diff --git a/dist/setup/index.js b/dist/setup/index.js index 59aa1ec3b..6a30bfa66 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -15557,23 +15557,15 @@ exports.AbortSignal = AbortSignal; /***/ }), /***/ 32206: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventAlgorithm_1 = __nccwpck_require__(28217); +exports.abort_add = abort_add; +exports.abort_remove = abort_remove; +exports.abort_signalAbort = abort_signalAbort; +const EventAlgorithm_1 = __nccwpck_require__(28217); /** * Adds an algorithm to the given abort signal. * @@ -15589,7 +15581,6 @@ function abort_add(algorithm, signal) { return; signal._abortAlgorithms.add(algorithm); } -exports.abort_add = abort_add; /** * Removes an algorithm from the given abort signal. * @@ -15603,14 +15594,12 @@ function abort_remove(algorithm, signal) { */ signal._abortAlgorithms.delete(algorithm); } -exports.abort_remove = abort_remove; /** * Signals abort on the given abort signal. * * @param signal - abort signal */ function abort_signalAbort(signal) { - var e_1, _a; /** * 1. If signal’s aborted flag is set, then return. * 2. Set signal’s aborted flag. @@ -15621,23 +15610,12 @@ function abort_signalAbort(signal) { if (signal._abortedFlag) return; signal._abortedFlag = true; - try { - for (var _b = __values(signal._abortAlgorithms), _c = _b.next(); !_c.done; _c = _b.next()) { - var algorithm = _c.value; - algorithm.call(signal); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + for (const algorithm of signal._abortAlgorithms) { + algorithm.call(signal); } signal._abortAlgorithms.clear(); - EventAlgorithm_1.event_fireAnEvent("abort", signal); + (0, EventAlgorithm_1.event_fireAnEvent)("abort", signal); } -exports.abort_signalAbort = abort_signalAbort; //# sourceMappingURL=AbortAlgorithm.js.map /***/ }), @@ -15648,7 +15626,8 @@ exports.abort_signalAbort = abort_signalAbort; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var ElementAlgorithm_1 = __nccwpck_require__(51849); +exports.attr_setAnExistingAttributeValue = attr_setAnExistingAttributeValue; +const ElementAlgorithm_1 = __nccwpck_require__(51849); /** * Changes the value of an existing attribute. * @@ -15664,10 +15643,9 @@ function attr_setAnExistingAttributeValue(attribute, value) { attribute._value = value; } else { - ElementAlgorithm_1.element_change(attribute, attribute._element, value); + (0, ElementAlgorithm_1.element_change)(attribute, attribute._element, value); } } -exports.attr_setAnExistingAttributeValue = attr_setAnExistingAttributeValue; //# sourceMappingURL=AttrAlgorithm.js.map /***/ }), @@ -15678,8 +15656,9 @@ exports.attr_setAnExistingAttributeValue = attr_setAnExistingAttributeValue; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var TreeAlgorithm_1 = __nccwpck_require__(16620); +exports.boundaryPoint_position = boundaryPoint_position; +const interfaces_1 = __nccwpck_require__(27305); +const TreeAlgorithm_1 = __nccwpck_require__(16620); /** * Defines the position of a boundary point relative to another. * @@ -15687,14 +15666,14 @@ var TreeAlgorithm_1 = __nccwpck_require__(16620); * @param relativeTo - a boundary point to compare to */ function boundaryPoint_position(bp, relativeTo) { - var nodeA = bp[0]; - var offsetA = bp[1]; - var nodeB = relativeTo[0]; - var offsetB = relativeTo[1]; + const nodeA = bp[0]; + const offsetA = bp[1]; + const nodeB = relativeTo[0]; + const offsetB = relativeTo[1]; /** * 1. Assert: nodeA and nodeB have the same root. */ - console.assert(TreeAlgorithm_1.tree_rootNode(nodeA) === TreeAlgorithm_1.tree_rootNode(nodeB), "Boundary points must share the same root node."); + console.assert((0, TreeAlgorithm_1.tree_rootNode)(nodeA) === (0, TreeAlgorithm_1.tree_rootNode)(nodeB), "Boundary points must share the same root node."); /** * 2. If nodeA is nodeB, then return equal if offsetA is offsetB, before * if offsetA is less than offsetB, and after if offsetA is greater than @@ -15716,8 +15695,8 @@ function boundaryPoint_position(bp, relativeTo) { * relative to (nodeA, offsetA) is before, return after, and if it is after, * return before. */ - if (TreeAlgorithm_1.tree_isFollowing(nodeB, nodeA)) { - var pos = boundaryPoint_position([nodeB, offsetB], [nodeA, offsetA]); + if ((0, TreeAlgorithm_1.tree_isFollowing)(nodeB, nodeA)) { + const pos = boundaryPoint_position([nodeB, offsetB], [nodeA, offsetA]); if (pos === interfaces_1.BoundaryPosition.Before) { return interfaces_1.BoundaryPosition.After; } @@ -15728,20 +15707,20 @@ function boundaryPoint_position(bp, relativeTo) { /** * 4. If nodeA is an ancestor of nodeB: */ - if (TreeAlgorithm_1.tree_isAncestorOf(nodeB, nodeA)) { + if ((0, TreeAlgorithm_1.tree_isAncestorOf)(nodeB, nodeA)) { /** * 4.1. Let child be nodeB. * 4.2. While child is not a child of nodeA, set child to its parent. * 4.3. If child’s index is less than offsetA, then return after. */ - var child = nodeB; - while (!TreeAlgorithm_1.tree_isChildOf(nodeA, child)) { + let child = nodeB; + while (!(0, TreeAlgorithm_1.tree_isChildOf)(nodeA, child)) { /* istanbul ignore else */ if (child._parent !== null) { child = child._parent; } } - if (TreeAlgorithm_1.tree_index(child) < offsetA) { + if ((0, TreeAlgorithm_1.tree_index)(child) < offsetA) { return interfaces_1.BoundaryPosition.After; } } @@ -15750,34 +15729,24 @@ function boundaryPoint_position(bp, relativeTo) { */ return interfaces_1.BoundaryPosition.Before; } -exports.boundaryPoint_position = boundaryPoint_position; //# sourceMappingURL=BoundaryPointAlgorithm.js.map /***/ }), /***/ 19461: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(65282); -var DOMException_1 = __nccwpck_require__(13166); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); -var DOMAlgorithm_1 = __nccwpck_require__(9628); +exports.characterData_replaceData = characterData_replaceData; +exports.characterData_substringData = characterData_substringData; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(65282); +const DOMException_1 = __nccwpck_require__(13166); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const MutationObserverAlgorithm_1 = __nccwpck_require__(78157); +const DOMAlgorithm_1 = __nccwpck_require__(9628); /** * Replaces character data. * @@ -15787,7 +15756,6 @@ var DOMAlgorithm_1 = __nccwpck_require__(9628); * @param data - new data */ function characterData_replaceData(node, offset, count, data) { - var e_1, _a; /** * 1. Let length be node’s length. * 2. If offset is greater than length, then throw an "IndexSizeError" @@ -15795,9 +15763,9 @@ function characterData_replaceData(node, offset, count, data) { * 3. If offset plus count is greater than length, then set count to length * minus offset. */ - var length = TreeAlgorithm_1.tree_nodeLength(node); + const length = (0, TreeAlgorithm_1.tree_nodeLength)(node); if (offset > length) { - throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); + throw new DOMException_1.IndexSizeError(`Offset exceeds character data length. Offset: ${offset}, Length: ${length}, Node is ${node.nodeName}.`); } if (offset + count > length) { count = length - offset; @@ -15807,7 +15775,7 @@ function characterData_replaceData(node, offset, count, data) { * node’s data, « », « », null, and null. */ if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueMutationRecord("characterData", node, null, null, node._data, [], [], null, null); + (0, MutationObserverAlgorithm_1.observer_queueMutationRecord)("characterData", node, null, null, node._data, [], [], null, null); } /** * 5. Insert data into node’s data after offset code units. @@ -15815,46 +15783,36 @@ function characterData_replaceData(node, offset, count, data) { * 7. Starting from delete offset code units, remove count code units from * node’s data. */ - var newData = node._data.substring(0, offset) + data + + const newData = node._data.substring(0, offset) + data + node._data.substring(offset + count); node._data = newData; - try { - /** - * 8. For each live range whose start node is node and start offset is - * greater than offset but less than or equal to offset plus count, set its - * start offset to offset. - * 9. For each live range whose end node is node and end offset is greater - * than offset but less than or equal to offset plus count, set its end - * offset to offset. - * 10. For each live range whose start node is node and start offset is - * greater than offset plus count, increase its start offset by data’s - * length and decrease it by count. - * 11. For each live range whose end node is node and end offset is greater - * than offset plus count, increase its end offset by data’s length and - * decrease it by count. - */ - for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var range = _c.value; - if (range._start[0] === node && range._start[1] > offset && range._start[1] <= offset + count) { - range._start[1] = offset; - } - if (range._end[0] === node && range._end[1] > offset && range._end[1] <= offset + count) { - range._end[1] = offset; - } - if (range._start[0] === node && range._start[1] > offset + count) { - range._start[1] += data.length - count; - } - if (range._end[0] === node && range._end[1] > offset + count) { - range._end[1] += data.length - count; - } + /** + * 8. For each live range whose start node is node and start offset is + * greater than offset but less than or equal to offset plus count, set its + * start offset to offset. + * 9. For each live range whose end node is node and end offset is greater + * than offset but less than or equal to offset plus count, set its end + * offset to offset. + * 10. For each live range whose start node is node and start offset is + * greater than offset plus count, increase its start offset by data’s + * length and decrease it by count. + * 11. For each live range whose end node is node and end offset is greater + * than offset plus count, increase its end offset by data’s length and + * decrease it by count. + */ + for (const range of DOMImpl_1.dom.rangeList) { + if (range._start[0] === node && range._start[1] > offset && range._start[1] <= offset + count) { + range._start[1] = offset; } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + if (range._end[0] === node && range._end[1] > offset && range._end[1] <= offset + count) { + range._end[1] = offset; + } + if (range._start[0] === node && range._start[1] > offset + count) { + range._start[1] += data.length - count; + } + if (range._end[0] === node && range._end[1] > offset + count) { + range._end[1] += data.length - count; } - finally { if (e_1) throw e_1.error; } } /** * 12. If node is a Text node and its parent is not null, run the child @@ -15862,11 +15820,10 @@ function characterData_replaceData(node, offset, count, data) { */ if (DOMImpl_1.dom.features.steps) { if (util_1.Guard.isTextNode(node) && node._parent !== null) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(node._parent); + (0, DOMAlgorithm_1.dom_runChildTextContentChangeSteps)(node._parent); } } } -exports.characterData_replaceData = characterData_replaceData; /** * Returns `count` number of characters from `node`'s data starting at * the given `offset`. @@ -15886,9 +15843,9 @@ function characterData_substringData(node, offset, count) { * 4. Return a string whose value is the code units from the offsetth code * unit to the offset+countth code unit in node’s data. */ - var length = TreeAlgorithm_1.tree_nodeLength(node); + const length = (0, TreeAlgorithm_1.tree_nodeLength)(node); if (offset > length) { - throw new DOMException_1.IndexSizeError("Offset exceeds character data length. Offset: " + offset + ", Length: " + length + ", Node is " + node.nodeName + "."); + throw new DOMException_1.IndexSizeError(`Offset exceeds character data length. Offset: ${offset}, Length: ${length}, Node is ${node.nodeName}.`); } if (offset + count > length) { return node._data.substr(offset); @@ -15897,7 +15854,6 @@ function characterData_substringData(node, offset, count) { return node._data.substr(offset, count); } } -exports.characterData_substringData = characterData_substringData; //# sourceMappingURL=CharacterDataAlgorithm.js.map /***/ }), @@ -15908,31 +15864,58 @@ exports.characterData_substringData = characterData_substringData; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImplementationImpl_1 = __nccwpck_require__(42197); -var WindowImpl_1 = __nccwpck_require__(69067); -var XMLDocumentImpl_1 = __nccwpck_require__(21685); -var DocumentImpl_1 = __nccwpck_require__(14333); -var AbortControllerImpl_1 = __nccwpck_require__(66461); -var AbortSignalImpl_1 = __nccwpck_require__(10022); -var DocumentTypeImpl_1 = __nccwpck_require__(3173); -var ElementImpl_1 = __nccwpck_require__(35975); -var DocumentFragmentImpl_1 = __nccwpck_require__(12585); -var ShadowRootImpl_1 = __nccwpck_require__(61911); -var AttrImpl_1 = __nccwpck_require__(13717); -var TextImpl_1 = __nccwpck_require__(42191); -var CDATASectionImpl_1 = __nccwpck_require__(23977); -var CommentImpl_1 = __nccwpck_require__(20930); -var ProcessingInstructionImpl_1 = __nccwpck_require__(99430); -var HTMLCollectionImpl_1 = __nccwpck_require__(93969); -var NodeListImpl_1 = __nccwpck_require__(43728); -var NodeListStaticImpl_1 = __nccwpck_require__(65306); -var NamedNodeMapImpl_1 = __nccwpck_require__(57206); -var RangeImpl_1 = __nccwpck_require__(50166); -var NodeIteratorImpl_1 = __nccwpck_require__(61997); -var TreeWalkerImpl_1 = __nccwpck_require__(89261); -var NodeFilterImpl_1 = __nccwpck_require__(12355); -var MutationRecordImpl_1 = __nccwpck_require__(6219); -var DOMTokenListImpl_1 = __nccwpck_require__(65096); +exports.create_domImplementation = create_domImplementation; +exports.create_window = create_window; +exports.create_xmlDocument = create_xmlDocument; +exports.create_document = create_document; +exports.create_abortController = create_abortController; +exports.create_abortSignal = create_abortSignal; +exports.create_documentType = create_documentType; +exports.create_element = create_element; +exports.create_htmlElement = create_htmlElement; +exports.create_htmlUnknownElement = create_htmlUnknownElement; +exports.create_documentFragment = create_documentFragment; +exports.create_shadowRoot = create_shadowRoot; +exports.create_attr = create_attr; +exports.create_text = create_text; +exports.create_cdataSection = create_cdataSection; +exports.create_comment = create_comment; +exports.create_processingInstruction = create_processingInstruction; +exports.create_htmlCollection = create_htmlCollection; +exports.create_nodeList = create_nodeList; +exports.create_nodeListStatic = create_nodeListStatic; +exports.create_namedNodeMap = create_namedNodeMap; +exports.create_range = create_range; +exports.create_nodeIterator = create_nodeIterator; +exports.create_treeWalker = create_treeWalker; +exports.create_nodeFilter = create_nodeFilter; +exports.create_mutationRecord = create_mutationRecord; +exports.create_domTokenList = create_domTokenList; +const DOMImplementationImpl_1 = __nccwpck_require__(42197); +const WindowImpl_1 = __nccwpck_require__(69067); +const XMLDocumentImpl_1 = __nccwpck_require__(21685); +const DocumentImpl_1 = __nccwpck_require__(14333); +const AbortControllerImpl_1 = __nccwpck_require__(66461); +const AbortSignalImpl_1 = __nccwpck_require__(10022); +const DocumentTypeImpl_1 = __nccwpck_require__(3173); +const ElementImpl_1 = __nccwpck_require__(35975); +const DocumentFragmentImpl_1 = __nccwpck_require__(12585); +const ShadowRootImpl_1 = __nccwpck_require__(61911); +const AttrImpl_1 = __nccwpck_require__(13717); +const TextImpl_1 = __nccwpck_require__(42191); +const CDATASectionImpl_1 = __nccwpck_require__(23977); +const CommentImpl_1 = __nccwpck_require__(20930); +const ProcessingInstructionImpl_1 = __nccwpck_require__(99430); +const HTMLCollectionImpl_1 = __nccwpck_require__(93969); +const NodeListImpl_1 = __nccwpck_require__(43728); +const NodeListStaticImpl_1 = __nccwpck_require__(65306); +const NamedNodeMapImpl_1 = __nccwpck_require__(57206); +const RangeImpl_1 = __nccwpck_require__(50166); +const NodeIteratorImpl_1 = __nccwpck_require__(61997); +const TreeWalkerImpl_1 = __nccwpck_require__(89261); +const NodeFilterImpl_1 = __nccwpck_require__(12355); +const MutationRecordImpl_1 = __nccwpck_require__(6219); +const DOMTokenListImpl_1 = __nccwpck_require__(65096); /** * Creates a `DOMImplementation`. * @@ -15941,42 +15924,36 @@ var DOMTokenListImpl_1 = __nccwpck_require__(65096); function create_domImplementation(document) { return DOMImplementationImpl_1.DOMImplementationImpl._create(document); } -exports.create_domImplementation = create_domImplementation; /** * Creates a `Window` node. */ function create_window() { return WindowImpl_1.WindowImpl._create(); } -exports.create_window = create_window; /** * Creates an `XMLDocument` node. */ function create_xmlDocument() { return new XMLDocumentImpl_1.XMLDocumentImpl(); } -exports.create_xmlDocument = create_xmlDocument; /** * Creates a `Document` node. */ function create_document() { return new DocumentImpl_1.DocumentImpl(); } -exports.create_document = create_document; /** * Creates an `AbortController`. */ function create_abortController() { return new AbortControllerImpl_1.AbortControllerImpl(); } -exports.create_abortController = create_abortController; /** * Creates an `AbortSignal`. */ function create_abortSignal() { return AbortSignalImpl_1.AbortSignalImpl._create(); } -exports.create_abortSignal = create_abortSignal; /** * Creates a `DocumentType` node. * @@ -15988,7 +15965,6 @@ exports.create_abortSignal = create_abortSignal; function create_documentType(document, name, publicId, systemId) { return DocumentTypeImpl_1.DocumentTypeImpl._create(document, name, publicId, systemId); } -exports.create_documentType = create_documentType; /** * Creates a new `Element` node. * @@ -16000,7 +15976,6 @@ exports.create_documentType = create_documentType; function create_element(document, localName, namespace, prefix) { return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); } -exports.create_element = create_element; /** * Creates a new `HTMLElement` node. * @@ -16013,7 +15988,6 @@ function create_htmlElement(document, localName, namespace, prefix) { // TODO: Implement in HTML DOM return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); } -exports.create_htmlElement = create_htmlElement; /** * Creates a new `HTMLUnknownElement` node. * @@ -16026,7 +16000,6 @@ function create_htmlUnknownElement(document, localName, namespace, prefix) { // TODO: Implement in HTML DOM return ElementImpl_1.ElementImpl._create(document, localName, namespace, prefix); } -exports.create_htmlUnknownElement = create_htmlUnknownElement; /** * Creates a new `DocumentFragment` node. * @@ -16035,7 +16008,6 @@ exports.create_htmlUnknownElement = create_htmlUnknownElement; function create_documentFragment(document) { return DocumentFragmentImpl_1.DocumentFragmentImpl._create(document); } -exports.create_documentFragment = create_documentFragment; /** * Creates a new `ShadowRoot` node. * @@ -16045,7 +16017,6 @@ exports.create_documentFragment = create_documentFragment; function create_shadowRoot(document, host) { return ShadowRootImpl_1.ShadowRootImpl._create(document, host); } -exports.create_shadowRoot = create_shadowRoot; /** * Creates a new `Attr` node. * @@ -16055,7 +16026,6 @@ exports.create_shadowRoot = create_shadowRoot; function create_attr(document, localName) { return AttrImpl_1.AttrImpl._create(document, localName); } -exports.create_attr = create_attr; /** * Creates a new `Text` node. * @@ -16065,7 +16035,6 @@ exports.create_attr = create_attr; function create_text(document, data) { return TextImpl_1.TextImpl._create(document, data); } -exports.create_text = create_text; /** * Creates a new `CDATASection` node. * @@ -16075,7 +16044,6 @@ exports.create_text = create_text; function create_cdataSection(document, data) { return CDATASectionImpl_1.CDATASectionImpl._create(document, data); } -exports.create_cdataSection = create_cdataSection; /** * Creates a new `Comment` node. * @@ -16085,7 +16053,6 @@ exports.create_cdataSection = create_cdataSection; function create_comment(document, data) { return CommentImpl_1.CommentImpl._create(document, data); } -exports.create_comment = create_comment; /** * Creates a new `ProcessingInstruction` node. * @@ -16096,18 +16063,15 @@ exports.create_comment = create_comment; function create_processingInstruction(document, target, data) { return ProcessingInstructionImpl_1.ProcessingInstructionImpl._create(document, target, data); } -exports.create_processingInstruction = create_processingInstruction; /** * Creates a new `HTMLCollection`. * * @param root - root node * @param filter - node filter */ -function create_htmlCollection(root, filter) { - if (filter === void 0) { filter = (function () { return true; }); } +function create_htmlCollection(root, filter = (() => true)) { return HTMLCollectionImpl_1.HTMLCollectionImpl._create(root, filter); } -exports.create_htmlCollection = create_htmlCollection; /** * Creates a new live `NodeList`. * @@ -16116,7 +16080,6 @@ exports.create_htmlCollection = create_htmlCollection; function create_nodeList(root) { return NodeListImpl_1.NodeListImpl._create(root); } -exports.create_nodeList = create_nodeList; /** * Creates a new static `NodeList`. * @@ -16126,7 +16089,6 @@ exports.create_nodeList = create_nodeList; function create_nodeListStatic(root, items) { return NodeListStaticImpl_1.NodeListStaticImpl._create(root, items); } -exports.create_nodeListStatic = create_nodeListStatic; /** * Creates a new `NamedNodeMap`. * @@ -16135,7 +16097,6 @@ exports.create_nodeListStatic = create_nodeListStatic; function create_namedNodeMap(element) { return NamedNodeMapImpl_1.NamedNodeMapImpl._create(element); } -exports.create_namedNodeMap = create_namedNodeMap; /** * Creates a new `Range`. * @@ -16145,7 +16106,6 @@ exports.create_namedNodeMap = create_namedNodeMap; function create_range(start, end) { return RangeImpl_1.RangeImpl._create(start, end); } -exports.create_range = create_range; /** * Creates a new `NodeIterator`. * @@ -16157,7 +16117,6 @@ exports.create_range = create_range; function create_nodeIterator(root, reference, pointerBeforeReference) { return NodeIteratorImpl_1.NodeIteratorImpl._create(root, reference, pointerBeforeReference); } -exports.create_nodeIterator = create_nodeIterator; /** * Creates a new `TreeWalker`. * @@ -16167,14 +16126,12 @@ exports.create_nodeIterator = create_nodeIterator; function create_treeWalker(root, current) { return TreeWalkerImpl_1.TreeWalkerImpl._create(root, current); } -exports.create_treeWalker = create_treeWalker; /** * Creates a new `NodeFilter`. */ function create_nodeFilter() { return NodeFilterImpl_1.NodeFilterImpl._create(); } -exports.create_nodeFilter = create_nodeFilter; /** * Creates a new `MutationRecord`. * @@ -16197,7 +16154,6 @@ exports.create_nodeFilter = create_nodeFilter; function create_mutationRecord(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { return MutationRecordImpl_1.MutationRecordImpl._create(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); } -exports.create_mutationRecord = create_mutationRecord; /** * Creates a new `DOMTokenList`. * @@ -16207,7 +16163,6 @@ exports.create_mutationRecord = create_mutationRecord; function create_domTokenList(element, attribute) { return DOMTokenListImpl_1.DOMTokenListImpl._create(element, attribute); } -exports.create_domTokenList = create_domTokenList; //# sourceMappingURL=CreateAlgorithm.js.map /***/ }), @@ -16218,17 +16173,26 @@ exports.create_domTokenList = create_domTokenList; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var PotentialCustomElementName = /[a-z]([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*/; -var NamesWithHyphen = new Set(['annotation-xml', 'color-profile', +exports.customElement_isValidCustomElementName = customElement_isValidCustomElementName; +exports.customElement_isValidElementName = customElement_isValidElementName; +exports.customElement_isVoidElementName = customElement_isVoidElementName; +exports.customElement_isValidShadowHostName = customElement_isValidShadowHostName; +exports.customElement_enqueueACustomElementUpgradeReaction = customElement_enqueueACustomElementUpgradeReaction; +exports.customElement_enqueueACustomElementCallbackReaction = customElement_enqueueACustomElementCallbackReaction; +exports.customElement_upgrade = customElement_upgrade; +exports.customElement_tryToUpgrade = customElement_tryToUpgrade; +exports.customElement_lookUpACustomElementDefinition = customElement_lookUpACustomElementDefinition; +const PotentialCustomElementName = /[a-z]([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*/; +const NamesWithHyphen = new Set(['annotation-xml', 'color-profile', 'font-face', 'font-face-src', 'font-face-uri', 'font-face-format', 'font-face-name', 'missing-glyph']); -var ElementNames = new Set(['article', 'aside', 'blockquote', +const ElementNames = new Set(['article', 'aside', 'blockquote', 'body', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', 'nav', 'p', 'section', 'span']); -var VoidElementNames = new Set(['area', 'base', 'basefont', +const VoidElementNames = new Set(['area', 'base', 'basefont', 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); -var ShadowHostNames = new Set(['article', 'aside', 'blockquote', 'body', +const ShadowHostNames = new Set(['article', 'aside', 'blockquote', 'body', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', 'nav', 'p', 'section', 'span']); /** @@ -16243,7 +16207,6 @@ function customElement_isValidCustomElementName(name) { return false; return true; } -exports.customElement_isValidCustomElementName = customElement_isValidCustomElementName; /** * Determines if the given string is a valid element name. * @@ -16252,7 +16215,6 @@ exports.customElement_isValidCustomElementName = customElement_isValidCustomElem function customElement_isValidElementName(name) { return (ElementNames.has(name)); } -exports.customElement_isValidElementName = customElement_isValidElementName; /** * Determines if the given string is a void element name. * @@ -16261,7 +16223,6 @@ exports.customElement_isValidElementName = customElement_isValidElementName; function customElement_isVoidElementName(name) { return (VoidElementNames.has(name)); } -exports.customElement_isVoidElementName = customElement_isVoidElementName; /** * Determines if the given string is a valid shadow host element name. * @@ -16270,7 +16231,6 @@ exports.customElement_isVoidElementName = customElement_isVoidElementName; function customElement_isValidShadowHostName(name) { return (ShadowHostNames.has(name)); } -exports.customElement_isValidShadowHostName = customElement_isValidShadowHostName; /** * Enqueues an upgrade reaction for a custom element. * @@ -16280,7 +16240,6 @@ exports.customElement_isValidShadowHostName = customElement_isValidShadowHostNam function customElement_enqueueACustomElementUpgradeReaction(element, definition) { // TODO: Implement in HTML DOM } -exports.customElement_enqueueACustomElementUpgradeReaction = customElement_enqueueACustomElementUpgradeReaction; /** * Enqueues a callback reaction for a custom element. * @@ -16291,7 +16250,6 @@ exports.customElement_enqueueACustomElementUpgradeReaction = customElement_enque function customElement_enqueueACustomElementCallbackReaction(element, callbackName, args) { // TODO: Implement in HTML DOM } -exports.customElement_enqueueACustomElementCallbackReaction = customElement_enqueueACustomElementCallbackReaction; /** * Upgrade a custom element. * @@ -16300,7 +16258,6 @@ exports.customElement_enqueueACustomElementCallbackReaction = customElement_enqu function customElement_upgrade(definition, element) { // TODO: Implement in HTML DOM } -exports.customElement_upgrade = customElement_upgrade; /** * Tries to upgrade a custom element. * @@ -16309,7 +16266,6 @@ exports.customElement_upgrade = customElement_upgrade; function customElement_tryToUpgrade(element) { // TODO: Implement in HTML DOM } -exports.customElement_tryToUpgrade = customElement_tryToUpgrade; /** * Looks up a custom element definition. * @@ -16322,33 +16278,31 @@ function customElement_lookUpACustomElementDefinition(document, namespace, local // TODO: Implement in HTML DOM return null; } -exports.customElement_lookUpACustomElementDefinition = customElement_lookUpACustomElementDefinition; //# sourceMappingURL=CustomElementAlgorithm.js.map /***/ }), /***/ 9628: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var util_1 = __nccwpck_require__(65282); -var ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); -var supportedTokens = new Map(); +exports.dom_runRemovingSteps = dom_runRemovingSteps; +exports.dom_runCloningSteps = dom_runCloningSteps; +exports.dom_runAdoptingSteps = dom_runAdoptingSteps; +exports.dom_runAttributeChangeSteps = dom_runAttributeChangeSteps; +exports.dom_runInsertionSteps = dom_runInsertionSteps; +exports.dom_runNodeIteratorPreRemovingSteps = dom_runNodeIteratorPreRemovingSteps; +exports.dom_hasSupportedTokens = dom_hasSupportedTokens; +exports.dom_getSupportedTokens = dom_getSupportedTokens; +exports.dom_runEventConstructingSteps = dom_runEventConstructingSteps; +exports.dom_runChildTextContentChangeSteps = dom_runChildTextContentChangeSteps; +const DOMImpl_1 = __nccwpck_require__(14177); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const util_1 = __nccwpck_require__(65282); +const ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); +const supportedTokens = new Map(); /** * Runs removing steps for node. * @@ -16358,7 +16312,6 @@ var supportedTokens = new Map(); function dom_runRemovingSteps(removedNode, oldParent) { // No steps defined } -exports.dom_runRemovingSteps = dom_runRemovingSteps; /** * Runs cloning steps for node. * @@ -16370,7 +16323,6 @@ exports.dom_runRemovingSteps = dom_runRemovingSteps; function dom_runCloningSteps(copy, node, document, cloneChildrenFlag) { // No steps defined } -exports.dom_runCloningSteps = dom_runCloningSteps; /** * Runs adopting steps for node. * @@ -16380,7 +16332,6 @@ exports.dom_runCloningSteps = dom_runCloningSteps; function dom_runAdoptingSteps(node, oldDocument) { // No steps defined } -exports.dom_runAdoptingSteps = dom_runAdoptingSteps; /** * Runs attribute change steps for an element node. * @@ -16391,29 +16342,17 @@ exports.dom_runAdoptingSteps = dom_runAdoptingSteps; * @param namespace - attribute's namespace */ function dom_runAttributeChangeSteps(element, localName, oldValue, value, namespace) { - var e_1, _a; // run default steps if (DOMImpl_1.dom.features.slots) { updateASlotablesName.call(element, element, localName, oldValue, value, namespace); updateASlotsName.call(element, element, localName, oldValue, value, namespace); } updateAnElementID.call(element, element, localName, value, namespace); - try { - // run custom steps - for (var _b = __values(element._attributeChangeSteps), _c = _b.next(); !_c.done; _c = _b.next()) { - var step = _c.value; - step.call(element, element, localName, oldValue, value, namespace); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + // run custom steps + for (const step of element._attributeChangeSteps) { + step.call(element, element, localName, oldValue, value, namespace); } } -exports.dom_runAttributeChangeSteps = dom_runAttributeChangeSteps; /** * Runs insertion steps for a node. * @@ -16422,7 +16361,6 @@ exports.dom_runAttributeChangeSteps = dom_runAttributeChangeSteps; function dom_runInsertionSteps(insertedNode) { // No steps defined } -exports.dom_runInsertionSteps = dom_runInsertionSteps; /** * Runs pre-removing steps for a node iterator and node. * @@ -16432,7 +16370,6 @@ exports.dom_runInsertionSteps = dom_runInsertionSteps; function dom_runNodeIteratorPreRemovingSteps(nodeIterator, toBeRemoved) { removeNodeIterator.call(nodeIterator, nodeIterator, toBeRemoved); } -exports.dom_runNodeIteratorPreRemovingSteps = dom_runNodeIteratorPreRemovingSteps; /** * Determines if there are any supported tokens defined for the given * attribute name. @@ -16442,7 +16379,6 @@ exports.dom_runNodeIteratorPreRemovingSteps = dom_runNodeIteratorPreRemovingStep function dom_hasSupportedTokens(attributeName) { return supportedTokens.has(attributeName); } -exports.dom_hasSupportedTokens = dom_hasSupportedTokens; /** * Returns the set of supported tokens defined for the given attribute name. * @@ -16451,7 +16387,6 @@ exports.dom_hasSupportedTokens = dom_hasSupportedTokens; function dom_getSupportedTokens(attributeName) { return supportedTokens.get(attributeName) || new Set(); } -exports.dom_getSupportedTokens = dom_getSupportedTokens; /** * Runs event construction steps. * @@ -16460,7 +16395,6 @@ exports.dom_getSupportedTokens = dom_getSupportedTokens; function dom_runEventConstructingSteps(event) { // No steps defined } -exports.dom_runEventConstructingSteps = dom_runEventConstructingSteps; /** * Runs child text content change steps for a parent node. * @@ -16469,7 +16403,6 @@ exports.dom_runEventConstructingSteps = dom_runEventConstructingSteps; function dom_runChildTextContentChangeSteps(parent) { // No steps defined } -exports.dom_runChildTextContentChangeSteps = dom_runChildTextContentChangeSteps; /** * Defines pre-removing steps for a node iterator. */ @@ -16479,7 +16412,7 @@ function removeNodeIterator(nodeIterator, toBeRemovedNode) { * reference, or toBeRemovedNode is nodeIterator’s root, then return. */ if (toBeRemovedNode === nodeIterator._root || - !TreeAlgorithm_1.tree_isAncestorOf(nodeIterator._reference, toBeRemovedNode, true)) { + !(0, TreeAlgorithm_1.tree_isAncestorOf)(nodeIterator._reference, toBeRemovedNode, true)) { return; } /** @@ -16492,10 +16425,10 @@ function removeNodeIterator(nodeIterator, toBeRemovedNode) { * descendant of toBeRemovedNode, and null if there is no such node. */ while (true) { - var nextNode = TreeAlgorithm_1.tree_getFollowingNode(nodeIterator._root, toBeRemovedNode); + const nextNode = (0, TreeAlgorithm_1.tree_getFollowingNode)(nodeIterator._root, toBeRemovedNode); if (nextNode !== null && - TreeAlgorithm_1.tree_isDescendantOf(nodeIterator._root, nextNode, true) && - !TreeAlgorithm_1.tree_isDescendantOf(toBeRemovedNode, nextNode, true)) { + (0, TreeAlgorithm_1.tree_isDescendantOf)(nodeIterator._root, nextNode, true) && + !(0, TreeAlgorithm_1.tree_isDescendantOf)(toBeRemovedNode, nextNode, true)) { /** * 2.2. If next is non-null, then set nodeIterator’s reference to next * and return. @@ -16524,14 +16457,14 @@ function removeNodeIterator(nodeIterator, toBeRemovedNode) { } } else { - var referenceNode = toBeRemovedNode._previousSibling; - var childNode = TreeAlgorithm_1.tree_getFirstDescendantNode(toBeRemovedNode._previousSibling, true, false); + let referenceNode = toBeRemovedNode._previousSibling; + let childNode = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(toBeRemovedNode._previousSibling, true, false); while (childNode !== null) { if (childNode !== null) { referenceNode = childNode; } // loop through to get the last descendant node - childNode = TreeAlgorithm_1.tree_getNextDescendantNode(toBeRemovedNode._previousSibling, childNode, true, false); + childNode = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(toBeRemovedNode._previousSibling, childNode, true, false); } nodeIterator._reference = referenceNode; } @@ -16563,7 +16496,7 @@ function updateASlotsName(element, localName, oldValue, value, namespace) { else { element._name = value; } - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(element)); + (0, ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree)((0, TreeAlgorithm_1.tree_rootNode)(element)); } } /** @@ -16595,10 +16528,10 @@ function updateASlotablesName(element, localName, oldValue, value, namespace) { else { element._name = value; } - if (ShadowTreeAlgorithm_1.shadowTree_isAssigned(element)) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotables(element._assignedSlot); + if ((0, ShadowTreeAlgorithm_1.shadowTree_isAssigned)(element)) { + (0, ShadowTreeAlgorithm_1.shadowTree_assignSlotables)(element._assignedSlot); } - ShadowTreeAlgorithm_1.shadowTree_assignASlot(element); + (0, ShadowTreeAlgorithm_1.shadowTree_assignASlot)(element); } } /** @@ -16628,9 +16561,12 @@ function updateAnElementID(element, localName, value, namespace) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var OrderedSetAlgorithm_1 = __nccwpck_require__(53670); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var ElementAlgorithm_1 = __nccwpck_require__(51849); +exports.tokenList_validationSteps = tokenList_validationSteps; +exports.tokenList_updateSteps = tokenList_updateSteps; +exports.tokenList_serializeSteps = tokenList_serializeSteps; +const OrderedSetAlgorithm_1 = __nccwpck_require__(53670); +const DOMAlgorithm_1 = __nccwpck_require__(9628); +const ElementAlgorithm_1 = __nccwpck_require__(51849); /** * Validates a given token against the supported tokens defined for the given * token lists' associated attribute. @@ -16646,12 +16582,11 @@ function tokenList_validationSteps(tokenList, token) { * 3. If lowercase token is present in supported tokens, return true. * 4. Return false. */ - if (!DOMAlgorithm_1.dom_hasSupportedTokens(tokenList._attribute._localName)) { - throw new TypeError("There are no supported tokens defined for attribute name: '" + tokenList._attribute._localName + "'."); + if (!(0, DOMAlgorithm_1.dom_hasSupportedTokens)(tokenList._attribute._localName)) { + throw new TypeError(`There are no supported tokens defined for attribute name: '${tokenList._attribute._localName}'.`); } - return DOMAlgorithm_1.dom_getSupportedTokens(tokenList._attribute._localName).has(token.toLowerCase()); + return (0, DOMAlgorithm_1.dom_getSupportedTokens)(tokenList._attribute._localName).has(token.toLowerCase()); } -exports.tokenList_validationSteps = tokenList_validationSteps; /** * Updates the value of the token lists' associated attribute. * @@ -16669,9 +16604,8 @@ function tokenList_updateSteps(tokenList) { tokenList._tokenSet.size === 0) { return; } - ElementAlgorithm_1.element_setAnAttributeValue(tokenList._element, tokenList._attribute._localName, OrderedSetAlgorithm_1.orderedSet_serialize(tokenList._tokenSet)); + (0, ElementAlgorithm_1.element_setAnAttributeValue)(tokenList._element, tokenList._attribute._localName, (0, OrderedSetAlgorithm_1.orderedSet_serialize)(tokenList._tokenSet)); } -exports.tokenList_updateSteps = tokenList_updateSteps; /** * Gets the value of the token lists' associated attribute. * @@ -16683,56 +16617,31 @@ function tokenList_serializeSteps(tokenList) { * running get an attribute value given the associated element and the * associated attribute’s local name. */ - return ElementAlgorithm_1.element_getAnAttributeValue(tokenList._element, tokenList._attribute._localName); + return (0, ElementAlgorithm_1.element_getAnAttributeValue)(tokenList._element, tokenList._attribute._localName); } -exports.tokenList_serializeSteps = tokenList_serializeSteps; //# sourceMappingURL=DOMTokenListAlgorithm.js.map /***/ }), /***/ 12793: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(65282); -var util_2 = __nccwpck_require__(76195); -var ElementImpl_1 = __nccwpck_require__(35975); -var CustomElementAlgorithm_1 = __nccwpck_require__(35648); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var NamespaceAlgorithm_1 = __nccwpck_require__(35856); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var ElementAlgorithm_1 = __nccwpck_require__(51849); -var MutationAlgorithm_1 = __nccwpck_require__(45463); +exports.document_elementInterface = document_elementInterface; +exports.document_internalCreateElementNS = document_internalCreateElementNS; +exports.document_adopt = document_adopt; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(65282); +const util_2 = __nccwpck_require__(76195); +const ElementImpl_1 = __nccwpck_require__(35975); +const CustomElementAlgorithm_1 = __nccwpck_require__(35648); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const NamespaceAlgorithm_1 = __nccwpck_require__(35856); +const DOMAlgorithm_1 = __nccwpck_require__(9628); +const ElementAlgorithm_1 = __nccwpck_require__(51849); +const MutationAlgorithm_1 = __nccwpck_require__(45463); /** * Returns an element interface for the given name and namespace. * @@ -16742,7 +16651,6 @@ var MutationAlgorithm_1 = __nccwpck_require__(45463); function document_elementInterface(name, namespace) { return ElementImpl_1.ElementImpl; } -exports.document_elementInterface = document_elementInterface; /** * Creates a new element node. * See: https://dom.spec.whatwg.org/#internal-createelementns-steps @@ -16762,19 +16670,18 @@ function document_internalCreateElementNS(document, namespace, qualifiedName, op * 4. Return the result of creating an element given document, localName, * namespace, prefix, is, and with the synchronous custom elements flag set. */ - var _a = __read(NamespaceAlgorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; - var is = null; + const [ns, prefix, localName] = (0, NamespaceAlgorithm_1.namespace_validateAndExtract)(namespace, qualifiedName); + let is = null; if (options !== undefined) { - if (util_2.isString(options)) { + if ((0, util_2.isString)(options)) { is = options; } else { is = options.is; } } - return ElementAlgorithm_1.element_createAnElement(document, localName, ns, prefix, is, true); + return (0, ElementAlgorithm_1.element_createAnElement)(document, localName, ns, prefix, is, true); } -exports.document_internalCreateElementNS = document_internalCreateElementNS; /** * Removes `node` and its subtree from its document and changes * its owner document to `document` so that it can be inserted @@ -16784,7 +16691,6 @@ exports.document_internalCreateElementNS = document_internalCreateElementNS; * @param document - document to receive the node and its subtree */ function document_adopt(node, document) { - var e_1, _a; // Optimize for common case of inserting a fresh node if (node._nodeDocument === document && node._parent === null) { return; @@ -16793,9 +16699,9 @@ function document_adopt(node, document) { * 1. Let oldDocument be node’s node document. * 2. If node’s parent is not null, remove node from its parent. */ - var oldDocument = node._nodeDocument; + const oldDocument = node._nodeDocument; if (node._parent) - MutationAlgorithm_1.mutation_remove(node, node._parent); + (0, MutationAlgorithm_1.mutation_remove)(node, node._parent); /** * 3. If document is not oldDocument, then: */ @@ -16804,7 +16710,7 @@ function document_adopt(node, document) { * 3.1. For each inclusiveDescendant in node’s shadow-including inclusive * descendants: */ - var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, true); + let inclusiveDescendant = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(node, true, true); while (inclusiveDescendant !== null) { /** * 3.1.1. Set inclusiveDescendant’s node document to document. @@ -16814,18 +16720,8 @@ function document_adopt(node, document) { */ inclusiveDescendant._nodeDocument = document; if (util_1.Guard.isElementNode(inclusiveDescendant)) { - try { - for (var _b = (e_1 = void 0, __values(inclusiveDescendant._attributeList._asArray())), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - attr._nodeDocument = document; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + for (const attr of inclusiveDescendant._attributeList._asArray()) { + attr._nodeDocument = document; } } /** @@ -16838,7 +16734,7 @@ function document_adopt(node, document) { if (DOMImpl_1.dom.features.customElements) { if (util_1.Guard.isElementNode(inclusiveDescendant) && inclusiveDescendant._customElementState === "custom") { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "adoptedCallback", [oldDocument, document]); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(inclusiveDescendant, "adoptedCallback", [oldDocument, document]); } } /** @@ -16847,13 +16743,12 @@ function document_adopt(node, document) { * adopting steps with inclusiveDescendant and oldDocument. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAdoptingSteps(inclusiveDescendant, oldDocument); + (0, DOMAlgorithm_1.dom_runAdoptingSteps)(inclusiveDescendant, oldDocument); } - inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, inclusiveDescendant, true, true); + inclusiveDescendant = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(node, inclusiveDescendant, true, true); } } } -exports.document_adopt = document_adopt; //# sourceMappingURL=DocumentAlgorithm.js.map /***/ }), @@ -16864,16 +16759,30 @@ exports.document_adopt = document_adopt; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var infra_1 = __nccwpck_require__(84251); -var util_1 = __nccwpck_require__(65282); -var DOMException_1 = __nccwpck_require__(13166); -var CreateAlgorithm_1 = __nccwpck_require__(57339); -var CustomElementAlgorithm_1 = __nccwpck_require__(35648); -var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var MutationAlgorithm_1 = __nccwpck_require__(45463); -var DocumentAlgorithm_1 = __nccwpck_require__(12793); +exports.element_has = element_has; +exports.element_change = element_change; +exports.element_append = element_append; +exports.element_remove = element_remove; +exports.element_replace = element_replace; +exports.element_getAnAttributeByName = element_getAnAttributeByName; +exports.element_getAnAttributeByNamespaceAndLocalName = element_getAnAttributeByNamespaceAndLocalName; +exports.element_getAnAttributeValue = element_getAnAttributeValue; +exports.element_setAnAttribute = element_setAnAttribute; +exports.element_setAnAttributeValue = element_setAnAttributeValue; +exports.element_removeAnAttributeByName = element_removeAnAttributeByName; +exports.element_removeAnAttributeByNamespaceAndLocalName = element_removeAnAttributeByNamespaceAndLocalName; +exports.element_createAnElement = element_createAnElement; +exports.element_insertAdjacent = element_insertAdjacent; +const DOMImpl_1 = __nccwpck_require__(14177); +const infra_1 = __nccwpck_require__(84251); +const util_1 = __nccwpck_require__(65282); +const DOMException_1 = __nccwpck_require__(13166); +const CreateAlgorithm_1 = __nccwpck_require__(57339); +const CustomElementAlgorithm_1 = __nccwpck_require__(35648); +const MutationObserverAlgorithm_1 = __nccwpck_require__(78157); +const DOMAlgorithm_1 = __nccwpck_require__(9628); +const MutationAlgorithm_1 = __nccwpck_require__(45463); +const DocumentAlgorithm_1 = __nccwpck_require__(12793); /** * Determines whether the element's attribute list contains the given * attribute. @@ -16887,7 +16796,6 @@ function element_has(attribute, element) { */ return element._attributeList._asArray().indexOf(attribute) !== -1; } -exports.element_has = element_has; /** * Changes the value of an attribute node. * @@ -16901,7 +16809,7 @@ function element_change(attribute, element, value) { * local name, attribute’s namespace, and attribute’s value. */ if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); + (0, MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord)(element, attribute._localName, attribute._namespace, attribute._value); } /** * 2. If element is custom, then enqueue a custom element callback reaction @@ -16911,7 +16819,7 @@ function element_change(attribute, element, value) { */ if (DOMImpl_1.dom.features.customElements) { if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, value, attribute._namespace]); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(element, "attributeChangedCallback", [attribute._localName, attribute._value, value, attribute._namespace]); } } /** @@ -16920,11 +16828,10 @@ function element_change(attribute, element, value) { * 4. Set attribute’s value to value. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, value, attribute._namespace); + (0, DOMAlgorithm_1.dom_runAttributeChangeSteps)(element, attribute._localName, attribute._value, value, attribute._namespace); } attribute._value = value; } -exports.element_change = element_change; /** * Appends an attribute to an element node. * @@ -16937,7 +16844,7 @@ function element_append(attribute, element) { * local name, attribute’s namespace, and null. */ if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, null); + (0, MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord)(element, attribute._localName, attribute._namespace, null); } /** * 2. If element is custom, then enqueue a custom element callback reaction @@ -16947,7 +16854,7 @@ function element_append(attribute, element) { */ if (DOMImpl_1.dom.features.customElements) { if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, null, attribute._value, attribute._namespace]); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(element, "attributeChangedCallback", [attribute._localName, null, attribute._value, attribute._namespace]); } } /** @@ -16955,7 +16862,7 @@ function element_append(attribute, element) { * null, attribute’s value, and attribute’s namespace. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, null, attribute._value, attribute._namespace); + (0, DOMAlgorithm_1.dom_runAttributeChangeSteps)(element, attribute._localName, null, attribute._value, attribute._namespace); } /** * 4. Append attribute to element’s attribute list. @@ -16969,7 +16876,6 @@ function element_append(attribute, element) { element._nodeDocument._hasNamespaces = true; } } -exports.element_append = element_append; /** * Removes an attribute from an element node. * @@ -16982,7 +16888,7 @@ function element_remove(attribute, element) { * local name, attribute’s namespace, and attribute’s value. */ if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, attribute._localName, attribute._namespace, attribute._value); + (0, MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord)(element, attribute._localName, attribute._namespace, attribute._value); } /** * 2. If element is custom, then enqueue a custom element callback reaction @@ -16992,7 +16898,7 @@ function element_remove(attribute, element) { */ if (DOMImpl_1.dom.features.customElements) { if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [attribute._localName, attribute._value, null, attribute._namespace]); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(element, "attributeChangedCallback", [attribute._localName, attribute._value, null, attribute._namespace]); } } /** @@ -17000,17 +16906,16 @@ function element_remove(attribute, element) { * attribute’s value, null, and attribute’s namespace. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, attribute._localName, attribute._value, null, attribute._namespace); + (0, DOMAlgorithm_1.dom_runAttributeChangeSteps)(element, attribute._localName, attribute._value, null, attribute._namespace); } /** * 3. Remove attribute from element’s attribute list. * 5. Set attribute’s element to null. */ - var index = element._attributeList._asArray().indexOf(attribute); + const index = element._attributeList._asArray().indexOf(attribute); element._attributeList._asArray().splice(index, 1); attribute._element = null; } -exports.element_remove = element_remove; /** * Replaces an attribute with another of an element node. * @@ -17024,7 +16929,7 @@ function element_replace(oldAttr, newAttr, element) { * local name, oldAttr’s namespace, and oldAttr’s value. */ if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord(element, oldAttr._localName, oldAttr._namespace, oldAttr._value); + (0, MutationObserverAlgorithm_1.observer_queueAttributeMutationRecord)(element, oldAttr._localName, oldAttr._namespace, oldAttr._value); } /** * 2. If element is custom, then enqueue a custom element callback reaction @@ -17034,7 +16939,7 @@ function element_replace(oldAttr, newAttr, element) { */ if (DOMImpl_1.dom.features.customElements) { if (util_1.Guard.isCustomElementNode(element)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(element, "attributeChangedCallback", [oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace]); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(element, "attributeChangedCallback", [oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace]); } } /** @@ -17042,14 +16947,14 @@ function element_replace(oldAttr, newAttr, element) { * oldAttr’s value, newAttr’s value, and oldAttr’s namespace. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runAttributeChangeSteps(element, oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace); + (0, DOMAlgorithm_1.dom_runAttributeChangeSteps)(element, oldAttr._localName, oldAttr._value, newAttr._value, oldAttr._namespace); } /** * 4. Replace oldAttr by newAttr in element’s attribute list. * 5. Set oldAttr’s element to null. * 6. Set newAttr’s element to element. */ - var index = element._attributeList._asArray().indexOf(oldAttr); + const index = element._attributeList._asArray().indexOf(oldAttr); if (index !== -1) { element._attributeList._asArray()[index] = newAttr; } @@ -17061,7 +16966,6 @@ function element_replace(oldAttr, newAttr, element) { element._nodeDocument._hasNamespaces = true; } } -exports.element_replace = element_replace; /** * Retrieves an attribute with the given name from an element node. * @@ -17078,9 +16982,8 @@ function element_getAnAttributeByName(qualifiedName, element) { if (element._namespace === infra_1.namespace.HTML && element._nodeDocument._type === "html") { qualifiedName = qualifiedName.toLowerCase(); } - return element._attributeList._asArray().find(function (attr) { return attr._qualifiedName === qualifiedName; }) || null; + return element._attributeList._asArray().find(attr => attr._qualifiedName === qualifiedName) || null; } -exports.element_getAnAttributeByName = element_getAnAttributeByName; /** * Retrieves an attribute with the given namespace and local name from an * element node. @@ -17095,10 +16998,9 @@ function element_getAnAttributeByNamespaceAndLocalName(namespace, localName, ele * 2. Return the attribute in element’s attribute list whose namespace is * namespace and local name is localName, if any, and null otherwise. */ - var ns = namespace || null; - return element._attributeList._asArray().find(function (attr) { return attr._namespace === ns && attr._localName === localName; }) || null; + const ns = namespace || null; + return element._attributeList._asArray().find(attr => attr._namespace === ns && attr._localName === localName) || null; } -exports.element_getAnAttributeByNamespaceAndLocalName = element_getAnAttributeByNamespaceAndLocalName; /** * Retrieves an attribute's value with the given name namespace and local * name from an element node. @@ -17107,21 +17009,19 @@ exports.element_getAnAttributeByNamespaceAndLocalName = element_getAnAttributeBy * @param localName - an attribute local name * @param namespace - an attribute namespace */ -function element_getAnAttributeValue(element, localName, namespace) { - if (namespace === void 0) { namespace = ''; } +function element_getAnAttributeValue(element, localName, namespace = '') { /** * 1. Let attr be the result of getting an attribute given namespace, * localName, and element. * 2. If attr is null, then return the empty string. * 3. Return attr’s value. */ - var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); + const attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); if (attr === null) return ''; else return attr._value; } -exports.element_getAnAttributeValue = element_getAnAttributeValue; /** * Sets an attribute of an element node. * @@ -17140,8 +17040,8 @@ function element_setAnAttribute(attr, element) { * 6. Return oldAttr. */ if (attr._element !== null && attr._element !== element) - throw new DOMException_1.InUseAttributeError("This attribute already exists in the document: " + attr._qualifiedName + " as a child of " + attr._element._qualifiedName + "."); - var oldAttr = element_getAnAttributeByNamespaceAndLocalName(attr._namespace || '', attr._localName, element); + throw new DOMException_1.InUseAttributeError(`This attribute already exists in the document: ${attr._qualifiedName} as a child of ${attr._element._qualifiedName}.`); + const oldAttr = element_getAnAttributeByNamespaceAndLocalName(attr._namespace || '', attr._localName, element); if (oldAttr === attr) return attr; if (oldAttr !== null) { @@ -17152,7 +17052,6 @@ function element_setAnAttribute(attr, element) { } return oldAttr; } -exports.element_setAnAttribute = element_setAnAttribute; /** * Sets an attribute's value of an element node. * @@ -17162,9 +17061,7 @@ exports.element_setAnAttribute = element_setAnAttribute; * @param prefix - an attribute prefix * @param namespace - an attribute namespace */ -function element_setAnAttributeValue(element, localName, value, prefix, namespace) { - if (prefix === void 0) { prefix = null; } - if (namespace === void 0) { namespace = null; } +function element_setAnAttributeValue(element, localName, value, prefix = null, namespace = null) { /** * 1. If prefix is not given, set it to null. * 2. If namespace is not given, set it to null. @@ -17176,9 +17073,9 @@ function element_setAnAttributeValue(element, localName, value, prefix, namespac * attribute to element, and then return. * 5. Change attribute from element to value. */ - var attribute = element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, element); + const attribute = element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, element); if (attribute === null) { - var newAttr = CreateAlgorithm_1.create_attr(element._nodeDocument, localName); + const newAttr = (0, CreateAlgorithm_1.create_attr)(element._nodeDocument, localName); newAttr._namespace = namespace; newAttr._namespacePrefix = prefix; newAttr._value = value; @@ -17187,7 +17084,6 @@ function element_setAnAttributeValue(element, localName, value, prefix, namespac } element_change(attribute, element, value); } -exports.element_setAnAttributeValue = element_setAnAttributeValue; /** * Removes an attribute with the given name from an element node. * @@ -17201,13 +17097,12 @@ function element_removeAnAttributeByName(qualifiedName, element) { * 2. If attr is non-null, remove it from element. * 3. Return attr. */ - var attr = element_getAnAttributeByName(qualifiedName, element); + const attr = element_getAnAttributeByName(qualifiedName, element); if (attr !== null) { element_remove(attr, element); } return attr; } -exports.element_removeAnAttributeByName = element_removeAnAttributeByName; /** * Removes an attribute with the given namespace and local name from an * element node. @@ -17222,13 +17117,12 @@ function element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, * 2. If attr is non-null, remove it from element. * 3. Return attr. */ - var attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); + const attr = element_getAnAttributeByNamespaceAndLocalName(namespace, localName, element); if (attr !== null) { element_remove(attr, element); } return attr; } -exports.element_removeAnAttributeByNamespaceAndLocalName = element_removeAnAttributeByNamespaceAndLocalName; /** * Creates an element node. * See: https://dom.spec.whatwg.org/#concept-create-element. @@ -17240,18 +17134,15 @@ exports.element_removeAnAttributeByNamespaceAndLocalName = element_removeAnAttri * @param is - the "is" value * @param synchronousCustomElementsFlag - synchronous custom elements flag */ -function element_createAnElement(document, localName, namespace, prefix, is, synchronousCustomElementsFlag) { - if (prefix === void 0) { prefix = null; } - if (is === void 0) { is = null; } - if (synchronousCustomElementsFlag === void 0) { synchronousCustomElementsFlag = false; } +function element_createAnElement(document, localName, namespace, prefix = null, is = null, synchronousCustomElementsFlag = false) { /** * 1. If prefix was not given, let prefix be null. * 2. If is was not given, let is be null. * 3. Let result be null. */ - var result = null; + let result = null; if (!DOMImpl_1.dom.features.customElements) { - result = CreateAlgorithm_1.create_element(document, localName, namespace, prefix); + result = (0, CreateAlgorithm_1.create_element)(document, localName, namespace, prefix); result._customElementState = "uncustomized"; result._customElementDefinition = null; result._is = is; @@ -17261,7 +17152,7 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * 4. Let definition be the result of looking up a custom element definition * given document, namespace, localName, and is. */ - var definition = CustomElementAlgorithm_1.customElement_lookUpACustomElementDefinition(document, namespace, localName, is); + const definition = (0, CustomElementAlgorithm_1.customElement_lookUpACustomElementDefinition)(document, namespace, localName, is); if (definition !== null && definition.name !== definition.localName) { /** * 5. If definition is non-null, and definition’s name is not equal to @@ -17279,7 +17170,7 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * 5.4. Otherwise, enqueue a custom element upgrade reaction given result * and definition. */ - var elemenInterface = DocumentAlgorithm_1.document_elementInterface(localName, infra_1.namespace.HTML); + const elemenInterface = (0, DocumentAlgorithm_1.document_elementInterface)(localName, infra_1.namespace.HTML); result = new elemenInterface(); result._localName = localName; result._namespace = infra_1.namespace.HTML; @@ -17289,10 +17180,10 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn result._is = is; result._nodeDocument = document; if (synchronousCustomElementsFlag) { - CustomElementAlgorithm_1.customElement_upgrade(definition, result); + (0, CustomElementAlgorithm_1.customElement_upgrade)(definition, result); } else { - CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction)(result, definition); } } else if (definition !== null) { @@ -17314,11 +17205,11 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * _Note:_ IDL enforces that result is an HTMLElement object, which all * use the HTML namespace. */ - var C = definition.constructor; - var result_1 = new C(); - console.assert(result_1._customElementState !== undefined); - console.assert(result_1._customElementDefinition !== undefined); - console.assert(result_1._namespace === infra_1.namespace.HTML); + const C = definition.constructor; + const result = new C(); + console.assert(result._customElementState !== undefined); + console.assert(result._customElementDefinition !== undefined); + console.assert(result._namespace === infra_1.namespace.HTML); /** * 6.1.5. If result’s attribute list is not empty, then throw a * "NotSupportedError" DOMException. @@ -17331,22 +17222,22 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * 6.1.9. If result’s local name is not equal to localName, then throw * a "NotSupportedError" DOMException. */ - if (result_1._attributeList.length !== 0) + if (result._attributeList.length !== 0) throw new DOMException_1.NotSupportedError("Custom element already has attributes."); - if (result_1._children.size !== 0) + if (result._children.size !== 0) throw new DOMException_1.NotSupportedError("Custom element already has child nodes."); - if (result_1._parent !== null) + if (result._parent !== null) throw new DOMException_1.NotSupportedError("Custom element already has a parent node."); - if (result_1._nodeDocument !== document) + if (result._nodeDocument !== document) throw new DOMException_1.NotSupportedError("Custom element is already in a document."); - if (result_1._localName !== localName) + if (result._localName !== localName) throw new DOMException_1.NotSupportedError("Custom element has a different local name."); /** * 6.1.10. Set result’s namespace prefix to prefix. * 6.1.11. Set result’s is value to null. */ - result_1._namespacePrefix = prefix; - result_1._is = null; + result._namespacePrefix = prefix; + result._is = null; } catch (e) { /** @@ -17359,7 +17250,7 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * is value set to null, and node document set to document. */ // TODO: Report the exception - result = CreateAlgorithm_1.create_htmlUnknownElement(document, localName, infra_1.namespace.HTML, prefix); + result = (0, CreateAlgorithm_1.create_htmlUnknownElement)(document, localName, infra_1.namespace.HTML, prefix); result._customElementState = "failed"; result._customElementDefinition = null; result._is = null; @@ -17376,11 +17267,11 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * 6.2.2. Enqueue a custom element upgrade reaction given result and * definition. */ - result = CreateAlgorithm_1.create_htmlElement(document, localName, infra_1.namespace.HTML, prefix); + result = (0, CreateAlgorithm_1.create_htmlElement)(document, localName, infra_1.namespace.HTML, prefix); result._customElementState = "undefined"; result._customElementDefinition = null; result._is = null; - CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction(result, definition); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementUpgradeReaction)(result, definition); } } else { @@ -17394,7 +17285,7 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * "uncustomized", custom element definition set to null, is value set to * is, and node document set to document. */ - var elementInterface = DocumentAlgorithm_1.document_elementInterface(localName, namespace); + const elementInterface = (0, DocumentAlgorithm_1.document_elementInterface)(localName, namespace); result = new elementInterface(); result._localName = localName; result._namespace = namespace; @@ -17409,7 +17300,7 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn * custom element state to "undefined". */ if (namespace === infra_1.namespace.HTML && (is !== null || - CustomElementAlgorithm_1.customElement_isValidCustomElementName(localName))) { + (0, CustomElementAlgorithm_1.customElement_isValidCustomElementName)(localName))) { result._customElementState = "undefined"; } } @@ -17422,7 +17313,6 @@ function element_createAnElement(document, localName, namespace, prefix, is, syn */ return result; } -exports.element_createAnElement = element_createAnElement; /** * Inserts a new node adjacent to this element. * @@ -17455,70 +17345,54 @@ function element_insertAdjacent(element, where, node) { case 'beforebegin': if (element._parent === null) return null; - return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element); + return (0, MutationAlgorithm_1.mutation_preInsert)(node, element._parent, element); case 'afterbegin': - return MutationAlgorithm_1.mutation_preInsert(node, element, element._firstChild); + return (0, MutationAlgorithm_1.mutation_preInsert)(node, element, element._firstChild); case 'beforeend': - return MutationAlgorithm_1.mutation_preInsert(node, element, null); + return (0, MutationAlgorithm_1.mutation_preInsert)(node, element, null); case 'afterend': if (element._parent === null) return null; - return MutationAlgorithm_1.mutation_preInsert(node, element._parent, element._nextSibling); + return (0, MutationAlgorithm_1.mutation_preInsert)(node, element._parent, element._nextSibling); default: - throw new DOMException_1.SyntaxError("Invalid 'where' argument. \"beforebegin\", \"afterbegin\", \"beforeend\" or \"afterend\" expected"); + throw new DOMException_1.SyntaxError(`Invalid 'where' argument. "beforebegin", "afterbegin", "beforeend" or "afterend" expected`); } } -exports.element_insertAdjacent = element_insertAdjacent; //# sourceMappingURL=ElementAlgorithm.js.map /***/ }), /***/ 28217: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var interfaces_1 = __nccwpck_require__(27305); -var util_1 = __nccwpck_require__(65282); -var CustomEventImpl_1 = __nccwpck_require__(59857); -var EventImpl_1 = __nccwpck_require__(38245); -var DOMException_1 = __nccwpck_require__(13166); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); -var DOMAlgorithm_1 = __nccwpck_require__(9628); +exports.event_setTheCanceledFlag = event_setTheCanceledFlag; +exports.event_initialize = event_initialize; +exports.event_createAnEvent = event_createAnEvent; +exports.event_innerEventCreationSteps = event_innerEventCreationSteps; +exports.event_dispatch = event_dispatch; +exports.event_appendToAnEventPath = event_appendToAnEventPath; +exports.event_invoke = event_invoke; +exports.event_innerInvoke = event_innerInvoke; +exports.event_fireAnEvent = event_fireAnEvent; +exports.event_createLegacyEvent = event_createLegacyEvent; +exports.event_getterEventHandlerIDLAttribute = event_getterEventHandlerIDLAttribute; +exports.event_setterEventHandlerIDLAttribute = event_setterEventHandlerIDLAttribute; +exports.event_determineTheTargetOfAnEventHandler = event_determineTheTargetOfAnEventHandler; +exports.event_getTheCurrentValueOfAnEventHandler = event_getTheCurrentValueOfAnEventHandler; +exports.event_activateAnEventHandler = event_activateAnEventHandler; +exports.event_deactivateAnEventHandler = event_deactivateAnEventHandler; +const DOMImpl_1 = __nccwpck_require__(14177); +const interfaces_1 = __nccwpck_require__(27305); +const util_1 = __nccwpck_require__(65282); +const CustomEventImpl_1 = __nccwpck_require__(59857); +const EventImpl_1 = __nccwpck_require__(38245); +const DOMException_1 = __nccwpck_require__(13166); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); +const DOMAlgorithm_1 = __nccwpck_require__(9628); /** * Sets the canceled flag of an event. * @@ -17529,7 +17403,6 @@ function event_setTheCanceledFlag(event) { event._canceledFlag = true; } } -exports.event_setTheCanceledFlag = event_setTheCanceledFlag; /** * Initializes the value of an event. * @@ -17549,15 +17422,13 @@ function event_initialize(event, type, bubbles, cancelable) { event._bubbles = bubbles; event._cancelable = cancelable; } -exports.event_initialize = event_initialize; /** * Creates a new event. * * @param eventInterface - event interface * @param realm - realm */ -function event_createAnEvent(eventInterface, realm) { - if (realm === void 0) { realm = undefined; } +function event_createAnEvent(eventInterface, realm = undefined) { /** * 1. If realm is not given, then set it to null. * 2. Let dictionary be the result of converting the JavaScript value @@ -17572,12 +17443,11 @@ function event_createAnEvent(eventInterface, realm) { */ if (realm === undefined) realm = null; - var dictionary = {}; - var event = event_innerEventCreationSteps(eventInterface, realm, new Date(), dictionary); + const dictionary = {}; + const event = event_innerEventCreationSteps(eventInterface, realm, new Date(), dictionary); event._isTrusted = true; return event; } -exports.event_createAnEvent = event_createAnEvent; /** * Performs event creation steps. * @@ -17594,7 +17464,7 @@ function event_innerEventCreationSteps(eventInterface, realm, time, dictionary) * If realm is non-null, then use that Realm; otherwise, use the default * behavior defined in Web IDL. */ - var event = new eventInterface(""); + const event = new eventInterface(""); /** * 2. Set event’s initialized flag. * 3. Initialize event’s timeStamp attribute to a DOMHighResTimeStamp @@ -17608,11 +17478,10 @@ function event_innerEventCreationSteps(eventInterface, realm, time, dictionary) event._timeStamp = time.getTime(); Object.assign(event, dictionary); if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runEventConstructingSteps(event); + (0, DOMAlgorithm_1.dom_runEventConstructingSteps)(event); } return event; } -exports.event_innerEventCreationSteps = event_innerEventCreationSteps; /** * Dispatches an event to an event target. * @@ -17622,11 +17491,8 @@ exports.event_innerEventCreationSteps = event_innerEventCreationSteps; * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns * whether the event listener's callback threw an exception */ -function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDidListenersThrowFlag) { - var e_1, _a, e_2, _b; - if (legacyTargetOverrideFlag === void 0) { legacyTargetOverrideFlag = false; } - if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } - var clearTargets = false; +function event_dispatch(event, target, legacyTargetOverrideFlag = false, legacyOutputDidListenersThrowFlag = { value: false }) { + let clearTargets = false; /** * 1. Set event's dispatch flag. */ @@ -17638,9 +17504,9 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid * _Note:_ legacy target override flag is only used by HTML and only when * target is a Window object. */ - var targetOverride = target; + let targetOverride = target; if (legacyTargetOverrideFlag) { - var doc = target._associatedDocument; + const doc = target._associatedDocument; if (util_1.Guard.isDocumentNode(doc)) { targetOverride = doc; } @@ -17652,8 +17518,8 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid * 5. If target is not relatedTarget or target is event's relatedTarget, * then: */ - var activationTarget = null; - var relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, target); + let activationTarget = null; + let relatedTarget = (0, TreeAlgorithm_1.tree_retarget)(event._relatedTarget, target); if (target !== relatedTarget || target === event._relatedTarget) { /** * 5.1. Let touchTargets be a new list. @@ -17671,29 +17537,19 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid * 5.8. Let parent be the result of invoking target's get the parent with * event. */ - var touchTargets = []; - try { - for (var _c = __values(event._touchTargetList), _d = _c.next(); !_d.done; _d = _c.next()) { - var touchTarget = _d.value; - touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, target)); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_1) throw e_1.error; } + let touchTargets = []; + for (const touchTarget of event._touchTargetList) { + touchTargets.push((0, TreeAlgorithm_1.tree_retarget)(touchTarget, target)); } event_appendToAnEventPath(event, target, targetOverride, relatedTarget, touchTargets, false); - var isActivationEvent = (util_1.Guard.isMouseEvent(event) && event._type === "click"); + const isActivationEvent = (util_1.Guard.isMouseEvent(event) && event._type === "click"); if (isActivationEvent && target._activationBehavior !== undefined) { activationTarget = target; } - var slotable = (util_1.Guard.isSlotable(target) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(target)) ? + let slotable = (util_1.Guard.isSlotable(target) && (0, ShadowTreeAlgorithm_1.shadowTree_isAssigned)(target)) ? target : null; - var slotInClosedTree = false; - var parent = target._getTheParent(event); + let slotInClosedTree = false; + let parent = target._getTheParent(event); /** * 5.9. While parent is non-null: */ @@ -17710,7 +17566,7 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid throw new Error("Parent node of a slotable should be a slot."); } slotable = null; - var root = TreeAlgorithm_1.tree_rootNode(parent, true); + const root = (0, TreeAlgorithm_1.tree_rootNode)(parent, true); if (util_1.Guard.isShadowRoot(root) && root._mode === "closed") { slotInClosedTree = true; } @@ -17724,30 +17580,20 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid * 5.9.4. For each touchTarget of event's touch target list, append the * result of retargeting touchTarget against parent to touchTargets. */ - if (util_1.Guard.isSlotable(parent) && ShadowTreeAlgorithm_1.shadowTree_isAssigned(parent)) { + if (util_1.Guard.isSlotable(parent) && (0, ShadowTreeAlgorithm_1.shadowTree_isAssigned)(parent)) { slotable = parent; } - relatedTarget = TreeAlgorithm_1.tree_retarget(event._relatedTarget, parent); + relatedTarget = (0, TreeAlgorithm_1.tree_retarget)(event._relatedTarget, parent); touchTargets = []; - try { - for (var _e = (e_2 = void 0, __values(event._touchTargetList)), _f = _e.next(); !_f.done; _f = _e.next()) { - var touchTarget = _f.value; - touchTargets.push(TreeAlgorithm_1.tree_retarget(touchTarget, parent)); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_2) throw e_2.error; } + for (const touchTarget of event._touchTargetList) { + touchTargets.push((0, TreeAlgorithm_1.tree_retarget)(touchTarget, parent)); } /** * 5.9.6. If parent is a Window object, or parent is a node and target's * root is a shadow-including inclusive ancestor of parent, then: */ if (util_1.Guard.isWindow(parent) || (util_1.Guard.isNode(parent) && util_1.Guard.isNode(target) && - TreeAlgorithm_1.tree_isAncestorOf(TreeAlgorithm_1.tree_rootNode(target, true), parent, true, true))) { + (0, TreeAlgorithm_1.tree_isAncestorOf)((0, TreeAlgorithm_1.tree_rootNode)(target, true), parent, true, true))) { /** * 5.9.6.1. If isActivationEvent is true, event's bubbles attribute * is true, activationTarget is null, and parent has activation @@ -17798,10 +17644,10 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid * 5.10. Let clearTargetsStruct be the last struct in event's path whose * shadow-adjusted target is non-null. */ - var clearTargetsStruct = null; - var path = event._path; - for (var i = path.length - 1; i >= 0; i--) { - var struct = path[i]; + let clearTargetsStruct = null; + const path = event._path; + for (let i = path.length - 1; i >= 0; i--) { + const struct = path[i]; if (struct.shadowAdjustedTarget !== null) { clearTargetsStruct = struct; break; @@ -17815,18 +17661,18 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid */ if (clearTargetsStruct !== null) { if (util_1.Guard.isNode(clearTargetsStruct.shadowAdjustedTarget) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.shadowAdjustedTarget, true))) { + util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(clearTargetsStruct.shadowAdjustedTarget, true))) { clearTargets = true; } else if (util_1.Guard.isNode(clearTargetsStruct.relatedTarget) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(clearTargetsStruct.relatedTarget, true))) { + util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(clearTargetsStruct.relatedTarget, true))) { clearTargets = true; } else { - for (var j = 0; j < clearTargetsStruct.touchTargetList.length; j++) { - var struct = clearTargetsStruct.touchTargetList[j]; + for (let j = 0; j < clearTargetsStruct.touchTargetList.length; j++) { + const struct = clearTargetsStruct.touchTargetList[j]; if (util_1.Guard.isNode(struct) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(struct, true))) { + util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(struct, true))) { clearTargets = true; break; } @@ -17845,8 +17691,8 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid /** * 5.13. For each struct in event's path, in reverse order: */ - for (var i = path.length - 1; i >= 0; i--) { - var struct = path[i]; + for (let i = path.length - 1; i >= 0; i--) { + const struct = path[i]; /** * 5.13.1. If struct's shadow-adjusted target is non-null, then set * event's eventPhase attribute to AT_TARGET. @@ -17866,8 +17712,8 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid /** * 5.14. For each struct in event's path */ - for (var i = 0; i < path.length; i++) { - var struct = path[i]; + for (let i = 0; i < path.length; i++) { + const struct = path[i]; /** * 5.14.1. If struct's shadow-adjusted target is non-null, then set * event's eventPhase attribute to AT_TARGET. @@ -17933,7 +17779,6 @@ function event_dispatch(event, target, legacyTargetOverrideFlag, legacyOutputDid */ return !event._canceledFlag; } -exports.event_dispatch = event_dispatch; /** * Appends a new struct to an event's path. * @@ -17950,9 +17795,9 @@ function event_appendToAnEventPath(event, invocationTarget, shadowAdjustedTarget * 2. If invocationTarget is a node and its root is a shadow root, then * set invocationTargetInShadowTree to true. */ - var invocationTargetInShadowTree = false; + let invocationTargetInShadowTree = false; if (util_1.Guard.isNode(invocationTarget) && - util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(invocationTarget))) { + util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(invocationTarget))) { invocationTargetInShadowTree = true; } /** @@ -17960,7 +17805,7 @@ function event_appendToAnEventPath(event, invocationTarget, shadowAdjustedTarget * 4. If invocationTarget is a shadow root whose mode is "closed", then * set root-of-closed-tree to true. */ - var rootOfClosedTree = false; + let rootOfClosedTree = false; if (util_1.Guard.isShadowRoot(invocationTarget) && invocationTarget._mode === "closed") { rootOfClosedTree = true; @@ -17983,7 +17828,6 @@ function event_appendToAnEventPath(event, invocationTarget, shadowAdjustedTarget slotInClosedTree: slotInClosedTree }); } -exports.event_appendToAnEventPath = event_appendToAnEventPath; /** * Invokes an event. * @@ -17993,23 +17837,22 @@ exports.event_appendToAnEventPath = event_appendToAnEventPath; * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns * whether the event listener's callback threw an exception */ -function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag) { - if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } +function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag = { value: false }) { /** * 1. Set event's target to the shadow-adjusted target of the last struct * in event's path, that is either struct or preceding struct, whose * shadow-adjusted target is non-null. */ - var path = event._path; - var index = -1; - for (var i = 0; i < path.length; i++) { + const path = event._path; + let index = -1; + for (let i = 0; i < path.length; i++) { if (path[i] === struct) { index = i; break; } } if (index !== -1) { - var item = path[index]; + let item = path[index]; if (item.shadowAdjustedTarget !== null) { event._target = item.shadowAdjustedTarget; } @@ -18037,14 +17880,14 @@ function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag) { if (event._stopPropagationFlag) return; event._currentTarget = struct.invocationTarget; - var currentTarget = event._currentTarget; - var targetListeners = currentTarget._eventListenerList; - var listeners = new (Array.bind.apply(Array, __spread([void 0], targetListeners)))(); + const currentTarget = event._currentTarget; + const targetListeners = currentTarget._eventListenerList; + let listeners = new Array(...targetListeners); /** * 7. Let found be the result of running inner invoke with event, listeners, * phase, and legacyOutputDidListenersThrowFlag if given. */ - var found = event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); + const found = event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag); /** * 8. If found is false and event's isTrusted attribute is true, then: */ @@ -18063,7 +17906,7 @@ function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag) { * "animationstart" | "webkitAnimationStart" * "transitionend" | "webkitTransitionEnd" */ - var originalEventType = event._type; + const originalEventType = event._type; if (originalEventType === "animationend") { event._type = "webkitAnimationEnd"; } @@ -18085,7 +17928,6 @@ function event_invoke(struct, event, phase, legacyOutputDidListenersThrowFlag) { event._type = originalEventType; } } -exports.event_invoke = event_invoke; /** * Invokes an event. * @@ -18096,15 +17938,14 @@ exports.event_invoke = event_invoke; * @param legacyOutputDidListenersThrowFlag - legacy output flag that returns * whether the event listener's callback threw an exception */ -function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag) { - if (legacyOutputDidListenersThrowFlag === void 0) { legacyOutputDidListenersThrowFlag = { value: false }; } +function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListenersThrowFlag = { value: false }) { /** * 1. Let found be false. * 2. For each listener in listeners, whose removed is false: */ - var found = false; - for (var i = 0; i < listeners.length; i++) { - var listener = listeners[i]; + let found = false; + for (let i = 0; i < listeners.length; i++) { + const listener = listeners[i]; if (!listener.removed) { /** * 2.1. If event's type attribute value is not listener's type, then @@ -18127,11 +17968,11 @@ function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListe * currentTarget attribute value's event listener list. */ if (listener.once && event._currentTarget !== null) { - var impl = event._currentTarget; - var index = -1; - for (var i_1 = 0; i_1 < impl._eventListenerList.length; i_1++) { - if (impl._eventListenerList[i_1] === listener) { - index = i_1; + const impl = event._currentTarget; + let index = -1; + for (let i = 0; i < impl._eventListenerList.length; i++) { + if (impl._eventListenerList[i] === listener) { + index = i; break; } } @@ -18145,7 +17986,7 @@ function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListe * 2.6. Let global be listener callback's associated Realm's global * object. */ - var globalObject = undefined; + const globalObject = undefined; /** * 2.7. Let currentEvent be undefined. * 2.8. If global is a Window object, then: @@ -18153,7 +17994,7 @@ function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListe * 2.8.2. If struct's invocation-target-in-shadow-tree is false, then * set global's current event to event. */ - var currentEvent = undefined; + let currentEvent = undefined; if (util_1.Guard.isWindow(globalObject)) { currentEvent = globalObject._currentEvent; if (struct.invocationTargetInShadowTree === false) { @@ -18209,7 +18050,6 @@ function event_innerInvoke(event, listeners, phase, struct, legacyOutputDidListe */ return found; } -exports.event_innerInvoke = event_innerInvoke; /** * Fires an event at target. * @param e - event name @@ -18231,7 +18071,7 @@ function event_fireAnEvent(e, target, eventConstructor, idlAttributes, legacyTar * 2. Let event be the result of creating an event given eventConstructor, * in the relevant Realm of target. */ - var event = event_createAnEvent(eventConstructor); + const event = event_createAnEvent(eventConstructor); /** * 3. Initialize event’s type attribute to e. */ @@ -18242,8 +18082,8 @@ function event_fireAnEvent(e, target, eventConstructor, idlAttributes, legacyTar * _Note:_ This also allows for the isTrusted attribute to be set to false. */ if (idlAttributes) { - for (var key in idlAttributes) { - var idlObj = event; + for (const key in idlAttributes) { + const idlObj = event; idlObj[key] = idlAttributes[key]; } } @@ -18253,7 +18093,6 @@ function event_fireAnEvent(e, target, eventConstructor, idlAttributes, legacyTar */ return event_dispatch(event, target, legacyTargetOverrideFlag); } -exports.event_fireAnEvent = event_fireAnEvent; /** * Creates an event. * @@ -18263,7 +18102,7 @@ function event_createLegacyEvent(eventInterface) { /** * 1. Let constructor be null. */ - var constructor = null; + let constructor = null; /** * TODO: Implement in HTML DOM * 2. If interface is an ASCII case-insensitive match for any of the strings @@ -18343,7 +18182,7 @@ function event_createLegacyEvent(eventInterface) { * 3. If constructor is null, then throw a "NotSupportedError" DOMException. */ if (constructor === null) { - throw new DOMException_1.NotSupportedError("Event constructor not found for interface " + eventInterface + "."); + throw new DOMException_1.NotSupportedError(`Event constructor not found for interface ${eventInterface}.`); } /** * 4. If the interface indicated by constructor is not exposed on the @@ -18362,7 +18201,7 @@ function event_createLegacyEvent(eventInterface) { * 8. Initialize event’s isTrusted attribute to false. * 9. Unset event’s initialized flag. */ - var event = new constructor(""); + const event = new constructor(""); event._type = ""; event._timeStamp = new Date().getTime(); event._isTrusted = false; @@ -18372,7 +18211,6 @@ function event_createLegacyEvent(eventInterface) { */ return event; } -exports.event_createLegacyEvent = event_createLegacyEvent; /** * Getter of an event handler IDL attribute. * @@ -18387,12 +18225,11 @@ function event_getterEventHandlerIDLAttribute(thisObj, name) { * 3. Return the result of getting the current value of the event handler * given eventTarget and name. */ - var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); + const eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); if (eventTarget === null) return null; return event_getTheCurrentValueOfAnEventHandler(eventTarget, name); } -exports.event_getterEventHandlerIDLAttribute = event_getterEventHandlerIDLAttribute; /** * Setter of an event handler IDL attribute. * @@ -18413,22 +18250,21 @@ function event_setterEventHandlerIDLAttribute(thisObj, name, value) { * 4.3. Set eventHandler's value to the given value. * 4.4. Activate an event handler given eventTarget and name. */ - var eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); + const eventTarget = event_determineTheTargetOfAnEventHandler(thisObj, name); if (eventTarget === null) return; if (value === null) { event_deactivateAnEventHandler(eventTarget, name); } else { - var handlerMap = eventTarget._eventHandlerMap; - var eventHandler = handlerMap["onabort"]; + const handlerMap = eventTarget._eventHandlerMap; + const eventHandler = handlerMap["onabort"]; if (eventHandler !== undefined) { eventHandler.value = value; } event_activateAnEventHandler(eventTarget, name); } } -exports.event_setterEventHandlerIDLAttribute = event_setterEventHandlerIDLAttribute; /** * Determines the target of an event handler. * @@ -18439,7 +18275,6 @@ function event_determineTheTargetOfAnEventHandler(eventTarget, name) { // TODO: Implement in HTML DOM return null; } -exports.event_determineTheTargetOfAnEventHandler = event_determineTheTargetOfAnEventHandler; /** * Gets the current value of an event handler. * @@ -18450,7 +18285,6 @@ function event_getTheCurrentValueOfAnEventHandler(eventTarget, name) { // TODO: Implement in HTML DOM return null; } -exports.event_getTheCurrentValueOfAnEventHandler = event_getTheCurrentValueOfAnEventHandler; /** * Activates an event handler. * @@ -18460,7 +18294,6 @@ exports.event_getTheCurrentValueOfAnEventHandler = event_getTheCurrentValueOfAnE function event_activateAnEventHandler(eventTarget, name) { // TODO: Implement in HTML DOM } -exports.event_activateAnEventHandler = event_activateAnEventHandler; /** * Deactivates an event handler. * @@ -18470,29 +18303,22 @@ exports.event_activateAnEventHandler = event_activateAnEventHandler; function event_deactivateAnEventHandler(eventTarget, name) { // TODO: Implement in HTML DOM } -exports.event_deactivateAnEventHandler = event_deactivateAnEventHandler; //# sourceMappingURL=EventAlgorithm.js.map /***/ }), /***/ 21312: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); +exports.eventTarget_flatten = eventTarget_flatten; +exports.eventTarget_flattenMore = eventTarget_flattenMore; +exports.eventTarget_addEventListener = eventTarget_addEventListener; +exports.eventTarget_removeEventListener = eventTarget_removeEventListener; +exports.eventTarget_removeAllEventListeners = eventTarget_removeAllEventListeners; +const util_1 = __nccwpck_require__(76195); /** * Flattens the given options argument. * @@ -18503,14 +18329,13 @@ function eventTarget_flatten(options) { * 1. If options is a boolean, then return options. * 2. Return options’s capture. */ - if (util_1.isBoolean(options)) { + if ((0, util_1.isBoolean)(options)) { return options; } else { return options.capture || false; } } -exports.eventTarget_flatten = eventTarget_flatten; /** * Flattens the given options argument. * @@ -18524,16 +18349,15 @@ function eventTarget_flattenMore(options) { * once to options’s once. * 4. Return capture, passive, and once. */ - var capture = eventTarget_flatten(options); - var once = false; - var passive = false; - if (!util_1.isBoolean(options)) { + const capture = eventTarget_flatten(options); + let once = false; + let passive = false; + if (!(0, util_1.isBoolean)(options)) { once = options.once || false; passive = options.passive || false; } return [capture, passive, once]; } -exports.eventTarget_flattenMore = eventTarget_flattenMore; /** * Adds a new event listener. * @@ -18560,8 +18384,8 @@ function eventTarget_addEventListener(eventTarget, listener) { * is listener’s capture, then append listener to eventTarget’s event listener * list. */ - for (var i = 0; i < eventTarget._eventListenerList.length; i++) { - var entry = eventTarget._eventListenerList[i]; + for (let i = 0; i < eventTarget._eventListenerList.length; i++) { + const entry = eventTarget._eventListenerList[i]; if (entry.type === listener.type && entry.callback.handleEvent === listener.callback.handleEvent && entry.capture === listener.capture) { return; @@ -18569,7 +18393,6 @@ function eventTarget_addEventListener(eventTarget, listener) { } eventTarget._eventListenerList.push(listener); } -exports.eventTarget_addEventListener = eventTarget_addEventListener; /** * Removes an event listener. * @@ -18591,7 +18414,6 @@ function eventTarget_removeEventListener(eventTarget, listener, index) { listener.removed = true; eventTarget._eventListenerList.splice(index, 1); } -exports.eventTarget_removeEventListener = eventTarget_removeEventListener; /** * Removes all event listeners. * @@ -18603,77 +18425,42 @@ function eventTarget_removeAllEventListeners(eventTarget) { * for each listener of eventTarget’s event listener list, remove an event * listener with eventTarget and listener. */ - var e_1, _a; - try { - for (var _b = __values(eventTarget._eventListenerList), _c = _b.next(); !_c.done; _c = _b.next()) { - var e = _c.value; - e.removed = true; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + for (const e of eventTarget._eventListenerList) { + e.removed = true; } eventTarget._eventListenerList.length = 0; } -exports.eventTarget_removeAllEventListeners = eventTarget_removeAllEventListeners; //# sourceMappingURL=EventTargetAlgorithm.js.map /***/ }), /***/ 45463: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var DOMException_1 = __nccwpck_require__(13166); -var interfaces_1 = __nccwpck_require__(27305); -var util_1 = __nccwpck_require__(65282); -var util_2 = __nccwpck_require__(76195); -var infra_1 = __nccwpck_require__(84251); -var CustomElementAlgorithm_1 = __nccwpck_require__(35648); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var NodeIteratorAlgorithm_1 = __nccwpck_require__(3973); -var ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); -var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var DocumentAlgorithm_1 = __nccwpck_require__(12793); +exports.mutation_ensurePreInsertionValidity = mutation_ensurePreInsertionValidity; +exports.mutation_preInsert = mutation_preInsert; +exports.mutation_insert = mutation_insert; +exports.mutation_append = mutation_append; +exports.mutation_replace = mutation_replace; +exports.mutation_replaceAll = mutation_replaceAll; +exports.mutation_preRemove = mutation_preRemove; +exports.mutation_remove = mutation_remove; +const DOMImpl_1 = __nccwpck_require__(14177); +const DOMException_1 = __nccwpck_require__(13166); +const interfaces_1 = __nccwpck_require__(27305); +const util_1 = __nccwpck_require__(65282); +const util_2 = __nccwpck_require__(76195); +const infra_1 = __nccwpck_require__(84251); +const CustomElementAlgorithm_1 = __nccwpck_require__(35648); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const NodeIteratorAlgorithm_1 = __nccwpck_require__(3973); +const ShadowTreeAlgorithm_1 = __nccwpck_require__(68733); +const MutationObserverAlgorithm_1 = __nccwpck_require__(78157); +const DOMAlgorithm_1 = __nccwpck_require__(9628); +const DocumentAlgorithm_1 = __nccwpck_require__(12793); /** * Ensures pre-insertion validity of a node into a parent before a * child. @@ -18683,10 +18470,9 @@ var DocumentAlgorithm_1 = __nccwpck_require__(12793); * @param child - child node to insert node before */ function mutation_ensurePreInsertionValidity(node, parent, child) { - var e_1, _a, e_2, _b, e_3, _c, e_4, _d; - var parentNodeType = parent._nodeType; - var nodeNodeType = node._nodeType; - var childNodeType = child ? child._nodeType : null; + const parentNodeType = parent._nodeType; + const nodeNodeType = node._nodeType; + const childNodeType = child ? child._nodeType : null; /** * 1. If parent is not a Document, DocumentFragment, or Element node, * throw a "HierarchyRequestError" DOMException. @@ -18694,19 +18480,19 @@ function mutation_ensurePreInsertionValidity(node, parent, child) { if (parentNodeType !== interfaces_1.NodeType.Document && parentNodeType !== interfaces_1.NodeType.DocumentFragment && parentNodeType !== interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Only document, document fragment and element nodes can contain child nodes. Parent node is ${parent.nodeName}.`); /** * 2. If node is a host-including inclusive ancestor of parent, throw a * "HierarchyRequestError" DOMException. */ - if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) - throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an inclusive ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); + if ((0, TreeAlgorithm_1.tree_isHostIncludingAncestorOf)(parent, node, true)) + throw new DOMException_1.HierarchyRequestError(`The node to be inserted cannot be an inclusive ancestor of parent node. Node is ${node.nodeName}, parent node is ${parent.nodeName}.`); /** * 3. If child is not null and its parent is not parent, then throw a * "NotFoundError" DOMException. */ if (child !== null && child._parent !== parent) - throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); + throw new DOMException_1.NotFoundError(`The reference child node cannot be found under parent node. Child node is ${child.nodeName}, parent node is ${parent.nodeName}.`); /** * 4. If node is not a DocumentFragment, DocumentType, Element, Text, * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" @@ -18719,7 +18505,7 @@ function mutation_ensurePreInsertionValidity(node, parent, child) { nodeNodeType !== interfaces_1.NodeType.ProcessingInstruction && nodeNodeType !== interfaces_1.NodeType.CData && nodeNodeType !== interfaces_1.NodeType.Comment) - throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is ${node.nodeName}.`); /** * 5. If either node is a Text node and parent is a document, or node is a * doctype and parent is not a document, throw a "HierarchyRequestError" @@ -18727,10 +18513,10 @@ function mutation_ensurePreInsertionValidity(node, parent, child) { */ if (nodeNodeType === interfaces_1.NodeType.Text && parentNodeType === interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert a text node as a child of a document node. Node is ${node.nodeName}.`); if (nodeNodeType === interfaces_1.NodeType.DocumentType && parentNodeType !== interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`A document type node can only be inserted under a document node. Parent node is ${parent.nodeName}.`); /** * 6. If parent is a document, and any of the statements below, switched on * node, are true, throw a "HierarchyRequestError" DOMException. @@ -18748,114 +18534,73 @@ function mutation_ensurePreInsertionValidity(node, parent, child) { */ if (parentNodeType === interfaces_1.NodeType.Document) { if (nodeNodeType === interfaces_1.NodeType.DocumentFragment) { - var eleCount = 0; - try { - for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { - var childNode = _f.value; - if (childNode._nodeType === interfaces_1.NodeType.Element) - eleCount++; - else if (childNode._nodeType === interfaces_1.NodeType.Text) - throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_f && !_f.done && (_a = _e.return)) _a.call(_e); - } - finally { if (e_1) throw e_1.error; } + let eleCount = 0; + for (const childNode of node._children) { + if (childNode._nodeType === interfaces_1.NodeType.Element) + eleCount++; + else if (childNode._nodeType === interfaces_1.NodeType.Text) + throw new DOMException_1.HierarchyRequestError(`Cannot insert text a node as a child of a document node. Node is ${childNode.nodeName}.`); } if (eleCount > 1) { - throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); + throw new DOMException_1.HierarchyRequestError(`A document node can only have one document element node. Document fragment to be inserted has ${eleCount} element nodes.`); } else if (eleCount === 1) { - try { - for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { - var ele = _h.value; - if (ele._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_h && !_h.done && (_b = _g.return)) _b.call(_g); - } - finally { if (e_2) throw e_2.error; } + for (const ele of parent._children) { + if (ele._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError(`The document node already has a document element node.`); } if (child) { if (childNodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); - var doctypeChild = child._nextSibling; + throw new DOMException_1.HierarchyRequestError(`Cannot insert an element node before a document type node.`); + let doctypeChild = child._nextSibling; while (doctypeChild) { if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert an element node before a document type node.`); doctypeChild = doctypeChild._nextSibling; } } } } else if (nodeNodeType === interfaces_1.NodeType.Element) { - try { - for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { - var ele = _k.value; - if (ele._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_k && !_k.done && (_c = _j.return)) _c.call(_j); - } - finally { if (e_3) throw e_3.error; } + for (const ele of parent._children) { + if (ele._nodeType === interfaces_1.NodeType.Element) + throw new DOMException_1.HierarchyRequestError(`Document already has a document element node. Node is ${node.nodeName}.`); } if (child) { if (childNodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); - var doctypeChild = child._nextSibling; + throw new DOMException_1.HierarchyRequestError(`Cannot insert an element node before a document type node. Node is ${node.nodeName}.`); + let doctypeChild = child._nextSibling; while (doctypeChild) { if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert an element node before a document type node. Node is ${node.nodeName}.`); doctypeChild = doctypeChild._nextSibling; } } } else if (nodeNodeType === interfaces_1.NodeType.DocumentType) { - try { - for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { - var ele = _m.value; - if (ele._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_m && !_m.done && (_d = _l.return)) _d.call(_l); - } - finally { if (e_4) throw e_4.error; } + for (const ele of parent._children) { + if (ele._nodeType === interfaces_1.NodeType.DocumentType) + throw new DOMException_1.HierarchyRequestError(`Document already has a document type node. Node is ${node.nodeName}.`); } if (child) { - var elementChild = child._previousSibling; + let elementChild = child._previousSibling; while (elementChild) { if (elementChild._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert a document type node before an element node. Node is ${node.nodeName}.`); elementChild = elementChild._previousSibling; } } else { - var elementChild = parent._firstChild; + let elementChild = parent._firstChild; while (elementChild) { if (elementChild._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert a document type node before an element node. Node is ${node.nodeName}.`); elementChild = elementChild._nextSibling; } } } } } -exports.mutation_ensurePreInsertionValidity = mutation_ensurePreInsertionValidity; /** * Ensures pre-insertion validity of a node into a parent before a * child, then adopts the node to the tree and inserts it. @@ -18874,14 +18619,13 @@ function mutation_preInsert(node, parent, child) { * 6. Return node. */ mutation_ensurePreInsertionValidity(node, parent, child); - var referenceChild = child; + let referenceChild = child; if (referenceChild === node) referenceChild = node._nextSibling; - DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); + (0, DocumentAlgorithm_1.document_adopt)(node, parent._nodeDocument); mutation_insert(node, parent, referenceChild); return node; } -exports.mutation_preInsert = mutation_preInsert; /** * Inserts a node into a parent node before the given child node. * @@ -18891,7 +18635,6 @@ exports.mutation_preInsert = mutation_preInsert; * @param suppressObservers - whether to notify observers */ function mutation_insert(node, parent, child, suppressObservers) { - var e_5, _a; // Optimized common case if (child === null && node._nodeType !== interfaces_1.NodeType.DocumentFragment) { mutation_insert_single(node, parent, suppressObservers); @@ -18901,7 +18644,7 @@ function mutation_insert(node, parent, child, suppressObservers) { * 1. Let count be the number of children of node if it is a * DocumentFragment node, and one otherwise. */ - var count = (node._nodeType === interfaces_1.NodeType.DocumentFragment ? + const count = (node._nodeType === interfaces_1.NodeType.DocumentFragment ? node._children.size : 1); /** * 2. If child is non-null, then: @@ -18916,24 +18659,14 @@ function mutation_insert(node, parent, child, suppressObservers) { * offset by count. */ if (DOMImpl_1.dom.rangeList.size !== 0) { - var index_1 = TreeAlgorithm_1.tree_index(child); - try { - for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var range = _c.value; - if (range._start[0] === parent && range._start[1] > index_1) { - range._start[1] += count; - } - if (range._end[0] === parent && range._end[1] > index_1) { - range._end[1] += count; - } + const index = (0, TreeAlgorithm_1.tree_index)(child); + for (const range of DOMImpl_1.dom.rangeList) { + if (range._start[0] === parent && range._start[1] > index) { + range._start[1] += count; } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + if (range._end[0] === parent && range._end[1] > index) { + range._end[1] += count; } - finally { if (e_5) throw e_5.error; } } } } @@ -18941,7 +18674,8 @@ function mutation_insert(node, parent, child, suppressObservers) { * 3. Let nodes be node’s children, if node is a DocumentFragment node; * otherwise « node ». */ - var nodes = node._nodeType === interfaces_1.NodeType.DocumentFragment ? new (Array.bind.apply(Array, __spread([void 0], node._children)))() : [node]; + const nodes = node._nodeType === interfaces_1.NodeType.DocumentFragment ? + new Array(...node._children) : [node]; /** * 4. If node is a DocumentFragment node, remove its children with the * suppress observers flag set. @@ -18957,29 +18691,29 @@ function mutation_insert(node, parent, child, suppressObservers) { */ if (DOMImpl_1.dom.features.mutationObservers) { if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(node, [], nodes, null, null); + (0, MutationObserverAlgorithm_1.observer_queueTreeMutationRecord)(node, [], nodes, null, null); } } /** * 6. Let previousSibling be child’s previous sibling or parent’s last * child if child is null. */ - var previousSibling = (child ? child._previousSibling : parent._lastChild); - var index = child === null ? -1 : TreeAlgorithm_1.tree_index(child); + const previousSibling = (child ? child._previousSibling : parent._lastChild); + let index = child === null ? -1 : (0, TreeAlgorithm_1.tree_index)(child); /** * 7. For each node in nodes, in tree order: */ - for (var i = 0; i < nodes.length; i++) { - var node_1 = nodes[i]; - if (util_1.Guard.isElementNode(node_1)) { + for (let i = 0; i < nodes.length; i++) { + const node = nodes[i]; + if (util_1.Guard.isElementNode(node)) { // set document element node if (util_1.Guard.isDocumentNode(parent)) { - parent._documentElement = node_1; + parent._documentElement = node; } // mark that the document has namespaces - if (!node_1._nodeDocument._hasNamespaces && (node_1._namespace !== null || - node_1._namespacePrefix !== null)) { - node_1._nodeDocument._hasNamespaces = true; + if (!node._nodeDocument._hasNamespaces && (node._namespace !== null || + node._namespacePrefix !== null)) { + node._nodeDocument._hasNamespaces = true; } } /** @@ -18987,42 +18721,42 @@ function mutation_insert(node, parent, child, suppressObservers) { * 7.2. Otherwise, insert node into parent’s children before child’s * index. */ - node_1._parent = parent; + node._parent = parent; if (child === null) { - infra_1.set.append(parent._children, node_1); + infra_1.set.append(parent._children, node); } else { - infra_1.set.insert(parent._children, node_1, index); + infra_1.set.insert(parent._children, node, index); index++; } // assign siblings and children for quick lookups if (parent._firstChild === null) { - node_1._previousSibling = null; - node_1._nextSibling = null; - parent._firstChild = node_1; - parent._lastChild = node_1; + node._previousSibling = null; + node._nextSibling = null; + parent._firstChild = node; + parent._lastChild = node; } else { - var prev = (child ? child._previousSibling : parent._lastChild); - var next = (child ? child : null); - node_1._previousSibling = prev; - node_1._nextSibling = next; + const prev = (child ? child._previousSibling : parent._lastChild); + const next = (child ? child : null); + node._previousSibling = prev; + node._nextSibling = next; if (prev) - prev._nextSibling = node_1; + prev._nextSibling = node; if (next) - next._previousSibling = node_1; + next._previousSibling = node; if (!prev) - parent._firstChild = node_1; + parent._firstChild = node; if (!next) - parent._lastChild = node_1; + parent._lastChild = node; } /** * 7.3. If parent is a shadow host and node is a slotable, then * assign a slot for node. */ if (DOMImpl_1.dom.features.slots) { - if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node_1)) { - ShadowTreeAlgorithm_1.shadowTree_assignASlot(node_1); + if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node)) { + (0, ShadowTreeAlgorithm_1.shadowTree_assignASlot)(node); } } /** @@ -19030,8 +18764,8 @@ function mutation_insert(node, parent, child, suppressObservers) { * steps for parent. */ if (DOMImpl_1.dom.features.steps) { - if (util_1.Guard.isTextNode(node_1)) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + if (util_1.Guard.isTextNode(node)) { + (0, DOMAlgorithm_1.dom_runChildTextContentChangeSteps)(parent); } } /** @@ -19040,53 +18774,53 @@ function mutation_insert(node, parent, child, suppressObservers) { * a slot change for parent. */ if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && - util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { - ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + if (util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(parent)) && + util_1.Guard.isSlot(parent) && (0, util_2.isEmpty)(parent._assignedNodes)) { + (0, ShadowTreeAlgorithm_1.shadowTree_signalASlotChange)(parent); } } /** * 7.6. Run assign slotables for a tree with node's root. */ if (DOMImpl_1.dom.features.slots) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node_1)); + (0, ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree)((0, TreeAlgorithm_1.tree_rootNode)(node)); } /** * 7.7. For each shadow-including inclusive descendant * inclusiveDescendant of node, in shadow-including tree * order: */ - var inclusiveDescendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node_1, true, true); + let inclusiveDescendant = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(node, true, true); while (inclusiveDescendant !== null) { /** * 7.7.1. Run the insertion steps with inclusiveDescendant. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runInsertionSteps(inclusiveDescendant); + (0, DOMAlgorithm_1.dom_runInsertionSteps)(inclusiveDescendant); } if (DOMImpl_1.dom.features.customElements) { /** * 7.7.2. If inclusiveDescendant is connected, then: */ if (util_1.Guard.isElementNode(inclusiveDescendant) && - ShadowTreeAlgorithm_1.shadowTree_isConnected(inclusiveDescendant)) { + (0, ShadowTreeAlgorithm_1.shadowTree_isConnected)(inclusiveDescendant)) { if (util_1.Guard.isCustomElementNode(inclusiveDescendant)) { /** * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom * element callback reaction with inclusiveDescendant, callback name * "connectedCallback", and an empty argument list. */ - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(inclusiveDescendant, "connectedCallback", []); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(inclusiveDescendant, "connectedCallback", []); } else { /** * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. */ - CustomElementAlgorithm_1.customElement_tryToUpgrade(inclusiveDescendant); + (0, CustomElementAlgorithm_1.customElement_tryToUpgrade)(inclusiveDescendant); } } } - inclusiveDescendant = TreeAlgorithm_1.tree_getNextDescendantNode(node_1, inclusiveDescendant, true, true); + inclusiveDescendant = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(node, inclusiveDescendant, true, true); } } /** @@ -19095,11 +18829,10 @@ function mutation_insert(node, parent, child, suppressObservers) { */ if (DOMImpl_1.dom.features.mutationObservers) { if (!suppressObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, [], previousSibling, child); + (0, MutationObserverAlgorithm_1.observer_queueTreeMutationRecord)(parent, nodes, [], previousSibling, child); } } } -exports.mutation_insert = mutation_insert; /** * Inserts a node into a parent node. Optimized routine for the common case where * node is not a document fragment node and it has no child nodes. @@ -19130,7 +18863,7 @@ function mutation_insert_single(node, parent, suppressObservers) { * 6. Let previousSibling be child’s previous sibling or parent’s last * child if child is null. */ - var previousSibling = parent._lastChild; + const previousSibling = parent._lastChild; // set document element node if (util_1.Guard.isElementNode(node)) { // set document element node @@ -19159,7 +18892,7 @@ function mutation_insert_single(node, parent, suppressObservers) { parent._lastChild = node; } else { - var prev = parent._lastChild; + const prev = parent._lastChild; node._previousSibling = prev; node._nextSibling = null; if (prev) @@ -19174,7 +18907,7 @@ function mutation_insert_single(node, parent, suppressObservers) { */ if (DOMImpl_1.dom.features.slots) { if (parent._shadowRoot !== null && util_1.Guard.isSlotable(node)) { - ShadowTreeAlgorithm_1.shadowTree_assignASlot(node); + (0, ShadowTreeAlgorithm_1.shadowTree_assignASlot)(node); } } /** @@ -19183,7 +18916,7 @@ function mutation_insert_single(node, parent, suppressObservers) { */ if (DOMImpl_1.dom.features.steps) { if (util_1.Guard.isTextNode(node)) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + (0, DOMAlgorithm_1.dom_runChildTextContentChangeSteps)(parent); } } /** @@ -19192,16 +18925,16 @@ function mutation_insert_single(node, parent, suppressObservers) { * a slot change for parent. */ if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && - util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { - ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + if (util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(parent)) && + util_1.Guard.isSlot(parent) && (0, util_2.isEmpty)(parent._assignedNodes)) { + (0, ShadowTreeAlgorithm_1.shadowTree_signalASlotChange)(parent); } } /** * 7.6. Run assign slotables for a tree with node's root. */ if (DOMImpl_1.dom.features.slots) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(node)); + (0, ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree)((0, TreeAlgorithm_1.tree_rootNode)(node)); } /** * 7.7. For each shadow-including inclusive descendant @@ -19210,27 +18943,27 @@ function mutation_insert_single(node, parent, suppressObservers) { * 7.7.1. Run the insertion steps with inclusiveDescendant. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runInsertionSteps(node); + (0, DOMAlgorithm_1.dom_runInsertionSteps)(node); } if (DOMImpl_1.dom.features.customElements) { /** * 7.7.2. If inclusiveDescendant is connected, then: */ if (util_1.Guard.isElementNode(node) && - ShadowTreeAlgorithm_1.shadowTree_isConnected(node)) { + (0, ShadowTreeAlgorithm_1.shadowTree_isConnected)(node)) { if (util_1.Guard.isCustomElementNode(node)) { /** * 7.7.2.1. If inclusiveDescendant is custom, then enqueue a custom * element callback reaction with inclusiveDescendant, callback name * "connectedCallback", and an empty argument list. */ - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "connectedCallback", []); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(node, "connectedCallback", []); } else { /** * 7.7.2.2. Otherwise, try to upgrade inclusiveDescendant. */ - CustomElementAlgorithm_1.customElement_tryToUpgrade(node); + (0, CustomElementAlgorithm_1.customElement_tryToUpgrade)(node); } } } @@ -19240,7 +18973,7 @@ function mutation_insert_single(node, parent, suppressObservers) { */ if (DOMImpl_1.dom.features.mutationObservers) { if (!suppressObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [node], [], previousSibling, null); + (0, MutationObserverAlgorithm_1.observer_queueTreeMutationRecord)(parent, [node], [], previousSibling, null); } } } @@ -19256,7 +18989,6 @@ function mutation_append(node, parent) { */ return mutation_preInsert(node, parent, null); } -exports.mutation_append = mutation_append; /** * Replaces a node with another node. * @@ -19265,7 +18997,6 @@ exports.mutation_append = mutation_append; * @param parent - parent node to receive node */ function mutation_replace(child, node, parent) { - var e_6, _a, e_7, _b, e_8, _c, e_9, _d; /** * 1. If parent is not a Document, DocumentFragment, or Element node, * throw a "HierarchyRequestError" DOMException. @@ -19273,19 +19004,19 @@ function mutation_replace(child, node, parent) { if (parent._nodeType !== interfaces_1.NodeType.Document && parent._nodeType !== interfaces_1.NodeType.DocumentFragment && parent._nodeType !== interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Only document, document fragment and element nodes can contain child nodes. Parent node is " + parent.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Only document, document fragment and element nodes can contain child nodes. Parent node is ${parent.nodeName}.`); /** * 2. If node is a host-including inclusive ancestor of parent, throw a * "HierarchyRequestError" DOMException. */ - if (TreeAlgorithm_1.tree_isHostIncludingAncestorOf(parent, node, true)) - throw new DOMException_1.HierarchyRequestError("The node to be inserted cannot be an ancestor of parent node. Node is " + node.nodeName + ", parent node is " + parent.nodeName + "."); + if ((0, TreeAlgorithm_1.tree_isHostIncludingAncestorOf)(parent, node, true)) + throw new DOMException_1.HierarchyRequestError(`The node to be inserted cannot be an ancestor of parent node. Node is ${node.nodeName}, parent node is ${parent.nodeName}.`); /** * 3. If child’s parent is not parent, then throw a "NotFoundError" * DOMException. */ if (child._parent !== parent) - throw new DOMException_1.NotFoundError("The reference child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); + throw new DOMException_1.NotFoundError(`The reference child node cannot be found under parent node. Child node is ${child.nodeName}, parent node is ${parent.nodeName}.`); /** * 4. If node is not a DocumentFragment, DocumentType, Element, Text, * ProcessingInstruction, or Comment node, throw a "HierarchyRequestError" @@ -19298,7 +19029,7 @@ function mutation_replace(child, node, parent) { node._nodeType !== interfaces_1.NodeType.ProcessingInstruction && node._nodeType !== interfaces_1.NodeType.CData && node._nodeType !== interfaces_1.NodeType.Comment) - throw new DOMException_1.HierarchyRequestError("Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Only document fragment, document type, element, text, processing instruction, cdata section or comment nodes can be inserted. Node is ${node.nodeName}.`); /** * 5. If either node is a Text node and parent is a document, or node is a * doctype and parent is not a document, throw a "HierarchyRequestError" @@ -19306,10 +19037,10 @@ function mutation_replace(child, node, parent) { */ if (node._nodeType === interfaces_1.NodeType.Text && parent._nodeType === interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("Cannot insert a text node as a child of a document node. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert a text node as a child of a document node. Node is ${node.nodeName}.`); if (node._nodeType === interfaces_1.NodeType.DocumentType && parent._nodeType !== interfaces_1.NodeType.Document) - throw new DOMException_1.HierarchyRequestError("A document type node can only be inserted under a document node. Parent node is " + parent.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`A document type node can only be inserted under a document node. Parent node is ${parent.nodeName}.`); /** * 6. If parent is a document, and any of the statements below, switched on * node, are true, throw a "HierarchyRequestError" DOMException. @@ -19326,90 +19057,50 @@ function mutation_replace(child, node, parent) { */ if (parent._nodeType === interfaces_1.NodeType.Document) { if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { - var eleCount = 0; - try { - for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { - var childNode = _f.value; - if (childNode._nodeType === interfaces_1.NodeType.Element) - eleCount++; - else if (childNode._nodeType === interfaces_1.NodeType.Text) - throw new DOMException_1.HierarchyRequestError("Cannot insert text a node as a child of a document node. Node is " + childNode.nodeName + "."); - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (_f && !_f.done && (_a = _e.return)) _a.call(_e); - } - finally { if (e_6) throw e_6.error; } + let eleCount = 0; + for (const childNode of node._children) { + if (childNode._nodeType === interfaces_1.NodeType.Element) + eleCount++; + else if (childNode._nodeType === interfaces_1.NodeType.Text) + throw new DOMException_1.HierarchyRequestError(`Cannot insert text a node as a child of a document node. Node is ${childNode.nodeName}.`); } if (eleCount > 1) { - throw new DOMException_1.HierarchyRequestError("A document node can only have one document element node. Document fragment to be inserted has " + eleCount + " element nodes."); + throw new DOMException_1.HierarchyRequestError(`A document node can only have one document element node. Document fragment to be inserted has ${eleCount} element nodes.`); } else if (eleCount === 1) { - try { - for (var _g = __values(parent._children), _h = _g.next(); !_h.done; _h = _g.next()) { - var ele = _h.value; - if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) - throw new DOMException_1.HierarchyRequestError("The document node already has a document element node."); - } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (_h && !_h.done && (_b = _g.return)) _b.call(_g); - } - finally { if (e_7) throw e_7.error; } + for (const ele of parent._children) { + if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) + throw new DOMException_1.HierarchyRequestError(`The document node already has a document element node.`); } - var doctypeChild = child._nextSibling; + let doctypeChild = child._nextSibling; while (doctypeChild) { if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert an element node before a document type node.`); doctypeChild = doctypeChild._nextSibling; } } } else if (node._nodeType === interfaces_1.NodeType.Element) { - try { - for (var _j = __values(parent._children), _k = _j.next(); !_k.done; _k = _j.next()) { - var ele = _k.value; - if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) - throw new DOMException_1.HierarchyRequestError("Document already has a document element node. Node is " + node.nodeName + "."); - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (_k && !_k.done && (_c = _j.return)) _c.call(_j); - } - finally { if (e_8) throw e_8.error; } + for (const ele of parent._children) { + if (ele._nodeType === interfaces_1.NodeType.Element && ele !== child) + throw new DOMException_1.HierarchyRequestError(`Document already has a document element node. Node is ${node.nodeName}.`); } - var doctypeChild = child._nextSibling; + let doctypeChild = child._nextSibling; while (doctypeChild) { if (doctypeChild._nodeType === interfaces_1.NodeType.DocumentType) - throw new DOMException_1.HierarchyRequestError("Cannot insert an element node before a document type node. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert an element node before a document type node. Node is ${node.nodeName}.`); doctypeChild = doctypeChild._nextSibling; } } else if (node._nodeType === interfaces_1.NodeType.DocumentType) { - try { - for (var _l = __values(parent._children), _m = _l.next(); !_m.done; _m = _l.next()) { - var ele = _m.value; - if (ele._nodeType === interfaces_1.NodeType.DocumentType && ele !== child) - throw new DOMException_1.HierarchyRequestError("Document already has a document type node. Node is " + node.nodeName + "."); - } + for (const ele of parent._children) { + if (ele._nodeType === interfaces_1.NodeType.DocumentType && ele !== child) + throw new DOMException_1.HierarchyRequestError(`Document already has a document type node. Node is ${node.nodeName}.`); } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { - try { - if (_m && !_m.done && (_d = _l.return)) _d.call(_l); - } - finally { if (e_9) throw e_9.error; } - } - var elementChild = child._previousSibling; + let elementChild = child._previousSibling; while (elementChild) { if (elementChild._nodeType === interfaces_1.NodeType.Element) - throw new DOMException_1.HierarchyRequestError("Cannot insert a document type node before an element node. Node is " + node.nodeName + "."); + throw new DOMException_1.HierarchyRequestError(`Cannot insert a document type node before an element node. Node is ${node.nodeName}.`); elementChild = elementChild._previousSibling; } } @@ -19419,16 +19110,16 @@ function mutation_replace(child, node, parent) { * 8. If reference child is node, set it to node’s next sibling. * 8. Let previousSibling be child’s previous sibling. */ - var referenceChild = child._nextSibling; + let referenceChild = child._nextSibling; if (referenceChild === node) referenceChild = node._nextSibling; - var previousSibling = child._previousSibling; + let previousSibling = child._previousSibling; /** * 10. Adopt node into parent’s node document. * 11. Let removedNodes be the empty list. */ - DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); - var removedNodes = []; + (0, DocumentAlgorithm_1.document_adopt)(node, parent._nodeDocument); + const removedNodes = []; /** * 12. If child’s parent is not null, then: */ @@ -19445,7 +19136,7 @@ function mutation_replace(child, node, parent) { * 13. Let nodes be node’s children if node is a DocumentFragment node; * otherwise [node]. */ - var nodes = []; + let nodes = []; if (node._nodeType === interfaces_1.NodeType.DocumentFragment) { nodes = Array.from(node._children); } @@ -19462,14 +19153,13 @@ function mutation_replace(child, node, parent) { * previousSibling, and reference child. */ if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, nodes, removedNodes, previousSibling, referenceChild); + (0, MutationObserverAlgorithm_1.observer_queueTreeMutationRecord)(parent, nodes, removedNodes, previousSibling, referenceChild); } /** * 16. Return child. */ return child; } -exports.mutation_replace = mutation_replace; /** * Replaces all nodes of a parent with the given node. * @@ -19477,46 +19167,35 @@ exports.mutation_replace = mutation_replace; * @param parent - parent node to receive node */ function mutation_replaceAll(node, parent) { - var e_10, _a; /** * 1. If node is not null, adopt node into parent’s node document. */ if (node !== null) { - DocumentAlgorithm_1.document_adopt(node, parent._nodeDocument); + (0, DocumentAlgorithm_1.document_adopt)(node, parent._nodeDocument); } /** * 2. Let removedNodes be parent’s children. */ - var removedNodes = Array.from(parent._children); + const removedNodes = Array.from(parent._children); /** * 3. Let addedNodes be the empty list. * 4. If node is DocumentFragment node, then set addedNodes to node’s * children. * 5. Otherwise, if node is non-null, set addedNodes to [node]. */ - var addedNodes = []; + let addedNodes = []; if (node && node._nodeType === interfaces_1.NodeType.DocumentFragment) { addedNodes = Array.from(node._children); } else if (node !== null) { addedNodes.push(node); } - try { - /** - * 6. Remove all parent’s children, in tree order, with the suppress - * observers flag set. - */ - for (var removedNodes_1 = __values(removedNodes), removedNodes_1_1 = removedNodes_1.next(); !removedNodes_1_1.done; removedNodes_1_1 = removedNodes_1.next()) { - var childNode = removedNodes_1_1.value; - mutation_remove(childNode, parent, true); - } - } - catch (e_10_1) { e_10 = { error: e_10_1 }; } - finally { - try { - if (removedNodes_1_1 && !removedNodes_1_1.done && (_a = removedNodes_1.return)) _a.call(removedNodes_1); - } - finally { if (e_10) throw e_10.error; } + /** + * 6. Remove all parent’s children, in tree order, with the suppress + * observers flag set. + */ + for (const childNode of removedNodes) { + mutation_remove(childNode, parent, true); } /** * 7. If node is not null, then insert node into parent before null with the @@ -19530,10 +19209,9 @@ function mutation_replaceAll(node, parent) { * null, and null. */ if (DOMImpl_1.dom.features.mutationObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, addedNodes, removedNodes, null, null); + (0, MutationObserverAlgorithm_1.observer_queueTreeMutationRecord)(parent, addedNodes, removedNodes, null, null); } } -exports.mutation_replaceAll = mutation_replaceAll; /** * Ensures pre-removal validity of a child node from a parent, then * removes it. @@ -19549,11 +19227,10 @@ function mutation_preRemove(child, parent) { * 3. Return child. */ if (child._parent !== parent) - throw new DOMException_1.NotFoundError("The child node cannot be found under parent node. Child node is " + child.nodeName + ", parent node is " + parent.nodeName + "."); + throw new DOMException_1.NotFoundError(`The child node cannot be found under parent node. Child node is ${child.nodeName}, parent node is ${parent.nodeName}.`); mutation_remove(child, parent); return child; } -exports.mutation_preRemove = mutation_preRemove; /** * Removes a child node from its parent. * @@ -19562,65 +19239,44 @@ exports.mutation_preRemove = mutation_preRemove; * @param suppressObservers - whether to notify observers */ function mutation_remove(node, parent, suppressObservers) { - var e_11, _a, e_12, _b, e_13, _c, e_14, _d; if (DOMImpl_1.dom.rangeList.size !== 0) { /** * 1. Let index be node’s index. */ - var index = TreeAlgorithm_1.tree_index(node); - try { - /** - * 2. For each live range whose start node is an inclusive descendant of - * node, set its start to (parent, index). - * 3. For each live range whose end node is an inclusive descendant of - * node, set its end to (parent, index). - */ - for (var _e = __values(DOMImpl_1.dom.rangeList), _f = _e.next(); !_f.done; _f = _e.next()) { - var range = _f.value; - if (TreeAlgorithm_1.tree_isDescendantOf(node, range._start[0], true)) { - range._start = [parent, index]; - } - if (TreeAlgorithm_1.tree_isDescendantOf(node, range._end[0], true)) { - range._end = [parent, index]; - } - if (range._start[0] === parent && range._start[1] > index) { - range._start[1]--; - } - if (range._end[0] === parent && range._end[1] > index) { - range._end[1]--; - } + const index = (0, TreeAlgorithm_1.tree_index)(node); + /** + * 2. For each live range whose start node is an inclusive descendant of + * node, set its start to (parent, index). + * 3. For each live range whose end node is an inclusive descendant of + * node, set its end to (parent, index). + */ + for (const range of DOMImpl_1.dom.rangeList) { + if ((0, TreeAlgorithm_1.tree_isDescendantOf)(node, range._start[0], true)) { + range._start = [parent, index]; } - } - catch (e_11_1) { e_11 = { error: e_11_1 }; } - finally { - try { - if (_f && !_f.done && (_a = _e.return)) _a.call(_e); + if ((0, TreeAlgorithm_1.tree_isDescendantOf)(node, range._end[0], true)) { + range._end = [parent, index]; } - finally { if (e_11) throw e_11.error; } - } - try { - /** - * 4. For each live range whose start node is parent and start offset is - * greater than index, decrease its start offset by 1. - * 5. For each live range whose end node is parent and end offset is greater - * than index, decrease its end offset by 1. - */ - for (var _g = __values(DOMImpl_1.dom.rangeList), _h = _g.next(); !_h.done; _h = _g.next()) { - var range = _h.value; - if (range._start[0] === parent && range._start[1] > index) { - range._start[1] -= 1; - } - if (range._end[0] === parent && range._end[1] > index) { - range._end[1] -= 1; - } + if (range._start[0] === parent && range._start[1] > index) { + range._start[1]--; + } + if (range._end[0] === parent && range._end[1] > index) { + range._end[1]--; } } - catch (e_12_1) { e_12 = { error: e_12_1 }; } - finally { - try { - if (_h && !_h.done && (_b = _g.return)) _b.call(_g); + /** + * 4. For each live range whose start node is parent and start offset is + * greater than index, decrease its start offset by 1. + * 5. For each live range whose end node is parent and end offset is greater + * than index, decrease its end offset by 1. + */ + for (const range of DOMImpl_1.dom.rangeList) { + if (range._start[0] === parent && range._start[1] > index) { + range._start[1] -= 1; + } + if (range._end[0] === parent && range._end[1] > index) { + range._end[1] -= 1; } - finally { if (e_12) throw e_12.error; } } } /** @@ -19629,28 +19285,18 @@ function mutation_remove(node, parent, suppressObservers) { * and iterator. */ if (DOMImpl_1.dom.features.steps) { - try { - for (var _j = __values(NodeIteratorAlgorithm_1.nodeIterator_iteratorList()), _k = _j.next(); !_k.done; _k = _j.next()) { - var iterator = _k.value; - if (iterator._root._nodeDocument === node._nodeDocument) { - DOMAlgorithm_1.dom_runNodeIteratorPreRemovingSteps(iterator, node); - } + for (const iterator of (0, NodeIteratorAlgorithm_1.nodeIterator_iteratorList)()) { + if (iterator._root._nodeDocument === node._nodeDocument) { + (0, DOMAlgorithm_1.dom_runNodeIteratorPreRemovingSteps)(iterator, node); } } - catch (e_13_1) { e_13 = { error: e_13_1 }; } - finally { - try { - if (_k && !_k.done && (_c = _j.return)) _c.call(_j); - } - finally { if (e_13) throw e_13.error; } - } } /** * 7. Let oldPreviousSibling be node’s previous sibling. * 8. Let oldNextSibling be node’s next sibling. */ - var oldPreviousSibling = node._previousSibling; - var oldNextSibling = node._nextSibling; + const oldPreviousSibling = node._previousSibling; + const oldNextSibling = node._nextSibling; // set document element node if (util_1.Guard.isDocumentNode(parent) && util_1.Guard.isElementNode(node)) { parent._documentElement = null; @@ -19661,8 +19307,8 @@ function mutation_remove(node, parent, suppressObservers) { node._parent = null; parent._children.delete(node); // assign siblings and children for quick lookups - var prev = node._previousSibling; - var next = node._nextSibling; + const prev = node._previousSibling; + const next = node._nextSibling; node._previousSibling = null; node._nextSibling = null; if (prev) @@ -19678,8 +19324,8 @@ function mutation_remove(node, parent, suppressObservers) { * slot. */ if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isSlotable(node) && node._assignedSlot !== null && ShadowTreeAlgorithm_1.shadowTree_isAssigned(node)) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotables(node._assignedSlot); + if (util_1.Guard.isSlotable(node) && node._assignedSlot !== null && (0, ShadowTreeAlgorithm_1.shadowTree_isAssigned)(node)) { + (0, ShadowTreeAlgorithm_1.shadowTree_assignSlotables)(node._assignedSlot); } } /** @@ -19688,9 +19334,9 @@ function mutation_remove(node, parent, suppressObservers) { * parent. */ if (DOMImpl_1.dom.features.slots) { - if (util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(parent)) && - util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { - ShadowTreeAlgorithm_1.shadowTree_signalASlotChange(parent); + if (util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(parent)) && + util_1.Guard.isSlot(parent) && (0, util_2.isEmpty)(parent._assignedNodes)) { + (0, ShadowTreeAlgorithm_1.shadowTree_signalASlotChange)(parent); } } /** @@ -19699,17 +19345,17 @@ function mutation_remove(node, parent, suppressObservers) { * 12.2. Run assign slotables for a tree with node. */ if (DOMImpl_1.dom.features.slots) { - var descendant_1 = TreeAlgorithm_1.tree_getFirstDescendantNode(node, true, false, function (e) { return util_1.Guard.isSlot(e); }); - if (descendant_1 !== null) { - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(TreeAlgorithm_1.tree_rootNode(parent)); - ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree(node); + const descendant = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(node, true, false, (e) => util_1.Guard.isSlot(e)); + if (descendant !== null) { + (0, ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree)((0, TreeAlgorithm_1.tree_rootNode)(parent)); + (0, ShadowTreeAlgorithm_1.shadowTree_assignSlotablesForATree)(node); } } /** * 13. Run the removing steps with node and parent. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runRemovingSteps(node, parent); + (0, DOMAlgorithm_1.dom_runRemovingSteps)(node, parent); } /** * 14. If node is custom, then enqueue a custom element callback @@ -19718,20 +19364,20 @@ function mutation_remove(node, parent, suppressObservers) { */ if (DOMImpl_1.dom.features.customElements) { if (util_1.Guard.isCustomElementNode(node)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(node, "disconnectedCallback", []); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(node, "disconnectedCallback", []); } } /** * 15. For each shadow-including descendant descendant of node, * in shadow-including tree order, then: */ - var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, true); + let descendant = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(node, false, true); while (descendant !== null) { /** * 15.1. Run the removing steps with descendant. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runRemovingSteps(descendant, node); + (0, DOMAlgorithm_1.dom_runRemovingSteps)(descendant, node); } /** * 15.2. If descendant is custom, then enqueue a custom element @@ -19740,10 +19386,10 @@ function mutation_remove(node, parent, suppressObservers) { */ if (DOMImpl_1.dom.features.customElements) { if (util_1.Guard.isCustomElementNode(descendant)) { - CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction(descendant, "disconnectedCallback", []); + (0, CustomElementAlgorithm_1.customElement_enqueueACustomElementCallbackReaction)(descendant, "disconnectedCallback", []); } } - descendant = TreeAlgorithm_1.tree_getNextDescendantNode(node, descendant, false, true); + descendant = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(node, descendant, false, true); } /** * 16. For each inclusive ancestor inclusiveAncestor of parent, and @@ -19755,28 +19401,18 @@ function mutation_remove(node, parent, suppressObservers) { * observer list. */ if (DOMImpl_1.dom.features.mutationObservers) { - var inclusiveAncestor = TreeAlgorithm_1.tree_getFirstAncestorNode(parent, true); + let inclusiveAncestor = (0, TreeAlgorithm_1.tree_getFirstAncestorNode)(parent, true); while (inclusiveAncestor !== null) { - try { - for (var _l = (e_14 = void 0, __values(inclusiveAncestor._registeredObserverList)), _m = _l.next(); !_m.done; _m = _l.next()) { - var registered = _m.value; - if (registered.options.subtree) { - node._registeredObserverList.push({ - observer: registered.observer, - options: registered.options, - source: registered - }); - } - } - } - catch (e_14_1) { e_14 = { error: e_14_1 }; } - finally { - try { - if (_m && !_m.done && (_d = _l.return)) _d.call(_l); + for (const registered of inclusiveAncestor._registeredObserverList) { + if (registered.options.subtree) { + node._registeredObserverList.push({ + observer: registered.observer, + options: registered.options, + source: registered + }); } - finally { if (e_14) throw e_14.error; } } - inclusiveAncestor = TreeAlgorithm_1.tree_getNextAncestorNode(parent, inclusiveAncestor, true); + inclusiveAncestor = (0, TreeAlgorithm_1.tree_getNextAncestorNode)(parent, inclusiveAncestor, true); } } /** @@ -19786,7 +19422,7 @@ function mutation_remove(node, parent, suppressObservers) { */ if (DOMImpl_1.dom.features.mutationObservers) { if (!suppressObservers) { - MutationObserverAlgorithm_1.observer_queueTreeMutationRecord(parent, [], [node], oldPreviousSibling, oldNextSibling); + (0, MutationObserverAlgorithm_1.observer_queueTreeMutationRecord)(parent, [], [node], oldPreviousSibling, oldNextSibling); } } /** @@ -19795,54 +19431,31 @@ function mutation_remove(node, parent, suppressObservers) { */ if (DOMImpl_1.dom.features.steps) { if (util_1.Guard.isTextNode(node)) { - DOMAlgorithm_1.dom_runChildTextContentChangeSteps(parent); + (0, DOMAlgorithm_1.dom_runChildTextContentChangeSteps)(parent); } } } -exports.mutation_remove = mutation_remove; //# sourceMappingURL=MutationAlgorithm.js.map /***/ }), /***/ 78157: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(65282); -var infra_1 = __nccwpck_require__(84251); -var CreateAlgorithm_1 = __nccwpck_require__(57339); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var EventAlgorithm_1 = __nccwpck_require__(28217); +exports.observer_queueAMutationObserverMicrotask = observer_queueAMutationObserverMicrotask; +exports.observer_notifyMutationObservers = observer_notifyMutationObservers; +exports.observer_queueMutationRecord = observer_queueMutationRecord; +exports.observer_queueTreeMutationRecord = observer_queueTreeMutationRecord; +exports.observer_queueAttributeMutationRecord = observer_queueAttributeMutationRecord; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(65282); +const infra_1 = __nccwpck_require__(84251); +const CreateAlgorithm_1 = __nccwpck_require__(57339); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const EventAlgorithm_1 = __nccwpck_require__(28217); /** * Queues a mutation observer microtask to the surrounding agent’s mutation * observers. @@ -19854,43 +19467,44 @@ function observer_queueAMutationObserverMicrotask() { * 2. Set the surrounding agent’s mutation observer microtask queued to true. * 3. Queue a microtask to notify mutation observers. */ - var window = DOMImpl_1.dom.window; + const window = DOMImpl_1.dom.window; if (window._mutationObserverMicrotaskQueued) return; window._mutationObserverMicrotaskQueued = true; - Promise.resolve().then(function () { observer_notifyMutationObservers(); }); + Promise.resolve().then(() => { observer_notifyMutationObservers(); }); } -exports.observer_queueAMutationObserverMicrotask = observer_queueAMutationObserverMicrotask; /** * Notifies the surrounding agent’s mutation observers. */ function observer_notifyMutationObservers() { - var e_1, _a, e_2, _b; /** * 1. Set the surrounding agent’s mutation observer microtask queued to false. * 2. Let notifySet be a clone of the surrounding agent’s mutation observers. * 3. Let signalSet be a clone of the surrounding agent’s signal slots. * 4. Empty the surrounding agent’s signal slots. */ - var window = DOMImpl_1.dom.window; + const window = DOMImpl_1.dom.window; window._mutationObserverMicrotaskQueued = false; - var notifySet = infra_1.set.clone(window._mutationObservers); - var signalSet = infra_1.set.clone(window._signalSlots); + const notifySet = infra_1.set.clone(window._mutationObservers); + const signalSet = infra_1.set.clone(window._signalSlots); infra_1.set.empty(window._signalSlots); - var _loop_1 = function (mo) { + /** + * 5. For each mo of notifySet: + */ + for (const mo of notifySet) { /** * 5.1. Let records be a clone of mo’s record queue. * 5.2. Empty mo’s record queue. */ - var records = infra_1.list.clone(mo._recordQueue); + const records = infra_1.list.clone(mo._recordQueue); infra_1.list.empty(mo._recordQueue); /** * 5.3. For each node of mo’s node list, remove all transient registered * observers whose observer is mo from node’s registered observer list. */ - for (var i = 0; i < mo._nodeList.length; i++) { - var node = mo._nodeList[i]; - infra_1.list.remove(node._registeredObserverList, function (observer) { + for (let i = 0; i < mo._nodeList.length; i++) { + const node = mo._nodeList[i]; + infra_1.list.remove(node._registeredObserverList, (observer) => { return util_1.Guard.isTransientRegisteredObserver(observer) && observer.observer === mo; }); } @@ -19906,44 +19520,17 @@ function observer_notifyMutationObservers() { // TODO: Report the exception } } - }; - try { - /** - * 5. For each mo of notifySet: - */ - for (var notifySet_1 = __values(notifySet), notifySet_1_1 = notifySet_1.next(); !notifySet_1_1.done; notifySet_1_1 = notifySet_1.next()) { - var mo = notifySet_1_1.value; - _loop_1(mo); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (notifySet_1_1 && !notifySet_1_1.done && (_a = notifySet_1.return)) _a.call(notifySet_1); - } - finally { if (e_1) throw e_1.error; } } /** * 6. For each slot of signalSet, fire an event named slotchange, with its * bubbles attribute set to true, at slot. */ if (DOMImpl_1.dom.features.slots) { - try { - for (var signalSet_1 = __values(signalSet), signalSet_1_1 = signalSet_1.next(); !signalSet_1_1.done; signalSet_1_1 = signalSet_1.next()) { - var slot = signalSet_1_1.value; - EventAlgorithm_1.event_fireAnEvent("slotchange", slot, undefined, { bubbles: true }); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (signalSet_1_1 && !signalSet_1_1.done && (_b = signalSet_1.return)) _b.call(signalSet_1); - } - finally { if (e_2) throw e_2.error; } + for (const slot of signalSet) { + (0, EventAlgorithm_1.event_fireAnEvent)("slotchange", slot, undefined, { bubbles: true }); } } } -exports.observer_notifyMutationObservers = observer_notifyMutationObservers; /** * Queues a mutation record of the given type for target. * @@ -19958,18 +19545,17 @@ exports.observer_notifyMutationObservers = observer_notifyMutationObservers; * @param nextSibling - next sibling of target before mutation */ function observer_queueMutationRecord(type, target, name, namespace, oldValue, addedNodes, removedNodes, previousSibling, nextSibling) { - var e_3, _a; /** * 1. Let interestedObservers be an empty map. * 2. Let nodes be the inclusive ancestors of target. * 3. For each node in nodes, and then for each registered of node’s * registered observer list: */ - var interestedObservers = new Map(); - var node = TreeAlgorithm_1.tree_getFirstAncestorNode(target, true); + const interestedObservers = new Map(); + let node = (0, TreeAlgorithm_1.tree_getFirstAncestorNode)(target, true); while (node !== null) { - for (var i = 0; i < node._registeredObserverList.length; i++) { - var registered = node._registeredObserverList[i]; + for (let i = 0; i < node._registeredObserverList.length; i++) { + const registered = node._registeredObserverList[i]; /** * 3.1. Let options be registered’s options. * 3.2. If none of the following are true @@ -19981,7 +19567,7 @@ function observer_queueMutationRecord(type, target, name, namespace, oldValue, a * - type is "characterData" and options’s characterData is not true * - type is "childList" and options’s childList is false */ - var options = registered.options; + const options = registered.options; if (node !== target && !options.subtree) continue; if (type === "attributes" && !options.attributes) @@ -20003,7 +19589,7 @@ function observer_queueMutationRecord(type, target, name, namespace, oldValue, a * characterDataOldValue is true, then set interestedObservers[mo] * to oldValue. */ - var mo = registered.observer; + const mo = registered.observer; if (!interestedObservers.has(mo)) { interestedObservers.set(mo, null); } @@ -20012,41 +19598,30 @@ function observer_queueMutationRecord(type, target, name, namespace, oldValue, a interestedObservers.set(mo, oldValue); } } - node = TreeAlgorithm_1.tree_getNextAncestorNode(target, node, true); + node = (0, TreeAlgorithm_1.tree_getNextAncestorNode)(target, node, true); } - try { + /** + * 4. For each observer → mappedOldValue of interestedObservers: + */ + for (const [observer, mappedOldValue] of interestedObservers) { /** - * 4. For each observer → mappedOldValue of interestedObservers: + * 4.1. Let record be a new MutationRecord object with its type set to + * type, target set to target, attributeName set to name, + * attributeNamespace set to namespace, oldValue set to mappedOldValue, + * addedNodes set to addedNodes, removedNodes set to removedNodes, + * previousSibling set to previousSibling, and nextSibling set to + * nextSibling. + * 4.2. Enqueue record to observer’s record queue. */ - for (var interestedObservers_1 = __values(interestedObservers), interestedObservers_1_1 = interestedObservers_1.next(); !interestedObservers_1_1.done; interestedObservers_1_1 = interestedObservers_1.next()) { - var _b = __read(interestedObservers_1_1.value, 2), observer = _b[0], mappedOldValue = _b[1]; - /** - * 4.1. Let record be a new MutationRecord object with its type set to - * type, target set to target, attributeName set to name, - * attributeNamespace set to namespace, oldValue set to mappedOldValue, - * addedNodes set to addedNodes, removedNodes set to removedNodes, - * previousSibling set to previousSibling, and nextSibling set to - * nextSibling. - * 4.2. Enqueue record to observer’s record queue. - */ - var record = CreateAlgorithm_1.create_mutationRecord(type, target, CreateAlgorithm_1.create_nodeListStatic(target, addedNodes), CreateAlgorithm_1.create_nodeListStatic(target, removedNodes), previousSibling, nextSibling, name, namespace, mappedOldValue); - var queue = observer._recordQueue; - queue.push(record); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (interestedObservers_1_1 && !interestedObservers_1_1.done && (_a = interestedObservers_1.return)) _a.call(interestedObservers_1); - } - finally { if (e_3) throw e_3.error; } + const record = (0, CreateAlgorithm_1.create_mutationRecord)(type, target, (0, CreateAlgorithm_1.create_nodeListStatic)(target, addedNodes), (0, CreateAlgorithm_1.create_nodeListStatic)(target, removedNodes), previousSibling, nextSibling, name, namespace, mappedOldValue); + const queue = observer._recordQueue; + queue.push(record); } /** * 5. Queue a mutation observer microtask. */ observer_queueAMutationObserverMicrotask(); } -exports.observer_queueMutationRecord = observer_queueMutationRecord; /** * Queues a tree mutation record for target. * @@ -20065,7 +19640,6 @@ function observer_queueTreeMutationRecord(target, addedNodes, removedNodes, prev */ observer_queueMutationRecord("childList", target, null, null, null, addedNodes, removedNodes, previousSibling, nextSibling); } -exports.observer_queueTreeMutationRecord = observer_queueTreeMutationRecord; /** * Queues an attribute mutation record for target. * @@ -20082,7 +19656,6 @@ function observer_queueAttributeMutationRecord(target, name, namespace, oldValue */ observer_queueMutationRecord("attributes", target, name, namespace, oldValue, [], [], null, null); } -exports.observer_queueAttributeMutationRecord = observer_queueAttributeMutationRecord; //# sourceMappingURL=MutationObserverAlgorithm.js.map /***/ }), @@ -20093,9 +19666,12 @@ exports.observer_queueAttributeMutationRecord = observer_queueAttributeMutationR "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(13166); -var infra_1 = __nccwpck_require__(84251); -var XMLAlgorithm_1 = __nccwpck_require__(57030); +exports.namespace_validate = namespace_validate; +exports.namespace_validateAndExtract = namespace_validateAndExtract; +exports.namespace_extractQName = namespace_extractQName; +const DOMException_1 = __nccwpck_require__(13166); +const infra_1 = __nccwpck_require__(84251); +const XMLAlgorithm_1 = __nccwpck_require__(57030); /** * Validates the given qualified name. * @@ -20107,12 +19683,11 @@ function namespace_validate(qualifiedName) { * DOMException if qualifiedName does not match the Name or QName * production. */ - if (!XMLAlgorithm_1.xml_isName(qualifiedName)) - throw new DOMException_1.InvalidCharacterError("Invalid XML name: " + qualifiedName); - if (!XMLAlgorithm_1.xml_isQName(qualifiedName)) - throw new DOMException_1.InvalidCharacterError("Invalid XML qualified name: " + qualifiedName + "."); + if (!(0, XMLAlgorithm_1.xml_isName)(qualifiedName)) + throw new DOMException_1.InvalidCharacterError(`Invalid XML name: ${qualifiedName}`); + if (!(0, XMLAlgorithm_1.xml_isQName)(qualifiedName)) + throw new DOMException_1.InvalidCharacterError(`Invalid XML qualified name: ${qualifiedName}.`); } -exports.namespace_validate = namespace_validate; /** * Validates and extracts a namespace, prefix and localName from the * given namespace and qualified name. @@ -20144,22 +19719,21 @@ function namespace_validateAndExtract(namespace, qualifiedName) { if (!namespace) namespace = null; namespace_validate(qualifiedName); - var parts = qualifiedName.split(':'); - var prefix = (parts.length === 2 ? parts[0] : null); - var localName = (parts.length === 2 ? parts[1] : qualifiedName); + const parts = qualifiedName.split(':'); + const prefix = (parts.length === 2 ? parts[0] : null); + const localName = (parts.length === 2 ? parts[1] : qualifiedName); if (prefix && namespace === null) throw new DOMException_1.NamespaceError("Qualified name includes a prefix but the namespace is null."); if (prefix === "xml" && namespace !== infra_1.namespace.XML) - throw new DOMException_1.NamespaceError("Qualified name includes the \"xml\" prefix but the namespace is not the XML namespace."); + throw new DOMException_1.NamespaceError(`Qualified name includes the "xml" prefix but the namespace is not the XML namespace.`); if (namespace !== infra_1.namespace.XMLNS && (prefix === "xmlns" || qualifiedName === "xmlns")) - throw new DOMException_1.NamespaceError("Qualified name includes the \"xmlns\" prefix but the namespace is not the XMLNS namespace."); + throw new DOMException_1.NamespaceError(`Qualified name includes the "xmlns" prefix but the namespace is not the XMLNS namespace.`); if (namespace === infra_1.namespace.XMLNS && (prefix !== "xmlns" && qualifiedName !== "xmlns")) - throw new DOMException_1.NamespaceError("Qualified name does not include the \"xmlns\" prefix but the namespace is the XMLNS namespace."); + throw new DOMException_1.NamespaceError(`Qualified name does not include the "xmlns" prefix but the namespace is the XMLNS namespace.`); return [namespace, prefix, localName]; } -exports.namespace_validateAndExtract = namespace_validateAndExtract; /** * Extracts a prefix and localName from the given qualified name. * @@ -20169,41 +19743,37 @@ exports.namespace_validateAndExtract = namespace_validateAndExtract; */ function namespace_extractQName(qualifiedName) { namespace_validate(qualifiedName); - var parts = qualifiedName.split(':'); - var prefix = (parts.length === 2 ? parts[0] : null); - var localName = (parts.length === 2 ? parts[1] : qualifiedName); + const parts = qualifiedName.split(':'); + const prefix = (parts.length === 2 ? parts[0] : null); + const localName = (parts.length === 2 ? parts[1] : qualifiedName); return [prefix, localName]; } -exports.namespace_extractQName = namespace_extractQName; //# sourceMappingURL=NamespaceAlgorithm.js.map /***/ }), /***/ 74924: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(65282); -var infra_1 = __nccwpck_require__(84251); -var CreateAlgorithm_1 = __nccwpck_require__(57339); -var OrderedSetAlgorithm_1 = __nccwpck_require__(53670); -var DOMAlgorithm_1 = __nccwpck_require__(9628); -var MutationAlgorithm_1 = __nccwpck_require__(45463); -var ElementAlgorithm_1 = __nccwpck_require__(51849); +exports.node_stringReplaceAll = node_stringReplaceAll; +exports.node_clone = node_clone; +exports.node_equals = node_equals; +exports.node_listOfElementsWithQualifiedName = node_listOfElementsWithQualifiedName; +exports.node_listOfElementsWithNamespace = node_listOfElementsWithNamespace; +exports.node_listOfElementsWithClassNames = node_listOfElementsWithClassNames; +exports.node_locateANamespacePrefix = node_locateANamespacePrefix; +exports.node_locateANamespace = node_locateANamespace; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(65282); +const infra_1 = __nccwpck_require__(84251); +const CreateAlgorithm_1 = __nccwpck_require__(57339); +const OrderedSetAlgorithm_1 = __nccwpck_require__(53670); +const DOMAlgorithm_1 = __nccwpck_require__(9628); +const MutationAlgorithm_1 = __nccwpck_require__(45463); +const ElementAlgorithm_1 = __nccwpck_require__(51849); /** * Replaces the contents of the given node with a single text node. * @@ -20217,13 +19787,12 @@ function node_stringReplaceAll(str, parent) { * whose data is string and node document is parent’s node document. * 3. Replace all with node within parent. */ - var node = null; + let node = null; if (str !== '') { - node = CreateAlgorithm_1.create_text(parent._nodeDocument, str); + node = (0, CreateAlgorithm_1.create_text)(parent._nodeDocument, str); } - MutationAlgorithm_1.mutation_replaceAll(node, parent); + (0, MutationAlgorithm_1.mutation_replaceAll)(node, parent); } -exports.node_stringReplaceAll = node_stringReplaceAll; /** * Clones a node. * @@ -20231,16 +19800,13 @@ exports.node_stringReplaceAll = node_stringReplaceAll; * @param document - the document to own the cloned node * @param cloneChildrenFlag - whether to clone node's children */ -function node_clone(node, document, cloneChildrenFlag) { - var e_1, _a, e_2, _b; - if (document === void 0) { document = null; } - if (cloneChildrenFlag === void 0) { cloneChildrenFlag = false; } +function node_clone(node, document = null, cloneChildrenFlag = false) { /** * 1. If document is not given, let document be node’s node document. */ if (document === null) document = node._nodeDocument; - var copy; + let copy; if (util_1.Guard.isElementNode(node)) { /** * 2. If node is an element, then: @@ -20251,20 +19817,10 @@ function node_clone(node, document, cloneChildrenFlag) { * 2.2.1. Let copyAttribute be a clone of attribute. * 2.2.2. Append copyAttribute to copy. */ - copy = ElementAlgorithm_1.element_createAnElement(document, node._localName, node._namespace, node._namespacePrefix, node._is, false); - try { - for (var _c = __values(node._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { - var attribute = _d.value; - var copyAttribute = node_clone(attribute, document); - ElementAlgorithm_1.element_append(copyAttribute, copy); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_1) throw e_1.error; } + copy = (0, ElementAlgorithm_1.element_createAnElement)(document, node._localName, node._namespace, node._namespacePrefix, node._is, false); + for (const attribute of node._attributeList) { + const copyAttribute = node_clone(attribute, document); + (0, ElementAlgorithm_1.element_append)(copyAttribute, copy); } } else { @@ -20287,7 +19843,7 @@ function node_clone(node, document, cloneChildrenFlag) { * - Any other node */ if (util_1.Guard.isDocumentNode(node)) { - var doc = CreateAlgorithm_1.create_document(); + const doc = (0, CreateAlgorithm_1.create_document)(); doc._encoding = node._encoding; doc._contentType = node._contentType; doc._URL = node._URL; @@ -20297,30 +19853,30 @@ function node_clone(node, document, cloneChildrenFlag) { copy = doc; } else if (util_1.Guard.isDocumentTypeNode(node)) { - var doctype = CreateAlgorithm_1.create_documentType(document, node._name, node._publicId, node._systemId); + const doctype = (0, CreateAlgorithm_1.create_documentType)(document, node._name, node._publicId, node._systemId); copy = doctype; } else if (util_1.Guard.isAttrNode(node)) { - var attr = CreateAlgorithm_1.create_attr(document, node.localName); + const attr = (0, CreateAlgorithm_1.create_attr)(document, node.localName); attr._namespace = node._namespace; attr._namespacePrefix = node._namespacePrefix; attr._value = node._value; copy = attr; } else if (util_1.Guard.isExclusiveTextNode(node)) { - copy = CreateAlgorithm_1.create_text(document, node._data); + copy = (0, CreateAlgorithm_1.create_text)(document, node._data); } else if (util_1.Guard.isCDATASectionNode(node)) { - copy = CreateAlgorithm_1.create_cdataSection(document, node._data); + copy = (0, CreateAlgorithm_1.create_cdataSection)(document, node._data); } else if (util_1.Guard.isCommentNode(node)) { - copy = CreateAlgorithm_1.create_comment(document, node._data); + copy = (0, CreateAlgorithm_1.create_comment)(document, node._data); } else if (util_1.Guard.isProcessingInstructionNode(node)) { - copy = CreateAlgorithm_1.create_processingInstruction(document, node._target, node._data); + copy = (0, CreateAlgorithm_1.create_processingInstruction)(document, node._target, node._data); } else if (util_1.Guard.isDocumentFragmentNode(node)) { - copy = CreateAlgorithm_1.create_documentFragment(document); + copy = (0, CreateAlgorithm_1.create_documentFragment)(document); } else { copy = Object.create(node); @@ -20343,7 +19899,7 @@ function node_clone(node, document, cloneChildrenFlag) { * if set, as parameters. */ if (DOMImpl_1.dom.features.steps) { - DOMAlgorithm_1.dom_runCloningSteps(copy, node, document, cloneChildrenFlag); + (0, DOMAlgorithm_1.dom_runCloningSteps)(copy, node, document, cloneChildrenFlag); } /** * 6. If the clone children flag is set, clone all the children of node and @@ -20351,19 +19907,9 @@ function node_clone(node, document, cloneChildrenFlag) { * flag being set. */ if (cloneChildrenFlag) { - try { - for (var _e = __values(node._children), _f = _e.next(); !_f.done; _f = _e.next()) { - var child = _f.value; - var childCopy = node_clone(child, document, true); - MutationAlgorithm_1.mutation_append(childCopy, copy); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_2) throw e_2.error; } + for (const child of node._children) { + const childCopy = node_clone(child, document, true); + (0, MutationAlgorithm_1.mutation_append)(childCopy, copy); } } /** @@ -20371,7 +19917,6 @@ function node_clone(node, document, cloneChildrenFlag) { */ return copy; } -exports.node_clone = node_clone; /** * Determines if two nodes can be considered equal. * @@ -20379,7 +19924,6 @@ exports.node_clone = node_clone; * @param b - node to compare */ function node_equals(a, b) { - var e_3, _a, e_4, _b; /** * 1. A and B’s nodeType attribute value is identical. */ @@ -20428,36 +19972,16 @@ function node_equals(a, b) { * that equals an attribute in B’s attribute list. */ if (util_1.Guard.isElementNode(a) && util_1.Guard.isElementNode(b)) { - var attrMap = {}; - try { - for (var _c = __values(a._attributeList), _d = _c.next(); !_d.done; _d = _c.next()) { - var attrA = _d.value; - attrMap[attrA._localName] = attrA; - } + const attrMap = {}; + for (const attrA of a._attributeList) { + attrMap[attrA._localName] = attrA; } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_3) throw e_3.error; } - } - try { - for (var _e = __values(b._attributeList), _f = _e.next(); !_f.done; _f = _e.next()) { - var attrB = _f.value; - var attrA = attrMap[attrB._localName]; - if (!attrA) - return false; - if (!node_equals(attrA, attrB)) - return false; - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_4) throw e_4.error; } + for (const attrB of b._attributeList) { + const attrA = attrMap[attrB._localName]; + if (!attrA) + return false; + if (!node_equals(attrA, attrB)) + return false; } } /** @@ -20466,13 +19990,13 @@ function node_equals(a, b) { */ if (a._children.size !== b._children.size) return false; - var itA = a._children[Symbol.iterator](); - var itB = b._children[Symbol.iterator](); - var resultA = itA.next(); - var resultB = itB.next(); + const itA = a._children[Symbol.iterator](); + const itB = b._children[Symbol.iterator](); + let resultA = itA.next(); + let resultB = itB.next(); while (!resultA.done && !resultB.done) { - var child1 = resultA.value; - var child2 = resultB.value; + const child1 = resultA.value; + const child2 = resultB.value; if (!node_equals(child1, child2)) return false; resultA = itA.next(); @@ -20480,7 +20004,6 @@ function node_equals(a, b) { } return true; } -exports.node_equals = node_equals; /** * Returns a collection of elements with the given qualified name which are * descendants of the given root node. @@ -20504,10 +20027,10 @@ function node_listOfElementsWithQualifiedName(qualifiedName, root) { * matches descendant elements whose qualified name is qualifiedName. */ if (qualifiedName === "*") { - return CreateAlgorithm_1.create_htmlCollection(root); + return (0, CreateAlgorithm_1.create_htmlCollection)(root); } else if (root._nodeDocument._type === "html") { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (0, CreateAlgorithm_1.create_htmlCollection)(root, function (ele) { if (ele._namespace === infra_1.namespace.HTML && ele._qualifiedName === qualifiedName.toLowerCase()) { return true; @@ -20522,12 +20045,11 @@ function node_listOfElementsWithQualifiedName(qualifiedName, root) { }); } else { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (0, CreateAlgorithm_1.create_htmlCollection)(root, function (ele) { return (ele._qualifiedName === qualifiedName); }); } } -exports.node_listOfElementsWithQualifiedName = node_listOfElementsWithQualifiedName; /** * Returns a collection of elements with the given namespace which are * descendants of the given root node. @@ -20555,25 +20077,24 @@ function node_listOfElementsWithNamespace(namespace, localName, root) { if (namespace === '') namespace = null; if (namespace === "*" && localName === "*") { - return CreateAlgorithm_1.create_htmlCollection(root); + return (0, CreateAlgorithm_1.create_htmlCollection)(root); } else if (namespace === "*") { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (0, CreateAlgorithm_1.create_htmlCollection)(root, function (ele) { return (ele._localName === localName); }); } else if (localName === "*") { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (0, CreateAlgorithm_1.create_htmlCollection)(root, function (ele) { return (ele._namespace === namespace); }); } else { - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { + return (0, CreateAlgorithm_1.create_htmlCollection)(root, function (ele) { return (ele._localName === localName && ele._namespace === namespace); }); } } -exports.node_listOfElementsWithNamespace = node_listOfElementsWithNamespace; /** * Returns a collection of elements with the given class names which are * descendants of the given root node. @@ -20594,17 +20115,16 @@ function node_listOfElementsWithClassNames(classNames, root) { * manner if root’s node document’s mode is "quirks", and in a * case-sensitive manner otherwise. */ - var classes = OrderedSetAlgorithm_1.orderedSet_parse(classNames); + const classes = (0, OrderedSetAlgorithm_1.orderedSet_parse)(classNames); if (classes.size === 0) { - return CreateAlgorithm_1.create_htmlCollection(root, function () { return false; }); + return (0, CreateAlgorithm_1.create_htmlCollection)(root, () => false); } - var caseSensitive = (root._nodeDocument._mode !== "quirks"); - return CreateAlgorithm_1.create_htmlCollection(root, function (ele) { - var eleClasses = ele.classList; - return OrderedSetAlgorithm_1.orderedSet_contains(eleClasses._tokenSet, classes, caseSensitive); + const caseSensitive = (root._nodeDocument._mode !== "quirks"); + return (0, CreateAlgorithm_1.create_htmlCollection)(root, function (ele) { + const eleClasses = ele.classList; + return (0, OrderedSetAlgorithm_1.orderedSet_contains)(eleClasses._tokenSet, classes, caseSensitive); }); } -exports.node_listOfElementsWithClassNames = node_listOfElementsWithClassNames; /** * Searches for a namespace prefix associated with the given namespace * starting from the given element through its ancestors. @@ -20625,8 +20145,8 @@ function node_locateANamespacePrefix(element, namespace) { * value is namespace, then return element’s first such attribute’s * local name. */ - for (var i = 0; i < element._attributeList.length; i++) { - var attr = element._attributeList[i]; + for (let i = 0; i < element._attributeList.length; i++) { + const attr = element._attributeList[i]; if (attr._namespacePrefix === "xmlns" && attr._value === namespace) { return attr._localName; } @@ -20643,7 +20163,6 @@ function node_locateANamespacePrefix(element, namespace) { */ return null; } -exports.node_locateANamespacePrefix = node_locateANamespacePrefix; /** * Searches for a namespace associated with the given namespace prefix * starting from the given node through its ancestors. @@ -20667,8 +20186,8 @@ function node_locateANamespace(node, prefix) { * namespace prefix is null, and local name is "xmlns", then return its * value if it is not the empty string, and null otherwise. */ - for (var i = 0; i < node._attributeList.length; i++) { - var attr = node._attributeList[i]; + for (let i = 0; i < node._attributeList.length; i++) { + const attr = node._attributeList[i]; if (attr._namespace === infra_1.namespace.XMLNS && attr._namespacePrefix === "xmlns" && attr._localName === prefix) { @@ -20724,7 +20243,6 @@ function node_locateANamespace(node, prefix) { return node_locateANamespace(node._parent, prefix); } } -exports.node_locateANamespace = node_locateANamespace; //# sourceMappingURL=NodeAlgorithm.js.map /***/ }), @@ -20735,10 +20253,12 @@ exports.node_locateANamespace = node_locateANamespace; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var interfaces_1 = __nccwpck_require__(27305); -var TraversalAlgorithm_1 = __nccwpck_require__(80998); -var TreeAlgorithm_1 = __nccwpck_require__(16620); +exports.nodeIterator_traverse = nodeIterator_traverse; +exports.nodeIterator_iteratorList = nodeIterator_iteratorList; +const DOMImpl_1 = __nccwpck_require__(14177); +const interfaces_1 = __nccwpck_require__(27305); +const TraversalAlgorithm_1 = __nccwpck_require__(80998); +const TreeAlgorithm_1 = __nccwpck_require__(16620); /** * Returns the next or previous node in the subtree, or `null` if * there are none. @@ -20752,8 +20272,8 @@ function nodeIterator_traverse(iterator, forward) { * 1. Let node be iterator’s reference. * 2. Let beforeNode be iterator’s pointer before reference. */ - var node = iterator._reference; - var beforeNode = iterator._pointerBeforeReference; + let node = iterator._reference; + let beforeNode = iterator._pointerBeforeReference; /** * 3. While true: */ @@ -20771,7 +20291,7 @@ function nodeIterator_traverse(iterator, forward) { * node in iterator’s iterator collection. If there is no such node, * then return null. */ - var nextNode = TreeAlgorithm_1.tree_getFollowingNode(iterator._root, node); + const nextNode = (0, TreeAlgorithm_1.tree_getFollowingNode)(iterator._root, node); if (nextNode) { node = nextNode; } @@ -20796,7 +20316,7 @@ function nodeIterator_traverse(iterator, forward) { * node in iterator’s iterator collection. If there is no such node, * then return null. */ - var prevNode = TreeAlgorithm_1.tree_getPrecedingNode(iterator.root, node); + const prevNode = (0, TreeAlgorithm_1.tree_getPrecedingNode)(iterator.root, node); if (prevNode) { node = prevNode; } @@ -20815,7 +20335,7 @@ function nodeIterator_traverse(iterator, forward) { * 3.2. Let result be the result of filtering node within iterator. * 3.3. If result is FILTER_ACCEPT, then break. */ - var result = TraversalAlgorithm_1.traversal_filter(iterator, node); + const result = (0, TraversalAlgorithm_1.traversal_filter)(iterator, node); if (result === interfaces_1.FilterResult.Accept) { break; } @@ -20829,56 +20349,27 @@ function nodeIterator_traverse(iterator, forward) { iterator._pointerBeforeReference = beforeNode; return node; } -exports.nodeIterator_traverse = nodeIterator_traverse; /** * Gets the global iterator list. */ function nodeIterator_iteratorList() { return DOMImpl_1.dom.window._iteratorList; } -exports.nodeIterator_iteratorList = nodeIterator_iteratorList; //# sourceMappingURL=NodeIteratorAlgorithm.js.map /***/ }), /***/ 53670: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var infra_1 = __nccwpck_require__(84251); +exports.orderedSet_parse = orderedSet_parse; +exports.orderedSet_serialize = orderedSet_serialize; +exports.orderedSet_sanitize = orderedSet_sanitize; +exports.orderedSet_contains = orderedSet_contains; +const infra_1 = __nccwpck_require__(84251); /** * Converts a whitespace separated string into an array of tokens. * @@ -20891,10 +20382,9 @@ function orderedSet_parse(value) { * 3. For each token in inputTokens, append token to tokens. * 4. Return tokens. */ - var inputTokens = infra_1.string.splitAStringOnASCIIWhitespace(value); + const inputTokens = infra_1.string.splitAStringOnASCIIWhitespace(value); return new Set(inputTokens); } -exports.orderedSet_parse = orderedSet_parse; /** * Converts an array of tokens into a space separated string. * @@ -20905,9 +20395,8 @@ function orderedSet_serialize(tokens) { * The ordered set serializer takes a set and returns the concatenation of * set using U+0020 SPACE. */ - return __spread(tokens).join(' '); + return [...tokens].join(' '); } -exports.orderedSet_serialize = orderedSet_serialize; /** * Removes duplicate tokens and convert all whitespace characters * to space. @@ -20917,7 +20406,6 @@ exports.orderedSet_serialize = orderedSet_serialize; function orderedSet_sanitize(value) { return orderedSet_serialize(orderedSet_parse(value)); } -exports.orderedSet_sanitize = orderedSet_sanitize; /** * Determines whether a set contains the other. * @@ -20926,72 +20414,40 @@ exports.orderedSet_sanitize = orderedSet_sanitize; * @param caseSensitive - whether matches are case-sensitive */ function orderedSet_contains(set1, set2, caseSensitive) { - var e_1, _a, e_2, _b; - try { - for (var set2_1 = __values(set2), set2_1_1 = set2_1.next(); !set2_1_1.done; set2_1_1 = set2_1.next()) { - var val2 = set2_1_1.value; - var found = false; - try { - for (var set1_1 = (e_2 = void 0, __values(set1)), set1_1_1 = set1_1.next(); !set1_1_1.done; set1_1_1 = set1_1.next()) { - var val1 = set1_1_1.value; - if (caseSensitive) { - if (val1 === val2) { - found = true; - break; - } - } - else { - if (val1.toUpperCase() === val2.toUpperCase()) { - found = true; - break; - } - } + for (const val2 of set2) { + let found = false; + for (const val1 of set1) { + if (caseSensitive) { + if (val1 === val2) { + found = true; + break; } } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (set1_1_1 && !set1_1_1.done && (_b = set1_1.return)) _b.call(set1_1); + else { + if (val1.toUpperCase() === val2.toUpperCase()) { + found = true; + break; } - finally { if (e_2) throw e_2.error; } } - if (!found) - return false; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (set2_1_1 && !set2_1_1.done && (_a = set2_1.return)) _a.call(set2_1); } - finally { if (e_1) throw e_1.error; } + if (!found) + return false; } return true; } -exports.orderedSet_contains = orderedSet_contains; //# sourceMappingURL=OrderedSetAlgorithm.js.map /***/ }), /***/ 2328: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); -var CreateAlgorithm_1 = __nccwpck_require__(57339); +exports.parentNode_convertNodesIntoANode = parentNode_convertNodesIntoANode; +const util_1 = __nccwpck_require__(76195); +const CreateAlgorithm_1 = __nccwpck_require__(57339); /** * Converts the given nodes or strings into a node (if `nodes` has * only one element) or a document fragment. @@ -21000,17 +20456,16 @@ var CreateAlgorithm_1 = __nccwpck_require__(57339); * @param document - owner document */ function parentNode_convertNodesIntoANode(nodes, document) { - var e_1, _a; /** * 1. Let node be null. * 2. Replace each string in nodes with a new Text node whose data is the * string and node document is document. */ - var node = null; - for (var i = 0; i < nodes.length; i++) { - var item = nodes[i]; - if (util_1.isString(item)) { - var text = CreateAlgorithm_1.create_text(document, item); + let node = null; + for (let i = 0; i < nodes.length; i++) { + const item = nodes[i]; + if ((0, util_1.isString)(item)) { + const text = (0, CreateAlgorithm_1.create_text)(document, item); nodes[i] = text; } } @@ -21023,20 +20478,10 @@ function parentNode_convertNodesIntoANode(nodes, document) { node = nodes[0]; } else { - node = CreateAlgorithm_1.create_documentFragment(document); - var ns = node; - try { - for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) { - var item = nodes_1_1.value; - ns.appendChild(item); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1); - } - finally { if (e_1) throw e_1.error; } + node = (0, CreateAlgorithm_1.create_documentFragment)(document); + const ns = node; + for (const item of nodes) { + ns.appendChild(item); } } /** @@ -21044,58 +20489,38 @@ function parentNode_convertNodesIntoANode(nodes, document) { */ return node; } -exports.parentNode_convertNodesIntoANode = parentNode_convertNodesIntoANode; //# sourceMappingURL=ParentNodeAlgorithm.js.map /***/ }), /***/ 30457: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var DOMException_1 = __nccwpck_require__(13166); -var util_1 = __nccwpck_require__(65282); -var CreateAlgorithm_1 = __nccwpck_require__(57339); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var BoundaryPointAlgorithm_1 = __nccwpck_require__(81054); -var CharacterDataAlgorithm_1 = __nccwpck_require__(19461); -var NodeAlgorithm_1 = __nccwpck_require__(74924); -var MutationAlgorithm_1 = __nccwpck_require__(45463); -var TextAlgorithm_1 = __nccwpck_require__(13512); +exports.range_collapsed = range_collapsed; +exports.range_root = range_root; +exports.range_isContained = range_isContained; +exports.range_isPartiallyContained = range_isPartiallyContained; +exports.range_setTheStart = range_setTheStart; +exports.range_setTheEnd = range_setTheEnd; +exports.range_select = range_select; +exports.range_extract = range_extract; +exports.range_cloneTheContents = range_cloneTheContents; +exports.range_insert = range_insert; +exports.range_getContainedNodes = range_getContainedNodes; +exports.range_getPartiallyContainedNodes = range_getPartiallyContainedNodes; +const interfaces_1 = __nccwpck_require__(27305); +const DOMException_1 = __nccwpck_require__(13166); +const util_1 = __nccwpck_require__(65282); +const CreateAlgorithm_1 = __nccwpck_require__(57339); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const BoundaryPointAlgorithm_1 = __nccwpck_require__(81054); +const CharacterDataAlgorithm_1 = __nccwpck_require__(19461); +const NodeAlgorithm_1 = __nccwpck_require__(74924); +const MutationAlgorithm_1 = __nccwpck_require__(45463); +const TextAlgorithm_1 = __nccwpck_require__(13512); /** * Determines if the node's start boundary point is at its end boundary * point. @@ -21108,7 +20533,6 @@ function range_collapsed(range) { */ return (range._startNode === range._endNode && range._startOffset === range._endOffset); } -exports.range_collapsed = range_collapsed; /** * Gets the root node of a range. * @@ -21118,9 +20542,8 @@ function range_root(range) { /** * The root of a live range is the root of its start node. */ - return TreeAlgorithm_1.tree_rootNode(range._startNode); + return (0, TreeAlgorithm_1.tree_rootNode)(range._startNode); } -exports.range_root = range_root; /** * Determines if a node is fully contained in a range. * @@ -21133,11 +20556,10 @@ function range_isContained(node, range) { * root, and (node, 0) is after range’s start, and (node, node’s length) is * before range’s end. */ - return (TreeAlgorithm_1.tree_rootNode(node) === range_root(range) && - BoundaryPointAlgorithm_1.boundaryPoint_position([node, 0], range._start) === interfaces_1.BoundaryPosition.After && - BoundaryPointAlgorithm_1.boundaryPoint_position([node, TreeAlgorithm_1.tree_nodeLength(node)], range._end) === interfaces_1.BoundaryPosition.Before); + return ((0, TreeAlgorithm_1.tree_rootNode)(node) === range_root(range) && + (0, BoundaryPointAlgorithm_1.boundaryPoint_position)([node, 0], range._start) === interfaces_1.BoundaryPosition.After && + (0, BoundaryPointAlgorithm_1.boundaryPoint_position)([node, (0, TreeAlgorithm_1.tree_nodeLength)(node)], range._end) === interfaces_1.BoundaryPosition.Before); } -exports.range_isContained = range_isContained; /** * Determines if a node is partially contained in a range. * @@ -21150,11 +20572,10 @@ function range_isPartiallyContained(node, range) { * ancestor of the live range’s start node but not its end node, * or vice versa. */ - var startCheck = TreeAlgorithm_1.tree_isAncestorOf(range._startNode, node, true); - var endCheck = TreeAlgorithm_1.tree_isAncestorOf(range._endNode, node, true); + const startCheck = (0, TreeAlgorithm_1.tree_isAncestorOf)(range._startNode, node, true); + const endCheck = (0, TreeAlgorithm_1.tree_isAncestorOf)(range._endNode, node, true); return (startCheck && !endCheck) || (!startCheck && endCheck); } -exports.range_isPartiallyContained = range_isPartiallyContained; /** * Sets the start boundary point of a range. * @@ -21176,17 +20597,16 @@ function range_setTheStart(range, node, offset) { if (util_1.Guard.isDocumentTypeNode(node)) { throw new DOMException_1.InvalidNodeTypeError(); } - if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { + if (offset > (0, TreeAlgorithm_1.tree_nodeLength)(node)) { throw new DOMException_1.IndexSizeError(); } - var bp = [node, offset]; - if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || - BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._end) === interfaces_1.BoundaryPosition.After) { + const bp = [node, offset]; + if (range_root(range) !== (0, TreeAlgorithm_1.tree_rootNode)(node) || + (0, BoundaryPointAlgorithm_1.boundaryPoint_position)(bp, range._end) === interfaces_1.BoundaryPosition.After) { range._end = bp; } range._start = bp; } -exports.range_setTheStart = range_setTheStart; /** * Sets the end boundary point of a range. * @@ -21208,17 +20628,16 @@ function range_setTheEnd(range, node, offset) { if (util_1.Guard.isDocumentTypeNode(node)) { throw new DOMException_1.InvalidNodeTypeError(); } - if (offset > TreeAlgorithm_1.tree_nodeLength(node)) { + if (offset > (0, TreeAlgorithm_1.tree_nodeLength)(node)) { throw new DOMException_1.IndexSizeError(); } - var bp = [node, offset]; - if (range_root(range) !== TreeAlgorithm_1.tree_rootNode(node) || - BoundaryPointAlgorithm_1.boundaryPoint_position(bp, range._start) === interfaces_1.BoundaryPosition.Before) { + const bp = [node, offset]; + if (range_root(range) !== (0, TreeAlgorithm_1.tree_rootNode)(node) || + (0, BoundaryPointAlgorithm_1.boundaryPoint_position)(bp, range._start) === interfaces_1.BoundaryPosition.Before) { range._start = bp; } range._end = bp; } -exports.range_setTheEnd = range_setTheEnd; /** * Selects a node. * @@ -21230,7 +20649,7 @@ function range_select(node, range) { * 1. Let parent be node’s parent. * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. */ - var parent = node._parent; + const parent = node._parent; if (parent === null) throw new DOMException_1.InvalidNodeTypeError(); /** @@ -21238,24 +20657,22 @@ function range_select(node, range) { * 4. Set range’s start to boundary point (parent, index). * 5. Set range’s end to boundary point (parent, index plus 1). */ - var index = TreeAlgorithm_1.tree_index(node); + const index = (0, TreeAlgorithm_1.tree_index)(node); range._start = [parent, index]; range._end = [parent, index + 1]; } -exports.range_select = range_select; /** * EXtracts the contents of range as a document fragment. * * @param range - a range */ function range_extract(range) { - var e_1, _a, e_2, _b, e_3, _c; /** * 1. Let fragment be a new DocumentFragment node whose node document is * range’s start node’s node document. * 2. If range is collapsed, then return fragment. */ - var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); + const fragment = (0, CreateAlgorithm_1.create_documentFragment)(range._startNode._nodeDocument); if (range_collapsed(range)) return fragment; /** @@ -21263,10 +20680,10 @@ function range_extract(range) { * and original end offset be range’s start node, start offset, end node, * and end offset, respectively. */ - var originalStartNode = range._startNode; - var originalStartOffset = range._startOffset; - var originalEndNode = range._endNode; - var originalEndOffset = range._endOffset; + const originalStartNode = range._startNode; + const originalStartOffset = range._startOffset; + const originalEndNode = range._endNode; + const originalEndOffset = range._endOffset; /** * 4. If original start node is original end node, and they are a Text, * ProcessingInstruction, or Comment node: @@ -21282,10 +20699,10 @@ function range_extract(range) { */ if (originalStartNode === originalEndNode && util_1.Guard.isCharacterDataNode(originalStartNode)) { - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); + const clone = (0, NodeAlgorithm_1.node_clone)(originalStartNode); + clone._data = (0, CharacterDataAlgorithm_1.characterData_substringData)(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); + (0, CharacterDataAlgorithm_1.characterData_replaceData)(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); return fragment; } /** @@ -21293,8 +20710,8 @@ function range_extract(range) { * 6. While common ancestor is not an inclusive ancestor of original end * node, set common ancestor to its own parent. */ - var commonAncestor = originalStartNode; - while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { + let commonAncestor = originalStartNode; + while (!(0, TreeAlgorithm_1.tree_isAncestorOf)(originalEndNode, commonAncestor, true)) { if (commonAncestor._parent === null) { throw new Error("Parent node is null."); } @@ -21306,23 +20723,13 @@ function range_extract(range) { * node, set first partially contained child to the first child of common * ancestor that is partially contained in range. */ - var firstPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { - try { - for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { - var node = _e.value; - if (range_isPartiallyContained(node, range)) { - firstPartiallyContainedChild = node; - break; - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + let firstPartiallyContainedChild = null; + if (!(0, TreeAlgorithm_1.tree_isAncestorOf)(originalEndNode, originalStartNode, true)) { + for (const node of commonAncestor._children) { + if (range_isPartiallyContained(node, range)) { + firstPartiallyContainedChild = node; + break; } - finally { if (e_1) throw e_1.error; } } } /** @@ -21331,11 +20738,11 @@ function range_extract(range) { * node, set last partially contained child to the last child of common * ancestor that is partially contained in range. */ - var lastPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { - var children = __spread(commonAncestor._children); - for (var i = children.length - 1; i > 0; i--) { - var node = children[i]; + let lastPartiallyContainedChild = null; + if (!(0, TreeAlgorithm_1.tree_isAncestorOf)(originalStartNode, originalEndNode, true)) { + const children = [...commonAncestor._children]; + for (let i = children.length - 1; i > 0; i--) { + const node = children[i]; if (range_isPartiallyContained(node, range)) { lastPartiallyContainedChild = node; break; @@ -21348,28 +20755,18 @@ function range_extract(range) { * 12. If any member of contained children is a doctype, then throw a * "HierarchyRequestError" DOMException. */ - var containedChildren = []; - try { - for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { - var child = _g.value; - if (range_isContained(child, range)) { - if (util_1.Guard.isDocumentTypeNode(child)) { - throw new DOMException_1.HierarchyRequestError(); - } - containedChildren.push(child); + const containedChildren = []; + for (const child of commonAncestor._children) { + if (range_isContained(child, range)) { + if (util_1.Guard.isDocumentTypeNode(child)) { + throw new DOMException_1.HierarchyRequestError(); } + containedChildren.push(child); } } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_g && !_g.done && (_b = _f.return)) _b.call(_f); - } - finally { if (e_2) throw e_2.error; } - } - var newNode; - var newOffset; - if (TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + let newNode; + let newOffset; + if ((0, TreeAlgorithm_1.tree_isAncestorOf)(originalEndNode, originalStartNode, true)) { /** * 13. If original start node is an inclusive ancestor of original end node, * set new node to original start node and new offset to original start @@ -21387,9 +20784,9 @@ function range_extract(range) { * 14.3. Set new node to the parent of reference node, and new offset to * one plus reference node’s index. */ - var referenceNode = originalStartNode; + let referenceNode = originalStartNode; while (referenceNode._parent !== null && - !TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent)) { + !(0, TreeAlgorithm_1.tree_isAncestorOf)(originalEndNode, referenceNode._parent)) { referenceNode = referenceNode._parent; } /* istanbul ignore next */ @@ -21402,7 +20799,7 @@ function range_extract(range) { throw new Error("Parent node is null."); } newNode = referenceNode._parent; - newOffset = 1 + TreeAlgorithm_1.tree_index(referenceNode); + newOffset = 1 + (0, TreeAlgorithm_1.tree_index)(referenceNode); } if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { /** @@ -21417,10 +20814,10 @@ function range_extract(range) { * start offset, count original start node’s length minus original start * offset, and data the empty string. */ - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - CharacterDataAlgorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); + const clone = (0, NodeAlgorithm_1.node_clone)(originalStartNode); + clone._data = (0, CharacterDataAlgorithm_1.characterData_substringData)(originalStartNode, originalStartOffset, (0, TreeAlgorithm_1.tree_nodeLength)(originalStartNode) - originalStartOffset); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); + (0, CharacterDataAlgorithm_1.characterData_replaceData)(originalStartNode, originalStartOffset, (0, TreeAlgorithm_1.tree_nodeLength)(originalStartNode) - originalStartOffset, ''); } else if (firstPartiallyContainedChild !== null) { /** @@ -21433,28 +20830,18 @@ function range_extract(range) { * 16.4. Let subfragment be the result of extracting subrange. * 16.5. Append subfragment to clone. */ - var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); - MutationAlgorithm_1.mutation_append(clone, fragment); - var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); - var subfragment = range_extract(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); + const clone = (0, NodeAlgorithm_1.node_clone)(firstPartiallyContainedChild); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); + const subrange = (0, CreateAlgorithm_1.create_range)([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, (0, TreeAlgorithm_1.tree_nodeLength)(firstPartiallyContainedChild)]); + const subfragment = range_extract(subrange); + (0, MutationAlgorithm_1.mutation_append)(subfragment, clone); } - try { - /** - * 17. For each contained child in contained children, append contained - * child to fragment. - */ - for (var containedChildren_1 = __values(containedChildren), containedChildren_1_1 = containedChildren_1.next(); !containedChildren_1_1.done; containedChildren_1_1 = containedChildren_1.next()) { - var child = containedChildren_1_1.value; - MutationAlgorithm_1.mutation_append(child, fragment); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (containedChildren_1_1 && !containedChildren_1_1.done && (_c = containedChildren_1.return)) _c.call(containedChildren_1); - } - finally { if (e_3) throw e_3.error; } + /** + * 17. For each contained child in contained children, append contained + * child to fragment. + */ + for (const child of containedChildren) { + (0, MutationAlgorithm_1.mutation_append)(child, fragment); } if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { /** @@ -21467,10 +20854,10 @@ function range_extract(range) { * 18.4. Replace data with node original end node, offset 0, count * original end offset, and data the empty string. */ - var clone = NodeAlgorithm_1.node_clone(originalEndNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); - CharacterDataAlgorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); + const clone = (0, NodeAlgorithm_1.node_clone)(originalEndNode); + clone._data = (0, CharacterDataAlgorithm_1.characterData_substringData)(originalEndNode, 0, originalEndOffset); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); + (0, CharacterDataAlgorithm_1.characterData_replaceData)(originalEndNode, 0, originalEndOffset, ''); } else if (lastPartiallyContainedChild !== null) { /** @@ -21483,11 +20870,11 @@ function range_extract(range) { * 19.4. Let subfragment be the result of extracting subrange. * 19.5. Append subfragment to clone. */ - var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); - MutationAlgorithm_1.mutation_append(clone, fragment); - var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); - var subfragment = range_extract(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); + const clone = (0, NodeAlgorithm_1.node_clone)(lastPartiallyContainedChild); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); + const subrange = (0, CreateAlgorithm_1.create_range)([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); + const subfragment = range_extract(subrange); + (0, MutationAlgorithm_1.mutation_append)(subfragment, clone); } /** * 20. Set range’s start and end to (new node, new offset). @@ -21499,20 +20886,18 @@ function range_extract(range) { */ return fragment; } -exports.range_extract = range_extract; /** * Clones the contents of range as a document fragment. * * @param range - a range */ function range_cloneTheContents(range) { - var e_4, _a, e_5, _b, e_6, _c; /** * 1. Let fragment be a new DocumentFragment node whose node document * is range’s start node’s node document. * 2. If range is collapsed, then return fragment. */ - var fragment = CreateAlgorithm_1.create_documentFragment(range._startNode._nodeDocument); + const fragment = (0, CreateAlgorithm_1.create_documentFragment)(range._startNode._nodeDocument); if (range_collapsed(range)) return fragment; /** @@ -21528,23 +20913,23 @@ function range_cloneTheContents(range) { * 4.3. Append clone to fragment. * 4.5. Return fragment. */ - var originalStartNode = range._startNode; - var originalStartOffset = range._startOffset; - var originalEndNode = range._endNode; - var originalEndOffset = range._endOffset; + const originalStartNode = range._startNode; + const originalStartOffset = range._startOffset; + const originalEndNode = range._endNode; + const originalEndOffset = range._endOffset; if (originalStartNode === originalEndNode && util_1.Guard.isCharacterDataNode(originalStartNode)) { - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); + const clone = (0, NodeAlgorithm_1.node_clone)(originalStartNode); + clone._data = (0, CharacterDataAlgorithm_1.characterData_substringData)(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); } /** * 5. Let common ancestor be original start node. * 6. While common ancestor is not an inclusive ancestor of original end * node, set common ancestor to its own parent. */ - var commonAncestor = originalStartNode; - while (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, commonAncestor, true)) { + let commonAncestor = originalStartNode; + while (!(0, TreeAlgorithm_1.tree_isAncestorOf)(originalEndNode, commonAncestor, true)) { if (commonAncestor._parent === null) { throw new Error("Parent node is null."); } @@ -21556,23 +20941,13 @@ function range_cloneTheContents(range) { * node, set first partially contained child to the first child of common * ancestor that is partially contained in range. */ - var firstPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { - try { - for (var _d = __values(commonAncestor._children), _e = _d.next(); !_e.done; _e = _d.next()) { - var node = _e.value; - if (range_isPartiallyContained(node, range)) { - firstPartiallyContainedChild = node; - break; - } - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + let firstPartiallyContainedChild = null; + if (!(0, TreeAlgorithm_1.tree_isAncestorOf)(originalEndNode, originalStartNode, true)) { + for (const node of commonAncestor._children) { + if (range_isPartiallyContained(node, range)) { + firstPartiallyContainedChild = node; + break; } - finally { if (e_4) throw e_4.error; } } } /** @@ -21581,11 +20956,11 @@ function range_cloneTheContents(range) { * node, set last partially contained child to the last child of common * ancestor that is partially contained in range. */ - var lastPartiallyContainedChild = null; - if (!TreeAlgorithm_1.tree_isAncestorOf(originalStartNode, originalEndNode, true)) { - var children = __spread(commonAncestor._children); - for (var i = children.length - 1; i > 0; i--) { - var node = children[i]; + let lastPartiallyContainedChild = null; + if (!(0, TreeAlgorithm_1.tree_isAncestorOf)(originalStartNode, originalEndNode, true)) { + const children = [...commonAncestor._children]; + for (let i = children.length - 1; i > 0; i--) { + const node = children[i]; if (range_isPartiallyContained(node, range)) { lastPartiallyContainedChild = node; break; @@ -21598,25 +20973,15 @@ function range_cloneTheContents(range) { * 12. If any member of contained children is a doctype, then throw a * "HierarchyRequestError" DOMException. */ - var containedChildren = []; - try { - for (var _f = __values(commonAncestor._children), _g = _f.next(); !_g.done; _g = _f.next()) { - var child = _g.value; - if (range_isContained(child, range)) { - if (util_1.Guard.isDocumentTypeNode(child)) { - throw new DOMException_1.HierarchyRequestError(); - } - containedChildren.push(child); + const containedChildren = []; + for (const child of commonAncestor._children) { + if (range_isContained(child, range)) { + if (util_1.Guard.isDocumentTypeNode(child)) { + throw new DOMException_1.HierarchyRequestError(); } + containedChildren.push(child); } } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_g && !_g.done && (_b = _f.return)) _b.call(_f); - } - finally { if (e_5) throw e_5.error; } - } if (util_1.Guard.isCharacterDataNode(firstPartiallyContainedChild)) { /** * 13. If first partially contained child is a Text, ProcessingInstruction, @@ -21627,9 +20992,9 @@ function range_cloneTheContents(range) { * original start node’s length minus original start offset. * 13.3. Append clone to fragment. */ - var clone = NodeAlgorithm_1.node_clone(originalStartNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalStartNode, originalStartOffset, TreeAlgorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); + const clone = (0, NodeAlgorithm_1.node_clone)(originalStartNode); + clone._data = (0, CharacterDataAlgorithm_1.characterData_substringData)(originalStartNode, originalStartOffset, (0, TreeAlgorithm_1.tree_nodeLength)(originalStartNode) - originalStartOffset); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); } else if (firstPartiallyContainedChild !== null) { /** @@ -21643,32 +21008,22 @@ function range_cloneTheContents(range) { * subrange. * 14.5. Append subfragment to clone. */ - var clone = NodeAlgorithm_1.node_clone(firstPartiallyContainedChild); - MutationAlgorithm_1.mutation_append(clone, fragment); - var subrange = CreateAlgorithm_1.create_range([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, TreeAlgorithm_1.tree_nodeLength(firstPartiallyContainedChild)]); - var subfragment = range_cloneTheContents(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); + const clone = (0, NodeAlgorithm_1.node_clone)(firstPartiallyContainedChild); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); + const subrange = (0, CreateAlgorithm_1.create_range)([originalStartNode, originalStartOffset], [firstPartiallyContainedChild, (0, TreeAlgorithm_1.tree_nodeLength)(firstPartiallyContainedChild)]); + const subfragment = range_cloneTheContents(subrange); + (0, MutationAlgorithm_1.mutation_append)(subfragment, clone); } - try { - /** - * 15. For each contained child in contained children, append contained - * child to fragment. - * 15.1. Let clone be a clone of contained child with the clone children - * flag set. - * 15.2. Append clone to fragment. - */ - for (var containedChildren_2 = __values(containedChildren), containedChildren_2_1 = containedChildren_2.next(); !containedChildren_2_1.done; containedChildren_2_1 = containedChildren_2.next()) { - var child = containedChildren_2_1.value; - var clone = NodeAlgorithm_1.node_clone(child); - MutationAlgorithm_1.mutation_append(clone, fragment); - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (containedChildren_2_1 && !containedChildren_2_1.done && (_c = containedChildren_2.return)) _c.call(containedChildren_2); - } - finally { if (e_6) throw e_6.error; } + /** + * 15. For each contained child in contained children, append contained + * child to fragment. + * 15.1. Let clone be a clone of contained child with the clone children + * flag set. + * 15.2. Append clone to fragment. + */ + for (const child of containedChildren) { + const clone = (0, NodeAlgorithm_1.node_clone)(child); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); } if (util_1.Guard.isCharacterDataNode(lastPartiallyContainedChild)) { /** @@ -21679,9 +21034,9 @@ function range_cloneTheContents(range) { * node original end node, offset 0, and count original end offset. * 16.3. Append clone to fragment. */ - var clone = NodeAlgorithm_1.node_clone(originalEndNode); - clone._data = CharacterDataAlgorithm_1.characterData_substringData(originalEndNode, 0, originalEndOffset); - MutationAlgorithm_1.mutation_append(clone, fragment); + const clone = (0, NodeAlgorithm_1.node_clone)(originalEndNode); + clone._data = (0, CharacterDataAlgorithm_1.characterData_substringData)(originalEndNode, 0, originalEndOffset); + (0, MutationAlgorithm_1.mutation_append)(clone, fragment); } else if (lastPartiallyContainedChild !== null) { /** @@ -21694,18 +21049,17 @@ function range_cloneTheContents(range) { * 17.4. Let subfragment be the result of cloning the contents of subrange. * 17.5. Append subfragment to clone. */ - var clone = NodeAlgorithm_1.node_clone(lastPartiallyContainedChild); + const clone = (0, NodeAlgorithm_1.node_clone)(lastPartiallyContainedChild); fragment.append(clone); - var subrange = CreateAlgorithm_1.create_range([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); - var subfragment = range_extract(subrange); - MutationAlgorithm_1.mutation_append(subfragment, clone); + const subrange = (0, CreateAlgorithm_1.create_range)([lastPartiallyContainedChild, 0], [originalEndNode, originalEndOffset]); + const subfragment = range_extract(subrange); + (0, MutationAlgorithm_1.mutation_append)(subfragment, clone); } /** * 18. Return fragment. */ return fragment; } -exports.range_cloneTheContents = range_cloneTheContents; /** * Inserts a node into a range at the start boundary point. * @@ -21713,7 +21067,6 @@ exports.range_cloneTheContents = range_cloneTheContents; * @param range - a range */ function range_insert(node, range) { - var e_7, _a; /** * 1. If range’s start node is a ProcessingInstruction or Comment node, is a * Text node whose parent is null, or is node, then throw a @@ -21732,35 +21085,25 @@ function range_insert(node, range) { * 4. Otherwise, set referenceNode to the child of start node whose index is * start offset, and null if there is no such child. */ - var referenceNode = null; + let referenceNode = null; if (util_1.Guard.isTextNode(range._startNode)) { referenceNode = range._startNode; } else { - var index = 0; - try { - for (var _b = __values(range._startNode._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var child = _c.value; - if (index === range._startOffset) { - referenceNode = child; - break; - } - index++; - } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + let index = 0; + for (const child of range._startNode._children) { + if (index === range._startOffset) { + referenceNode = child; + break; } - finally { if (e_7) throw e_7.error; } + index++; } } /** * 5. Let parent be range’s start node if referenceNode is null, and * referenceNode’s parent otherwise. */ - var parent; + let parent; if (referenceNode === null) { parent = range._startNode; } @@ -21773,13 +21116,13 @@ function range_insert(node, range) { /** * 6. Ensure pre-insertion validity of node into parent before referenceNode. */ - MutationAlgorithm_1.mutation_ensurePreInsertionValidity(node, parent, referenceNode); + (0, MutationAlgorithm_1.mutation_ensurePreInsertionValidity)(node, parent, referenceNode); /** * 7. If range’s start node is a Text node, set referenceNode to the result * of splitting it with offset range’s start offset. */ if (util_1.Guard.isTextNode(range._startNode)) { - referenceNode = TextAlgorithm_1.text_split(range._startNode, range._startOffset); + referenceNode = (0, TextAlgorithm_1.text_split)(range._startNode, range._startOffset); } /** * 8. If node is referenceNode, set referenceNode to its next sibling. @@ -21791,20 +21134,20 @@ function range_insert(node, range) { * 9. If node’s parent is not null, remove node from its parent. */ if (node._parent !== null) { - MutationAlgorithm_1.mutation_remove(node, node._parent); + (0, MutationAlgorithm_1.mutation_remove)(node, node._parent); } /** * 10. Let newOffset be parent’s length if referenceNode is null, and * referenceNode’s index otherwise. */ - var newOffset = (referenceNode === null ? - TreeAlgorithm_1.tree_nodeLength(parent) : TreeAlgorithm_1.tree_index(referenceNode)); + let newOffset = (referenceNode === null ? + (0, TreeAlgorithm_1.tree_nodeLength)(parent) : (0, TreeAlgorithm_1.tree_index)(referenceNode)); /** * 11. Increase newOffset by node’s length if node is a DocumentFragment * node, and one otherwise. */ if (util_1.Guard.isDocumentFragmentNode(node)) { - newOffset += TreeAlgorithm_1.tree_nodeLength(node); + newOffset += (0, TreeAlgorithm_1.tree_nodeLength)(node); } else { newOffset++; @@ -21812,7 +21155,7 @@ function range_insert(node, range) { /** * 12. Pre-insert node into parent before referenceNode. */ - MutationAlgorithm_1.mutation_preInsert(node, parent, referenceNode); + (0, MutationAlgorithm_1.mutation_preInsert)(node, parent, referenceNode); /** * 13. If range is collapsed, then set range’s end to (parent, newOffset). */ @@ -21820,67 +21163,62 @@ function range_insert(node, range) { range._end = [parent, newOffset]; } } -exports.range_insert = range_insert; /** * Traverses through all contained nodes of a range. * * @param range - a range */ function range_getContainedNodes(range) { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var container = range.commonAncestorContainer; - var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); + return { + [Symbol.iterator]: () => { + const container = range.commonAncestorContainer; + let currentNode = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(container); return { - next: function () { + next: () => { while (currentNode && !range_isContained(currentNode, range)) { - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + currentNode = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(container, currentNode); } if (currentNode === null) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + const result = { done: false, value: currentNode }; + currentNode = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(container, currentNode); return result; } } }; - }, - _a; + } + }; } -exports.range_getContainedNodes = range_getContainedNodes; /** * Traverses through all partially contained nodes of a range. * * @param range - a range */ function range_getPartiallyContainedNodes(range) { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var container = range.commonAncestorContainer; - var currentNode = TreeAlgorithm_1.tree_getFirstDescendantNode(container); + return { + [Symbol.iterator]: () => { + const container = range.commonAncestorContainer; + let currentNode = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(container); return { - next: function () { + next: () => { while (currentNode && !range_isPartiallyContained(currentNode, range)) { - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + currentNode = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(container, currentNode); } if (currentNode === null) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; - currentNode = TreeAlgorithm_1.tree_getNextDescendantNode(container, currentNode); + const result = { done: false, value: currentNode }; + currentNode = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(container, currentNode); return result; } } }; - }, - _a; + } + }; } -exports.range_getPartiallyContainedNodes = range_getPartiallyContainedNodes; //# sourceMappingURL=RangeAlgorithm.js.map /***/ }), @@ -21891,7 +21229,8 @@ exports.range_getPartiallyContainedNodes = range_getPartiallyContainedNodes; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(13166); +exports.selectors_scopeMatchASelectorsString = selectors_scopeMatchASelectorsString; +const DOMException_1 = __nccwpck_require__(13166); /** * Matches elements with the given selectors. * @@ -21908,53 +21247,30 @@ function selectors_scopeMatchASelectorsString(selectors, node) { */ throw new DOMException_1.NotSupportedError(); } -exports.selectors_scopeMatchASelectorsString = selectors_scopeMatchASelectorsString; //# sourceMappingURL=SelectorsAlgorithm.js.map /***/ }), /***/ 68733: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(65282); -var util_2 = __nccwpck_require__(76195); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var MutationObserverAlgorithm_1 = __nccwpck_require__(78157); +exports.shadowTree_signalASlotChange = shadowTree_signalASlotChange; +exports.shadowTree_isConnected = shadowTree_isConnected; +exports.shadowTree_isAssigned = shadowTree_isAssigned; +exports.shadowTree_findASlot = shadowTree_findASlot; +exports.shadowTree_findSlotables = shadowTree_findSlotables; +exports.shadowTree_findFlattenedSlotables = shadowTree_findFlattenedSlotables; +exports.shadowTree_assignSlotables = shadowTree_assignSlotables; +exports.shadowTree_assignSlotablesForATree = shadowTree_assignSlotablesForATree; +exports.shadowTree_assignASlot = shadowTree_assignASlot; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(65282); +const util_2 = __nccwpck_require__(76195); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const MutationObserverAlgorithm_1 = __nccwpck_require__(78157); /** * Signals a slot change to the given slot. * @@ -21965,11 +21281,10 @@ function shadowTree_signalASlotChange(slot) { * 1. Append slot to slot’s relevant agent’s signal slots. * 2. Queue a mutation observer microtask. */ - var window = DOMImpl_1.dom.window; + const window = DOMImpl_1.dom.window; window._signalSlots.add(slot); - MutationObserverAlgorithm_1.observer_queueAMutationObserverMicrotask(); + (0, MutationObserverAlgorithm_1.observer_queueAMutationObserverMicrotask)(); } -exports.shadowTree_signalASlotChange = shadowTree_signalASlotChange; /** * Determines whether a the shadow tree of the given element node is * connected to a document node. @@ -21980,9 +21295,8 @@ function shadowTree_isConnected(element) { /** * An element is connected if its shadow-including root is a document. */ - return util_1.Guard.isDocumentNode(TreeAlgorithm_1.tree_rootNode(element, true)); + return util_1.Guard.isDocumentNode((0, TreeAlgorithm_1.tree_rootNode)(element, true)); } -exports.shadowTree_isConnected = shadowTree_isConnected; /** * Determines whether a slotable is assigned. * @@ -21994,15 +21308,13 @@ function shadowTree_isAssigned(slotable) { */ return (slotable._assignedSlot !== null); } -exports.shadowTree_isAssigned = shadowTree_isAssigned; /** * Finds a slot for the given slotable. * * @param slotable - a slotable * @param openFlag - `true` to search open shadow tree's only */ -function shadowTree_findASlot(slotable, openFlag) { - if (openFlag === void 0) { openFlag = false; } +function shadowTree_findASlot(slotable, openFlag = false) { /** * 1. If slotable’s parent is null, then return null. * 2. Let shadow be slotable’s parent’s shadow root. @@ -22012,85 +21324,71 @@ function shadowTree_findASlot(slotable, openFlag) { * 5. Return the first slot in tree order in shadow’s descendants whose name * is slotable’s name, if any, and null otherwise. */ - var node = util_1.Cast.asNode(slotable); - var parent = node._parent; + const node = util_1.Cast.asNode(slotable); + const parent = node._parent; if (parent === null) return null; - var shadow = parent._shadowRoot || null; + const shadow = parent._shadowRoot || null; if (shadow === null) return null; if (openFlag && shadow._mode !== "open") return null; - var child = TreeAlgorithm_1.tree_getFirstDescendantNode(shadow, false, true, function (e) { return util_1.Guard.isSlot(e); }); + let child = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(shadow, false, true, (e) => util_1.Guard.isSlot(e)); while (child !== null) { if (child._name === slotable._name) return child; - child = TreeAlgorithm_1.tree_getNextDescendantNode(shadow, child, false, true, function (e) { return util_1.Guard.isSlot(e); }); + child = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(shadow, child, false, true, (e) => util_1.Guard.isSlot(e)); } return null; } -exports.shadowTree_findASlot = shadowTree_findASlot; /** * Finds slotables for the given slot. * * @param slot - a slot */ function shadowTree_findSlotables(slot) { - var e_1, _a; /** * 1. Let result be an empty list. * 2. If slot’s root is not a shadow root, then return result. */ - var result = []; - var root = TreeAlgorithm_1.tree_rootNode(slot); + const result = []; + const root = (0, TreeAlgorithm_1.tree_rootNode)(slot); if (!util_1.Guard.isShadowRoot(root)) return result; /** * 3. Let host be slot’s root’s host. * 4. For each slotable child of host, slotable, in tree order: */ - var host = root._host; - try { - for (var _b = __values(host._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var slotable = _c.value; - if (util_1.Guard.isSlotable(slotable)) { - /** - * 4.1. Let foundSlot be the result of finding a slot given slotable. - * 4.2. If foundSlot is slot, then append slotable to result. - */ - var foundSlot = shadowTree_findASlot(slotable); - if (foundSlot === slot) { - result.push(slotable); - } + const host = root._host; + for (const slotable of host._children) { + if (util_1.Guard.isSlotable(slotable)) { + /** + * 4.1. Let foundSlot be the result of finding a slot given slotable. + * 4.2. If foundSlot is slot, then append slotable to result. + */ + const foundSlot = shadowTree_findASlot(slotable); + if (foundSlot === slot) { + result.push(slotable); } } } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } /** * 5. Return result. */ return result; } -exports.shadowTree_findSlotables = shadowTree_findSlotables; /** * Finds slotables for the given slot. * * @param slot - a slot */ function shadowTree_findFlattenedSlotables(slot) { - var e_2, _a, e_3, _b; /** * 1. Let result be an empty list. * 2. If slot’s root is not a shadow root, then return result. */ - var result = []; - var root = TreeAlgorithm_1.tree_rootNode(slot); + const result = []; + const root = (0, TreeAlgorithm_1.tree_rootNode)(slot); if (!util_1.Guard.isShadowRoot(root)) return result; /** @@ -22098,78 +21396,56 @@ function shadowTree_findFlattenedSlotables(slot) { * 4. If slotables is the empty list, then append each slotable child of * slot, in tree order, to slotables. */ - var slotables = shadowTree_findSlotables(slot); - if (util_2.isEmpty(slotables)) { - try { - for (var _c = __values(slot._children), _d = _c.next(); !_d.done; _d = _c.next()) { - var slotable = _d.value; - if (util_1.Guard.isSlotable(slotable)) { - slotables.push(slotable); - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + const slotables = shadowTree_findSlotables(slot); + if ((0, util_2.isEmpty)(slotables)) { + for (const slotable of slot._children) { + if (util_1.Guard.isSlotable(slotable)) { + slotables.push(slotable); } - finally { if (e_2) throw e_2.error; } } } - try { + /** + * 5. For each node in slotables: + */ + for (const node of slotables) { /** - * 5. For each node in slotables: + * 5.1. If node is a slot whose root is a shadow root, then: */ - for (var slotables_1 = __values(slotables), slotables_1_1 = slotables_1.next(); !slotables_1_1.done; slotables_1_1 = slotables_1.next()) { - var node = slotables_1_1.value; + if (util_1.Guard.isSlot(node) && util_1.Guard.isShadowRoot((0, TreeAlgorithm_1.tree_rootNode)(node))) { /** - * 5.1. If node is a slot whose root is a shadow root, then: + * 5.1.1. Let temporaryResult be the result of finding flattened slotables given node. + * 5.1.2. Append each slotable in temporaryResult, in order, to result. */ - if (util_1.Guard.isSlot(node) && util_1.Guard.isShadowRoot(TreeAlgorithm_1.tree_rootNode(node))) { - /** - * 5.1.1. Let temporaryResult be the result of finding flattened slotables given node. - * 5.1.2. Append each slotable in temporaryResult, in order, to result. - */ - var temporaryResult = shadowTree_findFlattenedSlotables(node); - result.push.apply(result, __spread(temporaryResult)); - } - else { - /** - * 5.2. Otherwise, append node to result. - */ - result.push(node); - } + const temporaryResult = shadowTree_findFlattenedSlotables(node); + result.push(...temporaryResult); } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (slotables_1_1 && !slotables_1_1.done && (_b = slotables_1.return)) _b.call(slotables_1); + else { + /** + * 5.2. Otherwise, append node to result. + */ + result.push(node); } - finally { if (e_3) throw e_3.error; } } /** * 6. Return result. */ return result; } -exports.shadowTree_findFlattenedSlotables = shadowTree_findFlattenedSlotables; /** * Assigns slotables to the given slot. * * @param slot - a slot */ function shadowTree_assignSlotables(slot) { - var e_4, _a; /** * 1. Let slotables be the result of finding slotables for slot. * 2. If slotables and slot’s assigned nodes are not identical, then run * signal a slot change for slot. */ - var slotables = shadowTree_findSlotables(slot); + const slotables = shadowTree_findSlotables(slot); if (slotables.length === slot._assignedNodes.length) { - var nodesIdentical = true; - for (var i = 0; i < slotables.length; i++) { + let nodesIdentical = true; + for (let i = 0; i < slotables.length; i++) { if (slotables[i] !== slot._assignedNodes[i]) { nodesIdentical = false; break; @@ -22184,21 +21460,10 @@ function shadowTree_assignSlotables(slot) { * 4. For each slotable in slotables, set slotable’s assigned slot to slot. */ slot._assignedNodes = slotables; - try { - for (var slotables_2 = __values(slotables), slotables_2_1 = slotables_2.next(); !slotables_2_1.done; slotables_2_1 = slotables_2.next()) { - var slotable = slotables_2_1.value; - slotable._assignedSlot = slot; - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (slotables_2_1 && !slotables_2_1.done && (_a = slotables_2.return)) _a.call(slotables_2); - } - finally { if (e_4) throw e_4.error; } + for (const slotable of slotables) { + slotable._assignedSlot = slot; } } -exports.shadowTree_assignSlotables = shadowTree_assignSlotables; /** * Assigns slotables to all nodes of a tree. * @@ -22209,13 +21474,12 @@ function shadowTree_assignSlotablesForATree(root) { * To assign slotables for a tree, given a node root, run assign slotables * for each slot slot in root’s inclusive descendants, in tree order. */ - var descendant = TreeAlgorithm_1.tree_getFirstDescendantNode(root, true, false, function (e) { return util_1.Guard.isSlot(e); }); + let descendant = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(root, true, false, (e) => util_1.Guard.isSlot(e)); while (descendant !== null) { shadowTree_assignSlotables(descendant); - descendant = TreeAlgorithm_1.tree_getNextDescendantNode(root, descendant, true, false, function (e) { return util_1.Guard.isSlot(e); }); + descendant = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(root, descendant, true, false, (e) => util_1.Guard.isSlot(e)); } } -exports.shadowTree_assignSlotablesForATree = shadowTree_assignSlotablesForATree; /** * Assigns a slot to a slotables. * @@ -22226,63 +21490,53 @@ function shadowTree_assignASlot(slotable) { * 1. Let slot be the result of finding a slot with slotable. * 2. If slot is non-null, then run assign slotables for slot. */ - var slot = shadowTree_findASlot(slotable); + const slot = shadowTree_findASlot(slotable); if (slot !== null) { shadowTree_assignSlotables(slot); } } -exports.shadowTree_assignASlot = shadowTree_assignASlot; //# sourceMappingURL=ShadowTreeAlgorithm.js.map /***/ }), /***/ 13512: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(65282); -var DOMException_1 = __nccwpck_require__(13166); -var CreateAlgorithm_1 = __nccwpck_require__(57339); -var TreeAlgorithm_1 = __nccwpck_require__(16620); -var CharacterDataAlgorithm_1 = __nccwpck_require__(19461); -var MutationAlgorithm_1 = __nccwpck_require__(45463); +exports.text_contiguousTextNodes = text_contiguousTextNodes; +exports.text_contiguousExclusiveTextNodes = text_contiguousExclusiveTextNodes; +exports.text_descendantTextContent = text_descendantTextContent; +exports.text_split = text_split; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(65282); +const DOMException_1 = __nccwpck_require__(13166); +const CreateAlgorithm_1 = __nccwpck_require__(57339); +const TreeAlgorithm_1 = __nccwpck_require__(16620); +const CharacterDataAlgorithm_1 = __nccwpck_require__(19461); +const MutationAlgorithm_1 = __nccwpck_require__(45463); /** * Returns node with its adjacent text and cdata node siblings. * * @param node - a node * @param self - whether to include node itself */ -function text_contiguousTextNodes(node, self) { - var _a; - if (self === void 0) { self = false; } +function text_contiguousTextNodes(node, self = false) { /** * The contiguous Text nodes of a node node are node, node’s previous * sibling Text node, if any, and its contiguous Text nodes, and node’s next * sibling Text node, if any, and its contiguous Text nodes, avoiding any * duplicates. */ - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = node; + return { + [Symbol.iterator]() { + let currentNode = node; while (currentNode && util_1.Guard.isTextNode(currentNode._previousSibling)) { currentNode = currentNode._previousSibling; } return { - next: function () { + next() { if (currentNode && (!self && currentNode === node)) { if (util_1.Guard.isTextNode(currentNode._nextSibling)) { currentNode = currentNode._nextSibling; @@ -22295,7 +21549,7 @@ function text_contiguousTextNodes(node, self) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; + const result = { done: false, value: currentNode }; if (util_1.Guard.isTextNode(currentNode._nextSibling)) { currentNode = currentNode._nextSibling; } @@ -22306,33 +21560,30 @@ function text_contiguousTextNodes(node, self) { } } }; - }, - _a; + } + }; } -exports.text_contiguousTextNodes = text_contiguousTextNodes; /** * Returns node with its adjacent text node siblings. * * @param node - a node * @param self - whether to include node itself */ -function text_contiguousExclusiveTextNodes(node, self) { - var _a; - if (self === void 0) { self = false; } +function text_contiguousExclusiveTextNodes(node, self = false) { /** * The contiguous exclusive Text nodes of a node node are node, node’s * previous sibling exclusive Text node, if any, and its contiguous * exclusive Text nodes, and node’s next sibling exclusive Text node, * if any, and its contiguous exclusive Text nodes, avoiding any duplicates. */ - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = node; + return { + [Symbol.iterator]() { + let currentNode = node; while (currentNode && util_1.Guard.isExclusiveTextNode(currentNode._previousSibling)) { currentNode = currentNode._previousSibling; } return { - next: function () { + next() { if (currentNode && (!self && currentNode === node)) { if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { currentNode = currentNode._nextSibling; @@ -22345,7 +21596,7 @@ function text_contiguousExclusiveTextNodes(node, self) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; + const result = { done: false, value: currentNode }; if (util_1.Guard.isExclusiveTextNode(currentNode._nextSibling)) { currentNode = currentNode._nextSibling; } @@ -22356,10 +21607,9 @@ function text_contiguousExclusiveTextNodes(node, self) { } } }; - }, - _a; + } + }; } -exports.text_contiguousExclusiveTextNodes = text_contiguousExclusiveTextNodes; /** * Returns the concatenation of the data of all the Text node descendants of * node, in tree order. @@ -22371,15 +21621,14 @@ function text_descendantTextContent(node) { * The descendant text content of a node node is the concatenation of the * data of all the Text node descendants of node, in tree order. */ - var contents = ''; - var text = TreeAlgorithm_1.tree_getFirstDescendantNode(node, false, false, function (e) { return util_1.Guard.isTextNode(e); }); + let contents = ''; + let text = (0, TreeAlgorithm_1.tree_getFirstDescendantNode)(node, false, false, (e) => util_1.Guard.isTextNode(e)); while (text !== null) { contents += text._data; - text = TreeAlgorithm_1.tree_getNextDescendantNode(node, text, false, false, function (e) { return util_1.Guard.isTextNode(e); }); + text = (0, TreeAlgorithm_1.tree_getNextDescendantNode)(node, text, false, false, (e) => util_1.Guard.isTextNode(e)); } return contents; } -exports.text_descendantTextContent = text_descendantTextContent; /** * Splits data at the given offset and returns the remainder as a text * node. @@ -22388,13 +21637,12 @@ exports.text_descendantTextContent = text_descendantTextContent; * @param offset - the offset at which to split the nodes. */ function text_split(node, offset) { - var e_1, _a; /** * 1. Let length be node’s length. * 2. If offset is greater than length, then throw an "IndexSizeError" * DOMException. */ - var length = node._data.length; + const length = node._data.length; if (offset > length) { throw new DOMException_1.IndexSizeError(); } @@ -22407,53 +21655,43 @@ function text_split(node, offset) { * 6. Let parent be node’s parent. * 7. If parent is not null, then: */ - var count = length - offset; - var newData = CharacterDataAlgorithm_1.characterData_substringData(node, offset, count); - var newNode = CreateAlgorithm_1.create_text(node._nodeDocument, newData); - var parent = node._parent; + const count = length - offset; + const newData = (0, CharacterDataAlgorithm_1.characterData_substringData)(node, offset, count); + const newNode = (0, CreateAlgorithm_1.create_text)(node._nodeDocument, newData); + const parent = node._parent; if (parent !== null) { /** * 7.1. Insert new node into parent before node’s next sibling. */ - MutationAlgorithm_1.mutation_insert(newNode, parent, node._nextSibling); - try { - /** - * 7.2. For each live range whose start node is node and start offset is - * greater than offset, set its start node to new node and decrease its - * start offset by offset. - * 7.3. For each live range whose end node is node and end offset is greater - * than offset, set its end node to new node and decrease its end offset - * by offset. - * 7.4. For each live range whose start node is parent and start offset is - * equal to the index of node plus 1, increase its start offset by 1. - * 7.5. For each live range whose end node is parent and end offset is equal - * to the index of node plus 1, increase its end offset by 1. - */ - for (var _b = __values(DOMImpl_1.dom.rangeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var range = _c.value; - if (range._start[0] === node && range._start[1] > offset) { - range._start[0] = newNode; - range._start[1] -= offset; - } - if (range._end[0] === node && range._end[1] > offset) { - range._end[0] = newNode; - range._end[1] -= offset; - } - var index = TreeAlgorithm_1.tree_index(node); - if (range._start[0] === parent && range._start[1] === index + 1) { - range._start[1]++; - } - if (range._end[0] === parent && range._end[1] === index + 1) { - range._end[1]++; - } + (0, MutationAlgorithm_1.mutation_insert)(newNode, parent, node._nextSibling); + /** + * 7.2. For each live range whose start node is node and start offset is + * greater than offset, set its start node to new node and decrease its + * start offset by offset. + * 7.3. For each live range whose end node is node and end offset is greater + * than offset, set its end node to new node and decrease its end offset + * by offset. + * 7.4. For each live range whose start node is parent and start offset is + * equal to the index of node plus 1, increase its start offset by 1. + * 7.5. For each live range whose end node is parent and end offset is equal + * to the index of node plus 1, increase its end offset by 1. + */ + for (const range of DOMImpl_1.dom.rangeList) { + if (range._start[0] === node && range._start[1] > offset) { + range._start[0] = newNode; + range._start[1] -= offset; } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + if (range._end[0] === node && range._end[1] > offset) { + range._end[0] = newNode; + range._end[1] -= offset; + } + const index = (0, TreeAlgorithm_1.tree_index)(node); + if (range._start[0] === parent && range._start[1] === index + 1) { + range._start[1]++; + } + if (range._end[0] === parent && range._end[1] === index + 1) { + range._end[1]++; } - finally { if (e_1) throw e_1.error; } } } /** @@ -22461,10 +21699,9 @@ function text_split(node, offset) { * the empty string. * 9. Return new node. */ - CharacterDataAlgorithm_1.characterData_replaceData(node, offset, count, ''); + (0, CharacterDataAlgorithm_1.characterData_replaceData)(node, offset, count, ''); return newNode; } -exports.text_split = text_split; //# sourceMappingURL=TextAlgorithm.js.map /***/ }), @@ -22475,8 +21712,9 @@ exports.text_split = text_split; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var DOMException_1 = __nccwpck_require__(13166); +exports.traversal_filter = traversal_filter; +const interfaces_1 = __nccwpck_require__(27305); +const DOMException_1 = __nccwpck_require__(13166); /** * Applies the filter to the given node and returns the result. * @@ -22494,12 +21732,12 @@ function traversal_filter(traverser, node) { /** * 2. Let n be node’s nodeType attribute value − 1. */ - var n = node._nodeType - 1; + const n = node._nodeType - 1; /** * 3. If the nth bit (where 0 is the least significant bit) of traverser’s * whatToShow is not set, then return FILTER_SKIP. */ - var mask = 1 << n; + const mask = 1 << n; if ((traverser.whatToShow & mask) === 0) { return interfaces_1.FilterResult.Skip; } @@ -22518,7 +21756,7 @@ function traversal_filter(traverser, node) { * traverser’s filter, "acceptNode", and « node ». If this throws an * exception, then unset traverser’s active flag and rethrow the exception. */ - var result = interfaces_1.FilterResult.Reject; + let result = interfaces_1.FilterResult.Reject; try { result = traverser.filter.acceptNode(node); } @@ -22533,30 +21771,48 @@ function traversal_filter(traverser, node) { traverser._activeFlag = false; return result; } -exports.traversal_filter = traversal_filter; //# sourceMappingURL=TraversalAlgorithm.js.map /***/ }), /***/ 16620: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(65282); -var interfaces_1 = __nccwpck_require__(27305); +exports.tree_getFirstDescendantNode = tree_getFirstDescendantNode; +exports.tree_getNextDescendantNode = tree_getNextDescendantNode; +exports.tree_getDescendantNodes = tree_getDescendantNodes; +exports.tree_getDescendantElements = tree_getDescendantElements; +exports.tree_getSiblingNodes = tree_getSiblingNodes; +exports.tree_getFirstAncestorNode = tree_getFirstAncestorNode; +exports.tree_getNextAncestorNode = tree_getNextAncestorNode; +exports.tree_getAncestorNodes = tree_getAncestorNodes; +exports.tree_getCommonAncestor = tree_getCommonAncestor; +exports.tree_getFollowingNode = tree_getFollowingNode; +exports.tree_getPrecedingNode = tree_getPrecedingNode; +exports.tree_isConstrained = tree_isConstrained; +exports.tree_nodeLength = tree_nodeLength; +exports.tree_isEmpty = tree_isEmpty; +exports.tree_rootNode = tree_rootNode; +exports.tree_isDescendantOf = tree_isDescendantOf; +exports.tree_isAncestorOf = tree_isAncestorOf; +exports.tree_isHostIncludingAncestorOf = tree_isHostIncludingAncestorOf; +exports.tree_isSiblingOf = tree_isSiblingOf; +exports.tree_isPreceding = tree_isPreceding; +exports.tree_isFollowing = tree_isFollowing; +exports.tree_isParentOf = tree_isParentOf; +exports.tree_isChildOf = tree_isChildOf; +exports.tree_previousSibling = tree_previousSibling; +exports.tree_nextSibling = tree_nextSibling; +exports.tree_firstChild = tree_firstChild; +exports.tree_lastChild = tree_lastChild; +exports.tree_treePosition = tree_treePosition; +exports.tree_index = tree_index; +exports.tree_retarget = tree_retarget; +const util_1 = __nccwpck_require__(65282); +const interfaces_1 = __nccwpck_require__(27305); /** * Gets the next descendant of the given node of the tree rooted at `root` * in depth-first pre-order. @@ -22565,8 +21821,7 @@ var interfaces_1 = __nccwpck_require__(27305); * @param node - a node * @param shadow - whether to visit shadow tree nodes */ -function _getNextDescendantNode(root, node, shadow) { - if (shadow === void 0) { shadow = false; } +function _getNextDescendantNode(root, node, shadow = false) { // traverse shadow tree if (shadow && util_1.Guard.isElementNode(node) && util_1.Guard.isShadowRoot(node.shadowRoot)) { if (node.shadowRoot._firstChild) @@ -22581,7 +21836,7 @@ function _getNextDescendantNode(root, node, shadow) { if (node._nextSibling) return node._nextSibling; // traverse parent's next sibling - var parent = node._parent; + let parent = node._parent; while (parent && parent !== root) { if (parent._nextSibling) return parent._nextSibling; @@ -22590,16 +21845,15 @@ function _getNextDescendantNode(root, node, shadow) { return null; } function _emptyIterator() { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { + return { + [Symbol.iterator]: () => { return { - next: function () { + next: () => { return { done: true, value: null }; } }; - }, - _a; + } + }; } /** * Returns the first descendant node of the tree rooted at `node` in @@ -22610,16 +21864,13 @@ function _emptyIterator() { * @param shadow - whether to visit shadow tree nodes * @param filter - a function to filter nodes */ -function tree_getFirstDescendantNode(node, self, shadow, filter) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - var firstNode = (self ? node : _getNextDescendantNode(node, node, shadow)); +function tree_getFirstDescendantNode(node, self = false, shadow = false, filter) { + let firstNode = (self ? node : _getNextDescendantNode(node, node, shadow)); while (firstNode && filter && !filter(firstNode)) { firstNode = _getNextDescendantNode(node, firstNode, shadow); } return firstNode; } -exports.tree_getFirstDescendantNode = tree_getFirstDescendantNode; /** * Returns the next descendant node of the tree rooted at `node` in * depth-first pre-order. @@ -22630,16 +21881,13 @@ exports.tree_getFirstDescendantNode = tree_getFirstDescendantNode; * @param shadow - whether to visit shadow tree nodes * @param filter - a function to filter nodes */ -function tree_getNextDescendantNode(node, currentNode, self, shadow, filter) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - var nextNode = _getNextDescendantNode(node, currentNode, shadow); +function tree_getNextDescendantNode(node, currentNode, self = false, shadow = false, filter) { + let nextNode = _getNextDescendantNode(node, currentNode, shadow); while (nextNode && filter && !filter(nextNode)) { nextNode = _getNextDescendantNode(node, nextNode, shadow); } return nextNode; } -exports.tree_getNextDescendantNode = tree_getNextDescendantNode; /** * Traverses through all descendant nodes of the tree rooted at * `node` in depth-first pre-order. @@ -22649,18 +21897,15 @@ exports.tree_getNextDescendantNode = tree_getNextDescendantNode; * @param shadow - whether to visit shadow tree nodes * @param filter - a function to filter nodes */ -function tree_getDescendantNodes(node, self, shadow, filter) { - var _a; - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } +function tree_getDescendantNodes(node, self = false, shadow = false, filter) { if (!self && node._children.size === 0) { return _emptyIterator(); } - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = (self ? node : _getNextDescendantNode(node, node, shadow)); + return { + [Symbol.iterator]: () => { + let currentNode = (self ? node : _getNextDescendantNode(node, node, shadow)); return { - next: function () { + next: () => { while (currentNode && filter && !filter(currentNode)) { currentNode = _getNextDescendantNode(node, currentNode, shadow); } @@ -22668,16 +21913,15 @@ function tree_getDescendantNodes(node, self, shadow, filter) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; + const result = { done: false, value: currentNode }; currentNode = _getNextDescendantNode(node, currentNode, shadow); return result; } } }; - }, - _a; + } + }; } -exports.tree_getDescendantNodes = tree_getDescendantNodes; /** * Traverses through all descendant element nodes of the tree rooted at * `node` in depth-first preorder. @@ -22687,19 +21931,16 @@ exports.tree_getDescendantNodes = tree_getDescendantNodes; * @param shadow - whether to visit shadow tree nodes * @param filter - a function to filter nodes */ -function tree_getDescendantElements(node, self, shadow, filter) { - var _a; - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } +function tree_getDescendantElements(node, self = false, shadow = false, filter) { if (!self && node._children.size === 0) { return _emptyIterator(); } - return _a = {}, - _a[Symbol.iterator] = function () { - var it = tree_getDescendantNodes(node, self, shadow, function (e) { return util_1.Guard.isElementNode(e); })[Symbol.iterator](); - var currentNode = it.next().value; + return { + [Symbol.iterator]: () => { + const it = tree_getDescendantNodes(node, self, shadow, (e) => util_1.Guard.isElementNode(e))[Symbol.iterator](); + let currentNode = it.next().value; return { - next: function () { + next() { while (currentNode && filter && !filter(currentNode)) { currentNode = it.next().value; } @@ -22707,16 +21948,15 @@ function tree_getDescendantElements(node, self, shadow, filter) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; + const result = { done: false, value: currentNode }; currentNode = it.next().value; return result; } } }; - }, - _a; + } + }; } -exports.tree_getDescendantElements = tree_getDescendantElements; /** * Traverses through all sibling nodes of `node`. * @@ -22724,17 +21964,15 @@ exports.tree_getDescendantElements = tree_getDescendantElements; * @param self - whether to include `node` in traversal * @param filter - a function to filter nodes */ -function tree_getSiblingNodes(node, self, filter) { - var _a; - if (self === void 0) { self = false; } +function tree_getSiblingNodes(node, self = false, filter) { if (!node._parent || node._parent._children.size === 0) { return _emptyIterator(); } - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = node._parent ? node._parent._firstChild : null; + return { + [Symbol.iterator]() { + let currentNode = node._parent ? node._parent._firstChild : null; return { - next: function () { + next() { while (currentNode && (filter && !filter(currentNode) || (!self && currentNode === node))) { currentNode = currentNode._nextSibling; } @@ -22742,16 +21980,15 @@ function tree_getSiblingNodes(node, self, filter) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; + const result = { done: false, value: currentNode }; currentNode = currentNode._nextSibling; return result; } } }; - }, - _a; + } + }; } -exports.tree_getSiblingNodes = tree_getSiblingNodes; /** * Gets the first ancestor of `node` in reverse tree order. * @@ -22759,15 +21996,13 @@ exports.tree_getSiblingNodes = tree_getSiblingNodes; * @param self - whether to include `node` in traversal * @param filter - a function to filter nodes */ -function tree_getFirstAncestorNode(node, self, filter) { - if (self === void 0) { self = false; } - var firstNode = self ? node : node._parent; +function tree_getFirstAncestorNode(node, self = false, filter) { + let firstNode = self ? node : node._parent; while (firstNode && filter && !filter(firstNode)) { firstNode = firstNode._parent; } return firstNode; } -exports.tree_getFirstAncestorNode = tree_getFirstAncestorNode; /** * Gets the first ancestor of `node` in reverse tree order. * @@ -22775,15 +22010,13 @@ exports.tree_getFirstAncestorNode = tree_getFirstAncestorNode; * @param self - whether to include `node` in traversal * @param filter - a function to filter nodes */ -function tree_getNextAncestorNode(node, currentNode, self, filter) { - if (self === void 0) { self = false; } - var nextNode = currentNode._parent; +function tree_getNextAncestorNode(node, currentNode, self = false, filter) { + let nextNode = currentNode._parent; while (nextNode && filter && !filter(nextNode)) { nextNode = nextNode._parent; } return nextNode; } -exports.tree_getNextAncestorNode = tree_getNextAncestorNode; /** * Traverses through all ancestor nodes `node` in reverse tree order. * @@ -22791,31 +22024,28 @@ exports.tree_getNextAncestorNode = tree_getNextAncestorNode; * @param self - whether to include `node` in traversal * @param filter - a function to filter nodes */ -function tree_getAncestorNodes(node, self, filter) { - var _a; - if (self === void 0) { self = false; } +function tree_getAncestorNodes(node, self = false, filter) { if (!self && !node._parent) { return _emptyIterator(); } - return _a = {}, - _a[Symbol.iterator] = function () { - var currentNode = tree_getFirstAncestorNode(node, self, filter); + return { + [Symbol.iterator]() { + let currentNode = tree_getFirstAncestorNode(node, self, filter); return { - next: function () { + next() { if (currentNode === null) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; + const result = { done: false, value: currentNode }; currentNode = tree_getNextAncestorNode(node, currentNode, self, filter); return result; } } }; - }, - _a; + } + }; } -exports.tree_getAncestorNodes = tree_getAncestorNodes; /** * Returns the common ancestor of the given nodes. * @@ -22827,25 +22057,25 @@ function tree_getCommonAncestor(nodeA, nodeB) { return nodeA._parent; } // lists of parent nodes - var parentsA = []; - var parentsB = []; - var pA = tree_getFirstAncestorNode(nodeA, true); + const parentsA = []; + const parentsB = []; + let pA = tree_getFirstAncestorNode(nodeA, true); while (pA !== null) { parentsA.push(pA); pA = tree_getNextAncestorNode(nodeA, pA, true); } - var pB = tree_getFirstAncestorNode(nodeB, true); + let pB = tree_getFirstAncestorNode(nodeB, true); while (pB !== null) { parentsB.push(pB); pB = tree_getNextAncestorNode(nodeB, pB, true); } // walk through parents backwards until they differ - var pos1 = parentsA.length; - var pos2 = parentsB.length; - var parent = null; - for (var i = Math.min(pos1, pos2); i > 0; i--) { - var parent1 = parentsA[--pos1]; - var parent2 = parentsB[--pos2]; + let pos1 = parentsA.length; + let pos2 = parentsB.length; + let parent = null; + for (let i = Math.min(pos1, pos2); i > 0; i--) { + const parent1 = parentsA[--pos1]; + const parent2 = parentsB[--pos2]; if (parent1 !== parent2) { break; } @@ -22853,7 +22083,6 @@ function tree_getCommonAncestor(nodeA, nodeB) { } return parent; } -exports.tree_getCommonAncestor = tree_getCommonAncestor; /** * Returns the node following `node` in depth-first preorder. * @@ -22869,7 +22098,7 @@ function tree_getFollowingNode(root, node) { } else { while (true) { - var parent = node._parent; + const parent = node._parent; if (parent === null || parent === root) { return null; } @@ -22882,7 +22111,6 @@ function tree_getFollowingNode(root, node) { } } } -exports.tree_getFollowingNode = tree_getFollowingNode; /** * Returns the node preceding `node` in depth-first preorder. * @@ -22906,7 +22134,6 @@ function tree_getPrecedingNode(root, node) { return node._parent; } } -exports.tree_getPrecedingNode = tree_getPrecedingNode; /** * Determines if the node tree is constrained. A node tree is * constrained as follows, expressed as a relationship between the @@ -22929,64 +22156,43 @@ exports.tree_getPrecedingNode = tree_getPrecedingNode; * @param node - the root of the tree */ function tree_isConstrained(node) { - var e_1, _a, e_2, _b, e_3, _c; switch (node._nodeType) { case interfaces_1.NodeType.Document: - var hasDocType = false; - var hasElement = false; - try { - for (var _d = __values(node._children), _e = _d.next(); !_e.done; _e = _d.next()) { - var childNode = _e.value; - switch (childNode._nodeType) { - case interfaces_1.NodeType.ProcessingInstruction: - case interfaces_1.NodeType.Comment: - break; - case interfaces_1.NodeType.DocumentType: - if (hasDocType || hasElement) - return false; - hasDocType = true; - break; - case interfaces_1.NodeType.Element: - if (hasElement) - return false; - hasElement = true; - break; - default: + let hasDocType = false; + let hasElement = false; + for (const childNode of node._children) { + switch (childNode._nodeType) { + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.Comment: + break; + case interfaces_1.NodeType.DocumentType: + if (hasDocType || hasElement) return false; - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); + hasDocType = true; + break; + case interfaces_1.NodeType.Element: + if (hasElement) + return false; + hasElement = true; + break; + default: + return false; } - finally { if (e_1) throw e_1.error; } } break; case interfaces_1.NodeType.DocumentFragment: case interfaces_1.NodeType.Element: - try { - for (var _f = __values(node._children), _g = _f.next(); !_g.done; _g = _f.next()) { - var childNode = _g.value; - switch (childNode._nodeType) { - case interfaces_1.NodeType.Element: - case interfaces_1.NodeType.Text: - case interfaces_1.NodeType.ProcessingInstruction: - case interfaces_1.NodeType.CData: - case interfaces_1.NodeType.Comment: - break; - default: - return false; - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_g && !_g.done && (_b = _f.return)) _b.call(_f); + for (const childNode of node._children) { + switch (childNode._nodeType) { + case interfaces_1.NodeType.Element: + case interfaces_1.NodeType.Text: + case interfaces_1.NodeType.ProcessingInstruction: + case interfaces_1.NodeType.CData: + case interfaces_1.NodeType.Comment: + break; + default: + return false; } - finally { if (e_2) throw e_2.error; } } break; case interfaces_1.NodeType.DocumentType: @@ -22996,24 +22202,13 @@ function tree_isConstrained(node) { case interfaces_1.NodeType.Comment: return (!node.hasChildNodes()); } - try { - for (var _h = __values(node._children), _j = _h.next(); !_j.done; _j = _h.next()) { - var childNode = _j.value; - // recursively check child nodes - if (!tree_isConstrained(childNode)) - return false; - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_j && !_j.done && (_c = _h.return)) _c.call(_h); - } - finally { if (e_3) throw e_3.error; } + for (const childNode of node._children) { + // recursively check child nodes + if (!tree_isConstrained(childNode)) + return false; } return true; } -exports.tree_isConstrained = tree_isConstrained; /** * Returns the length of a node. * @@ -23041,7 +22236,6 @@ function tree_nodeLength(node) { return node._children.size; } } -exports.tree_nodeLength = tree_nodeLength; /** * Determines if a node is empty. * @@ -23053,7 +22247,6 @@ function tree_isEmpty(node) { */ return (tree_nodeLength(node) === 0); } -exports.tree_isEmpty = tree_isEmpty; /** * Returns the root node of a tree. The root of an object is itself, * if its parent is `null`, or else it is the root of its parent. @@ -23064,15 +22257,14 @@ exports.tree_isEmpty = tree_isEmpty; * @param shadow - `true` to return shadow-including root, otherwise * `false` */ -function tree_rootNode(node, shadow) { - if (shadow === void 0) { shadow = false; } +function tree_rootNode(node, shadow = false) { /** * The root of an object is itself, if its parent is null, or else it is the * root of its parent. The root of a tree is any object participating in * that tree whose parent is null. */ if (shadow) { - var root = tree_rootNode(node, false); + const root = tree_rootNode(node, false); if (util_1.Guard.isShadowRoot(root)) return tree_rootNode(root._host, true); else @@ -23085,7 +22277,6 @@ function tree_rootNode(node, shadow) { return tree_rootNode(node._parent); } } -exports.tree_rootNode = tree_rootNode; /** * Determines whether `other` is a descendant of `node`. An object * A is called a descendant of an object B, if either A is a child @@ -23097,16 +22288,14 @@ exports.tree_rootNode = tree_rootNode; * @param shadow - if `true`, traversal includes the * node's and its descendant's shadow trees as well. */ -function tree_isDescendantOf(node, other, self, shadow) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } +function tree_isDescendantOf(node, other, self = false, shadow = false) { /** * An object A is called a descendant of an object B, if either A is a * child of B or A is a child of an object C that is a descendant of B. * * An inclusive descendant is an object or one of its descendants. */ - var child = tree_getFirstDescendantNode(node, self, shadow); + let child = tree_getFirstDescendantNode(node, self, shadow); while (child !== null) { if (child === other) { return true; @@ -23115,7 +22304,6 @@ function tree_isDescendantOf(node, other, self, shadow) { } return false; } -exports.tree_isDescendantOf = tree_isDescendantOf; /** * Determines whether `other` is an ancestor of `node`. An object A * is called an ancestor of an object B if and only if B is a @@ -23127,10 +22315,8 @@ exports.tree_isDescendantOf = tree_isDescendantOf; * @param shadow - if `true`, traversal includes the * node's and its descendant's shadow trees as well. */ -function tree_isAncestorOf(node, other, self, shadow) { - if (self === void 0) { self = false; } - if (shadow === void 0) { shadow = false; } - var ancestor = self ? node : shadow && util_1.Guard.isShadowRoot(node) ? +function tree_isAncestorOf(node, other, self = false, shadow = false) { + let ancestor = self ? node : shadow && util_1.Guard.isShadowRoot(node) ? node._host : node._parent; while (ancestor !== null) { if (ancestor === other) @@ -23140,7 +22326,6 @@ function tree_isAncestorOf(node, other, self, shadow) { } return false; } -exports.tree_isAncestorOf = tree_isAncestorOf; /** * Determines whether `other` is a host-including ancestor of `node`. An * object A is a host-including inclusive ancestor of an object B, if either @@ -23151,17 +22336,15 @@ exports.tree_isAncestorOf = tree_isAncestorOf; * @param other - the node to check * @param self - if `true`, traversal includes `node` itself */ -function tree_isHostIncludingAncestorOf(node, other, self) { - if (self === void 0) { self = false; } +function tree_isHostIncludingAncestorOf(node, other, self = false) { if (tree_isAncestorOf(node, other, self)) return true; - var root = tree_rootNode(node); + const root = tree_rootNode(node); if (util_1.Guard.isDocumentFragmentNode(root) && root._host !== null && tree_isHostIncludingAncestorOf(root._host, other, self)) return true; return false; } -exports.tree_isHostIncludingAncestorOf = tree_isHostIncludingAncestorOf; /** * Determines whether `other` is a sibling of `node`. An object A is * called a sibling of an object B, if and only if B and A share @@ -23171,8 +22354,7 @@ exports.tree_isHostIncludingAncestorOf = tree_isHostIncludingAncestorOf; * @param other - the node to check * @param self - if `true`, traversal includes `node` itself */ -function tree_isSiblingOf(node, other, self) { - if (self === void 0) { self = false; } +function tree_isSiblingOf(node, other, self = false) { /** * An object A is called a sibling of an object B, if and only if B and A * share the same non-null parent. @@ -23188,7 +22370,6 @@ function tree_isSiblingOf(node, other, self) { } return false; } -exports.tree_isSiblingOf = tree_isSiblingOf; /** * Determines whether `other` is preceding `node`. An object A is * preceding an object B if A and B are in the same tree and A comes @@ -23202,8 +22383,8 @@ function tree_isPreceding(node, other) { * An object A is preceding an object B if A and B are in the same tree and * A comes before B in tree order. */ - var nodePos = tree_treePosition(node); - var otherPos = tree_treePosition(other); + const nodePos = tree_treePosition(node); + const otherPos = tree_treePosition(other); if (nodePos === -1 || otherPos === -1) return false; else if (tree_rootNode(node) !== tree_rootNode(other)) @@ -23211,7 +22392,6 @@ function tree_isPreceding(node, other) { else return otherPos < nodePos; } -exports.tree_isPreceding = tree_isPreceding; /** * Determines whether `other` is following `node`. An object A is * following an object B if A and B are in the same tree and A comes @@ -23225,8 +22405,8 @@ function tree_isFollowing(node, other) { * An object A is following an object B if A and B are in the same tree and * A comes after B in tree order. */ - var nodePos = tree_treePosition(node); - var otherPos = tree_treePosition(other); + const nodePos = tree_treePosition(node); + const otherPos = tree_treePosition(other); if (nodePos === -1 || otherPos === -1) return false; else if (tree_rootNode(node) !== tree_rootNode(other)) @@ -23234,7 +22414,6 @@ function tree_isFollowing(node, other) { else return otherPos > nodePos; } -exports.tree_isFollowing = tree_isFollowing; /** * Determines whether `other` is the parent node of `node`. * @@ -23249,7 +22428,6 @@ function tree_isParentOf(node, other) { */ return (node._parent === other); } -exports.tree_isParentOf = tree_isParentOf; /** * Determines whether `other` is a child node of `node`. * @@ -23264,7 +22442,6 @@ function tree_isChildOf(node, other) { */ return (other._parent === node); } -exports.tree_isChildOf = tree_isChildOf; /** * Returns the previous sibling node of `node` or null if it has no * preceding sibling. @@ -23278,7 +22455,6 @@ function tree_previousSibling(node) { */ return node._previousSibling; } -exports.tree_previousSibling = tree_previousSibling; /** * Returns the next sibling node of `node` or null if it has no * following sibling. @@ -23292,7 +22468,6 @@ function tree_nextSibling(node) { */ return node._nextSibling; } -exports.tree_nextSibling = tree_nextSibling; /** * Returns the first child node of `node` or null if it has no * children. @@ -23306,7 +22481,6 @@ function tree_firstChild(node) { */ return node._firstChild; } -exports.tree_firstChild = tree_firstChild; /** * Returns the last child node of `node` or null if it has no * children. @@ -23320,7 +22494,6 @@ function tree_lastChild(node) { */ return node._lastChild; } -exports.tree_lastChild = tree_lastChild; /** * Returns the zero-based index of `node` when counted preorder in * the tree rooted at `root`. Returns `-1` if `node` is not in @@ -23329,9 +22502,9 @@ exports.tree_lastChild = tree_lastChild; * @param node - the node to get the index of */ function tree_treePosition(node) { - var root = tree_rootNode(node); - var pos = 0; - var childNode = tree_getFirstDescendantNode(root); + const root = tree_rootNode(node); + let pos = 0; + let childNode = tree_getFirstDescendantNode(root); while (childNode !== null) { pos++; if (childNode === node) @@ -23340,7 +22513,6 @@ function tree_treePosition(node) { } return -1; } -exports.tree_treePosition = tree_treePosition; /** * Determines the index of `node`. The index of an object is its number of * preceding siblings, or 0 if it has none. @@ -23353,14 +22525,13 @@ function tree_index(node) { * The index of an object is its number of preceding siblings, or 0 if it * has none. */ - var n = 0; + let n = 0; while (node._previousSibling !== null) { n++; node = node._previousSibling; } return n; } -exports.tree_index = tree_index; /** * Retargets an object against another object. * @@ -23383,7 +22554,7 @@ function tree_retarget(a, b) { if (!a || !util_1.Guard.isNode(a)) { return a; } - var rootOfA = tree_rootNode(a); + const rootOfA = tree_rootNode(a); if (!util_1.Guard.isShadowRoot(rootOfA)) { return a; } @@ -23393,7 +22564,6 @@ function tree_retarget(a, b) { a = rootOfA.host; } } -exports.tree_retarget = tree_retarget; //# sourceMappingURL=TreeAlgorithm.js.map /***/ }), @@ -23404,8 +22574,10 @@ exports.tree_retarget = tree_retarget; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var TraversalAlgorithm_1 = __nccwpck_require__(80998); +exports.treeWalker_traverseChildren = treeWalker_traverseChildren; +exports.treeWalker_traverseSiblings = treeWalker_traverseSiblings; +const interfaces_1 = __nccwpck_require__(27305); +const TraversalAlgorithm_1 = __nccwpck_require__(80998); /** * Returns the first or last child node, or `null` if there are none. * @@ -23420,12 +22592,12 @@ function treeWalker_traverseChildren(walker, first) { * if type is last. * 3. While node is non-null: */ - var node = (first ? walker._current._firstChild : walker._current._lastChild); + let node = (first ? walker._current._firstChild : walker._current._lastChild); while (node !== null) { /** * 3.1. Let result be the result of filtering node within walker. */ - var result = TraversalAlgorithm_1.traversal_filter(walker, node); + const result = (0, TraversalAlgorithm_1.traversal_filter)(walker, node); if (result === interfaces_1.FilterResult.Accept) { /** * 3.2. If result is FILTER_ACCEPT, then set walker’s current to node and @@ -23441,7 +22613,7 @@ function treeWalker_traverseChildren(walker, first) { * last child if type is last. * 3.3.2. If child is non-null, then set node to child and continue. */ - var child = (first ? node._firstChild : node._lastChild); + const child = (first ? node._firstChild : node._lastChild); if (child !== null) { node = child; continue; @@ -23456,7 +22628,7 @@ function treeWalker_traverseChildren(walker, first) { * node’s previous sibling if type is last. * 3.4.2. If sibling is non-null, then set node to sibling and break. */ - var sibling = (first ? node._nextSibling : node._previousSibling); + const sibling = (first ? node._nextSibling : node._previousSibling); if (sibling !== null) { node = sibling; break; @@ -23466,7 +22638,7 @@ function treeWalker_traverseChildren(walker, first) { * 3.4.4. If parent is null, walker’s root, or walker’s current, then * return null. */ - var parent = node._parent; + const parent = node._parent; if (parent === null || parent === walker._root || parent === walker._current) { return null; } @@ -23481,7 +22653,6 @@ function treeWalker_traverseChildren(walker, first) { */ return null; } -exports.treeWalker_traverseChildren = treeWalker_traverseChildren; /** * Returns the next or previous sibling node, or `null` if there are none. * @@ -23495,7 +22666,7 @@ function treeWalker_traverseSiblings(walker, next) { * 2. If node is root, then return null. * 3. While node is non-null: */ - var node = walker._current; + let node = walker._current; if (node === walker._root) return null; while (true) { @@ -23504,7 +22675,7 @@ function treeWalker_traverseSiblings(walker, next) { * previous sibling if type is previous. * 3.2. While sibling is non-null: */ - var sibling = (next ? node._nextSibling : node._previousSibling); + let sibling = (next ? node._nextSibling : node._previousSibling); while (sibling !== null) { /** * 3.2.1. Set node to sibling. @@ -23513,7 +22684,7 @@ function treeWalker_traverseSiblings(walker, next) { * and return node. */ node = sibling; - var result = TraversalAlgorithm_1.traversal_filter(walker, node); + const result = (0, TraversalAlgorithm_1.traversal_filter)(walker, node); if (result === interfaces_1.FilterResult.Accept) { walker._current = node; return node; @@ -23542,12 +22713,11 @@ function treeWalker_traverseSiblings(walker, next) { * 3.5. If the return value of filtering node within walker is FILTER_ACCEPT, * then return null. */ - if (TraversalAlgorithm_1.traversal_filter(walker, node) === interfaces_1.FilterResult.Accept) { + if ((0, TraversalAlgorithm_1.traversal_filter)(walker, node) === interfaces_1.FilterResult.Accept) { return null; } } } -exports.treeWalker_traverseSiblings = treeWalker_traverseSiblings; //# sourceMappingURL=TreeWalkerAlgorithm.js.map /***/ }), @@ -23558,6 +22728,7 @@ exports.treeWalker_traverseSiblings = treeWalker_traverseSiblings; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.idl_defineConst = idl_defineConst; /** * Defines a WebIDL `Const` property on the given object. * @@ -23568,7 +22739,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function idl_defineConst(o, name, value) { Object.defineProperty(o, name, { writable: false, enumerable: true, configurable: false, value: value }); } -exports.idl_defineConst = idl_defineConst; //# sourceMappingURL=WebIDLAlgorithm.js.map /***/ }), @@ -23579,14 +22749,18 @@ exports.idl_defineConst = idl_defineConst; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.xml_isName = xml_isName; +exports.xml_isQName = xml_isQName; +exports.xml_isLegalChar = xml_isLegalChar; +exports.xml_isPubidChar = xml_isPubidChar; /** * Determines if the given string is valid for a `"Name"` construct. * * @param name - name string to test */ function xml_isName(name) { - for (var i = 0; i < name.length; i++) { - var n = name.charCodeAt(i); + for (let i = 0; i < name.length; i++) { + let n = name.charCodeAt(i); // NameStartChar if ((n >= 97 && n <= 122) || // [a-z] (n >= 65 && n <= 90) || // [A-Z] @@ -23613,7 +22787,7 @@ function xml_isName(name) { continue; } if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { - var n2 = name.charCodeAt(i + 1); + const n2 = name.charCodeAt(i + 1); if (n2 >= 0xDC00 && n2 <= 0xDFFF) { n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; i++; @@ -23626,16 +22800,15 @@ function xml_isName(name) { } return true; } -exports.xml_isName = xml_isName; /** * Determines if the given string is valid for a `"QName"` construct. * * @param name - name string to test */ function xml_isQName(name) { - var colonFound = false; - for (var i = 0; i < name.length; i++) { - var n = name.charCodeAt(i); + let colonFound = false; + for (let i = 0; i < name.length; i++) { + let n = name.charCodeAt(i); // NameStartChar if ((n >= 97 && n <= 122) || // [a-z] (n >= 65 && n <= 90) || // [A-Z] @@ -23670,7 +22843,7 @@ function xml_isQName(name) { continue; } if (n >= 0xD800 && n <= 0xDBFF && i < name.length - 1) { - var n2 = name.charCodeAt(i + 1); + const n2 = name.charCodeAt(i + 1); if (n2 >= 0xDC00 && n2 <= 0xDFFF) { n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; i++; @@ -23683,15 +22856,14 @@ function xml_isQName(name) { } return true; } -exports.xml_isQName = xml_isQName; /** * Determines if the given string contains legal characters. * * @param chars - sequence of characters to test */ function xml_isLegalChar(chars) { - for (var i = 0; i < chars.length; i++) { - var n = chars.charCodeAt(i); + for (let i = 0; i < chars.length; i++) { + let n = chars.charCodeAt(i); // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] if (n === 0x9 || n === 0xA || n === 0xD || (n >= 0x20 && n <= 0xD7FF) || @@ -23699,7 +22871,7 @@ function xml_isLegalChar(chars) { continue; } if (n >= 0xD800 && n <= 0xDBFF && i < chars.length - 1) { - var n2 = chars.charCodeAt(i + 1); + const n2 = chars.charCodeAt(i + 1); if (n2 >= 0xDC00 && n2 <= 0xDFFF) { n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; i++; @@ -23712,7 +22884,6 @@ function xml_isLegalChar(chars) { } return true; } -exports.xml_isLegalChar = xml_isLegalChar; /** * Determines if the given string contains legal characters for a public * identifier. @@ -23720,9 +22891,9 @@ exports.xml_isLegalChar = xml_isLegalChar; * @param chars - sequence of characters to test */ function xml_isPubidChar(chars) { - for (var i = 0; i < chars.length; i++) { + for (let i = 0; i < chars.length; i++) { // PubId chars are all in the ASCII range, no need to check surrogates - var n = chars.charCodeAt(i); + const n = chars.charCodeAt(i); // #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] if ((n >= 97 && n <= 122) || // [a-z] (n >= 65 && n <= 90) || // [A-Z] @@ -23739,48 +22910,58 @@ function xml_isPubidChar(chars) { } return true; } -exports.xml_isPubidChar = xml_isPubidChar; //# sourceMappingURL=XMLAlgorithm.js.map /***/ }), /***/ 61: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", ({ value: true })); -__export(__nccwpck_require__(32206)); -__export(__nccwpck_require__(84309)); -__export(__nccwpck_require__(81054)); -__export(__nccwpck_require__(19461)); -__export(__nccwpck_require__(57339)); -__export(__nccwpck_require__(35648)); -__export(__nccwpck_require__(12793)); -__export(__nccwpck_require__(9628)); -__export(__nccwpck_require__(93261)); -__export(__nccwpck_require__(51849)); -__export(__nccwpck_require__(28217)); -__export(__nccwpck_require__(21312)); -__export(__nccwpck_require__(45463)); -__export(__nccwpck_require__(78157)); -__export(__nccwpck_require__(35856)); -__export(__nccwpck_require__(74924)); -__export(__nccwpck_require__(3973)); -__export(__nccwpck_require__(53670)); -__export(__nccwpck_require__(2328)); -__export(__nccwpck_require__(30457)); -__export(__nccwpck_require__(41853)); -__export(__nccwpck_require__(68733)); -__export(__nccwpck_require__(13512)); -__export(__nccwpck_require__(80998)); -__export(__nccwpck_require__(16620)); -__export(__nccwpck_require__(94962)); -__export(__nccwpck_require__(45457)); -__export(__nccwpck_require__(57030)); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(32206), exports); +__exportStar(__nccwpck_require__(84309), exports); +__exportStar(__nccwpck_require__(81054), exports); +__exportStar(__nccwpck_require__(19461), exports); +__exportStar(__nccwpck_require__(57339), exports); +__exportStar(__nccwpck_require__(35648), exports); +__exportStar(__nccwpck_require__(12793), exports); +__exportStar(__nccwpck_require__(9628), exports); +__exportStar(__nccwpck_require__(93261), exports); +__exportStar(__nccwpck_require__(51849), exports); +__exportStar(__nccwpck_require__(28217), exports); +__exportStar(__nccwpck_require__(21312), exports); +__exportStar(__nccwpck_require__(45463), exports); +__exportStar(__nccwpck_require__(78157), exports); +__exportStar(__nccwpck_require__(35856), exports); +__exportStar(__nccwpck_require__(74924), exports); +__exportStar(__nccwpck_require__(3973), exports); +__exportStar(__nccwpck_require__(53670), exports); +__exportStar(__nccwpck_require__(2328), exports); +__exportStar(__nccwpck_require__(30457), exports); +__exportStar(__nccwpck_require__(41853), exports); +__exportStar(__nccwpck_require__(68733), exports); +__exportStar(__nccwpck_require__(13512), exports); +__exportStar(__nccwpck_require__(80998), exports); +__exportStar(__nccwpck_require__(16620), exports); +__exportStar(__nccwpck_require__(94962), exports); +__exportStar(__nccwpck_require__(45457), exports); +__exportStar(__nccwpck_require__(57030), exports); //# sourceMappingURL=index.js.map /***/ }), @@ -23791,100 +22972,74 @@ __export(__nccwpck_require__(57030)); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var algorithm_1 = __nccwpck_require__(61); +exports.AbortControllerImpl = void 0; +const algorithm_1 = __nccwpck_require__(61); /** * Represents a controller that allows to abort DOM requests. */ -var AbortControllerImpl = /** @class */ (function () { +class AbortControllerImpl { + _signal; /** * Initializes a new instance of `AbortController`. */ - function AbortControllerImpl() { + constructor() { /** * 1. Let signal be a new AbortSignal object. * 2. Let controller be a new AbortController object whose signal is signal. * 3. Return controller. */ - this._signal = algorithm_1.create_abortSignal(); + this._signal = (0, algorithm_1.create_abortSignal)(); } - Object.defineProperty(AbortControllerImpl.prototype, "signal", { - /** @inheritdoc */ - get: function () { return this._signal; }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - AbortControllerImpl.prototype.abort = function () { - algorithm_1.abort_signalAbort(this._signal); - }; - return AbortControllerImpl; -}()); + get signal() { return this._signal; } + /** @inheritdoc */ + abort() { + (0, algorithm_1.abort_signalAbort)(this._signal); + } +} exports.AbortControllerImpl = AbortControllerImpl; //# sourceMappingURL=AbortControllerImpl.js.map /***/ }), /***/ 10022: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventTargetImpl_1 = __nccwpck_require__(69968); -var algorithm_1 = __nccwpck_require__(61); +exports.AbortSignalImpl = void 0; +const EventTargetImpl_1 = __nccwpck_require__(69968); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a signal object that communicates with a DOM request and abort * it through an AbortController. */ -var AbortSignalImpl = /** @class */ (function (_super) { - __extends(AbortSignalImpl, _super); +class AbortSignalImpl extends EventTargetImpl_1.EventTargetImpl { + _abortedFlag = false; + _abortAlgorithms = new Set(); /** * Initializes a new instance of `AbortSignal`. */ - function AbortSignalImpl() { - var _this = _super.call(this) || this; - _this._abortedFlag = false; - _this._abortAlgorithms = new Set(); - return _this; - } - Object.defineProperty(AbortSignalImpl.prototype, "aborted", { - /** @inheritdoc */ - get: function () { return this._abortedFlag; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbortSignalImpl.prototype, "onabort", { - /** @inheritdoc */ - get: function () { - return algorithm_1.event_getterEventHandlerIDLAttribute(this, "onabort"); - }, - set: function (val) { - algorithm_1.event_setterEventHandlerIDLAttribute(this, "onabort", val); - }, - enumerable: true, - configurable: true - }); + constructor() { + super(); + } + /** @inheritdoc */ + get aborted() { return this._abortedFlag; } + /** @inheritdoc */ + get onabort() { + return (0, algorithm_1.event_getterEventHandlerIDLAttribute)(this, "onabort"); + } + set onabort(val) { + (0, algorithm_1.event_setterEventHandlerIDLAttribute)(this, "onabort", val); + } /** * Creates a new `AbortSignal`. */ - AbortSignalImpl._create = function () { + static _create() { return new AbortSignalImpl(); - }; - return AbortSignalImpl; -}(EventTargetImpl_1.EventTargetImpl)); + } +} exports.AbortSignalImpl = AbortSignalImpl; //# sourceMappingURL=AbortSignalImpl.js.map @@ -23896,236 +23051,143 @@ exports.AbortSignalImpl = AbortSignalImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbstractRangeImpl = void 0; /** * Represents an abstract range with a start and end boundary point. */ -var AbstractRangeImpl = /** @class */ (function () { - function AbstractRangeImpl() { +class AbstractRangeImpl { + get _startNode() { return this._start[0]; } + get _startOffset() { return this._start[1]; } + get _endNode() { return this._end[0]; } + get _endOffset() { return this._end[1]; } + get _collapsed() { + return (this._start[0] === this._end[0] && + this._start[1] === this._end[1]); } - Object.defineProperty(AbstractRangeImpl.prototype, "_startNode", { - get: function () { return this._start[0]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_startOffset", { - get: function () { return this._start[1]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_endNode", { - get: function () { return this._end[0]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_endOffset", { - get: function () { return this._end[1]; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "_collapsed", { - get: function () { - return (this._start[0] === this._end[0] && - this._start[1] === this._end[1]); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "startContainer", { - /** @inheritdoc */ - get: function () { return this._startNode; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "startOffset", { - /** @inheritdoc */ - get: function () { return this._startOffset; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "endContainer", { - /** @inheritdoc */ - get: function () { return this._endNode; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "endOffset", { - /** @inheritdoc */ - get: function () { return this._endOffset; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbstractRangeImpl.prototype, "collapsed", { - /** @inheritdoc */ - get: function () { return this._collapsed; }, - enumerable: true, - configurable: true - }); - return AbstractRangeImpl; -}()); + /** @inheritdoc */ + get startContainer() { return this._startNode; } + /** @inheritdoc */ + get startOffset() { return this._startOffset; } + /** @inheritdoc */ + get endContainer() { return this._endNode; } + /** @inheritdoc */ + get endOffset() { return this._endOffset; } + /** @inheritdoc */ + get collapsed() { return this._collapsed; } +} exports.AbstractRangeImpl = AbstractRangeImpl; //# sourceMappingURL=AbstractRangeImpl.js.map /***/ }), /***/ 13717: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var NodeImpl_1 = __nccwpck_require__(91745); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.AttrImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const NodeImpl_1 = __nccwpck_require__(91745); +const algorithm_1 = __nccwpck_require__(61); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents an attribute of an element node. */ -var AttrImpl = /** @class */ (function (_super) { - __extends(AttrImpl, _super); +class AttrImpl extends NodeImpl_1.NodeImpl { + _nodeType = interfaces_1.NodeType.Attribute; + _localName; + _namespace = null; + _namespacePrefix = null; + _element = null; + _value = ''; /** * Initializes a new instance of `Attr`. * * @param localName - local name */ - function AttrImpl(localName) { - var _this = _super.call(this) || this; - _this._namespace = null; - _this._namespacePrefix = null; - _this._element = null; - _this._value = ''; - _this._localName = localName; - return _this; - } - Object.defineProperty(AttrImpl.prototype, "ownerElement", { - /** @inheritdoc */ - get: function () { return this._element; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "namespaceURI", { - /** @inheritdoc */ - get: function () { return this._namespace; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "prefix", { - /** @inheritdoc */ - get: function () { return this._namespacePrefix; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "localName", { - /** @inheritdoc */ - get: function () { return this._localName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "name", { - /** @inheritdoc */ - get: function () { return this._qualifiedName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "value", { - /** @inheritdoc */ - get: function () { return this._value; }, - set: function (value) { - /** - * The value attribute’s setter must set an existing attribute value with - * context object and the given value. - */ - algorithm_1.attr_setAnExistingAttributeValue(this, value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AttrImpl.prototype, "_qualifiedName", { + constructor(localName) { + super(); + this._localName = localName; + } + /** @inheritdoc */ + specified; + /** @inheritdoc */ + get ownerElement() { return this._element; } + /** @inheritdoc */ + get namespaceURI() { return this._namespace; } + /** @inheritdoc */ + get prefix() { return this._namespacePrefix; } + /** @inheritdoc */ + get localName() { return this._localName; } + /** @inheritdoc */ + get name() { return this._qualifiedName; } + /** @inheritdoc */ + get value() { return this._value; } + set value(value) { /** - * Returns the qualified name. + * The value attribute’s setter must set an existing attribute value with + * context object and the given value. */ - get: function () { - /** - * An attribute’s qualified name is its local name if its namespace prefix - * is null, and its namespace prefix, followed by ":", followed by its - * local name, otherwise. - */ - return (this._namespacePrefix !== null ? - this._namespacePrefix + ':' + this._localName : - this._localName); - }, - enumerable: true, - configurable: true - }); + (0, algorithm_1.attr_setAnExistingAttributeValue)(this, value); + } + /** + * Returns the qualified name. + */ + get _qualifiedName() { + /** + * An attribute’s qualified name is its local name if its namespace prefix + * is null, and its namespace prefix, followed by ":", followed by its + * local name, otherwise. + */ + return (this._namespacePrefix !== null ? + this._namespacePrefix + ':' + this._localName : + this._localName); + } /** * Creates an `Attr`. * * @param document - owner document * @param localName - local name */ - AttrImpl._create = function (document, localName) { - var node = new AttrImpl(localName); + static _create(document, localName) { + const node = new AttrImpl(localName); node._nodeDocument = document; return node; - }; - return AttrImpl; -}(NodeImpl_1.NodeImpl)); + } +} exports.AttrImpl = AttrImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "_nodeType", interfaces_1.NodeType.Attribute); -WebIDLAlgorithm_1.idl_defineConst(AttrImpl.prototype, "specified", true); +(0, WebIDLAlgorithm_1.idl_defineConst)(AttrImpl.prototype, "_nodeType", interfaces_1.NodeType.Attribute); +(0, WebIDLAlgorithm_1.idl_defineConst)(AttrImpl.prototype, "specified", true); //# sourceMappingURL=AttrImpl.js.map /***/ }), /***/ 23977: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var TextImpl_1 = __nccwpck_require__(42191); -var interfaces_1 = __nccwpck_require__(27305); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.CDATASectionImpl = void 0; +const TextImpl_1 = __nccwpck_require__(42191); +const interfaces_1 = __nccwpck_require__(27305); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a CDATA node. */ -var CDATASectionImpl = /** @class */ (function (_super) { - __extends(CDATASectionImpl, _super); +class CDATASectionImpl extends TextImpl_1.TextImpl { + _nodeType = interfaces_1.NodeType.CData; /** * Initializes a new instance of `CDATASection`. * * @param data - node contents */ - function CDATASectionImpl(data) { - return _super.call(this, data) || this; + constructor(data) { + super(data); } /** * Creates a new `CDATASection`. @@ -24133,157 +23195,107 @@ var CDATASectionImpl = /** @class */ (function (_super) { * @param document - owner document * @param data - node contents */ - CDATASectionImpl._create = function (document, data) { - if (data === void 0) { data = ''; } - var node = new CDATASectionImpl(data); + static _create(document, data = '') { + const node = new CDATASectionImpl(data); node._nodeDocument = document; return node; - }; - return CDATASectionImpl; -}(TextImpl_1.TextImpl)); + } +} exports.CDATASectionImpl = CDATASectionImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(CDATASectionImpl.prototype, "_nodeType", interfaces_1.NodeType.CData); +(0, WebIDLAlgorithm_1.idl_defineConst)(CDATASectionImpl.prototype, "_nodeType", interfaces_1.NodeType.CData); //# sourceMappingURL=CDATASectionImpl.js.map /***/ }), /***/ 65330: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var NodeImpl_1 = __nccwpck_require__(91745); -var algorithm_1 = __nccwpck_require__(61); +exports.CharacterDataImpl = void 0; +const NodeImpl_1 = __nccwpck_require__(91745); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a generic text node. */ -var CharacterDataImpl = /** @class */ (function (_super) { - __extends(CharacterDataImpl, _super); +class CharacterDataImpl extends NodeImpl_1.NodeImpl { + _data; /** * Initializes a new instance of `CharacterData`. * * @param data - the text content */ - function CharacterDataImpl(data) { - var _this = _super.call(this) || this; - _this._data = data; - return _this; + constructor(data) { + super(); + this._data = data; + } + /** @inheritdoc */ + get data() { return this._data; } + set data(value) { + (0, algorithm_1.characterData_replaceData)(this, 0, this._data.length, value); } - Object.defineProperty(CharacterDataImpl.prototype, "data", { - /** @inheritdoc */ - get: function () { return this._data; }, - set: function (value) { - algorithm_1.characterData_replaceData(this, 0, this._data.length, value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CharacterDataImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { return this._data.length; }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - CharacterDataImpl.prototype.substringData = function (offset, count) { + get length() { return this._data.length; } + /** @inheritdoc */ + substringData(offset, count) { /** * The substringData(offset, count) method, when invoked, must return the * result of running substring data with node context object, offset offset, and count count. */ - return algorithm_1.characterData_substringData(this, offset, count); - }; + return (0, algorithm_1.characterData_substringData)(this, offset, count); + } /** @inheritdoc */ - CharacterDataImpl.prototype.appendData = function (data) { + appendData(data) { /** * The appendData(data) method, when invoked, must replace data with node * context object, offset context object’s length, count 0, and data data. */ - return algorithm_1.characterData_replaceData(this, this._data.length, 0, data); - }; + return (0, algorithm_1.characterData_replaceData)(this, this._data.length, 0, data); + } /** @inheritdoc */ - CharacterDataImpl.prototype.insertData = function (offset, data) { + insertData(offset, data) { /** * The insertData(offset, data) method, when invoked, must replace data with * node context object, offset offset, count 0, and data data. */ - algorithm_1.characterData_replaceData(this, offset, 0, data); - }; + (0, algorithm_1.characterData_replaceData)(this, offset, 0, data); + } /** @inheritdoc */ - CharacterDataImpl.prototype.deleteData = function (offset, count) { + deleteData(offset, count) { /** * The deleteData(offset, count) method, when invoked, must replace data * with node context object, offset offset, count count, and data the * empty string. */ - algorithm_1.characterData_replaceData(this, offset, count, ''); - }; + (0, algorithm_1.characterData_replaceData)(this, offset, count, ''); + } /** @inheritdoc */ - CharacterDataImpl.prototype.replaceData = function (offset, count, data) { + replaceData(offset, count, data) { /** * The replaceData(offset, count, data) method, when invoked, must replace * data with node context object, offset offset, count count, and data data. */ - algorithm_1.characterData_replaceData(this, offset, count, data); - }; - Object.defineProperty(CharacterDataImpl.prototype, "previousElementSibling", { - // MIXIN: NonDocumentTypeChildNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CharacterDataImpl.prototype, "nextElementSibling", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); + (0, algorithm_1.characterData_replaceData)(this, offset, count, data); + } + // MIXIN: NonDocumentTypeChildNode + /* istanbul ignore next */ + get previousElementSibling() { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); } + /* istanbul ignore next */ + get nextElementSibling() { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); } // MIXIN: ChildNode /* istanbul ignore next */ - CharacterDataImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + before(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - CharacterDataImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + after(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - CharacterDataImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + replaceWith(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - CharacterDataImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; - return CharacterDataImpl; -}(NodeImpl_1.NodeImpl)); + remove() { throw new Error("Mixin: ChildNode not implemented."); } +} exports.CharacterDataImpl = CharacterDataImpl; //# sourceMappingURL=CharacterDataImpl.js.map @@ -24295,40 +23307,35 @@ exports.CharacterDataImpl = CharacterDataImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(65282); -var algorithm_1 = __nccwpck_require__(61); +exports.ChildNodeImpl = void 0; +const util_1 = __nccwpck_require__(65282); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a mixin that extends child nodes that can have siblings * including doctypes. This mixin is implemented by {@link Element}, * {@link CharacterData} and {@link DocumentType}. */ -var ChildNodeImpl = /** @class */ (function () { - function ChildNodeImpl() { - } +class ChildNodeImpl { /** @inheritdoc */ - ChildNodeImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } + before(...nodes) { /** * 1. Let parent be context object’s parent. * 2. If parent is null, then return. */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; + const context = util_1.Cast.asNode(this); + const parent = context._parent; if (parent === null) return; /** * 3. Let viablePreviousSibling be context object’s first preceding * sibling not in nodes, and null otherwise. */ - var viablePreviousSibling = context._previousSibling; - var flag = true; + let viablePreviousSibling = context._previousSibling; + let flag = true; while (flag && viablePreviousSibling) { flag = false; - for (var i = 0; i < nodes.length; i++) { - var child = nodes[i]; + for (let i = 0; i < nodes.length; i++) { + const child = nodes[i]; if (child === viablePreviousSibling) { viablePreviousSibling = viablePreviousSibling._previousSibling; flag = true; @@ -24340,7 +23347,7 @@ var ChildNodeImpl = /** @class */ (function () { * 4. Let node be the result of converting nodes into a node, given nodes * and context object’s node document. */ - var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); + const node = (0, algorithm_1.parentNode_convertNodesIntoANode)(nodes, context._nodeDocument); /** * 5. If viablePreviousSibling is null, set it to parent’s first child, * and to viablePreviousSibling’s next sibling otherwise. @@ -24352,32 +23359,28 @@ var ChildNodeImpl = /** @class */ (function () { /** * 6. Pre-insert node into parent before viablePreviousSibling. */ - algorithm_1.mutation_preInsert(node, parent, viablePreviousSibling); - }; + (0, algorithm_1.mutation_preInsert)(node, parent, viablePreviousSibling); + } /** @inheritdoc */ - ChildNodeImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } + after(...nodes) { /** * 1. Let parent be context object’s parent. * 2. If parent is null, then return. */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; + const context = util_1.Cast.asNode(this); + const parent = context._parent; if (!parent) return; /** * 3. Let viableNextSibling be context object’s first following sibling not * in nodes, and null otherwise. */ - var viableNextSibling = context._nextSibling; - var flag = true; + let viableNextSibling = context._nextSibling; + let flag = true; while (flag && viableNextSibling) { flag = false; - for (var i = 0; i < nodes.length; i++) { - var child = nodes[i]; + for (let i = 0; i < nodes.length; i++) { + const child = nodes[i]; if (child === viableNextSibling) { viableNextSibling = viableNextSibling._nextSibling; flag = true; @@ -24389,36 +23392,32 @@ var ChildNodeImpl = /** @class */ (function () { * 4. Let node be the result of converting nodes into a node, given nodes * and context object’s node document. */ - var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); + const node = (0, algorithm_1.parentNode_convertNodesIntoANode)(nodes, context._nodeDocument); /** * 5. Pre-insert node into parent before viableNextSibling. */ - algorithm_1.mutation_preInsert(node, parent, viableNextSibling); - }; + (0, algorithm_1.mutation_preInsert)(node, parent, viableNextSibling); + } /** @inheritdoc */ - ChildNodeImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } + replaceWith(...nodes) { /** * 1. Let parent be context object’s parent. * 2. If parent is null, then return. */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; + const context = util_1.Cast.asNode(this); + const parent = context._parent; if (!parent) return; /** * 3. Let viableNextSibling be context object’s first following sibling not * in nodes, and null otherwise. */ - var viableNextSibling = context._nextSibling; - var flag = true; + let viableNextSibling = context._nextSibling; + let flag = true; while (flag && viableNextSibling) { flag = false; - for (var i = 0; i < nodes.length; i++) { - var child = nodes[i]; + for (let i = 0; i < nodes.length; i++) { + const child = nodes[i]; if (child === viableNextSibling) { viableNextSibling = viableNextSibling._nextSibling; flag = true; @@ -24430,7 +23429,7 @@ var ChildNodeImpl = /** @class */ (function () { * 4. Let node be the result of converting nodes into a node, given nodes * and context object’s node document. */ - var node = algorithm_1.parentNode_convertNodesIntoANode(nodes, context._nodeDocument); + const node = (0, algorithm_1.parentNode_convertNodesIntoANode)(nodes, context._nodeDocument); /** * 5. If context object’s parent is parent, replace the context object with * node within parent. @@ -24438,64 +23437,50 @@ var ChildNodeImpl = /** @class */ (function () { * 6. Otherwise, pre-insert node into parent before viableNextSibling. */ if (context._parent === parent) - algorithm_1.mutation_replace(context, node, parent); + (0, algorithm_1.mutation_replace)(context, node, parent); else - algorithm_1.mutation_preInsert(node, parent, viableNextSibling); - }; + (0, algorithm_1.mutation_preInsert)(node, parent, viableNextSibling); + } /** @inheritdoc */ - ChildNodeImpl.prototype.remove = function () { + remove() { /** * 1. If context object’s parent is null, then return. * 2. Remove the context object from context object’s parent. */ - var context = util_1.Cast.asNode(this); - var parent = context._parent; + const context = util_1.Cast.asNode(this); + const parent = context._parent; if (!parent) return; - algorithm_1.mutation_remove(context, parent); - }; - return ChildNodeImpl; -}()); + (0, algorithm_1.mutation_remove)(context, parent); + } +} exports.ChildNodeImpl = ChildNodeImpl; //# sourceMappingURL=ChildNodeImpl.js.map /***/ }), /***/ 20930: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var CharacterDataImpl_1 = __nccwpck_require__(65330); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.CommentImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const CharacterDataImpl_1 = __nccwpck_require__(65330); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a comment node. */ -var CommentImpl = /** @class */ (function (_super) { - __extends(CommentImpl, _super); +class CommentImpl extends CharacterDataImpl_1.CharacterDataImpl { + _nodeType = interfaces_1.NodeType.Comment; /** * Initializes a new instance of `Comment`. * * @param data - the text content */ - function CommentImpl(data) { - if (data === void 0) { data = ''; } - return _super.call(this, data) || this; + constructor(data = '') { + super(data); } /** * Creates a new `Comment`. @@ -24503,69 +23488,46 @@ var CommentImpl = /** @class */ (function (_super) { * @param document - owner document * @param data - node contents */ - CommentImpl._create = function (document, data) { - if (data === void 0) { data = ''; } - var node = new CommentImpl(data); + static _create(document, data = '') { + const node = new CommentImpl(data); node._nodeDocument = document; return node; - }; - return CommentImpl; -}(CharacterDataImpl_1.CharacterDataImpl)); + } +} exports.CommentImpl = CommentImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(CommentImpl.prototype, "_nodeType", interfaces_1.NodeType.Comment); +(0, WebIDLAlgorithm_1.idl_defineConst)(CommentImpl.prototype, "_nodeType", interfaces_1.NodeType.Comment); //# sourceMappingURL=CommentImpl.js.map /***/ }), /***/ 59857: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventImpl_1 = __nccwpck_require__(38245); -var algorithm_1 = __nccwpck_require__(61); +exports.CustomEventImpl = void 0; +const EventImpl_1 = __nccwpck_require__(38245); +const algorithm_1 = __nccwpck_require__(61); /** * Represents and event that carries custom data. */ -var CustomEventImpl = /** @class */ (function (_super) { - __extends(CustomEventImpl, _super); +class CustomEventImpl extends EventImpl_1.EventImpl { + _detail = null; /** * Initializes a new instance of `CustomEvent`. */ - function CustomEventImpl(type, eventInit) { - var _this = _super.call(this, type, eventInit) || this; - _this._detail = null; - _this._detail = (eventInit && eventInit.detail) || null; - return _this; - } - Object.defineProperty(CustomEventImpl.prototype, "detail", { - /** @inheritdoc */ - get: function () { return this._detail; }, - enumerable: true, - configurable: true - }); + constructor(type, eventInit) { + super(type, eventInit); + this._detail = (eventInit && eventInit.detail) || null; + } /** @inheritdoc */ - CustomEventImpl.prototype.initCustomEvent = function (type, bubbles, cancelable, detail) { - if (bubbles === void 0) { bubbles = false; } - if (cancelable === void 0) { cancelable = false; } - if (detail === void 0) { detail = null; } + get detail() { return this._detail; } + /** @inheritdoc */ + initCustomEvent(type, bubbles = false, cancelable = false, detail = null) { /** * 1. If the context object’s dispatch flag is set, then return. */ @@ -24574,368 +23536,277 @@ var CustomEventImpl = /** @class */ (function (_super) { /** * 2. Initialize the context object with type, bubbles, and cancelable. */ - algorithm_1.event_initialize(this, type, bubbles, cancelable); + (0, algorithm_1.event_initialize)(this, type, bubbles, cancelable); /** * 3. Set the context object’s detail attribute to detail. */ this._detail = detail; - }; - return CustomEventImpl; -}(EventImpl_1.EventImpl)); + } +} exports.CustomEventImpl = CustomEventImpl; //# sourceMappingURL=CustomEventImpl.js.map /***/ }), /***/ 13166: -/***/ (function(__unused_webpack_module, exports) { +/***/ ((__unused_webpack_module, exports) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.InvalidCharacterError = exports.SyntaxError = exports.IndexSizeError = exports.NotFoundError = exports.HierarchyRequestError = exports.NotImplementedError = exports.DataCloneError = exports.InvalidNodeTypeError = exports.TimeoutError = exports.QuotaExceededError = exports.URLMismatchError = exports.AbortError = exports.NetworkError = exports.SecurityError = exports.TypeMismatchError = exports.ValidationError = exports.InvalidAccessError = exports.NamespaceError = exports.InvalidModificationError = exports.InvalidStateError = exports.InUseAttributeError = exports.NotSupportedError = exports.NoModificationAllowedError = exports.NoDataAllowedError = exports.WrongDocumentError = exports.DOMStringSizeError = exports.DOMException = void 0; /** * Represents the base class of `Error` objects used by this module. */ -var DOMException = /** @class */ (function (_super) { - __extends(DOMException, _super); +class DOMException extends Error { + /** + * Returns the name of the error message. + */ + name; /** * * @param name - message name * @param message - error message */ - function DOMException(name, message) { - if (message === void 0) { message = ""; } - var _this = _super.call(this, message) || this; - _this.name = name; - return _this; + constructor(name, message = "") { + super(message); + this.name = name; } - return DOMException; -}(Error)); +} exports.DOMException = DOMException; -var DOMStringSizeError = /** @class */ (function (_super) { - __extends(DOMStringSizeError, _super); +class DOMStringSizeError extends DOMException { /** * @param message - error message */ - function DOMStringSizeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "DOMStringSizeError", message) || this; + constructor(message = "") { + super("DOMStringSizeError", message); } - return DOMStringSizeError; -}(DOMException)); +} exports.DOMStringSizeError = DOMStringSizeError; -var WrongDocumentError = /** @class */ (function (_super) { - __extends(WrongDocumentError, _super); +class WrongDocumentError extends DOMException { /** * @param message - error message */ - function WrongDocumentError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "WrongDocumentError", "The object is in the wrong document. " + message) || this; + constructor(message = "") { + super("WrongDocumentError", "The object is in the wrong document. " + message); } - return WrongDocumentError; -}(DOMException)); +} exports.WrongDocumentError = WrongDocumentError; -var NoDataAllowedError = /** @class */ (function (_super) { - __extends(NoDataAllowedError, _super); +class NoDataAllowedError extends DOMException { /** * @param message - error message */ - function NoDataAllowedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NoDataAllowedError", message) || this; + constructor(message = "") { + super("NoDataAllowedError", message); } - return NoDataAllowedError; -}(DOMException)); +} exports.NoDataAllowedError = NoDataAllowedError; -var NoModificationAllowedError = /** @class */ (function (_super) { - __extends(NoModificationAllowedError, _super); +class NoModificationAllowedError extends DOMException { /** * @param message - error message */ - function NoModificationAllowedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NoModificationAllowedError", "The object can not be modified. " + message) || this; + constructor(message = "") { + super("NoModificationAllowedError", "The object can not be modified. " + message); } - return NoModificationAllowedError; -}(DOMException)); +} exports.NoModificationAllowedError = NoModificationAllowedError; -var NotSupportedError = /** @class */ (function (_super) { - __extends(NotSupportedError, _super); +class NotSupportedError extends DOMException { /** * @param message - error message */ - function NotSupportedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NotSupportedError", "The operation is not supported. " + message) || this; + constructor(message = "") { + super("NotSupportedError", "The operation is not supported. " + message); } - return NotSupportedError; -}(DOMException)); +} exports.NotSupportedError = NotSupportedError; -var InUseAttributeError = /** @class */ (function (_super) { - __extends(InUseAttributeError, _super); +class InUseAttributeError extends DOMException { /** * @param message - error message */ - function InUseAttributeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InUseAttributeError", message) || this; + constructor(message = "") { + super("InUseAttributeError", message); } - return InUseAttributeError; -}(DOMException)); +} exports.InUseAttributeError = InUseAttributeError; -var InvalidStateError = /** @class */ (function (_super) { - __extends(InvalidStateError, _super); +class InvalidStateError extends DOMException { /** * @param message - error message */ - function InvalidStateError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidStateError", "The object is in an invalid state. " + message) || this; + constructor(message = "") { + super("InvalidStateError", "The object is in an invalid state. " + message); } - return InvalidStateError; -}(DOMException)); +} exports.InvalidStateError = InvalidStateError; -var InvalidModificationError = /** @class */ (function (_super) { - __extends(InvalidModificationError, _super); +class InvalidModificationError extends DOMException { /** * @param message - error message */ - function InvalidModificationError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidModificationError", "The object can not be modified in this way. " + message) || this; + constructor(message = "") { + super("InvalidModificationError", "The object can not be modified in this way. " + message); } - return InvalidModificationError; -}(DOMException)); +} exports.InvalidModificationError = InvalidModificationError; -var NamespaceError = /** @class */ (function (_super) { - __extends(NamespaceError, _super); +class NamespaceError extends DOMException { /** * @param message - error message */ - function NamespaceError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NamespaceError", "The operation is not allowed by Namespaces in XML. [XMLNS] " + message) || this; + constructor(message = "") { + super("NamespaceError", "The operation is not allowed by Namespaces in XML. [XMLNS] " + message); } - return NamespaceError; -}(DOMException)); +} exports.NamespaceError = NamespaceError; -var InvalidAccessError = /** @class */ (function (_super) { - __extends(InvalidAccessError, _super); +class InvalidAccessError extends DOMException { /** * @param message - error message */ - function InvalidAccessError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidAccessError", "The object does not support the operation or argument. " + message) || this; + constructor(message = "") { + super("InvalidAccessError", "The object does not support the operation or argument. " + message); } - return InvalidAccessError; -}(DOMException)); +} exports.InvalidAccessError = InvalidAccessError; -var ValidationError = /** @class */ (function (_super) { - __extends(ValidationError, _super); +class ValidationError extends DOMException { /** * @param message - error message */ - function ValidationError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "ValidationError", message) || this; + constructor(message = "") { + super("ValidationError", message); } - return ValidationError; -}(DOMException)); +} exports.ValidationError = ValidationError; -var TypeMismatchError = /** @class */ (function (_super) { - __extends(TypeMismatchError, _super); +class TypeMismatchError extends DOMException { /** * @param message - error message */ - function TypeMismatchError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "TypeMismatchError", message) || this; + constructor(message = "") { + super("TypeMismatchError", message); } - return TypeMismatchError; -}(DOMException)); +} exports.TypeMismatchError = TypeMismatchError; -var SecurityError = /** @class */ (function (_super) { - __extends(SecurityError, _super); +class SecurityError extends DOMException { /** * @param message - error message */ - function SecurityError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "SecurityError", "The operation is insecure. " + message) || this; + constructor(message = "") { + super("SecurityError", "The operation is insecure. " + message); } - return SecurityError; -}(DOMException)); +} exports.SecurityError = SecurityError; -var NetworkError = /** @class */ (function (_super) { - __extends(NetworkError, _super); +class NetworkError extends DOMException { /** * @param message - error message */ - function NetworkError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NetworkError", "A network error occurred. " + message) || this; + constructor(message = "") { + super("NetworkError", "A network error occurred. " + message); } - return NetworkError; -}(DOMException)); +} exports.NetworkError = NetworkError; -var AbortError = /** @class */ (function (_super) { - __extends(AbortError, _super); +class AbortError extends DOMException { /** * @param message - error message */ - function AbortError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "AbortError", "The operation was aborted. " + message) || this; + constructor(message = "") { + super("AbortError", "The operation was aborted. " + message); } - return AbortError; -}(DOMException)); +} exports.AbortError = AbortError; -var URLMismatchError = /** @class */ (function (_super) { - __extends(URLMismatchError, _super); +class URLMismatchError extends DOMException { /** * @param message - error message */ - function URLMismatchError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "URLMismatchError", "The given URL does not match another URL. " + message) || this; + constructor(message = "") { + super("URLMismatchError", "The given URL does not match another URL. " + message); } - return URLMismatchError; -}(DOMException)); +} exports.URLMismatchError = URLMismatchError; -var QuotaExceededError = /** @class */ (function (_super) { - __extends(QuotaExceededError, _super); +class QuotaExceededError extends DOMException { /** * @param message - error message */ - function QuotaExceededError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "QuotaExceededError", "The quota has been exceeded. " + message) || this; + constructor(message = "") { + super("QuotaExceededError", "The quota has been exceeded. " + message); } - return QuotaExceededError; -}(DOMException)); +} exports.QuotaExceededError = QuotaExceededError; -var TimeoutError = /** @class */ (function (_super) { - __extends(TimeoutError, _super); +class TimeoutError extends DOMException { /** * @param message - error message */ - function TimeoutError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "TimeoutError", "The operation timed out. " + message) || this; + constructor(message = "") { + super("TimeoutError", "The operation timed out. " + message); } - return TimeoutError; -}(DOMException)); +} exports.TimeoutError = TimeoutError; -var InvalidNodeTypeError = /** @class */ (function (_super) { - __extends(InvalidNodeTypeError, _super); +class InvalidNodeTypeError extends DOMException { /** * @param message - error message */ - function InvalidNodeTypeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation. " + message) || this; + constructor(message = "") { + super("InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation. " + message); } - return InvalidNodeTypeError; -}(DOMException)); +} exports.InvalidNodeTypeError = InvalidNodeTypeError; -var DataCloneError = /** @class */ (function (_super) { - __extends(DataCloneError, _super); +class DataCloneError extends DOMException { /** * @param message - error message */ - function DataCloneError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "DataCloneError", "The object can not be cloned. " + message) || this; + constructor(message = "") { + super("DataCloneError", "The object can not be cloned. " + message); } - return DataCloneError; -}(DOMException)); +} exports.DataCloneError = DataCloneError; -var NotImplementedError = /** @class */ (function (_super) { - __extends(NotImplementedError, _super); +class NotImplementedError extends DOMException { /** * @param message - error message */ - function NotImplementedError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NotImplementedError", "The DOM method is not implemented by this module. " + message) || this; + constructor(message = "") { + super("NotImplementedError", "The DOM method is not implemented by this module. " + message); } - return NotImplementedError; -}(DOMException)); +} exports.NotImplementedError = NotImplementedError; -var HierarchyRequestError = /** @class */ (function (_super) { - __extends(HierarchyRequestError, _super); +class HierarchyRequestError extends DOMException { /** * @param message - error message */ - function HierarchyRequestError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "HierarchyRequestError", "The operation would yield an incorrect node tree. " + message) || this; + constructor(message = "") { + super("HierarchyRequestError", "The operation would yield an incorrect node tree. " + message); } - return HierarchyRequestError; -}(DOMException)); +} exports.HierarchyRequestError = HierarchyRequestError; -var NotFoundError = /** @class */ (function (_super) { - __extends(NotFoundError, _super); +class NotFoundError extends DOMException { /** * @param message - error message */ - function NotFoundError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "NotFoundError", "The object can not be found here. " + message) || this; + constructor(message = "") { + super("NotFoundError", "The object can not be found here. " + message); } - return NotFoundError; -}(DOMException)); +} exports.NotFoundError = NotFoundError; -var IndexSizeError = /** @class */ (function (_super) { - __extends(IndexSizeError, _super); +class IndexSizeError extends DOMException { /** * @param message - error message */ - function IndexSizeError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "IndexSizeError", "The index is not in the allowed range. " + message) || this; + constructor(message = "") { + super("IndexSizeError", "The index is not in the allowed range. " + message); } - return IndexSizeError; -}(DOMException)); +} exports.IndexSizeError = IndexSizeError; -var SyntaxError = /** @class */ (function (_super) { - __extends(SyntaxError, _super); +class SyntaxError extends DOMException { /** * @param message - error message */ - function SyntaxError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "SyntaxError", "The string did not match the expected pattern. " + message) || this; + constructor(message = "") { + super("SyntaxError", "The string did not match the expected pattern. " + message); } - return SyntaxError; -}(DOMException)); +} exports.SyntaxError = SyntaxError; -var InvalidCharacterError = /** @class */ (function (_super) { - __extends(InvalidCharacterError, _super); +class InvalidCharacterError extends DOMException { /** * @param message - error message */ - function InvalidCharacterError(message) { - if (message === void 0) { message = ""; } - return _super.call(this, "InvalidCharacterError", "The string contains invalid characters. " + message) || this; + constructor(message = "") { + super("InvalidCharacterError", "The string contains invalid characters. " + message); } - return InvalidCharacterError; -}(DOMException)); +} exports.InvalidCharacterError = InvalidCharacterError; //# sourceMappingURL=DOMException.js.map @@ -24947,23 +23818,27 @@ exports.InvalidCharacterError = InvalidCharacterError; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); -var CreateAlgorithm_1 = __nccwpck_require__(57339); +exports.dom = void 0; +const util_1 = __nccwpck_require__(76195); +const CreateAlgorithm_1 = __nccwpck_require__(57339); /** * Represents an object implementing DOM algorithms. */ -var DOMImpl = /** @class */ (function () { +class DOMImpl { + static _instance; + _features = { + mutationObservers: true, + customElements: true, + slots: true, + steps: true + }; + _window = null; + _compareCache; + _rangeList; /** * Initializes a new instance of `DOM`. */ - function DOMImpl() { - this._features = { - mutationObservers: true, - customElements: true, - slots: true, - steps: true - }; - this._window = null; + constructor() { this._compareCache = new util_1.CompareCache(); this._rangeList = new util_1.FixedSizeSet(); } @@ -24973,73 +23848,52 @@ var DOMImpl = /** @class */ (function () { * @param features - DOM features supported by algorithms. All features are * enabled by default unless explicity disabled. */ - DOMImpl.prototype.setFeatures = function (features) { + setFeatures(features) { if (features === undefined) features = true; - if (util_1.isObject(features)) { - for (var key in features) { + if ((0, util_1.isObject)(features)) { + for (const key in features) { this._features[key] = features[key] || false; } } else { // enable/disable all features - for (var key in this._features) { + for (const key in this._features) { this._features[key] = features; } } - }; - Object.defineProperty(DOMImpl.prototype, "features", { - /** - * Gets DOM algorithm features. - */ - get: function () { return this._features; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl.prototype, "window", { - /** - * Gets the DOM window. - */ - get: function () { - if (this._window === null) { - this._window = CreateAlgorithm_1.create_window(); - } - return this._window; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl.prototype, "compareCache", { - /** - * Gets the global node compare cache. - */ - get: function () { return this._compareCache; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl.prototype, "rangeList", { - /** - * Gets the global range list. - */ - get: function () { return this._rangeList; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DOMImpl, "instance", { - /** - * Returns the instance of `DOM`. - */ - get: function () { - if (!DOMImpl._instance) { - DOMImpl._instance = new DOMImpl(); - } - return DOMImpl._instance; - }, - enumerable: true, - configurable: true - }); - return DOMImpl; -}()); + } + /** + * Gets DOM algorithm features. + */ + get features() { return this._features; } + /** + * Gets the DOM window. + */ + get window() { + if (this._window === null) { + this._window = (0, CreateAlgorithm_1.create_window)(); + } + return this._window; + } + /** + * Gets the global node compare cache. + */ + get compareCache() { return this._compareCache; } + /** + * Gets the global range list. + */ + get rangeList() { return this._rangeList; } + /** + * Returns the instance of `DOM`. + */ + static get instance() { + if (!DOMImpl._instance) { + DOMImpl._instance = new DOMImpl(); + } + return DOMImpl._instance; + } +} /** * Represents an object implementing DOM algorithms. */ @@ -25054,50 +23908,52 @@ exports.dom = DOMImpl.instance; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.DOMImplementationImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents an object providing methods which are not dependent on * any particular document. */ -var DOMImplementationImpl = /** @class */ (function () { +class DOMImplementationImpl { + _ID = "@oozcitak/dom"; + _associatedDocument; /** * Initializes a new instance of `DOMImplementation`. * * @param document - the associated document */ - function DOMImplementationImpl(document) { + constructor(document) { this._associatedDocument = document || DOMImpl_1.dom.window.document; } /** @inheritdoc */ - DOMImplementationImpl.prototype.createDocumentType = function (qualifiedName, publicId, systemId) { + createDocumentType(qualifiedName, publicId, systemId) { /** * 1. Validate qualifiedName. * 2. Return a new doctype, with qualifiedName as its name, publicId as its * public ID, and systemId as its system ID, and with its node document set * to the associated document of the context object. */ - algorithm_1.namespace_validate(qualifiedName); - return algorithm_1.create_documentType(this._associatedDocument, qualifiedName, publicId, systemId); - }; + (0, algorithm_1.namespace_validate)(qualifiedName); + return (0, algorithm_1.create_documentType)(this._associatedDocument, qualifiedName, publicId, systemId); + } /** @inheritdoc */ - DOMImplementationImpl.prototype.createDocument = function (namespace, qualifiedName, doctype) { - if (doctype === void 0) { doctype = null; } + createDocument(namespace, qualifiedName, doctype = null) { /** * 1. Let document be a new XMLDocument. */ - var document = algorithm_1.create_xmlDocument(); + const document = (0, algorithm_1.create_xmlDocument)(); /** * 2. Let element be null. * 3. If qualifiedName is not the empty string, then set element to * the result of running the internal createElementNS steps, given document, * namespace, qualifiedName, and an empty dictionary. */ - var element = null; + let element = null; if (qualifiedName) { - element = algorithm_1.document_internalCreateElementNS(document, namespace, qualifiedName); + element = (0, algorithm_1.document_internalCreateElementNS)(document, namespace, qualifiedName); } /** * 4. If doctype is non-null, append doctype to document. @@ -25130,32 +23986,32 @@ var DOMImplementationImpl = /** @class */ (function () { * 8. Return document. */ return document; - }; + } /** @inheritdoc */ - DOMImplementationImpl.prototype.createHTMLDocument = function (title) { + createHTMLDocument(title) { /** * 1. Let doc be a new document that is an HTML document. * 2. Set doc’s content type to "text/html". */ - var doc = algorithm_1.create_document(); + const doc = (0, algorithm_1.create_document)(); doc._type = "html"; doc._contentType = "text/html"; /** * 3. Append a new doctype, with "html" as its name and with its node * document set to doc, to doc. */ - doc.appendChild(algorithm_1.create_documentType(doc, "html", "", "")); + doc.appendChild((0, algorithm_1.create_documentType)(doc, "html", "", "")); /** * 4. Append the result of creating an element given doc, html, and the * HTML namespace, to doc. */ - var htmlElement = algorithm_1.element_createAnElement(doc, "html", infra_1.namespace.HTML); + const htmlElement = (0, algorithm_1.element_createAnElement)(doc, "html", infra_1.namespace.HTML); doc.appendChild(htmlElement); /** * 5. Append the result of creating an element given doc, head, and the * HTML namespace, to the html element created earlier. */ - var headElement = algorithm_1.element_createAnElement(doc, "head", infra_1.namespace.HTML); + const headElement = (0, algorithm_1.element_createAnElement)(doc, "head", infra_1.namespace.HTML); htmlElement.appendChild(headElement); /** * 6. If title is given: @@ -25166,16 +24022,16 @@ var DOMImplementationImpl = /** @class */ (function () { * element created earlier. */ if (title !== undefined) { - var titleElement = algorithm_1.element_createAnElement(doc, "title", infra_1.namespace.HTML); + const titleElement = (0, algorithm_1.element_createAnElement)(doc, "title", infra_1.namespace.HTML); headElement.appendChild(titleElement); - var textElement = algorithm_1.create_text(doc, title); + const textElement = (0, algorithm_1.create_text)(doc, title); titleElement.appendChild(textElement); } /** * 7. Append the result of creating an element given doc, body, and the * HTML namespace, to the html element created earlier. */ - var bodyElement = algorithm_1.element_createAnElement(doc, "body", infra_1.namespace.HTML); + const bodyElement = (0, algorithm_1.element_createAnElement)(doc, "body", infra_1.namespace.HTML); htmlElement.appendChild(bodyElement); /** * 8. doc’s origin is context object’s associated document’s origin. @@ -25185,57 +24041,49 @@ var DOMImplementationImpl = /** @class */ (function () { * 9. Return doc. */ return doc; - }; + } /** @inheritdoc */ - DOMImplementationImpl.prototype.hasFeature = function () { return true; }; + hasFeature() { return true; } /** * Creates a new `DOMImplementation`. * * @param document - owner document */ - DOMImplementationImpl._create = function (document) { + static _create(document) { return new DOMImplementationImpl(document); - }; - return DOMImplementationImpl; -}()); + } +} exports.DOMImplementationImpl = DOMImplementationImpl; -WebIDLAlgorithm_1.idl_defineConst(DOMImplementationImpl.prototype, "_ID", "@oozcitak/dom"); +(0, WebIDLAlgorithm_1.idl_defineConst)(DOMImplementationImpl.prototype, "_ID", "@oozcitak/dom"); //# sourceMappingURL=DOMImplementationImpl.js.map /***/ }), /***/ 65096: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var DOMException_1 = __nccwpck_require__(13166); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); +exports.DOMTokenListImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const DOMException_1 = __nccwpck_require__(13166); +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a token set. */ -var DOMTokenListImpl = /** @class */ (function () { +class DOMTokenListImpl { + _element; + _attribute; + _tokenSet; /** * Initializes a new instance of `DOMTokenList`. * * @param element - associated element * @param attribute - associated attribute */ - function DOMTokenListImpl(element, attribute) { + constructor(element, attribute) { /** * 1. Let element be associated element. * 2. Let localName be associated attribute’s local name. @@ -25247,10 +24095,10 @@ var DOMTokenListImpl = /** @class */ (function () { this._element = element; this._attribute = attribute; this._tokenSet = new Set(); - var localName = attribute._localName; - var value = algorithm_1.element_getAnAttributeValue(element, localName); + const localName = attribute._localName; + const value = (0, algorithm_1.element_getAnAttributeValue)(element, localName); // define a closure to be called when the associated attribute's value changes - var thisObj = this; + const thisObj = this; function updateTokenSet(element, localName, oldValue, value, namespace) { /** * 1. If localName is associated attribute’s local name, namespace is null, @@ -25262,142 +24110,96 @@ var DOMTokenListImpl = /** @class */ (function () { if (!value) thisObj._tokenSet.clear(); else - thisObj._tokenSet = algorithm_1.orderedSet_parse(value); + thisObj._tokenSet = (0, algorithm_1.orderedSet_parse)(value); } } // add the closure to the associated element's attribute change steps this._element._attributeChangeSteps.push(updateTokenSet); if (DOMImpl_1.dom.features.steps) { - algorithm_1.dom_runAttributeChangeSteps(element, localName, value, value, null); + (0, algorithm_1.dom_runAttributeChangeSteps)(element, localName, value, value, null); } } - Object.defineProperty(DOMTokenListImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { - /** - * The length attribute' getter must return context object’s token set’s - * size. - */ - return this._tokenSet.size; - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - DOMTokenListImpl.prototype.item = function (index) { - var e_1, _a; + get length() { + /** + * The length attribute' getter must return context object’s token set’s + * size. + */ + return this._tokenSet.size; + } + /** @inheritdoc */ + item(index) { /** * 1. If index is equal to or greater than context object’s token set’s * size, then return null. * 2. Return context object’s token set[index]. */ - var i = 0; - try { - for (var _b = __values(this._tokenSet), _c = _b.next(); !_c.done; _c = _b.next()) { - var token = _c.value; - if (i === index) - return token; - i++; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + let i = 0; + for (const token of this._tokenSet) { + if (i === index) + return token; + i++; } return null; - }; + } /** @inheritdoc */ - DOMTokenListImpl.prototype.contains = function (token) { + contains(token) { /** * The contains(token) method, when invoked, must return true if context * object’s token set[token] exists, and false otherwise. */ return this._tokenSet.has(token); - }; + } /** @inheritdoc */ - DOMTokenListImpl.prototype.add = function () { - var e_2, _a; - var tokens = []; - for (var _i = 0; _i < arguments.length; _i++) { - tokens[_i] = arguments[_i]; - } - try { - /** - * 1. For each token in tokens: - * 1.1. If token is the empty string, then throw a "SyntaxError" - * DOMException. - * 1.2. If token contains any ASCII whitespace, then throw an - * "InvalidCharacterError" DOMException. - * 2. For each token in tokens, append token to context object’s token set. - * 3. Run the update steps. - */ - for (var tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) { - var token = tokens_1_1.value; - if (token === '') { - throw new DOMException_1.SyntaxError("Cannot add an empty token."); - } - else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { - throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); - } - else { - this._tokenSet.add(token); - } + add(...tokens) { + /** + * 1. For each token in tokens: + * 1.1. If token is the empty string, then throw a "SyntaxError" + * DOMException. + * 1.2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. + * 2. For each token in tokens, append token to context object’s token set. + * 3. Run the update steps. + */ + for (const token of tokens) { + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot add an empty token."); } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1); + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + else { + this._tokenSet.add(token); } - finally { if (e_2) throw e_2.error; } } - algorithm_1.tokenList_updateSteps(this); - }; + (0, algorithm_1.tokenList_updateSteps)(this); + } /** @inheritdoc */ - DOMTokenListImpl.prototype.remove = function () { - var e_3, _a; - var tokens = []; - for (var _i = 0; _i < arguments.length; _i++) { - tokens[_i] = arguments[_i]; - } - try { - /** - * 1. For each token in tokens: - * 1.1. If token is the empty string, then throw a "SyntaxError" - * DOMException. - * 1.2. If token contains any ASCII whitespace, then throw an - * "InvalidCharacterError" DOMException. - * 2. For each token in tokens, remove token from context object’s token set. - * 3. Run the update steps. - */ - for (var tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) { - var token = tokens_2_1.value; - if (token === '') { - throw new DOMException_1.SyntaxError("Cannot remove an empty token."); - } - else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { - throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); - } - else { - this._tokenSet.delete(token); - } + remove(...tokens) { + /** + * 1. For each token in tokens: + * 1.1. If token is the empty string, then throw a "SyntaxError" + * DOMException. + * 1.2. If token contains any ASCII whitespace, then throw an + * "InvalidCharacterError" DOMException. + * 2. For each token in tokens, remove token from context object’s token set. + * 3. Run the update steps. + */ + for (const token of tokens) { + if (token === '') { + throw new DOMException_1.SyntaxError("Cannot remove an empty token."); } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2); + else if (infra_1.codePoint.ASCIIWhiteSpace.test(token)) { + throw new DOMException_1.InvalidCharacterError("Token cannot contain whitespace."); + } + else { + this._tokenSet.delete(token); } - finally { if (e_3) throw e_3.error; } } - algorithm_1.tokenList_updateSteps(this); - }; + (0, algorithm_1.tokenList_updateSteps)(this); + } /** @inheritdoc */ - DOMTokenListImpl.prototype.toggle = function (token, force) { - if (force === void 0) { force = undefined; } + toggle(token, force = undefined) { /** * 1. If token is the empty string, then throw a "SyntaxError" DOMException. * 2. If token contains any ASCII whitespace, then throw an @@ -25420,7 +24222,7 @@ var DOMTokenListImpl = /** @class */ (function () { */ if (force === undefined || force === false) { this._tokenSet.delete(token); - algorithm_1.tokenList_updateSteps(this); + (0, algorithm_1.tokenList_updateSteps)(this); return false; } return true; @@ -25431,16 +24233,16 @@ var DOMTokenListImpl = /** @class */ (function () { */ if (force === undefined || force === true) { this._tokenSet.add(token); - algorithm_1.tokenList_updateSteps(this); + (0, algorithm_1.tokenList_updateSteps)(this); return true; } /** * 5. Return false. */ return false; - }; + } /** @inheritdoc */ - DOMTokenListImpl.prototype.replace = function (token, newToken) { + replace(token, newToken) { /** * 1. If either token or newToken is the empty string, then throw a * "SyntaxError" DOMException. @@ -25465,424 +24267,278 @@ var DOMTokenListImpl = /** @class */ (function () { * 6. Return true. */ infra_1.set.replace(this._tokenSet, token, newToken); - algorithm_1.tokenList_updateSteps(this); + (0, algorithm_1.tokenList_updateSteps)(this); return true; - }; + } /** @inheritdoc */ - DOMTokenListImpl.prototype.supports = function (token) { + supports(token) { /** * 1. Let result be the return value of validation steps called with token. * 2. Return result. */ - return algorithm_1.tokenList_validationSteps(this, token); - }; - Object.defineProperty(DOMTokenListImpl.prototype, "value", { - /** @inheritdoc */ - get: function () { - /** - * The value attribute must return the result of running context object’s - * serialize steps. - */ - return algorithm_1.tokenList_serializeSteps(this); - }, - set: function (value) { - /** - * Setting the value attribute must set an attribute value for the - * associated element using associated attribute’s local name and the given - * value. - */ - algorithm_1.element_setAnAttributeValue(this._element, this._attribute._localName, value); - }, - enumerable: true, - configurable: true - }); + return (0, algorithm_1.tokenList_validationSteps)(this, token); + } + /** @inheritdoc */ + get value() { + /** + * The value attribute must return the result of running context object’s + * serialize steps. + */ + return (0, algorithm_1.tokenList_serializeSteps)(this); + } + set value(value) { + /** + * Setting the value attribute must set an attribute value for the + * associated element using associated attribute’s local name and the given + * value. + */ + (0, algorithm_1.element_setAnAttributeValue)(this._element, this._attribute._localName, value); + } /** * Returns an iterator for the token set. */ - DOMTokenListImpl.prototype[Symbol.iterator] = function () { - var it = this._tokenSet[Symbol.iterator](); + [Symbol.iterator]() { + const it = this._tokenSet[Symbol.iterator](); return { - next: function () { + next() { return it.next(); } }; - }; + } /** * Creates a new `DOMTokenList`. * * @param element - associated element * @param attribute - associated attribute */ - DOMTokenListImpl._create = function (element, attribute) { + static _create(element, attribute) { return new DOMTokenListImpl(element, attribute); - }; - return DOMTokenListImpl; -}()); + } +} exports.DOMTokenListImpl = DOMTokenListImpl; //# sourceMappingURL=DOMTokenListImpl.js.map /***/ }), /***/ 12585: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var NodeImpl_1 = __nccwpck_require__(91745); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.DocumentFragmentImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const NodeImpl_1 = __nccwpck_require__(91745); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a document fragment in the XML tree. */ -var DocumentFragmentImpl = /** @class */ (function (_super) { - __extends(DocumentFragmentImpl, _super); +class DocumentFragmentImpl extends NodeImpl_1.NodeImpl { + _nodeType = interfaces_1.NodeType.DocumentFragment; + _children = new Set(); + _host; /** * Initializes a new instance of `DocumentFragment`. * * @param host - shadow root's host element */ - function DocumentFragmentImpl(host) { - if (host === void 0) { host = null; } - var _this = _super.call(this) || this; - _this._children = new Set(); - _this._host = host; - return _this; + constructor(host = null) { + super(); + this._host = host; } // MIXIN: NonElementParentNode /* istanbul ignore next */ - DocumentFragmentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; - Object.defineProperty(DocumentFragmentImpl.prototype, "children", { - // MIXIN: ParentNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentFragmentImpl.prototype, "firstElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentFragmentImpl.prototype, "lastElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentFragmentImpl.prototype, "childElementCount", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); + getElementById(elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); } + // MIXIN: ParentNode /* istanbul ignore next */ - DocumentFragmentImpl.prototype.prepend = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); - }; + get children() { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - DocumentFragmentImpl.prototype.append = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); - }; + get firstElementChild() { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - DocumentFragmentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + get lastElementChild() { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - DocumentFragmentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + get childElementCount() { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + prepend(...nodes) { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + append(...nodes) { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + querySelector(selectors) { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + querySelectorAll(selectors) { throw new Error("Mixin: ParentNode not implemented."); } /** * Creates a new `DocumentFragment`. * * @param document - owner document * @param host - shadow root's host element */ - DocumentFragmentImpl._create = function (document, host) { - if (host === void 0) { host = null; } - var node = new DocumentFragmentImpl(host); + static _create(document, host = null) { + const node = new DocumentFragmentImpl(host); node._nodeDocument = document; return node; - }; - return DocumentFragmentImpl; -}(NodeImpl_1.NodeImpl)); + } +} exports.DocumentFragmentImpl = DocumentFragmentImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(DocumentFragmentImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentFragment); +(0, WebIDLAlgorithm_1.idl_defineConst)(DocumentFragmentImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentFragment); //# sourceMappingURL=DocumentFragmentImpl.js.map /***/ }), /***/ 14333: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var interfaces_1 = __nccwpck_require__(27305); -var DOMException_1 = __nccwpck_require__(13166); -var NodeImpl_1 = __nccwpck_require__(91745); -var util_1 = __nccwpck_require__(65282); -var util_2 = __nccwpck_require__(76195); -var infra_1 = __nccwpck_require__(84251); -var URLAlgorithm_1 = __nccwpck_require__(53568); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.DocumentImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const interfaces_1 = __nccwpck_require__(27305); +const DOMException_1 = __nccwpck_require__(13166); +const NodeImpl_1 = __nccwpck_require__(91745); +const util_1 = __nccwpck_require__(65282); +const util_2 = __nccwpck_require__(76195); +const infra_1 = __nccwpck_require__(84251); +const URLAlgorithm_1 = __nccwpck_require__(53568); +const algorithm_1 = __nccwpck_require__(61); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a document node. */ -var DocumentImpl = /** @class */ (function (_super) { - __extends(DocumentImpl, _super); +class DocumentImpl extends NodeImpl_1.NodeImpl { + _nodeType = interfaces_1.NodeType.Document; + _children = new Set(); + _encoding = { + name: "UTF-8", + labels: ["unicode-1-1-utf-8", "utf-8", "utf8"] + }; + _contentType = 'application/xml'; + _URL = { + scheme: "about", + username: "", + password: "", + host: null, + port: null, + path: ["blank"], + query: null, + fragment: null, + _cannotBeABaseURLFlag: true, + _blobURLEntry: null + }; + _origin = null; + _type = "xml"; + _mode = "no-quirks"; + _implementation; + _documentElement = null; + _hasNamespaces = false; + _nodeDocumentOverwrite = null; + get _nodeDocument() { return this._nodeDocumentOverwrite || this; } + set _nodeDocument(val) { this._nodeDocumentOverwrite = val; } /** * Initializes a new instance of `Document`. */ - function DocumentImpl() { - var _this = _super.call(this) || this; - _this._children = new Set(); - _this._encoding = { - name: "UTF-8", - labels: ["unicode-1-1-utf-8", "utf-8", "utf8"] - }; - _this._contentType = 'application/xml'; - _this._URL = { - scheme: "about", - username: "", - password: "", - host: null, - port: null, - path: ["blank"], - query: null, - fragment: null, - _cannotBeABaseURLFlag: true, - _blobURLEntry: null - }; - _this._origin = null; - _this._type = "xml"; - _this._mode = "no-quirks"; - _this._documentElement = null; - _this._hasNamespaces = false; - _this._nodeDocumentOverwrite = null; - return _this; - } - Object.defineProperty(DocumentImpl.prototype, "_nodeDocument", { - get: function () { return this._nodeDocumentOverwrite || this; }, - set: function (val) { this._nodeDocumentOverwrite = val; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "implementation", { - /** @inheritdoc */ - get: function () { - /** - * The implementation attribute’s getter must return the DOMImplementation - * object that is associated with the document. - */ - return this._implementation || (this._implementation = algorithm_1.create_domImplementation(this)); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "URL", { - /** @inheritdoc */ - get: function () { - /** - * The URL attribute’s getter and documentURI attribute’s getter must return - * the URL, serialized. - * See: https://url.spec.whatwg.org/#concept-url-serializer - */ - return URLAlgorithm_1.urlSerializer(this._URL); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "documentURI", { - /** @inheritdoc */ - get: function () { return this.URL; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "origin", { - /** @inheritdoc */ - get: function () { - return "null"; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "compatMode", { - /** @inheritdoc */ - get: function () { - /** - * The compatMode attribute’s getter must return "BackCompat" if context - * object’s mode is "quirks", and "CSS1Compat" otherwise. - */ - return this._mode === "quirks" ? "BackCompat" : "CSS1Compat"; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "characterSet", { - /** @inheritdoc */ - get: function () { - /** - * The characterSet attribute’s getter, charset attribute’s getter, and - * inputEncoding attribute’s getter, must return context object’s - * encoding’s name. - */ - return this._encoding.name; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "charset", { - /** @inheritdoc */ - get: function () { return this._encoding.name; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "inputEncoding", { - /** @inheritdoc */ - get: function () { return this._encoding.name; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "contentType", { - /** @inheritdoc */ - get: function () { - /** - * The contentType attribute’s getter must return the content type. - */ - return this._contentType; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "doctype", { - /** @inheritdoc */ - get: function () { - var e_1, _a; - try { - /** - * The doctype attribute’s getter must return the child of the document - * that is a doctype, and null otherwise. - */ - for (var _b = __values(this._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var child = _c.value; - if (util_1.Guard.isDocumentTypeNode(child)) - return child; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return null; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "documentElement", { - /** @inheritdoc */ - get: function () { - /** - * The documentElement attribute’s getter must return the document element. - */ - return this._documentElement; - }, - enumerable: true, - configurable: true - }); + constructor() { + super(); + } + /** @inheritdoc */ + get implementation() { + /** + * The implementation attribute’s getter must return the DOMImplementation + * object that is associated with the document. + */ + return this._implementation || (this._implementation = (0, algorithm_1.create_domImplementation)(this)); + } /** @inheritdoc */ - DocumentImpl.prototype.getElementsByTagName = function (qualifiedName) { + get URL() { + /** + * The URL attribute’s getter and documentURI attribute’s getter must return + * the URL, serialized. + * See: https://url.spec.whatwg.org/#concept-url-serializer + */ + return (0, URLAlgorithm_1.urlSerializer)(this._URL); + } + /** @inheritdoc */ + get documentURI() { return this.URL; } + /** @inheritdoc */ + get origin() { + return "null"; + } + /** @inheritdoc */ + get compatMode() { + /** + * The compatMode attribute’s getter must return "BackCompat" if context + * object’s mode is "quirks", and "CSS1Compat" otherwise. + */ + return this._mode === "quirks" ? "BackCompat" : "CSS1Compat"; + } + /** @inheritdoc */ + get characterSet() { + /** + * The characterSet attribute’s getter, charset attribute’s getter, and + * inputEncoding attribute’s getter, must return context object’s + * encoding’s name. + */ + return this._encoding.name; + } + /** @inheritdoc */ + get charset() { return this._encoding.name; } + /** @inheritdoc */ + get inputEncoding() { return this._encoding.name; } + /** @inheritdoc */ + get contentType() { + /** + * The contentType attribute’s getter must return the content type. + */ + return this._contentType; + } + /** @inheritdoc */ + get doctype() { + /** + * The doctype attribute’s getter must return the child of the document + * that is a doctype, and null otherwise. + */ + for (const child of this._children) { + if (util_1.Guard.isDocumentTypeNode(child)) + return child; + } + return null; + } + /** @inheritdoc */ + get documentElement() { + /** + * The documentElement attribute’s getter must return the document element. + */ + return this._documentElement; + } + /** @inheritdoc */ + getElementsByTagName(qualifiedName) { /** * The getElementsByTagName(qualifiedName) method, when invoked, must return * the list of elements with qualified name qualifiedName for the context object. */ - return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); - }; + return (0, algorithm_1.node_listOfElementsWithQualifiedName)(qualifiedName, this); + } /** @inheritdoc */ - DocumentImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { + getElementsByTagNameNS(namespace, localName) { /** * The getElementsByTagNameNS(namespace, localName) method, when invoked, * must return the list of elements with namespace namespace and local name * localName for the context object. */ - return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); - }; + return (0, algorithm_1.node_listOfElementsWithNamespace)(namespace, localName, this); + } /** @inheritdoc */ - DocumentImpl.prototype.getElementsByClassName = function (classNames) { + getElementsByClassName(classNames) { /** * The getElementsByClassName(classNames) method, when invoked, must return * the list of elements with class names classNames for the context object. */ - return algorithm_1.node_listOfElementsWithClassNames(classNames, this); - }; + return (0, algorithm_1.node_listOfElementsWithClassNames)(classNames, this); + } /** @inheritdoc */ - DocumentImpl.prototype.createElement = function (localName, options) { + createElement(localName, options) { /** * 1. If localName does not match the Name production, then throw an * "InvalidCharacterError" DOMException. @@ -25898,50 +24554,50 @@ var DocumentImpl = /** @class */ (function (_super) { * localName, namespace, null, is, and with the synchronous custom elements * flag set. */ - if (!algorithm_1.xml_isName(localName)) + if (!(0, algorithm_1.xml_isName)(localName)) throw new DOMException_1.InvalidCharacterError(); if (this._type === "html") localName = localName.toLowerCase(); - var is = null; + let is = null; if (options !== undefined) { - if (util_2.isString(options)) { + if ((0, util_2.isString)(options)) { is = options; } else { is = options.is; } } - var namespace = (this._type === "html" || this._contentType === "application/xhtml+xml") ? + const namespace = (this._type === "html" || this._contentType === "application/xhtml+xml") ? infra_1.namespace.HTML : null; - return algorithm_1.element_createAnElement(this, localName, namespace, null, is, true); - }; + return (0, algorithm_1.element_createAnElement)(this, localName, namespace, null, is, true); + } /** @inheritdoc */ - DocumentImpl.prototype.createElementNS = function (namespace, qualifiedName, options) { + createElementNS(namespace, qualifiedName, options) { /** * The createElementNS(namespace, qualifiedName, options) method, when * invoked, must return the result of running the internal createElementNS * steps, given context object, namespace, qualifiedName, and options. */ - return algorithm_1.document_internalCreateElementNS(this, namespace, qualifiedName, options); - }; + return (0, algorithm_1.document_internalCreateElementNS)(this, namespace, qualifiedName, options); + } /** @inheritdoc */ - DocumentImpl.prototype.createDocumentFragment = function () { + createDocumentFragment() { /** * The createDocumentFragment() method, when invoked, must return a new * DocumentFragment node with its node document set to the context object. */ - return algorithm_1.create_documentFragment(this); - }; + return (0, algorithm_1.create_documentFragment)(this); + } /** @inheritdoc */ - DocumentImpl.prototype.createTextNode = function (data) { + createTextNode(data) { /** * The createTextNode(data) method, when invoked, must return a new Text * node with its data set to data and node document set to the context object. */ - return algorithm_1.create_text(this, data); - }; + return (0, algorithm_1.create_text)(this, data); + } /** @inheritdoc */ - DocumentImpl.prototype.createCDATASection = function (data) { + createCDATASection(data) { /** * 1. If context object is an HTML document, then throw a * "NotSupportedError" DOMException. @@ -25954,18 +24610,18 @@ var DocumentImpl = /** @class */ (function (_super) { throw new DOMException_1.NotSupportedError(); if (data.indexOf(']]>') !== -1) throw new DOMException_1.InvalidCharacterError(); - return algorithm_1.create_cdataSection(this, data); - }; + return (0, algorithm_1.create_cdataSection)(this, data); + } /** @inheritdoc */ - DocumentImpl.prototype.createComment = function (data) { + createComment(data) { /** * The createComment(data) method, when invoked, must return a new Comment * node with its data set to data and node document set to the context object. */ - return algorithm_1.create_comment(this, data); - }; + return (0, algorithm_1.create_comment)(this, data); + } /** @inheritdoc */ - DocumentImpl.prototype.createProcessingInstruction = function (target, data) { + createProcessingInstruction(target, data) { /** * 1. If target does not match the Name production, then throw an * "InvalidCharacterError" DOMException. @@ -25974,15 +24630,14 @@ var DocumentImpl = /** @class */ (function (_super) { * 3. Return a new ProcessingInstruction node, with target set to target, * data set to data, and node document set to the context object. */ - if (!algorithm_1.xml_isName(target)) + if (!(0, algorithm_1.xml_isName)(target)) throw new DOMException_1.InvalidCharacterError(); if (data.indexOf("?>") !== -1) throw new DOMException_1.InvalidCharacterError(); - return algorithm_1.create_processingInstruction(this, target, data); - }; + return (0, algorithm_1.create_processingInstruction)(this, target, data); + } /** @inheritdoc */ - DocumentImpl.prototype.importNode = function (node, deep) { - if (deep === void 0) { deep = false; } + importNode(node, deep = false) { /** * 1. If node is a document or shadow root, then throw a "NotSupportedError" DOMException. */ @@ -25991,10 +24646,10 @@ var DocumentImpl = /** @class */ (function (_super) { /** * 2. Return a clone of node, with context object and the clone children flag set if deep is true. */ - return algorithm_1.node_clone(node, this, deep); - }; + return (0, algorithm_1.node_clone)(node, this, deep); + } /** @inheritdoc */ - DocumentImpl.prototype.adoptNode = function (node) { + adoptNode(node) { /** * 1. If node is a document, then throw a "NotSupportedError" DOMException. */ @@ -26009,11 +24664,11 @@ var DocumentImpl = /** @class */ (function (_super) { * 3. Adopt node into the context object. * 4. Return node. */ - algorithm_1.document_adopt(node, this); + (0, algorithm_1.document_adopt)(node, this); return node; - }; + } /** @inheritdoc */ - DocumentImpl.prototype.createAttribute = function (localName) { + createAttribute(localName) { /** * 1. If localName does not match the Name production in XML, then throw * an "InvalidCharacterError" DOMException. @@ -26022,47 +24677,45 @@ var DocumentImpl = /** @class */ (function (_super) { * 3. Return a new attribute whose local name is localName and node document * is context object. */ - if (!algorithm_1.xml_isName(localName)) + if (!(0, algorithm_1.xml_isName)(localName)) throw new DOMException_1.InvalidCharacterError(); if (this._type === "html") { localName = localName.toLowerCase(); } - var attr = algorithm_1.create_attr(this, localName); + const attr = (0, algorithm_1.create_attr)(this, localName); return attr; - }; + } /** @inheritdoc */ - DocumentImpl.prototype.createAttributeNS = function (namespace, qualifiedName) { + createAttributeNS(namespace, qualifiedName) { /** * 1. Let namespace, prefix, and localName be the result of passing * namespace and qualifiedName to validate and extract. * 2. Return a new attribute whose namespace is namespace, namespace prefix * is prefix, local name is localName, and node document is context object. */ - var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; - var attr = algorithm_1.create_attr(this, localName); + const [ns, prefix, localName] = (0, algorithm_1.namespace_validateAndExtract)(namespace, qualifiedName); + const attr = (0, algorithm_1.create_attr)(this, localName); attr._namespace = ns; attr._namespacePrefix = prefix; return attr; - }; + } /** @inheritdoc */ - DocumentImpl.prototype.createEvent = function (eventInterface) { - return algorithm_1.event_createLegacyEvent(eventInterface); - }; + createEvent(eventInterface) { + return (0, algorithm_1.event_createLegacyEvent)(eventInterface); + } /** @inheritdoc */ - DocumentImpl.prototype.createRange = function () { + createRange() { /** * The createRange() method, when invoked, must return a new live range * with (context object, 0) as its start and end. */ - var range = algorithm_1.create_range(); + const range = (0, algorithm_1.create_range)(); range._start = [this, 0]; range._end = [this, 0]; return range; - }; + } /** @inheritdoc */ - DocumentImpl.prototype.createNodeIterator = function (root, whatToShow, filter) { - if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } - if (filter === void 0) { filter = null; } + createNodeIterator(root, whatToShow = interfaces_1.WhatToShow.All, filter = null) { /** * 1. Let iterator be a new NodeIterator object. * 2. Set iterator’s root and iterator’s reference to root. @@ -26071,22 +24724,20 @@ var DocumentImpl = /** @class */ (function (_super) { * 5. Set iterator’s filter to filter. * 6. Return iterator. */ - var iterator = algorithm_1.create_nodeIterator(root, root, true); + const iterator = (0, algorithm_1.create_nodeIterator)(root, root, true); iterator._whatToShow = whatToShow; - iterator._iteratorCollection = algorithm_1.create_nodeList(root); - if (util_2.isFunction(filter)) { - iterator._filter = algorithm_1.create_nodeFilter(); + iterator._iteratorCollection = (0, algorithm_1.create_nodeList)(root); + if ((0, util_2.isFunction)(filter)) { + iterator._filter = (0, algorithm_1.create_nodeFilter)(); iterator._filter.acceptNode = filter; } else { iterator._filter = filter; } return iterator; - }; + } /** @inheritdoc */ - DocumentImpl.prototype.createTreeWalker = function (root, whatToShow, filter) { - if (whatToShow === void 0) { whatToShow = interfaces_1.WhatToShow.All; } - if (filter === void 0) { filter = null; } + createTreeWalker(root, whatToShow = interfaces_1.WhatToShow.All, filter = null) { /** * 1. Let walker be a new TreeWalker object. * 2. Set walker’s root and walker’s current to root. @@ -26094,23 +24745,23 @@ var DocumentImpl = /** @class */ (function (_super) { * 4. Set walker’s filter to filter. * 5. Return walker. */ - var walker = algorithm_1.create_treeWalker(root, root); + const walker = (0, algorithm_1.create_treeWalker)(root, root); walker._whatToShow = whatToShow; - if (util_2.isFunction(filter)) { - walker._filter = algorithm_1.create_nodeFilter(); + if ((0, util_2.isFunction)(filter)) { + walker._filter = (0, algorithm_1.create_nodeFilter)(); walker._filter.acceptNode = filter; } else { walker._filter = filter; } return walker; - }; + } /** * Gets the parent event target for the given event. * * @param event - an event */ - DocumentImpl.prototype._getTheParent = function (event) { + _getTheParent(event) { /** * TODO: Implement realms * A document’s get the parent algorithm, given an event, returns null if @@ -26123,64 +24774,35 @@ var DocumentImpl = /** @class */ (function (_super) { else { return DOMImpl_1.dom.window; } - }; + } // MIXIN: NonElementParentNode /* istanbul ignore next */ - DocumentImpl.prototype.getElementById = function (elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); }; - Object.defineProperty(DocumentImpl.prototype, "children", { - // MIXIN: DocumentOrShadowRoot - // No elements - // MIXIN: ParentNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "firstElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "lastElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentImpl.prototype, "childElementCount", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); + getElementById(elementId) { throw new Error("Mixin: NonElementParentNode not implemented."); } + // MIXIN: DocumentOrShadowRoot + // No elements + // MIXIN: ParentNode /* istanbul ignore next */ - DocumentImpl.prototype.prepend = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); - }; + get children() { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - DocumentImpl.prototype.append = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); - }; + get firstElementChild() { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + get lastElementChild() { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + get childElementCount() { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + prepend(...nodes) { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - DocumentImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + append(...nodes) { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - DocumentImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - return DocumentImpl; -}(NodeImpl_1.NodeImpl)); + querySelector(selectors) { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + querySelectorAll(selectors) { throw new Error("Mixin: ParentNode not implemented."); } +} exports.DocumentImpl = DocumentImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(DocumentImpl.prototype, "_nodeType", interfaces_1.NodeType.Document); +(0, WebIDLAlgorithm_1.idl_defineConst)(DocumentImpl.prototype, "_nodeType", interfaces_1.NodeType.Document); //# sourceMappingURL=DocumentImpl.js.map /***/ }), @@ -26191,6 +24813,7 @@ WebIDLAlgorithm_1.idl_defineConst(DocumentImpl.prototype, "_nodeType", interface "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DocumentOrShadowRootImpl = void 0; /** * Represents a mixin for an interface to be used to share APIs between * documents and shadow roots. This mixin is implemented by @@ -26199,44 +24822,32 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); * _Note:_ The DocumentOrShadowRoot mixin is expected to be used by other * standards that want to define APIs shared between documents and shadow roots. */ -var DocumentOrShadowRootImpl = /** @class */ (function () { - function DocumentOrShadowRootImpl() { - } - return DocumentOrShadowRootImpl; -}()); +class DocumentOrShadowRootImpl { +} exports.DocumentOrShadowRootImpl = DocumentOrShadowRootImpl; //# sourceMappingURL=DocumentOrShadowRootImpl.js.map /***/ }), /***/ 3173: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var NodeImpl_1 = __nccwpck_require__(91745); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.DocumentTypeImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const NodeImpl_1 = __nccwpck_require__(91745); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents an object providing methods which are not dependent on * any particular document */ -var DocumentTypeImpl = /** @class */ (function (_super) { - __extends(DocumentTypeImpl, _super); +class DocumentTypeImpl extends NodeImpl_1.NodeImpl { + _nodeType = interfaces_1.NodeType.DocumentType; + _name = ''; + _publicId = ''; + _systemId = ''; /** * Initializes a new instance of `DocumentType`. * @@ -26244,61 +24855,27 @@ var DocumentTypeImpl = /** @class */ (function (_super) { * @param publicId - `PUBLIC` identifier * @param systemId - `SYSTEM` identifier */ - function DocumentTypeImpl(name, publicId, systemId) { - var _this = _super.call(this) || this; - _this._name = ''; - _this._publicId = ''; - _this._systemId = ''; - _this._name = name; - _this._publicId = publicId; - _this._systemId = systemId; - return _this; - } - Object.defineProperty(DocumentTypeImpl.prototype, "name", { - /** @inheritdoc */ - get: function () { return this._name; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentTypeImpl.prototype, "publicId", { - /** @inheritdoc */ - get: function () { return this._publicId; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DocumentTypeImpl.prototype, "systemId", { - /** @inheritdoc */ - get: function () { return this._systemId; }, - enumerable: true, - configurable: true - }); + constructor(name, publicId, systemId) { + super(); + this._name = name; + this._publicId = publicId; + this._systemId = systemId; + } + /** @inheritdoc */ + get name() { return this._name; } + /** @inheritdoc */ + get publicId() { return this._publicId; } + /** @inheritdoc */ + get systemId() { return this._systemId; } // MIXIN: ChildNode /* istanbul ignore next */ - DocumentTypeImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + before(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - DocumentTypeImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + after(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - DocumentTypeImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + replaceWith(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - DocumentTypeImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; + remove() { throw new Error("Mixin: ChildNode not implemented."); } /** * Creates a new `DocumentType`. * @@ -26307,232 +24884,143 @@ var DocumentTypeImpl = /** @class */ (function (_super) { * @param publicId - `PUBLIC` identifier * @param systemId - `SYSTEM` identifier */ - DocumentTypeImpl._create = function (document, name, publicId, systemId) { - if (publicId === void 0) { publicId = ''; } - if (systemId === void 0) { systemId = ''; } - var node = new DocumentTypeImpl(name, publicId, systemId); + static _create(document, name, publicId = '', systemId = '') { + const node = new DocumentTypeImpl(name, publicId, systemId); node._nodeDocument = document; return node; - }; - return DocumentTypeImpl; -}(NodeImpl_1.NodeImpl)); + } +} exports.DocumentTypeImpl = DocumentTypeImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(DocumentTypeImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentType); +(0, WebIDLAlgorithm_1.idl_defineConst)(DocumentTypeImpl.prototype, "_nodeType", interfaces_1.NodeType.DocumentType); //# sourceMappingURL=DocumentTypeImpl.js.map /***/ }), /***/ 35975: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var NodeImpl_1 = __nccwpck_require__(91745); -var DOMException_1 = __nccwpck_require__(13166); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.ElementImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const NodeImpl_1 = __nccwpck_require__(91745); +const DOMException_1 = __nccwpck_require__(13166); +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents an element node. */ -var ElementImpl = /** @class */ (function (_super) { - __extends(ElementImpl, _super); +class ElementImpl extends NodeImpl_1.NodeImpl { + _nodeType = interfaces_1.NodeType.Element; + _children = new Set(); + _namespace = null; + _namespacePrefix = null; + _localName = ""; + _customElementState = "undefined"; + _customElementDefinition = null; + _is = null; + _shadowRoot = null; + _attributeList = (0, algorithm_1.create_namedNodeMap)(this); + _uniqueIdentifier; + _attributeChangeSteps = []; + _name = ''; + _assignedSlot = null; /** * Initializes a new instance of `Element`. */ - function ElementImpl() { - var _this = _super.call(this) || this; - _this._children = new Set(); - _this._namespace = null; - _this._namespacePrefix = null; - _this._localName = ""; - _this._customElementState = "undefined"; - _this._customElementDefinition = null; - _this._is = null; - _this._shadowRoot = null; - _this._attributeList = algorithm_1.create_namedNodeMap(_this); - _this._attributeChangeSteps = []; - _this._name = ''; - _this._assignedSlot = null; - return _this; - } - Object.defineProperty(ElementImpl.prototype, "namespaceURI", { - /** @inheritdoc */ - get: function () { return this._namespace; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "prefix", { - /** @inheritdoc */ - get: function () { return this._namespacePrefix; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "localName", { - /** @inheritdoc */ - get: function () { return this._localName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "tagName", { - /** @inheritdoc */ - get: function () { return this._htmlUppercasedQualifiedName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "id", { - /** @inheritdoc */ - get: function () { - return algorithm_1.element_getAnAttributeValue(this, "id"); - }, - set: function (value) { - algorithm_1.element_setAnAttributeValue(this, "id", value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "className", { - /** @inheritdoc */ - get: function () { - return algorithm_1.element_getAnAttributeValue(this, "class"); - }, - set: function (value) { - algorithm_1.element_setAnAttributeValue(this, "class", value); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "classList", { - /** @inheritdoc */ - get: function () { - var attr = algorithm_1.element_getAnAttributeByName("class", this); - if (attr === null) { - attr = algorithm_1.create_attr(this._nodeDocument, "class"); - } - return algorithm_1.create_domTokenList(this, attr); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "slot", { - /** @inheritdoc */ - get: function () { - return algorithm_1.element_getAnAttributeValue(this, "slot"); - }, - set: function (value) { - algorithm_1.element_setAnAttributeValue(this, "slot", value); - }, - enumerable: true, - configurable: true - }); + constructor() { + super(); + } + /** @inheritdoc */ + get namespaceURI() { return this._namespace; } + /** @inheritdoc */ + get prefix() { return this._namespacePrefix; } + /** @inheritdoc */ + get localName() { return this._localName; } + /** @inheritdoc */ + get tagName() { return this._htmlUppercasedQualifiedName; } + /** @inheritdoc */ + get id() { + return (0, algorithm_1.element_getAnAttributeValue)(this, "id"); + } + set id(value) { + (0, algorithm_1.element_setAnAttributeValue)(this, "id", value); + } + /** @inheritdoc */ + get className() { + return (0, algorithm_1.element_getAnAttributeValue)(this, "class"); + } + set className(value) { + (0, algorithm_1.element_setAnAttributeValue)(this, "class", value); + } + /** @inheritdoc */ + get classList() { + let attr = (0, algorithm_1.element_getAnAttributeByName)("class", this); + if (attr === null) { + attr = (0, algorithm_1.create_attr)(this._nodeDocument, "class"); + } + return (0, algorithm_1.create_domTokenList)(this, attr); + } /** @inheritdoc */ - ElementImpl.prototype.hasAttributes = function () { + get slot() { + return (0, algorithm_1.element_getAnAttributeValue)(this, "slot"); + } + set slot(value) { + (0, algorithm_1.element_setAnAttributeValue)(this, "slot", value); + } + /** @inheritdoc */ + hasAttributes() { return this._attributeList.length !== 0; - }; - Object.defineProperty(ElementImpl.prototype, "attributes", { - /** @inheritdoc */ - get: function () { return this._attributeList; }, - enumerable: true, - configurable: true - }); + } /** @inheritdoc */ - ElementImpl.prototype.getAttributeNames = function () { - var e_1, _a; + get attributes() { return this._attributeList; } + /** @inheritdoc */ + getAttributeNames() { /** * The getAttributeNames() method, when invoked, must return the qualified * names of the attributes in context object’s attribute list, in order, * and a new list otherwise. */ - var names = []; - try { - for (var _b = __values(this._attributeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - names.push(attr._qualifiedName); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + const names = []; + for (const attr of this._attributeList) { + names.push(attr._qualifiedName); } return names; - }; + } /** @inheritdoc */ - ElementImpl.prototype.getAttribute = function (qualifiedName) { + getAttribute(qualifiedName) { /** * 1. Let attr be the result of getting an attribute given qualifiedName * and the context object. * 2. If attr is null, return null. * 3. Return attr’s value. */ - var attr = algorithm_1.element_getAnAttributeByName(qualifiedName, this); + const attr = (0, algorithm_1.element_getAnAttributeByName)(qualifiedName, this); return (attr ? attr._value : null); - }; + } /** @inheritdoc */ - ElementImpl.prototype.getAttributeNS = function (namespace, localName) { + getAttributeNS(namespace, localName) { /** * 1. Let attr be the result of getting an attribute given namespace, * localName, and the context object. * 2. If attr is null, return null. * 3. Return attr’s value. */ - var attr = algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); + const attr = (0, algorithm_1.element_getAnAttributeByNamespaceAndLocalName)(namespace, localName, this); return (attr ? attr._value : null); - }; + } /** @inheritdoc */ - ElementImpl.prototype.setAttribute = function (qualifiedName, value) { + setAttribute(qualifiedName, value) { /** * 1. If qualifiedName does not match the Name production in XML, then * throw an "InvalidCharacterError" DOMException. */ - if (!algorithm_1.xml_isName(qualifiedName)) + if (!(0, algorithm_1.xml_isName)(qualifiedName)) throw new DOMException_1.InvalidCharacterError(); /** * 2. If the context object is in the HTML namespace and its node document @@ -26546,9 +25034,9 @@ var ElementImpl = /** @class */ (function (_super) { * 3. Let attribute be the first attribute in context object’s attribute * list whose qualified name is qualifiedName, and null otherwise. */ - var attribute = null; - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; + let attribute = null; + for (let i = 0; i < this._attributeList.length; i++) { + const attr = this._attributeList[i]; if (attr._qualifiedName === qualifiedName) { attribute = attr; break; @@ -26561,47 +25049,47 @@ var ElementImpl = /** @class */ (function (_super) { * then return. */ if (attribute === null) { - attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); + attribute = (0, algorithm_1.create_attr)(this._nodeDocument, qualifiedName); attribute._value = value; - algorithm_1.element_append(attribute, this); + (0, algorithm_1.element_append)(attribute, this); return; } /** * 5. Change attribute from context object to value. */ - algorithm_1.element_change(attribute, this, value); - }; + (0, algorithm_1.element_change)(attribute, this, value); + } /** @inheritdoc */ - ElementImpl.prototype.setAttributeNS = function (namespace, qualifiedName, value) { + setAttributeNS(namespace, qualifiedName, value) { /** * 1. Let namespace, prefix, and localName be the result of passing * namespace and qualifiedName to validate and extract. * 2. Set an attribute value for the context object using localName, value, * and also prefix and namespace. */ - var _a = __read(algorithm_1.namespace_validateAndExtract(namespace, qualifiedName), 3), ns = _a[0], prefix = _a[1], localName = _a[2]; - algorithm_1.element_setAnAttributeValue(this, localName, value, prefix, ns); - }; + const [ns, prefix, localName] = (0, algorithm_1.namespace_validateAndExtract)(namespace, qualifiedName); + (0, algorithm_1.element_setAnAttributeValue)(this, localName, value, prefix, ns); + } /** @inheritdoc */ - ElementImpl.prototype.removeAttribute = function (qualifiedName) { + removeAttribute(qualifiedName) { /** * The removeAttribute(qualifiedName) method, when invoked, must remove an * attribute given qualifiedName and the context object, and then return * undefined. */ - algorithm_1.element_removeAnAttributeByName(qualifiedName, this); - }; + (0, algorithm_1.element_removeAnAttributeByName)(qualifiedName, this); + } /** @inheritdoc */ - ElementImpl.prototype.removeAttributeNS = function (namespace, localName) { + removeAttributeNS(namespace, localName) { /** * The removeAttributeNS(namespace, localName) method, when invoked, must * remove an attribute given namespace, localName, and context object, and * then return undefined. */ - algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace, localName, this); - }; + (0, algorithm_1.element_removeAnAttributeByNamespaceAndLocalName)(namespace, localName, this); + } /** @inheritdoc */ - ElementImpl.prototype.hasAttribute = function (qualifiedName) { + hasAttribute(qualifiedName) { /** * 1. If the context object is in the HTML namespace and its node document * is an HTML document, then set qualifiedName to qualifiedName in ASCII @@ -26612,21 +25100,21 @@ var ElementImpl = /** @class */ (function (_super) { if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { qualifiedName = qualifiedName.toLowerCase(); } - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; + for (let i = 0; i < this._attributeList.length; i++) { + const attr = this._attributeList[i]; if (attr._qualifiedName === qualifiedName) { return true; } } return false; - }; + } /** @inheritdoc */ - ElementImpl.prototype.toggleAttribute = function (qualifiedName, force) { + toggleAttribute(qualifiedName, force) { /** * 1. If qualifiedName does not match the Name production in XML, then * throw an "InvalidCharacterError" DOMException. */ - if (!algorithm_1.xml_isName(qualifiedName)) + if (!(0, algorithm_1.xml_isName)(qualifiedName)) throw new DOMException_1.InvalidCharacterError(); /** * 2. If the context object is in the HTML namespace and its node document @@ -26640,9 +25128,9 @@ var ElementImpl = /** @class */ (function (_super) { * 3. Let attribute be the first attribute in the context object’s attribute * list whose qualified name is qualifiedName, and null otherwise. */ - var attribute = null; - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; + let attribute = null; + for (let i = 0; i < this._attributeList.length; i++) { + const attr = this._attributeList[i]; if (attr._qualifiedName === qualifiedName) { attribute = attr; break; @@ -26658,9 +25146,9 @@ var ElementImpl = /** @class */ (function (_super) { * 4.2. Return false. */ if (force === undefined || force === true) { - attribute = algorithm_1.create_attr(this._nodeDocument, qualifiedName); + attribute = (0, algorithm_1.create_attr)(this._nodeDocument, qualifiedName); attribute._value = ''; - algorithm_1.element_append(attribute, this); + (0, algorithm_1.element_append)(attribute, this); return true; } return false; @@ -26670,71 +25158,71 @@ var ElementImpl = /** @class */ (function (_super) { * 5. Otherwise, if force is not given or is false, remove an attribute * given qualifiedName and the context object, and then return false. */ - algorithm_1.element_removeAnAttributeByName(qualifiedName, this); + (0, algorithm_1.element_removeAnAttributeByName)(qualifiedName, this); return false; } /** * 6. Return true. */ return true; - }; + } /** @inheritdoc */ - ElementImpl.prototype.hasAttributeNS = function (namespace, localName) { + hasAttributeNS(namespace, localName) { /** * 1. If namespace is the empty string, set it to null. * 2. Return true if the context object has an attribute whose namespace is * namespace and local name is localName, and false otherwise. */ - var ns = namespace || null; - for (var i = 0; i < this._attributeList.length; i++) { - var attr = this._attributeList[i]; + const ns = namespace || null; + for (let i = 0; i < this._attributeList.length; i++) { + const attr = this._attributeList[i]; if (attr._namespace === ns && attr._localName === localName) { return true; } } return false; - }; + } /** @inheritdoc */ - ElementImpl.prototype.getAttributeNode = function (qualifiedName) { + getAttributeNode(qualifiedName) { /** * The getAttributeNode(qualifiedName) method, when invoked, must return the * result of getting an attribute given qualifiedName and context object. */ - return algorithm_1.element_getAnAttributeByName(qualifiedName, this); - }; + return (0, algorithm_1.element_getAnAttributeByName)(qualifiedName, this); + } /** @inheritdoc */ - ElementImpl.prototype.getAttributeNodeNS = function (namespace, localName) { + getAttributeNodeNS(namespace, localName) { /** * The getAttributeNodeNS(namespace, localName) method, when invoked, must * return the result of getting an attribute given namespace, localName, and * the context object. */ - return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace, localName, this); - }; + return (0, algorithm_1.element_getAnAttributeByNamespaceAndLocalName)(namespace, localName, this); + } /** @inheritdoc */ - ElementImpl.prototype.setAttributeNode = function (attr) { + setAttributeNode(attr) { /** * The setAttributeNode(attr) and setAttributeNodeNS(attr) methods, when * invoked, must return the result of setting an attribute given attr and * the context object. */ - return algorithm_1.element_setAnAttribute(attr, this); - }; + return (0, algorithm_1.element_setAnAttribute)(attr, this); + } /** @inheritdoc */ - ElementImpl.prototype.setAttributeNodeNS = function (attr) { - return algorithm_1.element_setAnAttribute(attr, this); - }; + setAttributeNodeNS(attr) { + return (0, algorithm_1.element_setAnAttribute)(attr, this); + } /** @inheritdoc */ - ElementImpl.prototype.removeAttributeNode = function (attr) { + removeAttributeNode(attr) { /** * 1. If context object’s attribute list does not contain attr, then throw * a "NotFoundError" DOMException. * 2. Remove attr from context object. * 3. Return attr. */ - var found = false; - for (var i = 0; i < this._attributeList.length; i++) { - var attribute = this._attributeList[i]; + let found = false; + for (let i = 0; i < this._attributeList.length; i++) { + const attribute = this._attributeList[i]; if (attribute === attr) { found = true; break; @@ -26742,11 +25230,11 @@ var ElementImpl = /** @class */ (function (_super) { } if (!found) throw new DOMException_1.NotFoundError(); - algorithm_1.element_remove(attr, this); + (0, algorithm_1.element_remove)(attr, this); return attr; - }; + } /** @inheritdoc */ - ElementImpl.prototype.attachShadow = function (init) { + attachShadow(init) { /** * 1. If context object’s namespace is not the HTML namespace, then throw a * "NotSupportedError" DOMException. @@ -26759,8 +25247,8 @@ var ElementImpl = /** @class */ (function (_super) { * "h3", "h4", "h5", "h6", "header", "main" "nav", "p", "section", * or "span", then throw a "NotSupportedError" DOMException. */ - if (!algorithm_1.customElement_isValidCustomElementName(this._localName) && - !algorithm_1.customElement_isValidShadowHostName(this._localName)) + if (!(0, algorithm_1.customElement_isValidCustomElementName)(this._localName) && + !(0, algorithm_1.customElement_isValidShadowHostName)(this._localName)) throw new DOMException_1.NotSupportedError(); /** * 3. If context object’s local name is a valid custom element name, @@ -26771,8 +25259,8 @@ var ElementImpl = /** @class */ (function (_super) { * 3.2. If definition is not null and definition’s disable shadow is true, * then throw a "NotSupportedError" DOMException. */ - if (algorithm_1.customElement_isValidCustomElementName(this._localName) || this._is !== null) { - var definition = algorithm_1.customElement_lookUpACustomElementDefinition(this._nodeDocument, this._namespace, this._localName, this._is); + if ((0, algorithm_1.customElement_isValidCustomElementName)(this._localName) || this._is !== null) { + const definition = (0, algorithm_1.customElement_lookUpACustomElementDefinition)(this._nodeDocument, this._namespace, this._localName, this._is); if (definition !== null && definition.disableShadow === true) { throw new DOMException_1.NotSupportedError(); } @@ -26789,30 +25277,26 @@ var ElementImpl = /** @class */ (function (_super) { * 6. Set context object’s shadow root to shadow. * 7. Return shadow. */ - var shadow = algorithm_1.create_shadowRoot(this._nodeDocument, this); + const shadow = (0, algorithm_1.create_shadowRoot)(this._nodeDocument, this); shadow._mode = init.mode; this._shadowRoot = shadow; return shadow; - }; - Object.defineProperty(ElementImpl.prototype, "shadowRoot", { - /** @inheritdoc */ - get: function () { - /** - * 1. Let shadow be context object’s shadow root. - * 2. If shadow is null or its mode is "closed", then return null. - * 3. Return shadow. - */ - var shadow = this._shadowRoot; - if (shadow === null || shadow.mode === "closed") - return null; - else - return shadow; - }, - enumerable: true, - configurable: true - }); + } + /** @inheritdoc */ + get shadowRoot() { + /** + * 1. Let shadow be context object’s shadow root. + * 2. If shadow is null or its mode is "closed", then return null. + * 3. Return shadow. + */ + const shadow = this._shadowRoot; + if (shadow === null || shadow.mode === "closed") + return null; + else + return shadow; + } /** @inheritdoc */ - ElementImpl.prototype.closest = function (selectors) { + closest(selectors) { /** * TODO: Selectors * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] @@ -26825,9 +25309,9 @@ var ElementImpl = /** @class */ (function (_super) { * 5. Return null. */ throw new DOMException_1.NotImplementedError(); - }; + } /** @inheritdoc */ - ElementImpl.prototype.matches = function (selectors) { + matches(selectors) { /** * TODO: Selectors * 1. Let s be the result of parse a selector from selectors. [SELECTORS4] @@ -26837,186 +25321,120 @@ var ElementImpl = /** @class */ (function (_super) { * and false otherwise. [SELECTORS4] */ throw new DOMException_1.NotImplementedError(); - }; + } /** @inheritdoc */ - ElementImpl.prototype.webkitMatchesSelector = function (selectors) { + webkitMatchesSelector(selectors) { return this.matches(selectors); - }; + } /** @inheritdoc */ - ElementImpl.prototype.getElementsByTagName = function (qualifiedName) { + getElementsByTagName(qualifiedName) { /** * The getElementsByTagName(qualifiedName) method, when invoked, must return * the list of elements with qualified name qualifiedName for context * object. */ - return algorithm_1.node_listOfElementsWithQualifiedName(qualifiedName, this); - }; + return (0, algorithm_1.node_listOfElementsWithQualifiedName)(qualifiedName, this); + } /** @inheritdoc */ - ElementImpl.prototype.getElementsByTagNameNS = function (namespace, localName) { + getElementsByTagNameNS(namespace, localName) { /** * The getElementsByTagNameNS(namespace, localName) method, when invoked, * must return the list of elements with namespace namespace and local name * localName for context object. */ - return algorithm_1.node_listOfElementsWithNamespace(namespace, localName, this); - }; + return (0, algorithm_1.node_listOfElementsWithNamespace)(namespace, localName, this); + } /** @inheritdoc */ - ElementImpl.prototype.getElementsByClassName = function (classNames) { + getElementsByClassName(classNames) { /** * The getElementsByClassName(classNames) method, when invoked, must return * the list of elements with class names classNames for context object. */ - return algorithm_1.node_listOfElementsWithClassNames(classNames, this); - }; + return (0, algorithm_1.node_listOfElementsWithClassNames)(classNames, this); + } /** @inheritdoc */ - ElementImpl.prototype.insertAdjacentElement = function (where, element) { + insertAdjacentElement(where, element) { /** * The insertAdjacentElement(where, element) method, when invoked, must * return the result of running insert adjacent, given context object, * where, and element. */ - return algorithm_1.element_insertAdjacent(this, where, element); - }; + return (0, algorithm_1.element_insertAdjacent)(this, where, element); + } /** @inheritdoc */ - ElementImpl.prototype.insertAdjacentText = function (where, data) { + insertAdjacentText(where, data) { /** * 1. Let text be a new Text node whose data is data and node document is * context object’s node document. * 2. Run insert adjacent, given context object, where, and text. */ - var text = algorithm_1.create_text(this._nodeDocument, data); - algorithm_1.element_insertAdjacent(this, where, text); - }; - Object.defineProperty(ElementImpl.prototype, "_qualifiedName", { + const text = (0, algorithm_1.create_text)(this._nodeDocument, data); + (0, algorithm_1.element_insertAdjacent)(this, where, text); + } + /** + * Returns the qualified name. + */ + get _qualifiedName() { /** - * Returns the qualified name. + * An element’s qualified name is its local name if its namespace prefix is + * null, and its namespace prefix, followed by ":", followed by its + * local name, otherwise. */ - get: function () { - /** - * An element’s qualified name is its local name if its namespace prefix is - * null, and its namespace prefix, followed by ":", followed by its - * local name, otherwise. - */ - return (this._namespacePrefix ? - this._namespacePrefix + ':' + this._localName : - this._localName); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "_htmlUppercasedQualifiedName", { + return (this._namespacePrefix ? + this._namespacePrefix + ':' + this._localName : + this._localName); + } + /** + * Returns the upper-cased qualified name for a html element. + */ + get _htmlUppercasedQualifiedName() { /** - * Returns the upper-cased qualified name for a html element. + * 1. Let qualifiedName be context object’s qualified name. + * 2. If the context object is in the HTML namespace and its node document + * is an HTML document, then set qualifiedName to qualifiedName in ASCII + * uppercase. + * 3. Return qualifiedName. */ - get: function () { - /** - * 1. Let qualifiedName be context object’s qualified name. - * 2. If the context object is in the HTML namespace and its node document - * is an HTML document, then set qualifiedName to qualifiedName in ASCII - * uppercase. - * 3. Return qualifiedName. - */ - var qualifiedName = this._qualifiedName; - if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { - qualifiedName = qualifiedName.toUpperCase(); - } - return qualifiedName; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "children", { - // MIXIN: ParentNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "firstElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "lastElementChild", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "childElementCount", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: ParentNode not implemented."); }, - enumerable: true, - configurable: true - }); - /* istanbul ignore next */ - ElementImpl.prototype.prepend = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; + let qualifiedName = this._qualifiedName; + if (this._namespace === infra_1.namespace.HTML && this._nodeDocument._type === "html") { + qualifiedName = qualifiedName.toUpperCase(); } - throw new Error("Mixin: ParentNode not implemented."); - }; + return qualifiedName; + } + // MIXIN: ParentNode /* istanbul ignore next */ - ElementImpl.prototype.append = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ParentNode not implemented."); - }; + get children() { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - ElementImpl.prototype.querySelector = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; + get firstElementChild() { throw new Error("Mixin: ParentNode not implemented."); } /* istanbul ignore next */ - ElementImpl.prototype.querySelectorAll = function (selectors) { throw new Error("Mixin: ParentNode not implemented."); }; - Object.defineProperty(ElementImpl.prototype, "previousElementSibling", { - // MIXIN: NonDocumentTypeChildNode - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ElementImpl.prototype, "nextElementSibling", { - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); }, - enumerable: true, - configurable: true - }); + get lastElementChild() { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + get childElementCount() { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + prepend(...nodes) { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + append(...nodes) { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + querySelector(selectors) { throw new Error("Mixin: ParentNode not implemented."); } + /* istanbul ignore next */ + querySelectorAll(selectors) { throw new Error("Mixin: ParentNode not implemented."); } + // MIXIN: NonDocumentTypeChildNode + /* istanbul ignore next */ + get previousElementSibling() { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); } + /* istanbul ignore next */ + get nextElementSibling() { throw new Error("Mixin: NonDocumentTypeChildNode not implemented."); } // MIXIN: ChildNode /* istanbul ignore next */ - ElementImpl.prototype.before = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + before(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - ElementImpl.prototype.after = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + after(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - ElementImpl.prototype.replaceWith = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } - throw new Error("Mixin: ChildNode not implemented."); - }; + replaceWith(...nodes) { throw new Error("Mixin: ChildNode not implemented."); } /* istanbul ignore next */ - ElementImpl.prototype.remove = function () { throw new Error("Mixin: ChildNode not implemented."); }; - Object.defineProperty(ElementImpl.prototype, "assignedSlot", { - // MIXIN: Slotable - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: Slotable not implemented."); }, - enumerable: true, - configurable: true - }); + remove() { throw new Error("Mixin: ChildNode not implemented."); } + // MIXIN: Slotable + /* istanbul ignore next */ + get assignedSlot() { throw new Error("Mixin: Slotable not implemented."); } /** * Creates a new `Element`. * @@ -27025,23 +25443,20 @@ var ElementImpl = /** @class */ (function (_super) { * @param namespace - namespace * @param prefix - namespace prefix */ - ElementImpl._create = function (document, localName, namespace, namespacePrefix) { - if (namespace === void 0) { namespace = null; } - if (namespacePrefix === void 0) { namespacePrefix = null; } - var node = new ElementImpl(); + static _create(document, localName, namespace = null, namespacePrefix = null) { + const node = new ElementImpl(); node._localName = localName; node._namespace = namespace; node._namespacePrefix = namespacePrefix; node._nodeDocument = document; return node; - }; - return ElementImpl; -}(NodeImpl_1.NodeImpl)); + } +} exports.ElementImpl = ElementImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(ElementImpl.prototype, "_nodeType", interfaces_1.NodeType.Element); +(0, WebIDLAlgorithm_1.idl_defineConst)(ElementImpl.prototype, "_nodeType", interfaces_1.NodeType.Element); //# sourceMappingURL=ElementImpl.js.map /***/ }), @@ -27052,33 +25467,44 @@ WebIDLAlgorithm_1.idl_defineConst(ElementImpl.prototype, "_nodeType", interfaces "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.EventImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const algorithm_1 = __nccwpck_require__(61); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a DOM event. */ -var EventImpl = /** @class */ (function () { +class EventImpl { + static NONE = 0; + static CAPTURING_PHASE = 1; + static AT_TARGET = 2; + static BUBBLING_PHASE = 3; + NONE = 0; + CAPTURING_PHASE = 1; + AT_TARGET = 2; + BUBBLING_PHASE = 3; + _target = null; + _relatedTarget = null; + _touchTargetList = []; + _path = []; + _currentTarget = null; + _eventPhase = interfaces_1.EventPhase.None; + _stopPropagationFlag = false; + _stopImmediatePropagationFlag = false; + _canceledFlag = false; + _inPassiveListenerFlag = false; + _composedFlag = false; + _initializedFlag = false; + _dispatchFlag = false; + _isTrusted = false; + _type; + _bubbles = false; + _cancelable = false; + _timeStamp; /** * Initializes a new instance of `Event`. */ - function EventImpl(type, eventInit) { - this._target = null; - this._relatedTarget = null; - this._touchTargetList = []; - this._path = []; - this._currentTarget = null; - this._eventPhase = interfaces_1.EventPhase.None; - this._stopPropagationFlag = false; - this._stopImmediatePropagationFlag = false; - this._canceledFlag = false; - this._inPassiveListenerFlag = false; - this._composedFlag = false; - this._initializedFlag = false; - this._dispatchFlag = false; - this._isTrusted = false; - this._bubbles = false; - this._cancelable = false; + constructor(type, eventInit) { /** * When a constructor of the Event interface, or of an interface that * inherits from the Event interface, is invoked, these steps must be run, @@ -27097,32 +25523,16 @@ var EventImpl = /** @class */ (function () { this._initializedFlag = true; this._timeStamp = new Date().getTime(); } - Object.defineProperty(EventImpl.prototype, "type", { - /** @inheritdoc */ - get: function () { return this._type; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "target", { - /** @inheritdoc */ - get: function () { return this._target; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "srcElement", { - /** @inheritdoc */ - get: function () { return this._target; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "currentTarget", { - /** @inheritdoc */ - get: function () { return this._currentTarget; }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - EventImpl.prototype.composedPath = function () { + get type() { return this._type; } + /** @inheritdoc */ + get target() { return this._target; } + /** @inheritdoc */ + get srcElement() { return this._target; } + /** @inheritdoc */ + get currentTarget() { return this._currentTarget; } + /** @inheritdoc */ + composedPath() { /** * 1. Let composedPath be an empty list. * 2. Let path be the context object’s path. @@ -27133,22 +25543,22 @@ var EventImpl = /** @class */ (function () { * 6. Let currentTargetIndex be 0. * 7. Let currentTargetHiddenSubtreeLevel be 0. */ - var composedPath = []; - var path = this._path; + const composedPath = []; + const path = this._path; if (path.length === 0) return composedPath; - var currentTarget = this._currentTarget; + const currentTarget = this._currentTarget; if (currentTarget === null) { throw new Error("Event currentTarget is null."); } composedPath.push(currentTarget); - var currentTargetIndex = 0; - var currentTargetHiddenSubtreeLevel = 0; + let currentTargetIndex = 0; + let currentTargetHiddenSubtreeLevel = 0; /** * 8. Let index be path’s size − 1. * 9. While index is greater than or equal to 0: */ - var index = path.length - 1; + let index = path.length - 1; while (index >= 0) { /** * 9.1. If path[index]'s root-of-closed-tree is true, then increase @@ -27175,8 +25585,8 @@ var EventImpl = /** @class */ (function () { * 10. Let currentHiddenLevel and maxHiddenLevel be * currentTargetHiddenSubtreeLevel. */ - var currentHiddenLevel = currentTargetHiddenSubtreeLevel; - var maxHiddenLevel = currentTargetHiddenSubtreeLevel; + let currentHiddenLevel = currentTargetHiddenSubtreeLevel; + let maxHiddenLevel = currentTargetHiddenSubtreeLevel; /** * 11. Set index to currentTargetIndex − 1. * 12. While index is greater than or equal to 0: @@ -27261,83 +25671,45 @@ var EventImpl = /** @class */ (function () { * 16. Return composedPath. */ return composedPath; - }; - Object.defineProperty(EventImpl.prototype, "eventPhase", { - /** @inheritdoc */ - get: function () { return this._eventPhase; }, - enumerable: true, - configurable: true - }); + } /** @inheritdoc */ - EventImpl.prototype.stopPropagation = function () { this._stopPropagationFlag = true; }; - Object.defineProperty(EventImpl.prototype, "cancelBubble", { - /** @inheritdoc */ - get: function () { return this._stopPropagationFlag; }, - set: function (value) { if (value) - this.stopPropagation(); }, - enumerable: true, - configurable: true - }); + get eventPhase() { return this._eventPhase; } + /** @inheritdoc */ + stopPropagation() { this._stopPropagationFlag = true; } /** @inheritdoc */ - EventImpl.prototype.stopImmediatePropagation = function () { + get cancelBubble() { return this._stopPropagationFlag; } + set cancelBubble(value) { if (value) + this.stopPropagation(); } + /** @inheritdoc */ + stopImmediatePropagation() { this._stopPropagationFlag = true; this._stopImmediatePropagationFlag = true; - }; - Object.defineProperty(EventImpl.prototype, "bubbles", { - /** @inheritdoc */ - get: function () { return this._bubbles; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "cancelable", { - /** @inheritdoc */ - get: function () { return this._cancelable; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "returnValue", { - /** @inheritdoc */ - get: function () { return !this._canceledFlag; }, - set: function (value) { - if (!value) { - algorithm_1.event_setTheCanceledFlag(this); - } - }, - enumerable: true, - configurable: true - }); + } /** @inheritdoc */ - EventImpl.prototype.preventDefault = function () { - algorithm_1.event_setTheCanceledFlag(this); - }; - Object.defineProperty(EventImpl.prototype, "defaultPrevented", { - /** @inheritdoc */ - get: function () { return this._canceledFlag; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "composed", { - /** @inheritdoc */ - get: function () { return this._composedFlag; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "isTrusted", { - /** @inheritdoc */ - get: function () { return this._isTrusted; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventImpl.prototype, "timeStamp", { - /** @inheritdoc */ - get: function () { return this._timeStamp; }, - enumerable: true, - configurable: true - }); + get bubbles() { return this._bubbles; } /** @inheritdoc */ - EventImpl.prototype.initEvent = function (type, bubbles, cancelable) { - if (bubbles === void 0) { bubbles = false; } - if (cancelable === void 0) { cancelable = false; } + get cancelable() { return this._cancelable; } + /** @inheritdoc */ + get returnValue() { return !this._canceledFlag; } + set returnValue(value) { + if (!value) { + (0, algorithm_1.event_setTheCanceledFlag)(this); + } + } + /** @inheritdoc */ + preventDefault() { + (0, algorithm_1.event_setTheCanceledFlag)(this); + } + /** @inheritdoc */ + get defaultPrevented() { return this._canceledFlag; } + /** @inheritdoc */ + get composed() { return this._composedFlag; } + /** @inheritdoc */ + get isTrusted() { return this._isTrusted; } + /** @inheritdoc */ + get timeStamp() { return this._timeStamp; } + /** @inheritdoc */ + initEvent(type, bubbles = false, cancelable = false) { /** * 1. If the context object’s dispatch flag is set, then return. */ @@ -27346,83 +25718,55 @@ var EventImpl = /** @class */ (function () { /** * 2. Initialize the context object with type, bubbles, and cancelable. */ - algorithm_1.event_initialize(this, type, bubbles, cancelable); - }; - EventImpl.NONE = 0; - EventImpl.CAPTURING_PHASE = 1; - EventImpl.AT_TARGET = 2; - EventImpl.BUBBLING_PHASE = 3; - return EventImpl; -}()); + (0, algorithm_1.event_initialize)(this, type, bubbles, cancelable); + } +} exports.EventImpl = EventImpl; /** * Define constants on prototype. */ -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "NONE", 0); -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "CAPTURING_PHASE", 1); -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "AT_TARGET", 2); -WebIDLAlgorithm_1.idl_defineConst(EventImpl.prototype, "BUBBLING_PHASE", 3); +(0, WebIDLAlgorithm_1.idl_defineConst)(EventImpl.prototype, "NONE", 0); +(0, WebIDLAlgorithm_1.idl_defineConst)(EventImpl.prototype, "CAPTURING_PHASE", 1); +(0, WebIDLAlgorithm_1.idl_defineConst)(EventImpl.prototype, "AT_TARGET", 2); +(0, WebIDLAlgorithm_1.idl_defineConst)(EventImpl.prototype, "BUBBLING_PHASE", 3); //# sourceMappingURL=EventImpl.js.map /***/ }), /***/ 69968: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(13166); -var util_1 = __nccwpck_require__(65282); -var algorithm_1 = __nccwpck_require__(61); +exports.EventTargetImpl = void 0; +const DOMException_1 = __nccwpck_require__(13166); +const util_1 = __nccwpck_require__(65282); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a target to which an event can be dispatched. */ -var EventTargetImpl = /** @class */ (function () { +class EventTargetImpl { + __eventListenerList; + get _eventListenerList() { + return this.__eventListenerList || (this.__eventListenerList = []); + } + __eventHandlerMap; + get _eventHandlerMap() { + return this.__eventHandlerMap || (this.__eventHandlerMap = {}); + } /** * Initializes a new instance of `EventTarget`. */ - function EventTargetImpl() { - } - Object.defineProperty(EventTargetImpl.prototype, "_eventListenerList", { - get: function () { - return this.__eventListenerList || (this.__eventListenerList = []); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(EventTargetImpl.prototype, "_eventHandlerMap", { - get: function () { - return this.__eventHandlerMap || (this.__eventHandlerMap = {}); - }, - enumerable: true, - configurable: true - }); + constructor() { } /** @inheritdoc */ - EventTargetImpl.prototype.addEventListener = function (type, callback, options) { - if (options === void 0) { options = { passive: false, once: false, capture: false }; } + addEventListener(type, callback, options = { passive: false, once: false, capture: false }) { /** * 1. Let capture, passive, and once be the result of flattening more options. */ - var _a = __read(algorithm_1.eventTarget_flattenMore(options), 3), capture = _a[0], passive = _a[1], once = _a[2]; + const [capture, passive, once] = (0, algorithm_1.eventTarget_flattenMore)(options); // convert callback function to EventListener, return if null - var listenerCallback; + let listenerCallback; if (!callback) { return; } @@ -27437,7 +25781,7 @@ var EventTargetImpl = /** @class */ (function () { * whose type is type, callback is callback, capture is capture, passive is * passive, and once is once. */ - algorithm_1.eventTarget_addEventListener(this, { + (0, algorithm_1.eventTarget_addEventListener)(this, { type: type, callback: listenerCallback, capture: capture, @@ -27445,9 +25789,9 @@ var EventTargetImpl = /** @class */ (function () { once: once, removed: false }); - }; + } /** @inheritdoc */ - EventTargetImpl.prototype.removeEventListener = function (type, callback, options) { + removeEventListener(type, callback, options = { capture: false }) { /** * TODO: Implement realms * 1. If the context object’s relevant global object is a @@ -27455,11 +25799,10 @@ var EventTargetImpl = /** @class */ (function () { * script resource’s has ever been evaluated flag is set, then throw * a TypeError. [SERVICE-WORKERS] */ - if (options === void 0) { options = { capture: false }; } /** * 2. Let capture be the result of flattening options. */ - var capture = algorithm_1.eventTarget_flatten(options); + const capture = (0, algorithm_1.eventTarget_flatten)(options); if (!callback) return; /** @@ -27467,22 +25810,22 @@ var EventTargetImpl = /** @class */ (function () { * whose type is type, callback is callback, and capture is capture, then * remove an event listener with the context object and that event listener. */ - for (var i = 0; i < this._eventListenerList.length; i++) { - var entry = this._eventListenerList[i]; + for (let i = 0; i < this._eventListenerList.length; i++) { + const entry = this._eventListenerList[i]; if (entry.type !== type || entry.capture !== capture) continue; if (util_1.Guard.isEventListener(callback) && entry.callback === callback) { - algorithm_1.eventTarget_removeEventListener(this, entry, i); + (0, algorithm_1.eventTarget_removeEventListener)(this, entry, i); break; } else if (callback && entry.callback.handleEvent === callback) { - algorithm_1.eventTarget_removeEventListener(this, entry, i); + (0, algorithm_1.eventTarget_removeEventListener)(this, entry, i); break; } } - }; + } /** @inheritdoc */ - EventTargetImpl.prototype.dispatchEvent = function (event) { + dispatchEvent(event) { /** * 1. If event’s dispatch flag is set, or if its initialized flag is not * set, then throw an "InvalidStateError" DOMException. @@ -27493,14 +25836,13 @@ var EventTargetImpl = /** @class */ (function () { throw new DOMException_1.InvalidStateError(); } event._isTrusted = false; - return algorithm_1.event_dispatch(event, this); - }; + return (0, algorithm_1.event_dispatch)(event, this); + } /** @inheritdoc */ - EventTargetImpl.prototype._getTheParent = function (event) { + _getTheParent(event) { return null; - }; - return EventTargetImpl; -}()); + } +} exports.EventTargetImpl = EventTargetImpl; //# sourceMappingURL=EventTargetImpl.js.map @@ -27512,67 +25854,65 @@ exports.EventTargetImpl = EventTargetImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); -var util_1 = __nccwpck_require__(65282); -var util_2 = __nccwpck_require__(76195); +exports.HTMLCollectionImpl = void 0; +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); +const util_1 = __nccwpck_require__(65282); +const util_2 = __nccwpck_require__(76195); /** * Represents a collection of elements. */ -var HTMLCollectionImpl = /** @class */ (function () { +class HTMLCollectionImpl { + _live = true; + _root; + _filter; + static reservedNames = ['_root', '_live', '_filter', 'length', + 'item', 'namedItem', 'get', 'set']; /** * Initializes a new instance of `HTMLCollection`. * * @param root - root node * @param filter - node filter */ - function HTMLCollectionImpl(root, filter) { - this._live = true; + constructor(root, filter) { this._root = root; this._filter = filter; return new Proxy(this, this); } - Object.defineProperty(HTMLCollectionImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { - var _this = this; - /** - * The length attribute’s getter must return the number of nodes - * represented by the collection. - */ - var count = 0; - var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - while (node !== null) { - count++; - node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); - } - return count; - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - HTMLCollectionImpl.prototype.item = function (index) { - var _this = this; + get length() { + /** + * The length attribute’s getter must return the number of nodes + * represented by the collection. + */ + let count = 0; + let node = (0, algorithm_1.tree_getFirstDescendantNode)(this._root, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e)); + while (node !== null) { + count++; + node = (0, algorithm_1.tree_getNextDescendantNode)(this._root, node, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e)); + } + return count; + } + /** @inheritdoc */ + item(index) { /** * The item(index) method, when invoked, must return the indexth element * in the collection. If there is no indexth element in the collection, * then the method must return null. */ - var i = 0; - var node = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + let i = 0; + let node = (0, algorithm_1.tree_getFirstDescendantNode)(this._root, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e)); while (node !== null) { if (i === index) return node; else i++; - node = algorithm_1.tree_getNextDescendantNode(this._root, node, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + node = (0, algorithm_1.tree_getNextDescendantNode)(this._root, node, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e)); } return null; - }; + } /** @inheritdoc */ - HTMLCollectionImpl.prototype.namedItem = function (key) { - var _this = this; + namedItem(key) { /** * 1. If key is the empty string, return null. * 2. Return the first element in the collection for which at least one of @@ -27583,138 +25923,124 @@ var HTMLCollectionImpl = /** @class */ (function () { */ if (key === '') return null; - var ele = algorithm_1.tree_getFirstDescendantNode(this._root, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + let ele = (0, algorithm_1.tree_getFirstDescendantNode)(this._root, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e)); while (ele != null) { if (ele._uniqueIdentifier === key) { return ele; } else if (ele._namespace === infra_1.namespace.HTML) { - for (var i = 0; i < ele._attributeList.length; i++) { - var attr = ele._attributeList[i]; + for (let i = 0; i < ele._attributeList.length; i++) { + const attr = ele._attributeList[i]; if (attr._localName === "name" && attr._namespace === null && attr._namespacePrefix === null && attr._value === key) return ele; } } - ele = algorithm_1.tree_getNextDescendantNode(this._root, ele, false, false, function (e) { return util_1.Guard.isElementNode(e) && _this._filter(e); }); + ele = (0, algorithm_1.tree_getNextDescendantNode)(this._root, ele, false, false, (e) => util_1.Guard.isElementNode(e) && this._filter(e)); } return null; - }; + } /** @inheritdoc */ - HTMLCollectionImpl.prototype[Symbol.iterator] = function () { - var root = this._root; - var filter = this._filter; - var currentNode = algorithm_1.tree_getFirstDescendantNode(root, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); + [Symbol.iterator]() { + const root = this._root; + const filter = this._filter; + let currentNode = (0, algorithm_1.tree_getFirstDescendantNode)(root, false, false, (e) => util_1.Guard.isElementNode(e) && filter(e)); return { - next: function () { + next() { if (currentNode === null) { return { done: true, value: null }; } else { - var result = { done: false, value: currentNode }; - currentNode = algorithm_1.tree_getNextDescendantNode(root, currentNode, false, false, function (e) { return util_1.Guard.isElementNode(e) && filter(e); }); + const result = { done: false, value: currentNode }; + currentNode = (0, algorithm_1.tree_getNextDescendantNode)(root, currentNode, false, false, (e) => util_1.Guard.isElementNode(e) && filter(e)); return result; } } }; - }; + } /** * Implements a proxy get trap to provide array-like access. */ - HTMLCollectionImpl.prototype.get = function (target, key, receiver) { - if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { + get(target, key, receiver) { + if (!(0, util_2.isString)(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { return Reflect.get(target, key, receiver); } - var index = Number(key); + const index = Number(key); if (isNaN(index)) { return target.namedItem(key) || undefined; } else { return target.item(index) || undefined; } - }; + } /** * Implements a proxy set trap to provide array-like access. */ - HTMLCollectionImpl.prototype.set = function (target, key, value, receiver) { - if (!util_2.isString(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { + set(target, key, value, receiver) { + if (!(0, util_2.isString)(key) || HTMLCollectionImpl.reservedNames.indexOf(key) !== -1) { return Reflect.set(target, key, value, receiver); } - var index = Number(key); - var node = isNaN(index) ? + const index = Number(key); + const node = isNaN(index) ? target.namedItem(key) || undefined : target.item(index) || undefined; if (node && node._parent) { - algorithm_1.mutation_replace(node, value, node._parent); + (0, algorithm_1.mutation_replace)(node, value, node._parent); return true; } else { return false; } - }; + } /** * Creates a new `HTMLCollection`. * * @param root - root node * @param filter - node filter */ - HTMLCollectionImpl._create = function (root, filter) { - if (filter === void 0) { filter = (function () { return true; }); } + static _create(root, filter = (() => true)) { return new HTMLCollectionImpl(root, filter); - }; - HTMLCollectionImpl.reservedNames = ['_root', '_live', '_filter', 'length', - 'item', 'namedItem', 'get', 'set']; - return HTMLCollectionImpl; -}()); + } +} exports.HTMLCollectionImpl = HTMLCollectionImpl; //# sourceMappingURL=HTMLCollectionImpl.js.map /***/ }), /***/ 89616: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(65282); -var infra_1 = __nccwpck_require__(84251); +exports.MutationObserverImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(65282); +const infra_1 = __nccwpck_require__(84251); /** * Represents an object that can be used to observe mutations to the tree of * nodes. */ -var MutationObserverImpl = /** @class */ (function () { +class MutationObserverImpl { + _callback; + _nodeList = []; + _recordQueue = []; /** * Initializes a new instance of `MutationObserver`. * * @param callback - the callback function */ - function MutationObserverImpl(callback) { - this._nodeList = []; - this._recordQueue = []; + constructor(callback) { /** * 1. Let mo be a new MutationObserver object whose callback is callback. * 2. Append mo to mo’s relevant agent’s mutation observers. * 3. Return mo. */ this._callback = callback; - var window = DOMImpl_1.dom.window; + const window = DOMImpl_1.dom.window; infra_1.set.append(window._mutationObservers, this); } /** @inheritdoc */ - MutationObserverImpl.prototype.observe = function (target, options) { - var e_1, _a; + observe(target, options) { options = options || { childList: false, subtree: false @@ -27757,51 +26083,24 @@ var MutationObserverImpl = /** @class */ (function () { * 7. For each registered of target’s registered observer list, if * registered’s observer is the context object: */ - var isRegistered = false; - var coptions = options; - var _loop_1 = function (registered) { - var e_2, _a; - if (registered.observer === this_1) { + let isRegistered = false; + const coptions = options; + for (const registered of target._registeredObserverList) { + if (registered.observer === this) { isRegistered = true; - try { - /** - * 7.1. For each node of the context object’s node list, remove all - * transient registered observers whose source is registered from node’s - * registered observer list. - */ - for (var _b = (e_2 = void 0, __values(this_1._nodeList)), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - infra_1.list.remove(node._registeredObserverList, function (ob) { - return util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered; - }); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_2) throw e_2.error; } + /** + * 7.1. For each node of the context object’s node list, remove all + * transient registered observers whose source is registered from node’s + * registered observer list. + */ + for (const node of this._nodeList) { + infra_1.list.remove(node._registeredObserverList, (ob) => util_1.Guard.isTransientRegisteredObserver(ob) && ob.source === registered); } /** * 7.2. Set registered’s options to options. */ registered.options = coptions; } - }; - var this_1 = this; - try { - for (var _b = __values(target._registeredObserverList), _c = _b.next(); !_c.done; _c = _b.next()) { - var registered = _c.value; - _loop_1(registered); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } } /** * 8. Otherwise: @@ -27813,49 +26112,34 @@ var MutationObserverImpl = /** @class */ (function () { target._registeredObserverList.push({ observer: this, options: options }); this._nodeList.push(target); } - }; + } /** @inheritdoc */ - MutationObserverImpl.prototype.disconnect = function () { - var e_3, _a; - var _this = this; - try { - /** - * 1. For each node of the context object’s node list, remove any - * registered observer from node’s registered observer list for which the - * context object is the observer. - */ - for (var _b = __values(this._nodeList), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - infra_1.list.remove((node)._registeredObserverList, function (ob) { - return ob.observer === _this; - }); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_3) throw e_3.error; } + disconnect() { + /** + * 1. For each node of the context object’s node list, remove any + * registered observer from node’s registered observer list for which the + * context object is the observer. + */ + for (const node of this._nodeList) { + infra_1.list.remove((node)._registeredObserverList, (ob) => ob.observer === this); } /** * 2. Empty the context object’s record queue. */ this._recordQueue = []; - }; + } /** @inheritdoc */ - MutationObserverImpl.prototype.takeRecords = function () { + takeRecords() { /** * 1. Let records be a clone of the context object’s record queue. * 2. Empty the context object’s record queue. * 3. Return records. */ - var records = this._recordQueue; + const records = this._recordQueue; this._recordQueue = []; return records; - }; - return MutationObserverImpl; -}()); + } +} exports.MutationObserverImpl = MutationObserverImpl; //# sourceMappingURL=MutationObserverImpl.js.map @@ -27867,10 +26151,20 @@ exports.MutationObserverImpl = MutationObserverImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MutationRecordImpl = void 0; /** * Represents a mutation record. */ -var MutationRecordImpl = /** @class */ (function () { +class MutationRecordImpl { + _type; + _target; + _addedNodes; + _removedNodes; + _previousSibling; + _nextSibling; + _attributeName; + _attributeNamespace; + _oldValue; /** * Initializes a new instance of `MutationRecord`. * @@ -27890,7 +26184,7 @@ var MutationRecordImpl = /** @class */ (function () { * mutation, node `data` for a mutation to a CharacterData node and `null` * for a mutation to the tree of nodes. */ - function MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + constructor(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { this._type = type; this._target = target; this._addedNodes = addedNodes; @@ -27901,60 +26195,24 @@ var MutationRecordImpl = /** @class */ (function () { this._attributeNamespace = attributeNamespace; this._oldValue = oldValue; } - Object.defineProperty(MutationRecordImpl.prototype, "type", { - /** @inheritdoc */ - get: function () { return this._type; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "target", { - /** @inheritdoc */ - get: function () { return this._target; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "addedNodes", { - /** @inheritdoc */ - get: function () { return this._addedNodes; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "removedNodes", { - /** @inheritdoc */ - get: function () { return this._removedNodes; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "previousSibling", { - /** @inheritdoc */ - get: function () { return this._previousSibling; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "nextSibling", { - /** @inheritdoc */ - get: function () { return this._nextSibling; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "attributeName", { - /** @inheritdoc */ - get: function () { return this._attributeName; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "attributeNamespace", { - /** @inheritdoc */ - get: function () { return this._attributeNamespace; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MutationRecordImpl.prototype, "oldValue", { - /** @inheritdoc */ - get: function () { return this._oldValue; }, - enumerable: true, - configurable: true - }); + /** @inheritdoc */ + get type() { return this._type; } + /** @inheritdoc */ + get target() { return this._target; } + /** @inheritdoc */ + get addedNodes() { return this._addedNodes; } + /** @inheritdoc */ + get removedNodes() { return this._removedNodes; } + /** @inheritdoc */ + get previousSibling() { return this._previousSibling; } + /** @inheritdoc */ + get nextSibling() { return this._nextSibling; } + /** @inheritdoc */ + get attributeName() { return this._attributeName; } + /** @inheritdoc */ + get attributeNamespace() { return this._attributeNamespace; } + /** @inheritdoc */ + get oldValue() { return this._oldValue; } /** * Creates a new `MutationRecord`. * @@ -27974,57 +26232,43 @@ var MutationRecordImpl = /** @class */ (function () { * mutation, node `data` for a mutation to a CharacterData node and `null` * for a mutation to the tree of nodes. */ - MutationRecordImpl._create = function (type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { + static _create(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue) { return new MutationRecordImpl(type, target, addedNodes, removedNodes, previousSibling, nextSibling, attributeName, attributeNamespace, oldValue); - }; - return MutationRecordImpl; -}()); + } +} exports.MutationRecordImpl = MutationRecordImpl; //# sourceMappingURL=MutationRecordImpl.js.map /***/ }), /***/ 57206: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMException_1 = __nccwpck_require__(13166); -var algorithm_1 = __nccwpck_require__(61); +exports.NamedNodeMapImpl = void 0; +const DOMException_1 = __nccwpck_require__(13166); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a collection of attributes. */ -var NamedNodeMapImpl = /** @class */ (function (_super) { - __extends(NamedNodeMapImpl, _super); +class NamedNodeMapImpl extends Array { + _element; /** * Initializes a new instance of `NamedNodeMap`. * * @param element - parent element */ - function NamedNodeMapImpl(element) { - var _this = _super.call(this) || this; - _this._element = element; + constructor(element) { + super(); + this._element = element; // TODO: This workaround is needed to extend Array in ES5 - Object.setPrototypeOf(_this, NamedNodeMapImpl.prototype); - return _this; + Object.setPrototypeOf(this, NamedNodeMapImpl.prototype); } - NamedNodeMapImpl.prototype._asArray = function () { return this; }; + _asArray() { return this; } /** @inheritdoc */ - NamedNodeMapImpl.prototype.item = function (index) { + item(index) { /** * 1. If index is equal to or greater than context object’s attribute list’s * size, then return null. @@ -28032,72 +26276,71 @@ var NamedNodeMapImpl = /** @class */ (function (_super) { * */ return this[index] || null; - }; + } /** @inheritdoc */ - NamedNodeMapImpl.prototype.getNamedItem = function (qualifiedName) { + getNamedItem(qualifiedName) { /** * The getNamedItem(qualifiedName) method, when invoked, must return the * result of getting an attribute given qualifiedName and element. */ - return algorithm_1.element_getAnAttributeByName(qualifiedName, this._element); - }; + return (0, algorithm_1.element_getAnAttributeByName)(qualifiedName, this._element); + } /** @inheritdoc */ - NamedNodeMapImpl.prototype.getNamedItemNS = function (namespace, localName) { + getNamedItemNS(namespace, localName) { /** * The getNamedItemNS(namespace, localName) method, when invoked, must * return the result of getting an attribute given namespace, localName, * and element. */ - return algorithm_1.element_getAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); - }; + return (0, algorithm_1.element_getAnAttributeByNamespaceAndLocalName)(namespace || '', localName, this._element); + } /** @inheritdoc */ - NamedNodeMapImpl.prototype.setNamedItem = function (attr) { + setNamedItem(attr) { /** * The setNamedItem(attr) and setNamedItemNS(attr) methods, when invoked, * must return the result of setting an attribute given attr and element. */ - return algorithm_1.element_setAnAttribute(attr, this._element); - }; + return (0, algorithm_1.element_setAnAttribute)(attr, this._element); + } /** @inheritdoc */ - NamedNodeMapImpl.prototype.setNamedItemNS = function (attr) { - return algorithm_1.element_setAnAttribute(attr, this._element); - }; + setNamedItemNS(attr) { + return (0, algorithm_1.element_setAnAttribute)(attr, this._element); + } /** @inheritdoc */ - NamedNodeMapImpl.prototype.removeNamedItem = function (qualifiedName) { + removeNamedItem(qualifiedName) { /** * 1. Let attr be the result of removing an attribute given qualifiedName * and element. * 2. If attr is null, then throw a "NotFoundError" DOMException. * 3. Return attr. */ - var attr = algorithm_1.element_removeAnAttributeByName(qualifiedName, this._element); + const attr = (0, algorithm_1.element_removeAnAttributeByName)(qualifiedName, this._element); if (attr === null) throw new DOMException_1.NotFoundError(); return attr; - }; + } /** @inheritdoc */ - NamedNodeMapImpl.prototype.removeNamedItemNS = function (namespace, localName) { + removeNamedItemNS(namespace, localName) { /** * 1. Let attr be the result of removing an attribute given namespace, * localName, and element. * 2. If attr is null, then throw a "NotFoundError" DOMException. * 3. Return attr. */ - var attr = algorithm_1.element_removeAnAttributeByNamespaceAndLocalName(namespace || '', localName, this._element); + const attr = (0, algorithm_1.element_removeAnAttributeByNamespaceAndLocalName)(namespace || '', localName, this._element); if (attr === null) throw new DOMException_1.NotFoundError(); return attr; - }; + } /** * Creates a new `NamedNodeMap`. * * @param element - parent element */ - NamedNodeMapImpl._create = function (element) { + static _create(element) { return new NamedNodeMapImpl(element); - }; - return NamedNodeMapImpl; -}(Array)); + } +} exports.NamedNodeMapImpl = NamedNodeMapImpl; //# sourceMappingURL=NamedNodeMapImpl.js.map @@ -28109,240 +26352,239 @@ exports.NamedNodeMapImpl = NamedNodeMapImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.NodeFilterImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a node filter. */ -var NodeFilterImpl = /** @class */ (function () { +class NodeFilterImpl { + static FILTER_ACCEPT = 1; + static FILTER_REJECT = 2; + static FILTER_SKIP = 3; + static SHOW_ALL = 0xffffffff; + static SHOW_ELEMENT = 0x1; + static SHOW_ATTRIBUTE = 0x2; + static SHOW_TEXT = 0x4; + static SHOW_CDATA_SECTION = 0x8; + static SHOW_ENTITY_REFERENCE = 0x10; + static SHOW_ENTITY = 0x20; + static SHOW_PROCESSING_INSTRUCTION = 0x40; + static SHOW_COMMENT = 0x80; + static SHOW_DOCUMENT = 0x100; + static SHOW_DOCUMENT_TYPE = 0x200; + static SHOW_DOCUMENT_FRAGMENT = 0x400; + static SHOW_NOTATION = 0x800; + FILTER_ACCEPT = 1; + FILTER_REJECT = 2; + FILTER_SKIP = 3; + SHOW_ALL = 0xffffffff; + SHOW_ELEMENT = 0x1; + SHOW_ATTRIBUTE = 0x2; + SHOW_TEXT = 0x4; + SHOW_CDATA_SECTION = 0x8; + SHOW_ENTITY_REFERENCE = 0x10; + SHOW_ENTITY = 0x20; + SHOW_PROCESSING_INSTRUCTION = 0x40; + SHOW_COMMENT = 0x80; + SHOW_DOCUMENT = 0x100; + SHOW_DOCUMENT_TYPE = 0x200; + SHOW_DOCUMENT_FRAGMENT = 0x400; + SHOW_NOTATION = 0x800; /** * Initializes a new instance of `NodeFilter`. */ - function NodeFilterImpl() { + constructor() { } /** * Callback function. */ - NodeFilterImpl.prototype.acceptNode = function (node) { + acceptNode(node) { return interfaces_1.FilterResult.Accept; - }; + } /** * Creates a new `NodeFilter`. */ - NodeFilterImpl._create = function () { + static _create() { return new NodeFilterImpl(); - }; - NodeFilterImpl.FILTER_ACCEPT = 1; - NodeFilterImpl.FILTER_REJECT = 2; - NodeFilterImpl.FILTER_SKIP = 3; - NodeFilterImpl.SHOW_ALL = 0xffffffff; - NodeFilterImpl.SHOW_ELEMENT = 0x1; - NodeFilterImpl.SHOW_ATTRIBUTE = 0x2; - NodeFilterImpl.SHOW_TEXT = 0x4; - NodeFilterImpl.SHOW_CDATA_SECTION = 0x8; - NodeFilterImpl.SHOW_ENTITY_REFERENCE = 0x10; - NodeFilterImpl.SHOW_ENTITY = 0x20; - NodeFilterImpl.SHOW_PROCESSING_INSTRUCTION = 0x40; - NodeFilterImpl.SHOW_COMMENT = 0x80; - NodeFilterImpl.SHOW_DOCUMENT = 0x100; - NodeFilterImpl.SHOW_DOCUMENT_TYPE = 0x200; - NodeFilterImpl.SHOW_DOCUMENT_FRAGMENT = 0x400; - NodeFilterImpl.SHOW_NOTATION = 0x800; - return NodeFilterImpl; -}()); + } +} exports.NodeFilterImpl = NodeFilterImpl; /** * Define constants on prototype. */ -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_ACCEPT", 1); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_REJECT", 2); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "FILTER_SKIP", 3); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ALL", 0xffffffff); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ELEMENT", 0x1); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ATTRIBUTE", 0x2); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_TEXT", 0x4); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_CDATA_SECTION", 0x8); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY_REFERENCE", 0x10); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_ENTITY", 0x20); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_PROCESSING_INSTRUCTION", 0x40); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_COMMENT", 0x80); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT", 0x100); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_TYPE", 0x200); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_DOCUMENT_FRAGMENT", 0x400); -WebIDLAlgorithm_1.idl_defineConst(NodeFilterImpl.prototype, "SHOW_NOTATION", 0x800); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "FILTER_ACCEPT", 1); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "FILTER_REJECT", 2); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "FILTER_SKIP", 3); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_ALL", 0xffffffff); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_ELEMENT", 0x1); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_ATTRIBUTE", 0x2); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_TEXT", 0x4); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_CDATA_SECTION", 0x8); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_ENTITY_REFERENCE", 0x10); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_ENTITY", 0x20); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_PROCESSING_INSTRUCTION", 0x40); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_COMMENT", 0x80); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_DOCUMENT", 0x100); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_DOCUMENT_TYPE", 0x200); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_DOCUMENT_FRAGMENT", 0x400); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeFilterImpl.prototype, "SHOW_NOTATION", 0x800); //# sourceMappingURL=NodeFilterImpl.js.map /***/ }), /***/ 91745: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var interfaces_1 = __nccwpck_require__(27305); -var EventTargetImpl_1 = __nccwpck_require__(69968); -var util_1 = __nccwpck_require__(65282); -var DOMException_1 = __nccwpck_require__(13166); -var algorithm_1 = __nccwpck_require__(61); -var URLAlgorithm_1 = __nccwpck_require__(53568); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.NodeImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const interfaces_1 = __nccwpck_require__(27305); +const EventTargetImpl_1 = __nccwpck_require__(69968); +const util_1 = __nccwpck_require__(65282); +const DOMException_1 = __nccwpck_require__(13166); +const algorithm_1 = __nccwpck_require__(61); +const URLAlgorithm_1 = __nccwpck_require__(53568); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a generic XML node. */ -var NodeImpl = /** @class */ (function (_super) { - __extends(NodeImpl, _super); +class NodeImpl extends EventTargetImpl_1.EventTargetImpl { + static ELEMENT_NODE = 1; + static ATTRIBUTE_NODE = 2; + static TEXT_NODE = 3; + static CDATA_SECTION_NODE = 4; + static ENTITY_REFERENCE_NODE = 5; + static ENTITY_NODE = 6; + static PROCESSING_INSTRUCTION_NODE = 7; + static COMMENT_NODE = 8; + static DOCUMENT_NODE = 9; + static DOCUMENT_TYPE_NODE = 10; + static DOCUMENT_FRAGMENT_NODE = 11; + static NOTATION_NODE = 12; + static DOCUMENT_POSITION_DISCONNECTED = 0x01; + static DOCUMENT_POSITION_PRECEDING = 0x02; + static DOCUMENT_POSITION_FOLLOWING = 0x04; + static DOCUMENT_POSITION_CONTAINS = 0x08; + static DOCUMENT_POSITION_CONTAINED_BY = 0x10; + static DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + ELEMENT_NODE = 1; + ATTRIBUTE_NODE = 2; + TEXT_NODE = 3; + CDATA_SECTION_NODE = 4; + ENTITY_REFERENCE_NODE = 5; + ENTITY_NODE = 6; + PROCESSING_INSTRUCTION_NODE = 7; + COMMENT_NODE = 8; + DOCUMENT_NODE = 9; + DOCUMENT_TYPE_NODE = 10; + DOCUMENT_FRAGMENT_NODE = 11; + NOTATION_NODE = 12; + DOCUMENT_POSITION_DISCONNECTED = 0x01; + DOCUMENT_POSITION_PRECEDING = 0x02; + DOCUMENT_POSITION_FOLLOWING = 0x04; + DOCUMENT_POSITION_CONTAINS = 0x08; + DOCUMENT_POSITION_CONTAINED_BY = 0x10; + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + __childNodes; + get _childNodes() { + return this.__childNodes || (this.__childNodes = (0, algorithm_1.create_nodeList)(this)); + } + _nodeDocumentOverride; + get _nodeDocument() { return this._nodeDocumentOverride || DOMImpl_1.dom.window._associatedDocument; } + set _nodeDocument(val) { this._nodeDocumentOverride = val; } + __registeredObserverList; + get _registeredObserverList() { + return this.__registeredObserverList || (this.__registeredObserverList = []); + } + _parent = null; + _children = new util_1.EmptySet; + _firstChild = null; + _lastChild = null; + _previousSibling = null; + _nextSibling = null; /** * Initializes a new instance of `Node`. */ - function NodeImpl() { - var _this = _super.call(this) || this; - _this._parent = null; - _this._firstChild = null; - _this._lastChild = null; - _this._previousSibling = null; - _this._nextSibling = null; - return _this; - } - Object.defineProperty(NodeImpl.prototype, "_childNodes", { - get: function () { - return this.__childNodes || (this.__childNodes = algorithm_1.create_nodeList(this)); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "_nodeDocument", { - get: function () { return this._nodeDocumentOverride || DOMImpl_1.dom.window._associatedDocument; }, - set: function (val) { this._nodeDocumentOverride = val; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "_registeredObserverList", { - get: function () { - return this.__registeredObserverList || (this.__registeredObserverList = []); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "nodeType", { - /** @inheritdoc */ - get: function () { return this._nodeType; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "nodeName", { - /** - * Returns a string appropriate for the type of node. - */ - get: function () { - if (util_1.Guard.isElementNode(this)) { - return this._htmlUppercasedQualifiedName; - } - else if (util_1.Guard.isAttrNode(this)) { - return this._qualifiedName; - } - else if (util_1.Guard.isExclusiveTextNode(this)) { - return "#text"; - } - else if (util_1.Guard.isCDATASectionNode(this)) { - return "#cdata-section"; - } - else if (util_1.Guard.isProcessingInstructionNode(this)) { - return this._target; - } - else if (util_1.Guard.isCommentNode(this)) { - return "#comment"; - } - else if (util_1.Guard.isDocumentNode(this)) { - return "#document"; - } - else if (util_1.Guard.isDocumentTypeNode(this)) { - return this._name; - } - else if (util_1.Guard.isDocumentFragmentNode(this)) { - return "#document-fragment"; - } - else { - return ""; - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "baseURI", { + constructor() { + super(); + } + /** @inheritdoc */ + get nodeType() { return this._nodeType; } + /** + * Returns a string appropriate for the type of node. + */ + get nodeName() { + if (util_1.Guard.isElementNode(this)) { + return this._htmlUppercasedQualifiedName; + } + else if (util_1.Guard.isAttrNode(this)) { + return this._qualifiedName; + } + else if (util_1.Guard.isExclusiveTextNode(this)) { + return "#text"; + } + else if (util_1.Guard.isCDATASectionNode(this)) { + return "#cdata-section"; + } + else if (util_1.Guard.isProcessingInstructionNode(this)) { + return this._target; + } + else if (util_1.Guard.isCommentNode(this)) { + return "#comment"; + } + else if (util_1.Guard.isDocumentNode(this)) { + return "#document"; + } + else if (util_1.Guard.isDocumentTypeNode(this)) { + return this._name; + } + else if (util_1.Guard.isDocumentFragmentNode(this)) { + return "#document-fragment"; + } + else { + return ""; + } + } + /** + * Gets the absolute base URL of the node. + */ + get baseURI() { /** - * Gets the absolute base URL of the node. + * The baseURI attribute’s getter must return node document’s document + * base URL, serialized. + * TODO: Implement in HTML DOM + * https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url */ - get: function () { - /** - * The baseURI attribute’s getter must return node document’s document - * base URL, serialized. - * TODO: Implement in HTML DOM - * https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url - */ - return URLAlgorithm_1.urlSerializer(this._nodeDocument._URL); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "isConnected", { + return (0, URLAlgorithm_1.urlSerializer)(this._nodeDocument._URL); + } + /** + * Returns whether the node is rooted to a document node. + */ + get isConnected() { /** - * Returns whether the node is rooted to a document node. + * The isConnected attribute’s getter must return true, if context object + * is connected, and false otherwise. */ - get: function () { - /** - * The isConnected attribute’s getter must return true, if context object - * is connected, and false otherwise. - */ - return util_1.Guard.isElementNode(this) && algorithm_1.shadowTree_isConnected(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "ownerDocument", { + return util_1.Guard.isElementNode(this) && (0, algorithm_1.shadowTree_isConnected)(this); + } + /** + * Returns the parent document. + */ + get ownerDocument() { /** - * Returns the parent document. + * The ownerDocument attribute’s getter must return null, if the context + * object is a document, and the context object’s node document otherwise. + * _Note:_ The node document of a document is that document itself. All + * nodes have a node document at all times. */ - get: function () { - /** - * The ownerDocument attribute’s getter must return null, if the context - * object is a document, and the context object’s node document otherwise. - * _Note:_ The node document of a document is that document itself. All - * nodes have a node document at all times. - */ - if (this._nodeType === interfaces_1.NodeType.Document) - return null; - else - return this._nodeDocument; - }, - enumerable: true, - configurable: true - }); + if (this._nodeType === interfaces_1.NodeType.Document) + return null; + else + return this._nodeDocument; + } /** * Returns the root node. * @@ -28350,200 +26592,164 @@ var NodeImpl = /** @class */ (function (_super) { * returns the node's shadow-including root, otherwise it returns * the node's root node. */ - NodeImpl.prototype.getRootNode = function (options) { + getRootNode(options) { /** * The getRootNode(options) method, when invoked, must return context * object’s shadow-including root if options’s composed is true, * and context object’s root otherwise. */ - return algorithm_1.tree_rootNode(this, !!options && options.composed); - }; - Object.defineProperty(NodeImpl.prototype, "parentNode", { + return (0, algorithm_1.tree_rootNode)(this, !!options && options.composed); + } + /** + * Returns the parent node. + */ + get parentNode() { /** - * Returns the parent node. + * The parentNode attribute’s getter must return the context object’s parent. + * _Note:_ An Attr node has no parent. */ - get: function () { - /** - * The parentNode attribute’s getter must return the context object’s parent. - * _Note:_ An Attr node has no parent. - */ - if (this._nodeType === interfaces_1.NodeType.Attribute) { - return null; - } - else { - return this._parent; - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "parentElement", { + if (this._nodeType === interfaces_1.NodeType.Attribute) { + return null; + } + else { + return this._parent; + } + } + /** + * Returns the parent element. + */ + get parentElement() { /** - * Returns the parent element. + * The parentElement attribute’s getter must return the context object’s + * parent element. */ - get: function () { - /** - * The parentElement attribute’s getter must return the context object’s - * parent element. - */ - if (this._parent && util_1.Guard.isElementNode(this._parent)) { - return this._parent; - } - else { - return null; - } - }, - enumerable: true, - configurable: true - }); + if (this._parent && util_1.Guard.isElementNode(this._parent)) { + return this._parent; + } + else { + return null; + } + } /** * Determines whether a node has any children. */ - NodeImpl.prototype.hasChildNodes = function () { + hasChildNodes() { /** * The hasChildNodes() method, when invoked, must return true if the context * object has children, and false otherwise. */ return (this._firstChild !== null); - }; - Object.defineProperty(NodeImpl.prototype, "childNodes", { - /** - * Returns a {@link NodeList} of child nodes. - */ - get: function () { - /** - * The childNodes attribute’s getter must return a NodeList rooted at the - * context object matching only children. - */ - return this._childNodes; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "firstChild", { - /** - * Returns the first child node. - */ - get: function () { - /** - * The firstChild attribute’s getter must return the context object’s first - * child. - */ - return this._firstChild; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "lastChild", { + } + /** + * Returns a {@link NodeList} of child nodes. + */ + get childNodes() { /** - * Returns the last child node. + * The childNodes attribute’s getter must return a NodeList rooted at the + * context object matching only children. */ - get: function () { - /** - * The lastChild attribute’s getter must return the context object’s last - * child. - */ - return this._lastChild; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "previousSibling", { + return this._childNodes; + } + /** + * Returns the first child node. + */ + get firstChild() { /** - * Returns the previous sibling node. + * The firstChild attribute’s getter must return the context object’s first + * child. */ - get: function () { - /** - * The previousSibling attribute’s getter must return the context object’s - * previous sibling. - * _Note:_ An Attr node has no siblings. - */ - return this._previousSibling; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "nextSibling", { + return this._firstChild; + } + /** + * Returns the last child node. + */ + get lastChild() { /** - * Returns the next sibling node. + * The lastChild attribute’s getter must return the context object’s last + * child. */ - get: function () { - /** - * The nextSibling attribute’s getter must return the context object’s - * next sibling. - */ - return this._nextSibling; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "nodeValue", { + return this._lastChild; + } + /** + * Returns the previous sibling node. + */ + get previousSibling() { /** - * Gets or sets the data associated with a {@link CharacterData} node or the - * value of an {@link @Attr} node. For other node types returns `null`. + * The previousSibling attribute’s getter must return the context object’s + * previous sibling. + * _Note:_ An Attr node has no siblings. */ - get: function () { - if (util_1.Guard.isAttrNode(this)) { - return this._value; - } - else if (util_1.Guard.isCharacterDataNode(this)) { - return this._data; - } - else { - return null; - } - }, - set: function (value) { - if (value === null) { - value = ''; - } - if (util_1.Guard.isAttrNode(this)) { - algorithm_1.attr_setAnExistingAttributeValue(this, value); - } - else if (util_1.Guard.isCharacterDataNode(this)) { - algorithm_1.characterData_replaceData(this, 0, this._data.length, value); - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeImpl.prototype, "textContent", { + return this._previousSibling; + } + /** + * Returns the next sibling node. + */ + get nextSibling() { /** - * Returns the concatenation of data of all the {@link Text} - * node descendants in tree order. When set, replaces the text - * contents of the node with the given value. + * The nextSibling attribute’s getter must return the context object’s + * next sibling. */ - get: function () { - if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { - return algorithm_1.text_descendantTextContent(this); - } - else if (util_1.Guard.isAttrNode(this)) { - return this._value; - } - else if (util_1.Guard.isCharacterDataNode(this)) { - return this._data; - } - else { - return null; - } - }, - set: function (value) { - if (value === null) { - value = ''; - } - if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { - algorithm_1.node_stringReplaceAll(value, this); - } - else if (util_1.Guard.isAttrNode(this)) { - algorithm_1.attr_setAnExistingAttributeValue(this, value); - } - else if (util_1.Guard.isCharacterDataNode(this)) { - algorithm_1.characterData_replaceData(this, 0, algorithm_1.tree_nodeLength(this), value); - } - }, - enumerable: true, - configurable: true - }); + return this._nextSibling; + } + /** + * Gets or sets the data associated with a {@link CharacterData} node or the + * value of an {@link @Attr} node. For other node types returns `null`. + */ + get nodeValue() { + if (util_1.Guard.isAttrNode(this)) { + return this._value; + } + else if (util_1.Guard.isCharacterDataNode(this)) { + return this._data; + } + else { + return null; + } + } + set nodeValue(value) { + if (value === null) { + value = ''; + } + if (util_1.Guard.isAttrNode(this)) { + (0, algorithm_1.attr_setAnExistingAttributeValue)(this, value); + } + else if (util_1.Guard.isCharacterDataNode(this)) { + (0, algorithm_1.characterData_replaceData)(this, 0, this._data.length, value); + } + } + /** + * Returns the concatenation of data of all the {@link Text} + * node descendants in tree order. When set, replaces the text + * contents of the node with the given value. + */ + get textContent() { + if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { + return (0, algorithm_1.text_descendantTextContent)(this); + } + else if (util_1.Guard.isAttrNode(this)) { + return this._value; + } + else if (util_1.Guard.isCharacterDataNode(this)) { + return this._data; + } + else { + return null; + } + } + set textContent(value) { + if (value === null) { + value = ''; + } + if (util_1.Guard.isDocumentFragmentNode(this) || util_1.Guard.isElementNode(this)) { + (0, algorithm_1.node_stringReplaceAll)(value, this); + } + else if (util_1.Guard.isAttrNode(this)) { + (0, algorithm_1.attr_setAnExistingAttributeValue)(this, value); + } + else if (util_1.Guard.isCharacterDataNode(this)) { + (0, algorithm_1.characterData_replaceData)(this, 0, (0, algorithm_1.tree_nodeLength)(this), value); + } + } /** * Puts all {@link Text} nodes in the full depth of the sub-tree * underneath this node into a "normal" form where only markup @@ -28551,62 +26757,51 @@ var NodeImpl = /** @class */ (function (_super) { * and entity references) separates {@link Text} nodes, i.e., there * are no adjacent Text nodes. */ - NodeImpl.prototype.normalize = function () { - var e_1, _a, e_2, _b; + normalize() { /** * The normalize() method, when invoked, must run these steps for each * descendant exclusive Text node node of context object: */ - var descendantNodes = []; - var node = algorithm_1.tree_getFirstDescendantNode(this, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); + const descendantNodes = []; + let node = (0, algorithm_1.tree_getFirstDescendantNode)(this, false, false, (e) => util_1.Guard.isExclusiveTextNode(e)); while (node !== null) { descendantNodes.push(node); - node = algorithm_1.tree_getNextDescendantNode(this, node, false, false, function (e) { return util_1.Guard.isExclusiveTextNode(e); }); + node = (0, algorithm_1.tree_getNextDescendantNode)(this, node, false, false, (e) => util_1.Guard.isExclusiveTextNode(e)); } - for (var i = 0; i < descendantNodes.length; i++) { - var node_1 = descendantNodes[i]; - if (node_1._parent === null) + for (let i = 0; i < descendantNodes.length; i++) { + const node = descendantNodes[i]; + if (node._parent === null) continue; /** * 1. Let length be node’s length. * 2. If length is zero, then remove node and continue with the next * exclusive Text node, if any. */ - var length = algorithm_1.tree_nodeLength(node_1); + let length = (0, algorithm_1.tree_nodeLength)(node); if (length === 0) { - algorithm_1.mutation_remove(node_1, node_1._parent); + (0, algorithm_1.mutation_remove)(node, node._parent); continue; } /** * 3. Let data be the concatenation of the data of node’s contiguous * exclusive Text nodes (excluding itself), in tree order. */ - var textSiblings = []; - var data = ''; - try { - for (var _c = (e_1 = void 0, __values(algorithm_1.text_contiguousExclusiveTextNodes(node_1))), _d = _c.next(); !_d.done; _d = _c.next()) { - var sibling = _d.value; - textSiblings.push(sibling); - data += sibling._data; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_1) throw e_1.error; } + const textSiblings = []; + let data = ''; + for (const sibling of (0, algorithm_1.text_contiguousExclusiveTextNodes)(node)) { + textSiblings.push(sibling); + data += sibling._data; } /** * 4. Replace data with node node, offset length, count 0, and data data. */ - algorithm_1.characterData_replaceData(node_1, length, 0, data); + (0, algorithm_1.characterData_replaceData)(node, length, 0, data); /** * 5. Let currentNode be node’s next sibling. * 6. While currentNode is an exclusive Text node: */ if (DOMImpl_1.dom.rangeList.size !== 0) { - var currentNode = node_1._nextSibling; + let currentNode = node._nextSibling; while (currentNode !== null && util_1.Guard.isExclusiveTextNode(currentNode)) { /** * 6.1. For each live range whose start node is currentNode, add length @@ -28620,41 +26815,31 @@ var NodeImpl = /** @class */ (function (_super) { * end offset is currentNode’s index, set its end node to node and its * end offset to length. */ - var cn = currentNode; - var index = algorithm_1.tree_index(cn); - try { - for (var _e = (e_2 = void 0, __values(DOMImpl_1.dom.rangeList)), _f = _e.next(); !_f.done; _f = _e.next()) { - var range = _f.value; - if (range._start[0] === cn) { - range._start[0] = node_1; - range._start[1] += length; - } - if (range._end[0] === cn) { - range._end[0] = node_1; - range._end[1] += length; - } - if (range._start[0] === cn._parent && range._start[1] === index) { - range._start[0] = node_1; - range._start[1] = length; - } - if (range._end[0] === cn._parent && range._end[1] === index) { - range._end[0] = node_1; - range._end[1] = length; - } + const cn = currentNode; + const index = (0, algorithm_1.tree_index)(cn); + for (const range of DOMImpl_1.dom.rangeList) { + if (range._start[0] === cn) { + range._start[0] = node; + range._start[1] += length; } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); + if (range._end[0] === cn) { + range._end[0] = node; + range._end[1] += length; + } + if (range._start[0] === cn._parent && range._start[1] === index) { + range._start[0] = node; + range._start[1] = length; + } + if (range._end[0] === cn._parent && range._end[1] === index) { + range._end[0] = node; + range._end[1] = length; } - finally { if (e_2) throw e_2.error; } } /** * 6.5. Add currentNode’s length to length. * 6.6. Set currentNode to its next sibling. */ - length += algorithm_1.tree_nodeLength(currentNode); + length += (0, algorithm_1.tree_nodeLength)(currentNode); currentNode = currentNode._nextSibling; } } @@ -28662,14 +26847,14 @@ var NodeImpl = /** @class */ (function (_super) { * 7. Remove node’s contiguous exclusive Text nodes (excluding itself), * in tree order. */ - for (var i_1 = 0; i_1 < textSiblings.length; i_1++) { - var sibling = textSiblings[i_1]; + for (let i = 0; i < textSiblings.length; i++) { + const sibling = textSiblings[i]; if (sibling._parent === null) continue; - algorithm_1.mutation_remove(sibling, sibling._parent); + (0, algorithm_1.mutation_remove)(sibling, sibling._parent); } } - }; + } /** * Returns a duplicate of this node, i.e., serves as a generic copy * constructor for nodes. The duplicate node has no parent @@ -28679,8 +26864,7 @@ var NodeImpl = /** @class */ (function (_super) { * specified node. If `false`, clone only the node itself (and its * attributes, if it is an {@link Element}). */ - NodeImpl.prototype.cloneNode = function (deep) { - if (deep === void 0) { deep = false; } + cloneNode(deep = false) { /** * 1. If context object is a shadow root, then throw a "NotSupportedError" * DOMException. @@ -28689,40 +26873,38 @@ var NodeImpl = /** @class */ (function (_super) { */ if (util_1.Guard.isShadowRoot(this)) throw new DOMException_1.NotSupportedError(); - return algorithm_1.node_clone(this, null, deep); - }; + return (0, algorithm_1.node_clone)(this, null, deep); + } /** * Determines if the given node is equal to this one. * * @param node - the node to compare with */ - NodeImpl.prototype.isEqualNode = function (node) { - if (node === void 0) { node = null; } + isEqualNode(node = null) { /** * The isEqualNode(otherNode) method, when invoked, must return true if * otherNode is non-null and context object equals otherNode, and false * otherwise. */ - return (node !== null && algorithm_1.node_equals(this, node)); - }; + return (node !== null && (0, algorithm_1.node_equals)(this, node)); + } /** * Determines if the given node is reference equal to this one. * * @param node - the node to compare with */ - NodeImpl.prototype.isSameNode = function (node) { - if (node === void 0) { node = null; } + isSameNode(node = null) { /** * The isSameNode(otherNode) method, when invoked, must return true if * otherNode is context object, and false otherwise. */ return (this === node); - }; + } /** * Returns a bitmask indicating the position of the given `node` * relative to this node. */ - NodeImpl.prototype.compareDocumentPosition = function (other) { + compareDocumentPosition(other) { /** * 1. If context object is other, then return zero. * 2. Let node1 be other and node2 be context object. @@ -28730,11 +26912,11 @@ var NodeImpl = /** @class */ (function (_super) { * attr1’s element. */ if (other === this) - return 0; - var node1 = other; - var node2 = this; - var attr1 = null; - var attr2 = null; + return interfaces_1.Position.SameNode; + let node1 = other; + let node2 = this; + let attr1 = null; + let attr2 = null; /** * 4. If node1 is an attribute, then set attr1 to node1 and node1 to * attr1’s element. @@ -28759,8 +26941,8 @@ var NodeImpl = /** @class */ (function (_super) { /** * 5.2. For each attr in node2’s attribute list: */ - for (var i = 0; i < node2._attributeList.length; i++) { - var attr = node2._attributeList[i]; + for (let i = 0; i < node2._attributeList.length; i++) { + const attr = node2._attributeList[i]; /** * 5.2.1. If attr equals attr1, then return the result of adding * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and @@ -28769,10 +26951,10 @@ var NodeImpl = /** @class */ (function (_super) { * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and * DOCUMENT_POSITION_FOLLOWING. */ - if (algorithm_1.node_equals(attr, attr1)) { + if ((0, algorithm_1.node_equals)(attr, attr1)) { return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Preceding; } - else if (algorithm_1.node_equals(attr, attr2)) { + else if ((0, algorithm_1.node_equals)(attr, attr2)) { return interfaces_1.Position.ImplementationSpecific | interfaces_1.Position.Following; } } @@ -28786,7 +26968,7 @@ var NodeImpl = /** @class */ (function (_super) { * with the constraint that this is to be consistent, together. */ if (node1 === null || node2 === null || - algorithm_1.tree_rootNode(node1) !== algorithm_1.tree_rootNode(node2)) { + (0, algorithm_1.tree_rootNode)(node1) !== (0, algorithm_1.tree_rootNode)(node2)) { // nodes are disconnected // return a random result but cache the value for consistency return interfaces_1.Position.Disconnected | interfaces_1.Position.ImplementationSpecific | @@ -28797,7 +26979,7 @@ var NodeImpl = /** @class */ (function (_super) { * and attr2 is non-null, then return the result of adding * DOCUMENT_POSITION_CONTAINS to DOCUMENT_POSITION_PRECEDING. */ - if ((!attr1 && algorithm_1.tree_isAncestorOf(node2, node1)) || + if ((!attr1 && (0, algorithm_1.tree_isAncestorOf)(node2, node1)) || (attr2 && (node1 === node2))) { return interfaces_1.Position.Contains | interfaces_1.Position.Preceding; } @@ -28806,27 +26988,27 @@ var NodeImpl = /** @class */ (function (_super) { * and attr1 is non-null, then return the result of adding * DOCUMENT_POSITION_CONTAINED_BY to DOCUMENT_POSITION_FOLLOWING. */ - if ((!attr2 && algorithm_1.tree_isDescendantOf(node2, node1)) || + if ((!attr2 && (0, algorithm_1.tree_isDescendantOf)(node2, node1)) || (attr1 && (node1 === node2))) { return interfaces_1.Position.ContainedBy | interfaces_1.Position.Following; } /** * 9. If node1 is preceding node2, then return DOCUMENT_POSITION_PRECEDING. */ - if (algorithm_1.tree_isPreceding(node2, node1)) + if ((0, algorithm_1.tree_isPreceding)(node2, node1)) return interfaces_1.Position.Preceding; /** * 10. Return DOCUMENT_POSITION_FOLLOWING. */ return interfaces_1.Position.Following; - }; + } /** * Returns `true` if given node is an inclusive descendant of this * node, and `false` otherwise (including when other node is `null`). * * @param other - the node to check */ - NodeImpl.prototype.contains = function (other) { + contains(other) { /** * The contains(other) method, when invoked, must return true if other is an * inclusive descendant of context object, and false otherwise (including @@ -28834,15 +27016,15 @@ var NodeImpl = /** @class */ (function (_super) { */ if (other === null) return false; - return algorithm_1.tree_isDescendantOf(this, other, true); - }; + return (0, algorithm_1.tree_isDescendantOf)(this, other, true); + } /** * Returns the prefix for a given namespace URI, if present, and * `null` if not. * * @param namespace - the namespace to search */ - NodeImpl.prototype.lookupPrefix = function (namespace) { + lookupPrefix(namespace) { /** * 1. If namespace is null or the empty string, then return null. * 2. Switch on the context object: @@ -28854,7 +27036,7 @@ var NodeImpl = /** @class */ (function (_super) { * Return the result of locating a namespace prefix for it using * namespace. */ - return algorithm_1.node_locateANamespacePrefix(this, namespace); + return (0, algorithm_1.node_locateANamespacePrefix)(this, namespace); } else if (util_1.Guard.isDocumentNode(this)) { /** @@ -28865,7 +27047,7 @@ var NodeImpl = /** @class */ (function (_super) { return null; } else { - return algorithm_1.node_locateANamespacePrefix(this.documentElement, namespace); + return (0, algorithm_1.node_locateANamespacePrefix)(this.documentElement, namespace); } } else if (util_1.Guard.isDocumentTypeNode(this) || util_1.Guard.isDocumentFragmentNode(this)) { @@ -28880,7 +27062,7 @@ var NodeImpl = /** @class */ (function (_super) { return null; } else { - return algorithm_1.node_locateANamespacePrefix(this._element, namespace); + return (0, algorithm_1.node_locateANamespacePrefix)(this._element, namespace); } } else { @@ -28889,34 +27071,34 @@ var NodeImpl = /** @class */ (function (_super) { * element, if its parent element is non-null, and null otherwise. */ if (this._parent !== null && util_1.Guard.isElementNode(this._parent)) { - return algorithm_1.node_locateANamespacePrefix(this._parent, namespace); + return (0, algorithm_1.node_locateANamespacePrefix)(this._parent, namespace); } else { return null; } } - }; + } /** * Returns the namespace URI for a given prefix if present, and `null` * if not. * * @param prefix - the prefix to search */ - NodeImpl.prototype.lookupNamespaceURI = function (prefix) { + lookupNamespaceURI(prefix) { /** * 1. If prefix is the empty string, then set it to null. * 2. Return the result of running locate a namespace for the context object * using prefix. */ - return algorithm_1.node_locateANamespace(this, prefix || null); - }; + return (0, algorithm_1.node_locateANamespace)(this, prefix || null); + } /** * Returns `true` if the namespace is the default namespace on this * node or `false` if not. * * @param namespace - the namespace to check */ - NodeImpl.prototype.isDefaultNamespace = function (namespace) { + isDefaultNamespace(namespace) { /** * 1. If namespace is the empty string, then set it to null. * 2. Let defaultNamespace be the result of running locate a namespace for @@ -28925,9 +27107,9 @@ var NodeImpl = /** @class */ (function (_super) { */ if (!namespace) namespace = null; - var defaultNamespace = algorithm_1.node_locateANamespace(this, null); + const defaultNamespace = (0, algorithm_1.node_locateANamespace)(this, null); return (defaultNamespace === namespace); - }; + } /** * Inserts the node `newChild` before the existing child node * `refChild`. If `refChild` is `null`, inserts `newChild` at the end @@ -28944,13 +27126,13 @@ var NodeImpl = /** @class */ (function (_super) { * * @returns the newly inserted child node */ - NodeImpl.prototype.insertBefore = function (newChild, refChild) { + insertBefore(newChild, refChild) { /** * The insertBefore(node, child) method, when invoked, must return the * result of pre-inserting node into context object before child. */ - return algorithm_1.mutation_preInsert(newChild, this, refChild); - }; + return (0, algorithm_1.mutation_preInsert)(newChild, this, refChild); + } /** * Adds the node `newChild` to the end of the list of children of this * node, and returns it. If `newChild` is already in the tree, it is @@ -28964,13 +27146,13 @@ var NodeImpl = /** @class */ (function (_super) { * * @returns the newly inserted child node */ - NodeImpl.prototype.appendChild = function (newChild) { + appendChild(newChild) { /** * The appendChild(node) method, when invoked, must return the result of * appending node to context object. */ - return algorithm_1.mutation_append(newChild, this); - }; + return (0, algorithm_1.mutation_append)(newChild, this); + } /** * Replaces the child node `oldChild` with `newChild` in the list of * children, and returns the `oldChild` node. If `newChild` is already @@ -28981,13 +27163,13 @@ var NodeImpl = /** @class */ (function (_super) { * * @returns the removed child node */ - NodeImpl.prototype.replaceChild = function (newChild, oldChild) { + replaceChild(newChild, oldChild) { /** * The replaceChild(node, child) method, when invoked, must return the * result of replacing child with node within context object. */ - return algorithm_1.mutation_replace(oldChild, newChild, this); - }; + return (0, algorithm_1.mutation_replace)(oldChild, newChild, this); + } /** * Removes the child node indicated by `oldChild` from the list of * children, and returns it. @@ -28996,50 +27178,31 @@ var NodeImpl = /** @class */ (function (_super) { * * @returns the removed child node */ - NodeImpl.prototype.removeChild = function (oldChild) { + removeChild(oldChild) { /** * The removeChild(child) method, when invoked, must return the result of * pre-removing child from context object. */ - return algorithm_1.mutation_preRemove(oldChild, this); - }; + return (0, algorithm_1.mutation_preRemove)(oldChild, this); + } /** * Gets the parent event target for the given event. * * @param event - an event */ - NodeImpl.prototype._getTheParent = function (event) { + _getTheParent(event) { /** * A node’s get the parent algorithm, given an event, returns the node’s * assigned slot, if node is assigned, and node’s parent otherwise. */ - if (util_1.Guard.isSlotable(this) && algorithm_1.shadowTree_isAssigned(this)) { + if (util_1.Guard.isSlotable(this) && (0, algorithm_1.shadowTree_isAssigned)(this)) { return this._assignedSlot; } else { return this._parent; } - }; - NodeImpl.ELEMENT_NODE = 1; - NodeImpl.ATTRIBUTE_NODE = 2; - NodeImpl.TEXT_NODE = 3; - NodeImpl.CDATA_SECTION_NODE = 4; - NodeImpl.ENTITY_REFERENCE_NODE = 5; - NodeImpl.ENTITY_NODE = 6; - NodeImpl.PROCESSING_INSTRUCTION_NODE = 7; - NodeImpl.COMMENT_NODE = 8; - NodeImpl.DOCUMENT_NODE = 9; - NodeImpl.DOCUMENT_TYPE_NODE = 10; - NodeImpl.DOCUMENT_FRAGMENT_NODE = 11; - NodeImpl.NOTATION_NODE = 12; - NodeImpl.DOCUMENT_POSITION_DISCONNECTED = 0x01; - NodeImpl.DOCUMENT_POSITION_PRECEDING = 0x02; - NodeImpl.DOCUMENT_POSITION_FOLLOWING = 0x04; - NodeImpl.DOCUMENT_POSITION_CONTAINS = 0x08; - NodeImpl.DOCUMENT_POSITION_CONTAINED_BY = 0x10; - NodeImpl.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; - return NodeImpl; -}(EventTargetImpl_1.EventTargetImpl)); + } +} exports.NodeImpl = NodeImpl; /** * A performance tweak to share an empty set between all node classes. This will @@ -29050,103 +27213,84 @@ NodeImpl.prototype._children = new util_1.EmptySet(); /** * Define constants on prototype. */ -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ELEMENT_NODE", 1); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ATTRIBUTE_NODE", 2); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "TEXT_NODE", 3); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "CDATA_SECTION_NODE", 4); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_REFERENCE_NODE", 5); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "ENTITY_NODE", 6); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "PROCESSING_INSTRUCTION_NODE", 7); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "COMMENT_NODE", 8); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_NODE", 9); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_TYPE_NODE", 10); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_FRAGMENT_NODE", 11); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "NOTATION_NODE", 12); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_DISCONNECTED", 0x01); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_PRECEDING", 0x02); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_FOLLOWING", 0x04); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINS", 0x08); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINED_BY", 0x10); -WebIDLAlgorithm_1.idl_defineConst(NodeImpl.prototype, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", 0x20); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "ELEMENT_NODE", 1); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "ATTRIBUTE_NODE", 2); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "TEXT_NODE", 3); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "CDATA_SECTION_NODE", 4); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "ENTITY_REFERENCE_NODE", 5); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "ENTITY_NODE", 6); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "PROCESSING_INSTRUCTION_NODE", 7); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "COMMENT_NODE", 8); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_NODE", 9); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_TYPE_NODE", 10); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_FRAGMENT_NODE", 11); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "NOTATION_NODE", 12); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_POSITION_DISCONNECTED", 0x01); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_POSITION_PRECEDING", 0x02); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_POSITION_FOLLOWING", 0x04); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINS", 0x08); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_POSITION_CONTAINED_BY", 0x10); +(0, WebIDLAlgorithm_1.idl_defineConst)(NodeImpl.prototype, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", 0x20); //# sourceMappingURL=NodeImpl.js.map /***/ }), /***/ 61997: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var TraverserImpl_1 = __nccwpck_require__(39782); -var algorithm_1 = __nccwpck_require__(61); +exports.NodeIteratorImpl = void 0; +const TraverserImpl_1 = __nccwpck_require__(39782); +const algorithm_1 = __nccwpck_require__(61); /** * Represents an object which can be used to iterate through the nodes * of a subtree. */ -var NodeIteratorImpl = /** @class */ (function (_super) { - __extends(NodeIteratorImpl, _super); +class NodeIteratorImpl extends TraverserImpl_1.TraverserImpl { + _iteratorCollection; + _reference; + _pointerBeforeReference; /** * Initializes a new instance of `NodeIterator`. */ - function NodeIteratorImpl(root, reference, pointerBeforeReference) { - var _this = _super.call(this, root) || this; - _this._iteratorCollection = undefined; - _this._reference = reference; - _this._pointerBeforeReference = pointerBeforeReference; - algorithm_1.nodeIterator_iteratorList().add(_this); - return _this; - } - Object.defineProperty(NodeIteratorImpl.prototype, "referenceNode", { - /** @inheritdoc */ - get: function () { return this._reference; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NodeIteratorImpl.prototype, "pointerBeforeReferenceNode", { - /** @inheritdoc */ - get: function () { return this._pointerBeforeReference; }, - enumerable: true, - configurable: true - }); + constructor(root, reference, pointerBeforeReference) { + super(root); + this._iteratorCollection = undefined; + this._reference = reference; + this._pointerBeforeReference = pointerBeforeReference; + (0, algorithm_1.nodeIterator_iteratorList)().add(this); + } + /** @inheritdoc */ + get referenceNode() { return this._reference; } + /** @inheritdoc */ + get pointerBeforeReferenceNode() { return this._pointerBeforeReference; } /** @inheritdoc */ - NodeIteratorImpl.prototype.nextNode = function () { + nextNode() { /** * The nextNode() method, when invoked, must return the result of * traversing with the context object and next. */ - return algorithm_1.nodeIterator_traverse(this, true); - }; + return (0, algorithm_1.nodeIterator_traverse)(this, true); + } /** @inheritdoc */ - NodeIteratorImpl.prototype.previousNode = function () { + previousNode() { /** * The previousNode() method, when invoked, must return the result of * traversing with the context object and previous. */ - return algorithm_1.nodeIterator_traverse(this, false); - }; + return (0, algorithm_1.nodeIterator_traverse)(this, false); + } /** @inheritdoc */ - NodeIteratorImpl.prototype.detach = function () { + detach() { /** * The detach() method, when invoked, must do nothing. * * since JS lacks weak references, we still use detach */ - algorithm_1.nodeIterator_iteratorList().delete(this); - }; + (0, algorithm_1.nodeIterator_iteratorList)().delete(this); + } /** * Creates a new `NodeIterator`. * @@ -29155,66 +27299,52 @@ var NodeIteratorImpl = /** @class */ (function (_super) { * @param pointerBeforeReference - whether the iterator is before or after the * reference node */ - NodeIteratorImpl._create = function (root, reference, pointerBeforeReference) { + static _create(root, reference, pointerBeforeReference) { return new NodeIteratorImpl(root, reference, pointerBeforeReference); - }; - return NodeIteratorImpl; -}(TraverserImpl_1.TraverserImpl)); + } +} exports.NodeIteratorImpl = NodeIteratorImpl; //# sourceMappingURL=NodeIteratorImpl.js.map /***/ }), /***/ 43728: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(76195); -var algorithm_1 = __nccwpck_require__(61); +exports.NodeListImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(76195); +const algorithm_1 = __nccwpck_require__(61); /** * Represents an ordered set of nodes. */ -var NodeListImpl = /** @class */ (function () { +class NodeListImpl { + _live = true; + _root; + _filter = null; + _length = 0; /** * Initializes a new instance of `NodeList`. * * @param root - root node */ - function NodeListImpl(root) { - this._live = true; - this._filter = null; - this._length = 0; + constructor(root) { this._root = root; return new Proxy(this, this); } - Object.defineProperty(NodeListImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { - /** - * The length attribute must return the number of nodes represented - * by the collection. - */ - return this._root._children.size; - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - NodeListImpl.prototype.item = function (index) { + get length() { + /** + * The length attribute must return the number of nodes represented + * by the collection. + */ + return this._root._children.size; + } + /** @inheritdoc */ + item(index) { /** * The item(index) method must return the indexth node in the collection. * If there is no indexth node in the collection, then the method must @@ -29223,8 +27353,8 @@ var NodeListImpl = /** @class */ (function () { if (index < 0 || index > this.length - 1) return null; if (index < this.length / 2) { - var i = 0; - var node = this._root._firstChild; + let i = 0; + let node = this._root._firstChild; while (node !== null && i !== index) { node = node._nextSibling; i++; @@ -29232,21 +27362,20 @@ var NodeListImpl = /** @class */ (function () { return node; } else { - var i = this.length - 1; - var node = this._root._lastChild; + let i = this.length - 1; + let node = this._root._lastChild; while (node !== null && i !== index) { node = node._previousSibling; i--; } return node; } - }; + } /** @inheritdoc */ - NodeListImpl.prototype.keys = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var index = 0; + keys() { + return { + [Symbol.iterator]: function () { + let index = 0; return { next: function () { if (index === this.length) { @@ -29257,33 +27386,31 @@ var NodeListImpl = /** @class */ (function () { } }.bind(this) }; - }.bind(this), - _a; - }; + }.bind(this) + }; + } /** @inheritdoc */ - NodeListImpl.prototype.values = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); + values() { + return { + [Symbol.iterator]: function () { + const it = this[Symbol.iterator](); return { - next: function () { + next() { return it.next(); } }; - }.bind(this), - _a; - }; + }.bind(this) + }; + } /** @inheritdoc */ - NodeListImpl.prototype.entries = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); - var index = 0; + entries() { + return { + [Symbol.iterator]: function () { + const it = this[Symbol.iterator](); + let index = 0; return { - next: function () { - var itResult = it.next(); + next() { + const itResult = it.next(); if (itResult.done) { return { done: true, value: null }; } @@ -29292,136 +27419,112 @@ var NodeListImpl = /** @class */ (function () { } } }; - }.bind(this), - _a; - }; + }.bind(this) + }; + } /** @inheritdoc */ - NodeListImpl.prototype[Symbol.iterator] = function () { + [Symbol.iterator]() { return this._root._children[Symbol.iterator](); - }; + } /** @inheritdoc */ - NodeListImpl.prototype.forEach = function (callback, thisArg) { - var e_1, _a; + forEach(callback, thisArg) { if (thisArg === undefined) { thisArg = DOMImpl_1.dom.window; } - var index = 0; - try { - for (var _b = __values(this._root._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - callback.call(thisArg, node, index++, this); - } + let index = 0; + for (const node of this._root._children) { + callback.call(thisArg, node, index++, this); } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - }; + } /** * Implements a proxy get trap to provide array-like access. */ - NodeListImpl.prototype.get = function (target, key, receiver) { - if (!util_1.isString(key)) { + get(target, key, receiver) { + if (!(0, util_1.isString)(key)) { return Reflect.get(target, key, receiver); } - var index = Number(key); + const index = Number(key); if (isNaN(index)) { return Reflect.get(target, key, receiver); } return target.item(index) || undefined; - }; + } /** * Implements a proxy set trap to provide array-like access. */ - NodeListImpl.prototype.set = function (target, key, value, receiver) { - if (!util_1.isString(key)) { + set(target, key, value, receiver) { + if (!(0, util_1.isString)(key)) { return Reflect.set(target, key, value, receiver); } - var index = Number(key); + const index = Number(key); if (isNaN(index)) { return Reflect.set(target, key, value, receiver); } - var node = target.item(index) || undefined; + const node = target.item(index) || undefined; if (!node) return false; if (node._parent) { - algorithm_1.mutation_replace(node, value, node._parent); + (0, algorithm_1.mutation_replace)(node, value, node._parent); return true; } else { return false; } - }; + } /** * Creates a new `NodeList`. * * @param root - root node */ - NodeListImpl._create = function (root) { + static _create(root) { return new NodeListImpl(root); - }; - return NodeListImpl; -}()); + } +} exports.NodeListImpl = NodeListImpl; //# sourceMappingURL=NodeListImpl.js.map /***/ }), /***/ 65306: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var util_1 = __nccwpck_require__(76195); +exports.NodeListStaticImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const util_1 = __nccwpck_require__(76195); /** * Represents an ordered list of nodes. * This is a static implementation of `NodeList`. */ -var NodeListStaticImpl = /** @class */ (function () { +class NodeListStaticImpl { + _live = false; + _root; + _filter; + _items = []; + _length = 0; /** * Initializes a new instance of `NodeList`. * * @param root - root node */ - function NodeListStaticImpl(root) { - this._live = false; - this._items = []; - this._length = 0; + constructor(root) { this._root = root; this._items = []; this._filter = function (node) { return true; }; return new Proxy(this, this); } - Object.defineProperty(NodeListStaticImpl.prototype, "length", { - /** @inheritdoc */ - get: function () { - /** - * The length attribute must return the number of nodes represented by - * the collection. - */ - return this._items.length; - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - NodeListStaticImpl.prototype.item = function (index) { + get length() { + /** + * The length attribute must return the number of nodes represented by + * the collection. + */ + return this._items.length; + } + /** @inheritdoc */ + item(index) { /** * The item(index) method must return the indexth node in the collection. * If there is no indexth node in the collection, then the method must @@ -29430,13 +27533,12 @@ var NodeListStaticImpl = /** @class */ (function () { if (index < 0 || index > this.length - 1) return null; return this._items[index]; - }; + } /** @inheritdoc */ - NodeListStaticImpl.prototype.keys = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var index = 0; + keys() { + return { + [Symbol.iterator]: function () { + let index = 0; return { next: function () { if (index === this.length) { @@ -29447,33 +27549,31 @@ var NodeListStaticImpl = /** @class */ (function () { } }.bind(this) }; - }.bind(this), - _a; - }; + }.bind(this) + }; + } /** @inheritdoc */ - NodeListStaticImpl.prototype.values = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); + values() { + return { + [Symbol.iterator]: function () { + const it = this[Symbol.iterator](); return { - next: function () { + next() { return it.next(); } }; - }.bind(this), - _a; - }; + }.bind(this) + }; + } /** @inheritdoc */ - NodeListStaticImpl.prototype.entries = function () { - var _a; - return _a = {}, - _a[Symbol.iterator] = function () { - var it = this[Symbol.iterator](); - var index = 0; + entries() { + return { + [Symbol.iterator]: function () { + const it = this[Symbol.iterator](); + let index = 0; return { - next: function () { - var itResult = it.next(); + next() { + const itResult = it.next(); if (itResult.done) { return { done: true, value: null }; } @@ -29482,60 +27582,49 @@ var NodeListStaticImpl = /** @class */ (function () { } } }; - }.bind(this), - _a; - }; + }.bind(this) + }; + } /** @inheritdoc */ - NodeListStaticImpl.prototype[Symbol.iterator] = function () { - var it = this._items[Symbol.iterator](); + [Symbol.iterator]() { + const it = this._items[Symbol.iterator](); return { - next: function () { + next() { return it.next(); } }; - }; + } /** @inheritdoc */ - NodeListStaticImpl.prototype.forEach = function (callback, thisArg) { - var e_1, _a; + forEach(callback, thisArg) { if (thisArg === undefined) { thisArg = DOMImpl_1.dom.window; } - var index = 0; - try { - for (var _b = __values(this._items), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - callback.call(thisArg, node, index++, this); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + let index = 0; + for (const node of this._items) { + callback.call(thisArg, node, index++, this); } - }; + } /** * Implements a proxy get trap to provide array-like access. */ - NodeListStaticImpl.prototype.get = function (target, key, receiver) { - if (!util_1.isString(key)) { + get(target, key, receiver) { + if (!(0, util_1.isString)(key)) { return Reflect.get(target, key, receiver); } - var index = Number(key); + const index = Number(key); if (isNaN(index)) { return Reflect.get(target, key, receiver); } return target._items[index] || undefined; - }; + } /** * Implements a proxy set trap to provide array-like access. */ - NodeListStaticImpl.prototype.set = function (target, key, value, receiver) { - if (!util_1.isString(key)) { + set(target, key, value, receiver) { + if (!(0, util_1.isString)(key)) { return Reflect.set(target, key, value, receiver); } - var index = Number(key); + const index = Number(key); if (isNaN(index)) { return Reflect.set(target, key, value, receiver); } @@ -29546,20 +27635,19 @@ var NodeListStaticImpl = /** @class */ (function () { else { return false; } - }; + } /** * Creates a new `NodeList`. * * @param root - root node * @param items - a list of items to initialize the list */ - NodeListStaticImpl._create = function (root, items) { - var list = new NodeListStaticImpl(root); + static _create(root, items) { + const list = new NodeListStaticImpl(root); list._items = items; return list; - }; - return NodeListStaticImpl; -}()); + } +} exports.NodeListStaticImpl = NodeListStaticImpl; //# sourceMappingURL=NodeListStaticImpl.js.map @@ -29571,55 +27659,45 @@ exports.NodeListStaticImpl = NodeListStaticImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(65282); +exports.NonDocumentTypeChildNodeImpl = void 0; +const util_1 = __nccwpck_require__(65282); /** * Represents a mixin that extends child nodes that can have siblings * other than doctypes. This mixin is implemented by {@link Element} and * {@link CharacterData}. */ -var NonDocumentTypeChildNodeImpl = /** @class */ (function () { - function NonDocumentTypeChildNodeImpl() { +class NonDocumentTypeChildNodeImpl { + /** @inheritdoc */ + get previousElementSibling() { + /** + * The previousElementSibling attribute’s getter must return the first + * preceding sibling that is an element, and null otherwise. + */ + let node = util_1.Cast.asNode(this)._previousSibling; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._previousSibling; + } + return null; } - Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "previousElementSibling", { - /** @inheritdoc */ - get: function () { - /** - * The previousElementSibling attribute’s getter must return the first - * preceding sibling that is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._previousSibling; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._previousSibling; - } - return null; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NonDocumentTypeChildNodeImpl.prototype, "nextElementSibling", { - /** @inheritdoc */ - get: function () { - /** - * The nextElementSibling attribute’s getter must return the first - * following sibling that is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._nextSibling; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._nextSibling; - } - return null; - }, - enumerable: true, - configurable: true - }); - return NonDocumentTypeChildNodeImpl; -}()); + /** @inheritdoc */ + get nextElementSibling() { + /** + * The nextElementSibling attribute’s getter must return the first + * following sibling that is an element, and null otherwise. + */ + let node = util_1.Cast.asNode(this)._nextSibling; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._nextSibling; + } + return null; + } +} exports.NonDocumentTypeChildNodeImpl = NonDocumentTypeChildNodeImpl; //# sourceMappingURL=NonDocumentTypeChildNodeImpl.js.map @@ -29631,246 +27709,180 @@ exports.NonDocumentTypeChildNodeImpl = NonDocumentTypeChildNodeImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(65282); -var algorithm_1 = __nccwpck_require__(61); +exports.NonElementParentNodeImpl = void 0; +const util_1 = __nccwpck_require__(65282); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a mixin that extends non-element parent nodes. This mixin * is implemented by {@link Document} and {@link DocumentFragment}. */ -var NonElementParentNodeImpl = /** @class */ (function () { - function NonElementParentNodeImpl() { - } +class NonElementParentNodeImpl { /** @inheritdoc */ - NonElementParentNodeImpl.prototype.getElementById = function (id) { + getElementById(id) { /** * The getElementById(elementId) method, when invoked, must return the first * element, in tree order, within the context object’s descendants, * whose ID is elementId, and null if there is no such element otherwise. */ - var ele = algorithm_1.tree_getFirstDescendantNode(util_1.Cast.asNode(this), false, false, function (e) { return util_1.Guard.isElementNode(e); }); + let ele = (0, algorithm_1.tree_getFirstDescendantNode)(util_1.Cast.asNode(this), false, false, (e) => util_1.Guard.isElementNode(e)); while (ele !== null) { if (ele._uniqueIdentifier === id) { return ele; } - ele = algorithm_1.tree_getNextDescendantNode(util_1.Cast.asNode(this), ele, false, false, function (e) { return util_1.Guard.isElementNode(e); }); + ele = (0, algorithm_1.tree_getNextDescendantNode)(util_1.Cast.asNode(this), ele, false, false, (e) => util_1.Guard.isElementNode(e)); } return null; - }; - return NonElementParentNodeImpl; -}()); + } +} exports.NonElementParentNodeImpl = NonElementParentNodeImpl; //# sourceMappingURL=NonElementParentNodeImpl.js.map /***/ }), /***/ 85988: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(65282); -var algorithm_1 = __nccwpck_require__(61); +exports.ParentNodeImpl = void 0; +const util_1 = __nccwpck_require__(65282); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a mixin that extends parent nodes that can have children. * This mixin is implemented by {@link Element}, {@link Document} and * {@link DocumentFragment}. */ -var ParentNodeImpl = /** @class */ (function () { - function ParentNodeImpl() { +class ParentNodeImpl { + /** @inheritdoc */ + get children() { + /** + * The children attribute’s getter must return an HTMLCollection collection + * rooted at context object matching only element children. + */ + return (0, algorithm_1.create_htmlCollection)(util_1.Cast.asNode(this)); } - Object.defineProperty(ParentNodeImpl.prototype, "children", { - /** @inheritdoc */ - get: function () { - /** - * The children attribute’s getter must return an HTMLCollection collection - * rooted at context object matching only element children. - */ - return algorithm_1.create_htmlCollection(util_1.Cast.asNode(this)); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParentNodeImpl.prototype, "firstElementChild", { - /** @inheritdoc */ - get: function () { - /** - * The firstElementChild attribute’s getter must return the first child - * that is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._firstChild; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._nextSibling; - } - return null; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParentNodeImpl.prototype, "lastElementChild", { - /** @inheritdoc */ - get: function () { - /** - * The lastElementChild attribute’s getter must return the last child that - * is an element, and null otherwise. - */ - var node = util_1.Cast.asNode(this)._lastChild; - while (node) { - if (util_1.Guard.isElementNode(node)) - return node; - else - node = node._previousSibling; - } - return null; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ParentNodeImpl.prototype, "childElementCount", { - /** @inheritdoc */ - get: function () { - var e_1, _a; - /** - * The childElementCount attribute’s getter must return the number of - * children of context object that are elements. - */ - var count = 0; - try { - for (var _b = __values(util_1.Cast.asNode(this)._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - if (util_1.Guard.isElementNode(childNode)) - count++; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return count; - }, - enumerable: true, - configurable: true - }); /** @inheritdoc */ - ParentNodeImpl.prototype.prepend = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; + get firstElementChild() { + /** + * The firstElementChild attribute’s getter must return the first child + * that is an element, and null otherwise. + */ + let node = util_1.Cast.asNode(this)._firstChild; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._nextSibling; } + return null; + } + /** @inheritdoc */ + get lastElementChild() { + /** + * The lastElementChild attribute’s getter must return the last child that + * is an element, and null otherwise. + */ + let node = util_1.Cast.asNode(this)._lastChild; + while (node) { + if (util_1.Guard.isElementNode(node)) + return node; + else + node = node._previousSibling; + } + return null; + } + /** @inheritdoc */ + get childElementCount() { + /** + * The childElementCount attribute’s getter must return the number of + * children of context object that are elements. + */ + let count = 0; + for (const childNode of util_1.Cast.asNode(this)._children) { + if (util_1.Guard.isElementNode(childNode)) + count++; + } + return count; + } + /** @inheritdoc */ + prepend(...nodes) { /** * 1. Let node be the result of converting nodes into a node given nodes * and context object’s node document. * 2. Pre-insert node into context object before the context object’s first * child. */ - var node = util_1.Cast.asNode(this); - var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); - algorithm_1.mutation_preInsert(childNode, node, node._firstChild); - }; + const node = util_1.Cast.asNode(this); + const childNode = (0, algorithm_1.parentNode_convertNodesIntoANode)(nodes, node._nodeDocument); + (0, algorithm_1.mutation_preInsert)(childNode, node, node._firstChild); + } /** @inheritdoc */ - ParentNodeImpl.prototype.append = function () { - var nodes = []; - for (var _i = 0; _i < arguments.length; _i++) { - nodes[_i] = arguments[_i]; - } + append(...nodes) { /** * 1. Let node be the result of converting nodes into a node given nodes * and context object’s node document. * 2. Append node to context object. */ - var node = util_1.Cast.asNode(this); - var childNode = algorithm_1.parentNode_convertNodesIntoANode(nodes, node._nodeDocument); - algorithm_1.mutation_append(childNode, node); - }; + const node = util_1.Cast.asNode(this); + const childNode = (0, algorithm_1.parentNode_convertNodesIntoANode)(nodes, node._nodeDocument); + (0, algorithm_1.mutation_append)(childNode, node); + } /** @inheritdoc */ - ParentNodeImpl.prototype.querySelector = function (selectors) { + querySelector(selectors) { /** * The querySelector(selectors) method, when invoked, must return the first * result of running scope-match a selectors string selectors against * context object, if the result is not an empty list, and null otherwise. */ - var node = util_1.Cast.asNode(this); - var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); + const node = util_1.Cast.asNode(this); + const result = (0, algorithm_1.selectors_scopeMatchASelectorsString)(selectors, node); return (result.length === 0 ? null : result[0]); - }; + } /** @inheritdoc */ - ParentNodeImpl.prototype.querySelectorAll = function (selectors) { + querySelectorAll(selectors) { /** * The querySelectorAll(selectors) method, when invoked, must return the * static result of running scope-match a selectors string selectors against * context object. */ - var node = util_1.Cast.asNode(this); - var result = algorithm_1.selectors_scopeMatchASelectorsString(selectors, node); - return algorithm_1.create_nodeListStatic(node, result); - }; - return ParentNodeImpl; -}()); + const node = util_1.Cast.asNode(this); + const result = (0, algorithm_1.selectors_scopeMatchASelectorsString)(selectors, node); + return (0, algorithm_1.create_nodeListStatic)(node, result); + } +} exports.ParentNodeImpl = ParentNodeImpl; //# sourceMappingURL=ParentNodeImpl.js.map /***/ }), /***/ 99430: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var CharacterDataImpl_1 = __nccwpck_require__(65330); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.ProcessingInstructionImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const CharacterDataImpl_1 = __nccwpck_require__(65330); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a processing instruction node. */ -var ProcessingInstructionImpl = /** @class */ (function (_super) { - __extends(ProcessingInstructionImpl, _super); +class ProcessingInstructionImpl extends CharacterDataImpl_1.CharacterDataImpl { + _nodeType = interfaces_1.NodeType.ProcessingInstruction; + _target; /** * Initializes a new instance of `ProcessingInstruction`. */ - function ProcessingInstructionImpl(target, data) { - var _this = _super.call(this, data) || this; - _this._target = target; - return _this; + constructor(target, data) { + super(data); + this._target = target; } - Object.defineProperty(ProcessingInstructionImpl.prototype, "target", { - /** - * Gets the target of the {@link ProcessingInstruction} node. - */ - get: function () { return this._target; }, - enumerable: true, - configurable: true - }); + /** + * Gets the target of the {@link ProcessingInstruction} node. + */ + get target() { return this._target; } /** * Creates a new `ProcessingInstruction`. * @@ -29878,170 +27890,150 @@ var ProcessingInstructionImpl = /** @class */ (function (_super) { * @param target - instruction target * @param data - node contents */ - ProcessingInstructionImpl._create = function (document, target, data) { - var node = new ProcessingInstructionImpl(target, data); + static _create(document, target, data) { + const node = new ProcessingInstructionImpl(target, data); node._nodeDocument = document; return node; - }; - return ProcessingInstructionImpl; -}(CharacterDataImpl_1.CharacterDataImpl)); + } +} exports.ProcessingInstructionImpl = ProcessingInstructionImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(ProcessingInstructionImpl.prototype, "_nodeType", interfaces_1.NodeType.ProcessingInstruction); +(0, WebIDLAlgorithm_1.idl_defineConst)(ProcessingInstructionImpl.prototype, "_nodeType", interfaces_1.NodeType.ProcessingInstruction); //# sourceMappingURL=ProcessingInstructionImpl.js.map /***/ }), /***/ 50166: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var DOMImpl_1 = __nccwpck_require__(14177); -var interfaces_1 = __nccwpck_require__(27305); -var AbstractRangeImpl_1 = __nccwpck_require__(57126); -var DOMException_1 = __nccwpck_require__(13166); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); -var util_1 = __nccwpck_require__(65282); +exports.RangeImpl = void 0; +const DOMImpl_1 = __nccwpck_require__(14177); +const interfaces_1 = __nccwpck_require__(27305); +const AbstractRangeImpl_1 = __nccwpck_require__(57126); +const DOMException_1 = __nccwpck_require__(13166); +const algorithm_1 = __nccwpck_require__(61); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); +const util_1 = __nccwpck_require__(65282); /** * Represents a live range. */ -var RangeImpl = /** @class */ (function (_super) { - __extends(RangeImpl, _super); +class RangeImpl extends AbstractRangeImpl_1.AbstractRangeImpl { + static START_TO_START = 0; + static START_TO_END = 1; + static END_TO_END = 2; + static END_TO_START = 3; + START_TO_START = 0; + START_TO_END = 1; + END_TO_END = 2; + END_TO_START = 3; + _start; + _end; /** * Initializes a new instance of `Range`. */ - function RangeImpl() { - var _this = _super.call(this) || this; + constructor() { + super(); /** * The Range() constructor, when invoked, must return a new live range with * (current global object’s associated Document, 0) as its start and end. */ - var doc = DOMImpl_1.dom.window._associatedDocument; - _this._start = [doc, 0]; - _this._end = [doc, 0]; - DOMImpl_1.dom.rangeList.add(_this); - return _this; - } - Object.defineProperty(RangeImpl.prototype, "commonAncestorContainer", { - /** @inheritdoc */ - get: function () { - /** - * 1. Let container be start node. - * 2. While container is not an inclusive ancestor of end node, let - * container be container’s parent. - * 3. Return container. - */ - var container = this._start[0]; - while (!algorithm_1.tree_isAncestorOf(this._end[0], container, true)) { - if (container._parent === null) { - throw new Error("Parent node is null."); - } - container = container._parent; + const doc = DOMImpl_1.dom.window._associatedDocument; + this._start = [doc, 0]; + this._end = [doc, 0]; + DOMImpl_1.dom.rangeList.add(this); + } + /** @inheritdoc */ + get commonAncestorContainer() { + /** + * 1. Let container be start node. + * 2. While container is not an inclusive ancestor of end node, let + * container be container’s parent. + * 3. Return container. + */ + let container = this._start[0]; + while (!(0, algorithm_1.tree_isAncestorOf)(this._end[0], container, true)) { + if (container._parent === null) { + throw new Error("Parent node is null."); } - return container; - }, - enumerable: true, - configurable: true - }); + container = container._parent; + } + return container; + } /** @inheritdoc */ - RangeImpl.prototype.setStart = function (node, offset) { + setStart(node, offset) { /** * The setStart(node, offset) method, when invoked, must set the start of * context object to boundary point (node, offset). */ - algorithm_1.range_setTheStart(this, node, offset); - }; + (0, algorithm_1.range_setTheStart)(this, node, offset); + } /** @inheritdoc */ - RangeImpl.prototype.setEnd = function (node, offset) { + setEnd(node, offset) { /** * The setEnd(node, offset) method, when invoked, must set the end of * context object to boundary point (node, offset). */ - algorithm_1.range_setTheEnd(this, node, offset); - }; + (0, algorithm_1.range_setTheEnd)(this, node, offset); + } /** @inheritdoc */ - RangeImpl.prototype.setStartBefore = function (node) { + setStartBefore(node) { /** * 1. Let parent be node’s parent. * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. * 3. Set the start of the context object to boundary point * (parent, node’s index). */ - var parent = node._parent; + let parent = node._parent; if (parent === null) throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node)); - }; + (0, algorithm_1.range_setTheStart)(this, parent, (0, algorithm_1.tree_index)(node)); + } /** @inheritdoc */ - RangeImpl.prototype.setStartAfter = function (node) { + setStartAfter(node) { /** * 1. Let parent be node’s parent. * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. * 3. Set the start of the context object to boundary point * (parent, node’s index plus 1). */ - var parent = node._parent; + let parent = node._parent; if (parent === null) throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheStart(this, parent, algorithm_1.tree_index(node) + 1); - }; + (0, algorithm_1.range_setTheStart)(this, parent, (0, algorithm_1.tree_index)(node) + 1); + } /** @inheritdoc */ - RangeImpl.prototype.setEndBefore = function (node) { + setEndBefore(node) { /** * 1. Let parent be node’s parent. * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. * 3. Set the end of the context object to boundary point * (parent, node’s index). */ - var parent = node._parent; + let parent = node._parent; if (parent === null) throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node)); - }; + (0, algorithm_1.range_setTheEnd)(this, parent, (0, algorithm_1.tree_index)(node)); + } /** @inheritdoc */ - RangeImpl.prototype.setEndAfter = function (node) { + setEndAfter(node) { /** * 1. Let parent be node’s parent. * 2. If parent is null, then throw an "InvalidNodeTypeError" DOMException. * 3. Set the end of the context object to boundary point * (parent, node’s index plus 1). */ - var parent = node._parent; + let parent = node._parent; if (parent === null) throw new DOMException_1.InvalidNodeTypeError(); - algorithm_1.range_setTheEnd(this, parent, algorithm_1.tree_index(node) + 1); - }; + (0, algorithm_1.range_setTheEnd)(this, parent, (0, algorithm_1.tree_index)(node) + 1); + } /** @inheritdoc */ - RangeImpl.prototype.collapse = function (toStart) { + collapse(toStart) { /** * The collapse(toStart) method, when invoked, must if toStart is true, * set end to start, and set start to end otherwise. @@ -30052,17 +28044,17 @@ var RangeImpl = /** @class */ (function (_super) { else { this._start = this._end; } - }; + } /** @inheritdoc */ - RangeImpl.prototype.selectNode = function (node) { + selectNode(node) { /** * The selectNode(node) method, when invoked, must select node within * context object. */ - algorithm_1.range_select(node, this); - }; + (0, algorithm_1.range_select)(node, this); + } /** @inheritdoc */ - RangeImpl.prototype.selectNodeContents = function (node) { + selectNodeContents(node) { /** * 1. If node is a doctype, throw an "InvalidNodeTypeError" DOMException. * 2. Let length be the length of node. @@ -30071,12 +28063,12 @@ var RangeImpl = /** @class */ (function (_super) { */ if (util_1.Guard.isDocumentTypeNode(node)) throw new DOMException_1.InvalidNodeTypeError(); - var length = algorithm_1.tree_nodeLength(node); + const length = (0, algorithm_1.tree_nodeLength)(node); this._start = [node, 0]; this._end = [node, length]; - }; + } /** @inheritdoc */ - RangeImpl.prototype.compareBoundaryPoints = function (how, sourceRange) { + compareBoundaryPoints(how, sourceRange) { /** * 1. If how is not one of * - START_TO_START, @@ -30092,7 +28084,7 @@ var RangeImpl = /** @class */ (function (_super) { * 2. If context object’s root is not the same as sourceRange’s root, * then throw a "WrongDocumentError" DOMException. */ - if (algorithm_1.range_root(this) !== algorithm_1.range_root(sourceRange)) + if ((0, algorithm_1.range_root)(this) !== (0, algorithm_1.range_root)(sourceRange)) throw new DOMException_1.WrongDocumentError(); /** * 3. If how is: @@ -30109,8 +28101,8 @@ var RangeImpl = /** @class */ (function (_super) { * Let this point be the context object’s start. Let other point be * sourceRange’s end. */ - var thisPoint; - var otherPoint; + let thisPoint; + let otherPoint; switch (how) { case interfaces_1.HowToCompare.StartToStart: thisPoint = this._start; @@ -30141,7 +28133,7 @@ var RangeImpl = /** @class */ (function (_super) { * - after * Return 1. */ - var position = algorithm_1.boundaryPoint_position(thisPoint, otherPoint); + const position = (0, algorithm_1.boundaryPoint_position)(thisPoint, otherPoint); if (position === interfaces_1.BoundaryPosition.Before) { return -1; } @@ -30151,22 +28143,21 @@ var RangeImpl = /** @class */ (function (_super) { else { return 0; } - }; + } /** @inheritdoc */ - RangeImpl.prototype.deleteContents = function () { - var e_1, _a, e_2, _b; + deleteContents() { /** * 1. If the context object is collapsed, then return. * 2. Let original start node, original start offset, original end node, * and original end offset be the context object’s start node, * start offset, end node, and end offset, respectively. */ - if (algorithm_1.range_collapsed(this)) + if ((0, algorithm_1.range_collapsed)(this)) return; - var originalStartNode = this._startNode; - var originalStartOffset = this._startOffset; - var originalEndNode = this._endNode; - var originalEndOffset = this._endOffset; + const originalStartNode = this._startNode; + const originalStartOffset = this._startOffset; + const originalEndNode = this._endNode; + const originalEndOffset = this._endOffset; /** * 3. If original start node and original end node are the same, and they * are a Text, ProcessingInstruction, or Comment node, replace data with @@ -30176,7 +28167,7 @@ var RangeImpl = /** @class */ (function (_super) { */ if (originalStartNode === originalEndNode && util_1.Guard.isCharacterDataNode(originalStartNode)) { - algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); + (0, algorithm_1.characterData_replaceData)(originalStartNode, originalStartOffset, originalEndOffset - originalStartOffset, ''); return; } /** @@ -30184,27 +28175,17 @@ var RangeImpl = /** @class */ (function (_super) { * the context object, in tree order, omitting any node whose parent is also * contained in the context object. */ - var nodesToRemove = []; - try { - for (var _c = __values(algorithm_1.range_getContainedNodes(this)), _d = _c.next(); !_d.done; _d = _c.next()) { - var node = _d.value; - var parent = node._parent; - if (parent !== null && algorithm_1.range_isContained(parent, this)) { - continue; - } - nodesToRemove.push(node); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); + const nodesToRemove = []; + for (const node of (0, algorithm_1.range_getContainedNodes)(this)) { + const parent = node._parent; + if (parent !== null && (0, algorithm_1.range_isContained)(parent, this)) { + continue; } - finally { if (e_1) throw e_1.error; } + nodesToRemove.push(node); } - var newNode; - var newOffset; - if (algorithm_1.tree_isAncestorOf(originalEndNode, originalStartNode, true)) { + let newNode; + let newOffset; + if ((0, algorithm_1.tree_isAncestorOf)(originalEndNode, originalStartNode, true)) { /** * 5. If original start node is an inclusive ancestor of original end * node, set new node to original start node and new offset to original @@ -30222,9 +28203,9 @@ var RangeImpl = /** @class */ (function (_super) { * 6.3. Set new node to the parent of reference node, and new offset to * one plus the index of reference node. */ - var referenceNode = originalStartNode; + let referenceNode = originalStartNode; while (referenceNode._parent !== null && - !algorithm_1.tree_isAncestorOf(originalEndNode, referenceNode._parent, true)) { + !(0, algorithm_1.tree_isAncestorOf)(originalEndNode, referenceNode._parent, true)) { referenceNode = referenceNode._parent; } /* istanbul ignore next */ @@ -30232,7 +28213,7 @@ var RangeImpl = /** @class */ (function (_super) { throw new Error("Parent node is null."); } newNode = referenceNode._parent; - newOffset = algorithm_1.tree_index(referenceNode) + 1; + newOffset = (0, algorithm_1.tree_index)(referenceNode) + 1; } /** * 7. If original start node is a Text, ProcessingInstruction, or Comment @@ -30241,27 +28222,17 @@ var RangeImpl = /** @class */ (function (_super) { * data the empty string. */ if (util_1.Guard.isCharacterDataNode(originalStartNode)) { - algorithm_1.characterData_replaceData(originalStartNode, originalStartOffset, algorithm_1.tree_nodeLength(originalStartNode) - originalStartOffset, ''); + (0, algorithm_1.characterData_replaceData)(originalStartNode, originalStartOffset, (0, algorithm_1.tree_nodeLength)(originalStartNode) - originalStartOffset, ''); } - try { - /** - * 8. For each node in nodes to remove, in tree order, remove node from its - * parent. - */ - for (var nodesToRemove_1 = __values(nodesToRemove), nodesToRemove_1_1 = nodesToRemove_1.next(); !nodesToRemove_1_1.done; nodesToRemove_1_1 = nodesToRemove_1.next()) { - var node = nodesToRemove_1_1.value; - /* istanbul ignore else */ - if (node._parent) { - algorithm_1.mutation_remove(node, node._parent); - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (nodesToRemove_1_1 && !nodesToRemove_1_1.done && (_b = nodesToRemove_1.return)) _b.call(nodesToRemove_1); + /** + * 8. For each node in nodes to remove, in tree order, remove node from its + * parent. + */ + for (const node of nodesToRemove) { + /* istanbul ignore else */ + if (node._parent) { + (0, algorithm_1.mutation_remove)(node, node._parent); } - finally { if (e_2) throw e_2.error; } } /** * 9. If original end node is a Text, ProcessingInstruction, or Comment @@ -30269,59 +28240,48 @@ var RangeImpl = /** @class */ (function (_super) { * end offset and data the empty string. */ if (util_1.Guard.isCharacterDataNode(originalEndNode)) { - algorithm_1.characterData_replaceData(originalEndNode, 0, originalEndOffset, ''); + (0, algorithm_1.characterData_replaceData)(originalEndNode, 0, originalEndOffset, ''); } /** * 10. Set start and end to (new node, new offset). */ this._start = [newNode, newOffset]; this._end = [newNode, newOffset]; - }; + } /** @inheritdoc */ - RangeImpl.prototype.extractContents = function () { + extractContents() { /** * The extractContents() method, when invoked, must return the result of * extracting the context object. */ - return algorithm_1.range_extract(this); - }; + return (0, algorithm_1.range_extract)(this); + } /** @inheritdoc */ - RangeImpl.prototype.cloneContents = function () { + cloneContents() { /** * The cloneContents() method, when invoked, must return the result of * cloning the contents of the context object. */ - return algorithm_1.range_cloneTheContents(this); - }; + return (0, algorithm_1.range_cloneTheContents)(this); + } /** @inheritdoc */ - RangeImpl.prototype.insertNode = function (node) { + insertNode(node) { /** * The insertNode(node) method, when invoked, must insert node into the * context object. */ - return algorithm_1.range_insert(node, this); - }; + return (0, algorithm_1.range_insert)(node, this); + } /** @inheritdoc */ - RangeImpl.prototype.surroundContents = function (newParent) { - var e_3, _a; - try { - /** - * 1. If a non-Text node is partially contained in the context object, then - * throw an "InvalidStateError" DOMException. - */ - for (var _b = __values(algorithm_1.range_getPartiallyContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - if (!util_1.Guard.isTextNode(node)) { - throw new DOMException_1.InvalidStateError(); - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + surroundContents(newParent) { + /** + * 1. If a non-Text node is partially contained in the context object, then + * throw an "InvalidStateError" DOMException. + */ + for (const node of (0, algorithm_1.range_getPartiallyContainedNodes)(this)) { + if (!util_1.Guard.isTextNode(node)) { + throw new DOMException_1.InvalidStateError(); } - finally { if (e_3) throw e_3.error; } } /** * 2. If newParent is a Document, DocumentType, or DocumentFragment node, @@ -30335,47 +28295,47 @@ var RangeImpl = /** @class */ (function (_super) { /** * 3. Let fragment be the result of extracting the context object. */ - var fragment = algorithm_1.range_extract(this); + const fragment = (0, algorithm_1.range_extract)(this); /** * 4. If newParent has children, then replace all with null within newParent. */ if ((newParent)._children.size !== 0) { - algorithm_1.mutation_replaceAll(null, newParent); + (0, algorithm_1.mutation_replaceAll)(null, newParent); } /** * 5. Insert newParent into the context object. * 6. Append fragment to newParent. */ - algorithm_1.range_insert(newParent, this); - algorithm_1.mutation_append(fragment, newParent); + (0, algorithm_1.range_insert)(newParent, this); + (0, algorithm_1.mutation_append)(fragment, newParent); /** * 7. Select newParent within the context object. */ - algorithm_1.range_select(newParent, this); - }; + (0, algorithm_1.range_select)(newParent, this); + } /** @inheritdoc */ - RangeImpl.prototype.cloneRange = function () { + cloneRange() { /** * The cloneRange() method, when invoked, must return a new live range with * the same start and end as the context object. */ - return algorithm_1.create_range(this._start, this._end); - }; + return (0, algorithm_1.create_range)(this._start, this._end); + } /** @inheritdoc */ - RangeImpl.prototype.detach = function () { + detach() { /** * The detach() method, when invoked, must do nothing. * * since JS lacks weak references, we still use detach */ DOMImpl_1.dom.rangeList.delete(this); - }; + } /** @inheritdoc */ - RangeImpl.prototype.isPointInRange = function (node, offset) { + isPointInRange(node, offset) { /** * 1. If node’s root is different from the context object’s root, return false. */ - if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { + if ((0, algorithm_1.tree_rootNode)(node) !== (0, algorithm_1.range_root)(this)) { return false; } /** @@ -30385,23 +28345,23 @@ var RangeImpl = /** @class */ (function (_super) { */ if (util_1.Guard.isDocumentTypeNode(node)) throw new DOMException_1.InvalidNodeTypeError(); - if (offset > algorithm_1.tree_nodeLength(node)) + if (offset > (0, algorithm_1.tree_nodeLength)(node)) throw new DOMException_1.IndexSizeError(); /** * 4. If (node, offset) is before start or after end, return false. */ - var bp = [node, offset]; - if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before || - algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { + const bp = [node, offset]; + if ((0, algorithm_1.boundaryPoint_position)(bp, this._start) === interfaces_1.BoundaryPosition.Before || + (0, algorithm_1.boundaryPoint_position)(bp, this._end) === interfaces_1.BoundaryPosition.After) { return false; } /** * 5. Return true. */ return true; - }; + } /** @inheritdoc */ - RangeImpl.prototype.comparePoint = function (node, offset) { + comparePoint(node, offset) { /** * 1. If node’s root is different from the context object’s root, then throw * a "WrongDocumentError" DOMException. @@ -30409,66 +28369,65 @@ var RangeImpl = /** @class */ (function (_super) { * 3. If offset is greater than node’s length, then throw an * "IndexSizeError" DOMException. */ - if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) + if ((0, algorithm_1.tree_rootNode)(node) !== (0, algorithm_1.range_root)(this)) throw new DOMException_1.WrongDocumentError(); if (util_1.Guard.isDocumentTypeNode(node)) throw new DOMException_1.InvalidNodeTypeError(); - if (offset > algorithm_1.tree_nodeLength(node)) + if (offset > (0, algorithm_1.tree_nodeLength)(node)) throw new DOMException_1.IndexSizeError(); /** * 4. If (node, offset) is before start, return −1. * 5. If (node, offset) is after end, return 1. * 6. Return 0. */ - var bp = [node, offset]; - if (algorithm_1.boundaryPoint_position(bp, this._start) === interfaces_1.BoundaryPosition.Before) { + const bp = [node, offset]; + if ((0, algorithm_1.boundaryPoint_position)(bp, this._start) === interfaces_1.BoundaryPosition.Before) { return -1; } - else if (algorithm_1.boundaryPoint_position(bp, this._end) === interfaces_1.BoundaryPosition.After) { + else if ((0, algorithm_1.boundaryPoint_position)(bp, this._end) === interfaces_1.BoundaryPosition.After) { return 1; } else { return 0; } - }; + } /** @inheritdoc */ - RangeImpl.prototype.intersectsNode = function (node) { + intersectsNode(node) { /** * 1. If node’s root is different from the context object’s root, return false. */ - if (algorithm_1.tree_rootNode(node) !== algorithm_1.range_root(this)) { + if ((0, algorithm_1.tree_rootNode)(node) !== (0, algorithm_1.range_root)(this)) { return false; } /** * 2. Let parent be node’s parent. * 3. If parent is null, return true. */ - var parent = node._parent; + const parent = node._parent; if (parent === null) return true; /** * 4. Let offset be node’s index. */ - var offset = algorithm_1.tree_index(node); + const offset = (0, algorithm_1.tree_index)(node); /** * 5. If (parent, offset) is before end and (parent, offset plus 1) is * after start, return true. */ - if (algorithm_1.boundaryPoint_position([parent, offset], this._end) === interfaces_1.BoundaryPosition.Before && - algorithm_1.boundaryPoint_position([parent, offset + 1], this._start) === interfaces_1.BoundaryPosition.After) { + if ((0, algorithm_1.boundaryPoint_position)([parent, offset], this._end) === interfaces_1.BoundaryPosition.Before && + (0, algorithm_1.boundaryPoint_position)([parent, offset + 1], this._start) === interfaces_1.BoundaryPosition.After) { return true; } /** * 6. Return false. */ return false; - }; - RangeImpl.prototype.toString = function () { - var e_4, _a; + } + toString() { /** * 1. Let s be the empty string. */ - var s = ''; + let s = ''; /** * 2. If the context object’s start node is the context object’s end node * and it is a Text node, then return the substring of that Text node’s data @@ -30486,24 +28445,14 @@ var RangeImpl = /** @class */ (function (_super) { if (util_1.Guard.isTextNode(this._startNode)) { s += this._startNode._data.substring(this._startOffset); } - try { - /** - * 4. Append the concatenation of the data of all Text nodes that are - * contained in the context object, in tree order, to s. - */ - for (var _b = __values(algorithm_1.range_getContainedNodes(this)), _c = _b.next(); !_c.done; _c = _b.next()) { - var child = _c.value; - if (util_1.Guard.isTextNode(child)) { - s += child._data; - } - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + /** + * 4. Append the concatenation of the data of all Text nodes that are + * contained in the context object, in tree order, to s. + */ + for (const child of (0, algorithm_1.range_getContainedNodes)(this)) { + if (util_1.Guard.isTextNode(child)) { + s += child._data; } - finally { if (e_4) throw e_4.error; } } /** * 5. If the context object’s end node is a Text node, then append the @@ -30517,110 +28466,85 @@ var RangeImpl = /** @class */ (function (_super) { * 6. Return s. */ return s; - }; + } /** * Creates a new `Range`. * * @param start - start point * @param end - end point */ - RangeImpl._create = function (start, end) { - var range = new RangeImpl(); + static _create(start, end) { + const range = new RangeImpl(); if (start) range._start = start; if (end) range._end = end; return range; - }; - RangeImpl.START_TO_START = 0; - RangeImpl.START_TO_END = 1; - RangeImpl.END_TO_END = 2; - RangeImpl.END_TO_START = 3; - return RangeImpl; -}(AbstractRangeImpl_1.AbstractRangeImpl)); + } +} exports.RangeImpl = RangeImpl; /** * Define constants on prototype. */ -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_START", 0); -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "START_TO_END", 1); -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_END", 2); -WebIDLAlgorithm_1.idl_defineConst(RangeImpl.prototype, "END_TO_START", 3); +(0, WebIDLAlgorithm_1.idl_defineConst)(RangeImpl.prototype, "START_TO_START", 0); +(0, WebIDLAlgorithm_1.idl_defineConst)(RangeImpl.prototype, "START_TO_END", 1); +(0, WebIDLAlgorithm_1.idl_defineConst)(RangeImpl.prototype, "END_TO_END", 2); +(0, WebIDLAlgorithm_1.idl_defineConst)(RangeImpl.prototype, "END_TO_START", 3); //# sourceMappingURL=RangeImpl.js.map /***/ }), /***/ 61911: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var DocumentFragmentImpl_1 = __nccwpck_require__(12585); -var util_1 = __nccwpck_require__(76195); -var algorithm_1 = __nccwpck_require__(61); +exports.ShadowRootImpl = void 0; +const DocumentFragmentImpl_1 = __nccwpck_require__(12585); +const util_1 = __nccwpck_require__(76195); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a shadow root. */ -var ShadowRootImpl = /** @class */ (function (_super) { - __extends(ShadowRootImpl, _super); +class ShadowRootImpl extends DocumentFragmentImpl_1.DocumentFragmentImpl { + _host; + _mode; /** * Initializes a new instance of `ShadowRoot`. * * @param host - shadow root's host element * @param mode - shadow root's mode */ - function ShadowRootImpl(host, mode) { - var _this = _super.call(this) || this; - _this._host = host; - _this._mode = mode; - return _this; - } - Object.defineProperty(ShadowRootImpl.prototype, "mode", { - /** @inheritdoc */ - get: function () { return this._mode; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ShadowRootImpl.prototype, "host", { - /** @inheritdoc */ - get: function () { return this._host; }, - enumerable: true, - configurable: true - }); + constructor(host, mode) { + super(); + this._host = host; + this._mode = mode; + } + /** @inheritdoc */ + get mode() { return this._mode; } + /** @inheritdoc */ + get host() { return this._host; } /** * Gets the parent event target for the given event. * * @param event - an event */ - ShadowRootImpl.prototype._getTheParent = function (event) { + _getTheParent(event) { /** * A shadow root’s get the parent algorithm, given an event, returns null * if event’s composed flag is unset and shadow root is the root of * event’s path’s first struct’s invocation target, and shadow root’s host * otherwise. */ - if (!event._composedFlag && !util_1.isEmpty(event._path) && - algorithm_1.tree_rootNode(event._path[0].invocationTarget) === this) { + if (!event._composedFlag && !(0, util_1.isEmpty)(event._path) && + (0, algorithm_1.tree_rootNode)(event._path[0].invocationTarget) === this) { return null; } else { return this._host; } - }; + } // MIXIN: DocumentOrShadowRoot // No elements /** @@ -30629,11 +28553,10 @@ var ShadowRootImpl = /** @class */ (function (_super) { * @param document - owner document * @param host - shadow root's host element */ - ShadowRootImpl._create = function (document, host) { + static _create(document, host) { return new ShadowRootImpl(host, "closed"); - }; - return ShadowRootImpl; -}(DocumentFragmentImpl_1.DocumentFragmentImpl)); + } +} exports.ShadowRootImpl = ShadowRootImpl; //# sourceMappingURL=ShadowRootImpl.js.map @@ -30645,74 +28568,51 @@ exports.ShadowRootImpl = ShadowRootImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var algorithm_1 = __nccwpck_require__(61); +exports.SlotableImpl = void 0; +const algorithm_1 = __nccwpck_require__(61); /** * Represents a mixin that allows nodes to become the contents of * a element. This mixin is implemented by {@link Element} and * {@link Text}. */ -var SlotableImpl = /** @class */ (function () { - function SlotableImpl() { +class SlotableImpl { + __name; + __assignedSlot; + get _name() { return this.__name || ''; } + set _name(val) { this.__name = val; } + get _assignedSlot() { return this.__assignedSlot || null; } + set _assignedSlot(val) { this.__assignedSlot = val; } + /** @inheritdoc */ + get assignedSlot() { + return (0, algorithm_1.shadowTree_findASlot)(this, true); } - Object.defineProperty(SlotableImpl.prototype, "_name", { - get: function () { return this.__name || ''; }, - set: function (val) { this.__name = val; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SlotableImpl.prototype, "_assignedSlot", { - get: function () { return this.__assignedSlot || null; }, - set: function (val) { this.__assignedSlot = val; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SlotableImpl.prototype, "assignedSlot", { - /** @inheritdoc */ - get: function () { - return algorithm_1.shadowTree_findASlot(this, true); - }, - enumerable: true, - configurable: true - }); - return SlotableImpl; -}()); +} exports.SlotableImpl = SlotableImpl; //# sourceMappingURL=SlotableImpl.js.map /***/ }), /***/ 86357: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var AbstractRangeImpl_1 = __nccwpck_require__(57126); -var DOMException_1 = __nccwpck_require__(13166); -var util_1 = __nccwpck_require__(65282); +exports.StaticRangeImpl = void 0; +const AbstractRangeImpl_1 = __nccwpck_require__(57126); +const DOMException_1 = __nccwpck_require__(13166); +const util_1 = __nccwpck_require__(65282); /** * Represents a static range. */ -var StaticRangeImpl = /** @class */ (function (_super) { - __extends(StaticRangeImpl, _super); +class StaticRangeImpl extends AbstractRangeImpl_1.AbstractRangeImpl { + _start; + _end; /** * Initializes a new instance of `StaticRange`. */ - function StaticRangeImpl(init) { - var _this = _super.call(this) || this; + constructor(init) { + super(); /** * 1. If init’s startContainer or endContainer is a DocumentType or Attr * node, then throw an "InvalidNodeTypeError" DOMException. @@ -30725,129 +28625,81 @@ var StaticRangeImpl = /** @class */ (function (_super) { util_1.Guard.isDocumentTypeNode(init.endContainer) || util_1.Guard.isAttrNode(init.endContainer)) { throw new DOMException_1.InvalidNodeTypeError(); } - _this._start = [init.startContainer, init.startOffset]; - _this._end = [init.endContainer, init.endOffset]; - return _this; + this._start = [init.startContainer, init.startOffset]; + this._end = [init.endContainer, init.endOffset]; } - return StaticRangeImpl; -}(AbstractRangeImpl_1.AbstractRangeImpl)); +} exports.StaticRangeImpl = StaticRangeImpl; //# sourceMappingURL=StaticRangeImpl.js.map /***/ }), /***/ 42191: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var CharacterDataImpl_1 = __nccwpck_require__(65330); -var algorithm_1 = __nccwpck_require__(61); -var WebIDLAlgorithm_1 = __nccwpck_require__(45457); +exports.TextImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const CharacterDataImpl_1 = __nccwpck_require__(65330); +const algorithm_1 = __nccwpck_require__(61); +const WebIDLAlgorithm_1 = __nccwpck_require__(45457); /** * Represents a text node. */ -var TextImpl = /** @class */ (function (_super) { - __extends(TextImpl, _super); +class TextImpl extends CharacterDataImpl_1.CharacterDataImpl { + _nodeType = interfaces_1.NodeType.Text; + _name = ''; + _assignedSlot = null; /** * Initializes a new instance of `Text`. * * @param data - the text content */ - function TextImpl(data) { - if (data === void 0) { data = ''; } - var _this = _super.call(this, data) || this; - _this._name = ''; - _this._assignedSlot = null; - return _this; - } - Object.defineProperty(TextImpl.prototype, "wholeText", { - /** @inheritdoc */ - get: function () { - var e_1, _a; - /** - * The wholeText attribute’s getter must return the concatenation of the - * data of the contiguous Text nodes of the context object, in tree order. - */ - var text = ''; - try { - for (var _b = __values(algorithm_1.text_contiguousTextNodes(this, true)), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - text = text + node._data; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return text; - }, - enumerable: true, - configurable: true - }); + constructor(data = '') { + super(data); + } /** @inheritdoc */ - TextImpl.prototype.splitText = function (offset) { + get wholeText() { + /** + * The wholeText attribute’s getter must return the concatenation of the + * data of the contiguous Text nodes of the context object, in tree order. + */ + let text = ''; + for (const node of (0, algorithm_1.text_contiguousTextNodes)(this, true)) { + text = text + node._data; + } + return text; + } + /** @inheritdoc */ + splitText(offset) { /** * The splitText(offset) method, when invoked, must split context object * with offset offset. */ - return algorithm_1.text_split(this, offset); - }; - Object.defineProperty(TextImpl.prototype, "assignedSlot", { - // MIXIN: Slotable - /* istanbul ignore next */ - get: function () { throw new Error("Mixin: Slotable not implemented."); }, - enumerable: true, - configurable: true - }); + return (0, algorithm_1.text_split)(this, offset); + } + // MIXIN: Slotable + /* istanbul ignore next */ + get assignedSlot() { throw new Error("Mixin: Slotable not implemented."); } /** * Creates a `Text`. * * @param document - owner document * @param data - the text content */ - TextImpl._create = function (document, data) { - if (data === void 0) { data = ''; } - var node = new TextImpl(data); + static _create(document, data = '') { + const node = new TextImpl(data); node._nodeDocument = document; return node; - }; - return TextImpl; -}(CharacterDataImpl_1.CharacterDataImpl)); + } +} exports.TextImpl = TextImpl; /** * Initialize prototype properties */ -WebIDLAlgorithm_1.idl_defineConst(TextImpl.prototype, "_nodeType", interfaces_1.NodeType.Text); +(0, WebIDLAlgorithm_1.idl_defineConst)(TextImpl.prototype, "_nodeType", interfaces_1.NodeType.Text); //# sourceMappingURL=TextImpl.js.map /***/ }), @@ -30858,97 +28710,72 @@ WebIDLAlgorithm_1.idl_defineConst(TextImpl.prototype, "_nodeType", interfaces_1. "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); +exports.TraverserImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); /** * Represents an object which can be used to iterate through the nodes * of a subtree. */ -var TraverserImpl = /** @class */ (function () { +class TraverserImpl { + _activeFlag; + _root; + _whatToShow; + _filter; /** * Initializes a new instance of `Traverser`. * * @param root - root node */ - function TraverserImpl(root) { + constructor(root) { this._activeFlag = false; this._root = root; this._whatToShow = interfaces_1.WhatToShow.All; this._filter = null; } - Object.defineProperty(TraverserImpl.prototype, "root", { - /** @inheritdoc */ - get: function () { return this._root; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TraverserImpl.prototype, "whatToShow", { - /** @inheritdoc */ - get: function () { return this._whatToShow; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TraverserImpl.prototype, "filter", { - /** @inheritdoc */ - get: function () { return this._filter; }, - enumerable: true, - configurable: true - }); - return TraverserImpl; -}()); + /** @inheritdoc */ + get root() { return this._root; } + /** @inheritdoc */ + get whatToShow() { return this._whatToShow; } + /** @inheritdoc */ + get filter() { return this._filter; } +} exports.TraverserImpl = TraverserImpl; //# sourceMappingURL=TraverserImpl.js.map /***/ }), /***/ 89261: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var TraverserImpl_1 = __nccwpck_require__(39782); -var algorithm_1 = __nccwpck_require__(61); +exports.TreeWalkerImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const TraverserImpl_1 = __nccwpck_require__(39782); +const algorithm_1 = __nccwpck_require__(61); /** * Represents the nodes of a subtree and a position within them. */ -var TreeWalkerImpl = /** @class */ (function (_super) { - __extends(TreeWalkerImpl, _super); +class TreeWalkerImpl extends TraverserImpl_1.TraverserImpl { + _current; /** * Initializes a new instance of `TreeWalker`. */ - function TreeWalkerImpl(root, current) { - var _this = _super.call(this, root) || this; - _this._current = current; - return _this; - } - Object.defineProperty(TreeWalkerImpl.prototype, "currentNode", { - /** @inheritdoc */ - get: function () { return this._current; }, - set: function (value) { this._current = value; }, - enumerable: true, - configurable: true - }); + constructor(root, current) { + super(root); + this._current = current; + } /** @inheritdoc */ - TreeWalkerImpl.prototype.parentNode = function () { + get currentNode() { return this._current; } + set currentNode(value) { this._current = value; } + /** @inheritdoc */ + parentNode() { /** * 1. Let node be the context object’s current. * 2. While node is non-null and is not the context object’s root: */ - var node = this._current; + let node = this._current; while (node !== null && node !== this._root) { /** * 2.1. Set node to node’s parent. @@ -30958,7 +28785,7 @@ var TreeWalkerImpl = /** @class */ (function (_super) { */ node = node._parent; if (node !== null && - algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { + (0, algorithm_1.traversal_filter)(this, node) === interfaces_1.FilterResult.Accept) { this._current = node; return node; } @@ -30967,44 +28794,44 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * 3. Return null. */ return null; - }; + } /** @inheritdoc */ - TreeWalkerImpl.prototype.firstChild = function () { + firstChild() { /** * The firstChild() method, when invoked, must traverse children with the * context object and first. */ - return algorithm_1.treeWalker_traverseChildren(this, true); - }; + return (0, algorithm_1.treeWalker_traverseChildren)(this, true); + } /** @inheritdoc */ - TreeWalkerImpl.prototype.lastChild = function () { + lastChild() { /** * The lastChild() method, when invoked, must traverse children with the * context object and last. */ - return algorithm_1.treeWalker_traverseChildren(this, false); - }; + return (0, algorithm_1.treeWalker_traverseChildren)(this, false); + } /** @inheritdoc */ - TreeWalkerImpl.prototype.nextSibling = function () { + nextSibling() { /** * The nextSibling() method, when invoked, must traverse siblings with the * context object and next. */ - return algorithm_1.treeWalker_traverseSiblings(this, true); - }; + return (0, algorithm_1.treeWalker_traverseSiblings)(this, true); + } /** @inheritdoc */ - TreeWalkerImpl.prototype.previousNode = function () { + previousNode() { /** * 1. Let node be the context object’s current. * 2. While node is not the context object’s root: */ - var node = this._current; + let node = this._current; while (node !== this._root) { /** * 2.1. Let sibling be node’s previous sibling. * 2.2. While sibling is non-null: */ - var sibling = node._previousSibling; + let sibling = node._previousSibling; while (sibling) { /** * 2.2.1. Set node to sibling. @@ -31012,7 +28839,7 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * object. */ node = sibling; - var result = algorithm_1.traversal_filter(this, node); + let result = (0, algorithm_1.traversal_filter)(this, node); /** * 2.2.3. While result is not FILTER_REJECT and node has a child: */ @@ -31023,7 +28850,7 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * context object. */ node = node._lastChild; - result = algorithm_1.traversal_filter(this, node); + result = (0, algorithm_1.traversal_filter)(this, node); } /** * 2.2.4. If result is FILTER_ACCEPT, then set the context object’s @@ -31054,7 +28881,7 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * FILTER_ACCEPT, then set the context object’s current to node and * return node. */ - if (algorithm_1.traversal_filter(this, node) === interfaces_1.FilterResult.Accept) { + if ((0, algorithm_1.traversal_filter)(this, node) === interfaces_1.FilterResult.Accept) { this._current = node; return node; } @@ -31063,24 +28890,24 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * 3. Return null. */ return null; - }; + } /** @inheritdoc */ - TreeWalkerImpl.prototype.previousSibling = function () { + previousSibling() { /** * The previousSibling() method, when invoked, must traverse siblings with * the context object and previous. */ - return algorithm_1.treeWalker_traverseSiblings(this, false); - }; + return (0, algorithm_1.treeWalker_traverseSiblings)(this, false); + } /** @inheritdoc */ - TreeWalkerImpl.prototype.nextNode = function () { + nextNode() { /** * 1. Let node be the context object’s current. * 2. Let result be FILTER_ACCEPT. * 3. While true: */ - var node = this._current; - var result = interfaces_1.FilterResult.Accept; + let node = this._current; + let result = interfaces_1.FilterResult.Accept; while (true) { /** * 3.1. While result is not FILTER_REJECT and node has a child: @@ -31094,7 +28921,7 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * current to node and return node. */ node = node._firstChild; - result = algorithm_1.traversal_filter(this, node); + result = (0, algorithm_1.traversal_filter)(this, node); if (result === interfaces_1.FilterResult.Accept) { this._current = node; return node; @@ -31105,8 +28932,8 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * 3.3. Let temporary be node. * 3.4. While temporary is non-null: */ - var sibling = null; - var temporary = node; + let sibling = null; + let temporary = node; while (temporary !== null) { /** * 3.4.1. If temporary is the context object’s root, then return null. @@ -31133,126 +28960,90 @@ var TreeWalkerImpl = /** @class */ (function (_super) { * 3.6. If result is FILTER_ACCEPT, then set the context object’s current * to node and return node. */ - result = algorithm_1.traversal_filter(this, node); + result = (0, algorithm_1.traversal_filter)(this, node); if (result === interfaces_1.FilterResult.Accept) { this._current = node; return node; } } - }; + } /** * Creates a new `TreeWalker`. * * @param root - iterator's root node * @param current - current node */ - TreeWalkerImpl._create = function (root, current) { + static _create(root, current) { return new TreeWalkerImpl(root, current); - }; - return TreeWalkerImpl; -}(TraverserImpl_1.TraverserImpl)); + } +} exports.TreeWalkerImpl = TreeWalkerImpl; //# sourceMappingURL=TreeWalkerImpl.js.map /***/ }), /***/ 69067: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var EventTargetImpl_1 = __nccwpck_require__(69968); -var util_1 = __nccwpck_require__(76195); -var algorithm_1 = __nccwpck_require__(61); +exports.WindowImpl = void 0; +const EventTargetImpl_1 = __nccwpck_require__(69968); +const util_1 = __nccwpck_require__(76195); +const algorithm_1 = __nccwpck_require__(61); /** * Represents a window containing a DOM document. */ -var WindowImpl = /** @class */ (function (_super) { - __extends(WindowImpl, _super); +class WindowImpl extends EventTargetImpl_1.EventTargetImpl { + _currentEvent; + _signalSlots = new Set(); + _mutationObserverMicrotaskQueued = false; + _mutationObservers = new Set(); + _associatedDocument; + _iteratorList = new util_1.FixedSizeSet(); /** * Initializes a new instance of `Window`. */ - function WindowImpl() { - var _this = _super.call(this) || this; - _this._signalSlots = new Set(); - _this._mutationObserverMicrotaskQueued = false; - _this._mutationObservers = new Set(); - _this._iteratorList = new util_1.FixedSizeSet(); - _this._associatedDocument = algorithm_1.create_document(); - return _this; - } - Object.defineProperty(WindowImpl.prototype, "document", { - /** @inheritdoc */ - get: function () { return this._associatedDocument; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(WindowImpl.prototype, "event", { - /** @inheritdoc */ - get: function () { return this._currentEvent; }, - enumerable: true, - configurable: true - }); + constructor() { + super(); + this._associatedDocument = (0, algorithm_1.create_document)(); + } + /** @inheritdoc */ + get document() { return this._associatedDocument; } + /** @inheritdoc */ + get event() { return this._currentEvent; } /** * Creates a new window with a blank document. */ - WindowImpl._create = function () { + static _create() { return new WindowImpl(); - }; - return WindowImpl; -}(EventTargetImpl_1.EventTargetImpl)); + } +} exports.WindowImpl = WindowImpl; //# sourceMappingURL=WindowImpl.js.map /***/ }), /***/ 21685: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var DocumentImpl_1 = __nccwpck_require__(14333); +exports.XMLDocumentImpl = void 0; +const DocumentImpl_1 = __nccwpck_require__(14333); /** * Represents an XML document. */ -var XMLDocumentImpl = /** @class */ (function (_super) { - __extends(XMLDocumentImpl, _super); +class XMLDocumentImpl extends DocumentImpl_1.DocumentImpl { /** * Initializes a new instance of `XMLDocument`. */ - function XMLDocumentImpl() { - return _super.call(this) || this; + constructor() { + super(); } - return XMLDocumentImpl; -}(DocumentImpl_1.DocumentImpl)); +} exports.XMLDocumentImpl = XMLDocumentImpl; //# sourceMappingURL=XMLDocumentImpl.js.map @@ -31264,105 +29055,106 @@ exports.XMLDocumentImpl = XMLDocumentImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); +exports.XMLDocument = exports.Window = exports.TreeWalker = exports.Traverser = exports.Text = exports.StaticRange = exports.ShadowRoot = exports.Range = exports.ProcessingInstruction = exports.NodeListStatic = exports.NodeList = exports.NodeIterator = exports.Node = exports.NodeFilter = exports.NamedNodeMap = exports.MutationRecord = exports.MutationObserver = exports.HTMLCollection = exports.EventTarget = exports.Event = exports.Element = exports.DOMTokenList = exports.DOMImplementation = exports.dom = exports.DocumentType = exports.Document = exports.DocumentFragment = exports.CustomEvent = exports.Comment = exports.CharacterData = exports.CDATASection = exports.Attr = exports.AbstractRange = exports.AbortSignal = exports.AbortController = void 0; +const util_1 = __nccwpck_require__(76195); // Import implementation classes -var AbortControllerImpl_1 = __nccwpck_require__(66461); -exports.AbortController = AbortControllerImpl_1.AbortControllerImpl; -var AbortSignalImpl_1 = __nccwpck_require__(10022); -exports.AbortSignal = AbortSignalImpl_1.AbortSignalImpl; -var AbstractRangeImpl_1 = __nccwpck_require__(57126); -exports.AbstractRange = AbstractRangeImpl_1.AbstractRangeImpl; -var AttrImpl_1 = __nccwpck_require__(13717); -exports.Attr = AttrImpl_1.AttrImpl; -var CDATASectionImpl_1 = __nccwpck_require__(23977); -exports.CDATASection = CDATASectionImpl_1.CDATASectionImpl; -var CharacterDataImpl_1 = __nccwpck_require__(65330); -exports.CharacterData = CharacterDataImpl_1.CharacterDataImpl; -var ChildNodeImpl_1 = __nccwpck_require__(88264); -var CommentImpl_1 = __nccwpck_require__(20930); -exports.Comment = CommentImpl_1.CommentImpl; -var CustomEventImpl_1 = __nccwpck_require__(59857); -exports.CustomEvent = CustomEventImpl_1.CustomEventImpl; -var DocumentFragmentImpl_1 = __nccwpck_require__(12585); -exports.DocumentFragment = DocumentFragmentImpl_1.DocumentFragmentImpl; -var DocumentImpl_1 = __nccwpck_require__(14333); -exports.Document = DocumentImpl_1.DocumentImpl; -var DocumentOrShadowRootImpl_1 = __nccwpck_require__(65274); -var DocumentTypeImpl_1 = __nccwpck_require__(3173); -exports.DocumentType = DocumentTypeImpl_1.DocumentTypeImpl; -var DOMImpl_1 = __nccwpck_require__(14177); -exports.dom = DOMImpl_1.dom; -var DOMImplementationImpl_1 = __nccwpck_require__(42197); -exports.DOMImplementation = DOMImplementationImpl_1.DOMImplementationImpl; -var DOMTokenListImpl_1 = __nccwpck_require__(65096); -exports.DOMTokenList = DOMTokenListImpl_1.DOMTokenListImpl; -var ElementImpl_1 = __nccwpck_require__(35975); -exports.Element = ElementImpl_1.ElementImpl; -var EventImpl_1 = __nccwpck_require__(38245); -exports.Event = EventImpl_1.EventImpl; -var EventTargetImpl_1 = __nccwpck_require__(69968); -exports.EventTarget = EventTargetImpl_1.EventTargetImpl; -var HTMLCollectionImpl_1 = __nccwpck_require__(93969); -exports.HTMLCollection = HTMLCollectionImpl_1.HTMLCollectionImpl; -var MutationObserverImpl_1 = __nccwpck_require__(89616); -exports.MutationObserver = MutationObserverImpl_1.MutationObserverImpl; -var MutationRecordImpl_1 = __nccwpck_require__(6219); -exports.MutationRecord = MutationRecordImpl_1.MutationRecordImpl; -var NamedNodeMapImpl_1 = __nccwpck_require__(57206); -exports.NamedNodeMap = NamedNodeMapImpl_1.NamedNodeMapImpl; -var NodeFilterImpl_1 = __nccwpck_require__(12355); -exports.NodeFilter = NodeFilterImpl_1.NodeFilterImpl; -var NodeImpl_1 = __nccwpck_require__(91745); -exports.Node = NodeImpl_1.NodeImpl; -var NodeIteratorImpl_1 = __nccwpck_require__(61997); -exports.NodeIterator = NodeIteratorImpl_1.NodeIteratorImpl; -var NodeListImpl_1 = __nccwpck_require__(43728); -exports.NodeList = NodeListImpl_1.NodeListImpl; -var NodeListStaticImpl_1 = __nccwpck_require__(65306); -exports.NodeListStatic = NodeListStaticImpl_1.NodeListStaticImpl; -var NonDocumentTypeChildNodeImpl_1 = __nccwpck_require__(71032); -var NonElementParentNodeImpl_1 = __nccwpck_require__(90733); -var ParentNodeImpl_1 = __nccwpck_require__(85988); -var ProcessingInstructionImpl_1 = __nccwpck_require__(99430); -exports.ProcessingInstruction = ProcessingInstructionImpl_1.ProcessingInstructionImpl; -var RangeImpl_1 = __nccwpck_require__(50166); -exports.Range = RangeImpl_1.RangeImpl; -var ShadowRootImpl_1 = __nccwpck_require__(61911); -exports.ShadowRoot = ShadowRootImpl_1.ShadowRootImpl; -var SlotableImpl_1 = __nccwpck_require__(21964); -var StaticRangeImpl_1 = __nccwpck_require__(86357); -exports.StaticRange = StaticRangeImpl_1.StaticRangeImpl; -var TextImpl_1 = __nccwpck_require__(42191); -exports.Text = TextImpl_1.TextImpl; -var TraverserImpl_1 = __nccwpck_require__(39782); -exports.Traverser = TraverserImpl_1.TraverserImpl; -var TreeWalkerImpl_1 = __nccwpck_require__(89261); -exports.TreeWalker = TreeWalkerImpl_1.TreeWalkerImpl; -var WindowImpl_1 = __nccwpck_require__(69067); -exports.Window = WindowImpl_1.WindowImpl; -var XMLDocumentImpl_1 = __nccwpck_require__(21685); -exports.XMLDocument = XMLDocumentImpl_1.XMLDocumentImpl; +const AbortControllerImpl_1 = __nccwpck_require__(66461); +Object.defineProperty(exports, "AbortController", ({ enumerable: true, get: function () { return AbortControllerImpl_1.AbortControllerImpl; } })); +const AbortSignalImpl_1 = __nccwpck_require__(10022); +Object.defineProperty(exports, "AbortSignal", ({ enumerable: true, get: function () { return AbortSignalImpl_1.AbortSignalImpl; } })); +const AbstractRangeImpl_1 = __nccwpck_require__(57126); +Object.defineProperty(exports, "AbstractRange", ({ enumerable: true, get: function () { return AbstractRangeImpl_1.AbstractRangeImpl; } })); +const AttrImpl_1 = __nccwpck_require__(13717); +Object.defineProperty(exports, "Attr", ({ enumerable: true, get: function () { return AttrImpl_1.AttrImpl; } })); +const CDATASectionImpl_1 = __nccwpck_require__(23977); +Object.defineProperty(exports, "CDATASection", ({ enumerable: true, get: function () { return CDATASectionImpl_1.CDATASectionImpl; } })); +const CharacterDataImpl_1 = __nccwpck_require__(65330); +Object.defineProperty(exports, "CharacterData", ({ enumerable: true, get: function () { return CharacterDataImpl_1.CharacterDataImpl; } })); +const ChildNodeImpl_1 = __nccwpck_require__(88264); +const CommentImpl_1 = __nccwpck_require__(20930); +Object.defineProperty(exports, "Comment", ({ enumerable: true, get: function () { return CommentImpl_1.CommentImpl; } })); +const CustomEventImpl_1 = __nccwpck_require__(59857); +Object.defineProperty(exports, "CustomEvent", ({ enumerable: true, get: function () { return CustomEventImpl_1.CustomEventImpl; } })); +const DocumentFragmentImpl_1 = __nccwpck_require__(12585); +Object.defineProperty(exports, "DocumentFragment", ({ enumerable: true, get: function () { return DocumentFragmentImpl_1.DocumentFragmentImpl; } })); +const DocumentImpl_1 = __nccwpck_require__(14333); +Object.defineProperty(exports, "Document", ({ enumerable: true, get: function () { return DocumentImpl_1.DocumentImpl; } })); +const DocumentOrShadowRootImpl_1 = __nccwpck_require__(65274); +const DocumentTypeImpl_1 = __nccwpck_require__(3173); +Object.defineProperty(exports, "DocumentType", ({ enumerable: true, get: function () { return DocumentTypeImpl_1.DocumentTypeImpl; } })); +const DOMImpl_1 = __nccwpck_require__(14177); +Object.defineProperty(exports, "dom", ({ enumerable: true, get: function () { return DOMImpl_1.dom; } })); +const DOMImplementationImpl_1 = __nccwpck_require__(42197); +Object.defineProperty(exports, "DOMImplementation", ({ enumerable: true, get: function () { return DOMImplementationImpl_1.DOMImplementationImpl; } })); +const DOMTokenListImpl_1 = __nccwpck_require__(65096); +Object.defineProperty(exports, "DOMTokenList", ({ enumerable: true, get: function () { return DOMTokenListImpl_1.DOMTokenListImpl; } })); +const ElementImpl_1 = __nccwpck_require__(35975); +Object.defineProperty(exports, "Element", ({ enumerable: true, get: function () { return ElementImpl_1.ElementImpl; } })); +const EventImpl_1 = __nccwpck_require__(38245); +Object.defineProperty(exports, "Event", ({ enumerable: true, get: function () { return EventImpl_1.EventImpl; } })); +const EventTargetImpl_1 = __nccwpck_require__(69968); +Object.defineProperty(exports, "EventTarget", ({ enumerable: true, get: function () { return EventTargetImpl_1.EventTargetImpl; } })); +const HTMLCollectionImpl_1 = __nccwpck_require__(93969); +Object.defineProperty(exports, "HTMLCollection", ({ enumerable: true, get: function () { return HTMLCollectionImpl_1.HTMLCollectionImpl; } })); +const MutationObserverImpl_1 = __nccwpck_require__(89616); +Object.defineProperty(exports, "MutationObserver", ({ enumerable: true, get: function () { return MutationObserverImpl_1.MutationObserverImpl; } })); +const MutationRecordImpl_1 = __nccwpck_require__(6219); +Object.defineProperty(exports, "MutationRecord", ({ enumerable: true, get: function () { return MutationRecordImpl_1.MutationRecordImpl; } })); +const NamedNodeMapImpl_1 = __nccwpck_require__(57206); +Object.defineProperty(exports, "NamedNodeMap", ({ enumerable: true, get: function () { return NamedNodeMapImpl_1.NamedNodeMapImpl; } })); +const NodeFilterImpl_1 = __nccwpck_require__(12355); +Object.defineProperty(exports, "NodeFilter", ({ enumerable: true, get: function () { return NodeFilterImpl_1.NodeFilterImpl; } })); +const NodeImpl_1 = __nccwpck_require__(91745); +Object.defineProperty(exports, "Node", ({ enumerable: true, get: function () { return NodeImpl_1.NodeImpl; } })); +const NodeIteratorImpl_1 = __nccwpck_require__(61997); +Object.defineProperty(exports, "NodeIterator", ({ enumerable: true, get: function () { return NodeIteratorImpl_1.NodeIteratorImpl; } })); +const NodeListImpl_1 = __nccwpck_require__(43728); +Object.defineProperty(exports, "NodeList", ({ enumerable: true, get: function () { return NodeListImpl_1.NodeListImpl; } })); +const NodeListStaticImpl_1 = __nccwpck_require__(65306); +Object.defineProperty(exports, "NodeListStatic", ({ enumerable: true, get: function () { return NodeListStaticImpl_1.NodeListStaticImpl; } })); +const NonDocumentTypeChildNodeImpl_1 = __nccwpck_require__(71032); +const NonElementParentNodeImpl_1 = __nccwpck_require__(90733); +const ParentNodeImpl_1 = __nccwpck_require__(85988); +const ProcessingInstructionImpl_1 = __nccwpck_require__(99430); +Object.defineProperty(exports, "ProcessingInstruction", ({ enumerable: true, get: function () { return ProcessingInstructionImpl_1.ProcessingInstructionImpl; } })); +const RangeImpl_1 = __nccwpck_require__(50166); +Object.defineProperty(exports, "Range", ({ enumerable: true, get: function () { return RangeImpl_1.RangeImpl; } })); +const ShadowRootImpl_1 = __nccwpck_require__(61911); +Object.defineProperty(exports, "ShadowRoot", ({ enumerable: true, get: function () { return ShadowRootImpl_1.ShadowRootImpl; } })); +const SlotableImpl_1 = __nccwpck_require__(21964); +const StaticRangeImpl_1 = __nccwpck_require__(86357); +Object.defineProperty(exports, "StaticRange", ({ enumerable: true, get: function () { return StaticRangeImpl_1.StaticRangeImpl; } })); +const TextImpl_1 = __nccwpck_require__(42191); +Object.defineProperty(exports, "Text", ({ enumerable: true, get: function () { return TextImpl_1.TextImpl; } })); +const TraverserImpl_1 = __nccwpck_require__(39782); +Object.defineProperty(exports, "Traverser", ({ enumerable: true, get: function () { return TraverserImpl_1.TraverserImpl; } })); +const TreeWalkerImpl_1 = __nccwpck_require__(89261); +Object.defineProperty(exports, "TreeWalker", ({ enumerable: true, get: function () { return TreeWalkerImpl_1.TreeWalkerImpl; } })); +const WindowImpl_1 = __nccwpck_require__(69067); +Object.defineProperty(exports, "Window", ({ enumerable: true, get: function () { return WindowImpl_1.WindowImpl; } })); +const XMLDocumentImpl_1 = __nccwpck_require__(21685); +Object.defineProperty(exports, "XMLDocument", ({ enumerable: true, get: function () { return XMLDocumentImpl_1.XMLDocumentImpl; } })); // Apply mixins // ChildNode -util_1.applyMixin(ElementImpl_1.ElementImpl, ChildNodeImpl_1.ChildNodeImpl); -util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, ChildNodeImpl_1.ChildNodeImpl); -util_1.applyMixin(DocumentTypeImpl_1.DocumentTypeImpl, ChildNodeImpl_1.ChildNodeImpl); +(0, util_1.applyMixin)(ElementImpl_1.ElementImpl, ChildNodeImpl_1.ChildNodeImpl); +(0, util_1.applyMixin)(CharacterDataImpl_1.CharacterDataImpl, ChildNodeImpl_1.ChildNodeImpl); +(0, util_1.applyMixin)(DocumentTypeImpl_1.DocumentTypeImpl, ChildNodeImpl_1.ChildNodeImpl); // DocumentOrShadowRoot -util_1.applyMixin(DocumentImpl_1.DocumentImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); -util_1.applyMixin(ShadowRootImpl_1.ShadowRootImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); +(0, util_1.applyMixin)(DocumentImpl_1.DocumentImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); +(0, util_1.applyMixin)(ShadowRootImpl_1.ShadowRootImpl, DocumentOrShadowRootImpl_1.DocumentOrShadowRootImpl); // NonDocumentTypeChildNode -util_1.applyMixin(ElementImpl_1.ElementImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); -util_1.applyMixin(CharacterDataImpl_1.CharacterDataImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); +(0, util_1.applyMixin)(ElementImpl_1.ElementImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); +(0, util_1.applyMixin)(CharacterDataImpl_1.CharacterDataImpl, NonDocumentTypeChildNodeImpl_1.NonDocumentTypeChildNodeImpl); // NonElementParentNode -util_1.applyMixin(DocumentImpl_1.DocumentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); -util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); +(0, util_1.applyMixin)(DocumentImpl_1.DocumentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); +(0, util_1.applyMixin)(DocumentFragmentImpl_1.DocumentFragmentImpl, NonElementParentNodeImpl_1.NonElementParentNodeImpl); // ParentNode -util_1.applyMixin(DocumentImpl_1.DocumentImpl, ParentNodeImpl_1.ParentNodeImpl); -util_1.applyMixin(DocumentFragmentImpl_1.DocumentFragmentImpl, ParentNodeImpl_1.ParentNodeImpl); -util_1.applyMixin(ElementImpl_1.ElementImpl, ParentNodeImpl_1.ParentNodeImpl); +(0, util_1.applyMixin)(DocumentImpl_1.DocumentImpl, ParentNodeImpl_1.ParentNodeImpl); +(0, util_1.applyMixin)(DocumentFragmentImpl_1.DocumentFragmentImpl, ParentNodeImpl_1.ParentNodeImpl); +(0, util_1.applyMixin)(ElementImpl_1.ElementImpl, ParentNodeImpl_1.ParentNodeImpl); // Slotable -util_1.applyMixin(TextImpl_1.TextImpl, SlotableImpl_1.SlotableImpl); -util_1.applyMixin(ElementImpl_1.ElementImpl, SlotableImpl_1.SlotableImpl); +(0, util_1.applyMixin)(TextImpl_1.TextImpl, SlotableImpl_1.SlotableImpl); +(0, util_1.applyMixin)(ElementImpl_1.ElementImpl, SlotableImpl_1.SlotableImpl); //# sourceMappingURL=index.js.map /***/ }), @@ -31373,6 +29165,7 @@ util_1.applyMixin(ElementImpl_1.ElementImpl, SlotableImpl_1.SlotableImpl); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HowToCompare = exports.WhatToShow = exports.FilterResult = exports.Position = exports.NodeType = exports.EventPhase = exports.BoundaryPosition = void 0; /** * Defines the position of a boundary point relative to another. */ @@ -31381,7 +29174,7 @@ var BoundaryPosition; BoundaryPosition[BoundaryPosition["Before"] = 0] = "Before"; BoundaryPosition[BoundaryPosition["Equal"] = 1] = "Equal"; BoundaryPosition[BoundaryPosition["After"] = 2] = "After"; -})(BoundaryPosition = exports.BoundaryPosition || (exports.BoundaryPosition = {})); +})(BoundaryPosition || (exports.BoundaryPosition = BoundaryPosition = {})); /** * Defines the event phase. */ @@ -31391,7 +29184,7 @@ var EventPhase; EventPhase[EventPhase["Capturing"] = 1] = "Capturing"; EventPhase[EventPhase["AtTarget"] = 2] = "AtTarget"; EventPhase[EventPhase["Bubbling"] = 3] = "Bubbling"; -})(EventPhase = exports.EventPhase || (exports.EventPhase = {})); +})(EventPhase || (exports.EventPhase = EventPhase = {})); /** * Defines the type of a node object. */ @@ -31409,20 +29202,21 @@ var NodeType; NodeType[NodeType["DocumentType"] = 10] = "DocumentType"; NodeType[NodeType["DocumentFragment"] = 11] = "DocumentFragment"; NodeType[NodeType["Notation"] = 12] = "Notation"; // historical -})(NodeType = exports.NodeType || (exports.NodeType = {})); +})(NodeType || (exports.NodeType = NodeType = {})); /** * Defines the position of a node in the document relative to another * node. */ var Position; (function (Position) { + Position[Position["SameNode"] = 0] = "SameNode"; Position[Position["Disconnected"] = 1] = "Disconnected"; Position[Position["Preceding"] = 2] = "Preceding"; Position[Position["Following"] = 4] = "Following"; Position[Position["Contains"] = 8] = "Contains"; Position[Position["ContainedBy"] = 16] = "ContainedBy"; Position[Position["ImplementationSpecific"] = 32] = "ImplementationSpecific"; -})(Position = exports.Position || (exports.Position = {})); +})(Position || (exports.Position = Position = {})); /** * Defines the return value of a filter callback. */ @@ -31431,7 +29225,7 @@ var FilterResult; FilterResult[FilterResult["Accept"] = 1] = "Accept"; FilterResult[FilterResult["Reject"] = 2] = "Reject"; FilterResult[FilterResult["Skip"] = 3] = "Skip"; -})(FilterResult = exports.FilterResult || (exports.FilterResult = {})); +})(FilterResult || (exports.FilterResult = FilterResult = {})); /** * Defines what to show in node filter. */ @@ -31450,7 +29244,7 @@ var WhatToShow; WhatToShow[WhatToShow["DocumentType"] = 512] = "DocumentType"; WhatToShow[WhatToShow["DocumentFragment"] = 1024] = "DocumentFragment"; WhatToShow[WhatToShow["Notation"] = 2048] = "Notation"; -})(WhatToShow = exports.WhatToShow || (exports.WhatToShow = {})); +})(WhatToShow || (exports.WhatToShow = WhatToShow = {})); /** * Defines how boundary points are compared. */ @@ -31460,7 +29254,7 @@ var HowToCompare; HowToCompare[HowToCompare["StartToEnd"] = 1] = "StartToEnd"; HowToCompare[HowToCompare["EndToEnd"] = 2] = "EndToEnd"; HowToCompare[HowToCompare["EndToStart"] = 3] = "EndToStart"; -})(HowToCompare = exports.HowToCompare || (exports.HowToCompare = {})); +})(HowToCompare || (exports.HowToCompare = HowToCompare = {})); //# sourceMappingURL=interfaces.js.map /***/ }), @@ -31471,14 +29265,15 @@ var HowToCompare; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var dom_1 = __nccwpck_require__(50633); +exports.XMLSerializer = exports.DOMParser = exports.DOMImplementation = void 0; +const dom_1 = __nccwpck_require__(50633); dom_1.dom.setFeatures(true); var dom_2 = __nccwpck_require__(50633); -exports.DOMImplementation = dom_2.DOMImplementation; +Object.defineProperty(exports, "DOMImplementation", ({ enumerable: true, get: function () { return dom_2.DOMImplementation; } })); var parser_1 = __nccwpck_require__(36216); -exports.DOMParser = parser_1.DOMParser; +Object.defineProperty(exports, "DOMParser", ({ enumerable: true, get: function () { return parser_1.DOMParser; } })); var serializer_1 = __nccwpck_require__(87119); -exports.XMLSerializer = serializer_1.XMLSerializer; +Object.defineProperty(exports, "XMLSerializer", ({ enumerable: true, get: function () { return serializer_1.XMLSerializer; } })); //# sourceMappingURL=index.js.map /***/ }), @@ -31489,251 +29284,200 @@ exports.XMLSerializer = serializer_1.XMLSerializer; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var algorithm_1 = __nccwpck_require__(61); -var XMLParserImpl_1 = __nccwpck_require__(64126); +exports.DOMParserImpl = void 0; +const algorithm_1 = __nccwpck_require__(61); +const XMLParserImpl_1 = __nccwpck_require__(64126); /** * Represents a parser for XML and HTML content. * * See: https://w3c.github.io/DOM-Parsing/#the-domparser-interface */ -var DOMParserImpl = /** @class */ (function () { - function DOMParserImpl() { - } +class DOMParserImpl { /** @inheritdoc */ - DOMParserImpl.prototype.parseFromString = function (source, mimeType) { + parseFromString(source, mimeType) { if (mimeType === "text/html") throw new Error('HTML parser not implemented.'); try { - var parser = new XMLParserImpl_1.XMLParserImpl(); - var doc = parser.parse(source); + const parser = new XMLParserImpl_1.XMLParserImpl(); + const doc = parser.parse(source); doc._contentType = mimeType; return doc; } catch (e) { - var errorNS = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; - var doc = algorithm_1.create_xmlDocument(); - var root = doc.createElementNS(errorNS, "parsererror"); - var ele = doc.createElementNS(errorNS, "error"); + const errorNS = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; + const doc = (0, algorithm_1.create_xmlDocument)(); + const root = doc.createElementNS(errorNS, "parsererror"); + const ele = doc.createElementNS(errorNS, "error"); ele.setAttribute("message", e.message); root.appendChild(ele); doc.appendChild(root); return doc; } - }; - return DOMParserImpl; -}()); + } +} exports.DOMParserImpl = DOMParserImpl; //# sourceMappingURL=DOMParserImpl.js.map /***/ }), /***/ 64126: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var XMLStringLexer_1 = __nccwpck_require__(47061); -var interfaces_1 = __nccwpck_require__(97707); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); -var LocalNameSet_1 = __nccwpck_require__(19049); +exports.XMLParserImpl = void 0; +const XMLStringLexer_1 = __nccwpck_require__(47061); +const interfaces_1 = __nccwpck_require__(97707); +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); +const LocalNameSet_1 = __nccwpck_require__(19049); /** * Represents a parser for XML content. * * See: https://html.spec.whatwg.org/#xml-parser */ -var XMLParserImpl = /** @class */ (function () { - function XMLParserImpl() { - } +class XMLParserImpl { /** * Parses XML content. * * @param source - a string containing XML content */ - XMLParserImpl.prototype.parse = function (source) { - var e_1, _a, e_2, _b; - var lexer = new XMLStringLexer_1.XMLStringLexer(source, { skipWhitespaceOnlyText: true }); - var doc = algorithm_1.create_document(); - var context = doc; - var token = lexer.nextToken(); + parse(source) { + const lexer = new XMLStringLexer_1.XMLStringLexer(source, { skipWhitespaceOnlyText: true }); + const doc = (0, algorithm_1.create_document)(); + let context = doc; + let token = lexer.nextToken(); while (token.type !== interfaces_1.TokenType.EOF) { switch (token.type) { case interfaces_1.TokenType.Declaration: - var declaration = token; + const declaration = token; if (declaration.version !== "1.0") { throw new Error("Invalid xml version: " + declaration.version); } break; case interfaces_1.TokenType.DocType: - var doctype = token; - if (!algorithm_1.xml_isPubidChar(doctype.pubId)) { + const doctype = token; + if (!(0, algorithm_1.xml_isPubidChar)(doctype.pubId)) { throw new Error("DocType public identifier does not match PubidChar construct."); } - if (!algorithm_1.xml_isLegalChar(doctype.sysId) || + if (!(0, algorithm_1.xml_isLegalChar)(doctype.sysId) || (doctype.sysId.indexOf('"') !== -1 && doctype.sysId.indexOf("'") !== -1)) { throw new Error("DocType system identifier contains invalid characters."); } context.appendChild(doc.implementation.createDocumentType(doctype.name, doctype.pubId, doctype.sysId)); break; case interfaces_1.TokenType.CDATA: - var cdata = token; - if (!algorithm_1.xml_isLegalChar(cdata.data) || + const cdata = token; + if (!(0, algorithm_1.xml_isLegalChar)(cdata.data) || cdata.data.indexOf("]]>") !== -1) { throw new Error("CDATA contains invalid characters."); } context.appendChild(doc.createCDATASection(cdata.data)); break; case interfaces_1.TokenType.Comment: - var comment = token; - if (!algorithm_1.xml_isLegalChar(comment.data) || + const comment = token; + if (!(0, algorithm_1.xml_isLegalChar)(comment.data) || comment.data.indexOf("--") !== -1 || comment.data.endsWith("-")) { throw new Error("Comment data contains invalid characters."); } context.appendChild(doc.createComment(comment.data)); break; case interfaces_1.TokenType.PI: - var pi = token; + const pi = token; if (pi.target.indexOf(":") !== -1 || (/^xml$/i).test(pi.target)) { throw new Error("Processing instruction target contains invalid characters."); } - if (!algorithm_1.xml_isLegalChar(pi.data) || pi.data.indexOf("?>") !== -1) { + if (!(0, algorithm_1.xml_isLegalChar)(pi.data) || pi.data.indexOf("?>") !== -1) { throw new Error("Processing instruction data contains invalid characters."); } context.appendChild(doc.createProcessingInstruction(pi.target, pi.data)); break; case interfaces_1.TokenType.Text: - var text = token; - if (!algorithm_1.xml_isLegalChar(text.data)) { + const text = token; + if (!(0, algorithm_1.xml_isLegalChar)(text.data)) { throw new Error("Text data contains invalid characters."); } - context.appendChild(doc.createTextNode(text.data)); + context.appendChild(doc.createTextNode(this._decodeText(text.data))); break; case interfaces_1.TokenType.Element: - var element = token; + const element = token; // inherit namespace from parent - var _c = __read(algorithm_1.namespace_extractQName(element.name), 2), prefix = _c[0], localName = _c[1]; - if (localName.indexOf(":") !== -1 || !algorithm_1.xml_isName(localName)) { + const [prefix, localName] = (0, algorithm_1.namespace_extractQName)(element.name); + if (localName.indexOf(":") !== -1 || !(0, algorithm_1.xml_isName)(localName)) { throw new Error("Node local name contains invalid characters."); } if (prefix === "xmlns") { throw new Error("An element cannot have the 'xmlns' prefix."); } - var namespace = context.lookupNamespaceURI(prefix); + let namespace = context.lookupNamespaceURI(prefix); // override namespace if there is a namespace declaration // attribute // also lookup namespace declaration attributes - var nsDeclarations = {}; - try { - for (var _d = (e_1 = void 0, __values(element.attributes)), _e = _d.next(); !_e.done; _e = _d.next()) { - var _f = __read(_e.value, 2), attName = _f[0], attValue = _f[1]; - if (attName === "xmlns") { - namespace = attValue; - } - else { - var _g = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _g[0], attLocalName = _g[1]; - if (attPrefix === "xmlns") { - if (attLocalName === prefix) { - namespace = attValue; - } - nsDeclarations[attLocalName] = attValue; + const nsDeclarations = {}; + for (const [attName, attValue] of element.attributes) { + if (attName === "xmlns") { + namespace = attValue; + } + else { + const [attPrefix, attLocalName] = (0, algorithm_1.namespace_extractQName)(attName); + if (attPrefix === "xmlns") { + if (attLocalName === prefix) { + namespace = attValue; } + nsDeclarations[attLocalName] = attValue; } } } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); - } - finally { if (e_1) throw e_1.error; } - } // create the DOM element node - var elementNode = (namespace !== null ? + const elementNode = (namespace !== null ? doc.createElementNS(namespace, element.name) : doc.createElement(element.name)); context.appendChild(elementNode); // assign attributes - var localNameSet = new LocalNameSet_1.LocalNameSet(); - try { - for (var _h = (e_2 = void 0, __values(element.attributes)), _j = _h.next(); !_j.done; _j = _h.next()) { - var _k = __read(_j.value, 2), attName = _k[0], attValue = _k[1]; - var _l = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _l[0], attLocalName = _l[1]; - var attNamespace = null; - if (attPrefix === "xmlns" || (attPrefix === null && attLocalName === "xmlns")) { - // namespace declaration attribute - attNamespace = infra_1.namespace.XMLNS; - } - else { - attNamespace = elementNode.lookupNamespaceURI(attPrefix); - if (attNamespace !== null && elementNode.isDefaultNamespace(attNamespace)) { - attNamespace = null; - } - else if (attNamespace === null && attPrefix !== null) { - attNamespace = nsDeclarations[attPrefix] || null; - } - } - if (localNameSet.has(attNamespace, attLocalName)) { - throw new Error("Element contains duplicate attributes."); - } - localNameSet.set(attNamespace, attLocalName); - if (attNamespace === infra_1.namespace.XMLNS) { - if (attValue === infra_1.namespace.XMLNS) { - throw new Error("XMLNS namespace is reserved."); - } + const localNameSet = new LocalNameSet_1.LocalNameSet(); + for (const [attName, attValue] of element.attributes) { + const [attPrefix, attLocalName] = (0, algorithm_1.namespace_extractQName)(attName); + let attNamespace = null; + if (attPrefix === "xmlns" || (attPrefix === null && attLocalName === "xmlns")) { + // namespace declaration attribute + attNamespace = infra_1.namespace.XMLNS; + } + else { + attNamespace = elementNode.lookupNamespaceURI(attPrefix); + if (attNamespace !== null && elementNode.isDefaultNamespace(attNamespace)) { + attNamespace = null; } - if (attLocalName.indexOf(":") !== -1 || !algorithm_1.xml_isName(attLocalName)) { - throw new Error("Attribute local name contains invalid characters."); + else if (attNamespace === null && attPrefix !== null) { + attNamespace = nsDeclarations[attPrefix] || null; } - if (attPrefix === "xmlns" && attValue === "") { - throw new Error("Empty XML namespace is not allowed."); + } + if (localNameSet.has(attNamespace, attLocalName)) { + throw new Error("Element contains duplicate attributes."); + } + localNameSet.set(attNamespace, attLocalName); + if (attNamespace === infra_1.namespace.XMLNS) { + if (attValue === infra_1.namespace.XMLNS) { + throw new Error("XMLNS namespace is reserved."); } - if (attNamespace !== null) - elementNode.setAttributeNS(attNamespace, attName, attValue); - else - elementNode.setAttribute(attName, attValue); } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_j && !_j.done && (_b = _h.return)) _b.call(_h); + if (attLocalName.indexOf(":") !== -1 || !(0, algorithm_1.xml_isName)(attLocalName)) { + throw new Error("Attribute local name contains invalid characters."); + } + if (attPrefix === "xmlns" && attValue === "") { + throw new Error("Empty XML namespace is not allowed."); } - finally { if (e_2) throw e_2.error; } + if (attNamespace !== null) + elementNode.setAttributeNS(attNamespace, attName, this._decodeAttributeValue(attValue)); + else + elementNode.setAttribute(attName, this._decodeAttributeValue(attValue)); } if (!element.selfClosing) { context = elementNode; } break; case interfaces_1.TokenType.ClosingTag: - var closingTag = token; + const closingTag = token; if (closingTag.name !== context.nodeName) { throw new Error('Closing tag name does not match opening tag name.'); } @@ -31746,52 +29490,59 @@ var XMLParserImpl = /** @class */ (function () { token = lexer.nextToken(); } return doc; - }; - return XMLParserImpl; -}()); + } + /** + * Decodes serialized text. + * + * @param text - text value to serialize + */ + _decodeText(text) { + return text == null ? text : text.replace(/</g, '<') + .replace(/>/g, '>') + .replace(/&/g, '&'); + } + /** + * Decodes serialized attribute value. + * + * @param text - attribute value to serialize + */ + _decodeAttributeValue(text) { + return text == null ? text : text.replace(/</g, '<') + .replace(/>/g, '>') + .replace(/&/g, '&'); + } +} exports.XMLParserImpl = XMLParserImpl; //# sourceMappingURL=XMLParserImpl.js.map /***/ }), /***/ 47061: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(97707); +exports.XMLStringLexer = void 0; +const interfaces_1 = __nccwpck_require__(97707); /** * Represents a lexer for XML content in a string. */ -var XMLStringLexer = /** @class */ (function () { +class XMLStringLexer { + _str; + _index; + _length; + _options = { + skipWhitespaceOnlyText: false + }; + err = { line: -1, col: -1, index: -1, str: "" }; /** * Initializes a new instance of `XMLStringLexer`. * * @param str - the string to tokenize and lex * @param options - lexer options */ - function XMLStringLexer(str, options) { - this._options = { - skipWhitespaceOnlyText: false - }; - this.err = { line: -1, col: -1, index: -1, str: "" }; + constructor(str, options) { this._str = str; this._index = 0; this._length = str.length; @@ -31802,11 +29553,11 @@ var XMLStringLexer = /** @class */ (function () { /** * Returns the next token. */ - XMLStringLexer.prototype.nextToken = function () { + nextToken() { if (this.eof()) { return { type: interfaces_1.TokenType.EOF }; } - var token = (this.skipIfStartsWith('<') ? this.openBracket() : this.text()); + let token = (this.skipIfStartsWith('<') ? this.openBracket() : this.text()); if (this._options.skipWhitespaceOnlyText) { if (token.type === interfaces_1.TokenType.Text && XMLStringLexer.isWhiteSpaceToken(token)) { @@ -31814,11 +29565,11 @@ var XMLStringLexer = /** @class */ (function () { } } return token; - }; + } /** * Branches from an opening bracket (`<`). */ - XMLStringLexer.prototype.openBracket = function () { + openBracket() { if (this.skipIfStartsWith('?')) { if (this.skipIfStartsWith('xml')) { if (XMLStringLexer.isSpace(this._str[this._index])) { @@ -31854,14 +29605,14 @@ var XMLStringLexer = /** @class */ (function () { else { return this.openTag(); } - }; + } /** * Produces an XML declaration token. */ - XMLStringLexer.prototype.declaration = function () { - var version = ''; - var encoding = ''; - var standalone = ''; + declaration() { + let version = ''; + let encoding = ''; + let standalone = ''; while (!this.eof()) { this.skipSpace(); if (this.skipIfStartsWith('?>')) { @@ -31869,7 +29620,7 @@ var XMLStringLexer = /** @class */ (function () { } else { // attribute name - var _a = __read(this.attribute(), 2), attName = _a[0], attValue = _a[1]; + const [attName, attValue] = this.attribute(); if (attName === 'version') version = attValue; else if (attName === 'encoding') @@ -31881,16 +29632,16 @@ var XMLStringLexer = /** @class */ (function () { } } this.throwError('Missing declaration end symbol `?>`'); - }; + } /** * Produces a doc type token. */ - XMLStringLexer.prototype.doctype = function () { - var pubId = ''; - var sysId = ''; + doctype() { + let pubId = ''; + let sysId = ''; // name this.skipSpace(); - var name = this.takeUntil2('[', '>', true); + const name = this.takeUntil2('[', '>', true); this.skipSpace(); if (this.skipIfStartsWith('PUBLIC')) { pubId = this.quotedString(); @@ -31913,12 +29664,12 @@ var XMLStringLexer = /** @class */ (function () { this.throwError('Missing doctype end symbol `>`'); } return { type: interfaces_1.TokenType.DocType, name: name, pubId: pubId, sysId: sysId }; - }; + } /** * Produces a processing instruction token. */ - XMLStringLexer.prototype.pi = function () { - var target = this.takeUntilStartsWith('?>', true); + pi() { + const target = this.takeUntilStartsWith('?>', true); if (this.eof()) { this.throwError('Missing processing instruction end symbol `?>`'); } @@ -31926,52 +29677,52 @@ var XMLStringLexer = /** @class */ (function () { if (this.skipIfStartsWith('?>')) { return { type: interfaces_1.TokenType.PI, target: target, data: '' }; } - var data = this.takeUntilStartsWith('?>'); + const data = this.takeUntilStartsWith('?>'); if (this.eof()) { this.throwError('Missing processing instruction end symbol `?>`'); } this.seek(2); return { type: interfaces_1.TokenType.PI, target: target, data: data }; - }; + } /** * Produces a text token. * */ - XMLStringLexer.prototype.text = function () { - var data = this.takeUntil('<'); + text() { + const data = this.takeUntil('<'); return { type: interfaces_1.TokenType.Text, data: data }; - }; + } /** * Produces a comment token. * */ - XMLStringLexer.prototype.comment = function () { - var data = this.takeUntilStartsWith('-->'); + comment() { + const data = this.takeUntilStartsWith('-->'); if (this.eof()) { this.throwError('Missing comment end symbol `-->`'); } this.seek(3); return { type: interfaces_1.TokenType.Comment, data: data }; - }; + } /** * Produces a CDATA token. * */ - XMLStringLexer.prototype.cdata = function () { - var data = this.takeUntilStartsWith(']]>'); + cdata() { + const data = this.takeUntilStartsWith(']]>'); if (this.eof()) { this.throwError('Missing CDATA end symbol `]>`'); } this.seek(3); return { type: interfaces_1.TokenType.CDATA, data: data }; - }; + } /** * Produces an element token. */ - XMLStringLexer.prototype.openTag = function () { + openTag() { // element name this.skipSpace(); - var name = this.takeUntil2('>', '/', true); + const name = this.takeUntil2('>', '/', true); this.skipSpace(); if (this.skipIfStartsWith('>')) { return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: false }; @@ -31980,7 +29731,7 @@ var XMLStringLexer = /** @class */ (function () { return { type: interfaces_1.TokenType.Element, name: name, attributes: [], selfClosing: true }; } // attributes - var attributes = []; + const attributes = []; while (!this.eof()) { // end tag this.skipSpace(); @@ -31990,66 +29741,66 @@ var XMLStringLexer = /** @class */ (function () { else if (this.skipIfStartsWith('/>')) { return { type: interfaces_1.TokenType.Element, name: name, attributes: attributes, selfClosing: true }; } - var attr = this.attribute(); + const attr = this.attribute(); attributes.push(attr); } this.throwError('Missing opening element tag end symbol `>`'); - }; + } /** * Produces a closing tag token. * */ - XMLStringLexer.prototype.closeTag = function () { + closeTag() { this.skipSpace(); - var name = this.takeUntil('>', true); + const name = this.takeUntil('>', true); this.skipSpace(); if (!this.skipIfStartsWith('>')) { this.throwError('Missing closing element tag end symbol `>`'); } return { type: interfaces_1.TokenType.ClosingTag, name: name }; - }; + } /** * Reads an attribute name, value pair */ - XMLStringLexer.prototype.attribute = function () { + attribute() { // attribute name this.skipSpace(); - var name = this.takeUntil('=', true); + const name = this.takeUntil('=', true); this.skipSpace(); if (!this.skipIfStartsWith('=')) { this.throwError('Missing equals sign before attribute value'); } // attribute value - var value = this.quotedString(); + const value = this.quotedString(); return [name, value]; - }; + } /** * Reads a string between double or single quotes. */ - XMLStringLexer.prototype.quotedString = function () { + quotedString() { this.skipSpace(); - var startQuote = this.take(1); + const startQuote = this.take(1); if (!XMLStringLexer.isQuote(startQuote)) { this.throwError('Missing start quote character before quoted value'); } - var value = this.takeUntil(startQuote); + const value = this.takeUntil(startQuote); if (!this.skipIfStartsWith(startQuote)) { this.throwError('Missing end quote character after quoted value'); } return value; - }; + } /** * Determines if the current index is at or past the end of input string. */ - XMLStringLexer.prototype.eof = function () { return this._index >= this._length; }; + eof() { return this._index >= this._length; } /** * Skips the length of the given string if the string from current position * starts with the given string. * * @param str - the string to match */ - XMLStringLexer.prototype.skipIfStartsWith = function (str) { - var strLength = str.length; + skipIfStartsWith(str) { + const strLength = str.length; if (strLength === 1) { if (this._str[this._index] === str) { this._index++; @@ -32059,57 +29810,56 @@ var XMLStringLexer = /** @class */ (function () { return false; } } - for (var i = 0; i < strLength; i++) { + for (let i = 0; i < strLength; i++) { if (this._str[this._index + i] !== str[i]) return false; } this._index += strLength; return true; - }; + } /** * Seeks a number of character codes. * * @param count - number of characters to skip */ - XMLStringLexer.prototype.seek = function (count) { + seek(count) { this._index += count; if (this._index < 0) this._index = 0; if (this._index > this._length) this._index = this._length; - }; + } /** * Skips space characters. */ - XMLStringLexer.prototype.skipSpace = function () { + skipSpace() { while (!this.eof() && (XMLStringLexer.isSpace(this._str[this._index]))) { this._index++; } - }; + } /** * Takes a given number of characters. * * @param count - character count */ - XMLStringLexer.prototype.take = function (count) { + take(count) { if (count === 1) { return this._str[this._index++]; } - var startIndex = this._index; + const startIndex = this._index; this.seek(count); return this._str.slice(startIndex, this._index); - }; + } /** * Takes characters until the next character matches `char`. * * @param char - a character to match * @param space - whether a space character stops iteration */ - XMLStringLexer.prototype.takeUntil = function (char, space) { - if (space === void 0) { space = false; } - var startIndex = this._index; + takeUntil(char, space = false) { + const startIndex = this._index; while (this._index < this._length) { - var c = this._str[this._index]; + const c = this._str[this._index]; if (c !== char && (!space || !XMLStringLexer.isSpace(c))) { this._index++; } @@ -32118,7 +29868,7 @@ var XMLStringLexer = /** @class */ (function () { } } return this._str.slice(startIndex, this._index); - }; + } /** * Takes characters until the next character matches `char1` or `char1`. * @@ -32126,11 +29876,10 @@ var XMLStringLexer = /** @class */ (function () { * @param char2 - a character to match * @param space - whether a space character stops iteration */ - XMLStringLexer.prototype.takeUntil2 = function (char1, char2, space) { - if (space === void 0) { space = false; } - var startIndex = this._index; + takeUntil2(char1, char2, space = false) { + const startIndex = this._index; while (this._index < this._length) { - var c = this._str[this._index]; + const c = this._str[this._index]; if (c !== char1 && c !== char2 && (!space || !XMLStringLexer.isSpace(c))) { this._index++; } @@ -32139,22 +29888,21 @@ var XMLStringLexer = /** @class */ (function () { } } return this._str.slice(startIndex, this._index); - }; + } /** * Takes characters until the next characters matches `str`. * * @param str - a string to match * @param space - whether a space character stops iteration */ - XMLStringLexer.prototype.takeUntilStartsWith = function (str, space) { - if (space === void 0) { space = false; } - var startIndex = this._index; - var strLength = str.length; + takeUntilStartsWith(str, space = false) { + const startIndex = this._index; + const strLength = str.length; while (this._index < this._length) { - var match = true; - for (var i = 0; i < strLength; i++) { - var c = this._str[this._index + i]; - var char = str[i]; + let match = true; + for (let i = 0; i < strLength; i++) { + const c = this._str[this._index + i]; + const char = str[i]; if (space && XMLStringLexer.isSpace(c)) { return this._str.slice(startIndex, this._index); } @@ -32169,15 +29917,15 @@ var XMLStringLexer = /** @class */ (function () { } this._index = this._length; return this._str.slice(startIndex); - }; + } /** * Skips characters until the next character matches `char`. * * @param char - a character to match */ - XMLStringLexer.prototype.skipUntil = function (char) { + skipUntil(char) { while (this._index < this._length) { - var c = this._str[this._index]; + const c = this._str[this._index]; if (c !== char) { this._index++; } @@ -32185,49 +29933,49 @@ var XMLStringLexer = /** @class */ (function () { break; } } - }; + } /** * Determines if the given token is entirely whitespace. * * @param token - the token to check */ - XMLStringLexer.isWhiteSpaceToken = function (token) { - var str = token.data; - for (var i = 0; i < str.length; i++) { - var c = str[i]; + static isWhiteSpaceToken(token) { + const str = token.data; + for (let i = 0; i < str.length; i++) { + const c = str[i]; if (c !== ' ' && c !== '\n' && c !== '\r' && c !== '\t' && c !== '\f') return false; } return true; - }; + } /** * Determines if the given character is whitespace. * * @param char - the character to check */ - XMLStringLexer.isSpace = function (char) { + static isSpace(char) { return char === ' ' || char === '\n' || char === '\r' || char === '\t'; - }; + } /** * Determines if the given character is a quote character. * * @param char - the character to check */ - XMLStringLexer.isQuote = function (char) { + static isQuote(char) { return (char === '"' || char === '\''); - }; + } /** * Throws a parser error and records the line and column numbers in the parsed * string. * * @param msg - error message */ - XMLStringLexer.prototype.throwError = function (msg) { - var regexp = /\r\n|\r|\n/g; - var match = null; - var line = 0; - var firstNewLineIndex = 0; - var lastNewlineIndex = this._str.length; + throwError(msg) { + const regexp = /\r\n|\r|\n/g; + let match = null; + let line = 0; + let firstNewLineIndex = 0; + let lastNewlineIndex = this._str.length; while ((match = regexp.exec(this._str)) !== null) { if (match === null) break; @@ -32248,15 +29996,15 @@ var XMLStringLexer = /** @class */ (function () { throw new Error(msg + "\nIndex: " + this.err.index + "\nLn: " + this.err.line + ", Col: " + this.err.col + "\nInput: " + this.err.str); - }; + } /** * Returns an iterator for the lexer. */ - XMLStringLexer.prototype[Symbol.iterator] = function () { + [Symbol.iterator]() { this._index = 0; return { next: function () { - var token = this.nextToken(); + const token = this.nextToken(); if (token.type === interfaces_1.TokenType.EOF) { return { done: true, value: null }; } @@ -32265,9 +30013,8 @@ var XMLStringLexer = /** @class */ (function () { } }.bind(this) }; - }; - return XMLStringLexer; -}()); + } +} exports.XMLStringLexer = XMLStringLexer; //# sourceMappingURL=XMLStringLexer.js.map @@ -32279,9 +30026,10 @@ exports.XMLStringLexer = XMLStringLexer; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DOMParser = void 0; // Export classes var DOMParserImpl_1 = __nccwpck_require__(98845); -exports.DOMParser = DOMParserImpl_1.DOMParserImpl; +Object.defineProperty(exports, "DOMParser", ({ enumerable: true, get: function () { return DOMParserImpl_1.DOMParserImpl; } })); //# sourceMappingURL=index.js.map /***/ }), @@ -32292,6 +30040,7 @@ exports.DOMParser = DOMParserImpl_1.DOMParserImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TokenType = void 0; /** * Defines the type of a token. */ @@ -32306,7 +30055,7 @@ var TokenType; TokenType[TokenType["PI"] = 6] = "PI"; TokenType[TokenType["Comment"] = 7] = "Comment"; TokenType[TokenType["ClosingTag"] = 8] = "ClosingTag"; -})(TokenType = exports.TokenType || (exports.TokenType = {})); +})(TokenType || (exports.TokenType = TokenType = {})); //# sourceMappingURL=interfaces.js.map /***/ }), @@ -32317,6 +30066,7 @@ var TokenType; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LocalNameSet = void 0; /** * Represents a set of unique attribute namespaceURI and localName pairs. * This set will contain tuples of unique attribute namespaceURI and @@ -32326,19 +30076,17 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); * This can occur when two otherwise identical attributes on the same * element differ only by their prefix values. */ -var LocalNameSet = /** @class */ (function () { - function LocalNameSet() { - // tuple storage - this._items = {}; - this._nullItems = {}; - } +class LocalNameSet { + // tuple storage + _items = {}; + _nullItems = {}; /** * Adds or replaces a tuple. * * @param ns - namespace URI * @param localName - attribute local name */ - LocalNameSet.prototype.set = function (ns, localName) { + set(ns, localName) { if (ns === null) { this._nullItems[localName] = true; } @@ -32349,14 +30097,14 @@ var LocalNameSet = /** @class */ (function () { this._items[ns] = {}; this._items[ns][localName] = true; } - }; + } /** * Determines if the given tuple exists in the set. * * @param ns - namespace URI * @param localName - attribute local name */ - LocalNameSet.prototype.has = function (ns, localName) { + has(ns, localName) { if (ns === null) { return this._nullItems[localName] === true; } @@ -32366,9 +30114,8 @@ var LocalNameSet = /** @class */ (function () { else { return false; } - }; - return LocalNameSet; -}()); + } +} exports.LocalNameSet = LocalNameSet; //# sourceMappingURL=LocalNameSet.js.map @@ -32380,6 +30127,7 @@ exports.LocalNameSet = LocalNameSet; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NamespacePrefixMap = void 0; /** * A namespace prefix map is a map that associates namespaceURI and namespace * prefix lists, where namespaceURI values are the map's unique keys (which can @@ -32396,41 +30144,39 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); * * See: https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map */ -var NamespacePrefixMap = /** @class */ (function () { - function NamespacePrefixMap() { - this._items = {}; - this._nullItems = []; - } +class NamespacePrefixMap { + _items = {}; + _nullItems = []; /** * Creates a copy of the map. */ - NamespacePrefixMap.prototype.copy = function () { + copy() { /** * To copy a namespace prefix map map means to copy the map's keys into a * new empty namespace prefix map, and to copy each of the values in the * namespace prefix list associated with each keys' value into a new list * which should be associated with the respective key in the new map. */ - var mapCopy = new NamespacePrefixMap(); - for (var key in this._items) { + const mapCopy = new NamespacePrefixMap(); + for (const key in this._items) { mapCopy._items[key] = this._items[key].slice(0); } mapCopy._nullItems = this._nullItems.slice(0); return mapCopy; - }; + } /** * Retrieves a preferred prefix string from the namespace prefix map. * * @param preferredPrefix - preferred prefix string * @param ns - namespace */ - NamespacePrefixMap.prototype.get = function (preferredPrefix, ns) { + get(preferredPrefix, ns) { /** * 1. Let candidates list be the result of retrieving a list from map where * there exists a key in map that matches the value of ns or if there is no * such key, then stop running these steps, and return the null value. */ - var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + const candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); if (candidatesList === null) { return null; } @@ -32440,8 +30186,8 @@ var NamespacePrefixMap = /** @class */ (function () { * * _Note:_ There will always be at least one prefix value in the list. */ - var prefix = null; - for (var i = 0; i < candidatesList.length; i++) { + let prefix = null; + for (let i = 0; i < candidatesList.length; i++) { prefix = candidatesList[i]; /** * 2.1. If prefix matches preferred prefix, then stop running these steps @@ -32456,7 +30202,7 @@ var NamespacePrefixMap = /** @class */ (function () { * running these steps and return prefix. */ return prefix; - }; + } /** * Checks if a prefix string is found in the namespace prefix map associated * with the given namespace. @@ -32464,13 +30210,13 @@ var NamespacePrefixMap = /** @class */ (function () { * @param prefix - prefix string * @param ns - namespace */ - NamespacePrefixMap.prototype.has = function (prefix, ns) { + has(prefix, ns) { /** * 1. Let candidates list be the result of retrieving a list from map where * there exists a key in map that matches the value of ns or if there is * no such key, then stop running these steps, and return false. */ - var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + const candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); if (candidatesList === null) { return false; } @@ -32479,34 +30225,34 @@ var NamespacePrefixMap = /** @class */ (function () { * return true, otherwise return false. */ return (candidatesList.indexOf(prefix) !== -1); - }; + } /** * Checks if a prefix string is found in the namespace prefix map. * * @param prefix - prefix string */ - NamespacePrefixMap.prototype.hasPrefix = function (prefix) { + hasPrefix(prefix) { if (this._nullItems.indexOf(prefix) !== -1) return true; - for (var key in this._items) { + for (const key in this._items) { if (this._items[key].indexOf(prefix) !== -1) return true; } return false; - }; + } /** * Adds a prefix string associated with a namespace to the prefix map. * * @param prefix - prefix string * @param ns - namespace */ - NamespacePrefixMap.prototype.set = function (prefix, ns) { + set(prefix, ns) { /** * 1. Let candidates list be the result of retrieving a list from map where * there exists a key in map that matches the value of ns or if there is * no such key, then let candidates list be null. */ - var candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); + const candidatesList = ns === null ? this._nullItems : (this._items[ns] || null); /** * 2. If candidates list is null, then create a new list with prefix as the * only item in the list, and associate that list with a new key ns in map. @@ -32524,61 +30270,51 @@ var NamespacePrefixMap = /** @class */ (function () { else { candidatesList.push(prefix); } - }; - return NamespacePrefixMap; -}()); + } +} exports.NamespacePrefixMap = NamespacePrefixMap; //# sourceMappingURL=NamespacePrefixMap.js.map /***/ }), /***/ 85039: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var LocalNameSet_1 = __nccwpck_require__(19049); -var NamespacePrefixMap_1 = __nccwpck_require__(90283); -var DOMException_1 = __nccwpck_require__(13166); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); +exports.XMLSerializerImpl = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const LocalNameSet_1 = __nccwpck_require__(19049); +const NamespacePrefixMap_1 = __nccwpck_require__(90283); +const DOMException_1 = __nccwpck_require__(13166); +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); /** * Represents an XML serializer. * * Implements: https://www.w3.org/TR/DOM-Parsing/#serializing */ -var XMLSerializerImpl = /** @class */ (function () { - function XMLSerializerImpl() { - } +class XMLSerializerImpl { + static _VoidElementNames = new Set(['area', 'base', 'basefont', + 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); /** @inheritdoc */ - XMLSerializerImpl.prototype.serializeToString = function (root) { + serializeToString(root) { /** * The serializeToString(root) method must produce an XML serialization * of root passing a value of false for the require well-formed parameter, * and return the result. */ return this._xmlSerialization(root, false); - }; + } /** * Produces an XML serialization of the given node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._xmlSerialization = function (node, requireWellFormed) { + _xmlSerialization(node, requireWellFormed) { // To increase performance, use a namespace-aware serializer only if the // document has namespaced elements if (node._nodeDocument === undefined || node._nodeDocument._hasNamespaces) { @@ -32598,10 +30334,10 @@ var XMLSerializerImpl = /** @class */ (function () { * serialize a node's namespaceURI (or the namespaceURI of one of node's * attributes). See the generate a prefix algorithm. */ - var namespace = null; - var prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); + const namespace = null; + const prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); prefixMap.set("xml", infra_1.namespace.XML); - var prefixIndex = { value: 1 }; + const prefixIndex = { value: 1 }; /** * 5. Return the result of running the XML serialization algorithm on node * passing the context namespace namespace, namespace prefix map prefix map, @@ -32613,7 +30349,7 @@ var XMLSerializerImpl = /** @class */ (function () { try { return this._serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); } - catch (_a) { + catch { throw new DOMException_1.InvalidStateError(); } } @@ -32621,11 +30357,11 @@ var XMLSerializerImpl = /** @class */ (function () { try { return this._serializeNode(node, requireWellFormed); } - catch (_b) { + catch { throw new DOMException_1.InvalidStateError(); } } - }; + } /** * Produces an XML serialization of a node. * @@ -32635,7 +30371,7 @@ var XMLSerializerImpl = /** @class */ (function () { * @param prefixIndex - generated namespace prefix index * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeNodeNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { + _serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { switch (node.nodeType) { case interfaces_1.NodeType.Element: return this._serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); @@ -32654,16 +30390,16 @@ var XMLSerializerImpl = /** @class */ (function () { case interfaces_1.NodeType.CData: return this._serializeCData(node, requireWellFormed); default: - throw new Error("Unknown node type: " + node.nodeType); + throw new Error(`Unknown node type: ${node.nodeType}`); } - }; + } /** * Produces an XML serialization of a node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeNode = function (node, requireWellFormed) { + _serializeNode(node, requireWellFormed) { switch (node.nodeType) { case interfaces_1.NodeType.Element: return this._serializeElement(node, requireWellFormed); @@ -32682,9 +30418,9 @@ var XMLSerializerImpl = /** @class */ (function () { case interfaces_1.NodeType.CData: return this._serializeCData(node, requireWellFormed); default: - throw new Error("Unknown node type: " + node.nodeType); + throw new Error(`Unknown node type: ${node.nodeType}`); } - }; + } /** * Produces an XML serialization of an element node. * @@ -32694,8 +30430,7 @@ var XMLSerializerImpl = /** @class */ (function () { * @param prefixIndex - generated namespace prefix index * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeElementNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { - var e_1, _a; + _serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { /** * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node * @@ -32705,7 +30440,7 @@ var XMLSerializerImpl = /** @class */ (function () { * serialization of this node would not be a well-formed element. */ if (requireWellFormed && (node.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(node.localName))) { + !(0, algorithm_1.xml_isName)(node.localName))) { throw new Error("Node local name contains invalid characters (well-formed required)."); } /** @@ -32738,15 +30473,15 @@ var XMLSerializerImpl = /** @class */ (function () { * 9. Let inherited ns be a copy of namespace. * 10. Let ns be the value of node's namespaceURI attribute. */ - var markup = "<"; - var qualifiedName = ''; - var skipEndTag = false; - var ignoreNamespaceDefinitionAttribute = false; - var map = prefixMap.copy(); - var localPrefixesMap = {}; - var localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); - var inheritedNS = namespace; - var ns = node.namespaceURI; + let markup = "<"; + let qualifiedName = ''; + let skipEndTag = false; + let ignoreNamespaceDefinitionAttribute = false; + let map = prefixMap.copy(); + let localPrefixesMap = {}; + let localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); + let inheritedNS = namespace; + let ns = node.namespaceURI; /** 11. If inherited ns is equal to ns, then: */ if (inheritedNS === ns) { /** @@ -32782,14 +30517,14 @@ var XMLSerializerImpl = /** @class */ (function () { * prefix string prefix from map given namespace ns. The above may return * null if no namespace key ns exists in map. */ - var prefix = node.prefix; + let prefix = node.prefix; /** * We don't need to run "retrieving a preferred prefix string" algorithm if * the element has no prefix and its namespace matches to the default * namespace. * See: https://github.com/web-platform-tests/wpt/pull/16703 */ - var candidatePrefix = null; + let candidatePrefix = null; if (prefix !== null || ns !== localDefaultNamespace) { candidatePrefix = map.get(prefix, ns); } @@ -32978,7 +30713,7 @@ var XMLSerializerImpl = /** @class */ (function () { * tag flag to true. * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. */ - var isHTML = (ns === infra_1.namespace.HTML); + const isHTML = (ns === infra_1.namespace.HTML); if (isHTML && node.childNodes.length === 0 && XMLSerializerImpl._VoidElementNames.has(node.localName)) { markup += " /"; @@ -33014,18 +30749,8 @@ var XMLSerializerImpl = /** @class */ (function () { // TODO: serialize template contents } else { - try { - for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + for (const childNode of node._children || node.childNodes) { + markup += this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed); } } /** @@ -33039,7 +30764,7 @@ var XMLSerializerImpl = /** @class */ (function () { * 21. Return the value of markup. */ return markup; - }; + } /** * Produces an XML serialization of a document node. * @@ -33049,8 +30774,7 @@ var XMLSerializerImpl = /** @class */ (function () { * @param prefixIndex - generated namespace prefix index * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeDocumentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { - var e_2, _a; + _serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { /** * If the require well-formed flag is set (its value is true), and this node * has no documentElement (the documentElement attribute's value is null), @@ -33074,29 +30798,19 @@ var XMLSerializerImpl = /** @class */ (function () { * * 3. Return the value of serialized document. */ - var serializedDocument = ""; - try { - for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - serializedDocument += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_2) throw e_2.error; } + let serializedDocument = ""; + for (const childNode of node._children || node.childNodes) { + serializedDocument += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); } return serializedDocument; - }; + } /** * Produces an XML serialization of a comment node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeComment = function (node, requireWellFormed) { + _serializeComment(node, requireWellFormed) { /** * If the require well-formed flag is set (its value is true), and node's * data contains characters that are not matched by the XML Char production @@ -33104,7 +30818,7 @@ var XMLSerializerImpl = /** @class */ (function () { * ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception; * the serialization of this node's data would not be well-formed. */ - if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || + if (requireWellFormed && (!(0, algorithm_1.xml_isLegalChar)(node.data) || node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) { throw new Error("Comment data contains invalid characters (well-formed required)."); } @@ -33112,7 +30826,7 @@ var XMLSerializerImpl = /** @class */ (function () { * Otherwise, return the concatenation of "". */ return ""; - }; + } /** * Produces an XML serialization of a text node. * @@ -33120,14 +30834,14 @@ var XMLSerializerImpl = /** @class */ (function () { * @param requireWellFormed - whether to check conformance * @param level - current depth of the XML tree */ - XMLSerializerImpl.prototype._serializeText = function (node, requireWellFormed) { + _serializeText(node, requireWellFormed) { /** * 1. If the require well-formed flag is set (its value is true), and * node's data contains characters that are not matched by the XML Char * production, then throw an exception; the serialization of this node's * data would not be well-formed. */ - if (requireWellFormed && !algorithm_1.xml_isLegalChar(node.data)) { + if (requireWellFormed && !(0, algorithm_1.xml_isLegalChar)(node.data)) { throw new Error("Text data contains invalid characters (well-formed required)."); } /** @@ -33137,9 +30851,9 @@ var XMLSerializerImpl = /** @class */ (function () { * 5. Replace any occurrences of ">" in markup by ">". * 6. Return the value of markup. */ - var result = ""; - for (var i = 0; i < node.data.length; i++) { - var c = node.data[i]; + let result = ""; + for (let i = 0; i < node.data.length; i++) { + const c = node.data[i]; if (c === "&") result += "&"; else if (c === "<") @@ -33150,7 +30864,7 @@ var XMLSerializerImpl = /** @class */ (function () { result += c; } return result; - }; + } /** * Produces an XML serialization of a document fragment node. * @@ -33160,8 +30874,7 @@ var XMLSerializerImpl = /** @class */ (function () { * @param prefixIndex - generated namespace prefix index * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeDocumentFragmentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed) { - var e_3, _a; + _serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { /** * 1. Let markup the empty string. * 2. For each child child of node, in tree order, run the XML serialization @@ -33169,36 +30882,26 @@ var XMLSerializerImpl = /** @class */ (function () { * index, and flag require well-formed. Concatenate the result to markup. * 3. Return the value of markup. */ - var markup = ""; - try { - for (var _b = __values(node._children || node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_3) throw e_3.error; } + let markup = ""; + for (const childNode of node._children || node.childNodes) { + markup += this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); } return markup; - }; + } /** * Produces an XML serialization of a document type node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeDocumentType = function (node, requireWellFormed) { + _serializeDocumentType(node, requireWellFormed) { /** * 1. If the require well-formed flag is true and the node's publicId * attribute contains characters that are not matched by the XML PubidChar * production, then throw an exception; the serialization of this node * would not be a well-formed document type declaration. */ - if (requireWellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) { + if (requireWellFormed && !(0, algorithm_1.xml_isPubidChar)(node.publicId)) { throw new Error("DocType public identifier does not match PubidChar construct (well-formed required)."); } /** @@ -33209,7 +30912,7 @@ var XMLSerializerImpl = /** @class */ (function () { * of this node would not be a well-formed document type declaration. */ if (requireWellFormed && - (!algorithm_1.xml_isLegalChar(node.systemId) || + (!(0, algorithm_1.xml_isLegalChar)(node.systemId) || (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { throw new Error("DocType system identifier contains invalid characters (well-formed required)."); } @@ -33249,14 +30952,14 @@ var XMLSerializerImpl = /** @class */ (function () { "" : ""; - }; + } /** * Produces an XML serialization of a processing instruction node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeProcessingInstruction = function (node, requireWellFormed) { + _serializeProcessingInstruction(node, requireWellFormed) { /** * 1. If the require well-formed flag is set (its value is true), and node's * target contains a ":" (U+003A COLON) character or is an ASCII @@ -33273,7 +30976,7 @@ var XMLSerializerImpl = /** @class */ (function () { * U+003E GREATER-THAN SIGN), then throw an exception; the serialization of * this node's data would not be well-formed. */ - if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || + if (requireWellFormed && (!(0, algorithm_1.xml_isLegalChar)(node.data) || node.data.indexOf("?>") !== -1)) { throw new Error("Processing instruction data contains invalid characters (well-formed required)."); } @@ -33287,19 +30990,19 @@ var XMLSerializerImpl = /** @class */ (function () { * 4. Return the value of markup. */ return ""; - }; + } /** * Produces an XML serialization of a CDATA node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeCData = function (node, requireWellFormed) { + _serializeCData(node, requireWellFormed) { if (requireWellFormed && (node.data.indexOf("]]>") !== -1)) { throw new Error("CDATA contains invalid characters (well-formed required)."); } return ""; - }; + } /** * Produces an XML serialization of the attributes of an element node. * @@ -33311,8 +31014,7 @@ var XMLSerializerImpl = /** @class */ (function () { * attributes * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeAttributesNS = function (node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { - var e_4, _a; + _serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { /** * 1. Let result be the empty string. * 2. Let localname set be a new empty namespace localname set. This @@ -33323,201 +31025,191 @@ var XMLSerializerImpl = /** @class */ (function () { * This can occur when two otherwise identical attributes on the same * element differ only by their prefix values. */ - var result = ""; - var localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; - try { + let result = ""; + const localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (const attr of node.attributes) { + // Optimize common case + if (!ignoreNamespaceDefinitionAttribute && !requireWellFormed && attr.namespaceURI === null) { + result += " " + attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + continue; + } /** - * 3. Loop: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - // Optimize common case - if (!ignoreNamespaceDefinitionAttribute && !requireWellFormed && attr.namespaceURI === null) { - result += " " + attr.localName + "=\"" + - this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; - continue; - } + if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); + } + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + if (requireWellFormed && localNameSet) + localNameSet.set(attr.namespaceURI, attr.localName); + let attributeNamespace = attr.namespaceURI; + let candidatePrefix = null; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + if (attributeNamespace !== null) { /** - * 3.1. If the require well-formed flag is set (its value is true), and the - * localname set contains a tuple whose values match those of a new tuple - * consisting of attr's namespaceURI attribute and localName attribute, - * then throw an exception; the serialization of this attr would fail to - * produce a well-formed element serialization. + * 3.5.1. Let candidate prefix be the result of retrieving a preferred + * prefix string from map given namespace attribute namespace with + * preferred prefix being attr's prefix value. */ - if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { - throw new Error("Element contains duplicate attributes (well-formed required)."); - } + candidatePrefix = map.get(attr.prefix, attributeNamespace); /** - * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and - * localName attribute, and add it to the localname set. - * 3.3. Let attribute namespace be the value of attr's namespaceURI value. - * 3.4. Let candidate prefix be null. + * 3.5.2. If the value of attribute namespace is the XMLNS namespace, + * then run these steps: */ - if (requireWellFormed && localNameSet) - localNameSet.set(attr.namespaceURI, attr.localName); - var attributeNamespace = attr.namespaceURI; - var candidatePrefix = null; - /** 3.5. If attribute namespace is not null, then run these sub-steps: */ - if (attributeNamespace !== null) { + if (attributeNamespace === infra_1.namespace.XMLNS) { /** - * 3.5.1. Let candidate prefix be the result of retrieving a preferred - * prefix string from map given namespace attribute namespace with - * preferred prefix being attr's prefix value. + * 3.5.2.1. If any of the following are true, then stop running these + * steps and goto Loop to visit the next attribute: + * - the attr's value is the XML namespace; + * _Note:_ The XML namespace cannot be redeclared and survive + * round-tripping (unless it defines the prefix "xml"). To avoid this + * problem, this algorithm always prefixes elements in the XML + * namespace with "xml" and drops any related definitions as seen + * in the above condition. + * - the attr's prefix is null and the ignore namespace definition + * attribute flag is true (the Element's default namespace attribute + * should be skipped); + * - the attr's prefix is not null and either + * * the attr's localName is not a key contained in the local + * prefixes map, or + * * the attr's localName is present in the local prefixes map but + * the value of the key does not match attr's value + * and furthermore that the attr's localName (as the prefix to find) + * is found in the namespace prefix map given the namespace consisting + * of the attr's value (the current namespace prefix definition was + * exactly defined previously--on an ancestor element not the current + * element whose attributes are being processed). */ - candidatePrefix = map.get(attr.prefix, attributeNamespace); + if (attr.value === infra_1.namespace.XML || + (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || + (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || + localPrefixesMap[attr.localName] !== attr.value) && + map.has(attr.localName, attr.value))) + continue; /** - * 3.5.2. If the value of attribute namespace is the XMLNS namespace, - * then run these steps: + * 3.5.2.2. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute matches the XMLNS + * namespace, then throw an exception; the serialization of this + * attribute would produce invalid XML because the XMLNS namespace + * is reserved and cannot be applied as an element's namespace via + * XML parsing. + * + * _Note:_ DOM APIs do allow creation of elements in the XMLNS + * namespace but with strict qualifications. */ - if (attributeNamespace === infra_1.namespace.XMLNS) { - /** - * 3.5.2.1. If any of the following are true, then stop running these - * steps and goto Loop to visit the next attribute: - * - the attr's value is the XML namespace; - * _Note:_ The XML namespace cannot be redeclared and survive - * round-tripping (unless it defines the prefix "xml"). To avoid this - * problem, this algorithm always prefixes elements in the XML - * namespace with "xml" and drops any related definitions as seen - * in the above condition. - * - the attr's prefix is null and the ignore namespace definition - * attribute flag is true (the Element's default namespace attribute - * should be skipped); - * - the attr's prefix is not null and either - * * the attr's localName is not a key contained in the local - * prefixes map, or - * * the attr's localName is present in the local prefixes map but - * the value of the key does not match attr's value - * and furthermore that the attr's localName (as the prefix to find) - * is found in the namespace prefix map given the namespace consisting - * of the attr's value (the current namespace prefix definition was - * exactly defined previously--on an ancestor element not the current - * element whose attributes are being processed). - */ - if (attr.value === infra_1.namespace.XML || - (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || - (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || - localPrefixesMap[attr.localName] !== attr.value) && - map.has(attr.localName, attr.value))) - continue; - /** - * 3.5.2.2. If the require well-formed flag is set (its value is true), - * and the value of attr's value attribute matches the XMLNS - * namespace, then throw an exception; the serialization of this - * attribute would produce invalid XML because the XMLNS namespace - * is reserved and cannot be applied as an element's namespace via - * XML parsing. - * - * _Note:_ DOM APIs do allow creation of elements in the XMLNS - * namespace but with strict qualifications. - */ - if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { - throw new Error("XMLNS namespace is reserved (well-formed required)."); - } - /** - * 3.5.2.3. If the require well-formed flag is set (its value is true), - * and the value of attr's value attribute is the empty string, then - * throw an exception; namespace prefix declarations cannot be used - * to undeclare a namespace (use a default namespace declaration - * instead). - */ - if (requireWellFormed && attr.value === '') { - throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."); - } - /** - * 3.5.2.4. the attr's prefix matches the string "xmlns", then let - * candidate prefix be the string "xmlns". - */ - if (attr.prefix === 'xmlns') - candidatePrefix = 'xmlns'; + if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { + throw new Error("XMLNS namespace is reserved (well-formed required)."); + } + /** + * 3.5.2.3. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute is the empty string, then + * throw an exception; namespace prefix declarations cannot be used + * to undeclare a namespace (use a default namespace declaration + * instead). + */ + if (requireWellFormed && attr.value === '') { + throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."); + } + /** + * 3.5.2.4. the attr's prefix matches the string "xmlns", then let + * candidate prefix be the string "xmlns". + */ + if (attr.prefix === 'xmlns') + candidatePrefix = 'xmlns'; + /** + * 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace. + * Run these steps: + * + * _Note:_ The (candidatePrefix === null) check is not in the spec. + * We deviate from the spec here. Otherwise a prefix is generated for + * all attributes with namespaces. + */ + } + else if (candidatePrefix === null) { + if (attr.prefix !== null && + (!map.hasPrefix(attr.prefix) || + map.has(attr.prefix, attributeNamespace))) { /** - * 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace. - * Run these steps: - * - * _Note:_ The (candidatePrefix === null) check is not in the spec. - * We deviate from the spec here. Otherwise a prefix is generated for - * all attributes with namespaces. + * Check if we can use the attribute's own prefix. + * We deviate from the spec here. + * TODO: This is not an efficient way of searching for prefixes. + * Follow developments to the spec. */ + candidatePrefix = attr.prefix; } - else if (candidatePrefix === null) { - if (attr.prefix !== null && - (!map.hasPrefix(attr.prefix) || - map.has(attr.prefix, attributeNamespace))) { - /** - * Check if we can use the attribute's own prefix. - * We deviate from the spec here. - * TODO: This is not an efficient way of searching for prefixes. - * Follow developments to the spec. - */ - candidatePrefix = attr.prefix; - } - else { - /** - * 3.5.3.1. Let candidate prefix be the result of generating a prefix - * providing map, attribute namespace, and prefix index as input. - */ - candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); - } + else { /** - * 3.5.3.2. Append the following to result, in the order listed: - * 3.5.3.2.1. " " (U+0020 SPACE); - * 3.5.3.2.2. The string "xmlns:"; - * 3.5.3.2.3. The value of candidate prefix; - * 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.5.3.2.5. The result of serializing an attribute value given - * attribute namespace and the require well-formed flag as input; - * 3.5.3.2.6. """ (U+0022 QUOTATION MARK). - */ - result += " xmlns:" + candidatePrefix + "=\"" + - this._serializeAttributeValue(attributeNamespace, requireWellFormed) + "\""; + * 3.5.3.1. Let candidate prefix be the result of generating a prefix + * providing map, attribute namespace, and prefix index as input. + */ + candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); } + /** + * 3.5.3.2. Append the following to result, in the order listed: + * 3.5.3.2.1. " " (U+0020 SPACE); + * 3.5.3.2.2. The string "xmlns:"; + * 3.5.3.2.3. The value of candidate prefix; + * 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.5.3.2.5. The result of serializing an attribute value given + * attribute namespace and the require well-formed flag as input; + * 3.5.3.2.6. """ (U+0022 QUOTATION MARK). + */ + result += " xmlns:" + candidatePrefix + "=\"" + + this._serializeAttributeValue(attributeNamespace, requireWellFormed) + "\""; } - /** - * 3.6. Append a " " (U+0020 SPACE) to result. - * 3.7. If candidate prefix is not null, then append to result the - * concatenation of candidate prefix with ":" (U+003A COLON). - */ - result += " "; - if (candidatePrefix !== null) { - result += candidatePrefix + ':'; - } - /** - * 3.8. If the require well-formed flag is set (its value is true), and - * this attr's localName attribute contains the character - * ":" (U+003A COLON) or does not match the XML Name production or - * equals "xmlns" and attribute namespace is null, then throw an - * exception; the serialization of this attr would not be a - * well-formed attribute. - */ - if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(attr.localName) || - (attr.localName === "xmlns" && attributeNamespace === null))) { - throw new Error("Attribute local name contains invalid characters (well-formed required)."); - } - /** - * 3.9. Append the following strings to result, in the order listed: - * 3.9.1. The value of attr's localName; - * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.9.3. The result of serializing an attribute value given attr's value - * attribute and the require well-formed flag as input; - * 3.9.4. """ (U+0022 QUOTATION MARK). - */ - result += attr.localName + "=\"" + - this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + result += " "; + if (candidatePrefix !== null) { + result += candidatePrefix + ':'; + } + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(attr.localName) || + (attr.localName === "xmlns" && attributeNamespace === null))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); } - finally { if (e_4) throw e_4.error; } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result += attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; } /** * 4. Return the value of result. */ return result; - }; + } /** * Records namespace information for the given element and returns the * default namespace attribute value. @@ -33526,109 +31218,98 @@ var XMLSerializerImpl = /** @class */ (function () { * @param map - namespace prefix map * @param localPrefixesMap - local prefixes map */ - XMLSerializerImpl.prototype._recordNamespaceInformation = function (node, map, localPrefixesMap) { - var e_5, _a; + _recordNamespaceInformation(node, map, localPrefixesMap) { /** * 1. Let default namespace attr value be null. */ - var defaultNamespaceAttrValue = null; - try { + let defaultNamespaceAttrValue = null; + /** + * 2. Main: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (const attr of node.attributes) { /** - * 2. Main: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: + * _Note:_ The following conditional steps find namespace prefixes. Only + * attributes in the XMLNS namespace are considered (e.g., attributes made + * to look like namespace declarations via + * setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not + * included). */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; + /** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */ + let attributeNamespace = attr.namespaceURI; + /** 2.2. Let attribute prefix be the value of attr's prefix. */ + let attributePrefix = attr.prefix; + /** 2.3. If the attribute namespace is the XMLNS namespace, then: */ + if (attributeNamespace === infra_1.namespace.XMLNS) { /** - * _Note:_ The following conditional steps find namespace prefixes. Only - * attributes in the XMLNS namespace are considered (e.g., attributes made - * to look like namespace declarations via - * setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not - * included). + * 2.3.1. If attribute prefix is null, then attr is a default namespace + * declaration. Set the default namespace attr value to attr's value and + * stop running these steps, returning to Main to visit the next + * attribute. */ - /** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */ - var attributeNamespace = attr.namespaceURI; - /** 2.2. Let attribute prefix be the value of attr's prefix. */ - var attributePrefix = attr.prefix; - /** 2.3. If the attribute namespace is the XMLNS namespace, then: */ - if (attributeNamespace === infra_1.namespace.XMLNS) { + if (attributePrefix === null) { + defaultNamespaceAttrValue = attr.value; + continue; + /** + * 2.3.2. Otherwise, the attribute prefix is not null and attr is a + * namespace prefix definition. Run the following steps: + */ + } + else { + /** 2.3.2.1. Let prefix definition be the value of attr's localName. */ + let prefixDefinition = attr.localName; + /** 2.3.2.2. Let namespace definition be the value of attr's value. */ + let namespaceDefinition = attr.value; /** - * 2.3.1. If attribute prefix is null, then attr is a default namespace - * declaration. Set the default namespace attr value to attr's value and - * stop running these steps, returning to Main to visit the next + * 2.3.2.3. If namespace definition is the XML namespace, then stop + * running these steps, and return to Main to visit the next * attribute. + * + * _Note:_ XML namespace definitions in prefixes are completely + * ignored (in order to avoid unnecessary work when there might be + * prefix conflicts). XML namespaced elements are always handled + * uniformly by prefixing (and overriding if necessary) the element's + * localname with the reserved "xml" prefix. */ - if (attributePrefix === null) { - defaultNamespaceAttrValue = attr.value; + if (namespaceDefinition === infra_1.namespace.XML) { continue; - /** - * 2.3.2. Otherwise, the attribute prefix is not null and attr is a - * namespace prefix definition. Run the following steps: - */ } - else { - /** 2.3.2.1. Let prefix definition be the value of attr's localName. */ - var prefixDefinition = attr.localName; - /** 2.3.2.2. Let namespace definition be the value of attr's value. */ - var namespaceDefinition = attr.value; - /** - * 2.3.2.3. If namespace definition is the XML namespace, then stop - * running these steps, and return to Main to visit the next - * attribute. - * - * _Note:_ XML namespace definitions in prefixes are completely - * ignored (in order to avoid unnecessary work when there might be - * prefix conflicts). XML namespaced elements are always handled - * uniformly by prefixing (and overriding if necessary) the element's - * localname with the reserved "xml" prefix. - */ - if (namespaceDefinition === infra_1.namespace.XML) { - continue; - } - /** - * 2.3.2.4. If namespace definition is the empty string (the - * declarative form of having no namespace), then let namespace - * definition be null instead. - */ - if (namespaceDefinition === '') { - namespaceDefinition = null; - } - /** - * 2.3.2.5. If prefix definition is found in map given the namespace - * namespace definition, then stop running these steps, and return to - * Main to visit the next attribute. - * - * _Note:_ This step avoids adding duplicate prefix definitions for - * the same namespace in the map. This has the side-effect of avoiding - * later serialization of duplicate namespace prefix declarations in - * any descendant nodes. - */ - if (map.has(prefixDefinition, namespaceDefinition)) { - continue; - } - /** - * 2.3.2.6. Add the prefix prefix definition to map given namespace - * namespace definition. - */ - map.set(prefixDefinition, namespaceDefinition); - /** - * 2.3.2.7. Add the value of prefix definition as a new key to the - * local prefixes map, with the namespace definition as the key's - * value replacing the value of null with the empty string if - * applicable. - */ - localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; + /** + * 2.3.2.4. If namespace definition is the empty string (the + * declarative form of having no namespace), then let namespace + * definition be null instead. + */ + if (namespaceDefinition === '') { + namespaceDefinition = null; + } + /** + * 2.3.2.5. If prefix definition is found in map given the namespace + * namespace definition, then stop running these steps, and return to + * Main to visit the next attribute. + * + * _Note:_ This step avoids adding duplicate prefix definitions for + * the same namespace in the map. This has the side-effect of avoiding + * later serialization of duplicate namespace prefix declarations in + * any descendant nodes. + */ + if (map.has(prefixDefinition, namespaceDefinition)) { + continue; } + /** + * 2.3.2.6. Add the prefix prefix definition to map given namespace + * namespace definition. + */ + map.set(prefixDefinition, namespaceDefinition); + /** + * 2.3.2.7. Add the value of prefix definition as a new key to the + * local prefixes map, with the namespace definition as the key's + * value replacing the value of null with the empty string if + * applicable. + */ + localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; } } } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_5) throw e_5.error; } - } /** * 3. Return the value of default namespace attr value. * @@ -33636,7 +31317,7 @@ var XMLSerializerImpl = /** @class */ (function () { * converted to null. */ return defaultNamespaceAttrValue; - }; + } /** * Generates a new prefix for the given namespace. * @@ -33644,7 +31325,7 @@ var XMLSerializerImpl = /** @class */ (function () { * @param prefixMap - namespace prefix map * @param prefixIndex - generated namespace prefix index */ - XMLSerializerImpl.prototype._generatePrefix = function (newNamespace, prefixMap, prefixIndex) { + _generatePrefix(newNamespace, prefixMap, prefixIndex) { /** * 1. Let generated prefix be the concatenation of the string "ns" and the * current numerical value of prefix index. @@ -33652,18 +31333,18 @@ var XMLSerializerImpl = /** @class */ (function () { * 3. Add to map the generated prefix given the new namespace namespace. * 4. Return the value of generated prefix. */ - var generatedPrefix = "ns" + prefixIndex.value; + let generatedPrefix = "ns" + prefixIndex.value; prefixIndex.value++; prefixMap.set(generatedPrefix, newNamespace); return generatedPrefix; - }; + } /** * Produces an XML serialization of an attribute value. * * @param value - attribute value * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeAttributeValue = function (value, requireWellFormed) { + _serializeAttributeValue(value, requireWellFormed) { /** * From: https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value * @@ -33672,7 +31353,7 @@ var XMLSerializerImpl = /** @class */ (function () { * production, then throw an exception; the serialization of this attribute * value would fail to produce a well-formed element serialization. */ - if (requireWellFormed && value !== null && !algorithm_1.xml_isLegalChar(value)) { + if (requireWellFormed && value !== null && !(0, algorithm_1.xml_isLegalChar)(value)) { throw new Error("Invalid characters in attribute value."); } /** @@ -33692,9 +31373,9 @@ var XMLSerializerImpl = /** @class */ (function () { * grammar requirement in the XML specification's AttValue production by * also replacing ">" characters. */ - var result = ""; - for (var i = 0; i < value.length; i++) { - var c = value[i]; + let result = ""; + for (let i = 0; i < value.length; i++) { + const c = value[i]; if (c === "\"") result += """; else if (c === "&") @@ -33707,15 +31388,14 @@ var XMLSerializerImpl = /** @class */ (function () { result += c; } return result; - }; + } /** * Produces an XML serialization of an element node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeElement = function (node, requireWellFormed) { - var e_6, _a; + _serializeElement(node, requireWellFormed) { /** * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node * @@ -33725,7 +31405,7 @@ var XMLSerializerImpl = /** @class */ (function () { * serialization of this node would not be a well-formed element. */ if (requireWellFormed && (node.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(node.localName))) { + !(0, algorithm_1.xml_isName)(node.localName))) { throw new Error("Node local name contains invalid characters (well-formed required)."); } /** @@ -33758,7 +31438,7 @@ var XMLSerializerImpl = /** @class */ (function () { * 9. Let inherited ns be a copy of namespace. * 10. Let ns be the value of node's namespaceURI attribute. */ - var skipEndTag = false; + let skipEndTag = false; /** 11. If inherited ns is equal to ns, then: */ /** * 11.1. If local default namespace is not null, then set ignore @@ -33768,9 +31448,9 @@ var XMLSerializerImpl = /** @class */ (function () { * 11.3. Otherwise, append to qualified name the value of node's * localName. The node's prefix if it exists, is dropped. */ - var qualifiedName = node.localName; + const qualifiedName = node.localName; /** 11.4. Append the value of qualified name to markup. */ - var markup = "<" + qualifiedName; + let markup = "<" + qualifiedName; /** * 13. Append to markup the result of the XML serialization of node's * attributes given map, prefix index, local prefixes map, ignore namespace @@ -33803,33 +31483,23 @@ var XMLSerializerImpl = /** @class */ (function () { */ if (skipEndTag) return markup; - try { - /** - * 18. If ns is the HTML namespace, and the node's localName matches the - * string "template", then this is a template element. Append to markup the - * result of XML serializing a DocumentFragment node given the template - * element's template contents (a DocumentFragment), providing inherited - * ns, map, prefix index, and the require well-formed flag. - * - * _Note:_ This allows template content to round-trip, given the rules for - * parsing XHTML documents. - * - * 19. Otherwise, append to markup the result of running the XML - * serialization algorithm on each of node's children, in tree order, - * providing inherited ns, map, prefix index, and the require well-formed - * flag. - */ - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNode(childNode, requireWellFormed); - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_6) throw e_6.error; } + /** + * 18. If ns is the HTML namespace, and the node's localName matches the + * string "template", then this is a template element. Append to markup the + * result of XML serializing a DocumentFragment node given the template + * element's template contents (a DocumentFragment), providing inherited + * ns, map, prefix index, and the require well-formed flag. + * + * _Note:_ This allows template content to round-trip, given the rules for + * parsing XHTML documents. + * + * 19. Otherwise, append to markup the result of running the XML + * serialization algorithm on each of node's children, in tree order, + * providing inherited ns, map, prefix index, and the require well-formed + * flag. + */ + for (const childNode of node._children) { + markup += this._serializeNode(childNode, requireWellFormed); } /** * 20. Append the following to markup, in the order listed: @@ -33842,15 +31512,14 @@ var XMLSerializerImpl = /** @class */ (function () { * 21. Return the value of markup. */ return markup; - }; + } /** * Produces an XML serialization of a document node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeDocument = function (node, requireWellFormed) { - var e_7, _a; + _serializeDocument(node, requireWellFormed) { /** * If the require well-formed flag is set (its value is true), and this node * has no documentElement (the documentElement attribute's value is null), @@ -33874,30 +31543,19 @@ var XMLSerializerImpl = /** @class */ (function () { * * 3. Return the value of serialized document. */ - var serializedDocument = ""; - try { - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - serializedDocument += this._serializeNode(childNode, requireWellFormed); - } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_7) throw e_7.error; } + let serializedDocument = ""; + for (const childNode of node._children) { + serializedDocument += this._serializeNode(childNode, requireWellFormed); } return serializedDocument; - }; + } /** * Produces an XML serialization of a document fragment node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeDocumentFragment = function (node, requireWellFormed) { - var e_8, _a; + _serializeDocumentFragment(node, requireWellFormed) { /** * 1. Let markup the empty string. * 2. For each child child of node, in tree order, run the XML serialization @@ -33905,30 +31563,19 @@ var XMLSerializerImpl = /** @class */ (function () { * index, and flag require well-formed. Concatenate the result to markup. * 3. Return the value of markup. */ - var markup = ""; - try { - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - markup += this._serializeNode(childNode, requireWellFormed); - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_8) throw e_8.error; } + let markup = ""; + for (const childNode of node._children) { + markup += this._serializeNode(childNode, requireWellFormed); } return markup; - }; + } /** * Produces an XML serialization of the attributes of an element node. * * @param node - node to serialize * @param requireWellFormed - whether to check conformance */ - XMLSerializerImpl.prototype._serializeAttributes = function (node, requireWellFormed) { - var e_9, _a; + _serializeAttributes(node, requireWellFormed) { /** * 1. Let result be the empty string. * 2. Let localname set be a new empty namespace localname set. This @@ -33939,80 +31586,66 @@ var XMLSerializerImpl = /** @class */ (function () { * This can occur when two otherwise identical attributes on the same * element differ only by their prefix values. */ - var result = ""; - var localNameSet = requireWellFormed ? {} : undefined; - try { + let result = ""; + const localNameSet = requireWellFormed ? {} : undefined; + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (const attr of node.attributes) { /** - * 3. Loop: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - /** - * 3.1. If the require well-formed flag is set (its value is true), and the - * localname set contains a tuple whose values match those of a new tuple - * consisting of attr's namespaceURI attribute and localName attribute, - * then throw an exception; the serialization of this attr would fail to - * produce a well-formed element serialization. - */ - if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) { - throw new Error("Element contains duplicate attributes (well-formed required)."); - } - /** - * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and - * localName attribute, and add it to the localname set. - * 3.3. Let attribute namespace be the value of attr's namespaceURI value. - * 3.4. Let candidate prefix be null. - */ - if (requireWellFormed && localNameSet) - localNameSet[attr.localName] = true; - /** 3.5. If attribute namespace is not null, then run these sub-steps: */ - /** - * 3.6. Append a " " (U+0020 SPACE) to result. - * 3.7. If candidate prefix is not null, then append to result the - * concatenation of candidate prefix with ":" (U+003A COLON). - */ - /** - * 3.8. If the require well-formed flag is set (its value is true), and - * this attr's localName attribute contains the character - * ":" (U+003A COLON) or does not match the XML Name production or - * equals "xmlns" and attribute namespace is null, then throw an - * exception; the serialization of this attr would not be a - * well-formed attribute. - */ - if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(attr.localName))) { - throw new Error("Attribute local name contains invalid characters (well-formed required)."); - } - /** - * 3.9. Append the following strings to result, in the order listed: - * 3.9.1. The value of attr's localName; - * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.9.3. The result of serializing an attribute value given attr's value - * attribute and the require well-formed flag as input; - * 3.9.4. """ (U+0022 QUOTATION MARK). - */ - result += " " + attr.localName + "=\"" + - this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; + if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); } - } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + if (requireWellFormed && localNameSet) + localNameSet[attr.localName] = true; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(attr.localName))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); } - finally { if (e_9) throw e_9.error; } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result += " " + attr.localName + "=\"" + + this._serializeAttributeValue(attr.value, requireWellFormed) + "\""; } /** * 4. Return the value of result. */ return result; - }; - XMLSerializerImpl._VoidElementNames = new Set(['area', 'base', 'basefont', - 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', - 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); - return XMLSerializerImpl; -}()); + } +} exports.XMLSerializerImpl = XMLSerializerImpl; //# sourceMappingURL=XMLSerializerImpl.js.map @@ -34024,9 +31657,10 @@ exports.XMLSerializerImpl = XMLSerializerImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.XMLSerializer = void 0; // Export classes var XMLSerializerImpl_1 = __nccwpck_require__(85039); -exports.XMLSerializer = XMLSerializerImpl_1.XMLSerializerImpl; +Object.defineProperty(exports, "XMLSerializer", ({ enumerable: true, get: function () { return XMLSerializerImpl_1.XMLSerializerImpl; } })); //# sourceMappingURL=index.js.map /***/ }), @@ -34037,28 +31671,26 @@ exports.XMLSerializer = XMLSerializerImpl_1.XMLSerializerImpl; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var Guard_1 = __nccwpck_require__(66862); +exports.Cast = void 0; +const Guard_1 = __nccwpck_require__(66862); /** * Contains type casts for DOM objects. */ -var Cast = /** @class */ (function () { - function Cast() { - } +class Cast { /** * Casts the given object to a `Node`. * * @param a - the object to cast */ - Cast.asNode = function (a) { + static asNode(a) { if (Guard_1.Guard.isNode(a)) { return a; } else { throw new Error("Invalid object. Node expected."); } - }; - return Cast; -}()); + } +} exports.Cast = Cast; //# sourceMappingURL=Cast.js.map @@ -34070,64 +31702,51 @@ exports.Cast = Cast; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var EmptySet = /** @class */ (function () { - function EmptySet() { +exports.EmptySet = void 0; +class EmptySet { + get size() { + return 0; } - Object.defineProperty(EmptySet.prototype, "size", { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }); - EmptySet.prototype.add = function (value) { + add(value) { throw new Error("Cannot add to an empty set."); - }; - EmptySet.prototype.clear = function () { + } + clear() { // no-op - }; - EmptySet.prototype.delete = function (value) { + } + delete(value) { return false; - }; - EmptySet.prototype.forEach = function (callbackfn, thisArg) { + } + forEach(callbackfn, thisArg) { // no-op - }; - EmptySet.prototype.has = function (value) { + } + has(value) { return false; - }; - EmptySet.prototype[Symbol.iterator] = function () { + } + [Symbol.iterator]() { return new EmptySetIterator(); - }; - EmptySet.prototype.entries = function () { + } + entries() { return new EmptySetIterator(); - }; - EmptySet.prototype.keys = function () { + } + keys() { return new EmptySetIterator(); - }; - EmptySet.prototype.values = function () { + } + values() { return new EmptySetIterator(); - }; - Object.defineProperty(EmptySet.prototype, Symbol.toStringTag, { - get: function () { - return "EmptySet"; - }, - enumerable: true, - configurable: true - }); - return EmptySet; -}()); -exports.EmptySet = EmptySet; -var EmptySetIterator = /** @class */ (function () { - function EmptySetIterator() { } - EmptySetIterator.prototype[Symbol.iterator] = function () { + get [Symbol.toStringTag]() { + return "EmptySet"; + } +} +exports.EmptySet = EmptySet; +class EmptySetIterator { + [Symbol.iterator]() { return this; - }; - EmptySetIterator.prototype.next = function () { + } + next() { return { done: true, value: null }; - }; - return EmptySetIterator; -}()); + } +} //# sourceMappingURL=EmptySet.js.map /***/ }), @@ -34138,139 +31757,138 @@ var EmptySetIterator = /** @class */ (function () { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); +exports.Guard = void 0; +const interfaces_1 = __nccwpck_require__(27305); /** * Contains user-defined type guards for DOM objects. */ -var Guard = /** @class */ (function () { - function Guard() { - } +class Guard { /** * Determines if the given object is a `Node`. * * @param a - the object to check */ - Guard.isNode = function (a) { + static isNode(a) { return (!!a && a._nodeType !== undefined); - }; + } /** * Determines if the given object is a `Document`. * * @param a - the object to check */ - Guard.isDocumentNode = function (a) { + static isDocumentNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Document); - }; + } /** * Determines if the given object is a `DocumentType`. * * @param a - the object to check */ - Guard.isDocumentTypeNode = function (a) { + static isDocumentTypeNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.DocumentType); - }; + } /** * Determines if the given object is a `DocumentFragment`. * * @param a - the object to check */ - Guard.isDocumentFragmentNode = function (a) { + static isDocumentFragmentNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.DocumentFragment); - }; + } /** * Determines if the given object is a `Attr`. * * @param a - the object to check */ - Guard.isAttrNode = function (a) { + static isAttrNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Attribute); - }; + } /** * Determines if the given node is a `CharacterData` node. * * @param a - the object to check */ - Guard.isCharacterDataNode = function (a) { + static isCharacterDataNode(a) { if (!Guard.isNode(a)) return false; - var type = a._nodeType; + const type = a._nodeType; return (type === interfaces_1.NodeType.Text || type === interfaces_1.NodeType.ProcessingInstruction || type === interfaces_1.NodeType.Comment || type === interfaces_1.NodeType.CData); - }; + } /** * Determines if the given object is a `Text` or a `CDATASection`. * * @param a - the object to check */ - Guard.isTextNode = function (a) { + static isTextNode(a) { return (Guard.isNode(a) && (a._nodeType === interfaces_1.NodeType.Text || a._nodeType === interfaces_1.NodeType.CData)); - }; + } /** * Determines if the given object is a `Text`. * * @param a - the object to check */ - Guard.isExclusiveTextNode = function (a) { + static isExclusiveTextNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Text); - }; + } /** * Determines if the given object is a `CDATASection`. * * @param a - the object to check */ - Guard.isCDATASectionNode = function (a) { + static isCDATASectionNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.CData); - }; + } /** * Determines if the given object is a `Comment`. * * @param a - the object to check */ - Guard.isCommentNode = function (a) { + static isCommentNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Comment); - }; + } /** * Determines if the given object is a `ProcessingInstruction`. * * @param a - the object to check */ - Guard.isProcessingInstructionNode = function (a) { + static isProcessingInstructionNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.ProcessingInstruction); - }; + } /** * Determines if the given object is an `Element`. * * @param a - the object to check */ - Guard.isElementNode = function (a) { + static isElementNode(a) { return (Guard.isNode(a) && a._nodeType === interfaces_1.NodeType.Element); - }; + } /** * Determines if the given object is a custom `Element`. * * @param a - the object to check */ - Guard.isCustomElementNode = function (a) { + static isCustomElementNode(a) { return (Guard.isElementNode(a) && a._customElementState === "custom"); - }; + } /** * Determines if the given object is a `ShadowRoot`. * * @param a - the object to check */ - Guard.isShadowRoot = function (a) { + static isShadowRoot(a) { return (!!a && a.host !== undefined); - }; + } /** * Determines if the given object is a `MouseEvent`. * * @param a - the object to check */ - Guard.isMouseEvent = function (a) { + static isMouseEvent(a) { return (!!a && a.screenX !== undefined && a.screenY != undefined); - }; + } /** * Determines if the given object is a slotable. * @@ -34279,53 +31897,52 @@ var Guard = /** @class */ (function () { * * @param a - the object to check */ - Guard.isSlotable = function (a) { + static isSlotable(a) { return (!!a && a._name !== undefined && a._assignedSlot !== undefined && (Guard.isTextNode(a) || Guard.isElementNode(a))); - }; + } /** * Determines if the given object is a slot. * * @param a - the object to check */ - Guard.isSlot = function (a) { + static isSlot(a) { return (!!a && a._name !== undefined && a._assignedNodes !== undefined && Guard.isElementNode(a)); - }; + } /** * Determines if the given object is a `Window`. * * @param a - the object to check */ - Guard.isWindow = function (a) { + static isWindow(a) { return (!!a && a.navigator !== undefined); - }; + } /** * Determines if the given object is an `EventListener`. * * @param a - the object to check */ - Guard.isEventListener = function (a) { + static isEventListener(a) { return (!!a && a.handleEvent !== undefined); - }; + } /** * Determines if the given object is a `RegisteredObserver`. * * @param a - the object to check */ - Guard.isRegisteredObserver = function (a) { + static isRegisteredObserver(a) { return (!!a && a.observer !== undefined && a.options !== undefined); - }; + } /** * Determines if the given object is a `TransientRegisteredObserver`. * * @param a - the object to check */ - Guard.isTransientRegisteredObserver = function (a) { + static isTransientRegisteredObserver(a) { return (!!a && a.source !== undefined && Guard.isRegisteredObserver(a)); - }; - return Guard; -}()); + } +} exports.Guard = Guard; //# sourceMappingURL=Guard.js.map @@ -34337,12 +31954,13 @@ exports.Guard = Guard; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.EmptySet = exports.Guard = exports.Cast = void 0; var Cast_1 = __nccwpck_require__(75483); -exports.Cast = Cast_1.Cast; +Object.defineProperty(exports, "Cast", ({ enumerable: true, get: function () { return Cast_1.Cast; } })); var Guard_1 = __nccwpck_require__(66862); -exports.Guard = Guard_1.Guard; +Object.defineProperty(exports, "Guard", ({ enumerable: true, get: function () { return Guard_1.Guard; } })); var EmptySet_1 = __nccwpck_require__(88392); -exports.EmptySet = EmptySet_1.EmptySet; +Object.defineProperty(exports, "EmptySet", ({ enumerable: true, get: function () { return EmptySet_1.EmptySet; } })); //# sourceMappingURL=index.js.map /***/ }), @@ -34353,7 +31971,9 @@ exports.EmptySet = EmptySet_1.EmptySet; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -var CodePoints_1 = __nccwpck_require__(28548); +exports.forgivingBase64Encode = forgivingBase64Encode; +exports.forgivingBase64Decode = forgivingBase64Decode; +const CodePoints_1 = __nccwpck_require__(28548); /** * Base-64 encodes the given string. * @@ -34367,7 +31987,6 @@ function forgivingBase64Encode(input) { */ return Buffer.from(input).toString('base64'); } -exports.forgivingBase64Encode = forgivingBase64Encode; /** * Decodes a base-64 string. * @@ -34431,7 +32050,6 @@ function forgivingBase64Decode(input) { */ return Buffer.from(input, 'base64').toString('utf8'); } -exports.forgivingBase64Decode = forgivingBase64Decode; //# sourceMappingURL=Base64.js.map /***/ }), @@ -34442,6 +32060,7 @@ exports.forgivingBase64Decode = forgivingBase64Decode; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isASCIIByte = isASCIIByte; /** * Determines if the given number is an ASCII byte. * @@ -34453,37 +32072,23 @@ function isASCIIByte(byte) { */ return byte >= 0x00 && byte <= 0x7F; } -exports.isASCIIByte = isASCIIByte; //# sourceMappingURL=Byte.js.map /***/ }), /***/ 71627: -/***/ (function(__unused_webpack_module, exports) { +/***/ ((__unused_webpack_module, exports) => { "use strict"; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.length = length; +exports.byteLowercase = byteLowercase; +exports.byteUppercase = byteUppercase; +exports.byteCaseInsensitiveMatch = byteCaseInsensitiveMatch; +exports.startsWith = startsWith; +exports.byteLessThan = byteLessThan; +exports.isomorphicDecode = isomorphicDecode; /** * Returns the count of bytes in a sequence. * @@ -34495,7 +32100,6 @@ function length(list) { */ return list.length; } -exports.length = length; /** * Converts each byte to lowercase. * @@ -34506,14 +32110,13 @@ function byteLowercase(list) { * To byte-lowercase a byte sequence, increase each byte it contains, in the * range 0x41 (A) to 0x5A (Z), inclusive, by 0x20. */ - for (var i = 0; i < list.length; i++) { - var c = list[i]; + for (let i = 0; i < list.length; i++) { + const c = list[i]; if (c >= 0x41 && c <= 0x5A) { list[i] = c + 0x20; } } } -exports.byteLowercase = byteLowercase; /** * Converts each byte to uppercase. * @@ -34524,14 +32127,13 @@ function byteUppercase(list) { * To byte-uppercase a byte sequence, subtract each byte it contains, in the * range 0x61 (a) to 0x7A (z), inclusive, by 0x20. */ - for (var i = 0; i < list.length; i++) { - var c = list[i]; + for (let i = 0; i < list.length; i++) { + const c = list[i]; if (c >= 0x61 && c <= 0x7A) { list[i] = c - 0x20; } } } -exports.byteUppercase = byteUppercase; /** * Compares two byte sequences. * @@ -34545,9 +32147,9 @@ function byteCaseInsensitiveMatch(listA, listB) { */ if (listA.length !== listB.length) return false; - for (var i = 0; i < listA.length; i++) { - var a = listA[i]; - var b = listB[i]; + for (let i = 0; i < listA.length; i++) { + let a = listA[i]; + let b = listB[i]; if (a >= 0x41 && a <= 0x5A) a += 0x20; if (b >= 0x41 && b <= 0x5A) @@ -34557,7 +32159,6 @@ function byteCaseInsensitiveMatch(listA, listB) { } return true; } -exports.byteCaseInsensitiveMatch = byteCaseInsensitiveMatch; /** * Determines if `listA` starts with `listB`. * @@ -34574,7 +32175,7 @@ function startsWith(listA, listB) { * 2.5. Return false if aByte is not bByte. * 2.6. Set i to i + 1. */ - var i = 0; + let i = 0; while (true) { if (i >= listA.length) return false; @@ -34585,7 +32186,6 @@ function startsWith(listA, listB) { i++; } } -exports.startsWith = startsWith; /** * Determines if `listA` is less than `listB`. * @@ -34602,14 +32202,14 @@ function byteLessThan(listA, listB) { * 4. If the nth byte of a is less than the nth byte of b, then return true. * 5. Return false. */ - var i = 0; + let i = 0; while (true) { if (i >= listA.length) return false; if (i >= listB.length) return true; - var a = listA[i]; - var b = listB[i]; + const a = listA[i]; + const b = listB[i]; if (a < b) return true; else if (a > b) @@ -34617,7 +32217,6 @@ function byteLessThan(listA, listB) { i++; } } -exports.byteLessThan = byteLessThan; /** * Decodes a byte sequence into a string. * @@ -34629,9 +32228,8 @@ function isomorphicDecode(list) { * equal to input’s length and whose code points have the same values as * input’s bytes, in the same order. */ - return String.fromCodePoint.apply(String, __spread(list)); + return String.fromCodePoint(...list); } -exports.isomorphicDecode = isomorphicDecode; //# sourceMappingURL=ByteSequence.js.map /***/ }), @@ -34642,6 +32240,7 @@ exports.isomorphicDecode = isomorphicDecode; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ASCIIAlphanumeric = exports.ASCIIAlpha = exports.ASCIILowerAlpha = exports.ASCIIUpperAlpha = exports.ASCIIHexDigit = exports.ASCIILowerHexDigit = exports.ASCIIUpperHexDigit = exports.ASCIIDigit = exports.Control = exports.C0ControlOrSpace = exports.C0Control = exports.ASCIIWhiteSpace = exports.ASCIITabOrNewLine = exports.ASCIICodePoint = exports.NonCharacter = exports.ScalarValue = exports.Surrogate = void 0; /** * A surrogate is a code point that is in the range U+D800 to U+DFFF, inclusive. */ @@ -34729,23 +32328,16 @@ exports.ASCIIAlphanumeric = /[0-9A-Za-z]/; /***/ }), /***/ 99387: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); +exports.parseJSONFromBytes = parseJSONFromBytes; +exports.serializeJSONToBytes = serializeJSONToBytes; +exports.parseJSONIntoInfraValues = parseJSONIntoInfraValues; +exports.convertAJSONDerivedJavaScriptValueToAnInfraValue = convertAJSONDerivedJavaScriptValueToAnInfraValue; +const util_1 = __nccwpck_require__(76195); /** * Parses the given byte sequence representing a JSON string into an object. * @@ -34756,10 +32348,9 @@ function parseJSONFromBytes(bytes) { * 1. Let jsonText be the result of running UTF-8 decode on bytes. [ENCODING] * 2. Return ? Call(%JSONParse%, undefined, « jsonText »). */ - var jsonText = util_1.utf8Decode(bytes); + const jsonText = (0, util_1.utf8Decode)(bytes); return JSON.parse.call(undefined, jsonText); } -exports.parseJSONFromBytes = parseJSONFromBytes; /** * Serialize the given JavaScript value into a byte sequence. * @@ -34770,10 +32361,9 @@ function serializeJSONToBytes(value) { * 1. Let jsonString be ? Call(%JSONStringify%, undefined, « value »). * 2. Return the result of running UTF-8 encode on jsonString. [ENCODING] */ - var jsonString = JSON.stringify.call(undefined, value); - return util_1.utf8Encode(jsonString); + const jsonString = JSON.stringify.call(undefined, value); + return (0, util_1.utf8Encode)(jsonString); } -exports.serializeJSONToBytes = serializeJSONToBytes; /** * Parses the given JSON string into a Realm-independent JavaScript value. * @@ -34785,21 +32375,19 @@ function parseJSONIntoInfraValues(jsonText) { * 2. Return the result of converting a JSON-derived JavaScript value to an * Infra value, given jsValue. */ - var jsValue = JSON.parse.call(undefined, jsonText); + const jsValue = JSON.parse.call(undefined, jsonText); return convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue); } -exports.parseJSONIntoInfraValues = parseJSONIntoInfraValues; /** * Parses the value into a Realm-independent JavaScript value. * * @param jsValue - a JavaScript value */ function convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue) { - var e_1, _a; /** * 1. If Type(jsValue) is Null, String, or Number, then return jsValue. */ - if (jsValue === null || util_1.isString(jsValue) || util_1.isNumber(jsValue)) + if (jsValue === null || (0, util_1.isString)(jsValue) || (0, util_1.isNumber)(jsValue)) return jsValue; /** * 2. If IsArray(jsValue) is true, then: @@ -34813,24 +32401,14 @@ function convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue) { * 2.3.4. Append infraValueAtIndex to result. * 2.8. Return result. */ - if (util_1.isArray(jsValue)) { - var result = new Array(); - try { - for (var jsValue_1 = __values(jsValue), jsValue_1_1 = jsValue_1.next(); !jsValue_1_1.done; jsValue_1_1 = jsValue_1.next()) { - var jsValueAtIndex = jsValue_1_1.value; - result.push(convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValueAtIndex)); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (jsValue_1_1 && !jsValue_1_1.done && (_a = jsValue_1.return)) _a.call(jsValue_1); - } - finally { if (e_1) throw e_1.error; } + if ((0, util_1.isArray)(jsValue)) { + const result = new Array(); + for (const jsValueAtIndex of jsValue) { + result.push(convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValueAtIndex)); } return result; } - else if (util_1.isObject(jsValue)) { + else if ((0, util_1.isObject)(jsValue)) { /** * 3. Let result be an empty ordered map. * 4. For each key of ! jsValue.[[OwnPropertyKeys]](): @@ -34840,11 +32418,11 @@ function convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue) { * 4.3. Set result[key] to infraValueAtKey. * 5. Return result. */ - var result = new Map(); - for (var key in jsValue) { + const result = new Map(); + for (const key in jsValue) { /* istanbul ignore else */ if (jsValue.hasOwnProperty(key)) { - var jsValueAtKey = jsValue[key]; + const jsValueAtKey = jsValue[key]; result.set(key, convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValueAtKey)); } } @@ -34853,76 +32431,31 @@ function convertAJSONDerivedJavaScriptValueToAnInfraValue(jsValue) { /* istanbul ignore next */ return jsValue; } -exports.convertAJSONDerivedJavaScriptValueToAnInfraValue = convertAJSONDerivedJavaScriptValueToAnInfraValue; //# sourceMappingURL=JSON.js.map /***/ }), /***/ 20340: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); +exports.append = append; +exports.extend = extend; +exports.prepend = prepend; +exports.replace = replace; +exports.insert = insert; +exports.remove = remove; +exports.empty = empty; +exports.contains = contains; +exports.size = size; +exports.isEmpty = isEmpty; +exports.forEach = forEach; +exports.clone = clone; +exports.sortInAscendingOrder = sortInAscendingOrder; +exports.sortInDescendingOrder = sortInDescendingOrder; +const util_1 = __nccwpck_require__(76195); /** * Adds the given item to the end of the list. * @@ -34932,7 +32465,6 @@ var util_1 = __nccwpck_require__(76195); function append(list, item) { list.push(item); } -exports.append = append; /** * Extends a list by appending all items from another list. * @@ -34940,9 +32472,8 @@ exports.append = append; * @param listB - a list containing items to append to `listA` */ function extend(listA, listB) { - listA.push.apply(listA, __spread(listB)); + listA.push(...listB); } -exports.extend = extend; /** * Inserts the given item to the start of the list. * @@ -34952,7 +32483,6 @@ exports.extend = extend; function prepend(list, item) { list.unshift(item); } -exports.prepend = prepend; /** * Replaces the given item or all items matching condition with a new item. * @@ -34962,32 +32492,20 @@ exports.prepend = prepend; * @param item - an item */ function replace(list, conditionOrItem, newItem) { - var e_1, _a; - var i = 0; - try { - for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) { - var oldItem = list_1_1.value; - if (util_1.isFunction(conditionOrItem)) { - if (!!conditionOrItem.call(null, oldItem)) { - list[i] = newItem; - } - } - else if (oldItem === conditionOrItem) { + let i = 0; + for (const oldItem of list) { + if ((0, util_1.isFunction)(conditionOrItem)) { + if (!!conditionOrItem.call(null, oldItem)) { list[i] = newItem; - return; } - i++; } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1); + else if (oldItem === conditionOrItem) { + list[i] = newItem; + return; } - finally { if (e_1) throw e_1.error; } + i++; } } -exports.replace = replace; /** * Inserts the given item before the given index. * @@ -34997,7 +32515,6 @@ exports.replace = replace; function insert(list, item, index) { list.splice(index, 0, item); } -exports.insert = insert; /** * Removes the given item or all items matching condition. * @@ -35006,10 +32523,10 @@ exports.insert = insert; * to remove */ function remove(list, conditionOrItem) { - var i = list.length; + let i = list.length; while (i--) { - var oldItem = list[i]; - if (util_1.isFunction(conditionOrItem)) { + const oldItem = list[i]; + if ((0, util_1.isFunction)(conditionOrItem)) { if (!!conditionOrItem.call(null, oldItem)) { list.splice(i, 1); } @@ -35020,14 +32537,12 @@ function remove(list, conditionOrItem) { } } } -exports.remove = remove; /** * Removes all items from the list. */ function empty(list) { list.length = 0; } -exports.empty = empty; /** * Determines if the list contains the given item or any items matching * condition. @@ -35036,30 +32551,18 @@ exports.empty = empty; * @param conditionOrItem - an item to a condition to match */ function contains(list, conditionOrItem) { - var e_2, _a; - try { - for (var list_2 = __values(list), list_2_1 = list_2.next(); !list_2_1.done; list_2_1 = list_2.next()) { - var oldItem = list_2_1.value; - if (util_1.isFunction(conditionOrItem)) { - if (!!conditionOrItem.call(null, oldItem)) { - return true; - } - } - else if (oldItem === conditionOrItem) { + for (const oldItem of list) { + if ((0, util_1.isFunction)(conditionOrItem)) { + if (!!conditionOrItem.call(null, oldItem)) { return true; } } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (list_2_1 && !list_2_1.done && (_a = list_2.return)) _a.call(list_2); + else if (oldItem === conditionOrItem) { + return true; } - finally { if (e_2) throw e_2.error; } } return false; } -exports.contains = contains; /** * Returns the count of items in the list matching the given condition. * @@ -35067,31 +32570,19 @@ exports.contains = contains; * @param condition - an optional condition to match */ function size(list, condition) { - var e_3, _a; if (condition === undefined) { return list.length; } else { - var count = 0; - try { - for (var list_3 = __values(list), list_3_1 = list_3.next(); !list_3_1.done; list_3_1 = list_3.next()) { - var item = list_3_1.value; - if (!!condition.call(null, item)) { - count++; - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (list_3_1 && !list_3_1.done && (_a = list_3.return)) _a.call(list_3); + let count = 0; + for (const item of list) { + if (!!condition.call(null, item)) { + count++; } - finally { if (e_3) throw e_3.error; } } return count; } } -exports.size = size; /** * Determines if the list is empty. * @@ -35100,64 +32591,32 @@ exports.size = size; function isEmpty(list) { return list.length === 0; } -exports.isEmpty = isEmpty; /** * Returns an iterator for the items of the list. * * @param list - a list * @param condition - an optional condition to match */ -function forEach(list, condition) { - var list_4, list_4_1, item, e_4_1; - var e_4, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(condition === undefined)) return [3 /*break*/, 2]; - return [5 /*yield**/, __values(list)]; - case 1: - _b.sent(); - return [3 /*break*/, 9]; - case 2: - _b.trys.push([2, 7, 8, 9]); - list_4 = __values(list), list_4_1 = list_4.next(); - _b.label = 3; - case 3: - if (!!list_4_1.done) return [3 /*break*/, 6]; - item = list_4_1.value; - if (!!!condition.call(null, item)) return [3 /*break*/, 5]; - return [4 /*yield*/, item]; - case 4: - _b.sent(); - _b.label = 5; - case 5: - list_4_1 = list_4.next(); - return [3 /*break*/, 3]; - case 6: return [3 /*break*/, 9]; - case 7: - e_4_1 = _b.sent(); - e_4 = { error: e_4_1 }; - return [3 /*break*/, 9]; - case 8: - try { - if (list_4_1 && !list_4_1.done && (_a = list_4.return)) _a.call(list_4); - } - finally { if (e_4) throw e_4.error; } - return [7 /*endfinally*/]; - case 9: return [2 /*return*/]; +function* forEach(list, condition) { + if (condition === undefined) { + yield* list; + } + else { + for (const item of list) { + if (!!condition.call(null, item)) { + yield item; + } } - }); + } } -exports.forEach = forEach; /** * Creates and returns a shallow clone of list. * * @param list - a list */ function clone(list) { - return new (Array.bind.apply(Array, __spread([void 0], list)))(); + return new Array(...list); } -exports.clone = clone; /** * Returns a new list containing items from the list sorted in ascending * order. @@ -35167,11 +32626,8 @@ exports.clone = clone; * is less than its second argument, and `false` otherwise. */ function sortInAscendingOrder(list, lessThanAlgo) { - return list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; - }); + return list.sort((itemA, itemB) => lessThanAlgo.call(null, itemA, itemB) ? -1 : 1); } -exports.sortInAscendingOrder = sortInAscendingOrder; /** * Returns a new list containing items from the list sorted in descending * order. @@ -35181,80 +32637,31 @@ exports.sortInAscendingOrder = sortInAscendingOrder; * is less than its second argument, and `false` otherwise. */ function sortInDescendingOrder(list, lessThanAlgo) { - return list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; - }); + return list.sort((itemA, itemB) => lessThanAlgo.call(null, itemA, itemB) ? 1 : -1); } -exports.sortInDescendingOrder = sortInDescendingOrder; //# sourceMappingURL=List.js.map /***/ }), /***/ 22298: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); +exports.get = get; +exports.set = set; +exports.remove = remove; +exports.contains = contains; +exports.keys = keys; +exports.values = values; +exports.size = size; +exports.isEmpty = isEmpty; +exports.forEach = forEach; +exports.clone = clone; +exports.sortInAscendingOrder = sortInAscendingOrder; +exports.sortInDescendingOrder = sortInDescendingOrder; +const util_1 = __nccwpck_require__(76195); /** * Gets the value corresponding to the given key. * @@ -35264,7 +32671,6 @@ var util_1 = __nccwpck_require__(76195); function get(map, key) { return map.get(key); } -exports.get = get; /** * Sets the value corresponding to the given key. * @@ -35275,7 +32681,6 @@ exports.get = get; function set(map, key, val) { map.set(key, val); } -exports.set = set; /** * Removes the item with the given key or all items matching condition. * @@ -35284,43 +32689,21 @@ exports.set = set; * items to remove */ function remove(map, conditionOrItem) { - var e_1, _a, e_2, _b; - if (!util_1.isFunction(conditionOrItem)) { + if (!(0, util_1.isFunction)(conditionOrItem)) { map.delete(conditionOrItem); } else { - var toRemove = []; - try { - for (var map_1 = __values(map), map_1_1 = map_1.next(); !map_1_1.done; map_1_1 = map_1.next()) { - var item = map_1_1.value; - if (!!conditionOrItem.call(null, item)) { - toRemove.push(item[0]); - } + const toRemove = []; + for (const item of map) { + if (!!conditionOrItem.call(null, item)) { + toRemove.push(item[0]); } } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (map_1_1 && !map_1_1.done && (_a = map_1.return)) _a.call(map_1); - } - finally { if (e_1) throw e_1.error; } - } - try { - for (var toRemove_1 = __values(toRemove), toRemove_1_1 = toRemove_1.next(); !toRemove_1_1.done; toRemove_1_1 = toRemove_1.next()) { - var key = toRemove_1_1.value; - map.delete(key); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (toRemove_1_1 && !toRemove_1_1.done && (_b = toRemove_1.return)) _b.call(toRemove_1); - } - finally { if (e_2) throw e_2.error; } + for (const key of toRemove) { + map.delete(key); } } } -exports.remove = remove; /** * Determines if the map contains a value with the given key. * @@ -35329,30 +32712,18 @@ exports.remove = remove; * items */ function contains(map, conditionOrItem) { - var e_3, _a; - if (!util_1.isFunction(conditionOrItem)) { + if (!(0, util_1.isFunction)(conditionOrItem)) { return map.has(conditionOrItem); } else { - try { - for (var map_2 = __values(map), map_2_1 = map_2.next(); !map_2_1.done; map_2_1 = map_2.next()) { - var item = map_2_1.value; - if (!!conditionOrItem.call(null, item)) { - return true; - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (map_2_1 && !map_2_1.done && (_a = map_2.return)) _a.call(map_2); + for (const item of map) { + if (!!conditionOrItem.call(null, item)) { + return true; } - finally { if (e_3) throw e_3.error; } } return false; } } -exports.contains = contains; /** * Gets the keys of the map. * @@ -35361,16 +32732,14 @@ exports.contains = contains; function keys(map) { return new Set(map.keys()); } -exports.keys = keys; /** * Gets the values of the map. * * @param map - a map */ function values(map) { - return __spread(map.values()); + return [...map.values()]; } -exports.values = values; /** * Gets the size of the map. * @@ -35378,31 +32747,19 @@ exports.values = values; * @param condition - an optional condition to match */ function size(map, condition) { - var e_4, _a; if (condition === undefined) { return map.size; } else { - var count = 0; - try { - for (var map_3 = __values(map), map_3_1 = map_3.next(); !map_3_1.done; map_3_1 = map_3.next()) { - var item = map_3_1.value; - if (!!condition.call(null, item)) { - count++; - } - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (map_3_1 && !map_3_1.done && (_a = map_3.return)) _a.call(map_3); + let count = 0; + for (const item of map) { + if (!!condition.call(null, item)) { + count++; } - finally { if (e_4) throw e_4.error; } } return count; } } -exports.size = size; /** * Determines if the map is empty. * @@ -35411,55 +32768,24 @@ exports.size = size; function isEmpty(map) { return map.size === 0; } -exports.isEmpty = isEmpty; /** * Returns an iterator for the items of the map. * * @param map - a map * @param condition - an optional condition to match */ -function forEach(map, condition) { - var map_4, map_4_1, item, e_5_1; - var e_5, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(condition === undefined)) return [3 /*break*/, 2]; - return [5 /*yield**/, __values(map)]; - case 1: - _b.sent(); - return [3 /*break*/, 9]; - case 2: - _b.trys.push([2, 7, 8, 9]); - map_4 = __values(map), map_4_1 = map_4.next(); - _b.label = 3; - case 3: - if (!!map_4_1.done) return [3 /*break*/, 6]; - item = map_4_1.value; - if (!!!condition.call(null, item)) return [3 /*break*/, 5]; - return [4 /*yield*/, item]; - case 4: - _b.sent(); - _b.label = 5; - case 5: - map_4_1 = map_4.next(); - return [3 /*break*/, 3]; - case 6: return [3 /*break*/, 9]; - case 7: - e_5_1 = _b.sent(); - e_5 = { error: e_5_1 }; - return [3 /*break*/, 9]; - case 8: - try { - if (map_4_1 && !map_4_1.done && (_a = map_4.return)) _a.call(map_4); - } - finally { if (e_5) throw e_5.error; } - return [7 /*endfinally*/]; - case 9: return [2 /*return*/]; +function* forEach(map, condition) { + if (condition === undefined) { + yield* map; + } + else { + for (const item of map) { + if (!!condition.call(null, item)) { + yield item; + } } - }); + } } -exports.forEach = forEach; /** * Creates and returns a shallow clone of map. * @@ -35468,7 +32794,6 @@ exports.forEach = forEach; function clone(map) { return new Map(map); } -exports.clone = clone; /** * Returns a new map containing items from the map sorted in ascending * order. @@ -35478,13 +32803,10 @@ exports.clone = clone; * is less than its second argument, and `false` otherwise. */ function sortInAscendingOrder(map, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], map)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; - }); + const list = new Array(...map); + list.sort((itemA, itemB) => lessThanAlgo.call(null, itemA, itemB) ? -1 : 1); return new Map(list); } -exports.sortInAscendingOrder = sortInAscendingOrder; /** * Returns a new map containing items from the map sorted in descending * order. @@ -35494,13 +32816,10 @@ exports.sortInAscendingOrder = sortInAscendingOrder; * is less than its second argument, and `false` otherwise. */ function sortInDescendingOrder(map, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], map)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; - }); + const list = new Array(...map); + list.sort((itemA, itemB) => lessThanAlgo.call(null, itemA, itemB) ? 1 : -1); return new Map(list); } -exports.sortInDescendingOrder = sortInDescendingOrder; //# sourceMappingURL=Map.js.map /***/ }), @@ -35511,6 +32830,7 @@ exports.sortInDescendingOrder = sortInDescendingOrder; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.XLink = exports.SVG = exports.MathML = exports.XMLNS = exports.XML = exports.HTML = void 0; exports.HTML = "http://www.w3.org/1999/xhtml"; exports.XML = "http://www.w3.org/XML/1998/namespace"; exports.XMLNS = "http://www.w3.org/2000/xmlns/"; @@ -35527,6 +32847,8 @@ exports.XLink = "http://www.w3.org/1999/xlink"; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.enqueue = enqueue; +exports.dequeue = dequeue; /** * Appends the given item to the queue. * @@ -35536,7 +32858,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function enqueue(list, item) { list.push(item); } -exports.enqueue = enqueue; /** * Removes and returns an item from the queue. * @@ -35545,76 +32866,36 @@ exports.enqueue = enqueue; function dequeue(list) { return list.shift() || null; } -exports.dequeue = dequeue; //# sourceMappingURL=Queue.js.map /***/ }), /***/ 35931: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); +exports.append = append; +exports.extend = extend; +exports.prepend = prepend; +exports.replace = replace; +exports.insert = insert; +exports.remove = remove; +exports.empty = empty; +exports.contains = contains; +exports.size = size; +exports.isEmpty = isEmpty; +exports.forEach = forEach; +exports.clone = clone; +exports.sortInAscendingOrder = sortInAscendingOrder; +exports.sortInDescendingOrder = sortInDescendingOrder; +exports.isSubsetOf = isSubsetOf; +exports.isSupersetOf = isSupersetOf; +exports.intersection = intersection; +exports.union = union; +exports.range = range; +const util_1 = __nccwpck_require__(76195); /** * Adds the given item to the end of the set. * @@ -35624,7 +32905,6 @@ var util_1 = __nccwpck_require__(76195); function append(set, item) { set.add(item); } -exports.append = append; /** * Extends a set by appending all items from another set. * @@ -35634,7 +32914,6 @@ exports.append = append; function extend(setA, setB) { setB.forEach(setA.add, setA); } -exports.extend = extend; /** * Inserts the given item to the start of the set. * @@ -35642,12 +32921,11 @@ exports.extend = extend; * @param item - an item */ function prepend(set, item) { - var cloned = new Set(set); + const cloned = new Set(set); set.clear(); set.add(item); cloned.forEach(set.add, set); } -exports.prepend = prepend; /** * Replaces the given item or all items matching condition with a new item. * @@ -35657,38 +32935,26 @@ exports.prepend = prepend; * @param item - an item */ function replace(set, conditionOrItem, newItem) { - var e_1, _a; - var newSet = new Set(); - try { - for (var set_1 = __values(set), set_1_1 = set_1.next(); !set_1_1.done; set_1_1 = set_1.next()) { - var oldItem = set_1_1.value; - if (util_1.isFunction(conditionOrItem)) { - if (!!conditionOrItem.call(null, oldItem)) { - newSet.add(newItem); - } - else { - newSet.add(oldItem); - } - } - else if (oldItem === conditionOrItem) { + const newSet = new Set(); + for (const oldItem of set) { + if ((0, util_1.isFunction)(conditionOrItem)) { + if (!!conditionOrItem.call(null, oldItem)) { newSet.add(newItem); } else { newSet.add(oldItem); } } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (set_1_1 && !set_1_1.done && (_a = set_1.return)) _a.call(set_1); + else if (oldItem === conditionOrItem) { + newSet.add(newItem); + } + else { + newSet.add(oldItem); } - finally { if (e_1) throw e_1.error; } } set.clear(); newSet.forEach(set.add, set); } -exports.replace = replace; /** * Inserts the given item before the given index. * @@ -35696,29 +32962,17 @@ exports.replace = replace; * @param item - an item */ function insert(set, item, index) { - var e_2, _a; - var newSet = new Set(); - var i = 0; - try { - for (var set_2 = __values(set), set_2_1 = set_2.next(); !set_2_1.done; set_2_1 = set_2.next()) { - var oldItem = set_2_1.value; - if (i === index) - newSet.add(item); - newSet.add(oldItem); - i++; - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (set_2_1 && !set_2_1.done && (_a = set_2.return)) _a.call(set_2); - } - finally { if (e_2) throw e_2.error; } + const newSet = new Set(); + let i = 0; + for (const oldItem of set) { + if (i === index) + newSet.add(item); + newSet.add(oldItem); + i++; } set.clear(); newSet.forEach(set.add, set); } -exports.insert = insert; /** * Removes the given item or all items matching condition. * @@ -35727,50 +32981,27 @@ exports.insert = insert; * to remove */ function remove(set, conditionOrItem) { - var e_3, _a, e_4, _b; - if (!util_1.isFunction(conditionOrItem)) { + if (!(0, util_1.isFunction)(conditionOrItem)) { set.delete(conditionOrItem); } else { - var toRemove = []; - try { - for (var set_3 = __values(set), set_3_1 = set_3.next(); !set_3_1.done; set_3_1 = set_3.next()) { - var item = set_3_1.value; - if (!!conditionOrItem.call(null, item)) { - toRemove.push(item); - } + const toRemove = []; + for (const item of set) { + if (!!conditionOrItem.call(null, item)) { + toRemove.push(item); } } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (set_3_1 && !set_3_1.done && (_a = set_3.return)) _a.call(set_3); - } - finally { if (e_3) throw e_3.error; } - } - try { - for (var toRemove_1 = __values(toRemove), toRemove_1_1 = toRemove_1.next(); !toRemove_1_1.done; toRemove_1_1 = toRemove_1.next()) { - var oldItem = toRemove_1_1.value; - set.delete(oldItem); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (toRemove_1_1 && !toRemove_1_1.done && (_b = toRemove_1.return)) _b.call(toRemove_1); - } - finally { if (e_4) throw e_4.error; } + for (const oldItem of toRemove) { + set.delete(oldItem); } } } -exports.remove = remove; /** * Removes all items from the set. */ function empty(set) { set.clear(); } -exports.empty = empty; /** * Determines if the set contains the given item or any items matching * condition. @@ -35779,30 +33010,18 @@ exports.empty = empty; * @param conditionOrItem - an item to a condition to match */ function contains(set, conditionOrItem) { - var e_5, _a; - if (!util_1.isFunction(conditionOrItem)) { + if (!(0, util_1.isFunction)(conditionOrItem)) { return set.has(conditionOrItem); } else { - try { - for (var set_4 = __values(set), set_4_1 = set_4.next(); !set_4_1.done; set_4_1 = set_4.next()) { - var oldItem = set_4_1.value; - if (!!conditionOrItem.call(null, oldItem)) { - return true; - } - } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (set_4_1 && !set_4_1.done && (_a = set_4.return)) _a.call(set_4); + for (const oldItem of set) { + if (!!conditionOrItem.call(null, oldItem)) { + return true; } - finally { if (e_5) throw e_5.error; } } } return false; } -exports.contains = contains; /** * Returns the count of items in the set matching the given condition. * @@ -35810,31 +33029,19 @@ exports.contains = contains; * @param condition - an optional condition to match */ function size(set, condition) { - var e_6, _a; if (condition === undefined) { return set.size; } else { - var count = 0; - try { - for (var set_5 = __values(set), set_5_1 = set_5.next(); !set_5_1.done; set_5_1 = set_5.next()) { - var item = set_5_1.value; - if (!!condition.call(null, item)) { - count++; - } - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (set_5_1 && !set_5_1.done && (_a = set_5.return)) _a.call(set_5); + let count = 0; + for (const item of set) { + if (!!condition.call(null, item)) { + count++; } - finally { if (e_6) throw e_6.error; } } return count; } } -exports.size = size; /** * Determines if the set is empty. * @@ -35843,55 +33050,24 @@ exports.size = size; function isEmpty(set) { return set.size === 0; } -exports.isEmpty = isEmpty; /** * Returns an iterator for the items of the set. * * @param set - a set * @param condition - an optional condition to match */ -function forEach(set, condition) { - var set_6, set_6_1, item, e_7_1; - var e_7, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(condition === undefined)) return [3 /*break*/, 2]; - return [5 /*yield**/, __values(set)]; - case 1: - _b.sent(); - return [3 /*break*/, 9]; - case 2: - _b.trys.push([2, 7, 8, 9]); - set_6 = __values(set), set_6_1 = set_6.next(); - _b.label = 3; - case 3: - if (!!set_6_1.done) return [3 /*break*/, 6]; - item = set_6_1.value; - if (!!!condition.call(null, item)) return [3 /*break*/, 5]; - return [4 /*yield*/, item]; - case 4: - _b.sent(); - _b.label = 5; - case 5: - set_6_1 = set_6.next(); - return [3 /*break*/, 3]; - case 6: return [3 /*break*/, 9]; - case 7: - e_7_1 = _b.sent(); - e_7 = { error: e_7_1 }; - return [3 /*break*/, 9]; - case 8: - try { - if (set_6_1 && !set_6_1.done && (_a = set_6.return)) _a.call(set_6); - } - finally { if (e_7) throw e_7.error; } - return [7 /*endfinally*/]; - case 9: return [2 /*return*/]; +function* forEach(set, condition) { + if (condition === undefined) { + yield* set; + } + else { + for (const item of set) { + if (!!condition.call(null, item)) { + yield item; + } } - }); + } } -exports.forEach = forEach; /** * Creates and returns a shallow clone of set. * @@ -35900,7 +33076,6 @@ exports.forEach = forEach; function clone(set) { return new Set(set); } -exports.clone = clone; /** * Returns a new set containing items from the set sorted in ascending * order. @@ -35910,13 +33085,10 @@ exports.clone = clone; * is less than its second argument, and `false` otherwise. */ function sortInAscendingOrder(set, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], set)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? -1 : 1; - }); + const list = new Array(...set); + list.sort((itemA, itemB) => lessThanAlgo.call(null, itemA, itemB) ? -1 : 1); return new Set(list); } -exports.sortInAscendingOrder = sortInAscendingOrder; /** * Returns a new set containing items from the set sorted in descending * order. @@ -35926,13 +33098,10 @@ exports.sortInAscendingOrder = sortInAscendingOrder; * is less than its second argument, and `false` otherwise. */ function sortInDescendingOrder(set, lessThanAlgo) { - var list = new (Array.bind.apply(Array, __spread([void 0], set)))(); - list.sort(function (itemA, itemB) { - return lessThanAlgo.call(null, itemA, itemB) ? 1 : -1; - }); + const list = new Array(...set); + list.sort((itemA, itemB) => lessThanAlgo.call(null, itemA, itemB) ? 1 : -1); return new Set(list); } -exports.sortInDescendingOrder = sortInDescendingOrder; /** * Determines if a set is a subset of another set. * @@ -35940,24 +33109,12 @@ exports.sortInDescendingOrder = sortInDescendingOrder; * @param superset - a superset possibly containing all items from `subset`. */ function isSubsetOf(subset, superset) { - var e_8, _a; - try { - for (var subset_1 = __values(subset), subset_1_1 = subset_1.next(); !subset_1_1.done; subset_1_1 = subset_1.next()) { - var item = subset_1_1.value; - if (!superset.has(item)) - return false; - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1); - } - finally { if (e_8) throw e_8.error; } + for (const item of subset) { + if (!superset.has(item)) + return false; } return true; } -exports.isSubsetOf = isSubsetOf; /** * Determines if a set is a superset of another set. * @@ -35967,7 +33124,6 @@ exports.isSubsetOf = isSubsetOf; function isSupersetOf(superset, subset) { return isSubsetOf(subset, superset); } -exports.isSupersetOf = isSupersetOf; /** * Returns a new set with items that are contained in both sets. * @@ -35975,25 +33131,13 @@ exports.isSupersetOf = isSupersetOf; * @param setB - a set */ function intersection(setA, setB) { - var e_9, _a; - var newSet = new Set(); - try { - for (var setA_1 = __values(setA), setA_1_1 = setA_1.next(); !setA_1_1.done; setA_1_1 = setA_1.next()) { - var item = setA_1_1.value; - if (setB.has(item)) - newSet.add(item); - } - } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { - try { - if (setA_1_1 && !setA_1_1.done && (_a = setA_1.return)) _a.call(setA_1); - } - finally { if (e_9) throw e_9.error; } + const newSet = new Set(); + for (const item of setA) { + if (setB.has(item)) + newSet.add(item); } return newSet; } -exports.intersection = intersection; /** * Returns a new set with items from both sets. * @@ -36001,11 +33145,10 @@ exports.intersection = intersection; * @param setB - a set */ function union(setA, setB) { - var newSet = new Set(setA); + const newSet = new Set(setA); setB.forEach(newSet.add, newSet); return newSet; } -exports.union = union; /** * Returns a set of integers from `n` to `m` inclusive. * @@ -36013,13 +33156,12 @@ exports.union = union; * @param m - ending number */ function range(n, m) { - var newSet = new Set(); - for (var i = n; i <= m; i++) { + const newSet = new Set(); + for (let i = n; i <= m; i++) { newSet.add(i); } return newSet; } -exports.range = range; //# sourceMappingURL=Set.js.map /***/ }), @@ -36030,6 +33172,8 @@ exports.range = range; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.push = push; +exports.pop = pop; /** * Pushes the given item to the stack. * @@ -36039,7 +33183,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); function push(list, item) { list.push(item); } -exports.push = push; /** * Pops and returns an item from the stack. * @@ -36048,32 +33191,39 @@ exports.push = push; function pop(list) { return list.pop() || null; } -exports.pop = pop; //# sourceMappingURL=Stack.js.map /***/ }), /***/ 13203: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var CodePoints_1 = __nccwpck_require__(28548); -var ByteSequence_1 = __nccwpck_require__(71627); -var Byte_1 = __nccwpck_require__(42460); -var util_1 = __nccwpck_require__(76195); +exports.isCodeUnitPrefix = isCodeUnitPrefix; +exports.isCodeUnitLessThan = isCodeUnitLessThan; +exports.isomorphicEncode = isomorphicEncode; +exports.isASCIIString = isASCIIString; +exports.asciiLowercase = asciiLowercase; +exports.asciiUppercase = asciiUppercase; +exports.asciiCaseInsensitiveMatch = asciiCaseInsensitiveMatch; +exports.asciiEncode = asciiEncode; +exports.asciiDecode = asciiDecode; +exports.stripNewlines = stripNewlines; +exports.normalizeNewlines = normalizeNewlines; +exports.stripLeadingAndTrailingASCIIWhitespace = stripLeadingAndTrailingASCIIWhitespace; +exports.stripAndCollapseASCIIWhitespace = stripAndCollapseASCIIWhitespace; +exports.collectASequenceOfCodePoints = collectASequenceOfCodePoints; +exports.skipASCIIWhitespace = skipASCIIWhitespace; +exports.strictlySplit = strictlySplit; +exports.splitAStringOnASCIIWhitespace = splitAStringOnASCIIWhitespace; +exports.splitAStringOnCommas = splitAStringOnCommas; +exports.concatenate = concatenate; +const CodePoints_1 = __nccwpck_require__(28548); +const ByteSequence_1 = __nccwpck_require__(71627); +const Byte_1 = __nccwpck_require__(42460); +const util_1 = __nccwpck_require__(76195); /** * Determines if the string `a` is a code unit prefix of string `b`. * @@ -36092,10 +33242,10 @@ function isCodeUnitPrefix(a, b) { * 2.4. Return false if aCodeUnit is different from bCodeUnit. * 2.5. Set i to i + 1. */ - var i = 0; + let i = 0; while (true) { - var aCodeUnit = i < a.length ? a.charCodeAt(i) : null; - var bCodeUnit = i < b.length ? b.charCodeAt(i) : null; + const aCodeUnit = i < a.length ? a.charCodeAt(i) : null; + const bCodeUnit = i < b.length ? b.charCodeAt(i) : null; if (aCodeUnit === null) return true; if (aCodeUnit !== bCodeUnit) @@ -36103,7 +33253,6 @@ function isCodeUnitPrefix(a, b) { i++; } } -exports.isCodeUnitPrefix = isCodeUnitPrefix; /** * Determines if the string `a` is a code unit less than string `b`. * @@ -36125,9 +33274,9 @@ function isCodeUnitLessThan(a, b) { return false; if (isCodeUnitPrefix(a, b)) return true; - for (var i = 0; i < Math.min(a.length, b.length); i++) { - var aCodeUnit = a.charCodeAt(i); - var bCodeUnit = b.charCodeAt(i); + for (let i = 0; i < Math.min(a.length, b.length); i++) { + const aCodeUnit = a.charCodeAt(i); + const bCodeUnit = b.charCodeAt(i); if (aCodeUnit === bCodeUnit) continue; return (aCodeUnit < bCodeUnit); @@ -36135,42 +33284,29 @@ function isCodeUnitLessThan(a, b) { /* istanbul ignore next */ return false; } -exports.isCodeUnitLessThan = isCodeUnitLessThan; /** * Isomorphic encodes the given string. * * @param str - a string */ function isomorphicEncode(str) { - var e_1, _a; /** * 1. Assert: input contains no code points greater than U+00FF. * 2. Return a byte sequence whose length is equal to input’s length and whose * bytes have the same values as input’s code points, in the same order. */ - var codePoints = Array.from(str); - var bytes = new Uint8Array(codePoints.length); - var i = 0; - try { - for (var str_1 = __values(str), str_1_1 = str_1.next(); !str_1_1.done; str_1_1 = str_1.next()) { - var codePoint = str_1_1.value; - var byte = codePoint.codePointAt(0); - console.assert(byte !== undefined && byte <= 0x00FF, "isomorphicEncode requires string bytes to be less than or equal to 0x00FF."); - if (byte !== undefined && byte <= 0x00FF) { - bytes[i++] = byte; - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (str_1_1 && !str_1_1.done && (_a = str_1.return)) _a.call(str_1); + const codePoints = Array.from(str); + const bytes = new Uint8Array(codePoints.length); + let i = 0; + for (const codePoint of str) { + const byte = codePoint.codePointAt(0); + console.assert(byte !== undefined && byte <= 0x00FF, "isomorphicEncode requires string bytes to be less than or equal to 0x00FF."); + if (byte !== undefined && byte <= 0x00FF) { + bytes[i++] = byte; } - finally { if (e_1) throw e_1.error; } } return bytes; } -exports.isomorphicEncode = isomorphicEncode; /** * Determines if the given string is An ASCII string. * @@ -36182,75 +33318,50 @@ function isASCIIString(str) { */ return /^[\u0000-\u007F]*$/.test(str); } -exports.isASCIIString = isASCIIString; /** * Converts all uppercase ASCII code points to lowercase. * * @param str - a string */ function asciiLowercase(str) { - var e_2, _a; /** * To ASCII lowercase a string, replace all ASCII upper alphas in the string * with their corresponding code point in ASCII lower alpha. */ - var result = ""; - try { - for (var str_2 = __values(str), str_2_1 = str_2.next(); !str_2_1.done; str_2_1 = str_2.next()) { - var c = str_2_1.value; - var code = c.codePointAt(0); - if (code !== undefined && code >= 0x41 && code <= 0x5A) { - result += String.fromCodePoint(code + 0x20); - } - else { - result += c; - } + let result = ""; + for (const c of str) { + const code = c.codePointAt(0); + if (code !== undefined && code >= 0x41 && code <= 0x5A) { + result += String.fromCodePoint(code + 0x20); } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (str_2_1 && !str_2_1.done && (_a = str_2.return)) _a.call(str_2); + else { + result += c; } - finally { if (e_2) throw e_2.error; } } return result; } -exports.asciiLowercase = asciiLowercase; /** * Converts all uppercase ASCII code points to uppercase. * * @param str - a string */ function asciiUppercase(str) { - var e_3, _a; /** * To ASCII uppercase a string, replace all ASCII lower alphas in the string * with their corresponding code point in ASCII upper alpha. */ - var result = ""; - try { - for (var str_3 = __values(str), str_3_1 = str_3.next(); !str_3_1.done; str_3_1 = str_3.next()) { - var c = str_3_1.value; - var code = c.codePointAt(0); - if (code !== undefined && code >= 0x61 && code <= 0x7A) { - result += String.fromCodePoint(code - 0x20); - } - else { - result += c; - } + let result = ""; + for (const c of str) { + const code = c.codePointAt(0); + if (code !== undefined && code >= 0x61 && code <= 0x7A) { + result += String.fromCodePoint(code - 0x20); } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (str_3_1 && !str_3_1.done && (_a = str_3.return)) _a.call(str_3); + else { + result += c; } - finally { if (e_3) throw e_3.error; } } return result; } -exports.asciiUppercase = asciiUppercase; /** * Compares two ASCII strings case-insensitively. * @@ -36264,7 +33375,6 @@ function asciiCaseInsensitiveMatch(a, b) { */ return asciiLowercase(a) === asciiLowercase(b); } -exports.asciiCaseInsensitiveMatch = asciiCaseInsensitiveMatch; /** * ASCII encodes a string. * @@ -36278,34 +33388,21 @@ function asciiEncode(str) { console.assert(isASCIIString(str), "asciiEncode requires an ASCII string."); return isomorphicEncode(str); } -exports.asciiEncode = asciiEncode; /** * ASCII decodes a byte sequence. * * @param bytes - a byte sequence */ function asciiDecode(bytes) { - var e_4, _a; - try { - /** - * 1. Assert: All bytes in input are ASCII bytes. - * 2. Return the isomorphic decoding of input. - */ - for (var bytes_1 = __values(bytes), bytes_1_1 = bytes_1.next(); !bytes_1_1.done; bytes_1_1 = bytes_1.next()) { - var byte = bytes_1_1.value; - console.assert(Byte_1.isASCIIByte(byte), "asciiDecode requires an ASCII byte sequence."); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (bytes_1_1 && !bytes_1_1.done && (_a = bytes_1.return)) _a.call(bytes_1); - } - finally { if (e_4) throw e_4.error; } + /** + * 1. Assert: All bytes in input are ASCII bytes. + * 2. Return the isomorphic decoding of input. + */ + for (const byte of bytes) { + console.assert((0, Byte_1.isASCIIByte)(byte), "asciiDecode requires an ASCII byte sequence."); } - return ByteSequence_1.isomorphicDecode(bytes); + return (0, ByteSequence_1.isomorphicDecode)(bytes); } -exports.asciiDecode = asciiDecode; /** * Strips newline characters from a string. * @@ -36318,7 +33415,6 @@ function stripNewlines(str) { */ return str.replace(/[\n\r]/g, ""); } -exports.stripNewlines = stripNewlines; /** * Normalizes newline characters in a string by converting consecutive * carriage-return newline characters and also single carriage return characters @@ -36334,7 +33430,6 @@ function normalizeNewlines(str) { */ return str.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); } -exports.normalizeNewlines = normalizeNewlines; /** * Removes leading and trailing whitespace characters from a string. * @@ -36347,7 +33442,6 @@ function stripLeadingAndTrailingASCIIWhitespace(str) { */ return str.replace(/^[\t\n\f\r ]+/, "").replace(/[\t\n\f\r ]+$/, ""); } -exports.stripLeadingAndTrailingASCIIWhitespace = stripLeadingAndTrailingASCIIWhitespace; /** * Removes consecutive newline characters from a string. * @@ -36362,7 +33456,6 @@ function stripAndCollapseASCIIWhitespace(str) { */ return stripLeadingAndTrailingASCIIWhitespace(str.replace(/[\t\n\f\r ]{2,}/g, " ")); } -exports.stripAndCollapseASCIIWhitespace = stripAndCollapseASCIIWhitespace; /** * Collects a sequence of code points matching a given condition from the input * string. @@ -36380,16 +33473,15 @@ function collectASequenceOfCodePoints(condition, input, options) { * 2.2. Advance position by 1. * 3. Return result. */ - if (!util_1.isArray(input)) + if (!(0, util_1.isArray)(input)) return collectASequenceOfCodePoints(condition, Array.from(input), options); - var result = ""; + let result = ""; while (options.position < input.length && !!condition.call(null, input[options.position])) { result += input[options.position]; options.position++; } return result; } -exports.collectASequenceOfCodePoints = collectASequenceOfCodePoints; /** * Skips over ASCII whitespace. * @@ -36403,9 +33495,8 @@ function skipASCIIWhitespace(input, options) { * input given position. The collected code points are not used, but position * is still updated. */ - collectASequenceOfCodePoints(function (str) { return CodePoints_1.ASCIIWhiteSpace.test(str); }, input, options); + collectASequenceOfCodePoints(str => CodePoints_1.ASCIIWhiteSpace.test(str), input, options); } -exports.skipASCIIWhitespace = skipASCIIWhitespace; /** * Solits a string at the given delimiter. * @@ -36428,21 +33519,20 @@ function strictlySplit(input, delimiter) { * 5.4. Append token to tokens. * 6. Return tokens. */ - if (!util_1.isArray(input)) + if (!(0, util_1.isArray)(input)) return strictlySplit(Array.from(input), delimiter); - var options = { position: 0 }; - var tokens = []; - var token = collectASequenceOfCodePoints(function (str) { return delimiter !== str; }, input, options); + const options = { position: 0 }; + const tokens = []; + let token = collectASequenceOfCodePoints(str => delimiter !== str, input, options); tokens.push(token); while (options.position < input.length) { console.assert(input[options.position] === delimiter, "strictlySplit found no delimiter in input string."); options.position++; - token = collectASequenceOfCodePoints(function (str) { return delimiter !== str; }, input, options); + token = collectASequenceOfCodePoints(str => delimiter !== str, input, options); tokens.push(token); } return tokens; } -exports.strictlySplit = strictlySplit; /** * Splits a string on ASCII whitespace. * @@ -36461,19 +33551,18 @@ function splitAStringOnASCIIWhitespace(input) { * 4.3. Skip ASCII whitespace within input given position. * 5. Return tokens. */ - if (!util_1.isArray(input)) + if (!(0, util_1.isArray)(input)) return splitAStringOnASCIIWhitespace(Array.from(input)); - var options = { position: 0 }; - var tokens = []; + const options = { position: 0 }; + const tokens = []; skipASCIIWhitespace(input, options); while (options.position < input.length) { - var token = collectASequenceOfCodePoints(function (str) { return !CodePoints_1.ASCIIWhiteSpace.test(str); }, input, options); + const token = collectASequenceOfCodePoints(str => !CodePoints_1.ASCIIWhiteSpace.test(str), input, options); tokens.push(token); skipASCIIWhitespace(input, options); } return tokens; } -exports.splitAStringOnASCIIWhitespace = splitAStringOnASCIIWhitespace; /** * Splits a string on commas. * @@ -36494,12 +33583,12 @@ function splitAStringOnCommas(input) { * 3.4.2. Advance position by 1. * 4. Return tokens. */ - if (!util_1.isArray(input)) + if (!(0, util_1.isArray)(input)) return splitAStringOnCommas(Array.from(input)); - var options = { position: 0 }; - var tokens = []; + const options = { position: 0 }; + const tokens = []; while (options.position < input.length) { - var token = collectASequenceOfCodePoints(function (str) { return str !== ','; }, input, options); + const token = collectASequenceOfCodePoints(str => str !== ',', input, options); tokens.push(stripLeadingAndTrailingASCIIWhitespace(token)); if (options.position < input.length) { console.assert(input[options.position] === ',', "splitAStringOnCommas found no delimiter in input string."); @@ -36508,15 +33597,13 @@ function splitAStringOnCommas(input) { } return tokens; } -exports.splitAStringOnCommas = splitAStringOnCommas; /** * Concatenates a list of strings with the given separator. * * @param list - a list of strings * @param separator - a separator string */ -function concatenate(list, separator) { - if (separator === void 0) { separator = ""; } +function concatenate(list, separator = "") { /** * 1. If list is empty, then return the empty string. * 2. If separator is not given, then set separator to the empty string. @@ -36527,7 +33614,6 @@ function concatenate(list, separator) { return ""; return list.join(separator); } -exports.concatenate = concatenate; //# sourceMappingURL=String.js.map /***/ }), @@ -36537,84 +33623,125 @@ exports.concatenate = concatenate; "use strict"; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var base64 = __importStar(__nccwpck_require__(28585)); +exports.string = exports.stack = exports.set = exports.queue = exports.namespace = exports.map = exports.list = exports.json = exports.codePoint = exports.byteSequence = exports.byte = exports.base64 = void 0; +const base64 = __importStar(__nccwpck_require__(28585)); exports.base64 = base64; -var byte = __importStar(__nccwpck_require__(42460)); +const byte = __importStar(__nccwpck_require__(42460)); exports.byte = byte; -var byteSequence = __importStar(__nccwpck_require__(71627)); +const byteSequence = __importStar(__nccwpck_require__(71627)); exports.byteSequence = byteSequence; -var codePoint = __importStar(__nccwpck_require__(28548)); +const codePoint = __importStar(__nccwpck_require__(28548)); exports.codePoint = codePoint; -var json = __importStar(__nccwpck_require__(99387)); +const json = __importStar(__nccwpck_require__(99387)); exports.json = json; -var list = __importStar(__nccwpck_require__(20340)); +const list = __importStar(__nccwpck_require__(20340)); exports.list = list; -var map = __importStar(__nccwpck_require__(22298)); +const map = __importStar(__nccwpck_require__(22298)); exports.map = map; -var namespace = __importStar(__nccwpck_require__(93764)); +const namespace = __importStar(__nccwpck_require__(93764)); exports.namespace = namespace; -var queue = __importStar(__nccwpck_require__(39201)); +const queue = __importStar(__nccwpck_require__(39201)); exports.queue = queue; -var set = __importStar(__nccwpck_require__(35931)); +const set = __importStar(__nccwpck_require__(35931)); exports.set = set; -var stack = __importStar(__nccwpck_require__(38784)); +const stack = __importStar(__nccwpck_require__(38784)); exports.stack = stack; -var string = __importStar(__nccwpck_require__(13203)); +const string = __importStar(__nccwpck_require__(13203)); exports.string = string; //# sourceMappingURL=index.js.map /***/ }), /***/ 53568: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); -var interfaces_1 = __nccwpck_require__(31752); -var infra_1 = __nccwpck_require__(84251); -var url_1 = __nccwpck_require__(57310); -var _validationErrorCallback; +exports.setValidationErrorCallback = setValidationErrorCallback; +exports.newURL = newURL; +exports.isSpecialScheme = isSpecialScheme; +exports.isSpecial = isSpecial; +exports.defaultPort = defaultPort; +exports.includesCredentials = includesCredentials; +exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; +exports.urlSerializer = urlSerializer; +exports.hostSerializer = hostSerializer; +exports.iPv4Serializer = iPv4Serializer; +exports.iPv6Serializer = iPv6Serializer; +exports.urlParser = urlParser; +exports.basicURLParser = basicURLParser; +exports.setTheUsername = setTheUsername; +exports.setThePassword = setThePassword; +exports.isSingleDotPathSegment = isSingleDotPathSegment; +exports.isDoubleDotPathSegment = isDoubleDotPathSegment; +exports.shorten = shorten; +exports.isNormalizedWindowsDriveLetter = isNormalizedWindowsDriveLetter; +exports.isWindowsDriveLetter = isWindowsDriveLetter; +exports.startsWithAWindowsDriveLetter = startsWithAWindowsDriveLetter; +exports.hostParser = hostParser; +exports.iPv4NumberParser = iPv4NumberParser; +exports.iPv4Parser = iPv4Parser; +exports.iPv6Parser = iPv6Parser; +exports.opaqueHostParser = opaqueHostParser; +exports.resolveABlobURL = resolveABlobURL; +exports.percentEncode = percentEncode; +exports.percentDecode = percentDecode; +exports.stringPercentDecode = stringPercentDecode; +exports.utf8PercentEncode = utf8PercentEncode; +exports.hostEquals = hostEquals; +exports.urlEquals = urlEquals; +exports.urlEncodedStringParser = urlEncodedStringParser; +exports.urlEncodedParser = urlEncodedParser; +exports.urlEncodedByteSerializer = urlEncodedByteSerializer; +exports.urlEncodedSerializer = urlEncodedSerializer; +exports.origin = origin; +exports.domainToASCII = domainToASCII; +exports.domainToUnicode = domainToUnicode; +exports.asciiSerializationOfAnOrigin = asciiSerializationOfAnOrigin; +const util_1 = __nccwpck_require__(76195); +const interfaces_1 = __nccwpck_require__(31752); +const infra_1 = __nccwpck_require__(84251); +const url_1 = __nccwpck_require__(57310); +let _validationErrorCallback; /** * Default ports for a special URL scheme. */ -var _defaultPorts = { +const _defaultPorts = { "ftp": 21, "file": null, "http": 80, @@ -36626,23 +33753,23 @@ var _defaultPorts = { * The C0 control percent-encode set are the C0 controls and all code points * greater than U+007E (~). */ -var _c0ControlPercentEncodeSet = /[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +const _c0ControlPercentEncodeSet = /[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; /** * The fragment percent-encode set is the C0 control percent-encode set and * U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and U+0060 (`). */ -var _fragmentPercentEncodeSet = /[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +const _fragmentPercentEncodeSet = /[ "<>`]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; /** * The path percent-encode set is the fragment percent-encode set and * U+0023 (#), U+003F (?), U+007B ({), and U+007D (}). */ -var _pathPercentEncodeSet = /[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +const _pathPercentEncodeSet = /[ "<>`#?{}]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; /** * The userinfo percent-encode set is the path percent-encode set and * U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@), U+005B ([), * U+005C (\), U+005D (]), U+005E (^), and U+007C (|). */ -var _userInfoPercentEncodeSet = /[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +const _userInfoPercentEncodeSet = /[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; /** * The URL code points are ASCII alphanumeric, U+0021 (!), U+0024 ($), * U+0026 (&), U+0027 ('), U+0028 LEFT PARENTHESIS, U+0029 RIGHT PARENTHESIS, @@ -36651,13 +33778,13 @@ var _userInfoPercentEncodeSet = /[ "<>`#?{}/:;=@\[\]\\\^\|]|[\0-\x1F\x7F-\uD7FF\ * U+007E (~), and code points in the range U+00A0 to U+10FFFD, inclusive, * excluding surrogates and noncharacters. */ -var _urlCodePoints = /[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/; +const _urlCodePoints = /[0-9A-Za-z!\$&-\/:;=\?@_~\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB40-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD]/; /** * A forbidden host code point is U+0000 NULL, U+0009 TAB, U+000A LF, * U+000D CR, U+0020 SPACE, U+0023 (#), U+0025 (%), U+002F (/), U+003A (:), * U+003F (?), U+0040 (@), U+005B ([), U+005C (\), or U+005D (]). */ -var _forbiddenHostCodePoint = /[\0\t\f\r #%/:?@\[\\\]]/; +const _forbiddenHostCodePoint = /[\0\t\f\r #%/:?@\[\\\]]/; /** * Sets the callback function for validation errors. * @@ -36667,7 +33794,6 @@ var _forbiddenHostCodePoint = /[\0\t\f\r #%/:?@\[\\\]]/; function setValidationErrorCallback(validationErrorCallback) { _validationErrorCallback = validationErrorCallback; } -exports.setValidationErrorCallback = setValidationErrorCallback; /** * Generates a validation error. * @@ -36695,7 +33821,6 @@ function newURL() { _blobURLEntry: null }; } -exports.newURL = newURL; /** * Determines if the scheme is a special scheme. * @@ -36704,7 +33829,6 @@ exports.newURL = newURL; function isSpecialScheme(scheme) { return (scheme in _defaultPorts); } -exports.isSpecialScheme = isSpecialScheme; /** * Determines if the URL has a special scheme. * @@ -36713,7 +33837,6 @@ exports.isSpecialScheme = isSpecialScheme; function isSpecial(url) { return isSpecialScheme(url.scheme); } -exports.isSpecial = isSpecial; /** * Returns the default port for a special scheme. * @@ -36722,7 +33845,6 @@ exports.isSpecial = isSpecial; function defaultPort(scheme) { return _defaultPorts[scheme] || null; } -exports.defaultPort = defaultPort; /** * Determines if the URL has credentials. * @@ -36731,7 +33853,6 @@ exports.defaultPort = defaultPort; function includesCredentials(url) { return url.username !== '' || url.password !== ''; } -exports.includesCredentials = includesCredentials; /** * Determines if an URL cannot have credentials. * @@ -36746,19 +33867,16 @@ function cannotHaveAUsernamePasswordPort(url) { return (url.host === null || url.host === "" || url._cannotBeABaseURLFlag || url.scheme === "file"); } -exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; /** * Serializes an URL into a string. * * @param url - an URL */ -function urlSerializer(url, excludeFragmentFlag) { - var e_1, _a; - if (excludeFragmentFlag === void 0) { excludeFragmentFlag = false; } +function urlSerializer(url, excludeFragmentFlag = false) { /** * 1. Let output be url’s scheme and U+003A (:) concatenated. */ - var output = url.scheme + ':'; + let output = url.scheme + ':'; /** * 2. If url’s host is non-null: */ @@ -36809,18 +33927,8 @@ function urlSerializer(url, excludeFragmentFlag) { output += url.path[0]; } else { - try { - for (var _b = __values(url.path), _c = _b.next(); !_c.done; _c = _b.next()) { - var str = _c.value; - output += '/' + str; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + for (const str of url.path) { + output += '/' + str; } } /** @@ -36838,7 +33946,6 @@ function urlSerializer(url, excludeFragmentFlag) { } return output; } -exports.urlSerializer = urlSerializer; /** * Serializes a host into a string. * @@ -36853,17 +33960,16 @@ function hostSerializer(host) { * U+005D (]). * 3. Otherwise, host is a domain, opaque host, or empty host, return host. */ - if (util_1.isNumber(host)) { + if ((0, util_1.isNumber)(host)) { return iPv4Serializer(host); } - else if (util_1.isArray(host)) { + else if ((0, util_1.isArray)(host)) { return '[' + iPv6Serializer(host) + ']'; } else { return host; } } -exports.hostSerializer = hostSerializer; /** * Serializes an IPv4 address into a string. * @@ -36879,9 +33985,9 @@ function iPv4Serializer(address) { * 3.3. Set n to floor(n / 256). * 4. Return output. */ - var output = ""; - var n = address; - for (var i = 1; i <= 4; i++) { + let output = ""; + let n = address; + for (let i = 1; i <= 4; i++) { output = (n % 256).toString() + output; if (i !== 4) { output = '.' + output; @@ -36890,7 +33996,6 @@ function iPv4Serializer(address) { } return output; } -exports.iPv4Serializer = iPv4Serializer; /** * Serializes an IPv6 address into a string. * @@ -36905,16 +34010,16 @@ function iPv6Serializer(address) { * 3. If there is no sequence of address’s IPv6 pieces that are 0 that is * longer than 1, then set compress to null. */ - var output = ""; - var compress = null; - var lastIndex = -1; - var count = 0; - var lastCount = 0; - for (var i = 0; i < 8; i++) { + let output = ""; + let compress = null; + let lastIndex = -1; + let count = 0; + let lastCount = 0; + for (let i = 0; i < 8; i++) { if (address[i] !== 0) continue; count = 1; - for (var j = i + 1; j < 8; j++) { + for (let j = i + 1; j < 8; j++) { if (address[j] !== 0) break; count++; @@ -36931,8 +34036,8 @@ function iPv6Serializer(address) { * 4. Let ignore0 be false. * 5. For each pieceIndex in the range 0 to 7, inclusive: */ - var ignore0 = false; - for (var pieceIndex = 0; pieceIndex < 8; pieceIndex++) { + let ignore0 = false; + for (let pieceIndex = 0; pieceIndex < 8; pieceIndex++) { /** * 5.1. If ignore0 is true and address[pieceIndex] is 0, then continue. * 5.2. Otherwise, if ignore0 is true, set ignore0 to false. @@ -36966,7 +34071,6 @@ function iPv6Serializer(address) { */ return output; } -exports.iPv6Serializer = iPv6Serializer; /** * Parses an URL string. * @@ -36984,12 +34088,12 @@ function urlParser(input, baseURL, encodingOverride) { * if that did not return failure, and null otherwise. * 5. Return url. */ - var url = basicURLParser(input, baseURL, encodingOverride); + const url = basicURLParser(input, baseURL, encodingOverride); if (url === null) return null; if (url.scheme !== "blob") return url; - var entry = resolveABlobURL(url); + const entry = resolveABlobURL(url); if (entry !== null) { url._blobURLEntry = entry; } @@ -36998,7 +34102,6 @@ function urlParser(input, baseURL, encodingOverride) { } return url; } -exports.urlParser = urlParser; /** * Parses an URL string. * @@ -37007,7 +34110,6 @@ exports.urlParser = urlParser; * @param encodingOverride - encoding override */ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { - var e_2, _a, e_3, _b; /** * 1. If url is not given: * 1.1. Set url to a new URL. @@ -37018,8 +34120,8 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { if (url === undefined) { url = newURL(); // leading - var leadingControlOrSpace = /^[\u0000-\u001F\u0020]+/; - var trailingControlOrSpace = /[\u0000-\u001F\u0020]+$/; + const leadingControlOrSpace = /^[\u0000-\u001F\u0020]+/; + const trailingControlOrSpace = /[\u0000-\u001F\u0020]+$/; if (leadingControlOrSpace.test(input) || trailingControlOrSpace.test(input)) { validationError("Input string contains leading or trailing control characters or space."); } @@ -37030,7 +34132,7 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { * 2. If input contains any ASCII tab or newline, validation error. * 3. Remove all ASCII tab or newline from input. */ - var tabOrNewline = /[\u0009\u000A\u000D]/g; + const tabOrNewline = /[\u0009\u000A\u000D]/g; if (tabOrNewline.test(input)) { validationError("Input string contains tab or newline characters."); } @@ -37042,10 +34144,10 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { * 7. If encoding override is given, set encoding to the result of getting * an output encoding from encoding override. */ - var state = (stateOverride === undefined ? interfaces_1.ParserState.SchemeStart : stateOverride); + let state = (stateOverride === undefined ? interfaces_1.ParserState.SchemeStart : stateOverride); if (baseURL === undefined) baseURL = null; - var encoding = (encodingOverride === undefined || + let encoding = (encodingOverride === undefined || encodingOverride === "replacement" || encodingOverride === "UTF-16BE" || encodingOverride === "UTF-16LE" ? "UTF-8" : encodingOverride); /** @@ -37053,12 +34155,12 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { * 9. Let the @ flag, [] flag, and passwordTokenSeenFlag be unset. * 10. Let pointer be a pointer to first code point in input. */ - var buffer = ""; - var atFlag = false; - var arrayFlag = false; - var passwordTokenSeenFlag = false; - var EOF = ""; - var walker = new util_1.StringWalker(input); + let buffer = ""; + let atFlag = false; + let arrayFlag = false; + let passwordTokenSeenFlag = false; + const EOF = ""; + const walker = new util_1.StringWalker(input); /** * 11. Keep running the following state machine by switching on state. If * after a run pointer points to the EOF code point, go to the next step. @@ -37436,37 +34538,27 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { if (atFlag) buffer = '%40' + buffer; atFlag = true; - try { - for (var buffer_1 = (e_2 = void 0, __values(buffer)), buffer_1_1 = buffer_1.next(); !buffer_1_1.done; buffer_1_1 = buffer_1.next()) { - var codePoint = buffer_1_1.value; - /** - * 1.4.1. If codePoint is U+003A (:) and passwordTokenSeenFlag is - * unset, then set passwordTokenSeenFlag and continue. - * 1.4.2. Let encodedCodePoints be the result of running UTF-8 - * percent encode codePoint using the userinfo percent-encode set. - * 1.4.3. If passwordTokenSeenFlag is set, then append - * encodedCodePoints to url’s password. - * 1.4.4. Otherwise, append encodedCodePoints to url’s username. - */ - if (codePoint === ':' && !passwordTokenSeenFlag) { - passwordTokenSeenFlag = true; - continue; - } - var encodedCodePoints = utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); - if (passwordTokenSeenFlag) { - url.password += encodedCodePoints; - } - else { - url.username += encodedCodePoints; - } + for (const codePoint of buffer) { + /** + * 1.4.1. If codePoint is U+003A (:) and passwordTokenSeenFlag is + * unset, then set passwordTokenSeenFlag and continue. + * 1.4.2. Let encodedCodePoints be the result of running UTF-8 + * percent encode codePoint using the userinfo percent-encode set. + * 1.4.3. If passwordTokenSeenFlag is set, then append + * encodedCodePoints to url’s password. + * 1.4.4. Otherwise, append encodedCodePoints to url’s username. + */ + if (codePoint === ':' && !passwordTokenSeenFlag) { + passwordTokenSeenFlag = true; + continue; } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (buffer_1_1 && !buffer_1_1.done && (_a = buffer_1.return)) _a.call(buffer_1); + const encodedCodePoints = utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); + if (passwordTokenSeenFlag) { + url.password += encodedCodePoints; + } + else { + url.username += encodedCodePoints; } - finally { if (e_2) throw e_2.error; } } /** * 1.5. Set buffer to the empty string. @@ -37527,7 +34619,7 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { validationError("Invalid input string."); return null; } - var host = hostParser(buffer, !isSpecial(url)); + const host = hostParser(buffer, !isSpecial(url)); if (host === null) return null; url.host = host; @@ -37565,7 +34657,7 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { validationError("Invalid input string."); return url; } - var host = hostParser(buffer, !isSpecial(url)); + const host = hostParser(buffer, !isSpecial(url)); if (host === null) return null; url.host = host; @@ -37617,7 +34709,7 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { * 2.1.4. Set buffer to the empty string. */ if (buffer !== "") { - var port = parseInt(buffer, 10); + const port = parseInt(buffer, 10); if (port > Math.pow(2, 16) - 1) { validationError("Invalid port number."); return null; @@ -37813,7 +34905,7 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { * 1.3.6. Set buffer to the empty string and state to path start * state. */ - var host = hostParser(buffer, !isSpecial(url)); + let host = hostParser(buffer, !isSpecial(url)); if (host === null) return null; if (host === "localhost") @@ -37931,7 +35023,7 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { validationError("Invalid input string."); url.host = ""; } - var bufferCodePoints = Array.from(buffer); + const bufferCodePoints = Array.from(buffer); buffer = bufferCodePoints.slice(0, 1) + ':' + bufferCodePoints.slice(2); } /** @@ -38065,7 +35157,7 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { if (encoding.toUpperCase() !== "UTF-8") { throw new Error("Only UTF-8 encoding is supported."); } - var bytes = util_1.utf8Encode(walker.c()); + let bytes = (0, util_1.utf8Encode)(walker.c()); /** * 3.4. If bytes starts with `&#` and ends with 0x3B (;), then: */ @@ -38082,36 +35174,26 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { url.query += "%26%23" + infra_1.byteSequence.isomorphicDecode(bytes) + "%3B"; } else { - try { - /** - * 3.5. Otherwise, for each byte in bytes: - * 3.5.1. If one of the following is true - * - byte is less than 0x21 (!) - * - byte is greater than 0x7E (~) - * - byte is 0x22 ("), 0x23 (#), 0x3C (<), or 0x3E (>) - * - byte is 0x27 (') and url is special - * then append byte, percent encoded, to url’s query. - * 3.5.2. Otherwise, append a code point whose value is byte to - * url’s query. - */ - for (var bytes_1 = (e_3 = void 0, __values(bytes)), bytes_1_1 = bytes_1.next(); !bytes_1_1.done; bytes_1_1 = bytes_1.next()) { - var byte = bytes_1_1.value; - if (byte < 0x21 || byte > 0x7E || byte === 0x22 || - byte === 0x23 || byte === 0x3C || byte === 0x3E || - (byte === 0x27 && isSpecial(url))) { - url.query += percentEncode(byte); - } - else { - url.query += String.fromCharCode(byte); - } + /** + * 3.5. Otherwise, for each byte in bytes: + * 3.5.1. If one of the following is true + * - byte is less than 0x21 (!) + * - byte is greater than 0x7E (~) + * - byte is 0x22 ("), 0x23 (#), 0x3C (<), or 0x3E (>) + * - byte is 0x27 (') and url is special + * then append byte, percent encoded, to url’s query. + * 3.5.2. Otherwise, append a code point whose value is byte to + * url’s query. + */ + for (const byte of bytes) { + if (byte < 0x21 || byte > 0x7E || byte === 0x22 || + byte === 0x23 || byte === 0x3C || byte === 0x3E || + (byte === 0x27 && isSpecial(url))) { + url.query += percentEncode(byte); } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (bytes_1_1 && !bytes_1_1.done && (_b = bytes_1.return)) _b.call(bytes_1); + else { + url.query += String.fromCharCode(byte); } - finally { if (e_3) throw e_3.error; } } } } @@ -38158,7 +35240,6 @@ function basicURLParser(input, baseURL, encodingOverride, url, stateOverride) { */ return url; } -exports.basicURLParser = basicURLParser; /** * Sets a URL's username. * @@ -38166,29 +35247,17 @@ exports.basicURLParser = basicURLParser; * @param username - username string */ function setTheUsername(url, username) { - var e_4, _a; /** * 1. Set url’s username to the empty string. * 2. For each code point in username, UTF-8 percent encode it using the * userinfo percent-encode set, and append the result to url’s username. */ - var result = ""; - try { - for (var username_1 = __values(username), username_1_1 = username_1.next(); !username_1_1.done; username_1_1 = username_1.next()) { - var codePoint = username_1_1.value; - result += utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (username_1_1 && !username_1_1.done && (_a = username_1.return)) _a.call(username_1); - } - finally { if (e_4) throw e_4.error; } + let result = ""; + for (const codePoint of username) { + result += utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); } url.username = result; } -exports.setTheUsername = setTheUsername; /** * Sets a URL's password. * @@ -38196,29 +35265,17 @@ exports.setTheUsername = setTheUsername; * @param username - password string */ function setThePassword(url, password) { - var e_5, _a; /** * 1. Set url’s password to the empty string. * 2. For each code point in password, UTF-8 percent encode it using the * userinfo percent-encode set, and append the result to url’s password. */ - var result = ""; - try { - for (var password_1 = __values(password), password_1_1 = password_1.next(); !password_1_1.done; password_1_1 = password_1.next()) { - var codePoint = password_1_1.value; - result += utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); - } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (password_1_1 && !password_1_1.done && (_a = password_1.return)) _a.call(password_1); - } - finally { if (e_5) throw e_5.error; } + let result = ""; + for (const codePoint of password) { + result += utf8PercentEncode(codePoint, _userInfoPercentEncodeSet); } url.password = result; } -exports.setThePassword = setThePassword; /** * Determines if the string represents a single dot path. * @@ -38227,18 +35284,16 @@ exports.setThePassword = setThePassword; function isSingleDotPathSegment(str) { return str === '.' || str.toLowerCase() === "%2e"; } -exports.isSingleDotPathSegment = isSingleDotPathSegment; /** * Determines if the string represents a double dot path. * * @param str - a string */ function isDoubleDotPathSegment(str) { - var lowerStr = str.toLowerCase(); + const lowerStr = str.toLowerCase(); return lowerStr === ".." || lowerStr === ".%2e" || lowerStr === "%2e." || lowerStr === "%2e%2e"; } -exports.isDoubleDotPathSegment = isDoubleDotPathSegment; /** * Shorten's URL's path. * @@ -38252,7 +35307,7 @@ function shorten(url) { * normalized Windows drive letter, then return. * 4. Remove path’s last item. */ - var path = url.path; + const path = url.path; if (path.length === 0) return; if (url.scheme === "file" && path.length === 1 && @@ -38260,7 +35315,6 @@ function shorten(url) { return; url.path.splice(url.path.length - 1, 1); } -exports.shorten = shorten; /** * Determines if a string is a normalized Windows drive letter. * @@ -38274,7 +35328,6 @@ function isNormalizedWindowsDriveLetter(str) { return str.length >= 2 && infra_1.codePoint.ASCIIAlpha.test(str[0]) && str[1] === ':'; } -exports.isNormalizedWindowsDriveLetter = isNormalizedWindowsDriveLetter; /** * Determines if a string is a Windows drive letter. * @@ -38288,7 +35341,6 @@ function isWindowsDriveLetter(str) { return str.length >= 2 && infra_1.codePoint.ASCIIAlpha.test(str[0]) && (str[1] === ':' || str[1] === '|'); } -exports.isWindowsDriveLetter = isWindowsDriveLetter; /** * Determines if a string starts with a Windows drive letter. * @@ -38307,7 +35359,6 @@ function startsWithAWindowsDriveLetter(str) { (str.length === 2 || (str[2] === '/' || str[2] === '\\' || str[2] === '?' || str[2] === '#')); } -exports.startsWithAWindowsDriveLetter = startsWithAWindowsDriveLetter; /** * Parses a host string. * @@ -38315,8 +35366,7 @@ exports.startsWithAWindowsDriveLetter = startsWithAWindowsDriveLetter; * @param isNotSpecial - `true` if the source URL is not special; otherwise * `false`. */ -function hostParser(input, isNotSpecial) { - if (isNotSpecial === void 0) { isNotSpecial = false; } +function hostParser(input, isNotSpecial = false) { /** * 1. If isNotSpecial is not given, then set isNotSpecial to false. * 2. If input starts with U+005B ([), then: @@ -38346,14 +35396,14 @@ function hostParser(input, isNotSpecial) { * coupled with an early return for failure, as domain to ASCII fails * on U+FFFD REPLACEMENT CHARACTER. */ - var domain = util_1.utf8Decode(stringPercentDecode(input)); + const domain = (0, util_1.utf8Decode)(stringPercentDecode(input)); /** * 5. Let asciiDomain be the result of running domain to ASCII on domain. * 6. If asciiDomain is failure, validation error, return failure. * 7. If asciiDomain contains a forbidden host code point, validation error, * return failure. */ - var asciiDomain = domainToASCII(domain); + const asciiDomain = domainToASCII(domain); if (asciiDomain === null) { validationError("Invalid domain."); return null; @@ -38367,12 +35417,11 @@ function hostParser(input, isNotSpecial) { * 9. If ipv4Host is an IPv4 address or failure, return ipv4Host. * 10. Return asciiDomain. */ - var ipv4Host = iPv4Parser(asciiDomain); - if (ipv4Host === null || util_1.isNumber(ipv4Host)) + const ipv4Host = iPv4Parser(asciiDomain); + if (ipv4Host === null || (0, util_1.isNumber)(ipv4Host)) return ipv4Host; return asciiDomain; } -exports.hostParser = hostParser; /** * Parses a string containing an IP v4 address. * @@ -38380,12 +35429,11 @@ exports.hostParser = hostParser; * @param isNotSpecial - `true` if the source URL is not special; otherwise * `false`. */ -function iPv4NumberParser(input, validationErrorFlag) { - if (validationErrorFlag === void 0) { validationErrorFlag = { value: false }; } +function iPv4NumberParser(input, validationErrorFlag = { value: false }) { /** * 1. Let R be 10. */ - var R = 10; + let R = 10; if (input.startsWith("0x") || input.startsWith("0X")) { /** * 2. If input contains at least two code points and the first two code @@ -38417,7 +35465,7 @@ function iPv4NumberParser(input, validationErrorFlag) { */ if (input === "") return 0; - var radixRDigits = (R === 10 ? /^[0-9]+$/ : (R === 16 ? /^[0-9A-Fa-f]+$/ : /^[0-7]+$/)); + const radixRDigits = (R === 10 ? /^[0-9]+$/ : (R === 16 ? /^[0-9A-Fa-f]+$/ : /^[0-7]+$/)); if (!radixRDigits.test(input)) return null; /** @@ -38427,20 +35475,18 @@ function iPv4NumberParser(input, validationErrorFlag) { */ return parseInt(input, R); } -exports.iPv4NumberParser = iPv4NumberParser; /** * Parses a string containing an IP v4 address. * * @param input - input string */ function iPv4Parser(input) { - var e_6, _a, e_7, _b; /** * 1. Let validationErrorFlag be unset. * 2. Let parts be input split on U+002E (.). */ - var validationErrorFlag = { value: false }; - var parts = input.split('.'); + const validationErrorFlag = { value: false }; + const parts = input.split('.'); /** * 3. If the last item in parts is the empty string, then: * 3.1. Set validationErrorFlag. @@ -38465,24 +35511,14 @@ function iPv4Parser(input) { * 6.3. If n is failure, return input. * 6.4. Append n to numbers. */ - var numbers = []; - try { - for (var parts_1 = __values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) { - var part = parts_1_1.value; - if (part === "") - return input; - var n = iPv4NumberParser(part, validationErrorFlag); - if (n === null) - return input; - numbers.push(n); - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1); - } - finally { if (e_6) throw e_6.error; } + const numbers = []; + for (const part of parts) { + if (part === "") + return input; + const n = iPv4NumberParser(part, validationErrorFlag); + if (n === null) + return input; + numbers.push(n); } /** * 7. If validationErrorFlag is set, validation error. @@ -38494,8 +35530,8 @@ function iPv4Parser(input) { */ if (validationErrorFlag.value) validationError("Invalid IP v4 address."); - for (var i = 0; i < numbers.length; i++) { - var item = numbers[i]; + for (let i = 0; i < numbers.length; i++) { + const item = numbers[i]; if (item > 255) { validationError("Invalid IP v4 address."); if (i < numbers.length - 1) @@ -38510,7 +35546,7 @@ function iPv4Parser(input) { * 11. Let ipv4 be the last item in numbers. * 12. Remove the last item from numbers. */ - var ipv4 = numbers[numbers.length - 1]; + let ipv4 = numbers[numbers.length - 1]; numbers.pop(); /** * 13. Let counter be zero. @@ -38518,34 +35554,22 @@ function iPv4Parser(input) { * 14.2. Increment ipv4 by n × 256**(3 − counter). * 14.2. Increment counter by 1. */ - var counter = 0; - try { - for (var numbers_1 = __values(numbers), numbers_1_1 = numbers_1.next(); !numbers_1_1.done; numbers_1_1 = numbers_1.next()) { - var n = numbers_1_1.value; - ipv4 += n * Math.pow(256, 3 - counter); - counter++; - } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (numbers_1_1 && !numbers_1_1.done && (_b = numbers_1.return)) _b.call(numbers_1); - } - finally { if (e_7) throw e_7.error; } + let counter = 0; + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + counter++; } /** * 15. Return ipv4. */ return ipv4; } -exports.iPv4Parser = iPv4Parser; /** * Parses a string containing an IP v6 address. * * @param input - input string */ function iPv6Parser(input) { - var _a; /** * 1. Let address be a new IPv6 address whose IPv6 pieces are all 0. * 2. Let pieceIndex be 0. @@ -38553,11 +35577,11 @@ function iPv6Parser(input) { * 4. Let pointer be a pointer into input, initially 0 (pointing to the * first code point). */ - var EOF = ""; - var address = [0, 0, 0, 0, 0, 0, 0, 0]; - var pieceIndex = 0; - var compress = null; - var walker = new util_1.StringWalker(input); + const EOF = ""; + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + const walker = new util_1.StringWalker(input); /** * 5. If c is U+003A (:), then: * 5.1. If remaining does not start with U+003A (:), validation error, @@ -38607,8 +35631,8 @@ function iPv6Parser(input) { * to value × 0x10 + c interpreted as hexadecimal number, and increase * pointer and length by 1. */ - var value = 0; - var length = 0; + let value = 0; + let length = 0; while (length < 4 && infra_1.codePoint.ASCIIHexDigit.test(walker.c())) { value = value * 0x10 + parseInt(walker.c(), 16); walker.pointer++; @@ -38634,7 +35658,7 @@ function iPv6Parser(input) { validationError("Invalid IP v6 address."); return null; } - var numbersSeen = 0; + let numbersSeen = 0; /** * 6.5.5. While c is not the EOF code point: */ @@ -38642,7 +35666,7 @@ function iPv6Parser(input) { /** * 6.5.5.1. Let ipv4Piece be null. */ - var ipv4Piece = null; + let ipv4Piece = null; /** * 6.5.5.2. If numbersSeen is greater than 0, then: * 6.5.5.2.1. If c is a U+002E (.) and numbersSeen is less than 4, then @@ -38673,7 +35697,7 @@ function iPv6Parser(input) { /** * 6.5.5.4.1. Let number be c interpreted as decimal number. */ - var number = parseInt(walker.c(), 10); + const number = parseInt(walker.c(), 10); /** * 6.5.5.4.2. If ipv4Piece is null, then set ipv4Piece to number. * Otherwise, if ipv4Piece is 0, validation error, return failure. @@ -38761,10 +35785,11 @@ function iPv6Parser(input) { * both pieceIndex and swaps by 1. */ if (compress !== null) { - var swaps = pieceIndex - compress; + let swaps = pieceIndex - compress; pieceIndex = 7; while (pieceIndex !== 0 && swaps > 0) { - _a = __read([address[compress + swaps - 1], address[pieceIndex]], 2), address[pieceIndex] = _a[0], address[compress + swaps - 1] = _a[1]; + [address[pieceIndex], address[compress + swaps - 1]] = + [address[compress + swaps - 1], address[pieceIndex]]; pieceIndex--; swaps--; } @@ -38782,14 +35807,12 @@ function iPv6Parser(input) { */ return address; } -exports.iPv6Parser = iPv6Parser; /** * Parses an opaque host string. * * @param input - a string */ function opaqueHostParser(input) { - var e_8, _a; /** * 1. If input contains a forbidden host code point excluding U+0025 (%), * validation error, return failure. @@ -38798,28 +35821,17 @@ function opaqueHostParser(input) { * control percent-encode set, and append the result to output. * 4. Return output. */ - var forbiddenChars = /[\x00\t\f\r #/:?@\[\\\]]/; + const forbiddenChars = /[\x00\t\f\r #/:?@\[\\\]]/; if (forbiddenChars.test(input)) { validationError("Invalid host string."); return null; } - var output = ""; - try { - for (var input_1 = __values(input), input_1_1 = input_1.next(); !input_1_1.done; input_1_1 = input_1.next()) { - var codePoint = input_1_1.value; - output += utf8PercentEncode(codePoint, _c0ControlPercentEncodeSet); - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (input_1_1 && !input_1_1.done && (_a = input_1.return)) _a.call(input_1); - } - finally { if (e_8) throw e_8.error; } + let output = ""; + for (const codePoint of input) { + output += utf8PercentEncode(codePoint, _c0ControlPercentEncodeSet); } return output; } -exports.opaqueHostParser = opaqueHostParser; /** * Resolves a Blob URL from the user agent's Blob URL store. * function is not implemented. @@ -38830,7 +35842,6 @@ exports.opaqueHostParser = opaqueHostParser; function resolveABlobURL(url) { return null; } -exports.resolveABlobURL = resolveABlobURL; /** * Percent encodes a byte. * @@ -38844,14 +35855,13 @@ function percentEncode(value) { */ return '%' + ('00' + value.toString(16).toUpperCase()).slice(-2); } -exports.percentEncode = percentEncode; /** * Percent decodes a byte sequence input. * * @param input - a byte sequence */ function percentDecode(input) { - var isHexDigit = function (byte) { + const isHexDigit = (byte) => { return (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x46) || (byte >= 0x61 && byte <= 0x66); }; @@ -38859,10 +35869,10 @@ function percentDecode(input) { * 1. Let output be an empty byte sequence. * 2. For each byte byte in input: */ - var output = new Uint8Array(input.length); - var n = 0; - for (var i = 0; i < input.length; i++) { - var byte = input[i]; + const output = new Uint8Array(input.length); + let n = 0; + for (let i = 0; i < input.length; i++) { + const byte = input[i]; /** * 2.1. If byte is not 0x25 (%), then append byte to output. * 2.2. Otherwise, if byte is 0x25 (%) and the next two bytes after byte @@ -38888,7 +35898,7 @@ function percentDecode(input) { n++; } else { - var bytePoint = parseInt(util_1.utf8Decode(Uint8Array.of(input[i + 1], input[i + 2])), 16); + const bytePoint = parseInt((0, util_1.utf8Decode)(Uint8Array.of(input[i + 1], input[i + 2])), 16); output[n] = bytePoint; n++; i += 2; @@ -38896,7 +35906,6 @@ function percentDecode(input) { } return output.subarray(0, n); } -exports.percentDecode = percentDecode; /** * String percent decodes a string. * @@ -38907,9 +35916,8 @@ function stringPercentDecode(input) { * 1. Let bytes be the UTF-8 encoding of input. * 2. Return the percent decoding of bytes. */ - return percentDecode(util_1.utf8Encode(input)); + return percentDecode((0, util_1.utf8Encode)(input)); } -exports.stringPercentDecode = stringPercentDecode; /** * UTF-8 percent encodes a code point, using a percent encode set. * @@ -38917,7 +35925,6 @@ exports.stringPercentDecode = stringPercentDecode; * @param percentEncodeSet - a percent encode set */ function utf8PercentEncode(codePoint, percentEncodeSet) { - var e_9, _a; /** * 1. If codePoint is not in percentEncodeSet, then return codePoint. * 2. Let bytes be the result of running UTF-8 encode on codePoint. @@ -38926,24 +35933,13 @@ function utf8PercentEncode(codePoint, percentEncodeSet) { */ if (!percentEncodeSet.test(codePoint)) return codePoint; - var bytes = util_1.utf8Encode(codePoint); - var result = ""; - try { - for (var bytes_2 = __values(bytes), bytes_2_1 = bytes_2.next(); !bytes_2_1.done; bytes_2_1 = bytes_2.next()) { - var byte = bytes_2_1.value; - result += percentEncode(byte); - } - } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { - try { - if (bytes_2_1 && !bytes_2_1.done && (_a = bytes_2.return)) _a.call(bytes_2); - } - finally { if (e_9) throw e_9.error; } + const bytes = (0, util_1.utf8Encode)(codePoint); + let result = ""; + for (const byte of bytes) { + result += percentEncode(byte); } return result; } -exports.utf8PercentEncode = utf8PercentEncode; /** * Determines if two hosts are considered equal. * @@ -38953,7 +35949,6 @@ exports.utf8PercentEncode = utf8PercentEncode; function hostEquals(hostA, hostB) { return hostA === hostB; } -exports.hostEquals = hostEquals; /** * Determines if two URLs are considered equal. * @@ -38961,8 +35956,7 @@ exports.hostEquals = hostEquals; * @param urlB - a URL * @param excludeFragmentsFlag - whether to ignore fragments while comparing */ -function urlEquals(urlA, urlB, excludeFragmentsFlag) { - if (excludeFragmentsFlag === void 0) { excludeFragmentsFlag = false; } +function urlEquals(urlA, urlB, excludeFragmentsFlag = false) { /** * 1. Let serializedA be the result of serializing A, with the exclude * fragment flag set if the exclude fragments flag is set. @@ -38973,7 +35967,6 @@ function urlEquals(urlA, urlB, excludeFragmentsFlag) { return urlSerializer(urlA, excludeFragmentsFlag) === urlSerializer(urlB, excludeFragmentsFlag); } -exports.urlEquals = urlEquals; /** * Parses an `application/x-www-form-urlencoded` string. * @@ -38985,39 +35978,27 @@ function urlEncodedStringParser(input) { * UTF-8 encodes it, and then returns the result of * application/x-www-form-urlencoded parsing it. */ - return urlEncodedParser(util_1.utf8Encode(input)); + return urlEncodedParser((0, util_1.utf8Encode)(input)); } -exports.urlEncodedStringParser = urlEncodedStringParser; /** * Parses `application/x-www-form-urlencoded` bytes. * * @param input - a byte sequence */ function urlEncodedParser(input) { - var e_10, _a, e_11, _b; /** * 1. Let sequences be the result of splitting input on 0x26 (&). */ - var sequences = []; - var currentSequence = []; - try { - for (var input_2 = __values(input), input_2_1 = input_2.next(); !input_2_1.done; input_2_1 = input_2.next()) { - var byte = input_2_1.value; - if (byte === 0x26) { - sequences.push(Uint8Array.from(currentSequence)); - currentSequence = []; - } - else { - currentSequence.push(byte); - } + const sequences = []; + let currentSequence = []; + for (const byte of input) { + if (byte === 0x26) { + sequences.push(Uint8Array.from(currentSequence)); + currentSequence = []; } - } - catch (e_10_1) { e_10 = { error: e_10_1 }; } - finally { - try { - if (input_2_1 && !input_2_1.done && (_a = input_2.return)) _a.call(input_2); + else { + currentSequence.push(byte); } - finally { if (e_10) throw e_10.error; } } if (currentSequence.length !== 0) { sequences.push(Uint8Array.from(currentSequence)); @@ -39025,72 +36006,60 @@ function urlEncodedParser(input) { /** * 2. Let output be an initially empty list of name-value tuples where both name and value hold a string. */ - var output = []; - try { + const output = []; + /** + * 3. For each byte sequence bytes in sequences: + */ + for (const bytes of sequences) { /** - * 3. For each byte sequence bytes in sequences: + * 3.1. If bytes is the empty byte sequence, then continue. */ - for (var sequences_1 = __values(sequences), sequences_1_1 = sequences_1.next(); !sequences_1_1.done; sequences_1_1 = sequences_1.next()) { - var bytes = sequences_1_1.value; - /** - * 3.1. If bytes is the empty byte sequence, then continue. - */ - if (bytes.length === 0) - continue; - /** - * 3.2. If bytes contains a 0x3D (=), then let name be the bytes from the - * start of bytes up to but excluding its first 0x3D (=), and let value be - * the bytes, if any, after the first 0x3D (=) up to the end of bytes. - * If 0x3D (=) is the first byte, then name will be the empty byte - * sequence. If it is the last, then value will be the empty byte sequence. - * 3.3. Otherwise, let name have the value of bytes and let value be the - * empty byte sequence. - */ - var index = bytes.indexOf(0x3D); - var name = (index !== -1 ? bytes.slice(0, index) : bytes); - var value = (index !== -1 ? bytes.slice(index + 1) : new Uint8Array()); - /** - * 3.4. Replace any 0x2B (+) in name and value with 0x20 (SP). - */ - for (var i = 0; i < name.length; i++) - if (name[i] === 0x2B) - name[i] = 0x20; - for (var i = 0; i < value.length; i++) - if (value[i] === 0x2B) - value[i] = 0x20; - /** - * 3.5. Let nameString and valueString be the result of running UTF-8 - * decode without BOM on the percent decoding of name and value, - * respectively. - */ - var nameString = util_1.utf8Decode(name); - var valueString = util_1.utf8Decode(value); - /** - * 3.6. Append (nameString, valueString) to output. - */ - output.push([nameString, valueString]); - } - } - catch (e_11_1) { e_11 = { error: e_11_1 }; } - finally { - try { - if (sequences_1_1 && !sequences_1_1.done && (_b = sequences_1.return)) _b.call(sequences_1); - } - finally { if (e_11) throw e_11.error; } + if (bytes.length === 0) + continue; + /** + * 3.2. If bytes contains a 0x3D (=), then let name be the bytes from the + * start of bytes up to but excluding its first 0x3D (=), and let value be + * the bytes, if any, after the first 0x3D (=) up to the end of bytes. + * If 0x3D (=) is the first byte, then name will be the empty byte + * sequence. If it is the last, then value will be the empty byte sequence. + * 3.3. Otherwise, let name have the value of bytes and let value be the + * empty byte sequence. + */ + const index = bytes.indexOf(0x3D); + const name = (index !== -1 ? bytes.slice(0, index) : bytes); + const value = (index !== -1 ? bytes.slice(index + 1) : new Uint8Array()); + /** + * 3.4. Replace any 0x2B (+) in name and value with 0x20 (SP). + */ + for (let i = 0; i < name.length; i++) + if (name[i] === 0x2B) + name[i] = 0x20; + for (let i = 0; i < value.length; i++) + if (value[i] === 0x2B) + value[i] = 0x20; + /** + * 3.5. Let nameString and valueString be the result of running UTF-8 + * decode without BOM on the percent decoding of name and value, + * respectively. + */ + const nameString = (0, util_1.utf8Decode)(name); + const valueString = (0, util_1.utf8Decode)(value); + /** + * 3.6. Append (nameString, valueString) to output. + */ + output.push([nameString, valueString]); } /** * 4. Return output. */ return output; } -exports.urlEncodedParser = urlEncodedParser; /** * Serializes `application/x-www-form-urlencoded` bytes. * * @param input - a byte sequence */ function urlEncodedByteSerializer(input) { - var e_12, _a; /** * 1. Let output be the empty string. * 2. For each byte in input, depending on byte: @@ -39110,33 +36079,22 @@ function urlEncodedByteSerializer(input) { * Append byte, percent encoded, to output. * 3. Return output. */ - var output = ""; - try { - for (var input_3 = __values(input), input_3_1 = input_3.next(); !input_3_1.done; input_3_1 = input_3.next()) { - var byte = input_3_1.value; - if (byte === 0x20) { - output += '+'; - } - else if (byte === 0x2A || byte === 0x2D || byte === 0x2E || - (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x5A) || - byte === 0x5F || (byte >= 0x61 && byte <= 0x7A)) { - output += String.fromCodePoint(byte); - } - else { - output += percentEncode(byte); - } + let output = ""; + for (const byte of input) { + if (byte === 0x20) { + output += '+'; } - } - catch (e_12_1) { e_12 = { error: e_12_1 }; } - finally { - try { - if (input_3_1 && !input_3_1.done && (_a = input_3.return)) _a.call(input_3); + else if (byte === 0x2A || byte === 0x2D || byte === 0x2E || + (byte >= 0x30 && byte <= 0x39) || (byte >= 0x41 && byte <= 0x5A) || + byte === 0x5F || (byte >= 0x61 && byte <= 0x7A)) { + output += String.fromCodePoint(byte); + } + else { + output += percentEncode(byte); } - finally { if (e_12) throw e_12.error; } } return output; } -exports.urlEncodedByteSerializer = urlEncodedByteSerializer; /** * Serializes `application/x-www-form-urlencoded` tuples. * @@ -39144,13 +36102,12 @@ exports.urlEncodedByteSerializer = urlEncodedByteSerializer; * @param encodingOverride: encoding override */ function urlEncodedSerializer(tuples, encodingOverride) { - var e_13, _a; /** * 1. Let encoding be UTF-8. * 2. If encoding override is given, set encoding to the result of getting * an output encoding from encoding override. */ - var encoding = (encodingOverride === undefined || + const encoding = (encodingOverride === undefined || encodingOverride === "replacement" || encodingOverride === "UTF-16BE" || encodingOverride === "UTF-16LE" ? "UTF-8" : encodingOverride); if (encoding.toUpperCase() !== "UTF-8") { @@ -39159,56 +36116,45 @@ function urlEncodedSerializer(tuples, encodingOverride) { /** * 3. Let output be the empty string. */ - var output = ""; - try { + let output = ""; + /** + * 4. For each tuple in tuples: + */ + for (const tuple of tuples) { /** - * 4. For each tuple in tuples: + * 4.1. Let name be the result of serializing the result of encoding + * tuple’s name, using encoding. */ - for (var tuples_1 = __values(tuples), tuples_1_1 = tuples_1.next(); !tuples_1_1.done; tuples_1_1 = tuples_1.next()) { - var tuple = tuples_1_1.value; - /** - * 4.1. Let name be the result of serializing the result of encoding - * tuple’s name, using encoding. - */ - var name = urlEncodedByteSerializer(util_1.utf8Encode(tuple[0])); - /** - * 4.2. Let value be tuple’s value. - */ - var value = tuple[1]; - /** - * TODO: - * 4.3. If value is a file, then set value to value’s filename. - */ - /** - * 4.4. Set value to the result of serializing the result of encoding - * value, using encoding. - */ - value = urlEncodedByteSerializer(util_1.utf8Encode(value)); - /** - * 4.5. If tuple is not the first pair in tuples, then append U+0026 (&) - * to output. - */ - if (output !== "") - output += '&'; - /** - * 4.6. Append name, followed by U+003D (=), followed by value, to output. - */ - output += name + '=' + value; - } - } - catch (e_13_1) { e_13 = { error: e_13_1 }; } - finally { - try { - if (tuples_1_1 && !tuples_1_1.done && (_a = tuples_1.return)) _a.call(tuples_1); - } - finally { if (e_13) throw e_13.error; } + const name = urlEncodedByteSerializer((0, util_1.utf8Encode)(tuple[0])); + /** + * 4.2. Let value be tuple’s value. + */ + let value = tuple[1]; + /** + * TODO: + * 4.3. If value is a file, then set value to value’s filename. + */ + /** + * 4.4. Set value to the result of serializing the result of encoding + * value, using encoding. + */ + value = urlEncodedByteSerializer((0, util_1.utf8Encode)(value)); + /** + * 4.5. If tuple is not the first pair in tuples, then append U+0026 (&) + * to output. + */ + if (output !== "") + output += '&'; + /** + * 4.6. Append name, followed by U+003D (=), followed by value, to output. + */ + output += name + '=' + value; } /** * 5. Return output. */ return output; } -exports.urlEncodedSerializer = urlEncodedSerializer; /** * Returns a URL's origin. * @@ -39242,7 +36188,7 @@ function origin(url) { if (url._blobURLEntry !== null) { // TODO: return URL’s blob URL entry’s environment’s origin. } - var parsedURL = basicURLParser(url.path[0]); + const parsedURL = basicURLParser(url.path[0]); if (parsedURL === null) return interfaces_1.OpaqueOrigin; else @@ -39259,14 +36205,12 @@ function origin(url) { return interfaces_1.OpaqueOrigin; } } -exports.origin = origin; /** * Converts a domain string to ASCII. * * @param domain - a domain string */ -function domainToASCII(domain, beStrict) { - if (beStrict === void 0) { beStrict = false; } +function domainToASCII(domain, beStrict = false) { /** * 1. If beStrict is not given, set it to false. * 2. Let result be the result of running Unicode ToASCII with domain_name @@ -39277,21 +36221,19 @@ function domainToASCII(domain, beStrict) { * 4. Return result. */ // Use node.js function - var result = url_1.domainToASCII(domain); + const result = (0, url_1.domainToASCII)(domain); if (result === "") { validationError("Invalid domain name."); return null; } return result; } -exports.domainToASCII = domainToASCII; /** * Converts a domain string to Unicode. * * @param domain - a domain string */ -function domainToUnicode(domain, beStrict) { - if (beStrict === void 0) { beStrict = false; } +function domainToUnicode(domain, beStrict = false) { /** * 1. Let result be the result of running Unicode ToUnicode with domain_name * set to domain, CheckHyphens set to false, CheckBidi set to true, @@ -39301,13 +36243,12 @@ function domainToUnicode(domain, beStrict) { * return result. */ // Use node.js function - var result = url_1.domainToUnicode(domain); + const result = (0, url_1.domainToUnicode)(domain); if (result === "") { validationError("Invalid domain name."); } return result; } -exports.domainToUnicode = domainToUnicode; /** * Serializes an origin. * function is from the HTML spec: @@ -39328,12 +36269,11 @@ function asciiSerializationOfAnOrigin(origin) { if (origin[0] === "" && origin[1] === "" && origin[2] === null && origin[3] === null) { return "null"; } - var result = origin[0] + "://" + hostSerializer(origin[1]); + let result = origin[0] + "://" + hostSerializer(origin[1]); if (origin[2] !== null) result += ":" + origin[2].toString(); return result; } -exports.asciiSerializationOfAnOrigin = asciiSerializationOfAnOrigin; //# sourceMappingURL=URLAlgorithm.js.map /***/ }), @@ -39344,6 +36284,7 @@ exports.asciiSerializationOfAnOrigin = asciiSerializationOfAnOrigin; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OpaqueOrigin = exports.ParserState = void 0; /** * Represents the state of the URL parser. */ @@ -39370,7 +36311,7 @@ var ParserState; ParserState[ParserState["CannotBeABaseURLPath"] = 18] = "CannotBeABaseURLPath"; ParserState[ParserState["Query"] = 19] = "Query"; ParserState[ParserState["Fragment"] = 20] = "Fragment"; -})(ParserState = exports.ParserState || (exports.ParserState = {})); +})(ParserState || (exports.ParserState = ParserState = {})); exports.OpaqueOrigin = ["", "", null, null]; //# sourceMappingURL=interfaces.js.map @@ -39382,6 +36323,7 @@ exports.OpaqueOrigin = ["", "", null, null]; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CompareCache = void 0; /** * Represents a cache for storing order between equal objects. * @@ -39395,16 +36337,16 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); * * The cache has a size limit which is defined on initialization. */ -var CompareCache = /** @class */ (function () { +class CompareCache { + _limit; + _items = new Map(); /** * Initializes a new instance of `CompareCache`. * * @param limit - maximum number of items to keep in the cache. When the limit * is exceeded the first item is removed from the cache. */ - function CompareCache(limit) { - if (limit === void 0) { limit = 1000; } - this._items = new Map(); + constructor(limit = 1000) { this._limit = limit; } /** @@ -39414,12 +36356,12 @@ var CompareCache = /** @class */ (function () { * @param objA - an item to compare * @param objB - an item to compare */ - CompareCache.prototype.check = function (objA, objB) { + check(objA, objB) { if (this._items.get(objA) === objB) return true; else if (this._items.get(objB) === objA) return false; - var result = (Math.random() < 0.5); + const result = (Math.random() < 0.5); if (result) { this._items.set(objA, objB); } @@ -39427,78 +36369,40 @@ var CompareCache = /** @class */ (function () { this._items.set(objB, objA); } if (this._items.size > this._limit) { - var it_1 = this._items.keys().next(); + const it = this._items.keys().next(); /* istanbul ignore else */ - if (!it_1.done) { - this._items.delete(it_1.value); + if (!it.done) { + this._items.delete(it.value); } } return result; - }; - return CompareCache; -}()); + } +} exports.CompareCache = CompareCache; //# sourceMappingURL=CompareCache.js.map /***/ }), /***/ 16006: -/***/ (function(__unused_webpack_module, exports) { +/***/ ((__unused_webpack_module, exports) => { "use strict"; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.FixedSizeSet = void 0; /** * Represents a set of objects with a size limit. */ -var FixedSizeSet = /** @class */ (function () { +class FixedSizeSet { + _limit; + _items = new Set(); /** * Initializes a new instance of `FixedSizeSet`. * * @param limit - maximum number of items to keep in the set. When the limit * is exceeded the first item is removed from the set. */ - function FixedSizeSet(limit) { - if (limit === void 0) { limit = 1000; } - this._items = new Set(); + constructor(limit = 1000) { this._limit = limit; } /** @@ -39506,118 +36410,80 @@ var FixedSizeSet = /** @class */ (function () { * * @param item - an item */ - FixedSizeSet.prototype.add = function (item) { + add(item) { this._items.add(item); if (this._items.size > this._limit) { - var it_1 = this._items.values().next(); + const it = this._items.values().next(); /* istanbul ignore else */ - if (!it_1.done) { - this._items.delete(it_1.value); + if (!it.done) { + this._items.delete(it.value); } } return this; - }; + } /** * Removes an item from the set. * * @param item - an item */ - FixedSizeSet.prototype.delete = function (item) { + delete(item) { return this._items.delete(item); - }; + } /** * Determines if an item is in the set. * * @param item - an item */ - FixedSizeSet.prototype.has = function (item) { + has(item) { return this._items.has(item); - }; + } /** * Removes all items from the set. */ - FixedSizeSet.prototype.clear = function () { + clear() { this._items.clear(); - }; - Object.defineProperty(FixedSizeSet.prototype, "size", { - /** - * Gets the number of items in the set. - */ - get: function () { return this._items.size; }, - enumerable: true, - configurable: true - }); + } + /** + * Gets the number of items in the set. + */ + get size() { return this._items.size; } /** * Applies the given callback function to all elements of the set. */ - FixedSizeSet.prototype.forEach = function (callback, thisArg) { - var _this = this; - this._items.forEach(function (e) { return callback.call(thisArg, e, e, _this); }); - }; + forEach(callback, thisArg) { + this._items.forEach(e => callback.call(thisArg, e, e, this)); + } /** * Iterates through the items in the set. */ - FixedSizeSet.prototype.keys = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items.keys())]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; + *keys() { + yield* this._items.keys(); + } /** * Iterates through the items in the set. */ - FixedSizeSet.prototype.values = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items.values())]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; + *values() { + yield* this._items.values(); + } /** * Iterates through the items in the set. */ - FixedSizeSet.prototype.entries = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items.entries())]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; + *entries() { + yield* this._items.entries(); + } /** * Iterates through the items in the set. */ - FixedSizeSet.prototype[Symbol.iterator] = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items)]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; - Object.defineProperty(FixedSizeSet.prototype, Symbol.toStringTag, { - /** - * Returns the string tag of the set. - */ - get: function () { - return "FixedSizeSet"; - }, - enumerable: true, - configurable: true - }); - return FixedSizeSet; -}()); + *[Symbol.iterator]() { + yield* this._items; + } + /** + * Returns the string tag of the set. + */ + get [Symbol.toStringTag]() { + return "FixedSizeSet"; + } +} exports.FixedSizeSet = FixedSizeSet; //# sourceMappingURL=FixedSizeSet.js.map @@ -39629,98 +36495,59 @@ exports.FixedSizeSet = FixedSizeSet; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Lazy = void 0; /** * Represents an object with lazy initialization. */ -var Lazy = /** @class */ (function () { +class Lazy { + _initialized = false; + _initFunc; + _value; /** * Initializes a new instance of `Lazy`. * * @param initFunc - initializer function */ - function Lazy(initFunc) { - this._initialized = false; + constructor(initFunc) { this._value = undefined; this._initFunc = initFunc; } - Object.defineProperty(Lazy.prototype, "value", { - /** - * Gets the value of the object. - */ - get: function () { - if (!this._initialized) { - this._value = this._initFunc(); - this._initialized = true; - } - return this._value; - }, - enumerable: true, - configurable: true - }); - return Lazy; -}()); + /** + * Gets the value of the object. + */ + get value() { + if (!this._initialized) { + this._value = this._initFunc(); + this._initialized = true; + } + return this._value; + } +} exports.Lazy = Lazy; //# sourceMappingURL=Lazy.js.map /***/ }), /***/ 25798: -/***/ (function(__unused_webpack_module, exports) { +/***/ ((__unused_webpack_module, exports) => { "use strict"; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ObjectCache = void 0; /** * Represents a cache of objects with a size limit. */ -var ObjectCache = /** @class */ (function () { +class ObjectCache { + _limit; + _items = new Map(); /** * Initializes a new instance of `ObjectCache`. * * @param limit - maximum number of items to keep in the cache. When the limit * is exceeded the first item is removed from the cache. */ - function ObjectCache(limit) { - if (limit === void 0) { limit = 1000; } - this._items = new Map(); + constructor(limit = 1000) { this._limit = limit; } /** @@ -39728,125 +36555,88 @@ var ObjectCache = /** @class */ (function () { * * @param key - object key */ - ObjectCache.prototype.get = function (key) { + get(key) { return this._items.get(key); - }; + } /** * Adds a new item to the cache. * * @param key - object key * @param value - object value */ - ObjectCache.prototype.set = function (key, value) { + set(key, value) { this._items.set(key, value); if (this._items.size > this._limit) { - var it_1 = this._items.keys().next(); + const it = this._items.keys().next(); /* istanbul ignore else */ - if (!it_1.done) { - this._items.delete(it_1.value); + if (!it.done) { + this._items.delete(it.value); } } - }; + } /** * Removes an item from the cache. * * @param item - an item */ - ObjectCache.prototype.delete = function (key) { + delete(key) { return this._items.delete(key); - }; + } /** * Determines if an item is in the cache. * * @param item - an item */ - ObjectCache.prototype.has = function (key) { + has(key) { return this._items.has(key); - }; + } /** * Removes all items from the cache. */ - ObjectCache.prototype.clear = function () { + clear() { this._items.clear(); - }; - Object.defineProperty(ObjectCache.prototype, "size", { - /** - * Gets the number of items in the cache. - */ - get: function () { return this._items.size; }, - enumerable: true, - configurable: true - }); + } + /** + * Gets the number of items in the cache. + */ + get size() { return this._items.size; } /** * Applies the given callback function to all elements of the cache. */ - ObjectCache.prototype.forEach = function (callback, thisArg) { - this._items.forEach(function (v, k) { return callback.call(thisArg, k, v); }); - }; + forEach(callback, thisArg) { + this._items.forEach((v, k) => callback.call(thisArg, k, v)); + } /** * Iterates through the items in the set. */ - ObjectCache.prototype.keys = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items.keys())]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; + *keys() { + yield* this._items.keys(); + } /** * Iterates through the items in the set. */ - ObjectCache.prototype.values = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items.values())]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; + *values() { + yield* this._items.values(); + } /** * Iterates through the items in the set. */ - ObjectCache.prototype.entries = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items.entries())]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; + *entries() { + yield* this._items.entries(); + } /** * Iterates through the items in the set. */ - ObjectCache.prototype[Symbol.iterator] = function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [5 /*yield**/, __values(this._items)]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }; - Object.defineProperty(ObjectCache.prototype, Symbol.toStringTag, { - /** - * Returns the string tag of the cache. - */ - get: function () { - return "ObjectCache"; - }, - enumerable: true, - configurable: true - }); - return ObjectCache; -}()); + *[Symbol.iterator]() { + yield* this._items; + } + /** + * Returns the string tag of the cache. + */ + get [Symbol.toStringTag]() { + return "ObjectCache"; + } +} exports.ObjectCache = ObjectCache; //# sourceMappingURL=ObjectCache.js.map @@ -39858,47 +36648,46 @@ exports.ObjectCache = ObjectCache; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StringWalker = void 0; /** * Walks through the code points of a string. */ -var StringWalker = /** @class */ (function () { +class StringWalker { + _chars; + _length; + _pointer = 0; + _codePoint; + _c; + _remaining; + _substring; /** * Initializes a new `StringWalker`. * * @param input - input string */ - function StringWalker(input) { - this._pointer = 0; + constructor(input) { this._chars = Array.from(input); this._length = this._chars.length; } - Object.defineProperty(StringWalker.prototype, "eof", { - /** - * Determines if the current position is beyond the end of string. - */ - get: function () { return this._pointer >= this._length; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(StringWalker.prototype, "length", { - /** - * Returns the number of code points in the input string. - */ - get: function () { return this._length; }, - enumerable: true, - configurable: true - }); + /** + * Determines if the current position is beyond the end of string. + */ + get eof() { return this._pointer >= this._length; } + /** + * Returns the number of code points in the input string. + */ + get length() { return this._length; } /** * Returns the current code point. Returns `-1` if the position is beyond * the end of string. */ - StringWalker.prototype.codePoint = function () { + codePoint() { if (this._codePoint === undefined) { if (this.eof) { this._codePoint = -1; } else { - var cp = this._chars[this._pointer].codePointAt(0); + const cp = this._chars[this._pointer].codePointAt(0); /* istanbul ignore else */ if (cp !== undefined) { this._codePoint = cp; @@ -39909,88 +36698,96 @@ var StringWalker = /** @class */ (function () { } } return this._codePoint; - }; + } /** * Returns the current character. Returns an empty string if the position is * beyond the end of string. */ - StringWalker.prototype.c = function () { + c() { if (this._c === undefined) { this._c = (this.eof ? "" : this._chars[this._pointer]); } return this._c; - }; + } /** * Returns the remaining string. */ - StringWalker.prototype.remaining = function () { + remaining() { if (this._remaining === undefined) { this._remaining = (this.eof ? "" : this._chars.slice(this._pointer + 1).join('')); } return this._remaining; - }; + } /** * Returns the substring from the current character to the end of string. */ - StringWalker.prototype.substring = function () { + substring() { if (this._substring === undefined) { this._substring = (this.eof ? "" : this._chars.slice(this._pointer).join('')); } return this._substring; - }; - Object.defineProperty(StringWalker.prototype, "pointer", { - /** - * Gets or sets the current position. - */ - get: function () { return this._pointer; }, - set: function (val) { - if (val === this._pointer) - return; - this._pointer = val; - this._codePoint = undefined; - this._c = undefined; - this._remaining = undefined; - this._substring = undefined; - }, - enumerable: true, - configurable: true - }); - return StringWalker; -}()); + } + /** + * Gets or sets the current position. + */ + get pointer() { return this._pointer; } + set pointer(val) { + if (val === this._pointer) + return; + this._pointer = val; + this._codePoint = undefined; + this._c = undefined; + this._remaining = undefined; + this._substring = undefined; + } +} exports.StringWalker = StringWalker; //# sourceMappingURL=StringWalker.js.map /***/ }), /***/ 76195: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; Object.defineProperty(exports, "__esModule", ({ value: true })); -var FixedSizeSet_1 = __nccwpck_require__(16006); -exports.FixedSizeSet = FixedSizeSet_1.FixedSizeSet; -var ObjectCache_1 = __nccwpck_require__(25798); -exports.ObjectCache = ObjectCache_1.ObjectCache; -var CompareCache_1 = __nccwpck_require__(27561); -exports.CompareCache = CompareCache_1.CompareCache; -var Lazy_1 = __nccwpck_require__(11857); -exports.Lazy = Lazy_1.Lazy; -var StringWalker_1 = __nccwpck_require__(34145); -exports.StringWalker = StringWalker_1.StringWalker; +exports.StringWalker = exports.Lazy = exports.CompareCache = exports.ObjectCache = exports.FixedSizeSet = void 0; +exports.applyMixin = applyMixin; +exports.applyDefaults = applyDefaults; +exports.forEachArray = forEachArray; +exports.forEachObject = forEachObject; +exports.arrayLength = arrayLength; +exports.objectLength = objectLength; +exports.getObjectValue = getObjectValue; +exports.removeObjectValue = removeObjectValue; +exports.clone = clone; +exports.isBoolean = isBoolean; +exports.isNumber = isNumber; +exports.isString = isString; +exports.isFunction = isFunction; +exports.isObject = isObject; +exports.isArray = isArray; +exports.isSet = isSet; +exports.isMap = isMap; +exports.isEmpty = isEmpty; +exports.isPlainObject = isPlainObject; +exports.isIterable = isIterable; +exports.getValue = getValue; +exports.utf8Encode = utf8Encode; +exports.utf8Decode = utf8Decode; +var FixedSizeSet_js_1 = __nccwpck_require__(16006); +Object.defineProperty(exports, "FixedSizeSet", ({ enumerable: true, get: function () { return FixedSizeSet_js_1.FixedSizeSet; } })); +var ObjectCache_js_1 = __nccwpck_require__(25798); +Object.defineProperty(exports, "ObjectCache", ({ enumerable: true, get: function () { return ObjectCache_js_1.ObjectCache; } })); +var CompareCache_js_1 = __nccwpck_require__(27561); +Object.defineProperty(exports, "CompareCache", ({ enumerable: true, get: function () { return CompareCache_js_1.CompareCache; } })); +var Lazy_js_1 = __nccwpck_require__(11857); +Object.defineProperty(exports, "Lazy", ({ enumerable: true, get: function () { return Lazy_js_1.Lazy; } })); +var StringWalker_js_1 = __nccwpck_require__(34145); +Object.defineProperty(exports, "StringWalker", ({ enumerable: true, get: function () { return StringWalker_js_1.StringWalker; } })); /** * Applies the mixin to a given class. * @@ -40000,21 +36797,17 @@ exports.StringWalker = StringWalker_1.StringWalker; * functions whose names are in this array will be kept by prepending an * underscore to their names. */ -function applyMixin(baseClass, mixinClass) { - var overrides = []; - for (var _i = 2; _i < arguments.length; _i++) { - overrides[_i - 2] = arguments[_i]; - } - Object.getOwnPropertyNames(mixinClass.prototype).forEach(function (name) { +function applyMixin(baseClass, mixinClass, ...overrides) { + Object.getOwnPropertyNames(mixinClass.prototype).forEach(name => { if (name !== "constructor") { if (overrides.indexOf(name) !== -1) { - var orgPropDesc = Object.getOwnPropertyDescriptor(baseClass.prototype, name); + const orgPropDesc = Object.getOwnPropertyDescriptor(baseClass.prototype, name); /* istanbul ignore else */ if (orgPropDesc) { Object.defineProperty(baseClass.prototype, "_" + name, orgPropDesc); } } - var propDesc = Object.getOwnPropertyDescriptor(mixinClass.prototype, name); + const propDesc = Object.getOwnPropertyDescriptor(mixinClass.prototype, name); /* istanbul ignore else */ if (propDesc) { Object.defineProperty(baseClass.prototype, name, propDesc); @@ -40022,7 +36815,6 @@ function applyMixin(baseClass, mixinClass) { } }); } -exports.applyMixin = applyMixin; /** * Applies default values to the given object. * @@ -40031,10 +36823,9 @@ exports.applyMixin = applyMixin; * @param overwrite - if set to `true` defaults object always overwrites object * values, whether they are `undefined` or not. */ -function applyDefaults(obj, defaults, overwrite) { - if (overwrite === void 0) { overwrite = false; } - var result = clone(obj || {}); - forEachObject(defaults, function (key, val) { +function applyDefaults(obj, defaults, overwrite = false) { + const result = clone(obj || {}); + forEachObject(defaults, (key, val) => { if (isPlainObject(val)) { result[key] = applyDefaults(result[key], val, overwrite); } @@ -40044,7 +36835,6 @@ function applyDefaults(obj, defaults, overwrite) { }); return result; } -exports.applyDefaults = applyDefaults; /** * Iterates over items of an array or set. * @@ -40056,7 +36846,6 @@ exports.applyDefaults = applyDefaults; function forEachArray(arr, callback, thisArg) { arr.forEach(callback, thisArg); } -exports.forEachArray = forEachArray; /** * Iterates over key/value pairs of a map or object. * @@ -40067,10 +36856,10 @@ exports.forEachArray = forEachArray; */ function forEachObject(obj, callback, thisArg) { if (isMap(obj)) { - obj.forEach(function (value, key) { return callback.call(thisArg, key, value); }); + obj.forEach((value, key) => callback.call(thisArg, key, value)); } else { - for (var key in obj) { + for (const key in obj) { /* istanbul ignore else */ if (obj.hasOwnProperty(key)) { callback.call(thisArg, key, obj[key]); @@ -40078,7 +36867,6 @@ function forEachObject(obj, callback, thisArg) { } } } -exports.forEachObject = forEachObject; /** * Returns the number of entries in an array or set. * @@ -40092,7 +36880,6 @@ function arrayLength(obj) { return obj.length; } } -exports.arrayLength = arrayLength; /** * Returns the number of entries in a map or object. * @@ -40106,7 +36893,6 @@ function objectLength(obj) { return Object.keys(obj).length; } } -exports.objectLength = objectLength; /** * Gets the value of a key from a map or object. * @@ -40121,7 +36907,6 @@ function getObjectValue(obj, key) { return obj[key]; } } -exports.getObjectValue = getObjectValue; /** * Removes a property from a map or object. * @@ -40136,40 +36921,28 @@ function removeObjectValue(obj, key) { delete obj[key]; } } -exports.removeObjectValue = removeObjectValue; /** * Deep clones the given object. * * @param obj - an object */ function clone(obj) { - var e_1, _a; if (isFunction(obj)) { return obj; } else if (isArray(obj)) { - var result = []; - try { - for (var obj_1 = __values(obj), obj_1_1 = obj_1.next(); !obj_1_1.done; obj_1_1 = obj_1.next()) { - var item = obj_1_1.value; - result.push(clone(item)); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (obj_1_1 && !obj_1_1.done && (_a = obj_1.return)) _a.call(obj_1); - } - finally { if (e_1) throw e_1.error; } + const result = []; + for (const item of obj) { + result.push(clone(item)); } return result; } - else if (isObject(obj)) { - var result = {}; - for (var key in obj) { + else if (isPlainObject(obj)) { + const result = {}; + for (const key in obj) { /* istanbul ignore next */ if (obj.hasOwnProperty(key)) { - var val = obj[key]; + const val = obj[key]; result[key] = clone(val); } } @@ -40179,7 +36952,6 @@ function clone(obj) { return obj; } } -exports.clone = clone; /** * Type guard for boolean types * @@ -40188,7 +36960,6 @@ exports.clone = clone; function isBoolean(x) { return typeof x === "boolean"; } -exports.isBoolean = isBoolean; /** * Type guard for numeric types * @@ -40197,7 +36968,6 @@ exports.isBoolean = isBoolean; function isNumber(x) { return typeof x === "number"; } -exports.isNumber = isNumber; /** * Type guard for strings * @@ -40206,16 +36976,14 @@ exports.isNumber = isNumber; function isString(x) { return typeof x === "string"; } -exports.isString = isString; /** * Type guard for function objects * * @param x - a variable to type check */ function isFunction(x) { - return !!x && Object.prototype.toString.call(x) === '[object Function]'; + return !!x && typeof x === 'function'; } -exports.isFunction = isFunction; /** * Type guard for JS objects * @@ -40224,10 +36992,9 @@ exports.isFunction = isFunction; * @param x - a variable to type check */ function isObject(x) { - var type = typeof x; + const type = typeof x; return !!x && (type === 'function' || type === 'object'); } -exports.isObject = isObject; /** * Type guard for arrays * @@ -40236,7 +37003,6 @@ exports.isObject = isObject; function isArray(x) { return Array.isArray(x); } -exports.isArray = isArray; /** * Type guard for sets. * @@ -40245,7 +37011,6 @@ exports.isArray = isArray; function isSet(x) { return x instanceof Set; } -exports.isSet = isSet; /** * Type guard for maps. * @@ -40254,7 +37019,6 @@ exports.isSet = isSet; function isMap(x) { return x instanceof Map; } -exports.isMap = isMap; /** * Determines if `x` is an empty Array or an Object with no own properties. * @@ -40271,7 +37035,7 @@ function isEmpty(x) { return !x.size; } else if (isObject(x)) { - for (var key in x) { + for (const key in x) { if (x.hasOwnProperty(key)) { return false; } @@ -40280,7 +37044,6 @@ function isEmpty(x) { } return false; } -exports.isEmpty = isEmpty; /** * Determines if `x` is a plain Object. * @@ -40288,15 +37051,14 @@ exports.isEmpty = isEmpty; */ function isPlainObject(x) { if (isObject(x)) { - var proto = Object.getPrototypeOf(x); - var ctor = proto.constructor; + const proto = Object.getPrototypeOf(x); + const ctor = proto.constructor; return proto && ctor && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); } return false; } -exports.isPlainObject = isPlainObject; /** * Determines if `x` is an iterable Object. * @@ -40305,7 +37067,6 @@ exports.isPlainObject = isPlainObject; function isIterable(x) { return x && (typeof x[Symbol.iterator] === 'function'); } -exports.isIterable = isIterable; /** * Gets the primitive value of an object. */ @@ -40317,17 +37078,16 @@ function getValue(obj) { return obj; } } -exports.getValue = getValue; /** * UTF-8 encodes the given string. * * @param input - a string */ function utf8Encode(input) { - var bytes = new Uint8Array(input.length * 4); - var byteIndex = 0; - for (var i = 0; i < input.length; i++) { - var char = input.charCodeAt(i); + const bytes = new Uint8Array(input.length * 4); + let byteIndex = 0; + for (let i = 0; i < input.length; i++) { + let char = input.charCodeAt(i); if (char < 128) { bytes[byteIndex++] = char; continue; @@ -40340,7 +37100,7 @@ function utf8Encode(input) { if (++i >= input.length) { throw new Error("Incomplete surrogate pair."); } - var c2 = input.charCodeAt(i); + const c2 = input.charCodeAt(i); if (c2 < 0xdc00 || c2 > 0xdfff) { throw new Error("Invalid surrogate character."); } @@ -40357,15 +37117,14 @@ function utf8Encode(input) { } return bytes.subarray(0, byteIndex); } -exports.utf8Encode = utf8Encode; /** * UTF-8 decodes the given byte sequence into a string. * * @param bytes - a byte sequence */ function utf8Decode(bytes) { - var result = ""; - var i = 0; + let result = ""; + let i = 0; while (i < bytes.length) { var c = bytes[i++]; if (c > 127) { @@ -40405,7 +37164,6 @@ function utf8Decode(bytes) { } return result; } -exports.utf8Decode = utf8Decode; //# sourceMappingURL=index.js.map /***/ }), @@ -47214,37075 +43972,30932 @@ exports.parseProxyResponse = parseProxyResponse; /***/ }), -/***/ 83973: +/***/ 21917: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = minimatch -minimatch.Minimatch = Minimatch +"use strict"; -var path = (function () { try { return __nccwpck_require__(71017) } catch (e) {}}()) || { - sep: '/' -} -minimatch.sep = path.sep -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __nccwpck_require__(33717) -var plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } +var loader = __nccwpck_require__(51161); +var dumper = __nccwpck_require__(68866); + + +function renamed(from, to) { + return function () { + throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + + 'Use yaml.' + to + ' instead, which is now safe by default.'); + }; } -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' -// * => any number of characters -var star = qmark + '*?' +module.exports.Type = __nccwpck_require__(6073); +module.exports.Schema = __nccwpck_require__(21082); +module.exports.FAILSAFE_SCHEMA = __nccwpck_require__(28562); +module.exports.JSON_SCHEMA = __nccwpck_require__(1035); +module.exports.CORE_SCHEMA = __nccwpck_require__(12011); +module.exports.DEFAULT_SCHEMA = __nccwpck_require__(18759); +module.exports.load = loader.load; +module.exports.loadAll = loader.loadAll; +module.exports.dump = dumper.dump; +module.exports.YAMLException = __nccwpck_require__(68179); -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' +// Re-export all types in case user wants to create custom schema +module.exports.types = { + binary: __nccwpck_require__(77900), + float: __nccwpck_require__(42705), + map: __nccwpck_require__(86150), + null: __nccwpck_require__(20721), + pairs: __nccwpck_require__(96860), + set: __nccwpck_require__(79548), + timestamp: __nccwpck_require__(99212), + bool: __nccwpck_require__(64993), + int: __nccwpck_require__(11615), + merge: __nccwpck_require__(86104), + omap: __nccwpck_require__(19046), + seq: __nccwpck_require__(67283), + str: __nccwpck_require__(23619) +}; -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' +// Removed functions from JS-YAML 3.0.x +module.exports.safeLoad = renamed('safeLoad', 'load'); +module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll'); +module.exports.safeDump = renamed('safeDump', 'dump'); -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} +/***/ }), -// normalizes slashes. -var slashSplit = /\/+/ +/***/ 26829: +/***/ ((module) => { -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) - } -} +"use strict"; -function ext (a, b) { - b = b || {} - var t = {} - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) - return t + + +function isNothing(subject) { + return (typeof subject === 'undefined') || (subject === null); } -minimatch.defaults = function (def) { - if (!def || typeof def !== 'object' || !Object.keys(def).length) { - return minimatch - } - var orig = minimatch +function isObject(subject) { + return (typeof subject === 'object') && (subject !== null); +} - var m = function minimatch (p, pattern, options) { - return orig(p, pattern, ext(def, options)) - } - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } - m.Minimatch.defaults = function defaults (options) { - return orig.defaults(ext(def, options)).Minimatch - } +function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; - m.filter = function filter (pattern, options) { - return orig.filter(pattern, ext(def, options)) - } + return [ sequence ]; +} - m.defaults = function defaults (options) { - return orig.defaults(ext(def, options)) - } - m.makeRe = function makeRe (pattern, options) { - return orig.makeRe(pattern, ext(def, options)) - } +function extend(target, source) { + var index, length, key, sourceKeys; - m.braceExpand = function braceExpand (pattern, options) { - return orig.braceExpand(pattern, ext(def, options)) - } + if (source) { + sourceKeys = Object.keys(source); - m.match = function (list, pattern, options) { - return orig.match(list, pattern, ext(def, options)) + for (index = 0, length = sourceKeys.length; index < length; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } } - return m -} - -Minimatch.defaults = function (def) { - return minimatch.defaults(def).Minimatch + return target; } -function minimatch (p, pattern, options) { - assertValidPattern(pattern) - if (!options) options = {} +function repeat(string, count) { + var result = '', cycle; - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false + for (cycle = 0; cycle < count; cycle += 1) { + result += string; } - return new Minimatch(pattern, options).match(p) + return result; } -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } - assertValidPattern(pattern) +function isNegativeZero(number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); +} - if (!options) options = {} - pattern = pattern.trim() +module.exports.isNothing = isNothing; +module.exports.isObject = isObject; +module.exports.toArray = toArray; +module.exports.repeat = repeat; +module.exports.isNegativeZero = isNegativeZero; +module.exports.extend = extend; - // windows support: need to use /, not \ - if (!options.allowWindowsEscape && path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false - this.partial = !!options.partial +/***/ }), - // make the set of regexps etc. - this.make() -} +/***/ 68866: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -Minimatch.prototype.debug = function () {} +"use strict"; -Minimatch.prototype.make = make -function make () { - var pattern = this.pattern - var options = this.options - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } +/*eslint-disable no-use-before-define*/ - // step 1: figure out negation, etc. - this.parseNegate() +var common = __nccwpck_require__(26829); +var YAMLException = __nccwpck_require__(68179); +var DEFAULT_SCHEMA = __nccwpck_require__(18759); - // step 2: expand braces - var set = this.globSet = this.braceExpand() +var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty; - if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } +var CHAR_BOM = 0xFEFF; +var CHAR_TAB = 0x09; /* Tab */ +var CHAR_LINE_FEED = 0x0A; /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ +var CHAR_SPACE = 0x20; /* Space */ +var CHAR_EXCLAMATION = 0x21; /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22; /* " */ +var CHAR_SHARP = 0x23; /* # */ +var CHAR_PERCENT = 0x25; /* % */ +var CHAR_AMPERSAND = 0x26; /* & */ +var CHAR_SINGLE_QUOTE = 0x27; /* ' */ +var CHAR_ASTERISK = 0x2A; /* * */ +var CHAR_COMMA = 0x2C; /* , */ +var CHAR_MINUS = 0x2D; /* - */ +var CHAR_COLON = 0x3A; /* : */ +var CHAR_EQUALS = 0x3D; /* = */ +var CHAR_GREATER_THAN = 0x3E; /* > */ +var CHAR_QUESTION = 0x3F; /* ? */ +var CHAR_COMMERCIAL_AT = 0x40; /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ +var CHAR_GRAVE_ACCENT = 0x60; /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ +var CHAR_VERTICAL_LINE = 0x7C; /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - this.debug(this.pattern, set) +var ESCAPE_SEQUENCES = {}; - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) +ESCAPE_SEQUENCES[0x00] = '\\0'; +ESCAPE_SEQUENCES[0x07] = '\\a'; +ESCAPE_SEQUENCES[0x08] = '\\b'; +ESCAPE_SEQUENCES[0x09] = '\\t'; +ESCAPE_SEQUENCES[0x0A] = '\\n'; +ESCAPE_SEQUENCES[0x0B] = '\\v'; +ESCAPE_SEQUENCES[0x0C] = '\\f'; +ESCAPE_SEQUENCES[0x0D] = '\\r'; +ESCAPE_SEQUENCES[0x1B] = '\\e'; +ESCAPE_SEQUENCES[0x22] = '\\"'; +ESCAPE_SEQUENCES[0x5C] = '\\\\'; +ESCAPE_SEQUENCES[0x85] = '\\N'; +ESCAPE_SEQUENCES[0xA0] = '\\_'; +ESCAPE_SEQUENCES[0x2028] = '\\L'; +ESCAPE_SEQUENCES[0x2029] = '\\P'; - this.debug(this.pattern, set) +var DEPRECATED_BOOLEANS_SYNTAX = [ + 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', + 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' +]; - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; - this.debug(this.pattern, set) +function compileStyleMap(schema, map) { + var result, keys, index, length, tag, style, type; - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) + if (map === null) return {}; - this.debug(this.pattern, set) + result = {}; + keys = Object.keys(map); - this.set = set + for (index = 0, length = keys.length; index < length; index += 1) { + tag = keys[index]; + style = String(map[tag]); + + if (tag.slice(0, 2) === '!!') { + tag = 'tag:yaml.org,2002:' + tag.slice(2); + } + type = schema.compiledTypeMap['fallback'][tag]; + + if (type && _hasOwnProperty.call(type.styleAliases, style)) { + style = type.styleAliases[style]; + } + + result[tag] = style; + } + + return result; } -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 +function encodeHex(character) { + var string, handle, length; - if (options.nonegate) return + string = character.toString(16).toUpperCase(); - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ + if (character <= 0xFF) { + handle = 'x'; + length = 2; + } else if (character <= 0xFFFF) { + handle = 'u'; + length = 4; + } else if (character <= 0xFFFFFFFF) { + handle = 'U'; + length = 8; + } else { + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); } - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate + return '\\' + handle + common.repeat('0', length - string.length) + string; } -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) + +var QUOTING_TYPE_SINGLE = 1, + QUOTING_TYPE_DOUBLE = 2; + +function State(options) { + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.indent = Math.max(1, (options['indent'] || 2)); + this.noArrayIndent = options['noArrayIndent'] || false; + this.skipInvalid = options['skipInvalid'] || false; + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); + this.styleMap = compileStyleMap(this.schema, options['styles'] || null); + this.sortKeys = options['sortKeys'] || false; + this.lineWidth = options['lineWidth'] || 80; + this.noRefs = options['noRefs'] || false; + this.noCompatMode = options['noCompatMode'] || false; + this.condenseFlow = options['condenseFlow'] || false; + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options['forceQuotes'] || false; + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; + + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + + this.tag = null; + this.result = ''; + + this.duplicates = []; + this.usedDuplicates = null; } -Minimatch.prototype.braceExpand = braceExpand +// Indents every line in a string. Empty lines (\n only) are not indented. +function indentString(string, spaces) { + var ind = common.repeat(' ', spaces), + position = 0, + next = -1, + result = '', + line, + length = string.length; -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options + while (position < length) { + next = string.indexOf('\n', position); + if (next === -1) { + line = string.slice(position); + position = length; } else { - options = {} + line = string.slice(position, next + 1); + position = next + 1; } - } - - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern - assertValidPattern(pattern) + if (line.length && line !== '\n') result += ind; - // Thanks to Yeting Li for - // improving this regexp to avoid a ReDOS vulnerability. - if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { - // shortcut. no need to expand. - return [pattern] + result += line; } - return expand(pattern) + return result; } -var MAX_PATTERN_LENGTH = 1024 * 64 -var assertValidPattern = function (pattern) { - if (typeof pattern !== 'string') { - throw new TypeError('invalid pattern') - } - - if (pattern.length > MAX_PATTERN_LENGTH) { - throw new TypeError('pattern is too long') - } +function generateNextLine(state, level) { + return '\n' + common.repeat(' ', state.indent * level); } -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - assertValidPattern(pattern) +function testImplicitResolving(state, str) { + var index, length, type; - var options = this.options + for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { + type = state.implicitTypes[index]; - // shortcuts - if (pattern === '**') { - if (!options.noglobstar) - return GLOBSTAR - else - pattern = '*' + if (type.resolve(str)) { + return true; + } } - if (pattern === '') return '' - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this - - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } - - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) + return false; +} - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue - } +// [33] s-white ::= s-space | s-tab +function isWhitespace(c) { + return c === CHAR_SPACE || c === CHAR_TAB; +} - switch (c) { - /* istanbul ignore next */ - case '/': { - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - } +// Returns true if the character can be printed without escaping. +// From YAML 1.2: "any allowed characters known to be non-printable +// should also be escaped. [However,] This isn’t mandatory" +// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. +function isPrintable(c) { + return (0x00020 <= c && c <= 0x00007E) + || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) + || (0x10000 <= c && c <= 0x10FFFF); +} - case '\\': - clearStateChar() - escaping = true - continue +// [34] ns-char ::= nb-char - s-white +// [27] nb-char ::= c-printable - b-char - c-byte-order-mark +// [26] b-char ::= b-line-feed | b-carriage-return +// Including s-white (for some reason, examples doesn't match specs in this aspect) +// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark +function isNsCharOrWhitespace(c) { + return isPrintable(c) + && c !== CHAR_BOM + // - b-char + && c !== CHAR_CARRIAGE_RETURN + && c !== CHAR_LINE_FEED; +} - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) +// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out +// c = flow-in ⇒ ns-plain-safe-in +// c = block-key ⇒ ns-plain-safe-out +// c = flow-key ⇒ ns-plain-safe-in +// [128] ns-plain-safe-out ::= ns-char +// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator +// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) +// | ( /* An ns-char preceding */ “#” ) +// | ( “:” /* Followed by an ns-plain-safe(c) */ ) +function isPlainSafe(c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); + return ( + // ns-plain-safe + inblock ? // c = flow-in + cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace + // - c-flow-indicator + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + ) + // ns-plain-char + && c !== CHAR_SHARP // false on '#' + && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' + || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' + || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' +} - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } +// Simplified test for values allowed as the first character in plain style. +function isPlainSafeFirst(c) { + // Uses a subset of ns-char - c-indicator + // where ns-char = nb-char - s-white. + // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part + return isPrintable(c) && c !== CHAR_BOM + && !isWhitespace(c) // - s-white + // - (c-indicator ::= + // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” + && c !== CHAR_MINUS + && c !== CHAR_QUESTION + && c !== CHAR_COLON + && c !== CHAR_COMMA + && c !== CHAR_LEFT_SQUARE_BRACKET + && c !== CHAR_RIGHT_SQUARE_BRACKET + && c !== CHAR_LEFT_CURLY_BRACKET + && c !== CHAR_RIGHT_CURLY_BRACKET + // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” + && c !== CHAR_SHARP + && c !== CHAR_AMPERSAND + && c !== CHAR_ASTERISK + && c !== CHAR_EXCLAMATION + && c !== CHAR_VERTICAL_LINE + && c !== CHAR_EQUALS + && c !== CHAR_GREATER_THAN + && c !== CHAR_SINGLE_QUOTE + && c !== CHAR_DOUBLE_QUOTE + // | “%” | “@” | “`”) + && c !== CHAR_PERCENT + && c !== CHAR_COMMERCIAL_AT + && c !== CHAR_GRAVE_ACCENT; +} - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue +// Simplified test for values allowed as the last character in plain style. +function isPlainSafeLast(c) { + // just not whitespace or colon, it will be checked to be plain character later + return !isWhitespace(c) && c !== CHAR_COLON; +} - case '(': - if (inClass) { - re += '(' - continue - } +// Same as 'string'.codePointAt(pos), but works in older browsers. +function codePointAt(string, pos) { + var first = string.charCodeAt(pos), second; + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { + second = string.charCodeAt(pos + 1); + if (second >= 0xDC00 && second <= 0xDFFF) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + } + } + return first; +} - if (!stateChar) { - re += '\\(' - continue - } +// Determines whether block indentation indicator is required. +function needIndentIndicator(string) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string); +} - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, + STYLE_LITERAL = 3, + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5; - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue - } +// Determines which scalar styles are possible and returns the preferred style. +// lineWidth = -1 => no limit. +// Pre-conditions: str.length > 0. +// Post-conditions: +// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. +// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). +// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). +function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, + testAmbiguousType, quotingType, forceQuotes, inblock) { - clearStateChar() - hasMagic = true - var pl = patternListStack.pop() - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) - } - pl.reEnd = re.length - continue + var i; + var char = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; // count the first line correctly + var plain = isPlainSafeFirst(codePointAt(string, 0)) + && isPlainSafeLast(codePointAt(string, string.length - 1)); - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue + if (singleLineOnly || forceQuotes) { + // Case: no block styles. + // Check for disallowed characters to rule out plain and single. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + } else { + // Case: block styles permitted. + for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + if (char === CHAR_LINE_FEED) { + hasLineBreak = true; + // Check if any line can be folded. + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || + // Foldable line = too long, and not more-indented. + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' '); + previousLineBreak = i; } + } else if (!isPrintable(char)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char, prevChar, inblock); + prevChar = char; + } + // in case the end is missing a \n + hasFoldableLine = hasFoldableLine || (shouldTrackWidth && + (i - previousLineBreak - 1 > lineWidth && + string[previousLineBreak + 1] !== ' ')); + } + // Although every style can represent \n without escaping, prefer block styles + // for multiline, since they're more readable and they don't add empty lines. + // Also prefer folding a super-long line. + if (!hasLineBreak && !hasFoldableLine) { + // Strings interpretable as another type have to be quoted; + // e.g. the string 'true' vs. the boolean true. + if (plain && !forceQuotes && !testAmbiguousType(string)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + // Edge case: block indentation indicator can only have one digit. + if (indentPerLevel > 9 && needIndentIndicator(string)) { + return STYLE_DOUBLE; + } + // At this point we know block styles are valid. + // Prefer literal style unless we want to fold. + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; +} - clearStateChar() - re += '|' - continue +// Note: line breaking/folding is implemented for only the folded style. +// NB. We drop the last trailing newline (if any) of a returned block scalar +// since the dumper adds its own newline. This always works: +// • No ending newline => unaffected; already using strip "-" chomping. +// • Ending newline => removed then restored. +// Importantly, this keeps the "+" chomp indicator from gaining an extra line. +function writeScalar(state, string, level, iskey, inblock) { + state.dump = (function () { + if (string.length === 0) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + } + } - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() + var indent = state.indent * Math.max(1, level); // no 0-indent scalars + // As indentation gets deeper, let the width decrease monotonically + // to the lower bound min(state.lineWidth, 40). + // Note that this implies + // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. + // state.lineWidth > 40 + state.indent: width decreases until the lower bound. + // This behaves better than a constant minimum width which disallows narrower options, + // or an indent threshold which causes the width to suddenly increase. + var lineWidth = state.lineWidth === -1 + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - if (inClass) { - re += '\\' + c - continue - } + // Without knowing if keys are implicit/explicit, assume implicit for safety. + var singleLineOnly = iskey + // No block styles in flow mode. + || (state.flowLevel > -1 && level >= state.flowLevel); + function testAmbiguity(string) { + return testImplicitResolving(state, string); + } - inClass = true - classStart = i - reClassStart = re.length - re += c - continue + switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, + testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } + case STYLE_PLAIN: + return string; + case STYLE_SINGLE: + return "'" + string.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)); + case STYLE_FOLDED: + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string, lineWidth) + '"'; + default: + throw new YAMLException('impossible error: invalid scalar style'); + } + }()); +} - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } +// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. +function blockHeader(string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; - // finish up the class. - hasMagic = true - inClass = false - re += c - continue + // note the special case: the string '\n' counts as a "trailing" empty line. + var clip = string[string.length - 1] === '\n'; + var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); + var chomp = keep ? '+' : (clip ? '' : '-'); - default: - // swallow any state char that wasn't consumed - clearStateChar() + return indentIndicator + chomp + '\n'; +} - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } +// (See the note for writeScalar.) +function dropEndingNewline(string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +} - re += c +// Note: a long line without a suitable break point will exceed the width limit. +// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. +function foldString(string, width) { + // In folded style, $k$ consecutive newlines output as $k+1$ newlines— + // unless they're before or after a more-indented line, or at the very + // beginning or end, in which case $k$ maps to $k$. + // Therefore, parse each chunk as newline(s) followed by a content line. + var lineRe = /(\n+)([^\n]*)/g; - } // switch - } // for + // first line (possibly an empty line) + var result = (function () { + var nextLF = string.indexOf('\n'); + nextLF = nextLF !== -1 ? nextLF : string.length; + lineRe.lastIndex = nextLF; + return foldLine(string.slice(0, nextLF), width); + }()); + // If we haven't reached the first content line yet, don't add an extra \n. + var prevMoreIndented = string[0] === '\n' || string[0] === ' '; + var moreIndented; - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] + // rest of the lines + var match; + while ((match = lineRe.exec(string))) { + var prefix = match[1], line = match[2]; + moreIndented = (line[0] === ' '); + result += prefix + + (!prevMoreIndented && !moreIndented && line !== '' + ? '\n' : '') + + foldLine(line, width); + prevMoreIndented = moreIndented; } - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } - - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) + return result; +} - this.debug('tail=%j\n %s', tail, tail, pl, re) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type +// Greedy line breaking. +// Picks the longest line under the limit each time, +// otherwise settles for the shortest line over the limit. +// NB. More-indented lines *cannot* be folded, as that would add an extra \n. +function foldLine(line, width) { + if (line === '' || line[0] === ' ') return line; - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } + // Since a more-indented line adds a \n, breaks can't be followed by a space. + var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. + var match; + // start is an inclusive index. end, curr, and next are exclusive. + var start = 0, end, curr = 0, next = 0; + var result = ''; - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' + // Invariants: 0 <= start <= length-1. + // 0 <= curr <= next <= max(0, length-2). curr - start <= width. + // Inside the loop: + // A match implies length >= 2, so curr and next are <= length-2. + while ((match = breakRe.exec(line))) { + next = match.index; + // maintain invariant: curr - start <= width + if (next - start > width) { + end = (curr > start) ? curr : next; // derive end <= length-2 + result += '\n' + line.slice(start, end); + // skip the space that was output as \n + start = end + 1; // derive start <= length-1 + } + curr = next; } - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '[': case '.': case '(': addPatternStart = true + // By the invariants, start <= length-1, so there is something left over. + // It is either the whole string or a part starting from non-whitespace. + result += '\n'; + // Insert a break if the remainder is too long and there is a break available. + if (line.length - start > width && curr > start) { + result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + } else { + result += line.slice(start); } - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] + return result.slice(1); // drop extra \n joiner +} - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) +// Escapes a double-quoted string. +function escapeString(string) { + var result = ''; + var char = 0; + var escapeSeq; - nlLast += nlAfter + for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + char = codePointAt(string, i); + escapeSeq = ESCAPE_SEQUENCES[char]; - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + if (!escapeSeq && isPrintable(char)) { + result += string[i]; + if (char >= 0x10000) result += string[i + 1]; + } else { + result += escapeSeq || encodeHex(char); } - nlAfter = cleanAfter - - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe } - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } - - if (addPatternStart) { - re = patternStart + re - } + return result; +} - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } +function writeFlowSequence(state, level, object) { + var _result = '', + _tag = state.tag, + index, + length, + value; - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; - var flags = options.nocase ? 'i' : '' - try { - var regExp = new RegExp('^' + re + '$', flags) - } catch (er) /* istanbul ignore next - should be impossible */ { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } - regExp._glob = pattern - regExp._src = re + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level, value, false, false) || + (typeof value === 'undefined' && + writeNode(state, level, null, false, false))) { - return regExp -} + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); + _result += state.dump; + } + } -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() + state.tag = _tag; + state.dump = '[' + _result + ']'; } -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp - - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set +function writeBlockSequence(state, level, object, compact) { + var _result = '', + _tag = state.tag, + index, + length, + value; - if (!set.length) { - this.regexp = false - return this.regexp - } - var options = this.options + for (index = 0, length = object.length; index < length; index += 1) { + value = object[index]; - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' + if (state.replacer) { + value = state.replacer.call(object, String(index), value); + } - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') + // Write only valid elements, put null instead of invalid elements. + if (writeNode(state, level + 1, value, true, true, false, true) || + (typeof value === 'undefined' && + writeNode(state, level + 1, null, true, true, false, true))) { - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' + if (!compact || _result !== '') { + _result += generateNextLine(state, level); + } - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + _result += '-'; + } else { + _result += '- '; + } - try { - this.regexp = new RegExp(re, flags) - } catch (ex) /* istanbul ignore next - should be impossible */ { - this.regexp = false + _result += state.dump; + } } - return this.regexp -} -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list + state.tag = _tag; + state.dump = _result || '[]'; // Empty sequence if no valid values. } -Minimatch.prototype.match = function match (f, partial) { - if (typeof partial === 'undefined') partial = this.partial - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' +function writeFlowMapping(state, level, object) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + pairBuffer; - if (f === '/' && partial) return true + for (index = 0, length = objectKeyList.length; index < length; index += 1) { - var options = this.options + pairBuffer = ''; + if (_result !== '') pairBuffer += ', '; - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } + if (state.condenseFlow) pairBuffer += '"'; - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } - var set = this.set - this.debug(this.pattern, 'set', set) + if (!writeNode(state, level, objectKey, false, false)) { + continue; // Skip this pair because of invalid key; + } - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break - } + if (state.dump.length > 1024) pairBuffer += '? '; - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + + if (!writeNode(state, level, objectValue, false, false)) { + continue; // Skip this pair because of invalid value. } + + pairBuffer += state.dump; + + // Both key and value are valid. + _result += pairBuffer; } - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate + state.tag = _tag; + state.dump = '{' + _result + '}'; } -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options - - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) +function writeBlockMapping(state, level, object, compact) { + var _result = '', + _tag = state.tag, + objectKeyList = Object.keys(object), + index, + length, + objectKey, + objectValue, + explicitPair, + pairBuffer; - this.debug('matchOne', file.length, pattern.length) + // Allow sorting keys so that the output file is deterministic + if (state.sortKeys === true) { + // Default sorting + objectKeyList.sort(); + } else if (typeof state.sortKeys === 'function') { + // Custom sort function + objectKeyList.sort(state.sortKeys); + } else if (state.sortKeys) { + // Something is wrong + throw new YAMLException('sortKeys must be a boolean or a function'); + } - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = ''; - this.debug(pattern, p, f) + if (!compact || _result !== '') { + pairBuffer += generateNextLine(state, level); + } - // should be impossible. - // some invalid regexp stuff in the set. - /* istanbul ignore if */ - if (p === false) return false + objectKey = objectKeyList[index]; + objectValue = object[objectKey]; - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) + if (state.replacer) { + objectValue = state.replacer.call(object, objectKey, objectValue); + } - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } + if (!writeNode(state, level + 1, objectKey, true, true, true)) { + continue; // Skip this pair because of invalid key. + } - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] + explicitPair = (state.tag !== null && state.tag !== '?') || + (state.dump && state.dump.length > 1024); - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + if (explicitPair) { + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += '?'; + } else { + pairBuffer += '? '; + } + } - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } + pairBuffer += state.dump; - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } + if (explicitPair) { + pairBuffer += generateNextLine(state, level); + } - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - /* istanbul ignore if */ - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false + if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { + continue; // Skip this pair because of invalid value. } - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - hit = f === p - this.debug('string match', p, f, hit) + if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { + pairBuffer += ':'; } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) + pairBuffer += ': '; } - if (!hit) return false - } - - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* + pairBuffer += state.dump; - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else /* istanbul ignore else */ if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - return (fi === fl - 1) && (file[fi] === '') + // Both key and value are valid. + _result += pairBuffer; } - // should be unreachable. - /* istanbul ignore next */ - throw new Error('wtf?') + state.tag = _tag; + state.dump = _result || '{}'; // Empty mapping if no valid pairs. } -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} +function detectType(state, object, explicit) { + var _result, typeList, index, length, type, style; -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} + typeList = explicit ? state.explicitTypes : state.implicitTypes; + for (index = 0, length = typeList.length; index < length; index += 1) { + type = typeList[index]; -/***/ }), + if ((type.instanceOf || type.predicate) && + (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && + (!type.predicate || type.predicate(object))) { -/***/ 80900: -/***/ ((module) => { + if (explicit) { + if (type.multi && type.representName) { + state.tag = type.representName(object); + } else { + state.tag = type.tag; + } + } else { + state.tag = '?'; + } -/** - * Helpers. - */ + if (type.represent) { + style = state.styleMap[type.tag] || type.defaultStyle; -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var w = d * 7; -var y = d * 365.25; + if (_toString.call(type.represent) === '[object Function]') { + _result = type.represent(object, style); + } else if (_hasOwnProperty.call(type.represent, style)) { + _result = type.represent[style](object, style); + } else { + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + } -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} [options] - * @throws {Error} throw an error if val is not a non-empty string or a number - * @return {String|Number} - * @api public - */ + state.dump = _result; + } -module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === 'string' && val.length > 0) { - return parse(val); - } else if (type === 'number' && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); + return true; + } } - throw new Error( - 'val is not a non-empty string or a valid number. val=' + - JSON.stringify(val) - ); -}; -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ + return false; +} -function parse(str) { - str = String(str); - if (str.length > 100) { - return; +// Serializes `object` and writes it to global `result`. +// Returns true on success, or false on invalid object. +// +function writeNode(state, level, object, block, compact, iskey, isblockseq) { + state.tag = null; + state.dump = object; + + if (!detectType(state, object, false)) { + detectType(state, object, true); } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; + + var type = _toString.call(state.dump); + var inblock = block; + var tagStr; + + if (block) { + block = (state.flowLevel < 0 || state.flowLevel > level); } - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - default: - return undefined; - } -} -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ + var objectOrArray = type === '[object Object]' || type === '[object Array]', + duplicateIndex, + duplicate; -function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + 'd'; - } - if (msAbs >= h) { - return Math.round(ms / h) + 'h'; + if (objectOrArray) { + duplicateIndex = state.duplicates.indexOf(object); + duplicate = duplicateIndex !== -1; } - if (msAbs >= m) { - return Math.round(ms / m) + 'm'; + + if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { + compact = false; } - if (msAbs >= s) { - return Math.round(ms / s) + 's'; + + if (duplicate && state.usedDuplicates[duplicateIndex]) { + state.dump = '*ref_' + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { + state.usedDuplicates[duplicateIndex] = true; + } + if (type === '[object Object]') { + if (block && (Object.keys(state.dump).length !== 0)) { + writeBlockMapping(state, level, state.dump, compact); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowMapping(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object Array]') { + if (block && (state.dump.length !== 0)) { + if (state.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state, level - 1, state.dump, compact); + } else { + writeBlockSequence(state, level, state.dump, compact); + } + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + state.dump; + } + } else { + writeFlowSequence(state, level, state.dump); + if (duplicate) { + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + } + } + } else if (type === '[object String]') { + if (state.tag !== '?') { + writeScalar(state, state.dump, level, iskey, inblock); + } + } else if (type === '[object Undefined]') { + return false; + } else { + if (state.skipInvalid) return false; + throw new YAMLException('unacceptable kind of an object to dump ' + type); + } + + if (state.tag !== null && state.tag !== '?') { + // Need to encode all characters except those allowed by the spec: + // + // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ + // [36] ns-hex-digit ::= ns-dec-digit + // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ + // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ + // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” + // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” + // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” + // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” + // + // Also need to encode '!' because it has special meaning (end of tag prefix). + // + tagStr = encodeURI( + state.tag[0] === '!' ? state.tag.slice(1) : state.tag + ).replace(/!/g, '%21'); + + if (state.tag[0] === '!') { + tagStr = '!' + tagStr; + } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { + tagStr = '!!' + tagStr.slice(18); + } else { + tagStr = '!<' + tagStr + '>'; + } + + state.dump = tagStr + ' ' + state.dump; + } } - return ms + 'ms'; + + return true; } -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ +function getDuplicateReferences(object, state) { + var objects = [], + duplicatesIndexes = [], + index, + length; -function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); + inspectNode(object, objects, duplicatesIndexes); + + for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + state.duplicates.push(objects[duplicatesIndexes[index]]); } - return ms + ' ms'; + state.usedDuplicates = new Array(length); } -/** - * Pluralization helper. - */ +function inspectNode(object, objects, duplicatesIndexes) { + var objectKeyList, + index, + length; -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + if (object !== null && typeof object === 'object') { + index = objects.indexOf(object); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object); + + if (Array.isArray(object)) { + for (index = 0, length = object.length; index < length; index += 1) { + inspectNode(object[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object); + + for (index = 0, length = objectKeyList.length; index < length; index += 1) { + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } } +function dump(input, options) { + options = options || {}; -/***/ }), + var state = new State(options); -/***/ 91532: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (!state.noRefs) getDuplicateReferences(input, state); -const ANY = Symbol('SemVer ANY') -// hoisted class for cyclic dependency -class Comparator { - static get ANY () { - return ANY + var value = input; + + if (state.replacer) { + value = state.replacer.call({ '': value }, '', value); } - constructor (comp, options) { - options = parseOptions(options) + if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } + return ''; +} - comp = comp.trim().split(/\s+/).join(' ') - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) +module.exports.dump = dump; - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - debug('comp', this) - } +/***/ }), - parse (comp) { - const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const m = comp.match(r) +/***/ 68179: +/***/ ((module) => { - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`) - } +"use strict"; +// YAML error class. http://stackoverflow.com/questions/8458984 +// - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } - } - toString () { - return this.value - } +function formatError(exception, compact) { + var where = '', message = exception.reason || '(unknown reason)'; - test (version) { - debug('Comparator.test', version, this.options.loose) + if (!exception.mark) return message; - if (this.semver === ANY || version === ANY) { - return true - } + if (exception.mark.name) { + where += 'in "' + exception.mark.name + '" '; + } - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; - return cmp(version, this.operator, this.semver, this.options) + if (!compact && exception.mark.snippet) { + where += '\n\n' + exception.mark.snippet; } - intersects (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } + return message + ' ' + where; +} - if (this.operator === '') { - if (this.value === '') { - return true - } - return new Range(comp.value, options).test(this.value) - } else if (comp.operator === '') { - if (comp.value === '') { - return true - } - return new Range(this.value, options).test(comp.semver) - } - options = parseOptions(options) +function YAMLException(reason, mark) { + // Super constructor + Error.call(this); - // Special cases where nothing can possibly be lower - if (options.includePrerelease && - (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { - return false - } - if (!options.includePrerelease && - (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { - return false - } + this.name = 'YAMLException'; + this.reason = reason; + this.mark = mark; + this.message = formatError(this, false); - // Same direction increasing (> or >=) - if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { - return true - } - // Same direction decreasing (< or <=) - if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { - return true - } - // same SemVer and both sides are inclusive (<= or >=) - if ( - (this.semver.version === comp.semver.version) && - this.operator.includes('=') && comp.operator.includes('=')) { - return true - } - // opposite directions less than - if (cmp(this.semver, '<', comp.semver, options) && - this.operator.startsWith('>') && comp.operator.startsWith('<')) { - return true - } - // opposite directions greater than - if (cmp(this.semver, '>', comp.semver, options) && - this.operator.startsWith('<') && comp.operator.startsWith('>')) { - return true - } - return false + // Include stack trace in error object + if (Error.captureStackTrace) { + // Chrome and NodeJS + Error.captureStackTrace(this, this.constructor); + } else { + // FF, IE 10+ and Safari 6+. Fallback for others + this.stack = (new Error()).stack || ''; } } -module.exports = Comparator -const parseOptions = __nccwpck_require__(40785) -const { safeRe: re, t } = __nccwpck_require__(9523) -const cmp = __nccwpck_require__(75098) -const debug = __nccwpck_require__(50427) -const SemVer = __nccwpck_require__(48088) -const Range = __nccwpck_require__(9828) +// Inherit from Error +YAMLException.prototype = Object.create(Error.prototype); +YAMLException.prototype.constructor = YAMLException; -/***/ }), +YAMLException.prototype.toString = function toString(compact) { + return this.name + ': ' + formatError(this, compact); +}; -/***/ 9828: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SPACE_CHARACTERS = /\s+/g +module.exports = YAMLException; -// hoisted class for cyclic dependency -class Range { - constructor (range, options) { - options = parseOptions(options) - if (range instanceof Range) { - if ( - range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease - ) { - return range - } else { - return new Range(range.raw, options) - } - } +/***/ }), - if (range instanceof Comparator) { - // just put it in the set and return - this.raw = range.value - this.set = [[range]] - this.formatted = undefined - return this - } +/***/ 51161: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease +"use strict"; - // First reduce all whitespace as much as possible so we do not have to rely - // on potentially slow regexes like \s*. This is then stored and used for - // future error messages as well. - this.raw = range.trim().replace(SPACE_CHARACTERS, ' ') - // First, split on || - this.set = this.raw - .split('||') - // map the range to a 2d array of comparators - .map(r => this.parseRange(r.trim())) - // throw out any comparator lists that are empty - // this generally means that it was not a valid range, which is allowed - // in loose mode, but will still throw if the WHOLE range is invalid. - .filter(c => c.length) +/*eslint-disable max-len,no-use-before-define*/ - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${this.raw}`) - } +var common = __nccwpck_require__(26829); +var YAMLException = __nccwpck_require__(68179); +var makeSnippet = __nccwpck_require__(96975); +var DEFAULT_SCHEMA = __nccwpck_require__(18759); - // if we have any that are not the null set, throw out null sets. - if (this.set.length > 1) { - // keep the first one, in case they're all null sets - const first = this.set[0] - this.set = this.set.filter(c => !isNullSet(c[0])) - if (this.set.length === 0) { - this.set = [first] - } else if (this.set.length > 1) { - // if we have any that are *, then the range is just * - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c] - break - } - } - } - } - this.formatted = undefined - } +var _hasOwnProperty = Object.prototype.hasOwnProperty; - get range () { - if (this.formatted === undefined) { - this.formatted = '' - for (let i = 0; i < this.set.length; i++) { - if (i > 0) { - this.formatted += '||' - } - const comps = this.set[i] - for (let k = 0; k < comps.length; k++) { - if (k > 0) { - this.formatted += ' ' - } - this.formatted += comps[k].toString().trim() - } - } - } - return this.formatted - } - format () { - return this.range - } +var CONTEXT_FLOW_IN = 1; +var CONTEXT_FLOW_OUT = 2; +var CONTEXT_BLOCK_IN = 3; +var CONTEXT_BLOCK_OUT = 4; - toString () { - return this.range - } - parseRange (range) { - // memoize range parsing for performance. - // this is a very hot path, and fully deterministic. - const memoOpts = - (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | - (this.options.loose && FLAG_LOOSE) - const memoKey = memoOpts + ':' + range - const cached = cache.get(memoKey) - if (cached) { - return cached - } +var CHOMPING_CLIP = 1; +var CHOMPING_STRIP = 2; +var CHOMPING_KEEP = 3; - const loose = this.options.loose - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range) +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) - debug('tilde trim', range) - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) - debug('caret trim', range) +function _class(obj) { return Object.prototype.toString.call(obj); } - // At this point, the range is completely trimmed and - // ready to be split into comparators. +function is_EOL(c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +} - let rangeList = range - .split(' ') - .map(comp => parseComparator(comp, this.options)) - .join(' ') - .split(/\s+/) - // >=0.0.0 is equivalent to * - .map(comp => replaceGTE0(comp, this.options)) +function is_WHITE_SPACE(c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +} - if (loose) { - // in loose mode, throw out any that are not valid comparators - rangeList = rangeList.filter(comp => { - debug('loose invalid filter', comp, this.options) - return !!comp.match(re[t.COMPARATORLOOSE]) - }) - } - debug('range list', rangeList) +function is_WS_OR_EOL(c) { + return (c === 0x09/* Tab */) || + (c === 0x20/* Space */) || + (c === 0x0A/* LF */) || + (c === 0x0D/* CR */); +} - // if any comparators are the null set, then replace with JUST null set - // if more than one comparator, remove any * comparators - // also, don't include the same comparator more than once - const rangeMap = new Map() - const comparators = rangeList.map(comp => new Comparator(comp, this.options)) - for (const comp of comparators) { - if (isNullSet(comp)) { - return [comp] - } - rangeMap.set(comp.value, comp) - } - if (rangeMap.size > 1 && rangeMap.has('')) { - rangeMap.delete('') - } +function is_FLOW_INDICATOR(c) { + return c === 0x2C/* , */ || + c === 0x5B/* [ */ || + c === 0x5D/* ] */ || + c === 0x7B/* { */ || + c === 0x7D/* } */; +} - const result = [...rangeMap.values()] - cache.set(memoKey, result) - return result +function fromHexCode(c) { + var lc; + + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; } - intersects (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } + /*eslint-disable no-bitwise*/ + lc = c | 0x20; - return this.set.some((thisComparators) => { - return ( - isSatisfiable(thisComparators, options) && - range.set.some((rangeComparators) => { - return ( - isSatisfiable(rangeComparators, options) && - thisComparators.every((thisComparator) => { - return rangeComparators.every((rangeComparator) => { - return thisComparator.intersects(rangeComparator, options) - }) - }) - ) - }) - ) - }) + if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + return lc - 0x61 + 10; } - // if ANY of the sets match ALL of its comparators, then pass - test (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false - } + return -1; } -module.exports = Range - -const LRU = __nccwpck_require__(15339) -const cache = new LRU() - -const parseOptions = __nccwpck_require__(40785) -const Comparator = __nccwpck_require__(91532) -const debug = __nccwpck_require__(50427) -const SemVer = __nccwpck_require__(48088) -const { - safeRe: re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace, -} = __nccwpck_require__(9523) -const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __nccwpck_require__(42293) - -const isNullSet = c => c.value === '<0.0.0-0' -const isAny = c => c.value === '' - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -const isSatisfiable = (comparators, options) => { - let result = true - const remainingComparators = comparators.slice() - let testComparator = remainingComparators.pop() - - while (result && remainingComparators.length) { - result = remainingComparators.every((otherComparator) => { - return testComparator.intersects(otherComparator, options) - }) +function escapedHexLen(c) { + if (c === 0x78/* x */) { return 2; } + if (c === 0x75/* u */) { return 4; } + if (c === 0x55/* U */) { return 8; } + return 0; +} - testComparator = remainingComparators.pop() +function fromDecimalCode(c) { + if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + return c - 0x30; } - return result + return -1; } -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -const parseComparator = (comp, options) => { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp +function simpleEscapeSequence(c) { + /* eslint-disable indent */ + return (c === 0x30/* 0 */) ? '\x00' : + (c === 0x61/* a */) ? '\x07' : + (c === 0x62/* b */) ? '\x08' : + (c === 0x74/* t */) ? '\x09' : + (c === 0x09/* Tab */) ? '\x09' : + (c === 0x6E/* n */) ? '\x0A' : + (c === 0x76/* v */) ? '\x0B' : + (c === 0x66/* f */) ? '\x0C' : + (c === 0x72/* r */) ? '\x0D' : + (c === 0x65/* e */) ? '\x1B' : + (c === 0x20/* Space */) ? ' ' : + (c === 0x22/* " */) ? '\x22' : + (c === 0x2F/* / */) ? '/' : + (c === 0x5C/* \ */) ? '\x5C' : + (c === 0x4E/* N */) ? '\x85' : + (c === 0x5F/* _ */) ? '\xA0' : + (c === 0x4C/* L */) ? '\u2028' : + (c === 0x50/* P */) ? '\u2029' : ''; } -const isX = id => !id || id.toLowerCase() === 'x' || id === '*' - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 -// ~0.0.1 --> >=0.0.1 <0.1.0-0 -const replaceTildes = (comp, options) => { - return comp - .trim() - .split(/\s+/) - .map((c) => replaceTilde(c, options)) - .join(' ') +function charFromCodepoint(c) { + if (c <= 0xFFFF) { + return String.fromCharCode(c); + } + // Encode UTF-16 surrogate pair + // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF + return String.fromCharCode( + ((c - 0x010000) >> 10) + 0xD800, + ((c - 0x010000) & 0x03FF) + 0xDC00 + ); } -const replaceTilde = (comp, options) => { - const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] - return comp.replace(r, (_, M, m, p, pr) => { - debug('tilde', comp, _, M, m, p, pr) - let ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0` - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0-0 - ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` - } else if (pr) { - debug('replaceTilde pr', pr) - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } else { - // ~1.2.3 == >=1.2.3 <1.3.0-0 - ret = `>=${M}.${m}.${p - } <${M}.${+m + 1}.0-0` - } - - debug('tilde return', ret) - return ret - }) +// set a property of a literal object, while protecting against prototype pollution, +// see https://github.com/nodeca/js-yaml/issues/164 for more details +function setProperty(object, key, value) { + // used for this specific key only because Object.defineProperty is slow + if (key === '__proto__') { + Object.defineProperty(object, key, { + configurable: true, + enumerable: true, + writable: true, + value: value + }); + } else { + object[key] = value; + } } -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 -// ^1.2.3 --> >=1.2.3 <2.0.0-0 -// ^1.2.0 --> >=1.2.0 <2.0.0-0 -// ^0.0.1 --> >=0.0.1 <0.0.2-0 -// ^0.1.0 --> >=0.1.0 <0.2.0-0 -const replaceCarets = (comp, options) => { - return comp - .trim() - .split(/\s+/) - .map((c) => replaceCaret(c, options)) - .join(' ') +var simpleEscapeCheck = new Array(256); // integer, for fast access +var simpleEscapeMap = new Array(256); +for (var i = 0; i < 256; i++) { + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; + simpleEscapeMap[i] = simpleEscapeSequence(i); } -const replaceCaret = (comp, options) => { - debug('caret', comp, options) - const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] - const z = options.includePrerelease ? '-0' : '' - return comp.replace(r, (_, M, m, p, pr) => { - debug('caret', comp, _, M, m, p, pr) - let ret - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` - } else if (isX(p)) { - if (M === '0') { - ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` - } else { - ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${+M + 1}.0.0-0` - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p - }${z} <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p - }${z} <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p - } <${+M + 1}.0.0-0` - } - } +function State(input, options) { + this.input = input; - debug('caret return', ret) - return ret - }) -} + this.filename = options['filename'] || null; + this.schema = options['schema'] || DEFAULT_SCHEMA; + this.onWarning = options['onWarning'] || null; + // (Hidden) Remove? makes the loader to expect YAML 1.1 documents + // if such documents have no explicit %YAML directive + this.legacy = options['legacy'] || false; -const replaceXRanges = (comp, options) => { - debug('replaceXRanges', comp, options) - return comp - .split(/\s+/) - .map((c) => replaceXRange(c, options)) - .join(' ') -} + this.json = options['json'] || false; + this.listener = options['listener'] || null; -const replaceXRange = (comp, options) => { - comp = comp.trim() - const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] - return comp.replace(r, (ret, gtlt, M, m, p, pr) => { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - const xM = isX(M) - const xm = xM || isX(m) - const xp = xm || isX(p) - const anyX = xp + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; - if (gtlt === '=' && anyX) { - gtlt = '' - } + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' + // position of first leading tab in the current line, + // used to make sure there are no tabs in the indentation + this.firstTabInLine = -1; - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 + this.documents = []; - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } + /* + this.version; + this.checkLineBreaks; + this.tagMap; + this.anchorMap; + this.tag; + this.anchor; + this.kind; + this.result;*/ - if (gtlt === '<') { - pr = '-0' - } +} - ret = `${gtlt + M}.${m}.${p}${pr}` - } else if (xm) { - ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` - } else if (xp) { - ret = `>=${M}.${m}.0${pr - } <${M}.${+m + 1}.0-0` - } - debug('xRange return', ret) +function generateError(state, message) { + var mark = { + name: state.filename, + buffer: state.input.slice(0, -1), // omit trailing \0 + position: state.position, + line: state.line, + column: state.position - state.lineStart + }; - return ret - }) -} + mark.snippet = makeSnippet(mark); -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -const replaceStars = (comp, options) => { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp - .trim() - .replace(re[t.STAR], '') + return new YAMLException(message, mark); } -const replaceGTE0 = (comp, options) => { - debug('replaceGTE0', comp, options) - return comp - .trim() - .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +function throwError(state, message) { + throw generateError(state, message); } -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 -// TODO build? -const hyphenReplace = incPr => ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr) => { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = `>=${fM}.0.0${incPr ? '-0' : ''}` - } else if (isX(fp)) { - from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` - } else if (fpr) { - from = `>=${from}` - } else { - from = `>=${from}${incPr ? '-0' : ''}` - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = `<${+tM + 1}.0.0-0` - } else if (isX(tp)) { - to = `<${tM}.${+tm + 1}.0-0` - } else if (tpr) { - to = `<=${tM}.${tm}.${tp}-${tpr}` - } else if (incPr) { - to = `<${tM}.${tm}.${+tp + 1}-0` - } else { - to = `<=${to}` +function throwWarning(state, message) { + if (state.onWarning) { + state.onWarning.call(null, generateError(state, message)); } - - return `${from} ${to}`.trim() } -const testSet = (set, version, options) => { - for (let i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (let i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === Comparator.ANY) { - continue - } - if (set[i].semver.prerelease.length > 0) { - const allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } +var directiveHandlers = { - // Version has a -pre, but it's not one of the ones we like. - return false - } + YAML: function handleYamlDirective(state, name, args) { - return true -} + var match, major, minor; + if (state.version !== null) { + throwError(state, 'duplication of %YAML directive'); + } -/***/ }), + if (args.length !== 1) { + throwError(state, 'YAML directive accepts exactly one argument'); + } -/***/ 48088: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); -const debug = __nccwpck_require__(50427) -const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(42293) -const { safeRe: re, safeSrc: src, t } = __nccwpck_require__(9523) + if (match === null) { + throwError(state, 'ill-formed argument of the YAML directive'); + } -const parseOptions = __nccwpck_require__(40785) -const { compareIdentifiers } = __nccwpck_require__(92463) -class SemVer { - constructor (version, options) { - options = parseOptions(options) + major = parseInt(match[1], 10); + minor = parseInt(match[2], 10); - if (version instanceof SemVer) { - if (version.loose === !!options.loose && - version.includePrerelease === !!options.includePrerelease) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) + if (major !== 1) { + throwError(state, 'unacceptable YAML version of the document'); } - if (version.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ) + state.version = args[0]; + state.checkLineBreaks = (minor < 2); + + if (minor !== 1 && minor !== 2) { + throwWarning(state, 'unsupported YAML version of the document'); } + }, - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - // this isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - this.includePrerelease = !!options.includePrerelease + TAG: function handleTagDirective(state, name, args) { - const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + var handle, prefix; - if (!m) { - throw new TypeError(`Invalid Version: ${version}`) + if (args.length !== 2) { + throwError(state, 'TAG directive accepts exactly two arguments'); } - this.raw = version + handle = args[0]; + prefix = args[1]; - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + } - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') + if (_hasOwnProperty.call(state.tagMap, handle)) { + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); } - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); } - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state, 'tag prefix is malformed: ' + prefix); } - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() + state.tagMap[handle] = prefix; } +}; - format () { - this.version = `${this.major}.${this.minor}.${this.patch}` - if (this.prerelease.length) { - this.version += `-${this.prerelease.join('.')}` - } - return this.version - } - toString () { - return this.version - } +function captureSegment(state, start, end, checkJson) { + var _position, _length, _character, _result; - compare (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - if (typeof other === 'string' && other === this.version) { - return 0 - } - other = new SemVer(other, this.options) - } + if (start < end) { + _result = state.input.slice(start, end); - if (other.version === this.version) { - return 0 + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 0x09 || + (0x20 <= _character && _character <= 0x10FFFF))) { + throwError(state, 'expected valid JSON character'); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state, 'the stream contains non-printable characters'); } - return this.compareMain(other) || this.comparePre(other) + state.result += _result; } +} - compareMain (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } +function mergeMappings(state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; - return ( - compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) - ) + if (!common.isObject(source)) { + throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); } - comparePre (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } + sourceKeys = Object.keys(source); - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; - let i = 0 - do { - const a = this.prerelease[i] - const b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) + if (!_hasOwnProperty.call(destination, key)) { + setProperty(destination, key, source[key]); + overridableKeys[key] = true; + } } +} - compareBuild (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } +function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, + startLine, startLineStart, startPos) { - let i = 0 - do { - const a = this.build[i] - const b = other.build[i] - debug('build compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } + var index, quantity; - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc (release, identifier, identifierBase) { - if (release.startsWith('pre')) { - if (!identifier && identifierBase === false) { - throw new Error('invalid increment argument: identifier is empty') + // The output is a plain object here, so keys can only be strings. + // We need to convert keyNode to a string, but doing so can hang the process + // (deeply nested arrays that explode exponentially using aliases). + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state, 'nested arrays are not supported inside keys'); } - // Avoid an invalid semver results - if (identifier) { - const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`) - const match = `-${identifier}`.match(r) - if (!match || match[1] !== identifier) { - throw new Error(`invalid identifier: ${identifier}`) - } + + if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { + keyNode[index] = '[object Object]'; } } + } - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier, identifierBase) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier, identifierBase) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier, identifierBase) - this.inc('pre', identifier, identifierBase) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier, identifierBase) - } - this.inc('pre', identifier, identifierBase) - break - case 'release': - if (this.prerelease.length === 0) { - throw new Error(`version ${this.raw} is not a prerelease`) - } - this.prerelease.length = 0 - break + // Avoid code execution in load() via toString property + // (still use its own toString for arrays, timestamps, + // and whatever user schema extensions happen to have @@toStringTag) + if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { + keyNode = '[object Object]'; + } - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if ( - this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0 - ) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case 'pre': { - const base = Number(identifierBase) ? 1 : 0 - if (this.prerelease.length === 0) { - this.prerelease = [base] - } else { - let i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - if (identifier === this.prerelease.join('.') && identifierBase === false) { - throw new Error('invalid increment argument: identifier already exists') - } - this.prerelease.push(base) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - let prerelease = [identifier, base] - if (identifierBase === false) { - prerelease = [identifier] - } - if (compareIdentifiers(this.prerelease[0], identifier) === 0) { - if (isNaN(this.prerelease[1])) { - this.prerelease = prerelease - } - } else { - this.prerelease = prerelease - } - } - break + keyNode = String(keyNode); + + if (_result === null) { + _result = {}; + } + + if (keyTag === 'tag:yaml.org,2002:merge') { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state, _result, valueNode[index], overridableKeys); } - default: - throw new Error(`invalid increment argument: ${release}`) + } else { + mergeMappings(state, _result, valueNode, overridableKeys); } - this.raw = this.format() - if (this.build.length) { - this.raw += `+${this.build.join('.')}` + } else { + if (!state.json && + !_hasOwnProperty.call(overridableKeys, keyNode) && + _hasOwnProperty.call(_result, keyNode)) { + state.line = startLine || state.line; + state.lineStart = startLineStart || state.lineStart; + state.position = startPos || state.position; + throwError(state, 'duplicated mapping key'); } - return this + + setProperty(_result, keyNode, valueNode); + delete overridableKeys[keyNode]; } -} -module.exports = SemVer + return _result; +} +function readLineBreak(state) { + var ch; -/***/ }), + ch = state.input.charCodeAt(state.position); -/***/ 48848: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (ch === 0x0A/* LF */) { + state.position++; + } else if (ch === 0x0D/* CR */) { + state.position++; + if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { + state.position++; + } + } else { + throwError(state, 'a line break is expected'); + } -const parse = __nccwpck_require__(75925) -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null + state.line += 1; + state.lineStart = state.position; + state.firstTabInLine = -1; } -module.exports = clean +function skipSeparationSpace(state, allowComments, checkIndent) { + var lineBreaks = 0, + ch = state.input.charCodeAt(state.position); -/***/ }), + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { + state.firstTabInLine = state.position; + } + ch = state.input.charCodeAt(++state.position); + } -/***/ 75098: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (allowComments && ch === 0x23/* # */) { + do { + ch = state.input.charCodeAt(++state.position); + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + } -const eq = __nccwpck_require__(91898) -const neq = __nccwpck_require__(6017) -const gt = __nccwpck_require__(84123) -const gte = __nccwpck_require__(15522) -const lt = __nccwpck_require__(80194) -const lte = __nccwpck_require__(77520) + if (is_EOL(ch)) { + readLineBreak(state); -const cmp = (a, op, b, loose) => { - switch (op) { - case '===': - if (typeof a === 'object') { - a = a.version - } - if (typeof b === 'object') { - b = b.version - } - return a === b + ch = state.input.charCodeAt(state.position); + lineBreaks++; + state.lineIndent = 0; - case '!==': - if (typeof a === 'object') { - a = a.version - } - if (typeof b === 'object') { - b = b.version + while (ch === 0x20/* Space */) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); } - return a !== b + } else { + break; + } + } - case '': - case '=': - case '==': - return eq(a, b, loose) + if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { + throwWarning(state, 'deficient indentation'); + } - case '!=': - return neq(a, b, loose) + return lineBreaks; +} - case '>': - return gt(a, b, loose) +function testDocumentSeparator(state) { + var _position = state.position, + ch; - case '>=': - return gte(a, b, loose) + ch = state.input.charCodeAt(_position); - case '<': - return lt(a, b, loose) + // Condition state.position === state.lineStart is tested + // in parent on each call, for efficiency. No needs to test here again. + if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && + ch === state.input.charCodeAt(_position + 1) && + ch === state.input.charCodeAt(_position + 2)) { - case '<=': - return lte(a, b, loose) + _position += 3; - default: - throw new TypeError(`Invalid operator: ${op}`) + ch = state.input.charCodeAt(_position); + + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } } + + return false; } -module.exports = cmp +function writeFoldedLines(state, count) { + if (count === 1) { + state.result += ' '; + } else if (count > 1) { + state.result += common.repeat('\n', count - 1); + } +} -/***/ }), -/***/ 13466: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function readPlainScalar(state, nodeIndent, withinFlowCollection) { + var preceding, + following, + captureStart, + captureEnd, + hasPendingContent, + _line, + _lineStart, + _lineIndent, + _kind = state.kind, + _result = state.result, + ch; -const SemVer = __nccwpck_require__(48088) -const parse = __nccwpck_require__(75925) -const { safeRe: re, t } = __nccwpck_require__(9523) + ch = state.input.charCodeAt(state.position); -const coerce = (version, options) => { - if (version instanceof SemVer) { - return version + if (is_WS_OR_EOL(ch) || + is_FLOW_INDICATOR(ch) || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || + ch === 0x60/* ` */) { + return false; } - if (typeof version === 'number') { - version = String(version) - } + if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { + following = state.input.charCodeAt(state.position + 1); - if (typeof version !== 'string') { - return null + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } } - options = options || {} + state.kind = 'scalar'; + state.result = ''; + captureStart = captureEnd = state.position; + hasPendingContent = false; - let match = null - if (!options.rtl) { - match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] - let next - while ((next = coerceRtlRegex.exec(version)) && - (!match || match.index + match[0].length !== version.length) - ) { - if (!match || - next.index + next[0].length !== match.index + match[0].length) { - match = next - } - coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - coerceRtlRegex.lastIndex = -1 - } + while (ch !== 0) { + if (ch === 0x3A/* : */) { + following = state.input.charCodeAt(state.position + 1); - if (match === null) { - return null - } + if (is_WS_OR_EOL(following) || + withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } - const major = match[2] - const minor = match[3] || '0' - const patch = match[4] || '0' - const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' - const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' - - return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) -} -module.exports = coerce - - -/***/ }), - -/***/ 92156: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -const SemVer = __nccwpck_require__(48088) -const compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose) - const versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} -module.exports = compareBuild + } else if (ch === 0x23/* # */) { + preceding = state.input.charCodeAt(state.position - 1); + if (is_WS_OR_EOL(preceding)) { + break; + } -/***/ }), + } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || + withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; -/***/ 62804: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + } else if (is_EOL(ch)) { + _line = state.line; + _lineStart = state.lineStart; + _lineIndent = state.lineIndent; + skipSeparationSpace(state, false, -1); -const compare = __nccwpck_require__(44309) -const compareLoose = (a, b) => compare(a, b, true) -module.exports = compareLoose + if (state.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state.input.charCodeAt(state.position); + continue; + } else { + state.position = captureEnd; + state.line = _line; + state.lineStart = _lineStart; + state.lineIndent = _lineIndent; + break; + } + } + if (hasPendingContent) { + captureSegment(state, captureStart, captureEnd, false); + writeFoldedLines(state, state.line - _line); + captureStart = captureEnd = state.position; + hasPendingContent = false; + } -/***/ }), + if (!is_WHITE_SPACE(ch)) { + captureEnd = state.position + 1; + } -/***/ 44309: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + ch = state.input.charCodeAt(++state.position); + } -const SemVer = __nccwpck_require__(48088) -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) + captureSegment(state, captureStart, captureEnd, false); -module.exports = compare + if (state.result) { + return true; + } + state.kind = _kind; + state.result = _result; + return false; +} -/***/ }), +function readSingleQuotedScalar(state, nodeIndent) { + var ch, + captureStart, captureEnd; -/***/ 64297: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + ch = state.input.charCodeAt(state.position); -const parse = __nccwpck_require__(75925) + if (ch !== 0x27/* ' */) { + return false; + } -const diff = (version1, version2) => { - const v1 = parse(version1, null, true) - const v2 = parse(version2, null, true) - const comparison = v1.compare(v2) + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; - if (comparison === 0) { - return null - } + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x27/* ' */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); - const v1Higher = comparison > 0 - const highVersion = v1Higher ? v1 : v2 - const lowVersion = v1Higher ? v2 : v1 - const highHasPre = !!highVersion.prerelease.length - const lowHasPre = !!lowVersion.prerelease.length + if (ch === 0x27/* ' */) { + captureStart = state.position; + state.position++; + captureEnd = state.position; + } else { + return true; + } - if (lowHasPre && !highHasPre) { - // Going from prerelease -> no prerelease requires some special casing + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; - // If the low version has only a major, then it will always be a major - // Some examples: - // 1.0.0-1 -> 1.0.0 - // 1.0.0-1 -> 1.1.1 - // 1.0.0-1 -> 2.0.0 - if (!lowVersion.patch && !lowVersion.minor) { - return 'major' - } + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a single quoted scalar'); - // If the main part has no difference - if (lowVersion.compareMain(highVersion) === 0) { - if (lowVersion.minor && !lowVersion.patch) { - return 'minor' - } - return 'patch' + } else { + state.position++; + captureEnd = state.position; } } - // add the `pre` prefix if we are going to a prerelease version - const prefix = highHasPre ? 'pre' : '' + throwError(state, 'unexpected end of the stream within a single quoted scalar'); +} - if (v1.major !== v2.major) { - return prefix + 'major' - } +function readDoubleQuotedScalar(state, nodeIndent) { + var captureStart, + captureEnd, + hexLength, + hexResult, + tmp, + ch; - if (v1.minor !== v2.minor) { - return prefix + 'minor' - } + ch = state.input.charCodeAt(state.position); - if (v1.patch !== v2.patch) { - return prefix + 'patch' + if (ch !== 0x22/* " */) { + return false; } - // high and low are preleases - return 'prerelease' -} + state.kind = 'scalar'; + state.result = ''; + state.position++; + captureStart = captureEnd = state.position; -module.exports = diff + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + if (ch === 0x22/* " */) { + captureSegment(state, captureStart, state.position, true); + state.position++; + return true; + } else if (ch === 0x5C/* \ */) { + captureSegment(state, captureStart, state.position, true); + ch = state.input.charCodeAt(++state.position); -/***/ }), + if (is_EOL(ch)) { + skipSeparationSpace(state, false, nodeIndent); -/***/ 91898: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // TODO: rework to inline fn with no type cast? + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state.result += simpleEscapeMap[ch]; + state.position++; -const compare = __nccwpck_require__(44309) -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + for (; hexLength > 0; hexLength--) { + ch = state.input.charCodeAt(++state.position); -/***/ }), + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; -/***/ 84123: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + } else { + throwError(state, 'expected hexadecimal character'); + } + } -const compare = __nccwpck_require__(44309) -const gt = (a, b, loose) => compare(a, b, loose) > 0 -module.exports = gt + state.result += charFromCodepoint(hexResult); + state.position++; -/***/ }), + } else { + throwError(state, 'unknown escape sequence'); + } -/***/ 15522: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + captureStart = captureEnd = state.position; -const compare = __nccwpck_require__(44309) -const gte = (a, b, loose) => compare(a, b, loose) >= 0 -module.exports = gte + } else if (is_EOL(ch)) { + captureSegment(state, captureStart, captureEnd, true); + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); + captureStart = captureEnd = state.position; + } else if (state.position === state.lineStart && testDocumentSeparator(state)) { + throwError(state, 'unexpected end of the document within a double quoted scalar'); -/***/ }), + } else { + state.position++; + captureEnd = state.position; + } + } -/***/ 30900: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + throwError(state, 'unexpected end of the stream within a double quoted scalar'); +} -const SemVer = __nccwpck_require__(48088) +function readFlowCollection(state, nodeIndent) { + var readNext = true, + _line, + _lineStart, + _pos, + _tag = state.tag, + _result, + _anchor = state.anchor, + following, + terminator, + isPair, + isExplicitPair, + isMapping, + overridableKeys = Object.create(null), + keyNode, + keyTag, + valueNode, + ch; -const inc = (version, release, options, identifier, identifierBase) => { - if (typeof (options) === 'string') { - identifierBase = identifier - identifier = options - options = undefined - } + ch = state.input.charCodeAt(state.position); - try { - return new SemVer( - version instanceof SemVer ? version.version : version, - options - ).inc(release, identifier, identifierBase).version - } catch (er) { - return null + if (ch === 0x5B/* [ */) { + terminator = 0x5D;/* ] */ + isMapping = false; + _result = []; + } else if (ch === 0x7B/* { */) { + terminator = 0x7D;/* } */ + isMapping = true; + _result = {}; + } else { + return false; } -} -module.exports = inc + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } -/***/ }), + ch = state.input.charCodeAt(++state.position); -/***/ 80194: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + while (ch !== 0) { + skipSeparationSpace(state, true, nodeIndent); -const compare = __nccwpck_require__(44309) -const lt = (a, b, loose) => compare(a, b, loose) < 0 -module.exports = lt + ch = state.input.charCodeAt(state.position); + if (ch === terminator) { + state.position++; + state.tag = _tag; + state.anchor = _anchor; + state.kind = isMapping ? 'mapping' : 'sequence'; + state.result = _result; + return true; + } else if (!readNext) { + throwError(state, 'missed comma between flow collection entries'); + } else if (ch === 0x2C/* , */) { + // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 + throwError(state, "expected the node content, but found ','"); + } -/***/ }), + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; -/***/ 77520: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (ch === 0x3F/* ? */) { + following = state.input.charCodeAt(state.position + 1); -const compare = __nccwpck_require__(44309) -const lte = (a, b, loose) => compare(a, b, loose) <= 0 -module.exports = lte + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state.position++; + skipSeparationSpace(state, true, nodeIndent); + } + } + _line = state.line; // Save the current line. + _lineStart = state.lineStart; + _pos = state.position; + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state.tag; + keyNode = state.result; + skipSeparationSpace(state, true, nodeIndent); -/***/ }), + ch = state.input.charCodeAt(state.position); -/***/ 76688: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { + isPair = true; + ch = state.input.charCodeAt(++state.position); + skipSeparationSpace(state, true, nodeIndent); + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state.result; + } -const SemVer = __nccwpck_require__(48088) -const major = (a, loose) => new SemVer(a, loose).major -module.exports = major + if (isMapping) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + skipSeparationSpace(state, true, nodeIndent); -/***/ }), + ch = state.input.charCodeAt(state.position); -/***/ 38447: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (ch === 0x2C/* , */) { + readNext = true; + ch = state.input.charCodeAt(++state.position); + } else { + readNext = false; + } + } -const SemVer = __nccwpck_require__(48088) -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor + throwError(state, 'unexpected end of the stream within a flow collection'); +} +function readBlockScalar(state, nodeIndent) { + var captureStart, + folding, + chomping = CHOMPING_CLIP, + didReadContent = false, + detectedIndent = false, + textIndent = nodeIndent, + emptyLines = 0, + atMoreIndented = false, + tmp, + ch; -/***/ }), + ch = state.input.charCodeAt(state.position); -/***/ 6017: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (ch === 0x7C/* | */) { + folding = false; + } else if (ch === 0x3E/* > */) { + folding = true; + } else { + return false; + } -const compare = __nccwpck_require__(44309) -const neq = (a, b, loose) => compare(a, b, loose) !== 0 -module.exports = neq + state.kind = 'scalar'; + state.result = ''; + while (ch !== 0) { + ch = state.input.charCodeAt(++state.position); -/***/ }), + if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { + if (CHOMPING_CLIP === chomping) { + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state, 'repeat of a chomping mode identifier'); + } -/***/ 75925: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state, 'repeat of an indentation width identifier'); + } -const SemVer = __nccwpck_require__(48088) -const parse = (version, options, throwErrors = false) => { - if (version instanceof SemVer) { - return version - } - try { - return new SemVer(version, options) - } catch (er) { - if (!throwErrors) { - return null + } else { + break; } - throw er } -} - -module.exports = parse + if (is_WHITE_SPACE(ch)) { + do { ch = state.input.charCodeAt(++state.position); } + while (is_WHITE_SPACE(ch)); -/***/ }), + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (!is_EOL(ch) && (ch !== 0)); + } + } -/***/ 42866: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + while (ch !== 0) { + readLineBreak(state); + state.lineIndent = 0; -const SemVer = __nccwpck_require__(48088) -const patch = (a, loose) => new SemVer(a, loose).patch -module.exports = patch + ch = state.input.charCodeAt(state.position); + while ((!detectedIndent || state.lineIndent < textIndent) && + (ch === 0x20/* Space */)) { + state.lineIndent++; + ch = state.input.charCodeAt(++state.position); + } -/***/ }), + if (!detectedIndent && state.lineIndent > textIndent) { + textIndent = state.lineIndent; + } -/***/ 24016: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (is_EOL(ch)) { + emptyLines++; + continue; + } -const parse = __nccwpck_require__(75925) -const prerelease = (version, options) => { - const parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} -module.exports = prerelease + // End of the scalar. + if (state.lineIndent < textIndent) { + // Perform the chomping. + if (chomping === CHOMPING_KEEP) { + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { // i.e. only if the scalar is not empty. + state.result += '\n'; + } + } -/***/ }), + // Break this `while` cycle and go to the funciton's epilogue. + break; + } -/***/ 76417: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Folded style: use fancy rules to handle line breaks. + if (folding) { -const compare = __nccwpck_require__(44309) -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare + // Lines starting with white space characters (more-indented lines) are not folded. + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + // except for the first content line (cf. Example 8.1) + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + // End of more-indented block. + } else if (atMoreIndented) { + atMoreIndented = false; + state.result += common.repeat('\n', emptyLines + 1); -/***/ }), + // Just one line break - perceive as the same line. + } else if (emptyLines === 0) { + if (didReadContent) { // i.e. only if we have already read some scalar content. + state.result += ' '; + } -/***/ 8701: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Several line breaks - perceive as different lines. + } else { + state.result += common.repeat('\n', emptyLines); + } -const compareBuild = __nccwpck_require__(92156) -const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) -module.exports = rsort + // Literal style: just add exact number of line breaks between content lines. + } else { + // Keep all line breaks except the header line break. + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + } + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state.position; -/***/ }), - -/***/ 6055: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + while (!is_EOL(ch) && (ch !== 0)) { + ch = state.input.charCodeAt(++state.position); + } -const Range = __nccwpck_require__(9828) -const satisfies = (version, range, options) => { - try { - range = new Range(range, options) - } catch (er) { - return false + captureSegment(state, captureStart, state.position, false); } - return range.test(version) -} -module.exports = satisfies + return true; +} -/***/ }), +function readBlockSequence(state, nodeIndent) { + var _line, + _tag = state.tag, + _anchor = state.anchor, + _result = [], + following, + detected = false, + ch; -/***/ 61426: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; -const compareBuild = __nccwpck_require__(92156) -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } + ch = state.input.charCodeAt(state.position); -/***/ }), + while (ch !== 0) { + if (state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } -/***/ 19601: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (ch !== 0x2D/* - */) { + break; + } -const parse = __nccwpck_require__(75925) -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid + following = state.input.charCodeAt(state.position + 1); + if (!is_WS_OR_EOL(following)) { + break; + } -/***/ }), + detected = true; + state.position++; -/***/ 11383: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (skipSeparationSpace(state, true, -1)) { + if (state.lineIndent <= nodeIndent) { + _result.push(null); + ch = state.input.charCodeAt(state.position); + continue; + } + } -// just pre-load all the stuff that index.js lazily exports -const internalRe = __nccwpck_require__(9523) -const constants = __nccwpck_require__(42293) -const SemVer = __nccwpck_require__(48088) -const identifiers = __nccwpck_require__(92463) -const parse = __nccwpck_require__(75925) -const valid = __nccwpck_require__(19601) -const clean = __nccwpck_require__(48848) -const inc = __nccwpck_require__(30900) -const diff = __nccwpck_require__(64297) -const major = __nccwpck_require__(76688) -const minor = __nccwpck_require__(38447) -const patch = __nccwpck_require__(42866) -const prerelease = __nccwpck_require__(24016) -const compare = __nccwpck_require__(44309) -const rcompare = __nccwpck_require__(76417) -const compareLoose = __nccwpck_require__(62804) -const compareBuild = __nccwpck_require__(92156) -const sort = __nccwpck_require__(61426) -const rsort = __nccwpck_require__(8701) -const gt = __nccwpck_require__(84123) -const lt = __nccwpck_require__(80194) -const eq = __nccwpck_require__(91898) -const neq = __nccwpck_require__(6017) -const gte = __nccwpck_require__(15522) -const lte = __nccwpck_require__(77520) -const cmp = __nccwpck_require__(75098) -const coerce = __nccwpck_require__(13466) -const Comparator = __nccwpck_require__(91532) -const Range = __nccwpck_require__(9828) -const satisfies = __nccwpck_require__(6055) -const toComparators = __nccwpck_require__(52706) -const maxSatisfying = __nccwpck_require__(20579) -const minSatisfying = __nccwpck_require__(10832) -const minVersion = __nccwpck_require__(34179) -const validRange = __nccwpck_require__(2098) -const outside = __nccwpck_require__(60420) -const gtr = __nccwpck_require__(9380) -const ltr = __nccwpck_require__(33323) -const intersects = __nccwpck_require__(27008) -const simplifyRange = __nccwpck_require__(75297) -const subset = __nccwpck_require__(7863) -module.exports = { - parse, - valid, - clean, - inc, - diff, - major, - minor, - patch, - prerelease, - compare, - rcompare, - compareLoose, - compareBuild, - sort, - rsort, - gt, - lt, - eq, - neq, - gte, - lte, - cmp, - coerce, - Comparator, - Range, - satisfies, - toComparators, - maxSatisfying, - minSatisfying, - minVersion, - validRange, - outside, - gtr, - ltr, - intersects, - simplifyRange, - subset, - SemVer, - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, - RELEASE_TYPES: constants.RELEASE_TYPES, - compareIdentifiers: identifiers.compareIdentifiers, - rcompareIdentifiers: identifiers.rcompareIdentifiers, -} + _line = state.line; + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state.result); + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); -/***/ }), + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a sequence entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } + } -/***/ 42293: -/***/ ((module) => { + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'sequence'; + state.result = _result; + return true; + } + return false; +} -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' +function readBlockMapping(state, nodeIndent, flowIndent) { + var following, + allowCompact, + _line, + _keyLine, + _keyLineStart, + _keyPos, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, + overridableKeys = Object.create(null), + keyTag = null, + keyNode = null, + valueNode = null, + atExplicitKey = false, + detected = false, + ch; -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || -/* istanbul ignore next */ 9007199254740991 + // there is a leading tab before this token, so it can't be a block sequence/mapping; + // it can still be flow sequence/mapping or a scalar + if (state.firstTabInLine !== -1) return false; -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 + if (state.anchor !== null) { + state.anchorMap[state.anchor] = _result; + } -// Max safe length for a build identifier. The max length minus 6 characters for -// the shortest version with a build 0.0.0+BUILD. -const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + ch = state.input.charCodeAt(state.position); -const RELEASE_TYPES = [ - 'major', - 'premajor', - 'minor', - 'preminor', - 'patch', - 'prepatch', - 'prerelease', -] + while (ch !== 0) { + if (!atExplicitKey && state.firstTabInLine !== -1) { + state.position = state.firstTabInLine; + throwError(state, 'tab characters must not be used in indentation'); + } -module.exports = { - MAX_LENGTH, - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_SAFE_INTEGER, - RELEASE_TYPES, - SEMVER_SPEC_VERSION, - FLAG_INCLUDE_PRERELEASE: 0b001, - FLAG_LOOSE: 0b010, -} + following = state.input.charCodeAt(state.position + 1); + _line = state.line; // Save the current line. + // + // Explicit notation case. There are two separate blocks: + // first for the key (denoted by "?") and second for the value (denoted by ":") + // + if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { -/***/ }), + if (ch === 0x3F/* ? */) { + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } -/***/ 50427: -/***/ ((module) => { + detected = true; + atExplicitKey = true; + allowCompact = true; -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} + } else if (atExplicitKey) { + // i.e. 0x3A/* : */ === character after the explicit key. + atExplicitKey = false; + allowCompact = true; -module.exports = debug + } else { + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + } + state.position += 1; + ch = following; -/***/ }), + // + // Implicit notation case. Flow-style node as the key first, then ":", and the value. + // + } else { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; -/***/ 92463: -/***/ ((module) => { + if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + // Neither implicit nor explicit notation. + // Reading is done. Go to the epilogue. + break; + } -const numeric = /^[0-9]+$/ -const compareIdentifiers = (a, b) => { - const anum = numeric.test(a) - const bnum = numeric.test(b) + if (state.line === _line) { + ch = state.input.charCodeAt(state.position); - if (anum && bnum) { - a = +a - b = +b - } + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} + if (ch === 0x3A/* : */) { + ch = state.input.charCodeAt(++state.position); -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + if (!is_WS_OR_EOL(ch)) { + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + } -module.exports = { - compareIdentifiers, - rcompareIdentifiers, -} + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state.tag; + keyNode = state.result; -/***/ }), + } else if (detected) { + throwError(state, 'can not read an implicit mapping pair; a colon is missed'); -/***/ 15339: -/***/ ((module) => { + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } -class LRUCache { - constructor () { - this.max = 1000 - this.map = new Map() - } + } else if (detected) { + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - get (key) { - const value = this.map.get(key) - if (value === undefined) { - return undefined - } else { - // Remove the key from the map and add it to the end - this.map.delete(key) - this.map.set(key, value) - return value + } else { + state.tag = _tag; + state.anchor = _anchor; + return true; // Keep the result of `composeNode`. + } } - } - delete (key) { - return this.map.delete(key) - } + // + // Common reading code for both explicit and implicit notations. + // + if (state.line === _line || state.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state.line; + _keyLineStart = state.lineStart; + _keyPos = state.position; + } - set (key, value) { - const deleted = this.delete(key) + if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state.result; + } else { + valueNode = state.result; + } + } - if (!deleted && value !== undefined) { - // If cache is full, delete the least recently used item - if (this.map.size >= this.max) { - const firstKey = this.map.keys().next().value - this.delete(firstKey) + if (!atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; } - this.map.set(key, value) + skipSeparationSpace(state, true, -1); + ch = state.input.charCodeAt(state.position); } - return this + if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { + throwError(state, 'bad indentation of a mapping entry'); + } else if (state.lineIndent < nodeIndent) { + break; + } } -} - -module.exports = LRUCache + // + // Epilogue. + // -/***/ }), - -/***/ 40785: -/***/ ((module) => { - -// parse out just the options we care about -const looseOption = Object.freeze({ loose: true }) -const emptyOpts = Object.freeze({ }) -const parseOptions = options => { - if (!options) { - return emptyOpts + // Special case: last mapping's node contains only the key in explicit notation. + if (atExplicitKey) { + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); } - if (typeof options !== 'object') { - return looseOption + // Expose the resulting mapping. + if (detected) { + state.tag = _tag; + state.anchor = _anchor; + state.kind = 'mapping'; + state.result = _result; } - return options + return detected; } -module.exports = parseOptions +function readTagProperty(state) { + var _position, + isVerbatim = false, + isNamed = false, + tagHandle, + tagName, + ch; -/***/ }), + ch = state.input.charCodeAt(state.position); -/***/ 9523: -/***/ ((module, exports, __nccwpck_require__) => { + if (ch !== 0x21/* ! */) return false; -const { - MAX_SAFE_COMPONENT_LENGTH, - MAX_SAFE_BUILD_LENGTH, - MAX_LENGTH, -} = __nccwpck_require__(42293) -const debug = __nccwpck_require__(50427) -exports = module.exports = {} + if (state.tag !== null) { + throwError(state, 'duplication of a tag property'); + } -// The actual regexps go on exports.re -const re = exports.re = [] -const safeRe = exports.safeRe = [] -const src = exports.src = [] -const safeSrc = exports.safeSrc = [] -const t = exports.t = {} -let R = 0 + ch = state.input.charCodeAt(++state.position); -const LETTERDASHNUMBER = '[a-zA-Z0-9-]' + if (ch === 0x3C/* < */) { + isVerbatim = true; + ch = state.input.charCodeAt(++state.position); -// Replace some greedy regex tokens to prevent regex dos issues. These regex are -// used internally via the safeRe object since all inputs in this library get -// normalized first to trim and collapse all extra whitespace. The original -// regexes are exported for userland consumption and lower level usage. A -// future breaking change could export the safer regex only with a note that -// all input should have extra whitespace removed. -const safeRegexReplacements = [ - ['\\s', 1], - ['\\d', MAX_LENGTH], - [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], -] + } else if (ch === 0x21/* ! */) { + isNamed = true; + tagHandle = '!!'; + ch = state.input.charCodeAt(++state.position); -const makeSafeRegex = (value) => { - for (const [token, max] of safeRegexReplacements) { - value = value - .split(`${token}*`).join(`${token}{0,${max}}`) - .split(`${token}+`).join(`${token}{1,${max}}`) + } else { + tagHandle = '!'; } - return value -} -const createToken = (name, value, isGlobal) => { - const safe = makeSafeRegex(value) - const index = R++ - debug(name, index, value) - t[name] = index - src[index] = value - safeSrc[index] = safe - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) - safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) -} + _position = state.position; -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. + if (isVerbatim) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && ch !== 0x3E/* > */); -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. + if (state.position < state.length) { + tagName = state.input.slice(_position, state.position); + ch = state.input.charCodeAt(++state.position); + } else { + throwError(state, 'unexpected end of the stream within a verbatim tag'); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '\\d+') + if (ch === 0x21/* ! */) { + if (!isNamed) { + tagHandle = state.input.slice(_position - 1, state.position + 1); -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state, 'named tag handle cannot contain such characters'); + } -createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) + isNamed = true; + _position = state.position + 1; + } else { + throwError(state, 'tag suffix cannot contain exclamation marks'); + } + } -// ## Main Version -// Three dot-separated numeric identifiers. + ch = state.input.charCodeAt(++state.position); + } -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`) + tagName = state.input.slice(_position, state.position); -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state, 'tag suffix cannot contain flow indicator characters'); + } + } -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state, 'tag name cannot contain such characters: ' + tagName); + } -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state, 'tag name is malformed: ' + tagName); + } -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) + if (isVerbatim) { + state.tag = tagName; -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. + } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { + state.tag = state.tagMap[tagHandle] + tagName; -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + } else if (tagHandle === '!') { + state.tag = '!' + tagName; -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + } else if (tagHandle === '!!') { + state.tag = 'tag:yaml.org,2002:' + tagName; -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. + } else { + throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + } -createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) + return true; +} -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. +function readAnchorProperty(state) { + var _position, + ch; -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + ch = state.input.charCodeAt(state.position); -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. + if (ch !== 0x26/* & */) return false; -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. + if (state.anchor !== null) { + throwError(state, 'duplication of an anchor property'); + } -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) + ch = state.input.charCodeAt(++state.position); + _position = state.position; -createToken('FULL', `^${src[t.FULLPLAIN]}$`) + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) + if (state.position === _position) { + throwError(state, 'name of an anchor node must contain at least one character'); + } -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + state.anchor = state.input.slice(_position, state.position); + return true; +} -createToken('GTLT', '((?:<|>)?=?)') +function readAlias(state) { + var _position, alias, + ch; -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + ch = state.input.charCodeAt(state.position); -createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:${src[t.PRERELEASE]})?${ - src[t.BUILD]}?` + - `)?)?`) + if (ch !== 0x2A/* * */) return false; -createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:${src[t.PRERELEASELOOSE]})?${ - src[t.BUILD]}?` + - `)?)?`) + ch = state.input.charCodeAt(++state.position); + _position = state.position; -createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) -createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state.input.charCodeAt(++state.position); + } -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -createToken('COERCEPLAIN', `${'(^|[^\\d])' + - '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) -createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) -createToken('COERCEFULL', src[t.COERCEPLAIN] + - `(?:${src[t.PRERELEASE]})?` + - `(?:${src[t.BUILD]})?` + - `(?:$|[^\\d])`) -createToken('COERCERTL', src[t.COERCE], true) -createToken('COERCERTLFULL', src[t.COERCEFULL], true) + if (state.position === _position) { + throwError(state, 'name of an alias node must contain at least one character'); + } -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') + alias = state.input.slice(_position, state.position); -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' + if (!_hasOwnProperty.call(state.anchorMap, alias)) { + throwError(state, 'unidentified alias "' + alias + '"'); + } -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + state.result = state.anchorMap[alias]; + skipSeparationSpace(state, true, -1); + return true; +} -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') +function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, + allowBlockScalars, + allowBlockCollections, + indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' + if (allowToSeek) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`) + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`) + if (indentStatus === 1) { + while (readTagProperty(state) || readAnchorProperty(state)) { + if (skipSeparationSpace(state, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') + if (state.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } -/***/ }), + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } -/***/ 9380: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + blockIndent = state.position - state.lineStart; -// Determine if version is greater than all the versions possible in the range. -const outside = __nccwpck_require__(60420) -const gtr = (version, range, options) => outside(version, range, '>', options) -module.exports = gtr + if (indentStatus === 1) { + if (allowBlockCollections && + (readBlockSequence(state, blockIndent) || + readBlockMapping(state, blockIndent, flowIndent)) || + readFlowCollection(state, flowIndent)) { + hasContent = true; + } else { + if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || + readSingleQuotedScalar(state, flowIndent) || + readDoubleQuotedScalar(state, flowIndent)) { + hasContent = true; + } else if (readAlias(state)) { + hasContent = true; -/***/ }), + if (state.tag !== null || state.anchor !== null) { + throwError(state, 'alias node should not have any properties'); + } -/***/ 27008: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; -const Range = __nccwpck_require__(9828) -const intersects = (r1, r2, options) => { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2, options) -} -module.exports = intersects + if (state.tag === null) { + state.tag = '?'; + } + } + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + } + } else if (indentStatus === 0) { + // Special case: block sequences are allowed to have same indentation level as the parent. + // http://www.yaml.org/spec/1.2/spec.html#id2799784 + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + } + } -/***/ }), + if (state.tag === null) { + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } -/***/ 33323: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + } else if (state.tag === '?') { + // Implicit resolving is not allowed for non-scalar types, and '?' + // non-specific tag is only automatically assigned to plain scalars. + // + // We only need to check kind conformity in case user explicitly assigns '?' + // tag, for example like this: "! [0]" + // + if (state.result !== null && state.kind !== 'scalar') { + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + } -const outside = __nccwpck_require__(60420) -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr + for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type = state.implicitTypes[typeIndex]; + if (type.resolve(state.result)) { // `state.result` updated in resolver if matched + state.result = type.construct(state.result); + state.tag = type.tag; + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; + } + break; + } + } + } else if (state.tag !== '!') { + if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { + type = state.typeMap[state.kind || 'fallback'][state.tag]; + } else { + // looking for multi type + type = null; + typeList = state.typeMap.multi[state.kind || 'fallback']; -/***/ }), + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type = typeList[typeIndex]; + break; + } + } + } -/***/ 20579: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (!type) { + throwError(state, 'unknown tag !<' + state.tag + '>'); + } -const SemVer = __nccwpck_require__(48088) -const Range = __nccwpck_require__(9828) + if (state.result !== null && type.kind !== state.kind) { + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + } -const maxSatisfying = (versions, range, options) => { - let max = null - let maxSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) + if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + } else { + state.result = type.construct(state.result, state.tag); + if (state.anchor !== null) { + state.anchorMap[state.anchor] = state.result; } } - }) - return max + } + + if (state.listener !== null) { + state.listener('close', state); + } + return state.tag !== null || state.anchor !== null || hasContent; } -module.exports = maxSatisfying +function readDocument(state) { + var documentStart = state.position, + _position, + directiveName, + directiveArgs, + hasDirectives = false, + ch; + + state.version = null; + state.checkLineBreaks = state.legacy; + state.tagMap = Object.create(null); + state.anchorMap = Object.create(null); -/***/ }), + while ((ch = state.input.charCodeAt(state.position)) !== 0) { + skipSeparationSpace(state, true, -1); -/***/ 10832: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + ch = state.input.charCodeAt(state.position); -const SemVer = __nccwpck_require__(48088) -const Range = __nccwpck_require__(9828) -const minSatisfying = (versions, range, options) => { - let min = null - let minSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } + if (state.lineIndent > 0 || ch !== 0x25/* % */) { + break; } - }) - return min -} -module.exports = minSatisfying + hasDirectives = true; + ch = state.input.charCodeAt(++state.position); + _position = state.position; -/***/ }), + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); + } -/***/ 34179: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + directiveName = state.input.slice(_position, state.position); + directiveArgs = []; -const SemVer = __nccwpck_require__(48088) -const Range = __nccwpck_require__(9828) -const gt = __nccwpck_require__(84123) + if (directiveName.length < 1) { + throwError(state, 'directive name must not be less than one character in length'); + } -const minVersion = (range, loose) => { - range = new Range(range, loose) + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state.input.charCodeAt(++state.position); + } - let minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } + if (ch === 0x23/* # */) { + do { ch = state.input.charCodeAt(++state.position); } + while (ch !== 0 && !is_EOL(ch)); + break; + } - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } + if (is_EOL(ch)) break; - minver = null - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] + _position = state.position; - let setMin = null - comparators.forEach((comparator) => { - // Clone to avoid manipulating the comparator's semver object. - const compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!setMin || gt(compver, setMin)) { - setMin = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`) + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state.input.charCodeAt(++state.position); } - }) - if (setMin && (!minver || gt(minver, setMin))) { - minver = setMin + + directiveArgs.push(state.input.slice(_position, state.position)); } - } - if (minver && range.test(minver)) { - return minver + if (ch !== 0) readLineBreak(state); + + if (_hasOwnProperty.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state, directiveName, directiveArgs); + } else { + throwWarning(state, 'unknown document directive "' + directiveName + '"'); + } } - return null -} -module.exports = minVersion + skipSeparationSpace(state, true, -1); + if (state.lineIndent === 0 && + state.input.charCodeAt(state.position) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && + state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { + state.position += 3; + skipSeparationSpace(state, true, -1); -/***/ }), + } else if (hasDirectives) { + throwError(state, 'directives end mark is expected'); + } -/***/ 60420: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state, true, -1); -const SemVer = __nccwpck_require__(48088) -const Comparator = __nccwpck_require__(91532) -const { ANY } = Comparator -const Range = __nccwpck_require__(9828) -const satisfies = __nccwpck_require__(6055) -const gt = __nccwpck_require__(84123) -const lt = __nccwpck_require__(80194) -const lte = __nccwpck_require__(77520) -const gte = __nccwpck_require__(15522) + if (state.checkLineBreaks && + PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { + throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + } -const outside = (version, range, hilo, options) => { - version = new SemVer(version, options) - range = new Range(range, options) + state.documents.push(state.result); - let gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } + if (state.position === state.lineStart && testDocumentSeparator(state)) { - // If it satisfies the range it is not outside - if (satisfies(version, range, options)) { - return false + if (state.input.charCodeAt(state.position) === 0x2E/* . */) { + state.position += 3; + skipSeparationSpace(state, true, -1); + } + return; } - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. + if (state.position < (state.length - 1)) { + throwError(state, 'end of the stream or a document separator is expected'); + } else { + return; + } +} - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] - let high = null - let low = null +function loadDocuments(input, options) { + input = String(input); + options = options || {}; - comparators.forEach((comparator) => { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) + if (input.length !== 0) { - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false + // Add tailing `\n` if not exists + if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && + input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { + input += '\n'; } - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false + // Strip BOM + if (input.charCodeAt(0) === 0xFEFF) { + input = input.slice(1); } } - return true -} -module.exports = outside + var state = new State(input, options); + var nullpos = input.indexOf('\0'); -/***/ }), + if (nullpos !== -1) { + state.position = nullpos; + throwError(state, 'null byte is not allowed in input'); + } -/***/ 75297: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Use 0 as string terminator. That significantly simplifies bounds check. + state.input += '\0'; -// given a set of versions and a range, create a "simplified" range -// that includes the same versions that the original range does -// If the original range is shorter than the simplified one, return that. -const satisfies = __nccwpck_require__(6055) -const compare = __nccwpck_require__(44309) -module.exports = (versions, range, options) => { - const set = [] - let first = null - let prev = null - const v = versions.sort((a, b) => compare(a, b, options)) - for (const version of v) { - const included = satisfies(version, range, options) - if (included) { - prev = version - if (!first) { - first = version - } - } else { - if (prev) { - set.push([first, prev]) - } - prev = null - first = null - } + while (state.input.charCodeAt(state.position) === 0x20/* Space */) { + state.lineIndent += 1; + state.position += 1; } - if (first) { - set.push([first, null]) + + while (state.position < (state.length - 1)) { + readDocument(state); } - const ranges = [] - for (const [min, max] of set) { - if (min === max) { - ranges.push(min) - } else if (!max && min === v[0]) { - ranges.push('*') - } else if (!max) { - ranges.push(`>=${min}`) - } else if (min === v[0]) { - ranges.push(`<=${max}`) - } else { - ranges.push(`${min} - ${max}`) - } + return state.documents; +} + + +function loadAll(input, iterator, options) { + if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { + options = iterator; + iterator = null; } - const simplified = ranges.join(' || ') - const original = typeof range.raw === 'string' ? range.raw : String(range) - return simplified.length < original.length ? simplified : range + + var documents = loadDocuments(input, options); + + if (typeof iterator !== 'function') { + return documents; + } + + for (var index = 0, length = documents.length; index < length; index += 1) { + iterator(documents[index]); + } +} + + +function load(input, options) { + var documents = loadDocuments(input, options); + + if (documents.length === 0) { + /*eslint-disable no-undefined*/ + return undefined; + } else if (documents.length === 1) { + return documents[0]; + } + throw new YAMLException('expected a single document in the stream, but found more'); } +module.exports.loadAll = loadAll; +module.exports.load = load; + + /***/ }), -/***/ 7863: +/***/ 21082: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(9828) -const Comparator = __nccwpck_require__(91532) -const { ANY } = Comparator -const satisfies = __nccwpck_require__(6055) -const compare = __nccwpck_require__(44309) +"use strict"; -// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: -// - Every simple range `r1, r2, ...` is a null set, OR -// - Every simple range `r1, r2, ...` which is not a null set is a subset of -// some `R1, R2, ...` -// -// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: -// - If c is only the ANY comparator -// - If C is only the ANY comparator, return true -// - Else if in prerelease mode, return false -// - else replace c with `[>=0.0.0]` -// - If C is only the ANY comparator -// - if in prerelease mode, return true -// - else replace C with `[>=0.0.0]` -// - Let EQ be the set of = comparators in c -// - If EQ is more than one, return true (null set) -// - Let GT be the highest > or >= comparator in c -// - Let LT be the lowest < or <= comparator in c -// - If GT and LT, and GT.semver > LT.semver, return true (null set) -// - If any C is a = range, and GT or LT are set, return false -// - If EQ -// - If GT, and EQ does not satisfy GT, return true (null set) -// - If LT, and EQ does not satisfy LT, return true (null set) -// - If EQ satisfies every C, return true -// - Else return false -// - If GT -// - If GT.semver is lower than any > or >= comp in C, return false -// - If GT is >=, and GT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the GT.semver tuple, return false -// - If LT -// - If LT.semver is greater than any < or <= comp in C, return false -// - If LT is <=, and LT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the LT.semver tuple, return false -// - Else return true -const subset = (sub, dom, options = {}) => { - if (sub === dom) { - return true - } +/*eslint-disable max-len*/ - sub = new Range(sub, options) - dom = new Range(dom, options) - let sawNonNull = false +var YAMLException = __nccwpck_require__(68179); +var Type = __nccwpck_require__(6073); - OUTER: for (const simpleSub of sub.set) { - for (const simpleDom of dom.set) { - const isSub = simpleSubset(simpleSub, simpleDom, options) - sawNonNull = sawNonNull || isSub !== null - if (isSub) { - continue OUTER + +function compileList(schema, name) { + var result = []; + + schema[name].forEach(function (currentType) { + var newIndex = result.length; + + result.forEach(function (previousType, previousIndex) { + if (previousType.tag === currentType.tag && + previousType.kind === currentType.kind && + previousType.multi === currentType.multi) { + + newIndex = previousIndex; } - } - // the null set is a subset of everything, but null simple ranges in - // a complex range should be ignored. so if we saw a non-null range, - // then we know this isn't a subset, but if EVERY simple range was null, - // then it is a subset. - if (sawNonNull) { - return false - } - } - return true + }); + + result[newIndex] = currentType; + }); + + return result; } -const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] -const minimumVersion = [new Comparator('>=0.0.0')] -const simpleSubset = (sub, dom, options) => { - if (sub === dom) { - return true - } +function compileMap(/* lists... */) { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length; - if (sub.length === 1 && sub[0].semver === ANY) { - if (dom.length === 1 && dom[0].semver === ANY) { - return true - } else if (options.includePrerelease) { - sub = minimumVersionWithPreRelease + function collectType(type) { + if (type.multi) { + result.multi[type.kind].push(type); + result.multi['fallback'].push(type); } else { - sub = minimumVersion + result[type.kind][type.tag] = result['fallback'][type.tag] = type; } } - if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) { - return true - } else { - dom = minimumVersion - } + for (index = 0, length = arguments.length; index < length; index += 1) { + arguments[index].forEach(collectType); } + return result; +} - const eqSet = new Set() - let gt, lt - for (const c of sub) { - if (c.operator === '>' || c.operator === '>=') { - gt = higherGT(gt, c, options) - } else if (c.operator === '<' || c.operator === '<=') { - lt = lowerLT(lt, c, options) - } else { - eqSet.add(c.semver) - } - } - if (eqSet.size > 1) { - return null - } +function Schema(definition) { + return this.extend(definition); +} - let gtltComp - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options) - if (gtltComp > 0) { - return null - } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { - return null - } - } - // will iterate one or zero times - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) { - return null - } +Schema.prototype.extend = function extend(definition) { + var implicit = []; + var explicit = []; - if (lt && !satisfies(eq, String(lt), options)) { - return null - } + if (definition instanceof Type) { + // Schema.extend(type) + explicit.push(definition); - for (const c of dom) { - if (!satisfies(eq, String(c), options)) { - return false - } - } + } else if (Array.isArray(definition)) { + // Schema.extend([ type1, type2, ... ]) + explicit = explicit.concat(definition); - return true - } + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) + if (definition.implicit) implicit = implicit.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); - let higher, lower - let hasDomLT, hasDomGT - // if the subset has a prerelease, we need a comparator in the superset - // with the same tuple and a prerelease, or it's not a subset - let needDomLTPre = lt && - !options.includePrerelease && - lt.semver.prerelease.length ? lt.semver : false - let needDomGTPre = gt && - !options.includePrerelease && - gt.semver.prerelease.length ? gt.semver : false - // exception: <1.2.3-0 is the same as <1.2.3 - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && - lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { - needDomLTPre = false + } else { + throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' + + 'or a schema definition ({ implicit: [...], explicit: [...] })'); } - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' - hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' - if (gt) { - if (needDomGTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomGTPre.major && - c.semver.minor === needDomGTPre.minor && - c.semver.patch === needDomGTPre.patch) { - needDomGTPre = false - } - } - if (c.operator === '>' || c.operator === '>=') { - higher = higherGT(gt, c, options) - if (higher === c && higher !== gt) { - return false - } - } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { - return false - } + implicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); } - if (lt) { - if (needDomLTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomLTPre.major && - c.semver.minor === needDomLTPre.minor && - c.semver.patch === needDomLTPre.patch) { - needDomLTPre = false - } - } - if (c.operator === '<' || c.operator === '<=') { - lower = lowerLT(lt, c, options) - if (lower === c && lower !== lt) { - return false - } - } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { - return false - } + + if (type.loadKind && type.loadKind !== 'scalar') { + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); } - if (!c.operator && (lt || gt) && gtltComp !== 0) { - return false + + if (type.multi) { + throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); } - } + }); - // if there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) { - return false - } + explicit.forEach(function (type) { + if (!(type instanceof Type)) { + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + } + }); - if (lt && hasDomGT && !gt && gtltComp !== 0) { - return false - } + var result = Object.create(Schema.prototype); - // we needed a prerelease range in a specific tuple, but didn't get one - // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, - // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) { - return false - } + result.implicit = (this.implicit || []).concat(implicit); + result.explicit = (this.explicit || []).concat(explicit); - return true -} + result.compiledImplicit = compileList(result, 'implicit'); + result.compiledExplicit = compileList(result, 'explicit'); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); -// >=1.2.3 is lower than >1.2.3 -const higherGT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp > 0 ? a - : comp < 0 ? b - : b.operator === '>' && a.operator === '>=' ? b - : a -} + return result; +}; -// <=1.2.3 is higher than <1.2.3 -const lowerLT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp < 0 ? a - : comp > 0 ? b - : b.operator === '<' && a.operator === '<=' ? b - : a -} -module.exports = subset +module.exports = Schema; /***/ }), -/***/ 52706: +/***/ 12011: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(9828) - -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) +"use strict"; +// Standard YAML's Core schema. +// http://www.yaml.org/spec/1.2/spec.html#id2804923 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, Core schema has no distinctions from JSON schema is JS-YAML. -module.exports = toComparators -/***/ }), -/***/ 2098: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(9828) -const validRange = (range, options) => { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} -module.exports = validRange +module.exports = __nccwpck_require__(1035); /***/ }), -/***/ 59318: +/***/ 18759: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +// JS-YAML's default schema for `safeLoad` function. +// It is not described in the YAML specification. +// +// This schema is based on standard YAML's Core schema and includes most of +// extra types described at YAML tag repository. (http://yaml.org/type/) -const os = __nccwpck_require__(22037); -const tty = __nccwpck_require__(76224); -const hasFlag = __nccwpck_require__(31621); -const {env} = process; -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false') || - hasFlag('color=never')) { - forceColor = 0; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = 1; -} -if ('FORCE_COLOR' in env) { - if (env.FORCE_COLOR === 'true') { - forceColor = 1; - } else if (env.FORCE_COLOR === 'false') { - forceColor = 0; - } else { - forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); - } -} -function translateLevel(level) { - if (level === 0) { - return false; - } +module.exports = (__nccwpck_require__(12011).extend)({ + implicit: [ + __nccwpck_require__(99212), + __nccwpck_require__(86104) + ], + explicit: [ + __nccwpck_require__(77900), + __nccwpck_require__(19046), + __nccwpck_require__(96860), + __nccwpck_require__(79548) + ] +}); - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} -function supportsColor(haveStream, streamIsTTY) { - if (forceColor === 0) { - return 0; - } +/***/ }), - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } +/***/ 28562: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (hasFlag('color=256')) { - return 2; - } +"use strict"; +// Standard YAML's Failsafe schema. +// http://www.yaml.org/spec/1.2/spec.html#id2802346 - if (haveStream && !streamIsTTY && forceColor === undefined) { - return 0; - } - const min = forceColor || 0; - if (env.TERM === 'dumb') { - return min; - } - if (process.platform === 'win32') { - // Windows 10 build 10586 is the first Windows release that supports 256 colors. - // Windows 10 build 14931 is the first release that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - return 1; - } +var Schema = __nccwpck_require__(21082); - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } - return min; - } +module.exports = new Schema({ + explicit: [ + __nccwpck_require__(23619), + __nccwpck_require__(67283), + __nccwpck_require__(86150) + ] +}); - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - if (env.COLORTERM === 'truecolor') { - return 3; - } +/***/ }), - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); +/***/ 1035: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } +"use strict"; +// Standard YAML's JSON schema. +// http://www.yaml.org/spec/1.2/spec.html#id2803231 +// +// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. +// So, this schema is not such strict as defined in the YAML specification. +// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - if ('COLORTERM' in env) { - return 1; - } - return min; + +module.exports = (__nccwpck_require__(28562).extend)({ + implicit: [ + __nccwpck_require__(20721), + __nccwpck_require__(64993), + __nccwpck_require__(11615), + __nccwpck_require__(42705) + ] +}); + + +/***/ }), + +/***/ 96975: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + + +var common = __nccwpck_require__(26829); + + +// get snippet for a single line, respecting maxLength +function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { + var head = ''; + var tail = ''; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; + + if (position - lineStart > maxHalfLength) { + head = ' ... '; + lineStart = position - maxHalfLength + head.length; + } + + if (lineEnd - position > maxHalfLength) { + tail = ' ...'; + lineEnd = position + maxHalfLength - tail.length; + } + + return { + str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, + pos: position - lineStart + head.length // relative position + }; } -function getSupportLevel(stream) { - const level = supportsColor(stream, stream && stream.isTTY); - return translateLevel(level); + +function padStart(string, max) { + return common.repeat(' ', max - string.length) + string; } -module.exports = { - supportsColor: getSupportLevel, - stdout: translateLevel(supportsColor(true, tty.isatty(1))), - stderr: translateLevel(supportsColor(true, tty.isatty(2))) -}; +function makeSnippet(mark, options) { + options = Object.create(options || null); -/***/ }), + if (!mark.buffer) return null; -/***/ 4351: -/***/ ((module) => { + if (!options.maxLength) options.maxLength = 79; + if (typeof options.indent !== 'number') options.indent = 1; + if (typeof options.linesBefore !== 'number') options.linesBefore = 3; + if (typeof options.linesAfter !== 'number') options.linesAfter = 2; -/****************************************************************************** -Copyright (c) Microsoft Corporation. + var re = /\r?\n|\r|\0/g; + var lineStarts = [ 0 ]; + var lineEnds = []; + var match; + var foundLineNo = -1; -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. + while ((match = re.exec(mark.buffer))) { + lineEnds.push(match.index); + lineStarts.push(match.index + match[0].length); -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __esDecorate; -var __runInitializers; -var __propKey; -var __setFunctionName; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __classPrivateFieldIn; -var __createBinding; -var __addDisposableResource; -var __disposeResources; -var __rewriteRelativeImportExtension; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if ( true && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + if (mark.position <= match.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + } - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; + var result = '', i, line; + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; + for (i = 1; i <= options.linesBefore; i++) { + if (foundLineNo - i < 0) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo - i], + lineEnds[foundLineNo - i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), + maxLineLength + ); + result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n' + result; + } - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; + for (i = 1; i <= options.linesAfter; i++) { + if (foundLineNo + i >= lineEnds.length) break; + line = getLine( + mark.buffer, + lineStarts[foundLineNo + i], + lineEnds[foundLineNo + i], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), + maxLineLength + ); + result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + + ' | ' + line.str + '\n'; + } - __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; + return result.replace(/\n$/, ''); +} - __runInitializers = function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; - }; - __propKey = function (x) { - return typeof x === "symbol" ? x : "".concat(x); - }; +module.exports = makeSnippet; - __setFunctionName = function (f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; +/***/ }), - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; +/***/ 6073: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; +"use strict"; - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +var YAMLException = __nccwpck_require__(68179); + +var TYPE_CONSTRUCTOR_OPTIONS = [ + 'kind', + 'multi', + 'resolve', + 'construct', + 'instanceOf', + 'predicate', + 'represent', + 'representName', + 'defaultStyle', + 'styleAliases' +]; + +var YAML_NODE_KINDS = [ + 'scalar', + 'sequence', + 'mapping' +]; + +function compileStyleAliases(map) { + var result = {}; + + if (map !== null) { + Object.keys(map).forEach(function (style) { + map[style].forEach(function (alias) { + result[String(alias)] = style; + }); }); + } - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; + return result; +} - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; +function Type(tag, options) { + options = options || {}; - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; + Object.keys(options).forEach(function (name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; + // TODO: Add tag format check. + this.options = options; // keep original options in case user wants to extend this type later + this.tag = tag; + this.kind = options['kind'] || null; + this.resolve = options['resolve'] || function () { return true; }; + this.construct = options['construct'] || function (data) { return data; }; + this.instanceOf = options['instanceOf'] || null; + this.predicate = options['predicate'] || null; + this.represent = options['represent'] || null; + this.representName = options['representName'] || null; + this.defaultStyle = options['defaultStyle'] || null; + this.multi = options['multi'] || false; + this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } +} - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; +module.exports = Type; - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; - function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } - function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } - }; +/***/ }), - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; +/***/ 77900: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; +"use strict"; - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; +/*eslint-disable no-bitwise*/ - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; +var Type = __nccwpck_require__(6073); - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; +// [ 64, 65, 66 ] -> [ padding, CR, LF ] +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - __classPrivateFieldIn = function (state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); - }; - __addDisposableResource = function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; - }; +function resolveYamlBinary(data) { + if (data === null) return false; - var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - __disposeResources = function (env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; + // Convert one by one. + for (idx = 0; idx < max; idx++) { + code = map.indexOf(data.charAt(idx)); - __rewriteRelativeImportExtension = function (path, preserveJsx) { - if (typeof path === "string" && /^\.\.?\//.test(path)) { - return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); - }); - } - return path; - }; + // Skip CR/LF + if (code > 64) continue; - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__esDecorate", __esDecorate); - exporter("__runInitializers", __runInitializers); - exporter("__propKey", __propKey); - exporter("__setFunctionName", __setFunctionName); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); - exporter("__classPrivateFieldIn", __classPrivateFieldIn); - exporter("__addDisposableResource", __addDisposableResource); - exporter("__disposeResources", __disposeResources); - exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension); -}); + // Fail on illegal characters + if (code < 0) return false; -0 && (0); + bitlen += 6; + } + // If there are any bits left, source was corrupted + return (bitlen % 8) === 0; +} -/***/ }), +function constructYamlBinary(data) { + var idx, tailbits, + input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan + max = input.length, + map = BASE64_MAP, + bits = 0, + result = []; -/***/ 74294: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Collect by 6*4 bits (3 bytes) -module.exports = __nccwpck_require__(54219); + for (idx = 0; idx < max; idx++) { + if ((idx % 4 === 0) && idx) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } + bits = (bits << 6) | map.indexOf(input.charAt(idx)); + } -/***/ }), + // Dump tail -/***/ 54219: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + tailbits = (max % 4) * 6; -"use strict"; + if (tailbits === 0) { + result.push((bits >> 16) & 0xFF); + result.push((bits >> 8) & 0xFF); + result.push(bits & 0xFF); + } else if (tailbits === 18) { + result.push((bits >> 10) & 0xFF); + result.push((bits >> 2) & 0xFF); + } else if (tailbits === 12) { + result.push((bits >> 4) & 0xFF); + } + return new Uint8Array(result); +} -var net = __nccwpck_require__(41808); -var tls = __nccwpck_require__(24404); -var http = __nccwpck_require__(13685); -var https = __nccwpck_require__(95687); -var events = __nccwpck_require__(82361); -var assert = __nccwpck_require__(39491); -var util = __nccwpck_require__(73837); +function representYamlBinary(object /*, style*/) { + var result = '', bits = 0, idx, tail, + max = object.length, + map = BASE64_MAP; + // Convert every three bytes to 4 ASCII characters. -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; + for (idx = 0; idx < max; idx++) { + if ((idx % 3 === 0) && idx) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } + bits = (bits << 8) + object[idx]; + } -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} + // Dump tail -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; -} + tail = max % 3; -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; + if (tail === 0) { + result += map[(bits >> 18) & 0x3F]; + result += map[(bits >> 12) & 0x3F]; + result += map[(bits >> 6) & 0x3F]; + result += map[bits & 0x3F]; + } else if (tail === 2) { + result += map[(bits >> 10) & 0x3F]; + result += map[(bits >> 4) & 0x3F]; + result += map[(bits << 2) & 0x3F]; + result += map[64]; + } else if (tail === 1) { + result += map[(bits >> 2) & 0x3F]; + result += map[(bits << 4) & 0x3F]; + result += map[64]; + result += map[64]; + } + + return result; } -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - agent.defaultPort = 443; - return agent; +function isBinary(obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]'; } +module.exports = new Type('tag:yaml.org,2002:binary', { + kind: 'scalar', + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary +}); -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; - self.on('free', function onFree(socket, host, port, localAddress) { - var options = toOptions(host, port, localAddress); - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === options.host && pending.port === options.port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); +/***/ }), -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { - var self = this; - var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); +/***/ 64993: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push(options); - return; - } +"use strict"; - // If we are under maxSockets create a new one. - self.createSocket(options, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); - function onFree() { - self.emit('free', socket, options); - } +var Type = __nccwpck_require__(6073); - function onCloseOrRemove(err) { - self.removeSocket(socket); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; +function resolveYamlBoolean(data) { + if (data === null) return false; -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); + var max = data.length; - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false, - headers: { - host: options.host + ':' + options.port - } - }); - if (options.localAddress) { - connectOptions.localAddress = options.localAddress; - } - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } + return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); +} - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); +function constructYamlBoolean(data) { + return data === 'true' || + data === 'True' || + data === 'TRUE'; +} - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } +function isBoolean(object) { + return Object.prototype.toString.call(object) === '[object Boolean]'; +} - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } +module.exports = new Type('tag:yaml.org,2002:bool', { + kind: 'scalar', + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: function (object) { return object ? 'true' : 'false'; }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, + camelcase: function (object) { return object ? 'True' : 'False'; } + }, + defaultStyle: 'lowercase' +}); - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - if (res.statusCode !== 200) { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - socket.destroy(); - var error = new Error('tunneling socket could not be established, ' + - 'statusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; - } - if (head.length > 0) { - debug('got illegal response body from proxy'); - socket.destroy(); - var error = new Error('got illegal response body from proxy'); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - return; - } - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - return cb(socket); - } +/***/ }), - function onError(cause) { - connectReq.removeAllListeners(); +/***/ 42705: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; +"use strict"; -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; +var common = __nccwpck_require__(26829); +var Type = __nccwpck_require__(6073); -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - var hostHeader = options.request.getHeader('host'); - var tlsOptions = mergeOptions({}, self.options, { - socket: socket, - servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host - }); +var YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + + // .2e4, .2 + // special case, seems not from spec + '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + + // .inf + '|[-+]?\\.(?:inf|Inf|INF)' + + // .nan + '|\\.(?:nan|NaN|NAN))$'); - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, tlsOptions); - self.sockets[self.sockets.indexOf(socket)] = secureSocket; - cb(secureSocket); - }); +function resolveYamlFloat(data) { + if (data === null) return false; + + if (!YAML_FLOAT_PATTERN.test(data) || + // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data[data.length - 1] === '_') { + return false; + } + + return true; } +function constructYamlFloat(data) { + var value, sign; -function toOptions(host, port, localAddress) { - if (typeof host === 'string') { // since v0.10 - return { - host: host, - port: port, - localAddress: localAddress - }; + value = data.replace(/_/g, '').toLowerCase(); + sign = value[0] === '-' ? -1 : 1; + + if ('+-'.indexOf(value[0]) >= 0) { + value = value.slice(1); } - return host; // for v0.11 or later -} -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } + if (value === '.inf') { + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + + } else if (value === '.nan') { + return NaN; } - return target; + return sign * parseFloat(value, 10); } -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + +function representYamlFloat(object, style) { + var res; + + if (isNaN(object)) { + switch (style) { + case 'lowercase': return '.nan'; + case 'uppercase': return '.NAN'; + case 'camelcase': return '.NaN'; } - console.error.apply(console, args); + } else if (Number.POSITIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '.inf'; + case 'uppercase': return '.INF'; + case 'camelcase': return '.Inf'; + } + } else if (Number.NEGATIVE_INFINITY === object) { + switch (style) { + case 'lowercase': return '-.inf'; + case 'uppercase': return '-.INF'; + case 'camelcase': return '-.Inf'; + } + } else if (common.isNegativeZero(object)) { + return '-0.0'; } -} else { - debug = function() {}; + + res = object.toString(10); + + // JS stringifier can build scientific format without dots: 5e-100, + // while YAML requres dot: 5.e-100. Fix it with simple hack + + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; } -exports.debug = debug; // for test + +function isFloat(object) { + return (Object.prototype.toString.call(object) === '[object Number]') && + (object % 1 !== 0 || common.isNegativeZero(object)); +} + +module.exports = new Type('tag:yaml.org,2002:float', { + kind: 'scalar', + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: 'lowercase' +}); /***/ }), -/***/ 41773: +/***/ 11615: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const Client = __nccwpck_require__(33598) -const Dispatcher = __nccwpck_require__(60412) -const errors = __nccwpck_require__(48045) -const Pool = __nccwpck_require__(4634) -const BalancedPool = __nccwpck_require__(37931) -const Agent = __nccwpck_require__(7890) -const util = __nccwpck_require__(83983) -const { InvalidArgumentError } = errors -const api = __nccwpck_require__(44059) -const buildConnector = __nccwpck_require__(82067) -const MockClient = __nccwpck_require__(58687) -const MockAgent = __nccwpck_require__(66771) -const MockPool = __nccwpck_require__(26193) -const mockErrors = __nccwpck_require__(50888) -const ProxyAgent = __nccwpck_require__(97858) -const RetryHandler = __nccwpck_require__(82286) -const { getGlobalDispatcher, setGlobalDispatcher } = __nccwpck_require__(21892) -const DecoratorHandler = __nccwpck_require__(46930) -const RedirectHandler = __nccwpck_require__(72860) -const createRedirectInterceptor = __nccwpck_require__(38861) +var common = __nccwpck_require__(26829); +var Type = __nccwpck_require__(6073); -let hasCrypto -try { - __nccwpck_require__(6113) - hasCrypto = true -} catch { - hasCrypto = false +function isHexCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || + ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || + ((0x61/* a */ <= c) && (c <= 0x66/* f */)); } -Object.assign(Dispatcher.prototype, api) - -module.exports.Dispatcher = Dispatcher -module.exports.Client = Client -module.exports.Pool = Pool -module.exports.BalancedPool = BalancedPool -module.exports.Agent = Agent -module.exports.ProxyAgent = ProxyAgent -module.exports.RetryHandler = RetryHandler +function isOctCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +} -module.exports.DecoratorHandler = DecoratorHandler -module.exports.RedirectHandler = RedirectHandler -module.exports.createRedirectInterceptor = createRedirectInterceptor +function isDecCode(c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +} -module.exports.buildConnector = buildConnector -module.exports.errors = errors +function resolveYamlInteger(data) { + if (data === null) return false; -function makeDispatcher (fn) { - return (url, opts, handler) => { - if (typeof opts === 'function') { - handler = opts - opts = null - } + var max = data.length, + index = 0, + hasDigits = false, + ch; - if (!url || (typeof url !== 'string' && typeof url !== 'object' && !(url instanceof URL))) { - throw new InvalidArgumentError('invalid url') - } + if (!max) return false; - if (opts != null && typeof opts !== 'object') { - throw new InvalidArgumentError('invalid opts') - } + ch = data[index]; - if (opts && opts.path != null) { - if (typeof opts.path !== 'string') { - throw new InvalidArgumentError('invalid opts.path') - } + // sign + if (ch === '-' || ch === '+') { + ch = data[++index]; + } - let path = opts.path - if (!opts.path.startsWith('/')) { - path = `/${path}` - } + if (ch === '0') { + // 0 + if (index + 1 === max) return true; + ch = data[++index]; - url = new URL(util.parseOrigin(url).origin + path) - } else { - if (!opts) { - opts = typeof url === 'object' ? url : {} + // base 2, base 8, base 16 + + if (ch === 'b') { + // base 2 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (ch !== '0' && ch !== '1') return false; + hasDigits = true; } + return hasDigits && ch !== '_'; + } - url = util.parseURL(url) + + if (ch === 'x') { + // base 16 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isHexCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; } - const { agent, dispatcher = getGlobalDispatcher() } = opts - if (agent) { - throw new InvalidArgumentError('unsupported opts.agent. Did you mean opts.client?') + if (ch === 'o') { + // base 8 + index++; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isOctCode(data.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== '_'; } + } - return fn.call(dispatcher, { - ...opts, - origin: url.origin, - path: url.search ? `${url.pathname}${url.search}` : url.pathname, - method: opts.method || (opts.body ? 'PUT' : 'GET') - }, handler) + // base 10 (except 0) + + // value should not start with `_`; + if (ch === '_') return false; + + for (; index < max; index++) { + ch = data[index]; + if (ch === '_') continue; + if (!isDecCode(data.charCodeAt(index))) { + return false; + } + hasDigits = true; } + + // Should have digits and should not end with `_` + if (!hasDigits || ch === '_') return false; + + return true; } -module.exports.setGlobalDispatcher = setGlobalDispatcher -module.exports.getGlobalDispatcher = getGlobalDispatcher +function constructYamlInteger(data) { + var value = data, sign = 1, ch; -if (util.nodeMajor > 16 || (util.nodeMajor === 16 && util.nodeMinor >= 8)) { - let fetchImpl = null - module.exports.fetch = async function fetch (resource) { - if (!fetchImpl) { - fetchImpl = (__nccwpck_require__(74881).fetch) - } + if (value.indexOf('_') !== -1) { + value = value.replace(/_/g, ''); + } - try { - return await fetchImpl(...arguments) - } catch (err) { - if (typeof err === 'object') { - Error.captureStackTrace(err, this) - } + ch = value[0]; - throw err - } + if (ch === '-' || ch === '+') { + if (ch === '-') sign = -1; + value = value.slice(1); + ch = value[0]; } - module.exports.Headers = __nccwpck_require__(10554).Headers - module.exports.Response = __nccwpck_require__(27823).Response - module.exports.Request = __nccwpck_require__(48359).Request - module.exports.FormData = __nccwpck_require__(72015).FormData - module.exports.File = __nccwpck_require__(78511).File - module.exports.FileReader = __nccwpck_require__(1446).FileReader - const { setGlobalOrigin, getGlobalOrigin } = __nccwpck_require__(71246) + if (value === '0') return 0; - module.exports.setGlobalOrigin = setGlobalOrigin - module.exports.getGlobalOrigin = getGlobalOrigin + if (ch === '0') { + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + } - const { CacheStorage } = __nccwpck_require__(37907) - const { kConstruct } = __nccwpck_require__(29174) + return sign * parseInt(value, 10); +} - // Cache & CacheStorage are tightly coupled with fetch. Even if it may run - // in an older version of Node, it doesn't have any use without fetch. - module.exports.caches = new CacheStorage(kConstruct) +function isInteger(object) { + return (Object.prototype.toString.call(object)) === '[object Number]' && + (object % 1 === 0 && !common.isNegativeZero(object)); } -if (util.nodeMajor >= 16) { - const { deleteCookie, getCookies, getSetCookies, setCookie } = __nccwpck_require__(41724) +module.exports = new Type('tag:yaml.org,2002:int', { + kind: 'scalar', + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, + decimal: function (obj) { return obj.toString(10); }, + /* eslint-disable max-len */ + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + }, + defaultStyle: 'decimal', + styleAliases: { + binary: [ 2, 'bin' ], + octal: [ 8, 'oct' ], + decimal: [ 10, 'dec' ], + hexadecimal: [ 16, 'hex' ] + } +}); - module.exports.deleteCookie = deleteCookie - module.exports.getCookies = getCookies - module.exports.getSetCookies = getSetCookies - module.exports.setCookie = setCookie - const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) +/***/ }), - module.exports.parseMIMEType = parseMIMEType - module.exports.serializeAMimeType = serializeAMimeType -} +/***/ 86150: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -if (util.nodeMajor >= 18 && hasCrypto) { - const { WebSocket } = __nccwpck_require__(54284) +"use strict"; - module.exports.WebSocket = WebSocket -} -module.exports.request = makeDispatcher(api.request) -module.exports.stream = makeDispatcher(api.stream) -module.exports.pipeline = makeDispatcher(api.pipeline) -module.exports.connect = makeDispatcher(api.connect) -module.exports.upgrade = makeDispatcher(api.upgrade) +var Type = __nccwpck_require__(6073); -module.exports.MockClient = MockClient -module.exports.MockPool = MockPool -module.exports.MockAgent = MockAgent -module.exports.mockErrors = mockErrors +module.exports = new Type('tag:yaml.org,2002:map', { + kind: 'mapping', + construct: function (data) { return data !== null ? data : {}; } +}); /***/ }), -/***/ 7890: +/***/ 86104: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { InvalidArgumentError } = __nccwpck_require__(48045) -const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(72785) -const DispatcherBase = __nccwpck_require__(74839) -const Pool = __nccwpck_require__(4634) -const Client = __nccwpck_require__(33598) -const util = __nccwpck_require__(83983) -const createRedirectInterceptor = __nccwpck_require__(38861) -const { WeakRef, FinalizationRegistry } = __nccwpck_require__(56436)() - -const kOnConnect = Symbol('onConnect') -const kOnDisconnect = Symbol('onDisconnect') -const kOnConnectionError = Symbol('onConnectionError') -const kMaxRedirections = Symbol('maxRedirections') -const kOnDrain = Symbol('onDrain') -const kFactory = Symbol('factory') -const kFinalizer = Symbol('finalizer') -const kOptions = Symbol('options') +var Type = __nccwpck_require__(6073); -function defaultFactory (origin, opts) { - return opts && opts.connections === 1 - ? new Client(origin, opts) - : new Pool(origin, opts) +function resolveYamlMerge(data) { + return data === '<<' || data === null; } -class Agent extends DispatcherBase { - constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) { - super() +module.exports = new Type('tag:yaml.org,2002:merge', { + kind: 'scalar', + resolve: resolveYamlMerge +}); - if (typeof factory !== 'function') { - throw new InvalidArgumentError('factory must be a function.') - } - if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { - throw new InvalidArgumentError('connect must be a function or an object') - } +/***/ }), - if (!Number.isInteger(maxRedirections) || maxRedirections < 0) { - throw new InvalidArgumentError('maxRedirections must be a positive number') - } +/***/ 20721: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (connect && typeof connect !== 'function') { - connect = { ...connect } - } +"use strict"; - this[kInterceptors] = options.interceptors && options.interceptors.Agent && Array.isArray(options.interceptors.Agent) - ? options.interceptors.Agent - : [createRedirectInterceptor({ maxRedirections })] - this[kOptions] = { ...util.deepClone(options), connect } - this[kOptions].interceptors = options.interceptors - ? { ...options.interceptors } - : undefined - this[kMaxRedirections] = maxRedirections - this[kFactory] = factory - this[kClients] = new Map() - this[kFinalizer] = new FinalizationRegistry(/* istanbul ignore next: gc is undeterministic */ key => { - const ref = this[kClients].get(key) - if (ref !== undefined && ref.deref() === undefined) { - this[kClients].delete(key) - } - }) +var Type = __nccwpck_require__(6073); - const agent = this +function resolveYamlNull(data) { + if (data === null) return true; - this[kOnDrain] = (origin, targets) => { - agent.emit('drain', origin, [agent, ...targets]) - } + var max = data.length; - this[kOnConnect] = (origin, targets) => { - agent.emit('connect', origin, [agent, ...targets]) - } + return (max === 1 && data === '~') || + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); +} - this[kOnDisconnect] = (origin, targets, err) => { - agent.emit('disconnect', origin, [agent, ...targets], err) - } +function constructYamlNull() { + return null; +} - this[kOnConnectionError] = (origin, targets, err) => { - agent.emit('connectionError', origin, [agent, ...targets], err) - } - } +function isNull(object) { + return object === null; +} - get [kRunning] () { - let ret = 0 - for (const ref of this[kClients].values()) { - const client = ref.deref() - /* istanbul ignore next: gc is undeterministic */ - if (client) { - ret += client[kRunning] - } - } - return ret - } +module.exports = new Type('tag:yaml.org,2002:null', { + kind: 'scalar', + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: function () { return '~'; }, + lowercase: function () { return 'null'; }, + uppercase: function () { return 'NULL'; }, + camelcase: function () { return 'Null'; }, + empty: function () { return ''; } + }, + defaultStyle: 'lowercase' +}); - [kDispatch] (opts, handler) { - let key - if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) { - key = String(opts.origin) - } else { - throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.') - } - const ref = this[kClients].get(key) +/***/ }), - let dispatcher = ref ? ref.deref() : null - if (!dispatcher) { - dispatcher = this[kFactory](opts.origin, this[kOptions]) - .on('drain', this[kOnDrain]) - .on('connect', this[kOnConnect]) - .on('disconnect', this[kOnDisconnect]) - .on('connectionError', this[kOnConnectionError]) +/***/ 19046: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - this[kClients].set(key, new WeakRef(dispatcher)) - this[kFinalizer].register(dispatcher, key) - } +"use strict"; - return dispatcher.dispatch(opts, handler) - } - async [kClose] () { - const closePromises = [] - for (const ref of this[kClients].values()) { - const client = ref.deref() - /* istanbul ignore else: gc is undeterministic */ - if (client) { - closePromises.push(client.close()) - } - } +var Type = __nccwpck_require__(6073); - await Promise.all(closePromises) - } +var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _toString = Object.prototype.toString; - async [kDestroy] (err) { - const destroyPromises = [] - for (const ref of this[kClients].values()) { - const client = ref.deref() - /* istanbul ignore else: gc is undeterministic */ - if (client) { - destroyPromises.push(client.destroy(err)) +function resolveYamlOmap(data) { + if (data === null) return true; + + var objectKeys = [], index, length, pair, pairKey, pairHasKey, + object = data; + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + pairHasKey = false; + + if (_toString.call(pair) !== '[object Object]') return false; + + for (pairKey in pair) { + if (_hasOwnProperty.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; } } - await Promise.all(destroyPromises) + if (!pairHasKey) return false; + + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; } + + return true; } -module.exports = Agent +function constructYamlOmap(data) { + return data !== null ? data : []; +} + +module.exports = new Type('tag:yaml.org,2002:omap', { + kind: 'sequence', + resolve: resolveYamlOmap, + construct: constructYamlOmap +}); /***/ }), -/***/ 7032: +/***/ 96860: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { addAbortListener } = __nccwpck_require__(83983) -const { RequestAbortedError } = __nccwpck_require__(48045) +"use strict"; -const kListener = Symbol('kListener') -const kSignal = Symbol('kSignal') -function abort (self) { - if (self.abort) { - self.abort() - } else { - self.onError(new RequestAbortedError()) - } -} +var Type = __nccwpck_require__(6073); -function addSignal (self, signal) { - self[kSignal] = null - self[kListener] = null +var _toString = Object.prototype.toString; - if (!signal) { - return - } +function resolveYamlPairs(data) { + if (data === null) return true; - if (signal.aborted) { - abort(self) - return - } + var index, length, pair, keys, result, + object = data; - self[kSignal] = signal - self[kListener] = () => { - abort(self) + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + if (_toString.call(pair) !== '[object Object]') return false; + + keys = Object.keys(pair); + + if (keys.length !== 1) return false; + + result[index] = [ keys[0], pair[keys[0]] ]; } - addAbortListener(self[kSignal], self[kListener]) + return true; } -function removeSignal (self) { - if (!self[kSignal]) { - return - } +function constructYamlPairs(data) { + if (data === null) return []; - if ('removeEventListener' in self[kSignal]) { - self[kSignal].removeEventListener('abort', self[kListener]) - } else { - self[kSignal].removeListener('abort', self[kListener]) + var index, length, pair, keys, result, + object = data; + + result = new Array(object.length); + + for (index = 0, length = object.length; index < length; index += 1) { + pair = object[index]; + + keys = Object.keys(pair); + + result[index] = [ keys[0], pair[keys[0]] ]; } - self[kSignal] = null - self[kListener] = null + return result; } -module.exports = { - addSignal, - removeSignal -} +module.exports = new Type('tag:yaml.org,2002:pairs', { + kind: 'sequence', + resolve: resolveYamlPairs, + construct: constructYamlPairs +}); /***/ }), -/***/ 29744: +/***/ 67283: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { AsyncResource } = __nccwpck_require__(50852) -const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(48045) -const util = __nccwpck_require__(83983) -const { addSignal, removeSignal } = __nccwpck_require__(7032) +var Type = __nccwpck_require__(6073); -class ConnectHandler extends AsyncResource { - constructor (opts, callback) { - if (!opts || typeof opts !== 'object') { - throw new InvalidArgumentError('invalid opts') - } +module.exports = new Type('tag:yaml.org,2002:seq', { + kind: 'sequence', + construct: function (data) { return data !== null ? data : []; } +}); - if (typeof callback !== 'function') { - throw new InvalidArgumentError('invalid callback') - } - const { signal, opaque, responseHeaders } = opts +/***/ }), - if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { - throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') - } +/***/ 79548: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - super('UNDICI_CONNECT') +"use strict"; - this.opaque = opaque || null - this.responseHeaders = responseHeaders || null - this.callback = callback - this.abort = null - addSignal(this, signal) - } +var Type = __nccwpck_require__(6073); - onConnect (abort, context) { - if (!this.callback) { - throw new RequestAbortedError() - } +var _hasOwnProperty = Object.prototype.hasOwnProperty; - this.abort = abort - this.context = context - } +function resolveYamlSet(data) { + if (data === null) return true; - onHeaders () { - throw new SocketError('bad connect', null) - } + var key, object = data; - onUpgrade (statusCode, rawHeaders, socket) { - const { callback, opaque, context } = this + for (key in object) { + if (_hasOwnProperty.call(object, key)) { + if (object[key] !== null) return false; + } + } - removeSignal(this) + return true; +} - this.callback = null +function constructYamlSet(data) { + return data !== null ? data : {}; +} - let headers = rawHeaders - // Indicates is an HTTP2Session - if (headers != null) { - headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) - } +module.exports = new Type('tag:yaml.org,2002:set', { + kind: 'mapping', + resolve: resolveYamlSet, + construct: constructYamlSet +}); - this.runInAsyncScope(callback, null, null, { - statusCode, - headers, - socket, - opaque, - context - }) - } - onError (err) { - const { callback, opaque } = this +/***/ }), - removeSignal(this) +/***/ 23619: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (callback) { - this.callback = null - queueMicrotask(() => { - this.runInAsyncScope(callback, null, err, { opaque }) - }) - } - } -} +"use strict"; -function connect (opts, callback) { - if (callback === undefined) { - return new Promise((resolve, reject) => { - connect.call(this, opts, (err, data) => { - return err ? reject(err) : resolve(data) - }) - }) - } - try { - const connectHandler = new ConnectHandler(opts, callback) - this.dispatch({ ...opts, method: 'CONNECT' }, connectHandler) - } catch (err) { - if (typeof callback !== 'function') { - throw err - } - const opaque = opts && opts.opaque - queueMicrotask(() => callback(err, { opaque })) - } -} +var Type = __nccwpck_require__(6073); -module.exports = connect +module.exports = new Type('tag:yaml.org,2002:str', { + kind: 'scalar', + construct: function (data) { return data !== null ? data : ''; } +}); /***/ }), -/***/ 28752: +/***/ 99212: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { - Readable, - Duplex, - PassThrough -} = __nccwpck_require__(12781) -const { - InvalidArgumentError, - InvalidReturnValueError, - RequestAbortedError -} = __nccwpck_require__(48045) -const util = __nccwpck_require__(83983) -const { AsyncResource } = __nccwpck_require__(50852) -const { addSignal, removeSignal } = __nccwpck_require__(7032) -const assert = __nccwpck_require__(39491) +var Type = __nccwpck_require__(6073); -const kResume = Symbol('resume') +var YAML_DATE_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month + '-([0-9][0-9])$'); // [3] day -class PipelineRequest extends Readable { - constructor () { - super({ autoDestroy: true }) +var YAML_TIMESTAMP_REGEXP = new RegExp( + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction + '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour + '(?::([0-9][0-9]))?))?$'); // [11] tz_minute - this[kResume] = null - } +function resolveYamlTimestamp(data) { + if (data === null) return false; + if (YAML_DATE_REGEXP.exec(data) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; + return false; +} - _read () { - const { [kResume]: resume } = this +function constructYamlTimestamp(data) { + var match, year, month, day, hour, minute, second, fraction = 0, + delta = null, tz_hour, tz_minute, date; - if (resume) { - this[kResume] = null - resume() - } - } + match = YAML_DATE_REGEXP.exec(data); + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - _destroy (err, callback) { - this._read() + if (match === null) throw new Error('Date resolve error'); - callback(err) - } -} + // match: [1] year [2] month [3] day -class PipelineResponse extends Readable { - constructor (resume) { - super({ autoDestroy: true }) - this[kResume] = resume - } + year = +(match[1]); + month = +(match[2]) - 1; // JS month starts with 0 + day = +(match[3]); - _read () { - this[kResume]() + if (!match[4]) { // no hour + return new Date(Date.UTC(year, month, day)); } - _destroy (err, callback) { - if (!err && !this._readableState.endEmitted) { - err = new RequestAbortedError() - } + // match: [4] hour [5] minute [6] second [7] fraction - callback(err) - } -} + hour = +(match[4]); + minute = +(match[5]); + second = +(match[6]); -class PipelineHandler extends AsyncResource { - constructor (opts, handler) { - if (!opts || typeof opts !== 'object') { - throw new InvalidArgumentError('invalid opts') + if (match[7]) { + fraction = match[7].slice(0, 3); + while (fraction.length < 3) { // milli-seconds + fraction += '0'; } + fraction = +fraction; + } - if (typeof handler !== 'function') { - throw new InvalidArgumentError('invalid handler') - } + // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - const { signal, method, opaque, onInfo, responseHeaders } = opts + if (match[9]) { + tz_hour = +(match[10]); + tz_minute = +(match[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds + if (match[9] === '-') delta = -delta; + } - if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { - throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') - } + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - if (method === 'CONNECT') { - throw new InvalidArgumentError('invalid method') - } + if (delta) date.setTime(date.getTime() - delta); - if (onInfo && typeof onInfo !== 'function') { - throw new InvalidArgumentError('invalid onInfo callback') - } + return date; +} - super('UNDICI_PIPELINE') +function representYamlTimestamp(object /*, style*/) { + return object.toISOString(); +} - this.opaque = opaque || null - this.responseHeaders = responseHeaders || null - this.handler = handler - this.abort = null - this.context = null - this.onInfo = onInfo || null +module.exports = new Type('tag:yaml.org,2002:timestamp', { + kind: 'scalar', + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp +}); - this.req = new PipelineRequest().on('error', util.nop) - this.ret = new Duplex({ - readableObjectMode: opts.objectMode, - autoDestroy: true, - read: () => { - const { body } = this +/***/ }), - if (body && body.resume) { - body.resume() - } - }, - write: (chunk, encoding, callback) => { - const { req } = this +/***/ 83973: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (req.push(chunk, encoding) || req._readableState.destroyed) { - callback() - } else { - req[kResume] = callback - } - }, - destroy: (err, callback) => { - const { body, req, res, ret, abort } = this +module.exports = minimatch +minimatch.Minimatch = Minimatch - if (!err && !ret._readableState.endEmitted) { - err = new RequestAbortedError() - } +var path = (function () { try { return __nccwpck_require__(71017) } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep - if (abort && err) { - abort() - } +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = __nccwpck_require__(33717) - util.destroy(body, err) - util.destroy(req, err) - util.destroy(res, err) +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} - removeSignal(this) +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' - callback(err) - } - }).on('prefinish', () => { - const { req } = this +// * => any number of characters +var star = qmark + '*?' - // Node < 15 does not call _final in same tick. - req.push(null) - }) +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - this.res = null +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' - addSignal(this, signal) - } +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') - onConnect (abort, context) { - const { ret, res } = this +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} - assert(!res, 'pipeline cannot be retried') +// normalizes slashes. +var slashSplit = /\/+/ - if (ret.destroyed) { - throw new RequestAbortedError() - } +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} - this.abort = abort - this.context = context +function ext (a, b) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch } - onHeaders (statusCode, rawHeaders, resume) { - const { opaque, handler, context } = this + var orig = minimatch - if (statusCode < 200) { - if (this.onInfo) { - const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) - this.onInfo({ statusCode, headers }) - } - return - } + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } - this.res = new PipelineResponse(resume) + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } - let body - try { - this.handler = null - const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) - body = this.runInAsyncScope(handler, null, { - statusCode, - headers, - opaque, - body: this.res, - context - }) - } catch (err) { - this.res.on('error', util.nop) - throw err - } + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } - if (!body || typeof body.on !== 'function') { - throw new InvalidReturnValueError('expected Readable') - } + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } - body - .on('data', (chunk) => { - const { ret, body } = this + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } - if (!ret.push(chunk) && body.pause) { - body.pause() - } - }) - .on('error', (err) => { - const { ret } = this + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } - util.destroy(ret, err) - }) - .on('end', () => { - const { ret } = this + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } - ret.push(null) - }) - .on('close', () => { - const { ret } = this + return m +} - if (!ret._readableState.ended) { - util.destroy(ret, new RequestAbortedError()) - } - }) +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} - this.body = body - } +function minimatch (p, pattern, options) { + assertValidPattern(pattern) - onData (chunk) { - const { res } = this - return res.push(chunk) - } + if (!options) options = {} - onComplete (trailers) { - const { res } = this - res.push(null) + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false } - onError (err) { - const { ret } = this - this.handler = null - util.destroy(ret, err) - } + return new Minimatch(pattern, options).match(p) } -function pipeline (opts, handler) { - try { - const pipelineHandler = new PipelineHandler(opts, handler) - this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler) - return pipelineHandler.ret - } catch (err) { - return new PassThrough().destroy(err) +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) } -} -module.exports = pipeline + assertValidPattern(pattern) + if (!options) options = {} -/***/ }), + pattern = pattern.trim() -/***/ 55448: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // windows support: need to use /, not \ + if (!options.allowWindowsEscape && path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } -"use strict"; + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + // make the set of regexps etc. + this.make() +} -const Readable = __nccwpck_require__(73858) -const { - InvalidArgumentError, - RequestAbortedError -} = __nccwpck_require__(48045) -const util = __nccwpck_require__(83983) -const { getResolveErrorBodyCallback } = __nccwpck_require__(77474) -const { AsyncResource } = __nccwpck_require__(50852) -const { addSignal, removeSignal } = __nccwpck_require__(7032) +Minimatch.prototype.debug = function () {} -class RequestHandler extends AsyncResource { - constructor (opts, callback) { - if (!opts || typeof opts !== 'object') { - throw new InvalidArgumentError('invalid opts') - } +Minimatch.prototype.make = make +function make () { + var pattern = this.pattern + var options = this.options - const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError, highWaterMark } = opts + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } - try { - if (typeof callback !== 'function') { - throw new InvalidArgumentError('invalid callback') - } + // step 1: figure out negation, etc. + this.parseNegate() - if (highWaterMark && (typeof highWaterMark !== 'number' || highWaterMark < 0)) { - throw new InvalidArgumentError('invalid highWaterMark') - } + // step 2: expand braces + var set = this.globSet = this.braceExpand() - if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { - throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') - } + if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } - if (method === 'CONNECT') { - throw new InvalidArgumentError('invalid method') - } + this.debug(this.pattern, set) - if (onInfo && typeof onInfo !== 'function') { - throw new InvalidArgumentError('invalid onInfo callback') - } + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) - super('UNDICI_REQUEST') - } catch (err) { - if (util.isStream(body)) { - util.destroy(body.on('error', util.nop), err) - } - throw err - } - - this.responseHeaders = responseHeaders || null - this.opaque = opaque || null - this.callback = callback - this.res = null - this.abort = null - this.body = body - this.trailers = {} - this.context = null - this.onInfo = onInfo || null - this.throwOnError = throwOnError - this.highWaterMark = highWaterMark - - if (util.isStream(body)) { - body.on('error', (err) => { - this.onError(err) - }) - } - - addSignal(this, signal) - } + this.debug(this.pattern, set) - onConnect (abort, context) { - if (!this.callback) { - throw new RequestAbortedError() - } + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) - this.abort = abort - this.context = context - } + this.debug(this.pattern, set) - onHeaders (statusCode, rawHeaders, resume, statusMessage) { - const { callback, opaque, abort, context, responseHeaders, highWaterMark } = this + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) - const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + this.debug(this.pattern, set) - if (statusCode < 200) { - if (this.onInfo) { - this.onInfo({ statusCode, headers }) - } - return - } + this.set = set +} - const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers - const contentType = parsedHeaders['content-type'] - const body = new Readable({ resume, abort, contentType, highWaterMark }) +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 - this.callback = null - this.res = body - if (callback !== null) { - if (this.throwOnError && statusCode >= 400) { - this.runInAsyncScope(getResolveErrorBodyCallback, null, - { callback, body, contentType, statusCode, statusMessage, headers } - ) - } else { - this.runInAsyncScope(callback, null, null, { - statusCode, - headers, - trailers: this.trailers, - opaque, - body, - context - }) - } - } - } + if (options.nonegate) return - onData (chunk) { - const { res } = this - return res.push(chunk) + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ } - onComplete (trailers) { - const { res } = this + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} - removeSignal(this) +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} - util.parseHeaders(trailers, this.trailers) +Minimatch.prototype.braceExpand = braceExpand - res.push(null) +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } } - onError (err) { - const { res, callback, body, opaque } = this - - removeSignal(this) - - if (callback) { - // TODO: Does this need queueMicrotask? - this.callback = null - queueMicrotask(() => { - this.runInAsyncScope(callback, null, err, { opaque }) - }) - } + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern - if (res) { - this.res = null - // Ensure all queued handlers are invoked before destroying res. - queueMicrotask(() => { - util.destroy(res, err) - }) - } + assertValidPattern(pattern) - if (body) { - this.body = null - util.destroy(body, err) - } + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] } + + return expand(pattern) } -function request (opts, callback) { - if (callback === undefined) { - return new Promise((resolve, reject) => { - request.call(this, opts, (err, data) => { - return err ? reject(err) : resolve(data) - }) - }) +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') } - try { - this.dispatch(opts, new RequestHandler(opts, callback)) - } catch (err) { - if (typeof callback !== 'function') { - throw err - } - const opaque = opts && opts.opaque - queueMicrotask(() => callback(err, { opaque })) + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') } } -module.exports = request -module.exports.RequestHandler = RequestHandler - - -/***/ }), - -/***/ 75395: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const { finished, PassThrough } = __nccwpck_require__(12781) -const { - InvalidArgumentError, - InvalidReturnValueError, - RequestAbortedError -} = __nccwpck_require__(48045) -const util = __nccwpck_require__(83983) -const { getResolveErrorBodyCallback } = __nccwpck_require__(77474) -const { AsyncResource } = __nccwpck_require__(50852) -const { addSignal, removeSignal } = __nccwpck_require__(7032) - -class StreamHandler extends AsyncResource { - constructor (opts, factory, callback) { - if (!opts || typeof opts !== 'object') { - throw new InvalidArgumentError('invalid opts') - } - - const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError } = opts - - try { - if (typeof callback !== 'function') { - throw new InvalidArgumentError('invalid callback') - } - - if (typeof factory !== 'function') { - throw new InvalidArgumentError('invalid factory') - } +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + assertValidPattern(pattern) - if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { - throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') - } + var options = this.options - if (method === 'CONNECT') { - throw new InvalidArgumentError('invalid method') - } + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' - if (onInfo && typeof onInfo !== 'function') { - throw new InvalidArgumentError('invalid onInfo callback') - } + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this - super('UNDICI_STREAM') - } catch (err) { - if (util.isStream(body)) { - util.destroy(body.on('error', util.nop), err) + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break } - throw err + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false } + } - this.responseHeaders = responseHeaders || null - this.opaque = opaque || null - this.factory = factory - this.callback = callback - this.res = null - this.abort = null - this.context = null - this.trailers = null - this.body = body - this.onInfo = onInfo || null - this.throwOnError = throwOnError || false + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) - if (util.isStream(body)) { - body.on('error', (err) => { - this.onError(err) - }) + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue } - addSignal(this, signal) - } + switch (c) { + /* istanbul ignore next */ + case '/': { + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + } - onConnect (abort, context) { - if (!this.callback) { - throw new RequestAbortedError() - } + case '\\': + clearStateChar() + escaping = true + continue - this.abort = abort - this.context = context - } + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - onHeaders (statusCode, rawHeaders, resume, statusMessage) { - const { factory, opaque, context, callback, responseHeaders } = this + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } - const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue - if (statusCode < 200) { - if (this.onInfo) { - this.onInfo({ statusCode, headers }) - } - return - } + case '(': + if (inClass) { + re += '(' + continue + } - this.factory = null + if (!stateChar) { + re += '\\(' + continue + } - let res + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue - if (this.throwOnError && statusCode >= 400) { - const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers - const contentType = parsedHeaders['content-type'] - res = new PassThrough() + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } - this.callback = null - this.runInAsyncScope(getResolveErrorBodyCallback, null, - { callback, body: res, contentType, statusCode, statusMessage, headers } - ) - } else { - if (factory === null) { - return - } + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue - res = this.runInAsyncScope(factory, null, { - statusCode, - headers, - opaque, - context - }) + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } - if ( - !res || - typeof res.write !== 'function' || - typeof res.end !== 'function' || - typeof res.on !== 'function' - ) { - throw new InvalidReturnValueError('expected Writable') - } + clearStateChar() + re += '|' + continue - // TODO: Avoid finished. It registers an unnecessary amount of listeners. - finished(res, { readable: false }, (err) => { - const { callback, res, opaque, trailers, abort } = this + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() - this.res = null - if (err || !res.readable) { - util.destroy(res, err) + if (inClass) { + re += '\\' + c + continue } - this.callback = null - this.runInAsyncScope(callback, null, err || null, { opaque, trailers }) + inClass = true + classStart = i + reClassStart = re.length + re += c + continue - if (err) { - abort() + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue } - }) - } - res.on('drain', resume) + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } - this.res = res + // finish up the class. + hasMagic = true + inClass = false + re += c + continue - const needDrain = res.writableNeedDrain !== undefined - ? res.writableNeedDrain - : res._writableState && res._writableState.needDrain + default: + // swallow any state char that wasn't consumed + clearStateChar() - return needDrain !== true - } + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } - onData (chunk) { - const { res } = this + re += c - return res ? res.write(chunk) : true + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] } - onComplete (trailers) { - const { res } = this + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } - removeSignal(this) + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) - if (!res) { - return - } + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type - this.trailers = util.parseHeaders(trailers) + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } - res.end() + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' } - onError (err) { - const { res, callback, opaque, body } = this + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '[': case '.': case '(': addPatternStart = true + } - removeSignal(this) + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] - this.factory = null + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) - if (res) { - this.res = null - util.destroy(res, err) - } else if (callback) { - this.callback = null - queueMicrotask(() => { - this.runInAsyncScope(callback, null, err, { opaque }) - }) + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') } + nlAfter = cleanAfter - if (body) { - this.body = null - util.destroy(body, err) + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe } -} -function stream (opts, factory, callback) { - if (callback === undefined) { - return new Promise((resolve, reject) => { - stream.call(this, opts, factory, (err, data) => { - return err ? reject(err) : resolve(data) - }) - }) + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re } - try { - this.dispatch(opts, new StreamHandler(opts, factory, callback)) - } catch (err) { - if (typeof callback !== 'function') { - throw err - } - const opaque = opts && opts.opaque - queueMicrotask(() => callback(err, { opaque })) + if (addPatternStart) { + re = patternStart + re } -} - -module.exports = stream - -/***/ }), + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } -/***/ 36923: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } -"use strict"; + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + regExp._glob = pattern + regExp._src = re -const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(48045) -const { AsyncResource } = __nccwpck_require__(50852) -const util = __nccwpck_require__(83983) -const { addSignal, removeSignal } = __nccwpck_require__(7032) -const assert = __nccwpck_require__(39491) + return regExp +} -class UpgradeHandler extends AsyncResource { - constructor (opts, callback) { - if (!opts || typeof opts !== 'object') { - throw new InvalidArgumentError('invalid opts') - } +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} - if (typeof callback !== 'function') { - throw new InvalidArgumentError('invalid callback') - } +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp - const { signal, opaque, responseHeaders } = opts + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set - if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { - throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') - } + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options - super('UNDICI_UPGRADE') + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' - this.responseHeaders = responseHeaders || null - this.opaque = opaque || null - this.callback = callback - this.abort = null - this.context = null + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') - addSignal(this, signal) - } + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' - onConnect (abort, context) { - if (!this.callback) { - throw new RequestAbortedError() - } + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' - this.abort = abort - this.context = null + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false } + return this.regexp +} - onHeaders () { - throw new SocketError('bad upgrade', null) +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) } + return list +} - onUpgrade (statusCode, rawHeaders, socket) { - const { callback, opaque, context } = this +Minimatch.prototype.match = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.partial + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' - assert.strictEqual(statusCode, 101) + if (f === '/' && partial) return true - removeSignal(this) + var options = this.options - this.callback = null - const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) - this.runInAsyncScope(callback, null, null, { - headers, - socket, - opaque, - context - }) + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') } - onError (err) { - const { callback, opaque } = this + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) - removeSignal(this) + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. - if (callback) { - this.callback = null - queueMicrotask(() => { - this.runInAsyncScope(callback, null, err, { opaque }) - }) - } - } -} + var set = this.set + this.debug(this.pattern, 'set', set) -function upgrade (opts, callback) { - if (callback === undefined) { - return new Promise((resolve, reject) => { - upgrade.call(this, opts, (err, data) => { - return err ? reject(err) : resolve(data) - }) - }) + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break } - try { - const upgradeHandler = new UpgradeHandler(opts, callback) - this.dispatch({ - ...opts, - method: opts.method || 'GET', - upgrade: opts.protocol || 'Websocket' - }, upgradeHandler) - } catch (err) { - if (typeof callback !== 'function') { - throw err + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate } - const opaque = opts && opts.opaque - queueMicrotask(() => callback(err, { opaque })) } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate } -module.exports = upgrade +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) -/***/ }), + this.debug('matchOne', file.length, pattern.length) -/***/ 44059: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] -"use strict"; + this.debug(pattern, p, f) + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false -module.exports.request = __nccwpck_require__(55448) -module.exports.stream = __nccwpck_require__(75395) -module.exports.pipeline = __nccwpck_require__(28752) -module.exports.upgrade = __nccwpck_require__(36923) -module.exports.connect = __nccwpck_require__(29744) + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } -/***/ }), + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] -/***/ 73858: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) -"use strict"; -// Ported from https://github.com/nodejs/undici/pull/907 + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } -const assert = __nccwpck_require__(39491) -const { Readable } = __nccwpck_require__(12781) -const { RequestAbortedError, NotSupportedError, InvalidArgumentError } = __nccwpck_require__(48045) -const util = __nccwpck_require__(83983) -const { ReadableStreamFrom, toUSVString } = __nccwpck_require__(83983) + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } -let Blob + if (!hit) return false + } -const kConsume = Symbol('kConsume') -const kReading = Symbol('kReading') -const kBody = Symbol('kBody') -const kAbort = Symbol('abort') -const kContentType = Symbol('kContentType') + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* -const noop = () => {} + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } -module.exports = class BodyReadable extends Readable { - constructor ({ - resume, - abort, - contentType = '', - highWaterMark = 64 * 1024 // Same as nodejs fs streams. - }) { - super({ - autoDestroy: true, - read: resume, - highWaterMark - }) + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') +} - this._readableState.dataEmitted = false +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} - this[kAbort] = abort - this[kConsume] = null - this[kBody] = null - this[kContentType] = contentType +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} - // Is stream being consumed through Readable API? - // This is an optimization so that we avoid checking - // for 'data' and 'readable' listeners in the hot path - // inside push(). - this[kReading] = false - } - destroy (err) { - if (this.destroyed) { - // Node < 16 - return this - } +/***/ }), - if (!err && !this._readableState.endEmitted) { - err = new RequestAbortedError() - } +/***/ 80900: +/***/ ((module) => { - if (err) { - this[kAbort]() - } +/** + * Helpers. + */ - return super.destroy(err) - } +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; - emit (ev, ...args) { - if (ev === 'data') { - // Node < 16.7 - this._readableState.dataEmitted = true - } else if (ev === 'error') { - // Node < 16 - this._readableState.errorEmitted = true - } - return super.emit(ev, ...args) - } +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ - on (ev, ...args) { - if (ev === 'data' || ev === 'readable') { - this[kReading] = true - } - return super.on(ev, ...args) +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; - addListener (ev, ...args) { - return this.on(ev, ...args) - } +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ - off (ev, ...args) { - const ret = super.off(ev, ...args) - if (ev === 'data' || ev === 'readable') { - this[kReading] = ( - this.listenerCount('data') > 0 || - this.listenerCount('readable') > 0 - ) - } - return ret +function parse(str) { + str = String(str); + if (str.length > 100) { + return; } - - removeListener (ev, ...args) { - return this.off(ev, ...args) + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; } - - push (chunk) { - if (this[kConsume] && chunk !== null && this.readableLength === 0) { - consumePush(this[kConsume], chunk) - return this[kReading] ? super.push(chunk) : true - } - return super.push(chunk) + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; } +} - // https://fetch.spec.whatwg.org/#dom-body-text - async text () { - return consume(this, 'text') - } +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - // https://fetch.spec.whatwg.org/#dom-body-json - async json () { - return consume(this, 'json') +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; } - - // https://fetch.spec.whatwg.org/#dom-body-blob - async blob () { - return consume(this, 'blob') + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; } - - // https://fetch.spec.whatwg.org/#dom-body-arraybuffer - async arrayBuffer () { - return consume(this, 'arrayBuffer') + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; } - - // https://fetch.spec.whatwg.org/#dom-body-formdata - async formData () { - // TODO: Implement. - throw new NotSupportedError() + if (msAbs >= s) { + return Math.round(ms / s) + 's'; } + return ms + 'ms'; +} - // https://fetch.spec.whatwg.org/#dom-body-bodyused - get bodyUsed () { - return util.isDisturbed(this) - } +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - // https://fetch.spec.whatwg.org/#dom-body-body - get body () { - if (!this[kBody]) { - this[kBody] = ReadableStreamFrom(this) - if (this[kConsume]) { - // TODO: Is this the best way to force a lock? - this[kBody].getReader() // Ensure stream is locked. - assert(this[kBody].locked) - } - } - return this[kBody] +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); } - - dump (opts) { - let limit = opts && Number.isFinite(opts.limit) ? opts.limit : 262144 - const signal = opts && opts.signal - - if (signal) { - try { - if (typeof signal !== 'object' || !('aborted' in signal)) { - throw new InvalidArgumentError('signal must be an AbortSignal') - } - util.throwIfAborted(signal) - } catch (err) { - return Promise.reject(err) - } - } - - if (this.closed) { - return Promise.resolve(null) - } - - return new Promise((resolve, reject) => { - const signalListenerCleanup = signal - ? util.addAbortListener(signal, () => { - this.destroy() - }) - : noop - - this - .on('close', function () { - signalListenerCleanup() - if (signal && signal.aborted) { - reject(signal.reason || Object.assign(new Error('The operation was aborted'), { name: 'AbortError' })) - } else { - resolve(null) - } - }) - .on('error', noop) - .on('data', function (chunk) { - limit -= chunk.length - if (limit <= 0) { - this.destroy() - } - }) - .resume() - }) + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); } + return ms + ' ms'; } -// https://streams.spec.whatwg.org/#readablestream-locked -function isLocked (self) { - // Consume is an implicit lock. - return (self[kBody] && self[kBody].locked === true) || self[kConsume] -} +/** + * Pluralization helper. + */ -// https://fetch.spec.whatwg.org/#body-unusable -function isUnusable (self) { - return util.isDisturbed(self) || isLocked(self) +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); } -async function consume (stream, type) { - if (isUnusable(stream)) { - throw new TypeError('unusable') + +/***/ }), + +/***/ 91532: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY } - assert(!stream[kConsume]) + constructor (comp, options) { + options = parseOptions(options) - return new Promise((resolve, reject) => { - stream[kConsume] = { - type, - stream, - resolve, - reject, - length: 0, - body: [] + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } } - stream - .on('error', function (err) { - consumeFinish(this[kConsume], err) - }) - .on('close', function () { - if (this[kConsume].body !== null) { - consumeFinish(this[kConsume], new RequestAbortedError()) - } - }) + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) - process.nextTick(consumeStart, stream[kConsume]) - }) -} + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } -function consumeStart (consume) { - if (consume.body === null) { - return + debug('comp', this) } - const { _readableState: state } = consume.stream + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) - for (const chunk of state.buffer) { - consumePush(consume, chunk) - } + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } - if (state.endEmitted) { - consumeEnd(this[kConsume]) - } else { - consume.stream.on('end', function () { - consumeEnd(this[kConsume]) - }) - } + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } - consume.stream.resume() + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } - while (consume.stream.read() != null) { - // Loop + toString () { + return this.value } -} -function consumeEnd (consume) { - const { type, body, resolve, stream, length } = consume + test (version) { + debug('Comparator.test', version, this.options.loose) - try { - if (type === 'text') { - resolve(toUSVString(Buffer.concat(body))) - } else if (type === 'json') { - resolve(JSON.parse(Buffer.concat(body))) - } else if (type === 'arrayBuffer') { - const dst = new Uint8Array(length) + if (this.semver === ANY || version === ANY) { + return true + } - let pos = 0 - for (const buf of body) { - dst.set(buf, pos) - pos += buf.byteLength + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false } + } - resolve(dst.buffer) - } else if (type === 'blob') { - if (!Blob) { - Blob = (__nccwpck_require__(14300).Blob) + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (this.operator === '') { + if (this.value === '') { + return true } - resolve(new Blob(body, { type: stream[kContentType] })) + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) } - consumeFinish(consume) - } catch (err) { - stream.destroy(err) - } -} + options = parseOptions(options) -function consumePush (consume, chunk) { - consume.length += chunk.length - consume.body.push(chunk) -} + // Special cases where nothing can possibly be lower + if (options.includePrerelease && + (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { + return false + } + if (!options.includePrerelease && + (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { + return false + } -function consumeFinish (consume, err) { - if (consume.body === null) { - return + // Same direction increasing (> or >=) + if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { + return true + } + // Same direction decreasing (< or <=) + if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { + return true + } + // same SemVer and both sides are inclusive (<= or >=) + if ( + (this.semver.version === comp.semver.version) && + this.operator.includes('=') && comp.operator.includes('=')) { + return true + } + // opposite directions less than + if (cmp(this.semver, '<', comp.semver, options) && + this.operator.startsWith('>') && comp.operator.startsWith('<')) { + return true + } + // opposite directions greater than + if (cmp(this.semver, '>', comp.semver, options) && + this.operator.startsWith('<') && comp.operator.startsWith('>')) { + return true + } + return false } +} - if (err) { - consume.reject(err) - } else { - consume.resolve() - } +module.exports = Comparator - consume.type = null - consume.stream = null - consume.resolve = null - consume.reject = null - consume.length = 0 - consume.body = null -} +const parseOptions = __nccwpck_require__(40785) +const { safeRe: re, t } = __nccwpck_require__(9523) +const cmp = __nccwpck_require__(75098) +const debug = __nccwpck_require__(50427) +const SemVer = __nccwpck_require__(48088) +const Range = __nccwpck_require__(9828) /***/ }), -/***/ 77474: +/***/ 9828: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const assert = __nccwpck_require__(39491) -const { - ResponseStatusCodeError -} = __nccwpck_require__(48045) -const { toUSVString } = __nccwpck_require__(83983) - -async function getResolveErrorBodyCallback ({ callback, body, contentType, statusCode, statusMessage, headers }) { - assert(body) +const SPACE_CHARACTERS = /\s+/g - let chunks = [] - let limit = 0 +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + options = parseOptions(options) - for await (const chunk of body) { - chunks.push(chunk) - limit += chunk.length - if (limit > 128 * 1024) { - chunks = null - break + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } } - } - - if (statusCode === 204 || !contentType || !chunks) { - process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers)) - return - } - try { - if (contentType.startsWith('application/json')) { - const payload = JSON.parse(toUSVString(Buffer.concat(chunks))) - process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload)) - return + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.formatted = undefined + return this } - if (contentType.startsWith('text/')) { - const payload = toUSVString(Buffer.concat(chunks)) - process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload)) - return - } - } catch (err) { - // Process in a fallback if error - } + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease - process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers)) -} + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range.trim().replace(SPACE_CHARACTERS, ' ') -module.exports = { getResolveErrorBodyCallback } + // First, split on || + this.set = this.raw + .split('||') + // map the range to a 2d array of comparators + .map(r => this.parseRange(r.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`) + } -/***/ }), + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0] + this.set = this.set.filter(c => !isNullSet(c[0])) + if (this.set.length === 0) { + this.set = [first] + } else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c] + break + } + } + } + } -/***/ 37931: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + this.formatted = undefined + } -"use strict"; + get range () { + if (this.formatted === undefined) { + this.formatted = '' + for (let i = 0; i < this.set.length; i++) { + if (i > 0) { + this.formatted += '||' + } + const comps = this.set[i] + for (let k = 0; k < comps.length; k++) { + if (k > 0) { + this.formatted += ' ' + } + this.formatted += comps[k].toString().trim() + } + } + } + return this.formatted + } + format () { + return this.range + } -const { - BalancedPoolMissingUpstreamError, - InvalidArgumentError -} = __nccwpck_require__(48045) -const { - PoolBase, - kClients, - kNeedDrain, - kAddClient, - kRemoveClient, - kGetDispatcher -} = __nccwpck_require__(73198) -const Pool = __nccwpck_require__(4634) -const { kUrl, kInterceptors } = __nccwpck_require__(72785) -const { parseOrigin } = __nccwpck_require__(83983) -const kFactory = Symbol('factory') + toString () { + return this.range + } -const kOptions = Symbol('options') -const kGreatestCommonDivisor = Symbol('kGreatestCommonDivisor') -const kCurrentWeight = Symbol('kCurrentWeight') -const kIndex = Symbol('kIndex') -const kWeight = Symbol('kWeight') -const kMaxWeightPerServer = Symbol('kMaxWeightPerServer') -const kErrorPenalty = Symbol('kErrorPenalty') + parseRange (range) { + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = + (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | + (this.options.loose && FLAG_LOOSE) + const memoKey = memoOpts + ':' + range + const cached = cache.get(memoKey) + if (cached) { + return cached + } -function getGreatestCommonDivisor (a, b) { - if (b === 0) return a - return getGreatestCommonDivisor(b, a % b) -} + const loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) -function defaultFactory (origin, opts) { - return new Pool(origin, opts) -} + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range) -class BalancedPool extends PoolBase { - constructor (upstreams = [], { factory = defaultFactory, ...opts } = {}) { - super() + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + debug('tilde trim', range) - this[kOptions] = opts - this[kIndex] = -1 - this[kCurrentWeight] = 0 + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + debug('caret trim', range) - this[kMaxWeightPerServer] = this[kOptions].maxWeightPerServer || 100 - this[kErrorPenalty] = this[kOptions].errorPenalty || 15 + // At this point, the range is completely trimmed and + // ready to be split into comparators. - if (!Array.isArray(upstreams)) { - upstreams = [upstreams] - } + let rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) - if (typeof factory !== 'function') { - throw new InvalidArgumentError('factory must be a function.') + if (loose) { + // in loose mode, throw out any that are not valid comparators + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) } + debug('range list', rangeList) - this[kInterceptors] = opts.interceptors && opts.interceptors.BalancedPool && Array.isArray(opts.interceptors.BalancedPool) - ? opts.interceptors.BalancedPool - : [] - this[kFactory] = factory - - for (const upstream of upstreams) { - this.addUpstream(upstream) + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + const rangeMap = new Map() + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp] + } + rangeMap.set(comp.value, comp) + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete('') } - this._updateBalancedPoolStats() - } - addUpstream (upstream) { - const upstreamOrigin = parseOrigin(upstream).origin + const result = [...rangeMap.values()] + cache.set(memoKey, result) + return result + } - if (this[kClients].find((pool) => ( - pool[kUrl].origin === upstreamOrigin && - pool.closed !== true && - pool.destroyed !== true - ))) { - return this + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') } - const pool = this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions])) - this[kAddClient](pool) - pool.on('connect', () => { - pool[kWeight] = Math.min(this[kMaxWeightPerServer], pool[kWeight] + this[kErrorPenalty]) + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) }) + } - pool.on('connectionError', () => { - pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) - this._updateBalancedPoolStats() - }) + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } - pool.on('disconnect', (...args) => { - const err = args[2] - if (err && err.code === 'UND_ERR_SOCKET') { - // decrease the weight of the pool. - pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) - this._updateBalancedPoolStats() + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false } - }) + } - for (const client of this[kClients]) { - client[kWeight] = this[kMaxWeightPerServer] + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } } + return false + } +} - this._updateBalancedPoolStats() +module.exports = Range - return this - } +const LRU = __nccwpck_require__(15339) +const cache = new LRU() - _updateBalancedPoolStats () { - this[kGreatestCommonDivisor] = this[kClients].map(p => p[kWeight]).reduce(getGreatestCommonDivisor, 0) - } +const parseOptions = __nccwpck_require__(40785) +const Comparator = __nccwpck_require__(91532) +const debug = __nccwpck_require__(50427) +const SemVer = __nccwpck_require__(48088) +const { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace, +} = __nccwpck_require__(9523) +const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __nccwpck_require__(42293) - removeUpstream (upstream) { - const upstreamOrigin = parseOrigin(upstream).origin +const isNullSet = c => c.value === '<0.0.0-0' +const isAny = c => c.value === '' - const pool = this[kClients].find((pool) => ( - pool[kUrl].origin === upstreamOrigin && - pool.closed !== true && - pool.destroyed !== true - )) +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() - if (pool) { - this[kRemoveClient](pool) - } + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) - return this + testComparator = remainingComparators.pop() } - get upstreams () { - return this[kClients] - .filter(dispatcher => dispatcher.closed !== true && dispatcher.destroyed !== true) - .map((p) => p[kUrl].origin) - } + return result +} - [kGetDispatcher] () { - // We validate that pools is greater than 0, - // otherwise we would have to wait until an upstream - // is added, which might never happen. - if (this[kClients].length === 0) { - throw new BalancedPoolMissingUpstreamError() - } +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} - const dispatcher = this[kClients].find(dispatcher => ( - !dispatcher[kNeedDrain] && - dispatcher.closed !== true && - dispatcher.destroyed !== true - )) +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' - if (!dispatcher) { - return - } +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +// ~0.0.1 --> >=0.0.1 <0.1.0-0 +const replaceTildes = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceTilde(c, options)) + .join(' ') +} - const allClientsBusy = this[kClients].map(pool => pool[kNeedDrain]).reduce((a, b) => a && b, true) +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret - if (allClientsBusy) { - return + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` } - let counter = 0 + debug('tilde return', ret) + return ret + }) +} - let maxWeightIndex = this[kClients].findIndex(pool => !pool[kNeedDrain]) +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +// ^0.0.1 --> >=0.0.1 <0.0.2-0 +// ^0.1.0 --> >=0.1.0 <0.2.0-0 +const replaceCarets = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceCaret(c, options)) + .join(' ') +} - while (counter++ < this[kClients].length) { - this[kIndex] = (this[kIndex] + 1) % this[kClients].length - const pool = this[kClients][this[kIndex]] +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret - // find pool index with the largest weight - if (pool[kWeight] > this[kClients][maxWeightIndex][kWeight] && !pool[kNeedDrain]) { - maxWeightIndex = this[kIndex] + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` } - - // decrease the current weight every `this[kClients].length`. - if (this[kIndex] === 0) { - // Set the current weight to the next lower weight. - this[kCurrentWeight] = this[kCurrentWeight] - this[kGreatestCommonDivisor] - - if (this[kCurrentWeight] <= 0) { - this[kCurrentWeight] = this[kMaxWeightPerServer] + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` } - if (pool[kWeight] >= this[kCurrentWeight] && (!pool[kNeedDrain])) { - return pool + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` } } - this[kCurrentWeight] = this[kClients][maxWeightIndex][kWeight] - this[kIndex] = maxWeightIndex - return this[kClients][maxWeightIndex] - } + debug('caret return', ret) + return ret + }) } -module.exports = BalancedPool - - -/***/ }), - -/***/ 66101: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp + .split(/\s+/) + .map((c) => replaceXRange(c, options)) + .join(' ') +} -"use strict"; +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + if (gtlt === '=' && anyX) { + gtlt = '' + } -const { kConstruct } = __nccwpck_require__(29174) -const { urlEquals, fieldValues: getFieldValues } = __nccwpck_require__(82396) -const { kEnumerableProperty, isDisturbed } = __nccwpck_require__(83983) -const { kHeadersList } = __nccwpck_require__(72785) -const { webidl } = __nccwpck_require__(21744) -const { Response, cloneResponse } = __nccwpck_require__(27823) -const { Request } = __nccwpck_require__(48359) -const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(15861) -const { fetching } = __nccwpck_require__(74881) -const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = __nccwpck_require__(52538) -const assert = __nccwpck_require__(39491) -const { getGlobalDispatcher } = __nccwpck_require__(21892) + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' -/** - * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation - * @typedef {Object} CacheBatchOperation - * @property {'delete' | 'put'} type - * @property {any} request - * @property {any} response - * @property {import('../../types/cache').CacheQueryOptions} options - */ + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 -/** - * @see https://w3c.github.io/ServiceWorker/#dfn-request-response-list - * @typedef {[any, any][]} requestResponseList - */ + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } -class Cache { - /** - * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-request-response-list - * @type {requestResponseList} - */ - #relevantRequestResponseList + if (gtlt === '<') { + pr = '-0' + } - constructor () { - if (arguments[0] !== kConstruct) { - webidl.illegalConstructor() + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` } - this.#relevantRequestResponseList = arguments[1] - } - - async match (request, options = {}) { - webidl.brandCheck(this, Cache) - webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.match' }) + debug('xRange return', ret) - request = webidl.converters.RequestInfo(request) - options = webidl.converters.CacheQueryOptions(options) + return ret + }) +} - const p = await this.matchAll(request, options) +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp + .trim() + .replace(re[t.STAR], '') +} - if (p.length === 0) { - return - } +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp + .trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} - return p[0] +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +// TODO build? +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` } - async matchAll (request = undefined, options = {}) { - webidl.brandCheck(this, Cache) - - if (request !== undefined) request = webidl.converters.RequestInfo(request) - options = webidl.converters.CacheQueryOptions(options) - - // 1. - let r = null + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } - // 2. - if (request !== undefined) { - if (request instanceof Request) { - // 2.1.1 - r = request[kState] + return `${from} ${to}`.trim() +} - // 2.1.2 - if (r.method !== 'GET' && !options.ignoreMethod) { - return [] - } - } else if (typeof request === 'string') { - // 2.2.1 - r = new Request(request)[kState] - } +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false } + } - // 5. - // 5.1 - const responses = [] - - // 5.2 - if (request === undefined) { - // 5.2.1 - for (const requestResponse of this.#relevantRequestResponseList) { - responses.push(requestResponse[1]) + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue } - } else { // 5.3 - // 5.3.1 - const requestResponses = this.#queryCache(r, options) - // 5.3.2 - for (const requestResponse of requestResponses) { - responses.push(requestResponse[1]) + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } } } - // 5.4 - // We don't implement CORs so we don't need to loop over the responses, yay! - - // 5.5.1 - const responseList = [] - - // 5.5.2 - for (const response of responses) { - // 5.5.2.1 - const responseObject = new Response(response.body?.source ?? null) - const body = responseObject[kState].body - responseObject[kState] = response - responseObject[kState].body = body - responseObject[kHeaders][kHeadersList] = response.headersList - responseObject[kHeaders][kGuard] = 'immutable' - - responseList.push(responseObject) - } - - // 6. - return Object.freeze(responseList) - } - - async add (request) { - webidl.brandCheck(this, Cache) - webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.add' }) - - request = webidl.converters.RequestInfo(request) - - // 1. - const requests = [request] - - // 2. - const responseArrayPromise = this.addAll(requests) - - // 3. - return await responseArrayPromise + // Version has a -pre, but it's not one of the ones we like. + return false } - async addAll (requests) { - webidl.brandCheck(this, Cache) - webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.addAll' }) + return true +} - requests = webidl.converters['sequence'](requests) - // 1. - const responsePromises = [] +/***/ }), - // 2. - const requestList = [] +/***/ 48088: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 3. - for (const request of requests) { - if (typeof request === 'string') { - continue - } +const debug = __nccwpck_require__(50427) +const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(42293) +const { safeRe: re, safeSrc: src, t } = __nccwpck_require__(9523) - // 3.1 - const r = request[kState] +const parseOptions = __nccwpck_require__(40785) +const { compareIdentifiers } = __nccwpck_require__(92463) +class SemVer { + constructor (version, options) { + options = parseOptions(options) - // 3.2 - if (!urlIsHttpHttpsScheme(r.url) || r.method !== 'GET') { - throw webidl.errors.exception({ - header: 'Cache.addAll', - message: 'Expected http/s scheme when method is not GET.' - }) + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) } - // 4. - /** @type {ReturnType[]} */ - const fetchControllers = [] + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } - // 5. - for (const request of requests) { - // 5.1 - const r = new Request(request)[kState] + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease - // 5.2 - if (!urlIsHttpHttpsScheme(r.url)) { - throw webidl.errors.exception({ - header: 'Cache.addAll', - message: 'Expected http/s scheme.' - }) - } + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) - // 5.4 - r.initiator = 'fetch' - r.destination = 'subresource' + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } - // 5.5 - requestList.push(r) + this.raw = version - // 5.6 - const responsePromise = createDeferredPromise() + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] - // 5.7 - fetchControllers.push(fetching({ - request: r, - dispatcher: getGlobalDispatcher(), - processResponse (response) { - // 1. - if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) { - responsePromise.reject(webidl.errors.exception({ - header: 'Cache.addAll', - message: 'Received an invalid status code or the request failed.' - })) - } else if (response.headersList.contains('vary')) { // 2. - // 2.1 - const fieldValues = getFieldValues(response.headersList.get('vary')) + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } - // 2.2 - for (const fieldValue of fieldValues) { - // 2.2.1 - if (fieldValue === '*') { - responsePromise.reject(webidl.errors.exception({ - header: 'Cache.addAll', - message: 'invalid vary field value' - })) + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } - for (const controller of fetchControllers) { - controller.abort() - } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } - return - } - } - } - }, - processResponseEndOfBody (response) { - // 1. - if (response.aborted) { - responsePromise.reject(new DOMException('aborted', 'AbortError')) - return + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num } - - // 2. - responsePromise.resolve(response) } - })) - - // 5.8 - responsePromises.push(responsePromise.promise) + return id + }) } - // 6. - const p = Promise.all(responsePromises) - - // 7. - const responses = await p + this.build = m[5] ? m[5].split('.') : [] + this.format() + } - // 7.1 - const operations = [] + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } - // 7.2 - let index = 0 + toString () { + return this.version + } - // 7.3 - for (const response of responses) { - // 7.3.1 - /** @type {CacheBatchOperation} */ - const operation = { - type: 'put', // 7.3.2 - request: requestList[index], // 7.3.3 - response // 7.3.4 + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 } + other = new SemVer(other, this.options) + } - operations.push(operation) // 7.3.5 + if (other.version === this.version) { + return 0 + } - index++ // 7.3.6 + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) } - // 7.5 - const cacheJobPromise = createDeferredPromise() + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } - // 7.6.1 - let errorData = null + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } - // 7.6.2 - try { - this.#batchCacheOperations(operations) - } catch (e) { - errorData = e + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 } - // 7.6.3 - queueMicrotask(() => { - // 7.6.3.1 - if (errorData === null) { - cacheJobPromise.resolve(undefined) + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue } else { - // 7.6.3.2 - cacheJobPromise.reject(errorData) + return compareIdentifiers(a, b) } - }) - - // 7.7 - return cacheJobPromise.promise + } while (++i) } - async put (request, response) { - webidl.brandCheck(this, Cache) - webidl.argumentLengthCheck(arguments, 2, { header: 'Cache.put' }) - - request = webidl.converters.RequestInfo(request) - response = webidl.converters.Response(response) + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } - // 1. - let innerRequest = null - - // 2. - if (request instanceof Request) { - innerRequest = request[kState] - } else { // 3. - innerRequest = new Request(request)[kState] - } + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('build compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } - // 4. - if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== 'GET') { - throw webidl.errors.exception({ - header: 'Cache.put', - message: 'Expected an http/s scheme when method is not GET' - }) + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier, identifierBase) { + if (release.startsWith('pre')) { + if (!identifier && identifierBase === false) { + throw new Error('invalid increment argument: identifier is empty') + } + // Avoid an invalid semver results + if (identifier) { + const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`) + const match = `-${identifier}`.match(r) + if (!match || match[1] !== identifier) { + throw new Error(`invalid identifier: ${identifier}`) + } + } } - // 5. - const innerResponse = response[kState] - - // 6. - if (innerResponse.status === 206) { - throw webidl.errors.exception({ - header: 'Cache.put', - message: 'Got 206 status' - }) - } + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier, identifierBase) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier, identifierBase) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier, identifierBase) + this.inc('pre', identifier, identifierBase) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier, identifierBase) + } + this.inc('pre', identifier, identifierBase) + break + case 'release': + if (this.prerelease.length === 0) { + throw new Error(`version ${this.raw} is not a prerelease`) + } + this.prerelease.length = 0 + break - // 7. - if (innerResponse.headersList.contains('vary')) { - // 7.1. - const fieldValues = getFieldValues(innerResponse.headersList.get('vary')) + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': { + const base = Number(identifierBase) ? 1 : 0 - // 7.2. - for (const fieldValue of fieldValues) { - // 7.2.1 - if (fieldValue === '*') { - throw webidl.errors.exception({ - header: 'Cache.put', - message: 'Got * vary field value' - }) + if (this.prerelease.length === 0) { + this.prerelease = [base] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + if (identifier === this.prerelease.join('.') && identifierBase === false) { + throw new Error('invalid increment argument: identifier already exists') + } + this.prerelease.push(base) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + let prerelease = [identifier, base] + if (identifierBase === false) { + prerelease = [identifier] + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease + } + } else { + this.prerelease = prerelease + } } + break } + default: + throw new Error(`invalid increment argument: ${release}`) } - - // 8. - if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) { - throw webidl.errors.exception({ - header: 'Cache.put', - message: 'Response body is locked or disturbed' - }) + this.raw = this.format() + if (this.build.length) { + this.raw += `+${this.build.join('.')}` } + return this + } +} - // 9. - const clonedResponse = cloneResponse(innerResponse) - - // 10. - const bodyReadPromise = createDeferredPromise() +module.exports = SemVer - // 11. - if (innerResponse.body != null) { - // 11.1 - const stream = innerResponse.body.stream - // 11.2 - const reader = stream.getReader() +/***/ }), - // 11.3 - readAllBytes(reader).then(bodyReadPromise.resolve, bodyReadPromise.reject) - } else { - bodyReadPromise.resolve(undefined) - } +/***/ 48848: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 12. - /** @type {CacheBatchOperation[]} */ - const operations = [] +const parse = __nccwpck_require__(75925) +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean - // 13. - /** @type {CacheBatchOperation} */ - const operation = { - type: 'put', // 14. - request: innerRequest, // 15. - response: clonedResponse // 16. - } - // 17. - operations.push(operation) +/***/ }), - // 19. - const bytes = await bodyReadPromise.promise +/***/ 75098: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (clonedResponse.body != null) { - clonedResponse.body.source = bytes - } +const eq = __nccwpck_require__(91898) +const neq = __nccwpck_require__(6017) +const gt = __nccwpck_require__(84123) +const gte = __nccwpck_require__(15522) +const lt = __nccwpck_require__(80194) +const lte = __nccwpck_require__(77520) - // 19.1 - const cacheJobPromise = createDeferredPromise() +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a === b - // 19.2.1 - let errorData = null + case '!==': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a !== b - // 19.2.2 - try { - this.#batchCacheOperations(operations) - } catch (e) { - errorData = e - } + case '': + case '=': + case '==': + return eq(a, b, loose) - // 19.2.3 - queueMicrotask(() => { - // 19.2.3.1 - if (errorData === null) { - cacheJobPromise.resolve() - } else { // 19.2.3.2 - cacheJobPromise.reject(errorData) - } - }) + case '!=': + return neq(a, b, loose) - return cacheJobPromise.promise - } + case '>': + return gt(a, b, loose) - async delete (request, options = {}) { - webidl.brandCheck(this, Cache) - webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.delete' }) + case '>=': + return gte(a, b, loose) - request = webidl.converters.RequestInfo(request) - options = webidl.converters.CacheQueryOptions(options) + case '<': + return lt(a, b, loose) - /** - * @type {Request} - */ - let r = null + case '<=': + return lte(a, b, loose) - if (request instanceof Request) { - r = request[kState] + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp - if (r.method !== 'GET' && !options.ignoreMethod) { - return false - } - } else { - assert(typeof request === 'string') - r = new Request(request)[kState] - } +/***/ }), - /** @type {CacheBatchOperation[]} */ - const operations = [] +/***/ 13466: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - /** @type {CacheBatchOperation} */ - const operation = { - type: 'delete', - request: r, - options - } +const SemVer = __nccwpck_require__(48088) +const parse = __nccwpck_require__(75925) +const { safeRe: re, t } = __nccwpck_require__(9523) - operations.push(operation) +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } - const cacheJobPromise = createDeferredPromise() + if (typeof version === 'number') { + version = String(version) + } - let errorData = null - let requestResponses + if (typeof version !== 'string') { + return null + } - try { - requestResponses = this.#batchCacheOperations(operations) - } catch (e) { - errorData = e - } + options = options || {} - queueMicrotask(() => { - if (errorData === null) { - cacheJobPromise.resolve(!!requestResponses?.length) - } else { - cacheJobPromise.reject(errorData) + let match = null + if (!options.rtl) { + match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] + let next + while ((next = coerceRtlRegex.exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next } - }) + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + coerceRtlRegex.lastIndex = -1 + } - return cacheJobPromise.promise + if (match === null) { + return null } - /** - * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys - * @param {any} request - * @param {import('../../types/cache').CacheQueryOptions} options - * @returns {readonly Request[]} - */ - async keys (request = undefined, options = {}) { - webidl.brandCheck(this, Cache) + const major = match[2] + const minor = match[3] || '0' + const patch = match[4] || '0' + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' + const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' - if (request !== undefined) request = webidl.converters.RequestInfo(request) - options = webidl.converters.CacheQueryOptions(options) + return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) +} +module.exports = coerce - // 1. - let r = null - // 2. - if (request !== undefined) { - // 2.1 - if (request instanceof Request) { - // 2.1.1 - r = request[kState] +/***/ }), - // 2.1.2 - if (r.method !== 'GET' && !options.ignoreMethod) { - return [] - } - } else if (typeof request === 'string') { // 2.2 - r = new Request(request)[kState] - } - } +/***/ 92156: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 4. - const promise = createDeferredPromise() +const SemVer = __nccwpck_require__(48088) +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild - // 5. - // 5.1 - const requests = [] - // 5.2 - if (request === undefined) { - // 5.2.1 - for (const requestResponse of this.#relevantRequestResponseList) { - // 5.2.1.1 - requests.push(requestResponse[0]) - } - } else { // 5.3 - // 5.3.1 - const requestResponses = this.#queryCache(r, options) +/***/ }), - // 5.3.2 - for (const requestResponse of requestResponses) { - // 5.3.2.1 - requests.push(requestResponse[0]) - } - } +/***/ 62804: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 5.4 - queueMicrotask(() => { - // 5.4.1 - const requestList = [] +const compare = __nccwpck_require__(44309) +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose - // 5.4.2 - for (const request of requests) { - const requestObject = new Request('https://a') - requestObject[kState] = request - requestObject[kHeaders][kHeadersList] = request.headersList - requestObject[kHeaders][kGuard] = 'immutable' - requestObject[kRealm] = request.client - // 5.4.2.1 - requestList.push(requestObject) - } +/***/ }), - // 5.4.3 - promise.resolve(Object.freeze(requestList)) - }) +/***/ 44309: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - return promise.promise - } +const SemVer = __nccwpck_require__(48088) +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) - /** - * @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm - * @param {CacheBatchOperation[]} operations - * @returns {requestResponseList} - */ - #batchCacheOperations (operations) { - // 1. - const cache = this.#relevantRequestResponseList +module.exports = compare - // 2. - const backupCache = [...cache] - // 3. - const addedItems = [] +/***/ }), - // 4.1 - const resultList = [] +/***/ 64297: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - try { - // 4.2 - for (const operation of operations) { - // 4.2.1 - if (operation.type !== 'delete' && operation.type !== 'put') { - throw webidl.errors.exception({ - header: 'Cache.#batchCacheOperations', - message: 'operation type does not match "delete" or "put"' - }) - } - - // 4.2.2 - if (operation.type === 'delete' && operation.response != null) { - throw webidl.errors.exception({ - header: 'Cache.#batchCacheOperations', - message: 'delete operation should not have an associated response' - }) - } +const parse = __nccwpck_require__(75925) - // 4.2.3 - if (this.#queryCache(operation.request, operation.options, addedItems).length) { - throw new DOMException('???', 'InvalidStateError') - } +const diff = (version1, version2) => { + const v1 = parse(version1, null, true) + const v2 = parse(version2, null, true) + const comparison = v1.compare(v2) - // 4.2.4 - let requestResponses + if (comparison === 0) { + return null + } - // 4.2.5 - if (operation.type === 'delete') { - // 4.2.5.1 - requestResponses = this.#queryCache(operation.request, operation.options) + const v1Higher = comparison > 0 + const highVersion = v1Higher ? v1 : v2 + const lowVersion = v1Higher ? v2 : v1 + const highHasPre = !!highVersion.prerelease.length + const lowHasPre = !!lowVersion.prerelease.length - // TODO: the spec is wrong, this is needed to pass WPTs - if (requestResponses.length === 0) { - return [] - } + if (lowHasPre && !highHasPre) { + // Going from prerelease -> no prerelease requires some special casing - // 4.2.5.2 - for (const requestResponse of requestResponses) { - const idx = cache.indexOf(requestResponse) - assert(idx !== -1) + // If the low version has only a major, then it will always be a major + // Some examples: + // 1.0.0-1 -> 1.0.0 + // 1.0.0-1 -> 1.1.1 + // 1.0.0-1 -> 2.0.0 + if (!lowVersion.patch && !lowVersion.minor) { + return 'major' + } - // 4.2.5.2.1 - cache.splice(idx, 1) - } - } else if (operation.type === 'put') { // 4.2.6 - // 4.2.6.1 - if (operation.response == null) { - throw webidl.errors.exception({ - header: 'Cache.#batchCacheOperations', - message: 'put operation should have an associated response' - }) - } + // If the main part has no difference + if (lowVersion.compareMain(highVersion) === 0) { + if (lowVersion.minor && !lowVersion.patch) { + return 'minor' + } + return 'patch' + } + } - // 4.2.6.2 - const r = operation.request + // add the `pre` prefix if we are going to a prerelease version + const prefix = highHasPre ? 'pre' : '' - // 4.2.6.3 - if (!urlIsHttpHttpsScheme(r.url)) { - throw webidl.errors.exception({ - header: 'Cache.#batchCacheOperations', - message: 'expected http or https scheme' - }) - } + if (v1.major !== v2.major) { + return prefix + 'major' + } - // 4.2.6.4 - if (r.method !== 'GET') { - throw webidl.errors.exception({ - header: 'Cache.#batchCacheOperations', - message: 'not get method' - }) - } + if (v1.minor !== v2.minor) { + return prefix + 'minor' + } - // 4.2.6.5 - if (operation.options != null) { - throw webidl.errors.exception({ - header: 'Cache.#batchCacheOperations', - message: 'options must not be defined' - }) - } + if (v1.patch !== v2.patch) { + return prefix + 'patch' + } - // 4.2.6.6 - requestResponses = this.#queryCache(operation.request) + // high and low are preleases + return 'prerelease' +} - // 4.2.6.7 - for (const requestResponse of requestResponses) { - const idx = cache.indexOf(requestResponse) - assert(idx !== -1) +module.exports = diff - // 4.2.6.7.1 - cache.splice(idx, 1) - } - // 4.2.6.8 - cache.push([operation.request, operation.response]) +/***/ }), - // 4.2.6.10 - addedItems.push([operation.request, operation.response]) - } +/***/ 91898: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 4.2.7 - resultList.push([operation.request, operation.response]) - } +const compare = __nccwpck_require__(44309) +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq - // 4.3 - return resultList - } catch (e) { // 5. - // 5.1 - this.#relevantRequestResponseList.length = 0 - // 5.2 - this.#relevantRequestResponseList = backupCache +/***/ }), - // 5.3 - throw e - } - } +/***/ 84123: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - /** - * @see https://w3c.github.io/ServiceWorker/#query-cache - * @param {any} requestQuery - * @param {import('../../types/cache').CacheQueryOptions} options - * @param {requestResponseList} targetStorage - * @returns {requestResponseList} - */ - #queryCache (requestQuery, options, targetStorage) { - /** @type {requestResponseList} */ - const resultList = [] +const compare = __nccwpck_require__(44309) +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt - const storage = targetStorage ?? this.#relevantRequestResponseList - for (const requestResponse of storage) { - const [cachedRequest, cachedResponse] = requestResponse - if (this.#requestMatchesCachedItem(requestQuery, cachedRequest, cachedResponse, options)) { - resultList.push(requestResponse) - } - } +/***/ }), - return resultList - } +/***/ 15522: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - /** - * @see https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm - * @param {any} requestQuery - * @param {any} request - * @param {any | null} response - * @param {import('../../types/cache').CacheQueryOptions | undefined} options - * @returns {boolean} - */ - #requestMatchesCachedItem (requestQuery, request, response = null, options) { - // if (options?.ignoreMethod === false && request.method === 'GET') { - // return false - // } +const compare = __nccwpck_require__(44309) +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte - const queryURL = new URL(requestQuery.url) - const cachedURL = new URL(request.url) +/***/ }), - if (options?.ignoreSearch) { - cachedURL.search = '' +/***/ 30900: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - queryURL.search = '' - } +const SemVer = __nccwpck_require__(48088) - if (!urlEquals(queryURL, cachedURL, true)) { - return false - } +const inc = (version, release, options, identifier, identifierBase) => { + if (typeof (options) === 'string') { + identifierBase = identifier + identifier = options + options = undefined + } - if ( - response == null || - options?.ignoreVary || - !response.headersList.contains('vary') - ) { - return true - } + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options + ).inc(release, identifier, identifierBase).version + } catch (er) { + return null + } +} +module.exports = inc - const fieldValues = getFieldValues(response.headersList.get('vary')) - for (const fieldValue of fieldValues) { - if (fieldValue === '*') { - return false - } +/***/ }), - const requestValue = request.headersList.get(fieldValue) - const queryValue = requestQuery.headersList.get(fieldValue) +/***/ 80194: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // If one has the header and the other doesn't, or one has - // a different value than the other, return false - if (requestValue !== queryValue) { - return false - } - } +const compare = __nccwpck_require__(44309) +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt - return true - } -} -Object.defineProperties(Cache.prototype, { - [Symbol.toStringTag]: { - value: 'Cache', - configurable: true - }, - match: kEnumerableProperty, - matchAll: kEnumerableProperty, - add: kEnumerableProperty, - addAll: kEnumerableProperty, - put: kEnumerableProperty, - delete: kEnumerableProperty, - keys: kEnumerableProperty -}) +/***/ }), -const cacheQueryOptionConverters = [ - { - key: 'ignoreSearch', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'ignoreMethod', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'ignoreVary', - converter: webidl.converters.boolean, - defaultValue: false - } -] +/***/ 77520: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -webidl.converters.CacheQueryOptions = webidl.dictionaryConverter(cacheQueryOptionConverters) +const compare = __nccwpck_require__(44309) +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte -webidl.converters.MultiCacheQueryOptions = webidl.dictionaryConverter([ - ...cacheQueryOptionConverters, - { - key: 'cacheName', - converter: webidl.converters.DOMString - } -]) -webidl.converters.Response = webidl.interfaceConverter(Response) +/***/ }), -webidl.converters['sequence'] = webidl.sequenceConverter( - webidl.converters.RequestInfo -) +/***/ 76688: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = { - Cache -} +const SemVer = __nccwpck_require__(48088) +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major /***/ }), -/***/ 37907: +/***/ 38447: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - - -const { kConstruct } = __nccwpck_require__(29174) -const { Cache } = __nccwpck_require__(66101) -const { webidl } = __nccwpck_require__(21744) -const { kEnumerableProperty } = __nccwpck_require__(83983) +const SemVer = __nccwpck_require__(48088) +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor -class CacheStorage { - /** - * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map - * @type {Map { - request = webidl.converters.RequestInfo(request) - options = webidl.converters.MultiCacheQueryOptions(options) +const compare = __nccwpck_require__(44309) +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq - // 1. - if (options.cacheName != null) { - // 1.1.1.1 - if (this.#caches.has(options.cacheName)) { - // 1.1.1.1.1 - const cacheList = this.#caches.get(options.cacheName) - const cache = new Cache(kConstruct, cacheList) - return await cache.match(request, options) - } - } else { // 2. - // 2.2 - for (const cacheList of this.#caches.values()) { - const cache = new Cache(kConstruct, cacheList) +/***/ }), - // 2.2.1.2 - const response = await cache.match(request, options) +/***/ 75925: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (response !== undefined) { - return response - } - } +const SemVer = __nccwpck_require__(48088) +const parse = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version + } + try { + return new SemVer(version, options) + } catch (er) { + if (!throwErrors) { + return null } + throw er } +} - /** - * @see https://w3c.github.io/ServiceWorker/#cache-storage-has - * @param {string} cacheName - * @returns {Promise} - */ - async has (cacheName) { - webidl.brandCheck(this, CacheStorage) - webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.has' }) +module.exports = parse - cacheName = webidl.converters.DOMString(cacheName) - // 2.1.1 - // 2.2 - return this.#caches.has(cacheName) - } +/***/ }), - /** - * @see https://w3c.github.io/ServiceWorker/#dom-cachestorage-open - * @param {string} cacheName - * @returns {Promise} - */ - async open (cacheName) { - webidl.brandCheck(this, CacheStorage) - webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.open' }) +/***/ 42866: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - cacheName = webidl.converters.DOMString(cacheName) +const SemVer = __nccwpck_require__(48088) +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch - // 2.1 - if (this.#caches.has(cacheName)) { - // await caches.open('v1') !== await caches.open('v1') - // 2.1.1 - const cache = this.#caches.get(cacheName) +/***/ }), - // 2.1.1.1 - return new Cache(kConstruct, cache) - } +/***/ 24016: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 2.2 - const cache = [] +const parse = __nccwpck_require__(75925) +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} +module.exports = prerelease - // 2.3 - this.#caches.set(cacheName, cache) - // 2.4 - return new Cache(kConstruct, cache) - } +/***/ }), - /** - * @see https://w3c.github.io/ServiceWorker/#cache-storage-delete - * @param {string} cacheName - * @returns {Promise} - */ - async delete (cacheName) { - webidl.brandCheck(this, CacheStorage) - webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.delete' }) +/***/ 76417: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - cacheName = webidl.converters.DOMString(cacheName) +const compare = __nccwpck_require__(44309) +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare - return this.#caches.delete(cacheName) - } - /** - * @see https://w3c.github.io/ServiceWorker/#cache-storage-keys - * @returns {string[]} - */ - async keys () { - webidl.brandCheck(this, CacheStorage) +/***/ }), - // 2.1 - const keys = this.#caches.keys() +/***/ 8701: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 2.2 - return [...keys] - } -} +const compareBuild = __nccwpck_require__(92156) +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort -Object.defineProperties(CacheStorage.prototype, { - [Symbol.toStringTag]: { - value: 'CacheStorage', - configurable: true - }, - match: kEnumerableProperty, - has: kEnumerableProperty, - open: kEnumerableProperty, - delete: kEnumerableProperty, - keys: kEnumerableProperty -}) -module.exports = { - CacheStorage +/***/ }), + +/***/ 6055: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(9828) +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) } +module.exports = satisfies /***/ }), -/***/ 29174: +/***/ 61426: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - - -module.exports = { - kConstruct: (__nccwpck_require__(72785).kConstruct) -} +const compareBuild = __nccwpck_require__(92156) +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort /***/ }), -/***/ 82396: +/***/ 19601: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +const parse = __nccwpck_require__(75925) +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid -const assert = __nccwpck_require__(39491) -const { URLSerializer } = __nccwpck_require__(685) -const { isValidHeaderName } = __nccwpck_require__(52538) +/***/ }), -/** - * @see https://url.spec.whatwg.org/#concept-url-equals - * @param {URL} A - * @param {URL} B - * @param {boolean | undefined} excludeFragment - * @returns {boolean} - */ -function urlEquals (A, B, excludeFragment = false) { - const serializedA = URLSerializer(A, excludeFragment) - - const serializedB = URLSerializer(B, excludeFragment) +/***/ 11383: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - return serializedA === serializedB +// just pre-load all the stuff that index.js lazily exports +const internalRe = __nccwpck_require__(9523) +const constants = __nccwpck_require__(42293) +const SemVer = __nccwpck_require__(48088) +const identifiers = __nccwpck_require__(92463) +const parse = __nccwpck_require__(75925) +const valid = __nccwpck_require__(19601) +const clean = __nccwpck_require__(48848) +const inc = __nccwpck_require__(30900) +const diff = __nccwpck_require__(64297) +const major = __nccwpck_require__(76688) +const minor = __nccwpck_require__(38447) +const patch = __nccwpck_require__(42866) +const prerelease = __nccwpck_require__(24016) +const compare = __nccwpck_require__(44309) +const rcompare = __nccwpck_require__(76417) +const compareLoose = __nccwpck_require__(62804) +const compareBuild = __nccwpck_require__(92156) +const sort = __nccwpck_require__(61426) +const rsort = __nccwpck_require__(8701) +const gt = __nccwpck_require__(84123) +const lt = __nccwpck_require__(80194) +const eq = __nccwpck_require__(91898) +const neq = __nccwpck_require__(6017) +const gte = __nccwpck_require__(15522) +const lte = __nccwpck_require__(77520) +const cmp = __nccwpck_require__(75098) +const coerce = __nccwpck_require__(13466) +const Comparator = __nccwpck_require__(91532) +const Range = __nccwpck_require__(9828) +const satisfies = __nccwpck_require__(6055) +const toComparators = __nccwpck_require__(52706) +const maxSatisfying = __nccwpck_require__(20579) +const minSatisfying = __nccwpck_require__(10832) +const minVersion = __nccwpck_require__(34179) +const validRange = __nccwpck_require__(2098) +const outside = __nccwpck_require__(60420) +const gtr = __nccwpck_require__(9380) +const ltr = __nccwpck_require__(33323) +const intersects = __nccwpck_require__(27008) +const simplifyRange = __nccwpck_require__(75297) +const subset = __nccwpck_require__(7863) +module.exports = { + parse, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers, } -/** - * @see https://github.com/chromium/chromium/blob/694d20d134cb553d8d89e5500b9148012b1ba299/content/browser/cache_storage/cache_storage_cache.cc#L260-L262 - * @param {string} header - */ -function fieldValues (header) { - assert(header !== null) - const values = [] +/***/ }), - for (let value of header.split(',')) { - value = value.trim() +/***/ 42293: +/***/ ((module) => { - if (!value.length) { - continue - } else if (!isValidHeaderName(value)) { - continue - } +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' - values.push(value) - } +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ 9007199254740991 - return values -} +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +// Max safe length for a build identifier. The max length minus 6 characters for +// the shortest version with a build 0.0.0+BUILD. +const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +const RELEASE_TYPES = [ + 'major', + 'premajor', + 'minor', + 'preminor', + 'patch', + 'prepatch', + 'prerelease', +] module.exports = { - urlEquals, - fieldValues + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 0b001, + FLAG_LOOSE: 0b010, } /***/ }), -/***/ 33598: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 50427: +/***/ ((module) => { -"use strict"; -// @ts-check +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} +module.exports = debug -/* global WebAssembly */ +/***/ }), -const assert = __nccwpck_require__(39491) -const net = __nccwpck_require__(41808) -const http = __nccwpck_require__(13685) -const { pipeline } = __nccwpck_require__(12781) -const util = __nccwpck_require__(83983) -const timers = __nccwpck_require__(29459) -const Request = __nccwpck_require__(62905) -const DispatcherBase = __nccwpck_require__(74839) -const { - RequestContentLengthMismatchError, - ResponseContentLengthMismatchError, - InvalidArgumentError, - RequestAbortedError, - HeadersTimeoutError, - HeadersOverflowError, - SocketError, - InformationalError, - BodyTimeoutError, - HTTPParserError, - ResponseExceededMaxSizeError, - ClientDestroyedError -} = __nccwpck_require__(48045) -const buildConnector = __nccwpck_require__(82067) -const { - kUrl, - kReset, - kServerName, - kClient, - kBusy, - kParser, - kConnect, - kBlocking, - kResuming, - kRunning, - kPending, - kSize, - kWriting, - kQueue, - kConnected, - kConnecting, - kNeedDrain, - kNoRef, - kKeepAliveDefaultTimeout, - kHostHeader, - kPendingIdx, - kRunningIdx, - kError, - kPipelining, - kSocket, - kKeepAliveTimeoutValue, - kMaxHeadersSize, - kKeepAliveMaxTimeout, - kKeepAliveTimeoutThreshold, - kHeadersTimeout, - kBodyTimeout, - kStrictContentLength, - kConnector, - kMaxRedirections, - kMaxRequests, - kCounter, - kClose, - kDestroy, - kDispatch, - kInterceptors, - kLocalAddress, - kMaxResponseSize, - kHTTPConnVersion, - // HTTP2 - kHost, - kHTTP2Session, - kHTTP2SessionState, - kHTTP2BuildRequest, - kHTTP2CopyHeaders, - kHTTP1BuildRequest -} = __nccwpck_require__(72785) +/***/ 92463: +/***/ ((module) => { -/** @type {import('http2')} */ -let http2 -try { - http2 = __nccwpck_require__(85158) -} catch { - // @ts-ignore - http2 = { constants: {} } -} +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) -const { - constants: { - HTTP2_HEADER_AUTHORITY, - HTTP2_HEADER_METHOD, - HTTP2_HEADER_PATH, - HTTP2_HEADER_SCHEME, - HTTP2_HEADER_CONTENT_LENGTH, - HTTP2_HEADER_EXPECT, - HTTP2_HEADER_STATUS + if (anum && bnum) { + a = +a + b = +b } -} = http2 -// Experimental -let h2ExperimentalWarned = false + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} -const FastBuffer = Buffer[Symbol.species] +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) -const kClosedResolve = Symbol('kClosedResolve') +module.exports = { + compareIdentifiers, + rcompareIdentifiers, +} -const channels = {} -try { - const diagnosticsChannel = __nccwpck_require__(67643) - channels.sendHeaders = diagnosticsChannel.channel('undici:client:sendHeaders') - channels.beforeConnect = diagnosticsChannel.channel('undici:client:beforeConnect') - channels.connectError = diagnosticsChannel.channel('undici:client:connectError') - channels.connected = diagnosticsChannel.channel('undici:client:connected') -} catch { - channels.sendHeaders = { hasSubscribers: false } - channels.beforeConnect = { hasSubscribers: false } - channels.connectError = { hasSubscribers: false } - channels.connected = { hasSubscribers: false } -} +/***/ }), -/** - * @type {import('../types/client').default} - */ -class Client extends DispatcherBase { - /** - * - * @param {string|URL} url - * @param {import('../types/client').Client.Options} options - */ - constructor (url, { - interceptors, - maxHeaderSize, - headersTimeout, - socketTimeout, - requestTimeout, - connectTimeout, - bodyTimeout, - idleTimeout, - keepAlive, - keepAliveTimeout, - maxKeepAliveTimeout, - keepAliveMaxTimeout, - keepAliveTimeoutThreshold, - socketPath, - pipelining, - tls, - strictContentLength, - maxCachedSessions, - maxRedirections, - connect, - maxRequestsPerClient, - localAddress, - maxResponseSize, - autoSelectFamily, - autoSelectFamilyAttemptTimeout, - // h2 - allowH2, - maxConcurrentStreams - } = {}) { - super() +/***/ 15339: +/***/ ((module) => { - if (keepAlive !== undefined) { - throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead') - } +class LRUCache { + constructor () { + this.max = 1000 + this.map = new Map() + } - if (socketTimeout !== undefined) { - throw new InvalidArgumentError('unsupported socketTimeout, use headersTimeout & bodyTimeout instead') + get (key) { + const value = this.map.get(key) + if (value === undefined) { + return undefined + } else { + // Remove the key from the map and add it to the end + this.map.delete(key) + this.map.set(key, value) + return value } + } - if (requestTimeout !== undefined) { - throw new InvalidArgumentError('unsupported requestTimeout, use headersTimeout & bodyTimeout instead') - } + delete (key) { + return this.map.delete(key) + } - if (idleTimeout !== undefined) { - throw new InvalidArgumentError('unsupported idleTimeout, use keepAliveTimeout instead') - } + set (key, value) { + const deleted = this.delete(key) - if (maxKeepAliveTimeout !== undefined) { - throw new InvalidArgumentError('unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead') - } + if (!deleted && value !== undefined) { + // If cache is full, delete the least recently used item + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value + this.delete(firstKey) + } - if (maxHeaderSize != null && !Number.isFinite(maxHeaderSize)) { - throw new InvalidArgumentError('invalid maxHeaderSize') + this.map.set(key, value) } - if (socketPath != null && typeof socketPath !== 'string') { - throw new InvalidArgumentError('invalid socketPath') - } + return this + } +} - if (connectTimeout != null && (!Number.isFinite(connectTimeout) || connectTimeout < 0)) { - throw new InvalidArgumentError('invalid connectTimeout') - } +module.exports = LRUCache - if (keepAliveTimeout != null && (!Number.isFinite(keepAliveTimeout) || keepAliveTimeout <= 0)) { - throw new InvalidArgumentError('invalid keepAliveTimeout') - } - if (keepAliveMaxTimeout != null && (!Number.isFinite(keepAliveMaxTimeout) || keepAliveMaxTimeout <= 0)) { - throw new InvalidArgumentError('invalid keepAliveMaxTimeout') - } +/***/ }), - if (keepAliveTimeoutThreshold != null && !Number.isFinite(keepAliveTimeoutThreshold)) { - throw new InvalidArgumentError('invalid keepAliveTimeoutThreshold') - } +/***/ 40785: +/***/ ((module) => { - if (headersTimeout != null && (!Number.isInteger(headersTimeout) || headersTimeout < 0)) { - throw new InvalidArgumentError('headersTimeout must be a positive integer or zero') - } +// parse out just the options we care about +const looseOption = Object.freeze({ loose: true }) +const emptyOpts = Object.freeze({ }) +const parseOptions = options => { + if (!options) { + return emptyOpts + } - if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) { - throw new InvalidArgumentError('bodyTimeout must be a positive integer or zero') - } + if (typeof options !== 'object') { + return looseOption + } - if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { - throw new InvalidArgumentError('connect must be a function or an object') - } + return options +} +module.exports = parseOptions - if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) { - throw new InvalidArgumentError('maxRedirections must be a positive number') - } - if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) { - throw new InvalidArgumentError('maxRequestsPerClient must be a positive number') - } +/***/ }), - if (localAddress != null && (typeof localAddress !== 'string' || net.isIP(localAddress) === 0)) { - throw new InvalidArgumentError('localAddress must be valid string IP address') - } +/***/ 9523: +/***/ ((module, exports, __nccwpck_require__) => { - if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) { - throw new InvalidArgumentError('maxResponseSize must be a positive number') - } +const { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH, +} = __nccwpck_require__(42293) +const debug = __nccwpck_require__(50427) +exports = module.exports = {} - if ( - autoSelectFamilyAttemptTimeout != null && - (!Number.isInteger(autoSelectFamilyAttemptTimeout) || autoSelectFamilyAttemptTimeout < -1) - ) { - throw new InvalidArgumentError('autoSelectFamilyAttemptTimeout must be a positive number') - } +// The actual regexps go on exports.re +const re = exports.re = [] +const safeRe = exports.safeRe = [] +const src = exports.src = [] +const safeSrc = exports.safeSrc = [] +const t = exports.t = {} +let R = 0 - // h2 - if (allowH2 != null && typeof allowH2 !== 'boolean') { - throw new InvalidArgumentError('allowH2 must be a valid boolean value') - } +const LETTERDASHNUMBER = '[a-zA-Z0-9-]' - if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== 'number' || maxConcurrentStreams < 1)) { - throw new InvalidArgumentError('maxConcurrentStreams must be a possitive integer, greater than 0') - } +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +const safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] - if (typeof connect !== 'function') { - connect = buildConnector({ - ...tls, - maxCachedSessions, - allowH2, - socketPath, - timeout: connectTimeout, - ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined), - ...connect - }) - } +const makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value + .split(`${token}*`).join(`${token}{0,${max}}`) + .split(`${token}+`).join(`${token}{1,${max}}`) + } + return value +} - this[kInterceptors] = interceptors && interceptors.Client && Array.isArray(interceptors.Client) - ? interceptors.Client - : [createRedirectInterceptor({ maxRedirections })] - this[kUrl] = util.parseOrigin(url) - this[kConnector] = connect - this[kSocket] = null - this[kPipelining] = pipelining != null ? pipelining : 1 - this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize - this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout - this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout - this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold - this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout] - this[kServerName] = null - this[kLocalAddress] = localAddress != null ? localAddress : null - this[kResuming] = 0 // 0, idle, 1, scheduled, 2 resuming - this[kNeedDrain] = 0 // 0, idle, 1, scheduled, 2 resuming - this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}\r\n` - this[kBodyTimeout] = bodyTimeout != null ? bodyTimeout : 300e3 - this[kHeadersTimeout] = headersTimeout != null ? headersTimeout : 300e3 - this[kStrictContentLength] = strictContentLength == null ? true : strictContentLength - this[kMaxRedirections] = maxRedirections - this[kMaxRequests] = maxRequestsPerClient - this[kClosedResolve] = null - this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1 - this[kHTTPConnVersion] = 'h1' +const createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value) + const index = R++ + debug(name, index, value) + t[name] = index + src[index] = value + safeSrc[index] = safe + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) + safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) +} - // HTTP/2 - this[kHTTP2Session] = null - this[kHTTP2SessionState] = !allowH2 - ? null - : { - // streams: null, // Fixed queue of streams - For future support of `push` - openStreams: 0, // Keep track of them to decide wether or not unref the session - maxConcurrentStreams: maxConcurrentStreams != null ? maxConcurrentStreams : 100 // Max peerConcurrentStreams for a Node h2 server - } - this[kHost] = `${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}` +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. - // kQueue is built up of 3 sections separated by - // the kRunningIdx and kPendingIdx indices. - // | complete | running | pending | - // ^ kRunningIdx ^ kPendingIdx ^ kQueue.length - // kRunningIdx points to the first running element. - // kPendingIdx points to the first pending element. - // This implements a fast queue with an amortized - // time of O(1). +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. - this[kQueue] = [] - this[kRunningIdx] = 0 - this[kPendingIdx] = 0 - } +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '\\d+') - get pipelining () { - return this[kPipelining] - } +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. - set pipelining (value) { - this[kPipelining] = value - resume(this, true) - } +createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) - get [kPending] () { - return this[kQueue].length - this[kPendingIdx] - } +// ## Main Version +// Three dot-separated numeric identifiers. - get [kRunning] () { - return this[kPendingIdx] - this[kRunningIdx] - } +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) - get [kSize] () { - return this[kQueue].length - this[kRunningIdx] - } +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - get [kConnected] () { - return !!this[kSocket] && !this[kConnecting] && !this[kSocket].destroyed - } +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. - get [kBusy] () { - const socket = this[kSocket] - return ( - (socket && (socket[kReset] || socket[kWriting] || socket[kBlocking])) || - (this[kSize] >= (this[kPipelining] || 1)) || - this[kPending] > 0 - ) - } +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) - /* istanbul ignore: only used for test */ - [kConnect] (cb) { - connect(this) - this.once('connect', cb) - } +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) - [kDispatch] (opts, handler) { - const origin = opts.origin || this[kUrl].origin +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. - const request = this[kHTTPConnVersion] === 'h2' - ? Request[kHTTP2BuildRequest](origin, opts, handler) - : Request[kHTTP1BuildRequest](origin, opts, handler) +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) - this[kQueue].push(request) - if (this[kResuming]) { - // Do nothing. - } else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) { - // Wait a tick in case stream/iterator is ended in the same tick. - this[kResuming] = 1 - process.nextTick(resume, this) - } else { - resume(this, true) - } +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) - if (this[kResuming] && this[kNeedDrain] !== 2 && this[kBusy]) { - this[kNeedDrain] = 2 - } +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. - return this[kNeedDrain] < 2 - } +createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) - async [kClose] () { - // TODO: for H2 we need to gracefully flush the remaining enqueued - // request and close each stream. - return new Promise((resolve) => { - if (!this[kSize]) { - resolve(null) - } else { - this[kClosedResolve] = resolve - } - }) - } +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. - async [kDestroy] (err) { - return new Promise((resolve) => { - const requests = this[kQueue].splice(this[kPendingIdx]) - for (let i = 0; i < requests.length; i++) { - const request = requests[i] - errorRequest(this, request, err) - } +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) - const callback = () => { - if (this[kClosedResolve]) { - // TODO (fix): Should we error here with ClientDestroyedError? - this[kClosedResolve]() - this[kClosedResolve] = null - } - resolve() - } +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. - if (this[kHTTP2Session] != null) { - util.destroy(this[kHTTP2Session], err) - this[kHTTP2Session] = null - this[kHTTP2SessionState] = null - } +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. - if (!this[kSocket]) { - queueMicrotask(callback) - } else { - util.destroy(this[kSocket].on('close', callback), err) - } +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) - resume(this) - }) - } -} +createToken('FULL', `^${src[t.FULLPLAIN]}$`) -function onHttp2SessionError (err) { - assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID') +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) - this[kSocket][kError] = err +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) - onError(this[kClient], err) -} +createToken('GTLT', '((?:<|>)?=?)') -function onHttp2FrameError (type, code, id) { - const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`) +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) - if (id === 0) { - this[kSocket][kError] = err - onError(this[kClient], err) - } -} +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) -function onHttp2SessionEnd () { - util.destroy(this, new SocketError('other side closed')) - util.destroy(this[kSocket], new SocketError('other side closed')) -} +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) -function onHTTP2GoAway (code) { - const client = this[kClient] - const err = new InformationalError(`HTTP/2: "GOAWAY" frame received with code ${code}`) - client[kSocket] = null - client[kHTTP2Session] = null +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) - if (client.destroyed) { - assert(this[kPending] === 0) +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCEPLAIN', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) +createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) +createToken('COERCEFULL', src[t.COERCEPLAIN] + + `(?:${src[t.PRERELEASE]})?` + + `(?:${src[t.BUILD]})?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) +createToken('COERCERTLFULL', src[t.COERCEFULL], true) - // Fail entire queue. - const requests = client[kQueue].splice(client[kRunningIdx]) - for (let i = 0; i < requests.length; i++) { - const request = requests[i] - errorRequest(this, request, err) - } - } else if (client[kRunning] > 0) { - // Fail head of pipeline. - const request = client[kQueue][client[kRunningIdx]] - client[kQueue][client[kRunningIdx]++] = null +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') - errorRequest(client, request, err) - } +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' - client[kPendingIdx] = client[kRunningIdx] +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) - assert(client[kRunning] === 0) +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') - client.emit('disconnect', - client[kUrl], - [client], - err - ) +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' - resume(client) -} +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) -const constants = __nccwpck_require__(30953) -const createRedirectInterceptor = __nccwpck_require__(38861) -const EMPTY_BUF = Buffer.alloc(0) +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) -async function lazyllhttp () { - const llhttpWasmData = process.env.JEST_WORKER_ID ? __nccwpck_require__(61145) : undefined +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' - let mod - try { - mod = await WebAssembly.compile(Buffer.from(__nccwpck_require__(95627), 'base64')) - } catch (e) { - /* istanbul ignore next */ +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) - // We could check if the error was caused by the simd option not - // being enabled, but the occurring of this other error - // * https://github.com/emscripten-core/emscripten/issues/11495 - // got me to remove that check to avoid breaking Node 12. - mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || __nccwpck_require__(61145), 'base64')) - } +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) - return await WebAssembly.instantiate(mod, { - env: { - /* eslint-disable camelcase */ +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') - wasm_on_url: (p, at, len) => { - /* istanbul ignore next */ - return 0 - }, - wasm_on_status: (p, at, len) => { - assert.strictEqual(currentParser.ptr, p) - const start = at - currentBufferPtr + currentBufferRef.byteOffset - return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 - }, - wasm_on_message_begin: (p) => { - assert.strictEqual(currentParser.ptr, p) - return currentParser.onMessageBegin() || 0 - }, - wasm_on_header_field: (p, at, len) => { - assert.strictEqual(currentParser.ptr, p) - const start = at - currentBufferPtr + currentBufferRef.byteOffset - return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 - }, - wasm_on_header_value: (p, at, len) => { - assert.strictEqual(currentParser.ptr, p) - const start = at - currentBufferPtr + currentBufferRef.byteOffset - return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 - }, - wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => { - assert.strictEqual(currentParser.ptr, p) - return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0 - }, - wasm_on_body: (p, at, len) => { - assert.strictEqual(currentParser.ptr, p) - const start = at - currentBufferPtr + currentBufferRef.byteOffset - return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 - }, - wasm_on_message_complete: (p) => { - assert.strictEqual(currentParser.ptr, p) - return currentParser.onMessageComplete() || 0 - } - /* eslint-enable camelcase */ - } - }) -} +/***/ }), -let llhttpInstance = null -let llhttpPromise = lazyllhttp() -llhttpPromise.catch() +/***/ 9380: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -let currentParser = null -let currentBufferRef = null -let currentBufferSize = 0 -let currentBufferPtr = null +// Determine if version is greater than all the versions possible in the range. +const outside = __nccwpck_require__(60420) +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr -const TIMEOUT_HEADERS = 1 -const TIMEOUT_BODY = 2 -const TIMEOUT_IDLE = 3 -class Parser { - constructor (client, socket, { exports }) { - assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0) +/***/ }), - this.llhttp = exports - this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE) - this.client = client - this.socket = socket - this.timeout = null - this.timeoutValue = null - this.timeoutType = null - this.statusCode = null - this.statusText = '' - this.upgrade = false - this.headers = [] - this.headersSize = 0 - this.headersMaxSize = client[kMaxHeadersSize] - this.shouldKeepAlive = false - this.paused = false - this.resume = this.resume.bind(this) +/***/ 27008: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - this.bytesRead = 0 +const Range = __nccwpck_require__(9828) +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2, options) +} +module.exports = intersects - this.keepAlive = '' - this.contentLength = '' - this.connection = '' - this.maxResponseSize = client[kMaxResponseSize] - } - setTimeout (value, type) { - this.timeoutType = type - if (value !== this.timeoutValue) { - timers.clearTimeout(this.timeout) - if (value) { - this.timeout = timers.setTimeout(onParserTimeout, value, this) - // istanbul ignore else: only for jest - if (this.timeout.unref) { - this.timeout.unref() - } - } else { - this.timeout = null - } - this.timeoutValue = value - } else if (this.timeout) { - // istanbul ignore else: only for jest - if (this.timeout.refresh) { - this.timeout.refresh() - } - } - } +/***/ }), - resume () { - if (this.socket.destroyed || !this.paused) { - return - } +/***/ 33323: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - assert(this.ptr != null) - assert(currentParser == null) +const outside = __nccwpck_require__(60420) +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr - this.llhttp.llhttp_resume(this.ptr) - assert(this.timeoutType === TIMEOUT_BODY) - if (this.timeout) { - // istanbul ignore else: only for jest - if (this.timeout.refresh) { - this.timeout.refresh() - } - } +/***/ }), - this.paused = false - this.execute(this.socket.read() || EMPTY_BUF) // Flush parser. - this.readMore() - } +/***/ 20579: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - readMore () { - while (!this.paused && this.ptr) { - const chunk = this.socket.read() - if (chunk === null) { - break +const SemVer = __nccwpck_require__(48088) +const Range = __nccwpck_require__(9828) + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) } - this.execute(chunk) } - } + }) + return max +} +module.exports = maxSatisfying - execute (data) { - assert(this.ptr != null) - assert(currentParser == null) - assert(!this.paused) - const { socket, llhttp } = this +/***/ }), - if (data.length > currentBufferSize) { - if (currentBufferPtr) { - llhttp.free(currentBufferPtr) - } - currentBufferSize = Math.ceil(data.length / 4096) * 4096 - currentBufferPtr = llhttp.malloc(currentBufferSize) - } - - new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data) - - // Call `execute` on the wasm parser. - // We pass the `llhttp_parser` pointer address, the pointer address of buffer view data, - // and finally the length of bytes to parse. - // The return value is an error code or `constants.ERROR.OK`. - try { - let ret +/***/ 10832: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - try { - currentBufferRef = data - currentParser = this - ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length) - /* eslint-disable-next-line no-useless-catch */ - } catch (err) { - /* istanbul ignore next: difficult to make a test case for */ - throw err - } finally { - currentParser = null - currentBufferRef = null +const SemVer = __nccwpck_require__(48088) +const Range = __nccwpck_require__(9828) +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) } + } + }) + return min +} +module.exports = minSatisfying - const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr - if (ret === constants.ERROR.PAUSED_UPGRADE) { - this.onUpgrade(data.slice(offset)) - } else if (ret === constants.ERROR.PAUSED) { - this.paused = true - socket.unshift(data.slice(offset)) - } else if (ret !== constants.ERROR.OK) { - const ptr = llhttp.llhttp_get_error_reason(this.ptr) - let message = '' - /* istanbul ignore else: difficult to make a test case for */ - if (ptr) { - const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0) - message = - 'Response does not match the HTTP/1.1 protocol (' + - Buffer.from(llhttp.memory.buffer, ptr, len).toString() + - ')' - } - throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset)) - } - } catch (err) { - util.destroy(socket, err) - } - } +/***/ }), - destroy () { - assert(this.ptr != null) - assert(currentParser == null) +/***/ 34179: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - this.llhttp.llhttp_free(this.ptr) - this.ptr = null +const SemVer = __nccwpck_require__(48088) +const Range = __nccwpck_require__(9828) +const gt = __nccwpck_require__(84123) - timers.clearTimeout(this.timeout) - this.timeout = null - this.timeoutValue = null - this.timeoutType = null +const minVersion = (range, loose) => { + range = new Range(range, loose) - this.paused = false + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver } - onStatus (buf) { - this.statusText = buf.toString() + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver } - onMessageBegin () { - const { socket, client } = this + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] - /* istanbul ignore next: difficult to make a test case for */ - if (socket.destroyed) { - return -1 + let setMin = null + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!setMin || gt(compver, setMin)) { + setMin = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin } + } - const request = client[kQueue][client[kRunningIdx]] - if (!request) { - return -1 - } + if (minver && range.test(minver)) { + return minver } - onHeaderField (buf) { - const len = this.headers.length + return null +} +module.exports = minVersion - if ((len & 1) === 0) { - this.headers.push(buf) - } else { - this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf]) - } - this.trackHeader(buf.length) - } +/***/ }), - onHeaderValue (buf) { - let len = this.headers.length +/***/ 60420: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if ((len & 1) === 1) { - this.headers.push(buf) - len += 1 - } else { - this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf]) - } +const SemVer = __nccwpck_require__(48088) +const Comparator = __nccwpck_require__(91532) +const { ANY } = Comparator +const Range = __nccwpck_require__(9828) +const satisfies = __nccwpck_require__(6055) +const gt = __nccwpck_require__(84123) +const lt = __nccwpck_require__(80194) +const lte = __nccwpck_require__(77520) +const gte = __nccwpck_require__(15522) - const key = this.headers[len - 2] - if (key.length === 10 && key.toString().toLowerCase() === 'keep-alive') { - this.keepAlive += buf.toString() - } else if (key.length === 10 && key.toString().toLowerCase() === 'connection') { - this.connection += buf.toString() - } else if (key.length === 14 && key.toString().toLowerCase() === 'content-length') { - this.contentLength += buf.toString() - } +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) - this.trackHeader(buf.length) + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') } - trackHeader (len) { - this.headersSize += len - if (this.headersSize >= this.headersMaxSize) { - util.destroy(this.socket, new HeadersOverflowError()) - } + // If it satisfies the range it is not outside + if (satisfies(version, range, options)) { + return false } - onUpgrade (head) { - const { upgrade, client, socket, headers, statusCode } = this + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. - assert(upgrade) + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] - const request = client[kQueue][client[kRunningIdx]] - assert(request) + let high = null + let low = null - assert(!socket.destroyed) - assert(socket === client[kSocket]) - assert(!this.paused) - assert(request.upgrade || request.method === 'CONNECT') + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) - this.statusCode = null - this.statusText = '' - this.shouldKeepAlive = null + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } - assert(this.headers.length % 2 === 0) - this.headers = [] - this.headersSize = 0 + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} - socket.unshift(head) +module.exports = outside - socket[kParser].destroy() - socket[kParser] = null - socket[kClient] = null - socket[kError] = null - socket - .removeListener('error', onSocketError) - .removeListener('readable', onSocketReadable) - .removeListener('end', onSocketEnd) - .removeListener('close', onSocketClose) +/***/ }), - client[kSocket] = null - client[kQueue][client[kRunningIdx]++] = null - client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade')) +/***/ 75297: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - try { - request.onUpgrade(statusCode, headers, socket) - } catch (err) { - util.destroy(socket, err) +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = __nccwpck_require__(6055) +const compare = __nccwpck_require__(44309) +module.exports = (versions, range, options) => { + const set = [] + let first = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!first) { + first = version + } + } else { + if (prev) { + set.push([first, prev]) + } + prev = null + first = null } - - resume(client) + } + if (first) { + set.push([first, null]) } - onHeadersComplete (statusCode, upgrade, shouldKeepAlive) { - const { client, socket, headers, statusText } = this - - /* istanbul ignore next: difficult to make a test case for */ - if (socket.destroyed) { - return -1 + const ranges = [] + for (const [min, max] of set) { + if (min === max) { + ranges.push(min) + } else if (!max && min === v[0]) { + ranges.push('*') + } else if (!max) { + ranges.push(`>=${min}`) + } else if (min === v[0]) { + ranges.push(`<=${max}`) + } else { + ranges.push(`${min} - ${max}`) } + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} - const request = client[kQueue][client[kRunningIdx]] - /* istanbul ignore next: difficult to make a test case for */ - if (!request) { - return -1 - } +/***/ }), - assert(!this.upgrade) - assert(this.statusCode < 200) +/***/ 7863: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (statusCode === 100) { - util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket))) - return -1 - } +const Range = __nccwpck_require__(9828) +const Comparator = __nccwpck_require__(91532) +const { ANY } = Comparator +const satisfies = __nccwpck_require__(6055) +const compare = __nccwpck_require__(44309) - /* this can only happen if server is misbehaving */ - if (upgrade && !request.upgrade) { - util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket))) - return -1 - } +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a null set, OR +// - Every simple range `r1, r2, ...` which is not a null set is a subset of +// some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else if in prerelease mode, return false +// - else replace c with `[>=0.0.0]` +// - If C is only the ANY comparator +// - if in prerelease mode, return true +// - else replace C with `[>=0.0.0]` +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If any C is a = range, and GT or LT are set, return false +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the GT.semver tuple, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the LT.semver tuple, return false +// - Else return true - assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS) +const subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true + } - this.statusCode = statusCode - this.shouldKeepAlive = ( - shouldKeepAlive || - // Override llhttp value which does not allow keepAlive for HEAD. - (request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive') - ) + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false - if (this.statusCode >= 200) { - const bodyTimeout = request.bodyTimeout != null - ? request.bodyTimeout - : client[kBodyTimeout] - this.setTimeout(bodyTimeout, TIMEOUT_BODY) - } else if (this.timeout) { - // istanbul ignore else: only for jest - if (this.timeout.refresh) { - this.timeout.refresh() + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) { + continue OUTER } } - - if (request.method === 'CONNECT') { - assert(client[kRunning] === 1) - this.upgrade = true - return 2 - } - - if (upgrade) { - assert(client[kRunning] === 1) - this.upgrade = true - return 2 + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) { + return false } + } + return true +} - assert(this.headers.length % 2 === 0) - this.headers = [] - this.headersSize = 0 +const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] +const minimumVersion = [new Comparator('>=0.0.0')] - if (this.shouldKeepAlive && client[kPipelining]) { - const keepAliveTimeout = this.keepAlive ? util.parseKeepAliveTimeout(this.keepAlive) : null +const simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true + } - if (keepAliveTimeout != null) { - const timeout = Math.min( - keepAliveTimeout - client[kKeepAliveTimeoutThreshold], - client[kKeepAliveMaxTimeout] - ) - if (timeout <= 0) { - socket[kReset] = true - } else { - client[kKeepAliveTimeoutValue] = timeout - } - } else { - client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout] - } + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease } else { - // Stop more requests from being dispatched. - socket[kReset] = true + sub = minimumVersion } + } - const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false - - if (request.aborted) { - return -1 + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = minimumVersion } + } - if (request.method === 'HEAD') { - return 1 + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') { + gt = higherGT(gt, c, options) + } else if (c.operator === '<' || c.operator === '<=') { + lt = lowerLT(lt, c, options) + } else { + eqSet.add(c.semver) } + } - if (statusCode < 200) { - return 1 - } + if (eqSet.size > 1) { + return null + } - if (socket[kBlocking]) { - socket[kBlocking] = false - resume(client) + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) { + return null + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { + return null } + } - return pause ? constants.ERROR.PAUSED : 0 - } - - onBody (buf) { - const { client, socket, statusCode, maxResponseSize } = this - - if (socket.destroyed) { - return -1 + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null } - const request = client[kQueue][client[kRunningIdx]] - assert(request) - - assert.strictEqual(this.timeoutType, TIMEOUT_BODY) - if (this.timeout) { - // istanbul ignore else: only for jest - if (this.timeout.refresh) { - this.timeout.refresh() - } + if (lt && !satisfies(eq, String(lt), options)) { + return null } - assert(statusCode >= 200) - - if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) { - util.destroy(socket, new ResponseExceededMaxSizeError()) - return -1 + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false + } } - this.bytesRead += buf.length - - if (request.onData(buf) === false) { - return constants.ERROR.PAUSED - } + return true } - onMessageComplete () { - const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this - - if (socket.destroyed && (!statusCode || shouldKeepAlive)) { - return -1 - } + let higher, lower + let hasDomLT, hasDomGT + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } - if (upgrade) { - return + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } } - - const request = client[kQueue][client[kRunningIdx]] - assert(request) - - assert(statusCode >= 100) - - this.statusCode = null - this.statusText = '' - this.bytesRead = 0 - this.contentLength = '' - this.keepAlive = '' - this.connection = '' - - assert(this.headers.length % 2 === 0) - this.headers = [] - this.headersSize = 0 - - if (statusCode < 200) { - return + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + return false + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { + return false + } } - - /* istanbul ignore next: should be handled by llhttp? */ - if (request.method !== 'HEAD' && contentLength && bytesRead !== parseInt(contentLength, 10)) { - util.destroy(socket, new ResponseContentLengthMismatchError()) - return -1 + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false } + } - request.onComplete(headers) + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false + } - client[kQueue][client[kRunningIdx]++] = null + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false + } - if (socket[kWriting]) { - assert.strictEqual(client[kRunning], 0) - // Response completed before request. - util.destroy(socket, new InformationalError('reset')) - return constants.ERROR.PAUSED - } else if (!shouldKeepAlive) { - util.destroy(socket, new InformationalError('reset')) - return constants.ERROR.PAUSED - } else if (socket[kReset] && client[kRunning] === 0) { - // Destroy socket once all requests have completed. - // The request at the tail of the pipeline is the one - // that requested reset and no further requests should - // have been queued since then. - util.destroy(socket, new InformationalError('reset')) - return constants.ERROR.PAUSED - } else if (client[kPipelining] === 1) { - // We must wait a full event loop cycle to reuse this socket to make sure - // that non-spec compliant servers are not closing the connection even if they - // said they won't. - setImmediate(resume, client) - } else { - resume(client) - } + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + return false } -} -function onParserTimeout (parser) { - const { socket, timeoutType, client } = parser + return true +} - /* istanbul ignore else */ - if (timeoutType === TIMEOUT_HEADERS) { - if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) { - assert(!parser.paused, 'cannot be paused while waiting for headers') - util.destroy(socket, new HeadersTimeoutError()) - } - } else if (timeoutType === TIMEOUT_BODY) { - if (!parser.paused) { - util.destroy(socket, new BodyTimeoutError()) - } - } else if (timeoutType === TIMEOUT_IDLE) { - assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]) - util.destroy(socket, new InformationalError('socket idle timeout')) +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) { + return b } + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a } -function onSocketReadable () { - const { [kParser]: parser } = this - if (parser) { - parser.readMore() +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) { + return b } + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a } -function onSocketError (err) { - const { [kClient]: client, [kParser]: parser } = this +module.exports = subset - assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID') - if (client[kHTTPConnVersion] !== 'h2') { - // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded - // to the user. - if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so for as a valid response. - parser.onMessageComplete() - return - } - } +/***/ }), - this[kError] = err +/***/ 52706: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - onError(this[kClient], err) -} +const Range = __nccwpck_require__(9828) -function onError (client, err) { - if ( - client[kRunning] === 0 && - err.code !== 'UND_ERR_INFO' && - err.code !== 'UND_ERR_SOCKET' - ) { - // Error is not caused by running request and not a recoverable - // socket error. +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) - assert(client[kPendingIdx] === client[kRunningIdx]) +module.exports = toComparators - const requests = client[kQueue].splice(client[kRunningIdx]) - for (let i = 0; i < requests.length; i++) { - const request = requests[i] - errorRequest(client, request, err) - } - assert(client[kSize] === 0) + +/***/ }), + +/***/ 2098: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(9828) +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null } } +module.exports = validRange -function onSocketEnd () { - const { [kParser]: parser, [kClient]: client } = this - if (client[kHTTPConnVersion] !== 'h2') { - if (parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so far as a valid response. - parser.onMessageComplete() - return - } - } +/***/ }), - util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this))) -} +/***/ 59318: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -function onSocketClose () { - const { [kClient]: client, [kParser]: parser } = this +"use strict"; - if (client[kHTTPConnVersion] === 'h1' && parser) { - if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) { - // We treat all incoming data so far as a valid response. - parser.onMessageComplete() - } +const os = __nccwpck_require__(22037); +const tty = __nccwpck_require__(76224); +const hasFlag = __nccwpck_require__(31621); - this[kParser].destroy() - this[kParser] = null - } +const {env} = process; - const err = this[kError] || new SocketError('closed', util.getSocketInfo(this)) +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = 1; +} - client[kSocket] = null +if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } +} - if (client.destroyed) { - assert(client[kPending] === 0) +function translateLevel(level) { + if (level === 0) { + return false; + } - // Fail entire queue. - const requests = client[kQueue].splice(client[kRunningIdx]) - for (let i = 0; i < requests.length; i++) { - const request = requests[i] - errorRequest(client, request, err) - } - } else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') { - // Fail head of pipeline. - const request = client[kQueue][client[kRunningIdx]] - client[kQueue][client[kRunningIdx]++] = null + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} - errorRequest(client, request, err) - } +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } - client[kPendingIdx] = client[kRunningIdx] + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } - assert(client[kRunning] === 0) + if (hasFlag('color=256')) { + return 2; + } - client.emit('disconnect', client[kUrl], [client], err) + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } - resume(client) -} + const min = forceColor || 0; -async function connect (client) { - assert(!client[kConnecting]) - assert(!client[kSocket]) + if (env.TERM === 'dumb') { + return min; + } - let { host, hostname, protocol, port } = client[kUrl] + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } - // Resolve ipv6 - if (hostname[0] === '[') { - const idx = hostname.indexOf(']') + return 1; + } - assert(idx !== -1) - const ip = hostname.substring(1, idx) + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } - assert(net.isIP(ip)) - hostname = ip - } + return min; + } - client[kConnecting] = true + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } - if (channels.beforeConnect.hasSubscribers) { - channels.beforeConnect.publish({ - connectParams: { - host, - hostname, - protocol, - port, - servername: client[kServerName], - localAddress: client[kLocalAddress] - }, - connector: client[kConnector] - }) - } + if (env.COLORTERM === 'truecolor') { + return 3; + } - try { - const socket = await new Promise((resolve, reject) => { - client[kConnector]({ - host, - hostname, - protocol, - port, - servername: client[kServerName], - localAddress: client[kLocalAddress] - }, (err, socket) => { - if (err) { - reject(err) - } else { - resolve(socket) - } - }) - }) + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - if (client.destroyed) { - util.destroy(socket.on('error', () => {}), new ClientDestroyedError()) - return - } + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } - client[kConnecting] = false + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } - assert(socket) + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } - const isH2 = socket.alpnProtocol === 'h2' - if (isH2) { - if (!h2ExperimentalWarned) { - h2ExperimentalWarned = true - process.emitWarning('H2 support is experimental, expect them to change at any time.', { - code: 'UNDICI-H2' - }) - } + if ('COLORTERM' in env) { + return 1; + } - const session = http2.connect(client[kUrl], { - createConnection: () => socket, - peerMaxConcurrentStreams: client[kHTTP2SessionState].maxConcurrentStreams - }) + return min; +} - client[kHTTPConnVersion] = 'h2' - session[kClient] = client - session[kSocket] = socket - session.on('error', onHttp2SessionError) - session.on('frameError', onHttp2FrameError) - session.on('end', onHttp2SessionEnd) - session.on('goaway', onHTTP2GoAway) - session.on('close', onSocketClose) - session.unref() +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} - client[kHTTP2Session] = session - socket[kHTTP2Session] = session - } else { - if (!llhttpInstance) { - llhttpInstance = await llhttpPromise - llhttpPromise = null - } +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; - socket[kNoRef] = false - socket[kWriting] = false - socket[kReset] = false - socket[kBlocking] = false - socket[kParser] = new Parser(client, socket, llhttpInstance) - } - socket[kCounter] = 0 - socket[kMaxRequests] = client[kMaxRequests] - socket[kClient] = client - socket[kError] = null +/***/ }), - socket - .on('error', onSocketError) - .on('readable', onSocketReadable) - .on('end', onSocketEnd) - .on('close', onSocketClose) +/***/ 4351: +/***/ ((module) => { - client[kSocket] = socket +/****************************************************************************** +Copyright (c) Microsoft Corporation. - if (channels.connected.hasSubscribers) { - channels.connected.publish({ - connectParams: { - host, - hostname, - protocol, - port, - servername: client[kServerName], - localAddress: client[kLocalAddress] - }, - connector: client[kConnector], - socket - }) +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +var __addDisposableResource; +var __disposeResources; +var __rewriteRelativeImportExtension; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); } - client.emit('connect', client[kUrl], [client]) - } catch (err) { - if (client.destroyed) { - return + else if ( true && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); } - - client[kConnecting] = false - - if (channels.connectError.hasSubscribers) { - channels.connectError.publish({ - connectParams: { - host, - hostname, - protocol, - port, - servername: client[kServerName], - localAddress: client[kLocalAddress] - }, - connector: client[kConnector], - error: err - }) + else { + factory(createExporter(root)); } - - if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') { - assert(client[kRunning] === 0) - while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { - const request = client[kQueue][client[kPendingIdx]++] - errorRequest(client, request, err) - } - } else { - onError(client, err) + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - client.emit('connectionError', client[kUrl], [client], err) - } - - resume(client) -} - -function emitDrain (client) { - client[kNeedDrain] = 0 - client.emit('drain', client[kUrl], [client]) -} - -function resume (client, sync) { - if (client[kResuming] === 2) { - return - } - - client[kResuming] = 2 - - _resume(client, sync) - client[kResuming] = 0 + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; - if (client[kRunningIdx] > 256) { - client[kQueue].splice(0, client[kRunningIdx]) - client[kPendingIdx] -= client[kRunningIdx] - client[kRunningIdx] = 0 - } -} + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; -function _resume (client, sync) { - while (true) { - if (client.destroyed) { - assert(client[kPending] === 0) - return - } + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; - if (client[kClosedResolve] && !client[kSize]) { - client[kClosedResolve]() - client[kClosedResolve] = null - return - } + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; - const socket = client[kSocket] + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; - if (socket && !socket.destroyed && socket.alpnProtocol !== 'h2') { - if (client[kSize] === 0) { - if (!socket[kNoRef] && socket.unref) { - socket.unref() - socket[kNoRef] = true + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } } - } else if (socket[kNoRef] && socket.ref) { - socket.ref() - socket[kNoRef] = false - } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; - if (client[kSize] === 0) { - if (socket[kParser].timeoutType !== TIMEOUT_IDLE) { - socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_IDLE) - } - } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { - if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { - const request = client[kQueue][client[kRunningIdx]] - const headersTimeout = request.headersTimeout != null - ? request.headersTimeout - : client[kHeadersTimeout] - socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS) + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } - } - } + return useValue ? value : void 0; + }; - if (client[kBusy]) { - client[kNeedDrain] = 2 - } else if (client[kNeedDrain] === 2) { - if (sync) { - client[kNeedDrain] = 1 - process.nextTick(emitDrain, client) - } else { - emitDrain(client) - } - continue - } + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; - if (client[kPending] === 0) { - return - } + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; - if (client[kRunning] >= (client[kPipelining] || 1)) { - return - } + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; - const request = client[kQueue][client[kPendingIdx]] + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; - if (client[kUrl].protocol === 'https:' && client[kServerName] !== request.servername) { - if (client[kRunning] > 0) { - return - } + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; - client[kServerName] = request.servername + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; - if (socket && socket.servername !== request.servername) { - util.destroy(socket, new InformationalError('servername changed')) - return - } - } + __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + }); - if (client[kConnecting]) { - return - } + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; - if (!socket && !client[kHTTP2Session]) { - connect(client) - return - } + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; - if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { - return - } + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; - if (client[kRunning] > 0 && !request.idempotent) { - // Non-idempotent request cannot be retried. - // Ensure that no other requests are inflight and - // could cause failure. - return - } + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; - if (client[kRunning] > 0 && (request.upgrade || request.method === 'CONNECT')) { - // Don't dispatch an upgrade until all preceding requests have completed. - // A misbehaving server might upgrade the connection before all pipelined - // request has completed. - return - } + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; - if (client[kRunning] > 0 && util.bodyLength(request.body) !== 0 && - (util.isStream(request.body) || util.isAsyncIterable(request.body))) { - // Request with stream or iterator body can error while other requests - // are inflight and indirectly error those as well. - // Ensure this doesn't happen by waiting for inflight - // to complete before dispatching. + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; - // Request with stream or iterator body cannot be retried. - // Ensure that no other requests are inflight and - // could cause failure. - return - } + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; - if (!request.aborted && write(client, request)) { - client[kPendingIdx]++ - } else { - client[kQueue].splice(client[kPendingIdx], 1) - } - } -} + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; -// https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2 -function shouldSendContentLength (method) { - return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT' -} + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; -function write (client, request) { - if (client[kHTTPConnVersion] === 'h2') { - writeH2(client, client[kHTTP2Session], request) - return - } + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; - const { body, method, path, host, upgrade, headers, blocking, reset } = request + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; - // https://tools.ietf.org/html/rfc7231#section-4.3.1 - // https://tools.ietf.org/html/rfc7231#section-4.3.2 - // https://tools.ietf.org/html/rfc7231#section-4.3.5 + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; - // Sending a payload body on a request that does not - // expect it can cause undefined behavior on some - // servers and corrupt connection state. Do not - // re-use the connection for further requests. + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; - const expectsPayload = ( - method === 'PUT' || - method === 'POST' || - method === 'PATCH' - ) + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; - if (body && typeof body.read === 'function') { - // Try to read EOF in order to get length. - body.read(0) - } + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; - const bodyLength = util.bodyLength(body) + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; - let contentLength = bodyLength + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; - if (contentLength === null) { - contentLength = request.contentLength - } - - if (contentLength === 0 && !expectsPayload) { - // https://tools.ietf.org/html/rfc7230#section-3.3.2 - // A user agent SHOULD NOT send a Content-Length header field when - // the request message does not contain a payload body and the method - // semantics do not anticipate such a body. - - contentLength = null - } - - // https://github.com/nodejs/undici/issues/2046 - // A user agent may send a Content-Length header with 0 value, this should be allowed. - if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength !== null && request.contentLength !== contentLength) { - if (client[kStrictContentLength]) { - errorRequest(client, request, new RequestContentLengthMismatchError()) - return false - } + __addDisposableResource = function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + }; - process.emitWarning(new RequestContentLengthMismatchError()) - } + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; - const socket = client[kSocket] + __disposeResources = function (env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; - try { - request.onConnect((err) => { - if (request.aborted || request.completed) { - return - } + __rewriteRelativeImportExtension = function (path, preserveJsx) { + if (typeof path === "string" && /^\.\.?\//.test(path)) { + return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { + return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); + }); + } + return path; + }; - errorRequest(client, request, err || new RequestAbortedError()) + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); + exporter("__addDisposableResource", __addDisposableResource); + exporter("__disposeResources", __disposeResources); + exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension); +}); - util.destroy(socket, new InformationalError('aborted')) - }) - } catch (err) { - errorRequest(client, request, err) - } +0 && (0); - if (request.aborted) { - return false - } - if (method === 'HEAD') { - // https://github.com/mcollina/undici/issues/258 - // Close after a HEAD request to interop with misbehaving servers - // that may send a body in the response. +/***/ }), - socket[kReset] = true - } +/***/ 74294: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (upgrade || method === 'CONNECT') { - // On CONNECT or upgrade, block pipeline from dispatching further - // requests on this connection. +module.exports = __nccwpck_require__(54219); - socket[kReset] = true - } - if (reset != null) { - socket[kReset] = reset - } +/***/ }), - if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) { - socket[kReset] = true - } +/***/ 54219: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (blocking) { - socket[kBlocking] = true - } +"use strict"; - let header = `${method} ${path} HTTP/1.1\r\n` - if (typeof host === 'string') { - header += `host: ${host}\r\n` - } else { - header += client[kHostHeader] - } +var net = __nccwpck_require__(41808); +var tls = __nccwpck_require__(24404); +var http = __nccwpck_require__(13685); +var https = __nccwpck_require__(95687); +var events = __nccwpck_require__(82361); +var assert = __nccwpck_require__(39491); +var util = __nccwpck_require__(73837); - if (upgrade) { - header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n` - } else if (client[kPipelining] && !socket[kReset]) { - header += 'connection: keep-alive\r\n' - } else { - header += 'connection: close\r\n' - } - if (headers) { - header += headers - } +exports.httpOverHttp = httpOverHttp; +exports.httpsOverHttp = httpsOverHttp; +exports.httpOverHttps = httpOverHttps; +exports.httpsOverHttps = httpsOverHttps; - if (channels.sendHeaders.hasSubscribers) { - channels.sendHeaders.publish({ request, headers: header, socket }) - } - /* istanbul ignore else: assertion */ - if (!body || bodyLength === 0) { - if (contentLength === 0) { - socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1') - } else { - assert(contentLength === null, 'no body must not have content length') - socket.write(`${header}\r\n`, 'latin1') - } - request.onRequestSent() - } else if (util.isBuffer(body)) { - assert(contentLength === body.byteLength, 'buffer body must have content length') +function httpOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + return agent; +} - socket.cork() - socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') - socket.write(body) - socket.uncork() - request.onBodySent(body) - request.onRequestSent() - if (!expectsPayload) { - socket[kReset] = true - } - } else if (util.isBlobLike(body)) { - if (typeof body.stream === 'function') { - writeIterable({ body: body.stream(), client, request, socket, contentLength, header, expectsPayload }) - } else { - writeBlob({ body, client, request, socket, contentLength, header, expectsPayload }) - } - } else if (util.isStream(body)) { - writeStream({ body, client, request, socket, contentLength, header, expectsPayload }) - } else if (util.isIterable(body)) { - writeIterable({ body, client, request, socket, contentLength, header, expectsPayload }) - } else { - assert(false) - } +function httpsOverHttp(options) { + var agent = new TunnelingAgent(options); + agent.request = http.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} - return true +function httpOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + return agent; } -function writeH2 (client, session, request) { - const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request +function httpsOverHttps(options) { + var agent = new TunnelingAgent(options); + agent.request = https.request; + agent.createSocket = createSecureSocket; + agent.defaultPort = 443; + return agent; +} - let headers - if (typeof reqHeaders === 'string') headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()) - else headers = reqHeaders - if (upgrade) { - errorRequest(client, request, new Error('Upgrade not supported for H2')) - return false - } +function TunnelingAgent(options) { + var self = this; + self.options = options || {}; + self.proxyOptions = self.options.proxy || {}; + self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; + self.requests = []; + self.sockets = []; - try { - // TODO(HTTP/2): Should we call onConnect immediately or on stream ready event? - request.onConnect((err) => { - if (request.aborted || request.completed) { - return + self.on('free', function onFree(socket, host, port, localAddress) { + var options = toOptions(host, port, localAddress); + for (var i = 0, len = self.requests.length; i < len; ++i) { + var pending = self.requests[i]; + if (pending.host === options.host && pending.port === options.port) { + // Detect the request to connect same origin server, + // reuse the connection. + self.requests.splice(i, 1); + pending.request.onSocket(socket); + return; } + } + socket.destroy(); + self.removeSocket(socket); + }); +} +util.inherits(TunnelingAgent, events.EventEmitter); - errorRequest(client, request, err || new RequestAbortedError()) - }) - } catch (err) { - errorRequest(client, request, err) - } +TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) { + var self = this; + var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress)); - if (request.aborted) { - return false + if (self.sockets.length >= this.maxSockets) { + // We are over limit so we'll add it to the queue. + self.requests.push(options); + return; } - /** @type {import('node:http2').ClientHttp2Stream} */ - let stream - const h2State = client[kHTTP2SessionState] - - headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost] - headers[HTTP2_HEADER_METHOD] = method + // If we are under maxSockets create a new one. + self.createSocket(options, function(socket) { + socket.on('free', onFree); + socket.on('close', onCloseOrRemove); + socket.on('agentRemove', onCloseOrRemove); + req.onSocket(socket); - if (method === 'CONNECT') { - session.ref() - // we are already connected, streams are pending, first request - // will create a new stream. We trigger a request to create the stream and wait until - // `ready` event is triggered - // We disabled endStream to allow the user to write to the stream - stream = session.request(headers, { endStream: false, signal }) + function onFree() { + self.emit('free', socket, options); + } - if (stream.id && !stream.pending) { - request.onUpgrade(null, null, stream) - ++h2State.openStreams - } else { - stream.once('ready', () => { - request.onUpgrade(null, null, stream) - ++h2State.openStreams - }) + function onCloseOrRemove(err) { + self.removeSocket(socket); + socket.removeListener('free', onFree); + socket.removeListener('close', onCloseOrRemove); + socket.removeListener('agentRemove', onCloseOrRemove); } + }); +}; - stream.once('close', () => { - h2State.openStreams -= 1 - // TODO(HTTP/2): unref only if current streams count is 0 - if (h2State.openStreams === 0) session.unref() - }) +TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + var self = this; + var placeholder = {}; + self.sockets.push(placeholder); - return true + var connectOptions = mergeOptions({}, self.proxyOptions, { + method: 'CONNECT', + path: options.host + ':' + options.port, + agent: false, + headers: { + host: options.host + ':' + options.port + } + }); + if (options.localAddress) { + connectOptions.localAddress = options.localAddress; + } + if (connectOptions.proxyAuth) { + connectOptions.headers = connectOptions.headers || {}; + connectOptions.headers['Proxy-Authorization'] = 'Basic ' + + new Buffer(connectOptions.proxyAuth).toString('base64'); } - // https://tools.ietf.org/html/rfc7540#section-8.3 - // :path and :scheme headers must be omited when sending CONNECT - - headers[HTTP2_HEADER_PATH] = path - headers[HTTP2_HEADER_SCHEME] = 'https' - - // https://tools.ietf.org/html/rfc7231#section-4.3.1 - // https://tools.ietf.org/html/rfc7231#section-4.3.2 - // https://tools.ietf.org/html/rfc7231#section-4.3.5 - - // Sending a payload body on a request that does not - // expect it can cause undefined behavior on some - // servers and corrupt connection state. Do not - // re-use the connection for further requests. - - const expectsPayload = ( - method === 'PUT' || - method === 'POST' || - method === 'PATCH' - ) + debug('making CONNECT request'); + var connectReq = self.request(connectOptions); + connectReq.useChunkedEncodingByDefault = false; // for v0.6 + connectReq.once('response', onResponse); // for v0.6 + connectReq.once('upgrade', onUpgrade); // for v0.6 + connectReq.once('connect', onConnect); // for v0.7 or later + connectReq.once('error', onError); + connectReq.end(); - if (body && typeof body.read === 'function') { - // Try to read EOF in order to get length. - body.read(0) + function onResponse(res) { + // Very hacky. This is necessary to avoid http-parser leaks. + res.upgrade = true; } - let contentLength = util.bodyLength(body) - - if (contentLength == null) { - contentLength = request.contentLength + function onUpgrade(res, socket, head) { + // Hacky. + process.nextTick(function() { + onConnect(res, socket, head); + }); } - if (contentLength === 0 || !expectsPayload) { - // https://tools.ietf.org/html/rfc7230#section-3.3.2 - // A user agent SHOULD NOT send a Content-Length header field when - // the request message does not contain a payload body and the method - // semantics do not anticipate such a body. + function onConnect(res, socket, head) { + connectReq.removeAllListeners(); + socket.removeAllListeners(); - contentLength = null + if (res.statusCode !== 200) { + debug('tunneling socket could not be established, statusCode=%d', + res.statusCode); + socket.destroy(); + var error = new Error('tunneling socket could not be established, ' + + 'statusCode=' + res.statusCode); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + if (head.length > 0) { + debug('got illegal response body from proxy'); + socket.destroy(); + var error = new Error('got illegal response body from proxy'); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); + return; + } + debug('tunneling connection has established'); + self.sockets[self.sockets.indexOf(placeholder)] = socket; + return cb(socket); } - // https://github.com/nodejs/undici/issues/2046 - // A user agent may send a Content-Length header with 0 value, this should be allowed. - if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength != null && request.contentLength !== contentLength) { - if (client[kStrictContentLength]) { - errorRequest(client, request, new RequestContentLengthMismatchError()) - return false - } + function onError(cause) { + connectReq.removeAllListeners(); - process.emitWarning(new RequestContentLengthMismatchError()) + debug('tunneling socket could not be established, cause=%s\n', + cause.message, cause.stack); + var error = new Error('tunneling socket could not be established, ' + + 'cause=' + cause.message); + error.code = 'ECONNRESET'; + options.request.emit('error', error); + self.removeSocket(placeholder); } +}; - if (contentLength != null) { - assert(body, 'no body must not have content length') - headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}` +TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { + var pos = this.sockets.indexOf(socket) + if (pos === -1) { + return; } + this.sockets.splice(pos, 1); - session.ref() - - const shouldEndStream = method === 'GET' || method === 'HEAD' - if (expectContinue) { - headers[HTTP2_HEADER_EXPECT] = '100-continue' - stream = session.request(headers, { endStream: shouldEndStream, signal }) - - stream.once('continue', writeBodyH2) - } else { - stream = session.request(headers, { - endStream: shouldEndStream, - signal - }) - writeBodyH2() + var pending = this.requests.shift(); + if (pending) { + // If we have pending requests and a socket gets closed a new one + // needs to be created to take over in the pool for the one that closed. + this.createSocket(pending, function(socket) { + pending.request.onSocket(socket); + }); } +}; - // Increment counter as we have new several streams open - ++h2State.openStreams - - stream.once('response', headers => { - const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers - - if (request.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), '') === false) { - stream.pause() - } - }) +function createSecureSocket(options, cb) { + var self = this; + TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { + var hostHeader = options.request.getHeader('host'); + var tlsOptions = mergeOptions({}, self.options, { + socket: socket, + servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host + }); - stream.once('end', () => { - request.onComplete([]) - }) + // 0 is dummy port for v0.6 + var secureSocket = tls.connect(0, tlsOptions); + self.sockets[self.sockets.indexOf(socket)] = secureSocket; + cb(secureSocket); + }); +} - stream.on('data', (chunk) => { - if (request.onData(chunk) === false) { - stream.pause() - } - }) - stream.once('close', () => { - h2State.openStreams -= 1 - // TODO(HTTP/2): unref only if current streams count is 0 - if (h2State.openStreams === 0) { - session.unref() - } - }) +function toOptions(host, port, localAddress) { + if (typeof host === 'string') { // since v0.10 + return { + host: host, + port: port, + localAddress: localAddress + }; + } + return host; // for v0.11 or later +} - stream.once('error', function (err) { - if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { - h2State.streams -= 1 - util.destroy(stream, err) +function mergeOptions(target) { + for (var i = 1, len = arguments.length; i < len; ++i) { + var overrides = arguments[i]; + if (typeof overrides === 'object') { + var keys = Object.keys(overrides); + for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { + var k = keys[j]; + if (overrides[k] !== undefined) { + target[k] = overrides[k]; + } + } } - }) + } + return target; +} - stream.once('frameError', (type, code) => { - const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`) - errorRequest(client, request, err) - if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { - h2State.streams -= 1 - util.destroy(stream, err) +var debug; +if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { + debug = function() { + var args = Array.prototype.slice.call(arguments); + if (typeof args[0] === 'string') { + args[0] = 'TUNNEL: ' + args[0]; + } else { + args.unshift('TUNNEL:'); } - }) - - // stream.on('aborted', () => { - // // TODO(HTTP/2): Support aborted - // }) - - // stream.on('timeout', () => { - // // TODO(HTTP/2): Support timeout - // }) + console.error.apply(console, args); + } +} else { + debug = function() {}; +} +exports.debug = debug; // for test - // stream.on('push', headers => { - // // TODO(HTTP/2): Suppor push - // }) - // stream.on('trailers', headers => { - // // TODO(HTTP/2): Support trailers - // }) +/***/ }), - return true +/***/ 41773: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - function writeBodyH2 () { - /* istanbul ignore else: assertion */ - if (!body) { - request.onRequestSent() - } else if (util.isBuffer(body)) { - assert(contentLength === body.byteLength, 'buffer body must have content length') - stream.cork() - stream.write(body) - stream.uncork() - stream.end() - request.onBodySent(body) - request.onRequestSent() - } else if (util.isBlobLike(body)) { - if (typeof body.stream === 'function') { - writeIterable({ - client, - request, - contentLength, - h2stream: stream, - expectsPayload, - body: body.stream(), - socket: client[kSocket], - header: '' - }) - } else { - writeBlob({ - body, - client, - request, - contentLength, - expectsPayload, - h2stream: stream, - header: '', - socket: client[kSocket] - }) - } - } else if (util.isStream(body)) { - writeStream({ - body, - client, - request, - contentLength, - expectsPayload, - socket: client[kSocket], - h2stream: stream, - header: '' - }) - } else if (util.isIterable(body)) { - writeIterable({ - body, - client, - request, - contentLength, - expectsPayload, - header: '', - h2stream: stream, - socket: client[kSocket] - }) - } else { - assert(false) - } - } -} +"use strict"; -function writeStream ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { - assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined') - if (client[kHTTPConnVersion] === 'h2') { - // For HTTP/2, is enough to pipe the stream - const pipe = pipeline( - body, - h2stream, - (err) => { - if (err) { - util.destroy(body, err) - util.destroy(h2stream, err) - } else { - request.onRequestSent() - } - } - ) +const Client = __nccwpck_require__(33598) +const Dispatcher = __nccwpck_require__(60412) +const errors = __nccwpck_require__(48045) +const Pool = __nccwpck_require__(4634) +const BalancedPool = __nccwpck_require__(37931) +const Agent = __nccwpck_require__(7890) +const util = __nccwpck_require__(83983) +const { InvalidArgumentError } = errors +const api = __nccwpck_require__(44059) +const buildConnector = __nccwpck_require__(82067) +const MockClient = __nccwpck_require__(58687) +const MockAgent = __nccwpck_require__(66771) +const MockPool = __nccwpck_require__(26193) +const mockErrors = __nccwpck_require__(50888) +const ProxyAgent = __nccwpck_require__(97858) +const RetryHandler = __nccwpck_require__(82286) +const { getGlobalDispatcher, setGlobalDispatcher } = __nccwpck_require__(21892) +const DecoratorHandler = __nccwpck_require__(46930) +const RedirectHandler = __nccwpck_require__(72860) +const createRedirectInterceptor = __nccwpck_require__(38861) - pipe.on('data', onPipeData) - pipe.once('end', () => { - pipe.removeListener('data', onPipeData) - util.destroy(pipe) - }) +let hasCrypto +try { + __nccwpck_require__(6113) + hasCrypto = true +} catch { + hasCrypto = false +} - function onPipeData (chunk) { - request.onBodySent(chunk) - } +Object.assign(Dispatcher.prototype, api) - return - } +module.exports.Dispatcher = Dispatcher +module.exports.Client = Client +module.exports.Pool = Pool +module.exports.BalancedPool = BalancedPool +module.exports.Agent = Agent +module.exports.ProxyAgent = ProxyAgent +module.exports.RetryHandler = RetryHandler - let finished = false +module.exports.DecoratorHandler = DecoratorHandler +module.exports.RedirectHandler = RedirectHandler +module.exports.createRedirectInterceptor = createRedirectInterceptor - const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header }) +module.exports.buildConnector = buildConnector +module.exports.errors = errors - const onData = function (chunk) { - if (finished) { - return +function makeDispatcher (fn) { + return (url, opts, handler) => { + if (typeof opts === 'function') { + handler = opts + opts = null } - try { - if (!writer.write(chunk) && this.pause) { - this.pause() - } - } catch (err) { - util.destroy(this, err) - } - } - const onDrain = function () { - if (finished) { - return + if (!url || (typeof url !== 'string' && typeof url !== 'object' && !(url instanceof URL))) { + throw new InvalidArgumentError('invalid url') } - if (body.resume) { - body.resume() - } - } - const onAbort = function () { - if (finished) { - return - } - const err = new RequestAbortedError() - queueMicrotask(() => onFinished(err)) - } - const onFinished = function (err) { - if (finished) { - return + if (opts != null && typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') } - finished = true - - assert(socket.destroyed || (socket[kWriting] && client[kRunning] <= 1)) - - socket - .off('drain', onDrain) - .off('error', onFinished) + if (opts && opts.path != null) { + if (typeof opts.path !== 'string') { + throw new InvalidArgumentError('invalid opts.path') + } - body - .removeListener('data', onData) - .removeListener('end', onFinished) - .removeListener('error', onFinished) - .removeListener('close', onAbort) + let path = opts.path + if (!opts.path.startsWith('/')) { + path = `/${path}` + } - if (!err) { - try { - writer.end() - } catch (er) { - err = er + url = new URL(util.parseOrigin(url).origin + path) + } else { + if (!opts) { + opts = typeof url === 'object' ? url : {} } + + url = util.parseURL(url) } - writer.destroy(err) + const { agent, dispatcher = getGlobalDispatcher() } = opts - if (err && (err.code !== 'UND_ERR_INFO' || err.message !== 'reset')) { - util.destroy(body, err) - } else { - util.destroy(body) + if (agent) { + throw new InvalidArgumentError('unsupported opts.agent. Did you mean opts.client?') } - } - - body - .on('data', onData) - .on('end', onFinished) - .on('error', onFinished) - .on('close', onAbort) - if (body.resume) { - body.resume() + return fn.call(dispatcher, { + ...opts, + origin: url.origin, + path: url.search ? `${url.pathname}${url.search}` : url.pathname, + method: opts.method || (opts.body ? 'PUT' : 'GET') + }, handler) } - - socket - .on('drain', onDrain) - .on('error', onFinished) } -async function writeBlob ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { - assert(contentLength === body.size, 'blob body must have content length') +module.exports.setGlobalDispatcher = setGlobalDispatcher +module.exports.getGlobalDispatcher = getGlobalDispatcher - const isH2 = client[kHTTPConnVersion] === 'h2' - try { - if (contentLength != null && contentLength !== body.size) { - throw new RequestContentLengthMismatchError() +if (util.nodeMajor > 16 || (util.nodeMajor === 16 && util.nodeMinor >= 8)) { + let fetchImpl = null + module.exports.fetch = async function fetch (resource) { + if (!fetchImpl) { + fetchImpl = (__nccwpck_require__(74881).fetch) } - const buffer = Buffer.from(await body.arrayBuffer()) + try { + return await fetchImpl(...arguments) + } catch (err) { + if (typeof err === 'object') { + Error.captureStackTrace(err, this) + } - if (isH2) { - h2stream.cork() - h2stream.write(buffer) - h2stream.uncork() - } else { - socket.cork() - socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') - socket.write(buffer) - socket.uncork() + throw err } + } + module.exports.Headers = __nccwpck_require__(10554).Headers + module.exports.Response = __nccwpck_require__(27823).Response + module.exports.Request = __nccwpck_require__(48359).Request + module.exports.FormData = __nccwpck_require__(72015).FormData + module.exports.File = __nccwpck_require__(78511).File + module.exports.FileReader = __nccwpck_require__(1446).FileReader - request.onBodySent(buffer) - request.onRequestSent() + const { setGlobalOrigin, getGlobalOrigin } = __nccwpck_require__(71246) - if (!expectsPayload) { - socket[kReset] = true - } + module.exports.setGlobalOrigin = setGlobalOrigin + module.exports.getGlobalOrigin = getGlobalOrigin - resume(client) - } catch (err) { - util.destroy(isH2 ? h2stream : socket, err) - } + const { CacheStorage } = __nccwpck_require__(37907) + const { kConstruct } = __nccwpck_require__(29174) + + // Cache & CacheStorage are tightly coupled with fetch. Even if it may run + // in an older version of Node, it doesn't have any use without fetch. + module.exports.caches = new CacheStorage(kConstruct) } -async function writeIterable ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { - assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined') +if (util.nodeMajor >= 16) { + const { deleteCookie, getCookies, getSetCookies, setCookie } = __nccwpck_require__(41724) - let callback = null - function onDrain () { - if (callback) { - const cb = callback - callback = null - cb() - } - } + module.exports.deleteCookie = deleteCookie + module.exports.getCookies = getCookies + module.exports.getSetCookies = getSetCookies + module.exports.setCookie = setCookie - const waitForDrain = () => new Promise((resolve, reject) => { - assert(callback === null) + const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) - if (socket[kError]) { - reject(socket[kError]) - } else { - callback = resolve - } - }) + module.exports.parseMIMEType = parseMIMEType + module.exports.serializeAMimeType = serializeAMimeType +} - if (client[kHTTPConnVersion] === 'h2') { - h2stream - .on('close', onDrain) - .on('drain', onDrain) +if (util.nodeMajor >= 18 && hasCrypto) { + const { WebSocket } = __nccwpck_require__(54284) - try { - // It's up to the user to somehow abort the async iterable. - for await (const chunk of body) { - if (socket[kError]) { - throw socket[kError] - } + module.exports.WebSocket = WebSocket +} - const res = h2stream.write(chunk) - request.onBodySent(chunk) - if (!res) { - await waitForDrain() - } - } - } catch (err) { - h2stream.destroy(err) - } finally { - request.onRequestSent() - h2stream.end() - h2stream - .off('close', onDrain) - .off('drain', onDrain) - } +module.exports.request = makeDispatcher(api.request) +module.exports.stream = makeDispatcher(api.stream) +module.exports.pipeline = makeDispatcher(api.pipeline) +module.exports.connect = makeDispatcher(api.connect) +module.exports.upgrade = makeDispatcher(api.upgrade) - return - } +module.exports.MockClient = MockClient +module.exports.MockPool = MockPool +module.exports.MockAgent = MockAgent +module.exports.mockErrors = mockErrors - socket - .on('close', onDrain) - .on('drain', onDrain) - const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header }) - try { - // It's up to the user to somehow abort the async iterable. - for await (const chunk of body) { - if (socket[kError]) { - throw socket[kError] - } +/***/ }), - if (!writer.write(chunk)) { - await waitForDrain() - } - } +/***/ 7890: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - writer.end() - } catch (err) { - writer.destroy(err) - } finally { - socket - .off('close', onDrain) - .off('drain', onDrain) - } -} +"use strict"; -class AsyncWriter { - constructor ({ socket, request, contentLength, client, expectsPayload, header }) { - this.socket = socket - this.request = request - this.contentLength = contentLength - this.client = client - this.bytesWritten = 0 - this.expectsPayload = expectsPayload - this.header = header - socket[kWriting] = true - } +const { InvalidArgumentError } = __nccwpck_require__(48045) +const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(72785) +const DispatcherBase = __nccwpck_require__(74839) +const Pool = __nccwpck_require__(4634) +const Client = __nccwpck_require__(33598) +const util = __nccwpck_require__(83983) +const createRedirectInterceptor = __nccwpck_require__(38861) +const { WeakRef, FinalizationRegistry } = __nccwpck_require__(56436)() - write (chunk) { - const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this +const kOnConnect = Symbol('onConnect') +const kOnDisconnect = Symbol('onDisconnect') +const kOnConnectionError = Symbol('onConnectionError') +const kMaxRedirections = Symbol('maxRedirections') +const kOnDrain = Symbol('onDrain') +const kFactory = Symbol('factory') +const kFinalizer = Symbol('finalizer') +const kOptions = Symbol('options') - if (socket[kError]) { - throw socket[kError] - } +function defaultFactory (origin, opts) { + return opts && opts.connections === 1 + ? new Client(origin, opts) + : new Pool(origin, opts) +} - if (socket.destroyed) { - return false +class Agent extends DispatcherBase { + constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) { + super() + + if (typeof factory !== 'function') { + throw new InvalidArgumentError('factory must be a function.') } - const len = Buffer.byteLength(chunk) - if (!len) { - return true + if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { + throw new InvalidArgumentError('connect must be a function or an object') } - // We should defer writing chunks. - if (contentLength !== null && bytesWritten + len > contentLength) { - if (client[kStrictContentLength]) { - throw new RequestContentLengthMismatchError() - } + if (!Number.isInteger(maxRedirections) || maxRedirections < 0) { + throw new InvalidArgumentError('maxRedirections must be a positive number') + } - process.emitWarning(new RequestContentLengthMismatchError()) + if (connect && typeof connect !== 'function') { + connect = { ...connect } } - socket.cork() + this[kInterceptors] = options.interceptors && options.interceptors.Agent && Array.isArray(options.interceptors.Agent) + ? options.interceptors.Agent + : [createRedirectInterceptor({ maxRedirections })] - if (bytesWritten === 0) { - if (!expectsPayload) { - socket[kReset] = true + this[kOptions] = { ...util.deepClone(options), connect } + this[kOptions].interceptors = options.interceptors + ? { ...options.interceptors } + : undefined + this[kMaxRedirections] = maxRedirections + this[kFactory] = factory + this[kClients] = new Map() + this[kFinalizer] = new FinalizationRegistry(/* istanbul ignore next: gc is undeterministic */ key => { + const ref = this[kClients].get(key) + if (ref !== undefined && ref.deref() === undefined) { + this[kClients].delete(key) } + }) - if (contentLength === null) { - socket.write(`${header}transfer-encoding: chunked\r\n`, 'latin1') - } else { - socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') - } - } + const agent = this - if (contentLength === null) { - socket.write(`\r\n${len.toString(16)}\r\n`, 'latin1') + this[kOnDrain] = (origin, targets) => { + agent.emit('drain', origin, [agent, ...targets]) } - this.bytesWritten += len - - const ret = socket.write(chunk) + this[kOnConnect] = (origin, targets) => { + agent.emit('connect', origin, [agent, ...targets]) + } - socket.uncork() + this[kOnDisconnect] = (origin, targets, err) => { + agent.emit('disconnect', origin, [agent, ...targets], err) + } - request.onBodySent(chunk) + this[kOnConnectionError] = (origin, targets, err) => { + agent.emit('connectionError', origin, [agent, ...targets], err) + } + } - if (!ret) { - if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { - // istanbul ignore else: only for jest - if (socket[kParser].timeout.refresh) { - socket[kParser].timeout.refresh() - } + get [kRunning] () { + let ret = 0 + for (const ref of this[kClients].values()) { + const client = ref.deref() + /* istanbul ignore next: gc is undeterministic */ + if (client) { + ret += client[kRunning] } } - return ret } - end () { - const { socket, contentLength, client, bytesWritten, expectsPayload, header, request } = this - request.onRequestSent() - - socket[kWriting] = false - - if (socket[kError]) { - throw socket[kError] + [kDispatch] (opts, handler) { + let key + if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) { + key = String(opts.origin) + } else { + throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.') } - if (socket.destroyed) { - return - } + const ref = this[kClients].get(key) - if (bytesWritten === 0) { - if (expectsPayload) { - // https://tools.ietf.org/html/rfc7230#section-3.3.2 - // A user agent SHOULD send a Content-Length in a request message when - // no Transfer-Encoding is sent and the request method defines a meaning - // for an enclosed payload body. + let dispatcher = ref ? ref.deref() : null + if (!dispatcher) { + dispatcher = this[kFactory](opts.origin, this[kOptions]) + .on('drain', this[kOnDrain]) + .on('connect', this[kOnConnect]) + .on('disconnect', this[kOnDisconnect]) + .on('connectionError', this[kOnConnectionError]) - socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1') - } else { - socket.write(`${header}\r\n`, 'latin1') - } - } else if (contentLength === null) { - socket.write('\r\n0\r\n\r\n', 'latin1') + this[kClients].set(key, new WeakRef(dispatcher)) + this[kFinalizer].register(dispatcher, key) } - if (contentLength !== null && bytesWritten !== contentLength) { - if (client[kStrictContentLength]) { - throw new RequestContentLengthMismatchError() - } else { - process.emitWarning(new RequestContentLengthMismatchError()) - } - } + return dispatcher.dispatch(opts, handler) + } - if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { - // istanbul ignore else: only for jest - if (socket[kParser].timeout.refresh) { - socket[kParser].timeout.refresh() + async [kClose] () { + const closePromises = [] + for (const ref of this[kClients].values()) { + const client = ref.deref() + /* istanbul ignore else: gc is undeterministic */ + if (client) { + closePromises.push(client.close()) } } - resume(client) + await Promise.all(closePromises) } - destroy (err) { - const { socket, client } = this - - socket[kWriting] = false - - if (err) { - assert(client[kRunning] <= 1, 'pipeline should only contain this request') - util.destroy(socket, err) + async [kDestroy] (err) { + const destroyPromises = [] + for (const ref of this[kClients].values()) { + const client = ref.deref() + /* istanbul ignore else: gc is undeterministic */ + if (client) { + destroyPromises.push(client.destroy(err)) + } } - } -} -function errorRequest (client, request, err) { - try { - request.onError(err) - assert(request.aborted) - } catch (err) { - client.emit('error', err) + await Promise.all(destroyPromises) } } -module.exports = Client +module.exports = Agent /***/ }), -/***/ 56436: +/***/ 7032: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +const { addAbortListener } = __nccwpck_require__(83983) +const { RequestAbortedError } = __nccwpck_require__(48045) +const kListener = Symbol('kListener') +const kSignal = Symbol('kSignal') -/* istanbul ignore file: only for Node 12 */ +function abort (self) { + if (self.abort) { + self.abort() + } else { + self.onError(new RequestAbortedError()) + } +} -const { kConnected, kSize } = __nccwpck_require__(72785) +function addSignal (self, signal) { + self[kSignal] = null + self[kListener] = null -class CompatWeakRef { - constructor (value) { - this.value = value + if (!signal) { + return } - deref () { - return this.value[kConnected] === 0 && this.value[kSize] === 0 - ? undefined - : this.value + if (signal.aborted) { + abort(self) + return } -} -class CompatFinalizer { - constructor (finalizer) { - this.finalizer = finalizer + self[kSignal] = signal + self[kListener] = () => { + abort(self) } - register (dispatcher, key) { - if (dispatcher.on) { - dispatcher.on('disconnect', () => { - if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { - this.finalizer(key) - } - }) - } - } + addAbortListener(self[kSignal], self[kListener]) } -module.exports = function () { - // FIXME: remove workaround when the Node bug is fixed - // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308 - if (process.env.NODE_V8_COVERAGE) { - return { - WeakRef: CompatWeakRef, - FinalizationRegistry: CompatFinalizer - } - } - return { - WeakRef: global.WeakRef || CompatWeakRef, - FinalizationRegistry: global.FinalizationRegistry || CompatFinalizer +function removeSignal (self) { + if (!self[kSignal]) { + return } -} - - -/***/ }), - -/***/ 20663: -/***/ ((module) => { - -"use strict"; - -// https://wicg.github.io/cookie-store/#cookie-maximum-attribute-value-size -const maxAttributeValueSize = 1024 + if ('removeEventListener' in self[kSignal]) { + self[kSignal].removeEventListener('abort', self[kListener]) + } else { + self[kSignal].removeListener('abort', self[kListener]) + } -// https://wicg.github.io/cookie-store/#cookie-maximum-name-value-pair-size -const maxNameValuePairSize = 4096 + self[kSignal] = null + self[kListener] = null +} module.exports = { - maxAttributeValueSize, - maxNameValuePairSize + addSignal, + removeSignal } /***/ }), -/***/ 41724: +/***/ 29744: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { parseSetCookie } = __nccwpck_require__(24408) -const { stringify } = __nccwpck_require__(43121) -const { webidl } = __nccwpck_require__(21744) -const { Headers } = __nccwpck_require__(10554) +const { AsyncResource } = __nccwpck_require__(50852) +const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(48045) +const util = __nccwpck_require__(83983) +const { addSignal, removeSignal } = __nccwpck_require__(7032) -/** - * @typedef {Object} Cookie - * @property {string} name - * @property {string} value - * @property {Date|number|undefined} expires - * @property {number|undefined} maxAge - * @property {string|undefined} domain - * @property {string|undefined} path - * @property {boolean|undefined} secure - * @property {boolean|undefined} httpOnly - * @property {'Strict'|'Lax'|'None'} sameSite - * @property {string[]} unparsed - */ +class ConnectHandler extends AsyncResource { + constructor (opts, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } -/** - * @param {Headers} headers - * @returns {Record} - */ -function getCookies (headers) { - webidl.argumentLengthCheck(arguments, 1, { header: 'getCookies' }) + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } - webidl.brandCheck(headers, Headers, { strict: false }) + const { signal, opaque, responseHeaders } = opts - const cookie = headers.get('cookie') - const out = {} + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } - if (!cookie) { - return out - } + super('UNDICI_CONNECT') - for (const piece of cookie.split(';')) { - const [name, ...value] = piece.split('=') + this.opaque = opaque || null + this.responseHeaders = responseHeaders || null + this.callback = callback + this.abort = null - out[name.trim()] = value.join('=') + addSignal(this, signal) } - return out -} - -/** - * @param {Headers} headers - * @param {string} name - * @param {{ path?: string, domain?: string }|undefined} attributes - * @returns {void} - */ -function deleteCookie (headers, name, attributes) { - webidl.argumentLengthCheck(arguments, 2, { header: 'deleteCookie' }) + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } - webidl.brandCheck(headers, Headers, { strict: false }) + this.abort = abort + this.context = context + } - name = webidl.converters.DOMString(name) - attributes = webidl.converters.DeleteCookieAttributes(attributes) + onHeaders () { + throw new SocketError('bad connect', null) + } - // Matches behavior of - // https://github.com/denoland/deno_std/blob/63827b16330b82489a04614027c33b7904e08be5/http/cookie.ts#L278 - setCookie(headers, { - name, - value: '', - expires: new Date(0), - ...attributes - }) -} + onUpgrade (statusCode, rawHeaders, socket) { + const { callback, opaque, context } = this -/** - * @param {Headers} headers - * @returns {Cookie[]} - */ -function getSetCookies (headers) { - webidl.argumentLengthCheck(arguments, 1, { header: 'getSetCookies' }) + removeSignal(this) - webidl.brandCheck(headers, Headers, { strict: false }) + this.callback = null - const cookies = headers.getSetCookie() + let headers = rawHeaders + // Indicates is an HTTP2Session + if (headers != null) { + headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + } - if (!cookies) { - return [] + this.runInAsyncScope(callback, null, null, { + statusCode, + headers, + socket, + opaque, + context + }) } - return cookies.map((pair) => parseSetCookie(pair)) -} - -/** - * @param {Headers} headers - * @param {Cookie} cookie - * @returns {void} - */ -function setCookie (headers, cookie) { - webidl.argumentLengthCheck(arguments, 2, { header: 'setCookie' }) - - webidl.brandCheck(headers, Headers, { strict: false }) - - cookie = webidl.converters.Cookie(cookie) + onError (err) { + const { callback, opaque } = this - const str = stringify(cookie) + removeSignal(this) - if (str) { - headers.append('Set-Cookie', stringify(cookie)) + if (callback) { + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } } } -webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([ - { - converter: webidl.nullableConverter(webidl.converters.DOMString), - key: 'path', - defaultValue: null - }, - { - converter: webidl.nullableConverter(webidl.converters.DOMString), - key: 'domain', - defaultValue: null +function connect (opts, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + connect.call(this, opts, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) } -]) - -webidl.converters.Cookie = webidl.dictionaryConverter([ - { - converter: webidl.converters.DOMString, - key: 'name' - }, - { - converter: webidl.converters.DOMString, - key: 'value' - }, - { - converter: webidl.nullableConverter((value) => { - if (typeof value === 'number') { - return webidl.converters['unsigned long long'](value) - } - return new Date(value) - }), - key: 'expires', - defaultValue: null - }, - { - converter: webidl.nullableConverter(webidl.converters['long long']), - key: 'maxAge', - defaultValue: null - }, - { - converter: webidl.nullableConverter(webidl.converters.DOMString), - key: 'domain', - defaultValue: null - }, - { - converter: webidl.nullableConverter(webidl.converters.DOMString), - key: 'path', - defaultValue: null - }, - { - converter: webidl.nullableConverter(webidl.converters.boolean), - key: 'secure', - defaultValue: null - }, - { - converter: webidl.nullableConverter(webidl.converters.boolean), - key: 'httpOnly', - defaultValue: null - }, - { - converter: webidl.converters.USVString, - key: 'sameSite', - allowedValues: ['Strict', 'Lax', 'None'] - }, - { - converter: webidl.sequenceConverter(webidl.converters.DOMString), - key: 'unparsed', - defaultValue: [] + try { + const connectHandler = new ConnectHandler(opts, callback) + this.dispatch({ ...opts, method: 'CONNECT' }, connectHandler) + } catch (err) { + if (typeof callback !== 'function') { + throw err + } + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) } -]) - -module.exports = { - getCookies, - deleteCookie, - getSetCookies, - setCookie } +module.exports = connect + /***/ }), -/***/ 24408: +/***/ 28752: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(20663) -const { isCTLExcludingHtab } = __nccwpck_require__(43121) -const { collectASequenceOfCodePointsFast } = __nccwpck_require__(685) +const { + Readable, + Duplex, + PassThrough +} = __nccwpck_require__(12781) +const { + InvalidArgumentError, + InvalidReturnValueError, + RequestAbortedError +} = __nccwpck_require__(48045) +const util = __nccwpck_require__(83983) +const { AsyncResource } = __nccwpck_require__(50852) +const { addSignal, removeSignal } = __nccwpck_require__(7032) const assert = __nccwpck_require__(39491) -/** - * @description Parses the field-value attributes of a set-cookie header string. - * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4 - * @param {string} header - * @returns if the header is invalid, null will be returned - */ -function parseSetCookie (header) { - // 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F - // character (CTL characters excluding HTAB): Abort these steps and - // ignore the set-cookie-string entirely. - if (isCTLExcludingHtab(header)) { - return null +const kResume = Symbol('resume') + +class PipelineRequest extends Readable { + constructor () { + super({ autoDestroy: true }) + + this[kResume] = null } - let nameValuePair = '' - let unparsedAttributes = '' - let name = '' - let value = '' + _read () { + const { [kResume]: resume } = this - // 2. If the set-cookie-string contains a %x3B (";") character: - if (header.includes(';')) { - // 1. The name-value-pair string consists of the characters up to, - // but not including, the first %x3B (";"), and the unparsed- - // attributes consist of the remainder of the set-cookie-string - // (including the %x3B (";") in question). - const position = { position: 0 } + if (resume) { + this[kResume] = null + resume() + } + } - nameValuePair = collectASequenceOfCodePointsFast(';', header, position) - unparsedAttributes = header.slice(position.position) - } else { - // Otherwise: + _destroy (err, callback) { + this._read() - // 1. The name-value-pair string consists of all the characters - // contained in the set-cookie-string, and the unparsed- - // attributes is the empty string. - nameValuePair = header + callback(err) } +} - // 3. If the name-value-pair string lacks a %x3D ("=") character, then - // the name string is empty, and the value string is the value of - // name-value-pair. - if (!nameValuePair.includes('=')) { - value = nameValuePair - } else { - // Otherwise, the name string consists of the characters up to, but - // not including, the first %x3D ("=") character, and the (possibly - // empty) value string consists of the characters after the first - // %x3D ("=") character. - const position = { position: 0 } - name = collectASequenceOfCodePointsFast( - '=', - nameValuePair, - position - ) - value = nameValuePair.slice(position.position + 1) +class PipelineResponse extends Readable { + constructor (resume) { + super({ autoDestroy: true }) + this[kResume] = resume } - // 4. Remove any leading or trailing WSP characters from the name - // string and the value string. - name = name.trim() - value = value.trim() - - // 5. If the sum of the lengths of the name string and the value string - // is more than 4096 octets, abort these steps and ignore the set- - // cookie-string entirely. - if (name.length + value.length > maxNameValuePairSize) { - return null + _read () { + this[kResume]() } - // 6. The cookie-name is the name string, and the cookie-value is the - // value string. - return { - name, value, ...parseUnparsedAttributes(unparsedAttributes) + _destroy (err, callback) { + if (!err && !this._readableState.endEmitted) { + err = new RequestAbortedError() + } + + callback(err) } } -/** - * Parses the remaining attributes of a set-cookie header - * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4 - * @param {string} unparsedAttributes - * @param {[Object.]={}} cookieAttributeList - */ -function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {}) { - // 1. If the unparsed-attributes string is empty, skip the rest of - // these steps. - if (unparsedAttributes.length === 0) { - return cookieAttributeList - } +class PipelineHandler extends AsyncResource { + constructor (opts, handler) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } - // 2. Discard the first character of the unparsed-attributes (which - // will be a %x3B (";") character). - assert(unparsedAttributes[0] === ';') - unparsedAttributes = unparsedAttributes.slice(1) + if (typeof handler !== 'function') { + throw new InvalidArgumentError('invalid handler') + } - let cookieAv = '' + const { signal, method, opaque, onInfo, responseHeaders } = opts - // 3. If the remaining unparsed-attributes contains a %x3B (";") - // character: - if (unparsedAttributes.includes(';')) { - // 1. Consume the characters of the unparsed-attributes up to, but - // not including, the first %x3B (";") character. - cookieAv = collectASequenceOfCodePointsFast( - ';', - unparsedAttributes, - { position: 0 } - ) - unparsedAttributes = unparsedAttributes.slice(cookieAv.length) - } else { - // Otherwise: + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } - // 1. Consume the remainder of the unparsed-attributes. - cookieAv = unparsedAttributes - unparsedAttributes = '' - } + if (method === 'CONNECT') { + throw new InvalidArgumentError('invalid method') + } - // Let the cookie-av string be the characters consumed in this step. + if (onInfo && typeof onInfo !== 'function') { + throw new InvalidArgumentError('invalid onInfo callback') + } - let attributeName = '' - let attributeValue = '' + super('UNDICI_PIPELINE') - // 4. If the cookie-av string contains a %x3D ("=") character: - if (cookieAv.includes('=')) { - // 1. The (possibly empty) attribute-name string consists of the - // characters up to, but not including, the first %x3D ("=") - // character, and the (possibly empty) attribute-value string - // consists of the characters after the first %x3D ("=") - // character. - const position = { position: 0 } + this.opaque = opaque || null + this.responseHeaders = responseHeaders || null + this.handler = handler + this.abort = null + this.context = null + this.onInfo = onInfo || null - attributeName = collectASequenceOfCodePointsFast( - '=', - cookieAv, - position - ) - attributeValue = cookieAv.slice(position.position + 1) - } else { - // Otherwise: + this.req = new PipelineRequest().on('error', util.nop) - // 1. The attribute-name string consists of the entire cookie-av - // string, and the attribute-value string is empty. - attributeName = cookieAv - } + this.ret = new Duplex({ + readableObjectMode: opts.objectMode, + autoDestroy: true, + read: () => { + const { body } = this - // 5. Remove any leading or trailing WSP characters from the attribute- - // name string and the attribute-value string. - attributeName = attributeName.trim() - attributeValue = attributeValue.trim() + if (body && body.resume) { + body.resume() + } + }, + write: (chunk, encoding, callback) => { + const { req } = this - // 6. If the attribute-value is longer than 1024 octets, ignore the - // cookie-av string and return to Step 1 of this algorithm. - if (attributeValue.length > maxAttributeValueSize) { - return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) - } + if (req.push(chunk, encoding) || req._readableState.destroyed) { + callback() + } else { + req[kResume] = callback + } + }, + destroy: (err, callback) => { + const { body, req, res, ret, abort } = this - // 7. Process the attribute-name and attribute-value according to the - // requirements in the following subsections. (Notice that - // attributes with unrecognized attribute-names are ignored.) - const attributeNameLowercase = attributeName.toLowerCase() + if (!err && !ret._readableState.endEmitted) { + err = new RequestAbortedError() + } - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.1 - // If the attribute-name case-insensitively matches the string - // "Expires", the user agent MUST process the cookie-av as follows. - if (attributeNameLowercase === 'expires') { - // 1. Let the expiry-time be the result of parsing the attribute-value - // as cookie-date (see Section 5.1.1). - const expiryTime = new Date(attributeValue) + if (abort && err) { + abort() + } - // 2. If the attribute-value failed to parse as a cookie date, ignore - // the cookie-av. + util.destroy(body, err) + util.destroy(req, err) + util.destroy(res, err) - cookieAttributeList.expires = expiryTime - } else if (attributeNameLowercase === 'max-age') { - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.2 - // If the attribute-name case-insensitively matches the string "Max- - // Age", the user agent MUST process the cookie-av as follows. + removeSignal(this) - // 1. If the first character of the attribute-value is not a DIGIT or a - // "-" character, ignore the cookie-av. - const charCode = attributeValue.charCodeAt(0) + callback(err) + } + }).on('prefinish', () => { + const { req } = this - if ((charCode < 48 || charCode > 57) && attributeValue[0] !== '-') { - return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) - } + // Node < 15 does not call _final in same tick. + req.push(null) + }) - // 2. If the remainder of attribute-value contains a non-DIGIT - // character, ignore the cookie-av. - if (!/^\d+$/.test(attributeValue)) { - return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) - } + this.res = null - // 3. Let delta-seconds be the attribute-value converted to an integer. - const deltaSeconds = Number(attributeValue) + addSignal(this, signal) + } - // 4. Let cookie-age-limit be the maximum age of the cookie (which - // SHOULD be 400 days or less, see Section 4.1.2.2). + onConnect (abort, context) { + const { ret, res } = this - // 5. Set delta-seconds to the smaller of its present value and cookie- - // age-limit. - // deltaSeconds = Math.min(deltaSeconds * 1000, maxExpiresMs) + assert(!res, 'pipeline cannot be retried') - // 6. If delta-seconds is less than or equal to zero (0), let expiry- - // time be the earliest representable date and time. Otherwise, let - // the expiry-time be the current date and time plus delta-seconds - // seconds. - // const expiryTime = deltaSeconds <= 0 ? Date.now() : Date.now() + deltaSeconds + if (ret.destroyed) { + throw new RequestAbortedError() + } - // 7. Append an attribute to the cookie-attribute-list with an - // attribute-name of Max-Age and an attribute-value of expiry-time. - cookieAttributeList.maxAge = deltaSeconds - } else if (attributeNameLowercase === 'domain') { - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.3 - // If the attribute-name case-insensitively matches the string "Domain", - // the user agent MUST process the cookie-av as follows. + this.abort = abort + this.context = context + } - // 1. Let cookie-domain be the attribute-value. - let cookieDomain = attributeValue + onHeaders (statusCode, rawHeaders, resume) { + const { opaque, handler, context } = this - // 2. If cookie-domain starts with %x2E ("."), let cookie-domain be - // cookie-domain without its leading %x2E ("."). - if (cookieDomain[0] === '.') { - cookieDomain = cookieDomain.slice(1) + if (statusCode < 200) { + if (this.onInfo) { + const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + this.onInfo({ statusCode, headers }) + } + return } - // 3. Convert the cookie-domain to lower case. - cookieDomain = cookieDomain.toLowerCase() - - // 4. Append an attribute to the cookie-attribute-list with an - // attribute-name of Domain and an attribute-value of cookie-domain. - cookieAttributeList.domain = cookieDomain - } else if (attributeNameLowercase === 'path') { - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.4 - // If the attribute-name case-insensitively matches the string "Path", - // the user agent MUST process the cookie-av as follows. - - // 1. If the attribute-value is empty or if the first character of the - // attribute-value is not %x2F ("/"): - let cookiePath = '' - if (attributeValue.length === 0 || attributeValue[0] !== '/') { - // 1. Let cookie-path be the default-path. - cookiePath = '/' - } else { - // Otherwise: + this.res = new PipelineResponse(resume) - // 1. Let cookie-path be the attribute-value. - cookiePath = attributeValue + let body + try { + this.handler = null + const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + body = this.runInAsyncScope(handler, null, { + statusCode, + headers, + opaque, + body: this.res, + context + }) + } catch (err) { + this.res.on('error', util.nop) + throw err } - // 2. Append an attribute to the cookie-attribute-list with an - // attribute-name of Path and an attribute-value of cookie-path. - cookieAttributeList.path = cookiePath - } else if (attributeNameLowercase === 'secure') { - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.5 - // If the attribute-name case-insensitively matches the string "Secure", - // the user agent MUST append an attribute to the cookie-attribute-list - // with an attribute-name of Secure and an empty attribute-value. + if (!body || typeof body.on !== 'function') { + throw new InvalidReturnValueError('expected Readable') + } - cookieAttributeList.secure = true - } else if (attributeNameLowercase === 'httponly') { - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.6 - // If the attribute-name case-insensitively matches the string - // "HttpOnly", the user agent MUST append an attribute to the cookie- - // attribute-list with an attribute-name of HttpOnly and an empty - // attribute-value. + body + .on('data', (chunk) => { + const { ret, body } = this - cookieAttributeList.httpOnly = true - } else if (attributeNameLowercase === 'samesite') { - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.7 - // If the attribute-name case-insensitively matches the string - // "SameSite", the user agent MUST process the cookie-av as follows: + if (!ret.push(chunk) && body.pause) { + body.pause() + } + }) + .on('error', (err) => { + const { ret } = this - // 1. Let enforcement be "Default". - let enforcement = 'Default' + util.destroy(ret, err) + }) + .on('end', () => { + const { ret } = this - const attributeValueLowercase = attributeValue.toLowerCase() - // 2. If cookie-av's attribute-value is a case-insensitive match for - // "None", set enforcement to "None". - if (attributeValueLowercase.includes('none')) { - enforcement = 'None' - } + ret.push(null) + }) + .on('close', () => { + const { ret } = this - // 3. If cookie-av's attribute-value is a case-insensitive match for - // "Strict", set enforcement to "Strict". - if (attributeValueLowercase.includes('strict')) { - enforcement = 'Strict' - } + if (!ret._readableState.ended) { + util.destroy(ret, new RequestAbortedError()) + } + }) - // 4. If cookie-av's attribute-value is a case-insensitive match for - // "Lax", set enforcement to "Lax". - if (attributeValueLowercase.includes('lax')) { - enforcement = 'Lax' - } + this.body = body + } - // 5. Append an attribute to the cookie-attribute-list with an - // attribute-name of "SameSite" and an attribute-value of - // enforcement. - cookieAttributeList.sameSite = enforcement - } else { - cookieAttributeList.unparsed ??= [] + onData (chunk) { + const { res } = this + return res.push(chunk) + } - cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`) + onComplete (trailers) { + const { res } = this + res.push(null) } - // 8. Return to Step 1 of this algorithm. - return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) + onError (err) { + const { ret } = this + this.handler = null + util.destroy(ret, err) + } } -module.exports = { - parseSetCookie, - parseUnparsedAttributes +function pipeline (opts, handler) { + try { + const pipelineHandler = new PipelineHandler(opts, handler) + this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler) + return pipelineHandler.ret + } catch (err) { + return new PassThrough().destroy(err) + } } +module.exports = pipeline + /***/ }), -/***/ 43121: -/***/ ((module) => { +/***/ 55448: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/** - * @param {string} value - * @returns {boolean} - */ -function isCTLExcludingHtab (value) { - if (value.length === 0) { - return false - } - - for (const char of value) { - const code = char.charCodeAt(0) +const Readable = __nccwpck_require__(73858) +const { + InvalidArgumentError, + RequestAbortedError +} = __nccwpck_require__(48045) +const util = __nccwpck_require__(83983) +const { getResolveErrorBodyCallback } = __nccwpck_require__(77474) +const { AsyncResource } = __nccwpck_require__(50852) +const { addSignal, removeSignal } = __nccwpck_require__(7032) - if ( - (code >= 0x00 || code <= 0x08) || - (code >= 0x0A || code <= 0x1F) || - code === 0x7F - ) { - return false +class RequestHandler extends AsyncResource { + constructor (opts, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') } - } -} -/** - CHAR = - token = 1* - separators = "(" | ")" | "<" | ">" | "@" - | "," | ";" | ":" | "\" | <"> - | "/" | "[" | "]" | "?" | "=" - | "{" | "}" | SP | HT - * @param {string} name - */ -function validateCookieName (name) { - for (const char of name) { - const code = char.charCodeAt(0) + const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError, highWaterMark } = opts - if ( - (code <= 0x20 || code > 0x7F) || - char === '(' || - char === ')' || - char === '>' || - char === '<' || - char === '@' || - char === ',' || - char === ';' || - char === ':' || - char === '\\' || - char === '"' || - char === '/' || - char === '[' || - char === ']' || - char === '?' || - char === '=' || - char === '{' || - char === '}' - ) { - throw new Error('Invalid cookie name') - } - } -} + try { + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } -/** - cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) - cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E - ; US-ASCII characters excluding CTLs, - ; whitespace DQUOTE, comma, semicolon, - ; and backslash - * @param {string} value - */ -function validateCookieValue (value) { - for (const char of value) { - const code = char.charCodeAt(0) + if (highWaterMark && (typeof highWaterMark !== 'number' || highWaterMark < 0)) { + throw new InvalidArgumentError('invalid highWaterMark') + } - if ( - code < 0x21 || // exclude CTLs (0-31) - code === 0x22 || - code === 0x2C || - code === 0x3B || - code === 0x5C || - code > 0x7E // non-ascii - ) { - throw new Error('Invalid header value') - } - } -} + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } -/** - * path-value = - * @param {string} path - */ -function validateCookiePath (path) { - for (const char of path) { - const code = char.charCodeAt(0) - - if (code < 0x21 || char === ';') { - throw new Error('Invalid cookie path') - } - } -} + if (method === 'CONNECT') { + throw new InvalidArgumentError('invalid method') + } -/** - * I have no idea why these values aren't allowed to be honest, - * but Deno tests these. - Khafra - * @param {string} domain - */ -function validateCookieDomain (domain) { - if ( - domain.startsWith('-') || - domain.endsWith('.') || - domain.endsWith('-') - ) { - throw new Error('Invalid cookie domain') - } -} + if (onInfo && typeof onInfo !== 'function') { + throw new InvalidArgumentError('invalid onInfo callback') + } -/** - * @see https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1 - * @param {number|Date} date - IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT - ; fixed length/zone/capitalization subset of the format - ; see Section 3.3 of [RFC5322] + super('UNDICI_REQUEST') + } catch (err) { + if (util.isStream(body)) { + util.destroy(body.on('error', util.nop), err) + } + throw err + } - day-name = %x4D.6F.6E ; "Mon", case-sensitive - / %x54.75.65 ; "Tue", case-sensitive - / %x57.65.64 ; "Wed", case-sensitive - / %x54.68.75 ; "Thu", case-sensitive - / %x46.72.69 ; "Fri", case-sensitive - / %x53.61.74 ; "Sat", case-sensitive - / %x53.75.6E ; "Sun", case-sensitive - date1 = day SP month SP year - ; e.g., 02 Jun 1982 + this.responseHeaders = responseHeaders || null + this.opaque = opaque || null + this.callback = callback + this.res = null + this.abort = null + this.body = body + this.trailers = {} + this.context = null + this.onInfo = onInfo || null + this.throwOnError = throwOnError + this.highWaterMark = highWaterMark - day = 2DIGIT - month = %x4A.61.6E ; "Jan", case-sensitive - / %x46.65.62 ; "Feb", case-sensitive - / %x4D.61.72 ; "Mar", case-sensitive - / %x41.70.72 ; "Apr", case-sensitive - / %x4D.61.79 ; "May", case-sensitive - / %x4A.75.6E ; "Jun", case-sensitive - / %x4A.75.6C ; "Jul", case-sensitive - / %x41.75.67 ; "Aug", case-sensitive - / %x53.65.70 ; "Sep", case-sensitive - / %x4F.63.74 ; "Oct", case-sensitive - / %x4E.6F.76 ; "Nov", case-sensitive - / %x44.65.63 ; "Dec", case-sensitive - year = 4DIGIT + if (util.isStream(body)) { + body.on('error', (err) => { + this.onError(err) + }) + } - GMT = %x47.4D.54 ; "GMT", case-sensitive + addSignal(this, signal) + } - time-of-day = hour ":" minute ":" second - ; 00:00:00 - 23:59:60 (leap second) + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } - hour = 2DIGIT - minute = 2DIGIT - second = 2DIGIT - */ -function toIMFDate (date) { - if (typeof date === 'number') { - date = new Date(date) + this.abort = abort + this.context = context } - const days = [ - 'Sun', 'Mon', 'Tue', 'Wed', - 'Thu', 'Fri', 'Sat' - ] + onHeaders (statusCode, rawHeaders, resume, statusMessage) { + const { callback, opaque, abort, context, responseHeaders, highWaterMark } = this - const months = [ - 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', - 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' - ] + const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) - const dayName = days[date.getUTCDay()] - const day = date.getUTCDate().toString().padStart(2, '0') - const month = months[date.getUTCMonth()] - const year = date.getUTCFullYear() - const hour = date.getUTCHours().toString().padStart(2, '0') - const minute = date.getUTCMinutes().toString().padStart(2, '0') - const second = date.getUTCSeconds().toString().padStart(2, '0') + if (statusCode < 200) { + if (this.onInfo) { + this.onInfo({ statusCode, headers }) + } + return + } - return `${dayName}, ${day} ${month} ${year} ${hour}:${minute}:${second} GMT` -} + const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers + const contentType = parsedHeaders['content-type'] + const body = new Readable({ resume, abort, contentType, highWaterMark }) -/** - max-age-av = "Max-Age=" non-zero-digit *DIGIT - ; In practice, both expires-av and max-age-av - ; are limited to dates representable by the - ; user agent. - * @param {number} maxAge - */ -function validateCookieMaxAge (maxAge) { - if (maxAge < 0) { - throw new Error('Invalid cookie max-age') + this.callback = null + this.res = body + if (callback !== null) { + if (this.throwOnError && statusCode >= 400) { + this.runInAsyncScope(getResolveErrorBodyCallback, null, + { callback, body, contentType, statusCode, statusMessage, headers } + ) + } else { + this.runInAsyncScope(callback, null, null, { + statusCode, + headers, + trailers: this.trailers, + opaque, + body, + context + }) + } + } } -} -/** - * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1 - * @param {import('./index').Cookie} cookie - */ -function stringify (cookie) { - if (cookie.name.length === 0) { - return null + onData (chunk) { + const { res } = this + return res.push(chunk) } - validateCookieName(cookie.name) - validateCookieValue(cookie.value) - - const out = [`${cookie.name}=${cookie.value}`] + onComplete (trailers) { + const { res } = this - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1 - // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2 - if (cookie.name.startsWith('__Secure-')) { - cookie.secure = true - } + removeSignal(this) - if (cookie.name.startsWith('__Host-')) { - cookie.secure = true - cookie.domain = null - cookie.path = '/' - } + util.parseHeaders(trailers, this.trailers) - if (cookie.secure) { - out.push('Secure') + res.push(null) } - if (cookie.httpOnly) { - out.push('HttpOnly') - } + onError (err) { + const { res, callback, body, opaque } = this - if (typeof cookie.maxAge === 'number') { - validateCookieMaxAge(cookie.maxAge) - out.push(`Max-Age=${cookie.maxAge}`) - } + removeSignal(this) - if (cookie.domain) { - validateCookieDomain(cookie.domain) - out.push(`Domain=${cookie.domain}`) - } + if (callback) { + // TODO: Does this need queueMicrotask? + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } - if (cookie.path) { - validateCookiePath(cookie.path) - out.push(`Path=${cookie.path}`) - } + if (res) { + this.res = null + // Ensure all queued handlers are invoked before destroying res. + queueMicrotask(() => { + util.destroy(res, err) + }) + } - if (cookie.expires && cookie.expires.toString() !== 'Invalid Date') { - out.push(`Expires=${toIMFDate(cookie.expires)}`) + if (body) { + this.body = null + util.destroy(body, err) + } } +} - if (cookie.sameSite) { - out.push(`SameSite=${cookie.sameSite}`) +function request (opts, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + request.call(this, opts, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) } - for (const part of cookie.unparsed) { - if (!part.includes('=')) { - throw new Error('Invalid unparsed') + try { + this.dispatch(opts, new RequestHandler(opts, callback)) + } catch (err) { + if (typeof callback !== 'function') { + throw err } - - const [key, ...value] = part.split('=') - - out.push(`${key.trim()}=${value.join('=')}`) + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) } - - return out.join('; ') } -module.exports = { - isCTLExcludingHtab, - validateCookieName, - validateCookiePath, - validateCookieValue, - toIMFDate, - stringify -} +module.exports = request +module.exports.RequestHandler = RequestHandler /***/ }), -/***/ 82067: +/***/ 75395: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const net = __nccwpck_require__(41808) -const assert = __nccwpck_require__(39491) +const { finished, PassThrough } = __nccwpck_require__(12781) +const { + InvalidArgumentError, + InvalidReturnValueError, + RequestAbortedError +} = __nccwpck_require__(48045) const util = __nccwpck_require__(83983) -const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(48045) - -let tls // include tls conditionally since it is not always available - -// TODO: session re-use does not wait for the first -// connection to resolve the session and might therefore -// resolve the same servername multiple times even when -// re-use is enabled. - -let SessionCache -// FIXME: remove workaround when the Node bug is fixed -// https://github.com/nodejs/node/issues/49344#issuecomment-1741776308 -if (global.FinalizationRegistry && !process.env.NODE_V8_COVERAGE) { - SessionCache = class WeakSessionCache { - constructor (maxCachedSessions) { - this._maxCachedSessions = maxCachedSessions - this._sessionCache = new Map() - this._sessionRegistry = new global.FinalizationRegistry((key) => { - if (this._sessionCache.size < this._maxCachedSessions) { - return - } +const { getResolveErrorBodyCallback } = __nccwpck_require__(77474) +const { AsyncResource } = __nccwpck_require__(50852) +const { addSignal, removeSignal } = __nccwpck_require__(7032) - const ref = this._sessionCache.get(key) - if (ref !== undefined && ref.deref() === undefined) { - this._sessionCache.delete(key) - } - }) +class StreamHandler extends AsyncResource { + constructor (opts, factory, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') } - get (sessionKey) { - const ref = this._sessionCache.get(sessionKey) - return ref ? ref.deref() : null - } + const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError } = opts - set (sessionKey, session) { - if (this._maxCachedSessions === 0) { - return + try { + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') } - this._sessionCache.set(sessionKey, new WeakRef(session)) - this._sessionRegistry.register(session, sessionKey) - } - } -} else { - SessionCache = class SimpleSessionCache { - constructor (maxCachedSessions) { - this._maxCachedSessions = maxCachedSessions - this._sessionCache = new Map() - } + if (typeof factory !== 'function') { + throw new InvalidArgumentError('invalid factory') + } - get (sessionKey) { - return this._sessionCache.get(sessionKey) - } + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } - set (sessionKey, session) { - if (this._maxCachedSessions === 0) { - return + if (method === 'CONNECT') { + throw new InvalidArgumentError('invalid method') } - if (this._sessionCache.size >= this._maxCachedSessions) { - // remove the oldest session - const { value: oldestKey } = this._sessionCache.keys().next() - this._sessionCache.delete(oldestKey) + if (onInfo && typeof onInfo !== 'function') { + throw new InvalidArgumentError('invalid onInfo callback') } - this._sessionCache.set(sessionKey, session) + super('UNDICI_STREAM') + } catch (err) { + if (util.isStream(body)) { + util.destroy(body.on('error', util.nop), err) + } + throw err } + + this.responseHeaders = responseHeaders || null + this.opaque = opaque || null + this.factory = factory + this.callback = callback + this.res = null + this.abort = null + this.context = null + this.trailers = null + this.body = body + this.onInfo = onInfo || null + this.throwOnError = throwOnError || false + + if (util.isStream(body)) { + body.on('error', (err) => { + this.onError(err) + }) + } + + addSignal(this, signal) } -} -function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, ...opts }) { - if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) { - throw new InvalidArgumentError('maxCachedSessions must be a positive integer or zero') + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } + + this.abort = abort + this.context = context } - const options = { path: socketPath, ...opts } - const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions) - timeout = timeout == null ? 10e3 : timeout - allowH2 = allowH2 != null ? allowH2 : false - return function connect ({ hostname, host, protocol, port, servername, localAddress, httpSocket }, callback) { - let socket - if (protocol === 'https:') { - if (!tls) { - tls = __nccwpck_require__(24404) + onHeaders (statusCode, rawHeaders, resume, statusMessage) { + const { factory, opaque, context, callback, responseHeaders } = this + + const headers = responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + + if (statusCode < 200) { + if (this.onInfo) { + this.onInfo({ statusCode, headers }) } - servername = servername || options.servername || util.getServerName(host) || null + return + } - const sessionKey = servername || hostname - const session = sessionCache.get(sessionKey) || null + this.factory = null - assert(sessionKey) + let res - socket = tls.connect({ - highWaterMark: 16384, // TLS in node can't have bigger HWM anyway... - ...options, - servername, - session, - localAddress, - // TODO(HTTP/2): Add support for h2c - ALPNProtocols: allowH2 ? ['http/1.1', 'h2'] : ['http/1.1'], - socket: httpSocket, // upgrade socket connection - port: port || 443, - host: hostname - }) + if (this.throwOnError && statusCode >= 400) { + const parsedHeaders = responseHeaders === 'raw' ? util.parseHeaders(rawHeaders) : headers + const contentType = parsedHeaders['content-type'] + res = new PassThrough() - socket - .on('session', function (session) { - // TODO (fix): Can a session become invalid once established? Don't think so? - sessionCache.set(sessionKey, session) - }) + this.callback = null + this.runInAsyncScope(getResolveErrorBodyCallback, null, + { callback, body: res, contentType, statusCode, statusMessage, headers } + ) } else { - assert(!httpSocket, 'httpSocket can only be sent on TLS update') - socket = net.connect({ - highWaterMark: 64 * 1024, // Same as nodejs fs streams. - ...options, - localAddress, - port: port || 80, - host: hostname - }) - } + if (factory === null) { + return + } - // Set TCP keep alive options on the socket here instead of in connect() for the case of assigning the socket - if (options.keepAlive == null || options.keepAlive) { - const keepAliveInitialDelay = options.keepAliveInitialDelay === undefined ? 60e3 : options.keepAliveInitialDelay - socket.setKeepAlive(true, keepAliveInitialDelay) - } + res = this.runInAsyncScope(factory, null, { + statusCode, + headers, + opaque, + context + }) - const cancelTimeout = setupTimeout(() => onConnectTimeout(socket), timeout) + if ( + !res || + typeof res.write !== 'function' || + typeof res.end !== 'function' || + typeof res.on !== 'function' + ) { + throw new InvalidReturnValueError('expected Writable') + } - socket - .setNoDelay(true) - .once(protocol === 'https:' ? 'secureConnect' : 'connect', function () { - cancelTimeout() + // TODO: Avoid finished. It registers an unnecessary amount of listeners. + finished(res, { readable: false }, (err) => { + const { callback, res, opaque, trailers, abort } = this - if (callback) { - const cb = callback - callback = null - cb(null, this) + this.res = null + if (err || !res.readable) { + util.destroy(res, err) } - }) - .on('error', function (err) { - cancelTimeout() - if (callback) { - const cb = callback - callback = null - cb(err) + this.callback = null + this.runInAsyncScope(callback, null, err || null, { opaque, trailers }) + + if (err) { + abort() } }) + } - return socket + res.on('drain', resume) + + this.res = res + + const needDrain = res.writableNeedDrain !== undefined + ? res.writableNeedDrain + : res._writableState && res._writableState.needDrain + + return needDrain !== true } -} -function setupTimeout (onConnectTimeout, timeout) { - if (!timeout) { - return () => {} + onData (chunk) { + const { res } = this + + return res ? res.write(chunk) : true } - let s1 = null - let s2 = null - const timeoutId = setTimeout(() => { - // setImmediate is added to make sure that we priotorise socket error events over timeouts - s1 = setImmediate(() => { - if (process.platform === 'win32') { - // Windows needs an extra setImmediate probably due to implementation differences in the socket logic - s2 = setImmediate(() => onConnectTimeout()) - } else { - onConnectTimeout() - } - }) - }, timeout) - return () => { - clearTimeout(timeoutId) - clearImmediate(s1) - clearImmediate(s2) - } -} - -function onConnectTimeout (socket) { - util.destroy(socket, new ConnectTimeoutError()) -} + onComplete (trailers) { + const { res } = this -module.exports = buildConnector + removeSignal(this) + if (!res) { + return + } -/***/ }), + this.trailers = util.parseHeaders(trailers) -/***/ 14462: -/***/ ((module) => { + res.end() + } -"use strict"; + onError (err) { + const { res, callback, opaque, body } = this + removeSignal(this) -/** @type {Record} */ -const headerNameLowerCasedRecord = {} + this.factory = null -// https://developer.mozilla.org/docs/Web/HTTP/Headers -const wellknownHeaderNames = [ - 'Accept', - 'Accept-Encoding', - 'Accept-Language', - 'Accept-Ranges', - 'Access-Control-Allow-Credentials', - 'Access-Control-Allow-Headers', - 'Access-Control-Allow-Methods', - 'Access-Control-Allow-Origin', - 'Access-Control-Expose-Headers', - 'Access-Control-Max-Age', - 'Access-Control-Request-Headers', - 'Access-Control-Request-Method', - 'Age', - 'Allow', - 'Alt-Svc', - 'Alt-Used', - 'Authorization', - 'Cache-Control', - 'Clear-Site-Data', - 'Connection', - 'Content-Disposition', - 'Content-Encoding', - 'Content-Language', - 'Content-Length', - 'Content-Location', - 'Content-Range', - 'Content-Security-Policy', - 'Content-Security-Policy-Report-Only', - 'Content-Type', - 'Cookie', - 'Cross-Origin-Embedder-Policy', - 'Cross-Origin-Opener-Policy', - 'Cross-Origin-Resource-Policy', - 'Date', - 'Device-Memory', - 'Downlink', - 'ECT', - 'ETag', - 'Expect', - 'Expect-CT', - 'Expires', - 'Forwarded', - 'From', - 'Host', - 'If-Match', - 'If-Modified-Since', - 'If-None-Match', - 'If-Range', - 'If-Unmodified-Since', - 'Keep-Alive', - 'Last-Modified', - 'Link', - 'Location', - 'Max-Forwards', - 'Origin', - 'Permissions-Policy', - 'Pragma', - 'Proxy-Authenticate', - 'Proxy-Authorization', - 'RTT', - 'Range', - 'Referer', - 'Referrer-Policy', - 'Refresh', - 'Retry-After', - 'Sec-WebSocket-Accept', - 'Sec-WebSocket-Extensions', - 'Sec-WebSocket-Key', - 'Sec-WebSocket-Protocol', - 'Sec-WebSocket-Version', - 'Server', - 'Server-Timing', - 'Service-Worker-Allowed', - 'Service-Worker-Navigation-Preload', - 'Set-Cookie', - 'SourceMap', - 'Strict-Transport-Security', - 'Supports-Loading-Mode', - 'TE', - 'Timing-Allow-Origin', - 'Trailer', - 'Transfer-Encoding', - 'Upgrade', - 'Upgrade-Insecure-Requests', - 'User-Agent', - 'Vary', - 'Via', - 'WWW-Authenticate', - 'X-Content-Type-Options', - 'X-DNS-Prefetch-Control', - 'X-Frame-Options', - 'X-Permitted-Cross-Domain-Policies', - 'X-Powered-By', - 'X-Requested-With', - 'X-XSS-Protection' -] + if (res) { + this.res = null + util.destroy(res, err) + } else if (callback) { + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } -for (let i = 0; i < wellknownHeaderNames.length; ++i) { - const key = wellknownHeaderNames[i] - const lowerCasedKey = key.toLowerCase() - headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] = - lowerCasedKey + if (body) { + this.body = null + util.destroy(body, err) + } + } } -// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`. -Object.setPrototypeOf(headerNameLowerCasedRecord, null) +function stream (opts, factory, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + stream.call(this, opts, factory, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) + } -module.exports = { - wellknownHeaderNames, - headerNameLowerCasedRecord + try { + this.dispatch(opts, new StreamHandler(opts, factory, callback)) + } catch (err) { + if (typeof callback !== 'function') { + throw err + } + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) + } } +module.exports = stream + /***/ }), -/***/ 48045: -/***/ ((module) => { +/***/ 36923: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -class UndiciError extends Error { - constructor (message) { - super(message) - this.name = 'UndiciError' - this.code = 'UND_ERR' - } -} +const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(48045) +const { AsyncResource } = __nccwpck_require__(50852) +const util = __nccwpck_require__(83983) +const { addSignal, removeSignal } = __nccwpck_require__(7032) +const assert = __nccwpck_require__(39491) -class ConnectTimeoutError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, ConnectTimeoutError) - this.name = 'ConnectTimeoutError' - this.message = message || 'Connect Timeout Error' - this.code = 'UND_ERR_CONNECT_TIMEOUT' - } -} +class UpgradeHandler extends AsyncResource { + constructor (opts, callback) { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('invalid opts') + } -class HeadersTimeoutError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, HeadersTimeoutError) - this.name = 'HeadersTimeoutError' - this.message = message || 'Headers Timeout Error' - this.code = 'UND_ERR_HEADERS_TIMEOUT' - } -} + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } -class HeadersOverflowError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, HeadersOverflowError) - this.name = 'HeadersOverflowError' - this.message = message || 'Headers Overflow Error' - this.code = 'UND_ERR_HEADERS_OVERFLOW' - } -} + const { signal, opaque, responseHeaders } = opts -class BodyTimeoutError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, BodyTimeoutError) - this.name = 'BodyTimeoutError' - this.message = message || 'Body Timeout Error' - this.code = 'UND_ERR_BODY_TIMEOUT' - } -} + if (signal && typeof signal.on !== 'function' && typeof signal.addEventListener !== 'function') { + throw new InvalidArgumentError('signal must be an EventEmitter or EventTarget') + } -class ResponseStatusCodeError extends UndiciError { - constructor (message, statusCode, headers, body) { - super(message) - Error.captureStackTrace(this, ResponseStatusCodeError) - this.name = 'ResponseStatusCodeError' - this.message = message || 'Response Status Code Error' - this.code = 'UND_ERR_RESPONSE_STATUS_CODE' - this.body = body - this.status = statusCode - this.statusCode = statusCode - this.headers = headers - } -} + super('UNDICI_UPGRADE') -class InvalidArgumentError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, InvalidArgumentError) - this.name = 'InvalidArgumentError' - this.message = message || 'Invalid Argument Error' - this.code = 'UND_ERR_INVALID_ARG' - } -} + this.responseHeaders = responseHeaders || null + this.opaque = opaque || null + this.callback = callback + this.abort = null + this.context = null -class InvalidReturnValueError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, InvalidReturnValueError) - this.name = 'InvalidReturnValueError' - this.message = message || 'Invalid Return Value Error' - this.code = 'UND_ERR_INVALID_RETURN_VALUE' + addSignal(this, signal) } -} -class RequestAbortedError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, RequestAbortedError) - this.name = 'AbortError' - this.message = message || 'Request aborted' - this.code = 'UND_ERR_ABORTED' - } -} + onConnect (abort, context) { + if (!this.callback) { + throw new RequestAbortedError() + } -class InformationalError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, InformationalError) - this.name = 'InformationalError' - this.message = message || 'Request information' - this.code = 'UND_ERR_INFO' + this.abort = abort + this.context = null } -} -class RequestContentLengthMismatchError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, RequestContentLengthMismatchError) - this.name = 'RequestContentLengthMismatchError' - this.message = message || 'Request body length does not match content-length header' - this.code = 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' + onHeaders () { + throw new SocketError('bad upgrade', null) } -} -class ResponseContentLengthMismatchError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, ResponseContentLengthMismatchError) - this.name = 'ResponseContentLengthMismatchError' - this.message = message || 'Response body length does not match content-length header' - this.code = 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH' - } -} + onUpgrade (statusCode, rawHeaders, socket) { + const { callback, opaque, context } = this -class ClientDestroyedError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, ClientDestroyedError) - this.name = 'ClientDestroyedError' - this.message = message || 'The client is destroyed' - this.code = 'UND_ERR_DESTROYED' - } -} + assert.strictEqual(statusCode, 101) -class ClientClosedError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, ClientClosedError) - this.name = 'ClientClosedError' - this.message = message || 'The client is closed' - this.code = 'UND_ERR_CLOSED' - } -} + removeSignal(this) -class SocketError extends UndiciError { - constructor (message, socket) { - super(message) - Error.captureStackTrace(this, SocketError) - this.name = 'SocketError' - this.message = message || 'Socket error' - this.code = 'UND_ERR_SOCKET' - this.socket = socket + this.callback = null + const headers = this.responseHeaders === 'raw' ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders) + this.runInAsyncScope(callback, null, null, { + headers, + socket, + opaque, + context + }) } -} -class NotSupportedError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, NotSupportedError) - this.name = 'NotSupportedError' - this.message = message || 'Not supported error' - this.code = 'UND_ERR_NOT_SUPPORTED' - } -} + onError (err) { + const { callback, opaque } = this -class BalancedPoolMissingUpstreamError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, NotSupportedError) - this.name = 'MissingUpstreamError' - this.message = message || 'No upstream has been added to the BalancedPool' - this.code = 'UND_ERR_BPL_MISSING_UPSTREAM' - } -} + removeSignal(this) -class HTTPParserError extends Error { - constructor (message, code, data) { - super(message) - Error.captureStackTrace(this, HTTPParserError) - this.name = 'HTTPParserError' - this.code = code ? `HPE_${code}` : undefined - this.data = data ? data.toString() : undefined + if (callback) { + this.callback = null + queueMicrotask(() => { + this.runInAsyncScope(callback, null, err, { opaque }) + }) + } } } -class ResponseExceededMaxSizeError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, ResponseExceededMaxSizeError) - this.name = 'ResponseExceededMaxSizeError' - this.message = message || 'Response content exceeded max size' - this.code = 'UND_ERR_RES_EXCEEDED_MAX_SIZE' +function upgrade (opts, callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + upgrade.call(this, opts, (err, data) => { + return err ? reject(err) : resolve(data) + }) + }) } -} -class RequestRetryError extends UndiciError { - constructor (message, code, { headers, data }) { - super(message) - Error.captureStackTrace(this, RequestRetryError) - this.name = 'RequestRetryError' - this.message = message || 'Request retry error' - this.code = 'UND_ERR_REQ_RETRY' - this.statusCode = code - this.data = data - this.headers = headers + try { + const upgradeHandler = new UpgradeHandler(opts, callback) + this.dispatch({ + ...opts, + method: opts.method || 'GET', + upgrade: opts.protocol || 'Websocket' + }, upgradeHandler) + } catch (err) { + if (typeof callback !== 'function') { + throw err + } + const opaque = opts && opts.opaque + queueMicrotask(() => callback(err, { opaque })) } } -module.exports = { - HTTPParserError, - UndiciError, - HeadersTimeoutError, - HeadersOverflowError, - BodyTimeoutError, - RequestContentLengthMismatchError, - ConnectTimeoutError, - ResponseStatusCodeError, - InvalidArgumentError, - InvalidReturnValueError, - RequestAbortedError, - ClientDestroyedError, - ClientClosedError, - InformationalError, - SocketError, - NotSupportedError, - ResponseContentLengthMismatchError, - BalancedPoolMissingUpstreamError, - ResponseExceededMaxSizeError, - RequestRetryError -} +module.exports = upgrade /***/ }), -/***/ 62905: +/***/ 44059: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { - InvalidArgumentError, - NotSupportedError -} = __nccwpck_require__(48045) -const assert = __nccwpck_require__(39491) -const { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = __nccwpck_require__(72785) -const util = __nccwpck_require__(83983) +module.exports.request = __nccwpck_require__(55448) +module.exports.stream = __nccwpck_require__(75395) +module.exports.pipeline = __nccwpck_require__(28752) +module.exports.upgrade = __nccwpck_require__(36923) +module.exports.connect = __nccwpck_require__(29744) -// tokenRegExp and headerCharRegex have been lifted from -// https://github.com/nodejs/node/blob/main/lib/_http_common.js -/** - * Verifies that the given val is a valid HTTP token - * per the rules defined in RFC 7230 - * See https://tools.ietf.org/html/rfc7230#section-3.2.6 - */ -const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/ +/***/ }), -/** - * Matches if val contains an invalid field-vchar - * field-value = *( field-content / obs-fold ) - * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] - * field-vchar = VCHAR / obs-text - */ -const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/ +/***/ 73858: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// Verifies that a given path is valid does not contain control chars \x00 to \x20 -const invalidPathRegex = /[^\u0021-\u00ff]/ +"use strict"; +// Ported from https://github.com/nodejs/undici/pull/907 -const kHandler = Symbol('handler') -const channels = {} -let extractBody +const assert = __nccwpck_require__(39491) +const { Readable } = __nccwpck_require__(12781) +const { RequestAbortedError, NotSupportedError, InvalidArgumentError } = __nccwpck_require__(48045) +const util = __nccwpck_require__(83983) +const { ReadableStreamFrom, toUSVString } = __nccwpck_require__(83983) -try { - const diagnosticsChannel = __nccwpck_require__(67643) - channels.create = diagnosticsChannel.channel('undici:request:create') - channels.bodySent = diagnosticsChannel.channel('undici:request:bodySent') - channels.headers = diagnosticsChannel.channel('undici:request:headers') - channels.trailers = diagnosticsChannel.channel('undici:request:trailers') - channels.error = diagnosticsChannel.channel('undici:request:error') -} catch { - channels.create = { hasSubscribers: false } - channels.bodySent = { hasSubscribers: false } - channels.headers = { hasSubscribers: false } - channels.trailers = { hasSubscribers: false } - channels.error = { hasSubscribers: false } -} +let Blob -class Request { - constructor (origin, { - path, - method, - body, - headers, - query, - idempotent, - blocking, - upgrade, - headersTimeout, - bodyTimeout, - reset, - throwOnError, - expectContinue - }, handler) { - if (typeof path !== 'string') { - throw new InvalidArgumentError('path must be a string') - } else if ( - path[0] !== '/' && - !(path.startsWith('http://') || path.startsWith('https://')) && - method !== 'CONNECT' - ) { - throw new InvalidArgumentError('path must be an absolute URL or start with a slash') - } else if (invalidPathRegex.exec(path) !== null) { - throw new InvalidArgumentError('invalid request path') - } +const kConsume = Symbol('kConsume') +const kReading = Symbol('kReading') +const kBody = Symbol('kBody') +const kAbort = Symbol('abort') +const kContentType = Symbol('kContentType') - if (typeof method !== 'string') { - throw new InvalidArgumentError('method must be a string') - } else if (tokenRegExp.exec(method) === null) { - throw new InvalidArgumentError('invalid request method') - } +const noop = () => {} - if (upgrade && typeof upgrade !== 'string') { - throw new InvalidArgumentError('upgrade must be a string') - } +module.exports = class BodyReadable extends Readable { + constructor ({ + resume, + abort, + contentType = '', + highWaterMark = 64 * 1024 // Same as nodejs fs streams. + }) { + super({ + autoDestroy: true, + read: resume, + highWaterMark + }) - if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) { - throw new InvalidArgumentError('invalid headersTimeout') - } + this._readableState.dataEmitted = false - if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) { - throw new InvalidArgumentError('invalid bodyTimeout') - } + this[kAbort] = abort + this[kConsume] = null + this[kBody] = null + this[kContentType] = contentType - if (reset != null && typeof reset !== 'boolean') { - throw new InvalidArgumentError('invalid reset') + // Is stream being consumed through Readable API? + // This is an optimization so that we avoid checking + // for 'data' and 'readable' listeners in the hot path + // inside push(). + this[kReading] = false + } + + destroy (err) { + if (this.destroyed) { + // Node < 16 + return this } - if (expectContinue != null && typeof expectContinue !== 'boolean') { - throw new InvalidArgumentError('invalid expectContinue') + if (!err && !this._readableState.endEmitted) { + err = new RequestAbortedError() } - this.headersTimeout = headersTimeout + if (err) { + this[kAbort]() + } - this.bodyTimeout = bodyTimeout + return super.destroy(err) + } - this.throwOnError = throwOnError === true + emit (ev, ...args) { + if (ev === 'data') { + // Node < 16.7 + this._readableState.dataEmitted = true + } else if (ev === 'error') { + // Node < 16 + this._readableState.errorEmitted = true + } + return super.emit(ev, ...args) + } - this.method = method + on (ev, ...args) { + if (ev === 'data' || ev === 'readable') { + this[kReading] = true + } + return super.on(ev, ...args) + } - this.abort = null + addListener (ev, ...args) { + return this.on(ev, ...args) + } - if (body == null) { - this.body = null - } else if (util.isStream(body)) { - this.body = body + off (ev, ...args) { + const ret = super.off(ev, ...args) + if (ev === 'data' || ev === 'readable') { + this[kReading] = ( + this.listenerCount('data') > 0 || + this.listenerCount('readable') > 0 + ) + } + return ret + } - const rState = this.body._readableState - if (!rState || !rState.autoDestroy) { - this.endHandler = function autoDestroy () { - util.destroy(this) - } - this.body.on('end', this.endHandler) - } + removeListener (ev, ...args) { + return this.off(ev, ...args) + } - this.errorHandler = err => { - if (this.abort) { - this.abort(err) - } else { - this.error = err - } - } - this.body.on('error', this.errorHandler) - } else if (util.isBuffer(body)) { - this.body = body.byteLength ? body : null - } else if (ArrayBuffer.isView(body)) { - this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null - } else if (body instanceof ArrayBuffer) { - this.body = body.byteLength ? Buffer.from(body) : null - } else if (typeof body === 'string') { - this.body = body.length ? Buffer.from(body) : null - } else if (util.isFormDataLike(body) || util.isIterable(body) || util.isBlobLike(body)) { - this.body = body - } else { - throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable') + push (chunk) { + if (this[kConsume] && chunk !== null && this.readableLength === 0) { + consumePush(this[kConsume], chunk) + return this[kReading] ? super.push(chunk) : true } + return super.push(chunk) + } - this.completed = false + // https://fetch.spec.whatwg.org/#dom-body-text + async text () { + return consume(this, 'text') + } - this.aborted = false + // https://fetch.spec.whatwg.org/#dom-body-json + async json () { + return consume(this, 'json') + } - this.upgrade = upgrade || null + // https://fetch.spec.whatwg.org/#dom-body-blob + async blob () { + return consume(this, 'blob') + } - this.path = query ? util.buildURL(path, query) : path + // https://fetch.spec.whatwg.org/#dom-body-arraybuffer + async arrayBuffer () { + return consume(this, 'arrayBuffer') + } - this.origin = origin + // https://fetch.spec.whatwg.org/#dom-body-formdata + async formData () { + // TODO: Implement. + throw new NotSupportedError() + } - this.idempotent = idempotent == null - ? method === 'HEAD' || method === 'GET' - : idempotent + // https://fetch.spec.whatwg.org/#dom-body-bodyused + get bodyUsed () { + return util.isDisturbed(this) + } - this.blocking = blocking == null ? false : blocking + // https://fetch.spec.whatwg.org/#dom-body-body + get body () { + if (!this[kBody]) { + this[kBody] = ReadableStreamFrom(this) + if (this[kConsume]) { + // TODO: Is this the best way to force a lock? + this[kBody].getReader() // Ensure stream is locked. + assert(this[kBody].locked) + } + } + return this[kBody] + } - this.reset = reset == null ? null : reset + dump (opts) { + let limit = opts && Number.isFinite(opts.limit) ? opts.limit : 262144 + const signal = opts && opts.signal - this.host = null + if (signal) { + try { + if (typeof signal !== 'object' || !('aborted' in signal)) { + throw new InvalidArgumentError('signal must be an AbortSignal') + } + util.throwIfAborted(signal) + } catch (err) { + return Promise.reject(err) + } + } - this.contentLength = null + if (this.closed) { + return Promise.resolve(null) + } - this.contentType = null + return new Promise((resolve, reject) => { + const signalListenerCleanup = signal + ? util.addAbortListener(signal, () => { + this.destroy() + }) + : noop - this.headers = '' + this + .on('close', function () { + signalListenerCleanup() + if (signal && signal.aborted) { + reject(signal.reason || Object.assign(new Error('The operation was aborted'), { name: 'AbortError' })) + } else { + resolve(null) + } + }) + .on('error', noop) + .on('data', function (chunk) { + limit -= chunk.length + if (limit <= 0) { + this.destroy() + } + }) + .resume() + }) + } +} - // Only for H2 - this.expectContinue = expectContinue != null ? expectContinue : false +// https://streams.spec.whatwg.org/#readablestream-locked +function isLocked (self) { + // Consume is an implicit lock. + return (self[kBody] && self[kBody].locked === true) || self[kConsume] +} - if (Array.isArray(headers)) { - if (headers.length % 2 !== 0) { - throw new InvalidArgumentError('headers array must be even') - } - for (let i = 0; i < headers.length; i += 2) { - processHeader(this, headers[i], headers[i + 1]) - } - } else if (headers && typeof headers === 'object') { - const keys = Object.keys(headers) - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - processHeader(this, key, headers[key]) - } - } else if (headers != null) { - throw new InvalidArgumentError('headers must be an object or an array') - } +// https://fetch.spec.whatwg.org/#body-unusable +function isUnusable (self) { + return util.isDisturbed(self) || isLocked(self) +} - if (util.isFormDataLike(this.body)) { - if (util.nodeMajor < 16 || (util.nodeMajor === 16 && util.nodeMinor < 8)) { - throw new InvalidArgumentError('Form-Data bodies are only supported in node v16.8 and newer.') - } +async function consume (stream, type) { + if (isUnusable(stream)) { + throw new TypeError('unusable') + } - if (!extractBody) { - extractBody = (__nccwpck_require__(41472).extractBody) - } + assert(!stream[kConsume]) - const [bodyStream, contentType] = extractBody(body) - if (this.contentType == null) { - this.contentType = contentType - this.headers += `content-type: ${contentType}\r\n` - } - this.body = bodyStream.stream - this.contentLength = bodyStream.length - } else if (util.isBlobLike(body) && this.contentType == null && body.type) { - this.contentType = body.type - this.headers += `content-type: ${body.type}\r\n` + return new Promise((resolve, reject) => { + stream[kConsume] = { + type, + stream, + resolve, + reject, + length: 0, + body: [] } - util.validateHandler(handler, method, upgrade) + stream + .on('error', function (err) { + consumeFinish(this[kConsume], err) + }) + .on('close', function () { + if (this[kConsume].body !== null) { + consumeFinish(this[kConsume], new RequestAbortedError()) + } + }) - this.servername = util.getServerName(this.host) + process.nextTick(consumeStart, stream[kConsume]) + }) +} - this[kHandler] = handler +function consumeStart (consume) { + if (consume.body === null) { + return + } - if (channels.create.hasSubscribers) { - channels.create.publish({ request: this }) - } + const { _readableState: state } = consume.stream + + for (const chunk of state.buffer) { + consumePush(consume, chunk) } - onBodySent (chunk) { - if (this[kHandler].onBodySent) { - try { - return this[kHandler].onBodySent(chunk) - } catch (err) { - this.abort(err) - } - } + if (state.endEmitted) { + consumeEnd(this[kConsume]) + } else { + consume.stream.on('end', function () { + consumeEnd(this[kConsume]) + }) } - onRequestSent () { - if (channels.bodySent.hasSubscribers) { - channels.bodySent.publish({ request: this }) - } + consume.stream.resume() - if (this[kHandler].onRequestSent) { - try { - return this[kHandler].onRequestSent() - } catch (err) { - this.abort(err) - } - } + while (consume.stream.read() != null) { + // Loop } +} - onConnect (abort) { - assert(!this.aborted) - assert(!this.completed) +function consumeEnd (consume) { + const { type, body, resolve, stream, length } = consume - if (this.error) { - abort(this.error) - } else { - this.abort = abort - return this[kHandler].onConnect(abort) - } - } + try { + if (type === 'text') { + resolve(toUSVString(Buffer.concat(body))) + } else if (type === 'json') { + resolve(JSON.parse(Buffer.concat(body))) + } else if (type === 'arrayBuffer') { + const dst = new Uint8Array(length) - onHeaders (statusCode, headers, resume, statusText) { - assert(!this.aborted) - assert(!this.completed) + let pos = 0 + for (const buf of body) { + dst.set(buf, pos) + pos += buf.byteLength + } - if (channels.headers.hasSubscribers) { - channels.headers.publish({ request: this, response: { statusCode, headers, statusText } }) + resolve(dst.buffer) + } else if (type === 'blob') { + if (!Blob) { + Blob = (__nccwpck_require__(14300).Blob) + } + resolve(new Blob(body, { type: stream[kContentType] })) } - try { - return this[kHandler].onHeaders(statusCode, headers, resume, statusText) - } catch (err) { - this.abort(err) - } + consumeFinish(consume) + } catch (err) { + stream.destroy(err) } +} - onData (chunk) { - assert(!this.aborted) - assert(!this.completed) +function consumePush (consume, chunk) { + consume.length += chunk.length + consume.body.push(chunk) +} - try { - return this[kHandler].onData(chunk) - } catch (err) { - this.abort(err) - return false - } +function consumeFinish (consume, err) { + if (consume.body === null) { + return } - onUpgrade (statusCode, headers, socket) { - assert(!this.aborted) - assert(!this.completed) - - return this[kHandler].onUpgrade(statusCode, headers, socket) + if (err) { + consume.reject(err) + } else { + consume.resolve() } - onComplete (trailers) { - this.onFinally() + consume.type = null + consume.stream = null + consume.resolve = null + consume.reject = null + consume.length = 0 + consume.body = null +} - assert(!this.aborted) - this.completed = true - if (channels.trailers.hasSubscribers) { - channels.trailers.publish({ request: this, trailers }) - } +/***/ }), - try { - return this[kHandler].onComplete(trailers) - } catch (err) { - // TODO (fix): This might be a bad idea? - this.onError(err) - } - } +/***/ 77474: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - onError (error) { - this.onFinally() +const assert = __nccwpck_require__(39491) +const { + ResponseStatusCodeError +} = __nccwpck_require__(48045) +const { toUSVString } = __nccwpck_require__(83983) - if (channels.error.hasSubscribers) { - channels.error.publish({ request: this, error }) - } +async function getResolveErrorBodyCallback ({ callback, body, contentType, statusCode, statusMessage, headers }) { + assert(body) - if (this.aborted) { - return + let chunks = [] + let limit = 0 + + for await (const chunk of body) { + chunks.push(chunk) + limit += chunk.length + if (limit > 128 * 1024) { + chunks = null + break } - this.aborted = true + } - return this[kHandler].onError(error) + if (statusCode === 204 || !contentType || !chunks) { + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers)) + return } - onFinally () { - if (this.errorHandler) { - this.body.off('error', this.errorHandler) - this.errorHandler = null + try { + if (contentType.startsWith('application/json')) { + const payload = JSON.parse(toUSVString(Buffer.concat(chunks))) + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload)) + return } - if (this.endHandler) { - this.body.off('end', this.endHandler) - this.endHandler = null + if (contentType.startsWith('text/')) { + const payload = toUSVString(Buffer.concat(chunks)) + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers, payload)) + return } + } catch (err) { + // Process in a fallback if error } - // TODO: adjust to support H2 - addHeader (key, value) { - processHeader(this, key, value) - return this - } - - static [kHTTP1BuildRequest] (origin, opts, handler) { - // TODO: Migrate header parsing here, to make Requests - // HTTP agnostic - return new Request(origin, opts, handler) - } - - static [kHTTP2BuildRequest] (origin, opts, handler) { - const headers = opts.headers - opts = { ...opts, headers: null } - - const request = new Request(origin, opts, handler) - - request.headers = {} - - if (Array.isArray(headers)) { - if (headers.length % 2 !== 0) { - throw new InvalidArgumentError('headers array must be even') - } - for (let i = 0; i < headers.length; i += 2) { - processHeader(request, headers[i], headers[i + 1], true) - } - } else if (headers && typeof headers === 'object') { - const keys = Object.keys(headers) - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - processHeader(request, key, headers[key], true) - } - } else if (headers != null) { - throw new InvalidArgumentError('headers must be an object or an array') - } - - return request - } + process.nextTick(callback, new ResponseStatusCodeError(`Response status code ${statusCode}${statusMessage ? `: ${statusMessage}` : ''}`, statusCode, headers)) +} - static [kHTTP2CopyHeaders] (raw) { - const rawHeaders = raw.split('\r\n') - const headers = {} +module.exports = { getResolveErrorBodyCallback } - for (const header of rawHeaders) { - const [key, value] = header.split(': ') - if (value == null || value.length === 0) continue +/***/ }), - if (headers[key]) headers[key] += `,${value}` - else headers[key] = value - } +/***/ 37931: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - return headers - } -} +"use strict"; -function processHeaderValue (key, val, skipAppend) { - if (val && typeof val === 'object') { - throw new InvalidArgumentError(`invalid ${key} header`) - } - val = val != null ? `${val}` : '' +const { + BalancedPoolMissingUpstreamError, + InvalidArgumentError +} = __nccwpck_require__(48045) +const { + PoolBase, + kClients, + kNeedDrain, + kAddClient, + kRemoveClient, + kGetDispatcher +} = __nccwpck_require__(73198) +const Pool = __nccwpck_require__(4634) +const { kUrl, kInterceptors } = __nccwpck_require__(72785) +const { parseOrigin } = __nccwpck_require__(83983) +const kFactory = Symbol('factory') - if (headerCharRegex.exec(val) !== null) { - throw new InvalidArgumentError(`invalid ${key} header`) - } +const kOptions = Symbol('options') +const kGreatestCommonDivisor = Symbol('kGreatestCommonDivisor') +const kCurrentWeight = Symbol('kCurrentWeight') +const kIndex = Symbol('kIndex') +const kWeight = Symbol('kWeight') +const kMaxWeightPerServer = Symbol('kMaxWeightPerServer') +const kErrorPenalty = Symbol('kErrorPenalty') - return skipAppend ? val : `${key}: ${val}\r\n` +function getGreatestCommonDivisor (a, b) { + if (b === 0) return a + return getGreatestCommonDivisor(b, a % b) } -function processHeader (request, key, val, skipAppend = false) { - if (val && (typeof val === 'object' && !Array.isArray(val))) { - throw new InvalidArgumentError(`invalid ${key} header`) - } else if (val === undefined) { - return - } - - if ( - request.host === null && - key.length === 4 && - key.toLowerCase() === 'host' - ) { - if (headerCharRegex.exec(val) !== null) { - throw new InvalidArgumentError(`invalid ${key} header`) - } - // Consumed by Client - request.host = val - } else if ( - request.contentLength === null && - key.length === 14 && - key.toLowerCase() === 'content-length' - ) { - request.contentLength = parseInt(val, 10) - if (!Number.isFinite(request.contentLength)) { - throw new InvalidArgumentError('invalid content-length header') - } - } else if ( - request.contentType === null && - key.length === 12 && - key.toLowerCase() === 'content-type' - ) { - request.contentType = val - if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) - else request.headers += processHeaderValue(key, val) - } else if ( - key.length === 17 && - key.toLowerCase() === 'transfer-encoding' - ) { - throw new InvalidArgumentError('invalid transfer-encoding header') - } else if ( - key.length === 10 && - key.toLowerCase() === 'connection' - ) { - const value = typeof val === 'string' ? val.toLowerCase() : null - if (value !== 'close' && value !== 'keep-alive') { - throw new InvalidArgumentError('invalid connection header') - } else if (value === 'close') { - request.reset = true - } - } else if ( - key.length === 10 && - key.toLowerCase() === 'keep-alive' - ) { - throw new InvalidArgumentError('invalid keep-alive header') - } else if ( - key.length === 7 && - key.toLowerCase() === 'upgrade' - ) { - throw new InvalidArgumentError('invalid upgrade header') - } else if ( - key.length === 6 && - key.toLowerCase() === 'expect' - ) { - throw new NotSupportedError('expect header not supported') - } else if (tokenRegExp.exec(key) === null) { - throw new InvalidArgumentError('invalid header key') - } else { - if (Array.isArray(val)) { - for (let i = 0; i < val.length; i++) { - if (skipAppend) { - if (request.headers[key]) request.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}` - else request.headers[key] = processHeaderValue(key, val[i], skipAppend) - } else { - request.headers += processHeaderValue(key, val[i]) - } - } - } else { - if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) - else request.headers += processHeaderValue(key, val) - } - } +function defaultFactory (origin, opts) { + return new Pool(origin, opts) } -module.exports = Request - +class BalancedPool extends PoolBase { + constructor (upstreams = [], { factory = defaultFactory, ...opts } = {}) { + super() -/***/ }), + this[kOptions] = opts + this[kIndex] = -1 + this[kCurrentWeight] = 0 -/***/ 72785: -/***/ ((module) => { + this[kMaxWeightPerServer] = this[kOptions].maxWeightPerServer || 100 + this[kErrorPenalty] = this[kOptions].errorPenalty || 15 -module.exports = { - kClose: Symbol('close'), - kDestroy: Symbol('destroy'), - kDispatch: Symbol('dispatch'), - kUrl: Symbol('url'), - kWriting: Symbol('writing'), - kResuming: Symbol('resuming'), - kQueue: Symbol('queue'), - kConnect: Symbol('connect'), - kConnecting: Symbol('connecting'), - kHeadersList: Symbol('headers list'), - kKeepAliveDefaultTimeout: Symbol('default keep alive timeout'), - kKeepAliveMaxTimeout: Symbol('max keep alive timeout'), - kKeepAliveTimeoutThreshold: Symbol('keep alive timeout threshold'), - kKeepAliveTimeoutValue: Symbol('keep alive timeout'), - kKeepAlive: Symbol('keep alive'), - kHeadersTimeout: Symbol('headers timeout'), - kBodyTimeout: Symbol('body timeout'), - kServerName: Symbol('server name'), - kLocalAddress: Symbol('local address'), - kHost: Symbol('host'), - kNoRef: Symbol('no ref'), - kBodyUsed: Symbol('used'), - kRunning: Symbol('running'), - kBlocking: Symbol('blocking'), - kPending: Symbol('pending'), - kSize: Symbol('size'), - kBusy: Symbol('busy'), - kQueued: Symbol('queued'), - kFree: Symbol('free'), - kConnected: Symbol('connected'), - kClosed: Symbol('closed'), - kNeedDrain: Symbol('need drain'), - kReset: Symbol('reset'), - kDestroyed: Symbol.for('nodejs.stream.destroyed'), - kMaxHeadersSize: Symbol('max headers size'), - kRunningIdx: Symbol('running index'), - kPendingIdx: Symbol('pending index'), - kError: Symbol('error'), - kClients: Symbol('clients'), - kClient: Symbol('client'), - kParser: Symbol('parser'), - kOnDestroyed: Symbol('destroy callbacks'), - kPipelining: Symbol('pipelining'), - kSocket: Symbol('socket'), - kHostHeader: Symbol('host header'), - kConnector: Symbol('connector'), - kStrictContentLength: Symbol('strict content length'), - kMaxRedirections: Symbol('maxRedirections'), - kMaxRequests: Symbol('maxRequestsPerClient'), - kProxy: Symbol('proxy agent options'), - kCounter: Symbol('socket request counter'), - kInterceptors: Symbol('dispatch interceptors'), - kMaxResponseSize: Symbol('max response size'), - kHTTP2Session: Symbol('http2Session'), - kHTTP2SessionState: Symbol('http2Session state'), - kHTTP2BuildRequest: Symbol('http2 build request'), - kHTTP1BuildRequest: Symbol('http1 build request'), - kHTTP2CopyHeaders: Symbol('http2 copy headers'), - kHTTPConnVersion: Symbol('http connection version'), - kRetryHandlerDefaultRetry: Symbol('retry agent default retry'), - kConstruct: Symbol('constructable') -} + if (!Array.isArray(upstreams)) { + upstreams = [upstreams] + } + if (typeof factory !== 'function') { + throw new InvalidArgumentError('factory must be a function.') + } -/***/ }), + this[kInterceptors] = opts.interceptors && opts.interceptors.BalancedPool && Array.isArray(opts.interceptors.BalancedPool) + ? opts.interceptors.BalancedPool + : [] + this[kFactory] = factory -/***/ 83983: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + for (const upstream of upstreams) { + this.addUpstream(upstream) + } + this._updateBalancedPoolStats() + } -"use strict"; + addUpstream (upstream) { + const upstreamOrigin = parseOrigin(upstream).origin + if (this[kClients].find((pool) => ( + pool[kUrl].origin === upstreamOrigin && + pool.closed !== true && + pool.destroyed !== true + ))) { + return this + } + const pool = this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions])) -const assert = __nccwpck_require__(39491) -const { kDestroyed, kBodyUsed } = __nccwpck_require__(72785) -const { IncomingMessage } = __nccwpck_require__(13685) -const stream = __nccwpck_require__(12781) -const net = __nccwpck_require__(41808) -const { InvalidArgumentError } = __nccwpck_require__(48045) -const { Blob } = __nccwpck_require__(14300) -const nodeUtil = __nccwpck_require__(73837) -const { stringify } = __nccwpck_require__(63477) -const { headerNameLowerCasedRecord } = __nccwpck_require__(14462) + this[kAddClient](pool) + pool.on('connect', () => { + pool[kWeight] = Math.min(this[kMaxWeightPerServer], pool[kWeight] + this[kErrorPenalty]) + }) -const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) + pool.on('connectionError', () => { + pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) + this._updateBalancedPoolStats() + }) -function nop () {} + pool.on('disconnect', (...args) => { + const err = args[2] + if (err && err.code === 'UND_ERR_SOCKET') { + // decrease the weight of the pool. + pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) + this._updateBalancedPoolStats() + } + }) -function isStream (obj) { - return obj && typeof obj === 'object' && typeof obj.pipe === 'function' && typeof obj.on === 'function' -} + for (const client of this[kClients]) { + client[kWeight] = this[kMaxWeightPerServer] + } -// based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License) -function isBlobLike (object) { - return (Blob && object instanceof Blob) || ( - object && - typeof object === 'object' && - (typeof object.stream === 'function' || - typeof object.arrayBuffer === 'function') && - /^(Blob|File)$/.test(object[Symbol.toStringTag]) - ) -} + this._updateBalancedPoolStats() -function buildURL (url, queryParams) { - if (url.includes('?') || url.includes('#')) { - throw new Error('Query params cannot be passed when url already contains "?" or "#".') + return this } - const stringified = stringify(queryParams) - - if (stringified) { - url += '?' + stringified + _updateBalancedPoolStats () { + this[kGreatestCommonDivisor] = this[kClients].map(p => p[kWeight]).reduce(getGreatestCommonDivisor, 0) } - return url -} + removeUpstream (upstream) { + const upstreamOrigin = parseOrigin(upstream).origin -function parseURL (url) { - if (typeof url === 'string') { - url = new URL(url) + const pool = this[kClients].find((pool) => ( + pool[kUrl].origin === upstreamOrigin && + pool.closed !== true && + pool.destroyed !== true + )) - if (!/^https?:/.test(url.origin || url.protocol)) { - throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.') + if (pool) { + this[kRemoveClient](pool) } - return url - } - - if (!url || typeof url !== 'object') { - throw new InvalidArgumentError('Invalid URL: The URL argument must be a non-null object.') + return this } - if (!/^https?:/.test(url.origin || url.protocol)) { - throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.') + get upstreams () { + return this[kClients] + .filter(dispatcher => dispatcher.closed !== true && dispatcher.destroyed !== true) + .map((p) => p[kUrl].origin) } - if (!(url instanceof URL)) { - if (url.port != null && url.port !== '' && !Number.isFinite(parseInt(url.port))) { - throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.') + [kGetDispatcher] () { + // We validate that pools is greater than 0, + // otherwise we would have to wait until an upstream + // is added, which might never happen. + if (this[kClients].length === 0) { + throw new BalancedPoolMissingUpstreamError() } - if (url.path != null && typeof url.path !== 'string') { - throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.') - } + const dispatcher = this[kClients].find(dispatcher => ( + !dispatcher[kNeedDrain] && + dispatcher.closed !== true && + dispatcher.destroyed !== true + )) - if (url.pathname != null && typeof url.pathname !== 'string') { - throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.') + if (!dispatcher) { + return } - if (url.hostname != null && typeof url.hostname !== 'string') { - throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.') - } + const allClientsBusy = this[kClients].map(pool => pool[kNeedDrain]).reduce((a, b) => a && b, true) - if (url.origin != null && typeof url.origin !== 'string') { - throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.') + if (allClientsBusy) { + return } - const port = url.port != null - ? url.port - : (url.protocol === 'https:' ? 443 : 80) - let origin = url.origin != null - ? url.origin - : `${url.protocol}//${url.hostname}:${port}` - let path = url.path != null - ? url.path - : `${url.pathname || ''}${url.search || ''}` + let counter = 0 - if (origin.endsWith('/')) { - origin = origin.substring(0, origin.length - 1) - } + let maxWeightIndex = this[kClients].findIndex(pool => !pool[kNeedDrain]) - if (path && !path.startsWith('/')) { - path = `/${path}` - } - // new URL(path, origin) is unsafe when `path` contains an absolute URL - // From https://developer.mozilla.org/en-US/docs/Web/API/URL/URL: - // If first parameter is a relative URL, second param is required, and will be used as the base URL. - // If first parameter is an absolute URL, a given second param will be ignored. - url = new URL(origin + path) - } + while (counter++ < this[kClients].length) { + this[kIndex] = (this[kIndex] + 1) % this[kClients].length + const pool = this[kClients][this[kIndex]] - return url -} + // find pool index with the largest weight + if (pool[kWeight] > this[kClients][maxWeightIndex][kWeight] && !pool[kNeedDrain]) { + maxWeightIndex = this[kIndex] + } -function parseOrigin (url) { - url = parseURL(url) + // decrease the current weight every `this[kClients].length`. + if (this[kIndex] === 0) { + // Set the current weight to the next lower weight. + this[kCurrentWeight] = this[kCurrentWeight] - this[kGreatestCommonDivisor] - if (url.pathname !== '/' || url.search || url.hash) { - throw new InvalidArgumentError('invalid url') - } + if (this[kCurrentWeight] <= 0) { + this[kCurrentWeight] = this[kMaxWeightPerServer] + } + } + if (pool[kWeight] >= this[kCurrentWeight] && (!pool[kNeedDrain])) { + return pool + } + } - return url + this[kCurrentWeight] = this[kClients][maxWeightIndex][kWeight] + this[kIndex] = maxWeightIndex + return this[kClients][maxWeightIndex] + } } -function getHostname (host) { - if (host[0] === '[') { - const idx = host.indexOf(']') +module.exports = BalancedPool - assert(idx !== -1) - return host.substring(1, idx) - } - const idx = host.indexOf(':') - if (idx === -1) return host +/***/ }), - return host.substring(0, idx) -} +/***/ 66101: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// IP addresses are not valid server names per RFC6066 -// > Currently, the only server names supported are DNS hostnames -function getServerName (host) { - if (!host) { - return null - } +"use strict"; - assert.strictEqual(typeof host, 'string') - const servername = getHostname(host) - if (net.isIP(servername)) { - return '' - } +const { kConstruct } = __nccwpck_require__(29174) +const { urlEquals, fieldValues: getFieldValues } = __nccwpck_require__(82396) +const { kEnumerableProperty, isDisturbed } = __nccwpck_require__(83983) +const { kHeadersList } = __nccwpck_require__(72785) +const { webidl } = __nccwpck_require__(21744) +const { Response, cloneResponse } = __nccwpck_require__(27823) +const { Request } = __nccwpck_require__(48359) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(15861) +const { fetching } = __nccwpck_require__(74881) +const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = __nccwpck_require__(52538) +const assert = __nccwpck_require__(39491) +const { getGlobalDispatcher } = __nccwpck_require__(21892) - return servername -} +/** + * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation + * @typedef {Object} CacheBatchOperation + * @property {'delete' | 'put'} type + * @property {any} request + * @property {any} response + * @property {import('../../types/cache').CacheQueryOptions} options + */ -function deepClone (obj) { - return JSON.parse(JSON.stringify(obj)) -} +/** + * @see https://w3c.github.io/ServiceWorker/#dfn-request-response-list + * @typedef {[any, any][]} requestResponseList + */ -function isAsyncIterable (obj) { - return !!(obj != null && typeof obj[Symbol.asyncIterator] === 'function') -} +class Cache { + /** + * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-request-response-list + * @type {requestResponseList} + */ + #relevantRequestResponseList -function isIterable (obj) { - return !!(obj != null && (typeof obj[Symbol.iterator] === 'function' || typeof obj[Symbol.asyncIterator] === 'function')) -} + constructor () { + if (arguments[0] !== kConstruct) { + webidl.illegalConstructor() + } -function bodyLength (body) { - if (body == null) { - return 0 - } else if (isStream(body)) { - const state = body._readableState - return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length) - ? state.length - : null - } else if (isBlobLike(body)) { - return body.size != null ? body.size : null - } else if (isBuffer(body)) { - return body.byteLength + this.#relevantRequestResponseList = arguments[1] } - return null -} - -function isDestroyed (stream) { - return !stream || !!(stream.destroyed || stream[kDestroyed]) -} + async match (request, options = {}) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.match' }) -function isReadableAborted (stream) { - const state = stream && stream._readableState - return isDestroyed(stream) && state && !state.endEmitted -} + request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) -function destroy (stream, err) { - if (stream == null || !isStream(stream) || isDestroyed(stream)) { - return - } + const p = await this.matchAll(request, options) - if (typeof stream.destroy === 'function') { - if (Object.getPrototypeOf(stream).constructor === IncomingMessage) { - // See: https://github.com/nodejs/node/pull/38505/files - stream.socket = null + if (p.length === 0) { + return } - stream.destroy(err) - } else if (err) { - process.nextTick((stream, err) => { - stream.emit('error', err) - }, stream, err) + return p[0] } - if (stream.destroyed !== true) { - stream[kDestroyed] = true - } -} + async matchAll (request = undefined, options = {}) { + webidl.brandCheck(this, Cache) -const KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/ -function parseKeepAliveTimeout (val) { - const m = val.toString().match(KEEPALIVE_TIMEOUT_EXPR) - return m ? parseInt(m[1], 10) * 1000 : null -} + if (request !== undefined) request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) -/** - * Retrieves a header name and returns its lowercase value. - * @param {string | Buffer} value Header name - * @returns {string} - */ -function headerNameToString (value) { - return headerNameLowerCasedRecord[value] || value.toLowerCase() -} + // 1. + let r = null -function parseHeaders (headers, obj = {}) { - // For H2 support - if (!Array.isArray(headers)) return headers + // 2. + if (request !== undefined) { + if (request instanceof Request) { + // 2.1.1 + r = request[kState] - for (let i = 0; i < headers.length; i += 2) { - const key = headers[i].toString().toLowerCase() - let val = obj[key] + // 2.1.2 + if (r.method !== 'GET' && !options.ignoreMethod) { + return [] + } + } else if (typeof request === 'string') { + // 2.2.1 + r = new Request(request)[kState] + } + } - if (!val) { - if (Array.isArray(headers[i + 1])) { - obj[key] = headers[i + 1].map(x => x.toString('utf8')) - } else { - obj[key] = headers[i + 1].toString('utf8') + // 5. + // 5.1 + const responses = [] + + // 5.2 + if (request === undefined) { + // 5.2.1 + for (const requestResponse of this.#relevantRequestResponseList) { + responses.push(requestResponse[1]) } - } else { - if (!Array.isArray(val)) { - val = [val] - obj[key] = val + } else { // 5.3 + // 5.3.1 + const requestResponses = this.#queryCache(r, options) + + // 5.3.2 + for (const requestResponse of requestResponses) { + responses.push(requestResponse[1]) } - val.push(headers[i + 1].toString('utf8')) } - } - // See https://github.com/nodejs/node/pull/46528 - if ('content-length' in obj && 'content-disposition' in obj) { - obj['content-disposition'] = Buffer.from(obj['content-disposition']).toString('latin1') - } - - return obj -} + // 5.4 + // We don't implement CORs so we don't need to loop over the responses, yay! -function parseRawHeaders (headers) { - const ret = [] - let hasContentLength = false - let contentDispositionIdx = -1 + // 5.5.1 + const responseList = [] - for (let n = 0; n < headers.length; n += 2) { - const key = headers[n + 0].toString() - const val = headers[n + 1].toString('utf8') + // 5.5.2 + for (const response of responses) { + // 5.5.2.1 + const responseObject = new Response(response.body?.source ?? null) + const body = responseObject[kState].body + responseObject[kState] = response + responseObject[kState].body = body + responseObject[kHeaders][kHeadersList] = response.headersList + responseObject[kHeaders][kGuard] = 'immutable' - if (key.length === 14 && (key === 'content-length' || key.toLowerCase() === 'content-length')) { - ret.push(key, val) - hasContentLength = true - } else if (key.length === 19 && (key === 'content-disposition' || key.toLowerCase() === 'content-disposition')) { - contentDispositionIdx = ret.push(key, val) - 1 - } else { - ret.push(key, val) + responseList.push(responseObject) } - } - // See https://github.com/nodejs/node/pull/46528 - if (hasContentLength && contentDispositionIdx !== -1) { - ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString('latin1') + // 6. + return Object.freeze(responseList) } - return ret -} - -function isBuffer (buffer) { - // See, https://github.com/mcollina/undici/pull/319 - return buffer instanceof Uint8Array || Buffer.isBuffer(buffer) -} + async add (request) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.add' }) -function validateHandler (handler, method, upgrade) { - if (!handler || typeof handler !== 'object') { - throw new InvalidArgumentError('handler must be an object') - } + request = webidl.converters.RequestInfo(request) - if (typeof handler.onConnect !== 'function') { - throw new InvalidArgumentError('invalid onConnect method') - } + // 1. + const requests = [request] - if (typeof handler.onError !== 'function') { - throw new InvalidArgumentError('invalid onError method') - } + // 2. + const responseArrayPromise = this.addAll(requests) - if (typeof handler.onBodySent !== 'function' && handler.onBodySent !== undefined) { - throw new InvalidArgumentError('invalid onBodySent method') + // 3. + return await responseArrayPromise } - if (upgrade || method === 'CONNECT') { - if (typeof handler.onUpgrade !== 'function') { - throw new InvalidArgumentError('invalid onUpgrade method') - } - } else { - if (typeof handler.onHeaders !== 'function') { - throw new InvalidArgumentError('invalid onHeaders method') - } - - if (typeof handler.onData !== 'function') { - throw new InvalidArgumentError('invalid onData method') - } + async addAll (requests) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.addAll' }) - if (typeof handler.onComplete !== 'function') { - throw new InvalidArgumentError('invalid onComplete method') - } - } -} + requests = webidl.converters['sequence'](requests) -// A body is disturbed if it has been read from and it cannot -// be re-used without losing state or data. -function isDisturbed (body) { - return !!(body && ( - stream.isDisturbed - ? stream.isDisturbed(body) || body[kBodyUsed] // TODO (fix): Why is body[kBodyUsed] needed? - : body[kBodyUsed] || - body.readableDidRead || - (body._readableState && body._readableState.dataEmitted) || - isReadableAborted(body) - )) -} + // 1. + const responsePromises = [] -function isErrored (body) { - return !!(body && ( - stream.isErrored - ? stream.isErrored(body) - : /state: 'errored'/.test(nodeUtil.inspect(body) - ))) -} + // 2. + const requestList = [] -function isReadable (body) { - return !!(body && ( - stream.isReadable - ? stream.isReadable(body) - : /state: 'readable'/.test(nodeUtil.inspect(body) - ))) -} + // 3. + for (const request of requests) { + if (typeof request === 'string') { + continue + } -function getSocketInfo (socket) { - return { - localAddress: socket.localAddress, - localPort: socket.localPort, - remoteAddress: socket.remoteAddress, - remotePort: socket.remotePort, - remoteFamily: socket.remoteFamily, - timeout: socket.timeout, - bytesWritten: socket.bytesWritten, - bytesRead: socket.bytesRead - } -} + // 3.1 + const r = request[kState] -async function * convertIterableToBuffer (iterable) { - for await (const chunk of iterable) { - yield Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk) - } -} + // 3.2 + if (!urlIsHttpHttpsScheme(r.url) || r.method !== 'GET') { + throw webidl.errors.exception({ + header: 'Cache.addAll', + message: 'Expected http/s scheme when method is not GET.' + }) + } + } -let ReadableStream -function ReadableStreamFrom (iterable) { - if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(35356).ReadableStream) - } + // 4. + /** @type {ReturnType[]} */ + const fetchControllers = [] - if (ReadableStream.from) { - return ReadableStream.from(convertIterableToBuffer(iterable)) - } + // 5. + for (const request of requests) { + // 5.1 + const r = new Request(request)[kState] - let iterator - return new ReadableStream( - { - async start () { - iterator = iterable[Symbol.asyncIterator]() - }, - async pull (controller) { - const { done, value } = await iterator.next() - if (done) { - queueMicrotask(() => { - controller.close() - }) - } else { - const buf = Buffer.isBuffer(value) ? value : Buffer.from(value) - controller.enqueue(new Uint8Array(buf)) - } - return controller.desiredSize > 0 - }, - async cancel (reason) { - await iterator.return() + // 5.2 + if (!urlIsHttpHttpsScheme(r.url)) { + throw webidl.errors.exception({ + header: 'Cache.addAll', + message: 'Expected http/s scheme.' + }) } - }, - 0 - ) -} -// The chunk should be a FormData instance and contains -// all the required methods. -function isFormDataLike (object) { - return ( - object && - typeof object === 'object' && - typeof object.append === 'function' && - typeof object.delete === 'function' && - typeof object.get === 'function' && - typeof object.getAll === 'function' && - typeof object.has === 'function' && - typeof object.set === 'function' && - object[Symbol.toStringTag] === 'FormData' - ) -} + // 5.4 + r.initiator = 'fetch' + r.destination = 'subresource' -function throwIfAborted (signal) { - if (!signal) { return } - if (typeof signal.throwIfAborted === 'function') { - signal.throwIfAborted() - } else { - if (signal.aborted) { - // DOMException not available < v17.0.0 - const err = new Error('The operation was aborted') - err.name = 'AbortError' - throw err - } - } -} + // 5.5 + requestList.push(r) -function addAbortListener (signal, listener) { - if ('addEventListener' in signal) { - signal.addEventListener('abort', listener, { once: true }) - return () => signal.removeEventListener('abort', listener) - } - signal.addListener('abort', listener) - return () => signal.removeListener('abort', listener) -} + // 5.6 + const responsePromise = createDeferredPromise() -const hasToWellFormed = !!String.prototype.toWellFormed + // 5.7 + fetchControllers.push(fetching({ + request: r, + dispatcher: getGlobalDispatcher(), + processResponse (response) { + // 1. + if (response.type === 'error' || response.status === 206 || response.status < 200 || response.status > 299) { + responsePromise.reject(webidl.errors.exception({ + header: 'Cache.addAll', + message: 'Received an invalid status code or the request failed.' + })) + } else if (response.headersList.contains('vary')) { // 2. + // 2.1 + const fieldValues = getFieldValues(response.headersList.get('vary')) -/** - * @param {string} val - */ -function toUSVString (val) { - if (hasToWellFormed) { - return `${val}`.toWellFormed() - } else if (nodeUtil.toUSVString) { - return nodeUtil.toUSVString(val) - } + // 2.2 + for (const fieldValue of fieldValues) { + // 2.2.1 + if (fieldValue === '*') { + responsePromise.reject(webidl.errors.exception({ + header: 'Cache.addAll', + message: 'invalid vary field value' + })) - return `${val}` -} + for (const controller of fetchControllers) { + controller.abort() + } -// Parsed accordingly to RFC 9110 -// https://www.rfc-editor.org/rfc/rfc9110#field.content-range -function parseRangeHeader (range) { - if (range == null || range === '') return { start: 0, end: null, size: null } + return + } + } + } + }, + processResponseEndOfBody (response) { + // 1. + if (response.aborted) { + responsePromise.reject(new DOMException('aborted', 'AbortError')) + return + } - const m = range ? range.match(/^bytes (\d+)-(\d+)\/(\d+)?$/) : null - return m - ? { - start: parseInt(m[1]), - end: m[2] ? parseInt(m[2]) : null, - size: m[3] ? parseInt(m[3]) : null - } - : null -} + // 2. + responsePromise.resolve(response) + } + })) -const kEnumerableProperty = Object.create(null) -kEnumerableProperty.enumerable = true + // 5.8 + responsePromises.push(responsePromise.promise) + } -module.exports = { - kEnumerableProperty, - nop, - isDisturbed, - isErrored, - isReadable, - toUSVString, - isReadableAborted, - isBlobLike, - parseOrigin, - parseURL, - getServerName, - isStream, - isIterable, - isAsyncIterable, - isDestroyed, - headerNameToString, - parseRawHeaders, - parseHeaders, - parseKeepAliveTimeout, - destroy, - bodyLength, - deepClone, - ReadableStreamFrom, - isBuffer, - validateHandler, - getSocketInfo, - isFormDataLike, - buildURL, - throwIfAborted, - addAbortListener, - parseRangeHeader, - nodeMajor, - nodeMinor, - nodeHasAutoSelectFamily: nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 13), - safeHTTPMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE'] -} + // 6. + const p = Promise.all(responsePromises) + // 7. + const responses = await p -/***/ }), + // 7.1 + const operations = [] -/***/ 74839: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 7.2 + let index = 0 -"use strict"; + // 7.3 + for (const response of responses) { + // 7.3.1 + /** @type {CacheBatchOperation} */ + const operation = { + type: 'put', // 7.3.2 + request: requestList[index], // 7.3.3 + response // 7.3.4 + } + operations.push(operation) // 7.3.5 -const Dispatcher = __nccwpck_require__(60412) -const { - ClientDestroyedError, - ClientClosedError, - InvalidArgumentError -} = __nccwpck_require__(48045) -const { kDestroy, kClose, kDispatch, kInterceptors } = __nccwpck_require__(72785) + index++ // 7.3.6 + } -const kDestroyed = Symbol('destroyed') -const kClosed = Symbol('closed') -const kOnDestroyed = Symbol('onDestroyed') -const kOnClosed = Symbol('onClosed') -const kInterceptedDispatch = Symbol('Intercepted Dispatch') + // 7.5 + const cacheJobPromise = createDeferredPromise() -class DispatcherBase extends Dispatcher { - constructor () { - super() + // 7.6.1 + let errorData = null - this[kDestroyed] = false - this[kOnDestroyed] = null - this[kClosed] = false - this[kOnClosed] = [] - } + // 7.6.2 + try { + this.#batchCacheOperations(operations) + } catch (e) { + errorData = e + } - get destroyed () { - return this[kDestroyed] - } + // 7.6.3 + queueMicrotask(() => { + // 7.6.3.1 + if (errorData === null) { + cacheJobPromise.resolve(undefined) + } else { + // 7.6.3.2 + cacheJobPromise.reject(errorData) + } + }) - get closed () { - return this[kClosed] + // 7.7 + return cacheJobPromise.promise } - get interceptors () { - return this[kInterceptors] - } + async put (request, response) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 2, { header: 'Cache.put' }) - set interceptors (newInterceptors) { - if (newInterceptors) { - for (let i = newInterceptors.length - 1; i >= 0; i--) { - const interceptor = this[kInterceptors][i] - if (typeof interceptor !== 'function') { - throw new InvalidArgumentError('interceptor must be an function') - } - } - } + request = webidl.converters.RequestInfo(request) + response = webidl.converters.Response(response) - this[kInterceptors] = newInterceptors - } + // 1. + let innerRequest = null - close (callback) { - if (callback === undefined) { - return new Promise((resolve, reject) => { - this.close((err, data) => { - return err ? reject(err) : resolve(data) - }) - }) + // 2. + if (request instanceof Request) { + innerRequest = request[kState] + } else { // 3. + innerRequest = new Request(request)[kState] } - if (typeof callback !== 'function') { - throw new InvalidArgumentError('invalid callback') + // 4. + if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== 'GET') { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Expected an http/s scheme when method is not GET' + }) } - if (this[kDestroyed]) { - queueMicrotask(() => callback(new ClientDestroyedError(), null)) - return - } + // 5. + const innerResponse = response[kState] - if (this[kClosed]) { - if (this[kOnClosed]) { - this[kOnClosed].push(callback) - } else { - queueMicrotask(() => callback(null, null)) - } - return + // 6. + if (innerResponse.status === 206) { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Got 206 status' + }) } - this[kClosed] = true - this[kOnClosed].push(callback) + // 7. + if (innerResponse.headersList.contains('vary')) { + // 7.1. + const fieldValues = getFieldValues(innerResponse.headersList.get('vary')) - const onClosed = () => { - const callbacks = this[kOnClosed] - this[kOnClosed] = null - for (let i = 0; i < callbacks.length; i++) { - callbacks[i](null, null) + // 7.2. + for (const fieldValue of fieldValues) { + // 7.2.1 + if (fieldValue === '*') { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Got * vary field value' + }) + } } } - // Should not error. - this[kClose]() - .then(() => this.destroy()) - .then(() => { - queueMicrotask(onClosed) + // 8. + if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) { + throw webidl.errors.exception({ + header: 'Cache.put', + message: 'Response body is locked or disturbed' }) - } - - destroy (err, callback) { - if (typeof err === 'function') { - callback = err - err = null } - if (callback === undefined) { - return new Promise((resolve, reject) => { - this.destroy(err, (err, data) => { - return err ? /* istanbul ignore next: should never error */ reject(err) : resolve(data) - }) - }) - } + // 9. + const clonedResponse = cloneResponse(innerResponse) - if (typeof callback !== 'function') { - throw new InvalidArgumentError('invalid callback') - } + // 10. + const bodyReadPromise = createDeferredPromise() - if (this[kDestroyed]) { - if (this[kOnDestroyed]) { - this[kOnDestroyed].push(callback) - } else { - queueMicrotask(() => callback(null, null)) - } - return - } + // 11. + if (innerResponse.body != null) { + // 11.1 + const stream = innerResponse.body.stream - if (!err) { - err = new ClientDestroyedError() + // 11.2 + const reader = stream.getReader() + + // 11.3 + readAllBytes(reader).then(bodyReadPromise.resolve, bodyReadPromise.reject) + } else { + bodyReadPromise.resolve(undefined) } - this[kDestroyed] = true - this[kOnDestroyed] = this[kOnDestroyed] || [] - this[kOnDestroyed].push(callback) + // 12. + /** @type {CacheBatchOperation[]} */ + const operations = [] - const onDestroyed = () => { - const callbacks = this[kOnDestroyed] - this[kOnDestroyed] = null - for (let i = 0; i < callbacks.length; i++) { - callbacks[i](null, null) - } + // 13. + /** @type {CacheBatchOperation} */ + const operation = { + type: 'put', // 14. + request: innerRequest, // 15. + response: clonedResponse // 16. } - // Should not error. - this[kDestroy](err).then(() => { - queueMicrotask(onDestroyed) - }) - } + // 17. + operations.push(operation) - [kInterceptedDispatch] (opts, handler) { - if (!this[kInterceptors] || this[kInterceptors].length === 0) { - this[kInterceptedDispatch] = this[kDispatch] - return this[kDispatch](opts, handler) - } + // 19. + const bytes = await bodyReadPromise.promise - let dispatch = this[kDispatch].bind(this) - for (let i = this[kInterceptors].length - 1; i >= 0; i--) { - dispatch = this[kInterceptors][i](dispatch) + if (clonedResponse.body != null) { + clonedResponse.body.source = bytes } - this[kInterceptedDispatch] = dispatch - return dispatch(opts, handler) - } - dispatch (opts, handler) { - if (!handler || typeof handler !== 'object') { - throw new InvalidArgumentError('handler must be an object') - } + // 19.1 + const cacheJobPromise = createDeferredPromise() + // 19.2.1 + let errorData = null + + // 19.2.2 try { - if (!opts || typeof opts !== 'object') { - throw new InvalidArgumentError('opts must be an object.') - } + this.#batchCacheOperations(operations) + } catch (e) { + errorData = e + } - if (this[kDestroyed] || this[kOnDestroyed]) { - throw new ClientDestroyedError() + // 19.2.3 + queueMicrotask(() => { + // 19.2.3.1 + if (errorData === null) { + cacheJobPromise.resolve() + } else { // 19.2.3.2 + cacheJobPromise.reject(errorData) } + }) - if (this[kClosed]) { - throw new ClientClosedError() - } + return cacheJobPromise.promise + } - return this[kInterceptedDispatch](opts, handler) - } catch (err) { - if (typeof handler.onError !== 'function') { - throw new InvalidArgumentError('invalid onError method') - } + async delete (request, options = {}) { + webidl.brandCheck(this, Cache) + webidl.argumentLengthCheck(arguments, 1, { header: 'Cache.delete' }) - handler.onError(err) + request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) - return false - } - } -} + /** + * @type {Request} + */ + let r = null -module.exports = DispatcherBase + if (request instanceof Request) { + r = request[kState] + + if (r.method !== 'GET' && !options.ignoreMethod) { + return false + } + } else { + assert(typeof request === 'string') + r = new Request(request)[kState] + } -/***/ }), + /** @type {CacheBatchOperation[]} */ + const operations = [] -/***/ 60412: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + /** @type {CacheBatchOperation} */ + const operation = { + type: 'delete', + request: r, + options + } -"use strict"; + operations.push(operation) + const cacheJobPromise = createDeferredPromise() -const EventEmitter = __nccwpck_require__(82361) + let errorData = null + let requestResponses -class Dispatcher extends EventEmitter { - dispatch () { - throw new Error('not implemented') - } + try { + requestResponses = this.#batchCacheOperations(operations) + } catch (e) { + errorData = e + } - close () { - throw new Error('not implemented') - } + queueMicrotask(() => { + if (errorData === null) { + cacheJobPromise.resolve(!!requestResponses?.length) + } else { + cacheJobPromise.reject(errorData) + } + }) - destroy () { - throw new Error('not implemented') + return cacheJobPromise.promise } -} -module.exports = Dispatcher + /** + * @see https://w3c.github.io/ServiceWorker/#dom-cache-keys + * @param {any} request + * @param {import('../../types/cache').CacheQueryOptions} options + * @returns {readonly Request[]} + */ + async keys (request = undefined, options = {}) { + webidl.brandCheck(this, Cache) + if (request !== undefined) request = webidl.converters.RequestInfo(request) + options = webidl.converters.CacheQueryOptions(options) -/***/ }), + // 1. + let r = null -/***/ 41472: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. + if (request !== undefined) { + // 2.1 + if (request instanceof Request) { + // 2.1.1 + r = request[kState] -"use strict"; + // 2.1.2 + if (r.method !== 'GET' && !options.ignoreMethod) { + return [] + } + } else if (typeof request === 'string') { // 2.2 + r = new Request(request)[kState] + } + } + // 4. + const promise = createDeferredPromise() -const Busboy = __nccwpck_require__(50727) -const util = __nccwpck_require__(83983) -const { - ReadableStreamFrom, - isBlobLike, - isReadableStreamLike, - readableStreamClose, - createDeferredPromise, - fullyReadBody -} = __nccwpck_require__(52538) -const { FormData } = __nccwpck_require__(72015) -const { kState } = __nccwpck_require__(15861) -const { webidl } = __nccwpck_require__(21744) -const { DOMException, structuredClone } = __nccwpck_require__(41037) -const { Blob, File: NativeFile } = __nccwpck_require__(14300) -const { kBodyUsed } = __nccwpck_require__(72785) -const assert = __nccwpck_require__(39491) -const { isErrored } = __nccwpck_require__(83983) -const { isUint8Array, isArrayBuffer } = __nccwpck_require__(29830) -const { File: UndiciFile } = __nccwpck_require__(78511) -const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) + // 5. + // 5.1 + const requests = [] -let random -try { - const crypto = __nccwpck_require__(6005) - random = (max) => crypto.randomInt(0, max) -} catch { - random = (max) => Math.floor(Math.random(max)) -} + // 5.2 + if (request === undefined) { + // 5.2.1 + for (const requestResponse of this.#relevantRequestResponseList) { + // 5.2.1.1 + requests.push(requestResponse[0]) + } + } else { // 5.3 + // 5.3.1 + const requestResponses = this.#queryCache(r, options) -let ReadableStream = globalThis.ReadableStream + // 5.3.2 + for (const requestResponse of requestResponses) { + // 5.3.2.1 + requests.push(requestResponse[0]) + } + } -/** @type {globalThis['File']} */ -const File = NativeFile ?? UndiciFile -const textEncoder = new TextEncoder() -const textDecoder = new TextDecoder() + // 5.4 + queueMicrotask(() => { + // 5.4.1 + const requestList = [] -// https://fetch.spec.whatwg.org/#concept-bodyinit-extract -function extractBody (object, keepalive = false) { - if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(35356).ReadableStream) - } + // 5.4.2 + for (const request of requests) { + const requestObject = new Request('https://a') + requestObject[kState] = request + requestObject[kHeaders][kHeadersList] = request.headersList + requestObject[kHeaders][kGuard] = 'immutable' + requestObject[kRealm] = request.client - // 1. Let stream be null. - let stream = null + // 5.4.2.1 + requestList.push(requestObject) + } - // 2. If object is a ReadableStream object, then set stream to object. - if (object instanceof ReadableStream) { - stream = object - } else if (isBlobLike(object)) { - // 3. Otherwise, if object is a Blob object, set stream to the - // result of running object’s get stream. - stream = object.stream() - } else { - // 4. Otherwise, set stream to a new ReadableStream object, and set - // up stream. - stream = new ReadableStream({ - async pull (controller) { - controller.enqueue( - typeof source === 'string' ? textEncoder.encode(source) : source - ) - queueMicrotask(() => readableStreamClose(controller)) - }, - start () {}, - type: undefined + // 5.4.3 + promise.resolve(Object.freeze(requestList)) }) + + return promise.promise } - // 5. Assert: stream is a ReadableStream object. - assert(isReadableStreamLike(stream)) + /** + * @see https://w3c.github.io/ServiceWorker/#batch-cache-operations-algorithm + * @param {CacheBatchOperation[]} operations + * @returns {requestResponseList} + */ + #batchCacheOperations (operations) { + // 1. + const cache = this.#relevantRequestResponseList - // 6. Let action be null. - let action = null + // 2. + const backupCache = [...cache] - // 7. Let source be null. - let source = null + // 3. + const addedItems = [] - // 8. Let length be null. - let length = null + // 4.1 + const resultList = [] - // 9. Let type be null. - let type = null + try { + // 4.2 + for (const operation of operations) { + // 4.2.1 + if (operation.type !== 'delete' && operation.type !== 'put') { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'operation type does not match "delete" or "put"' + }) + } - // 10. Switch on object: - if (typeof object === 'string') { - // Set source to the UTF-8 encoding of object. - // Note: setting source to a Uint8Array here breaks some mocking assumptions. - source = object + // 4.2.2 + if (operation.type === 'delete' && operation.response != null) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'delete operation should not have an associated response' + }) + } - // Set type to `text/plain;charset=UTF-8`. - type = 'text/plain;charset=UTF-8' - } else if (object instanceof URLSearchParams) { - // URLSearchParams + // 4.2.3 + if (this.#queryCache(operation.request, operation.options, addedItems).length) { + throw new DOMException('???', 'InvalidStateError') + } - // spec says to run application/x-www-form-urlencoded on body.list - // this is implemented in Node.js as apart of an URLSearchParams instance toString method - // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490 - // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100 + // 4.2.4 + let requestResponses - // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list. - source = object.toString() + // 4.2.5 + if (operation.type === 'delete') { + // 4.2.5.1 + requestResponses = this.#queryCache(operation.request, operation.options) - // Set type to `application/x-www-form-urlencoded;charset=UTF-8`. - type = 'application/x-www-form-urlencoded;charset=UTF-8' - } else if (isArrayBuffer(object)) { - // BufferSource/ArrayBuffer + // TODO: the spec is wrong, this is needed to pass WPTs + if (requestResponses.length === 0) { + return [] + } - // Set source to a copy of the bytes held by object. - source = new Uint8Array(object.slice()) - } else if (ArrayBuffer.isView(object)) { - // BufferSource/ArrayBufferView + // 4.2.5.2 + for (const requestResponse of requestResponses) { + const idx = cache.indexOf(requestResponse) + assert(idx !== -1) - // Set source to a copy of the bytes held by object. - source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength)) - } else if (util.isFormDataLike(object)) { - const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}` - const prefix = `--${boundary}\r\nContent-Disposition: form-data` + // 4.2.5.2.1 + cache.splice(idx, 1) + } + } else if (operation.type === 'put') { // 4.2.6 + // 4.2.6.1 + if (operation.response == null) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'put operation should have an associated response' + }) + } - /*! formdata-polyfill. MIT License. Jimmy Wärting */ - const escape = (str) => - str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22') - const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, '\r\n') + // 4.2.6.2 + const r = operation.request - // Set action to this step: run the multipart/form-data - // encoding algorithm, with object’s entry list and UTF-8. - // - This ensures that the body is immutable and can't be changed afterwords - // - That the content-length is calculated in advance. - // - And that all parts are pre-encoded and ready to be sent. + // 4.2.6.3 + if (!urlIsHttpHttpsScheme(r.url)) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'expected http or https scheme' + }) + } - const blobParts = [] - const rn = new Uint8Array([13, 10]) // '\r\n' - length = 0 - let hasUnknownSizeValue = false + // 4.2.6.4 + if (r.method !== 'GET') { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'not get method' + }) + } - for (const [name, value] of object) { - if (typeof value === 'string') { - const chunk = textEncoder.encode(prefix + - `; name="${escape(normalizeLinefeeds(name))}"` + - `\r\n\r\n${normalizeLinefeeds(value)}\r\n`) - blobParts.push(chunk) - length += chunk.byteLength - } else { - const chunk = textEncoder.encode(`${prefix}; name="${escape(normalizeLinefeeds(name))}"` + - (value.name ? `; filename="${escape(value.name)}"` : '') + '\r\n' + - `Content-Type: ${ - value.type || 'application/octet-stream' - }\r\n\r\n`) - blobParts.push(chunk, value, rn) - if (typeof value.size === 'number') { - length += chunk.byteLength + value.size + rn.byteLength - } else { - hasUnknownSizeValue = true + // 4.2.6.5 + if (operation.options != null) { + throw webidl.errors.exception({ + header: 'Cache.#batchCacheOperations', + message: 'options must not be defined' + }) + } + + // 4.2.6.6 + requestResponses = this.#queryCache(operation.request) + + // 4.2.6.7 + for (const requestResponse of requestResponses) { + const idx = cache.indexOf(requestResponse) + assert(idx !== -1) + + // 4.2.6.7.1 + cache.splice(idx, 1) + } + + // 4.2.6.8 + cache.push([operation.request, operation.response]) + + // 4.2.6.10 + addedItems.push([operation.request, operation.response]) } + + // 4.2.7 + resultList.push([operation.request, operation.response]) } - } - const chunk = textEncoder.encode(`--${boundary}--`) - blobParts.push(chunk) - length += chunk.byteLength - if (hasUnknownSizeValue) { - length = null + // 4.3 + return resultList + } catch (e) { // 5. + // 5.1 + this.#relevantRequestResponseList.length = 0 + + // 5.2 + this.#relevantRequestResponseList = backupCache + + // 5.3 + throw e } + } - // Set source to object. - source = object + /** + * @see https://w3c.github.io/ServiceWorker/#query-cache + * @param {any} requestQuery + * @param {import('../../types/cache').CacheQueryOptions} options + * @param {requestResponseList} targetStorage + * @returns {requestResponseList} + */ + #queryCache (requestQuery, options, targetStorage) { + /** @type {requestResponseList} */ + const resultList = [] - action = async function * () { - for (const part of blobParts) { - if (part.stream) { - yield * part.stream() - } else { - yield part - } + const storage = targetStorage ?? this.#relevantRequestResponseList + + for (const requestResponse of storage) { + const [cachedRequest, cachedResponse] = requestResponse + if (this.#requestMatchesCachedItem(requestQuery, cachedRequest, cachedResponse, options)) { + resultList.push(requestResponse) } } - // Set type to `multipart/form-data; boundary=`, - // followed by the multipart/form-data boundary string generated - // by the multipart/form-data encoding algorithm. - type = 'multipart/form-data; boundary=' + boundary - } else if (isBlobLike(object)) { - // Blob + return resultList + } - // Set source to object. - source = object + /** + * @see https://w3c.github.io/ServiceWorker/#request-matches-cached-item-algorithm + * @param {any} requestQuery + * @param {any} request + * @param {any | null} response + * @param {import('../../types/cache').CacheQueryOptions | undefined} options + * @returns {boolean} + */ + #requestMatchesCachedItem (requestQuery, request, response = null, options) { + // if (options?.ignoreMethod === false && request.method === 'GET') { + // return false + // } - // Set length to object’s size. - length = object.size + const queryURL = new URL(requestQuery.url) - // If object’s type attribute is not the empty byte sequence, set - // type to its value. - if (object.type) { - type = object.type + const cachedURL = new URL(request.url) + + if (options?.ignoreSearch) { + cachedURL.search = '' + + queryURL.search = '' } - } else if (typeof object[Symbol.asyncIterator] === 'function') { - // If keepalive is true, then throw a TypeError. - if (keepalive) { - throw new TypeError('keepalive') + + if (!urlEquals(queryURL, cachedURL, true)) { + return false } - // If object is disturbed or locked, then throw a TypeError. - if (util.isDisturbed(object) || object.locked) { - throw new TypeError( - 'Response body object should not be disturbed or locked' - ) + if ( + response == null || + options?.ignoreVary || + !response.headersList.contains('vary') + ) { + return true } - stream = - object instanceof ReadableStream ? object : ReadableStreamFrom(object) - } + const fieldValues = getFieldValues(response.headersList.get('vary')) - // 11. If source is a byte sequence, then set action to a - // step that returns source and length to source’s length. - if (typeof source === 'string' || util.isBuffer(source)) { - length = Buffer.byteLength(source) - } + for (const fieldValue of fieldValues) { + if (fieldValue === '*') { + return false + } - // 12. If action is non-null, then run these steps in in parallel: - if (action != null) { - // Run action. - let iterator - stream = new ReadableStream({ - async start () { - iterator = action(object)[Symbol.asyncIterator]() - }, - async pull (controller) { - const { value, done } = await iterator.next() - if (done) { - // When running action is done, close stream. - queueMicrotask(() => { - controller.close() - }) - } else { - // Whenever one or more bytes are available and stream is not errored, - // enqueue a Uint8Array wrapping an ArrayBuffer containing the available - // bytes into stream. - if (!isErrored(stream)) { - controller.enqueue(new Uint8Array(value)) - } - } - return controller.desiredSize > 0 - }, - async cancel (reason) { - await iterator.return() - }, - type: undefined - }) - } + const requestValue = request.headersList.get(fieldValue) + const queryValue = requestQuery.headersList.get(fieldValue) - // 13. Let body be a body whose stream is stream, source is source, - // and length is length. - const body = { stream, source, length } + // If one has the header and the other doesn't, or one has + // a different value than the other, return false + if (requestValue !== queryValue) { + return false + } + } - // 14. Return (body, type). - return [body, type] + return true + } } -// https://fetch.spec.whatwg.org/#bodyinit-safely-extract -function safelyExtractBody (object, keepalive = false) { - if (!ReadableStream) { - // istanbul ignore next - ReadableStream = (__nccwpck_require__(35356).ReadableStream) +Object.defineProperties(Cache.prototype, { + [Symbol.toStringTag]: { + value: 'Cache', + configurable: true + }, + match: kEnumerableProperty, + matchAll: kEnumerableProperty, + add: kEnumerableProperty, + addAll: kEnumerableProperty, + put: kEnumerableProperty, + delete: kEnumerableProperty, + keys: kEnumerableProperty +}) + +const cacheQueryOptionConverters = [ + { + key: 'ignoreSearch', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'ignoreMethod', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'ignoreVary', + converter: webidl.converters.boolean, + defaultValue: false } +] - // To safely extract a body and a `Content-Type` value from - // a byte sequence or BodyInit object object, run these steps: +webidl.converters.CacheQueryOptions = webidl.dictionaryConverter(cacheQueryOptionConverters) - // 1. If object is a ReadableStream object, then: - if (object instanceof ReadableStream) { - // Assert: object is neither disturbed nor locked. - // istanbul ignore next - assert(!util.isDisturbed(object), 'The body has already been consumed.') - // istanbul ignore next - assert(!object.locked, 'The stream is locked.') +webidl.converters.MultiCacheQueryOptions = webidl.dictionaryConverter([ + ...cacheQueryOptionConverters, + { + key: 'cacheName', + converter: webidl.converters.DOMString } +]) - // 2. Return the results of extracting object. - return extractBody(object, keepalive) -} +webidl.converters.Response = webidl.interfaceConverter(Response) -function cloneBody (body) { - // To clone a body body, run these steps: +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.RequestInfo +) - // https://fetch.spec.whatwg.org/#concept-body-clone +module.exports = { + Cache +} - // 1. Let « out1, out2 » be the result of teeing body’s stream. - const [out1, out2] = body.stream.tee() - const out2Clone = structuredClone(out2, { transfer: [out2] }) - // This, for whatever reasons, unrefs out2Clone which allows - // the process to exit by itself. - const [, finalClone] = out2Clone.tee() - // 2. Set body’s stream to out1. - body.stream = out1 +/***/ }), - // 3. Return a body whose stream is out2 and other members are copied from body. - return { - stream: finalClone, - length: body.length, - source: body.source - } -} +/***/ 37907: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -async function * consumeBody (body) { - if (body) { - if (isUint8Array(body)) { - yield body - } else { - const stream = body.stream +"use strict"; - if (util.isDisturbed(stream)) { - throw new TypeError('The body has already been consumed.') - } - if (stream.locked) { - throw new TypeError('The stream is locked.') - } +const { kConstruct } = __nccwpck_require__(29174) +const { Cache } = __nccwpck_require__(66101) +const { webidl } = __nccwpck_require__(21744) +const { kEnumerableProperty } = __nccwpck_require__(83983) - // Compat. - stream[kBodyUsed] = true +class CacheStorage { + /** + * @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map + * @type {Map { - let mimeType = bodyMimeType(this) + request = webidl.converters.RequestInfo(request) + options = webidl.converters.MultiCacheQueryOptions(options) - if (mimeType === 'failure') { - mimeType = '' - } else if (mimeType) { - mimeType = serializeAMimeType(mimeType) + // 1. + if (options.cacheName != null) { + // 1.1.1.1 + if (this.#caches.has(options.cacheName)) { + // 1.1.1.1.1 + const cacheList = this.#caches.get(options.cacheName) + const cache = new Cache(kConstruct, cacheList) + + return await cache.match(request, options) + } + } else { // 2. + // 2.2 + for (const cacheList of this.#caches.values()) { + const cache = new Cache(kConstruct, cacheList) + + // 2.2.1.2 + const response = await cache.match(request, options) + + if (response !== undefined) { + return response } + } + } + } - // Return a Blob whose contents are bytes and type attribute - // is mimeType. - return new Blob([bytes], { type: mimeType }) - }, instance) - }, + /** + * @see https://w3c.github.io/ServiceWorker/#cache-storage-has + * @param {string} cacheName + * @returns {Promise} + */ + async has (cacheName) { + webidl.brandCheck(this, CacheStorage) + webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.has' }) - arrayBuffer () { - // The arrayBuffer() method steps are to return the result - // of running consume body with this and the following step - // given a byte sequence bytes: return a new ArrayBuffer - // whose contents are bytes. - return specConsumeBody(this, (bytes) => { - return new Uint8Array(bytes).buffer - }, instance) - }, + cacheName = webidl.converters.DOMString(cacheName) - text () { - // The text() method steps are to return the result of running - // consume body with this and UTF-8 decode. - return specConsumeBody(this, utf8DecodeBytes, instance) - }, + // 2.1.1 + // 2.2 + return this.#caches.has(cacheName) + } - json () { - // The json() method steps are to return the result of running - // consume body with this and parse JSON from bytes. - return specConsumeBody(this, parseJSONFromBytes, instance) - }, + /** + * @see https://w3c.github.io/ServiceWorker/#dom-cachestorage-open + * @param {string} cacheName + * @returns {Promise} + */ + async open (cacheName) { + webidl.brandCheck(this, CacheStorage) + webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.open' }) - async formData () { - webidl.brandCheck(this, instance) + cacheName = webidl.converters.DOMString(cacheName) - throwIfAborted(this[kState]) + // 2.1 + if (this.#caches.has(cacheName)) { + // await caches.open('v1') !== await caches.open('v1') - const contentType = this.headers.get('Content-Type') + // 2.1.1 + const cache = this.#caches.get(cacheName) - // If mimeType’s essence is "multipart/form-data", then: - if (/multipart\/form-data/.test(contentType)) { - const headers = {} - for (const [key, value] of this.headers) headers[key.toLowerCase()] = value + // 2.1.1.1 + return new Cache(kConstruct, cache) + } - const responseFormData = new FormData() + // 2.2 + const cache = [] - let busboy + // 2.3 + this.#caches.set(cacheName, cache) - try { - busboy = new Busboy({ - headers, - preservePath: true - }) - } catch (err) { - throw new DOMException(`${err}`, 'AbortError') - } + // 2.4 + return new Cache(kConstruct, cache) + } - busboy.on('field', (name, value) => { - responseFormData.append(name, value) - }) - busboy.on('file', (name, value, filename, encoding, mimeType) => { - const chunks = [] + /** + * @see https://w3c.github.io/ServiceWorker/#cache-storage-delete + * @param {string} cacheName + * @returns {Promise} + */ + async delete (cacheName) { + webidl.brandCheck(this, CacheStorage) + webidl.argumentLengthCheck(arguments, 1, { header: 'CacheStorage.delete' }) - if (encoding === 'base64' || encoding.toLowerCase() === 'base64') { - let base64chunk = '' + cacheName = webidl.converters.DOMString(cacheName) - value.on('data', (chunk) => { - base64chunk += chunk.toString().replace(/[\r\n]/gm, '') + return this.#caches.delete(cacheName) + } - const end = base64chunk.length - base64chunk.length % 4 - chunks.push(Buffer.from(base64chunk.slice(0, end), 'base64')) + /** + * @see https://w3c.github.io/ServiceWorker/#cache-storage-keys + * @returns {string[]} + */ + async keys () { + webidl.brandCheck(this, CacheStorage) - base64chunk = base64chunk.slice(end) - }) - value.on('end', () => { - chunks.push(Buffer.from(base64chunk, 'base64')) - responseFormData.append(name, new File(chunks, filename, { type: mimeType })) - }) - } else { - value.on('data', (chunk) => { - chunks.push(chunk) - }) - value.on('end', () => { - responseFormData.append(name, new File(chunks, filename, { type: mimeType })) - }) - } - }) - - const busboyResolve = new Promise((resolve, reject) => { - busboy.on('finish', resolve) - busboy.on('error', (err) => reject(new TypeError(err))) - }) + // 2.1 + const keys = this.#caches.keys() - if (this.body !== null) for await (const chunk of consumeBody(this[kState].body)) busboy.write(chunk) - busboy.end() - await busboyResolve + // 2.2 + return [...keys] + } +} - return responseFormData - } else if (/application\/x-www-form-urlencoded/.test(contentType)) { - // Otherwise, if mimeType’s essence is "application/x-www-form-urlencoded", then: +Object.defineProperties(CacheStorage.prototype, { + [Symbol.toStringTag]: { + value: 'CacheStorage', + configurable: true + }, + match: kEnumerableProperty, + has: kEnumerableProperty, + open: kEnumerableProperty, + delete: kEnumerableProperty, + keys: kEnumerableProperty +}) - // 1. Let entries be the result of parsing bytes. - let entries - try { - let text = '' - // application/x-www-form-urlencoded parser will keep the BOM. - // https://url.spec.whatwg.org/#concept-urlencoded-parser - // Note that streaming decoder is stateful and cannot be reused - const streamingDecoder = new TextDecoder('utf-8', { ignoreBOM: true }) +module.exports = { + CacheStorage +} - for await (const chunk of consumeBody(this[kState].body)) { - if (!isUint8Array(chunk)) { - throw new TypeError('Expected Uint8Array chunk') - } - text += streamingDecoder.decode(chunk, { stream: true }) - } - text += streamingDecoder.decode() - entries = new URLSearchParams(text) - } catch (err) { - // istanbul ignore next: Unclear when new URLSearchParams can fail on a string. - // 2. If entries is failure, then throw a TypeError. - throw Object.assign(new TypeError(), { cause: err }) - } - // 3. Return a new FormData object whose entries are entries. - const formData = new FormData() - for (const [name, value] of entries) { - formData.append(name, value) - } - return formData - } else { - // Wait a tick before checking if the request has been aborted. - // Otherwise, a TypeError can be thrown when an AbortError should. - await Promise.resolve() +/***/ }), - throwIfAborted(this[kState]) +/***/ 29174: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // Otherwise, throw a TypeError. - throw webidl.errors.exception({ - header: `${instance.name}.formData`, - message: 'Could not parse content as FormData.' - }) - } - } - } +"use strict"; - return methods -} -function mixinBody (prototype) { - Object.assign(prototype.prototype, bodyMixinMethods(prototype)) +module.exports = { + kConstruct: (__nccwpck_require__(72785).kConstruct) } -/** - * @see https://fetch.spec.whatwg.org/#concept-body-consume-body - * @param {Response|Request} object - * @param {(value: unknown) => unknown} convertBytesToJSValue - * @param {Response|Request} instance - */ -async function specConsumeBody (object, convertBytesToJSValue, instance) { - webidl.brandCheck(object, instance) - - throwIfAborted(object[kState]) - - // 1. If object is unusable, then return a promise rejected - // with a TypeError. - if (bodyUnusable(object[kState].body)) { - throw new TypeError('Body is unusable') - } - - // 2. Let promise be a new promise. - const promise = createDeferredPromise() - - // 3. Let errorSteps given error be to reject promise with error. - const errorSteps = (error) => promise.reject(error) - // 4. Let successSteps given a byte sequence data be to resolve - // promise with the result of running convertBytesToJSValue - // with data. If that threw an exception, then run errorSteps - // with that exception. - const successSteps = (data) => { - try { - promise.resolve(convertBytesToJSValue(data)) - } catch (e) { - errorSteps(e) - } - } +/***/ }), - // 5. If object’s body is null, then run successSteps with an - // empty byte sequence. - if (object[kState].body == null) { - successSteps(new Uint8Array()) - return promise.promise - } +/***/ 82396: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 6. Otherwise, fully read object’s body given successSteps, - // errorSteps, and object’s relevant global object. - await fullyReadBody(object[kState].body, successSteps, errorSteps) +"use strict"; - // 7. Return promise. - return promise.promise -} -// https://fetch.spec.whatwg.org/#body-unusable -function bodyUnusable (body) { - // An object including the Body interface mixin is - // said to be unusable if its body is non-null and - // its body’s stream is disturbed or locked. - return body != null && (body.stream.locked || util.isDisturbed(body.stream)) -} +const assert = __nccwpck_require__(39491) +const { URLSerializer } = __nccwpck_require__(685) +const { isValidHeaderName } = __nccwpck_require__(52538) /** - * @see https://encoding.spec.whatwg.org/#utf-8-decode - * @param {Buffer} buffer + * @see https://url.spec.whatwg.org/#concept-url-equals + * @param {URL} A + * @param {URL} B + * @param {boolean | undefined} excludeFragment + * @returns {boolean} */ -function utf8DecodeBytes (buffer) { - if (buffer.length === 0) { - return '' - } - - // 1. Let buffer be the result of peeking three bytes from - // ioQueue, converted to a byte sequence. - - // 2. If buffer is 0xEF 0xBB 0xBF, then read three - // bytes from ioQueue. (Do nothing with those bytes.) - if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { - buffer = buffer.subarray(3) - } +function urlEquals (A, B, excludeFragment = false) { + const serializedA = URLSerializer(A, excludeFragment) - // 3. Process a queue with an instance of UTF-8’s - // decoder, ioQueue, output, and "replacement". - const output = textDecoder.decode(buffer) + const serializedB = URLSerializer(B, excludeFragment) - // 4. Return output. - return output + return serializedA === serializedB } /** - * @see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value - * @param {Uint8Array} bytes + * @see https://github.com/chromium/chromium/blob/694d20d134cb553d8d89e5500b9148012b1ba299/content/browser/cache_storage/cache_storage_cache.cc#L260-L262 + * @param {string} header */ -function parseJSONFromBytes (bytes) { - return JSON.parse(utf8DecodeBytes(bytes)) -} +function fieldValues (header) { + assert(header !== null) -/** - * @see https://fetch.spec.whatwg.org/#concept-body-mime-type - * @param {import('./response').Response|import('./request').Request} object - */ -function bodyMimeType (object) { - const { headersList } = object[kState] - const contentType = headersList.get('content-type') + const values = [] - if (contentType === null) { - return 'failure' + for (let value of header.split(',')) { + value = value.trim() + + if (!value.length) { + continue + } else if (!isValidHeaderName(value)) { + continue + } + + values.push(value) } - return parseMIMEType(contentType) + return values } module.exports = { - extractBody, - safelyExtractBody, - cloneBody, - mixinBody + urlEquals, + fieldValues } /***/ }), -/***/ 41037: +/***/ 33598: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +// @ts-check -const { MessageChannel, receiveMessageOnPort } = __nccwpck_require__(71267) -const corsSafeListedMethods = ['GET', 'HEAD', 'POST'] -const corsSafeListedMethodsSet = new Set(corsSafeListedMethods) +/* global WebAssembly */ -const nullBodyStatus = [101, 204, 205, 304] +const assert = __nccwpck_require__(39491) +const net = __nccwpck_require__(41808) +const http = __nccwpck_require__(13685) +const { pipeline } = __nccwpck_require__(12781) +const util = __nccwpck_require__(83983) +const timers = __nccwpck_require__(29459) +const Request = __nccwpck_require__(62905) +const DispatcherBase = __nccwpck_require__(74839) +const { + RequestContentLengthMismatchError, + ResponseContentLengthMismatchError, + InvalidArgumentError, + RequestAbortedError, + HeadersTimeoutError, + HeadersOverflowError, + SocketError, + InformationalError, + BodyTimeoutError, + HTTPParserError, + ResponseExceededMaxSizeError, + ClientDestroyedError +} = __nccwpck_require__(48045) +const buildConnector = __nccwpck_require__(82067) +const { + kUrl, + kReset, + kServerName, + kClient, + kBusy, + kParser, + kConnect, + kBlocking, + kResuming, + kRunning, + kPending, + kSize, + kWriting, + kQueue, + kConnected, + kConnecting, + kNeedDrain, + kNoRef, + kKeepAliveDefaultTimeout, + kHostHeader, + kPendingIdx, + kRunningIdx, + kError, + kPipelining, + kSocket, + kKeepAliveTimeoutValue, + kMaxHeadersSize, + kKeepAliveMaxTimeout, + kKeepAliveTimeoutThreshold, + kHeadersTimeout, + kBodyTimeout, + kStrictContentLength, + kConnector, + kMaxRedirections, + kMaxRequests, + kCounter, + kClose, + kDestroy, + kDispatch, + kInterceptors, + kLocalAddress, + kMaxResponseSize, + kHTTPConnVersion, + // HTTP2 + kHost, + kHTTP2Session, + kHTTP2SessionState, + kHTTP2BuildRequest, + kHTTP2CopyHeaders, + kHTTP1BuildRequest +} = __nccwpck_require__(72785) -const redirectStatus = [301, 302, 303, 307, 308] -const redirectStatusSet = new Set(redirectStatus) +/** @type {import('http2')} */ +let http2 +try { + http2 = __nccwpck_require__(85158) +} catch { + // @ts-ignore + http2 = { constants: {} } +} -// https://fetch.spec.whatwg.org/#block-bad-port -const badPorts = [ - '1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79', - '87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137', - '139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532', - '540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723', - '2049', '3659', '4045', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6697', - '10080' -] +const { + constants: { + HTTP2_HEADER_AUTHORITY, + HTTP2_HEADER_METHOD, + HTTP2_HEADER_PATH, + HTTP2_HEADER_SCHEME, + HTTP2_HEADER_CONTENT_LENGTH, + HTTP2_HEADER_EXPECT, + HTTP2_HEADER_STATUS + } +} = http2 -const badPortsSet = new Set(badPorts) +// Experimental +let h2ExperimentalWarned = false -// https://w3c.github.io/webappsec-referrer-policy/#referrer-policies -const referrerPolicy = [ - '', - 'no-referrer', - 'no-referrer-when-downgrade', - 'same-origin', - 'origin', - 'strict-origin', - 'origin-when-cross-origin', - 'strict-origin-when-cross-origin', - 'unsafe-url' -] -const referrerPolicySet = new Set(referrerPolicy) +const FastBuffer = Buffer[Symbol.species] -const requestRedirect = ['follow', 'manual', 'error'] +const kClosedResolve = Symbol('kClosedResolve') -const safeMethods = ['GET', 'HEAD', 'OPTIONS', 'TRACE'] -const safeMethodsSet = new Set(safeMethods) +const channels = {} -const requestMode = ['navigate', 'same-origin', 'no-cors', 'cors'] +try { + const diagnosticsChannel = __nccwpck_require__(67643) + channels.sendHeaders = diagnosticsChannel.channel('undici:client:sendHeaders') + channels.beforeConnect = diagnosticsChannel.channel('undici:client:beforeConnect') + channels.connectError = diagnosticsChannel.channel('undici:client:connectError') + channels.connected = diagnosticsChannel.channel('undici:client:connected') +} catch { + channels.sendHeaders = { hasSubscribers: false } + channels.beforeConnect = { hasSubscribers: false } + channels.connectError = { hasSubscribers: false } + channels.connected = { hasSubscribers: false } +} -const requestCredentials = ['omit', 'same-origin', 'include'] +/** + * @type {import('../types/client').default} + */ +class Client extends DispatcherBase { + /** + * + * @param {string|URL} url + * @param {import('../types/client').Client.Options} options + */ + constructor (url, { + interceptors, + maxHeaderSize, + headersTimeout, + socketTimeout, + requestTimeout, + connectTimeout, + bodyTimeout, + idleTimeout, + keepAlive, + keepAliveTimeout, + maxKeepAliveTimeout, + keepAliveMaxTimeout, + keepAliveTimeoutThreshold, + socketPath, + pipelining, + tls, + strictContentLength, + maxCachedSessions, + maxRedirections, + connect, + maxRequestsPerClient, + localAddress, + maxResponseSize, + autoSelectFamily, + autoSelectFamilyAttemptTimeout, + // h2 + allowH2, + maxConcurrentStreams + } = {}) { + super() -const requestCache = [ - 'default', - 'no-store', - 'reload', - 'no-cache', - 'force-cache', - 'only-if-cached' -] + if (keepAlive !== undefined) { + throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead') + } -// https://fetch.spec.whatwg.org/#request-body-header-name -const requestBodyHeader = [ - 'content-encoding', - 'content-language', - 'content-location', - 'content-type', - // See https://github.com/nodejs/undici/issues/2021 - // 'Content-Length' is a forbidden header name, which is typically - // removed in the Headers implementation. However, undici doesn't - // filter out headers, so we add it here. - 'content-length' -] + if (socketTimeout !== undefined) { + throw new InvalidArgumentError('unsupported socketTimeout, use headersTimeout & bodyTimeout instead') + } -// https://fetch.spec.whatwg.org/#enumdef-requestduplex -const requestDuplex = [ - 'half' -] + if (requestTimeout !== undefined) { + throw new InvalidArgumentError('unsupported requestTimeout, use headersTimeout & bodyTimeout instead') + } -// http://fetch.spec.whatwg.org/#forbidden-method -const forbiddenMethods = ['CONNECT', 'TRACE', 'TRACK'] -const forbiddenMethodsSet = new Set(forbiddenMethods) + if (idleTimeout !== undefined) { + throw new InvalidArgumentError('unsupported idleTimeout, use keepAliveTimeout instead') + } -const subresource = [ - 'audio', - 'audioworklet', - 'font', - 'image', - 'manifest', - 'paintworklet', - 'script', - 'style', - 'track', - 'video', - 'xslt', - '' -] -const subresourceSet = new Set(subresource) + if (maxKeepAliveTimeout !== undefined) { + throw new InvalidArgumentError('unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead') + } -/** @type {globalThis['DOMException']} */ -const DOMException = globalThis.DOMException ?? (() => { - // DOMException was only made a global in Node v17.0.0, - // but fetch supports >= v16.8. - try { - atob('~') - } catch (err) { - return Object.getPrototypeOf(err).constructor - } -})() + if (maxHeaderSize != null && !Number.isFinite(maxHeaderSize)) { + throw new InvalidArgumentError('invalid maxHeaderSize') + } -let channel + if (socketPath != null && typeof socketPath !== 'string') { + throw new InvalidArgumentError('invalid socketPath') + } -/** @type {globalThis['structuredClone']} */ -const structuredClone = - globalThis.structuredClone ?? - // https://github.com/nodejs/node/blob/b27ae24dcc4251bad726d9d84baf678d1f707fed/lib/internal/structured_clone.js - // structuredClone was added in v17.0.0, but fetch supports v16.8 - function structuredClone (value, options = undefined) { - if (arguments.length === 0) { - throw new TypeError('missing argument') + if (connectTimeout != null && (!Number.isFinite(connectTimeout) || connectTimeout < 0)) { + throw new InvalidArgumentError('invalid connectTimeout') } - if (!channel) { - channel = new MessageChannel() + if (keepAliveTimeout != null && (!Number.isFinite(keepAliveTimeout) || keepAliveTimeout <= 0)) { + throw new InvalidArgumentError('invalid keepAliveTimeout') } - channel.port1.unref() - channel.port2.unref() - channel.port1.postMessage(value, options?.transfer) - return receiveMessageOnPort(channel.port2).message - } -module.exports = { - DOMException, - structuredClone, - subresource, - forbiddenMethods, - requestBodyHeader, - referrerPolicy, - requestRedirect, - requestMode, - requestCredentials, - requestCache, - redirectStatus, - corsSafeListedMethods, - nullBodyStatus, - safeMethods, - badPorts, - requestDuplex, - subresourceSet, - badPortsSet, - redirectStatusSet, - corsSafeListedMethodsSet, - safeMethodsSet, - forbiddenMethodsSet, - referrerPolicySet -} - - -/***/ }), - -/***/ 685: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (keepAliveMaxTimeout != null && (!Number.isFinite(keepAliveMaxTimeout) || keepAliveMaxTimeout <= 0)) { + throw new InvalidArgumentError('invalid keepAliveMaxTimeout') + } -const assert = __nccwpck_require__(39491) -const { atob } = __nccwpck_require__(14300) -const { isomorphicDecode } = __nccwpck_require__(52538) + if (keepAliveTimeoutThreshold != null && !Number.isFinite(keepAliveTimeoutThreshold)) { + throw new InvalidArgumentError('invalid keepAliveTimeoutThreshold') + } -const encoder = new TextEncoder() + if (headersTimeout != null && (!Number.isInteger(headersTimeout) || headersTimeout < 0)) { + throw new InvalidArgumentError('headersTimeout must be a positive integer or zero') + } -/** - * @see https://mimesniff.spec.whatwg.org/#http-token-code-point - */ -const HTTP_TOKEN_CODEPOINTS = /^[!#$%&'*+-.^_|~A-Za-z0-9]+$/ -const HTTP_WHITESPACE_REGEX = /(\u000A|\u000D|\u0009|\u0020)/ // eslint-disable-line -/** - * @see https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point - */ -const HTTP_QUOTED_STRING_TOKENS = /[\u0009|\u0020-\u007E|\u0080-\u00FF]/ // eslint-disable-line + if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) { + throw new InvalidArgumentError('bodyTimeout must be a positive integer or zero') + } -// https://fetch.spec.whatwg.org/#data-url-processor -/** @param {URL} dataURL */ -function dataURLProcessor (dataURL) { - // 1. Assert: dataURL’s scheme is "data". - assert(dataURL.protocol === 'data:') + if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { + throw new InvalidArgumentError('connect must be a function or an object') + } - // 2. Let input be the result of running the URL - // serializer on dataURL with exclude fragment - // set to true. - let input = URLSerializer(dataURL, true) + if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) { + throw new InvalidArgumentError('maxRedirections must be a positive number') + } - // 3. Remove the leading "data:" string from input. - input = input.slice(5) + if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) { + throw new InvalidArgumentError('maxRequestsPerClient must be a positive number') + } - // 4. Let position point at the start of input. - const position = { position: 0 } + if (localAddress != null && (typeof localAddress !== 'string' || net.isIP(localAddress) === 0)) { + throw new InvalidArgumentError('localAddress must be valid string IP address') + } - // 5. Let mimeType be the result of collecting a - // sequence of code points that are not equal - // to U+002C (,), given position. - let mimeType = collectASequenceOfCodePointsFast( - ',', - input, - position - ) + if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) { + throw new InvalidArgumentError('maxResponseSize must be a positive number') + } - // 6. Strip leading and trailing ASCII whitespace - // from mimeType. - // Undici implementation note: we need to store the - // length because if the mimetype has spaces removed, - // the wrong amount will be sliced from the input in - // step #9 - const mimeTypeLength = mimeType.length - mimeType = removeASCIIWhitespace(mimeType, true, true) + if ( + autoSelectFamilyAttemptTimeout != null && + (!Number.isInteger(autoSelectFamilyAttemptTimeout) || autoSelectFamilyAttemptTimeout < -1) + ) { + throw new InvalidArgumentError('autoSelectFamilyAttemptTimeout must be a positive number') + } - // 7. If position is past the end of input, then - // return failure - if (position.position >= input.length) { - return 'failure' - } + // h2 + if (allowH2 != null && typeof allowH2 !== 'boolean') { + throw new InvalidArgumentError('allowH2 must be a valid boolean value') + } - // 8. Advance position by 1. - position.position++ + if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== 'number' || maxConcurrentStreams < 1)) { + throw new InvalidArgumentError('maxConcurrentStreams must be a possitive integer, greater than 0') + } - // 9. Let encodedBody be the remainder of input. - const encodedBody = input.slice(mimeTypeLength + 1) + if (typeof connect !== 'function') { + connect = buildConnector({ + ...tls, + maxCachedSessions, + allowH2, + socketPath, + timeout: connectTimeout, + ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined), + ...connect + }) + } - // 10. Let body be the percent-decoding of encodedBody. - let body = stringPercentDecode(encodedBody) + this[kInterceptors] = interceptors && interceptors.Client && Array.isArray(interceptors.Client) + ? interceptors.Client + : [createRedirectInterceptor({ maxRedirections })] + this[kUrl] = util.parseOrigin(url) + this[kConnector] = connect + this[kSocket] = null + this[kPipelining] = pipelining != null ? pipelining : 1 + this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize + this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout + this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 600e3 : keepAliveMaxTimeout + this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold + this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout] + this[kServerName] = null + this[kLocalAddress] = localAddress != null ? localAddress : null + this[kResuming] = 0 // 0, idle, 1, scheduled, 2 resuming + this[kNeedDrain] = 0 // 0, idle, 1, scheduled, 2 resuming + this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}\r\n` + this[kBodyTimeout] = bodyTimeout != null ? bodyTimeout : 300e3 + this[kHeadersTimeout] = headersTimeout != null ? headersTimeout : 300e3 + this[kStrictContentLength] = strictContentLength == null ? true : strictContentLength + this[kMaxRedirections] = maxRedirections + this[kMaxRequests] = maxRequestsPerClient + this[kClosedResolve] = null + this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1 + this[kHTTPConnVersion] = 'h1' - // 11. If mimeType ends with U+003B (;), followed by - // zero or more U+0020 SPACE, followed by an ASCII - // case-insensitive match for "base64", then: - if (/;(\u0020){0,}base64$/i.test(mimeType)) { - // 1. Let stringBody be the isomorphic decode of body. - const stringBody = isomorphicDecode(body) + // HTTP/2 + this[kHTTP2Session] = null + this[kHTTP2SessionState] = !allowH2 + ? null + : { + // streams: null, // Fixed queue of streams - For future support of `push` + openStreams: 0, // Keep track of them to decide wether or not unref the session + maxConcurrentStreams: maxConcurrentStreams != null ? maxConcurrentStreams : 100 // Max peerConcurrentStreams for a Node h2 server + } + this[kHost] = `${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ''}` - // 2. Set body to the forgiving-base64 decode of - // stringBody. - body = forgivingBase64(stringBody) + // kQueue is built up of 3 sections separated by + // the kRunningIdx and kPendingIdx indices. + // | complete | running | pending | + // ^ kRunningIdx ^ kPendingIdx ^ kQueue.length + // kRunningIdx points to the first running element. + // kPendingIdx points to the first pending element. + // This implements a fast queue with an amortized + // time of O(1). - // 3. If body is failure, then return failure. - if (body === 'failure') { - return 'failure' - } + this[kQueue] = [] + this[kRunningIdx] = 0 + this[kPendingIdx] = 0 + } - // 4. Remove the last 6 code points from mimeType. - mimeType = mimeType.slice(0, -6) + get pipelining () { + return this[kPipelining] + } - // 5. Remove trailing U+0020 SPACE code points from mimeType, - // if any. - mimeType = mimeType.replace(/(\u0020)+$/, '') + set pipelining (value) { + this[kPipelining] = value + resume(this, true) + } - // 6. Remove the last U+003B (;) code point from mimeType. - mimeType = mimeType.slice(0, -1) + get [kPending] () { + return this[kQueue].length - this[kPendingIdx] } - // 12. If mimeType starts with U+003B (;), then prepend - // "text/plain" to mimeType. - if (mimeType.startsWith(';')) { - mimeType = 'text/plain' + mimeType + get [kRunning] () { + return this[kPendingIdx] - this[kRunningIdx] } - // 13. Let mimeTypeRecord be the result of parsing - // mimeType. - let mimeTypeRecord = parseMIMEType(mimeType) + get [kSize] () { + return this[kQueue].length - this[kRunningIdx] + } - // 14. If mimeTypeRecord is failure, then set - // mimeTypeRecord to text/plain;charset=US-ASCII. - if (mimeTypeRecord === 'failure') { - mimeTypeRecord = parseMIMEType('text/plain;charset=US-ASCII') + get [kConnected] () { + return !!this[kSocket] && !this[kConnecting] && !this[kSocket].destroyed } - // 15. Return a new data: URL struct whose MIME - // type is mimeTypeRecord and body is body. - // https://fetch.spec.whatwg.org/#data-url-struct - return { mimeType: mimeTypeRecord, body } -} + get [kBusy] () { + const socket = this[kSocket] + return ( + (socket && (socket[kReset] || socket[kWriting] || socket[kBlocking])) || + (this[kSize] >= (this[kPipelining] || 1)) || + this[kPending] > 0 + ) + } -// https://url.spec.whatwg.org/#concept-url-serializer -/** - * @param {URL} url - * @param {boolean} excludeFragment - */ -function URLSerializer (url, excludeFragment = false) { - if (!excludeFragment) { - return url.href + /* istanbul ignore: only used for test */ + [kConnect] (cb) { + connect(this) + this.once('connect', cb) } - const href = url.href - const hashLength = url.hash.length + [kDispatch] (opts, handler) { + const origin = opts.origin || this[kUrl].origin - return hashLength === 0 ? href : href.substring(0, href.length - hashLength) -} + const request = this[kHTTPConnVersion] === 'h2' + ? Request[kHTTP2BuildRequest](origin, opts, handler) + : Request[kHTTP1BuildRequest](origin, opts, handler) -// https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points -/** - * @param {(char: string) => boolean} condition - * @param {string} input - * @param {{ position: number }} position - */ -function collectASequenceOfCodePoints (condition, input, position) { - // 1. Let result be the empty string. - let result = '' + this[kQueue].push(request) + if (this[kResuming]) { + // Do nothing. + } else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) { + // Wait a tick in case stream/iterator is ended in the same tick. + this[kResuming] = 1 + process.nextTick(resume, this) + } else { + resume(this, true) + } - // 2. While position doesn’t point past the end of input and the - // code point at position within input meets the condition condition: - while (position.position < input.length && condition(input[position.position])) { - // 1. Append that code point to the end of result. - result += input[position.position] + if (this[kResuming] && this[kNeedDrain] !== 2 && this[kBusy]) { + this[kNeedDrain] = 2 + } - // 2. Advance position by 1. - position.position++ + return this[kNeedDrain] < 2 } - // 3. Return result. - return result -} - -/** - * A faster collectASequenceOfCodePoints that only works when comparing a single character. - * @param {string} char - * @param {string} input - * @param {{ position: number }} position - */ -function collectASequenceOfCodePointsFast (char, input, position) { - const idx = input.indexOf(char, position.position) - const start = position.position - - if (idx === -1) { - position.position = input.length - return input.slice(start) + async [kClose] () { + // TODO: for H2 we need to gracefully flush the remaining enqueued + // request and close each stream. + return new Promise((resolve) => { + if (!this[kSize]) { + resolve(null) + } else { + this[kClosedResolve] = resolve + } + }) } - position.position = idx - return input.slice(start, position.position) -} + async [kDestroy] (err) { + return new Promise((resolve) => { + const requests = this[kQueue].splice(this[kPendingIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(this, request, err) + } -// https://url.spec.whatwg.org/#string-percent-decode -/** @param {string} input */ -function stringPercentDecode (input) { - // 1. Let bytes be the UTF-8 encoding of input. - const bytes = encoder.encode(input) + const callback = () => { + if (this[kClosedResolve]) { + // TODO (fix): Should we error here with ClientDestroyedError? + this[kClosedResolve]() + this[kClosedResolve] = null + } + resolve() + } - // 2. Return the percent-decoding of bytes. - return percentDecode(bytes) -} + if (this[kHTTP2Session] != null) { + util.destroy(this[kHTTP2Session], err) + this[kHTTP2Session] = null + this[kHTTP2SessionState] = null + } -// https://url.spec.whatwg.org/#percent-decode -/** @param {Uint8Array} input */ -function percentDecode (input) { - // 1. Let output be an empty byte sequence. - /** @type {number[]} */ - const output = [] + if (!this[kSocket]) { + queueMicrotask(callback) + } else { + util.destroy(this[kSocket].on('close', callback), err) + } - // 2. For each byte byte in input: - for (let i = 0; i < input.length; i++) { - const byte = input[i] + resume(this) + }) + } +} - // 1. If byte is not 0x25 (%), then append byte to output. - if (byte !== 0x25) { - output.push(byte) +function onHttp2SessionError (err) { + assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID') - // 2. Otherwise, if byte is 0x25 (%) and the next two bytes - // after byte in input are not in the ranges - // 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F), - // and 0x61 (a) to 0x66 (f), all inclusive, append byte - // to output. - } else if ( - byte === 0x25 && - !/^[0-9A-Fa-f]{2}$/i.test(String.fromCharCode(input[i + 1], input[i + 2])) - ) { - output.push(0x25) + this[kSocket][kError] = err - // 3. Otherwise: - } else { - // 1. Let bytePoint be the two bytes after byte in input, - // decoded, and then interpreted as hexadecimal number. - const nextTwoBytes = String.fromCharCode(input[i + 1], input[i + 2]) - const bytePoint = Number.parseInt(nextTwoBytes, 16) + onError(this[kClient], err) +} - // 2. Append a byte whose value is bytePoint to output. - output.push(bytePoint) +function onHttp2FrameError (type, code, id) { + const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`) - // 3. Skip the next two bytes in input. - i += 2 - } + if (id === 0) { + this[kSocket][kError] = err + onError(this[kClient], err) } +} - // 3. Return output. - return Uint8Array.from(output) +function onHttp2SessionEnd () { + util.destroy(this, new SocketError('other side closed')) + util.destroy(this[kSocket], new SocketError('other side closed')) } -// https://mimesniff.spec.whatwg.org/#parse-a-mime-type -/** @param {string} input */ -function parseMIMEType (input) { - // 1. Remove any leading and trailing HTTP whitespace - // from input. - input = removeHTTPWhitespace(input, true, true) +function onHTTP2GoAway (code) { + const client = this[kClient] + const err = new InformationalError(`HTTP/2: "GOAWAY" frame received with code ${code}`) + client[kSocket] = null + client[kHTTP2Session] = null - // 2. Let position be a position variable for input, - // initially pointing at the start of input. - const position = { position: 0 } + if (client.destroyed) { + assert(this[kPending] === 0) - // 3. Let type be the result of collecting a sequence - // of code points that are not U+002F (/) from - // input, given position. - const type = collectASequenceOfCodePointsFast( - '/', - input, - position - ) + // Fail entire queue. + const requests = client[kQueue].splice(client[kRunningIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(this, request, err) + } + } else if (client[kRunning] > 0) { + // Fail head of pipeline. + const request = client[kQueue][client[kRunningIdx]] + client[kQueue][client[kRunningIdx]++] = null - // 4. If type is the empty string or does not solely - // contain HTTP token code points, then return failure. - // https://mimesniff.spec.whatwg.org/#http-token-code-point - if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) { - return 'failure' + errorRequest(client, request, err) } - // 5. If position is past the end of input, then return - // failure - if (position.position > input.length) { - return 'failure' - } + client[kPendingIdx] = client[kRunningIdx] - // 6. Advance position by 1. (This skips past U+002F (/).) - position.position++ + assert(client[kRunning] === 0) - // 7. Let subtype be the result of collecting a sequence of - // code points that are not U+003B (;) from input, given - // position. - let subtype = collectASequenceOfCodePointsFast( - ';', - input, - position + client.emit('disconnect', + client[kUrl], + [client], + err ) - // 8. Remove any trailing HTTP whitespace from subtype. - subtype = removeHTTPWhitespace(subtype, false, true) + resume(client) +} - // 9. If subtype is the empty string or does not solely - // contain HTTP token code points, then return failure. - if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) { - return 'failure' - } +const constants = __nccwpck_require__(30953) +const createRedirectInterceptor = __nccwpck_require__(38861) +const EMPTY_BUF = Buffer.alloc(0) - const typeLowercase = type.toLowerCase() - const subtypeLowercase = subtype.toLowerCase() +async function lazyllhttp () { + const llhttpWasmData = process.env.JEST_WORKER_ID ? __nccwpck_require__(61145) : undefined - // 10. Let mimeType be a new MIME type record whose type - // is type, in ASCII lowercase, and subtype is subtype, - // in ASCII lowercase. - // https://mimesniff.spec.whatwg.org/#mime-type - const mimeType = { - type: typeLowercase, - subtype: subtypeLowercase, - /** @type {Map} */ - parameters: new Map(), - // https://mimesniff.spec.whatwg.org/#mime-type-essence - essence: `${typeLowercase}/${subtypeLowercase}` + let mod + try { + mod = await WebAssembly.compile(Buffer.from(__nccwpck_require__(95627), 'base64')) + } catch (e) { + /* istanbul ignore next */ + + // We could check if the error was caused by the simd option not + // being enabled, but the occurring of this other error + // * https://github.com/emscripten-core/emscripten/issues/11495 + // got me to remove that check to avoid breaking Node 12. + mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || __nccwpck_require__(61145), 'base64')) } - // 11. While position is not past the end of input: - while (position.position < input.length) { - // 1. Advance position by 1. (This skips past U+003B (;).) - position.position++ + return await WebAssembly.instantiate(mod, { + env: { + /* eslint-disable camelcase */ - // 2. Collect a sequence of code points that are HTTP - // whitespace from input given position. - collectASequenceOfCodePoints( - // https://fetch.spec.whatwg.org/#http-whitespace - char => HTTP_WHITESPACE_REGEX.test(char), - input, - position - ) - - // 3. Let parameterName be the result of collecting a - // sequence of code points that are not U+003B (;) - // or U+003D (=) from input, given position. - let parameterName = collectASequenceOfCodePoints( - (char) => char !== ';' && char !== '=', - input, - position - ) - - // 4. Set parameterName to parameterName, in ASCII - // lowercase. - parameterName = parameterName.toLowerCase() - - // 5. If position is not past the end of input, then: - if (position.position < input.length) { - // 1. If the code point at position within input is - // U+003B (;), then continue. - if (input[position.position] === ';') { - continue + wasm_on_url: (p, at, len) => { + /* istanbul ignore next */ + return 0 + }, + wasm_on_status: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_message_begin: (p) => { + assert.strictEqual(currentParser.ptr, p) + return currentParser.onMessageBegin() || 0 + }, + wasm_on_header_field: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_header_value: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => { + assert.strictEqual(currentParser.ptr, p) + return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0 + }, + wasm_on_body: (p, at, len) => { + assert.strictEqual(currentParser.ptr, p) + const start = at - currentBufferPtr + currentBufferRef.byteOffset + return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0 + }, + wasm_on_message_complete: (p) => { + assert.strictEqual(currentParser.ptr, p) + return currentParser.onMessageComplete() || 0 } - // 2. Advance position by 1. (This skips past U+003D (=).) - position.position++ + /* eslint-enable camelcase */ } + }) +} - // 6. If position is past the end of input, then break. - if (position.position > input.length) { - break - } +let llhttpInstance = null +let llhttpPromise = lazyllhttp() +llhttpPromise.catch() - // 7. Let parameterValue be null. - let parameterValue = null +let currentParser = null +let currentBufferRef = null +let currentBufferSize = 0 +let currentBufferPtr = null - // 8. If the code point at position within input is - // U+0022 ("), then: - if (input[position.position] === '"') { - // 1. Set parameterValue to the result of collecting - // an HTTP quoted string from input, given position - // and the extract-value flag. - parameterValue = collectAnHTTPQuotedString(input, position, true) +const TIMEOUT_HEADERS = 1 +const TIMEOUT_BODY = 2 +const TIMEOUT_IDLE = 3 - // 2. Collect a sequence of code points that are not - // U+003B (;) from input, given position. - collectASequenceOfCodePointsFast( - ';', - input, - position - ) +class Parser { + constructor (client, socket, { exports }) { + assert(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0) - // 9. Otherwise: - } else { - // 1. Set parameterValue to the result of collecting - // a sequence of code points that are not U+003B (;) - // from input, given position. - parameterValue = collectASequenceOfCodePointsFast( - ';', - input, - position - ) + this.llhttp = exports + this.ptr = this.llhttp.llhttp_alloc(constants.TYPE.RESPONSE) + this.client = client + this.socket = socket + this.timeout = null + this.timeoutValue = null + this.timeoutType = null + this.statusCode = null + this.statusText = '' + this.upgrade = false + this.headers = [] + this.headersSize = 0 + this.headersMaxSize = client[kMaxHeadersSize] + this.shouldKeepAlive = false + this.paused = false + this.resume = this.resume.bind(this) - // 2. Remove any trailing HTTP whitespace from parameterValue. - parameterValue = removeHTTPWhitespace(parameterValue, false, true) + this.bytesRead = 0 - // 3. If parameterValue is the empty string, then continue. - if (parameterValue.length === 0) { - continue - } - } + this.keepAlive = '' + this.contentLength = '' + this.connection = '' + this.maxResponseSize = client[kMaxResponseSize] + } - // 10. If all of the following are true - // - parameterName is not the empty string - // - parameterName solely contains HTTP token code points - // - parameterValue solely contains HTTP quoted-string token code points - // - mimeType’s parameters[parameterName] does not exist - // then set mimeType’s parameters[parameterName] to parameterValue. - if ( - parameterName.length !== 0 && - HTTP_TOKEN_CODEPOINTS.test(parameterName) && - (parameterValue.length === 0 || HTTP_QUOTED_STRING_TOKENS.test(parameterValue)) && - !mimeType.parameters.has(parameterName) - ) { - mimeType.parameters.set(parameterName, parameterValue) + setTimeout (value, type) { + this.timeoutType = type + if (value !== this.timeoutValue) { + timers.clearTimeout(this.timeout) + if (value) { + this.timeout = timers.setTimeout(onParserTimeout, value, this) + // istanbul ignore else: only for jest + if (this.timeout.unref) { + this.timeout.unref() + } + } else { + this.timeout = null + } + this.timeoutValue = value + } else if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() + } } } - // 12. Return mimeType. - return mimeType -} + resume () { + if (this.socket.destroyed || !this.paused) { + return + } -// https://infra.spec.whatwg.org/#forgiving-base64-decode -/** @param {string} data */ -function forgivingBase64 (data) { - // 1. Remove all ASCII whitespace from data. - data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '') // eslint-disable-line + assert(this.ptr != null) + assert(currentParser == null) - // 2. If data’s code point length divides by 4 leaving - // no remainder, then: - if (data.length % 4 === 0) { - // 1. If data ends with one or two U+003D (=) code points, - // then remove them from data. - data = data.replace(/=?=$/, '') - } + this.llhttp.llhttp_resume(this.ptr) - // 3. If data’s code point length divides by 4 leaving - // a remainder of 1, then return failure. - if (data.length % 4 === 1) { - return 'failure' - } + assert(this.timeoutType === TIMEOUT_BODY) + if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() + } + } - // 4. If data contains a code point that is not one of - // U+002B (+) - // U+002F (/) - // ASCII alphanumeric - // then return failure. - if (/[^+/0-9A-Za-z]/.test(data)) { - return 'failure' + this.paused = false + this.execute(this.socket.read() || EMPTY_BUF) // Flush parser. + this.readMore() } - const binary = atob(data) - const bytes = new Uint8Array(binary.length) - - for (let byte = 0; byte < binary.length; byte++) { - bytes[byte] = binary.charCodeAt(byte) + readMore () { + while (!this.paused && this.ptr) { + const chunk = this.socket.read() + if (chunk === null) { + break + } + this.execute(chunk) + } } - return bytes -} - -// https://fetch.spec.whatwg.org/#collect-an-http-quoted-string -// tests: https://fetch.spec.whatwg.org/#example-http-quoted-string -/** - * @param {string} input - * @param {{ position: number }} position - * @param {boolean?} extractValue - */ -function collectAnHTTPQuotedString (input, position, extractValue) { - // 1. Let positionStart be position. - const positionStart = position.position - - // 2. Let value be the empty string. - let value = '' - - // 3. Assert: the code point at position within input - // is U+0022 ("). - assert(input[position.position] === '"') - - // 4. Advance position by 1. - position.position++ + execute (data) { + assert(this.ptr != null) + assert(currentParser == null) + assert(!this.paused) - // 5. While true: - while (true) { - // 1. Append the result of collecting a sequence of code points - // that are not U+0022 (") or U+005C (\) from input, given - // position, to value. - value += collectASequenceOfCodePoints( - (char) => char !== '"' && char !== '\\', - input, - position - ) + const { socket, llhttp } = this - // 2. If position is past the end of input, then break. - if (position.position >= input.length) { - break + if (data.length > currentBufferSize) { + if (currentBufferPtr) { + llhttp.free(currentBufferPtr) + } + currentBufferSize = Math.ceil(data.length / 4096) * 4096 + currentBufferPtr = llhttp.malloc(currentBufferSize) } - // 3. Let quoteOrBackslash be the code point at position within - // input. - const quoteOrBackslash = input[position.position] + new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data) - // 4. Advance position by 1. - position.position++ + // Call `execute` on the wasm parser. + // We pass the `llhttp_parser` pointer address, the pointer address of buffer view data, + // and finally the length of bytes to parse. + // The return value is an error code or `constants.ERROR.OK`. + try { + let ret - // 5. If quoteOrBackslash is U+005C (\), then: - if (quoteOrBackslash === '\\') { - // 1. If position is past the end of input, then append - // U+005C (\) to value and break. - if (position.position >= input.length) { - value += '\\' - break + try { + currentBufferRef = data + currentParser = this + ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length) + /* eslint-disable-next-line no-useless-catch */ + } catch (err) { + /* istanbul ignore next: difficult to make a test case for */ + throw err + } finally { + currentParser = null + currentBufferRef = null } - // 2. Append the code point at position within input to value. - value += input[position.position] - - // 3. Advance position by 1. - position.position++ - - // 6. Otherwise: - } else { - // 1. Assert: quoteOrBackslash is U+0022 ("). - assert(quoteOrBackslash === '"') + const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr - // 2. Break. - break + if (ret === constants.ERROR.PAUSED_UPGRADE) { + this.onUpgrade(data.slice(offset)) + } else if (ret === constants.ERROR.PAUSED) { + this.paused = true + socket.unshift(data.slice(offset)) + } else if (ret !== constants.ERROR.OK) { + const ptr = llhttp.llhttp_get_error_reason(this.ptr) + let message = '' + /* istanbul ignore else: difficult to make a test case for */ + if (ptr) { + const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0) + message = + 'Response does not match the HTTP/1.1 protocol (' + + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + + ')' + } + throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset)) + } + } catch (err) { + util.destroy(socket, err) } } - // 6. If the extract-value flag is set, then return value. - if (extractValue) { - return value - } + destroy () { + assert(this.ptr != null) + assert(currentParser == null) - // 7. Return the code points from positionStart to position, - // inclusive, within input. - return input.slice(positionStart, position.position) -} + this.llhttp.llhttp_free(this.ptr) + this.ptr = null -/** - * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type - */ -function serializeAMimeType (mimeType) { - assert(mimeType !== 'failure') - const { parameters, essence } = mimeType + timers.clearTimeout(this.timeout) + this.timeout = null + this.timeoutValue = null + this.timeoutType = null - // 1. Let serialization be the concatenation of mimeType’s - // type, U+002F (/), and mimeType’s subtype. - let serialization = essence + this.paused = false + } - // 2. For each name → value of mimeType’s parameters: - for (let [name, value] of parameters.entries()) { - // 1. Append U+003B (;) to serialization. - serialization += ';' + onStatus (buf) { + this.statusText = buf.toString() + } - // 2. Append name to serialization. - serialization += name + onMessageBegin () { + const { socket, client } = this - // 3. Append U+003D (=) to serialization. - serialization += '=' + /* istanbul ignore next: difficult to make a test case for */ + if (socket.destroyed) { + return -1 + } - // 4. If value does not solely contain HTTP token code - // points or value is the empty string, then: - if (!HTTP_TOKEN_CODEPOINTS.test(value)) { - // 1. Precede each occurence of U+0022 (") or - // U+005C (\) in value with U+005C (\). - value = value.replace(/(\\|")/g, '\\$1') + const request = client[kQueue][client[kRunningIdx]] + if (!request) { + return -1 + } + } - // 2. Prepend U+0022 (") to value. - value = '"' + value + onHeaderField (buf) { + const len = this.headers.length - // 3. Append U+0022 (") to value. - value += '"' + if ((len & 1) === 0) { + this.headers.push(buf) + } else { + this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf]) } - // 5. Append value to serialization. - serialization += value + this.trackHeader(buf.length) } - // 3. Return serialization. - return serialization -} + onHeaderValue (buf) { + let len = this.headers.length -/** - * @see https://fetch.spec.whatwg.org/#http-whitespace - * @param {string} char - */ -function isHTTPWhiteSpace (char) { - return char === '\r' || char === '\n' || char === '\t' || char === ' ' -} + if ((len & 1) === 1) { + this.headers.push(buf) + len += 1 + } else { + this.headers[len - 1] = Buffer.concat([this.headers[len - 1], buf]) + } -/** - * @see https://fetch.spec.whatwg.org/#http-whitespace - * @param {string} str - */ -function removeHTTPWhitespace (str, leading = true, trailing = true) { - let lead = 0 - let trail = str.length - 1 + const key = this.headers[len - 2] + if (key.length === 10 && key.toString().toLowerCase() === 'keep-alive') { + this.keepAlive += buf.toString() + } else if (key.length === 10 && key.toString().toLowerCase() === 'connection') { + this.connection += buf.toString() + } else if (key.length === 14 && key.toString().toLowerCase() === 'content-length') { + this.contentLength += buf.toString() + } - if (leading) { - for (; lead < str.length && isHTTPWhiteSpace(str[lead]); lead++); + this.trackHeader(buf.length) } - if (trailing) { - for (; trail > 0 && isHTTPWhiteSpace(str[trail]); trail--); + trackHeader (len) { + this.headersSize += len + if (this.headersSize >= this.headersMaxSize) { + util.destroy(this.socket, new HeadersOverflowError()) + } } - return str.slice(lead, trail + 1) -} - -/** - * @see https://infra.spec.whatwg.org/#ascii-whitespace - * @param {string} char - */ -function isASCIIWhitespace (char) { - return char === '\r' || char === '\n' || char === '\t' || char === '\f' || char === ' ' -} - -/** - * @see https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace - */ -function removeASCIIWhitespace (str, leading = true, trailing = true) { - let lead = 0 - let trail = str.length - 1 + onUpgrade (head) { + const { upgrade, client, socket, headers, statusCode } = this - if (leading) { - for (; lead < str.length && isASCIIWhitespace(str[lead]); lead++); - } + assert(upgrade) - if (trailing) { - for (; trail > 0 && isASCIIWhitespace(str[trail]); trail--); - } + const request = client[kQueue][client[kRunningIdx]] + assert(request) - return str.slice(lead, trail + 1) -} + assert(!socket.destroyed) + assert(socket === client[kSocket]) + assert(!this.paused) + assert(request.upgrade || request.method === 'CONNECT') -module.exports = { - dataURLProcessor, - URLSerializer, - collectASequenceOfCodePoints, - collectASequenceOfCodePointsFast, - stringPercentDecode, - parseMIMEType, - collectAnHTTPQuotedString, - serializeAMimeType -} + this.statusCode = null + this.statusText = '' + this.shouldKeepAlive = null + assert(this.headers.length % 2 === 0) + this.headers = [] + this.headersSize = 0 -/***/ }), + socket.unshift(head) -/***/ 78511: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + socket[kParser].destroy() + socket[kParser] = null -"use strict"; + socket[kClient] = null + socket[kError] = null + socket + .removeListener('error', onSocketError) + .removeListener('readable', onSocketReadable) + .removeListener('end', onSocketEnd) + .removeListener('close', onSocketClose) + client[kSocket] = null + client[kQueue][client[kRunningIdx]++] = null + client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade')) -const { Blob, File: NativeFile } = __nccwpck_require__(14300) -const { types } = __nccwpck_require__(73837) -const { kState } = __nccwpck_require__(15861) -const { isBlobLike } = __nccwpck_require__(52538) -const { webidl } = __nccwpck_require__(21744) -const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) -const { kEnumerableProperty } = __nccwpck_require__(83983) -const encoder = new TextEncoder() + try { + request.onUpgrade(statusCode, headers, socket) + } catch (err) { + util.destroy(socket, err) + } -class File extends Blob { - constructor (fileBits, fileName, options = {}) { - // The File constructor is invoked with two or three parameters, depending - // on whether the optional dictionary parameter is used. When the File() - // constructor is invoked, user agents must run the following steps: - webidl.argumentLengthCheck(arguments, 2, { header: 'File constructor' }) + resume(client) + } - fileBits = webidl.converters['sequence'](fileBits) - fileName = webidl.converters.USVString(fileName) - options = webidl.converters.FilePropertyBag(options) + onHeadersComplete (statusCode, upgrade, shouldKeepAlive) { + const { client, socket, headers, statusText } = this - // 1. Let bytes be the result of processing blob parts given fileBits and - // options. - // Note: Blob handles this for us + /* istanbul ignore next: difficult to make a test case for */ + if (socket.destroyed) { + return -1 + } - // 2. Let n be the fileName argument to the constructor. - const n = fileName + const request = client[kQueue][client[kRunningIdx]] - // 3. Process FilePropertyBag dictionary argument by running the following - // substeps: + /* istanbul ignore next: difficult to make a test case for */ + if (!request) { + return -1 + } - // 1. If the type member is provided and is not the empty string, let t - // be set to the type dictionary member. If t contains any characters - // outside the range U+0020 to U+007E, then set t to the empty string - // and return from these substeps. - // 2. Convert every character in t to ASCII lowercase. - let t = options.type - let d + assert(!this.upgrade) + assert(this.statusCode < 200) - // eslint-disable-next-line no-labels - substep: { - if (t) { - t = parseMIMEType(t) + if (statusCode === 100) { + util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket))) + return -1 + } - if (t === 'failure') { - t = '' - // eslint-disable-next-line no-labels - break substep - } + /* this can only happen if server is misbehaving */ + if (upgrade && !request.upgrade) { + util.destroy(socket, new SocketError('bad upgrade', util.getSocketInfo(socket))) + return -1 + } - t = serializeAMimeType(t).toLowerCase() + assert.strictEqual(this.timeoutType, TIMEOUT_HEADERS) + + this.statusCode = statusCode + this.shouldKeepAlive = ( + shouldKeepAlive || + // Override llhttp value which does not allow keepAlive for HEAD. + (request.method === 'HEAD' && !socket[kReset] && this.connection.toLowerCase() === 'keep-alive') + ) + + if (this.statusCode >= 200) { + const bodyTimeout = request.bodyTimeout != null + ? request.bodyTimeout + : client[kBodyTimeout] + this.setTimeout(bodyTimeout, TIMEOUT_BODY) + } else if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() } + } - // 3. If the lastModified member is provided, let d be set to the - // lastModified dictionary member. If it is not provided, set d to the - // current date and time represented as the number of milliseconds since - // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]). - d = options.lastModified + if (request.method === 'CONNECT') { + assert(client[kRunning] === 1) + this.upgrade = true + return 2 } - // 4. Return a new File object F such that: - // F refers to the bytes byte sequence. - // F.size is set to the number of total bytes in bytes. - // F.name is set to n. - // F.type is set to t. - // F.lastModified is set to d. + if (upgrade) { + assert(client[kRunning] === 1) + this.upgrade = true + return 2 + } - super(processBlobParts(fileBits, options), { type: t }) - this[kState] = { - name: n, - lastModified: d, - type: t + assert(this.headers.length % 2 === 0) + this.headers = [] + this.headersSize = 0 + + if (this.shouldKeepAlive && client[kPipelining]) { + const keepAliveTimeout = this.keepAlive ? util.parseKeepAliveTimeout(this.keepAlive) : null + + if (keepAliveTimeout != null) { + const timeout = Math.min( + keepAliveTimeout - client[kKeepAliveTimeoutThreshold], + client[kKeepAliveMaxTimeout] + ) + if (timeout <= 0) { + socket[kReset] = true + } else { + client[kKeepAliveTimeoutValue] = timeout + } + } else { + client[kKeepAliveTimeoutValue] = client[kKeepAliveDefaultTimeout] + } + } else { + // Stop more requests from being dispatched. + socket[kReset] = true } - } - get name () { - webidl.brandCheck(this, File) + const pause = request.onHeaders(statusCode, headers, this.resume, statusText) === false - return this[kState].name - } + if (request.aborted) { + return -1 + } - get lastModified () { - webidl.brandCheck(this, File) + if (request.method === 'HEAD') { + return 1 + } - return this[kState].lastModified - } + if (statusCode < 200) { + return 1 + } - get type () { - webidl.brandCheck(this, File) + if (socket[kBlocking]) { + socket[kBlocking] = false + resume(client) + } - return this[kState].type + return pause ? constants.ERROR.PAUSED : 0 } -} -class FileLike { - constructor (blobLike, fileName, options = {}) { - // TODO: argument idl type check + onBody (buf) { + const { client, socket, statusCode, maxResponseSize } = this - // The File constructor is invoked with two or three parameters, depending - // on whether the optional dictionary parameter is used. When the File() - // constructor is invoked, user agents must run the following steps: + if (socket.destroyed) { + return -1 + } - // 1. Let bytes be the result of processing blob parts given fileBits and - // options. + const request = client[kQueue][client[kRunningIdx]] + assert(request) - // 2. Let n be the fileName argument to the constructor. - const n = fileName + assert.strictEqual(this.timeoutType, TIMEOUT_BODY) + if (this.timeout) { + // istanbul ignore else: only for jest + if (this.timeout.refresh) { + this.timeout.refresh() + } + } - // 3. Process FilePropertyBag dictionary argument by running the following - // substeps: + assert(statusCode >= 200) - // 1. If the type member is provided and is not the empty string, let t - // be set to the type dictionary member. If t contains any characters - // outside the range U+0020 to U+007E, then set t to the empty string - // and return from these substeps. - // TODO - const t = options.type + if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) { + util.destroy(socket, new ResponseExceededMaxSizeError()) + return -1 + } - // 2. Convert every character in t to ASCII lowercase. - // TODO + this.bytesRead += buf.length - // 3. If the lastModified member is provided, let d be set to the - // lastModified dictionary member. If it is not provided, set d to the - // current date and time represented as the number of milliseconds since - // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]). - const d = options.lastModified ?? Date.now() + if (request.onData(buf) === false) { + return constants.ERROR.PAUSED + } + } - // 4. Return a new File object F such that: - // F refers to the bytes byte sequence. - // F.size is set to the number of total bytes in bytes. - // F.name is set to n. - // F.type is set to t. - // F.lastModified is set to d. + onMessageComplete () { + const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this - this[kState] = { - blobLike, - name: n, - type: t, - lastModified: d + if (socket.destroyed && (!statusCode || shouldKeepAlive)) { + return -1 } - } - stream (...args) { - webidl.brandCheck(this, FileLike) + if (upgrade) { + return + } - return this[kState].blobLike.stream(...args) - } + const request = client[kQueue][client[kRunningIdx]] + assert(request) - arrayBuffer (...args) { - webidl.brandCheck(this, FileLike) + assert(statusCode >= 100) - return this[kState].blobLike.arrayBuffer(...args) - } + this.statusCode = null + this.statusText = '' + this.bytesRead = 0 + this.contentLength = '' + this.keepAlive = '' + this.connection = '' - slice (...args) { - webidl.brandCheck(this, FileLike) + assert(this.headers.length % 2 === 0) + this.headers = [] + this.headersSize = 0 - return this[kState].blobLike.slice(...args) - } + if (statusCode < 200) { + return + } - text (...args) { - webidl.brandCheck(this, FileLike) + /* istanbul ignore next: should be handled by llhttp? */ + if (request.method !== 'HEAD' && contentLength && bytesRead !== parseInt(contentLength, 10)) { + util.destroy(socket, new ResponseContentLengthMismatchError()) + return -1 + } - return this[kState].blobLike.text(...args) - } + request.onComplete(headers) - get size () { - webidl.brandCheck(this, FileLike) + client[kQueue][client[kRunningIdx]++] = null - return this[kState].blobLike.size + if (socket[kWriting]) { + assert.strictEqual(client[kRunning], 0) + // Response completed before request. + util.destroy(socket, new InformationalError('reset')) + return constants.ERROR.PAUSED + } else if (!shouldKeepAlive) { + util.destroy(socket, new InformationalError('reset')) + return constants.ERROR.PAUSED + } else if (socket[kReset] && client[kRunning] === 0) { + // Destroy socket once all requests have completed. + // The request at the tail of the pipeline is the one + // that requested reset and no further requests should + // have been queued since then. + util.destroy(socket, new InformationalError('reset')) + return constants.ERROR.PAUSED + } else if (client[kPipelining] === 1) { + // We must wait a full event loop cycle to reuse this socket to make sure + // that non-spec compliant servers are not closing the connection even if they + // said they won't. + setImmediate(resume, client) + } else { + resume(client) + } } +} - get type () { - webidl.brandCheck(this, FileLike) +function onParserTimeout (parser) { + const { socket, timeoutType, client } = parser - return this[kState].blobLike.type + /* istanbul ignore else */ + if (timeoutType === TIMEOUT_HEADERS) { + if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) { + assert(!parser.paused, 'cannot be paused while waiting for headers') + util.destroy(socket, new HeadersTimeoutError()) + } + } else if (timeoutType === TIMEOUT_BODY) { + if (!parser.paused) { + util.destroy(socket, new BodyTimeoutError()) + } + } else if (timeoutType === TIMEOUT_IDLE) { + assert(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]) + util.destroy(socket, new InformationalError('socket idle timeout')) } +} - get name () { - webidl.brandCheck(this, FileLike) - - return this[kState].name +function onSocketReadable () { + const { [kParser]: parser } = this + if (parser) { + parser.readMore() } +} - get lastModified () { - webidl.brandCheck(this, FileLike) +function onSocketError (err) { + const { [kClient]: client, [kParser]: parser } = this - return this[kState].lastModified - } + assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID') - get [Symbol.toStringTag] () { - return 'File' + if (client[kHTTPConnVersion] !== 'h2') { + // On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded + // to the user. + if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) { + // We treat all incoming data so for as a valid response. + parser.onMessageComplete() + return + } } + + this[kError] = err + + onError(this[kClient], err) } -Object.defineProperties(File.prototype, { - [Symbol.toStringTag]: { - value: 'File', - configurable: true - }, - name: kEnumerableProperty, - lastModified: kEnumerableProperty -}) +function onError (client, err) { + if ( + client[kRunning] === 0 && + err.code !== 'UND_ERR_INFO' && + err.code !== 'UND_ERR_SOCKET' + ) { + // Error is not caused by running request and not a recoverable + // socket error. -webidl.converters.Blob = webidl.interfaceConverter(Blob) + assert(client[kPendingIdx] === client[kRunningIdx]) -webidl.converters.BlobPart = function (V, opts) { - if (webidl.util.Type(V) === 'Object') { - if (isBlobLike(V)) { - return webidl.converters.Blob(V, { strict: false }) + const requests = client[kQueue].splice(client[kRunningIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(client, request, err) } + assert(client[kSize] === 0) + } +} - if ( - ArrayBuffer.isView(V) || - types.isAnyArrayBuffer(V) - ) { - return webidl.converters.BufferSource(V, opts) +function onSocketEnd () { + const { [kParser]: parser, [kClient]: client } = this + + if (client[kHTTPConnVersion] !== 'h2') { + if (parser.statusCode && !parser.shouldKeepAlive) { + // We treat all incoming data so far as a valid response. + parser.onMessageComplete() + return } } - return webidl.converters.USVString(V, opts) + util.destroy(this, new SocketError('other side closed', util.getSocketInfo(this))) } -webidl.converters['sequence'] = webidl.sequenceConverter( - webidl.converters.BlobPart -) +function onSocketClose () { + const { [kClient]: client, [kParser]: parser } = this -// https://www.w3.org/TR/FileAPI/#dfn-FilePropertyBag -webidl.converters.FilePropertyBag = webidl.dictionaryConverter([ - { - key: 'lastModified', - converter: webidl.converters['long long'], - get defaultValue () { - return Date.now() + if (client[kHTTPConnVersion] === 'h1' && parser) { + if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) { + // We treat all incoming data so far as a valid response. + parser.onMessageComplete() } - }, - { - key: 'type', - converter: webidl.converters.DOMString, - defaultValue: '' - }, - { - key: 'endings', - converter: (value) => { - value = webidl.converters.DOMString(value) - value = value.toLowerCase() - if (value !== 'native') { - value = 'transparent' - } - - return value - }, - defaultValue: 'transparent' + this[kParser].destroy() + this[kParser] = null } -]) -/** - * @see https://www.w3.org/TR/FileAPI/#process-blob-parts - * @param {(NodeJS.TypedArray|Blob|string)[]} parts - * @param {{ type: string, endings: string }} options - */ -function processBlobParts (parts, options) { - // 1. Let bytes be an empty sequence of bytes. - /** @type {NodeJS.TypedArray[]} */ - const bytes = [] + const err = this[kError] || new SocketError('closed', util.getSocketInfo(this)) - // 2. For each element in parts: - for (const element of parts) { - // 1. If element is a USVString, run the following substeps: - if (typeof element === 'string') { - // 1. Let s be element. - let s = element + client[kSocket] = null - // 2. If the endings member of options is "native", set s - // to the result of converting line endings to native - // of element. - if (options.endings === 'native') { - s = convertLineEndingsNative(s) - } + if (client.destroyed) { + assert(client[kPending] === 0) - // 3. Append the result of UTF-8 encoding s to bytes. - bytes.push(encoder.encode(s)) - } else if ( - types.isAnyArrayBuffer(element) || - types.isTypedArray(element) - ) { - // 2. If element is a BufferSource, get a copy of the - // bytes held by the buffer source, and append those - // bytes to bytes. - if (!element.buffer) { // ArrayBuffer - bytes.push(new Uint8Array(element)) - } else { - bytes.push( - new Uint8Array(element.buffer, element.byteOffset, element.byteLength) - ) - } - } else if (isBlobLike(element)) { - // 3. If element is a Blob, append the bytes it represents - // to bytes. - bytes.push(element) + // Fail entire queue. + const requests = client[kQueue].splice(client[kRunningIdx]) + for (let i = 0; i < requests.length; i++) { + const request = requests[i] + errorRequest(client, request, err) } + } else if (client[kRunning] > 0 && err.code !== 'UND_ERR_INFO') { + // Fail head of pipeline. + const request = client[kQueue][client[kRunningIdx]] + client[kQueue][client[kRunningIdx]++] = null + + errorRequest(client, request, err) } - // 3. Return bytes. - return bytes -} + client[kPendingIdx] = client[kRunningIdx] -/** - * @see https://www.w3.org/TR/FileAPI/#convert-line-endings-to-native - * @param {string} s - */ -function convertLineEndingsNative (s) { - // 1. Let native line ending be be the code point U+000A LF. - let nativeLineEnding = '\n' + assert(client[kRunning] === 0) - // 2. If the underlying platform’s conventions are to - // represent newlines as a carriage return and line feed - // sequence, set native line ending to the code point - // U+000D CR followed by the code point U+000A LF. - if (process.platform === 'win32') { - nativeLineEnding = '\r\n' - } + client.emit('disconnect', client[kUrl], [client], err) - return s.replace(/\r?\n/g, nativeLineEnding) + resume(client) } -// If this function is moved to ./util.js, some tools (such as -// rollup) will warn about circular dependencies. See: -// https://github.com/nodejs/undici/issues/1629 -function isFileLike (object) { - return ( - (NativeFile && object instanceof NativeFile) || - object instanceof File || ( - object && - (typeof object.stream === 'function' || - typeof object.arrayBuffer === 'function') && - object[Symbol.toStringTag] === 'File' - ) - ) -} +async function connect (client) { + assert(!client[kConnecting]) + assert(!client[kSocket]) -module.exports = { File, FileLike, isFileLike } + let { host, hostname, protocol, port } = client[kUrl] + // Resolve ipv6 + if (hostname[0] === '[') { + const idx = hostname.indexOf(']') -/***/ }), + assert(idx !== -1) + const ip = hostname.substring(1, idx) -/***/ 72015: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + assert(net.isIP(ip)) + hostname = ip + } -"use strict"; + client[kConnecting] = true + if (channels.beforeConnect.hasSubscribers) { + channels.beforeConnect.publish({ + connectParams: { + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, + connector: client[kConnector] + }) + } -const { isBlobLike, toUSVString, makeIterator } = __nccwpck_require__(52538) -const { kState } = __nccwpck_require__(15861) -const { File: UndiciFile, FileLike, isFileLike } = __nccwpck_require__(78511) -const { webidl } = __nccwpck_require__(21744) -const { Blob, File: NativeFile } = __nccwpck_require__(14300) + try { + const socket = await new Promise((resolve, reject) => { + client[kConnector]({ + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, (err, socket) => { + if (err) { + reject(err) + } else { + resolve(socket) + } + }) + }) -/** @type {globalThis['File']} */ -const File = NativeFile ?? UndiciFile + if (client.destroyed) { + util.destroy(socket.on('error', () => {}), new ClientDestroyedError()) + return + } -// https://xhr.spec.whatwg.org/#formdata -class FormData { - constructor (form) { - if (form !== undefined) { - throw webidl.errors.conversionFailed({ - prefix: 'FormData constructor', - argument: 'Argument 1', - types: ['undefined'] + client[kConnecting] = false + + assert(socket) + + const isH2 = socket.alpnProtocol === 'h2' + if (isH2) { + if (!h2ExperimentalWarned) { + h2ExperimentalWarned = true + process.emitWarning('H2 support is experimental, expect them to change at any time.', { + code: 'UNDICI-H2' + }) + } + + const session = http2.connect(client[kUrl], { + createConnection: () => socket, + peerMaxConcurrentStreams: client[kHTTP2SessionState].maxConcurrentStreams }) + + client[kHTTPConnVersion] = 'h2' + session[kClient] = client + session[kSocket] = socket + session.on('error', onHttp2SessionError) + session.on('frameError', onHttp2FrameError) + session.on('end', onHttp2SessionEnd) + session.on('goaway', onHTTP2GoAway) + session.on('close', onSocketClose) + session.unref() + + client[kHTTP2Session] = session + socket[kHTTP2Session] = session + } else { + if (!llhttpInstance) { + llhttpInstance = await llhttpPromise + llhttpPromise = null + } + + socket[kNoRef] = false + socket[kWriting] = false + socket[kReset] = false + socket[kBlocking] = false + socket[kParser] = new Parser(client, socket, llhttpInstance) } - this[kState] = [] - } + socket[kCounter] = 0 + socket[kMaxRequests] = client[kMaxRequests] + socket[kClient] = client + socket[kError] = null - append (name, value, filename = undefined) { - webidl.brandCheck(this, FormData) + socket + .on('error', onSocketError) + .on('readable', onSocketReadable) + .on('end', onSocketEnd) + .on('close', onSocketClose) - webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.append' }) + client[kSocket] = socket - if (arguments.length === 3 && !isBlobLike(value)) { - throw new TypeError( - "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'" - ) + if (channels.connected.hasSubscribers) { + channels.connected.publish({ + connectParams: { + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, + connector: client[kConnector], + socket + }) + } + client.emit('connect', client[kUrl], [client]) + } catch (err) { + if (client.destroyed) { + return } - // 1. Let value be value if given; otherwise blobValue. + client[kConnecting] = false - name = webidl.converters.USVString(name) - value = isBlobLike(value) - ? webidl.converters.Blob(value, { strict: false }) - : webidl.converters.USVString(value) - filename = arguments.length === 3 - ? webidl.converters.USVString(filename) - : undefined + if (channels.connectError.hasSubscribers) { + channels.connectError.publish({ + connectParams: { + host, + hostname, + protocol, + port, + servername: client[kServerName], + localAddress: client[kLocalAddress] + }, + connector: client[kConnector], + error: err + }) + } - // 2. Let entry be the result of creating an entry with - // name, value, and filename if given. - const entry = makeEntry(name, value, filename) + if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') { + assert(client[kRunning] === 0) + while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) { + const request = client[kQueue][client[kPendingIdx]++] + errorRequest(client, request, err) + } + } else { + onError(client, err) + } - // 3. Append entry to this’s entry list. - this[kState].push(entry) + client.emit('connectionError', client[kUrl], [client], err) } - delete (name) { - webidl.brandCheck(this, FormData) - - webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.delete' }) + resume(client) +} - name = webidl.converters.USVString(name) +function emitDrain (client) { + client[kNeedDrain] = 0 + client.emit('drain', client[kUrl], [client]) +} - // The delete(name) method steps are to remove all entries whose name - // is name from this’s entry list. - this[kState] = this[kState].filter(entry => entry.name !== name) +function resume (client, sync) { + if (client[kResuming] === 2) { + return } - get (name) { - webidl.brandCheck(this, FormData) + client[kResuming] = 2 - webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.get' }) + _resume(client, sync) + client[kResuming] = 0 - name = webidl.converters.USVString(name) + if (client[kRunningIdx] > 256) { + client[kQueue].splice(0, client[kRunningIdx]) + client[kPendingIdx] -= client[kRunningIdx] + client[kRunningIdx] = 0 + } +} - // 1. If there is no entry whose name is name in this’s entry list, - // then return null. - const idx = this[kState].findIndex((entry) => entry.name === name) - if (idx === -1) { - return null +function _resume (client, sync) { + while (true) { + if (client.destroyed) { + assert(client[kPending] === 0) + return } - // 2. Return the value of the first entry whose name is name from - // this’s entry list. - return this[kState][idx].value - } + if (client[kClosedResolve] && !client[kSize]) { + client[kClosedResolve]() + client[kClosedResolve] = null + return + } - getAll (name) { - webidl.brandCheck(this, FormData) + const socket = client[kSocket] - webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.getAll' }) + if (socket && !socket.destroyed && socket.alpnProtocol !== 'h2') { + if (client[kSize] === 0) { + if (!socket[kNoRef] && socket.unref) { + socket.unref() + socket[kNoRef] = true + } + } else if (socket[kNoRef] && socket.ref) { + socket.ref() + socket[kNoRef] = false + } - name = webidl.converters.USVString(name) + if (client[kSize] === 0) { + if (socket[kParser].timeoutType !== TIMEOUT_IDLE) { + socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_IDLE) + } + } else if (client[kRunning] > 0 && socket[kParser].statusCode < 200) { + if (socket[kParser].timeoutType !== TIMEOUT_HEADERS) { + const request = client[kQueue][client[kRunningIdx]] + const headersTimeout = request.headersTimeout != null + ? request.headersTimeout + : client[kHeadersTimeout] + socket[kParser].setTimeout(headersTimeout, TIMEOUT_HEADERS) + } + } + } - // 1. If there is no entry whose name is name in this’s entry list, - // then return the empty list. - // 2. Return the values of all entries whose name is name, in order, - // from this’s entry list. - return this[kState] - .filter((entry) => entry.name === name) - .map((entry) => entry.value) - } + if (client[kBusy]) { + client[kNeedDrain] = 2 + } else if (client[kNeedDrain] === 2) { + if (sync) { + client[kNeedDrain] = 1 + process.nextTick(emitDrain, client) + } else { + emitDrain(client) + } + continue + } - has (name) { - webidl.brandCheck(this, FormData) + if (client[kPending] === 0) { + return + } - webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.has' }) + if (client[kRunning] >= (client[kPipelining] || 1)) { + return + } - name = webidl.converters.USVString(name) + const request = client[kQueue][client[kPendingIdx]] - // The has(name) method steps are to return true if there is an entry - // whose name is name in this’s entry list; otherwise false. - return this[kState].findIndex((entry) => entry.name === name) !== -1 - } + if (client[kUrl].protocol === 'https:' && client[kServerName] !== request.servername) { + if (client[kRunning] > 0) { + return + } - set (name, value, filename = undefined) { - webidl.brandCheck(this, FormData) + client[kServerName] = request.servername - webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.set' }) + if (socket && socket.servername !== request.servername) { + util.destroy(socket, new InformationalError('servername changed')) + return + } + } - if (arguments.length === 3 && !isBlobLike(value)) { - throw new TypeError( - "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'" - ) + if (client[kConnecting]) { + return } - // The set(name, value) and set(name, blobValue, filename) method steps - // are: + if (!socket && !client[kHTTP2Session]) { + connect(client) + return + } - // 1. Let value be value if given; otherwise blobValue. + if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) { + return + } - name = webidl.converters.USVString(name) - value = isBlobLike(value) - ? webidl.converters.Blob(value, { strict: false }) - : webidl.converters.USVString(value) - filename = arguments.length === 3 - ? toUSVString(filename) - : undefined + if (client[kRunning] > 0 && !request.idempotent) { + // Non-idempotent request cannot be retried. + // Ensure that no other requests are inflight and + // could cause failure. + return + } - // 2. Let entry be the result of creating an entry with name, value, and - // filename if given. - const entry = makeEntry(name, value, filename) + if (client[kRunning] > 0 && (request.upgrade || request.method === 'CONNECT')) { + // Don't dispatch an upgrade until all preceding requests have completed. + // A misbehaving server might upgrade the connection before all pipelined + // request has completed. + return + } - // 3. If there are entries in this’s entry list whose name is name, then - // replace the first such entry with entry and remove the others. - const idx = this[kState].findIndex((entry) => entry.name === name) - if (idx !== -1) { - this[kState] = [ - ...this[kState].slice(0, idx), - entry, - ...this[kState].slice(idx + 1).filter((entry) => entry.name !== name) - ] + if (client[kRunning] > 0 && util.bodyLength(request.body) !== 0 && + (util.isStream(request.body) || util.isAsyncIterable(request.body))) { + // Request with stream or iterator body can error while other requests + // are inflight and indirectly error those as well. + // Ensure this doesn't happen by waiting for inflight + // to complete before dispatching. + + // Request with stream or iterator body cannot be retried. + // Ensure that no other requests are inflight and + // could cause failure. + return + } + + if (!request.aborted && write(client, request)) { + client[kPendingIdx]++ } else { - // 4. Otherwise, append entry to this’s entry list. - this[kState].push(entry) + client[kQueue].splice(client[kPendingIdx], 1) } } +} - entries () { - webidl.brandCheck(this, FormData) +// https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2 +function shouldSendContentLength (method) { + return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT' +} - return makeIterator( - () => this[kState].map(pair => [pair.name, pair.value]), - 'FormData', - 'key+value' - ) +function write (client, request) { + if (client[kHTTPConnVersion] === 'h2') { + writeH2(client, client[kHTTP2Session], request) + return } - keys () { - webidl.brandCheck(this, FormData) + const { body, method, path, host, upgrade, headers, blocking, reset } = request - return makeIterator( - () => this[kState].map(pair => [pair.name, pair.value]), - 'FormData', - 'key' - ) - } + // https://tools.ietf.org/html/rfc7231#section-4.3.1 + // https://tools.ietf.org/html/rfc7231#section-4.3.2 + // https://tools.ietf.org/html/rfc7231#section-4.3.5 - values () { - webidl.brandCheck(this, FormData) + // Sending a payload body on a request that does not + // expect it can cause undefined behavior on some + // servers and corrupt connection state. Do not + // re-use the connection for further requests. - return makeIterator( - () => this[kState].map(pair => [pair.name, pair.value]), - 'FormData', - 'value' - ) - } + const expectsPayload = ( + method === 'PUT' || + method === 'POST' || + method === 'PATCH' + ) - /** - * @param {(value: string, key: string, self: FormData) => void} callbackFn - * @param {unknown} thisArg - */ - forEach (callbackFn, thisArg = globalThis) { - webidl.brandCheck(this, FormData) + if (body && typeof body.read === 'function') { + // Try to read EOF in order to get length. + body.read(0) + } - webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.forEach' }) + const bodyLength = util.bodyLength(body) - if (typeof callbackFn !== 'function') { - throw new TypeError( - "Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'." - ) - } + let contentLength = bodyLength - for (const [key, value] of this) { - callbackFn.apply(thisArg, [value, key, this]) - } + if (contentLength === null) { + contentLength = request.contentLength } -} -FormData.prototype[Symbol.iterator] = FormData.prototype.entries + if (contentLength === 0 && !expectsPayload) { + // https://tools.ietf.org/html/rfc7230#section-3.3.2 + // A user agent SHOULD NOT send a Content-Length header field when + // the request message does not contain a payload body and the method + // semantics do not anticipate such a body. -Object.defineProperties(FormData.prototype, { - [Symbol.toStringTag]: { - value: 'FormData', - configurable: true + contentLength = null } -}) -/** - * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry - * @param {string} name - * @param {string|Blob} value - * @param {?string} filename - * @returns - */ -function makeEntry (name, value, filename) { - // 1. Set name to the result of converting name into a scalar value string. - // "To convert a string into a scalar value string, replace any surrogates - // with U+FFFD." - // see: https://nodejs.org/dist/latest-v18.x/docs/api/buffer.html#buftostringencoding-start-end - name = Buffer.from(name).toString('utf8') + // https://github.com/nodejs/undici/issues/2046 + // A user agent may send a Content-Length header with 0 value, this should be allowed. + if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength !== null && request.contentLength !== contentLength) { + if (client[kStrictContentLength]) { + errorRequest(client, request, new RequestContentLengthMismatchError()) + return false + } - // 2. If value is a string, then set value to the result of converting - // value into a scalar value string. - if (typeof value === 'string') { - value = Buffer.from(value).toString('utf8') - } else { - // 3. Otherwise: + process.emitWarning(new RequestContentLengthMismatchError()) + } - // 1. If value is not a File object, then set value to a new File object, - // representing the same bytes, whose name attribute value is "blob" - if (!isFileLike(value)) { - value = value instanceof Blob - ? new File([value], 'blob', { type: value.type }) - : new FileLike(value, 'blob', { type: value.type }) - } + const socket = client[kSocket] - // 2. If filename is given, then set value to a new File object, - // representing the same bytes, whose name attribute is filename. - if (filename !== undefined) { - /** @type {FilePropertyBag} */ - const options = { - type: value.type, - lastModified: value.lastModified + try { + request.onConnect((err) => { + if (request.aborted || request.completed) { + return } - value = (NativeFile && value instanceof NativeFile) || value instanceof UndiciFile - ? new File([value], filename, options) - : new FileLike(value, filename, options) - } - } + errorRequest(client, request, err || new RequestAbortedError()) - // 4. Return an entry whose name is name and whose value is value. - return { name, value } -} - -module.exports = { FormData } - - -/***/ }), - -/***/ 71246: -/***/ ((module) => { - -"use strict"; - - -// In case of breaking changes, increase the version -// number to avoid conflicts. -const globalOrigin = Symbol.for('undici.globalOrigin.1') - -function getGlobalOrigin () { - return globalThis[globalOrigin] -} - -function setGlobalOrigin (newOrigin) { - if (newOrigin === undefined) { - Object.defineProperty(globalThis, globalOrigin, { - value: undefined, - writable: true, - enumerable: false, - configurable: false + util.destroy(socket, new InformationalError('aborted')) }) + } catch (err) { + errorRequest(client, request, err) + } - return + if (request.aborted) { + return false } - const parsedURL = new URL(newOrigin) + if (method === 'HEAD') { + // https://github.com/mcollina/undici/issues/258 + // Close after a HEAD request to interop with misbehaving servers + // that may send a body in the response. - if (parsedURL.protocol !== 'http:' && parsedURL.protocol !== 'https:') { - throw new TypeError(`Only http & https urls are allowed, received ${parsedURL.protocol}`) + socket[kReset] = true } - Object.defineProperty(globalThis, globalOrigin, { - value: parsedURL, - writable: true, - enumerable: false, - configurable: false - }) -} - -module.exports = { - getGlobalOrigin, - setGlobalOrigin -} + if (upgrade || method === 'CONNECT') { + // On CONNECT or upgrade, block pipeline from dispatching further + // requests on this connection. + socket[kReset] = true + } -/***/ }), + if (reset != null) { + socket[kReset] = reset + } -/***/ 10554: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) { + socket[kReset] = true + } -"use strict"; -// https://github.com/Ethan-Arrowood/undici-fetch + if (blocking) { + socket[kBlocking] = true + } + let header = `${method} ${path} HTTP/1.1\r\n` + if (typeof host === 'string') { + header += `host: ${host}\r\n` + } else { + header += client[kHostHeader] + } -const { kHeadersList, kConstruct } = __nccwpck_require__(72785) -const { kGuard } = __nccwpck_require__(15861) -const { kEnumerableProperty } = __nccwpck_require__(83983) -const { - makeIterator, - isValidHeaderName, - isValidHeaderValue -} = __nccwpck_require__(52538) -const util = __nccwpck_require__(73837) -const { webidl } = __nccwpck_require__(21744) -const assert = __nccwpck_require__(39491) + if (upgrade) { + header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n` + } else if (client[kPipelining] && !socket[kReset]) { + header += 'connection: keep-alive\r\n' + } else { + header += 'connection: close\r\n' + } -const kHeadersMap = Symbol('headers map') -const kHeadersSortedMap = Symbol('headers map sorted') + if (headers) { + header += headers + } -/** - * @param {number} code - */ -function isHTTPWhiteSpaceCharCode (code) { - return code === 0x00a || code === 0x00d || code === 0x009 || code === 0x020 -} + if (channels.sendHeaders.hasSubscribers) { + channels.sendHeaders.publish({ request, headers: header, socket }) + } -/** - * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize - * @param {string} potentialValue - */ -function headerValueNormalize (potentialValue) { - // To normalize a byte sequence potentialValue, remove - // any leading and trailing HTTP whitespace bytes from - // potentialValue. - let i = 0; let j = potentialValue.length + /* istanbul ignore else: assertion */ + if (!body || bodyLength === 0) { + if (contentLength === 0) { + socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1') + } else { + assert(contentLength === null, 'no body must not have content length') + socket.write(`${header}\r\n`, 'latin1') + } + request.onRequestSent() + } else if (util.isBuffer(body)) { + assert(contentLength === body.byteLength, 'buffer body must have content length') - while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(j - 1))) --j - while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i))) ++i + socket.cork() + socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') + socket.write(body) + socket.uncork() + request.onBodySent(body) + request.onRequestSent() + if (!expectsPayload) { + socket[kReset] = true + } + } else if (util.isBlobLike(body)) { + if (typeof body.stream === 'function') { + writeIterable({ body: body.stream(), client, request, socket, contentLength, header, expectsPayload }) + } else { + writeBlob({ body, client, request, socket, contentLength, header, expectsPayload }) + } + } else if (util.isStream(body)) { + writeStream({ body, client, request, socket, contentLength, header, expectsPayload }) + } else if (util.isIterable(body)) { + writeIterable({ body, client, request, socket, contentLength, header, expectsPayload }) + } else { + assert(false) + } - return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j) + return true } -function fill (headers, object) { - // To fill a Headers object headers with a given object object, run these steps: - - // 1. If object is a sequence, then for each header in object: - // Note: webidl conversion to array has already been done. - if (Array.isArray(object)) { - for (let i = 0; i < object.length; ++i) { - const header = object[i] - // 1. If header does not contain exactly two items, then throw a TypeError. - if (header.length !== 2) { - throw webidl.errors.exception({ - header: 'Headers constructor', - message: `expected name/value pair to be length 2, found ${header.length}.` - }) - } +function writeH2 (client, session, request) { + const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request - // 2. Append (header’s first item, header’s second item) to headers. - appendHeader(headers, header[0], header[1]) - } - } else if (typeof object === 'object' && object !== null) { - // Note: null should throw + let headers + if (typeof reqHeaders === 'string') headers = Request[kHTTP2CopyHeaders](reqHeaders.trim()) + else headers = reqHeaders - // 2. Otherwise, object is a record, then for each key → value in object, - // append (key, value) to headers - const keys = Object.keys(object) - for (let i = 0; i < keys.length; ++i) { - appendHeader(headers, keys[i], object[keys[i]]) - } - } else { - throw webidl.errors.conversionFailed({ - prefix: 'Headers constructor', - argument: 'Argument 1', - types: ['sequence>', 'record'] - }) + if (upgrade) { + errorRequest(client, request, new Error('Upgrade not supported for H2')) + return false } -} -/** - * @see https://fetch.spec.whatwg.org/#concept-headers-append - */ -function appendHeader (headers, name, value) { - // 1. Normalize value. - value = headerValueNormalize(value) + try { + // TODO(HTTP/2): Should we call onConnect immediately or on stream ready event? + request.onConnect((err) => { + if (request.aborted || request.completed) { + return + } - // 2. If name is not a header name or value is not a - // header value, then throw a TypeError. - if (!isValidHeaderName(name)) { - throw webidl.errors.invalidArgument({ - prefix: 'Headers.append', - value: name, - type: 'header name' - }) - } else if (!isValidHeaderValue(value)) { - throw webidl.errors.invalidArgument({ - prefix: 'Headers.append', - value, - type: 'header value' + errorRequest(client, request, err || new RequestAbortedError()) }) + } catch (err) { + errorRequest(client, request, err) } - // 3. If headers’s guard is "immutable", then throw a TypeError. - // 4. Otherwise, if headers’s guard is "request" and name is a - // forbidden header name, return. - // Note: undici does not implement forbidden header names - if (headers[kGuard] === 'immutable') { - throw new TypeError('immutable') - } else if (headers[kGuard] === 'request-no-cors') { - // 5. Otherwise, if headers’s guard is "request-no-cors": - // TODO + if (request.aborted) { + return false } - // 6. Otherwise, if headers’s guard is "response" and name is a - // forbidden response-header name, return. - - // 7. Append (name, value) to headers’s header list. - return headers[kHeadersList].append(name, value) + /** @type {import('node:http2').ClientHttp2Stream} */ + let stream + const h2State = client[kHTTP2SessionState] - // 8. If headers’s guard is "request-no-cors", then remove - // privileged no-CORS request headers from headers -} + headers[HTTP2_HEADER_AUTHORITY] = host || client[kHost] + headers[HTTP2_HEADER_METHOD] = method -class HeadersList { - /** @type {[string, string][]|null} */ - cookies = null + if (method === 'CONNECT') { + session.ref() + // we are already connected, streams are pending, first request + // will create a new stream. We trigger a request to create the stream and wait until + // `ready` event is triggered + // We disabled endStream to allow the user to write to the stream + stream = session.request(headers, { endStream: false, signal }) - constructor (init) { - if (init instanceof HeadersList) { - this[kHeadersMap] = new Map(init[kHeadersMap]) - this[kHeadersSortedMap] = init[kHeadersSortedMap] - this.cookies = init.cookies === null ? null : [...init.cookies] + if (stream.id && !stream.pending) { + request.onUpgrade(null, null, stream) + ++h2State.openStreams } else { - this[kHeadersMap] = new Map(init) - this[kHeadersSortedMap] = null + stream.once('ready', () => { + request.onUpgrade(null, null, stream) + ++h2State.openStreams + }) } - } - - // https://fetch.spec.whatwg.org/#header-list-contains - contains (name) { - // A header list list contains a header name name if list - // contains a header whose name is a byte-case-insensitive - // match for name. - name = name.toLowerCase() - return this[kHeadersMap].has(name) - } + stream.once('close', () => { + h2State.openStreams -= 1 + // TODO(HTTP/2): unref only if current streams count is 0 + if (h2State.openStreams === 0) session.unref() + }) - clear () { - this[kHeadersMap].clear() - this[kHeadersSortedMap] = null - this.cookies = null + return true } - // https://fetch.spec.whatwg.org/#concept-header-list-append - append (name, value) { - this[kHeadersSortedMap] = null - - // 1. If list contains name, then set name to the first such - // header’s name. - const lowercaseName = name.toLowerCase() - const exists = this[kHeadersMap].get(lowercaseName) + // https://tools.ietf.org/html/rfc7540#section-8.3 + // :path and :scheme headers must be omited when sending CONNECT - // 2. Append (name, value) to list. - if (exists) { - const delimiter = lowercaseName === 'cookie' ? '; ' : ', ' - this[kHeadersMap].set(lowercaseName, { - name: exists.name, - value: `${exists.value}${delimiter}${value}` - }) - } else { - this[kHeadersMap].set(lowercaseName, { name, value }) - } + headers[HTTP2_HEADER_PATH] = path + headers[HTTP2_HEADER_SCHEME] = 'https' - if (lowercaseName === 'set-cookie') { - this.cookies ??= [] - this.cookies.push(value) - } - } + // https://tools.ietf.org/html/rfc7231#section-4.3.1 + // https://tools.ietf.org/html/rfc7231#section-4.3.2 + // https://tools.ietf.org/html/rfc7231#section-4.3.5 - // https://fetch.spec.whatwg.org/#concept-header-list-set - set (name, value) { - this[kHeadersSortedMap] = null - const lowercaseName = name.toLowerCase() + // Sending a payload body on a request that does not + // expect it can cause undefined behavior on some + // servers and corrupt connection state. Do not + // re-use the connection for further requests. - if (lowercaseName === 'set-cookie') { - this.cookies = [value] - } + const expectsPayload = ( + method === 'PUT' || + method === 'POST' || + method === 'PATCH' + ) - // 1. If list contains name, then set the value of - // the first such header to value and remove the - // others. - // 2. Otherwise, append header (name, value) to list. - this[kHeadersMap].set(lowercaseName, { name, value }) + if (body && typeof body.read === 'function') { + // Try to read EOF in order to get length. + body.read(0) } - // https://fetch.spec.whatwg.org/#concept-header-list-delete - delete (name) { - this[kHeadersSortedMap] = null + let contentLength = util.bodyLength(body) - name = name.toLowerCase() + if (contentLength == null) { + contentLength = request.contentLength + } - if (name === 'set-cookie') { - this.cookies = null - } + if (contentLength === 0 || !expectsPayload) { + // https://tools.ietf.org/html/rfc7230#section-3.3.2 + // A user agent SHOULD NOT send a Content-Length header field when + // the request message does not contain a payload body and the method + // semantics do not anticipate such a body. - this[kHeadersMap].delete(name) + contentLength = null } - // https://fetch.spec.whatwg.org/#concept-header-list-get - get (name) { - const value = this[kHeadersMap].get(name.toLowerCase()) + // https://github.com/nodejs/undici/issues/2046 + // A user agent may send a Content-Length header with 0 value, this should be allowed. + if (shouldSendContentLength(method) && contentLength > 0 && request.contentLength != null && request.contentLength !== contentLength) { + if (client[kStrictContentLength]) { + errorRequest(client, request, new RequestContentLengthMismatchError()) + return false + } - // 1. If list does not contain name, then return null. - // 2. Return the values of all headers in list whose name - // is a byte-case-insensitive match for name, - // separated from each other by 0x2C 0x20, in order. - return value === undefined ? null : value.value + process.emitWarning(new RequestContentLengthMismatchError()) } - * [Symbol.iterator] () { - // use the lowercased name - for (const [name, { value }] of this[kHeadersMap]) { - yield [name, value] - } + if (contentLength != null) { + assert(body, 'no body must not have content length') + headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}` } - get entries () { - const headers = {} + session.ref() - if (this[kHeadersMap].size) { - for (const { name, value } of this[kHeadersMap].values()) { - headers[name] = value - } - } + const shouldEndStream = method === 'GET' || method === 'HEAD' + if (expectContinue) { + headers[HTTP2_HEADER_EXPECT] = '100-continue' + stream = session.request(headers, { endStream: shouldEndStream, signal }) - return headers + stream.once('continue', writeBodyH2) + } else { + stream = session.request(headers, { + endStream: shouldEndStream, + signal + }) + writeBodyH2() } -} -// https://fetch.spec.whatwg.org/#headers-class -class Headers { - constructor (init = undefined) { - if (init === kConstruct) { - return + // Increment counter as we have new several streams open + ++h2State.openStreams + + stream.once('response', headers => { + const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers + + if (request.onHeaders(Number(statusCode), realHeaders, stream.resume.bind(stream), '') === false) { + stream.pause() } - this[kHeadersList] = new HeadersList() + }) - // The new Headers(init) constructor steps are: + stream.once('end', () => { + request.onComplete([]) + }) - // 1. Set this’s guard to "none". - this[kGuard] = 'none' + stream.on('data', (chunk) => { + if (request.onData(chunk) === false) { + stream.pause() + } + }) - // 2. If init is given, then fill this with init. - if (init !== undefined) { - init = webidl.converters.HeadersInit(init) - fill(this, init) + stream.once('close', () => { + h2State.openStreams -= 1 + // TODO(HTTP/2): unref only if current streams count is 0 + if (h2State.openStreams === 0) { + session.unref() } - } + }) - // https://fetch.spec.whatwg.org/#dom-headers-append - append (name, value) { - webidl.brandCheck(this, Headers) + stream.once('error', function (err) { + if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { + h2State.streams -= 1 + util.destroy(stream, err) + } + }) - webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.append' }) + stream.once('frameError', (type, code) => { + const err = new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`) + errorRequest(client, request, err) - name = webidl.converters.ByteString(name) - value = webidl.converters.ByteString(value) + if (client[kHTTP2Session] && !client[kHTTP2Session].destroyed && !this.closed && !this.destroyed) { + h2State.streams -= 1 + util.destroy(stream, err) + } + }) - return appendHeader(this, name, value) - } + // stream.on('aborted', () => { + // // TODO(HTTP/2): Support aborted + // }) - // https://fetch.spec.whatwg.org/#dom-headers-delete - delete (name) { - webidl.brandCheck(this, Headers) + // stream.on('timeout', () => { + // // TODO(HTTP/2): Support timeout + // }) - webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.delete' }) + // stream.on('push', headers => { + // // TODO(HTTP/2): Suppor push + // }) - name = webidl.converters.ByteString(name) + // stream.on('trailers', headers => { + // // TODO(HTTP/2): Support trailers + // }) - // 1. If name is not a header name, then throw a TypeError. - if (!isValidHeaderName(name)) { - throw webidl.errors.invalidArgument({ - prefix: 'Headers.delete', - value: name, - type: 'header name' - }) - } + return true - // 2. If this’s guard is "immutable", then throw a TypeError. - // 3. Otherwise, if this’s guard is "request" and name is a - // forbidden header name, return. - // 4. Otherwise, if this’s guard is "request-no-cors", name - // is not a no-CORS-safelisted request-header name, and - // name is not a privileged no-CORS request-header name, - // return. - // 5. Otherwise, if this’s guard is "response" and name is - // a forbidden response-header name, return. - // Note: undici does not implement forbidden header names - if (this[kGuard] === 'immutable') { - throw new TypeError('immutable') - } else if (this[kGuard] === 'request-no-cors') { - // TODO - } - - // 6. If this’s header list does not contain name, then - // return. - if (!this[kHeadersList].contains(name)) { - return + function writeBodyH2 () { + /* istanbul ignore else: assertion */ + if (!body) { + request.onRequestSent() + } else if (util.isBuffer(body)) { + assert(contentLength === body.byteLength, 'buffer body must have content length') + stream.cork() + stream.write(body) + stream.uncork() + stream.end() + request.onBodySent(body) + request.onRequestSent() + } else if (util.isBlobLike(body)) { + if (typeof body.stream === 'function') { + writeIterable({ + client, + request, + contentLength, + h2stream: stream, + expectsPayload, + body: body.stream(), + socket: client[kSocket], + header: '' + }) + } else { + writeBlob({ + body, + client, + request, + contentLength, + expectsPayload, + h2stream: stream, + header: '', + socket: client[kSocket] + }) + } + } else if (util.isStream(body)) { + writeStream({ + body, + client, + request, + contentLength, + expectsPayload, + socket: client[kSocket], + h2stream: stream, + header: '' + }) + } else if (util.isIterable(body)) { + writeIterable({ + body, + client, + request, + contentLength, + expectsPayload, + header: '', + h2stream: stream, + socket: client[kSocket] + }) + } else { + assert(false) } - - // 7. Delete name from this’s header list. - // 8. If this’s guard is "request-no-cors", then remove - // privileged no-CORS request headers from this. - this[kHeadersList].delete(name) } +} - // https://fetch.spec.whatwg.org/#dom-headers-get - get (name) { - webidl.brandCheck(this, Headers) +function writeStream ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { + assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined') - webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.get' }) + if (client[kHTTPConnVersion] === 'h2') { + // For HTTP/2, is enough to pipe the stream + const pipe = pipeline( + body, + h2stream, + (err) => { + if (err) { + util.destroy(body, err) + util.destroy(h2stream, err) + } else { + request.onRequestSent() + } + } + ) - name = webidl.converters.ByteString(name) + pipe.on('data', onPipeData) + pipe.once('end', () => { + pipe.removeListener('data', onPipeData) + util.destroy(pipe) + }) - // 1. If name is not a header name, then throw a TypeError. - if (!isValidHeaderName(name)) { - throw webidl.errors.invalidArgument({ - prefix: 'Headers.get', - value: name, - type: 'header name' - }) + function onPipeData (chunk) { + request.onBodySent(chunk) } - // 2. Return the result of getting name from this’s header - // list. - return this[kHeadersList].get(name) + return } - // https://fetch.spec.whatwg.org/#dom-headers-has - has (name) { - webidl.brandCheck(this, Headers) - - webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.has' }) + let finished = false - name = webidl.converters.ByteString(name) + const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header }) - // 1. If name is not a header name, then throw a TypeError. - if (!isValidHeaderName(name)) { - throw webidl.errors.invalidArgument({ - prefix: 'Headers.has', - value: name, - type: 'header name' - }) + const onData = function (chunk) { + if (finished) { + return } - // 2. Return true if this’s header list contains name; - // otherwise false. - return this[kHeadersList].contains(name) + try { + if (!writer.write(chunk) && this.pause) { + this.pause() + } + } catch (err) { + util.destroy(this, err) + } } - - // https://fetch.spec.whatwg.org/#dom-headers-set - set (name, value) { - webidl.brandCheck(this, Headers) - - webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.set' }) - - name = webidl.converters.ByteString(name) - value = webidl.converters.ByteString(value) - - // 1. Normalize value. - value = headerValueNormalize(value) - - // 2. If name is not a header name or value is not a - // header value, then throw a TypeError. - if (!isValidHeaderName(name)) { - throw webidl.errors.invalidArgument({ - prefix: 'Headers.set', - value: name, - type: 'header name' - }) - } else if (!isValidHeaderValue(value)) { - throw webidl.errors.invalidArgument({ - prefix: 'Headers.set', - value, - type: 'header value' - }) + const onDrain = function () { + if (finished) { + return } - // 3. If this’s guard is "immutable", then throw a TypeError. - // 4. Otherwise, if this’s guard is "request" and name is a - // forbidden header name, return. - // 5. Otherwise, if this’s guard is "request-no-cors" and - // name/value is not a no-CORS-safelisted request-header, - // return. - // 6. Otherwise, if this’s guard is "response" and name is a - // forbidden response-header name, return. - // Note: undici does not implement forbidden header names - if (this[kGuard] === 'immutable') { - throw new TypeError('immutable') - } else if (this[kGuard] === 'request-no-cors') { - // TODO + if (body.resume) { + body.resume() } - - // 7. Set (name, value) in this’s header list. - // 8. If this’s guard is "request-no-cors", then remove - // privileged no-CORS request headers from this - this[kHeadersList].set(name, value) } + const onAbort = function () { + if (finished) { + return + } + const err = new RequestAbortedError() + queueMicrotask(() => onFinished(err)) + } + const onFinished = function (err) { + if (finished) { + return + } - // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie - getSetCookie () { - webidl.brandCheck(this, Headers) + finished = true - // 1. If this’s header list does not contain `Set-Cookie`, then return « ». - // 2. Return the values of all headers in this’s header list whose name is - // a byte-case-insensitive match for `Set-Cookie`, in order. + assert(socket.destroyed || (socket[kWriting] && client[kRunning] <= 1)) - const list = this[kHeadersList].cookies + socket + .off('drain', onDrain) + .off('error', onFinished) - if (list) { - return [...list] + body + .removeListener('data', onData) + .removeListener('end', onFinished) + .removeListener('error', onFinished) + .removeListener('close', onAbort) + + if (!err) { + try { + writer.end() + } catch (er) { + err = er + } } - return [] - } + writer.destroy(err) - // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine - get [kHeadersSortedMap] () { - if (this[kHeadersList][kHeadersSortedMap]) { - return this[kHeadersList][kHeadersSortedMap] + if (err && (err.code !== 'UND_ERR_INFO' || err.message !== 'reset')) { + util.destroy(body, err) + } else { + util.destroy(body) } + } - // 1. Let headers be an empty list of headers with the key being the name - // and value the value. - const headers = [] + body + .on('data', onData) + .on('end', onFinished) + .on('error', onFinished) + .on('close', onAbort) - // 2. Let names be the result of convert header names to a sorted-lowercase - // set with all the names of the headers in list. - const names = [...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1) - const cookies = this[kHeadersList].cookies + if (body.resume) { + body.resume() + } - // 3. For each name of names: - for (let i = 0; i < names.length; ++i) { - const [name, value] = names[i] - // 1. If name is `set-cookie`, then: - if (name === 'set-cookie') { - // 1. Let values be a list of all values of headers in list whose name - // is a byte-case-insensitive match for name, in order. + socket + .on('drain', onDrain) + .on('error', onFinished) +} - // 2. For each value of values: - // 1. Append (name, value) to headers. - for (let j = 0; j < cookies.length; ++j) { - headers.push([name, cookies[j]]) - } - } else { - // 2. Otherwise: +async function writeBlob ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { + assert(contentLength === body.size, 'blob body must have content length') - // 1. Let value be the result of getting name from list. + const isH2 = client[kHTTPConnVersion] === 'h2' + try { + if (contentLength != null && contentLength !== body.size) { + throw new RequestContentLengthMismatchError() + } - // 2. Assert: value is non-null. - assert(value !== null) + const buffer = Buffer.from(await body.arrayBuffer()) - // 3. Append (name, value) to headers. - headers.push([name, value]) - } + if (isH2) { + h2stream.cork() + h2stream.write(buffer) + h2stream.uncork() + } else { + socket.cork() + socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') + socket.write(buffer) + socket.uncork() } - this[kHeadersList][kHeadersSortedMap] = headers + request.onBodySent(buffer) + request.onRequestSent() - // 4. Return headers. - return headers + if (!expectsPayload) { + socket[kReset] = true + } + + resume(client) + } catch (err) { + util.destroy(isH2 ? h2stream : socket, err) } +} - keys () { - webidl.brandCheck(this, Headers) +async function writeIterable ({ h2stream, body, client, request, socket, contentLength, header, expectsPayload }) { + assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined') - if (this[kGuard] === 'immutable') { - const value = this[kHeadersSortedMap] - return makeIterator(() => value, 'Headers', - 'key') + let callback = null + function onDrain () { + if (callback) { + const cb = callback + callback = null + cb() } - - return makeIterator( - () => [...this[kHeadersSortedMap].values()], - 'Headers', - 'key' - ) } - values () { - webidl.brandCheck(this, Headers) + const waitForDrain = () => new Promise((resolve, reject) => { + assert(callback === null) - if (this[kGuard] === 'immutable') { - const value = this[kHeadersSortedMap] - return makeIterator(() => value, 'Headers', - 'value') + if (socket[kError]) { + reject(socket[kError]) + } else { + callback = resolve } + }) - return makeIterator( - () => [...this[kHeadersSortedMap].values()], - 'Headers', - 'value' - ) - } + if (client[kHTTPConnVersion] === 'h2') { + h2stream + .on('close', onDrain) + .on('drain', onDrain) - entries () { - webidl.brandCheck(this, Headers) + try { + // It's up to the user to somehow abort the async iterable. + for await (const chunk of body) { + if (socket[kError]) { + throw socket[kError] + } - if (this[kGuard] === 'immutable') { - const value = this[kHeadersSortedMap] - return makeIterator(() => value, 'Headers', - 'key+value') + const res = h2stream.write(chunk) + request.onBodySent(chunk) + if (!res) { + await waitForDrain() + } + } + } catch (err) { + h2stream.destroy(err) + } finally { + request.onRequestSent() + h2stream.end() + h2stream + .off('close', onDrain) + .off('drain', onDrain) } - return makeIterator( - () => [...this[kHeadersSortedMap].values()], - 'Headers', - 'key+value' - ) + return } - /** - * @param {(value: string, key: string, self: Headers) => void} callbackFn - * @param {unknown} thisArg - */ - forEach (callbackFn, thisArg = globalThis) { - webidl.brandCheck(this, Headers) + socket + .on('close', onDrain) + .on('drain', onDrain) - webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.forEach' }) + const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header }) + try { + // It's up to the user to somehow abort the async iterable. + for await (const chunk of body) { + if (socket[kError]) { + throw socket[kError] + } - if (typeof callbackFn !== 'function') { - throw new TypeError( - "Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'." - ) + if (!writer.write(chunk)) { + await waitForDrain() + } } - for (const [key, value] of this) { - callbackFn.apply(thisArg, [value, key, this]) - } + writer.end() + } catch (err) { + writer.destroy(err) + } finally { + socket + .off('close', onDrain) + .off('drain', onDrain) } +} - [Symbol.for('nodejs.util.inspect.custom')] () { - webidl.brandCheck(this, Headers) +class AsyncWriter { + constructor ({ socket, request, contentLength, client, expectsPayload, header }) { + this.socket = socket + this.request = request + this.contentLength = contentLength + this.client = client + this.bytesWritten = 0 + this.expectsPayload = expectsPayload + this.header = header - return this[kHeadersList] + socket[kWriting] = true } -} -Headers.prototype[Symbol.iterator] = Headers.prototype.entries + write (chunk) { + const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this -Object.defineProperties(Headers.prototype, { - append: kEnumerableProperty, - delete: kEnumerableProperty, - get: kEnumerableProperty, - has: kEnumerableProperty, - set: kEnumerableProperty, - getSetCookie: kEnumerableProperty, - keys: kEnumerableProperty, - values: kEnumerableProperty, - entries: kEnumerableProperty, - forEach: kEnumerableProperty, - [Symbol.iterator]: { enumerable: false }, - [Symbol.toStringTag]: { - value: 'Headers', - configurable: true - }, - [util.inspect.custom]: { - enumerable: false - } -}) + if (socket[kError]) { + throw socket[kError] + } -webidl.converters.HeadersInit = function (V) { - if (webidl.util.Type(V) === 'Object') { - if (V[Symbol.iterator]) { - return webidl.converters['sequence>'](V) + if (socket.destroyed) { + return false } - return webidl.converters['record'](V) - } + const len = Buffer.byteLength(chunk) + if (!len) { + return true + } - throw webidl.errors.conversionFailed({ - prefix: 'Headers constructor', - argument: 'Argument 1', - types: ['sequence>', 'record'] - }) -} + // We should defer writing chunks. + if (contentLength !== null && bytesWritten + len > contentLength) { + if (client[kStrictContentLength]) { + throw new RequestContentLengthMismatchError() + } -module.exports = { - fill, - Headers, - HeadersList -} + process.emitWarning(new RequestContentLengthMismatchError()) + } + socket.cork() -/***/ }), + if (bytesWritten === 0) { + if (!expectsPayload) { + socket[kReset] = true + } -/***/ 74881: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (contentLength === null) { + socket.write(`${header}transfer-encoding: chunked\r\n`, 'latin1') + } else { + socket.write(`${header}content-length: ${contentLength}\r\n\r\n`, 'latin1') + } + } -"use strict"; -// https://github.com/Ethan-Arrowood/undici-fetch + if (contentLength === null) { + socket.write(`\r\n${len.toString(16)}\r\n`, 'latin1') + } + this.bytesWritten += len + const ret = socket.write(chunk) -const { - Response, - makeNetworkError, - makeAppropriateNetworkError, - filterResponse, - makeResponse -} = __nccwpck_require__(27823) -const { Headers } = __nccwpck_require__(10554) -const { Request, makeRequest } = __nccwpck_require__(48359) -const zlib = __nccwpck_require__(59796) -const { - bytesMatch, - makePolicyContainer, - clonePolicyContainer, - requestBadPort, - TAOCheck, - appendRequestOriginHeader, - responseLocationURL, - requestCurrentURL, - setRequestReferrerPolicyOnRedirect, - tryUpgradeRequestToAPotentiallyTrustworthyURL, - createOpaqueTimingInfo, - appendFetchMetadata, - corsCheck, - crossOriginResourcePolicyCheck, - determineRequestsReferrer, - coarsenedSharedCurrentTime, - createDeferredPromise, - isBlobLike, - sameOrigin, - isCancelled, - isAborted, - isErrorLike, - fullyReadBody, - readableStreamClose, - isomorphicEncode, - urlIsLocal, - urlIsHttpHttpsScheme, - urlHasHttpsScheme -} = __nccwpck_require__(52538) -const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(15861) -const assert = __nccwpck_require__(39491) -const { safelyExtractBody } = __nccwpck_require__(41472) -const { - redirectStatusSet, - nullBodyStatus, - safeMethodsSet, - requestBodyHeader, - subresourceSet, - DOMException -} = __nccwpck_require__(41037) -const { kHeadersList } = __nccwpck_require__(72785) -const EE = __nccwpck_require__(82361) -const { Readable, pipeline } = __nccwpck_require__(12781) -const { addAbortListener, isErrored, isReadable, nodeMajor, nodeMinor } = __nccwpck_require__(83983) -const { dataURLProcessor, serializeAMimeType } = __nccwpck_require__(685) -const { TransformStream } = __nccwpck_require__(35356) -const { getGlobalDispatcher } = __nccwpck_require__(21892) -const { webidl } = __nccwpck_require__(21744) -const { STATUS_CODES } = __nccwpck_require__(13685) -const GET_OR_HEAD = ['GET', 'HEAD'] + socket.uncork() -/** @type {import('buffer').resolveObjectURL} */ -let resolveObjectURL -let ReadableStream = globalThis.ReadableStream + request.onBodySent(chunk) -class Fetch extends EE { - constructor (dispatcher) { - super() + if (!ret) { + if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { + // istanbul ignore else: only for jest + if (socket[kParser].timeout.refresh) { + socket[kParser].timeout.refresh() + } + } + } - this.dispatcher = dispatcher - this.connection = null - this.dump = false - this.state = 'ongoing' - // 2 terminated listeners get added per request, - // but only 1 gets removed. If there are 20 redirects, - // 21 listeners will be added. - // See https://github.com/nodejs/undici/issues/1711 - // TODO (fix): Find and fix root cause for leaked listener. - this.setMaxListeners(21) + return ret } - terminate (reason) { - if (this.state !== 'ongoing') { - return - } + end () { + const { socket, contentLength, client, bytesWritten, expectsPayload, header, request } = this + request.onRequestSent() - this.state = 'terminated' - this.connection?.destroy(reason) - this.emit('terminated', reason) - } + socket[kWriting] = false - // https://fetch.spec.whatwg.org/#fetch-controller-abort - abort (error) { - if (this.state !== 'ongoing') { + if (socket[kError]) { + throw socket[kError] + } + + if (socket.destroyed) { return } - // 1. Set controller’s state to "aborted". - this.state = 'aborted' + if (bytesWritten === 0) { + if (expectsPayload) { + // https://tools.ietf.org/html/rfc7230#section-3.3.2 + // A user agent SHOULD send a Content-Length in a request message when + // no Transfer-Encoding is sent and the request method defines a meaning + // for an enclosed payload body. - // 2. Let fallbackError be an "AbortError" DOMException. - // 3. Set error to fallbackError if it is not given. - if (!error) { - error = new DOMException('The operation was aborted.', 'AbortError') + socket.write(`${header}content-length: 0\r\n\r\n`, 'latin1') + } else { + socket.write(`${header}\r\n`, 'latin1') + } + } else if (contentLength === null) { + socket.write('\r\n0\r\n\r\n', 'latin1') } - // 4. Let serializedError be StructuredSerialize(error). - // If that threw an exception, catch it, and let - // serializedError be StructuredSerialize(fallbackError). + if (contentLength !== null && bytesWritten !== contentLength) { + if (client[kStrictContentLength]) { + throw new RequestContentLengthMismatchError() + } else { + process.emitWarning(new RequestContentLengthMismatchError()) + } + } - // 5. Set controller’s serialized abort reason to serializedError. - this.serializedAbortReason = error + if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) { + // istanbul ignore else: only for jest + if (socket[kParser].timeout.refresh) { + socket[kParser].timeout.refresh() + } + } - this.connection?.destroy(error) - this.emit('terminated', error) + resume(client) } -} -// https://fetch.spec.whatwg.org/#fetch-method -function fetch (input, init = {}) { - webidl.argumentLengthCheck(arguments, 1, { header: 'globalThis.fetch' }) + destroy (err) { + const { socket, client } = this - // 1. Let p be a new promise. - const p = createDeferredPromise() + socket[kWriting] = false - // 2. Let requestObject be the result of invoking the initial value of - // Request as constructor with input and init as arguments. If this throws - // an exception, reject p with it and return p. - let requestObject + if (err) { + assert(client[kRunning] <= 1, 'pipeline should only contain this request') + util.destroy(socket, err) + } + } +} +function errorRequest (client, request, err) { try { - requestObject = new Request(input, init) - } catch (e) { - p.reject(e) - return p.promise + request.onError(err) + assert(request.aborted) + } catch (err) { + client.emit('error', err) } +} - // 3. Let request be requestObject’s request. - const request = requestObject[kState] +module.exports = Client - // 4. If requestObject’s signal’s aborted flag is set, then: - if (requestObject.signal.aborted) { - // 1. Abort the fetch() call with p, request, null, and - // requestObject’s signal’s abort reason. - abortFetch(p, request, null, requestObject.signal.reason) - // 2. Return p. - return p.promise - } +/***/ }), - // 5. Let globalObject be request’s client’s global object. - const globalObject = request.client.globalObject +/***/ 56436: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 6. If globalObject is a ServiceWorkerGlobalScope object, then set - // request’s service-workers mode to "none". - if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') { - request.serviceWorkers = 'none' - } +"use strict"; - // 7. Let responseObject be null. - let responseObject = null - // 8. Let relevantRealm be this’s relevant Realm. - const relevantRealm = null +/* istanbul ignore file: only for Node 12 */ - // 9. Let locallyAborted be false. - let locallyAborted = false +const { kConnected, kSize } = __nccwpck_require__(72785) - // 10. Let controller be null. - let controller = null +class CompatWeakRef { + constructor (value) { + this.value = value + } - // 11. Add the following abort steps to requestObject’s signal: - addAbortListener( - requestObject.signal, - () => { - // 1. Set locallyAborted to true. - locallyAborted = true + deref () { + return this.value[kConnected] === 0 && this.value[kSize] === 0 + ? undefined + : this.value + } +} - // 2. Assert: controller is non-null. - assert(controller != null) +class CompatFinalizer { + constructor (finalizer) { + this.finalizer = finalizer + } - // 3. Abort controller with requestObject’s signal’s abort reason. - controller.abort(requestObject.signal.reason) + register (dispatcher, key) { + if (dispatcher.on) { + dispatcher.on('disconnect', () => { + if (dispatcher[kConnected] === 0 && dispatcher[kSize] === 0) { + this.finalizer(key) + } + }) + } + } +} - // 4. Abort the fetch() call with p, request, responseObject, - // and requestObject’s signal’s abort reason. - abortFetch(p, request, responseObject, requestObject.signal.reason) +module.exports = function () { + // FIXME: remove workaround when the Node bug is fixed + // https://github.com/nodejs/node/issues/49344#issuecomment-1741776308 + if (process.env.NODE_V8_COVERAGE) { + return { + WeakRef: CompatWeakRef, + FinalizationRegistry: CompatFinalizer } - ) + } + return { + WeakRef: global.WeakRef || CompatWeakRef, + FinalizationRegistry: global.FinalizationRegistry || CompatFinalizer + } +} - // 12. Let handleFetchDone given response response be to finalize and - // report timing with response, globalObject, and "fetch". - const handleFetchDone = (response) => - finalizeAndReportTiming(response, 'fetch') - // 13. Set controller to the result of calling fetch given request, - // with processResponseEndOfBody set to handleFetchDone, and processResponse - // given response being these substeps: +/***/ }), - const processResponse = (response) => { - // 1. If locallyAborted is true, terminate these substeps. - if (locallyAborted) { - return Promise.resolve() - } +/***/ 20663: +/***/ ((module) => { - // 2. If response’s aborted flag is set, then: - if (response.aborted) { - // 1. Let deserializedError be the result of deserialize a serialized - // abort reason given controller’s serialized abort reason and - // relevantRealm. +"use strict"; - // 2. Abort the fetch() call with p, request, responseObject, and - // deserializedError. - abortFetch(p, request, responseObject, controller.serializedAbortReason) - return Promise.resolve() - } +// https://wicg.github.io/cookie-store/#cookie-maximum-attribute-value-size +const maxAttributeValueSize = 1024 - // 3. If response is a network error, then reject p with a TypeError - // and terminate these substeps. - if (response.type === 'error') { - p.reject( - Object.assign(new TypeError('fetch failed'), { cause: response.error }) - ) - return Promise.resolve() - } +// https://wicg.github.io/cookie-store/#cookie-maximum-name-value-pair-size +const maxNameValuePairSize = 4096 - // 4. Set responseObject to the result of creating a Response object, - // given response, "immutable", and relevantRealm. - responseObject = new Response() - responseObject[kState] = response - responseObject[kRealm] = relevantRealm - responseObject[kHeaders][kHeadersList] = response.headersList - responseObject[kHeaders][kGuard] = 'immutable' - responseObject[kHeaders][kRealm] = relevantRealm +module.exports = { + maxAttributeValueSize, + maxNameValuePairSize +} - // 5. Resolve p with responseObject. - p.resolve(responseObject) - } - controller = fetching({ - request, - processResponseEndOfBody: handleFetchDone, - processResponse, - dispatcher: init.dispatcher ?? getGlobalDispatcher() // undici - }) +/***/ }), - // 14. Return p. - return p.promise -} +/***/ 41724: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// https://fetch.spec.whatwg.org/#finalize-and-report-timing -function finalizeAndReportTiming (response, initiatorType = 'other') { - // 1. If response is an aborted network error, then return. - if (response.type === 'error' && response.aborted) { - return - } +"use strict"; - // 2. If response’s URL list is null or empty, then return. - if (!response.urlList?.length) { - return - } - // 3. Let originalURL be response’s URL list[0]. - const originalURL = response.urlList[0] +const { parseSetCookie } = __nccwpck_require__(24408) +const { stringify } = __nccwpck_require__(43121) +const { webidl } = __nccwpck_require__(21744) +const { Headers } = __nccwpck_require__(10554) - // 4. Let timingInfo be response’s timing info. - let timingInfo = response.timingInfo +/** + * @typedef {Object} Cookie + * @property {string} name + * @property {string} value + * @property {Date|number|undefined} expires + * @property {number|undefined} maxAge + * @property {string|undefined} domain + * @property {string|undefined} path + * @property {boolean|undefined} secure + * @property {boolean|undefined} httpOnly + * @property {'Strict'|'Lax'|'None'} sameSite + * @property {string[]} unparsed + */ - // 5. Let cacheState be response’s cache state. - let cacheState = response.cacheState +/** + * @param {Headers} headers + * @returns {Record} + */ +function getCookies (headers) { + webidl.argumentLengthCheck(arguments, 1, { header: 'getCookies' }) - // 6. If originalURL’s scheme is not an HTTP(S) scheme, then return. - if (!urlIsHttpHttpsScheme(originalURL)) { - return - } + webidl.brandCheck(headers, Headers, { strict: false }) - // 7. If timingInfo is null, then return. - if (timingInfo === null) { - return + const cookie = headers.get('cookie') + const out = {} + + if (!cookie) { + return out } - // 8. If response’s timing allow passed flag is not set, then: - if (!response.timingAllowPassed) { - // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo. - timingInfo = createOpaqueTimingInfo({ - startTime: timingInfo.startTime - }) + for (const piece of cookie.split(';')) { + const [name, ...value] = piece.split('=') - // 2. Set cacheState to the empty string. - cacheState = '' + out[name.trim()] = value.join('=') } - // 9. Set timingInfo’s end time to the coarsened shared current time - // given global’s relevant settings object’s cross-origin isolated - // capability. - // TODO: given global’s relevant settings object’s cross-origin isolated - // capability? - timingInfo.endTime = coarsenedSharedCurrentTime() + return out +} - // 10. Set response’s timing info to timingInfo. - response.timingInfo = timingInfo +/** + * @param {Headers} headers + * @param {string} name + * @param {{ path?: string, domain?: string }|undefined} attributes + * @returns {void} + */ +function deleteCookie (headers, name, attributes) { + webidl.argumentLengthCheck(arguments, 2, { header: 'deleteCookie' }) - // 11. Mark resource timing for timingInfo, originalURL, initiatorType, - // global, and cacheState. - markResourceTiming( - timingInfo, - originalURL, - initiatorType, - globalThis, - cacheState - ) -} + webidl.brandCheck(headers, Headers, { strict: false }) -// https://w3c.github.io/resource-timing/#dfn-mark-resource-timing -function markResourceTiming (timingInfo, originalURL, initiatorType, globalThis, cacheState) { - if (nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 2)) { - performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis, cacheState) - } + name = webidl.converters.DOMString(name) + attributes = webidl.converters.DeleteCookieAttributes(attributes) + + // Matches behavior of + // https://github.com/denoland/deno_std/blob/63827b16330b82489a04614027c33b7904e08be5/http/cookie.ts#L278 + setCookie(headers, { + name, + value: '', + expires: new Date(0), + ...attributes + }) } -// https://fetch.spec.whatwg.org/#abort-fetch -function abortFetch (p, request, responseObject, error) { - // Note: AbortSignal.reason was added in node v17.2.0 - // which would give us an undefined error to reject with. - // Remove this once node v16 is no longer supported. - if (!error) { - error = new DOMException('The operation was aborted.', 'AbortError') - } +/** + * @param {Headers} headers + * @returns {Cookie[]} + */ +function getSetCookies (headers) { + webidl.argumentLengthCheck(arguments, 1, { header: 'getSetCookies' }) - // 1. Reject promise with error. - p.reject(error) + webidl.brandCheck(headers, Headers, { strict: false }) - // 2. If request’s body is not null and is readable, then cancel request’s - // body with error. - if (request.body != null && isReadable(request.body?.stream)) { - request.body.stream.cancel(error).catch((err) => { - if (err.code === 'ERR_INVALID_STATE') { - // Node bug? - return - } - throw err - }) - } + const cookies = headers.getSetCookie() - // 3. If responseObject is null, then return. - if (responseObject == null) { - return + if (!cookies) { + return [] } - // 4. Let response be responseObject’s response. - const response = responseObject[kState] - - // 5. If response’s body is not null and is readable, then error response’s - // body with error. - if (response.body != null && isReadable(response.body?.stream)) { - response.body.stream.cancel(error).catch((err) => { - if (err.code === 'ERR_INVALID_STATE') { - // Node bug? - return - } - throw err - }) - } + return cookies.map((pair) => parseSetCookie(pair)) } -// https://fetch.spec.whatwg.org/#fetching -function fetching ({ - request, - processRequestBodyChunkLength, - processRequestEndOfBody, - processResponse, - processResponseEndOfBody, - processResponseConsumeBody, - useParallelQueue = false, - dispatcher // undici -}) { - // 1. Let taskDestination be null. - let taskDestination = null +/** + * @param {Headers} headers + * @param {Cookie} cookie + * @returns {void} + */ +function setCookie (headers, cookie) { + webidl.argumentLengthCheck(arguments, 2, { header: 'setCookie' }) - // 2. Let crossOriginIsolatedCapability be false. - let crossOriginIsolatedCapability = false + webidl.brandCheck(headers, Headers, { strict: false }) - // 3. If request’s client is non-null, then: - if (request.client != null) { - // 1. Set taskDestination to request’s client’s global object. - taskDestination = request.client.globalObject + cookie = webidl.converters.Cookie(cookie) - // 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin - // isolated capability. - crossOriginIsolatedCapability = - request.client.crossOriginIsolatedCapability - } - - // 4. If useParallelQueue is true, then set taskDestination to the result of - // starting a new parallel queue. - // TODO - - // 5. Let timingInfo be a new fetch timing info whose start time and - // post-redirect start time are the coarsened shared current time given - // crossOriginIsolatedCapability. - const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability) - const timingInfo = createOpaqueTimingInfo({ - startTime: currenTime - }) + const str = stringify(cookie) - // 6. Let fetchParams be a new fetch params whose - // request is request, - // timing info is timingInfo, - // process request body chunk length is processRequestBodyChunkLength, - // process request end-of-body is processRequestEndOfBody, - // process response is processResponse, - // process response consume body is processResponseConsumeBody, - // process response end-of-body is processResponseEndOfBody, - // task destination is taskDestination, - // and cross-origin isolated capability is crossOriginIsolatedCapability. - const fetchParams = { - controller: new Fetch(dispatcher), - request, - timingInfo, - processRequestBodyChunkLength, - processRequestEndOfBody, - processResponse, - processResponseConsumeBody, - processResponseEndOfBody, - taskDestination, - crossOriginIsolatedCapability + if (str) { + headers.append('Set-Cookie', stringify(cookie)) } +} - // 7. If request’s body is a byte sequence, then set request’s body to - // request’s body as a body. - // NOTE: Since fetching is only called from fetch, body should already be - // extracted. - assert(!request.body || request.body.stream) - - // 8. If request’s window is "client", then set request’s window to request’s - // client, if request’s client’s global object is a Window object; otherwise - // "no-window". - if (request.window === 'client') { - // TODO: What if request.client is null? - request.window = - request.client?.globalObject?.constructor?.name === 'Window' - ? request.client - : 'no-window' +webidl.converters.DeleteCookieAttributes = webidl.dictionaryConverter([ + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'path', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'domain', + defaultValue: null } +]) - // 9. If request’s origin is "client", then set request’s origin to request’s - // client’s origin. - if (request.origin === 'client') { - // TODO: What if request.client is null? - request.origin = request.client?.origin +webidl.converters.Cookie = webidl.dictionaryConverter([ + { + converter: webidl.converters.DOMString, + key: 'name' + }, + { + converter: webidl.converters.DOMString, + key: 'value' + }, + { + converter: webidl.nullableConverter((value) => { + if (typeof value === 'number') { + return webidl.converters['unsigned long long'](value) + } + + return new Date(value) + }), + key: 'expires', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters['long long']), + key: 'maxAge', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'domain', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.DOMString), + key: 'path', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.boolean), + key: 'secure', + defaultValue: null + }, + { + converter: webidl.nullableConverter(webidl.converters.boolean), + key: 'httpOnly', + defaultValue: null + }, + { + converter: webidl.converters.USVString, + key: 'sameSite', + allowedValues: ['Strict', 'Lax', 'None'] + }, + { + converter: webidl.sequenceConverter(webidl.converters.DOMString), + key: 'unparsed', + defaultValue: [] } +]) - // 10. If all of the following conditions are true: - // TODO +module.exports = { + getCookies, + deleteCookie, + getSetCookies, + setCookie +} - // 11. If request’s policy container is "client", then: - if (request.policyContainer === 'client') { - // 1. If request’s client is non-null, then set request’s policy - // container to a clone of request’s client’s policy container. [HTML] - if (request.client != null) { - request.policyContainer = clonePolicyContainer( - request.client.policyContainer - ) - } else { - // 2. Otherwise, set request’s policy container to a new policy - // container. - request.policyContainer = makePolicyContainer() - } - } - // 12. If request’s header list does not contain `Accept`, then: - if (!request.headersList.contains('accept')) { - // 1. Let value be `*/*`. - const value = '*/*' +/***/ }), - // 2. A user agent should set value to the first matching statement, if - // any, switching on request’s destination: - // "document" - // "frame" - // "iframe" - // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` - // "image" - // `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5` - // "style" - // `text/css,*/*;q=0.1` - // TODO +/***/ 24408: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 3. Append `Accept`/value to request’s header list. - request.headersList.append('accept', value) - } +"use strict"; - // 13. If request’s header list does not contain `Accept-Language`, then - // user agents should append `Accept-Language`/an appropriate value to - // request’s header list. - if (!request.headersList.contains('accept-language')) { - request.headersList.append('accept-language', '*') - } - // 14. If request’s priority is null, then use request’s initiator and - // destination appropriately in setting request’s priority to a - // user-agent-defined object. - if (request.priority === null) { - // TODO - } +const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(20663) +const { isCTLExcludingHtab } = __nccwpck_require__(43121) +const { collectASequenceOfCodePointsFast } = __nccwpck_require__(685) +const assert = __nccwpck_require__(39491) - // 15. If request is a subresource request, then: - if (subresourceSet.has(request.destination)) { - // TODO +/** + * @description Parses the field-value attributes of a set-cookie header string. + * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4 + * @param {string} header + * @returns if the header is invalid, null will be returned + */ +function parseSetCookie (header) { + // 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F + // character (CTL characters excluding HTAB): Abort these steps and + // ignore the set-cookie-string entirely. + if (isCTLExcludingHtab(header)) { + return null } - // 16. Run main fetch given fetchParams. - mainFetch(fetchParams) - .catch(err => { - fetchParams.controller.terminate(err) - }) - - // 17. Return fetchParam's controller - return fetchParams.controller -} + let nameValuePair = '' + let unparsedAttributes = '' + let name = '' + let value = '' -// https://fetch.spec.whatwg.org/#concept-main-fetch -async function mainFetch (fetchParams, recursive = false) { - // 1. Let request be fetchParams’s request. - const request = fetchParams.request + // 2. If the set-cookie-string contains a %x3B (";") character: + if (header.includes(';')) { + // 1. The name-value-pair string consists of the characters up to, + // but not including, the first %x3B (";"), and the unparsed- + // attributes consist of the remainder of the set-cookie-string + // (including the %x3B (";") in question). + const position = { position: 0 } - // 2. Let response be null. - let response = null + nameValuePair = collectASequenceOfCodePointsFast(';', header, position) + unparsedAttributes = header.slice(position.position) + } else { + // Otherwise: - // 3. If request’s local-URLs-only flag is set and request’s current URL is - // not local, then set response to a network error. - if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) { - response = makeNetworkError('local URLs only') + // 1. The name-value-pair string consists of all the characters + // contained in the set-cookie-string, and the unparsed- + // attributes is the empty string. + nameValuePair = header } - // 4. Run report Content Security Policy violations for request. - // TODO + // 3. If the name-value-pair string lacks a %x3D ("=") character, then + // the name string is empty, and the value string is the value of + // name-value-pair. + if (!nameValuePair.includes('=')) { + value = nameValuePair + } else { + // Otherwise, the name string consists of the characters up to, but + // not including, the first %x3D ("=") character, and the (possibly + // empty) value string consists of the characters after the first + // %x3D ("=") character. + const position = { position: 0 } + name = collectASequenceOfCodePointsFast( + '=', + nameValuePair, + position + ) + value = nameValuePair.slice(position.position + 1) + } - // 5. Upgrade request to a potentially trustworthy URL, if appropriate. - tryUpgradeRequestToAPotentiallyTrustworthyURL(request) + // 4. Remove any leading or trailing WSP characters from the name + // string and the value string. + name = name.trim() + value = value.trim() - // 6. If should request be blocked due to a bad port, should fetching request - // be blocked as mixed content, or should request be blocked by Content - // Security Policy returns blocked, then set response to a network error. - if (requestBadPort(request) === 'blocked') { - response = makeNetworkError('bad port') + // 5. If the sum of the lengths of the name string and the value string + // is more than 4096 octets, abort these steps and ignore the set- + // cookie-string entirely. + if (name.length + value.length > maxNameValuePairSize) { + return null } - // TODO: should fetching request be blocked as mixed content? - // TODO: should request be blocked by Content Security Policy? - // 7. If request’s referrer policy is the empty string, then set request’s - // referrer policy to request’s policy container’s referrer policy. - if (request.referrerPolicy === '') { - request.referrerPolicy = request.policyContainer.referrerPolicy + // 6. The cookie-name is the name string, and the cookie-value is the + // value string. + return { + name, value, ...parseUnparsedAttributes(unparsedAttributes) } +} - // 8. If request’s referrer is not "no-referrer", then set request’s - // referrer to the result of invoking determine request’s referrer. - if (request.referrer !== 'no-referrer') { - request.referrer = determineRequestsReferrer(request) +/** + * Parses the remaining attributes of a set-cookie header + * @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4 + * @param {string} unparsedAttributes + * @param {[Object.]={}} cookieAttributeList + */ +function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {}) { + // 1. If the unparsed-attributes string is empty, skip the rest of + // these steps. + if (unparsedAttributes.length === 0) { + return cookieAttributeList } - // 9. Set request’s current URL’s scheme to "https" if all of the following - // conditions are true: - // - request’s current URL’s scheme is "http" - // - request’s current URL’s host is a domain - // - Matching request’s current URL’s host per Known HSTS Host Domain Name - // Matching results in either a superdomain match with an asserted - // includeSubDomains directive or a congruent match (with or without an - // asserted includeSubDomains directive). [HSTS] - // TODO + // 2. Discard the first character of the unparsed-attributes (which + // will be a %x3B (";") character). + assert(unparsedAttributes[0] === ';') + unparsedAttributes = unparsedAttributes.slice(1) - // 10. If recursive is false, then run the remaining steps in parallel. - // TODO + let cookieAv = '' - // 11. If response is null, then set response to the result of running - // the steps corresponding to the first matching statement: - if (response === null) { - response = await (async () => { - const currentURL = requestCurrentURL(request) + // 3. If the remaining unparsed-attributes contains a %x3B (";") + // character: + if (unparsedAttributes.includes(';')) { + // 1. Consume the characters of the unparsed-attributes up to, but + // not including, the first %x3B (";") character. + cookieAv = collectASequenceOfCodePointsFast( + ';', + unparsedAttributes, + { position: 0 } + ) + unparsedAttributes = unparsedAttributes.slice(cookieAv.length) + } else { + // Otherwise: - if ( - // - request’s current URL’s origin is same origin with request’s origin, - // and request’s response tainting is "basic" - (sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') || - // request’s current URL’s scheme is "data" - (currentURL.protocol === 'data:') || - // - request’s mode is "navigate" or "websocket" - (request.mode === 'navigate' || request.mode === 'websocket') - ) { - // 1. Set request’s response tainting to "basic". - request.responseTainting = 'basic' + // 1. Consume the remainder of the unparsed-attributes. + cookieAv = unparsedAttributes + unparsedAttributes = '' + } - // 2. Return the result of running scheme fetch given fetchParams. - return await schemeFetch(fetchParams) - } + // Let the cookie-av string be the characters consumed in this step. - // request’s mode is "same-origin" - if (request.mode === 'same-origin') { - // 1. Return a network error. - return makeNetworkError('request mode cannot be "same-origin"') - } + let attributeName = '' + let attributeValue = '' - // request’s mode is "no-cors" - if (request.mode === 'no-cors') { - // 1. If request’s redirect mode is not "follow", then return a network - // error. - if (request.redirect !== 'follow') { - return makeNetworkError( - 'redirect mode cannot be "follow" for "no-cors" request' - ) - } + // 4. If the cookie-av string contains a %x3D ("=") character: + if (cookieAv.includes('=')) { + // 1. The (possibly empty) attribute-name string consists of the + // characters up to, but not including, the first %x3D ("=") + // character, and the (possibly empty) attribute-value string + // consists of the characters after the first %x3D ("=") + // character. + const position = { position: 0 } - // 2. Set request’s response tainting to "opaque". - request.responseTainting = 'opaque' + attributeName = collectASequenceOfCodePointsFast( + '=', + cookieAv, + position + ) + attributeValue = cookieAv.slice(position.position + 1) + } else { + // Otherwise: - // 3. Return the result of running scheme fetch given fetchParams. - return await schemeFetch(fetchParams) - } + // 1. The attribute-name string consists of the entire cookie-av + // string, and the attribute-value string is empty. + attributeName = cookieAv + } - // request’s current URL’s scheme is not an HTTP(S) scheme - if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) { - // Return a network error. - return makeNetworkError('URL scheme must be a HTTP(S) scheme') - } + // 5. Remove any leading or trailing WSP characters from the attribute- + // name string and the attribute-value string. + attributeName = attributeName.trim() + attributeValue = attributeValue.trim() - // - request’s use-CORS-preflight flag is set - // - request’s unsafe-request flag is set and either request’s method is - // not a CORS-safelisted method or CORS-unsafe request-header names with - // request’s header list is not empty - // 1. Set request’s response tainting to "cors". - // 2. Let corsWithPreflightResponse be the result of running HTTP fetch - // given fetchParams and true. - // 3. If corsWithPreflightResponse is a network error, then clear cache - // entries using request. - // 4. Return corsWithPreflightResponse. - // TODO + // 6. If the attribute-value is longer than 1024 octets, ignore the + // cookie-av string and return to Step 1 of this algorithm. + if (attributeValue.length > maxAttributeValueSize) { + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) + } - // Otherwise - // 1. Set request’s response tainting to "cors". - request.responseTainting = 'cors' + // 7. Process the attribute-name and attribute-value according to the + // requirements in the following subsections. (Notice that + // attributes with unrecognized attribute-names are ignored.) + const attributeNameLowercase = attributeName.toLowerCase() - // 2. Return the result of running HTTP fetch given fetchParams. - return await httpFetch(fetchParams) - })() - } + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.1 + // If the attribute-name case-insensitively matches the string + // "Expires", the user agent MUST process the cookie-av as follows. + if (attributeNameLowercase === 'expires') { + // 1. Let the expiry-time be the result of parsing the attribute-value + // as cookie-date (see Section 5.1.1). + const expiryTime = new Date(attributeValue) - // 12. If recursive is true, then return response. - if (recursive) { - return response - } + // 2. If the attribute-value failed to parse as a cookie date, ignore + // the cookie-av. - // 13. If response is not a network error and response is not a filtered - // response, then: - if (response.status !== 0 && !response.internalResponse) { - // If request’s response tainting is "cors", then: - if (request.responseTainting === 'cors') { - // 1. Let headerNames be the result of extracting header list values - // given `Access-Control-Expose-Headers` and response’s header list. - // TODO - // 2. If request’s credentials mode is not "include" and headerNames - // contains `*`, then set response’s CORS-exposed header-name list to - // all unique header names in response’s header list. - // TODO - // 3. Otherwise, if headerNames is not null or failure, then set - // response’s CORS-exposed header-name list to headerNames. - // TODO - } + cookieAttributeList.expires = expiryTime + } else if (attributeNameLowercase === 'max-age') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.2 + // If the attribute-name case-insensitively matches the string "Max- + // Age", the user agent MUST process the cookie-av as follows. - // Set response to the following filtered response with response as its - // internal response, depending on request’s response tainting: - if (request.responseTainting === 'basic') { - response = filterResponse(response, 'basic') - } else if (request.responseTainting === 'cors') { - response = filterResponse(response, 'cors') - } else if (request.responseTainting === 'opaque') { - response = filterResponse(response, 'opaque') - } else { - assert(false) + // 1. If the first character of the attribute-value is not a DIGIT or a + // "-" character, ignore the cookie-av. + const charCode = attributeValue.charCodeAt(0) + + if ((charCode < 48 || charCode > 57) && attributeValue[0] !== '-') { + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) } - } - // 14. Let internalResponse be response, if response is a network error, - // and response’s internal response otherwise. - let internalResponse = - response.status === 0 ? response : response.internalResponse + // 2. If the remainder of attribute-value contains a non-DIGIT + // character, ignore the cookie-av. + if (!/^\d+$/.test(attributeValue)) { + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) + } - // 15. If internalResponse’s URL list is empty, then set it to a clone of - // request’s URL list. - if (internalResponse.urlList.length === 0) { - internalResponse.urlList.push(...request.urlList) - } + // 3. Let delta-seconds be the attribute-value converted to an integer. + const deltaSeconds = Number(attributeValue) - // 16. If request’s timing allow failed flag is unset, then set - // internalResponse’s timing allow passed flag. - if (!request.timingAllowFailed) { - response.timingAllowPassed = true - } + // 4. Let cookie-age-limit be the maximum age of the cookie (which + // SHOULD be 400 days or less, see Section 4.1.2.2). - // 17. If response is not a network error and any of the following returns - // blocked - // - should internalResponse to request be blocked as mixed content - // - should internalResponse to request be blocked by Content Security Policy - // - should internalResponse to request be blocked due to its MIME type - // - should internalResponse to request be blocked due to nosniff - // TODO + // 5. Set delta-seconds to the smaller of its present value and cookie- + // age-limit. + // deltaSeconds = Math.min(deltaSeconds * 1000, maxExpiresMs) - // 18. If response’s type is "opaque", internalResponse’s status is 206, - // internalResponse’s range-requested flag is set, and request’s header - // list does not contain `Range`, then set response and internalResponse - // to a network error. - if ( - response.type === 'opaque' && - internalResponse.status === 206 && - internalResponse.rangeRequested && - !request.headers.contains('range') - ) { - response = internalResponse = makeNetworkError() - } + // 6. If delta-seconds is less than or equal to zero (0), let expiry- + // time be the earliest representable date and time. Otherwise, let + // the expiry-time be the current date and time plus delta-seconds + // seconds. + // const expiryTime = deltaSeconds <= 0 ? Date.now() : Date.now() + deltaSeconds - // 19. If response is not a network error and either request’s method is - // `HEAD` or `CONNECT`, or internalResponse’s status is a null body status, - // set internalResponse’s body to null and disregard any enqueuing toward - // it (if any). - if ( - response.status !== 0 && - (request.method === 'HEAD' || - request.method === 'CONNECT' || - nullBodyStatus.includes(internalResponse.status)) - ) { - internalResponse.body = null - fetchParams.controller.dump = true - } + // 7. Append an attribute to the cookie-attribute-list with an + // attribute-name of Max-Age and an attribute-value of expiry-time. + cookieAttributeList.maxAge = deltaSeconds + } else if (attributeNameLowercase === 'domain') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.3 + // If the attribute-name case-insensitively matches the string "Domain", + // the user agent MUST process the cookie-av as follows. - // 20. If request’s integrity metadata is not the empty string, then: - if (request.integrity) { - // 1. Let processBodyError be this step: run fetch finale given fetchParams - // and a network error. - const processBodyError = (reason) => - fetchFinale(fetchParams, makeNetworkError(reason)) + // 1. Let cookie-domain be the attribute-value. + let cookieDomain = attributeValue - // 2. If request’s response tainting is "opaque", or response’s body is null, - // then run processBodyError and abort these steps. - if (request.responseTainting === 'opaque' || response.body == null) { - processBodyError(response.error) - return + // 2. If cookie-domain starts with %x2E ("."), let cookie-domain be + // cookie-domain without its leading %x2E ("."). + if (cookieDomain[0] === '.') { + cookieDomain = cookieDomain.slice(1) } - // 3. Let processBody given bytes be these steps: - const processBody = (bytes) => { - // 1. If bytes do not match request’s integrity metadata, - // then run processBodyError and abort these steps. [SRI] - if (!bytesMatch(bytes, request.integrity)) { - processBodyError('integrity mismatch') - return - } + // 3. Convert the cookie-domain to lower case. + cookieDomain = cookieDomain.toLowerCase() - // 2. Set response’s body to bytes as a body. - response.body = safelyExtractBody(bytes)[0] + // 4. Append an attribute to the cookie-attribute-list with an + // attribute-name of Domain and an attribute-value of cookie-domain. + cookieAttributeList.domain = cookieDomain + } else if (attributeNameLowercase === 'path') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.4 + // If the attribute-name case-insensitively matches the string "Path", + // the user agent MUST process the cookie-av as follows. - // 3. Run fetch finale given fetchParams and response. - fetchFinale(fetchParams, response) - } + // 1. If the attribute-value is empty or if the first character of the + // attribute-value is not %x2F ("/"): + let cookiePath = '' + if (attributeValue.length === 0 || attributeValue[0] !== '/') { + // 1. Let cookie-path be the default-path. + cookiePath = '/' + } else { + // Otherwise: - // 4. Fully read response’s body given processBody and processBodyError. - await fullyReadBody(response.body, processBody, processBodyError) - } else { - // 21. Otherwise, run fetch finale given fetchParams and response. - fetchFinale(fetchParams, response) - } -} + // 1. Let cookie-path be the attribute-value. + cookiePath = attributeValue + } -// https://fetch.spec.whatwg.org/#concept-scheme-fetch -// given a fetch params fetchParams -function schemeFetch (fetchParams) { - // Note: since the connection is destroyed on redirect, which sets fetchParams to a - // cancelled state, we do not want this condition to trigger *unless* there have been - // no redirects. See https://github.com/nodejs/undici/issues/1776 - // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams. - if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { - return Promise.resolve(makeAppropriateNetworkError(fetchParams)) - } + // 2. Append an attribute to the cookie-attribute-list with an + // attribute-name of Path and an attribute-value of cookie-path. + cookieAttributeList.path = cookiePath + } else if (attributeNameLowercase === 'secure') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.5 + // If the attribute-name case-insensitively matches the string "Secure", + // the user agent MUST append an attribute to the cookie-attribute-list + // with an attribute-name of Secure and an empty attribute-value. - // 2. Let request be fetchParams’s request. - const { request } = fetchParams + cookieAttributeList.secure = true + } else if (attributeNameLowercase === 'httponly') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.6 + // If the attribute-name case-insensitively matches the string + // "HttpOnly", the user agent MUST append an attribute to the cookie- + // attribute-list with an attribute-name of HttpOnly and an empty + // attribute-value. - const { protocol: scheme } = requestCurrentURL(request) + cookieAttributeList.httpOnly = true + } else if (attributeNameLowercase === 'samesite') { + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.7 + // If the attribute-name case-insensitively matches the string + // "SameSite", the user agent MUST process the cookie-av as follows: - // 3. Switch on request’s current URL’s scheme and run the associated steps: - switch (scheme) { - case 'about:': { - // If request’s current URL’s path is the string "blank", then return a new response - // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) », - // and body is the empty byte sequence as a body. + // 1. Let enforcement be "Default". + let enforcement = 'Default' - // Otherwise, return a network error. - return Promise.resolve(makeNetworkError('about scheme is not supported')) + const attributeValueLowercase = attributeValue.toLowerCase() + // 2. If cookie-av's attribute-value is a case-insensitive match for + // "None", set enforcement to "None". + if (attributeValueLowercase.includes('none')) { + enforcement = 'None' } - case 'blob:': { - if (!resolveObjectURL) { - resolveObjectURL = (__nccwpck_require__(14300).resolveObjectURL) - } - - // 1. Let blobURLEntry be request’s current URL’s blob URL entry. - const blobURLEntry = requestCurrentURL(request) - // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56 - // Buffer.resolveObjectURL does not ignore URL queries. - if (blobURLEntry.search.length !== 0) { - return Promise.resolve(makeNetworkError('NetworkError when attempting to fetch resource.')) - } + // 3. If cookie-av's attribute-value is a case-insensitive match for + // "Strict", set enforcement to "Strict". + if (attributeValueLowercase.includes('strict')) { + enforcement = 'Strict' + } - const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()) + // 4. If cookie-av's attribute-value is a case-insensitive match for + // "Lax", set enforcement to "Lax". + if (attributeValueLowercase.includes('lax')) { + enforcement = 'Lax' + } - // 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s - // object is not a Blob object, then return a network error. - if (request.method !== 'GET' || !isBlobLike(blobURLEntryObject)) { - return Promise.resolve(makeNetworkError('invalid method')) - } + // 5. Append an attribute to the cookie-attribute-list with an + // attribute-name of "SameSite" and an attribute-value of + // enforcement. + cookieAttributeList.sameSite = enforcement + } else { + cookieAttributeList.unparsed ??= [] - // 3. Let bodyWithType be the result of safely extracting blobURLEntry’s object. - const bodyWithType = safelyExtractBody(blobURLEntryObject) + cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`) + } - // 4. Let body be bodyWithType’s body. - const body = bodyWithType[0] + // 8. Return to Step 1 of this algorithm. + return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList) +} - // 5. Let length be body’s length, serialized and isomorphic encoded. - const length = isomorphicEncode(`${body.length}`) +module.exports = { + parseSetCookie, + parseUnparsedAttributes +} - // 6. Let type be bodyWithType’s type if it is non-null; otherwise the empty byte sequence. - const type = bodyWithType[1] ?? '' - // 7. Return a new response whose status message is `OK`, header list is - // « (`Content-Length`, length), (`Content-Type`, type) », and body is body. - const response = makeResponse({ - statusText: 'OK', - headersList: [ - ['content-length', { name: 'Content-Length', value: length }], - ['content-type', { name: 'Content-Type', value: type }] - ] - }) +/***/ }), - response.body = body +/***/ 43121: +/***/ ((module) => { - return Promise.resolve(response) - } - case 'data:': { - // 1. Let dataURLStruct be the result of running the - // data: URL processor on request’s current URL. - const currentURL = requestCurrentURL(request) - const dataURLStruct = dataURLProcessor(currentURL) +"use strict"; - // 2. If dataURLStruct is failure, then return a - // network error. - if (dataURLStruct === 'failure') { - return Promise.resolve(makeNetworkError('failed to fetch the data URL')) - } - // 3. Let mimeType be dataURLStruct’s MIME type, serialized. - const mimeType = serializeAMimeType(dataURLStruct.mimeType) +/** + * @param {string} value + * @returns {boolean} + */ +function isCTLExcludingHtab (value) { + if (value.length === 0) { + return false + } - // 4. Return a response whose status message is `OK`, - // header list is « (`Content-Type`, mimeType) », - // and body is dataURLStruct’s body as a body. - return Promise.resolve(makeResponse({ - statusText: 'OK', - headersList: [ - ['content-type', { name: 'Content-Type', value: mimeType }] - ], - body: safelyExtractBody(dataURLStruct.body)[0] - })) - } - case 'file:': { - // For now, unfortunate as it is, file URLs are left as an exercise for the reader. - // When in doubt, return a network error. - return Promise.resolve(makeNetworkError('not implemented... yet...')) - } - case 'http:': - case 'https:': { - // Return the result of running HTTP fetch given fetchParams. + for (const char of value) { + const code = char.charCodeAt(0) - return httpFetch(fetchParams) - .catch((err) => makeNetworkError(err)) - } - default: { - return Promise.resolve(makeNetworkError('unknown scheme')) + if ( + (code >= 0x00 || code <= 0x08) || + (code >= 0x0A || code <= 0x1F) || + code === 0x7F + ) { + return false } } } -// https://fetch.spec.whatwg.org/#finalize-response -function finalizeResponse (fetchParams, response) { - // 1. Set fetchParams’s request’s done flag. - fetchParams.request.done = true +/** + CHAR = + token = 1* + separators = "(" | ")" | "<" | ">" | "@" + | "," | ";" | ":" | "\" | <"> + | "/" | "[" | "]" | "?" | "=" + | "{" | "}" | SP | HT + * @param {string} name + */ +function validateCookieName (name) { + for (const char of name) { + const code = char.charCodeAt(0) - // 2, If fetchParams’s process response done is not null, then queue a fetch - // task to run fetchParams’s process response done given response, with - // fetchParams’s task destination. - if (fetchParams.processResponseDone != null) { - queueMicrotask(() => fetchParams.processResponseDone(response)) + if ( + (code <= 0x20 || code > 0x7F) || + char === '(' || + char === ')' || + char === '>' || + char === '<' || + char === '@' || + char === ',' || + char === ';' || + char === ':' || + char === '\\' || + char === '"' || + char === '/' || + char === '[' || + char === ']' || + char === '?' || + char === '=' || + char === '{' || + char === '}' + ) { + throw new Error('Invalid cookie name') + } } } -// https://fetch.spec.whatwg.org/#fetch-finale -function fetchFinale (fetchParams, response) { - // 1. If response is a network error, then: - if (response.type === 'error') { - // 1. Set response’s URL list to « fetchParams’s request’s URL list[0] ». - response.urlList = [fetchParams.request.urlList[0]] +/** + cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) + cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E + ; US-ASCII characters excluding CTLs, + ; whitespace DQUOTE, comma, semicolon, + ; and backslash + * @param {string} value + */ +function validateCookieValue (value) { + for (const char of value) { + const code = char.charCodeAt(0) - // 2. Set response’s timing info to the result of creating an opaque timing - // info for fetchParams’s timing info. - response.timingInfo = createOpaqueTimingInfo({ - startTime: fetchParams.timingInfo.startTime - }) + if ( + code < 0x21 || // exclude CTLs (0-31) + code === 0x22 || + code === 0x2C || + code === 0x3B || + code === 0x5C || + code > 0x7E // non-ascii + ) { + throw new Error('Invalid header value') + } } +} - // 2. Let processResponseEndOfBody be the following steps: - const processResponseEndOfBody = () => { - // 1. Set fetchParams’s request’s done flag. - fetchParams.request.done = true +/** + * path-value = + * @param {string} path + */ +function validateCookiePath (path) { + for (const char of path) { + const code = char.charCodeAt(0) - // If fetchParams’s process response end-of-body is not null, - // then queue a fetch task to run fetchParams’s process response - // end-of-body given response with fetchParams’s task destination. - if (fetchParams.processResponseEndOfBody != null) { - queueMicrotask(() => fetchParams.processResponseEndOfBody(response)) + if (code < 0x21 || char === ';') { + throw new Error('Invalid cookie path') } } +} - // 3. If fetchParams’s process response is non-null, then queue a fetch task - // to run fetchParams’s process response given response, with fetchParams’s - // task destination. - if (fetchParams.processResponse != null) { - queueMicrotask(() => fetchParams.processResponse(response)) +/** + * I have no idea why these values aren't allowed to be honest, + * but Deno tests these. - Khafra + * @param {string} domain + */ +function validateCookieDomain (domain) { + if ( + domain.startsWith('-') || + domain.endsWith('.') || + domain.endsWith('-') + ) { + throw new Error('Invalid cookie domain') } +} - // 4. If response’s body is null, then run processResponseEndOfBody. - if (response.body == null) { - processResponseEndOfBody() - } else { - // 5. Otherwise: +/** + * @see https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1 + * @param {number|Date} date + IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT + ; fixed length/zone/capitalization subset of the format + ; see Section 3.3 of [RFC5322] - // 1. Let transformStream be a new a TransformStream. + day-name = %x4D.6F.6E ; "Mon", case-sensitive + / %x54.75.65 ; "Tue", case-sensitive + / %x57.65.64 ; "Wed", case-sensitive + / %x54.68.75 ; "Thu", case-sensitive + / %x46.72.69 ; "Fri", case-sensitive + / %x53.61.74 ; "Sat", case-sensitive + / %x53.75.6E ; "Sun", case-sensitive + date1 = day SP month SP year + ; e.g., 02 Jun 1982 - // 2. Let identityTransformAlgorithm be an algorithm which, given chunk, - // enqueues chunk in transformStream. - const identityTransformAlgorithm = (chunk, controller) => { - controller.enqueue(chunk) - } + day = 2DIGIT + month = %x4A.61.6E ; "Jan", case-sensitive + / %x46.65.62 ; "Feb", case-sensitive + / %x4D.61.72 ; "Mar", case-sensitive + / %x41.70.72 ; "Apr", case-sensitive + / %x4D.61.79 ; "May", case-sensitive + / %x4A.75.6E ; "Jun", case-sensitive + / %x4A.75.6C ; "Jul", case-sensitive + / %x41.75.67 ; "Aug", case-sensitive + / %x53.65.70 ; "Sep", case-sensitive + / %x4F.63.74 ; "Oct", case-sensitive + / %x4E.6F.76 ; "Nov", case-sensitive + / %x44.65.63 ; "Dec", case-sensitive + year = 4DIGIT - // 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm - // and flushAlgorithm set to processResponseEndOfBody. - const transformStream = new TransformStream({ - start () {}, - transform: identityTransformAlgorithm, - flush: processResponseEndOfBody - }, { - size () { - return 1 - } - }, { - size () { - return 1 - } - }) + GMT = %x47.4D.54 ; "GMT", case-sensitive - // 4. Set response’s body to the result of piping response’s body through transformStream. - response.body = { stream: response.body.stream.pipeThrough(transformStream) } + time-of-day = hour ":" minute ":" second + ; 00:00:00 - 23:59:60 (leap second) + + hour = 2DIGIT + minute = 2DIGIT + second = 2DIGIT + */ +function toIMFDate (date) { + if (typeof date === 'number') { + date = new Date(date) } - // 6. If fetchParams’s process response consume body is non-null, then: - if (fetchParams.processResponseConsumeBody != null) { - // 1. Let processBody given nullOrBytes be this step: run fetchParams’s - // process response consume body given response and nullOrBytes. - const processBody = (nullOrBytes) => fetchParams.processResponseConsumeBody(response, nullOrBytes) + const days = [ + 'Sun', 'Mon', 'Tue', 'Wed', + 'Thu', 'Fri', 'Sat' + ] - // 2. Let processBodyError be this step: run fetchParams’s process - // response consume body given response and failure. - const processBodyError = (failure) => fetchParams.processResponseConsumeBody(response, failure) + const months = [ + 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' + ] - // 3. If response’s body is null, then queue a fetch task to run processBody - // given null, with fetchParams’s task destination. - if (response.body == null) { - queueMicrotask(() => processBody(null)) - } else { - // 4. Otherwise, fully read response’s body given processBody, processBodyError, - // and fetchParams’s task destination. - return fullyReadBody(response.body, processBody, processBodyError) - } - return Promise.resolve() - } + const dayName = days[date.getUTCDay()] + const day = date.getUTCDate().toString().padStart(2, '0') + const month = months[date.getUTCMonth()] + const year = date.getUTCFullYear() + const hour = date.getUTCHours().toString().padStart(2, '0') + const minute = date.getUTCMinutes().toString().padStart(2, '0') + const second = date.getUTCSeconds().toString().padStart(2, '0') + + return `${dayName}, ${day} ${month} ${year} ${hour}:${minute}:${second} GMT` } -// https://fetch.spec.whatwg.org/#http-fetch -async function httpFetch (fetchParams) { - // 1. Let request be fetchParams’s request. - const request = fetchParams.request +/** + max-age-av = "Max-Age=" non-zero-digit *DIGIT + ; In practice, both expires-av and max-age-av + ; are limited to dates representable by the + ; user agent. + * @param {number} maxAge + */ +function validateCookieMaxAge (maxAge) { + if (maxAge < 0) { + throw new Error('Invalid cookie max-age') + } +} - // 2. Let response be null. - let response = null +/** + * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1 + * @param {import('./index').Cookie} cookie + */ +function stringify (cookie) { + if (cookie.name.length === 0) { + return null + } - // 3. Let actualResponse be null. - let actualResponse = null + validateCookieName(cookie.name) + validateCookieValue(cookie.value) - // 4. Let timingInfo be fetchParams’s timing info. - const timingInfo = fetchParams.timingInfo + const out = [`${cookie.name}=${cookie.value}`] - // 5. If request’s service-workers mode is "all", then: - if (request.serviceWorkers === 'all') { - // TODO + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.1 + // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes-00#section-3.2 + if (cookie.name.startsWith('__Secure-')) { + cookie.secure = true } - // 6. If response is null, then: - if (response === null) { - // 1. If makeCORSPreflight is true and one of these conditions is true: - // TODO + if (cookie.name.startsWith('__Host-')) { + cookie.secure = true + cookie.domain = null + cookie.path = '/' + } - // 2. If request’s redirect mode is "follow", then set request’s - // service-workers mode to "none". - if (request.redirect === 'follow') { - request.serviceWorkers = 'none' - } + if (cookie.secure) { + out.push('Secure') + } - // 3. Set response and actualResponse to the result of running - // HTTP-network-or-cache fetch given fetchParams. - actualResponse = response = await httpNetworkOrCacheFetch(fetchParams) + if (cookie.httpOnly) { + out.push('HttpOnly') + } - // 4. If request’s response tainting is "cors" and a CORS check - // for request and response returns failure, then return a network error. - if ( - request.responseTainting === 'cors' && - corsCheck(request, response) === 'failure' - ) { - return makeNetworkError('cors failure') - } + if (typeof cookie.maxAge === 'number') { + validateCookieMaxAge(cookie.maxAge) + out.push(`Max-Age=${cookie.maxAge}`) + } - // 5. If the TAO check for request and response returns failure, then set - // request’s timing allow failed flag. - if (TAOCheck(request, response) === 'failure') { - request.timingAllowFailed = true - } + if (cookie.domain) { + validateCookieDomain(cookie.domain) + out.push(`Domain=${cookie.domain}`) } - // 7. If either request’s response tainting or response’s type - // is "opaque", and the cross-origin resource policy check with - // request’s origin, request’s client, request’s destination, - // and actualResponse returns blocked, then return a network error. - if ( - (request.responseTainting === 'opaque' || response.type === 'opaque') && - crossOriginResourcePolicyCheck( - request.origin, - request.client, - request.destination, - actualResponse - ) === 'blocked' - ) { - return makeNetworkError('blocked') + if (cookie.path) { + validateCookiePath(cookie.path) + out.push(`Path=${cookie.path}`) } - // 8. If actualResponse’s status is a redirect status, then: - if (redirectStatusSet.has(actualResponse.status)) { - // 1. If actualResponse’s status is not 303, request’s body is not null, - // and the connection uses HTTP/2, then user agents may, and are even - // encouraged to, transmit an RST_STREAM frame. - // See, https://github.com/whatwg/fetch/issues/1288 - if (request.redirect !== 'manual') { - fetchParams.controller.connection.destroy() - } + if (cookie.expires && cookie.expires.toString() !== 'Invalid Date') { + out.push(`Expires=${toIMFDate(cookie.expires)}`) + } - // 2. Switch on request’s redirect mode: - if (request.redirect === 'error') { - // Set response to a network error. - response = makeNetworkError('unexpected redirect') - } else if (request.redirect === 'manual') { - // Set response to an opaque-redirect filtered response whose internal - // response is actualResponse. - // NOTE(spec): On the web this would return an `opaqueredirect` response, - // but that doesn't make sense server side. - // See https://github.com/nodejs/undici/issues/1193. - response = actualResponse - } else if (request.redirect === 'follow') { - // Set response to the result of running HTTP-redirect fetch given - // fetchParams and response. - response = await httpRedirectFetch(fetchParams, response) - } else { - assert(false) - } + if (cookie.sameSite) { + out.push(`SameSite=${cookie.sameSite}`) } - // 9. Set response’s timing info to timingInfo. - response.timingInfo = timingInfo + for (const part of cookie.unparsed) { + if (!part.includes('=')) { + throw new Error('Invalid unparsed') + } - // 10. Return response. - return response -} + const [key, ...value] = part.split('=') -// https://fetch.spec.whatwg.org/#http-redirect-fetch -function httpRedirectFetch (fetchParams, response) { - // 1. Let request be fetchParams’s request. - const request = fetchParams.request + out.push(`${key.trim()}=${value.join('=')}`) + } - // 2. Let actualResponse be response, if response is not a filtered response, - // and response’s internal response otherwise. - const actualResponse = response.internalResponse - ? response.internalResponse - : response + return out.join('; ') +} - // 3. Let locationURL be actualResponse’s location URL given request’s current - // URL’s fragment. - let locationURL +module.exports = { + isCTLExcludingHtab, + validateCookieName, + validateCookiePath, + validateCookieValue, + toIMFDate, + stringify +} - try { - locationURL = responseLocationURL( - actualResponse, - requestCurrentURL(request).hash - ) - // 4. If locationURL is null, then return response. - if (locationURL == null) { - return response - } - } catch (err) { - // 5. If locationURL is failure, then return a network error. - return Promise.resolve(makeNetworkError(err)) - } +/***/ }), - // 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network - // error. - if (!urlIsHttpHttpsScheme(locationURL)) { - return Promise.resolve(makeNetworkError('URL scheme must be a HTTP(S) scheme')) - } +/***/ 82067: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 7. If request’s redirect count is 20, then return a network error. - if (request.redirectCount === 20) { - return Promise.resolve(makeNetworkError('redirect count exceeded')) - } +"use strict"; - // 8. Increase request’s redirect count by 1. - request.redirectCount += 1 - // 9. If request’s mode is "cors", locationURL includes credentials, and - // request’s origin is not same origin with locationURL’s origin, then return - // a network error. - if ( - request.mode === 'cors' && - (locationURL.username || locationURL.password) && - !sameOrigin(request, locationURL) - ) { - return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')) - } +const net = __nccwpck_require__(41808) +const assert = __nccwpck_require__(39491) +const util = __nccwpck_require__(83983) +const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(48045) - // 10. If request’s response tainting is "cors" and locationURL includes - // credentials, then return a network error. - if ( - request.responseTainting === 'cors' && - (locationURL.username || locationURL.password) - ) { - return Promise.resolve(makeNetworkError( - 'URL cannot contain credentials for request mode "cors"' - )) - } +let tls // include tls conditionally since it is not always available - // 11. If actualResponse’s status is not 303, request’s body is non-null, - // and request’s body’s source is null, then return a network error. - if ( - actualResponse.status !== 303 && - request.body != null && - request.body.source == null - ) { - return Promise.resolve(makeNetworkError()) - } +// TODO: session re-use does not wait for the first +// connection to resolve the session and might therefore +// resolve the same servername multiple times even when +// re-use is enabled. - // 12. If one of the following is true - // - actualResponse’s status is 301 or 302 and request’s method is `POST` - // - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD` - if ( - ([301, 302].includes(actualResponse.status) && request.method === 'POST') || - (actualResponse.status === 303 && - !GET_OR_HEAD.includes(request.method)) - ) { - // then: - // 1. Set request’s method to `GET` and request’s body to null. - request.method = 'GET' - request.body = null +let SessionCache +// FIXME: remove workaround when the Node bug is fixed +// https://github.com/nodejs/node/issues/49344#issuecomment-1741776308 +if (global.FinalizationRegistry && !process.env.NODE_V8_COVERAGE) { + SessionCache = class WeakSessionCache { + constructor (maxCachedSessions) { + this._maxCachedSessions = maxCachedSessions + this._sessionCache = new Map() + this._sessionRegistry = new global.FinalizationRegistry((key) => { + if (this._sessionCache.size < this._maxCachedSessions) { + return + } - // 2. For each headerName of request-body-header name, delete headerName from - // request’s header list. - for (const headerName of requestBodyHeader) { - request.headersList.delete(headerName) + const ref = this._sessionCache.get(key) + if (ref !== undefined && ref.deref() === undefined) { + this._sessionCache.delete(key) + } + }) } - } - // 13. If request’s current URL’s origin is not same origin with locationURL’s - // origin, then for each headerName of CORS non-wildcard request-header name, - // delete headerName from request’s header list. - if (!sameOrigin(requestCurrentURL(request), locationURL)) { - // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name - request.headersList.delete('authorization') + get (sessionKey) { + const ref = this._sessionCache.get(sessionKey) + return ref ? ref.deref() : null + } - // https://fetch.spec.whatwg.org/#authentication-entries - request.headersList.delete('proxy-authorization', true) + set (sessionKey, session) { + if (this._maxCachedSessions === 0) { + return + } - // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. - request.headersList.delete('cookie') - request.headersList.delete('host') + this._sessionCache.set(sessionKey, new WeakRef(session)) + this._sessionRegistry.register(session, sessionKey) + } } +} else { + SessionCache = class SimpleSessionCache { + constructor (maxCachedSessions) { + this._maxCachedSessions = maxCachedSessions + this._sessionCache = new Map() + } - // 14. If request’s body is non-null, then set request’s body to the first return - // value of safely extracting request’s body’s source. - if (request.body != null) { - assert(request.body.source != null) - request.body = safelyExtractBody(request.body.source)[0] - } + get (sessionKey) { + return this._sessionCache.get(sessionKey) + } - // 15. Let timingInfo be fetchParams’s timing info. - const timingInfo = fetchParams.timingInfo + set (sessionKey, session) { + if (this._maxCachedSessions === 0) { + return + } - // 16. Set timingInfo’s redirect end time and post-redirect start time to the - // coarsened shared current time given fetchParams’s cross-origin isolated - // capability. - timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = - coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability) + if (this._sessionCache.size >= this._maxCachedSessions) { + // remove the oldest session + const { value: oldestKey } = this._sessionCache.keys().next() + this._sessionCache.delete(oldestKey) + } - // 17. If timingInfo’s redirect start time is 0, then set timingInfo’s - // redirect start time to timingInfo’s start time. - if (timingInfo.redirectStartTime === 0) { - timingInfo.redirectStartTime = timingInfo.startTime + this._sessionCache.set(sessionKey, session) + } } - - // 18. Append locationURL to request’s URL list. - request.urlList.push(locationURL) - - // 19. Invoke set request’s referrer policy on redirect on request and - // actualResponse. - setRequestReferrerPolicyOnRedirect(request, actualResponse) - - // 20. Return the result of running main fetch given fetchParams and true. - return mainFetch(fetchParams, true) } -// https://fetch.spec.whatwg.org/#http-network-or-cache-fetch -async function httpNetworkOrCacheFetch ( - fetchParams, - isAuthenticationFetch = false, - isNewConnectionFetch = false -) { - // 1. Let request be fetchParams’s request. - const request = fetchParams.request +function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, ...opts }) { + if (maxCachedSessions != null && (!Number.isInteger(maxCachedSessions) || maxCachedSessions < 0)) { + throw new InvalidArgumentError('maxCachedSessions must be a positive integer or zero') + } - // 2. Let httpFetchParams be null. - let httpFetchParams = null + const options = { path: socketPath, ...opts } + const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions) + timeout = timeout == null ? 10e3 : timeout + allowH2 = allowH2 != null ? allowH2 : false + return function connect ({ hostname, host, protocol, port, servername, localAddress, httpSocket }, callback) { + let socket + if (protocol === 'https:') { + if (!tls) { + tls = __nccwpck_require__(24404) + } + servername = servername || options.servername || util.getServerName(host) || null - // 3. Let httpRequest be null. - let httpRequest = null + const sessionKey = servername || hostname + const session = sessionCache.get(sessionKey) || null - // 4. Let response be null. - let response = null + assert(sessionKey) - // 5. Let storedResponse be null. - // TODO: cache + socket = tls.connect({ + highWaterMark: 16384, // TLS in node can't have bigger HWM anyway... + ...options, + servername, + session, + localAddress, + // TODO(HTTP/2): Add support for h2c + ALPNProtocols: allowH2 ? ['http/1.1', 'h2'] : ['http/1.1'], + socket: httpSocket, // upgrade socket connection + port: port || 443, + host: hostname + }) - // 6. Let httpCache be null. - const httpCache = null + socket + .on('session', function (session) { + // TODO (fix): Can a session become invalid once established? Don't think so? + sessionCache.set(sessionKey, session) + }) + } else { + assert(!httpSocket, 'httpSocket can only be sent on TLS update') + socket = net.connect({ + highWaterMark: 64 * 1024, // Same as nodejs fs streams. + ...options, + localAddress, + port: port || 80, + host: hostname + }) + } - // 7. Let the revalidatingFlag be unset. - const revalidatingFlag = false + // Set TCP keep alive options on the socket here instead of in connect() for the case of assigning the socket + if (options.keepAlive == null || options.keepAlive) { + const keepAliveInitialDelay = options.keepAliveInitialDelay === undefined ? 60e3 : options.keepAliveInitialDelay + socket.setKeepAlive(true, keepAliveInitialDelay) + } - // 8. Run these steps, but abort when the ongoing fetch is terminated: + const cancelTimeout = setupTimeout(() => onConnectTimeout(socket), timeout) - // 1. If request’s window is "no-window" and request’s redirect mode is - // "error", then set httpFetchParams to fetchParams and httpRequest to - // request. - if (request.window === 'no-window' && request.redirect === 'error') { - httpFetchParams = fetchParams - httpRequest = request - } else { - // Otherwise: + socket + .setNoDelay(true) + .once(protocol === 'https:' ? 'secureConnect' : 'connect', function () { + cancelTimeout() - // 1. Set httpRequest to a clone of request. - httpRequest = makeRequest(request) + if (callback) { + const cb = callback + callback = null + cb(null, this) + } + }) + .on('error', function (err) { + cancelTimeout() - // 2. Set httpFetchParams to a copy of fetchParams. - httpFetchParams = { ...fetchParams } + if (callback) { + const cb = callback + callback = null + cb(err) + } + }) - // 3. Set httpFetchParams’s request to httpRequest. - httpFetchParams.request = httpRequest + return socket } +} - // 3. Let includeCredentials be true if one of - const includeCredentials = - request.credentials === 'include' || - (request.credentials === 'same-origin' && - request.responseTainting === 'basic') - - // 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s - // body is non-null; otherwise null. - const contentLength = httpRequest.body ? httpRequest.body.length : null - - // 5. Let contentLengthHeaderValue be null. - let contentLengthHeaderValue = null - - // 6. If httpRequest’s body is null and httpRequest’s method is `POST` or - // `PUT`, then set contentLengthHeaderValue to `0`. - if ( - httpRequest.body == null && - ['POST', 'PUT'].includes(httpRequest.method) - ) { - contentLengthHeaderValue = '0' +function setupTimeout (onConnectTimeout, timeout) { + if (!timeout) { + return () => {} } - // 7. If contentLength is non-null, then set contentLengthHeaderValue to - // contentLength, serialized and isomorphic encoded. - if (contentLength != null) { - contentLengthHeaderValue = isomorphicEncode(`${contentLength}`) + let s1 = null + let s2 = null + const timeoutId = setTimeout(() => { + // setImmediate is added to make sure that we priotorise socket error events over timeouts + s1 = setImmediate(() => { + if (process.platform === 'win32') { + // Windows needs an extra setImmediate probably due to implementation differences in the socket logic + s2 = setImmediate(() => onConnectTimeout()) + } else { + onConnectTimeout() + } + }) + }, timeout) + return () => { + clearTimeout(timeoutId) + clearImmediate(s1) + clearImmediate(s2) } +} - // 8. If contentLengthHeaderValue is non-null, then append - // `Content-Length`/contentLengthHeaderValue to httpRequest’s header - // list. - if (contentLengthHeaderValue != null) { - httpRequest.headersList.append('content-length', contentLengthHeaderValue) - } +function onConnectTimeout (socket) { + util.destroy(socket, new ConnectTimeoutError()) +} - // 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`, - // contentLengthHeaderValue) to httpRequest’s header list. +module.exports = buildConnector - // 10. If contentLength is non-null and httpRequest’s keepalive is true, - // then: - if (contentLength != null && httpRequest.keepalive) { - // NOTE: keepalive is a noop outside of browser context. - } - // 11. If httpRequest’s referrer is a URL, then append - // `Referer`/httpRequest’s referrer, serialized and isomorphic encoded, - // to httpRequest’s header list. - if (httpRequest.referrer instanceof URL) { - httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href)) - } +/***/ }), - // 12. Append a request `Origin` header for httpRequest. - appendRequestOriginHeader(httpRequest) +/***/ 14462: +/***/ ((module) => { - // 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA] - appendFetchMetadata(httpRequest) +"use strict"; - // 14. If httpRequest’s header list does not contain `User-Agent`, then - // user agents should append `User-Agent`/default `User-Agent` value to - // httpRequest’s header list. - if (!httpRequest.headersList.contains('user-agent')) { - httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node') - } - // 15. If httpRequest’s cache mode is "default" and httpRequest’s header - // list contains `If-Modified-Since`, `If-None-Match`, - // `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set - // httpRequest’s cache mode to "no-store". - if ( - httpRequest.cache === 'default' && - (httpRequest.headersList.contains('if-modified-since') || - httpRequest.headersList.contains('if-none-match') || - httpRequest.headersList.contains('if-unmodified-since') || - httpRequest.headersList.contains('if-match') || - httpRequest.headersList.contains('if-range')) - ) { - httpRequest.cache = 'no-store' - } +/** @type {Record} */ +const headerNameLowerCasedRecord = {} - // 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent - // no-cache cache-control header modification flag is unset, and - // httpRequest’s header list does not contain `Cache-Control`, then append - // `Cache-Control`/`max-age=0` to httpRequest’s header list. - if ( - httpRequest.cache === 'no-cache' && - !httpRequest.preventNoCacheCacheControlHeaderModification && - !httpRequest.headersList.contains('cache-control') - ) { - httpRequest.headersList.append('cache-control', 'max-age=0') - } +// https://developer.mozilla.org/docs/Web/HTTP/Headers +const wellknownHeaderNames = [ + 'Accept', + 'Accept-Encoding', + 'Accept-Language', + 'Accept-Ranges', + 'Access-Control-Allow-Credentials', + 'Access-Control-Allow-Headers', + 'Access-Control-Allow-Methods', + 'Access-Control-Allow-Origin', + 'Access-Control-Expose-Headers', + 'Access-Control-Max-Age', + 'Access-Control-Request-Headers', + 'Access-Control-Request-Method', + 'Age', + 'Allow', + 'Alt-Svc', + 'Alt-Used', + 'Authorization', + 'Cache-Control', + 'Clear-Site-Data', + 'Connection', + 'Content-Disposition', + 'Content-Encoding', + 'Content-Language', + 'Content-Length', + 'Content-Location', + 'Content-Range', + 'Content-Security-Policy', + 'Content-Security-Policy-Report-Only', + 'Content-Type', + 'Cookie', + 'Cross-Origin-Embedder-Policy', + 'Cross-Origin-Opener-Policy', + 'Cross-Origin-Resource-Policy', + 'Date', + 'Device-Memory', + 'Downlink', + 'ECT', + 'ETag', + 'Expect', + 'Expect-CT', + 'Expires', + 'Forwarded', + 'From', + 'Host', + 'If-Match', + 'If-Modified-Since', + 'If-None-Match', + 'If-Range', + 'If-Unmodified-Since', + 'Keep-Alive', + 'Last-Modified', + 'Link', + 'Location', + 'Max-Forwards', + 'Origin', + 'Permissions-Policy', + 'Pragma', + 'Proxy-Authenticate', + 'Proxy-Authorization', + 'RTT', + 'Range', + 'Referer', + 'Referrer-Policy', + 'Refresh', + 'Retry-After', + 'Sec-WebSocket-Accept', + 'Sec-WebSocket-Extensions', + 'Sec-WebSocket-Key', + 'Sec-WebSocket-Protocol', + 'Sec-WebSocket-Version', + 'Server', + 'Server-Timing', + 'Service-Worker-Allowed', + 'Service-Worker-Navigation-Preload', + 'Set-Cookie', + 'SourceMap', + 'Strict-Transport-Security', + 'Supports-Loading-Mode', + 'TE', + 'Timing-Allow-Origin', + 'Trailer', + 'Transfer-Encoding', + 'Upgrade', + 'Upgrade-Insecure-Requests', + 'User-Agent', + 'Vary', + 'Via', + 'WWW-Authenticate', + 'X-Content-Type-Options', + 'X-DNS-Prefetch-Control', + 'X-Frame-Options', + 'X-Permitted-Cross-Domain-Policies', + 'X-Powered-By', + 'X-Requested-With', + 'X-XSS-Protection' +] - // 17. If httpRequest’s cache mode is "no-store" or "reload", then: - if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') { - // 1. If httpRequest’s header list does not contain `Pragma`, then append - // `Pragma`/`no-cache` to httpRequest’s header list. - if (!httpRequest.headersList.contains('pragma')) { - httpRequest.headersList.append('pragma', 'no-cache') - } +for (let i = 0; i < wellknownHeaderNames.length; ++i) { + const key = wellknownHeaderNames[i] + const lowerCasedKey = key.toLowerCase() + headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] = + lowerCasedKey +} - // 2. If httpRequest’s header list does not contain `Cache-Control`, - // then append `Cache-Control`/`no-cache` to httpRequest’s header list. - if (!httpRequest.headersList.contains('cache-control')) { - httpRequest.headersList.append('cache-control', 'no-cache') - } - } +// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`. +Object.setPrototypeOf(headerNameLowerCasedRecord, null) - // 18. If httpRequest’s header list contains `Range`, then append - // `Accept-Encoding`/`identity` to httpRequest’s header list. - if (httpRequest.headersList.contains('range')) { - httpRequest.headersList.append('accept-encoding', 'identity') - } +module.exports = { + wellknownHeaderNames, + headerNameLowerCasedRecord +} - // 19. Modify httpRequest’s header list per HTTP. Do not append a given - // header if httpRequest’s header list contains that header’s name. - // TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129 - if (!httpRequest.headersList.contains('accept-encoding')) { - if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) { - httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate') - } else { - httpRequest.headersList.append('accept-encoding', 'gzip, deflate') - } - } - httpRequest.headersList.delete('host') +/***/ }), - // 20. If includeCredentials is true, then: - if (includeCredentials) { - // 1. If the user agent is not configured to block cookies for httpRequest - // (see section 7 of [COOKIES]), then: - // TODO: credentials - // 2. If httpRequest’s header list does not contain `Authorization`, then: - // TODO: credentials - } +/***/ 48045: +/***/ ((module) => { - // 21. If there’s a proxy-authentication entry, use it as appropriate. - // TODO: proxy-authentication +"use strict"; - // 22. Set httpCache to the result of determining the HTTP cache - // partition, given httpRequest. - // TODO: cache - // 23. If httpCache is null, then set httpRequest’s cache mode to - // "no-store". - if (httpCache == null) { - httpRequest.cache = 'no-store' +class UndiciError extends Error { + constructor (message) { + super(message) + this.name = 'UndiciError' + this.code = 'UND_ERR' } +} - // 24. If httpRequest’s cache mode is neither "no-store" nor "reload", - // then: - if (httpRequest.mode !== 'no-store' && httpRequest.mode !== 'reload') { - // TODO: cache +class ConnectTimeoutError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ConnectTimeoutError) + this.name = 'ConnectTimeoutError' + this.message = message || 'Connect Timeout Error' + this.code = 'UND_ERR_CONNECT_TIMEOUT' } +} - // 9. If aborted, then return the appropriate network error for fetchParams. - // TODO - - // 10. If response is null, then: - if (response == null) { - // 1. If httpRequest’s cache mode is "only-if-cached", then return a - // network error. - if (httpRequest.mode === 'only-if-cached') { - return makeNetworkError('only if cached') - } - - // 2. Let forwardResponse be the result of running HTTP-network fetch - // given httpFetchParams, includeCredentials, and isNewConnectionFetch. - const forwardResponse = await httpNetworkFetch( - httpFetchParams, - includeCredentials, - isNewConnectionFetch - ) - - // 3. If httpRequest’s method is unsafe and forwardResponse’s status is - // in the range 200 to 399, inclusive, invalidate appropriate stored - // responses in httpCache, as per the "Invalidation" chapter of HTTP - // Caching, and set storedResponse to null. [HTTP-CACHING] - if ( - !safeMethodsSet.has(httpRequest.method) && - forwardResponse.status >= 200 && - forwardResponse.status <= 399 - ) { - // TODO: cache - } - - // 4. If the revalidatingFlag is set and forwardResponse’s status is 304, - // then: - if (revalidatingFlag && forwardResponse.status === 304) { - // TODO: cache - } - - // 5. If response is null, then: - if (response == null) { - // 1. Set response to forwardResponse. - response = forwardResponse - - // 2. Store httpRequest and forwardResponse in httpCache, as per the - // "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING] - // TODO: cache - } +class HeadersTimeoutError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, HeadersTimeoutError) + this.name = 'HeadersTimeoutError' + this.message = message || 'Headers Timeout Error' + this.code = 'UND_ERR_HEADERS_TIMEOUT' } +} - // 11. Set response’s URL list to a clone of httpRequest’s URL list. - response.urlList = [...httpRequest.urlList] - - // 12. If httpRequest’s header list contains `Range`, then set response’s - // range-requested flag. - if (httpRequest.headersList.contains('range')) { - response.rangeRequested = true +class HeadersOverflowError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, HeadersOverflowError) + this.name = 'HeadersOverflowError' + this.message = message || 'Headers Overflow Error' + this.code = 'UND_ERR_HEADERS_OVERFLOW' } +} - // 13. Set response’s request-includes-credentials to includeCredentials. - response.requestIncludesCredentials = includeCredentials +class BodyTimeoutError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, BodyTimeoutError) + this.name = 'BodyTimeoutError' + this.message = message || 'Body Timeout Error' + this.code = 'UND_ERR_BODY_TIMEOUT' + } +} - // 14. If response’s status is 401, httpRequest’s response tainting is not - // "cors", includeCredentials is true, and request’s window is an environment - // settings object, then: - // TODO +class ResponseStatusCodeError extends UndiciError { + constructor (message, statusCode, headers, body) { + super(message) + Error.captureStackTrace(this, ResponseStatusCodeError) + this.name = 'ResponseStatusCodeError' + this.message = message || 'Response Status Code Error' + this.code = 'UND_ERR_RESPONSE_STATUS_CODE' + this.body = body + this.status = statusCode + this.statusCode = statusCode + this.headers = headers + } +} - // 15. If response’s status is 407, then: - if (response.status === 407) { - // 1. If request’s window is "no-window", then return a network error. - if (request.window === 'no-window') { - return makeNetworkError() - } +class InvalidArgumentError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, InvalidArgumentError) + this.name = 'InvalidArgumentError' + this.message = message || 'Invalid Argument Error' + this.code = 'UND_ERR_INVALID_ARG' + } +} - // 2. ??? +class InvalidReturnValueError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, InvalidReturnValueError) + this.name = 'InvalidReturnValueError' + this.message = message || 'Invalid Return Value Error' + this.code = 'UND_ERR_INVALID_RETURN_VALUE' + } +} - // 3. If fetchParams is canceled, then return the appropriate network error for fetchParams. - if (isCancelled(fetchParams)) { - return makeAppropriateNetworkError(fetchParams) - } +class RequestAbortedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, RequestAbortedError) + this.name = 'AbortError' + this.message = message || 'Request aborted' + this.code = 'UND_ERR_ABORTED' + } +} - // 4. Prompt the end user as appropriate in request’s window and store - // the result as a proxy-authentication entry. [HTTP-AUTH] - // TODO: Invoke some kind of callback? +class InformationalError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, InformationalError) + this.name = 'InformationalError' + this.message = message || 'Request information' + this.code = 'UND_ERR_INFO' + } +} - // 5. Set response to the result of running HTTP-network-or-cache fetch given - // fetchParams. - // TODO - return makeNetworkError('proxy authentication required') +class RequestContentLengthMismatchError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, RequestContentLengthMismatchError) + this.name = 'RequestContentLengthMismatchError' + this.message = message || 'Request body length does not match content-length header' + this.code = 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH' } +} - // 16. If all of the following are true - if ( - // response’s status is 421 - response.status === 421 && - // isNewConnectionFetch is false - !isNewConnectionFetch && - // request’s body is null, or request’s body is non-null and request’s body’s source is non-null - (request.body == null || request.body.source != null) - ) { - // then: +class ResponseContentLengthMismatchError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ResponseContentLengthMismatchError) + this.name = 'ResponseContentLengthMismatchError' + this.message = message || 'Response body length does not match content-length header' + this.code = 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH' + } +} - // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams. - if (isCancelled(fetchParams)) { - return makeAppropriateNetworkError(fetchParams) - } +class ClientDestroyedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ClientDestroyedError) + this.name = 'ClientDestroyedError' + this.message = message || 'The client is destroyed' + this.code = 'UND_ERR_DESTROYED' + } +} - // 2. Set response to the result of running HTTP-network-or-cache - // fetch given fetchParams, isAuthenticationFetch, and true. +class ClientClosedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ClientClosedError) + this.name = 'ClientClosedError' + this.message = message || 'The client is closed' + this.code = 'UND_ERR_CLOSED' + } +} - // TODO (spec): The spec doesn't specify this but we need to cancel - // the active response before we can start a new one. - // https://github.com/whatwg/fetch/issues/1293 - fetchParams.controller.connection.destroy() +class SocketError extends UndiciError { + constructor (message, socket) { + super(message) + Error.captureStackTrace(this, SocketError) + this.name = 'SocketError' + this.message = message || 'Socket error' + this.code = 'UND_ERR_SOCKET' + this.socket = socket + } +} - response = await httpNetworkOrCacheFetch( - fetchParams, - isAuthenticationFetch, - true - ) +class NotSupportedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, NotSupportedError) + this.name = 'NotSupportedError' + this.message = message || 'Not supported error' + this.code = 'UND_ERR_NOT_SUPPORTED' } +} - // 17. If isAuthenticationFetch is true, then create an authentication entry - if (isAuthenticationFetch) { - // TODO +class BalancedPoolMissingUpstreamError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, NotSupportedError) + this.name = 'MissingUpstreamError' + this.message = message || 'No upstream has been added to the BalancedPool' + this.code = 'UND_ERR_BPL_MISSING_UPSTREAM' } +} - // 18. Return response. - return response +class HTTPParserError extends Error { + constructor (message, code, data) { + super(message) + Error.captureStackTrace(this, HTTPParserError) + this.name = 'HTTPParserError' + this.code = code ? `HPE_${code}` : undefined + this.data = data ? data.toString() : undefined + } } -// https://fetch.spec.whatwg.org/#http-network-fetch -async function httpNetworkFetch ( - fetchParams, - includeCredentials = false, - forceNewConnection = false -) { - assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed) +class ResponseExceededMaxSizeError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, ResponseExceededMaxSizeError) + this.name = 'ResponseExceededMaxSizeError' + this.message = message || 'Response content exceeded max size' + this.code = 'UND_ERR_RES_EXCEEDED_MAX_SIZE' + } +} - fetchParams.controller.connection = { - abort: null, - destroyed: false, - destroy (err) { - if (!this.destroyed) { - this.destroyed = true - this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError')) - } - } +class RequestRetryError extends UndiciError { + constructor (message, code, { headers, data }) { + super(message) + Error.captureStackTrace(this, RequestRetryError) + this.name = 'RequestRetryError' + this.message = message || 'Request retry error' + this.code = 'UND_ERR_REQ_RETRY' + this.statusCode = code + this.data = data + this.headers = headers } +} - // 1. Let request be fetchParams’s request. - const request = fetchParams.request +module.exports = { + HTTPParserError, + UndiciError, + HeadersTimeoutError, + HeadersOverflowError, + BodyTimeoutError, + RequestContentLengthMismatchError, + ConnectTimeoutError, + ResponseStatusCodeError, + InvalidArgumentError, + InvalidReturnValueError, + RequestAbortedError, + ClientDestroyedError, + ClientClosedError, + InformationalError, + SocketError, + NotSupportedError, + ResponseContentLengthMismatchError, + BalancedPoolMissingUpstreamError, + ResponseExceededMaxSizeError, + RequestRetryError +} - // 2. Let response be null. - let response = null - // 3. Let timingInfo be fetchParams’s timing info. - const timingInfo = fetchParams.timingInfo +/***/ }), - // 4. Let httpCache be the result of determining the HTTP cache partition, - // given request. - // TODO: cache - const httpCache = null +/***/ 62905: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 5. If httpCache is null, then set request’s cache mode to "no-store". - if (httpCache == null) { - request.cache = 'no-store' - } +"use strict"; - // 6. Let networkPartitionKey be the result of determining the network - // partition key given request. - // TODO - // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise - // "no". - const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars +const { + InvalidArgumentError, + NotSupportedError +} = __nccwpck_require__(48045) +const assert = __nccwpck_require__(39491) +const { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = __nccwpck_require__(72785) +const util = __nccwpck_require__(83983) - // 8. Switch on request’s mode: - if (request.mode === 'websocket') { - // Let connection be the result of obtaining a WebSocket connection, - // given request’s current URL. - // TODO - } else { - // Let connection be the result of obtaining a connection, given - // networkPartitionKey, request’s current URL’s origin, - // includeCredentials, and forceNewConnection. - // TODO - } +// tokenRegExp and headerCharRegex have been lifted from +// https://github.com/nodejs/node/blob/main/lib/_http_common.js - // 9. Run these steps, but abort when the ongoing fetch is terminated: +/** + * Verifies that the given val is a valid HTTP token + * per the rules defined in RFC 7230 + * See https://tools.ietf.org/html/rfc7230#section-3.2.6 + */ +const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/ - // 1. If connection is failure, then return a network error. +/** + * Matches if val contains an invalid field-vchar + * field-value = *( field-content / obs-fold ) + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + */ +const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/ - // 2. Set timingInfo’s final connection timing info to the result of - // calling clamp and coarsen connection timing info with connection’s - // timing info, timingInfo’s post-redirect start time, and fetchParams’s - // cross-origin isolated capability. +// Verifies that a given path is valid does not contain control chars \x00 to \x20 +const invalidPathRegex = /[^\u0021-\u00ff]/ - // 3. If connection is not an HTTP/2 connection, request’s body is non-null, - // and request’s body’s source is null, then append (`Transfer-Encoding`, - // `chunked`) to request’s header list. +const kHandler = Symbol('handler') - // 4. Set timingInfo’s final network-request start time to the coarsened - // shared current time given fetchParams’s cross-origin isolated - // capability. +const channels = {} - // 5. Set response to the result of making an HTTP request over connection - // using request with the following caveats: +let extractBody - // - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS] - // [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH] +try { + const diagnosticsChannel = __nccwpck_require__(67643) + channels.create = diagnosticsChannel.channel('undici:request:create') + channels.bodySent = diagnosticsChannel.channel('undici:request:bodySent') + channels.headers = diagnosticsChannel.channel('undici:request:headers') + channels.trailers = diagnosticsChannel.channel('undici:request:trailers') + channels.error = diagnosticsChannel.channel('undici:request:error') +} catch { + channels.create = { hasSubscribers: false } + channels.bodySent = { hasSubscribers: false } + channels.headers = { hasSubscribers: false } + channels.trailers = { hasSubscribers: false } + channels.error = { hasSubscribers: false } +} - // - If request’s body is non-null, and request’s body’s source is null, - // then the user agent may have a buffer of up to 64 kibibytes and store - // a part of request’s body in that buffer. If the user agent reads from - // request’s body beyond that buffer’s size and the user agent needs to - // resend request, then instead return a network error. +class Request { + constructor (origin, { + path, + method, + body, + headers, + query, + idempotent, + blocking, + upgrade, + headersTimeout, + bodyTimeout, + reset, + throwOnError, + expectContinue + }, handler) { + if (typeof path !== 'string') { + throw new InvalidArgumentError('path must be a string') + } else if ( + path[0] !== '/' && + !(path.startsWith('http://') || path.startsWith('https://')) && + method !== 'CONNECT' + ) { + throw new InvalidArgumentError('path must be an absolute URL or start with a slash') + } else if (invalidPathRegex.exec(path) !== null) { + throw new InvalidArgumentError('invalid request path') + } - // - Set timingInfo’s final network-response start time to the coarsened - // shared current time given fetchParams’s cross-origin isolated capability, - // immediately after the user agent’s HTTP parser receives the first byte - // of the response (e.g., frame header bytes for HTTP/2 or response status - // line for HTTP/1.x). + if (typeof method !== 'string') { + throw new InvalidArgumentError('method must be a string') + } else if (tokenRegExp.exec(method) === null) { + throw new InvalidArgumentError('invalid request method') + } - // - Wait until all the headers are transmitted. + if (upgrade && typeof upgrade !== 'string') { + throw new InvalidArgumentError('upgrade must be a string') + } - // - Any responses whose status is in the range 100 to 199, inclusive, - // and is not 101, are to be ignored, except for the purposes of setting - // timingInfo’s final network-response start time above. + if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) { + throw new InvalidArgumentError('invalid headersTimeout') + } - // - If request’s header list contains `Transfer-Encoding`/`chunked` and - // response is transferred via HTTP/1.0 or older, then return a network - // error. + if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) { + throw new InvalidArgumentError('invalid bodyTimeout') + } - // - If the HTTP request results in a TLS client certificate dialog, then: + if (reset != null && typeof reset !== 'boolean') { + throw new InvalidArgumentError('invalid reset') + } - // 1. If request’s window is an environment settings object, make the - // dialog available in request’s window. + if (expectContinue != null && typeof expectContinue !== 'boolean') { + throw new InvalidArgumentError('invalid expectContinue') + } - // 2. Otherwise, return a network error. + this.headersTimeout = headersTimeout - // To transmit request’s body body, run these steps: - let requestBody = null - // 1. If body is null and fetchParams’s process request end-of-body is - // non-null, then queue a fetch task given fetchParams’s process request - // end-of-body and fetchParams’s task destination. - if (request.body == null && fetchParams.processRequestEndOfBody) { - queueMicrotask(() => fetchParams.processRequestEndOfBody()) - } else if (request.body != null) { - // 2. Otherwise, if body is non-null: + this.bodyTimeout = bodyTimeout - // 1. Let processBodyChunk given bytes be these steps: - const processBodyChunk = async function * (bytes) { - // 1. If the ongoing fetch is terminated, then abort these steps. - if (isCancelled(fetchParams)) { - return - } + this.throwOnError = throwOnError === true - // 2. Run this step in parallel: transmit bytes. - yield bytes + this.method = method - // 3. If fetchParams’s process request body is non-null, then run - // fetchParams’s process request body given bytes’s length. - fetchParams.processRequestBodyChunkLength?.(bytes.byteLength) - } + this.abort = null - // 2. Let processEndOfBody be these steps: - const processEndOfBody = () => { - // 1. If fetchParams is canceled, then abort these steps. - if (isCancelled(fetchParams)) { - return + if (body == null) { + this.body = null + } else if (util.isStream(body)) { + this.body = body + + const rState = this.body._readableState + if (!rState || !rState.autoDestroy) { + this.endHandler = function autoDestroy () { + util.destroy(this) + } + this.body.on('end', this.endHandler) } - // 2. If fetchParams’s process request end-of-body is non-null, - // then run fetchParams’s process request end-of-body. - if (fetchParams.processRequestEndOfBody) { - fetchParams.processRequestEndOfBody() + this.errorHandler = err => { + if (this.abort) { + this.abort(err) + } else { + this.error = err + } } + this.body.on('error', this.errorHandler) + } else if (util.isBuffer(body)) { + this.body = body.byteLength ? body : null + } else if (ArrayBuffer.isView(body)) { + this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null + } else if (body instanceof ArrayBuffer) { + this.body = body.byteLength ? Buffer.from(body) : null + } else if (typeof body === 'string') { + this.body = body.length ? Buffer.from(body) : null + } else if (util.isFormDataLike(body) || util.isIterable(body) || util.isBlobLike(body)) { + this.body = body + } else { + throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable') } - // 3. Let processBodyError given e be these steps: - const processBodyError = (e) => { - // 1. If fetchParams is canceled, then abort these steps. - if (isCancelled(fetchParams)) { - return - } + this.completed = false - // 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller. - if (e.name === 'AbortError') { - fetchParams.controller.abort() - } else { - fetchParams.controller.terminate(e) - } - } + this.aborted = false - // 4. Incrementally read request’s body given processBodyChunk, processEndOfBody, - // processBodyError, and fetchParams’s task destination. - requestBody = (async function * () { - try { - for await (const bytes of request.body.stream) { - yield * processBodyChunk(bytes) - } - processEndOfBody() - } catch (err) { - processBodyError(err) - } - })() - } + this.upgrade = upgrade || null - try { - // socket is only provided for websockets - const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody }) + this.path = query ? util.buildURL(path, query) : path - if (socket) { - response = makeResponse({ status, statusText, headersList, socket }) - } else { - const iterator = body[Symbol.asyncIterator]() - fetchParams.controller.next = () => iterator.next() + this.origin = origin - response = makeResponse({ status, statusText, headersList }) - } - } catch (err) { - // 10. If aborted, then: - if (err.name === 'AbortError') { - // 1. If connection uses HTTP/2, then transmit an RST_STREAM frame. - fetchParams.controller.connection.destroy() + this.idempotent = idempotent == null + ? method === 'HEAD' || method === 'GET' + : idempotent - // 2. Return the appropriate network error for fetchParams. - return makeAppropriateNetworkError(fetchParams, err) - } + this.blocking = blocking == null ? false : blocking - return makeNetworkError(err) - } + this.reset = reset == null ? null : reset - // 11. Let pullAlgorithm be an action that resumes the ongoing fetch - // if it is suspended. - const pullAlgorithm = () => { - fetchParams.controller.resume() - } + this.host = null - // 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s - // controller with reason, given reason. - const cancelAlgorithm = (reason) => { - fetchParams.controller.abort(reason) - } + this.contentLength = null - // 13. Let highWaterMark be a non-negative, non-NaN number, chosen by - // the user agent. - // TODO + this.contentType = null - // 14. Let sizeAlgorithm be an algorithm that accepts a chunk object - // and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent. - // TODO + this.headers = '' - // 15. Let stream be a new ReadableStream. - // 16. Set up stream with pullAlgorithm set to pullAlgorithm, - // cancelAlgorithm set to cancelAlgorithm, highWaterMark set to - // highWaterMark, and sizeAlgorithm set to sizeAlgorithm. - if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(35356).ReadableStream) - } + // Only for H2 + this.expectContinue = expectContinue != null ? expectContinue : false - const stream = new ReadableStream( - { - async start (controller) { - fetchParams.controller.controller = controller - }, - async pull (controller) { - await pullAlgorithm(controller) - }, - async cancel (reason) { - await cancelAlgorithm(reason) + if (Array.isArray(headers)) { + if (headers.length % 2 !== 0) { + throw new InvalidArgumentError('headers array must be even') } - }, - { - highWaterMark: 0, - size () { - return 1 + for (let i = 0; i < headers.length; i += 2) { + processHeader(this, headers[i], headers[i + 1]) + } + } else if (headers && typeof headers === 'object') { + const keys = Object.keys(headers) + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + processHeader(this, key, headers[key]) } + } else if (headers != null) { + throw new InvalidArgumentError('headers must be an object or an array') } - ) - // 17. Run these steps, but abort when the ongoing fetch is terminated: + if (util.isFormDataLike(this.body)) { + if (util.nodeMajor < 16 || (util.nodeMajor === 16 && util.nodeMinor < 8)) { + throw new InvalidArgumentError('Form-Data bodies are only supported in node v16.8 and newer.') + } - // 1. Set response’s body to a new body whose stream is stream. - response.body = { stream } + if (!extractBody) { + extractBody = (__nccwpck_require__(41472).extractBody) + } - // 2. If response is not a network error and request’s cache mode is - // not "no-store", then update response in httpCache for request. - // TODO + const [bodyStream, contentType] = extractBody(body) + if (this.contentType == null) { + this.contentType = contentType + this.headers += `content-type: ${contentType}\r\n` + } + this.body = bodyStream.stream + this.contentLength = bodyStream.length + } else if (util.isBlobLike(body) && this.contentType == null && body.type) { + this.contentType = body.type + this.headers += `content-type: ${body.type}\r\n` + } - // 3. If includeCredentials is true and the user agent is not configured - // to block cookies for request (see section 7 of [COOKIES]), then run the - // "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on - // the value of each header whose name is a byte-case-insensitive match for - // `Set-Cookie` in response’s header list, if any, and request’s current URL. - // TODO + util.validateHandler(handler, method, upgrade) - // 18. If aborted, then: - // TODO + this.servername = util.getServerName(this.host) - // 19. Run these steps in parallel: + this[kHandler] = handler - // 1. Run these steps, but abort when fetchParams is canceled: - fetchParams.controller.on('terminated', onAborted) - fetchParams.controller.resume = async () => { - // 1. While true - while (true) { - // 1-3. See onData... + if (channels.create.hasSubscribers) { + channels.create.publish({ request: this }) + } + } - // 4. Set bytes to the result of handling content codings given - // codings and bytes. - let bytes - let isFailure + onBodySent (chunk) { + if (this[kHandler].onBodySent) { try { - const { done, value } = await fetchParams.controller.next() - - if (isAborted(fetchParams)) { - break - } - - bytes = done ? undefined : value + return this[kHandler].onBodySent(chunk) } catch (err) { - if (fetchParams.controller.ended && !timingInfo.encodedBodySize) { - // zlib doesn't like empty streams. - bytes = undefined - } else { - bytes = err - - // err may be propagated from the result of calling readablestream.cancel, - // which might not be an error. https://github.com/nodejs/undici/issues/2009 - isFailure = true - } + this.abort(err) } + } + } - if (bytes === undefined) { - // 2. Otherwise, if the bytes transmission for response’s message - // body is done normally and stream is readable, then close - // stream, finalize response for fetchParams and response, and - // abort these in-parallel steps. - readableStreamClose(fetchParams.controller.controller) - - finalizeResponse(fetchParams, response) + onRequestSent () { + if (channels.bodySent.hasSubscribers) { + channels.bodySent.publish({ request: this }) + } - return + if (this[kHandler].onRequestSent) { + try { + return this[kHandler].onRequestSent() + } catch (err) { + this.abort(err) } + } + } - // 5. Increase timingInfo’s decoded body size by bytes’s length. - timingInfo.decodedBodySize += bytes?.byteLength ?? 0 + onConnect (abort) { + assert(!this.aborted) + assert(!this.completed) - // 6. If bytes is failure, then terminate fetchParams’s controller. - if (isFailure) { - fetchParams.controller.terminate(bytes) - return - } + if (this.error) { + abort(this.error) + } else { + this.abort = abort + return this[kHandler].onConnect(abort) + } + } - // 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes - // into stream. - fetchParams.controller.controller.enqueue(new Uint8Array(bytes)) + onHeaders (statusCode, headers, resume, statusText) { + assert(!this.aborted) + assert(!this.completed) - // 8. If stream is errored, then terminate the ongoing fetch. - if (isErrored(stream)) { - fetchParams.controller.terminate() - return - } + if (channels.headers.hasSubscribers) { + channels.headers.publish({ request: this, response: { statusCode, headers, statusText } }) + } - // 9. If stream doesn’t need more data ask the user agent to suspend - // the ongoing fetch. - if (!fetchParams.controller.controller.desiredSize) { - return - } + try { + return this[kHandler].onHeaders(statusCode, headers, resume, statusText) + } catch (err) { + this.abort(err) } } - // 2. If aborted, then: - function onAborted (reason) { - // 2. If fetchParams is aborted, then: - if (isAborted(fetchParams)) { - // 1. Set response’s aborted flag. - response.aborted = true + onData (chunk) { + assert(!this.aborted) + assert(!this.completed) - // 2. If stream is readable, then error stream with the result of - // deserialize a serialized abort reason given fetchParams’s - // controller’s serialized abort reason and an - // implementation-defined realm. - if (isReadable(stream)) { - fetchParams.controller.controller.error( - fetchParams.controller.serializedAbortReason - ) - } - } else { - // 3. Otherwise, if stream is readable, error stream with a TypeError. - if (isReadable(stream)) { - fetchParams.controller.controller.error(new TypeError('terminated', { - cause: isErrorLike(reason) ? reason : undefined - })) - } + try { + return this[kHandler].onData(chunk) + } catch (err) { + this.abort(err) + return false } - - // 4. If connection uses HTTP/2, then transmit an RST_STREAM frame. - // 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so. - fetchParams.controller.connection.destroy() } - // 20. Return response. - return response + onUpgrade (statusCode, headers, socket) { + assert(!this.aborted) + assert(!this.completed) - async function dispatch ({ body }) { - const url = requestCurrentURL(request) - /** @type {import('../..').Agent} */ - const agent = fetchParams.controller.dispatcher + return this[kHandler].onUpgrade(statusCode, headers, socket) + } - return new Promise((resolve, reject) => agent.dispatch( - { - path: url.pathname + url.search, - origin: url.origin, - method: request.method, - body: fetchParams.controller.dispatcher.isMockActive ? request.body && (request.body.source || request.body.stream) : body, - headers: request.headersList.entries, - maxRedirections: 0, - upgrade: request.mode === 'websocket' ? 'websocket' : undefined - }, - { - body: null, - abort: null, + onComplete (trailers) { + this.onFinally() - onConnect (abort) { - // TODO (fix): Do we need connection here? - const { connection } = fetchParams.controller - - if (connection.destroyed) { - abort(new DOMException('The operation was aborted.', 'AbortError')) - } else { - fetchParams.controller.on('terminated', abort) - this.abort = connection.abort = abort - } - }, - - onHeaders (status, headersList, resume, statusText) { - if (status < 200) { - return - } - - let codings = [] - let location = '' - - const headers = new Headers() - - // For H2, the headers are a plain JS object - // We distinguish between them and iterate accordingly - if (Array.isArray(headersList)) { - for (let n = 0; n < headersList.length; n += 2) { - const key = headersList[n + 0].toString('latin1') - const val = headersList[n + 1].toString('latin1') - if (key.toLowerCase() === 'content-encoding') { - // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1 - // "All content-coding values are case-insensitive..." - codings = val.toLowerCase().split(',').map((x) => x.trim()) - } else if (key.toLowerCase() === 'location') { - location = val - } - - headers[kHeadersList].append(key, val) - } - } else { - const keys = Object.keys(headersList) - for (const key of keys) { - const val = headersList[key] - if (key.toLowerCase() === 'content-encoding') { - // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1 - // "All content-coding values are case-insensitive..." - codings = val.toLowerCase().split(',').map((x) => x.trim()).reverse() - } else if (key.toLowerCase() === 'location') { - location = val - } - - headers[kHeadersList].append(key, val) - } - } + assert(!this.aborted) - this.body = new Readable({ read: resume }) + this.completed = true + if (channels.trailers.hasSubscribers) { + channels.trailers.publish({ request: this, trailers }) + } - const decoders = [] + try { + return this[kHandler].onComplete(trailers) + } catch (err) { + // TODO (fix): This might be a bad idea? + this.onError(err) + } + } - const willFollow = request.redirect === 'follow' && - location && - redirectStatusSet.has(status) + onError (error) { + this.onFinally() - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding - if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) { - for (const coding of codings) { - // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2 - if (coding === 'x-gzip' || coding === 'gzip') { - decoders.push(zlib.createGunzip({ - // Be less strict when decoding compressed responses, since sometimes - // servers send slightly invalid responses that are still accepted - // by common browsers. - // Always using Z_SYNC_FLUSH is what cURL does. - flush: zlib.constants.Z_SYNC_FLUSH, - finishFlush: zlib.constants.Z_SYNC_FLUSH - })) - } else if (coding === 'deflate') { - decoders.push(zlib.createInflate()) - } else if (coding === 'br') { - decoders.push(zlib.createBrotliDecompress()) - } else { - decoders.length = 0 - break - } - } - } + if (channels.error.hasSubscribers) { + channels.error.publish({ request: this, error }) + } - resolve({ - status, - statusText, - headersList: headers[kHeadersList], - body: decoders.length - ? pipeline(this.body, ...decoders, () => { }) - : this.body.on('error', () => {}) - }) + if (this.aborted) { + return + } + this.aborted = true - return true - }, + return this[kHandler].onError(error) + } - onData (chunk) { - if (fetchParams.controller.dump) { - return - } + onFinally () { + if (this.errorHandler) { + this.body.off('error', this.errorHandler) + this.errorHandler = null + } - // 1. If one or more bytes have been transmitted from response’s - // message body, then: + if (this.endHandler) { + this.body.off('end', this.endHandler) + this.endHandler = null + } + } - // 1. Let bytes be the transmitted bytes. - const bytes = chunk + // TODO: adjust to support H2 + addHeader (key, value) { + processHeader(this, key, value) + return this + } - // 2. Let codings be the result of extracting header list values - // given `Content-Encoding` and response’s header list. - // See pullAlgorithm. + static [kHTTP1BuildRequest] (origin, opts, handler) { + // TODO: Migrate header parsing here, to make Requests + // HTTP agnostic + return new Request(origin, opts, handler) + } - // 3. Increase timingInfo’s encoded body size by bytes’s length. - timingInfo.encodedBodySize += bytes.byteLength + static [kHTTP2BuildRequest] (origin, opts, handler) { + const headers = opts.headers + opts = { ...opts, headers: null } - // 4. See pullAlgorithm... + const request = new Request(origin, opts, handler) - return this.body.push(bytes) - }, + request.headers = {} - onComplete () { - if (this.abort) { - fetchParams.controller.off('terminated', this.abort) - } + if (Array.isArray(headers)) { + if (headers.length % 2 !== 0) { + throw new InvalidArgumentError('headers array must be even') + } + for (let i = 0; i < headers.length; i += 2) { + processHeader(request, headers[i], headers[i + 1], true) + } + } else if (headers && typeof headers === 'object') { + const keys = Object.keys(headers) + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + processHeader(request, key, headers[key], true) + } + } else if (headers != null) { + throw new InvalidArgumentError('headers must be an object or an array') + } - fetchParams.controller.ended = true + return request + } - this.body.push(null) - }, + static [kHTTP2CopyHeaders] (raw) { + const rawHeaders = raw.split('\r\n') + const headers = {} - onError (error) { - if (this.abort) { - fetchParams.controller.off('terminated', this.abort) - } + for (const header of rawHeaders) { + const [key, value] = header.split(': ') - this.body?.destroy(error) + if (value == null || value.length === 0) continue - fetchParams.controller.terminate(error) + if (headers[key]) headers[key] += `,${value}` + else headers[key] = value + } - reject(error) - }, + return headers + } +} - onUpgrade (status, headersList, socket) { - if (status !== 101) { - return - } +function processHeaderValue (key, val, skipAppend) { + if (val && typeof val === 'object') { + throw new InvalidArgumentError(`invalid ${key} header`) + } - const headers = new Headers() + val = val != null ? `${val}` : '' - for (let n = 0; n < headersList.length; n += 2) { - const key = headersList[n + 0].toString('latin1') - const val = headersList[n + 1].toString('latin1') + if (headerCharRegex.exec(val) !== null) { + throw new InvalidArgumentError(`invalid ${key} header`) + } - headers[kHeadersList].append(key, val) - } + return skipAppend ? val : `${key}: ${val}\r\n` +} - resolve({ - status, - statusText: STATUS_CODES[status], - headersList: headers[kHeadersList], - socket - }) +function processHeader (request, key, val, skipAppend = false) { + if (val && (typeof val === 'object' && !Array.isArray(val))) { + throw new InvalidArgumentError(`invalid ${key} header`) + } else if (val === undefined) { + return + } - return true + if ( + request.host === null && + key.length === 4 && + key.toLowerCase() === 'host' + ) { + if (headerCharRegex.exec(val) !== null) { + throw new InvalidArgumentError(`invalid ${key} header`) + } + // Consumed by Client + request.host = val + } else if ( + request.contentLength === null && + key.length === 14 && + key.toLowerCase() === 'content-length' + ) { + request.contentLength = parseInt(val, 10) + if (!Number.isFinite(request.contentLength)) { + throw new InvalidArgumentError('invalid content-length header') + } + } else if ( + request.contentType === null && + key.length === 12 && + key.toLowerCase() === 'content-type' + ) { + request.contentType = val + if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) + else request.headers += processHeaderValue(key, val) + } else if ( + key.length === 17 && + key.toLowerCase() === 'transfer-encoding' + ) { + throw new InvalidArgumentError('invalid transfer-encoding header') + } else if ( + key.length === 10 && + key.toLowerCase() === 'connection' + ) { + const value = typeof val === 'string' ? val.toLowerCase() : null + if (value !== 'close' && value !== 'keep-alive') { + throw new InvalidArgumentError('invalid connection header') + } else if (value === 'close') { + request.reset = true + } + } else if ( + key.length === 10 && + key.toLowerCase() === 'keep-alive' + ) { + throw new InvalidArgumentError('invalid keep-alive header') + } else if ( + key.length === 7 && + key.toLowerCase() === 'upgrade' + ) { + throw new InvalidArgumentError('invalid upgrade header') + } else if ( + key.length === 6 && + key.toLowerCase() === 'expect' + ) { + throw new NotSupportedError('expect header not supported') + } else if (tokenRegExp.exec(key) === null) { + throw new InvalidArgumentError('invalid header key') + } else { + if (Array.isArray(val)) { + for (let i = 0; i < val.length; i++) { + if (skipAppend) { + if (request.headers[key]) request.headers[key] += `,${processHeaderValue(key, val[i], skipAppend)}` + else request.headers[key] = processHeaderValue(key, val[i], skipAppend) + } else { + request.headers += processHeaderValue(key, val[i]) } } - )) + } else { + if (skipAppend) request.headers[key] = processHeaderValue(key, val, skipAppend) + else request.headers += processHeaderValue(key, val) + } } } +module.exports = Request + + +/***/ }), + +/***/ 72785: +/***/ ((module) => { + module.exports = { - fetch, - Fetch, - fetching, - finalizeAndReportTiming + kClose: Symbol('close'), + kDestroy: Symbol('destroy'), + kDispatch: Symbol('dispatch'), + kUrl: Symbol('url'), + kWriting: Symbol('writing'), + kResuming: Symbol('resuming'), + kQueue: Symbol('queue'), + kConnect: Symbol('connect'), + kConnecting: Symbol('connecting'), + kHeadersList: Symbol('headers list'), + kKeepAliveDefaultTimeout: Symbol('default keep alive timeout'), + kKeepAliveMaxTimeout: Symbol('max keep alive timeout'), + kKeepAliveTimeoutThreshold: Symbol('keep alive timeout threshold'), + kKeepAliveTimeoutValue: Symbol('keep alive timeout'), + kKeepAlive: Symbol('keep alive'), + kHeadersTimeout: Symbol('headers timeout'), + kBodyTimeout: Symbol('body timeout'), + kServerName: Symbol('server name'), + kLocalAddress: Symbol('local address'), + kHost: Symbol('host'), + kNoRef: Symbol('no ref'), + kBodyUsed: Symbol('used'), + kRunning: Symbol('running'), + kBlocking: Symbol('blocking'), + kPending: Symbol('pending'), + kSize: Symbol('size'), + kBusy: Symbol('busy'), + kQueued: Symbol('queued'), + kFree: Symbol('free'), + kConnected: Symbol('connected'), + kClosed: Symbol('closed'), + kNeedDrain: Symbol('need drain'), + kReset: Symbol('reset'), + kDestroyed: Symbol.for('nodejs.stream.destroyed'), + kMaxHeadersSize: Symbol('max headers size'), + kRunningIdx: Symbol('running index'), + kPendingIdx: Symbol('pending index'), + kError: Symbol('error'), + kClients: Symbol('clients'), + kClient: Symbol('client'), + kParser: Symbol('parser'), + kOnDestroyed: Symbol('destroy callbacks'), + kPipelining: Symbol('pipelining'), + kSocket: Symbol('socket'), + kHostHeader: Symbol('host header'), + kConnector: Symbol('connector'), + kStrictContentLength: Symbol('strict content length'), + kMaxRedirections: Symbol('maxRedirections'), + kMaxRequests: Symbol('maxRequestsPerClient'), + kProxy: Symbol('proxy agent options'), + kCounter: Symbol('socket request counter'), + kInterceptors: Symbol('dispatch interceptors'), + kMaxResponseSize: Symbol('max response size'), + kHTTP2Session: Symbol('http2Session'), + kHTTP2SessionState: Symbol('http2Session state'), + kHTTP2BuildRequest: Symbol('http2 build request'), + kHTTP1BuildRequest: Symbol('http1 build request'), + kHTTP2CopyHeaders: Symbol('http2 copy headers'), + kHTTPConnVersion: Symbol('http connection version'), + kRetryHandlerDefaultRetry: Symbol('retry agent default retry'), + kConstruct: Symbol('constructable') } /***/ }), -/***/ 48359: +/***/ 83983: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/* globals AbortController */ - -const { extractBody, mixinBody, cloneBody } = __nccwpck_require__(41472) -const { Headers, fill: fillHeaders, HeadersList } = __nccwpck_require__(10554) -const { FinalizationRegistry } = __nccwpck_require__(56436)() -const util = __nccwpck_require__(83983) -const { - isValidHTTPToken, - sameOrigin, - normalizeMethod, - makePolicyContainer, - normalizeMethodRecord -} = __nccwpck_require__(52538) -const { - forbiddenMethodsSet, - corsSafeListedMethodsSet, - referrerPolicy, - requestRedirect, - requestMode, - requestCredentials, - requestCache, - requestDuplex -} = __nccwpck_require__(41037) -const { kEnumerableProperty } = util -const { kHeaders, kSignal, kState, kGuard, kRealm } = __nccwpck_require__(15861) -const { webidl } = __nccwpck_require__(21744) -const { getGlobalOrigin } = __nccwpck_require__(71246) -const { URLSerializer } = __nccwpck_require__(685) -const { kHeadersList, kConstruct } = __nccwpck_require__(72785) const assert = __nccwpck_require__(39491) -const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(82361) +const { kDestroyed, kBodyUsed } = __nccwpck_require__(72785) +const { IncomingMessage } = __nccwpck_require__(13685) +const stream = __nccwpck_require__(12781) +const net = __nccwpck_require__(41808) +const { InvalidArgumentError } = __nccwpck_require__(48045) +const { Blob } = __nccwpck_require__(14300) +const nodeUtil = __nccwpck_require__(73837) +const { stringify } = __nccwpck_require__(63477) +const { headerNameLowerCasedRecord } = __nccwpck_require__(14462) -let TransformStream = globalThis.TransformStream +const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) -const kAbortController = Symbol('abortController') +function nop () {} -const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => { - signal.removeEventListener('abort', abort) -}) +function isStream (obj) { + return obj && typeof obj === 'object' && typeof obj.pipe === 'function' && typeof obj.on === 'function' +} -// https://fetch.spec.whatwg.org/#request-class -class Request { - // https://fetch.spec.whatwg.org/#dom-request - constructor (input, init = {}) { - if (input === kConstruct) { - return - } +// based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License) +function isBlobLike (object) { + return (Blob && object instanceof Blob) || ( + object && + typeof object === 'object' && + (typeof object.stream === 'function' || + typeof object.arrayBuffer === 'function') && + /^(Blob|File)$/.test(object[Symbol.toStringTag]) + ) +} - webidl.argumentLengthCheck(arguments, 1, { header: 'Request constructor' }) +function buildURL (url, queryParams) { + if (url.includes('?') || url.includes('#')) { + throw new Error('Query params cannot be passed when url already contains "?" or "#".') + } - input = webidl.converters.RequestInfo(input) - init = webidl.converters.RequestInit(init) + const stringified = stringify(queryParams) - // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object - this[kRealm] = { - settingsObject: { - baseUrl: getGlobalOrigin(), - get origin () { - return this.baseUrl?.origin - }, - policyContainer: makePolicyContainer() - } - } + if (stringified) { + url += '?' + stringified + } - // 1. Let request be null. - let request = null + return url +} - // 2. Let fallbackMode be null. - let fallbackMode = null +function parseURL (url) { + if (typeof url === 'string') { + url = new URL(url) - // 3. Let baseURL be this’s relevant settings object’s API base URL. - const baseUrl = this[kRealm].settingsObject.baseUrl + if (!/^https?:/.test(url.origin || url.protocol)) { + throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.') + } - // 4. Let signal be null. - let signal = null + return url + } - // 5. If input is a string, then: - if (typeof input === 'string') { - // 1. Let parsedURL be the result of parsing input with baseURL. - // 2. If parsedURL is failure, then throw a TypeError. - let parsedURL - try { - parsedURL = new URL(input, baseUrl) - } catch (err) { - throw new TypeError('Failed to parse URL from ' + input, { cause: err }) - } + if (!url || typeof url !== 'object') { + throw new InvalidArgumentError('Invalid URL: The URL argument must be a non-null object.') + } - // 3. If parsedURL includes credentials, then throw a TypeError. - if (parsedURL.username || parsedURL.password) { - throw new TypeError( - 'Request cannot be constructed from a URL that includes credentials: ' + - input - ) - } + if (!/^https?:/.test(url.origin || url.protocol)) { + throw new InvalidArgumentError('Invalid URL protocol: the URL must start with `http:` or `https:`.') + } - // 4. Set request to a new request whose URL is parsedURL. - request = makeRequest({ urlList: [parsedURL] }) + if (!(url instanceof URL)) { + if (url.port != null && url.port !== '' && !Number.isFinite(parseInt(url.port))) { + throw new InvalidArgumentError('Invalid URL: port must be a valid integer or a string representation of an integer.') + } - // 5. Set fallbackMode to "cors". - fallbackMode = 'cors' - } else { - // 6. Otherwise: - - // 7. Assert: input is a Request object. - assert(input instanceof Request) - - // 8. Set request to input’s request. - request = input[kState] - - // 9. Set signal to input’s signal. - signal = input[kSignal] + if (url.path != null && typeof url.path !== 'string') { + throw new InvalidArgumentError('Invalid URL path: the path must be a string or null/undefined.') } - // 7. Let origin be this’s relevant settings object’s origin. - const origin = this[kRealm].settingsObject.origin - - // 8. Let window be "client". - let window = 'client' + if (url.pathname != null && typeof url.pathname !== 'string') { + throw new InvalidArgumentError('Invalid URL pathname: the pathname must be a string or null/undefined.') + } - // 9. If request’s window is an environment settings object and its origin - // is same origin with origin, then set window to request’s window. - if ( - request.window?.constructor?.name === 'EnvironmentSettingsObject' && - sameOrigin(request.window, origin) - ) { - window = request.window + if (url.hostname != null && typeof url.hostname !== 'string') { + throw new InvalidArgumentError('Invalid URL hostname: the hostname must be a string or null/undefined.') } - // 10. If init["window"] exists and is non-null, then throw a TypeError. - if (init.window != null) { - throw new TypeError(`'window' option '${window}' must be null`) + if (url.origin != null && typeof url.origin !== 'string') { + throw new InvalidArgumentError('Invalid URL origin: the origin must be a string or null/undefined.') } - // 11. If init["window"] exists, then set window to "no-window". - if ('window' in init) { - window = 'no-window' + const port = url.port != null + ? url.port + : (url.protocol === 'https:' ? 443 : 80) + let origin = url.origin != null + ? url.origin + : `${url.protocol}//${url.hostname}:${port}` + let path = url.path != null + ? url.path + : `${url.pathname || ''}${url.search || ''}` + + if (origin.endsWith('/')) { + origin = origin.substring(0, origin.length - 1) } - // 12. Set request to a new request with the following properties: - request = makeRequest({ - // URL request’s URL. - // undici implementation note: this is set as the first item in request's urlList in makeRequest - // method request’s method. - method: request.method, - // header list A copy of request’s header list. - // undici implementation note: headersList is cloned in makeRequest - headersList: request.headersList, - // unsafe-request flag Set. - unsafeRequest: request.unsafeRequest, - // client This’s relevant settings object. - client: this[kRealm].settingsObject, - // window window. - window, - // priority request’s priority. - priority: request.priority, - // origin request’s origin. The propagation of the origin is only significant for navigation requests - // being handled by a service worker. In this scenario a request can have an origin that is different - // from the current client. - origin: request.origin, - // referrer request’s referrer. - referrer: request.referrer, - // referrer policy request’s referrer policy. - referrerPolicy: request.referrerPolicy, - // mode request’s mode. - mode: request.mode, - // credentials mode request’s credentials mode. - credentials: request.credentials, - // cache mode request’s cache mode. - cache: request.cache, - // redirect mode request’s redirect mode. - redirect: request.redirect, - // integrity metadata request’s integrity metadata. - integrity: request.integrity, - // keepalive request’s keepalive. - keepalive: request.keepalive, - // reload-navigation flag request’s reload-navigation flag. - reloadNavigation: request.reloadNavigation, - // history-navigation flag request’s history-navigation flag. - historyNavigation: request.historyNavigation, - // URL list A clone of request’s URL list. - urlList: [...request.urlList] - }) + if (path && !path.startsWith('/')) { + path = `/${path}` + } + // new URL(path, origin) is unsafe when `path` contains an absolute URL + // From https://developer.mozilla.org/en-US/docs/Web/API/URL/URL: + // If first parameter is a relative URL, second param is required, and will be used as the base URL. + // If first parameter is an absolute URL, a given second param will be ignored. + url = new URL(origin + path) + } - const initHasKey = Object.keys(init).length !== 0 + return url +} - // 13. If init is not empty, then: - if (initHasKey) { - // 1. If request’s mode is "navigate", then set it to "same-origin". - if (request.mode === 'navigate') { - request.mode = 'same-origin' - } +function parseOrigin (url) { + url = parseURL(url) - // 2. Unset request’s reload-navigation flag. - request.reloadNavigation = false + if (url.pathname !== '/' || url.search || url.hash) { + throw new InvalidArgumentError('invalid url') + } - // 3. Unset request’s history-navigation flag. - request.historyNavigation = false + return url +} - // 4. Set request’s origin to "client". - request.origin = 'client' +function getHostname (host) { + if (host[0] === '[') { + const idx = host.indexOf(']') - // 5. Set request’s referrer to "client" - request.referrer = 'client' + assert(idx !== -1) + return host.substring(1, idx) + } - // 6. Set request’s referrer policy to the empty string. - request.referrerPolicy = '' + const idx = host.indexOf(':') + if (idx === -1) return host - // 7. Set request’s URL to request’s current URL. - request.url = request.urlList[request.urlList.length - 1] + return host.substring(0, idx) +} - // 8. Set request’s URL list to « request’s URL ». - request.urlList = [request.url] - } +// IP addresses are not valid server names per RFC6066 +// > Currently, the only server names supported are DNS hostnames +function getServerName (host) { + if (!host) { + return null + } - // 14. If init["referrer"] exists, then: - if (init.referrer !== undefined) { - // 1. Let referrer be init["referrer"]. - const referrer = init.referrer + assert.strictEqual(typeof host, 'string') - // 2. If referrer is the empty string, then set request’s referrer to "no-referrer". - if (referrer === '') { - request.referrer = 'no-referrer' - } else { - // 1. Let parsedReferrer be the result of parsing referrer with - // baseURL. - // 2. If parsedReferrer is failure, then throw a TypeError. - let parsedReferrer - try { - parsedReferrer = new URL(referrer, baseUrl) - } catch (err) { - throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }) - } + const servername = getHostname(host) + if (net.isIP(servername)) { + return '' + } - // 3. If one of the following is true - // - parsedReferrer’s scheme is "about" and path is the string "client" - // - parsedReferrer’s origin is not same origin with origin - // then set request’s referrer to "client". - if ( - (parsedReferrer.protocol === 'about:' && parsedReferrer.hostname === 'client') || - (origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) - ) { - request.referrer = 'client' - } else { - // 4. Otherwise, set request’s referrer to parsedReferrer. - request.referrer = parsedReferrer - } - } - } + return servername +} - // 15. If init["referrerPolicy"] exists, then set request’s referrer policy - // to it. - if (init.referrerPolicy !== undefined) { - request.referrerPolicy = init.referrerPolicy - } +function deepClone (obj) { + return JSON.parse(JSON.stringify(obj)) +} - // 16. Let mode be init["mode"] if it exists, and fallbackMode otherwise. - let mode - if (init.mode !== undefined) { - mode = init.mode - } else { - mode = fallbackMode - } +function isAsyncIterable (obj) { + return !!(obj != null && typeof obj[Symbol.asyncIterator] === 'function') +} - // 17. If mode is "navigate", then throw a TypeError. - if (mode === 'navigate') { - throw webidl.errors.exception({ - header: 'Request constructor', - message: 'invalid request mode navigate.' - }) - } +function isIterable (obj) { + return !!(obj != null && (typeof obj[Symbol.iterator] === 'function' || typeof obj[Symbol.asyncIterator] === 'function')) +} - // 18. If mode is non-null, set request’s mode to mode. - if (mode != null) { - request.mode = mode - } +function bodyLength (body) { + if (body == null) { + return 0 + } else if (isStream(body)) { + const state = body._readableState + return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length) + ? state.length + : null + } else if (isBlobLike(body)) { + return body.size != null ? body.size : null + } else if (isBuffer(body)) { + return body.byteLength + } - // 19. If init["credentials"] exists, then set request’s credentials mode - // to it. - if (init.credentials !== undefined) { - request.credentials = init.credentials - } + return null +} - // 18. If init["cache"] exists, then set request’s cache mode to it. - if (init.cache !== undefined) { - request.cache = init.cache - } +function isDestroyed (stream) { + return !stream || !!(stream.destroyed || stream[kDestroyed]) +} - // 21. If request’s cache mode is "only-if-cached" and request’s mode is - // not "same-origin", then throw a TypeError. - if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') { - throw new TypeError( - "'only-if-cached' can be set only with 'same-origin' mode" - ) - } +function isReadableAborted (stream) { + const state = stream && stream._readableState + return isDestroyed(stream) && state && !state.endEmitted +} - // 22. If init["redirect"] exists, then set request’s redirect mode to it. - if (init.redirect !== undefined) { - request.redirect = init.redirect - } +function destroy (stream, err) { + if (stream == null || !isStream(stream) || isDestroyed(stream)) { + return + } - // 23. If init["integrity"] exists, then set request’s integrity metadata to it. - if (init.integrity != null) { - request.integrity = String(init.integrity) + if (typeof stream.destroy === 'function') { + if (Object.getPrototypeOf(stream).constructor === IncomingMessage) { + // See: https://github.com/nodejs/node/pull/38505/files + stream.socket = null } - // 24. If init["keepalive"] exists, then set request’s keepalive to it. - if (init.keepalive !== undefined) { - request.keepalive = Boolean(init.keepalive) - } + stream.destroy(err) + } else if (err) { + process.nextTick((stream, err) => { + stream.emit('error', err) + }, stream, err) + } - // 25. If init["method"] exists, then: - if (init.method !== undefined) { - // 1. Let method be init["method"]. - let method = init.method + if (stream.destroyed !== true) { + stream[kDestroyed] = true + } +} - // 2. If method is not a method or method is a forbidden method, then - // throw a TypeError. - if (!isValidHTTPToken(method)) { - throw new TypeError(`'${method}' is not a valid HTTP method.`) - } +const KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/ +function parseKeepAliveTimeout (val) { + const m = val.toString().match(KEEPALIVE_TIMEOUT_EXPR) + return m ? parseInt(m[1], 10) * 1000 : null +} - if (forbiddenMethodsSet.has(method.toUpperCase())) { - throw new TypeError(`'${method}' HTTP method is unsupported.`) - } +/** + * Retrieves a header name and returns its lowercase value. + * @param {string | Buffer} value Header name + * @returns {string} + */ +function headerNameToString (value) { + return headerNameLowerCasedRecord[value] || value.toLowerCase() +} - // 3. Normalize method. - method = normalizeMethodRecord[method] ?? normalizeMethod(method) +function parseHeaders (headers, obj = {}) { + // For H2 support + if (!Array.isArray(headers)) return headers - // 4. Set request’s method to method. - request.method = method - } + for (let i = 0; i < headers.length; i += 2) { + const key = headers[i].toString().toLowerCase() + let val = obj[key] - // 26. If init["signal"] exists, then set signal to it. - if (init.signal !== undefined) { - signal = init.signal + if (!val) { + if (Array.isArray(headers[i + 1])) { + obj[key] = headers[i + 1].map(x => x.toString('utf8')) + } else { + obj[key] = headers[i + 1].toString('utf8') + } + } else { + if (!Array.isArray(val)) { + val = [val] + obj[key] = val + } + val.push(headers[i + 1].toString('utf8')) } + } - // 27. Set this’s request to request. - this[kState] = request + // See https://github.com/nodejs/node/pull/46528 + if ('content-length' in obj && 'content-disposition' in obj) { + obj['content-disposition'] = Buffer.from(obj['content-disposition']).toString('latin1') + } - // 28. Set this’s signal to a new AbortSignal object with this’s relevant - // Realm. - // TODO: could this be simplified with AbortSignal.any - // (https://dom.spec.whatwg.org/#dom-abortsignal-any) - const ac = new AbortController() - this[kSignal] = ac.signal - this[kSignal][kRealm] = this[kRealm] + return obj +} - // 29. If signal is not null, then make this’s signal follow signal. - if (signal != null) { - if ( - !signal || - typeof signal.aborted !== 'boolean' || - typeof signal.addEventListener !== 'function' - ) { - throw new TypeError( - "Failed to construct 'Request': member signal is not of type AbortSignal." - ) - } +function parseRawHeaders (headers) { + const ret = [] + let hasContentLength = false + let contentDispositionIdx = -1 - if (signal.aborted) { - ac.abort(signal.reason) - } else { - // Keep a strong ref to ac while request object - // is alive. This is needed to prevent AbortController - // from being prematurely garbage collected. - // See, https://github.com/nodejs/undici/issues/1926. - this[kAbortController] = ac + for (let n = 0; n < headers.length; n += 2) { + const key = headers[n + 0].toString() + const val = headers[n + 1].toString('utf8') - const acRef = new WeakRef(ac) - const abort = function () { - const ac = acRef.deref() - if (ac !== undefined) { - ac.abort(this.reason) - } - } + if (key.length === 14 && (key === 'content-length' || key.toLowerCase() === 'content-length')) { + ret.push(key, val) + hasContentLength = true + } else if (key.length === 19 && (key === 'content-disposition' || key.toLowerCase() === 'content-disposition')) { + contentDispositionIdx = ret.push(key, val) - 1 + } else { + ret.push(key, val) + } + } - // Third-party AbortControllers may not work with these. - // See, https://github.com/nodejs/undici/pull/1910#issuecomment-1464495619. - try { - // If the max amount of listeners is equal to the default, increase it - // This is only available in node >= v19.9.0 - if (typeof getMaxListeners === 'function' && getMaxListeners(signal) === defaultMaxListeners) { - setMaxListeners(100, signal) - } else if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) { - setMaxListeners(100, signal) - } - } catch {} + // See https://github.com/nodejs/node/pull/46528 + if (hasContentLength && contentDispositionIdx !== -1) { + ret[contentDispositionIdx] = Buffer.from(ret[contentDispositionIdx]).toString('latin1') + } - util.addAbortListener(signal, abort) - requestFinalizer.register(ac, { signal, abort }) - } - } + return ret +} - // 30. Set this’s headers to a new Headers object with this’s relevant - // Realm, whose header list is request’s header list and guard is - // "request". - this[kHeaders] = new Headers(kConstruct) - this[kHeaders][kHeadersList] = request.headersList - this[kHeaders][kGuard] = 'request' - this[kHeaders][kRealm] = this[kRealm] +function isBuffer (buffer) { + // See, https://github.com/mcollina/undici/pull/319 + return buffer instanceof Uint8Array || Buffer.isBuffer(buffer) +} - // 31. If this’s request’s mode is "no-cors", then: - if (mode === 'no-cors') { - // 1. If this’s request’s method is not a CORS-safelisted method, - // then throw a TypeError. - if (!corsSafeListedMethodsSet.has(request.method)) { - throw new TypeError( - `'${request.method} is unsupported in no-cors mode.` - ) - } +function validateHandler (handler, method, upgrade) { + if (!handler || typeof handler !== 'object') { + throw new InvalidArgumentError('handler must be an object') + } - // 2. Set this’s headers’s guard to "request-no-cors". - this[kHeaders][kGuard] = 'request-no-cors' - } + if (typeof handler.onConnect !== 'function') { + throw new InvalidArgumentError('invalid onConnect method') + } - // 32. If init is not empty, then: - if (initHasKey) { - /** @type {HeadersList} */ - const headersList = this[kHeaders][kHeadersList] - // 1. Let headers be a copy of this’s headers and its associated header - // list. - // 2. If init["headers"] exists, then set headers to init["headers"]. - const headers = init.headers !== undefined ? init.headers : new HeadersList(headersList) + if (typeof handler.onError !== 'function') { + throw new InvalidArgumentError('invalid onError method') + } - // 3. Empty this’s headers’s header list. - headersList.clear() + if (typeof handler.onBodySent !== 'function' && handler.onBodySent !== undefined) { + throw new InvalidArgumentError('invalid onBodySent method') + } - // 4. If headers is a Headers object, then for each header in its header - // list, append header’s name/header’s value to this’s headers. - if (headers instanceof HeadersList) { - for (const [key, val] of headers) { - headersList.append(key, val) - } - // Note: Copy the `set-cookie` meta-data. - headersList.cookies = headers.cookies - } else { - // 5. Otherwise, fill this’s headers with headers. - fillHeaders(this[kHeaders], headers) - } + if (upgrade || method === 'CONNECT') { + if (typeof handler.onUpgrade !== 'function') { + throw new InvalidArgumentError('invalid onUpgrade method') + } + } else { + if (typeof handler.onHeaders !== 'function') { + throw new InvalidArgumentError('invalid onHeaders method') } - // 33. Let inputBody be input’s request’s body if input is a Request - // object; otherwise null. - const inputBody = input instanceof Request ? input[kState].body : null - - // 34. If either init["body"] exists and is non-null or inputBody is - // non-null, and request’s method is `GET` or `HEAD`, then throw a - // TypeError. - if ( - (init.body != null || inputBody != null) && - (request.method === 'GET' || request.method === 'HEAD') - ) { - throw new TypeError('Request with GET/HEAD method cannot have body.') + if (typeof handler.onData !== 'function') { + throw new InvalidArgumentError('invalid onData method') } - // 35. Let initBody be null. - let initBody = null + if (typeof handler.onComplete !== 'function') { + throw new InvalidArgumentError('invalid onComplete method') + } + } +} - // 36. If init["body"] exists and is non-null, then: - if (init.body != null) { - // 1. Let Content-Type be null. - // 2. Set initBody and Content-Type to the result of extracting - // init["body"], with keepalive set to request’s keepalive. - const [extractedBody, contentType] = extractBody( - init.body, - request.keepalive - ) - initBody = extractedBody +// A body is disturbed if it has been read from and it cannot +// be re-used without losing state or data. +function isDisturbed (body) { + return !!(body && ( + stream.isDisturbed + ? stream.isDisturbed(body) || body[kBodyUsed] // TODO (fix): Why is body[kBodyUsed] needed? + : body[kBodyUsed] || + body.readableDidRead || + (body._readableState && body._readableState.dataEmitted) || + isReadableAborted(body) + )) +} - // 3, If Content-Type is non-null and this’s headers’s header list does - // not contain `Content-Type`, then append `Content-Type`/Content-Type to - // this’s headers. - if (contentType && !this[kHeaders][kHeadersList].contains('content-type')) { - this[kHeaders].append('content-type', contentType) - } - } +function isErrored (body) { + return !!(body && ( + stream.isErrored + ? stream.isErrored(body) + : /state: 'errored'/.test(nodeUtil.inspect(body) + ))) +} - // 37. Let inputOrInitBody be initBody if it is non-null; otherwise - // inputBody. - const inputOrInitBody = initBody ?? inputBody +function isReadable (body) { + return !!(body && ( + stream.isReadable + ? stream.isReadable(body) + : /state: 'readable'/.test(nodeUtil.inspect(body) + ))) +} - // 38. If inputOrInitBody is non-null and inputOrInitBody’s source is - // null, then: - if (inputOrInitBody != null && inputOrInitBody.source == null) { - // 1. If initBody is non-null and init["duplex"] does not exist, - // then throw a TypeError. - if (initBody != null && init.duplex == null) { - throw new TypeError('RequestInit: duplex option is required when sending a body.') - } +function getSocketInfo (socket) { + return { + localAddress: socket.localAddress, + localPort: socket.localPort, + remoteAddress: socket.remoteAddress, + remotePort: socket.remotePort, + remoteFamily: socket.remoteFamily, + timeout: socket.timeout, + bytesWritten: socket.bytesWritten, + bytesRead: socket.bytesRead + } +} - // 2. If this’s request’s mode is neither "same-origin" nor "cors", - // then throw a TypeError. - if (request.mode !== 'same-origin' && request.mode !== 'cors') { - throw new TypeError( - 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' - ) - } +async function * convertIterableToBuffer (iterable) { + for await (const chunk of iterable) { + yield Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk) + } +} - // 3. Set this’s request’s use-CORS-preflight flag. - request.useCORSPreflightFlag = true - } +let ReadableStream +function ReadableStreamFrom (iterable) { + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(35356).ReadableStream) + } - // 39. Let finalBody be inputOrInitBody. - let finalBody = inputOrInitBody + if (ReadableStream.from) { + return ReadableStream.from(convertIterableToBuffer(iterable)) + } - // 40. If initBody is null and inputBody is non-null, then: - if (initBody == null && inputBody != null) { - // 1. If input is unusable, then throw a TypeError. - if (util.isDisturbed(inputBody.stream) || inputBody.stream.locked) { - throw new TypeError( - 'Cannot construct a Request with a Request object that has already been used.' - ) + let iterator + return new ReadableStream( + { + async start () { + iterator = iterable[Symbol.asyncIterator]() + }, + async pull (controller) { + const { done, value } = await iterator.next() + if (done) { + queueMicrotask(() => { + controller.close() + }) + } else { + const buf = Buffer.isBuffer(value) ? value : Buffer.from(value) + controller.enqueue(new Uint8Array(buf)) + } + return controller.desiredSize > 0 + }, + async cancel (reason) { + await iterator.return() } + }, + 0 + ) +} - // 2. Set finalBody to the result of creating a proxy for inputBody. - if (!TransformStream) { - TransformStream = (__nccwpck_require__(35356).TransformStream) - } +// The chunk should be a FormData instance and contains +// all the required methods. +function isFormDataLike (object) { + return ( + object && + typeof object === 'object' && + typeof object.append === 'function' && + typeof object.delete === 'function' && + typeof object.get === 'function' && + typeof object.getAll === 'function' && + typeof object.has === 'function' && + typeof object.set === 'function' && + object[Symbol.toStringTag] === 'FormData' + ) +} - // https://streams.spec.whatwg.org/#readablestream-create-a-proxy - const identityTransform = new TransformStream() - inputBody.stream.pipeThrough(identityTransform) - finalBody = { - source: inputBody.source, - length: inputBody.length, - stream: identityTransform.readable - } +function throwIfAborted (signal) { + if (!signal) { return } + if (typeof signal.throwIfAborted === 'function') { + signal.throwIfAborted() + } else { + if (signal.aborted) { + // DOMException not available < v17.0.0 + const err = new Error('The operation was aborted') + err.name = 'AbortError' + throw err } + } +} - // 41. Set this’s request’s body to finalBody. - this[kState].body = finalBody +function addAbortListener (signal, listener) { + if ('addEventListener' in signal) { + signal.addEventListener('abort', listener, { once: true }) + return () => signal.removeEventListener('abort', listener) } + signal.addListener('abort', listener) + return () => signal.removeListener('abort', listener) +} - // Returns request’s HTTP method, which is "GET" by default. - get method () { - webidl.brandCheck(this, Request) +const hasToWellFormed = !!String.prototype.toWellFormed - // The method getter steps are to return this’s request’s method. - return this[kState].method +/** + * @param {string} val + */ +function toUSVString (val) { + if (hasToWellFormed) { + return `${val}`.toWellFormed() + } else if (nodeUtil.toUSVString) { + return nodeUtil.toUSVString(val) } - // Returns the URL of request as a string. - get url () { - webidl.brandCheck(this, Request) + return `${val}` +} - // The url getter steps are to return this’s request’s URL, serialized. - return URLSerializer(this[kState].url) - } +// Parsed accordingly to RFC 9110 +// https://www.rfc-editor.org/rfc/rfc9110#field.content-range +function parseRangeHeader (range) { + if (range == null || range === '') return { start: 0, end: null, size: null } - // Returns a Headers object consisting of the headers associated with request. - // Note that headers added in the network layer by the user agent will not - // be accounted for in this object, e.g., the "Host" header. - get headers () { - webidl.brandCheck(this, Request) + const m = range ? range.match(/^bytes (\d+)-(\d+)\/(\d+)?$/) : null + return m + ? { + start: parseInt(m[1]), + end: m[2] ? parseInt(m[2]) : null, + size: m[3] ? parseInt(m[3]) : null + } + : null +} - // The headers getter steps are to return this’s headers. - return this[kHeaders] - } +const kEnumerableProperty = Object.create(null) +kEnumerableProperty.enumerable = true - // Returns the kind of resource requested by request, e.g., "document" - // or "script". - get destination () { - webidl.brandCheck(this, Request) +module.exports = { + kEnumerableProperty, + nop, + isDisturbed, + isErrored, + isReadable, + toUSVString, + isReadableAborted, + isBlobLike, + parseOrigin, + parseURL, + getServerName, + isStream, + isIterable, + isAsyncIterable, + isDestroyed, + headerNameToString, + parseRawHeaders, + parseHeaders, + parseKeepAliveTimeout, + destroy, + bodyLength, + deepClone, + ReadableStreamFrom, + isBuffer, + validateHandler, + getSocketInfo, + isFormDataLike, + buildURL, + throwIfAborted, + addAbortListener, + parseRangeHeader, + nodeMajor, + nodeMinor, + nodeHasAutoSelectFamily: nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 13), + safeHTTPMethods: ['GET', 'HEAD', 'OPTIONS', 'TRACE'] +} - // The destination getter are to return this’s request’s destination. - return this[kState].destination - } - // Returns the referrer of request. Its value can be a same-origin URL if - // explicitly set in init, the empty string to indicate no referrer, and - // "about:client" when defaulting to the global’s default. This is used - // during fetching to determine the value of the `Referer` header of the - // request being made. - get referrer () { - webidl.brandCheck(this, Request) +/***/ }), - // 1. If this’s request’s referrer is "no-referrer", then return the - // empty string. - if (this[kState].referrer === 'no-referrer') { - return '' - } +/***/ 74839: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 2. If this’s request’s referrer is "client", then return - // "about:client". - if (this[kState].referrer === 'client') { - return 'about:client' - } +"use strict"; - // Return this’s request’s referrer, serialized. - return this[kState].referrer.toString() - } - // Returns the referrer policy associated with request. - // This is used during fetching to compute the value of the request’s - // referrer. - get referrerPolicy () { - webidl.brandCheck(this, Request) +const Dispatcher = __nccwpck_require__(60412) +const { + ClientDestroyedError, + ClientClosedError, + InvalidArgumentError +} = __nccwpck_require__(48045) +const { kDestroy, kClose, kDispatch, kInterceptors } = __nccwpck_require__(72785) - // The referrerPolicy getter steps are to return this’s request’s referrer policy. - return this[kState].referrerPolicy - } +const kDestroyed = Symbol('destroyed') +const kClosed = Symbol('closed') +const kOnDestroyed = Symbol('onDestroyed') +const kOnClosed = Symbol('onClosed') +const kInterceptedDispatch = Symbol('Intercepted Dispatch') - // Returns the mode associated with request, which is a string indicating - // whether the request will use CORS, or will be restricted to same-origin - // URLs. - get mode () { - webidl.brandCheck(this, Request) +class DispatcherBase extends Dispatcher { + constructor () { + super() - // The mode getter steps are to return this’s request’s mode. - return this[kState].mode + this[kDestroyed] = false + this[kOnDestroyed] = null + this[kClosed] = false + this[kOnClosed] = [] } - // Returns the credentials mode associated with request, - // which is a string indicating whether credentials will be sent with the - // request always, never, or only when sent to a same-origin URL. - get credentials () { - // The credentials getter steps are to return this’s request’s credentials mode. - return this[kState].credentials + get destroyed () { + return this[kDestroyed] } - // Returns the cache mode associated with request, - // which is a string indicating how the request will - // interact with the browser’s cache when fetching. - get cache () { - webidl.brandCheck(this, Request) + get closed () { + return this[kClosed] + } - // The cache getter steps are to return this’s request’s cache mode. - return this[kState].cache + get interceptors () { + return this[kInterceptors] } - // Returns the redirect mode associated with request, - // which is a string indicating how redirects for the - // request will be handled during fetching. A request - // will follow redirects by default. - get redirect () { - webidl.brandCheck(this, Request) + set interceptors (newInterceptors) { + if (newInterceptors) { + for (let i = newInterceptors.length - 1; i >= 0; i--) { + const interceptor = this[kInterceptors][i] + if (typeof interceptor !== 'function') { + throw new InvalidArgumentError('interceptor must be an function') + } + } + } - // The redirect getter steps are to return this’s request’s redirect mode. - return this[kState].redirect + this[kInterceptors] = newInterceptors } - // Returns request’s subresource integrity metadata, which is a - // cryptographic hash of the resource being fetched. Its value - // consists of multiple hashes separated by whitespace. [SRI] - get integrity () { - webidl.brandCheck(this, Request) + close (callback) { + if (callback === undefined) { + return new Promise((resolve, reject) => { + this.close((err, data) => { + return err ? reject(err) : resolve(data) + }) + }) + } - // The integrity getter steps are to return this’s request’s integrity - // metadata. - return this[kState].integrity - } + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } - // Returns a boolean indicating whether or not request can outlive the - // global in which it was created. - get keepalive () { - webidl.brandCheck(this, Request) + if (this[kDestroyed]) { + queueMicrotask(() => callback(new ClientDestroyedError(), null)) + return + } - // The keepalive getter steps are to return this’s request’s keepalive. - return this[kState].keepalive - } + if (this[kClosed]) { + if (this[kOnClosed]) { + this[kOnClosed].push(callback) + } else { + queueMicrotask(() => callback(null, null)) + } + return + } - // Returns a boolean indicating whether or not request is for a reload - // navigation. - get isReloadNavigation () { - webidl.brandCheck(this, Request) + this[kClosed] = true + this[kOnClosed].push(callback) - // The isReloadNavigation getter steps are to return true if this’s - // request’s reload-navigation flag is set; otherwise false. - return this[kState].reloadNavigation + const onClosed = () => { + const callbacks = this[kOnClosed] + this[kOnClosed] = null + for (let i = 0; i < callbacks.length; i++) { + callbacks[i](null, null) + } + } + + // Should not error. + this[kClose]() + .then(() => this.destroy()) + .then(() => { + queueMicrotask(onClosed) + }) } - // Returns a boolean indicating whether or not request is for a history - // navigation (a.k.a. back-foward navigation). - get isHistoryNavigation () { - webidl.brandCheck(this, Request) + destroy (err, callback) { + if (typeof err === 'function') { + callback = err + err = null + } - // The isHistoryNavigation getter steps are to return true if this’s request’s - // history-navigation flag is set; otherwise false. - return this[kState].historyNavigation - } + if (callback === undefined) { + return new Promise((resolve, reject) => { + this.destroy(err, (err, data) => { + return err ? /* istanbul ignore next: should never error */ reject(err) : resolve(data) + }) + }) + } - // Returns the signal associated with request, which is an AbortSignal - // object indicating whether or not request has been aborted, and its - // abort event handler. - get signal () { - webidl.brandCheck(this, Request) + if (typeof callback !== 'function') { + throw new InvalidArgumentError('invalid callback') + } - // The signal getter steps are to return this’s signal. - return this[kSignal] - } + if (this[kDestroyed]) { + if (this[kOnDestroyed]) { + this[kOnDestroyed].push(callback) + } else { + queueMicrotask(() => callback(null, null)) + } + return + } - get body () { - webidl.brandCheck(this, Request) + if (!err) { + err = new ClientDestroyedError() + } - return this[kState].body ? this[kState].body.stream : null - } + this[kDestroyed] = true + this[kOnDestroyed] = this[kOnDestroyed] || [] + this[kOnDestroyed].push(callback) - get bodyUsed () { - webidl.brandCheck(this, Request) + const onDestroyed = () => { + const callbacks = this[kOnDestroyed] + this[kOnDestroyed] = null + for (let i = 0; i < callbacks.length; i++) { + callbacks[i](null, null) + } + } - return !!this[kState].body && util.isDisturbed(this[kState].body.stream) + // Should not error. + this[kDestroy](err).then(() => { + queueMicrotask(onDestroyed) + }) } - get duplex () { - webidl.brandCheck(this, Request) + [kInterceptedDispatch] (opts, handler) { + if (!this[kInterceptors] || this[kInterceptors].length === 0) { + this[kInterceptedDispatch] = this[kDispatch] + return this[kDispatch](opts, handler) + } - return 'half' + let dispatch = this[kDispatch].bind(this) + for (let i = this[kInterceptors].length - 1; i >= 0; i--) { + dispatch = this[kInterceptors][i](dispatch) + } + this[kInterceptedDispatch] = dispatch + return dispatch(opts, handler) } - // Returns a clone of request. - clone () { - webidl.brandCheck(this, Request) - - // 1. If this is unusable, then throw a TypeError. - if (this.bodyUsed || this.body?.locked) { - throw new TypeError('unusable') + dispatch (opts, handler) { + if (!handler || typeof handler !== 'object') { + throw new InvalidArgumentError('handler must be an object') } - // 2. Let clonedRequest be the result of cloning this’s request. - const clonedRequest = cloneRequest(this[kState]) + try { + if (!opts || typeof opts !== 'object') { + throw new InvalidArgumentError('opts must be an object.') + } - // 3. Let clonedRequestObject be the result of creating a Request object, - // given clonedRequest, this’s headers’s guard, and this’s relevant Realm. - const clonedRequestObject = new Request(kConstruct) - clonedRequestObject[kState] = clonedRequest - clonedRequestObject[kRealm] = this[kRealm] - clonedRequestObject[kHeaders] = new Headers(kConstruct) - clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList - clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard] - clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm] + if (this[kDestroyed] || this[kOnDestroyed]) { + throw new ClientDestroyedError() + } - // 4. Make clonedRequestObject’s signal follow this’s signal. - const ac = new AbortController() - if (this.signal.aborted) { - ac.abort(this.signal.reason) - } else { - util.addAbortListener( - this.signal, - () => { - ac.abort(this.signal.reason) - } - ) - } - clonedRequestObject[kSignal] = ac.signal + if (this[kClosed]) { + throw new ClientClosedError() + } - // 4. Return clonedRequestObject. - return clonedRequestObject - } -} + return this[kInterceptedDispatch](opts, handler) + } catch (err) { + if (typeof handler.onError !== 'function') { + throw new InvalidArgumentError('invalid onError method') + } -mixinBody(Request) + handler.onError(err) -function makeRequest (init) { - // https://fetch.spec.whatwg.org/#requests - const request = { - method: 'GET', - localURLsOnly: false, - unsafeRequest: false, - body: null, - client: null, - reservedClient: null, - replacesClientId: '', - window: 'client', - keepalive: false, - serviceWorkers: 'all', - initiator: '', - destination: '', - priority: null, - origin: 'client', - policyContainer: 'client', - referrer: 'client', - referrerPolicy: '', - mode: 'no-cors', - useCORSPreflightFlag: false, - credentials: 'same-origin', - useCredentials: false, - cache: 'default', - redirect: 'follow', - integrity: '', - cryptoGraphicsNonceMetadata: '', - parserMetadata: '', - reloadNavigation: false, - historyNavigation: false, - userActivation: false, - taintedOrigin: false, - redirectCount: 0, - responseTainting: 'basic', - preventNoCacheCacheControlHeaderModification: false, - done: false, - timingAllowFailed: false, - ...init, - headersList: init.headersList - ? new HeadersList(init.headersList) - : new HeadersList() + return false + } } - request.url = request.urlList[0] - return request } -// https://fetch.spec.whatwg.org/#concept-request-clone -function cloneRequest (request) { - // To clone a request request, run these steps: +module.exports = DispatcherBase - // 1. Let newRequest be a copy of request, except for its body. - const newRequest = makeRequest({ ...request, body: null }) - // 2. If request’s body is non-null, set newRequest’s body to the - // result of cloning request’s body. - if (request.body != null) { - newRequest.body = cloneBody(request.body) - } +/***/ }), - // 3. Return newRequest. - return newRequest -} +/***/ 60412: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -Object.defineProperties(Request.prototype, { - method: kEnumerableProperty, - url: kEnumerableProperty, - headers: kEnumerableProperty, - redirect: kEnumerableProperty, - clone: kEnumerableProperty, - signal: kEnumerableProperty, - duplex: kEnumerableProperty, - destination: kEnumerableProperty, - body: kEnumerableProperty, - bodyUsed: kEnumerableProperty, - isHistoryNavigation: kEnumerableProperty, - isReloadNavigation: kEnumerableProperty, - keepalive: kEnumerableProperty, - integrity: kEnumerableProperty, - cache: kEnumerableProperty, - credentials: kEnumerableProperty, - attribute: kEnumerableProperty, - referrerPolicy: kEnumerableProperty, - referrer: kEnumerableProperty, - mode: kEnumerableProperty, - [Symbol.toStringTag]: { - value: 'Request', - configurable: true - } -}) +"use strict"; -webidl.converters.Request = webidl.interfaceConverter( - Request -) -// https://fetch.spec.whatwg.org/#requestinfo -webidl.converters.RequestInfo = function (V) { - if (typeof V === 'string') { - return webidl.converters.USVString(V) - } +const EventEmitter = __nccwpck_require__(82361) - if (V instanceof Request) { - return webidl.converters.Request(V) +class Dispatcher extends EventEmitter { + dispatch () { + throw new Error('not implemented') } - return webidl.converters.USVString(V) -} - -webidl.converters.AbortSignal = webidl.interfaceConverter( - AbortSignal -) + close () { + throw new Error('not implemented') + } -// https://fetch.spec.whatwg.org/#requestinit -webidl.converters.RequestInit = webidl.dictionaryConverter([ - { - key: 'method', - converter: webidl.converters.ByteString - }, - { - key: 'headers', - converter: webidl.converters.HeadersInit - }, - { - key: 'body', - converter: webidl.nullableConverter( - webidl.converters.BodyInit - ) - }, - { - key: 'referrer', - converter: webidl.converters.USVString - }, - { - key: 'referrerPolicy', - converter: webidl.converters.DOMString, - // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy - allowedValues: referrerPolicy - }, - { - key: 'mode', - converter: webidl.converters.DOMString, - // https://fetch.spec.whatwg.org/#concept-request-mode - allowedValues: requestMode - }, - { - key: 'credentials', - converter: webidl.converters.DOMString, - // https://fetch.spec.whatwg.org/#requestcredentials - allowedValues: requestCredentials - }, - { - key: 'cache', - converter: webidl.converters.DOMString, - // https://fetch.spec.whatwg.org/#requestcache - allowedValues: requestCache - }, - { - key: 'redirect', - converter: webidl.converters.DOMString, - // https://fetch.spec.whatwg.org/#requestredirect - allowedValues: requestRedirect - }, - { - key: 'integrity', - converter: webidl.converters.DOMString - }, - { - key: 'keepalive', - converter: webidl.converters.boolean - }, - { - key: 'signal', - converter: webidl.nullableConverter( - (signal) => webidl.converters.AbortSignal( - signal, - { strict: false } - ) - ) - }, - { - key: 'window', - converter: webidl.converters.any - }, - { - key: 'duplex', - converter: webidl.converters.DOMString, - allowedValues: requestDuplex + destroy () { + throw new Error('not implemented') } -]) +} -module.exports = { Request, makeRequest } +module.exports = Dispatcher /***/ }), -/***/ 27823: +/***/ 41472: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { Headers, HeadersList, fill } = __nccwpck_require__(10554) -const { extractBody, cloneBody, mixinBody } = __nccwpck_require__(41472) +const Busboy = __nccwpck_require__(50727) const util = __nccwpck_require__(83983) -const { kEnumerableProperty } = util const { - isValidReasonPhrase, - isCancelled, - isAborted, + ReadableStreamFrom, isBlobLike, - serializeJavascriptValueToJSONString, - isErrorLike, - isomorphicEncode + isReadableStreamLike, + readableStreamClose, + createDeferredPromise, + fullyReadBody } = __nccwpck_require__(52538) -const { - redirectStatusSet, - nullBodyStatus, - DOMException -} = __nccwpck_require__(41037) -const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(15861) -const { webidl } = __nccwpck_require__(21744) const { FormData } = __nccwpck_require__(72015) -const { getGlobalOrigin } = __nccwpck_require__(71246) -const { URLSerializer } = __nccwpck_require__(685) -const { kHeadersList, kConstruct } = __nccwpck_require__(72785) +const { kState } = __nccwpck_require__(15861) +const { webidl } = __nccwpck_require__(21744) +const { DOMException, structuredClone } = __nccwpck_require__(41037) +const { Blob, File: NativeFile } = __nccwpck_require__(14300) +const { kBodyUsed } = __nccwpck_require__(72785) const assert = __nccwpck_require__(39491) -const { types } = __nccwpck_require__(73837) +const { isErrored } = __nccwpck_require__(83983) +const { isUint8Array, isArrayBuffer } = __nccwpck_require__(29830) +const { File: UndiciFile } = __nccwpck_require__(78511) +const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) -const ReadableStream = globalThis.ReadableStream || (__nccwpck_require__(35356).ReadableStream) -const textEncoder = new TextEncoder('utf-8') +let random +try { + const crypto = __nccwpck_require__(6005) + random = (max) => crypto.randomInt(0, max) +} catch { + random = (max) => Math.floor(Math.random(max)) +} -// https://fetch.spec.whatwg.org/#response-class -class Response { - // Creates network error Response. - static error () { - // TODO - const relevantRealm = { settingsObject: {} } +let ReadableStream = globalThis.ReadableStream - // The static error() method steps are to return the result of creating a - // Response object, given a new network error, "immutable", and this’s - // relevant Realm. - const responseObject = new Response() - responseObject[kState] = makeNetworkError() - responseObject[kRealm] = relevantRealm - responseObject[kHeaders][kHeadersList] = responseObject[kState].headersList - responseObject[kHeaders][kGuard] = 'immutable' - responseObject[kHeaders][kRealm] = relevantRealm - return responseObject +/** @type {globalThis['File']} */ +const File = NativeFile ?? UndiciFile +const textEncoder = new TextEncoder() +const textDecoder = new TextDecoder() + +// https://fetch.spec.whatwg.org/#concept-bodyinit-extract +function extractBody (object, keepalive = false) { + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(35356).ReadableStream) } - // https://fetch.spec.whatwg.org/#dom-response-json - static json (data, init = {}) { - webidl.argumentLengthCheck(arguments, 1, { header: 'Response.json' }) + // 1. Let stream be null. + let stream = null - if (init !== null) { - init = webidl.converters.ResponseInit(init) - } + // 2. If object is a ReadableStream object, then set stream to object. + if (object instanceof ReadableStream) { + stream = object + } else if (isBlobLike(object)) { + // 3. Otherwise, if object is a Blob object, set stream to the + // result of running object’s get stream. + stream = object.stream() + } else { + // 4. Otherwise, set stream to a new ReadableStream object, and set + // up stream. + stream = new ReadableStream({ + async pull (controller) { + controller.enqueue( + typeof source === 'string' ? textEncoder.encode(source) : source + ) + queueMicrotask(() => readableStreamClose(controller)) + }, + start () {}, + type: undefined + }) + } - // 1. Let bytes the result of running serialize a JavaScript value to JSON bytes on data. - const bytes = textEncoder.encode( - serializeJavascriptValueToJSONString(data) - ) + // 5. Assert: stream is a ReadableStream object. + assert(isReadableStreamLike(stream)) - // 2. Let body be the result of extracting bytes. - const body = extractBody(bytes) + // 6. Let action be null. + let action = null - // 3. Let responseObject be the result of creating a Response object, given a new response, - // "response", and this’s relevant Realm. - const relevantRealm = { settingsObject: {} } - const responseObject = new Response() - responseObject[kRealm] = relevantRealm - responseObject[kHeaders][kGuard] = 'response' - responseObject[kHeaders][kRealm] = relevantRealm + // 7. Let source be null. + let source = null - // 4. Perform initialize a response given responseObject, init, and (body, "application/json"). - initializeResponse(responseObject, init, { body: body[0], type: 'application/json' }) + // 8. Let length be null. + let length = null - // 5. Return responseObject. - return responseObject - } + // 9. Let type be null. + let type = null - // Creates a redirect Response that redirects to url with status status. - static redirect (url, status = 302) { - const relevantRealm = { settingsObject: {} } + // 10. Switch on object: + if (typeof object === 'string') { + // Set source to the UTF-8 encoding of object. + // Note: setting source to a Uint8Array here breaks some mocking assumptions. + source = object - webidl.argumentLengthCheck(arguments, 1, { header: 'Response.redirect' }) + // Set type to `text/plain;charset=UTF-8`. + type = 'text/plain;charset=UTF-8' + } else if (object instanceof URLSearchParams) { + // URLSearchParams - url = webidl.converters.USVString(url) - status = webidl.converters['unsigned short'](status) + // spec says to run application/x-www-form-urlencoded on body.list + // this is implemented in Node.js as apart of an URLSearchParams instance toString method + // See: https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L490 + // and https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/lib/internal/url.js#L1100 - // 1. Let parsedURL be the result of parsing url with current settings - // object’s API base URL. - // 2. If parsedURL is failure, then throw a TypeError. - // TODO: base-URL? - let parsedURL - try { - parsedURL = new URL(url, getGlobalOrigin()) - } catch (err) { - throw Object.assign(new TypeError('Failed to parse URL from ' + url), { - cause: err - }) - } + // Set source to the result of running the application/x-www-form-urlencoded serializer with object’s list. + source = object.toString() - // 3. If status is not a redirect status, then throw a RangeError. - if (!redirectStatusSet.has(status)) { - throw new RangeError('Invalid status code ' + status) - } + // Set type to `application/x-www-form-urlencoded;charset=UTF-8`. + type = 'application/x-www-form-urlencoded;charset=UTF-8' + } else if (isArrayBuffer(object)) { + // BufferSource/ArrayBuffer - // 4. Let responseObject be the result of creating a Response object, - // given a new response, "immutable", and this’s relevant Realm. - const responseObject = new Response() - responseObject[kRealm] = relevantRealm - responseObject[kHeaders][kGuard] = 'immutable' - responseObject[kHeaders][kRealm] = relevantRealm + // Set source to a copy of the bytes held by object. + source = new Uint8Array(object.slice()) + } else if (ArrayBuffer.isView(object)) { + // BufferSource/ArrayBufferView - // 5. Set responseObject’s response’s status to status. - responseObject[kState].status = status + // Set source to a copy of the bytes held by object. + source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength)) + } else if (util.isFormDataLike(object)) { + const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}` + const prefix = `--${boundary}\r\nContent-Disposition: form-data` - // 6. Let value be parsedURL, serialized and isomorphic encoded. - const value = isomorphicEncode(URLSerializer(parsedURL)) + /*! formdata-polyfill. MIT License. Jimmy Wärting */ + const escape = (str) => + str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22') + const normalizeLinefeeds = (value) => value.replace(/\r?\n|\r/g, '\r\n') - // 7. Append `Location`/value to responseObject’s response’s header list. - responseObject[kState].headersList.append('location', value) + // Set action to this step: run the multipart/form-data + // encoding algorithm, with object’s entry list and UTF-8. + // - This ensures that the body is immutable and can't be changed afterwords + // - That the content-length is calculated in advance. + // - And that all parts are pre-encoded and ready to be sent. - // 8. Return responseObject. - return responseObject - } + const blobParts = [] + const rn = new Uint8Array([13, 10]) // '\r\n' + length = 0 + let hasUnknownSizeValue = false - // https://fetch.spec.whatwg.org/#dom-response - constructor (body = null, init = {}) { - if (body !== null) { - body = webidl.converters.BodyInit(body) + for (const [name, value] of object) { + if (typeof value === 'string') { + const chunk = textEncoder.encode(prefix + + `; name="${escape(normalizeLinefeeds(name))}"` + + `\r\n\r\n${normalizeLinefeeds(value)}\r\n`) + blobParts.push(chunk) + length += chunk.byteLength + } else { + const chunk = textEncoder.encode(`${prefix}; name="${escape(normalizeLinefeeds(name))}"` + + (value.name ? `; filename="${escape(value.name)}"` : '') + '\r\n' + + `Content-Type: ${ + value.type || 'application/octet-stream' + }\r\n\r\n`) + blobParts.push(chunk, value, rn) + if (typeof value.size === 'number') { + length += chunk.byteLength + value.size + rn.byteLength + } else { + hasUnknownSizeValue = true + } + } } - init = webidl.converters.ResponseInit(init) - - // TODO - this[kRealm] = { settingsObject: {} } - - // 1. Set this’s response to a new response. - this[kState] = makeResponse({}) - - // 2. Set this’s headers to a new Headers object with this’s relevant - // Realm, whose header list is this’s response’s header list and guard - // is "response". - this[kHeaders] = new Headers(kConstruct) - this[kHeaders][kGuard] = 'response' - this[kHeaders][kHeadersList] = this[kState].headersList - this[kHeaders][kRealm] = this[kRealm] + const chunk = textEncoder.encode(`--${boundary}--`) + blobParts.push(chunk) + length += chunk.byteLength + if (hasUnknownSizeValue) { + length = null + } - // 3. Let bodyWithType be null. - let bodyWithType = null + // Set source to object. + source = object - // 4. If body is non-null, then set bodyWithType to the result of extracting body. - if (body != null) { - const [extractedBody, type] = extractBody(body) - bodyWithType = { body: extractedBody, type } + action = async function * () { + for (const part of blobParts) { + if (part.stream) { + yield * part.stream() + } else { + yield part + } + } } - // 5. Perform initialize a response given this, init, and bodyWithType. - initializeResponse(this, init, bodyWithType) - } + // Set type to `multipart/form-data; boundary=`, + // followed by the multipart/form-data boundary string generated + // by the multipart/form-data encoding algorithm. + type = 'multipart/form-data; boundary=' + boundary + } else if (isBlobLike(object)) { + // Blob - // Returns response’s type, e.g., "cors". - get type () { - webidl.brandCheck(this, Response) + // Set source to object. + source = object - // The type getter steps are to return this’s response’s type. - return this[kState].type - } + // Set length to object’s size. + length = object.size - // Returns response’s URL, if it has one; otherwise the empty string. - get url () { - webidl.brandCheck(this, Response) - - const urlList = this[kState].urlList - - // The url getter steps are to return the empty string if this’s - // response’s URL is null; otherwise this’s response’s URL, - // serialized with exclude fragment set to true. - const url = urlList[urlList.length - 1] ?? null + // If object’s type attribute is not the empty byte sequence, set + // type to its value. + if (object.type) { + type = object.type + } + } else if (typeof object[Symbol.asyncIterator] === 'function') { + // If keepalive is true, then throw a TypeError. + if (keepalive) { + throw new TypeError('keepalive') + } - if (url === null) { - return '' + // If object is disturbed or locked, then throw a TypeError. + if (util.isDisturbed(object) || object.locked) { + throw new TypeError( + 'Response body object should not be disturbed or locked' + ) } - return URLSerializer(url, true) + stream = + object instanceof ReadableStream ? object : ReadableStreamFrom(object) } - // Returns whether response was obtained through a redirect. - get redirected () { - webidl.brandCheck(this, Response) - - // The redirected getter steps are to return true if this’s response’s URL - // list has more than one item; otherwise false. - return this[kState].urlList.length > 1 + // 11. If source is a byte sequence, then set action to a + // step that returns source and length to source’s length. + if (typeof source === 'string' || util.isBuffer(source)) { + length = Buffer.byteLength(source) } - // Returns response’s status. - get status () { - webidl.brandCheck(this, Response) - - // The status getter steps are to return this’s response’s status. - return this[kState].status + // 12. If action is non-null, then run these steps in in parallel: + if (action != null) { + // Run action. + let iterator + stream = new ReadableStream({ + async start () { + iterator = action(object)[Symbol.asyncIterator]() + }, + async pull (controller) { + const { value, done } = await iterator.next() + if (done) { + // When running action is done, close stream. + queueMicrotask(() => { + controller.close() + }) + } else { + // Whenever one or more bytes are available and stream is not errored, + // enqueue a Uint8Array wrapping an ArrayBuffer containing the available + // bytes into stream. + if (!isErrored(stream)) { + controller.enqueue(new Uint8Array(value)) + } + } + return controller.desiredSize > 0 + }, + async cancel (reason) { + await iterator.return() + }, + type: undefined + }) } - // Returns whether response’s status is an ok status. - get ok () { - webidl.brandCheck(this, Response) + // 13. Let body be a body whose stream is stream, source is source, + // and length is length. + const body = { stream, source, length } - // The ok getter steps are to return true if this’s response’s status is an - // ok status; otherwise false. - return this[kState].status >= 200 && this[kState].status <= 299 + // 14. Return (body, type). + return [body, type] +} + +// https://fetch.spec.whatwg.org/#bodyinit-safely-extract +function safelyExtractBody (object, keepalive = false) { + if (!ReadableStream) { + // istanbul ignore next + ReadableStream = (__nccwpck_require__(35356).ReadableStream) } - // Returns response’s status message. - get statusText () { - webidl.brandCheck(this, Response) + // To safely extract a body and a `Content-Type` value from + // a byte sequence or BodyInit object object, run these steps: - // The statusText getter steps are to return this’s response’s status - // message. - return this[kState].statusText + // 1. If object is a ReadableStream object, then: + if (object instanceof ReadableStream) { + // Assert: object is neither disturbed nor locked. + // istanbul ignore next + assert(!util.isDisturbed(object), 'The body has already been consumed.') + // istanbul ignore next + assert(!object.locked, 'The stream is locked.') } - // Returns response’s headers as Headers. - get headers () { - webidl.brandCheck(this, Response) + // 2. Return the results of extracting object. + return extractBody(object, keepalive) +} - // The headers getter steps are to return this’s headers. - return this[kHeaders] - } +function cloneBody (body) { + // To clone a body body, run these steps: - get body () { - webidl.brandCheck(this, Response) + // https://fetch.spec.whatwg.org/#concept-body-clone - return this[kState].body ? this[kState].body.stream : null - } + // 1. Let « out1, out2 » be the result of teeing body’s stream. + const [out1, out2] = body.stream.tee() + const out2Clone = structuredClone(out2, { transfer: [out2] }) + // This, for whatever reasons, unrefs out2Clone which allows + // the process to exit by itself. + const [, finalClone] = out2Clone.tee() - get bodyUsed () { - webidl.brandCheck(this, Response) + // 2. Set body’s stream to out1. + body.stream = out1 - return !!this[kState].body && util.isDisturbed(this[kState].body.stream) + // 3. Return a body whose stream is out2 and other members are copied from body. + return { + stream: finalClone, + length: body.length, + source: body.source } +} - // Returns a clone of response. - clone () { - webidl.brandCheck(this, Response) +async function * consumeBody (body) { + if (body) { + if (isUint8Array(body)) { + yield body + } else { + const stream = body.stream - // 1. If this is unusable, then throw a TypeError. - if (this.bodyUsed || (this.body && this.body.locked)) { - throw webidl.errors.exception({ - header: 'Response.clone', - message: 'Body has already been consumed.' - }) - } + if (util.isDisturbed(stream)) { + throw new TypeError('The body has already been consumed.') + } - // 2. Let clonedResponse be the result of cloning this’s response. - const clonedResponse = cloneResponse(this[kState]) + if (stream.locked) { + throw new TypeError('The stream is locked.') + } - // 3. Return the result of creating a Response object, given - // clonedResponse, this’s headers’s guard, and this’s relevant Realm. - const clonedResponseObject = new Response() - clonedResponseObject[kState] = clonedResponse - clonedResponseObject[kRealm] = this[kRealm] - clonedResponseObject[kHeaders][kHeadersList] = clonedResponse.headersList - clonedResponseObject[kHeaders][kGuard] = this[kHeaders][kGuard] - clonedResponseObject[kHeaders][kRealm] = this[kHeaders][kRealm] + // Compat. + stream[kBodyUsed] = true - return clonedResponseObject + yield * stream + } } } -mixinBody(Response) - -Object.defineProperties(Response.prototype, { - type: kEnumerableProperty, - url: kEnumerableProperty, - status: kEnumerableProperty, - ok: kEnumerableProperty, - redirected: kEnumerableProperty, - statusText: kEnumerableProperty, - headers: kEnumerableProperty, - clone: kEnumerableProperty, - body: kEnumerableProperty, - bodyUsed: kEnumerableProperty, - [Symbol.toStringTag]: { - value: 'Response', - configurable: true +function throwIfAborted (state) { + if (state.aborted) { + throw new DOMException('The operation was aborted.', 'AbortError') } -}) +} -Object.defineProperties(Response, { - json: kEnumerableProperty, - redirect: kEnumerableProperty, - error: kEnumerableProperty -}) +function bodyMixinMethods (instance) { + const methods = { + blob () { + // The blob() method steps are to return the result of + // running consume body with this and the following step + // given a byte sequence bytes: return a Blob whose + // contents are bytes and whose type attribute is this’s + // MIME type. + return specConsumeBody(this, (bytes) => { + let mimeType = bodyMimeType(this) -// https://fetch.spec.whatwg.org/#concept-response-clone -function cloneResponse (response) { - // To clone a response response, run these steps: + if (mimeType === 'failure') { + mimeType = '' + } else if (mimeType) { + mimeType = serializeAMimeType(mimeType) + } - // 1. If response is a filtered response, then return a new identical - // filtered response whose internal response is a clone of response’s - // internal response. - if (response.internalResponse) { - return filterResponse( - cloneResponse(response.internalResponse), - response.type - ) - } + // Return a Blob whose contents are bytes and type attribute + // is mimeType. + return new Blob([bytes], { type: mimeType }) + }, instance) + }, - // 2. Let newResponse be a copy of response, except for its body. - const newResponse = makeResponse({ ...response, body: null }) + arrayBuffer () { + // The arrayBuffer() method steps are to return the result + // of running consume body with this and the following step + // given a byte sequence bytes: return a new ArrayBuffer + // whose contents are bytes. + return specConsumeBody(this, (bytes) => { + return new Uint8Array(bytes).buffer + }, instance) + }, - // 3. If response’s body is non-null, then set newResponse’s body to the - // result of cloning response’s body. - if (response.body != null) { - newResponse.body = cloneBody(response.body) - } + text () { + // The text() method steps are to return the result of running + // consume body with this and UTF-8 decode. + return specConsumeBody(this, utf8DecodeBytes, instance) + }, - // 4. Return newResponse. - return newResponse -} + json () { + // The json() method steps are to return the result of running + // consume body with this and parse JSON from bytes. + return specConsumeBody(this, parseJSONFromBytes, instance) + }, -function makeResponse (init) { - return { - aborted: false, - rangeRequested: false, - timingAllowPassed: false, - requestIncludesCredentials: false, - type: 'default', - status: 200, - timingInfo: null, - cacheState: '', - statusText: '', - ...init, - headersList: init.headersList - ? new HeadersList(init.headersList) - : new HeadersList(), - urlList: init.urlList ? [...init.urlList] : [] - } -} + async formData () { + webidl.brandCheck(this, instance) -function makeNetworkError (reason) { - const isError = isErrorLike(reason) - return makeResponse({ - type: 'error', - status: 0, - error: isError - ? reason - : new Error(reason ? String(reason) : reason), - aborted: reason && reason.name === 'AbortError' - }) -} + throwIfAborted(this[kState]) -function makeFilteredResponse (response, state) { - state = { - internalResponse: response, - ...state - } + const contentType = this.headers.get('Content-Type') - return new Proxy(response, { - get (target, p) { - return p in state ? state[p] : target[p] - }, - set (target, p, value) { - assert(!(p in state)) - target[p] = value - return true - } - }) -} + // If mimeType’s essence is "multipart/form-data", then: + if (/multipart\/form-data/.test(contentType)) { + const headers = {} + for (const [key, value] of this.headers) headers[key.toLowerCase()] = value -// https://fetch.spec.whatwg.org/#concept-filtered-response -function filterResponse (response, type) { - // Set response to the following filtered response with response as its - // internal response, depending on request’s response tainting: - if (type === 'basic') { - // A basic filtered response is a filtered response whose type is "basic" - // and header list excludes any headers in internal response’s header list - // whose name is a forbidden response-header name. + const responseFormData = new FormData() - // Note: undici does not implement forbidden response-header names - return makeFilteredResponse(response, { - type: 'basic', - headersList: response.headersList - }) - } else if (type === 'cors') { - // A CORS filtered response is a filtered response whose type is "cors" - // and header list excludes any headers in internal response’s header - // list whose name is not a CORS-safelisted response-header name, given - // internal response’s CORS-exposed header-name list. + let busboy - // Note: undici does not implement CORS-safelisted response-header names - return makeFilteredResponse(response, { - type: 'cors', - headersList: response.headersList - }) - } else if (type === 'opaque') { - // An opaque filtered response is a filtered response whose type is - // "opaque", URL list is the empty list, status is 0, status message - // is the empty byte sequence, header list is empty, and body is null. + try { + busboy = new Busboy({ + headers, + preservePath: true + }) + } catch (err) { + throw new DOMException(`${err}`, 'AbortError') + } - return makeFilteredResponse(response, { - type: 'opaque', - urlList: Object.freeze([]), - status: 0, - statusText: '', - body: null - }) - } else if (type === 'opaqueredirect') { - // An opaque-redirect filtered response is a filtered response whose type - // is "opaqueredirect", status is 0, status message is the empty byte - // sequence, header list is empty, and body is null. + busboy.on('field', (name, value) => { + responseFormData.append(name, value) + }) + busboy.on('file', (name, value, filename, encoding, mimeType) => { + const chunks = [] - return makeFilteredResponse(response, { - type: 'opaqueredirect', - status: 0, - statusText: '', - headersList: [], - body: null - }) - } else { - assert(false) - } -} + if (encoding === 'base64' || encoding.toLowerCase() === 'base64') { + let base64chunk = '' -// https://fetch.spec.whatwg.org/#appropriate-network-error -function makeAppropriateNetworkError (fetchParams, err = null) { - // 1. Assert: fetchParams is canceled. - assert(isCancelled(fetchParams)) + value.on('data', (chunk) => { + base64chunk += chunk.toString().replace(/[\r\n]/gm, '') - // 2. Return an aborted network error if fetchParams is aborted; - // otherwise return a network error. - return isAborted(fetchParams) - ? makeNetworkError(Object.assign(new DOMException('The operation was aborted.', 'AbortError'), { cause: err })) - : makeNetworkError(Object.assign(new DOMException('Request was cancelled.'), { cause: err })) -} + const end = base64chunk.length - base64chunk.length % 4 + chunks.push(Buffer.from(base64chunk.slice(0, end), 'base64')) -// https://whatpr.org/fetch/1392.html#initialize-a-response -function initializeResponse (response, init, body) { - // 1. If init["status"] is not in the range 200 to 599, inclusive, then - // throw a RangeError. - if (init.status !== null && (init.status < 200 || init.status > 599)) { - throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.') - } + base64chunk = base64chunk.slice(end) + }) + value.on('end', () => { + chunks.push(Buffer.from(base64chunk, 'base64')) + responseFormData.append(name, new File(chunks, filename, { type: mimeType })) + }) + } else { + value.on('data', (chunk) => { + chunks.push(chunk) + }) + value.on('end', () => { + responseFormData.append(name, new File(chunks, filename, { type: mimeType })) + }) + } + }) - // 2. If init["statusText"] does not match the reason-phrase token production, - // then throw a TypeError. - if ('statusText' in init && init.statusText != null) { - // See, https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2: - // reason-phrase = *( HTAB / SP / VCHAR / obs-text ) - if (!isValidReasonPhrase(String(init.statusText))) { - throw new TypeError('Invalid statusText') - } - } + const busboyResolve = new Promise((resolve, reject) => { + busboy.on('finish', resolve) + busboy.on('error', (err) => reject(new TypeError(err))) + }) - // 3. Set response’s response’s status to init["status"]. - if ('status' in init && init.status != null) { - response[kState].status = init.status - } + if (this.body !== null) for await (const chunk of consumeBody(this[kState].body)) busboy.write(chunk) + busboy.end() + await busboyResolve - // 4. Set response’s response’s status message to init["statusText"]. - if ('statusText' in init && init.statusText != null) { - response[kState].statusText = init.statusText - } + return responseFormData + } else if (/application\/x-www-form-urlencoded/.test(contentType)) { + // Otherwise, if mimeType’s essence is "application/x-www-form-urlencoded", then: - // 5. If init["headers"] exists, then fill response’s headers with init["headers"]. - if ('headers' in init && init.headers != null) { - fill(response[kHeaders], init.headers) - } + // 1. Let entries be the result of parsing bytes. + let entries + try { + let text = '' + // application/x-www-form-urlencoded parser will keep the BOM. + // https://url.spec.whatwg.org/#concept-urlencoded-parser + // Note that streaming decoder is stateful and cannot be reused + const streamingDecoder = new TextDecoder('utf-8', { ignoreBOM: true }) - // 6. If body was given, then: - if (body) { - // 1. If response's status is a null body status, then throw a TypeError. - if (nullBodyStatus.includes(response.status)) { - throw webidl.errors.exception({ - header: 'Response constructor', - message: 'Invalid response status code ' + response.status - }) - } + for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError('Expected Uint8Array chunk') + } + text += streamingDecoder.decode(chunk, { stream: true }) + } + text += streamingDecoder.decode() + entries = new URLSearchParams(text) + } catch (err) { + // istanbul ignore next: Unclear when new URLSearchParams can fail on a string. + // 2. If entries is failure, then throw a TypeError. + throw Object.assign(new TypeError(), { cause: err }) + } - // 2. Set response's body to body's body. - response[kState].body = body.body + // 3. Return a new FormData object whose entries are entries. + const formData = new FormData() + for (const [name, value] of entries) { + formData.append(name, value) + } + return formData + } else { + // Wait a tick before checking if the request has been aborted. + // Otherwise, a TypeError can be thrown when an AbortError should. + await Promise.resolve() - // 3. If body's type is non-null and response's header list does not contain - // `Content-Type`, then append (`Content-Type`, body's type) to response's header list. - if (body.type != null && !response[kState].headersList.contains('Content-Type')) { - response[kState].headersList.append('content-type', body.type) + throwIfAborted(this[kState]) + + // Otherwise, throw a TypeError. + throw webidl.errors.exception({ + header: `${instance.name}.formData`, + message: 'Could not parse content as FormData.' + }) + } } } + + return methods } -webidl.converters.ReadableStream = webidl.interfaceConverter( - ReadableStream -) +function mixinBody (prototype) { + Object.assign(prototype.prototype, bodyMixinMethods(prototype)) +} -webidl.converters.FormData = webidl.interfaceConverter( - FormData -) +/** + * @see https://fetch.spec.whatwg.org/#concept-body-consume-body + * @param {Response|Request} object + * @param {(value: unknown) => unknown} convertBytesToJSValue + * @param {Response|Request} instance + */ +async function specConsumeBody (object, convertBytesToJSValue, instance) { + webidl.brandCheck(object, instance) -webidl.converters.URLSearchParams = webidl.interfaceConverter( - URLSearchParams -) + throwIfAborted(object[kState]) -// https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit -webidl.converters.XMLHttpRequestBodyInit = function (V) { - if (typeof V === 'string') { - return webidl.converters.USVString(V) + // 1. If object is unusable, then return a promise rejected + // with a TypeError. + if (bodyUnusable(object[kState].body)) { + throw new TypeError('Body is unusable') } - if (isBlobLike(V)) { - return webidl.converters.Blob(V, { strict: false }) - } + // 2. Let promise be a new promise. + const promise = createDeferredPromise() - if (types.isArrayBuffer(V) || types.isTypedArray(V) || types.isDataView(V)) { - return webidl.converters.BufferSource(V) - } + // 3. Let errorSteps given error be to reject promise with error. + const errorSteps = (error) => promise.reject(error) - if (util.isFormDataLike(V)) { - return webidl.converters.FormData(V, { strict: false }) + // 4. Let successSteps given a byte sequence data be to resolve + // promise with the result of running convertBytesToJSValue + // with data. If that threw an exception, then run errorSteps + // with that exception. + const successSteps = (data) => { + try { + promise.resolve(convertBytesToJSValue(data)) + } catch (e) { + errorSteps(e) + } } - if (V instanceof URLSearchParams) { - return webidl.converters.URLSearchParams(V) + // 5. If object’s body is null, then run successSteps with an + // empty byte sequence. + if (object[kState].body == null) { + successSteps(new Uint8Array()) + return promise.promise } - return webidl.converters.DOMString(V) + // 6. Otherwise, fully read object’s body given successSteps, + // errorSteps, and object’s relevant global object. + await fullyReadBody(object[kState].body, successSteps, errorSteps) + + // 7. Return promise. + return promise.promise } -// https://fetch.spec.whatwg.org/#bodyinit -webidl.converters.BodyInit = function (V) { - if (V instanceof ReadableStream) { - return webidl.converters.ReadableStream(V) - } +// https://fetch.spec.whatwg.org/#body-unusable +function bodyUnusable (body) { + // An object including the Body interface mixin is + // said to be unusable if its body is non-null and + // its body’s stream is disturbed or locked. + return body != null && (body.stream.locked || util.isDisturbed(body.stream)) +} - // Note: the spec doesn't include async iterables, - // this is an undici extension. - if (V?.[Symbol.asyncIterator]) { - return V +/** + * @see https://encoding.spec.whatwg.org/#utf-8-decode + * @param {Buffer} buffer + */ +function utf8DecodeBytes (buffer) { + if (buffer.length === 0) { + return '' } - return webidl.converters.XMLHttpRequestBodyInit(V) -} + // 1. Let buffer be the result of peeking three bytes from + // ioQueue, converted to a byte sequence. -webidl.converters.ResponseInit = webidl.dictionaryConverter([ - { - key: 'status', - converter: webidl.converters['unsigned short'], - defaultValue: 200 - }, - { - key: 'statusText', - converter: webidl.converters.ByteString, - defaultValue: '' - }, - { - key: 'headers', - converter: webidl.converters.HeadersInit + // 2. If buffer is 0xEF 0xBB 0xBF, then read three + // bytes from ioQueue. (Do nothing with those bytes.) + if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { + buffer = buffer.subarray(3) } -]) -module.exports = { - makeNetworkError, - makeResponse, - makeAppropriateNetworkError, - filterResponse, - Response, - cloneResponse -} + // 3. Process a queue with an instance of UTF-8’s + // decoder, ioQueue, output, and "replacement". + const output = textDecoder.decode(buffer) + // 4. Return output. + return output +} -/***/ }), +/** + * @see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value + * @param {Uint8Array} bytes + */ +function parseJSONFromBytes (bytes) { + return JSON.parse(utf8DecodeBytes(bytes)) +} -/***/ 15861: -/***/ ((module) => { +/** + * @see https://fetch.spec.whatwg.org/#concept-body-mime-type + * @param {import('./response').Response|import('./request').Request} object + */ +function bodyMimeType (object) { + const { headersList } = object[kState] + const contentType = headersList.get('content-type') -"use strict"; + if (contentType === null) { + return 'failure' + } + return parseMIMEType(contentType) +} module.exports = { - kUrl: Symbol('url'), - kHeaders: Symbol('headers'), - kSignal: Symbol('signal'), - kState: Symbol('state'), - kGuard: Symbol('guard'), - kRealm: Symbol('realm') + extractBody, + safelyExtractBody, + cloneBody, + mixinBody } /***/ }), -/***/ 52538: +/***/ 41037: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = __nccwpck_require__(41037) -const { getGlobalOrigin } = __nccwpck_require__(71246) -const { performance } = __nccwpck_require__(4074) -const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(83983) -const assert = __nccwpck_require__(39491) -const { isUint8Array } = __nccwpck_require__(29830) +const { MessageChannel, receiveMessageOnPort } = __nccwpck_require__(71267) -let supportedHashes = [] +const corsSafeListedMethods = ['GET', 'HEAD', 'POST'] +const corsSafeListedMethodsSet = new Set(corsSafeListedMethods) -// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable -/** @type {import('crypto')|undefined} */ -let crypto +const nullBodyStatus = [101, 204, 205, 304] -try { - crypto = __nccwpck_require__(6113) - const possibleRelevantHashes = ['sha256', 'sha384', 'sha512'] - supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)) -/* c8 ignore next 3 */ -} catch { -} +const redirectStatus = [301, 302, 303, 307, 308] +const redirectStatusSet = new Set(redirectStatus) -function responseURL (response) { - // https://fetch.spec.whatwg.org/#responses - // A response has an associated URL. It is a pointer to the last URL - // in response’s URL list and null if response’s URL list is empty. - const urlList = response.urlList - const length = urlList.length - return length === 0 ? null : urlList[length - 1].toString() -} +// https://fetch.spec.whatwg.org/#block-bad-port +const badPorts = [ + '1', '7', '9', '11', '13', '15', '17', '19', '20', '21', '22', '23', '25', '37', '42', '43', '53', '69', '77', '79', + '87', '95', '101', '102', '103', '104', '109', '110', '111', '113', '115', '117', '119', '123', '135', '137', + '139', '143', '161', '179', '389', '427', '465', '512', '513', '514', '515', '526', '530', '531', '532', + '540', '548', '554', '556', '563', '587', '601', '636', '989', '990', '993', '995', '1719', '1720', '1723', + '2049', '3659', '4045', '5060', '5061', '6000', '6566', '6665', '6666', '6667', '6668', '6669', '6697', + '10080' +] -// https://fetch.spec.whatwg.org/#concept-response-location-url -function responseLocationURL (response, requestFragment) { - // 1. If response’s status is not a redirect status, then return null. - if (!redirectStatusSet.has(response.status)) { - return null - } +const badPortsSet = new Set(badPorts) - // 2. Let location be the result of extracting header list values given - // `Location` and response’s header list. - let location = response.headersList.get('location') +// https://w3c.github.io/webappsec-referrer-policy/#referrer-policies +const referrerPolicy = [ + '', + 'no-referrer', + 'no-referrer-when-downgrade', + 'same-origin', + 'origin', + 'strict-origin', + 'origin-when-cross-origin', + 'strict-origin-when-cross-origin', + 'unsafe-url' +] +const referrerPolicySet = new Set(referrerPolicy) - // 3. If location is a header value, then set location to the result of - // parsing location with response’s URL. - if (location !== null && isValidHeaderValue(location)) { - location = new URL(location, responseURL(response)) - } +const requestRedirect = ['follow', 'manual', 'error'] - // 4. If location is a URL whose fragment is null, then set location’s - // fragment to requestFragment. - if (location && !location.hash) { - location.hash = requestFragment - } +const safeMethods = ['GET', 'HEAD', 'OPTIONS', 'TRACE'] +const safeMethodsSet = new Set(safeMethods) - // 5. Return location. - return location -} +const requestMode = ['navigate', 'same-origin', 'no-cors', 'cors'] -/** @returns {URL} */ -function requestCurrentURL (request) { - return request.urlList[request.urlList.length - 1] -} +const requestCredentials = ['omit', 'same-origin', 'include'] -function requestBadPort (request) { - // 1. Let url be request’s current URL. - const url = requestCurrentURL(request) +const requestCache = [ + 'default', + 'no-store', + 'reload', + 'no-cache', + 'force-cache', + 'only-if-cached' +] - // 2. If url’s scheme is an HTTP(S) scheme and url’s port is a bad port, - // then return blocked. - if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { - return 'blocked' - } +// https://fetch.spec.whatwg.org/#request-body-header-name +const requestBodyHeader = [ + 'content-encoding', + 'content-language', + 'content-location', + 'content-type', + // See https://github.com/nodejs/undici/issues/2021 + // 'Content-Length' is a forbidden header name, which is typically + // removed in the Headers implementation. However, undici doesn't + // filter out headers, so we add it here. + 'content-length' +] - // 3. Return allowed. - return 'allowed' -} +// https://fetch.spec.whatwg.org/#enumdef-requestduplex +const requestDuplex = [ + 'half' +] -function isErrorLike (object) { - return object instanceof Error || ( - object?.constructor?.name === 'Error' || - object?.constructor?.name === 'DOMException' - ) -} +// http://fetch.spec.whatwg.org/#forbidden-method +const forbiddenMethods = ['CONNECT', 'TRACE', 'TRACK'] +const forbiddenMethodsSet = new Set(forbiddenMethods) -// Check whether |statusText| is a ByteString and -// matches the Reason-Phrase token production. -// RFC 2616: https://tools.ietf.org/html/rfc2616 -// RFC 7230: https://tools.ietf.org/html/rfc7230 -// "reason-phrase = *( HTAB / SP / VCHAR / obs-text )" -// https://github.com/chromium/chromium/blob/94.0.4604.1/third_party/blink/renderer/core/fetch/response.cc#L116 -function isValidReasonPhrase (statusText) { - for (let i = 0; i < statusText.length; ++i) { - const c = statusText.charCodeAt(i) - if ( - !( - ( - c === 0x09 || // HTAB - (c >= 0x20 && c <= 0x7e) || // SP / VCHAR - (c >= 0x80 && c <= 0xff) - ) // obs-text - ) - ) { - return false - } - } - return true -} +const subresource = [ + 'audio', + 'audioworklet', + 'font', + 'image', + 'manifest', + 'paintworklet', + 'script', + 'style', + 'track', + 'video', + 'xslt', + '' +] +const subresourceSet = new Set(subresource) -/** - * @see https://tools.ietf.org/html/rfc7230#section-3.2.6 - * @param {number} c - */ -function isTokenCharCode (c) { - switch (c) { - case 0x22: - case 0x28: - case 0x29: - case 0x2c: - case 0x2f: - case 0x3a: - case 0x3b: - case 0x3c: - case 0x3d: - case 0x3e: - case 0x3f: - case 0x40: - case 0x5b: - case 0x5c: - case 0x5d: - case 0x7b: - case 0x7d: - // DQUOTE and "(),/:;<=>?@[\]{}" - return false - default: - // VCHAR %x21-7E - return c >= 0x21 && c <= 0x7e +/** @type {globalThis['DOMException']} */ +const DOMException = globalThis.DOMException ?? (() => { + // DOMException was only made a global in Node v17.0.0, + // but fetch supports >= v16.8. + try { + atob('~') + } catch (err) { + return Object.getPrototypeOf(err).constructor } -} +})() -/** - * @param {string} characters - */ -function isValidHTTPToken (characters) { - if (characters.length === 0) { - return false - } - for (let i = 0; i < characters.length; ++i) { - if (!isTokenCharCode(characters.charCodeAt(i))) { - return false +let channel + +/** @type {globalThis['structuredClone']} */ +const structuredClone = + globalThis.structuredClone ?? + // https://github.com/nodejs/node/blob/b27ae24dcc4251bad726d9d84baf678d1f707fed/lib/internal/structured_clone.js + // structuredClone was added in v17.0.0, but fetch supports v16.8 + function structuredClone (value, options = undefined) { + if (arguments.length === 0) { + throw new TypeError('missing argument') + } + + if (!channel) { + channel = new MessageChannel() } + channel.port1.unref() + channel.port2.unref() + channel.port1.postMessage(value, options?.transfer) + return receiveMessageOnPort(channel.port2).message } - return true + +module.exports = { + DOMException, + structuredClone, + subresource, + forbiddenMethods, + requestBodyHeader, + referrerPolicy, + requestRedirect, + requestMode, + requestCredentials, + requestCache, + redirectStatus, + corsSafeListedMethods, + nullBodyStatus, + safeMethods, + badPorts, + requestDuplex, + subresourceSet, + badPortsSet, + redirectStatusSet, + corsSafeListedMethodsSet, + safeMethodsSet, + forbiddenMethodsSet, + referrerPolicySet } + +/***/ }), + +/***/ 685: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const assert = __nccwpck_require__(39491) +const { atob } = __nccwpck_require__(14300) +const { isomorphicDecode } = __nccwpck_require__(52538) + +const encoder = new TextEncoder() + /** - * @see https://fetch.spec.whatwg.org/#header-name - * @param {string} potentialValue + * @see https://mimesniff.spec.whatwg.org/#http-token-code-point */ -function isValidHeaderName (potentialValue) { - return isValidHTTPToken(potentialValue) -} - +const HTTP_TOKEN_CODEPOINTS = /^[!#$%&'*+-.^_|~A-Za-z0-9]+$/ +const HTTP_WHITESPACE_REGEX = /(\u000A|\u000D|\u0009|\u0020)/ // eslint-disable-line /** - * @see https://fetch.spec.whatwg.org/#header-value - * @param {string} potentialValue + * @see https://mimesniff.spec.whatwg.org/#http-quoted-string-token-code-point */ -function isValidHeaderValue (potentialValue) { - // - Has no leading or trailing HTTP tab or space bytes. - // - Contains no 0x00 (NUL) or HTTP newline bytes. - if ( - potentialValue.startsWith('\t') || - potentialValue.startsWith(' ') || - potentialValue.endsWith('\t') || - potentialValue.endsWith(' ') - ) { - return false - } +const HTTP_QUOTED_STRING_TOKENS = /[\u0009|\u0020-\u007E|\u0080-\u00FF]/ // eslint-disable-line - if ( - potentialValue.includes('\0') || - potentialValue.includes('\r') || - potentialValue.includes('\n') - ) { - return false - } +// https://fetch.spec.whatwg.org/#data-url-processor +/** @param {URL} dataURL */ +function dataURLProcessor (dataURL) { + // 1. Assert: dataURL’s scheme is "data". + assert(dataURL.protocol === 'data:') - return true -} + // 2. Let input be the result of running the URL + // serializer on dataURL with exclude fragment + // set to true. + let input = URLSerializer(dataURL, true) -// https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect -function setRequestReferrerPolicyOnRedirect (request, actualResponse) { - // Given a request request and a response actualResponse, this algorithm - // updates request’s referrer policy according to the Referrer-Policy - // header (if any) in actualResponse. + // 3. Remove the leading "data:" string from input. + input = input.slice(5) - // 1. Let policy be the result of executing § 8.1 Parse a referrer policy - // from a Referrer-Policy header on actualResponse. + // 4. Let position point at the start of input. + const position = { position: 0 } - // 8.1 Parse a referrer policy from a Referrer-Policy header - // 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy` and response’s header list. - const { headersList } = actualResponse - // 2. Let policy be the empty string. - // 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty string, then set policy to token. - // 4. Return policy. - const policyHeader = (headersList.get('referrer-policy') ?? '').split(',') + // 5. Let mimeType be the result of collecting a + // sequence of code points that are not equal + // to U+002C (,), given position. + let mimeType = collectASequenceOfCodePointsFast( + ',', + input, + position + ) - // Note: As the referrer-policy can contain multiple policies - // separated by comma, we need to loop through all of them - // and pick the first valid one. - // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#specify_a_fallback_policy - let policy = '' - if (policyHeader.length > 0) { - // The right-most policy takes precedence. - // The left-most policy is the fallback. - for (let i = policyHeader.length; i !== 0; i--) { - const token = policyHeader[i - 1].trim() - if (referrerPolicyTokens.has(token)) { - policy = token - break - } - } - } + // 6. Strip leading and trailing ASCII whitespace + // from mimeType. + // Undici implementation note: we need to store the + // length because if the mimetype has spaces removed, + // the wrong amount will be sliced from the input in + // step #9 + const mimeTypeLength = mimeType.length + mimeType = removeASCIIWhitespace(mimeType, true, true) - // 2. If policy is not the empty string, then set request’s referrer policy to policy. - if (policy !== '') { - request.referrerPolicy = policy + // 7. If position is past the end of input, then + // return failure + if (position.position >= input.length) { + return 'failure' } -} - -// https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check -function crossOriginResourcePolicyCheck () { - // TODO - return 'allowed' -} - -// https://fetch.spec.whatwg.org/#concept-cors-check -function corsCheck () { - // TODO - return 'success' -} - -// https://fetch.spec.whatwg.org/#concept-tao-check -function TAOCheck () { - // TODO - return 'success' -} -function appendFetchMetadata (httpRequest) { - // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-dest-header - // TODO + // 8. Advance position by 1. + position.position++ - // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-mode-header + // 9. Let encodedBody be the remainder of input. + const encodedBody = input.slice(mimeTypeLength + 1) - // 1. Assert: r’s url is a potentially trustworthy URL. - // TODO + // 10. Let body be the percent-decoding of encodedBody. + let body = stringPercentDecode(encodedBody) - // 2. Let header be a Structured Header whose value is a token. - let header = null + // 11. If mimeType ends with U+003B (;), followed by + // zero or more U+0020 SPACE, followed by an ASCII + // case-insensitive match for "base64", then: + if (/;(\u0020){0,}base64$/i.test(mimeType)) { + // 1. Let stringBody be the isomorphic decode of body. + const stringBody = isomorphicDecode(body) - // 3. Set header’s value to r’s mode. - header = httpRequest.mode + // 2. Set body to the forgiving-base64 decode of + // stringBody. + body = forgivingBase64(stringBody) - // 4. Set a structured field value `Sec-Fetch-Mode`/header in r’s header list. - httpRequest.headersList.set('sec-fetch-mode', header) + // 3. If body is failure, then return failure. + if (body === 'failure') { + return 'failure' + } - // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-site-header - // TODO + // 4. Remove the last 6 code points from mimeType. + mimeType = mimeType.slice(0, -6) - // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-user-header - // TODO -} + // 5. Remove trailing U+0020 SPACE code points from mimeType, + // if any. + mimeType = mimeType.replace(/(\u0020)+$/, '') -// https://fetch.spec.whatwg.org/#append-a-request-origin-header -function appendRequestOriginHeader (request) { - // 1. Let serializedOrigin be the result of byte-serializing a request origin with request. - let serializedOrigin = request.origin + // 6. Remove the last U+003B (;) code point from mimeType. + mimeType = mimeType.slice(0, -1) + } - // 2. If request’s response tainting is "cors" or request’s mode is "websocket", then append (`Origin`, serializedOrigin) to request’s header list. - if (request.responseTainting === 'cors' || request.mode === 'websocket') { - if (serializedOrigin) { - request.headersList.append('origin', serializedOrigin) - } + // 12. If mimeType starts with U+003B (;), then prepend + // "text/plain" to mimeType. + if (mimeType.startsWith(';')) { + mimeType = 'text/plain' + mimeType + } - // 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then: - } else if (request.method !== 'GET' && request.method !== 'HEAD') { - // 1. Switch on request’s referrer policy: - switch (request.referrerPolicy) { - case 'no-referrer': - // Set serializedOrigin to `null`. - serializedOrigin = null - break - case 'no-referrer-when-downgrade': - case 'strict-origin': - case 'strict-origin-when-cross-origin': - // If request’s origin is a tuple origin, its scheme is "https", and request’s current URL’s scheme is not "https", then set serializedOrigin to `null`. - if (request.origin && urlHasHttpsScheme(request.origin) && !urlHasHttpsScheme(requestCurrentURL(request))) { - serializedOrigin = null - } - break - case 'same-origin': - // If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin to `null`. - if (!sameOrigin(request, requestCurrentURL(request))) { - serializedOrigin = null - } - break - default: - // Do nothing. - } + // 13. Let mimeTypeRecord be the result of parsing + // mimeType. + let mimeTypeRecord = parseMIMEType(mimeType) - if (serializedOrigin) { - // 2. Append (`Origin`, serializedOrigin) to request’s header list. - request.headersList.append('origin', serializedOrigin) - } + // 14. If mimeTypeRecord is failure, then set + // mimeTypeRecord to text/plain;charset=US-ASCII. + if (mimeTypeRecord === 'failure') { + mimeTypeRecord = parseMIMEType('text/plain;charset=US-ASCII') } -} -function coarsenedSharedCurrentTime (crossOriginIsolatedCapability) { - // TODO - return performance.now() + // 15. Return a new data: URL struct whose MIME + // type is mimeTypeRecord and body is body. + // https://fetch.spec.whatwg.org/#data-url-struct + return { mimeType: mimeTypeRecord, body } } -// https://fetch.spec.whatwg.org/#create-an-opaque-timing-info -function createOpaqueTimingInfo (timingInfo) { - return { - startTime: timingInfo.startTime ?? 0, - redirectStartTime: 0, - redirectEndTime: 0, - postRedirectStartTime: timingInfo.startTime ?? 0, - finalServiceWorkerStartTime: 0, - finalNetworkResponseStartTime: 0, - finalNetworkRequestStartTime: 0, - endTime: 0, - encodedBodySize: 0, - decodedBodySize: 0, - finalConnectionTimingInfo: null +// https://url.spec.whatwg.org/#concept-url-serializer +/** + * @param {URL} url + * @param {boolean} excludeFragment + */ +function URLSerializer (url, excludeFragment = false) { + if (!excludeFragment) { + return url.href } -} -// https://html.spec.whatwg.org/multipage/origin.html#policy-container -function makePolicyContainer () { - // Note: the fetch spec doesn't make use of embedder policy or CSP list - return { - referrerPolicy: 'strict-origin-when-cross-origin' - } -} + const href = url.href + const hashLength = url.hash.length -// https://html.spec.whatwg.org/multipage/origin.html#clone-a-policy-container -function clonePolicyContainer (policyContainer) { - return { - referrerPolicy: policyContainer.referrerPolicy - } + return hashLength === 0 ? href : href.substring(0, href.length - hashLength) } -// https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer -function determineRequestsReferrer (request) { - // 1. Let policy be request's referrer policy. - const policy = request.referrerPolicy +// https://infra.spec.whatwg.org/#collect-a-sequence-of-code-points +/** + * @param {(char: string) => boolean} condition + * @param {string} input + * @param {{ position: number }} position + */ +function collectASequenceOfCodePoints (condition, input, position) { + // 1. Let result be the empty string. + let result = '' - // Note: policy cannot (shouldn't) be null or an empty string. - assert(policy) + // 2. While position doesn’t point past the end of input and the + // code point at position within input meets the condition condition: + while (position.position < input.length && condition(input[position.position])) { + // 1. Append that code point to the end of result. + result += input[position.position] - // 2. Let environment be request’s client. + // 2. Advance position by 1. + position.position++ + } - let referrerSource = null + // 3. Return result. + return result +} - // 3. Switch on request’s referrer: - if (request.referrer === 'client') { - // Note: node isn't a browser and doesn't implement document/iframes, - // so we bypass this step and replace it with our own. +/** + * A faster collectASequenceOfCodePoints that only works when comparing a single character. + * @param {string} char + * @param {string} input + * @param {{ position: number }} position + */ +function collectASequenceOfCodePointsFast (char, input, position) { + const idx = input.indexOf(char, position.position) + const start = position.position - const globalOrigin = getGlobalOrigin() + if (idx === -1) { + position.position = input.length + return input.slice(start) + } - if (!globalOrigin || globalOrigin.origin === 'null') { - return 'no-referrer' - } + position.position = idx + return input.slice(start, position.position) +} - // note: we need to clone it as it's mutated - referrerSource = new URL(globalOrigin) - } else if (request.referrer instanceof URL) { - // Let referrerSource be request’s referrer. - referrerSource = request.referrer - } +// https://url.spec.whatwg.org/#string-percent-decode +/** @param {string} input */ +function stringPercentDecode (input) { + // 1. Let bytes be the UTF-8 encoding of input. + const bytes = encoder.encode(input) - // 4. Let request’s referrerURL be the result of stripping referrerSource for - // use as a referrer. - let referrerURL = stripURLForReferrer(referrerSource) + // 2. Return the percent-decoding of bytes. + return percentDecode(bytes) +} - // 5. Let referrerOrigin be the result of stripping referrerSource for use as - // a referrer, with the origin-only flag set to true. - const referrerOrigin = stripURLForReferrer(referrerSource, true) +// https://url.spec.whatwg.org/#percent-decode +/** @param {Uint8Array} input */ +function percentDecode (input) { + // 1. Let output be an empty byte sequence. + /** @type {number[]} */ + const output = [] - // 6. If the result of serializing referrerURL is a string whose length is - // greater than 4096, set referrerURL to referrerOrigin. - if (referrerURL.toString().length > 4096) { - referrerURL = referrerOrigin - } + // 2. For each byte byte in input: + for (let i = 0; i < input.length; i++) { + const byte = input[i] - const areSameOrigin = sameOrigin(request, referrerURL) - const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && - !isURLPotentiallyTrustworthy(request.url) + // 1. If byte is not 0x25 (%), then append byte to output. + if (byte !== 0x25) { + output.push(byte) - // 8. Execute the switch statements corresponding to the value of policy: - switch (policy) { - case 'origin': return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true) - case 'unsafe-url': return referrerURL - case 'same-origin': - return areSameOrigin ? referrerOrigin : 'no-referrer' - case 'origin-when-cross-origin': - return areSameOrigin ? referrerURL : referrerOrigin - case 'strict-origin-when-cross-origin': { - const currentURL = requestCurrentURL(request) + // 2. Otherwise, if byte is 0x25 (%) and the next two bytes + // after byte in input are not in the ranges + // 0x30 (0) to 0x39 (9), 0x41 (A) to 0x46 (F), + // and 0x61 (a) to 0x66 (f), all inclusive, append byte + // to output. + } else if ( + byte === 0x25 && + !/^[0-9A-Fa-f]{2}$/i.test(String.fromCharCode(input[i + 1], input[i + 2])) + ) { + output.push(0x25) - // 1. If the origin of referrerURL and the origin of request’s current - // URL are the same, then return referrerURL. - if (sameOrigin(referrerURL, currentURL)) { - return referrerURL - } + // 3. Otherwise: + } else { + // 1. Let bytePoint be the two bytes after byte in input, + // decoded, and then interpreted as hexadecimal number. + const nextTwoBytes = String.fromCharCode(input[i + 1], input[i + 2]) + const bytePoint = Number.parseInt(nextTwoBytes, 16) - // 2. If referrerURL is a potentially trustworthy URL and request’s - // current URL is not a potentially trustworthy URL, then return no - // referrer. - if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { - return 'no-referrer' - } + // 2. Append a byte whose value is bytePoint to output. + output.push(bytePoint) - // 3. Return referrerOrigin. - return referrerOrigin + // 3. Skip the next two bytes in input. + i += 2 } - case 'strict-origin': // eslint-disable-line - /** - * 1. If referrerURL is a potentially trustworthy URL and - * request’s current URL is not a potentially trustworthy URL, - * then return no referrer. - * 2. Return referrerOrigin - */ - case 'no-referrer-when-downgrade': // eslint-disable-line - /** - * 1. If referrerURL is a potentially trustworthy URL and - * request’s current URL is not a potentially trustworthy URL, - * then return no referrer. - * 2. Return referrerOrigin - */ - - default: // eslint-disable-line - return isNonPotentiallyTrustWorthy ? 'no-referrer' : referrerOrigin } + + // 3. Return output. + return Uint8Array.from(output) } -/** - * @see https://w3c.github.io/webappsec-referrer-policy/#strip-url - * @param {URL} url - * @param {boolean|undefined} originOnly - */ -function stripURLForReferrer (url, originOnly) { - // 1. Assert: url is a URL. - assert(url instanceof URL) +// https://mimesniff.spec.whatwg.org/#parse-a-mime-type +/** @param {string} input */ +function parseMIMEType (input) { + // 1. Remove any leading and trailing HTTP whitespace + // from input. + input = removeHTTPWhitespace(input, true, true) - // 2. If url’s scheme is a local scheme, then return no referrer. - if (url.protocol === 'file:' || url.protocol === 'about:' || url.protocol === 'blank:') { - return 'no-referrer' - } + // 2. Let position be a position variable for input, + // initially pointing at the start of input. + const position = { position: 0 } - // 3. Set url’s username to the empty string. - url.username = '' + // 3. Let type be the result of collecting a sequence + // of code points that are not U+002F (/) from + // input, given position. + const type = collectASequenceOfCodePointsFast( + '/', + input, + position + ) - // 4. Set url’s password to the empty string. - url.password = '' + // 4. If type is the empty string or does not solely + // contain HTTP token code points, then return failure. + // https://mimesniff.spec.whatwg.org/#http-token-code-point + if (type.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type)) { + return 'failure' + } - // 5. Set url’s fragment to null. - url.hash = '' + // 5. If position is past the end of input, then return + // failure + if (position.position > input.length) { + return 'failure' + } - // 6. If the origin-only flag is true, then: - if (originOnly) { - // 1. Set url’s path to « the empty string ». - url.pathname = '' + // 6. Advance position by 1. (This skips past U+002F (/).) + position.position++ - // 2. Set url’s query to null. - url.search = '' - } + // 7. Let subtype be the result of collecting a sequence of + // code points that are not U+003B (;) from input, given + // position. + let subtype = collectASequenceOfCodePointsFast( + ';', + input, + position + ) - // 7. Return url. - return url -} + // 8. Remove any trailing HTTP whitespace from subtype. + subtype = removeHTTPWhitespace(subtype, false, true) -function isURLPotentiallyTrustworthy (url) { - if (!(url instanceof URL)) { - return false + // 9. If subtype is the empty string or does not solely + // contain HTTP token code points, then return failure. + if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) { + return 'failure' } - // If child of about, return true - if (url.href === 'about:blank' || url.href === 'about:srcdoc') { - return true + const typeLowercase = type.toLowerCase() + const subtypeLowercase = subtype.toLowerCase() + + // 10. Let mimeType be a new MIME type record whose type + // is type, in ASCII lowercase, and subtype is subtype, + // in ASCII lowercase. + // https://mimesniff.spec.whatwg.org/#mime-type + const mimeType = { + type: typeLowercase, + subtype: subtypeLowercase, + /** @type {Map} */ + parameters: new Map(), + // https://mimesniff.spec.whatwg.org/#mime-type-essence + essence: `${typeLowercase}/${subtypeLowercase}` } - // If scheme is data, return true - if (url.protocol === 'data:') return true + // 11. While position is not past the end of input: + while (position.position < input.length) { + // 1. Advance position by 1. (This skips past U+003B (;).) + position.position++ - // If file, return true - if (url.protocol === 'file:') return true + // 2. Collect a sequence of code points that are HTTP + // whitespace from input given position. + collectASequenceOfCodePoints( + // https://fetch.spec.whatwg.org/#http-whitespace + char => HTTP_WHITESPACE_REGEX.test(char), + input, + position + ) - return isOriginPotentiallyTrustworthy(url.origin) + // 3. Let parameterName be the result of collecting a + // sequence of code points that are not U+003B (;) + // or U+003D (=) from input, given position. + let parameterName = collectASequenceOfCodePoints( + (char) => char !== ';' && char !== '=', + input, + position + ) - function isOriginPotentiallyTrustworthy (origin) { - // If origin is explicitly null, return false - if (origin == null || origin === 'null') return false + // 4. Set parameterName to parameterName, in ASCII + // lowercase. + parameterName = parameterName.toLowerCase() - const originAsURL = new URL(origin) + // 5. If position is not past the end of input, then: + if (position.position < input.length) { + // 1. If the code point at position within input is + // U+003B (;), then continue. + if (input[position.position] === ';') { + continue + } - // If secure, return true - if (originAsURL.protocol === 'https:' || originAsURL.protocol === 'wss:') { - return true + // 2. Advance position by 1. (This skips past U+003D (=).) + position.position++ } - // If localhost or variants, return true - if (/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(originAsURL.hostname) || - (originAsURL.hostname === 'localhost' || originAsURL.hostname.includes('localhost.')) || - (originAsURL.hostname.endsWith('.localhost'))) { - return true + // 6. If position is past the end of input, then break. + if (position.position > input.length) { + break } - // If any other, return false - return false - } -} + // 7. Let parameterValue be null. + let parameterValue = null -/** - * @see https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist - * @param {Uint8Array} bytes - * @param {string} metadataList - */ -function bytesMatch (bytes, metadataList) { - // If node is not built with OpenSSL support, we cannot check - // a request's integrity, so allow it by default (the spec will - // allow requests if an invalid hash is given, as precedence). - /* istanbul ignore if: only if node is built with --without-ssl */ - if (crypto === undefined) { - return true - } + // 8. If the code point at position within input is + // U+0022 ("), then: + if (input[position.position] === '"') { + // 1. Set parameterValue to the result of collecting + // an HTTP quoted string from input, given position + // and the extract-value flag. + parameterValue = collectAnHTTPQuotedString(input, position, true) - // 1. Let parsedMetadata be the result of parsing metadataList. - const parsedMetadata = parseMetadata(metadataList) + // 2. Collect a sequence of code points that are not + // U+003B (;) from input, given position. + collectASequenceOfCodePointsFast( + ';', + input, + position + ) - // 2. If parsedMetadata is no metadata, return true. - if (parsedMetadata === 'no metadata') { - return true - } + // 9. Otherwise: + } else { + // 1. Set parameterValue to the result of collecting + // a sequence of code points that are not U+003B (;) + // from input, given position. + parameterValue = collectASequenceOfCodePointsFast( + ';', + input, + position + ) - // 3. If response is not eligible for integrity validation, return false. - // TODO + // 2. Remove any trailing HTTP whitespace from parameterValue. + parameterValue = removeHTTPWhitespace(parameterValue, false, true) - // 4. If parsedMetadata is the empty set, return true. - if (parsedMetadata.length === 0) { - return true + // 3. If parameterValue is the empty string, then continue. + if (parameterValue.length === 0) { + continue + } + } + + // 10. If all of the following are true + // - parameterName is not the empty string + // - parameterName solely contains HTTP token code points + // - parameterValue solely contains HTTP quoted-string token code points + // - mimeType’s parameters[parameterName] does not exist + // then set mimeType’s parameters[parameterName] to parameterValue. + if ( + parameterName.length !== 0 && + HTTP_TOKEN_CODEPOINTS.test(parameterName) && + (parameterValue.length === 0 || HTTP_QUOTED_STRING_TOKENS.test(parameterValue)) && + !mimeType.parameters.has(parameterName) + ) { + mimeType.parameters.set(parameterName, parameterValue) + } } - // 5. Let metadata be the result of getting the strongest - // metadata from parsedMetadata. - const strongest = getStrongestMetadata(parsedMetadata) - const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest) + // 12. Return mimeType. + return mimeType +} - // 6. For each item in metadata: - for (const item of metadata) { - // 1. Let algorithm be the alg component of item. - const algorithm = item.algo +// https://infra.spec.whatwg.org/#forgiving-base64-decode +/** @param {string} data */ +function forgivingBase64 (data) { + // 1. Remove all ASCII whitespace from data. + data = data.replace(/[\u0009\u000A\u000C\u000D\u0020]/g, '') // eslint-disable-line - // 2. Let expectedValue be the val component of item. - const expectedValue = item.hash + // 2. If data’s code point length divides by 4 leaving + // no remainder, then: + if (data.length % 4 === 0) { + // 1. If data ends with one or two U+003D (=) code points, + // then remove them from data. + data = data.replace(/=?=$/, '') + } - // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e - // "be liberal with padding". This is annoying, and it's not even in the spec. + // 3. If data’s code point length divides by 4 leaving + // a remainder of 1, then return failure. + if (data.length % 4 === 1) { + return 'failure' + } - // 3. Let actualValue be the result of applying algorithm to bytes. - let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') + // 4. If data contains a code point that is not one of + // U+002B (+) + // U+002F (/) + // ASCII alphanumeric + // then return failure. + if (/[^+/0-9A-Za-z]/.test(data)) { + return 'failure' + } - if (actualValue[actualValue.length - 1] === '=') { - if (actualValue[actualValue.length - 2] === '=') { - actualValue = actualValue.slice(0, -2) - } else { - actualValue = actualValue.slice(0, -1) - } - } + const binary = atob(data) + const bytes = new Uint8Array(binary.length) - // 4. If actualValue is a case-sensitive match for expectedValue, - // return true. - if (compareBase64Mixed(actualValue, expectedValue)) { - return true - } + for (let byte = 0; byte < binary.length; byte++) { + bytes[byte] = binary.charCodeAt(byte) } - // 7. Return false. - return false + return bytes } -// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options -// https://www.w3.org/TR/CSP2/#source-list-syntax -// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1 -const parseHashWithOptions = /(?sha256|sha384|sha512)-((?[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i - +// https://fetch.spec.whatwg.org/#collect-an-http-quoted-string +// tests: https://fetch.spec.whatwg.org/#example-http-quoted-string /** - * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata - * @param {string} metadata + * @param {string} input + * @param {{ position: number }} position + * @param {boolean?} extractValue */ -function parseMetadata (metadata) { - // 1. Let result be the empty set. - /** @type {{ algo: string, hash: string }[]} */ - const result = [] +function collectAnHTTPQuotedString (input, position, extractValue) { + // 1. Let positionStart be position. + const positionStart = position.position - // 2. Let empty be equal to true. - let empty = true + // 2. Let value be the empty string. + let value = '' - // 3. For each token returned by splitting metadata on spaces: - for (const token of metadata.split(' ')) { - // 1. Set empty to false. - empty = false + // 3. Assert: the code point at position within input + // is U+0022 ("). + assert(input[position.position] === '"') - // 2. Parse token as a hash-with-options. - const parsedToken = parseHashWithOptions.exec(token) + // 4. Advance position by 1. + position.position++ - // 3. If token does not parse, continue to the next token. - if ( - parsedToken === null || - parsedToken.groups === undefined || - parsedToken.groups.algo === undefined - ) { - // Note: Chromium blocks the request at this point, but Firefox - // gives a warning that an invalid integrity was given. The - // correct behavior is to ignore these, and subsequently not - // check the integrity of the resource. - continue + // 5. While true: + while (true) { + // 1. Append the result of collecting a sequence of code points + // that are not U+0022 (") or U+005C (\) from input, given + // position, to value. + value += collectASequenceOfCodePoints( + (char) => char !== '"' && char !== '\\', + input, + position + ) + + // 2. If position is past the end of input, then break. + if (position.position >= input.length) { + break } - // 4. Let algorithm be the hash-algo component of token. - const algorithm = parsedToken.groups.algo.toLowerCase() + // 3. Let quoteOrBackslash be the code point at position within + // input. + const quoteOrBackslash = input[position.position] - // 5. If algorithm is a hash function recognized by the user - // agent, add the parsed token to result. - if (supportedHashes.includes(algorithm)) { - result.push(parsedToken.groups) + // 4. Advance position by 1. + position.position++ + + // 5. If quoteOrBackslash is U+005C (\), then: + if (quoteOrBackslash === '\\') { + // 1. If position is past the end of input, then append + // U+005C (\) to value and break. + if (position.position >= input.length) { + value += '\\' + break + } + + // 2. Append the code point at position within input to value. + value += input[position.position] + + // 3. Advance position by 1. + position.position++ + + // 6. Otherwise: + } else { + // 1. Assert: quoteOrBackslash is U+0022 ("). + assert(quoteOrBackslash === '"') + + // 2. Break. + break } } - // 4. Return no metadata if empty is true, otherwise return result. - if (empty === true) { - return 'no metadata' + // 6. If the extract-value flag is set, then return value. + if (extractValue) { + return value } - return result + // 7. Return the code points from positionStart to position, + // inclusive, within input. + return input.slice(positionStart, position.position) } /** - * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList + * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type */ -function getStrongestMetadata (metadataList) { - // Let algorithm be the algo component of the first item in metadataList. - // Can be sha256 - let algorithm = metadataList[0].algo - // If the algorithm is sha512, then it is the strongest - // and we can return immediately - if (algorithm[3] === '5') { - return algorithm - } +function serializeAMimeType (mimeType) { + assert(mimeType !== 'failure') + const { parameters, essence } = mimeType - for (let i = 1; i < metadataList.length; ++i) { - const metadata = metadataList[i] - // If the algorithm is sha512, then it is the strongest - // and we can break the loop immediately - if (metadata.algo[3] === '5') { - algorithm = 'sha512' - break - // If the algorithm is sha384, then a potential sha256 or sha384 is ignored - } else if (algorithm[3] === '3') { - continue - // algorithm is sha256, check if algorithm is sha384 and if so, set it as - // the strongest - } else if (metadata.algo[3] === '3') { - algorithm = 'sha384' - } - } - return algorithm -} + // 1. Let serialization be the concatenation of mimeType’s + // type, U+002F (/), and mimeType’s subtype. + let serialization = essence -function filterMetadataListByAlgorithm (metadataList, algorithm) { - if (metadataList.length === 1) { - return metadataList - } + // 2. For each name → value of mimeType’s parameters: + for (let [name, value] of parameters.entries()) { + // 1. Append U+003B (;) to serialization. + serialization += ';' - let pos = 0 - for (let i = 0; i < metadataList.length; ++i) { - if (metadataList[i].algo === algorithm) { - metadataList[pos++] = metadataList[i] - } - } + // 2. Append name to serialization. + serialization += name - metadataList.length = pos + // 3. Append U+003D (=) to serialization. + serialization += '=' - return metadataList -} + // 4. If value does not solely contain HTTP token code + // points or value is the empty string, then: + if (!HTTP_TOKEN_CODEPOINTS.test(value)) { + // 1. Precede each occurence of U+0022 (") or + // U+005C (\) in value with U+005C (\). + value = value.replace(/(\\|")/g, '\\$1') -/** - * Compares two base64 strings, allowing for base64url - * in the second string. - * -* @param {string} actualValue always base64 - * @param {string} expectedValue base64 or base64url - * @returns {boolean} - */ -function compareBase64Mixed (actualValue, expectedValue) { - if (actualValue.length !== expectedValue.length) { - return false - } - for (let i = 0; i < actualValue.length; ++i) { - if (actualValue[i] !== expectedValue[i]) { - if ( - (actualValue[i] === '+' && expectedValue[i] === '-') || - (actualValue[i] === '/' && expectedValue[i] === '_') - ) { - continue - } - return false + // 2. Prepend U+0022 (") to value. + value = '"' + value + + // 3. Append U+0022 (") to value. + value += '"' } + + // 5. Append value to serialization. + serialization += value } - return true + // 3. Return serialization. + return serialization } -// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request -function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { - // TODO +/** + * @see https://fetch.spec.whatwg.org/#http-whitespace + * @param {string} char + */ +function isHTTPWhiteSpace (char) { + return char === '\r' || char === '\n' || char === '\t' || char === ' ' } /** - * @link {https://html.spec.whatwg.org/multipage/origin.html#same-origin} - * @param {URL} A - * @param {URL} B + * @see https://fetch.spec.whatwg.org/#http-whitespace + * @param {string} str */ -function sameOrigin (A, B) { - // 1. If A and B are the same opaque origin, then return true. - if (A.origin === B.origin && A.origin === 'null') { - return true - } +function removeHTTPWhitespace (str, leading = true, trailing = true) { + let lead = 0 + let trail = str.length - 1 - // 2. If A and B are both tuple origins and their schemes, - // hosts, and port are identical, then return true. - if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) { - return true + if (leading) { + for (; lead < str.length && isHTTPWhiteSpace(str[lead]); lead++); } - // 3. Return false. - return false -} - -function createDeferredPromise () { - let res - let rej - const promise = new Promise((resolve, reject) => { - res = resolve - rej = reject - }) - - return { promise, resolve: res, reject: rej } -} - -function isAborted (fetchParams) { - return fetchParams.controller.state === 'aborted' -} + if (trailing) { + for (; trail > 0 && isHTTPWhiteSpace(str[trail]); trail--); + } -function isCancelled (fetchParams) { - return fetchParams.controller.state === 'aborted' || - fetchParams.controller.state === 'terminated' + return str.slice(lead, trail + 1) } -const normalizeMethodRecord = { - delete: 'DELETE', - DELETE: 'DELETE', - get: 'GET', - GET: 'GET', - head: 'HEAD', - HEAD: 'HEAD', - options: 'OPTIONS', - OPTIONS: 'OPTIONS', - post: 'POST', - POST: 'POST', - put: 'PUT', - PUT: 'PUT' +/** + * @see https://infra.spec.whatwg.org/#ascii-whitespace + * @param {string} char + */ +function isASCIIWhitespace (char) { + return char === '\r' || char === '\n' || char === '\t' || char === '\f' || char === ' ' } -// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`. -Object.setPrototypeOf(normalizeMethodRecord, null) - /** - * @see https://fetch.spec.whatwg.org/#concept-method-normalize - * @param {string} method + * @see https://infra.spec.whatwg.org/#strip-leading-and-trailing-ascii-whitespace */ -function normalizeMethod (method) { - return normalizeMethodRecord[method.toLowerCase()] ?? method -} +function removeASCIIWhitespace (str, leading = true, trailing = true) { + let lead = 0 + let trail = str.length - 1 -// https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-a-json-string -function serializeJavascriptValueToJSONString (value) { - // 1. Let result be ? Call(%JSON.stringify%, undefined, « value »). - const result = JSON.stringify(value) + if (leading) { + for (; lead < str.length && isASCIIWhitespace(str[lead]); lead++); + } - // 2. If result is undefined, then throw a TypeError. - if (result === undefined) { - throw new TypeError('Value is not JSON serializable') + if (trailing) { + for (; trail > 0 && isASCIIWhitespace(str[trail]); trail--); } - // 3. Assert: result is a string. - assert(typeof result === 'string') + return str.slice(lead, trail + 1) +} - // 4. Return result. - return result +module.exports = { + dataURLProcessor, + URLSerializer, + collectASequenceOfCodePoints, + collectASequenceOfCodePointsFast, + stringPercentDecode, + parseMIMEType, + collectAnHTTPQuotedString, + serializeAMimeType } -// https://tc39.es/ecma262/#sec-%25iteratorprototype%25-object -const esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())) -/** - * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object - * @param {() => unknown[]} iterator - * @param {string} name name of the instance - * @param {'key'|'value'|'key+value'} kind - */ -function makeIterator (iterator, name, kind) { - const object = { - index: 0, - kind, - target: iterator - } +/***/ }), - const i = { - next () { - // 1. Let interface be the interface for which the iterator prototype object exists. +/***/ 78511: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 2. Let thisValue be the this value. +"use strict"; - // 3. Let object be ? ToObject(thisValue). - // 4. If object is a platform object, then perform a security - // check, passing: +const { Blob, File: NativeFile } = __nccwpck_require__(14300) +const { types } = __nccwpck_require__(73837) +const { kState } = __nccwpck_require__(15861) +const { isBlobLike } = __nccwpck_require__(52538) +const { webidl } = __nccwpck_require__(21744) +const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685) +const { kEnumerableProperty } = __nccwpck_require__(83983) +const encoder = new TextEncoder() - // 5. If object is not a default iterator object for interface, - // then throw a TypeError. - if (Object.getPrototypeOf(this) !== i) { - throw new TypeError( - `'next' called on an object that does not implement interface ${name} Iterator.` - ) - } +class File extends Blob { + constructor (fileBits, fileName, options = {}) { + // The File constructor is invoked with two or three parameters, depending + // on whether the optional dictionary parameter is used. When the File() + // constructor is invoked, user agents must run the following steps: + webidl.argumentLengthCheck(arguments, 2, { header: 'File constructor' }) - // 6. Let index be object’s index. - // 7. Let kind be object’s kind. - // 8. Let values be object’s target's value pairs to iterate over. - const { index, kind, target } = object - const values = target() + fileBits = webidl.converters['sequence'](fileBits) + fileName = webidl.converters.USVString(fileName) + options = webidl.converters.FilePropertyBag(options) - // 9. Let len be the length of values. - const len = values.length + // 1. Let bytes be the result of processing blob parts given fileBits and + // options. + // Note: Blob handles this for us - // 10. If index is greater than or equal to len, then return - // CreateIterResultObject(undefined, true). - if (index >= len) { - return { value: undefined, done: true } - } + // 2. Let n be the fileName argument to the constructor. + const n = fileName - // 11. Let pair be the entry in values at index index. - const pair = values[index] + // 3. Process FilePropertyBag dictionary argument by running the following + // substeps: - // 12. Set object’s index to index + 1. - object.index = index + 1 + // 1. If the type member is provided and is not the empty string, let t + // be set to the type dictionary member. If t contains any characters + // outside the range U+0020 to U+007E, then set t to the empty string + // and return from these substeps. + // 2. Convert every character in t to ASCII lowercase. + let t = options.type + let d - // 13. Return the iterator result for pair and kind. - return iteratorResult(pair, kind) - }, - // The class string of an iterator prototype object for a given interface is the - // result of concatenating the identifier of the interface and the string " Iterator". - [Symbol.toStringTag]: `${name} Iterator` - } + // eslint-disable-next-line no-labels + substep: { + if (t) { + t = parseMIMEType(t) - // The [[Prototype]] internal slot of an iterator prototype object must be %IteratorPrototype%. - Object.setPrototypeOf(i, esIteratorPrototype) - // esIteratorPrototype needs to be the prototype of i - // which is the prototype of an empty object. Yes, it's confusing. - return Object.setPrototypeOf({}, i) -} + if (t === 'failure') { + t = '' + // eslint-disable-next-line no-labels + break substep + } -// https://webidl.spec.whatwg.org/#iterator-result -function iteratorResult (pair, kind) { - let result + t = serializeAMimeType(t).toLowerCase() + } - // 1. Let result be a value determined by the value of kind: - switch (kind) { - case 'key': { - // 1. Let idlKey be pair’s key. - // 2. Let key be the result of converting idlKey to an - // ECMAScript value. - // 3. result is key. - result = pair[0] - break - } - case 'value': { - // 1. Let idlValue be pair’s value. - // 2. Let value be the result of converting idlValue to - // an ECMAScript value. - // 3. result is value. - result = pair[1] - break + // 3. If the lastModified member is provided, let d be set to the + // lastModified dictionary member. If it is not provided, set d to the + // current date and time represented as the number of milliseconds since + // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]). + d = options.lastModified } - case 'key+value': { - // 1. Let idlKey be pair’s key. - // 2. Let idlValue be pair’s value. - // 3. Let key be the result of converting idlKey to an - // ECMAScript value. - // 4. Let value be the result of converting idlValue to - // an ECMAScript value. - // 5. Let array be ! ArrayCreate(2). - // 6. Call ! CreateDataProperty(array, "0", key). - // 7. Call ! CreateDataProperty(array, "1", value). - // 8. result is array. - result = pair - break + + // 4. Return a new File object F such that: + // F refers to the bytes byte sequence. + // F.size is set to the number of total bytes in bytes. + // F.name is set to n. + // F.type is set to t. + // F.lastModified is set to d. + + super(processBlobParts(fileBits, options), { type: t }) + this[kState] = { + name: n, + lastModified: d, + type: t } } - // 2. Return CreateIterResultObject(result, false). - return { value: result, done: false } + get name () { + webidl.brandCheck(this, File) + + return this[kState].name + } + + get lastModified () { + webidl.brandCheck(this, File) + + return this[kState].lastModified + } + + get type () { + webidl.brandCheck(this, File) + + return this[kState].type + } } -/** - * @see https://fetch.spec.whatwg.org/#body-fully-read - */ -async function fullyReadBody (body, processBody, processBodyError) { - // 1. If taskDestination is null, then set taskDestination to - // the result of starting a new parallel queue. +class FileLike { + constructor (blobLike, fileName, options = {}) { + // TODO: argument idl type check - // 2. Let successSteps given a byte sequence bytes be to queue a - // fetch task to run processBody given bytes, with taskDestination. - const successSteps = processBody + // The File constructor is invoked with two or three parameters, depending + // on whether the optional dictionary parameter is used. When the File() + // constructor is invoked, user agents must run the following steps: - // 3. Let errorSteps be to queue a fetch task to run processBodyError, - // with taskDestination. - const errorSteps = processBodyError + // 1. Let bytes be the result of processing blob parts given fileBits and + // options. - // 4. Let reader be the result of getting a reader for body’s stream. - // If that threw an exception, then run errorSteps with that - // exception and return. - let reader + // 2. Let n be the fileName argument to the constructor. + const n = fileName - try { - reader = body.stream.getReader() - } catch (e) { - errorSteps(e) - return + // 3. Process FilePropertyBag dictionary argument by running the following + // substeps: + + // 1. If the type member is provided and is not the empty string, let t + // be set to the type dictionary member. If t contains any characters + // outside the range U+0020 to U+007E, then set t to the empty string + // and return from these substeps. + // TODO + const t = options.type + + // 2. Convert every character in t to ASCII lowercase. + // TODO + + // 3. If the lastModified member is provided, let d be set to the + // lastModified dictionary member. If it is not provided, set d to the + // current date and time represented as the number of milliseconds since + // the Unix Epoch (which is the equivalent of Date.now() [ECMA-262]). + const d = options.lastModified ?? Date.now() + + // 4. Return a new File object F such that: + // F refers to the bytes byte sequence. + // F.size is set to the number of total bytes in bytes. + // F.name is set to n. + // F.type is set to t. + // F.lastModified is set to d. + + this[kState] = { + blobLike, + name: n, + type: t, + lastModified: d + } } - // 5. Read all bytes from reader, given successSteps and errorSteps. - try { - const result = await readAllBytes(reader) - successSteps(result) - } catch (e) { - errorSteps(e) + stream (...args) { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.stream(...args) } -} -/** @type {ReadableStream} */ -let ReadableStream = globalThis.ReadableStream + arrayBuffer (...args) { + webidl.brandCheck(this, FileLike) -function isReadableStreamLike (stream) { - if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(35356).ReadableStream) + return this[kState].blobLike.arrayBuffer(...args) } - return stream instanceof ReadableStream || ( - stream[Symbol.toStringTag] === 'ReadableStream' && - typeof stream.tee === 'function' - ) -} + slice (...args) { + webidl.brandCheck(this, FileLike) -const MAXIMUM_ARGUMENT_LENGTH = 65535 + return this[kState].blobLike.slice(...args) + } -/** - * @see https://infra.spec.whatwg.org/#isomorphic-decode - * @param {number[]|Uint8Array} input - */ -function isomorphicDecode (input) { - // 1. To isomorphic decode a byte sequence input, return a string whose code point - // length is equal to input’s length and whose code points have the same values - // as the values of input’s bytes, in the same order. + text (...args) { + webidl.brandCheck(this, FileLike) - if (input.length < MAXIMUM_ARGUMENT_LENGTH) { - return String.fromCharCode(...input) + return this[kState].blobLike.text(...args) } - return input.reduce((previous, current) => previous + String.fromCharCode(current), '') -} + get size () { + webidl.brandCheck(this, FileLike) -/** - * @param {ReadableStreamController} controller - */ -function readableStreamClose (controller) { - try { - controller.close() - } catch (err) { - // TODO: add comment explaining why this error occurs. - if (!err.message.includes('Controller is already closed')) { - throw err - } + return this[kState].blobLike.size } -} -/** - * @see https://infra.spec.whatwg.org/#isomorphic-encode - * @param {string} input - */ -function isomorphicEncode (input) { - // 1. Assert: input contains no code points greater than U+00FF. - for (let i = 0; i < input.length; i++) { - assert(input.charCodeAt(i) <= 0xFF) + get type () { + webidl.brandCheck(this, FileLike) + + return this[kState].blobLike.type } - // 2. Return a byte sequence whose length is equal to input’s code - // point length and whose bytes have the same values as the - // values of input’s code points, in the same order - return input + get name () { + webidl.brandCheck(this, FileLike) + + return this[kState].name + } + + get lastModified () { + webidl.brandCheck(this, FileLike) + + return this[kState].lastModified + } + + get [Symbol.toStringTag] () { + return 'File' + } } -/** - * @see https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes - * @see https://streams.spec.whatwg.org/#read-loop - * @param {ReadableStreamDefaultReader} reader - */ -async function readAllBytes (reader) { - const bytes = [] - let byteLength = 0 +Object.defineProperties(File.prototype, { + [Symbol.toStringTag]: { + value: 'File', + configurable: true + }, + name: kEnumerableProperty, + lastModified: kEnumerableProperty +}) - while (true) { - const { done, value: chunk } = await reader.read() +webidl.converters.Blob = webidl.interfaceConverter(Blob) - if (done) { - // 1. Call successSteps with bytes. - return Buffer.concat(bytes, byteLength) +webidl.converters.BlobPart = function (V, opts) { + if (webidl.util.Type(V) === 'Object') { + if (isBlobLike(V)) { + return webidl.converters.Blob(V, { strict: false }) } - // 1. If chunk is not a Uint8Array object, call failureSteps - // with a TypeError and abort these steps. - if (!isUint8Array(chunk)) { - throw new TypeError('Received non-Uint8Array chunk') + if ( + ArrayBuffer.isView(V) || + types.isAnyArrayBuffer(V) + ) { + return webidl.converters.BufferSource(V, opts) + } + } + + return webidl.converters.USVString(V, opts) +} + +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.BlobPart +) + +// https://www.w3.org/TR/FileAPI/#dfn-FilePropertyBag +webidl.converters.FilePropertyBag = webidl.dictionaryConverter([ + { + key: 'lastModified', + converter: webidl.converters['long long'], + get defaultValue () { + return Date.now() } + }, + { + key: 'type', + converter: webidl.converters.DOMString, + defaultValue: '' + }, + { + key: 'endings', + converter: (value) => { + value = webidl.converters.DOMString(value) + value = value.toLowerCase() - // 2. Append the bytes represented by chunk to bytes. - bytes.push(chunk) - byteLength += chunk.length + if (value !== 'native') { + value = 'transparent' + } - // 3. Read-loop given reader, bytes, successSteps, and failureSteps. + return value + }, + defaultValue: 'transparent' } -} +]) /** - * @see https://fetch.spec.whatwg.org/#is-local - * @param {URL} url + * @see https://www.w3.org/TR/FileAPI/#process-blob-parts + * @param {(NodeJS.TypedArray|Blob|string)[]} parts + * @param {{ type: string, endings: string }} options */ -function urlIsLocal (url) { - assert('protocol' in url) // ensure it's a url object +function processBlobParts (parts, options) { + // 1. Let bytes be an empty sequence of bytes. + /** @type {NodeJS.TypedArray[]} */ + const bytes = [] - const protocol = url.protocol + // 2. For each element in parts: + for (const element of parts) { + // 1. If element is a USVString, run the following substeps: + if (typeof element === 'string') { + // 1. Let s be element. + let s = element - return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:' -} + // 2. If the endings member of options is "native", set s + // to the result of converting line endings to native + // of element. + if (options.endings === 'native') { + s = convertLineEndingsNative(s) + } -/** - * @param {string|URL} url - */ -function urlHasHttpsScheme (url) { - if (typeof url === 'string') { - return url.startsWith('https:') + // 3. Append the result of UTF-8 encoding s to bytes. + bytes.push(encoder.encode(s)) + } else if ( + types.isAnyArrayBuffer(element) || + types.isTypedArray(element) + ) { + // 2. If element is a BufferSource, get a copy of the + // bytes held by the buffer source, and append those + // bytes to bytes. + if (!element.buffer) { // ArrayBuffer + bytes.push(new Uint8Array(element)) + } else { + bytes.push( + new Uint8Array(element.buffer, element.byteOffset, element.byteLength) + ) + } + } else if (isBlobLike(element)) { + // 3. If element is a Blob, append the bytes it represents + // to bytes. + bytes.push(element) + } } - return url.protocol === 'https:' + // 3. Return bytes. + return bytes } /** - * @see https://fetch.spec.whatwg.org/#http-scheme - * @param {URL} url + * @see https://www.w3.org/TR/FileAPI/#convert-line-endings-to-native + * @param {string} s */ -function urlIsHttpHttpsScheme (url) { - assert('protocol' in url) // ensure it's a url object +function convertLineEndingsNative (s) { + // 1. Let native line ending be be the code point U+000A LF. + let nativeLineEnding = '\n' - const protocol = url.protocol + // 2. If the underlying platform’s conventions are to + // represent newlines as a carriage return and line feed + // sequence, set native line ending to the code point + // U+000D CR followed by the code point U+000A LF. + if (process.platform === 'win32') { + nativeLineEnding = '\r\n' + } - return protocol === 'http:' || protocol === 'https:' + return s.replace(/\r?\n/g, nativeLineEnding) } -/** - * Fetch supports node >= 16.8.0, but Object.hasOwn was added in v16.9.0. - */ -const hasOwn = Object.hasOwn || ((dict, key) => Object.prototype.hasOwnProperty.call(dict, key)) - -module.exports = { - isAborted, - isCancelled, - createDeferredPromise, - ReadableStreamFrom, - toUSVString, - tryUpgradeRequestToAPotentiallyTrustworthyURL, - coarsenedSharedCurrentTime, - determineRequestsReferrer, - makePolicyContainer, - clonePolicyContainer, - appendFetchMetadata, - appendRequestOriginHeader, - TAOCheck, - corsCheck, - crossOriginResourcePolicyCheck, - createOpaqueTimingInfo, - setRequestReferrerPolicyOnRedirect, - isValidHTTPToken, - requestBadPort, - requestCurrentURL, - responseURL, - responseLocationURL, - isBlobLike, - isURLPotentiallyTrustworthy, - isValidReasonPhrase, - sameOrigin, - normalizeMethod, - serializeJavascriptValueToJSONString, - makeIterator, - isValidHeaderName, - isValidHeaderValue, - hasOwn, - isErrorLike, - fullyReadBody, - bytesMatch, - isReadableStreamLike, - readableStreamClose, - isomorphicEncode, - isomorphicDecode, - urlIsLocal, - urlHasHttpsScheme, - urlIsHttpHttpsScheme, - readAllBytes, - normalizeMethodRecord, - parseMetadata +// If this function is moved to ./util.js, some tools (such as +// rollup) will warn about circular dependencies. See: +// https://github.com/nodejs/undici/issues/1629 +function isFileLike (object) { + return ( + (NativeFile && object instanceof NativeFile) || + object instanceof File || ( + object && + (typeof object.stream === 'function' || + typeof object.arrayBuffer === 'function') && + object[Symbol.toStringTag] === 'File' + ) + ) } +module.exports = { File, FileLike, isFileLike } + /***/ }), -/***/ 21744: +/***/ 72015: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const { types } = __nccwpck_require__(73837) -const { hasOwn, toUSVString } = __nccwpck_require__(52538) +const { isBlobLike, toUSVString, makeIterator } = __nccwpck_require__(52538) +const { kState } = __nccwpck_require__(15861) +const { File: UndiciFile, FileLike, isFileLike } = __nccwpck_require__(78511) +const { webidl } = __nccwpck_require__(21744) +const { Blob, File: NativeFile } = __nccwpck_require__(14300) -/** @type {import('../../types/webidl').Webidl} */ -const webidl = {} -webidl.converters = {} -webidl.util = {} -webidl.errors = {} +/** @type {globalThis['File']} */ +const File = NativeFile ?? UndiciFile -webidl.errors.exception = function (message) { - return new TypeError(`${message.header}: ${message.message}`) -} +// https://xhr.spec.whatwg.org/#formdata +class FormData { + constructor (form) { + if (form !== undefined) { + throw webidl.errors.conversionFailed({ + prefix: 'FormData constructor', + argument: 'Argument 1', + types: ['undefined'] + }) + } -webidl.errors.conversionFailed = function (context) { - const plural = context.types.length === 1 ? '' : ' one of' - const message = - `${context.argument} could not be converted to` + - `${plural}: ${context.types.join(', ')}.` + this[kState] = [] + } - return webidl.errors.exception({ - header: context.prefix, - message - }) -} + append (name, value, filename = undefined) { + webidl.brandCheck(this, FormData) -webidl.errors.invalidArgument = function (context) { - return webidl.errors.exception({ - header: context.prefix, - message: `"${context.value}" is an invalid ${context.type}.` - }) -} + webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.append' }) -// https://webidl.spec.whatwg.org/#implements -webidl.brandCheck = function (V, I, opts = undefined) { - if (opts?.strict !== false && !(V instanceof I)) { - throw new TypeError('Illegal invocation') - } else { - return V?.[Symbol.toStringTag] === I.prototype[Symbol.toStringTag] - } -} + if (arguments.length === 3 && !isBlobLike(value)) { + throw new TypeError( + "Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'" + ) + } -webidl.argumentLengthCheck = function ({ length }, min, ctx) { - if (length < min) { - throw webidl.errors.exception({ - message: `${min} argument${min !== 1 ? 's' : ''} required, ` + - `but${length ? ' only' : ''} ${length} found.`, - ...ctx - }) - } -} + // 1. Let value be value if given; otherwise blobValue. -webidl.illegalConstructor = function () { - throw webidl.errors.exception({ - header: 'TypeError', - message: 'Illegal constructor' - }) -} + name = webidl.converters.USVString(name) + value = isBlobLike(value) + ? webidl.converters.Blob(value, { strict: false }) + : webidl.converters.USVString(value) + filename = arguments.length === 3 + ? webidl.converters.USVString(filename) + : undefined -// https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values -webidl.util.Type = function (V) { - switch (typeof V) { - case 'undefined': return 'Undefined' - case 'boolean': return 'Boolean' - case 'string': return 'String' - case 'symbol': return 'Symbol' - case 'number': return 'Number' - case 'bigint': return 'BigInt' - case 'function': - case 'object': { - if (V === null) { - return 'Null' - } + // 2. Let entry be the result of creating an entry with + // name, value, and filename if given. + const entry = makeEntry(name, value, filename) - return 'Object' - } + // 3. Append entry to this’s entry list. + this[kState].push(entry) } -} -// https://webidl.spec.whatwg.org/#abstract-opdef-converttoint -webidl.util.ConvertToInt = function (V, bitLength, signedness, opts = {}) { - let upperBound - let lowerBound - - // 1. If bitLength is 64, then: - if (bitLength === 64) { - // 1. Let upperBound be 2^53 − 1. - upperBound = Math.pow(2, 53) - 1 - - // 2. If signedness is "unsigned", then let lowerBound be 0. - if (signedness === 'unsigned') { - lowerBound = 0 - } else { - // 3. Otherwise let lowerBound be −2^53 + 1. - lowerBound = Math.pow(-2, 53) + 1 - } - } else if (signedness === 'unsigned') { - // 2. Otherwise, if signedness is "unsigned", then: - - // 1. Let lowerBound be 0. - lowerBound = 0 + delete (name) { + webidl.brandCheck(this, FormData) - // 2. Let upperBound be 2^bitLength − 1. - upperBound = Math.pow(2, bitLength) - 1 - } else { - // 3. Otherwise: + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.delete' }) - // 1. Let lowerBound be -2^bitLength − 1. - lowerBound = Math.pow(-2, bitLength) - 1 + name = webidl.converters.USVString(name) - // 2. Let upperBound be 2^bitLength − 1 − 1. - upperBound = Math.pow(2, bitLength - 1) - 1 + // The delete(name) method steps are to remove all entries whose name + // is name from this’s entry list. + this[kState] = this[kState].filter(entry => entry.name !== name) } - // 4. Let x be ? ToNumber(V). - let x = Number(V) - - // 5. If x is −0, then set x to +0. - if (x === 0) { - x = 0 - } + get (name) { + webidl.brandCheck(this, FormData) - // 6. If the conversion is to an IDL type associated - // with the [EnforceRange] extended attribute, then: - if (opts.enforceRange === true) { - // 1. If x is NaN, +∞, or −∞, then throw a TypeError. - if ( - Number.isNaN(x) || - x === Number.POSITIVE_INFINITY || - x === Number.NEGATIVE_INFINITY - ) { - throw webidl.errors.exception({ - header: 'Integer conversion', - message: `Could not convert ${V} to an integer.` - }) - } + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.get' }) - // 2. Set x to IntegerPart(x). - x = webidl.util.IntegerPart(x) + name = webidl.converters.USVString(name) - // 3. If x < lowerBound or x > upperBound, then - // throw a TypeError. - if (x < lowerBound || x > upperBound) { - throw webidl.errors.exception({ - header: 'Integer conversion', - message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.` - }) + // 1. If there is no entry whose name is name in this’s entry list, + // then return null. + const idx = this[kState].findIndex((entry) => entry.name === name) + if (idx === -1) { + return null } - // 4. Return x. - return x + // 2. Return the value of the first entry whose name is name from + // this’s entry list. + return this[kState][idx].value } - // 7. If x is not NaN and the conversion is to an IDL - // type associated with the [Clamp] extended - // attribute, then: - if (!Number.isNaN(x) && opts.clamp === true) { - // 1. Set x to min(max(x, lowerBound), upperBound). - x = Math.min(Math.max(x, lowerBound), upperBound) + getAll (name) { + webidl.brandCheck(this, FormData) - // 2. Round x to the nearest integer, choosing the - // even integer if it lies halfway between two, - // and choosing +0 rather than −0. - if (Math.floor(x) % 2 === 0) { - x = Math.floor(x) - } else { - x = Math.ceil(x) - } + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.getAll' }) - // 3. Return x. - return x - } + name = webidl.converters.USVString(name) - // 8. If x is NaN, +0, +∞, or −∞, then return +0. - if ( - Number.isNaN(x) || - (x === 0 && Object.is(0, x)) || - x === Number.POSITIVE_INFINITY || - x === Number.NEGATIVE_INFINITY - ) { - return 0 + // 1. If there is no entry whose name is name in this’s entry list, + // then return the empty list. + // 2. Return the values of all entries whose name is name, in order, + // from this’s entry list. + return this[kState] + .filter((entry) => entry.name === name) + .map((entry) => entry.value) } - // 9. Set x to IntegerPart(x). - x = webidl.util.IntegerPart(x) - - // 10. Set x to x modulo 2^bitLength. - x = x % Math.pow(2, bitLength) - - // 11. If signedness is "signed" and x ≥ 2^bitLength − 1, - // then return x − 2^bitLength. - if (signedness === 'signed' && x >= Math.pow(2, bitLength) - 1) { - return x - Math.pow(2, bitLength) - } + has (name) { + webidl.brandCheck(this, FormData) - // 12. Otherwise, return x. - return x -} + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.has' }) -// https://webidl.spec.whatwg.org/#abstract-opdef-integerpart -webidl.util.IntegerPart = function (n) { - // 1. Let r be floor(abs(n)). - const r = Math.floor(Math.abs(n)) + name = webidl.converters.USVString(name) - // 2. If n < 0, then return -1 × r. - if (n < 0) { - return -1 * r + // The has(name) method steps are to return true if there is an entry + // whose name is name in this’s entry list; otherwise false. + return this[kState].findIndex((entry) => entry.name === name) !== -1 } - // 3. Otherwise, return r. - return r -} + set (name, value, filename = undefined) { + webidl.brandCheck(this, FormData) -// https://webidl.spec.whatwg.org/#es-sequence -webidl.sequenceConverter = function (converter) { - return (V) => { - // 1. If Type(V) is not Object, throw a TypeError. - if (webidl.util.Type(V) !== 'Object') { - throw webidl.errors.exception({ - header: 'Sequence', - message: `Value of type ${webidl.util.Type(V)} is not an Object.` - }) + webidl.argumentLengthCheck(arguments, 2, { header: 'FormData.set' }) + + if (arguments.length === 3 && !isBlobLike(value)) { + throw new TypeError( + "Failed to execute 'set' on 'FormData': parameter 2 is not of type 'Blob'" + ) } - // 2. Let method be ? GetMethod(V, @@iterator). - /** @type {Generator} */ - const method = V?.[Symbol.iterator]?.() - const seq = [] + // The set(name, value) and set(name, blobValue, filename) method steps + // are: - // 3. If method is undefined, throw a TypeError. - if ( - method === undefined || - typeof method.next !== 'function' - ) { - throw webidl.errors.exception({ - header: 'Sequence', - message: 'Object is not an iterator.' - }) - } + // 1. Let value be value if given; otherwise blobValue. - // https://webidl.spec.whatwg.org/#create-sequence-from-iterable - while (true) { - const { done, value } = method.next() + name = webidl.converters.USVString(name) + value = isBlobLike(value) + ? webidl.converters.Blob(value, { strict: false }) + : webidl.converters.USVString(value) + filename = arguments.length === 3 + ? toUSVString(filename) + : undefined - if (done) { - break - } + // 2. Let entry be the result of creating an entry with name, value, and + // filename if given. + const entry = makeEntry(name, value, filename) - seq.push(converter(value)) + // 3. If there are entries in this’s entry list whose name is name, then + // replace the first such entry with entry and remove the others. + const idx = this[kState].findIndex((entry) => entry.name === name) + if (idx !== -1) { + this[kState] = [ + ...this[kState].slice(0, idx), + entry, + ...this[kState].slice(idx + 1).filter((entry) => entry.name !== name) + ] + } else { + // 4. Otherwise, append entry to this’s entry list. + this[kState].push(entry) } + } - return seq + entries () { + webidl.brandCheck(this, FormData) + + return makeIterator( + () => this[kState].map(pair => [pair.name, pair.value]), + 'FormData', + 'key+value' + ) } -} -// https://webidl.spec.whatwg.org/#es-to-record -webidl.recordConverter = function (keyConverter, valueConverter) { - return (O) => { - // 1. If Type(O) is not Object, throw a TypeError. - if (webidl.util.Type(O) !== 'Object') { - throw webidl.errors.exception({ - header: 'Record', - message: `Value of type ${webidl.util.Type(O)} is not an Object.` - }) - } + keys () { + webidl.brandCheck(this, FormData) - // 2. Let result be a new empty instance of record. - const result = {} + return makeIterator( + () => this[kState].map(pair => [pair.name, pair.value]), + 'FormData', + 'key' + ) + } - if (!types.isProxy(O)) { - // Object.keys only returns enumerable properties - const keys = Object.keys(O) + values () { + webidl.brandCheck(this, FormData) - for (const key of keys) { - // 1. Let typedKey be key converted to an IDL value of type K. - const typedKey = keyConverter(key) + return makeIterator( + () => this[kState].map(pair => [pair.name, pair.value]), + 'FormData', + 'value' + ) + } - // 2. Let value be ? Get(O, key). - // 3. Let typedValue be value converted to an IDL value of type V. - const typedValue = valueConverter(O[key]) + /** + * @param {(value: string, key: string, self: FormData) => void} callbackFn + * @param {unknown} thisArg + */ + forEach (callbackFn, thisArg = globalThis) { + webidl.brandCheck(this, FormData) - // 4. Set result[typedKey] to typedValue. - result[typedKey] = typedValue - } + webidl.argumentLengthCheck(arguments, 1, { header: 'FormData.forEach' }) - // 5. Return result. - return result + if (typeof callbackFn !== 'function') { + throw new TypeError( + "Failed to execute 'forEach' on 'FormData': parameter 1 is not of type 'Function'." + ) } - // 3. Let keys be ? O.[[OwnPropertyKeys]](). - const keys = Reflect.ownKeys(O) + for (const [key, value] of this) { + callbackFn.apply(thisArg, [value, key, this]) + } + } +} - // 4. For each key of keys. - for (const key of keys) { - // 1. Let desc be ? O.[[GetOwnProperty]](key). - const desc = Reflect.getOwnPropertyDescriptor(O, key) +FormData.prototype[Symbol.iterator] = FormData.prototype.entries - // 2. If desc is not undefined and desc.[[Enumerable]] is true: - if (desc?.enumerable) { - // 1. Let typedKey be key converted to an IDL value of type K. - const typedKey = keyConverter(key) +Object.defineProperties(FormData.prototype, { + [Symbol.toStringTag]: { + value: 'FormData', + configurable: true + } +}) - // 2. Let value be ? Get(O, key). - // 3. Let typedValue be value converted to an IDL value of type V. - const typedValue = valueConverter(O[key]) +/** + * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#create-an-entry + * @param {string} name + * @param {string|Blob} value + * @param {?string} filename + * @returns + */ +function makeEntry (name, value, filename) { + // 1. Set name to the result of converting name into a scalar value string. + // "To convert a string into a scalar value string, replace any surrogates + // with U+FFFD." + // see: https://nodejs.org/dist/latest-v18.x/docs/api/buffer.html#buftostringencoding-start-end + name = Buffer.from(name).toString('utf8') - // 4. Set result[typedKey] to typedValue. - result[typedKey] = typedValue - } + // 2. If value is a string, then set value to the result of converting + // value into a scalar value string. + if (typeof value === 'string') { + value = Buffer.from(value).toString('utf8') + } else { + // 3. Otherwise: + + // 1. If value is not a File object, then set value to a new File object, + // representing the same bytes, whose name attribute value is "blob" + if (!isFileLike(value)) { + value = value instanceof Blob + ? new File([value], 'blob', { type: value.type }) + : new FileLike(value, 'blob', { type: value.type }) } - // 5. Return result. - return result - } -} + // 2. If filename is given, then set value to a new File object, + // representing the same bytes, whose name attribute is filename. + if (filename !== undefined) { + /** @type {FilePropertyBag} */ + const options = { + type: value.type, + lastModified: value.lastModified + } -webidl.interfaceConverter = function (i) { - return (V, opts = {}) => { - if (opts.strict !== false && !(V instanceof i)) { - throw webidl.errors.exception({ - header: i.name, - message: `Expected ${V} to be an instance of ${i.name}.` - }) + value = (NativeFile && value instanceof NativeFile) || value instanceof UndiciFile + ? new File([value], filename, options) + : new FileLike(value, filename, options) } - - return V } -} - -webidl.dictionaryConverter = function (converters) { - return (dictionary) => { - const type = webidl.util.Type(dictionary) - const dict = {} - if (type === 'Null' || type === 'Undefined') { - return dict - } else if (type !== 'Object') { - throw webidl.errors.exception({ - header: 'Dictionary', - message: `Expected ${dictionary} to be one of: Null, Undefined, Object.` - }) - } + // 4. Return an entry whose name is name and whose value is value. + return { name, value } +} - for (const options of converters) { - const { key, defaultValue, required, converter } = options +module.exports = { FormData } - if (required === true) { - if (!hasOwn(dictionary, key)) { - throw webidl.errors.exception({ - header: 'Dictionary', - message: `Missing required key "${key}".` - }) - } - } - let value = dictionary[key] - const hasDefault = hasOwn(options, 'defaultValue') +/***/ }), - // Only use defaultValue if value is undefined and - // a defaultValue options was provided. - if (hasDefault && value !== null) { - value = value ?? defaultValue - } +/***/ 71246: +/***/ ((module) => { - // A key can be optional and have no default value. - // When this happens, do not perform a conversion, - // and do not assign the key a value. - if (required || hasDefault || value !== undefined) { - value = converter(value) +"use strict"; - if ( - options.allowedValues && - !options.allowedValues.includes(value) - ) { - throw webidl.errors.exception({ - header: 'Dictionary', - message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.` - }) - } - dict[key] = value - } - } +// In case of breaking changes, increase the version +// number to avoid conflicts. +const globalOrigin = Symbol.for('undici.globalOrigin.1') - return dict - } +function getGlobalOrigin () { + return globalThis[globalOrigin] } -webidl.nullableConverter = function (converter) { - return (V) => { - if (V === null) { - return V - } +function setGlobalOrigin (newOrigin) { + if (newOrigin === undefined) { + Object.defineProperty(globalThis, globalOrigin, { + value: undefined, + writable: true, + enumerable: false, + configurable: false + }) - return converter(V) + return } -} -// https://webidl.spec.whatwg.org/#es-DOMString -webidl.converters.DOMString = function (V, opts = {}) { - // 1. If V is null and the conversion is to an IDL type - // associated with the [LegacyNullToEmptyString] - // extended attribute, then return the DOMString value - // that represents the empty string. - if (V === null && opts.legacyNullToEmptyString) { - return '' - } + const parsedURL = new URL(newOrigin) - // 2. Let x be ? ToString(V). - if (typeof V === 'symbol') { - throw new TypeError('Could not convert argument of type symbol to string.') + if (parsedURL.protocol !== 'http:' && parsedURL.protocol !== 'https:') { + throw new TypeError(`Only http & https urls are allowed, received ${parsedURL.protocol}`) } - // 3. Return the IDL DOMString value that represents the - // same sequence of code units as the one the - // ECMAScript String value x represents. - return String(V) + Object.defineProperty(globalThis, globalOrigin, { + value: parsedURL, + writable: true, + enumerable: false, + configurable: false + }) } -// https://webidl.spec.whatwg.org/#es-ByteString -webidl.converters.ByteString = function (V) { - // 1. Let x be ? ToString(V). - // Note: DOMString converter perform ? ToString(V) - const x = webidl.converters.DOMString(V) +module.exports = { + getGlobalOrigin, + setGlobalOrigin +} - // 2. If the value of any element of x is greater than - // 255, then throw a TypeError. - for (let index = 0; index < x.length; index++) { - if (x.charCodeAt(index) > 255) { - throw new TypeError( - 'Cannot convert argument to a ByteString because the character at ' + - `index ${index} has a value of ${x.charCodeAt(index)} which is greater than 255.` - ) - } - } - // 3. Return an IDL ByteString value whose length is the - // length of x, and where the value of each element is - // the value of the corresponding element of x. - return x -} - -// https://webidl.spec.whatwg.org/#es-USVString -webidl.converters.USVString = toUSVString +/***/ }), -// https://webidl.spec.whatwg.org/#es-boolean -webidl.converters.boolean = function (V) { - // 1. Let x be the result of computing ToBoolean(V). - const x = Boolean(V) +/***/ 10554: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // 2. Return the IDL boolean value that is the one that represents - // the same truth value as the ECMAScript Boolean value x. - return x -} +"use strict"; +// https://github.com/Ethan-Arrowood/undici-fetch -// https://webidl.spec.whatwg.org/#es-any -webidl.converters.any = function (V) { - return V -} -// https://webidl.spec.whatwg.org/#es-long-long -webidl.converters['long long'] = function (V) { - // 1. Let x be ? ConvertToInt(V, 64, "signed"). - const x = webidl.util.ConvertToInt(V, 64, 'signed') - // 2. Return the IDL long long value that represents - // the same numeric value as x. - return x -} +const { kHeadersList, kConstruct } = __nccwpck_require__(72785) +const { kGuard } = __nccwpck_require__(15861) +const { kEnumerableProperty } = __nccwpck_require__(83983) +const { + makeIterator, + isValidHeaderName, + isValidHeaderValue +} = __nccwpck_require__(52538) +const util = __nccwpck_require__(73837) +const { webidl } = __nccwpck_require__(21744) +const assert = __nccwpck_require__(39491) -// https://webidl.spec.whatwg.org/#es-unsigned-long-long -webidl.converters['unsigned long long'] = function (V) { - // 1. Let x be ? ConvertToInt(V, 64, "unsigned"). - const x = webidl.util.ConvertToInt(V, 64, 'unsigned') +const kHeadersMap = Symbol('headers map') +const kHeadersSortedMap = Symbol('headers map sorted') - // 2. Return the IDL unsigned long long value that - // represents the same numeric value as x. - return x +/** + * @param {number} code + */ +function isHTTPWhiteSpaceCharCode (code) { + return code === 0x00a || code === 0x00d || code === 0x009 || code === 0x020 } -// https://webidl.spec.whatwg.org/#es-unsigned-long -webidl.converters['unsigned long'] = function (V) { - // 1. Let x be ? ConvertToInt(V, 32, "unsigned"). - const x = webidl.util.ConvertToInt(V, 32, 'unsigned') +/** + * @see https://fetch.spec.whatwg.org/#concept-header-value-normalize + * @param {string} potentialValue + */ +function headerValueNormalize (potentialValue) { + // To normalize a byte sequence potentialValue, remove + // any leading and trailing HTTP whitespace bytes from + // potentialValue. + let i = 0; let j = potentialValue.length - // 2. Return the IDL unsigned long value that - // represents the same numeric value as x. - return x + while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(j - 1))) --j + while (j > i && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i))) ++i + + return i === 0 && j === potentialValue.length ? potentialValue : potentialValue.substring(i, j) } -// https://webidl.spec.whatwg.org/#es-unsigned-short -webidl.converters['unsigned short'] = function (V, opts) { - // 1. Let x be ? ConvertToInt(V, 16, "unsigned"). - const x = webidl.util.ConvertToInt(V, 16, 'unsigned', opts) +function fill (headers, object) { + // To fill a Headers object headers with a given object object, run these steps: - // 2. Return the IDL unsigned short value that represents - // the same numeric value as x. - return x -} + // 1. If object is a sequence, then for each header in object: + // Note: webidl conversion to array has already been done. + if (Array.isArray(object)) { + for (let i = 0; i < object.length; ++i) { + const header = object[i] + // 1. If header does not contain exactly two items, then throw a TypeError. + if (header.length !== 2) { + throw webidl.errors.exception({ + header: 'Headers constructor', + message: `expected name/value pair to be length 2, found ${header.length}.` + }) + } -// https://webidl.spec.whatwg.org/#idl-ArrayBuffer -webidl.converters.ArrayBuffer = function (V, opts = {}) { - // 1. If Type(V) is not Object, or V does not have an - // [[ArrayBufferData]] internal slot, then throw a - // TypeError. - // see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances - // see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances - if ( - webidl.util.Type(V) !== 'Object' || - !types.isAnyArrayBuffer(V) - ) { + // 2. Append (header’s first item, header’s second item) to headers. + appendHeader(headers, header[0], header[1]) + } + } else if (typeof object === 'object' && object !== null) { + // Note: null should throw + + // 2. Otherwise, object is a record, then for each key → value in object, + // append (key, value) to headers + const keys = Object.keys(object) + for (let i = 0; i < keys.length; ++i) { + appendHeader(headers, keys[i], object[keys[i]]) + } + } else { throw webidl.errors.conversionFailed({ - prefix: `${V}`, - argument: `${V}`, - types: ['ArrayBuffer'] + prefix: 'Headers constructor', + argument: 'Argument 1', + types: ['sequence>', 'record'] }) } +} - // 2. If the conversion is not to an IDL type associated - // with the [AllowShared] extended attribute, and - // IsSharedArrayBuffer(V) is true, then throw a - // TypeError. - if (opts.allowShared === false && types.isSharedArrayBuffer(V)) { - throw webidl.errors.exception({ - header: 'ArrayBuffer', - message: 'SharedArrayBuffer is not allowed.' +/** + * @see https://fetch.spec.whatwg.org/#concept-headers-append + */ +function appendHeader (headers, name, value) { + // 1. Normalize value. + value = headerValueNormalize(value) + + // 2. If name is not a header name or value is not a + // header value, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.append', + value: name, + type: 'header name' + }) + } else if (!isValidHeaderValue(value)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.append', + value, + type: 'header value' }) } - // 3. If the conversion is not to an IDL type associated - // with the [AllowResizable] extended attribute, and - // IsResizableArrayBuffer(V) is true, then throw a - // TypeError. - // Note: resizable ArrayBuffers are currently a proposal. + // 3. If headers’s guard is "immutable", then throw a TypeError. + // 4. Otherwise, if headers’s guard is "request" and name is a + // forbidden header name, return. + // Note: undici does not implement forbidden header names + if (headers[kGuard] === 'immutable') { + throw new TypeError('immutable') + } else if (headers[kGuard] === 'request-no-cors') { + // 5. Otherwise, if headers’s guard is "request-no-cors": + // TODO + } - // 4. Return the IDL ArrayBuffer value that is a - // reference to the same object as V. - return V + // 6. Otherwise, if headers’s guard is "response" and name is a + // forbidden response-header name, return. + + // 7. Append (name, value) to headers’s header list. + return headers[kHeadersList].append(name, value) + + // 8. If headers’s guard is "request-no-cors", then remove + // privileged no-CORS request headers from headers } -webidl.converters.TypedArray = function (V, T, opts = {}) { - // 1. Let T be the IDL type V is being converted to. +class HeadersList { + /** @type {[string, string][]|null} */ + cookies = null - // 2. If Type(V) is not Object, or V does not have a - // [[TypedArrayName]] internal slot with a value - // equal to T’s name, then throw a TypeError. - if ( - webidl.util.Type(V) !== 'Object' || - !types.isTypedArray(V) || - V.constructor.name !== T.name - ) { - throw webidl.errors.conversionFailed({ - prefix: `${T.name}`, - argument: `${V}`, - types: [T.name] - }) + constructor (init) { + if (init instanceof HeadersList) { + this[kHeadersMap] = new Map(init[kHeadersMap]) + this[kHeadersSortedMap] = init[kHeadersSortedMap] + this.cookies = init.cookies === null ? null : [...init.cookies] + } else { + this[kHeadersMap] = new Map(init) + this[kHeadersSortedMap] = null + } } - // 3. If the conversion is not to an IDL type associated - // with the [AllowShared] extended attribute, and - // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is - // true, then throw a TypeError. - if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) { - throw webidl.errors.exception({ - header: 'ArrayBuffer', - message: 'SharedArrayBuffer is not allowed.' - }) + // https://fetch.spec.whatwg.org/#header-list-contains + contains (name) { + // A header list list contains a header name name if list + // contains a header whose name is a byte-case-insensitive + // match for name. + name = name.toLowerCase() + + return this[kHeadersMap].has(name) } - // 4. If the conversion is not to an IDL type associated - // with the [AllowResizable] extended attribute, and - // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is - // true, then throw a TypeError. - // Note: resizable array buffers are currently a proposal + clear () { + this[kHeadersMap].clear() + this[kHeadersSortedMap] = null + this.cookies = null + } - // 5. Return the IDL value of type T that is a reference - // to the same object as V. - return V -} + // https://fetch.spec.whatwg.org/#concept-header-list-append + append (name, value) { + this[kHeadersSortedMap] = null -webidl.converters.DataView = function (V, opts = {}) { - // 1. If Type(V) is not Object, or V does not have a - // [[DataView]] internal slot, then throw a TypeError. - if (webidl.util.Type(V) !== 'Object' || !types.isDataView(V)) { - throw webidl.errors.exception({ - header: 'DataView', - message: 'Object is not a DataView.' - }) + // 1. If list contains name, then set name to the first such + // header’s name. + const lowercaseName = name.toLowerCase() + const exists = this[kHeadersMap].get(lowercaseName) + + // 2. Append (name, value) to list. + if (exists) { + const delimiter = lowercaseName === 'cookie' ? '; ' : ', ' + this[kHeadersMap].set(lowercaseName, { + name: exists.name, + value: `${exists.value}${delimiter}${value}` + }) + } else { + this[kHeadersMap].set(lowercaseName, { name, value }) + } + + if (lowercaseName === 'set-cookie') { + this.cookies ??= [] + this.cookies.push(value) + } } - // 2. If the conversion is not to an IDL type associated - // with the [AllowShared] extended attribute, and - // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true, - // then throw a TypeError. - if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) { - throw webidl.errors.exception({ - header: 'ArrayBuffer', - message: 'SharedArrayBuffer is not allowed.' - }) + // https://fetch.spec.whatwg.org/#concept-header-list-set + set (name, value) { + this[kHeadersSortedMap] = null + const lowercaseName = name.toLowerCase() + + if (lowercaseName === 'set-cookie') { + this.cookies = [value] + } + + // 1. If list contains name, then set the value of + // the first such header to value and remove the + // others. + // 2. Otherwise, append header (name, value) to list. + this[kHeadersMap].set(lowercaseName, { name, value }) } - // 3. If the conversion is not to an IDL type associated - // with the [AllowResizable] extended attribute, and - // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is - // true, then throw a TypeError. - // Note: resizable ArrayBuffers are currently a proposal + // https://fetch.spec.whatwg.org/#concept-header-list-delete + delete (name) { + this[kHeadersSortedMap] = null - // 4. Return the IDL DataView value that is a reference - // to the same object as V. - return V -} + name = name.toLowerCase() -// https://webidl.spec.whatwg.org/#BufferSource -webidl.converters.BufferSource = function (V, opts = {}) { - if (types.isAnyArrayBuffer(V)) { - return webidl.converters.ArrayBuffer(V, opts) + if (name === 'set-cookie') { + this.cookies = null + } + + this[kHeadersMap].delete(name) } - if (types.isTypedArray(V)) { - return webidl.converters.TypedArray(V, V.constructor) + // https://fetch.spec.whatwg.org/#concept-header-list-get + get (name) { + const value = this[kHeadersMap].get(name.toLowerCase()) + + // 1. If list does not contain name, then return null. + // 2. Return the values of all headers in list whose name + // is a byte-case-insensitive match for name, + // separated from each other by 0x2C 0x20, in order. + return value === undefined ? null : value.value } - if (types.isDataView(V)) { - return webidl.converters.DataView(V, opts) + * [Symbol.iterator] () { + // use the lowercased name + for (const [name, { value }] of this[kHeadersMap]) { + yield [name, value] + } } - throw new TypeError(`Could not convert ${V} to a BufferSource.`) + get entries () { + const headers = {} + + if (this[kHeadersMap].size) { + for (const { name, value } of this[kHeadersMap].values()) { + headers[name] = value + } + } + + return headers + } } -webidl.converters['sequence'] = webidl.sequenceConverter( - webidl.converters.ByteString -) +// https://fetch.spec.whatwg.org/#headers-class +class Headers { + constructor (init = undefined) { + if (init === kConstruct) { + return + } + this[kHeadersList] = new HeadersList() -webidl.converters['sequence>'] = webidl.sequenceConverter( - webidl.converters['sequence'] -) + // The new Headers(init) constructor steps are: -webidl.converters['record'] = webidl.recordConverter( - webidl.converters.ByteString, - webidl.converters.ByteString -) + // 1. Set this’s guard to "none". + this[kGuard] = 'none' -module.exports = { - webidl -} + // 2. If init is given, then fill this with init. + if (init !== undefined) { + init = webidl.converters.HeadersInit(init) + fill(this, init) + } + } + // https://fetch.spec.whatwg.org/#dom-headers-append + append (name, value) { + webidl.brandCheck(this, Headers) -/***/ }), + webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.append' }) -/***/ 84854: -/***/ ((module) => { + name = webidl.converters.ByteString(name) + value = webidl.converters.ByteString(value) -"use strict"; + return appendHeader(this, name, value) + } + // https://fetch.spec.whatwg.org/#dom-headers-delete + delete (name) { + webidl.brandCheck(this, Headers) -/** - * @see https://encoding.spec.whatwg.org/#concept-encoding-get - * @param {string|undefined} label - */ -function getEncoding (label) { - if (!label) { - return 'failure' + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.delete' }) + + name = webidl.converters.ByteString(name) + + // 1. If name is not a header name, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.delete', + value: name, + type: 'header name' + }) + } + + // 2. If this’s guard is "immutable", then throw a TypeError. + // 3. Otherwise, if this’s guard is "request" and name is a + // forbidden header name, return. + // 4. Otherwise, if this’s guard is "request-no-cors", name + // is not a no-CORS-safelisted request-header name, and + // name is not a privileged no-CORS request-header name, + // return. + // 5. Otherwise, if this’s guard is "response" and name is + // a forbidden response-header name, return. + // Note: undici does not implement forbidden header names + if (this[kGuard] === 'immutable') { + throw new TypeError('immutable') + } else if (this[kGuard] === 'request-no-cors') { + // TODO + } + + // 6. If this’s header list does not contain name, then + // return. + if (!this[kHeadersList].contains(name)) { + return + } + + // 7. Delete name from this’s header list. + // 8. If this’s guard is "request-no-cors", then remove + // privileged no-CORS request headers from this. + this[kHeadersList].delete(name) } - // 1. Remove any leading and trailing ASCII whitespace from label. - // 2. If label is an ASCII case-insensitive match for any of the - // labels listed in the table below, then return the - // corresponding encoding; otherwise return failure. - switch (label.trim().toLowerCase()) { - case 'unicode-1-1-utf-8': - case 'unicode11utf8': - case 'unicode20utf8': - case 'utf-8': - case 'utf8': - case 'x-unicode20utf8': - return 'UTF-8' - case '866': - case 'cp866': - case 'csibm866': - case 'ibm866': - return 'IBM866' - case 'csisolatin2': - case 'iso-8859-2': - case 'iso-ir-101': - case 'iso8859-2': - case 'iso88592': - case 'iso_8859-2': - case 'iso_8859-2:1987': - case 'l2': - case 'latin2': - return 'ISO-8859-2' - case 'csisolatin3': - case 'iso-8859-3': - case 'iso-ir-109': - case 'iso8859-3': - case 'iso88593': - case 'iso_8859-3': - case 'iso_8859-3:1988': - case 'l3': - case 'latin3': - return 'ISO-8859-3' - case 'csisolatin4': - case 'iso-8859-4': - case 'iso-ir-110': - case 'iso8859-4': - case 'iso88594': - case 'iso_8859-4': - case 'iso_8859-4:1988': - case 'l4': - case 'latin4': - return 'ISO-8859-4' - case 'csisolatincyrillic': - case 'cyrillic': - case 'iso-8859-5': - case 'iso-ir-144': - case 'iso8859-5': - case 'iso88595': - case 'iso_8859-5': - case 'iso_8859-5:1988': - return 'ISO-8859-5' - case 'arabic': - case 'asmo-708': - case 'csiso88596e': - case 'csiso88596i': - case 'csisolatinarabic': - case 'ecma-114': - case 'iso-8859-6': - case 'iso-8859-6-e': - case 'iso-8859-6-i': - case 'iso-ir-127': - case 'iso8859-6': - case 'iso88596': - case 'iso_8859-6': - case 'iso_8859-6:1987': - return 'ISO-8859-6' - case 'csisolatingreek': - case 'ecma-118': - case 'elot_928': - case 'greek': - case 'greek8': - case 'iso-8859-7': - case 'iso-ir-126': - case 'iso8859-7': - case 'iso88597': - case 'iso_8859-7': - case 'iso_8859-7:1987': - case 'sun_eu_greek': - return 'ISO-8859-7' - case 'csiso88598e': - case 'csisolatinhebrew': - case 'hebrew': - case 'iso-8859-8': - case 'iso-8859-8-e': - case 'iso-ir-138': - case 'iso8859-8': - case 'iso88598': - case 'iso_8859-8': - case 'iso_8859-8:1988': - case 'visual': - return 'ISO-8859-8' - case 'csiso88598i': - case 'iso-8859-8-i': - case 'logical': - return 'ISO-8859-8-I' - case 'csisolatin6': - case 'iso-8859-10': - case 'iso-ir-157': - case 'iso8859-10': - case 'iso885910': - case 'l6': - case 'latin6': - return 'ISO-8859-10' - case 'iso-8859-13': - case 'iso8859-13': - case 'iso885913': - return 'ISO-8859-13' - case 'iso-8859-14': - case 'iso8859-14': - case 'iso885914': - return 'ISO-8859-14' - case 'csisolatin9': - case 'iso-8859-15': - case 'iso8859-15': - case 'iso885915': - case 'iso_8859-15': - case 'l9': - return 'ISO-8859-15' - case 'iso-8859-16': - return 'ISO-8859-16' - case 'cskoi8r': - case 'koi': - case 'koi8': - case 'koi8-r': - case 'koi8_r': - return 'KOI8-R' - case 'koi8-ru': - case 'koi8-u': - return 'KOI8-U' - case 'csmacintosh': - case 'mac': - case 'macintosh': - case 'x-mac-roman': - return 'macintosh' - case 'iso-8859-11': - case 'iso8859-11': - case 'iso885911': - case 'tis-620': - case 'windows-874': - return 'windows-874' - case 'cp1250': - case 'windows-1250': - case 'x-cp1250': - return 'windows-1250' - case 'cp1251': - case 'windows-1251': - case 'x-cp1251': - return 'windows-1251' - case 'ansi_x3.4-1968': - case 'ascii': - case 'cp1252': - case 'cp819': - case 'csisolatin1': - case 'ibm819': - case 'iso-8859-1': - case 'iso-ir-100': - case 'iso8859-1': - case 'iso88591': - case 'iso_8859-1': - case 'iso_8859-1:1987': - case 'l1': - case 'latin1': - case 'us-ascii': - case 'windows-1252': - case 'x-cp1252': - return 'windows-1252' - case 'cp1253': - case 'windows-1253': - case 'x-cp1253': - return 'windows-1253' - case 'cp1254': - case 'csisolatin5': - case 'iso-8859-9': - case 'iso-ir-148': - case 'iso8859-9': - case 'iso88599': - case 'iso_8859-9': - case 'iso_8859-9:1989': - case 'l5': - case 'latin5': - case 'windows-1254': - case 'x-cp1254': - return 'windows-1254' - case 'cp1255': - case 'windows-1255': - case 'x-cp1255': - return 'windows-1255' - case 'cp1256': - case 'windows-1256': - case 'x-cp1256': - return 'windows-1256' - case 'cp1257': - case 'windows-1257': - case 'x-cp1257': - return 'windows-1257' - case 'cp1258': - case 'windows-1258': - case 'x-cp1258': - return 'windows-1258' - case 'x-mac-cyrillic': - case 'x-mac-ukrainian': - return 'x-mac-cyrillic' - case 'chinese': - case 'csgb2312': - case 'csiso58gb231280': - case 'gb2312': - case 'gb_2312': - case 'gb_2312-80': - case 'gbk': - case 'iso-ir-58': - case 'x-gbk': - return 'GBK' - case 'gb18030': - return 'gb18030' - case 'big5': - case 'big5-hkscs': - case 'cn-big5': - case 'csbig5': - case 'x-x-big5': - return 'Big5' - case 'cseucpkdfmtjapanese': - case 'euc-jp': - case 'x-euc-jp': - return 'EUC-JP' - case 'csiso2022jp': - case 'iso-2022-jp': - return 'ISO-2022-JP' - case 'csshiftjis': - case 'ms932': - case 'ms_kanji': - case 'shift-jis': - case 'shift_jis': - case 'sjis': - case 'windows-31j': - case 'x-sjis': - return 'Shift_JIS' - case 'cseuckr': - case 'csksc56011987': - case 'euc-kr': - case 'iso-ir-149': - case 'korean': - case 'ks_c_5601-1987': - case 'ks_c_5601-1989': - case 'ksc5601': - case 'ksc_5601': - case 'windows-949': - return 'EUC-KR' - case 'csiso2022kr': - case 'hz-gb-2312': - case 'iso-2022-cn': - case 'iso-2022-cn-ext': - case 'iso-2022-kr': - case 'replacement': - return 'replacement' - case 'unicodefffe': - case 'utf-16be': - return 'UTF-16BE' - case 'csunicode': - case 'iso-10646-ucs-2': - case 'ucs-2': - case 'unicode': - case 'unicodefeff': - case 'utf-16': - case 'utf-16le': - return 'UTF-16LE' - case 'x-user-defined': - return 'x-user-defined' - default: return 'failure' - } -} - -module.exports = { - getEncoding -} + // https://fetch.spec.whatwg.org/#dom-headers-get + get (name) { + webidl.brandCheck(this, Headers) + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.get' }) -/***/ }), + name = webidl.converters.ByteString(name) -/***/ 1446: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 1. If name is not a header name, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.get', + value: name, + type: 'header name' + }) + } -"use strict"; + // 2. Return the result of getting name from this’s header + // list. + return this[kHeadersList].get(name) + } + // https://fetch.spec.whatwg.org/#dom-headers-has + has (name) { + webidl.brandCheck(this, Headers) -const { - staticPropertyDescriptors, - readOperation, - fireAProgressEvent -} = __nccwpck_require__(87530) -const { - kState, - kError, - kResult, - kEvents, - kAborted -} = __nccwpck_require__(29054) -const { webidl } = __nccwpck_require__(21744) -const { kEnumerableProperty } = __nccwpck_require__(83983) + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.has' }) -class FileReader extends EventTarget { - constructor () { - super() + name = webidl.converters.ByteString(name) - this[kState] = 'empty' - this[kResult] = null - this[kError] = null - this[kEvents] = { - loadend: null, - error: null, - abort: null, - load: null, - progress: null, - loadstart: null + // 1. If name is not a header name, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.has', + value: name, + type: 'header name' + }) } - } - /** - * @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer - * @param {import('buffer').Blob} blob - */ - readAsArrayBuffer (blob) { - webidl.brandCheck(this, FileReader) + // 2. Return true if this’s header list contains name; + // otherwise false. + return this[kHeadersList].contains(name) + } - webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsArrayBuffer' }) + // https://fetch.spec.whatwg.org/#dom-headers-set + set (name, value) { + webidl.brandCheck(this, Headers) - blob = webidl.converters.Blob(blob, { strict: false }) + webidl.argumentLengthCheck(arguments, 2, { header: 'Headers.set' }) - // The readAsArrayBuffer(blob) method, when invoked, - // must initiate a read operation for blob with ArrayBuffer. - readOperation(this, blob, 'ArrayBuffer') - } + name = webidl.converters.ByteString(name) + value = webidl.converters.ByteString(value) - /** - * @see https://w3c.github.io/FileAPI/#readAsBinaryString - * @param {import('buffer').Blob} blob - */ - readAsBinaryString (blob) { - webidl.brandCheck(this, FileReader) + // 1. Normalize value. + value = headerValueNormalize(value) - webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsBinaryString' }) + // 2. If name is not a header name or value is not a + // header value, then throw a TypeError. + if (!isValidHeaderName(name)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.set', + value: name, + type: 'header name' + }) + } else if (!isValidHeaderValue(value)) { + throw webidl.errors.invalidArgument({ + prefix: 'Headers.set', + value, + type: 'header value' + }) + } - blob = webidl.converters.Blob(blob, { strict: false }) + // 3. If this’s guard is "immutable", then throw a TypeError. + // 4. Otherwise, if this’s guard is "request" and name is a + // forbidden header name, return. + // 5. Otherwise, if this’s guard is "request-no-cors" and + // name/value is not a no-CORS-safelisted request-header, + // return. + // 6. Otherwise, if this’s guard is "response" and name is a + // forbidden response-header name, return. + // Note: undici does not implement forbidden header names + if (this[kGuard] === 'immutable') { + throw new TypeError('immutable') + } else if (this[kGuard] === 'request-no-cors') { + // TODO + } - // The readAsBinaryString(blob) method, when invoked, - // must initiate a read operation for blob with BinaryString. - readOperation(this, blob, 'BinaryString') + // 7. Set (name, value) in this’s header list. + // 8. If this’s guard is "request-no-cors", then remove + // privileged no-CORS request headers from this + this[kHeadersList].set(name, value) } - /** - * @see https://w3c.github.io/FileAPI/#readAsDataText - * @param {import('buffer').Blob} blob - * @param {string?} encoding - */ - readAsText (blob, encoding = undefined) { - webidl.brandCheck(this, FileReader) + // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie + getSetCookie () { + webidl.brandCheck(this, Headers) - webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsText' }) + // 1. If this’s header list does not contain `Set-Cookie`, then return « ». + // 2. Return the values of all headers in this’s header list whose name is + // a byte-case-insensitive match for `Set-Cookie`, in order. - blob = webidl.converters.Blob(blob, { strict: false }) + const list = this[kHeadersList].cookies - if (encoding !== undefined) { - encoding = webidl.converters.DOMString(encoding) + if (list) { + return [...list] } - // The readAsText(blob, encoding) method, when invoked, - // must initiate a read operation for blob with Text and encoding. - readOperation(this, blob, 'Text', encoding) + return [] } - /** - * @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL - * @param {import('buffer').Blob} blob - */ - readAsDataURL (blob) { - webidl.brandCheck(this, FileReader) + // https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine + get [kHeadersSortedMap] () { + if (this[kHeadersList][kHeadersSortedMap]) { + return this[kHeadersList][kHeadersSortedMap] + } - webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsDataURL' }) + // 1. Let headers be an empty list of headers with the key being the name + // and value the value. + const headers = [] - blob = webidl.converters.Blob(blob, { strict: false }) + // 2. Let names be the result of convert header names to a sorted-lowercase + // set with all the names of the headers in list. + const names = [...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1) + const cookies = this[kHeadersList].cookies - // The readAsDataURL(blob) method, when invoked, must - // initiate a read operation for blob with DataURL. - readOperation(this, blob, 'DataURL') - } + // 3. For each name of names: + for (let i = 0; i < names.length; ++i) { + const [name, value] = names[i] + // 1. If name is `set-cookie`, then: + if (name === 'set-cookie') { + // 1. Let values be a list of all values of headers in list whose name + // is a byte-case-insensitive match for name, in order. - /** - * @see https://w3c.github.io/FileAPI/#dfn-abort - */ - abort () { - // 1. If this's state is "empty" or if this's state is - // "done" set this's result to null and terminate - // this algorithm. - if (this[kState] === 'empty' || this[kState] === 'done') { - this[kResult] = null - return - } + // 2. For each value of values: + // 1. Append (name, value) to headers. + for (let j = 0; j < cookies.length; ++j) { + headers.push([name, cookies[j]]) + } + } else { + // 2. Otherwise: - // 2. If this's state is "loading" set this's state to - // "done" and set this's result to null. - if (this[kState] === 'loading') { - this[kState] = 'done' - this[kResult] = null + // 1. Let value be the result of getting name from list. + + // 2. Assert: value is non-null. + assert(value !== null) + + // 3. Append (name, value) to headers. + headers.push([name, value]) + } } - // 3. If there are any tasks from this on the file reading - // task source in an affiliated task queue, then remove - // those tasks from that task queue. - this[kAborted] = true + this[kHeadersList][kHeadersSortedMap] = headers - // 4. Terminate the algorithm for the read method being processed. - // TODO + // 4. Return headers. + return headers + } - // 5. Fire a progress event called abort at this. - fireAProgressEvent('abort', this) + keys () { + webidl.brandCheck(this, Headers) - // 6. If this's state is not "loading", fire a progress - // event called loadend at this. - if (this[kState] !== 'loading') { - fireAProgressEvent('loadend', this) + if (this[kGuard] === 'immutable') { + const value = this[kHeadersSortedMap] + return makeIterator(() => value, 'Headers', + 'key') } + + return makeIterator( + () => [...this[kHeadersSortedMap].values()], + 'Headers', + 'key' + ) } - /** - * @see https://w3c.github.io/FileAPI/#dom-filereader-readystate - */ - get readyState () { - webidl.brandCheck(this, FileReader) + values () { + webidl.brandCheck(this, Headers) - switch (this[kState]) { - case 'empty': return this.EMPTY - case 'loading': return this.LOADING - case 'done': return this.DONE + if (this[kGuard] === 'immutable') { + const value = this[kHeadersSortedMap] + return makeIterator(() => value, 'Headers', + 'value') } + + return makeIterator( + () => [...this[kHeadersSortedMap].values()], + 'Headers', + 'value' + ) } - /** - * @see https://w3c.github.io/FileAPI/#dom-filereader-result - */ - get result () { - webidl.brandCheck(this, FileReader) + entries () { + webidl.brandCheck(this, Headers) - // The result attribute’s getter, when invoked, must return - // this's result. - return this[kResult] + if (this[kGuard] === 'immutable') { + const value = this[kHeadersSortedMap] + return makeIterator(() => value, 'Headers', + 'key+value') + } + + return makeIterator( + () => [...this[kHeadersSortedMap].values()], + 'Headers', + 'key+value' + ) } /** - * @see https://w3c.github.io/FileAPI/#dom-filereader-error + * @param {(value: string, key: string, self: Headers) => void} callbackFn + * @param {unknown} thisArg */ - get error () { - webidl.brandCheck(this, FileReader) + forEach (callbackFn, thisArg = globalThis) { + webidl.brandCheck(this, Headers) - // The error attribute’s getter, when invoked, must return - // this's error. - return this[kError] - } + webidl.argumentLengthCheck(arguments, 1, { header: 'Headers.forEach' }) - get onloadend () { - webidl.brandCheck(this, FileReader) + if (typeof callbackFn !== 'function') { + throw new TypeError( + "Failed to execute 'forEach' on 'Headers': parameter 1 is not of type 'Function'." + ) + } - return this[kEvents].loadend + for (const [key, value] of this) { + callbackFn.apply(thisArg, [value, key, this]) + } } - set onloadend (fn) { - webidl.brandCheck(this, FileReader) - - if (this[kEvents].loadend) { - this.removeEventListener('loadend', this[kEvents].loadend) - } + [Symbol.for('nodejs.util.inspect.custom')] () { + webidl.brandCheck(this, Headers) - if (typeof fn === 'function') { - this[kEvents].loadend = fn - this.addEventListener('loadend', fn) - } else { - this[kEvents].loadend = null - } + return this[kHeadersList] } +} - get onerror () { - webidl.brandCheck(this, FileReader) +Headers.prototype[Symbol.iterator] = Headers.prototype.entries - return this[kEvents].error +Object.defineProperties(Headers.prototype, { + append: kEnumerableProperty, + delete: kEnumerableProperty, + get: kEnumerableProperty, + has: kEnumerableProperty, + set: kEnumerableProperty, + getSetCookie: kEnumerableProperty, + keys: kEnumerableProperty, + values: kEnumerableProperty, + entries: kEnumerableProperty, + forEach: kEnumerableProperty, + [Symbol.iterator]: { enumerable: false }, + [Symbol.toStringTag]: { + value: 'Headers', + configurable: true + }, + [util.inspect.custom]: { + enumerable: false } +}) - set onerror (fn) { - webidl.brandCheck(this, FileReader) - - if (this[kEvents].error) { - this.removeEventListener('error', this[kEvents].error) +webidl.converters.HeadersInit = function (V) { + if (webidl.util.Type(V) === 'Object') { + if (V[Symbol.iterator]) { + return webidl.converters['sequence>'](V) } - if (typeof fn === 'function') { - this[kEvents].error = fn - this.addEventListener('error', fn) - } else { - this[kEvents].error = null - } + return webidl.converters['record'](V) } - get onloadstart () { - webidl.brandCheck(this, FileReader) + throw webidl.errors.conversionFailed({ + prefix: 'Headers constructor', + argument: 'Argument 1', + types: ['sequence>', 'record'] + }) +} - return this[kEvents].loadstart - } +module.exports = { + fill, + Headers, + HeadersList +} - set onloadstart (fn) { - webidl.brandCheck(this, FileReader) - if (this[kEvents].loadstart) { - this.removeEventListener('loadstart', this[kEvents].loadstart) - } +/***/ }), - if (typeof fn === 'function') { - this[kEvents].loadstart = fn - this.addEventListener('loadstart', fn) - } else { - this[kEvents].loadstart = null - } - } +/***/ 74881: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - get onprogress () { - webidl.brandCheck(this, FileReader) +"use strict"; +// https://github.com/Ethan-Arrowood/undici-fetch - return this[kEvents].progress - } - set onprogress (fn) { - webidl.brandCheck(this, FileReader) - if (this[kEvents].progress) { - this.removeEventListener('progress', this[kEvents].progress) - } +const { + Response, + makeNetworkError, + makeAppropriateNetworkError, + filterResponse, + makeResponse +} = __nccwpck_require__(27823) +const { Headers } = __nccwpck_require__(10554) +const { Request, makeRequest } = __nccwpck_require__(48359) +const zlib = __nccwpck_require__(59796) +const { + bytesMatch, + makePolicyContainer, + clonePolicyContainer, + requestBadPort, + TAOCheck, + appendRequestOriginHeader, + responseLocationURL, + requestCurrentURL, + setRequestReferrerPolicyOnRedirect, + tryUpgradeRequestToAPotentiallyTrustworthyURL, + createOpaqueTimingInfo, + appendFetchMetadata, + corsCheck, + crossOriginResourcePolicyCheck, + determineRequestsReferrer, + coarsenedSharedCurrentTime, + createDeferredPromise, + isBlobLike, + sameOrigin, + isCancelled, + isAborted, + isErrorLike, + fullyReadBody, + readableStreamClose, + isomorphicEncode, + urlIsLocal, + urlIsHttpHttpsScheme, + urlHasHttpsScheme +} = __nccwpck_require__(52538) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(15861) +const assert = __nccwpck_require__(39491) +const { safelyExtractBody } = __nccwpck_require__(41472) +const { + redirectStatusSet, + nullBodyStatus, + safeMethodsSet, + requestBodyHeader, + subresourceSet, + DOMException +} = __nccwpck_require__(41037) +const { kHeadersList } = __nccwpck_require__(72785) +const EE = __nccwpck_require__(82361) +const { Readable, pipeline } = __nccwpck_require__(12781) +const { addAbortListener, isErrored, isReadable, nodeMajor, nodeMinor } = __nccwpck_require__(83983) +const { dataURLProcessor, serializeAMimeType } = __nccwpck_require__(685) +const { TransformStream } = __nccwpck_require__(35356) +const { getGlobalDispatcher } = __nccwpck_require__(21892) +const { webidl } = __nccwpck_require__(21744) +const { STATUS_CODES } = __nccwpck_require__(13685) +const GET_OR_HEAD = ['GET', 'HEAD'] - if (typeof fn === 'function') { - this[kEvents].progress = fn - this.addEventListener('progress', fn) - } else { - this[kEvents].progress = null - } - } +/** @type {import('buffer').resolveObjectURL} */ +let resolveObjectURL +let ReadableStream = globalThis.ReadableStream - get onload () { - webidl.brandCheck(this, FileReader) +class Fetch extends EE { + constructor (dispatcher) { + super() - return this[kEvents].load + this.dispatcher = dispatcher + this.connection = null + this.dump = false + this.state = 'ongoing' + // 2 terminated listeners get added per request, + // but only 1 gets removed. If there are 20 redirects, + // 21 listeners will be added. + // See https://github.com/nodejs/undici/issues/1711 + // TODO (fix): Find and fix root cause for leaked listener. + this.setMaxListeners(21) } - set onload (fn) { - webidl.brandCheck(this, FileReader) - - if (this[kEvents].load) { - this.removeEventListener('load', this[kEvents].load) + terminate (reason) { + if (this.state !== 'ongoing') { + return } - if (typeof fn === 'function') { - this[kEvents].load = fn - this.addEventListener('load', fn) - } else { - this[kEvents].load = null - } + this.state = 'terminated' + this.connection?.destroy(reason) + this.emit('terminated', reason) } - get onabort () { - webidl.brandCheck(this, FileReader) - - return this[kEvents].abort - } + // https://fetch.spec.whatwg.org/#fetch-controller-abort + abort (error) { + if (this.state !== 'ongoing') { + return + } - set onabort (fn) { - webidl.brandCheck(this, FileReader) + // 1. Set controller’s state to "aborted". + this.state = 'aborted' - if (this[kEvents].abort) { - this.removeEventListener('abort', this[kEvents].abort) + // 2. Let fallbackError be an "AbortError" DOMException. + // 3. Set error to fallbackError if it is not given. + if (!error) { + error = new DOMException('The operation was aborted.', 'AbortError') } - if (typeof fn === 'function') { - this[kEvents].abort = fn - this.addEventListener('abort', fn) - } else { - this[kEvents].abort = null - } - } -} + // 4. Let serializedError be StructuredSerialize(error). + // If that threw an exception, catch it, and let + // serializedError be StructuredSerialize(fallbackError). -// https://w3c.github.io/FileAPI/#dom-filereader-empty -FileReader.EMPTY = FileReader.prototype.EMPTY = 0 -// https://w3c.github.io/FileAPI/#dom-filereader-loading -FileReader.LOADING = FileReader.prototype.LOADING = 1 -// https://w3c.github.io/FileAPI/#dom-filereader-done -FileReader.DONE = FileReader.prototype.DONE = 2 + // 5. Set controller’s serialized abort reason to serializedError. + this.serializedAbortReason = error -Object.defineProperties(FileReader.prototype, { - EMPTY: staticPropertyDescriptors, - LOADING: staticPropertyDescriptors, - DONE: staticPropertyDescriptors, - readAsArrayBuffer: kEnumerableProperty, - readAsBinaryString: kEnumerableProperty, - readAsText: kEnumerableProperty, - readAsDataURL: kEnumerableProperty, - abort: kEnumerableProperty, - readyState: kEnumerableProperty, - result: kEnumerableProperty, - error: kEnumerableProperty, - onloadstart: kEnumerableProperty, - onprogress: kEnumerableProperty, - onload: kEnumerableProperty, - onabort: kEnumerableProperty, - onerror: kEnumerableProperty, - onloadend: kEnumerableProperty, - [Symbol.toStringTag]: { - value: 'FileReader', - writable: false, - enumerable: false, - configurable: true + this.connection?.destroy(error) + this.emit('terminated', error) } -}) - -Object.defineProperties(FileReader, { - EMPTY: staticPropertyDescriptors, - LOADING: staticPropertyDescriptors, - DONE: staticPropertyDescriptors -}) - -module.exports = { - FileReader } +// https://fetch.spec.whatwg.org/#fetch-method +function fetch (input, init = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'globalThis.fetch' }) -/***/ }), - -/***/ 55504: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - + // 1. Let p be a new promise. + const p = createDeferredPromise() -const { webidl } = __nccwpck_require__(21744) + // 2. Let requestObject be the result of invoking the initial value of + // Request as constructor with input and init as arguments. If this throws + // an exception, reject p with it and return p. + let requestObject -const kState = Symbol('ProgressEvent state') + try { + requestObject = new Request(input, init) + } catch (e) { + p.reject(e) + return p.promise + } -/** - * @see https://xhr.spec.whatwg.org/#progressevent - */ -class ProgressEvent extends Event { - constructor (type, eventInitDict = {}) { - type = webidl.converters.DOMString(type) - eventInitDict = webidl.converters.ProgressEventInit(eventInitDict ?? {}) + // 3. Let request be requestObject’s request. + const request = requestObject[kState] - super(type, eventInitDict) + // 4. If requestObject’s signal’s aborted flag is set, then: + if (requestObject.signal.aborted) { + // 1. Abort the fetch() call with p, request, null, and + // requestObject’s signal’s abort reason. + abortFetch(p, request, null, requestObject.signal.reason) - this[kState] = { - lengthComputable: eventInitDict.lengthComputable, - loaded: eventInitDict.loaded, - total: eventInitDict.total - } + // 2. Return p. + return p.promise } - get lengthComputable () { - webidl.brandCheck(this, ProgressEvent) + // 5. Let globalObject be request’s client’s global object. + const globalObject = request.client.globalObject - return this[kState].lengthComputable + // 6. If globalObject is a ServiceWorkerGlobalScope object, then set + // request’s service-workers mode to "none". + if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') { + request.serviceWorkers = 'none' } - get loaded () { - webidl.brandCheck(this, ProgressEvent) + // 7. Let responseObject be null. + let responseObject = null - return this[kState].loaded - } + // 8. Let relevantRealm be this’s relevant Realm. + const relevantRealm = null - get total () { - webidl.brandCheck(this, ProgressEvent) + // 9. Let locallyAborted be false. + let locallyAborted = false - return this[kState].total - } -} + // 10. Let controller be null. + let controller = null -webidl.converters.ProgressEventInit = webidl.dictionaryConverter([ - { - key: 'lengthComputable', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'loaded', - converter: webidl.converters['unsigned long long'], - defaultValue: 0 - }, - { - key: 'total', - converter: webidl.converters['unsigned long long'], - defaultValue: 0 - }, - { - key: 'bubbles', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'cancelable', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'composed', - converter: webidl.converters.boolean, - defaultValue: false - } -]) + // 11. Add the following abort steps to requestObject’s signal: + addAbortListener( + requestObject.signal, + () => { + // 1. Set locallyAborted to true. + locallyAborted = true -module.exports = { - ProgressEvent -} + // 2. Assert: controller is non-null. + assert(controller != null) + // 3. Abort controller with requestObject’s signal’s abort reason. + controller.abort(requestObject.signal.reason) -/***/ }), + // 4. Abort the fetch() call with p, request, responseObject, + // and requestObject’s signal’s abort reason. + abortFetch(p, request, responseObject, requestObject.signal.reason) + } + ) -/***/ 29054: -/***/ ((module) => { + // 12. Let handleFetchDone given response response be to finalize and + // report timing with response, globalObject, and "fetch". + const handleFetchDone = (response) => + finalizeAndReportTiming(response, 'fetch') -"use strict"; + // 13. Set controller to the result of calling fetch given request, + // with processResponseEndOfBody set to handleFetchDone, and processResponse + // given response being these substeps: + const processResponse = (response) => { + // 1. If locallyAborted is true, terminate these substeps. + if (locallyAborted) { + return Promise.resolve() + } -module.exports = { - kState: Symbol('FileReader state'), - kResult: Symbol('FileReader result'), - kError: Symbol('FileReader error'), - kLastProgressEventFired: Symbol('FileReader last progress event fired timestamp'), - kEvents: Symbol('FileReader events'), - kAborted: Symbol('FileReader aborted') -} + // 2. If response’s aborted flag is set, then: + if (response.aborted) { + // 1. Let deserializedError be the result of deserialize a serialized + // abort reason given controller’s serialized abort reason and + // relevantRealm. + // 2. Abort the fetch() call with p, request, responseObject, and + // deserializedError. -/***/ }), + abortFetch(p, request, responseObject, controller.serializedAbortReason) + return Promise.resolve() + } -/***/ 87530: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 3. If response is a network error, then reject p with a TypeError + // and terminate these substeps. + if (response.type === 'error') { + p.reject( + Object.assign(new TypeError('fetch failed'), { cause: response.error }) + ) + return Promise.resolve() + } -"use strict"; + // 4. Set responseObject to the result of creating a Response object, + // given response, "immutable", and relevantRealm. + responseObject = new Response() + responseObject[kState] = response + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kHeadersList] = response.headersList + responseObject[kHeaders][kGuard] = 'immutable' + responseObject[kHeaders][kRealm] = relevantRealm + // 5. Resolve p with responseObject. + p.resolve(responseObject) + } -const { - kState, - kError, - kResult, - kAborted, - kLastProgressEventFired -} = __nccwpck_require__(29054) -const { ProgressEvent } = __nccwpck_require__(55504) -const { getEncoding } = __nccwpck_require__(84854) -const { DOMException } = __nccwpck_require__(41037) -const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(685) -const { types } = __nccwpck_require__(73837) -const { StringDecoder } = __nccwpck_require__(71576) -const { btoa } = __nccwpck_require__(14300) + controller = fetching({ + request, + processResponseEndOfBody: handleFetchDone, + processResponse, + dispatcher: init.dispatcher ?? getGlobalDispatcher() // undici + }) -/** @type {PropertyDescriptor} */ -const staticPropertyDescriptors = { - enumerable: true, - writable: false, - configurable: false + // 14. Return p. + return p.promise } -/** - * @see https://w3c.github.io/FileAPI/#readOperation - * @param {import('./filereader').FileReader} fr - * @param {import('buffer').Blob} blob - * @param {string} type - * @param {string?} encodingName - */ -function readOperation (fr, blob, type, encodingName) { - // 1. If fr’s state is "loading", throw an InvalidStateError - // DOMException. - if (fr[kState] === 'loading') { - throw new DOMException('Invalid state', 'InvalidStateError') +// https://fetch.spec.whatwg.org/#finalize-and-report-timing +function finalizeAndReportTiming (response, initiatorType = 'other') { + // 1. If response is an aborted network error, then return. + if (response.type === 'error' && response.aborted) { + return } - // 2. Set fr’s state to "loading". - fr[kState] = 'loading' + // 2. If response’s URL list is null or empty, then return. + if (!response.urlList?.length) { + return + } - // 3. Set fr’s result to null. - fr[kResult] = null + // 3. Let originalURL be response’s URL list[0]. + const originalURL = response.urlList[0] - // 4. Set fr’s error to null. - fr[kError] = null + // 4. Let timingInfo be response’s timing info. + let timingInfo = response.timingInfo - // 5. Let stream be the result of calling get stream on blob. - /** @type {import('stream/web').ReadableStream} */ - const stream = blob.stream() + // 5. Let cacheState be response’s cache state. + let cacheState = response.cacheState - // 6. Let reader be the result of getting a reader from stream. - const reader = stream.getReader() + // 6. If originalURL’s scheme is not an HTTP(S) scheme, then return. + if (!urlIsHttpHttpsScheme(originalURL)) { + return + } - // 7. Let bytes be an empty byte sequence. - /** @type {Uint8Array[]} */ - const bytes = [] + // 7. If timingInfo is null, then return. + if (timingInfo === null) { + return + } - // 8. Let chunkPromise be the result of reading a chunk from - // stream with reader. - let chunkPromise = reader.read() + // 8. If response’s timing allow passed flag is not set, then: + if (!response.timingAllowPassed) { + // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo. + timingInfo = createOpaqueTimingInfo({ + startTime: timingInfo.startTime + }) - // 9. Let isFirstChunk be true. - let isFirstChunk = true + // 2. Set cacheState to the empty string. + cacheState = '' + } - // 10. In parallel, while true: - // Note: "In parallel" just means non-blocking - // Note 2: readOperation itself cannot be async as double - // reading the body would then reject the promise, instead - // of throwing an error. - ;(async () => { - while (!fr[kAborted]) { - // 1. Wait for chunkPromise to be fulfilled or rejected. - try { - const { done, value } = await chunkPromise + // 9. Set timingInfo’s end time to the coarsened shared current time + // given global’s relevant settings object’s cross-origin isolated + // capability. + // TODO: given global’s relevant settings object’s cross-origin isolated + // capability? + timingInfo.endTime = coarsenedSharedCurrentTime() - // 2. If chunkPromise is fulfilled, and isFirstChunk is - // true, queue a task to fire a progress event called - // loadstart at fr. - if (isFirstChunk && !fr[kAborted]) { - queueMicrotask(() => { - fireAProgressEvent('loadstart', fr) - }) - } + // 10. Set response’s timing info to timingInfo. + response.timingInfo = timingInfo - // 3. Set isFirstChunk to false. - isFirstChunk = false + // 11. Mark resource timing for timingInfo, originalURL, initiatorType, + // global, and cacheState. + markResourceTiming( + timingInfo, + originalURL, + initiatorType, + globalThis, + cacheState + ) +} - // 4. If chunkPromise is fulfilled with an object whose - // done property is false and whose value property is - // a Uint8Array object, run these steps: - if (!done && types.isUint8Array(value)) { - // 1. Let bs be the byte sequence represented by the - // Uint8Array object. +// https://w3c.github.io/resource-timing/#dfn-mark-resource-timing +function markResourceTiming (timingInfo, originalURL, initiatorType, globalThis, cacheState) { + if (nodeMajor > 18 || (nodeMajor === 18 && nodeMinor >= 2)) { + performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis, cacheState) + } +} - // 2. Append bs to bytes. - bytes.push(value) +// https://fetch.spec.whatwg.org/#abort-fetch +function abortFetch (p, request, responseObject, error) { + // Note: AbortSignal.reason was added in node v17.2.0 + // which would give us an undefined error to reject with. + // Remove this once node v16 is no longer supported. + if (!error) { + error = new DOMException('The operation was aborted.', 'AbortError') + } - // 3. If roughly 50ms have passed since these steps - // were last invoked, queue a task to fire a - // progress event called progress at fr. - if ( - ( - fr[kLastProgressEventFired] === undefined || - Date.now() - fr[kLastProgressEventFired] >= 50 - ) && - !fr[kAborted] - ) { - fr[kLastProgressEventFired] = Date.now() - queueMicrotask(() => { - fireAProgressEvent('progress', fr) - }) - } + // 1. Reject promise with error. + p.reject(error) - // 4. Set chunkPromise to the result of reading a - // chunk from stream with reader. - chunkPromise = reader.read() - } else if (done) { - // 5. Otherwise, if chunkPromise is fulfilled with an - // object whose done property is true, queue a task - // to run the following steps and abort this algorithm: - queueMicrotask(() => { - // 1. Set fr’s state to "done". - fr[kState] = 'done' + // 2. If request’s body is not null and is readable, then cancel request’s + // body with error. + if (request.body != null && isReadable(request.body?.stream)) { + request.body.stream.cancel(error).catch((err) => { + if (err.code === 'ERR_INVALID_STATE') { + // Node bug? + return + } + throw err + }) + } - // 2. Let result be the result of package data given - // bytes, type, blob’s type, and encodingName. - try { - const result = packageData(bytes, type, blob.type, encodingName) + // 3. If responseObject is null, then return. + if (responseObject == null) { + return + } - // 4. Else: + // 4. Let response be responseObject’s response. + const response = responseObject[kState] - if (fr[kAborted]) { - return - } + // 5. If response’s body is not null and is readable, then error response’s + // body with error. + if (response.body != null && isReadable(response.body?.stream)) { + response.body.stream.cancel(error).catch((err) => { + if (err.code === 'ERR_INVALID_STATE') { + // Node bug? + return + } + throw err + }) + } +} - // 1. Set fr’s result to result. - fr[kResult] = result +// https://fetch.spec.whatwg.org/#fetching +function fetching ({ + request, + processRequestBodyChunkLength, + processRequestEndOfBody, + processResponse, + processResponseEndOfBody, + processResponseConsumeBody, + useParallelQueue = false, + dispatcher // undici +}) { + // 1. Let taskDestination be null. + let taskDestination = null - // 2. Fire a progress event called load at the fr. - fireAProgressEvent('load', fr) - } catch (error) { - // 3. If package data threw an exception error: + // 2. Let crossOriginIsolatedCapability be false. + let crossOriginIsolatedCapability = false - // 1. Set fr’s error to error. - fr[kError] = error + // 3. If request’s client is non-null, then: + if (request.client != null) { + // 1. Set taskDestination to request’s client’s global object. + taskDestination = request.client.globalObject - // 2. Fire a progress event called error at fr. - fireAProgressEvent('error', fr) - } + // 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin + // isolated capability. + crossOriginIsolatedCapability = + request.client.crossOriginIsolatedCapability + } - // 5. If fr’s state is not "loading", fire a progress - // event called loadend at the fr. - if (fr[kState] !== 'loading') { - fireAProgressEvent('loadend', fr) - } - }) + // 4. If useParallelQueue is true, then set taskDestination to the result of + // starting a new parallel queue. + // TODO - break - } - } catch (error) { - if (fr[kAborted]) { - return - } + // 5. Let timingInfo be a new fetch timing info whose start time and + // post-redirect start time are the coarsened shared current time given + // crossOriginIsolatedCapability. + const currenTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability) + const timingInfo = createOpaqueTimingInfo({ + startTime: currenTime + }) - // 6. Otherwise, if chunkPromise is rejected with an - // error error, queue a task to run the following - // steps and abort this algorithm: - queueMicrotask(() => { - // 1. Set fr’s state to "done". - fr[kState] = 'done' + // 6. Let fetchParams be a new fetch params whose + // request is request, + // timing info is timingInfo, + // process request body chunk length is processRequestBodyChunkLength, + // process request end-of-body is processRequestEndOfBody, + // process response is processResponse, + // process response consume body is processResponseConsumeBody, + // process response end-of-body is processResponseEndOfBody, + // task destination is taskDestination, + // and cross-origin isolated capability is crossOriginIsolatedCapability. + const fetchParams = { + controller: new Fetch(dispatcher), + request, + timingInfo, + processRequestBodyChunkLength, + processRequestEndOfBody, + processResponse, + processResponseConsumeBody, + processResponseEndOfBody, + taskDestination, + crossOriginIsolatedCapability + } - // 2. Set fr’s error to error. - fr[kError] = error + // 7. If request’s body is a byte sequence, then set request’s body to + // request’s body as a body. + // NOTE: Since fetching is only called from fetch, body should already be + // extracted. + assert(!request.body || request.body.stream) - // 3. Fire a progress event called error at fr. - fireAProgressEvent('error', fr) + // 8. If request’s window is "client", then set request’s window to request’s + // client, if request’s client’s global object is a Window object; otherwise + // "no-window". + if (request.window === 'client') { + // TODO: What if request.client is null? + request.window = + request.client?.globalObject?.constructor?.name === 'Window' + ? request.client + : 'no-window' + } - // 4. If fr’s state is not "loading", fire a progress - // event called loadend at fr. - if (fr[kState] !== 'loading') { - fireAProgressEvent('loadend', fr) - } - }) + // 9. If request’s origin is "client", then set request’s origin to request’s + // client’s origin. + if (request.origin === 'client') { + // TODO: What if request.client is null? + request.origin = request.client?.origin + } - break - } + // 10. If all of the following conditions are true: + // TODO + + // 11. If request’s policy container is "client", then: + if (request.policyContainer === 'client') { + // 1. If request’s client is non-null, then set request’s policy + // container to a clone of request’s client’s policy container. [HTML] + if (request.client != null) { + request.policyContainer = clonePolicyContainer( + request.client.policyContainer + ) + } else { + // 2. Otherwise, set request’s policy container to a new policy + // container. + request.policyContainer = makePolicyContainer() } - })() -} + } -/** - * @see https://w3c.github.io/FileAPI/#fire-a-progress-event - * @see https://dom.spec.whatwg.org/#concept-event-fire - * @param {string} e The name of the event - * @param {import('./filereader').FileReader} reader - */ -function fireAProgressEvent (e, reader) { - // The progress event e does not bubble. e.bubbles must be false - // The progress event e is NOT cancelable. e.cancelable must be false - const event = new ProgressEvent(e, { - bubbles: false, - cancelable: false - }) + // 12. If request’s header list does not contain `Accept`, then: + if (!request.headersList.contains('accept')) { + // 1. Let value be `*/*`. + const value = '*/*' - reader.dispatchEvent(event) + // 2. A user agent should set value to the first matching statement, if + // any, switching on request’s destination: + // "document" + // "frame" + // "iframe" + // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` + // "image" + // `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5` + // "style" + // `text/css,*/*;q=0.1` + // TODO + + // 3. Append `Accept`/value to request’s header list. + request.headersList.append('accept', value) + } + + // 13. If request’s header list does not contain `Accept-Language`, then + // user agents should append `Accept-Language`/an appropriate value to + // request’s header list. + if (!request.headersList.contains('accept-language')) { + request.headersList.append('accept-language', '*') + } + + // 14. If request’s priority is null, then use request’s initiator and + // destination appropriately in setting request’s priority to a + // user-agent-defined object. + if (request.priority === null) { + // TODO + } + + // 15. If request is a subresource request, then: + if (subresourceSet.has(request.destination)) { + // TODO + } + + // 16. Run main fetch given fetchParams. + mainFetch(fetchParams) + .catch(err => { + fetchParams.controller.terminate(err) + }) + + // 17. Return fetchParam's controller + return fetchParams.controller } -/** - * @see https://w3c.github.io/FileAPI/#blob-package-data - * @param {Uint8Array[]} bytes - * @param {string} type - * @param {string?} mimeType - * @param {string?} encodingName - */ -function packageData (bytes, type, mimeType, encodingName) { - // 1. A Blob has an associated package data algorithm, given - // bytes, a type, a optional mimeType, and a optional - // encodingName, which switches on type and runs the - // associated steps: +// https://fetch.spec.whatwg.org/#concept-main-fetch +async function mainFetch (fetchParams, recursive = false) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request - switch (type) { - case 'DataURL': { - // 1. Return bytes as a DataURL [RFC2397] subject to - // the considerations below: - // * Use mimeType as part of the Data URL if it is - // available in keeping with the Data URL - // specification [RFC2397]. - // * If mimeType is not available return a Data URL - // without a media-type. [RFC2397]. + // 2. Let response be null. + let response = null - // https://datatracker.ietf.org/doc/html/rfc2397#section-3 - // dataurl := "data:" [ mediatype ] [ ";base64" ] "," data - // mediatype := [ type "/" subtype ] *( ";" parameter ) - // data := *urlchar - // parameter := attribute "=" value - let dataURL = 'data:' + // 3. If request’s local-URLs-only flag is set and request’s current URL is + // not local, then set response to a network error. + if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) { + response = makeNetworkError('local URLs only') + } - const parsed = parseMIMEType(mimeType || 'application/octet-stream') + // 4. Run report Content Security Policy violations for request. + // TODO - if (parsed !== 'failure') { - dataURL += serializeAMimeType(parsed) - } + // 5. Upgrade request to a potentially trustworthy URL, if appropriate. + tryUpgradeRequestToAPotentiallyTrustworthyURL(request) - dataURL += ';base64,' + // 6. If should request be blocked due to a bad port, should fetching request + // be blocked as mixed content, or should request be blocked by Content + // Security Policy returns blocked, then set response to a network error. + if (requestBadPort(request) === 'blocked') { + response = makeNetworkError('bad port') + } + // TODO: should fetching request be blocked as mixed content? + // TODO: should request be blocked by Content Security Policy? - const decoder = new StringDecoder('latin1') + // 7. If request’s referrer policy is the empty string, then set request’s + // referrer policy to request’s policy container’s referrer policy. + if (request.referrerPolicy === '') { + request.referrerPolicy = request.policyContainer.referrerPolicy + } - for (const chunk of bytes) { - dataURL += btoa(decoder.write(chunk)) - } + // 8. If request’s referrer is not "no-referrer", then set request’s + // referrer to the result of invoking determine request’s referrer. + if (request.referrer !== 'no-referrer') { + request.referrer = determineRequestsReferrer(request) + } - dataURL += btoa(decoder.end()) + // 9. Set request’s current URL’s scheme to "https" if all of the following + // conditions are true: + // - request’s current URL’s scheme is "http" + // - request’s current URL’s host is a domain + // - Matching request’s current URL’s host per Known HSTS Host Domain Name + // Matching results in either a superdomain match with an asserted + // includeSubDomains directive or a congruent match (with or without an + // asserted includeSubDomains directive). [HSTS] + // TODO - return dataURL - } - case 'Text': { - // 1. Let encoding be failure - let encoding = 'failure' + // 10. If recursive is false, then run the remaining steps in parallel. + // TODO - // 2. If the encodingName is present, set encoding to the - // result of getting an encoding from encodingName. - if (encodingName) { - encoding = getEncoding(encodingName) - } + // 11. If response is null, then set response to the result of running + // the steps corresponding to the first matching statement: + if (response === null) { + response = await (async () => { + const currentURL = requestCurrentURL(request) - // 3. If encoding is failure, and mimeType is present: - if (encoding === 'failure' && mimeType) { - // 1. Let type be the result of parse a MIME type - // given mimeType. - const type = parseMIMEType(mimeType) + if ( + // - request’s current URL’s origin is same origin with request’s origin, + // and request’s response tainting is "basic" + (sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') || + // request’s current URL’s scheme is "data" + (currentURL.protocol === 'data:') || + // - request’s mode is "navigate" or "websocket" + (request.mode === 'navigate' || request.mode === 'websocket') + ) { + // 1. Set request’s response tainting to "basic". + request.responseTainting = 'basic' - // 2. If type is not failure, set encoding to the result - // of getting an encoding from type’s parameters["charset"]. - if (type !== 'failure') { - encoding = getEncoding(type.parameters.get('charset')) - } + // 2. Return the result of running scheme fetch given fetchParams. + return await schemeFetch(fetchParams) } - // 4. If encoding is failure, then set encoding to UTF-8. - if (encoding === 'failure') { - encoding = 'UTF-8' + // request’s mode is "same-origin" + if (request.mode === 'same-origin') { + // 1. Return a network error. + return makeNetworkError('request mode cannot be "same-origin"') } - // 5. Decode bytes using fallback encoding encoding, and - // return the result. - return decode(bytes, encoding) - } - case 'ArrayBuffer': { - // Return a new ArrayBuffer whose contents are bytes. - const sequence = combineByteSequences(bytes) - - return sequence.buffer - } - case 'BinaryString': { - // Return bytes as a binary string, in which every byte - // is represented by a code unit of equal value [0..255]. - let binaryString = '' + // request’s mode is "no-cors" + if (request.mode === 'no-cors') { + // 1. If request’s redirect mode is not "follow", then return a network + // error. + if (request.redirect !== 'follow') { + return makeNetworkError( + 'redirect mode cannot be "follow" for "no-cors" request' + ) + } - const decoder = new StringDecoder('latin1') + // 2. Set request’s response tainting to "opaque". + request.responseTainting = 'opaque' - for (const chunk of bytes) { - binaryString += decoder.write(chunk) + // 3. Return the result of running scheme fetch given fetchParams. + return await schemeFetch(fetchParams) } - binaryString += decoder.end() + // request’s current URL’s scheme is not an HTTP(S) scheme + if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) { + // Return a network error. + return makeNetworkError('URL scheme must be a HTTP(S) scheme') + } - return binaryString + // - request’s use-CORS-preflight flag is set + // - request’s unsafe-request flag is set and either request’s method is + // not a CORS-safelisted method or CORS-unsafe request-header names with + // request’s header list is not empty + // 1. Set request’s response tainting to "cors". + // 2. Let corsWithPreflightResponse be the result of running HTTP fetch + // given fetchParams and true. + // 3. If corsWithPreflightResponse is a network error, then clear cache + // entries using request. + // 4. Return corsWithPreflightResponse. + // TODO + + // Otherwise + // 1. Set request’s response tainting to "cors". + request.responseTainting = 'cors' + + // 2. Return the result of running HTTP fetch given fetchParams. + return await httpFetch(fetchParams) + })() + } + + // 12. If recursive is true, then return response. + if (recursive) { + return response + } + + // 13. If response is not a network error and response is not a filtered + // response, then: + if (response.status !== 0 && !response.internalResponse) { + // If request’s response tainting is "cors", then: + if (request.responseTainting === 'cors') { + // 1. Let headerNames be the result of extracting header list values + // given `Access-Control-Expose-Headers` and response’s header list. + // TODO + // 2. If request’s credentials mode is not "include" and headerNames + // contains `*`, then set response’s CORS-exposed header-name list to + // all unique header names in response’s header list. + // TODO + // 3. Otherwise, if headerNames is not null or failure, then set + // response’s CORS-exposed header-name list to headerNames. + // TODO + } + + // Set response to the following filtered response with response as its + // internal response, depending on request’s response tainting: + if (request.responseTainting === 'basic') { + response = filterResponse(response, 'basic') + } else if (request.responseTainting === 'cors') { + response = filterResponse(response, 'cors') + } else if (request.responseTainting === 'opaque') { + response = filterResponse(response, 'opaque') + } else { + assert(false) } } -} -/** - * @see https://encoding.spec.whatwg.org/#decode - * @param {Uint8Array[]} ioQueue - * @param {string} encoding - */ -function decode (ioQueue, encoding) { - const bytes = combineByteSequences(ioQueue) + // 14. Let internalResponse be response, if response is a network error, + // and response’s internal response otherwise. + let internalResponse = + response.status === 0 ? response : response.internalResponse - // 1. Let BOMEncoding be the result of BOM sniffing ioQueue. - const BOMEncoding = BOMSniffing(bytes) + // 15. If internalResponse’s URL list is empty, then set it to a clone of + // request’s URL list. + if (internalResponse.urlList.length === 0) { + internalResponse.urlList.push(...request.urlList) + } - let slice = 0 + // 16. If request’s timing allow failed flag is unset, then set + // internalResponse’s timing allow passed flag. + if (!request.timingAllowFailed) { + response.timingAllowPassed = true + } - // 2. If BOMEncoding is non-null: - if (BOMEncoding !== null) { - // 1. Set encoding to BOMEncoding. - encoding = BOMEncoding + // 17. If response is not a network error and any of the following returns + // blocked + // - should internalResponse to request be blocked as mixed content + // - should internalResponse to request be blocked by Content Security Policy + // - should internalResponse to request be blocked due to its MIME type + // - should internalResponse to request be blocked due to nosniff + // TODO - // 2. Read three bytes from ioQueue, if BOMEncoding is - // UTF-8; otherwise read two bytes. - // (Do nothing with those bytes.) - slice = BOMEncoding === 'UTF-8' ? 3 : 2 + // 18. If response’s type is "opaque", internalResponse’s status is 206, + // internalResponse’s range-requested flag is set, and request’s header + // list does not contain `Range`, then set response and internalResponse + // to a network error. + if ( + response.type === 'opaque' && + internalResponse.status === 206 && + internalResponse.rangeRequested && + !request.headers.contains('range') + ) { + response = internalResponse = makeNetworkError() } - // 3. Process a queue with an instance of encoding’s - // decoder, ioQueue, output, and "replacement". + // 19. If response is not a network error and either request’s method is + // `HEAD` or `CONNECT`, or internalResponse’s status is a null body status, + // set internalResponse’s body to null and disregard any enqueuing toward + // it (if any). + if ( + response.status !== 0 && + (request.method === 'HEAD' || + request.method === 'CONNECT' || + nullBodyStatus.includes(internalResponse.status)) + ) { + internalResponse.body = null + fetchParams.controller.dump = true + } - // 4. Return output. + // 20. If request’s integrity metadata is not the empty string, then: + if (request.integrity) { + // 1. Let processBodyError be this step: run fetch finale given fetchParams + // and a network error. + const processBodyError = (reason) => + fetchFinale(fetchParams, makeNetworkError(reason)) - const sliced = bytes.slice(slice) - return new TextDecoder(encoding).decode(sliced) -} + // 2. If request’s response tainting is "opaque", or response’s body is null, + // then run processBodyError and abort these steps. + if (request.responseTainting === 'opaque' || response.body == null) { + processBodyError(response.error) + return + } -/** - * @see https://encoding.spec.whatwg.org/#bom-sniff - * @param {Uint8Array} ioQueue - */ -function BOMSniffing (ioQueue) { - // 1. Let BOM be the result of peeking 3 bytes from ioQueue, - // converted to a byte sequence. - const [a, b, c] = ioQueue + // 3. Let processBody given bytes be these steps: + const processBody = (bytes) => { + // 1. If bytes do not match request’s integrity metadata, + // then run processBodyError and abort these steps. [SRI] + if (!bytesMatch(bytes, request.integrity)) { + processBodyError('integrity mismatch') + return + } - // 2. For each of the rows in the table below, starting with - // the first one and going down, if BOM starts with the - // bytes given in the first column, then return the - // encoding given in the cell in the second column of that - // row. Otherwise, return null. - if (a === 0xEF && b === 0xBB && c === 0xBF) { - return 'UTF-8' - } else if (a === 0xFE && b === 0xFF) { - return 'UTF-16BE' - } else if (a === 0xFF && b === 0xFE) { - return 'UTF-16LE' - } + // 2. Set response’s body to bytes as a body. + response.body = safelyExtractBody(bytes)[0] - return null + // 3. Run fetch finale given fetchParams and response. + fetchFinale(fetchParams, response) + } + + // 4. Fully read response’s body given processBody and processBodyError. + await fullyReadBody(response.body, processBody, processBodyError) + } else { + // 21. Otherwise, run fetch finale given fetchParams and response. + fetchFinale(fetchParams, response) + } } -/** - * @param {Uint8Array[]} sequences - */ -function combineByteSequences (sequences) { - const size = sequences.reduce((a, b) => { - return a + b.byteLength - }, 0) +// https://fetch.spec.whatwg.org/#concept-scheme-fetch +// given a fetch params fetchParams +function schemeFetch (fetchParams) { + // Note: since the connection is destroyed on redirect, which sets fetchParams to a + // cancelled state, we do not want this condition to trigger *unless* there have been + // no redirects. See https://github.com/nodejs/undici/issues/1776 + // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams. + if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) { + return Promise.resolve(makeAppropriateNetworkError(fetchParams)) + } - let offset = 0 + // 2. Let request be fetchParams’s request. + const { request } = fetchParams - return sequences.reduce((a, b) => { - a.set(b, offset) - offset += b.byteLength - return a - }, new Uint8Array(size)) -} + const { protocol: scheme } = requestCurrentURL(request) -module.exports = { - staticPropertyDescriptors, - readOperation, - fireAProgressEvent -} + // 3. Switch on request’s current URL’s scheme and run the associated steps: + switch (scheme) { + case 'about:': { + // If request’s current URL’s path is the string "blank", then return a new response + // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) », + // and body is the empty byte sequence as a body. + // Otherwise, return a network error. + return Promise.resolve(makeNetworkError('about scheme is not supported')) + } + case 'blob:': { + if (!resolveObjectURL) { + resolveObjectURL = (__nccwpck_require__(14300).resolveObjectURL) + } -/***/ }), + // 1. Let blobURLEntry be request’s current URL’s blob URL entry. + const blobURLEntry = requestCurrentURL(request) -/***/ 21892: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56 + // Buffer.resolveObjectURL does not ignore URL queries. + if (blobURLEntry.search.length !== 0) { + return Promise.resolve(makeNetworkError('NetworkError when attempting to fetch resource.')) + } -"use strict"; + const blobURLEntryObject = resolveObjectURL(blobURLEntry.toString()) + // 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s + // object is not a Blob object, then return a network error. + if (request.method !== 'GET' || !isBlobLike(blobURLEntryObject)) { + return Promise.resolve(makeNetworkError('invalid method')) + } -// We include a version number for the Dispatcher API. In case of breaking changes, -// this version number must be increased to avoid conflicts. -const globalDispatcher = Symbol.for('undici.globalDispatcher.1') -const { InvalidArgumentError } = __nccwpck_require__(48045) -const Agent = __nccwpck_require__(7890) + // 3. Let bodyWithType be the result of safely extracting blobURLEntry’s object. + const bodyWithType = safelyExtractBody(blobURLEntryObject) -if (getGlobalDispatcher() === undefined) { - setGlobalDispatcher(new Agent()) -} + // 4. Let body be bodyWithType’s body. + const body = bodyWithType[0] -function setGlobalDispatcher (agent) { - if (!agent || typeof agent.dispatch !== 'function') { - throw new InvalidArgumentError('Argument agent must implement Agent') - } - Object.defineProperty(globalThis, globalDispatcher, { - value: agent, - writable: true, - enumerable: false, - configurable: false - }) -} + // 5. Let length be body’s length, serialized and isomorphic encoded. + const length = isomorphicEncode(`${body.length}`) -function getGlobalDispatcher () { - return globalThis[globalDispatcher] -} + // 6. Let type be bodyWithType’s type if it is non-null; otherwise the empty byte sequence. + const type = bodyWithType[1] ?? '' -module.exports = { - setGlobalDispatcher, - getGlobalDispatcher -} + // 7. Return a new response whose status message is `OK`, header list is + // « (`Content-Length`, length), (`Content-Type`, type) », and body is body. + const response = makeResponse({ + statusText: 'OK', + headersList: [ + ['content-length', { name: 'Content-Length', value: length }], + ['content-type', { name: 'Content-Type', value: type }] + ] + }) + response.body = body -/***/ }), + return Promise.resolve(response) + } + case 'data:': { + // 1. Let dataURLStruct be the result of running the + // data: URL processor on request’s current URL. + const currentURL = requestCurrentURL(request) + const dataURLStruct = dataURLProcessor(currentURL) -/***/ 46930: -/***/ ((module) => { + // 2. If dataURLStruct is failure, then return a + // network error. + if (dataURLStruct === 'failure') { + return Promise.resolve(makeNetworkError('failed to fetch the data URL')) + } -"use strict"; + // 3. Let mimeType be dataURLStruct’s MIME type, serialized. + const mimeType = serializeAMimeType(dataURLStruct.mimeType) + // 4. Return a response whose status message is `OK`, + // header list is « (`Content-Type`, mimeType) », + // and body is dataURLStruct’s body as a body. + return Promise.resolve(makeResponse({ + statusText: 'OK', + headersList: [ + ['content-type', { name: 'Content-Type', value: mimeType }] + ], + body: safelyExtractBody(dataURLStruct.body)[0] + })) + } + case 'file:': { + // For now, unfortunate as it is, file URLs are left as an exercise for the reader. + // When in doubt, return a network error. + return Promise.resolve(makeNetworkError('not implemented... yet...')) + } + case 'http:': + case 'https:': { + // Return the result of running HTTP fetch given fetchParams. -module.exports = class DecoratorHandler { - constructor (handler) { - this.handler = handler + return httpFetch(fetchParams) + .catch((err) => makeNetworkError(err)) + } + default: { + return Promise.resolve(makeNetworkError('unknown scheme')) + } } +} - onConnect (...args) { - return this.handler.onConnect(...args) - } +// https://fetch.spec.whatwg.org/#finalize-response +function finalizeResponse (fetchParams, response) { + // 1. Set fetchParams’s request’s done flag. + fetchParams.request.done = true - onError (...args) { - return this.handler.onError(...args) + // 2, If fetchParams’s process response done is not null, then queue a fetch + // task to run fetchParams’s process response done given response, with + // fetchParams’s task destination. + if (fetchParams.processResponseDone != null) { + queueMicrotask(() => fetchParams.processResponseDone(response)) } +} - onUpgrade (...args) { - return this.handler.onUpgrade(...args) - } +// https://fetch.spec.whatwg.org/#fetch-finale +function fetchFinale (fetchParams, response) { + // 1. If response is a network error, then: + if (response.type === 'error') { + // 1. Set response’s URL list to « fetchParams’s request’s URL list[0] ». + response.urlList = [fetchParams.request.urlList[0]] - onHeaders (...args) { - return this.handler.onHeaders(...args) + // 2. Set response’s timing info to the result of creating an opaque timing + // info for fetchParams’s timing info. + response.timingInfo = createOpaqueTimingInfo({ + startTime: fetchParams.timingInfo.startTime + }) } - onData (...args) { - return this.handler.onData(...args) - } + // 2. Let processResponseEndOfBody be the following steps: + const processResponseEndOfBody = () => { + // 1. Set fetchParams’s request’s done flag. + fetchParams.request.done = true - onComplete (...args) { - return this.handler.onComplete(...args) + // If fetchParams’s process response end-of-body is not null, + // then queue a fetch task to run fetchParams’s process response + // end-of-body given response with fetchParams’s task destination. + if (fetchParams.processResponseEndOfBody != null) { + queueMicrotask(() => fetchParams.processResponseEndOfBody(response)) + } } - onBodySent (...args) { - return this.handler.onBodySent(...args) + // 3. If fetchParams’s process response is non-null, then queue a fetch task + // to run fetchParams’s process response given response, with fetchParams’s + // task destination. + if (fetchParams.processResponse != null) { + queueMicrotask(() => fetchParams.processResponse(response)) } -} + // 4. If response’s body is null, then run processResponseEndOfBody. + if (response.body == null) { + processResponseEndOfBody() + } else { + // 5. Otherwise: -/***/ }), - -/***/ 72860: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; + // 1. Let transformStream be a new a TransformStream. + // 2. Let identityTransformAlgorithm be an algorithm which, given chunk, + // enqueues chunk in transformStream. + const identityTransformAlgorithm = (chunk, controller) => { + controller.enqueue(chunk) + } -const util = __nccwpck_require__(83983) -const { kBodyUsed } = __nccwpck_require__(72785) -const assert = __nccwpck_require__(39491) -const { InvalidArgumentError } = __nccwpck_require__(48045) -const EE = __nccwpck_require__(82361) + // 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm + // and flushAlgorithm set to processResponseEndOfBody. + const transformStream = new TransformStream({ + start () {}, + transform: identityTransformAlgorithm, + flush: processResponseEndOfBody + }, { + size () { + return 1 + } + }, { + size () { + return 1 + } + }) -const redirectableStatusCodes = [300, 301, 302, 303, 307, 308] + // 4. Set response’s body to the result of piping response’s body through transformStream. + response.body = { stream: response.body.stream.pipeThrough(transformStream) } + } -const kBody = Symbol('body') + // 6. If fetchParams’s process response consume body is non-null, then: + if (fetchParams.processResponseConsumeBody != null) { + // 1. Let processBody given nullOrBytes be this step: run fetchParams’s + // process response consume body given response and nullOrBytes. + const processBody = (nullOrBytes) => fetchParams.processResponseConsumeBody(response, nullOrBytes) -class BodyAsyncIterable { - constructor (body) { - this[kBody] = body - this[kBodyUsed] = false - } + // 2. Let processBodyError be this step: run fetchParams’s process + // response consume body given response and failure. + const processBodyError = (failure) => fetchParams.processResponseConsumeBody(response, failure) - async * [Symbol.asyncIterator] () { - assert(!this[kBodyUsed], 'disturbed') - this[kBodyUsed] = true - yield * this[kBody] + // 3. If response’s body is null, then queue a fetch task to run processBody + // given null, with fetchParams’s task destination. + if (response.body == null) { + queueMicrotask(() => processBody(null)) + } else { + // 4. Otherwise, fully read response’s body given processBody, processBodyError, + // and fetchParams’s task destination. + return fullyReadBody(response.body, processBody, processBodyError) + } + return Promise.resolve() } } -class RedirectHandler { - constructor (dispatch, maxRedirections, opts, handler) { - if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) { - throw new InvalidArgumentError('maxRedirections must be a positive number') - } +// https://fetch.spec.whatwg.org/#http-fetch +async function httpFetch (fetchParams) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request - util.validateHandler(handler, opts.method, opts.upgrade) + // 2. Let response be null. + let response = null - this.dispatch = dispatch - this.location = null - this.abort = null - this.opts = { ...opts, maxRedirections: 0 } // opts must be a copy - this.maxRedirections = maxRedirections - this.handler = handler - this.history = [] + // 3. Let actualResponse be null. + let actualResponse = null - if (util.isStream(this.opts.body)) { - // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp - // so that it can be dispatched again? - // TODO (fix): Do we need 100-expect support to provide a way to do this properly? - if (util.bodyLength(this.opts.body) === 0) { - this.opts.body - .on('data', function () { - assert(false) - }) - } + // 4. Let timingInfo be fetchParams’s timing info. + const timingInfo = fetchParams.timingInfo - if (typeof this.opts.body.readableDidRead !== 'boolean') { - this.opts.body[kBodyUsed] = false - EE.prototype.on.call(this.opts.body, 'data', function () { - this[kBodyUsed] = true - }) - } - } else if (this.opts.body && typeof this.opts.body.pipeTo === 'function') { - // TODO (fix): We can't access ReadableStream internal state - // to determine whether or not it has been disturbed. This is just - // a workaround. - this.opts.body = new BodyAsyncIterable(this.opts.body) - } else if ( - this.opts.body && - typeof this.opts.body !== 'string' && - !ArrayBuffer.isView(this.opts.body) && - util.isIterable(this.opts.body) - ) { - // TODO: Should we allow re-using iterable if !this.opts.idempotent - // or through some other flag? - this.opts.body = new BodyAsyncIterable(this.opts.body) - } + // 5. If request’s service-workers mode is "all", then: + if (request.serviceWorkers === 'all') { + // TODO } - onConnect (abort) { - this.abort = abort - this.handler.onConnect(abort, { history: this.history }) - } - - onUpgrade (statusCode, headers, socket) { - this.handler.onUpgrade(statusCode, headers, socket) - } - - onError (error) { - this.handler.onError(error) - } - - onHeaders (statusCode, headers, resume, statusText) { - this.location = this.history.length >= this.maxRedirections || util.isDisturbed(this.opts.body) - ? null - : parseLocation(statusCode, headers) - - if (this.opts.origin) { - this.history.push(new URL(this.opts.path, this.opts.origin)) - } + // 6. If response is null, then: + if (response === null) { + // 1. If makeCORSPreflight is true and one of these conditions is true: + // TODO - if (!this.location) { - return this.handler.onHeaders(statusCode, headers, resume, statusText) + // 2. If request’s redirect mode is "follow", then set request’s + // service-workers mode to "none". + if (request.redirect === 'follow') { + request.serviceWorkers = 'none' } - const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))) - const path = search ? `${pathname}${search}` : pathname + // 3. Set response and actualResponse to the result of running + // HTTP-network-or-cache fetch given fetchParams. + actualResponse = response = await httpNetworkOrCacheFetch(fetchParams) - // Remove headers referring to the original URL. - // By default it is Host only, unless it's a 303 (see below), which removes also all Content-* headers. - // https://tools.ietf.org/html/rfc7231#section-6.4 - this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin) - this.opts.path = path - this.opts.origin = origin - this.opts.maxRedirections = 0 - this.opts.query = null + // 4. If request’s response tainting is "cors" and a CORS check + // for request and response returns failure, then return a network error. + if ( + request.responseTainting === 'cors' && + corsCheck(request, response) === 'failure' + ) { + return makeNetworkError('cors failure') + } - // https://tools.ietf.org/html/rfc7231#section-6.4.4 - // In case of HTTP 303, always replace method to be either HEAD or GET - if (statusCode === 303 && this.opts.method !== 'HEAD') { - this.opts.method = 'GET' - this.opts.body = null + // 5. If the TAO check for request and response returns failure, then set + // request’s timing allow failed flag. + if (TAOCheck(request, response) === 'failure') { + request.timingAllowFailed = true } } - onData (chunk) { - if (this.location) { - /* - https://tools.ietf.org/html/rfc7231#section-6.4 - - TLDR: undici always ignores 3xx response bodies. - - Redirection is used to serve the requested resource from another URL, so it is assumes that - no body is generated (and thus can be ignored). Even though generating a body is not prohibited. + // 7. If either request’s response tainting or response’s type + // is "opaque", and the cross-origin resource policy check with + // request’s origin, request’s client, request’s destination, + // and actualResponse returns blocked, then return a network error. + if ( + (request.responseTainting === 'opaque' || response.type === 'opaque') && + crossOriginResourcePolicyCheck( + request.origin, + request.client, + request.destination, + actualResponse + ) === 'blocked' + ) { + return makeNetworkError('blocked') + } - For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually - (which means it's optional and not mandated) contain just an hyperlink to the value of - the Location response header, so the body can be ignored safely. + // 8. If actualResponse’s status is a redirect status, then: + if (redirectStatusSet.has(actualResponse.status)) { + // 1. If actualResponse’s status is not 303, request’s body is not null, + // and the connection uses HTTP/2, then user agents may, and are even + // encouraged to, transmit an RST_STREAM frame. + // See, https://github.com/whatwg/fetch/issues/1288 + if (request.redirect !== 'manual') { + fetchParams.controller.connection.destroy() + } - For status 300, which is "Multiple Choices", the spec mentions both generating a Location - response header AND a response body with the other possible location to follow. - Since the spec explicitily chooses not to specify a format for such body and leave it to - servers and browsers implementors, we ignore the body as there is no specified way to eventually parse it. - */ + // 2. Switch on request’s redirect mode: + if (request.redirect === 'error') { + // Set response to a network error. + response = makeNetworkError('unexpected redirect') + } else if (request.redirect === 'manual') { + // Set response to an opaque-redirect filtered response whose internal + // response is actualResponse. + // NOTE(spec): On the web this would return an `opaqueredirect` response, + // but that doesn't make sense server side. + // See https://github.com/nodejs/undici/issues/1193. + response = actualResponse + } else if (request.redirect === 'follow') { + // Set response to the result of running HTTP-redirect fetch given + // fetchParams and response. + response = await httpRedirectFetch(fetchParams, response) } else { - return this.handler.onData(chunk) + assert(false) } } - onComplete (trailers) { - if (this.location) { - /* - https://tools.ietf.org/html/rfc7231#section-6.4 + // 9. Set response’s timing info to timingInfo. + response.timingInfo = timingInfo - TLDR: undici always ignores 3xx response trailers as they are not expected in case of redirections - and neither are useful if present. + // 10. Return response. + return response +} - See comment on onData method above for more detailed informations. - */ +// https://fetch.spec.whatwg.org/#http-redirect-fetch +function httpRedirectFetch (fetchParams, response) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request - this.location = null - this.abort = null + // 2. Let actualResponse be response, if response is not a filtered response, + // and response’s internal response otherwise. + const actualResponse = response.internalResponse + ? response.internalResponse + : response - this.dispatch(this.opts, this) - } else { - this.handler.onComplete(trailers) - } - } + // 3. Let locationURL be actualResponse’s location URL given request’s current + // URL’s fragment. + let locationURL - onBodySent (chunk) { - if (this.handler.onBodySent) { - this.handler.onBodySent(chunk) + try { + locationURL = responseLocationURL( + actualResponse, + requestCurrentURL(request).hash + ) + + // 4. If locationURL is null, then return response. + if (locationURL == null) { + return response } + } catch (err) { + // 5. If locationURL is failure, then return a network error. + return Promise.resolve(makeNetworkError(err)) } -} -function parseLocation (statusCode, headers) { - if (redirectableStatusCodes.indexOf(statusCode) === -1) { - return null + // 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network + // error. + if (!urlIsHttpHttpsScheme(locationURL)) { + return Promise.resolve(makeNetworkError('URL scheme must be a HTTP(S) scheme')) } - for (let i = 0; i < headers.length; i += 2) { - if (headers[i].toString().toLowerCase() === 'location') { - return headers[i + 1] - } + // 7. If request’s redirect count is 20, then return a network error. + if (request.redirectCount === 20) { + return Promise.resolve(makeNetworkError('redirect count exceeded')) } -} -// https://tools.ietf.org/html/rfc7231#section-6.4.4 -function shouldRemoveHeader (header, removeContent, unknownOrigin) { - if (header.length === 4) { - return util.headerNameToString(header) === 'host' + // 8. Increase request’s redirect count by 1. + request.redirectCount += 1 + + // 9. If request’s mode is "cors", locationURL includes credentials, and + // request’s origin is not same origin with locationURL’s origin, then return + // a network error. + if ( + request.mode === 'cors' && + (locationURL.username || locationURL.password) && + !sameOrigin(request, locationURL) + ) { + return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"')) } - if (removeContent && util.headerNameToString(header).startsWith('content-')) { - return true + + // 10. If request’s response tainting is "cors" and locationURL includes + // credentials, then return a network error. + if ( + request.responseTainting === 'cors' && + (locationURL.username || locationURL.password) + ) { + return Promise.resolve(makeNetworkError( + 'URL cannot contain credentials for request mode "cors"' + )) } - if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { - const name = util.headerNameToString(header) - return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' + + // 11. If actualResponse’s status is not 303, request’s body is non-null, + // and request’s body’s source is null, then return a network error. + if ( + actualResponse.status !== 303 && + request.body != null && + request.body.source == null + ) { + return Promise.resolve(makeNetworkError()) } - return false -} -// https://tools.ietf.org/html/rfc7231#section-6.4 -function cleanRequestHeaders (headers, removeContent, unknownOrigin) { - const ret = [] - if (Array.isArray(headers)) { - for (let i = 0; i < headers.length; i += 2) { - if (!shouldRemoveHeader(headers[i], removeContent, unknownOrigin)) { - ret.push(headers[i], headers[i + 1]) - } - } - } else if (headers && typeof headers === 'object') { - for (const key of Object.keys(headers)) { - if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) { - ret.push(key, headers[key]) - } + // 12. If one of the following is true + // - actualResponse’s status is 301 or 302 and request’s method is `POST` + // - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD` + if ( + ([301, 302].includes(actualResponse.status) && request.method === 'POST') || + (actualResponse.status === 303 && + !GET_OR_HEAD.includes(request.method)) + ) { + // then: + // 1. Set request’s method to `GET` and request’s body to null. + request.method = 'GET' + request.body = null + + // 2. For each headerName of request-body-header name, delete headerName from + // request’s header list. + for (const headerName of requestBodyHeader) { + request.headersList.delete(headerName) } - } else { - assert(headers == null, 'headers must be an object or an array') } - return ret -} -module.exports = RedirectHandler + // 13. If request’s current URL’s origin is not same origin with locationURL’s + // origin, then for each headerName of CORS non-wildcard request-header name, + // delete headerName from request’s header list. + if (!sameOrigin(requestCurrentURL(request), locationURL)) { + // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name + request.headersList.delete('authorization') + // https://fetch.spec.whatwg.org/#authentication-entries + request.headersList.delete('proxy-authorization', true) -/***/ }), + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. + request.headersList.delete('cookie') + request.headersList.delete('host') + } -/***/ 82286: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 14. If request’s body is non-null, then set request’s body to the first return + // value of safely extracting request’s body’s source. + if (request.body != null) { + assert(request.body.source != null) + request.body = safelyExtractBody(request.body.source)[0] + } -const assert = __nccwpck_require__(39491) + // 15. Let timingInfo be fetchParams’s timing info. + const timingInfo = fetchParams.timingInfo -const { kRetryHandlerDefaultRetry } = __nccwpck_require__(72785) -const { RequestRetryError } = __nccwpck_require__(48045) -const { isDisturbed, parseHeaders, parseRangeHeader } = __nccwpck_require__(83983) + // 16. Set timingInfo’s redirect end time and post-redirect start time to the + // coarsened shared current time given fetchParams’s cross-origin isolated + // capability. + timingInfo.redirectEndTime = timingInfo.postRedirectStartTime = + coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability) -function calculateRetryAfterHeader (retryAfter) { - const current = Date.now() - const diff = new Date(retryAfter).getTime() - current + // 17. If timingInfo’s redirect start time is 0, then set timingInfo’s + // redirect start time to timingInfo’s start time. + if (timingInfo.redirectStartTime === 0) { + timingInfo.redirectStartTime = timingInfo.startTime + } - return diff -} + // 18. Append locationURL to request’s URL list. + request.urlList.push(locationURL) -class RetryHandler { - constructor (opts, handlers) { - const { retryOptions, ...dispatchOpts } = opts - const { - // Retry scoped - retry: retryFn, - maxRetries, - maxTimeout, - minTimeout, - timeoutFactor, - // Response scoped - methods, - errorCodes, - retryAfter, - statusCodes - } = retryOptions ?? {} + // 19. Invoke set request’s referrer policy on redirect on request and + // actualResponse. + setRequestReferrerPolicyOnRedirect(request, actualResponse) - this.dispatch = handlers.dispatch - this.handler = handlers.handler - this.opts = dispatchOpts - this.abort = null - this.aborted = false - this.retryOpts = { - retry: retryFn ?? RetryHandler[kRetryHandlerDefaultRetry], - retryAfter: retryAfter ?? true, - maxTimeout: maxTimeout ?? 30 * 1000, // 30s, - timeout: minTimeout ?? 500, // .5s - timeoutFactor: timeoutFactor ?? 2, - maxRetries: maxRetries ?? 5, - // What errors we should retry - methods: methods ?? ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'], - // Indicates which errors to retry - statusCodes: statusCodes ?? [500, 502, 503, 504, 429], - // List of errors to retry - errorCodes: errorCodes ?? [ - 'ECONNRESET', - 'ECONNREFUSED', - 'ENOTFOUND', - 'ENETDOWN', - 'ENETUNREACH', - 'EHOSTDOWN', - 'EHOSTUNREACH', - 'EPIPE' - ] - } + // 20. Return the result of running main fetch given fetchParams and true. + return mainFetch(fetchParams, true) +} - this.retryCount = 0 - this.start = 0 - this.end = null - this.etag = null - this.resume = null +// https://fetch.spec.whatwg.org/#http-network-or-cache-fetch +async function httpNetworkOrCacheFetch ( + fetchParams, + isAuthenticationFetch = false, + isNewConnectionFetch = false +) { + // 1. Let request be fetchParams’s request. + const request = fetchParams.request - // Handle possible onConnect duplication - this.handler.onConnect(reason => { - this.aborted = true - if (this.abort) { - this.abort(reason) - } else { - this.reason = reason - } - }) - } + // 2. Let httpFetchParams be null. + let httpFetchParams = null - onRequestSent () { - if (this.handler.onRequestSent) { - this.handler.onRequestSent() - } - } + // 3. Let httpRequest be null. + let httpRequest = null - onUpgrade (statusCode, headers, socket) { - if (this.handler.onUpgrade) { - this.handler.onUpgrade(statusCode, headers, socket) - } - } + // 4. Let response be null. + let response = null - onConnect (abort) { - if (this.aborted) { - abort(this.reason) - } else { - this.abort = abort - } - } + // 5. Let storedResponse be null. + // TODO: cache - onBodySent (chunk) { - if (this.handler.onBodySent) return this.handler.onBodySent(chunk) - } + // 6. Let httpCache be null. + const httpCache = null - static [kRetryHandlerDefaultRetry] (err, { state, opts }, cb) { - const { statusCode, code, headers } = err - const { method, retryOptions } = opts - const { - maxRetries, - timeout, - maxTimeout, - timeoutFactor, - statusCodes, - errorCodes, - methods - } = retryOptions - let { counter, currentTimeout } = state + // 7. Let the revalidatingFlag be unset. + const revalidatingFlag = false - currentTimeout = - currentTimeout != null && currentTimeout > 0 ? currentTimeout : timeout + // 8. Run these steps, but abort when the ongoing fetch is terminated: - // Any code that is not a Undici's originated and allowed to retry - if ( - code && - code !== 'UND_ERR_REQ_RETRY' && - code !== 'UND_ERR_SOCKET' && - !errorCodes.includes(code) - ) { - cb(err) - return - } + // 1. If request’s window is "no-window" and request’s redirect mode is + // "error", then set httpFetchParams to fetchParams and httpRequest to + // request. + if (request.window === 'no-window' && request.redirect === 'error') { + httpFetchParams = fetchParams + httpRequest = request + } else { + // Otherwise: - // If a set of method are provided and the current method is not in the list - if (Array.isArray(methods) && !methods.includes(method)) { - cb(err) - return - } + // 1. Set httpRequest to a clone of request. + httpRequest = makeRequest(request) - // If a set of status code are provided and the current status code is not in the list - if ( - statusCode != null && - Array.isArray(statusCodes) && - !statusCodes.includes(statusCode) - ) { - cb(err) - return - } + // 2. Set httpFetchParams to a copy of fetchParams. + httpFetchParams = { ...fetchParams } - // If we reached the max number of retries - if (counter > maxRetries) { - cb(err) - return - } + // 3. Set httpFetchParams’s request to httpRequest. + httpFetchParams.request = httpRequest + } - let retryAfterHeader = headers != null && headers['retry-after'] - if (retryAfterHeader) { - retryAfterHeader = Number(retryAfterHeader) - retryAfterHeader = isNaN(retryAfterHeader) - ? calculateRetryAfterHeader(retryAfterHeader) - : retryAfterHeader * 1e3 // Retry-After is in seconds - } + // 3. Let includeCredentials be true if one of + const includeCredentials = + request.credentials === 'include' || + (request.credentials === 'same-origin' && + request.responseTainting === 'basic') - const retryTimeout = - retryAfterHeader > 0 - ? Math.min(retryAfterHeader, maxTimeout) - : Math.min(currentTimeout * timeoutFactor ** counter, maxTimeout) + // 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s + // body is non-null; otherwise null. + const contentLength = httpRequest.body ? httpRequest.body.length : null - state.currentTimeout = retryTimeout + // 5. Let contentLengthHeaderValue be null. + let contentLengthHeaderValue = null - setTimeout(() => cb(null), retryTimeout) + // 6. If httpRequest’s body is null and httpRequest’s method is `POST` or + // `PUT`, then set contentLengthHeaderValue to `0`. + if ( + httpRequest.body == null && + ['POST', 'PUT'].includes(httpRequest.method) + ) { + contentLengthHeaderValue = '0' } - onHeaders (statusCode, rawHeaders, resume, statusMessage) { - const headers = parseHeaders(rawHeaders) + // 7. If contentLength is non-null, then set contentLengthHeaderValue to + // contentLength, serialized and isomorphic encoded. + if (contentLength != null) { + contentLengthHeaderValue = isomorphicEncode(`${contentLength}`) + } - this.retryCount += 1 + // 8. If contentLengthHeaderValue is non-null, then append + // `Content-Length`/contentLengthHeaderValue to httpRequest’s header + // list. + if (contentLengthHeaderValue != null) { + httpRequest.headersList.append('content-length', contentLengthHeaderValue) + } - if (statusCode >= 300) { - this.abort( - new RequestRetryError('Request failed', statusCode, { - headers, - count: this.retryCount - }) - ) - return false - } + // 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`, + // contentLengthHeaderValue) to httpRequest’s header list. - // Checkpoint for resume from where we left it - if (this.resume != null) { - this.resume = null + // 10. If contentLength is non-null and httpRequest’s keepalive is true, + // then: + if (contentLength != null && httpRequest.keepalive) { + // NOTE: keepalive is a noop outside of browser context. + } - if (statusCode !== 206) { - return true - } + // 11. If httpRequest’s referrer is a URL, then append + // `Referer`/httpRequest’s referrer, serialized and isomorphic encoded, + // to httpRequest’s header list. + if (httpRequest.referrer instanceof URL) { + httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href)) + } - const contentRange = parseRangeHeader(headers['content-range']) - // If no content range - if (!contentRange) { - this.abort( - new RequestRetryError('Content-Range mismatch', statusCode, { - headers, - count: this.retryCount - }) - ) - return false - } + // 12. Append a request `Origin` header for httpRequest. + appendRequestOriginHeader(httpRequest) - // Let's start with a weak etag check - if (this.etag != null && this.etag !== headers.etag) { - this.abort( - new RequestRetryError('ETag mismatch', statusCode, { - headers, - count: this.retryCount - }) - ) - return false - } + // 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA] + appendFetchMetadata(httpRequest) - const { start, size, end = size } = contentRange + // 14. If httpRequest’s header list does not contain `User-Agent`, then + // user agents should append `User-Agent`/default `User-Agent` value to + // httpRequest’s header list. + if (!httpRequest.headersList.contains('user-agent')) { + httpRequest.headersList.append('user-agent', typeof esbuildDetection === 'undefined' ? 'undici' : 'node') + } - assert(this.start === start, 'content-range mismatch') - assert(this.end == null || this.end === end, 'content-range mismatch') + // 15. If httpRequest’s cache mode is "default" and httpRequest’s header + // list contains `If-Modified-Since`, `If-None-Match`, + // `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set + // httpRequest’s cache mode to "no-store". + if ( + httpRequest.cache === 'default' && + (httpRequest.headersList.contains('if-modified-since') || + httpRequest.headersList.contains('if-none-match') || + httpRequest.headersList.contains('if-unmodified-since') || + httpRequest.headersList.contains('if-match') || + httpRequest.headersList.contains('if-range')) + ) { + httpRequest.cache = 'no-store' + } - this.resume = resume - return true + // 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent + // no-cache cache-control header modification flag is unset, and + // httpRequest’s header list does not contain `Cache-Control`, then append + // `Cache-Control`/`max-age=0` to httpRequest’s header list. + if ( + httpRequest.cache === 'no-cache' && + !httpRequest.preventNoCacheCacheControlHeaderModification && + !httpRequest.headersList.contains('cache-control') + ) { + httpRequest.headersList.append('cache-control', 'max-age=0') + } + + // 17. If httpRequest’s cache mode is "no-store" or "reload", then: + if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') { + // 1. If httpRequest’s header list does not contain `Pragma`, then append + // `Pragma`/`no-cache` to httpRequest’s header list. + if (!httpRequest.headersList.contains('pragma')) { + httpRequest.headersList.append('pragma', 'no-cache') } - if (this.end == null) { - if (statusCode === 206) { - // First time we receive 206 - const range = parseRangeHeader(headers['content-range']) + // 2. If httpRequest’s header list does not contain `Cache-Control`, + // then append `Cache-Control`/`no-cache` to httpRequest’s header list. + if (!httpRequest.headersList.contains('cache-control')) { + httpRequest.headersList.append('cache-control', 'no-cache') + } + } - if (range == null) { - return this.handler.onHeaders( - statusCode, - rawHeaders, - resume, - statusMessage - ) - } + // 18. If httpRequest’s header list contains `Range`, then append + // `Accept-Encoding`/`identity` to httpRequest’s header list. + if (httpRequest.headersList.contains('range')) { + httpRequest.headersList.append('accept-encoding', 'identity') + } - const { start, size, end = size } = range + // 19. Modify httpRequest’s header list per HTTP. Do not append a given + // header if httpRequest’s header list contains that header’s name. + // TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129 + if (!httpRequest.headersList.contains('accept-encoding')) { + if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) { + httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate') + } else { + httpRequest.headersList.append('accept-encoding', 'gzip, deflate') + } + } - assert( - start != null && Number.isFinite(start) && this.start !== start, - 'content-range mismatch' - ) - assert(Number.isFinite(start)) - assert( - end != null && Number.isFinite(end) && this.end !== end, - 'invalid content-length' - ) + httpRequest.headersList.delete('host') - this.start = start - this.end = end - } + // 20. If includeCredentials is true, then: + if (includeCredentials) { + // 1. If the user agent is not configured to block cookies for httpRequest + // (see section 7 of [COOKIES]), then: + // TODO: credentials + // 2. If httpRequest’s header list does not contain `Authorization`, then: + // TODO: credentials + } - // We make our best to checkpoint the body for further range headers - if (this.end == null) { - const contentLength = headers['content-length'] - this.end = contentLength != null ? Number(contentLength) : null - } + // 21. If there’s a proxy-authentication entry, use it as appropriate. + // TODO: proxy-authentication - assert(Number.isFinite(this.start)) - assert( - this.end == null || Number.isFinite(this.end), - 'invalid content-length' - ) + // 22. Set httpCache to the result of determining the HTTP cache + // partition, given httpRequest. + // TODO: cache - this.resume = resume - this.etag = headers.etag != null ? headers.etag : null + // 23. If httpCache is null, then set httpRequest’s cache mode to + // "no-store". + if (httpCache == null) { + httpRequest.cache = 'no-store' + } - return this.handler.onHeaders( - statusCode, - rawHeaders, - resume, - statusMessage - ) + // 24. If httpRequest’s cache mode is neither "no-store" nor "reload", + // then: + if (httpRequest.mode !== 'no-store' && httpRequest.mode !== 'reload') { + // TODO: cache + } + + // 9. If aborted, then return the appropriate network error for fetchParams. + // TODO + + // 10. If response is null, then: + if (response == null) { + // 1. If httpRequest’s cache mode is "only-if-cached", then return a + // network error. + if (httpRequest.mode === 'only-if-cached') { + return makeNetworkError('only if cached') } - const err = new RequestRetryError('Request failed', statusCode, { - headers, - count: this.retryCount - }) + // 2. Let forwardResponse be the result of running HTTP-network fetch + // given httpFetchParams, includeCredentials, and isNewConnectionFetch. + const forwardResponse = await httpNetworkFetch( + httpFetchParams, + includeCredentials, + isNewConnectionFetch + ) - this.abort(err) + // 3. If httpRequest’s method is unsafe and forwardResponse’s status is + // in the range 200 to 399, inclusive, invalidate appropriate stored + // responses in httpCache, as per the "Invalidation" chapter of HTTP + // Caching, and set storedResponse to null. [HTTP-CACHING] + if ( + !safeMethodsSet.has(httpRequest.method) && + forwardResponse.status >= 200 && + forwardResponse.status <= 399 + ) { + // TODO: cache + } - return false + // 4. If the revalidatingFlag is set and forwardResponse’s status is 304, + // then: + if (revalidatingFlag && forwardResponse.status === 304) { + // TODO: cache + } + + // 5. If response is null, then: + if (response == null) { + // 1. Set response to forwardResponse. + response = forwardResponse + + // 2. Store httpRequest and forwardResponse in httpCache, as per the + // "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING] + // TODO: cache + } } - onData (chunk) { - this.start += chunk.length + // 11. Set response’s URL list to a clone of httpRequest’s URL list. + response.urlList = [...httpRequest.urlList] - return this.handler.onData(chunk) + // 12. If httpRequest’s header list contains `Range`, then set response’s + // range-requested flag. + if (httpRequest.headersList.contains('range')) { + response.rangeRequested = true } - onComplete (rawTrailers) { - this.retryCount = 0 - return this.handler.onComplete(rawTrailers) + // 13. Set response’s request-includes-credentials to includeCredentials. + response.requestIncludesCredentials = includeCredentials + + // 14. If response’s status is 401, httpRequest’s response tainting is not + // "cors", includeCredentials is true, and request’s window is an environment + // settings object, then: + // TODO + + // 15. If response’s status is 407, then: + if (response.status === 407) { + // 1. If request’s window is "no-window", then return a network error. + if (request.window === 'no-window') { + return makeNetworkError() + } + + // 2. ??? + + // 3. If fetchParams is canceled, then return the appropriate network error for fetchParams. + if (isCancelled(fetchParams)) { + return makeAppropriateNetworkError(fetchParams) + } + + // 4. Prompt the end user as appropriate in request’s window and store + // the result as a proxy-authentication entry. [HTTP-AUTH] + // TODO: Invoke some kind of callback? + + // 5. Set response to the result of running HTTP-network-or-cache fetch given + // fetchParams. + // TODO + return makeNetworkError('proxy authentication required') } - onError (err) { - if (this.aborted || isDisturbed(this.opts.body)) { - return this.handler.onError(err) + // 16. If all of the following are true + if ( + // response’s status is 421 + response.status === 421 && + // isNewConnectionFetch is false + !isNewConnectionFetch && + // request’s body is null, or request’s body is non-null and request’s body’s source is non-null + (request.body == null || request.body.source != null) + ) { + // then: + + // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams. + if (isCancelled(fetchParams)) { + return makeAppropriateNetworkError(fetchParams) } - this.retryOpts.retry( - err, - { - state: { counter: this.retryCount++, currentTimeout: this.retryAfter }, - opts: { retryOptions: this.retryOpts, ...this.opts } - }, - onRetry.bind(this) + // 2. Set response to the result of running HTTP-network-or-cache + // fetch given fetchParams, isAuthenticationFetch, and true. + + // TODO (spec): The spec doesn't specify this but we need to cancel + // the active response before we can start a new one. + // https://github.com/whatwg/fetch/issues/1293 + fetchParams.controller.connection.destroy() + + response = await httpNetworkOrCacheFetch( + fetchParams, + isAuthenticationFetch, + true ) + } - function onRetry (err) { - if (err != null || this.aborted || isDisturbed(this.opts.body)) { - return this.handler.onError(err) - } + // 17. If isAuthenticationFetch is true, then create an authentication entry + if (isAuthenticationFetch) { + // TODO + } - if (this.start !== 0) { - this.opts = { - ...this.opts, - headers: { - ...this.opts.headers, - range: `bytes=${this.start}-${this.end ?? ''}` - } - } - } + // 18. Return response. + return response +} - try { - this.dispatch(this.opts, this) - } catch (err) { - this.handler.onError(err) +// https://fetch.spec.whatwg.org/#http-network-fetch +async function httpNetworkFetch ( + fetchParams, + includeCredentials = false, + forceNewConnection = false +) { + assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed) + + fetchParams.controller.connection = { + abort: null, + destroyed: false, + destroy (err) { + if (!this.destroyed) { + this.destroyed = true + this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError')) } } } -} -module.exports = RetryHandler + // 1. Let request be fetchParams’s request. + const request = fetchParams.request + // 2. Let response be null. + let response = null -/***/ }), + // 3. Let timingInfo be fetchParams’s timing info. + const timingInfo = fetchParams.timingInfo -/***/ 38861: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 4. Let httpCache be the result of determining the HTTP cache partition, + // given request. + // TODO: cache + const httpCache = null -"use strict"; + // 5. If httpCache is null, then set request’s cache mode to "no-store". + if (httpCache == null) { + request.cache = 'no-store' + } + // 6. Let networkPartitionKey be the result of determining the network + // partition key given request. + // TODO -const RedirectHandler = __nccwpck_require__(72860) + // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise + // "no". + const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars -function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) { - return (dispatch) => { - return function Intercept (opts, handler) { - const { maxRedirections = defaultMaxRedirections } = opts + // 8. Switch on request’s mode: + if (request.mode === 'websocket') { + // Let connection be the result of obtaining a WebSocket connection, + // given request’s current URL. + // TODO + } else { + // Let connection be the result of obtaining a connection, given + // networkPartitionKey, request’s current URL’s origin, + // includeCredentials, and forceNewConnection. + // TODO + } - if (!maxRedirections) { - return dispatch(opts, handler) + // 9. Run these steps, but abort when the ongoing fetch is terminated: + + // 1. If connection is failure, then return a network error. + + // 2. Set timingInfo’s final connection timing info to the result of + // calling clamp and coarsen connection timing info with connection’s + // timing info, timingInfo’s post-redirect start time, and fetchParams’s + // cross-origin isolated capability. + + // 3. If connection is not an HTTP/2 connection, request’s body is non-null, + // and request’s body’s source is null, then append (`Transfer-Encoding`, + // `chunked`) to request’s header list. + + // 4. Set timingInfo’s final network-request start time to the coarsened + // shared current time given fetchParams’s cross-origin isolated + // capability. + + // 5. Set response to the result of making an HTTP request over connection + // using request with the following caveats: + + // - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS] + // [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH] + + // - If request’s body is non-null, and request’s body’s source is null, + // then the user agent may have a buffer of up to 64 kibibytes and store + // a part of request’s body in that buffer. If the user agent reads from + // request’s body beyond that buffer’s size and the user agent needs to + // resend request, then instead return a network error. + + // - Set timingInfo’s final network-response start time to the coarsened + // shared current time given fetchParams’s cross-origin isolated capability, + // immediately after the user agent’s HTTP parser receives the first byte + // of the response (e.g., frame header bytes for HTTP/2 or response status + // line for HTTP/1.x). + + // - Wait until all the headers are transmitted. + + // - Any responses whose status is in the range 100 to 199, inclusive, + // and is not 101, are to be ignored, except for the purposes of setting + // timingInfo’s final network-response start time above. + + // - If request’s header list contains `Transfer-Encoding`/`chunked` and + // response is transferred via HTTP/1.0 or older, then return a network + // error. + + // - If the HTTP request results in a TLS client certificate dialog, then: + + // 1. If request’s window is an environment settings object, make the + // dialog available in request’s window. + + // 2. Otherwise, return a network error. + + // To transmit request’s body body, run these steps: + let requestBody = null + // 1. If body is null and fetchParams’s process request end-of-body is + // non-null, then queue a fetch task given fetchParams’s process request + // end-of-body and fetchParams’s task destination. + if (request.body == null && fetchParams.processRequestEndOfBody) { + queueMicrotask(() => fetchParams.processRequestEndOfBody()) + } else if (request.body != null) { + // 2. Otherwise, if body is non-null: + + // 1. Let processBodyChunk given bytes be these steps: + const processBodyChunk = async function * (bytes) { + // 1. If the ongoing fetch is terminated, then abort these steps. + if (isCancelled(fetchParams)) { + return } - const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler) - opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting. - return dispatch(opts, redirectHandler) - } - } -} + // 2. Run this step in parallel: transmit bytes. + yield bytes -module.exports = createRedirectInterceptor + // 3. If fetchParams’s process request body is non-null, then run + // fetchParams’s process request body given bytes’s length. + fetchParams.processRequestBodyChunkLength?.(bytes.byteLength) + } + // 2. Let processEndOfBody be these steps: + const processEndOfBody = () => { + // 1. If fetchParams is canceled, then abort these steps. + if (isCancelled(fetchParams)) { + return + } -/***/ }), + // 2. If fetchParams’s process request end-of-body is non-null, + // then run fetchParams’s process request end-of-body. + if (fetchParams.processRequestEndOfBody) { + fetchParams.processRequestEndOfBody() + } + } -/***/ 30953: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + // 3. Let processBodyError given e be these steps: + const processBodyError = (e) => { + // 1. If fetchParams is canceled, then abort these steps. + if (isCancelled(fetchParams)) { + return + } -"use strict"; + // 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller. + if (e.name === 'AbortError') { + fetchParams.controller.abort() + } else { + fetchParams.controller.terminate(e) + } + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SPECIAL_HEADERS = exports.HEADER_STATE = exports.MINOR = exports.MAJOR = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.STRICT_TOKEN = exports.HEX = exports.URL_CHAR = exports.STRICT_URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.FINISH = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0; -const utils_1 = __nccwpck_require__(41891); -// C headers -var ERROR; -(function (ERROR) { - ERROR[ERROR["OK"] = 0] = "OK"; - ERROR[ERROR["INTERNAL"] = 1] = "INTERNAL"; - ERROR[ERROR["STRICT"] = 2] = "STRICT"; - ERROR[ERROR["LF_EXPECTED"] = 3] = "LF_EXPECTED"; - ERROR[ERROR["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH"; - ERROR[ERROR["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION"; - ERROR[ERROR["INVALID_METHOD"] = 6] = "INVALID_METHOD"; - ERROR[ERROR["INVALID_URL"] = 7] = "INVALID_URL"; - ERROR[ERROR["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT"; - ERROR[ERROR["INVALID_VERSION"] = 9] = "INVALID_VERSION"; - ERROR[ERROR["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN"; - ERROR[ERROR["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH"; - ERROR[ERROR["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE"; - ERROR[ERROR["INVALID_STATUS"] = 13] = "INVALID_STATUS"; - ERROR[ERROR["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE"; - ERROR[ERROR["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING"; - ERROR[ERROR["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN"; - ERROR[ERROR["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE"; - ERROR[ERROR["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE"; - ERROR[ERROR["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER"; - ERROR[ERROR["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE"; - ERROR[ERROR["PAUSED"] = 21] = "PAUSED"; - ERROR[ERROR["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE"; - ERROR[ERROR["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE"; - ERROR[ERROR["USER"] = 24] = "USER"; -})(ERROR = exports.ERROR || (exports.ERROR = {})); -var TYPE; -(function (TYPE) { - TYPE[TYPE["BOTH"] = 0] = "BOTH"; - TYPE[TYPE["REQUEST"] = 1] = "REQUEST"; - TYPE[TYPE["RESPONSE"] = 2] = "RESPONSE"; -})(TYPE = exports.TYPE || (exports.TYPE = {})); -var FLAGS; -(function (FLAGS) { - FLAGS[FLAGS["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE"; - FLAGS[FLAGS["CONNECTION_CLOSE"] = 2] = "CONNECTION_CLOSE"; - FLAGS[FLAGS["CONNECTION_UPGRADE"] = 4] = "CONNECTION_UPGRADE"; - FLAGS[FLAGS["CHUNKED"] = 8] = "CHUNKED"; - FLAGS[FLAGS["UPGRADE"] = 16] = "UPGRADE"; - FLAGS[FLAGS["CONTENT_LENGTH"] = 32] = "CONTENT_LENGTH"; - FLAGS[FLAGS["SKIPBODY"] = 64] = "SKIPBODY"; - FLAGS[FLAGS["TRAILING"] = 128] = "TRAILING"; - // 1 << 8 is unused - FLAGS[FLAGS["TRANSFER_ENCODING"] = 512] = "TRANSFER_ENCODING"; -})(FLAGS = exports.FLAGS || (exports.FLAGS = {})); -var LENIENT_FLAGS; -(function (LENIENT_FLAGS) { - LENIENT_FLAGS[LENIENT_FLAGS["HEADERS"] = 1] = "HEADERS"; - LENIENT_FLAGS[LENIENT_FLAGS["CHUNKED_LENGTH"] = 2] = "CHUNKED_LENGTH"; - LENIENT_FLAGS[LENIENT_FLAGS["KEEP_ALIVE"] = 4] = "KEEP_ALIVE"; -})(LENIENT_FLAGS = exports.LENIENT_FLAGS || (exports.LENIENT_FLAGS = {})); -var METHODS; -(function (METHODS) { - METHODS[METHODS["DELETE"] = 0] = "DELETE"; - METHODS[METHODS["GET"] = 1] = "GET"; - METHODS[METHODS["HEAD"] = 2] = "HEAD"; - METHODS[METHODS["POST"] = 3] = "POST"; - METHODS[METHODS["PUT"] = 4] = "PUT"; - /* pathological */ - METHODS[METHODS["CONNECT"] = 5] = "CONNECT"; - METHODS[METHODS["OPTIONS"] = 6] = "OPTIONS"; - METHODS[METHODS["TRACE"] = 7] = "TRACE"; - /* WebDAV */ - METHODS[METHODS["COPY"] = 8] = "COPY"; - METHODS[METHODS["LOCK"] = 9] = "LOCK"; - METHODS[METHODS["MKCOL"] = 10] = "MKCOL"; - METHODS[METHODS["MOVE"] = 11] = "MOVE"; - METHODS[METHODS["PROPFIND"] = 12] = "PROPFIND"; - METHODS[METHODS["PROPPATCH"] = 13] = "PROPPATCH"; - METHODS[METHODS["SEARCH"] = 14] = "SEARCH"; - METHODS[METHODS["UNLOCK"] = 15] = "UNLOCK"; - METHODS[METHODS["BIND"] = 16] = "BIND"; - METHODS[METHODS["REBIND"] = 17] = "REBIND"; - METHODS[METHODS["UNBIND"] = 18] = "UNBIND"; - METHODS[METHODS["ACL"] = 19] = "ACL"; - /* subversion */ - METHODS[METHODS["REPORT"] = 20] = "REPORT"; - METHODS[METHODS["MKACTIVITY"] = 21] = "MKACTIVITY"; - METHODS[METHODS["CHECKOUT"] = 22] = "CHECKOUT"; - METHODS[METHODS["MERGE"] = 23] = "MERGE"; - /* upnp */ - METHODS[METHODS["M-SEARCH"] = 24] = "M-SEARCH"; - METHODS[METHODS["NOTIFY"] = 25] = "NOTIFY"; - METHODS[METHODS["SUBSCRIBE"] = 26] = "SUBSCRIBE"; - METHODS[METHODS["UNSUBSCRIBE"] = 27] = "UNSUBSCRIBE"; - /* RFC-5789 */ - METHODS[METHODS["PATCH"] = 28] = "PATCH"; - METHODS[METHODS["PURGE"] = 29] = "PURGE"; - /* CalDAV */ - METHODS[METHODS["MKCALENDAR"] = 30] = "MKCALENDAR"; - /* RFC-2068, section 19.6.1.2 */ - METHODS[METHODS["LINK"] = 31] = "LINK"; - METHODS[METHODS["UNLINK"] = 32] = "UNLINK"; - /* icecast */ - METHODS[METHODS["SOURCE"] = 33] = "SOURCE"; - /* RFC-7540, section 11.6 */ - METHODS[METHODS["PRI"] = 34] = "PRI"; - /* RFC-2326 RTSP */ - METHODS[METHODS["DESCRIBE"] = 35] = "DESCRIBE"; - METHODS[METHODS["ANNOUNCE"] = 36] = "ANNOUNCE"; - METHODS[METHODS["SETUP"] = 37] = "SETUP"; - METHODS[METHODS["PLAY"] = 38] = "PLAY"; - METHODS[METHODS["PAUSE"] = 39] = "PAUSE"; - METHODS[METHODS["TEARDOWN"] = 40] = "TEARDOWN"; - METHODS[METHODS["GET_PARAMETER"] = 41] = "GET_PARAMETER"; - METHODS[METHODS["SET_PARAMETER"] = 42] = "SET_PARAMETER"; - METHODS[METHODS["REDIRECT"] = 43] = "REDIRECT"; - METHODS[METHODS["RECORD"] = 44] = "RECORD"; - /* RAOP */ - METHODS[METHODS["FLUSH"] = 45] = "FLUSH"; -})(METHODS = exports.METHODS || (exports.METHODS = {})); -exports.METHODS_HTTP = [ - METHODS.DELETE, - METHODS.GET, - METHODS.HEAD, - METHODS.POST, - METHODS.PUT, - METHODS.CONNECT, - METHODS.OPTIONS, - METHODS.TRACE, - METHODS.COPY, - METHODS.LOCK, - METHODS.MKCOL, - METHODS.MOVE, - METHODS.PROPFIND, - METHODS.PROPPATCH, - METHODS.SEARCH, - METHODS.UNLOCK, - METHODS.BIND, - METHODS.REBIND, - METHODS.UNBIND, - METHODS.ACL, - METHODS.REPORT, - METHODS.MKACTIVITY, - METHODS.CHECKOUT, - METHODS.MERGE, - METHODS['M-SEARCH'], - METHODS.NOTIFY, - METHODS.SUBSCRIBE, - METHODS.UNSUBSCRIBE, - METHODS.PATCH, - METHODS.PURGE, - METHODS.MKCALENDAR, - METHODS.LINK, - METHODS.UNLINK, - METHODS.PRI, - // TODO(indutny): should we allow it with HTTP? - METHODS.SOURCE, -]; -exports.METHODS_ICE = [ - METHODS.SOURCE, -]; -exports.METHODS_RTSP = [ - METHODS.OPTIONS, - METHODS.DESCRIBE, - METHODS.ANNOUNCE, - METHODS.SETUP, - METHODS.PLAY, - METHODS.PAUSE, - METHODS.TEARDOWN, - METHODS.GET_PARAMETER, - METHODS.SET_PARAMETER, - METHODS.REDIRECT, - METHODS.RECORD, - METHODS.FLUSH, - // For AirPlay - METHODS.GET, - METHODS.POST, -]; -exports.METHOD_MAP = utils_1.enumToMap(METHODS); -exports.H_METHOD_MAP = {}; -Object.keys(exports.METHOD_MAP).forEach((key) => { - if (/^H/.test(key)) { - exports.H_METHOD_MAP[key] = exports.METHOD_MAP[key]; - } -}); -var FINISH; -(function (FINISH) { - FINISH[FINISH["SAFE"] = 0] = "SAFE"; - FINISH[FINISH["SAFE_WITH_CB"] = 1] = "SAFE_WITH_CB"; - FINISH[FINISH["UNSAFE"] = 2] = "UNSAFE"; -})(FINISH = exports.FINISH || (exports.FINISH = {})); -exports.ALPHA = []; -for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) { - // Upper case - exports.ALPHA.push(String.fromCharCode(i)); - // Lower case - exports.ALPHA.push(String.fromCharCode(i + 0x20)); -} -exports.NUM_MAP = { - 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, - 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, -}; -exports.HEX_MAP = { - 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, - 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, - A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF, - a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf, -}; -exports.NUM = [ - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', -]; -exports.ALPHANUM = exports.ALPHA.concat(exports.NUM); -exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')']; -exports.USERINFO_CHARS = exports.ALPHANUM - .concat(exports.MARK) - .concat(['%', ';', ':', '&', '=', '+', '$', ',']); -// TODO(indutny): use RFC -exports.STRICT_URL_CHAR = [ - '!', '"', '$', '%', '&', '\'', - '(', ')', '*', '+', ',', '-', '.', '/', - ':', ';', '<', '=', '>', - '@', '[', '\\', ']', '^', '_', - '`', - '{', '|', '}', '~', -].concat(exports.ALPHANUM); -exports.URL_CHAR = exports.STRICT_URL_CHAR - .concat(['\t', '\f']); -// All characters with 0x80 bit set to 1 -for (let i = 0x80; i <= 0xff; i++) { - exports.URL_CHAR.push(i); -} -exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']); -/* Tokens as defined by rfc 2616. Also lowercases them. - * token = 1* - * separators = "(" | ")" | "<" | ">" | "@" - * | "," | ";" | ":" | "\" | <"> - * | "/" | "[" | "]" | "?" | "=" - * | "{" | "}" | SP | HT - */ -exports.STRICT_TOKEN = [ - '!', '#', '$', '%', '&', '\'', - '*', '+', '-', '.', - '^', '_', '`', - '|', '~', -].concat(exports.ALPHANUM); -exports.TOKEN = exports.STRICT_TOKEN.concat([' ']); -/* - * Verify that a char is a valid visible (printable) US-ASCII - * character or %x80-FF - */ -exports.HEADER_CHARS = ['\t']; -for (let i = 32; i <= 255; i++) { - if (i !== 127) { - exports.HEADER_CHARS.push(i); - } -} -// ',' = \x44 -exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44); -exports.MAJOR = exports.NUM_MAP; -exports.MINOR = exports.MAJOR; -var HEADER_STATE; -(function (HEADER_STATE) { - HEADER_STATE[HEADER_STATE["GENERAL"] = 0] = "GENERAL"; - HEADER_STATE[HEADER_STATE["CONNECTION"] = 1] = "CONNECTION"; - HEADER_STATE[HEADER_STATE["CONTENT_LENGTH"] = 2] = "CONTENT_LENGTH"; - HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING"] = 3] = "TRANSFER_ENCODING"; - HEADER_STATE[HEADER_STATE["UPGRADE"] = 4] = "UPGRADE"; - HEADER_STATE[HEADER_STATE["CONNECTION_KEEP_ALIVE"] = 5] = "CONNECTION_KEEP_ALIVE"; - HEADER_STATE[HEADER_STATE["CONNECTION_CLOSE"] = 6] = "CONNECTION_CLOSE"; - HEADER_STATE[HEADER_STATE["CONNECTION_UPGRADE"] = 7] = "CONNECTION_UPGRADE"; - HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING_CHUNKED"] = 8] = "TRANSFER_ENCODING_CHUNKED"; -})(HEADER_STATE = exports.HEADER_STATE || (exports.HEADER_STATE = {})); -exports.SPECIAL_HEADERS = { - 'connection': HEADER_STATE.CONNECTION, - 'content-length': HEADER_STATE.CONTENT_LENGTH, - 'proxy-connection': HEADER_STATE.CONNECTION, - 'transfer-encoding': HEADER_STATE.TRANSFER_ENCODING, - 'upgrade': HEADER_STATE.UPGRADE, -}; -//# sourceMappingURL=constants.js.map + // 4. Incrementally read request’s body given processBodyChunk, processEndOfBody, + // processBodyError, and fetchParams’s task destination. + requestBody = (async function * () { + try { + for await (const bytes of request.body.stream) { + yield * processBodyChunk(bytes) + } + processEndOfBody() + } catch (err) { + processBodyError(err) + } + })() + } -/***/ }), + try { + // socket is only provided for websockets + const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody }) -/***/ 61145: -/***/ ((module) => { + if (socket) { + response = makeResponse({ status, statusText, headersList, socket }) + } else { + const iterator = body[Symbol.asyncIterator]() + fetchParams.controller.next = () => iterator.next() -module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn9/AGAGf39/f39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQACA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAA0ZFAwMEAAAFAAAAAAAABQEFAAUFBQAABgAAAAAGBgYGAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAAABAQcAAAUFAwABBAUBcAESEgUDAQACBggBfwFBgNQECwfRBSIGbWVtb3J5AgALX2luaXRpYWxpemUACRlfX2luZGlyZWN0X2Z1bmN0aW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Rg0AIAAvATJB//8DcSIAQZx/akHkAEkNACAAQcwBRg0AIABBsAJGDQAgAkHAAHENAEEAIQEgAkGIBHFBgARGDQAgAkEocUEARyEBCyABC1kAIABBGGpCADcDACAAQgA3AwAgAEE4akIANwMAIABBMGpCADcDACAAQShqQgA3AwAgAEEgakIANwMAIABBEGpCADcDACAAQQhqQgA3AwAgAEHdATYCHEEAC3sBAX8CQCAAKAIMIgMNAAJAIAAoAgRFDQAgACABNgIECwJAIAAgASACEMSAgIAAIgMNACAAKAIMDwsgACADNgIcQQAhAyAAKAIEIgFFDQAgACABIAIgACgCCBGBgICAAAAiAUUNACAAIAI2AhQgACABNgIMIAEhAwsgAwvk8wEDDn8DfgR/I4CAgIAAQRBrIgMkgICAgAAgASEEIAEhBSABIQYgASEHIAEhCCABIQkgASEKIAEhCyABIQwgASENIAEhDiABIQ8CQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgACgCHCIQQX9qDt0B2gEB2QECAwQFBgcICQoLDA0O2AEPENcBERLWARMUFRYXG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BIRAMIwtBogEhEAwiC0GjASEQDCELQaQBIRAMIAtBpQEhEAwfC0GmASEQDB4LQacBIRAMHQtBqAEhEAwcC0GpASEQDBsLQaoBIRAMGgtBqwEhEAwZC0GsASEQDBgLQa0BIRAMFwtBrgEhEAwWC0EBIRAMFQtBrwEhEAwUC0GwASEQDBMLQbEBIRAMEgtBswEhEAwRC0GyASEQDBALQbQBIRAMDwtBtQEhEAwOC0G2ASEQDA0LQbcBIRAMDAtBuAEhEAwLC0G5ASEQDAoLQboBIRAMCQtBuwEhEAwIC0HGASEQDAcLQbwBIRAMBgtBvQEhEAwFC0G+ASEQDAQLQb8BIRAMAwtBwAEhEAwCC0HCASEQDAELQcEBIRALA0ACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQ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gACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMSQsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAytAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMTQsgAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAysAQsgAEEANgIcIAAgATYCFCAAQdyIgIAANgIQIABBBzYCDEEAIRAMqwELIBBBP0cNASABQQFqIQELQQUhEAyQAQtBACEQIABBADYCHCAAIAE2AhQgAEH9koCAADYCECAAQQc2AgwMqAELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMpwELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMpgELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEYLIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMpQELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDD8LIABB0gA2AhwgACAUNgIUIAAgATYCDEEAIRAMpAELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDD8LIABB0wA2AhwgACAUNgIUIAAgATYCDEEAIRAMowELIAAoAgQhASAAQQA2AgQCQCAAIAEgFBCngICAACIBDQAgFCEBDEMLIABB5QA2AhwgACAUNgIUIAAgATYCDEEAIRAMogELIABBADYCHCAAIBQ2AhQgAEHDj4CAADYCECAAQQc2AgxBACEQDKEBCyAAQQA2AhwgACABNgIUIABBw4+AgAA2AhAgAEEHNgIMQQAhEAygAQtBACEQIABBADYCHCAAIBQ2AhQgAEGMnICAADYCECAAQQc2AgwMnwELIABBADYCHCAAIBQ2AhQgAEGMnICAADYCECAAQQc2AgxBACEQDJ4BCyAAQQA2AhwgACAUNgIUIABB/pGAgAA2AhAgAEEHNgIMQQAhEAydAQs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NUQVRDSEdFT1JESVJFQ1RPUlRSQ0hQQVJBTUVURVJVUkNFQlNDUklCRUFSRE9XTkFDRUlORE5LQ0tVQlNDUklCRUhUVFAvQURUUC8=' + response = makeResponse({ status, statusText, headersList }) + } + } catch (err) { + // 10. If aborted, then: + if (err.name === 'AbortError') { + // 1. If connection uses HTTP/2, then transmit an RST_STREAM frame. + fetchParams.controller.connection.destroy() + // 2. Return the appropriate network error for fetchParams. + return makeAppropriateNetworkError(fetchParams, err) + } -/***/ }), + return makeNetworkError(err) + } -/***/ 95627: -/***/ ((module) => { + // 11. Let pullAlgorithm be an action that resumes the ongoing fetch + // if it is suspended. + const pullAlgorithm = () => { + fetchParams.controller.resume() + } -module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn9/AGAGf39/f39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQACA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAA0ZFAwMEAAAFAAAAAAAABQEFAAUFBQAABgAAAAAGBgYGAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAAABAQcAAAUFAwABBAUBcAESEgUDAQACBggBfwFBgNQECwfRBSIGbWVtb3J5AgALX2luaXRpYWxpemUACRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALbGxodHRwX2luaXQAChhsbGh0dHBfc2hvdWxkX2tlZXBfYWxpdmUAQQxsbGh0dHBfYWxsb2MADAZtYWxsb2MARgtsbGh0dHBfZnJlZQANBGZyZWUASA9sbGh0dHBfZ2V0X3R5cGUADhVsbGh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BMGogAf0LAwAgAEEgaiAB/QsDACAAQd0BNgIcQQALewEBfwJAIAAoAgwiAw0AAkAgACgCBEUNACAAIAE2AgQLAkAgACABIAIQxICAgAAiAw0AIAAoAgwPCyAAIAM2AhxBACEDIAAoAgQiAUUNACAAIAEgAiAAKAIIEYGAgIAAACIBRQ0AIAAgAjYCFCAAIAE2AgwgASEDCyADC+TzAQMOfwN+BH8jgICAgABBEGsiAySAgICAACABIQQgASEFIAEhBiABIQcgASEIIAEhCSABIQogASELIAEhDCABIQ0gASEOIAEhDwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAAKAIcIhBBf2oO3QHaAQHZAQIDBAUGBwgJCgsMDQ7YAQ8Q1wEREtYBExQVFhcYGRob4AHfARwdHtUBHyAhIiMkJdQBJicoKSorLNMB0gEtLtEB0AEvMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUbbAUdISUrPAc4BS80BTMwBTU5PUFFSU1RVVldYWVpbXF1eX2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h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EAwSC0GzASEQDBELQbIBIRAMEAtBtAEhEAwPC0G1ASEQDA4LQbYBIRAMDQtBtwEhEAwMC0G4ASEQDAsLQbkBIRAMCgtBugEhEAwJC0G7ASEQDAgLQcYBIRAMBwtBvAEhEAwGC0G9ASEQDAULQb4BIRAMBAtBvwEhEAwDC0HAASEQDAILQcIBIRAMAQtBwQEhEAsDQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQ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AIAEiASACEMCAgIAAQQFHDeYBIABCADcDIAznAQsgACABIgEgAhC0gICAACIQDecBIAEhAQz1AgsCQCABIgEgAkcNAEEGIRAM8AMLIAAgAUEBaiIBIAIQu4CAgAAiEA3oASABIQEMMQsgAEIANwMgQRIhEAzVAwsgASIQIAJHDStBHSEQDO0DCwJAIAEiASACRg0AIAFBAWohAUEQIRAM1AMLQQchEAzsAwsgAEIAIAApAyAiESACIAEiEGutIhJ9IhMgEyARVhs3AyAgESASViIURQ3lAUEIIRAM6wMLAkAgASIBIAJGDQAgAEGJgICAADYCCCAAIAE2AgQgASEBQRQhEAzSAwtBCSEQDOoDCyABIQEgACkDIFAN5AEgASEBDPICCwJAIAEiASACRw0AQQshEAzpAwsgACABQQFqIgEgAhC2gICAACIQDeUBIAEhAQzyAgsgACABIgEgAhC4gICAACIQDeUBIAEhAQzyAgsgACABIgEgAhC4gICAACIQDeYBIAEhAQwNCyAAIAEiASACELqAgIAAIhAN5wEgASEBDPACCwJAIAEiASACRw0AQQ8hEAzlAwsgAS0AACIQQTtGDQggEEENRw3oASABQQFqIQEM7wILIAAgASIBIAIQuoCAgAAiEA3oASABIQEM8gILA0ACQCABLQAAQfC1gIAAai0AACIQQQFGDQAgEEECRw3rASAAKAIEIRAgAEEANgIEIAAgECABQQFqIgEQuYCAgAAiEA3qASABIQEM9AILIAFBAWoiASACRw0AC0ESIRAM4gMLIAAgASIBIAIQuoCAgAAiEA3pASABIQEMCgsgASIBIAJHDQZBGyEQDOADCwJAIAEiASACRw0AQRYhEAzgAwsgAEGKgICAADYCCCAAIAE2AgQgACABIAIQuICAgAAiEA3qASABIQFBICEQDMYDCwJAIAEiASACRg0AA0ACQCABLQAAQfC3gIAAai0AACIQQQJGDQACQCAQQX9qDgTlAewBAOsB7AELIAFBAWohAUEIIRAMyAMLIAFBAWoiASACRw0AC0EVIRAM3wMLQRUhEAzeAwsDQAJAIAEtAABB8LmAgABqLQAAIhBBAkYNACAQQX9qDgTeAewB4AHrAewBC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AIRAgAEEANgIcIAAgATYCFCAAQZCzgIAANgIQIABBCDYCDAy3AQsgAEEANgIAIBdBAWohAQJAIAAtAClBIUcNACABIQEMVgsgAEEANgIcIAAgATYCFCAAQZuKgIAANgIQIABBCDYCDEEAIRAMtgELIABBADYCACAXQQFqIQECQCAALQApIhBBXWpBC08NACABIQEMVQsCQCAQQQZLDQBBASAQdEHKAHFFDQAgASEBDFULQQAhECAAQQA2AhwgACABNgIUIABB94mAgAA2AhAgAEEINgIMDLUBCyAQQRVGDXEgAEEANgIcIAAgATYCFCAAQbmNgIAANgIQIABBGjYCDEEAIRAMtAELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDFQLIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMswELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDE0LIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMsgELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDE0LIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMsQELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDFELIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMsAELIABBADYCHCAAIAE2AhQgAEHGioCAADYCECAAQQc2AgxBACEQDK8BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdIANgIcIAAgATYCFCAAIBA2AgxBACEQDK4BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdMANgIcIAAgATYCFCAAIBA2AgxBACEQDK0BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDKwBCyAAQQA2AhwgACABNgIUIABB3IiAgAA2AhAgAEEHNgIMQQAhEAyrAQsgEEE/Rw0BIAFBAWohAQtBBSEQDJABC0EAIRAgAEEANgIcIAAgATYCFCAAQf2SgIAANgIQIABBBzYCDAyoAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHSADYCHCAAIAE2AhQgACAQNgIMQQAhEAynAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAymAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMRgsgAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAylAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMPwsgAEHSADYCHCAAIBQ2AhQgACABNgIMQQAhEAykAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMPwsgAEHTADYCHCAAIBQ2AhQgACABNgIMQQAhEAyjAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMQwsgAEHlADYCHCAAIBQ2AhQgACABNgIMQQAhEAyiAQsgAEEANgIcIAAgFDYCFCAAQcOPgIAANgIQIABBBzYCDEEAIRAMoQELIABBADYCHCAAIAE2AhQgAEHDj4CAADYCECAAQQc2AgxBACEQDKABC0EAIRAgAEEANgIcIAAgFDYCFCAAQYycgIAANgIQIABBBzYCDAyfAQsgAEEANgIcIAAgFDYCFCAAQYycgIAANgIQIABBBzYCDEEAIRAMngELIABBADYCHCAAIBQ2AhQgAEH+kYCAADYCECAAQQc2AgxBACEQDJ0BCyAAQQA2AhwgACABNgIUIABBjpuAgAA2AhAgAEEGNgIMQQAhEAycAQsgEEEVRg1XIABBADYCHCAAIAE2AhQgAEHMjoCAADYCECAAQSA2AgxBACEQDJsBCyAAQQA2AgAgEEEBaiEBQSQhEAsgACAQOgApIAAoAgQhECAAQQA2AgQgACAQIAEQq4CAgAAiEA1UIAEhAQw+CyAAQQA2AgALQQAhECAAQQA2AhwgACAENgIUIABB8ZuAgAA2A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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAgAAAAACAAAAAAAAAAAAAAAAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5PVU5DRUVDS09VVE5FQ1RFVEVDUklCRUxVU0hFVEVBRFNFQVJDSFJHRUNUSVZJVFlMRU5EQVJWRU9USUZZUFRJT05TQ0hTRUFZU1RBVENIR0VPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFSFRUUC9BRFRQLw==' + // 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s + // controller with reason, given reason. + const cancelAlgorithm = (reason) => { + fetchParams.controller.abort(reason) + } + // 13. Let highWaterMark be a non-negative, non-NaN number, chosen by + // the user agent. + // TODO -/***/ }), + // 14. Let sizeAlgorithm be an algorithm that accepts a chunk object + // and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent. + // TODO -/***/ 41891: -/***/ ((__unused_webpack_module, exports) => { + // 15. Let stream be a new ReadableStream. + // 16. Set up stream with pullAlgorithm set to pullAlgorithm, + // cancelAlgorithm set to cancelAlgorithm, highWaterMark set to + // highWaterMark, and sizeAlgorithm set to sizeAlgorithm. + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(35356).ReadableStream) + } -"use strict"; + const stream = new ReadableStream( + { + async start (controller) { + fetchParams.controller.controller = controller + }, + async pull (controller) { + await pullAlgorithm(controller) + }, + async cancel (reason) { + await cancelAlgorithm(reason) + } + }, + { + highWaterMark: 0, + size () { + return 1 + } + } + ) -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.enumToMap = void 0; -function enumToMap(obj) { - const res = {}; - Object.keys(obj).forEach((key) => { - const value = obj[key]; - if (typeof value === 'number') { - res[key] = value; - } - }); - return res; -} -exports.enumToMap = enumToMap; -//# sourceMappingURL=utils.js.map + // 17. Run these steps, but abort when the ongoing fetch is terminated: -/***/ }), + // 1. Set response’s body to a new body whose stream is stream. + response.body = { stream } -/***/ 66771: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. If response is not a network error and request’s cache mode is + // not "no-store", then update response in httpCache for request. + // TODO -"use strict"; + // 3. If includeCredentials is true and the user agent is not configured + // to block cookies for request (see section 7 of [COOKIES]), then run the + // "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on + // the value of each header whose name is a byte-case-insensitive match for + // `Set-Cookie` in response’s header list, if any, and request’s current URL. + // TODO + // 18. If aborted, then: + // TODO -const { kClients } = __nccwpck_require__(72785) -const Agent = __nccwpck_require__(7890) -const { - kAgent, - kMockAgentSet, - kMockAgentGet, - kDispatches, - kIsMockActive, - kNetConnect, - kGetNetConnect, - kOptions, - kFactory -} = __nccwpck_require__(24347) -const MockClient = __nccwpck_require__(58687) -const MockPool = __nccwpck_require__(26193) -const { matchValue, buildMockOptions } = __nccwpck_require__(79323) -const { InvalidArgumentError, UndiciError } = __nccwpck_require__(48045) -const Dispatcher = __nccwpck_require__(60412) -const Pluralizer = __nccwpck_require__(78891) -const PendingInterceptorsFormatter = __nccwpck_require__(86823) + // 19. Run these steps in parallel: -class FakeWeakRef { - constructor (value) { - this.value = value - } + // 1. Run these steps, but abort when fetchParams is canceled: + fetchParams.controller.on('terminated', onAborted) + fetchParams.controller.resume = async () => { + // 1. While true + while (true) { + // 1-3. See onData... - deref () { - return this.value - } -} + // 4. Set bytes to the result of handling content codings given + // codings and bytes. + let bytes + let isFailure + try { + const { done, value } = await fetchParams.controller.next() -class MockAgent extends Dispatcher { - constructor (opts) { - super(opts) + if (isAborted(fetchParams)) { + break + } - this[kNetConnect] = true - this[kIsMockActive] = true + bytes = done ? undefined : value + } catch (err) { + if (fetchParams.controller.ended && !timingInfo.encodedBodySize) { + // zlib doesn't like empty streams. + bytes = undefined + } else { + bytes = err - // Instantiate Agent and encapsulate - if ((opts && opts.agent && typeof opts.agent.dispatch !== 'function')) { - throw new InvalidArgumentError('Argument opts.agent must implement Agent') - } - const agent = opts && opts.agent ? opts.agent : new Agent(opts) - this[kAgent] = agent + // err may be propagated from the result of calling readablestream.cancel, + // which might not be an error. https://github.com/nodejs/undici/issues/2009 + isFailure = true + } + } - this[kClients] = agent[kClients] - this[kOptions] = buildMockOptions(opts) - } + if (bytes === undefined) { + // 2. Otherwise, if the bytes transmission for response’s message + // body is done normally and stream is readable, then close + // stream, finalize response for fetchParams and response, and + // abort these in-parallel steps. + readableStreamClose(fetchParams.controller.controller) - get (origin) { - let dispatcher = this[kMockAgentGet](origin) + finalizeResponse(fetchParams, response) - if (!dispatcher) { - dispatcher = this[kFactory](origin) - this[kMockAgentSet](origin, dispatcher) - } - return dispatcher - } + return + } - dispatch (opts, handler) { - // Call MockAgent.get to perform additional setup before dispatching as normal - this.get(opts.origin) - return this[kAgent].dispatch(opts, handler) - } + // 5. Increase timingInfo’s decoded body size by bytes’s length. + timingInfo.decodedBodySize += bytes?.byteLength ?? 0 - async close () { - await this[kAgent].close() - this[kClients].clear() - } + // 6. If bytes is failure, then terminate fetchParams’s controller. + if (isFailure) { + fetchParams.controller.terminate(bytes) + return + } - deactivate () { - this[kIsMockActive] = false - } + // 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes + // into stream. + fetchParams.controller.controller.enqueue(new Uint8Array(bytes)) - activate () { - this[kIsMockActive] = true + // 8. If stream is errored, then terminate the ongoing fetch. + if (isErrored(stream)) { + fetchParams.controller.terminate() + return + } + + // 9. If stream doesn’t need more data ask the user agent to suspend + // the ongoing fetch. + if (!fetchParams.controller.controller.desiredSize) { + return + } + } } - enableNetConnect (matcher) { - if (typeof matcher === 'string' || typeof matcher === 'function' || matcher instanceof RegExp) { - if (Array.isArray(this[kNetConnect])) { - this[kNetConnect].push(matcher) - } else { - this[kNetConnect] = [matcher] + // 2. If aborted, then: + function onAborted (reason) { + // 2. If fetchParams is aborted, then: + if (isAborted(fetchParams)) { + // 1. Set response’s aborted flag. + response.aborted = true + + // 2. If stream is readable, then error stream with the result of + // deserialize a serialized abort reason given fetchParams’s + // controller’s serialized abort reason and an + // implementation-defined realm. + if (isReadable(stream)) { + fetchParams.controller.controller.error( + fetchParams.controller.serializedAbortReason + ) } - } else if (typeof matcher === 'undefined') { - this[kNetConnect] = true } else { - throw new InvalidArgumentError('Unsupported matcher. Must be one of String|Function|RegExp.') + // 3. Otherwise, if stream is readable, error stream with a TypeError. + if (isReadable(stream)) { + fetchParams.controller.controller.error(new TypeError('terminated', { + cause: isErrorLike(reason) ? reason : undefined + })) + } } - } - disableNetConnect () { - this[kNetConnect] = false + // 4. If connection uses HTTP/2, then transmit an RST_STREAM frame. + // 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so. + fetchParams.controller.connection.destroy() } - // This is required to bypass issues caused by using global symbols - see: - // https://github.com/nodejs/undici/issues/1447 - get isMockActive () { - return this[kIsMockActive] - } + // 20. Return response. + return response - [kMockAgentSet] (origin, dispatcher) { - this[kClients].set(origin, new FakeWeakRef(dispatcher)) - } + async function dispatch ({ body }) { + const url = requestCurrentURL(request) + /** @type {import('../..').Agent} */ + const agent = fetchParams.controller.dispatcher - [kFactory] (origin) { - const mockOptions = Object.assign({ agent: this }, this[kOptions]) - return this[kOptions] && this[kOptions].connections === 1 - ? new MockClient(origin, mockOptions) - : new MockPool(origin, mockOptions) - } + return new Promise((resolve, reject) => agent.dispatch( + { + path: url.pathname + url.search, + origin: url.origin, + method: request.method, + body: fetchParams.controller.dispatcher.isMockActive ? request.body && (request.body.source || request.body.stream) : body, + headers: request.headersList.entries, + maxRedirections: 0, + upgrade: request.mode === 'websocket' ? 'websocket' : undefined + }, + { + body: null, + abort: null, - [kMockAgentGet] (origin) { - // First check if we can immediately find it - const ref = this[kClients].get(origin) - if (ref) { - return ref.deref() - } + onConnect (abort) { + // TODO (fix): Do we need connection here? + const { connection } = fetchParams.controller - // If the origin is not a string create a dummy parent pool and return to user - if (typeof origin !== 'string') { - const dispatcher = this[kFactory]('http://localhost:9999') - this[kMockAgentSet](origin, dispatcher) - return dispatcher - } + if (connection.destroyed) { + abort(new DOMException('The operation was aborted.', 'AbortError')) + } else { + fetchParams.controller.on('terminated', abort) + this.abort = connection.abort = abort + } + }, - // If we match, create a pool and assign the same dispatches - for (const [keyMatcher, nonExplicitRef] of Array.from(this[kClients])) { - const nonExplicitDispatcher = nonExplicitRef.deref() - if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) { - const dispatcher = this[kFactory](origin) - this[kMockAgentSet](origin, dispatcher) - dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches] - return dispatcher - } - } - } + onHeaders (status, headersList, resume, statusText) { + if (status < 200) { + return + } - [kGetNetConnect] () { - return this[kNetConnect] - } + let codings = [] + let location = '' - pendingInterceptors () { - const mockAgentClients = this[kClients] + const headers = new Headers() - return Array.from(mockAgentClients.entries()) - .flatMap(([origin, scope]) => scope.deref()[kDispatches].map(dispatch => ({ ...dispatch, origin }))) - .filter(({ pending }) => pending) - } + // For H2, the headers are a plain JS object + // We distinguish between them and iterate accordingly + if (Array.isArray(headersList)) { + for (let n = 0; n < headersList.length; n += 2) { + const key = headersList[n + 0].toString('latin1') + const val = headersList[n + 1].toString('latin1') + if (key.toLowerCase() === 'content-encoding') { + // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1 + // "All content-coding values are case-insensitive..." + codings = val.toLowerCase().split(',').map((x) => x.trim()) + } else if (key.toLowerCase() === 'location') { + location = val + } - assertNoPendingInterceptors ({ pendingInterceptorsFormatter = new PendingInterceptorsFormatter() } = {}) { - const pending = this.pendingInterceptors() + headers[kHeadersList].append(key, val) + } + } else { + const keys = Object.keys(headersList) + for (const key of keys) { + const val = headersList[key] + if (key.toLowerCase() === 'content-encoding') { + // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1 + // "All content-coding values are case-insensitive..." + codings = val.toLowerCase().split(',').map((x) => x.trim()).reverse() + } else if (key.toLowerCase() === 'location') { + location = val + } - if (pending.length === 0) { - return - } + headers[kHeadersList].append(key, val) + } + } - const pluralizer = new Pluralizer('interceptor', 'interceptors').pluralize(pending.length) + this.body = new Readable({ read: resume }) - throw new UndiciError(` -${pluralizer.count} ${pluralizer.noun} ${pluralizer.is} pending: + const decoders = [] -${pendingInterceptorsFormatter.format(pending)} -`.trim()) - } -} + const willFollow = request.redirect === 'follow' && + location && + redirectStatusSet.has(status) -module.exports = MockAgent + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding + if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) { + for (const coding of codings) { + // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2 + if (coding === 'x-gzip' || coding === 'gzip') { + decoders.push(zlib.createGunzip({ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + flush: zlib.constants.Z_SYNC_FLUSH, + finishFlush: zlib.constants.Z_SYNC_FLUSH + })) + } else if (coding === 'deflate') { + decoders.push(zlib.createInflate()) + } else if (coding === 'br') { + decoders.push(zlib.createBrotliDecompress()) + } else { + decoders.length = 0 + break + } + } + } + resolve({ + status, + statusText, + headersList: headers[kHeadersList], + body: decoders.length + ? pipeline(this.body, ...decoders, () => { }) + : this.body.on('error', () => {}) + }) -/***/ }), + return true + }, -/***/ 58687: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + onData (chunk) { + if (fetchParams.controller.dump) { + return + } -"use strict"; + // 1. If one or more bytes have been transmitted from response’s + // message body, then: + // 1. Let bytes be the transmitted bytes. + const bytes = chunk -const { promisify } = __nccwpck_require__(73837) -const Client = __nccwpck_require__(33598) -const { buildMockDispatch } = __nccwpck_require__(79323) -const { - kDispatches, - kMockAgent, - kClose, - kOriginalClose, - kOrigin, - kOriginalDispatch, - kConnected -} = __nccwpck_require__(24347) -const { MockInterceptor } = __nccwpck_require__(90410) -const Symbols = __nccwpck_require__(72785) -const { InvalidArgumentError } = __nccwpck_require__(48045) + // 2. Let codings be the result of extracting header list values + // given `Content-Encoding` and response’s header list. + // See pullAlgorithm. -/** - * MockClient provides an API that extends the Client to influence the mockDispatches. - */ -class MockClient extends Client { - constructor (origin, opts) { - super(origin, opts) + // 3. Increase timingInfo’s encoded body size by bytes’s length. + timingInfo.encodedBodySize += bytes.byteLength - if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') { - throw new InvalidArgumentError('Argument opts.agent must implement Agent') - } + // 4. See pullAlgorithm... - this[kMockAgent] = opts.agent - this[kOrigin] = origin - this[kDispatches] = [] - this[kConnected] = 1 - this[kOriginalDispatch] = this.dispatch - this[kOriginalClose] = this.close.bind(this) + return this.body.push(bytes) + }, - this.dispatch = buildMockDispatch.call(this) - this.close = this[kClose] - } + onComplete () { + if (this.abort) { + fetchParams.controller.off('terminated', this.abort) + } - get [Symbols.kConnected] () { - return this[kConnected] - } + fetchParams.controller.ended = true - /** - * Sets up the base interceptor for mocking replies from undici. - */ - intercept (opts) { - return new MockInterceptor(opts, this[kDispatches]) - } + this.body.push(null) + }, - async [kClose] () { - await promisify(this[kOriginalClose])() - this[kConnected] = 0 - this[kMockAgent][Symbols.kClients].delete(this[kOrigin]) - } -} + onError (error) { + if (this.abort) { + fetchParams.controller.off('terminated', this.abort) + } -module.exports = MockClient + this.body?.destroy(error) + fetchParams.controller.terminate(error) -/***/ }), + reject(error) + }, -/***/ 50888: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + onUpgrade (status, headersList, socket) { + if (status !== 101) { + return + } -"use strict"; + const headers = new Headers() + for (let n = 0; n < headersList.length; n += 2) { + const key = headersList[n + 0].toString('latin1') + const val = headersList[n + 1].toString('latin1') -const { UndiciError } = __nccwpck_require__(48045) + headers[kHeadersList].append(key, val) + } -class MockNotMatchedError extends UndiciError { - constructor (message) { - super(message) - Error.captureStackTrace(this, MockNotMatchedError) - this.name = 'MockNotMatchedError' - this.message = message || 'The request does not match any registered mock dispatches' - this.code = 'UND_MOCK_ERR_MOCK_NOT_MATCHED' + resolve({ + status, + statusText: STATUS_CODES[status], + headersList: headers[kHeadersList], + socket + }) + + return true + } + } + )) } } module.exports = { - MockNotMatchedError + fetch, + Fetch, + fetching, + finalizeAndReportTiming } /***/ }), -/***/ 90410: +/***/ 48359: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +/* globals AbortController */ -const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(79323) -const { - kDispatches, - kDispatchKey, - kDefaultHeaders, - kDefaultTrailers, - kContentLength, - kMockDispatch -} = __nccwpck_require__(24347) -const { InvalidArgumentError } = __nccwpck_require__(48045) -const { buildURL } = __nccwpck_require__(83983) -/** - * Defines the scope API for an interceptor reply - */ -class MockScope { - constructor (mockDispatch) { - this[kMockDispatch] = mockDispatch - } +const { extractBody, mixinBody, cloneBody } = __nccwpck_require__(41472) +const { Headers, fill: fillHeaders, HeadersList } = __nccwpck_require__(10554) +const { FinalizationRegistry } = __nccwpck_require__(56436)() +const util = __nccwpck_require__(83983) +const { + isValidHTTPToken, + sameOrigin, + normalizeMethod, + makePolicyContainer, + normalizeMethodRecord +} = __nccwpck_require__(52538) +const { + forbiddenMethodsSet, + corsSafeListedMethodsSet, + referrerPolicy, + requestRedirect, + requestMode, + requestCredentials, + requestCache, + requestDuplex +} = __nccwpck_require__(41037) +const { kEnumerableProperty } = util +const { kHeaders, kSignal, kState, kGuard, kRealm } = __nccwpck_require__(15861) +const { webidl } = __nccwpck_require__(21744) +const { getGlobalOrigin } = __nccwpck_require__(71246) +const { URLSerializer } = __nccwpck_require__(685) +const { kHeadersList, kConstruct } = __nccwpck_require__(72785) +const assert = __nccwpck_require__(39491) +const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(82361) - /** - * Delay a reply by a set amount in ms. - */ - delay (waitInMs) { - if (typeof waitInMs !== 'number' || !Number.isInteger(waitInMs) || waitInMs <= 0) { - throw new InvalidArgumentError('waitInMs must be a valid integer > 0') - } +let TransformStream = globalThis.TransformStream - this[kMockDispatch].delay = waitInMs - return this - } +const kAbortController = Symbol('abortController') - /** - * For a defined reply, never mark as consumed. - */ - persist () { - this[kMockDispatch].persist = true - return this - } +const requestFinalizer = new FinalizationRegistry(({ signal, abort }) => { + signal.removeEventListener('abort', abort) +}) - /** - * Allow one to define a reply for a set amount of matching requests. - */ - times (repeatTimes) { - if (typeof repeatTimes !== 'number' || !Number.isInteger(repeatTimes) || repeatTimes <= 0) { - throw new InvalidArgumentError('repeatTimes must be a valid integer > 0') +// https://fetch.spec.whatwg.org/#request-class +class Request { + // https://fetch.spec.whatwg.org/#dom-request + constructor (input, init = {}) { + if (input === kConstruct) { + return } - this[kMockDispatch].times = repeatTimes - return this - } -} + webidl.argumentLengthCheck(arguments, 1, { header: 'Request constructor' }) -/** - * Defines an interceptor for a Mock - */ -class MockInterceptor { - constructor (opts, mockDispatches) { - if (typeof opts !== 'object') { - throw new InvalidArgumentError('opts must be an object') - } - if (typeof opts.path === 'undefined') { - throw new InvalidArgumentError('opts.path must be defined') - } - if (typeof opts.method === 'undefined') { - opts.method = 'GET' - } - // See https://github.com/nodejs/undici/issues/1245 - // As per RFC 3986, clients are not supposed to send URI - // fragments to servers when they retrieve a document, - if (typeof opts.path === 'string') { - if (opts.query) { - opts.path = buildURL(opts.path, opts.query) - } else { - // Matches https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L1811 - const parsedURL = new URL(opts.path, 'data://') - opts.path = parsedURL.pathname + parsedURL.search + input = webidl.converters.RequestInfo(input) + init = webidl.converters.RequestInit(init) + + // https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object + this[kRealm] = { + settingsObject: { + baseUrl: getGlobalOrigin(), + get origin () { + return this.baseUrl?.origin + }, + policyContainer: makePolicyContainer() } } - if (typeof opts.method === 'string') { - opts.method = opts.method.toUpperCase() - } - - this[kDispatchKey] = buildKey(opts) - this[kDispatches] = mockDispatches - this[kDefaultHeaders] = {} - this[kDefaultTrailers] = {} - this[kContentLength] = false - } - - createMockScopeDispatchData (statusCode, data, responseOptions = {}) { - const responseData = getResponseData(data) - const contentLength = this[kContentLength] ? { 'content-length': responseData.length } : {} - const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers } - const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers } - return { statusCode, data, headers, trailers } - } + // 1. Let request be null. + let request = null - validateReplyParameters (statusCode, data, responseOptions) { - if (typeof statusCode === 'undefined') { - throw new InvalidArgumentError('statusCode must be defined') - } - if (typeof data === 'undefined') { - throw new InvalidArgumentError('data must be defined') - } - if (typeof responseOptions !== 'object') { - throw new InvalidArgumentError('responseOptions must be an object') - } - } + // 2. Let fallbackMode be null. + let fallbackMode = null - /** - * Mock an undici request with a defined reply. - */ - reply (replyData) { - // Values of reply aren't available right now as they - // can only be available when the reply callback is invoked. - if (typeof replyData === 'function') { - // We'll first wrap the provided callback in another function, - // this function will properly resolve the data from the callback - // when invoked. - const wrappedDefaultsCallback = (opts) => { - // Our reply options callback contains the parameter for statusCode, data and options. - const resolvedData = replyData(opts) + // 3. Let baseURL be this’s relevant settings object’s API base URL. + const baseUrl = this[kRealm].settingsObject.baseUrl - // Check if it is in the right format - if (typeof resolvedData !== 'object') { - throw new InvalidArgumentError('reply options callback must return an object') - } + // 4. Let signal be null. + let signal = null - const { statusCode, data = '', responseOptions = {} } = resolvedData - this.validateReplyParameters(statusCode, data, responseOptions) - // Since the values can be obtained immediately we return them - // from this higher order function that will be resolved later. - return { - ...this.createMockScopeDispatchData(statusCode, data, responseOptions) - } + // 5. If input is a string, then: + if (typeof input === 'string') { + // 1. Let parsedURL be the result of parsing input with baseURL. + // 2. If parsedURL is failure, then throw a TypeError. + let parsedURL + try { + parsedURL = new URL(input, baseUrl) + } catch (err) { + throw new TypeError('Failed to parse URL from ' + input, { cause: err }) } - // Add usual dispatch data, but this time set the data parameter to function that will eventually provide data. - const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], wrappedDefaultsCallback) - return new MockScope(newMockDispatch) - } + // 3. If parsedURL includes credentials, then throw a TypeError. + if (parsedURL.username || parsedURL.password) { + throw new TypeError( + 'Request cannot be constructed from a URL that includes credentials: ' + + input + ) + } - // We can have either one or three parameters, if we get here, - // we should have 1-3 parameters. So we spread the arguments of - // this function to obtain the parameters, since replyData will always - // just be the statusCode. - const [statusCode, data = '', responseOptions = {}] = [...arguments] - this.validateReplyParameters(statusCode, data, responseOptions) + // 4. Set request to a new request whose URL is parsedURL. + request = makeRequest({ urlList: [parsedURL] }) - // Send in-already provided data like usual - const dispatchData = this.createMockScopeDispatchData(statusCode, data, responseOptions) - const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], dispatchData) - return new MockScope(newMockDispatch) - } + // 5. Set fallbackMode to "cors". + fallbackMode = 'cors' + } else { + // 6. Otherwise: - /** - * Mock an undici request with a defined error. - */ - replyWithError (error) { - if (typeof error === 'undefined') { - throw new InvalidArgumentError('error must be defined') - } + // 7. Assert: input is a Request object. + assert(input instanceof Request) - const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error }) - return new MockScope(newMockDispatch) - } + // 8. Set request to input’s request. + request = input[kState] - /** - * Set default reply headers on the interceptor for subsequent replies - */ - defaultReplyHeaders (headers) { - if (typeof headers === 'undefined') { - throw new InvalidArgumentError('headers must be defined') + // 9. Set signal to input’s signal. + signal = input[kSignal] } - this[kDefaultHeaders] = headers - return this - } + // 7. Let origin be this’s relevant settings object’s origin. + const origin = this[kRealm].settingsObject.origin - /** - * Set default reply trailers on the interceptor for subsequent replies - */ - defaultReplyTrailers (trailers) { - if (typeof trailers === 'undefined') { - throw new InvalidArgumentError('trailers must be defined') + // 8. Let window be "client". + let window = 'client' + + // 9. If request’s window is an environment settings object and its origin + // is same origin with origin, then set window to request’s window. + if ( + request.window?.constructor?.name === 'EnvironmentSettingsObject' && + sameOrigin(request.window, origin) + ) { + window = request.window } - this[kDefaultTrailers] = trailers - return this - } + // 10. If init["window"] exists and is non-null, then throw a TypeError. + if (init.window != null) { + throw new TypeError(`'window' option '${window}' must be null`) + } - /** - * Set reply content length header for replies on the interceptor - */ - replyContentLength () { - this[kContentLength] = true - return this - } -} + // 11. If init["window"] exists, then set window to "no-window". + if ('window' in init) { + window = 'no-window' + } -module.exports.MockInterceptor = MockInterceptor -module.exports.MockScope = MockScope + // 12. Set request to a new request with the following properties: + request = makeRequest({ + // URL request’s URL. + // undici implementation note: this is set as the first item in request's urlList in makeRequest + // method request’s method. + method: request.method, + // header list A copy of request’s header list. + // undici implementation note: headersList is cloned in makeRequest + headersList: request.headersList, + // unsafe-request flag Set. + unsafeRequest: request.unsafeRequest, + // client This’s relevant settings object. + client: this[kRealm].settingsObject, + // window window. + window, + // priority request’s priority. + priority: request.priority, + // origin request’s origin. The propagation of the origin is only significant for navigation requests + // being handled by a service worker. In this scenario a request can have an origin that is different + // from the current client. + origin: request.origin, + // referrer request’s referrer. + referrer: request.referrer, + // referrer policy request’s referrer policy. + referrerPolicy: request.referrerPolicy, + // mode request’s mode. + mode: request.mode, + // credentials mode request’s credentials mode. + credentials: request.credentials, + // cache mode request’s cache mode. + cache: request.cache, + // redirect mode request’s redirect mode. + redirect: request.redirect, + // integrity metadata request’s integrity metadata. + integrity: request.integrity, + // keepalive request’s keepalive. + keepalive: request.keepalive, + // reload-navigation flag request’s reload-navigation flag. + reloadNavigation: request.reloadNavigation, + // history-navigation flag request’s history-navigation flag. + historyNavigation: request.historyNavigation, + // URL list A clone of request’s URL list. + urlList: [...request.urlList] + }) + const initHasKey = Object.keys(init).length !== 0 -/***/ }), + // 13. If init is not empty, then: + if (initHasKey) { + // 1. If request’s mode is "navigate", then set it to "same-origin". + if (request.mode === 'navigate') { + request.mode = 'same-origin' + } -/***/ 26193: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. Unset request’s reload-navigation flag. + request.reloadNavigation = false -"use strict"; + // 3. Unset request’s history-navigation flag. + request.historyNavigation = false + // 4. Set request’s origin to "client". + request.origin = 'client' -const { promisify } = __nccwpck_require__(73837) -const Pool = __nccwpck_require__(4634) -const { buildMockDispatch } = __nccwpck_require__(79323) -const { - kDispatches, - kMockAgent, - kClose, - kOriginalClose, - kOrigin, - kOriginalDispatch, - kConnected -} = __nccwpck_require__(24347) -const { MockInterceptor } = __nccwpck_require__(90410) -const Symbols = __nccwpck_require__(72785) -const { InvalidArgumentError } = __nccwpck_require__(48045) + // 5. Set request’s referrer to "client" + request.referrer = 'client' -/** - * MockPool provides an API that extends the Pool to influence the mockDispatches. - */ -class MockPool extends Pool { - constructor (origin, opts) { - super(origin, opts) + // 6. Set request’s referrer policy to the empty string. + request.referrerPolicy = '' - if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') { - throw new InvalidArgumentError('Argument opts.agent must implement Agent') + // 7. Set request’s URL to request’s current URL. + request.url = request.urlList[request.urlList.length - 1] + + // 8. Set request’s URL list to « request’s URL ». + request.urlList = [request.url] } - this[kMockAgent] = opts.agent - this[kOrigin] = origin - this[kDispatches] = [] - this[kConnected] = 1 - this[kOriginalDispatch] = this.dispatch - this[kOriginalClose] = this.close.bind(this) + // 14. If init["referrer"] exists, then: + if (init.referrer !== undefined) { + // 1. Let referrer be init["referrer"]. + const referrer = init.referrer - this.dispatch = buildMockDispatch.call(this) - this.close = this[kClose] - } + // 2. If referrer is the empty string, then set request’s referrer to "no-referrer". + if (referrer === '') { + request.referrer = 'no-referrer' + } else { + // 1. Let parsedReferrer be the result of parsing referrer with + // baseURL. + // 2. If parsedReferrer is failure, then throw a TypeError. + let parsedReferrer + try { + parsedReferrer = new URL(referrer, baseUrl) + } catch (err) { + throw new TypeError(`Referrer "${referrer}" is not a valid URL.`, { cause: err }) + } - get [Symbols.kConnected] () { - return this[kConnected] - } + // 3. If one of the following is true + // - parsedReferrer’s scheme is "about" and path is the string "client" + // - parsedReferrer’s origin is not same origin with origin + // then set request’s referrer to "client". + if ( + (parsedReferrer.protocol === 'about:' && parsedReferrer.hostname === 'client') || + (origin && !sameOrigin(parsedReferrer, this[kRealm].settingsObject.baseUrl)) + ) { + request.referrer = 'client' + } else { + // 4. Otherwise, set request’s referrer to parsedReferrer. + request.referrer = parsedReferrer + } + } + } - /** - * Sets up the base interceptor for mocking replies from undici. - */ - intercept (opts) { - return new MockInterceptor(opts, this[kDispatches]) - } + // 15. If init["referrerPolicy"] exists, then set request’s referrer policy + // to it. + if (init.referrerPolicy !== undefined) { + request.referrerPolicy = init.referrerPolicy + } - async [kClose] () { - await promisify(this[kOriginalClose])() - this[kConnected] = 0 - this[kMockAgent][Symbols.kClients].delete(this[kOrigin]) - } -} + // 16. Let mode be init["mode"] if it exists, and fallbackMode otherwise. + let mode + if (init.mode !== undefined) { + mode = init.mode + } else { + mode = fallbackMode + } -module.exports = MockPool + // 17. If mode is "navigate", then throw a TypeError. + if (mode === 'navigate') { + throw webidl.errors.exception({ + header: 'Request constructor', + message: 'invalid request mode navigate.' + }) + } + // 18. If mode is non-null, set request’s mode to mode. + if (mode != null) { + request.mode = mode + } -/***/ }), + // 19. If init["credentials"] exists, then set request’s credentials mode + // to it. + if (init.credentials !== undefined) { + request.credentials = init.credentials + } -/***/ 24347: -/***/ ((module) => { + // 18. If init["cache"] exists, then set request’s cache mode to it. + if (init.cache !== undefined) { + request.cache = init.cache + } -"use strict"; + // 21. If request’s cache mode is "only-if-cached" and request’s mode is + // not "same-origin", then throw a TypeError. + if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') { + throw new TypeError( + "'only-if-cached' can be set only with 'same-origin' mode" + ) + } + // 22. If init["redirect"] exists, then set request’s redirect mode to it. + if (init.redirect !== undefined) { + request.redirect = init.redirect + } -module.exports = { - kAgent: Symbol('agent'), - kOptions: Symbol('options'), - kFactory: Symbol('factory'), - kDispatches: Symbol('dispatches'), - kDispatchKey: Symbol('dispatch key'), - kDefaultHeaders: Symbol('default headers'), - kDefaultTrailers: Symbol('default trailers'), - kContentLength: Symbol('content length'), - kMockAgent: Symbol('mock agent'), - kMockAgentSet: Symbol('mock agent set'), - kMockAgentGet: Symbol('mock agent get'), - kMockDispatch: Symbol('mock dispatch'), - kClose: Symbol('close'), - kOriginalClose: Symbol('original agent close'), - kOrigin: Symbol('origin'), - kIsMockActive: Symbol('is mock active'), - kNetConnect: Symbol('net connect'), - kGetNetConnect: Symbol('get net connect'), - kConnected: Symbol('connected') -} + // 23. If init["integrity"] exists, then set request’s integrity metadata to it. + if (init.integrity != null) { + request.integrity = String(init.integrity) + } + // 24. If init["keepalive"] exists, then set request’s keepalive to it. + if (init.keepalive !== undefined) { + request.keepalive = Boolean(init.keepalive) + } -/***/ }), + // 25. If init["method"] exists, then: + if (init.method !== undefined) { + // 1. Let method be init["method"]. + let method = init.method -/***/ 79323: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. If method is not a method or method is a forbidden method, then + // throw a TypeError. + if (!isValidHTTPToken(method)) { + throw new TypeError(`'${method}' is not a valid HTTP method.`) + } -"use strict"; + if (forbiddenMethodsSet.has(method.toUpperCase())) { + throw new TypeError(`'${method}' HTTP method is unsupported.`) + } + // 3. Normalize method. + method = normalizeMethodRecord[method] ?? normalizeMethod(method) -const { MockNotMatchedError } = __nccwpck_require__(50888) -const { - kDispatches, - kMockAgent, - kOriginalDispatch, - kOrigin, - kGetNetConnect -} = __nccwpck_require__(24347) -const { buildURL, nop } = __nccwpck_require__(83983) -const { STATUS_CODES } = __nccwpck_require__(13685) -const { - types: { - isPromise - } -} = __nccwpck_require__(73837) + // 4. Set request’s method to method. + request.method = method + } -function matchValue (match, value) { - if (typeof match === 'string') { - return match === value - } - if (match instanceof RegExp) { - return match.test(value) - } - if (typeof match === 'function') { - return match(value) === true - } - return false -} + // 26. If init["signal"] exists, then set signal to it. + if (init.signal !== undefined) { + signal = init.signal + } -function lowerCaseEntries (headers) { - return Object.fromEntries( - Object.entries(headers).map(([headerName, headerValue]) => { - return [headerName.toLocaleLowerCase(), headerValue] - }) - ) -} + // 27. Set this’s request to request. + this[kState] = request -/** - * @param {import('../../index').Headers|string[]|Record} headers - * @param {string} key - */ -function getHeaderByName (headers, key) { - if (Array.isArray(headers)) { - for (let i = 0; i < headers.length; i += 2) { - if (headers[i].toLocaleLowerCase() === key.toLocaleLowerCase()) { - return headers[i + 1] - } - } + // 28. Set this’s signal to a new AbortSignal object with this’s relevant + // Realm. + // TODO: could this be simplified with AbortSignal.any + // (https://dom.spec.whatwg.org/#dom-abortsignal-any) + const ac = new AbortController() + this[kSignal] = ac.signal + this[kSignal][kRealm] = this[kRealm] - return undefined - } else if (typeof headers.get === 'function') { - return headers.get(key) - } else { - return lowerCaseEntries(headers)[key.toLocaleLowerCase()] - } -} + // 29. If signal is not null, then make this’s signal follow signal. + if (signal != null) { + if ( + !signal || + typeof signal.aborted !== 'boolean' || + typeof signal.addEventListener !== 'function' + ) { + throw new TypeError( + "Failed to construct 'Request': member signal is not of type AbortSignal." + ) + } -/** @param {string[]} headers */ -function buildHeadersFromArray (headers) { // fetch HeadersList - const clone = headers.slice() - const entries = [] - for (let index = 0; index < clone.length; index += 2) { - entries.push([clone[index], clone[index + 1]]) - } - return Object.fromEntries(entries) -} + if (signal.aborted) { + ac.abort(signal.reason) + } else { + // Keep a strong ref to ac while request object + // is alive. This is needed to prevent AbortController + // from being prematurely garbage collected. + // See, https://github.com/nodejs/undici/issues/1926. + this[kAbortController] = ac -function matchHeaders (mockDispatch, headers) { - if (typeof mockDispatch.headers === 'function') { - if (Array.isArray(headers)) { // fetch HeadersList - headers = buildHeadersFromArray(headers) - } - return mockDispatch.headers(headers ? lowerCaseEntries(headers) : {}) - } - if (typeof mockDispatch.headers === 'undefined') { - return true - } - if (typeof headers !== 'object' || typeof mockDispatch.headers !== 'object') { - return false - } + const acRef = new WeakRef(ac) + const abort = function () { + const ac = acRef.deref() + if (ac !== undefined) { + ac.abort(this.reason) + } + } - for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) { - const headerValue = getHeaderByName(headers, matchHeaderName) + // Third-party AbortControllers may not work with these. + // See, https://github.com/nodejs/undici/pull/1910#issuecomment-1464495619. + try { + // If the max amount of listeners is equal to the default, increase it + // This is only available in node >= v19.9.0 + if (typeof getMaxListeners === 'function' && getMaxListeners(signal) === defaultMaxListeners) { + setMaxListeners(100, signal) + } else if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) { + setMaxListeners(100, signal) + } + } catch {} - if (!matchValue(matchHeaderValue, headerValue)) { - return false + util.addAbortListener(signal, abort) + requestFinalizer.register(ac, { signal, abort }) + } } - } - return true -} -function safeUrl (path) { - if (typeof path !== 'string') { - return path - } + // 30. Set this’s headers to a new Headers object with this’s relevant + // Realm, whose header list is request’s header list and guard is + // "request". + this[kHeaders] = new Headers(kConstruct) + this[kHeaders][kHeadersList] = request.headersList + this[kHeaders][kGuard] = 'request' + this[kHeaders][kRealm] = this[kRealm] - const pathSegments = path.split('?') + // 31. If this’s request’s mode is "no-cors", then: + if (mode === 'no-cors') { + // 1. If this’s request’s method is not a CORS-safelisted method, + // then throw a TypeError. + if (!corsSafeListedMethodsSet.has(request.method)) { + throw new TypeError( + `'${request.method} is unsupported in no-cors mode.` + ) + } - if (pathSegments.length !== 2) { - return path - } + // 2. Set this’s headers’s guard to "request-no-cors". + this[kHeaders][kGuard] = 'request-no-cors' + } - const qp = new URLSearchParams(pathSegments.pop()) - qp.sort() - return [...pathSegments, qp.toString()].join('?') -} + // 32. If init is not empty, then: + if (initHasKey) { + /** @type {HeadersList} */ + const headersList = this[kHeaders][kHeadersList] + // 1. Let headers be a copy of this’s headers and its associated header + // list. + // 2. If init["headers"] exists, then set headers to init["headers"]. + const headers = init.headers !== undefined ? init.headers : new HeadersList(headersList) -function matchKey (mockDispatch, { path, method, body, headers }) { - const pathMatch = matchValue(mockDispatch.path, path) - const methodMatch = matchValue(mockDispatch.method, method) - const bodyMatch = typeof mockDispatch.body !== 'undefined' ? matchValue(mockDispatch.body, body) : true - const headersMatch = matchHeaders(mockDispatch, headers) - return pathMatch && methodMatch && bodyMatch && headersMatch -} + // 3. Empty this’s headers’s header list. + headersList.clear() -function getResponseData (data) { - if (Buffer.isBuffer(data)) { - return data - } else if (typeof data === 'object') { - return JSON.stringify(data) - } else { - return data.toString() - } -} + // 4. If headers is a Headers object, then for each header in its header + // list, append header’s name/header’s value to this’s headers. + if (headers instanceof HeadersList) { + for (const [key, val] of headers) { + headersList.append(key, val) + } + // Note: Copy the `set-cookie` meta-data. + headersList.cookies = headers.cookies + } else { + // 5. Otherwise, fill this’s headers with headers. + fillHeaders(this[kHeaders], headers) + } + } -function getMockDispatch (mockDispatches, key) { - const basePath = key.query ? buildURL(key.path, key.query) : key.path - const resolvedPath = typeof basePath === 'string' ? safeUrl(basePath) : basePath + // 33. Let inputBody be input’s request’s body if input is a Request + // object; otherwise null. + const inputBody = input instanceof Request ? input[kState].body : null - // Match path - let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path }) => matchValue(safeUrl(path), resolvedPath)) - if (matchedMockDispatches.length === 0) { - throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`) - } + // 34. If either init["body"] exists and is non-null or inputBody is + // non-null, and request’s method is `GET` or `HEAD`, then throw a + // TypeError. + if ( + (init.body != null || inputBody != null) && + (request.method === 'GET' || request.method === 'HEAD') + ) { + throw new TypeError('Request with GET/HEAD method cannot have body.') + } - // Match method - matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method)) - if (matchedMockDispatches.length === 0) { - throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}'`) - } + // 35. Let initBody be null. + let initBody = null - // Match body - matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== 'undefined' ? matchValue(body, key.body) : true) - if (matchedMockDispatches.length === 0) { - throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}'`) - } + // 36. If init["body"] exists and is non-null, then: + if (init.body != null) { + // 1. Let Content-Type be null. + // 2. Set initBody and Content-Type to the result of extracting + // init["body"], with keepalive set to request’s keepalive. + const [extractedBody, contentType] = extractBody( + init.body, + request.keepalive + ) + initBody = extractedBody - // Match headers - matchedMockDispatches = matchedMockDispatches.filter((mockDispatch) => matchHeaders(mockDispatch, key.headers)) - if (matchedMockDispatches.length === 0) { - throw new MockNotMatchedError(`Mock dispatch not matched for headers '${typeof key.headers === 'object' ? JSON.stringify(key.headers) : key.headers}'`) - } + // 3, If Content-Type is non-null and this’s headers’s header list does + // not contain `Content-Type`, then append `Content-Type`/Content-Type to + // this’s headers. + if (contentType && !this[kHeaders][kHeadersList].contains('content-type')) { + this[kHeaders].append('content-type', contentType) + } + } - return matchedMockDispatches[0] -} + // 37. Let inputOrInitBody be initBody if it is non-null; otherwise + // inputBody. + const inputOrInitBody = initBody ?? inputBody -function addMockDispatch (mockDispatches, key, data) { - const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false } - const replyData = typeof data === 'function' ? { callback: data } : { ...data } - const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } } - mockDispatches.push(newMockDispatch) - return newMockDispatch -} + // 38. If inputOrInitBody is non-null and inputOrInitBody’s source is + // null, then: + if (inputOrInitBody != null && inputOrInitBody.source == null) { + // 1. If initBody is non-null and init["duplex"] does not exist, + // then throw a TypeError. + if (initBody != null && init.duplex == null) { + throw new TypeError('RequestInit: duplex option is required when sending a body.') + } -function deleteMockDispatch (mockDispatches, key) { - const index = mockDispatches.findIndex(dispatch => { - if (!dispatch.consumed) { - return false + // 2. If this’s request’s mode is neither "same-origin" nor "cors", + // then throw a TypeError. + if (request.mode !== 'same-origin' && request.mode !== 'cors') { + throw new TypeError( + 'If request is made from ReadableStream, mode should be "same-origin" or "cors"' + ) + } + + // 3. Set this’s request’s use-CORS-preflight flag. + request.useCORSPreflightFlag = true } - return matchKey(dispatch, key) - }) - if (index !== -1) { - mockDispatches.splice(index, 1) - } -} -function buildKey (opts) { - const { path, method, body, headers, query } = opts - return { - path, - method, - body, - headers, - query - } -} + // 39. Let finalBody be inputOrInitBody. + let finalBody = inputOrInitBody -function generateKeyValues (data) { - return Object.entries(data).reduce((keyValuePairs, [key, value]) => [ - ...keyValuePairs, - Buffer.from(`${key}`), - Array.isArray(value) ? value.map(x => Buffer.from(`${x}`)) : Buffer.from(`${value}`) - ], []) -} + // 40. If initBody is null and inputBody is non-null, then: + if (initBody == null && inputBody != null) { + // 1. If input is unusable, then throw a TypeError. + if (util.isDisturbed(inputBody.stream) || inputBody.stream.locked) { + throw new TypeError( + 'Cannot construct a Request with a Request object that has already been used.' + ) + } -/** - * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status - * @param {number} statusCode - */ -function getStatusText (statusCode) { - return STATUS_CODES[statusCode] || 'unknown' -} + // 2. Set finalBody to the result of creating a proxy for inputBody. + if (!TransformStream) { + TransformStream = (__nccwpck_require__(35356).TransformStream) + } -async function getResponse (body) { - const buffers = [] - for await (const data of body) { - buffers.push(data) - } - return Buffer.concat(buffers).toString('utf8') -} + // https://streams.spec.whatwg.org/#readablestream-create-a-proxy + const identityTransform = new TransformStream() + inputBody.stream.pipeThrough(identityTransform) + finalBody = { + source: inputBody.source, + length: inputBody.length, + stream: identityTransform.readable + } + } -/** - * Mock dispatch function used to simulate undici dispatches - */ -function mockDispatch (opts, handler) { - // Get mock dispatch from built key - const key = buildKey(opts) - const mockDispatch = getMockDispatch(this[kDispatches], key) + // 41. Set this’s request’s body to finalBody. + this[kState].body = finalBody + } - mockDispatch.timesInvoked++ + // Returns request’s HTTP method, which is "GET" by default. + get method () { + webidl.brandCheck(this, Request) - // Here's where we resolve a callback if a callback is present for the dispatch data. - if (mockDispatch.data.callback) { - mockDispatch.data = { ...mockDispatch.data, ...mockDispatch.data.callback(opts) } + // The method getter steps are to return this’s request’s method. + return this[kState].method } - // Parse mockDispatch data - const { data: { statusCode, data, headers, trailers, error }, delay, persist } = mockDispatch - const { timesInvoked, times } = mockDispatch + // Returns the URL of request as a string. + get url () { + webidl.brandCheck(this, Request) - // If it's used up and not persistent, mark as consumed - mockDispatch.consumed = !persist && timesInvoked >= times - mockDispatch.pending = timesInvoked < times + // The url getter steps are to return this’s request’s URL, serialized. + return URLSerializer(this[kState].url) + } - // If specified, trigger dispatch error - if (error !== null) { - deleteMockDispatch(this[kDispatches], key) - handler.onError(error) - return true + // Returns a Headers object consisting of the headers associated with request. + // Note that headers added in the network layer by the user agent will not + // be accounted for in this object, e.g., the "Host" header. + get headers () { + webidl.brandCheck(this, Request) + + // The headers getter steps are to return this’s headers. + return this[kHeaders] } - // Handle the request with a delay if necessary - if (typeof delay === 'number' && delay > 0) { - setTimeout(() => { - handleReply(this[kDispatches]) - }, delay) - } else { - handleReply(this[kDispatches]) + // Returns the kind of resource requested by request, e.g., "document" + // or "script". + get destination () { + webidl.brandCheck(this, Request) + + // The destination getter are to return this’s request’s destination. + return this[kState].destination } - function handleReply (mockDispatches, _data = data) { - // fetch's HeadersList is a 1D string array - const optsHeaders = Array.isArray(opts.headers) - ? buildHeadersFromArray(opts.headers) - : opts.headers - const body = typeof _data === 'function' - ? _data({ ...opts, headers: optsHeaders }) - : _data + // Returns the referrer of request. Its value can be a same-origin URL if + // explicitly set in init, the empty string to indicate no referrer, and + // "about:client" when defaulting to the global’s default. This is used + // during fetching to determine the value of the `Referer` header of the + // request being made. + get referrer () { + webidl.brandCheck(this, Request) - // util.types.isPromise is likely needed for jest. - if (isPromise(body)) { - // If handleReply is asynchronous, throwing an error - // in the callback will reject the promise, rather than - // synchronously throw the error, which breaks some tests. - // Rather, we wait for the callback to resolve if it is a - // promise, and then re-run handleReply with the new body. - body.then((newData) => handleReply(mockDispatches, newData)) - return + // 1. If this’s request’s referrer is "no-referrer", then return the + // empty string. + if (this[kState].referrer === 'no-referrer') { + return '' } - const responseData = getResponseData(body) - const responseHeaders = generateKeyValues(headers) - const responseTrailers = generateKeyValues(trailers) + // 2. If this’s request’s referrer is "client", then return + // "about:client". + if (this[kState].referrer === 'client') { + return 'about:client' + } - handler.abort = nop - handler.onHeaders(statusCode, responseHeaders, resume, getStatusText(statusCode)) - handler.onData(Buffer.from(responseData)) - handler.onComplete(responseTrailers) - deleteMockDispatch(mockDispatches, key) + // Return this’s request’s referrer, serialized. + return this[kState].referrer.toString() } - function resume () {} + // Returns the referrer policy associated with request. + // This is used during fetching to compute the value of the request’s + // referrer. + get referrerPolicy () { + webidl.brandCheck(this, Request) - return true -} + // The referrerPolicy getter steps are to return this’s request’s referrer policy. + return this[kState].referrerPolicy + } -function buildMockDispatch () { - const agent = this[kMockAgent] - const origin = this[kOrigin] - const originalDispatch = this[kOriginalDispatch] + // Returns the mode associated with request, which is a string indicating + // whether the request will use CORS, or will be restricted to same-origin + // URLs. + get mode () { + webidl.brandCheck(this, Request) - return function dispatch (opts, handler) { - if (agent.isMockActive) { - try { - mockDispatch.call(this, opts, handler) - } catch (error) { - if (error instanceof MockNotMatchedError) { - const netConnect = agent[kGetNetConnect]() - if (netConnect === false) { - throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`) - } - if (checkNetConnect(netConnect, origin)) { - originalDispatch.call(this, opts, handler) - } else { - throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`) - } - } else { - throw error - } - } - } else { - originalDispatch.call(this, opts, handler) - } + // The mode getter steps are to return this’s request’s mode. + return this[kState].mode } -} -function checkNetConnect (netConnect, origin) { - const url = new URL(origin) - if (netConnect === true) { - return true - } else if (Array.isArray(netConnect) && netConnect.some((matcher) => matchValue(matcher, url.host))) { - return true + // Returns the credentials mode associated with request, + // which is a string indicating whether credentials will be sent with the + // request always, never, or only when sent to a same-origin URL. + get credentials () { + // The credentials getter steps are to return this’s request’s credentials mode. + return this[kState].credentials } - return false -} -function buildMockOptions (opts) { - if (opts) { - const { agent, ...mockOptions } = opts - return mockOptions - } -} + // Returns the cache mode associated with request, + // which is a string indicating how the request will + // interact with the browser’s cache when fetching. + get cache () { + webidl.brandCheck(this, Request) -module.exports = { - getResponseData, - getMockDispatch, - addMockDispatch, - deleteMockDispatch, - buildKey, - generateKeyValues, - matchValue, - getResponse, - getStatusText, - mockDispatch, - buildMockDispatch, - checkNetConnect, - buildMockOptions, - getHeaderByName -} + // The cache getter steps are to return this’s request’s cache mode. + return this[kState].cache + } + // Returns the redirect mode associated with request, + // which is a string indicating how redirects for the + // request will be handled during fetching. A request + // will follow redirects by default. + get redirect () { + webidl.brandCheck(this, Request) -/***/ }), + // The redirect getter steps are to return this’s request’s redirect mode. + return this[kState].redirect + } -/***/ 86823: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // Returns request’s subresource integrity metadata, which is a + // cryptographic hash of the resource being fetched. Its value + // consists of multiple hashes separated by whitespace. [SRI] + get integrity () { + webidl.brandCheck(this, Request) -"use strict"; + // The integrity getter steps are to return this’s request’s integrity + // metadata. + return this[kState].integrity + } + // Returns a boolean indicating whether or not request can outlive the + // global in which it was created. + get keepalive () { + webidl.brandCheck(this, Request) -const { Transform } = __nccwpck_require__(12781) -const { Console } = __nccwpck_require__(96206) + // The keepalive getter steps are to return this’s request’s keepalive. + return this[kState].keepalive + } -/** - * Gets the output of `console.table(…)` as a string. - */ -module.exports = class PendingInterceptorsFormatter { - constructor ({ disableColors } = {}) { - this.transform = new Transform({ - transform (chunk, _enc, cb) { - cb(null, chunk) - } - }) + // Returns a boolean indicating whether or not request is for a reload + // navigation. + get isReloadNavigation () { + webidl.brandCheck(this, Request) - this.logger = new Console({ - stdout: this.transform, - inspectOptions: { - colors: !disableColors && !process.env.CI - } - }) + // The isReloadNavigation getter steps are to return true if this’s + // request’s reload-navigation flag is set; otherwise false. + return this[kState].reloadNavigation } - format (pendingInterceptors) { - const withPrettyHeaders = pendingInterceptors.map( - ({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ - Method: method, - Origin: origin, - Path: path, - 'Status code': statusCode, - Persistent: persist ? '✅' : '❌', - Invocations: timesInvoked, - Remaining: persist ? Infinity : times - timesInvoked - })) + // Returns a boolean indicating whether or not request is for a history + // navigation (a.k.a. back-foward navigation). + get isHistoryNavigation () { + webidl.brandCheck(this, Request) - this.logger.table(withPrettyHeaders) - return this.transform.read().toString() + // The isHistoryNavigation getter steps are to return true if this’s request’s + // history-navigation flag is set; otherwise false. + return this[kState].historyNavigation } -} + // Returns the signal associated with request, which is an AbortSignal + // object indicating whether or not request has been aborted, and its + // abort event handler. + get signal () { + webidl.brandCheck(this, Request) -/***/ }), + // The signal getter steps are to return this’s signal. + return this[kSignal] + } -/***/ 78891: -/***/ ((module) => { + get body () { + webidl.brandCheck(this, Request) -"use strict"; + return this[kState].body ? this[kState].body.stream : null + } + get bodyUsed () { + webidl.brandCheck(this, Request) -const singulars = { - pronoun: 'it', - is: 'is', - was: 'was', - this: 'this' -} + return !!this[kState].body && util.isDisturbed(this[kState].body.stream) + } -const plurals = { - pronoun: 'they', - is: 'are', - was: 'were', - this: 'these' -} + get duplex () { + webidl.brandCheck(this, Request) -module.exports = class Pluralizer { - constructor (singular, plural) { - this.singular = singular - this.plural = plural + return 'half' } - pluralize (count) { - const one = count === 1 - const keys = one ? singulars : plurals - const noun = one ? this.singular : this.plural - return { ...keys, count, noun } - } -} + // Returns a clone of request. + clone () { + webidl.brandCheck(this, Request) + // 1. If this is unusable, then throw a TypeError. + if (this.bodyUsed || this.body?.locked) { + throw new TypeError('unusable') + } -/***/ }), + // 2. Let clonedRequest be the result of cloning this’s request. + const clonedRequest = cloneRequest(this[kState]) -/***/ 68266: -/***/ ((module) => { + // 3. Let clonedRequestObject be the result of creating a Request object, + // given clonedRequest, this’s headers’s guard, and this’s relevant Realm. + const clonedRequestObject = new Request(kConstruct) + clonedRequestObject[kState] = clonedRequest + clonedRequestObject[kRealm] = this[kRealm] + clonedRequestObject[kHeaders] = new Headers(kConstruct) + clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList + clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard] + clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm] -"use strict"; -/* eslint-disable */ + // 4. Make clonedRequestObject’s signal follow this’s signal. + const ac = new AbortController() + if (this.signal.aborted) { + ac.abort(this.signal.reason) + } else { + util.addAbortListener( + this.signal, + () => { + ac.abort(this.signal.reason) + } + ) + } + clonedRequestObject[kSignal] = ac.signal + // 4. Return clonedRequestObject. + return clonedRequestObject + } +} +mixinBody(Request) -// Extracted from node/lib/internal/fixed_queue.js +function makeRequest (init) { + // https://fetch.spec.whatwg.org/#requests + const request = { + method: 'GET', + localURLsOnly: false, + unsafeRequest: false, + body: null, + client: null, + reservedClient: null, + replacesClientId: '', + window: 'client', + keepalive: false, + serviceWorkers: 'all', + initiator: '', + destination: '', + priority: null, + origin: 'client', + policyContainer: 'client', + referrer: 'client', + referrerPolicy: '', + mode: 'no-cors', + useCORSPreflightFlag: false, + credentials: 'same-origin', + useCredentials: false, + cache: 'default', + redirect: 'follow', + integrity: '', + cryptoGraphicsNonceMetadata: '', + parserMetadata: '', + reloadNavigation: false, + historyNavigation: false, + userActivation: false, + taintedOrigin: false, + redirectCount: 0, + responseTainting: 'basic', + preventNoCacheCacheControlHeaderModification: false, + done: false, + timingAllowFailed: false, + ...init, + headersList: init.headersList + ? new HeadersList(init.headersList) + : new HeadersList() + } + request.url = request.urlList[0] + return request +} -// Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two. -const kSize = 2048; -const kMask = kSize - 1; +// https://fetch.spec.whatwg.org/#concept-request-clone +function cloneRequest (request) { + // To clone a request request, run these steps: -// The FixedQueue is implemented as a singly-linked list of fixed-size -// circular buffers. It looks something like this: -// -// head tail -// | | -// v v -// +-----------+ <-----\ +-----------+ <------\ +-----------+ -// | [null] | \----- | next | \------- | next | -// +-----------+ +-----------+ +-----------+ -// | item | <-- bottom | item | <-- bottom | [empty] | -// | item | | item | | [empty] | -// | item | | item | | [empty] | -// | item | | item | | [empty] | -// | item | | item | bottom --> | item | -// | item | | item | | item | -// | ... | | ... | | ... | -// | item | | item | | item | -// | item | | item | | item | -// | [empty] | <-- top | item | | item | -// | [empty] | | item | | item | -// | [empty] | | [empty] | <-- top top --> | [empty] | -// +-----------+ +-----------+ +-----------+ -// -// Or, if there is only one circular buffer, it looks something -// like either of these: -// -// head tail head tail -// | | | | -// v v v v -// +-----------+ +-----------+ -// | [null] | | [null] | -// +-----------+ +-----------+ -// | [empty] | | item | -// | [empty] | | item | -// | item | <-- bottom top --> | [empty] | -// | item | | [empty] | -// | [empty] | <-- top bottom --> | item | -// | [empty] | | item | -// +-----------+ +-----------+ -// -// Adding a value means moving `top` forward by one, removing means -// moving `bottom` forward by one. After reaching the end, the queue -// wraps around. -// -// When `top === bottom` the current queue is empty and when -// `top + 1 === bottom` it's full. This wastes a single space of storage -// but allows much quicker checks. + // 1. Let newRequest be a copy of request, except for its body. + const newRequest = makeRequest({ ...request, body: null }) -class FixedCircularBuffer { - constructor() { - this.bottom = 0; - this.top = 0; - this.list = new Array(kSize); - this.next = null; + // 2. If request’s body is non-null, set newRequest’s body to the + // result of cloning request’s body. + if (request.body != null) { + newRequest.body = cloneBody(request.body) } - isEmpty() { - return this.top === this.bottom; - } + // 3. Return newRequest. + return newRequest +} - isFull() { - return ((this.top + 1) & kMask) === this.bottom; +Object.defineProperties(Request.prototype, { + method: kEnumerableProperty, + url: kEnumerableProperty, + headers: kEnumerableProperty, + redirect: kEnumerableProperty, + clone: kEnumerableProperty, + signal: kEnumerableProperty, + duplex: kEnumerableProperty, + destination: kEnumerableProperty, + body: kEnumerableProperty, + bodyUsed: kEnumerableProperty, + isHistoryNavigation: kEnumerableProperty, + isReloadNavigation: kEnumerableProperty, + keepalive: kEnumerableProperty, + integrity: kEnumerableProperty, + cache: kEnumerableProperty, + credentials: kEnumerableProperty, + attribute: kEnumerableProperty, + referrerPolicy: kEnumerableProperty, + referrer: kEnumerableProperty, + mode: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'Request', + configurable: true } +}) - push(data) { - this.list[this.top] = data; - this.top = (this.top + 1) & kMask; - } +webidl.converters.Request = webidl.interfaceConverter( + Request +) - shift() { - const nextItem = this.list[this.bottom]; - if (nextItem === undefined) - return null; - this.list[this.bottom] = undefined; - this.bottom = (this.bottom + 1) & kMask; - return nextItem; +// https://fetch.spec.whatwg.org/#requestinfo +webidl.converters.RequestInfo = function (V) { + if (typeof V === 'string') { + return webidl.converters.USVString(V) } -} -module.exports = class FixedQueue { - constructor() { - this.head = this.tail = new FixedCircularBuffer(); + if (V instanceof Request) { + return webidl.converters.Request(V) } - isEmpty() { - return this.head.isEmpty(); - } + return webidl.converters.USVString(V) +} - push(data) { - if (this.head.isFull()) { - // Head is full: Creates a new queue, sets the old queue's `.next` to it, - // and sets it as the new main queue. - this.head = this.head.next = new FixedCircularBuffer(); - } - this.head.push(data); - } +webidl.converters.AbortSignal = webidl.interfaceConverter( + AbortSignal +) - shift() { - const tail = this.tail; - const next = tail.shift(); - if (tail.isEmpty() && tail.next !== null) { - // If there is another queue, it forms the new tail. - this.tail = tail.next; - } - return next; +// https://fetch.spec.whatwg.org/#requestinit +webidl.converters.RequestInit = webidl.dictionaryConverter([ + { + key: 'method', + converter: webidl.converters.ByteString + }, + { + key: 'headers', + converter: webidl.converters.HeadersInit + }, + { + key: 'body', + converter: webidl.nullableConverter( + webidl.converters.BodyInit + ) + }, + { + key: 'referrer', + converter: webidl.converters.USVString + }, + { + key: 'referrerPolicy', + converter: webidl.converters.DOMString, + // https://w3c.github.io/webappsec-referrer-policy/#referrer-policy + allowedValues: referrerPolicy + }, + { + key: 'mode', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#concept-request-mode + allowedValues: requestMode + }, + { + key: 'credentials', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#requestcredentials + allowedValues: requestCredentials + }, + { + key: 'cache', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#requestcache + allowedValues: requestCache + }, + { + key: 'redirect', + converter: webidl.converters.DOMString, + // https://fetch.spec.whatwg.org/#requestredirect + allowedValues: requestRedirect + }, + { + key: 'integrity', + converter: webidl.converters.DOMString + }, + { + key: 'keepalive', + converter: webidl.converters.boolean + }, + { + key: 'signal', + converter: webidl.nullableConverter( + (signal) => webidl.converters.AbortSignal( + signal, + { strict: false } + ) + ) + }, + { + key: 'window', + converter: webidl.converters.any + }, + { + key: 'duplex', + converter: webidl.converters.DOMString, + allowedValues: requestDuplex } -}; +]) + +module.exports = { Request, makeRequest } /***/ }), -/***/ 73198: +/***/ 27823: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -const DispatcherBase = __nccwpck_require__(74839) -const FixedQueue = __nccwpck_require__(68266) -const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(72785) -const PoolStats = __nccwpck_require__(39689) +const { Headers, HeadersList, fill } = __nccwpck_require__(10554) +const { extractBody, cloneBody, mixinBody } = __nccwpck_require__(41472) +const util = __nccwpck_require__(83983) +const { kEnumerableProperty } = util +const { + isValidReasonPhrase, + isCancelled, + isAborted, + isBlobLike, + serializeJavascriptValueToJSONString, + isErrorLike, + isomorphicEncode +} = __nccwpck_require__(52538) +const { + redirectStatusSet, + nullBodyStatus, + DOMException +} = __nccwpck_require__(41037) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(15861) +const { webidl } = __nccwpck_require__(21744) +const { FormData } = __nccwpck_require__(72015) +const { getGlobalOrigin } = __nccwpck_require__(71246) +const { URLSerializer } = __nccwpck_require__(685) +const { kHeadersList, kConstruct } = __nccwpck_require__(72785) +const assert = __nccwpck_require__(39491) +const { types } = __nccwpck_require__(73837) -const kClients = Symbol('clients') -const kNeedDrain = Symbol('needDrain') -const kQueue = Symbol('queue') -const kClosedResolve = Symbol('closed resolve') -const kOnDrain = Symbol('onDrain') -const kOnConnect = Symbol('onConnect') -const kOnDisconnect = Symbol('onDisconnect') -const kOnConnectionError = Symbol('onConnectionError') -const kGetDispatcher = Symbol('get dispatcher') -const kAddClient = Symbol('add client') -const kRemoveClient = Symbol('remove client') -const kStats = Symbol('stats') +const ReadableStream = globalThis.ReadableStream || (__nccwpck_require__(35356).ReadableStream) +const textEncoder = new TextEncoder('utf-8') -class PoolBase extends DispatcherBase { - constructor () { - super() +// https://fetch.spec.whatwg.org/#response-class +class Response { + // Creates network error Response. + static error () { + // TODO + const relevantRealm = { settingsObject: {} } - this[kQueue] = new FixedQueue() - this[kClients] = [] - this[kQueued] = 0 + // The static error() method steps are to return the result of creating a + // Response object, given a new network error, "immutable", and this’s + // relevant Realm. + const responseObject = new Response() + responseObject[kState] = makeNetworkError() + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kHeadersList] = responseObject[kState].headersList + responseObject[kHeaders][kGuard] = 'immutable' + responseObject[kHeaders][kRealm] = relevantRealm + return responseObject + } - const pool = this + // https://fetch.spec.whatwg.org/#dom-response-json + static json (data, init = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'Response.json' }) - this[kOnDrain] = function onDrain (origin, targets) { - const queue = pool[kQueue] + if (init !== null) { + init = webidl.converters.ResponseInit(init) + } - let needDrain = false + // 1. Let bytes the result of running serialize a JavaScript value to JSON bytes on data. + const bytes = textEncoder.encode( + serializeJavascriptValueToJSONString(data) + ) - while (!needDrain) { - const item = queue.shift() - if (!item) { - break - } - pool[kQueued]-- - needDrain = !this.dispatch(item.opts, item.handler) - } + // 2. Let body be the result of extracting bytes. + const body = extractBody(bytes) - this[kNeedDrain] = needDrain + // 3. Let responseObject be the result of creating a Response object, given a new response, + // "response", and this’s relevant Realm. + const relevantRealm = { settingsObject: {} } + const responseObject = new Response() + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kGuard] = 'response' + responseObject[kHeaders][kRealm] = relevantRealm - if (!this[kNeedDrain] && pool[kNeedDrain]) { - pool[kNeedDrain] = false - pool.emit('drain', origin, [pool, ...targets]) - } + // 4. Perform initialize a response given responseObject, init, and (body, "application/json"). + initializeResponse(responseObject, init, { body: body[0], type: 'application/json' }) - if (pool[kClosedResolve] && queue.isEmpty()) { - Promise - .all(pool[kClients].map(c => c.close())) - .then(pool[kClosedResolve]) - } - } + // 5. Return responseObject. + return responseObject + } - this[kOnConnect] = (origin, targets) => { - pool.emit('connect', origin, [pool, ...targets]) - } + // Creates a redirect Response that redirects to url with status status. + static redirect (url, status = 302) { + const relevantRealm = { settingsObject: {} } - this[kOnDisconnect] = (origin, targets, err) => { - pool.emit('disconnect', origin, [pool, ...targets], err) + webidl.argumentLengthCheck(arguments, 1, { header: 'Response.redirect' }) + + url = webidl.converters.USVString(url) + status = webidl.converters['unsigned short'](status) + + // 1. Let parsedURL be the result of parsing url with current settings + // object’s API base URL. + // 2. If parsedURL is failure, then throw a TypeError. + // TODO: base-URL? + let parsedURL + try { + parsedURL = new URL(url, getGlobalOrigin()) + } catch (err) { + throw Object.assign(new TypeError('Failed to parse URL from ' + url), { + cause: err + }) } - this[kOnConnectionError] = (origin, targets, err) => { - pool.emit('connectionError', origin, [pool, ...targets], err) + // 3. If status is not a redirect status, then throw a RangeError. + if (!redirectStatusSet.has(status)) { + throw new RangeError('Invalid status code ' + status) } - this[kStats] = new PoolStats(this) - } + // 4. Let responseObject be the result of creating a Response object, + // given a new response, "immutable", and this’s relevant Realm. + const responseObject = new Response() + responseObject[kRealm] = relevantRealm + responseObject[kHeaders][kGuard] = 'immutable' + responseObject[kHeaders][kRealm] = relevantRealm - get [kBusy] () { - return this[kNeedDrain] - } + // 5. Set responseObject’s response’s status to status. + responseObject[kState].status = status - get [kConnected] () { - return this[kClients].filter(client => client[kConnected]).length - } + // 6. Let value be parsedURL, serialized and isomorphic encoded. + const value = isomorphicEncode(URLSerializer(parsedURL)) - get [kFree] () { - return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length - } + // 7. Append `Location`/value to responseObject’s response’s header list. + responseObject[kState].headersList.append('location', value) - get [kPending] () { - let ret = this[kQueued] - for (const { [kPending]: pending } of this[kClients]) { - ret += pending - } - return ret + // 8. Return responseObject. + return responseObject } - get [kRunning] () { - let ret = 0 - for (const { [kRunning]: running } of this[kClients]) { - ret += running + // https://fetch.spec.whatwg.org/#dom-response + constructor (body = null, init = {}) { + if (body !== null) { + body = webidl.converters.BodyInit(body) } - return ret - } - get [kSize] () { - let ret = this[kQueued] - for (const { [kSize]: size } of this[kClients]) { - ret += size + init = webidl.converters.ResponseInit(init) + + // TODO + this[kRealm] = { settingsObject: {} } + + // 1. Set this’s response to a new response. + this[kState] = makeResponse({}) + + // 2. Set this’s headers to a new Headers object with this’s relevant + // Realm, whose header list is this’s response’s header list and guard + // is "response". + this[kHeaders] = new Headers(kConstruct) + this[kHeaders][kGuard] = 'response' + this[kHeaders][kHeadersList] = this[kState].headersList + this[kHeaders][kRealm] = this[kRealm] + + // 3. Let bodyWithType be null. + let bodyWithType = null + + // 4. If body is non-null, then set bodyWithType to the result of extracting body. + if (body != null) { + const [extractedBody, type] = extractBody(body) + bodyWithType = { body: extractedBody, type } } - return ret - } - get stats () { - return this[kStats] + // 5. Perform initialize a response given this, init, and bodyWithType. + initializeResponse(this, init, bodyWithType) } - async [kClose] () { - if (this[kQueue].isEmpty()) { - return Promise.all(this[kClients].map(c => c.close())) - } else { - return new Promise((resolve) => { - this[kClosedResolve] = resolve - }) - } + // Returns response’s type, e.g., "cors". + get type () { + webidl.brandCheck(this, Response) + + // The type getter steps are to return this’s response’s type. + return this[kState].type } - async [kDestroy] (err) { - while (true) { - const item = this[kQueue].shift() - if (!item) { - break - } - item.handler.onError(err) - } + // Returns response’s URL, if it has one; otherwise the empty string. + get url () { + webidl.brandCheck(this, Response) - return Promise.all(this[kClients].map(c => c.destroy(err))) - } + const urlList = this[kState].urlList - [kDispatch] (opts, handler) { - const dispatcher = this[kGetDispatcher]() + // The url getter steps are to return the empty string if this’s + // response’s URL is null; otherwise this’s response’s URL, + // serialized with exclude fragment set to true. + const url = urlList[urlList.length - 1] ?? null - if (!dispatcher) { - this[kNeedDrain] = true - this[kQueue].push({ opts, handler }) - this[kQueued]++ - } else if (!dispatcher.dispatch(opts, handler)) { - dispatcher[kNeedDrain] = true - this[kNeedDrain] = !this[kGetDispatcher]() + if (url === null) { + return '' } - return !this[kNeedDrain] + return URLSerializer(url, true) } - [kAddClient] (client) { - client - .on('drain', this[kOnDrain]) - .on('connect', this[kOnConnect]) - .on('disconnect', this[kOnDisconnect]) - .on('connectionError', this[kOnConnectionError]) + // Returns whether response was obtained through a redirect. + get redirected () { + webidl.brandCheck(this, Response) - this[kClients].push(client) + // The redirected getter steps are to return true if this’s response’s URL + // list has more than one item; otherwise false. + return this[kState].urlList.length > 1 + } - if (this[kNeedDrain]) { - process.nextTick(() => { - if (this[kNeedDrain]) { - this[kOnDrain](client[kUrl], [this, client]) - } - }) - } + // Returns response’s status. + get status () { + webidl.brandCheck(this, Response) - return this + // The status getter steps are to return this’s response’s status. + return this[kState].status } - [kRemoveClient] (client) { - client.close(() => { - const idx = this[kClients].indexOf(client) - if (idx !== -1) { - this[kClients].splice(idx, 1) - } - }) + // Returns whether response’s status is an ok status. + get ok () { + webidl.brandCheck(this, Response) - this[kNeedDrain] = this[kClients].some(dispatcher => ( - !dispatcher[kNeedDrain] && - dispatcher.closed !== true && - dispatcher.destroyed !== true - )) + // The ok getter steps are to return true if this’s response’s status is an + // ok status; otherwise false. + return this[kState].status >= 200 && this[kState].status <= 299 } -} -module.exports = { - PoolBase, - kClients, - kNeedDrain, - kAddClient, - kRemoveClient, - kGetDispatcher -} + // Returns response’s status message. + get statusText () { + webidl.brandCheck(this, Response) + // The statusText getter steps are to return this’s response’s status + // message. + return this[kState].statusText + } -/***/ }), + // Returns response’s headers as Headers. + get headers () { + webidl.brandCheck(this, Response) -/***/ 39689: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // The headers getter steps are to return this’s headers. + return this[kHeaders] + } -const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(72785) -const kPool = Symbol('pool') + get body () { + webidl.brandCheck(this, Response) -class PoolStats { - constructor (pool) { - this[kPool] = pool + return this[kState].body ? this[kState].body.stream : null } - get connected () { - return this[kPool][kConnected] - } + get bodyUsed () { + webidl.brandCheck(this, Response) - get free () { - return this[kPool][kFree] + return !!this[kState].body && util.isDisturbed(this[kState].body.stream) } - get pending () { - return this[kPool][kPending] - } + // Returns a clone of response. + clone () { + webidl.brandCheck(this, Response) - get queued () { - return this[kPool][kQueued] - } + // 1. If this is unusable, then throw a TypeError. + if (this.bodyUsed || (this.body && this.body.locked)) { + throw webidl.errors.exception({ + header: 'Response.clone', + message: 'Body has already been consumed.' + }) + } - get running () { - return this[kPool][kRunning] - } + // 2. Let clonedResponse be the result of cloning this’s response. + const clonedResponse = cloneResponse(this[kState]) - get size () { - return this[kPool][kSize] + // 3. Return the result of creating a Response object, given + // clonedResponse, this’s headers’s guard, and this’s relevant Realm. + const clonedResponseObject = new Response() + clonedResponseObject[kState] = clonedResponse + clonedResponseObject[kRealm] = this[kRealm] + clonedResponseObject[kHeaders][kHeadersList] = clonedResponse.headersList + clonedResponseObject[kHeaders][kGuard] = this[kHeaders][kGuard] + clonedResponseObject[kHeaders][kRealm] = this[kHeaders][kRealm] + + return clonedResponseObject } } -module.exports = PoolStats +mixinBody(Response) +Object.defineProperties(Response.prototype, { + type: kEnumerableProperty, + url: kEnumerableProperty, + status: kEnumerableProperty, + ok: kEnumerableProperty, + redirected: kEnumerableProperty, + statusText: kEnumerableProperty, + headers: kEnumerableProperty, + clone: kEnumerableProperty, + body: kEnumerableProperty, + bodyUsed: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'Response', + configurable: true + } +}) -/***/ }), +Object.defineProperties(Response, { + json: kEnumerableProperty, + redirect: kEnumerableProperty, + error: kEnumerableProperty +}) -/***/ 4634: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +// https://fetch.spec.whatwg.org/#concept-response-clone +function cloneResponse (response) { + // To clone a response response, run these steps: -"use strict"; + // 1. If response is a filtered response, then return a new identical + // filtered response whose internal response is a clone of response’s + // internal response. + if (response.internalResponse) { + return filterResponse( + cloneResponse(response.internalResponse), + response.type + ) + } + // 2. Let newResponse be a copy of response, except for its body. + const newResponse = makeResponse({ ...response, body: null }) -const { - PoolBase, - kClients, - kNeedDrain, - kAddClient, - kGetDispatcher -} = __nccwpck_require__(73198) -const Client = __nccwpck_require__(33598) -const { - InvalidArgumentError -} = __nccwpck_require__(48045) -const util = __nccwpck_require__(83983) -const { kUrl, kInterceptors } = __nccwpck_require__(72785) -const buildConnector = __nccwpck_require__(82067) + // 3. If response’s body is non-null, then set newResponse’s body to the + // result of cloning response’s body. + if (response.body != null) { + newResponse.body = cloneBody(response.body) + } -const kOptions = Symbol('options') -const kConnections = Symbol('connections') -const kFactory = Symbol('factory') + // 4. Return newResponse. + return newResponse +} -function defaultFactory (origin, opts) { - return new Client(origin, opts) +function makeResponse (init) { + return { + aborted: false, + rangeRequested: false, + timingAllowPassed: false, + requestIncludesCredentials: false, + type: 'default', + status: 200, + timingInfo: null, + cacheState: '', + statusText: '', + ...init, + headersList: init.headersList + ? new HeadersList(init.headersList) + : new HeadersList(), + urlList: init.urlList ? [...init.urlList] : [] + } } -class Pool extends PoolBase { - constructor (origin, { - connections, - factory = defaultFactory, - connect, - connectTimeout, - tls, - maxCachedSessions, - socketPath, - autoSelectFamily, - autoSelectFamilyAttemptTimeout, - allowH2, - ...options - } = {}) { - super() +function makeNetworkError (reason) { + const isError = isErrorLike(reason) + return makeResponse({ + type: 'error', + status: 0, + error: isError + ? reason + : new Error(reason ? String(reason) : reason), + aborted: reason && reason.name === 'AbortError' + }) +} - if (connections != null && (!Number.isFinite(connections) || connections < 0)) { - throw new InvalidArgumentError('invalid connections') - } +function makeFilteredResponse (response, state) { + state = { + internalResponse: response, + ...state + } - if (typeof factory !== 'function') { - throw new InvalidArgumentError('factory must be a function.') + return new Proxy(response, { + get (target, p) { + return p in state ? state[p] : target[p] + }, + set (target, p, value) { + assert(!(p in state)) + target[p] = value + return true } + }) +} - if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { - throw new InvalidArgumentError('connect must be a function or an object') - } +// https://fetch.spec.whatwg.org/#concept-filtered-response +function filterResponse (response, type) { + // Set response to the following filtered response with response as its + // internal response, depending on request’s response tainting: + if (type === 'basic') { + // A basic filtered response is a filtered response whose type is "basic" + // and header list excludes any headers in internal response’s header list + // whose name is a forbidden response-header name. - if (typeof connect !== 'function') { - connect = buildConnector({ - ...tls, - maxCachedSessions, - allowH2, - socketPath, - timeout: connectTimeout, - ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined), - ...connect - }) - } + // Note: undici does not implement forbidden response-header names + return makeFilteredResponse(response, { + type: 'basic', + headersList: response.headersList + }) + } else if (type === 'cors') { + // A CORS filtered response is a filtered response whose type is "cors" + // and header list excludes any headers in internal response’s header + // list whose name is not a CORS-safelisted response-header name, given + // internal response’s CORS-exposed header-name list. - this[kInterceptors] = options.interceptors && options.interceptors.Pool && Array.isArray(options.interceptors.Pool) - ? options.interceptors.Pool - : [] - this[kConnections] = connections || null - this[kUrl] = util.parseOrigin(origin) - this[kOptions] = { ...util.deepClone(options), connect, allowH2 } - this[kOptions].interceptors = options.interceptors - ? { ...options.interceptors } - : undefined - this[kFactory] = factory + // Note: undici does not implement CORS-safelisted response-header names + return makeFilteredResponse(response, { + type: 'cors', + headersList: response.headersList + }) + } else if (type === 'opaque') { + // An opaque filtered response is a filtered response whose type is + // "opaque", URL list is the empty list, status is 0, status message + // is the empty byte sequence, header list is empty, and body is null. - this.on('connectionError', (origin, targets, error) => { - // If a connection error occurs, we remove the client from the pool, - // and emit a connectionError event. They will not be re-used. - // Fixes https://github.com/nodejs/undici/issues/3895 - for (const target of targets) { - // Do not use kRemoveClient here, as it will close the client, - // but the client cannot be closed in this state. - const idx = this[kClients].indexOf(target) - if (idx !== -1) { - this[kClients].splice(idx, 1) - } - } + return makeFilteredResponse(response, { + type: 'opaque', + urlList: Object.freeze([]), + status: 0, + statusText: '', + body: null + }) + } else if (type === 'opaqueredirect') { + // An opaque-redirect filtered response is a filtered response whose type + // is "opaqueredirect", status is 0, status message is the empty byte + // sequence, header list is empty, and body is null. + + return makeFilteredResponse(response, { + type: 'opaqueredirect', + status: 0, + statusText: '', + headersList: [], + body: null }) + } else { + assert(false) } +} - [kGetDispatcher] () { - let dispatcher = this[kClients].find(dispatcher => !dispatcher[kNeedDrain]) +// https://fetch.spec.whatwg.org/#appropriate-network-error +function makeAppropriateNetworkError (fetchParams, err = null) { + // 1. Assert: fetchParams is canceled. + assert(isCancelled(fetchParams)) - if (dispatcher) { - return dispatcher - } + // 2. Return an aborted network error if fetchParams is aborted; + // otherwise return a network error. + return isAborted(fetchParams) + ? makeNetworkError(Object.assign(new DOMException('The operation was aborted.', 'AbortError'), { cause: err })) + : makeNetworkError(Object.assign(new DOMException('Request was cancelled.'), { cause: err })) +} - if (!this[kConnections] || this[kClients].length < this[kConnections]) { - dispatcher = this[kFactory](this[kUrl], this[kOptions]) - this[kAddClient](dispatcher) +// https://whatpr.org/fetch/1392.html#initialize-a-response +function initializeResponse (response, init, body) { + // 1. If init["status"] is not in the range 200 to 599, inclusive, then + // throw a RangeError. + if (init.status !== null && (init.status < 200 || init.status > 599)) { + throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.') + } + + // 2. If init["statusText"] does not match the reason-phrase token production, + // then throw a TypeError. + if ('statusText' in init && init.statusText != null) { + // See, https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2: + // reason-phrase = *( HTAB / SP / VCHAR / obs-text ) + if (!isValidReasonPhrase(String(init.statusText))) { + throw new TypeError('Invalid statusText') } + } - return dispatcher + // 3. Set response’s response’s status to init["status"]. + if ('status' in init && init.status != null) { + response[kState].status = init.status } -} -module.exports = Pool + // 4. Set response’s response’s status message to init["statusText"]. + if ('statusText' in init && init.statusText != null) { + response[kState].statusText = init.statusText + } + // 5. If init["headers"] exists, then fill response’s headers with init["headers"]. + if ('headers' in init && init.headers != null) { + fill(response[kHeaders], init.headers) + } -/***/ }), + // 6. If body was given, then: + if (body) { + // 1. If response's status is a null body status, then throw a TypeError. + if (nullBodyStatus.includes(response.status)) { + throw webidl.errors.exception({ + header: 'Response constructor', + message: 'Invalid response status code ' + response.status + }) + } -/***/ 97858: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. Set response's body to body's body. + response[kState].body = body.body -"use strict"; + // 3. If body's type is non-null and response's header list does not contain + // `Content-Type`, then append (`Content-Type`, body's type) to response's header list. + if (body.type != null && !response[kState].headersList.contains('Content-Type')) { + response[kState].headersList.append('content-type', body.type) + } + } +} + +webidl.converters.ReadableStream = webidl.interfaceConverter( + ReadableStream +) +webidl.converters.FormData = webidl.interfaceConverter( + FormData +) -const { kProxy, kClose, kDestroy, kInterceptors } = __nccwpck_require__(72785) -const { URL } = __nccwpck_require__(57310) -const Agent = __nccwpck_require__(7890) -const Pool = __nccwpck_require__(4634) -const DispatcherBase = __nccwpck_require__(74839) -const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(48045) -const buildConnector = __nccwpck_require__(82067) +webidl.converters.URLSearchParams = webidl.interfaceConverter( + URLSearchParams +) -const kAgent = Symbol('proxy agent') -const kClient = Symbol('proxy client') -const kProxyHeaders = Symbol('proxy headers') -const kRequestTls = Symbol('request tls settings') -const kProxyTls = Symbol('proxy tls settings') -const kConnectEndpoint = Symbol('connect endpoint function') +// https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit +webidl.converters.XMLHttpRequestBodyInit = function (V) { + if (typeof V === 'string') { + return webidl.converters.USVString(V) + } -function defaultProtocolPort (protocol) { - return protocol === 'https:' ? 443 : 80 -} + if (isBlobLike(V)) { + return webidl.converters.Blob(V, { strict: false }) + } -function buildProxyOptions (opts) { - if (typeof opts === 'string') { - opts = { uri: opts } + if (types.isArrayBuffer(V) || types.isTypedArray(V) || types.isDataView(V)) { + return webidl.converters.BufferSource(V) } - if (!opts || !opts.uri) { - throw new InvalidArgumentError('Proxy opts.uri is mandatory') + if (util.isFormDataLike(V)) { + return webidl.converters.FormData(V, { strict: false }) } - return { - uri: opts.uri, - protocol: opts.protocol || 'https' + if (V instanceof URLSearchParams) { + return webidl.converters.URLSearchParams(V) } -} -function defaultFactory (origin, opts) { - return new Pool(origin, opts) + return webidl.converters.DOMString(V) } -class ProxyAgent extends DispatcherBase { - constructor (opts) { - super(opts) - this[kProxy] = buildProxyOptions(opts) - this[kAgent] = new Agent(opts) - this[kInterceptors] = opts.interceptors && opts.interceptors.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent) - ? opts.interceptors.ProxyAgent - : [] +// https://fetch.spec.whatwg.org/#bodyinit +webidl.converters.BodyInit = function (V) { + if (V instanceof ReadableStream) { + return webidl.converters.ReadableStream(V) + } - if (typeof opts === 'string') { - opts = { uri: opts } - } - - if (!opts || !opts.uri) { - throw new InvalidArgumentError('Proxy opts.uri is mandatory') - } + // Note: the spec doesn't include async iterables, + // this is an undici extension. + if (V?.[Symbol.asyncIterator]) { + return V + } - const { clientFactory = defaultFactory } = opts + return webidl.converters.XMLHttpRequestBodyInit(V) +} - if (typeof clientFactory !== 'function') { - throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.') - } +webidl.converters.ResponseInit = webidl.dictionaryConverter([ + { + key: 'status', + converter: webidl.converters['unsigned short'], + defaultValue: 200 + }, + { + key: 'statusText', + converter: webidl.converters.ByteString, + defaultValue: '' + }, + { + key: 'headers', + converter: webidl.converters.HeadersInit + } +]) - this[kRequestTls] = opts.requestTls - this[kProxyTls] = opts.proxyTls - this[kProxyHeaders] = opts.headers || {} +module.exports = { + makeNetworkError, + makeResponse, + makeAppropriateNetworkError, + filterResponse, + Response, + cloneResponse +} - const resolvedUrl = new URL(opts.uri) - const { origin, port, host, username, password } = resolvedUrl - if (opts.auth && opts.token) { - throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token') - } else if (opts.auth) { - /* @deprecated in favour of opts.token */ - this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}` - } else if (opts.token) { - this[kProxyHeaders]['proxy-authorization'] = opts.token - } else if (username && password) { - this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}` - } +/***/ }), - const connect = buildConnector({ ...opts.proxyTls }) - this[kConnectEndpoint] = buildConnector({ ...opts.requestTls }) - this[kClient] = clientFactory(resolvedUrl, { connect }) - this[kAgent] = new Agent({ - ...opts, - connect: async (opts, callback) => { - let requestedHost = opts.host - if (!opts.port) { - requestedHost += `:${defaultProtocolPort(opts.protocol)}` - } - try { - const { socket, statusCode } = await this[kClient].connect({ - origin, - port, - path: requestedHost, - signal: opts.signal, - headers: { - ...this[kProxyHeaders], - host - } - }) - if (statusCode !== 200) { - socket.on('error', () => {}).destroy() - callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`)) - } - if (opts.protocol !== 'https:') { - callback(null, socket) - return - } - let servername - if (this[kRequestTls]) { - servername = this[kRequestTls].servername - } else { - servername = opts.servername - } - this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback) - } catch (err) { - callback(err) - } - } - }) - } +/***/ 15861: +/***/ ((module) => { - dispatch (opts, handler) { - const { host } = new URL(opts.origin) - const headers = buildHeaders(opts.headers) - throwIfProxyAuthIsSent(headers) - return this[kAgent].dispatch( - { - ...opts, - headers: { - ...headers, - host - } - }, - handler - ) - } +"use strict"; - async [kClose] () { - await this[kAgent].close() - await this[kClient].close() - } - async [kDestroy] () { - await this[kAgent].destroy() - await this[kClient].destroy() - } +module.exports = { + kUrl: Symbol('url'), + kHeaders: Symbol('headers'), + kSignal: Symbol('signal'), + kState: Symbol('state'), + kGuard: Symbol('guard'), + kRealm: Symbol('realm') } -/** - * @param {string[] | Record} headers - * @returns {Record} - */ -function buildHeaders (headers) { - // When using undici.fetch, the headers list is stored - // as an array. - if (Array.isArray(headers)) { - /** @type {Record} */ - const headersPair = {} - for (let i = 0; i < headers.length; i += 2) { - headersPair[headers[i]] = headers[i + 1] - } +/***/ }), - return headersPair - } +/***/ 52538: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - return headers -} +"use strict"; -/** - * @param {Record} headers - * - * Previous versions of ProxyAgent suggests the Proxy-Authorization in request headers - * Nevertheless, it was changed and to avoid a security vulnerability by end users - * this check was created. - * It should be removed in the next major version for performance reasons - */ -function throwIfProxyAuthIsSent (headers) { - const existProxyAuth = headers && Object.keys(headers) - .find((key) => key.toLowerCase() === 'proxy-authorization') - if (existProxyAuth) { - throw new InvalidArgumentError('Proxy-Authorization should be sent in ProxyAgent constructor') - } + +const { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = __nccwpck_require__(41037) +const { getGlobalOrigin } = __nccwpck_require__(71246) +const { performance } = __nccwpck_require__(4074) +const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(83983) +const assert = __nccwpck_require__(39491) +const { isUint8Array } = __nccwpck_require__(29830) + +let supportedHashes = [] + +// https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable +/** @type {import('crypto')|undefined} */ +let crypto + +try { + crypto = __nccwpck_require__(6113) + const possibleRelevantHashes = ['sha256', 'sha384', 'sha512'] + supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)) +/* c8 ignore next 3 */ +} catch { } -module.exports = ProxyAgent +function responseURL (response) { + // https://fetch.spec.whatwg.org/#responses + // A response has an associated URL. It is a pointer to the last URL + // in response’s URL list and null if response’s URL list is empty. + const urlList = response.urlList + const length = urlList.length + return length === 0 ? null : urlList[length - 1].toString() +} +// https://fetch.spec.whatwg.org/#concept-response-location-url +function responseLocationURL (response, requestFragment) { + // 1. If response’s status is not a redirect status, then return null. + if (!redirectStatusSet.has(response.status)) { + return null + } -/***/ }), + // 2. Let location be the result of extracting header list values given + // `Location` and response’s header list. + let location = response.headersList.get('location') -/***/ 29459: -/***/ ((module) => { + // 3. If location is a header value, then set location to the result of + // parsing location with response’s URL. + if (location !== null && isValidHeaderValue(location)) { + location = new URL(location, responseURL(response)) + } -"use strict"; + // 4. If location is a URL whose fragment is null, then set location’s + // fragment to requestFragment. + if (location && !location.hash) { + location.hash = requestFragment + } + // 5. Return location. + return location +} -let fastNow = Date.now() -let fastNowTimeout +/** @returns {URL} */ +function requestCurrentURL (request) { + return request.urlList[request.urlList.length - 1] +} -const fastTimers = [] +function requestBadPort (request) { + // 1. Let url be request’s current URL. + const url = requestCurrentURL(request) -function onTimeout () { - fastNow = Date.now() + // 2. If url’s scheme is an HTTP(S) scheme and url’s port is a bad port, + // then return blocked. + if (urlIsHttpHttpsScheme(url) && badPortsSet.has(url.port)) { + return 'blocked' + } - let len = fastTimers.length - let idx = 0 - while (idx < len) { - const timer = fastTimers[idx] + // 3. Return allowed. + return 'allowed' +} - if (timer.state === 0) { - timer.state = fastNow + timer.delay - } else if (timer.state > 0 && fastNow >= timer.state) { - timer.state = -1 - timer.callback(timer.opaque) - } +function isErrorLike (object) { + return object instanceof Error || ( + object?.constructor?.name === 'Error' || + object?.constructor?.name === 'DOMException' + ) +} - if (timer.state === -1) { - timer.state = -2 - if (idx !== len - 1) { - fastTimers[idx] = fastTimers.pop() - } else { - fastTimers.pop() - } - len -= 1 - } else { - idx += 1 +// Check whether |statusText| is a ByteString and +// matches the Reason-Phrase token production. +// RFC 2616: https://tools.ietf.org/html/rfc2616 +// RFC 7230: https://tools.ietf.org/html/rfc7230 +// "reason-phrase = *( HTAB / SP / VCHAR / obs-text )" +// https://github.com/chromium/chromium/blob/94.0.4604.1/third_party/blink/renderer/core/fetch/response.cc#L116 +function isValidReasonPhrase (statusText) { + for (let i = 0; i < statusText.length; ++i) { + const c = statusText.charCodeAt(i) + if ( + !( + ( + c === 0x09 || // HTAB + (c >= 0x20 && c <= 0x7e) || // SP / VCHAR + (c >= 0x80 && c <= 0xff) + ) // obs-text + ) + ) { + return false } } + return true +} - if (fastTimers.length > 0) { - refreshTimeout() +/** + * @see https://tools.ietf.org/html/rfc7230#section-3.2.6 + * @param {number} c + */ +function isTokenCharCode (c) { + switch (c) { + case 0x22: + case 0x28: + case 0x29: + case 0x2c: + case 0x2f: + case 0x3a: + case 0x3b: + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + case 0x40: + case 0x5b: + case 0x5c: + case 0x5d: + case 0x7b: + case 0x7d: + // DQUOTE and "(),/:;<=>?@[\]{}" + return false + default: + // VCHAR %x21-7E + return c >= 0x21 && c <= 0x7e } } -function refreshTimeout () { - if (fastNowTimeout && fastNowTimeout.refresh) { - fastNowTimeout.refresh() - } else { - clearTimeout(fastNowTimeout) - fastNowTimeout = setTimeout(onTimeout, 1e3) - if (fastNowTimeout.unref) { - fastNowTimeout.unref() +/** + * @param {string} characters + */ +function isValidHTTPToken (characters) { + if (characters.length === 0) { + return false + } + for (let i = 0; i < characters.length; ++i) { + if (!isTokenCharCode(characters.charCodeAt(i))) { + return false } } + return true } -class Timeout { - constructor (callback, delay, opaque) { - this.callback = callback - this.delay = delay - this.opaque = opaque +/** + * @see https://fetch.spec.whatwg.org/#header-name + * @param {string} potentialValue + */ +function isValidHeaderName (potentialValue) { + return isValidHTTPToken(potentialValue) +} - // -2 not in timer list - // -1 in timer list but inactive - // 0 in timer list waiting for time - // > 0 in timer list waiting for time to expire - this.state = -2 +/** + * @see https://fetch.spec.whatwg.org/#header-value + * @param {string} potentialValue + */ +function isValidHeaderValue (potentialValue) { + // - Has no leading or trailing HTTP tab or space bytes. + // - Contains no 0x00 (NUL) or HTTP newline bytes. + if ( + potentialValue.startsWith('\t') || + potentialValue.startsWith(' ') || + potentialValue.endsWith('\t') || + potentialValue.endsWith(' ') + ) { + return false + } - this.refresh() + if ( + potentialValue.includes('\0') || + potentialValue.includes('\r') || + potentialValue.includes('\n') + ) { + return false } - refresh () { - if (this.state === -2) { - fastTimers.push(this) - if (!fastNowTimeout || fastTimers.length === 1) { - refreshTimeout() + return true +} + +// https://w3c.github.io/webappsec-referrer-policy/#set-requests-referrer-policy-on-redirect +function setRequestReferrerPolicyOnRedirect (request, actualResponse) { + // Given a request request and a response actualResponse, this algorithm + // updates request’s referrer policy according to the Referrer-Policy + // header (if any) in actualResponse. + + // 1. Let policy be the result of executing § 8.1 Parse a referrer policy + // from a Referrer-Policy header on actualResponse. + + // 8.1 Parse a referrer policy from a Referrer-Policy header + // 1. Let policy-tokens be the result of extracting header list values given `Referrer-Policy` and response’s header list. + const { headersList } = actualResponse + // 2. Let policy be the empty string. + // 3. For each token in policy-tokens, if token is a referrer policy and token is not the empty string, then set policy to token. + // 4. Return policy. + const policyHeader = (headersList.get('referrer-policy') ?? '').split(',') + + // Note: As the referrer-policy can contain multiple policies + // separated by comma, we need to loop through all of them + // and pick the first valid one. + // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#specify_a_fallback_policy + let policy = '' + if (policyHeader.length > 0) { + // The right-most policy takes precedence. + // The left-most policy is the fallback. + for (let i = policyHeader.length; i !== 0; i--) { + const token = policyHeader[i - 1].trim() + if (referrerPolicyTokens.has(token)) { + policy = token + break } } - - this.state = 0 } - clear () { - this.state = -1 + // 2. If policy is not the empty string, then set request’s referrer policy to policy. + if (policy !== '') { + request.referrerPolicy = policy } } -module.exports = { - setTimeout (callback, delay, opaque) { - return delay < 1e3 - ? setTimeout(callback, delay, opaque) - : new Timeout(callback, delay, opaque) - }, - clearTimeout (timeout) { - if (timeout instanceof Timeout) { - timeout.clear() - } else { - clearTimeout(timeout) - } - } +// https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check +function crossOriginResourcePolicyCheck () { + // TODO + return 'allowed' } +// https://fetch.spec.whatwg.org/#concept-cors-check +function corsCheck () { + // TODO + return 'success' +} -/***/ }), +// https://fetch.spec.whatwg.org/#concept-tao-check +function TAOCheck () { + // TODO + return 'success' +} -/***/ 35354: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function appendFetchMetadata (httpRequest) { + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-dest-header + // TODO -"use strict"; + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-mode-header + // 1. Assert: r’s url is a potentially trustworthy URL. + // TODO -const diagnosticsChannel = __nccwpck_require__(67643) -const { uid, states } = __nccwpck_require__(19188) -const { - kReadyState, - kSentClose, - kByteParser, - kReceivedClose -} = __nccwpck_require__(37578) -const { fireEvent, failWebsocketConnection } = __nccwpck_require__(25515) -const { CloseEvent } = __nccwpck_require__(52611) -const { makeRequest } = __nccwpck_require__(48359) -const { fetching } = __nccwpck_require__(74881) -const { Headers } = __nccwpck_require__(10554) -const { getGlobalDispatcher } = __nccwpck_require__(21892) -const { kHeadersList } = __nccwpck_require__(72785) + // 2. Let header be a Structured Header whose value is a token. + let header = null -const channels = {} -channels.open = diagnosticsChannel.channel('undici:websocket:open') -channels.close = diagnosticsChannel.channel('undici:websocket:close') -channels.socketError = diagnosticsChannel.channel('undici:websocket:socket_error') + // 3. Set header’s value to r’s mode. + header = httpRequest.mode -/** @type {import('crypto')} */ -let crypto -try { - crypto = __nccwpck_require__(6113) -} catch { + // 4. Set a structured field value `Sec-Fetch-Mode`/header in r’s header list. + httpRequest.headersList.set('sec-fetch-mode', header) + + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-site-header + // TODO + // https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-user-header + // TODO } -/** - * @see https://websockets.spec.whatwg.org/#concept-websocket-establish - * @param {URL} url - * @param {string|string[]} protocols - * @param {import('./websocket').WebSocket} ws - * @param {(response: any) => void} onEstablish - * @param {Partial} options - */ -function establishWebSocketConnection (url, protocols, ws, onEstablish, options) { - // 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s - // scheme is "ws", and to "https" otherwise. - const requestURL = url +// https://fetch.spec.whatwg.org/#append-a-request-origin-header +function appendRequestOriginHeader (request) { + // 1. Let serializedOrigin be the result of byte-serializing a request origin with request. + let serializedOrigin = request.origin - requestURL.protocol = url.protocol === 'ws:' ? 'http:' : 'https:' - - // 2. Let request be a new request, whose URL is requestURL, client is client, - // service-workers mode is "none", referrer is "no-referrer", mode is - // "websocket", credentials mode is "include", cache mode is "no-store" , - // and redirect mode is "error". - const request = makeRequest({ - urlList: [requestURL], - serviceWorkers: 'none', - referrer: 'no-referrer', - mode: 'websocket', - credentials: 'include', - cache: 'no-store', - redirect: 'error' - }) + // 2. If request’s response tainting is "cors" or request’s mode is "websocket", then append (`Origin`, serializedOrigin) to request’s header list. + if (request.responseTainting === 'cors' || request.mode === 'websocket') { + if (serializedOrigin) { + request.headersList.append('origin', serializedOrigin) + } - // Note: undici extension, allow setting custom headers. - if (options.headers) { - const headersList = new Headers(options.headers)[kHeadersList] + // 3. Otherwise, if request’s method is neither `GET` nor `HEAD`, then: + } else if (request.method !== 'GET' && request.method !== 'HEAD') { + // 1. Switch on request’s referrer policy: + switch (request.referrerPolicy) { + case 'no-referrer': + // Set serializedOrigin to `null`. + serializedOrigin = null + break + case 'no-referrer-when-downgrade': + case 'strict-origin': + case 'strict-origin-when-cross-origin': + // If request’s origin is a tuple origin, its scheme is "https", and request’s current URL’s scheme is not "https", then set serializedOrigin to `null`. + if (request.origin && urlHasHttpsScheme(request.origin) && !urlHasHttpsScheme(requestCurrentURL(request))) { + serializedOrigin = null + } + break + case 'same-origin': + // If request’s origin is not same origin with request’s current URL’s origin, then set serializedOrigin to `null`. + if (!sameOrigin(request, requestCurrentURL(request))) { + serializedOrigin = null + } + break + default: + // Do nothing. + } - request.headersList = headersList + if (serializedOrigin) { + // 2. Append (`Origin`, serializedOrigin) to request’s header list. + request.headersList.append('origin', serializedOrigin) + } } +} - // 3. Append (`Upgrade`, `websocket`) to request’s header list. - // 4. Append (`Connection`, `Upgrade`) to request’s header list. - // Note: both of these are handled by undici currently. - // https://github.com/nodejs/undici/blob/68c269c4144c446f3f1220951338daef4a6b5ec4/lib/client.js#L1397 - - // 5. Let keyValue be a nonce consisting of a randomly selected - // 16-byte value that has been forgiving-base64-encoded and - // isomorphic encoded. - const keyValue = crypto.randomBytes(16).toString('base64') +function coarsenedSharedCurrentTime (crossOriginIsolatedCapability) { + // TODO + return performance.now() +} - // 6. Append (`Sec-WebSocket-Key`, keyValue) to request’s - // header list. - request.headersList.append('sec-websocket-key', keyValue) +// https://fetch.spec.whatwg.org/#create-an-opaque-timing-info +function createOpaqueTimingInfo (timingInfo) { + return { + startTime: timingInfo.startTime ?? 0, + redirectStartTime: 0, + redirectEndTime: 0, + postRedirectStartTime: timingInfo.startTime ?? 0, + finalServiceWorkerStartTime: 0, + finalNetworkResponseStartTime: 0, + finalNetworkRequestStartTime: 0, + endTime: 0, + encodedBodySize: 0, + decodedBodySize: 0, + finalConnectionTimingInfo: null + } +} - // 7. Append (`Sec-WebSocket-Version`, `13`) to request’s - // header list. - request.headersList.append('sec-websocket-version', '13') +// https://html.spec.whatwg.org/multipage/origin.html#policy-container +function makePolicyContainer () { + // Note: the fetch spec doesn't make use of embedder policy or CSP list + return { + referrerPolicy: 'strict-origin-when-cross-origin' + } +} - // 8. For each protocol in protocols, combine - // (`Sec-WebSocket-Protocol`, protocol) in request’s header - // list. - for (const protocol of protocols) { - request.headersList.append('sec-websocket-protocol', protocol) +// https://html.spec.whatwg.org/multipage/origin.html#clone-a-policy-container +function clonePolicyContainer (policyContainer) { + return { + referrerPolicy: policyContainer.referrerPolicy } +} - // 9. Let permessageDeflate be a user-agent defined - // "permessage-deflate" extension header value. - // https://github.com/mozilla/gecko-dev/blob/ce78234f5e653a5d3916813ff990f053510227bc/netwerk/protocol/websocket/WebSocketChannel.cpp#L2673 - // TODO: enable once permessage-deflate is supported - const permessageDeflate = '' // 'permessage-deflate; 15' +// https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer +function determineRequestsReferrer (request) { + // 1. Let policy be request's referrer policy. + const policy = request.referrerPolicy - // 10. Append (`Sec-WebSocket-Extensions`, permessageDeflate) to - // request’s header list. - // request.headersList.append('sec-websocket-extensions', permessageDeflate) + // Note: policy cannot (shouldn't) be null or an empty string. + assert(policy) - // 11. Fetch request with useParallelQueue set to true, and - // processResponse given response being these steps: - const controller = fetching({ - request, - useParallelQueue: true, - dispatcher: options.dispatcher ?? getGlobalDispatcher(), - processResponse (response) { - // 1. If response is a network error or its status is not 101, - // fail the WebSocket connection. - if (response.type === 'error' || response.status !== 101) { - failWebsocketConnection(ws, 'Received network error or non-101 status code.') - return - } + // 2. Let environment be request’s client. - // 2. If protocols is not the empty list and extracting header - // list values given `Sec-WebSocket-Protocol` and response’s - // header list results in null, failure, or the empty byte - // sequence, then fail the WebSocket connection. - if (protocols.length !== 0 && !response.headersList.get('Sec-WebSocket-Protocol')) { - failWebsocketConnection(ws, 'Server did not respond with sent protocols.') - return - } + let referrerSource = null - // 3. Follow the requirements stated step 2 to step 6, inclusive, - // of the last set of steps in section 4.1 of The WebSocket - // Protocol to validate response. This either results in fail - // the WebSocket connection or the WebSocket connection is - // established. + // 3. Switch on request’s referrer: + if (request.referrer === 'client') { + // Note: node isn't a browser and doesn't implement document/iframes, + // so we bypass this step and replace it with our own. - // 2. If the response lacks an |Upgrade| header field or the |Upgrade| - // header field contains a value that is not an ASCII case- - // insensitive match for the value "websocket", the client MUST - // _Fail the WebSocket Connection_. - if (response.headersList.get('Upgrade')?.toLowerCase() !== 'websocket') { - failWebsocketConnection(ws, 'Server did not set Upgrade header to "websocket".') - return - } + const globalOrigin = getGlobalOrigin() - // 3. If the response lacks a |Connection| header field or the - // |Connection| header field doesn't contain a token that is an - // ASCII case-insensitive match for the value "Upgrade", the client - // MUST _Fail the WebSocket Connection_. - if (response.headersList.get('Connection')?.toLowerCase() !== 'upgrade') { - failWebsocketConnection(ws, 'Server did not set Connection header to "upgrade".') - return - } + if (!globalOrigin || globalOrigin.origin === 'null') { + return 'no-referrer' + } - // 4. If the response lacks a |Sec-WebSocket-Accept| header field or - // the |Sec-WebSocket-Accept| contains a value other than the - // base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket- - // Key| (as a string, not base64-decoded) with the string "258EAFA5- - // E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and - // trailing whitespace, the client MUST _Fail the WebSocket - // Connection_. - const secWSAccept = response.headersList.get('Sec-WebSocket-Accept') - const digest = crypto.createHash('sha1').update(keyValue + uid).digest('base64') - if (secWSAccept !== digest) { - failWebsocketConnection(ws, 'Incorrect hash received in Sec-WebSocket-Accept header.') - return - } + // note: we need to clone it as it's mutated + referrerSource = new URL(globalOrigin) + } else if (request.referrer instanceof URL) { + // Let referrerSource be request’s referrer. + referrerSource = request.referrer + } - // 5. If the response includes a |Sec-WebSocket-Extensions| header - // field and this header field indicates the use of an extension - // that was not present in the client's handshake (the server has - // indicated an extension not requested by the client), the client - // MUST _Fail the WebSocket Connection_. (The parsing of this - // header field to determine which extensions are requested is - // discussed in Section 9.1.) - const secExtension = response.headersList.get('Sec-WebSocket-Extensions') + // 4. Let request’s referrerURL be the result of stripping referrerSource for + // use as a referrer. + let referrerURL = stripURLForReferrer(referrerSource) - if (secExtension !== null && secExtension !== permessageDeflate) { - failWebsocketConnection(ws, 'Received different permessage-deflate than the one set.') - return - } + // 5. Let referrerOrigin be the result of stripping referrerSource for use as + // a referrer, with the origin-only flag set to true. + const referrerOrigin = stripURLForReferrer(referrerSource, true) - // 6. If the response includes a |Sec-WebSocket-Protocol| header field - // and this header field indicates the use of a subprotocol that was - // not present in the client's handshake (the server has indicated a - // subprotocol not requested by the client), the client MUST _Fail - // the WebSocket Connection_. - const secProtocol = response.headersList.get('Sec-WebSocket-Protocol') + // 6. If the result of serializing referrerURL is a string whose length is + // greater than 4096, set referrerURL to referrerOrigin. + if (referrerURL.toString().length > 4096) { + referrerURL = referrerOrigin + } - if (secProtocol !== null && secProtocol !== request.headersList.get('Sec-WebSocket-Protocol')) { - failWebsocketConnection(ws, 'Protocol was not set in the opening handshake.') - return - } + const areSameOrigin = sameOrigin(request, referrerURL) + const isNonPotentiallyTrustWorthy = isURLPotentiallyTrustworthy(referrerURL) && + !isURLPotentiallyTrustworthy(request.url) - response.socket.on('data', onSocketData) - response.socket.on('close', onSocketClose) - response.socket.on('error', onSocketError) + // 8. Execute the switch statements corresponding to the value of policy: + switch (policy) { + case 'origin': return referrerOrigin != null ? referrerOrigin : stripURLForReferrer(referrerSource, true) + case 'unsafe-url': return referrerURL + case 'same-origin': + return areSameOrigin ? referrerOrigin : 'no-referrer' + case 'origin-when-cross-origin': + return areSameOrigin ? referrerURL : referrerOrigin + case 'strict-origin-when-cross-origin': { + const currentURL = requestCurrentURL(request) - if (channels.open.hasSubscribers) { - channels.open.publish({ - address: response.socket.address(), - protocol: secProtocol, - extensions: secExtension - }) + // 1. If the origin of referrerURL and the origin of request’s current + // URL are the same, then return referrerURL. + if (sameOrigin(referrerURL, currentURL)) { + return referrerURL } - onEstablish(response) - } - }) + // 2. If referrerURL is a potentially trustworthy URL and request’s + // current URL is not a potentially trustworthy URL, then return no + // referrer. + if (isURLPotentiallyTrustworthy(referrerURL) && !isURLPotentiallyTrustworthy(currentURL)) { + return 'no-referrer' + } - return controller -} + // 3. Return referrerOrigin. + return referrerOrigin + } + case 'strict-origin': // eslint-disable-line + /** + * 1. If referrerURL is a potentially trustworthy URL and + * request’s current URL is not a potentially trustworthy URL, + * then return no referrer. + * 2. Return referrerOrigin + */ + case 'no-referrer-when-downgrade': // eslint-disable-line + /** + * 1. If referrerURL is a potentially trustworthy URL and + * request’s current URL is not a potentially trustworthy URL, + * then return no referrer. + * 2. Return referrerOrigin + */ -/** - * @param {Buffer} chunk - */ -function onSocketData (chunk) { - if (!this.ws[kByteParser].write(chunk)) { - this.pause() + default: // eslint-disable-line + return isNonPotentiallyTrustWorthy ? 'no-referrer' : referrerOrigin } } /** - * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol - * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.4 + * @see https://w3c.github.io/webappsec-referrer-policy/#strip-url + * @param {URL} url + * @param {boolean|undefined} originOnly */ -function onSocketClose () { - const { ws } = this - - // If the TCP connection was closed after the - // WebSocket closing handshake was completed, the WebSocket connection - // is said to have been closed _cleanly_. - const wasClean = ws[kSentClose] && ws[kReceivedClose] - - let code = 1005 - let reason = '' - - const result = ws[kByteParser].closingInfo +function stripURLForReferrer (url, originOnly) { + // 1. Assert: url is a URL. + assert(url instanceof URL) - if (result) { - code = result.code ?? 1005 - reason = result.reason - } else if (!ws[kSentClose]) { - // If _The WebSocket - // Connection is Closed_ and no Close control frame was received by the - // endpoint (such as could occur if the underlying transport connection - // is lost), _The WebSocket Connection Close Code_ is considered to be - // 1006. - code = 1006 + // 2. If url’s scheme is a local scheme, then return no referrer. + if (url.protocol === 'file:' || url.protocol === 'about:' || url.protocol === 'blank:') { + return 'no-referrer' } - // 1. Change the ready state to CLOSED (3). - ws[kReadyState] = states.CLOSED - - // 2. If the user agent was required to fail the WebSocket - // connection, or if the WebSocket connection was closed - // after being flagged as full, fire an event named error - // at the WebSocket object. - // TODO - - // 3. Fire an event named close at the WebSocket object, - // using CloseEvent, with the wasClean attribute - // initialized to true if the connection closed cleanly - // and false otherwise, the code attribute initialized to - // the WebSocket connection close code, and the reason - // attribute initialized to the result of applying UTF-8 - // decode without BOM to the WebSocket connection close - // reason. - fireEvent('close', ws, CloseEvent, { - wasClean, code, reason - }) + // 3. Set url’s username to the empty string. + url.username = '' - if (channels.close.hasSubscribers) { - channels.close.publish({ - websocket: ws, - code, - reason - }) - } -} + // 4. Set url’s password to the empty string. + url.password = '' -function onSocketError (error) { - const { ws } = this + // 5. Set url’s fragment to null. + url.hash = '' - ws[kReadyState] = states.CLOSING + // 6. If the origin-only flag is true, then: + if (originOnly) { + // 1. Set url’s path to « the empty string ». + url.pathname = '' - if (channels.socketError.hasSubscribers) { - channels.socketError.publish(error) + // 2. Set url’s query to null. + url.search = '' } - this.destroy() -} - -module.exports = { - establishWebSocketConnection + // 7. Return url. + return url } +function isURLPotentiallyTrustworthy (url) { + if (!(url instanceof URL)) { + return false + } -/***/ }), - -/***/ 19188: -/***/ ((module) => { - -"use strict"; - + // If child of about, return true + if (url.href === 'about:blank' || url.href === 'about:srcdoc') { + return true + } -// This is a Globally Unique Identifier unique used -// to validate that the endpoint accepts websocket -// connections. -// See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3 -const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' + // If scheme is data, return true + if (url.protocol === 'data:') return true -/** @type {PropertyDescriptor} */ -const staticPropertyDescriptors = { - enumerable: true, - writable: false, - configurable: false -} + // If file, return true + if (url.protocol === 'file:') return true -const states = { - CONNECTING: 0, - OPEN: 1, - CLOSING: 2, - CLOSED: 3 -} + return isOriginPotentiallyTrustworthy(url.origin) -const opcodes = { - CONTINUATION: 0x0, - TEXT: 0x1, - BINARY: 0x2, - CLOSE: 0x8, - PING: 0x9, - PONG: 0xA -} + function isOriginPotentiallyTrustworthy (origin) { + // If origin is explicitly null, return false + if (origin == null || origin === 'null') return false -const maxUnsigned16Bit = 2 ** 16 - 1 // 65535 + const originAsURL = new URL(origin) -const parserStates = { - INFO: 0, - PAYLOADLENGTH_16: 2, - PAYLOADLENGTH_64: 3, - READ_DATA: 4 -} + // If secure, return true + if (originAsURL.protocol === 'https:' || originAsURL.protocol === 'wss:') { + return true + } -const emptyBuffer = Buffer.allocUnsafe(0) + // If localhost or variants, return true + if (/^127(?:\.[0-9]+){0,2}\.[0-9]+$|^\[(?:0*:)*?:?0*1\]$/.test(originAsURL.hostname) || + (originAsURL.hostname === 'localhost' || originAsURL.hostname.includes('localhost.')) || + (originAsURL.hostname.endsWith('.localhost'))) { + return true + } -module.exports = { - uid, - staticPropertyDescriptors, - states, - opcodes, - maxUnsigned16Bit, - parserStates, - emptyBuffer + // If any other, return false + return false + } } - -/***/ }), - -/***/ 52611: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const { webidl } = __nccwpck_require__(21744) -const { kEnumerableProperty } = __nccwpck_require__(83983) -const { MessagePort } = __nccwpck_require__(71267) - /** - * @see https://html.spec.whatwg.org/multipage/comms.html#messageevent + * @see https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist + * @param {Uint8Array} bytes + * @param {string} metadataList */ -class MessageEvent extends Event { - #eventInit - - constructor (type, eventInitDict = {}) { - webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent constructor' }) - - type = webidl.converters.DOMString(type) - eventInitDict = webidl.converters.MessageEventInit(eventInitDict) - - super(type, eventInitDict) - - this.#eventInit = eventInitDict +function bytesMatch (bytes, metadataList) { + // If node is not built with OpenSSL support, we cannot check + // a request's integrity, so allow it by default (the spec will + // allow requests if an invalid hash is given, as precedence). + /* istanbul ignore if: only if node is built with --without-ssl */ + if (crypto === undefined) { + return true } - get data () { - webidl.brandCheck(this, MessageEvent) + // 1. Let parsedMetadata be the result of parsing metadataList. + const parsedMetadata = parseMetadata(metadataList) - return this.#eventInit.data + // 2. If parsedMetadata is no metadata, return true. + if (parsedMetadata === 'no metadata') { + return true } - get origin () { - webidl.brandCheck(this, MessageEvent) + // 3. If response is not eligible for integrity validation, return false. + // TODO - return this.#eventInit.origin + // 4. If parsedMetadata is the empty set, return true. + if (parsedMetadata.length === 0) { + return true } - get lastEventId () { - webidl.brandCheck(this, MessageEvent) + // 5. Let metadata be the result of getting the strongest + // metadata from parsedMetadata. + const strongest = getStrongestMetadata(parsedMetadata) + const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest) - return this.#eventInit.lastEventId - } + // 6. For each item in metadata: + for (const item of metadata) { + // 1. Let algorithm be the alg component of item. + const algorithm = item.algo - get source () { - webidl.brandCheck(this, MessageEvent) + // 2. Let expectedValue be the val component of item. + const expectedValue = item.hash - return this.#eventInit.source - } + // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e + // "be liberal with padding". This is annoying, and it's not even in the spec. - get ports () { - webidl.brandCheck(this, MessageEvent) + // 3. Let actualValue be the result of applying algorithm to bytes. + let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') - if (!Object.isFrozen(this.#eventInit.ports)) { - Object.freeze(this.#eventInit.ports) + if (actualValue[actualValue.length - 1] === '=') { + if (actualValue[actualValue.length - 2] === '=') { + actualValue = actualValue.slice(0, -2) + } else { + actualValue = actualValue.slice(0, -1) + } } - return this.#eventInit.ports + // 4. If actualValue is a case-sensitive match for expectedValue, + // return true. + if (compareBase64Mixed(actualValue, expectedValue)) { + return true + } } - initMessageEvent ( - type, - bubbles = false, - cancelable = false, - data = null, - origin = '', - lastEventId = '', - source = null, - ports = [] - ) { - webidl.brandCheck(this, MessageEvent) - - webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent.initMessageEvent' }) - - return new MessageEvent(type, { - bubbles, cancelable, data, origin, lastEventId, source, ports - }) - } + // 7. Return false. + return false } +// https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options +// https://www.w3.org/TR/CSP2/#source-list-syntax +// https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1 +const parseHashWithOptions = /(?sha256|sha384|sha512)-((?[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i + /** - * @see https://websockets.spec.whatwg.org/#the-closeevent-interface + * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata + * @param {string} metadata */ -class CloseEvent extends Event { - #eventInit +function parseMetadata (metadata) { + // 1. Let result be the empty set. + /** @type {{ algo: string, hash: string }[]} */ + const result = [] - constructor (type, eventInitDict = {}) { - webidl.argumentLengthCheck(arguments, 1, { header: 'CloseEvent constructor' }) + // 2. Let empty be equal to true. + let empty = true - type = webidl.converters.DOMString(type) - eventInitDict = webidl.converters.CloseEventInit(eventInitDict) + // 3. For each token returned by splitting metadata on spaces: + for (const token of metadata.split(' ')) { + // 1. Set empty to false. + empty = false - super(type, eventInitDict) + // 2. Parse token as a hash-with-options. + const parsedToken = parseHashWithOptions.exec(token) - this.#eventInit = eventInitDict - } + // 3. If token does not parse, continue to the next token. + if ( + parsedToken === null || + parsedToken.groups === undefined || + parsedToken.groups.algo === undefined + ) { + // Note: Chromium blocks the request at this point, but Firefox + // gives a warning that an invalid integrity was given. The + // correct behavior is to ignore these, and subsequently not + // check the integrity of the resource. + continue + } - get wasClean () { - webidl.brandCheck(this, CloseEvent) + // 4. Let algorithm be the hash-algo component of token. + const algorithm = parsedToken.groups.algo.toLowerCase() - return this.#eventInit.wasClean + // 5. If algorithm is a hash function recognized by the user + // agent, add the parsed token to result. + if (supportedHashes.includes(algorithm)) { + result.push(parsedToken.groups) + } } - get code () { - webidl.brandCheck(this, CloseEvent) - - return this.#eventInit.code + // 4. Return no metadata if empty is true, otherwise return result. + if (empty === true) { + return 'no metadata' } - get reason () { - webidl.brandCheck(this, CloseEvent) + return result +} - return this.#eventInit.reason +/** + * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList + */ +function getStrongestMetadata (metadataList) { + // Let algorithm be the algo component of the first item in metadataList. + // Can be sha256 + let algorithm = metadataList[0].algo + // If the algorithm is sha512, then it is the strongest + // and we can return immediately + if (algorithm[3] === '5') { + return algorithm + } + + for (let i = 1; i < metadataList.length; ++i) { + const metadata = metadataList[i] + // If the algorithm is sha512, then it is the strongest + // and we can break the loop immediately + if (metadata.algo[3] === '5') { + algorithm = 'sha512' + break + // If the algorithm is sha384, then a potential sha256 or sha384 is ignored + } else if (algorithm[3] === '3') { + continue + // algorithm is sha256, check if algorithm is sha384 and if so, set it as + // the strongest + } else if (metadata.algo[3] === '3') { + algorithm = 'sha384' + } } + return algorithm } -// https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface -class ErrorEvent extends Event { - #eventInit +function filterMetadataListByAlgorithm (metadataList, algorithm) { + if (metadataList.length === 1) { + return metadataList + } - constructor (type, eventInitDict) { - webidl.argumentLengthCheck(arguments, 1, { header: 'ErrorEvent constructor' }) + let pos = 0 + for (let i = 0; i < metadataList.length; ++i) { + if (metadataList[i].algo === algorithm) { + metadataList[pos++] = metadataList[i] + } + } - super(type, eventInitDict) + metadataList.length = pos - type = webidl.converters.DOMString(type) - eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {}) + return metadataList +} - this.#eventInit = eventInitDict +/** + * Compares two base64 strings, allowing for base64url + * in the second string. + * +* @param {string} actualValue always base64 + * @param {string} expectedValue base64 or base64url + * @returns {boolean} + */ +function compareBase64Mixed (actualValue, expectedValue) { + if (actualValue.length !== expectedValue.length) { + return false } - - get message () { - webidl.brandCheck(this, ErrorEvent) - - return this.#eventInit.message + for (let i = 0; i < actualValue.length; ++i) { + if (actualValue[i] !== expectedValue[i]) { + if ( + (actualValue[i] === '+' && expectedValue[i] === '-') || + (actualValue[i] === '/' && expectedValue[i] === '_') + ) { + continue + } + return false + } } - get filename () { - webidl.brandCheck(this, ErrorEvent) - - return this.#eventInit.filename - } + return true +} - get lineno () { - webidl.brandCheck(this, ErrorEvent) +// https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request +function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { + // TODO +} - return this.#eventInit.lineno +/** + * @link {https://html.spec.whatwg.org/multipage/origin.html#same-origin} + * @param {URL} A + * @param {URL} B + */ +function sameOrigin (A, B) { + // 1. If A and B are the same opaque origin, then return true. + if (A.origin === B.origin && A.origin === 'null') { + return true } - get colno () { - webidl.brandCheck(this, ErrorEvent) - - return this.#eventInit.colno + // 2. If A and B are both tuple origins and their schemes, + // hosts, and port are identical, then return true. + if (A.protocol === B.protocol && A.hostname === B.hostname && A.port === B.port) { + return true } - get error () { - webidl.brandCheck(this, ErrorEvent) - - return this.#eventInit.error - } + // 3. Return false. + return false } -Object.defineProperties(MessageEvent.prototype, { - [Symbol.toStringTag]: { - value: 'MessageEvent', - configurable: true - }, - data: kEnumerableProperty, - origin: kEnumerableProperty, - lastEventId: kEnumerableProperty, - source: kEnumerableProperty, - ports: kEnumerableProperty, - initMessageEvent: kEnumerableProperty -}) +function createDeferredPromise () { + let res + let rej + const promise = new Promise((resolve, reject) => { + res = resolve + rej = reject + }) -Object.defineProperties(CloseEvent.prototype, { - [Symbol.toStringTag]: { - value: 'CloseEvent', - configurable: true - }, - reason: kEnumerableProperty, - code: kEnumerableProperty, - wasClean: kEnumerableProperty -}) + return { promise, resolve: res, reject: rej } +} -Object.defineProperties(ErrorEvent.prototype, { - [Symbol.toStringTag]: { - value: 'ErrorEvent', - configurable: true - }, - message: kEnumerableProperty, - filename: kEnumerableProperty, - lineno: kEnumerableProperty, - colno: kEnumerableProperty, - error: kEnumerableProperty -}) +function isAborted (fetchParams) { + return fetchParams.controller.state === 'aborted' +} -webidl.converters.MessagePort = webidl.interfaceConverter(MessagePort) +function isCancelled (fetchParams) { + return fetchParams.controller.state === 'aborted' || + fetchParams.controller.state === 'terminated' +} -webidl.converters['sequence'] = webidl.sequenceConverter( - webidl.converters.MessagePort -) +const normalizeMethodRecord = { + delete: 'DELETE', + DELETE: 'DELETE', + get: 'GET', + GET: 'GET', + head: 'HEAD', + HEAD: 'HEAD', + options: 'OPTIONS', + OPTIONS: 'OPTIONS', + post: 'POST', + POST: 'POST', + put: 'PUT', + PUT: 'PUT' +} -const eventInit = [ - { - key: 'bubbles', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'cancelable', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'composed', - converter: webidl.converters.boolean, - defaultValue: false - } -] +// Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`. +Object.setPrototypeOf(normalizeMethodRecord, null) -webidl.converters.MessageEventInit = webidl.dictionaryConverter([ - ...eventInit, - { - key: 'data', - converter: webidl.converters.any, - defaultValue: null - }, - { - key: 'origin', - converter: webidl.converters.USVString, - defaultValue: '' - }, - { - key: 'lastEventId', - converter: webidl.converters.DOMString, - defaultValue: '' - }, - { - key: 'source', - // Node doesn't implement WindowProxy or ServiceWorker, so the only - // valid value for source is a MessagePort. - converter: webidl.nullableConverter(webidl.converters.MessagePort), - defaultValue: null - }, - { - key: 'ports', - converter: webidl.converters['sequence'], - get defaultValue () { - return [] - } - } -]) +/** + * @see https://fetch.spec.whatwg.org/#concept-method-normalize + * @param {string} method + */ +function normalizeMethod (method) { + return normalizeMethodRecord[method.toLowerCase()] ?? method +} -webidl.converters.CloseEventInit = webidl.dictionaryConverter([ - ...eventInit, - { - key: 'wasClean', - converter: webidl.converters.boolean, - defaultValue: false - }, - { - key: 'code', - converter: webidl.converters['unsigned short'], - defaultValue: 0 - }, - { - key: 'reason', - converter: webidl.converters.USVString, - defaultValue: '' - } -]) +// https://infra.spec.whatwg.org/#serialize-a-javascript-value-to-a-json-string +function serializeJavascriptValueToJSONString (value) { + // 1. Let result be ? Call(%JSON.stringify%, undefined, « value »). + const result = JSON.stringify(value) -webidl.converters.ErrorEventInit = webidl.dictionaryConverter([ - ...eventInit, - { - key: 'message', - converter: webidl.converters.DOMString, - defaultValue: '' - }, - { - key: 'filename', - converter: webidl.converters.USVString, - defaultValue: '' - }, - { - key: 'lineno', - converter: webidl.converters['unsigned long'], - defaultValue: 0 - }, - { - key: 'colno', - converter: webidl.converters['unsigned long'], - defaultValue: 0 - }, - { - key: 'error', - converter: webidl.converters.any + // 2. If result is undefined, then throw a TypeError. + if (result === undefined) { + throw new TypeError('Value is not JSON serializable') } -]) -module.exports = { - MessageEvent, - CloseEvent, - ErrorEvent -} + // 3. Assert: result is a string. + assert(typeof result === 'string') + // 4. Return result. + return result +} -/***/ }), +// https://tc39.es/ecma262/#sec-%25iteratorprototype%25-object +const esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())) -/***/ 25444: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/** + * @see https://webidl.spec.whatwg.org/#dfn-iterator-prototype-object + * @param {() => unknown[]} iterator + * @param {string} name name of the instance + * @param {'key'|'value'|'key+value'} kind + */ +function makeIterator (iterator, name, kind) { + const object = { + index: 0, + kind, + target: iterator + } -"use strict"; + const i = { + next () { + // 1. Let interface be the interface for which the iterator prototype object exists. + // 2. Let thisValue be the this value. -const { maxUnsigned16Bit } = __nccwpck_require__(19188) + // 3. Let object be ? ToObject(thisValue). -/** @type {import('crypto')} */ -let crypto -try { - crypto = __nccwpck_require__(6113) -} catch { + // 4. If object is a platform object, then perform a security + // check, passing: -} + // 5. If object is not a default iterator object for interface, + // then throw a TypeError. + if (Object.getPrototypeOf(this) !== i) { + throw new TypeError( + `'next' called on an object that does not implement interface ${name} Iterator.` + ) + } -class WebsocketFrameSend { - /** - * @param {Buffer|undefined} data - */ - constructor (data) { - this.frameData = data - this.maskKey = crypto.randomBytes(4) - } + // 6. Let index be object’s index. + // 7. Let kind be object’s kind. + // 8. Let values be object’s target's value pairs to iterate over. + const { index, kind, target } = object + const values = target() - createFrame (opcode) { - const bodyLength = this.frameData?.byteLength ?? 0 + // 9. Let len be the length of values. + const len = values.length - /** @type {number} */ - let payloadLength = bodyLength // 0-125 - let offset = 6 + // 10. If index is greater than or equal to len, then return + // CreateIterResultObject(undefined, true). + if (index >= len) { + return { value: undefined, done: true } + } - if (bodyLength > maxUnsigned16Bit) { - offset += 8 // payload length is next 8 bytes - payloadLength = 127 - } else if (bodyLength > 125) { - offset += 2 // payload length is next 2 bytes - payloadLength = 126 - } + // 11. Let pair be the entry in values at index index. + const pair = values[index] - const buffer = Buffer.allocUnsafe(bodyLength + offset) + // 12. Set object’s index to index + 1. + object.index = index + 1 - // Clear first 2 bytes, everything else is overwritten - buffer[0] = buffer[1] = 0 - buffer[0] |= 0x80 // FIN - buffer[0] = (buffer[0] & 0xF0) + opcode // opcode + // 13. Return the iterator result for pair and kind. + return iteratorResult(pair, kind) + }, + // The class string of an iterator prototype object for a given interface is the + // result of concatenating the identifier of the interface and the string " Iterator". + [Symbol.toStringTag]: `${name} Iterator` + } - /*! ws. MIT License. Einar Otto Stangvik */ - buffer[offset - 4] = this.maskKey[0] - buffer[offset - 3] = this.maskKey[1] - buffer[offset - 2] = this.maskKey[2] - buffer[offset - 1] = this.maskKey[3] + // The [[Prototype]] internal slot of an iterator prototype object must be %IteratorPrototype%. + Object.setPrototypeOf(i, esIteratorPrototype) + // esIteratorPrototype needs to be the prototype of i + // which is the prototype of an empty object. Yes, it's confusing. + return Object.setPrototypeOf({}, i) +} - buffer[1] = payloadLength +// https://webidl.spec.whatwg.org/#iterator-result +function iteratorResult (pair, kind) { + let result - if (payloadLength === 126) { - buffer.writeUInt16BE(bodyLength, 2) - } else if (payloadLength === 127) { - // Clear extended payload length - buffer[2] = buffer[3] = 0 - buffer.writeUIntBE(bodyLength, 4, 6) + // 1. Let result be a value determined by the value of kind: + switch (kind) { + case 'key': { + // 1. Let idlKey be pair’s key. + // 2. Let key be the result of converting idlKey to an + // ECMAScript value. + // 3. result is key. + result = pair[0] + break } - - buffer[1] |= 0x80 // MASK - - // mask body - for (let i = 0; i < bodyLength; i++) { - buffer[offset + i] = this.frameData[i] ^ this.maskKey[i % 4] + case 'value': { + // 1. Let idlValue be pair’s value. + // 2. Let value be the result of converting idlValue to + // an ECMAScript value. + // 3. result is value. + result = pair[1] + break + } + case 'key+value': { + // 1. Let idlKey be pair’s key. + // 2. Let idlValue be pair’s value. + // 3. Let key be the result of converting idlKey to an + // ECMAScript value. + // 4. Let value be the result of converting idlValue to + // an ECMAScript value. + // 5. Let array be ! ArrayCreate(2). + // 6. Call ! CreateDataProperty(array, "0", key). + // 7. Call ! CreateDataProperty(array, "1", value). + // 8. result is array. + result = pair + break } - - return buffer } -} -module.exports = { - WebsocketFrameSend + // 2. Return CreateIterResultObject(result, false). + return { value: result, done: false } } +/** + * @see https://fetch.spec.whatwg.org/#body-fully-read + */ +async function fullyReadBody (body, processBody, processBodyError) { + // 1. If taskDestination is null, then set taskDestination to + // the result of starting a new parallel queue. -/***/ }), - -/***/ 11688: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. Let successSteps given a byte sequence bytes be to queue a + // fetch task to run processBody given bytes, with taskDestination. + const successSteps = processBody -"use strict"; + // 3. Let errorSteps be to queue a fetch task to run processBodyError, + // with taskDestination. + const errorSteps = processBodyError + // 4. Let reader be the result of getting a reader for body’s stream. + // If that threw an exception, then run errorSteps with that + // exception and return. + let reader -const { Writable } = __nccwpck_require__(12781) -const diagnosticsChannel = __nccwpck_require__(67643) -const { parserStates, opcodes, states, emptyBuffer } = __nccwpck_require__(19188) -const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(37578) -const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(25515) -const { WebsocketFrameSend } = __nccwpck_require__(25444) + try { + reader = body.stream.getReader() + } catch (e) { + errorSteps(e) + return + } -// This code was influenced by ws released under the MIT license. -// Copyright (c) 2011 Einar Otto Stangvik -// Copyright (c) 2013 Arnout Kazemier and contributors -// Copyright (c) 2016 Luigi Pinca and contributors + // 5. Read all bytes from reader, given successSteps and errorSteps. + try { + const result = await readAllBytes(reader) + successSteps(result) + } catch (e) { + errorSteps(e) + } +} -const channels = {} -channels.ping = diagnosticsChannel.channel('undici:websocket:ping') -channels.pong = diagnosticsChannel.channel('undici:websocket:pong') +/** @type {ReadableStream} */ +let ReadableStream = globalThis.ReadableStream -class ByteParser extends Writable { - #buffers = [] - #byteOffset = 0 +function isReadableStreamLike (stream) { + if (!ReadableStream) { + ReadableStream = (__nccwpck_require__(35356).ReadableStream) + } - #state = parserStates.INFO + return stream instanceof ReadableStream || ( + stream[Symbol.toStringTag] === 'ReadableStream' && + typeof stream.tee === 'function' + ) +} - #info = {} - #fragments = [] +const MAXIMUM_ARGUMENT_LENGTH = 65535 - constructor (ws) { - super() +/** + * @see https://infra.spec.whatwg.org/#isomorphic-decode + * @param {number[]|Uint8Array} input + */ +function isomorphicDecode (input) { + // 1. To isomorphic decode a byte sequence input, return a string whose code point + // length is equal to input’s length and whose code points have the same values + // as the values of input’s bytes, in the same order. - this.ws = ws + if (input.length < MAXIMUM_ARGUMENT_LENGTH) { + return String.fromCharCode(...input) } - /** - * @param {Buffer} chunk - * @param {() => void} callback - */ - _write (chunk, _, callback) { - this.#buffers.push(chunk) - this.#byteOffset += chunk.length + return input.reduce((previous, current) => previous + String.fromCharCode(current), '') +} - this.run(callback) +/** + * @param {ReadableStreamController} controller + */ +function readableStreamClose (controller) { + try { + controller.close() + } catch (err) { + // TODO: add comment explaining why this error occurs. + if (!err.message.includes('Controller is already closed')) { + throw err + } } +} - /** - * Runs whenever a new chunk is received. - * Callback is called whenever there are no more chunks buffering, - * or not enough bytes are buffered to parse. - */ - run (callback) { - while (true) { - if (this.#state === parserStates.INFO) { - // If there aren't enough bytes to parse the payload length, etc. - if (this.#byteOffset < 2) { - return callback() - } - - const buffer = this.consume(2) - - this.#info.fin = (buffer[0] & 0x80) !== 0 - this.#info.opcode = buffer[0] & 0x0F - - // If we receive a fragmented message, we use the type of the first - // frame to parse the full message as binary/text, when it's terminated - this.#info.originalOpcode ??= this.#info.opcode - - this.#info.fragmented = !this.#info.fin && this.#info.opcode !== opcodes.CONTINUATION +/** + * @see https://infra.spec.whatwg.org/#isomorphic-encode + * @param {string} input + */ +function isomorphicEncode (input) { + // 1. Assert: input contains no code points greater than U+00FF. + for (let i = 0; i < input.length; i++) { + assert(input.charCodeAt(i) <= 0xFF) + } - if (this.#info.fragmented && this.#info.opcode !== opcodes.BINARY && this.#info.opcode !== opcodes.TEXT) { - // Only text and binary frames can be fragmented - failWebsocketConnection(this.ws, 'Invalid frame type was fragmented.') - return - } + // 2. Return a byte sequence whose length is equal to input’s code + // point length and whose bytes have the same values as the + // values of input’s code points, in the same order + return input +} - const payloadLength = buffer[1] & 0x7F +/** + * @see https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes + * @see https://streams.spec.whatwg.org/#read-loop + * @param {ReadableStreamDefaultReader} reader + */ +async function readAllBytes (reader) { + const bytes = [] + let byteLength = 0 - if (payloadLength <= 125) { - this.#info.payloadLength = payloadLength - this.#state = parserStates.READ_DATA - } else if (payloadLength === 126) { - this.#state = parserStates.PAYLOADLENGTH_16 - } else if (payloadLength === 127) { - this.#state = parserStates.PAYLOADLENGTH_64 - } + while (true) { + const { done, value: chunk } = await reader.read() - if (this.#info.fragmented && payloadLength > 125) { - // A fragmented frame can't be fragmented itself - failWebsocketConnection(this.ws, 'Fragmented frame exceeded 125 bytes.') - return - } else if ( - (this.#info.opcode === opcodes.PING || - this.#info.opcode === opcodes.PONG || - this.#info.opcode === opcodes.CLOSE) && - payloadLength > 125 - ) { - // Control frames can have a payload length of 125 bytes MAX - failWebsocketConnection(this.ws, 'Payload length for control frame exceeded 125 bytes.') - return - } else if (this.#info.opcode === opcodes.CLOSE) { - if (payloadLength === 1) { - failWebsocketConnection(this.ws, 'Received close frame with a 1-byte body.') - return - } + if (done) { + // 1. Call successSteps with bytes. + return Buffer.concat(bytes, byteLength) + } - const body = this.consume(payloadLength) + // 1. If chunk is not a Uint8Array object, call failureSteps + // with a TypeError and abort these steps. + if (!isUint8Array(chunk)) { + throw new TypeError('Received non-Uint8Array chunk') + } - this.#info.closeInfo = this.parseCloseBody(false, body) + // 2. Append the bytes represented by chunk to bytes. + bytes.push(chunk) + byteLength += chunk.length - if (!this.ws[kSentClose]) { - // If an endpoint receives a Close frame and did not previously send a - // Close frame, the endpoint MUST send a Close frame in response. (When - // sending a Close frame in response, the endpoint typically echos the - // status code it received.) - const body = Buffer.allocUnsafe(2) - body.writeUInt16BE(this.#info.closeInfo.code, 0) - const closeFrame = new WebsocketFrameSend(body) + // 3. Read-loop given reader, bytes, successSteps, and failureSteps. + } +} - this.ws[kResponse].socket.write( - closeFrame.createFrame(opcodes.CLOSE), - (err) => { - if (!err) { - this.ws[kSentClose] = true - } - } - ) - } +/** + * @see https://fetch.spec.whatwg.org/#is-local + * @param {URL} url + */ +function urlIsLocal (url) { + assert('protocol' in url) // ensure it's a url object - // Upon either sending or receiving a Close control frame, it is said - // that _The WebSocket Closing Handshake is Started_ and that the - // WebSocket connection is in the CLOSING state. - this.ws[kReadyState] = states.CLOSING - this.ws[kReceivedClose] = true + const protocol = url.protocol - this.end() + return protocol === 'about:' || protocol === 'blob:' || protocol === 'data:' +} - return - } else if (this.#info.opcode === opcodes.PING) { - // Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in - // response, unless it already received a Close frame. - // A Pong frame sent in response to a Ping frame must have identical - // "Application data" +/** + * @param {string|URL} url + */ +function urlHasHttpsScheme (url) { + if (typeof url === 'string') { + return url.startsWith('https:') + } - const body = this.consume(payloadLength) + return url.protocol === 'https:' +} - if (!this.ws[kReceivedClose]) { - const frame = new WebsocketFrameSend(body) +/** + * @see https://fetch.spec.whatwg.org/#http-scheme + * @param {URL} url + */ +function urlIsHttpHttpsScheme (url) { + assert('protocol' in url) // ensure it's a url object - this.ws[kResponse].socket.write(frame.createFrame(opcodes.PONG)) + const protocol = url.protocol - if (channels.ping.hasSubscribers) { - channels.ping.publish({ - payload: body - }) - } - } + return protocol === 'http:' || protocol === 'https:' +} - this.#state = parserStates.INFO +/** + * Fetch supports node >= 16.8.0, but Object.hasOwn was added in v16.9.0. + */ +const hasOwn = Object.hasOwn || ((dict, key) => Object.prototype.hasOwnProperty.call(dict, key)) - if (this.#byteOffset > 0) { - continue - } else { - callback() - return - } - } else if (this.#info.opcode === opcodes.PONG) { - // A Pong frame MAY be sent unsolicited. This serves as a - // unidirectional heartbeat. A response to an unsolicited Pong frame is - // not expected. +module.exports = { + isAborted, + isCancelled, + createDeferredPromise, + ReadableStreamFrom, + toUSVString, + tryUpgradeRequestToAPotentiallyTrustworthyURL, + coarsenedSharedCurrentTime, + determineRequestsReferrer, + makePolicyContainer, + clonePolicyContainer, + appendFetchMetadata, + appendRequestOriginHeader, + TAOCheck, + corsCheck, + crossOriginResourcePolicyCheck, + createOpaqueTimingInfo, + setRequestReferrerPolicyOnRedirect, + isValidHTTPToken, + requestBadPort, + requestCurrentURL, + responseURL, + responseLocationURL, + isBlobLike, + isURLPotentiallyTrustworthy, + isValidReasonPhrase, + sameOrigin, + normalizeMethod, + serializeJavascriptValueToJSONString, + makeIterator, + isValidHeaderName, + isValidHeaderValue, + hasOwn, + isErrorLike, + fullyReadBody, + bytesMatch, + isReadableStreamLike, + readableStreamClose, + isomorphicEncode, + isomorphicDecode, + urlIsLocal, + urlHasHttpsScheme, + urlIsHttpHttpsScheme, + readAllBytes, + normalizeMethodRecord, + parseMetadata +} - const body = this.consume(payloadLength) - if (channels.pong.hasSubscribers) { - channels.pong.publish({ - payload: body - }) - } +/***/ }), - if (this.#byteOffset > 0) { - continue - } else { - callback() - return - } - } - } else if (this.#state === parserStates.PAYLOADLENGTH_16) { - if (this.#byteOffset < 2) { - return callback() - } +/***/ 21744: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - const buffer = this.consume(2) +"use strict"; - this.#info.payloadLength = buffer.readUInt16BE(0) - this.#state = parserStates.READ_DATA - } else if (this.#state === parserStates.PAYLOADLENGTH_64) { - if (this.#byteOffset < 8) { - return callback() - } - const buffer = this.consume(8) - const upper = buffer.readUInt32BE(0) +const { types } = __nccwpck_require__(73837) +const { hasOwn, toUSVString } = __nccwpck_require__(52538) - // 2^31 is the maxinimum bytes an arraybuffer can contain - // on 32-bit systems. Although, on 64-bit systems, this is - // 2^53-1 bytes. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length - // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/common/globals.h;drc=1946212ac0100668f14eb9e2843bdd846e510a1e;bpv=1;bpt=1;l=1275 - // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-array-buffer.h;l=34;drc=1946212ac0100668f14eb9e2843bdd846e510a1e - if (upper > 2 ** 31 - 1) { - failWebsocketConnection(this.ws, 'Received payload length > 2^31 bytes.') - return - } +/** @type {import('../../types/webidl').Webidl} */ +const webidl = {} +webidl.converters = {} +webidl.util = {} +webidl.errors = {} - const lower = buffer.readUInt32BE(4) +webidl.errors.exception = function (message) { + return new TypeError(`${message.header}: ${message.message}`) +} - this.#info.payloadLength = (upper << 8) + lower - this.#state = parserStates.READ_DATA - } else if (this.#state === parserStates.READ_DATA) { - if (this.#byteOffset < this.#info.payloadLength) { - // If there is still more data in this chunk that needs to be read - return callback() - } else if (this.#byteOffset >= this.#info.payloadLength) { - // If the server sent multiple frames in a single chunk +webidl.errors.conversionFailed = function (context) { + const plural = context.types.length === 1 ? '' : ' one of' + const message = + `${context.argument} could not be converted to` + + `${plural}: ${context.types.join(', ')}.` - const body = this.consume(this.#info.payloadLength) + return webidl.errors.exception({ + header: context.prefix, + message + }) +} - this.#fragments.push(body) +webidl.errors.invalidArgument = function (context) { + return webidl.errors.exception({ + header: context.prefix, + message: `"${context.value}" is an invalid ${context.type}.` + }) +} - // If the frame is unfragmented, or a fragmented frame was terminated, - // a message was received - if (!this.#info.fragmented || (this.#info.fin && this.#info.opcode === opcodes.CONTINUATION)) { - const fullMessage = Buffer.concat(this.#fragments) +// https://webidl.spec.whatwg.org/#implements +webidl.brandCheck = function (V, I, opts = undefined) { + if (opts?.strict !== false && !(V instanceof I)) { + throw new TypeError('Illegal invocation') + } else { + return V?.[Symbol.toStringTag] === I.prototype[Symbol.toStringTag] + } +} - websocketMessageReceived(this.ws, this.#info.originalOpcode, fullMessage) +webidl.argumentLengthCheck = function ({ length }, min, ctx) { + if (length < min) { + throw webidl.errors.exception({ + message: `${min} argument${min !== 1 ? 's' : ''} required, ` + + `but${length ? ' only' : ''} ${length} found.`, + ...ctx + }) + } +} - this.#info = {} - this.#fragments.length = 0 - } +webidl.illegalConstructor = function () { + throw webidl.errors.exception({ + header: 'TypeError', + message: 'Illegal constructor' + }) +} - this.#state = parserStates.INFO - } +// https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values +webidl.util.Type = function (V) { + switch (typeof V) { + case 'undefined': return 'Undefined' + case 'boolean': return 'Boolean' + case 'string': return 'String' + case 'symbol': return 'Symbol' + case 'number': return 'Number' + case 'bigint': return 'BigInt' + case 'function': + case 'object': { + if (V === null) { + return 'Null' } - if (this.#byteOffset > 0) { - continue - } else { - callback() - break - } + return 'Object' } } +} - /** - * Take n bytes from the buffered Buffers - * @param {number} n - * @returns {Buffer|null} - */ - consume (n) { - if (n > this.#byteOffset) { - return null - } else if (n === 0) { - return emptyBuffer - } +// https://webidl.spec.whatwg.org/#abstract-opdef-converttoint +webidl.util.ConvertToInt = function (V, bitLength, signedness, opts = {}) { + let upperBound + let lowerBound - if (this.#buffers[0].length === n) { - this.#byteOffset -= this.#buffers[0].length - return this.#buffers.shift() - } + // 1. If bitLength is 64, then: + if (bitLength === 64) { + // 1. Let upperBound be 2^53 − 1. + upperBound = Math.pow(2, 53) - 1 - const buffer = Buffer.allocUnsafe(n) - let offset = 0 + // 2. If signedness is "unsigned", then let lowerBound be 0. + if (signedness === 'unsigned') { + lowerBound = 0 + } else { + // 3. Otherwise let lowerBound be −2^53 + 1. + lowerBound = Math.pow(-2, 53) + 1 + } + } else if (signedness === 'unsigned') { + // 2. Otherwise, if signedness is "unsigned", then: - while (offset !== n) { - const next = this.#buffers[0] - const { length } = next + // 1. Let lowerBound be 0. + lowerBound = 0 - if (length + offset === n) { - buffer.set(this.#buffers.shift(), offset) - break - } else if (length + offset > n) { - buffer.set(next.subarray(0, n - offset), offset) - this.#buffers[0] = next.subarray(n - offset) - break - } else { - buffer.set(this.#buffers.shift(), offset) - offset += next.length - } - } + // 2. Let upperBound be 2^bitLength − 1. + upperBound = Math.pow(2, bitLength) - 1 + } else { + // 3. Otherwise: - this.#byteOffset -= n + // 1. Let lowerBound be -2^bitLength − 1. + lowerBound = Math.pow(-2, bitLength) - 1 - return buffer + // 2. Let upperBound be 2^bitLength − 1 − 1. + upperBound = Math.pow(2, bitLength - 1) - 1 } - parseCloseBody (onlyCode, data) { - // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5 - /** @type {number|undefined} */ - let code - - if (data.length >= 2) { - // _The WebSocket Connection Close Code_ is - // defined as the status code (Section 7.4) contained in the first Close - // control frame received by the application - code = data.readUInt16BE(0) - } + // 4. Let x be ? ToNumber(V). + let x = Number(V) - if (onlyCode) { - if (!isValidStatusCode(code)) { - return null - } + // 5. If x is −0, then set x to +0. + if (x === 0) { + x = 0 + } - return { code } + // 6. If the conversion is to an IDL type associated + // with the [EnforceRange] extended attribute, then: + if (opts.enforceRange === true) { + // 1. If x is NaN, +∞, or −∞, then throw a TypeError. + if ( + Number.isNaN(x) || + x === Number.POSITIVE_INFINITY || + x === Number.NEGATIVE_INFINITY + ) { + throw webidl.errors.exception({ + header: 'Integer conversion', + message: `Could not convert ${V} to an integer.` + }) } - // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6 - /** @type {Buffer} */ - let reason = data.subarray(2) + // 2. Set x to IntegerPart(x). + x = webidl.util.IntegerPart(x) - // Remove BOM - if (reason[0] === 0xEF && reason[1] === 0xBB && reason[2] === 0xBF) { - reason = reason.subarray(3) + // 3. If x < lowerBound or x > upperBound, then + // throw a TypeError. + if (x < lowerBound || x > upperBound) { + throw webidl.errors.exception({ + header: 'Integer conversion', + message: `Value must be between ${lowerBound}-${upperBound}, got ${x}.` + }) } - if (code !== undefined && !isValidStatusCode(code)) { - return null - } + // 4. Return x. + return x + } - try { - // TODO: optimize this - reason = new TextDecoder('utf-8', { fatal: true }).decode(reason) - } catch { - return null + // 7. If x is not NaN and the conversion is to an IDL + // type associated with the [Clamp] extended + // attribute, then: + if (!Number.isNaN(x) && opts.clamp === true) { + // 1. Set x to min(max(x, lowerBound), upperBound). + x = Math.min(Math.max(x, lowerBound), upperBound) + + // 2. Round x to the nearest integer, choosing the + // even integer if it lies halfway between two, + // and choosing +0 rather than −0. + if (Math.floor(x) % 2 === 0) { + x = Math.floor(x) + } else { + x = Math.ceil(x) } - return { code, reason } + // 3. Return x. + return x } - get closingInfo () { - return this.#info.closeInfo + // 8. If x is NaN, +0, +∞, or −∞, then return +0. + if ( + Number.isNaN(x) || + (x === 0 && Object.is(0, x)) || + x === Number.POSITIVE_INFINITY || + x === Number.NEGATIVE_INFINITY + ) { + return 0 } -} -module.exports = { - ByteParser -} + // 9. Set x to IntegerPart(x). + x = webidl.util.IntegerPart(x) + // 10. Set x to x modulo 2^bitLength. + x = x % Math.pow(2, bitLength) -/***/ }), + // 11. If signedness is "signed" and x ≥ 2^bitLength − 1, + // then return x − 2^bitLength. + if (signedness === 'signed' && x >= Math.pow(2, bitLength) - 1) { + return x - Math.pow(2, bitLength) + } -/***/ 37578: -/***/ ((module) => { + // 12. Otherwise, return x. + return x +} -"use strict"; +// https://webidl.spec.whatwg.org/#abstract-opdef-integerpart +webidl.util.IntegerPart = function (n) { + // 1. Let r be floor(abs(n)). + const r = Math.floor(Math.abs(n)) + // 2. If n < 0, then return -1 × r. + if (n < 0) { + return -1 * r + } -module.exports = { - kWebSocketURL: Symbol('url'), - kReadyState: Symbol('ready state'), - kController: Symbol('controller'), - kResponse: Symbol('response'), - kBinaryType: Symbol('binary type'), - kSentClose: Symbol('sent close'), - kReceivedClose: Symbol('received close'), - kByteParser: Symbol('byte parser') + // 3. Otherwise, return r. + return r } +// https://webidl.spec.whatwg.org/#es-sequence +webidl.sequenceConverter = function (converter) { + return (V) => { + // 1. If Type(V) is not Object, throw a TypeError. + if (webidl.util.Type(V) !== 'Object') { + throw webidl.errors.exception({ + header: 'Sequence', + message: `Value of type ${webidl.util.Type(V)} is not an Object.` + }) + } -/***/ }), - -/***/ 25515: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 2. Let method be ? GetMethod(V, @@iterator). + /** @type {Generator} */ + const method = V?.[Symbol.iterator]?.() + const seq = [] -"use strict"; + // 3. If method is undefined, throw a TypeError. + if ( + method === undefined || + typeof method.next !== 'function' + ) { + throw webidl.errors.exception({ + header: 'Sequence', + message: 'Object is not an iterator.' + }) + } + // https://webidl.spec.whatwg.org/#create-sequence-from-iterable + while (true) { + const { done, value } = method.next() -const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(37578) -const { states, opcodes } = __nccwpck_require__(19188) -const { MessageEvent, ErrorEvent } = __nccwpck_require__(52611) + if (done) { + break + } -/* globals Blob */ + seq.push(converter(value)) + } -/** - * @param {import('./websocket').WebSocket} ws - */ -function isEstablished (ws) { - // If the server's response is validated as provided for above, it is - // said that _The WebSocket Connection is Established_ and that the - // WebSocket Connection is in the OPEN state. - return ws[kReadyState] === states.OPEN + return seq + } } -/** - * @param {import('./websocket').WebSocket} ws - */ -function isClosing (ws) { - // Upon either sending or receiving a Close control frame, it is said - // that _The WebSocket Closing Handshake is Started_ and that the - // WebSocket connection is in the CLOSING state. - return ws[kReadyState] === states.CLOSING -} +// https://webidl.spec.whatwg.org/#es-to-record +webidl.recordConverter = function (keyConverter, valueConverter) { + return (O) => { + // 1. If Type(O) is not Object, throw a TypeError. + if (webidl.util.Type(O) !== 'Object') { + throw webidl.errors.exception({ + header: 'Record', + message: `Value of type ${webidl.util.Type(O)} is not an Object.` + }) + } -/** - * @param {import('./websocket').WebSocket} ws - */ -function isClosed (ws) { - return ws[kReadyState] === states.CLOSED -} + // 2. Let result be a new empty instance of record. + const result = {} -/** - * @see https://dom.spec.whatwg.org/#concept-event-fire - * @param {string} e - * @param {EventTarget} target - * @param {EventInit | undefined} eventInitDict - */ -function fireEvent (e, target, eventConstructor = Event, eventInitDict) { - // 1. If eventConstructor is not given, then let eventConstructor be Event. + if (!types.isProxy(O)) { + // Object.keys only returns enumerable properties + const keys = Object.keys(O) - // 2. Let event be the result of creating an event given eventConstructor, - // in the relevant realm of target. - // 3. Initialize event’s type attribute to e. - const event = new eventConstructor(e, eventInitDict) // eslint-disable-line new-cap + for (const key of keys) { + // 1. Let typedKey be key converted to an IDL value of type K. + const typedKey = keyConverter(key) - // 4. Initialize any other IDL attributes of event as described in the - // invocation of this algorithm. + // 2. Let value be ? Get(O, key). + // 3. Let typedValue be value converted to an IDL value of type V. + const typedValue = valueConverter(O[key]) - // 5. Return the result of dispatching event at target, with legacy target - // override flag set if set. - target.dispatchEvent(event) -} + // 4. Set result[typedKey] to typedValue. + result[typedKey] = typedValue + } -/** - * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol - * @param {import('./websocket').WebSocket} ws - * @param {number} type Opcode - * @param {Buffer} data application data - */ -function websocketMessageReceived (ws, type, data) { - // 1. If ready state is not OPEN (1), then return. - if (ws[kReadyState] !== states.OPEN) { - return - } + // 5. Return result. + return result + } - // 2. Let dataForEvent be determined by switching on type and binary type: - let dataForEvent + // 3. Let keys be ? O.[[OwnPropertyKeys]](). + const keys = Reflect.ownKeys(O) - if (type === opcodes.TEXT) { - // -> type indicates that the data is Text - // a new DOMString containing data - try { - dataForEvent = new TextDecoder('utf-8', { fatal: true }).decode(data) - } catch { - failWebsocketConnection(ws, 'Received invalid UTF-8 in text frame.') - return - } - } else if (type === opcodes.BINARY) { - if (ws[kBinaryType] === 'blob') { - // -> type indicates that the data is Binary and binary type is "blob" - // a new Blob object, created in the relevant Realm of the WebSocket - // object, that represents data as its raw data - dataForEvent = new Blob([data]) - } else { - // -> type indicates that the data is Binary and binary type is "arraybuffer" - // a new ArrayBuffer object, created in the relevant Realm of the - // WebSocket object, whose contents are data - dataForEvent = new Uint8Array(data).buffer + // 4. For each key of keys. + for (const key of keys) { + // 1. Let desc be ? O.[[GetOwnProperty]](key). + const desc = Reflect.getOwnPropertyDescriptor(O, key) + + // 2. If desc is not undefined and desc.[[Enumerable]] is true: + if (desc?.enumerable) { + // 1. Let typedKey be key converted to an IDL value of type K. + const typedKey = keyConverter(key) + + // 2. Let value be ? Get(O, key). + // 3. Let typedValue be value converted to an IDL value of type V. + const typedValue = valueConverter(O[key]) + + // 4. Set result[typedKey] to typedValue. + result[typedKey] = typedValue + } } - } - // 3. Fire an event named message at the WebSocket object, using MessageEvent, - // with the origin attribute initialized to the serialization of the WebSocket - // object’s url's origin, and the data attribute initialized to dataForEvent. - fireEvent('message', ws, MessageEvent, { - origin: ws[kWebSocketURL].origin, - data: dataForEvent - }) + // 5. Return result. + return result + } } -/** - * @see https://datatracker.ietf.org/doc/html/rfc6455 - * @see https://datatracker.ietf.org/doc/html/rfc2616 - * @see https://bugs.chromium.org/p/chromium/issues/detail?id=398407 - * @param {string} protocol - */ -function isValidSubprotocol (protocol) { - // If present, this value indicates one - // or more comma-separated subprotocol the client wishes to speak, - // ordered by preference. The elements that comprise this value - // MUST be non-empty strings with characters in the range U+0021 to - // U+007E not including separator characters as defined in - // [RFC2616] and MUST all be unique strings. - if (protocol.length === 0) { - return false +webidl.interfaceConverter = function (i) { + return (V, opts = {}) => { + if (opts.strict !== false && !(V instanceof i)) { + throw webidl.errors.exception({ + header: i.name, + message: `Expected ${V} to be an instance of ${i.name}.` + }) + } + + return V } +} - for (const char of protocol) { - const code = char.charCodeAt(0) +webidl.dictionaryConverter = function (converters) { + return (dictionary) => { + const type = webidl.util.Type(dictionary) + const dict = {} - if ( - code < 0x21 || - code > 0x7E || - char === '(' || - char === ')' || - char === '<' || - char === '>' || - char === '@' || - char === ',' || - char === ';' || - char === ':' || - char === '\\' || - char === '"' || - char === '/' || - char === '[' || - char === ']' || - char === '?' || - char === '=' || - char === '{' || - char === '}' || - code === 32 || // SP - code === 9 // HT - ) { - return false + if (type === 'Null' || type === 'Undefined') { + return dict + } else if (type !== 'Object') { + throw webidl.errors.exception({ + header: 'Dictionary', + message: `Expected ${dictionary} to be one of: Null, Undefined, Object.` + }) } - } - return true -} + for (const options of converters) { + const { key, defaultValue, required, converter } = options -/** - * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7-4 - * @param {number} code - */ -function isValidStatusCode (code) { - if (code >= 1000 && code < 1015) { - return ( - code !== 1004 && // reserved - code !== 1005 && // "MUST NOT be set as a status code" - code !== 1006 // "MUST NOT be set as a status code" - ) - } + if (required === true) { + if (!hasOwn(dictionary, key)) { + throw webidl.errors.exception({ + header: 'Dictionary', + message: `Missing required key "${key}".` + }) + } + } - return code >= 3000 && code <= 4999 -} + let value = dictionary[key] + const hasDefault = hasOwn(options, 'defaultValue') -/** - * @param {import('./websocket').WebSocket} ws - * @param {string|undefined} reason - */ -function failWebsocketConnection (ws, reason) { - const { [kController]: controller, [kResponse]: response } = ws + // Only use defaultValue if value is undefined and + // a defaultValue options was provided. + if (hasDefault && value !== null) { + value = value ?? defaultValue + } - controller.abort() + // A key can be optional and have no default value. + // When this happens, do not perform a conversion, + // and do not assign the key a value. + if (required || hasDefault || value !== undefined) { + value = converter(value) - if (response?.socket && !response.socket.destroyed) { - response.socket.destroy() - } + if ( + options.allowedValues && + !options.allowedValues.includes(value) + ) { + throw webidl.errors.exception({ + header: 'Dictionary', + message: `${value} is not an accepted type. Expected one of ${options.allowedValues.join(', ')}.` + }) + } - if (reason) { - fireEvent('error', ws, ErrorEvent, { - error: new Error(reason) - }) + dict[key] = value + } + } + + return dict } } -module.exports = { - isEstablished, - isClosing, - isClosed, - fireEvent, - isValidSubprotocol, - isValidStatusCode, - failWebsocketConnection, - websocketMessageReceived -} +webidl.nullableConverter = function (converter) { + return (V) => { + if (V === null) { + return V + } + return converter(V) + } +} -/***/ }), +// https://webidl.spec.whatwg.org/#es-DOMString +webidl.converters.DOMString = function (V, opts = {}) { + // 1. If V is null and the conversion is to an IDL type + // associated with the [LegacyNullToEmptyString] + // extended attribute, then return the DOMString value + // that represents the empty string. + if (V === null && opts.legacyNullToEmptyString) { + return '' + } -/***/ 54284: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const { webidl } = __nccwpck_require__(21744) -const { DOMException } = __nccwpck_require__(41037) -const { URLSerializer } = __nccwpck_require__(685) -const { getGlobalOrigin } = __nccwpck_require__(71246) -const { staticPropertyDescriptors, states, opcodes, emptyBuffer } = __nccwpck_require__(19188) -const { - kWebSocketURL, - kReadyState, - kController, - kBinaryType, - kResponse, - kSentClose, - kByteParser -} = __nccwpck_require__(37578) -const { isEstablished, isClosing, isValidSubprotocol, failWebsocketConnection, fireEvent } = __nccwpck_require__(25515) -const { establishWebSocketConnection } = __nccwpck_require__(35354) -const { WebsocketFrameSend } = __nccwpck_require__(25444) -const { ByteParser } = __nccwpck_require__(11688) -const { kEnumerableProperty, isBlobLike } = __nccwpck_require__(83983) -const { getGlobalDispatcher } = __nccwpck_require__(21892) -const { types } = __nccwpck_require__(73837) - -let experimentalWarned = false - -// https://websockets.spec.whatwg.org/#interface-definition -class WebSocket extends EventTarget { - #events = { - open: null, - error: null, - close: null, - message: null + // 2. Let x be ? ToString(V). + if (typeof V === 'symbol') { + throw new TypeError('Could not convert argument of type symbol to string.') } - #bufferedAmount = 0 - #protocol = '' - #extensions = '' - - /** - * @param {string} url - * @param {string|string[]} protocols - */ - constructor (url, protocols = []) { - super() - - webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket constructor' }) - - if (!experimentalWarned) { - experimentalWarned = true - process.emitWarning('WebSockets are experimental, expect them to change at any time.', { - code: 'UNDICI-WS' - }) - } - - const options = webidl.converters['DOMString or sequence or WebSocketInit'](protocols) - - url = webidl.converters.USVString(url) - protocols = options.protocols - - // 1. Let baseURL be this's relevant settings object's API base URL. - const baseURL = getGlobalOrigin() + // 3. Return the IDL DOMString value that represents the + // same sequence of code units as the one the + // ECMAScript String value x represents. + return String(V) +} - // 1. Let urlRecord be the result of applying the URL parser to url with baseURL. - let urlRecord +// https://webidl.spec.whatwg.org/#es-ByteString +webidl.converters.ByteString = function (V) { + // 1. Let x be ? ToString(V). + // Note: DOMString converter perform ? ToString(V) + const x = webidl.converters.DOMString(V) - try { - urlRecord = new URL(url, baseURL) - } catch (e) { - // 3. If urlRecord is failure, then throw a "SyntaxError" DOMException. - throw new DOMException(e, 'SyntaxError') + // 2. If the value of any element of x is greater than + // 255, then throw a TypeError. + for (let index = 0; index < x.length; index++) { + if (x.charCodeAt(index) > 255) { + throw new TypeError( + 'Cannot convert argument to a ByteString because the character at ' + + `index ${index} has a value of ${x.charCodeAt(index)} which is greater than 255.` + ) } + } - // 4. If urlRecord’s scheme is "http", then set urlRecord’s scheme to "ws". - if (urlRecord.protocol === 'http:') { - urlRecord.protocol = 'ws:' - } else if (urlRecord.protocol === 'https:') { - // 5. Otherwise, if urlRecord’s scheme is "https", set urlRecord’s scheme to "wss". - urlRecord.protocol = 'wss:' - } + // 3. Return an IDL ByteString value whose length is the + // length of x, and where the value of each element is + // the value of the corresponding element of x. + return x +} - // 6. If urlRecord’s scheme is not "ws" or "wss", then throw a "SyntaxError" DOMException. - if (urlRecord.protocol !== 'ws:' && urlRecord.protocol !== 'wss:') { - throw new DOMException( - `Expected a ws: or wss: protocol, got ${urlRecord.protocol}`, - 'SyntaxError' - ) - } +// https://webidl.spec.whatwg.org/#es-USVString +webidl.converters.USVString = toUSVString - // 7. If urlRecord’s fragment is non-null, then throw a "SyntaxError" - // DOMException. - if (urlRecord.hash || urlRecord.href.endsWith('#')) { - throw new DOMException('Got fragment', 'SyntaxError') - } +// https://webidl.spec.whatwg.org/#es-boolean +webidl.converters.boolean = function (V) { + // 1. Let x be the result of computing ToBoolean(V). + const x = Boolean(V) - // 8. If protocols is a string, set protocols to a sequence consisting - // of just that string. - if (typeof protocols === 'string') { - protocols = [protocols] - } + // 2. Return the IDL boolean value that is the one that represents + // the same truth value as the ECMAScript Boolean value x. + return x +} - // 9. If any of the values in protocols occur more than once or otherwise - // fail to match the requirements for elements that comprise the value - // of `Sec-WebSocket-Protocol` fields as defined by The WebSocket - // protocol, then throw a "SyntaxError" DOMException. - if (protocols.length !== new Set(protocols.map(p => p.toLowerCase())).size) { - throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError') - } +// https://webidl.spec.whatwg.org/#es-any +webidl.converters.any = function (V) { + return V +} - if (protocols.length > 0 && !protocols.every(p => isValidSubprotocol(p))) { - throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError') - } +// https://webidl.spec.whatwg.org/#es-long-long +webidl.converters['long long'] = function (V) { + // 1. Let x be ? ConvertToInt(V, 64, "signed"). + const x = webidl.util.ConvertToInt(V, 64, 'signed') - // 10. Set this's url to urlRecord. - this[kWebSocketURL] = new URL(urlRecord.href) + // 2. Return the IDL long long value that represents + // the same numeric value as x. + return x +} - // 11. Let client be this's relevant settings object. +// https://webidl.spec.whatwg.org/#es-unsigned-long-long +webidl.converters['unsigned long long'] = function (V) { + // 1. Let x be ? ConvertToInt(V, 64, "unsigned"). + const x = webidl.util.ConvertToInt(V, 64, 'unsigned') - // 12. Run this step in parallel: + // 2. Return the IDL unsigned long long value that + // represents the same numeric value as x. + return x +} - // 1. Establish a WebSocket connection given urlRecord, protocols, - // and client. - this[kController] = establishWebSocketConnection( - urlRecord, - protocols, - this, - (response) => this.#onConnectionEstablished(response), - options - ) +// https://webidl.spec.whatwg.org/#es-unsigned-long +webidl.converters['unsigned long'] = function (V) { + // 1. Let x be ? ConvertToInt(V, 32, "unsigned"). + const x = webidl.util.ConvertToInt(V, 32, 'unsigned') - // Each WebSocket object has an associated ready state, which is a - // number representing the state of the connection. Initially it must - // be CONNECTING (0). - this[kReadyState] = WebSocket.CONNECTING + // 2. Return the IDL unsigned long value that + // represents the same numeric value as x. + return x +} - // The extensions attribute must initially return the empty string. +// https://webidl.spec.whatwg.org/#es-unsigned-short +webidl.converters['unsigned short'] = function (V, opts) { + // 1. Let x be ? ConvertToInt(V, 16, "unsigned"). + const x = webidl.util.ConvertToInt(V, 16, 'unsigned', opts) - // The protocol attribute must initially return the empty string. + // 2. Return the IDL unsigned short value that represents + // the same numeric value as x. + return x +} - // Each WebSocket object has an associated binary type, which is a - // BinaryType. Initially it must be "blob". - this[kBinaryType] = 'blob' +// https://webidl.spec.whatwg.org/#idl-ArrayBuffer +webidl.converters.ArrayBuffer = function (V, opts = {}) { + // 1. If Type(V) is not Object, or V does not have an + // [[ArrayBufferData]] internal slot, then throw a + // TypeError. + // see: https://tc39.es/ecma262/#sec-properties-of-the-arraybuffer-instances + // see: https://tc39.es/ecma262/#sec-properties-of-the-sharedarraybuffer-instances + if ( + webidl.util.Type(V) !== 'Object' || + !types.isAnyArrayBuffer(V) + ) { + throw webidl.errors.conversionFailed({ + prefix: `${V}`, + argument: `${V}`, + types: ['ArrayBuffer'] + }) } - /** - * @see https://websockets.spec.whatwg.org/#dom-websocket-close - * @param {number|undefined} code - * @param {string|undefined} reason - */ - close (code = undefined, reason = undefined) { - webidl.brandCheck(this, WebSocket) - - if (code !== undefined) { - code = webidl.converters['unsigned short'](code, { clamp: true }) - } + // 2. If the conversion is not to an IDL type associated + // with the [AllowShared] extended attribute, and + // IsSharedArrayBuffer(V) is true, then throw a + // TypeError. + if (opts.allowShared === false && types.isSharedArrayBuffer(V)) { + throw webidl.errors.exception({ + header: 'ArrayBuffer', + message: 'SharedArrayBuffer is not allowed.' + }) + } - if (reason !== undefined) { - reason = webidl.converters.USVString(reason) - } + // 3. If the conversion is not to an IDL type associated + // with the [AllowResizable] extended attribute, and + // IsResizableArrayBuffer(V) is true, then throw a + // TypeError. + // Note: resizable ArrayBuffers are currently a proposal. - // 1. If code is present, but is neither an integer equal to 1000 nor an - // integer in the range 3000 to 4999, inclusive, throw an - // "InvalidAccessError" DOMException. - if (code !== undefined) { - if (code !== 1000 && (code < 3000 || code > 4999)) { - throw new DOMException('invalid code', 'InvalidAccessError') - } - } + // 4. Return the IDL ArrayBuffer value that is a + // reference to the same object as V. + return V +} - let reasonByteLength = 0 +webidl.converters.TypedArray = function (V, T, opts = {}) { + // 1. Let T be the IDL type V is being converted to. - // 2. If reason is present, then run these substeps: - if (reason !== undefined) { - // 1. Let reasonBytes be the result of encoding reason. - // 2. If reasonBytes is longer than 123 bytes, then throw a - // "SyntaxError" DOMException. - reasonByteLength = Buffer.byteLength(reason) + // 2. If Type(V) is not Object, or V does not have a + // [[TypedArrayName]] internal slot with a value + // equal to T’s name, then throw a TypeError. + if ( + webidl.util.Type(V) !== 'Object' || + !types.isTypedArray(V) || + V.constructor.name !== T.name + ) { + throw webidl.errors.conversionFailed({ + prefix: `${T.name}`, + argument: `${V}`, + types: [T.name] + }) + } - if (reasonByteLength > 123) { - throw new DOMException( - `Reason must be less than 123 bytes; received ${reasonByteLength}`, - 'SyntaxError' - ) - } - } + // 3. If the conversion is not to an IDL type associated + // with the [AllowShared] extended attribute, and + // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is + // true, then throw a TypeError. + if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) { + throw webidl.errors.exception({ + header: 'ArrayBuffer', + message: 'SharedArrayBuffer is not allowed.' + }) + } - // 3. Run the first matching steps from the following list: - if (this[kReadyState] === WebSocket.CLOSING || this[kReadyState] === WebSocket.CLOSED) { - // If this's ready state is CLOSING (2) or CLOSED (3) - // Do nothing. - } else if (!isEstablished(this)) { - // If the WebSocket connection is not yet established - // Fail the WebSocket connection and set this's ready state - // to CLOSING (2). - failWebsocketConnection(this, 'Connection was closed before it was established.') - this[kReadyState] = WebSocket.CLOSING - } else if (!isClosing(this)) { - // If the WebSocket closing handshake has not yet been started - // Start the WebSocket closing handshake and set this's ready - // state to CLOSING (2). - // - If neither code nor reason is present, the WebSocket Close - // message must not have a body. - // - If code is present, then the status code to use in the - // WebSocket Close message must be the integer given by code. - // - If reason is also present, then reasonBytes must be - // provided in the Close message after the status code. + // 4. If the conversion is not to an IDL type associated + // with the [AllowResizable] extended attribute, and + // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is + // true, then throw a TypeError. + // Note: resizable array buffers are currently a proposal - const frame = new WebsocketFrameSend() + // 5. Return the IDL value of type T that is a reference + // to the same object as V. + return V +} - // If neither code nor reason is present, the WebSocket Close - // message must not have a body. +webidl.converters.DataView = function (V, opts = {}) { + // 1. If Type(V) is not Object, or V does not have a + // [[DataView]] internal slot, then throw a TypeError. + if (webidl.util.Type(V) !== 'Object' || !types.isDataView(V)) { + throw webidl.errors.exception({ + header: 'DataView', + message: 'Object is not a DataView.' + }) + } - // If code is present, then the status code to use in the - // WebSocket Close message must be the integer given by code. - if (code !== undefined && reason === undefined) { - frame.frameData = Buffer.allocUnsafe(2) - frame.frameData.writeUInt16BE(code, 0) - } else if (code !== undefined && reason !== undefined) { - // If reason is also present, then reasonBytes must be - // provided in the Close message after the status code. - frame.frameData = Buffer.allocUnsafe(2 + reasonByteLength) - frame.frameData.writeUInt16BE(code, 0) - // the body MAY contain UTF-8-encoded data with value /reason/ - frame.frameData.write(reason, 2, 'utf-8') - } else { - frame.frameData = emptyBuffer - } + // 2. If the conversion is not to an IDL type associated + // with the [AllowShared] extended attribute, and + // IsSharedArrayBuffer(V.[[ViewedArrayBuffer]]) is true, + // then throw a TypeError. + if (opts.allowShared === false && types.isSharedArrayBuffer(V.buffer)) { + throw webidl.errors.exception({ + header: 'ArrayBuffer', + message: 'SharedArrayBuffer is not allowed.' + }) + } - /** @type {import('stream').Duplex} */ - const socket = this[kResponse].socket + // 3. If the conversion is not to an IDL type associated + // with the [AllowResizable] extended attribute, and + // IsResizableArrayBuffer(V.[[ViewedArrayBuffer]]) is + // true, then throw a TypeError. + // Note: resizable ArrayBuffers are currently a proposal - socket.write(frame.createFrame(opcodes.CLOSE), (err) => { - if (!err) { - this[kSentClose] = true - } - }) + // 4. Return the IDL DataView value that is a reference + // to the same object as V. + return V +} - // Upon either sending or receiving a Close control frame, it is said - // that _The WebSocket Closing Handshake is Started_ and that the - // WebSocket connection is in the CLOSING state. - this[kReadyState] = states.CLOSING - } else { - // Otherwise - // Set this's ready state to CLOSING (2). - this[kReadyState] = WebSocket.CLOSING - } +// https://webidl.spec.whatwg.org/#BufferSource +webidl.converters.BufferSource = function (V, opts = {}) { + if (types.isAnyArrayBuffer(V)) { + return webidl.converters.ArrayBuffer(V, opts) } - /** - * @see https://websockets.spec.whatwg.org/#dom-websocket-send - * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data - */ - send (data) { - webidl.brandCheck(this, WebSocket) - - webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket.send' }) + if (types.isTypedArray(V)) { + return webidl.converters.TypedArray(V, V.constructor) + } - data = webidl.converters.WebSocketSendData(data) + if (types.isDataView(V)) { + return webidl.converters.DataView(V, opts) + } - // 1. If this's ready state is CONNECTING, then throw an - // "InvalidStateError" DOMException. - if (this[kReadyState] === WebSocket.CONNECTING) { - throw new DOMException('Sent before connected.', 'InvalidStateError') - } + throw new TypeError(`Could not convert ${V} to a BufferSource.`) +} - // 2. Run the appropriate set of steps from the following list: - // https://datatracker.ietf.org/doc/html/rfc6455#section-6.1 - // https://datatracker.ietf.org/doc/html/rfc6455#section-5.2 +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.ByteString +) - if (!isEstablished(this) || isClosing(this)) { - return - } +webidl.converters['sequence>'] = webidl.sequenceConverter( + webidl.converters['sequence'] +) - /** @type {import('stream').Duplex} */ - const socket = this[kResponse].socket +webidl.converters['record'] = webidl.recordConverter( + webidl.converters.ByteString, + webidl.converters.ByteString +) - // If data is a string - if (typeof data === 'string') { - // If the WebSocket connection is established and the WebSocket - // closing handshake has not yet started, then the user agent - // must send a WebSocket Message comprised of the data argument - // using a text frame opcode; if the data cannot be sent, e.g. - // because it would need to be buffered but the buffer is full, - // the user agent must flag the WebSocket as full and then close - // the WebSocket connection. Any invocation of this method with a - // string argument that does not throw an exception must increase - // the bufferedAmount attribute by the number of bytes needed to - // express the argument as UTF-8. +module.exports = { + webidl +} - const value = Buffer.from(data) - const frame = new WebsocketFrameSend(value) - const buffer = frame.createFrame(opcodes.TEXT) - this.#bufferedAmount += value.byteLength - socket.write(buffer, () => { - this.#bufferedAmount -= value.byteLength - }) - } else if (types.isArrayBuffer(data)) { - // If the WebSocket connection is established, and the WebSocket - // closing handshake has not yet started, then the user agent must - // send a WebSocket Message comprised of data using a binary frame - // opcode; if the data cannot be sent, e.g. because it would need - // to be buffered but the buffer is full, the user agent must flag - // the WebSocket as full and then close the WebSocket connection. - // The data to be sent is the data stored in the buffer described - // by the ArrayBuffer object. Any invocation of this method with an - // ArrayBuffer argument that does not throw an exception must - // increase the bufferedAmount attribute by the length of the - // ArrayBuffer in bytes. +/***/ }), - const value = Buffer.from(data) - const frame = new WebsocketFrameSend(value) - const buffer = frame.createFrame(opcodes.BINARY) +/***/ 84854: +/***/ ((module) => { - this.#bufferedAmount += value.byteLength - socket.write(buffer, () => { - this.#bufferedAmount -= value.byteLength - }) - } else if (ArrayBuffer.isView(data)) { - // If the WebSocket connection is established, and the WebSocket - // closing handshake has not yet started, then the user agent must - // send a WebSocket Message comprised of data using a binary frame - // opcode; if the data cannot be sent, e.g. because it would need to - // be buffered but the buffer is full, the user agent must flag the - // WebSocket as full and then close the WebSocket connection. The - // data to be sent is the data stored in the section of the buffer - // described by the ArrayBuffer object that data references. Any - // invocation of this method with this kind of argument that does - // not throw an exception must increase the bufferedAmount attribute - // by the length of data’s buffer in bytes. +"use strict"; - const ab = Buffer.from(data, data.byteOffset, data.byteLength) - const frame = new WebsocketFrameSend(ab) - const buffer = frame.createFrame(opcodes.BINARY) +/** + * @see https://encoding.spec.whatwg.org/#concept-encoding-get + * @param {string|undefined} label + */ +function getEncoding (label) { + if (!label) { + return 'failure' + } - this.#bufferedAmount += ab.byteLength - socket.write(buffer, () => { - this.#bufferedAmount -= ab.byteLength - }) - } else if (isBlobLike(data)) { - // If the WebSocket connection is established, and the WebSocket - // closing handshake has not yet started, then the user agent must - // send a WebSocket Message comprised of data using a binary frame - // opcode; if the data cannot be sent, e.g. because it would need to - // be buffered but the buffer is full, the user agent must flag the - // WebSocket as full and then close the WebSocket connection. The data - // to be sent is the raw data represented by the Blob object. Any - // invocation of this method with a Blob argument that does not throw - // an exception must increase the bufferedAmount attribute by the size - // of the Blob object’s raw data, in bytes. + // 1. Remove any leading and trailing ASCII whitespace from label. + // 2. If label is an ASCII case-insensitive match for any of the + // labels listed in the table below, then return the + // corresponding encoding; otherwise return failure. + switch (label.trim().toLowerCase()) { + case 'unicode-1-1-utf-8': + case 'unicode11utf8': + case 'unicode20utf8': + case 'utf-8': + case 'utf8': + case 'x-unicode20utf8': + return 'UTF-8' + case '866': + case 'cp866': + case 'csibm866': + case 'ibm866': + return 'IBM866' + case 'csisolatin2': + case 'iso-8859-2': + case 'iso-ir-101': + case 'iso8859-2': + case 'iso88592': + case 'iso_8859-2': + case 'iso_8859-2:1987': + case 'l2': + case 'latin2': + return 'ISO-8859-2' + case 'csisolatin3': + case 'iso-8859-3': + case 'iso-ir-109': + case 'iso8859-3': + case 'iso88593': + case 'iso_8859-3': + case 'iso_8859-3:1988': + case 'l3': + case 'latin3': + return 'ISO-8859-3' + case 'csisolatin4': + case 'iso-8859-4': + case 'iso-ir-110': + case 'iso8859-4': + case 'iso88594': + case 'iso_8859-4': + case 'iso_8859-4:1988': + case 'l4': + case 'latin4': + return 'ISO-8859-4' + case 'csisolatincyrillic': + case 'cyrillic': + case 'iso-8859-5': + case 'iso-ir-144': + case 'iso8859-5': + case 'iso88595': + case 'iso_8859-5': + case 'iso_8859-5:1988': + return 'ISO-8859-5' + case 'arabic': + case 'asmo-708': + case 'csiso88596e': + case 'csiso88596i': + case 'csisolatinarabic': + case 'ecma-114': + case 'iso-8859-6': + case 'iso-8859-6-e': + case 'iso-8859-6-i': + case 'iso-ir-127': + case 'iso8859-6': + case 'iso88596': + case 'iso_8859-6': + case 'iso_8859-6:1987': + return 'ISO-8859-6' + case 'csisolatingreek': + case 'ecma-118': + case 'elot_928': + case 'greek': + case 'greek8': + case 'iso-8859-7': + case 'iso-ir-126': + case 'iso8859-7': + case 'iso88597': + case 'iso_8859-7': + case 'iso_8859-7:1987': + case 'sun_eu_greek': + return 'ISO-8859-7' + case 'csiso88598e': + case 'csisolatinhebrew': + case 'hebrew': + case 'iso-8859-8': + case 'iso-8859-8-e': + case 'iso-ir-138': + case 'iso8859-8': + case 'iso88598': + case 'iso_8859-8': + case 'iso_8859-8:1988': + case 'visual': + return 'ISO-8859-8' + case 'csiso88598i': + case 'iso-8859-8-i': + case 'logical': + return 'ISO-8859-8-I' + case 'csisolatin6': + case 'iso-8859-10': + case 'iso-ir-157': + case 'iso8859-10': + case 'iso885910': + case 'l6': + case 'latin6': + return 'ISO-8859-10' + case 'iso-8859-13': + case 'iso8859-13': + case 'iso885913': + return 'ISO-8859-13' + case 'iso-8859-14': + case 'iso8859-14': + case 'iso885914': + return 'ISO-8859-14' + case 'csisolatin9': + case 'iso-8859-15': + case 'iso8859-15': + case 'iso885915': + case 'iso_8859-15': + case 'l9': + return 'ISO-8859-15' + case 'iso-8859-16': + return 'ISO-8859-16' + case 'cskoi8r': + case 'koi': + case 'koi8': + case 'koi8-r': + case 'koi8_r': + return 'KOI8-R' + case 'koi8-ru': + case 'koi8-u': + return 'KOI8-U' + case 'csmacintosh': + case 'mac': + case 'macintosh': + case 'x-mac-roman': + return 'macintosh' + case 'iso-8859-11': + case 'iso8859-11': + case 'iso885911': + case 'tis-620': + case 'windows-874': + return 'windows-874' + case 'cp1250': + case 'windows-1250': + case 'x-cp1250': + return 'windows-1250' + case 'cp1251': + case 'windows-1251': + case 'x-cp1251': + return 'windows-1251' + case 'ansi_x3.4-1968': + case 'ascii': + case 'cp1252': + case 'cp819': + case 'csisolatin1': + case 'ibm819': + case 'iso-8859-1': + case 'iso-ir-100': + case 'iso8859-1': + case 'iso88591': + case 'iso_8859-1': + case 'iso_8859-1:1987': + case 'l1': + case 'latin1': + case 'us-ascii': + case 'windows-1252': + case 'x-cp1252': + return 'windows-1252' + case 'cp1253': + case 'windows-1253': + case 'x-cp1253': + return 'windows-1253' + case 'cp1254': + case 'csisolatin5': + case 'iso-8859-9': + case 'iso-ir-148': + case 'iso8859-9': + case 'iso88599': + case 'iso_8859-9': + case 'iso_8859-9:1989': + case 'l5': + case 'latin5': + case 'windows-1254': + case 'x-cp1254': + return 'windows-1254' + case 'cp1255': + case 'windows-1255': + case 'x-cp1255': + return 'windows-1255' + case 'cp1256': + case 'windows-1256': + case 'x-cp1256': + return 'windows-1256' + case 'cp1257': + case 'windows-1257': + case 'x-cp1257': + return 'windows-1257' + case 'cp1258': + case 'windows-1258': + case 'x-cp1258': + return 'windows-1258' + case 'x-mac-cyrillic': + case 'x-mac-ukrainian': + return 'x-mac-cyrillic' + case 'chinese': + case 'csgb2312': + case 'csiso58gb231280': + case 'gb2312': + case 'gb_2312': + case 'gb_2312-80': + case 'gbk': + case 'iso-ir-58': + case 'x-gbk': + return 'GBK' + case 'gb18030': + return 'gb18030' + case 'big5': + case 'big5-hkscs': + case 'cn-big5': + case 'csbig5': + case 'x-x-big5': + return 'Big5' + case 'cseucpkdfmtjapanese': + case 'euc-jp': + case 'x-euc-jp': + return 'EUC-JP' + case 'csiso2022jp': + case 'iso-2022-jp': + return 'ISO-2022-JP' + case 'csshiftjis': + case 'ms932': + case 'ms_kanji': + case 'shift-jis': + case 'shift_jis': + case 'sjis': + case 'windows-31j': + case 'x-sjis': + return 'Shift_JIS' + case 'cseuckr': + case 'csksc56011987': + case 'euc-kr': + case 'iso-ir-149': + case 'korean': + case 'ks_c_5601-1987': + case 'ks_c_5601-1989': + case 'ksc5601': + case 'ksc_5601': + case 'windows-949': + return 'EUC-KR' + case 'csiso2022kr': + case 'hz-gb-2312': + case 'iso-2022-cn': + case 'iso-2022-cn-ext': + case 'iso-2022-kr': + case 'replacement': + return 'replacement' + case 'unicodefffe': + case 'utf-16be': + return 'UTF-16BE' + case 'csunicode': + case 'iso-10646-ucs-2': + case 'ucs-2': + case 'unicode': + case 'unicodefeff': + case 'utf-16': + case 'utf-16le': + return 'UTF-16LE' + case 'x-user-defined': + return 'x-user-defined' + default: return 'failure' + } +} - const frame = new WebsocketFrameSend() +module.exports = { + getEncoding +} - data.arrayBuffer().then((ab) => { - const value = Buffer.from(ab) - frame.frameData = value - const buffer = frame.createFrame(opcodes.BINARY) - this.#bufferedAmount += value.byteLength - socket.write(buffer, () => { - this.#bufferedAmount -= value.byteLength - }) - }) - } - } +/***/ }), - get readyState () { - webidl.brandCheck(this, WebSocket) +/***/ 1446: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // The readyState getter steps are to return this's ready state. - return this[kReadyState] - } +"use strict"; - get bufferedAmount () { - webidl.brandCheck(this, WebSocket) - return this.#bufferedAmount - } +const { + staticPropertyDescriptors, + readOperation, + fireAProgressEvent +} = __nccwpck_require__(87530) +const { + kState, + kError, + kResult, + kEvents, + kAborted +} = __nccwpck_require__(29054) +const { webidl } = __nccwpck_require__(21744) +const { kEnumerableProperty } = __nccwpck_require__(83983) - get url () { - webidl.brandCheck(this, WebSocket) +class FileReader extends EventTarget { + constructor () { + super() - // The url getter steps are to return this's url, serialized. - return URLSerializer(this[kWebSocketURL]) + this[kState] = 'empty' + this[kResult] = null + this[kError] = null + this[kEvents] = { + loadend: null, + error: null, + abort: null, + load: null, + progress: null, + loadstart: null + } } - get extensions () { - webidl.brandCheck(this, WebSocket) + /** + * @see https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer + * @param {import('buffer').Blob} blob + */ + readAsArrayBuffer (blob) { + webidl.brandCheck(this, FileReader) - return this.#extensions - } + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsArrayBuffer' }) - get protocol () { - webidl.brandCheck(this, WebSocket) + blob = webidl.converters.Blob(blob, { strict: false }) - return this.#protocol + // The readAsArrayBuffer(blob) method, when invoked, + // must initiate a read operation for blob with ArrayBuffer. + readOperation(this, blob, 'ArrayBuffer') } - get onopen () { - webidl.brandCheck(this, WebSocket) - - return this.#events.open - } + /** + * @see https://w3c.github.io/FileAPI/#readAsBinaryString + * @param {import('buffer').Blob} blob + */ + readAsBinaryString (blob) { + webidl.brandCheck(this, FileReader) - set onopen (fn) { - webidl.brandCheck(this, WebSocket) + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsBinaryString' }) - if (this.#events.open) { - this.removeEventListener('open', this.#events.open) - } + blob = webidl.converters.Blob(blob, { strict: false }) - if (typeof fn === 'function') { - this.#events.open = fn - this.addEventListener('open', fn) - } else { - this.#events.open = null - } + // The readAsBinaryString(blob) method, when invoked, + // must initiate a read operation for blob with BinaryString. + readOperation(this, blob, 'BinaryString') } - get onerror () { - webidl.brandCheck(this, WebSocket) + /** + * @see https://w3c.github.io/FileAPI/#readAsDataText + * @param {import('buffer').Blob} blob + * @param {string?} encoding + */ + readAsText (blob, encoding = undefined) { + webidl.brandCheck(this, FileReader) - return this.#events.error - } + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsText' }) - set onerror (fn) { - webidl.brandCheck(this, WebSocket) + blob = webidl.converters.Blob(blob, { strict: false }) - if (this.#events.error) { - this.removeEventListener('error', this.#events.error) + if (encoding !== undefined) { + encoding = webidl.converters.DOMString(encoding) } - if (typeof fn === 'function') { - this.#events.error = fn - this.addEventListener('error', fn) - } else { - this.#events.error = null - } + // The readAsText(blob, encoding) method, when invoked, + // must initiate a read operation for blob with Text and encoding. + readOperation(this, blob, 'Text', encoding) } - get onclose () { - webidl.brandCheck(this, WebSocket) + /** + * @see https://w3c.github.io/FileAPI/#dfn-readAsDataURL + * @param {import('buffer').Blob} blob + */ + readAsDataURL (blob) { + webidl.brandCheck(this, FileReader) - return this.#events.close - } + webidl.argumentLengthCheck(arguments, 1, { header: 'FileReader.readAsDataURL' }) - set onclose (fn) { - webidl.brandCheck(this, WebSocket) + blob = webidl.converters.Blob(blob, { strict: false }) - if (this.#events.close) { - this.removeEventListener('close', this.#events.close) - } + // The readAsDataURL(blob) method, when invoked, must + // initiate a read operation for blob with DataURL. + readOperation(this, blob, 'DataURL') + } - if (typeof fn === 'function') { - this.#events.close = fn - this.addEventListener('close', fn) - } else { - this.#events.close = null + /** + * @see https://w3c.github.io/FileAPI/#dfn-abort + */ + abort () { + // 1. If this's state is "empty" or if this's state is + // "done" set this's result to null and terminate + // this algorithm. + if (this[kState] === 'empty' || this[kState] === 'done') { + this[kResult] = null + return } - } - get onmessage () { - webidl.brandCheck(this, WebSocket) + // 2. If this's state is "loading" set this's state to + // "done" and set this's result to null. + if (this[kState] === 'loading') { + this[kState] = 'done' + this[kResult] = null + } - return this.#events.message - } + // 3. If there are any tasks from this on the file reading + // task source in an affiliated task queue, then remove + // those tasks from that task queue. + this[kAborted] = true - set onmessage (fn) { - webidl.brandCheck(this, WebSocket) + // 4. Terminate the algorithm for the read method being processed. + // TODO - if (this.#events.message) { - this.removeEventListener('message', this.#events.message) - } + // 5. Fire a progress event called abort at this. + fireAProgressEvent('abort', this) - if (typeof fn === 'function') { - this.#events.message = fn - this.addEventListener('message', fn) - } else { - this.#events.message = null + // 6. If this's state is not "loading", fire a progress + // event called loadend at this. + if (this[kState] !== 'loading') { + fireAProgressEvent('loadend', this) } } - get binaryType () { - webidl.brandCheck(this, WebSocket) + /** + * @see https://w3c.github.io/FileAPI/#dom-filereader-readystate + */ + get readyState () { + webidl.brandCheck(this, FileReader) - return this[kBinaryType] + switch (this[kState]) { + case 'empty': return this.EMPTY + case 'loading': return this.LOADING + case 'done': return this.DONE + } } - set binaryType (type) { - webidl.brandCheck(this, WebSocket) + /** + * @see https://w3c.github.io/FileAPI/#dom-filereader-result + */ + get result () { + webidl.brandCheck(this, FileReader) - if (type !== 'blob' && type !== 'arraybuffer') { - this[kBinaryType] = 'blob' - } else { - this[kBinaryType] = type - } + // The result attribute’s getter, when invoked, must return + // this's result. + return this[kResult] } /** - * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol + * @see https://w3c.github.io/FileAPI/#dom-filereader-error */ - #onConnectionEstablished (response) { - // processResponse is called when the "response’s header list has been received and initialized." - // once this happens, the connection is open - this[kResponse] = response + get error () { + webidl.brandCheck(this, FileReader) - const parser = new ByteParser(this) - parser.on('drain', function onParserDrain () { - this.ws[kResponse].socket.resume() - }) + // The error attribute’s getter, when invoked, must return + // this's error. + return this[kError] + } - response.socket.ws = this - this[kByteParser] = parser + get onloadend () { + webidl.brandCheck(this, FileReader) - // 1. Change the ready state to OPEN (1). - this[kReadyState] = states.OPEN + return this[kEvents].loadend + } - // 2. Change the extensions attribute’s value to the extensions in use, if - // it is not the null value. - // https://datatracker.ietf.org/doc/html/rfc6455#section-9.1 - const extensions = response.headersList.get('sec-websocket-extensions') + set onloadend (fn) { + webidl.brandCheck(this, FileReader) - if (extensions !== null) { - this.#extensions = extensions + if (this[kEvents].loadend) { + this.removeEventListener('loadend', this[kEvents].loadend) } - // 3. Change the protocol attribute’s value to the subprotocol in use, if - // it is not the null value. - // https://datatracker.ietf.org/doc/html/rfc6455#section-1.9 - const protocol = response.headersList.get('sec-websocket-protocol') + if (typeof fn === 'function') { + this[kEvents].loadend = fn + this.addEventListener('loadend', fn) + } else { + this[kEvents].loadend = null + } + } - if (protocol !== null) { - this.#protocol = protocol + get onerror () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].error + } + + set onerror (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].error) { + this.removeEventListener('error', this[kEvents].error) } - // 4. Fire an event named open at the WebSocket object. - fireEvent('open', this) + if (typeof fn === 'function') { + this[kEvents].error = fn + this.addEventListener('error', fn) + } else { + this[kEvents].error = null + } } -} -// https://websockets.spec.whatwg.org/#dom-websocket-connecting -WebSocket.CONNECTING = WebSocket.prototype.CONNECTING = states.CONNECTING -// https://websockets.spec.whatwg.org/#dom-websocket-open -WebSocket.OPEN = WebSocket.prototype.OPEN = states.OPEN -// https://websockets.spec.whatwg.org/#dom-websocket-closing -WebSocket.CLOSING = WebSocket.prototype.CLOSING = states.CLOSING -// https://websockets.spec.whatwg.org/#dom-websocket-closed -WebSocket.CLOSED = WebSocket.prototype.CLOSED = states.CLOSED + get onloadstart () { + webidl.brandCheck(this, FileReader) -Object.defineProperties(WebSocket.prototype, { - CONNECTING: staticPropertyDescriptors, - OPEN: staticPropertyDescriptors, - CLOSING: staticPropertyDescriptors, - CLOSED: staticPropertyDescriptors, - url: kEnumerableProperty, - readyState: kEnumerableProperty, - bufferedAmount: kEnumerableProperty, - onopen: kEnumerableProperty, - onerror: kEnumerableProperty, - onclose: kEnumerableProperty, - close: kEnumerableProperty, - onmessage: kEnumerableProperty, - binaryType: kEnumerableProperty, - send: kEnumerableProperty, - extensions: kEnumerableProperty, - protocol: kEnumerableProperty, - [Symbol.toStringTag]: { - value: 'WebSocket', - writable: false, - enumerable: false, - configurable: true + return this[kEvents].loadstart } -}) -Object.defineProperties(WebSocket, { - CONNECTING: staticPropertyDescriptors, - OPEN: staticPropertyDescriptors, - CLOSING: staticPropertyDescriptors, - CLOSED: staticPropertyDescriptors -}) + set onloadstart (fn) { + webidl.brandCheck(this, FileReader) -webidl.converters['sequence'] = webidl.sequenceConverter( - webidl.converters.DOMString -) + if (this[kEvents].loadstart) { + this.removeEventListener('loadstart', this[kEvents].loadstart) + } -webidl.converters['DOMString or sequence'] = function (V) { - if (webidl.util.Type(V) === 'Object' && Symbol.iterator in V) { - return webidl.converters['sequence'](V) + if (typeof fn === 'function') { + this[kEvents].loadstart = fn + this.addEventListener('loadstart', fn) + } else { + this[kEvents].loadstart = null + } } - return webidl.converters.DOMString(V) -} + get onprogress () { + webidl.brandCheck(this, FileReader) -// This implements the propsal made in https://github.com/whatwg/websockets/issues/42 -webidl.converters.WebSocketInit = webidl.dictionaryConverter([ - { - key: 'protocols', - converter: webidl.converters['DOMString or sequence'], - get defaultValue () { - return [] + return this[kEvents].progress + } + + set onprogress (fn) { + webidl.brandCheck(this, FileReader) + + if (this[kEvents].progress) { + this.removeEventListener('progress', this[kEvents].progress) } - }, - { - key: 'dispatcher', - converter: (V) => V, - get defaultValue () { - return getGlobalDispatcher() + + if (typeof fn === 'function') { + this[kEvents].progress = fn + this.addEventListener('progress', fn) + } else { + this[kEvents].progress = null } - }, - { - key: 'headers', - converter: webidl.nullableConverter(webidl.converters.HeadersInit) } -]) -webidl.converters['DOMString or sequence or WebSocketInit'] = function (V) { - if (webidl.util.Type(V) === 'Object' && !(Symbol.iterator in V)) { - return webidl.converters.WebSocketInit(V) + get onload () { + webidl.brandCheck(this, FileReader) + + return this[kEvents].load } - return { protocols: webidl.converters['DOMString or sequence'](V) } -} + set onload (fn) { + webidl.brandCheck(this, FileReader) -webidl.converters.WebSocketSendData = function (V) { - if (webidl.util.Type(V) === 'Object') { - if (isBlobLike(V)) { - return webidl.converters.Blob(V, { strict: false }) + if (this[kEvents].load) { + this.removeEventListener('load', this[kEvents].load) } - if (ArrayBuffer.isView(V) || types.isAnyArrayBuffer(V)) { - return webidl.converters.BufferSource(V) + if (typeof fn === 'function') { + this[kEvents].load = fn + this.addEventListener('load', fn) + } else { + this[kEvents].load = null } } - return webidl.converters.USVString(V) -} - -module.exports = { - WebSocket -} + get onabort () { + webidl.brandCheck(this, FileReader) + return this[kEvents].abort + } -/***/ }), + set onabort (fn) { + webidl.brandCheck(this, FileReader) -/***/ 92707: -/***/ ((module) => { + if (this[kEvents].abort) { + this.removeEventListener('abort', this[kEvents].abort) + } -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ -var byteToHex = []; -for (var i = 0; i < 256; ++i) { - byteToHex[i] = (i + 0x100).toString(16).substr(1); + if (typeof fn === 'function') { + this[kEvents].abort = fn + this.addEventListener('abort', fn) + } else { + this[kEvents].abort = null + } + } } -function bytesToUuid(buf, offset) { - var i = offset || 0; - var bth = byteToHex; - // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - return ([ - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]] - ]).join(''); -} +// https://w3c.github.io/FileAPI/#dom-filereader-empty +FileReader.EMPTY = FileReader.prototype.EMPTY = 0 +// https://w3c.github.io/FileAPI/#dom-filereader-loading +FileReader.LOADING = FileReader.prototype.LOADING = 1 +// https://w3c.github.io/FileAPI/#dom-filereader-done +FileReader.DONE = FileReader.prototype.DONE = 2 -module.exports = bytesToUuid; +Object.defineProperties(FileReader.prototype, { + EMPTY: staticPropertyDescriptors, + LOADING: staticPropertyDescriptors, + DONE: staticPropertyDescriptors, + readAsArrayBuffer: kEnumerableProperty, + readAsBinaryString: kEnumerableProperty, + readAsText: kEnumerableProperty, + readAsDataURL: kEnumerableProperty, + abort: kEnumerableProperty, + readyState: kEnumerableProperty, + result: kEnumerableProperty, + error: kEnumerableProperty, + onloadstart: kEnumerableProperty, + onprogress: kEnumerableProperty, + onload: kEnumerableProperty, + onabort: kEnumerableProperty, + onerror: kEnumerableProperty, + onloadend: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'FileReader', + writable: false, + enumerable: false, + configurable: true + } +}) + +Object.defineProperties(FileReader, { + EMPTY: staticPropertyDescriptors, + LOADING: staticPropertyDescriptors, + DONE: staticPropertyDescriptors +}) + +module.exports = { + FileReader +} /***/ }), -/***/ 15859: +/***/ 55504: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// Unique ID creation requires a high quality random # generator. In node.js -// this is pretty straight-forward - we use the crypto API. +"use strict"; -var crypto = __nccwpck_require__(6113); -module.exports = function nodeRNG() { - return crypto.randomBytes(16); -}; +const { webidl } = __nccwpck_require__(21744) +const kState = Symbol('ProgressEvent state') -/***/ }), +/** + * @see https://xhr.spec.whatwg.org/#progressevent + */ +class ProgressEvent extends Event { + constructor (type, eventInitDict = {}) { + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.ProgressEventInit(eventInitDict ?? {}) -/***/ 80824: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + super(type, eventInitDict) -var rng = __nccwpck_require__(15859); -var bytesToUuid = __nccwpck_require__(92707); + this[kState] = { + lengthComputable: eventInitDict.lengthComputable, + loaded: eventInitDict.loaded, + total: eventInitDict.total + } + } -function v4(options, buf, offset) { - var i = buf && offset || 0; + get lengthComputable () { + webidl.brandCheck(this, ProgressEvent) - if (typeof(options) == 'string') { - buf = options === 'binary' ? new Array(16) : null; - options = null; + return this[kState].lengthComputable } - options = options || {}; - var rnds = options.random || (options.rng || rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; + get loaded () { + webidl.brandCheck(this, ProgressEvent) - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ++ii) { - buf[i + ii] = rnds[ii]; - } + return this[kState].loaded } - return buf || bytesToUuid(rnds); + get total () { + webidl.brandCheck(this, ProgressEvent) + + return this[kState].total + } } -module.exports = v4; +webidl.converters.ProgressEventInit = webidl.dictionaryConverter([ + { + key: 'lengthComputable', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'loaded', + converter: webidl.converters['unsigned long long'], + defaultValue: 0 + }, + { + key: 'total', + converter: webidl.converters['unsigned long long'], + defaultValue: 0 + }, + { + key: 'bubbles', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'cancelable', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'composed', + converter: webidl.converters.boolean, + defaultValue: false + } +]) + +module.exports = { + ProgressEvent +} /***/ }), -/***/ 95696: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 29054: +/***/ ((module) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(56417); -var util_1 = __nccwpck_require__(76195); -var util_2 = __nccwpck_require__(65282); -var _1 = __nccwpck_require__(44260); -var dom_1 = __nccwpck_require__(40770); -/** @inheritdoc */ -function builder(p1, p2) { - var options = formatBuilderOptions(isXMLBuilderCreateOptions(p1) ? p1 : interfaces_1.DefaultBuilderOptions); - var nodes = util_2.Guard.isNode(p1) || util_1.isArray(p1) ? p1 : p2; - if (nodes === undefined) { - throw new Error("Invalid arguments."); - } - if (util_1.isArray(nodes)) { - var builders = []; - for (var i = 0; i < nodes.length; i++) { - var builder_1 = new _1.XMLBuilderImpl(nodes[i]); - builder_1.set(options); - builders.push(builder_1); - } - return builders; - } - else { - var builder_2 = new _1.XMLBuilderImpl(nodes); - builder_2.set(options); - return builder_2; - } -} -exports.builder = builder; -/** @inheritdoc */ -function create(p1, p2) { - var options = formatBuilderOptions(p1 === undefined || isXMLBuilderCreateOptions(p1) ? - p1 : interfaces_1.DefaultBuilderOptions); - var contents = isXMLBuilderCreateOptions(p1) ? p2 : p1; - var doc = dom_1.createDocument(); - setOptions(doc, options); - var builder = new _1.XMLBuilderImpl(doc); - if (contents !== undefined) { - // parse contents - builder.ele(contents); - } - return builder; -} -exports.create = create; -/** @inheritdoc */ -function fragment(p1, p2) { - var options = formatBuilderOptions(p1 === undefined || isXMLBuilderCreateOptions(p1) ? - p1 : interfaces_1.DefaultBuilderOptions); - var contents = isXMLBuilderCreateOptions(p1) ? p2 : p1; - var doc = dom_1.createDocument(); - setOptions(doc, options, true); - var builder = new _1.XMLBuilderImpl(doc.createDocumentFragment()); - if (contents !== undefined) { - // parse contents - builder.ele(contents); - } - return builder; -} -exports.fragment = fragment; -/** @inheritdoc */ -function convert(p1, p2, p3) { - var builderOptions; - var contents; - var convertOptions; - if (isXMLBuilderCreateOptions(p1) && p2 !== undefined) { - builderOptions = p1; - contents = p2; - convertOptions = p3; - } - else { - builderOptions = interfaces_1.DefaultBuilderOptions; - contents = p1; - convertOptions = p2 || undefined; - } - return create(builderOptions, contents).end(convertOptions); -} -exports.convert = convert; -function isXMLBuilderCreateOptions(obj) { - if (!util_1.isPlainObject(obj)) - return false; - for (var key in obj) { - /* istanbul ignore else */ - if (obj.hasOwnProperty(key)) { - if (!interfaces_1.XMLBuilderOptionKeys.has(key)) - return false; - } - } - return true; -} -function formatBuilderOptions(createOptions) { - if (createOptions === void 0) { createOptions = {}; } - var options = util_1.applyDefaults(createOptions, interfaces_1.DefaultBuilderOptions); - if (options.convert.att.length === 0 || - options.convert.ins.length === 0 || - options.convert.text.length === 0 || - options.convert.cdata.length === 0 || - options.convert.comment.length === 0) { - throw new Error("JS object converter strings cannot be zero length."); - } - return options; -} -function setOptions(doc, options, isFragment) { - var docWithSettings = doc; - docWithSettings._xmlBuilderOptions = options; - docWithSettings._isFragment = isFragment; + +module.exports = { + kState: Symbol('FileReader state'), + kResult: Symbol('FileReader result'), + kError: Symbol('FileReader error'), + kLastProgressEventFired: Symbol('FileReader last progress event fired timestamp'), + kEvents: Symbol('FileReader events'), + kAborted: Symbol('FileReader aborted') } -//# sourceMappingURL=BuilderFunctions.js.map + /***/ }), -/***/ 10268: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 87530: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var _1 = __nccwpck_require__(44260); -/** - * Creates an XML builder which serializes the document in chunks. - * - * @param options - callback builder options - * - * @returns callback builder - */ -function createCB(options) { - return new _1.XMLBuilderCBImpl(options); + +const { + kState, + kError, + kResult, + kAborted, + kLastProgressEventFired +} = __nccwpck_require__(29054) +const { ProgressEvent } = __nccwpck_require__(55504) +const { getEncoding } = __nccwpck_require__(84854) +const { DOMException } = __nccwpck_require__(41037) +const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(685) +const { types } = __nccwpck_require__(73837) +const { StringDecoder } = __nccwpck_require__(71576) +const { btoa } = __nccwpck_require__(14300) + +/** @type {PropertyDescriptor} */ +const staticPropertyDescriptors = { + enumerable: true, + writable: false, + configurable: false } -exports.createCB = createCB; + /** - * Creates an XML builder which serializes the fragment in chunks. - * - * @param options - callback builder options - * - * @returns callback builder + * @see https://w3c.github.io/FileAPI/#readOperation + * @param {import('./filereader').FileReader} fr + * @param {import('buffer').Blob} blob + * @param {string} type + * @param {string?} encodingName */ -function fragmentCB(options) { - return new _1.XMLBuilderCBImpl(options, true); -} -exports.fragmentCB = fragmentCB; -//# sourceMappingURL=BuilderFunctionsCB.js.map +function readOperation (fr, blob, type, encodingName) { + // 1. If fr’s state is "loading", throw an InvalidStateError + // DOMException. + if (fr[kState] === 'loading') { + throw new DOMException('Invalid state', 'InvalidStateError') + } -/***/ }), + // 2. Set fr’s state to "loading". + fr[kState] = 'loading' -/***/ 71438: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + // 3. Set fr’s result to null. + fr[kResult] = null -"use strict"; + // 4. Set fr’s error to null. + fr[kError] = null -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(56417); -var util_1 = __nccwpck_require__(76195); -var BuilderFunctions_1 = __nccwpck_require__(95696); -var algorithm_1 = __nccwpck_require__(61); -var infra_1 = __nccwpck_require__(84251); -var NamespacePrefixMap_1 = __nccwpck_require__(90283); -var LocalNameSet_1 = __nccwpck_require__(19049); -var util_2 = __nccwpck_require__(65282); -var XMLCBWriter_1 = __nccwpck_require__(77572); -var JSONCBWriter_1 = __nccwpck_require__(37525); -var YAMLCBWriter_1 = __nccwpck_require__(42444); -var events_1 = __nccwpck_require__(82361); -/** - * Represents a readable XML document stream. - */ -var XMLBuilderCBImpl = /** @class */ (function (_super) { - __extends(XMLBuilderCBImpl, _super); - /** - * Initializes a new instance of `XMLStream`. - * - * @param options - stream writer options - * @param fragment - whether to create fragment stream or a document stream - * - * @returns XML stream - */ - function XMLBuilderCBImpl(options, fragment) { - if (fragment === void 0) { fragment = false; } - var _this = _super.call(this) || this; - _this._hasDeclaration = false; - _this._docTypeName = ""; - _this._hasDocumentElement = false; - _this._currentElementSerialized = false; - _this._openTags = []; - _this._ended = false; - _this._fragment = fragment; - // provide default options - _this._options = util_1.applyDefaults(options || {}, interfaces_1.DefaultXMLBuilderCBOptions); - _this._builderOptions = { - defaultNamespace: _this._options.defaultNamespace, - namespaceAlias: _this._options.namespaceAlias - }; - if (_this._options.format === "json") { - _this._writer = new JSONCBWriter_1.JSONCBWriter(_this._options); - } - else if (_this._options.format === "yaml") { - _this._writer = new YAMLCBWriter_1.YAMLCBWriter(_this._options); - } - else { - _this._writer = new XMLCBWriter_1.XMLCBWriter(_this._options); - } - // automatically create listeners for callbacks passed via options - if (_this._options.data !== undefined) { - _this.on("data", _this._options.data); - } - if (_this._options.end !== undefined) { - _this.on("end", _this._options.end); - } - if (_this._options.error !== undefined) { - _this.on("error", _this._options.error); + // 5. Let stream be the result of calling get stream on blob. + /** @type {import('stream/web').ReadableStream} */ + const stream = blob.stream() + + // 6. Let reader be the result of getting a reader from stream. + const reader = stream.getReader() + + // 7. Let bytes be an empty byte sequence. + /** @type {Uint8Array[]} */ + const bytes = [] + + // 8. Let chunkPromise be the result of reading a chunk from + // stream with reader. + let chunkPromise = reader.read() + + // 9. Let isFirstChunk be true. + let isFirstChunk = true + + // 10. In parallel, while true: + // Note: "In parallel" just means non-blocking + // Note 2: readOperation itself cannot be async as double + // reading the body would then reject the promise, instead + // of throwing an error. + ;(async () => { + while (!fr[kAborted]) { + // 1. Wait for chunkPromise to be fulfilled or rejected. + try { + const { done, value } = await chunkPromise + + // 2. If chunkPromise is fulfilled, and isFirstChunk is + // true, queue a task to fire a progress event called + // loadstart at fr. + if (isFirstChunk && !fr[kAborted]) { + queueMicrotask(() => { + fireAProgressEvent('loadstart', fr) + }) } - _this._prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); - _this._prefixMap.set("xml", infra_1.namespace.XML); - _this._prefixIndex = { value: 1 }; - _this._push(_this._writer.frontMatter()); - return _this; - } - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.ele = function (p1, p2, p3) { - var e_1, _a; - // parse if JS object or XML or JSON string - if (util_1.isObject(p1) || (util_1.isString(p1) && (/^\s*= 50 + ) && + !fr[kAborted] + ) { + fr[kLastProgressEventFired] = Date.now() + queueMicrotask(() => { + fireAProgressEvent('progress', fr) + }) + } + + // 4. Set chunkPromise to the result of reading a + // chunk from stream with reader. + chunkPromise = reader.read() + } else if (done) { + // 5. Otherwise, if chunkPromise is fulfilled with an + // object whose done property is true, queue a task + // to run the following steps and abort this algorithm: + queueMicrotask(() => { + // 1. Set fr’s state to "done". + fr[kState] = 'done' + + // 2. Let result be the result of package data given + // bytes, type, blob’s type, and encodingName. try { - for (var _b = __values(frag.node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var node = _c.value; - this._fromNode(node); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } + const result = packageData(bytes, type, blob.type, encodingName) + + // 4. Else: + + if (fr[kAborted]) { + return + } + + // 1. Set fr’s result to result. + fr[kResult] = result + + // 2. Fire a progress event called load at the fr. + fireAProgressEvent('load', fr) + } catch (error) { + // 3. If package data threw an exception error: + + // 1. Set fr’s error to error. + fr[kError] = error + + // 2. Fire a progress event called error at fr. + fireAProgressEvent('error', fr) } - return this; - } - this._serializeOpenTag(true); - if (!this._fragment && this._hasDocumentElement && this._writer.level === 0) { - this.emit("error", new Error("Document cannot have multiple document element nodes.")); - return this; - } - try { - this._currentElement = BuilderFunctions_1.fragment(this._builderOptions).ele(p1, p2, p3); - } - catch (err) { - this.emit("error", err); - return this; - } - if (!this._fragment && !this._hasDocumentElement && this._docTypeName !== "" - && this._currentElement.node._qualifiedName !== this._docTypeName) { - this.emit("error", new Error("Document element name does not match DocType declaration name.")); - return this; - } - this._currentElementSerialized = false; - if (!this._fragment) { - this._hasDocumentElement = true; - } - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.att = function (p1, p2, p3) { - if (this._currentElement === undefined) { - this.emit("error", new Error("Cannot insert an attribute node as child of a document node.")); - return this; - } - try { - this._currentElement.att(p1, p2, p3); - } - catch (err) { - this.emit("error", err); - return this; - } - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.com = function (content) { - this._serializeOpenTag(true); - var node; - try { - node = BuilderFunctions_1.fragment(this._builderOptions).com(content).first().node; - } - catch (err) { - /* istanbul ignore next */ - this.emit("error", err); - /* istanbul ignore next */ - return this; - } - if (this._options.wellFormed && (!algorithm_1.xml_isLegalChar(node.data) || - node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) { - this.emit("error", new Error("Comment data contains invalid characters (well-formed required).")); - return this; - } - this._push(this._writer.comment(node.data)); - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.txt = function (content) { - if (!this._fragment && this._currentElement === undefined) { - this.emit("error", new Error("Cannot insert a text node as child of a document node.")); - return this; - } - this._serializeOpenTag(true); - var node; - try { - node = BuilderFunctions_1.fragment(this._builderOptions).txt(content).first().node; - } - catch (err) { - /* istanbul ignore next */ - this.emit("error", err); - /* istanbul ignore next */ - return this; - } - if (this._options.wellFormed && !algorithm_1.xml_isLegalChar(node.data)) { - this.emit("error", new Error("Text data contains invalid characters (well-formed required).")); - return this; - } - var markup = ""; - if (this._options.noDoubleEncoding) { - markup = node.data.replace(/(?!&(lt|gt|amp|apos|quot);)&/g, '&') - .replace(//g, '>'); - } - else { - for (var i = 0; i < node.data.length; i++) { - var c = node.data[i]; - if (c === "&") - markup += "&"; - else if (c === "<") - markup += "<"; - else if (c === ">") - markup += ">"; - else - markup += c; + + // 5. If fr’s state is not "loading", fire a progress + // event called loadend at the fr. + if (fr[kState] !== 'loading') { + fireAProgressEvent('loadend', fr) } + }) + + break } - this._push(this._writer.text(markup)); - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.ins = function (target, content) { - if (content === void 0) { content = ''; } - this._serializeOpenTag(true); - var node; - try { - node = BuilderFunctions_1.fragment(this._builderOptions).ins(target, content).first().node; - } - catch (err) { - /* istanbul ignore next */ - this.emit("error", err); - /* istanbul ignore next */ - return this; - } - if (this._options.wellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) { - this.emit("error", new Error("Processing instruction target contains invalid characters (well-formed required).")); - return this; - } - if (this._options.wellFormed && !algorithm_1.xml_isLegalChar(node.data)) { - this.emit("error", Error("Processing instruction data contains invalid characters (well-formed required).")); - return this; - } - this._push(this._writer.instruction(node.target, node.data)); - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.dat = function (content) { - this._serializeOpenTag(true); - var node; - try { - node = BuilderFunctions_1.fragment(this._builderOptions).dat(content).first().node; - } - catch (err) { - this.emit("error", err); - return this; - } - this._push(this._writer.cdata(node.data)); - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.dec = function (options) { - if (options === void 0) { options = { version: "1.0" }; } - if (this._fragment) { - this.emit("error", Error("Cannot insert an XML declaration into a document fragment.")); - return this; - } - if (this._hasDeclaration) { - this.emit("error", Error("XML declaration is already inserted.")); - return this; - } - this._push(this._writer.declaration(options.version || "1.0", options.encoding, options.standalone)); - this._hasDeclaration = true; - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.dtd = function (options) { - if (this._fragment) { - this.emit("error", Error("Cannot insert a DocType declaration into a document fragment.")); - return this; - } - if (this._docTypeName !== "") { - this.emit("error", new Error("DocType declaration is already inserted.")); - return this; - } - if (this._hasDocumentElement) { - this.emit("error", new Error("Cannot insert DocType declaration after document element.")); - return this; - } - var node; - try { - node = BuilderFunctions_1.create().dtd(options).first().node; - } - catch (err) { - this.emit("error", err); - return this; - } - if (this._options.wellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) { - this.emit("error", new Error("DocType public identifier does not match PubidChar construct (well-formed required).")); - return this; - } - if (this._options.wellFormed && - (!algorithm_1.xml_isLegalChar(node.systemId) || - (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { - this.emit("error", new Error("DocType system identifier contains invalid characters (well-formed required).")); - return this; - } - this._docTypeName = options.name; - this._push(this._writer.docType(options.name, node.publicId, node.systemId)); - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.up = function () { - this._serializeOpenTag(false); - this._serializeCloseTag(); - return this; - }; - /** @inheritdoc */ - XMLBuilderCBImpl.prototype.end = function () { - this._serializeOpenTag(false); - while (this._openTags.length > 0) { - this._serializeCloseTag(); - } - this._push(null); - return this; - }; - /** - * Serializes the opening tag of an element node. - * - * @param hasChildren - whether the element node has child nodes - */ - XMLBuilderCBImpl.prototype._serializeOpenTag = function (hasChildren) { - if (this._currentElementSerialized) - return; - if (this._currentElement === undefined) - return; - var node = this._currentElement.node; - if (this._options.wellFormed && (node.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(node.localName))) { - this.emit("error", new Error("Node local name contains invalid characters (well-formed required).")); - return; + } catch (error) { + if (fr[kAborted]) { + return } - var qualifiedName = ""; - var ignoreNamespaceDefinitionAttribute = false; - var map = this._prefixMap.copy(); - var localPrefixesMap = {}; - var localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); - var inheritedNS = this._openTags.length === 0 ? null : this._openTags[this._openTags.length - 1][1]; - var ns = node.namespaceURI; - if (ns === null) - ns = inheritedNS; - if (inheritedNS === ns) { - if (localDefaultNamespace !== null) { - ignoreNamespaceDefinitionAttribute = true; - } - if (ns === infra_1.namespace.XML) { - qualifiedName = "xml:" + node.localName; - } - else { - qualifiedName = node.localName; - } - this._writer.beginElement(qualifiedName); - this._push(this._writer.openTagBegin(qualifiedName)); + + // 6. Otherwise, if chunkPromise is rejected with an + // error error, queue a task to run the following + // steps and abort this algorithm: + queueMicrotask(() => { + // 1. Set fr’s state to "done". + fr[kState] = 'done' + + // 2. Set fr’s error to error. + fr[kError] = error + + // 3. Fire a progress event called error at fr. + fireAProgressEvent('error', fr) + + // 4. If fr’s state is not "loading", fire a progress + // event called loadend at fr. + if (fr[kState] !== 'loading') { + fireAProgressEvent('loadend', fr) + } + }) + + break + } + } + })() +} + +/** + * @see https://w3c.github.io/FileAPI/#fire-a-progress-event + * @see https://dom.spec.whatwg.org/#concept-event-fire + * @param {string} e The name of the event + * @param {import('./filereader').FileReader} reader + */ +function fireAProgressEvent (e, reader) { + // The progress event e does not bubble. e.bubbles must be false + // The progress event e is NOT cancelable. e.cancelable must be false + const event = new ProgressEvent(e, { + bubbles: false, + cancelable: false + }) + + reader.dispatchEvent(event) +} + +/** + * @see https://w3c.github.io/FileAPI/#blob-package-data + * @param {Uint8Array[]} bytes + * @param {string} type + * @param {string?} mimeType + * @param {string?} encodingName + */ +function packageData (bytes, type, mimeType, encodingName) { + // 1. A Blob has an associated package data algorithm, given + // bytes, a type, a optional mimeType, and a optional + // encodingName, which switches on type and runs the + // associated steps: + + switch (type) { + case 'DataURL': { + // 1. Return bytes as a DataURL [RFC2397] subject to + // the considerations below: + // * Use mimeType as part of the Data URL if it is + // available in keeping with the Data URL + // specification [RFC2397]. + // * If mimeType is not available return a Data URL + // without a media-type. [RFC2397]. + + // https://datatracker.ietf.org/doc/html/rfc2397#section-3 + // dataurl := "data:" [ mediatype ] [ ";base64" ] "," data + // mediatype := [ type "/" subtype ] *( ";" parameter ) + // data := *urlchar + // parameter := attribute "=" value + let dataURL = 'data:' + + const parsed = parseMIMEType(mimeType || 'application/octet-stream') + + if (parsed !== 'failure') { + dataURL += serializeAMimeType(parsed) + } + + dataURL += ';base64,' + + const decoder = new StringDecoder('latin1') + + for (const chunk of bytes) { + dataURL += btoa(decoder.write(chunk)) + } + + dataURL += btoa(decoder.end()) + + return dataURL + } + case 'Text': { + // 1. Let encoding be failure + let encoding = 'failure' + + // 2. If the encodingName is present, set encoding to the + // result of getting an encoding from encodingName. + if (encodingName) { + encoding = getEncoding(encodingName) + } + + // 3. If encoding is failure, and mimeType is present: + if (encoding === 'failure' && mimeType) { + // 1. Let type be the result of parse a MIME type + // given mimeType. + const type = parseMIMEType(mimeType) + + // 2. If type is not failure, set encoding to the result + // of getting an encoding from type’s parameters["charset"]. + if (type !== 'failure') { + encoding = getEncoding(type.parameters.get('charset')) } - else { - var prefix = node.prefix; - var candidatePrefix = null; - if (prefix !== null || ns !== localDefaultNamespace) { - candidatePrefix = map.get(prefix, ns); - } - if (prefix === "xmlns") { - if (this._options.wellFormed) { - this.emit("error", new Error("An element cannot have the 'xmlns' prefix (well-formed required).")); - return; - } - candidatePrefix = prefix; - } - if (candidatePrefix !== null) { - qualifiedName = candidatePrefix + ':' + node.localName; - if (localDefaultNamespace !== null && localDefaultNamespace !== infra_1.namespace.XML) { - inheritedNS = localDefaultNamespace || null; - } - this._writer.beginElement(qualifiedName); - this._push(this._writer.openTagBegin(qualifiedName)); - } - else if (prefix !== null) { - if (prefix in localPrefixesMap) { - prefix = this._generatePrefix(ns, map, this._prefixIndex); - } - map.set(prefix, ns); - qualifiedName += prefix + ':' + node.localName; - this._writer.beginElement(qualifiedName); - this._push(this._writer.openTagBegin(qualifiedName)); - this._push(this._writer.attribute("xmlns:" + prefix, this._serializeAttributeValue(ns, this._options.wellFormed))); - if (localDefaultNamespace !== null) { - inheritedNS = localDefaultNamespace || null; - } - } - else if (localDefaultNamespace === null || - (localDefaultNamespace !== null && localDefaultNamespace !== ns)) { - ignoreNamespaceDefinitionAttribute = true; - qualifiedName += node.localName; - inheritedNS = ns; - this._writer.beginElement(qualifiedName); - this._push(this._writer.openTagBegin(qualifiedName)); - this._push(this._writer.attribute("xmlns", this._serializeAttributeValue(ns, this._options.wellFormed))); - } - else { - qualifiedName += node.localName; - inheritedNS = ns; - this._writer.beginElement(qualifiedName); - this._push(this._writer.openTagBegin(qualifiedName)); - } - } - this._serializeAttributes(node, map, this._prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, this._options.wellFormed); - var isHTML = (ns === infra_1.namespace.HTML); - if (isHTML && !hasChildren && - XMLBuilderCBImpl._VoidElementNames.has(node.localName)) { - this._push(this._writer.openTagEnd(qualifiedName, true, true)); - this._writer.endElement(qualifiedName); - } - else if (!isHTML && !hasChildren) { - this._push(this._writer.openTagEnd(qualifiedName, true, false)); - this._writer.endElement(qualifiedName); - } - else { - this._push(this._writer.openTagEnd(qualifiedName, false, false)); - } - this._currentElementSerialized = true; - /** - * Save qualified name, original inherited ns, original prefix map, and - * hasChildren flag. - */ - this._openTags.push([qualifiedName, inheritedNS, this._prefixMap, hasChildren]); - /** - * New values of inherited namespace and prefix map will be used while - * serializing child nodes. They will be returned to their original values - * when this node is closed using the _openTags array item we saved above. - */ - if (this._isPrefixMapModified(this._prefixMap, map)) { - this._prefixMap = map; - } - /** - * Calls following this will either serialize child nodes or close this tag. - */ - this._writer.level++; - }; - /** - * Serializes the closing tag of an element node. - */ - XMLBuilderCBImpl.prototype._serializeCloseTag = function () { - this._writer.level--; - var lastEle = this._openTags.pop(); - /* istanbul ignore next */ - if (lastEle === undefined) { - this.emit("error", new Error("Last element is undefined.")); - return; - } - var _a = __read(lastEle, 4), qualifiedName = _a[0], ns = _a[1], map = _a[2], hasChildren = _a[3]; - /** - * Restore original values of inherited namespace and prefix map. - */ - this._prefixMap = map; - if (!hasChildren) - return; - this._push(this._writer.closeTag(qualifiedName)); - this._writer.endElement(qualifiedName); - }; - /** - * Pushes data to internal buffer. - * - * @param data - data - */ - XMLBuilderCBImpl.prototype._push = function (data) { - if (data === null) { - this._ended = true; - this.emit("end"); - } - else if (this._ended) { - this.emit("error", new Error("Cannot push to ended stream.")); - } - else if (data.length !== 0) { - this._writer.hasData = true; - this.emit("data", data, this._writer.level); - } - }; - /** - * Reads and serializes an XML tree. - * - * @param node - root node - */ - XMLBuilderCBImpl.prototype._fromNode = function (node) { - var e_2, _a, e_3, _b; - if (util_2.Guard.isElementNode(node)) { - var name = node.prefix ? node.prefix + ":" + node.localName : node.localName; - if (node.namespaceURI !== null) { - this.ele(node.namespaceURI, name); - } - else { - this.ele(name); - } - try { - for (var _c = __values(node.attributes), _d = _c.next(); !_d.done; _d = _c.next()) { - var attr = _d.value; - var name_1 = attr.prefix ? attr.prefix + ":" + attr.localName : attr.localName; - if (attr.namespaceURI !== null) { - this.att(attr.namespaceURI, name_1, attr.value); - } - else { - this.att(name_1, attr.value); - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_2) throw e_2.error; } - } - try { - for (var _e = __values(node.childNodes), _f = _e.next(); !_f.done; _f = _e.next()) { - var child = _f.value; - this._fromNode(child); - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_f && !_f.done && (_b = _e.return)) _b.call(_e); - } - finally { if (e_3) throw e_3.error; } - } - this.up(); - } - else if (util_2.Guard.isExclusiveTextNode(node) && node.data) { - this.txt(node.data); - } - else if (util_2.Guard.isCommentNode(node)) { - this.com(node.data); - } - else if (util_2.Guard.isCDATASectionNode(node)) { - this.dat(node.data); - } - else if (util_2.Guard.isProcessingInstructionNode(node)) { - this.ins(node.target, node.data); - } - }; - /** - * Produces an XML serialization of the attributes of an element node. - * - * @param node - node to serialize - * @param map - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param localPrefixesMap - local prefixes map - * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace - * attributes - * @param requireWellFormed - whether to check conformance - */ - XMLBuilderCBImpl.prototype._serializeAttributes = function (node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { - var e_4, _a; - var localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; - try { - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - // Optimize common case - if (!requireWellFormed && !ignoreNamespaceDefinitionAttribute && attr.namespaceURI === null) { - this._push(this._writer.attribute(attr.localName, this._serializeAttributeValue(attr.value, this._options.wellFormed))); - continue; - } - if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { - this.emit("error", new Error("Element contains duplicate attributes (well-formed required).")); - return; - } - if (requireWellFormed && localNameSet) - localNameSet.set(attr.namespaceURI, attr.localName); - var attributeNamespace = attr.namespaceURI; - var candidatePrefix = null; - if (attributeNamespace !== null) { - candidatePrefix = map.get(attr.prefix, attributeNamespace); - if (attributeNamespace === infra_1.namespace.XMLNS) { - if (attr.value === infra_1.namespace.XML || - (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || - (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || - localPrefixesMap[attr.localName] !== attr.value) && - map.has(attr.localName, attr.value))) - continue; - if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { - this.emit("error", new Error("XMLNS namespace is reserved (well-formed required).")); - return; - } - if (requireWellFormed && attr.value === '') { - this.emit("error", new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).")); - return; - } - if (attr.prefix === 'xmlns') - candidatePrefix = 'xmlns'; - /** - * _Note:_ The (candidatePrefix === null) check is not in the spec. - * We deviate from the spec here. Otherwise a prefix is generated for - * all attributes with namespaces. - */ - } - else if (candidatePrefix === null) { - if (attr.prefix !== null && - (!map.hasPrefix(attr.prefix) || - map.has(attr.prefix, attributeNamespace))) { - /** - * Check if we can use the attribute's own prefix. - * We deviate from the spec here. - * TODO: This is not an efficient way of searching for prefixes. - * Follow developments to the spec. - */ - candidatePrefix = attr.prefix; - } - else { - candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); - } - this._push(this._writer.attribute("xmlns:" + candidatePrefix, this._serializeAttributeValue(attributeNamespace, this._options.wellFormed))); - } - } - if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(attr.localName) || - (attr.localName === "xmlns" && attributeNamespace === null))) { - this.emit("error", new Error("Attribute local name contains invalid characters (well-formed required).")); - return; - } - this._push(this._writer.attribute((candidatePrefix !== null ? candidatePrefix + ":" : "") + attr.localName, this._serializeAttributeValue(attr.value, this._options.wellFormed))); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_4) throw e_4.error; } - } - }; - /** - * Produces an XML serialization of an attribute value. - * - * @param value - attribute value - * @param requireWellFormed - whether to check conformance - */ - XMLBuilderCBImpl.prototype._serializeAttributeValue = function (value, requireWellFormed) { - if (requireWellFormed && value !== null && !algorithm_1.xml_isLegalChar(value)) { - this.emit("error", new Error("Invalid characters in attribute value.")); - return ""; - } - if (value === null) - return ""; - if (this._options.noDoubleEncoding) { - return value.replace(/(?!&(lt|gt|amp|apos|quot);)&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); - } - else { - var result = ""; - for (var i = 0; i < value.length; i++) { - var c = value[i]; - if (c === "\"") - result += """; - else if (c === "&") - result += "&"; - else if (c === "<") - result += "<"; - else if (c === ">") - result += ">"; - else - result += c; - } - return result; - } - }; - /** - * Records namespace information for the given element and returns the - * default namespace attribute value. - * - * @param node - element node to process - * @param map - namespace prefix map - * @param localPrefixesMap - local prefixes map - */ - XMLBuilderCBImpl.prototype._recordNamespaceInformation = function (node, map, localPrefixesMap) { - var e_5, _a; - var defaultNamespaceAttrValue = null; - try { - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - var attributeNamespace = attr.namespaceURI; - var attributePrefix = attr.prefix; - if (attributeNamespace === infra_1.namespace.XMLNS) { - if (attributePrefix === null) { - defaultNamespaceAttrValue = attr.value; - continue; - } - else { - var prefixDefinition = attr.localName; - var namespaceDefinition = attr.value; - if (namespaceDefinition === infra_1.namespace.XML) { - continue; - } - if (namespaceDefinition === '') { - namespaceDefinition = null; - } - if (map.has(prefixDefinition, namespaceDefinition)) { - continue; - } - map.set(prefixDefinition, namespaceDefinition); - localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; - } - } - } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_5) throw e_5.error; } - } - return defaultNamespaceAttrValue; - }; - /** - * Generates a new prefix for the given namespace. - * - * @param newNamespace - a namespace to generate prefix for - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - */ - XMLBuilderCBImpl.prototype._generatePrefix = function (newNamespace, prefixMap, prefixIndex) { - var generatedPrefix = "ns" + prefixIndex.value; - prefixIndex.value++; - prefixMap.set(generatedPrefix, newNamespace); - return generatedPrefix; - }; - /** - * Determines if the namespace prefix map was modified from its original. - * - * @param originalMap - original namespace prefix map - * @param newMap - new namespace prefix map - */ - XMLBuilderCBImpl.prototype._isPrefixMapModified = function (originalMap, newMap) { - var items1 = originalMap._items; - var items2 = newMap._items; - var nullItems1 = originalMap._nullItems; - var nullItems2 = newMap._nullItems; - for (var key in items2) { - var arr1 = items1[key]; - if (arr1 === undefined) - return true; - var arr2 = items2[key]; - if (arr1.length !== arr2.length) - return true; - for (var i = 0; i < arr1.length; i++) { - if (arr1[i] !== arr2[i]) - return true; - } - } - if (nullItems1.length !== nullItems2.length) - return true; - for (var i = 0; i < nullItems1.length; i++) { - if (nullItems1[i] !== nullItems2[i]) - return true; - } - return false; - }; - XMLBuilderCBImpl._VoidElementNames = new Set(['area', 'base', 'basefont', - 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', - 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); - return XMLBuilderCBImpl; -}(events_1.EventEmitter)); -exports.XMLBuilderCBImpl = XMLBuilderCBImpl; -//# sourceMappingURL=XMLBuilderCBImpl.js.map - -/***/ }), + } -/***/ 48248: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + // 4. If encoding is failure, then set encoding to UTF-8. + if (encoding === 'failure') { + encoding = 'UTF-8' + } -"use strict"; + // 5. Decode bytes using fallback encoding encoding, and + // return the result. + return decode(bytes, encoding) + } + case 'ArrayBuffer': { + // Return a new ArrayBuffer whose contents are bytes. + const sequence = combineByteSequences(bytes) -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + return sequence.buffer } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } + case 'BinaryString': { + // Return bytes as a binary string, in which every byte + // is represented by a code unit of equal value [0..255]. + let binaryString = '' + + const decoder = new StringDecoder('latin1') + + for (const chunk of bytes) { + binaryString += decoder.write(chunk) + } + + binaryString += decoder.end() + + return binaryString } - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(56417); -var util_1 = __nccwpck_require__(76195); -var writers_1 = __nccwpck_require__(17476); -var interfaces_2 = __nccwpck_require__(27305); -var util_2 = __nccwpck_require__(65282); -var algorithm_1 = __nccwpck_require__(61); -var dom_1 = __nccwpck_require__(40770); -var infra_1 = __nccwpck_require__(84251); -var readers_1 = __nccwpck_require__(90560); + } +} + /** - * Represents a wrapper that extends XML nodes to implement easy to use and - * chainable document builder methods. + * @see https://encoding.spec.whatwg.org/#decode + * @param {Uint8Array[]} ioQueue + * @param {string} encoding */ -var XMLBuilderImpl = /** @class */ (function () { - /** - * Initializes a new instance of `XMLBuilderNodeImpl`. - * - * @param domNode - the DOM node to wrap - */ - function XMLBuilderImpl(domNode) { - this._domNode = domNode; +function decode (ioQueue, encoding) { + const bytes = combineByteSequences(ioQueue) + + // 1. Let BOMEncoding be the result of BOM sniffing ioQueue. + const BOMEncoding = BOMSniffing(bytes) + + let slice = 0 + + // 2. If BOMEncoding is non-null: + if (BOMEncoding !== null) { + // 1. Set encoding to BOMEncoding. + encoding = BOMEncoding + + // 2. Read three bytes from ioQueue, if BOMEncoding is + // UTF-8; otherwise read two bytes. + // (Do nothing with those bytes.) + slice = BOMEncoding === 'UTF-8' ? 3 : 2 + } + + // 3. Process a queue with an instance of encoding’s + // decoder, ioQueue, output, and "replacement". + + // 4. Return output. + + const sliced = bytes.slice(slice) + return new TextDecoder(encoding).decode(sliced) +} + +/** + * @see https://encoding.spec.whatwg.org/#bom-sniff + * @param {Uint8Array} ioQueue + */ +function BOMSniffing (ioQueue) { + // 1. Let BOM be the result of peeking 3 bytes from ioQueue, + // converted to a byte sequence. + const [a, b, c] = ioQueue + + // 2. For each of the rows in the table below, starting with + // the first one and going down, if BOM starts with the + // bytes given in the first column, then return the + // encoding given in the cell in the second column of that + // row. Otherwise, return null. + if (a === 0xEF && b === 0xBB && c === 0xBF) { + return 'UTF-8' + } else if (a === 0xFE && b === 0xFF) { + return 'UTF-16BE' + } else if (a === 0xFF && b === 0xFE) { + return 'UTF-16LE' + } + + return null +} + +/** + * @param {Uint8Array[]} sequences + */ +function combineByteSequences (sequences) { + const size = sequences.reduce((a, b) => { + return a + b.byteLength + }, 0) + + let offset = 0 + + return sequences.reduce((a, b) => { + a.set(b, offset) + offset += b.byteLength + return a + }, new Uint8Array(size)) +} + +module.exports = { + staticPropertyDescriptors, + readOperation, + fireAProgressEvent +} + + +/***/ }), + +/***/ 21892: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +// We include a version number for the Dispatcher API. In case of breaking changes, +// this version number must be increased to avoid conflicts. +const globalDispatcher = Symbol.for('undici.globalDispatcher.1') +const { InvalidArgumentError } = __nccwpck_require__(48045) +const Agent = __nccwpck_require__(7890) + +if (getGlobalDispatcher() === undefined) { + setGlobalDispatcher(new Agent()) +} + +function setGlobalDispatcher (agent) { + if (!agent || typeof agent.dispatch !== 'function') { + throw new InvalidArgumentError('Argument agent must implement Agent') + } + Object.defineProperty(globalThis, globalDispatcher, { + value: agent, + writable: true, + enumerable: false, + configurable: false + }) +} + +function getGlobalDispatcher () { + return globalThis[globalDispatcher] +} + +module.exports = { + setGlobalDispatcher, + getGlobalDispatcher +} + + +/***/ }), + +/***/ 46930: +/***/ ((module) => { + +"use strict"; + + +module.exports = class DecoratorHandler { + constructor (handler) { + this.handler = handler + } + + onConnect (...args) { + return this.handler.onConnect(...args) + } + + onError (...args) { + return this.handler.onError(...args) + } + + onUpgrade (...args) { + return this.handler.onUpgrade(...args) + } + + onHeaders (...args) { + return this.handler.onHeaders(...args) + } + + onData (...args) { + return this.handler.onData(...args) + } + + onComplete (...args) { + return this.handler.onComplete(...args) + } + + onBodySent (...args) { + return this.handler.onBodySent(...args) + } +} + + +/***/ }), + +/***/ 72860: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const util = __nccwpck_require__(83983) +const { kBodyUsed } = __nccwpck_require__(72785) +const assert = __nccwpck_require__(39491) +const { InvalidArgumentError } = __nccwpck_require__(48045) +const EE = __nccwpck_require__(82361) + +const redirectableStatusCodes = [300, 301, 302, 303, 307, 308] + +const kBody = Symbol('body') + +class BodyAsyncIterable { + constructor (body) { + this[kBody] = body + this[kBodyUsed] = false + } + + async * [Symbol.asyncIterator] () { + assert(!this[kBodyUsed], 'disturbed') + this[kBodyUsed] = true + yield * this[kBody] + } +} + +class RedirectHandler { + constructor (dispatch, maxRedirections, opts, handler) { + if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) { + throw new InvalidArgumentError('maxRedirections must be a positive number') } - Object.defineProperty(XMLBuilderImpl.prototype, "node", { - /** @inheritdoc */ - get: function () { return this._domNode; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(XMLBuilderImpl.prototype, "options", { - /** @inheritdoc */ - get: function () { return this._options; }, - enumerable: true, - configurable: true - }); - /** @inheritdoc */ - XMLBuilderImpl.prototype.set = function (options) { - this._options = util_1.applyDefaults(util_1.applyDefaults(this._options, options, true), // apply user settings - interfaces_1.DefaultBuilderOptions); // provide defaults - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.ele = function (p1, p2, p3) { - var _a, _b, _c; - var namespace; - var name; - var attributes; - if (util_1.isObject(p1)) { - // ele(obj: ExpandObject) - return new readers_1.ObjectReader(this._options).parse(this, p1); - } - else if (p1 !== null && /^\s*= this.maxRedirections || util.isDisturbed(this.opts.body) + ? null + : parseLocation(statusCode, headers) + + if (this.opts.origin) { + this.history.push(new URL(this.opts.path, this.opts.origin)) + } + + if (!this.location) { + return this.handler.onHeaders(statusCode, headers, resume, statusText) + } + + const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin))) + const path = search ? `${pathname}${search}` : pathname + + // Remove headers referring to the original URL. + // By default it is Host only, unless it's a 303 (see below), which removes also all Content-* headers. + // https://tools.ietf.org/html/rfc7231#section-6.4 + this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin) + this.opts.path = path + this.opts.origin = origin + this.opts.maxRedirections = 0 + this.opts.query = null + + // https://tools.ietf.org/html/rfc7231#section-6.4.4 + // In case of HTTP 303, always replace method to be either HEAD or GET + if (statusCode === 303 && this.opts.method !== 'HEAD') { + this.opts.method = 'GET' + this.opts.body = null + } + } + + onData (chunk) { + if (this.location) { + /* + https://tools.ietf.org/html/rfc7231#section-6.4 + + TLDR: undici always ignores 3xx response bodies. + + Redirection is used to serve the requested resource from another URL, so it is assumes that + no body is generated (and thus can be ignored). Even though generating a body is not prohibited. + + For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually + (which means it's optional and not mandated) contain just an hyperlink to the value of + the Location response header, so the body can be ignored safely. + + For status 300, which is "Multiple Choices", the spec mentions both generating a Location + response header AND a response body with the other possible location to follow. + Since the spec explicitily chooses not to specify a format for such body and leave it to + servers and browsers implementors, we ignore the body as there is no specified way to eventually parse it. + */ + } else { + return this.handler.onData(chunk) + } + } + + onComplete (trailers) { + if (this.location) { + /* + https://tools.ietf.org/html/rfc7231#section-6.4 + + TLDR: undici always ignores 3xx response trailers as they are not expected in case of redirections + and neither are useful if present. + + See comment on onData method above for more detailed informations. + */ + + this.location = null + this.abort = null + + this.dispatch(this.opts, this) + } else { + this.handler.onComplete(trailers) + } + } + + onBodySent (chunk) { + if (this.handler.onBodySent) { + this.handler.onBodySent(chunk) + } + } +} + +function parseLocation (statusCode, headers) { + if (redirectableStatusCodes.indexOf(statusCode) === -1) { + return null + } + + for (let i = 0; i < headers.length; i += 2) { + if (headers[i].toString().toLowerCase() === 'location') { + return headers[i + 1] + } + } +} + +// https://tools.ietf.org/html/rfc7231#section-6.4.4 +function shouldRemoveHeader (header, removeContent, unknownOrigin) { + if (header.length === 4) { + return util.headerNameToString(header) === 'host' + } + if (removeContent && util.headerNameToString(header).startsWith('content-')) { + return true + } + if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { + const name = util.headerNameToString(header) + return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' + } + return false +} + +// https://tools.ietf.org/html/rfc7231#section-6.4 +function cleanRequestHeaders (headers, removeContent, unknownOrigin) { + const ret = [] + if (Array.isArray(headers)) { + for (let i = 0; i < headers.length; i += 2) { + if (!shouldRemoveHeader(headers[i], removeContent, unknownOrigin)) { + ret.push(headers[i], headers[i + 1]) + } + } + } else if (headers && typeof headers === 'object') { + for (const key of Object.keys(headers)) { + if (!shouldRemoveHeader(key, removeContent, unknownOrigin)) { + ret.push(key, headers[key]) + } + } + } else { + assert(headers == null, 'headers must be an object or an array') + } + return ret +} + +module.exports = RedirectHandler + + +/***/ }), + +/***/ 82286: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const assert = __nccwpck_require__(39491) + +const { kRetryHandlerDefaultRetry } = __nccwpck_require__(72785) +const { RequestRetryError } = __nccwpck_require__(48045) +const { isDisturbed, parseHeaders, parseRangeHeader } = __nccwpck_require__(83983) + +function calculateRetryAfterHeader (retryAfter) { + const current = Date.now() + const diff = new Date(retryAfter).getTime() - current + + return diff +} + +class RetryHandler { + constructor (opts, handlers) { + const { retryOptions, ...dispatchOpts } = opts + const { + // Retry scoped + retry: retryFn, + maxRetries, + maxTimeout, + minTimeout, + timeoutFactor, + // Response scoped + methods, + errorCodes, + retryAfter, + statusCodes + } = retryOptions ?? {} + + this.dispatch = handlers.dispatch + this.handler = handlers.handler + this.opts = dispatchOpts + this.abort = null + this.aborted = false + this.retryOpts = { + retry: retryFn ?? RetryHandler[kRetryHandlerDefaultRetry], + retryAfter: retryAfter ?? true, + maxTimeout: maxTimeout ?? 30 * 1000, // 30s, + timeout: minTimeout ?? 500, // .5s + timeoutFactor: timeoutFactor ?? 2, + maxRetries: maxRetries ?? 5, + // What errors we should retry + methods: methods ?? ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'], + // Indicates which errors to retry + statusCodes: statusCodes ?? [500, 502, 503, 504, 429], + // List of errors to retry + errorCodes: errorCodes ?? [ + 'ECONNRESET', + 'ECONNREFUSED', + 'ENOTFOUND', + 'ENETDOWN', + 'ENETUNREACH', + 'EHOSTDOWN', + 'EHOSTUNREACH', + 'EPIPE' + ] + } + + this.retryCount = 0 + this.start = 0 + this.end = null + this.etag = null + this.resume = null + + // Handle possible onConnect duplication + this.handler.onConnect(reason => { + this.aborted = true + if (this.abort) { + this.abort(reason) + } else { + this.reason = reason + } + }) + } + + onRequestSent () { + if (this.handler.onRequestSent) { + this.handler.onRequestSent() + } + } + + onUpgrade (statusCode, headers, socket) { + if (this.handler.onUpgrade) { + this.handler.onUpgrade(statusCode, headers, socket) + } + } + + onConnect (abort) { + if (this.aborted) { + abort(this.reason) + } else { + this.abort = abort + } + } + + onBodySent (chunk) { + if (this.handler.onBodySent) return this.handler.onBodySent(chunk) + } + + static [kRetryHandlerDefaultRetry] (err, { state, opts }, cb) { + const { statusCode, code, headers } = err + const { method, retryOptions } = opts + const { + maxRetries, + timeout, + maxTimeout, + timeoutFactor, + statusCodes, + errorCodes, + methods + } = retryOptions + let { counter, currentTimeout } = state + + currentTimeout = + currentTimeout != null && currentTimeout > 0 ? currentTimeout : timeout + + // Any code that is not a Undici's originated and allowed to retry + if ( + code && + code !== 'UND_ERR_REQ_RETRY' && + code !== 'UND_ERR_SOCKET' && + !errorCodes.includes(code) + ) { + cb(err) + return + } + + // If a set of method are provided and the current method is not in the list + if (Array.isArray(methods) && !methods.includes(method)) { + cb(err) + return + } + + // If a set of status code are provided and the current status code is not in the list + if ( + statusCode != null && + Array.isArray(statusCodes) && + !statusCodes.includes(statusCode) + ) { + cb(err) + return + } + + // If we reached the max number of retries + if (counter > maxRetries) { + cb(err) + return + } + + let retryAfterHeader = headers != null && headers['retry-after'] + if (retryAfterHeader) { + retryAfterHeader = Number(retryAfterHeader) + retryAfterHeader = isNaN(retryAfterHeader) + ? calculateRetryAfterHeader(retryAfterHeader) + : retryAfterHeader * 1e3 // Retry-After is in seconds + } + + const retryTimeout = + retryAfterHeader > 0 + ? Math.min(retryAfterHeader, maxTimeout) + : Math.min(currentTimeout * timeoutFactor ** counter, maxTimeout) + + state.currentTimeout = retryTimeout + + setTimeout(() => cb(null), retryTimeout) + } + + onHeaders (statusCode, rawHeaders, resume, statusMessage) { + const headers = parseHeaders(rawHeaders) + + this.retryCount += 1 + + if (statusCode >= 300) { + this.abort( + new RequestRetryError('Request failed', statusCode, { + headers, + count: this.retryCount + }) + ) + return false + } + + // Checkpoint for resume from where we left it + if (this.resume != null) { + this.resume = null + + if (statusCode !== 206) { + return true + } + + const contentRange = parseRangeHeader(headers['content-range']) + // If no content range + if (!contentRange) { + this.abort( + new RequestRetryError('Content-Range mismatch', statusCode, { + headers, + count: this.retryCount + }) + ) + return false + } + + // Let's start with a weak etag check + if (this.etag != null && this.etag !== headers.etag) { + this.abort( + new RequestRetryError('ETag mismatch', statusCode, { + headers, + count: this.retryCount + }) + ) + return false + } + + const { start, size, end = size } = contentRange + + assert(this.start === start, 'content-range mismatch') + assert(this.end == null || this.end === end, 'content-range mismatch') + + this.resume = resume + return true + } + + if (this.end == null) { + if (statusCode === 206) { + // First time we receive 206 + const range = parseRangeHeader(headers['content-range']) + + if (range == null) { + return this.handler.onHeaders( + statusCode, + rawHeaders, + resume, + statusMessage + ) } - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.removeAtt = function (p1, p2) { - var _this = this; - if (!util_2.Guard.isElementNode(this.node)) { - throw new Error("An attribute can only be removed from an element node."); - } - // get primitive values - p1 = util_1.getValue(p1); - if (p2 !== undefined) { - p2 = util_1.getValue(p2); - } - var namespace; - var name; - if (p1 !== null && p2 === undefined) { - name = p1; - } - else if ((p1 === null || util_1.isString(p1)) && p2 !== undefined) { - namespace = p1; - name = p2; - } - else { - throw new Error("Attribute namespace must be a string. " + this._debugInfo()); - } - if (util_1.isArray(name) || util_1.isSet(name)) { - // removeAtt(names: string[]) - // removeAtt(namespace: string, names: string[]) - util_1.forEachArray(name, function (attName) { - return namespace === undefined ? _this.removeAtt(attName) : _this.removeAtt(namespace, attName); - }, this); - } - else if (namespace !== undefined) { - // removeAtt(namespace: string, name: string) - name = dom_1.sanitizeInput(name, this._options.invalidCharReplacement); - namespace = dom_1.sanitizeInput(namespace, this._options.invalidCharReplacement); - this.node.removeAttributeNS(namespace, name); - } - else { - // removeAtt(name: string) - name = dom_1.sanitizeInput(name, this._options.invalidCharReplacement); - this.node.removeAttribute(name); - } - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.txt = function (content) { - if (content === null || content === undefined) { - if (this._options.keepNullNodes) { - // keep null nodes - content = ""; - } - else { - // skip null|undefined nodes - return this; - } - } - var child = this._doc.createTextNode(dom_1.sanitizeInput(content, this._options.invalidCharReplacement)); - this.node.appendChild(child); - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.com = function (content) { - if (content === null || content === undefined) { - if (this._options.keepNullNodes) { - // keep null nodes - content = ""; - } - else { - // skip null|undefined nodes - return this; - } - } - var child = this._doc.createComment(dom_1.sanitizeInput(content, this._options.invalidCharReplacement)); - this.node.appendChild(child); - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.dat = function (content) { - if (content === null || content === undefined) { - if (this._options.keepNullNodes) { - // keep null nodes - content = ""; - } - else { - // skip null|undefined nodes - return this; - } - } - var child = this._doc.createCDATASection(dom_1.sanitizeInput(content, this._options.invalidCharReplacement)); - this.node.appendChild(child); - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.ins = function (target, content) { - var _this = this; - if (content === void 0) { content = ''; } - if (content === null || content === undefined) { - if (this._options.keepNullNodes) { - // keep null nodes - content = ""; - } - else { - // skip null|undefined nodes - return this; - } - } - if (util_1.isArray(target) || util_1.isSet(target)) { - util_1.forEachArray(target, function (item) { - item += ""; - var insIndex = item.indexOf(' '); - var insTarget = (insIndex === -1 ? item : item.substr(0, insIndex)); - var insValue = (insIndex === -1 ? '' : item.substr(insIndex + 1)); - _this.ins(insTarget, insValue); - }, this); - } - else if (util_1.isMap(target) || util_1.isObject(target)) { - util_1.forEachObject(target, function (insTarget, insValue) { return _this.ins(insTarget, insValue); }, this); - } - else { - var child = this._doc.createProcessingInstruction(dom_1.sanitizeInput(target, this._options.invalidCharReplacement), dom_1.sanitizeInput(content, this._options.invalidCharReplacement)); - this.node.appendChild(child); - } - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.dec = function (options) { - this._options.version = options.version || "1.0"; - this._options.encoding = options.encoding; - this._options.standalone = options.standalone; - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.dtd = function (options) { - var name = dom_1.sanitizeInput((options && options.name) || (this._doc.documentElement ? this._doc.documentElement.tagName : "ROOT"), this._options.invalidCharReplacement); - var pubID = dom_1.sanitizeInput((options && options.pubID) || "", this._options.invalidCharReplacement); - var sysID = dom_1.sanitizeInput((options && options.sysID) || "", this._options.invalidCharReplacement); - // name must match document element - if (this._doc.documentElement !== null && name !== this._doc.documentElement.tagName) { - throw new Error("DocType name does not match document element name."); - } - // create doctype node - var docType = this._doc.implementation.createDocumentType(name, pubID, sysID); - if (this._doc.doctype !== null) { - // replace existing doctype - this._doc.replaceChild(docType, this._doc.doctype); - } - else { - // insert before document element node or append to end - this._doc.insertBefore(docType, this._doc.documentElement); - } - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.import = function (node) { - var e_1, _a; - var hostNode = this._domNode; - var hostDoc = this._doc; - var importedNode = node.node; - if (util_2.Guard.isDocumentNode(importedNode)) { - // import document node - var elementNode = importedNode.documentElement; - if (elementNode === null) { - throw new Error("Imported document has no document element node. " + this._debugInfo()); - } - var clone = hostDoc.importNode(elementNode, true); - hostNode.appendChild(clone); - var _b = __read(algorithm_1.namespace_extractQName(clone.prefix ? clone.prefix + ':' + clone.localName : clone.localName), 1), prefix = _b[0]; - var namespace = hostNode.lookupNamespaceURI(prefix); - new XMLBuilderImpl(clone)._updateNamespace(namespace); - } - else if (util_2.Guard.isDocumentFragmentNode(importedNode)) { - try { - // import child nodes - for (var _c = __values(importedNode.childNodes), _d = _c.next(); !_d.done; _d = _c.next()) { - var childNode = _d.value; - var clone = hostDoc.importNode(childNode, true); - hostNode.appendChild(clone); - if (util_2.Guard.isElementNode(clone)) { - var _e = __read(algorithm_1.namespace_extractQName(clone.prefix ? clone.prefix + ':' + clone.localName : clone.localName), 1), prefix = _e[0]; - var namespace = hostNode.lookupNamespaceURI(prefix); - new XMLBuilderImpl(clone)._updateNamespace(namespace); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_d && !_d.done && (_a = _c.return)) _a.call(_c); - } - finally { if (e_1) throw e_1.error; } - } - } - else { - // import node - var clone = hostDoc.importNode(importedNode, true); - hostNode.appendChild(clone); - if (util_2.Guard.isElementNode(clone)) { - var _f = __read(algorithm_1.namespace_extractQName(clone.prefix ? clone.prefix + ':' + clone.localName : clone.localName), 1), prefix = _f[0]; - var namespace = hostNode.lookupNamespaceURI(prefix); - new XMLBuilderImpl(clone)._updateNamespace(namespace); - } - } - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.doc = function () { - if (this._doc._isFragment) { - var node = this.node; - while (node && node.nodeType !== interfaces_2.NodeType.DocumentFragment) { - node = node.parentNode; - } - /* istanbul ignore next */ - if (node === null) { - throw new Error("Node has no parent node while searching for document fragment ancestor. " + this._debugInfo()); - } - return new XMLBuilderImpl(node); - } - else { - return new XMLBuilderImpl(this._doc); - } - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.root = function () { - var ele = this._doc.documentElement; - if (!ele) { - throw new Error("Document root element is null. " + this._debugInfo()); - } - return new XMLBuilderImpl(ele); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.up = function () { - var parent = this._domNode.parentNode; - if (!parent) { - throw new Error("Parent node is null. " + this._debugInfo()); - } - return new XMLBuilderImpl(parent); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.prev = function () { - var node = this._domNode.previousSibling; - if (!node) { - throw new Error("Previous sibling node is null. " + this._debugInfo()); - } - return new XMLBuilderImpl(node); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.next = function () { - var node = this._domNode.nextSibling; - if (!node) { - throw new Error("Next sibling node is null. " + this._debugInfo()); - } - return new XMLBuilderImpl(node); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.first = function () { - var node = this._domNode.firstChild; - if (!node) { - throw new Error("First child node is null. " + this._debugInfo()); - } - return new XMLBuilderImpl(node); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.last = function () { - var node = this._domNode.lastChild; - if (!node) { - throw new Error("Last child node is null. " + this._debugInfo()); - } - return new XMLBuilderImpl(node); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.each = function (callback, self, recursive, thisArg) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var result = this._getFirstDescendantNode(this._domNode, self, recursive); - while (result[0]) { - var nextResult = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); - callback.call(thisArg, new XMLBuilderImpl(result[0]), result[1], result[2]); - result = nextResult; - } - return this; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.map = function (callback, self, recursive, thisArg) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var result = []; - this.each(function (node, index, level) { - return result.push(callback.call(thisArg, node, index, level)); - }, self, recursive); - return result; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.reduce = function (callback, initialValue, self, recursive, thisArg) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var value = initialValue; - this.each(function (node, index, level) { - return value = callback.call(thisArg, value, node, index, level); - }, self, recursive); - return value; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.find = function (predicate, self, recursive, thisArg) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var result = this._getFirstDescendantNode(this._domNode, self, recursive); - while (result[0]) { - var builder = new XMLBuilderImpl(result[0]); - if (predicate.call(thisArg, builder, result[1], result[2])) { - return builder; - } - result = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); - } - return undefined; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.filter = function (predicate, self, recursive, thisArg) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var result = []; - this.each(function (node, index, level) { - if (predicate.call(thisArg, node, index, level)) { - result.push(node); - } - }, self, recursive); - return result; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.every = function (predicate, self, recursive, thisArg) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var result = this._getFirstDescendantNode(this._domNode, self, recursive); - while (result[0]) { - var builder = new XMLBuilderImpl(result[0]); - if (!predicate.call(thisArg, builder, result[1], result[2])) { - return false; - } - result = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); - } - return true; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.some = function (predicate, self, recursive, thisArg) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var result = this._getFirstDescendantNode(this._domNode, self, recursive); - while (result[0]) { - var builder = new XMLBuilderImpl(result[0]); - if (predicate.call(thisArg, builder, result[1], result[2])) { - return true; - } - result = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); - } - return false; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.toArray = function (self, recursive) { - if (self === void 0) { self = false; } - if (recursive === void 0) { recursive = false; } - var result = []; - this.each(function (node) { return result.push(node); }, self, recursive); - return result; - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.toString = function (writerOptions) { - writerOptions = writerOptions || {}; - if (writerOptions.format === undefined) { - writerOptions.format = "xml"; - } - return this._serialize(writerOptions); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.toObject = function (writerOptions) { - writerOptions = writerOptions || {}; - if (writerOptions.format === undefined) { - writerOptions.format = "object"; - } - return this._serialize(writerOptions); - }; - /** @inheritdoc */ - XMLBuilderImpl.prototype.end = function (writerOptions) { - writerOptions = writerOptions || {}; - if (writerOptions.format === undefined) { - writerOptions.format = "xml"; - } - return this.doc()._serialize(writerOptions); - }; - /** - * Gets the next descendant of the given node of the tree rooted at `root` - * in depth-first pre-order. Returns a three-tuple with - * [descendant, descendant_index, descendant_level]. - * - * @param root - root node of the tree - * @param self - whether to visit the current node along with child nodes - * @param recursive - whether to visit all descendant nodes in tree-order or - * only the immediate child nodes - */ - XMLBuilderImpl.prototype._getFirstDescendantNode = function (root, self, recursive) { - if (self) - return [this._domNode, 0, 0]; - else if (recursive) - return this._getNextDescendantNode(root, root, recursive, 0, 0); - else - return [this._domNode.firstChild, 0, 1]; - }; - /** - * Gets the next descendant of the given node of the tree rooted at `root` - * in depth-first pre-order. Returns a three-tuple with - * [descendant, descendant_index, descendant_level]. - * - * @param root - root node of the tree - * @param node - current node - * @param recursive - whether to visit all descendant nodes in tree-order or - * only the immediate child nodes - * @param index - child node index - * @param level - current depth of the XML tree - */ - XMLBuilderImpl.prototype._getNextDescendantNode = function (root, node, recursive, index, level) { - if (recursive) { - // traverse child nodes - if (node.firstChild) - return [node.firstChild, 0, level + 1]; - if (node === root) - return [null, -1, -1]; - // traverse siblings - if (node.nextSibling) - return [node.nextSibling, index + 1, level]; - // traverse parent's next sibling - var parent = node.parentNode; - while (parent && parent !== root) { - if (parent.nextSibling) - return [parent.nextSibling, algorithm_1.tree_index(parent.nextSibling), level - 1]; - parent = parent.parentNode; - level--; - } - } - else { - if (root === node) - return [node.firstChild, 0, level + 1]; - else - return [node.nextSibling, index + 1, level]; - } - return [null, -1, -1]; - }; - /** - * Converts the node into its string or object representation. - * - * @param options - serialization options - */ - XMLBuilderImpl.prototype._serialize = function (writerOptions) { - if (writerOptions.format === "xml") { - var writer = new writers_1.XMLWriter(this._options, writerOptions); - return writer.serialize(this.node); - } - else if (writerOptions.format === "map") { - var writer = new writers_1.MapWriter(this._options, writerOptions); - return writer.serialize(this.node); - } - else if (writerOptions.format === "object") { - var writer = new writers_1.ObjectWriter(this._options, writerOptions); - return writer.serialize(this.node); - } - else if (writerOptions.format === "json") { - var writer = new writers_1.JSONWriter(this._options, writerOptions); - return writer.serialize(this.node); - } - else if (writerOptions.format === "yaml") { - var writer = new writers_1.YAMLWriter(this._options, writerOptions); - return writer.serialize(this.node); - } - else { - throw new Error("Invalid writer format: " + writerOptions.format + ". " + this._debugInfo()); - } - }; - /** - * Extracts a namespace and name from the given string. - * - * @param namespace - namespace - * @param name - a string containing both a name and namespace separated by an - * `'@'` character - * @param ele - `true` if this is an element namespace; otherwise `false` - */ - XMLBuilderImpl.prototype._extractNamespace = function (namespace, name, ele) { - // extract from name - var atIndex = name.indexOf("@"); - if (atIndex > 0) { - if (namespace === undefined) - namespace = name.slice(atIndex + 1); - name = name.slice(0, atIndex); - } - if (namespace === undefined) { - // look-up default namespace - namespace = (ele ? this._options.defaultNamespace.ele : this._options.defaultNamespace.att); - } - else if (namespace !== null && namespace[0] === "@") { - // look-up namespace aliases - var alias = namespace.slice(1); - namespace = this._options.namespaceAlias[alias]; - if (namespace === undefined) { - throw new Error("Namespace alias `" + alias + "` is not defined. " + this._debugInfo()); - } - } - return [namespace, name]; - }; - /** - * Updates the element's namespace. - * - * @param ns - new namespace - */ - XMLBuilderImpl.prototype._updateNamespace = function (ns) { - var e_2, _a, e_3, _b; - var ele = this._domNode; - if (util_2.Guard.isElementNode(ele) && ns !== null && ele.namespaceURI !== ns) { - var _c = __read(algorithm_1.namespace_extractQName(ele.prefix ? ele.prefix + ':' + ele.localName : ele.localName), 2), elePrefix = _c[0], eleLocalName = _c[1]; - // re-create the element node if its namespace changed - // we can't simply change the namespaceURI since its read-only - var newEle = algorithm_1.create_element(this._doc, eleLocalName, ns, elePrefix); - try { - for (var _d = __values(ele.attributes), _e = _d.next(); !_e.done; _e = _d.next()) { - var attr = _e.value; - var attrQName = attr.prefix ? attr.prefix + ':' + attr.localName : attr.localName; - var _f = __read(algorithm_1.namespace_extractQName(attrQName), 1), attrPrefix = _f[0]; - var newAttrNS = attr.namespaceURI; - if (newAttrNS === null && attrPrefix !== null) { - newAttrNS = ele.lookupNamespaceURI(attrPrefix); - } - if (newAttrNS === null) { - newEle.setAttribute(attrQName, attr.value); - } - else { - newEle.setAttributeNS(newAttrNS, attrQName, attr.value); - } - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); - } - finally { if (e_2) throw e_2.error; } - } - // replace the new node in parent node - var parent = ele.parentNode; - /* istanbul ignore next */ - if (parent === null) { - throw new Error("Parent node is null." + this._debugInfo()); - } - parent.replaceChild(newEle, ele); - this._domNode = newEle; - try { - // check child nodes - for (var _g = __values(ele.childNodes), _h = _g.next(); !_h.done; _h = _g.next()) { - var childNode = _h.value; - var newChildNode = childNode.cloneNode(true); - newEle.appendChild(newChildNode); - if (util_2.Guard.isElementNode(newChildNode)) { - var _j = __read(algorithm_1.namespace_extractQName(newChildNode.prefix ? newChildNode.prefix + ':' + newChildNode.localName : newChildNode.localName), 1), newChildNodePrefix = _j[0]; - var newChildNodeNS = newEle.lookupNamespaceURI(newChildNodePrefix); - new XMLBuilderImpl(newChildNode)._updateNamespace(newChildNodeNS); - } - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_h && !_h.done && (_b = _g.return)) _b.call(_g); - } - finally { if (e_3) throw e_3.error; } - } - } - }; - Object.defineProperty(XMLBuilderImpl.prototype, "_doc", { - /** - * Returns the document owning this node. - */ - get: function () { - var node = this.node; - if (util_2.Guard.isDocumentNode(node)) { - return node; - } - else { - var docNode = node.ownerDocument; - /* istanbul ignore next */ - if (!docNode) - throw new Error("Owner document is null. " + this._debugInfo()); - return docNode; - } - }, - enumerable: true, - configurable: true - }); - /** - * Returns debug information for this node. - * - * @param name - node name - */ - XMLBuilderImpl.prototype._debugInfo = function (name) { - var node = this.node; - var parentNode = node.parentNode; - name = name || node.nodeName; - var parentName = parentNode ? parentNode.nodeName : ''; - if (!parentName) { - return "node: <" + name + ">"; - } - else { - return "node: <" + name + ">, parent: <" + parentName + ">"; - } - }; - Object.defineProperty(XMLBuilderImpl.prototype, "_options", { - /** - * Gets or sets builder options. - */ - get: function () { - var doc = this._doc; - /* istanbul ignore next */ - if (doc._xmlBuilderOptions === undefined) { - throw new Error("Builder options is not set."); - } - return doc._xmlBuilderOptions; - }, - set: function (value) { - var doc = this._doc; - doc._xmlBuilderOptions = value; - }, - enumerable: true, - configurable: true - }); - return XMLBuilderImpl; -}()); -exports.XMLBuilderImpl = XMLBuilderImpl; -//# sourceMappingURL=XMLBuilderImpl.js.map -/***/ }), + const { start, size, end = size } = range -/***/ 40770: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + assert( + start != null && Number.isFinite(start) && this.start !== start, + 'content-range mismatch' + ) + assert(Number.isFinite(start)) + assert( + end != null && Number.isFinite(end) && this.end !== end, + 'invalid content-length' + ) -"use strict"; + this.start = start + this.end = end + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -var dom_1 = __nccwpck_require__(54646); -var dom_2 = __nccwpck_require__(50633); -var util_1 = __nccwpck_require__(76195); -dom_2.dom.setFeatures(false); -/** - * Creates an XML document without any child nodes. - */ -function createDocument() { - var impl = new dom_1.DOMImplementation(); - var doc = impl.createDocument(null, 'root', null); - /* istanbul ignore else */ - if (doc.documentElement) { - doc.removeChild(doc.documentElement); - } - return doc; -} -exports.createDocument = createDocument; -/** - * Sanitizes input strings with user supplied replacement characters. - * - * @param str - input string - * @param replacement - replacement character or function - */ -function sanitizeInput(str, replacement) { - if (str == null) { - return str; - } - else if (replacement === undefined) { - return str + ""; + // We make our best to checkpoint the body for further range headers + if (this.end == null) { + const contentLength = headers['content-length'] + this.end = contentLength != null ? Number(contentLength) : null + } + + assert(Number.isFinite(this.start)) + assert( + this.end == null || Number.isFinite(this.end), + 'invalid content-length' + ) + + this.resume = resume + this.etag = headers.etag != null ? headers.etag : null + + return this.handler.onHeaders( + statusCode, + rawHeaders, + resume, + statusMessage + ) } - else { - var result = ""; - str = str + ""; - for (var i = 0; i < str.length; i++) { - var n = str.charCodeAt(i); - // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] - if (n === 0x9 || n === 0xA || n === 0xD || - (n >= 0x20 && n <= 0xD7FF) || - (n >= 0xE000 && n <= 0xFFFD)) { - // valid character - not surrogate pair - result += str.charAt(i); - } - else if (n >= 0xD800 && n <= 0xDBFF && i < str.length - 1) { - var n2 = str.charCodeAt(i + 1); - if (n2 >= 0xDC00 && n2 <= 0xDFFF) { - // valid surrogate pair - n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; - result += String.fromCodePoint(n); - i++; - } - else { - // invalid lone surrogate - result += util_1.isString(replacement) ? replacement : replacement(str.charAt(i), i, str); - } - } - else { - // invalid character - result += util_1.isString(replacement) ? replacement : replacement(str.charAt(i), i, str); - } - } - return result; - } -} -exports.sanitizeInput = sanitizeInput; -//# sourceMappingURL=dom.js.map -/***/ }), - -/***/ 44260: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + const err = new RequestRetryError('Request failed', statusCode, { + headers, + count: this.retryCount + }) -"use strict"; + this.abort(err) -Object.defineProperty(exports, "__esModule", ({ value: true })); -var XMLBuilderImpl_1 = __nccwpck_require__(48248); -exports.XMLBuilderImpl = XMLBuilderImpl_1.XMLBuilderImpl; -var XMLBuilderCBImpl_1 = __nccwpck_require__(71438); -exports.XMLBuilderCBImpl = XMLBuilderCBImpl_1.XMLBuilderCBImpl; -var BuilderFunctions_1 = __nccwpck_require__(95696); -exports.builder = BuilderFunctions_1.builder; -exports.create = BuilderFunctions_1.create; -exports.fragment = BuilderFunctions_1.fragment; -exports.convert = BuilderFunctions_1.convert; -var BuilderFunctionsCB_1 = __nccwpck_require__(10268); -exports.createCB = BuilderFunctionsCB_1.createCB; -exports.fragmentCB = BuilderFunctionsCB_1.fragmentCB; -//# sourceMappingURL=index.js.map + return false + } -/***/ }), + onData (chunk) { + this.start += chunk.length -/***/ 70151: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + return this.handler.onData(chunk) + } -"use strict"; + onComplete (rawTrailers) { + this.retryCount = 0 + return this.handler.onComplete(rawTrailers) + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -var builder_1 = __nccwpck_require__(44260); -exports.builder = builder_1.builder; -exports.create = builder_1.create; -exports.fragment = builder_1.fragment; -exports.convert = builder_1.convert; -exports.createCB = builder_1.createCB; -exports.fragmentCB = builder_1.fragmentCB; -//# sourceMappingURL=index.js.map + onError (err) { + if (this.aborted || isDisturbed(this.opts.body)) { + return this.handler.onError(err) + } -/***/ }), + this.retryOpts.retry( + err, + { + state: { counter: this.retryCount++, currentTimeout: this.retryAfter }, + opts: { retryOptions: this.retryOpts, ...this.opts } + }, + onRetry.bind(this) + ) -/***/ 56417: -/***/ ((__unused_webpack_module, exports) => { + function onRetry (err) { + if (err != null || this.aborted || isDisturbed(this.opts.body)) { + return this.handler.onError(err) + } -"use strict"; + if (this.start !== 0) { + this.opts = { + ...this.opts, + headers: { + ...this.opts.headers, + range: `bytes=${this.start}-${this.end ?? ''}` + } + } + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Defines default values for builder options. - */ -exports.DefaultBuilderOptions = { - version: "1.0", - encoding: undefined, - standalone: undefined, - keepNullNodes: false, - keepNullAttributes: false, - ignoreConverters: false, - convert: { - att: "@", - ins: "?", - text: "#", - cdata: "$", - comment: "!" - }, - defaultNamespace: { - ele: undefined, - att: undefined - }, - namespaceAlias: { - html: "http://www.w3.org/1999/xhtml", - xml: "http://www.w3.org/XML/1998/namespace", - xmlns: "http://www.w3.org/2000/xmlns/", - mathml: "http://www.w3.org/1998/Math/MathML", - svg: "http://www.w3.org/2000/svg", - xlink: "http://www.w3.org/1999/xlink" - }, - invalidCharReplacement: undefined, - parser: undefined -}; -/** - * Contains keys of `XMLBuilderOptions`. - */ -exports.XMLBuilderOptionKeys = new Set(Object.keys(exports.DefaultBuilderOptions)); -/** - * Defines default values for builder options. - */ -exports.DefaultXMLBuilderCBOptions = { - format: "xml", - wellFormed: false, - prettyPrint: false, - indent: " ", - newline: "\n", - offset: 0, - width: 0, - allowEmptyTags: false, - spaceBeforeSlash: false, - keepNullNodes: false, - keepNullAttributes: false, - ignoreConverters: false, - convert: { - att: "@", - ins: "?", - text: "#", - cdata: "$", - comment: "!" - }, - defaultNamespace: { - ele: undefined, - att: undefined - }, - namespaceAlias: { - html: "http://www.w3.org/1999/xhtml", - xml: "http://www.w3.org/XML/1998/namespace", - xmlns: "http://www.w3.org/2000/xmlns/", - mathml: "http://www.w3.org/1998/Math/MathML", - svg: "http://www.w3.org/2000/svg", - xlink: "http://www.w3.org/1999/xlink" + try { + this.dispatch(this.opts, this) + } catch (err) { + this.handler.onError(err) + } } -}; -//# sourceMappingURL=interfaces.js.map - -/***/ }), - -/***/ 33396: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + } +} -"use strict"; +module.exports = RetryHandler -Object.defineProperty(exports, "__esModule", ({ value: true })); -var dom_1 = __nccwpck_require__(40770); -/** - * Pre-serializes XML nodes. - */ -var BaseReader = /** @class */ (function () { - /** - * Initializes a new instance of `BaseReader`. - * - * @param builderOptions - XML builder options - */ - function BaseReader(builderOptions) { - this._builderOptions = builderOptions; - if (builderOptions.parser) { - Object.assign(this, builderOptions.parser); - } - } - BaseReader.prototype._docType = function (parent, name, publicId, systemId) { - return parent.dtd({ name: name, pubID: publicId, sysID: systemId }); - }; - BaseReader.prototype._comment = function (parent, data) { - return parent.com(data); - }; - BaseReader.prototype._text = function (parent, data) { - return parent.txt(data); - }; - BaseReader.prototype._instruction = function (parent, target, data) { - return parent.ins(target, data); - }; - BaseReader.prototype._cdata = function (parent, data) { - return parent.dat(data); - }; - BaseReader.prototype._element = function (parent, namespace, name) { - return (namespace === undefined ? parent.ele(name) : parent.ele(namespace, name)); - }; - BaseReader.prototype._attribute = function (parent, namespace, name, value) { - return (namespace === undefined ? parent.att(name, value) : parent.att(namespace, name, value)); - }; - BaseReader.prototype._sanitize = function (str) { - return dom_1.sanitizeInput(str, this._builderOptions.invalidCharReplacement); - }; - /** - * Main parser function which parses the given object and returns an XMLBuilder. - * - * @param node - node to recieve parsed content - * @param obj - object to parse - */ - BaseReader.prototype.parse = function (node, obj) { - return this._parse(node, obj); - }; - /** - * Creates a DocType node. - * The node will be skipped if the function returns `undefined`. - * - * @param name - node name - * @param publicId - public identifier - * @param systemId - system identifier - */ - BaseReader.prototype.docType = function (parent, name, publicId, systemId) { - return this._docType(parent, name, publicId, systemId); - }; - /** - * Creates a comment node. - * The node will be skipped if the function returns `undefined`. - * - * @param parent - parent node - * @param data - node data - */ - BaseReader.prototype.comment = function (parent, data) { - return this._comment(parent, data); - }; - /** - * Creates a text node. - * The node will be skipped if the function returns `undefined`. - * - * @param parent - parent node - * @param data - node data - */ - BaseReader.prototype.text = function (parent, data) { - return this._text(parent, data); - }; - /** - * Creates a processing instruction node. - * The node will be skipped if the function returns `undefined`. - * - * @param parent - parent node - * @param target - instruction target - * @param data - node data - */ - BaseReader.prototype.instruction = function (parent, target, data) { - return this._instruction(parent, target, data); - }; - /** - * Creates a CData section node. - * The node will be skipped if the function returns `undefined`. - * - * @param parent - parent node - * @param data - node data - */ - BaseReader.prototype.cdata = function (parent, data) { - return this._cdata(parent, data); - }; - /** - * Creates an element node. - * The node will be skipped if the function returns `undefined`. - * - * @param parent - parent node - * @param namespace - node namespace - * @param name - node name - */ - BaseReader.prototype.element = function (parent, namespace, name) { - return this._element(parent, namespace, name); - }; - /** - * Creates an attribute or namespace declaration. - * The node will be skipped if the function returns `undefined`. - * - * @param parent - parent node - * @param namespace - node namespace - * @param name - node name - * @param value - node value - */ - BaseReader.prototype.attribute = function (parent, namespace, name, value) { - return this._attribute(parent, namespace, name, value); - }; - /** - * Sanitizes input strings. - * - * @param str - input string - */ - BaseReader.prototype.sanitize = function (str) { - return this._sanitize(str); - }; - return BaseReader; -}()); -exports.BaseReader = BaseReader; -//# sourceMappingURL=BaseReader.js.map /***/ }), -/***/ 43518: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 38861: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var ObjectReader_1 = __nccwpck_require__(40768); -var BaseReader_1 = __nccwpck_require__(33396); -/** - * Parses XML nodes from a JSON string. - */ -var JSONReader = /** @class */ (function (_super) { - __extends(JSONReader, _super); - function JSONReader() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Parses the given document representation. - * - * @param node - node receive parsed XML nodes - * @param str - JSON string to parse - */ - JSONReader.prototype._parse = function (node, str) { - return new ObjectReader_1.ObjectReader(this._builderOptions).parse(node, JSON.parse(str)); - }; - return JSONReader; -}(BaseReader_1.BaseReader)); -exports.JSONReader = JSONReader; -//# sourceMappingURL=JSONReader.js.map -/***/ }), +const RedirectHandler = __nccwpck_require__(72860) -/***/ 40768: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) { + return (dispatch) => { + return function Intercept (opts, handler) { + const { maxRedirections = defaultMaxRedirections } = opts -"use strict"; + if (!maxRedirections) { + return dispatch(opts, handler) + } -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); -var BaseReader_1 = __nccwpck_require__(33396); -/** - * Parses XML nodes from objects and arrays. - * ES6 maps and sets are also supoorted. - */ -var ObjectReader = /** @class */ (function (_super) { - __extends(ObjectReader, _super); - function ObjectReader() { - return _super !== null && _super.apply(this, arguments) || this; + const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler) + opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting. + return dispatch(opts, redirectHandler) } - /** - * Parses the given document representation. - * - * @param node - node receive parsed XML nodes - * @param obj - object to parse - */ - ObjectReader.prototype._parse = function (node, obj) { - var _this = this; - var options = this._builderOptions; - var lastChild = null; - if (util_1.isFunction(obj)) { - // evaluate if function - lastChild = this.parse(node, obj.apply(this)); - } - else if (util_1.isArray(obj) || util_1.isSet(obj)) { - util_1.forEachArray(obj, function (item) { return lastChild = _this.parse(node, item); }, this); - } - else /* if (isMap(obj) || isObject(obj)) */ { - // expand if object - util_1.forEachObject(obj, function (key, val) { - if (util_1.isFunction(val)) { - // evaluate if function - val = val.apply(_this); - } - if (!options.ignoreConverters && key.indexOf(options.convert.att) === 0) { - // assign attributes - if (key === options.convert.att) { - if (util_1.isArray(val) || util_1.isSet(val)) { - throw new Error("Invalid attribute: " + val.toString() + ". " + node._debugInfo()); - } - else /* if (isMap(val) || isObject(val)) */ { - util_1.forEachObject(val, function (attrKey, attrVal) { - lastChild = _this.attribute(node, undefined, _this.sanitize(attrKey), _this.sanitize(attrVal)) || lastChild; - }); - } - } - else { - lastChild = _this.attribute(node, undefined, _this.sanitize(key.substr(options.convert.att.length)), _this.sanitize(val)) || lastChild; - } - } - else if (!options.ignoreConverters && key.indexOf(options.convert.text) === 0) { - // text node - if (util_1.isMap(val) || util_1.isObject(val)) { - // if the key is #text expand child nodes under this node to support mixed content - lastChild = _this.parse(node, val); - } - else { - lastChild = _this.text(node, _this.sanitize(val)) || lastChild; - } - } - else if (!options.ignoreConverters && key.indexOf(options.convert.cdata) === 0) { - // cdata node - if (util_1.isArray(val) || util_1.isSet(val)) { - util_1.forEachArray(val, function (item) { return lastChild = _this.cdata(node, _this.sanitize(item)) || lastChild; }, _this); - } - else { - lastChild = _this.cdata(node, _this.sanitize(val)) || lastChild; - } - } - else if (!options.ignoreConverters && key.indexOf(options.convert.comment) === 0) { - // comment node - if (util_1.isArray(val) || util_1.isSet(val)) { - util_1.forEachArray(val, function (item) { return lastChild = _this.comment(node, _this.sanitize(item)) || lastChild; }, _this); - } - else { - lastChild = _this.comment(node, _this.sanitize(val)) || lastChild; - } - } - else if (!options.ignoreConverters && key.indexOf(options.convert.ins) === 0) { - // processing instruction - if (util_1.isString(val)) { - var insIndex = val.indexOf(' '); - var insTarget = (insIndex === -1 ? val : val.substr(0, insIndex)); - var insValue = (insIndex === -1 ? '' : val.substr(insIndex + 1)); - lastChild = _this.instruction(node, _this.sanitize(insTarget), _this.sanitize(insValue)) || lastChild; - } - else if (util_1.isArray(val) || util_1.isSet(val)) { - util_1.forEachArray(val, function (item) { - var insIndex = item.indexOf(' '); - var insTarget = (insIndex === -1 ? item : item.substr(0, insIndex)); - var insValue = (insIndex === -1 ? '' : item.substr(insIndex + 1)); - lastChild = _this.instruction(node, _this.sanitize(insTarget), _this.sanitize(insValue)) || lastChild; - }, _this); - } - else /* if (isMap(target) || isObject(target)) */ { - util_1.forEachObject(val, function (insTarget, insValue) { return lastChild = _this.instruction(node, _this.sanitize(insTarget), _this.sanitize(insValue)) || lastChild; }, _this); - } - } - else if ((util_1.isArray(val) || util_1.isSet(val)) && util_1.isEmpty(val)) { - // skip empty arrays - } - else if ((util_1.isMap(val) || util_1.isObject(val)) && util_1.isEmpty(val)) { - // empty objects produce one node - lastChild = _this.element(node, undefined, _this.sanitize(key)) || lastChild; - } - else if (!options.keepNullNodes && (val == null)) { - // skip null and undefined nodes - } - else if (util_1.isArray(val) || util_1.isSet(val)) { - // expand list by creating child nodes - util_1.forEachArray(val, function (item) { - var childNode = {}; - childNode[key] = item; - lastChild = _this.parse(node, childNode); - }, _this); - } - else if (util_1.isMap(val) || util_1.isObject(val)) { - // create a parent node - var parent = _this.element(node, undefined, _this.sanitize(key)); - if (parent) { - lastChild = parent; - // expand child nodes under parent - _this.parse(parent, val); - } - } - else if (val != null && val !== '') { - // leaf element node with a single text node - var parent = _this.element(node, undefined, _this.sanitize(key)); - if (parent) { - lastChild = parent; - _this.text(parent, _this.sanitize(val)); - } - } - else { - // leaf element node - lastChild = _this.element(node, undefined, _this.sanitize(key)) || lastChild; - } - }, this); - } - return lastChild || node; - }; - return ObjectReader; -}(BaseReader_1.BaseReader)); -exports.ObjectReader = ObjectReader; -//# sourceMappingURL=ObjectReader.js.map - -/***/ }), - -/***/ 65044: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + } +} -"use strict"; +module.exports = createRedirectInterceptor -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -}; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var XMLStringLexer_1 = __nccwpck_require__(47061); -var interfaces_1 = __nccwpck_require__(97707); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); -var BaseReader_1 = __nccwpck_require__(33396); -/** - * Parses XML nodes from an XML document string. - */ -var XMLReader = /** @class */ (function (_super) { - __extends(XMLReader, _super); - function XMLReader() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Parses the given document representation. - * - * @param node - node receive parsed XML nodes - * @param str - XML document string to parse - */ - XMLReader.prototype._parse = function (node, str) { - var e_1, _a, e_2, _b; - var lexer = new XMLStringLexer_1.XMLStringLexer(str, { skipWhitespaceOnlyText: true }); - var context = node; - var token = lexer.nextToken(); - while (token.type !== interfaces_1.TokenType.EOF) { - switch (token.type) { - case interfaces_1.TokenType.Declaration: - var declaration = token; - var version = this.sanitize(declaration.version); - if (version !== "1.0") { - throw new Error("Invalid xml version: " + version); - } - var builderOptions = { - version: version - }; - if (declaration.encoding) { - builderOptions.encoding = this.sanitize(declaration.encoding); - } - if (declaration.standalone) { - builderOptions.standalone = (this.sanitize(declaration.standalone) === "yes"); - } - context.set(builderOptions); - break; - case interfaces_1.TokenType.DocType: - var doctype = token; - context = this.docType(context, this.sanitize(doctype.name), this.sanitize(doctype.pubId), this.sanitize(doctype.sysId)) || context; - break; - case interfaces_1.TokenType.CDATA: - var cdata = token; - context = this.cdata(context, this.sanitize(cdata.data)) || context; - break; - case interfaces_1.TokenType.Comment: - var comment = token; - context = this.comment(context, this.sanitize(comment.data)) || context; - break; - case interfaces_1.TokenType.PI: - var pi = token; - context = this.instruction(context, this.sanitize(pi.target), this.sanitize(pi.data)) || context; - break; - case interfaces_1.TokenType.Text: - var text = token; - context = this.text(context, this.sanitize(text.data)) || context; - break; - case interfaces_1.TokenType.Element: - var element = token; - var elementName = this.sanitize(element.name); - // inherit namespace from parent - var _c = __read(algorithm_1.namespace_extractQName(elementName), 1), prefix = _c[0]; - var namespace = context.node.lookupNamespaceURI(prefix); - // override namespace if there is a namespace declaration - // attribute - // also lookup namespace declaration attributes - var nsDeclarations = {}; - try { - for (var _d = (e_1 = void 0, __values(element.attributes)), _e = _d.next(); !_e.done; _e = _d.next()) { - var _f = __read(_e.value, 2), attName = _f[0], attValue = _f[1]; - attName = this.sanitize(attName); - attValue = this.sanitize(attValue); - if (attName === "xmlns") { - namespace = attValue; - } - else { - var _g = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _g[0], attLocalName = _g[1]; - if (attPrefix === "xmlns") { - if (attLocalName === prefix) { - namespace = attValue; - } - nsDeclarations[attLocalName] = attValue; - } - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_e && !_e.done && (_a = _d.return)) _a.call(_d); - } - finally { if (e_1) throw e_1.error; } - } - // create the DOM element node - var elementNode = (namespace !== null ? - this.element(context, namespace, elementName) : - this.element(context, undefined, elementName)); - if (elementNode === undefined) - break; - try { - // assign attributes - for (var _h = (e_2 = void 0, __values(element.attributes)), _j = _h.next(); !_j.done; _j = _h.next()) { - var _k = __read(_j.value, 2), attName = _k[0], attValue = _k[1]; - attName = this.sanitize(attName); - attValue = this.sanitize(attValue); - var _l = __read(algorithm_1.namespace_extractQName(attName), 2), attPrefix = _l[0], attLocalName = _l[1]; - var attNamespace = null; - if (attPrefix === "xmlns" || (attPrefix === null && attLocalName === "xmlns")) { - // namespace declaration attribute - attNamespace = infra_1.namespace.XMLNS; - } - else { - attNamespace = elementNode.node.lookupNamespaceURI(attPrefix); - if (attNamespace !== null && elementNode.node.isDefaultNamespace(attNamespace)) { - attNamespace = null; - } - else if (attNamespace === null && attPrefix !== null) { - attNamespace = nsDeclarations[attPrefix] || null; - } - } - if (attNamespace !== null) - this.attribute(elementNode, attNamespace, attName, attValue); - else - this.attribute(elementNode, undefined, attName, attValue); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_j && !_j.done && (_b = _h.return)) _b.call(_h); - } - finally { if (e_2) throw e_2.error; } - } - if (!element.selfClosing) { - context = elementNode; - } - break; - case interfaces_1.TokenType.ClosingTag: - /* istanbul ignore else */ - if (context.node.parentNode) { - context = context.up(); - } - break; - } - token = lexer.nextToken(); - } - return context; - }; - return XMLReader; -}(BaseReader_1.BaseReader)); -exports.XMLReader = XMLReader; -//# sourceMappingURL=XMLReader.js.map /***/ }), -/***/ 12475: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 30953: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); Object.defineProperty(exports, "__esModule", ({ value: true })); -var ObjectReader_1 = __nccwpck_require__(40768); -var BaseReader_1 = __nccwpck_require__(33396); -var js_yaml_1 = __nccwpck_require__(10829); -/** - * Parses XML nodes from a YAML string. +exports.SPECIAL_HEADERS = exports.HEADER_STATE = exports.MINOR = exports.MAJOR = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.STRICT_TOKEN = exports.HEX = exports.URL_CHAR = exports.STRICT_URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.FINISH = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0; +const utils_1 = __nccwpck_require__(41891); +// C headers +var ERROR; +(function (ERROR) { + ERROR[ERROR["OK"] = 0] = "OK"; + ERROR[ERROR["INTERNAL"] = 1] = "INTERNAL"; + ERROR[ERROR["STRICT"] = 2] = "STRICT"; + ERROR[ERROR["LF_EXPECTED"] = 3] = "LF_EXPECTED"; + ERROR[ERROR["UNEXPECTED_CONTENT_LENGTH"] = 4] = "UNEXPECTED_CONTENT_LENGTH"; + ERROR[ERROR["CLOSED_CONNECTION"] = 5] = "CLOSED_CONNECTION"; + ERROR[ERROR["INVALID_METHOD"] = 6] = "INVALID_METHOD"; + ERROR[ERROR["INVALID_URL"] = 7] = "INVALID_URL"; + ERROR[ERROR["INVALID_CONSTANT"] = 8] = "INVALID_CONSTANT"; + ERROR[ERROR["INVALID_VERSION"] = 9] = "INVALID_VERSION"; + ERROR[ERROR["INVALID_HEADER_TOKEN"] = 10] = "INVALID_HEADER_TOKEN"; + ERROR[ERROR["INVALID_CONTENT_LENGTH"] = 11] = "INVALID_CONTENT_LENGTH"; + ERROR[ERROR["INVALID_CHUNK_SIZE"] = 12] = "INVALID_CHUNK_SIZE"; + ERROR[ERROR["INVALID_STATUS"] = 13] = "INVALID_STATUS"; + ERROR[ERROR["INVALID_EOF_STATE"] = 14] = "INVALID_EOF_STATE"; + ERROR[ERROR["INVALID_TRANSFER_ENCODING"] = 15] = "INVALID_TRANSFER_ENCODING"; + ERROR[ERROR["CB_MESSAGE_BEGIN"] = 16] = "CB_MESSAGE_BEGIN"; + ERROR[ERROR["CB_HEADERS_COMPLETE"] = 17] = "CB_HEADERS_COMPLETE"; + ERROR[ERROR["CB_MESSAGE_COMPLETE"] = 18] = "CB_MESSAGE_COMPLETE"; + ERROR[ERROR["CB_CHUNK_HEADER"] = 19] = "CB_CHUNK_HEADER"; + ERROR[ERROR["CB_CHUNK_COMPLETE"] = 20] = "CB_CHUNK_COMPLETE"; + ERROR[ERROR["PAUSED"] = 21] = "PAUSED"; + ERROR[ERROR["PAUSED_UPGRADE"] = 22] = "PAUSED_UPGRADE"; + ERROR[ERROR["PAUSED_H2_UPGRADE"] = 23] = "PAUSED_H2_UPGRADE"; + ERROR[ERROR["USER"] = 24] = "USER"; +})(ERROR = exports.ERROR || (exports.ERROR = {})); +var TYPE; +(function (TYPE) { + TYPE[TYPE["BOTH"] = 0] = "BOTH"; + TYPE[TYPE["REQUEST"] = 1] = "REQUEST"; + TYPE[TYPE["RESPONSE"] = 2] = "RESPONSE"; +})(TYPE = exports.TYPE || (exports.TYPE = {})); +var FLAGS; +(function (FLAGS) { + FLAGS[FLAGS["CONNECTION_KEEP_ALIVE"] = 1] = "CONNECTION_KEEP_ALIVE"; + FLAGS[FLAGS["CONNECTION_CLOSE"] = 2] = "CONNECTION_CLOSE"; + FLAGS[FLAGS["CONNECTION_UPGRADE"] = 4] = "CONNECTION_UPGRADE"; + FLAGS[FLAGS["CHUNKED"] = 8] = "CHUNKED"; + FLAGS[FLAGS["UPGRADE"] = 16] = "UPGRADE"; + FLAGS[FLAGS["CONTENT_LENGTH"] = 32] = "CONTENT_LENGTH"; + FLAGS[FLAGS["SKIPBODY"] = 64] = "SKIPBODY"; + FLAGS[FLAGS["TRAILING"] = 128] = "TRAILING"; + // 1 << 8 is unused + FLAGS[FLAGS["TRANSFER_ENCODING"] = 512] = "TRANSFER_ENCODING"; +})(FLAGS = exports.FLAGS || (exports.FLAGS = {})); +var LENIENT_FLAGS; +(function (LENIENT_FLAGS) { + LENIENT_FLAGS[LENIENT_FLAGS["HEADERS"] = 1] = "HEADERS"; + LENIENT_FLAGS[LENIENT_FLAGS["CHUNKED_LENGTH"] = 2] = "CHUNKED_LENGTH"; + LENIENT_FLAGS[LENIENT_FLAGS["KEEP_ALIVE"] = 4] = "KEEP_ALIVE"; +})(LENIENT_FLAGS = exports.LENIENT_FLAGS || (exports.LENIENT_FLAGS = {})); +var METHODS; +(function (METHODS) { + METHODS[METHODS["DELETE"] = 0] = "DELETE"; + METHODS[METHODS["GET"] = 1] = "GET"; + METHODS[METHODS["HEAD"] = 2] = "HEAD"; + METHODS[METHODS["POST"] = 3] = "POST"; + METHODS[METHODS["PUT"] = 4] = "PUT"; + /* pathological */ + METHODS[METHODS["CONNECT"] = 5] = "CONNECT"; + METHODS[METHODS["OPTIONS"] = 6] = "OPTIONS"; + METHODS[METHODS["TRACE"] = 7] = "TRACE"; + /* WebDAV */ + METHODS[METHODS["COPY"] = 8] = "COPY"; + METHODS[METHODS["LOCK"] = 9] = "LOCK"; + METHODS[METHODS["MKCOL"] = 10] = "MKCOL"; + METHODS[METHODS["MOVE"] = 11] = "MOVE"; + METHODS[METHODS["PROPFIND"] = 12] = "PROPFIND"; + METHODS[METHODS["PROPPATCH"] = 13] = "PROPPATCH"; + METHODS[METHODS["SEARCH"] = 14] = "SEARCH"; + METHODS[METHODS["UNLOCK"] = 15] = "UNLOCK"; + METHODS[METHODS["BIND"] = 16] = "BIND"; + METHODS[METHODS["REBIND"] = 17] = "REBIND"; + METHODS[METHODS["UNBIND"] = 18] = "UNBIND"; + METHODS[METHODS["ACL"] = 19] = "ACL"; + /* subversion */ + METHODS[METHODS["REPORT"] = 20] = "REPORT"; + METHODS[METHODS["MKACTIVITY"] = 21] = "MKACTIVITY"; + METHODS[METHODS["CHECKOUT"] = 22] = "CHECKOUT"; + METHODS[METHODS["MERGE"] = 23] = "MERGE"; + /* upnp */ + METHODS[METHODS["M-SEARCH"] = 24] = "M-SEARCH"; + METHODS[METHODS["NOTIFY"] = 25] = "NOTIFY"; + METHODS[METHODS["SUBSCRIBE"] = 26] = "SUBSCRIBE"; + METHODS[METHODS["UNSUBSCRIBE"] = 27] = "UNSUBSCRIBE"; + /* RFC-5789 */ + METHODS[METHODS["PATCH"] = 28] = "PATCH"; + METHODS[METHODS["PURGE"] = 29] = "PURGE"; + /* CalDAV */ + METHODS[METHODS["MKCALENDAR"] = 30] = "MKCALENDAR"; + /* RFC-2068, section 19.6.1.2 */ + METHODS[METHODS["LINK"] = 31] = "LINK"; + METHODS[METHODS["UNLINK"] = 32] = "UNLINK"; + /* icecast */ + METHODS[METHODS["SOURCE"] = 33] = "SOURCE"; + /* RFC-7540, section 11.6 */ + METHODS[METHODS["PRI"] = 34] = "PRI"; + /* RFC-2326 RTSP */ + METHODS[METHODS["DESCRIBE"] = 35] = "DESCRIBE"; + METHODS[METHODS["ANNOUNCE"] = 36] = "ANNOUNCE"; + METHODS[METHODS["SETUP"] = 37] = "SETUP"; + METHODS[METHODS["PLAY"] = 38] = "PLAY"; + METHODS[METHODS["PAUSE"] = 39] = "PAUSE"; + METHODS[METHODS["TEARDOWN"] = 40] = "TEARDOWN"; + METHODS[METHODS["GET_PARAMETER"] = 41] = "GET_PARAMETER"; + METHODS[METHODS["SET_PARAMETER"] = 42] = "SET_PARAMETER"; + METHODS[METHODS["REDIRECT"] = 43] = "REDIRECT"; + METHODS[METHODS["RECORD"] = 44] = "RECORD"; + /* RAOP */ + METHODS[METHODS["FLUSH"] = 45] = "FLUSH"; +})(METHODS = exports.METHODS || (exports.METHODS = {})); +exports.METHODS_HTTP = [ + METHODS.DELETE, + METHODS.GET, + METHODS.HEAD, + METHODS.POST, + METHODS.PUT, + METHODS.CONNECT, + METHODS.OPTIONS, + METHODS.TRACE, + METHODS.COPY, + METHODS.LOCK, + METHODS.MKCOL, + METHODS.MOVE, + METHODS.PROPFIND, + METHODS.PROPPATCH, + METHODS.SEARCH, + METHODS.UNLOCK, + METHODS.BIND, + METHODS.REBIND, + METHODS.UNBIND, + METHODS.ACL, + METHODS.REPORT, + METHODS.MKACTIVITY, + METHODS.CHECKOUT, + METHODS.MERGE, + METHODS['M-SEARCH'], + METHODS.NOTIFY, + METHODS.SUBSCRIBE, + METHODS.UNSUBSCRIBE, + METHODS.PATCH, + METHODS.PURGE, + METHODS.MKCALENDAR, + METHODS.LINK, + METHODS.UNLINK, + METHODS.PRI, + // TODO(indutny): should we allow it with HTTP? + METHODS.SOURCE, +]; +exports.METHODS_ICE = [ + METHODS.SOURCE, +]; +exports.METHODS_RTSP = [ + METHODS.OPTIONS, + METHODS.DESCRIBE, + METHODS.ANNOUNCE, + METHODS.SETUP, + METHODS.PLAY, + METHODS.PAUSE, + METHODS.TEARDOWN, + METHODS.GET_PARAMETER, + METHODS.SET_PARAMETER, + METHODS.REDIRECT, + METHODS.RECORD, + METHODS.FLUSH, + // For AirPlay + METHODS.GET, + METHODS.POST, +]; +exports.METHOD_MAP = utils_1.enumToMap(METHODS); +exports.H_METHOD_MAP = {}; +Object.keys(exports.METHOD_MAP).forEach((key) => { + if (/^H/.test(key)) { + exports.H_METHOD_MAP[key] = exports.METHOD_MAP[key]; + } +}); +var FINISH; +(function (FINISH) { + FINISH[FINISH["SAFE"] = 0] = "SAFE"; + FINISH[FINISH["SAFE_WITH_CB"] = 1] = "SAFE_WITH_CB"; + FINISH[FINISH["UNSAFE"] = 2] = "UNSAFE"; +})(FINISH = exports.FINISH || (exports.FINISH = {})); +exports.ALPHA = []; +for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) { + // Upper case + exports.ALPHA.push(String.fromCharCode(i)); + // Lower case + exports.ALPHA.push(String.fromCharCode(i + 0x20)); +} +exports.NUM_MAP = { + 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, + 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, +}; +exports.HEX_MAP = { + 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, + 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, + A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF, + a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf, +}; +exports.NUM = [ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', +]; +exports.ALPHANUM = exports.ALPHA.concat(exports.NUM); +exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')']; +exports.USERINFO_CHARS = exports.ALPHANUM + .concat(exports.MARK) + .concat(['%', ';', ':', '&', '=', '+', '$', ',']); +// TODO(indutny): use RFC +exports.STRICT_URL_CHAR = [ + '!', '"', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + ':', ';', '<', '=', '>', + '@', '[', '\\', ']', '^', '_', + '`', + '{', '|', '}', '~', +].concat(exports.ALPHANUM); +exports.URL_CHAR = exports.STRICT_URL_CHAR + .concat(['\t', '\f']); +// All characters with 0x80 bit set to 1 +for (let i = 0x80; i <= 0xff; i++) { + exports.URL_CHAR.push(i); +} +exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']); +/* Tokens as defined by rfc 2616. Also lowercases them. + * token = 1* + * separators = "(" | ")" | "<" | ">" | "@" + * | "," | ";" | ":" | "\" | <"> + * | "/" | "[" | "]" | "?" | "=" + * | "{" | "}" | SP | HT + */ +exports.STRICT_TOKEN = [ + '!', '#', '$', '%', '&', '\'', + '*', '+', '-', '.', + '^', '_', '`', + '|', '~', +].concat(exports.ALPHANUM); +exports.TOKEN = exports.STRICT_TOKEN.concat([' ']); +/* + * Verify that a char is a valid visible (printable) US-ASCII + * character or %x80-FF */ -var YAMLReader = /** @class */ (function (_super) { - __extends(YAMLReader, _super); - function YAMLReader() { - return _super !== null && _super.apply(this, arguments) || this; +exports.HEADER_CHARS = ['\t']; +for (let i = 32; i <= 255; i++) { + if (i !== 127) { + exports.HEADER_CHARS.push(i); } - /** - * Parses the given document representation. - * - * @param node - node receive parsed XML nodes - * @param str - YAML string to parse - */ - YAMLReader.prototype._parse = function (node, str) { - var result = js_yaml_1.safeLoad(str); - /* istanbul ignore next */ - if (result === undefined) { - throw new Error("Unable to parse YAML document."); - } - return new ObjectReader_1.ObjectReader(this._builderOptions).parse(node, result); - }; - return YAMLReader; -}(BaseReader_1.BaseReader)); -exports.YAMLReader = YAMLReader; -//# sourceMappingURL=YAMLReader.js.map +} +// ',' = \x44 +exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44); +exports.MAJOR = exports.NUM_MAP; +exports.MINOR = exports.MAJOR; +var HEADER_STATE; +(function (HEADER_STATE) { + HEADER_STATE[HEADER_STATE["GENERAL"] = 0] = "GENERAL"; + HEADER_STATE[HEADER_STATE["CONNECTION"] = 1] = "CONNECTION"; + HEADER_STATE[HEADER_STATE["CONTENT_LENGTH"] = 2] = "CONTENT_LENGTH"; + HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING"] = 3] = "TRANSFER_ENCODING"; + HEADER_STATE[HEADER_STATE["UPGRADE"] = 4] = "UPGRADE"; + HEADER_STATE[HEADER_STATE["CONNECTION_KEEP_ALIVE"] = 5] = "CONNECTION_KEEP_ALIVE"; + HEADER_STATE[HEADER_STATE["CONNECTION_CLOSE"] = 6] = "CONNECTION_CLOSE"; + HEADER_STATE[HEADER_STATE["CONNECTION_UPGRADE"] = 7] = "CONNECTION_UPGRADE"; + HEADER_STATE[HEADER_STATE["TRANSFER_ENCODING_CHUNKED"] = 8] = "TRANSFER_ENCODING_CHUNKED"; +})(HEADER_STATE = exports.HEADER_STATE || (exports.HEADER_STATE = {})); +exports.SPECIAL_HEADERS = { + 'connection': HEADER_STATE.CONNECTION, + 'content-length': HEADER_STATE.CONTENT_LENGTH, + 'proxy-connection': HEADER_STATE.CONNECTION, + 'transfer-encoding': HEADER_STATE.TRANSFER_ENCODING, + 'upgrade': HEADER_STATE.UPGRADE, +}; +//# sourceMappingURL=constants.js.map /***/ }), -/***/ 90560: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 61145: +/***/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QAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAQDscBAAECAwQFBgcICQoLDA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CQCABIhAgAkcNAEEcIRAM2AMLQgAhESAQIQEgEC0AAEFQag435wHmAQECAwQFBgcIAAAAAAAAAAkKCwwNDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADxAREhMUAAtBHiEQDL0DC0ICIREM5QELQgMhEQzkAQtCBCERDOMBC0IFIREM4gELQgYhEQzhAQtCByERDOABC0IIIREM3wELQgkhEQzeAQtCCiERDN0BC0ILIREM3AELQgwhEQzbAQtCDSERDNoBC0IOIREM2QELQg8hEQzYAQtCCiERDNcBC0ILIREM1gELQgwhEQzVAQtCDSERDNQBC0IOIREM0wELQg8hEQzSAQtCACERAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAQLQAAQVBqDjflAeQBAAECAwQFBgfmAeYB5gHmAeYB5gHmAQgJCgsMDeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gHmAeYB5gEODxAREhPmAQtCAiERDOQBC0IDIREM4wELQgQhEQziAQtCBSERDOEBC0IGIREM4AELQgchEQzfAQtCCCERDN4BC0IJIREM3QELQgohEQzcAQtCCyERDNsBC0IMIREM2gELQg0hEQzZAQtCDiERDNgBC0IPIREM1wELQgohEQzWAQtCCyERDNUBC0IMIREM1AELQg0hEQzTAQtCDiERDNIBC0IPIREM0QELIABCACAAKQMgIhEgAiABIhBrrSISfSITIBMgEVYbNwMgIBEgElYiFEUN0gFBHyEQDMADCwJAIAEiASACRg0AIABBiYCAgAA2AgggACABNgIEIAEhAUEkIRAMpwMLQSAhEAy/AwsgACABIhAgAhC+gICAAEF/ag4FtgEAxQIB0QHSAQtBESEQDKQDCyAAQQE6AC8gECEBDLsDCyABIgEgAkcN0gFBJCEQDLsDCyABIg0gAkcNHkHGACEQDLoDCyAAIAEiASACELKAgIAAIhAN1AEgASEBDLUBCyABIhAgAkcNJkHQACEQDLgDCwJAIAEiASACRw0AQSghEAy4AwsgAEEANgIEIABBjICAgAA2AgggAC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BADYCHCAAIAE2AhQgAEG5jYCAADYCECAAQRo2AgxBACEQDLQBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxUCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDLMBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQdIANgIcIAAgATYCFCAAIBA2AgxBACEQDLIBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQdMANgIcIAAgATYCFCAAIBA2AgxBACEQDLEBCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxRCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDLABCyAAQQA2AhwgACABNgIUIABBxoqAgAA2AhAgAEEHNgIMQQAhEAyvAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMSQsgAEHSADYCHCAAIAE2AhQgACAQNgIMQQAhEAyuAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMSQsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAytAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMTQsgAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAysAQsgAEEANgIcIAAgATYCFCAAQdyIgIAANgIQIABBBzYCDEEAIRAMqwELIBBBP0cNASABQQFqIQELQQUhEAyQAQtBACEQIABBADYCHCAAIAE2AhQgAEH9koCAADYCECAAQQc2AgwMqAELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0gA2AhwgACABNgIUIAAgEDYCDEEAIRAMpwELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEILIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMpgELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDEYLIABB5QA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gIIIAEgAjYCDCABIAA2AggPC0EfIQICQCAAQf///wdLDQAgAEEIdiICIAJBgP4/akEQdkEIcSICdCIEIARBgOAfakEQdkEEcSIEdCIGIAZBgIAPakEQdkECcSIGdEEPdiACIARyIAZyayICQQF0IAAgAkEVanZBAXFyQRxqIQILIAEgAjYCHCABQgA3AhAgAkECdEG40oCAAGohBAJAAkBBACgCjNCAgAAiBkEBIAJ0IgNxDQAgBCABNgIAQQAgBiADcjYCjNCAgAAgASAENgIYIAEgATYCCCABIAE2AgwMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgBCgCACEGAkADQCAGIgQoAgRBeHEgAEYNASACQR12IQYgAkEBdCECIAQgBkEEcWpBEGoiAygCACIGDQALIAMgATYCACABIAQ2AhggASABNgIMIAEgATYCCAwBCyAEKAIIIgAgATYCDCAEIAE2AgggAUEANgIYIAEgBDYCDCABIAA2AggLQQBBACgCqNCAgABBf2oiAUF/IAEbNgKo0ICAAAsLBAAAAAtOAAJAIAANAD8AQRB0DwsCQCAAQf//A3ENACAAQX9MDQACQCAAQRB2QAAiAEF/Rw0AQQBBMDYC+NOAgABBfw8LIABBEHQPCxDKgICAAAAL8gICA38BfgJAIAJFDQAgACABOgAAIAIgAGoiA0F/aiABOgAAIAJBA0kNACAAIAE6AAIgACABOgABIANBfWogAToAACADQX5qIAE6AAAgAkEHSQ0AIAAgAToAAyADQXxqIAE6AAAgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIFayICQSBJDQAgAa1CgYCAgBB+IQYgAyAFaiEBA0AgASAGNwMYIAEgBjcDECABIAY3AwggASAGNwMAIAFBIG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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAIAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABOT1VOQ0VFQ0tPVVRORUNURVRFQ1JJQkVMVVNIRVRFQURTRUFSQ0hSR0VDVElWSVRZTEVOREFSVkVPVElGWVBUSU9OU0NIU0VBWVNUQVRDSEdFT1JESVJFQ1RPUlRSQ0hQQVJBTUVURVJVUkNFQlNDUklCRUFSRE9XTkFDRUlORE5LQ0tVQlNDUklCRUhUVFAvQURUUC8=' -Object.defineProperty(exports, "__esModule", ({ value: true })); -var XMLReader_1 = __nccwpck_require__(65044); -exports.XMLReader = XMLReader_1.XMLReader; -var ObjectReader_1 = __nccwpck_require__(40768); -exports.ObjectReader = ObjectReader_1.ObjectReader; -var JSONReader_1 = __nccwpck_require__(43518); -exports.JSONReader = JSONReader_1.JSONReader; -var YAMLReader_1 = __nccwpck_require__(12475); -exports.YAMLReader = YAMLReader_1.YAMLReader; -//# sourceMappingURL=index.js.map /***/ }), -/***/ 50708: +/***/ 95627: +/***/ ((module) => { + +module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn9/AGAGf39/f39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQ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AAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIBAOxwEAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB4fICEjJSg/QEFERUZHSElKS0xNT1BRUlPeA1dZW1xdYGJlZmdoaWprbG1vcHFyc3R1dnd4eXp7fH1+gAGCAYUBhgGHAYkBiwGMAY0BjgGPAZABkQGUAZUBlgGXAZgBmQGaAZsBnAG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AAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDE0LIABB0wA2AhwgACABNgIUIAAgEDYCDEEAIRAMsQELIAAoAgQhECAAQQA2AgQCQCAAIBAgARCngICAACIQDQAgASEBDFELIABB5QA2AhwgACABNgIUIAAgEDYCDEEAIRAMsAELIABBADYCHCAAIAE2AhQgAEHGioCAADYCECAAQQc2AgxBACEQDK8BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdIANgIcIAAgATYCFCAAIBA2AgxBACEQDK4BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxJCyAAQdMANgIcIAAgATYCFCAAIBA2AgxBACEQDK0BCyAAKAIEIRAgAEEANgIEAkAgACAQIAEQp4CAgAAiEA0AIAEhAQxNCyAAQeUANgIcIAAgATYCFCAAIBA2AgxBACEQDKwBCyAAQQA2AhwgACABNgIUIABB3IiAgAA2AhAgAEEHNgIMQQAhEAyrAQsgEEE/Rw0BIAFBAWohAQtBBSEQDJABC0EAIRAgAEEANgIcIAAgATYCFCAAQf2SgIAANgIQIABBBzYCDAyoAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHSADYCHCAAIAE2AhQgACAQNgIMQQAhEAynAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMQgsgAEHTADYCHCAAIAE2AhQgACAQNgIMQQAhEAymAQsgACgCBCEQIABBADYCBAJAIAAgECABEKeAgIAAIhANACABIQEMRgsgAEHlADYCHCAAIAE2AhQgACAQNgIMQQAhEAylAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMPwsgAEHSADYCHCAAIBQ2AhQgACABNgIMQQAhEAykAQsgACgCBCEBIABBADYCBAJAIAAgASAUEKeAgIAAIgENACAUIQEMPwsgAEHTADYCHCAAIBQ2AhQgACABNgIMQQAhEAyjAQsgACgCBCEBIABBADYC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wMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5PVU5DRUVDS09VVE5FQ1RFVEVDUklCRUxVU0hFVEVBRFNFQVJDSFJHRUNUSVZJVFlMRU5EQVJWRU9USUZZUFRJT05TQ0hTRUFZU1RBVENIR0VPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFSFRUUC9BRFRQLw==' + + +/***/ }), + +/***/ 41891: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -/** - * Pre-serializes XML nodes. - */ -var BaseCBWriter = /** @class */ (function () { - /** - * Initializes a new instance of `BaseCBWriter`. - * - * @param builderOptions - XML builder options - */ - function BaseCBWriter(builderOptions) { - /** - * Gets the current depth of the XML tree. - */ - this.level = 0; - this._builderOptions = builderOptions; - this._writerOptions = builderOptions; - } - return BaseCBWriter; -}()); -exports.BaseCBWriter = BaseCBWriter; -//# sourceMappingURL=BaseCBWriter.js.map +exports.enumToMap = void 0; +function enumToMap(obj) { + const res = {}; + Object.keys(obj).forEach((key) => { + const value = obj[key]; + if (typeof value === 'number') { + res[key] = value; + } + }); + return res; +} +exports.enumToMap = enumToMap; +//# sourceMappingURL=utils.js.map /***/ }), -/***/ 37644: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 66771: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -var __read = (this && this.__read) || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + +const { kClients } = __nccwpck_require__(72785) +const Agent = __nccwpck_require__(7890) +const { + kAgent, + kMockAgentSet, + kMockAgentGet, + kDispatches, + kIsMockActive, + kNetConnect, + kGetNetConnect, + kOptions, + kFactory +} = __nccwpck_require__(24347) +const MockClient = __nccwpck_require__(58687) +const MockPool = __nccwpck_require__(26193) +const { matchValue, buildMockOptions } = __nccwpck_require__(79323) +const { InvalidArgumentError, UndiciError } = __nccwpck_require__(48045) +const Dispatcher = __nccwpck_require__(60412) +const Pluralizer = __nccwpck_require__(78891) +const PendingInterceptorsFormatter = __nccwpck_require__(86823) + +class FakeWeakRef { + constructor (value) { + this.value = value + } + + deref () { + return this.value + } +} + +class MockAgent extends Dispatcher { + constructor (opts) { + super(opts) + + this[kNetConnect] = true + this[kIsMockActive] = true + + // Instantiate Agent and encapsulate + if ((opts && opts.agent && typeof opts.agent.dispatch !== 'function')) { + throw new InvalidArgumentError('Argument opts.agent must implement Agent') } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } + const agent = opts && opts.agent ? opts.agent : new Agent(opts) + this[kAgent] = agent + + this[kClients] = agent[kClients] + this[kOptions] = buildMockOptions(opts) + } + + get (origin) { + let dispatcher = this[kMockAgentGet](origin) + + if (!dispatcher) { + dispatcher = this[kFactory](origin) + this[kMockAgentSet](origin, dispatcher) } - return ar; -}; -var __spread = (this && this.__spread) || function () { - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); - return ar; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var interfaces_1 = __nccwpck_require__(27305); -var LocalNameSet_1 = __nccwpck_require__(19049); -var NamespacePrefixMap_1 = __nccwpck_require__(90283); -var infra_1 = __nccwpck_require__(84251); -var algorithm_1 = __nccwpck_require__(61); -/** - * Pre-serializes XML nodes. - */ -var BaseWriter = /** @class */ (function () { - /** - * Initializes a new instance of `BaseWriter`. - * - * @param builderOptions - XML builder options - */ - function BaseWriter(builderOptions) { - /** - * Gets the current depth of the XML tree. - */ - this.level = 0; - this._builderOptions = builderOptions; + return dispatcher + } + + dispatch (opts, handler) { + // Call MockAgent.get to perform additional setup before dispatching as normal + this.get(opts.origin) + return this[kAgent].dispatch(opts, handler) + } + + async close () { + await this[kAgent].close() + this[kClients].clear() + } + + deactivate () { + this[kIsMockActive] = false + } + + activate () { + this[kIsMockActive] = true + } + + enableNetConnect (matcher) { + if (typeof matcher === 'string' || typeof matcher === 'function' || matcher instanceof RegExp) { + if (Array.isArray(this[kNetConnect])) { + this[kNetConnect].push(matcher) + } else { + this[kNetConnect] = [matcher] + } + } else if (typeof matcher === 'undefined') { + this[kNetConnect] = true + } else { + throw new InvalidArgumentError('Unsupported matcher. Must be one of String|Function|RegExp.') } - /** - * Used by derived classes to serialize the XML declaration. - * - * @param version - a version number string - * @param encoding - encoding declaration - * @param standalone - standalone document declaration - */ - BaseWriter.prototype.declaration = function (version, encoding, standalone) { }; - /** - * Used by derived classes to serialize a DocType node. - * - * @param name - node name - * @param publicId - public identifier - * @param systemId - system identifier - */ - BaseWriter.prototype.docType = function (name, publicId, systemId) { }; - /** - * Used by derived classes to serialize a comment node. - * - * @param data - node data - */ - BaseWriter.prototype.comment = function (data) { }; - /** - * Used by derived classes to serialize a text node. - * - * @param data - node data - */ - BaseWriter.prototype.text = function (data) { }; - /** - * Used by derived classes to serialize a processing instruction node. - * - * @param target - instruction target - * @param data - node data - */ - BaseWriter.prototype.instruction = function (target, data) { }; - /** - * Used by derived classes to serialize a CData section node. - * - * @param data - node data - */ - BaseWriter.prototype.cdata = function (data) { }; - /** - * Used by derived classes to serialize the beginning of the opening tag of an - * element node. - * - * @param name - node name - */ - BaseWriter.prototype.openTagBegin = function (name) { }; - /** - * Used by derived classes to serialize the ending of the opening tag of an - * element node. - * - * @param name - node name - * @param selfClosing - whether the element node is self closing - * @param voidElement - whether the element node is a HTML void element - */ - BaseWriter.prototype.openTagEnd = function (name, selfClosing, voidElement) { }; - /** - * Used by derived classes to serialize the closing tag of an element node. - * - * @param name - node name - */ - BaseWriter.prototype.closeTag = function (name) { }; - /** - * Used by derived classes to serialize attributes or namespace declarations. - * - * @param attributes - attribute array - */ - BaseWriter.prototype.attributes = function (attributes) { - var e_1, _a; - try { - for (var attributes_1 = __values(attributes), attributes_1_1 = attributes_1.next(); !attributes_1_1.done; attributes_1_1 = attributes_1.next()) { - var attr = attributes_1_1.value; - this.attribute(attr[1] === null ? attr[2] : attr[1] + ':' + attr[2], attr[3]); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (attributes_1_1 && !attributes_1_1.done && (_a = attributes_1.return)) _a.call(attributes_1); - } - finally { if (e_1) throw e_1.error; } - } - }; - /** - * Used by derived classes to serialize an attribute or namespace declaration. - * - * @param name - node name - * @param value - node value - */ - BaseWriter.prototype.attribute = function (name, value) { }; - /** - * Used by derived classes to perform any pre-processing steps before starting - * serializing an element node. - * - * @param name - node name - */ - BaseWriter.prototype.beginElement = function (name) { }; - /** - * Used by derived classes to perform any post-processing steps after - * completing serializing an element node. - * - * @param name - node name - */ - BaseWriter.prototype.endElement = function (name) { }; - /** - * Produces an XML serialization of the given node. The pre-serializer inserts - * namespace declarations where necessary and produces qualified names for - * nodes and attributes. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype.serializeNode = function (node, requireWellFormed, noDoubleEncoding) { - var hasNamespaces = (node._nodeDocument !== undefined && node._nodeDocument._hasNamespaces); - this.level = 0; - this.currentNode = node; - if (hasNamespaces) { - /** From: https://w3c.github.io/DOM-Parsing/#xml-serialization - * - * 1. Let namespace be a context namespace with value null. - * The context namespace tracks the XML serialization algorithm's current - * default namespace. The context namespace is changed when either an Element - * Node has a default namespace declaration, or the algorithm generates a - * default namespace declaration for the Element Node to match its own - * namespace. The algorithm assumes no namespace (null) to start. - * 2. Let prefix map be a new namespace prefix map. - * 3. Add the XML namespace with prefix value "xml" to prefix map. - * 4. Let prefix index be a generated namespace prefix index with value 1. - * The generated namespace prefix index is used to generate a new unique - * prefix value when no suitable existing namespace prefix is available to - * serialize a node's namespaceURI (or the namespaceURI of one of node's - * attributes). See the generate a prefix algorithm. - */ - var namespace = null; - var prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); - prefixMap.set("xml", infra_1.namespace.XML); - var prefixIndex = { value: 1 }; - /** - * 5. Return the result of running the XML serialization algorithm on node - * passing the context namespace namespace, namespace prefix map prefix map, - * generated namespace prefix index reference to prefix index, and the - * flag require well-formed. If an exception occurs during the execution - * of the algorithm, then catch that exception and throw an - * "InvalidStateError" DOMException. - */ - this._serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding); - } - else { - this._serializeNode(node, requireWellFormed, noDoubleEncoding); - } - }; - /** - * Produces an XML serialization of a node. - * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeNodeNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding) { - this.currentNode = node; - switch (node.nodeType) { - case interfaces_1.NodeType.Element: - this._serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.Document: - this._serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.Comment: - this._serializeComment(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.Text: - this._serializeText(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.DocumentFragment: - this._serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.DocumentType: - this._serializeDocumentType(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.ProcessingInstruction: - this._serializeProcessingInstruction(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.CData: - this._serializeCData(node, requireWellFormed, noDoubleEncoding); - break; - default: - throw new Error("Unknown node type: " + node.nodeType); - } - }; - /** - * Produces an XML serialization of a node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeNode = function (node, requireWellFormed, noDoubleEncoding) { - this.currentNode = node; - switch (node.nodeType) { - case interfaces_1.NodeType.Element: - this._serializeElement(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.Document: - this._serializeDocument(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.Comment: - this._serializeComment(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.Text: - this._serializeText(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.DocumentFragment: - this._serializeDocumentFragment(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.DocumentType: - this._serializeDocumentType(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.ProcessingInstruction: - this._serializeProcessingInstruction(node, requireWellFormed, noDoubleEncoding); - break; - case interfaces_1.NodeType.CData: - this._serializeCData(node, requireWellFormed, noDoubleEncoding); - break; - default: - throw new Error("Unknown node type: " + node.nodeType); + } + + disableNetConnect () { + this[kNetConnect] = false + } + + // This is required to bypass issues caused by using global symbols - see: + // https://github.com/nodejs/undici/issues/1447 + get isMockActive () { + return this[kIsMockActive] + } + + [kMockAgentSet] (origin, dispatcher) { + this[kClients].set(origin, new FakeWeakRef(dispatcher)) + } + + [kFactory] (origin) { + const mockOptions = Object.assign({ agent: this }, this[kOptions]) + return this[kOptions] && this[kOptions].connections === 1 + ? new MockClient(origin, mockOptions) + : new MockPool(origin, mockOptions) + } + + [kMockAgentGet] (origin) { + // First check if we can immediately find it + const ref = this[kClients].get(origin) + if (ref) { + return ref.deref() + } + + // If the origin is not a string create a dummy parent pool and return to user + if (typeof origin !== 'string') { + const dispatcher = this[kFactory]('http://localhost:9999') + this[kMockAgentSet](origin, dispatcher) + return dispatcher + } + + // If we match, create a pool and assign the same dispatches + for (const [keyMatcher, nonExplicitRef] of Array.from(this[kClients])) { + const nonExplicitDispatcher = nonExplicitRef.deref() + if (nonExplicitDispatcher && typeof keyMatcher !== 'string' && matchValue(keyMatcher, origin)) { + const dispatcher = this[kFactory](origin) + this[kMockAgentSet](origin, dispatcher) + dispatcher[kDispatches] = nonExplicitDispatcher[kDispatches] + return dispatcher + } + } + } + + [kGetNetConnect] () { + return this[kNetConnect] + } + + pendingInterceptors () { + const mockAgentClients = this[kClients] + + return Array.from(mockAgentClients.entries()) + .flatMap(([origin, scope]) => scope.deref()[kDispatches].map(dispatch => ({ ...dispatch, origin }))) + .filter(({ pending }) => pending) + } + + assertNoPendingInterceptors ({ pendingInterceptorsFormatter = new PendingInterceptorsFormatter() } = {}) { + const pending = this.pendingInterceptors() + + if (pending.length === 0) { + return + } + + const pluralizer = new Pluralizer('interceptor', 'interceptors').pluralize(pending.length) + + throw new UndiciError(` +${pluralizer.count} ${pluralizer.noun} ${pluralizer.is} pending: + +${pendingInterceptorsFormatter.format(pending)} +`.trim()) + } +} + +module.exports = MockAgent + + +/***/ }), + +/***/ 58687: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { promisify } = __nccwpck_require__(73837) +const Client = __nccwpck_require__(33598) +const { buildMockDispatch } = __nccwpck_require__(79323) +const { + kDispatches, + kMockAgent, + kClose, + kOriginalClose, + kOrigin, + kOriginalDispatch, + kConnected +} = __nccwpck_require__(24347) +const { MockInterceptor } = __nccwpck_require__(90410) +const Symbols = __nccwpck_require__(72785) +const { InvalidArgumentError } = __nccwpck_require__(48045) + +/** + * MockClient provides an API that extends the Client to influence the mockDispatches. + */ +class MockClient extends Client { + constructor (origin, opts) { + super(origin, opts) + + if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') { + throw new InvalidArgumentError('Argument opts.agent must implement Agent') + } + + this[kMockAgent] = opts.agent + this[kOrigin] = origin + this[kDispatches] = [] + this[kConnected] = 1 + this[kOriginalDispatch] = this.dispatch + this[kOriginalClose] = this.close.bind(this) + + this.dispatch = buildMockDispatch.call(this) + this.close = this[kClose] + } + + get [Symbols.kConnected] () { + return this[kConnected] + } + + /** + * Sets up the base interceptor for mocking replies from undici. + */ + intercept (opts) { + return new MockInterceptor(opts, this[kDispatches]) + } + + async [kClose] () { + await promisify(this[kOriginalClose])() + this[kConnected] = 0 + this[kMockAgent][Symbols.kClients].delete(this[kOrigin]) + } +} + +module.exports = MockClient + + +/***/ }), + +/***/ 50888: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { UndiciError } = __nccwpck_require__(48045) + +class MockNotMatchedError extends UndiciError { + constructor (message) { + super(message) + Error.captureStackTrace(this, MockNotMatchedError) + this.name = 'MockNotMatchedError' + this.message = message || 'The request does not match any registered mock dispatches' + this.code = 'UND_MOCK_ERR_MOCK_NOT_MATCHED' + } +} + +module.exports = { + MockNotMatchedError +} + + +/***/ }), + +/***/ 90410: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(79323) +const { + kDispatches, + kDispatchKey, + kDefaultHeaders, + kDefaultTrailers, + kContentLength, + kMockDispatch +} = __nccwpck_require__(24347) +const { InvalidArgumentError } = __nccwpck_require__(48045) +const { buildURL } = __nccwpck_require__(83983) + +/** + * Defines the scope API for an interceptor reply + */ +class MockScope { + constructor (mockDispatch) { + this[kMockDispatch] = mockDispatch + } + + /** + * Delay a reply by a set amount in ms. + */ + delay (waitInMs) { + if (typeof waitInMs !== 'number' || !Number.isInteger(waitInMs) || waitInMs <= 0) { + throw new InvalidArgumentError('waitInMs must be a valid integer > 0') + } + + this[kMockDispatch].delay = waitInMs + return this + } + + /** + * For a defined reply, never mark as consumed. + */ + persist () { + this[kMockDispatch].persist = true + return this + } + + /** + * Allow one to define a reply for a set amount of matching requests. + */ + times (repeatTimes) { + if (typeof repeatTimes !== 'number' || !Number.isInteger(repeatTimes) || repeatTimes <= 0) { + throw new InvalidArgumentError('repeatTimes must be a valid integer > 0') + } + + this[kMockDispatch].times = repeatTimes + return this + } +} + +/** + * Defines an interceptor for a Mock + */ +class MockInterceptor { + constructor (opts, mockDispatches) { + if (typeof opts !== 'object') { + throw new InvalidArgumentError('opts must be an object') + } + if (typeof opts.path === 'undefined') { + throw new InvalidArgumentError('opts.path must be defined') + } + if (typeof opts.method === 'undefined') { + opts.method = 'GET' + } + // See https://github.com/nodejs/undici/issues/1245 + // As per RFC 3986, clients are not supposed to send URI + // fragments to servers when they retrieve a document, + if (typeof opts.path === 'string') { + if (opts.query) { + opts.path = buildURL(opts.path, opts.query) + } else { + // Matches https://github.com/nodejs/undici/blob/main/lib/fetch/index.js#L1811 + const parsedURL = new URL(opts.path, 'data://') + opts.path = parsedURL.pathname + parsedURL.search + } + } + if (typeof opts.method === 'string') { + opts.method = opts.method.toUpperCase() + } + + this[kDispatchKey] = buildKey(opts) + this[kDispatches] = mockDispatches + this[kDefaultHeaders] = {} + this[kDefaultTrailers] = {} + this[kContentLength] = false + } + + createMockScopeDispatchData (statusCode, data, responseOptions = {}) { + const responseData = getResponseData(data) + const contentLength = this[kContentLength] ? { 'content-length': responseData.length } : {} + const headers = { ...this[kDefaultHeaders], ...contentLength, ...responseOptions.headers } + const trailers = { ...this[kDefaultTrailers], ...responseOptions.trailers } + + return { statusCode, data, headers, trailers } + } + + validateReplyParameters (statusCode, data, responseOptions) { + if (typeof statusCode === 'undefined') { + throw new InvalidArgumentError('statusCode must be defined') + } + if (typeof data === 'undefined') { + throw new InvalidArgumentError('data must be defined') + } + if (typeof responseOptions !== 'object') { + throw new InvalidArgumentError('responseOptions must be an object') + } + } + + /** + * Mock an undici request with a defined reply. + */ + reply (replyData) { + // Values of reply aren't available right now as they + // can only be available when the reply callback is invoked. + if (typeof replyData === 'function') { + // We'll first wrap the provided callback in another function, + // this function will properly resolve the data from the callback + // when invoked. + const wrappedDefaultsCallback = (opts) => { + // Our reply options callback contains the parameter for statusCode, data and options. + const resolvedData = replyData(opts) + + // Check if it is in the right format + if (typeof resolvedData !== 'object') { + throw new InvalidArgumentError('reply options callback must return an object') } - }; - /** - * Produces an XML serialization of an element node. - * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeElementNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding) { - var e_2, _a; - var attributes = []; - /** - * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node - * - * 1. If the require well-formed flag is set (its value is true), and this - * node's localName attribute contains the character ":" (U+003A COLON) or - * does not match the XML Name production, then throw an exception; the - * serialization of this node would not be a well-formed element. - */ - if (requireWellFormed && (node.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(node.localName))) { - throw new Error("Node local name contains invalid characters (well-formed required)."); + + const { statusCode, data = '', responseOptions = {} } = resolvedData + this.validateReplyParameters(statusCode, data, responseOptions) + // Since the values can be obtained immediately we return them + // from this higher order function that will be resolved later. + return { + ...this.createMockScopeDispatchData(statusCode, data, responseOptions) } - /** - * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). - * 3. Let qualified name be an empty string. - * 4. Let skip end tag be a boolean flag with value false. - * 5. Let ignore namespace definition attribute be a boolean flag with value - * false. - * 6. Given prefix map, copy a namespace prefix map and let map be the - * result. - * 7. Let local prefixes map be an empty map. The map has unique Node prefix - * strings as its keys, with corresponding namespaceURI Node values as the - * map's key values (in this map, the null namespace is represented by the - * empty string). - * - * _Note:_ This map is local to each element. It is used to ensure there - * are no conflicting prefixes should a new namespace prefix attribute need - * to be generated. It is also used to enable skipping of duplicate prefix - * definitions when writing an element's attributes: the map allows the - * algorithm to distinguish between a prefix in the namespace prefix map - * that might be locally-defined (to the current Element) and one that is - * not. - * 8. Let local default namespace be the result of recording the namespace - * information for node given map and local prefixes map. - * - * _Note:_ The above step will update map with any found namespace prefix - * definitions, add the found prefix definitions to the local prefixes map - * and return a local default namespace value defined by a default namespace - * attribute if one exists. Otherwise it returns null. - * 9. Let inherited ns be a copy of namespace. - * 10. Let ns be the value of node's namespaceURI attribute. - */ - var qualifiedName = ''; - var skipEndTag = false; - var ignoreNamespaceDefinitionAttribute = false; - var map = prefixMap.copy(); - var localPrefixesMap = {}; - var localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); - var inheritedNS = namespace; - var ns = node.namespaceURI; - /** 11. If inherited ns is equal to ns, then: */ - if (inheritedNS === ns) { - /** - * 11.1. If local default namespace is not null, then set ignore - * namespace definition attribute to true. - */ - if (localDefaultNamespace !== null) { - ignoreNamespaceDefinitionAttribute = true; - } - /** - * 11.2. If ns is the XML namespace, then append to qualified name the - * concatenation of the string "xml:" and the value of node's localName. - * 11.3. Otherwise, append to qualified name the value of node's - * localName. The node's prefix if it exists, is dropped. - */ - if (ns === infra_1.namespace.XML) { - qualifiedName = 'xml:' + node.localName; - } - else { - qualifiedName = node.localName; - } - /** 11.4. Append the value of qualified name to markup. */ - this.beginElement(qualifiedName); - this.openTagBegin(qualifiedName); + } + + // Add usual dispatch data, but this time set the data parameter to function that will eventually provide data. + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], wrappedDefaultsCallback) + return new MockScope(newMockDispatch) + } + + // We can have either one or three parameters, if we get here, + // we should have 1-3 parameters. So we spread the arguments of + // this function to obtain the parameters, since replyData will always + // just be the statusCode. + const [statusCode, data = '', responseOptions = {}] = [...arguments] + this.validateReplyParameters(statusCode, data, responseOptions) + + // Send in-already provided data like usual + const dispatchData = this.createMockScopeDispatchData(statusCode, data, responseOptions) + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], dispatchData) + return new MockScope(newMockDispatch) + } + + /** + * Mock an undici request with a defined error. + */ + replyWithError (error) { + if (typeof error === 'undefined') { + throw new InvalidArgumentError('error must be defined') + } + + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error }) + return new MockScope(newMockDispatch) + } + + /** + * Set default reply headers on the interceptor for subsequent replies + */ + defaultReplyHeaders (headers) { + if (typeof headers === 'undefined') { + throw new InvalidArgumentError('headers must be defined') + } + + this[kDefaultHeaders] = headers + return this + } + + /** + * Set default reply trailers on the interceptor for subsequent replies + */ + defaultReplyTrailers (trailers) { + if (typeof trailers === 'undefined') { + throw new InvalidArgumentError('trailers must be defined') + } + + this[kDefaultTrailers] = trailers + return this + } + + /** + * Set reply content length header for replies on the interceptor + */ + replyContentLength () { + this[kContentLength] = true + return this + } +} + +module.exports.MockInterceptor = MockInterceptor +module.exports.MockScope = MockScope + + +/***/ }), + +/***/ 26193: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { promisify } = __nccwpck_require__(73837) +const Pool = __nccwpck_require__(4634) +const { buildMockDispatch } = __nccwpck_require__(79323) +const { + kDispatches, + kMockAgent, + kClose, + kOriginalClose, + kOrigin, + kOriginalDispatch, + kConnected +} = __nccwpck_require__(24347) +const { MockInterceptor } = __nccwpck_require__(90410) +const Symbols = __nccwpck_require__(72785) +const { InvalidArgumentError } = __nccwpck_require__(48045) + +/** + * MockPool provides an API that extends the Pool to influence the mockDispatches. + */ +class MockPool extends Pool { + constructor (origin, opts) { + super(origin, opts) + + if (!opts || !opts.agent || typeof opts.agent.dispatch !== 'function') { + throw new InvalidArgumentError('Argument opts.agent must implement Agent') + } + + this[kMockAgent] = opts.agent + this[kOrigin] = origin + this[kDispatches] = [] + this[kConnected] = 1 + this[kOriginalDispatch] = this.dispatch + this[kOriginalClose] = this.close.bind(this) + + this.dispatch = buildMockDispatch.call(this) + this.close = this[kClose] + } + + get [Symbols.kConnected] () { + return this[kConnected] + } + + /** + * Sets up the base interceptor for mocking replies from undici. + */ + intercept (opts) { + return new MockInterceptor(opts, this[kDispatches]) + } + + async [kClose] () { + await promisify(this[kOriginalClose])() + this[kConnected] = 0 + this[kMockAgent][Symbols.kClients].delete(this[kOrigin]) + } +} + +module.exports = MockPool + + +/***/ }), + +/***/ 24347: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + kAgent: Symbol('agent'), + kOptions: Symbol('options'), + kFactory: Symbol('factory'), + kDispatches: Symbol('dispatches'), + kDispatchKey: Symbol('dispatch key'), + kDefaultHeaders: Symbol('default headers'), + kDefaultTrailers: Symbol('default trailers'), + kContentLength: Symbol('content length'), + kMockAgent: Symbol('mock agent'), + kMockAgentSet: Symbol('mock agent set'), + kMockAgentGet: Symbol('mock agent get'), + kMockDispatch: Symbol('mock dispatch'), + kClose: Symbol('close'), + kOriginalClose: Symbol('original agent close'), + kOrigin: Symbol('origin'), + kIsMockActive: Symbol('is mock active'), + kNetConnect: Symbol('net connect'), + kGetNetConnect: Symbol('get net connect'), + kConnected: Symbol('connected') +} + + +/***/ }), + +/***/ 79323: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { MockNotMatchedError } = __nccwpck_require__(50888) +const { + kDispatches, + kMockAgent, + kOriginalDispatch, + kOrigin, + kGetNetConnect +} = __nccwpck_require__(24347) +const { buildURL, nop } = __nccwpck_require__(83983) +const { STATUS_CODES } = __nccwpck_require__(13685) +const { + types: { + isPromise + } +} = __nccwpck_require__(73837) + +function matchValue (match, value) { + if (typeof match === 'string') { + return match === value + } + if (match instanceof RegExp) { + return match.test(value) + } + if (typeof match === 'function') { + return match(value) === true + } + return false +} + +function lowerCaseEntries (headers) { + return Object.fromEntries( + Object.entries(headers).map(([headerName, headerValue]) => { + return [headerName.toLocaleLowerCase(), headerValue] + }) + ) +} + +/** + * @param {import('../../index').Headers|string[]|Record} headers + * @param {string} key + */ +function getHeaderByName (headers, key) { + if (Array.isArray(headers)) { + for (let i = 0; i < headers.length; i += 2) { + if (headers[i].toLocaleLowerCase() === key.toLocaleLowerCase()) { + return headers[i + 1] + } + } + + return undefined + } else if (typeof headers.get === 'function') { + return headers.get(key) + } else { + return lowerCaseEntries(headers)[key.toLocaleLowerCase()] + } +} + +/** @param {string[]} headers */ +function buildHeadersFromArray (headers) { // fetch HeadersList + const clone = headers.slice() + const entries = [] + for (let index = 0; index < clone.length; index += 2) { + entries.push([clone[index], clone[index + 1]]) + } + return Object.fromEntries(entries) +} + +function matchHeaders (mockDispatch, headers) { + if (typeof mockDispatch.headers === 'function') { + if (Array.isArray(headers)) { // fetch HeadersList + headers = buildHeadersFromArray(headers) + } + return mockDispatch.headers(headers ? lowerCaseEntries(headers) : {}) + } + if (typeof mockDispatch.headers === 'undefined') { + return true + } + if (typeof headers !== 'object' || typeof mockDispatch.headers !== 'object') { + return false + } + + for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) { + const headerValue = getHeaderByName(headers, matchHeaderName) + + if (!matchValue(matchHeaderValue, headerValue)) { + return false + } + } + return true +} + +function safeUrl (path) { + if (typeof path !== 'string') { + return path + } + + const pathSegments = path.split('?') + + if (pathSegments.length !== 2) { + return path + } + + const qp = new URLSearchParams(pathSegments.pop()) + qp.sort() + return [...pathSegments, qp.toString()].join('?') +} + +function matchKey (mockDispatch, { path, method, body, headers }) { + const pathMatch = matchValue(mockDispatch.path, path) + const methodMatch = matchValue(mockDispatch.method, method) + const bodyMatch = typeof mockDispatch.body !== 'undefined' ? matchValue(mockDispatch.body, body) : true + const headersMatch = matchHeaders(mockDispatch, headers) + return pathMatch && methodMatch && bodyMatch && headersMatch +} + +function getResponseData (data) { + if (Buffer.isBuffer(data)) { + return data + } else if (typeof data === 'object') { + return JSON.stringify(data) + } else { + return data.toString() + } +} + +function getMockDispatch (mockDispatches, key) { + const basePath = key.query ? buildURL(key.path, key.query) : key.path + const resolvedPath = typeof basePath === 'string' ? safeUrl(basePath) : basePath + + // Match path + let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path }) => matchValue(safeUrl(path), resolvedPath)) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`) + } + + // Match method + matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method)) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}'`) + } + + // Match body + matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== 'undefined' ? matchValue(body, key.body) : true) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}'`) + } + + // Match headers + matchedMockDispatches = matchedMockDispatches.filter((mockDispatch) => matchHeaders(mockDispatch, key.headers)) + if (matchedMockDispatches.length === 0) { + throw new MockNotMatchedError(`Mock dispatch not matched for headers '${typeof key.headers === 'object' ? JSON.stringify(key.headers) : key.headers}'`) + } + + return matchedMockDispatches[0] +} + +function addMockDispatch (mockDispatches, key, data) { + const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false } + const replyData = typeof data === 'function' ? { callback: data } : { ...data } + const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } } + mockDispatches.push(newMockDispatch) + return newMockDispatch +} + +function deleteMockDispatch (mockDispatches, key) { + const index = mockDispatches.findIndex(dispatch => { + if (!dispatch.consumed) { + return false + } + return matchKey(dispatch, key) + }) + if (index !== -1) { + mockDispatches.splice(index, 1) + } +} + +function buildKey (opts) { + const { path, method, body, headers, query } = opts + return { + path, + method, + body, + headers, + query + } +} + +function generateKeyValues (data) { + return Object.entries(data).reduce((keyValuePairs, [key, value]) => [ + ...keyValuePairs, + Buffer.from(`${key}`), + Array.isArray(value) ? value.map(x => Buffer.from(`${x}`)) : Buffer.from(`${value}`) + ], []) +} + +/** + * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status + * @param {number} statusCode + */ +function getStatusText (statusCode) { + return STATUS_CODES[statusCode] || 'unknown' +} + +async function getResponse (body) { + const buffers = [] + for await (const data of body) { + buffers.push(data) + } + return Buffer.concat(buffers).toString('utf8') +} + +/** + * Mock dispatch function used to simulate undici dispatches + */ +function mockDispatch (opts, handler) { + // Get mock dispatch from built key + const key = buildKey(opts) + const mockDispatch = getMockDispatch(this[kDispatches], key) + + mockDispatch.timesInvoked++ + + // Here's where we resolve a callback if a callback is present for the dispatch data. + if (mockDispatch.data.callback) { + mockDispatch.data = { ...mockDispatch.data, ...mockDispatch.data.callback(opts) } + } + + // Parse mockDispatch data + const { data: { statusCode, data, headers, trailers, error }, delay, persist } = mockDispatch + const { timesInvoked, times } = mockDispatch + + // If it's used up and not persistent, mark as consumed + mockDispatch.consumed = !persist && timesInvoked >= times + mockDispatch.pending = timesInvoked < times + + // If specified, trigger dispatch error + if (error !== null) { + deleteMockDispatch(this[kDispatches], key) + handler.onError(error) + return true + } + + // Handle the request with a delay if necessary + if (typeof delay === 'number' && delay > 0) { + setTimeout(() => { + handleReply(this[kDispatches]) + }, delay) + } else { + handleReply(this[kDispatches]) + } + + function handleReply (mockDispatches, _data = data) { + // fetch's HeadersList is a 1D string array + const optsHeaders = Array.isArray(opts.headers) + ? buildHeadersFromArray(opts.headers) + : opts.headers + const body = typeof _data === 'function' + ? _data({ ...opts, headers: optsHeaders }) + : _data + + // util.types.isPromise is likely needed for jest. + if (isPromise(body)) { + // If handleReply is asynchronous, throwing an error + // in the callback will reject the promise, rather than + // synchronously throw the error, which breaks some tests. + // Rather, we wait for the callback to resolve if it is a + // promise, and then re-run handleReply with the new body. + body.then((newData) => handleReply(mockDispatches, newData)) + return + } + + const responseData = getResponseData(body) + const responseHeaders = generateKeyValues(headers) + const responseTrailers = generateKeyValues(trailers) + + handler.abort = nop + handler.onHeaders(statusCode, responseHeaders, resume, getStatusText(statusCode)) + handler.onData(Buffer.from(responseData)) + handler.onComplete(responseTrailers) + deleteMockDispatch(mockDispatches, key) + } + + function resume () {} + + return true +} + +function buildMockDispatch () { + const agent = this[kMockAgent] + const origin = this[kOrigin] + const originalDispatch = this[kOriginalDispatch] + + return function dispatch (opts, handler) { + if (agent.isMockActive) { + try { + mockDispatch.call(this, opts, handler) + } catch (error) { + if (error instanceof MockNotMatchedError) { + const netConnect = agent[kGetNetConnect]() + if (netConnect === false) { + throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`) + } + if (checkNetConnect(netConnect, origin)) { + originalDispatch.call(this, opts, handler) + } else { + throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`) + } + } else { + throw error } - else { - /** - * 12. Otherwise, inherited ns is not equal to ns (the node's own - * namespace is different from the context namespace of its parent). - * Run these sub-steps: - * - * 12.1. Let prefix be the value of node's prefix attribute. - * 12.2. Let candidate prefix be the result of retrieving a preferred - * prefix string prefix from map given namespace ns. The above may return - * null if no namespace key ns exists in map. - */ - var prefix = node.prefix; - /** - * We don't need to run "retrieving a preferred prefix string" algorithm if - * the element has no prefix and its namespace matches to the default - * namespace. - * See: https://github.com/web-platform-tests/wpt/pull/16703 - */ - var candidatePrefix = null; - if (prefix !== null || ns !== localDefaultNamespace) { - candidatePrefix = map.get(prefix, ns); - } - /** - * 12.3. If the value of prefix matches "xmlns", then run the following - * steps: - */ - if (prefix === "xmlns") { - /** - * 12.3.1. If the require well-formed flag is set, then throw an error. - * An Element with prefix "xmlns" will not legally round-trip in a - * conforming XML parser. - */ - if (requireWellFormed) { - throw new Error("An element cannot have the 'xmlns' prefix (well-formed required)."); - } - /** - * 12.3.2. Let candidate prefix be the value of prefix. - */ - candidatePrefix = prefix; - } - /** - * 12.4.Found a suitable namespace prefix: if candidate prefix is not - * null (a namespace prefix is defined which maps to ns), then: - */ - if (candidatePrefix !== null) { - /** - * The following may serialize a different prefix than the Element's - * existing prefix if it already had one. However, the retrieving a - * preferred prefix string algorithm already tried to match the - * existing prefix if possible. - * - * 12.4.1. Append to qualified name the concatenation of candidate - * prefix, ":" (U+003A COLON), and node's localName. There exists on - * this node or the node's ancestry a namespace prefix definition that - * defines the node's namespace. - * 12.4.2. If the local default namespace is not null (there exists a - * locally-defined default namespace declaration attribute) and its - * value is not the XML namespace, then let inherited ns get the value - * of local default namespace unless the local default namespace is the - * empty string in which case let it get null (the context namespace - * is changed to the declared default, rather than this node's own - * namespace). - * - * _Note:_ Any default namespace definitions or namespace prefixes that - * define the XML namespace are omitted when serializing this node's - * attributes. - */ - qualifiedName = candidatePrefix + ':' + node.localName; - if (localDefaultNamespace !== null && localDefaultNamespace !== infra_1.namespace.XML) { - inheritedNS = localDefaultNamespace || null; - } - /** - * 12.4.3. Append the value of qualified name to markup. - */ - this.beginElement(qualifiedName); - this.openTagBegin(qualifiedName); - /** 12.5. Otherwise, if prefix is not null, then: */ - } - else if (prefix !== null) { - /** - * _Note:_ By this step, there is no namespace or prefix mapping - * declaration in this node (or any parent node visited by this - * algorithm) that defines prefix otherwise the step labelled Found - * a suitable namespace prefix would have been followed. The sub-steps - * that follow will create a new namespace prefix declaration for prefix - * and ensure that prefix does not conflict with an existing namespace - * prefix declaration of the same localName in node's attribute list. - * - * 12.5.1. If the local prefixes map contains a key matching prefix, - * then let prefix be the result of generating a prefix providing as - * input map, ns, and prefix index. - */ - if (prefix in localPrefixesMap) { - prefix = this._generatePrefix(ns, map, prefixIndex); - } - /** - * 12.5.2. Add prefix to map given namespace ns. - * 12.5.3. Append to qualified name the concatenation of prefix, ":" - * (U+003A COLON), and node's localName. - * 12.5.4. Append the value of qualified name to markup. - */ - map.set(prefix, ns); - qualifiedName += prefix + ':' + node.localName; - this.beginElement(qualifiedName); - this.openTagBegin(qualifiedName); - /** - * 12.5.5. Append the following to markup, in the order listed: - * - * _Note:_ The following serializes a namespace prefix declaration for - * prefix which was just added to the map. - * - * 12.5.5.1. " " (U+0020 SPACE); - * 12.5.5.2. The string "xmlns:"; - * 12.5.5.3. The value of prefix; - * 12.5.5.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 12.5.5.5. The result of serializing an attribute value given ns and - * the require well-formed flag as input; - * 12.5.5.6. """ (U+0022 QUOTATION MARK). - */ - attributes.push([null, 'xmlns', prefix, - this._serializeAttributeValue(ns, requireWellFormed, noDoubleEncoding)]); - /** - * 12.5.5.7. If local default namespace is not null (there exists a - * locally-defined default namespace declaration attribute), then - * let inherited ns get the value of local default namespace unless the - * local default namespace is the empty string in which case let it get - * null. - */ - if (localDefaultNamespace !== null) { - inheritedNS = localDefaultNamespace || null; - } - /** - * 12.6. Otherwise, if local default namespace is null, or local - * default namespace is not null and its value is not equal to ns, then: - */ - } - else if (localDefaultNamespace === null || - (localDefaultNamespace !== null && localDefaultNamespace !== ns)) { - /** - * _Note:_ At this point, the namespace for this node still needs to be - * serialized, but there's no prefix (or candidate prefix) available; the - * following uses the default namespace declaration to define the - * namespace--optionally replacing an existing default declaration - * if present. - * - * 12.6.1. Set the ignore namespace definition attribute flag to true. - * 12.6.2. Append to qualified name the value of node's localName. - * 12.6.3. Let the value of inherited ns be ns. - * - * _Note:_ The new default namespace will be used in the serialization - * to define this node's namespace and act as the context namespace for - * its children. - */ - ignoreNamespaceDefinitionAttribute = true; - qualifiedName += node.localName; - inheritedNS = ns; - /** - * 12.6.4. Append the value of qualified name to markup. - */ - this.beginElement(qualifiedName); - this.openTagBegin(qualifiedName); - /** - * 12.6.5. Append the following to markup, in the order listed: - * - * _Note:_ The following serializes the new (or replacement) default - * namespace definition. - * - * 12.6.5.1. " " (U+0020 SPACE); - * 12.6.5.2. The string "xmlns"; - * 12.6.5.3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 12.6.5.4. The result of serializing an attribute value given ns - * and the require well-formed flag as input; - * 12.6.5.5. """ (U+0022 QUOTATION MARK). - */ - attributes.push([null, null, 'xmlns', - this._serializeAttributeValue(ns, requireWellFormed, noDoubleEncoding)]); - /** - * 12.7. Otherwise, the node has a local default namespace that matches - * ns. Append to qualified name the value of node's localName, let the - * value of inherited ns be ns, and append the value of qualified name - * to markup. - */ - } - else { - qualifiedName += node.localName; - inheritedNS = ns; - this.beginElement(qualifiedName); - this.openTagBegin(qualifiedName); - } - } - /** - * 13. Append to markup the result of the XML serialization of node's - * attributes given map, prefix index, local prefixes map, ignore namespace - * definition attribute flag, and require well-formed flag. - */ - attributes.push.apply(attributes, __spread(this._serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed, noDoubleEncoding))); - this.attributes(attributes); - /** - * 14. If ns is the HTML namespace, and the node's list of children is - * empty, and the node's localName matches any one of the following void - * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", - * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", - * "param", "source", "track", "wbr"; then append the following to markup, - * in the order listed: - * 14.1. " " (U+0020 SPACE); - * 14.2. "/" (U+002F SOLIDUS). - * and set the skip end tag flag to true. - * 15. If ns is not the HTML namespace, and the node's list of children is - * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end - * tag flag to true. - * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. - */ - var isHTML = (ns === infra_1.namespace.HTML); - if (isHTML && node.childNodes.length === 0 && - BaseWriter._VoidElementNames.has(node.localName)) { - this.openTagEnd(qualifiedName, true, true); - this.endElement(qualifiedName); - skipEndTag = true; - } - else if (!isHTML && node.childNodes.length === 0) { - this.openTagEnd(qualifiedName, true, false); - this.endElement(qualifiedName); - skipEndTag = true; - } - else { - this.openTagEnd(qualifiedName, false, false); + } + } else { + originalDispatch.call(this, opts, handler) + } + } +} + +function checkNetConnect (netConnect, origin) { + const url = new URL(origin) + if (netConnect === true) { + return true + } else if (Array.isArray(netConnect) && netConnect.some((matcher) => matchValue(matcher, url.host))) { + return true + } + return false +} + +function buildMockOptions (opts) { + if (opts) { + const { agent, ...mockOptions } = opts + return mockOptions + } +} + +module.exports = { + getResponseData, + getMockDispatch, + addMockDispatch, + deleteMockDispatch, + buildKey, + generateKeyValues, + matchValue, + getResponse, + getStatusText, + mockDispatch, + buildMockDispatch, + checkNetConnect, + buildMockOptions, + getHeaderByName +} + + +/***/ }), + +/***/ 86823: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { Transform } = __nccwpck_require__(12781) +const { Console } = __nccwpck_require__(96206) + +/** + * Gets the output of `console.table(…)` as a string. + */ +module.exports = class PendingInterceptorsFormatter { + constructor ({ disableColors } = {}) { + this.transform = new Transform({ + transform (chunk, _enc, cb) { + cb(null, chunk) + } + }) + + this.logger = new Console({ + stdout: this.transform, + inspectOptions: { + colors: !disableColors && !process.env.CI + } + }) + } + + format (pendingInterceptors) { + const withPrettyHeaders = pendingInterceptors.map( + ({ method, path, data: { statusCode }, persist, times, timesInvoked, origin }) => ({ + Method: method, + Origin: origin, + Path: path, + 'Status code': statusCode, + Persistent: persist ? '✅' : '❌', + Invocations: timesInvoked, + Remaining: persist ? Infinity : times - timesInvoked + })) + + this.logger.table(withPrettyHeaders) + return this.transform.read().toString() + } +} + + +/***/ }), + +/***/ 78891: +/***/ ((module) => { + +"use strict"; + + +const singulars = { + pronoun: 'it', + is: 'is', + was: 'was', + this: 'this' +} + +const plurals = { + pronoun: 'they', + is: 'are', + was: 'were', + this: 'these' +} + +module.exports = class Pluralizer { + constructor (singular, plural) { + this.singular = singular + this.plural = plural + } + + pluralize (count) { + const one = count === 1 + const keys = one ? singulars : plurals + const noun = one ? this.singular : this.plural + return { ...keys, count, noun } + } +} + + +/***/ }), + +/***/ 68266: +/***/ ((module) => { + +"use strict"; +/* eslint-disable */ + + + +// Extracted from node/lib/internal/fixed_queue.js + +// Currently optimal queue size, tested on V8 6.0 - 6.6. Must be power of two. +const kSize = 2048; +const kMask = kSize - 1; + +// The FixedQueue is implemented as a singly-linked list of fixed-size +// circular buffers. It looks something like this: +// +// head tail +// | | +// v v +// +-----------+ <-----\ +-----------+ <------\ +-----------+ +// | [null] | \----- | next | \------- | next | +// +-----------+ +-----------+ +-----------+ +// | item | <-- bottom | item | <-- bottom | [empty] | +// | item | | item | | [empty] | +// | item | | item | | [empty] | +// | item | | item | | [empty] | +// | item | | item | bottom --> | item | +// | item | | item | | item | +// | ... | | ... | | ... | +// | item | | item | | item | +// | item | | item | | item | +// | [empty] | <-- top | item | | item | +// | [empty] | | item | | item | +// | [empty] | | [empty] | <-- top top --> | [empty] | +// +-----------+ +-----------+ +-----------+ +// +// Or, if there is only one circular buffer, it looks something +// like either of these: +// +// head tail head tail +// | | | | +// v v v v +// +-----------+ +-----------+ +// | [null] | | [null] | +// +-----------+ +-----------+ +// | [empty] | | item | +// | [empty] | | item | +// | item | <-- bottom top --> | [empty] | +// | item | | [empty] | +// | [empty] | <-- top bottom --> | item | +// | [empty] | | item | +// +-----------+ +-----------+ +// +// Adding a value means moving `top` forward by one, removing means +// moving `bottom` forward by one. After reaching the end, the queue +// wraps around. +// +// When `top === bottom` the current queue is empty and when +// `top + 1 === bottom` it's full. This wastes a single space of storage +// but allows much quicker checks. + +class FixedCircularBuffer { + constructor() { + this.bottom = 0; + this.top = 0; + this.list = new Array(kSize); + this.next = null; + } + + isEmpty() { + return this.top === this.bottom; + } + + isFull() { + return ((this.top + 1) & kMask) === this.bottom; + } + + push(data) { + this.list[this.top] = data; + this.top = (this.top + 1) & kMask; + } + + shift() { + const nextItem = this.list[this.bottom]; + if (nextItem === undefined) + return null; + this.list[this.bottom] = undefined; + this.bottom = (this.bottom + 1) & kMask; + return nextItem; + } +} + +module.exports = class FixedQueue { + constructor() { + this.head = this.tail = new FixedCircularBuffer(); + } + + isEmpty() { + return this.head.isEmpty(); + } + + push(data) { + if (this.head.isFull()) { + // Head is full: Creates a new queue, sets the old queue's `.next` to it, + // and sets it as the new main queue. + this.head = this.head.next = new FixedCircularBuffer(); + } + this.head.push(data); + } + + shift() { + const tail = this.tail; + const next = tail.shift(); + if (tail.isEmpty() && tail.next !== null) { + // If there is another queue, it forms the new tail. + this.tail = tail.next; + } + return next; + } +}; + + +/***/ }), + +/***/ 73198: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const DispatcherBase = __nccwpck_require__(74839) +const FixedQueue = __nccwpck_require__(68266) +const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(72785) +const PoolStats = __nccwpck_require__(39689) + +const kClients = Symbol('clients') +const kNeedDrain = Symbol('needDrain') +const kQueue = Symbol('queue') +const kClosedResolve = Symbol('closed resolve') +const kOnDrain = Symbol('onDrain') +const kOnConnect = Symbol('onConnect') +const kOnDisconnect = Symbol('onDisconnect') +const kOnConnectionError = Symbol('onConnectionError') +const kGetDispatcher = Symbol('get dispatcher') +const kAddClient = Symbol('add client') +const kRemoveClient = Symbol('remove client') +const kStats = Symbol('stats') + +class PoolBase extends DispatcherBase { + constructor () { + super() + + this[kQueue] = new FixedQueue() + this[kClients] = [] + this[kQueued] = 0 + + const pool = this + + this[kOnDrain] = function onDrain (origin, targets) { + const queue = pool[kQueue] + + let needDrain = false + + while (!needDrain) { + const item = queue.shift() + if (!item) { + break } - /** - * 17. If the value of skip end tag is true, then return the value of markup - * and skip the remaining steps. The node is a leaf-node. - */ - if (skipEndTag) - return; - /** - * 18. If ns is the HTML namespace, and the node's localName matches the - * string "template", then this is a template element. Append to markup the - * result of XML serializing a DocumentFragment node given the template - * element's template contents (a DocumentFragment), providing inherited - * ns, map, prefix index, and the require well-formed flag. - * - * _Note:_ This allows template content to round-trip, given the rules for - * parsing XHTML documents. - * - * 19. Otherwise, append to markup the result of running the XML - * serialization algorithm on each of node's children, in tree order, - * providing inherited ns, map, prefix index, and the require well-formed - * flag. - */ - if (isHTML && node.localName === "template") { - // TODO: serialize template contents + pool[kQueued]-- + needDrain = !this.dispatch(item.opts, item.handler) + } + + this[kNeedDrain] = needDrain + + if (!this[kNeedDrain] && pool[kNeedDrain]) { + pool[kNeedDrain] = false + pool.emit('drain', origin, [pool, ...targets]) + } + + if (pool[kClosedResolve] && queue.isEmpty()) { + Promise + .all(pool[kClients].map(c => c.close())) + .then(pool[kClosedResolve]) + } + } + + this[kOnConnect] = (origin, targets) => { + pool.emit('connect', origin, [pool, ...targets]) + } + + this[kOnDisconnect] = (origin, targets, err) => { + pool.emit('disconnect', origin, [pool, ...targets], err) + } + + this[kOnConnectionError] = (origin, targets, err) => { + pool.emit('connectionError', origin, [pool, ...targets], err) + } + + this[kStats] = new PoolStats(this) + } + + get [kBusy] () { + return this[kNeedDrain] + } + + get [kConnected] () { + return this[kClients].filter(client => client[kConnected]).length + } + + get [kFree] () { + return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length + } + + get [kPending] () { + let ret = this[kQueued] + for (const { [kPending]: pending } of this[kClients]) { + ret += pending + } + return ret + } + + get [kRunning] () { + let ret = 0 + for (const { [kRunning]: running } of this[kClients]) { + ret += running + } + return ret + } + + get [kSize] () { + let ret = this[kQueued] + for (const { [kSize]: size } of this[kClients]) { + ret += size + } + return ret + } + + get stats () { + return this[kStats] + } + + async [kClose] () { + if (this[kQueue].isEmpty()) { + return Promise.all(this[kClients].map(c => c.close())) + } else { + return new Promise((resolve) => { + this[kClosedResolve] = resolve + }) + } + } + + async [kDestroy] (err) { + while (true) { + const item = this[kQueue].shift() + if (!item) { + break + } + item.handler.onError(err) + } + + return Promise.all(this[kClients].map(c => c.destroy(err))) + } + + [kDispatch] (opts, handler) { + const dispatcher = this[kGetDispatcher]() + + if (!dispatcher) { + this[kNeedDrain] = true + this[kQueue].push({ opts, handler }) + this[kQueued]++ + } else if (!dispatcher.dispatch(opts, handler)) { + dispatcher[kNeedDrain] = true + this[kNeedDrain] = !this[kGetDispatcher]() + } + + return !this[kNeedDrain] + } + + [kAddClient] (client) { + client + .on('drain', this[kOnDrain]) + .on('connect', this[kOnConnect]) + .on('disconnect', this[kOnDisconnect]) + .on('connectionError', this[kOnConnectionError]) + + this[kClients].push(client) + + if (this[kNeedDrain]) { + process.nextTick(() => { + if (this[kNeedDrain]) { + this[kOnDrain](client[kUrl], [this, client]) } - else { - try { - for (var _b = __values(node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - this.level++; - this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed, noDoubleEncoding); - this.level--; - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_2) throw e_2.error; } + }) + } + + return this + } + + [kRemoveClient] (client) { + client.close(() => { + const idx = this[kClients].indexOf(client) + if (idx !== -1) { + this[kClients].splice(idx, 1) + } + }) + + this[kNeedDrain] = this[kClients].some(dispatcher => ( + !dispatcher[kNeedDrain] && + dispatcher.closed !== true && + dispatcher.destroyed !== true + )) + } +} + +module.exports = { + PoolBase, + kClients, + kNeedDrain, + kAddClient, + kRemoveClient, + kGetDispatcher +} + + +/***/ }), + +/***/ 39689: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(72785) +const kPool = Symbol('pool') + +class PoolStats { + constructor (pool) { + this[kPool] = pool + } + + get connected () { + return this[kPool][kConnected] + } + + get free () { + return this[kPool][kFree] + } + + get pending () { + return this[kPool][kPending] + } + + get queued () { + return this[kPool][kQueued] + } + + get running () { + return this[kPool][kRunning] + } + + get size () { + return this[kPool][kSize] + } +} + +module.exports = PoolStats + + +/***/ }), + +/***/ 4634: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { + PoolBase, + kClients, + kNeedDrain, + kAddClient, + kGetDispatcher +} = __nccwpck_require__(73198) +const Client = __nccwpck_require__(33598) +const { + InvalidArgumentError +} = __nccwpck_require__(48045) +const util = __nccwpck_require__(83983) +const { kUrl, kInterceptors } = __nccwpck_require__(72785) +const buildConnector = __nccwpck_require__(82067) + +const kOptions = Symbol('options') +const kConnections = Symbol('connections') +const kFactory = Symbol('factory') + +function defaultFactory (origin, opts) { + return new Client(origin, opts) +} + +class Pool extends PoolBase { + constructor (origin, { + connections, + factory = defaultFactory, + connect, + connectTimeout, + tls, + maxCachedSessions, + socketPath, + autoSelectFamily, + autoSelectFamilyAttemptTimeout, + allowH2, + ...options + } = {}) { + super() + + if (connections != null && (!Number.isFinite(connections) || connections < 0)) { + throw new InvalidArgumentError('invalid connections') + } + + if (typeof factory !== 'function') { + throw new InvalidArgumentError('factory must be a function.') + } + + if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') { + throw new InvalidArgumentError('connect must be a function or an object') + } + + if (typeof connect !== 'function') { + connect = buildConnector({ + ...tls, + maxCachedSessions, + allowH2, + socketPath, + timeout: connectTimeout, + ...(util.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined), + ...connect + }) + } + + this[kInterceptors] = options.interceptors && options.interceptors.Pool && Array.isArray(options.interceptors.Pool) + ? options.interceptors.Pool + : [] + this[kConnections] = connections || null + this[kUrl] = util.parseOrigin(origin) + this[kOptions] = { ...util.deepClone(options), connect, allowH2 } + this[kOptions].interceptors = options.interceptors + ? { ...options.interceptors } + : undefined + this[kFactory] = factory + + this.on('connectionError', (origin, targets, error) => { + // If a connection error occurs, we remove the client from the pool, + // and emit a connectionError event. They will not be re-used. + // Fixes https://github.com/nodejs/undici/issues/3895 + for (const target of targets) { + // Do not use kRemoveClient here, as it will close the client, + // but the client cannot be closed in this state. + const idx = this[kClients].indexOf(target) + if (idx !== -1) { + this[kClients].splice(idx, 1) + } + } + }) + } + + [kGetDispatcher] () { + let dispatcher = this[kClients].find(dispatcher => !dispatcher[kNeedDrain]) + + if (dispatcher) { + return dispatcher + } + + if (!this[kConnections] || this[kClients].length < this[kConnections]) { + dispatcher = this[kFactory](this[kUrl], this[kOptions]) + this[kAddClient](dispatcher) + } + + return dispatcher + } +} + +module.exports = Pool + + +/***/ }), + +/***/ 97858: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const { kProxy, kClose, kDestroy, kInterceptors } = __nccwpck_require__(72785) +const { URL } = __nccwpck_require__(57310) +const Agent = __nccwpck_require__(7890) +const Pool = __nccwpck_require__(4634) +const DispatcherBase = __nccwpck_require__(74839) +const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(48045) +const buildConnector = __nccwpck_require__(82067) + +const kAgent = Symbol('proxy agent') +const kClient = Symbol('proxy client') +const kProxyHeaders = Symbol('proxy headers') +const kRequestTls = Symbol('request tls settings') +const kProxyTls = Symbol('proxy tls settings') +const kConnectEndpoint = Symbol('connect endpoint function') + +function defaultProtocolPort (protocol) { + return protocol === 'https:' ? 443 : 80 +} + +function buildProxyOptions (opts) { + if (typeof opts === 'string') { + opts = { uri: opts } + } + + if (!opts || !opts.uri) { + throw new InvalidArgumentError('Proxy opts.uri is mandatory') + } + + return { + uri: opts.uri, + protocol: opts.protocol || 'https' + } +} + +function defaultFactory (origin, opts) { + return new Pool(origin, opts) +} + +class ProxyAgent extends DispatcherBase { + constructor (opts) { + super(opts) + this[kProxy] = buildProxyOptions(opts) + this[kAgent] = new Agent(opts) + this[kInterceptors] = opts.interceptors && opts.interceptors.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent) + ? opts.interceptors.ProxyAgent + : [] + + if (typeof opts === 'string') { + opts = { uri: opts } + } + + if (!opts || !opts.uri) { + throw new InvalidArgumentError('Proxy opts.uri is mandatory') + } + + const { clientFactory = defaultFactory } = opts + + if (typeof clientFactory !== 'function') { + throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.') + } + + this[kRequestTls] = opts.requestTls + this[kProxyTls] = opts.proxyTls + this[kProxyHeaders] = opts.headers || {} + + const resolvedUrl = new URL(opts.uri) + const { origin, port, host, username, password } = resolvedUrl + + if (opts.auth && opts.token) { + throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token') + } else if (opts.auth) { + /* @deprecated in favour of opts.token */ + this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}` + } else if (opts.token) { + this[kProxyHeaders]['proxy-authorization'] = opts.token + } else if (username && password) { + this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}` + } + + const connect = buildConnector({ ...opts.proxyTls }) + this[kConnectEndpoint] = buildConnector({ ...opts.requestTls }) + this[kClient] = clientFactory(resolvedUrl, { connect }) + this[kAgent] = new Agent({ + ...opts, + connect: async (opts, callback) => { + let requestedHost = opts.host + if (!opts.port) { + requestedHost += `:${defaultProtocolPort(opts.protocol)}` + } + try { + const { socket, statusCode } = await this[kClient].connect({ + origin, + port, + path: requestedHost, + signal: opts.signal, + headers: { + ...this[kProxyHeaders], + host } + }) + if (statusCode !== 200) { + socket.on('error', () => {}).destroy() + callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`)) + } + if (opts.protocol !== 'https:') { + callback(null, socket) + return + } + let servername + if (this[kRequestTls]) { + servername = this[kRequestTls].servername + } else { + servername = opts.servername + } + this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback) + } catch (err) { + callback(err) } - /** - * 20. Append the following to markup, in the order listed: - * 20.1. "" (U+003E GREATER-THAN SIGN). - * 21. Return the value of markup. - */ - this.closeTag(qualifiedName); - this.endElement(qualifiedName); - }; - /** - * Produces an XML serialization of an element node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeElement = function (node, requireWellFormed, noDoubleEncoding) { - var e_3, _a; - /** - * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node - * - * 1. If the require well-formed flag is set (its value is true), and this - * node's localName attribute contains the character ":" (U+003A COLON) or - * does not match the XML Name production, then throw an exception; the - * serialization of this node would not be a well-formed element. - */ - if (requireWellFormed && (node.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(node.localName))) { - throw new Error("Node local name contains invalid characters (well-formed required)."); + } + }) + } + + dispatch (opts, handler) { + const { host } = new URL(opts.origin) + const headers = buildHeaders(opts.headers) + throwIfProxyAuthIsSent(headers) + return this[kAgent].dispatch( + { + ...opts, + headers: { + ...headers, + host } - /** - * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). - * 3. Let qualified name be an empty string. - * 4. Let skip end tag be a boolean flag with value false. - * 5. Let ignore namespace definition attribute be a boolean flag with value - * false. - * 6. Given prefix map, copy a namespace prefix map and let map be the - * result. - * 7. Let local prefixes map be an empty map. The map has unique Node prefix - * strings as its keys, with corresponding namespaceURI Node values as the - * map's key values (in this map, the null namespace is represented by the - * empty string). - * - * _Note:_ This map is local to each element. It is used to ensure there - * are no conflicting prefixes should a new namespace prefix attribute need - * to be generated. It is also used to enable skipping of duplicate prefix - * definitions when writing an element's attributes: the map allows the - * algorithm to distinguish between a prefix in the namespace prefix map - * that might be locally-defined (to the current Element) and one that is - * not. - * 8. Let local default namespace be the result of recording the namespace - * information for node given map and local prefixes map. - * - * _Note:_ The above step will update map with any found namespace prefix - * definitions, add the found prefix definitions to the local prefixes map - * and return a local default namespace value defined by a default namespace - * attribute if one exists. Otherwise it returns null. - * 9. Let inherited ns be a copy of namespace. - * 10. Let ns be the value of node's namespaceURI attribute. - */ - var skipEndTag = false; - /** 11. If inherited ns is equal to ns, then: */ - /** - * 11.1. If local default namespace is not null, then set ignore - * namespace definition attribute to true. - */ - /** - * 11.2. If ns is the XML namespace, then append to qualified name the - * concatenation of the string "xml:" and the value of node's localName. - * 11.3. Otherwise, append to qualified name the value of node's - * localName. The node's prefix if it exists, is dropped. - */ - var qualifiedName = node.localName; - /** 11.4. Append the value of qualified name to markup. */ - this.beginElement(qualifiedName); - this.openTagBegin(qualifiedName); - /** - * 13. Append to markup the result of the XML serialization of node's - * attributes given map, prefix index, local prefixes map, ignore namespace - * definition attribute flag, and require well-formed flag. - */ - var attributes = this._serializeAttributes(node, requireWellFormed, noDoubleEncoding); - this.attributes(attributes); - /** - * 14. If ns is the HTML namespace, and the node's list of children is - * empty, and the node's localName matches any one of the following void - * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", - * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", - * "param", "source", "track", "wbr"; then append the following to markup, - * in the order listed: - * 14.1. " " (U+0020 SPACE); - * 14.2. "/" (U+002F SOLIDUS). - * and set the skip end tag flag to true. - * 15. If ns is not the HTML namespace, and the node's list of children is - * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end - * tag flag to true. - * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. - */ - if (!node.hasChildNodes()) { - this.openTagEnd(qualifiedName, true, false); - this.endElement(qualifiedName); - skipEndTag = true; - } - else { - this.openTagEnd(qualifiedName, false, false); - } - /** - * 17. If the value of skip end tag is true, then return the value of markup - * and skip the remaining steps. The node is a leaf-node. - */ - if (skipEndTag) - return; - try { - /** - * 18. If ns is the HTML namespace, and the node's localName matches the - * string "template", then this is a template element. Append to markup the - * result of XML serializing a DocumentFragment node given the template - * element's template contents (a DocumentFragment), providing inherited - * ns, map, prefix index, and the require well-formed flag. - * - * _Note:_ This allows template content to round-trip, given the rules for - * parsing XHTML documents. - * - * 19. Otherwise, append to markup the result of running the XML - * serialization algorithm on each of node's children, in tree order, - * providing inherited ns, map, prefix index, and the require well-formed - * flag. - */ - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - this.level++; - this._serializeNode(childNode, requireWellFormed, noDoubleEncoding); - this.level--; - } - } - catch (e_3_1) { e_3 = { error: e_3_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_3) throw e_3.error; } - } - /** - * 20. Append the following to markup, in the order listed: - * 20.1. "" (U+003E GREATER-THAN SIGN). - * 21. Return the value of markup. - */ - this.closeTag(qualifiedName); - this.endElement(qualifiedName); - }; - /** - * Produces an XML serialization of a document node. - * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeDocumentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding) { - var e_4, _a; - /** - * If the require well-formed flag is set (its value is true), and this node - * has no documentElement (the documentElement attribute's value is null), - * then throw an exception; the serialization of this node would not be a - * well-formed document. - */ - if (requireWellFormed && node.documentElement === null) { - throw new Error("Missing document element (well-formed required)."); - } - try { - /** - * Otherwise, run the following steps: - * 1. Let serialized document be an empty string. - * 2. For each child child of node, in tree order, run the XML - * serialization algorithm on the child passing along the provided - * arguments, and append the result to serialized document. - * - * _Note:_ This will serialize any number of ProcessingInstruction and - * Comment nodes both before and after the Document's documentElement node, - * including at most one DocumentType node. (Text nodes are not allowed as - * children of the Document.) - * - * 3. Return the value of serialized document. - */ - for (var _b = __values(node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding); - } - } - catch (e_4_1) { e_4 = { error: e_4_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_4) throw e_4.error; } - } - }; - /** - * Produces an XML serialization of a document node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeDocument = function (node, requireWellFormed, noDoubleEncoding) { - var e_5, _a; - /** - * If the require well-formed flag is set (its value is true), and this node - * has no documentElement (the documentElement attribute's value is null), - * then throw an exception; the serialization of this node would not be a - * well-formed document. - */ - if (requireWellFormed && node.documentElement === null) { - throw new Error("Missing document element (well-formed required)."); - } - try { - /** - * Otherwise, run the following steps: - * 1. Let serialized document be an empty string. - * 2. For each child child of node, in tree order, run the XML - * serialization algorithm on the child passing along the provided - * arguments, and append the result to serialized document. - * - * _Note:_ This will serialize any number of ProcessingInstruction and - * Comment nodes both before and after the Document's documentElement node, - * including at most one DocumentType node. (Text nodes are not allowed as - * children of the Document.) - * - * 3. Return the value of serialized document. - */ - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - this._serializeNode(childNode, requireWellFormed, noDoubleEncoding); - } - } - catch (e_5_1) { e_5 = { error: e_5_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_5) throw e_5.error; } - } - }; - /** - * Produces an XML serialization of a comment node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeComment = function (node, requireWellFormed, noDoubleEncoding) { - /** - * If the require well-formed flag is set (its value is true), and node's - * data contains characters that are not matched by the XML Char production - * or contains "--" (two adjacent U+002D HYPHEN-MINUS characters) or that - * ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception; - * the serialization of this node's data would not be well-formed. - */ - if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || - node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) { - throw new Error("Comment data contains invalid characters (well-formed required)."); - } - /** - * Otherwise, return the concatenation of "". - */ - this.comment(node.data); - }; - /** - * Produces an XML serialization of a text node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - * @param level - current depth of the XML tree - */ - BaseWriter.prototype._serializeText = function (node, requireWellFormed, noDoubleEncoding) { - /** - * 1. If the require well-formed flag is set (its value is true), and - * node's data contains characters that are not matched by the XML Char - * production, then throw an exception; the serialization of this node's - * data would not be well-formed. - */ - if (requireWellFormed && !algorithm_1.xml_isLegalChar(node.data)) { - throw new Error("Text data contains invalid characters (well-formed required)."); - } - /** - * 2. Let markup be the value of node's data. - * 3. Replace any occurrences of "&" in markup by "&". - * 4. Replace any occurrences of "<" in markup by "<". - * 5. Replace any occurrences of ">" in markup by ">". - * 6. Return the value of markup. - */ - var markup = ""; - if (noDoubleEncoding) { - markup = node.data.replace(/(?!&(lt|gt|amp|apos|quot);)&/g, '&') - .replace(//g, '>'); - } - else { - for (var i = 0; i < node.data.length; i++) { - var c = node.data[i]; - if (c === "&") - markup += "&"; - else if (c === "<") - markup += "<"; - else if (c === ">") - markup += ">"; - else - markup += c; - } - } - this.text(markup); - }; - /** - * Produces an XML serialization of a document fragment node. - * - * @param node - node to serialize - * @param namespace - context namespace - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeDocumentFragmentNS = function (node, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding) { - var e_6, _a; - try { - /** - * 1. Let markup the empty string. - * 2. For each child child of node, in tree order, run the XML serialization - * algorithm on the child given namespace, prefix map, a reference to prefix - * index, and flag require well-formed. Concatenate the result to markup. - * 3. Return the value of markup. - */ - for (var _b = __values(node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed, noDoubleEncoding); - } - } - catch (e_6_1) { e_6 = { error: e_6_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_6) throw e_6.error; } - } - }; - /** - * Produces an XML serialization of a document fragment node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeDocumentFragment = function (node, requireWellFormed, noDoubleEncoding) { - var e_7, _a; - try { - /** - * 1. Let markup the empty string. - * 2. For each child child of node, in tree order, run the XML serialization - * algorithm on the child given namespace, prefix map, a reference to prefix - * index, and flag require well-formed. Concatenate the result to markup. - * 3. Return the value of markup. - */ - for (var _b = __values(node._children), _c = _b.next(); !_c.done; _c = _b.next()) { - var childNode = _c.value; - this._serializeNode(childNode, requireWellFormed, noDoubleEncoding); - } - } - catch (e_7_1) { e_7 = { error: e_7_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_7) throw e_7.error; } - } - }; - /** - * Produces an XML serialization of a document type node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeDocumentType = function (node, requireWellFormed, noDoubleEncoding) { - /** - * 1. If the require well-formed flag is true and the node's publicId - * attribute contains characters that are not matched by the XML PubidChar - * production, then throw an exception; the serialization of this node - * would not be a well-formed document type declaration. - */ - if (requireWellFormed && !algorithm_1.xml_isPubidChar(node.publicId)) { - throw new Error("DocType public identifier does not match PubidChar construct (well-formed required)."); - } - /** - * 2. If the require well-formed flag is true and the node's systemId - * attribute contains characters that are not matched by the XML Char - * production or that contains both a """ (U+0022 QUOTATION MARK) and a - * "'" (U+0027 APOSTROPHE), then throw an exception; the serialization - * of this node would not be a well-formed document type declaration. - */ - if (requireWellFormed && - (!algorithm_1.xml_isLegalChar(node.systemId) || - (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { - throw new Error("DocType system identifier contains invalid characters (well-formed required)."); - } - /** - * 3. Let markup be an empty string. - * 4. Append the string "" (U+003E GREATER-THAN SIGN) to markup. - * 11. Return the value of markup. - */ - this.docType(node.name, node.publicId, node.systemId); - }; - /** - * Produces an XML serialization of a processing instruction node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeProcessingInstruction = function (node, requireWellFormed, noDoubleEncoding) { - /** - * 1. If the require well-formed flag is set (its value is true), and node's - * target contains a ":" (U+003A COLON) character or is an ASCII - * case-insensitive match for the string "xml", then throw an exception; - * the serialization of this node's target would not be well-formed. - */ - if (requireWellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) { - throw new Error("Processing instruction target contains invalid characters (well-formed required)."); - } - /** - * 2. If the require well-formed flag is set (its value is true), and node's - * data contains characters that are not matched by the XML Char production - * or contains the string "?>" (U+003F QUESTION MARK, - * U+003E GREATER-THAN SIGN), then throw an exception; the serialization of - * this node's data would not be well-formed. - */ - if (requireWellFormed && (!algorithm_1.xml_isLegalChar(node.data) || - node.data.indexOf("?>") !== -1)) { - throw new Error("Processing instruction data contains invalid characters (well-formed required)."); - } - /** - * 3. Let markup be the concatenation of the following, in the order listed: - * 3.1. "" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN). - * 4. Return the value of markup. - */ - this.instruction(node.target, node.data); - }; - /** - * Produces an XML serialization of a CDATA node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeCData = function (node, requireWellFormed, noDoubleEncoding) { - if (requireWellFormed && (node.data.indexOf("]]>") !== -1)) { - throw new Error("CDATA contains invalid characters (well-formed required)."); - } - this.cdata(node.data); - }; - /** - * Produces an XML serialization of the attributes of an element node. - * - * @param node - node to serialize - * @param map - namespace prefix map - * @param prefixIndex - generated namespace prefix index - * @param localPrefixesMap - local prefixes map - * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace - * attributes - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeAttributesNS = function (node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed, noDoubleEncoding) { - var e_8, _a; - /** - * 1. Let result be the empty string. - * 2. Let localname set be a new empty namespace localname set. This - * localname set will contain tuples of unique attribute namespaceURI and - * localName pairs, and is populated as each attr is processed. This set is - * used to [optionally] enforce the well-formed constraint that an element - * cannot have two attributes with the same namespaceURI and localName. - * This can occur when two otherwise identical attributes on the same - * element differ only by their prefix values. - */ - var result = []; - var localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; - try { - /** - * 3. Loop: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: - */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - // Optimize common case - if (!requireWellFormed && !ignoreNamespaceDefinitionAttribute && attr.namespaceURI === null) { - result.push([null, null, attr.localName, - this._serializeAttributeValue(attr.value, requireWellFormed, noDoubleEncoding)]); - continue; - } - /** - * 3.1. If the require well-formed flag is set (its value is true), and the - * localname set contains a tuple whose values match those of a new tuple - * consisting of attr's namespaceURI attribute and localName attribute, - * then throw an exception; the serialization of this attr would fail to - * produce a well-formed element serialization. - */ - if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { - throw new Error("Element contains duplicate attributes (well-formed required)."); - } - /** - * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and - * localName attribute, and add it to the localname set. - * 3.3. Let attribute namespace be the value of attr's namespaceURI value. - * 3.4. Let candidate prefix be null. - */ - if (requireWellFormed && localNameSet) - localNameSet.set(attr.namespaceURI, attr.localName); - var attributeNamespace = attr.namespaceURI; - var candidatePrefix = null; - /** 3.5. If attribute namespace is not null, then run these sub-steps: */ - if (attributeNamespace !== null) { - /** - * 3.5.1. Let candidate prefix be the result of retrieving a preferred - * prefix string from map given namespace attribute namespace with - * preferred prefix being attr's prefix value. - */ - candidatePrefix = map.get(attr.prefix, attributeNamespace); - /** - * 3.5.2. If the value of attribute namespace is the XMLNS namespace, - * then run these steps: - */ - if (attributeNamespace === infra_1.namespace.XMLNS) { - /** - * 3.5.2.1. If any of the following are true, then stop running these - * steps and goto Loop to visit the next attribute: - * - the attr's value is the XML namespace; - * _Note:_ The XML namespace cannot be redeclared and survive - * round-tripping (unless it defines the prefix "xml"). To avoid this - * problem, this algorithm always prefixes elements in the XML - * namespace with "xml" and drops any related definitions as seen - * in the above condition. - * - the attr's prefix is null and the ignore namespace definition - * attribute flag is true (the Element's default namespace attribute - * should be skipped); - * - the attr's prefix is not null and either - * * the attr's localName is not a key contained in the local - * prefixes map, or - * * the attr's localName is present in the local prefixes map but - * the value of the key does not match attr's value - * and furthermore that the attr's localName (as the prefix to find) - * is found in the namespace prefix map given the namespace consisting - * of the attr's value (the current namespace prefix definition was - * exactly defined previously--on an ancestor element not the current - * element whose attributes are being processed). - */ - if (attr.value === infra_1.namespace.XML || - (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || - (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || - localPrefixesMap[attr.localName] !== attr.value) && - map.has(attr.localName, attr.value))) - continue; - /** - * 3.5.2.2. If the require well-formed flag is set (its value is true), - * and the value of attr's value attribute matches the XMLNS - * namespace, then throw an exception; the serialization of this - * attribute would produce invalid XML because the XMLNS namespace - * is reserved and cannot be applied as an element's namespace via - * XML parsing. - * - * _Note:_ DOM APIs do allow creation of elements in the XMLNS - * namespace but with strict qualifications. - */ - if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { - throw new Error("XMLNS namespace is reserved (well-formed required)."); - } - /** - * 3.5.2.3. If the require well-formed flag is set (its value is true), - * and the value of attr's value attribute is the empty string, then - * throw an exception; namespace prefix declarations cannot be used - * to undeclare a namespace (use a default namespace declaration - * instead). - */ - if (requireWellFormed && attr.value === '') { - throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."); - } - /** - * 3.5.2.4. the attr's prefix matches the string "xmlns", then let - * candidate prefix be the string "xmlns". - */ - if (attr.prefix === 'xmlns') - candidatePrefix = 'xmlns'; - /** - * 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace. - * Run these steps: - * - * _Note:_ The (candidatePrefix === null) check is not in the spec. - * We deviate from the spec here. Otherwise a prefix is generated for - * all attributes with namespaces. - */ - } - else if (candidatePrefix === null) { - if (attr.prefix !== null && - (!map.hasPrefix(attr.prefix) || - map.has(attr.prefix, attributeNamespace))) { - /** - * Check if we can use the attribute's own prefix. - * We deviate from the spec here. - * TODO: This is not an efficient way of searching for prefixes. - * Follow developments to the spec. - */ - candidatePrefix = attr.prefix; - } - else { - /** - * 3.5.3.1. Let candidate prefix be the result of generating a prefix - * providing map, attribute namespace, and prefix index as input. - */ - candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); - } - /** - * 3.5.3.2. Append the following to result, in the order listed: - * 3.5.3.2.1. " " (U+0020 SPACE); - * 3.5.3.2.2. The string "xmlns:"; - * 3.5.3.2.3. The value of candidate prefix; - * 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.5.3.2.5. The result of serializing an attribute value given - * attribute namespace and the require well-formed flag as input; - * 3.5.3.2.6. """ (U+0022 QUOTATION MARK). - */ - result.push([null, "xmlns", candidatePrefix, - this._serializeAttributeValue(attributeNamespace, requireWellFormed, noDoubleEncoding)]); - } - } - /** - * 3.6. Append a " " (U+0020 SPACE) to result. - * 3.7. If candidate prefix is not null, then append to result the - * concatenation of candidate prefix with ":" (U+003A COLON). - */ - var attrName = ''; - if (candidatePrefix !== null) { - attrName = candidatePrefix; - } - /** - * 3.8. If the require well-formed flag is set (its value is true), and - * this attr's localName attribute contains the character - * ":" (U+003A COLON) or does not match the XML Name production or - * equals "xmlns" and attribute namespace is null, then throw an - * exception; the serialization of this attr would not be a - * well-formed attribute. - */ - if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(attr.localName) || - (attr.localName === "xmlns" && attributeNamespace === null))) { - throw new Error("Attribute local name contains invalid characters (well-formed required)."); - } - /** - * 3.9. Append the following strings to result, in the order listed: - * 3.9.1. The value of attr's localName; - * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.9.3. The result of serializing an attribute value given attr's value - * attribute and the require well-formed flag as input; - * 3.9.4. """ (U+0022 QUOTATION MARK). - */ - result.push([attributeNamespace, candidatePrefix, attr.localName, - this._serializeAttributeValue(attr.value, requireWellFormed, noDoubleEncoding)]); - } - } - catch (e_8_1) { e_8 = { error: e_8_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_8) throw e_8.error; } - } - /** - * 4. Return the value of result. - */ - return result; - }; - /** - * Produces an XML serialization of the attributes of an element node. - * - * @param node - node to serialize - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeAttributes = function (node, requireWellFormed, noDoubleEncoding) { - var e_9, _a; - /** - * 1. Let result be the empty string. - * 2. Let localname set be a new empty namespace localname set. This - * localname set will contain tuples of unique attribute namespaceURI and - * localName pairs, and is populated as each attr is processed. This set is - * used to [optionally] enforce the well-formed constraint that an element - * cannot have two attributes with the same namespaceURI and localName. - * This can occur when two otherwise identical attributes on the same - * element differ only by their prefix values. - */ - var result = []; - var localNameSet = requireWellFormed ? {} : undefined; - try { - /** - * 3. Loop: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: - */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - // Optimize common case - if (!requireWellFormed) { - result.push([null, null, attr.localName, - this._serializeAttributeValue(attr.value, requireWellFormed, noDoubleEncoding)]); - continue; - } - /** - * 3.1. If the require well-formed flag is set (its value is true), and the - * localname set contains a tuple whose values match those of a new tuple - * consisting of attr's namespaceURI attribute and localName attribute, - * then throw an exception; the serialization of this attr would fail to - * produce a well-formed element serialization. - */ - if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) { - throw new Error("Element contains duplicate attributes (well-formed required)."); - } - /** - * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and - * localName attribute, and add it to the localname set. - * 3.3. Let attribute namespace be the value of attr's namespaceURI value. - * 3.4. Let candidate prefix be null. - */ - /* istanbul ignore else */ - if (requireWellFormed && localNameSet) - localNameSet[attr.localName] = true; - /** 3.5. If attribute namespace is not null, then run these sub-steps: */ - /** - * 3.6. Append a " " (U+0020 SPACE) to result. - * 3.7. If candidate prefix is not null, then append to result the - * concatenation of candidate prefix with ":" (U+003A COLON). - */ - /** - * 3.8. If the require well-formed flag is set (its value is true), and - * this attr's localName attribute contains the character - * ":" (U+003A COLON) or does not match the XML Name production or - * equals "xmlns" and attribute namespace is null, then throw an - * exception; the serialization of this attr would not be a - * well-formed attribute. - */ - if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || - !algorithm_1.xml_isName(attr.localName))) { - throw new Error("Attribute local name contains invalid characters (well-formed required)."); - } - /** - * 3.9. Append the following strings to result, in the order listed: - * 3.9.1. The value of attr's localName; - * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); - * 3.9.3. The result of serializing an attribute value given attr's value - * attribute and the require well-formed flag as input; - * 3.9.4. """ (U+0022 QUOTATION MARK). - */ - result.push([null, null, attr.localName, - this._serializeAttributeValue(attr.value, requireWellFormed, noDoubleEncoding)]); - } - } - catch (e_9_1) { e_9 = { error: e_9_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_9) throw e_9.error; } - } - /** - * 4. Return the value of result. - */ - return result; - }; - /** - * Records namespace information for the given element and returns the - * default namespace attribute value. - * - * @param node - element node to process - * @param map - namespace prefix map - * @param localPrefixesMap - local prefixes map - */ - BaseWriter.prototype._recordNamespaceInformation = function (node, map, localPrefixesMap) { - var e_10, _a; - /** - * 1. Let default namespace attr value be null. - */ - var defaultNamespaceAttrValue = null; - try { - /** - * 2. Main: For each attribute attr in element's attributes, in the order - * they are specified in the element's attribute list: - */ - for (var _b = __values(node.attributes), _c = _b.next(); !_c.done; _c = _b.next()) { - var attr = _c.value; - /** - * _Note:_ The following conditional steps find namespace prefixes. Only - * attributes in the XMLNS namespace are considered (e.g., attributes made - * to look like namespace declarations via - * setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not - * included). - */ - /** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */ - var attributeNamespace = attr.namespaceURI; - /** 2.2. Let attribute prefix be the value of attr's prefix. */ - var attributePrefix = attr.prefix; - /** 2.3. If the attribute namespace is the XMLNS namespace, then: */ - if (attributeNamespace === infra_1.namespace.XMLNS) { - /** - * 2.3.1. If attribute prefix is null, then attr is a default namespace - * declaration. Set the default namespace attr value to attr's value and - * stop running these steps, returning to Main to visit the next - * attribute. - */ - if (attributePrefix === null) { - defaultNamespaceAttrValue = attr.value; - continue; - /** - * 2.3.2. Otherwise, the attribute prefix is not null and attr is a - * namespace prefix definition. Run the following steps: - */ - } - else { - /** 2.3.2.1. Let prefix definition be the value of attr's localName. */ - var prefixDefinition = attr.localName; - /** 2.3.2.2. Let namespace definition be the value of attr's value. */ - var namespaceDefinition = attr.value; - /** - * 2.3.2.3. If namespace definition is the XML namespace, then stop - * running these steps, and return to Main to visit the next - * attribute. - * - * _Note:_ XML namespace definitions in prefixes are completely - * ignored (in order to avoid unnecessary work when there might be - * prefix conflicts). XML namespaced elements are always handled - * uniformly by prefixing (and overriding if necessary) the element's - * localname with the reserved "xml" prefix. - */ - if (namespaceDefinition === infra_1.namespace.XML) { - continue; - } - /** - * 2.3.2.4. If namespace definition is the empty string (the - * declarative form of having no namespace), then let namespace - * definition be null instead. - */ - if (namespaceDefinition === '') { - namespaceDefinition = null; - } - /** - * 2.3.2.5. If prefix definition is found in map given the namespace - * namespace definition, then stop running these steps, and return to - * Main to visit the next attribute. - * - * _Note:_ This step avoids adding duplicate prefix definitions for - * the same namespace in the map. This has the side-effect of avoiding - * later serialization of duplicate namespace prefix declarations in - * any descendant nodes. - */ - if (map.has(prefixDefinition, namespaceDefinition)) { - continue; - } - /** - * 2.3.2.6. Add the prefix prefix definition to map given namespace - * namespace definition. - */ - map.set(prefixDefinition, namespaceDefinition); - /** - * 2.3.2.7. Add the value of prefix definition as a new key to the - * local prefixes map, with the namespace definition as the key's - * value replacing the value of null with the empty string if - * applicable. - */ - localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; - } - } - } - } - catch (e_10_1) { e_10 = { error: e_10_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_10) throw e_10.error; } - } - /** - * 3. Return the value of default namespace attr value. - * - * _Note:_ The empty string is a legitimate return value and is not - * converted to null. - */ - return defaultNamespaceAttrValue; - }; - /** - * Generates a new prefix for the given namespace. - * - * @param newNamespace - a namespace to generate prefix for - * @param prefixMap - namespace prefix map - * @param prefixIndex - generated namespace prefix index - */ - BaseWriter.prototype._generatePrefix = function (newNamespace, prefixMap, prefixIndex) { - /** - * 1. Let generated prefix be the concatenation of the string "ns" and the - * current numerical value of prefix index. - * 2. Let the value of prefix index be incremented by one. - * 3. Add to map the generated prefix given the new namespace namespace. - * 4. Return the value of generated prefix. - */ - var generatedPrefix = "ns" + prefixIndex.value.toString(); - prefixIndex.value++; - prefixMap.set(generatedPrefix, newNamespace); - return generatedPrefix; - }; - /** - * Produces an XML serialization of an attribute value. - * - * @param value - attribute value - * @param requireWellFormed - whether to check conformance - */ - BaseWriter.prototype._serializeAttributeValue = function (value, requireWellFormed, noDoubleEncoding) { - /** - * From: https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value - * - * 1. If the require well-formed flag is set (its value is true), and - * attribute value contains characters that are not matched by the XML Char - * production, then throw an exception; the serialization of this attribute - * value would fail to produce a well-formed element serialization. - */ - if (requireWellFormed && value !== null && !algorithm_1.xml_isLegalChar(value)) { - throw new Error("Invalid characters in attribute value."); - } - /** - * 2. If attribute value is null, then return the empty string. - */ - if (value === null) - return ""; - /** - * 3. Otherwise, attribute value is a string. Return the value of attribute - * value, first replacing any occurrences of the following: - * - "&" with "&" - * - """ with """ - * - "<" with "<" - * - ">" with ">" - * NOTE - * This matches behavior present in browsers, and goes above and beyond the - * grammar requirement in the XML specification's AttValue production by - * also replacing ">" characters. - */ - if (noDoubleEncoding) { - return value.replace(/(?!&(lt|gt|amp|apos|quot);)&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); - } - else { - var result = ""; - for (var i = 0; i < value.length; i++) { - var c = value[i]; - if (c === "\"") - result += """; - else if (c === "&") - result += "&"; - else if (c === "<") - result += "<"; - else if (c === ">") - result += ">"; - else - result += c; - } - return result; - } - }; - BaseWriter._VoidElementNames = new Set(['area', 'base', 'basefont', - 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', - 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); - return BaseWriter; -}()); -exports.BaseWriter = BaseWriter; -//# sourceMappingURL=BaseWriter.js.map - -/***/ }), - -/***/ 37525: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var BaseCBWriter_1 = __nccwpck_require__(50708); -/** - * Serializes XML nodes. - */ -var JSONCBWriter = /** @class */ (function (_super) { - __extends(JSONCBWriter, _super); - /** - * Initializes a new instance of `JSONCBWriter`. - * - * @param builderOptions - XML builder options - */ - function JSONCBWriter(builderOptions) { - var _this = _super.call(this, builderOptions) || this; - _this._hasChildren = []; - _this._additionalLevel = 0; - return _this; - } - /** @inheritdoc */ - JSONCBWriter.prototype.frontMatter = function () { - return ""; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.declaration = function (version, encoding, standalone) { - return ""; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.docType = function (name, publicId, systemId) { - return ""; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.comment = function (data) { - // { "!": "hello" } - return this._comma() + this._beginLine() + "{" + this._sep() + - this._key(this._builderOptions.convert.comment) + this._sep() + - this._val(data) + this._sep() + "}"; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.text = function (data) { - // { "#": "hello" } - return this._comma() + this._beginLine() + "{" + this._sep() + - this._key(this._builderOptions.convert.text) + this._sep() + - this._val(data) + this._sep() + "}"; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.instruction = function (target, data) { - // { "?": "target hello" } - return this._comma() + this._beginLine() + "{" + this._sep() + - this._key(this._builderOptions.convert.ins) + this._sep() + - this._val(data ? target + " " + data : target) + this._sep() + "}"; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.cdata = function (data) { - // { "$": "hello" } - return this._comma() + this._beginLine() + "{" + this._sep() + - this._key(this._builderOptions.convert.cdata) + this._sep() + - this._val(data) + this._sep() + "}"; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.attribute = function (name, value) { - // { "@name": "val" } - return this._comma() + this._beginLine(1) + "{" + this._sep() + - this._key(this._builderOptions.convert.att + name) + this._sep() + - this._val(value) + this._sep() + "}"; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.openTagBegin = function (name) { - // { "node": { "#": [ - var str = this._comma() + this._beginLine() + "{" + this._sep() + this._key(name) + this._sep() + "{"; - this._additionalLevel++; - this.hasData = true; - str += this._beginLine() + this._key(this._builderOptions.convert.text) + this._sep() + "["; - this._hasChildren.push(false); - return str; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.openTagEnd = function (name, selfClosing, voidElement) { - if (selfClosing) { - var str = this._sep() + "]"; - this._additionalLevel--; - str += this._beginLine() + "}" + this._sep() + "}"; - return str; - } - else { - return ""; - } - }; - /** @inheritdoc */ - JSONCBWriter.prototype.closeTag = function (name) { - // ] } } - var str = this._beginLine() + "]"; - this._additionalLevel--; - str += this._beginLine() + "}" + this._sep() + "}"; - return str; - }; - /** @inheritdoc */ - JSONCBWriter.prototype.beginElement = function (name) { }; - /** @inheritdoc */ - JSONCBWriter.prototype.endElement = function (name) { this._hasChildren.pop(); }; - /** - * Produces characters to be prepended to a line of string in pretty-print - * mode. - */ - JSONCBWriter.prototype._beginLine = function (additionalOffset) { - if (additionalOffset === void 0) { additionalOffset = 0; } - if (this._writerOptions.prettyPrint) { - return (this.hasData ? this._writerOptions.newline : "") + - this._indent(this._writerOptions.offset + this.level + additionalOffset); - } - else { - return ""; - } - }; - /** - * Produces an indentation string. - * - * @param level - depth of the tree - */ - JSONCBWriter.prototype._indent = function (level) { - if (level + this._additionalLevel <= 0) { - return ""; - } - else { - return this._writerOptions.indent.repeat(level + this._additionalLevel); - } - }; - /** - * Produces a comma before a child node if it has previous siblings. - */ - JSONCBWriter.prototype._comma = function () { - var str = (this._hasChildren[this._hasChildren.length - 1] ? "," : ""); - if (this._hasChildren.length > 0) { - this._hasChildren[this._hasChildren.length - 1] = true; - } - return str; - }; - /** - * Produces a separator string. - */ - JSONCBWriter.prototype._sep = function () { - return (this._writerOptions.prettyPrint ? " " : ""); - }; - /** - * Produces a JSON key string delimited with double quotes. - */ - JSONCBWriter.prototype._key = function (key) { - return "\"" + key + "\":"; - }; - /** - * Produces a JSON value string delimited with double quotes. - */ - JSONCBWriter.prototype._val = function (val) { - return JSON.stringify(val); - }; - return JSONCBWriter; -}(BaseCBWriter_1.BaseCBWriter)); -exports.JSONCBWriter = JSONCBWriter; -//# sourceMappingURL=JSONCBWriter.js.map - -/***/ }), - -/***/ 37510: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var ObjectWriter_1 = __nccwpck_require__(50243); -var util_1 = __nccwpck_require__(76195); -var BaseWriter_1 = __nccwpck_require__(37644); -/** - * Serializes XML nodes into a JSON string. - */ -var JSONWriter = /** @class */ (function (_super) { - __extends(JSONWriter, _super); - /** - * Initializes a new instance of `JSONWriter`. - * - * @param builderOptions - XML builder options - * @param writerOptions - serialization options - */ - function JSONWriter(builderOptions, writerOptions) { - var _this = _super.call(this, builderOptions) || this; - // provide default options - _this._writerOptions = util_1.applyDefaults(writerOptions, { - wellFormed: false, - noDoubleEncoding: false, - prettyPrint: false, - indent: ' ', - newline: '\n', - offset: 0, - group: false, - verbose: false - }); - return _this; - } - /** - * Produces an XML serialization of the given node. - * - * @param node - node to serialize - * @param writerOptions - serialization options - */ - JSONWriter.prototype.serialize = function (node) { - // convert to object - var objectWriterOptions = util_1.applyDefaults(this._writerOptions, { - format: "object", - wellFormed: false, - noDoubleEncoding: false, - }); - var objectWriter = new ObjectWriter_1.ObjectWriter(this._builderOptions, objectWriterOptions); - var val = objectWriter.serialize(node); - // recursively convert object into JSON string - return this._beginLine(this._writerOptions, 0) + this._convertObject(val, this._writerOptions); - }; - /** - * Produces an XML serialization of the given object. - * - * @param obj - object to serialize - * @param options - serialization options - * @param level - depth of the XML tree - */ - JSONWriter.prototype._convertObject = function (obj, options, level) { - var e_1, _a; - var _this = this; - if (level === void 0) { level = 0; } - var markup = ''; - var isLeaf = this._isLeafNode(obj); - if (util_1.isArray(obj)) { - markup += '['; - var len = obj.length; - var i = 0; - try { - for (var obj_1 = __values(obj), obj_1_1 = obj_1.next(); !obj_1_1.done; obj_1_1 = obj_1.next()) { - var val = obj_1_1.value; - markup += this._endLine(options, level + 1) + - this._beginLine(options, level + 1) + - this._convertObject(val, options, level + 1); - if (i < len - 1) { - markup += ','; - } - i++; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (obj_1_1 && !obj_1_1.done && (_a = obj_1.return)) _a.call(obj_1); - } - finally { if (e_1) throw e_1.error; } - } - markup += this._endLine(options, level) + this._beginLine(options, level); - markup += ']'; - } - else if (util_1.isObject(obj)) { - markup += '{'; - var len_1 = util_1.objectLength(obj); - var i_1 = 0; - util_1.forEachObject(obj, function (key, val) { - if (isLeaf && options.prettyPrint) { - markup += ' '; - } - else { - markup += _this._endLine(options, level + 1) + _this._beginLine(options, level + 1); - } - markup += _this._key(key); - if (options.prettyPrint) { - markup += ' '; - } - markup += _this._convertObject(val, options, level + 1); - if (i_1 < len_1 - 1) { - markup += ','; - } - i_1++; - }, this); - if (isLeaf && options.prettyPrint) { - markup += ' '; - } - else { - markup += this._endLine(options, level) + this._beginLine(options, level); - } - markup += '}'; - } - else { - markup += this._val(obj); - } - return markup; - }; - /** - * Produces characters to be prepended to a line of string in pretty-print - * mode. - * - * @param options - serialization options - * @param level - current depth of the XML tree - */ - JSONWriter.prototype._beginLine = function (options, level) { - if (!options.prettyPrint) { - return ''; - } - else { - var indentLevel = options.offset + level + 1; - if (indentLevel > 0) { - return new Array(indentLevel).join(options.indent); - } - } - return ''; - }; - /** - * Produces characters to be appended to a line of string in pretty-print - * mode. - * - * @param options - serialization options - * @param level - current depth of the XML tree - */ - JSONWriter.prototype._endLine = function (options, level) { - if (!options.prettyPrint) { - return ''; - } - else { - return options.newline; - } - }; - /** - * Produces a JSON key string delimited with double quotes. - */ - JSONWriter.prototype._key = function (key) { - return "\"" + key + "\":"; - }; - /** - * Produces a JSON value string delimited with double quotes. - */ - JSONWriter.prototype._val = function (val) { - return JSON.stringify(val); - }; - /** - * Determines if an object is a leaf node. - * - * @param obj - */ - JSONWriter.prototype._isLeafNode = function (obj) { - return this._descendantCount(obj) <= 1; - }; - /** - * Counts the number of descendants of the given object. - * - * @param obj - * @param count - */ - JSONWriter.prototype._descendantCount = function (obj, count) { - var _this = this; - if (count === void 0) { count = 0; } - if (util_1.isArray(obj)) { - util_1.forEachArray(obj, function (val) { return count += _this._descendantCount(val, count); }, this); - } - else if (util_1.isObject(obj)) { - util_1.forEachObject(obj, function (key, val) { return count += _this._descendantCount(val, count); }, this); - } - else { - count++; - } - return count; - }; - return JSONWriter; -}(BaseWriter_1.BaseWriter)); -exports.JSONWriter = JSONWriter; -//# sourceMappingURL=JSONWriter.js.map - -/***/ }), - -/***/ 41397: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); -var ObjectWriter_1 = __nccwpck_require__(50243); -var BaseWriter_1 = __nccwpck_require__(37644); -/** - * Serializes XML nodes into ES6 maps and arrays. - */ -var MapWriter = /** @class */ (function (_super) { - __extends(MapWriter, _super); - /** - * Initializes a new instance of `MapWriter`. - * - * @param builderOptions - XML builder options - * @param writerOptions - serialization options - */ - function MapWriter(builderOptions, writerOptions) { - var _this = _super.call(this, builderOptions) || this; - // provide default options - _this._writerOptions = util_1.applyDefaults(writerOptions, { - format: "map", - wellFormed: false, - noDoubleEncoding: false, - group: false, - verbose: false - }); - return _this; - } - /** - * Produces an XML serialization of the given node. - * - * @param node - node to serialize - */ - MapWriter.prototype.serialize = function (node) { - // convert to object - var objectWriterOptions = util_1.applyDefaults(this._writerOptions, { - format: "object", - wellFormed: false, - noDoubleEncoding: false, - verbose: false - }); - var objectWriter = new ObjectWriter_1.ObjectWriter(this._builderOptions, objectWriterOptions); - var val = objectWriter.serialize(node); - // recursively convert object into Map - return this._convertObject(val); - }; - /** - * Recursively converts a JS object into an ES5 map. - * - * @param obj - a JS object - */ - MapWriter.prototype._convertObject = function (obj) { - if (util_1.isArray(obj)) { - for (var i = 0; i < obj.length; i++) { - obj[i] = this._convertObject(obj[i]); - } - return obj; - } - else if (util_1.isObject(obj)) { - var map = new Map(); - for (var key in obj) { - map.set(key, this._convertObject(obj[key])); - } - return map; - } - else { - return obj; - } - }; - return MapWriter; -}(BaseWriter_1.BaseWriter)); -exports.MapWriter = MapWriter; -//# sourceMappingURL=MapWriter.js.map - -/***/ }), - -/***/ 50243: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); -var interfaces_1 = __nccwpck_require__(27305); -var BaseWriter_1 = __nccwpck_require__(37644); -/** - * Serializes XML nodes into objects and arrays. - */ -var ObjectWriter = /** @class */ (function (_super) { - __extends(ObjectWriter, _super); - /** - * Initializes a new instance of `ObjectWriter`. - * - * @param builderOptions - XML builder options - * @param writerOptions - serialization options - */ - function ObjectWriter(builderOptions, writerOptions) { - var _this = _super.call(this, builderOptions) || this; - _this._writerOptions = util_1.applyDefaults(writerOptions, { - format: "object", - wellFormed: false, - noDoubleEncoding: false, - group: false, - verbose: false - }); - return _this; - } - /** - * Produces an XML serialization of the given node. - * - * @param node - node to serialize - */ - ObjectWriter.prototype.serialize = function (node) { - this._currentList = []; - this._currentIndex = 0; - this._listRegister = [this._currentList]; - /** - * First pass, serialize nodes - * This creates a list of nodes grouped under node types while preserving - * insertion order. For example: - * [ - * root: [ - * node: [ - * { "@" : { "att1": "val1", "att2": "val2" } - * { "#": "node text" } - * { childNode: [] } - * { "#": "more text" } - * ], - * node: [ - * { "@" : { "att": "val" } - * { "#": [ "text line1", "text line2" ] } - * ] - * ] - * ] - */ - this.serializeNode(node, this._writerOptions.wellFormed, this._writerOptions.noDoubleEncoding); - /** - * Second pass, process node lists. Above example becomes: - * { - * root: { - * node: [ - * { - * "@att1": "val1", - * "@att2": "val2", - * "#1": "node text", - * childNode: {}, - * "#2": "more text" - * }, - * { - * "@att": "val", - * "#": [ "text line1", "text line2" ] - * } - * ] - * } - * } - */ - return this._process(this._currentList, this._writerOptions); - }; - ObjectWriter.prototype._process = function (items, options) { - var _a, _b, _c, _d, _e, _f, _g; - if (items.length === 0) - return {}; - // determine if there are non-unique element names - var namesSeen = {}; - var hasNonUniqueNames = false; - var textCount = 0; - var commentCount = 0; - var instructionCount = 0; - var cdataCount = 0; - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var key = Object.keys(item)[0]; - switch (key) { - case "@": - continue; - case "#": - textCount++; - break; - case "!": - commentCount++; - break; - case "?": - instructionCount++; - break; - case "$": - cdataCount++; - break; - default: - if (namesSeen[key]) { - hasNonUniqueNames = true; - } - else { - namesSeen[key] = true; - } - break; - } - } - var defAttrKey = this._getAttrKey(); - var defTextKey = this._getNodeKey(interfaces_1.NodeType.Text); - var defCommentKey = this._getNodeKey(interfaces_1.NodeType.Comment); - var defInstructionKey = this._getNodeKey(interfaces_1.NodeType.ProcessingInstruction); - var defCdataKey = this._getNodeKey(interfaces_1.NodeType.CData); - if (textCount === 1 && items.length === 1 && util_1.isString(items[0]["#"])) { - // special case of an element node with a single text node - return items[0]["#"]; - } - else if (hasNonUniqueNames) { - var obj = {}; - // process attributes first - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var key = Object.keys(item)[0]; - if (key === "@") { - var attrs = item["@"]; - var attrKeys = Object.keys(attrs); - if (attrKeys.length === 1) { - obj[defAttrKey + attrKeys[0]] = attrs[attrKeys[0]]; - } - else { - obj[defAttrKey] = item["@"]; - } - } - } - // list contains element nodes with non-unique names - // return an array with mixed content notation - var result = []; - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var key = Object.keys(item)[0]; - switch (key) { - case "@": - // attributes were processed above - break; - case "#": - result.push((_a = {}, _a[defTextKey] = item["#"], _a)); - break; - case "!": - result.push((_b = {}, _b[defCommentKey] = item["!"], _b)); - break; - case "?": - result.push((_c = {}, _c[defInstructionKey] = item["?"], _c)); - break; - case "$": - result.push((_d = {}, _d[defCdataKey] = item["$"], _d)); - break; - default: - // element node - var ele = item; - if (ele[key].length !== 0 && util_1.isArray(ele[key][0])) { - // group of element nodes - var eleGroup = []; - var listOfLists = ele[key]; - for (var i_1 = 0; i_1 < listOfLists.length; i_1++) { - eleGroup.push(this._process(listOfLists[i_1], options)); - } - result.push((_e = {}, _e[key] = eleGroup, _e)); - } - else { - // single element node - if (options.verbose) { - result.push((_f = {}, _f[key] = [this._process(ele[key], options)], _f)); - } - else { - result.push((_g = {}, _g[key] = this._process(ele[key], options), _g)); - } - } - break; - } - } - obj[defTextKey] = result; - return obj; - } - else { - // all element nodes have unique names - // return an object while prefixing data node keys - var textId = 1; - var commentId = 1; - var instructionId = 1; - var cdataId = 1; - var obj = {}; - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var key = Object.keys(item)[0]; - switch (key) { - case "@": - var attrs = item["@"]; - var attrKeys = Object.keys(attrs); - if (!options.group || attrKeys.length === 1) { - for (var attrName in attrs) { - obj[defAttrKey + attrName] = attrs[attrName]; - } - } - else { - obj[defAttrKey] = attrs; - } - break; - case "#": - textId = this._processSpecItem(item["#"], obj, options.group, defTextKey, textCount, textId); - break; - case "!": - commentId = this._processSpecItem(item["!"], obj, options.group, defCommentKey, commentCount, commentId); - break; - case "?": - instructionId = this._processSpecItem(item["?"], obj, options.group, defInstructionKey, instructionCount, instructionId); - break; - case "$": - cdataId = this._processSpecItem(item["$"], obj, options.group, defCdataKey, cdataCount, cdataId); - break; - default: - // element node - var ele = item; - if (ele[key].length !== 0 && util_1.isArray(ele[key][0])) { - // group of element nodes - var eleGroup = []; - var listOfLists = ele[key]; - for (var i_2 = 0; i_2 < listOfLists.length; i_2++) { - eleGroup.push(this._process(listOfLists[i_2], options)); - } - obj[key] = eleGroup; - } - else { - // single element node - if (options.verbose) { - obj[key] = [this._process(ele[key], options)]; - } - else { - obj[key] = this._process(ele[key], options); - } - } - break; - } - } - return obj; - } - }; - ObjectWriter.prototype._processSpecItem = function (item, obj, group, defKey, count, id) { - var e_1, _a; - if (!group && util_1.isArray(item) && count + item.length > 2) { - try { - for (var item_1 = __values(item), item_1_1 = item_1.next(); !item_1_1.done; item_1_1 = item_1.next()) { - var subItem = item_1_1.value; - var key = defKey + (id++).toString(); - obj[key] = subItem; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (item_1_1 && !item_1_1.done && (_a = item_1.return)) _a.call(item_1); - } - finally { if (e_1) throw e_1.error; } - } - } - else { - var key = count > 1 ? defKey + (id++).toString() : defKey; - obj[key] = item; - } - return id; - }; - /** @inheritdoc */ - ObjectWriter.prototype.beginElement = function (name) { - var _a, _b; - var childItems = []; - if (this._currentList.length === 0) { - this._currentList.push((_a = {}, _a[name] = childItems, _a)); - } - else { - var lastItem = this._currentList[this._currentList.length - 1]; - if (this._isElementNode(lastItem, name)) { - if (lastItem[name].length !== 0 && util_1.isArray(lastItem[name][0])) { - var listOfLists = lastItem[name]; - listOfLists.push(childItems); - } - else { - lastItem[name] = [lastItem[name], childItems]; - } - } - else { - this._currentList.push((_b = {}, _b[name] = childItems, _b)); - } - } - this._currentIndex++; - if (this._listRegister.length > this._currentIndex) { - this._listRegister[this._currentIndex] = childItems; - } - else { - this._listRegister.push(childItems); - } - this._currentList = childItems; - }; - /** @inheritdoc */ - ObjectWriter.prototype.endElement = function () { - this._currentList = this._listRegister[--this._currentIndex]; - }; - /** @inheritdoc */ - ObjectWriter.prototype.attribute = function (name, value) { - var _a, _b; - if (this._currentList.length === 0) { - this._currentList.push({ "@": (_a = {}, _a[name] = value, _a) }); - } - else { - var lastItem = this._currentList[this._currentList.length - 1]; - /* istanbul ignore else */ - if (this._isAttrNode(lastItem)) { - lastItem["@"][name] = value; - } - else { - this._currentList.push({ "@": (_b = {}, _b[name] = value, _b) }); - } - } - }; - /** @inheritdoc */ - ObjectWriter.prototype.comment = function (data) { - if (this._currentList.length === 0) { - this._currentList.push({ "!": data }); - } - else { - var lastItem = this._currentList[this._currentList.length - 1]; - if (this._isCommentNode(lastItem)) { - if (util_1.isArray(lastItem["!"])) { - lastItem["!"].push(data); - } - else { - lastItem["!"] = [lastItem["!"], data]; - } - } - else { - this._currentList.push({ "!": data }); - } - } - }; - /** @inheritdoc */ - ObjectWriter.prototype.text = function (data) { - if (this._currentList.length === 0) { - this._currentList.push({ "#": data }); - } - else { - var lastItem = this._currentList[this._currentList.length - 1]; - if (this._isTextNode(lastItem)) { - if (util_1.isArray(lastItem["#"])) { - lastItem["#"].push(data); - } - else { - lastItem["#"] = [lastItem["#"], data]; - } - } - else { - this._currentList.push({ "#": data }); - } - } - }; - /** @inheritdoc */ - ObjectWriter.prototype.instruction = function (target, data) { - var value = (data === "" ? target : target + " " + data); - if (this._currentList.length === 0) { - this._currentList.push({ "?": value }); - } - else { - var lastItem = this._currentList[this._currentList.length - 1]; - if (this._isInstructionNode(lastItem)) { - if (util_1.isArray(lastItem["?"])) { - lastItem["?"].push(value); - } - else { - lastItem["?"] = [lastItem["?"], value]; - } - } - else { - this._currentList.push({ "?": value }); - } - } - }; - /** @inheritdoc */ - ObjectWriter.prototype.cdata = function (data) { - if (this._currentList.length === 0) { - this._currentList.push({ "$": data }); - } - else { - var lastItem = this._currentList[this._currentList.length - 1]; - if (this._isCDATANode(lastItem)) { - if (util_1.isArray(lastItem["$"])) { - lastItem["$"].push(data); - } - else { - lastItem["$"] = [lastItem["$"], data]; - } - } - else { - this._currentList.push({ "$": data }); - } - } - }; - ObjectWriter.prototype._isAttrNode = function (x) { - return "@" in x; - }; - ObjectWriter.prototype._isTextNode = function (x) { - return "#" in x; - }; - ObjectWriter.prototype._isCommentNode = function (x) { - return "!" in x; - }; - ObjectWriter.prototype._isInstructionNode = function (x) { - return "?" in x; - }; - ObjectWriter.prototype._isCDATANode = function (x) { - return "$" in x; - }; - ObjectWriter.prototype._isElementNode = function (x, name) { - return name in x; - }; - /** - * Returns an object key for an attribute or namespace declaration. - */ - ObjectWriter.prototype._getAttrKey = function () { - return this._builderOptions.convert.att; - }; - /** - * Returns an object key for the given node type. - * - * @param nodeType - node type to get a key for - */ - ObjectWriter.prototype._getNodeKey = function (nodeType) { - switch (nodeType) { - case interfaces_1.NodeType.Comment: - return this._builderOptions.convert.comment; - case interfaces_1.NodeType.Text: - return this._builderOptions.convert.text; - case interfaces_1.NodeType.ProcessingInstruction: - return this._builderOptions.convert.ins; - case interfaces_1.NodeType.CData: - return this._builderOptions.convert.cdata; - /* istanbul ignore next */ - default: - throw new Error("Invalid node type."); - } - }; - return ObjectWriter; -}(BaseWriter_1.BaseWriter)); -exports.ObjectWriter = ObjectWriter; -//# sourceMappingURL=ObjectWriter.js.map - -/***/ }), - -/***/ 77572: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var BaseCBWriter_1 = __nccwpck_require__(50708); -/** - * Serializes XML nodes. - */ -var XMLCBWriter = /** @class */ (function (_super) { - __extends(XMLCBWriter, _super); - /** - * Initializes a new instance of `XMLCBWriter`. - * - * @param builderOptions - XML builder options - */ - function XMLCBWriter(builderOptions) { - var _this = _super.call(this, builderOptions) || this; - _this._lineLength = 0; - return _this; - } - /** @inheritdoc */ - XMLCBWriter.prototype.frontMatter = function () { - return ""; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.declaration = function (version, encoding, standalone) { - var markup = this._beginLine() + ""; - return markup; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.docType = function (name, publicId, systemId) { - var markup = this._beginLine(); - if (publicId && systemId) { - markup += ""; - } - else if (publicId) { - markup += ""; - } - else if (systemId) { - markup += ""; - } - else { - markup += ""; - } - return markup; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.comment = function (data) { - return this._beginLine() + ""; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.text = function (data) { - return this._beginLine() + data; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.instruction = function (target, data) { - if (data) { - return this._beginLine() + ""; - } - else { - return this._beginLine() + ""; - } - }; - /** @inheritdoc */ - XMLCBWriter.prototype.cdata = function (data) { - return this._beginLine() + ""; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.openTagBegin = function (name) { - this._lineLength += 1 + name.length; - return this._beginLine() + "<" + name; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.openTagEnd = function (name, selfClosing, voidElement) { - if (voidElement) { - return " />"; - } - else if (selfClosing) { - if (this._writerOptions.allowEmptyTags) { - return ">"; - } - else if (this._writerOptions.spaceBeforeSlash) { - return " />"; - } - else { - return "/>"; - } - } - else { - return ">"; - } - }; - /** @inheritdoc */ - XMLCBWriter.prototype.closeTag = function (name) { - return this._beginLine() + ""; - }; - /** @inheritdoc */ - XMLCBWriter.prototype.attribute = function (name, value) { - var str = name + "=\"" + value + "\""; - if (this._writerOptions.prettyPrint && this._writerOptions.width > 0 && - this._lineLength + 1 + str.length > this._writerOptions.width) { - str = this._beginLine() + this._indent(1) + str; - this._lineLength = str.length; - return str; - } - else { - this._lineLength += 1 + str.length; - return " " + str; - } - }; - /** @inheritdoc */ - XMLCBWriter.prototype.beginElement = function (name) { }; - /** @inheritdoc */ - XMLCBWriter.prototype.endElement = function (name) { }; - /** - * Produces characters to be prepended to a line of string in pretty-print - * mode. - */ - XMLCBWriter.prototype._beginLine = function () { - if (this._writerOptions.prettyPrint) { - var str = (this.hasData ? this._writerOptions.newline : "") + - this._indent(this._writerOptions.offset + this.level); - this._lineLength = str.length; - return str; - } - else { - return ""; - } - }; - /** - * Produces an indentation string. - * - * @param level - depth of the tree - */ - XMLCBWriter.prototype._indent = function (level) { - if (level <= 0) { - return ""; - } - else { - return this._writerOptions.indent.repeat(level); - } - }; - return XMLCBWriter; -}(BaseCBWriter_1.BaseCBWriter)); -exports.XMLCBWriter = XMLCBWriter; -//# sourceMappingURL=XMLCBWriter.js.map - -/***/ }), - -/***/ 59606: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var util_1 = __nccwpck_require__(76195); -var interfaces_1 = __nccwpck_require__(27305); -var BaseWriter_1 = __nccwpck_require__(37644); -var util_2 = __nccwpck_require__(65282); -/** - * Serializes XML nodes into strings. - */ -var XMLWriter = /** @class */ (function (_super) { - __extends(XMLWriter, _super); - /** - * Initializes a new instance of `XMLWriter`. - * - * @param builderOptions - XML builder options - * @param writerOptions - serialization options - */ - function XMLWriter(builderOptions, writerOptions) { - var _this = _super.call(this, builderOptions) || this; - _this._indentation = {}; - _this._lengthToLastNewline = 0; - // provide default options - _this._writerOptions = util_1.applyDefaults(writerOptions, { - wellFormed: false, - noDoubleEncoding: false, - headless: false, - prettyPrint: false, - indent: " ", - newline: "\n", - offset: 0, - width: 0, - allowEmptyTags: false, - indentTextOnlyNodes: false, - spaceBeforeSlash: false - }); - return _this; - } - /** - * Produces an XML serialization of the given node. - * - * @param node - node to serialize - */ - XMLWriter.prototype.serialize = function (node) { - this._refs = { suppressPretty: false, emptyNode: false, markup: "" }; - // Serialize XML declaration - if (node.nodeType === interfaces_1.NodeType.Document && !this._writerOptions.headless) { - this.declaration(this._builderOptions.version, this._builderOptions.encoding, this._builderOptions.standalone); - } - // recursively serialize node - this.serializeNode(node, this._writerOptions.wellFormed, this._writerOptions.noDoubleEncoding); - // remove trailing newline - if (this._writerOptions.prettyPrint && - this._refs.markup.slice(-this._writerOptions.newline.length) === this._writerOptions.newline) { - this._refs.markup = this._refs.markup.slice(0, -this._writerOptions.newline.length); - } - return this._refs.markup; - }; - /** @inheritdoc */ - XMLWriter.prototype.declaration = function (version, encoding, standalone) { - this._beginLine(); - this._refs.markup += ""; - this._endLine(); - }; - /** @inheritdoc */ - XMLWriter.prototype.docType = function (name, publicId, systemId) { - this._beginLine(); - if (publicId && systemId) { - this._refs.markup += ""; - } - else if (publicId) { - this._refs.markup += ""; - } - else if (systemId) { - this._refs.markup += ""; - } - else { - this._refs.markup += ""; - } - this._endLine(); - }; - /** @inheritdoc */ - XMLWriter.prototype.openTagBegin = function (name) { - this._beginLine(); - this._refs.markup += "<" + name; - }; - /** @inheritdoc */ - XMLWriter.prototype.openTagEnd = function (name, selfClosing, voidElement) { - // do not indent text only elements or elements with empty text nodes - this._refs.suppressPretty = false; - this._refs.emptyNode = false; - if (this._writerOptions.prettyPrint && !selfClosing && !voidElement) { - var textOnlyNode = true; - var emptyNode = true; - var childNode = this.currentNode.firstChild; - var cdataCount = 0; - var textCount = 0; - while (childNode) { - if (util_2.Guard.isExclusiveTextNode(childNode)) { - textCount++; - } - else if (util_2.Guard.isCDATASectionNode(childNode)) { - cdataCount++; - } - else { - textOnlyNode = false; - emptyNode = false; - break; - } - if (childNode.data !== '') { - emptyNode = false; - } - childNode = childNode.nextSibling; - } - this._refs.suppressPretty = !this._writerOptions.indentTextOnlyNodes && textOnlyNode && ((cdataCount <= 1 && textCount === 0) || cdataCount === 0); - this._refs.emptyNode = emptyNode; - } - if ((voidElement || selfClosing || this._refs.emptyNode) && this._writerOptions.allowEmptyTags) { - this._refs.markup += ">"; - } - else { - this._refs.markup += voidElement ? " />" : - (selfClosing || this._refs.emptyNode) ? (this._writerOptions.spaceBeforeSlash ? " />" : "/>") : ">"; - } - this._endLine(); - }; - /** @inheritdoc */ - XMLWriter.prototype.closeTag = function (name) { - if (!this._refs.emptyNode) { - this._beginLine(); - this._refs.markup += ""; - } - this._refs.suppressPretty = false; - this._refs.emptyNode = false; - this._endLine(); - }; - /** @inheritdoc */ - XMLWriter.prototype.attribute = function (name, value) { - var str = name + "=\"" + value + "\""; - if (this._writerOptions.prettyPrint && this._writerOptions.width > 0 && - this._refs.markup.length - this._lengthToLastNewline + 1 + str.length > this._writerOptions.width) { - this._endLine(); - this._beginLine(); - this._refs.markup += this._indent(1) + str; - } - else { - this._refs.markup += " " + str; - } - }; - /** @inheritdoc */ - XMLWriter.prototype.text = function (data) { - if (data !== '') { - this._beginLine(); - this._refs.markup += data; - this._endLine(); - } - }; - /** @inheritdoc */ - XMLWriter.prototype.cdata = function (data) { - if (data !== '') { - this._beginLine(); - this._refs.markup += ""; - this._endLine(); - } - }; - /** @inheritdoc */ - XMLWriter.prototype.comment = function (data) { - this._beginLine(); - this._refs.markup += ""; - this._endLine(); - }; - /** @inheritdoc */ - XMLWriter.prototype.instruction = function (target, data) { - this._beginLine(); - this._refs.markup += ""; - this._endLine(); - }; - /** - * Produces characters to be prepended to a line of string in pretty-print - * mode. - */ - XMLWriter.prototype._beginLine = function () { - if (this._writerOptions.prettyPrint && !this._refs.suppressPretty) { - this._refs.markup += this._indent(this._writerOptions.offset + this.level); - } - }; - /** - * Produces characters to be appended to a line of string in pretty-print - * mode. - */ - XMLWriter.prototype._endLine = function () { - if (this._writerOptions.prettyPrint && !this._refs.suppressPretty) { - this._refs.markup += this._writerOptions.newline; - this._lengthToLastNewline = this._refs.markup.length; - } - }; - /** - * Produces an indentation string. - * - * @param level - depth of the tree - */ - XMLWriter.prototype._indent = function (level) { - if (level <= 0) { - return ""; - } - else if (this._indentation[level] !== undefined) { - return this._indentation[level]; - } - else { - var str = this._writerOptions.indent.repeat(level); - this._indentation[level] = str; - return str; - } - }; - return XMLWriter; -}(BaseWriter_1.BaseWriter)); -exports.XMLWriter = XMLWriter; -//# sourceMappingURL=XMLWriter.js.map - -/***/ }), - -/***/ 42444: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", ({ value: true })); -var BaseCBWriter_1 = __nccwpck_require__(50708); -/** - * Serializes XML nodes. - */ -var YAMLCBWriter = /** @class */ (function (_super) { - __extends(YAMLCBWriter, _super); - /** - * Initializes a new instance of `BaseCBWriter`. - * - * @param builderOptions - XML builder options - */ - function YAMLCBWriter(builderOptions) { - var _this = _super.call(this, builderOptions) || this; - _this._rootWritten = false; - _this._additionalLevel = 0; - if (builderOptions.indent.length < 2) { - throw new Error("YAML indententation string must be at least two characters long."); - } - if (builderOptions.offset < 0) { - throw new Error("YAML offset should be zero or a positive number."); - } - return _this; - } - /** @inheritdoc */ - YAMLCBWriter.prototype.frontMatter = function () { - return this._beginLine() + "---"; - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.declaration = function (version, encoding, standalone) { - return ""; - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.docType = function (name, publicId, systemId) { - return ""; - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.comment = function (data) { - // "!": "hello" - return this._beginLine() + - this._key(this._builderOptions.convert.comment) + " " + - this._val(data); - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.text = function (data) { - // "#": "hello" - return this._beginLine() + - this._key(this._builderOptions.convert.text) + " " + - this._val(data); - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.instruction = function (target, data) { - // "?": "target hello" - return this._beginLine() + - this._key(this._builderOptions.convert.ins) + " " + - this._val(data ? target + " " + data : target); - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.cdata = function (data) { - // "$": "hello" - return this._beginLine() + - this._key(this._builderOptions.convert.cdata) + " " + - this._val(data); - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.attribute = function (name, value) { - // "@name": "val" - this._additionalLevel++; - var str = this._beginLine() + - this._key(this._builderOptions.convert.att + name) + " " + - this._val(value); - this._additionalLevel--; - return str; - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.openTagBegin = function (name) { - // "node": - // "#": - // - - var str = this._beginLine() + this._key(name); - if (!this._rootWritten) { - this._rootWritten = true; - } - this.hasData = true; - this._additionalLevel++; - str += this._beginLine(true) + this._key(this._builderOptions.convert.text); - return str; - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.openTagEnd = function (name, selfClosing, voidElement) { - if (selfClosing) { - return " " + this._val(""); - } - return ""; - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.closeTag = function (name) { - this._additionalLevel--; - return ""; - }; - /** @inheritdoc */ - YAMLCBWriter.prototype.beginElement = function (name) { }; - /** @inheritdoc */ - YAMLCBWriter.prototype.endElement = function (name) { }; - /** - * Produces characters to be prepended to a line of string in pretty-print - * mode. - */ - YAMLCBWriter.prototype._beginLine = function (suppressArray) { - if (suppressArray === void 0) { suppressArray = false; } - return (this.hasData ? this._writerOptions.newline : "") + - this._indent(this._writerOptions.offset + this.level, suppressArray); - }; - /** - * Produces an indentation string. - * - * @param level - depth of the tree - * @param suppressArray - whether the suppress array marker - */ - YAMLCBWriter.prototype._indent = function (level, suppressArray) { - if (level + this._additionalLevel <= 0) { - return ""; - } - else { - var chars = this._writerOptions.indent.repeat(level + this._additionalLevel); - if (!suppressArray && this._rootWritten) { - return chars.substr(0, chars.length - 2) + '-' + chars.substr(-1, 1); - } - return chars; - } - }; - /** - * Produces a YAML key string delimited with double quotes. - */ - YAMLCBWriter.prototype._key = function (key) { - return "\"" + key + "\":"; - }; - /** - * Produces a YAML value string delimited with double quotes. - */ - YAMLCBWriter.prototype._val = function (val) { - return JSON.stringify(val); - }; - return YAMLCBWriter; -}(BaseCBWriter_1.BaseCBWriter)); -exports.YAMLCBWriter = YAMLCBWriter; -//# sourceMappingURL=YAMLCBWriter.js.map - -/***/ }), - -/***/ 96517: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __values = (this && this.__values) || function(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -var ObjectWriter_1 = __nccwpck_require__(50243); -var util_1 = __nccwpck_require__(76195); -var BaseWriter_1 = __nccwpck_require__(37644); -/** - * Serializes XML nodes into a YAML string. - */ -var YAMLWriter = /** @class */ (function (_super) { - __extends(YAMLWriter, _super); - /** - * Initializes a new instance of `YAMLWriter`. - * - * @param builderOptions - XML builder options - * @param writerOptions - serialization options - */ - function YAMLWriter(builderOptions, writerOptions) { - var _this = _super.call(this, builderOptions) || this; - // provide default options - _this._writerOptions = util_1.applyDefaults(writerOptions, { - wellFormed: false, - noDoubleEncoding: false, - indent: ' ', - newline: '\n', - offset: 0, - group: false, - verbose: false - }); - if (_this._writerOptions.indent.length < 2) { - throw new Error("YAML indententation string must be at least two characters long."); - } - if (_this._writerOptions.offset < 0) { - throw new Error("YAML offset should be zero or a positive number."); - } - return _this; - } - /** - * Produces an XML serialization of the given node. - * - * @param node - node to serialize - * @param writerOptions - serialization options - */ - YAMLWriter.prototype.serialize = function (node) { - // convert to object - var objectWriterOptions = util_1.applyDefaults(this._writerOptions, { - format: "object", - wellFormed: false, - noDoubleEncoding: false, - }); - var objectWriter = new ObjectWriter_1.ObjectWriter(this._builderOptions, objectWriterOptions); - var val = objectWriter.serialize(node); - var markup = this._beginLine(this._writerOptions, 0) + '---' + this._endLine(this._writerOptions) + - this._convertObject(val, this._writerOptions, 0); - // remove trailing newline - /* istanbul ignore else */ - if (markup.slice(-this._writerOptions.newline.length) === this._writerOptions.newline) { - markup = markup.slice(0, -this._writerOptions.newline.length); - } - return markup; - }; - /** - * Produces an XML serialization of the given object. - * - * @param obj - object to serialize - * @param options - serialization options - * @param level - depth of the XML tree - * @param indentLeaf - indents leaf nodes - */ - YAMLWriter.prototype._convertObject = function (obj, options, level, suppressIndent) { - var e_1, _a; - var _this = this; - if (suppressIndent === void 0) { suppressIndent = false; } - var markup = ''; - if (util_1.isArray(obj)) { - try { - for (var obj_1 = __values(obj), obj_1_1 = obj_1.next(); !obj_1_1.done; obj_1_1 = obj_1.next()) { - var val = obj_1_1.value; - markup += this._beginLine(options, level, true); - if (!util_1.isObject(val)) { - markup += this._val(val) + this._endLine(options); - } - else if (util_1.isEmpty(val)) { - markup += '""' + this._endLine(options); - } - else { - markup += this._convertObject(val, options, level, true); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (obj_1_1 && !obj_1_1.done && (_a = obj_1.return)) _a.call(obj_1); - } - finally { if (e_1) throw e_1.error; } - } - } - else /* if (isObject(obj)) */ { - util_1.forEachObject(obj, function (key, val) { - if (suppressIndent) { - markup += _this._key(key); - suppressIndent = false; - } - else { - markup += _this._beginLine(options, level) + _this._key(key); - } - if (!util_1.isObject(val)) { - markup += ' ' + _this._val(val) + _this._endLine(options); - } - else if (util_1.isEmpty(val)) { - markup += ' ""' + _this._endLine(options); - } - else { - markup += _this._endLine(options) + - _this._convertObject(val, options, level + 1); - } - }, this); - } - return markup; - }; - /** - * Produces characters to be prepended to a line of string in pretty-print - * mode. - * - * @param options - serialization options - * @param level - current depth of the XML tree - * @param isArray - whether this line is an array item - */ - YAMLWriter.prototype._beginLine = function (options, level, isArray) { - if (isArray === void 0) { isArray = false; } - var indentLevel = options.offset + level + 1; - var chars = new Array(indentLevel).join(options.indent); - if (isArray) { - return chars.substr(0, chars.length - 2) + '-' + chars.substr(-1, 1); - } - else { - return chars; - } - }; - /** - * Produces characters to be appended to a line of string in pretty-print - * mode. - * - * @param options - serialization options - */ - YAMLWriter.prototype._endLine = function (options) { - return options.newline; - }; - /** - * Produces a YAML key string delimited with double quotes. - */ - YAMLWriter.prototype._key = function (key) { - return "\"" + key + "\":"; - }; - /** - * Produces a YAML value string delimited with double quotes. - */ - YAMLWriter.prototype._val = function (val) { - return JSON.stringify(val); - }; - return YAMLWriter; -}(BaseWriter_1.BaseWriter)); -exports.YAMLWriter = YAMLWriter; -//# sourceMappingURL=YAMLWriter.js.map - -/***/ }), - -/***/ 17476: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -var MapWriter_1 = __nccwpck_require__(41397); -exports.MapWriter = MapWriter_1.MapWriter; -var XMLWriter_1 = __nccwpck_require__(59606); -exports.XMLWriter = XMLWriter_1.XMLWriter; -var ObjectWriter_1 = __nccwpck_require__(50243); -exports.ObjectWriter = ObjectWriter_1.ObjectWriter; -var JSONWriter_1 = __nccwpck_require__(37510); -exports.JSONWriter = JSONWriter_1.JSONWriter; -var YAMLWriter_1 = __nccwpck_require__(96517); -exports.YAMLWriter = YAMLWriter_1.YAMLWriter; -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 10829: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - - -var yaml = __nccwpck_require__(59625); - - -module.exports = yaml; - - -/***/ }), - -/***/ 59625: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - - -var loader = __nccwpck_require__(40342); -var dumper = __nccwpck_require__(98069); - - -function deprecated(name) { - return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); - }; -} - - -module.exports.Type = __nccwpck_require__(90256); -module.exports.Schema = __nccwpck_require__(66280); -module.exports.FAILSAFE_SCHEMA = __nccwpck_require__(70026); -module.exports.JSON_SCHEMA = __nccwpck_require__(2168); -module.exports.CORE_SCHEMA = __nccwpck_require__(11950); -module.exports.DEFAULT_SAFE_SCHEMA = __nccwpck_require__(42881); -module.exports.DEFAULT_FULL_SCHEMA = __nccwpck_require__(145); -module.exports.load = loader.load; -module.exports.loadAll = loader.loadAll; -module.exports.safeLoad = loader.safeLoad; -module.exports.safeLoadAll = loader.safeLoadAll; -module.exports.dump = dumper.dump; -module.exports.safeDump = dumper.safeDump; -module.exports.YAMLException = __nccwpck_require__(29291); - -// Deprecated schema names from JS-YAML 2.0.x -module.exports.MINIMAL_SCHEMA = __nccwpck_require__(70026); -module.exports.SAFE_SCHEMA = __nccwpck_require__(42881); -module.exports.DEFAULT_SCHEMA = __nccwpck_require__(145); - -// Deprecated functions from JS-YAML 1.x.x -module.exports.scan = deprecated('scan'); -module.exports.parse = deprecated('parse'); -module.exports.compose = deprecated('compose'); -module.exports.addConstructor = deprecated('addConstructor'); - - -/***/ }), - -/***/ 59941: -/***/ ((module) => { - -"use strict"; - - - -function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); -} - - -function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); -} - - -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; - - return [ sequence ]; -} - - -function extend(target, source) { - var index, length, key, sourceKeys; - - if (source) { - sourceKeys = Object.keys(source); - - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; - } - } - - return target; -} - - -function repeat(string, count) { - var result = '', cycle; - - for (cycle = 0; cycle < count; cycle += 1) { - result += string; - } - - return result; -} - - -function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); -} - - -module.exports.isNothing = isNothing; -module.exports.isObject = isObject; -module.exports.toArray = toArray; -module.exports.repeat = repeat; -module.exports.isNegativeZero = isNegativeZero; -module.exports.extend = extend; - - -/***/ }), - -/***/ 98069: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -/*eslint-disable no-use-before-define*/ - -var common = __nccwpck_require__(59941); -var YAMLException = __nccwpck_require__(29291); -var DEFAULT_FULL_SCHEMA = __nccwpck_require__(145); -var DEFAULT_SAFE_SCHEMA = __nccwpck_require__(42881); - -var _toString = Object.prototype.toString; -var _hasOwnProperty = Object.prototype.hasOwnProperty; - -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_EQUALS = 0x3D; /* = */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - -var ESCAPE_SEQUENCES = {}; - -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; - -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; - -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; - - if (map === null) return {}; - - result = {}; - keys = Object.keys(map); - - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); - - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } - type = schema.compiledTypeMap['fallback'][tag]; - - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; - } - - result[tag] = style; - } - - return result; -} - -function encodeHex(character) { - var string, handle, length; - - string = character.toString(16).toUpperCase(); - - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); - } - - return '\\' + handle + common.repeat('0', length - string.length) + string; -} - -function State(options) { - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - - this.tag = null; - this.result = ''; - - this.duplicates = []; - this.usedDuplicates = null; -} - -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; - - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - - if (line.length && line !== '\n') result += ind; - - result += line; - } - - return result; -} - -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} - -function testImplicitResolving(state, str) { - var index, length, type; - - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; - - if (type.resolve(str)) { - return true; - } - } - - return false; -} - -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} - -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */) - || (0x10000 <= c && c <= 0x10FFFF); -} - -// [34] ns-char ::= nb-char - s-white -// [27] nb-char ::= c-printable - b-char - c-byte-order-mark -// [26] b-char ::= b-line-feed | b-carriage-return -// [24] b-line-feed ::= #xA /* LF */ -// [25] b-carriage-return ::= #xD /* CR */ -// [3] c-byte-order-mark ::= #xFEFF -function isNsChar(c) { - return isPrintable(c) && !isWhitespace(c) - // byte-order-mark - && c !== 0xFEFF - // b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; -} - -// Simplified test for values allowed after the first character in plain style. -function isPlainSafe(c, prev) { - // Uses a subset of nb-char - c-flow-indicator - ":" - "#" - // where nb-char ::= c-printable - b-char - c-byte-order-mark. - return isPrintable(c) && c !== 0xFEFF - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // - ":" - "#" - // /* An ns-char preceding */ "#" - && c !== CHAR_COLON - && ((c !== CHAR_SHARP) || (prev && isNsChar(prev))); -} - -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - return isPrintable(c) && c !== 0xFEFF - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; -} - -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} - -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; - -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { - var i; - var char, prev_char; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(string.charCodeAt(0)) - && !isWhitespace(string.charCodeAt(string.length - 1)); - - if (singleLineOnly) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - prev_char = i > 0 ? string.charCodeAt(i - 1) : null; - plain = plain && isPlainSafe(char, prev_char); - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - return plain && !testAmbiguousType(string) - ? STYLE_PLAIN : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; -} - -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey) { - state.dump = (function () { - if (string.length === 0) { - return "''"; - } - if (!state.noCompatMode && - DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { - return "'" + string + "'"; - } - - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } - - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) { - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string, lineWidth) + '"'; - default: - throw new YAMLException('impossible error: invalid scalar style'); - } - }()); -} - -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; - - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); - - return indentIndicator + chomp + '\n'; -} - -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} - -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; - - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; - - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; - } - - return result; -} - -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; - - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; - - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } - - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); - } else { - result += line.slice(start); - } - - return result.slice(1); // drop extra \n joiner -} - -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char, nextChar; - var escapeSeq; - - for (var i = 0; i < string.length; i++) { - char = string.charCodeAt(i); - // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates"). - if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) { - nextChar = string.charCodeAt(i + 1); - if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) { - // Combine the surrogate pair and store it escaped. - result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000); - // Advance index one extra since we already used that char here. - i++; continue; - } - } - escapeSeq = ESCAPE_SEQUENCES[char]; - result += !escapeSeq && isPrintable(char) - ? string[i] - : escapeSeq || encodeHex(char); - } - - return result; -} - -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length; - - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level, object[index], false, false)) { - if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = '[' + _result + ']'; -} - -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length; - - for (index = 0, length = object.length; index < length; index += 1) { - // Write only valid elements. - if (writeNode(state, level + 1, object[index], true, true)) { - if (!compact || index !== 0) { - _result += generateNextLine(state, level); - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } - - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} - -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - - pairBuffer = ''; - if (index !== 0) pairBuffer += ', '; - - if (state.condenseFlow) pairBuffer += '"'; - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } - - if (state.dump.length > 1024) pairBuffer += '? '; - - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = '{' + _result + '}'; -} - -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new YAMLException('sortKeys must be a boolean or a function'); - } - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; - - if (!compact || index !== 0) { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } - - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); - - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } - - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. -} - -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - - typeList = explicit ? state.explicitTypes : state.implicitTypes; - - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; - - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { - - state.tag = explicit ? type.tag : '?'; - - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } - - state.dump = _result; - } - - return true; - } - } - - return false; -} - -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey) { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - var type = _toString.call(state.dump); - - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } - - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; - - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } - - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } - - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object Array]') { - var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level; - if (block && (state.dump.length !== 0)) { - writeBlockSequence(state, arrayLevel, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowSequence(state, arrayLevel, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey); - } - } else { - if (state.skipInvalid) return false; - throw new YAMLException('unacceptable kind of an object to dump ' + type); - } - - if (state.tag !== null && state.tag !== '?') { - state.dump = '!<' + state.tag + '> ' + state.dump; - } - } - - return true; -} - -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; - - inspectNode(object, objects, duplicatesIndexes); - - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); -} - -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; - - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); - - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); - } - } - } - } -} - -function dump(input, options) { - options = options || {}; - - var state = new State(options); - - if (!state.noRefs) getDuplicateReferences(input, state); - - if (writeNode(state, 0, input, true, true)) return state.dump + '\n'; - - return ''; -} - -function safeDump(input, options) { - return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} - -module.exports.dump = dump; -module.exports.safeDump = safeDump; - - -/***/ }), - -/***/ 29291: -/***/ ((module) => { - -"use strict"; -// YAML error class. http://stackoverflow.com/questions/8458984 -// - - -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); - - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); - - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } -} - - -// Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; - - -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; - - result += this.reason || '(unknown reason)'; - - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); - } - - return result; -}; - - -module.exports = YAMLException; - - -/***/ }), - -/***/ 40342: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -/*eslint-disable max-len,no-use-before-define*/ - -var common = __nccwpck_require__(59941); -var YAMLException = __nccwpck_require__(29291); -var Mark = __nccwpck_require__(77262); -var DEFAULT_SAFE_SCHEMA = __nccwpck_require__(42881); -var DEFAULT_FULL_SCHEMA = __nccwpck_require__(145); - - -var _hasOwnProperty = Object.prototype.hasOwnProperty; - - -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; - - -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; - - -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - - -function _class(obj) { return Object.prototype.toString.call(obj); } - -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} - -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} - -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} - -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} - -function fromHexCode(c) { - var lc; - - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - /*eslint-disable no-bitwise*/ - lc = c | 0x20; - - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } - - return -1; -} - -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} - -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - return -1; -} - -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; -} - -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); -} - -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} - - -function State(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.onWarning = options['onWarning'] || null; - this.legacy = options['legacy'] || false; - this.json = options['json'] || false; - this.listener = options['listener'] || null; - - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; - - this.documents = []; - - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ - -} - - -function generateError(state, message) { - return new YAMLException( - message, - new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart))); -} - -function throwError(state, message) { - throw generateError(state, message); -} - -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} - - -var directiveHandlers = { - - YAML: function handleYamlDirective(state, name, args) { - - var match, major, minor; - - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } - - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } - - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } - - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } - - state.version = args[0]; - state.checkLineBreaks = (minor < 2); - - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - - TAG: function handleTagDirective(state, name, args) { - - var handle, prefix; - - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } - - handle = args[0]; - prefix = args[1]; - - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - state.tagMap[handle] = prefix; - } -}; - - -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - - if (start < end) { - _result = state.input.slice(start, end); - - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - - state.result += _result; - } -} - -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; - - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - - sourceKeys = Object.keys(source); - - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; - - if (!_hasOwnProperty.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; - } - } -} - -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { - var index, quantity; - - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); - - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } - - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } - - - keyNode = String(keyNode); - - if (_result === null) { - _result = {}; - } - - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty.call(overridableKeys, keyNode) && - _hasOwnProperty.call(_result, keyNode)) { - state.line = startLine || state.line; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - _result[keyNode] = valueNode; - delete overridableKeys[keyNode]; - } - - return _result; -} - -function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } - - state.line += 1; - state.lineStart = state.position; -} - -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } - - if (is_EOL(ch)) { - readLineBreak(state); - - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - - return lineBreaks; -} - -function testDocumentSeparator(state) { - var _position = state.position, - ch; - - ch = state.input.charCodeAt(_position); - - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { - - _position += 3; - - ch = state.input.charCodeAt(_position); - - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; -} - -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} - - -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; - - ch = state.input.charCodeAt(state.position); - - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; - } - - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } - - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); - - if (is_WS_OR_EOL(preceding)) { - break; - } - - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); - - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } - - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; - } - - state.kind = _kind; - state.result = _result; - return false; -} - -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x27/* ' */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} - -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x22/* " */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); - - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; - - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); - - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - - } else { - throwError(state, 'expected hexadecimal character'); - } - } - - state.result += charFromCodepoint(hexResult); - - state.position++; - - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} - -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = {}, - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } - - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; - - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); - } else { - _result.push(keyNode); - } - - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - - throwError(state, 'unexpected end of the stream within a flow collection'); -} - -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - - } else { - break; - } - } - - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } - - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - - ch = state.input.charCodeAt(state.position); - - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - - if (is_EOL(ch)) { - emptyLines++; - continue; - } - - // End of the scalar. - if (state.lineIndent < textIndent) { - - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } - - // Break this `while` cycle and go to the funciton's epilogue. - break; - } - - // Folded style: use fancy rules to handle line breaks. - if (folding) { - - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } - - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } - - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } - - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, state.position, false); - } - - return true; -} - -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - - if (ch !== 0x2D/* - */) { - break; - } - - following = state.input.charCodeAt(state.position + 1); - - if (!is_WS_OR_EOL(following)) { - break; - } - - detected = true; - state.position++; - - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} - -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _pos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = {}, - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - _pos = state.position; - - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = true; - allowCompact = true; - - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } - - state.position += 1; - ch = following; - - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { - - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); - - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); - - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else { - break; // Reading is done. Go to the epilogue. - } - - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } - - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); - keyTag = keyNode = valueNode = null; - } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - } - - if (state.lineIndent > nodeIndent && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } + }, + handler + ) } - // - // Epilogue. - // - - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); + async [kClose] () { + await this[kAgent].close() + await this[kClient].close() } - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; + async [kDestroy] () { + await this[kAgent].destroy() + await this[kClient].destroy() } - - return detected; } -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x21/* ! */) return false; - - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } - - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - - } else { - tagHandle = '!'; - } - - _position = state.position; - - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); - - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); - - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } - - ch = state.input.charCodeAt(++state.position); - } - - tagName = state.input.slice(_position, state.position); +/** + * @param {string[] | Record} headers + * @returns {Record} + */ +function buildHeaders (headers) { + // When using undici.fetch, the headers list is stored + // as an array. + if (Array.isArray(headers)) { + /** @type {Record} */ + const headersPair = {} - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); + for (let i = 0; i < headers.length; i += 2) { + headersPair[headers[i]] = headers[i + 1] } - } - - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - - if (isVerbatim) { - state.tag = tagName; - - } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - - } else if (tagHandle === '!') { - state.tag = '!' + tagName; - - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } - - return true; -} - -function readAnchorProperty(state) { - var _position, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x26/* & */) return false; - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - - state.anchor = state.input.slice(_position, state.position); - return true; -} - -function readAlias(state) { - var _position, alias, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x2A/* * */) return false; - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } - - alias = state.input.slice(_position, state.position); - - if (!state.anchorMap.hasOwnProperty(alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); + return headersPair } - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; + return headers } -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } - - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } - - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - - } else if (readAlias(state)) { - hasContent = true; - - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } - - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; - - if (state.tag === null) { - state.tag = '?'; - } - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } - - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } - - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; - - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; - - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - - if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - } - - if (state.listener !== null) { - state.listener('close', state); +/** + * @param {Record} headers + * + * Previous versions of ProxyAgent suggests the Proxy-Authorization in request headers + * Nevertheless, it was changed and to avoid a security vulnerability by end users + * this check was created. + * It should be removed in the next major version for performance reasons + */ +function throwIfProxyAuthIsSent (headers) { + const existProxyAuth = headers && Object.keys(headers) + .find((key) => key.toLowerCase() === 'proxy-authorization') + if (existProxyAuth) { + throw new InvalidArgumentError('Proxy-Authorization should be sent in ProxyAgent constructor') } - return state.tag !== null || state.anchor !== null || hasContent; } -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); +module.exports = ProxyAgent - ch = state.input.charCodeAt(state.position); - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } +/***/ }), - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; +/***/ 29459: +/***/ ((module) => { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } +"use strict"; - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } +let fastNow = Date.now() +let fastNowTimeout - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } +const fastTimers = [] - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } +function onTimeout () { + fastNow = Date.now() - if (is_EOL(ch)) break; + let len = fastTimers.length + let idx = 0 + while (idx < len) { + const timer = fastTimers[idx] - _position = state.position; + if (timer.state === 0) { + timer.state = fastNow + timer.delay + } else if (timer.state > 0 && fastNow >= timer.state) { + timer.state = -1 + timer.callback(timer.opaque) + } - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); + if (timer.state === -1) { + timer.state = -2 + if (idx !== len - 1) { + fastTimers[idx] = fastTimers.pop() + } else { + fastTimers.pop() } - - directiveArgs.push(state.input.slice(_position, state.position)); + len -= 1 + } else { + idx += 1 } + } - if (ch !== 0) readLineBreak(state); + if (fastTimers.length > 0) { + refreshTimeout() + } +} - if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); +function refreshTimeout () { + if (fastNowTimeout && fastNowTimeout.refresh) { + fastNowTimeout.refresh() + } else { + clearTimeout(fastNowTimeout) + fastNowTimeout = setTimeout(onTimeout, 1e3) + if (fastNowTimeout.unref) { + fastNowTimeout.unref() } } +} - skipSeparationSpace(state, true, -1); +class Timeout { + constructor (callback, delay, opaque) { + this.callback = callback + this.delay = delay + this.opaque = opaque - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); + // -2 not in timer list + // -1 in timer list but inactive + // 0 in timer list waiting for time + // > 0 in timer list waiting for time to expire + this.state = -2 - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); + this.refresh() } - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); + refresh () { + if (this.state === -2) { + fastTimers.push(this) + if (!fastNowTimeout || fastTimers.length === 1) { + refreshTimeout() + } + } - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + this.state = 0 } - state.documents.push(state.result); - - if (state.position === state.lineStart && testDocumentSeparator(state)) { - - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; + clear () { + this.state = -1 } +} - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; +module.exports = { + setTimeout (callback, delay, opaque) { + return delay < 1e3 + ? setTimeout(callback, delay, opaque) + : new Timeout(callback, delay, opaque) + }, + clearTimeout (timeout) { + if (timeout instanceof Timeout) { + timeout.clear() + } else { + clearTimeout(timeout) + } } } -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } - - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } +/***/ }), - var state = new State(input, options); +/***/ 35354: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - var nullpos = input.indexOf('\0'); +"use strict"; - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; +const diagnosticsChannel = __nccwpck_require__(67643) +const { uid, states } = __nccwpck_require__(19188) +const { + kReadyState, + kSentClose, + kByteParser, + kReceivedClose +} = __nccwpck_require__(37578) +const { fireEvent, failWebsocketConnection } = __nccwpck_require__(25515) +const { CloseEvent } = __nccwpck_require__(52611) +const { makeRequest } = __nccwpck_require__(48359) +const { fetching } = __nccwpck_require__(74881) +const { Headers } = __nccwpck_require__(10554) +const { getGlobalDispatcher } = __nccwpck_require__(21892) +const { kHeadersList } = __nccwpck_require__(72785) - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } +const channels = {} +channels.open = diagnosticsChannel.channel('undici:websocket:open') +channels.close = diagnosticsChannel.channel('undici:websocket:close') +channels.socketError = diagnosticsChannel.channel('undici:websocket:socket_error') - while (state.position < (state.length - 1)) { - readDocument(state); - } +/** @type {import('crypto')} */ +let crypto +try { + crypto = __nccwpck_require__(6113) +} catch { - return state.documents; } +/** + * @see https://websockets.spec.whatwg.org/#concept-websocket-establish + * @param {URL} url + * @param {string|string[]} protocols + * @param {import('./websocket').WebSocket} ws + * @param {(response: any) => void} onEstablish + * @param {Partial} options + */ +function establishWebSocketConnection (url, protocols, ws, onEstablish, options) { + // 1. Let requestURL be a copy of url, with its scheme set to "http", if url’s + // scheme is "ws", and to "https" otherwise. + const requestURL = url -function loadAll(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } + requestURL.protocol = url.protocol === 'ws:' ? 'http:' : 'https:' - var documents = loadDocuments(input, options); + // 2. Let request be a new request, whose URL is requestURL, client is client, + // service-workers mode is "none", referrer is "no-referrer", mode is + // "websocket", credentials mode is "include", cache mode is "no-store" , + // and redirect mode is "error". + const request = makeRequest({ + urlList: [requestURL], + serviceWorkers: 'none', + referrer: 'no-referrer', + mode: 'websocket', + credentials: 'include', + cache: 'no-store', + redirect: 'error' + }) - if (typeof iterator !== 'function') { - return documents; - } + // Note: undici extension, allow setting custom headers. + if (options.headers) { + const headersList = new Headers(options.headers)[kHeadersList] - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); + request.headersList = headersList } -} + // 3. Append (`Upgrade`, `websocket`) to request’s header list. + // 4. Append (`Connection`, `Upgrade`) to request’s header list. + // Note: both of these are handled by undici currently. + // https://github.com/nodejs/undici/blob/68c269c4144c446f3f1220951338daef4a6b5ec4/lib/client.js#L1397 -function load(input, options) { - var documents = loadDocuments(input, options); + // 5. Let keyValue be a nonce consisting of a randomly selected + // 16-byte value that has been forgiving-base64-encoded and + // isomorphic encoded. + const keyValue = crypto.randomBytes(16).toString('base64') - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new YAMLException('expected a single document in the stream, but found more'); -} + // 6. Append (`Sec-WebSocket-Key`, keyValue) to request’s + // header list. + request.headersList.append('sec-websocket-key', keyValue) + // 7. Append (`Sec-WebSocket-Version`, `13`) to request’s + // header list. + request.headersList.append('sec-websocket-version', '13') -function safeLoadAll(input, iterator, options) { - if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { - options = iterator; - iterator = null; + // 8. For each protocol in protocols, combine + // (`Sec-WebSocket-Protocol`, protocol) in request’s header + // list. + for (const protocol of protocols) { + request.headersList.append('sec-websocket-protocol', protocol) } - return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} + // 9. Let permessageDeflate be a user-agent defined + // "permessage-deflate" extension header value. + // https://github.com/mozilla/gecko-dev/blob/ce78234f5e653a5d3916813ff990f053510227bc/netwerk/protocol/websocket/WebSocketChannel.cpp#L2673 + // TODO: enable once permessage-deflate is supported + const permessageDeflate = '' // 'permessage-deflate; 15' + // 10. Append (`Sec-WebSocket-Extensions`, permessageDeflate) to + // request’s header list. + // request.headersList.append('sec-websocket-extensions', permessageDeflate) -function safeLoad(input, options) { - return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options)); -} + // 11. Fetch request with useParallelQueue set to true, and + // processResponse given response being these steps: + const controller = fetching({ + request, + useParallelQueue: true, + dispatcher: options.dispatcher ?? getGlobalDispatcher(), + processResponse (response) { + // 1. If response is a network error or its status is not 101, + // fail the WebSocket connection. + if (response.type === 'error' || response.status !== 101) { + failWebsocketConnection(ws, 'Received network error or non-101 status code.') + return + } + // 2. If protocols is not the empty list and extracting header + // list values given `Sec-WebSocket-Protocol` and response’s + // header list results in null, failure, or the empty byte + // sequence, then fail the WebSocket connection. + if (protocols.length !== 0 && !response.headersList.get('Sec-WebSocket-Protocol')) { + failWebsocketConnection(ws, 'Server did not respond with sent protocols.') + return + } -module.exports.loadAll = loadAll; -module.exports.load = load; -module.exports.safeLoadAll = safeLoadAll; -module.exports.safeLoad = safeLoad; + // 3. Follow the requirements stated step 2 to step 6, inclusive, + // of the last set of steps in section 4.1 of The WebSocket + // Protocol to validate response. This either results in fail + // the WebSocket connection or the WebSocket connection is + // established. + // 2. If the response lacks an |Upgrade| header field or the |Upgrade| + // header field contains a value that is not an ASCII case- + // insensitive match for the value "websocket", the client MUST + // _Fail the WebSocket Connection_. + if (response.headersList.get('Upgrade')?.toLowerCase() !== 'websocket') { + failWebsocketConnection(ws, 'Server did not set Upgrade header to "websocket".') + return + } -/***/ }), + // 3. If the response lacks a |Connection| header field or the + // |Connection| header field doesn't contain a token that is an + // ASCII case-insensitive match for the value "Upgrade", the client + // MUST _Fail the WebSocket Connection_. + if (response.headersList.get('Connection')?.toLowerCase() !== 'upgrade') { + failWebsocketConnection(ws, 'Server did not set Connection header to "upgrade".') + return + } -/***/ 77262: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 4. If the response lacks a |Sec-WebSocket-Accept| header field or + // the |Sec-WebSocket-Accept| contains a value other than the + // base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket- + // Key| (as a string, not base64-decoded) with the string "258EAFA5- + // E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and + // trailing whitespace, the client MUST _Fail the WebSocket + // Connection_. + const secWSAccept = response.headersList.get('Sec-WebSocket-Accept') + const digest = crypto.createHash('sha1').update(keyValue + uid).digest('base64') + if (secWSAccept !== digest) { + failWebsocketConnection(ws, 'Incorrect hash received in Sec-WebSocket-Accept header.') + return + } -"use strict"; + // 5. If the response includes a |Sec-WebSocket-Extensions| header + // field and this header field indicates the use of an extension + // that was not present in the client's handshake (the server has + // indicated an extension not requested by the client), the client + // MUST _Fail the WebSocket Connection_. (The parsing of this + // header field to determine which extensions are requested is + // discussed in Section 9.1.) + const secExtension = response.headersList.get('Sec-WebSocket-Extensions') + if (secExtension !== null && secExtension !== permessageDeflate) { + failWebsocketConnection(ws, 'Received different permessage-deflate than the one set.') + return + } + // 6. If the response includes a |Sec-WebSocket-Protocol| header field + // and this header field indicates the use of a subprotocol that was + // not present in the client's handshake (the server has indicated a + // subprotocol not requested by the client), the client MUST _Fail + // the WebSocket Connection_. + const secProtocol = response.headersList.get('Sec-WebSocket-Protocol') -var common = __nccwpck_require__(59941); + if (secProtocol !== null && secProtocol !== request.headersList.get('Sec-WebSocket-Protocol')) { + failWebsocketConnection(ws, 'Protocol was not set in the opening handshake.') + return + } + response.socket.on('data', onSocketData) + response.socket.on('close', onSocketClose) + response.socket.on('error', onSocketError) -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; -} + if (channels.open.hasSubscribers) { + channels.open.publish({ + address: response.socket.address(), + protocol: secProtocol, + extensions: secExtension + }) + } + onEstablish(response) + } + }) -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; + return controller +} - if (!this.buffer) return null; +/** + * @param {Buffer} chunk + */ +function onSocketData (chunk) { + if (!this.ws[kByteParser].write(chunk)) { + this.pause() + } +} - indent = indent || 4; - maxLength = maxLength || 75; +/** + * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol + * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.4 + */ +function onSocketClose () { + const { ws } = this - head = ''; - start = this.position; + // If the TCP connection was closed after the + // WebSocket closing handshake was completed, the WebSocket connection + // is said to have been closed _cleanly_. + const wasClean = ws[kSentClose] && ws[kReceivedClose] - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; - } - } + let code = 1005 + let reason = '' - tail = ''; - end = this.position; + const result = ws[kByteParser].closingInfo - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; - } + if (result) { + code = result.code ?? 1005 + reason = result.reason + } else if (!ws[kSentClose]) { + // If _The WebSocket + // Connection is Closed_ and no Close control frame was received by the + // endpoint (such as could occur if the underlying transport connection + // is lost), _The WebSocket Connection Close Code_ is considered to be + // 1006. + code = 1006 } - snippet = this.buffer.slice(start, end); - - return common.repeat(' ', indent) + head + snippet + tail + '\n' + - common.repeat(' ', indent + this.position - start + head.length) + '^'; -}; + // 1. Change the ready state to CLOSED (3). + ws[kReadyState] = states.CLOSED + // 2. If the user agent was required to fail the WebSocket + // connection, or if the WebSocket connection was closed + // after being flagged as full, fire an event named error + // at the WebSocket object. + // TODO -Mark.prototype.toString = function toString(compact) { - var snippet, where = ''; + // 3. Fire an event named close at the WebSocket object, + // using CloseEvent, with the wasClean attribute + // initialized to true if the connection closed cleanly + // and false otherwise, the code attribute initialized to + // the WebSocket connection close code, and the reason + // attribute initialized to the result of applying UTF-8 + // decode without BOM to the WebSocket connection close + // reason. + fireEvent('close', ws, CloseEvent, { + wasClean, code, reason + }) - if (this.name) { - where += 'in "' + this.name + '" '; + if (channels.close.hasSubscribers) { + channels.close.publish({ + websocket: ws, + code, + reason + }) } +} - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); +function onSocketError (error) { + const { ws } = this - if (!compact) { - snippet = this.getSnippet(); + ws[kReadyState] = states.CLOSING - if (snippet) { - where += ':\n' + snippet; - } + if (channels.socketError.hasSubscribers) { + channels.socketError.publish(error) } - return where; -}; - + this.destroy() +} -module.exports = Mark; +module.exports = { + establishWebSocketConnection +} /***/ }), -/***/ 66280: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 19188: +/***/ ((module) => { "use strict"; -/*eslint-disable max-len*/ - -var common = __nccwpck_require__(59941); -var YAMLException = __nccwpck_require__(29291); -var Type = __nccwpck_require__(90256); - - -function compileList(schema, name, result) { - var exclude = []; - - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); +// This is a Globally Unique Identifier unique used +// to validate that the endpoint accepts websocket +// connections. +// See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3 +const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); - } - }); +/** @type {PropertyDescriptor} */ +const staticPropertyDescriptors = { + enumerable: true, + writable: false, + configurable: false +} - result.push(currentType); - }); +const states = { + CONNECTING: 0, + OPEN: 1, + CLOSING: 2, + CLOSED: 3 +} - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); +const opcodes = { + CONTINUATION: 0x0, + TEXT: 0x1, + BINARY: 0x2, + CLOSE: 0x8, + PING: 0x9, + PONG: 0xA } +const maxUnsigned16Bit = 2 ** 16 - 1 // 65535 -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, index, length; +const parserStates = { + INFO: 0, + PAYLOADLENGTH_16: 2, + PAYLOADLENGTH_64: 3, + READ_DATA: 4 +} - function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; - } +const emptyBuffer = Buffer.allocUnsafe(0) - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - return result; +module.exports = { + uid, + staticPropertyDescriptors, + states, + opcodes, + maxUnsigned16Bit, + parserStates, + emptyBuffer } -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; +/***/ }), - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - }); +/***/ 52611: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); -} +"use strict"; -Schema.DEFAULT = null; +const { webidl } = __nccwpck_require__(21744) +const { kEnumerableProperty } = __nccwpck_require__(83983) +const { MessagePort } = __nccwpck_require__(71267) +/** + * @see https://html.spec.whatwg.org/multipage/comms.html#messageevent + */ +class MessageEvent extends Event { + #eventInit -Schema.create = function createSchema() { - var schemas, types; + constructor (type, eventInitDict = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent constructor' }) - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.MessageEventInit(eventInitDict) - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; + super(type, eventInitDict) - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); + this.#eventInit = eventInitDict } - schemas = common.toArray(schemas); - types = common.toArray(types); + get data () { + webidl.brandCheck(this, MessageEvent) - if (!schemas.every(function (schema) { return schema instanceof Schema; })) { - throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); + return this.#eventInit.data } - if (!types.every(function (type) { return type instanceof Type; })) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } + get origin () { + webidl.brandCheck(this, MessageEvent) - return new Schema({ - include: schemas, - explicit: types - }); -}; + return this.#eventInit.origin + } + get lastEventId () { + webidl.brandCheck(this, MessageEvent) -module.exports = Schema; + return this.#eventInit.lastEventId + } + get source () { + webidl.brandCheck(this, MessageEvent) -/***/ }), + return this.#eventInit.source + } -/***/ 11950: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get ports () { + webidl.brandCheck(this, MessageEvent) -"use strict"; -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, Core schema has no distinctions from JSON schema is JS-YAML. + if (!Object.isFrozen(this.#eventInit.ports)) { + Object.freeze(this.#eventInit.ports) + } + return this.#eventInit.ports + } + initMessageEvent ( + type, + bubbles = false, + cancelable = false, + data = null, + origin = '', + lastEventId = '', + source = null, + ports = [] + ) { + webidl.brandCheck(this, MessageEvent) + webidl.argumentLengthCheck(arguments, 1, { header: 'MessageEvent.initMessageEvent' }) + return new MessageEvent(type, { + bubbles, cancelable, data, origin, lastEventId, source, ports + }) + } +} -var Schema = __nccwpck_require__(66280); +/** + * @see https://websockets.spec.whatwg.org/#the-closeevent-interface + */ +class CloseEvent extends Event { + #eventInit + constructor (type, eventInitDict = {}) { + webidl.argumentLengthCheck(arguments, 1, { header: 'CloseEvent constructor' }) -module.exports = new Schema({ - include: [ - __nccwpck_require__(2168) - ] -}); + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.CloseEventInit(eventInitDict) + super(type, eventInitDict) -/***/ }), + this.#eventInit = eventInitDict + } -/***/ 145: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get wasClean () { + webidl.brandCheck(this, CloseEvent) -"use strict"; -// JS-YAML's default schema for `load` function. -// It is not described in the YAML specification. -// -// This schema is based on JS-YAML's default safe schema and includes -// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. -// -// Also this schema is used as default base schema at `Schema.create` function. + return this.#eventInit.wasClean + } + get code () { + webidl.brandCheck(this, CloseEvent) + return this.#eventInit.code + } + get reason () { + webidl.brandCheck(this, CloseEvent) + return this.#eventInit.reason + } +} -var Schema = __nccwpck_require__(66280); +// https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface +class ErrorEvent extends Event { + #eventInit + constructor (type, eventInitDict) { + webidl.argumentLengthCheck(arguments, 1, { header: 'ErrorEvent constructor' }) -module.exports = Schema.DEFAULT = new Schema({ - include: [ - __nccwpck_require__(42881) - ], - explicit: [ - __nccwpck_require__(34801), - __nccwpck_require__(77234), - __nccwpck_require__(35361) - ] -}); + super(type, eventInitDict) + type = webidl.converters.DOMString(type) + eventInitDict = webidl.converters.ErrorEventInit(eventInitDict ?? {}) -/***/ }), + this.#eventInit = eventInitDict + } -/***/ 42881: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get message () { + webidl.brandCheck(this, ErrorEvent) -"use strict"; -// JS-YAML's default schema for `safeLoad` function. -// It is not described in the YAML specification. -// -// This schema is based on standard YAML's Core schema and includes most of -// extra types described at YAML tag repository. (http://yaml.org/type/) + return this.#eventInit.message + } + get filename () { + webidl.brandCheck(this, ErrorEvent) + return this.#eventInit.filename + } + get lineno () { + webidl.brandCheck(this, ErrorEvent) + return this.#eventInit.lineno + } -var Schema = __nccwpck_require__(66280); + get colno () { + webidl.brandCheck(this, ErrorEvent) + return this.#eventInit.colno + } -module.exports = new Schema({ - include: [ - __nccwpck_require__(11950) - ], - implicit: [ - __nccwpck_require__(82018), - __nccwpck_require__(60194) - ], - explicit: [ - __nccwpck_require__(21716), - __nccwpck_require__(96439), - __nccwpck_require__(33730), - __nccwpck_require__(9047) - ] -}); + get error () { + webidl.brandCheck(this, ErrorEvent) + return this.#eventInit.error + } +} -/***/ }), +Object.defineProperties(MessageEvent.prototype, { + [Symbol.toStringTag]: { + value: 'MessageEvent', + configurable: true + }, + data: kEnumerableProperty, + origin: kEnumerableProperty, + lastEventId: kEnumerableProperty, + source: kEnumerableProperty, + ports: kEnumerableProperty, + initMessageEvent: kEnumerableProperty +}) -/***/ 70026: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +Object.defineProperties(CloseEvent.prototype, { + [Symbol.toStringTag]: { + value: 'CloseEvent', + configurable: true + }, + reason: kEnumerableProperty, + code: kEnumerableProperty, + wasClean: kEnumerableProperty +}) -"use strict"; -// Standard YAML's Failsafe schema. -// http://www.yaml.org/spec/1.2/spec.html#id2802346 +Object.defineProperties(ErrorEvent.prototype, { + [Symbol.toStringTag]: { + value: 'ErrorEvent', + configurable: true + }, + message: kEnumerableProperty, + filename: kEnumerableProperty, + lineno: kEnumerableProperty, + colno: kEnumerableProperty, + error: kEnumerableProperty +}) +webidl.converters.MessagePort = webidl.interfaceConverter(MessagePort) +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.MessagePort +) +const eventInit = [ + { + key: 'bubbles', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'cancelable', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'composed', + converter: webidl.converters.boolean, + defaultValue: false + } +] +webidl.converters.MessageEventInit = webidl.dictionaryConverter([ + ...eventInit, + { + key: 'data', + converter: webidl.converters.any, + defaultValue: null + }, + { + key: 'origin', + converter: webidl.converters.USVString, + defaultValue: '' + }, + { + key: 'lastEventId', + converter: webidl.converters.DOMString, + defaultValue: '' + }, + { + key: 'source', + // Node doesn't implement WindowProxy or ServiceWorker, so the only + // valid value for source is a MessagePort. + converter: webidl.nullableConverter(webidl.converters.MessagePort), + defaultValue: null + }, + { + key: 'ports', + converter: webidl.converters['sequence'], + get defaultValue () { + return [] + } + } +]) -var Schema = __nccwpck_require__(66280); +webidl.converters.CloseEventInit = webidl.dictionaryConverter([ + ...eventInit, + { + key: 'wasClean', + converter: webidl.converters.boolean, + defaultValue: false + }, + { + key: 'code', + converter: webidl.converters['unsigned short'], + defaultValue: 0 + }, + { + key: 'reason', + converter: webidl.converters.USVString, + defaultValue: '' + } +]) +webidl.converters.ErrorEventInit = webidl.dictionaryConverter([ + ...eventInit, + { + key: 'message', + converter: webidl.converters.DOMString, + defaultValue: '' + }, + { + key: 'filename', + converter: webidl.converters.USVString, + defaultValue: '' + }, + { + key: 'lineno', + converter: webidl.converters['unsigned long'], + defaultValue: 0 + }, + { + key: 'colno', + converter: webidl.converters['unsigned long'], + defaultValue: 0 + }, + { + key: 'error', + converter: webidl.converters.any + } +]) -module.exports = new Schema({ - explicit: [ - __nccwpck_require__(24649), - __nccwpck_require__(65629), - __nccwpck_require__(15938) - ] -}); +module.exports = { + MessageEvent, + CloseEvent, + ErrorEvent +} /***/ }), -/***/ 2168: +/***/ 25444: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - - - -var Schema = __nccwpck_require__(66280); - - -module.exports = new Schema({ - include: [ - __nccwpck_require__(70026) - ], - implicit: [ - __nccwpck_require__(26058), - __nccwpck_require__(93195), - __nccwpck_require__(76865), - __nccwpck_require__(16480) - ] -}); +const { maxUnsigned16Bit } = __nccwpck_require__(19188) +/** @type {import('crypto')} */ +let crypto +try { + crypto = __nccwpck_require__(6113) +} catch { -/***/ }), +} -/***/ 90256: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +class WebsocketFrameSend { + /** + * @param {Buffer|undefined} data + */ + constructor (data) { + this.frameData = data + this.maskKey = crypto.randomBytes(4) + } -"use strict"; + createFrame (opcode) { + const bodyLength = this.frameData?.byteLength ?? 0 + /** @type {number} */ + let payloadLength = bodyLength // 0-125 + let offset = 6 -var YAMLException = __nccwpck_require__(29291); + if (bodyLength > maxUnsigned16Bit) { + offset += 8 // payload length is next 8 bytes + payloadLength = 127 + } else if (bodyLength > 125) { + offset += 2 // payload length is next 2 bytes + payloadLength = 126 + } -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'defaultStyle', - 'styleAliases' -]; + const buffer = Buffer.allocUnsafe(bodyLength + offset) -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; + // Clear first 2 bytes, everything else is overwritten + buffer[0] = buffer[1] = 0 + buffer[0] |= 0x80 // FIN + buffer[0] = (buffer[0] & 0xF0) + opcode // opcode -function compileStyleAliases(map) { - var result = {}; + /*! ws. MIT License. Einar Otto Stangvik */ + buffer[offset - 4] = this.maskKey[0] + buffer[offset - 3] = this.maskKey[1] + buffer[offset - 2] = this.maskKey[2] + buffer[offset - 1] = this.maskKey[3] - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } + buffer[1] = payloadLength - return result; -} + if (payloadLength === 126) { + buffer.writeUInt16BE(bodyLength, 2) + } else if (payloadLength === 127) { + // Clear extended payload length + buffer[2] = buffer[3] = 0 + buffer.writeUIntBE(bodyLength, 4, 6) + } -function Type(tag, options) { - options = options || {}; + buffer[1] |= 0x80 // MASK - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + // mask body + for (let i = 0; i < bodyLength; i++) { + buffer[offset + i] = this.frameData[i] ^ this.maskKey[i % 4] } - }); - - // TODO: Add tag format check. - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + return buffer } } -module.exports = Type; +module.exports = { + WebsocketFrameSend +} /***/ }), -/***/ 21716: +/***/ 11688: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -/*eslint-disable no-bitwise*/ - -var NodeBuffer; - -try { - // A trick for browserified version, to not include `Buffer` shim - var _require = require; - NodeBuffer = _require('buffer').Buffer; -} catch (__) {} - -var Type = __nccwpck_require__(90256); - - -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; +const { Writable } = __nccwpck_require__(12781) +const diagnosticsChannel = __nccwpck_require__(67643) +const { parserStates, opcodes, states, emptyBuffer } = __nccwpck_require__(19188) +const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(37578) +const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(25515) +const { WebsocketFrameSend } = __nccwpck_require__(25444) +// This code was influenced by ws released under the MIT license. +// Copyright (c) 2011 Einar Otto Stangvik +// Copyright (c) 2013 Arnout Kazemier and contributors +// Copyright (c) 2016 Luigi Pinca and contributors -function resolveYamlBinary(data) { - if (data === null) return false; +const channels = {} +channels.ping = diagnosticsChannel.channel('undici:websocket:ping') +channels.pong = diagnosticsChannel.channel('undici:websocket:pong') - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; +class ByteParser extends Writable { + #buffers = [] + #byteOffset = 0 - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); + #state = parserStates.INFO - // Skip CR/LF - if (code > 64) continue; + #info = {} + #fragments = [] - // Fail on illegal characters - if (code < 0) return false; + constructor (ws) { + super() - bitlen += 6; + this.ws = ws } - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; -} - -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; - - // Collect by 6*4 bits (3 bytes) - - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } + /** + * @param {Buffer} chunk + * @param {() => void} callback + */ + _write (chunk, _, callback) { + this.#buffers.push(chunk) + this.#byteOffset += chunk.length - bits = (bits << 6) | map.indexOf(input.charAt(idx)); + this.run(callback) } - // Dump tail - - tailbits = (max % 4) * 6; - - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } + /** + * Runs whenever a new chunk is received. + * Callback is called whenever there are no more chunks buffering, + * or not enough bytes are buffered to parse. + */ + run (callback) { + while (true) { + if (this.#state === parserStates.INFO) { + // If there aren't enough bytes to parse the payload length, etc. + if (this.#byteOffset < 2) { + return callback() + } - // Wrap into Buffer for NodeJS and leave Array for browser - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); - } + const buffer = this.consume(2) - return result; -} + this.#info.fin = (buffer[0] & 0x80) !== 0 + this.#info.opcode = buffer[0] & 0x0F -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; + // If we receive a fragmented message, we use the type of the first + // frame to parse the full message as binary/text, when it's terminated + this.#info.originalOpcode ??= this.#info.opcode - // Convert every three bytes to 4 ASCII characters. + this.#info.fragmented = !this.#info.fin && this.#info.opcode !== opcodes.CONTINUATION - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } + if (this.#info.fragmented && this.#info.opcode !== opcodes.BINARY && this.#info.opcode !== opcodes.TEXT) { + // Only text and binary frames can be fragmented + failWebsocketConnection(this.ws, 'Invalid frame type was fragmented.') + return + } - bits = (bits << 8) + object[idx]; - } + const payloadLength = buffer[1] & 0x7F - // Dump tail + if (payloadLength <= 125) { + this.#info.payloadLength = payloadLength + this.#state = parserStates.READ_DATA + } else if (payloadLength === 126) { + this.#state = parserStates.PAYLOADLENGTH_16 + } else if (payloadLength === 127) { + this.#state = parserStates.PAYLOADLENGTH_64 + } - tail = max % 3; + if (this.#info.fragmented && payloadLength > 125) { + // A fragmented frame can't be fragmented itself + failWebsocketConnection(this.ws, 'Fragmented frame exceeded 125 bytes.') + return + } else if ( + (this.#info.opcode === opcodes.PING || + this.#info.opcode === opcodes.PONG || + this.#info.opcode === opcodes.CLOSE) && + payloadLength > 125 + ) { + // Control frames can have a payload length of 125 bytes MAX + failWebsocketConnection(this.ws, 'Payload length for control frame exceeded 125 bytes.') + return + } else if (this.#info.opcode === opcodes.CLOSE) { + if (payloadLength === 1) { + failWebsocketConnection(this.ws, 'Received close frame with a 1-byte body.') + return + } - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } + const body = this.consume(payloadLength) - return result; -} + this.#info.closeInfo = this.parseCloseBody(false, body) -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); -} + if (!this.ws[kSentClose]) { + // If an endpoint receives a Close frame and did not previously send a + // Close frame, the endpoint MUST send a Close frame in response. (When + // sending a Close frame in response, the endpoint typically echos the + // status code it received.) + const body = Buffer.allocUnsafe(2) + body.writeUInt16BE(this.#info.closeInfo.code, 0) + const closeFrame = new WebsocketFrameSend(body) -module.exports = new Type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); + this.ws[kResponse].socket.write( + closeFrame.createFrame(opcodes.CLOSE), + (err) => { + if (!err) { + this.ws[kSentClose] = true + } + } + ) + } + // Upon either sending or receiving a Close control frame, it is said + // that _The WebSocket Closing Handshake is Started_ and that the + // WebSocket connection is in the CLOSING state. + this.ws[kReadyState] = states.CLOSING + this.ws[kReceivedClose] = true -/***/ }), + this.end() -/***/ 93195: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + return + } else if (this.#info.opcode === opcodes.PING) { + // Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in + // response, unless it already received a Close frame. + // A Pong frame sent in response to a Ping frame must have identical + // "Application data" -"use strict"; + const body = this.consume(payloadLength) + if (!this.ws[kReceivedClose]) { + const frame = new WebsocketFrameSend(body) -var Type = __nccwpck_require__(90256); + this.ws[kResponse].socket.write(frame.createFrame(opcodes.PONG)) -function resolveYamlBoolean(data) { - if (data === null) return false; + if (channels.ping.hasSubscribers) { + channels.ping.publish({ + payload: body + }) + } + } - var max = data.length; + this.#state = parserStates.INFO - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} + if (this.#byteOffset > 0) { + continue + } else { + callback() + return + } + } else if (this.#info.opcode === opcodes.PONG) { + // A Pong frame MAY be sent unsolicited. This serves as a + // unidirectional heartbeat. A response to an unsolicited Pong frame is + // not expected. -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} + const body = this.consume(payloadLength) -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} + if (channels.pong.hasSubscribers) { + channels.pong.publish({ + payload: body + }) + } -module.exports = new Type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); + if (this.#byteOffset > 0) { + continue + } else { + callback() + return + } + } + } else if (this.#state === parserStates.PAYLOADLENGTH_16) { + if (this.#byteOffset < 2) { + return callback() + } + const buffer = this.consume(2) -/***/ }), + this.#info.payloadLength = buffer.readUInt16BE(0) + this.#state = parserStates.READ_DATA + } else if (this.#state === parserStates.PAYLOADLENGTH_64) { + if (this.#byteOffset < 8) { + return callback() + } -/***/ 16480: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + const buffer = this.consume(8) + const upper = buffer.readUInt32BE(0) -"use strict"; + // 2^31 is the maxinimum bytes an arraybuffer can contain + // on 32-bit systems. Although, on 64-bit systems, this is + // 2^53-1 bytes. + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length + // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/common/globals.h;drc=1946212ac0100668f14eb9e2843bdd846e510a1e;bpv=1;bpt=1;l=1275 + // https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-array-buffer.h;l=34;drc=1946212ac0100668f14eb9e2843bdd846e510a1e + if (upper > 2 ** 31 - 1) { + failWebsocketConnection(this.ws, 'Received payload length > 2^31 bytes.') + return + } + const lower = buffer.readUInt32BE(4) -var common = __nccwpck_require__(59941); -var Type = __nccwpck_require__(90256); + this.#info.payloadLength = (upper << 8) + lower + this.#state = parserStates.READ_DATA + } else if (this.#state === parserStates.READ_DATA) { + if (this.#byteOffset < this.#info.payloadLength) { + // If there is still more data in this chunk that needs to be read + return callback() + } else if (this.#byteOffset >= this.#info.payloadLength) { + // If the server sent multiple frames in a single chunk -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // 20:59 - '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); + const body = this.consume(this.#info.payloadLength) -function resolveYamlFloat(data) { - if (data === null) return false; + this.#fragments.push(body) - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; - } + // If the frame is unfragmented, or a fragmented frame was terminated, + // a message was received + if (!this.#info.fragmented || (this.#info.fin && this.#info.opcode === opcodes.CONTINUATION)) { + const fullMessage = Buffer.concat(this.#fragments) - return true; -} + websocketMessageReceived(this.ws, this.#info.originalOpcode, fullMessage) -function constructYamlFloat(data) { - var value, sign, base, digits; + this.#info = {} + this.#fragments.length = 0 + } - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - digits = []; + this.#state = parserStates.INFO + } + } - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); + if (this.#byteOffset > 0) { + continue + } else { + callback() + break + } + } } - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + /** + * Take n bytes from the buffered Buffers + * @param {number} n + * @returns {Buffer|null} + */ + consume (n) { + if (n > this.#byteOffset) { + return null + } else if (n === 0) { + return emptyBuffer + } - } else if (value === '.nan') { - return NaN; + if (this.#buffers[0].length === n) { + this.#byteOffset -= this.#buffers[0].length + return this.#buffers.shift() + } - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); + const buffer = Buffer.allocUnsafe(n) + let offset = 0 - value = 0.0; - base = 1; + while (offset !== n) { + const next = this.#buffers[0] + const { length } = next - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); + if (length + offset === n) { + buffer.set(this.#buffers.shift(), offset) + break + } else if (length + offset > n) { + buffer.set(next.subarray(0, n - offset), offset) + this.#buffers[0] = next.subarray(n - offset) + break + } else { + buffer.set(this.#buffers.shift(), offset) + offset += next.length + } + } - return sign * value; + this.#byteOffset -= n + return buffer } - return sign * parseFloat(value, 10); -} + parseCloseBody (onlyCode, data) { + // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5 + /** @type {number|undefined} */ + let code -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + if (data.length >= 2) { + // _The WebSocket Connection Close Code_ is + // defined as the status code (Section 7.4) contained in the first Close + // control frame received by the application + code = data.readUInt16BE(0) + } -function representYamlFloat(object, style) { - var res; + if (onlyCode) { + if (!isValidStatusCode(code)) { + return null + } - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; + return { code } } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; + + // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6 + /** @type {Buffer} */ + let reason = data.subarray(2) + + // Remove BOM + if (reason[0] === 0xEF && reason[1] === 0xBB && reason[2] === 0xBF) { + reason = reason.subarray(3) } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; + + if (code !== undefined && !isValidStatusCode(code)) { + return null } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - res = object.toString(10); + try { + // TODO: optimize this + reason = new TextDecoder('utf-8', { fatal: true }).decode(reason) + } catch { + return null + } - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack + return { code, reason } + } - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; + get closingInfo () { + return this.#info.closeInfo + } } -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); +module.exports = { + ByteParser } -module.exports = new Type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); - /***/ }), -/***/ 76865: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 37578: +/***/ ((module) => { "use strict"; -var common = __nccwpck_require__(59941); -var Type = __nccwpck_require__(90256); - -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} - -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} - -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +module.exports = { + kWebSocketURL: Symbol('url'), + kReadyState: Symbol('ready state'), + kController: Symbol('controller'), + kResponse: Symbol('response'), + kBinaryType: Symbol('binary type'), + kSentClose: Symbol('sent close'), + kReceivedClose: Symbol('received close'), + kByteParser: Symbol('byte parser') } -function resolveYamlInteger(data) { - if (data === null) return false; - - var max = data.length, - index = 0, - hasDigits = false, - ch; - if (!max) return false; +/***/ }), - ch = data[index]; +/***/ 25515: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; - } +"use strict"; - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - // base 2, base 8, base 16 +const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(37578) +const { states, opcodes } = __nccwpck_require__(19188) +const { MessageEvent, ErrorEvent } = __nccwpck_require__(52611) - if (ch === 'b') { - // base 2 - index++; +/* globals Blob */ - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } +/** + * @param {import('./websocket').WebSocket} ws + */ +function isEstablished (ws) { + // If the server's response is validated as provided for above, it is + // said that _The WebSocket Connection is Established_ and that the + // WebSocket Connection is in the OPEN state. + return ws[kReadyState] === states.OPEN +} +/** + * @param {import('./websocket').WebSocket} ws + */ +function isClosing (ws) { + // Upon either sending or receiving a Close control frame, it is said + // that _The WebSocket Closing Handshake is Started_ and that the + // WebSocket connection is in the CLOSING state. + return ws[kReadyState] === states.CLOSING +} - if (ch === 'x') { - // base 16 - index++; +/** + * @param {import('./websocket').WebSocket} ws + */ +function isClosed (ws) { + return ws[kReadyState] === states.CLOSED +} - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } +/** + * @see https://dom.spec.whatwg.org/#concept-event-fire + * @param {string} e + * @param {EventTarget} target + * @param {EventInit | undefined} eventInitDict + */ +function fireEvent (e, target, eventConstructor = Event, eventInitDict) { + // 1. If eventConstructor is not given, then let eventConstructor be Event. - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } + // 2. Let event be the result of creating an event given eventConstructor, + // in the relevant realm of target. + // 3. Initialize event’s type attribute to e. + const event = new eventConstructor(e, eventInitDict) // eslint-disable-line new-cap - // base 10 (except 0) or base 60 + // 4. Initialize any other IDL attributes of event as described in the + // invocation of this algorithm. - // value should not start with `_`; - if (ch === '_') return false; + // 5. Return the result of dispatching event at target, with legacy target + // override flag set if set. + target.dispatchEvent(event) +} - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; +/** + * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol + * @param {import('./websocket').WebSocket} ws + * @param {number} type Opcode + * @param {Buffer} data application data + */ +function websocketMessageReceived (ws, type, data) { + // 1. If ready state is not OPEN (1), then return. + if (ws[kReadyState] !== states.OPEN) { + return } - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; + // 2. Let dataForEvent be determined by switching on type and binary type: + let dataForEvent - // if !base60 - done; - if (ch !== ':') return true; + if (type === opcodes.TEXT) { + // -> type indicates that the data is Text + // a new DOMString containing data + try { + dataForEvent = new TextDecoder('utf-8', { fatal: true }).decode(data) + } catch { + failWebsocketConnection(ws, 'Received invalid UTF-8 in text frame.') + return + } + } else if (type === opcodes.BINARY) { + if (ws[kBinaryType] === 'blob') { + // -> type indicates that the data is Binary and binary type is "blob" + // a new Blob object, created in the relevant Realm of the WebSocket + // object, that represents data as its raw data + dataForEvent = new Blob([data]) + } else { + // -> type indicates that the data is Binary and binary type is "arraybuffer" + // a new ArrayBuffer object, created in the relevant Realm of the + // WebSocket object, whose contents are data + dataForEvent = new Uint8Array(data).buffer + } + } - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); + // 3. Fire an event named message at the WebSocket object, using MessageEvent, + // with the origin attribute initialized to the serialization of the WebSocket + // object’s url's origin, and the data attribute initialized to dataForEvent. + fireEvent('message', ws, MessageEvent, { + origin: ws[kWebSocketURL].origin, + data: dataForEvent + }) } -function constructYamlInteger(data) { - var value = data, sign = 1, ch, base, digits = []; - - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); +/** + * @see https://datatracker.ietf.org/doc/html/rfc6455 + * @see https://datatracker.ietf.org/doc/html/rfc2616 + * @see https://bugs.chromium.org/p/chromium/issues/detail?id=398407 + * @param {string} protocol + */ +function isValidSubprotocol (protocol) { + // If present, this value indicates one + // or more comma-separated subprotocol the client wishes to speak, + // ordered by preference. The elements that comprise this value + // MUST be non-empty strings with characters in the range U+0021 to + // U+007E not including separator characters as defined in + // [RFC2616] and MUST all be unique strings. + if (protocol.length === 0) { + return false } - ch = value[0]; + for (const char of protocol) { + const code = char.charCodeAt(0) - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; + if ( + code < 0x21 || + code > 0x7E || + char === '(' || + char === ')' || + char === '<' || + char === '>' || + char === '@' || + char === ',' || + char === ';' || + char === ':' || + char === '\\' || + char === '"' || + char === '/' || + char === '[' || + char === ']' || + char === '?' || + char === '=' || + char === '{' || + char === '}' || + code === 32 || // SP + code === 9 // HT + ) { + return false + } } - if (value === '0') return 0; + return true +} - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); +/** + * @see https://datatracker.ietf.org/doc/html/rfc6455#section-7-4 + * @param {number} code + */ +function isValidStatusCode (code) { + if (code >= 1000 && code < 1015) { + return ( + code !== 1004 && // reserved + code !== 1005 && // "MUST NOT be set as a status code" + code !== 1006 // "MUST NOT be set as a status code" + ) } - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); - - value = 0; - base = 1; + return code >= 3000 && code <= 4999 +} - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); +/** + * @param {import('./websocket').WebSocket} ws + * @param {string|undefined} reason + */ +function failWebsocketConnection (ws, reason) { + const { [kController]: controller, [kResponse]: response } = ws - return sign * value; + controller.abort() + if (response?.socket && !response.socket.destroyed) { + response.socket.destroy() } - return sign * parseInt(value, 10); + if (reason) { + fireEvent('error', ws, ErrorEvent, { + error: new Error(reason) + }) + } } -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); +module.exports = { + isEstablished, + isClosing, + isClosed, + fireEvent, + isValidSubprotocol, + isValidStatusCode, + failWebsocketConnection, + websocketMessageReceived } -module.exports = new Type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); - /***/ }), -/***/ 35361: +/***/ 54284: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var esprima; - -// Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// -try { - // workaround to exclude package from browserify list. - var _require = require; - esprima = _require('esprima'); -} catch (_) { - /* eslint-disable no-redeclare */ - /* global window */ - if (typeof window !== 'undefined') esprima = window.esprima; -} - -var Type = __nccwpck_require__(90256); - -function resolveJavascriptFunction(data) { - if (data === null) return false; +const { webidl } = __nccwpck_require__(21744) +const { DOMException } = __nccwpck_require__(41037) +const { URLSerializer } = __nccwpck_require__(685) +const { getGlobalOrigin } = __nccwpck_require__(71246) +const { staticPropertyDescriptors, states, opcodes, emptyBuffer } = __nccwpck_require__(19188) +const { + kWebSocketURL, + kReadyState, + kController, + kBinaryType, + kResponse, + kSentClose, + kByteParser +} = __nccwpck_require__(37578) +const { isEstablished, isClosing, isValidSubprotocol, failWebsocketConnection, fireEvent } = __nccwpck_require__(25515) +const { establishWebSocketConnection } = __nccwpck_require__(35354) +const { WebsocketFrameSend } = __nccwpck_require__(25444) +const { ByteParser } = __nccwpck_require__(11688) +const { kEnumerableProperty, isBlobLike } = __nccwpck_require__(83983) +const { getGlobalDispatcher } = __nccwpck_require__(21892) +const { types } = __nccwpck_require__(73837) - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }); - - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - return false; - } +let experimentalWarned = false - return true; - } catch (err) { - return false; +// https://websockets.spec.whatwg.org/#interface-definition +class WebSocket extends EventTarget { + #events = { + open: null, + error: null, + close: null, + message: null } -} -function constructJavascriptFunction(data) { - /*jslint evil:true*/ + #bufferedAmount = 0 + #protocol = '' + #extensions = '' - var source = '(' + data + ')', - ast = esprima.parse(source, { range: true }), - params = [], - body; + /** + * @param {string} url + * @param {string|string[]} protocols + */ + constructor (url, protocols = []) { + super() - if (ast.type !== 'Program' || - ast.body.length !== 1 || - ast.body[0].type !== 'ExpressionStatement' || - (ast.body[0].expression.type !== 'ArrowFunctionExpression' && - ast.body[0].expression.type !== 'FunctionExpression')) { - throw new Error('Failed to resolve function'); - } + webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket constructor' }) - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); + if (!experimentalWarned) { + experimentalWarned = true + process.emitWarning('WebSockets are experimental, expect them to change at any time.', { + code: 'UNDICI-WS' + }) + } - body = ast.body[0].expression.body.range; + const options = webidl.converters['DOMString or sequence or WebSocketInit'](protocols) - // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - if (ast.body[0].expression.body.type === 'BlockStatement') { - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); - } - // ES6 arrow functions can omit the BlockStatement. In that case, just return - // the body. - /*eslint-disable no-new-func*/ - return new Function(params, 'return ' + source.slice(body[0], body[1])); -} + url = webidl.converters.USVString(url) + protocols = options.protocols -function representJavascriptFunction(object /*, style*/) { - return object.toString(); -} + // 1. Let baseURL be this's relevant settings object's API base URL. + const baseURL = getGlobalOrigin() -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; -} + // 1. Let urlRecord be the result of applying the URL parser to url with baseURL. + let urlRecord -module.exports = new Type('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); + try { + urlRecord = new URL(url, baseURL) + } catch (e) { + // 3. If urlRecord is failure, then throw a "SyntaxError" DOMException. + throw new DOMException(e, 'SyntaxError') + } + // 4. If urlRecord’s scheme is "http", then set urlRecord’s scheme to "ws". + if (urlRecord.protocol === 'http:') { + urlRecord.protocol = 'ws:' + } else if (urlRecord.protocol === 'https:') { + // 5. Otherwise, if urlRecord’s scheme is "https", set urlRecord’s scheme to "wss". + urlRecord.protocol = 'wss:' + } -/***/ }), + // 6. If urlRecord’s scheme is not "ws" or "wss", then throw a "SyntaxError" DOMException. + if (urlRecord.protocol !== 'ws:' && urlRecord.protocol !== 'wss:') { + throw new DOMException( + `Expected a ws: or wss: protocol, got ${urlRecord.protocol}`, + 'SyntaxError' + ) + } -/***/ 77234: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + // 7. If urlRecord’s fragment is non-null, then throw a "SyntaxError" + // DOMException. + if (urlRecord.hash || urlRecord.href.endsWith('#')) { + throw new DOMException('Got fragment', 'SyntaxError') + } -"use strict"; + // 8. If protocols is a string, set protocols to a sequence consisting + // of just that string. + if (typeof protocols === 'string') { + protocols = [protocols] + } + // 9. If any of the values in protocols occur more than once or otherwise + // fail to match the requirements for elements that comprise the value + // of `Sec-WebSocket-Protocol` fields as defined by The WebSocket + // protocol, then throw a "SyntaxError" DOMException. + if (protocols.length !== new Set(protocols.map(p => p.toLowerCase())).size) { + throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError') + } -var Type = __nccwpck_require__(90256); + if (protocols.length > 0 && !protocols.every(p => isValidSubprotocol(p))) { + throw new DOMException('Invalid Sec-WebSocket-Protocol value', 'SyntaxError') + } -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; + // 10. Set this's url to urlRecord. + this[kWebSocketURL] = new URL(urlRecord.href) - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; + // 11. Let client be this's relevant settings object. - // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; + // 12. Run this step in parallel: - if (modifiers.length > 3) return false; - // if expression starts with /, is should be properly terminated - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; - } + // 1. Establish a WebSocket connection given urlRecord, protocols, + // and client. + this[kController] = establishWebSocketConnection( + urlRecord, + protocols, + this, + (response) => this.#onConnectionEstablished(response), + options + ) - return true; -} + // Each WebSocket object has an associated ready state, which is a + // number representing the state of the connection. Initially it must + // be CONNECTING (0). + this[kReadyState] = WebSocket.CONNECTING + + // The extensions attribute must initially return the empty string. -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; + // The protocol attribute must initially return the empty string. - // `/foo/gim` - tail can be maximum 4 chars - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); + // Each WebSocket object has an associated binary type, which is a + // BinaryType. Initially it must be "blob". + this[kBinaryType] = 'blob' } - return new RegExp(regexp, modifiers); -} + /** + * @see https://websockets.spec.whatwg.org/#dom-websocket-close + * @param {number|undefined} code + * @param {string|undefined} reason + */ + close (code = undefined, reason = undefined) { + webidl.brandCheck(this, WebSocket) -function representJavascriptRegExp(object /*, style*/) { - var result = '/' + object.source + '/'; + if (code !== undefined) { + code = webidl.converters['unsigned short'](code, { clamp: true }) + } - if (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; + if (reason !== undefined) { + reason = webidl.converters.USVString(reason) + } - return result; -} + // 1. If code is present, but is neither an integer equal to 1000 nor an + // integer in the range 3000 to 4999, inclusive, throw an + // "InvalidAccessError" DOMException. + if (code !== undefined) { + if (code !== 1000 && (code < 3000 || code > 4999)) { + throw new DOMException('invalid code', 'InvalidAccessError') + } + } -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; -} + let reasonByteLength = 0 -module.exports = new Type('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); + // 2. If reason is present, then run these substeps: + if (reason !== undefined) { + // 1. Let reasonBytes be the result of encoding reason. + // 2. If reasonBytes is longer than 123 bytes, then throw a + // "SyntaxError" DOMException. + reasonByteLength = Buffer.byteLength(reason) + if (reasonByteLength > 123) { + throw new DOMException( + `Reason must be less than 123 bytes; received ${reasonByteLength}`, + 'SyntaxError' + ) + } + } -/***/ }), + // 3. Run the first matching steps from the following list: + if (this[kReadyState] === WebSocket.CLOSING || this[kReadyState] === WebSocket.CLOSED) { + // If this's ready state is CLOSING (2) or CLOSED (3) + // Do nothing. + } else if (!isEstablished(this)) { + // If the WebSocket connection is not yet established + // Fail the WebSocket connection and set this's ready state + // to CLOSING (2). + failWebsocketConnection(this, 'Connection was closed before it was established.') + this[kReadyState] = WebSocket.CLOSING + } else if (!isClosing(this)) { + // If the WebSocket closing handshake has not yet been started + // Start the WebSocket closing handshake and set this's ready + // state to CLOSING (2). + // - If neither code nor reason is present, the WebSocket Close + // message must not have a body. + // - If code is present, then the status code to use in the + // WebSocket Close message must be the integer given by code. + // - If reason is also present, then reasonBytes must be + // provided in the Close message after the status code. -/***/ 34801: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + const frame = new WebsocketFrameSend() -"use strict"; + // If neither code nor reason is present, the WebSocket Close + // message must not have a body. + // If code is present, then the status code to use in the + // WebSocket Close message must be the integer given by code. + if (code !== undefined && reason === undefined) { + frame.frameData = Buffer.allocUnsafe(2) + frame.frameData.writeUInt16BE(code, 0) + } else if (code !== undefined && reason !== undefined) { + // If reason is also present, then reasonBytes must be + // provided in the Close message after the status code. + frame.frameData = Buffer.allocUnsafe(2 + reasonByteLength) + frame.frameData.writeUInt16BE(code, 0) + // the body MAY contain UTF-8-encoded data with value /reason/ + frame.frameData.write(reason, 2, 'utf-8') + } else { + frame.frameData = emptyBuffer + } -var Type = __nccwpck_require__(90256); + /** @type {import('stream').Duplex} */ + const socket = this[kResponse].socket -function resolveJavascriptUndefined() { - return true; -} + socket.write(frame.createFrame(opcodes.CLOSE), (err) => { + if (!err) { + this[kSentClose] = true + } + }) -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; -} + // Upon either sending or receiving a Close control frame, it is said + // that _The WebSocket Closing Handshake is Started_ and that the + // WebSocket connection is in the CLOSING state. + this[kReadyState] = states.CLOSING + } else { + // Otherwise + // Set this's ready state to CLOSING (2). + this[kReadyState] = WebSocket.CLOSING + } + } -function representJavascriptUndefined() { - return ''; -} + /** + * @see https://websockets.spec.whatwg.org/#dom-websocket-send + * @param {NodeJS.TypedArray|ArrayBuffer|Blob|string} data + */ + send (data) { + webidl.brandCheck(this, WebSocket) -function isUndefined(object) { - return typeof object === 'undefined'; -} + webidl.argumentLengthCheck(arguments, 1, { header: 'WebSocket.send' }) -module.exports = new Type('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); + data = webidl.converters.WebSocketSendData(data) + // 1. If this's ready state is CONNECTING, then throw an + // "InvalidStateError" DOMException. + if (this[kReadyState] === WebSocket.CONNECTING) { + throw new DOMException('Sent before connected.', 'InvalidStateError') + } -/***/ }), + // 2. Run the appropriate set of steps from the following list: + // https://datatracker.ietf.org/doc/html/rfc6455#section-6.1 + // https://datatracker.ietf.org/doc/html/rfc6455#section-5.2 -/***/ 15938: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (!isEstablished(this) || isClosing(this)) { + return + } -"use strict"; + /** @type {import('stream').Duplex} */ + const socket = this[kResponse].socket + // If data is a string + if (typeof data === 'string') { + // If the WebSocket connection is established and the WebSocket + // closing handshake has not yet started, then the user agent + // must send a WebSocket Message comprised of the data argument + // using a text frame opcode; if the data cannot be sent, e.g. + // because it would need to be buffered but the buffer is full, + // the user agent must flag the WebSocket as full and then close + // the WebSocket connection. Any invocation of this method with a + // string argument that does not throw an exception must increase + // the bufferedAmount attribute by the number of bytes needed to + // express the argument as UTF-8. -var Type = __nccwpck_require__(90256); + const value = Buffer.from(data) + const frame = new WebsocketFrameSend(value) + const buffer = frame.createFrame(opcodes.TEXT) -module.exports = new Type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); + this.#bufferedAmount += value.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= value.byteLength + }) + } else if (types.isArrayBuffer(data)) { + // If the WebSocket connection is established, and the WebSocket + // closing handshake has not yet started, then the user agent must + // send a WebSocket Message comprised of data using a binary frame + // opcode; if the data cannot be sent, e.g. because it would need + // to be buffered but the buffer is full, the user agent must flag + // the WebSocket as full and then close the WebSocket connection. + // The data to be sent is the data stored in the buffer described + // by the ArrayBuffer object. Any invocation of this method with an + // ArrayBuffer argument that does not throw an exception must + // increase the bufferedAmount attribute by the length of the + // ArrayBuffer in bytes. + const value = Buffer.from(data) + const frame = new WebsocketFrameSend(value) + const buffer = frame.createFrame(opcodes.BINARY) -/***/ }), + this.#bufferedAmount += value.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= value.byteLength + }) + } else if (ArrayBuffer.isView(data)) { + // If the WebSocket connection is established, and the WebSocket + // closing handshake has not yet started, then the user agent must + // send a WebSocket Message comprised of data using a binary frame + // opcode; if the data cannot be sent, e.g. because it would need to + // be buffered but the buffer is full, the user agent must flag the + // WebSocket as full and then close the WebSocket connection. The + // data to be sent is the data stored in the section of the buffer + // described by the ArrayBuffer object that data references. Any + // invocation of this method with this kind of argument that does + // not throw an exception must increase the bufferedAmount attribute + // by the length of data’s buffer in bytes. -/***/ 60194: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + const ab = Buffer.from(data, data.byteOffset, data.byteLength) -"use strict"; + const frame = new WebsocketFrameSend(ab) + const buffer = frame.createFrame(opcodes.BINARY) + this.#bufferedAmount += ab.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= ab.byteLength + }) + } else if (isBlobLike(data)) { + // If the WebSocket connection is established, and the WebSocket + // closing handshake has not yet started, then the user agent must + // send a WebSocket Message comprised of data using a binary frame + // opcode; if the data cannot be sent, e.g. because it would need to + // be buffered but the buffer is full, the user agent must flag the + // WebSocket as full and then close the WebSocket connection. The data + // to be sent is the raw data represented by the Blob object. Any + // invocation of this method with a Blob argument that does not throw + // an exception must increase the bufferedAmount attribute by the size + // of the Blob object’s raw data, in bytes. -var Type = __nccwpck_require__(90256); + const frame = new WebsocketFrameSend() -function resolveYamlMerge(data) { - return data === '<<' || data === null; -} + data.arrayBuffer().then((ab) => { + const value = Buffer.from(ab) + frame.frameData = value + const buffer = frame.createFrame(opcodes.BINARY) -module.exports = new Type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); + this.#bufferedAmount += value.byteLength + socket.write(buffer, () => { + this.#bufferedAmount -= value.byteLength + }) + }) + } + } + get readyState () { + webidl.brandCheck(this, WebSocket) -/***/ }), + // The readyState getter steps are to return this's ready state. + return this[kReadyState] + } -/***/ 26058: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get bufferedAmount () { + webidl.brandCheck(this, WebSocket) -"use strict"; + return this.#bufferedAmount + } + get url () { + webidl.brandCheck(this, WebSocket) -var Type = __nccwpck_require__(90256); + // The url getter steps are to return this's url, serialized. + return URLSerializer(this[kWebSocketURL]) + } -function resolveYamlNull(data) { - if (data === null) return true; + get extensions () { + webidl.brandCheck(this, WebSocket) - var max = data.length; + return this.#extensions + } - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); -} + get protocol () { + webidl.brandCheck(this, WebSocket) -function constructYamlNull() { - return null; -} + return this.#protocol + } -function isNull(object) { - return object === null; -} + get onopen () { + webidl.brandCheck(this, WebSocket) -module.exports = new Type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; } - }, - defaultStyle: 'lowercase' -}); + return this.#events.open + } + set onopen (fn) { + webidl.brandCheck(this, WebSocket) -/***/ }), + if (this.#events.open) { + this.removeEventListener('open', this.#events.open) + } -/***/ 96439: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + if (typeof fn === 'function') { + this.#events.open = fn + this.addEventListener('open', fn) + } else { + this.#events.open = null + } + } -"use strict"; + get onerror () { + webidl.brandCheck(this, WebSocket) + return this.#events.error + } -var Type = __nccwpck_require__(90256); + set onerror (fn) { + webidl.brandCheck(this, WebSocket) -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; + if (this.#events.error) { + this.removeEventListener('error', this.#events.error) + } -function resolveYamlOmap(data) { - if (data === null) return true; + if (typeof fn === 'function') { + this.#events.error = fn + this.addEventListener('error', fn) + } else { + this.#events.error = null + } + } - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; + get onclose () { + webidl.brandCheck(this, WebSocket) - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; + return this.#events.close + } - if (_toString.call(pair) !== '[object Object]') return false; + set onclose (fn) { + webidl.brandCheck(this, WebSocket) - for (pairKey in pair) { - if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } + if (this.#events.close) { + this.removeEventListener('close', this.#events.close) } - if (!pairHasKey) return false; - - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; + if (typeof fn === 'function') { + this.#events.close = fn + this.addEventListener('close', fn) + } else { + this.#events.close = null + } } - return true; -} + get onmessage () { + webidl.brandCheck(this, WebSocket) -function constructYamlOmap(data) { - return data !== null ? data : []; -} + return this.#events.message + } -module.exports = new Type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); + set onmessage (fn) { + webidl.brandCheck(this, WebSocket) + if (this.#events.message) { + this.removeEventListener('message', this.#events.message) + } -/***/ }), + if (typeof fn === 'function') { + this.#events.message = fn + this.addEventListener('message', fn) + } else { + this.#events.message = null + } + } -/***/ 33730: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + get binaryType () { + webidl.brandCheck(this, WebSocket) -"use strict"; + return this[kBinaryType] + } + set binaryType (type) { + webidl.brandCheck(this, WebSocket) -var Type = __nccwpck_require__(90256); + if (type !== 'blob' && type !== 'arraybuffer') { + this[kBinaryType] = 'blob' + } else { + this[kBinaryType] = type + } + } -var _toString = Object.prototype.toString; + /** + * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol + */ + #onConnectionEstablished (response) { + // processResponse is called when the "response’s header list has been received and initialized." + // once this happens, the connection is open + this[kResponse] = response -function resolveYamlPairs(data) { - if (data === null) return true; + const parser = new ByteParser(this) + parser.on('drain', function onParserDrain () { + this.ws[kResponse].socket.resume() + }) - var index, length, pair, keys, result, - object = data; + response.socket.ws = this + this[kByteParser] = parser - result = new Array(object.length); + // 1. Change the ready state to OPEN (1). + this[kReadyState] = states.OPEN - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; + // 2. Change the extensions attribute’s value to the extensions in use, if + // it is not the null value. + // https://datatracker.ietf.org/doc/html/rfc6455#section-9.1 + const extensions = response.headersList.get('sec-websocket-extensions') - if (_toString.call(pair) !== '[object Object]') return false; + if (extensions !== null) { + this.#extensions = extensions + } - keys = Object.keys(pair); + // 3. Change the protocol attribute’s value to the subprotocol in use, if + // it is not the null value. + // https://datatracker.ietf.org/doc/html/rfc6455#section-1.9 + const protocol = response.headersList.get('sec-websocket-protocol') - if (keys.length !== 1) return false; + if (protocol !== null) { + this.#protocol = protocol + } - result[index] = [ keys[0], pair[keys[0]] ]; + // 4. Fire an event named open at the WebSocket object. + fireEvent('open', this) } - - return true; } -function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; +// https://websockets.spec.whatwg.org/#dom-websocket-connecting +WebSocket.CONNECTING = WebSocket.prototype.CONNECTING = states.CONNECTING +// https://websockets.spec.whatwg.org/#dom-websocket-open +WebSocket.OPEN = WebSocket.prototype.OPEN = states.OPEN +// https://websockets.spec.whatwg.org/#dom-websocket-closing +WebSocket.CLOSING = WebSocket.prototype.CLOSING = states.CLOSING +// https://websockets.spec.whatwg.org/#dom-websocket-closed +WebSocket.CLOSED = WebSocket.prototype.CLOSED = states.CLOSED - result = new Array(object.length); +Object.defineProperties(WebSocket.prototype, { + CONNECTING: staticPropertyDescriptors, + OPEN: staticPropertyDescriptors, + CLOSING: staticPropertyDescriptors, + CLOSED: staticPropertyDescriptors, + url: kEnumerableProperty, + readyState: kEnumerableProperty, + bufferedAmount: kEnumerableProperty, + onopen: kEnumerableProperty, + onerror: kEnumerableProperty, + onclose: kEnumerableProperty, + close: kEnumerableProperty, + onmessage: kEnumerableProperty, + binaryType: kEnumerableProperty, + send: kEnumerableProperty, + extensions: kEnumerableProperty, + protocol: kEnumerableProperty, + [Symbol.toStringTag]: { + value: 'WebSocket', + writable: false, + enumerable: false, + configurable: true + } +}) - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; +Object.defineProperties(WebSocket, { + CONNECTING: staticPropertyDescriptors, + OPEN: staticPropertyDescriptors, + CLOSING: staticPropertyDescriptors, + CLOSED: staticPropertyDescriptors +}) - keys = Object.keys(pair); +webidl.converters['sequence'] = webidl.sequenceConverter( + webidl.converters.DOMString +) - result[index] = [ keys[0], pair[keys[0]] ]; +webidl.converters['DOMString or sequence'] = function (V) { + if (webidl.util.Type(V) === 'Object' && Symbol.iterator in V) { + return webidl.converters['sequence'](V) } - return result; + return webidl.converters.DOMString(V) } -module.exports = new Type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); - - -/***/ }), - -/***/ 65629: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -var Type = __nccwpck_require__(90256); - -module.exports = new Type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); - - -/***/ }), - -/***/ 9047: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -var Type = __nccwpck_require__(90256); +// This implements the propsal made in https://github.com/whatwg/websockets/issues/42 +webidl.converters.WebSocketInit = webidl.dictionaryConverter([ + { + key: 'protocols', + converter: webidl.converters['DOMString or sequence'], + get defaultValue () { + return [] + } + }, + { + key: 'dispatcher', + converter: (V) => V, + get defaultValue () { + return getGlobalDispatcher() + } + }, + { + key: 'headers', + converter: webidl.nullableConverter(webidl.converters.HeadersInit) + } +]) -var _hasOwnProperty = Object.prototype.hasOwnProperty; +webidl.converters['DOMString or sequence or WebSocketInit'] = function (V) { + if (webidl.util.Type(V) === 'Object' && !(Symbol.iterator in V)) { + return webidl.converters.WebSocketInit(V) + } -function resolveYamlSet(data) { - if (data === null) return true; + return { protocols: webidl.converters['DOMString or sequence'](V) } +} - var key, object = data; +webidl.converters.WebSocketSendData = function (V) { + if (webidl.util.Type(V) === 'Object') { + if (isBlobLike(V)) { + return webidl.converters.Blob(V, { strict: false }) + } - for (key in object) { - if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; + if (ArrayBuffer.isView(V) || types.isAnyArrayBuffer(V)) { + return webidl.converters.BufferSource(V) } } - return true; + return webidl.converters.USVString(V) } -function constructYamlSet(data) { - return data !== null ? data : {}; +module.exports = { + WebSocket } -module.exports = new Type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); - /***/ }), -/***/ 24649: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; +/***/ 92707: +/***/ ((module) => { +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +var byteToHex = []; +for (var i = 0; i < 256; ++i) { + byteToHex[i] = (i + 0x100).toString(16).substr(1); +} -var Type = __nccwpck_require__(90256); +function bytesToUuid(buf, offset) { + var i = offset || 0; + var bth = byteToHex; + // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + return ([ + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]] + ]).join(''); +} -module.exports = new Type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); +module.exports = bytesToUuid; /***/ }), -/***/ 82018: +/***/ 15859: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; - - -var Type = __nccwpck_require__(90256); - -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day +// Unique ID creation requires a high quality random # generator. In node.js +// this is pretty straight-forward - we use the crypto API. -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute +var crypto = __nccwpck_require__(6113); -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} +module.exports = function nodeRNG() { + return crypto.randomBytes(16); +}; -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); +/***/ }), - if (match === null) throw new Error('Date resolve error'); +/***/ 80824: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // match: [1] year [2] month [3] day +var rng = __nccwpck_require__(15859); +var bytesToUuid = __nccwpck_require__(92707); - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); +function v4(options, buf, offset) { + var i = buf && offset || 0; - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); + if (typeof(options) == 'string') { + buf = options === 'binary' ? new Array(16) : null; + options = null; } + options = options || {}; - // match: [4] hour [5] minute [6] second [7] fraction + var rnds = options.random || (options.rng || rng)(); - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); + // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + rnds[6] = (rnds[6] & 0x0f) | 0x40; + rnds[8] = (rnds[8] & 0x3f) | 0x80; - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; + // Copy bytes to buffer, if provided + if (buf) { + for (var ii = 0; ii < 16; ++ii) { + buf[i + ii] = rnds[ii]; } - fraction = +fraction; - } - - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; } - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - - if (delta) date.setTime(date.getTime() - delta); - - return date; -} - -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); + return buf || bytesToUuid(rnds); } -module.exports = new Type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); +module.exports = v4; /***/ }), @@ -84331,7 +74946,7 @@ const core = __importStar(__nccwpck_require__(42186)); const io = __importStar(__nccwpck_require__(47351)); const fs = __importStar(__nccwpck_require__(57147)); const os = __importStar(__nccwpck_require__(22037)); -const xmlbuilder2_1 = __nccwpck_require__(70151); +const xmlbuilder2_1 = __nccwpck_require__(69075); const constants = __importStar(__nccwpck_require__(69042)); const gpg = __importStar(__nccwpck_require__(23759)); const util_1 = __nccwpck_require__(92629); @@ -87637,7 +78252,7 @@ const core = __importStar(__nccwpck_require__(42186)); const io = __importStar(__nccwpck_require__(47351)); const constants = __importStar(__nccwpck_require__(69042)); const util_1 = __nccwpck_require__(92629); -const xmlbuilder2_1 = __nccwpck_require__(70151); +const xmlbuilder2_1 = __nccwpck_require__(69075); function configureToolchains(version, distributionName, jdkHome, toolchainId) { return __awaiter(this, void 0, void 0, function* () { const vendor = core.getInput(constants.INPUT_MVN_TOOLCHAIN_VENDOR) || distributionName; @@ -113644,284 +104259,952 @@ const downloadOperationSpec = { headersMapper: Mappers.BlobDownloadExceptionHeaders, }, }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.snapshot, - Parameters.versionId, - ], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.versionId, + ], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.range, + Parameters.rangeGetContentMD5, + Parameters.rangeGetContentCRC64, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + ], + isXML: true, + serializer: xmlSerializer, +}; +const getPropertiesOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "HEAD", + responses: { + 200: { + headersMapper: Mappers.BlobGetPropertiesHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobGetPropertiesExceptionHeaders, + }, + }, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.versionId, + ], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + ], + isXML: true, + serializer: xmlSerializer, +}; +const deleteOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "DELETE", + responses: { + 202: { + headersMapper: Mappers.BlobDeleteHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobDeleteExceptionHeaders, + }, + }, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.versionId, + Parameters.blobDeleteType, + ], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.deleteSnapshots, + ], + isXML: true, + serializer: xmlSerializer, +}; +const undeleteOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobUndeleteHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobUndeleteExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp8], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + ], + isXML: true, + serializer: xmlSerializer, +}; +const setExpiryOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobSetExpiryHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobSetExpiryExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp11], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.expiryOptions, + Parameters.expiresOn, + ], + isXML: true, + serializer: xmlSerializer, +}; +const setHttpHeadersOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobSetHttpHeadersHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobSetHttpHeadersExceptionHeaders, + }, + }, + queryParameters: [Parameters.comp, Parameters.timeoutInSeconds], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.blobCacheControl, + Parameters.blobContentType, + Parameters.blobContentMD5, + Parameters.blobContentEncoding, + Parameters.blobContentLanguage, + Parameters.blobContentDisposition, + ], + isXML: true, + serializer: xmlSerializer, +}; +const setImmutabilityPolicyOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobSetImmutabilityPolicyHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobSetImmutabilityPolicyExceptionHeaders, + }, + }, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.versionId, + Parameters.comp12, + ], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.ifUnmodifiedSince, + Parameters.immutabilityPolicyExpiry, + Parameters.immutabilityPolicyMode, + ], + isXML: true, + serializer: xmlSerializer, +}; +const deleteImmutabilityPolicyOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.BlobDeleteImmutabilityPolicyHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobDeleteImmutabilityPolicyExceptionHeaders, + }, + }, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.versionId, + Parameters.comp12, + ], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + ], + isXML: true, + serializer: xmlSerializer, +}; +const setLegalHoldOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobSetLegalHoldHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobSetLegalHoldExceptionHeaders, + }, + }, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.versionId, + Parameters.comp13, + ], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.legalHold, + ], + isXML: true, + serializer: xmlSerializer, +}; +const setMetadataOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobSetMetadataHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobSetMetadataExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp6], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.metadata, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.encryptionScope, + ], + isXML: true, + serializer: xmlSerializer, +}; +const acquireLeaseOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 201: { + headersMapper: Mappers.BlobAcquireLeaseHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobAcquireLeaseExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.action, + Parameters.duration, + Parameters.proposedLeaseId, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + ], + isXML: true, + serializer: xmlSerializer, +}; +const releaseLeaseOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobReleaseLeaseHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobReleaseLeaseExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.action1, + Parameters.leaseId1, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + ], + isXML: true, + serializer: xmlSerializer, +}; +const renewLeaseOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobRenewLeaseHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobRenewLeaseExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.leaseId1, + Parameters.action2, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + ], + isXML: true, + serializer: xmlSerializer, +}; +const changeLeaseOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 200: { + headersMapper: Mappers.BlobChangeLeaseHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobChangeLeaseExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.leaseId1, + Parameters.action4, + Parameters.proposedLeaseId1, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + ], + isXML: true, + serializer: xmlSerializer, +}; +const breakLeaseOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 202: { + headersMapper: Mappers.BlobBreakLeaseHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobBreakLeaseExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.action3, + Parameters.breakPeriod, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + ], + isXML: true, + serializer: xmlSerializer, +}; +const createSnapshotOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 201: { + headersMapper: Mappers.BlobCreateSnapshotHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlobCreateSnapshotExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp14], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.metadata, Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.range, - Parameters.rangeGetContentMD5, - Parameters.rangeGetContentCRC64, Parameters.encryptionKey, Parameters.encryptionKeySha256, Parameters.encryptionAlgorithm, Parameters.ifMatch, Parameters.ifNoneMatch, Parameters.ifTags, + Parameters.encryptionScope, ], isXML: true, serializer: xmlSerializer, }; -const getPropertiesOperationSpec = { +const startCopyFromURLOperationSpec = { path: "/{containerName}/{blob}", - httpMethod: "HEAD", + httpMethod: "PUT", responses: { - 200: { - headersMapper: Mappers.BlobGetPropertiesHeaders, + 202: { + headersMapper: Mappers.BlobStartCopyFromURLHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobGetPropertiesExceptionHeaders, + headersMapper: Mappers.BlobStartCopyFromURLExceptionHeaders, }, }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.snapshot, - Parameters.versionId, - ], + queryParameters: [Parameters.timeoutInSeconds], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.metadata, Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, Parameters.ifMatch, Parameters.ifNoneMatch, Parameters.ifTags, + Parameters.immutabilityPolicyExpiry, + Parameters.immutabilityPolicyMode, + Parameters.tier, + Parameters.rehydratePriority, + Parameters.sourceIfModifiedSince, + Parameters.sourceIfUnmodifiedSince, + Parameters.sourceIfMatch, + Parameters.sourceIfNoneMatch, + Parameters.sourceIfTags, + Parameters.copySource, + Parameters.blobTagsString, + Parameters.sealBlob, + Parameters.legalHold1, ], isXML: true, serializer: xmlSerializer, }; -const deleteOperationSpec = { +const copyFromURLOperationSpec = { path: "/{containerName}/{blob}", - httpMethod: "DELETE", + httpMethod: "PUT", responses: { 202: { - headersMapper: Mappers.BlobDeleteHeaders, + headersMapper: Mappers.BlobCopyFromURLHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobDeleteExceptionHeaders, + headersMapper: Mappers.BlobCopyFromURLExceptionHeaders, }, }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.snapshot, - Parameters.versionId, - Parameters.blobDeleteType, - ], + queryParameters: [Parameters.timeoutInSeconds], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.metadata, Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, Parameters.ifMatch, Parameters.ifNoneMatch, Parameters.ifTags, - Parameters.deleteSnapshots, + Parameters.immutabilityPolicyExpiry, + Parameters.immutabilityPolicyMode, + Parameters.encryptionScope, + Parameters.tier, + Parameters.sourceIfModifiedSince, + Parameters.sourceIfUnmodifiedSince, + Parameters.sourceIfMatch, + Parameters.sourceIfNoneMatch, + Parameters.copySource, + Parameters.blobTagsString, + Parameters.legalHold1, + Parameters.xMsRequiresSync, + Parameters.sourceContentMD5, + Parameters.copySourceAuthorization, + Parameters.copySourceTags, + Parameters.fileRequestIntent, ], isXML: true, serializer: xmlSerializer, }; -const undeleteOperationSpec = { +const abortCopyFromURLOperationSpec = { path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { - 200: { - headersMapper: Mappers.BlobUndeleteHeaders, + 204: { + headersMapper: Mappers.BlobAbortCopyFromURLHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobUndeleteExceptionHeaders, + headersMapper: Mappers.BlobAbortCopyFromURLExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp8], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.comp15, + Parameters.copyId, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.leaseId, + Parameters.copyActionAbortConstant, ], isXML: true, serializer: xmlSerializer, }; -const setExpiryOperationSpec = { +const setTierOperationSpec = { path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { 200: { - headersMapper: Mappers.BlobSetExpiryHeaders, + headersMapper: Mappers.BlobSetTierHeaders, + }, + 202: { + headersMapper: Mappers.BlobSetTierHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobSetExpiryExceptionHeaders, + headersMapper: Mappers.BlobSetTierExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp11], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.versionId, + Parameters.comp16, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.expiryOptions, - Parameters.expiresOn, + Parameters.leaseId, + Parameters.ifTags, + Parameters.rehydratePriority, + Parameters.tier1, ], isXML: true, serializer: xmlSerializer, }; -const setHttpHeadersOperationSpec = { +const getAccountInfoOperationSpec = { path: "/{containerName}/{blob}", - httpMethod: "PUT", + httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.BlobSetHttpHeadersHeaders, + headersMapper: Mappers.BlobGetAccountInfoHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobSetHttpHeadersExceptionHeaders, + headersMapper: Mappers.BlobGetAccountInfoExceptionHeaders, }, }, - queryParameters: [Parameters.comp, Parameters.timeoutInSeconds], + queryParameters: [ + Parameters.comp, + Parameters.timeoutInSeconds, + Parameters.restype1, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.blobCacheControl, - Parameters.blobContentType, - Parameters.blobContentMD5, - Parameters.blobContentEncoding, - Parameters.blobContentLanguage, - Parameters.blobContentDisposition, ], isXML: true, serializer: xmlSerializer, }; -const setImmutabilityPolicyOperationSpec = { +const queryOperationSpec = { path: "/{containerName}/{blob}", - httpMethod: "PUT", + httpMethod: "POST", responses: { 200: { - headersMapper: Mappers.BlobSetImmutabilityPolicyHeaders, + bodyMapper: { + type: { name: "Stream" }, + serializedName: "parsedResponse", + }, + headersMapper: Mappers.BlobQueryHeaders, + }, + 206: { + bodyMapper: { + type: { name: "Stream" }, + serializedName: "parsedResponse", + }, + headersMapper: Mappers.BlobQueryHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobSetImmutabilityPolicyExceptionHeaders, + headersMapper: Mappers.BlobQueryExceptionHeaders, }, }, + requestBody: Parameters.queryRequest, queryParameters: [ Parameters.timeoutInSeconds, Parameters.snapshot, - Parameters.versionId, - Parameters.comp12, + Parameters.comp17, ], urlParameters: [Parameters.url], headerParameters: [ + Parameters.contentType, + Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.accept1, + Parameters.leaseId, + Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.immutabilityPolicyExpiry, - Parameters.immutabilityPolicyMode, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "xml", serializer: xmlSerializer, }; -const deleteImmutabilityPolicyOperationSpec = { +const getTagsOperationSpec = { path: "/{containerName}/{blob}", - httpMethod: "DELETE", + httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.BlobDeleteImmutabilityPolicyHeaders, + bodyMapper: Mappers.BlobTags, + headersMapper: Mappers.BlobGetTagsHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobDeleteImmutabilityPolicyExceptionHeaders, + headersMapper: Mappers.BlobGetTagsExceptionHeaders, }, }, queryParameters: [ Parameters.timeoutInSeconds, Parameters.snapshot, Parameters.versionId, - Parameters.comp12, + Parameters.comp18, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.leaseId, + Parameters.ifTags, ], isXML: true, serializer: xmlSerializer, }; -const setLegalHoldOperationSpec = { +const setTagsOperationSpec = { path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { - 200: { - headersMapper: Mappers.BlobSetLegalHoldHeaders, + 204: { + headersMapper: Mappers.BlobSetTagsHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobSetLegalHoldExceptionHeaders, + headersMapper: Mappers.BlobSetTagsExceptionHeaders, }, }, + requestBody: Parameters.tags, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.snapshot, Parameters.versionId, - Parameters.comp13, + Parameters.comp18, ], urlParameters: [Parameters.url], headerParameters: [ + Parameters.contentType, + Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.accept1, - Parameters.legalHold, + Parameters.leaseId, + Parameters.ifTags, + Parameters.transactionalContentMD5, + Parameters.transactionalContentCrc64, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "xml", serializer: xmlSerializer, }; -const setMetadataOperationSpec = { +//# sourceMappingURL=blob.js.map + +/***/ }), + +/***/ 48652: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BlockBlobImpl = void 0; +const tslib_1 = __nccwpck_require__(4351); +const coreClient = tslib_1.__importStar(__nccwpck_require__(7611)); +const Mappers = tslib_1.__importStar(__nccwpck_require__(52486)); +const Parameters = tslib_1.__importStar(__nccwpck_require__(54142)); +/** Class containing BlockBlob operations. */ +class BlockBlobImpl { + client; + /** + * Initialize a new instance of the class BlockBlob class. + * @param client Reference to the service client + */ + constructor(client) { + this.client = client; + } + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing + * block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put + * Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a + * partial update of the content of a block blob, use the Put Block List operation. + * @param contentLength The length of the request. + * @param body Initial data + * @param options The options parameters. + */ + upload(contentLength, body, options) { + return this.client.sendOperationRequest({ contentLength, body, options }, uploadOperationSpec); + } + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read + * from a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are + * not supported with Put Blob from URL; the content of an existing blob is overwritten with the + * content of the new blob. To perform partial updates to a block blob’s contents using a source URL, + * use the Put Block from URL API in conjunction with Put Block List. + * @param contentLength The length of the request. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to + * 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would + * appear in a request URI. The source blob must either be public or must be authenticated via a shared + * access signature. + * @param options The options parameters. + */ + putBlobFromUrl(contentLength, copySource, options) { + return this.client.sendOperationRequest({ contentLength, copySource, options }, putBlobFromUrlOperationSpec); + } + /** + * The Stage Block operation creates a new block to be committed as part of a blob + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string + * must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified + * for the blockid parameter must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data + * @param options The options parameters. + */ + stageBlock(blockId, contentLength, body, options) { + return this.client.sendOperationRequest({ blockId, contentLength, body, options }, stageBlockOperationSpec); + } + /** + * The Stage Block operation creates a new block to be committed as part of a blob where the contents + * are read from a URL. + * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string + * must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified + * for the blockid parameter must be the same size for each block. + * @param contentLength The length of the request. + * @param sourceUrl Specify a URL to the copy source. + * @param options The options parameters. + */ + stageBlockFromURL(blockId, contentLength, sourceUrl, options) { + return this.client.sendOperationRequest({ blockId, contentLength, sourceUrl, options }, stageBlockFromURLOperationSpec); + } + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the + * blob. In order to be written as part of a blob, a block must have been successfully written to the + * server in a prior Put Block operation. You can call Put Block List to update a blob by uploading + * only those blocks that have changed, then committing the new and existing blocks together. You can + * do this by specifying whether to commit a block from the committed block list or from the + * uncommitted block list, or to commit the most recently uploaded version of the block, whichever list + * it may belong to. + * @param blocks Blob Blocks. + * @param options The options parameters. + */ + commitBlockList(blocks, options) { + return this.client.sendOperationRequest({ blocks, options }, commitBlockListOperationSpec); + } + /** + * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block + * blob + * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted + * blocks, or both lists together. + * @param options The options parameters. + */ + getBlockList(listType, options) { + return this.client.sendOperationRequest({ listType, options }, getBlockListOperationSpec); + } +} +exports.BlockBlobImpl = BlockBlobImpl; +// Operation Specifications +const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true); +const uploadOperationSpec = { path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { - 200: { - headersMapper: Mappers.BlobSetMetadataHeaders, + 201: { + headersMapper: Mappers.BlockBlobUploadHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobSetMetadataExceptionHeaders, + headersMapper: Mappers.BlockBlobUploadExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp6], + requestBody: Parameters.body1, + queryParameters: [Parameters.timeoutInSeconds], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.contentLength, + Parameters.metadata, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.blobCacheControl, + Parameters.blobContentType, + Parameters.blobContentMD5, + Parameters.blobContentEncoding, + Parameters.blobContentLanguage, + Parameters.blobContentDisposition, + Parameters.immutabilityPolicyExpiry, + Parameters.immutabilityPolicyMode, + Parameters.encryptionScope, + Parameters.tier, + Parameters.blobTagsString, + Parameters.legalHold1, + Parameters.transactionalContentMD5, + Parameters.transactionalContentCrc64, + Parameters.contentType1, + Parameters.accept2, + Parameters.blobType2, + ], + isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "binary", + serializer: xmlSerializer, +}; +const putBlobFromUrlOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 201: { + headersMapper: Mappers.BlockBlobPutBlobFromUrlHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlockBlobPutBlobFromUrlExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.contentLength, Parameters.metadata, Parameters.leaseId, Parameters.ifModifiedSince, @@ -113932,171 +105215,471 @@ const setMetadataOperationSpec = { Parameters.ifMatch, Parameters.ifNoneMatch, Parameters.ifTags, + Parameters.blobCacheControl, + Parameters.blobContentType, + Parameters.blobContentMD5, + Parameters.blobContentEncoding, + Parameters.blobContentLanguage, + Parameters.blobContentDisposition, Parameters.encryptionScope, + Parameters.tier, + Parameters.sourceIfModifiedSince, + Parameters.sourceIfUnmodifiedSince, + Parameters.sourceIfMatch, + Parameters.sourceIfNoneMatch, + Parameters.sourceIfTags, + Parameters.copySource, + Parameters.blobTagsString, + Parameters.sourceContentMD5, + Parameters.copySourceAuthorization, + Parameters.copySourceTags, + Parameters.fileRequestIntent, + Parameters.transactionalContentMD5, + Parameters.blobType2, + Parameters.copySourceBlobProperties, ], isXML: true, serializer: xmlSerializer, }; -const acquireLeaseOperationSpec = { +const stageBlockOperationSpec = { path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { 201: { - headersMapper: Mappers.BlobAcquireLeaseHeaders, + headersMapper: Mappers.BlockBlobStageBlockHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobAcquireLeaseExceptionHeaders, + headersMapper: Mappers.BlockBlobStageBlockExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + requestBody: Parameters.body1, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.comp24, + Parameters.blockId, + ], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.contentLength, + Parameters.leaseId, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.encryptionScope, + Parameters.transactionalContentMD5, + Parameters.transactionalContentCrc64, + Parameters.contentType1, + Parameters.accept2, + ], + isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "binary", + serializer: xmlSerializer, +}; +const stageBlockFromURLOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 201: { + headersMapper: Mappers.BlockBlobStageBlockFromURLHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlockBlobStageBlockFromURLExceptionHeaders, + }, + }, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.comp24, + Parameters.blockId, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.contentLength, + Parameters.leaseId, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.encryptionScope, + Parameters.sourceIfModifiedSince, + Parameters.sourceIfUnmodifiedSince, + Parameters.sourceIfMatch, + Parameters.sourceIfNoneMatch, + Parameters.sourceContentMD5, + Parameters.copySourceAuthorization, + Parameters.fileRequestIntent, + Parameters.sourceUrl, + Parameters.sourceContentCrc64, + Parameters.sourceRange1, + ], + isXML: true, + serializer: xmlSerializer, +}; +const commitBlockListOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 201: { + headersMapper: Mappers.BlockBlobCommitBlockListHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.BlockBlobCommitBlockListExceptionHeaders, + }, + }, + requestBody: Parameters.blocks, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp25], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.contentType, + Parameters.accept, + Parameters.version, + Parameters.requestId, + Parameters.metadata, + Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.action, - Parameters.duration, - Parameters.proposedLeaseId, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, Parameters.ifMatch, Parameters.ifNoneMatch, Parameters.ifTags, + Parameters.blobCacheControl, + Parameters.blobContentType, + Parameters.blobContentMD5, + Parameters.blobContentEncoding, + Parameters.blobContentLanguage, + Parameters.blobContentDisposition, + Parameters.immutabilityPolicyExpiry, + Parameters.immutabilityPolicyMode, + Parameters.encryptionScope, + Parameters.tier, + Parameters.blobTagsString, + Parameters.legalHold1, + Parameters.transactionalContentMD5, + Parameters.transactionalContentCrc64, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "xml", serializer: xmlSerializer, }; -const releaseLeaseOperationSpec = { +const getBlockListOperationSpec = { path: "/{containerName}/{blob}", - httpMethod: "PUT", + httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.BlobReleaseLeaseHeaders, + bodyMapper: Mappers.BlockList, + headersMapper: Mappers.BlockBlobGetBlockListHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobReleaseLeaseExceptionHeaders, + headersMapper: Mappers.BlockBlobGetBlockListExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.snapshot, + Parameters.comp25, + Parameters.listType, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.action1, - Parameters.leaseId1, - Parameters.ifMatch, - Parameters.ifNoneMatch, + Parameters.leaseId, Parameters.ifTags, ], isXML: true, serializer: xmlSerializer, }; -const renewLeaseOperationSpec = { - path: "/{containerName}/{blob}", +//# sourceMappingURL=blockBlob.js.map + +/***/ }), + +/***/ 3269: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ContainerImpl = void 0; +const tslib_1 = __nccwpck_require__(4351); +const coreClient = tslib_1.__importStar(__nccwpck_require__(7611)); +const Mappers = tslib_1.__importStar(__nccwpck_require__(52486)); +const Parameters = tslib_1.__importStar(__nccwpck_require__(54142)); +/** Class containing Container operations. */ +class ContainerImpl { + client; + /** + * Initialize a new instance of the class Container class. + * @param client Reference to the service client + */ + constructor(client) { + this.client = client; + } + /** + * creates a new container under the specified account. If the container with the same name already + * exists, the operation fails + * @param options The options parameters. + */ + create(options) { + return this.client.sendOperationRequest({ options }, createOperationSpec); + } + /** + * returns all user-defined metadata and system properties for the specified container. The data + * returned does not include the container's list of blobs + * @param options The options parameters. + */ + getProperties(options) { + return this.client.sendOperationRequest({ options }, getPropertiesOperationSpec); + } + /** + * operation marks the specified container for deletion. The container and any blobs contained within + * it are later deleted during garbage collection + * @param options The options parameters. + */ + delete(options) { + return this.client.sendOperationRequest({ options }, deleteOperationSpec); + } + /** + * operation sets one or more user-defined name-value pairs for the specified container. + * @param options The options parameters. + */ + setMetadata(options) { + return this.client.sendOperationRequest({ options }, setMetadataOperationSpec); + } + /** + * gets the permissions for the specified container. The permissions indicate whether container data + * may be accessed publicly. + * @param options The options parameters. + */ + getAccessPolicy(options) { + return this.client.sendOperationRequest({ options }, getAccessPolicyOperationSpec); + } + /** + * sets the permissions for the specified container. The permissions indicate whether blobs in a + * container may be accessed publicly. + * @param options The options parameters. + */ + setAccessPolicy(options) { + return this.client.sendOperationRequest({ options }, setAccessPolicyOperationSpec); + } + /** + * Restores a previously-deleted container. + * @param options The options parameters. + */ + restore(options) { + return this.client.sendOperationRequest({ options }, restoreOperationSpec); + } + /** + * Renames an existing container. + * @param sourceContainerName Required. Specifies the name of the container to rename. + * @param options The options parameters. + */ + rename(sourceContainerName, options) { + return this.client.sendOperationRequest({ sourceContainerName, options }, renameOperationSpec); + } + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch + * boundary. Example header value: multipart/mixed; boundary=batch_ + * @param body Initial data + * @param options The options parameters. + */ + submitBatch(contentLength, multipartContentType, body, options) { + return this.client.sendOperationRequest({ contentLength, multipartContentType, body, options }, submitBatchOperationSpec); + } + /** + * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given + * search expression. Filter blobs searches within the given container. + * @param options The options parameters. + */ + filterBlobs(options) { + return this.client.sendOperationRequest({ options }, filterBlobsOperationSpec); + } + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can + * be 15 to 60 seconds, or can be infinite + * @param options The options parameters. + */ + acquireLease(options) { + return this.client.sendOperationRequest({ options }, acquireLeaseOperationSpec); + } + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can + * be 15 to 60 seconds, or can be infinite + * @param leaseId Specifies the current lease ID on the resource. + * @param options The options parameters. + */ + releaseLease(leaseId, options) { + return this.client.sendOperationRequest({ leaseId, options }, releaseLeaseOperationSpec); + } + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can + * be 15 to 60 seconds, or can be infinite + * @param leaseId Specifies the current lease ID on the resource. + * @param options The options parameters. + */ + renewLease(leaseId, options) { + return this.client.sendOperationRequest({ leaseId, options }, renewLeaseOperationSpec); + } + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can + * be 15 to 60 seconds, or can be infinite + * @param options The options parameters. + */ + breakLease(options) { + return this.client.sendOperationRequest({ options }, breakLeaseOperationSpec); + } + /** + * [Update] establishes and manages a lock on a container for delete operations. The lock duration can + * be 15 to 60 seconds, or can be infinite + * @param leaseId Specifies the current lease ID on the resource. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 + * (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor + * (String) for a list of valid GUID string formats. + * @param options The options parameters. + */ + changeLease(leaseId, proposedLeaseId, options) { + return this.client.sendOperationRequest({ leaseId, proposedLeaseId, options }, changeLeaseOperationSpec); + } + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container + * @param options The options parameters. + */ + listBlobFlatSegment(options) { + return this.client.sendOperationRequest({ options }, listBlobFlatSegmentOperationSpec); + } + /** + * [Update] The List Blobs operation returns a list of the blobs under the specified container + * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix + * element in the response body that acts as a placeholder for all blobs whose names begin with the + * same substring up to the appearance of the delimiter character. The delimiter may be a single + * character or a string. + * @param options The options parameters. + */ + listBlobHierarchySegment(delimiter, options) { + return this.client.sendOperationRequest({ delimiter, options }, listBlobHierarchySegmentOperationSpec); + } + /** + * Returns the sku name and account kind + * @param options The options parameters. + */ + getAccountInfo(options) { + return this.client.sendOperationRequest({ options }, getAccountInfoOperationSpec); + } +} +exports.ContainerImpl = ContainerImpl; +// Operation Specifications +const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true); +const createOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 200: { - headersMapper: Mappers.BlobRenewLeaseHeaders, + 201: { + headersMapper: Mappers.ContainerCreateHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobRenewLeaseExceptionHeaders, + headersMapper: Mappers.ContainerCreateExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + queryParameters: [Parameters.timeoutInSeconds, Parameters.restype2], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.leaseId1, - Parameters.action2, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, + Parameters.metadata, + Parameters.access, + Parameters.defaultEncryptionScope, + Parameters.preventEncryptionScopeOverride, ], isXML: true, serializer: xmlSerializer, }; -const changeLeaseOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", +const getPropertiesOperationSpec = { + path: "/{containerName}", + httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.BlobChangeLeaseHeaders, + headersMapper: Mappers.ContainerGetPropertiesHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobChangeLeaseExceptionHeaders, + headersMapper: Mappers.ContainerGetPropertiesExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + queryParameters: [Parameters.timeoutInSeconds, Parameters.restype2], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.leaseId1, - Parameters.action4, - Parameters.proposedLeaseId1, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, + Parameters.leaseId, ], isXML: true, serializer: xmlSerializer, }; -const breakLeaseOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", +const deleteOperationSpec = { + path: "/{containerName}", + httpMethod: "DELETE", responses: { 202: { - headersMapper: Mappers.BlobBreakLeaseHeaders, + headersMapper: Mappers.ContainerDeleteHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobBreakLeaseExceptionHeaders, + headersMapper: Mappers.ContainerDeleteExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp10], + queryParameters: [Parameters.timeoutInSeconds, Parameters.restype2], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.action3, - Parameters.breakPeriod, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, ], isXML: true, serializer: xmlSerializer, }; -const createSnapshotOperationSpec = { - path: "/{containerName}/{blob}", +const setMetadataOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 201: { - headersMapper: Mappers.BlobCreateSnapshotHeaders, + 200: { + headersMapper: Mappers.ContainerSetMetadataHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobCreateSnapshotExceptionHeaders, + headersMapper: Mappers.ContainerSetMetadataExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp14], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.restype2, + Parameters.comp6, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, @@ -114105,692 +105688,450 @@ const createSnapshotOperationSpec = { Parameters.metadata, Parameters.leaseId, Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.encryptionScope, ], isXML: true, serializer: xmlSerializer, }; -const startCopyFromURLOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", +const getAccessPolicyOperationSpec = { + path: "/{containerName}", + httpMethod: "GET", responses: { - 202: { - headersMapper: Mappers.BlobStartCopyFromURLHeaders, + 200: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "SignedIdentifier" }, + }, + }, + serializedName: "SignedIdentifiers", + xmlName: "SignedIdentifiers", + xmlIsWrapped: true, + xmlElementName: "SignedIdentifier", + }, + headersMapper: Mappers.ContainerGetAccessPolicyHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobStartCopyFromURLExceptionHeaders, + headersMapper: Mappers.ContainerGetAccessPolicyExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.restype2, + Parameters.comp7, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.metadata, Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.immutabilityPolicyExpiry, - Parameters.immutabilityPolicyMode, - Parameters.tier, - Parameters.rehydratePriority, - Parameters.sourceIfModifiedSince, - Parameters.sourceIfUnmodifiedSince, - Parameters.sourceIfMatch, - Parameters.sourceIfNoneMatch, - Parameters.sourceIfTags, - Parameters.copySource, - Parameters.blobTagsString, - Parameters.sealBlob, - Parameters.legalHold1, ], isXML: true, serializer: xmlSerializer, }; -const copyFromURLOperationSpec = { - path: "/{containerName}/{blob}", +const setAccessPolicyOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 202: { - headersMapper: Mappers.BlobCopyFromURLHeaders, + 200: { + headersMapper: Mappers.ContainerSetAccessPolicyHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobCopyFromURLExceptionHeaders, + headersMapper: Mappers.ContainerSetAccessPolicyExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds], + requestBody: Parameters.containerAcl, + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.restype2, + Parameters.comp7, + ], urlParameters: [Parameters.url], headerParameters: [ + Parameters.contentType, + Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.accept1, - Parameters.metadata, + Parameters.access, Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.immutabilityPolicyExpiry, - Parameters.immutabilityPolicyMode, - Parameters.encryptionScope, - Parameters.tier, - Parameters.sourceIfModifiedSince, - Parameters.sourceIfUnmodifiedSince, - Parameters.sourceIfMatch, - Parameters.sourceIfNoneMatch, - Parameters.copySource, - Parameters.blobTagsString, - Parameters.legalHold1, - Parameters.xMsRequiresSync, - Parameters.sourceContentMD5, - Parameters.copySourceAuthorization, - Parameters.copySourceTags, - Parameters.fileRequestIntent, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "xml", serializer: xmlSerializer, }; -const abortCopyFromURLOperationSpec = { - path: "/{containerName}/{blob}", +const restoreOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 204: { - headersMapper: Mappers.BlobAbortCopyFromURLHeaders, + 201: { + headersMapper: Mappers.ContainerRestoreHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobAbortCopyFromURLExceptionHeaders, + headersMapper: Mappers.ContainerRestoreExceptionHeaders, }, }, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.comp15, - Parameters.copyId, + Parameters.restype2, + Parameters.comp8, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.leaseId, - Parameters.copyActionAbortConstant, + Parameters.deletedContainerName, + Parameters.deletedContainerVersion, ], isXML: true, serializer: xmlSerializer, }; -const setTierOperationSpec = { - path: "/{containerName}/{blob}", +const renameOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { 200: { - headersMapper: Mappers.BlobSetTierHeaders, - }, - 202: { - headersMapper: Mappers.BlobSetTierHeaders, + headersMapper: Mappers.ContainerRenameHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobSetTierExceptionHeaders, + headersMapper: Mappers.ContainerRenameExceptionHeaders, }, }, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.snapshot, - Parameters.versionId, - Parameters.comp16, + Parameters.restype2, + Parameters.comp9, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.leaseId, - Parameters.ifTags, - Parameters.rehydratePriority, - Parameters.tier1, + Parameters.sourceContainerName, + Parameters.sourceLeaseId, ], isXML: true, serializer: xmlSerializer, }; -const getAccountInfoOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "GET", +const submitBatchOperationSpec = { + path: "/{containerName}", + httpMethod: "POST", responses: { - 200: { - headersMapper: Mappers.BlobGetAccountInfoHeaders, + 202: { + bodyMapper: { + type: { name: "Stream" }, + serializedName: "parsedResponse", + }, + headersMapper: Mappers.ContainerSubmitBatchHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobGetAccountInfoExceptionHeaders, + headersMapper: Mappers.ContainerSubmitBatchExceptionHeaders, }, }, + requestBody: Parameters.body, queryParameters: [ - Parameters.comp, Parameters.timeoutInSeconds, - Parameters.restype1, + Parameters.comp4, + Parameters.restype2, ], urlParameters: [Parameters.url], headerParameters: [ + Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.accept1, + Parameters.contentLength, + Parameters.multipartContentType, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "xml", serializer: xmlSerializer, }; -const queryOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "POST", +const filterBlobsOperationSpec = { + path: "/{containerName}", + httpMethod: "GET", responses: { 200: { - bodyMapper: { - type: { name: "Stream" }, - serializedName: "parsedResponse", - }, - headersMapper: Mappers.BlobQueryHeaders, - }, - 206: { - bodyMapper: { - type: { name: "Stream" }, - serializedName: "parsedResponse", - }, - headersMapper: Mappers.BlobQueryHeaders, + bodyMapper: Mappers.FilterBlobSegment, + headersMapper: Mappers.ContainerFilterBlobsHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobQueryExceptionHeaders, + headersMapper: Mappers.ContainerFilterBlobsExceptionHeaders, }, }, - requestBody: Parameters.queryRequest, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.snapshot, - Parameters.comp17, + Parameters.marker, + Parameters.maxPageSize, + Parameters.comp5, + Parameters.where, + Parameters.restype2, ], urlParameters: [Parameters.url], headerParameters: [ - Parameters.contentType, - Parameters.accept, - Parameters.version, - Parameters.requestId, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, + Parameters.version, + Parameters.requestId, + Parameters.accept1, ], isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "xml", serializer: xmlSerializer, }; -const getTagsOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "GET", +const acquireLeaseOperationSpec = { + path: "/{containerName}", + httpMethod: "PUT", responses: { - 200: { - bodyMapper: Mappers.BlobTags, - headersMapper: Mappers.BlobGetTagsHeaders, + 201: { + headersMapper: Mappers.ContainerAcquireLeaseHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobGetTagsExceptionHeaders, + headersMapper: Mappers.ContainerAcquireLeaseExceptionHeaders, }, }, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.snapshot, - Parameters.versionId, - Parameters.comp18, + Parameters.restype2, + Parameters.comp10, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.leaseId, - Parameters.ifTags, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.action, + Parameters.duration, + Parameters.proposedLeaseId, ], isXML: true, serializer: xmlSerializer, }; -const setTagsOperationSpec = { - path: "/{containerName}/{blob}", +const releaseLeaseOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 204: { - headersMapper: Mappers.BlobSetTagsHeaders, + 200: { + headersMapper: Mappers.ContainerReleaseLeaseHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlobSetTagsExceptionHeaders, + headersMapper: Mappers.ContainerReleaseLeaseExceptionHeaders, }, }, - requestBody: Parameters.tags, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.versionId, - Parameters.comp18, + Parameters.restype2, + Parameters.comp10, ], urlParameters: [Parameters.url], headerParameters: [ - Parameters.contentType, - Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.leaseId, - Parameters.ifTags, - Parameters.transactionalContentMD5, - Parameters.transactionalContentCrc64, + Parameters.accept1, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.action1, + Parameters.leaseId1, ], isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "xml", serializer: xmlSerializer, }; -//# sourceMappingURL=blob.js.map - -/***/ }), - -/***/ 48652: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BlockBlobImpl = void 0; -const tslib_1 = __nccwpck_require__(4351); -const coreClient = tslib_1.__importStar(__nccwpck_require__(7611)); -const Mappers = tslib_1.__importStar(__nccwpck_require__(52486)); -const Parameters = tslib_1.__importStar(__nccwpck_require__(54142)); -/** Class containing BlockBlob operations. */ -class BlockBlobImpl { - client; - /** - * Initialize a new instance of the class BlockBlob class. - * @param client Reference to the service client - */ - constructor(client) { - this.client = client; - } - /** - * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing - * block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put - * Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a - * partial update of the content of a block blob, use the Put Block List operation. - * @param contentLength The length of the request. - * @param body Initial data - * @param options The options parameters. - */ - upload(contentLength, body, options) { - return this.client.sendOperationRequest({ contentLength, body, options }, uploadOperationSpec); - } - /** - * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read - * from a given URL. This API is supported beginning with the 2020-04-08 version. Partial updates are - * not supported with Put Blob from URL; the content of an existing blob is overwritten with the - * content of the new blob. To perform partial updates to a block blob’s contents using a source URL, - * use the Put Block from URL API in conjunction with Put Block List. - * @param contentLength The length of the request. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to - * 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would - * appear in a request URI. The source blob must either be public or must be authenticated via a shared - * access signature. - * @param options The options parameters. - */ - putBlobFromUrl(contentLength, copySource, options) { - return this.client.sendOperationRequest({ contentLength, copySource, options }, putBlobFromUrlOperationSpec); - } - /** - * The Stage Block operation creates a new block to be committed as part of a blob - * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string - * must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified - * for the blockid parameter must be the same size for each block. - * @param contentLength The length of the request. - * @param body Initial data - * @param options The options parameters. - */ - stageBlock(blockId, contentLength, body, options) { - return this.client.sendOperationRequest({ blockId, contentLength, body, options }, stageBlockOperationSpec); - } - /** - * The Stage Block operation creates a new block to be committed as part of a blob where the contents - * are read from a URL. - * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string - * must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified - * for the blockid parameter must be the same size for each block. - * @param contentLength The length of the request. - * @param sourceUrl Specify a URL to the copy source. - * @param options The options parameters. - */ - stageBlockFromURL(blockId, contentLength, sourceUrl, options) { - return this.client.sendOperationRequest({ blockId, contentLength, sourceUrl, options }, stageBlockFromURLOperationSpec); - } - /** - * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the - * blob. In order to be written as part of a blob, a block must have been successfully written to the - * server in a prior Put Block operation. You can call Put Block List to update a blob by uploading - * only those blocks that have changed, then committing the new and existing blocks together. You can - * do this by specifying whether to commit a block from the committed block list or from the - * uncommitted block list, or to commit the most recently uploaded version of the block, whichever list - * it may belong to. - * @param blocks Blob Blocks. - * @param options The options parameters. - */ - commitBlockList(blocks, options) { - return this.client.sendOperationRequest({ blocks, options }, commitBlockListOperationSpec); - } - /** - * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block - * blob - * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted - * blocks, or both lists together. - * @param options The options parameters. - */ - getBlockList(listType, options) { - return this.client.sendOperationRequest({ listType, options }, getBlockListOperationSpec); - } -} -exports.BlockBlobImpl = BlockBlobImpl; -// Operation Specifications -const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true); -const uploadOperationSpec = { - path: "/{containerName}/{blob}", +const renewLeaseOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 201: { - headersMapper: Mappers.BlockBlobUploadHeaders, + 200: { + headersMapper: Mappers.ContainerRenewLeaseHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlockBlobUploadExceptionHeaders, + headersMapper: Mappers.ContainerRenewLeaseExceptionHeaders, }, }, - requestBody: Parameters.body1, - queryParameters: [Parameters.timeoutInSeconds], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.restype2, + Parameters.comp10, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, - Parameters.contentLength, - Parameters.metadata, - Parameters.leaseId, + Parameters.accept1, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.blobCacheControl, - Parameters.blobContentType, - Parameters.blobContentMD5, - Parameters.blobContentEncoding, - Parameters.blobContentLanguage, - Parameters.blobContentDisposition, - Parameters.immutabilityPolicyExpiry, - Parameters.immutabilityPolicyMode, - Parameters.encryptionScope, - Parameters.tier, - Parameters.blobTagsString, - Parameters.legalHold1, - Parameters.transactionalContentMD5, - Parameters.transactionalContentCrc64, - Parameters.contentType1, - Parameters.accept2, - Parameters.blobType2, + Parameters.leaseId1, + Parameters.action2, ], isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "binary", serializer: xmlSerializer, }; -const putBlobFromUrlOperationSpec = { - path: "/{containerName}/{blob}", +const breakLeaseOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 201: { - headersMapper: Mappers.BlockBlobPutBlobFromUrlHeaders, + 202: { + headersMapper: Mappers.ContainerBreakLeaseHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlockBlobPutBlobFromUrlExceptionHeaders, + headersMapper: Mappers.ContainerBreakLeaseExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.restype2, + Parameters.comp10, + ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.contentLength, - Parameters.metadata, - Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.blobCacheControl, - Parameters.blobContentType, - Parameters.blobContentMD5, - Parameters.blobContentEncoding, - Parameters.blobContentLanguage, - Parameters.blobContentDisposition, - Parameters.encryptionScope, - Parameters.tier, - Parameters.sourceIfModifiedSince, - Parameters.sourceIfUnmodifiedSince, - Parameters.sourceIfMatch, - Parameters.sourceIfNoneMatch, - Parameters.sourceIfTags, - Parameters.copySource, - Parameters.blobTagsString, - Parameters.sourceContentMD5, - Parameters.copySourceAuthorization, - Parameters.copySourceTags, - Parameters.fileRequestIntent, - Parameters.transactionalContentMD5, - Parameters.blobType2, - Parameters.copySourceBlobProperties, + Parameters.action3, + Parameters.breakPeriod, ], isXML: true, serializer: xmlSerializer, }; -const stageBlockOperationSpec = { - path: "/{containerName}/{blob}", +const changeLeaseOperationSpec = { + path: "/{containerName}", httpMethod: "PUT", responses: { - 201: { - headersMapper: Mappers.BlockBlobStageBlockHeaders, + 200: { + headersMapper: Mappers.ContainerChangeLeaseHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlockBlobStageBlockExceptionHeaders, + headersMapper: Mappers.ContainerChangeLeaseExceptionHeaders, }, }, - requestBody: Parameters.body1, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.comp24, - Parameters.blockId, + Parameters.restype2, + Parameters.comp10, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, - Parameters.contentLength, - Parameters.leaseId, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.encryptionScope, - Parameters.transactionalContentMD5, - Parameters.transactionalContentCrc64, - Parameters.contentType1, - Parameters.accept2, + Parameters.accept1, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.leaseId1, + Parameters.action4, + Parameters.proposedLeaseId1, ], isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "binary", serializer: xmlSerializer, }; -const stageBlockFromURLOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", +const listBlobFlatSegmentOperationSpec = { + path: "/{containerName}", + httpMethod: "GET", responses: { - 201: { - headersMapper: Mappers.BlockBlobStageBlockFromURLHeaders, + 200: { + bodyMapper: Mappers.ListBlobsFlatSegmentResponse, + headersMapper: Mappers.ContainerListBlobFlatSegmentHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlockBlobStageBlockFromURLExceptionHeaders, + headersMapper: Mappers.ContainerListBlobFlatSegmentExceptionHeaders, }, }, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.comp24, - Parameters.blockId, + Parameters.comp2, + Parameters.prefix, + Parameters.marker, + Parameters.maxPageSize, + Parameters.restype2, + Parameters.include1, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.contentLength, - Parameters.leaseId, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.encryptionScope, - Parameters.sourceIfModifiedSince, - Parameters.sourceIfUnmodifiedSince, - Parameters.sourceIfMatch, - Parameters.sourceIfNoneMatch, - Parameters.sourceContentMD5, - Parameters.copySourceAuthorization, - Parameters.fileRequestIntent, - Parameters.sourceUrl, - Parameters.sourceContentCrc64, - Parameters.sourceRange1, ], isXML: true, serializer: xmlSerializer, }; -const commitBlockListOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", +const listBlobHierarchySegmentOperationSpec = { + path: "/{containerName}", + httpMethod: "GET", responses: { - 201: { - headersMapper: Mappers.BlockBlobCommitBlockListHeaders, + 200: { + bodyMapper: Mappers.ListBlobsHierarchySegmentResponse, + headersMapper: Mappers.ContainerListBlobHierarchySegmentHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlockBlobCommitBlockListExceptionHeaders, + headersMapper: Mappers.ContainerListBlobHierarchySegmentExceptionHeaders, }, }, - requestBody: Parameters.blocks, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp25], + queryParameters: [ + Parameters.timeoutInSeconds, + Parameters.comp2, + Parameters.prefix, + Parameters.marker, + Parameters.maxPageSize, + Parameters.restype2, + Parameters.include1, + Parameters.delimiter, + ], urlParameters: [Parameters.url], headerParameters: [ - Parameters.contentType, - Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.metadata, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.blobCacheControl, - Parameters.blobContentType, - Parameters.blobContentMD5, - Parameters.blobContentEncoding, - Parameters.blobContentLanguage, - Parameters.blobContentDisposition, - Parameters.immutabilityPolicyExpiry, - Parameters.immutabilityPolicyMode, - Parameters.encryptionScope, - Parameters.tier, - Parameters.blobTagsString, - Parameters.legalHold1, - Parameters.transactionalContentMD5, - Parameters.transactionalContentCrc64, + Parameters.accept1, ], isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "xml", serializer: xmlSerializer, }; -const getBlockListOperationSpec = { - path: "/{containerName}/{blob}", +const getAccountInfoOperationSpec = { + path: "/{containerName}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.BlockList, - headersMapper: Mappers.BlockBlobGetBlockListHeaders, + headersMapper: Mappers.ContainerGetAccountInfoHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.BlockBlobGetBlockListExceptionHeaders, + headersMapper: Mappers.ContainerGetAccountInfoExceptionHeaders, }, }, queryParameters: [ + Parameters.comp, Parameters.timeoutInSeconds, - Parameters.snapshot, - Parameters.comp25, - Parameters.listType, + Parameters.restype1, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.leaseId, - Parameters.ifTags, ], isXML: true, serializer: xmlSerializer, }; -//# sourceMappingURL=blockBlob.js.map +//# sourceMappingURL=container.js.map /***/ }), -/***/ 3269: +/***/ 13759: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -114803,308 +106144,337 @@ const getBlockListOperationSpec = { * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContainerImpl = void 0; +const tslib_1 = __nccwpck_require__(4351); +tslib_1.__exportStar(__nccwpck_require__(1746), exports); +tslib_1.__exportStar(__nccwpck_require__(3269), exports); +tslib_1.__exportStar(__nccwpck_require__(8296), exports); +tslib_1.__exportStar(__nccwpck_require__(69477), exports); +tslib_1.__exportStar(__nccwpck_require__(80313), exports); +tslib_1.__exportStar(__nccwpck_require__(48652), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 69477: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PageBlobImpl = void 0; const tslib_1 = __nccwpck_require__(4351); const coreClient = tslib_1.__importStar(__nccwpck_require__(7611)); const Mappers = tslib_1.__importStar(__nccwpck_require__(52486)); const Parameters = tslib_1.__importStar(__nccwpck_require__(54142)); -/** Class containing Container operations. */ -class ContainerImpl { - client; - /** - * Initialize a new instance of the class Container class. - * @param client Reference to the service client - */ - constructor(client) { - this.client = client; - } - /** - * creates a new container under the specified account. If the container with the same name already - * exists, the operation fails - * @param options The options parameters. - */ - create(options) { - return this.client.sendOperationRequest({ options }, createOperationSpec); - } - /** - * returns all user-defined metadata and system properties for the specified container. The data - * returned does not include the container's list of blobs - * @param options The options parameters. - */ - getProperties(options) { - return this.client.sendOperationRequest({ options }, getPropertiesOperationSpec); - } - /** - * operation marks the specified container for deletion. The container and any blobs contained within - * it are later deleted during garbage collection - * @param options The options parameters. - */ - delete(options) { - return this.client.sendOperationRequest({ options }, deleteOperationSpec); - } - /** - * operation sets one or more user-defined name-value pairs for the specified container. - * @param options The options parameters. - */ - setMetadata(options) { - return this.client.sendOperationRequest({ options }, setMetadataOperationSpec); - } - /** - * gets the permissions for the specified container. The permissions indicate whether container data - * may be accessed publicly. - * @param options The options parameters. - */ - getAccessPolicy(options) { - return this.client.sendOperationRequest({ options }, getAccessPolicyOperationSpec); - } - /** - * sets the permissions for the specified container. The permissions indicate whether blobs in a - * container may be accessed publicly. - * @param options The options parameters. - */ - setAccessPolicy(options) { - return this.client.sendOperationRequest({ options }, setAccessPolicyOperationSpec); - } - /** - * Restores a previously-deleted container. - * @param options The options parameters. - */ - restore(options) { - return this.client.sendOperationRequest({ options }, restoreOperationSpec); - } - /** - * Renames an existing container. - * @param sourceContainerName Required. Specifies the name of the container to rename. - * @param options The options parameters. - */ - rename(sourceContainerName, options) { - return this.client.sendOperationRequest({ sourceContainerName, options }, renameOperationSpec); - } +/** Class containing PageBlob operations. */ +class PageBlobImpl { + client; /** - * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * @param contentLength The length of the request. - * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch - * boundary. Example header value: multipart/mixed; boundary=batch_ - * @param body Initial data - * @param options The options parameters. + * Initialize a new instance of the class PageBlob class. + * @param client Reference to the service client */ - submitBatch(contentLength, multipartContentType, body, options) { - return this.client.sendOperationRequest({ contentLength, multipartContentType, body, options }, submitBatchOperationSpec); + constructor(client) { + this.client = client; } /** - * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given - * search expression. Filter blobs searches within the given container. + * The Create operation creates a new page blob. + * @param contentLength The length of the request. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The + * page blob size must be aligned to a 512-byte boundary. * @param options The options parameters. */ - filterBlobs(options) { - return this.client.sendOperationRequest({ options }, filterBlobsOperationSpec); + create(contentLength, blobContentLength, options) { + return this.client.sendOperationRequest({ contentLength, blobContentLength, options }, createOperationSpec); } /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can - * be 15 to 60 seconds, or can be infinite + * The Upload Pages operation writes a range of pages to a page blob + * @param contentLength The length of the request. + * @param body Initial data * @param options The options parameters. */ - acquireLease(options) { - return this.client.sendOperationRequest({ options }, acquireLeaseOperationSpec); + uploadPages(contentLength, body, options) { + return this.client.sendOperationRequest({ contentLength, body, options }, uploadPagesOperationSpec); } /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can - * be 15 to 60 seconds, or can be infinite - * @param leaseId Specifies the current lease ID on the resource. + * The Clear Pages operation clears a set of pages from a page blob + * @param contentLength The length of the request. * @param options The options parameters. */ - releaseLease(leaseId, options) { - return this.client.sendOperationRequest({ leaseId, options }, releaseLeaseOperationSpec); + clearPages(contentLength, options) { + return this.client.sendOperationRequest({ contentLength, options }, clearPagesOperationSpec); } /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can - * be 15 to 60 seconds, or can be infinite - * @param leaseId Specifies the current lease ID on the resource. + * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a + * URL + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. The length of this range should + * match the ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 + * aligned and range-end is required. * @param options The options parameters. */ - renewLease(leaseId, options) { - return this.client.sendOperationRequest({ leaseId, options }, renewLeaseOperationSpec); + uploadPagesFromURL(sourceUrl, sourceRange, contentLength, range, options) { + return this.client.sendOperationRequest({ sourceUrl, sourceRange, contentLength, range, options }, uploadPagesFromURLOperationSpec); } /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can - * be 15 to 60 seconds, or can be infinite + * The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a + * page blob * @param options The options parameters. */ - breakLease(options) { - return this.client.sendOperationRequest({ options }, breakLeaseOperationSpec); + getPageRanges(options) { + return this.client.sendOperationRequest({ options }, getPageRangesOperationSpec); } /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can - * be 15 to 60 seconds, or can be infinite - * @param leaseId Specifies the current lease ID on the resource. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 - * (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor - * (String) for a list of valid GUID string formats. + * The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were + * changed between target blob and previous snapshot. * @param options The options parameters. */ - changeLease(leaseId, proposedLeaseId, options) { - return this.client.sendOperationRequest({ leaseId, proposedLeaseId, options }, changeLeaseOperationSpec); + getPageRangesDiff(options) { + return this.client.sendOperationRequest({ options }, getPageRangesDiffOperationSpec); } /** - * [Update] The List Blobs operation returns a list of the blobs under the specified container + * Resize the Blob + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The + * page blob size must be aligned to a 512-byte boundary. * @param options The options parameters. */ - listBlobFlatSegment(options) { - return this.client.sendOperationRequest({ options }, listBlobFlatSegmentOperationSpec); + resize(blobContentLength, options) { + return this.client.sendOperationRequest({ blobContentLength, options }, resizeOperationSpec); } /** - * [Update] The List Blobs operation returns a list of the blobs under the specified container - * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix - * element in the response body that acts as a placeholder for all blobs whose names begin with the - * same substring up to the appearance of the delimiter character. The delimiter may be a single - * character or a string. + * Update the sequence number of the blob + * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. + * This property applies to page blobs only. This property indicates how the service should modify the + * blob's sequence number * @param options The options parameters. */ - listBlobHierarchySegment(delimiter, options) { - return this.client.sendOperationRequest({ delimiter, options }, listBlobHierarchySegmentOperationSpec); + updateSequenceNumber(sequenceNumberAction, options) { + return this.client.sendOperationRequest({ sequenceNumberAction, options }, updateSequenceNumberOperationSpec); } /** - * Returns the sku name and account kind + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. + * The snapshot is copied such that only the differential changes between the previously copied + * snapshot are transferred to the destination. The copied snapshots are complete copies of the + * original snapshot and can be read or copied from as usual. This API is supported since REST version + * 2016-05-31. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to + * 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would + * appear in a request URI. The source blob must either be public or must be authenticated via a shared + * access signature. * @param options The options parameters. */ - getAccountInfo(options) { - return this.client.sendOperationRequest({ options }, getAccountInfoOperationSpec); + copyIncremental(copySource, options) { + return this.client.sendOperationRequest({ copySource, options }, copyIncrementalOperationSpec); } } -exports.ContainerImpl = ContainerImpl; +exports.PageBlobImpl = PageBlobImpl; // Operation Specifications const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true); const createOperationSpec = { - path: "/{containerName}", + path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { 201: { - headersMapper: Mappers.ContainerCreateHeaders, + headersMapper: Mappers.PageBlobCreateHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerCreateExceptionHeaders, + headersMapper: Mappers.PageBlobCreateExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.restype2], + queryParameters: [Parameters.timeoutInSeconds], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.contentLength, Parameters.metadata, - Parameters.access, - Parameters.defaultEncryptionScope, - Parameters.preventEncryptionScopeOverride, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.blobCacheControl, + Parameters.blobContentType, + Parameters.blobContentMD5, + Parameters.blobContentEncoding, + Parameters.blobContentLanguage, + Parameters.blobContentDisposition, + Parameters.immutabilityPolicyExpiry, + Parameters.immutabilityPolicyMode, + Parameters.encryptionScope, + Parameters.tier, + Parameters.blobTagsString, + Parameters.legalHold1, + Parameters.blobType, + Parameters.blobContentLength, + Parameters.blobSequenceNumber, ], isXML: true, serializer: xmlSerializer, }; -const getPropertiesOperationSpec = { - path: "/{containerName}", - httpMethod: "GET", +const uploadPagesOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", responses: { - 200: { - headersMapper: Mappers.ContainerGetPropertiesHeaders, + 201: { + headersMapper: Mappers.PageBlobUploadPagesHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerGetPropertiesExceptionHeaders, + headersMapper: Mappers.PageBlobUploadPagesExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.restype2], + requestBody: Parameters.body1, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp19], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, - Parameters.accept1, + Parameters.contentLength, Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.range, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.encryptionScope, + Parameters.transactionalContentMD5, + Parameters.transactionalContentCrc64, + Parameters.contentType1, + Parameters.accept2, + Parameters.pageWrite, + Parameters.ifSequenceNumberLessThanOrEqualTo, + Parameters.ifSequenceNumberLessThan, + Parameters.ifSequenceNumberEqualTo, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "binary", serializer: xmlSerializer, }; -const deleteOperationSpec = { - path: "/{containerName}", - httpMethod: "DELETE", +const clearPagesOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", responses: { - 202: { - headersMapper: Mappers.ContainerDeleteHeaders, + 201: { + headersMapper: Mappers.PageBlobClearPagesHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerDeleteExceptionHeaders, + headersMapper: Mappers.PageBlobClearPagesExceptionHeaders, }, }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.restype2], + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp19], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, + Parameters.contentLength, Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, + Parameters.range, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.encryptionScope, + Parameters.ifSequenceNumberLessThanOrEqualTo, + Parameters.ifSequenceNumberLessThan, + Parameters.ifSequenceNumberEqualTo, + Parameters.pageWrite1, ], isXML: true, serializer: xmlSerializer, }; -const setMetadataOperationSpec = { - path: "/{containerName}", +const uploadPagesFromURLOperationSpec = { + path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { - 200: { - headersMapper: Mappers.ContainerSetMetadataHeaders, + 201: { + headersMapper: Mappers.PageBlobUploadPagesFromURLHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerSetMetadataExceptionHeaders, + headersMapper: Mappers.PageBlobUploadPagesFromURLExceptionHeaders, }, }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp6, - ], + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp19], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.metadata, + Parameters.contentLength, Parameters.leaseId, Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.encryptionScope, + Parameters.sourceIfModifiedSince, + Parameters.sourceIfUnmodifiedSince, + Parameters.sourceIfMatch, + Parameters.sourceIfNoneMatch, + Parameters.sourceContentMD5, + Parameters.copySourceAuthorization, + Parameters.fileRequestIntent, + Parameters.pageWrite, + Parameters.ifSequenceNumberLessThanOrEqualTo, + Parameters.ifSequenceNumberLessThan, + Parameters.ifSequenceNumberEqualTo, + Parameters.sourceUrl, + Parameters.sourceRange, + Parameters.sourceContentCrc64, + Parameters.range1, ], isXML: true, serializer: xmlSerializer, }; -const getAccessPolicyOperationSpec = { - path: "/{containerName}", +const getPageRangesOperationSpec = { + path: "/{containerName}/{blob}", httpMethod: "GET", responses: { 200: { - bodyMapper: { - type: { - name: "Sequence", - element: { - type: { name: "Composite", className: "SignedIdentifier" }, - }, - }, - serializedName: "SignedIdentifiers", - xmlName: "SignedIdentifiers", - xmlIsWrapped: true, - xmlElementName: "SignedIdentifier", - }, - headersMapper: Mappers.ContainerGetAccessPolicyHeaders, + bodyMapper: Mappers.PageList, + headersMapper: Mappers.PageBlobGetPageRangesHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerGetAccessPolicyExceptionHeaders, + headersMapper: Mappers.PageBlobGetPageRangesExceptionHeaders, }, }, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp7, + Parameters.marker, + Parameters.maxPageSize, + Parameters.snapshot, + Parameters.comp20, ], urlParameters: [Parameters.url], headerParameters: [ @@ -115112,338 +106482,411 @@ const getAccessPolicyOperationSpec = { Parameters.requestId, Parameters.accept1, Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.range, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, ], isXML: true, serializer: xmlSerializer, }; -const setAccessPolicyOperationSpec = { - path: "/{containerName}", - httpMethod: "PUT", +const getPageRangesDiffOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.ContainerSetAccessPolicyHeaders, + bodyMapper: Mappers.PageList, + headersMapper: Mappers.PageBlobGetPageRangesDiffHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerSetAccessPolicyExceptionHeaders, + headersMapper: Mappers.PageBlobGetPageRangesDiffExceptionHeaders, }, }, - requestBody: Parameters.containerAcl, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp7, + Parameters.marker, + Parameters.maxPageSize, + Parameters.snapshot, + Parameters.comp20, + Parameters.prevsnapshot, ], urlParameters: [Parameters.url], headerParameters: [ - Parameters.contentType, - Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.access, + Parameters.accept1, Parameters.leaseId, Parameters.ifModifiedSince, Parameters.ifUnmodifiedSince, + Parameters.range, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.prevSnapshotUrl, ], isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "xml", serializer: xmlSerializer, }; -const restoreOperationSpec = { - path: "/{containerName}", +const resizeOperationSpec = { + path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { - 201: { - headersMapper: Mappers.ContainerRestoreHeaders, + 200: { + headersMapper: Mappers.PageBlobResizeHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerRestoreExceptionHeaders, + headersMapper: Mappers.PageBlobResizeExceptionHeaders, }, }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp8, - ], + queryParameters: [Parameters.comp, Parameters.timeoutInSeconds], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.deletedContainerName, - Parameters.deletedContainerVersion, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.encryptionKey, + Parameters.encryptionKeySha256, + Parameters.encryptionAlgorithm, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.encryptionScope, + Parameters.blobContentLength, ], isXML: true, serializer: xmlSerializer, }; -const renameOperationSpec = { - path: "/{containerName}", +const updateSequenceNumberOperationSpec = { + path: "/{containerName}/{blob}", httpMethod: "PUT", responses: { 200: { - headersMapper: Mappers.ContainerRenameHeaders, + headersMapper: Mappers.PageBlobUpdateSequenceNumberHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerRenameExceptionHeaders, + headersMapper: Mappers.PageBlobUpdateSequenceNumberExceptionHeaders, }, }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp9, + queryParameters: [Parameters.comp, Parameters.timeoutInSeconds], + urlParameters: [Parameters.url], + headerParameters: [ + Parameters.version, + Parameters.requestId, + Parameters.accept1, + Parameters.leaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.blobSequenceNumber, + Parameters.sequenceNumberAction, ], + isXML: true, + serializer: xmlSerializer, +}; +const copyIncrementalOperationSpec = { + path: "/{containerName}/{blob}", + httpMethod: "PUT", + responses: { + 202: { + headersMapper: Mappers.PageBlobCopyIncrementalHeaders, + }, + default: { + bodyMapper: Mappers.StorageError, + headersMapper: Mappers.PageBlobCopyIncrementalExceptionHeaders, + }, + }, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp21], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.sourceContainerName, - Parameters.sourceLeaseId, + Parameters.ifModifiedSince, + Parameters.ifUnmodifiedSince, + Parameters.ifMatch, + Parameters.ifNoneMatch, + Parameters.ifTags, + Parameters.copySource, ], isXML: true, serializer: xmlSerializer, }; -const submitBatchOperationSpec = { - path: "/{containerName}", - httpMethod: "POST", +//# sourceMappingURL=pageBlob.js.map + +/***/ }), + +/***/ 1746: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ServiceImpl = void 0; +const tslib_1 = __nccwpck_require__(4351); +const coreClient = tslib_1.__importStar(__nccwpck_require__(7611)); +const Mappers = tslib_1.__importStar(__nccwpck_require__(52486)); +const Parameters = tslib_1.__importStar(__nccwpck_require__(54142)); +/** Class containing Service operations. */ +class ServiceImpl { + client; + /** + * Initialize a new instance of the class Service class. + * @param client Reference to the service client + */ + constructor(client) { + this.client = client; + } + /** + * Sets properties for a storage account's Blob service endpoint, including properties for Storage + * Analytics and CORS (Cross-Origin Resource Sharing) rules + * @param blobServiceProperties The StorageService properties. + * @param options The options parameters. + */ + setProperties(blobServiceProperties, options) { + return this.client.sendOperationRequest({ blobServiceProperties, options }, setPropertiesOperationSpec); + } + /** + * gets the properties of a storage account's Blob service, including properties for Storage Analytics + * and CORS (Cross-Origin Resource Sharing) rules. + * @param options The options parameters. + */ + getProperties(options) { + return this.client.sendOperationRequest({ options }, getPropertiesOperationSpec); + } + /** + * Retrieves statistics related to replication for the Blob service. It is only available on the + * secondary location endpoint when read-access geo-redundant replication is enabled for the storage + * account. + * @param options The options parameters. + */ + getStatistics(options) { + return this.client.sendOperationRequest({ options }, getStatisticsOperationSpec); + } + /** + * The List Containers Segment operation returns a list of the containers under the specified account + * @param options The options parameters. + */ + listContainersSegment(options) { + return this.client.sendOperationRequest({ options }, listContainersSegmentOperationSpec); + } + /** + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using + * bearer token authentication. + * @param keyInfo Key information + * @param options The options parameters. + */ + getUserDelegationKey(keyInfo, options) { + return this.client.sendOperationRequest({ keyInfo, options }, getUserDelegationKeyOperationSpec); + } + /** + * Returns the sku name and account kind + * @param options The options parameters. + */ + getAccountInfo(options) { + return this.client.sendOperationRequest({ options }, getAccountInfoOperationSpec); + } + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch + * boundary. Example header value: multipart/mixed; boundary=batch_ + * @param body Initial data + * @param options The options parameters. + */ + submitBatch(contentLength, multipartContentType, body, options) { + return this.client.sendOperationRequest({ contentLength, multipartContentType, body, options }, submitBatchOperationSpec); + } + /** + * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a + * given search expression. Filter blobs searches across all containers within a storage account but + * can be scoped within the expression to a single container. + * @param options The options parameters. + */ + filterBlobs(options) { + return this.client.sendOperationRequest({ options }, filterBlobsOperationSpec); + } +} +exports.ServiceImpl = ServiceImpl; +// Operation Specifications +const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true); +const setPropertiesOperationSpec = { + path: "/", + httpMethod: "PUT", responses: { 202: { - bodyMapper: { - type: { name: "Stream" }, - serializedName: "parsedResponse", - }, - headersMapper: Mappers.ContainerSubmitBatchHeaders, + headersMapper: Mappers.ServiceSetPropertiesHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerSubmitBatchExceptionHeaders, + headersMapper: Mappers.ServiceSetPropertiesExceptionHeaders, }, }, - requestBody: Parameters.body, + requestBody: Parameters.blobServiceProperties, queryParameters: [ + Parameters.restype, + Parameters.comp, Parameters.timeoutInSeconds, - Parameters.comp4, - Parameters.restype2, ], urlParameters: [Parameters.url], headerParameters: [ + Parameters.contentType, Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.contentLength, - Parameters.multipartContentType, ], isXML: true, contentType: "application/xml; charset=utf-8", mediaType: "xml", serializer: xmlSerializer, }; -const filterBlobsOperationSpec = { - path: "/{containerName}", +const getPropertiesOperationSpec = { + path: "/", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.FilterBlobSegment, - headersMapper: Mappers.ContainerFilterBlobsHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerFilterBlobsExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.marker, - Parameters.maxPageSize, - Parameters.comp5, - Parameters.where, - Parameters.restype2, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - ], - isXML: true, - serializer: xmlSerializer, -}; -const acquireLeaseOperationSpec = { - path: "/{containerName}", - httpMethod: "PUT", - responses: { - 201: { - headersMapper: Mappers.ContainerAcquireLeaseHeaders, + bodyMapper: Mappers.BlobServiceProperties, + headersMapper: Mappers.ServiceGetPropertiesHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerAcquireLeaseExceptionHeaders, + headersMapper: Mappers.ServiceGetPropertiesExceptionHeaders, }, }, queryParameters: [ + Parameters.restype, + Parameters.comp, Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp10, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.action, - Parameters.duration, - Parameters.proposedLeaseId, ], isXML: true, serializer: xmlSerializer, }; -const releaseLeaseOperationSpec = { - path: "/{containerName}", - httpMethod: "PUT", +const getStatisticsOperationSpec = { + path: "/", + httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.ContainerReleaseLeaseHeaders, + bodyMapper: Mappers.BlobServiceStatistics, + headersMapper: Mappers.ServiceGetStatisticsHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerReleaseLeaseExceptionHeaders, + headersMapper: Mappers.ServiceGetStatisticsExceptionHeaders, }, }, queryParameters: [ + Parameters.restype, Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp10, + Parameters.comp1, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.action1, - Parameters.leaseId1, ], isXML: true, serializer: xmlSerializer, }; -const renewLeaseOperationSpec = { - path: "/{containerName}", - httpMethod: "PUT", +const listContainersSegmentOperationSpec = { + path: "/", + httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.ContainerRenewLeaseHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerRenewLeaseExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp10, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.leaseId1, - Parameters.action2, - ], - isXML: true, - serializer: xmlSerializer, -}; -const breakLeaseOperationSpec = { - path: "/{containerName}", - httpMethod: "PUT", - responses: { - 202: { - headersMapper: Mappers.ContainerBreakLeaseHeaders, + bodyMapper: Mappers.ListContainersSegmentResponse, + headersMapper: Mappers.ServiceListContainersSegmentHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerBreakLeaseExceptionHeaders, + headersMapper: Mappers.ServiceListContainersSegmentExceptionHeaders, }, }, queryParameters: [ Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp10, + Parameters.comp2, + Parameters.prefix, + Parameters.marker, + Parameters.maxPageSize, + Parameters.include, ], urlParameters: [Parameters.url], headerParameters: [ Parameters.version, Parameters.requestId, Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.action3, - Parameters.breakPeriod, ], isXML: true, serializer: xmlSerializer, }; -const changeLeaseOperationSpec = { - path: "/{containerName}", - httpMethod: "PUT", +const getUserDelegationKeyOperationSpec = { + path: "/", + httpMethod: "POST", responses: { 200: { - headersMapper: Mappers.ContainerChangeLeaseHeaders, + bodyMapper: Mappers.UserDelegationKey, + headersMapper: Mappers.ServiceGetUserDelegationKeyHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerChangeLeaseExceptionHeaders, + headersMapper: Mappers.ServiceGetUserDelegationKeyExceptionHeaders, }, }, + requestBody: Parameters.keyInfo, queryParameters: [ + Parameters.restype, Parameters.timeoutInSeconds, - Parameters.restype2, - Parameters.comp10, + Parameters.comp3, ], urlParameters: [Parameters.url], headerParameters: [ + Parameters.contentType, + Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.leaseId1, - Parameters.action4, - Parameters.proposedLeaseId1, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "xml", serializer: xmlSerializer, }; -const listBlobFlatSegmentOperationSpec = { - path: "/{containerName}", +const getAccountInfoOperationSpec = { + path: "/", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ListBlobsFlatSegmentResponse, - headersMapper: Mappers.ContainerListBlobFlatSegmentHeaders, + headersMapper: Mappers.ServiceGetAccountInfoHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerListBlobFlatSegmentExceptionHeaders, + headersMapper: Mappers.ServiceGetAccountInfoExceptionHeaders, }, }, queryParameters: [ + Parameters.comp, Parameters.timeoutInSeconds, - Parameters.comp2, - Parameters.prefix, - Parameters.marker, - Parameters.maxPageSize, - Parameters.restype2, - Parameters.include1, + Parameters.restype1, ], urlParameters: [Parameters.url], headerParameters: [ @@ -115454,54 +106897,56 @@ const listBlobFlatSegmentOperationSpec = { isXML: true, serializer: xmlSerializer, }; -const listBlobHierarchySegmentOperationSpec = { - path: "/{containerName}", - httpMethod: "GET", +const submitBatchOperationSpec = { + path: "/", + httpMethod: "POST", responses: { - 200: { - bodyMapper: Mappers.ListBlobsHierarchySegmentResponse, - headersMapper: Mappers.ContainerListBlobHierarchySegmentHeaders, + 202: { + bodyMapper: { + type: { name: "Stream" }, + serializedName: "parsedResponse", + }, + headersMapper: Mappers.ServiceSubmitBatchHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerListBlobHierarchySegmentExceptionHeaders, + headersMapper: Mappers.ServiceSubmitBatchExceptionHeaders, }, }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.comp2, - Parameters.prefix, - Parameters.marker, - Parameters.maxPageSize, - Parameters.restype2, - Parameters.include1, - Parameters.delimiter, - ], + requestBody: Parameters.body, + queryParameters: [Parameters.timeoutInSeconds, Parameters.comp4], urlParameters: [Parameters.url], headerParameters: [ + Parameters.accept, Parameters.version, Parameters.requestId, - Parameters.accept1, + Parameters.contentLength, + Parameters.multipartContentType, ], isXML: true, + contentType: "application/xml; charset=utf-8", + mediaType: "xml", serializer: xmlSerializer, }; -const getAccountInfoOperationSpec = { - path: "/{containerName}", +const filterBlobsOperationSpec = { + path: "/", httpMethod: "GET", responses: { 200: { - headersMapper: Mappers.ContainerGetAccountInfoHeaders, + bodyMapper: Mappers.FilterBlobSegment, + headersMapper: Mappers.ServiceFilterBlobsHeaders, }, default: { bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ContainerGetAccountInfoExceptionHeaders, + headersMapper: Mappers.ServiceFilterBlobsExceptionHeaders, }, }, queryParameters: [ - Parameters.comp, Parameters.timeoutInSeconds, - Parameters.restype1, + Parameters.marker, + Parameters.maxPageSize, + Parameters.comp5, + Parameters.where, ], urlParameters: [Parameters.url], headerParameters: [ @@ -115512,1058 +106957,2613 @@ const getAccountInfoOperationSpec = { isXML: true, serializer: xmlSerializer, }; +//# sourceMappingURL=service.js.map + +/***/ }), + +/***/ 24763: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=appendBlob.js.map + +/***/ }), + +/***/ 57427: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=blob.js.map + +/***/ }), + +/***/ 56945: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=blockBlob.js.map + +/***/ }), + +/***/ 43634: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); //# sourceMappingURL=container.js.map /***/ }), -/***/ 13759: +/***/ 68529: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __nccwpck_require__(4351); +tslib_1.__exportStar(__nccwpck_require__(75650), exports); +tslib_1.__exportStar(__nccwpck_require__(43634), exports); +tslib_1.__exportStar(__nccwpck_require__(57427), exports); +tslib_1.__exportStar(__nccwpck_require__(76425), exports); +tslib_1.__exportStar(__nccwpck_require__(24763), exports); +tslib_1.__exportStar(__nccwpck_require__(56945), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 76425: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=pageBlob.js.map + +/***/ }), + +/***/ 75650: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=service.js.map + +/***/ }), + +/***/ 92252: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageClient = void 0; +const tslib_1 = __nccwpck_require__(4351); +const coreHttpCompat = tslib_1.__importStar(__nccwpck_require__(25083)); +const index_js_1 = __nccwpck_require__(13759); +class StorageClient extends coreHttpCompat.ExtendedServiceClient { + url; + version; + /** + * Initializes a new instance of the StorageClient class. + * @param url The URL of the service account, container, or blob that is the target of the desired + * operation. + * @param options The parameter options + */ + constructor(url, options) { + if (url === undefined) { + throw new Error("'url' cannot be null"); + } + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults = { + requestContentType: "application/json; charset=utf-8", + }; + const packageDetails = `azsdk-js-azure-storage-blob/12.29.1`; + const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix, + }, + endpoint: options.endpoint ?? options.baseUri ?? "{url}", + }; + super(optionsWithDefaults); + // Parameter assignments + this.url = url; + // Assigning values to Constant parameters + this.version = options.version || "2025-11-05"; + this.service = new index_js_1.ServiceImpl(this); + this.container = new index_js_1.ContainerImpl(this); + this.blob = new index_js_1.BlobImpl(this); + this.pageBlob = new index_js_1.PageBlobImpl(this); + this.appendBlob = new index_js_1.AppendBlobImpl(this); + this.blockBlob = new index_js_1.BlockBlobImpl(this); + } + service; + container; + blob; + pageBlob; + appendBlob; + blockBlob; +} +exports.StorageClient = StorageClient; +//# sourceMappingURL=storageClient.js.map + +/***/ }), + +/***/ 39241: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.KnownEncryptionAlgorithmType = void 0; +/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */ +var KnownEncryptionAlgorithmType; +(function (KnownEncryptionAlgorithmType) { + KnownEncryptionAlgorithmType["AES256"] = "AES256"; +})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {})); +//# sourceMappingURL=generatedModels.js.map + +/***/ }), + +/***/ 37168: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.logger = exports.RestError = exports.BaseRequestPolicy = exports.StorageOAuthScopes = exports.newPipeline = exports.isPipelineLike = exports.Pipeline = exports.getBlobServiceAccountAudience = exports.StorageBlobAudience = exports.PremiumPageBlobTier = exports.BlockBlobTier = exports.generateBlobSASQueryParameters = exports.generateAccountSASQueryParameters = void 0; +const tslib_1 = __nccwpck_require__(4351); +const core_rest_pipeline_1 = __nccwpck_require__(29146); +Object.defineProperty(exports, "RestError", ({ enumerable: true, get: function () { return core_rest_pipeline_1.RestError; } })); +tslib_1.__exportStar(__nccwpck_require__(12679), exports); +tslib_1.__exportStar(__nccwpck_require__(54437), exports); +tslib_1.__exportStar(__nccwpck_require__(63750), exports); +tslib_1.__exportStar(__nccwpck_require__(20106), exports); +tslib_1.__exportStar(__nccwpck_require__(70793), exports); +tslib_1.__exportStar(__nccwpck_require__(70790), exports); +tslib_1.__exportStar(__nccwpck_require__(34606), exports); +var AccountSASSignatureValues_js_1 = __nccwpck_require__(72763); +Object.defineProperty(exports, "generateAccountSASQueryParameters", ({ enumerable: true, get: function () { return AccountSASSignatureValues_js_1.generateAccountSASQueryParameters; } })); +tslib_1.__exportStar(__nccwpck_require__(73689), exports); +tslib_1.__exportStar(__nccwpck_require__(71861), exports); +tslib_1.__exportStar(__nccwpck_require__(1227), exports); +tslib_1.__exportStar(__nccwpck_require__(87393), exports); +var BlobSASSignatureValues_js_1 = __nccwpck_require__(48921); +Object.defineProperty(exports, "generateBlobSASQueryParameters", ({ enumerable: true, get: function () { return BlobSASSignatureValues_js_1.generateBlobSASQueryParameters; } })); +tslib_1.__exportStar(__nccwpck_require__(86562), exports); +tslib_1.__exportStar(__nccwpck_require__(27579), exports); +tslib_1.__exportStar(__nccwpck_require__(42803), exports); +tslib_1.__exportStar(__nccwpck_require__(35778), exports); +tslib_1.__exportStar(__nccwpck_require__(59155), exports); +var models_js_1 = __nccwpck_require__(64526); +Object.defineProperty(exports, "BlockBlobTier", ({ enumerable: true, get: function () { return models_js_1.BlockBlobTier; } })); +Object.defineProperty(exports, "PremiumPageBlobTier", ({ enumerable: true, get: function () { return models_js_1.PremiumPageBlobTier; } })); +Object.defineProperty(exports, "StorageBlobAudience", ({ enumerable: true, get: function () { return models_js_1.StorageBlobAudience; } })); +Object.defineProperty(exports, "getBlobServiceAccountAudience", ({ enumerable: true, get: function () { return models_js_1.getBlobServiceAccountAudience; } })); +var Pipeline_js_1 = __nccwpck_require__(33781); +Object.defineProperty(exports, "Pipeline", ({ enumerable: true, get: function () { return Pipeline_js_1.Pipeline; } })); +Object.defineProperty(exports, "isPipelineLike", ({ enumerable: true, get: function () { return Pipeline_js_1.isPipelineLike; } })); +Object.defineProperty(exports, "newPipeline", ({ enumerable: true, get: function () { return Pipeline_js_1.newPipeline; } })); +Object.defineProperty(exports, "StorageOAuthScopes", ({ enumerable: true, get: function () { return Pipeline_js_1.StorageOAuthScopes; } })); +tslib_1.__exportStar(__nccwpck_require__(98637), exports); +var RequestPolicy_js_1 = __nccwpck_require__(33847); +Object.defineProperty(exports, "BaseRequestPolicy", ({ enumerable: true, get: function () { return RequestPolicy_js_1.BaseRequestPolicy; } })); +tslib_1.__exportStar(__nccwpck_require__(51870), exports); +tslib_1.__exportStar(__nccwpck_require__(15513), exports); +tslib_1.__exportStar(__nccwpck_require__(98637), exports); +tslib_1.__exportStar(__nccwpck_require__(66776), exports); +tslib_1.__exportStar(__nccwpck_require__(21969), exports); +tslib_1.__exportStar(__nccwpck_require__(39241), exports); +var log_js_1 = __nccwpck_require__(53282); +Object.defineProperty(exports, "logger", ({ enumerable: true, get: function () { return log_js_1.logger; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 583: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AVRO_SCHEMA_KEY = exports.AVRO_CODEC_KEY = exports.AVRO_INIT_BYTES = exports.AVRO_SYNC_MARKER_SIZE = void 0; +exports.AVRO_SYNC_MARKER_SIZE = 16; +exports.AVRO_INIT_BYTES = new Uint8Array([79, 98, 106, 1]); +exports.AVRO_CODEC_KEY = "avro.codec"; +exports.AVRO_SCHEMA_KEY = "avro.schema"; +//# sourceMappingURL=AvroConstants.js.map + +/***/ }), + +/***/ 58119: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AvroType = exports.AvroParser = void 0; +class AvroParser { + /** + * Reads a fixed number of bytes from the stream. + * + * @param stream - + * @param length - + * @param options - + */ + static async readFixedBytes(stream, length, options = {}) { + const bytes = await stream.read(length, { abortSignal: options.abortSignal }); + if (bytes.length !== length) { + throw new Error("Hit stream end."); + } + return bytes; + } + /** + * Reads a single byte from the stream. + * + * @param stream - + * @param options - + */ + static async readByte(stream, options = {}) { + const buf = await AvroParser.readFixedBytes(stream, 1, options); + return buf[0]; + } + // int and long are stored in variable-length zig-zag coding. + // variable-length: https://lucene.apache.org/core/3_5_0/fileformats.html#VInt + // zig-zag: https://developers.google.com/protocol-buffers/docs/encoding?csw=1#types + static async readZigZagLong(stream, options = {}) { + let zigZagEncoded = 0; + let significanceInBit = 0; + let byte, haveMoreByte, significanceInFloat; + do { + byte = await AvroParser.readByte(stream, options); + haveMoreByte = byte & 0x80; + zigZagEncoded |= (byte & 0x7f) << significanceInBit; + significanceInBit += 7; + } while (haveMoreByte && significanceInBit < 28); // bitwise operation only works for 32-bit integers + if (haveMoreByte) { + // Switch to float arithmetic + // eslint-disable-next-line no-self-assign + zigZagEncoded = zigZagEncoded; + significanceInFloat = 268435456; // 2 ** 28. + do { + byte = await AvroParser.readByte(stream, options); + zigZagEncoded += (byte & 0x7f) * significanceInFloat; + significanceInFloat *= 128; // 2 ** 7 + } while (byte & 0x80); + const res = (zigZagEncoded % 2 ? -(zigZagEncoded + 1) : zigZagEncoded) / 2; + if (res < Number.MIN_SAFE_INTEGER || res > Number.MAX_SAFE_INTEGER) { + throw new Error("Integer overflow."); + } + return res; + } + return (zigZagEncoded >> 1) ^ -(zigZagEncoded & 1); + } + static async readLong(stream, options = {}) { + return AvroParser.readZigZagLong(stream, options); + } + static async readInt(stream, options = {}) { + return AvroParser.readZigZagLong(stream, options); + } + static async readNull() { + return null; + } + static async readBoolean(stream, options = {}) { + const b = await AvroParser.readByte(stream, options); + if (b === 1) { + return true; + } + else if (b === 0) { + return false; + } + else { + throw new Error("Byte was not a boolean."); + } + } + static async readFloat(stream, options = {}) { + const u8arr = await AvroParser.readFixedBytes(stream, 4, options); + const view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); + return view.getFloat32(0, true); // littleEndian = true + } + static async readDouble(stream, options = {}) { + const u8arr = await AvroParser.readFixedBytes(stream, 8, options); + const view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); + return view.getFloat64(0, true); // littleEndian = true + } + static async readBytes(stream, options = {}) { + const size = await AvroParser.readLong(stream, options); + if (size < 0) { + throw new Error("Bytes size was negative."); + } + return stream.read(size, { abortSignal: options.abortSignal }); + } + static async readString(stream, options = {}) { + const u8arr = await AvroParser.readBytes(stream, options); + const utf8decoder = new TextDecoder(); + return utf8decoder.decode(u8arr); + } + static async readMapPair(stream, readItemMethod, options = {}) { + const key = await AvroParser.readString(stream, options); + // FUTURE: this won't work with readFixed (currently not supported) which needs a length as the parameter. + const value = await readItemMethod(stream, options); + return { key, value }; + } + static async readMap(stream, readItemMethod, options = {}) { + const readPairMethod = (s, opts = {}) => { + return AvroParser.readMapPair(s, readItemMethod, opts); + }; + const pairs = await AvroParser.readArray(stream, readPairMethod, options); + const dict = {}; + for (const pair of pairs) { + dict[pair.key] = pair.value; + } + return dict; + } + static async readArray(stream, readItemMethod, options = {}) { + const items = []; + for (let count = await AvroParser.readLong(stream, options); count !== 0; count = await AvroParser.readLong(stream, options)) { + if (count < 0) { + // Ignore block sizes + await AvroParser.readLong(stream, options); + count = -count; + } + while (count--) { + const item = await readItemMethod(stream, options); + items.push(item); + } + } + return items; + } +} +exports.AvroParser = AvroParser; +var AvroComplex; +(function (AvroComplex) { + AvroComplex["RECORD"] = "record"; + AvroComplex["ENUM"] = "enum"; + AvroComplex["ARRAY"] = "array"; + AvroComplex["MAP"] = "map"; + AvroComplex["UNION"] = "union"; + AvroComplex["FIXED"] = "fixed"; +})(AvroComplex || (AvroComplex = {})); +var AvroPrimitive; +(function (AvroPrimitive) { + AvroPrimitive["NULL"] = "null"; + AvroPrimitive["BOOLEAN"] = "boolean"; + AvroPrimitive["INT"] = "int"; + AvroPrimitive["LONG"] = "long"; + AvroPrimitive["FLOAT"] = "float"; + AvroPrimitive["DOUBLE"] = "double"; + AvroPrimitive["BYTES"] = "bytes"; + AvroPrimitive["STRING"] = "string"; +})(AvroPrimitive || (AvroPrimitive = {})); +class AvroType { + /** + * Determines the AvroType from the Avro Schema. + */ + // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types + static fromSchema(schema) { + if (typeof schema === "string") { + return AvroType.fromStringSchema(schema); + } + else if (Array.isArray(schema)) { + return AvroType.fromArraySchema(schema); + } + else { + return AvroType.fromObjectSchema(schema); + } + } + static fromStringSchema(schema) { + switch (schema) { + case AvroPrimitive.NULL: + case AvroPrimitive.BOOLEAN: + case AvroPrimitive.INT: + case AvroPrimitive.LONG: + case AvroPrimitive.FLOAT: + case AvroPrimitive.DOUBLE: + case AvroPrimitive.BYTES: + case AvroPrimitive.STRING: + return new AvroPrimitiveType(schema); + default: + throw new Error(`Unexpected Avro type ${schema}`); + } + } + static fromArraySchema(schema) { + return new AvroUnionType(schema.map(AvroType.fromSchema)); + } + static fromObjectSchema(schema) { + const type = schema.type; + // Primitives can be defined as strings or objects + try { + return AvroType.fromStringSchema(type); + } + catch { + // no-op + } + switch (type) { + case AvroComplex.RECORD: + if (schema.aliases) { + throw new Error(`aliases currently is not supported, schema: ${schema}`); + } + if (!schema.name) { + throw new Error(`Required attribute 'name' doesn't exist on schema: ${schema}`); + } + // eslint-disable-next-line no-case-declarations + const fields = {}; + if (!schema.fields) { + throw new Error(`Required attribute 'fields' doesn't exist on schema: ${schema}`); + } + for (const field of schema.fields) { + fields[field.name] = AvroType.fromSchema(field.type); + } + return new AvroRecordType(fields, schema.name); + case AvroComplex.ENUM: + if (schema.aliases) { + throw new Error(`aliases currently is not supported, schema: ${schema}`); + } + if (!schema.symbols) { + throw new Error(`Required attribute 'symbols' doesn't exist on schema: ${schema}`); + } + return new AvroEnumType(schema.symbols); + case AvroComplex.MAP: + if (!schema.values) { + throw new Error(`Required attribute 'values' doesn't exist on schema: ${schema}`); + } + return new AvroMapType(AvroType.fromSchema(schema.values)); + case AvroComplex.ARRAY: // Unused today + case AvroComplex.FIXED: // Unused today + default: + throw new Error(`Unexpected Avro type ${type} in ${schema}`); + } + } +} +exports.AvroType = AvroType; +class AvroPrimitiveType extends AvroType { + _primitive; + constructor(primitive) { + super(); + this._primitive = primitive; + } + // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types + read(stream, options = {}) { + switch (this._primitive) { + case AvroPrimitive.NULL: + return AvroParser.readNull(); + case AvroPrimitive.BOOLEAN: + return AvroParser.readBoolean(stream, options); + case AvroPrimitive.INT: + return AvroParser.readInt(stream, options); + case AvroPrimitive.LONG: + return AvroParser.readLong(stream, options); + case AvroPrimitive.FLOAT: + return AvroParser.readFloat(stream, options); + case AvroPrimitive.DOUBLE: + return AvroParser.readDouble(stream, options); + case AvroPrimitive.BYTES: + return AvroParser.readBytes(stream, options); + case AvroPrimitive.STRING: + return AvroParser.readString(stream, options); + default: + throw new Error("Unknown Avro Primitive"); + } + } +} +class AvroEnumType extends AvroType { + _symbols; + constructor(symbols) { + super(); + this._symbols = symbols; + } + // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types + async read(stream, options = {}) { + const value = await AvroParser.readInt(stream, options); + return this._symbols[value]; + } +} +class AvroUnionType extends AvroType { + _types; + constructor(types) { + super(); + this._types = types; + } + async read(stream, options = {}) { + const typeIndex = await AvroParser.readInt(stream, options); + return this._types[typeIndex].read(stream, options); + } +} +class AvroMapType extends AvroType { + _itemType; + constructor(itemType) { + super(); + this._itemType = itemType; + } + // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types + read(stream, options = {}) { + const readItemMethod = (s, opts) => { + return this._itemType.read(s, opts); + }; + return AvroParser.readMap(stream, readItemMethod, options); + } +} +class AvroRecordType extends AvroType { + _name; + _fields; + constructor(fields, name) { + super(); + this._fields = fields; + this._name = name; + } + // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types + async read(stream, options = {}) { + // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types + const record = {}; + record["$schema"] = this._name; + for (const key in this._fields) { + if (Object.prototype.hasOwnProperty.call(this._fields, key)) { + record[key] = await this._fields[key].read(stream, options); + } + } + return record; + } +} +//# sourceMappingURL=AvroParser.js.map + +/***/ }), + +/***/ 15192: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AvroReadable = void 0; +class AvroReadable { +} +exports.AvroReadable = AvroReadable; +//# sourceMappingURL=AvroReadable.js.map + +/***/ }), + +/***/ 53027: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AvroReadableFromStream = void 0; +const AvroReadable_js_1 = __nccwpck_require__(15192); +const abort_controller_1 = __nccwpck_require__(1753); +const buffer_1 = __nccwpck_require__(14300); +const ABORT_ERROR = new abort_controller_1.AbortError("Reading from the avro stream was aborted."); +class AvroReadableFromStream extends AvroReadable_js_1.AvroReadable { + _position; + _readable; + toUint8Array(data) { + if (typeof data === "string") { + return buffer_1.Buffer.from(data); + } + return data; + } + constructor(readable) { + super(); + this._readable = readable; + this._position = 0; + } + get position() { + return this._position; + } + async read(size, options = {}) { + if (options.abortSignal?.aborted) { + throw ABORT_ERROR; + } + if (size < 0) { + throw new Error(`size parameter should be positive: ${size}`); + } + if (size === 0) { + return new Uint8Array(); + } + if (!this._readable.readable) { + throw new Error("Stream no longer readable."); + } + // See if there is already enough data. + const chunk = this._readable.read(size); + if (chunk) { + this._position += chunk.length; + // chunk.length maybe less than desired size if the stream ends. + return this.toUint8Array(chunk); + } + else { + // register callback to wait for enough data to read + return new Promise((resolve, reject) => { + /* eslint-disable @typescript-eslint/no-use-before-define */ + const cleanUp = () => { + this._readable.removeListener("readable", readableCallback); + this._readable.removeListener("error", rejectCallback); + this._readable.removeListener("end", rejectCallback); + this._readable.removeListener("close", rejectCallback); + if (options.abortSignal) { + options.abortSignal.removeEventListener("abort", abortHandler); + } + }; + const readableCallback = () => { + const callbackChunk = this._readable.read(size); + if (callbackChunk) { + this._position += callbackChunk.length; + cleanUp(); + // callbackChunk.length maybe less than desired size if the stream ends. + resolve(this.toUint8Array(callbackChunk)); + } + }; + const rejectCallback = () => { + cleanUp(); + reject(); + }; + const abortHandler = () => { + cleanUp(); + reject(ABORT_ERROR); + }; + this._readable.on("readable", readableCallback); + this._readable.once("error", rejectCallback); + this._readable.once("end", rejectCallback); + this._readable.once("close", rejectCallback); + if (options.abortSignal) { + options.abortSignal.addEventListener("abort", abortHandler); + } + /* eslint-enable @typescript-eslint/no-use-before-define */ + }); + } + } +} +exports.AvroReadableFromStream = AvroReadableFromStream; +//# sourceMappingURL=AvroReadableFromStream.js.map + +/***/ }), + +/***/ 64331: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AvroReader = void 0; +// TODO: Do a review of non-interfaces +/* eslint-disable @azure/azure-sdk/ts-use-interface-parameters */ +const AvroConstants_js_1 = __nccwpck_require__(583); +const AvroParser_js_1 = __nccwpck_require__(58119); +const utils_common_js_1 = __nccwpck_require__(32617); +class AvroReader { + _dataStream; + _headerStream; + _syncMarker; + _metadata; + _itemType; + _itemsRemainingInBlock; + // Remembers where we started if partial data stream was provided. + _initialBlockOffset; + /// The byte offset within the Avro file (both header and data) + /// of the start of the current block. + _blockOffset; + get blockOffset() { + return this._blockOffset; + } + _objectIndex; + get objectIndex() { + return this._objectIndex; + } + _initialized; + constructor(dataStream, headerStream, currentBlockOffset, indexWithinCurrentBlock) { + this._dataStream = dataStream; + this._headerStream = headerStream || dataStream; + this._initialized = false; + this._blockOffset = currentBlockOffset || 0; + this._objectIndex = indexWithinCurrentBlock || 0; + this._initialBlockOffset = currentBlockOffset || 0; + } + async initialize(options = {}) { + const header = await AvroParser_js_1.AvroParser.readFixedBytes(this._headerStream, AvroConstants_js_1.AVRO_INIT_BYTES.length, { + abortSignal: options.abortSignal, + }); + if (!(0, utils_common_js_1.arraysEqual)(header, AvroConstants_js_1.AVRO_INIT_BYTES)) { + throw new Error("Stream is not an Avro file."); + } + // File metadata is written as if defined by the following map schema: + // { "type": "map", "values": "bytes"} + this._metadata = await AvroParser_js_1.AvroParser.readMap(this._headerStream, AvroParser_js_1.AvroParser.readString, { + abortSignal: options.abortSignal, + }); + // Validate codec + const codec = this._metadata[AvroConstants_js_1.AVRO_CODEC_KEY]; + if (!(codec === undefined || codec === null || codec === "null")) { + throw new Error("Codecs are not supported"); + } + // The 16-byte, randomly-generated sync marker for this file. + this._syncMarker = await AvroParser_js_1.AvroParser.readFixedBytes(this._headerStream, AvroConstants_js_1.AVRO_SYNC_MARKER_SIZE, { + abortSignal: options.abortSignal, + }); + // Parse the schema + const schema = JSON.parse(this._metadata[AvroConstants_js_1.AVRO_SCHEMA_KEY]); + this._itemType = AvroParser_js_1.AvroType.fromSchema(schema); + if (this._blockOffset === 0) { + this._blockOffset = this._initialBlockOffset + this._dataStream.position; + } + this._itemsRemainingInBlock = await AvroParser_js_1.AvroParser.readLong(this._dataStream, { + abortSignal: options.abortSignal, + }); + // skip block length + await AvroParser_js_1.AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal }); + this._initialized = true; + if (this._objectIndex && this._objectIndex > 0) { + for (let i = 0; i < this._objectIndex; i++) { + await this._itemType.read(this._dataStream, { abortSignal: options.abortSignal }); + this._itemsRemainingInBlock--; + } + } + } + hasNext() { + return !this._initialized || this._itemsRemainingInBlock > 0; + } + async *parseObjects(options = {}) { + if (!this._initialized) { + await this.initialize(options); + } + while (this.hasNext()) { + const result = await this._itemType.read(this._dataStream, { + abortSignal: options.abortSignal, + }); + this._itemsRemainingInBlock--; + this._objectIndex++; + if (this._itemsRemainingInBlock === 0) { + const marker = await AvroParser_js_1.AvroParser.readFixedBytes(this._dataStream, AvroConstants_js_1.AVRO_SYNC_MARKER_SIZE, { + abortSignal: options.abortSignal, + }); + this._blockOffset = this._initialBlockOffset + this._dataStream.position; + this._objectIndex = 0; + if (!(0, utils_common_js_1.arraysEqual)(this._syncMarker, marker)) { + throw new Error("Stream is not a valid Avro file."); + } + try { + this._itemsRemainingInBlock = await AvroParser_js_1.AvroParser.readLong(this._dataStream, { + abortSignal: options.abortSignal, + }); + } + catch { + // We hit the end of the stream. + this._itemsRemainingInBlock = 0; + } + if (this._itemsRemainingInBlock > 0) { + // Ignore block size + await AvroParser_js_1.AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal }); + } + } + yield result; + } + } +} +exports.AvroReader = AvroReader; +//# sourceMappingURL=AvroReader.js.map + +/***/ }), + +/***/ 94382: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(1746), exports); -tslib_1.__exportStar(__nccwpck_require__(3269), exports); -tslib_1.__exportStar(__nccwpck_require__(8296), exports); -tslib_1.__exportStar(__nccwpck_require__(69477), exports); -tslib_1.__exportStar(__nccwpck_require__(80313), exports); -tslib_1.__exportStar(__nccwpck_require__(48652), exports); +exports.AvroReadableFromStream = exports.AvroReadable = exports.AvroReader = void 0; +var AvroReader_js_1 = __nccwpck_require__(64331); +Object.defineProperty(exports, "AvroReader", ({ enumerable: true, get: function () { return AvroReader_js_1.AvroReader; } })); +var AvroReadable_js_1 = __nccwpck_require__(15192); +Object.defineProperty(exports, "AvroReadable", ({ enumerable: true, get: function () { return AvroReadable_js_1.AvroReadable; } })); +var AvroReadableFromStream_js_1 = __nccwpck_require__(53027); +Object.defineProperty(exports, "AvroReadableFromStream", ({ enumerable: true, get: function () { return AvroReadableFromStream_js_1.AvroReadableFromStream; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 69477: +/***/ 32617: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.arraysEqual = arraysEqual; +function arraysEqual(a, b) { + if (a === b) + return true; + if (a == null || b == null) + return false; + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; +} +//# sourceMappingURL=utils.common.js.map + +/***/ }), + +/***/ 53282: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.logger = void 0; +const logger_1 = __nccwpck_require__(89497); +/** + * The `@azure/logger` configuration for this package. + */ +exports.logger = (0, logger_1.createClientLogger)("storage-blob"); +//# sourceMappingURL=log.js.map + +/***/ }), + +/***/ 64526: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageBlobAudience = exports.PremiumPageBlobTier = exports.BlockBlobTier = void 0; +exports.toAccessTier = toAccessTier; +exports.ensureCpkIfSpecified = ensureCpkIfSpecified; +exports.getBlobServiceAccountAudience = getBlobServiceAccountAudience; +const constants_js_1 = __nccwpck_require__(81865); +/** + * Represents the access tier on a blob. + * For detailed information about block blob level tiering see {@link https://learn.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers|Hot, cool and archive storage tiers.} + */ +var BlockBlobTier; +(function (BlockBlobTier) { + /** + * Optimized for storing data that is accessed frequently. + */ + BlockBlobTier["Hot"] = "Hot"; + /** + * Optimized for storing data that is infrequently accessed and stored for at least 30 days. + */ + BlockBlobTier["Cool"] = "Cool"; + /** + * Optimized for storing data that is rarely accessed. + */ + BlockBlobTier["Cold"] = "Cold"; + /** + * Optimized for storing data that is rarely accessed and stored for at least 180 days + * with flexible latency requirements (on the order of hours). + */ + BlockBlobTier["Archive"] = "Archive"; +})(BlockBlobTier || (exports.BlockBlobTier = BlockBlobTier = {})); +/** + * Specifies the page blob tier to set the blob to. This is only applicable to page blobs on premium storage accounts. + * Please see {@link https://learn.microsoft.com/azure/storage/storage-premium-storage#scalability-and-performance-targets|here} + * for detailed information on the corresponding IOPS and throughput per PageBlobTier. + */ +var PremiumPageBlobTier; +(function (PremiumPageBlobTier) { + /** + * P4 Tier. + */ + PremiumPageBlobTier["P4"] = "P4"; + /** + * P6 Tier. + */ + PremiumPageBlobTier["P6"] = "P6"; + /** + * P10 Tier. + */ + PremiumPageBlobTier["P10"] = "P10"; + /** + * P15 Tier. + */ + PremiumPageBlobTier["P15"] = "P15"; + /** + * P20 Tier. + */ + PremiumPageBlobTier["P20"] = "P20"; + /** + * P30 Tier. + */ + PremiumPageBlobTier["P30"] = "P30"; + /** + * P40 Tier. + */ + PremiumPageBlobTier["P40"] = "P40"; + /** + * P50 Tier. + */ + PremiumPageBlobTier["P50"] = "P50"; + /** + * P60 Tier. + */ + PremiumPageBlobTier["P60"] = "P60"; + /** + * P70 Tier. + */ + PremiumPageBlobTier["P70"] = "P70"; + /** + * P80 Tier. + */ + PremiumPageBlobTier["P80"] = "P80"; +})(PremiumPageBlobTier || (exports.PremiumPageBlobTier = PremiumPageBlobTier = {})); +function toAccessTier(tier) { + if (tier === undefined) { + return undefined; + } + return tier; // No more check if string is a valid AccessTier, and left this to underlay logic to decide(service). +} +function ensureCpkIfSpecified(cpk, isHttps) { + if (cpk && !isHttps) { + throw new RangeError("Customer-provided encryption key must be used over HTTPS."); + } + if (cpk && !cpk.encryptionAlgorithm) { + cpk.encryptionAlgorithm = constants_js_1.EncryptionAlgorithmAES25; + } +} +/** + * Defines the known cloud audiences for Storage. + */ +var StorageBlobAudience; +(function (StorageBlobAudience) { + /** + * The OAuth scope to use to retrieve an AAD token for Azure Storage. + */ + StorageBlobAudience["StorageOAuthScopes"] = "https://storage.azure.com/.default"; + /** + * The OAuth scope to use to retrieve an AAD token for Azure Disk. + */ + StorageBlobAudience["DiskComputeOAuthScopes"] = "https://disk.compute.azure.com/.default"; +})(StorageBlobAudience || (exports.StorageBlobAudience = StorageBlobAudience = {})); +/** * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. + * To get OAuth audience for a storage account for blob service. */ +function getBlobServiceAccountAudience(storageAccountName) { + return `https://${storageAccountName}.blob.core.windows.net/.default`; +} +//# sourceMappingURL=models.js.map + +/***/ }), + +/***/ 51870: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PageBlobImpl = void 0; -const tslib_1 = __nccwpck_require__(4351); -const coreClient = tslib_1.__importStar(__nccwpck_require__(7611)); -const Mappers = tslib_1.__importStar(__nccwpck_require__(52486)); -const Parameters = tslib_1.__importStar(__nccwpck_require__(54142)); -/** Class containing PageBlob operations. */ -class PageBlobImpl { - client; +exports.AnonymousCredentialPolicy = void 0; +const CredentialPolicy_js_1 = __nccwpck_require__(15513); +/** + * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources + * or for use with Shared Access Signatures (SAS). + */ +class AnonymousCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { /** - * Initialize a new instance of the class PageBlob class. - * @param client Reference to the service client + * Creates an instance of AnonymousCredentialPolicy. + * @param nextPolicy - + * @param options - */ - constructor(client) { - this.client = client; + // The base class has a protected constructor. Adding a public one to enable constructing of this class. + /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ + constructor(nextPolicy, options) { + super(nextPolicy, options); } +} +exports.AnonymousCredentialPolicy = AnonymousCredentialPolicy; +//# sourceMappingURL=AnonymousCredentialPolicy.js.map + +/***/ }), + +/***/ 15513: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CredentialPolicy = void 0; +const RequestPolicy_js_1 = __nccwpck_require__(33847); +/** + * Credential policy used to sign HTTP(S) requests before sending. This is an + * abstract class. + */ +class CredentialPolicy extends RequestPolicy_js_1.BaseRequestPolicy { /** - * The Create operation creates a new page blob. - * @param contentLength The length of the request. - * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The - * page blob size must be aligned to a 512-byte boundary. - * @param options The options parameters. + * Sends out request. + * + * @param request - */ - create(contentLength, blobContentLength, options) { - return this.client.sendOperationRequest({ contentLength, blobContentLength, options }, createOperationSpec); + sendRequest(request) { + return this._nextPolicy.sendRequest(this.signRequest(request)); } /** - * The Upload Pages operation writes a range of pages to a page blob - * @param contentLength The length of the request. - * @param body Initial data - * @param options The options parameters. + * Child classes must implement this method with request signing. This method + * will be executed in {@link sendRequest}. + * + * @param request - */ - uploadPages(contentLength, body, options) { - return this.client.sendOperationRequest({ contentLength, body, options }, uploadPagesOperationSpec); + signRequest(request) { + // Child classes must override this method with request signing. This method + // will be executed in sendRequest(). + return request; } +} +exports.CredentialPolicy = CredentialPolicy; +//# sourceMappingURL=CredentialPolicy.js.map + +/***/ }), + +/***/ 33847: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaseRequestPolicy = void 0; +/** + * The base class from which all request policies derive. + */ +class BaseRequestPolicy { + _nextPolicy; + _options; /** - * The Clear Pages operation clears a set of pages from a page blob - * @param contentLength The length of the request. - * @param options The options parameters. + * The main method to implement that manipulates a request/response. */ - clearPages(contentLength, options) { - return this.client.sendOperationRequest({ contentLength, options }, clearPagesOperationSpec); + constructor( + /** + * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline. + */ + _nextPolicy, + /** + * The options that can be passed to a given request policy. + */ + _options) { + this._nextPolicy = _nextPolicy; + this._options = _options; } /** - * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a - * URL - * @param sourceUrl Specify a URL to the copy source. - * @param sourceRange Bytes of source data in the specified range. The length of this range should - * match the ContentLength header and x-ms-range/Range destination range header. - * @param contentLength The length of the request. - * @param range The range of bytes to which the source range would be written. The range should be 512 - * aligned and range-end is required. - * @param options The options parameters. + * Get whether or not a log with the provided log level should be logged. + * @param logLevel - The log level of the log that will be logged. + * @returns Whether or not a log with the provided log level should be logged. */ - uploadPagesFromURL(sourceUrl, sourceRange, contentLength, range, options) { - return this.client.sendOperationRequest({ sourceUrl, sourceRange, contentLength, range, options }, uploadPagesFromURLOperationSpec); + shouldLog(logLevel) { + return this._options.shouldLog(logLevel); + } + /** + * Attempt to log the provided message to the provided logger. If no logger was provided or if + * the log level does not meat the logger's threshold, then nothing will be logged. + * @param logLevel - The log level of this log. + * @param message - The message of this log. + */ + log(logLevel, message) { + this._options.log(logLevel, message); + } +} +exports.BaseRequestPolicy = BaseRequestPolicy; +//# sourceMappingURL=RequestPolicy.js.map + +/***/ }), + +/***/ 6602: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageBrowserPolicy = void 0; +const RequestPolicy_js_1 = __nccwpck_require__(33847); +const core_util_1 = __nccwpck_require__(80637); +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +/** + * StorageBrowserPolicy will handle differences between Node.js and browser runtime, including: + * + * 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'. + * StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL + * thus avoid the browser cache. + * + * 2. Remove cookie header for security + * + * 3. Remove content-length header to avoid browsers warning + */ +class StorageBrowserPolicy extends RequestPolicy_js_1.BaseRequestPolicy { + /** + * Creates an instance of StorageBrowserPolicy. + * @param nextPolicy - + * @param options - + */ + // The base class has a protected constructor. Adding a public one to enable constructing of this class. + /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ + constructor(nextPolicy, options) { + super(nextPolicy, options); + } + /** + * Sends out request. + * + * @param request - + */ + async sendRequest(request) { + if (core_util_1.isNodeLike) { + return this._nextPolicy.sendRequest(request); + } + if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") { + request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); + } + request.headers.remove(constants_js_1.HeaderConstants.COOKIE); + // According to XHR standards, content-length should be fully controlled by browsers + request.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return this._nextPolicy.sendRequest(request); + } +} +exports.StorageBrowserPolicy = StorageBrowserPolicy; +//# sourceMappingURL=StorageBrowserPolicy.js.map + +/***/ }), + +/***/ 29090: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.storageBrowserPolicyName = void 0; +exports.storageBrowserPolicy = storageBrowserPolicy; +const core_util_1 = __nccwpck_require__(80637); +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +/** + * The programmatic identifier of the StorageBrowserPolicy. + */ +exports.storageBrowserPolicyName = "storageBrowserPolicy"; +/** + * storageBrowserPolicy is a policy used to prevent browsers from caching requests + * and to remove cookies and explicit content-length headers. + */ +function storageBrowserPolicy() { + return { + name: exports.storageBrowserPolicyName, + async sendRequest(request, next) { + if (core_util_1.isNodeLike) { + return next(request); + } + if (request.method === "GET" || request.method === "HEAD") { + request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); + } + request.headers.delete(constants_js_1.HeaderConstants.COOKIE); + // According to XHR standards, content-length should be fully controlled by browsers + request.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return next(request); + }, + }; +} +//# sourceMappingURL=StorageBrowserPolicyV2.js.map + +/***/ }), + +/***/ 73623: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.storageCorrectContentLengthPolicyName = void 0; +exports.storageCorrectContentLengthPolicy = storageCorrectContentLengthPolicy; +const constants_js_1 = __nccwpck_require__(81865); +/** + * The programmatic identifier of the storageCorrectContentLengthPolicy. + */ +exports.storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy"; +/** + * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length. + */ +function storageCorrectContentLengthPolicy() { + function correctContentLength(request) { + if (request.body && + (typeof request.body === "string" || Buffer.isBuffer(request.body)) && + request.body.length > 0) { + request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + } } + return { + name: exports.storageCorrectContentLengthPolicyName, + async sendRequest(request, next) { + correctContentLength(request); + return next(request); + }, + }; +} +//# sourceMappingURL=StorageCorrectContentLengthPolicy.js.map + +/***/ }), + +/***/ 34419: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageRetryPolicy = void 0; +exports.NewRetryPolicyFactory = NewRetryPolicyFactory; +const abort_controller_1 = __nccwpck_require__(1753); +const RequestPolicy_js_1 = __nccwpck_require__(33847); +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +const log_js_1 = __nccwpck_require__(53282); +const StorageRetryPolicyType_js_1 = __nccwpck_require__(51772); +/** + * A factory method used to generated a RetryPolicy factory. + * + * @param retryOptions - + */ +function NewRetryPolicyFactory(retryOptions) { + return { + create: (nextPolicy, options) => { + return new StorageRetryPolicy(nextPolicy, options, retryOptions); + }, + }; +} +// Default values of StorageRetryOptions +const DEFAULT_RETRY_OPTIONS = { + maxRetryDelayInMs: 120 * 1000, + maxTries: 4, + retryDelayInMs: 4 * 1000, + retryPolicyType: StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL, + secondaryHost: "", + tryTimeoutInMs: undefined, // Use server side default timeout strategy +}; +const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); +/** + * Retry policy with exponential retry and linear retry implemented. + */ +class StorageRetryPolicy extends RequestPolicy_js_1.BaseRequestPolicy { /** - * The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a - * page blob - * @param options The options parameters. + * RetryOptions. */ - getPageRanges(options) { - return this.client.sendOperationRequest({ options }, getPageRangesOperationSpec); - } + retryOptions; /** - * The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were - * changed between target blob and previous snapshot. - * @param options The options parameters. + * Creates an instance of RetryPolicy. + * + * @param nextPolicy - + * @param options - + * @param retryOptions - */ - getPageRangesDiff(options) { - return this.client.sendOperationRequest({ options }, getPageRangesDiffOperationSpec); + constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) { + super(nextPolicy, options); + // Initialize retry options + this.retryOptions = { + retryPolicyType: retryOptions.retryPolicyType + ? retryOptions.retryPolicyType + : DEFAULT_RETRY_OPTIONS.retryPolicyType, + maxTries: retryOptions.maxTries && retryOptions.maxTries >= 1 + ? Math.floor(retryOptions.maxTries) + : DEFAULT_RETRY_OPTIONS.maxTries, + tryTimeoutInMs: retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0 + ? retryOptions.tryTimeoutInMs + : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs, + retryDelayInMs: retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0 + ? Math.min(retryOptions.retryDelayInMs, retryOptions.maxRetryDelayInMs + ? retryOptions.maxRetryDelayInMs + : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs) + : DEFAULT_RETRY_OPTIONS.retryDelayInMs, + maxRetryDelayInMs: retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0 + ? retryOptions.maxRetryDelayInMs + : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs, + secondaryHost: retryOptions.secondaryHost + ? retryOptions.secondaryHost + : DEFAULT_RETRY_OPTIONS.secondaryHost, + }; } /** - * Resize the Blob - * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The - * page blob size must be aligned to a 512-byte boundary. - * @param options The options parameters. + * Sends request. + * + * @param request - */ - resize(blobContentLength, options) { - return this.client.sendOperationRequest({ blobContentLength, options }, resizeOperationSpec); + async sendRequest(request) { + return this.attemptSendRequest(request, false, 1); } /** - * Update the sequence number of the blob - * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. - * This property applies to page blobs only. This property indicates how the service should modify the - * blob's sequence number - * @param options The options parameters. + * Decide and perform next retry. Won't mutate request parameter. + * + * @param request - + * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then + * the resource was not found. This may be due to replication delay. So, in this + * case, we'll never try the secondary again for this operation. + * @param attempt - How many retries has been attempted to performed, starting from 1, which includes + * the attempt will be performed by this method call. */ - updateSequenceNumber(sequenceNumberAction, options) { - return this.client.sendOperationRequest({ sequenceNumberAction, options }, updateSequenceNumberOperationSpec); + async attemptSendRequest(request, secondaryHas404, attempt) { + const newRequest = request.clone(); + const isPrimaryRetry = secondaryHas404 || + !this.retryOptions.secondaryHost || + !(request.method === "GET" || request.method === "HEAD" || request.method === "OPTIONS") || + attempt % 2 === 1; + if (!isPrimaryRetry) { + newRequest.url = (0, utils_common_js_1.setURLHost)(newRequest.url, this.retryOptions.secondaryHost); + } + // Set the server-side timeout query parameter "timeout=[seconds]" + if (this.retryOptions.tryTimeoutInMs) { + newRequest.url = (0, utils_common_js_1.setURLParameter)(newRequest.url, constants_js_1.URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString()); + } + let response; + try { + log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); + response = await this._nextPolicy.sendRequest(newRequest); + if (!this.shouldRetry(isPrimaryRetry, attempt, response)) { + return response; + } + secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); + } + catch (err) { + log_js_1.logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`); + if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) { + throw err; + } + } + await this.delay(isPrimaryRetry, attempt, request.abortSignal); + return this.attemptSendRequest(request, secondaryHas404, ++attempt); } /** - * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. - * The snapshot is copied such that only the differential changes between the previously copied - * snapshot are transferred to the destination. The copied snapshots are complete copies of the - * original snapshot and can be read or copied from as usual. This API is supported since REST version - * 2016-05-31. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to - * 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would - * appear in a request URI. The source blob must either be public or must be authenticated via a shared - * access signature. - * @param options The options parameters. - */ - copyIncremental(copySource, options) { - return this.client.sendOperationRequest({ copySource, options }, copyIncrementalOperationSpec); - } -} -exports.PageBlobImpl = PageBlobImpl; -// Operation Specifications -const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true); -const createOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", - responses: { - 201: { - headersMapper: Mappers.PageBlobCreateHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobCreateExceptionHeaders, - }, - }, - queryParameters: [Parameters.timeoutInSeconds], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.contentLength, - Parameters.metadata, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.blobCacheControl, - Parameters.blobContentType, - Parameters.blobContentMD5, - Parameters.blobContentEncoding, - Parameters.blobContentLanguage, - Parameters.blobContentDisposition, - Parameters.immutabilityPolicyExpiry, - Parameters.immutabilityPolicyMode, - Parameters.encryptionScope, - Parameters.tier, - Parameters.blobTagsString, - Parameters.legalHold1, - Parameters.blobType, - Parameters.blobContentLength, - Parameters.blobSequenceNumber, - ], - isXML: true, - serializer: xmlSerializer, -}; -const uploadPagesOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", - responses: { - 201: { - headersMapper: Mappers.PageBlobUploadPagesHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobUploadPagesExceptionHeaders, - }, - }, - requestBody: Parameters.body1, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp19], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.contentLength, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.range, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.encryptionScope, - Parameters.transactionalContentMD5, - Parameters.transactionalContentCrc64, - Parameters.contentType1, - Parameters.accept2, - Parameters.pageWrite, - Parameters.ifSequenceNumberLessThanOrEqualTo, - Parameters.ifSequenceNumberLessThan, - Parameters.ifSequenceNumberEqualTo, - ], - isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "binary", - serializer: xmlSerializer, -}; -const clearPagesOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", - responses: { - 201: { - headersMapper: Mappers.PageBlobClearPagesHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobClearPagesExceptionHeaders, - }, - }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp19], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.contentLength, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.range, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.encryptionScope, - Parameters.ifSequenceNumberLessThanOrEqualTo, - Parameters.ifSequenceNumberLessThan, - Parameters.ifSequenceNumberEqualTo, - Parameters.pageWrite1, - ], - isXML: true, - serializer: xmlSerializer, -}; -const uploadPagesFromURLOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", - responses: { - 201: { - headersMapper: Mappers.PageBlobUploadPagesFromURLHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobUploadPagesFromURLExceptionHeaders, - }, - }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp19], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.contentLength, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.encryptionScope, - Parameters.sourceIfModifiedSince, - Parameters.sourceIfUnmodifiedSince, - Parameters.sourceIfMatch, - Parameters.sourceIfNoneMatch, - Parameters.sourceContentMD5, - Parameters.copySourceAuthorization, - Parameters.fileRequestIntent, - Parameters.pageWrite, - Parameters.ifSequenceNumberLessThanOrEqualTo, - Parameters.ifSequenceNumberLessThan, - Parameters.ifSequenceNumberEqualTo, - Parameters.sourceUrl, - Parameters.sourceRange, - Parameters.sourceContentCrc64, - Parameters.range1, - ], - isXML: true, - serializer: xmlSerializer, -}; -const getPageRangesOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PageList, - headersMapper: Mappers.PageBlobGetPageRangesHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobGetPageRangesExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.marker, - Parameters.maxPageSize, - Parameters.snapshot, - Parameters.comp20, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.range, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - ], - isXML: true, - serializer: xmlSerializer, -}; -const getPageRangesDiffOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PageList, - headersMapper: Mappers.PageBlobGetPageRangesDiffHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobGetPageRangesDiffExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.marker, - Parameters.maxPageSize, - Parameters.snapshot, - Parameters.comp20, - Parameters.prevsnapshot, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.range, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.prevSnapshotUrl, - ], - isXML: true, - serializer: xmlSerializer, -}; -const resizeOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", - responses: { - 200: { - headersMapper: Mappers.PageBlobResizeHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobResizeExceptionHeaders, - }, - }, - queryParameters: [Parameters.comp, Parameters.timeoutInSeconds], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.encryptionKey, - Parameters.encryptionKeySha256, - Parameters.encryptionAlgorithm, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.encryptionScope, - Parameters.blobContentLength, - ], - isXML: true, - serializer: xmlSerializer, -}; -const updateSequenceNumberOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", - responses: { - 200: { - headersMapper: Mappers.PageBlobUpdateSequenceNumberHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobUpdateSequenceNumberExceptionHeaders, - }, - }, - queryParameters: [Parameters.comp, Parameters.timeoutInSeconds], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.leaseId, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.blobSequenceNumber, - Parameters.sequenceNumberAction, - ], - isXML: true, - serializer: xmlSerializer, + * Decide whether to retry according to last HTTP response and retry counters. + * + * @param isPrimaryRetry - + * @param attempt - + * @param response - + * @param err - + */ + shouldRetry(isPrimaryRetry, attempt, response, err) { + if (attempt >= this.retryOptions.maxTries) { + log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions + .maxTries}, no further try.`); + return false; + } + // Handle network failures, you may need to customize the list when you implement + // your own http client + const retriableErrors = [ + "ETIMEDOUT", + "ESOCKETTIMEDOUT", + "ECONNREFUSED", + "ECONNRESET", + "ENOENT", + "ENOTFOUND", + "TIMEOUT", + "EPIPE", + "REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js + ]; + if (err) { + for (const retriableError of retriableErrors) { + if (err.name.toUpperCase().includes(retriableError) || + err.message.toUpperCase().includes(retriableError) || + (err.code && err.code.toString().toUpperCase() === retriableError)) { + log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); + return true; + } + } + } + // If attempt was against the secondary & it returned a StatusNotFound (404), then + // the resource was not found. This may be due to replication delay. So, in this + // case, we'll never try the secondary again for this operation. + if (response || err) { + const statusCode = response ? response.status : err ? err.statusCode : 0; + if (!isPrimaryRetry && statusCode === 404) { + log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); + return true; + } + // Server internal error or server timeout + if (statusCode === 503 || statusCode === 500) { + log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); + return true; + } + } + if (response) { + // Retry select Copy Source Error Codes. + if (response?.status >= 400) { + const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); + if (copySourceError !== undefined) { + switch (copySourceError) { + case "InternalError": + case "OperationTimedOut": + case "ServerBusy": + return true; + } + } + } + } + if (err?.code === "PARSE_ERROR" && err?.message.startsWith(`Error "Error: Unclosed root tag`)) { + log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); + return true; + } + return false; + } + /** + * Delay a calculated time between retries. + * + * @param isPrimaryRetry - + * @param attempt - + * @param abortSignal - + */ + async delay(isPrimaryRetry, attempt, abortSignal) { + let delayTimeInMs = 0; + if (isPrimaryRetry) { + switch (this.retryOptions.retryPolicyType) { + case StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL: + delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs, this.retryOptions.maxRetryDelayInMs); + break; + case StorageRetryPolicyType_js_1.StorageRetryPolicyType.FIXED: + delayTimeInMs = this.retryOptions.retryDelayInMs; + break; + } + } + else { + delayTimeInMs = Math.random() * 1000; + } + log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); + return (0, utils_common_js_1.delay)(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR); + } +} +exports.StorageRetryPolicy = StorageRetryPolicy; +//# sourceMappingURL=StorageRetryPolicy.js.map + +/***/ }), + +/***/ 51772: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageRetryPolicyType = void 0; +/** + * RetryPolicy types. + */ +var StorageRetryPolicyType; +(function (StorageRetryPolicyType) { + /** + * Exponential retry. Retry time delay grows exponentially. + */ + StorageRetryPolicyType[StorageRetryPolicyType["EXPONENTIAL"] = 0] = "EXPONENTIAL"; + /** + * Linear retry. Retry time delay grows linearly. + */ + StorageRetryPolicyType[StorageRetryPolicyType["FIXED"] = 1] = "FIXED"; +})(StorageRetryPolicyType || (exports.StorageRetryPolicyType = StorageRetryPolicyType = {})); +//# sourceMappingURL=StorageRetryPolicyType.js.map + +/***/ }), + +/***/ 68031: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.storageRetryPolicyName = void 0; +exports.storageRetryPolicy = storageRetryPolicy; +const abort_controller_1 = __nccwpck_require__(1753); +const core_rest_pipeline_1 = __nccwpck_require__(29146); +const core_util_1 = __nccwpck_require__(80637); +const StorageRetryPolicyFactory_js_1 = __nccwpck_require__(98637); +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +const log_js_1 = __nccwpck_require__(53282); +/** + * Name of the {@link storageRetryPolicy} + */ +exports.storageRetryPolicyName = "storageRetryPolicy"; +// Default values of StorageRetryOptions +const DEFAULT_RETRY_OPTIONS = { + maxRetryDelayInMs: 120 * 1000, + maxTries: 4, + retryDelayInMs: 4 * 1000, + retryPolicyType: StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL, + secondaryHost: "", + tryTimeoutInMs: undefined, // Use server side default timeout strategy }; -const copyIncrementalOperationSpec = { - path: "/{containerName}/{blob}", - httpMethod: "PUT", - responses: { - 202: { - headersMapper: Mappers.PageBlobCopyIncrementalHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.PageBlobCopyIncrementalExceptionHeaders, +const retriableErrors = [ + "ETIMEDOUT", + "ESOCKETTIMEDOUT", + "ECONNREFUSED", + "ECONNRESET", + "ENOENT", + "ENOTFOUND", + "TIMEOUT", + "EPIPE", + "REQUEST_SEND_ERROR", +]; +const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); +/** + * Retry policy with exponential retry and linear retry implemented. + */ +function storageRetryPolicy(options = {}) { + const retryPolicyType = options.retryPolicyType ?? DEFAULT_RETRY_OPTIONS.retryPolicyType; + const maxTries = options.maxTries ?? DEFAULT_RETRY_OPTIONS.maxTries; + const retryDelayInMs = options.retryDelayInMs ?? DEFAULT_RETRY_OPTIONS.retryDelayInMs; + const maxRetryDelayInMs = options.maxRetryDelayInMs ?? DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs; + const secondaryHost = options.secondaryHost ?? DEFAULT_RETRY_OPTIONS.secondaryHost; + const tryTimeoutInMs = options.tryTimeoutInMs ?? DEFAULT_RETRY_OPTIONS.tryTimeoutInMs; + function shouldRetry({ isPrimaryRetry, attempt, response, error, }) { + if (attempt >= maxTries) { + log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${maxTries}, no further try.`); + return false; + } + if (error) { + for (const retriableError of retriableErrors) { + if (error.name.toUpperCase().includes(retriableError) || + error.message.toUpperCase().includes(retriableError) || + (error.code && error.code.toString().toUpperCase() === retriableError)) { + log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); + return true; + } + } + if (error?.code === "PARSE_ERROR" && + error?.message.startsWith(`Error "Error: Unclosed root tag`)) { + log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); + return true; + } + } + // If attempt was against the secondary & it returned a StatusNotFound (404), then + // the resource was not found. This may be due to replication delay. So, in this + // case, we'll never try the secondary again for this operation. + if (response || error) { + const statusCode = response?.status ?? error?.statusCode ?? 0; + if (!isPrimaryRetry && statusCode === 404) { + log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); + return true; + } + // Server internal error or server timeout + if (statusCode === 503 || statusCode === 500) { + log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); + return true; + } + } + if (response) { + // Retry select Copy Source Error Codes. + if (response?.status >= 400) { + const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); + if (copySourceError !== undefined) { + switch (copySourceError) { + case "InternalError": + case "OperationTimedOut": + case "ServerBusy": + return true; + } + } + } + } + return false; + } + function calculateDelay(isPrimaryRetry, attempt) { + let delayTimeInMs = 0; + if (isPrimaryRetry) { + switch (retryPolicyType) { + case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL: + delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * retryDelayInMs, maxRetryDelayInMs); + break; + case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.FIXED: + delayTimeInMs = retryDelayInMs; + break; + } + } + else { + delayTimeInMs = Math.random() * 1000; + } + log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); + return delayTimeInMs; + } + return { + name: exports.storageRetryPolicyName, + async sendRequest(request, next) { + // Set the server-side timeout query parameter "timeout=[seconds]" + if (tryTimeoutInMs) { + request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1000))); + } + const primaryUrl = request.url; + const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request.url, secondaryHost) : undefined; + let secondaryHas404 = false; + let attempt = 1; + let retryAgain = true; + let response; + let error; + while (retryAgain) { + const isPrimaryRetry = secondaryHas404 || + !secondaryUrl || + !["GET", "HEAD", "OPTIONS"].includes(request.method) || + attempt % 2 === 1; + request.url = isPrimaryRetry ? primaryUrl : secondaryUrl; + response = undefined; + error = undefined; + try { + log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); + response = await next(request); + secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); + } + catch (e) { + if ((0, core_rest_pipeline_1.isRestError)(e)) { + log_js_1.logger.error(`RetryPolicy: Caught error, message: ${e.message}, code: ${e.code}`); + error = e; + } + else { + log_js_1.logger.error(`RetryPolicy: Caught error, message: ${(0, core_util_1.getErrorMessage)(e)}`); + throw e; + } + } + retryAgain = shouldRetry({ isPrimaryRetry, attempt, response, error }); + if (retryAgain) { + await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request.abortSignal, RETRY_ABORT_ERROR); + } + attempt++; + } + if (response) { + return response; + } + throw error ?? new core_rest_pipeline_1.RestError("RetryPolicy failed without known error."); }, - }, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp21], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - Parameters.ifModifiedSince, - Parameters.ifUnmodifiedSince, - Parameters.ifMatch, - Parameters.ifNoneMatch, - Parameters.ifTags, - Parameters.copySource, - ], - isXML: true, - serializer: xmlSerializer, -}; -//# sourceMappingURL=pageBlob.js.map + }; +} +//# sourceMappingURL=StorageRetryPolicyV2.js.map /***/ }), -/***/ 1746: +/***/ 66776: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ServiceImpl = void 0; -const tslib_1 = __nccwpck_require__(4351); -const coreClient = tslib_1.__importStar(__nccwpck_require__(7611)); -const Mappers = tslib_1.__importStar(__nccwpck_require__(52486)); -const Parameters = tslib_1.__importStar(__nccwpck_require__(54142)); -/** Class containing Service operations. */ -class ServiceImpl { - client; +exports.StorageSharedKeyCredentialPolicy = void 0; +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +const CredentialPolicy_js_1 = __nccwpck_require__(15513); +const SharedKeyComparator_js_1 = __nccwpck_require__(35867); +/** + * StorageSharedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key. + */ +class StorageSharedKeyCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { /** - * Initialize a new instance of the class Service class. - * @param client Reference to the service client + * Reference to StorageSharedKeyCredential which generates StorageSharedKeyCredentialPolicy */ - constructor(client) { - this.client = client; - } + factory; /** - * Sets properties for a storage account's Blob service endpoint, including properties for Storage - * Analytics and CORS (Cross-Origin Resource Sharing) rules - * @param blobServiceProperties The StorageService properties. - * @param options The options parameters. + * Creates an instance of StorageSharedKeyCredentialPolicy. + * @param nextPolicy - + * @param options - + * @param factory - */ - setProperties(blobServiceProperties, options) { - return this.client.sendOperationRequest({ blobServiceProperties, options }, setPropertiesOperationSpec); + constructor(nextPolicy, options, factory) { + super(nextPolicy, options); + this.factory = factory; } /** - * gets the properties of a storage account's Blob service, including properties for Storage Analytics - * and CORS (Cross-Origin Resource Sharing) rules. - * @param options The options parameters. + * Signs request. + * + * @param request - */ - getProperties(options) { - return this.client.sendOperationRequest({ options }, getPropertiesOperationSpec); + signRequest(request) { + request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); + if (request.body && + (typeof request.body === "string" || request.body !== undefined) && + request.body.length > 0) { + request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + } + const stringToSign = [ + request.method.toUpperCase(), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), + ].join("\n") + + "\n" + + this.getCanonicalizedHeadersString(request) + + this.getCanonicalizedResourceString(request); + const signature = this.factory.computeHMACSHA256(stringToSign); + request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); + // console.log(`[URL]:${request.url}`); + // console.log(`[HEADERS]:${request.headers.toString()}`); + // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); + // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); + return request; } /** - * Retrieves statistics related to replication for the Blob service. It is only available on the - * secondary location endpoint when read-access geo-redundant replication is enabled for the storage - * account. - * @param options The options parameters. + * Retrieve header value according to shared key sign rules. + * @see https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key + * + * @param request - + * @param headerName - */ - getStatistics(options) { - return this.client.sendOperationRequest({ options }, getStatisticsOperationSpec); + getHeaderValueToSign(request, headerName) { + const value = request.headers.get(headerName); + if (!value) { + return ""; + } + // When using version 2015-02-21 or later, if Content-Length is zero, then + // set the Content-Length part of the StringToSign to an empty string. + // https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key + if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { + return ""; + } + return value; } /** - * The List Containers Segment operation returns a list of the containers under the specified account - * @param options The options parameters. + * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: + * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. + * 2. Convert each HTTP header name to lowercase. + * 3. Sort the headers lexicographically by header name, in ascending order. + * Each header may appear only once in the string. + * 4. Replace any linear whitespace in the header value with a single space. + * 5. Trim any whitespace around the colon in the header. + * 6. Finally, append a new-line character to each canonicalized header in the resulting list. + * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. + * + * @param request - */ - listContainersSegment(options) { - return this.client.sendOperationRequest({ options }, listContainersSegmentOperationSpec); + getCanonicalizedHeadersString(request) { + let headersArray = request.headers.headersArray().filter((value) => { + return value.name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE); + }); + headersArray.sort((a, b) => { + return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); + }); + // Remove duplicate headers + headersArray = headersArray.filter((value, index, array) => { + if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { + return false; + } + return true; + }); + let canonicalizedHeadersStringToSign = ""; + headersArray.forEach((header) => { + canonicalizedHeadersStringToSign += `${header.name + .toLowerCase() + .trimRight()}:${header.value.trimLeft()}\n`; + }); + return canonicalizedHeadersStringToSign; } /** - * Retrieves a user delegation key for the Blob service. This is only a valid operation when using - * bearer token authentication. - * @param keyInfo Key information - * @param options The options parameters. + * Retrieves the webResource canonicalized resource string. + * + * @param request - */ - getUserDelegationKey(keyInfo, options) { - return this.client.sendOperationRequest({ keyInfo, options }, getUserDelegationKeyOperationSpec); + getCanonicalizedResourceString(request) { + const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; + let canonicalizedResourceString = ""; + canonicalizedResourceString += `/${this.factory.accountName}${path}`; + const queries = (0, utils_common_js_1.getURLQueries)(request.url); + const lowercaseQueries = {}; + if (queries) { + const queryKeys = []; + for (const key in queries) { + if (Object.prototype.hasOwnProperty.call(queries, key)) { + const lowercaseKey = key.toLowerCase(); + lowercaseQueries[lowercaseKey] = queries[key]; + queryKeys.push(lowercaseKey); + } + } + queryKeys.sort(); + for (const key of queryKeys) { + canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; + } + } + return canonicalizedResourceString; + } +} +exports.StorageSharedKeyCredentialPolicy = StorageSharedKeyCredentialPolicy; +//# sourceMappingURL=StorageSharedKeyCredentialPolicy.js.map + +/***/ }), + +/***/ 93846: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.storageSharedKeyCredentialPolicyName = void 0; +exports.storageSharedKeyCredentialPolicy = storageSharedKeyCredentialPolicy; +const node_crypto_1 = __nccwpck_require__(6005); +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +const SharedKeyComparator_js_1 = __nccwpck_require__(35867); +/** + * The programmatic identifier of the storageSharedKeyCredentialPolicy. + */ +exports.storageSharedKeyCredentialPolicyName = "storageSharedKeyCredentialPolicy"; +/** + * storageSharedKeyCredentialPolicy handles signing requests using storage account keys. + */ +function storageSharedKeyCredentialPolicy(options) { + function signRequest(request) { + request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); + if (request.body && + (typeof request.body === "string" || Buffer.isBuffer(request.body)) && + request.body.length > 0) { + request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + } + const stringToSign = [ + request.method.toUpperCase(), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), + ].join("\n") + + "\n" + + getCanonicalizedHeadersString(request) + + getCanonicalizedResourceString(request); + const signature = (0, node_crypto_1.createHmac)("sha256", options.accountKey) + .update(stringToSign, "utf8") + .digest("base64"); + request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); + // console.log(`[URL]:${request.url}`); + // console.log(`[HEADERS]:${request.headers.toString()}`); + // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); + // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); } /** - * Returns the sku name and account kind - * @param options The options parameters. + * Retrieve header value according to shared key sign rules. + * @see https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key */ - getAccountInfo(options) { - return this.client.sendOperationRequest({ options }, getAccountInfoOperationSpec); + function getHeaderValueToSign(request, headerName) { + const value = request.headers.get(headerName); + if (!value) { + return ""; + } + // When using version 2015-02-21 or later, if Content-Length is zero, then + // set the Content-Length part of the StringToSign to an empty string. + // https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key + if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { + return ""; + } + return value; } /** - * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * @param contentLength The length of the request. - * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch - * boundary. Example header value: multipart/mixed; boundary=batch_ - * @param body Initial data - * @param options The options parameters. + * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: + * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. + * 2. Convert each HTTP header name to lowercase. + * 3. Sort the headers lexicographically by header name, in ascending order. + * Each header may appear only once in the string. + * 4. Replace any linear whitespace in the header value with a single space. + * 5. Trim any whitespace around the colon in the header. + * 6. Finally, append a new-line character to each canonicalized header in the resulting list. + * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. + * */ - submitBatch(contentLength, multipartContentType, body, options) { - return this.client.sendOperationRequest({ contentLength, multipartContentType, body, options }, submitBatchOperationSpec); + function getCanonicalizedHeadersString(request) { + let headersArray = []; + for (const [name, value] of request.headers) { + if (name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE)) { + headersArray.push({ name, value }); + } + } + headersArray.sort((a, b) => { + return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); + }); + // Remove duplicate headers + headersArray = headersArray.filter((value, index, array) => { + if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { + return false; + } + return true; + }); + let canonicalizedHeadersStringToSign = ""; + headersArray.forEach((header) => { + canonicalizedHeadersStringToSign += `${header.name + .toLowerCase() + .trimRight()}:${header.value.trimLeft()}\n`; + }); + return canonicalizedHeadersStringToSign; } - /** - * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a - * given search expression. Filter blobs searches across all containers within a storage account but - * can be scoped within the expression to a single container. - * @param options The options parameters. - */ - filterBlobs(options) { - return this.client.sendOperationRequest({ options }, filterBlobsOperationSpec); + function getCanonicalizedResourceString(request) { + const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; + let canonicalizedResourceString = ""; + canonicalizedResourceString += `/${options.accountName}${path}`; + const queries = (0, utils_common_js_1.getURLQueries)(request.url); + const lowercaseQueries = {}; + if (queries) { + const queryKeys = []; + for (const key in queries) { + if (Object.prototype.hasOwnProperty.call(queries, key)) { + const lowercaseKey = key.toLowerCase(); + lowercaseQueries[lowercaseKey] = queries[key]; + queryKeys.push(lowercaseKey); + } + } + queryKeys.sort(); + for (const key of queryKeys) { + canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; + } + } + return canonicalizedResourceString; } -} -exports.ServiceImpl = ServiceImpl; -// Operation Specifications -const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true); -const setPropertiesOperationSpec = { - path: "/", - httpMethod: "PUT", - responses: { - 202: { - headersMapper: Mappers.ServiceSetPropertiesHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceSetPropertiesExceptionHeaders, - }, - }, - requestBody: Parameters.blobServiceProperties, - queryParameters: [ - Parameters.restype, - Parameters.comp, - Parameters.timeoutInSeconds, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.contentType, - Parameters.accept, - Parameters.version, - Parameters.requestId, - ], - isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "xml", - serializer: xmlSerializer, -}; -const getPropertiesOperationSpec = { - path: "/", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BlobServiceProperties, - headersMapper: Mappers.ServiceGetPropertiesHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceGetPropertiesExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.restype, - Parameters.comp, - Parameters.timeoutInSeconds, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - ], - isXML: true, - serializer: xmlSerializer, -}; -const getStatisticsOperationSpec = { - path: "/", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.BlobServiceStatistics, - headersMapper: Mappers.ServiceGetStatisticsHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceGetStatisticsExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.restype, - Parameters.timeoutInSeconds, - Parameters.comp1, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - ], - isXML: true, - serializer: xmlSerializer, -}; -const listContainersSegmentOperationSpec = { - path: "/", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ListContainersSegmentResponse, - headersMapper: Mappers.ServiceListContainersSegmentHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceListContainersSegmentExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.comp2, - Parameters.prefix, - Parameters.marker, - Parameters.maxPageSize, - Parameters.include, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - ], - isXML: true, - serializer: xmlSerializer, -}; -const getUserDelegationKeyOperationSpec = { - path: "/", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.UserDelegationKey, - headersMapper: Mappers.ServiceGetUserDelegationKeyHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceGetUserDelegationKeyExceptionHeaders, - }, - }, - requestBody: Parameters.keyInfo, - queryParameters: [ - Parameters.restype, - Parameters.timeoutInSeconds, - Parameters.comp3, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.contentType, - Parameters.accept, - Parameters.version, - Parameters.requestId, - ], - isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "xml", - serializer: xmlSerializer, -}; -const getAccountInfoOperationSpec = { - path: "/", - httpMethod: "GET", - responses: { - 200: { - headersMapper: Mappers.ServiceGetAccountInfoHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceGetAccountInfoExceptionHeaders, - }, - }, - queryParameters: [ - Parameters.comp, - Parameters.timeoutInSeconds, - Parameters.restype1, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - ], - isXML: true, - serializer: xmlSerializer, -}; -const submitBatchOperationSpec = { - path: "/", - httpMethod: "POST", - responses: { - 202: { - bodyMapper: { - type: { name: "Stream" }, - serializedName: "parsedResponse", - }, - headersMapper: Mappers.ServiceSubmitBatchHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceSubmitBatchExceptionHeaders, - }, - }, - requestBody: Parameters.body, - queryParameters: [Parameters.timeoutInSeconds, Parameters.comp4], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.accept, - Parameters.version, - Parameters.requestId, - Parameters.contentLength, - Parameters.multipartContentType, - ], - isXML: true, - contentType: "application/xml; charset=utf-8", - mediaType: "xml", - serializer: xmlSerializer, -}; -const filterBlobsOperationSpec = { - path: "/", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.FilterBlobSegment, - headersMapper: Mappers.ServiceFilterBlobsHeaders, - }, - default: { - bodyMapper: Mappers.StorageError, - headersMapper: Mappers.ServiceFilterBlobsExceptionHeaders, + return { + name: exports.storageSharedKeyCredentialPolicyName, + async sendRequest(request, next) { + signRequest(request); + return next(request); }, - }, - queryParameters: [ - Parameters.timeoutInSeconds, - Parameters.marker, - Parameters.maxPageSize, - Parameters.comp5, - Parameters.where, - ], - urlParameters: [Parameters.url], - headerParameters: [ - Parameters.version, - Parameters.requestId, - Parameters.accept1, - ], - isXML: true, - serializer: xmlSerializer, -}; -//# sourceMappingURL=service.js.map + }; +} +//# sourceMappingURL=StorageSharedKeyCredentialPolicyV2.js.map /***/ }), -/***/ 24763: -/***/ ((__unused_webpack_module, exports) => { +/***/ 9846: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=appendBlob.js.map - -/***/ }), - -/***/ 57427: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. +exports.BlobBeginCopyFromUrlPoller = void 0; +const core_util_1 = __nccwpck_require__(80637); +const core_lro_1 = __nccwpck_require__(90334); +/** + * This is the poller returned by {@link BlobClient.beginCopyFromURL}. + * This can not be instantiated directly outside of this package. * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. + * @hidden + */ +class BlobBeginCopyFromUrlPoller extends core_lro_1.Poller { + intervalInMs; + constructor(options) { + const { blobClient, copySource, intervalInMs = 15000, onProgress, resumeFrom, startCopyFromURLOptions, } = options; + let state; + if (resumeFrom) { + state = JSON.parse(resumeFrom).state; + } + const operation = makeBlobBeginCopyFromURLPollOperation({ + ...state, + blobClient, + copySource, + startCopyFromURLOptions, + }); + super(operation); + if (typeof onProgress === "function") { + this.onProgress(onProgress); + } + this.intervalInMs = intervalInMs; + } + delay() { + return (0, core_util_1.delay)(this.intervalInMs); + } +} +exports.BlobBeginCopyFromUrlPoller = BlobBeginCopyFromUrlPoller; +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @hidden + */ +const cancel = async function cancel(options = {}) { + const state = this.state; + const { copyId } = state; + if (state.isCompleted) { + return makeBlobBeginCopyFromURLPollOperation(state); + } + if (!copyId) { + state.isCancelled = true; + return makeBlobBeginCopyFromURLPollOperation(state); + } + // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call + await state.blobClient.abortCopyFromURL(copyId, { + abortSignal: options.abortSignal, + }); + state.isCancelled = true; + return makeBlobBeginCopyFromURLPollOperation(state); +}; +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @hidden + */ +const update = async function update(options = {}) { + const state = this.state; + const { blobClient, copySource, startCopyFromURLOptions } = state; + if (!state.isStarted) { + state.isStarted = true; + const result = await blobClient.startCopyFromURL(copySource, startCopyFromURLOptions); + // copyId is needed to abort + state.copyId = result.copyId; + if (result.copyStatus === "success") { + state.result = result; + state.isCompleted = true; + } + } + else if (!state.isCompleted) { + try { + const result = await state.blobClient.getProperties({ abortSignal: options.abortSignal }); + const { copyStatus, copyProgress } = result; + const prevCopyProgress = state.copyProgress; + if (copyProgress) { + state.copyProgress = copyProgress; + } + if (copyStatus === "pending" && + copyProgress !== prevCopyProgress && + typeof options.fireProgress === "function") { + // trigger in setTimeout, or swallow error? + options.fireProgress(state); + } + else if (copyStatus === "success") { + state.result = result; + state.isCompleted = true; + } + else if (copyStatus === "failed") { + state.error = new Error(`Blob copy failed with reason: "${result.copyStatusDescription || "unknown"}"`); + state.isCompleted = true; + } + } + catch (err) { + state.error = err; + state.isCompleted = true; + } + } + return makeBlobBeginCopyFromURLPollOperation(state); +}; +/** + * Note: Intentionally using function expression over arrow function expression + * so that the function can be invoked with a different context. + * This affects what `this` refers to. + * @hidden */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=blob.js.map - -/***/ }), - -/***/ 56945: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. +const toString = function toString() { + return JSON.stringify({ state: this.state }, (key, value) => { + // remove blobClient from serialized state since a client can't be hydrated from this info. + if (key === "blobClient") { + return undefined; + } + return value; + }); +}; +/** + * Creates a poll operation given the provided state. + * @hidden */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=blockBlob.js.map +function makeBlobBeginCopyFromURLPollOperation(state) { + return { + state: { ...state }, + cancel, + toString, + update, + }; +} +//# sourceMappingURL=BlobStartCopyFromUrlPoller.js.map /***/ }), -/***/ 43634: +/***/ 70793: /***/ ((__unused_webpack_module, exports) => { "use strict"; -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=container.js.map - -/***/ }), - -/***/ 68529: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. +exports.AccountSASPermissions = void 0; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. + * This is a helper class to construct a string representing the permissions granted by an AccountSAS. Setting a value + * to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the + * values are set, this should be serialized with toString and set as the permissions field on an + * {@link AccountSASSignatureValues} object. It is possible to construct the permissions string without this class, but + * the order of the permissions is particular and this class guarantees correctness. */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(75650), exports); -tslib_1.__exportStar(__nccwpck_require__(43634), exports); -tslib_1.__exportStar(__nccwpck_require__(57427), exports); -tslib_1.__exportStar(__nccwpck_require__(76425), exports); -tslib_1.__exportStar(__nccwpck_require__(24763), exports); -tslib_1.__exportStar(__nccwpck_require__(56945), exports); -//# sourceMappingURL=index.js.map +class AccountSASPermissions { + /** + * Parse initializes the AccountSASPermissions fields from a string. + * + * @param permissions - + */ + static parse(permissions) { + const accountSASPermissions = new AccountSASPermissions(); + for (const c of permissions) { + switch (c) { + case "r": + accountSASPermissions.read = true; + break; + case "w": + accountSASPermissions.write = true; + break; + case "d": + accountSASPermissions.delete = true; + break; + case "x": + accountSASPermissions.deleteVersion = true; + break; + case "l": + accountSASPermissions.list = true; + break; + case "a": + accountSASPermissions.add = true; + break; + case "c": + accountSASPermissions.create = true; + break; + case "u": + accountSASPermissions.update = true; + break; + case "p": + accountSASPermissions.process = true; + break; + case "t": + accountSASPermissions.tag = true; + break; + case "f": + accountSASPermissions.filter = true; + break; + case "i": + accountSASPermissions.setImmutabilityPolicy = true; + break; + case "y": + accountSASPermissions.permanentDelete = true; + break; + default: + throw new RangeError(`Invalid permission character: ${c}`); + } + } + return accountSASPermissions; + } + /** + * Creates a {@link AccountSASPermissions} from a raw object which contains same keys as it + * and boolean values for them. + * + * @param permissionLike - + */ + static from(permissionLike) { + const accountSASPermissions = new AccountSASPermissions(); + if (permissionLike.read) { + accountSASPermissions.read = true; + } + if (permissionLike.write) { + accountSASPermissions.write = true; + } + if (permissionLike.delete) { + accountSASPermissions.delete = true; + } + if (permissionLike.deleteVersion) { + accountSASPermissions.deleteVersion = true; + } + if (permissionLike.filter) { + accountSASPermissions.filter = true; + } + if (permissionLike.tag) { + accountSASPermissions.tag = true; + } + if (permissionLike.list) { + accountSASPermissions.list = true; + } + if (permissionLike.add) { + accountSASPermissions.add = true; + } + if (permissionLike.create) { + accountSASPermissions.create = true; + } + if (permissionLike.update) { + accountSASPermissions.update = true; + } + if (permissionLike.process) { + accountSASPermissions.process = true; + } + if (permissionLike.setImmutabilityPolicy) { + accountSASPermissions.setImmutabilityPolicy = true; + } + if (permissionLike.permanentDelete) { + accountSASPermissions.permanentDelete = true; + } + return accountSASPermissions; + } + /** + * Permission to read resources and list queues and tables granted. + */ + read = false; + /** + * Permission to write resources granted. + */ + write = false; + /** + * Permission to delete blobs and files granted. + */ + delete = false; + /** + * Permission to delete versions granted. + */ + deleteVersion = false; + /** + * Permission to list blob containers, blobs, shares, directories, and files granted. + */ + list = false; + /** + * Permission to add messages, table entities, and append to blobs granted. + */ + add = false; + /** + * Permission to create blobs and files granted. + */ + create = false; + /** + * Permissions to update messages and table entities granted. + */ + update = false; + /** + * Permission to get and delete messages granted. + */ + process = false; + /** + * Specfies Tag access granted. + */ + tag = false; + /** + * Permission to filter blobs. + */ + filter = false; + /** + * Permission to set immutability policy. + */ + setImmutabilityPolicy = false; + /** + * Specifies that Permanent Delete is permitted. + */ + permanentDelete = false; + /** + * Produces the SAS permissions string for an Azure Storage account. + * Call this method to set AccountSASSignatureValues Permissions field. + * + * Using this method will guarantee the resource types are in + * an order accepted by the service. + * + * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas + * + */ + toString() { + // The order of the characters should be as specified here to ensure correctness: + // https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas + // Use a string array instead of string concatenating += operator for performance + const permissions = []; + if (this.read) { + permissions.push("r"); + } + if (this.write) { + permissions.push("w"); + } + if (this.delete) { + permissions.push("d"); + } + if (this.deleteVersion) { + permissions.push("x"); + } + if (this.filter) { + permissions.push("f"); + } + if (this.tag) { + permissions.push("t"); + } + if (this.list) { + permissions.push("l"); + } + if (this.add) { + permissions.push("a"); + } + if (this.create) { + permissions.push("c"); + } + if (this.update) { + permissions.push("u"); + } + if (this.process) { + permissions.push("p"); + } + if (this.setImmutabilityPolicy) { + permissions.push("i"); + } + if (this.permanentDelete) { + permissions.push("y"); + } + return permissions.join(""); + } +} +exports.AccountSASPermissions = AccountSASPermissions; +//# sourceMappingURL=AccountSASPermissions.js.map /***/ }), -/***/ 76425: +/***/ 70790: /***/ ((__unused_webpack_module, exports) => { "use strict"; -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AccountSASResourceTypes = void 0; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. + * This is a helper class to construct a string representing the resources accessible by an AccountSAS. Setting a value + * to true means that any SAS which uses these permissions will grant access to that resource type. Once all the + * values are set, this should be serialized with toString and set as the resources field on an + * {@link AccountSASSignatureValues} object. It is possible to construct the resources string without this class, but + * the order of the resources is particular and this class guarantees correctness. */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=pageBlob.js.map +class AccountSASResourceTypes { + /** + * Creates an {@link AccountSASResourceTypes} from the specified resource types string. This method will throw an + * Error if it encounters a character that does not correspond to a valid resource type. + * + * @param resourceTypes - + */ + static parse(resourceTypes) { + const accountSASResourceTypes = new AccountSASResourceTypes(); + for (const c of resourceTypes) { + switch (c) { + case "s": + accountSASResourceTypes.service = true; + break; + case "c": + accountSASResourceTypes.container = true; + break; + case "o": + accountSASResourceTypes.object = true; + break; + default: + throw new RangeError(`Invalid resource type: ${c}`); + } + } + return accountSASResourceTypes; + } + /** + * Permission to access service level APIs granted. + */ + service = false; + /** + * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted. + */ + container = false; + /** + * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted. + */ + object = false; + /** + * Converts the given resource types to a string. + * + * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas + * + */ + toString() { + const resourceTypes = []; + if (this.service) { + resourceTypes.push("s"); + } + if (this.container) { + resourceTypes.push("c"); + } + if (this.object) { + resourceTypes.push("o"); + } + return resourceTypes.join(""); + } +} +exports.AccountSASResourceTypes = AccountSASResourceTypes; +//# sourceMappingURL=AccountSASResourceTypes.js.map /***/ }), -/***/ 75650: +/***/ 34606: /***/ ((__unused_webpack_module, exports) => { "use strict"; -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=service.js.map - -/***/ }), - -/***/ 92252: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. +exports.AccountSASServices = void 0; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. + * This is a helper class to construct a string representing the services accessible by an AccountSAS. Setting a value + * to true means that any SAS which uses these permissions will grant access to that service. Once all the + * values are set, this should be serialized with toString and set as the services field on an + * {@link AccountSASSignatureValues} object. It is possible to construct the services string without this class, but + * the order of the services is particular and this class guarantees correctness. */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageClient = void 0; -const tslib_1 = __nccwpck_require__(4351); -const coreHttpCompat = tslib_1.__importStar(__nccwpck_require__(25083)); -const index_js_1 = __nccwpck_require__(13759); -class StorageClient extends coreHttpCompat.ExtendedServiceClient { - url; - version; +class AccountSASServices { /** - * Initializes a new instance of the StorageClient class. - * @param url The URL of the service account, container, or blob that is the target of the desired - * operation. - * @param options The parameter options + * Creates an {@link AccountSASServices} from the specified services string. This method will throw an + * Error if it encounters a character that does not correspond to a valid service. + * + * @param services - */ - constructor(url, options) { - if (url === undefined) { - throw new Error("'url' cannot be null"); - } - // Initializing default values for options - if (!options) { - options = {}; + static parse(services) { + const accountSASServices = new AccountSASServices(); + for (const c of services) { + switch (c) { + case "b": + accountSASServices.blob = true; + break; + case "f": + accountSASServices.file = true; + break; + case "q": + accountSASServices.queue = true; + break; + case "t": + accountSASServices.table = true; + break; + default: + throw new RangeError(`Invalid service character: ${c}`); + } } - const defaults = { - requestContentType: "application/json; charset=utf-8", - }; - const packageDetails = `azsdk-js-azure-storage-blob/12.29.1`; - const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - const optionsWithDefaults = { - ...defaults, - ...options, - userAgentOptions: { - userAgentPrefix, - }, - endpoint: options.endpoint ?? options.baseUri ?? "{url}", - }; - super(optionsWithDefaults); - // Parameter assignments - this.url = url; - // Assigning values to Constant parameters - this.version = options.version || "2025-11-05"; - this.service = new index_js_1.ServiceImpl(this); - this.container = new index_js_1.ContainerImpl(this); - this.blob = new index_js_1.BlobImpl(this); - this.pageBlob = new index_js_1.PageBlobImpl(this); - this.appendBlob = new index_js_1.AppendBlobImpl(this); - this.blockBlob = new index_js_1.BlockBlobImpl(this); + return accountSASServices; + } + /** + * Permission to access blob resources granted. + */ + blob = false; + /** + * Permission to access file resources granted. + */ + file = false; + /** + * Permission to access queue resources granted. + */ + queue = false; + /** + * Permission to access table resources granted. + */ + table = false; + /** + * Converts the given services to a string. + * + */ + toString() { + const services = []; + if (this.blob) { + services.push("b"); + } + if (this.table) { + services.push("t"); + } + if (this.queue) { + services.push("q"); + } + if (this.file) { + services.push("f"); + } + return services.join(""); } - service; - container; - blob; - pageBlob; - appendBlob; - blockBlob; } -exports.StorageClient = StorageClient; -//# sourceMappingURL=storageClient.js.map - -/***/ }), - -/***/ 39241: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.KnownEncryptionAlgorithmType = void 0; -/** Known values of {@link EncryptionAlgorithmType} that the service accepts. */ -var KnownEncryptionAlgorithmType; -(function (KnownEncryptionAlgorithmType) { - KnownEncryptionAlgorithmType["AES256"] = "AES256"; -})(KnownEncryptionAlgorithmType || (exports.KnownEncryptionAlgorithmType = KnownEncryptionAlgorithmType = {})); -//# sourceMappingURL=generatedModels.js.map +exports.AccountSASServices = AccountSASServices; +//# sourceMappingURL=AccountSASServices.js.map /***/ }), -/***/ 37168: +/***/ 72763: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -116571,73 +109571,110 @@ var KnownEncryptionAlgorithmType; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.logger = exports.RestError = exports.BaseRequestPolicy = exports.StorageOAuthScopes = exports.newPipeline = exports.isPipelineLike = exports.Pipeline = exports.getBlobServiceAccountAudience = exports.StorageBlobAudience = exports.PremiumPageBlobTier = exports.BlockBlobTier = exports.generateBlobSASQueryParameters = exports.generateAccountSASQueryParameters = void 0; -const tslib_1 = __nccwpck_require__(4351); -const core_rest_pipeline_1 = __nccwpck_require__(29146); -Object.defineProperty(exports, "RestError", ({ enumerable: true, get: function () { return core_rest_pipeline_1.RestError; } })); -tslib_1.__exportStar(__nccwpck_require__(12679), exports); -tslib_1.__exportStar(__nccwpck_require__(54437), exports); -tslib_1.__exportStar(__nccwpck_require__(63750), exports); -tslib_1.__exportStar(__nccwpck_require__(20106), exports); -tslib_1.__exportStar(__nccwpck_require__(70793), exports); -tslib_1.__exportStar(__nccwpck_require__(70790), exports); -tslib_1.__exportStar(__nccwpck_require__(34606), exports); -var AccountSASSignatureValues_js_1 = __nccwpck_require__(72763); -Object.defineProperty(exports, "generateAccountSASQueryParameters", ({ enumerable: true, get: function () { return AccountSASSignatureValues_js_1.generateAccountSASQueryParameters; } })); -tslib_1.__exportStar(__nccwpck_require__(73689), exports); -tslib_1.__exportStar(__nccwpck_require__(71861), exports); -tslib_1.__exportStar(__nccwpck_require__(1227), exports); -tslib_1.__exportStar(__nccwpck_require__(87393), exports); -var BlobSASSignatureValues_js_1 = __nccwpck_require__(48921); -Object.defineProperty(exports, "generateBlobSASQueryParameters", ({ enumerable: true, get: function () { return BlobSASSignatureValues_js_1.generateBlobSASQueryParameters; } })); -tslib_1.__exportStar(__nccwpck_require__(86562), exports); -tslib_1.__exportStar(__nccwpck_require__(27579), exports); -tslib_1.__exportStar(__nccwpck_require__(42803), exports); -tslib_1.__exportStar(__nccwpck_require__(35778), exports); -tslib_1.__exportStar(__nccwpck_require__(59155), exports); -var models_js_1 = __nccwpck_require__(64526); -Object.defineProperty(exports, "BlockBlobTier", ({ enumerable: true, get: function () { return models_js_1.BlockBlobTier; } })); -Object.defineProperty(exports, "PremiumPageBlobTier", ({ enumerable: true, get: function () { return models_js_1.PremiumPageBlobTier; } })); -Object.defineProperty(exports, "StorageBlobAudience", ({ enumerable: true, get: function () { return models_js_1.StorageBlobAudience; } })); -Object.defineProperty(exports, "getBlobServiceAccountAudience", ({ enumerable: true, get: function () { return models_js_1.getBlobServiceAccountAudience; } })); -var Pipeline_js_1 = __nccwpck_require__(33781); -Object.defineProperty(exports, "Pipeline", ({ enumerable: true, get: function () { return Pipeline_js_1.Pipeline; } })); -Object.defineProperty(exports, "isPipelineLike", ({ enumerable: true, get: function () { return Pipeline_js_1.isPipelineLike; } })); -Object.defineProperty(exports, "newPipeline", ({ enumerable: true, get: function () { return Pipeline_js_1.newPipeline; } })); -Object.defineProperty(exports, "StorageOAuthScopes", ({ enumerable: true, get: function () { return Pipeline_js_1.StorageOAuthScopes; } })); -tslib_1.__exportStar(__nccwpck_require__(98637), exports); -var RequestPolicy_js_1 = __nccwpck_require__(33847); -Object.defineProperty(exports, "BaseRequestPolicy", ({ enumerable: true, get: function () { return RequestPolicy_js_1.BaseRequestPolicy; } })); -tslib_1.__exportStar(__nccwpck_require__(51870), exports); -tslib_1.__exportStar(__nccwpck_require__(15513), exports); -tslib_1.__exportStar(__nccwpck_require__(98637), exports); -tslib_1.__exportStar(__nccwpck_require__(66776), exports); -tslib_1.__exportStar(__nccwpck_require__(21969), exports); -tslib_1.__exportStar(__nccwpck_require__(39241), exports); -var log_js_1 = __nccwpck_require__(53282); -Object.defineProperty(exports, "logger", ({ enumerable: true, get: function () { return log_js_1.logger; } })); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 583: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AVRO_SCHEMA_KEY = exports.AVRO_CODEC_KEY = exports.AVRO_INIT_BYTES = exports.AVRO_SYNC_MARKER_SIZE = void 0; -exports.AVRO_SYNC_MARKER_SIZE = 16; -exports.AVRO_INIT_BYTES = new Uint8Array([79, 98, 106, 1]); -exports.AVRO_CODEC_KEY = "avro.codec"; -exports.AVRO_SCHEMA_KEY = "avro.schema"; -//# sourceMappingURL=AvroConstants.js.map +exports.generateAccountSASQueryParameters = generateAccountSASQueryParameters; +exports.generateAccountSASQueryParametersInternal = generateAccountSASQueryParametersInternal; +const AccountSASPermissions_js_1 = __nccwpck_require__(70793); +const AccountSASResourceTypes_js_1 = __nccwpck_require__(70790); +const AccountSASServices_js_1 = __nccwpck_require__(34606); +const SasIPRange_js_1 = __nccwpck_require__(80914); +const SASQueryParameters_js_1 = __nccwpck_require__(21969); +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * Generates a {@link SASQueryParameters} object which contains all SAS query parameters needed to make an actual + * REST request. + * + * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas + * + * @param accountSASSignatureValues - + * @param sharedKeyCredential - + */ +function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyCredential) { + return generateAccountSASQueryParametersInternal(accountSASSignatureValues, sharedKeyCredential) + .sasQueryParameters; +} +function generateAccountSASQueryParametersInternal(accountSASSignatureValues, sharedKeyCredential) { + const version = accountSASSignatureValues.version + ? accountSASSignatureValues.version + : constants_js_1.SERVICE_VERSION; + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.setImmutabilityPolicy && + version < "2020-08-04") { + throw RangeError("'version' must be >= '2020-08-04' when provided 'i' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.deleteVersion && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.permanentDelete && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when provided 'y' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.tag && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission."); + } + if (accountSASSignatureValues.permissions && + accountSASSignatureValues.permissions.filter && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when provided 'f' permission."); + } + if (accountSASSignatureValues.encryptionScope && version < "2020-12-06") { + throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS."); + } + const parsedPermissions = AccountSASPermissions_js_1.AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString()); + const parsedServices = AccountSASServices_js_1.AccountSASServices.parse(accountSASSignatureValues.services).toString(); + const parsedResourceTypes = AccountSASResourceTypes_js_1.AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString(); + let stringToSign; + if (version >= "2020-12-06") { + stringToSign = [ + sharedKeyCredential.accountName, + parsedPermissions, + parsedServices, + parsedResourceTypes, + accountSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.startsOn, false) + : "", + (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.expiresOn, false), + accountSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(accountSASSignatureValues.ipRange) : "", + accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "", + version, + accountSASSignatureValues.encryptionScope ? accountSASSignatureValues.encryptionScope : "", + "", // Account SAS requires an additional newline character + ].join("\n"); + } + else { + stringToSign = [ + sharedKeyCredential.accountName, + parsedPermissions, + parsedServices, + parsedResourceTypes, + accountSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.startsOn, false) + : "", + (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.expiresOn, false), + accountSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(accountSASSignatureValues.ipRange) : "", + accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "", + version, + "", // Account SAS requires an additional newline character + ].join("\n"); + } + const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, accountSASSignatureValues.encryptionScope), + stringToSign: stringToSign, + }; +} +//# sourceMappingURL=AccountSASSignatureValues.js.map /***/ }), -/***/ 58119: +/***/ 87393: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -116645,1027 +109682,1110 @@ exports.AVRO_SCHEMA_KEY = "avro.schema"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AvroType = exports.AvroParser = void 0; -class AvroParser { +exports.BlobSASPermissions = void 0; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a blob. Setting + * a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all + * the values are set, this should be serialized with toString and set as the permissions field on a + * {@link BlobSASSignatureValues} object. It is possible to construct the permissions string without this class, but + * the order of the permissions is particular and this class guarantees correctness. + */ +class BlobSASPermissions { /** - * Reads a fixed number of bytes from the stream. + * Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an + * Error if it encounters a character that does not correspond to a valid permission. * - * @param stream - - * @param length - - * @param options - + * @param permissions - */ - static async readFixedBytes(stream, length, options = {}) { - const bytes = await stream.read(length, { abortSignal: options.abortSignal }); - if (bytes.length !== length) { - throw new Error("Hit stream end."); + static parse(permissions) { + const blobSASPermissions = new BlobSASPermissions(); + for (const char of permissions) { + switch (char) { + case "r": + blobSASPermissions.read = true; + break; + case "a": + blobSASPermissions.add = true; + break; + case "c": + blobSASPermissions.create = true; + break; + case "w": + blobSASPermissions.write = true; + break; + case "d": + blobSASPermissions.delete = true; + break; + case "x": + blobSASPermissions.deleteVersion = true; + break; + case "t": + blobSASPermissions.tag = true; + break; + case "m": + blobSASPermissions.move = true; + break; + case "e": + blobSASPermissions.execute = true; + break; + case "i": + blobSASPermissions.setImmutabilityPolicy = true; + break; + case "y": + blobSASPermissions.permanentDelete = true; + break; + default: + throw new RangeError(`Invalid permission: ${char}`); + } } - return bytes; + return blobSASPermissions; } /** - * Reads a single byte from the stream. + * Creates a {@link BlobSASPermissions} from a raw object which contains same keys as it + * and boolean values for them. * - * @param stream - - * @param options - + * @param permissionLike - */ - static async readByte(stream, options = {}) { - const buf = await AvroParser.readFixedBytes(stream, 1, options); - return buf[0]; - } - // int and long are stored in variable-length zig-zag coding. - // variable-length: https://lucene.apache.org/core/3_5_0/fileformats.html#VInt - // zig-zag: https://developers.google.com/protocol-buffers/docs/encoding?csw=1#types - static async readZigZagLong(stream, options = {}) { - let zigZagEncoded = 0; - let significanceInBit = 0; - let byte, haveMoreByte, significanceInFloat; - do { - byte = await AvroParser.readByte(stream, options); - haveMoreByte = byte & 0x80; - zigZagEncoded |= (byte & 0x7f) << significanceInBit; - significanceInBit += 7; - } while (haveMoreByte && significanceInBit < 28); // bitwise operation only works for 32-bit integers - if (haveMoreByte) { - // Switch to float arithmetic - // eslint-disable-next-line no-self-assign - zigZagEncoded = zigZagEncoded; - significanceInFloat = 268435456; // 2 ** 28. - do { - byte = await AvroParser.readByte(stream, options); - zigZagEncoded += (byte & 0x7f) * significanceInFloat; - significanceInFloat *= 128; // 2 ** 7 - } while (byte & 0x80); - const res = (zigZagEncoded % 2 ? -(zigZagEncoded + 1) : zigZagEncoded) / 2; - if (res < Number.MIN_SAFE_INTEGER || res > Number.MAX_SAFE_INTEGER) { - throw new Error("Integer overflow."); - } - return res; + static from(permissionLike) { + const blobSASPermissions = new BlobSASPermissions(); + if (permissionLike.read) { + blobSASPermissions.read = true; } - return (zigZagEncoded >> 1) ^ -(zigZagEncoded & 1); - } - static async readLong(stream, options = {}) { - return AvroParser.readZigZagLong(stream, options); - } - static async readInt(stream, options = {}) { - return AvroParser.readZigZagLong(stream, options); - } - static async readNull() { - return null; - } - static async readBoolean(stream, options = {}) { - const b = await AvroParser.readByte(stream, options); - if (b === 1) { - return true; + if (permissionLike.add) { + blobSASPermissions.add = true; } - else if (b === 0) { - return false; + if (permissionLike.create) { + blobSASPermissions.create = true; } - else { - throw new Error("Byte was not a boolean."); + if (permissionLike.write) { + blobSASPermissions.write = true; } - } - static async readFloat(stream, options = {}) { - const u8arr = await AvroParser.readFixedBytes(stream, 4, options); - const view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); - return view.getFloat32(0, true); // littleEndian = true - } - static async readDouble(stream, options = {}) { - const u8arr = await AvroParser.readFixedBytes(stream, 8, options); - const view = new DataView(u8arr.buffer, u8arr.byteOffset, u8arr.byteLength); - return view.getFloat64(0, true); // littleEndian = true - } - static async readBytes(stream, options = {}) { - const size = await AvroParser.readLong(stream, options); - if (size < 0) { - throw new Error("Bytes size was negative."); + if (permissionLike.delete) { + blobSASPermissions.delete = true; } - return stream.read(size, { abortSignal: options.abortSignal }); - } - static async readString(stream, options = {}) { - const u8arr = await AvroParser.readBytes(stream, options); - const utf8decoder = new TextDecoder(); - return utf8decoder.decode(u8arr); - } - static async readMapPair(stream, readItemMethod, options = {}) { - const key = await AvroParser.readString(stream, options); - // FUTURE: this won't work with readFixed (currently not supported) which needs a length as the parameter. - const value = await readItemMethod(stream, options); - return { key, value }; + if (permissionLike.deleteVersion) { + blobSASPermissions.deleteVersion = true; + } + if (permissionLike.tag) { + blobSASPermissions.tag = true; + } + if (permissionLike.move) { + blobSASPermissions.move = true; + } + if (permissionLike.execute) { + blobSASPermissions.execute = true; + } + if (permissionLike.setImmutabilityPolicy) { + blobSASPermissions.setImmutabilityPolicy = true; + } + if (permissionLike.permanentDelete) { + blobSASPermissions.permanentDelete = true; + } + return blobSASPermissions; } - static async readMap(stream, readItemMethod, options = {}) { - const readPairMethod = (s, opts = {}) => { - return AvroParser.readMapPair(s, readItemMethod, opts); - }; - const pairs = await AvroParser.readArray(stream, readPairMethod, options); - const dict = {}; - for (const pair of pairs) { - dict[pair.key] = pair.value; + /** + * Specifies Read access granted. + */ + read = false; + /** + * Specifies Add access granted. + */ + add = false; + /** + * Specifies Create access granted. + */ + create = false; + /** + * Specifies Write access granted. + */ + write = false; + /** + * Specifies Delete access granted. + */ + delete = false; + /** + * Specifies Delete version access granted. + */ + deleteVersion = false; + /** + * Specfies Tag access granted. + */ + tag = false; + /** + * Specifies Move access granted. + */ + move = false; + /** + * Specifies Execute access granted. + */ + execute = false; + /** + * Specifies SetImmutabilityPolicy access granted. + */ + setImmutabilityPolicy = false; + /** + * Specifies that Permanent Delete is permitted. + */ + permanentDelete = false; + /** + * Converts the given permissions to a string. Using this method will guarantee the permissions are in an + * order accepted by the service. + * + * @returns A string which represents the BlobSASPermissions + */ + toString() { + const permissions = []; + if (this.read) { + permissions.push("r"); } - return dict; + if (this.add) { + permissions.push("a"); + } + if (this.create) { + permissions.push("c"); + } + if (this.write) { + permissions.push("w"); + } + if (this.delete) { + permissions.push("d"); + } + if (this.deleteVersion) { + permissions.push("x"); + } + if (this.tag) { + permissions.push("t"); + } + if (this.move) { + permissions.push("m"); + } + if (this.execute) { + permissions.push("e"); + } + if (this.setImmutabilityPolicy) { + permissions.push("i"); + } + if (this.permanentDelete) { + permissions.push("y"); + } + return permissions.join(""); + } +} +exports.BlobSASPermissions = BlobSASPermissions; +//# sourceMappingURL=BlobSASPermissions.js.map + +/***/ }), + +/***/ 48921: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.generateBlobSASQueryParameters = generateBlobSASQueryParameters; +exports.generateBlobSASQueryParametersInternal = generateBlobSASQueryParametersInternal; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const BlobSASPermissions_js_1 = __nccwpck_require__(87393); +const ContainerSASPermissions_js_1 = __nccwpck_require__(27579); +const StorageSharedKeyCredential_js_1 = __nccwpck_require__(59155); +const UserDelegationKeyCredential_js_1 = __nccwpck_require__(50822); +const SasIPRange_js_1 = __nccwpck_require__(80914); +const SASQueryParameters_js_1 = __nccwpck_require__(21969); +const constants_js_1 = __nccwpck_require__(81865); +const utils_common_js_1 = __nccwpck_require__(16673); +function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName) { + return generateBlobSASQueryParametersInternal(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName).sasQueryParameters; +} +function generateBlobSASQueryParametersInternal(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName) { + const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : constants_js_1.SERVICE_VERSION; + const sharedKeyCredential = sharedKeyCredentialOrUserDelegationKey instanceof StorageSharedKeyCredential_js_1.StorageSharedKeyCredential + ? sharedKeyCredentialOrUserDelegationKey + : undefined; + let userDelegationKeyCredential; + if (sharedKeyCredential === undefined && accountName !== undefined) { + userDelegationKeyCredential = new UserDelegationKeyCredential_js_1.UserDelegationKeyCredential(accountName, sharedKeyCredentialOrUserDelegationKey); } - static async readArray(stream, readItemMethod, options = {}) { - const items = []; - for (let count = await AvroParser.readLong(stream, options); count !== 0; count = await AvroParser.readLong(stream, options)) { - if (count < 0) { - // Ignore block sizes - await AvroParser.readLong(stream, options); - count = -count; + if (sharedKeyCredential === undefined && userDelegationKeyCredential === undefined) { + throw TypeError("Invalid sharedKeyCredential, userDelegationKey or accountName."); + } + // Version 2020-12-06 adds support for encryptionscope in SAS. + if (version >= "2020-12-06") { + if (sharedKeyCredential !== undefined) { + return generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential); + } + else { + if (version >= "2025-07-05") { + return generateBlobSASQueryParametersUDK20250705(blobSASSignatureValues, userDelegationKeyCredential); } - while (count--) { - const item = await readItemMethod(stream, options); - items.push(item); + else { + return generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential); } } - return items; } -} -exports.AvroParser = AvroParser; -var AvroComplex; -(function (AvroComplex) { - AvroComplex["RECORD"] = "record"; - AvroComplex["ENUM"] = "enum"; - AvroComplex["ARRAY"] = "array"; - AvroComplex["MAP"] = "map"; - AvroComplex["UNION"] = "union"; - AvroComplex["FIXED"] = "fixed"; -})(AvroComplex || (AvroComplex = {})); -var AvroPrimitive; -(function (AvroPrimitive) { - AvroPrimitive["NULL"] = "null"; - AvroPrimitive["BOOLEAN"] = "boolean"; - AvroPrimitive["INT"] = "int"; - AvroPrimitive["LONG"] = "long"; - AvroPrimitive["FLOAT"] = "float"; - AvroPrimitive["DOUBLE"] = "double"; - AvroPrimitive["BYTES"] = "bytes"; - AvroPrimitive["STRING"] = "string"; -})(AvroPrimitive || (AvroPrimitive = {})); -class AvroType { - /** - * Determines the AvroType from the Avro Schema. - */ - // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types - static fromSchema(schema) { - if (typeof schema === "string") { - return AvroType.fromStringSchema(schema); - } - else if (Array.isArray(schema)) { - return AvroType.fromArraySchema(schema); + // Version 2019-12-12 adds support for the blob tags permission. + // Version 2018-11-09 adds support for the signed resource and signed blob snapshot time fields. + // https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string + if (version >= "2018-11-09") { + if (sharedKeyCredential !== undefined) { + return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential); } else { - return AvroType.fromObjectSchema(schema); + // Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId. + if (version >= "2020-02-10") { + return generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential); + } + else { + return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential); + } } } - static fromStringSchema(schema) { - switch (schema) { - case AvroPrimitive.NULL: - case AvroPrimitive.BOOLEAN: - case AvroPrimitive.INT: - case AvroPrimitive.LONG: - case AvroPrimitive.FLOAT: - case AvroPrimitive.DOUBLE: - case AvroPrimitive.BYTES: - case AvroPrimitive.STRING: - return new AvroPrimitiveType(schema); - default: - throw new Error(`Unexpected Avro type ${schema}`); + if (version >= "2015-04-05") { + if (sharedKeyCredential !== undefined) { + return generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential); + } + else { + throw new RangeError("'version' must be >= '2018-11-09' when generating user delegation SAS using user delegation key."); } } - static fromArraySchema(schema) { - return new AvroUnionType(schema.map(AvroType.fromSchema)); + throw new RangeError("'version' must be >= '2015-04-05'."); +} +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2015-04-05 AND BEFORE 2018-11-09. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn and identifier. + * + * WARNING: When identifier is not provided, permissions and expiresOn are required. + * You MUST assign value to identifier or expiresOn & permissions manually if you initial with + * this constructor. + * + * @param blobSASSignatureValues - + * @param sharedKeyCredential - + */ +function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + if (!blobSASSignatureValues.identifier && + !(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); } - static fromObjectSchema(schema) { - const type = schema.type; - // Primitives can be defined as strings or objects - try { - return AvroType.fromStringSchema(type); - } - catch { - // no-op + let resource = "c"; + if (blobSASSignatureValues.blobName) { + resource = "b"; + } + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); } - switch (type) { - case AvroComplex.RECORD: - if (schema.aliases) { - throw new Error(`aliases currently is not supported, schema: ${schema}`); - } - if (!schema.name) { - throw new Error(`Required attribute 'name' doesn't exist on schema: ${schema}`); - } - // eslint-disable-next-line no-case-declarations - const fields = {}; - if (!schema.fields) { - throw new Error(`Required attribute 'fields' doesn't exist on schema: ${schema}`); - } - for (const field of schema.fields) { - fields[field.name] = AvroType.fromSchema(field.type); - } - return new AvroRecordType(fields, schema.name); - case AvroComplex.ENUM: - if (schema.aliases) { - throw new Error(`aliases currently is not supported, schema: ${schema}`); - } - if (!schema.symbols) { - throw new Error(`Required attribute 'symbols' doesn't exist on schema: ${schema}`); - } - return new AvroEnumType(schema.symbols); - case AvroComplex.MAP: - if (!schema.values) { - throw new Error(`Required attribute 'values' doesn't exist on schema: ${schema}`); - } - return new AvroMapType(AvroType.fromSchema(schema.values)); - case AvroComplex.ARRAY: // Unused today - case AvroComplex.FIXED: // Unused today - default: - throw new Error(`Unexpected Avro type ${type} in ${schema}`); + else { + verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); } } + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + blobSASSignatureValues.identifier, + blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", + blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", + blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", + blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "", + blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "", + ].join("\n"); + const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType), + stringToSign: stringToSign, + }; } -exports.AvroType = AvroType; -class AvroPrimitiveType extends AvroType { - _primitive; - constructor(primitive) { - super(); - this._primitive = primitive; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2018-11-09. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn and identifier. + * + * WARNING: When identifier is not provided, permissions and expiresOn are required. + * You MUST assign value to identifier or expiresOn & permissions manually if you initial with + * this constructor. + * + * @param blobSASSignatureValues - + * @param sharedKeyCredential - + */ +function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + if (!blobSASSignatureValues.identifier && + !(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); } - // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types - read(stream, options = {}) { - switch (this._primitive) { - case AvroPrimitive.NULL: - return AvroParser.readNull(); - case AvroPrimitive.BOOLEAN: - return AvroParser.readBoolean(stream, options); - case AvroPrimitive.INT: - return AvroParser.readInt(stream, options); - case AvroPrimitive.LONG: - return AvroParser.readLong(stream, options); - case AvroPrimitive.FLOAT: - return AvroParser.readFloat(stream, options); - case AvroPrimitive.DOUBLE: - return AvroParser.readDouble(stream, options); - case AvroPrimitive.BYTES: - return AvroParser.readBytes(stream, options); - case AvroPrimitive.STRING: - return AvroParser.readString(stream, options); - default: - throw new Error("Unknown Avro Primitive"); + let resource = "c"; + let timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; } } -} -class AvroEnumType extends AvroType { - _symbols; - constructor(symbols) { - super(); - this._symbols = symbols; - } - // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types - async read(stream, options = {}) { - const value = await AvroParser.readInt(stream, options); - return this._symbols[value]; + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } + else { + verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } } + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + blobSASSignatureValues.identifier, + blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", + blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", + blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", + blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "", + blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "", + ].join("\n"); + const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType), + stringToSign: stringToSign, + }; } -class AvroUnionType extends AvroType { - _types; - constructor(types) { - super(); - this._types = types; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-12-06. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn and identifier. + * + * WARNING: When identifier is not provided, permissions and expiresOn are required. + * You MUST assign value to identifier or expiresOn & permissions manually if you initial with + * this constructor. + * + * @param blobSASSignatureValues - + * @param sharedKeyCredential - + */ +function generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + if (!blobSASSignatureValues.identifier && + !(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); } - async read(stream, options = {}) { - const typeIndex = await AvroParser.readInt(stream, options); - return this._types[typeIndex].read(stream, options); + let resource = "c"; + let timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } + } + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } + else { + verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } } + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + blobSASSignatureValues.identifier, + blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.encryptionScope, + blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", + blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", + blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", + blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "", + blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "", + ].join("\n"); + const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, undefined, undefined, undefined, blobSASSignatureValues.encryptionScope), + stringToSign: stringToSign, + }; } -class AvroMapType extends AvroType { - _itemType; - constructor(itemType) { - super(); - this._itemType = itemType; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2018-11-09. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param blobSASSignatureValues - + * @param userDelegationKeyCredential - + */ +function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. + if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); } - // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types - read(stream, options = {}) { - const readItemMethod = (s, opts) => { - return this._itemType.read(s, opts); - }; - return AvroParser.readMap(stream, readItemMethod, options); + let resource = "c"; + let timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } + } + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } + else { + verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } } + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType, + ].join("\n"); + const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey), + stringToSign: stringToSign, + }; } -class AvroRecordType extends AvroType { - _name; - _fields; - constructor(fields, name) { - super(); - this._fields = fields; - this._name = name; +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-02-10. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param blobSASSignatureValues - + * @param userDelegationKeyCredential - + */ +function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. + if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); } - // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types - async read(stream, options = {}) { - // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types - const record = {}; - record["$schema"] = this._name; - for (const key in this._fields) { - if (Object.prototype.hasOwnProperty.call(this._fields, key)) { - record[key] = await this._fields[key].read(stream, options); - } + let resource = "c"; + let timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; } - return record; } -} -//# sourceMappingURL=AvroParser.js.map - -/***/ }), - -/***/ 15192: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AvroReadable = void 0; -class AvroReadable { -} -exports.AvroReadable = AvroReadable; -//# sourceMappingURL=AvroReadable.js.map - -/***/ }), - -/***/ 53027: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AvroReadableFromStream = void 0; -const AvroReadable_js_1 = __nccwpck_require__(15192); -const abort_controller_1 = __nccwpck_require__(1753); -const buffer_1 = __nccwpck_require__(14300); -const ABORT_ERROR = new abort_controller_1.AbortError("Reading from the avro stream was aborted."); -class AvroReadableFromStream extends AvroReadable_js_1.AvroReadable { - _position; - _readable; - toUint8Array(data) { - if (typeof data === "string") { - return buffer_1.Buffer.from(data); + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + } + else { + verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); } - return data; } - constructor(readable) { - super(); - this._readable = readable; - this._position = 0; + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.preauthorizedAgentObjectId, + undefined, // agentObjectId + blobSASSignatureValues.correlationId, + blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType, + ].join("\n"); + const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId), + stringToSign: stringToSign, + }; +} +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-12-06. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param blobSASSignatureValues - + * @param userDelegationKeyCredential - + */ +function generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. + if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); } - get position() { - return this._position; + let resource = "c"; + let timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; + } + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; + } } - async read(size, options = {}) { - if (options.abortSignal?.aborted) { - throw ABORT_ERROR; + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); } - if (size < 0) { - throw new Error(`size parameter should be positive: ${size}`); + else { + verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); } - if (size === 0) { - return new Uint8Array(); + } + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.preauthorizedAgentObjectId, + undefined, // agentObjectId + blobSASSignatureValues.correlationId, + blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.encryptionScope, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType, + ].join("\n"); + const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope), + stringToSign: stringToSign, + }; +} +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * IMPLEMENTATION FOR API VERSION FROM 2020-12-06. + * + * Creates an instance of SASQueryParameters. + * + * Only accepts required settings needed to create a SAS. For optional settings please + * set corresponding properties directly, such as permissions, startsOn. + * + * WARNING: identifier will be ignored, permissions and expiresOn are required. + * + * @param blobSASSignatureValues - + * @param userDelegationKeyCredential - + */ +function generateBlobSASQueryParametersUDK20250705(blobSASSignatureValues, userDelegationKeyCredential) { + blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); + // Stored access policies are not supported for a user delegation SAS. + if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { + throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); + } + let resource = "c"; + let timestamp = blobSASSignatureValues.snapshotTime; + if (blobSASSignatureValues.blobName) { + resource = "b"; + if (blobSASSignatureValues.snapshotTime) { + resource = "bs"; } - if (!this._readable.readable) { - throw new Error("Stream no longer readable."); + else if (blobSASSignatureValues.versionId) { + resource = "bv"; + timestamp = blobSASSignatureValues.versionId; } - // See if there is already enough data. - const chunk = this._readable.read(size); - if (chunk) { - this._position += chunk.length; - // chunk.length maybe less than desired size if the stream ends. - return this.toUint8Array(chunk); + } + // Calling parse and toString guarantees the proper ordering and throws on invalid characters. + let verifiedPermissions; + if (blobSASSignatureValues.permissions) { + if (blobSASSignatureValues.blobName) { + verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); } else { - // register callback to wait for enough data to read - return new Promise((resolve, reject) => { - /* eslint-disable @typescript-eslint/no-use-before-define */ - const cleanUp = () => { - this._readable.removeListener("readable", readableCallback); - this._readable.removeListener("error", rejectCallback); - this._readable.removeListener("end", rejectCallback); - this._readable.removeListener("close", rejectCallback); - if (options.abortSignal) { - options.abortSignal.removeEventListener("abort", abortHandler); - } - }; - const readableCallback = () => { - const callbackChunk = this._readable.read(size); - if (callbackChunk) { - this._position += callbackChunk.length; - cleanUp(); - // callbackChunk.length maybe less than desired size if the stream ends. - resolve(this.toUint8Array(callbackChunk)); - } - }; - const rejectCallback = () => { - cleanUp(); - reject(); - }; - const abortHandler = () => { - cleanUp(); - reject(ABORT_ERROR); - }; - this._readable.on("readable", readableCallback); - this._readable.once("error", rejectCallback); - this._readable.once("end", rejectCallback); - this._readable.once("close", rejectCallback); - if (options.abortSignal) { - options.abortSignal.addEventListener("abort", abortHandler); - } - /* eslint-enable @typescript-eslint/no-use-before-define */ - }); + verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); } } + // Signature is generated on the un-url-encoded values. + const stringToSign = [ + verifiedPermissions ? verifiedPermissions : "", + blobSASSignatureValues.startsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) + : "", + blobSASSignatureValues.expiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) + : "", + getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), + userDelegationKeyCredential.userDelegationKey.signedObjectId, + userDelegationKeyCredential.userDelegationKey.signedTenantId, + userDelegationKeyCredential.userDelegationKey.signedStartsOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedExpiresOn + ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) + : "", + userDelegationKeyCredential.userDelegationKey.signedService, + userDelegationKeyCredential.userDelegationKey.signedVersion, + blobSASSignatureValues.preauthorizedAgentObjectId, + undefined, // agentObjectId + blobSASSignatureValues.correlationId, + undefined, // SignedKeyDelegatedUserTenantId, will be added in a future release. + undefined, // SignedDelegatedUserObjectId, will be added in future release. + blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", + blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", + blobSASSignatureValues.version, + resource, + timestamp, + blobSASSignatureValues.encryptionScope, + blobSASSignatureValues.cacheControl, + blobSASSignatureValues.contentDisposition, + blobSASSignatureValues.contentEncoding, + blobSASSignatureValues.contentLanguage, + blobSASSignatureValues.contentType, + ].join("\n"); + const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); + return { + sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope), + stringToSign: stringToSign, + }; } -exports.AvroReadableFromStream = AvroReadableFromStream; -//# sourceMappingURL=AvroReadableFromStream.js.map - -/***/ }), - -/***/ 64331: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AvroReader = void 0; -// TODO: Do a review of non-interfaces -/* eslint-disable @azure/azure-sdk/ts-use-interface-parameters */ -const AvroConstants_js_1 = __nccwpck_require__(583); -const AvroParser_js_1 = __nccwpck_require__(58119); -const utils_common_js_1 = __nccwpck_require__(32617); -class AvroReader { - _dataStream; - _headerStream; - _syncMarker; - _metadata; - _itemType; - _itemsRemainingInBlock; - // Remembers where we started if partial data stream was provided. - _initialBlockOffset; - /// The byte offset within the Avro file (both header and data) - /// of the start of the current block. - _blockOffset; - get blockOffset() { - return this._blockOffset; +function getCanonicalName(accountName, containerName, blobName) { + // Container: "/blob/account/containerName" + // Blob: "/blob/account/containerName/blobName" + const elements = [`/blob/${accountName}/${containerName}`]; + if (blobName) { + elements.push(`/${blobName}`); } - _objectIndex; - get objectIndex() { - return this._objectIndex; + return elements.join(""); +} +function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) { + const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : constants_js_1.SERVICE_VERSION; + if (blobSASSignatureValues.snapshotTime && version < "2018-11-09") { + throw RangeError("'version' must be >= '2018-11-09' when providing 'snapshotTime'."); } - _initialized; - constructor(dataStream, headerStream, currentBlockOffset, indexWithinCurrentBlock) { - this._dataStream = dataStream; - this._headerStream = headerStream || dataStream; - this._initialized = false; - this._blockOffset = currentBlockOffset || 0; - this._objectIndex = indexWithinCurrentBlock || 0; - this._initialBlockOffset = currentBlockOffset || 0; + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { + throw RangeError("Must provide 'blobName' when providing 'snapshotTime'."); } - async initialize(options = {}) { - const header = await AvroParser_js_1.AvroParser.readFixedBytes(this._headerStream, AvroConstants_js_1.AVRO_INIT_BYTES.length, { - abortSignal: options.abortSignal, - }); - if (!(0, utils_common_js_1.arraysEqual)(header, AvroConstants_js_1.AVRO_INIT_BYTES)) { - throw new Error("Stream is not an Avro file."); - } - // File metadata is written as if defined by the following map schema: - // { "type": "map", "values": "bytes"} - this._metadata = await AvroParser_js_1.AvroParser.readMap(this._headerStream, AvroParser_js_1.AvroParser.readString, { - abortSignal: options.abortSignal, - }); - // Validate codec - const codec = this._metadata[AvroConstants_js_1.AVRO_CODEC_KEY]; - if (!(codec === undefined || codec === null || codec === "null")) { - throw new Error("Codecs are not supported"); - } - // The 16-byte, randomly-generated sync marker for this file. - this._syncMarker = await AvroParser_js_1.AvroParser.readFixedBytes(this._headerStream, AvroConstants_js_1.AVRO_SYNC_MARKER_SIZE, { - abortSignal: options.abortSignal, - }); - // Parse the schema - const schema = JSON.parse(this._metadata[AvroConstants_js_1.AVRO_SCHEMA_KEY]); - this._itemType = AvroParser_js_1.AvroType.fromSchema(schema); - if (this._blockOffset === 0) { - this._blockOffset = this._initialBlockOffset + this._dataStream.position; - } - this._itemsRemainingInBlock = await AvroParser_js_1.AvroParser.readLong(this._dataStream, { - abortSignal: options.abortSignal, - }); - // skip block length - await AvroParser_js_1.AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal }); - this._initialized = true; - if (this._objectIndex && this._objectIndex > 0) { - for (let i = 0; i < this._objectIndex; i++) { - await this._itemType.read(this._dataStream, { abortSignal: options.abortSignal }); - this._itemsRemainingInBlock--; - } - } + if (blobSASSignatureValues.versionId && version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'versionId'."); } - hasNext() { - return !this._initialized || this._itemsRemainingInBlock > 0; + if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) { + throw RangeError("Must provide 'blobName' when providing 'versionId'."); } - async *parseObjects(options = {}) { - if (!this._initialized) { - await this.initialize(options); - } - while (this.hasNext()) { - const result = await this._itemType.read(this._dataStream, { - abortSignal: options.abortSignal, - }); - this._itemsRemainingInBlock--; - this._objectIndex++; - if (this._itemsRemainingInBlock === 0) { - const marker = await AvroParser_js_1.AvroParser.readFixedBytes(this._dataStream, AvroConstants_js_1.AVRO_SYNC_MARKER_SIZE, { - abortSignal: options.abortSignal, - }); - this._blockOffset = this._initialBlockOffset + this._dataStream.position; - this._objectIndex = 0; - if (!(0, utils_common_js_1.arraysEqual)(this._syncMarker, marker)) { - throw new Error("Stream is not a valid Avro file."); - } - try { - this._itemsRemainingInBlock = await AvroParser_js_1.AvroParser.readLong(this._dataStream, { - abortSignal: options.abortSignal, - }); - } - catch { - // We hit the end of the stream. - this._itemsRemainingInBlock = 0; - } - if (this._itemsRemainingInBlock > 0) { - // Ignore block size - await AvroParser_js_1.AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal }); - } - } - yield result; - } + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.setImmutabilityPolicy && + version < "2020-08-04") { + throw RangeError("'version' must be >= '2020-08-04' when provided 'i' permission."); } -} -exports.AvroReader = AvroReader; -//# sourceMappingURL=AvroReader.js.map - -/***/ }), - -/***/ 94382: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AvroReadableFromStream = exports.AvroReadable = exports.AvroReader = void 0; -var AvroReader_js_1 = __nccwpck_require__(64331); -Object.defineProperty(exports, "AvroReader", ({ enumerable: true, get: function () { return AvroReader_js_1.AvroReader; } })); -var AvroReadable_js_1 = __nccwpck_require__(15192); -Object.defineProperty(exports, "AvroReadable", ({ enumerable: true, get: function () { return AvroReadable_js_1.AvroReadable; } })); -var AvroReadableFromStream_js_1 = __nccwpck_require__(53027); -Object.defineProperty(exports, "AvroReadableFromStream", ({ enumerable: true, get: function () { return AvroReadableFromStream_js_1.AvroReadableFromStream; } })); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ 32617: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.arraysEqual = arraysEqual; -function arraysEqual(a, b) { - if (a === b) - return true; - if (a == null || b == null) - return false; - if (a.length !== b.length) - return false; - for (let i = 0; i < a.length; ++i) { - if (a[i] !== b[i]) - return false; + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.deleteVersion && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission."); + } + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.permanentDelete && + version < "2019-10-10") { + throw RangeError("'version' must be >= '2019-10-10' when providing 'y' permission."); + } + if (blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.tag && + version < "2019-12-12") { + throw RangeError("'version' must be >= '2019-12-12' when providing 't' permission."); + } + if (version < "2020-02-10" && + blobSASSignatureValues.permissions && + (blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) { + throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission."); } - return true; + if (version < "2021-04-10" && + blobSASSignatureValues.permissions && + blobSASSignatureValues.permissions.filterByTags) { + throw RangeError("'version' must be >= '2021-04-10' when providing the 'f' permission."); + } + if (version < "2020-02-10" && + (blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) { + throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'."); + } + if (blobSASSignatureValues.encryptionScope && version < "2020-12-06") { + throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS."); + } + blobSASSignatureValues.version = version; + return blobSASSignatureValues; } -//# sourceMappingURL=utils.common.js.map - -/***/ }), - -/***/ 53282: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.logger = void 0; -const logger_1 = __nccwpck_require__(89497); -/** - * The `@azure/logger` configuration for this package. - */ -exports.logger = (0, logger_1.createClientLogger)("storage-blob"); -//# sourceMappingURL=log.js.map +//# sourceMappingURL=BlobSASSignatureValues.js.map /***/ }), -/***/ 64526: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 27579: +/***/ ((__unused_webpack_module, exports) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageBlobAudience = exports.PremiumPageBlobTier = exports.BlockBlobTier = void 0; -exports.toAccessTier = toAccessTier; -exports.ensureCpkIfSpecified = ensureCpkIfSpecified; -exports.getBlobServiceAccountAudience = getBlobServiceAccountAudience; -const constants_js_1 = __nccwpck_require__(81865); -/** - * Represents the access tier on a blob. - * For detailed information about block blob level tiering see {@link https://learn.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers|Hot, cool and archive storage tiers.} - */ -var BlockBlobTier; -(function (BlockBlobTier) { - /** - * Optimized for storing data that is accessed frequently. - */ - BlockBlobTier["Hot"] = "Hot"; - /** - * Optimized for storing data that is infrequently accessed and stored for at least 30 days. - */ - BlockBlobTier["Cool"] = "Cool"; - /** - * Optimized for storing data that is rarely accessed. - */ - BlockBlobTier["Cold"] = "Cold"; - /** - * Optimized for storing data that is rarely accessed and stored for at least 180 days - * with flexible latency requirements (on the order of hours). - */ - BlockBlobTier["Archive"] = "Archive"; -})(BlockBlobTier || (exports.BlockBlobTier = BlockBlobTier = {})); +exports.ContainerSASPermissions = void 0; /** - * Specifies the page blob tier to set the blob to. This is only applicable to page blobs on premium storage accounts. - * Please see {@link https://learn.microsoft.com/azure/storage/storage-premium-storage#scalability-and-performance-targets|here} - * for detailed information on the corresponding IOPS and throughput per PageBlobTier. + * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a container. + * Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation. + * Once all the values are set, this should be serialized with toString and set as the permissions field on a + * {@link BlobSASSignatureValues} object. It is possible to construct the permissions string without this class, but + * the order of the permissions is particular and this class guarantees correctness. */ -var PremiumPageBlobTier; -(function (PremiumPageBlobTier) { +class ContainerSASPermissions { /** - * P4 Tier. + * Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an + * Error if it encounters a character that does not correspond to a valid permission. + * + * @param permissions - */ - PremiumPageBlobTier["P4"] = "P4"; + static parse(permissions) { + const containerSASPermissions = new ContainerSASPermissions(); + for (const char of permissions) { + switch (char) { + case "r": + containerSASPermissions.read = true; + break; + case "a": + containerSASPermissions.add = true; + break; + case "c": + containerSASPermissions.create = true; + break; + case "w": + containerSASPermissions.write = true; + break; + case "d": + containerSASPermissions.delete = true; + break; + case "l": + containerSASPermissions.list = true; + break; + case "t": + containerSASPermissions.tag = true; + break; + case "x": + containerSASPermissions.deleteVersion = true; + break; + case "m": + containerSASPermissions.move = true; + break; + case "e": + containerSASPermissions.execute = true; + break; + case "i": + containerSASPermissions.setImmutabilityPolicy = true; + break; + case "y": + containerSASPermissions.permanentDelete = true; + break; + case "f": + containerSASPermissions.filterByTags = true; + break; + default: + throw new RangeError(`Invalid permission ${char}`); + } + } + return containerSASPermissions; + } /** - * P6 Tier. + * Creates a {@link ContainerSASPermissions} from a raw object which contains same keys as it + * and boolean values for them. + * + * @param permissionLike - */ - PremiumPageBlobTier["P6"] = "P6"; + static from(permissionLike) { + const containerSASPermissions = new ContainerSASPermissions(); + if (permissionLike.read) { + containerSASPermissions.read = true; + } + if (permissionLike.add) { + containerSASPermissions.add = true; + } + if (permissionLike.create) { + containerSASPermissions.create = true; + } + if (permissionLike.write) { + containerSASPermissions.write = true; + } + if (permissionLike.delete) { + containerSASPermissions.delete = true; + } + if (permissionLike.list) { + containerSASPermissions.list = true; + } + if (permissionLike.deleteVersion) { + containerSASPermissions.deleteVersion = true; + } + if (permissionLike.tag) { + containerSASPermissions.tag = true; + } + if (permissionLike.move) { + containerSASPermissions.move = true; + } + if (permissionLike.execute) { + containerSASPermissions.execute = true; + } + if (permissionLike.setImmutabilityPolicy) { + containerSASPermissions.setImmutabilityPolicy = true; + } + if (permissionLike.permanentDelete) { + containerSASPermissions.permanentDelete = true; + } + if (permissionLike.filterByTags) { + containerSASPermissions.filterByTags = true; + } + return containerSASPermissions; + } /** - * P10 Tier. + * Specifies Read access granted. */ - PremiumPageBlobTier["P10"] = "P10"; + read = false; /** - * P15 Tier. + * Specifies Add access granted. */ - PremiumPageBlobTier["P15"] = "P15"; + add = false; /** - * P20 Tier. + * Specifies Create access granted. */ - PremiumPageBlobTier["P20"] = "P20"; + create = false; /** - * P30 Tier. + * Specifies Write access granted. */ - PremiumPageBlobTier["P30"] = "P30"; + write = false; /** - * P40 Tier. + * Specifies Delete access granted. */ - PremiumPageBlobTier["P40"] = "P40"; + delete = false; /** - * P50 Tier. + * Specifies Delete version access granted. */ - PremiumPageBlobTier["P50"] = "P50"; + deleteVersion = false; /** - * P60 Tier. + * Specifies List access granted. */ - PremiumPageBlobTier["P60"] = "P60"; + list = false; /** - * P70 Tier. + * Specfies Tag access granted. */ - PremiumPageBlobTier["P70"] = "P70"; + tag = false; /** - * P80 Tier. + * Specifies Move access granted. */ - PremiumPageBlobTier["P80"] = "P80"; -})(PremiumPageBlobTier || (exports.PremiumPageBlobTier = PremiumPageBlobTier = {})); -function toAccessTier(tier) { - if (tier === undefined) { - return undefined; - } - return tier; // No more check if string is a valid AccessTier, and left this to underlay logic to decide(service). -} -function ensureCpkIfSpecified(cpk, isHttps) { - if (cpk && !isHttps) { - throw new RangeError("Customer-provided encryption key must be used over HTTPS."); - } - if (cpk && !cpk.encryptionAlgorithm) { - cpk.encryptionAlgorithm = constants_js_1.EncryptionAlgorithmAES25; - } -} -/** - * Defines the known cloud audiences for Storage. - */ -var StorageBlobAudience; -(function (StorageBlobAudience) { + move = false; /** - * The OAuth scope to use to retrieve an AAD token for Azure Storage. + * Specifies Execute access granted. */ - StorageBlobAudience["StorageOAuthScopes"] = "https://storage.azure.com/.default"; + execute = false; /** - * The OAuth scope to use to retrieve an AAD token for Azure Disk. + * Specifies SetImmutabilityPolicy access granted. */ - StorageBlobAudience["DiskComputeOAuthScopes"] = "https://disk.compute.azure.com/.default"; -})(StorageBlobAudience || (exports.StorageBlobAudience = StorageBlobAudience = {})); -/** - * - * To get OAuth audience for a storage account for blob service. - */ -function getBlobServiceAccountAudience(storageAccountName) { - return `https://${storageAccountName}.blob.core.windows.net/.default`; -} -//# sourceMappingURL=models.js.map - -/***/ }), - -/***/ 51870: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AnonymousCredentialPolicy = void 0; -const CredentialPolicy_js_1 = __nccwpck_require__(15513); -/** - * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources - * or for use with Shared Access Signatures (SAS). - */ -class AnonymousCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { + setImmutabilityPolicy = false; /** - * Creates an instance of AnonymousCredentialPolicy. - * @param nextPolicy - - * @param options - + * Specifies that Permanent Delete is permitted. */ - // The base class has a protected constructor. Adding a public one to enable constructing of this class. - /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ - constructor(nextPolicy, options) { - super(nextPolicy, options); - } -} -exports.AnonymousCredentialPolicy = AnonymousCredentialPolicy; -//# sourceMappingURL=AnonymousCredentialPolicy.js.map - -/***/ }), - -/***/ 15513: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.CredentialPolicy = void 0; -const RequestPolicy_js_1 = __nccwpck_require__(33847); -/** - * Credential policy used to sign HTTP(S) requests before sending. This is an - * abstract class. - */ -class CredentialPolicy extends RequestPolicy_js_1.BaseRequestPolicy { + permanentDelete = false; /** - * Sends out request. - * - * @param request - + * Specifies that Filter Blobs by Tags is permitted. */ - sendRequest(request) { - return this._nextPolicy.sendRequest(this.signRequest(request)); - } + filterByTags = false; /** - * Child classes must implement this method with request signing. This method - * will be executed in {@link sendRequest}. + * Converts the given permissions to a string. Using this method will guarantee the permissions are in an + * order accepted by the service. * - * @param request - - */ - signRequest(request) { - // Child classes must override this method with request signing. This method - // will be executed in sendRequest(). - return request; - } -} -exports.CredentialPolicy = CredentialPolicy; -//# sourceMappingURL=CredentialPolicy.js.map - -/***/ }), - -/***/ 33847: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BaseRequestPolicy = void 0; -/** - * The base class from which all request policies derive. - */ -class BaseRequestPolicy { - _nextPolicy; - _options; - /** - * The main method to implement that manipulates a request/response. - */ - constructor( - /** - * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline. - */ - _nextPolicy, - /** - * The options that can be passed to a given request policy. - */ - _options) { - this._nextPolicy = _nextPolicy; - this._options = _options; - } - /** - * Get whether or not a log with the provided log level should be logged. - * @param logLevel - The log level of the log that will be logged. - * @returns Whether or not a log with the provided log level should be logged. - */ - shouldLog(logLevel) { - return this._options.shouldLog(logLevel); - } - /** - * Attempt to log the provided message to the provided logger. If no logger was provided or if - * the log level does not meat the logger's threshold, then nothing will be logged. - * @param logLevel - The log level of this log. - * @param message - The message of this log. - */ - log(logLevel, message) { - this._options.log(logLevel, message); - } -} -exports.BaseRequestPolicy = BaseRequestPolicy; -//# sourceMappingURL=RequestPolicy.js.map - -/***/ }), - -/***/ 6602: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageBrowserPolicy = void 0; -const RequestPolicy_js_1 = __nccwpck_require__(33847); -const core_util_1 = __nccwpck_require__(80637); -const constants_js_1 = __nccwpck_require__(81865); -const utils_common_js_1 = __nccwpck_require__(16673); -/** - * StorageBrowserPolicy will handle differences between Node.js and browser runtime, including: - * - * 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'. - * StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL - * thus avoid the browser cache. - * - * 2. Remove cookie header for security - * - * 3. Remove content-length header to avoid browsers warning - */ -class StorageBrowserPolicy extends RequestPolicy_js_1.BaseRequestPolicy { - /** - * Creates an instance of StorageBrowserPolicy. - * @param nextPolicy - - * @param options - - */ - // The base class has a protected constructor. Adding a public one to enable constructing of this class. - /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ - constructor(nextPolicy, options) { - super(nextPolicy, options); - } - /** - * Sends out request. + * The order of the characters should be as specified here to ensure correctness. + * @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas * - * @param request - */ - async sendRequest(request) { - if (core_util_1.isNodeLike) { - return this._nextPolicy.sendRequest(request); + toString() { + const permissions = []; + if (this.read) { + permissions.push("r"); } - if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") { - request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); + if (this.add) { + permissions.push("a"); } - request.headers.remove(constants_js_1.HeaderConstants.COOKIE); - // According to XHR standards, content-length should be fully controlled by browsers - request.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return this._nextPolicy.sendRequest(request); - } -} -exports.StorageBrowserPolicy = StorageBrowserPolicy; -//# sourceMappingURL=StorageBrowserPolicy.js.map - -/***/ }), - -/***/ 29090: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageBrowserPolicyName = void 0; -exports.storageBrowserPolicy = storageBrowserPolicy; -const core_util_1 = __nccwpck_require__(80637); -const constants_js_1 = __nccwpck_require__(81865); -const utils_common_js_1 = __nccwpck_require__(16673); -/** - * The programmatic identifier of the StorageBrowserPolicy. - */ -exports.storageBrowserPolicyName = "storageBrowserPolicy"; -/** - * storageBrowserPolicy is a policy used to prevent browsers from caching requests - * and to remove cookies and explicit content-length headers. - */ -function storageBrowserPolicy() { - return { - name: exports.storageBrowserPolicyName, - async sendRequest(request, next) { - if (core_util_1.isNodeLike) { - return next(request); - } - if (request.method === "GET" || request.method === "HEAD") { - request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); - } - request.headers.delete(constants_js_1.HeaderConstants.COOKIE); - // According to XHR standards, content-length should be fully controlled by browsers - request.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return next(request); - }, - }; -} -//# sourceMappingURL=StorageBrowserPolicyV2.js.map - -/***/ }), - -/***/ 73623: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageCorrectContentLengthPolicyName = void 0; -exports.storageCorrectContentLengthPolicy = storageCorrectContentLengthPolicy; -const constants_js_1 = __nccwpck_require__(81865); -/** - * The programmatic identifier of the storageCorrectContentLengthPolicy. - */ -exports.storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy"; -/** - * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length. - */ -function storageCorrectContentLengthPolicy() { - function correctContentLength(request) { - if (request.body && - (typeof request.body === "string" || Buffer.isBuffer(request.body)) && - request.body.length > 0) { - request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + if (this.create) { + permissions.push("c"); + } + if (this.write) { + permissions.push("w"); + } + if (this.delete) { + permissions.push("d"); + } + if (this.deleteVersion) { + permissions.push("x"); + } + if (this.list) { + permissions.push("l"); + } + if (this.tag) { + permissions.push("t"); + } + if (this.move) { + permissions.push("m"); + } + if (this.execute) { + permissions.push("e"); + } + if (this.setImmutabilityPolicy) { + permissions.push("i"); + } + if (this.permanentDelete) { + permissions.push("y"); + } + if (this.filterByTags) { + permissions.push("f"); } + return permissions.join(""); } - return { - name: exports.storageCorrectContentLengthPolicyName, - async sendRequest(request, next) { - correctContentLength(request); - return next(request); - }, - }; } -//# sourceMappingURL=StorageCorrectContentLengthPolicy.js.map +exports.ContainerSASPermissions = ContainerSASPermissions; +//# sourceMappingURL=ContainerSASPermissions.js.map /***/ }), -/***/ 34419: +/***/ 21969: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -117673,230 +110793,361 @@ function storageCorrectContentLengthPolicy() { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageRetryPolicy = void 0; -exports.NewRetryPolicyFactory = NewRetryPolicyFactory; -const abort_controller_1 = __nccwpck_require__(1753); -const RequestPolicy_js_1 = __nccwpck_require__(33847); -const constants_js_1 = __nccwpck_require__(81865); +exports.SASQueryParameters = exports.SASProtocol = void 0; +const SasIPRange_js_1 = __nccwpck_require__(80914); const utils_common_js_1 = __nccwpck_require__(16673); -const log_js_1 = __nccwpck_require__(53282); -const StorageRetryPolicyType_js_1 = __nccwpck_require__(51772); /** - * A factory method used to generated a RetryPolicy factory. - * - * @param retryOptions - + * Protocols for generated SAS. */ -function NewRetryPolicyFactory(retryOptions) { - return { - create: (nextPolicy, options) => { - return new StorageRetryPolicy(nextPolicy, options, retryOptions); - }, - }; -} -// Default values of StorageRetryOptions -const DEFAULT_RETRY_OPTIONS = { - maxRetryDelayInMs: 120 * 1000, - maxTries: 4, - retryDelayInMs: 4 * 1000, - retryPolicyType: StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL, - secondaryHost: "", - tryTimeoutInMs: undefined, // Use server side default timeout strategy -}; -const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); +var SASProtocol; +(function (SASProtocol) { + /** + * Protocol that allows HTTPS only + */ + SASProtocol["Https"] = "https"; + /** + * Protocol that allows both HTTPS and HTTP + */ + SASProtocol["HttpsAndHttp"] = "https,http"; +})(SASProtocol || (exports.SASProtocol = SASProtocol = {})); /** - * Retry policy with exponential retry and linear retry implemented. + * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly + * by the user; it is only generated by the {@link AccountSASSignatureValues} and {@link BlobSASSignatureValues} + * types. Once generated, it can be encoded into a {@link String} and appended to a URL directly (though caution should + * be taken here in case there are existing query parameters, which might affect the appropriate means of appending + * these query parameters). + * + * NOTE: Instances of this class are immutable. */ -class StorageRetryPolicy extends RequestPolicy_js_1.BaseRequestPolicy { +class SASQueryParameters { /** - * RetryOptions. + * The storage API version. */ - retryOptions; + version; /** - * Creates an instance of RetryPolicy. - * - * @param nextPolicy - - * @param options - - * @param retryOptions - + * Optional. The allowed HTTP protocol(s). */ - constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) { - super(nextPolicy, options); - // Initialize retry options - this.retryOptions = { - retryPolicyType: retryOptions.retryPolicyType - ? retryOptions.retryPolicyType - : DEFAULT_RETRY_OPTIONS.retryPolicyType, - maxTries: retryOptions.maxTries && retryOptions.maxTries >= 1 - ? Math.floor(retryOptions.maxTries) - : DEFAULT_RETRY_OPTIONS.maxTries, - tryTimeoutInMs: retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0 - ? retryOptions.tryTimeoutInMs - : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs, - retryDelayInMs: retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0 - ? Math.min(retryOptions.retryDelayInMs, retryOptions.maxRetryDelayInMs - ? retryOptions.maxRetryDelayInMs - : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs) - : DEFAULT_RETRY_OPTIONS.retryDelayInMs, - maxRetryDelayInMs: retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0 - ? retryOptions.maxRetryDelayInMs - : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs, - secondaryHost: retryOptions.secondaryHost - ? retryOptions.secondaryHost - : DEFAULT_RETRY_OPTIONS.secondaryHost, - }; - } + protocol; /** - * Sends request. + * Optional. The start time for this SAS token. + */ + startsOn; + /** + * Optional only when identifier is provided. The expiry time for this SAS token. + */ + expiresOn; + /** + * Optional only when identifier is provided. + * Please refer to {@link AccountSASPermissions}, {@link BlobSASPermissions}, or {@link ContainerSASPermissions} for + * more details. + */ + permissions; + /** + * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASServices} + * for more details. + */ + services; + /** + * Optional. The storage resource types being accessed (only for Account SAS). Please refer to + * {@link AccountSASResourceTypes} for more details. + */ + resourceTypes; + /** + * Optional. The signed identifier (only for {@link BlobSASSignatureValues}). * - * @param request - + * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy */ - async sendRequest(request) { - return this.attemptSendRequest(request, false, 1); - } + identifier; /** - * Decide and perform next retry. Won't mutate request parameter. + * Optional. Encryption scope to use when sending requests authorized with this SAS URI. + */ + encryptionScope; + /** + * Optional. Specifies which resources are accessible via the SAS (only for {@link BlobSASSignatureValues}). + * @see https://learn.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only + */ + resource; + /** + * The signature for the SAS token. + */ + signature; + /** + * Value for cache-control header in Blob/File Service SAS. + */ + cacheControl; + /** + * Value for content-disposition header in Blob/File Service SAS. + */ + contentDisposition; + /** + * Value for content-encoding header in Blob/File Service SAS. + */ + contentEncoding; + /** + * Value for content-length header in Blob/File Service SAS. + */ + contentLanguage; + /** + * Value for content-type header in Blob/File Service SAS. + */ + contentType; + /** + * Inner value of getter ipRange. + */ + ipRangeInner; + /** + * The Azure Active Directory object ID in GUID format. + * Property of user delegation key. + */ + signedOid; + /** + * The Azure Active Directory tenant ID in GUID format. + * Property of user delegation key. + */ + signedTenantId; + /** + * The date-time the key is active. + * Property of user delegation key. + */ + signedStartsOn; + /** + * The date-time the key expires. + * Property of user delegation key. + */ + signedExpiresOn; + /** + * Abbreviation of the Azure Storage service that accepts the user delegation key. + * Property of user delegation key. + */ + signedService; + /** + * The service version that created the user delegation key. + * Property of user delegation key. + */ + signedVersion; + /** + * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key + * to perform the action granted by the SAS. The Azure Storage service will ensure that the owner of the user delegation key + * has the required permissions before granting access but no additional permission check for the user specified in + * this value will be performed. This is only used for User Delegation SAS. + */ + preauthorizedAgentObjectId; + /** + * A GUID value that will be logged in the storage diagnostic logs and can be used to correlate SAS generation with storage resource access. + * This is only used for User Delegation SAS. + */ + correlationId; + /** + * Optional. IP range allowed for this SAS. * - * @param request - - * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then - * the resource was not found. This may be due to replication delay. So, in this - * case, we'll never try the secondary again for this operation. - * @param attempt - How many retries has been attempted to performed, starting from 1, which includes - * the attempt will be performed by this method call. + * @readonly */ - async attemptSendRequest(request, secondaryHas404, attempt) { - const newRequest = request.clone(); - const isPrimaryRetry = secondaryHas404 || - !this.retryOptions.secondaryHost || - !(request.method === "GET" || request.method === "HEAD" || request.method === "OPTIONS") || - attempt % 2 === 1; - if (!isPrimaryRetry) { - newRequest.url = (0, utils_common_js_1.setURLHost)(newRequest.url, this.retryOptions.secondaryHost); - } - // Set the server-side timeout query parameter "timeout=[seconds]" - if (this.retryOptions.tryTimeoutInMs) { - newRequest.url = (0, utils_common_js_1.setURLParameter)(newRequest.url, constants_js_1.URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString()); + get ipRange() { + if (this.ipRangeInner) { + return { + end: this.ipRangeInner.end, + start: this.ipRangeInner.start, + }; } - let response; - try { - log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); - response = await this._nextPolicy.sendRequest(newRequest); - if (!this.shouldRetry(isPrimaryRetry, attempt, response)) { - return response; + return undefined; + } + constructor(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId, encryptionScope) { + this.version = version; + this.signature = signature; + if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") { + // SASQueryParametersOptions + this.permissions = permissionsOrOptions.permissions; + this.services = permissionsOrOptions.services; + this.resourceTypes = permissionsOrOptions.resourceTypes; + this.protocol = permissionsOrOptions.protocol; + this.startsOn = permissionsOrOptions.startsOn; + this.expiresOn = permissionsOrOptions.expiresOn; + this.ipRangeInner = permissionsOrOptions.ipRange; + this.identifier = permissionsOrOptions.identifier; + this.encryptionScope = permissionsOrOptions.encryptionScope; + this.resource = permissionsOrOptions.resource; + this.cacheControl = permissionsOrOptions.cacheControl; + this.contentDisposition = permissionsOrOptions.contentDisposition; + this.contentEncoding = permissionsOrOptions.contentEncoding; + this.contentLanguage = permissionsOrOptions.contentLanguage; + this.contentType = permissionsOrOptions.contentType; + if (permissionsOrOptions.userDelegationKey) { + this.signedOid = permissionsOrOptions.userDelegationKey.signedObjectId; + this.signedTenantId = permissionsOrOptions.userDelegationKey.signedTenantId; + this.signedStartsOn = permissionsOrOptions.userDelegationKey.signedStartsOn; + this.signedExpiresOn = permissionsOrOptions.userDelegationKey.signedExpiresOn; + this.signedService = permissionsOrOptions.userDelegationKey.signedService; + this.signedVersion = permissionsOrOptions.userDelegationKey.signedVersion; + this.preauthorizedAgentObjectId = permissionsOrOptions.preauthorizedAgentObjectId; + this.correlationId = permissionsOrOptions.correlationId; } - secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); } - catch (err) { - log_js_1.logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`); - if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) { - throw err; + else { + this.services = services; + this.resourceTypes = resourceTypes; + this.expiresOn = expiresOn; + this.permissions = permissionsOrOptions; + this.protocol = protocol; + this.startsOn = startsOn; + this.ipRangeInner = ipRange; + this.encryptionScope = encryptionScope; + this.identifier = identifier; + this.resource = resource; + this.cacheControl = cacheControl; + this.contentDisposition = contentDisposition; + this.contentEncoding = contentEncoding; + this.contentLanguage = contentLanguage; + this.contentType = contentType; + if (userDelegationKey) { + this.signedOid = userDelegationKey.signedObjectId; + this.signedTenantId = userDelegationKey.signedTenantId; + this.signedStartsOn = userDelegationKey.signedStartsOn; + this.signedExpiresOn = userDelegationKey.signedExpiresOn; + this.signedService = userDelegationKey.signedService; + this.signedVersion = userDelegationKey.signedVersion; + this.preauthorizedAgentObjectId = preauthorizedAgentObjectId; + this.correlationId = correlationId; } } - await this.delay(isPrimaryRetry, attempt, request.abortSignal); - return this.attemptSendRequest(request, secondaryHas404, ++attempt); } /** - * Decide whether to retry according to last HTTP response and retry counters. + * Encodes all SAS query parameters into a string that can be appended to a URL. * - * @param isPrimaryRetry - - * @param attempt - - * @param response - - * @param err - */ - shouldRetry(isPrimaryRetry, attempt, response, err) { - if (attempt >= this.retryOptions.maxTries) { - log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions - .maxTries}, no further try.`); - return false; - } - // Handle network failures, you may need to customize the list when you implement - // your own http client - const retriableErrors = [ - "ETIMEDOUT", - "ESOCKETTIMEDOUT", - "ECONNREFUSED", - "ECONNRESET", - "ENOENT", - "ENOTFOUND", - "TIMEOUT", - "EPIPE", - "REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js + toString() { + const params = [ + "sv", + "ss", + "srt", + "spr", + "st", + "se", + "sip", + "si", + "ses", + "skoid", // Signed object ID + "sktid", // Signed tenant ID + "skt", // Signed key start time + "ske", // Signed key expiry time + "sks", // Signed key service + "skv", // Signed key version + "sr", + "sp", + "sig", + "rscc", + "rscd", + "rsce", + "rscl", + "rsct", + "saoid", + "scid", ]; - if (err) { - for (const retriableError of retriableErrors) { - if (err.name.toUpperCase().includes(retriableError) || - err.message.toUpperCase().includes(retriableError) || - (err.code && err.code.toString().toUpperCase() === retriableError)) { - log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); - return true; - } - } - } - // If attempt was against the secondary & it returned a StatusNotFound (404), then - // the resource was not found. This may be due to replication delay. So, in this - // case, we'll never try the secondary again for this operation. - if (response || err) { - const statusCode = response ? response.status : err ? err.statusCode : 0; - if (!isPrimaryRetry && statusCode === 404) { - log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); - return true; - } - // Server internal error or server timeout - if (statusCode === 503 || statusCode === 500) { - log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); - return true; - } - } - if (response) { - // Retry select Copy Source Error Codes. - if (response?.status >= 400) { - const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); - if (copySourceError !== undefined) { - switch (copySourceError) { - case "InternalError": - case "OperationTimedOut": - case "ServerBusy": - return true; - } - } + const queries = []; + for (const param of params) { + switch (param) { + case "sv": + this.tryAppendQueryParameter(queries, param, this.version); + break; + case "ss": + this.tryAppendQueryParameter(queries, param, this.services); + break; + case "srt": + this.tryAppendQueryParameter(queries, param, this.resourceTypes); + break; + case "spr": + this.tryAppendQueryParameter(queries, param, this.protocol); + break; + case "st": + this.tryAppendQueryParameter(queries, param, this.startsOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.startsOn, false) : undefined); + break; + case "se": + this.tryAppendQueryParameter(queries, param, this.expiresOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.expiresOn, false) : undefined); + break; + case "sip": + this.tryAppendQueryParameter(queries, param, this.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(this.ipRange) : undefined); + break; + case "si": + this.tryAppendQueryParameter(queries, param, this.identifier); + break; + case "ses": + this.tryAppendQueryParameter(queries, param, this.encryptionScope); + break; + case "skoid": // Signed object ID + this.tryAppendQueryParameter(queries, param, this.signedOid); + break; + case "sktid": // Signed tenant ID + this.tryAppendQueryParameter(queries, param, this.signedTenantId); + break; + case "skt": // Signed key start time + this.tryAppendQueryParameter(queries, param, this.signedStartsOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.signedStartsOn, false) : undefined); + break; + case "ske": // Signed key expiry time + this.tryAppendQueryParameter(queries, param, this.signedExpiresOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.signedExpiresOn, false) : undefined); + break; + case "sks": // Signed key service + this.tryAppendQueryParameter(queries, param, this.signedService); + break; + case "skv": // Signed key version + this.tryAppendQueryParameter(queries, param, this.signedVersion); + break; + case "sr": + this.tryAppendQueryParameter(queries, param, this.resource); + break; + case "sp": + this.tryAppendQueryParameter(queries, param, this.permissions); + break; + case "sig": + this.tryAppendQueryParameter(queries, param, this.signature); + break; + case "rscc": + this.tryAppendQueryParameter(queries, param, this.cacheControl); + break; + case "rscd": + this.tryAppendQueryParameter(queries, param, this.contentDisposition); + break; + case "rsce": + this.tryAppendQueryParameter(queries, param, this.contentEncoding); + break; + case "rscl": + this.tryAppendQueryParameter(queries, param, this.contentLanguage); + break; + case "rsct": + this.tryAppendQueryParameter(queries, param, this.contentType); + break; + case "saoid": + this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId); + break; + case "scid": + this.tryAppendQueryParameter(queries, param, this.correlationId); + break; } } - if (err?.code === "PARSE_ERROR" && err?.message.startsWith(`Error "Error: Unclosed root tag`)) { - log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); - return true; - } - return false; + return queries.join("&"); } /** - * Delay a calculated time between retries. + * A private helper method used to filter and append query key/value pairs into an array. * - * @param isPrimaryRetry - - * @param attempt - - * @param abortSignal - + * @param queries - + * @param key - + * @param value - */ - async delay(isPrimaryRetry, attempt, abortSignal) { - let delayTimeInMs = 0; - if (isPrimaryRetry) { - switch (this.retryOptions.retryPolicyType) { - case StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL: - delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs, this.retryOptions.maxRetryDelayInMs); - break; - case StorageRetryPolicyType_js_1.StorageRetryPolicyType.FIXED: - delayTimeInMs = this.retryOptions.retryDelayInMs; - break; - } + tryAppendQueryParameter(queries, key, value) { + if (!value) { + return; } - else { - delayTimeInMs = Math.random() * 1000; + key = encodeURIComponent(key); + value = encodeURIComponent(value); + if (key.length > 0 && value.length > 0) { + queries.push(`${key}=${value}`); } - log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); - return (0, utils_common_js_1.delay)(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR); } } -exports.StorageRetryPolicy = StorageRetryPolicy; -//# sourceMappingURL=StorageRetryPolicy.js.map +exports.SASQueryParameters = SASQueryParameters; +//# sourceMappingURL=SASQueryParameters.js.map /***/ }), -/***/ 51772: +/***/ 80914: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -117904,26 +111155,22 @@ exports.StorageRetryPolicy = StorageRetryPolicy; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageRetryPolicyType = void 0; +exports.ipRangeToString = ipRangeToString; /** - * RetryPolicy types. + * Generate SasIPRange format string. For example: + * + * "8.8.8.8" or "1.1.1.1-255.255.255.255" + * + * @param ipRange - */ -var StorageRetryPolicyType; -(function (StorageRetryPolicyType) { - /** - * Exponential retry. Retry time delay grows exponentially. - */ - StorageRetryPolicyType[StorageRetryPolicyType["EXPONENTIAL"] = 0] = "EXPONENTIAL"; - /** - * Linear retry. Retry time delay grows linearly. - */ - StorageRetryPolicyType[StorageRetryPolicyType["FIXED"] = 1] = "FIXED"; -})(StorageRetryPolicyType || (exports.StorageRetryPolicyType = StorageRetryPolicyType = {})); -//# sourceMappingURL=StorageRetryPolicyType.js.map +function ipRangeToString(ipRange) { + return ipRange.end ? `${ipRange.start}-${ipRange.end}` : ipRange.start; +} +//# sourceMappingURL=SasIPRange.js.map /***/ }), -/***/ 68031: +/***/ 93996: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -117931,473 +111178,140 @@ var StorageRetryPolicyType; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageRetryPolicyName = void 0; -exports.storageRetryPolicy = storageRetryPolicy; -const abort_controller_1 = __nccwpck_require__(1753); -const core_rest_pipeline_1 = __nccwpck_require__(29146); -const core_util_1 = __nccwpck_require__(80637); -const StorageRetryPolicyFactory_js_1 = __nccwpck_require__(98637); -const constants_js_1 = __nccwpck_require__(81865); -const utils_common_js_1 = __nccwpck_require__(16673); -const log_js_1 = __nccwpck_require__(53282); -/** - * Name of the {@link storageRetryPolicy} - */ -exports.storageRetryPolicyName = "storageRetryPolicy"; -// Default values of StorageRetryOptions -const DEFAULT_RETRY_OPTIONS = { - maxRetryDelayInMs: 120 * 1000, - maxTries: 4, - retryDelayInMs: 4 * 1000, - retryPolicyType: StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL, - secondaryHost: "", - tryTimeoutInMs: undefined, // Use server side default timeout strategy -}; -const retriableErrors = [ - "ETIMEDOUT", - "ESOCKETTIMEDOUT", - "ECONNREFUSED", - "ECONNRESET", - "ENOENT", - "ENOTFOUND", - "TIMEOUT", - "EPIPE", - "REQUEST_SEND_ERROR", -]; -const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); +exports.Batch = void 0; +// In browser, during webpack or browserify bundling, this module will be replaced by 'events' +// https://github.com/Gozala/events +const events_1 = __nccwpck_require__(82361); /** - * Retry policy with exponential retry and linear retry implemented. + * States for Batch. */ -function storageRetryPolicy(options = {}) { - const retryPolicyType = options.retryPolicyType ?? DEFAULT_RETRY_OPTIONS.retryPolicyType; - const maxTries = options.maxTries ?? DEFAULT_RETRY_OPTIONS.maxTries; - const retryDelayInMs = options.retryDelayInMs ?? DEFAULT_RETRY_OPTIONS.retryDelayInMs; - const maxRetryDelayInMs = options.maxRetryDelayInMs ?? DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs; - const secondaryHost = options.secondaryHost ?? DEFAULT_RETRY_OPTIONS.secondaryHost; - const tryTimeoutInMs = options.tryTimeoutInMs ?? DEFAULT_RETRY_OPTIONS.tryTimeoutInMs; - function shouldRetry({ isPrimaryRetry, attempt, response, error, }) { - if (attempt >= maxTries) { - log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${maxTries}, no further try.`); - return false; - } - if (error) { - for (const retriableError of retriableErrors) { - if (error.name.toUpperCase().includes(retriableError) || - error.message.toUpperCase().includes(retriableError) || - (error.code && error.code.toString().toUpperCase() === retriableError)) { - log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); - return true; - } - } - if (error?.code === "PARSE_ERROR" && - error?.message.startsWith(`Error "Error: Unclosed root tag`)) { - log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); - return true; - } - } - // If attempt was against the secondary & it returned a StatusNotFound (404), then - // the resource was not found. This may be due to replication delay. So, in this - // case, we'll never try the secondary again for this operation. - if (response || error) { - const statusCode = response?.status ?? error?.statusCode ?? 0; - if (!isPrimaryRetry && statusCode === 404) { - log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); - return true; - } - // Server internal error or server timeout - if (statusCode === 503 || statusCode === 500) { - log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); - return true; - } - } - if (response) { - // Retry select Copy Source Error Codes. - if (response?.status >= 400) { - const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); - if (copySourceError !== undefined) { - switch (copySourceError) { - case "InternalError": - case "OperationTimedOut": - case "ServerBusy": - return true; - } - } - } - } - return false; - } - function calculateDelay(isPrimaryRetry, attempt) { - let delayTimeInMs = 0; - if (isPrimaryRetry) { - switch (retryPolicyType) { - case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL: - delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * retryDelayInMs, maxRetryDelayInMs); - break; - case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.FIXED: - delayTimeInMs = retryDelayInMs; - break; - } - } - else { - delayTimeInMs = Math.random() * 1000; - } - log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); - return delayTimeInMs; - } - return { - name: exports.storageRetryPolicyName, - async sendRequest(request, next) { - // Set the server-side timeout query parameter "timeout=[seconds]" - if (tryTimeoutInMs) { - request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1000))); - } - const primaryUrl = request.url; - const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request.url, secondaryHost) : undefined; - let secondaryHas404 = false; - let attempt = 1; - let retryAgain = true; - let response; - let error; - while (retryAgain) { - const isPrimaryRetry = secondaryHas404 || - !secondaryUrl || - !["GET", "HEAD", "OPTIONS"].includes(request.method) || - attempt % 2 === 1; - request.url = isPrimaryRetry ? primaryUrl : secondaryUrl; - response = undefined; - error = undefined; - try { - log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); - response = await next(request); - secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); - } - catch (e) { - if ((0, core_rest_pipeline_1.isRestError)(e)) { - log_js_1.logger.error(`RetryPolicy: Caught error, message: ${e.message}, code: ${e.code}`); - error = e; - } - else { - log_js_1.logger.error(`RetryPolicy: Caught error, message: ${(0, core_util_1.getErrorMessage)(e)}`); - throw e; - } - } - retryAgain = shouldRetry({ isPrimaryRetry, attempt, response, error }); - if (retryAgain) { - await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request.abortSignal, RETRY_ABORT_ERROR); - } - attempt++; - } - if (response) { - return response; - } - throw error ?? new core_rest_pipeline_1.RestError("RetryPolicy failed without known error."); - }, - }; -} -//# sourceMappingURL=StorageRetryPolicyV2.js.map - -/***/ }), - -/***/ 66776: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageSharedKeyCredentialPolicy = void 0; -const constants_js_1 = __nccwpck_require__(81865); -const utils_common_js_1 = __nccwpck_require__(16673); -const CredentialPolicy_js_1 = __nccwpck_require__(15513); -const SharedKeyComparator_js_1 = __nccwpck_require__(35867); +var BatchStates; +(function (BatchStates) { + BatchStates[BatchStates["Good"] = 0] = "Good"; + BatchStates[BatchStates["Error"] = 1] = "Error"; +})(BatchStates || (BatchStates = {})); /** - * StorageSharedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key. + * Batch provides basic parallel execution with concurrency limits. + * Will stop execute left operations when one of the executed operation throws an error. + * But Batch cannot cancel ongoing operations, you need to cancel them by yourself. */ -class StorageSharedKeyCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { +class Batch { /** - * Reference to StorageSharedKeyCredential which generates StorageSharedKeyCredentialPolicy + * Concurrency. Must be lager than 0. */ - factory; + concurrency; /** - * Creates an instance of StorageSharedKeyCredentialPolicy. - * @param nextPolicy - - * @param options - - * @param factory - + * Number of active operations under execution. */ - constructor(nextPolicy, options, factory) { - super(nextPolicy, options); - this.factory = factory; - } + actives = 0; /** - * Signs request. - * - * @param request - + * Number of completed operations under execution. */ - signRequest(request) { - request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); - if (request.body && - (typeof request.body === "string" || request.body !== undefined) && - request.body.length > 0) { - request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); - } - const stringToSign = [ - request.method.toUpperCase(), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), - ].join("\n") + - "\n" + - this.getCanonicalizedHeadersString(request) + - this.getCanonicalizedResourceString(request); - const signature = this.factory.computeHMACSHA256(stringToSign); - request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); - // console.log(`[URL]:${request.url}`); - // console.log(`[HEADERS]:${request.headers.toString()}`); - // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); - // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); - return request; - } + completed = 0; /** - * Retrieve header value according to shared key sign rules. - * @see https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key - * - * @param request - - * @param headerName - + * Offset of next operation to be executed. */ - getHeaderValueToSign(request, headerName) { - const value = request.headers.get(headerName); - if (!value) { - return ""; - } - // When using version 2015-02-21 or later, if Content-Length is zero, then - // set the Content-Length part of the StringToSign to an empty string. - // https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key - if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { - return ""; + offset = 0; + /** + * Operation array to be executed. + */ + operations = []; + /** + * States of Batch. When an error happens, state will turn into error. + * Batch will stop execute left operations. + */ + state = BatchStates.Good; + /** + * A private emitter used to pass events inside this class. + */ + emitter; + /** + * Creates an instance of Batch. + * @param concurrency - + */ + constructor(concurrency = 5) { + if (concurrency < 1) { + throw new RangeError("concurrency must be larger than 0"); } - return value; + this.concurrency = concurrency; + this.emitter = new events_1.EventEmitter(); } /** - * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: - * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. - * 2. Convert each HTTP header name to lowercase. - * 3. Sort the headers lexicographically by header name, in ascending order. - * Each header may appear only once in the string. - * 4. Replace any linear whitespace in the header value with a single space. - * 5. Trim any whitespace around the colon in the header. - * 6. Finally, append a new-line character to each canonicalized header in the resulting list. - * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. + * Add a operation into queue. * - * @param request - + * @param operation - */ - getCanonicalizedHeadersString(request) { - let headersArray = request.headers.headersArray().filter((value) => { - return value.name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE); - }); - headersArray.sort((a, b) => { - return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); - }); - // Remove duplicate headers - headersArray = headersArray.filter((value, index, array) => { - if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { - return false; + addOperation(operation) { + this.operations.push(async () => { + try { + this.actives++; + await operation(); + this.actives--; + this.completed++; + this.parallelExecute(); + } + catch (error) { + this.emitter.emit("error", error); } - return true; - }); - let canonicalizedHeadersStringToSign = ""; - headersArray.forEach((header) => { - canonicalizedHeadersStringToSign += `${header.name - .toLowerCase() - .trimRight()}:${header.value.trimLeft()}\n`; }); - return canonicalizedHeadersStringToSign; } /** - * Retrieves the webResource canonicalized resource string. + * Start execute operations in the queue. * - * @param request - */ - getCanonicalizedResourceString(request) { - const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; - let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${this.factory.accountName}${path}`; - const queries = (0, utils_common_js_1.getURLQueries)(request.url); - const lowercaseQueries = {}; - if (queries) { - const queryKeys = []; - for (const key in queries) { - if (Object.prototype.hasOwnProperty.call(queries, key)) { - const lowercaseKey = key.toLowerCase(); - lowercaseQueries[lowercaseKey] = queries[key]; - queryKeys.push(lowercaseKey); - } - } - queryKeys.sort(); - for (const key of queryKeys) { - canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; - } - } - return canonicalizedResourceString; - } -} -exports.StorageSharedKeyCredentialPolicy = StorageSharedKeyCredentialPolicy; -//# sourceMappingURL=StorageSharedKeyCredentialPolicy.js.map - -/***/ }), - -/***/ 93846: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageSharedKeyCredentialPolicyName = void 0; -exports.storageSharedKeyCredentialPolicy = storageSharedKeyCredentialPolicy; -const node_crypto_1 = __nccwpck_require__(6005); -const constants_js_1 = __nccwpck_require__(81865); -const utils_common_js_1 = __nccwpck_require__(16673); -const SharedKeyComparator_js_1 = __nccwpck_require__(35867); -/** - * The programmatic identifier of the storageSharedKeyCredentialPolicy. - */ -exports.storageSharedKeyCredentialPolicyName = "storageSharedKeyCredentialPolicy"; -/** - * storageSharedKeyCredentialPolicy handles signing requests using storage account keys. - */ -function storageSharedKeyCredentialPolicy(options) { - function signRequest(request) { - request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); - if (request.body && - (typeof request.body === "string" || Buffer.isBuffer(request.body)) && - request.body.length > 0) { - request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + async do() { + if (this.operations.length === 0) { + return Promise.resolve(); } - const stringToSign = [ - request.method.toUpperCase(), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), - ].join("\n") + - "\n" + - getCanonicalizedHeadersString(request) + - getCanonicalizedResourceString(request); - const signature = (0, node_crypto_1.createHmac)("sha256", options.accountKey) - .update(stringToSign, "utf8") - .digest("base64"); - request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); - // console.log(`[URL]:${request.url}`); - // console.log(`[HEADERS]:${request.headers.toString()}`); - // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); - // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); + this.parallelExecute(); + return new Promise((resolve, reject) => { + this.emitter.on("finish", resolve); + this.emitter.on("error", (error) => { + this.state = BatchStates.Error; + reject(error); + }); + }); } /** - * Retrieve header value according to shared key sign rules. - * @see https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key + * Get next operation to be executed. Return null when reaching ends. + * */ - function getHeaderValueToSign(request, headerName) { - const value = request.headers.get(headerName); - if (!value) { - return ""; - } - // When using version 2015-02-21 or later, if Content-Length is zero, then - // set the Content-Length part of the StringToSign to an empty string. - // https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key - if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { - return ""; - } - return value; - } - /** - * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: - * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. - * 2. Convert each HTTP header name to lowercase. - * 3. Sort the headers lexicographically by header name, in ascending order. - * Each header may appear only once in the string. - * 4. Replace any linear whitespace in the header value with a single space. - * 5. Trim any whitespace around the colon in the header. - * 6. Finally, append a new-line character to each canonicalized header in the resulting list. - * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. + nextOperation() { + if (this.offset < this.operations.length) { + return this.operations[this.offset++]; + } + return null; + } + /** + * Start execute operations. One one the most important difference between + * this method with do() is that do() wraps as an sync method. * */ - function getCanonicalizedHeadersString(request) { - let headersArray = []; - for (const [name, value] of request.headers) { - if (name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE)) { - headersArray.push({ name, value }); - } + parallelExecute() { + if (this.state === BatchStates.Error) { + return; } - headersArray.sort((a, b) => { - return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); - }); - // Remove duplicate headers - headersArray = headersArray.filter((value, index, array) => { - if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { - return false; - } - return true; - }); - let canonicalizedHeadersStringToSign = ""; - headersArray.forEach((header) => { - canonicalizedHeadersStringToSign += `${header.name - .toLowerCase() - .trimRight()}:${header.value.trimLeft()}\n`; - }); - return canonicalizedHeadersStringToSign; - } - function getCanonicalizedResourceString(request) { - const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; - let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${options.accountName}${path}`; - const queries = (0, utils_common_js_1.getURLQueries)(request.url); - const lowercaseQueries = {}; - if (queries) { - const queryKeys = []; - for (const key in queries) { - if (Object.prototype.hasOwnProperty.call(queries, key)) { - const lowercaseKey = key.toLowerCase(); - lowercaseQueries[lowercaseKey] = queries[key]; - queryKeys.push(lowercaseKey); - } + if (this.completed >= this.operations.length) { + this.emitter.emit("finish"); + return; + } + while (this.actives < this.concurrency) { + const operation = this.nextOperation(); + if (operation) { + operation(); } - queryKeys.sort(); - for (const key of queryKeys) { - canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; + else { + return; } } - return canonicalizedResourceString; } - return { - name: exports.storageSharedKeyCredentialPolicyName, - async sendRequest(request, next) { - signRequest(request); - return next(request); - }, - }; } -//# sourceMappingURL=StorageSharedKeyCredentialPolicyV2.js.map +exports.Batch = Batch; +//# sourceMappingURL=Batch.js.map /***/ }), -/***/ 9846: +/***/ 59028: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -118405,144 +111319,126 @@ function storageSharedKeyCredentialPolicy(options) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BlobBeginCopyFromUrlPoller = void 0; -const core_util_1 = __nccwpck_require__(80637); -const core_lro_1 = __nccwpck_require__(90334); +exports.BlobQuickQueryStream = void 0; +const node_stream_1 = __nccwpck_require__(84492); +const index_js_1 = __nccwpck_require__(94382); /** - * This is the poller returned by {@link BlobClient.beginCopyFromURL}. - * This can not be instantiated directly outside of this package. + * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * @hidden - */ -class BlobBeginCopyFromUrlPoller extends core_lro_1.Poller { - intervalInMs; - constructor(options) { - const { blobClient, copySource, intervalInMs = 15000, onProgress, resumeFrom, startCopyFromURLOptions, } = options; - let state; - if (resumeFrom) { - state = JSON.parse(resumeFrom).state; - } - const operation = makeBlobBeginCopyFromURLPollOperation({ - ...state, - blobClient, - copySource, - startCopyFromURLOptions, - }); - super(operation); - if (typeof onProgress === "function") { - this.onProgress(onProgress); - } - this.intervalInMs = intervalInMs; - } - delay() { - return (0, core_util_1.delay)(this.intervalInMs); - } -} -exports.BlobBeginCopyFromUrlPoller = BlobBeginCopyFromUrlPoller; -/** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @hidden + * A Node.js BlobQuickQueryStream will internally parse avro data stream for blob query. */ -const cancel = async function cancel(options = {}) { - const state = this.state; - const { copyId } = state; - if (state.isCompleted) { - return makeBlobBeginCopyFromURLPollOperation(state); - } - if (!copyId) { - state.isCancelled = true; - return makeBlobBeginCopyFromURLPollOperation(state); +class BlobQuickQueryStream extends node_stream_1.Readable { + source; + avroReader; + avroIter; + avroPaused = true; + onProgress; + onError; + /** + * Creates an instance of BlobQuickQueryStream. + * + * @param source - The current ReadableStream returned from getter + * @param options - + */ + constructor(source, options = {}) { + super(); + this.source = source; + this.onProgress = options.onProgress; + this.onError = options.onError; + this.avroReader = new index_js_1.AvroReader(new index_js_1.AvroReadableFromStream(this.source)); + this.avroIter = this.avroReader.parseObjects({ abortSignal: options.abortSignal }); } - // if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call - await state.blobClient.abortCopyFromURL(copyId, { - abortSignal: options.abortSignal, - }); - state.isCancelled = true; - return makeBlobBeginCopyFromURLPollOperation(state); -}; -/** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @hidden - */ -const update = async function update(options = {}) { - const state = this.state; - const { blobClient, copySource, startCopyFromURLOptions } = state; - if (!state.isStarted) { - state.isStarted = true; - const result = await blobClient.startCopyFromURL(copySource, startCopyFromURLOptions); - // copyId is needed to abort - state.copyId = result.copyId; - if (result.copyStatus === "success") { - state.result = result; - state.isCompleted = true; + _read() { + if (this.avroPaused) { + this.readInternal().catch((err) => { + this.emit("error", err); + }); } } - else if (!state.isCompleted) { - try { - const result = await state.blobClient.getProperties({ abortSignal: options.abortSignal }); - const { copyStatus, copyProgress } = result; - const prevCopyProgress = state.copyProgress; - if (copyProgress) { - state.copyProgress = copyProgress; - } - if (copyStatus === "pending" && - copyProgress !== prevCopyProgress && - typeof options.fireProgress === "function") { - // trigger in setTimeout, or swallow error? - options.fireProgress(state); + async readInternal() { + this.avroPaused = false; + let avroNext; + do { + avroNext = await this.avroIter.next(); + if (avroNext.done) { + break; } - else if (copyStatus === "success") { - state.result = result; - state.isCompleted = true; + const obj = avroNext.value; + const schema = obj.$schema; + if (typeof schema !== "string") { + throw Error("Missing schema in avro record."); } - else if (copyStatus === "failed") { - state.error = new Error(`Blob copy failed with reason: "${result.copyStatusDescription || "unknown"}"`); - state.isCompleted = true; + switch (schema) { + case "com.microsoft.azure.storage.queryBlobContents.resultData": + { + const data = obj.data; + if (data instanceof Uint8Array === false) { + throw Error("Invalid data in avro result record."); + } + if (!this.push(Buffer.from(data))) { + this.avroPaused = true; + } + } + break; + case "com.microsoft.azure.storage.queryBlobContents.progress": + { + const bytesScanned = obj.bytesScanned; + if (typeof bytesScanned !== "number") { + throw Error("Invalid bytesScanned in avro progress record."); + } + if (this.onProgress) { + this.onProgress({ loadedBytes: bytesScanned }); + } + } + break; + case "com.microsoft.azure.storage.queryBlobContents.end": + if (this.onProgress) { + const totalBytes = obj.totalBytes; + if (typeof totalBytes !== "number") { + throw Error("Invalid totalBytes in avro end record."); + } + this.onProgress({ loadedBytes: totalBytes }); + } + this.push(null); + break; + case "com.microsoft.azure.storage.queryBlobContents.error": + if (this.onError) { + const fatal = obj.fatal; + if (typeof fatal !== "boolean") { + throw Error("Invalid fatal in avro error record."); + } + const name = obj.name; + if (typeof name !== "string") { + throw Error("Invalid name in avro error record."); + } + const description = obj.description; + if (typeof description !== "string") { + throw Error("Invalid description in avro error record."); + } + const position = obj.position; + if (typeof position !== "number") { + throw Error("Invalid position in avro error record."); + } + this.onError({ + position, + name, + isFatal: fatal, + description, + }); + } + break; + default: + throw Error(`Unknown schema ${schema} in avro progress record.`); } - } - catch (err) { - state.error = err; - state.isCompleted = true; - } + } while (!avroNext.done && !this.avroPaused); } - return makeBlobBeginCopyFromURLPollOperation(state); -}; -/** - * Note: Intentionally using function expression over arrow function expression - * so that the function can be invoked with a different context. - * This affects what `this` refers to. - * @hidden - */ -const toString = function toString() { - return JSON.stringify({ state: this.state }, (key, value) => { - // remove blobClient from serialized state since a client can't be hydrated from this info. - if (key === "blobClient") { - return undefined; - } - return value; - }); -}; -/** - * Creates a poll operation given the provided state. - * @hidden - */ -function makeBlobBeginCopyFromURLPollOperation(state) { - return { - state: { ...state }, - cancel, - toString, - update, - }; } -//# sourceMappingURL=BlobStartCopyFromUrlPoller.js.map +exports.BlobQuickQueryStream = BlobQuickQueryStream; +//# sourceMappingURL=BlobQuickQueryStream.js.map /***/ }), -/***/ 70793: +/***/ 25300: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -118550,235 +111446,296 @@ function makeBlobBeginCopyFromURLPollOperation(state) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AccountSASPermissions = void 0; +exports.Mutex = void 0; +var MutexLockStatus; +(function (MutexLockStatus) { + MutexLockStatus[MutexLockStatus["LOCKED"] = 0] = "LOCKED"; + MutexLockStatus[MutexLockStatus["UNLOCKED"] = 1] = "UNLOCKED"; +})(MutexLockStatus || (MutexLockStatus = {})); /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * This is a helper class to construct a string representing the permissions granted by an AccountSAS. Setting a value - * to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the - * values are set, this should be serialized with toString and set as the permissions field on an - * {@link AccountSASSignatureValues} object. It is possible to construct the permissions string without this class, but - * the order of the permissions is particular and this class guarantees correctness. + * An async mutex lock. */ -class AccountSASPermissions { +class Mutex { /** - * Parse initializes the AccountSASPermissions fields from a string. + * Lock for a specific key. If the lock has been acquired by another customer, then + * will wait until getting the lock. * - * @param permissions - + * @param key - lock key */ - static parse(permissions) { - const accountSASPermissions = new AccountSASPermissions(); - for (const c of permissions) { - switch (c) { - case "r": - accountSASPermissions.read = true; - break; - case "w": - accountSASPermissions.write = true; - break; - case "d": - accountSASPermissions.delete = true; - break; - case "x": - accountSASPermissions.deleteVersion = true; - break; - case "l": - accountSASPermissions.list = true; - break; - case "a": - accountSASPermissions.add = true; - break; - case "c": - accountSASPermissions.create = true; - break; - case "u": - accountSASPermissions.update = true; - break; - case "p": - accountSASPermissions.process = true; - break; - case "t": - accountSASPermissions.tag = true; - break; - case "f": - accountSASPermissions.filter = true; - break; - case "i": - accountSASPermissions.setImmutabilityPolicy = true; - break; - case "y": - accountSASPermissions.permanentDelete = true; - break; - default: - throw new RangeError(`Invalid permission character: ${c}`); + static async lock(key) { + return new Promise((resolve) => { + if (this.keys[key] === undefined || this.keys[key] === MutexLockStatus.UNLOCKED) { + this.keys[key] = MutexLockStatus.LOCKED; + resolve(); } - } - return accountSASPermissions; + else { + this.onUnlockEvent(key, () => { + this.keys[key] = MutexLockStatus.LOCKED; + resolve(); + }); + } + }); } /** - * Creates a {@link AccountSASPermissions} from a raw object which contains same keys as it - * and boolean values for them. + * Unlock a key. * - * @param permissionLike - + * @param key - */ - static from(permissionLike) { - const accountSASPermissions = new AccountSASPermissions(); - if (permissionLike.read) { - accountSASPermissions.read = true; - } - if (permissionLike.write) { - accountSASPermissions.write = true; - } - if (permissionLike.delete) { - accountSASPermissions.delete = true; - } - if (permissionLike.deleteVersion) { - accountSASPermissions.deleteVersion = true; - } - if (permissionLike.filter) { - accountSASPermissions.filter = true; - } - if (permissionLike.tag) { - accountSASPermissions.tag = true; - } - if (permissionLike.list) { - accountSASPermissions.list = true; - } - if (permissionLike.add) { - accountSASPermissions.add = true; - } - if (permissionLike.create) { - accountSASPermissions.create = true; - } - if (permissionLike.update) { - accountSASPermissions.update = true; - } - if (permissionLike.process) { - accountSASPermissions.process = true; + static async unlock(key) { + return new Promise((resolve) => { + if (this.keys[key] === MutexLockStatus.LOCKED) { + this.emitUnlockEvent(key); + } + delete this.keys[key]; + resolve(); + }); + } + static keys = {}; + static listeners = {}; + static onUnlockEvent(key, handler) { + if (this.listeners[key] === undefined) { + this.listeners[key] = [handler]; } - if (permissionLike.setImmutabilityPolicy) { - accountSASPermissions.setImmutabilityPolicy = true; + else { + this.listeners[key].push(handler); } - if (permissionLike.permanentDelete) { - accountSASPermissions.permanentDelete = true; + } + static emitUnlockEvent(key) { + if (this.listeners[key] !== undefined && this.listeners[key].length > 0) { + const handler = this.listeners[key].shift(); + setImmediate(() => { + handler.call(this); + }); } - return accountSASPermissions; } +} +exports.Mutex = Mutex; +//# sourceMappingURL=Mutex.js.map + +/***/ }), + +/***/ 88251: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RetriableReadableStream = void 0; +const abort_controller_1 = __nccwpck_require__(1753); +const node_stream_1 = __nccwpck_require__(84492); +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * A Node.js ReadableStream will internally retry when internal ReadableStream unexpected ends. + */ +class RetriableReadableStream extends node_stream_1.Readable { + start; + offset; + end; + getter; + source; + retries = 0; + maxRetryRequests; + onProgress; + options; /** - * Permission to read resources and list queues and tables granted. - */ - read = false; - /** - * Permission to write resources granted. - */ - write = false; - /** - * Permission to delete blobs and files granted. - */ - delete = false; - /** - * Permission to delete versions granted. - */ - deleteVersion = false; - /** - * Permission to list blob containers, blobs, shares, directories, and files granted. - */ - list = false; - /** - * Permission to add messages, table entities, and append to blobs granted. - */ - add = false; - /** - * Permission to create blobs and files granted. - */ - create = false; - /** - * Permissions to update messages and table entities granted. - */ - update = false; - /** - * Permission to get and delete messages granted. - */ - process = false; - /** - * Specfies Tag access granted. - */ - tag = false; - /** - * Permission to filter blobs. - */ - filter = false; - /** - * Permission to set immutability policy. - */ - setImmutabilityPolicy = false; - /** - * Specifies that Permanent Delete is permitted. - */ - permanentDelete = false; - /** - * Produces the SAS permissions string for an Azure Storage account. - * Call this method to set AccountSASSignatureValues Permissions field. - * - * Using this method will guarantee the resource types are in - * an order accepted by the service. - * - * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas + * Creates an instance of RetriableReadableStream. * + * @param source - The current ReadableStream returned from getter + * @param getter - A method calling downloading request returning + * a new ReadableStream from specified offset + * @param offset - Offset position in original data source to read + * @param count - How much data in original data source to read + * @param options - */ - toString() { - // The order of the characters should be as specified here to ensure correctness: - // https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas - // Use a string array instead of string concatenating += operator for performance - const permissions = []; - if (this.read) { - permissions.push("r"); + constructor(source, getter, offset, count, options = {}) { + super({ highWaterMark: options.highWaterMark }); + this.getter = getter; + this.source = source; + this.start = offset; + this.offset = offset; + this.end = offset + count - 1; + this.maxRetryRequests = + options.maxRetryRequests && options.maxRetryRequests >= 0 ? options.maxRetryRequests : 0; + this.onProgress = options.onProgress; + this.options = options; + this.setSourceEventHandlers(); + } + _read() { + this.source.resume(); + } + setSourceEventHandlers() { + this.source.on("data", this.sourceDataHandler); + this.source.on("end", this.sourceErrorOrEndHandler); + this.source.on("error", this.sourceErrorOrEndHandler); + // needed for Node14 + this.source.on("aborted", this.sourceAbortedHandler); + } + removeSourceEventHandlers() { + this.source.removeListener("data", this.sourceDataHandler); + this.source.removeListener("end", this.sourceErrorOrEndHandler); + this.source.removeListener("error", this.sourceErrorOrEndHandler); + this.source.removeListener("aborted", this.sourceAbortedHandler); + } + sourceDataHandler = (data) => { + if (this.options.doInjectErrorOnce) { + this.options.doInjectErrorOnce = undefined; + this.source.pause(); + this.sourceErrorOrEndHandler(); + this.source.destroy(); + return; } - if (this.write) { - permissions.push("w"); + // console.log( + // `Offset: ${this.offset}, Received ${data.length} from internal stream` + // ); + this.offset += data.length; + if (this.onProgress) { + this.onProgress({ loadedBytes: this.offset - this.start }); } - if (this.delete) { - permissions.push("d"); + if (!this.push(data)) { + this.source.pause(); } - if (this.deleteVersion) { - permissions.push("x"); + }; + sourceAbortedHandler = () => { + const abortError = new abort_controller_1.AbortError("The operation was aborted."); + this.destroy(abortError); + }; + sourceErrorOrEndHandler = (err) => { + if (err && err.name === "AbortError") { + this.destroy(err); + return; } - if (this.filter) { - permissions.push("f"); + // console.log( + // `Source stream emits end or error, offset: ${ + // this.offset + // }, dest end : ${this.end}` + // ); + this.removeSourceEventHandlers(); + if (this.offset - 1 === this.end) { + this.push(null); } - if (this.tag) { - permissions.push("t"); + else if (this.offset <= this.end) { + // console.log( + // `retries: ${this.retries}, max retries: ${this.maxRetries}` + // ); + if (this.retries < this.maxRetryRequests) { + this.retries += 1; + this.getter(this.offset) + .then((newSource) => { + this.source = newSource; + this.setSourceEventHandlers(); + return; + }) + .catch((error) => { + this.destroy(error); + }); + } + else { + this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`)); + } } - if (this.list) { - permissions.push("l"); + else { + this.destroy(new Error(`Data corruption failure: Received more data than original request, data needed offset is ${this.end}, received offset: ${this.offset - 1}`)); } - if (this.add) { - permissions.push("a"); + }; + _destroy(error, callback) { + // remove listener from source and release source + this.removeSourceEventHandlers(); + this.source.destroy(); + callback(error === null ? undefined : error); + } +} +exports.RetriableReadableStream = RetriableReadableStream; +//# sourceMappingURL=RetriableReadableStream.js.map + +/***/ }), + +/***/ 35867: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.compareHeader = compareHeader; +/* + * We need to imitate .Net culture-aware sorting, which is used in storage service. + * Below tables contain sort-keys for en-US culture. + */ +const table_lv0 = new Uint32Array([ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, + 0x723, 0x725, 0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e, + 0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe02, 0xe09, 0xe0a, + 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, + 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x0, 0x0, 0x743, 0x744, 0x748, + 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, + 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4,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, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +]); +function compareHeader(lhs, rhs) { + if (isLessThan(lhs, rhs)) + return -1; + return 1; +} +function isLessThan(lhs, rhs) { + const tables = [table_lv0, table_lv2, table_lv4]; + let curr_level = 0; + let i = 0; + let j = 0; + while (curr_level < tables.length) { + if (curr_level === tables.length - 1 && i !== j) { + return i > j; } - if (this.create) { - permissions.push("c"); + const weight1 = i < lhs.length ? tables[curr_level][lhs[i].charCodeAt(0)] : 0x1; + const weight2 = j < rhs.length ? tables[curr_level][rhs[j].charCodeAt(0)] : 0x1; + if (weight1 === 0x1 && weight2 === 0x1) { + i = 0; + j = 0; + ++curr_level; } - if (this.update) { - permissions.push("u"); + else if (weight1 === weight2) { + ++i; + ++j; } - if (this.process) { - permissions.push("p"); + else if (weight1 === 0) { + ++i; } - if (this.setImmutabilityPolicy) { - permissions.push("i"); + else if (weight2 === 0) { + ++j; } - if (this.permanentDelete) { - permissions.push("y"); + else { + return weight1 < weight2; } - return permissions.join(""); } + return false; } -exports.AccountSASPermissions = AccountSASPermissions; -//# sourceMappingURL=AccountSASPermissions.js.map +//# sourceMappingURL=SharedKeyComparator.js.map /***/ }), -/***/ 70790: +/***/ 81865: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -118786,169 +111743,259 @@ exports.AccountSASPermissions = AccountSASPermissions; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AccountSASResourceTypes = void 0; +exports.PathStylePorts = exports.BlobDoesNotUseCustomerSpecifiedEncryption = exports.BlobUsesCustomerSpecifiedEncryptionMsg = exports.StorageBlobLoggingAllowedQueryParameters = exports.StorageBlobLoggingAllowedHeaderNames = exports.DevelopmentConnectionString = exports.EncryptionAlgorithmAES25 = exports.HTTP_VERSION_1_1 = exports.HTTP_LINE_ENDING = exports.BATCH_MAX_PAYLOAD_IN_BYTES = exports.BATCH_MAX_REQUEST = exports.SIZE_1_MB = exports.ETagAny = exports.ETagNone = exports.HeaderConstants = exports.HTTPURLConnection = exports.URLConstants = exports.StorageOAuthScopes = exports.REQUEST_TIMEOUT = exports.DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = exports.DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES = exports.DEFAULT_BLOCK_BUFFER_SIZE_BYTES = exports.BLOCK_BLOB_MAX_BLOCKS = exports.BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = exports.BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = exports.SERVICE_VERSION = exports.SDK_VERSION = void 0; +exports.SDK_VERSION = "12.29.1"; +exports.SERVICE_VERSION = "2025-11-05"; +exports.BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB +exports.BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB +exports.BLOCK_BLOB_MAX_BLOCKS = 50000; +exports.DEFAULT_BLOCK_BUFFER_SIZE_BYTES = 8 * 1024 * 1024; // 8MB +exports.DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES = 4 * 1024 * 1024; // 4MB +exports.DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = 5; +exports.REQUEST_TIMEOUT = 100 * 1000; // In ms /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * This is a helper class to construct a string representing the resources accessible by an AccountSAS. Setting a value - * to true means that any SAS which uses these permissions will grant access to that resource type. Once all the - * values are set, this should be serialized with toString and set as the resources field on an - * {@link AccountSASSignatureValues} object. It is possible to construct the resources string without this class, but - * the order of the resources is particular and this class guarantees correctness. + * The OAuth scope to use with Azure Storage. */ -class AccountSASResourceTypes { - /** - * Creates an {@link AccountSASResourceTypes} from the specified resource types string. This method will throw an - * Error if it encounters a character that does not correspond to a valid resource type. - * - * @param resourceTypes - - */ - static parse(resourceTypes) { - const accountSASResourceTypes = new AccountSASResourceTypes(); - for (const c of resourceTypes) { - switch (c) { - case "s": - accountSASResourceTypes.service = true; - break; - case "c": - accountSASResourceTypes.container = true; - break; - case "o": - accountSASResourceTypes.object = true; - break; - default: - throw new RangeError(`Invalid resource type: ${c}`); - } - } - return accountSASResourceTypes; - } - /** - * Permission to access service level APIs granted. - */ - service = false; - /** - * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted. - */ - container = false; - /** - * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted. - */ - object = false; - /** - * Converts the given resource types to a string. - * - * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas - * - */ - toString() { - const resourceTypes = []; - if (this.service) { - resourceTypes.push("s"); - } - if (this.container) { - resourceTypes.push("c"); - } - if (this.object) { - resourceTypes.push("o"); - } - return resourceTypes.join(""); - } -} -exports.AccountSASResourceTypes = AccountSASResourceTypes; -//# sourceMappingURL=AccountSASResourceTypes.js.map +exports.StorageOAuthScopes = "https://storage.azure.com/.default"; +exports.URLConstants = { + Parameters: { + FORCE_BROWSER_NO_CACHE: "_", + SIGNATURE: "sig", + SNAPSHOT: "snapshot", + VERSIONID: "versionid", + TIMEOUT: "timeout", + }, +}; +exports.HTTPURLConnection = { + HTTP_ACCEPTED: 202, + HTTP_CONFLICT: 409, + HTTP_NOT_FOUND: 404, + HTTP_PRECON_FAILED: 412, + HTTP_RANGE_NOT_SATISFIABLE: 416, +}; +exports.HeaderConstants = { + AUTHORIZATION: "Authorization", + AUTHORIZATION_SCHEME: "Bearer", + CONTENT_ENCODING: "Content-Encoding", + CONTENT_ID: "Content-ID", + CONTENT_LANGUAGE: "Content-Language", + CONTENT_LENGTH: "Content-Length", + CONTENT_MD5: "Content-Md5", + CONTENT_TRANSFER_ENCODING: "Content-Transfer-Encoding", + CONTENT_TYPE: "Content-Type", + COOKIE: "Cookie", + DATE: "date", + IF_MATCH: "if-match", + IF_MODIFIED_SINCE: "if-modified-since", + IF_NONE_MATCH: "if-none-match", + IF_UNMODIFIED_SINCE: "if-unmodified-since", + PREFIX_FOR_STORAGE: "x-ms-", + RANGE: "Range", + USER_AGENT: "User-Agent", + X_MS_CLIENT_REQUEST_ID: "x-ms-client-request-id", + X_MS_COPY_SOURCE: "x-ms-copy-source", + X_MS_DATE: "x-ms-date", + X_MS_ERROR_CODE: "x-ms-error-code", + X_MS_VERSION: "x-ms-version", + X_MS_CopySourceErrorCode: "x-ms-copy-source-error-code", +}; +exports.ETagNone = ""; +exports.ETagAny = "*"; +exports.SIZE_1_MB = 1 * 1024 * 1024; +exports.BATCH_MAX_REQUEST = 256; +exports.BATCH_MAX_PAYLOAD_IN_BYTES = 4 * exports.SIZE_1_MB; +exports.HTTP_LINE_ENDING = "\r\n"; +exports.HTTP_VERSION_1_1 = "HTTP/1.1"; +exports.EncryptionAlgorithmAES25 = "AES256"; +exports.DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;`; +exports.StorageBlobLoggingAllowedHeaderNames = [ + "Access-Control-Allow-Origin", + "Cache-Control", + "Content-Length", + "Content-Type", + "Date", + "Request-Id", + "traceparent", + "Transfer-Encoding", + "User-Agent", + "x-ms-client-request-id", + "x-ms-date", + "x-ms-error-code", + "x-ms-request-id", + "x-ms-return-client-request-id", + "x-ms-version", + "Accept-Ranges", + "Content-Disposition", + "Content-Encoding", + "Content-Language", + "Content-MD5", + "Content-Range", + "ETag", + "Last-Modified", + "Server", + "Vary", + "x-ms-content-crc64", + "x-ms-copy-action", + "x-ms-copy-completion-time", + "x-ms-copy-id", + "x-ms-copy-progress", + "x-ms-copy-status", + "x-ms-has-immutability-policy", + "x-ms-has-legal-hold", + "x-ms-lease-state", + "x-ms-lease-status", + "x-ms-range", + "x-ms-request-server-encrypted", + "x-ms-server-encrypted", + "x-ms-snapshot", + "x-ms-source-range", + "If-Match", + "If-Modified-Since", + "If-None-Match", + "If-Unmodified-Since", + "x-ms-access-tier", + "x-ms-access-tier-change-time", + "x-ms-access-tier-inferred", + "x-ms-account-kind", + "x-ms-archive-status", + "x-ms-blob-append-offset", + "x-ms-blob-cache-control", + "x-ms-blob-committed-block-count", + "x-ms-blob-condition-appendpos", + "x-ms-blob-condition-maxsize", + "x-ms-blob-content-disposition", + "x-ms-blob-content-encoding", + "x-ms-blob-content-language", + "x-ms-blob-content-length", + "x-ms-blob-content-md5", + "x-ms-blob-content-type", + "x-ms-blob-public-access", + "x-ms-blob-sequence-number", + "x-ms-blob-type", + "x-ms-copy-destination-snapshot", + "x-ms-creation-time", + "x-ms-default-encryption-scope", + "x-ms-delete-snapshots", + "x-ms-delete-type-permanent", + "x-ms-deny-encryption-scope-override", + "x-ms-encryption-algorithm", + "x-ms-if-sequence-number-eq", + "x-ms-if-sequence-number-le", + "x-ms-if-sequence-number-lt", + "x-ms-incremental-copy", + "x-ms-lease-action", + "x-ms-lease-break-period", + "x-ms-lease-duration", + "x-ms-lease-id", + "x-ms-lease-time", + "x-ms-page-write", + "x-ms-proposed-lease-id", + "x-ms-range-get-content-md5", + "x-ms-rehydrate-priority", + "x-ms-sequence-number-action", + "x-ms-sku-name", + "x-ms-source-content-md5", + "x-ms-source-if-match", + "x-ms-source-if-modified-since", + "x-ms-source-if-none-match", + "x-ms-source-if-unmodified-since", + "x-ms-tag-count", + "x-ms-encryption-key-sha256", + "x-ms-copy-source-error-code", + "x-ms-copy-source-status-code", + "x-ms-if-tags", + "x-ms-source-if-tags", +]; +exports.StorageBlobLoggingAllowedQueryParameters = [ + "comp", + "maxresults", + "rscc", + "rscd", + "rsce", + "rscl", + "rsct", + "se", + "si", + "sip", + "sp", + "spr", + "sr", + "srt", + "ss", + "st", + "sv", + "include", + "marker", + "prefix", + "copyid", + "restype", + "blockid", + "blocklisttype", + "delimiter", + "prevsnapshot", + "ske", + "skoid", + "sks", + "skt", + "sktid", + "skv", + "snapshot", +]; +exports.BlobUsesCustomerSpecifiedEncryptionMsg = "BlobUsesCustomerSpecifiedEncryption"; +exports.BlobDoesNotUseCustomerSpecifiedEncryption = "BlobDoesNotUseCustomerSpecifiedEncryption"; +/// List of ports used for path style addressing. +/// Path style addressing means that storage account is put in URI's Path segment in instead of in host. +exports.PathStylePorts = [ + "10000", + "10001", + "10002", + "10003", + "10004", + "10100", + "10101", + "10102", + "10103", + "10104", + "11000", + "11001", + "11002", + "11003", + "11004", + "11100", + "11101", + "11102", + "11103", + "11104", +]; +//# sourceMappingURL=constants.js.map /***/ }), -/***/ 34606: -/***/ ((__unused_webpack_module, exports) => { +/***/ 53683: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AccountSASServices = void 0; +exports.tracingClient = void 0; +const core_tracing_1 = __nccwpck_require__(19363); +const constants_js_1 = __nccwpck_require__(81865); /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * This is a helper class to construct a string representing the services accessible by an AccountSAS. Setting a value - * to true means that any SAS which uses these permissions will grant access to that service. Once all the - * values are set, this should be serialized with toString and set as the services field on an - * {@link AccountSASSignatureValues} object. It is possible to construct the services string without this class, but - * the order of the services is particular and this class guarantees correctness. + * Creates a span using the global tracer. + * @internal */ -class AccountSASServices { - /** - * Creates an {@link AccountSASServices} from the specified services string. This method will throw an - * Error if it encounters a character that does not correspond to a valid service. - * - * @param services - - */ - static parse(services) { - const accountSASServices = new AccountSASServices(); - for (const c of services) { - switch (c) { - case "b": - accountSASServices.blob = true; - break; - case "f": - accountSASServices.file = true; - break; - case "q": - accountSASServices.queue = true; - break; - case "t": - accountSASServices.table = true; - break; - default: - throw new RangeError(`Invalid service character: ${c}`); - } - } - return accountSASServices; - } - /** - * Permission to access blob resources granted. - */ - blob = false; - /** - * Permission to access file resources granted. - */ - file = false; - /** - * Permission to access queue resources granted. - */ - queue = false; - /** - * Permission to access table resources granted. - */ - table = false; - /** - * Converts the given services to a string. - * - */ - toString() { - const services = []; - if (this.blob) { - services.push("b"); - } - if (this.table) { - services.push("t"); - } - if (this.queue) { - services.push("q"); - } - if (this.file) { - services.push("f"); - } - return services.join(""); - } -} -exports.AccountSASServices = AccountSASServices; -//# sourceMappingURL=AccountSASServices.js.map +exports.tracingClient = (0, core_tracing_1.createTracingClient)({ + packageName: "@azure/storage-blob", + packageVersion: constants_js_1.SDK_VERSION, + namespace: "Microsoft.Storage", +}); +//# sourceMappingURL=tracing.js.map /***/ }), -/***/ 72763: +/***/ 16673: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -118956,1221 +112003,1547 @@ exports.AccountSASServices = AccountSASServices; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.generateAccountSASQueryParameters = generateAccountSASQueryParameters; -exports.generateAccountSASQueryParametersInternal = generateAccountSASQueryParametersInternal; -const AccountSASPermissions_js_1 = __nccwpck_require__(70793); -const AccountSASResourceTypes_js_1 = __nccwpck_require__(70790); -const AccountSASServices_js_1 = __nccwpck_require__(34606); -const SasIPRange_js_1 = __nccwpck_require__(80914); -const SASQueryParameters_js_1 = __nccwpck_require__(21969); +exports.escapeURLPath = escapeURLPath; +exports.getValueInConnString = getValueInConnString; +exports.extractConnectionStringParts = extractConnectionStringParts; +exports.appendToURLPath = appendToURLPath; +exports.setURLParameter = setURLParameter; +exports.getURLParameter = getURLParameter; +exports.setURLHost = setURLHost; +exports.getURLPath = getURLPath; +exports.getURLScheme = getURLScheme; +exports.getURLPathAndQuery = getURLPathAndQuery; +exports.getURLQueries = getURLQueries; +exports.appendToURLQuery = appendToURLQuery; +exports.truncatedISO8061Date = truncatedISO8061Date; +exports.base64encode = base64encode; +exports.base64decode = base64decode; +exports.generateBlockID = generateBlockID; +exports.delay = delay; +exports.padStart = padStart; +exports.sanitizeURL = sanitizeURL; +exports.sanitizeHeaders = sanitizeHeaders; +exports.iEqual = iEqual; +exports.getAccountNameFromUrl = getAccountNameFromUrl; +exports.isIpEndpointStyle = isIpEndpointStyle; +exports.toBlobTagsString = toBlobTagsString; +exports.toBlobTags = toBlobTags; +exports.toTags = toTags; +exports.toQuerySerialization = toQuerySerialization; +exports.parseObjectReplicationRecord = parseObjectReplicationRecord; +exports.attachCredential = attachCredential; +exports.httpAuthorizationToString = httpAuthorizationToString; +exports.BlobNameToString = BlobNameToString; +exports.ConvertInternalResponseOfListBlobFlat = ConvertInternalResponseOfListBlobFlat; +exports.ConvertInternalResponseOfListBlobHierarchy = ConvertInternalResponseOfListBlobHierarchy; +exports.ExtractPageRangeInfoItems = ExtractPageRangeInfoItems; +exports.EscapePath = EscapePath; +exports.assertResponse = assertResponse; +const core_rest_pipeline_1 = __nccwpck_require__(29146); +const core_util_1 = __nccwpck_require__(80637); const constants_js_1 = __nccwpck_require__(81865); -const utils_common_js_1 = __nccwpck_require__(16673); /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. + * Reserved URL characters must be properly escaped for Storage services like Blob or File. * - * Generates a {@link SASQueryParameters} object which contains all SAS query parameters needed to make an actual - * REST request. + * ## URL encode and escape strategy for JS SDKs * - * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas + * When customers pass a URL string into XxxClient classes constructor, the URL string may already be URL encoded or not. + * But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL + * string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XxxClient constructors. * - * @param accountSASSignatureValues - - * @param sharedKeyCredential - + * ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK. + * + * This is what legacy V2 SDK does, simple and works for most of the cases. + * - When customer URL string is "http://account.blob.core.windows.net/con/b:", + * SDK will encode it to "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created. + * - When customer URL string is "http://account.blob.core.windows.net/con/b%3A", + * SDK will encode it to "http://account.blob.core.windows.net/con/b%253A" and send to server. A blob named "b%3A" will be created. + * + * But this strategy will make it not possible to create a blob with "?" in it's name. Because when customer URL string is + * "http://account.blob.core.windows.net/con/blob?name", the "?name" will be treated as URL paramter instead of blob name. + * If customer URL string is "http://account.blob.core.windows.net/con/blob%3Fname", a blob named "blob%3Fname" will be created. + * V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it. + * We cannot accept a SDK cannot create a blob name with "?". So we implement strategy two: + * + * ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters. + * + * This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped. + * - When customer URL string is "http://account.blob.core.windows.net/con/b:", + * SDK will escape ":" like "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created. + * - When customer URL string is "http://account.blob.core.windows.net/con/b%3A", + * There is no special characters, so send "http://account.blob.core.windows.net/con/b%3A" to server. A blob named "b:" will be created. + * - When customer URL string is "http://account.blob.core.windows.net/con/b%253A", + * There is no special characters, so send "http://account.blob.core.windows.net/con/b%253A" to server. A blob named "b%3A" will be created. + * + * This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string + * is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL. + * If customer needs to create a blob with "%" in it's blob name, use "%25" instead of "%". Just like above 3rd sample. + * And following URL strings are invalid: + * - "http://account.blob.core.windows.net/con/b%" + * - "http://account.blob.core.windows.net/con/b%2" + * - "http://account.blob.core.windows.net/con/b%G" + * + * Another special character is "?", use "%2F" to represent a blob name with "?" in a URL string. + * + * ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `containerClient.getBlobClient(blobName)` + * + * We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL. + * + * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata + * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata + * + * @param url - */ -function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyCredential) { - return generateAccountSASQueryParametersInternal(accountSASSignatureValues, sharedKeyCredential) - .sasQueryParameters; +function escapeURLPath(url) { + const urlParsed = new URL(url); + let path = urlParsed.pathname; + path = path || "/"; + path = escape(path); + urlParsed.pathname = path; + return urlParsed.toString(); } -function generateAccountSASQueryParametersInternal(accountSASSignatureValues, sharedKeyCredential) { - const version = accountSASSignatureValues.version - ? accountSASSignatureValues.version - : constants_js_1.SERVICE_VERSION; - if (accountSASSignatureValues.permissions && - accountSASSignatureValues.permissions.setImmutabilityPolicy && - version < "2020-08-04") { - throw RangeError("'version' must be >= '2020-08-04' when provided 'i' permission."); +function getProxyUriFromDevConnString(connectionString) { + // Development Connection String + // https://learn.microsoft.com/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key + let proxyUri = ""; + if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) { + // CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri + const matchCredentials = connectionString.split(";"); + for (const element of matchCredentials) { + if (element.trim().startsWith("DevelopmentStorageProxyUri=")) { + proxyUri = element.trim().match("DevelopmentStorageProxyUri=(.*)")[1]; + } + } } - if (accountSASSignatureValues.permissions && - accountSASSignatureValues.permissions.deleteVersion && - version < "2019-10-10") { - throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission."); + return proxyUri; +} +function getValueInConnString(connectionString, argument) { + const elements = connectionString.split(";"); + for (const element of elements) { + if (element.trim().startsWith(argument)) { + return element.trim().match(argument + "=(.*)")[1]; + } } - if (accountSASSignatureValues.permissions && - accountSASSignatureValues.permissions.permanentDelete && - version < "2019-10-10") { - throw RangeError("'version' must be >= '2019-10-10' when provided 'y' permission."); + return ""; +} +/** + * Extracts the parts of an Azure Storage account connection string. + * + * @param connectionString - Connection string. + * @returns String key value pairs of the storage account's url and credentials. + */ +function extractConnectionStringParts(connectionString) { + let proxyUri = ""; + if (connectionString.startsWith("UseDevelopmentStorage=true")) { + // Development connection string + proxyUri = getProxyUriFromDevConnString(connectionString); + connectionString = constants_js_1.DevelopmentConnectionString; } - if (accountSASSignatureValues.permissions && - accountSASSignatureValues.permissions.tag && - version < "2019-12-12") { - throw RangeError("'version' must be >= '2019-12-12' when provided 't' permission."); + // Matching BlobEndpoint in the Account connection string + let blobEndpoint = getValueInConnString(connectionString, "BlobEndpoint"); + // Slicing off '/' at the end if exists + // (The methods that use `extractConnectionStringParts` expect the url to not have `/` at the end) + blobEndpoint = blobEndpoint.endsWith("/") ? blobEndpoint.slice(0, -1) : blobEndpoint; + if (connectionString.search("DefaultEndpointsProtocol=") !== -1 && + connectionString.search("AccountKey=") !== -1) { + // Account connection string + let defaultEndpointsProtocol = ""; + let accountName = ""; + let accountKey = Buffer.from("accountKey", "base64"); + let endpointSuffix = ""; + // Get account name and key + accountName = getValueInConnString(connectionString, "AccountName"); + accountKey = Buffer.from(getValueInConnString(connectionString, "AccountKey"), "base64"); + if (!blobEndpoint) { + // BlobEndpoint is not present in the Account connection string + // Can be obtained from `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}` + defaultEndpointsProtocol = getValueInConnString(connectionString, "DefaultEndpointsProtocol"); + const protocol = defaultEndpointsProtocol.toLowerCase(); + if (protocol !== "https" && protocol !== "http") { + throw new Error("Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'"); + } + endpointSuffix = getValueInConnString(connectionString, "EndpointSuffix"); + if (!endpointSuffix) { + throw new Error("Invalid EndpointSuffix in the provided Connection String"); + } + blobEndpoint = `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; + } + if (!accountName) { + throw new Error("Invalid AccountName in the provided Connection String"); + } + else if (accountKey.length === 0) { + throw new Error("Invalid AccountKey in the provided Connection String"); + } + return { + kind: "AccountConnString", + url: blobEndpoint, + accountName, + accountKey, + proxyUri, + }; } - if (accountSASSignatureValues.permissions && - accountSASSignatureValues.permissions.filter && - version < "2019-12-12") { - throw RangeError("'version' must be >= '2019-12-12' when provided 'f' permission."); + else { + // SAS connection string + let accountSas = getValueInConnString(connectionString, "SharedAccessSignature"); + let accountName = getValueInConnString(connectionString, "AccountName"); + // if accountName is empty, try to read it from BlobEndpoint + if (!accountName) { + accountName = getAccountNameFromUrl(blobEndpoint); + } + if (!blobEndpoint) { + throw new Error("Invalid BlobEndpoint in the provided SAS Connection String"); + } + else if (!accountSas) { + throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String"); + } + // client constructors assume accountSas does *not* start with ? + if (accountSas.startsWith("?")) { + accountSas = accountSas.substring(1); + } + return { kind: "SASConnString", url: blobEndpoint, accountName, accountSas }; } - if (accountSASSignatureValues.encryptionScope && version < "2020-12-06") { - throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS."); +} +/** + * Internal escape method implemented Strategy Two mentioned in escapeURL() description. + * + * @param text - + */ +function escape(text) { + return encodeURIComponent(text) + .replace(/%2F/g, "/") // Don't escape for "/" + .replace(/'/g, "%27") // Escape for "'" + .replace(/\+/g, "%20") + .replace(/%25/g, "%"); // Revert encoded "%" +} +/** + * Append a string to URL path. Will remove duplicated "/" in front of the string + * when URL path ends with a "/". + * + * @param url - Source URL string + * @param name - String to be appended to URL + * @returns An updated URL string + */ +function appendToURLPath(url, name) { + const urlParsed = new URL(url); + let path = urlParsed.pathname; + path = path ? (path.endsWith("/") ? `${path}${name}` : `${path}/${name}`) : name; + urlParsed.pathname = path; + return urlParsed.toString(); +} +/** + * Set URL parameter name and value. If name exists in URL parameters, old value + * will be replaced by name key. If not provide value, the parameter will be deleted. + * + * @param url - Source URL string + * @param name - Parameter name + * @param value - Parameter value + * @returns An updated URL string + */ +function setURLParameter(url, name, value) { + const urlParsed = new URL(url); + const encodedName = encodeURIComponent(name); + const encodedValue = value ? encodeURIComponent(value) : undefined; + // mutating searchParams will change the encoding, so we have to do this ourselves + const searchString = urlParsed.search === "" ? "?" : urlParsed.search; + const searchPieces = []; + for (const pair of searchString.slice(1).split("&")) { + if (pair) { + const [key] = pair.split("=", 2); + if (key !== encodedName) { + searchPieces.push(pair); + } + } } - const parsedPermissions = AccountSASPermissions_js_1.AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString()); - const parsedServices = AccountSASServices_js_1.AccountSASServices.parse(accountSASSignatureValues.services).toString(); - const parsedResourceTypes = AccountSASResourceTypes_js_1.AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString(); - let stringToSign; - if (version >= "2020-12-06") { - stringToSign = [ - sharedKeyCredential.accountName, - parsedPermissions, - parsedServices, - parsedResourceTypes, - accountSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.startsOn, false) - : "", - (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.expiresOn, false), - accountSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(accountSASSignatureValues.ipRange) : "", - accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "", - version, - accountSASSignatureValues.encryptionScope ? accountSASSignatureValues.encryptionScope : "", - "", // Account SAS requires an additional newline character - ].join("\n"); + if (encodedValue) { + searchPieces.push(`${encodedName}=${encodedValue}`); + } + urlParsed.search = searchPieces.length ? `?${searchPieces.join("&")}` : ""; + return urlParsed.toString(); +} +/** + * Get URL parameter by name. + * + * @param url - + * @param name - + */ +function getURLParameter(url, name) { + const urlParsed = new URL(url); + return urlParsed.searchParams.get(name) ?? undefined; +} +/** + * Set URL host. + * + * @param url - Source URL string + * @param host - New host string + * @returns An updated URL string + */ +function setURLHost(url, host) { + const urlParsed = new URL(url); + urlParsed.hostname = host; + return urlParsed.toString(); +} +/** + * Get URL path from an URL string. + * + * @param url - Source URL string + */ +function getURLPath(url) { + try { + const urlParsed = new URL(url); + return urlParsed.pathname; + } + catch (e) { + return undefined; + } +} +/** + * Get URL scheme from an URL string. + * + * @param url - Source URL string + */ +function getURLScheme(url) { + try { + const urlParsed = new URL(url); + return urlParsed.protocol.endsWith(":") ? urlParsed.protocol.slice(0, -1) : urlParsed.protocol; + } + catch (e) { + return undefined; + } +} +/** + * Get URL path and query from an URL string. + * + * @param url - Source URL string + */ +function getURLPathAndQuery(url) { + const urlParsed = new URL(url); + const pathString = urlParsed.pathname; + if (!pathString) { + throw new RangeError("Invalid url without valid path."); + } + let queryString = urlParsed.search || ""; + queryString = queryString.trim(); + if (queryString !== "") { + queryString = queryString.startsWith("?") ? queryString : `?${queryString}`; // Ensure query string start with '?' + } + return `${pathString}${queryString}`; +} +/** + * Get URL query key value pairs from an URL string. + * + * @param url - + */ +function getURLQueries(url) { + let queryString = new URL(url).search; + if (!queryString) { + return {}; + } + queryString = queryString.trim(); + queryString = queryString.startsWith("?") ? queryString.substring(1) : queryString; + let querySubStrings = queryString.split("&"); + querySubStrings = querySubStrings.filter((value) => { + const indexOfEqual = value.indexOf("="); + const lastIndexOfEqual = value.lastIndexOf("="); + return (indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1); + }); + const queries = {}; + for (const querySubString of querySubStrings) { + const splitResults = querySubString.split("="); + const key = splitResults[0]; + const value = splitResults[1]; + queries[key] = value; + } + return queries; +} +/** + * Append a string to URL query. + * + * @param url - Source URL string. + * @param queryParts - String to be appended to the URL query. + * @returns An updated URL string. + */ +function appendToURLQuery(url, queryParts) { + const urlParsed = new URL(url); + let query = urlParsed.search; + if (query) { + query += "&" + queryParts; } else { - stringToSign = [ - sharedKeyCredential.accountName, - parsedPermissions, - parsedServices, - parsedResourceTypes, - accountSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.startsOn, false) - : "", - (0, utils_common_js_1.truncatedISO8061Date)(accountSASSignatureValues.expiresOn, false), - accountSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(accountSASSignatureValues.ipRange) : "", - accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "", - version, - "", // Account SAS requires an additional newline character - ].join("\n"); + query = queryParts; } - const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); - return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, accountSASSignatureValues.encryptionScope), - stringToSign: stringToSign, - }; + urlParsed.search = query; + return urlParsed.toString(); } -//# sourceMappingURL=AccountSASSignatureValues.js.map - -/***/ }), - -/***/ 87393: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BlobSASPermissions = void 0; /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. + * Rounds a date off to seconds. * - * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a blob. Setting - * a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all - * the values are set, this should be serialized with toString and set as the permissions field on a - * {@link BlobSASSignatureValues} object. It is possible to construct the permissions string without this class, but - * the order of the permissions is particular and this class guarantees correctness. + * @param date - + * @param withMilliseconds - If true, YYYY-MM-DDThh:mm:ss.fffffffZ will be returned; + * If false, YYYY-MM-DDThh:mm:ssZ will be returned. + * @returns Date string in ISO8061 format, with or without 7 milliseconds component */ -class BlobSASPermissions { - /** - * Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an - * Error if it encounters a character that does not correspond to a valid permission. - * - * @param permissions - - */ - static parse(permissions) { - const blobSASPermissions = new BlobSASPermissions(); - for (const char of permissions) { - switch (char) { - case "r": - blobSASPermissions.read = true; - break; - case "a": - blobSASPermissions.add = true; - break; - case "c": - blobSASPermissions.create = true; - break; - case "w": - blobSASPermissions.write = true; - break; - case "d": - blobSASPermissions.delete = true; - break; - case "x": - blobSASPermissions.deleteVersion = true; - break; - case "t": - blobSASPermissions.tag = true; - break; - case "m": - blobSASPermissions.move = true; - break; - case "e": - blobSASPermissions.execute = true; - break; - case "i": - blobSASPermissions.setImmutabilityPolicy = true; - break; - case "y": - blobSASPermissions.permanentDelete = true; - break; - default: - throw new RangeError(`Invalid permission: ${char}`); +function truncatedISO8061Date(date, withMilliseconds = true) { + // Date.toISOString() will return like "2018-10-29T06:34:36.139Z" + const dateString = date.toISOString(); + return withMilliseconds + ? dateString.substring(0, dateString.length - 1) + "0000" + "Z" + : dateString.substring(0, dateString.length - 5) + "Z"; +} +/** + * Base64 encode. + * + * @param content - + */ +function base64encode(content) { + return !core_util_1.isNodeLike ? btoa(content) : Buffer.from(content).toString("base64"); +} +/** + * Base64 decode. + * + * @param encodedString - + */ +function base64decode(encodedString) { + return !core_util_1.isNodeLike ? atob(encodedString) : Buffer.from(encodedString, "base64").toString(); +} +/** + * Generate a 64 bytes base64 block ID string. + * + * @param blockIndex - + */ +function generateBlockID(blockIDPrefix, blockIndex) { + // To generate a 64 bytes base64 string, source string should be 48 + const maxSourceStringLength = 48; + // A blob can have a maximum of 100,000 uncommitted blocks at any given time + const maxBlockIndexLength = 6; + const maxAllowedBlockIDPrefixLength = maxSourceStringLength - maxBlockIndexLength; + if (blockIDPrefix.length > maxAllowedBlockIDPrefixLength) { + blockIDPrefix = blockIDPrefix.slice(0, maxAllowedBlockIDPrefixLength); + } + const res = blockIDPrefix + + padStart(blockIndex.toString(), maxSourceStringLength - blockIDPrefix.length, "0"); + return base64encode(res); +} +/** + * Delay specified time interval. + * + * @param timeInMs - + * @param aborter - + * @param abortError - + */ +async function delay(timeInMs, aborter, abortError) { + return new Promise((resolve, reject) => { + /* eslint-disable-next-line prefer-const */ + let timeout; + const abortHandler = () => { + if (timeout !== undefined) { + clearTimeout(timeout); + } + reject(abortError); + }; + const resolveHandler = () => { + if (aborter !== undefined) { + aborter.removeEventListener("abort", abortHandler); } + resolve(); + }; + timeout = setTimeout(resolveHandler, timeInMs); + if (aborter !== undefined) { + aborter.addEventListener("abort", abortHandler); } - return blobSASPermissions; + }); +} +/** + * String.prototype.padStart() + * + * @param currentString - + * @param targetLength - + * @param padString - + */ +function padStart(currentString, targetLength, padString = " ") { + // @ts-expect-error: TS doesn't know this code needs to run downlevel sometimes + if (String.prototype.padStart) { + return currentString.padStart(targetLength, padString); } - /** - * Creates a {@link BlobSASPermissions} from a raw object which contains same keys as it - * and boolean values for them. - * - * @param permissionLike - - */ - static from(permissionLike) { - const blobSASPermissions = new BlobSASPermissions(); - if (permissionLike.read) { - blobSASPermissions.read = true; - } - if (permissionLike.add) { - blobSASPermissions.add = true; - } - if (permissionLike.create) { - blobSASPermissions.create = true; - } - if (permissionLike.write) { - blobSASPermissions.write = true; - } - if (permissionLike.delete) { - blobSASPermissions.delete = true; - } - if (permissionLike.deleteVersion) { - blobSASPermissions.deleteVersion = true; - } - if (permissionLike.tag) { - blobSASPermissions.tag = true; - } - if (permissionLike.move) { - blobSASPermissions.move = true; - } - if (permissionLike.execute) { - blobSASPermissions.execute = true; - } - if (permissionLike.setImmutabilityPolicy) { - blobSASPermissions.setImmutabilityPolicy = true; - } - if (permissionLike.permanentDelete) { - blobSASPermissions.permanentDelete = true; - } - return blobSASPermissions; + padString = padString || " "; + if (currentString.length > targetLength) { + return currentString; } - /** - * Specifies Read access granted. - */ - read = false; - /** - * Specifies Add access granted. - */ - add = false; - /** - * Specifies Create access granted. - */ - create = false; - /** - * Specifies Write access granted. - */ - write = false; - /** - * Specifies Delete access granted. - */ - delete = false; - /** - * Specifies Delete version access granted. - */ - deleteVersion = false; - /** - * Specfies Tag access granted. - */ - tag = false; - /** - * Specifies Move access granted. - */ - move = false; - /** - * Specifies Execute access granted. - */ - execute = false; - /** - * Specifies SetImmutabilityPolicy access granted. - */ - setImmutabilityPolicy = false; - /** - * Specifies that Permanent Delete is permitted. - */ - permanentDelete = false; - /** - * Converts the given permissions to a string. Using this method will guarantee the permissions are in an - * order accepted by the service. - * - * @returns A string which represents the BlobSASPermissions - */ - toString() { - const permissions = []; - if (this.read) { - permissions.push("r"); - } - if (this.add) { - permissions.push("a"); - } - if (this.create) { - permissions.push("c"); + else { + targetLength = targetLength - currentString.length; + if (targetLength > padString.length) { + padString += padString.repeat(targetLength / padString.length); } - if (this.write) { - permissions.push("w"); + return padString.slice(0, targetLength) + currentString; + } +} +function sanitizeURL(url) { + let safeURL = url; + if (getURLParameter(safeURL, constants_js_1.URLConstants.Parameters.SIGNATURE)) { + safeURL = setURLParameter(safeURL, constants_js_1.URLConstants.Parameters.SIGNATURE, "*****"); + } + return safeURL; +} +function sanitizeHeaders(originalHeader) { + const headers = (0, core_rest_pipeline_1.createHttpHeaders)(); + for (const [name, value] of originalHeader) { + if (name.toLowerCase() === constants_js_1.HeaderConstants.AUTHORIZATION.toLowerCase()) { + headers.set(name, "*****"); } - if (this.delete) { - permissions.push("d"); + else if (name.toLowerCase() === constants_js_1.HeaderConstants.X_MS_COPY_SOURCE) { + headers.set(name, sanitizeURL(value)); } - if (this.deleteVersion) { - permissions.push("x"); + else { + headers.set(name, value); } - if (this.tag) { - permissions.push("t"); + } + return headers; +} +/** + * If two strings are equal when compared case insensitive. + * + * @param str1 - + * @param str2 - + */ +function iEqual(str1, str2) { + return str1.toLocaleLowerCase() === str2.toLocaleLowerCase(); +} +/** + * Extracts account name from the url + * @param url - url to extract the account name from + * @returns with the account name + */ +function getAccountNameFromUrl(url) { + const parsedUrl = new URL(url); + let accountName; + try { + if (parsedUrl.hostname.split(".")[1] === "blob") { + // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; + accountName = parsedUrl.hostname.split(".")[0]; } - if (this.move) { - permissions.push("m"); + else if (isIpEndpointStyle(parsedUrl)) { + // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/ + // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/ + // .getPath() -> /devstoreaccount1/ + accountName = parsedUrl.pathname.split("/")[1]; } - if (this.execute) { - permissions.push("e"); + else { + // Custom domain case: "https://customdomain.com/containername/blob". + accountName = ""; } - if (this.setImmutabilityPolicy) { - permissions.push("i"); + return accountName; + } + catch (error) { + throw new Error("Unable to extract accountName with provided information."); + } +} +function isIpEndpointStyle(parsedUrl) { + const host = parsedUrl.host; + // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'. + // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part. + // Case 3: Ipv4, use broad regex which just check if host contains Ipv4. + // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html. + return (/^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) || + (Boolean(parsedUrl.port) && constants_js_1.PathStylePorts.includes(parsedUrl.port))); +} +/** + * Convert Tags to encoded string. + * + * @param tags - + */ +function toBlobTagsString(tags) { + if (tags === undefined) { + return undefined; + } + const tagPairs = []; + for (const key in tags) { + if (Object.prototype.hasOwnProperty.call(tags, key)) { + const value = tags[key]; + tagPairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`); } - if (this.permanentDelete) { - permissions.push("y"); + } + return tagPairs.join("&"); +} +/** + * Convert Tags type to BlobTags. + * + * @param tags - + */ +function toBlobTags(tags) { + if (tags === undefined) { + return undefined; + } + const res = { + blobTagSet: [], + }; + for (const key in tags) { + if (Object.prototype.hasOwnProperty.call(tags, key)) { + const value = tags[key]; + res.blobTagSet.push({ + key, + value, + }); } - return permissions.join(""); } + return res; } -exports.BlobSASPermissions = BlobSASPermissions; -//# sourceMappingURL=BlobSASPermissions.js.map - -/***/ }), - -/***/ 48921: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.generateBlobSASQueryParameters = generateBlobSASQueryParameters; -exports.generateBlobSASQueryParametersInternal = generateBlobSASQueryParametersInternal; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const BlobSASPermissions_js_1 = __nccwpck_require__(87393); -const ContainerSASPermissions_js_1 = __nccwpck_require__(27579); -const StorageSharedKeyCredential_js_1 = __nccwpck_require__(59155); -const UserDelegationKeyCredential_js_1 = __nccwpck_require__(50822); -const SasIPRange_js_1 = __nccwpck_require__(80914); -const SASQueryParameters_js_1 = __nccwpck_require__(21969); -const constants_js_1 = __nccwpck_require__(81865); -const utils_common_js_1 = __nccwpck_require__(16673); -function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName) { - return generateBlobSASQueryParametersInternal(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName).sasQueryParameters; +/** + * Covert BlobTags to Tags type. + * + * @param tags - + */ +function toTags(tags) { + if (tags === undefined) { + return undefined; + } + const res = {}; + for (const blobTag of tags.blobTagSet) { + res[blobTag.key] = blobTag.value; + } + return res; } -function generateBlobSASQueryParametersInternal(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName) { - const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : constants_js_1.SERVICE_VERSION; - const sharedKeyCredential = sharedKeyCredentialOrUserDelegationKey instanceof StorageSharedKeyCredential_js_1.StorageSharedKeyCredential - ? sharedKeyCredentialOrUserDelegationKey - : undefined; - let userDelegationKeyCredential; - if (sharedKeyCredential === undefined && accountName !== undefined) { - userDelegationKeyCredential = new UserDelegationKeyCredential_js_1.UserDelegationKeyCredential(accountName, sharedKeyCredentialOrUserDelegationKey); +/** + * Convert BlobQueryTextConfiguration to QuerySerialization type. + * + * @param textConfiguration - + */ +function toQuerySerialization(textConfiguration) { + if (textConfiguration === undefined) { + return undefined; + } + switch (textConfiguration.kind) { + case "csv": + return { + format: { + type: "delimited", + delimitedTextConfiguration: { + columnSeparator: textConfiguration.columnSeparator || ",", + fieldQuote: textConfiguration.fieldQuote || "", + recordSeparator: textConfiguration.recordSeparator, + escapeChar: textConfiguration.escapeCharacter || "", + headersPresent: textConfiguration.hasHeaders || false, + }, + }, + }; + case "json": + return { + format: { + type: "json", + jsonTextConfiguration: { + recordSeparator: textConfiguration.recordSeparator, + }, + }, + }; + case "arrow": + return { + format: { + type: "arrow", + arrowConfiguration: { + schema: textConfiguration.schema, + }, + }, + }; + case "parquet": + return { + format: { + type: "parquet", + }, + }; + default: + throw Error("Invalid BlobQueryTextConfiguration."); } - if (sharedKeyCredential === undefined && userDelegationKeyCredential === undefined) { - throw TypeError("Invalid sharedKeyCredential, userDelegationKey or accountName."); +} +function parseObjectReplicationRecord(objectReplicationRecord) { + if (!objectReplicationRecord) { + return undefined; } - // Version 2020-12-06 adds support for encryptionscope in SAS. - if (version >= "2020-12-06") { - if (sharedKeyCredential !== undefined) { - return generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential); - } - else { - if (version >= "2025-07-05") { - return generateBlobSASQueryParametersUDK20250705(blobSASSignatureValues, userDelegationKeyCredential); - } - else { - return generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential); - } - } + if ("policy-id" in objectReplicationRecord) { + // If the dictionary contains a key with policy id, we are not required to do any parsing since + // the policy id should already be stored in the ObjectReplicationDestinationPolicyId. + return undefined; } - // Version 2019-12-12 adds support for the blob tags permission. - // Version 2018-11-09 adds support for the signed resource and signed blob snapshot time fields. - // https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string - if (version >= "2018-11-09") { - if (sharedKeyCredential !== undefined) { - return generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential); - } - else { - // Version 2020-02-10 delegation SAS signature construction includes preauthorizedAgentObjectId, agentObjectId, correlationId. - if (version >= "2020-02-10") { - return generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential); - } - else { - return generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential); - } + const orProperties = []; + for (const key in objectReplicationRecord) { + const ids = key.split("_"); + const policyPrefix = "or-"; + if (ids[0].startsWith(policyPrefix)) { + ids[0] = ids[0].substring(policyPrefix.length); } - } - if (version >= "2015-04-05") { - if (sharedKeyCredential !== undefined) { - return generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential); + const rule = { + ruleId: ids[1], + replicationStatus: objectReplicationRecord[key], + }; + const policyIndex = orProperties.findIndex((policy) => policy.policyId === ids[0]); + if (policyIndex > -1) { + orProperties[policyIndex].rules.push(rule); } else { - throw new RangeError("'version' must be >= '2018-11-09' when generating user delegation SAS using user delegation key."); + orProperties.push({ + policyId: ids[0], + rules: [rule], + }); } } - throw new RangeError("'version' must be >= '2015-04-05'."); + return orProperties; } /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * IMPLEMENTATION FOR API VERSION FROM 2015-04-05 AND BEFORE 2018-11-09. - * - * Creates an instance of SASQueryParameters. - * - * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn and identifier. - * - * WARNING: When identifier is not provided, permissions and expiresOn are required. - * You MUST assign value to identifier or expiresOn & permissions manually if you initial with - * this constructor. + * Attach a TokenCredential to an object. * - * @param blobSASSignatureValues - - * @param sharedKeyCredential - + * @param thing - + * @param credential - */ -function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKeyCredential) { - blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); - if (!blobSASSignatureValues.identifier && - !(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) { - throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); - } - let resource = "c"; - if (blobSASSignatureValues.blobName) { - resource = "b"; +function attachCredential(thing, credential) { + thing.credential = credential; + return thing; +} +function httpAuthorizationToString(httpAuthorization) { + return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined; +} +function BlobNameToString(name) { + if (name.encoded) { + return decodeURIComponent(name.content); } - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - let verifiedPermissions; - if (blobSASSignatureValues.permissions) { - if (blobSASSignatureValues.blobName) { - verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } - else { - verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } + else { + return name.content; } - // Signature is generated on the un-url-encoded values. - const stringToSign = [ - verifiedPermissions ? verifiedPermissions : "", - blobSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) - : "", - blobSASSignatureValues.expiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) - : "", - getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), - blobSASSignatureValues.identifier, - blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", - blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - blobSASSignatureValues.version, - blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", - blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", - blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", - blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "", - blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "", - ].join("\n"); - const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); +} +function ConvertInternalResponseOfListBlobFlat(internalResponse) { return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType), - stringToSign: stringToSign, + ...internalResponse, + segment: { + blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => { + const blobItem = { + ...blobItemInteral, + name: BlobNameToString(blobItemInteral.name), + }; + return blobItem; + }), + }, }; } -/** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * IMPLEMENTATION FOR API VERSION FROM 2018-11-09. - * - * Creates an instance of SASQueryParameters. - * - * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn and identifier. - * - * WARNING: When identifier is not provided, permissions and expiresOn are required. - * You MUST assign value to identifier or expiresOn & permissions manually if you initial with - * this constructor. - * - * @param blobSASSignatureValues - - * @param sharedKeyCredential - - */ -function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKeyCredential) { - blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); - if (!blobSASSignatureValues.identifier && - !(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) { - throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); - } - let resource = "c"; - let timestamp = blobSASSignatureValues.snapshotTime; - if (blobSASSignatureValues.blobName) { - resource = "b"; - if (blobSASSignatureValues.snapshotTime) { - resource = "bs"; - } - else if (blobSASSignatureValues.versionId) { - resource = "bv"; - timestamp = blobSASSignatureValues.versionId; - } - } - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - let verifiedPermissions; - if (blobSASSignatureValues.permissions) { - if (blobSASSignatureValues.blobName) { - verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); +function ConvertInternalResponseOfListBlobHierarchy(internalResponse) { + return { + ...internalResponse, + segment: { + blobPrefixes: internalResponse.segment.blobPrefixes?.map((blobPrefixInternal) => { + const blobPrefix = { + ...blobPrefixInternal, + name: BlobNameToString(blobPrefixInternal.name), + }; + return blobPrefix; + }), + blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => { + const blobItem = { + ...blobItemInteral, + name: BlobNameToString(blobItemInteral.name), + }; + return blobItem; + }), + }, + }; +} +function* ExtractPageRangeInfoItems(getPageRangesSegment) { + let pageRange = []; + let clearRange = []; + if (getPageRangesSegment.pageRange) + pageRange = getPageRangesSegment.pageRange; + if (getPageRangesSegment.clearRange) + clearRange = getPageRangesSegment.clearRange; + let pageRangeIndex = 0; + let clearRangeIndex = 0; + while (pageRangeIndex < pageRange.length && clearRangeIndex < clearRange.length) { + if (pageRange[pageRangeIndex].start < clearRange[clearRangeIndex].start) { + yield { + start: pageRange[pageRangeIndex].start, + end: pageRange[pageRangeIndex].end, + isClear: false, + }; + ++pageRangeIndex; } else { - verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + yield { + start: clearRange[clearRangeIndex].start, + end: clearRange[clearRangeIndex].end, + isClear: true, + }; + ++clearRangeIndex; } } - // Signature is generated on the un-url-encoded values. - const stringToSign = [ - verifiedPermissions ? verifiedPermissions : "", - blobSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) - : "", - blobSASSignatureValues.expiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) - : "", - getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), - blobSASSignatureValues.identifier, - blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", - blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - blobSASSignatureValues.version, - resource, - timestamp, - blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", - blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", - blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", - blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "", - blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "", - ].join("\n"); - const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); - return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType), - stringToSign: stringToSign, - }; + for (; pageRangeIndex < pageRange.length; ++pageRangeIndex) { + yield { + start: pageRange[pageRangeIndex].start, + end: pageRange[pageRangeIndex].end, + isClear: false, + }; + } + for (; clearRangeIndex < clearRange.length; ++clearRangeIndex) { + yield { + start: clearRange[clearRangeIndex].start, + end: clearRange[clearRangeIndex].end, + isClear: true, + }; + } } /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * IMPLEMENTATION FOR API VERSION FROM 2020-12-06. - * - * Creates an instance of SASQueryParameters. - * - * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn and identifier. - * - * WARNING: When identifier is not provided, permissions and expiresOn are required. - * You MUST assign value to identifier or expiresOn & permissions manually if you initial with - * this constructor. - * - * @param blobSASSignatureValues - - * @param sharedKeyCredential - + * Escape the blobName but keep path separator ('/'). */ -function generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential) { - blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); - if (!blobSASSignatureValues.identifier && - !(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) { - throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided."); - } - let resource = "c"; - let timestamp = blobSASSignatureValues.snapshotTime; - if (blobSASSignatureValues.blobName) { - resource = "b"; - if (blobSASSignatureValues.snapshotTime) { - resource = "bs"; - } - else if (blobSASSignatureValues.versionId) { - resource = "bv"; - timestamp = blobSASSignatureValues.versionId; - } +function EscapePath(blobName) { + const split = blobName.split("/"); + for (let i = 0; i < split.length; i++) { + split[i] = encodeURIComponent(split[i]); } - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - let verifiedPermissions; - if (blobSASSignatureValues.permissions) { - if (blobSASSignatureValues.blobName) { - verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } - else { - verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } + return split.join("/"); +} +/** + * A typesafe helper for ensuring that a given response object has + * the original _response attached. + * @param response - A response object from calling a client operation + * @returns The same object, but with known _response property + */ +function assertResponse(response) { + if (`_response` in response) { + return response; } - // Signature is generated on the un-url-encoded values. - const stringToSign = [ - verifiedPermissions ? verifiedPermissions : "", - blobSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) - : "", - blobSASSignatureValues.expiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) - : "", - getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), - blobSASSignatureValues.identifier, - blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", - blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - blobSASSignatureValues.version, - resource, - timestamp, - blobSASSignatureValues.encryptionScope, - blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "", - blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "", - blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "", - blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "", - blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "", - ].join("\n"); - const signature = sharedKeyCredential.computeHMACSHA256(stringToSign); - return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, undefined, undefined, undefined, blobSASSignatureValues.encryptionScope), - stringToSign: stringToSign, - }; + throw new TypeError(`Unexpected response object ${response}`); } +//# sourceMappingURL=utils.common.js.map + +/***/ }), + +/***/ 85157: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fsCreateReadStream = exports.fsStat = void 0; +exports.streamToBuffer = streamToBuffer; +exports.streamToBuffer2 = streamToBuffer2; +exports.streamToBuffer3 = streamToBuffer3; +exports.readStreamToLocalFile = readStreamToLocalFile; +const tslib_1 = __nccwpck_require__(4351); +const node_fs_1 = tslib_1.__importDefault(__nccwpck_require__(87561)); +const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(47261)); +const constants_js_1 = __nccwpck_require__(81865); /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * IMPLEMENTATION FOR API VERSION FROM 2018-11-09. - * - * Creates an instance of SASQueryParameters. - * - * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn. + * Reads a readable stream into buffer. Fill the buffer from offset to end. * - * WARNING: identifier will be ignored, permissions and expiresOn are required. + * @param stream - A Node.js Readable stream + * @param buffer - Buffer to be filled, length must greater than or equal to offset + * @param offset - From which position in the buffer to be filled, inclusive + * @param end - To which position in the buffer to be filled, exclusive + * @param encoding - Encoding of the Readable stream + */ +async function streamToBuffer(stream, buffer, offset, end, encoding) { + let pos = 0; // Position in stream + const count = end - offset; // Total amount of data needed in stream + return new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error(`The operation cannot be completed in timeout.`)), constants_js_1.REQUEST_TIMEOUT); + stream.on("readable", () => { + if (pos >= count) { + clearTimeout(timeout); + resolve(); + return; + } + let chunk = stream.read(); + if (!chunk) { + return; + } + if (typeof chunk === "string") { + chunk = Buffer.from(chunk, encoding); + } + // How much data needed in this chunk + const chunkLength = pos + chunk.length > count ? count - pos : chunk.length; + buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); + pos += chunkLength; + }); + stream.on("end", () => { + clearTimeout(timeout); + if (pos < count) { + reject(new Error(`Stream drains before getting enough data needed. Data read: ${pos}, data need: ${count}`)); + } + resolve(); + }); + stream.on("error", (msg) => { + clearTimeout(timeout); + reject(msg); + }); + }); +} +/** + * Reads a readable stream into buffer entirely. * - * @param blobSASSignatureValues - - * @param userDelegationKeyCredential - + * @param stream - A Node.js Readable stream + * @param buffer - Buffer to be filled, length must greater than or equal to offset + * @param encoding - Encoding of the Readable stream + * @returns with the count of bytes read. + * @throws `RangeError` If buffer size is not big enough. */ -function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userDelegationKeyCredential) { - blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); - // Stored access policies are not supported for a user delegation SAS. - if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { - throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); - } - let resource = "c"; - let timestamp = blobSASSignatureValues.snapshotTime; - if (blobSASSignatureValues.blobName) { - resource = "b"; - if (blobSASSignatureValues.snapshotTime) { - resource = "bs"; - } - else if (blobSASSignatureValues.versionId) { - resource = "bv"; - timestamp = blobSASSignatureValues.versionId; - } - } - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - let verifiedPermissions; - if (blobSASSignatureValues.permissions) { - if (blobSASSignatureValues.blobName) { - verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } - else { - verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } - } - // Signature is generated on the un-url-encoded values. - const stringToSign = [ - verifiedPermissions ? verifiedPermissions : "", - blobSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) - : "", - blobSASSignatureValues.expiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) - : "", - getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), - userDelegationKeyCredential.userDelegationKey.signedObjectId, - userDelegationKeyCredential.userDelegationKey.signedTenantId, - userDelegationKeyCredential.userDelegationKey.signedStartsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedExpiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedService, - userDelegationKeyCredential.userDelegationKey.signedVersion, - blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", - blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - blobSASSignatureValues.version, - resource, - timestamp, - blobSASSignatureValues.cacheControl, - blobSASSignatureValues.contentDisposition, - blobSASSignatureValues.contentEncoding, - blobSASSignatureValues.contentLanguage, - blobSASSignatureValues.contentType, - ].join("\n"); - const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); - return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey), - stringToSign: stringToSign, - }; +async function streamToBuffer2(stream, buffer, encoding) { + let pos = 0; // Position in stream + const bufferSize = buffer.length; + return new Promise((resolve, reject) => { + stream.on("readable", () => { + let chunk = stream.read(); + if (!chunk) { + return; + } + if (typeof chunk === "string") { + chunk = Buffer.from(chunk, encoding); + } + if (pos + chunk.length > bufferSize) { + reject(new Error(`Stream exceeds buffer size. Buffer size: ${bufferSize}`)); + return; + } + buffer.fill(chunk, pos, pos + chunk.length); + pos += chunk.length; + }); + stream.on("end", () => { + resolve(pos); + }); + stream.on("error", reject); + }); } /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * IMPLEMENTATION FOR API VERSION FROM 2020-02-10. - * - * Creates an instance of SASQueryParameters. - * - * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn. - * - * WARNING: identifier will be ignored, permissions and expiresOn are required. + * Reads a readable stream into a buffer. * - * @param blobSASSignatureValues - - * @param userDelegationKeyCredential - + * @param stream - A Node.js Readable stream + * @param encoding - Encoding of the Readable stream + * @returns with the count of bytes read. */ -function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userDelegationKeyCredential) { - blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); - // Stored access policies are not supported for a user delegation SAS. - if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { - throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); - } - let resource = "c"; - let timestamp = blobSASSignatureValues.snapshotTime; - if (blobSASSignatureValues.blobName) { - resource = "b"; - if (blobSASSignatureValues.snapshotTime) { - resource = "bs"; - } - else if (blobSASSignatureValues.versionId) { - resource = "bv"; - timestamp = blobSASSignatureValues.versionId; - } - } - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - let verifiedPermissions; - if (blobSASSignatureValues.permissions) { - if (blobSASSignatureValues.blobName) { - verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } - else { - verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } - } - // Signature is generated on the un-url-encoded values. - const stringToSign = [ - verifiedPermissions ? verifiedPermissions : "", - blobSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) - : "", - blobSASSignatureValues.expiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) - : "", - getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), - userDelegationKeyCredential.userDelegationKey.signedObjectId, - userDelegationKeyCredential.userDelegationKey.signedTenantId, - userDelegationKeyCredential.userDelegationKey.signedStartsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedExpiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedService, - userDelegationKeyCredential.userDelegationKey.signedVersion, - blobSASSignatureValues.preauthorizedAgentObjectId, - undefined, // agentObjectId - blobSASSignatureValues.correlationId, - blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", - blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - blobSASSignatureValues.version, - resource, - timestamp, - blobSASSignatureValues.cacheControl, - blobSASSignatureValues.contentDisposition, - blobSASSignatureValues.contentEncoding, - blobSASSignatureValues.contentLanguage, - blobSASSignatureValues.contentType, - ].join("\n"); - const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); - return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId), - stringToSign: stringToSign, - }; +async function streamToBuffer3(readableStream, encoding) { + return new Promise((resolve, reject) => { + const chunks = []; + readableStream.on("data", (data) => { + chunks.push(typeof data === "string" ? Buffer.from(data, encoding) : data); + }); + readableStream.on("end", () => { + resolve(Buffer.concat(chunks)); + }); + readableStream.on("error", reject); + }); } /** * ONLY AVAILABLE IN NODE.JS RUNTIME. - * IMPLEMENTATION FOR API VERSION FROM 2020-12-06. * - * Creates an instance of SASQueryParameters. + * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed. * - * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn. + * @param rs - The read stream. + * @param file - Destination file path. + */ +async function readStreamToLocalFile(rs, file) { + return new Promise((resolve, reject) => { + const ws = node_fs_1.default.createWriteStream(file); + rs.on("error", (err) => { + reject(err); + }); + ws.on("error", (err) => { + reject(err); + }); + ws.on("close", resolve); + rs.pipe(ws); + }); +} +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. * - * WARNING: identifier will be ignored, permissions and expiresOn are required. + * Promisified version of fs.stat(). + */ +exports.fsStat = node_util_1.default.promisify(node_fs_1.default.stat); +exports.fsCreateReadStream = node_fs_1.default.createReadStream; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 58412: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbortError = void 0; +/** + * This error is thrown when an asynchronous operation has been aborted. + * Check for this error by testing the `name` that the name property of the + * error matches `"AbortError"`. * - * @param blobSASSignatureValues - - * @param userDelegationKeyCredential - + * @example + * ```ts + * const controller = new AbortController(); + * controller.abort(); + * try { + * doAsyncWork(controller.signal) + * } catch (e) { + * if (e.name === 'AbortError') { + * // handle abort error here. + * } + * } + * ``` */ -function generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential) { - blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); - // Stored access policies are not supported for a user delegation SAS. - if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { - throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); - } - let resource = "c"; - let timestamp = blobSASSignatureValues.snapshotTime; - if (blobSASSignatureValues.blobName) { - resource = "b"; - if (blobSASSignatureValues.snapshotTime) { - resource = "bs"; - } - else if (blobSASSignatureValues.versionId) { - resource = "bv"; - timestamp = blobSASSignatureValues.versionId; - } - } - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - let verifiedPermissions; - if (blobSASSignatureValues.permissions) { - if (blobSASSignatureValues.blobName) { - verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } - else { - verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); - } +class AbortError extends Error { + constructor(message) { + super(message); + this.name = "AbortError"; } - // Signature is generated on the un-url-encoded values. - const stringToSign = [ - verifiedPermissions ? verifiedPermissions : "", - blobSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) - : "", - blobSASSignatureValues.expiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) - : "", - getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), - userDelegationKeyCredential.userDelegationKey.signedObjectId, - userDelegationKeyCredential.userDelegationKey.signedTenantId, - userDelegationKeyCredential.userDelegationKey.signedStartsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedExpiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedService, - userDelegationKeyCredential.userDelegationKey.signedVersion, - blobSASSignatureValues.preauthorizedAgentObjectId, - undefined, // agentObjectId - blobSASSignatureValues.correlationId, - blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", - blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - blobSASSignatureValues.version, - resource, - timestamp, - blobSASSignatureValues.encryptionScope, - blobSASSignatureValues.cacheControl, - blobSASSignatureValues.contentDisposition, - blobSASSignatureValues.contentEncoding, - blobSASSignatureValues.contentLanguage, - blobSASSignatureValues.contentType, - ].join("\n"); - const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); - return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope), - stringToSign: stringToSign, - }; } +exports.AbortError = AbortError; +//# sourceMappingURL=AbortError.js.map + +/***/ }), + +/***/ 1753: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbortError = void 0; +var AbortError_js_1 = __nccwpck_require__(58412); +Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 80974: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BufferScheduler = void 0; +const events_1 = __nccwpck_require__(82361); +const PooledBuffer_js_1 = __nccwpck_require__(39474); /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * IMPLEMENTATION FOR API VERSION FROM 2020-12-06. + * This class accepts a Node.js Readable stream as input, and keeps reading data + * from the stream into the internal buffer structure, until it reaches maxBuffers. + * Every available buffer will try to trigger outgoingHandler. * - * Creates an instance of SASQueryParameters. + * The internal buffer structure includes an incoming buffer array, and a outgoing + * buffer array. The incoming buffer array includes the "empty" buffers can be filled + * with new incoming data. The outgoing array includes the filled buffers to be + * handled by outgoingHandler. Every above buffer size is defined by parameter bufferSize. * - * Only accepts required settings needed to create a SAS. For optional settings please - * set corresponding properties directly, such as permissions, startsOn. + * NUM_OF_ALL_BUFFERS = BUFFERS_IN_INCOMING + BUFFERS_IN_OUTGOING + BUFFERS_UNDER_HANDLING * - * WARNING: identifier will be ignored, permissions and expiresOn are required. + * NUM_OF_ALL_BUFFERS lesser than or equal to maxBuffers * - * @param blobSASSignatureValues - - * @param userDelegationKeyCredential - + * PERFORMANCE IMPROVEMENT TIPS: + * 1. Input stream highWaterMark is better to set a same value with bufferSize + * parameter, which will avoid Buffer.concat() operations. + * 2. concurrency should set a smaller value than maxBuffers, which is helpful to + * reduce the possibility when a outgoing handler waits for the stream data. + * in this situation, outgoing handlers are blocked. + * Outgoing queue shouldn't be empty. */ -function generateBlobSASQueryParametersUDK20250705(blobSASSignatureValues, userDelegationKeyCredential) { - blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues); - // Stored access policies are not supported for a user delegation SAS. - if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) { - throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS."); - } - let resource = "c"; - let timestamp = blobSASSignatureValues.snapshotTime; - if (blobSASSignatureValues.blobName) { - resource = "b"; - if (blobSASSignatureValues.snapshotTime) { - resource = "bs"; - } - else if (blobSASSignatureValues.versionId) { - resource = "bv"; - timestamp = blobSASSignatureValues.versionId; +class BufferScheduler { + /** + * Size of buffers in incoming and outgoing queues. This class will try to align + * data read from Readable stream into buffer chunks with bufferSize defined. + */ + bufferSize; + /** + * How many buffers can be created or maintained. + */ + maxBuffers; + /** + * A Node.js Readable stream. + */ + readable; + /** + * OutgoingHandler is an async function triggered by BufferScheduler when there + * are available buffers in outgoing array. + */ + outgoingHandler; + /** + * An internal event emitter. + */ + emitter = new events_1.EventEmitter(); + /** + * Concurrency of executing outgoingHandlers. (0 lesser than concurrency lesser than or equal to maxBuffers) + */ + concurrency; + /** + * An internal offset marker to track data offset in bytes of next outgoingHandler. + */ + offset = 0; + /** + * An internal marker to track whether stream is end. + */ + isStreamEnd = false; + /** + * An internal marker to track whether stream or outgoingHandler returns error. + */ + isError = false; + /** + * How many handlers are executing. + */ + executingOutgoingHandlers = 0; + /** + * Encoding of the input Readable stream which has string data type instead of Buffer. + */ + encoding; + /** + * How many buffers have been allocated. + */ + numBuffers = 0; + /** + * Because this class doesn't know how much data every time stream pops, which + * is defined by highWaterMarker of the stream. So BufferScheduler will cache + * data received from the stream, when data in unresolvedDataArray exceeds the + * blockSize defined, it will try to concat a blockSize of buffer, fill into available + * buffers from incoming and push to outgoing array. + */ + unresolvedDataArray = []; + /** + * How much data consisted in unresolvedDataArray. + */ + unresolvedLength = 0; + /** + * The array includes all the available buffers can be used to fill data from stream. + */ + incoming = []; + /** + * The array (queue) includes all the buffers filled from stream data. + */ + outgoing = []; + /** + * Creates an instance of BufferScheduler. + * + * @param readable - A Node.js Readable stream + * @param bufferSize - Buffer size of every maintained buffer + * @param maxBuffers - How many buffers can be allocated + * @param outgoingHandler - An async function scheduled to be + * triggered when a buffer fully filled + * with stream data + * @param concurrency - Concurrency of executing outgoingHandlers (>0) + * @param encoding - [Optional] Encoding of Readable stream when it's a string stream + */ + constructor(readable, bufferSize, maxBuffers, outgoingHandler, concurrency, encoding) { + if (bufferSize <= 0) { + throw new RangeError(`bufferSize must be larger than 0, current is ${bufferSize}`); } - } - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - let verifiedPermissions; - if (blobSASSignatureValues.permissions) { - if (blobSASSignatureValues.blobName) { - verifiedPermissions = BlobSASPermissions_js_1.BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + if (maxBuffers <= 0) { + throw new RangeError(`maxBuffers must be larger than 0, current is ${maxBuffers}`); } - else { - verifiedPermissions = ContainerSASPermissions_js_1.ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString(); + if (concurrency <= 0) { + throw new RangeError(`concurrency must be larger than 0, current is ${concurrency}`); } + this.bufferSize = bufferSize; + this.maxBuffers = maxBuffers; + this.readable = readable; + this.outgoingHandler = outgoingHandler; + this.concurrency = concurrency; + this.encoding = encoding; } - // Signature is generated on the un-url-encoded values. - const stringToSign = [ - verifiedPermissions ? verifiedPermissions : "", - blobSASSignatureValues.startsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.startsOn, false) - : "", - blobSASSignatureValues.expiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(blobSASSignatureValues.expiresOn, false) - : "", - getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName), - userDelegationKeyCredential.userDelegationKey.signedObjectId, - userDelegationKeyCredential.userDelegationKey.signedTenantId, - userDelegationKeyCredential.userDelegationKey.signedStartsOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedExpiresOn - ? (0, utils_common_js_1.truncatedISO8061Date)(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false) - : "", - userDelegationKeyCredential.userDelegationKey.signedService, - userDelegationKeyCredential.userDelegationKey.signedVersion, - blobSASSignatureValues.preauthorizedAgentObjectId, - undefined, // agentObjectId - blobSASSignatureValues.correlationId, - undefined, // SignedKeyDelegatedUserTenantId, will be added in a future release. - undefined, // SignedDelegatedUserObjectId, will be added in future release. - blobSASSignatureValues.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(blobSASSignatureValues.ipRange) : "", - blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "", - blobSASSignatureValues.version, - resource, - timestamp, - blobSASSignatureValues.encryptionScope, - blobSASSignatureValues.cacheControl, - blobSASSignatureValues.contentDisposition, - blobSASSignatureValues.contentEncoding, - blobSASSignatureValues.contentLanguage, - blobSASSignatureValues.contentType, - ].join("\n"); - const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign); - return { - sasQueryParameters: new SASQueryParameters_js_1.SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope), - stringToSign: stringToSign, - }; -} -function getCanonicalName(accountName, containerName, blobName) { - // Container: "/blob/account/containerName" - // Blob: "/blob/account/containerName/blobName" - const elements = [`/blob/${accountName}/${containerName}`]; - if (blobName) { - elements.push(`/${blobName}`); - } - return elements.join(""); -} -function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) { - const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : constants_js_1.SERVICE_VERSION; - if (blobSASSignatureValues.snapshotTime && version < "2018-11-09") { - throw RangeError("'version' must be >= '2018-11-09' when providing 'snapshotTime'."); - } - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.snapshotTime) { - throw RangeError("Must provide 'blobName' when providing 'snapshotTime'."); - } - if (blobSASSignatureValues.versionId && version < "2019-10-10") { - throw RangeError("'version' must be >= '2019-10-10' when providing 'versionId'."); - } - if (blobSASSignatureValues.blobName === undefined && blobSASSignatureValues.versionId) { - throw RangeError("Must provide 'blobName' when providing 'versionId'."); - } - if (blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.setImmutabilityPolicy && - version < "2020-08-04") { - throw RangeError("'version' must be >= '2020-08-04' when provided 'i' permission."); - } - if (blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.deleteVersion && - version < "2019-10-10") { - throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission."); + /** + * Start the scheduler, will return error when stream of any of the outgoingHandlers + * returns error. + * + */ + async do() { + return new Promise((resolve, reject) => { + this.readable.on("data", (data) => { + data = typeof data === "string" ? Buffer.from(data, this.encoding) : data; + this.appendUnresolvedData(data); + if (!this.resolveData()) { + this.readable.pause(); + } + }); + this.readable.on("error", (err) => { + this.emitter.emit("error", err); + }); + this.readable.on("end", () => { + this.isStreamEnd = true; + this.emitter.emit("checkEnd"); + }); + this.emitter.on("error", (err) => { + this.isError = true; + this.readable.pause(); + reject(err); + }); + this.emitter.on("checkEnd", () => { + if (this.outgoing.length > 0) { + this.triggerOutgoingHandlers(); + return; + } + if (this.isStreamEnd && this.executingOutgoingHandlers === 0) { + if (this.unresolvedLength > 0 && this.unresolvedLength < this.bufferSize) { + const buffer = this.shiftBufferFromUnresolvedDataArray(); + this.outgoingHandler(() => buffer.getReadableStream(), buffer.size, this.offset) + .then(resolve) + .catch(reject); + } + else if (this.unresolvedLength >= this.bufferSize) { + return; + } + else { + resolve(); + } + } + }); + }); } - if (blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.permanentDelete && - version < "2019-10-10") { - throw RangeError("'version' must be >= '2019-10-10' when providing 'y' permission."); + /** + * Insert a new data into unresolved array. + * + * @param data - + */ + appendUnresolvedData(data) { + this.unresolvedDataArray.push(data); + this.unresolvedLength += data.length; } - if (blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.tag && - version < "2019-12-12") { - throw RangeError("'version' must be >= '2019-12-12' when providing 't' permission."); + /** + * Try to shift a buffer with size in blockSize. The buffer returned may be less + * than blockSize when data in unresolvedDataArray is less than bufferSize. + * + */ + shiftBufferFromUnresolvedDataArray(buffer) { + if (!buffer) { + buffer = new PooledBuffer_js_1.PooledBuffer(this.bufferSize, this.unresolvedDataArray, this.unresolvedLength); + } + else { + buffer.fill(this.unresolvedDataArray, this.unresolvedLength); + } + this.unresolvedLength -= buffer.size; + return buffer; } - if (version < "2020-02-10" && - blobSASSignatureValues.permissions && - (blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) { - throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission."); + /** + * Resolve data in unresolvedDataArray. For every buffer with size in blockSize + * shifted, it will try to get (or allocate a buffer) from incoming, and fill it, + * then push it into outgoing to be handled by outgoing handler. + * + * Return false when available buffers in incoming are not enough, else true. + * + * @returns Return false when buffers in incoming are not enough, else true. + */ + resolveData() { + while (this.unresolvedLength >= this.bufferSize) { + let buffer; + if (this.incoming.length > 0) { + buffer = this.incoming.shift(); + this.shiftBufferFromUnresolvedDataArray(buffer); + } + else { + if (this.numBuffers < this.maxBuffers) { + buffer = this.shiftBufferFromUnresolvedDataArray(); + this.numBuffers++; + } + else { + // No available buffer, wait for buffer returned + return false; + } + } + this.outgoing.push(buffer); + this.triggerOutgoingHandlers(); + } + return true; } - if (version < "2021-04-10" && - blobSASSignatureValues.permissions && - blobSASSignatureValues.permissions.filterByTags) { - throw RangeError("'version' must be >= '2021-04-10' when providing the 'f' permission."); + /** + * Try to trigger a outgoing handler for every buffer in outgoing. Stop when + * concurrency reaches. + */ + async triggerOutgoingHandlers() { + let buffer; + do { + if (this.executingOutgoingHandlers >= this.concurrency) { + return; + } + buffer = this.outgoing.shift(); + if (buffer) { + this.triggerOutgoingHandler(buffer); + } + } while (buffer); } - if (version < "2020-02-10" && - (blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) { - throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'."); + /** + * Trigger a outgoing handler for a buffer shifted from outgoing. + * + * @param buffer - + */ + async triggerOutgoingHandler(buffer) { + const bufferLength = buffer.size; + this.executingOutgoingHandlers++; + this.offset += bufferLength; + try { + await this.outgoingHandler(() => buffer.getReadableStream(), bufferLength, this.offset - bufferLength); + } + catch (err) { + this.emitter.emit("error", err); + return; + } + this.executingOutgoingHandlers--; + this.reuseBuffer(buffer); + this.emitter.emit("checkEnd"); } - if (blobSASSignatureValues.encryptionScope && version < "2020-12-06") { - throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS."); + /** + * Return buffer used by outgoing handler into incoming. + * + * @param buffer - + */ + reuseBuffer(buffer) { + this.incoming.push(buffer); + if (!this.isError && this.resolveData() && !this.isStreamEnd) { + this.readable.resume(); + } } - blobSASSignatureValues.version = version; - return blobSASSignatureValues; } -//# sourceMappingURL=BlobSASSignatureValues.js.map +exports.BufferScheduler = BufferScheduler; +//# sourceMappingURL=BufferScheduler.js.map /***/ }), -/***/ 27579: -/***/ ((__unused_webpack_module, exports) => { +/***/ 82202: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContainerSASPermissions = void 0; +exports.BuffersStream = void 0; +const node_stream_1 = __nccwpck_require__(84492); /** - * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a container. - * Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation. - * Once all the values are set, this should be serialized with toString and set as the permissions field on a - * {@link BlobSASSignatureValues} object. It is possible to construct the permissions string without this class, but - * the order of the permissions is particular and this class guarantees correctness. + * This class generates a readable stream from the data in an array of buffers. */ -class ContainerSASPermissions { +class BuffersStream extends node_stream_1.Readable { + buffers; + byteLength; /** - * Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an - * Error if it encounters a character that does not correspond to a valid permission. + * The offset of data to be read in the current buffer. + */ + byteOffsetInCurrentBuffer; + /** + * The index of buffer to be read in the array of buffers. + */ + bufferIndex; + /** + * The total length of data already read. + */ + pushedBytesLength; + /** + * Creates an instance of BuffersStream that will emit the data + * contained in the array of buffers. * - * @param permissions - + * @param buffers - Array of buffers containing the data + * @param byteLength - The total length of data contained in the buffers */ - static parse(permissions) { - const containerSASPermissions = new ContainerSASPermissions(); - for (const char of permissions) { - switch (char) { - case "r": - containerSASPermissions.read = true; - break; - case "a": - containerSASPermissions.add = true; - break; - case "c": - containerSASPermissions.create = true; - break; - case "w": - containerSASPermissions.write = true; - break; - case "d": - containerSASPermissions.delete = true; - break; - case "l": - containerSASPermissions.list = true; - break; - case "t": - containerSASPermissions.tag = true; - break; - case "x": - containerSASPermissions.deleteVersion = true; - break; - case "m": - containerSASPermissions.move = true; - break; - case "e": - containerSASPermissions.execute = true; - break; - case "i": - containerSASPermissions.setImmutabilityPolicy = true; - break; - case "y": - containerSASPermissions.permanentDelete = true; - break; - case "f": - containerSASPermissions.filterByTags = true; - break; - default: - throw new RangeError(`Invalid permission ${char}`); - } + constructor(buffers, byteLength, options) { + super(options); + this.buffers = buffers; + this.byteLength = byteLength; + this.byteOffsetInCurrentBuffer = 0; + this.bufferIndex = 0; + this.pushedBytesLength = 0; + // check byteLength is no larger than buffers[] total length + let buffersLength = 0; + for (const buf of this.buffers) { + buffersLength += buf.byteLength; + } + if (buffersLength < this.byteLength) { + throw new Error("Data size shouldn't be larger than the total length of buffers."); } - return containerSASPermissions; } /** - * Creates a {@link ContainerSASPermissions} from a raw object which contains same keys as it - * and boolean values for them. + * Internal _read() that will be called when the stream wants to pull more data in. * - * @param permissionLike - + * @param size - Optional. The size of data to be read */ - static from(permissionLike) { - const containerSASPermissions = new ContainerSASPermissions(); - if (permissionLike.read) { - containerSASPermissions.read = true; - } - if (permissionLike.add) { - containerSASPermissions.add = true; - } - if (permissionLike.create) { - containerSASPermissions.create = true; - } - if (permissionLike.write) { - containerSASPermissions.write = true; - } - if (permissionLike.delete) { - containerSASPermissions.delete = true; - } - if (permissionLike.list) { - containerSASPermissions.list = true; - } - if (permissionLike.deleteVersion) { - containerSASPermissions.deleteVersion = true; - } - if (permissionLike.tag) { - containerSASPermissions.tag = true; - } - if (permissionLike.move) { - containerSASPermissions.move = true; + _read(size) { + if (this.pushedBytesLength >= this.byteLength) { + this.push(null); } - if (permissionLike.execute) { - containerSASPermissions.execute = true; + if (!size) { + size = this.readableHighWaterMark; } - if (permissionLike.setImmutabilityPolicy) { - containerSASPermissions.setImmutabilityPolicy = true; + const outBuffers = []; + let i = 0; + while (i < size && this.pushedBytesLength < this.byteLength) { + // The last buffer may be longer than the data it contains. + const remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength; + const remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer; + const remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers); + if (remaining > size - i) { + // chunkSize = size - i + const end = this.byteOffsetInCurrentBuffer + size - i; + outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); + this.pushedBytesLength += size - i; + this.byteOffsetInCurrentBuffer = end; + i = size; + break; + } + else { + // chunkSize = remaining + const end = this.byteOffsetInCurrentBuffer + remaining; + outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); + if (remaining === remainingCapacityInThisBuffer) { + // this.buffers[this.bufferIndex] used up, shift to next one + this.byteOffsetInCurrentBuffer = 0; + this.bufferIndex++; + } + else { + this.byteOffsetInCurrentBuffer = end; + } + this.pushedBytesLength += remaining; + i += remaining; + } } - if (permissionLike.permanentDelete) { - containerSASPermissions.permanentDelete = true; + if (outBuffers.length > 1) { + this.push(Buffer.concat(outBuffers)); } - if (permissionLike.filterByTags) { - containerSASPermissions.filterByTags = true; + else if (outBuffers.length === 1) { + this.push(outBuffers[0]); } - return containerSASPermissions; } +} +exports.BuffersStream = BuffersStream; +//# sourceMappingURL=BuffersStream.js.map + +/***/ }), + +/***/ 39474: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PooledBuffer = void 0; +const tslib_1 = __nccwpck_require__(4351); +const BuffersStream_js_1 = __nccwpck_require__(82202); +const node_buffer_1 = tslib_1.__importDefault(__nccwpck_require__(72254)); +/** + * maxBufferLength is max size of each buffer in the pooled buffers. + */ +const maxBufferLength = node_buffer_1.default.constants.MAX_LENGTH; +/** + * This class provides a buffer container which conceptually has no hard size limit. + * It accepts a capacity, an array of input buffers and the total length of input data. + * It will allocate an internal "buffer" of the capacity and fill the data in the input buffers + * into the internal "buffer" serially with respect to the total length. + * Then by calling PooledBuffer.getReadableStream(), you can get a readable stream + * assembled from all the data in the internal "buffer". + */ +class PooledBuffer { /** - * Specifies Read access granted. - */ - read = false; - /** - * Specifies Add access granted. - */ - add = false; - /** - * Specifies Create access granted. - */ - create = false; - /** - * Specifies Write access granted. - */ - write = false; - /** - * Specifies Delete access granted. - */ - delete = false; - /** - * Specifies Delete version access granted. - */ - deleteVersion = false; - /** - * Specifies List access granted. - */ - list = false; - /** - * Specfies Tag access granted. - */ - tag = false; - /** - * Specifies Move access granted. - */ - move = false; - /** - * Specifies Execute access granted. + * Internal buffers used to keep the data. + * Each buffer has a length of the maxBufferLength except last one. */ - execute = false; + buffers = []; /** - * Specifies SetImmutabilityPolicy access granted. + * The total size of internal buffers. */ - setImmutabilityPolicy = false; + capacity; /** - * Specifies that Permanent Delete is permitted. + * The total size of data contained in internal buffers. */ - permanentDelete = false; + _size; /** - * Specifies that Filter Blobs by Tags is permitted. + * The size of the data contained in the pooled buffers. */ - filterByTags = false; + get size() { + return this._size; + } + constructor(capacity, buffers, totalLength) { + this.capacity = capacity; + this._size = 0; + // allocate + const bufferNum = Math.ceil(capacity / maxBufferLength); + for (let i = 0; i < bufferNum; i++) { + let len = i === bufferNum - 1 ? capacity % maxBufferLength : maxBufferLength; + if (len === 0) { + len = maxBufferLength; + } + this.buffers.push(Buffer.allocUnsafe(len)); + } + if (buffers) { + this.fill(buffers, totalLength); + } + } /** - * Converts the given permissions to a string. Using this method will guarantee the permissions are in an - * order accepted by the service. + * Fill the internal buffers with data in the input buffers serially + * with respect to the total length and the total capacity of the internal buffers. + * Data copied will be shift out of the input buffers. * - * The order of the characters should be as specified here to ensure correctness. - * @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas + * @param buffers - Input buffers containing the data to be filled in the pooled buffer + * @param totalLength - Total length of the data to be filled in. * */ - toString() { - const permissions = []; - if (this.read) { - permissions.push("r"); - } - if (this.add) { - permissions.push("a"); - } - if (this.create) { - permissions.push("c"); - } - if (this.write) { - permissions.push("w"); - } - if (this.delete) { - permissions.push("d"); - } - if (this.deleteVersion) { - permissions.push("x"); - } - if (this.list) { - permissions.push("l"); - } - if (this.tag) { - permissions.push("t"); - } - if (this.move) { - permissions.push("m"); - } - if (this.execute) { - permissions.push("e"); - } - if (this.setImmutabilityPolicy) { - permissions.push("i"); - } - if (this.permanentDelete) { - permissions.push("y"); + fill(buffers, totalLength) { + this._size = Math.min(this.capacity, totalLength); + let i = 0, j = 0, targetOffset = 0, sourceOffset = 0, totalCopiedNum = 0; + while (totalCopiedNum < this._size) { + const source = buffers[i]; + const target = this.buffers[j]; + const copiedNum = source.copy(target, targetOffset, sourceOffset); + totalCopiedNum += copiedNum; + sourceOffset += copiedNum; + targetOffset += copiedNum; + if (sourceOffset === source.length) { + i++; + sourceOffset = 0; + } + if (targetOffset === target.length) { + j++; + targetOffset = 0; + } } - if (this.filterByTags) { - permissions.push("f"); + // clear copied from source buffers + buffers.splice(0, i); + if (buffers.length > 0) { + buffers[0] = buffers[0].slice(sourceOffset); } - return permissions.join(""); + } + /** + * Get the readable stream assembled from all the data in the internal buffers. + * + */ + getReadableStream() { + return new BuffersStream_js_1.BuffersStream(this.buffers, this.size); + } +} +exports.PooledBuffer = PooledBuffer; +//# sourceMappingURL=PooledBuffer.js.map + +/***/ }), + +/***/ 83269: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageBrowserPolicyFactory = exports.StorageBrowserPolicy = void 0; +const StorageBrowserPolicy_js_1 = __nccwpck_require__(69277); +Object.defineProperty(exports, "StorageBrowserPolicy", ({ enumerable: true, get: function () { return StorageBrowserPolicy_js_1.StorageBrowserPolicy; } })); +/** + * StorageBrowserPolicyFactory is a factory class helping generating StorageBrowserPolicy objects. + */ +class StorageBrowserPolicyFactory { + /** + * Creates a StorageBrowserPolicyFactory object. + * + * @param nextPolicy - + * @param options - + */ + create(nextPolicy, options) { + return new StorageBrowserPolicy_js_1.StorageBrowserPolicy(nextPolicy, options); } } -exports.ContainerSASPermissions = ContainerSASPermissions; -//# sourceMappingURL=ContainerSASPermissions.js.map +exports.StorageBrowserPolicyFactory = StorageBrowserPolicyFactory; +//# sourceMappingURL=StorageBrowserPolicyFactory.js.map /***/ }), -/***/ 21969: +/***/ 26508: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -120178,361 +113551,497 @@ exports.ContainerSASPermissions = ContainerSASPermissions; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.SASQueryParameters = exports.SASProtocol = void 0; -const SasIPRange_js_1 = __nccwpck_require__(80914); -const utils_common_js_1 = __nccwpck_require__(16673); +exports.StorageRetryPolicyFactory = exports.StorageRetryPolicy = exports.StorageRetryPolicyType = void 0; +const StorageRetryPolicy_js_1 = __nccwpck_require__(1114); +Object.defineProperty(exports, "StorageRetryPolicy", ({ enumerable: true, get: function () { return StorageRetryPolicy_js_1.StorageRetryPolicy; } })); +const StorageRetryPolicyType_js_1 = __nccwpck_require__(21483); +Object.defineProperty(exports, "StorageRetryPolicyType", ({ enumerable: true, get: function () { return StorageRetryPolicyType_js_1.StorageRetryPolicyType; } })); /** - * Protocols for generated SAS. + * StorageRetryPolicyFactory is a factory class helping generating {@link StorageRetryPolicy} objects. */ -var SASProtocol; -(function (SASProtocol) { +class StorageRetryPolicyFactory { + retryOptions; /** - * Protocol that allows HTTPS only + * Creates an instance of StorageRetryPolicyFactory. + * @param retryOptions - */ - SASProtocol["Https"] = "https"; + constructor(retryOptions) { + this.retryOptions = retryOptions; + } /** - * Protocol that allows both HTTPS and HTTP + * Creates a StorageRetryPolicy object. + * + * @param nextPolicy - + * @param options - */ - SASProtocol["HttpsAndHttp"] = "https,http"; -})(SASProtocol || (exports.SASProtocol = SASProtocol = {})); + create(nextPolicy, options) { + return new StorageRetryPolicy_js_1.StorageRetryPolicy(nextPolicy, options, this.retryOptions); + } +} +exports.StorageRetryPolicyFactory = StorageRetryPolicyFactory; +//# sourceMappingURL=StorageRetryPolicyFactory.js.map + +/***/ }), + +/***/ 92599: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getCachedDefaultHttpClient = getCachedDefaultHttpClient; +const core_rest_pipeline_1 = __nccwpck_require__(29146); +let _defaultHttpClient; +function getCachedDefaultHttpClient() { + if (!_defaultHttpClient) { + _defaultHttpClient = (0, core_rest_pipeline_1.createDefaultHttpClient)(); + } + return _defaultHttpClient; +} +//# sourceMappingURL=cache.js.map + +/***/ }), + +/***/ 17662: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AnonymousCredential = void 0; +const AnonymousCredentialPolicy_js_1 = __nccwpck_require__(85969); +const Credential_js_1 = __nccwpck_require__(34936); /** - * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly - * by the user; it is only generated by the {@link AccountSASSignatureValues} and {@link BlobSASSignatureValues} - * types. Once generated, it can be encoded into a {@link String} and appended to a URL directly (though caution should - * be taken here in case there are existing query parameters, which might affect the appropriate means of appending - * these query parameters). - * - * NOTE: Instances of this class are immutable. + * AnonymousCredential provides a credentialPolicyCreator member used to create + * AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with + * HTTP(S) requests that read public resources or for use with Shared Access + * Signatures (SAS). */ -class SASQueryParameters { - /** - * The storage API version. - */ - version; - /** - * Optional. The allowed HTTP protocol(s). - */ - protocol; - /** - * Optional. The start time for this SAS token. - */ - startsOn; - /** - * Optional only when identifier is provided. The expiry time for this SAS token. - */ - expiresOn; - /** - * Optional only when identifier is provided. - * Please refer to {@link AccountSASPermissions}, {@link BlobSASPermissions}, or {@link ContainerSASPermissions} for - * more details. - */ - permissions; - /** - * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASServices} - * for more details. - */ - services; - /** - * Optional. The storage resource types being accessed (only for Account SAS). Please refer to - * {@link AccountSASResourceTypes} for more details. - */ - resourceTypes; +class AnonymousCredential extends Credential_js_1.Credential { /** - * Optional. The signed identifier (only for {@link BlobSASSignatureValues}). + * Creates an {@link AnonymousCredentialPolicy} object. * - * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy - */ - identifier; - /** - * Optional. Encryption scope to use when sending requests authorized with this SAS URI. - */ - encryptionScope; - /** - * Optional. Specifies which resources are accessible via the SAS (only for {@link BlobSASSignatureValues}). - * @see https://learn.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only - */ - resource; - /** - * The signature for the SAS token. - */ - signature; - /** - * Value for cache-control header in Blob/File Service SAS. + * @param nextPolicy - + * @param options - */ - cacheControl; + create(nextPolicy, options) { + return new AnonymousCredentialPolicy_js_1.AnonymousCredentialPolicy(nextPolicy, options); + } +} +exports.AnonymousCredential = AnonymousCredential; +//# sourceMappingURL=AnonymousCredential.js.map + +/***/ }), + +/***/ 34936: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Credential = void 0; +/** + * Credential is an abstract class for Azure Storage HTTP requests signing. This + * class will host an credentialPolicyCreator factory which generates CredentialPolicy. + */ +class Credential { /** - * Value for content-disposition header in Blob/File Service SAS. + * Creates a RequestPolicy object. + * + * @param _nextPolicy - + * @param _options - */ - contentDisposition; + create(_nextPolicy, _options) { + throw new Error("Method should be implemented in children classes."); + } +} +exports.Credential = Credential; +//# sourceMappingURL=Credential.js.map + +/***/ }), + +/***/ 92782: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageSharedKeyCredential = void 0; +const node_crypto_1 = __nccwpck_require__(6005); +const StorageSharedKeyCredentialPolicy_js_1 = __nccwpck_require__(40755); +const Credential_js_1 = __nccwpck_require__(34936); +/** + * ONLY AVAILABLE IN NODE.JS RUNTIME. + * + * StorageSharedKeyCredential for account key authorization of Azure Storage service. + */ +class StorageSharedKeyCredential extends Credential_js_1.Credential { /** - * Value for content-encoding header in Blob/File Service SAS. + * Azure Storage account name; readonly. */ - contentEncoding; + accountName; /** - * Value for content-length header in Blob/File Service SAS. + * Azure Storage account key; readonly. */ - contentLanguage; + accountKey; /** - * Value for content-type header in Blob/File Service SAS. + * Creates an instance of StorageSharedKeyCredential. + * @param accountName - + * @param accountKey - */ - contentType; + constructor(accountName, accountKey) { + super(); + this.accountName = accountName; + this.accountKey = Buffer.from(accountKey, "base64"); + } /** - * Inner value of getter ipRange. + * Creates a StorageSharedKeyCredentialPolicy object. + * + * @param nextPolicy - + * @param options - */ - ipRangeInner; + create(nextPolicy, options) { + return new StorageSharedKeyCredentialPolicy_js_1.StorageSharedKeyCredentialPolicy(nextPolicy, options, this); + } /** - * The Azure Active Directory object ID in GUID format. - * Property of user delegation key. + * Generates a hash signature for an HTTP request or for a SAS. + * + * @param stringToSign - */ - signedOid; + computeHMACSHA256(stringToSign) { + return (0, node_crypto_1.createHmac)("sha256", this.accountKey).update(stringToSign, "utf8").digest("base64"); + } +} +exports.StorageSharedKeyCredential = StorageSharedKeyCredential; +//# sourceMappingURL=StorageSharedKeyCredential.js.map + +/***/ }), + +/***/ 83667: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaseRequestPolicy = exports.getCachedDefaultHttpClient = void 0; +const tslib_1 = __nccwpck_require__(4351); +tslib_1.__exportStar(__nccwpck_require__(80974), exports); +var cache_js_1 = __nccwpck_require__(92599); +Object.defineProperty(exports, "getCachedDefaultHttpClient", ({ enumerable: true, get: function () { return cache_js_1.getCachedDefaultHttpClient; } })); +tslib_1.__exportStar(__nccwpck_require__(83269), exports); +tslib_1.__exportStar(__nccwpck_require__(17662), exports); +tslib_1.__exportStar(__nccwpck_require__(34936), exports); +tslib_1.__exportStar(__nccwpck_require__(92782), exports); +tslib_1.__exportStar(__nccwpck_require__(26508), exports); +var RequestPolicy_js_1 = __nccwpck_require__(76584); +Object.defineProperty(exports, "BaseRequestPolicy", ({ enumerable: true, get: function () { return RequestPolicy_js_1.BaseRequestPolicy; } })); +tslib_1.__exportStar(__nccwpck_require__(85969), exports); +tslib_1.__exportStar(__nccwpck_require__(13615), exports); +tslib_1.__exportStar(__nccwpck_require__(69277), exports); +tslib_1.__exportStar(__nccwpck_require__(89782), exports); +tslib_1.__exportStar(__nccwpck_require__(37740), exports); +tslib_1.__exportStar(__nccwpck_require__(21483), exports); +tslib_1.__exportStar(__nccwpck_require__(1114), exports); +tslib_1.__exportStar(__nccwpck_require__(3353), exports); +tslib_1.__exportStar(__nccwpck_require__(40755), exports); +tslib_1.__exportStar(__nccwpck_require__(89020), exports); +tslib_1.__exportStar(__nccwpck_require__(26508), exports); +tslib_1.__exportStar(__nccwpck_require__(72426), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 89818: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.logger = void 0; +const logger_1 = __nccwpck_require__(89497); +/** + * The `@azure/logger` configuration for this package. + */ +exports.logger = (0, logger_1.createClientLogger)("storage-common"); +//# sourceMappingURL=log.js.map + +/***/ }), + +/***/ 85969: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AnonymousCredentialPolicy = void 0; +const CredentialPolicy_js_1 = __nccwpck_require__(13615); +/** + * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources + * or for use with Shared Access Signatures (SAS). + */ +class AnonymousCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { /** - * The Azure Active Directory tenant ID in GUID format. - * Property of user delegation key. + * Creates an instance of AnonymousCredentialPolicy. + * @param nextPolicy - + * @param options - */ - signedTenantId; + // The base class has a protected constructor. Adding a public one to enable constructing of this class. + /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ + constructor(nextPolicy, options) { + super(nextPolicy, options); + } +} +exports.AnonymousCredentialPolicy = AnonymousCredentialPolicy; +//# sourceMappingURL=AnonymousCredentialPolicy.js.map + +/***/ }), + +/***/ 13615: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CredentialPolicy = void 0; +const RequestPolicy_js_1 = __nccwpck_require__(76584); +/** + * Credential policy used to sign HTTP(S) requests before sending. This is an + * abstract class. + */ +class CredentialPolicy extends RequestPolicy_js_1.BaseRequestPolicy { /** - * The date-time the key is active. - * Property of user delegation key. + * Sends out request. + * + * @param request - */ - signedStartsOn; + sendRequest(request) { + return this._nextPolicy.sendRequest(this.signRequest(request)); + } /** - * The date-time the key expires. - * Property of user delegation key. + * Child classes must implement this method with request signing. This method + * will be executed in {@link sendRequest}. + * + * @param request - */ - signedExpiresOn; + signRequest(request) { + // Child classes must override this method with request signing. This method + // will be executed in sendRequest(). + return request; + } +} +exports.CredentialPolicy = CredentialPolicy; +//# sourceMappingURL=CredentialPolicy.js.map + +/***/ }), + +/***/ 76584: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaseRequestPolicy = void 0; +/** + * The base class from which all request policies derive. + */ +class BaseRequestPolicy { + _nextPolicy; + _options; /** - * Abbreviation of the Azure Storage service that accepts the user delegation key. - * Property of user delegation key. + * The main method to implement that manipulates a request/response. */ - signedService; + constructor( /** - * The service version that created the user delegation key. - * Property of user delegation key. + * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline. */ - signedVersion; + _nextPolicy, /** - * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key - * to perform the action granted by the SAS. The Azure Storage service will ensure that the owner of the user delegation key - * has the required permissions before granting access but no additional permission check for the user specified in - * this value will be performed. This is only used for User Delegation SAS. + * The options that can be passed to a given request policy. */ - preauthorizedAgentObjectId; + _options) { + this._nextPolicy = _nextPolicy; + this._options = _options; + } /** - * A GUID value that will be logged in the storage diagnostic logs and can be used to correlate SAS generation with storage resource access. - * This is only used for User Delegation SAS. + * Get whether or not a log with the provided log level should be logged. + * @param logLevel - The log level of the log that will be logged. + * @returns Whether or not a log with the provided log level should be logged. */ - correlationId; + shouldLog(logLevel) { + return this._options.shouldLog(logLevel); + } /** - * Optional. IP range allowed for this SAS. - * - * @readonly + * Attempt to log the provided message to the provided logger. If no logger was provided or if + * the log level does not meat the logger's threshold, then nothing will be logged. + * @param logLevel - The log level of this log. + * @param message - The message of this log. */ - get ipRange() { - if (this.ipRangeInner) { - return { - end: this.ipRangeInner.end, - start: this.ipRangeInner.start, - }; - } - return undefined; - } - constructor(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId, encryptionScope) { - this.version = version; - this.signature = signature; - if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") { - // SASQueryParametersOptions - this.permissions = permissionsOrOptions.permissions; - this.services = permissionsOrOptions.services; - this.resourceTypes = permissionsOrOptions.resourceTypes; - this.protocol = permissionsOrOptions.protocol; - this.startsOn = permissionsOrOptions.startsOn; - this.expiresOn = permissionsOrOptions.expiresOn; - this.ipRangeInner = permissionsOrOptions.ipRange; - this.identifier = permissionsOrOptions.identifier; - this.encryptionScope = permissionsOrOptions.encryptionScope; - this.resource = permissionsOrOptions.resource; - this.cacheControl = permissionsOrOptions.cacheControl; - this.contentDisposition = permissionsOrOptions.contentDisposition; - this.contentEncoding = permissionsOrOptions.contentEncoding; - this.contentLanguage = permissionsOrOptions.contentLanguage; - this.contentType = permissionsOrOptions.contentType; - if (permissionsOrOptions.userDelegationKey) { - this.signedOid = permissionsOrOptions.userDelegationKey.signedObjectId; - this.signedTenantId = permissionsOrOptions.userDelegationKey.signedTenantId; - this.signedStartsOn = permissionsOrOptions.userDelegationKey.signedStartsOn; - this.signedExpiresOn = permissionsOrOptions.userDelegationKey.signedExpiresOn; - this.signedService = permissionsOrOptions.userDelegationKey.signedService; - this.signedVersion = permissionsOrOptions.userDelegationKey.signedVersion; - this.preauthorizedAgentObjectId = permissionsOrOptions.preauthorizedAgentObjectId; - this.correlationId = permissionsOrOptions.correlationId; - } - } - else { - this.services = services; - this.resourceTypes = resourceTypes; - this.expiresOn = expiresOn; - this.permissions = permissionsOrOptions; - this.protocol = protocol; - this.startsOn = startsOn; - this.ipRangeInner = ipRange; - this.encryptionScope = encryptionScope; - this.identifier = identifier; - this.resource = resource; - this.cacheControl = cacheControl; - this.contentDisposition = contentDisposition; - this.contentEncoding = contentEncoding; - this.contentLanguage = contentLanguage; - this.contentType = contentType; - if (userDelegationKey) { - this.signedOid = userDelegationKey.signedObjectId; - this.signedTenantId = userDelegationKey.signedTenantId; - this.signedStartsOn = userDelegationKey.signedStartsOn; - this.signedExpiresOn = userDelegationKey.signedExpiresOn; - this.signedService = userDelegationKey.signedService; - this.signedVersion = userDelegationKey.signedVersion; - this.preauthorizedAgentObjectId = preauthorizedAgentObjectId; - this.correlationId = correlationId; - } - } + log(logLevel, message) { + this._options.log(logLevel, message); } +} +exports.BaseRequestPolicy = BaseRequestPolicy; +//# sourceMappingURL=RequestPolicy.js.map + +/***/ }), + +/***/ 69277: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StorageBrowserPolicy = void 0; +const RequestPolicy_js_1 = __nccwpck_require__(76584); +const core_util_1 = __nccwpck_require__(80637); +const constants_js_1 = __nccwpck_require__(77807); +const utils_common_js_1 = __nccwpck_require__(61876); +/** + * StorageBrowserPolicy will handle differences between Node.js and browser runtime, including: + * + * 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'. + * StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL + * thus avoid the browser cache. + * + * 2. Remove cookie header for security + * + * 3. Remove content-length header to avoid browsers warning + */ +class StorageBrowserPolicy extends RequestPolicy_js_1.BaseRequestPolicy { /** - * Encodes all SAS query parameters into a string that can be appended to a URL. - * + * Creates an instance of StorageBrowserPolicy. + * @param nextPolicy - + * @param options - */ - toString() { - const params = [ - "sv", - "ss", - "srt", - "spr", - "st", - "se", - "sip", - "si", - "ses", - "skoid", // Signed object ID - "sktid", // Signed tenant ID - "skt", // Signed key start time - "ske", // Signed key expiry time - "sks", // Signed key service - "skv", // Signed key version - "sr", - "sp", - "sig", - "rscc", - "rscd", - "rsce", - "rscl", - "rsct", - "saoid", - "scid", - ]; - const queries = []; - for (const param of params) { - switch (param) { - case "sv": - this.tryAppendQueryParameter(queries, param, this.version); - break; - case "ss": - this.tryAppendQueryParameter(queries, param, this.services); - break; - case "srt": - this.tryAppendQueryParameter(queries, param, this.resourceTypes); - break; - case "spr": - this.tryAppendQueryParameter(queries, param, this.protocol); - break; - case "st": - this.tryAppendQueryParameter(queries, param, this.startsOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.startsOn, false) : undefined); - break; - case "se": - this.tryAppendQueryParameter(queries, param, this.expiresOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.expiresOn, false) : undefined); - break; - case "sip": - this.tryAppendQueryParameter(queries, param, this.ipRange ? (0, SasIPRange_js_1.ipRangeToString)(this.ipRange) : undefined); - break; - case "si": - this.tryAppendQueryParameter(queries, param, this.identifier); - break; - case "ses": - this.tryAppendQueryParameter(queries, param, this.encryptionScope); - break; - case "skoid": // Signed object ID - this.tryAppendQueryParameter(queries, param, this.signedOid); - break; - case "sktid": // Signed tenant ID - this.tryAppendQueryParameter(queries, param, this.signedTenantId); - break; - case "skt": // Signed key start time - this.tryAppendQueryParameter(queries, param, this.signedStartsOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.signedStartsOn, false) : undefined); - break; - case "ske": // Signed key expiry time - this.tryAppendQueryParameter(queries, param, this.signedExpiresOn ? (0, utils_common_js_1.truncatedISO8061Date)(this.signedExpiresOn, false) : undefined); - break; - case "sks": // Signed key service - this.tryAppendQueryParameter(queries, param, this.signedService); - break; - case "skv": // Signed key version - this.tryAppendQueryParameter(queries, param, this.signedVersion); - break; - case "sr": - this.tryAppendQueryParameter(queries, param, this.resource); - break; - case "sp": - this.tryAppendQueryParameter(queries, param, this.permissions); - break; - case "sig": - this.tryAppendQueryParameter(queries, param, this.signature); - break; - case "rscc": - this.tryAppendQueryParameter(queries, param, this.cacheControl); - break; - case "rscd": - this.tryAppendQueryParameter(queries, param, this.contentDisposition); - break; - case "rsce": - this.tryAppendQueryParameter(queries, param, this.contentEncoding); - break; - case "rscl": - this.tryAppendQueryParameter(queries, param, this.contentLanguage); - break; - case "rsct": - this.tryAppendQueryParameter(queries, param, this.contentType); - break; - case "saoid": - this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId); - break; - case "scid": - this.tryAppendQueryParameter(queries, param, this.correlationId); - break; - } - } - return queries.join("&"); + // The base class has a protected constructor. Adding a public one to enable constructing of this class. + /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ + constructor(nextPolicy, options) { + super(nextPolicy, options); } /** - * A private helper method used to filter and append query key/value pairs into an array. + * Sends out request. * - * @param queries - - * @param key - - * @param value - + * @param request - */ - tryAppendQueryParameter(queries, key, value) { - if (!value) { - return; + async sendRequest(request) { + if (core_util_1.isNodeLike) { + return this._nextPolicy.sendRequest(request); } - key = encodeURIComponent(key); - value = encodeURIComponent(value); - if (key.length > 0 && value.length > 0) { - queries.push(`${key}=${value}`); + if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") { + request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); } + request.headers.remove(constants_js_1.HeaderConstants.COOKIE); + // According to XHR standards, content-length should be fully controlled by browsers + request.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return this._nextPolicy.sendRequest(request); } } -exports.SASQueryParameters = SASQueryParameters; -//# sourceMappingURL=SASQueryParameters.js.map +exports.StorageBrowserPolicy = StorageBrowserPolicy; +//# sourceMappingURL=StorageBrowserPolicy.js.map /***/ }), -/***/ 80914: +/***/ 89782: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.storageBrowserPolicyName = void 0; +exports.storageBrowserPolicy = storageBrowserPolicy; +const core_util_1 = __nccwpck_require__(80637); +const constants_js_1 = __nccwpck_require__(77807); +const utils_common_js_1 = __nccwpck_require__(61876); +/** + * The programmatic identifier of the StorageBrowserPolicy. + */ +exports.storageBrowserPolicyName = "storageBrowserPolicy"; +/** + * storageBrowserPolicy is a policy used to prevent browsers from caching requests + * and to remove cookies and explicit content-length headers. + */ +function storageBrowserPolicy() { + return { + name: exports.storageBrowserPolicyName, + async sendRequest(request, next) { + if (core_util_1.isNodeLike) { + return next(request); + } + if (request.method === "GET" || request.method === "HEAD") { + request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); + } + request.headers.delete(constants_js_1.HeaderConstants.COOKIE); + // According to XHR standards, content-length should be fully controlled by browsers + request.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); + return next(request); + }, + }; +} +//# sourceMappingURL=StorageBrowserPolicyV2.js.map + +/***/ }), + +/***/ 37740: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.storageCorrectContentLengthPolicyName = void 0; +exports.storageCorrectContentLengthPolicy = storageCorrectContentLengthPolicy; +const constants_js_1 = __nccwpck_require__(77807); +/** + * The programmatic identifier of the storageCorrectContentLengthPolicy. + */ +exports.storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy"; +/** + * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length. + */ +function storageCorrectContentLengthPolicy() { + function correctContentLength(request) { + if (request.body && + (typeof request.body === "string" || Buffer.isBuffer(request.body)) && + request.body.length > 0) { + request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + } + } + return { + name: exports.storageCorrectContentLengthPolicyName, + async sendRequest(request, next) { + correctContentLength(request); + return next(request); + }, + }; +} +//# sourceMappingURL=StorageCorrectContentLengthPolicy.js.map + +/***/ }), + +/***/ 72426: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -120540,22 +114049,44 @@ exports.SASQueryParameters = SASQueryParameters; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ipRangeToString = ipRangeToString; +exports.storageRequestFailureDetailsParserPolicyName = void 0; +exports.storageRequestFailureDetailsParserPolicy = storageRequestFailureDetailsParserPolicy; /** - * Generate SasIPRange format string. For example: - * - * "8.8.8.8" or "1.1.1.1-255.255.255.255" - * - * @param ipRange - + * The programmatic identifier of the StorageRequestFailureDetailsParserPolicy. */ -function ipRangeToString(ipRange) { - return ipRange.end ? `${ipRange.start}-${ipRange.end}` : ipRange.start; +exports.storageRequestFailureDetailsParserPolicyName = "storageRequestFailureDetailsParserPolicy"; +/** + * StorageRequestFailureDetailsParserPolicy + */ +function storageRequestFailureDetailsParserPolicy() { + return { + name: exports.storageRequestFailureDetailsParserPolicyName, + async sendRequest(request, next) { + try { + const response = await next(request); + return response; + } + catch (err) { + if (typeof err === "object" && + err !== null && + err.response && + err.response.parsedBody) { + if (err.response.parsedBody.code === "InvalidHeaderValue" && + err.response.parsedBody.HeaderName === "x-ms-version") { + err.message = + "The provided service version is not enabled on this storage account. Please see https://learn.microsoft.com/rest/api/storageservices/versioning-for-the-azure-storage-services for additional information.\n"; + } + } + throw err; + } + }, + }; } -//# sourceMappingURL=SasIPRange.js.map +//# sourceMappingURL=StorageRequestFailureDetailsParserPolicy.js.map /***/ }), -/***/ 93996: +/***/ 1114: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -120563,343 +114094,588 @@ function ipRangeToString(ipRange) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Batch = void 0; -// In browser, during webpack or browserify bundling, this module will be replaced by 'events' -// https://github.com/Gozala/events -const events_1 = __nccwpck_require__(82361); +exports.StorageRetryPolicy = void 0; +exports.NewRetryPolicyFactory = NewRetryPolicyFactory; +const abort_controller_1 = __nccwpck_require__(31514); +const RequestPolicy_js_1 = __nccwpck_require__(76584); +const constants_js_1 = __nccwpck_require__(77807); +const utils_common_js_1 = __nccwpck_require__(61876); +const log_js_1 = __nccwpck_require__(89818); +const StorageRetryPolicyType_js_1 = __nccwpck_require__(21483); /** - * States for Batch. + * A factory method used to generated a RetryPolicy factory. + * + * @param retryOptions - */ -var BatchStates; -(function (BatchStates) { - BatchStates[BatchStates["Good"] = 0] = "Good"; - BatchStates[BatchStates["Error"] = 1] = "Error"; -})(BatchStates || (BatchStates = {})); +function NewRetryPolicyFactory(retryOptions) { + return { + create: (nextPolicy, options) => { + return new StorageRetryPolicy(nextPolicy, options, retryOptions); + }, + }; +} +// Default values of StorageRetryOptions +const DEFAULT_RETRY_OPTIONS = { + maxRetryDelayInMs: 120 * 1000, + maxTries: 4, + retryDelayInMs: 4 * 1000, + retryPolicyType: StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL, + secondaryHost: "", + tryTimeoutInMs: undefined, // Use server side default timeout strategy +}; +const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); /** - * Batch provides basic parallel execution with concurrency limits. - * Will stop execute left operations when one of the executed operation throws an error. - * But Batch cannot cancel ongoing operations, you need to cancel them by yourself. + * Retry policy with exponential retry and linear retry implemented. */ -class Batch { - /** - * Concurrency. Must be lager than 0. - */ - concurrency; - /** - * Number of active operations under execution. - */ - actives = 0; - /** - * Number of completed operations under execution. - */ - completed = 0; - /** - * Offset of next operation to be executed. - */ - offset = 0; +class StorageRetryPolicy extends RequestPolicy_js_1.BaseRequestPolicy { /** - * Operation array to be executed. + * RetryOptions. */ - operations = []; + retryOptions; /** - * States of Batch. When an error happens, state will turn into error. - * Batch will stop execute left operations. + * Creates an instance of RetryPolicy. + * + * @param nextPolicy - + * @param options - + * @param retryOptions - */ - state = BatchStates.Good; + constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) { + super(nextPolicy, options); + // Initialize retry options + this.retryOptions = { + retryPolicyType: retryOptions.retryPolicyType + ? retryOptions.retryPolicyType + : DEFAULT_RETRY_OPTIONS.retryPolicyType, + maxTries: retryOptions.maxTries && retryOptions.maxTries >= 1 + ? Math.floor(retryOptions.maxTries) + : DEFAULT_RETRY_OPTIONS.maxTries, + tryTimeoutInMs: retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0 + ? retryOptions.tryTimeoutInMs + : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs, + retryDelayInMs: retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0 + ? Math.min(retryOptions.retryDelayInMs, retryOptions.maxRetryDelayInMs + ? retryOptions.maxRetryDelayInMs + : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs) + : DEFAULT_RETRY_OPTIONS.retryDelayInMs, + maxRetryDelayInMs: retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0 + ? retryOptions.maxRetryDelayInMs + : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs, + secondaryHost: retryOptions.secondaryHost + ? retryOptions.secondaryHost + : DEFAULT_RETRY_OPTIONS.secondaryHost, + }; + } /** - * A private emitter used to pass events inside this class. + * Sends request. + * + * @param request - */ - emitter; + async sendRequest(request) { + return this.attemptSendRequest(request, false, 1); + } /** - * Creates an instance of Batch. - * @param concurrency - + * Decide and perform next retry. Won't mutate request parameter. + * + * @param request - + * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then + * the resource was not found. This may be due to replication delay. So, in this + * case, we'll never try the secondary again for this operation. + * @param attempt - How many retries has been attempted to performed, starting from 1, which includes + * the attempt will be performed by this method call. */ - constructor(concurrency = 5) { - if (concurrency < 1) { - throw new RangeError("concurrency must be larger than 0"); + async attemptSendRequest(request, secondaryHas404, attempt) { + const newRequest = request.clone(); + const isPrimaryRetry = secondaryHas404 || + !this.retryOptions.secondaryHost || + !(request.method === "GET" || request.method === "HEAD" || request.method === "OPTIONS") || + attempt % 2 === 1; + if (!isPrimaryRetry) { + newRequest.url = (0, utils_common_js_1.setURLHost)(newRequest.url, this.retryOptions.secondaryHost); } - this.concurrency = concurrency; - this.emitter = new events_1.EventEmitter(); + // Set the server-side timeout query parameter "timeout=[seconds]" + if (this.retryOptions.tryTimeoutInMs) { + newRequest.url = (0, utils_common_js_1.setURLParameter)(newRequest.url, constants_js_1.URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString()); + } + let response; + try { + log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); + response = await this._nextPolicy.sendRequest(newRequest); + if (!this.shouldRetry(isPrimaryRetry, attempt, response)) { + return response; + } + secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); + } + catch (err) { + log_js_1.logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`); + if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) { + throw err; + } + } + await this.delay(isPrimaryRetry, attempt, request.abortSignal); + return this.attemptSendRequest(request, secondaryHas404, ++attempt); } /** - * Add a operation into queue. + * Decide whether to retry according to last HTTP response and retry counters. * - * @param operation - + * @param isPrimaryRetry - + * @param attempt - + * @param response - + * @param err - */ - addOperation(operation) { - this.operations.push(async () => { - try { - this.actives++; - await operation(); - this.actives--; - this.completed++; - this.parallelExecute(); + shouldRetry(isPrimaryRetry, attempt, response, err) { + if (attempt >= this.retryOptions.maxTries) { + log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions + .maxTries}, no further try.`); + return false; + } + // Handle network failures, you may need to customize the list when you implement + // your own http client + const retriableErrors = [ + "ETIMEDOUT", + "ESOCKETTIMEDOUT", + "ECONNREFUSED", + "ECONNRESET", + "ENOENT", + "ENOTFOUND", + "TIMEOUT", + "EPIPE", + "REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js + ]; + if (err) { + for (const retriableError of retriableErrors) { + if (err.name.toUpperCase().includes(retriableError) || + err.message.toUpperCase().includes(retriableError) || + (err.code && err.code.toString().toUpperCase() === retriableError)) { + log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); + return true; + } } - catch (error) { - this.emitter.emit("error", error); + } + // If attempt was against the secondary & it returned a StatusNotFound (404), then + // the resource was not found. This may be due to replication delay. So, in this + // case, we'll never try the secondary again for this operation. + if (response || err) { + const statusCode = response ? response.status : err ? err.statusCode : 0; + if (!isPrimaryRetry && statusCode === 404) { + log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); + return true; + } + // Server internal error or server timeout + if (statusCode === 503 || statusCode === 500) { + log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); + return true; + } + } + if (response) { + // Retry select Copy Source Error Codes. + if (response?.status >= 400) { + const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); + if (copySourceError !== undefined) { + switch (copySourceError) { + case "InternalError": + case "OperationTimedOut": + case "ServerBusy": + return true; + } + } } - }); - } - /** - * Start execute operations in the queue. - * - */ - async do() { - if (this.operations.length === 0) { - return Promise.resolve(); } - this.parallelExecute(); - return new Promise((resolve, reject) => { - this.emitter.on("finish", resolve); - this.emitter.on("error", (error) => { - this.state = BatchStates.Error; - reject(error); - }); - }); - } - /** - * Get next operation to be executed. Return null when reaching ends. - * - */ - nextOperation() { - if (this.offset < this.operations.length) { - return this.operations[this.offset++]; + if (err?.code === "PARSE_ERROR" && err?.message.startsWith(`Error "Error: Unclosed root tag`)) { + log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); + return true; } - return null; + return false; } /** - * Start execute operations. One one the most important difference between - * this method with do() is that do() wraps as an sync method. + * Delay a calculated time between retries. * + * @param isPrimaryRetry - + * @param attempt - + * @param abortSignal - */ - parallelExecute() { - if (this.state === BatchStates.Error) { - return; - } - if (this.completed >= this.operations.length) { - this.emitter.emit("finish"); - return; - } - while (this.actives < this.concurrency) { - const operation = this.nextOperation(); - if (operation) { - operation(); - } - else { - return; + async delay(isPrimaryRetry, attempt, abortSignal) { + let delayTimeInMs = 0; + if (isPrimaryRetry) { + switch (this.retryOptions.retryPolicyType) { + case StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL: + delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs, this.retryOptions.maxRetryDelayInMs); + break; + case StorageRetryPolicyType_js_1.StorageRetryPolicyType.FIXED: + delayTimeInMs = this.retryOptions.retryDelayInMs; + break; } } + else { + delayTimeInMs = Math.random() * 1000; + } + log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); + return (0, utils_common_js_1.delay)(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR); } } -exports.Batch = Batch; -//# sourceMappingURL=Batch.js.map +exports.StorageRetryPolicy = StorageRetryPolicy; +//# sourceMappingURL=StorageRetryPolicy.js.map /***/ }), -/***/ 59028: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 21483: +/***/ ((__unused_webpack_module, exports) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BlobQuickQueryStream = void 0; -const node_stream_1 = __nccwpck_require__(84492); -const index_js_1 = __nccwpck_require__(94382); +exports.StorageRetryPolicyType = void 0; /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * A Node.js BlobQuickQueryStream will internally parse avro data stream for blob query. + * RetryPolicy types. */ -class BlobQuickQueryStream extends node_stream_1.Readable { - source; - avroReader; - avroIter; - avroPaused = true; - onProgress; - onError; +var StorageRetryPolicyType; +(function (StorageRetryPolicyType) { /** - * Creates an instance of BlobQuickQueryStream. - * - * @param source - The current ReadableStream returned from getter - * @param options - + * Exponential retry. Retry time delay grows exponentially. */ - constructor(source, options = {}) { - super(); - this.source = source; - this.onProgress = options.onProgress; - this.onError = options.onError; - this.avroReader = new index_js_1.AvroReader(new index_js_1.AvroReadableFromStream(this.source)); - this.avroIter = this.avroReader.parseObjects({ abortSignal: options.abortSignal }); - } - _read() { - if (this.avroPaused) { - this.readInternal().catch((err) => { - this.emit("error", err); - }); + StorageRetryPolicyType[StorageRetryPolicyType["EXPONENTIAL"] = 0] = "EXPONENTIAL"; + /** + * Linear retry. Retry time delay grows linearly. + */ + StorageRetryPolicyType[StorageRetryPolicyType["FIXED"] = 1] = "FIXED"; +})(StorageRetryPolicyType || (exports.StorageRetryPolicyType = StorageRetryPolicyType = {})); +//# sourceMappingURL=StorageRetryPolicyType.js.map + +/***/ }), + +/***/ 3353: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.storageRetryPolicyName = void 0; +exports.storageRetryPolicy = storageRetryPolicy; +const abort_controller_1 = __nccwpck_require__(31514); +const core_rest_pipeline_1 = __nccwpck_require__(29146); +const core_util_1 = __nccwpck_require__(80637); +const StorageRetryPolicyFactory_js_1 = __nccwpck_require__(26508); +const constants_js_1 = __nccwpck_require__(77807); +const utils_common_js_1 = __nccwpck_require__(61876); +const log_js_1 = __nccwpck_require__(89818); +/** + * Name of the {@link storageRetryPolicy} + */ +exports.storageRetryPolicyName = "storageRetryPolicy"; +// Default values of StorageRetryOptions +const DEFAULT_RETRY_OPTIONS = { + maxRetryDelayInMs: 120 * 1000, + maxTries: 4, + retryDelayInMs: 4 * 1000, + retryPolicyType: StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL, + secondaryHost: "", + tryTimeoutInMs: undefined, // Use server side default timeout strategy +}; +const retriableErrors = [ + "ETIMEDOUT", + "ESOCKETTIMEDOUT", + "ECONNREFUSED", + "ECONNRESET", + "ENOENT", + "ENOTFOUND", + "TIMEOUT", + "EPIPE", + "REQUEST_SEND_ERROR", +]; +const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); +/** + * Retry policy with exponential retry and linear retry implemented. + */ +function storageRetryPolicy(options = {}) { + const retryPolicyType = options.retryPolicyType ?? DEFAULT_RETRY_OPTIONS.retryPolicyType; + const maxTries = options.maxTries ?? DEFAULT_RETRY_OPTIONS.maxTries; + const retryDelayInMs = options.retryDelayInMs ?? DEFAULT_RETRY_OPTIONS.retryDelayInMs; + const maxRetryDelayInMs = options.maxRetryDelayInMs ?? DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs; + const secondaryHost = options.secondaryHost ?? DEFAULT_RETRY_OPTIONS.secondaryHost; + const tryTimeoutInMs = options.tryTimeoutInMs ?? DEFAULT_RETRY_OPTIONS.tryTimeoutInMs; + function shouldRetry({ isPrimaryRetry, attempt, response, error, }) { + if (attempt >= maxTries) { + log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${maxTries}, no further try.`); + return false; } - } - async readInternal() { - this.avroPaused = false; - let avroNext; - do { - avroNext = await this.avroIter.next(); - if (avroNext.done) { - break; + if (error) { + for (const retriableError of retriableErrors) { + if (error.name.toUpperCase().includes(retriableError) || + error.message.toUpperCase().includes(retriableError) || + (error.code && error.code.toString().toUpperCase() === retriableError)) { + log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); + return true; + } } - const obj = avroNext.value; - const schema = obj.$schema; - if (typeof schema !== "string") { - throw Error("Missing schema in avro record."); + if (error?.code === "PARSE_ERROR" && + error?.message.startsWith(`Error "Error: Unclosed root tag`)) { + log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); + return true; } - switch (schema) { - case "com.microsoft.azure.storage.queryBlobContents.resultData": - { - const data = obj.data; - if (data instanceof Uint8Array === false) { - throw Error("Invalid data in avro result record."); - } - if (!this.push(Buffer.from(data))) { - this.avroPaused = true; - } + } + // If attempt was against the secondary & it returned a StatusNotFound (404), then + // the resource was not found. This may be due to replication delay. So, in this + // case, we'll never try the secondary again for this operation. + if (response || error) { + const statusCode = response?.status ?? error?.statusCode ?? 0; + if (!isPrimaryRetry && statusCode === 404) { + log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); + return true; + } + // Server internal error or server timeout + if (statusCode === 503 || statusCode === 500) { + log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); + return true; + } + } + if (response) { + // Retry select Copy Source Error Codes. + if (response?.status >= 400) { + const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); + if (copySourceError !== undefined) { + switch (copySourceError) { + case "InternalError": + case "OperationTimedOut": + case "ServerBusy": + return true; } + } + } + } + return false; + } + function calculateDelay(isPrimaryRetry, attempt) { + let delayTimeInMs = 0; + if (isPrimaryRetry) { + switch (retryPolicyType) { + case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL: + delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * retryDelayInMs, maxRetryDelayInMs); break; - case "com.microsoft.azure.storage.queryBlobContents.progress": - { - const bytesScanned = obj.bytesScanned; - if (typeof bytesScanned !== "number") { - throw Error("Invalid bytesScanned in avro progress record."); - } - if (this.onProgress) { - this.onProgress({ loadedBytes: bytesScanned }); - } - } + case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.FIXED: + delayTimeInMs = retryDelayInMs; break; - case "com.microsoft.azure.storage.queryBlobContents.end": - if (this.onProgress) { - const totalBytes = obj.totalBytes; - if (typeof totalBytes !== "number") { - throw Error("Invalid totalBytes in avro end record."); - } - this.onProgress({ loadedBytes: totalBytes }); + } + } + else { + delayTimeInMs = Math.random() * 1000; + } + log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); + return delayTimeInMs; + } + return { + name: exports.storageRetryPolicyName, + async sendRequest(request, next) { + // Set the server-side timeout query parameter "timeout=[seconds]" + if (tryTimeoutInMs) { + request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1000))); + } + const primaryUrl = request.url; + const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request.url, secondaryHost) : undefined; + let secondaryHas404 = false; + let attempt = 1; + let retryAgain = true; + let response; + let error; + while (retryAgain) { + const isPrimaryRetry = secondaryHas404 || + !secondaryUrl || + !["GET", "HEAD", "OPTIONS"].includes(request.method) || + attempt % 2 === 1; + request.url = isPrimaryRetry ? primaryUrl : secondaryUrl; + response = undefined; + error = undefined; + try { + log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); + response = await next(request); + secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); + } + catch (e) { + if ((0, core_rest_pipeline_1.isRestError)(e)) { + log_js_1.logger.error(`RetryPolicy: Caught error, message: ${e.message}, code: ${e.code}`); + error = e; } - this.push(null); - break; - case "com.microsoft.azure.storage.queryBlobContents.error": - if (this.onError) { - const fatal = obj.fatal; - if (typeof fatal !== "boolean") { - throw Error("Invalid fatal in avro error record."); - } - const name = obj.name; - if (typeof name !== "string") { - throw Error("Invalid name in avro error record."); - } - const description = obj.description; - if (typeof description !== "string") { - throw Error("Invalid description in avro error record."); - } - const position = obj.position; - if (typeof position !== "number") { - throw Error("Invalid position in avro error record."); - } - this.onError({ - position, - name, - isFatal: fatal, - description, - }); + else { + log_js_1.logger.error(`RetryPolicy: Caught error, message: ${(0, core_util_1.getErrorMessage)(e)}`); + throw e; } - break; - default: - throw Error(`Unknown schema ${schema} in avro progress record.`); + } + retryAgain = shouldRetry({ isPrimaryRetry, attempt, response, error }); + if (retryAgain) { + await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request.abortSignal, RETRY_ABORT_ERROR); + } + attempt++; } - } while (!avroNext.done && !this.avroPaused); - } + if (response) { + return response; + } + throw error ?? new core_rest_pipeline_1.RestError("RetryPolicy failed without known error."); + }, + }; } -exports.BlobQuickQueryStream = BlobQuickQueryStream; -//# sourceMappingURL=BlobQuickQueryStream.js.map +//# sourceMappingURL=StorageRetryPolicyV2.js.map /***/ }), -/***/ 25300: -/***/ ((__unused_webpack_module, exports) => { +/***/ 40755: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Mutex = void 0; -var MutexLockStatus; -(function (MutexLockStatus) { - MutexLockStatus[MutexLockStatus["LOCKED"] = 0] = "LOCKED"; - MutexLockStatus[MutexLockStatus["UNLOCKED"] = 1] = "UNLOCKED"; -})(MutexLockStatus || (MutexLockStatus = {})); +exports.StorageSharedKeyCredentialPolicy = void 0; +const constants_js_1 = __nccwpck_require__(77807); +const utils_common_js_1 = __nccwpck_require__(61876); +const CredentialPolicy_js_1 = __nccwpck_require__(13615); +const SharedKeyComparator_js_1 = __nccwpck_require__(4482); /** - * An async mutex lock. + * StorageSharedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key. */ -class Mutex { +class StorageSharedKeyCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { /** - * Lock for a specific key. If the lock has been acquired by another customer, then - * will wait until getting the lock. + * Reference to StorageSharedKeyCredential which generates StorageSharedKeyCredentialPolicy + */ + factory; + /** + * Creates an instance of StorageSharedKeyCredentialPolicy. + * @param nextPolicy - + * @param options - + * @param factory - + */ + constructor(nextPolicy, options, factory) { + super(nextPolicy, options); + this.factory = factory; + } + /** + * Signs request. * - * @param key - lock key + * @param request - */ - static async lock(key) { - return new Promise((resolve) => { - if (this.keys[key] === undefined || this.keys[key] === MutexLockStatus.UNLOCKED) { - this.keys[key] = MutexLockStatus.LOCKED; - resolve(); - } - else { - this.onUnlockEvent(key, () => { - this.keys[key] = MutexLockStatus.LOCKED; - resolve(); - }); + signRequest(request) { + request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); + if (request.body && + (typeof request.body === "string" || request.body !== undefined) && + request.body.length > 0) { + request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + } + const stringToSign = [ + request.method.toUpperCase(), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), + ].join("\n") + + "\n" + + this.getCanonicalizedHeadersString(request) + + this.getCanonicalizedResourceString(request); + const signature = this.factory.computeHMACSHA256(stringToSign); + request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); + // console.log(`[URL]:${request.url}`); + // console.log(`[HEADERS]:${request.headers.toString()}`); + // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); + // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); + return request; + } + /** + * Retrieve header value according to shared key sign rules. + * @see https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key + * + * @param request - + * @param headerName - + */ + getHeaderValueToSign(request, headerName) { + const value = request.headers.get(headerName); + if (!value) { + return ""; + } + // When using version 2015-02-21 or later, if Content-Length is zero, then + // set the Content-Length part of the StringToSign to an empty string. + // https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key + if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { + return ""; + } + return value; + } + /** + * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: + * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. + * 2. Convert each HTTP header name to lowercase. + * 3. Sort the headers lexicographically by header name, in ascending order. + * Each header may appear only once in the string. + * 4. Replace any linear whitespace in the header value with a single space. + * 5. Trim any whitespace around the colon in the header. + * 6. Finally, append a new-line character to each canonicalized header in the resulting list. + * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. + * + * @param request - + */ + getCanonicalizedHeadersString(request) { + let headersArray = request.headers.headersArray().filter((value) => { + return value.name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE); + }); + headersArray.sort((a, b) => { + return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); + }); + // Remove duplicate headers + headersArray = headersArray.filter((value, index, array) => { + if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { + return false; } + return true; + }); + let canonicalizedHeadersStringToSign = ""; + headersArray.forEach((header) => { + canonicalizedHeadersStringToSign += `${header.name + .toLowerCase() + .trimRight()}:${header.value.trimLeft()}\n`; }); + return canonicalizedHeadersStringToSign; } /** - * Unlock a key. + * Retrieves the webResource canonicalized resource string. * - * @param key - + * @param request - */ - static async unlock(key) { - return new Promise((resolve) => { - if (this.keys[key] === MutexLockStatus.LOCKED) { - this.emitUnlockEvent(key); + getCanonicalizedResourceString(request) { + const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; + let canonicalizedResourceString = ""; + canonicalizedResourceString += `/${this.factory.accountName}${path}`; + const queries = (0, utils_common_js_1.getURLQueries)(request.url); + const lowercaseQueries = {}; + if (queries) { + const queryKeys = []; + for (const key in queries) { + if (Object.prototype.hasOwnProperty.call(queries, key)) { + const lowercaseKey = key.toLowerCase(); + lowercaseQueries[lowercaseKey] = queries[key]; + queryKeys.push(lowercaseKey); + } + } + queryKeys.sort(); + for (const key of queryKeys) { + canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; } - delete this.keys[key]; - resolve(); - }); - } - static keys = {}; - static listeners = {}; - static onUnlockEvent(key, handler) { - if (this.listeners[key] === undefined) { - this.listeners[key] = [handler]; - } - else { - this.listeners[key].push(handler); - } - } - static emitUnlockEvent(key) { - if (this.listeners[key] !== undefined && this.listeners[key].length > 0) { - const handler = this.listeners[key].shift(); - setImmediate(() => { - handler.call(this); - }); } + return canonicalizedResourceString; } } -exports.Mutex = Mutex; -//# sourceMappingURL=Mutex.js.map +exports.StorageSharedKeyCredentialPolicy = StorageSharedKeyCredentialPolicy; +//# sourceMappingURL=StorageSharedKeyCredentialPolicy.js.map /***/ }), -/***/ 88251: +/***/ 89020: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -120907,137 +114683,142 @@ exports.Mutex = Mutex; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RetriableReadableStream = void 0; -const abort_controller_1 = __nccwpck_require__(1753); -const node_stream_1 = __nccwpck_require__(84492); +exports.storageSharedKeyCredentialPolicyName = void 0; +exports.storageSharedKeyCredentialPolicy = storageSharedKeyCredentialPolicy; +const node_crypto_1 = __nccwpck_require__(6005); +const constants_js_1 = __nccwpck_require__(77807); +const utils_common_js_1 = __nccwpck_require__(61876); +const SharedKeyComparator_js_1 = __nccwpck_require__(4482); /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * A Node.js ReadableStream will internally retry when internal ReadableStream unexpected ends. + * The programmatic identifier of the storageSharedKeyCredentialPolicy. */ -class RetriableReadableStream extends node_stream_1.Readable { - start; - offset; - end; - getter; - source; - retries = 0; - maxRetryRequests; - onProgress; - options; +exports.storageSharedKeyCredentialPolicyName = "storageSharedKeyCredentialPolicy"; +/** + * storageSharedKeyCredentialPolicy handles signing requests using storage account keys. + */ +function storageSharedKeyCredentialPolicy(options) { + function signRequest(request) { + request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); + if (request.body && + (typeof request.body === "string" || Buffer.isBuffer(request.body)) && + request.body.length > 0) { + request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + } + const stringToSign = [ + request.method.toUpperCase(), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), + getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), + ].join("\n") + + "\n" + + getCanonicalizedHeadersString(request) + + getCanonicalizedResourceString(request); + const signature = (0, node_crypto_1.createHmac)("sha256", options.accountKey) + .update(stringToSign, "utf8") + .digest("base64"); + request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); + // console.log(`[URL]:${request.url}`); + // console.log(`[HEADERS]:${request.headers.toString()}`); + // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); + // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); + } /** - * Creates an instance of RetriableReadableStream. - * - * @param source - The current ReadableStream returned from getter - * @param getter - A method calling downloading request returning - * a new ReadableStream from specified offset - * @param offset - Offset position in original data source to read - * @param count - How much data in original data source to read - * @param options - + * Retrieve header value according to shared key sign rules. + * @see https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key */ - constructor(source, getter, offset, count, options = {}) { - super({ highWaterMark: options.highWaterMark }); - this.getter = getter; - this.source = source; - this.start = offset; - this.offset = offset; - this.end = offset + count - 1; - this.maxRetryRequests = - options.maxRetryRequests && options.maxRetryRequests >= 0 ? options.maxRetryRequests : 0; - this.onProgress = options.onProgress; - this.options = options; - this.setSourceEventHandlers(); - } - _read() { - this.source.resume(); - } - setSourceEventHandlers() { - this.source.on("data", this.sourceDataHandler); - this.source.on("end", this.sourceErrorOrEndHandler); - this.source.on("error", this.sourceErrorOrEndHandler); - // needed for Node14 - this.source.on("aborted", this.sourceAbortedHandler); - } - removeSourceEventHandlers() { - this.source.removeListener("data", this.sourceDataHandler); - this.source.removeListener("end", this.sourceErrorOrEndHandler); - this.source.removeListener("error", this.sourceErrorOrEndHandler); - this.source.removeListener("aborted", this.sourceAbortedHandler); - } - sourceDataHandler = (data) => { - if (this.options.doInjectErrorOnce) { - this.options.doInjectErrorOnce = undefined; - this.source.pause(); - this.sourceErrorOrEndHandler(); - this.source.destroy(); - return; - } - // console.log( - // `Offset: ${this.offset}, Received ${data.length} from internal stream` - // ); - this.offset += data.length; - if (this.onProgress) { - this.onProgress({ loadedBytes: this.offset - this.start }); - } - if (!this.push(data)) { - this.source.pause(); + function getHeaderValueToSign(request, headerName) { + const value = request.headers.get(headerName); + if (!value) { + return ""; } - }; - sourceAbortedHandler = () => { - const abortError = new abort_controller_1.AbortError("The operation was aborted."); - this.destroy(abortError); - }; - sourceErrorOrEndHandler = (err) => { - if (err && err.name === "AbortError") { - this.destroy(err); - return; + // When using version 2015-02-21 or later, if Content-Length is zero, then + // set the Content-Length part of the StringToSign to an empty string. + // https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key + if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { + return ""; } - // console.log( - // `Source stream emits end or error, offset: ${ - // this.offset - // }, dest end : ${this.end}` - // ); - this.removeSourceEventHandlers(); - if (this.offset - 1 === this.end) { - this.push(null); + return value; + } + /** + * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: + * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. + * 2. Convert each HTTP header name to lowercase. + * 3. Sort the headers lexicographically by header name, in ascending order. + * Each header may appear only once in the string. + * 4. Replace any linear whitespace in the header value with a single space. + * 5. Trim any whitespace around the colon in the header. + * 6. Finally, append a new-line character to each canonicalized header in the resulting list. + * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. + * + */ + function getCanonicalizedHeadersString(request) { + let headersArray = []; + for (const [name, value] of request.headers) { + if (name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE)) { + headersArray.push({ name, value }); + } } - else if (this.offset <= this.end) { - // console.log( - // `retries: ${this.retries}, max retries: ${this.maxRetries}` - // ); - if (this.retries < this.maxRetryRequests) { - this.retries += 1; - this.getter(this.offset) - .then((newSource) => { - this.source = newSource; - this.setSourceEventHandlers(); - return; - }) - .catch((error) => { - this.destroy(error); - }); + headersArray.sort((a, b) => { + return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); + }); + // Remove duplicate headers + headersArray = headersArray.filter((value, index, array) => { + if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { + return false; } - else { - this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`)); + return true; + }); + let canonicalizedHeadersStringToSign = ""; + headersArray.forEach((header) => { + canonicalizedHeadersStringToSign += `${header.name + .toLowerCase() + .trimRight()}:${header.value.trimLeft()}\n`; + }); + return canonicalizedHeadersStringToSign; + } + function getCanonicalizedResourceString(request) { + const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; + let canonicalizedResourceString = ""; + canonicalizedResourceString += `/${options.accountName}${path}`; + const queries = (0, utils_common_js_1.getURLQueries)(request.url); + const lowercaseQueries = {}; + if (queries) { + const queryKeys = []; + for (const key in queries) { + if (Object.prototype.hasOwnProperty.call(queries, key)) { + const lowercaseKey = key.toLowerCase(); + lowercaseQueries[lowercaseKey] = queries[key]; + queryKeys.push(lowercaseKey); + } + } + queryKeys.sort(); + for (const key of queryKeys) { + canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; } } - else { - this.destroy(new Error(`Data corruption failure: Received more data than original request, data needed offset is ${this.end}, received offset: ${this.offset - 1}`)); - } - }; - _destroy(error, callback) { - // remove listener from source and release source - this.removeSourceEventHandlers(); - this.source.destroy(); - callback(error === null ? undefined : error); + return canonicalizedResourceString; } + return { + name: exports.storageSharedKeyCredentialPolicyName, + async sendRequest(request, next) { + signRequest(request); + return next(request); + }, + }; } -exports.RetriableReadableStream = RetriableReadableStream; -//# sourceMappingURL=RetriableReadableStream.js.map +//# sourceMappingURL=StorageSharedKeyCredentialPolicyV2.js.map /***/ }), -/***/ 35867: +/***/ 4482: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -121084,250 +114865,88 @@ function compareHeader(lhs, rhs) { return -1; return 1; } -function isLessThan(lhs, rhs) { - const tables = [table_lv0, table_lv2, table_lv4]; - let curr_level = 0; - let i = 0; - let j = 0; - while (curr_level < tables.length) { - if (curr_level === tables.length - 1 && i !== j) { - return i > j; - } - const weight1 = i < lhs.length ? tables[curr_level][lhs[i].charCodeAt(0)] : 0x1; - const weight2 = j < rhs.length ? tables[curr_level][rhs[j].charCodeAt(0)] : 0x1; - if (weight1 === 0x1 && weight2 === 0x1) { - i = 0; - j = 0; - ++curr_level; - } - else if (weight1 === weight2) { - ++i; - ++j; - } - else if (weight1 === 0) { - ++i; - } - else if (weight2 === 0) { - ++j; - } - else { - return weight1 < weight2; - } - } - return false; -} -//# sourceMappingURL=SharedKeyComparator.js.map - -/***/ }), - -/***/ 81865: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PathStylePorts = exports.BlobDoesNotUseCustomerSpecifiedEncryption = exports.BlobUsesCustomerSpecifiedEncryptionMsg = exports.StorageBlobLoggingAllowedQueryParameters = exports.StorageBlobLoggingAllowedHeaderNames = exports.DevelopmentConnectionString = exports.EncryptionAlgorithmAES25 = exports.HTTP_VERSION_1_1 = exports.HTTP_LINE_ENDING = exports.BATCH_MAX_PAYLOAD_IN_BYTES = exports.BATCH_MAX_REQUEST = exports.SIZE_1_MB = exports.ETagAny = exports.ETagNone = exports.HeaderConstants = exports.HTTPURLConnection = exports.URLConstants = exports.StorageOAuthScopes = exports.REQUEST_TIMEOUT = exports.DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = exports.DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES = exports.DEFAULT_BLOCK_BUFFER_SIZE_BYTES = exports.BLOCK_BLOB_MAX_BLOCKS = exports.BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = exports.BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = exports.SERVICE_VERSION = exports.SDK_VERSION = void 0; -exports.SDK_VERSION = "12.29.1"; -exports.SERVICE_VERSION = "2025-11-05"; -exports.BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB -exports.BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB -exports.BLOCK_BLOB_MAX_BLOCKS = 50000; -exports.DEFAULT_BLOCK_BUFFER_SIZE_BYTES = 8 * 1024 * 1024; // 8MB -exports.DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES = 4 * 1024 * 1024; // 4MB -exports.DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = 5; -exports.REQUEST_TIMEOUT = 100 * 1000; // In ms -/** - * The OAuth scope to use with Azure Storage. - */ -exports.StorageOAuthScopes = "https://storage.azure.com/.default"; -exports.URLConstants = { - Parameters: { - FORCE_BROWSER_NO_CACHE: "_", - SIGNATURE: "sig", - SNAPSHOT: "snapshot", - VERSIONID: "versionid", - TIMEOUT: "timeout", - }, -}; -exports.HTTPURLConnection = { - HTTP_ACCEPTED: 202, - HTTP_CONFLICT: 409, - HTTP_NOT_FOUND: 404, - HTTP_PRECON_FAILED: 412, - HTTP_RANGE_NOT_SATISFIABLE: 416, -}; -exports.HeaderConstants = { - AUTHORIZATION: "Authorization", - AUTHORIZATION_SCHEME: "Bearer", - CONTENT_ENCODING: "Content-Encoding", - CONTENT_ID: "Content-ID", - CONTENT_LANGUAGE: "Content-Language", - CONTENT_LENGTH: "Content-Length", - CONTENT_MD5: "Content-Md5", - CONTENT_TRANSFER_ENCODING: "Content-Transfer-Encoding", - CONTENT_TYPE: "Content-Type", - COOKIE: "Cookie", - DATE: "date", - IF_MATCH: "if-match", - IF_MODIFIED_SINCE: "if-modified-since", - IF_NONE_MATCH: "if-none-match", - IF_UNMODIFIED_SINCE: "if-unmodified-since", - PREFIX_FOR_STORAGE: "x-ms-", - RANGE: "Range", - USER_AGENT: "User-Agent", - X_MS_CLIENT_REQUEST_ID: "x-ms-client-request-id", - X_MS_COPY_SOURCE: "x-ms-copy-source", - X_MS_DATE: "x-ms-date", - X_MS_ERROR_CODE: "x-ms-error-code", - X_MS_VERSION: "x-ms-version", - X_MS_CopySourceErrorCode: "x-ms-copy-source-error-code", -}; -exports.ETagNone = ""; -exports.ETagAny = "*"; -exports.SIZE_1_MB = 1 * 1024 * 1024; -exports.BATCH_MAX_REQUEST = 256; -exports.BATCH_MAX_PAYLOAD_IN_BYTES = 4 * exports.SIZE_1_MB; -exports.HTTP_LINE_ENDING = "\r\n"; -exports.HTTP_VERSION_1_1 = "HTTP/1.1"; -exports.EncryptionAlgorithmAES25 = "AES256"; -exports.DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;`; -exports.StorageBlobLoggingAllowedHeaderNames = [ - "Access-Control-Allow-Origin", - "Cache-Control", - "Content-Length", - "Content-Type", - "Date", - "Request-Id", - "traceparent", - "Transfer-Encoding", - "User-Agent", - "x-ms-client-request-id", - "x-ms-date", - "x-ms-error-code", - "x-ms-request-id", - "x-ms-return-client-request-id", - "x-ms-version", - "Accept-Ranges", - "Content-Disposition", - "Content-Encoding", - "Content-Language", - "Content-MD5", - "Content-Range", - "ETag", - "Last-Modified", - "Server", - "Vary", - "x-ms-content-crc64", - "x-ms-copy-action", - "x-ms-copy-completion-time", - "x-ms-copy-id", - "x-ms-copy-progress", - "x-ms-copy-status", - "x-ms-has-immutability-policy", - "x-ms-has-legal-hold", - "x-ms-lease-state", - "x-ms-lease-status", - "x-ms-range", - "x-ms-request-server-encrypted", - "x-ms-server-encrypted", - "x-ms-snapshot", - "x-ms-source-range", - "If-Match", - "If-Modified-Since", - "If-None-Match", - "If-Unmodified-Since", - "x-ms-access-tier", - "x-ms-access-tier-change-time", - "x-ms-access-tier-inferred", - "x-ms-account-kind", - "x-ms-archive-status", - "x-ms-blob-append-offset", - "x-ms-blob-cache-control", - "x-ms-blob-committed-block-count", - "x-ms-blob-condition-appendpos", - "x-ms-blob-condition-maxsize", - "x-ms-blob-content-disposition", - "x-ms-blob-content-encoding", - "x-ms-blob-content-language", - "x-ms-blob-content-length", - "x-ms-blob-content-md5", - "x-ms-blob-content-type", - "x-ms-blob-public-access", - "x-ms-blob-sequence-number", - "x-ms-blob-type", - "x-ms-copy-destination-snapshot", - "x-ms-creation-time", - "x-ms-default-encryption-scope", - "x-ms-delete-snapshots", - "x-ms-delete-type-permanent", - "x-ms-deny-encryption-scope-override", - "x-ms-encryption-algorithm", - "x-ms-if-sequence-number-eq", - "x-ms-if-sequence-number-le", - "x-ms-if-sequence-number-lt", - "x-ms-incremental-copy", - "x-ms-lease-action", - "x-ms-lease-break-period", - "x-ms-lease-duration", - "x-ms-lease-id", - "x-ms-lease-time", - "x-ms-page-write", - "x-ms-proposed-lease-id", - "x-ms-range-get-content-md5", - "x-ms-rehydrate-priority", - "x-ms-sequence-number-action", - "x-ms-sku-name", - "x-ms-source-content-md5", - "x-ms-source-if-match", - "x-ms-source-if-modified-since", - "x-ms-source-if-none-match", - "x-ms-source-if-unmodified-since", - "x-ms-tag-count", - "x-ms-encryption-key-sha256", - "x-ms-copy-source-error-code", - "x-ms-copy-source-status-code", - "x-ms-if-tags", - "x-ms-source-if-tags", -]; -exports.StorageBlobLoggingAllowedQueryParameters = [ - "comp", - "maxresults", - "rscc", - "rscd", - "rsce", - "rscl", - "rsct", - "se", - "si", - "sip", - "sp", - "spr", - "sr", - "srt", - "ss", - "st", - "sv", - "include", - "marker", - "prefix", - "copyid", - "restype", - "blockid", - "blocklisttype", - "delimiter", - "prevsnapshot", - "ske", - "skoid", - "sks", - "skt", - "sktid", - "skv", - "snapshot", -]; -exports.BlobUsesCustomerSpecifiedEncryptionMsg = "BlobUsesCustomerSpecifiedEncryption"; -exports.BlobDoesNotUseCustomerSpecifiedEncryption = "BlobDoesNotUseCustomerSpecifiedEncryption"; +function isLessThan(lhs, rhs) { + const tables = [table_lv0, table_lv2, table_lv4]; + let curr_level = 0; + let i = 0; + let j = 0; + while (curr_level < tables.length) { + if (curr_level === tables.length - 1 && i !== j) { + return i > j; + } + const weight1 = i < lhs.length ? tables[curr_level][lhs[i].charCodeAt(0)] : 0x1; + const weight2 = j < rhs.length ? tables[curr_level][rhs[j].charCodeAt(0)] : 0x1; + if (weight1 === 0x1 && weight2 === 0x1) { + i = 0; + j = 0; + ++curr_level; + } + else if (weight1 === weight2) { + ++i; + ++j; + } + else if (weight1 === 0) { + ++i; + } + else if (weight2 === 0) { + ++j; + } + else { + return weight1 < weight2; + } + } + return false; +} +//# sourceMappingURL=SharedKeyComparator.js.map + +/***/ }), + +/***/ 77807: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PathStylePorts = exports.DevelopmentConnectionString = exports.HeaderConstants = exports.URLConstants = exports.SDK_VERSION = void 0; +exports.SDK_VERSION = "1.0.0"; +exports.URLConstants = { + Parameters: { + FORCE_BROWSER_NO_CACHE: "_", + SIGNATURE: "sig", + SNAPSHOT: "snapshot", + VERSIONID: "versionid", + TIMEOUT: "timeout", + }, +}; +exports.HeaderConstants = { + AUTHORIZATION: "Authorization", + AUTHORIZATION_SCHEME: "Bearer", + CONTENT_ENCODING: "Content-Encoding", + CONTENT_ID: "Content-ID", + CONTENT_LANGUAGE: "Content-Language", + CONTENT_LENGTH: "Content-Length", + CONTENT_MD5: "Content-Md5", + CONTENT_TRANSFER_ENCODING: "Content-Transfer-Encoding", + CONTENT_TYPE: "Content-Type", + COOKIE: "Cookie", + DATE: "date", + IF_MATCH: "if-match", + IF_MODIFIED_SINCE: "if-modified-since", + IF_NONE_MATCH: "if-none-match", + IF_UNMODIFIED_SINCE: "if-unmodified-since", + PREFIX_FOR_STORAGE: "x-ms-", + RANGE: "Range", + USER_AGENT: "User-Agent", + X_MS_CLIENT_REQUEST_ID: "x-ms-client-request-id", + X_MS_COPY_SOURCE: "x-ms-copy-source", + X_MS_DATE: "x-ms-date", + X_MS_ERROR_CODE: "x-ms-error-code", + X_MS_VERSION: "x-ms-version", + X_MS_CopySourceErrorCode: "x-ms-copy-source-error-code", +}; +exports.DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;`; /// List of ports used for path style addressing. /// Path style addressing means that storage account is put in URI's Path segment in instead of in host. exports.PathStylePorts = [ @@ -121356,31 +114975,7 @@ exports.PathStylePorts = [ /***/ }), -/***/ 53683: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.tracingClient = void 0; -const core_tracing_1 = __nccwpck_require__(19363); -const constants_js_1 = __nccwpck_require__(81865); -/** - * Creates a span using the global tracer. - * @internal - */ -exports.tracingClient = (0, core_tracing_1.createTracingClient)({ - packageName: "@azure/storage-blob", - packageVersion: constants_js_1.SDK_VERSION, - namespace: "Microsoft.Storage", -}); -//# sourceMappingURL=tracing.js.map - -/***/ }), - -/***/ 16673: +/***/ 61876: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -121411,22 +115006,13 @@ exports.sanitizeHeaders = sanitizeHeaders; exports.iEqual = iEqual; exports.getAccountNameFromUrl = getAccountNameFromUrl; exports.isIpEndpointStyle = isIpEndpointStyle; -exports.toBlobTagsString = toBlobTagsString; -exports.toBlobTags = toBlobTags; -exports.toTags = toTags; -exports.toQuerySerialization = toQuerySerialization; -exports.parseObjectReplicationRecord = parseObjectReplicationRecord; exports.attachCredential = attachCredential; exports.httpAuthorizationToString = httpAuthorizationToString; -exports.BlobNameToString = BlobNameToString; -exports.ConvertInternalResponseOfListBlobFlat = ConvertInternalResponseOfListBlobFlat; -exports.ConvertInternalResponseOfListBlobHierarchy = ConvertInternalResponseOfListBlobHierarchy; -exports.ExtractPageRangeInfoItems = ExtractPageRangeInfoItems; exports.EscapePath = EscapePath; exports.assertResponse = assertResponse; const core_rest_pipeline_1 = __nccwpck_require__(29146); const core_util_1 = __nccwpck_require__(80637); -const constants_js_1 = __nccwpck_require__(81865); +const constants_js_1 = __nccwpck_require__(77807); /** * Reserved URL characters must be properly escaped for Storage services like Blob or File. * @@ -121474,8 +115060,8 @@ const constants_js_1 = __nccwpck_require__(81865); * * We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL. * - * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata - * @see https://learn.microsoft.com/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata + * @see https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata + * @see https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata * * @param url - */ @@ -121489,7 +115075,7 @@ function escapeURLPath(url) { } function getProxyUriFromDevConnString(connectionString) { // Development Connection String - // https://learn.microsoft.com/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key + // https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key let proxyUri = ""; if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) { // CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri @@ -121902,446 +115488,74 @@ function getAccountNameFromUrl(url) { let accountName; try { if (parsedUrl.hostname.split(".")[1] === "blob") { - // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; - accountName = parsedUrl.hostname.split(".")[0]; - } - else if (isIpEndpointStyle(parsedUrl)) { - // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/ - // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/ - // .getPath() -> /devstoreaccount1/ - accountName = parsedUrl.pathname.split("/")[1]; - } - else { - // Custom domain case: "https://customdomain.com/containername/blob". - accountName = ""; - } - return accountName; - } - catch (error) { - throw new Error("Unable to extract accountName with provided information."); - } -} -function isIpEndpointStyle(parsedUrl) { - const host = parsedUrl.host; - // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'. - // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part. - // Case 3: Ipv4, use broad regex which just check if host contains Ipv4. - // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html. - return (/^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) || - (Boolean(parsedUrl.port) && constants_js_1.PathStylePorts.includes(parsedUrl.port))); -} -/** - * Convert Tags to encoded string. - * - * @param tags - - */ -function toBlobTagsString(tags) { - if (tags === undefined) { - return undefined; - } - const tagPairs = []; - for (const key in tags) { - if (Object.prototype.hasOwnProperty.call(tags, key)) { - const value = tags[key]; - tagPairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`); - } - } - return tagPairs.join("&"); -} -/** - * Convert Tags type to BlobTags. - * - * @param tags - - */ -function toBlobTags(tags) { - if (tags === undefined) { - return undefined; - } - const res = { - blobTagSet: [], - }; - for (const key in tags) { - if (Object.prototype.hasOwnProperty.call(tags, key)) { - const value = tags[key]; - res.blobTagSet.push({ - key, - value, - }); - } - } - return res; -} -/** - * Covert BlobTags to Tags type. - * - * @param tags - - */ -function toTags(tags) { - if (tags === undefined) { - return undefined; - } - const res = {}; - for (const blobTag of tags.blobTagSet) { - res[blobTag.key] = blobTag.value; - } - return res; -} -/** - * Convert BlobQueryTextConfiguration to QuerySerialization type. - * - * @param textConfiguration - - */ -function toQuerySerialization(textConfiguration) { - if (textConfiguration === undefined) { - return undefined; - } - switch (textConfiguration.kind) { - case "csv": - return { - format: { - type: "delimited", - delimitedTextConfiguration: { - columnSeparator: textConfiguration.columnSeparator || ",", - fieldQuote: textConfiguration.fieldQuote || "", - recordSeparator: textConfiguration.recordSeparator, - escapeChar: textConfiguration.escapeCharacter || "", - headersPresent: textConfiguration.hasHeaders || false, - }, - }, - }; - case "json": - return { - format: { - type: "json", - jsonTextConfiguration: { - recordSeparator: textConfiguration.recordSeparator, - }, - }, - }; - case "arrow": - return { - format: { - type: "arrow", - arrowConfiguration: { - schema: textConfiguration.schema, - }, - }, - }; - case "parquet": - return { - format: { - type: "parquet", - }, - }; - default: - throw Error("Invalid BlobQueryTextConfiguration."); - } -} -function parseObjectReplicationRecord(objectReplicationRecord) { - if (!objectReplicationRecord) { - return undefined; - } - if ("policy-id" in objectReplicationRecord) { - // If the dictionary contains a key with policy id, we are not required to do any parsing since - // the policy id should already be stored in the ObjectReplicationDestinationPolicyId. - return undefined; - } - const orProperties = []; - for (const key in objectReplicationRecord) { - const ids = key.split("_"); - const policyPrefix = "or-"; - if (ids[0].startsWith(policyPrefix)) { - ids[0] = ids[0].substring(policyPrefix.length); - } - const rule = { - ruleId: ids[1], - replicationStatus: objectReplicationRecord[key], - }; - const policyIndex = orProperties.findIndex((policy) => policy.policyId === ids[0]); - if (policyIndex > -1) { - orProperties[policyIndex].rules.push(rule); - } - else { - orProperties.push({ - policyId: ids[0], - rules: [rule], - }); - } - } - return orProperties; -} -/** - * Attach a TokenCredential to an object. - * - * @param thing - - * @param credential - - */ -function attachCredential(thing, credential) { - thing.credential = credential; - return thing; -} -function httpAuthorizationToString(httpAuthorization) { - return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined; -} -function BlobNameToString(name) { - if (name.encoded) { - return decodeURIComponent(name.content); - } - else { - return name.content; - } -} -function ConvertInternalResponseOfListBlobFlat(internalResponse) { - return { - ...internalResponse, - segment: { - blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => { - const blobItem = { - ...blobItemInteral, - name: BlobNameToString(blobItemInteral.name), - }; - return blobItem; - }), - }, - }; -} -function ConvertInternalResponseOfListBlobHierarchy(internalResponse) { - return { - ...internalResponse, - segment: { - blobPrefixes: internalResponse.segment.blobPrefixes?.map((blobPrefixInternal) => { - const blobPrefix = { - ...blobPrefixInternal, - name: BlobNameToString(blobPrefixInternal.name), - }; - return blobPrefix; - }), - blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => { - const blobItem = { - ...blobItemInteral, - name: BlobNameToString(blobItemInteral.name), - }; - return blobItem; - }), - }, - }; -} -function* ExtractPageRangeInfoItems(getPageRangesSegment) { - let pageRange = []; - let clearRange = []; - if (getPageRangesSegment.pageRange) - pageRange = getPageRangesSegment.pageRange; - if (getPageRangesSegment.clearRange) - clearRange = getPageRangesSegment.clearRange; - let pageRangeIndex = 0; - let clearRangeIndex = 0; - while (pageRangeIndex < pageRange.length && clearRangeIndex < clearRange.length) { - if (pageRange[pageRangeIndex].start < clearRange[clearRangeIndex].start) { - yield { - start: pageRange[pageRangeIndex].start, - end: pageRange[pageRangeIndex].end, - isClear: false, - }; - ++pageRangeIndex; - } - else { - yield { - start: clearRange[clearRangeIndex].start, - end: clearRange[clearRangeIndex].end, - isClear: true, - }; - ++clearRangeIndex; - } - } - for (; pageRangeIndex < pageRange.length; ++pageRangeIndex) { - yield { - start: pageRange[pageRangeIndex].start, - end: pageRange[pageRangeIndex].end, - isClear: false, - }; - } - for (; clearRangeIndex < clearRange.length; ++clearRangeIndex) { - yield { - start: clearRange[clearRangeIndex].start, - end: clearRange[clearRangeIndex].end, - isClear: true, - }; - } -} -/** - * Escape the blobName but keep path separator ('/'). - */ -function EscapePath(blobName) { - const split = blobName.split("/"); - for (let i = 0; i < split.length; i++) { - split[i] = encodeURIComponent(split[i]); - } - return split.join("/"); -} -/** - * A typesafe helper for ensuring that a given response object has - * the original _response attached. - * @param response - A response object from calling a client operation - * @returns The same object, but with known _response property - */ -function assertResponse(response) { - if (`_response` in response) { - return response; - } - throw new TypeError(`Unexpected response object ${response}`); -} -//# sourceMappingURL=utils.common.js.map - -/***/ }), - -/***/ 85157: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.fsCreateReadStream = exports.fsStat = void 0; -exports.streamToBuffer = streamToBuffer; -exports.streamToBuffer2 = streamToBuffer2; -exports.streamToBuffer3 = streamToBuffer3; -exports.readStreamToLocalFile = readStreamToLocalFile; -const tslib_1 = __nccwpck_require__(4351); -const node_fs_1 = tslib_1.__importDefault(__nccwpck_require__(87561)); -const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(47261)); -const constants_js_1 = __nccwpck_require__(81865); -/** - * Reads a readable stream into buffer. Fill the buffer from offset to end. - * - * @param stream - A Node.js Readable stream - * @param buffer - Buffer to be filled, length must greater than or equal to offset - * @param offset - From which position in the buffer to be filled, inclusive - * @param end - To which position in the buffer to be filled, exclusive - * @param encoding - Encoding of the Readable stream - */ -async function streamToBuffer(stream, buffer, offset, end, encoding) { - let pos = 0; // Position in stream - const count = end - offset; // Total amount of data needed in stream - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => reject(new Error(`The operation cannot be completed in timeout.`)), constants_js_1.REQUEST_TIMEOUT); - stream.on("readable", () => { - if (pos >= count) { - clearTimeout(timeout); - resolve(); - return; - } - let chunk = stream.read(); - if (!chunk) { - return; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding); - } - // How much data needed in this chunk - const chunkLength = pos + chunk.length > count ? count - pos : chunk.length; - buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength); - pos += chunkLength; - }); - stream.on("end", () => { - clearTimeout(timeout); - if (pos < count) { - reject(new Error(`Stream drains before getting enough data needed. Data read: ${pos}, data need: ${count}`)); - } - resolve(); - }); - stream.on("error", (msg) => { - clearTimeout(timeout); - reject(msg); - }); - }); -} -/** - * Reads a readable stream into buffer entirely. - * - * @param stream - A Node.js Readable stream - * @param buffer - Buffer to be filled, length must greater than or equal to offset - * @param encoding - Encoding of the Readable stream - * @returns with the count of bytes read. - * @throws `RangeError` If buffer size is not big enough. - */ -async function streamToBuffer2(stream, buffer, encoding) { - let pos = 0; // Position in stream - const bufferSize = buffer.length; - return new Promise((resolve, reject) => { - stream.on("readable", () => { - let chunk = stream.read(); - if (!chunk) { - return; - } - if (typeof chunk === "string") { - chunk = Buffer.from(chunk, encoding); - } - if (pos + chunk.length > bufferSize) { - reject(new Error(`Stream exceeds buffer size. Buffer size: ${bufferSize}`)); - return; - } - buffer.fill(chunk, pos, pos + chunk.length); - pos += chunk.length; - }); - stream.on("end", () => { - resolve(pos); - }); - stream.on("error", reject); - }); + // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; + accountName = parsedUrl.hostname.split(".")[0]; + } + else if (isIpEndpointStyle(parsedUrl)) { + // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/ + // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/ + // .getPath() -> /devstoreaccount1/ + accountName = parsedUrl.pathname.split("/")[1]; + } + else { + // Custom domain case: "https://customdomain.com/containername/blob". + accountName = ""; + } + return accountName; + } + catch (error) { + throw new Error("Unable to extract accountName with provided information."); + } +} +function isIpEndpointStyle(parsedUrl) { + const host = parsedUrl.host; + // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'. + // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part. + // Case 3: Ipv4, use broad regex which just check if host contains Ipv4. + // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html. + return (/^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) || + (Boolean(parsedUrl.port) && constants_js_1.PathStylePorts.includes(parsedUrl.port))); } /** - * Reads a readable stream into a buffer. + * Attach a TokenCredential to an object. * - * @param stream - A Node.js Readable stream - * @param encoding - Encoding of the Readable stream - * @returns with the count of bytes read. + * @param thing - + * @param credential - */ -async function streamToBuffer3(readableStream, encoding) { - return new Promise((resolve, reject) => { - const chunks = []; - readableStream.on("data", (data) => { - chunks.push(typeof data === "string" ? Buffer.from(data, encoding) : data); - }); - readableStream.on("end", () => { - resolve(Buffer.concat(chunks)); - }); - readableStream.on("error", reject); - }); +function attachCredential(thing, credential) { + thing.credential = credential; + return thing; +} +function httpAuthorizationToString(httpAuthorization) { + return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined; } /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed. - * - * @param rs - The read stream. - * @param file - Destination file path. + * Escape the blobName but keep path separator ('/'). */ -async function readStreamToLocalFile(rs, file) { - return new Promise((resolve, reject) => { - const ws = node_fs_1.default.createWriteStream(file); - rs.on("error", (err) => { - reject(err); - }); - ws.on("error", (err) => { - reject(err); - }); - ws.on("close", resolve); - rs.pipe(ws); - }); +function EscapePath(blobName) { + const split = blobName.split("/"); + for (let i = 0; i < split.length; i++) { + split[i] = encodeURIComponent(split[i]); + } + return split.join("/"); } /** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * Promisified version of fs.stat(). + * A typesafe helper for ensuring that a given response object has + * the original _response attached. + * @param response - A response object from calling a client operation + * @returns The same object, but with known _response property */ -exports.fsStat = node_util_1.default.promisify(node_fs_1.default.stat); -exports.fsCreateReadStream = node_fs_1.default.createReadStream; -//# sourceMappingURL=utils.js.map +function assertResponse(response) { + if (`_response` in response) { + return response; + } + throw new TypeError(`Unexpected response object ${response}`); +} +//# sourceMappingURL=utils.common.js.map /***/ }), -/***/ 58412: +/***/ 81577: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -122379,7 +115593,7 @@ exports.AbortError = AbortError; /***/ }), -/***/ 1753: +/***/ 31514: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -122388,1979 +115602,1927 @@ exports.AbortError = AbortError; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AbortError = void 0; -var AbortError_js_1 = __nccwpck_require__(58412); +var AbortError_js_1 = __nccwpck_require__(81577); Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 80974: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 92960: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BufferScheduler = void 0; -const events_1 = __nccwpck_require__(82361); -const PooledBuffer_js_1 = __nccwpck_require__(39474); -/** - * This class accepts a Node.js Readable stream as input, and keeps reading data - * from the stream into the internal buffer structure, until it reaches maxBuffers. - * Every available buffer will try to trigger outgoingHandler. - * - * The internal buffer structure includes an incoming buffer array, and a outgoing - * buffer array. The incoming buffer array includes the "empty" buffers can be filled - * with new incoming data. The outgoing array includes the filled buffers to be - * handled by outgoingHandler. Every above buffer size is defined by parameter bufferSize. - * - * NUM_OF_ALL_BUFFERS = BUFFERS_IN_INCOMING + BUFFERS_IN_OUTGOING + BUFFERS_UNDER_HANDLING - * - * NUM_OF_ALL_BUFFERS lesser than or equal to maxBuffers - * - * PERFORMANCE IMPROVEMENT TIPS: - * 1. Input stream highWaterMark is better to set a same value with bufferSize - * parameter, which will avoid Buffer.concat() operations. - * 2. concurrency should set a smaller value than maxBuffers, which is helpful to - * reduce the possibility when a outgoing handler waits for the stream data. - * in this situation, outgoing handlers are blocked. - * Outgoing queue shouldn't be empty. - */ -class BufferScheduler { - /** - * Size of buffers in incoming and outgoing queues. This class will try to align - * data read from Readable stream into buffer chunks with bufferSize defined. - */ - bufferSize; - /** - * How many buffers can be created or maintained. - */ - maxBuffers; - /** - * A Node.js Readable stream. - */ - readable; - /** - * OutgoingHandler is an async function triggered by BufferScheduler when there - * are available buffers in outgoing array. - */ - outgoingHandler; - /** - * An internal event emitter. - */ - emitter = new events_1.EventEmitter(); - /** - * Concurrency of executing outgoingHandlers. (0 lesser than concurrency lesser than or equal to maxBuffers) - */ - concurrency; - /** - * An internal offset marker to track data offset in bytes of next outgoingHandler. - */ - offset = 0; - /** - * An internal marker to track whether stream is end. - */ - isStreamEnd = false; - /** - * An internal marker to track whether stream or outgoingHandler returns error. - */ - isError = false; - /** - * How many handlers are executing. - */ - executingOutgoingHandlers = 0; - /** - * Encoding of the input Readable stream which has string data type instead of Buffer. - */ - encoding; - /** - * How many buffers have been allocated. - */ - numBuffers = 0; - /** - * Because this class doesn't know how much data every time stream pops, which - * is defined by highWaterMarker of the stream. So BufferScheduler will cache - * data received from the stream, when data in unresolvedDataArray exceeds the - * blockSize defined, it will try to concat a blockSize of buffer, fill into available - * buffers from incoming and push to outgoing array. - */ - unresolvedDataArray = []; - /** - * How much data consisted in unresolvedDataArray. - */ - unresolvedLength = 0; - /** - * The array includes all the available buffers can be used to fill data from stream. - */ - incoming = []; - /** - * The array (queue) includes all the buffers filled from stream data. - */ - outgoing = []; - /** - * Creates an instance of BufferScheduler. - * - * @param readable - A Node.js Readable stream - * @param bufferSize - Buffer size of every maintained buffer - * @param maxBuffers - How many buffers can be allocated - * @param outgoingHandler - An async function scheduled to be - * triggered when a buffer fully filled - * with stream data - * @param concurrency - Concurrency of executing outgoingHandlers (>0) - * @param encoding - [Optional] Encoding of Readable stream when it's a string stream - */ - constructor(readable, bufferSize, maxBuffers, outgoingHandler, concurrency, encoding) { - if (bufferSize <= 0) { - throw new RangeError(`bufferSize must be larger than 0, current is ${bufferSize}`); - } - if (maxBuffers <= 0) { - throw new RangeError(`maxBuffers must be larger than 0, current is ${maxBuffers}`); - } - if (concurrency <= 0) { - throw new RangeError(`concurrency must be larger than 0, current is ${concurrency}`); + +const WritableStream = (__nccwpck_require__(84492).Writable) +const inherits = (__nccwpck_require__(47261).inherits) + +const StreamSearch = __nccwpck_require__(51142) + +const PartStream = __nccwpck_require__(81620) +const HeaderParser = __nccwpck_require__(92032) + +const DASH = 45 +const B_ONEDASH = Buffer.from('-') +const B_CRLF = Buffer.from('\r\n') +const EMPTY_FN = function () {} + +function Dicer (cfg) { + if (!(this instanceof Dicer)) { return new Dicer(cfg) } + WritableStream.call(this, cfg) + + if (!cfg || (!cfg.headerFirst && typeof cfg.boundary !== 'string')) { throw new TypeError('Boundary required') } + + if (typeof cfg.boundary === 'string') { this.setBoundary(cfg.boundary) } else { this._bparser = undefined } + + this._headerFirst = cfg.headerFirst + + this._dashes = 0 + this._parts = 0 + this._finished = false + this._realFinish = false + this._isPreamble = true + this._justMatched = false + this._firstWrite = true + this._inHeader = true + this._part = undefined + this._cb = undefined + this._ignoreData = false + this._partOpts = { highWaterMark: cfg.partHwm } + this._pause = false + + const self = this + this._hparser = new HeaderParser(cfg) + this._hparser.on('header', function (header) { + self._inHeader = false + self._part.emit('header', header) + }) +} +inherits(Dicer, WritableStream) + +Dicer.prototype.emit = function (ev) { + if (ev === 'finish' && !this._realFinish) { + if (!this._finished) { + const self = this + process.nextTick(function () { + self.emit('error', new Error('Unexpected end of multipart data')) + if (self._part && !self._ignoreData) { + const type = (self._isPreamble ? 'Preamble' : 'Part') + self._part.emit('error', new Error(type + ' terminated early due to unexpected end of multipart data')) + self._part.push(null) + process.nextTick(function () { + self._realFinish = true + self.emit('finish') + self._realFinish = false + }) + return } - this.bufferSize = bufferSize; - this.maxBuffers = maxBuffers; - this.readable = readable; - this.outgoingHandler = outgoingHandler; - this.concurrency = concurrency; - this.encoding = encoding; - } - /** - * Start the scheduler, will return error when stream of any of the outgoingHandlers - * returns error. - * - */ - async do() { - return new Promise((resolve, reject) => { - this.readable.on("data", (data) => { - data = typeof data === "string" ? Buffer.from(data, this.encoding) : data; - this.appendUnresolvedData(data); - if (!this.resolveData()) { - this.readable.pause(); - } - }); - this.readable.on("error", (err) => { - this.emitter.emit("error", err); - }); - this.readable.on("end", () => { - this.isStreamEnd = true; - this.emitter.emit("checkEnd"); - }); - this.emitter.on("error", (err) => { - this.isError = true; - this.readable.pause(); - reject(err); - }); - this.emitter.on("checkEnd", () => { - if (this.outgoing.length > 0) { - this.triggerOutgoingHandlers(); - return; - } - if (this.isStreamEnd && this.executingOutgoingHandlers === 0) { - if (this.unresolvedLength > 0 && this.unresolvedLength < this.bufferSize) { - const buffer = this.shiftBufferFromUnresolvedDataArray(); - this.outgoingHandler(() => buffer.getReadableStream(), buffer.size, this.offset) - .then(resolve) - .catch(reject); - } - else if (this.unresolvedLength >= this.bufferSize) { - return; - } - else { - resolve(); - } - } - }); - }); - } - /** - * Insert a new data into unresolved array. - * - * @param data - - */ - appendUnresolvedData(data) { - this.unresolvedDataArray.push(data); - this.unresolvedLength += data.length; + self._realFinish = true + self.emit('finish') + self._realFinish = false + }) } - /** - * Try to shift a buffer with size in blockSize. The buffer returned may be less - * than blockSize when data in unresolvedDataArray is less than bufferSize. - * - */ - shiftBufferFromUnresolvedDataArray(buffer) { - if (!buffer) { - buffer = new PooledBuffer_js_1.PooledBuffer(this.bufferSize, this.unresolvedDataArray, this.unresolvedLength); - } - else { - buffer.fill(this.unresolvedDataArray, this.unresolvedLength); - } - this.unresolvedLength -= buffer.size; - return buffer; + } else { WritableStream.prototype.emit.apply(this, arguments) } +} + +Dicer.prototype._write = function (data, encoding, cb) { + // ignore unexpected data (e.g. extra trailer data after finished) + if (!this._hparser && !this._bparser) { return cb() } + + if (this._headerFirst && this._isPreamble) { + if (!this._part) { + this._part = new PartStream(this._partOpts) + if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } } - /** - * Resolve data in unresolvedDataArray. For every buffer with size in blockSize - * shifted, it will try to get (or allocate a buffer) from incoming, and fill it, - * then push it into outgoing to be handled by outgoing handler. - * - * Return false when available buffers in incoming are not enough, else true. - * - * @returns Return false when buffers in incoming are not enough, else true. - */ - resolveData() { - while (this.unresolvedLength >= this.bufferSize) { - let buffer; - if (this.incoming.length > 0) { - buffer = this.incoming.shift(); - this.shiftBufferFromUnresolvedDataArray(buffer); - } - else { - if (this.numBuffers < this.maxBuffers) { - buffer = this.shiftBufferFromUnresolvedDataArray(); - this.numBuffers++; - } - else { - // No available buffer, wait for buffer returned - return false; - } - } - this.outgoing.push(buffer); - this.triggerOutgoingHandlers(); - } - return true; + const r = this._hparser.push(data) + if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } + } + + // allows for "easier" testing + if (this._firstWrite) { + this._bparser.push(B_CRLF) + this._firstWrite = false + } + + this._bparser.push(data) + + if (this._pause) { this._cb = cb } else { cb() } +} + +Dicer.prototype.reset = function () { + this._part = undefined + this._bparser = undefined + this._hparser = undefined +} + +Dicer.prototype.setBoundary = function (boundary) { + const self = this + this._bparser = new StreamSearch('\r\n--' + boundary) + this._bparser.on('info', function (isMatch, data, start, end) { + self._oninfo(isMatch, data, start, end) + }) +} + +Dicer.prototype._ignore = function () { + if (this._part && !this._ignoreData) { + this._ignoreData = true + this._part.on('error', EMPTY_FN) + // we must perform some kind of read on the stream even though we are + // ignoring the data, otherwise node's Readable stream will not emit 'end' + // after pushing null to the stream + this._part.resume() + } +} + +Dicer.prototype._oninfo = function (isMatch, data, start, end) { + let buf; const self = this; let i = 0; let r; let shouldWriteMore = true + + if (!this._part && this._justMatched && data) { + while (this._dashes < 2 && (start + i) < end) { + if (data[start + i] === DASH) { + ++i + ++this._dashes + } else { + if (this._dashes) { buf = B_ONEDASH } + this._dashes = 0 + break + } } - /** - * Try to trigger a outgoing handler for every buffer in outgoing. Stop when - * concurrency reaches. - */ - async triggerOutgoingHandlers() { - let buffer; - do { - if (this.executingOutgoingHandlers >= this.concurrency) { - return; - } - buffer = this.outgoing.shift(); - if (buffer) { - this.triggerOutgoingHandler(buffer); - } - } while (buffer); + if (this._dashes === 2) { + if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + this.reset() + this._finished = true + // no more parts will be added + if (self._parts === 0) { + self._realFinish = true + self.emit('finish') + self._realFinish = false + } } - /** - * Trigger a outgoing handler for a buffer shifted from outgoing. - * - * @param buffer - - */ - async triggerOutgoingHandler(buffer) { - const bufferLength = buffer.size; - this.executingOutgoingHandlers++; - this.offset += bufferLength; - try { - await this.outgoingHandler(() => buffer.getReadableStream(), bufferLength, this.offset - bufferLength); - } - catch (err) { - this.emitter.emit("error", err); - return; - } - this.executingOutgoingHandlers--; - this.reuseBuffer(buffer); - this.emitter.emit("checkEnd"); + if (this._dashes) { return } + } + if (this._justMatched) { this._justMatched = false } + if (!this._part) { + this._part = new PartStream(this._partOpts) + this._part._read = function (n) { + self._unpause() } - /** - * Return buffer used by outgoing handler into incoming. - * - * @param buffer - - */ - reuseBuffer(buffer) { - this.incoming.push(buffer); - if (!this.isError && this.resolveData() && !this.isStreamEnd) { - this.readable.resume(); - } + if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (!this._isPreamble) { this._inHeader = true } + } + if (data && start < end && !this._ignoreData) { + if (this._isPreamble || !this._inHeader) { + if (buf) { shouldWriteMore = this._part.push(buf) } + shouldWriteMore = this._part.push(data.slice(start, end)) + if (!shouldWriteMore) { this._pause = true } + } else if (!this._isPreamble && this._inHeader) { + if (buf) { this._hparser.push(buf) } + r = this._hparser.push(data.slice(start, end)) + if (!this._inHeader && r !== undefined && r < end) { this._oninfo(false, data, start + r, end) } + } + } + if (isMatch) { + this._hparser.reset() + if (this._isPreamble) { this._isPreamble = false } else { + if (start !== end) { + ++this._parts + this._part.on('end', function () { + if (--self._parts === 0) { + if (self._finished) { + self._realFinish = true + self.emit('finish') + self._realFinish = false + } else { + self._unpause() + } + } + }) + } } + this._part.push(null) + this._part = undefined + this._ignoreData = false + this._justMatched = true + this._dashes = 0 + } +} + +Dicer.prototype._unpause = function () { + if (!this._pause) { return } + + this._pause = false + if (this._cb) { + const cb = this._cb + this._cb = undefined + cb() + } } -exports.BufferScheduler = BufferScheduler; -//# sourceMappingURL=BufferScheduler.js.map + +module.exports = Dicer + /***/ }), -/***/ 82202: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 92032: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BuffersStream = void 0; -const node_stream_1 = __nccwpck_require__(84492); -/** - * This class generates a readable stream from the data in an array of buffers. - */ -class BuffersStream extends node_stream_1.Readable { - buffers; - byteLength; - /** - * The offset of data to be read in the current buffer. - */ - byteOffsetInCurrentBuffer; - /** - * The index of buffer to be read in the array of buffers. - */ - bufferIndex; - /** - * The total length of data already read. - */ - pushedBytesLength; - /** - * Creates an instance of BuffersStream that will emit the data - * contained in the array of buffers. - * - * @param buffers - Array of buffers containing the data - * @param byteLength - The total length of data contained in the buffers - */ - constructor(buffers, byteLength, options) { - super(options); - this.buffers = buffers; - this.byteLength = byteLength; - this.byteOffsetInCurrentBuffer = 0; - this.bufferIndex = 0; - this.pushedBytesLength = 0; - // check byteLength is no larger than buffers[] total length - let buffersLength = 0; - for (const buf of this.buffers) { - buffersLength += buf.byteLength; - } - if (buffersLength < this.byteLength) { - throw new Error("Data size shouldn't be larger than the total length of buffers."); - } - } - /** - * Internal _read() that will be called when the stream wants to pull more data in. - * - * @param size - Optional. The size of data to be read - */ - _read(size) { - if (this.pushedBytesLength >= this.byteLength) { - this.push(null); - } - if (!size) { - size = this.readableHighWaterMark; - } - const outBuffers = []; - let i = 0; - while (i < size && this.pushedBytesLength < this.byteLength) { - // The last buffer may be longer than the data it contains. - const remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength; - const remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer; - const remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers); - if (remaining > size - i) { - // chunkSize = size - i - const end = this.byteOffsetInCurrentBuffer + size - i; - outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); - this.pushedBytesLength += size - i; - this.byteOffsetInCurrentBuffer = end; - i = size; - break; - } - else { - // chunkSize = remaining - const end = this.byteOffsetInCurrentBuffer + remaining; - outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end)); - if (remaining === remainingCapacityInThisBuffer) { - // this.buffers[this.bufferIndex] used up, shift to next one - this.byteOffsetInCurrentBuffer = 0; - this.bufferIndex++; - } - else { - this.byteOffsetInCurrentBuffer = end; - } - this.pushedBytesLength += remaining; - i += remaining; - } - } - if (outBuffers.length > 1) { - this.push(Buffer.concat(outBuffers)); - } - else if (outBuffers.length === 1) { - this.push(outBuffers[0]); - } + +const EventEmitter = (__nccwpck_require__(15673).EventEmitter) +const inherits = (__nccwpck_require__(47261).inherits) +const getLimit = __nccwpck_require__(21467) + +const StreamSearch = __nccwpck_require__(51142) + +const B_DCRLF = Buffer.from('\r\n\r\n') +const RE_CRLF = /\r\n/g +const RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/ // eslint-disable-line no-control-regex + +function HeaderParser (cfg) { + EventEmitter.call(this) + + cfg = cfg || {} + const self = this + this.nread = 0 + this.maxed = false + this.npairs = 0 + this.maxHeaderPairs = getLimit(cfg, 'maxHeaderPairs', 2000) + this.maxHeaderSize = getLimit(cfg, 'maxHeaderSize', 80 * 1024) + this.buffer = '' + this.header = {} + this.finished = false + this.ss = new StreamSearch(B_DCRLF) + this.ss.on('info', function (isMatch, data, start, end) { + if (data && !self.maxed) { + if (self.nread + end - start >= self.maxHeaderSize) { + end = self.maxHeaderSize - self.nread + start + self.nread = self.maxHeaderSize + self.maxed = true + } else { self.nread += (end - start) } + + self.buffer += data.toString('binary', start, end) } + if (isMatch) { self._finish() } + }) } -exports.BuffersStream = BuffersStream; -//# sourceMappingURL=BuffersStream.js.map +inherits(HeaderParser, EventEmitter) -/***/ }), +HeaderParser.prototype.push = function (data) { + const r = this.ss.push(data) + if (this.finished) { return r } +} -/***/ 39474: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +HeaderParser.prototype.reset = function () { + this.finished = false + this.buffer = '' + this.header = {} + this.ss.reset() +} -"use strict"; +HeaderParser.prototype._finish = function () { + if (this.buffer) { this._parseHeader() } + this.ss.matches = this.ss.maxMatches + const header = this.header + this.header = {} + this.buffer = '' + this.finished = true + this.nread = this.npairs = 0 + this.maxed = false + this.emit('header', header) +} -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PooledBuffer = void 0; -const tslib_1 = __nccwpck_require__(4351); -const BuffersStream_js_1 = __nccwpck_require__(82202); -const node_buffer_1 = tslib_1.__importDefault(__nccwpck_require__(72254)); -/** - * maxBufferLength is max size of each buffer in the pooled buffers. - */ -const maxBufferLength = node_buffer_1.default.constants.MAX_LENGTH; -/** - * This class provides a buffer container which conceptually has no hard size limit. - * It accepts a capacity, an array of input buffers and the total length of input data. - * It will allocate an internal "buffer" of the capacity and fill the data in the input buffers - * into the internal "buffer" serially with respect to the total length. - * Then by calling PooledBuffer.getReadableStream(), you can get a readable stream - * assembled from all the data in the internal "buffer". - */ -class PooledBuffer { - /** - * Internal buffers used to keep the data. - * Each buffer has a length of the maxBufferLength except last one. - */ - buffers = []; - /** - * The total size of internal buffers. - */ - capacity; - /** - * The total size of data contained in internal buffers. - */ - _size; - /** - * The size of the data contained in the pooled buffers. - */ - get size() { - return this._size; - } - constructor(capacity, buffers, totalLength) { - this.capacity = capacity; - this._size = 0; - // allocate - const bufferNum = Math.ceil(capacity / maxBufferLength); - for (let i = 0; i < bufferNum; i++) { - let len = i === bufferNum - 1 ? capacity % maxBufferLength : maxBufferLength; - if (len === 0) { - len = maxBufferLength; - } - this.buffers.push(Buffer.allocUnsafe(len)); - } - if (buffers) { - this.fill(buffers, totalLength); - } - } - /** - * Fill the internal buffers with data in the input buffers serially - * with respect to the total length and the total capacity of the internal buffers. - * Data copied will be shift out of the input buffers. - * - * @param buffers - Input buffers containing the data to be filled in the pooled buffer - * @param totalLength - Total length of the data to be filled in. - * - */ - fill(buffers, totalLength) { - this._size = Math.min(this.capacity, totalLength); - let i = 0, j = 0, targetOffset = 0, sourceOffset = 0, totalCopiedNum = 0; - while (totalCopiedNum < this._size) { - const source = buffers[i]; - const target = this.buffers[j]; - const copiedNum = source.copy(target, targetOffset, sourceOffset); - totalCopiedNum += copiedNum; - sourceOffset += copiedNum; - targetOffset += copiedNum; - if (sourceOffset === source.length) { - i++; - sourceOffset = 0; - } - if (targetOffset === target.length) { - j++; - targetOffset = 0; - } - } - // clear copied from source buffers - buffers.splice(0, i); - if (buffers.length > 0) { - buffers[0] = buffers[0].slice(sourceOffset); - } +HeaderParser.prototype._parseHeader = function () { + if (this.npairs === this.maxHeaderPairs) { return } + + const lines = this.buffer.split(RE_CRLF) + const len = lines.length + let m, h + + for (var i = 0; i < len; ++i) { // eslint-disable-line no-var + if (lines[i].length === 0) { continue } + if (lines[i][0] === '\t' || lines[i][0] === ' ') { + // folded header content + // RFC2822 says to just remove the CRLF and not the whitespace following + // it, so we follow the RFC and include the leading whitespace ... + if (h) { + this.header[h][this.header[h].length - 1] += lines[i] + continue + } } - /** - * Get the readable stream assembled from all the data in the internal buffers. - * - */ - getReadableStream() { - return new BuffersStream_js_1.BuffersStream(this.buffers, this.size); + + const posColon = lines[i].indexOf(':') + if ( + posColon === -1 || + posColon === 0 + ) { + return } + m = RE_HDR.exec(lines[i]) + h = m[1].toLowerCase() + this.header[h] = this.header[h] || [] + this.header[h].push((m[2] || '')) + if (++this.npairs === this.maxHeaderPairs) { break } + } } -exports.PooledBuffer = PooledBuffer; -//# sourceMappingURL=PooledBuffer.js.map + +module.exports = HeaderParser + /***/ }), -/***/ 83269: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 81620: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageBrowserPolicyFactory = exports.StorageBrowserPolicy = void 0; -const StorageBrowserPolicy_js_1 = __nccwpck_require__(69277); -Object.defineProperty(exports, "StorageBrowserPolicy", ({ enumerable: true, get: function () { return StorageBrowserPolicy_js_1.StorageBrowserPolicy; } })); -/** - * StorageBrowserPolicyFactory is a factory class helping generating StorageBrowserPolicy objects. - */ -class StorageBrowserPolicyFactory { - /** - * Creates a StorageBrowserPolicyFactory object. - * - * @param nextPolicy - - * @param options - - */ - create(nextPolicy, options) { - return new StorageBrowserPolicy_js_1.StorageBrowserPolicy(nextPolicy, options); - } + +const inherits = (__nccwpck_require__(47261).inherits) +const ReadableStream = (__nccwpck_require__(84492).Readable) + +function PartStream (opts) { + ReadableStream.call(this, opts) } -exports.StorageBrowserPolicyFactory = StorageBrowserPolicyFactory; -//# sourceMappingURL=StorageBrowserPolicyFactory.js.map +inherits(PartStream, ReadableStream) + +PartStream.prototype._read = function (n) {} + +module.exports = PartStream + /***/ }), -/***/ 26508: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 51142: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageRetryPolicyFactory = exports.StorageRetryPolicy = exports.StorageRetryPolicyType = void 0; -const StorageRetryPolicy_js_1 = __nccwpck_require__(1114); -Object.defineProperty(exports, "StorageRetryPolicy", ({ enumerable: true, get: function () { return StorageRetryPolicy_js_1.StorageRetryPolicy; } })); -const StorageRetryPolicyType_js_1 = __nccwpck_require__(21483); -Object.defineProperty(exports, "StorageRetryPolicyType", ({ enumerable: true, get: function () { return StorageRetryPolicyType_js_1.StorageRetryPolicyType; } })); + /** - * StorageRetryPolicyFactory is a factory class helping generating {@link StorageRetryPolicy} objects. + * Copyright Brian White. All rights reserved. + * + * @see https://github.com/mscdex/streamsearch + * + * 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. + * + * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation + * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool */ -class StorageRetryPolicyFactory { - retryOptions; - /** - * Creates an instance of StorageRetryPolicyFactory. - * @param retryOptions - - */ - constructor(retryOptions) { - this.retryOptions = retryOptions; - } - /** - * Creates a StorageRetryPolicy object. - * - * @param nextPolicy - - * @param options - - */ - create(nextPolicy, options) { - return new StorageRetryPolicy_js_1.StorageRetryPolicy(nextPolicy, options, this.retryOptions); - } -} -exports.StorageRetryPolicyFactory = StorageRetryPolicyFactory; -//# sourceMappingURL=StorageRetryPolicyFactory.js.map +const EventEmitter = (__nccwpck_require__(15673).EventEmitter) +const inherits = (__nccwpck_require__(47261).inherits) -/***/ }), +function SBMH (needle) { + if (typeof needle === 'string') { + needle = Buffer.from(needle) + } -/***/ 92599: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + if (!Buffer.isBuffer(needle)) { + throw new TypeError('The needle has to be a String or a Buffer.') + } -"use strict"; + const needleLength = needle.length -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getCachedDefaultHttpClient = getCachedDefaultHttpClient; -const core_rest_pipeline_1 = __nccwpck_require__(29146); -let _defaultHttpClient; -function getCachedDefaultHttpClient() { - if (!_defaultHttpClient) { - _defaultHttpClient = (0, core_rest_pipeline_1.createDefaultHttpClient)(); - } - return _defaultHttpClient; + if (needleLength === 0) { + throw new Error('The needle cannot be an empty String/Buffer.') + } + + if (needleLength > 256) { + throw new Error('The needle cannot have a length bigger than 256.') + } + + this.maxMatches = Infinity + this.matches = 0 + + this._occ = new Array(256) + .fill(needleLength) // Initialize occurrence table. + this._lookbehind_size = 0 + this._needle = needle + this._bufpos = 0 + + this._lookbehind = Buffer.alloc(needleLength) + + // Populate occurrence table with analysis of the needle, + // ignoring last letter. + for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var + this._occ[needle[i]] = needleLength - 1 - i + } +} +inherits(SBMH, EventEmitter) + +SBMH.prototype.reset = function () { + this._lookbehind_size = 0 + this.matches = 0 + this._bufpos = 0 +} + +SBMH.prototype.push = function (chunk, pos) { + if (!Buffer.isBuffer(chunk)) { + chunk = Buffer.from(chunk, 'binary') + } + const chlen = chunk.length + this._bufpos = pos || 0 + let r + while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) } + return r } -//# sourceMappingURL=cache.js.map -/***/ }), - -/***/ 17662: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +SBMH.prototype._sbmh_feed = function (data) { + const len = data.length + const needle = this._needle + const needleLength = needle.length + const lastNeedleChar = needle[needleLength - 1] -"use strict"; + // Positive: points to a position in `data` + // pos == 3 points to data[3] + // Negative: points to a position in the lookbehind buffer + // pos == -2 points to lookbehind[lookbehind_size - 2] + let pos = -this._lookbehind_size + let ch -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AnonymousCredential = void 0; -const AnonymousCredentialPolicy_js_1 = __nccwpck_require__(85969); -const Credential_js_1 = __nccwpck_require__(34936); -/** - * AnonymousCredential provides a credentialPolicyCreator member used to create - * AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with - * HTTP(S) requests that read public resources or for use with Shared Access - * Signatures (SAS). - */ -class AnonymousCredential extends Credential_js_1.Credential { - /** - * Creates an {@link AnonymousCredentialPolicy} object. - * - * @param nextPolicy - - * @param options - - */ - create(nextPolicy, options) { - return new AnonymousCredentialPolicy_js_1.AnonymousCredentialPolicy(nextPolicy, options); - } -} -exports.AnonymousCredential = AnonymousCredential; -//# sourceMappingURL=AnonymousCredential.js.map + if (pos < 0) { + // Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool + // search with character lookup code that considers both the + // lookbehind buffer and the current round's haystack data. + // + // Loop until + // there is a match. + // or until + // we've moved past the position that requires the + // lookbehind buffer. In this case we switch to the + // optimized loop. + // or until + // the character to look at lies outside the haystack. + while (pos < 0 && pos <= len - needleLength) { + ch = this._sbmh_lookup_char(data, pos + needleLength - 1) -/***/ }), + if ( + ch === lastNeedleChar && + this._sbmh_memcmp(data, pos, needleLength - 1) + ) { + this._lookbehind_size = 0 + ++this.matches + this.emit('info', true) -/***/ 34936: -/***/ ((__unused_webpack_module, exports) => { + return (this._bufpos = pos + needleLength) + } + pos += this._occ[ch] + } -"use strict"; + // No match. -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Credential = void 0; -/** - * Credential is an abstract class for Azure Storage HTTP requests signing. This - * class will host an credentialPolicyCreator factory which generates CredentialPolicy. - */ -class Credential { - /** - * Creates a RequestPolicy object. - * - * @param _nextPolicy - - * @param _options - - */ - create(_nextPolicy, _options) { - throw new Error("Method should be implemented in children classes."); + if (pos < 0) { + // There's too few data for Boyer-Moore-Horspool to run, + // so let's use a different algorithm to skip as much as + // we can. + // Forward pos until + // the trailing part of lookbehind + data + // looks like the beginning of the needle + // or until + // pos == 0 + while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos } } -} -exports.Credential = Credential; -//# sourceMappingURL=Credential.js.map -/***/ }), + if (pos >= 0) { + // Discard lookbehind buffer. + this.emit('info', false, this._lookbehind, 0, this._lookbehind_size) + this._lookbehind_size = 0 + } else { + // Cut off part of the lookbehind buffer that has + // been processed and append the entire haystack + // into it. + const bytesToCutOff = this._lookbehind_size + pos + if (bytesToCutOff > 0) { + // The cut off data is guaranteed not to contain the needle. + this.emit('info', false, this._lookbehind, 0, bytesToCutOff) + } -/***/ 92782: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff, + this._lookbehind_size - bytesToCutOff) + this._lookbehind_size -= bytesToCutOff -"use strict"; + data.copy(this._lookbehind, this._lookbehind_size) + this._lookbehind_size += len -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageSharedKeyCredential = void 0; -const node_crypto_1 = __nccwpck_require__(6005); -const StorageSharedKeyCredentialPolicy_js_1 = __nccwpck_require__(40755); -const Credential_js_1 = __nccwpck_require__(34936); -/** - * ONLY AVAILABLE IN NODE.JS RUNTIME. - * - * StorageSharedKeyCredential for account key authorization of Azure Storage service. - */ -class StorageSharedKeyCredential extends Credential_js_1.Credential { - /** - * Azure Storage account name; readonly. - */ - accountName; - /** - * Azure Storage account key; readonly. - */ - accountKey; - /** - * Creates an instance of StorageSharedKeyCredential. - * @param accountName - - * @param accountKey - - */ - constructor(accountName, accountKey) { - super(); - this.accountName = accountName; - this.accountKey = Buffer.from(accountKey, "base64"); - } - /** - * Creates a StorageSharedKeyCredentialPolicy object. - * - * @param nextPolicy - - * @param options - - */ - create(nextPolicy, options) { - return new StorageSharedKeyCredentialPolicy_js_1.StorageSharedKeyCredentialPolicy(nextPolicy, options, this); - } - /** - * Generates a hash signature for an HTTP request or for a SAS. - * - * @param stringToSign - - */ - computeHMACSHA256(stringToSign) { - return (0, node_crypto_1.createHmac)("sha256", this.accountKey).update(stringToSign, "utf8").digest("base64"); + this._bufpos = len + return len } -} -exports.StorageSharedKeyCredential = StorageSharedKeyCredential; -//# sourceMappingURL=StorageSharedKeyCredential.js.map + } -/***/ }), + pos += (pos >= 0) * this._bufpos -/***/ 83667: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + // Lookbehind buffer is now empty. We only need to check if the + // needle is in the haystack. + if (data.indexOf(needle, pos) !== -1) { + pos = data.indexOf(needle, pos) + ++this.matches + if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) } -"use strict"; + return (this._bufpos = pos + needleLength) + } else { + pos = len - needleLength + } -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BaseRequestPolicy = exports.getCachedDefaultHttpClient = void 0; -const tslib_1 = __nccwpck_require__(4351); -tslib_1.__exportStar(__nccwpck_require__(80974), exports); -var cache_js_1 = __nccwpck_require__(92599); -Object.defineProperty(exports, "getCachedDefaultHttpClient", ({ enumerable: true, get: function () { return cache_js_1.getCachedDefaultHttpClient; } })); -tslib_1.__exportStar(__nccwpck_require__(83269), exports); -tslib_1.__exportStar(__nccwpck_require__(17662), exports); -tslib_1.__exportStar(__nccwpck_require__(34936), exports); -tslib_1.__exportStar(__nccwpck_require__(92782), exports); -tslib_1.__exportStar(__nccwpck_require__(26508), exports); -var RequestPolicy_js_1 = __nccwpck_require__(76584); -Object.defineProperty(exports, "BaseRequestPolicy", ({ enumerable: true, get: function () { return RequestPolicy_js_1.BaseRequestPolicy; } })); -tslib_1.__exportStar(__nccwpck_require__(85969), exports); -tslib_1.__exportStar(__nccwpck_require__(13615), exports); -tslib_1.__exportStar(__nccwpck_require__(69277), exports); -tslib_1.__exportStar(__nccwpck_require__(89782), exports); -tslib_1.__exportStar(__nccwpck_require__(37740), exports); -tslib_1.__exportStar(__nccwpck_require__(21483), exports); -tslib_1.__exportStar(__nccwpck_require__(1114), exports); -tslib_1.__exportStar(__nccwpck_require__(3353), exports); -tslib_1.__exportStar(__nccwpck_require__(40755), exports); -tslib_1.__exportStar(__nccwpck_require__(89020), exports); -tslib_1.__exportStar(__nccwpck_require__(26508), exports); -tslib_1.__exportStar(__nccwpck_require__(72426), exports); -//# sourceMappingURL=index.js.map + // There was no match. If there's trailing haystack data that we cannot + // match yet using the Boyer-Moore-Horspool algorithm (because the trailing + // data is less than the needle size) then match using a modified + // algorithm that starts matching from the beginning instead of the end. + // Whatever trailing data is left after running this algorithm is added to + // the lookbehind buffer. + while ( + pos < len && + ( + data[pos] !== needle[0] || + ( + (Buffer.compare( + data.subarray(pos, pos + len - pos), + needle.subarray(0, len - pos) + ) !== 0) + ) + ) + ) { + ++pos + } + if (pos < len) { + data.copy(this._lookbehind, 0, pos, pos + (len - pos)) + this._lookbehind_size = len - pos + } -/***/ }), + // Everything until pos is guaranteed not to contain needle data. + if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) } -/***/ 89818: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + this._bufpos = len + return len +} -"use strict"; +SBMH.prototype._sbmh_lookup_char = function (data, pos) { + return (pos < 0) + ? this._lookbehind[this._lookbehind_size + pos] + : data[pos] +} + +SBMH.prototype._sbmh_memcmp = function (data, pos, len) { + for (var i = 0; i < len; ++i) { // eslint-disable-line no-var + if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false } + } + return true +} + +module.exports = SBMH -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.logger = void 0; -const logger_1 = __nccwpck_require__(89497); -/** - * The `@azure/logger` configuration for this package. - */ -exports.logger = (0, logger_1.createClientLogger)("storage-common"); -//# sourceMappingURL=log.js.map /***/ }), -/***/ 85969: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 50727: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AnonymousCredentialPolicy = void 0; -const CredentialPolicy_js_1 = __nccwpck_require__(13615); -/** - * AnonymousCredentialPolicy is used with HTTP(S) requests that read public resources - * or for use with Shared Access Signatures (SAS). - */ -class AnonymousCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { - /** - * Creates an instance of AnonymousCredentialPolicy. - * @param nextPolicy - - * @param options - - */ - // The base class has a protected constructor. Adding a public one to enable constructing of this class. - /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ - constructor(nextPolicy, options) { - super(nextPolicy, options); - } -} -exports.AnonymousCredentialPolicy = AnonymousCredentialPolicy; -//# sourceMappingURL=AnonymousCredentialPolicy.js.map -/***/ }), +const WritableStream = (__nccwpck_require__(84492).Writable) +const { inherits } = __nccwpck_require__(47261) +const Dicer = __nccwpck_require__(92960) -/***/ 13615: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const MultipartParser = __nccwpck_require__(32183) +const UrlencodedParser = __nccwpck_require__(78306) +const parseParams = __nccwpck_require__(31854) -"use strict"; +function Busboy (opts) { + if (!(this instanceof Busboy)) { return new Busboy(opts) } -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.CredentialPolicy = void 0; -const RequestPolicy_js_1 = __nccwpck_require__(76584); -/** - * Credential policy used to sign HTTP(S) requests before sending. This is an - * abstract class. - */ -class CredentialPolicy extends RequestPolicy_js_1.BaseRequestPolicy { - /** - * Sends out request. - * - * @param request - - */ - sendRequest(request) { - return this._nextPolicy.sendRequest(this.signRequest(request)); - } - /** - * Child classes must implement this method with request signing. This method - * will be executed in {@link sendRequest}. - * - * @param request - - */ - signRequest(request) { - // Child classes must override this method with request signing. This method - // will be executed in sendRequest(). - return request; - } -} -exports.CredentialPolicy = CredentialPolicy; -//# sourceMappingURL=CredentialPolicy.js.map + if (typeof opts !== 'object') { + throw new TypeError('Busboy expected an options-Object.') + } + if (typeof opts.headers !== 'object') { + throw new TypeError('Busboy expected an options-Object with headers-attribute.') + } + if (typeof opts.headers['content-type'] !== 'string') { + throw new TypeError('Missing Content-Type-header.') + } -/***/ }), + const { + headers, + ...streamOptions + } = opts -/***/ 76584: -/***/ ((__unused_webpack_module, exports) => { + this.opts = { + autoDestroy: false, + ...streamOptions + } + WritableStream.call(this, this.opts) -"use strict"; + this._done = false + this._parser = this.getParserByHeaders(headers) + this._finished = false +} +inherits(Busboy, WritableStream) -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BaseRequestPolicy = void 0; -/** - * The base class from which all request policies derive. - */ -class BaseRequestPolicy { - _nextPolicy; - _options; - /** - * The main method to implement that manipulates a request/response. - */ - constructor( - /** - * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline. - */ - _nextPolicy, - /** - * The options that can be passed to a given request policy. - */ - _options) { - this._nextPolicy = _nextPolicy; - this._options = _options; - } - /** - * Get whether or not a log with the provided log level should be logged. - * @param logLevel - The log level of the log that will be logged. - * @returns Whether or not a log with the provided log level should be logged. - */ - shouldLog(logLevel) { - return this._options.shouldLog(logLevel); - } - /** - * Attempt to log the provided message to the provided logger. If no logger was provided or if - * the log level does not meat the logger's threshold, then nothing will be logged. - * @param logLevel - The log level of this log. - * @param message - The message of this log. - */ - log(logLevel, message) { - this._options.log(logLevel, message); +Busboy.prototype.emit = function (ev) { + if (ev === 'finish') { + if (!this._done) { + this._parser?.end() + return + } else if (this._finished) { + return } + this._finished = true + } + WritableStream.prototype.emit.apply(this, arguments) } -exports.BaseRequestPolicy = BaseRequestPolicy; -//# sourceMappingURL=RequestPolicy.js.map -/***/ }), +Busboy.prototype.getParserByHeaders = function (headers) { + const parsed = parseParams(headers['content-type']) -/***/ 69277: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + const cfg = { + defCharset: this.opts.defCharset, + fileHwm: this.opts.fileHwm, + headers, + highWaterMark: this.opts.highWaterMark, + isPartAFile: this.opts.isPartAFile, + limits: this.opts.limits, + parsedConType: parsed, + preservePath: this.opts.preservePath + } -"use strict"; + if (MultipartParser.detect.test(parsed[0])) { + return new MultipartParser(this, cfg) + } + if (UrlencodedParser.detect.test(parsed[0])) { + return new UrlencodedParser(this, cfg) + } + throw new Error('Unsupported Content-Type.') +} -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageBrowserPolicy = void 0; -const RequestPolicy_js_1 = __nccwpck_require__(76584); -const core_util_1 = __nccwpck_require__(80637); -const constants_js_1 = __nccwpck_require__(77807); -const utils_common_js_1 = __nccwpck_require__(61876); -/** - * StorageBrowserPolicy will handle differences between Node.js and browser runtime, including: - * - * 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'. - * StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL - * thus avoid the browser cache. - * - * 2. Remove cookie header for security - * - * 3. Remove content-length header to avoid browsers warning - */ -class StorageBrowserPolicy extends RequestPolicy_js_1.BaseRequestPolicy { - /** - * Creates an instance of StorageBrowserPolicy. - * @param nextPolicy - - * @param options - - */ - // The base class has a protected constructor. Adding a public one to enable constructing of this class. - /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/ - constructor(nextPolicy, options) { - super(nextPolicy, options); - } - /** - * Sends out request. - * - * @param request - - */ - async sendRequest(request) { - if (core_util_1.isNodeLike) { - return this._nextPolicy.sendRequest(request); - } - if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") { - request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); - } - request.headers.remove(constants_js_1.HeaderConstants.COOKIE); - // According to XHR standards, content-length should be fully controlled by browsers - request.headers.remove(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return this._nextPolicy.sendRequest(request); - } +Busboy.prototype._write = function (chunk, encoding, cb) { + this._parser.write(chunk, cb) } -exports.StorageBrowserPolicy = StorageBrowserPolicy; -//# sourceMappingURL=StorageBrowserPolicy.js.map + +module.exports = Busboy +module.exports["default"] = Busboy +module.exports.Busboy = Busboy + +module.exports.Dicer = Dicer + /***/ }), -/***/ 89782: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 32183: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageBrowserPolicyName = void 0; -exports.storageBrowserPolicy = storageBrowserPolicy; -const core_util_1 = __nccwpck_require__(80637); -const constants_js_1 = __nccwpck_require__(77807); -const utils_common_js_1 = __nccwpck_require__(61876); -/** - * The programmatic identifier of the StorageBrowserPolicy. - */ -exports.storageBrowserPolicyName = "storageBrowserPolicy"; -/** - * storageBrowserPolicy is a policy used to prevent browsers from caching requests - * and to remove cookies and explicit content-length headers. - */ -function storageBrowserPolicy() { - return { - name: exports.storageBrowserPolicyName, - async sendRequest(request, next) { - if (core_util_1.isNodeLike) { - return next(request); - } - if (request.method === "GET" || request.method === "HEAD") { - request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString()); - } - request.headers.delete(constants_js_1.HeaderConstants.COOKIE); - // According to XHR standards, content-length should be fully controlled by browsers - request.headers.delete(constants_js_1.HeaderConstants.CONTENT_LENGTH); - return next(request); - }, - }; -} -//# sourceMappingURL=StorageBrowserPolicyV2.js.map -/***/ }), +// TODO: +// * support 1 nested multipart level +// (see second multipart example here: +// http://www.w3.org/TR/html401/interact/forms.html#didx-multipartform-data) +// * support limits.fieldNameSize +// -- this will require modifications to utils.parseParams -/***/ 37740: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +const { Readable } = __nccwpck_require__(84492) +const { inherits } = __nccwpck_require__(47261) -"use strict"; +const Dicer = __nccwpck_require__(92960) -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageCorrectContentLengthPolicyName = void 0; -exports.storageCorrectContentLengthPolicy = storageCorrectContentLengthPolicy; -const constants_js_1 = __nccwpck_require__(77807); -/** - * The programmatic identifier of the storageCorrectContentLengthPolicy. - */ -exports.storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy"; -/** - * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length. - */ -function storageCorrectContentLengthPolicy() { - function correctContentLength(request) { - if (request.body && - (typeof request.body === "string" || Buffer.isBuffer(request.body)) && - request.body.length > 0) { - request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); - } - } - return { - name: exports.storageCorrectContentLengthPolicyName, - async sendRequest(request, next) { - correctContentLength(request); - return next(request); - }, - }; -} -//# sourceMappingURL=StorageCorrectContentLengthPolicy.js.map +const parseParams = __nccwpck_require__(31854) +const decodeText = __nccwpck_require__(84619) +const basename = __nccwpck_require__(48647) +const getLimit = __nccwpck_require__(21467) -/***/ }), +const RE_BOUNDARY = /^boundary$/i +const RE_FIELD = /^form-data$/i +const RE_CHARSET = /^charset$/i +const RE_FILENAME = /^filename$/i +const RE_NAME = /^name$/i -/***/ 72426: -/***/ ((__unused_webpack_module, exports) => { +Multipart.detect = /^multipart\/form-data/i +function Multipart (boy, cfg) { + let i + let len + const self = this + let boundary + const limits = cfg.limits + const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined)) + const parsedConType = cfg.parsedConType || [] + const defCharset = cfg.defCharset || 'utf8' + const preservePath = cfg.preservePath + const fileOpts = { highWaterMark: cfg.fileHwm } -"use strict"; + for (i = 0, len = parsedConType.length; i < len; ++i) { + if (Array.isArray(parsedConType[i]) && + RE_BOUNDARY.test(parsedConType[i][0])) { + boundary = parsedConType[i][1] + break + } + } -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageRequestFailureDetailsParserPolicyName = void 0; -exports.storageRequestFailureDetailsParserPolicy = storageRequestFailureDetailsParserPolicy; -/** - * The programmatic identifier of the StorageRequestFailureDetailsParserPolicy. - */ -exports.storageRequestFailureDetailsParserPolicyName = "storageRequestFailureDetailsParserPolicy"; -/** - * StorageRequestFailureDetailsParserPolicy - */ -function storageRequestFailureDetailsParserPolicy() { - return { - name: exports.storageRequestFailureDetailsParserPolicyName, - async sendRequest(request, next) { - try { - const response = await next(request); - return response; - } - catch (err) { - if (typeof err === "object" && - err !== null && - err.response && - err.response.parsedBody) { - if (err.response.parsedBody.code === "InvalidHeaderValue" && - err.response.parsedBody.HeaderName === "x-ms-version") { - err.message = - "The provided service version is not enabled on this storage account. Please see https://learn.microsoft.com/rest/api/storageservices/versioning-for-the-azure-storage-services for additional information.\n"; - } - } - throw err; - } - }, - }; -} -//# sourceMappingURL=StorageRequestFailureDetailsParserPolicy.js.map + function checkFinished () { + if (nends === 0 && finished && !boy._done) { + finished = false + self.end() + } + } -/***/ }), + if (typeof boundary !== 'string') { throw new Error('Multipart: Boundary not found') } -/***/ 1114: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + const fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) + const fileSizeLimit = getLimit(limits, 'fileSize', Infinity) + const filesLimit = getLimit(limits, 'files', Infinity) + const fieldsLimit = getLimit(limits, 'fields', Infinity) + const partsLimit = getLimit(limits, 'parts', Infinity) + const headerPairsLimit = getLimit(limits, 'headerPairs', 2000) + const headerSizeLimit = getLimit(limits, 'headerSize', 80 * 1024) -"use strict"; + let nfiles = 0 + let nfields = 0 + let nends = 0 + let curFile + let curField + let finished = false -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageRetryPolicy = void 0; -exports.NewRetryPolicyFactory = NewRetryPolicyFactory; -const abort_controller_1 = __nccwpck_require__(31514); -const RequestPolicy_js_1 = __nccwpck_require__(76584); -const constants_js_1 = __nccwpck_require__(77807); -const utils_common_js_1 = __nccwpck_require__(61876); -const log_js_1 = __nccwpck_require__(89818); -const StorageRetryPolicyType_js_1 = __nccwpck_require__(21483); -/** - * A factory method used to generated a RetryPolicy factory. - * - * @param retryOptions - - */ -function NewRetryPolicyFactory(retryOptions) { - return { - create: (nextPolicy, options) => { - return new StorageRetryPolicy(nextPolicy, options, retryOptions); - }, - }; -} -// Default values of StorageRetryOptions -const DEFAULT_RETRY_OPTIONS = { - maxRetryDelayInMs: 120 * 1000, - maxTries: 4, - retryDelayInMs: 4 * 1000, - retryPolicyType: StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL, - secondaryHost: "", - tryTimeoutInMs: undefined, // Use server side default timeout strategy -}; -const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); -/** - * Retry policy with exponential retry and linear retry implemented. - */ -class StorageRetryPolicy extends RequestPolicy_js_1.BaseRequestPolicy { - /** - * RetryOptions. - */ - retryOptions; - /** - * Creates an instance of RetryPolicy. - * - * @param nextPolicy - - * @param options - - * @param retryOptions - - */ - constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) { - super(nextPolicy, options); - // Initialize retry options - this.retryOptions = { - retryPolicyType: retryOptions.retryPolicyType - ? retryOptions.retryPolicyType - : DEFAULT_RETRY_OPTIONS.retryPolicyType, - maxTries: retryOptions.maxTries && retryOptions.maxTries >= 1 - ? Math.floor(retryOptions.maxTries) - : DEFAULT_RETRY_OPTIONS.maxTries, - tryTimeoutInMs: retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0 - ? retryOptions.tryTimeoutInMs - : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs, - retryDelayInMs: retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0 - ? Math.min(retryOptions.retryDelayInMs, retryOptions.maxRetryDelayInMs - ? retryOptions.maxRetryDelayInMs - : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs) - : DEFAULT_RETRY_OPTIONS.retryDelayInMs, - maxRetryDelayInMs: retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0 - ? retryOptions.maxRetryDelayInMs - : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs, - secondaryHost: retryOptions.secondaryHost - ? retryOptions.secondaryHost - : DEFAULT_RETRY_OPTIONS.secondaryHost, - }; + this._needDrain = false + this._pause = false + this._cb = undefined + this._nparts = 0 + this._boy = boy + + const parserCfg = { + boundary, + maxHeaderPairs: headerPairsLimit, + maxHeaderSize: headerSizeLimit, + partHwm: fileOpts.highWaterMark, + highWaterMark: cfg.highWaterMark + } + + this.parser = new Dicer(parserCfg) + this.parser.on('drain', function () { + self._needDrain = false + if (self._cb && !self._pause) { + const cb = self._cb + self._cb = undefined + cb() } - /** - * Sends request. - * - * @param request - - */ - async sendRequest(request) { - return this.attemptSendRequest(request, false, 1); + }).on('part', function onPart (part) { + if (++self._nparts > partsLimit) { + self.parser.removeListener('part', onPart) + self.parser.on('part', skipPart) + boy.hitPartsLimit = true + boy.emit('partsLimit') + return skipPart(part) } - /** - * Decide and perform next retry. Won't mutate request parameter. - * - * @param request - - * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then - * the resource was not found. This may be due to replication delay. So, in this - * case, we'll never try the secondary again for this operation. - * @param attempt - How many retries has been attempted to performed, starting from 1, which includes - * the attempt will be performed by this method call. - */ - async attemptSendRequest(request, secondaryHas404, attempt) { - const newRequest = request.clone(); - const isPrimaryRetry = secondaryHas404 || - !this.retryOptions.secondaryHost || - !(request.method === "GET" || request.method === "HEAD" || request.method === "OPTIONS") || - attempt % 2 === 1; - if (!isPrimaryRetry) { - newRequest.url = (0, utils_common_js_1.setURLHost)(newRequest.url, this.retryOptions.secondaryHost); - } - // Set the server-side timeout query parameter "timeout=[seconds]" - if (this.retryOptions.tryTimeoutInMs) { - newRequest.url = (0, utils_common_js_1.setURLParameter)(newRequest.url, constants_js_1.URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString()); - } - let response; - try { - log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); - response = await this._nextPolicy.sendRequest(newRequest); - if (!this.shouldRetry(isPrimaryRetry, attempt, response)) { - return response; - } - secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); - } - catch (err) { - log_js_1.logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`); - if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) { - throw err; - } - } - await this.delay(isPrimaryRetry, attempt, request.abortSignal); - return this.attemptSendRequest(request, secondaryHas404, ++attempt); + + // hack because streams2 _always_ doesn't emit 'end' until nextTick, so let + // us emit 'end' early since we know the part has ended if we are already + // seeing the next part + if (curField) { + const field = curField + field.emit('end') + field.removeAllListeners('end') } - /** - * Decide whether to retry according to last HTTP response and retry counters. - * - * @param isPrimaryRetry - - * @param attempt - - * @param response - - * @param err - - */ - shouldRetry(isPrimaryRetry, attempt, response, err) { - if (attempt >= this.retryOptions.maxTries) { - log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions - .maxTries}, no further try.`); - return false; - } - // Handle network failures, you may need to customize the list when you implement - // your own http client - const retriableErrors = [ - "ETIMEDOUT", - "ESOCKETTIMEDOUT", - "ECONNREFUSED", - "ECONNRESET", - "ENOENT", - "ENOTFOUND", - "TIMEOUT", - "EPIPE", - "REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js - ]; - if (err) { - for (const retriableError of retriableErrors) { - if (err.name.toUpperCase().includes(retriableError) || - err.message.toUpperCase().includes(retriableError) || - (err.code && err.code.toString().toUpperCase() === retriableError)) { - log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); - return true; - } + + part.on('header', function (header) { + let contype + let fieldname + let parsed + let charset + let encoding + let filename + let nsize = 0 + + if (header['content-type']) { + parsed = parseParams(header['content-type'][0]) + if (parsed[0]) { + contype = parsed[0].toLowerCase() + for (i = 0, len = parsed.length; i < len; ++i) { + if (RE_CHARSET.test(parsed[i][0])) { + charset = parsed[i][1].toLowerCase() + break } + } } - // If attempt was against the secondary & it returned a StatusNotFound (404), then - // the resource was not found. This may be due to replication delay. So, in this - // case, we'll never try the secondary again for this operation. - if (response || err) { - const statusCode = response ? response.status : err ? err.statusCode : 0; - if (!isPrimaryRetry && statusCode === 404) { - log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); - return true; - } - // Server internal error or server timeout - if (statusCode === 503 || statusCode === 500) { - log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); - return true; - } + } + + if (contype === undefined) { contype = 'text/plain' } + if (charset === undefined) { charset = defCharset } + + if (header['content-disposition']) { + parsed = parseParams(header['content-disposition'][0]) + if (!RE_FIELD.test(parsed[0])) { return skipPart(part) } + for (i = 0, len = parsed.length; i < len; ++i) { + if (RE_NAME.test(parsed[i][0])) { + fieldname = parsed[i][1] + } else if (RE_FILENAME.test(parsed[i][0])) { + filename = parsed[i][1] + if (!preservePath) { filename = basename(filename) } + } } - if (response) { - // Retry select Copy Source Error Codes. - if (response?.status >= 400) { - const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); - if (copySourceError !== undefined) { - switch (copySourceError) { - case "InternalError": - case "OperationTimedOut": - case "ServerBusy": - return true; - } - } - } + } else { return skipPart(part) } + + if (header['content-transfer-encoding']) { encoding = header['content-transfer-encoding'][0].toLowerCase() } else { encoding = '7bit' } + + let onData, + onEnd + + if (isPartAFile(fieldname, contype, filename)) { + // file/binary field + if (nfiles === filesLimit) { + if (!boy.hitFilesLimit) { + boy.hitFilesLimit = true + boy.emit('filesLimit') + } + return skipPart(part) } - if (err?.code === "PARSE_ERROR" && err?.message.startsWith(`Error "Error: Unclosed root tag`)) { - log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); - return true; + + ++nfiles + + if (!boy._events.file) { + self.parser._ignore() + return } - return false; - } - /** - * Delay a calculated time between retries. - * - * @param isPrimaryRetry - - * @param attempt - - * @param abortSignal - - */ - async delay(isPrimaryRetry, attempt, abortSignal) { - let delayTimeInMs = 0; - if (isPrimaryRetry) { - switch (this.retryOptions.retryPolicyType) { - case StorageRetryPolicyType_js_1.StorageRetryPolicyType.EXPONENTIAL: - delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs, this.retryOptions.maxRetryDelayInMs); - break; - case StorageRetryPolicyType_js_1.StorageRetryPolicyType.FIXED: - delayTimeInMs = this.retryOptions.retryDelayInMs; - break; - } + + ++nends + const file = new FileStream(fileOpts) + curFile = file + file.on('end', function () { + --nends + self._pause = false + checkFinished() + if (self._cb && !self._needDrain) { + const cb = self._cb + self._cb = undefined + cb() + } + }) + file._read = function (n) { + if (!self._pause) { return } + self._pause = false + if (self._cb && !self._needDrain) { + const cb = self._cb + self._cb = undefined + cb() + } + } + boy.emit('file', fieldname, file, filename, encoding, contype) + + onData = function (data) { + if ((nsize += data.length) > fileSizeLimit) { + const extralen = fileSizeLimit - nsize + data.length + if (extralen > 0) { file.push(data.slice(0, extralen)) } + file.truncated = true + file.bytesRead = fileSizeLimit + part.removeAllListeners('data') + file.emit('limit') + return + } else if (!file.push(data)) { self._pause = true } + + file.bytesRead = nsize } - else { - delayTimeInMs = Math.random() * 1000; + + onEnd = function () { + curFile = undefined + file.push(null) } - log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); - return (0, utils_common_js_1.delay)(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR); - } + } else { + // non-file field + if (nfields === fieldsLimit) { + if (!boy.hitFieldsLimit) { + boy.hitFieldsLimit = true + boy.emit('fieldsLimit') + } + return skipPart(part) + } + + ++nfields + ++nends + let buffer = '' + let truncated = false + curField = part + + onData = function (data) { + if ((nsize += data.length) > fieldSizeLimit) { + const extralen = (fieldSizeLimit - (nsize - data.length)) + buffer += data.toString('binary', 0, extralen) + truncated = true + part.removeAllListeners('data') + } else { buffer += data.toString('binary') } + } + + onEnd = function () { + curField = undefined + if (buffer.length) { buffer = decodeText(buffer, 'binary', charset) } + boy.emit('field', fieldname, buffer, false, truncated, encoding, contype) + --nends + checkFinished() + } + } + + /* As of node@2efe4ab761666 (v0.10.29+/v0.11.14+), busboy had become + broken. Streams2/streams3 is a huge black box of confusion, but + somehow overriding the sync state seems to fix things again (and still + seems to work for previous node versions). + */ + part._readableState.sync = false + + part.on('data', onData) + part.on('end', onEnd) + }).on('error', function (err) { + if (curFile) { curFile.emit('error', err) } + }) + }).on('error', function (err) { + boy.emit('error', err) + }).on('finish', function () { + finished = true + checkFinished() + }) } -exports.StorageRetryPolicy = StorageRetryPolicy; -//# sourceMappingURL=StorageRetryPolicy.js.map -/***/ }), +Multipart.prototype.write = function (chunk, cb) { + const r = this.parser.write(chunk) + if (r && !this._pause) { + cb() + } else { + this._needDrain = !r + this._cb = cb + } +} -/***/ 21483: -/***/ ((__unused_webpack_module, exports) => { +Multipart.prototype.end = function () { + const self = this -"use strict"; + if (self.parser.writable) { + self.parser.end() + } else if (!self._boy._done) { + process.nextTick(function () { + self._boy._done = true + self._boy.emit('finish') + }) + } +} + +function skipPart (part) { + part.resume() +} + +function FileStream (opts) { + Readable.call(this, opts) + + this.bytesRead = 0 + + this.truncated = false +} + +inherits(FileStream, Readable) + +FileStream.prototype._read = function (n) {} + +module.exports = Multipart -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageRetryPolicyType = void 0; -/** - * RetryPolicy types. - */ -var StorageRetryPolicyType; -(function (StorageRetryPolicyType) { - /** - * Exponential retry. Retry time delay grows exponentially. - */ - StorageRetryPolicyType[StorageRetryPolicyType["EXPONENTIAL"] = 0] = "EXPONENTIAL"; - /** - * Linear retry. Retry time delay grows linearly. - */ - StorageRetryPolicyType[StorageRetryPolicyType["FIXED"] = 1] = "FIXED"; -})(StorageRetryPolicyType || (exports.StorageRetryPolicyType = StorageRetryPolicyType = {})); -//# sourceMappingURL=StorageRetryPolicyType.js.map /***/ }), -/***/ 3353: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 78306: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageRetryPolicyName = void 0; -exports.storageRetryPolicy = storageRetryPolicy; -const abort_controller_1 = __nccwpck_require__(31514); -const core_rest_pipeline_1 = __nccwpck_require__(29146); -const core_util_1 = __nccwpck_require__(80637); -const StorageRetryPolicyFactory_js_1 = __nccwpck_require__(26508); -const constants_js_1 = __nccwpck_require__(77807); -const utils_common_js_1 = __nccwpck_require__(61876); -const log_js_1 = __nccwpck_require__(89818); -/** - * Name of the {@link storageRetryPolicy} - */ -exports.storageRetryPolicyName = "storageRetryPolicy"; -// Default values of StorageRetryOptions -const DEFAULT_RETRY_OPTIONS = { - maxRetryDelayInMs: 120 * 1000, - maxTries: 4, - retryDelayInMs: 4 * 1000, - retryPolicyType: StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL, - secondaryHost: "", - tryTimeoutInMs: undefined, // Use server side default timeout strategy -}; -const retriableErrors = [ - "ETIMEDOUT", - "ESOCKETTIMEDOUT", - "ECONNREFUSED", - "ECONNRESET", - "ENOENT", - "ENOTFOUND", - "TIMEOUT", - "EPIPE", - "REQUEST_SEND_ERROR", -]; -const RETRY_ABORT_ERROR = new abort_controller_1.AbortError("The operation was aborted."); -/** - * Retry policy with exponential retry and linear retry implemented. - */ -function storageRetryPolicy(options = {}) { - const retryPolicyType = options.retryPolicyType ?? DEFAULT_RETRY_OPTIONS.retryPolicyType; - const maxTries = options.maxTries ?? DEFAULT_RETRY_OPTIONS.maxTries; - const retryDelayInMs = options.retryDelayInMs ?? DEFAULT_RETRY_OPTIONS.retryDelayInMs; - const maxRetryDelayInMs = options.maxRetryDelayInMs ?? DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs; - const secondaryHost = options.secondaryHost ?? DEFAULT_RETRY_OPTIONS.secondaryHost; - const tryTimeoutInMs = options.tryTimeoutInMs ?? DEFAULT_RETRY_OPTIONS.tryTimeoutInMs; - function shouldRetry({ isPrimaryRetry, attempt, response, error, }) { - if (attempt >= maxTries) { - log_js_1.logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${maxTries}, no further try.`); - return false; - } - if (error) { - for (const retriableError of retriableErrors) { - if (error.name.toUpperCase().includes(retriableError) || - error.message.toUpperCase().includes(retriableError) || - (error.code && error.code.toString().toUpperCase() === retriableError)) { - log_js_1.logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`); - return true; - } - } - if (error?.code === "PARSE_ERROR" && - error?.message.startsWith(`Error "Error: Unclosed root tag`)) { - log_js_1.logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry."); - return true; - } + +const Decoder = __nccwpck_require__(27100) +const decodeText = __nccwpck_require__(84619) +const getLimit = __nccwpck_require__(21467) + +const RE_CHARSET = /^charset$/i + +UrlEncoded.detect = /^application\/x-www-form-urlencoded/i +function UrlEncoded (boy, cfg) { + const limits = cfg.limits + const parsedConType = cfg.parsedConType + this.boy = boy + + this.fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) + this.fieldNameSizeLimit = getLimit(limits, 'fieldNameSize', 100) + this.fieldsLimit = getLimit(limits, 'fields', Infinity) + + let charset + for (var i = 0, len = parsedConType.length; i < len; ++i) { // eslint-disable-line no-var + if (Array.isArray(parsedConType[i]) && + RE_CHARSET.test(parsedConType[i][0])) { + charset = parsedConType[i][1].toLowerCase() + break + } + } + + if (charset === undefined) { charset = cfg.defCharset || 'utf8' } + + this.decoder = new Decoder() + this.charset = charset + this._fields = 0 + this._state = 'key' + this._checkingBytes = true + this._bytesKey = 0 + this._bytesVal = 0 + this._key = '' + this._val = '' + this._keyTrunc = false + this._valTrunc = false + this._hitLimit = false +} + +UrlEncoded.prototype.write = function (data, cb) { + if (this._fields === this.fieldsLimit) { + if (!this.boy.hitFieldsLimit) { + this.boy.hitFieldsLimit = true + this.boy.emit('fieldsLimit') + } + return cb() + } + + let idxeq; let idxamp; let i; let p = 0; const len = data.length + + while (p < len) { + if (this._state === 'key') { + idxeq = idxamp = undefined + for (i = p; i < len; ++i) { + if (!this._checkingBytes) { ++p } + if (data[i] === 0x3D/* = */) { + idxeq = i + break + } else if (data[i] === 0x26/* & */) { + idxamp = i + break } - // If attempt was against the secondary & it returned a StatusNotFound (404), then - // the resource was not found. This may be due to replication delay. So, in this - // case, we'll never try the secondary again for this operation. - if (response || error) { - const statusCode = response?.status ?? error?.statusCode ?? 0; - if (!isPrimaryRetry && statusCode === 404) { - log_js_1.logger.info(`RetryPolicy: Secondary access with 404, will retry.`); - return true; - } - // Server internal error or server timeout - if (statusCode === 503 || statusCode === 500) { - log_js_1.logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`); - return true; - } + if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) { + this._hitLimit = true + break + } else if (this._checkingBytes) { ++this._bytesKey } + } + + if (idxeq !== undefined) { + // key with assignment + if (idxeq > p) { this._key += this.decoder.write(data.toString('binary', p, idxeq)) } + this._state = 'val' + + this._hitLimit = false + this._checkingBytes = true + this._val = '' + this._bytesVal = 0 + this._valTrunc = false + this.decoder.reset() + + p = idxeq + 1 + } else if (idxamp !== undefined) { + // key with no assignment + ++this._fields + let key; const keyTrunc = this._keyTrunc + if (idxamp > p) { key = (this._key += this.decoder.write(data.toString('binary', p, idxamp))) } else { key = this._key } + + this._hitLimit = false + this._checkingBytes = true + this._key = '' + this._bytesKey = 0 + this._keyTrunc = false + this.decoder.reset() + + if (key.length) { + this.boy.emit('field', decodeText(key, 'binary', this.charset), + '', + keyTrunc, + false) } - if (response) { - // Retry select Copy Source Error Codes. - if (response?.status >= 400) { - const copySourceError = response.headers.get(constants_js_1.HeaderConstants.X_MS_CopySourceErrorCode); - if (copySourceError !== undefined) { - switch (copySourceError) { - case "InternalError": - case "OperationTimedOut": - case "ServerBusy": - return true; - } - } - } + + p = idxamp + 1 + if (this._fields === this.fieldsLimit) { return cb() } + } else if (this._hitLimit) { + // we may not have hit the actual limit if there are encoded bytes... + if (i > p) { this._key += this.decoder.write(data.toString('binary', p, i)) } + p = i + if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) { + // yep, we actually did hit the limit + this._checkingBytes = false + this._keyTrunc = true } - return false; - } - function calculateDelay(isPrimaryRetry, attempt) { - let delayTimeInMs = 0; - if (isPrimaryRetry) { - switch (retryPolicyType) { - case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.EXPONENTIAL: - delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * retryDelayInMs, maxRetryDelayInMs); - break; - case StorageRetryPolicyFactory_js_1.StorageRetryPolicyType.FIXED: - delayTimeInMs = retryDelayInMs; - break; - } + } else { + if (p < len) { this._key += this.decoder.write(data.toString('binary', p)) } + p = len + } + } else { + idxamp = undefined + for (i = p; i < len; ++i) { + if (!this._checkingBytes) { ++p } + if (data[i] === 0x26/* & */) { + idxamp = i + break } - else { - delayTimeInMs = Math.random() * 1000; + if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) { + this._hitLimit = true + break + } else if (this._checkingBytes) { ++this._bytesVal } + } + + if (idxamp !== undefined) { + ++this._fields + if (idxamp > p) { this._val += this.decoder.write(data.toString('binary', p, idxamp)) } + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + decodeText(this._val, 'binary', this.charset), + this._keyTrunc, + this._valTrunc) + this._state = 'key' + + this._hitLimit = false + this._checkingBytes = true + this._key = '' + this._bytesKey = 0 + this._keyTrunc = false + this.decoder.reset() + + p = idxamp + 1 + if (this._fields === this.fieldsLimit) { return cb() } + } else if (this._hitLimit) { + // we may not have hit the actual limit if there are encoded bytes... + if (i > p) { this._val += this.decoder.write(data.toString('binary', p, i)) } + p = i + if ((this._val === '' && this.fieldSizeLimit === 0) || + (this._bytesVal = this._val.length) === this.fieldSizeLimit) { + // yep, we actually did hit the limit + this._checkingBytes = false + this._valTrunc = true } - log_js_1.logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`); - return delayTimeInMs; + } else { + if (p < len) { this._val += this.decoder.write(data.toString('binary', p)) } + p = len + } } - return { - name: exports.storageRetryPolicyName, - async sendRequest(request, next) { - // Set the server-side timeout query parameter "timeout=[seconds]" - if (tryTimeoutInMs) { - request.url = (0, utils_common_js_1.setURLParameter)(request.url, constants_js_1.URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1000))); - } - const primaryUrl = request.url; - const secondaryUrl = secondaryHost ? (0, utils_common_js_1.setURLHost)(request.url, secondaryHost) : undefined; - let secondaryHas404 = false; - let attempt = 1; - let retryAgain = true; - let response; - let error; - while (retryAgain) { - const isPrimaryRetry = secondaryHas404 || - !secondaryUrl || - !["GET", "HEAD", "OPTIONS"].includes(request.method) || - attempt % 2 === 1; - request.url = isPrimaryRetry ? primaryUrl : secondaryUrl; - response = undefined; - error = undefined; - try { - log_js_1.logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`); - response = await next(request); - secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404); - } - catch (e) { - if ((0, core_rest_pipeline_1.isRestError)(e)) { - log_js_1.logger.error(`RetryPolicy: Caught error, message: ${e.message}, code: ${e.code}`); - error = e; - } - else { - log_js_1.logger.error(`RetryPolicy: Caught error, message: ${(0, core_util_1.getErrorMessage)(e)}`); - throw e; - } - } - retryAgain = shouldRetry({ isPrimaryRetry, attempt, response, error }); - if (retryAgain) { - await (0, utils_common_js_1.delay)(calculateDelay(isPrimaryRetry, attempt), request.abortSignal, RETRY_ABORT_ERROR); - } - attempt++; - } - if (response) { - return response; - } - throw error ?? new core_rest_pipeline_1.RestError("RetryPolicy failed without known error."); - }, - }; + } + cb() +} + +UrlEncoded.prototype.end = function () { + if (this.boy._done) { return } + + if (this._state === 'key' && this._key.length > 0) { + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + '', + this._keyTrunc, + false) + } else if (this._state === 'val') { + this.boy.emit('field', decodeText(this._key, 'binary', this.charset), + decodeText(this._val, 'binary', this.charset), + this._keyTrunc, + this._valTrunc) + } + this.boy._done = true + this.boy.emit('finish') +} + +module.exports = UrlEncoded + + +/***/ }), + +/***/ 27100: +/***/ ((module) => { + +"use strict"; + + +const RE_PLUS = /\+/g + +const HEX = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +] + +function Decoder () { + this.buffer = undefined +} +Decoder.prototype.write = function (str) { + // Replace '+' with ' ' before decoding + str = str.replace(RE_PLUS, ' ') + let res = '' + let i = 0; let p = 0; const len = str.length + for (; i < len; ++i) { + if (this.buffer !== undefined) { + if (!HEX[str.charCodeAt(i)]) { + res += '%' + this.buffer + this.buffer = undefined + --i // retry character + } else { + this.buffer += str[i] + ++p + if (this.buffer.length === 2) { + res += String.fromCharCode(parseInt(this.buffer, 16)) + this.buffer = undefined + } + } + } else if (str[i] === '%') { + if (i > p) { + res += str.substring(p, i) + p = i + } + this.buffer = '' + ++p + } + } + if (p < len && this.buffer === undefined) { res += str.substring(p) } + return res } -//# sourceMappingURL=StorageRetryPolicyV2.js.map +Decoder.prototype.reset = function () { + this.buffer = undefined +} + +module.exports = Decoder + /***/ }), -/***/ 40755: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 48647: +/***/ ((module) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.StorageSharedKeyCredentialPolicy = void 0; -const constants_js_1 = __nccwpck_require__(77807); -const utils_common_js_1 = __nccwpck_require__(61876); -const CredentialPolicy_js_1 = __nccwpck_require__(13615); -const SharedKeyComparator_js_1 = __nccwpck_require__(4482); -/** - * StorageSharedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key. - */ -class StorageSharedKeyCredentialPolicy extends CredentialPolicy_js_1.CredentialPolicy { - /** - * Reference to StorageSharedKeyCredential which generates StorageSharedKeyCredentialPolicy - */ - factory; - /** - * Creates an instance of StorageSharedKeyCredentialPolicy. - * @param nextPolicy - - * @param options - - * @param factory - - */ - constructor(nextPolicy, options, factory) { - super(nextPolicy, options); - this.factory = factory; + +module.exports = function basename (path) { + if (typeof path !== 'string') { return '' } + for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var + switch (path.charCodeAt(i)) { + case 0x2F: // '/' + case 0x5C: // '\' + path = path.slice(i + 1) + return (path === '..' || path === '.' ? '' : path) } - /** - * Signs request. - * - * @param request - - */ - signRequest(request) { - request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); - if (request.body && - (typeof request.body === "string" || request.body !== undefined) && - request.body.length > 0) { - request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); + } + return (path === '..' || path === '.' ? '' : path) +} + + +/***/ }), + +/***/ 84619: +/***/ (function(module) { + +"use strict"; + + +// Node has always utf-8 +const utf8Decoder = new TextDecoder('utf-8') +const textDecoders = new Map([ + ['utf-8', utf8Decoder], + ['utf8', utf8Decoder] +]) + +function getDecoder (charset) { + let lc + while (true) { + switch (charset) { + case 'utf-8': + case 'utf8': + return decoders.utf8 + case 'latin1': + case 'ascii': // TODO: Make these a separate, strict decoder? + case 'us-ascii': + case 'iso-8859-1': + case 'iso8859-1': + case 'iso88591': + case 'iso_8859-1': + case 'windows-1252': + case 'iso_8859-1:1987': + case 'cp1252': + case 'x-cp1252': + return decoders.latin1 + case 'utf16le': + case 'utf-16le': + case 'ucs2': + case 'ucs-2': + return decoders.utf16le + case 'base64': + return decoders.base64 + default: + if (lc === undefined) { + lc = true + charset = charset.toLowerCase() + continue } - const stringToSign = [ - request.method.toUpperCase(), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - this.getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), - ].join("\n") + - "\n" + - this.getCanonicalizedHeadersString(request) + - this.getCanonicalizedResourceString(request); - const signature = this.factory.computeHMACSHA256(stringToSign); - request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${this.factory.accountName}:${signature}`); - // console.log(`[URL]:${request.url}`); - // console.log(`[HEADERS]:${request.headers.toString()}`); - // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); - // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); - return request; + return decoders.other.bind(charset) } - /** - * Retrieve header value according to shared key sign rules. - * @see https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key - * - * @param request - - * @param headerName - - */ - getHeaderValueToSign(request, headerName) { - const value = request.headers.get(headerName); - if (!value) { - return ""; - } - // When using version 2015-02-21 or later, if Content-Length is zero, then - // set the Content-Length part of the StringToSign to an empty string. - // https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key - if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { - return ""; - } - return value; + } +} + +const decoders = { + utf8: (data, sourceEncoding) => { + if (data.length === 0) { + return '' } - /** - * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: - * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. - * 2. Convert each HTTP header name to lowercase. - * 3. Sort the headers lexicographically by header name, in ascending order. - * Each header may appear only once in the string. - * 4. Replace any linear whitespace in the header value with a single space. - * 5. Trim any whitespace around the colon in the header. - * 6. Finally, append a new-line character to each canonicalized header in the resulting list. - * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. - * - * @param request - - */ - getCanonicalizedHeadersString(request) { - let headersArray = request.headers.headersArray().filter((value) => { - return value.name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE); - }); - headersArray.sort((a, b) => { - return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); - }); - // Remove duplicate headers - headersArray = headersArray.filter((value, index, array) => { - if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { - return false; - } - return true; - }); - let canonicalizedHeadersStringToSign = ""; - headersArray.forEach((header) => { - canonicalizedHeadersStringToSign += `${header.name - .toLowerCase() - .trimRight()}:${header.value.trimLeft()}\n`; - }); - return canonicalizedHeadersStringToSign; + if (typeof data === 'string') { + data = Buffer.from(data, sourceEncoding) } - /** - * Retrieves the webResource canonicalized resource string. - * - * @param request - - */ - getCanonicalizedResourceString(request) { - const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; - let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${this.factory.accountName}${path}`; - const queries = (0, utils_common_js_1.getURLQueries)(request.url); - const lowercaseQueries = {}; - if (queries) { - const queryKeys = []; - for (const key in queries) { - if (Object.prototype.hasOwnProperty.call(queries, key)) { - const lowercaseKey = key.toLowerCase(); - lowercaseQueries[lowercaseKey] = queries[key]; - queryKeys.push(lowercaseKey); - } - } - queryKeys.sort(); - for (const key of queryKeys) { - canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; - } + return data.utf8Slice(0, data.length) + }, + + latin1: (data, sourceEncoding) => { + if (data.length === 0) { + return '' + } + if (typeof data === 'string') { + return data + } + return data.latin1Slice(0, data.length) + }, + + utf16le: (data, sourceEncoding) => { + if (data.length === 0) { + return '' + } + if (typeof data === 'string') { + data = Buffer.from(data, sourceEncoding) + } + return data.ucs2Slice(0, data.length) + }, + + base64: (data, sourceEncoding) => { + if (data.length === 0) { + return '' + } + if (typeof data === 'string') { + data = Buffer.from(data, sourceEncoding) + } + return data.base64Slice(0, data.length) + }, + + other: (data, sourceEncoding) => { + if (data.length === 0) { + return '' + } + if (typeof data === 'string') { + data = Buffer.from(data, sourceEncoding) + } + + if (textDecoders.has(this.toString())) { + try { + return textDecoders.get(this).decode(data) + } catch (e) { } + } + return typeof data === 'string' + ? data + : data.toString() + } +} + +function decodeText (text, sourceEncoding, destEncoding) { + if (text) { + return getDecoder(destEncoding)(text, sourceEncoding) + } + return text +} + +module.exports = decodeText + + +/***/ }), + +/***/ 21467: +/***/ ((module) => { + +"use strict"; + + +module.exports = function getLimit (limits, name, defaultLimit) { + if ( + !limits || + limits[name] === undefined || + limits[name] === null + ) { return defaultLimit } + + if ( + typeof limits[name] !== 'number' || + isNaN(limits[name]) + ) { throw new TypeError('Limit ' + name + ' is not a valid number') } + + return limits[name] +} + + +/***/ }), + +/***/ 31854: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/* eslint-disable object-property-newline */ + + +const decodeText = __nccwpck_require__(84619) + +const RE_ENCODED = /%[a-fA-F0-9][a-fA-F0-9]/g + +const EncodedLookup = { + '%00': '\x00', '%01': '\x01', '%02': '\x02', '%03': '\x03', '%04': '\x04', + '%05': '\x05', '%06': '\x06', '%07': '\x07', '%08': '\x08', '%09': '\x09', + '%0a': '\x0a', '%0A': '\x0a', '%0b': '\x0b', '%0B': '\x0b', '%0c': '\x0c', + '%0C': '\x0c', '%0d': '\x0d', '%0D': '\x0d', '%0e': '\x0e', '%0E': '\x0e', + '%0f': '\x0f', '%0F': '\x0f', '%10': '\x10', '%11': '\x11', '%12': '\x12', + '%13': '\x13', '%14': '\x14', '%15': '\x15', '%16': '\x16', '%17': '\x17', + '%18': '\x18', '%19': '\x19', '%1a': '\x1a', '%1A': '\x1a', '%1b': '\x1b', + '%1B': '\x1b', '%1c': '\x1c', '%1C': '\x1c', '%1d': '\x1d', '%1D': '\x1d', + '%1e': '\x1e', '%1E': '\x1e', '%1f': '\x1f', '%1F': '\x1f', '%20': '\x20', + '%21': '\x21', '%22': '\x22', '%23': '\x23', '%24': '\x24', '%25': '\x25', + '%26': '\x26', '%27': '\x27', '%28': '\x28', '%29': '\x29', '%2a': '\x2a', + '%2A': '\x2a', '%2b': '\x2b', '%2B': '\x2b', '%2c': '\x2c', '%2C': '\x2c', + '%2d': '\x2d', '%2D': '\x2d', '%2e': '\x2e', '%2E': '\x2e', '%2f': '\x2f', + '%2F': '\x2f', '%30': '\x30', '%31': '\x31', '%32': '\x32', '%33': '\x33', + '%34': '\x34', '%35': '\x35', '%36': '\x36', '%37': '\x37', '%38': '\x38', + '%39': '\x39', '%3a': '\x3a', '%3A': '\x3a', '%3b': '\x3b', '%3B': '\x3b', + '%3c': '\x3c', '%3C': '\x3c', '%3d': '\x3d', '%3D': '\x3d', '%3e': '\x3e', + '%3E': '\x3e', '%3f': '\x3f', '%3F': '\x3f', '%40': '\x40', '%41': '\x41', + '%42': '\x42', '%43': '\x43', '%44': '\x44', '%45': '\x45', '%46': '\x46', + '%47': '\x47', '%48': '\x48', '%49': '\x49', '%4a': '\x4a', '%4A': '\x4a', + '%4b': '\x4b', '%4B': '\x4b', '%4c': '\x4c', '%4C': '\x4c', '%4d': '\x4d', + '%4D': '\x4d', '%4e': '\x4e', '%4E': '\x4e', '%4f': '\x4f', '%4F': '\x4f', + '%50': '\x50', '%51': '\x51', '%52': '\x52', '%53': '\x53', '%54': '\x54', + '%55': '\x55', '%56': '\x56', '%57': '\x57', '%58': '\x58', '%59': '\x59', + '%5a': '\x5a', '%5A': '\x5a', '%5b': '\x5b', '%5B': '\x5b', '%5c': '\x5c', + '%5C': '\x5c', '%5d': '\x5d', '%5D': '\x5d', '%5e': '\x5e', '%5E': '\x5e', + '%5f': '\x5f', '%5F': '\x5f', '%60': '\x60', '%61': '\x61', '%62': '\x62', + '%63': '\x63', '%64': '\x64', '%65': '\x65', '%66': '\x66', '%67': '\x67', + '%68': '\x68', '%69': '\x69', '%6a': '\x6a', '%6A': '\x6a', '%6b': '\x6b', + '%6B': '\x6b', '%6c': '\x6c', '%6C': '\x6c', '%6d': '\x6d', '%6D': '\x6d', + '%6e': '\x6e', '%6E': '\x6e', '%6f': '\x6f', '%6F': '\x6f', '%70': '\x70', + '%71': '\x71', '%72': '\x72', '%73': '\x73', '%74': '\x74', '%75': '\x75', + '%76': '\x76', '%77': '\x77', '%78': '\x78', '%79': '\x79', '%7a': '\x7a', + '%7A': '\x7a', '%7b': '\x7b', '%7B': '\x7b', '%7c': '\x7c', '%7C': '\x7c', + '%7d': '\x7d', '%7D': '\x7d', '%7e': '\x7e', '%7E': '\x7e', '%7f': '\x7f', + '%7F': '\x7f', '%80': '\x80', '%81': '\x81', '%82': '\x82', '%83': '\x83', + '%84': '\x84', '%85': '\x85', '%86': '\x86', '%87': '\x87', '%88': '\x88', + '%89': '\x89', '%8a': '\x8a', '%8A': '\x8a', '%8b': '\x8b', '%8B': '\x8b', + '%8c': '\x8c', '%8C': '\x8c', '%8d': '\x8d', '%8D': '\x8d', '%8e': '\x8e', + '%8E': '\x8e', '%8f': '\x8f', '%8F': '\x8f', '%90': '\x90', '%91': '\x91', + '%92': '\x92', '%93': '\x93', '%94': '\x94', '%95': '\x95', '%96': '\x96', + '%97': '\x97', '%98': '\x98', '%99': '\x99', '%9a': '\x9a', '%9A': '\x9a', + '%9b': '\x9b', '%9B': '\x9b', '%9c': '\x9c', '%9C': '\x9c', '%9d': '\x9d', + '%9D': '\x9d', '%9e': '\x9e', '%9E': '\x9e', '%9f': '\x9f', '%9F': '\x9f', + '%a0': '\xa0', '%A0': '\xa0', '%a1': '\xa1', '%A1': '\xa1', '%a2': '\xa2', + '%A2': '\xa2', '%a3': '\xa3', '%A3': '\xa3', '%a4': '\xa4', '%A4': '\xa4', + '%a5': '\xa5', '%A5': '\xa5', '%a6': '\xa6', '%A6': '\xa6', '%a7': '\xa7', + '%A7': '\xa7', '%a8': '\xa8', '%A8': '\xa8', '%a9': '\xa9', '%A9': '\xa9', + '%aa': '\xaa', '%Aa': '\xaa', '%aA': '\xaa', '%AA': '\xaa', '%ab': '\xab', + '%Ab': '\xab', '%aB': '\xab', '%AB': '\xab', '%ac': '\xac', '%Ac': '\xac', + '%aC': '\xac', '%AC': '\xac', '%ad': '\xad', '%Ad': '\xad', '%aD': '\xad', + '%AD': '\xad', '%ae': '\xae', '%Ae': '\xae', '%aE': '\xae', '%AE': '\xae', + '%af': '\xaf', '%Af': '\xaf', '%aF': '\xaf', '%AF': '\xaf', '%b0': '\xb0', + '%B0': '\xb0', '%b1': '\xb1', '%B1': '\xb1', '%b2': '\xb2', '%B2': '\xb2', + '%b3': '\xb3', '%B3': '\xb3', '%b4': '\xb4', '%B4': '\xb4', '%b5': '\xb5', + '%B5': '\xb5', '%b6': '\xb6', '%B6': '\xb6', '%b7': '\xb7', '%B7': '\xb7', + '%b8': '\xb8', '%B8': '\xb8', '%b9': '\xb9', '%B9': '\xb9', '%ba': '\xba', + '%Ba': '\xba', '%bA': '\xba', '%BA': '\xba', '%bb': '\xbb', '%Bb': '\xbb', + '%bB': '\xbb', '%BB': '\xbb', '%bc': '\xbc', '%Bc': '\xbc', '%bC': '\xbc', + '%BC': '\xbc', '%bd': '\xbd', '%Bd': '\xbd', '%bD': '\xbd', '%BD': '\xbd', + '%be': '\xbe', '%Be': '\xbe', '%bE': '\xbe', '%BE': '\xbe', '%bf': '\xbf', + '%Bf': '\xbf', '%bF': '\xbf', '%BF': '\xbf', '%c0': '\xc0', '%C0': '\xc0', + '%c1': '\xc1', '%C1': '\xc1', '%c2': '\xc2', '%C2': '\xc2', '%c3': '\xc3', + '%C3': '\xc3', '%c4': '\xc4', '%C4': '\xc4', '%c5': '\xc5', '%C5': '\xc5', + '%c6': '\xc6', '%C6': '\xc6', '%c7': '\xc7', '%C7': '\xc7', '%c8': '\xc8', + '%C8': '\xc8', '%c9': '\xc9', '%C9': '\xc9', '%ca': '\xca', '%Ca': '\xca', + '%cA': '\xca', '%CA': '\xca', '%cb': '\xcb', '%Cb': '\xcb', '%cB': '\xcb', + '%CB': '\xcb', '%cc': '\xcc', '%Cc': '\xcc', '%cC': '\xcc', '%CC': '\xcc', + '%cd': '\xcd', '%Cd': '\xcd', '%cD': '\xcd', '%CD': '\xcd', '%ce': '\xce', + '%Ce': '\xce', '%cE': '\xce', '%CE': '\xce', '%cf': '\xcf', '%Cf': '\xcf', + '%cF': '\xcf', '%CF': '\xcf', '%d0': '\xd0', '%D0': '\xd0', '%d1': '\xd1', + '%D1': '\xd1', '%d2': '\xd2', '%D2': '\xd2', '%d3': '\xd3', '%D3': '\xd3', + '%d4': '\xd4', '%D4': '\xd4', '%d5': '\xd5', '%D5': '\xd5', '%d6': '\xd6', + '%D6': '\xd6', '%d7': '\xd7', '%D7': '\xd7', '%d8': '\xd8', '%D8': '\xd8', + '%d9': '\xd9', '%D9': '\xd9', '%da': '\xda', '%Da': '\xda', '%dA': '\xda', + '%DA': '\xda', '%db': '\xdb', '%Db': '\xdb', '%dB': '\xdb', '%DB': '\xdb', + '%dc': '\xdc', '%Dc': '\xdc', '%dC': '\xdc', '%DC': '\xdc', '%dd': '\xdd', + '%Dd': '\xdd', '%dD': '\xdd', '%DD': '\xdd', '%de': '\xde', '%De': '\xde', + '%dE': '\xde', '%DE': '\xde', '%df': '\xdf', '%Df': '\xdf', '%dF': '\xdf', + '%DF': '\xdf', '%e0': '\xe0', '%E0': '\xe0', '%e1': '\xe1', '%E1': '\xe1', + '%e2': '\xe2', '%E2': '\xe2', '%e3': '\xe3', '%E3': '\xe3', '%e4': '\xe4', + '%E4': '\xe4', '%e5': '\xe5', '%E5': '\xe5', '%e6': '\xe6', '%E6': '\xe6', + '%e7': '\xe7', '%E7': '\xe7', '%e8': '\xe8', '%E8': '\xe8', '%e9': '\xe9', + '%E9': '\xe9', '%ea': '\xea', '%Ea': '\xea', '%eA': '\xea', '%EA': '\xea', + '%eb': '\xeb', '%Eb': '\xeb', '%eB': '\xeb', '%EB': '\xeb', '%ec': '\xec', + '%Ec': '\xec', '%eC': '\xec', '%EC': '\xec', '%ed': '\xed', '%Ed': '\xed', + '%eD': '\xed', '%ED': '\xed', '%ee': '\xee', '%Ee': '\xee', '%eE': '\xee', + '%EE': '\xee', '%ef': '\xef', '%Ef': '\xef', '%eF': '\xef', '%EF': '\xef', + '%f0': '\xf0', '%F0': '\xf0', '%f1': '\xf1', '%F1': '\xf1', '%f2': '\xf2', + '%F2': '\xf2', '%f3': '\xf3', '%F3': '\xf3', '%f4': '\xf4', '%F4': '\xf4', + '%f5': '\xf5', '%F5': '\xf5', '%f6': '\xf6', '%F6': '\xf6', '%f7': '\xf7', + '%F7': '\xf7', '%f8': '\xf8', '%F8': '\xf8', '%f9': '\xf9', '%F9': '\xf9', + '%fa': '\xfa', '%Fa': '\xfa', '%fA': '\xfa', '%FA': '\xfa', '%fb': '\xfb', + '%Fb': '\xfb', '%fB': '\xfb', '%FB': '\xfb', '%fc': '\xfc', '%Fc': '\xfc', + '%fC': '\xfc', '%FC': '\xfc', '%fd': '\xfd', '%Fd': '\xfd', '%fD': '\xfd', + '%FD': '\xfd', '%fe': '\xfe', '%Fe': '\xfe', '%fE': '\xfe', '%FE': '\xfe', + '%ff': '\xff', '%Ff': '\xff', '%fF': '\xff', '%FF': '\xff' +} + +function encodedReplacer (match) { + return EncodedLookup[match] +} + +const STATE_KEY = 0 +const STATE_VALUE = 1 +const STATE_CHARSET = 2 +const STATE_LANG = 3 + +function parseParams (str) { + const res = [] + let state = STATE_KEY + let charset = '' + let inquote = false + let escaping = false + let p = 0 + let tmp = '' + const len = str.length + + for (var i = 0; i < len; ++i) { // eslint-disable-line no-var + const char = str[i] + if (char === '\\' && inquote) { + if (escaping) { escaping = false } else { + escaping = true + continue + } + } else if (char === '"') { + if (!escaping) { + if (inquote) { + inquote = false + state = STATE_KEY + } else { inquote = true } + continue + } else { escaping = false } + } else { + if (escaping && inquote) { tmp += '\\' } + escaping = false + if ((state === STATE_CHARSET || state === STATE_LANG) && char === "'") { + if (state === STATE_CHARSET) { + state = STATE_LANG + charset = tmp.substring(1) + } else { state = STATE_VALUE } + tmp = '' + continue + } else if (state === STATE_KEY && + (char === '*' || char === '=') && + res.length) { + state = char === '*' + ? STATE_CHARSET + : STATE_VALUE + res[p] = [tmp, undefined] + tmp = '' + continue + } else if (!inquote && char === ';') { + state = STATE_KEY + if (charset) { + if (tmp.length) { + tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), + 'binary', + charset) + } + charset = '' + } else if (tmp.length) { + tmp = decodeText(tmp, 'binary', 'utf8') } - return canonicalizedResourceString; + if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp } + tmp = '' + ++p + continue + } else if (!inquote && (char === ' ' || char === '\t')) { continue } + } + tmp += char + } + if (charset && tmp.length) { + tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), + 'binary', + charset) + } else if (tmp) { + tmp = decodeText(tmp, 'binary', 'utf8') + } + + if (res[p] === undefined) { + if (tmp) { res[p] = tmp } + } else { res[p][1] = tmp } + + return res +} + +module.exports = parseParams + + +/***/ }), + +/***/ 72033: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbortError = void 0; +/** + * This error is thrown when an asynchronous operation has been aborted. + * Check for this error by testing the `name` that the name property of the + * error matches `"AbortError"`. + * + * @example + * ```ts snippet:ReadmeSampleAbortError + * import { AbortError } from "@typespec/ts-http-runtime"; + * + * async function doAsyncWork(options: { abortSignal: AbortSignal }): Promise { + * if (options.abortSignal.aborted) { + * throw new AbortError(); + * } + * + * // do async work + * } + * + * const controller = new AbortController(); + * controller.abort(); + * + * try { + * doAsyncWork({ abortSignal: controller.signal }); + * } catch (e) { + * if (e instanceof Error && e.name === "AbortError") { + * // handle abort error here. + * } + * } + * ``` + */ +class AbortError extends Error { + constructor(message) { + super(message); + this.name = "AbortError"; } } -exports.StorageSharedKeyCredentialPolicy = StorageSharedKeyCredentialPolicy; -//# sourceMappingURL=StorageSharedKeyCredentialPolicy.js.map +exports.AbortError = AbortError; +//# sourceMappingURL=AbortError.js.map /***/ }), -/***/ 89020: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 5630: +/***/ ((__unused_webpack_module, exports) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.storageSharedKeyCredentialPolicyName = void 0; -exports.storageSharedKeyCredentialPolicy = storageSharedKeyCredentialPolicy; -const node_crypto_1 = __nccwpck_require__(6005); -const constants_js_1 = __nccwpck_require__(77807); -const utils_common_js_1 = __nccwpck_require__(61876); -const SharedKeyComparator_js_1 = __nccwpck_require__(4482); +exports.isOAuth2TokenCredential = isOAuth2TokenCredential; +exports.isBearerTokenCredential = isBearerTokenCredential; +exports.isBasicCredential = isBasicCredential; +exports.isApiKeyCredential = isApiKeyCredential; /** - * The programmatic identifier of the storageSharedKeyCredentialPolicy. + * Type guard to check if a credential is an OAuth2 token credential. */ -exports.storageSharedKeyCredentialPolicyName = "storageSharedKeyCredentialPolicy"; +function isOAuth2TokenCredential(credential) { + return "getOAuth2Token" in credential; +} /** - * storageSharedKeyCredentialPolicy handles signing requests using storage account keys. + * Type guard to check if a credential is a Bearer token credential. */ -function storageSharedKeyCredentialPolicy(options) { - function signRequest(request) { - request.headers.set(constants_js_1.HeaderConstants.X_MS_DATE, new Date().toUTCString()); - if (request.body && - (typeof request.body === "string" || Buffer.isBuffer(request.body)) && - request.body.length > 0) { - request.headers.set(constants_js_1.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body)); - } - const stringToSign = [ - request.method.toUpperCase(), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LANGUAGE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_ENCODING), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_LENGTH), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_MD5), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.CONTENT_TYPE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.DATE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MODIFIED_SINCE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_MATCH), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_NONE_MATCH), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.IF_UNMODIFIED_SINCE), - getHeaderValueToSign(request, constants_js_1.HeaderConstants.RANGE), - ].join("\n") + - "\n" + - getCanonicalizedHeadersString(request) + - getCanonicalizedResourceString(request); - const signature = (0, node_crypto_1.createHmac)("sha256", options.accountKey) - .update(stringToSign, "utf8") - .digest("base64"); - request.headers.set(constants_js_1.HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`); - // console.log(`[URL]:${request.url}`); - // console.log(`[HEADERS]:${request.headers.toString()}`); - // console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`); - // console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`); - } - /** - * Retrieve header value according to shared key sign rules. - * @see https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key - */ - function getHeaderValueToSign(request, headerName) { - const value = request.headers.get(headerName); - if (!value) { - return ""; - } - // When using version 2015-02-21 or later, if Content-Length is zero, then - // set the Content-Length part of the StringToSign to an empty string. - // https://learn.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key - if (headerName === constants_js_1.HeaderConstants.CONTENT_LENGTH && value === "0") { - return ""; - } - return value; - } - /** - * To construct the CanonicalizedHeaders portion of the signature string, follow these steps: - * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header. - * 2. Convert each HTTP header name to lowercase. - * 3. Sort the headers lexicographically by header name, in ascending order. - * Each header may appear only once in the string. - * 4. Replace any linear whitespace in the header value with a single space. - * 5. Trim any whitespace around the colon in the header. - * 6. Finally, append a new-line character to each canonicalized header in the resulting list. - * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string. - * - */ - function getCanonicalizedHeadersString(request) { - let headersArray = []; - for (const [name, value] of request.headers) { - if (name.toLowerCase().startsWith(constants_js_1.HeaderConstants.PREFIX_FOR_STORAGE)) { - headersArray.push({ name, value }); - } - } - headersArray.sort((a, b) => { - return (0, SharedKeyComparator_js_1.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase()); - }); - // Remove duplicate headers - headersArray = headersArray.filter((value, index, array) => { - if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) { - return false; - } - return true; - }); - let canonicalizedHeadersStringToSign = ""; - headersArray.forEach((header) => { - canonicalizedHeadersStringToSign += `${header.name - .toLowerCase() - .trimRight()}:${header.value.trimLeft()}\n`; - }); - return canonicalizedHeadersStringToSign; - } - function getCanonicalizedResourceString(request) { - const path = (0, utils_common_js_1.getURLPath)(request.url) || "/"; - let canonicalizedResourceString = ""; - canonicalizedResourceString += `/${options.accountName}${path}`; - const queries = (0, utils_common_js_1.getURLQueries)(request.url); - const lowercaseQueries = {}; - if (queries) { - const queryKeys = []; - for (const key in queries) { - if (Object.prototype.hasOwnProperty.call(queries, key)) { - const lowercaseKey = key.toLowerCase(); - lowercaseQueries[lowercaseKey] = queries[key]; - queryKeys.push(lowercaseKey); - } - } - queryKeys.sort(); - for (const key of queryKeys) { - canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`; - } - } - return canonicalizedResourceString; - } +function isBearerTokenCredential(credential) { + return "getBearerToken" in credential; +} +/** + * Type guard to check if a credential is a Basic auth credential. + */ +function isBasicCredential(credential) { + return "username" in credential && "password" in credential; +} +/** + * Type guard to check if a credential is an API key credential. + */ +function isApiKeyCredential(credential) { + return "key" in credential; +} +//# sourceMappingURL=credentials.js.map + +/***/ }), + +/***/ 38018: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=oauth2Flows.js.map + +/***/ }), + +/***/ 65546: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=schemes.js.map + +/***/ }), + +/***/ 51648: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.apiVersionPolicyName = void 0; +exports.apiVersionPolicy = apiVersionPolicy; +exports.apiVersionPolicyName = "ApiVersionPolicy"; +/** + * Creates a policy that sets the apiVersion as a query parameter on every request + * @param options - Client options + * @returns Pipeline policy that sets the apiVersion as a query parameter on every request + */ +function apiVersionPolicy(options) { return { - name: exports.storageSharedKeyCredentialPolicyName, - async sendRequest(request, next) { - signRequest(request); - return next(request); + name: exports.apiVersionPolicyName, + sendRequest: (req, next) => { + // Use the apiVesion defined in request url directly + // Append one if there is no apiVesion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && options.apiVersion) { + req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${options.apiVersion}`; + } + return next(req); }, }; } -//# sourceMappingURL=StorageSharedKeyCredentialPolicyV2.js.map +//# sourceMappingURL=apiVersionPolicy.js.map /***/ }), -/***/ 4482: -/***/ ((__unused_webpack_module, exports) => { +/***/ 11687: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.compareHeader = compareHeader; -/* - * We need to imitate .Net culture-aware sorting, which is used in storage service. - * Below tables contain sort-keys for en-US culture. +exports.createDefaultPipeline = createDefaultPipeline; +exports.getCachedDefaultHttpsClient = getCachedDefaultHttpsClient; +const defaultHttpClient_js_1 = __nccwpck_require__(42917); +const createPipelineFromOptions_js_1 = __nccwpck_require__(97239); +const apiVersionPolicy_js_1 = __nccwpck_require__(51648); +const credentials_js_1 = __nccwpck_require__(5630); +const apiKeyAuthenticationPolicy_js_1 = __nccwpck_require__(7937); +const basicAuthenticationPolicy_js_1 = __nccwpck_require__(10068); +const bearerAuthenticationPolicy_js_1 = __nccwpck_require__(73054); +const oauth2AuthenticationPolicy_js_1 = __nccwpck_require__(71305); +let cachedHttpClient; +/** + * Creates a default rest pipeline to re-use accross Rest Level Clients */ -const table_lv0 = new Uint32Array([ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, - 0x723, 0x725, 0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e, - 0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe02, 0xe09, 0xe0a, - 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, - 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x0, 0x0, 0x743, 0x744, 0x748, - 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, - 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c, - 0x0, 0x750, 0x0, -]); -const table_lv2 = new Uint32Array([ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, - 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, - 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, -]); -const table_lv4 = new Uint32Array([ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, -]); -function compareHeader(lhs, rhs) { - if (isLessThan(lhs, rhs)) - return -1; - return 1; -} -function isLessThan(lhs, rhs) { - const tables = [table_lv0, table_lv2, table_lv4]; - let curr_level = 0; - let i = 0; - let j = 0; - while (curr_level < tables.length) { - if (curr_level === tables.length - 1 && i !== j) { - return i > j; - } - const weight1 = i < lhs.length ? tables[curr_level][lhs[i].charCodeAt(0)] : 0x1; - const weight2 = j < rhs.length ? tables[curr_level][rhs[j].charCodeAt(0)] : 0x1; - if (weight1 === 0x1 && weight2 === 0x1) { - i = 0; - j = 0; - ++curr_level; - } - else if (weight1 === weight2) { - ++i; - ++j; +function createDefaultPipeline(options = {}) { + const pipeline = (0, createPipelineFromOptions_js_1.createPipelineFromOptions)(options); + pipeline.addPolicy((0, apiVersionPolicy_js_1.apiVersionPolicy)(options)); + const { credential, authSchemes, allowInsecureConnection } = options; + if (credential) { + if ((0, credentials_js_1.isApiKeyCredential)(credential)) { + pipeline.addPolicy((0, apiKeyAuthenticationPolicy_js_1.apiKeyAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); } - else if (weight1 === 0) { - ++i; + else if ((0, credentials_js_1.isBasicCredential)(credential)) { + pipeline.addPolicy((0, basicAuthenticationPolicy_js_1.basicAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); } - else if (weight2 === 0) { - ++j; + else if ((0, credentials_js_1.isBearerTokenCredential)(credential)) { + pipeline.addPolicy((0, bearerAuthenticationPolicy_js_1.bearerAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); } - else { - return weight1 < weight2; + else if ((0, credentials_js_1.isOAuth2TokenCredential)(credential)) { + pipeline.addPolicy((0, oauth2AuthenticationPolicy_js_1.oauth2AuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); } } - return false; + return pipeline; } -//# sourceMappingURL=SharedKeyComparator.js.map +function getCachedDefaultHttpsClient() { + if (!cachedHttpClient) { + cachedHttpClient = (0, defaultHttpClient_js_1.createDefaultHttpClient)(); + } + return cachedHttpClient; +} +//# sourceMappingURL=clientHelpers.js.map /***/ }), -/***/ 77807: -/***/ ((__unused_webpack_module, exports) => { +/***/ 15714: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.PathStylePorts = exports.DevelopmentConnectionString = exports.HeaderConstants = exports.URLConstants = exports.SDK_VERSION = void 0; -exports.SDK_VERSION = "1.0.0"; -exports.URLConstants = { - Parameters: { - FORCE_BROWSER_NO_CACHE: "_", - SIGNATURE: "sig", - SNAPSHOT: "snapshot", - VERSIONID: "versionid", - TIMEOUT: "timeout", - }, -}; -exports.HeaderConstants = { - AUTHORIZATION: "Authorization", - AUTHORIZATION_SCHEME: "Bearer", - CONTENT_ENCODING: "Content-Encoding", - CONTENT_ID: "Content-ID", - CONTENT_LANGUAGE: "Content-Language", - CONTENT_LENGTH: "Content-Length", - CONTENT_MD5: "Content-Md5", - CONTENT_TRANSFER_ENCODING: "Content-Transfer-Encoding", - CONTENT_TYPE: "Content-Type", - COOKIE: "Cookie", - DATE: "date", - IF_MATCH: "if-match", - IF_MODIFIED_SINCE: "if-modified-since", - IF_NONE_MATCH: "if-none-match", - IF_UNMODIFIED_SINCE: "if-unmodified-since", - PREFIX_FOR_STORAGE: "x-ms-", - RANGE: "Range", - USER_AGENT: "User-Agent", - X_MS_CLIENT_REQUEST_ID: "x-ms-client-request-id", - X_MS_COPY_SOURCE: "x-ms-copy-source", - X_MS_DATE: "x-ms-date", - X_MS_ERROR_CODE: "x-ms-error-code", - X_MS_VERSION: "x-ms-version", - X_MS_CopySourceErrorCode: "x-ms-copy-source-error-code", -}; -exports.DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;`; -/// List of ports used for path style addressing. -/// Path style addressing means that storage account is put in URI's Path segment in instead of in host. -exports.PathStylePorts = [ - "10000", - "10001", - "10002", - "10003", - "10004", - "10100", - "10101", - "10102", - "10103", - "10104", - "11000", - "11001", - "11002", - "11003", - "11004", - "11100", - "11101", - "11102", - "11103", - "11104", -]; -//# sourceMappingURL=constants.js.map +exports.getClient = getClient; +const clientHelpers_js_1 = __nccwpck_require__(11687); +const sendRequest_js_1 = __nccwpck_require__(94381); +const urlHelpers_js_1 = __nccwpck_require__(91752); +const checkEnvironment_js_1 = __nccwpck_require__(94121); +/** + * Creates a client with a default pipeline + * @param endpoint - Base endpoint for the client + * @param credentials - Credentials to authenticate the requests + * @param options - Client options + */ +function getClient(endpoint, clientOptions = {}) { + const pipeline = clientOptions.pipeline ?? (0, clientHelpers_js_1.createDefaultPipeline)(clientOptions); + if (clientOptions.additionalPolicies?.length) { + for (const { policy, position } of clientOptions.additionalPolicies) { + // Sign happens after Retry and is commonly needed to occur + // before policies that intercept post-retry. + const afterPhase = position === "perRetry" ? "Sign" : undefined; + pipeline.addPolicy(policy, { + afterPhase, + }); + } + } + const { allowInsecureConnection, httpClient } = clientOptions; + const endpointUrl = clientOptions.endpoint ?? endpoint; + const client = (path, ...args) => { + const getUrl = (requestOptions) => (0, urlHelpers_js_1.buildRequestUrl)(endpointUrl, path, args, { allowInsecureConnection, ...requestOptions }); + return { + get: (requestOptions = {}) => { + return buildOperation("GET", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + post: (requestOptions = {}) => { + return buildOperation("POST", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + put: (requestOptions = {}) => { + return buildOperation("PUT", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + patch: (requestOptions = {}) => { + return buildOperation("PATCH", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + delete: (requestOptions = {}) => { + return buildOperation("DELETE", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + head: (requestOptions = {}) => { + return buildOperation("HEAD", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + options: (requestOptions = {}) => { + return buildOperation("OPTIONS", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + trace: (requestOptions = {}) => { + return buildOperation("TRACE", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); + }, + }; + }; + return { + path: client, + pathUnchecked: client, + pipeline, + }; +} +function buildOperation(method, url, pipeline, options, allowInsecureConnection, httpClient) { + allowInsecureConnection = options.allowInsecureConnection ?? allowInsecureConnection; + return { + then: function (onFulfilled, onrejected) { + return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, { ...options, allowInsecureConnection }, httpClient).then(onFulfilled, onrejected); + }, + async asBrowserStream() { + if (checkEnvironment_js_1.isNodeLike) { + throw new Error("`asBrowserStream` is supported only in the browser environment. Use `asNodeStream` instead to obtain the response body stream. If you require a Web stream of the response in Node, consider using `Readable.toWeb` on the result of `asNodeStream`."); + } + else { + return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, { ...options, allowInsecureConnection, responseAsStream: true }, httpClient); + } + }, + async asNodeStream() { + if (checkEnvironment_js_1.isNodeLike) { + return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, { ...options, allowInsecureConnection, responseAsStream: true }, httpClient); + } + else { + throw new Error("`isNodeStream` is not supported in the browser environment. Use `asBrowserStream` to obtain the response body stream."); + } + }, + }; +} +//# sourceMappingURL=getClient.js.map /***/ }), -/***/ 61876: +/***/ 56985: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -124368,2340 +117530,3011 @@ exports.PathStylePorts = [ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.escapeURLPath = escapeURLPath; -exports.getValueInConnString = getValueInConnString; -exports.extractConnectionStringParts = extractConnectionStringParts; -exports.appendToURLPath = appendToURLPath; -exports.setURLParameter = setURLParameter; -exports.getURLParameter = getURLParameter; -exports.setURLHost = setURLHost; -exports.getURLPath = getURLPath; -exports.getURLScheme = getURLScheme; -exports.getURLPathAndQuery = getURLPathAndQuery; -exports.getURLQueries = getURLQueries; -exports.appendToURLQuery = appendToURLQuery; -exports.truncatedISO8061Date = truncatedISO8061Date; -exports.base64encode = base64encode; -exports.base64decode = base64decode; -exports.generateBlockID = generateBlockID; -exports.delay = delay; -exports.padStart = padStart; -exports.sanitizeURL = sanitizeURL; -exports.sanitizeHeaders = sanitizeHeaders; -exports.iEqual = iEqual; -exports.getAccountNameFromUrl = getAccountNameFromUrl; -exports.isIpEndpointStyle = isIpEndpointStyle; -exports.attachCredential = attachCredential; -exports.httpAuthorizationToString = httpAuthorizationToString; -exports.EscapePath = EscapePath; -exports.assertResponse = assertResponse; -const core_rest_pipeline_1 = __nccwpck_require__(29146); -const core_util_1 = __nccwpck_require__(80637); -const constants_js_1 = __nccwpck_require__(77807); +exports.buildBodyPart = buildBodyPart; +exports.buildMultipartBody = buildMultipartBody; +const restError_js_1 = __nccwpck_require__(42858); +const httpHeaders_js_1 = __nccwpck_require__(66816); +const bytesEncoding_js_1 = __nccwpck_require__(88943); +const typeGuards_js_1 = __nccwpck_require__(61580); /** - * Reserved URL characters must be properly escaped for Storage services like Blob or File. - * - * ## URL encode and escape strategy for JS SDKs - * - * When customers pass a URL string into XxxClient classes constructor, the URL string may already be URL encoded or not. - * But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL - * string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XxxClient constructors. - * - * ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK. - * - * This is what legacy V2 SDK does, simple and works for most of the cases. - * - When customer URL string is "http://account.blob.core.windows.net/con/b:", - * SDK will encode it to "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created. - * - When customer URL string is "http://account.blob.core.windows.net/con/b%3A", - * SDK will encode it to "http://account.blob.core.windows.net/con/b%253A" and send to server. A blob named "b%3A" will be created. - * - * But this strategy will make it not possible to create a blob with "?" in it's name. Because when customer URL string is - * "http://account.blob.core.windows.net/con/blob?name", the "?name" will be treated as URL paramter instead of blob name. - * If customer URL string is "http://account.blob.core.windows.net/con/blob%3Fname", a blob named "blob%3Fname" will be created. - * V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it. - * We cannot accept a SDK cannot create a blob name with "?". So we implement strategy two: - * - * ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters. - * - * This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped. - * - When customer URL string is "http://account.blob.core.windows.net/con/b:", - * SDK will escape ":" like "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created. - * - When customer URL string is "http://account.blob.core.windows.net/con/b%3A", - * There is no special characters, so send "http://account.blob.core.windows.net/con/b%3A" to server. A blob named "b:" will be created. - * - When customer URL string is "http://account.blob.core.windows.net/con/b%253A", - * There is no special characters, so send "http://account.blob.core.windows.net/con/b%253A" to server. A blob named "b%3A" will be created. - * - * This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string - * is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL. - * If customer needs to create a blob with "%" in it's blob name, use "%25" instead of "%". Just like above 3rd sample. - * And following URL strings are invalid: - * - "http://account.blob.core.windows.net/con/b%" - * - "http://account.blob.core.windows.net/con/b%2" - * - "http://account.blob.core.windows.net/con/b%G" - * - * Another special character is "?", use "%2F" to represent a blob name with "?" in a URL string. - * - * ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `containerClient.getBlobClient(blobName)` - * - * We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL. - * - * @see https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata - * @see https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata - * - * @param url - + * Get value of a header in the part descriptor ignoring case */ -function escapeURLPath(url) { - const urlParsed = new URL(url); - let path = urlParsed.pathname; - path = path || "/"; - path = escape(path); - urlParsed.pathname = path; - return urlParsed.toString(); -} -function getProxyUriFromDevConnString(connectionString) { - // Development Connection String - // https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key - let proxyUri = ""; - if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) { - // CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri - const matchCredentials = connectionString.split(";"); - for (const element of matchCredentials) { - if (element.trim().startsWith("DevelopmentStorageProxyUri=")) { - proxyUri = element.trim().match("DevelopmentStorageProxyUri=(.*)")[1]; - } +function getHeaderValue(descriptor, headerName) { + if (descriptor.headers) { + const actualHeaderName = Object.keys(descriptor.headers).find((x) => x.toLowerCase() === headerName.toLowerCase()); + if (actualHeaderName) { + return descriptor.headers[actualHeaderName]; } } - return proxyUri; + return undefined; } -function getValueInConnString(connectionString, argument) { - const elements = connectionString.split(";"); - for (const element of elements) { - if (element.trim().startsWith(argument)) { - return element.trim().match(argument + "=(.*)")[1]; - } +function getPartContentType(descriptor) { + const contentTypeHeader = getHeaderValue(descriptor, "content-type"); + if (contentTypeHeader) { + return contentTypeHeader; } - return ""; -} -/** - * Extracts the parts of an Azure Storage account connection string. - * - * @param connectionString - Connection string. - * @returns String key value pairs of the storage account's url and credentials. - */ -function extractConnectionStringParts(connectionString) { - let proxyUri = ""; - if (connectionString.startsWith("UseDevelopmentStorage=true")) { - // Development connection string - proxyUri = getProxyUriFromDevConnString(connectionString); - connectionString = constants_js_1.DevelopmentConnectionString; + // Special value of null means content type is to be omitted + if (descriptor.contentType === null) { + return undefined; } - // Matching BlobEndpoint in the Account connection string - let blobEndpoint = getValueInConnString(connectionString, "BlobEndpoint"); - // Slicing off '/' at the end if exists - // (The methods that use `extractConnectionStringParts` expect the url to not have `/` at the end) - blobEndpoint = blobEndpoint.endsWith("/") ? blobEndpoint.slice(0, -1) : blobEndpoint; - if (connectionString.search("DefaultEndpointsProtocol=") !== -1 && - connectionString.search("AccountKey=") !== -1) { - // Account connection string - let defaultEndpointsProtocol = ""; - let accountName = ""; - let accountKey = Buffer.from("accountKey", "base64"); - let endpointSuffix = ""; - // Get account name and key - accountName = getValueInConnString(connectionString, "AccountName"); - accountKey = Buffer.from(getValueInConnString(connectionString, "AccountKey"), "base64"); - if (!blobEndpoint) { - // BlobEndpoint is not present in the Account connection string - // Can be obtained from `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}` - defaultEndpointsProtocol = getValueInConnString(connectionString, "DefaultEndpointsProtocol"); - const protocol = defaultEndpointsProtocol.toLowerCase(); - if (protocol !== "https" && protocol !== "http") { - throw new Error("Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'"); - } - endpointSuffix = getValueInConnString(connectionString, "EndpointSuffix"); - if (!endpointSuffix) { - throw new Error("Invalid EndpointSuffix in the provided Connection String"); - } - blobEndpoint = `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; - } - if (!accountName) { - throw new Error("Invalid AccountName in the provided Connection String"); - } - else if (accountKey.length === 0) { - throw new Error("Invalid AccountKey in the provided Connection String"); - } - return { - kind: "AccountConnString", - url: blobEndpoint, - accountName, - accountKey, - proxyUri, - }; + if (descriptor.contentType) { + return descriptor.contentType; } - else { - // SAS connection string - let accountSas = getValueInConnString(connectionString, "SharedAccessSignature"); - let accountName = getValueInConnString(connectionString, "AccountName"); - // if accountName is empty, try to read it from BlobEndpoint - if (!accountName) { - accountName = getAccountNameFromUrl(blobEndpoint); - } - if (!blobEndpoint) { - throw new Error("Invalid BlobEndpoint in the provided SAS Connection String"); - } - else if (!accountSas) { - throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String"); - } - // client constructors assume accountSas does *not* start with ? - if (accountSas.startsWith("?")) { - accountSas = accountSas.substring(1); - } - return { kind: "SASConnString", url: blobEndpoint, accountName, accountSas }; + const { body } = descriptor; + if (body === null || body === undefined) { + return undefined; } -} -/** - * Internal escape method implemented Strategy Two mentioned in escapeURL() description. - * - * @param text - - */ -function escape(text) { - return encodeURIComponent(text) - .replace(/%2F/g, "/") // Don't escape for "/" - .replace(/'/g, "%27") // Escape for "'" - .replace(/\+/g, "%20") - .replace(/%25/g, "%"); // Revert encoded "%" -} -/** - * Append a string to URL path. Will remove duplicated "/" in front of the string - * when URL path ends with a "/". - * - * @param url - Source URL string - * @param name - String to be appended to URL - * @returns An updated URL string - */ -function appendToURLPath(url, name) { - const urlParsed = new URL(url); - let path = urlParsed.pathname; - path = path ? (path.endsWith("/") ? `${path}${name}` : `${path}/${name}`) : name; - urlParsed.pathname = path; - return urlParsed.toString(); -} -/** - * Set URL parameter name and value. If name exists in URL parameters, old value - * will be replaced by name key. If not provide value, the parameter will be deleted. - * - * @param url - Source URL string - * @param name - Parameter name - * @param value - Parameter value - * @returns An updated URL string - */ -function setURLParameter(url, name, value) { - const urlParsed = new URL(url); - const encodedName = encodeURIComponent(name); - const encodedValue = value ? encodeURIComponent(value) : undefined; - // mutating searchParams will change the encoding, so we have to do this ourselves - const searchString = urlParsed.search === "" ? "?" : urlParsed.search; - const searchPieces = []; - for (const pair of searchString.slice(1).split("&")) { - if (pair) { - const [key] = pair.split("=", 2); - if (key !== encodedName) { - searchPieces.push(pair); - } - } + if (typeof body === "string" || typeof body === "number" || typeof body === "boolean") { + return "text/plain; charset=UTF-8"; } - if (encodedValue) { - searchPieces.push(`${encodedName}=${encodedValue}`); + if (body instanceof Blob) { + return body.type || "application/octet-stream"; } - urlParsed.search = searchPieces.length ? `?${searchPieces.join("&")}` : ""; - return urlParsed.toString(); -} -/** - * Get URL parameter by name. - * - * @param url - - * @param name - - */ -function getURLParameter(url, name) { - const urlParsed = new URL(url); - return urlParsed.searchParams.get(name) ?? undefined; + if ((0, typeGuards_js_1.isBinaryBody)(body)) { + return "application/octet-stream"; + } + // arbitrary non-text object -> generic JSON content type by default. We will try to JSON.stringify the body. + return "application/json"; } /** - * Set URL host. - * - * @param url - Source URL string - * @param host - New host string - * @returns An updated URL string + * Enclose value in quotes and escape special characters, for use in the Content-Disposition header */ -function setURLHost(url, host) { - const urlParsed = new URL(url); - urlParsed.hostname = host; - return urlParsed.toString(); +function escapeDispositionField(value) { + return JSON.stringify(value); } -/** - * Get URL path from an URL string. - * - * @param url - Source URL string - */ -function getURLPath(url) { - try { - const urlParsed = new URL(url); - return urlParsed.pathname; +function getContentDisposition(descriptor) { + const contentDispositionHeader = getHeaderValue(descriptor, "content-disposition"); + if (contentDispositionHeader) { + return contentDispositionHeader; } - catch (e) { + if (descriptor.dispositionType === undefined && + descriptor.name === undefined && + descriptor.filename === undefined) { return undefined; } + const dispositionType = descriptor.dispositionType ?? "form-data"; + let disposition = dispositionType; + if (descriptor.name) { + disposition += `; name=${escapeDispositionField(descriptor.name)}`; + } + let filename = undefined; + if (descriptor.filename) { + filename = descriptor.filename; + } + else if (typeof File !== "undefined" && descriptor.body instanceof File) { + const filenameFromFile = descriptor.body.name; + if (filenameFromFile !== "") { + filename = filenameFromFile; + } + } + if (filename) { + disposition += `; filename=${escapeDispositionField(filename)}`; + } + return disposition; } -/** - * Get URL scheme from an URL string. - * - * @param url - Source URL string - */ -function getURLScheme(url) { - try { - const urlParsed = new URL(url); - return urlParsed.protocol.endsWith(":") ? urlParsed.protocol.slice(0, -1) : urlParsed.protocol; +function normalizeBody(body, contentType) { + if (body === undefined) { + // zero-length body + return new Uint8Array([]); } - catch (e) { - return undefined; + // binary and primitives should go straight on the wire regardless of content type + if ((0, typeGuards_js_1.isBinaryBody)(body)) { + return body; + } + if (typeof body === "string" || typeof body === "number" || typeof body === "boolean") { + return (0, bytesEncoding_js_1.stringToUint8Array)(String(body), "utf-8"); } + // stringify objects for JSON-ish content types e.g. application/json, application/merge-patch+json, application/vnd.oci.manifest.v1+json, application.json; charset=UTF-8 + if (contentType && /application\/(.+\+)?json(;.+)?/i.test(String(contentType))) { + return (0, bytesEncoding_js_1.stringToUint8Array)(JSON.stringify(body), "utf-8"); + } + throw new restError_js_1.RestError(`Unsupported body/content-type combination: ${body}, ${contentType}`); } -/** - * Get URL path and query from an URL string. - * - * @param url - Source URL string - */ -function getURLPathAndQuery(url) { - const urlParsed = new URL(url); - const pathString = urlParsed.pathname; - if (!pathString) { - throw new RangeError("Invalid url without valid path."); +function buildBodyPart(descriptor) { + const contentType = getPartContentType(descriptor); + const contentDisposition = getContentDisposition(descriptor); + const headers = (0, httpHeaders_js_1.createHttpHeaders)(descriptor.headers ?? {}); + if (contentType) { + headers.set("content-type", contentType); } - let queryString = urlParsed.search || ""; - queryString = queryString.trim(); - if (queryString !== "") { - queryString = queryString.startsWith("?") ? queryString : `?${queryString}`; // Ensure query string start with '?' + if (contentDisposition) { + headers.set("content-disposition", contentDisposition); } - return `${pathString}${queryString}`; + const body = normalizeBody(descriptor.body, contentType); + return { + headers, + body, + }; +} +function buildMultipartBody(parts) { + return { parts: parts.map(buildBodyPart) }; } +//# sourceMappingURL=multipart.js.map + +/***/ }), + +/***/ 16857: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.operationOptionsToRequestParameters = operationOptionsToRequestParameters; /** - * Get URL query key value pairs from an URL string. - * - * @param url - + * Helper function to convert OperationOptions to RequestParameters + * @param options - the options that are used by Modular layer to send the request + * @returns the result of the conversion in RequestParameters of RLC layer */ -function getURLQueries(url) { - let queryString = new URL(url).search; - if (!queryString) { - return {}; - } - queryString = queryString.trim(); - queryString = queryString.startsWith("?") ? queryString.substring(1) : queryString; - let querySubStrings = queryString.split("&"); - querySubStrings = querySubStrings.filter((value) => { - const indexOfEqual = value.indexOf("="); - const lastIndexOfEqual = value.lastIndexOf("="); - return (indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1); +function operationOptionsToRequestParameters(options) { + return { + allowInsecureConnection: options.requestOptions?.allowInsecureConnection, + timeout: options.requestOptions?.timeout, + skipUrlEncoding: options.requestOptions?.skipUrlEncoding, + abortSignal: options.abortSignal, + onUploadProgress: options.requestOptions?.onUploadProgress, + onDownloadProgress: options.requestOptions?.onDownloadProgress, + headers: { ...options.requestOptions?.headers }, + onResponse: options.onResponse, + }; +} +//# sourceMappingURL=operationOptionHelpers.js.map + +/***/ }), + +/***/ 24193: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createRestError = createRestError; +const restError_js_1 = __nccwpck_require__(42858); +const httpHeaders_js_1 = __nccwpck_require__(66816); +function createRestError(messageOrResponse, response) { + const resp = typeof messageOrResponse === "string" ? response : messageOrResponse; + const internalError = resp.body?.error ?? resp.body; + const message = typeof messageOrResponse === "string" + ? messageOrResponse + : (internalError?.message ?? `Unexpected status code: ${resp.status}`); + return new restError_js_1.RestError(message, { + statusCode: statusCodeToNumber(resp.status), + code: internalError?.code, + request: resp.request, + response: toPipelineResponse(resp), }); - const queries = {}; - for (const querySubString of querySubStrings) { - const splitResults = querySubString.split("="); - const key = splitResults[0]; - const value = splitResults[1]; - queries[key] = value; - } - return queries; } +function toPipelineResponse(response) { + return { + headers: (0, httpHeaders_js_1.createHttpHeaders)(response.headers), + request: response.request, + status: statusCodeToNumber(response.status) ?? -1, + }; +} +function statusCodeToNumber(statusCode) { + const status = Number.parseInt(statusCode); + return Number.isNaN(status) ? undefined : status; +} +//# sourceMappingURL=restError.js.map + +/***/ }), + +/***/ 94381: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.sendRequest = sendRequest; +const restError_js_1 = __nccwpck_require__(42858); +const httpHeaders_js_1 = __nccwpck_require__(66816); +const pipelineRequest_js_1 = __nccwpck_require__(47983); +const clientHelpers_js_1 = __nccwpck_require__(11687); +const typeGuards_js_1 = __nccwpck_require__(61580); +const multipart_js_1 = __nccwpck_require__(56985); /** - * Append a string to URL query. - * - * @param url - Source URL string. - * @param queryParts - String to be appended to the URL query. - * @returns An updated URL string. + * Helper function to send request used by the client + * @param method - method to use to send the request + * @param url - url to send the request to + * @param pipeline - pipeline with the policies to run when sending the request + * @param options - request options + * @param customHttpClient - a custom HttpClient to use when making the request + * @returns returns and HttpResponse */ -function appendToURLQuery(url, queryParts) { - const urlParsed = new URL(url); - let query = urlParsed.search; - if (query) { - query += "&" + queryParts; +async function sendRequest(method, url, pipeline, options = {}, customHttpClient) { + const httpClient = customHttpClient ?? (0, clientHelpers_js_1.getCachedDefaultHttpsClient)(); + const request = buildPipelineRequest(method, url, options); + try { + const response = await pipeline.sendRequest(httpClient, request); + const headers = response.headers.toJSON(); + const stream = response.readableStreamBody ?? response.browserStreamBody; + const parsedBody = options.responseAsStream || stream !== undefined ? undefined : getResponseBody(response); + const body = stream ?? parsedBody; + if (options?.onResponse) { + options.onResponse({ ...response, request, rawHeaders: headers, parsedBody }); + } + return { + request, + headers, + status: `${response.status}`, + body, + }; } - else { - query = queryParts; + catch (e) { + if ((0, restError_js_1.isRestError)(e) && e.response && options.onResponse) { + const { response } = e; + const rawHeaders = response.headers.toJSON(); + // UNBRANDED DIFFERENCE: onResponse callback does not have a second __legacyError property + options?.onResponse({ ...response, request, rawHeaders }, e); + } + throw e; } - urlParsed.search = query; - return urlParsed.toString(); } /** - * Rounds a date off to seconds. - * - * @param date - - * @param withMilliseconds - If true, YYYY-MM-DDThh:mm:ss.fffffffZ will be returned; - * If false, YYYY-MM-DDThh:mm:ssZ will be returned. - * @returns Date string in ISO8061 format, with or without 7 milliseconds component + * Function to determine the request content type + * @param options - request options InternalRequestParameters + * @returns returns the content-type */ -function truncatedISO8061Date(date, withMilliseconds = true) { - // Date.toISOString() will return like "2018-10-29T06:34:36.139Z" - const dateString = date.toISOString(); - return withMilliseconds - ? dateString.substring(0, dateString.length - 1) + "0000" + "Z" - : dateString.substring(0, dateString.length - 5) + "Z"; +function getRequestContentType(options = {}) { + return (options.contentType ?? + options.headers?.["content-type"] ?? + getContentType(options.body)); } /** - * Base64 encode. - * - * @param content - + * Function to determine the content-type of a body + * this is used if an explicit content-type is not provided + * @param body - body in the request + * @returns returns the content-type */ -function base64encode(content) { - return !core_util_1.isNodeLike ? btoa(content) : Buffer.from(content).toString("base64"); +function getContentType(body) { + if (ArrayBuffer.isView(body)) { + return "application/octet-stream"; + } + if (typeof body === "string") { + try { + JSON.parse(body); + return "application/json"; + } + catch (error) { + // If we fail to parse the body, it is not json + return undefined; + } + } + // By default return json + return "application/json"; } -/** - * Base64 decode. - * - * @param encodedString - - */ -function base64decode(encodedString) { - return !core_util_1.isNodeLike ? atob(encodedString) : Buffer.from(encodedString, "base64").toString(); +function buildPipelineRequest(method, url, options = {}) { + const requestContentType = getRequestContentType(options); + const { body, multipartBody } = getRequestBody(options.body, requestContentType); + const hasContent = body !== undefined || multipartBody !== undefined; + const headers = (0, httpHeaders_js_1.createHttpHeaders)({ + ...(options.headers ? options.headers : {}), + accept: options.accept ?? options.headers?.accept ?? "application/json", + ...(hasContent && + requestContentType && { + "content-type": requestContentType, + }), + }); + return (0, pipelineRequest_js_1.createPipelineRequest)({ + url, + method, + body, + multipartBody, + headers, + allowInsecureConnection: options.allowInsecureConnection, + abortSignal: options.abortSignal, + onUploadProgress: options.onUploadProgress, + onDownloadProgress: options.onDownloadProgress, + timeout: options.timeout, + enableBrowserStreams: true, + streamResponseStatusCodes: options.responseAsStream + ? new Set([Number.POSITIVE_INFINITY]) + : undefined, + }); } /** - * Generate a 64 bytes base64 block ID string. - * - * @param blockIndex - + * Prepares the body before sending the request */ -function generateBlockID(blockIDPrefix, blockIndex) { - // To generate a 64 bytes base64 string, source string should be 48 - const maxSourceStringLength = 48; - // A blob can have a maximum of 100,000 uncommitted blocks at any given time - const maxBlockIndexLength = 6; - const maxAllowedBlockIDPrefixLength = maxSourceStringLength - maxBlockIndexLength; - if (blockIDPrefix.length > maxAllowedBlockIDPrefixLength) { - blockIDPrefix = blockIDPrefix.slice(0, maxAllowedBlockIDPrefixLength); +function getRequestBody(body, contentType = "") { + if (body === undefined) { + return { body: undefined }; + } + if (typeof FormData !== "undefined" && body instanceof FormData) { + return { body }; + } + if ((0, typeGuards_js_1.isReadableStream)(body)) { + return { body }; + } + if (ArrayBuffer.isView(body)) { + return { body: body instanceof Uint8Array ? body : JSON.stringify(body) }; + } + const firstType = contentType.split(";")[0]; + switch (firstType) { + case "application/json": + return { body: JSON.stringify(body) }; + case "multipart/form-data": + if (Array.isArray(body)) { + return { multipartBody: (0, multipart_js_1.buildMultipartBody)(body) }; + } + return { body: JSON.stringify(body) }; + case "text/plain": + return { body: String(body) }; + default: + if (typeof body === "string") { + return { body }; + } + return { body: JSON.stringify(body) }; } - const res = blockIDPrefix + - padStart(blockIndex.toString(), maxSourceStringLength - blockIDPrefix.length, "0"); - return base64encode(res); } /** - * Delay specified time interval. - * - * @param timeInMs - - * @param aborter - - * @param abortError - + * Prepares the response body */ -async function delay(timeInMs, aborter, abortError) { - return new Promise((resolve, reject) => { - /* eslint-disable-next-line prefer-const */ - let timeout; - const abortHandler = () => { - if (timeout !== undefined) { - clearTimeout(timeout); - } - reject(abortError); - }; - const resolveHandler = () => { - if (aborter !== undefined) { - aborter.removeEventListener("abort", abortHandler); - } - resolve(); - }; - timeout = setTimeout(resolveHandler, timeInMs); - if (aborter !== undefined) { - aborter.addEventListener("abort", abortHandler); +function getResponseBody(response) { + // Set the default response type + const contentType = response.headers.get("content-type") ?? ""; + const firstType = contentType.split(";")[0]; + const bodyToParse = response.bodyAsText ?? ""; + if (firstType === "text/plain") { + return String(bodyToParse); + } + // Default to "application/json" and fallback to string; + try { + return bodyToParse ? JSON.parse(bodyToParse) : undefined; + } + catch (error) { + // If we were supposed to get a JSON object and failed to + // parse, throw a parse error + if (firstType === "application/json") { + throw createParseError(response, error); } + // We are not sure how to handle the response so we return it as + // plain text. + return String(bodyToParse); + } +} +function createParseError(response, err) { + const msg = `Error "${err}" occurred while parsing the response body - ${response.bodyAsText}.`; + const errCode = err.code ?? restError_js_1.RestError.PARSE_ERROR; + return new restError_js_1.RestError(msg, { + code: errCode, + statusCode: response.status, + request: response.request, + response: response, }); } +//# sourceMappingURL=sendRequest.js.map + +/***/ }), + +/***/ 91752: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.buildRequestUrl = buildRequestUrl; +exports.buildBaseUrl = buildBaseUrl; +exports.replaceAll = replaceAll; +function isQueryParameterWithOptions(x) { + const value = x.value; + return (value !== undefined && value.toString !== undefined && typeof value.toString === "function"); +} /** - * String.prototype.padStart() - * - * @param currentString - - * @param targetLength - - * @param padString - + * Builds the request url, filling in query and path parameters + * @param endpoint - base url which can be a template url + * @param routePath - path to append to the endpoint + * @param pathParameters - values of the path parameters + * @param options - request parameters including query parameters + * @returns a full url with path and query parameters */ -function padStart(currentString, targetLength, padString = " ") { - // @ts-expect-error: TS doesn't know this code needs to run downlevel sometimes - if (String.prototype.padStart) { - return currentString.padStart(targetLength, padString); +function buildRequestUrl(endpoint, routePath, pathParameters, options = {}) { + if (routePath.startsWith("https://") || routePath.startsWith("http://")) { + return routePath; } - padString = padString || " "; - if (currentString.length > targetLength) { - return currentString; + endpoint = buildBaseUrl(endpoint, options); + routePath = buildRoutePath(routePath, pathParameters, options); + const requestUrl = appendQueryParams(`${endpoint}/${routePath}`, options); + const url = new URL(requestUrl); + return (url + .toString() + // Remove double forward slashes + .replace(/([^:]\/)\/+/g, "$1")); +} +function getQueryParamValue(key, allowReserved, style, param) { + let separator; + if (style === "pipeDelimited") { + separator = "|"; + } + else if (style === "spaceDelimited") { + separator = "%20"; } else { - targetLength = targetLength - currentString.length; - if (targetLength > padString.length) { - padString += padString.repeat(targetLength / padString.length); - } - return padString.slice(0, targetLength) + currentString; + separator = ","; } -} -function sanitizeURL(url) { - let safeURL = url; - if (getURLParameter(safeURL, constants_js_1.URLConstants.Parameters.SIGNATURE)) { - safeURL = setURLParameter(safeURL, constants_js_1.URLConstants.Parameters.SIGNATURE, "*****"); + let paramValues; + if (Array.isArray(param)) { + paramValues = param; } - return safeURL; + else if (typeof param === "object" && param.toString === Object.prototype.toString) { + // If the parameter is an object without a custom toString implementation (e.g. a Date), + // then we should deconstruct the object into an array [key1, value1, key2, value2, ...]. + paramValues = Object.entries(param).flat(); + } + else { + paramValues = [param]; + } + const value = paramValues + .map((p) => { + if (p === null || p === undefined) { + return ""; + } + if (!p.toString || typeof p.toString !== "function") { + throw new Error(`Query parameters must be able to be represented as string, ${key} can't`); + } + const rawValue = p.toISOString !== undefined ? p.toISOString() : p.toString(); + return allowReserved ? rawValue : encodeURIComponent(rawValue); + }) + .join(separator); + return `${allowReserved ? key : encodeURIComponent(key)}=${value}`; } -function sanitizeHeaders(originalHeader) { - const headers = (0, core_rest_pipeline_1.createHttpHeaders)(); - for (const [name, value] of originalHeader) { - if (name.toLowerCase() === constants_js_1.HeaderConstants.AUTHORIZATION.toLowerCase()) { - headers.set(name, "*****"); +function appendQueryParams(url, options = {}) { + if (!options.queryParameters) { + return url; + } + const parsedUrl = new URL(url); + const queryParams = options.queryParameters; + const paramStrings = []; + for (const key of Object.keys(queryParams)) { + const param = queryParams[key]; + if (param === undefined || param === null) { + continue; } - else if (name.toLowerCase() === constants_js_1.HeaderConstants.X_MS_COPY_SOURCE) { - headers.set(name, sanitizeURL(value)); + const hasMetadata = isQueryParameterWithOptions(param); + const rawValue = hasMetadata ? param.value : param; + const explode = hasMetadata ? (param.explode ?? false) : false; + const style = hasMetadata && param.style ? param.style : "form"; + if (explode) { + if (Array.isArray(rawValue)) { + for (const item of rawValue) { + paramStrings.push(getQueryParamValue(key, options.skipUrlEncoding ?? false, style, item)); + } + } + else if (typeof rawValue === "object") { + // For object explode, the name of the query parameter is ignored and we use the object key instead + for (const [actualKey, value] of Object.entries(rawValue)) { + paramStrings.push(getQueryParamValue(actualKey, options.skipUrlEncoding ?? false, style, value)); + } + } + else { + // Explode doesn't really make sense for primitives + throw new Error("explode can only be set to true for objects and arrays"); + } } else { - headers.set(name, value); + paramStrings.push(getQueryParamValue(key, options.skipUrlEncoding ?? false, style, rawValue)); } } - return headers; -} -/** - * If two strings are equal when compared case insensitive. - * - * @param str1 - - * @param str2 - - */ -function iEqual(str1, str2) { - return str1.toLocaleLowerCase() === str2.toLocaleLowerCase(); + if (parsedUrl.search !== "") { + parsedUrl.search += "&"; + } + parsedUrl.search += paramStrings.join("&"); + return parsedUrl.toString(); } -/** - * Extracts account name from the url - * @param url - url to extract the account name from - * @returns with the account name - */ -function getAccountNameFromUrl(url) { - const parsedUrl = new URL(url); - let accountName; - try { - if (parsedUrl.hostname.split(".")[1] === "blob") { - // `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`; - accountName = parsedUrl.hostname.split(".")[0]; +function buildBaseUrl(endpoint, options) { + if (!options.pathParameters) { + return endpoint; + } + const pathParams = options.pathParameters; + for (const [key, param] of Object.entries(pathParams)) { + if (param === undefined || param === null) { + throw new Error(`Path parameters ${key} must not be undefined or null`); } - else if (isIpEndpointStyle(parsedUrl)) { - // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/ - // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/ - // .getPath() -> /devstoreaccount1/ - accountName = parsedUrl.pathname.split("/")[1]; + if (!param.toString || typeof param.toString !== "function") { + throw new Error(`Path parameters must be able to be represented as string, ${key} can't`); } - else { - // Custom domain case: "https://customdomain.com/containername/blob". - accountName = ""; + let value = param.toISOString !== undefined ? param.toISOString() : String(param); + if (!options.skipUrlEncoding) { + value = encodeURIComponent(param); } - return accountName; - } - catch (error) { - throw new Error("Unable to extract accountName with provided information."); + endpoint = replaceAll(endpoint, `{${key}}`, value) ?? ""; } + return endpoint; } -function isIpEndpointStyle(parsedUrl) { - const host = parsedUrl.host; - // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'. - // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part. - // Case 3: Ipv4, use broad regex which just check if host contains Ipv4. - // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html. - return (/^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) || - (Boolean(parsedUrl.port) && constants_js_1.PathStylePorts.includes(parsedUrl.port))); +function buildRoutePath(routePath, pathParameters, options = {}) { + for (const pathParam of pathParameters) { + const allowReserved = typeof pathParam === "object" && (pathParam.allowReserved ?? false); + let value = typeof pathParam === "object" ? pathParam.value : pathParam; + if (!options.skipUrlEncoding && !allowReserved) { + value = encodeURIComponent(value); + } + routePath = routePath.replace(/\{[\w-]+\}/, String(value)); + } + return routePath; } /** - * Attach a TokenCredential to an object. - * - * @param thing - - * @param credential - + * Replace all of the instances of searchValue in value with the provided replaceValue. + * @param value - The value to search and replace in. + * @param searchValue - The value to search for in the value argument. + * @param replaceValue - The value to replace searchValue with in the value argument. + * @returns The value where each instance of searchValue was replaced with replacedValue. */ -function attachCredential(thing, credential) { - thing.credential = credential; - return thing; -} -function httpAuthorizationToString(httpAuthorization) { - return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined; +function replaceAll(value, searchValue, replaceValue) { + return !value || !searchValue ? value : value.split(searchValue).join(replaceValue || ""); } +//# sourceMappingURL=urlHelpers.js.map + +/***/ }), + +/***/ 58463: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DEFAULT_RETRY_POLICY_COUNT = exports.SDK_VERSION = void 0; +exports.SDK_VERSION = "0.3.2"; +exports.DEFAULT_RETRY_POLICY_COUNT = 3; +//# sourceMappingURL=constants.js.map + +/***/ }), + +/***/ 97239: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createPipelineFromOptions = createPipelineFromOptions; +const logPolicy_js_1 = __nccwpck_require__(71610); +const pipeline_js_1 = __nccwpck_require__(34744); +const redirectPolicy_js_1 = __nccwpck_require__(45125); +const userAgentPolicy_js_1 = __nccwpck_require__(35402); +const decompressResponsePolicy_js_1 = __nccwpck_require__(74162); +const defaultRetryPolicy_js_1 = __nccwpck_require__(20297); +const formDataPolicy_js_1 = __nccwpck_require__(51393); +const checkEnvironment_js_1 = __nccwpck_require__(94121); +const proxyPolicy_js_1 = __nccwpck_require__(57954); +const agentPolicy_js_1 = __nccwpck_require__(73398); +const tlsPolicy_js_1 = __nccwpck_require__(24655); +const multipartPolicy_js_1 = __nccwpck_require__(95316); /** - * Escape the blobName but keep path separator ('/'). + * Create a new pipeline with a default set of customizable policies. + * @param options - Options to configure a custom pipeline. */ -function EscapePath(blobName) { - const split = blobName.split("/"); - for (let i = 0; i < split.length; i++) { - split[i] = encodeURIComponent(split[i]); +function createPipelineFromOptions(options) { + const pipeline = (0, pipeline_js_1.createEmptyPipeline)(); + if (checkEnvironment_js_1.isNodeLike) { + if (options.agent) { + pipeline.addPolicy((0, agentPolicy_js_1.agentPolicy)(options.agent)); + } + if (options.tlsOptions) { + pipeline.addPolicy((0, tlsPolicy_js_1.tlsPolicy)(options.tlsOptions)); + } + pipeline.addPolicy((0, proxyPolicy_js_1.proxyPolicy)(options.proxyOptions)); + pipeline.addPolicy((0, decompressResponsePolicy_js_1.decompressResponsePolicy)()); } - return split.join("/"); + pipeline.addPolicy((0, formDataPolicy_js_1.formDataPolicy)(), { beforePolicies: [multipartPolicy_js_1.multipartPolicyName] }); + pipeline.addPolicy((0, userAgentPolicy_js_1.userAgentPolicy)(options.userAgentOptions)); + // The multipart policy is added after policies with no phase, so that + // policies can be added between it and formDataPolicy to modify + // properties (e.g., making the boundary constant in recorded tests). + pipeline.addPolicy((0, multipartPolicy_js_1.multipartPolicy)(), { afterPhase: "Deserialize" }); + pipeline.addPolicy((0, defaultRetryPolicy_js_1.defaultRetryPolicy)(options.retryOptions), { phase: "Retry" }); + if (checkEnvironment_js_1.isNodeLike) { + // Both XHR and Fetch expect to handle redirects automatically, + // so only include this policy when we're in Node. + pipeline.addPolicy((0, redirectPolicy_js_1.redirectPolicy)(options.redirectOptions), { afterPhase: "Retry" }); + } + pipeline.addPolicy((0, logPolicy_js_1.logPolicy)(options.loggingOptions), { afterPhase: "Sign" }); + return pipeline; } +//# sourceMappingURL=createPipelineFromOptions.js.map + +/***/ }), + +/***/ 42917: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createDefaultHttpClient = createDefaultHttpClient; +const nodeHttpClient_js_1 = __nccwpck_require__(63098); /** - * A typesafe helper for ensuring that a given response object has - * the original _response attached. - * @param response - A response object from calling a client operation - * @returns The same object, but with known _response property + * Create the correct HttpClient for the current environment. */ -function assertResponse(response) { - if (`_response` in response) { - return response; - } - throw new TypeError(`Unexpected response object ${response}`); +function createDefaultHttpClient() { + return (0, nodeHttpClient_js_1.createNodeHttpClient)(); } -//# sourceMappingURL=utils.common.js.map +//# sourceMappingURL=defaultHttpClient.js.map /***/ }), -/***/ 81577: +/***/ 66816: /***/ ((__unused_webpack_module, exports) => { "use strict"; // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AbortError = void 0; +exports.createHttpHeaders = createHttpHeaders; +function normalizeName(name) { + return name.toLowerCase(); +} +function* headerIterator(map) { + for (const entry of map.values()) { + yield [entry.name, entry.value]; + } +} +class HttpHeadersImpl { + _headersMap; + constructor(rawHeaders) { + this._headersMap = new Map(); + if (rawHeaders) { + for (const headerName of Object.keys(rawHeaders)) { + this.set(headerName, rawHeaders[headerName]); + } + } + } + /** + * Set a header in this collection with the provided name and value. The name is + * case-insensitive. + * @param name - The name of the header to set. This value is case-insensitive. + * @param value - The value of the header to set. + */ + set(name, value) { + this._headersMap.set(normalizeName(name), { name, value: String(value).trim() }); + } + /** + * Get the header value for the provided header name, or undefined if no header exists in this + * collection with the provided name. + * @param name - The name of the header. This value is case-insensitive. + */ + get(name) { + return this._headersMap.get(normalizeName(name))?.value; + } + /** + * Get whether or not this header collection contains a header entry for the provided header name. + * @param name - The name of the header to set. This value is case-insensitive. + */ + has(name) { + return this._headersMap.has(normalizeName(name)); + } + /** + * Remove the header with the provided headerName. + * @param name - The name of the header to remove. + */ + delete(name) { + this._headersMap.delete(normalizeName(name)); + } + /** + * Get the JSON object representation of this HTTP header collection. + */ + toJSON(options = {}) { + const result = {}; + if (options.preserveCase) { + for (const entry of this._headersMap.values()) { + result[entry.name] = entry.value; + } + } + else { + for (const [normalizedName, entry] of this._headersMap) { + result[normalizedName] = entry.value; + } + } + return result; + } + /** + * Get the string representation of this HTTP header collection. + */ + toString() { + return JSON.stringify(this.toJSON({ preserveCase: true })); + } + /** + * Iterate over tuples of header [name, value] pairs. + */ + [Symbol.iterator]() { + return headerIterator(this._headersMap); + } +} /** - * This error is thrown when an asynchronous operation has been aborted. - * Check for this error by testing the `name` that the name property of the - * error matches `"AbortError"`. - * - * @example - * ```ts - * const controller = new AbortController(); - * controller.abort(); - * try { - * doAsyncWork(controller.signal) - * } catch (e) { - * if (e.name === 'AbortError') { - * // handle abort error here. - * } - * } - * ``` + * Creates an object that satisfies the `HttpHeaders` interface. + * @param rawHeaders - A simple object representing initial headers */ -class AbortError extends Error { - constructor(message) { - super(message); - this.name = "AbortError"; - } +function createHttpHeaders(rawHeaders) { + return new HttpHeadersImpl(rawHeaders); } -exports.AbortError = AbortError; -//# sourceMappingURL=AbortError.js.map +//# sourceMappingURL=httpHeaders.js.map /***/ }), -/***/ 31514: +/***/ 83335: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AbortError = void 0; -var AbortError_js_1 = __nccwpck_require__(81577); +exports.createRestError = exports.operationOptionsToRequestParameters = exports.getClient = exports.createDefaultHttpClient = exports.uint8ArrayToString = exports.stringToUint8Array = exports.isRestError = exports.RestError = exports.createEmptyPipeline = exports.createPipelineRequest = exports.createHttpHeaders = exports.TypeSpecRuntimeLogger = exports.setLogLevel = exports.getLogLevel = exports.createClientLogger = exports.AbortError = void 0; +const tslib_1 = __nccwpck_require__(4351); +var AbortError_js_1 = __nccwpck_require__(72033); Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } })); +var logger_js_1 = __nccwpck_require__(36720); +Object.defineProperty(exports, "createClientLogger", ({ enumerable: true, get: function () { return logger_js_1.createClientLogger; } })); +Object.defineProperty(exports, "getLogLevel", ({ enumerable: true, get: function () { return logger_js_1.getLogLevel; } })); +Object.defineProperty(exports, "setLogLevel", ({ enumerable: true, get: function () { return logger_js_1.setLogLevel; } })); +Object.defineProperty(exports, "TypeSpecRuntimeLogger", ({ enumerable: true, get: function () { return logger_js_1.TypeSpecRuntimeLogger; } })); +var httpHeaders_js_1 = __nccwpck_require__(66816); +Object.defineProperty(exports, "createHttpHeaders", ({ enumerable: true, get: function () { return httpHeaders_js_1.createHttpHeaders; } })); +tslib_1.__exportStar(__nccwpck_require__(65546), exports); +tslib_1.__exportStar(__nccwpck_require__(38018), exports); +var pipelineRequest_js_1 = __nccwpck_require__(47983); +Object.defineProperty(exports, "createPipelineRequest", ({ enumerable: true, get: function () { return pipelineRequest_js_1.createPipelineRequest; } })); +var pipeline_js_1 = __nccwpck_require__(34744); +Object.defineProperty(exports, "createEmptyPipeline", ({ enumerable: true, get: function () { return pipeline_js_1.createEmptyPipeline; } })); +var restError_js_1 = __nccwpck_require__(42858); +Object.defineProperty(exports, "RestError", ({ enumerable: true, get: function () { return restError_js_1.RestError; } })); +Object.defineProperty(exports, "isRestError", ({ enumerable: true, get: function () { return restError_js_1.isRestError; } })); +var bytesEncoding_js_1 = __nccwpck_require__(88943); +Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } })); +Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } })); +var defaultHttpClient_js_1 = __nccwpck_require__(42917); +Object.defineProperty(exports, "createDefaultHttpClient", ({ enumerable: true, get: function () { return defaultHttpClient_js_1.createDefaultHttpClient; } })); +var getClient_js_1 = __nccwpck_require__(15714); +Object.defineProperty(exports, "getClient", ({ enumerable: true, get: function () { return getClient_js_1.getClient; } })); +var operationOptionHelpers_js_1 = __nccwpck_require__(16857); +Object.defineProperty(exports, "operationOptionsToRequestParameters", ({ enumerable: true, get: function () { return operationOptionHelpers_js_1.operationOptionsToRequestParameters; } })); +var restError_js_2 = __nccwpck_require__(24193); +Object.defineProperty(exports, "createRestError", ({ enumerable: true, get: function () { return restError_js_2.createRestError; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 92960: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 85930: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.logger = void 0; +const logger_js_1 = __nccwpck_require__(36720); +exports.logger = (0, logger_js_1.createClientLogger)("ts-http-runtime"); +//# sourceMappingURL=log.js.map -const WritableStream = (__nccwpck_require__(84492).Writable) -const inherits = (__nccwpck_require__(47261).inherits) - -const StreamSearch = __nccwpck_require__(51142) - -const PartStream = __nccwpck_require__(81620) -const HeaderParser = __nccwpck_require__(92032) - -const DASH = 45 -const B_ONEDASH = Buffer.from('-') -const B_CRLF = Buffer.from('\r\n') -const EMPTY_FN = function () {} - -function Dicer (cfg) { - if (!(this instanceof Dicer)) { return new Dicer(cfg) } - WritableStream.call(this, cfg) - - if (!cfg || (!cfg.headerFirst && typeof cfg.boundary !== 'string')) { throw new TypeError('Boundary required') } - - if (typeof cfg.boundary === 'string') { this.setBoundary(cfg.boundary) } else { this._bparser = undefined } +/***/ }), - this._headerFirst = cfg.headerFirst +/***/ 34907: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - this._dashes = 0 - this._parts = 0 - this._finished = false - this._realFinish = false - this._isPreamble = true - this._justMatched = false - this._firstWrite = true - this._inHeader = true - this._part = undefined - this._cb = undefined - this._ignoreData = false - this._partOpts = { highWaterMark: cfg.partHwm } - this._pause = false +"use strict"; - const self = this - this._hparser = new HeaderParser(cfg) - this._hparser.on('header', function (header) { - self._inHeader = false - self._part.emit('header', header) - }) +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +const log_js_1 = __nccwpck_require__(57792); +const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined; +let enabledString; +let enabledNamespaces = []; +let skippedNamespaces = []; +const debuggers = []; +if (debugEnvVariable) { + enable(debugEnvVariable); } -inherits(Dicer, WritableStream) - -Dicer.prototype.emit = function (ev) { - if (ev === 'finish' && !this._realFinish) { - if (!this._finished) { - const self = this - process.nextTick(function () { - self.emit('error', new Error('Unexpected end of multipart data')) - if (self._part && !self._ignoreData) { - const type = (self._isPreamble ? 'Preamble' : 'Part') - self._part.emit('error', new Error(type + ' terminated early due to unexpected end of multipart data')) - self._part.push(null) - process.nextTick(function () { - self._realFinish = true - self.emit('finish') - self._realFinish = false - }) - return +const debugObj = Object.assign((namespace) => { + return createDebugger(namespace); +}, { + enable, + enabled, + disable, + log: log_js_1.log, +}); +function enable(namespaces) { + enabledString = namespaces; + enabledNamespaces = []; + skippedNamespaces = []; + const namespaceList = namespaces.split(",").map((ns) => ns.trim()); + for (const ns of namespaceList) { + if (ns.startsWith("-")) { + skippedNamespaces.push(ns.substring(1)); + } + else { + enabledNamespaces.push(ns); } - self._realFinish = true - self.emit('finish') - self._realFinish = false - }) } - } else { WritableStream.prototype.emit.apply(this, arguments) } -} - -Dicer.prototype._write = function (data, encoding, cb) { - // ignore unexpected data (e.g. extra trailer data after finished) - if (!this._hparser && !this._bparser) { return cb() } - - if (this._headerFirst && this._isPreamble) { - if (!this._part) { - this._part = new PartStream(this._partOpts) - if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } + for (const instance of debuggers) { + instance.enabled = enabled(instance.namespace); } - const r = this._hparser.push(data) - if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } - } - - // allows for "easier" testing - if (this._firstWrite) { - this._bparser.push(B_CRLF) - this._firstWrite = false - } - - this._bparser.push(data) - - if (this._pause) { this._cb = cb } else { cb() } -} - -Dicer.prototype.reset = function () { - this._part = undefined - this._bparser = undefined - this._hparser = undefined -} - -Dicer.prototype.setBoundary = function (boundary) { - const self = this - this._bparser = new StreamSearch('\r\n--' + boundary) - this._bparser.on('info', function (isMatch, data, start, end) { - self._oninfo(isMatch, data, start, end) - }) -} - -Dicer.prototype._ignore = function () { - if (this._part && !this._ignoreData) { - this._ignoreData = true - this._part.on('error', EMPTY_FN) - // we must perform some kind of read on the stream even though we are - // ignoring the data, otherwise node's Readable stream will not emit 'end' - // after pushing null to the stream - this._part.resume() - } } - -Dicer.prototype._oninfo = function (isMatch, data, start, end) { - let buf; const self = this; let i = 0; let r; let shouldWriteMore = true - - if (!this._part && this._justMatched && data) { - while (this._dashes < 2 && (start + i) < end) { - if (data[start + i] === DASH) { - ++i - ++this._dashes - } else { - if (this._dashes) { buf = B_ONEDASH } - this._dashes = 0 - break - } +function enabled(namespace) { + if (namespace.endsWith("*")) { + return true; } - if (this._dashes === 2) { - if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } - this.reset() - this._finished = true - // no more parts will be added - if (self._parts === 0) { - self._realFinish = true - self.emit('finish') - self._realFinish = false - } + for (const skipped of skippedNamespaces) { + if (namespaceMatches(namespace, skipped)) { + return false; + } } - if (this._dashes) { return } - } - if (this._justMatched) { this._justMatched = false } - if (!this._part) { - this._part = new PartStream(this._partOpts) - this._part._read = function (n) { - self._unpause() + for (const enabledNamespace of enabledNamespaces) { + if (namespaceMatches(namespace, enabledNamespace)) { + return true; + } } - if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } - if (!this._isPreamble) { this._inHeader = true } - } - if (data && start < end && !this._ignoreData) { - if (this._isPreamble || !this._inHeader) { - if (buf) { shouldWriteMore = this._part.push(buf) } - shouldWriteMore = this._part.push(data.slice(start, end)) - if (!shouldWriteMore) { this._pause = true } - } else if (!this._isPreamble && this._inHeader) { - if (buf) { this._hparser.push(buf) } - r = this._hparser.push(data.slice(start, end)) - if (!this._inHeader && r !== undefined && r < end) { this._oninfo(false, data, start + r, end) } + return false; +} +/** + * Given a namespace, check if it matches a pattern. + * Patterns only have a single wildcard character which is *. + * The behavior of * is that it matches zero or more other characters. + */ +function namespaceMatches(namespace, patternToMatch) { + // simple case, no pattern matching required + if (patternToMatch.indexOf("*") === -1) { + return namespace === patternToMatch; } - } - if (isMatch) { - this._hparser.reset() - if (this._isPreamble) { this._isPreamble = false } else { - if (start !== end) { - ++this._parts - this._part.on('end', function () { - if (--self._parts === 0) { - if (self._finished) { - self._realFinish = true - self.emit('finish') - self._realFinish = false - } else { - self._unpause() + let pattern = patternToMatch; + // normalize successive * if needed + if (patternToMatch.indexOf("**") !== -1) { + const patternParts = []; + let lastCharacter = ""; + for (const character of patternToMatch) { + if (character === "*" && lastCharacter === "*") { + continue; } - } - }) - } + else { + lastCharacter = character; + patternParts.push(character); + } + } + pattern = patternParts.join(""); } - this._part.push(null) - this._part = undefined - this._ignoreData = false - this._justMatched = true - this._dashes = 0 - } -} - -Dicer.prototype._unpause = function () { - if (!this._pause) { return } - - this._pause = false - if (this._cb) { - const cb = this._cb - this._cb = undefined - cb() - } -} - -module.exports = Dicer - - -/***/ }), - -/***/ 92032: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const EventEmitter = (__nccwpck_require__(15673).EventEmitter) -const inherits = (__nccwpck_require__(47261).inherits) -const getLimit = __nccwpck_require__(21467) - -const StreamSearch = __nccwpck_require__(51142) - -const B_DCRLF = Buffer.from('\r\n\r\n') -const RE_CRLF = /\r\n/g -const RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/ // eslint-disable-line no-control-regex - -function HeaderParser (cfg) { - EventEmitter.call(this) - - cfg = cfg || {} - const self = this - this.nread = 0 - this.maxed = false - this.npairs = 0 - this.maxHeaderPairs = getLimit(cfg, 'maxHeaderPairs', 2000) - this.maxHeaderSize = getLimit(cfg, 'maxHeaderSize', 80 * 1024) - this.buffer = '' - this.header = {} - this.finished = false - this.ss = new StreamSearch(B_DCRLF) - this.ss.on('info', function (isMatch, data, start, end) { - if (data && !self.maxed) { - if (self.nread + end - start >= self.maxHeaderSize) { - end = self.maxHeaderSize - self.nread + start - self.nread = self.maxHeaderSize - self.maxed = true - } else { self.nread += (end - start) } - - self.buffer += data.toString('binary', start, end) + let namespaceIndex = 0; + let patternIndex = 0; + const patternLength = pattern.length; + const namespaceLength = namespace.length; + let lastWildcard = -1; + let lastWildcardNamespace = -1; + while (namespaceIndex < namespaceLength && patternIndex < patternLength) { + if (pattern[patternIndex] === "*") { + lastWildcard = patternIndex; + patternIndex++; + if (patternIndex === patternLength) { + // if wildcard is the last character, it will match the remaining namespace string + return true; + } + // now we let the wildcard eat characters until we match the next literal in the pattern + while (namespace[namespaceIndex] !== pattern[patternIndex]) { + namespaceIndex++; + // reached the end of the namespace without a match + if (namespaceIndex === namespaceLength) { + return false; + } + } + // now that we have a match, let's try to continue on + // however, it's possible we could find a later match + // so keep a reference in case we have to backtrack + lastWildcardNamespace = namespaceIndex; + namespaceIndex++; + patternIndex++; + continue; + } + else if (pattern[patternIndex] === namespace[namespaceIndex]) { + // simple case: literal pattern matches so keep going + patternIndex++; + namespaceIndex++; + } + else if (lastWildcard >= 0) { + // special case: we don't have a literal match, but there is a previous wildcard + // which we can backtrack to and try having the wildcard eat the match instead + patternIndex = lastWildcard + 1; + namespaceIndex = lastWildcardNamespace + 1; + // we've reached the end of the namespace without a match + if (namespaceIndex === namespaceLength) { + return false; + } + // similar to the previous logic, let's keep going until we find the next literal match + while (namespace[namespaceIndex] !== pattern[patternIndex]) { + namespaceIndex++; + if (namespaceIndex === namespaceLength) { + return false; + } + } + lastWildcardNamespace = namespaceIndex; + namespaceIndex++; + patternIndex++; + continue; + } + else { + return false; + } } - if (isMatch) { self._finish() } - }) -} -inherits(HeaderParser, EventEmitter) - -HeaderParser.prototype.push = function (data) { - const r = this.ss.push(data) - if (this.finished) { return r } -} - -HeaderParser.prototype.reset = function () { - this.finished = false - this.buffer = '' - this.header = {} - this.ss.reset() + const namespaceDone = namespaceIndex === namespace.length; + const patternDone = patternIndex === pattern.length; + // this is to detect the case of an unneeded final wildcard + // e.g. the pattern `ab*` should match the string `ab` + const trailingWildCard = patternIndex === pattern.length - 1 && pattern[patternIndex] === "*"; + return namespaceDone && (patternDone || trailingWildCard); } - -HeaderParser.prototype._finish = function () { - if (this.buffer) { this._parseHeader() } - this.ss.matches = this.ss.maxMatches - const header = this.header - this.header = {} - this.buffer = '' - this.finished = true - this.nread = this.npairs = 0 - this.maxed = false - this.emit('header', header) +function disable() { + const result = enabledString || ""; + enable(""); + return result; } - -HeaderParser.prototype._parseHeader = function () { - if (this.npairs === this.maxHeaderPairs) { return } - - const lines = this.buffer.split(RE_CRLF) - const len = lines.length - let m, h - - for (var i = 0; i < len; ++i) { // eslint-disable-line no-var - if (lines[i].length === 0) { continue } - if (lines[i][0] === '\t' || lines[i][0] === ' ') { - // folded header content - // RFC2822 says to just remove the CRLF and not the whitespace following - // it, so we follow the RFC and include the leading whitespace ... - if (h) { - this.header[h][this.header[h].length - 1] += lines[i] - continue - } +function createDebugger(namespace) { + const newDebugger = Object.assign(debug, { + enabled: enabled(namespace), + destroy, + log: debugObj.log, + namespace, + extend, + }); + function debug(...args) { + if (!newDebugger.enabled) { + return; + } + if (args.length > 0) { + args[0] = `${namespace} ${args[0]}`; + } + newDebugger.log(...args); } - - const posColon = lines[i].indexOf(':') - if ( - posColon === -1 || - posColon === 0 - ) { - return + debuggers.push(newDebugger); + return newDebugger; +} +function destroy() { + const index = debuggers.indexOf(this); + if (index >= 0) { + debuggers.splice(index, 1); + return true; } - m = RE_HDR.exec(lines[i]) - h = m[1].toLowerCase() - this.header[h] = this.header[h] || [] - this.header[h].push((m[2] || '')) - if (++this.npairs === this.maxHeaderPairs) { break } - } + return false; } - -module.exports = HeaderParser - +function extend(namespace) { + const newDebugger = createDebugger(`${this.namespace}:${namespace}`); + newDebugger.log = this.log; + return newDebugger; +} +exports["default"] = debugObj; +//# sourceMappingURL=debug.js.map /***/ }), -/***/ 81620: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 46244: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const inherits = (__nccwpck_require__(47261).inherits) -const ReadableStream = (__nccwpck_require__(84492).Readable) - -function PartStream (opts) { - ReadableStream.call(this, opts) -} -inherits(PartStream, ReadableStream) - -PartStream.prototype._read = function (n) {} - -module.exports = PartStream - +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createLoggerContext = void 0; +var logger_js_1 = __nccwpck_require__(36720); +Object.defineProperty(exports, "createLoggerContext", ({ enumerable: true, get: function () { return logger_js_1.createLoggerContext; } })); +//# sourceMappingURL=internal.js.map /***/ }), -/***/ 51142: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 57792: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.log = log; +const tslib_1 = __nccwpck_require__(4351); +const node_os_1 = __nccwpck_require__(70612); +const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(47261)); +const node_process_1 = tslib_1.__importDefault(__nccwpck_require__(97742)); +function log(message, ...args) { + node_process_1.default.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`); +} +//# sourceMappingURL=log.js.map -/** - * Copyright Brian White. All rights reserved. - * - * @see https://github.com/mscdex/streamsearch - * - * 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. - * - * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation - * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool - */ -const EventEmitter = (__nccwpck_require__(15673).EventEmitter) -const inherits = (__nccwpck_require__(47261).inherits) - -function SBMH (needle) { - if (typeof needle === 'string') { - needle = Buffer.from(needle) - } - - if (!Buffer.isBuffer(needle)) { - throw new TypeError('The needle has to be a String or a Buffer.') - } - - const needleLength = needle.length - - if (needleLength === 0) { - throw new Error('The needle cannot be an empty String/Buffer.') - } - - if (needleLength > 256) { - throw new Error('The needle cannot have a length bigger than 256.') - } - - this.maxMatches = Infinity - this.matches = 0 - - this._occ = new Array(256) - .fill(needleLength) // Initialize occurrence table. - this._lookbehind_size = 0 - this._needle = needle - this._bufpos = 0 +/***/ }), - this._lookbehind = Buffer.alloc(needleLength) +/***/ 36720: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - // Populate occurrence table with analysis of the needle, - // ignoring last letter. - for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var - this._occ[needle[i]] = needleLength - 1 - i - } -} -inherits(SBMH, EventEmitter) +"use strict"; -SBMH.prototype.reset = function () { - this._lookbehind_size = 0 - this.matches = 0 - this._bufpos = 0 +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TypeSpecRuntimeLogger = void 0; +exports.createLoggerContext = createLoggerContext; +exports.setLogLevel = setLogLevel; +exports.getLogLevel = getLogLevel; +exports.createClientLogger = createClientLogger; +const tslib_1 = __nccwpck_require__(4351); +const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(34907)); +const TYPESPEC_RUNTIME_LOG_LEVELS = ["verbose", "info", "warning", "error"]; +const levelMap = { + verbose: 400, + info: 300, + warning: 200, + error: 100, +}; +function patchLogMethod(parent, child) { + child.log = (...args) => { + parent.log(...args); + }; } - -SBMH.prototype.push = function (chunk, pos) { - if (!Buffer.isBuffer(chunk)) { - chunk = Buffer.from(chunk, 'binary') - } - const chlen = chunk.length - this._bufpos = pos || 0 - let r - while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) } - return r +function isTypeSpecRuntimeLogLevel(level) { + return TYPESPEC_RUNTIME_LOG_LEVELS.includes(level); } - -SBMH.prototype._sbmh_feed = function (data) { - const len = data.length - const needle = this._needle - const needleLength = needle.length - const lastNeedleChar = needle[needleLength - 1] - - // Positive: points to a position in `data` - // pos == 3 points to data[3] - // Negative: points to a position in the lookbehind buffer - // pos == -2 points to lookbehind[lookbehind_size - 2] - let pos = -this._lookbehind_size - let ch - - if (pos < 0) { - // Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool - // search with character lookup code that considers both the - // lookbehind buffer and the current round's haystack data. - // - // Loop until - // there is a match. - // or until - // we've moved past the position that requires the - // lookbehind buffer. In this case we switch to the - // optimized loop. - // or until - // the character to look at lies outside the haystack. - while (pos < 0 && pos <= len - needleLength) { - ch = this._sbmh_lookup_char(data, pos + needleLength - 1) - - if ( - ch === lastNeedleChar && - this._sbmh_memcmp(data, pos, needleLength - 1) - ) { - this._lookbehind_size = 0 - ++this.matches - this.emit('info', true) - - return (this._bufpos = pos + needleLength) - } - pos += this._occ[ch] +/** + * Creates a logger context base on the provided options. + * @param options - The options for creating a logger context. + * @returns The logger context. + */ +function createLoggerContext(options) { + const registeredLoggers = new Set(); + const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env[options.logLevelEnvVarName]) || + undefined; + let logLevel; + const clientLogger = (0, debug_js_1.default)(options.namespace); + clientLogger.log = (...args) => { + debug_js_1.default.log(...args); + }; + function contextSetLogLevel(level) { + if (level && !isTypeSpecRuntimeLogLevel(level)) { + throw new Error(`Unknown log level '${level}'. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(",")}`); + } + logLevel = level; + const enabledNamespaces = []; + for (const logger of registeredLoggers) { + if (shouldEnable(logger)) { + enabledNamespaces.push(logger.namespace); + } + } + debug_js_1.default.enable(enabledNamespaces.join(",")); } - - // No match. - - if (pos < 0) { - // There's too few data for Boyer-Moore-Horspool to run, - // so let's use a different algorithm to skip as much as - // we can. - // Forward pos until - // the trailing part of lookbehind + data - // looks like the beginning of the needle - // or until - // pos == 0 - while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos } + if (logLevelFromEnv) { + // avoid calling setLogLevel because we don't want a mis-set environment variable to crash + if (isTypeSpecRuntimeLogLevel(logLevelFromEnv)) { + contextSetLogLevel(logLevelFromEnv); + } + else { + console.error(`${options.logLevelEnvVarName} set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(", ")}.`); + } } - - if (pos >= 0) { - // Discard lookbehind buffer. - this.emit('info', false, this._lookbehind, 0, this._lookbehind_size) - this._lookbehind_size = 0 - } else { - // Cut off part of the lookbehind buffer that has - // been processed and append the entire haystack - // into it. - const bytesToCutOff = this._lookbehind_size + pos - if (bytesToCutOff > 0) { - // The cut off data is guaranteed not to contain the needle. - this.emit('info', false, this._lookbehind, 0, bytesToCutOff) - } - - this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff, - this._lookbehind_size - bytesToCutOff) - this._lookbehind_size -= bytesToCutOff - - data.copy(this._lookbehind, this._lookbehind_size) - this._lookbehind_size += len - - this._bufpos = len - return len + function shouldEnable(logger) { + return Boolean(logLevel && levelMap[logger.level] <= levelMap[logLevel]); } - } - - pos += (pos >= 0) * this._bufpos - - // Lookbehind buffer is now empty. We only need to check if the - // needle is in the haystack. - if (data.indexOf(needle, pos) !== -1) { - pos = data.indexOf(needle, pos) - ++this.matches - if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) } - - return (this._bufpos = pos + needleLength) - } else { - pos = len - needleLength - } - - // There was no match. If there's trailing haystack data that we cannot - // match yet using the Boyer-Moore-Horspool algorithm (because the trailing - // data is less than the needle size) then match using a modified - // algorithm that starts matching from the beginning instead of the end. - // Whatever trailing data is left after running this algorithm is added to - // the lookbehind buffer. - while ( - pos < len && - ( - data[pos] !== needle[0] || - ( - (Buffer.compare( - data.subarray(pos, pos + len - pos), - needle.subarray(0, len - pos) - ) !== 0) - ) - ) - ) { - ++pos - } - if (pos < len) { - data.copy(this._lookbehind, 0, pos, pos + (len - pos)) - this._lookbehind_size = len - pos - } - - // Everything until pos is guaranteed not to contain needle data. - if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) } - - this._bufpos = len - return len + function createLogger(parent, level) { + const logger = Object.assign(parent.extend(level), { + level, + }); + patchLogMethod(parent, logger); + if (shouldEnable(logger)) { + const enabledNamespaces = debug_js_1.default.disable(); + debug_js_1.default.enable(enabledNamespaces + "," + logger.namespace); + } + registeredLoggers.add(logger); + return logger; + } + function contextGetLogLevel() { + return logLevel; + } + function contextCreateClientLogger(namespace) { + const clientRootLogger = clientLogger.extend(namespace); + patchLogMethod(clientLogger, clientRootLogger); + return { + error: createLogger(clientRootLogger, "error"), + warning: createLogger(clientRootLogger, "warning"), + info: createLogger(clientRootLogger, "info"), + verbose: createLogger(clientRootLogger, "verbose"), + }; + } + return { + setLogLevel: contextSetLogLevel, + getLogLevel: contextGetLogLevel, + createClientLogger: contextCreateClientLogger, + logger: clientLogger, + }; } - -SBMH.prototype._sbmh_lookup_char = function (data, pos) { - return (pos < 0) - ? this._lookbehind[this._lookbehind_size + pos] - : data[pos] +const context = createLoggerContext({ + logLevelEnvVarName: "TYPESPEC_RUNTIME_LOG_LEVEL", + namespace: "typeSpecRuntime", +}); +/** + * Immediately enables logging at the specified log level. If no level is specified, logging is disabled. + * @param level - The log level to enable for logging. + * Options from most verbose to least verbose are: + * - verbose + * - info + * - warning + * - error + */ +// eslint-disable-next-line @typescript-eslint/no-redeclare +exports.TypeSpecRuntimeLogger = context.logger; +/** + * Retrieves the currently specified log level. + */ +function setLogLevel(logLevel) { + context.setLogLevel(logLevel); } - -SBMH.prototype._sbmh_memcmp = function (data, pos, len) { - for (var i = 0; i < len; ++i) { // eslint-disable-line no-var - if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false } - } - return true +/** + * Retrieves the currently specified log level. + */ +function getLogLevel() { + return context.getLogLevel(); } - -module.exports = SBMH - +/** + * Creates a logger for use by the SDKs that inherits from `TypeSpecRuntimeLogger`. + * @param namespace - The name of the SDK package. + * @hidden + */ +function createClientLogger(namespace) { + return context.createClientLogger(namespace); +} +//# sourceMappingURL=logger.js.map /***/ }), -/***/ 50727: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 63098: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -const WritableStream = (__nccwpck_require__(84492).Writable) -const { inherits } = __nccwpck_require__(47261) -const Dicer = __nccwpck_require__(92960) - -const MultipartParser = __nccwpck_require__(32183) -const UrlencodedParser = __nccwpck_require__(78306) -const parseParams = __nccwpck_require__(31854) - -function Busboy (opts) { - if (!(this instanceof Busboy)) { return new Busboy(opts) } - - if (typeof opts !== 'object') { - throw new TypeError('Busboy expected an options-Object.') - } - if (typeof opts.headers !== 'object') { - throw new TypeError('Busboy expected an options-Object with headers-attribute.') - } - if (typeof opts.headers['content-type'] !== 'string') { - throw new TypeError('Missing Content-Type-header.') - } - - const { - headers, - ...streamOptions - } = opts - - this.opts = { - autoDestroy: false, - ...streamOptions - } - WritableStream.call(this, this.opts) - - this._done = false - this._parser = this.getParserByHeaders(headers) - this._finished = false +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getBodyLength = getBodyLength; +exports.createNodeHttpClient = createNodeHttpClient; +const tslib_1 = __nccwpck_require__(4351); +const node_http_1 = tslib_1.__importDefault(__nccwpck_require__(88849)); +const node_https_1 = tslib_1.__importDefault(__nccwpck_require__(22286)); +const node_zlib_1 = tslib_1.__importDefault(__nccwpck_require__(65628)); +const node_stream_1 = __nccwpck_require__(84492); +const AbortError_js_1 = __nccwpck_require__(72033); +const httpHeaders_js_1 = __nccwpck_require__(66816); +const restError_js_1 = __nccwpck_require__(42858); +const log_js_1 = __nccwpck_require__(85930); +const sanitizer_js_1 = __nccwpck_require__(61416); +const DEFAULT_TLS_SETTINGS = {}; +function isReadableStream(body) { + return body && typeof body.pipe === "function"; } -inherits(Busboy, WritableStream) - -Busboy.prototype.emit = function (ev) { - if (ev === 'finish') { - if (!this._done) { - this._parser?.end() - return - } else if (this._finished) { - return +function isStreamComplete(stream) { + if (stream.readable === false) { + return Promise.resolve(); } - this._finished = true - } - WritableStream.prototype.emit.apply(this, arguments) + return new Promise((resolve) => { + const handler = () => { + resolve(); + stream.removeListener("close", handler); + stream.removeListener("end", handler); + stream.removeListener("error", handler); + }; + stream.on("close", handler); + stream.on("end", handler); + stream.on("error", handler); + }); } - -Busboy.prototype.getParserByHeaders = function (headers) { - const parsed = parseParams(headers['content-type']) - - const cfg = { - defCharset: this.opts.defCharset, - fileHwm: this.opts.fileHwm, - headers, - highWaterMark: this.opts.highWaterMark, - isPartAFile: this.opts.isPartAFile, - limits: this.opts.limits, - parsedConType: parsed, - preservePath: this.opts.preservePath - } - - if (MultipartParser.detect.test(parsed[0])) { - return new MultipartParser(this, cfg) - } - if (UrlencodedParser.detect.test(parsed[0])) { - return new UrlencodedParser(this, cfg) - } - throw new Error('Unsupported Content-Type.') +function isArrayBuffer(body) { + return body && typeof body.byteLength === "number"; } - -Busboy.prototype._write = function (chunk, encoding, cb) { - this._parser.write(chunk, cb) +class ReportTransform extends node_stream_1.Transform { + loadedBytes = 0; + progressCallback; + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + _transform(chunk, _encoding, callback) { + this.push(chunk); + this.loadedBytes += chunk.length; + try { + this.progressCallback({ loadedBytes: this.loadedBytes }); + callback(); + } + catch (e) { + callback(e); + } + } + constructor(progressCallback) { + super(); + this.progressCallback = progressCallback; + } } - -module.exports = Busboy -module.exports["default"] = Busboy -module.exports.Busboy = Busboy - -module.exports.Dicer = Dicer - - -/***/ }), - -/***/ 32183: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -// TODO: -// * support 1 nested multipart level -// (see second multipart example here: -// http://www.w3.org/TR/html401/interact/forms.html#didx-multipartform-data) -// * support limits.fieldNameSize -// -- this will require modifications to utils.parseParams - -const { Readable } = __nccwpck_require__(84492) -const { inherits } = __nccwpck_require__(47261) - -const Dicer = __nccwpck_require__(92960) - -const parseParams = __nccwpck_require__(31854) -const decodeText = __nccwpck_require__(84619) -const basename = __nccwpck_require__(48647) -const getLimit = __nccwpck_require__(21467) - -const RE_BOUNDARY = /^boundary$/i -const RE_FIELD = /^form-data$/i -const RE_CHARSET = /^charset$/i -const RE_FILENAME = /^filename$/i -const RE_NAME = /^name$/i - -Multipart.detect = /^multipart\/form-data/i -function Multipart (boy, cfg) { - let i - let len - const self = this - let boundary - const limits = cfg.limits - const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined)) - const parsedConType = cfg.parsedConType || [] - const defCharset = cfg.defCharset || 'utf8' - const preservePath = cfg.preservePath - const fileOpts = { highWaterMark: cfg.fileHwm } - - for (i = 0, len = parsedConType.length; i < len; ++i) { - if (Array.isArray(parsedConType[i]) && - RE_BOUNDARY.test(parsedConType[i][0])) { - boundary = parsedConType[i][1] - break +/** + * A HttpClient implementation that uses Node's "https" module to send HTTPS requests. + * @internal + */ +class NodeHttpClient { + cachedHttpAgent; + cachedHttpsAgents = new WeakMap(); + /** + * Makes a request over an underlying transport layer and returns the response. + * @param request - The request to be made. + */ + async sendRequest(request) { + const abortController = new AbortController(); + let abortListener; + if (request.abortSignal) { + if (request.abortSignal.aborted) { + throw new AbortError_js_1.AbortError("The operation was aborted. Request has already been canceled."); + } + abortListener = (event) => { + if (event.type === "abort") { + abortController.abort(); + } + }; + request.abortSignal.addEventListener("abort", abortListener); + } + let timeoutId; + if (request.timeout > 0) { + timeoutId = setTimeout(() => { + const sanitizer = new sanitizer_js_1.Sanitizer(); + log_js_1.logger.info(`request to '${sanitizer.sanitizeUrl(request.url)}' timed out. canceling...`); + abortController.abort(); + }, request.timeout); + } + const acceptEncoding = request.headers.get("Accept-Encoding"); + const shouldDecompress = acceptEncoding?.includes("gzip") || acceptEncoding?.includes("deflate"); + let body = typeof request.body === "function" ? request.body() : request.body; + if (body && !request.headers.has("Content-Length")) { + const bodyLength = getBodyLength(body); + if (bodyLength !== null) { + request.headers.set("Content-Length", bodyLength); + } + } + let responseStream; + try { + if (body && request.onUploadProgress) { + const onUploadProgress = request.onUploadProgress; + const uploadReportStream = new ReportTransform(onUploadProgress); + uploadReportStream.on("error", (e) => { + log_js_1.logger.error("Error in upload progress", e); + }); + if (isReadableStream(body)) { + body.pipe(uploadReportStream); + } + else { + uploadReportStream.end(body); + } + body = uploadReportStream; + } + const res = await this.makeRequest(request, abortController, body); + if (timeoutId !== undefined) { + clearTimeout(timeoutId); + } + const headers = getResponseHeaders(res); + const status = res.statusCode ?? 0; + const response = { + status, + headers, + request, + }; + // Responses to HEAD must not have a body. + // If they do return a body, that body must be ignored. + if (request.method === "HEAD") { + // call resume() and not destroy() to avoid closing the socket + // and losing keep alive + res.resume(); + return response; + } + responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res; + const onDownloadProgress = request.onDownloadProgress; + if (onDownloadProgress) { + const downloadReportStream = new ReportTransform(onDownloadProgress); + downloadReportStream.on("error", (e) => { + log_js_1.logger.error("Error in download progress", e); + }); + responseStream.pipe(downloadReportStream); + responseStream = downloadReportStream; + } + if ( + // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code + request.streamResponseStatusCodes?.has(Number.POSITIVE_INFINITY) || + request.streamResponseStatusCodes?.has(response.status)) { + response.readableStreamBody = responseStream; + } + else { + response.bodyAsText = await streamToText(responseStream); + } + return response; + } + finally { + // clean up event listener + if (request.abortSignal && abortListener) { + let uploadStreamDone = Promise.resolve(); + if (isReadableStream(body)) { + uploadStreamDone = isStreamComplete(body); + } + let downloadStreamDone = Promise.resolve(); + if (isReadableStream(responseStream)) { + downloadStreamDone = isStreamComplete(responseStream); + } + Promise.all([uploadStreamDone, downloadStreamDone]) + .then(() => { + // eslint-disable-next-line promise/always-return + if (abortListener) { + request.abortSignal?.removeEventListener("abort", abortListener); + } + }) + .catch((e) => { + log_js_1.logger.warning("Error when cleaning up abortListener on httpRequest", e); + }); + } + } } - } - - function checkFinished () { - if (nends === 0 && finished && !boy._done) { - finished = false - self.end() + makeRequest(request, abortController, body) { + const url = new URL(request.url); + const isInsecure = url.protocol !== "https:"; + if (isInsecure && !request.allowInsecureConnection) { + throw new Error(`Cannot connect to ${request.url} while allowInsecureConnection is false.`); + } + const agent = request.agent ?? this.getOrCreateAgent(request, isInsecure); + const options = { + agent, + hostname: url.hostname, + path: `${url.pathname}${url.search}`, + port: url.port, + method: request.method, + headers: request.headers.toJSON({ preserveCase: true }), + ...request.requestOverrides, + }; + return new Promise((resolve, reject) => { + const req = isInsecure ? node_http_1.default.request(options, resolve) : node_https_1.default.request(options, resolve); + req.once("error", (err) => { + reject(new restError_js_1.RestError(err.message, { code: err.code ?? restError_js_1.RestError.REQUEST_SEND_ERROR, request })); + }); + abortController.signal.addEventListener("abort", () => { + const abortError = new AbortError_js_1.AbortError("The operation was aborted. Rejecting from abort signal callback while making request."); + req.destroy(abortError); + reject(abortError); + }); + if (body && isReadableStream(body)) { + body.pipe(req); + } + else if (body) { + if (typeof body === "string" || Buffer.isBuffer(body)) { + req.end(body); + } + else if (isArrayBuffer(body)) { + req.end(ArrayBuffer.isView(body) ? Buffer.from(body.buffer) : Buffer.from(body)); + } + else { + log_js_1.logger.error("Unrecognized body type", body); + reject(new restError_js_1.RestError("Unrecognized body type")); + } + } + else { + // streams don't like "undefined" being passed as data + req.end(); + } + }); } - } - - if (typeof boundary !== 'string') { throw new Error('Multipart: Boundary not found') } - - const fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) - const fileSizeLimit = getLimit(limits, 'fileSize', Infinity) - const filesLimit = getLimit(limits, 'files', Infinity) - const fieldsLimit = getLimit(limits, 'fields', Infinity) - const partsLimit = getLimit(limits, 'parts', Infinity) - const headerPairsLimit = getLimit(limits, 'headerPairs', 2000) - const headerSizeLimit = getLimit(limits, 'headerSize', 80 * 1024) - - let nfiles = 0 - let nfields = 0 - let nends = 0 - let curFile - let curField - let finished = false + getOrCreateAgent(request, isInsecure) { + const disableKeepAlive = request.disableKeepAlive; + // Handle Insecure requests first + if (isInsecure) { + if (disableKeepAlive) { + // keepAlive:false is the default so we don't need a custom Agent + return node_http_1.default.globalAgent; + } + if (!this.cachedHttpAgent) { + // If there is no cached agent create a new one and cache it. + this.cachedHttpAgent = new node_http_1.default.Agent({ keepAlive: true }); + } + return this.cachedHttpAgent; + } + else { + if (disableKeepAlive && !request.tlsSettings) { + // When there are no tlsSettings and keepAlive is false + // we don't need a custom agent + return node_https_1.default.globalAgent; + } + // We use the tlsSettings to index cached clients + const tlsSettings = request.tlsSettings ?? DEFAULT_TLS_SETTINGS; + // Get the cached agent or create a new one with the + // provided values for keepAlive and tlsSettings + let agent = this.cachedHttpsAgents.get(tlsSettings); + if (agent && agent.options.keepAlive === !disableKeepAlive) { + return agent; + } + log_js_1.logger.info("No cached TLS Agent exist, creating a new Agent"); + agent = new node_https_1.default.Agent({ + // keepAlive is true if disableKeepAlive is false. + keepAlive: !disableKeepAlive, + // Since we are spreading, if no tslSettings were provided, nothing is added to the agent options. + ...tlsSettings, + }); + this.cachedHttpsAgents.set(tlsSettings, agent); + return agent; + } + } +} +function getResponseHeaders(res) { + const headers = (0, httpHeaders_js_1.createHttpHeaders)(); + for (const header of Object.keys(res.headers)) { + const value = res.headers[header]; + if (Array.isArray(value)) { + if (value.length > 0) { + headers.set(header, value[0]); + } + } + else if (value) { + headers.set(header, value); + } + } + return headers; +} +function getDecodedResponseStream(stream, headers) { + const contentEncoding = headers.get("Content-Encoding"); + if (contentEncoding === "gzip") { + const unzip = node_zlib_1.default.createGunzip(); + stream.pipe(unzip); + return unzip; + } + else if (contentEncoding === "deflate") { + const inflate = node_zlib_1.default.createInflate(); + stream.pipe(inflate); + return inflate; + } + return stream; +} +function streamToText(stream) { + return new Promise((resolve, reject) => { + const buffer = []; + stream.on("data", (chunk) => { + if (Buffer.isBuffer(chunk)) { + buffer.push(chunk); + } + else { + buffer.push(Buffer.from(chunk)); + } + }); + stream.on("end", () => { + resolve(Buffer.concat(buffer).toString("utf8")); + }); + stream.on("error", (e) => { + if (e && e?.name === "AbortError") { + reject(e); + } + else { + reject(new restError_js_1.RestError(`Error reading response as text: ${e.message}`, { + code: restError_js_1.RestError.PARSE_ERROR, + })); + } + }); + }); +} +/** @internal */ +function getBodyLength(body) { + if (!body) { + return 0; + } + else if (Buffer.isBuffer(body)) { + return body.length; + } + else if (isReadableStream(body)) { + return null; + } + else if (isArrayBuffer(body)) { + return body.byteLength; + } + else if (typeof body === "string") { + return Buffer.from(body).length; + } + else { + return null; + } +} +/** + * Create a new HttpClient instance for the NodeJS environment. + * @internal + */ +function createNodeHttpClient() { + return new NodeHttpClient(); +} +//# sourceMappingURL=nodeHttpClient.js.map - this._needDrain = false - this._pause = false - this._cb = undefined - this._nparts = 0 - this._boy = boy +/***/ }), - const parserCfg = { - boundary, - maxHeaderPairs: headerPairsLimit, - maxHeaderSize: headerSizeLimit, - partHwm: fileOpts.highWaterMark, - highWaterMark: cfg.highWaterMark - } +/***/ 34744: +/***/ ((__unused_webpack_module, exports) => { - this.parser = new Dicer(parserCfg) - this.parser.on('drain', function () { - self._needDrain = false - if (self._cb && !self._pause) { - const cb = self._cb - self._cb = undefined - cb() +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createEmptyPipeline = createEmptyPipeline; +const ValidPhaseNames = new Set(["Deserialize", "Serialize", "Retry", "Sign"]); +/** + * A private implementation of Pipeline. + * Do not export this class from the package. + * @internal + */ +class HttpPipeline { + _policies = []; + _orderedPolicies; + constructor(policies) { + this._policies = policies?.slice(0) ?? []; + this._orderedPolicies = undefined; } - }).on('part', function onPart (part) { - if (++self._nparts > partsLimit) { - self.parser.removeListener('part', onPart) - self.parser.on('part', skipPart) - boy.hitPartsLimit = true - boy.emit('partsLimit') - return skipPart(part) + addPolicy(policy, options = {}) { + if (options.phase && options.afterPhase) { + throw new Error("Policies inside a phase cannot specify afterPhase."); + } + if (options.phase && !ValidPhaseNames.has(options.phase)) { + throw new Error(`Invalid phase name: ${options.phase}`); + } + if (options.afterPhase && !ValidPhaseNames.has(options.afterPhase)) { + throw new Error(`Invalid afterPhase name: ${options.afterPhase}`); + } + this._policies.push({ + policy, + options, + }); + this._orderedPolicies = undefined; } - - // hack because streams2 _always_ doesn't emit 'end' until nextTick, so let - // us emit 'end' early since we know the part has ended if we are already - // seeing the next part - if (curField) { - const field = curField - field.emit('end') - field.removeAllListeners('end') + removePolicy(options) { + const removedPolicies = []; + this._policies = this._policies.filter((policyDescriptor) => { + if ((options.name && policyDescriptor.policy.name === options.name) || + (options.phase && policyDescriptor.options.phase === options.phase)) { + removedPolicies.push(policyDescriptor.policy); + return false; + } + else { + return true; + } + }); + this._orderedPolicies = undefined; + return removedPolicies; } - - part.on('header', function (header) { - let contype - let fieldname - let parsed - let charset - let encoding - let filename - let nsize = 0 - - if (header['content-type']) { - parsed = parseParams(header['content-type'][0]) - if (parsed[0]) { - contype = parsed[0].toLowerCase() - for (i = 0, len = parsed.length; i < len; ++i) { - if (RE_CHARSET.test(parsed[i][0])) { - charset = parsed[i][1].toLowerCase() - break + sendRequest(httpClient, request) { + const policies = this.getOrderedPolicies(); + const pipeline = policies.reduceRight((next, policy) => { + return (req) => { + return policy.sendRequest(req, next); + }; + }, (req) => httpClient.sendRequest(req)); + return pipeline(request); + } + getOrderedPolicies() { + if (!this._orderedPolicies) { + this._orderedPolicies = this.orderPolicies(); + } + return this._orderedPolicies; + } + clone() { + return new HttpPipeline(this._policies); + } + static create() { + return new HttpPipeline(); + } + orderPolicies() { + /** + * The goal of this method is to reliably order pipeline policies + * based on their declared requirements when they were added. + * + * Order is first determined by phase: + * + * 1. Serialize Phase + * 2. Policies not in a phase + * 3. Deserialize Phase + * 4. Retry Phase + * 5. Sign Phase + * + * Within each phase, policies are executed in the order + * they were added unless they were specified to execute + * before/after other policies or after a particular phase. + * + * To determine the final order, we will walk the policy list + * in phase order multiple times until all dependencies are + * satisfied. + * + * `afterPolicies` are the set of policies that must be + * executed before a given policy. This requirement is + * considered satisfied when each of the listed policies + * have been scheduled. + * + * `beforePolicies` are the set of policies that must be + * executed after a given policy. Since this dependency + * can be expressed by converting it into a equivalent + * `afterPolicies` declarations, they are normalized + * into that form for simplicity. + * + * An `afterPhase` dependency is considered satisfied when all + * policies in that phase have scheduled. + * + */ + const result = []; + // Track all policies we know about. + const policyMap = new Map(); + function createPhase(name) { + return { + name, + policies: new Set(), + hasRun: false, + hasAfterPolicies: false, + }; + } + // Track policies for each phase. + const serializePhase = createPhase("Serialize"); + const noPhase = createPhase("None"); + const deserializePhase = createPhase("Deserialize"); + const retryPhase = createPhase("Retry"); + const signPhase = createPhase("Sign"); + // a list of phases in order + const orderedPhases = [serializePhase, noPhase, deserializePhase, retryPhase, signPhase]; + // Small helper function to map phase name to each Phase + function getPhase(phase) { + if (phase === "Retry") { + return retryPhase; + } + else if (phase === "Serialize") { + return serializePhase; + } + else if (phase === "Deserialize") { + return deserializePhase; + } + else if (phase === "Sign") { + return signPhase; + } + else { + return noPhase; } - } } - } - - if (contype === undefined) { contype = 'text/plain' } - if (charset === undefined) { charset = defCharset } - - if (header['content-disposition']) { - parsed = parseParams(header['content-disposition'][0]) - if (!RE_FIELD.test(parsed[0])) { return skipPart(part) } - for (i = 0, len = parsed.length; i < len; ++i) { - if (RE_NAME.test(parsed[i][0])) { - fieldname = parsed[i][1] - } else if (RE_FILENAME.test(parsed[i][0])) { - filename = parsed[i][1] - if (!preservePath) { filename = basename(filename) } - } + // First walk each policy and create a node to track metadata. + for (const descriptor of this._policies) { + const policy = descriptor.policy; + const options = descriptor.options; + const policyName = policy.name; + if (policyMap.has(policyName)) { + throw new Error("Duplicate policy names not allowed in pipeline"); + } + const node = { + policy, + dependsOn: new Set(), + dependants: new Set(), + }; + if (options.afterPhase) { + node.afterPhase = getPhase(options.afterPhase); + node.afterPhase.hasAfterPolicies = true; + } + policyMap.set(policyName, node); + const phase = getPhase(options.phase); + phase.policies.add(node); } - } else { return skipPart(part) } - - if (header['content-transfer-encoding']) { encoding = header['content-transfer-encoding'][0].toLowerCase() } else { encoding = '7bit' } - - let onData, - onEnd - - if (isPartAFile(fieldname, contype, filename)) { - // file/binary field - if (nfiles === filesLimit) { - if (!boy.hitFilesLimit) { - boy.hitFilesLimit = true - boy.emit('filesLimit') - } - return skipPart(part) + // Now that each policy has a node, connect dependency references. + for (const descriptor of this._policies) { + const { policy, options } = descriptor; + const policyName = policy.name; + const node = policyMap.get(policyName); + if (!node) { + throw new Error(`Missing node for policy ${policyName}`); + } + if (options.afterPolicies) { + for (const afterPolicyName of options.afterPolicies) { + const afterNode = policyMap.get(afterPolicyName); + if (afterNode) { + // Linking in both directions helps later + // when we want to notify dependants. + node.dependsOn.add(afterNode); + afterNode.dependants.add(node); + } + } + } + if (options.beforePolicies) { + for (const beforePolicyName of options.beforePolicies) { + const beforeNode = policyMap.get(beforePolicyName); + if (beforeNode) { + // To execute before another node, make it + // depend on the current node. + beforeNode.dependsOn.add(node); + node.dependants.add(beforeNode); + } + } + } } - - ++nfiles - - if (!boy._events.file) { - self.parser._ignore() - return + function walkPhase(phase) { + phase.hasRun = true; + // Sets iterate in insertion order + for (const node of phase.policies) { + if (node.afterPhase && (!node.afterPhase.hasRun || node.afterPhase.policies.size)) { + // If this node is waiting on a phase to complete, + // we need to skip it for now. + // Even if the phase is empty, we should wait for it + // to be walked to avoid re-ordering policies. + continue; + } + if (node.dependsOn.size === 0) { + // If there's nothing else we're waiting for, we can + // add this policy to the result list. + result.push(node.policy); + // Notify anything that depends on this policy that + // the policy has been scheduled. + for (const dependant of node.dependants) { + dependant.dependsOn.delete(node); + } + policyMap.delete(node.policy.name); + phase.policies.delete(node); + } + } } - - ++nends - const file = new FileStream(fileOpts) - curFile = file - file.on('end', function () { - --nends - self._pause = false - checkFinished() - if (self._cb && !self._needDrain) { - const cb = self._cb - self._cb = undefined - cb() - } - }) - file._read = function (n) { - if (!self._pause) { return } - self._pause = false - if (self._cb && !self._needDrain) { - const cb = self._cb - self._cb = undefined - cb() - } + function walkPhases() { + for (const phase of orderedPhases) { + walkPhase(phase); + // if the phase isn't complete + if (phase.policies.size > 0 && phase !== noPhase) { + if (!noPhase.hasRun) { + // Try running noPhase to see if that unblocks this phase next tick. + // This can happen if a phase that happens before noPhase + // is waiting on a noPhase policy to complete. + walkPhase(noPhase); + } + // Don't proceed to the next phase until this phase finishes. + return; + } + if (phase.hasAfterPolicies) { + // Run any policies unblocked by this phase + walkPhase(noPhase); + } + } } - boy.emit('file', fieldname, file, filename, encoding, contype) + // Iterate until we've put every node in the result list. + let iteration = 0; + while (policyMap.size > 0) { + iteration++; + const initialResultLength = result.length; + // Keep walking each phase in order until we can order every node. + walkPhases(); + // The result list *should* get at least one larger each time + // after the first full pass. + // Otherwise, we're going to loop forever. + if (result.length <= initialResultLength && iteration > 1) { + throw new Error("Cannot satisfy policy dependencies due to requirements cycle."); + } + } + return result; + } +} +/** + * Creates a totally empty pipeline. + * Useful for testing or creating a custom one. + */ +function createEmptyPipeline() { + return HttpPipeline.create(); +} +//# sourceMappingURL=pipeline.js.map - onData = function (data) { - if ((nsize += data.length) > fileSizeLimit) { - const extralen = fileSizeLimit - nsize + data.length - if (extralen > 0) { file.push(data.slice(0, extralen)) } - file.truncated = true - file.bytesRead = fileSizeLimit - part.removeAllListeners('data') - file.emit('limit') - return - } else if (!file.push(data)) { self._pause = true } +/***/ }), - file.bytesRead = nsize - } +/***/ 47983: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - onEnd = function () { - curFile = undefined - file.push(null) - } - } else { - // non-file field - if (nfields === fieldsLimit) { - if (!boy.hitFieldsLimit) { - boy.hitFieldsLimit = true - boy.emit('fieldsLimit') - } - return skipPart(part) - } +"use strict"; - ++nfields - ++nends - let buffer = '' - let truncated = false - curField = part +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createPipelineRequest = createPipelineRequest; +const httpHeaders_js_1 = __nccwpck_require__(66816); +const uuidUtils_js_1 = __nccwpck_require__(2339); +class PipelineRequestImpl { + url; + method; + headers; + timeout; + withCredentials; + body; + multipartBody; + formData; + streamResponseStatusCodes; + enableBrowserStreams; + proxySettings; + disableKeepAlive; + abortSignal; + requestId; + allowInsecureConnection; + onUploadProgress; + onDownloadProgress; + requestOverrides; + authSchemes; + constructor(options) { + this.url = options.url; + this.body = options.body; + this.headers = options.headers ?? (0, httpHeaders_js_1.createHttpHeaders)(); + this.method = options.method ?? "GET"; + this.timeout = options.timeout ?? 0; + this.multipartBody = options.multipartBody; + this.formData = options.formData; + this.disableKeepAlive = options.disableKeepAlive ?? false; + this.proxySettings = options.proxySettings; + this.streamResponseStatusCodes = options.streamResponseStatusCodes; + this.withCredentials = options.withCredentials ?? false; + this.abortSignal = options.abortSignal; + this.onUploadProgress = options.onUploadProgress; + this.onDownloadProgress = options.onDownloadProgress; + this.requestId = options.requestId || (0, uuidUtils_js_1.randomUUID)(); + this.allowInsecureConnection = options.allowInsecureConnection ?? false; + this.enableBrowserStreams = options.enableBrowserStreams ?? false; + this.requestOverrides = options.requestOverrides; + this.authSchemes = options.authSchemes; + } +} +/** + * Creates a new pipeline request with the given options. + * This method is to allow for the easy setting of default values and not required. + * @param options - The options to create the request with. + */ +function createPipelineRequest(options) { + return new PipelineRequestImpl(options); +} +//# sourceMappingURL=pipelineRequest.js.map - onData = function (data) { - if ((nsize += data.length) > fieldSizeLimit) { - const extralen = (fieldSizeLimit - (nsize - data.length)) - buffer += data.toString('binary', 0, extralen) - truncated = true - part.removeAllListeners('data') - } else { buffer += data.toString('binary') } - } +/***/ }), - onEnd = function () { - curField = undefined - if (buffer.length) { buffer = decodeText(buffer, 'binary', charset) } - boy.emit('field', fieldname, buffer, false, truncated, encoding, contype) - --nends - checkFinished() - } - } +/***/ 73398: +/***/ ((__unused_webpack_module, exports) => { - /* As of node@2efe4ab761666 (v0.10.29+/v0.11.14+), busboy had become - broken. Streams2/streams3 is a huge black box of confusion, but - somehow overriding the sync state seems to fix things again (and still - seems to work for previous node versions). - */ - part._readableState.sync = false +"use strict"; - part.on('data', onData) - part.on('end', onEnd) - }).on('error', function (err) { - if (curFile) { curFile.emit('error', err) } - }) - }).on('error', function (err) { - boy.emit('error', err) - }).on('finish', function () { - finished = true - checkFinished() - }) +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.agentPolicyName = void 0; +exports.agentPolicy = agentPolicy; +/** + * Name of the Agent Policy + */ +exports.agentPolicyName = "agentPolicy"; +/** + * Gets a pipeline policy that sets http.agent + */ +function agentPolicy(agent) { + return { + name: exports.agentPolicyName, + sendRequest: async (req, next) => { + // Users may define an agent on the request, honor it over the client level one + if (!req.agent) { + req.agent = agent; + } + return next(req); + }, + }; } +//# sourceMappingURL=agentPolicy.js.map -Multipart.prototype.write = function (chunk, cb) { - const r = this.parser.write(chunk) - if (r && !this._pause) { - cb() - } else { - this._needDrain = !r - this._cb = cb - } -} +/***/ }), -Multipart.prototype.end = function () { - const self = this +/***/ 7937: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (self.parser.writable) { - self.parser.end() - } else if (!self._boy._done) { - process.nextTick(function () { - self._boy._done = true - self._boy.emit('finish') - }) - } -} +"use strict"; -function skipPart (part) { - part.resume() +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.apiKeyAuthenticationPolicyName = void 0; +exports.apiKeyAuthenticationPolicy = apiKeyAuthenticationPolicy; +const checkInsecureConnection_js_1 = __nccwpck_require__(4212); +/** + * Name of the API Key Authentication Policy + */ +exports.apiKeyAuthenticationPolicyName = "apiKeyAuthenticationPolicy"; +/** + * Gets a pipeline policy that adds API key authentication to requests + */ +function apiKeyAuthenticationPolicy(options) { + return { + name: exports.apiKeyAuthenticationPolicyName, + async sendRequest(request, next) { + // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); + const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "apiKey"); + // Skip adding authentication header if no API key authentication scheme is found + if (!scheme) { + return next(request); + } + if (scheme.apiKeyLocation !== "header") { + throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`); + } + request.headers.set(scheme.name, options.credential.key); + return next(request); + }, + }; } +//# sourceMappingURL=apiKeyAuthenticationPolicy.js.map -function FileStream (opts) { - Readable.call(this, opts) +/***/ }), - this.bytesRead = 0 +/***/ 10068: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - this.truncated = false +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.basicAuthenticationPolicyName = void 0; +exports.basicAuthenticationPolicy = basicAuthenticationPolicy; +const bytesEncoding_js_1 = __nccwpck_require__(88943); +const checkInsecureConnection_js_1 = __nccwpck_require__(4212); +/** + * Name of the Basic Authentication Policy + */ +exports.basicAuthenticationPolicyName = "bearerAuthenticationPolicy"; +/** + * Gets a pipeline policy that adds basic authentication to requests + */ +function basicAuthenticationPolicy(options) { + return { + name: exports.basicAuthenticationPolicyName, + async sendRequest(request, next) { + // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); + const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "basic"); + // Skip adding authentication header if no basic authentication scheme is found + if (!scheme) { + return next(request); + } + const { username, password } = options.credential; + const headerValue = (0, bytesEncoding_js_1.uint8ArrayToString)((0, bytesEncoding_js_1.stringToUint8Array)(`${username}:${password}`, "utf-8"), "base64"); + request.headers.set("Authorization", `Basic ${headerValue}`); + return next(request); + }, + }; } +//# sourceMappingURL=basicAuthenticationPolicy.js.map -inherits(FileStream, Readable) +/***/ }), -FileStream.prototype._read = function (n) {} +/***/ 73054: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -module.exports = Multipart +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.bearerAuthenticationPolicyName = void 0; +exports.bearerAuthenticationPolicy = bearerAuthenticationPolicy; +const checkInsecureConnection_js_1 = __nccwpck_require__(4212); +/** + * Name of the Bearer Authentication Policy + */ +exports.bearerAuthenticationPolicyName = "bearerAuthenticationPolicy"; +/** + * Gets a pipeline policy that adds bearer token authentication to requests + */ +function bearerAuthenticationPolicy(options) { + return { + name: exports.bearerAuthenticationPolicyName, + async sendRequest(request, next) { + // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); + const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "bearer"); + // Skip adding authentication header if no bearer authentication scheme is found + if (!scheme) { + return next(request); + } + const token = await options.credential.getBearerToken({ + abortSignal: request.abortSignal, + }); + request.headers.set("Authorization", `Bearer ${token}`); + return next(request); + }, + }; +} +//# sourceMappingURL=bearerAuthenticationPolicy.js.map /***/ }), -/***/ 78306: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 4212: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ensureSecureConnection = ensureSecureConnection; +const log_js_1 = __nccwpck_require__(85930); +// Ensure the warining is only emitted once +let insecureConnectionWarningEmmitted = false; +/** + * Checks if the request is allowed to be sent over an insecure connection. + * + * A request is allowed to be sent over an insecure connection when: + * - The `allowInsecureConnection` option is set to `true`. + * - The request has the `allowInsecureConnection` property set to `true`. + * - The request is being sent to `localhost` or `127.0.0.1` + */ +function allowInsecureConnection(request, options) { + if (options.allowInsecureConnection && request.allowInsecureConnection) { + const url = new URL(request.url); + if (url.hostname === "localhost" || url.hostname === "127.0.0.1") { + return true; + } + } + return false; +} +/** + * Logs a warning about sending a token over an insecure connection. + * + * This function will emit a node warning once, but log the warning every time. + */ +function emitInsecureConnectionWarning() { + const warning = "Sending token over insecure transport. Assume any token issued is compromised."; + log_js_1.logger.warning(warning); + if (typeof process?.emitWarning === "function" && !insecureConnectionWarningEmmitted) { + insecureConnectionWarningEmmitted = true; + process.emitWarning(warning); + } +} +/** + * Ensures that authentication is only allowed over HTTPS unless explicitly allowed. + * Throws an error if the connection is not secure and not explicitly allowed. + */ +function ensureSecureConnection(request, options) { + if (!request.url.toLowerCase().startsWith("https://")) { + if (allowInsecureConnection(request, options)) { + emitInsecureConnectionWarning(); + } + else { + throw new Error("Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false."); + } + } +} +//# sourceMappingURL=checkInsecureConnection.js.map -const Decoder = __nccwpck_require__(27100) -const decodeText = __nccwpck_require__(84619) -const getLimit = __nccwpck_require__(21467) +/***/ }), -const RE_CHARSET = /^charset$/i +/***/ 71305: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -UrlEncoded.detect = /^application\/x-www-form-urlencoded/i -function UrlEncoded (boy, cfg) { - const limits = cfg.limits - const parsedConType = cfg.parsedConType - this.boy = boy +"use strict"; - this.fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024) - this.fieldNameSizeLimit = getLimit(limits, 'fieldNameSize', 100) - this.fieldsLimit = getLimit(limits, 'fields', Infinity) +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.oauth2AuthenticationPolicyName = void 0; +exports.oauth2AuthenticationPolicy = oauth2AuthenticationPolicy; +const checkInsecureConnection_js_1 = __nccwpck_require__(4212); +/** + * Name of the OAuth2 Authentication Policy + */ +exports.oauth2AuthenticationPolicyName = "oauth2AuthenticationPolicy"; +/** + * Gets a pipeline policy that adds authorization header from OAuth2 schemes + */ +function oauth2AuthenticationPolicy(options) { + return { + name: exports.oauth2AuthenticationPolicyName, + async sendRequest(request, next) { + // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs + (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); + const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "oauth2"); + // Skip adding authentication header if no OAuth2 authentication scheme is found + if (!scheme) { + return next(request); + } + const token = await options.credential.getOAuth2Token(scheme.flows, { + abortSignal: request.abortSignal, + }); + request.headers.set("Authorization", `Bearer ${token}`); + return next(request); + }, + }; +} +//# sourceMappingURL=oauth2AuthenticationPolicy.js.map - let charset - for (var i = 0, len = parsedConType.length; i < len; ++i) { // eslint-disable-line no-var - if (Array.isArray(parsedConType[i]) && - RE_CHARSET.test(parsedConType[i][0])) { - charset = parsedConType[i][1].toLowerCase() - break - } - } +/***/ }), - if (charset === undefined) { charset = cfg.defCharset || 'utf8' } +/***/ 74162: +/***/ ((__unused_webpack_module, exports) => { - this.decoder = new Decoder() - this.charset = charset - this._fields = 0 - this._state = 'key' - this._checkingBytes = true - this._bytesKey = 0 - this._bytesVal = 0 - this._key = '' - this._val = '' - this._keyTrunc = false - this._valTrunc = false - this._hitLimit = false +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.decompressResponsePolicyName = void 0; +exports.decompressResponsePolicy = decompressResponsePolicy; +/** + * The programmatic identifier of the decompressResponsePolicy. + */ +exports.decompressResponsePolicyName = "decompressResponsePolicy"; +/** + * A policy to enable response decompression according to Accept-Encoding header + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding + */ +function decompressResponsePolicy() { + return { + name: exports.decompressResponsePolicyName, + async sendRequest(request, next) { + // HEAD requests have no body + if (request.method !== "HEAD") { + request.headers.set("Accept-Encoding", "gzip,deflate"); + } + return next(request); + }, + }; } +//# sourceMappingURL=decompressResponsePolicy.js.map -UrlEncoded.prototype.write = function (data, cb) { - if (this._fields === this.fieldsLimit) { - if (!this.boy.hitFieldsLimit) { - this.boy.hitFieldsLimit = true - this.boy.emit('fieldsLimit') - } - return cb() - } +/***/ }), - let idxeq; let idxamp; let i; let p = 0; const len = data.length +/***/ 20297: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - while (p < len) { - if (this._state === 'key') { - idxeq = idxamp = undefined - for (i = p; i < len; ++i) { - if (!this._checkingBytes) { ++p } - if (data[i] === 0x3D/* = */) { - idxeq = i - break - } else if (data[i] === 0x26/* & */) { - idxamp = i - break - } - if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) { - this._hitLimit = true - break - } else if (this._checkingBytes) { ++this._bytesKey } - } +"use strict"; - if (idxeq !== undefined) { - // key with assignment - if (idxeq > p) { this._key += this.decoder.write(data.toString('binary', p, idxeq)) } - this._state = 'val' +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.defaultRetryPolicyName = void 0; +exports.defaultRetryPolicy = defaultRetryPolicy; +const exponentialRetryStrategy_js_1 = __nccwpck_require__(12283); +const throttlingRetryStrategy_js_1 = __nccwpck_require__(90483); +const retryPolicy_js_1 = __nccwpck_require__(27729); +const constants_js_1 = __nccwpck_require__(58463); +/** + * Name of the {@link defaultRetryPolicy} + */ +exports.defaultRetryPolicyName = "defaultRetryPolicy"; +/** + * A policy that retries according to three strategies: + * - When the server sends a 429 response with a Retry-After header. + * - When there are errors in the underlying transport layer (e.g. DNS lookup failures). + * - Or otherwise if the outgoing request fails, it will retry with an exponentially increasing delay. + */ +function defaultRetryPolicy(options = {}) { + return { + name: exports.defaultRetryPolicyName, + sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)(), (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(options)], { + maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, + }).sendRequest, + }; +} +//# sourceMappingURL=defaultRetryPolicy.js.map - this._hitLimit = false - this._checkingBytes = true - this._val = '' - this._bytesVal = 0 - this._valTrunc = false - this.decoder.reset() +/***/ }), - p = idxeq + 1 - } else if (idxamp !== undefined) { - // key with no assignment - ++this._fields - let key; const keyTrunc = this._keyTrunc - if (idxamp > p) { key = (this._key += this.decoder.write(data.toString('binary', p, idxamp))) } else { key = this._key } +/***/ 46313: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - this._hitLimit = false - this._checkingBytes = true - this._key = '' - this._bytesKey = 0 - this._keyTrunc = false - this.decoder.reset() +"use strict"; - if (key.length) { - this.boy.emit('field', decodeText(key, 'binary', this.charset), - '', - keyTrunc, - false) - } +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.exponentialRetryPolicyName = void 0; +exports.exponentialRetryPolicy = exponentialRetryPolicy; +const exponentialRetryStrategy_js_1 = __nccwpck_require__(12283); +const retryPolicy_js_1 = __nccwpck_require__(27729); +const constants_js_1 = __nccwpck_require__(58463); +/** + * The programmatic identifier of the exponentialRetryPolicy. + */ +exports.exponentialRetryPolicyName = "exponentialRetryPolicy"; +/** + * A policy that attempts to retry requests while introducing an exponentially increasing delay. + * @param options - Options that configure retry logic. + */ +function exponentialRetryPolicy(options = {}) { + return (0, retryPolicy_js_1.retryPolicy)([ + (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)({ + ...options, + ignoreSystemErrors: true, + }), + ], { + maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, + }); +} +//# sourceMappingURL=exponentialRetryPolicy.js.map - p = idxamp + 1 - if (this._fields === this.fieldsLimit) { return cb() } - } else if (this._hitLimit) { - // we may not have hit the actual limit if there are encoded bytes... - if (i > p) { this._key += this.decoder.write(data.toString('binary', p, i)) } - p = i - if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) { - // yep, we actually did hit the limit - this._checkingBytes = false - this._keyTrunc = true - } - } else { - if (p < len) { this._key += this.decoder.write(data.toString('binary', p)) } - p = len - } - } else { - idxamp = undefined - for (i = p; i < len; ++i) { - if (!this._checkingBytes) { ++p } - if (data[i] === 0x26/* & */) { - idxamp = i - break - } - if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) { - this._hitLimit = true - break - } else if (this._checkingBytes) { ++this._bytesVal } - } +/***/ }), - if (idxamp !== undefined) { - ++this._fields - if (idxamp > p) { this._val += this.decoder.write(data.toString('binary', p, idxamp)) } - this.boy.emit('field', decodeText(this._key, 'binary', this.charset), - decodeText(this._val, 'binary', this.charset), - this._keyTrunc, - this._valTrunc) - this._state = 'key' +/***/ 51393: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - this._hitLimit = false - this._checkingBytes = true - this._key = '' - this._bytesKey = 0 - this._keyTrunc = false - this.decoder.reset() +"use strict"; - p = idxamp + 1 - if (this._fields === this.fieldsLimit) { return cb() } - } else if (this._hitLimit) { - // we may not have hit the actual limit if there are encoded bytes... - if (i > p) { this._val += this.decoder.write(data.toString('binary', p, i)) } - p = i - if ((this._val === '' && this.fieldSizeLimit === 0) || - (this._bytesVal = this._val.length) === this.fieldSizeLimit) { - // yep, we actually did hit the limit - this._checkingBytes = false - this._valTrunc = true +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.formDataPolicyName = void 0; +exports.formDataPolicy = formDataPolicy; +const bytesEncoding_js_1 = __nccwpck_require__(88943); +const checkEnvironment_js_1 = __nccwpck_require__(94121); +const httpHeaders_js_1 = __nccwpck_require__(66816); +/** + * The programmatic identifier of the formDataPolicy. + */ +exports.formDataPolicyName = "formDataPolicy"; +function formDataToFormDataMap(formData) { + const formDataMap = {}; + for (const [key, value] of formData.entries()) { + formDataMap[key] ??= []; + formDataMap[key].push(value); + } + return formDataMap; +} +/** + * A policy that encodes FormData on the request into the body. + */ +function formDataPolicy() { + return { + name: exports.formDataPolicyName, + async sendRequest(request, next) { + if (checkEnvironment_js_1.isNodeLike && typeof FormData !== "undefined" && request.body instanceof FormData) { + request.formData = formDataToFormDataMap(request.body); + request.body = undefined; + } + if (request.formData) { + const contentType = request.headers.get("Content-Type"); + if (contentType && contentType.indexOf("application/x-www-form-urlencoded") !== -1) { + request.body = wwwFormUrlEncode(request.formData); + } + else { + await prepareFormData(request.formData, request); + } + request.formData = undefined; + } + return next(request); + }, + }; +} +function wwwFormUrlEncode(formData) { + const urlSearchParams = new URLSearchParams(); + for (const [key, value] of Object.entries(formData)) { + if (Array.isArray(value)) { + for (const subValue of value) { + urlSearchParams.append(key, subValue.toString()); + } + } + else { + urlSearchParams.append(key, value.toString()); } - } else { - if (p < len) { this._val += this.decoder.write(data.toString('binary', p)) } - p = len - } } - } - cb() + return urlSearchParams.toString(); +} +async function prepareFormData(formData, request) { + // validate content type (multipart/form-data) + const contentType = request.headers.get("Content-Type"); + if (contentType && !contentType.startsWith("multipart/form-data")) { + // content type is specified and is not multipart/form-data. Exit. + return; + } + request.headers.set("Content-Type", contentType ?? "multipart/form-data"); + // set body to MultipartRequestBody using content from FormDataMap + const parts = []; + for (const [fieldName, values] of Object.entries(formData)) { + for (const value of Array.isArray(values) ? values : [values]) { + if (typeof value === "string") { + parts.push({ + headers: (0, httpHeaders_js_1.createHttpHeaders)({ + "Content-Disposition": `form-data; name="${fieldName}"`, + }), + body: (0, bytesEncoding_js_1.stringToUint8Array)(value, "utf-8"), + }); + } + else if (value === undefined || value === null || typeof value !== "object") { + throw new Error(`Unexpected value for key ${fieldName}: ${value}. Value should be serialized to string first.`); + } + else { + // using || instead of ?? here since if value.name is empty we should create a file name + const fileName = value.name || "blob"; + const headers = (0, httpHeaders_js_1.createHttpHeaders)(); + headers.set("Content-Disposition", `form-data; name="${fieldName}"; filename="${fileName}"`); + // again, || is used since an empty value.type means the content type is unset + headers.set("Content-Type", value.type || "application/octet-stream"); + parts.push({ + headers, + body: value, + }); + } + } + } + request.multipartBody = { parts }; } +//# sourceMappingURL=formDataPolicy.js.map -UrlEncoded.prototype.end = function () { - if (this.boy._done) { return } +/***/ }), - if (this._state === 'key' && this._key.length > 0) { - this.boy.emit('field', decodeText(this._key, 'binary', this.charset), - '', - this._keyTrunc, - false) - } else if (this._state === 'val') { - this.boy.emit('field', decodeText(this._key, 'binary', this.charset), - decodeText(this._val, 'binary', this.charset), - this._keyTrunc, - this._valTrunc) - } - this.boy._done = true - this.boy.emit('finish') -} +/***/ 81914: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -module.exports = UrlEncoded +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.userAgentPolicyName = exports.userAgentPolicy = exports.tlsPolicyName = exports.tlsPolicy = exports.redirectPolicyName = exports.redirectPolicy = exports.getDefaultProxySettings = exports.proxyPolicyName = exports.proxyPolicy = exports.multipartPolicyName = exports.multipartPolicy = exports.logPolicyName = exports.logPolicy = exports.formDataPolicyName = exports.formDataPolicy = exports.throttlingRetryPolicyName = exports.throttlingRetryPolicy = exports.systemErrorRetryPolicyName = exports.systemErrorRetryPolicy = exports.retryPolicy = exports.exponentialRetryPolicyName = exports.exponentialRetryPolicy = exports.defaultRetryPolicyName = exports.defaultRetryPolicy = exports.decompressResponsePolicyName = exports.decompressResponsePolicy = exports.agentPolicyName = exports.agentPolicy = void 0; +var agentPolicy_js_1 = __nccwpck_require__(73398); +Object.defineProperty(exports, "agentPolicy", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicy; } })); +Object.defineProperty(exports, "agentPolicyName", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicyName; } })); +var decompressResponsePolicy_js_1 = __nccwpck_require__(74162); +Object.defineProperty(exports, "decompressResponsePolicy", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicy; } })); +Object.defineProperty(exports, "decompressResponsePolicyName", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicyName; } })); +var defaultRetryPolicy_js_1 = __nccwpck_require__(20297); +Object.defineProperty(exports, "defaultRetryPolicy", ({ enumerable: true, get: function () { return defaultRetryPolicy_js_1.defaultRetryPolicy; } })); +Object.defineProperty(exports, "defaultRetryPolicyName", ({ enumerable: true, get: function () { return defaultRetryPolicy_js_1.defaultRetryPolicyName; } })); +var exponentialRetryPolicy_js_1 = __nccwpck_require__(46313); +Object.defineProperty(exports, "exponentialRetryPolicy", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicy; } })); +Object.defineProperty(exports, "exponentialRetryPolicyName", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicyName; } })); +var retryPolicy_js_1 = __nccwpck_require__(27729); +Object.defineProperty(exports, "retryPolicy", ({ enumerable: true, get: function () { return retryPolicy_js_1.retryPolicy; } })); +var systemErrorRetryPolicy_js_1 = __nccwpck_require__(32738); +Object.defineProperty(exports, "systemErrorRetryPolicy", ({ enumerable: true, get: function () { return systemErrorRetryPolicy_js_1.systemErrorRetryPolicy; } })); +Object.defineProperty(exports, "systemErrorRetryPolicyName", ({ enumerable: true, get: function () { return systemErrorRetryPolicy_js_1.systemErrorRetryPolicyName; } })); +var throttlingRetryPolicy_js_1 = __nccwpck_require__(92337); +Object.defineProperty(exports, "throttlingRetryPolicy", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicy; } })); +Object.defineProperty(exports, "throttlingRetryPolicyName", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicyName; } })); +var formDataPolicy_js_1 = __nccwpck_require__(51393); +Object.defineProperty(exports, "formDataPolicy", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicy; } })); +Object.defineProperty(exports, "formDataPolicyName", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicyName; } })); +var logPolicy_js_1 = __nccwpck_require__(71610); +Object.defineProperty(exports, "logPolicy", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicy; } })); +Object.defineProperty(exports, "logPolicyName", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicyName; } })); +var multipartPolicy_js_1 = __nccwpck_require__(95316); +Object.defineProperty(exports, "multipartPolicy", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicy; } })); +Object.defineProperty(exports, "multipartPolicyName", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicyName; } })); +var proxyPolicy_js_1 = __nccwpck_require__(57954); +Object.defineProperty(exports, "proxyPolicy", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicy; } })); +Object.defineProperty(exports, "proxyPolicyName", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicyName; } })); +Object.defineProperty(exports, "getDefaultProxySettings", ({ enumerable: true, get: function () { return proxyPolicy_js_1.getDefaultProxySettings; } })); +var redirectPolicy_js_1 = __nccwpck_require__(45125); +Object.defineProperty(exports, "redirectPolicy", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicy; } })); +Object.defineProperty(exports, "redirectPolicyName", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicyName; } })); +var tlsPolicy_js_1 = __nccwpck_require__(24655); +Object.defineProperty(exports, "tlsPolicy", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicy; } })); +Object.defineProperty(exports, "tlsPolicyName", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicyName; } })); +var userAgentPolicy_js_1 = __nccwpck_require__(35402); +Object.defineProperty(exports, "userAgentPolicy", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicy; } })); +Object.defineProperty(exports, "userAgentPolicyName", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicyName; } })); +//# sourceMappingURL=internal.js.map /***/ }), -/***/ 27100: -/***/ ((module) => { +/***/ 71610: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.logPolicyName = void 0; +exports.logPolicy = logPolicy; +const log_js_1 = __nccwpck_require__(85930); +const sanitizer_js_1 = __nccwpck_require__(61416); +/** + * The programmatic identifier of the logPolicy. + */ +exports.logPolicyName = "logPolicy"; +/** + * A policy that logs all requests and responses. + * @param options - Options to configure logPolicy. + */ +function logPolicy(options = {}) { + const logger = options.logger ?? log_js_1.logger.info; + const sanitizer = new sanitizer_js_1.Sanitizer({ + additionalAllowedHeaderNames: options.additionalAllowedHeaderNames, + additionalAllowedQueryParameters: options.additionalAllowedQueryParameters, + }); + return { + name: exports.logPolicyName, + async sendRequest(request, next) { + if (!logger.enabled) { + return next(request); + } + logger(`Request: ${sanitizer.sanitize(request)}`); + const response = await next(request); + logger(`Response status code: ${response.status}`); + logger(`Headers: ${sanitizer.sanitize(response.headers)}`); + return response; + }, + }; +} +//# sourceMappingURL=logPolicy.js.map -const RE_PLUS = /\+/g +/***/ }), -const HEX = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -] +/***/ 95316: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -function Decoder () { - this.buffer = undefined +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.multipartPolicyName = void 0; +exports.multipartPolicy = multipartPolicy; +const bytesEncoding_js_1 = __nccwpck_require__(88943); +const typeGuards_js_1 = __nccwpck_require__(61580); +const uuidUtils_js_1 = __nccwpck_require__(2339); +const concat_js_1 = __nccwpck_require__(96494); +function generateBoundary() { + return `----AzSDKFormBoundary${(0, uuidUtils_js_1.randomUUID)()}`; } -Decoder.prototype.write = function (str) { - // Replace '+' with ' ' before decoding - str = str.replace(RE_PLUS, ' ') - let res = '' - let i = 0; let p = 0; const len = str.length - for (; i < len; ++i) { - if (this.buffer !== undefined) { - if (!HEX[str.charCodeAt(i)]) { - res += '%' + this.buffer - this.buffer = undefined - --i // retry character - } else { - this.buffer += str[i] - ++p - if (this.buffer.length === 2) { - res += String.fromCharCode(parseInt(this.buffer, 16)) - this.buffer = undefined +function encodeHeaders(headers) { + let result = ""; + for (const [key, value] of headers) { + result += `${key}: ${value}\r\n`; + } + return result; +} +function getLength(source) { + if (source instanceof Uint8Array) { + return source.byteLength; + } + else if ((0, typeGuards_js_1.isBlob)(source)) { + // if was created using createFile then -1 means we have an unknown size + return source.size === -1 ? undefined : source.size; + } + else { + return undefined; + } +} +function getTotalLength(sources) { + let total = 0; + for (const source of sources) { + const partLength = getLength(source); + if (partLength === undefined) { + return undefined; + } + else { + total += partLength; } - } - } else if (str[i] === '%') { - if (i > p) { - res += str.substring(p, i) - p = i - } - this.buffer = '' - ++p } - } - if (p < len && this.buffer === undefined) { res += str.substring(p) } - return res + return total; } -Decoder.prototype.reset = function () { - this.buffer = undefined +async function buildRequestBody(request, parts, boundary) { + const sources = [ + (0, bytesEncoding_js_1.stringToUint8Array)(`--${boundary}`, "utf-8"), + ...parts.flatMap((part) => [ + (0, bytesEncoding_js_1.stringToUint8Array)("\r\n", "utf-8"), + (0, bytesEncoding_js_1.stringToUint8Array)(encodeHeaders(part.headers), "utf-8"), + (0, bytesEncoding_js_1.stringToUint8Array)("\r\n", "utf-8"), + part.body, + (0, bytesEncoding_js_1.stringToUint8Array)(`\r\n--${boundary}`, "utf-8"), + ]), + (0, bytesEncoding_js_1.stringToUint8Array)("--\r\n\r\n", "utf-8"), + ]; + const contentLength = getTotalLength(sources); + if (contentLength) { + request.headers.set("Content-Length", contentLength); + } + request.body = await (0, concat_js_1.concat)(sources); } - -module.exports = Decoder - - -/***/ }), - -/***/ 48647: -/***/ ((module) => { - -"use strict"; - - -module.exports = function basename (path) { - if (typeof path !== 'string') { return '' } - for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var - switch (path.charCodeAt(i)) { - case 0x2F: // '/' - case 0x5C: // '\' - path = path.slice(i + 1) - return (path === '..' || path === '.' ? '' : path) +/** + * Name of multipart policy + */ +exports.multipartPolicyName = "multipartPolicy"; +const maxBoundaryLength = 70; +const validBoundaryCharacters = new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`); +function assertValidBoundary(boundary) { + if (boundary.length > maxBoundaryLength) { + throw new Error(`Multipart boundary "${boundary}" exceeds maximum length of 70 characters`); + } + if (Array.from(boundary).some((x) => !validBoundaryCharacters.has(x))) { + throw new Error(`Multipart boundary "${boundary}" contains invalid characters`); } - } - return (path === '..' || path === '.' ? '' : path) } - +/** + * Pipeline policy for multipart requests + */ +function multipartPolicy() { + return { + name: exports.multipartPolicyName, + async sendRequest(request, next) { + if (!request.multipartBody) { + return next(request); + } + if (request.body) { + throw new Error("multipartBody and regular body cannot be set at the same time"); + } + let boundary = request.multipartBody.boundary; + const contentTypeHeader = request.headers.get("Content-Type") ?? "multipart/mixed"; + const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/); + if (!parsedHeader) { + throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`); + } + const [, contentType, parsedBoundary] = parsedHeader; + if (parsedBoundary && boundary && parsedBoundary !== boundary) { + throw new Error(`Multipart boundary was specified as ${parsedBoundary} in the header, but got ${boundary} in the request body`); + } + boundary ??= parsedBoundary; + if (boundary) { + assertValidBoundary(boundary); + } + else { + boundary = generateBoundary(); + } + request.headers.set("Content-Type", `${contentType}; boundary=${boundary}`); + await buildRequestBody(request, request.multipartBody.parts, boundary); + request.multipartBody = undefined; + return next(request); + }, + }; +} +//# sourceMappingURL=multipartPolicy.js.map /***/ }), -/***/ 84619: -/***/ (function(module) { +/***/ 57954: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -// Node has always utf-8 -const utf8Decoder = new TextDecoder('utf-8') -const textDecoders = new Map([ - ['utf-8', utf8Decoder], - ['utf8', utf8Decoder] -]) - -function getDecoder (charset) { - let lc - while (true) { - switch (charset) { - case 'utf-8': - case 'utf8': - return decoders.utf8 - case 'latin1': - case 'ascii': // TODO: Make these a separate, strict decoder? - case 'us-ascii': - case 'iso-8859-1': - case 'iso8859-1': - case 'iso88591': - case 'iso_8859-1': - case 'windows-1252': - case 'iso_8859-1:1987': - case 'cp1252': - case 'x-cp1252': - return decoders.latin1 - case 'utf16le': - case 'utf-16le': - case 'ucs2': - case 'ucs-2': - return decoders.utf16le - case 'base64': - return decoders.base64 - default: - if (lc === undefined) { - lc = true - charset = charset.toLowerCase() - continue - } - return decoders.other.bind(charset) +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.globalNoProxyList = exports.proxyPolicyName = void 0; +exports.loadNoProxy = loadNoProxy; +exports.getDefaultProxySettings = getDefaultProxySettings; +exports.proxyPolicy = proxyPolicy; +const https_proxy_agent_1 = __nccwpck_require__(77219); +const http_proxy_agent_1 = __nccwpck_require__(23764); +const log_js_1 = __nccwpck_require__(85930); +const HTTPS_PROXY = "HTTPS_PROXY"; +const HTTP_PROXY = "HTTP_PROXY"; +const ALL_PROXY = "ALL_PROXY"; +const NO_PROXY = "NO_PROXY"; +/** + * The programmatic identifier of the proxyPolicy. + */ +exports.proxyPolicyName = "proxyPolicy"; +/** + * Stores the patterns specified in NO_PROXY environment variable. + * @internal + */ +exports.globalNoProxyList = []; +let noProxyListLoaded = false; +/** A cache of whether a host should bypass the proxy. */ +const globalBypassedMap = new Map(); +function getEnvironmentValue(name) { + if (process.env[name]) { + return process.env[name]; } - } + else if (process.env[name.toLowerCase()]) { + return process.env[name.toLowerCase()]; + } + return undefined; } - -const decoders = { - utf8: (data, sourceEncoding) => { - if (data.length === 0) { - return '' +function loadEnvironmentProxyValue() { + if (!process) { + return undefined; } - if (typeof data === 'string') { - data = Buffer.from(data, sourceEncoding) + const httpsProxy = getEnvironmentValue(HTTPS_PROXY); + const allProxy = getEnvironmentValue(ALL_PROXY); + const httpProxy = getEnvironmentValue(HTTP_PROXY); + return httpsProxy || allProxy || httpProxy; +} +/** + * Check whether the host of a given `uri` matches any pattern in the no proxy list. + * If there's a match, any request sent to the same host shouldn't have the proxy settings set. + * This implementation is a port of https://github.com/Azure/azure-sdk-for-net/blob/8cca811371159e527159c7eb65602477898683e2/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs#L210 + */ +function isBypassed(uri, noProxyList, bypassedMap) { + if (noProxyList.length === 0) { + return false; } - return data.utf8Slice(0, data.length) - }, - - latin1: (data, sourceEncoding) => { - if (data.length === 0) { - return '' + const host = new URL(uri).hostname; + if (bypassedMap?.has(host)) { + return bypassedMap.get(host); + } + let isBypassedFlag = false; + for (const pattern of noProxyList) { + if (pattern[0] === ".") { + // This should match either domain it self or any subdomain or host + // .foo.com will match foo.com it self or *.foo.com + if (host.endsWith(pattern)) { + isBypassedFlag = true; + } + else { + if (host.length === pattern.length - 1 && host === pattern.slice(1)) { + isBypassedFlag = true; + } + } + } + else { + if (host === pattern) { + isBypassedFlag = true; + } + } + } + bypassedMap?.set(host, isBypassedFlag); + return isBypassedFlag; +} +function loadNoProxy() { + const noProxy = getEnvironmentValue(NO_PROXY); + noProxyListLoaded = true; + if (noProxy) { + return noProxy + .split(",") + .map((item) => item.trim()) + .filter((item) => item.length); + } + return []; +} +/** + * This method converts a proxy url into `ProxySettings` for use with ProxyPolicy. + * If no argument is given, it attempts to parse a proxy URL from the environment + * variables `HTTPS_PROXY` or `HTTP_PROXY`. + * @param proxyUrl - The url of the proxy to use. May contain authentication information. + * @deprecated - Internally this method is no longer necessary when setting proxy information. + */ +function getDefaultProxySettings(proxyUrl) { + if (!proxyUrl) { + proxyUrl = loadEnvironmentProxyValue(); + if (!proxyUrl) { + return undefined; + } } - if (typeof data === 'string') { - return data + const parsedUrl = new URL(proxyUrl); + const schema = parsedUrl.protocol ? parsedUrl.protocol + "//" : ""; + return { + host: schema + parsedUrl.hostname, + port: Number.parseInt(parsedUrl.port || "80"), + username: parsedUrl.username, + password: parsedUrl.password, + }; +} +/** + * This method attempts to parse a proxy URL from the environment + * variables `HTTPS_PROXY` or `HTTP_PROXY`. + */ +function getDefaultProxySettingsInternal() { + const envProxy = loadEnvironmentProxyValue(); + return envProxy ? new URL(envProxy) : undefined; +} +function getUrlFromProxySettings(settings) { + let parsedProxyUrl; + try { + parsedProxyUrl = new URL(settings.host); } - return data.latin1Slice(0, data.length) - }, - - utf16le: (data, sourceEncoding) => { - if (data.length === 0) { - return '' + catch { + throw new Error(`Expecting a valid host string in proxy settings, but found "${settings.host}".`); } - if (typeof data === 'string') { - data = Buffer.from(data, sourceEncoding) + parsedProxyUrl.port = String(settings.port); + if (settings.username) { + parsedProxyUrl.username = settings.username; } - return data.ucs2Slice(0, data.length) - }, - - base64: (data, sourceEncoding) => { - if (data.length === 0) { - return '' + if (settings.password) { + parsedProxyUrl.password = settings.password; } - if (typeof data === 'string') { - data = Buffer.from(data, sourceEncoding) + return parsedProxyUrl; +} +function setProxyAgentOnRequest(request, cachedAgents, proxyUrl) { + // Custom Agent should take precedence so if one is present + // we should skip to avoid overwriting it. + if (request.agent) { + return; } - return data.base64Slice(0, data.length) - }, - - other: (data, sourceEncoding) => { - if (data.length === 0) { - return '' + const url = new URL(request.url); + const isInsecure = url.protocol !== "https:"; + if (request.tlsSettings) { + log_js_1.logger.warning("TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored."); } - if (typeof data === 'string') { - data = Buffer.from(data, sourceEncoding) + const headers = request.headers.toJSON(); + if (isInsecure) { + if (!cachedAgents.httpProxyAgent) { + cachedAgents.httpProxyAgent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl, { headers }); + } + request.agent = cachedAgents.httpProxyAgent; } - - if (textDecoders.has(this.toString())) { - try { - return textDecoders.get(this).decode(data) - } catch (e) { } + else { + if (!cachedAgents.httpsProxyAgent) { + cachedAgents.httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, { headers }); + } + request.agent = cachedAgents.httpsProxyAgent; } - return typeof data === 'string' - ? data - : data.toString() - } } - -function decodeText (text, sourceEncoding, destEncoding) { - if (text) { - return getDecoder(destEncoding)(text, sourceEncoding) - } - return text +/** + * A policy that allows one to apply proxy settings to all requests. + * If not passed static settings, they will be retrieved from the HTTPS_PROXY + * or HTTP_PROXY environment variables. + * @param proxySettings - ProxySettings to use on each request. + * @param options - additional settings, for example, custom NO_PROXY patterns + */ +function proxyPolicy(proxySettings, options) { + if (!noProxyListLoaded) { + exports.globalNoProxyList.push(...loadNoProxy()); + } + const defaultProxy = proxySettings + ? getUrlFromProxySettings(proxySettings) + : getDefaultProxySettingsInternal(); + const cachedAgents = {}; + return { + name: exports.proxyPolicyName, + async sendRequest(request, next) { + if (!request.proxySettings && + defaultProxy && + !isBypassed(request.url, options?.customNoProxyList ?? exports.globalNoProxyList, options?.customNoProxyList ? undefined : globalBypassedMap)) { + setProxyAgentOnRequest(request, cachedAgents, defaultProxy); + } + else if (request.proxySettings) { + setProxyAgentOnRequest(request, cachedAgents, getUrlFromProxySettings(request.proxySettings)); + } + return next(request); + }, + }; } - -module.exports = decodeText - +//# sourceMappingURL=proxyPolicy.js.map /***/ }), -/***/ 21467: -/***/ ((module) => { +/***/ 45125: +/***/ ((__unused_webpack_module, exports) => { "use strict"; - -module.exports = function getLimit (limits, name, defaultLimit) { - if ( - !limits || - limits[name] === undefined || - limits[name] === null - ) { return defaultLimit } - - if ( - typeof limits[name] !== 'number' || - isNaN(limits[name]) - ) { throw new TypeError('Limit ' + name + ' is not a valid number') } - - return limits[name] +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.redirectPolicyName = void 0; +exports.redirectPolicy = redirectPolicy; +/** + * The programmatic identifier of the redirectPolicy. + */ +exports.redirectPolicyName = "redirectPolicy"; +/** + * Methods that are allowed to follow redirects 301 and 302 + */ +const allowedRedirect = ["GET", "HEAD"]; +/** + * A policy to follow Location headers from the server in order + * to support server-side redirection. + * In the browser, this policy is not used. + * @param options - Options to control policy behavior. + */ +function redirectPolicy(options = {}) { + const { maxRetries = 20 } = options; + return { + name: exports.redirectPolicyName, + async sendRequest(request, next) { + const response = await next(request); + return handleRedirect(next, response, maxRetries); + }, + }; } - +async function handleRedirect(next, response, maxRetries, currentRetries = 0) { + const { request, status, headers } = response; + const locationHeader = headers.get("location"); + if (locationHeader && + (status === 300 || + (status === 301 && allowedRedirect.includes(request.method)) || + (status === 302 && allowedRedirect.includes(request.method)) || + (status === 303 && request.method === "POST") || + status === 307) && + currentRetries < maxRetries) { + const url = new URL(locationHeader, request.url); + request.url = url.toString(); + // POST request with Status code 303 should be converted into a + // redirected GET request if the redirect url is present in the location header + if (status === 303) { + request.method = "GET"; + request.headers.delete("Content-Length"); + delete request.body; + } + request.headers.delete("Authorization"); + const res = await next(request); + return handleRedirect(next, res, maxRetries, currentRetries + 1); + } + return response; +} +//# sourceMappingURL=redirectPolicy.js.map /***/ }), -/***/ 31854: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +/***/ 27729: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -/* eslint-disable object-property-newline */ - - -const decodeText = __nccwpck_require__(84619) - -const RE_ENCODED = /%[a-fA-F0-9][a-fA-F0-9]/g - -const EncodedLookup = { - '%00': '\x00', '%01': '\x01', '%02': '\x02', '%03': '\x03', '%04': '\x04', - '%05': '\x05', '%06': '\x06', '%07': '\x07', '%08': '\x08', '%09': '\x09', - '%0a': '\x0a', '%0A': '\x0a', '%0b': '\x0b', '%0B': '\x0b', '%0c': '\x0c', - '%0C': '\x0c', '%0d': '\x0d', '%0D': '\x0d', '%0e': '\x0e', '%0E': '\x0e', - '%0f': '\x0f', '%0F': '\x0f', '%10': '\x10', '%11': '\x11', '%12': '\x12', - '%13': '\x13', '%14': '\x14', '%15': '\x15', '%16': '\x16', '%17': '\x17', - '%18': '\x18', '%19': '\x19', '%1a': '\x1a', '%1A': '\x1a', '%1b': '\x1b', - '%1B': '\x1b', '%1c': '\x1c', '%1C': '\x1c', '%1d': '\x1d', '%1D': '\x1d', - '%1e': '\x1e', '%1E': '\x1e', '%1f': '\x1f', '%1F': '\x1f', '%20': '\x20', - '%21': '\x21', '%22': '\x22', '%23': '\x23', '%24': '\x24', '%25': '\x25', - '%26': '\x26', '%27': '\x27', '%28': '\x28', '%29': '\x29', '%2a': '\x2a', - '%2A': '\x2a', '%2b': '\x2b', '%2B': '\x2b', '%2c': '\x2c', '%2C': '\x2c', - '%2d': '\x2d', '%2D': '\x2d', '%2e': '\x2e', '%2E': '\x2e', '%2f': '\x2f', - '%2F': '\x2f', '%30': '\x30', '%31': '\x31', '%32': '\x32', '%33': '\x33', - '%34': '\x34', '%35': '\x35', '%36': '\x36', '%37': '\x37', '%38': '\x38', - '%39': '\x39', '%3a': '\x3a', '%3A': '\x3a', '%3b': '\x3b', '%3B': '\x3b', - '%3c': '\x3c', '%3C': '\x3c', '%3d': '\x3d', '%3D': '\x3d', '%3e': '\x3e', - '%3E': '\x3e', '%3f': '\x3f', '%3F': '\x3f', '%40': '\x40', '%41': '\x41', - '%42': '\x42', '%43': '\x43', '%44': '\x44', '%45': '\x45', '%46': '\x46', - '%47': '\x47', '%48': '\x48', '%49': '\x49', '%4a': '\x4a', '%4A': '\x4a', - '%4b': '\x4b', '%4B': '\x4b', '%4c': '\x4c', '%4C': '\x4c', '%4d': '\x4d', - '%4D': '\x4d', '%4e': '\x4e', '%4E': '\x4e', '%4f': '\x4f', '%4F': '\x4f', - '%50': '\x50', '%51': '\x51', '%52': '\x52', '%53': '\x53', '%54': '\x54', - '%55': '\x55', '%56': '\x56', '%57': '\x57', '%58': '\x58', '%59': '\x59', - '%5a': '\x5a', '%5A': '\x5a', '%5b': '\x5b', '%5B': '\x5b', '%5c': '\x5c', - '%5C': '\x5c', '%5d': '\x5d', '%5D': '\x5d', '%5e': '\x5e', '%5E': '\x5e', - '%5f': '\x5f', '%5F': '\x5f', '%60': '\x60', '%61': '\x61', '%62': '\x62', - '%63': '\x63', '%64': '\x64', '%65': '\x65', '%66': '\x66', '%67': '\x67', - '%68': '\x68', '%69': '\x69', '%6a': '\x6a', '%6A': '\x6a', '%6b': '\x6b', - '%6B': '\x6b', '%6c': '\x6c', '%6C': '\x6c', '%6d': '\x6d', '%6D': '\x6d', - '%6e': '\x6e', '%6E': '\x6e', '%6f': '\x6f', '%6F': '\x6f', '%70': '\x70', - '%71': '\x71', '%72': '\x72', '%73': '\x73', '%74': '\x74', '%75': '\x75', - '%76': '\x76', '%77': '\x77', '%78': '\x78', '%79': '\x79', '%7a': '\x7a', - '%7A': '\x7a', '%7b': '\x7b', '%7B': '\x7b', '%7c': '\x7c', '%7C': '\x7c', - '%7d': '\x7d', '%7D': '\x7d', '%7e': '\x7e', '%7E': '\x7e', '%7f': '\x7f', - '%7F': '\x7f', '%80': '\x80', '%81': '\x81', '%82': '\x82', '%83': '\x83', - '%84': '\x84', '%85': '\x85', '%86': '\x86', '%87': '\x87', '%88': '\x88', - '%89': '\x89', '%8a': '\x8a', '%8A': '\x8a', '%8b': '\x8b', '%8B': '\x8b', - '%8c': '\x8c', '%8C': '\x8c', '%8d': '\x8d', '%8D': '\x8d', '%8e': '\x8e', - '%8E': '\x8e', '%8f': '\x8f', '%8F': '\x8f', '%90': '\x90', '%91': '\x91', - '%92': '\x92', '%93': '\x93', '%94': '\x94', '%95': '\x95', '%96': '\x96', - '%97': '\x97', '%98': '\x98', '%99': '\x99', '%9a': '\x9a', '%9A': '\x9a', - '%9b': '\x9b', '%9B': '\x9b', '%9c': '\x9c', '%9C': '\x9c', '%9d': '\x9d', - '%9D': '\x9d', '%9e': '\x9e', '%9E': '\x9e', '%9f': '\x9f', '%9F': '\x9f', - '%a0': '\xa0', '%A0': '\xa0', '%a1': '\xa1', '%A1': '\xa1', '%a2': '\xa2', - '%A2': '\xa2', '%a3': '\xa3', '%A3': '\xa3', '%a4': '\xa4', '%A4': '\xa4', - '%a5': '\xa5', '%A5': '\xa5', '%a6': '\xa6', '%A6': '\xa6', '%a7': '\xa7', - '%A7': '\xa7', '%a8': '\xa8', '%A8': '\xa8', '%a9': '\xa9', '%A9': '\xa9', - '%aa': '\xaa', '%Aa': '\xaa', '%aA': '\xaa', '%AA': '\xaa', '%ab': '\xab', - '%Ab': '\xab', '%aB': '\xab', '%AB': '\xab', '%ac': '\xac', '%Ac': '\xac', - '%aC': '\xac', '%AC': '\xac', '%ad': '\xad', '%Ad': '\xad', '%aD': '\xad', - '%AD': '\xad', '%ae': '\xae', '%Ae': '\xae', '%aE': '\xae', '%AE': '\xae', - '%af': '\xaf', '%Af': '\xaf', '%aF': '\xaf', '%AF': '\xaf', '%b0': '\xb0', - '%B0': '\xb0', '%b1': '\xb1', '%B1': '\xb1', '%b2': '\xb2', '%B2': '\xb2', - '%b3': '\xb3', '%B3': '\xb3', '%b4': '\xb4', '%B4': '\xb4', '%b5': '\xb5', - '%B5': '\xb5', '%b6': '\xb6', '%B6': '\xb6', '%b7': '\xb7', '%B7': '\xb7', - '%b8': '\xb8', '%B8': '\xb8', '%b9': '\xb9', '%B9': '\xb9', '%ba': '\xba', - '%Ba': '\xba', '%bA': '\xba', '%BA': '\xba', '%bb': '\xbb', '%Bb': '\xbb', - '%bB': '\xbb', '%BB': '\xbb', '%bc': '\xbc', '%Bc': '\xbc', '%bC': '\xbc', - '%BC': '\xbc', '%bd': '\xbd', '%Bd': '\xbd', '%bD': '\xbd', '%BD': '\xbd', - '%be': '\xbe', '%Be': '\xbe', '%bE': '\xbe', '%BE': '\xbe', '%bf': '\xbf', - '%Bf': '\xbf', '%bF': '\xbf', '%BF': '\xbf', '%c0': '\xc0', '%C0': '\xc0', - '%c1': '\xc1', '%C1': '\xc1', '%c2': '\xc2', '%C2': '\xc2', '%c3': '\xc3', - '%C3': '\xc3', '%c4': '\xc4', '%C4': '\xc4', '%c5': '\xc5', '%C5': '\xc5', - '%c6': '\xc6', '%C6': '\xc6', '%c7': '\xc7', '%C7': '\xc7', '%c8': '\xc8', - '%C8': '\xc8', '%c9': '\xc9', '%C9': '\xc9', '%ca': '\xca', '%Ca': '\xca', - '%cA': '\xca', '%CA': '\xca', '%cb': '\xcb', '%Cb': '\xcb', '%cB': '\xcb', - '%CB': '\xcb', '%cc': '\xcc', '%Cc': '\xcc', '%cC': '\xcc', '%CC': '\xcc', - '%cd': '\xcd', '%Cd': '\xcd', '%cD': '\xcd', '%CD': '\xcd', '%ce': '\xce', - '%Ce': '\xce', '%cE': '\xce', '%CE': '\xce', '%cf': '\xcf', '%Cf': '\xcf', - '%cF': '\xcf', '%CF': '\xcf', '%d0': '\xd0', '%D0': '\xd0', '%d1': '\xd1', - '%D1': '\xd1', '%d2': '\xd2', '%D2': '\xd2', '%d3': '\xd3', '%D3': '\xd3', - '%d4': '\xd4', '%D4': '\xd4', '%d5': '\xd5', '%D5': '\xd5', '%d6': '\xd6', - '%D6': '\xd6', '%d7': '\xd7', '%D7': '\xd7', '%d8': '\xd8', '%D8': '\xd8', - '%d9': '\xd9', '%D9': '\xd9', '%da': '\xda', '%Da': '\xda', '%dA': '\xda', - '%DA': '\xda', '%db': '\xdb', '%Db': '\xdb', '%dB': '\xdb', '%DB': '\xdb', - '%dc': '\xdc', '%Dc': '\xdc', '%dC': '\xdc', '%DC': '\xdc', '%dd': '\xdd', - '%Dd': '\xdd', '%dD': '\xdd', '%DD': '\xdd', '%de': '\xde', '%De': '\xde', - '%dE': '\xde', '%DE': '\xde', '%df': '\xdf', '%Df': '\xdf', '%dF': '\xdf', - '%DF': '\xdf', '%e0': '\xe0', '%E0': '\xe0', '%e1': '\xe1', '%E1': '\xe1', - '%e2': '\xe2', '%E2': '\xe2', '%e3': '\xe3', '%E3': '\xe3', '%e4': '\xe4', - '%E4': '\xe4', '%e5': '\xe5', '%E5': '\xe5', '%e6': '\xe6', '%E6': '\xe6', - '%e7': '\xe7', '%E7': '\xe7', '%e8': '\xe8', '%E8': '\xe8', '%e9': '\xe9', - '%E9': '\xe9', '%ea': '\xea', '%Ea': '\xea', '%eA': '\xea', '%EA': '\xea', - '%eb': '\xeb', '%Eb': '\xeb', '%eB': '\xeb', '%EB': '\xeb', '%ec': '\xec', - '%Ec': '\xec', '%eC': '\xec', '%EC': '\xec', '%ed': '\xed', '%Ed': '\xed', - '%eD': '\xed', '%ED': '\xed', '%ee': '\xee', '%Ee': '\xee', '%eE': '\xee', - '%EE': '\xee', '%ef': '\xef', '%Ef': '\xef', '%eF': '\xef', '%EF': '\xef', - '%f0': '\xf0', '%F0': '\xf0', '%f1': '\xf1', '%F1': '\xf1', '%f2': '\xf2', - '%F2': '\xf2', '%f3': '\xf3', '%F3': '\xf3', '%f4': '\xf4', '%F4': '\xf4', - '%f5': '\xf5', '%F5': '\xf5', '%f6': '\xf6', '%F6': '\xf6', '%f7': '\xf7', - '%F7': '\xf7', '%f8': '\xf8', '%F8': '\xf8', '%f9': '\xf9', '%F9': '\xf9', - '%fa': '\xfa', '%Fa': '\xfa', '%fA': '\xfa', '%FA': '\xfa', '%fb': '\xfb', - '%Fb': '\xfb', '%fB': '\xfb', '%FB': '\xfb', '%fc': '\xfc', '%Fc': '\xfc', - '%fC': '\xfc', '%FC': '\xfc', '%fd': '\xfd', '%Fd': '\xfd', '%fD': '\xfd', - '%FD': '\xfd', '%fe': '\xfe', '%Fe': '\xfe', '%fE': '\xfe', '%FE': '\xfe', - '%ff': '\xff', '%Ff': '\xff', '%fF': '\xff', '%FF': '\xff' -} - -function encodedReplacer (match) { - return EncodedLookup[match] -} - -const STATE_KEY = 0 -const STATE_VALUE = 1 -const STATE_CHARSET = 2 -const STATE_LANG = 3 - -function parseParams (str) { - const res = [] - let state = STATE_KEY - let charset = '' - let inquote = false - let escaping = false - let p = 0 - let tmp = '' - const len = str.length - - for (var i = 0; i < len; ++i) { // eslint-disable-line no-var - const char = str[i] - if (char === '\\' && inquote) { - if (escaping) { escaping = false } else { - escaping = true - continue - } - } else if (char === '"') { - if (!escaping) { - if (inquote) { - inquote = false - state = STATE_KEY - } else { inquote = true } - continue - } else { escaping = false } - } else { - if (escaping && inquote) { tmp += '\\' } - escaping = false - if ((state === STATE_CHARSET || state === STATE_LANG) && char === "'") { - if (state === STATE_CHARSET) { - state = STATE_LANG - charset = tmp.substring(1) - } else { state = STATE_VALUE } - tmp = '' - continue - } else if (state === STATE_KEY && - (char === '*' || char === '=') && - res.length) { - state = char === '*' - ? STATE_CHARSET - : STATE_VALUE - res[p] = [tmp, undefined] - tmp = '' - continue - } else if (!inquote && char === ';') { - state = STATE_KEY - if (charset) { - if (tmp.length) { - tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), - 'binary', - charset) - } - charset = '' - } else if (tmp.length) { - tmp = decodeText(tmp, 'binary', 'utf8') - } - if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp } - tmp = '' - ++p - continue - } else if (!inquote && (char === ' ' || char === '\t')) { continue } - } - tmp += char - } - if (charset && tmp.length) { - tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), - 'binary', - charset) - } else if (tmp) { - tmp = decodeText(tmp, 'binary', 'utf8') - } - - if (res[p] === undefined) { - if (tmp) { res[p] = tmp } - } else { res[p][1] = tmp } - return res +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.retryPolicy = retryPolicy; +const helpers_js_1 = __nccwpck_require__(59842); +const AbortError_js_1 = __nccwpck_require__(72033); +const logger_js_1 = __nccwpck_require__(36720); +const constants_js_1 = __nccwpck_require__(58463); +const retryPolicyLogger = (0, logger_js_1.createClientLogger)("ts-http-runtime retryPolicy"); +/** + * The programmatic identifier of the retryPolicy. + */ +const retryPolicyName = "retryPolicy"; +/** + * retryPolicy is a generic policy to enable retrying requests when certain conditions are met + */ +function retryPolicy(strategies, options = { maxRetries: constants_js_1.DEFAULT_RETRY_POLICY_COUNT }) { + const logger = options.logger || retryPolicyLogger; + return { + name: retryPolicyName, + async sendRequest(request, next) { + let response; + let responseError; + let retryCount = -1; + retryRequest: while (true) { + retryCount += 1; + response = undefined; + responseError = undefined; + try { + logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId); + response = await next(request); + logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId); + } + catch (e) { + logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId); + // RestErrors are valid targets for the retry strategies. + // If none of the retry strategies can work with them, they will be thrown later in this policy. + // If the received error is not a RestError, it is immediately thrown. + responseError = e; + if (!e || responseError.name !== "RestError") { + throw e; + } + response = responseError.response; + } + if (request.abortSignal?.aborted) { + logger.error(`Retry ${retryCount}: Request aborted.`); + const abortError = new AbortError_js_1.AbortError(); + throw abortError; + } + if (retryCount >= (options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT)) { + logger.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`); + if (responseError) { + throw responseError; + } + else if (response) { + return response; + } + else { + throw new Error("Maximum retries reached with no response or error to throw"); + } + } + logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`); + strategiesLoop: for (const strategy of strategies) { + const strategyLogger = strategy.logger || logger; + strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`); + const modifiers = strategy.retry({ + retryCount, + response, + responseError, + }); + if (modifiers.skipStrategy) { + strategyLogger.info(`Retry ${retryCount}: Skipped.`); + continue strategiesLoop; + } + const { errorToThrow, retryAfterInMs, redirectTo } = modifiers; + if (errorToThrow) { + strategyLogger.error(`Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`, errorToThrow); + throw errorToThrow; + } + if (retryAfterInMs || retryAfterInMs === 0) { + strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`); + await (0, helpers_js_1.delay)(retryAfterInMs, undefined, { abortSignal: request.abortSignal }); + continue retryRequest; + } + if (redirectTo) { + strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`); + request.url = redirectTo; + continue retryRequest; + } + } + if (responseError) { + logger.info(`None of the retry strategies could work with the received error. Throwing it.`); + throw responseError; + } + if (response) { + logger.info(`None of the retry strategies could work with the received response. Returning it.`); + return response; + } + // If all the retries skip and there's no response, + // we're still in the retry loop, so a new request will be sent + // until `maxRetries` is reached. + } + }, + }; } - -module.exports = parseParams - +//# sourceMappingURL=retryPolicy.js.map /***/ }), -/***/ 72033: -/***/ ((__unused_webpack_module, exports) => { +/***/ 32738: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.AbortError = void 0; +exports.systemErrorRetryPolicyName = void 0; +exports.systemErrorRetryPolicy = systemErrorRetryPolicy; +const exponentialRetryStrategy_js_1 = __nccwpck_require__(12283); +const retryPolicy_js_1 = __nccwpck_require__(27729); +const constants_js_1 = __nccwpck_require__(58463); /** - * This error is thrown when an asynchronous operation has been aborted. - * Check for this error by testing the `name` that the name property of the - * error matches `"AbortError"`. - * - * @example - * ```ts snippet:ReadmeSampleAbortError - * import { AbortError } from "@typespec/ts-http-runtime"; - * - * async function doAsyncWork(options: { abortSignal: AbortSignal }): Promise { - * if (options.abortSignal.aborted) { - * throw new AbortError(); - * } - * - * // do async work - * } - * - * const controller = new AbortController(); - * controller.abort(); - * - * try { - * doAsyncWork({ abortSignal: controller.signal }); - * } catch (e) { - * if (e instanceof Error && e.name === "AbortError") { - * // handle abort error here. - * } - * } - * ``` + * Name of the {@link systemErrorRetryPolicy} */ -class AbortError extends Error { - constructor(message) { - super(message); - this.name = "AbortError"; - } +exports.systemErrorRetryPolicyName = "systemErrorRetryPolicy"; +/** + * A retry policy that specifically seeks to handle errors in the + * underlying transport layer (e.g. DNS lookup failures) rather than + * retryable error codes from the server itself. + * @param options - Options that customize the policy. + */ +function systemErrorRetryPolicy(options = {}) { + return { + name: exports.systemErrorRetryPolicyName, + sendRequest: (0, retryPolicy_js_1.retryPolicy)([ + (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)({ + ...options, + ignoreHttpStatusCodes: true, + }), + ], { + maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, + }).sendRequest, + }; } -exports.AbortError = AbortError; -//# sourceMappingURL=AbortError.js.map +//# sourceMappingURL=systemErrorRetryPolicy.js.map /***/ }), -/***/ 5630: -/***/ ((__unused_webpack_module, exports) => { +/***/ 92337: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isOAuth2TokenCredential = isOAuth2TokenCredential; -exports.isBearerTokenCredential = isBearerTokenCredential; -exports.isBasicCredential = isBasicCredential; -exports.isApiKeyCredential = isApiKeyCredential; -/** - * Type guard to check if a credential is an OAuth2 token credential. - */ -function isOAuth2TokenCredential(credential) { - return "getOAuth2Token" in credential; -} -/** - * Type guard to check if a credential is a Bearer token credential. - */ -function isBearerTokenCredential(credential) { - return "getBearerToken" in credential; -} +exports.throttlingRetryPolicyName = void 0; +exports.throttlingRetryPolicy = throttlingRetryPolicy; +const throttlingRetryStrategy_js_1 = __nccwpck_require__(90483); +const retryPolicy_js_1 = __nccwpck_require__(27729); +const constants_js_1 = __nccwpck_require__(58463); /** - * Type guard to check if a credential is a Basic auth credential. + * Name of the {@link throttlingRetryPolicy} */ -function isBasicCredential(credential) { - return "username" in credential && "password" in credential; -} +exports.throttlingRetryPolicyName = "throttlingRetryPolicy"; /** - * Type guard to check if a credential is an API key credential. + * A policy that retries when the server sends a 429 response with a Retry-After header. + * + * To learn more, please refer to + * https://learn.microsoft.com/azure/azure-resource-manager/resource-manager-request-limits, + * https://learn.microsoft.com/azure/azure-subscription-service-limits and + * https://learn.microsoft.com/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors + * + * @param options - Options that configure retry logic. */ -function isApiKeyCredential(credential) { - return "key" in credential; +function throttlingRetryPolicy(options = {}) { + return { + name: exports.throttlingRetryPolicyName, + sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)()], { + maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, + }).sendRequest, + }; } -//# sourceMappingURL=credentials.js.map +//# sourceMappingURL=throttlingRetryPolicy.js.map /***/ }), -/***/ 38018: +/***/ 24655: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -126709,57 +120542,170 @@ function isApiKeyCredential(credential) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=oauth2Flows.js.map +exports.tlsPolicyName = void 0; +exports.tlsPolicy = tlsPolicy; +/** + * Name of the TLS Policy + */ +exports.tlsPolicyName = "tlsPolicy"; +/** + * Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication. + */ +function tlsPolicy(tlsSettings) { + return { + name: exports.tlsPolicyName, + sendRequest: async (req, next) => { + // Users may define a request tlsSettings, honor those over the client level one + if (!req.tlsSettings) { + req.tlsSettings = tlsSettings; + } + return next(req); + }, + }; +} +//# sourceMappingURL=tlsPolicy.js.map /***/ }), -/***/ 65546: -/***/ ((__unused_webpack_module, exports) => { +/***/ 35402: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=schemes.js.map +exports.userAgentPolicyName = void 0; +exports.userAgentPolicy = userAgentPolicy; +const userAgent_js_1 = __nccwpck_require__(8192); +const UserAgentHeaderName = (0, userAgent_js_1.getUserAgentHeaderName)(); +/** + * The programmatic identifier of the userAgentPolicy. + */ +exports.userAgentPolicyName = "userAgentPolicy"; +/** + * A policy that sets the User-Agent header (or equivalent) to reflect + * the library version. + * @param options - Options to customize the user agent value. + */ +function userAgentPolicy(options = {}) { + const userAgentValue = (0, userAgent_js_1.getUserAgentValue)(options.userAgentPrefix); + return { + name: exports.userAgentPolicyName, + async sendRequest(request, next) { + if (!request.headers.has(UserAgentHeaderName)) { + request.headers.set(UserAgentHeaderName, await userAgentValue); + } + return next(request); + }, + }; +} +//# sourceMappingURL=userAgentPolicy.js.map /***/ }), -/***/ 51648: -/***/ ((__unused_webpack_module, exports) => { +/***/ 42858: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.apiVersionPolicyName = void 0; -exports.apiVersionPolicy = apiVersionPolicy; -exports.apiVersionPolicyName = "ApiVersionPolicy"; +exports.RestError = void 0; +exports.isRestError = isRestError; +const error_js_1 = __nccwpck_require__(13742); +const inspect_js_1 = __nccwpck_require__(52728); +const sanitizer_js_1 = __nccwpck_require__(61416); +const errorSanitizer = new sanitizer_js_1.Sanitizer(); /** - * Creates a policy that sets the apiVersion as a query parameter on every request - * @param options - Client options - * @returns Pipeline policy that sets the apiVersion as a query parameter on every request + * A custom error type for failed pipeline requests. */ -function apiVersionPolicy(options) { - return { - name: exports.apiVersionPolicyName, - sendRequest: (req, next) => { - // Use the apiVesion defined in request url directly - // Append one if there is no apiVesion and we have one at client options - const url = new URL(req.url); - if (!url.searchParams.get("api-version") && options.apiVersion) { - req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${options.apiVersion}`; +class RestError extends Error { + /** + * Something went wrong when making the request. + * This means the actual request failed for some reason, + * such as a DNS issue or the connection being lost. + */ + static REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR"; + /** + * This means that parsing the response from the server failed. + * It may have been malformed. + */ + static PARSE_ERROR = "PARSE_ERROR"; + /** + * The code of the error itself (use statics on RestError if possible.) + */ + code; + /** + * The HTTP status code of the request (if applicable.) + */ + statusCode; + /** + * The request that was made. + * This property is non-enumerable. + */ + request; + /** + * The response received (if any.) + * This property is non-enumerable. + */ + response; + /** + * Bonus property set by the throw site. + */ + details; + constructor(message, options = {}) { + super(message); + this.name = "RestError"; + this.code = options.code; + this.statusCode = options.statusCode; + // The request and response may contain sensitive information in the headers or body. + // To help prevent this sensitive information being accidentally logged, the request and response + // properties are marked as non-enumerable here. This prevents them showing up in the output of + // JSON.stringify and console.log. + Object.defineProperty(this, "request", { value: options.request, enumerable: false }); + Object.defineProperty(this, "response", { value: options.response, enumerable: false }); + // Only include useful agent information in the request for logging, as the full agent object + // may contain large binary data. + const agent = this.request?.agent + ? { + maxFreeSockets: this.request.agent.maxFreeSockets, + maxSockets: this.request.agent.maxSockets, } - return next(req); - }, - }; + : undefined; + // Logging method for util.inspect in Node + Object.defineProperty(this, inspect_js_1.custom, { + value: () => { + // Extract non-enumerable properties and add them back. This is OK since in this output the request and + // response get sanitized. + return `RestError: ${this.message} \n ${errorSanitizer.sanitize({ + ...this, + request: { ...this.request, agent }, + response: this.response, + })}`; + }, + enumerable: false, + }); + Object.setPrototypeOf(this, RestError.prototype); + } } -//# sourceMappingURL=apiVersionPolicy.js.map +exports.RestError = RestError; +/** + * Typeguard for RestError + * @param e - Something caught by a catch clause. + */ +function isRestError(e) { + if (e instanceof RestError) { + return true; + } + return (0, error_js_1.isError)(e) && e.name === "RestError"; +} +//# sourceMappingURL=restError.js.map /***/ }), -/***/ 11687: +/***/ 12283: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -126767,51 +120713,74 @@ function apiVersionPolicy(options) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createDefaultPipeline = createDefaultPipeline; -exports.getCachedDefaultHttpsClient = getCachedDefaultHttpsClient; -const defaultHttpClient_js_1 = __nccwpck_require__(42917); -const createPipelineFromOptions_js_1 = __nccwpck_require__(97239); -const apiVersionPolicy_js_1 = __nccwpck_require__(51648); -const credentials_js_1 = __nccwpck_require__(5630); -const apiKeyAuthenticationPolicy_js_1 = __nccwpck_require__(7937); -const basicAuthenticationPolicy_js_1 = __nccwpck_require__(10068); -const bearerAuthenticationPolicy_js_1 = __nccwpck_require__(73054); -const oauth2AuthenticationPolicy_js_1 = __nccwpck_require__(71305); -let cachedHttpClient; +exports.exponentialRetryStrategy = exponentialRetryStrategy; +exports.isExponentialRetryResponse = isExponentialRetryResponse; +exports.isSystemError = isSystemError; +const delay_js_1 = __nccwpck_require__(34591); +const throttlingRetryStrategy_js_1 = __nccwpck_require__(90483); +// intervals are in milliseconds +const DEFAULT_CLIENT_RETRY_INTERVAL = 1000; +const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64; /** - * Creates a default rest pipeline to re-use accross Rest Level Clients + * A retry strategy that retries with an exponentially increasing delay in these two cases: + * - When there are errors in the underlying transport layer (e.g. DNS lookup failures). + * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505). */ -function createDefaultPipeline(options = {}) { - const pipeline = (0, createPipelineFromOptions_js_1.createPipelineFromOptions)(options); - pipeline.addPolicy((0, apiVersionPolicy_js_1.apiVersionPolicy)(options)); - const { credential, authSchemes, allowInsecureConnection } = options; - if (credential) { - if ((0, credentials_js_1.isApiKeyCredential)(credential)) { - pipeline.addPolicy((0, apiKeyAuthenticationPolicy_js_1.apiKeyAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); - } - else if ((0, credentials_js_1.isBasicCredential)(credential)) { - pipeline.addPolicy((0, basicAuthenticationPolicy_js_1.basicAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); - } - else if ((0, credentials_js_1.isBearerTokenCredential)(credential)) { - pipeline.addPolicy((0, bearerAuthenticationPolicy_js_1.bearerAuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); - } - else if ((0, credentials_js_1.isOAuth2TokenCredential)(credential)) { - pipeline.addPolicy((0, oauth2AuthenticationPolicy_js_1.oauth2AuthenticationPolicy)({ authSchemes, credential, allowInsecureConnection })); - } - } - return pipeline; +function exponentialRetryStrategy(options = {}) { + const retryInterval = options.retryDelayInMs ?? DEFAULT_CLIENT_RETRY_INTERVAL; + const maxRetryInterval = options.maxRetryDelayInMs ?? DEFAULT_CLIENT_MAX_RETRY_INTERVAL; + return { + name: "exponentialRetryStrategy", + retry({ retryCount, response, responseError }) { + const matchedSystemError = isSystemError(responseError); + const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors; + const isExponential = isExponentialRetryResponse(response); + const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes; + const unknownResponse = response && ((0, throttlingRetryStrategy_js_1.isThrottlingRetryResponse)(response) || !isExponential); + if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) { + return { skipStrategy: true }; + } + if (responseError && !matchedSystemError && !isExponential) { + return { errorToThrow: responseError }; + } + return (0, delay_js_1.calculateRetryDelay)(retryCount, { + retryDelayInMs: retryInterval, + maxRetryDelayInMs: maxRetryInterval, + }); + }, + }; } -function getCachedDefaultHttpsClient() { - if (!cachedHttpClient) { - cachedHttpClient = (0, defaultHttpClient_js_1.createDefaultHttpClient)(); +/** + * A response is a retry response if it has status codes: + * - 408, or + * - Greater or equal than 500, except for 501 and 505. + */ +function isExponentialRetryResponse(response) { + return Boolean(response && + response.status !== undefined && + (response.status >= 500 || response.status === 408) && + response.status !== 501 && + response.status !== 505); +} +/** + * Determines whether an error from a pipeline response was triggered in the network layer. + */ +function isSystemError(err) { + if (!err) { + return false; } - return cachedHttpClient; + return (err.code === "ETIMEDOUT" || + err.code === "ESOCKETTIMEDOUT" || + err.code === "ECONNREFUSED" || + err.code === "ECONNRESET" || + err.code === "ENOENT" || + err.code === "ENOTFOUND"); } -//# sourceMappingURL=clientHelpers.js.map +//# sourceMappingURL=exponentialRetryStrategy.js.map /***/ }), -/***/ 15714: +/***/ 90483: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -126819,256 +120788,276 @@ function getCachedDefaultHttpsClient() { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getClient = getClient; -const clientHelpers_js_1 = __nccwpck_require__(11687); -const sendRequest_js_1 = __nccwpck_require__(94381); -const urlHelpers_js_1 = __nccwpck_require__(91752); -const checkEnvironment_js_1 = __nccwpck_require__(94121); +exports.isThrottlingRetryResponse = isThrottlingRetryResponse; +exports.throttlingRetryStrategy = throttlingRetryStrategy; +const helpers_js_1 = __nccwpck_require__(59842); /** - * Creates a client with a default pipeline - * @param endpoint - Base endpoint for the client - * @param credentials - Credentials to authenticate the requests - * @param options - Client options + * The header that comes back from services representing + * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry). */ -function getClient(endpoint, clientOptions = {}) { - const pipeline = clientOptions.pipeline ?? (0, clientHelpers_js_1.createDefaultPipeline)(clientOptions); - if (clientOptions.additionalPolicies?.length) { - for (const { policy, position } of clientOptions.additionalPolicies) { - // Sign happens after Retry and is commonly needed to occur - // before policies that intercept post-retry. - const afterPhase = position === "perRetry" ? "Sign" : undefined; - pipeline.addPolicy(policy, { - afterPhase, - }); +const RetryAfterHeader = "Retry-After"; +/** + * The headers that come back from services representing + * the amount of time (minimum) to wait to retry. + * + * "retry-after-ms", "x-ms-retry-after-ms" : milliseconds + * "Retry-After" : seconds or timestamp + */ +const AllRetryAfterHeaders = ["retry-after-ms", "x-ms-retry-after-ms", RetryAfterHeader]; +/** + * A response is a throttling retry response if it has a throttling status code (429 or 503), + * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value. + * + * Returns the `retryAfterInMs` value if the response is a throttling retry response. + * If not throttling retry response, returns `undefined`. + * + * @internal + */ +function getRetryAfterInMs(response) { + if (!(response && [429, 503].includes(response.status))) + return undefined; + try { + // Headers: "retry-after-ms", "x-ms-retry-after-ms", "Retry-After" + for (const header of AllRetryAfterHeaders) { + const retryAfterValue = (0, helpers_js_1.parseHeaderValueAsNumber)(response, header); + if (retryAfterValue === 0 || retryAfterValue) { + // "Retry-After" header ==> seconds + // "retry-after-ms", "x-ms-retry-after-ms" headers ==> milli-seconds + const multiplyingFactor = header === RetryAfterHeader ? 1000 : 1; + return retryAfterValue * multiplyingFactor; // in milli-seconds + } } + // RetryAfterHeader ("Retry-After") has a special case where it might be formatted as a date instead of a number of seconds + const retryAfterHeader = response.headers.get(RetryAfterHeader); + if (!retryAfterHeader) + return; + const date = Date.parse(retryAfterHeader); + const diff = date - Date.now(); + // negative diff would mean a date in the past, so retry asap with 0 milliseconds + return Number.isFinite(diff) ? Math.max(0, diff) : undefined; + } + catch { + return undefined; } - const { allowInsecureConnection, httpClient } = clientOptions; - const endpointUrl = clientOptions.endpoint ?? endpoint; - const client = (path, ...args) => { - const getUrl = (requestOptions) => (0, urlHelpers_js_1.buildRequestUrl)(endpointUrl, path, args, { allowInsecureConnection, ...requestOptions }); - return { - get: (requestOptions = {}) => { - return buildOperation("GET", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - post: (requestOptions = {}) => { - return buildOperation("POST", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - put: (requestOptions = {}) => { - return buildOperation("PUT", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - patch: (requestOptions = {}) => { - return buildOperation("PATCH", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - delete: (requestOptions = {}) => { - return buildOperation("DELETE", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - head: (requestOptions = {}) => { - return buildOperation("HEAD", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - options: (requestOptions = {}) => { - return buildOperation("OPTIONS", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - trace: (requestOptions = {}) => { - return buildOperation("TRACE", getUrl(requestOptions), pipeline, requestOptions, allowInsecureConnection, httpClient); - }, - }; - }; - return { - path: client, - pathUnchecked: client, - pipeline, - }; } -function buildOperation(method, url, pipeline, options, allowInsecureConnection, httpClient) { - allowInsecureConnection = options.allowInsecureConnection ?? allowInsecureConnection; +/** + * A response is a retry response if it has a throttling status code (429 or 503), + * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value. + */ +function isThrottlingRetryResponse(response) { + return Number.isFinite(getRetryAfterInMs(response)); +} +function throttlingRetryStrategy() { return { - then: function (onFulfilled, onrejected) { - return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, { ...options, allowInsecureConnection }, httpClient).then(onFulfilled, onrejected); - }, - async asBrowserStream() { - if (checkEnvironment_js_1.isNodeLike) { - throw new Error("`asBrowserStream` is supported only in the browser environment. Use `asNodeStream` instead to obtain the response body stream. If you require a Web stream of the response in Node, consider using `Readable.toWeb` on the result of `asNodeStream`."); - } - else { - return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, { ...options, allowInsecureConnection, responseAsStream: true }, httpClient); - } - }, - async asNodeStream() { - if (checkEnvironment_js_1.isNodeLike) { - return (0, sendRequest_js_1.sendRequest)(method, url, pipeline, { ...options, allowInsecureConnection, responseAsStream: true }, httpClient); - } - else { - throw new Error("`isNodeStream` is not supported in the browser environment. Use `asBrowserStream` to obtain the response body stream."); + name: "throttlingRetryStrategy", + retry({ response }) { + const retryAfterInMs = getRetryAfterInMs(response); + if (!Number.isFinite(retryAfterInMs)) { + return { skipStrategy: true }; } + return { + retryAfterInMs, + }; }, }; } -//# sourceMappingURL=getClient.js.map +//# sourceMappingURL=throttlingRetryStrategy.js.map /***/ }), -/***/ 56985: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 88943: +/***/ ((__unused_webpack_module, exports) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.buildBodyPart = buildBodyPart; -exports.buildMultipartBody = buildMultipartBody; -const restError_js_1 = __nccwpck_require__(42858); -const httpHeaders_js_1 = __nccwpck_require__(66816); -const bytesEncoding_js_1 = __nccwpck_require__(88943); -const typeGuards_js_1 = __nccwpck_require__(61580); +exports.uint8ArrayToString = uint8ArrayToString; +exports.stringToUint8Array = stringToUint8Array; /** - * Get value of a header in the part descriptor ignoring case + * The helper that transforms bytes with specific character encoding into string + * @param bytes - the uint8array bytes + * @param format - the format we use to encode the byte + * @returns a string of the encoded string */ -function getHeaderValue(descriptor, headerName) { - if (descriptor.headers) { - const actualHeaderName = Object.keys(descriptor.headers).find((x) => x.toLowerCase() === headerName.toLowerCase()); - if (actualHeaderName) { - return descriptor.headers[actualHeaderName]; - } - } - return undefined; -} -function getPartContentType(descriptor) { - const contentTypeHeader = getHeaderValue(descriptor, "content-type"); - if (contentTypeHeader) { - return contentTypeHeader; - } - // Special value of null means content type is to be omitted - if (descriptor.contentType === null) { - return undefined; - } - if (descriptor.contentType) { - return descriptor.contentType; - } - const { body } = descriptor; - if (body === null || body === undefined) { - return undefined; - } - if (typeof body === "string" || typeof body === "number" || typeof body === "boolean") { - return "text/plain; charset=UTF-8"; - } - if (body instanceof Blob) { - return body.type || "application/octet-stream"; - } - if ((0, typeGuards_js_1.isBinaryBody)(body)) { - return "application/octet-stream"; - } - // arbitrary non-text object -> generic JSON content type by default. We will try to JSON.stringify the body. - return "application/json"; +function uint8ArrayToString(bytes, format) { + return Buffer.from(bytes).toString(format); } /** - * Enclose value in quotes and escape special characters, for use in the Content-Disposition header + * The helper that transforms string to specific character encoded bytes array. + * @param value - the string to be converted + * @param format - the format we use to decode the value + * @returns a uint8array */ -function escapeDispositionField(value) { - return JSON.stringify(value); +function stringToUint8Array(value, format) { + return Buffer.from(value, format); } -function getContentDisposition(descriptor) { - const contentDispositionHeader = getHeaderValue(descriptor, "content-disposition"); - if (contentDispositionHeader) { - return contentDispositionHeader; - } - if (descriptor.dispositionType === undefined && - descriptor.name === undefined && - descriptor.filename === undefined) { - return undefined; - } - const dispositionType = descriptor.dispositionType ?? "form-data"; - let disposition = dispositionType; - if (descriptor.name) { - disposition += `; name=${escapeDispositionField(descriptor.name)}`; - } - let filename = undefined; - if (descriptor.filename) { - filename = descriptor.filename; - } - else if (typeof File !== "undefined" && descriptor.body instanceof File) { - const filenameFromFile = descriptor.body.name; - if (filenameFromFile !== "") { - filename = filenameFromFile; +//# sourceMappingURL=bytesEncoding.js.map + +/***/ }), + +/***/ 94121: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isReactNative = exports.isNodeRuntime = exports.isNodeLike = exports.isBun = exports.isDeno = exports.isWebWorker = exports.isBrowser = void 0; +/** + * A constant that indicates whether the environment the code is running is a Web Browser. + */ +// eslint-disable-next-line @azure/azure-sdk/ts-no-window +exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is a Web Worker. + */ +exports.isWebWorker = typeof self === "object" && + typeof self?.importScripts === "function" && + (self.constructor?.name === "DedicatedWorkerGlobalScope" || + self.constructor?.name === "ServiceWorkerGlobalScope" || + self.constructor?.name === "SharedWorkerGlobalScope"); +/** + * A constant that indicates whether the environment the code is running is Deno. + */ +exports.isDeno = typeof Deno !== "undefined" && + typeof Deno.version !== "undefined" && + typeof Deno.version.deno !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is Bun.sh. + */ +exports.isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is a Node.js compatible environment. + */ +exports.isNodeLike = typeof globalThis.process !== "undefined" && + Boolean(globalThis.process.version) && + Boolean(globalThis.process.versions?.node); +/** + * A constant that indicates whether the environment the code is running is Node.JS. + */ +exports.isNodeRuntime = exports.isNodeLike && !exports.isBun && !exports.isDeno; +/** + * A constant that indicates whether the environment the code is running is in React-Native. + */ +// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js +exports.isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; +//# sourceMappingURL=checkEnvironment.js.map + +/***/ }), + +/***/ 96494: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.concat = concat; +const stream_1 = __nccwpck_require__(12781); +const typeGuards_js_1 = __nccwpck_require__(61580); +async function* streamAsyncIterator() { + const reader = this.getReader(); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) { + return; + } + yield value; } } - if (filename) { - disposition += `; filename=${escapeDispositionField(filename)}`; + finally { + reader.releaseLock(); } - return disposition; } -function normalizeBody(body, contentType) { - if (body === undefined) { - // zero-length body - return new Uint8Array([]); +function makeAsyncIterable(webStream) { + if (!webStream[Symbol.asyncIterator]) { + webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream); } - // binary and primitives should go straight on the wire regardless of content type - if ((0, typeGuards_js_1.isBinaryBody)(body)) { - return body; + if (!webStream.values) { + webStream.values = streamAsyncIterator.bind(webStream); } - if (typeof body === "string" || typeof body === "number" || typeof body === "boolean") { - return (0, bytesEncoding_js_1.stringToUint8Array)(String(body), "utf-8"); +} +function ensureNodeStream(stream) { + if (stream instanceof ReadableStream) { + makeAsyncIterable(stream); + return stream_1.Readable.fromWeb(stream); } - // stringify objects for JSON-ish content types e.g. application/json, application/merge-patch+json, application/vnd.oci.manifest.v1+json, application.json; charset=UTF-8 - if (contentType && /application\/(.+\+)?json(;.+)?/i.test(String(contentType))) { - return (0, bytesEncoding_js_1.stringToUint8Array)(JSON.stringify(body), "utf-8"); + else { + return stream; } - throw new restError_js_1.RestError(`Unsupported body/content-type combination: ${body}, ${contentType}`); } -function buildBodyPart(descriptor) { - const contentType = getPartContentType(descriptor); - const contentDisposition = getContentDisposition(descriptor); - const headers = (0, httpHeaders_js_1.createHttpHeaders)(descriptor.headers ?? {}); - if (contentType) { - headers.set("content-type", contentType); +function toStream(source) { + if (source instanceof Uint8Array) { + return stream_1.Readable.from(Buffer.from(source)); } - if (contentDisposition) { - headers.set("content-disposition", contentDisposition); + else if ((0, typeGuards_js_1.isBlob)(source)) { + return ensureNodeStream(source.stream()); + } + else { + return ensureNodeStream(source); } - const body = normalizeBody(descriptor.body, contentType); - return { - headers, - body, - }; } -function buildMultipartBody(parts) { - return { parts: parts.map(buildBodyPart) }; +/** + * Utility function that concatenates a set of binary inputs into one combined output. + * + * @param sources - array of sources for the concatenation + * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs. + * In browser, returns a `Blob` representing all the concatenated inputs. + * + * @internal + */ +async function concat(sources) { + return function () { + const streams = sources.map((x) => (typeof x === "function" ? x() : x)).map(toStream); + return stream_1.Readable.from((async function* () { + for (const stream of streams) { + for await (const chunk of stream) { + yield chunk; + } + } + })()); + }; } -//# sourceMappingURL=multipart.js.map +//# sourceMappingURL=concat.js.map /***/ }), -/***/ 16857: -/***/ ((__unused_webpack_module, exports) => { +/***/ 34591: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.operationOptionsToRequestParameters = operationOptionsToRequestParameters; +exports.calculateRetryDelay = calculateRetryDelay; +const random_js_1 = __nccwpck_require__(25042); /** - * Helper function to convert OperationOptions to RequestParameters - * @param options - the options that are used by Modular layer to send the request - * @returns the result of the conversion in RequestParameters of RLC layer + * Calculates the delay interval for retry attempts using exponential delay with jitter. + * @param retryAttempt - The current retry attempt number. + * @param config - The exponential retry configuration. + * @returns An object containing the calculated retry delay. */ -function operationOptionsToRequestParameters(options) { - return { - allowInsecureConnection: options.requestOptions?.allowInsecureConnection, - timeout: options.requestOptions?.timeout, - skipUrlEncoding: options.requestOptions?.skipUrlEncoding, - abortSignal: options.abortSignal, - onUploadProgress: options.requestOptions?.onUploadProgress, - onDownloadProgress: options.requestOptions?.onDownloadProgress, - headers: { ...options.requestOptions?.headers }, - onResponse: options.onResponse, - }; +function calculateRetryDelay(retryAttempt, config) { + // Exponentially increase the delay each time + const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt); + // Don't let the delay exceed the maximum + const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay); + // Allow the final value to have some "jitter" (within 50% of the delay size) so + // that retries across multiple clients don't occur simultaneously. + const retryAfterInMs = clampedDelay / 2 + (0, random_js_1.getRandomIntegerInclusive)(0, clampedDelay / 2); + return { retryAfterInMs }; } -//# sourceMappingURL=operationOptionHelpers.js.map +//# sourceMappingURL=delay.js.map /***/ }), -/***/ 24193: +/***/ 13742: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -127076,38 +121065,25 @@ function operationOptionsToRequestParameters(options) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createRestError = createRestError; -const restError_js_1 = __nccwpck_require__(42858); -const httpHeaders_js_1 = __nccwpck_require__(66816); -function createRestError(messageOrResponse, response) { - const resp = typeof messageOrResponse === "string" ? response : messageOrResponse; - const internalError = resp.body?.error ?? resp.body; - const message = typeof messageOrResponse === "string" - ? messageOrResponse - : (internalError?.message ?? `Unexpected status code: ${resp.status}`); - return new restError_js_1.RestError(message, { - statusCode: statusCodeToNumber(resp.status), - code: internalError?.code, - request: resp.request, - response: toPipelineResponse(resp), - }); -} -function toPipelineResponse(response) { - return { - headers: (0, httpHeaders_js_1.createHttpHeaders)(response.headers), - request: response.request, - status: statusCodeToNumber(response.status) ?? -1, - }; -} -function statusCodeToNumber(statusCode) { - const status = Number.parseInt(statusCode); - return Number.isNaN(status) ? undefined : status; +exports.isError = isError; +const object_js_1 = __nccwpck_require__(7088); +/** + * Typeguard for an error object shape (has name and message) + * @param e - Something caught by a catch clause. + */ +function isError(e) { + if ((0, object_js_1.isObject)(e)) { + const hasName = typeof e.name === "string"; + const hasMessage = typeof e.message === "string"; + return hasName && hasMessage; + } + return false; } -//# sourceMappingURL=restError.js.map +//# sourceMappingURL=error.js.map /***/ }), -/***/ 94381: +/***/ 59842: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -127115,349 +121091,376 @@ function statusCodeToNumber(statusCode) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.sendRequest = sendRequest; -const restError_js_1 = __nccwpck_require__(42858); -const httpHeaders_js_1 = __nccwpck_require__(66816); -const pipelineRequest_js_1 = __nccwpck_require__(47983); -const clientHelpers_js_1 = __nccwpck_require__(11687); -const typeGuards_js_1 = __nccwpck_require__(61580); -const multipart_js_1 = __nccwpck_require__(56985); +exports.delay = delay; +exports.parseHeaderValueAsNumber = parseHeaderValueAsNumber; +const AbortError_js_1 = __nccwpck_require__(72033); +const StandardAbortMessage = "The operation was aborted."; /** - * Helper function to send request used by the client - * @param method - method to use to send the request - * @param url - url to send the request to - * @param pipeline - pipeline with the policies to run when sending the request - * @param options - request options - * @param customHttpClient - a custom HttpClient to use when making the request - * @returns returns and HttpResponse + * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds. + * @param delayInMs - The number of milliseconds to be delayed. + * @param value - The value to be resolved with after a timeout of t milliseconds. + * @param options - The options for delay - currently abort options + * - abortSignal - The abortSignal associated with containing operation. + * - abortErrorMsg - The abort error message associated with containing operation. + * @returns Resolved promise */ -async function sendRequest(method, url, pipeline, options = {}, customHttpClient) { - const httpClient = customHttpClient ?? (0, clientHelpers_js_1.getCachedDefaultHttpsClient)(); - const request = buildPipelineRequest(method, url, options); - try { - const response = await pipeline.sendRequest(httpClient, request); - const headers = response.headers.toJSON(); - const stream = response.readableStreamBody ?? response.browserStreamBody; - const parsedBody = options.responseAsStream || stream !== undefined ? undefined : getResponseBody(response); - const body = stream ?? parsedBody; - if (options?.onResponse) { - options.onResponse({ ...response, request, rawHeaders: headers, parsedBody }); - } - return { - request, - headers, - status: `${response.status}`, - body, +function delay(delayInMs, value, options) { + return new Promise((resolve, reject) => { + let timer = undefined; + let onAborted = undefined; + const rejectOnAbort = () => { + return reject(new AbortError_js_1.AbortError(options?.abortErrorMsg ? options?.abortErrorMsg : StandardAbortMessage)); }; - } - catch (e) { - if ((0, restError_js_1.isRestError)(e) && e.response && options.onResponse) { - const { response } = e; - const rawHeaders = response.headers.toJSON(); - // UNBRANDED DIFFERENCE: onResponse callback does not have a second __legacyError property - options?.onResponse({ ...response, request, rawHeaders }, e); + const removeListeners = () => { + if (options?.abortSignal && onAborted) { + options.abortSignal.removeEventListener("abort", onAborted); + } + }; + onAborted = () => { + if (timer) { + clearTimeout(timer); + } + removeListeners(); + return rejectOnAbort(); + }; + if (options?.abortSignal && options.abortSignal.aborted) { + return rejectOnAbort(); } - throw e; - } -} -/** - * Function to determine the request content type - * @param options - request options InternalRequestParameters - * @returns returns the content-type - */ -function getRequestContentType(options = {}) { - return (options.contentType ?? - options.headers?.["content-type"] ?? - getContentType(options.body)); + timer = setTimeout(() => { + removeListeners(); + resolve(value); + }, delayInMs); + if (options?.abortSignal) { + options.abortSignal.addEventListener("abort", onAborted); + } + }); } /** - * Function to determine the content-type of a body - * this is used if an explicit content-type is not provided - * @param body - body in the request - * @returns returns the content-type + * @internal + * @returns the parsed value or undefined if the parsed value is invalid. */ -function getContentType(body) { - if (ArrayBuffer.isView(body)) { - return "application/octet-stream"; - } - if (typeof body === "string") { - try { - JSON.parse(body); - return "application/json"; - } - catch (error) { - // If we fail to parse the body, it is not json - return undefined; - } - } - // By default return json - return "application/json"; -} -function buildPipelineRequest(method, url, options = {}) { - const requestContentType = getRequestContentType(options); - const { body, multipartBody } = getRequestBody(options.body, requestContentType); - const hasContent = body !== undefined || multipartBody !== undefined; - const headers = (0, httpHeaders_js_1.createHttpHeaders)({ - ...(options.headers ? options.headers : {}), - accept: options.accept ?? options.headers?.accept ?? "application/json", - ...(hasContent && - requestContentType && { - "content-type": requestContentType, - }), - }); - return (0, pipelineRequest_js_1.createPipelineRequest)({ - url, - method, - body, - multipartBody, - headers, - allowInsecureConnection: options.allowInsecureConnection, - abortSignal: options.abortSignal, - onUploadProgress: options.onUploadProgress, - onDownloadProgress: options.onDownloadProgress, - timeout: options.timeout, - enableBrowserStreams: true, - streamResponseStatusCodes: options.responseAsStream - ? new Set([Number.POSITIVE_INFINITY]) - : undefined, - }); +function parseHeaderValueAsNumber(response, headerName) { + const value = response.headers.get(headerName); + if (!value) + return; + const valueAsNum = Number(value); + if (Number.isNaN(valueAsNum)) + return; + return valueAsNum; } +//# sourceMappingURL=helpers.js.map + +/***/ }), + +/***/ 52728: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.custom = void 0; +const node_util_1 = __nccwpck_require__(47261); +exports.custom = node_util_1.inspect.custom; +//# sourceMappingURL=inspect.js.map + +/***/ }), + +/***/ 68152: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Sanitizer = exports.uint8ArrayToString = exports.stringToUint8Array = exports.isWebWorker = exports.isReactNative = exports.isDeno = exports.isNodeRuntime = exports.isNodeLike = exports.isBun = exports.isBrowser = exports.randomUUID = exports.computeSha256Hmac = exports.computeSha256Hash = exports.isError = exports.isObject = exports.getRandomIntegerInclusive = exports.calculateRetryDelay = void 0; +var delay_js_1 = __nccwpck_require__(34591); +Object.defineProperty(exports, "calculateRetryDelay", ({ enumerable: true, get: function () { return delay_js_1.calculateRetryDelay; } })); +var random_js_1 = __nccwpck_require__(25042); +Object.defineProperty(exports, "getRandomIntegerInclusive", ({ enumerable: true, get: function () { return random_js_1.getRandomIntegerInclusive; } })); +var object_js_1 = __nccwpck_require__(7088); +Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return object_js_1.isObject; } })); +var error_js_1 = __nccwpck_require__(13742); +Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return error_js_1.isError; } })); +var sha256_js_1 = __nccwpck_require__(70017); +Object.defineProperty(exports, "computeSha256Hash", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hash; } })); +Object.defineProperty(exports, "computeSha256Hmac", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hmac; } })); +var uuidUtils_js_1 = __nccwpck_require__(2339); +Object.defineProperty(exports, "randomUUID", ({ enumerable: true, get: function () { return uuidUtils_js_1.randomUUID; } })); +var checkEnvironment_js_1 = __nccwpck_require__(94121); +Object.defineProperty(exports, "isBrowser", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBrowser; } })); +Object.defineProperty(exports, "isBun", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBun; } })); +Object.defineProperty(exports, "isNodeLike", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeLike; } })); +Object.defineProperty(exports, "isNodeRuntime", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeRuntime; } })); +Object.defineProperty(exports, "isDeno", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isDeno; } })); +Object.defineProperty(exports, "isReactNative", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isReactNative; } })); +Object.defineProperty(exports, "isWebWorker", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isWebWorker; } })); +var bytesEncoding_js_1 = __nccwpck_require__(88943); +Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } })); +Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } })); +var sanitizer_js_1 = __nccwpck_require__(61416); +Object.defineProperty(exports, "Sanitizer", ({ enumerable: true, get: function () { return sanitizer_js_1.Sanitizer; } })); +//# sourceMappingURL=internal.js.map + +/***/ }), + +/***/ 7088: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isObject = isObject; /** - * Prepares the body before sending the request + * Helper to determine when an input is a generic JS object. + * @returns true when input is an object type that is not null, Array, RegExp, or Date. */ -function getRequestBody(body, contentType = "") { - if (body === undefined) { - return { body: undefined }; - } - if (typeof FormData !== "undefined" && body instanceof FormData) { - return { body }; - } - if ((0, typeGuards_js_1.isReadableStream)(body)) { - return { body }; - } - if (ArrayBuffer.isView(body)) { - return { body: body instanceof Uint8Array ? body : JSON.stringify(body) }; - } - const firstType = contentType.split(";")[0]; - switch (firstType) { - case "application/json": - return { body: JSON.stringify(body) }; - case "multipart/form-data": - if (Array.isArray(body)) { - return { multipartBody: (0, multipart_js_1.buildMultipartBody)(body) }; - } - return { body: JSON.stringify(body) }; - case "text/plain": - return { body: String(body) }; - default: - if (typeof body === "string") { - return { body }; - } - return { body: JSON.stringify(body) }; - } +function isObject(input) { + return (typeof input === "object" && + input !== null && + !Array.isArray(input) && + !(input instanceof RegExp) && + !(input instanceof Date)); } +//# sourceMappingURL=object.js.map + +/***/ }), + +/***/ 25042: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getRandomIntegerInclusive = getRandomIntegerInclusive; /** - * Prepares the response body + * Returns a random integer value between a lower and upper bound, + * inclusive of both bounds. + * Note that this uses Math.random and isn't secure. If you need to use + * this for any kind of security purpose, find a better source of random. + * @param min - The smallest integer value allowed. + * @param max - The largest integer value allowed. */ -function getResponseBody(response) { - // Set the default response type - const contentType = response.headers.get("content-type") ?? ""; - const firstType = contentType.split(";")[0]; - const bodyToParse = response.bodyAsText ?? ""; - if (firstType === "text/plain") { - return String(bodyToParse); - } - // Default to "application/json" and fallback to string; - try { - return bodyToParse ? JSON.parse(bodyToParse) : undefined; - } - catch (error) { - // If we were supposed to get a JSON object and failed to - // parse, throw a parse error - if (firstType === "application/json") { - throw createParseError(response, error); - } - // We are not sure how to handle the response so we return it as - // plain text. - return String(bodyToParse); - } -} -function createParseError(response, err) { - const msg = `Error "${err}" occurred while parsing the response body - ${response.bodyAsText}.`; - const errCode = err.code ?? restError_js_1.RestError.PARSE_ERROR; - return new restError_js_1.RestError(msg, { - code: errCode, - statusCode: response.status, - request: response.request, - response: response, - }); +function getRandomIntegerInclusive(min, max) { + // Make sure inputs are integers. + min = Math.ceil(min); + max = Math.floor(max); + // Pick a random offset from zero to the size of the range. + // Since Math.random() can never return 1, we have to make the range one larger + // in order to be inclusive of the maximum value after we take the floor. + const offset = Math.floor(Math.random() * (max - min + 1)); + return offset + min; } -//# sourceMappingURL=sendRequest.js.map +//# sourceMappingURL=random.js.map /***/ }), -/***/ 91752: -/***/ ((__unused_webpack_module, exports) => { +/***/ 61416: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.buildRequestUrl = buildRequestUrl; -exports.buildBaseUrl = buildBaseUrl; -exports.replaceAll = replaceAll; -function isQueryParameterWithOptions(x) { - const value = x.value; - return (value !== undefined && value.toString !== undefined && typeof value.toString === "function"); -} +exports.Sanitizer = void 0; +const object_js_1 = __nccwpck_require__(7088); +const RedactedString = "REDACTED"; +// Make sure this list is up-to-date with the one under core/logger/Readme#Keyconcepts +const defaultAllowedHeaderNames = [ + "x-ms-client-request-id", + "x-ms-return-client-request-id", + "x-ms-useragent", + "x-ms-correlation-request-id", + "x-ms-request-id", + "client-request-id", + "ms-cv", + "return-client-request-id", + "traceparent", + "Access-Control-Allow-Credentials", + "Access-Control-Allow-Headers", + "Access-Control-Allow-Methods", + "Access-Control-Allow-Origin", + "Access-Control-Expose-Headers", + "Access-Control-Max-Age", + "Access-Control-Request-Headers", + "Access-Control-Request-Method", + "Origin", + "Accept", + "Accept-Encoding", + "Cache-Control", + "Connection", + "Content-Length", + "Content-Type", + "Date", + "ETag", + "Expires", + "If-Match", + "If-Modified-Since", + "If-None-Match", + "If-Unmodified-Since", + "Last-Modified", + "Pragma", + "Request-Id", + "Retry-After", + "Server", + "Transfer-Encoding", + "User-Agent", + "WWW-Authenticate", +]; +const defaultAllowedQueryParameters = ["api-version"]; /** - * Builds the request url, filling in query and path parameters - * @param endpoint - base url which can be a template url - * @param routePath - path to append to the endpoint - * @param pathParameters - values of the path parameters - * @param options - request parameters including query parameters - * @returns a full url with path and query parameters + * A utility class to sanitize objects for logging. */ -function buildRequestUrl(endpoint, routePath, pathParameters, options = {}) { - if (routePath.startsWith("https://") || routePath.startsWith("http://")) { - return routePath; - } - endpoint = buildBaseUrl(endpoint, options); - routePath = buildRoutePath(routePath, pathParameters, options); - const requestUrl = appendQueryParams(`${endpoint}/${routePath}`, options); - const url = new URL(requestUrl); - return (url - .toString() - // Remove double forward slashes - .replace(/([^:]\/)\/+/g, "$1")); -} -function getQueryParamValue(key, allowReserved, style, param) { - let separator; - if (style === "pipeDelimited") { - separator = "|"; - } - else if (style === "spaceDelimited") { - separator = "%20"; - } - else { - separator = ","; - } - let paramValues; - if (Array.isArray(param)) { - paramValues = param; - } - else if (typeof param === "object" && param.toString === Object.prototype.toString) { - // If the parameter is an object without a custom toString implementation (e.g. a Date), - // then we should deconstruct the object into an array [key1, value1, key2, value2, ...]. - paramValues = Object.entries(param).flat(); +class Sanitizer { + allowedHeaderNames; + allowedQueryParameters; + constructor({ additionalAllowedHeaderNames: allowedHeaderNames = [], additionalAllowedQueryParameters: allowedQueryParameters = [], } = {}) { + allowedHeaderNames = defaultAllowedHeaderNames.concat(allowedHeaderNames); + allowedQueryParameters = defaultAllowedQueryParameters.concat(allowedQueryParameters); + this.allowedHeaderNames = new Set(allowedHeaderNames.map((n) => n.toLowerCase())); + this.allowedQueryParameters = new Set(allowedQueryParameters.map((p) => p.toLowerCase())); } - else { - paramValues = [param]; + /** + * Sanitizes an object for logging. + * @param obj - The object to sanitize + * @returns - The sanitized object as a string + */ + sanitize(obj) { + const seen = new Set(); + return JSON.stringify(obj, (key, value) => { + // Ensure Errors include their interesting non-enumerable members + if (value instanceof Error) { + return { + ...value, + name: value.name, + message: value.message, + }; + } + if (key === "headers") { + return this.sanitizeHeaders(value); + } + else if (key === "url") { + return this.sanitizeUrl(value); + } + else if (key === "query") { + return this.sanitizeQuery(value); + } + else if (key === "body") { + // Don't log the request body + return undefined; + } + else if (key === "response") { + // Don't log response again + return undefined; + } + else if (key === "operationSpec") { + // When using sendOperationRequest, the request carries a massive + // field with the autorest spec. No need to log it. + return undefined; + } + else if (Array.isArray(value) || (0, object_js_1.isObject)(value)) { + if (seen.has(value)) { + return "[Circular]"; + } + seen.add(value); + } + return value; + }, 2); } - const value = paramValues - .map((p) => { - if (p === null || p === undefined) { - return ""; - } - if (!p.toString || typeof p.toString !== "function") { - throw new Error(`Query parameters must be able to be represented as string, ${key} can't`); + /** + * Sanitizes a URL for logging. + * @param value - The URL to sanitize + * @returns - The sanitized URL as a string + */ + sanitizeUrl(value) { + if (typeof value !== "string" || value === null || value === "") { + return value; } - const rawValue = p.toISOString !== undefined ? p.toISOString() : p.toString(); - return allowReserved ? rawValue : encodeURIComponent(rawValue); - }) - .join(separator); - return `${allowReserved ? key : encodeURIComponent(key)}=${value}`; -} -function appendQueryParams(url, options = {}) { - if (!options.queryParameters) { - return url; - } - const parsedUrl = new URL(url); - const queryParams = options.queryParameters; - const paramStrings = []; - for (const key of Object.keys(queryParams)) { - const param = queryParams[key]; - if (param === undefined || param === null) { - continue; + const url = new URL(value); + if (!url.search) { + return value; } - const hasMetadata = isQueryParameterWithOptions(param); - const rawValue = hasMetadata ? param.value : param; - const explode = hasMetadata ? (param.explode ?? false) : false; - const style = hasMetadata && param.style ? param.style : "form"; - if (explode) { - if (Array.isArray(rawValue)) { - for (const item of rawValue) { - paramStrings.push(getQueryParamValue(key, options.skipUrlEncoding ?? false, style, item)); - } + for (const [key] of url.searchParams) { + if (!this.allowedQueryParameters.has(key.toLowerCase())) { + url.searchParams.set(key, RedactedString); } - else if (typeof rawValue === "object") { - // For object explode, the name of the query parameter is ignored and we use the object key instead - for (const [actualKey, value] of Object.entries(rawValue)) { - paramStrings.push(getQueryParamValue(actualKey, options.skipUrlEncoding ?? false, style, value)); - } + } + return url.toString(); + } + sanitizeHeaders(obj) { + const sanitized = {}; + for (const key of Object.keys(obj)) { + if (this.allowedHeaderNames.has(key.toLowerCase())) { + sanitized[key] = obj[key]; } else { - // Explode doesn't really make sense for primitives - throw new Error("explode can only be set to true for objects and arrays"); + sanitized[key] = RedactedString; } } - else { - paramStrings.push(getQueryParamValue(key, options.skipUrlEncoding ?? false, style, rawValue)); - } - } - if (parsedUrl.search !== "") { - parsedUrl.search += "&"; - } - parsedUrl.search += paramStrings.join("&"); - return parsedUrl.toString(); -} -function buildBaseUrl(endpoint, options) { - if (!options.pathParameters) { - return endpoint; + return sanitized; } - const pathParams = options.pathParameters; - for (const [key, param] of Object.entries(pathParams)) { - if (param === undefined || param === null) { - throw new Error(`Path parameters ${key} must not be undefined or null`); - } - if (!param.toString || typeof param.toString !== "function") { - throw new Error(`Path parameters must be able to be represented as string, ${key} can't`); + sanitizeQuery(value) { + if (typeof value !== "object" || value === null) { + return value; } - let value = param.toISOString !== undefined ? param.toISOString() : String(param); - if (!options.skipUrlEncoding) { - value = encodeURIComponent(param); + const sanitized = {}; + for (const k of Object.keys(value)) { + if (this.allowedQueryParameters.has(k.toLowerCase())) { + sanitized[k] = value[k]; + } + else { + sanitized[k] = RedactedString; + } } - endpoint = replaceAll(endpoint, `{${key}}`, value) ?? ""; + return sanitized; } - return endpoint; } -function buildRoutePath(routePath, pathParameters, options = {}) { - for (const pathParam of pathParameters) { - const allowReserved = typeof pathParam === "object" && (pathParam.allowReserved ?? false); - let value = typeof pathParam === "object" ? pathParam.value : pathParam; - if (!options.skipUrlEncoding && !allowReserved) { - value = encodeURIComponent(value); - } - routePath = routePath.replace(/\{[\w-]+\}/, String(value)); - } - return routePath; +exports.Sanitizer = Sanitizer; +//# sourceMappingURL=sanitizer.js.map + +/***/ }), + +/***/ 70017: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.computeSha256Hmac = computeSha256Hmac; +exports.computeSha256Hash = computeSha256Hash; +const node_crypto_1 = __nccwpck_require__(6005); +/** + * Generates a SHA-256 HMAC signature. + * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash. + * @param stringToSign - The data to be signed. + * @param encoding - The textual encoding to use for the returned HMAC digest. + */ +async function computeSha256Hmac(key, stringToSign, encoding) { + const decodedKey = Buffer.from(key, "base64"); + return (0, node_crypto_1.createHmac)("sha256", decodedKey).update(stringToSign).digest(encoding); } /** - * Replace all of the instances of searchValue in value with the provided replaceValue. - * @param value - The value to search and replace in. - * @param searchValue - The value to search for in the value argument. - * @param replaceValue - The value to replace searchValue with in the value argument. - * @returns The value where each instance of searchValue was replaced with replacedValue. + * Generates a SHA-256 hash. + * @param content - The data to be included in the hash. + * @param encoding - The textual encoding to use for the returned hash. */ -function replaceAll(value, searchValue, replaceValue) { - return !value || !searchValue ? value : value.split(searchValue).join(replaceValue || ""); +async function computeSha256Hash(content, encoding) { + return (0, node_crypto_1.createHash)("sha256").update(content).digest(encoding); } -//# sourceMappingURL=urlHelpers.js.map +//# sourceMappingURL=sha256.js.map /***/ }), -/***/ 58463: +/***/ 61580: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -127465,14 +121468,37 @@ function replaceAll(value, searchValue, replaceValue) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DEFAULT_RETRY_POLICY_COUNT = exports.SDK_VERSION = void 0; -exports.SDK_VERSION = "0.3.2"; -exports.DEFAULT_RETRY_POLICY_COUNT = 3; -//# sourceMappingURL=constants.js.map +exports.isNodeReadableStream = isNodeReadableStream; +exports.isWebReadableStream = isWebReadableStream; +exports.isBinaryBody = isBinaryBody; +exports.isReadableStream = isReadableStream; +exports.isBlob = isBlob; +function isNodeReadableStream(x) { + return Boolean(x && typeof x["pipe"] === "function"); +} +function isWebReadableStream(x) { + return Boolean(x && + typeof x.getReader === "function" && + typeof x.tee === "function"); +} +function isBinaryBody(body) { + return (body !== undefined && + (body instanceof Uint8Array || + isReadableStream(body) || + typeof body === "function" || + body instanceof Blob)); +} +function isReadableStream(x) { + return isNodeReadableStream(x) || isWebReadableStream(x); +} +function isBlob(x) { + return typeof x.stream === "function"; +} +//# sourceMappingURL=typeGuards.js.map /***/ }), -/***/ 97239: +/***/ 8192: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -127480,55 +121506,40 @@ exports.DEFAULT_RETRY_POLICY_COUNT = 3; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createPipelineFromOptions = createPipelineFromOptions; -const logPolicy_js_1 = __nccwpck_require__(71610); -const pipeline_js_1 = __nccwpck_require__(34744); -const redirectPolicy_js_1 = __nccwpck_require__(45125); -const userAgentPolicy_js_1 = __nccwpck_require__(35402); -const decompressResponsePolicy_js_1 = __nccwpck_require__(74162); -const defaultRetryPolicy_js_1 = __nccwpck_require__(20297); -const formDataPolicy_js_1 = __nccwpck_require__(51393); -const checkEnvironment_js_1 = __nccwpck_require__(94121); -const proxyPolicy_js_1 = __nccwpck_require__(57954); -const agentPolicy_js_1 = __nccwpck_require__(73398); -const tlsPolicy_js_1 = __nccwpck_require__(24655); -const multipartPolicy_js_1 = __nccwpck_require__(95316); -/** - * Create a new pipeline with a default set of customizable policies. - * @param options - Options to configure a custom pipeline. - */ -function createPipelineFromOptions(options) { - const pipeline = (0, pipeline_js_1.createEmptyPipeline)(); - if (checkEnvironment_js_1.isNodeLike) { - if (options.agent) { - pipeline.addPolicy((0, agentPolicy_js_1.agentPolicy)(options.agent)); - } - if (options.tlsOptions) { - pipeline.addPolicy((0, tlsPolicy_js_1.tlsPolicy)(options.tlsOptions)); - } - pipeline.addPolicy((0, proxyPolicy_js_1.proxyPolicy)(options.proxyOptions)); - pipeline.addPolicy((0, decompressResponsePolicy_js_1.decompressResponsePolicy)()); - } - pipeline.addPolicy((0, formDataPolicy_js_1.formDataPolicy)(), { beforePolicies: [multipartPolicy_js_1.multipartPolicyName] }); - pipeline.addPolicy((0, userAgentPolicy_js_1.userAgentPolicy)(options.userAgentOptions)); - // The multipart policy is added after policies with no phase, so that - // policies can be added between it and formDataPolicy to modify - // properties (e.g., making the boundary constant in recorded tests). - pipeline.addPolicy((0, multipartPolicy_js_1.multipartPolicy)(), { afterPhase: "Deserialize" }); - pipeline.addPolicy((0, defaultRetryPolicy_js_1.defaultRetryPolicy)(options.retryOptions), { phase: "Retry" }); - if (checkEnvironment_js_1.isNodeLike) { - // Both XHR and Fetch expect to handle redirects automatically, - // so only include this policy when we're in Node. - pipeline.addPolicy((0, redirectPolicy_js_1.redirectPolicy)(options.redirectOptions), { afterPhase: "Retry" }); +exports.getUserAgentHeaderName = getUserAgentHeaderName; +exports.getUserAgentValue = getUserAgentValue; +const userAgentPlatform_js_1 = __nccwpck_require__(76576); +const constants_js_1 = __nccwpck_require__(58463); +function getUserAgentString(telemetryInfo) { + const parts = []; + for (const [key, value] of telemetryInfo) { + const token = value ? `${key}/${value}` : key; + parts.push(token); } - pipeline.addPolicy((0, logPolicy_js_1.logPolicy)(options.loggingOptions), { afterPhase: "Sign" }); - return pipeline; + return parts.join(" "); } -//# sourceMappingURL=createPipelineFromOptions.js.map +/** + * @internal + */ +function getUserAgentHeaderName() { + return (0, userAgentPlatform_js_1.getHeaderName)(); +} +/** + * @internal + */ +async function getUserAgentValue(prefix) { + const runtimeInfo = new Map(); + runtimeInfo.set("ts-http-runtime", constants_js_1.SDK_VERSION); + await (0, userAgentPlatform_js_1.setPlatformSpecificData)(runtimeInfo); + const defaultAgent = getUserAgentString(runtimeInfo); + const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent; + return userAgentValue; +} +//# sourceMappingURL=userAgent.js.map /***/ }), -/***/ 42917: +/***/ 76576: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -127536,19 +121547,40 @@ function createPipelineFromOptions(options) { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createDefaultHttpClient = createDefaultHttpClient; -const nodeHttpClient_js_1 = __nccwpck_require__(63098); +exports.getHeaderName = getHeaderName; +exports.setPlatformSpecificData = setPlatformSpecificData; +const tslib_1 = __nccwpck_require__(4351); +const node_os_1 = tslib_1.__importDefault(__nccwpck_require__(70612)); +const node_process_1 = tslib_1.__importDefault(__nccwpck_require__(97742)); /** - * Create the correct HttpClient for the current environment. + * @internal */ -function createDefaultHttpClient() { - return (0, nodeHttpClient_js_1.createNodeHttpClient)(); +function getHeaderName() { + return "User-Agent"; } -//# sourceMappingURL=defaultHttpClient.js.map +/** + * @internal + */ +async function setPlatformSpecificData(map) { + if (node_process_1.default && node_process_1.default.versions) { + const osInfo = `${node_os_1.default.type()} ${node_os_1.default.release()}; ${node_os_1.default.arch()}`; + const versions = node_process_1.default.versions; + if (versions.bun) { + map.set("Bun", `${versions.bun} (${osInfo})`); + } + else if (versions.deno) { + map.set("Deno", `${versions.deno} (${osInfo})`); + } + else if (versions.node) { + map.set("Node", `${versions.node} (${osInfo})`); + } + } +} +//# sourceMappingURL=userAgentPlatform.js.map /***/ }), -/***/ 66816: +/***/ 2339: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -127556,3433 +121588,5476 @@ function createDefaultHttpClient() { // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createHttpHeaders = createHttpHeaders; -function normalizeName(name) { - return name.toLowerCase(); +exports.randomUUID = randomUUID; +/** + * Generated Universally Unique Identifier + * + * @returns RFC4122 v4 UUID. + */ +function randomUUID() { + return crypto.randomUUID(); } -function* headerIterator(map) { - for (const entry of map.values()) { - yield [entry.name, entry.value]; +//# sourceMappingURL=uuidUtils.js.map + +/***/ }), + +/***/ 13810: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.builder = builder; +exports.create = create; +exports.fragment = fragment; +exports.convert = convert; +const interfaces_1 = __nccwpck_require__(81348); +const util_1 = __nccwpck_require__(76195); +const util_2 = __nccwpck_require__(65282); +const _1 = __nccwpck_require__(2106); +const dom_1 = __nccwpck_require__(1256); +/** @inheritdoc */ +function builder(p1, p2) { + const options = formatBuilderOptions(isXMLBuilderCreateOptions(p1) ? p1 : interfaces_1.DefaultBuilderOptions); + const nodes = util_2.Guard.isNode(p1) || (0, util_1.isArray)(p1) ? p1 : p2; + if (nodes === undefined) { + throw new Error("Invalid arguments."); } -} -class HttpHeadersImpl { - _headersMap; - constructor(rawHeaders) { - this._headersMap = new Map(); - if (rawHeaders) { - for (const headerName of Object.keys(rawHeaders)) { - this.set(headerName, rawHeaders[headerName]); - } + if ((0, util_1.isArray)(nodes)) { + const builders = []; + for (let i = 0; i < nodes.length; i++) { + const builder = new _1.XMLBuilderImpl(nodes[i]); + builder.set(options); + builders.push(builder); } + return builders; } - /** - * Set a header in this collection with the provided name and value. The name is - * case-insensitive. - * @param name - The name of the header to set. This value is case-insensitive. - * @param value - The value of the header to set. - */ - set(name, value) { - this._headersMap.set(normalizeName(name), { name, value: String(value).trim() }); + else { + const builder = new _1.XMLBuilderImpl(nodes); + builder.set(options); + return builder; } - /** - * Get the header value for the provided header name, or undefined if no header exists in this - * collection with the provided name. - * @param name - The name of the header. This value is case-insensitive. - */ - get(name) { - return this._headersMap.get(normalizeName(name))?.value; +} +/** @inheritdoc */ +function create(p1, p2) { + const options = formatBuilderOptions(p1 === undefined || isXMLBuilderCreateOptions(p1) ? + p1 : interfaces_1.DefaultBuilderOptions); + const contents = isXMLBuilderCreateOptions(p1) ? p2 : p1; + const doc = (0, dom_1.createDocument)(); + setOptions(doc, options); + const builder = new _1.XMLBuilderImpl(doc); + if (contents !== undefined) { + // parse contents + builder.ele(contents); } - /** - * Get whether or not this header collection contains a header entry for the provided header name. - * @param name - The name of the header to set. This value is case-insensitive. - */ - has(name) { - return this._headersMap.has(normalizeName(name)); + return builder; +} +/** @inheritdoc */ +function fragment(p1, p2) { + const options = formatBuilderOptions(p1 === undefined || isXMLBuilderCreateOptions(p1) ? + p1 : interfaces_1.DefaultBuilderOptions); + const contents = isXMLBuilderCreateOptions(p1) ? p2 : p1; + const doc = (0, dom_1.createDocument)(); + setOptions(doc, options, true); + const builder = new _1.XMLBuilderImpl(doc.createDocumentFragment()); + if (contents !== undefined) { + // parse contents + builder.ele(contents); } - /** - * Remove the header with the provided headerName. - * @param name - The name of the header to remove. - */ - delete(name) { - this._headersMap.delete(normalizeName(name)); + return builder; +} +/** @inheritdoc */ +function convert(p1, p2, p3) { + let builderOptions; + let contents; + let convertOptions; + if (isXMLBuilderCreateOptions(p1) && p2 !== undefined) { + builderOptions = p1; + contents = p2; + convertOptions = p3; } - /** - * Get the JSON object representation of this HTTP header collection. - */ - toJSON(options = {}) { - const result = {}; - if (options.preserveCase) { - for (const entry of this._headersMap.values()) { - result[entry.name] = entry.value; - } - } - else { - for (const [normalizedName, entry] of this._headersMap) { - result[normalizedName] = entry.value; - } - } - return result; + else { + builderOptions = interfaces_1.DefaultBuilderOptions; + contents = p1; + convertOptions = p2 || undefined; } - /** - * Get the string representation of this HTTP header collection. - */ - toString() { - return JSON.stringify(this.toJSON({ preserveCase: true })); + return create(builderOptions, contents).end(convertOptions); +} +function isXMLBuilderCreateOptions(obj) { + if (!(0, util_1.isPlainObject)(obj)) + return false; + for (const key in obj) { + /* istanbul ignore else */ + if (obj.hasOwnProperty(key)) { + if (!interfaces_1.XMLBuilderOptionKeys.has(key)) + return false; + } } - /** - * Iterate over tuples of header [name, value] pairs. - */ - [Symbol.iterator]() { - return headerIterator(this._headersMap); + return true; +} +function formatBuilderOptions(createOptions = {}) { + const options = (0, util_1.applyDefaults)(createOptions, interfaces_1.DefaultBuilderOptions); + if (options.convert.att.length === 0 || + options.convert.ins.length === 0 || + options.convert.text.length === 0 || + options.convert.cdata.length === 0 || + options.convert.comment.length === 0) { + throw new Error("JS object converter strings cannot be zero length."); } + return options; } -/** - * Creates an object that satisfies the `HttpHeaders` interface. - * @param rawHeaders - A simple object representing initial headers - */ -function createHttpHeaders(rawHeaders) { - return new HttpHeadersImpl(rawHeaders); +function setOptions(doc, options, isFragment) { + const docWithSettings = doc; + docWithSettings._xmlBuilderOptions = options; + docWithSettings._isFragment = isFragment; } -//# sourceMappingURL=httpHeaders.js.map - -/***/ }), - -/***/ 83335: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createRestError = exports.operationOptionsToRequestParameters = exports.getClient = exports.createDefaultHttpClient = exports.uint8ArrayToString = exports.stringToUint8Array = exports.isRestError = exports.RestError = exports.createEmptyPipeline = exports.createPipelineRequest = exports.createHttpHeaders = exports.TypeSpecRuntimeLogger = exports.setLogLevel = exports.getLogLevel = exports.createClientLogger = exports.AbortError = void 0; -const tslib_1 = __nccwpck_require__(4351); -var AbortError_js_1 = __nccwpck_require__(72033); -Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } })); -var logger_js_1 = __nccwpck_require__(36720); -Object.defineProperty(exports, "createClientLogger", ({ enumerable: true, get: function () { return logger_js_1.createClientLogger; } })); -Object.defineProperty(exports, "getLogLevel", ({ enumerable: true, get: function () { return logger_js_1.getLogLevel; } })); -Object.defineProperty(exports, "setLogLevel", ({ enumerable: true, get: function () { return logger_js_1.setLogLevel; } })); -Object.defineProperty(exports, "TypeSpecRuntimeLogger", ({ enumerable: true, get: function () { return logger_js_1.TypeSpecRuntimeLogger; } })); -var httpHeaders_js_1 = __nccwpck_require__(66816); -Object.defineProperty(exports, "createHttpHeaders", ({ enumerable: true, get: function () { return httpHeaders_js_1.createHttpHeaders; } })); -tslib_1.__exportStar(__nccwpck_require__(65546), exports); -tslib_1.__exportStar(__nccwpck_require__(38018), exports); -var pipelineRequest_js_1 = __nccwpck_require__(47983); -Object.defineProperty(exports, "createPipelineRequest", ({ enumerable: true, get: function () { return pipelineRequest_js_1.createPipelineRequest; } })); -var pipeline_js_1 = __nccwpck_require__(34744); -Object.defineProperty(exports, "createEmptyPipeline", ({ enumerable: true, get: function () { return pipeline_js_1.createEmptyPipeline; } })); -var restError_js_1 = __nccwpck_require__(42858); -Object.defineProperty(exports, "RestError", ({ enumerable: true, get: function () { return restError_js_1.RestError; } })); -Object.defineProperty(exports, "isRestError", ({ enumerable: true, get: function () { return restError_js_1.isRestError; } })); -var bytesEncoding_js_1 = __nccwpck_require__(88943); -Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } })); -Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } })); -var defaultHttpClient_js_1 = __nccwpck_require__(42917); -Object.defineProperty(exports, "createDefaultHttpClient", ({ enumerable: true, get: function () { return defaultHttpClient_js_1.createDefaultHttpClient; } })); -var getClient_js_1 = __nccwpck_require__(15714); -Object.defineProperty(exports, "getClient", ({ enumerable: true, get: function () { return getClient_js_1.getClient; } })); -var operationOptionHelpers_js_1 = __nccwpck_require__(16857); -Object.defineProperty(exports, "operationOptionsToRequestParameters", ({ enumerable: true, get: function () { return operationOptionHelpers_js_1.operationOptionsToRequestParameters; } })); -var restError_js_2 = __nccwpck_require__(24193); -Object.defineProperty(exports, "createRestError", ({ enumerable: true, get: function () { return restError_js_2.createRestError; } })); -//# sourceMappingURL=index.js.map +//# sourceMappingURL=BuilderFunctions.js.map /***/ }), -/***/ 85930: +/***/ 47059: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.logger = void 0; -const logger_js_1 = __nccwpck_require__(36720); -exports.logger = (0, logger_js_1.createClientLogger)("ts-http-runtime"); -//# sourceMappingURL=log.js.map +exports.createCB = createCB; +exports.fragmentCB = fragmentCB; +const _1 = __nccwpck_require__(2106); +/** + * Creates an XML builder which serializes the document in chunks. + * + * @param options - callback builder options + * + * @returns callback builder + */ +function createCB(options) { + return new _1.XMLBuilderCBImpl(options); +} +/** + * Creates an XML builder which serializes the fragment in chunks. + * + * @param options - callback builder options + * + * @returns callback builder + */ +function fragmentCB(options) { + return new _1.XMLBuilderCBImpl(options, true); +} +//# sourceMappingURL=BuilderFunctionsCB.js.map /***/ }), -/***/ 34907: +/***/ 20282: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -const log_js_1 = __nccwpck_require__(57792); -const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined; -let enabledString; -let enabledNamespaces = []; -let skippedNamespaces = []; -const debuggers = []; -if (debugEnvVariable) { - enable(debugEnvVariable); -} -const debugObj = Object.assign((namespace) => { - return createDebugger(namespace); -}, { - enable, - enabled, - disable, - log: log_js_1.log, -}); -function enable(namespaces) { - enabledString = namespaces; - enabledNamespaces = []; - skippedNamespaces = []; - const namespaceList = namespaces.split(",").map((ns) => ns.trim()); - for (const ns of namespaceList) { - if (ns.startsWith("-")) { - skippedNamespaces.push(ns.substring(1)); +exports.XMLBuilderCBImpl = void 0; +const interfaces_1 = __nccwpck_require__(81348); +const util_1 = __nccwpck_require__(76195); +const BuilderFunctions_1 = __nccwpck_require__(13810); +const algorithm_1 = __nccwpck_require__(61); +const infra_1 = __nccwpck_require__(84251); +const NamespacePrefixMap_1 = __nccwpck_require__(90283); +const LocalNameSet_1 = __nccwpck_require__(19049); +const util_2 = __nccwpck_require__(65282); +const XMLCBWriter_1 = __nccwpck_require__(7299); +const JSONCBWriter_1 = __nccwpck_require__(3198); +const YAMLCBWriter_1 = __nccwpck_require__(32770); +const events_1 = __nccwpck_require__(82361); +/** + * Represents a readable XML document stream. + */ +class XMLBuilderCBImpl extends events_1.EventEmitter { + static _VoidElementNames = new Set(['area', 'base', 'basefont', + 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); + _options; + _builderOptions; + _writer; + _fragment; + _hasDeclaration = false; + _docTypeName = ""; + _hasDocumentElement = false; + _currentElement; + _currentElementSerialized = false; + _openTags = []; + _prefixMap; + _prefixIndex; + _ended = false; + /** + * Initializes a new instance of `XMLStream`. + * + * @param options - stream writer options + * @param fragment - whether to create fragment stream or a document stream + * + * @returns XML stream + */ + constructor(options, fragment = false) { + super(); + this._fragment = fragment; + // provide default options + this._options = (0, util_1.applyDefaults)(options || {}, interfaces_1.DefaultXMLBuilderCBOptions); + this._builderOptions = { + defaultNamespace: this._options.defaultNamespace, + namespaceAlias: this._options.namespaceAlias + }; + if (this._options.format === "json") { + this._writer = new JSONCBWriter_1.JSONCBWriter(this._options); + } + else if (this._options.format === "yaml") { + this._writer = new YAMLCBWriter_1.YAMLCBWriter(this._options); } else { - enabledNamespaces.push(ns); + this._writer = new XMLCBWriter_1.XMLCBWriter(this._options); + } + // automatically create listeners for callbacks passed via options + if (this._options.data !== undefined) { + this.on("data", this._options.data); } + if (this._options.end !== undefined) { + this.on("end", this._options.end); + } + if (this._options.error !== undefined) { + this.on("error", this._options.error); + } + this._prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); + this._prefixMap.set("xml", infra_1.namespace.XML); + this._prefixIndex = { value: 1 }; + this._push(this._writer.frontMatter()); } - for (const instance of debuggers) { - instance.enabled = enabled(instance.namespace); + /** @inheritdoc */ + ele(p1, p2, p3) { + // parse if JS object or XML or JSON string + if ((0, util_1.isObject)(p1) || ((0, util_1.isString)(p1) && (/^\s*/g, '>'); + this._push(this._writer.text(markup)); + const lastEl = this._openTags[this._openTags.length - 1]; + // edge case: text on top level. + if (lastEl) { + lastEl[lastEl.length - 1] = true; + } + return this; + } + /** @inheritdoc */ + ins(target, content = '') { + this._serializeOpenTag(true); + let node; + try { + node = (0, BuilderFunctions_1.fragment)(this._builderOptions).ins(target, content).first().node; + } + catch (err) { + /* istanbul ignore next */ + this.emit("error", err); + /* istanbul ignore next */ + return this; + } + if (this._options.wellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) { + this.emit("error", new Error("Processing instruction target contains invalid characters (well-formed required).")); + return this; + } + if (this._options.wellFormed && !(0, algorithm_1.xml_isLegalChar)(node.data)) { + this.emit("error", Error("Processing instruction data contains invalid characters (well-formed required).")); + return this; + } + this._push(this._writer.instruction(node.target, node.data)); + return this; + } + /** @inheritdoc */ + dat(content) { + this._serializeOpenTag(true); + let node; + try { + node = (0, BuilderFunctions_1.fragment)(this._builderOptions).dat(content).first().node; + } + catch (err) { + this.emit("error", err); + return this; + } + this._push(this._writer.cdata(node.data)); + return this; + } + /** @inheritdoc */ + dec(options = { version: "1.0" }) { + if (this._fragment) { + this.emit("error", Error("Cannot insert an XML declaration into a document fragment.")); + return this; + } + if (this._hasDeclaration) { + this.emit("error", Error("XML declaration is already inserted.")); + return this; + } + this._push(this._writer.declaration(options.version || "1.0", options.encoding, options.standalone)); + this._hasDeclaration = true; + return this; + } + /** @inheritdoc */ + dtd(options) { + if (this._fragment) { + this.emit("error", Error("Cannot insert a DocType declaration into a document fragment.")); + return this; + } + if (this._docTypeName !== "") { + this.emit("error", new Error("DocType declaration is already inserted.")); + return this; + } + if (this._hasDocumentElement) { + this.emit("error", new Error("Cannot insert DocType declaration after document element.")); + return this; + } + let node; + try { + node = (0, BuilderFunctions_1.create)().dtd(options).first().node; + } + catch (err) { + this.emit("error", err); + return this; + } + if (this._options.wellFormed && !(0, algorithm_1.xml_isPubidChar)(node.publicId)) { + this.emit("error", new Error("DocType public identifier does not match PubidChar construct (well-formed required).")); + return this; + } + if (this._options.wellFormed && + (!(0, algorithm_1.xml_isLegalChar)(node.systemId) || + (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { + this.emit("error", new Error("DocType system identifier contains invalid characters (well-formed required).")); + return this; + } + this._docTypeName = options.name; + this._push(this._writer.docType(options.name, node.publicId, node.systemId)); + return this; + } + /** @inheritdoc */ + import(node) { + const frag = (0, BuilderFunctions_1.fragment)().set(this._options); + try { + frag.import(node); + } + catch (err) { + this.emit("error", err); + return this; } - } - for (const enabledNamespace of enabledNamespaces) { - if (namespaceMatches(namespace, enabledNamespace)) { - return true; + for (const node of frag.node.childNodes) { + this._fromNode(node); } + return this; } - return false; -} -/** - * Given a namespace, check if it matches a pattern. - * Patterns only have a single wildcard character which is *. - * The behavior of * is that it matches zero or more other characters. - */ -function namespaceMatches(namespace, patternToMatch) { - // simple case, no pattern matching required - if (patternToMatch.indexOf("*") === -1) { - return namespace === patternToMatch; + /** @inheritdoc */ + up() { + this._serializeOpenTag(false); + this._serializeCloseTag(); + return this; } - let pattern = patternToMatch; - // normalize successive * if needed - if (patternToMatch.indexOf("**") !== -1) { - const patternParts = []; - let lastCharacter = ""; - for (const character of patternToMatch) { - if (character === "*" && lastCharacter === "*") { - continue; + /** @inheritdoc */ + end() { + this._serializeOpenTag(false); + while (this._openTags.length > 0) { + this._serializeCloseTag(); + } + this._push(null); + return this; + } + /** + * Serializes the opening tag of an element node. + * + * @param hasChildren - whether the element node has child nodes + */ + _serializeOpenTag(hasChildren) { + if (this._currentElementSerialized) + return; + if (this._currentElement === undefined) + return; + const node = this._currentElement.node; + if (this._options.wellFormed && (node.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(node.localName))) { + this.emit("error", new Error("Node local name contains invalid characters (well-formed required).")); + return; + } + let qualifiedName = ""; + let ignoreNamespaceDefinitionAttribute = false; + let map = this._prefixMap.copy(); + let localPrefixesMap = {}; + let localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); + let inheritedNS = this._openTags.length === 0 ? null : this._openTags[this._openTags.length - 1][1]; + let ns = node.namespaceURI; + if (ns === null) + ns = inheritedNS; + if (inheritedNS === ns) { + if (localDefaultNamespace !== null) { + ignoreNamespaceDefinitionAttribute = true; + } + if (ns === infra_1.namespace.XML) { + qualifiedName = "xml:" + node.localName; } else { - lastCharacter = character; - patternParts.push(character); + qualifiedName = node.localName; } + this._writer.beginElement(qualifiedName); + this._push(this._writer.openTagBegin(qualifiedName)); } - pattern = patternParts.join(""); - } - let namespaceIndex = 0; - let patternIndex = 0; - const patternLength = pattern.length; - const namespaceLength = namespace.length; - let lastWildcard = -1; - let lastWildcardNamespace = -1; - while (namespaceIndex < namespaceLength && patternIndex < patternLength) { - if (pattern[patternIndex] === "*") { - lastWildcard = patternIndex; - patternIndex++; - if (patternIndex === patternLength) { - // if wildcard is the last character, it will match the remaining namespace string - return true; + else { + let prefix = node.prefix; + let candidatePrefix = null; + if (prefix !== null || ns !== localDefaultNamespace) { + candidatePrefix = map.get(prefix, ns); } - // now we let the wildcard eat characters until we match the next literal in the pattern - while (namespace[namespaceIndex] !== pattern[patternIndex]) { - namespaceIndex++; - // reached the end of the namespace without a match - if (namespaceIndex === namespaceLength) { - return false; + if (prefix === "xmlns") { + if (this._options.wellFormed) { + this.emit("error", new Error("An element cannot have the 'xmlns' prefix (well-formed required).")); + return; } + candidatePrefix = prefix; } - // now that we have a match, let's try to continue on - // however, it's possible we could find a later match - // so keep a reference in case we have to backtrack - lastWildcardNamespace = namespaceIndex; - namespaceIndex++; - patternIndex++; - continue; - } - else if (pattern[patternIndex] === namespace[namespaceIndex]) { - // simple case: literal pattern matches so keep going - patternIndex++; - namespaceIndex++; - } - else if (lastWildcard >= 0) { - // special case: we don't have a literal match, but there is a previous wildcard - // which we can backtrack to and try having the wildcard eat the match instead - patternIndex = lastWildcard + 1; - namespaceIndex = lastWildcardNamespace + 1; - // we've reached the end of the namespace without a match - if (namespaceIndex === namespaceLength) { - return false; + if (candidatePrefix !== null) { + qualifiedName = candidatePrefix + ':' + node.localName; + if (localDefaultNamespace !== null && localDefaultNamespace !== infra_1.namespace.XML) { + inheritedNS = localDefaultNamespace || null; + } + this._writer.beginElement(qualifiedName); + this._push(this._writer.openTagBegin(qualifiedName)); } - // similar to the previous logic, let's keep going until we find the next literal match - while (namespace[namespaceIndex] !== pattern[patternIndex]) { - namespaceIndex++; - if (namespaceIndex === namespaceLength) { - return false; + else if (prefix !== null) { + if (prefix in localPrefixesMap) { + prefix = this._generatePrefix(ns, map, this._prefixIndex); + } + map.set(prefix, ns); + qualifiedName += prefix + ':' + node.localName; + this._writer.beginElement(qualifiedName); + this._push(this._writer.openTagBegin(qualifiedName)); + this._push(this._writer.attribute("xmlns:" + prefix, this._serializeAttributeValue(ns, this._options.wellFormed))); + if (localDefaultNamespace !== null) { + inheritedNS = localDefaultNamespace || null; } } - lastWildcardNamespace = namespaceIndex; - namespaceIndex++; - patternIndex++; - continue; + else if (localDefaultNamespace === null || + (localDefaultNamespace !== null && localDefaultNamespace !== ns)) { + ignoreNamespaceDefinitionAttribute = true; + qualifiedName += node.localName; + inheritedNS = ns; + this._writer.beginElement(qualifiedName); + this._push(this._writer.openTagBegin(qualifiedName)); + this._push(this._writer.attribute("xmlns", this._serializeAttributeValue(ns, this._options.wellFormed))); + } + else { + qualifiedName += node.localName; + inheritedNS = ns; + this._writer.beginElement(qualifiedName); + this._push(this._writer.openTagBegin(qualifiedName)); + } + } + this._serializeAttributes(node, map, this._prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, this._options.wellFormed); + const isHTML = (ns === infra_1.namespace.HTML); + if (isHTML && !hasChildren && + XMLBuilderCBImpl._VoidElementNames.has(node.localName)) { + this._push(this._writer.openTagEnd(qualifiedName, true, true)); + this._writer.endElement(qualifiedName); + } + else if (!isHTML && !hasChildren) { + this._push(this._writer.openTagEnd(qualifiedName, true, false)); + this._writer.endElement(qualifiedName); } else { - return false; + this._push(this._writer.openTagEnd(qualifiedName, false, false)); + } + this._currentElementSerialized = true; + /** + * Save qualified name, original inherited ns, original prefix map, and + * hasChildren flag. + */ + this._openTags.push([qualifiedName, inheritedNS, this._prefixMap, hasChildren, undefined]); + /** + * New values of inherited namespace and prefix map will be used while + * serializing child nodes. They will be returned to their original values + * when this node is closed using the _openTags array item we saved above. + */ + if (this._isPrefixMapModified(this._prefixMap, map)) { + this._prefixMap = map; } + /** + * Calls following this will either serialize child nodes or close this tag. + */ + this._writer.level++; } - const namespaceDone = namespaceIndex === namespace.length; - const patternDone = patternIndex === pattern.length; - // this is to detect the case of an unneeded final wildcard - // e.g. the pattern `ab*` should match the string `ab` - const trailingWildCard = patternIndex === pattern.length - 1 && pattern[patternIndex] === "*"; - return namespaceDone && (patternDone || trailingWildCard); -} -function disable() { - const result = enabledString || ""; - enable(""); - return result; -} -function createDebugger(namespace) { - const newDebugger = Object.assign(debug, { - enabled: enabled(namespace), - destroy, - log: debugObj.log, - namespace, - extend, - }); - function debug(...args) { - if (!newDebugger.enabled) { + /** + * Serializes the closing tag of an element node. + */ + _serializeCloseTag() { + this._writer.level--; + const lastEle = this._openTags.pop(); + /* istanbul ignore next */ + if (lastEle === undefined) { + this.emit("error", new Error("Last element is undefined.")); return; } - if (args.length > 0) { - args[0] = `${namespace} ${args[0]}`; - } - newDebugger.log(...args); - } - debuggers.push(newDebugger); - return newDebugger; -} -function destroy() { - const index = debuggers.indexOf(this); - if (index >= 0) { - debuggers.splice(index, 1); - return true; + const [qualifiedName, ns, map, hasChildren, hasTextPayload] = lastEle; + /** + * Restore original values of inherited namespace and prefix map. + */ + this._prefixMap = map; + if (!hasChildren) + return; + this._push(this._writer.closeTag(qualifiedName, hasTextPayload)); + this._writer.endElement(qualifiedName); } - return false; -} -function extend(namespace) { - const newDebugger = createDebugger(`${this.namespace}:${namespace}`); - newDebugger.log = this.log; - return newDebugger; -} -exports["default"] = debugObj; -//# sourceMappingURL=debug.js.map - -/***/ }), - -/***/ 46244: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createLoggerContext = void 0; -var logger_js_1 = __nccwpck_require__(36720); -Object.defineProperty(exports, "createLoggerContext", ({ enumerable: true, get: function () { return logger_js_1.createLoggerContext; } })); -//# sourceMappingURL=internal.js.map - -/***/ }), - -/***/ 57792: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.log = log; -const tslib_1 = __nccwpck_require__(4351); -const node_os_1 = __nccwpck_require__(70612); -const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(47261)); -const node_process_1 = tslib_1.__importDefault(__nccwpck_require__(97742)); -function log(message, ...args) { - node_process_1.default.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`); -} -//# sourceMappingURL=log.js.map - -/***/ }), - -/***/ 36720: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.TypeSpecRuntimeLogger = void 0; -exports.createLoggerContext = createLoggerContext; -exports.setLogLevel = setLogLevel; -exports.getLogLevel = getLogLevel; -exports.createClientLogger = createClientLogger; -const tslib_1 = __nccwpck_require__(4351); -const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(34907)); -const TYPESPEC_RUNTIME_LOG_LEVELS = ["verbose", "info", "warning", "error"]; -const levelMap = { - verbose: 400, - info: 300, - warning: 200, - error: 100, -}; -function patchLogMethod(parent, child) { - child.log = (...args) => { - parent.log(...args); - }; -} -function isTypeSpecRuntimeLogLevel(level) { - return TYPESPEC_RUNTIME_LOG_LEVELS.includes(level); -} -/** - * Creates a logger context base on the provided options. - * @param options - The options for creating a logger context. - * @returns The logger context. - */ -function createLoggerContext(options) { - const registeredLoggers = new Set(); - const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env[options.logLevelEnvVarName]) || - undefined; - let logLevel; - const clientLogger = (0, debug_js_1.default)(options.namespace); - clientLogger.log = (...args) => { - debug_js_1.default.log(...args); - }; - function contextSetLogLevel(level) { - if (level && !isTypeSpecRuntimeLogLevel(level)) { - throw new Error(`Unknown log level '${level}'. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(",")}`); + /** + * Pushes data to internal buffer. + * + * @param data - data + */ + _push(data) { + if (data === null) { + this._ended = true; + this.emit("end"); } - logLevel = level; - const enabledNamespaces = []; - for (const logger of registeredLoggers) { - if (shouldEnable(logger)) { - enabledNamespaces.push(logger.namespace); - } + else if (this._ended) { + this.emit("error", new Error("Cannot push to ended stream.")); + } + else if (data.length !== 0) { + this._writer.hasData = true; + this.emit("data", data, this._writer.level); } - debug_js_1.default.enable(enabledNamespaces.join(",")); } - if (logLevelFromEnv) { - // avoid calling setLogLevel because we don't want a mis-set environment variable to crash - if (isTypeSpecRuntimeLogLevel(logLevelFromEnv)) { - contextSetLogLevel(logLevelFromEnv); + /** + * Reads and serializes an XML tree. + * + * @param node - root node + */ + _fromNode(node) { + if (util_2.Guard.isElementNode(node)) { + const name = node.prefix ? node.prefix + ":" + node.localName : node.localName; + if (node.namespaceURI !== null) { + this.ele(node.namespaceURI, name); + } + else { + this.ele(name); + } + for (const attr of node.attributes) { + const name = attr.prefix ? attr.prefix + ":" + attr.localName : attr.localName; + if (attr.namespaceURI !== null) { + this.att(attr.namespaceURI, name, attr.value); + } + else { + this.att(name, attr.value); + } + } + for (const child of node.childNodes) { + this._fromNode(child); + } + this.up(); } - else { - console.error(`${options.logLevelEnvVarName} set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${TYPESPEC_RUNTIME_LOG_LEVELS.join(", ")}.`); + else if (util_2.Guard.isExclusiveTextNode(node) && node.data) { + this.txt(node.data); } - } - function shouldEnable(logger) { - return Boolean(logLevel && levelMap[logger.level] <= levelMap[logLevel]); - } - function createLogger(parent, level) { - const logger = Object.assign(parent.extend(level), { - level, - }); - patchLogMethod(parent, logger); - if (shouldEnable(logger)) { - const enabledNamespaces = debug_js_1.default.disable(); - debug_js_1.default.enable(enabledNamespaces + "," + logger.namespace); + else if (util_2.Guard.isCommentNode(node)) { + this.com(node.data); + } + else if (util_2.Guard.isCDATASectionNode(node)) { + this.dat(node.data); + } + else if (util_2.Guard.isProcessingInstructionNode(node)) { + this.ins(node.target, node.data); } - registeredLoggers.add(logger); - return logger; } - function contextGetLogLevel() { - return logLevel; + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param map - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param localPrefixesMap - local prefixes map + * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace + * attributes + * @param requireWellFormed - whether to check conformance + */ + _serializeAttributes(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { + const localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; + for (const attr of node.attributes) { + // Optimize common case + if (!requireWellFormed && !ignoreNamespaceDefinitionAttribute && attr.namespaceURI === null) { + this._push(this._writer.attribute(attr.localName, this._serializeAttributeValue(attr.value, this._options.wellFormed))); + continue; + } + if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { + this.emit("error", new Error("Element contains duplicate attributes (well-formed required).")); + return; + } + if (requireWellFormed && localNameSet) + localNameSet.set(attr.namespaceURI, attr.localName); + let attributeNamespace = attr.namespaceURI; + let candidatePrefix = null; + if (attributeNamespace !== null) { + candidatePrefix = map.get(attr.prefix, attributeNamespace); + if (attributeNamespace === infra_1.namespace.XMLNS) { + if (attr.value === infra_1.namespace.XML || + (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || + (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || + localPrefixesMap[attr.localName] !== attr.value) && + map.has(attr.localName, attr.value))) + continue; + if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { + this.emit("error", new Error("XMLNS namespace is reserved (well-formed required).")); + return; + } + if (requireWellFormed && attr.value === '') { + this.emit("error", new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required).")); + return; + } + if (attr.prefix === 'xmlns') + candidatePrefix = 'xmlns'; + /** + * _Note:_ The (candidatePrefix === null) check is not in the spec. + * We deviate from the spec here. Otherwise a prefix is generated for + * all attributes with namespaces. + */ + } + else if (candidatePrefix === null) { + if (attr.prefix !== null && + (!map.hasPrefix(attr.prefix) || + map.has(attr.prefix, attributeNamespace))) { + /** + * Check if we can use the attribute's own prefix. + * We deviate from the spec here. + * TODO: This is not an efficient way of searching for prefixes. + * Follow developments to the spec. + */ + candidatePrefix = attr.prefix; + } + else { + candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); + } + this._push(this._writer.attribute("xmlns:" + candidatePrefix, this._serializeAttributeValue(attributeNamespace, this._options.wellFormed))); + } + } + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(attr.localName) || + (attr.localName === "xmlns" && attributeNamespace === null))) { + this.emit("error", new Error("Attribute local name contains invalid characters (well-formed required).")); + return; + } + this._push(this._writer.attribute((candidatePrefix !== null ? candidatePrefix + ":" : "") + attr.localName, this._serializeAttributeValue(attr.value, this._options.wellFormed))); + } } - function contextCreateClientLogger(namespace) { - const clientRootLogger = clientLogger.extend(namespace); - patchLogMethod(clientLogger, clientRootLogger); - return { - error: createLogger(clientRootLogger, "error"), - warning: createLogger(clientRootLogger, "warning"), - info: createLogger(clientRootLogger, "info"), - verbose: createLogger(clientRootLogger, "verbose"), - }; + /** + * Produces an XML serialization of an attribute value. + * + * @param value - attribute value + * @param requireWellFormed - whether to check conformance + */ + _serializeAttributeValue(value, requireWellFormed) { + if (requireWellFormed && value !== null && !(0, algorithm_1.xml_isLegalChar)(value)) { + this.emit("error", new Error("Invalid characters in attribute value.")); + return ""; + } + if (value === null) + return ""; + return value.replace(/(?!&(lt|gt|amp|apos|quot);)&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); + } + /** + * Records namespace information for the given element and returns the + * default namespace attribute value. + * + * @param node - element node to process + * @param map - namespace prefix map + * @param localPrefixesMap - local prefixes map + */ + _recordNamespaceInformation(node, map, localPrefixesMap) { + let defaultNamespaceAttrValue = null; + for (const attr of node.attributes) { + let attributeNamespace = attr.namespaceURI; + let attributePrefix = attr.prefix; + if (attributeNamespace === infra_1.namespace.XMLNS) { + if (attributePrefix === null) { + defaultNamespaceAttrValue = attr.value; + continue; + } + else { + let prefixDefinition = attr.localName; + let namespaceDefinition = attr.value; + if (namespaceDefinition === infra_1.namespace.XML) { + continue; + } + if (namespaceDefinition === '') { + namespaceDefinition = null; + } + if (map.has(prefixDefinition, namespaceDefinition)) { + continue; + } + map.set(prefixDefinition, namespaceDefinition); + localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; + } + } + } + return defaultNamespaceAttrValue; + } + /** + * Generates a new prefix for the given namespace. + * + * @param newNamespace - a namespace to generate prefix for + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + */ + _generatePrefix(newNamespace, prefixMap, prefixIndex) { + let generatedPrefix = "ns" + prefixIndex.value; + prefixIndex.value++; + prefixMap.set(generatedPrefix, newNamespace); + return generatedPrefix; + } + /** + * Determines if the namespace prefix map was modified from its original. + * + * @param originalMap - original namespace prefix map + * @param newMap - new namespace prefix map + */ + _isPrefixMapModified(originalMap, newMap) { + const items1 = originalMap._items; + const items2 = newMap._items; + const nullItems1 = originalMap._nullItems; + const nullItems2 = newMap._nullItems; + for (const key in items2) { + const arr1 = items1[key]; + if (arr1 === undefined) + return true; + const arr2 = items2[key]; + if (arr1.length !== arr2.length) + return true; + for (let i = 0; i < arr1.length; i++) { + if (arr1[i] !== arr2[i]) + return true; + } + } + if (nullItems1.length !== nullItems2.length) + return true; + for (let i = 0; i < nullItems1.length; i++) { + if (nullItems1[i] !== nullItems2[i]) + return true; + } + return false; } - return { - setLogLevel: contextSetLogLevel, - getLogLevel: contextGetLogLevel, - createClientLogger: contextCreateClientLogger, - logger: clientLogger, - }; -} -const context = createLoggerContext({ - logLevelEnvVarName: "TYPESPEC_RUNTIME_LOG_LEVEL", - namespace: "typeSpecRuntime", -}); -/** - * Immediately enables logging at the specified log level. If no level is specified, logging is disabled. - * @param level - The log level to enable for logging. - * Options from most verbose to least verbose are: - * - verbose - * - info - * - warning - * - error - */ -// eslint-disable-next-line @typescript-eslint/no-redeclare -exports.TypeSpecRuntimeLogger = context.logger; -/** - * Retrieves the currently specified log level. - */ -function setLogLevel(logLevel) { - context.setLogLevel(logLevel); -} -/** - * Retrieves the currently specified log level. - */ -function getLogLevel() { - return context.getLogLevel(); -} -/** - * Creates a logger for use by the SDKs that inherits from `TypeSpecRuntimeLogger`. - * @param namespace - The name of the SDK package. - * @hidden - */ -function createClientLogger(namespace) { - return context.createClientLogger(namespace); } -//# sourceMappingURL=logger.js.map +exports.XMLBuilderCBImpl = XMLBuilderCBImpl; +//# sourceMappingURL=XMLBuilderCBImpl.js.map /***/ }), -/***/ 63098: +/***/ 10584: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getBodyLength = getBodyLength; -exports.createNodeHttpClient = createNodeHttpClient; -const tslib_1 = __nccwpck_require__(4351); -const node_http_1 = tslib_1.__importDefault(__nccwpck_require__(88849)); -const node_https_1 = tslib_1.__importDefault(__nccwpck_require__(22286)); -const node_zlib_1 = tslib_1.__importDefault(__nccwpck_require__(65628)); -const node_stream_1 = __nccwpck_require__(84492); -const AbortError_js_1 = __nccwpck_require__(72033); -const httpHeaders_js_1 = __nccwpck_require__(66816); -const restError_js_1 = __nccwpck_require__(42858); -const log_js_1 = __nccwpck_require__(85930); -const sanitizer_js_1 = __nccwpck_require__(61416); -const DEFAULT_TLS_SETTINGS = {}; -function isReadableStream(body) { - return body && typeof body.pipe === "function"; -} -function isStreamComplete(stream) { - if (stream.readable === false) { - return Promise.resolve(); +exports.XMLBuilderImpl = void 0; +const interfaces_1 = __nccwpck_require__(81348); +const util_1 = __nccwpck_require__(76195); +const writers_1 = __nccwpck_require__(70469); +const interfaces_2 = __nccwpck_require__(27305); +const util_2 = __nccwpck_require__(65282); +const algorithm_1 = __nccwpck_require__(61); +const dom_1 = __nccwpck_require__(1256); +const infra_1 = __nccwpck_require__(84251); +const readers_1 = __nccwpck_require__(90241); +/** + * Represents a wrapper that extends XML nodes to implement easy to use and + * chainable document builder methods. + */ +class XMLBuilderImpl { + _domNode; + /** + * Initializes a new instance of `XMLBuilderNodeImpl`. + * + * @param domNode - the DOM node to wrap + */ + constructor(domNode) { + this._domNode = domNode; } - return new Promise((resolve) => { - const handler = () => { - resolve(); - stream.removeListener("close", handler); - stream.removeListener("end", handler); - stream.removeListener("error", handler); - }; - stream.on("close", handler); - stream.on("end", handler); - stream.on("error", handler); - }); -} -function isArrayBuffer(body) { - return body && typeof body.byteLength === "number"; -} -class ReportTransform extends node_stream_1.Transform { - loadedBytes = 0; - progressCallback; - // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type - _transform(chunk, _encoding, callback) { - this.push(chunk); - this.loadedBytes += chunk.length; - try { - this.progressCallback({ loadedBytes: this.loadedBytes }); - callback(); + /** @inheritdoc */ + get node() { return this._domNode; } + /** @inheritdoc */ + get options() { return this._options; } + /** @inheritdoc */ + set(options) { + this._options = (0, util_1.applyDefaults)((0, util_1.applyDefaults)(this._options, options, true), // apply user settings + interfaces_1.DefaultBuilderOptions); // provide defaults + return this; + } + /** @inheritdoc */ + ele(p1, p2, p3) { + let namespace; + let name; + let attributes; + if ((0, util_1.isObject)(p1)) { + // ele(obj: ExpandObject) + return new readers_1.ObjectReader(this._options).parse(this, p1); } - catch (e) { - callback(e); + else if ((0, util_1.isString)(p1) && p1 !== null && /^\s* { - if (event.type === "abort") { - abortController.abort(); - } - }; - request.abortSignal.addEventListener("abort", abortListener); + /** @inheritdoc */ + att(p1, p2, p3) { + if ((0, util_1.isMap)(p1) || (0, util_1.isObject)(p1)) { + // att(obj: AttributesObject) + // expand if object + (0, util_1.forEachObject)(p1, (attName, attValue) => this.att(attName, attValue), this); + return this; } - let timeoutId; - if (request.timeout > 0) { - timeoutId = setTimeout(() => { - const sanitizer = new sanitizer_js_1.Sanitizer(); - log_js_1.logger.info(`request to '${sanitizer.sanitizeUrl(request.url)}' timed out. canceling...`); - abortController.abort(); - }, request.timeout); + // get primitive values + if (p1 !== undefined && p1 !== null) + p1 = (0, util_1.getValue)(p1 + ""); + if (p2 !== undefined && p2 !== null) + p2 = (0, util_1.getValue)(p2 + ""); + if (p3 !== undefined && p3 !== null) + p3 = (0, util_1.getValue)(p3 + ""); + let namespace; + let name; + let value; + if ((p1 === null || (0, util_1.isString)(p1)) && (0, util_1.isString)(p2) && (p3 === null || (0, util_1.isString)(p3))) { + // att(namespace: string, name: string, value: string) + [namespace, name, value] = [p1, p2, p3]; } - const acceptEncoding = request.headers.get("Accept-Encoding"); - const shouldDecompress = acceptEncoding?.includes("gzip") || acceptEncoding?.includes("deflate"); - let body = typeof request.body === "function" ? request.body() : request.body; - if (body && !request.headers.has("Content-Length")) { - const bodyLength = getBodyLength(body); - if (bodyLength !== null) { - request.headers.set("Content-Length", bodyLength); - } + else if ((0, util_1.isString)(p1) && (p2 == null || (0, util_1.isString)(p2))) { + // ele(name: string, value: string) + [namespace, name, value] = [undefined, p1, p2]; } - let responseStream; - try { - if (body && request.onUploadProgress) { - const onUploadProgress = request.onUploadProgress; - const uploadReportStream = new ReportTransform(onUploadProgress); - uploadReportStream.on("error", (e) => { - log_js_1.logger.error("Error in upload progress", e); - }); - if (isReadableStream(body)) { - body.pipe(uploadReportStream); - } - else { - uploadReportStream.end(body); - } - body = uploadReportStream; - } - const res = await this.makeRequest(request, abortController, body); - if (timeoutId !== undefined) { - clearTimeout(timeoutId); - } - const headers = getResponseHeaders(res); - const status = res.statusCode ?? 0; - const response = { - status, - headers, - request, - }; - // Responses to HEAD must not have a body. - // If they do return a body, that body must be ignored. - if (request.method === "HEAD") { - // call resume() and not destroy() to avoid closing the socket - // and losing keep alive - res.resume(); - return response; - } - responseStream = shouldDecompress ? getDecodedResponseStream(res, headers) : res; - const onDownloadProgress = request.onDownloadProgress; - if (onDownloadProgress) { - const downloadReportStream = new ReportTransform(onDownloadProgress); - downloadReportStream.on("error", (e) => { - log_js_1.logger.error("Error in download progress", e); - }); - responseStream.pipe(downloadReportStream); - responseStream = downloadReportStream; - } - if ( - // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code - request.streamResponseStatusCodes?.has(Number.POSITIVE_INFINITY) || - request.streamResponseStatusCodes?.has(response.status)) { - response.readableStreamBody = responseStream; - } - else { - response.bodyAsText = await streamToText(responseStream); - } - return response; + else { + throw new Error("Attribute name and value not specified. " + this._debugInfo()); } - finally { - // clean up event listener - if (request.abortSignal && abortListener) { - let uploadStreamDone = Promise.resolve(); - if (isReadableStream(body)) { - uploadStreamDone = isStreamComplete(body); - } - let downloadStreamDone = Promise.resolve(); - if (isReadableStream(responseStream)) { - downloadStreamDone = isStreamComplete(responseStream); - } - Promise.all([uploadStreamDone, downloadStreamDone]) - .then(() => { - // eslint-disable-next-line promise/always-return - if (abortListener) { - request.abortSignal?.removeEventListener("abort", abortListener); - } - }) - .catch((e) => { - log_js_1.logger.warning("Error when cleaning up abortListener on httpRequest", e); - }); + if (this._options.keepNullAttributes && (value == null)) { + // keep null attributes + value = ""; + } + else if (value == null) { + // skip null|undefined attributes + return this; + } + if (!util_2.Guard.isElementNode(this.node)) { + throw new Error("An attribute can only be assigned to an element node."); + } + let ele = this.node; + [namespace, name] = this._extractNamespace(namespace, name, false); + name = (0, dom_1.sanitizeInput)(name, this._options.invalidCharReplacement); + namespace = (0, dom_1.sanitizeInput)(namespace, this._options.invalidCharReplacement); + value = (0, dom_1.sanitizeInput)(value, this._options.invalidCharReplacement); + const [prefix, localName] = (0, algorithm_1.namespace_extractQName)(name); + const [elePrefix] = (0, algorithm_1.namespace_extractQName)(ele.prefix ? ele.prefix + ':' + ele.localName : ele.localName); + // check if this is a namespace declaration attribute + // assign a new element namespace if it wasn't previously assigned + let eleNamespace = null; + if (prefix === "xmlns") { + namespace = infra_1.namespace.XMLNS; + if (ele.namespaceURI === null && elePrefix === localName) { + eleNamespace = value; } } + else if (prefix === null && localName === "xmlns" && elePrefix === null) { + namespace = infra_1.namespace.XMLNS; + eleNamespace = value; + } + // re-create the element node if its namespace changed + // we can't simply change the namespaceURI since its read-only + if (eleNamespace !== null) { + this._updateNamespace(eleNamespace); + ele = this.node; + } + if (namespace !== undefined) { + ele.setAttributeNS(namespace, name, value); + } + else { + ele.setAttribute(name, value); + } + return this; } - makeRequest(request, abortController, body) { - const url = new URL(request.url); - const isInsecure = url.protocol !== "https:"; - if (isInsecure && !request.allowInsecureConnection) { - throw new Error(`Cannot connect to ${request.url} while allowInsecureConnection is false.`); + /** @inheritdoc */ + removeAtt(p1, p2) { + if (!util_2.Guard.isElementNode(this.node)) { + throw new Error("An attribute can only be removed from an element node."); } - const agent = request.agent ?? this.getOrCreateAgent(request, isInsecure); - const options = { - agent, - hostname: url.hostname, - path: `${url.pathname}${url.search}`, - port: url.port, - method: request.method, - headers: request.headers.toJSON({ preserveCase: true }), - ...request.requestOverrides, - }; - return new Promise((resolve, reject) => { - const req = isInsecure ? node_http_1.default.request(options, resolve) : node_https_1.default.request(options, resolve); - req.once("error", (err) => { - reject(new restError_js_1.RestError(err.message, { code: err.code ?? restError_js_1.RestError.REQUEST_SEND_ERROR, request })); - }); - abortController.signal.addEventListener("abort", () => { - const abortError = new AbortError_js_1.AbortError("The operation was aborted. Rejecting from abort signal callback while making request."); - req.destroy(abortError); - reject(abortError); - }); - if (body && isReadableStream(body)) { - body.pipe(req); - } - else if (body) { - if (typeof body === "string" || Buffer.isBuffer(body)) { - req.end(body); - } - else if (isArrayBuffer(body)) { - req.end(ArrayBuffer.isView(body) ? Buffer.from(body.buffer) : Buffer.from(body)); - } - else { - log_js_1.logger.error("Unrecognized body type", body); - reject(new restError_js_1.RestError("Unrecognized body type")); - } + // get primitive values + p1 = (0, util_1.getValue)(p1); + if (p2 !== undefined) { + p2 = (0, util_1.getValue)(p2); + } + let namespace; + let name; + if (p1 !== null && p2 === undefined) { + name = p1; + } + else if ((p1 === null || (0, util_1.isString)(p1)) && p2 !== undefined) { + namespace = p1; + name = p2; + } + else { + throw new Error("Attribute namespace must be a string. " + this._debugInfo()); + } + if ((0, util_1.isArray)(name) || (0, util_1.isSet)(name)) { + // removeAtt(names: string[]) + // removeAtt(namespace: string, names: string[]) + (0, util_1.forEachArray)(name, attName => namespace === undefined ? this.removeAtt(attName) : this.removeAtt(namespace, attName), this); + } + else if (namespace !== undefined) { + // removeAtt(namespace: string, name: string) + name = (0, dom_1.sanitizeInput)(name, this._options.invalidCharReplacement); + namespace = (0, dom_1.sanitizeInput)(namespace, this._options.invalidCharReplacement); + this.node.removeAttributeNS(namespace, name); + } + else { + // removeAtt(name: string) + name = (0, dom_1.sanitizeInput)(name, this._options.invalidCharReplacement); + this.node.removeAttribute(name); + } + return this; + } + /** @inheritdoc */ + txt(content) { + if (content === null || content === undefined) { + if (this._options.keepNullNodes) { + // keep null nodes + content = ""; } else { - // streams don't like "undefined" being passed as data - req.end(); + // skip null|undefined nodes + return this; } - }); + } + const child = this._doc.createTextNode((0, dom_1.sanitizeInput)(content, this._options.invalidCharReplacement)); + this.node.appendChild(child); + return this; } - getOrCreateAgent(request, isInsecure) { - const disableKeepAlive = request.disableKeepAlive; - // Handle Insecure requests first - if (isInsecure) { - if (disableKeepAlive) { - // keepAlive:false is the default so we don't need a custom Agent - return node_http_1.default.globalAgent; + /** @inheritdoc */ + com(content) { + if (content === null || content === undefined) { + if (this._options.keepNullNodes) { + // keep null nodes + content = ""; } - if (!this.cachedHttpAgent) { - // If there is no cached agent create a new one and cache it. - this.cachedHttpAgent = new node_http_1.default.Agent({ keepAlive: true }); + else { + // skip null|undefined nodes + return this; } - return this.cachedHttpAgent; } - else { - if (disableKeepAlive && !request.tlsSettings) { - // When there are no tlsSettings and keepAlive is false - // we don't need a custom agent - return node_https_1.default.globalAgent; + const child = this._doc.createComment((0, dom_1.sanitizeInput)(content, this._options.invalidCharReplacement)); + this.node.appendChild(child); + return this; + } + /** @inheritdoc */ + dat(content) { + if (content === null || content === undefined) { + if (this._options.keepNullNodes) { + // keep null nodes + content = ""; } - // We use the tlsSettings to index cached clients - const tlsSettings = request.tlsSettings ?? DEFAULT_TLS_SETTINGS; - // Get the cached agent or create a new one with the - // provided values for keepAlive and tlsSettings - let agent = this.cachedHttpsAgents.get(tlsSettings); - if (agent && agent.options.keepAlive === !disableKeepAlive) { - return agent; + else { + // skip null|undefined nodes + return this; } - log_js_1.logger.info("No cached TLS Agent exist, creating a new Agent"); - agent = new node_https_1.default.Agent({ - // keepAlive is true if disableKeepAlive is false. - keepAlive: !disableKeepAlive, - // Since we are spreading, if no tslSettings were provided, nothing is added to the agent options. - ...tlsSettings, - }); - this.cachedHttpsAgents.set(tlsSettings, agent); - return agent; } + const child = this._doc.createCDATASection((0, dom_1.sanitizeInput)(content, this._options.invalidCharReplacement)); + this.node.appendChild(child); + return this; } -} -function getResponseHeaders(res) { - const headers = (0, httpHeaders_js_1.createHttpHeaders)(); - for (const header of Object.keys(res.headers)) { - const value = res.headers[header]; - if (Array.isArray(value)) { - if (value.length > 0) { - headers.set(header, value[0]); + /** @inheritdoc */ + ins(target, content = '') { + if (content === null || content === undefined) { + if (this._options.keepNullNodes) { + // keep null nodes + content = ""; + } + else { + // skip null|undefined nodes + return this; } } - else if (value) { - headers.set(header, value); + if ((0, util_1.isArray)(target) || (0, util_1.isSet)(target)) { + (0, util_1.forEachArray)(target, item => { + item += ""; + const insIndex = item.indexOf(' '); + const insTarget = (insIndex === -1 ? item : item.substr(0, insIndex)); + const insValue = (insIndex === -1 ? '' : item.substr(insIndex + 1)); + this.ins(insTarget, insValue); + }, this); + } + else if ((0, util_1.isMap)(target) || (0, util_1.isObject)(target)) { + (0, util_1.forEachObject)(target, (insTarget, insValue) => this.ins(insTarget, insValue), this); + } + else { + const child = this._doc.createProcessingInstruction((0, dom_1.sanitizeInput)(target, this._options.invalidCharReplacement), (0, dom_1.sanitizeInput)(content, this._options.invalidCharReplacement)); + this.node.appendChild(child); } + return this; } - return headers; -} -function getDecodedResponseStream(stream, headers) { - const contentEncoding = headers.get("Content-Encoding"); - if (contentEncoding === "gzip") { - const unzip = node_zlib_1.default.createGunzip(); - stream.pipe(unzip); - return unzip; + /** @inheritdoc */ + dec(options) { + this._options.version = options.version || "1.0"; + this._options.encoding = options.encoding; + this._options.standalone = options.standalone; + return this; } - else if (contentEncoding === "deflate") { - const inflate = node_zlib_1.default.createInflate(); - stream.pipe(inflate); - return inflate; + /** @inheritdoc */ + dtd(options) { + const name = (0, dom_1.sanitizeInput)((options && options.name) || (this._doc.documentElement ? this._doc.documentElement.tagName : "ROOT"), this._options.invalidCharReplacement); + const pubID = (0, dom_1.sanitizeInput)((options && options.pubID) || "", this._options.invalidCharReplacement); + const sysID = (0, dom_1.sanitizeInput)((options && options.sysID) || "", this._options.invalidCharReplacement); + // name must match document element + if (this._doc.documentElement !== null && name !== this._doc.documentElement.tagName) { + throw new Error("DocType name does not match document element name."); + } + // create doctype node + const docType = this._doc.implementation.createDocumentType(name, pubID, sysID); + if (this._doc.doctype !== null) { + // replace existing doctype + this._doc.replaceChild(docType, this._doc.doctype); + } + else { + // insert before document element node or append to end + this._doc.insertBefore(docType, this._doc.documentElement); + } + return this; } - return stream; -} -function streamToText(stream) { - return new Promise((resolve, reject) => { - const buffer = []; - stream.on("data", (chunk) => { - if (Buffer.isBuffer(chunk)) { - buffer.push(chunk); + /** @inheritdoc */ + import(node) { + const hostNode = this._domNode; + const hostDoc = this._doc; + const importedNode = node.node; + const updateImportedNodeNs = (clone) => { + // update namespace of imported node only when not specified + if (!clone._namespace) { + const [prefix] = (0, algorithm_1.namespace_extractQName)(clone.prefix ? clone.prefix + ':' + clone.localName : clone.localName); + const namespace = hostNode.lookupNamespaceURI(prefix); + new XMLBuilderImpl(clone)._updateNamespace(namespace); } - else { - buffer.push(Buffer.from(chunk)); + }; + if (util_2.Guard.isDocumentNode(importedNode)) { + // import document node + const elementNode = importedNode.documentElement; + if (elementNode === null) { + throw new Error("Imported document has no document element node. " + this._debugInfo()); } - }); - stream.on("end", () => { - resolve(Buffer.concat(buffer).toString("utf8")); - }); - stream.on("error", (e) => { - if (e && e?.name === "AbortError") { - reject(e); + const clone = hostDoc.importNode(elementNode, true); + hostNode.appendChild(clone); + updateImportedNodeNs(clone); + } + else if (util_2.Guard.isDocumentFragmentNode(importedNode)) { + // import child nodes + for (const childNode of importedNode.childNodes) { + const clone = hostDoc.importNode(childNode, true); + hostNode.appendChild(clone); + if (util_2.Guard.isElementNode(clone)) { + updateImportedNodeNs(clone); + } } - else { - reject(new restError_js_1.RestError(`Error reading response as text: ${e.message}`, { - code: restError_js_1.RestError.PARSE_ERROR, - })); + } + else { + // import node + const clone = hostDoc.importNode(importedNode, true); + hostNode.appendChild(clone); + if (util_2.Guard.isElementNode(clone)) { + updateImportedNodeNs(clone); } - }); - }); -} -/** @internal */ -function getBodyLength(body) { - if (!body) { - return 0; + } + return this; } - else if (Buffer.isBuffer(body)) { - return body.length; + /** @inheritdoc */ + doc() { + if (this._doc._isFragment) { + let node = this.node; + while (node && node.nodeType !== interfaces_2.NodeType.DocumentFragment) { + node = node.parentNode; + } + /* istanbul ignore next */ + if (node === null) { + throw new Error("Node has no parent node while searching for document fragment ancestor. " + this._debugInfo()); + } + return new XMLBuilderImpl(node); + } + else { + return new XMLBuilderImpl(this._doc); + } } - else if (isReadableStream(body)) { - return null; + /** @inheritdoc */ + root() { + const ele = this._doc.documentElement; + if (!ele) { + throw new Error("Document root element is null. " + this._debugInfo()); + } + return new XMLBuilderImpl(ele); } - else if (isArrayBuffer(body)) { - return body.byteLength; + /** @inheritdoc */ + up() { + const parent = this._domNode.parentNode; + if (!parent) { + throw new Error("Parent node is null. " + this._debugInfo()); + } + return new XMLBuilderImpl(parent); } - else if (typeof body === "string") { - return Buffer.from(body).length; + /** @inheritdoc */ + prev() { + const node = this._domNode.previousSibling; + if (!node) { + throw new Error("Previous sibling node is null. " + this._debugInfo()); + } + return new XMLBuilderImpl(node); } - else { - return null; + /** @inheritdoc */ + next() { + const node = this._domNode.nextSibling; + if (!node) { + throw new Error("Next sibling node is null. " + this._debugInfo()); + } + return new XMLBuilderImpl(node); } -} -/** - * Create a new HttpClient instance for the NodeJS environment. - * @internal - */ -function createNodeHttpClient() { - return new NodeHttpClient(); -} -//# sourceMappingURL=nodeHttpClient.js.map - -/***/ }), - -/***/ 34744: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createEmptyPipeline = createEmptyPipeline; -const ValidPhaseNames = new Set(["Deserialize", "Serialize", "Retry", "Sign"]); -/** - * A private implementation of Pipeline. - * Do not export this class from the package. - * @internal - */ -class HttpPipeline { - _policies = []; - _orderedPolicies; - constructor(policies) { - this._policies = policies?.slice(0) ?? []; - this._orderedPolicies = undefined; + /** @inheritdoc */ + first() { + const node = this._domNode.firstChild; + if (!node) { + throw new Error("First child node is null. " + this._debugInfo()); + } + return new XMLBuilderImpl(node); } - addPolicy(policy, options = {}) { - if (options.phase && options.afterPhase) { - throw new Error("Policies inside a phase cannot specify afterPhase."); + /** @inheritdoc */ + last() { + const node = this._domNode.lastChild; + if (!node) { + throw new Error("Last child node is null. " + this._debugInfo()); } - if (options.phase && !ValidPhaseNames.has(options.phase)) { - throw new Error(`Invalid phase name: ${options.phase}`); + return new XMLBuilderImpl(node); + } + /** @inheritdoc */ + each(callback, self = false, recursive = false, thisArg) { + let result = this._getFirstDescendantNode(this._domNode, self, recursive); + while (result[0]) { + const nextResult = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); + callback.call(thisArg, new XMLBuilderImpl(result[0]), result[1], result[2]); + result = nextResult; } - if (options.afterPhase && !ValidPhaseNames.has(options.afterPhase)) { - throw new Error(`Invalid afterPhase name: ${options.afterPhase}`); + return this; + } + /** @inheritdoc */ + map(callback, self = false, recursive = false, thisArg) { + let result = []; + this.each((node, index, level) => result.push(callback.call(thisArg, node, index, level)), self, recursive); + return result; + } + /** @inheritdoc */ + reduce(callback, initialValue, self = false, recursive = false, thisArg) { + let value = initialValue; + this.each((node, index, level) => value = callback.call(thisArg, value, node, index, level), self, recursive); + return value; + } + /** @inheritdoc */ + find(predicate, self = false, recursive = false, thisArg) { + let result = this._getFirstDescendantNode(this._domNode, self, recursive); + while (result[0]) { + const builder = new XMLBuilderImpl(result[0]); + if (predicate.call(thisArg, builder, result[1], result[2])) { + return builder; + } + result = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); } - this._policies.push({ - policy, - options, - }); - this._orderedPolicies = undefined; + return undefined; } - removePolicy(options) { - const removedPolicies = []; - this._policies = this._policies.filter((policyDescriptor) => { - if ((options.name && policyDescriptor.policy.name === options.name) || - (options.phase && policyDescriptor.options.phase === options.phase)) { - removedPolicies.push(policyDescriptor.policy); + /** @inheritdoc */ + filter(predicate, self = false, recursive = false, thisArg) { + let result = []; + this.each((node, index, level) => { + if (predicate.call(thisArg, node, index, level)) { + result.push(node); + } + }, self, recursive); + return result; + } + /** @inheritdoc */ + every(predicate, self = false, recursive = false, thisArg) { + let result = this._getFirstDescendantNode(this._domNode, self, recursive); + while (result[0]) { + const builder = new XMLBuilderImpl(result[0]); + if (!predicate.call(thisArg, builder, result[1], result[2])) { return false; } - else { + result = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); + } + return true; + } + /** @inheritdoc */ + some(predicate, self = false, recursive = false, thisArg) { + let result = this._getFirstDescendantNode(this._domNode, self, recursive); + while (result[0]) { + const builder = new XMLBuilderImpl(result[0]); + if (predicate.call(thisArg, builder, result[1], result[2])) { return true; } - }); - this._orderedPolicies = undefined; - return removedPolicies; + result = this._getNextDescendantNode(this._domNode, result[0], recursive, result[1], result[2]); + } + return false; } - sendRequest(httpClient, request) { - const policies = this.getOrderedPolicies(); - const pipeline = policies.reduceRight((next, policy) => { - return (req) => { - return policy.sendRequest(req, next); - }; - }, (req) => httpClient.sendRequest(req)); - return pipeline(request); + /** @inheritdoc */ + toArray(self = false, recursive = false) { + let result = []; + this.each(node => result.push(node), self, recursive); + return result; } - getOrderedPolicies() { - if (!this._orderedPolicies) { - this._orderedPolicies = this.orderPolicies(); + /** @inheritdoc */ + toString(writerOptions) { + writerOptions = writerOptions || {}; + if (writerOptions.format === undefined) { + writerOptions.format = "xml"; } - return this._orderedPolicies; - } - clone() { - return new HttpPipeline(this._policies); + return this._serialize(writerOptions); } - static create() { - return new HttpPipeline(); + /** @inheritdoc */ + toObject(writerOptions) { + writerOptions = writerOptions || {}; + if (writerOptions.format === undefined) { + writerOptions.format = "object"; + } + return this._serialize(writerOptions); } - orderPolicies() { - /** - * The goal of this method is to reliably order pipeline policies - * based on their declared requirements when they were added. - * - * Order is first determined by phase: - * - * 1. Serialize Phase - * 2. Policies not in a phase - * 3. Deserialize Phase - * 4. Retry Phase - * 5. Sign Phase - * - * Within each phase, policies are executed in the order - * they were added unless they were specified to execute - * before/after other policies or after a particular phase. - * - * To determine the final order, we will walk the policy list - * in phase order multiple times until all dependencies are - * satisfied. - * - * `afterPolicies` are the set of policies that must be - * executed before a given policy. This requirement is - * considered satisfied when each of the listed policies - * have been scheduled. - * - * `beforePolicies` are the set of policies that must be - * executed after a given policy. Since this dependency - * can be expressed by converting it into a equivalent - * `afterPolicies` declarations, they are normalized - * into that form for simplicity. - * - * An `afterPhase` dependency is considered satisfied when all - * policies in that phase have scheduled. - * - */ - const result = []; - // Track all policies we know about. - const policyMap = new Map(); - function createPhase(name) { - return { - name, - policies: new Set(), - hasRun: false, - hasAfterPolicies: false, - }; + /** @inheritdoc */ + end(writerOptions) { + writerOptions = writerOptions || {}; + if (writerOptions.format === undefined) { + writerOptions.format = "xml"; } - // Track policies for each phase. - const serializePhase = createPhase("Serialize"); - const noPhase = createPhase("None"); - const deserializePhase = createPhase("Deserialize"); - const retryPhase = createPhase("Retry"); - const signPhase = createPhase("Sign"); - // a list of phases in order - const orderedPhases = [serializePhase, noPhase, deserializePhase, retryPhase, signPhase]; - // Small helper function to map phase name to each Phase - function getPhase(phase) { - if (phase === "Retry") { - return retryPhase; - } - else if (phase === "Serialize") { - return serializePhase; - } - else if (phase === "Deserialize") { - return deserializePhase; - } - else if (phase === "Sign") { - return signPhase; - } - else { - return noPhase; + return this.doc()._serialize(writerOptions); + } + /** + * Gets the next descendant of the given node of the tree rooted at `root` + * in depth-first pre-order. Returns a three-tuple with + * [descendant, descendant_index, descendant_level]. + * + * @param root - root node of the tree + * @param self - whether to visit the current node along with child nodes + * @param recursive - whether to visit all descendant nodes in tree-order or + * only the immediate child nodes + */ + _getFirstDescendantNode(root, self, recursive) { + if (self) + return [this._domNode, 0, 0]; + else if (recursive) + return this._getNextDescendantNode(root, root, recursive, 0, 0); + else + return [this._domNode.firstChild, 0, 1]; + } + /** + * Gets the next descendant of the given node of the tree rooted at `root` + * in depth-first pre-order. Returns a three-tuple with + * [descendant, descendant_index, descendant_level]. + * + * @param root - root node of the tree + * @param node - current node + * @param recursive - whether to visit all descendant nodes in tree-order or + * only the immediate child nodes + * @param index - child node index + * @param level - current depth of the XML tree + */ + _getNextDescendantNode(root, node, recursive, index, level) { + if (recursive) { + // traverse child nodes + if (node.firstChild) + return [node.firstChild, 0, level + 1]; + if (node === root) + return [null, -1, -1]; + // traverse siblings + if (node.nextSibling) + return [node.nextSibling, index + 1, level]; + // traverse parent's next sibling + let parent = node.parentNode; + while (parent && parent !== root) { + if (parent.nextSibling) + return [parent.nextSibling, (0, algorithm_1.tree_index)(parent.nextSibling), level - 1]; + parent = parent.parentNode; + level--; } } - // First walk each policy and create a node to track metadata. - for (const descriptor of this._policies) { - const policy = descriptor.policy; - const options = descriptor.options; - const policyName = policy.name; - if (policyMap.has(policyName)) { - throw new Error("Duplicate policy names not allowed in pipeline"); - } - const node = { - policy, - dependsOn: new Set(), - dependants: new Set(), - }; - if (options.afterPhase) { - node.afterPhase = getPhase(options.afterPhase); - node.afterPhase.hasAfterPolicies = true; - } - policyMap.set(policyName, node); - const phase = getPhase(options.phase); - phase.policies.add(node); + else { + if (root === node) + return [node.firstChild, 0, level + 1]; + else + return [node.nextSibling, index + 1, level]; } - // Now that each policy has a node, connect dependency references. - for (const descriptor of this._policies) { - const { policy, options } = descriptor; - const policyName = policy.name; - const node = policyMap.get(policyName); - if (!node) { - throw new Error(`Missing node for policy ${policyName}`); - } - if (options.afterPolicies) { - for (const afterPolicyName of options.afterPolicies) { - const afterNode = policyMap.get(afterPolicyName); - if (afterNode) { - // Linking in both directions helps later - // when we want to notify dependants. - node.dependsOn.add(afterNode); - afterNode.dependants.add(node); - } - } - } - if (options.beforePolicies) { - for (const beforePolicyName of options.beforePolicies) { - const beforeNode = policyMap.get(beforePolicyName); - if (beforeNode) { - // To execute before another node, make it - // depend on the current node. - beforeNode.dependsOn.add(node); - node.dependants.add(beforeNode); - } - } + return [null, -1, -1]; + } + /** + * Converts the node into its string or object representation. + * + * @param options - serialization options + */ + _serialize(writerOptions) { + if (writerOptions.format === "xml") { + const writer = new writers_1.XMLWriter(this._options, writerOptions); + return writer.serialize(this.node); + } + else if (writerOptions.format === "map") { + const writer = new writers_1.MapWriter(this._options, writerOptions); + return writer.serialize(this.node); + } + else if (writerOptions.format === "object") { + const writer = new writers_1.ObjectWriter(this._options, writerOptions); + return writer.serialize(this.node); + } + else if (writerOptions.format === "json") { + const writer = new writers_1.JSONWriter(this._options, writerOptions); + return writer.serialize(this.node); + } + else if (writerOptions.format === "yaml") { + const writer = new writers_1.YAMLWriter(this._options, writerOptions); + return writer.serialize(this.node); + } + else { + throw new Error("Invalid writer format: " + writerOptions.format + ". " + this._debugInfo()); + } + } + /** + * Extracts a namespace and name from the given string. + * + * @param namespace - namespace + * @param name - a string containing both a name and namespace separated by an + * `'@'` character + * @param ele - `true` if this is an element namespace; otherwise `false` + */ + _extractNamespace(namespace, name, ele) { + // extract from name + const atIndex = name.indexOf("@"); + if (atIndex > 0) { + if (namespace === undefined) + namespace = name.slice(atIndex + 1); + name = name.slice(0, atIndex); + } + if (namespace === undefined) { + // look-up default namespace + namespace = (ele ? this._options.defaultNamespace.ele : this._options.defaultNamespace.att); + } + else if (namespace !== null && namespace[0] === "@") { + // look-up namespace aliases + const alias = namespace.slice(1); + namespace = this._options.namespaceAlias[alias]; + if (namespace === undefined) { + throw new Error("Namespace alias `" + alias + "` is not defined. " + this._debugInfo()); } } - function walkPhase(phase) { - phase.hasRun = true; - // Sets iterate in insertion order - for (const node of phase.policies) { - if (node.afterPhase && (!node.afterPhase.hasRun || node.afterPhase.policies.size)) { - // If this node is waiting on a phase to complete, - // we need to skip it for now. - // Even if the phase is empty, we should wait for it - // to be walked to avoid re-ordering policies. - continue; + return [namespace, name]; + } + /** + * Updates the element's namespace. + * + * @param ns - new namespace + */ + _updateNamespace(ns) { + const ele = this._domNode; + if (util_2.Guard.isElementNode(ele) && ns !== null && ele.namespaceURI !== ns) { + const [elePrefix, eleLocalName] = (0, algorithm_1.namespace_extractQName)(ele.prefix ? ele.prefix + ':' + ele.localName : ele.localName); + // re-create the element node if its namespace changed + // we can't simply change the namespaceURI since its read-only + const newEle = (0, algorithm_1.create_element)(this._doc, eleLocalName, ns, elePrefix); + for (const attr of ele.attributes) { + const attrQName = attr.prefix ? attr.prefix + ':' + attr.localName : attr.localName; + const [attrPrefix] = (0, algorithm_1.namespace_extractQName)(attrQName); + let newAttrNS = attr.namespaceURI; + if (newAttrNS === null && attrPrefix !== null) { + newAttrNS = ele.lookupNamespaceURI(attrPrefix); } - if (node.dependsOn.size === 0) { - // If there's nothing else we're waiting for, we can - // add this policy to the result list. - result.push(node.policy); - // Notify anything that depends on this policy that - // the policy has been scheduled. - for (const dependant of node.dependants) { - dependant.dependsOn.delete(node); - } - policyMap.delete(node.policy.name); - phase.policies.delete(node); + if (newAttrNS === null) { + newEle.setAttribute(attrQName, attr.value); } - } - } - function walkPhases() { - for (const phase of orderedPhases) { - walkPhase(phase); - // if the phase isn't complete - if (phase.policies.size > 0 && phase !== noPhase) { - if (!noPhase.hasRun) { - // Try running noPhase to see if that unblocks this phase next tick. - // This can happen if a phase that happens before noPhase - // is waiting on a noPhase policy to complete. - walkPhase(noPhase); - } - // Don't proceed to the next phase until this phase finishes. - return; + else { + newEle.setAttributeNS(newAttrNS, attrQName, attr.value); } - if (phase.hasAfterPolicies) { - // Run any policies unblocked by this phase - walkPhase(noPhase); + } + // replace the new node in parent node + const parent = ele.parentNode; + /* istanbul ignore next */ + if (parent === null) { + throw new Error("Parent node is null." + this._debugInfo()); + } + parent.replaceChild(newEle, ele); + this._domNode = newEle; + // check child nodes + for (const childNode of ele.childNodes) { + const newChildNode = childNode.cloneNode(true); + newEle.appendChild(newChildNode); + if (util_2.Guard.isElementNode(newChildNode) && !newChildNode._namespace) { + const [newChildNodePrefix] = (0, algorithm_1.namespace_extractQName)(newChildNode.prefix ? newChildNode.prefix + ':' + newChildNode.localName : newChildNode.localName); + const newChildNodeNS = newEle.lookupNamespaceURI(newChildNodePrefix); + new XMLBuilderImpl(newChildNode)._updateNamespace(newChildNodeNS); } } } - // Iterate until we've put every node in the result list. - let iteration = 0; - while (policyMap.size > 0) { - iteration++; - const initialResultLength = result.length; - // Keep walking each phase in order until we can order every node. - walkPhases(); - // The result list *should* get at least one larger each time - // after the first full pass. - // Otherwise, we're going to loop forever. - if (result.length <= initialResultLength && iteration > 1) { - throw new Error("Cannot satisfy policy dependencies due to requirements cycle."); - } + } + /** + * Returns the document owning this node. + */ + get _doc() { + const node = this.node; + if (util_2.Guard.isDocumentNode(node)) { + return node; + } + else { + const docNode = node.ownerDocument; + /* istanbul ignore next */ + if (!docNode) + throw new Error("Owner document is null. " + this._debugInfo()); + return docNode; + } + } + /** + * Returns debug information for this node. + * + * @param name - node name + */ + _debugInfo(name) { + const node = this.node; + const parentNode = node.parentNode; + name = name || node.nodeName; + const parentName = parentNode ? parentNode.nodeName : ''; + if (!parentName) { + return "node: <" + name + ">"; + } + else { + return "node: <" + name + ">, parent: <" + parentName + ">"; } - return result; + } + /** + * Gets or sets builder options. + */ + get _options() { + const doc = this._doc; + /* istanbul ignore next */ + if (doc._xmlBuilderOptions === undefined) { + throw new Error("Builder options is not set."); + } + return doc._xmlBuilderOptions; + } + set _options(value) { + const doc = this._doc; + doc._xmlBuilderOptions = value; } } -/** - * Creates a totally empty pipeline. - * Useful for testing or creating a custom one. - */ -function createEmptyPipeline() { - return HttpPipeline.create(); -} -//# sourceMappingURL=pipeline.js.map +exports.XMLBuilderImpl = XMLBuilderImpl; +//# sourceMappingURL=XMLBuilderImpl.js.map /***/ }), -/***/ 47983: +/***/ 1256: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.createPipelineRequest = createPipelineRequest; -const httpHeaders_js_1 = __nccwpck_require__(66816); -const uuidUtils_js_1 = __nccwpck_require__(2339); -class PipelineRequestImpl { - url; - method; - headers; - timeout; - withCredentials; - body; - multipartBody; - formData; - streamResponseStatusCodes; - enableBrowserStreams; - proxySettings; - disableKeepAlive; - abortSignal; - requestId; - allowInsecureConnection; - onUploadProgress; - onDownloadProgress; - requestOverrides; - authSchemes; - constructor(options) { - this.url = options.url; - this.body = options.body; - this.headers = options.headers ?? (0, httpHeaders_js_1.createHttpHeaders)(); - this.method = options.method ?? "GET"; - this.timeout = options.timeout ?? 0; - this.multipartBody = options.multipartBody; - this.formData = options.formData; - this.disableKeepAlive = options.disableKeepAlive ?? false; - this.proxySettings = options.proxySettings; - this.streamResponseStatusCodes = options.streamResponseStatusCodes; - this.withCredentials = options.withCredentials ?? false; - this.abortSignal = options.abortSignal; - this.onUploadProgress = options.onUploadProgress; - this.onDownloadProgress = options.onDownloadProgress; - this.requestId = options.requestId || (0, uuidUtils_js_1.randomUUID)(); - this.allowInsecureConnection = options.allowInsecureConnection ?? false; - this.enableBrowserStreams = options.enableBrowserStreams ?? false; - this.requestOverrides = options.requestOverrides; - this.authSchemes = options.authSchemes; - } -} +exports.createDocument = createDocument; +exports.sanitizeInput = sanitizeInput; +const dom_1 = __nccwpck_require__(54646); +const dom_2 = __nccwpck_require__(50633); +const util_1 = __nccwpck_require__(76195); +dom_2.dom.setFeatures(false); /** - * Creates a new pipeline request with the given options. - * This method is to allow for the easy setting of default values and not required. - * @param options - The options to create the request with. + * Creates an XML document without any child nodes. */ -function createPipelineRequest(options) { - return new PipelineRequestImpl(options); +function createDocument() { + const impl = new dom_1.DOMImplementation(); + const doc = impl.createDocument(null, 'root', null); + /* istanbul ignore else */ + if (doc.documentElement) { + doc.removeChild(doc.documentElement); + } + return doc; } -//# sourceMappingURL=pipelineRequest.js.map - -/***/ }), - -/***/ 73398: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.agentPolicyName = void 0; -exports.agentPolicy = agentPolicy; /** - * Name of the Agent Policy - */ -exports.agentPolicyName = "agentPolicy"; -/** - * Gets a pipeline policy that sets http.agent + * Sanitizes input strings with user supplied replacement characters. + * + * @param str - input string + * @param replacement - replacement character or function */ -function agentPolicy(agent) { - return { - name: exports.agentPolicyName, - sendRequest: async (req, next) => { - // Users may define an agent on the request, honor it over the client level one - if (!req.agent) { - req.agent = agent; +function sanitizeInput(str, replacement) { + if (str == null) { + return str; + } + else if (replacement === undefined) { + return str + ""; + } + else { + let result = ""; + str = str + ""; + for (let i = 0; i < str.length; i++) { + let n = str.charCodeAt(i); + // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + if (n === 0x9 || n === 0xA || n === 0xD || + (n >= 0x20 && n <= 0xD7FF) || + (n >= 0xE000 && n <= 0xFFFD)) { + // valid character - not surrogate pair + result += str.charAt(i); } - return next(req); - }, - }; -} -//# sourceMappingURL=agentPolicy.js.map - -/***/ }), - -/***/ 7937: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.apiKeyAuthenticationPolicyName = void 0; -exports.apiKeyAuthenticationPolicy = apiKeyAuthenticationPolicy; -const checkInsecureConnection_js_1 = __nccwpck_require__(4212); -/** - * Name of the API Key Authentication Policy - */ -exports.apiKeyAuthenticationPolicyName = "apiKeyAuthenticationPolicy"; -/** - * Gets a pipeline policy that adds API key authentication to requests - */ -function apiKeyAuthenticationPolicy(options) { - return { - name: exports.apiKeyAuthenticationPolicyName, - async sendRequest(request, next) { - // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); - const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "apiKey"); - // Skip adding authentication header if no API key authentication scheme is found - if (!scheme) { - return next(request); + else if (n >= 0xD800 && n <= 0xDBFF && i < str.length - 1) { + const n2 = str.charCodeAt(i + 1); + if (n2 >= 0xDC00 && n2 <= 0xDFFF) { + // valid surrogate pair + n = (n - 0xD800) * 0x400 + n2 - 0xDC00 + 0x10000; + result += String.fromCodePoint(n); + i++; + } + else { + // invalid lone surrogate + result += (0, util_1.isString)(replacement) ? replacement : replacement(str.charAt(i), i, str); + } } - if (scheme.apiKeyLocation !== "header") { - throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`); + else { + // invalid character + result += (0, util_1.isString)(replacement) ? replacement : replacement(str.charAt(i), i, str); } - request.headers.set(scheme.name, options.credential.key); - return next(request); - }, - }; + } + return result; + } } -//# sourceMappingURL=apiKeyAuthenticationPolicy.js.map +//# sourceMappingURL=dom.js.map /***/ }), -/***/ 10068: +/***/ 2106: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.basicAuthenticationPolicyName = void 0; -exports.basicAuthenticationPolicy = basicAuthenticationPolicy; -const bytesEncoding_js_1 = __nccwpck_require__(88943); -const checkInsecureConnection_js_1 = __nccwpck_require__(4212); -/** - * Name of the Basic Authentication Policy - */ -exports.basicAuthenticationPolicyName = "bearerAuthenticationPolicy"; -/** - * Gets a pipeline policy that adds basic authentication to requests - */ -function basicAuthenticationPolicy(options) { - return { - name: exports.basicAuthenticationPolicyName, - async sendRequest(request, next) { - // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); - const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "basic"); - // Skip adding authentication header if no basic authentication scheme is found - if (!scheme) { - return next(request); - } - const { username, password } = options.credential; - const headerValue = (0, bytesEncoding_js_1.uint8ArrayToString)((0, bytesEncoding_js_1.stringToUint8Array)(`${username}:${password}`, "utf-8"), "base64"); - request.headers.set("Authorization", `Basic ${headerValue}`); - return next(request); - }, - }; -} -//# sourceMappingURL=basicAuthenticationPolicy.js.map +exports.fragmentCB = exports.createCB = exports.convert = exports.fragment = exports.create = exports.builder = exports.XMLBuilderCBImpl = exports.XMLBuilderImpl = void 0; +var XMLBuilderImpl_1 = __nccwpck_require__(10584); +Object.defineProperty(exports, "XMLBuilderImpl", ({ enumerable: true, get: function () { return XMLBuilderImpl_1.XMLBuilderImpl; } })); +var XMLBuilderCBImpl_1 = __nccwpck_require__(20282); +Object.defineProperty(exports, "XMLBuilderCBImpl", ({ enumerable: true, get: function () { return XMLBuilderCBImpl_1.XMLBuilderCBImpl; } })); +var BuilderFunctions_1 = __nccwpck_require__(13810); +Object.defineProperty(exports, "builder", ({ enumerable: true, get: function () { return BuilderFunctions_1.builder; } })); +Object.defineProperty(exports, "create", ({ enumerable: true, get: function () { return BuilderFunctions_1.create; } })); +Object.defineProperty(exports, "fragment", ({ enumerable: true, get: function () { return BuilderFunctions_1.fragment; } })); +Object.defineProperty(exports, "convert", ({ enumerable: true, get: function () { return BuilderFunctions_1.convert; } })); +var BuilderFunctionsCB_1 = __nccwpck_require__(47059); +Object.defineProperty(exports, "createCB", ({ enumerable: true, get: function () { return BuilderFunctionsCB_1.createCB; } })); +Object.defineProperty(exports, "fragmentCB", ({ enumerable: true, get: function () { return BuilderFunctionsCB_1.fragmentCB; } })); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 73054: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 9311: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.bearerAuthenticationPolicyName = void 0; -exports.bearerAuthenticationPolicy = bearerAuthenticationPolicy; -const checkInsecureConnection_js_1 = __nccwpck_require__(4212); -/** - * Name of the Bearer Authentication Policy - */ -exports.bearerAuthenticationPolicyName = "bearerAuthenticationPolicy"; -/** - * Gets a pipeline policy that adds bearer token authentication to requests - */ -function bearerAuthenticationPolicy(options) { - return { - name: exports.bearerAuthenticationPolicyName, - async sendRequest(request, next) { - // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); - const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "http" && x.scheme === "bearer"); - // Skip adding authentication header if no bearer authentication scheme is found - if (!scheme) { - return next(request); - } - const token = await options.credential.getBearerToken({ - abortSignal: request.abortSignal, - }); - request.headers.set("Authorization", `Bearer ${token}`); - return next(request); - }, - }; -} -//# sourceMappingURL=bearerAuthenticationPolicy.js.map +exports.nonEntityAmpersandRegex = void 0; +exports.nonEntityAmpersandRegex = /&(?![A-Za-z]+;|#\d+;)/g; +//# sourceMappingURL=constants.js.map /***/ }), -/***/ 4212: +/***/ 69075: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ensureSecureConnection = ensureSecureConnection; -const log_js_1 = __nccwpck_require__(85930); -// Ensure the warining is only emitted once -let insecureConnectionWarningEmmitted = false; -/** - * Checks if the request is allowed to be sent over an insecure connection. - * - * A request is allowed to be sent over an insecure connection when: - * - The `allowInsecureConnection` option is set to `true`. - * - The request has the `allowInsecureConnection` property set to `true`. - * - The request is being sent to `localhost` or `127.0.0.1` - */ -function allowInsecureConnection(request, options) { - if (options.allowInsecureConnection && request.allowInsecureConnection) { - const url = new URL(request.url); - if (url.hostname === "localhost" || url.hostname === "127.0.0.1") { - return true; - } - } - return false; -} -/** - * Logs a warning about sending a token over an insecure connection. - * - * This function will emit a node warning once, but log the warning every time. - */ -function emitInsecureConnectionWarning() { - const warning = "Sending token over insecure transport. Assume any token issued is compromised."; - log_js_1.logger.warning(warning); - if (typeof process?.emitWarning === "function" && !insecureConnectionWarningEmmitted) { - insecureConnectionWarningEmmitted = true; - process.emitWarning(warning); - } -} -/** - * Ensures that authentication is only allowed over HTTPS unless explicitly allowed. - * Throws an error if the connection is not secure and not explicitly allowed. - */ -function ensureSecureConnection(request, options) { - if (!request.url.toLowerCase().startsWith("https://")) { - if (allowInsecureConnection(request, options)) { - emitInsecureConnectionWarning(); - } - else { - throw new Error("Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false."); - } - } -} -//# sourceMappingURL=checkInsecureConnection.js.map +exports.fragmentCB = exports.createCB = exports.convert = exports.fragment = exports.create = exports.builder = void 0; +var builder_1 = __nccwpck_require__(2106); +Object.defineProperty(exports, "builder", ({ enumerable: true, get: function () { return builder_1.builder; } })); +Object.defineProperty(exports, "create", ({ enumerable: true, get: function () { return builder_1.create; } })); +Object.defineProperty(exports, "fragment", ({ enumerable: true, get: function () { return builder_1.fragment; } })); +Object.defineProperty(exports, "convert", ({ enumerable: true, get: function () { return builder_1.convert; } })); +Object.defineProperty(exports, "createCB", ({ enumerable: true, get: function () { return builder_1.createCB; } })); +Object.defineProperty(exports, "fragmentCB", ({ enumerable: true, get: function () { return builder_1.fragmentCB; } })); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 71305: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { +/***/ 81348: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.oauth2AuthenticationPolicyName = void 0; -exports.oauth2AuthenticationPolicy = oauth2AuthenticationPolicy; -const checkInsecureConnection_js_1 = __nccwpck_require__(4212); -/** - * Name of the OAuth2 Authentication Policy - */ -exports.oauth2AuthenticationPolicyName = "oauth2AuthenticationPolicy"; +exports.DefaultXMLBuilderCBOptions = exports.XMLBuilderOptionKeys = exports.DefaultBuilderOptions = void 0; /** - * Gets a pipeline policy that adds authorization header from OAuth2 schemes + * Defines default values for builder options. */ -function oauth2AuthenticationPolicy(options) { - return { - name: exports.oauth2AuthenticationPolicyName, - async sendRequest(request, next) { - // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs - (0, checkInsecureConnection_js_1.ensureSecureConnection)(request, options); - const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === "oauth2"); - // Skip adding authentication header if no OAuth2 authentication scheme is found - if (!scheme) { - return next(request); - } - const token = await options.credential.getOAuth2Token(scheme.flows, { - abortSignal: request.abortSignal, - }); - request.headers.set("Authorization", `Bearer ${token}`); - return next(request); - }, - }; -} -//# sourceMappingURL=oauth2AuthenticationPolicy.js.map - -/***/ }), - -/***/ 74162: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.decompressResponsePolicyName = void 0; -exports.decompressResponsePolicy = decompressResponsePolicy; +exports.DefaultBuilderOptions = { + version: "1.0", + encoding: undefined, + standalone: undefined, + keepNullNodes: false, + keepNullAttributes: false, + ignoreConverters: false, + skipWhitespaceOnlyText: true, + convert: { + att: "@", + ins: "?", + text: "#", + cdata: "$", + comment: "!" + }, + defaultNamespace: { + ele: undefined, + att: undefined + }, + namespaceAlias: { + html: "http://www.w3.org/1999/xhtml", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/", + mathml: "http://www.w3.org/1998/Math/MathML", + svg: "http://www.w3.org/2000/svg", + xlink: "http://www.w3.org/1999/xlink" + }, + invalidCharReplacement: undefined, + parser: undefined +}; /** - * The programmatic identifier of the decompressResponsePolicy. + * Contains keys of `XMLBuilderOptions`. */ -exports.decompressResponsePolicyName = "decompressResponsePolicy"; +exports.XMLBuilderOptionKeys = new Set(Object.keys(exports.DefaultBuilderOptions)); /** - * A policy to enable response decompression according to Accept-Encoding header - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding + * Defines default values for builder options. */ -function decompressResponsePolicy() { - return { - name: exports.decompressResponsePolicyName, - async sendRequest(request, next) { - // HEAD requests have no body - if (request.method !== "HEAD") { - request.headers.set("Accept-Encoding", "gzip,deflate"); - } - return next(request); - }, - }; -} -//# sourceMappingURL=decompressResponsePolicy.js.map +exports.DefaultXMLBuilderCBOptions = { + format: "xml", + wellFormed: false, + prettyPrint: false, + indent: " ", + newline: "\n", + offset: 0, + width: 0, + allowEmptyTags: false, + spaceBeforeSlash: false, + keepNullNodes: false, + keepNullAttributes: false, + ignoreConverters: false, + convert: { + att: "@", + ins: "?", + text: "#", + cdata: "$", + comment: "!" + }, + defaultNamespace: { + ele: undefined, + att: undefined + }, + namespaceAlias: { + html: "http://www.w3.org/1999/xhtml", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/", + mathml: "http://www.w3.org/1998/Math/MathML", + svg: "http://www.w3.org/2000/svg", + xlink: "http://www.w3.org/1999/xlink" + } +}; +//# sourceMappingURL=interfaces.js.map /***/ }), -/***/ 20297: +/***/ 87825: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.defaultRetryPolicyName = void 0; -exports.defaultRetryPolicy = defaultRetryPolicy; -const exponentialRetryStrategy_js_1 = __nccwpck_require__(12283); -const throttlingRetryStrategy_js_1 = __nccwpck_require__(90483); -const retryPolicy_js_1 = __nccwpck_require__(27729); -const constants_js_1 = __nccwpck_require__(58463); +exports.BaseReader = void 0; +const dom_1 = __nccwpck_require__(1256); /** - * Name of the {@link defaultRetryPolicy} - */ -exports.defaultRetryPolicyName = "defaultRetryPolicy"; -/** - * A policy that retries according to three strategies: - * - When the server sends a 429 response with a Retry-After header. - * - When there are errors in the underlying transport layer (e.g. DNS lookup failures). - * - Or otherwise if the outgoing request fails, it will retry with an exponentially increasing delay. + * Parses XML nodes. */ -function defaultRetryPolicy(options = {}) { - return { - name: exports.defaultRetryPolicyName, - sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)(), (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)(options)], { - maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, - }).sendRequest, +class BaseReader { + _builderOptions; + static _entityTable = { + "lt": "<", + "gt": ">", + "amp": "&", + "quot": '"', + "apos": "'", }; + /** + * Initializes a new instance of `BaseReader`. + * + * @param builderOptions - XML builder options + */ + constructor(builderOptions) { + this._builderOptions = builderOptions; + if (builderOptions.parser) { + Object.assign(this, builderOptions.parser); + } + } + _docType(parent, name, publicId, systemId) { + return parent.dtd({ name: name, pubID: publicId, sysID: systemId }); + } + _comment(parent, data) { + return parent.com(data); + } + _text(parent, data) { + return parent.txt(data); + } + _instruction(parent, target, data) { + return parent.ins(target, data); + } + _cdata(parent, data) { + return parent.dat(data); + } + _element(parent, namespace, name) { + return (namespace === undefined ? parent.ele(name) : parent.ele(namespace, name)); + } + _attribute(parent, namespace, name, value) { + return (namespace === undefined ? parent.att(name, value) : parent.att(namespace, name, value)); + } + _sanitize(str) { + return (0, dom_1.sanitizeInput)(str, this._builderOptions.invalidCharReplacement); + } + /** + * Decodes serialized text. + * + * @param text - text value to serialize + */ + _decodeText(text) { + if (text == null) + return text; + return text.replace(/&(quot|amp|apos|lt|gt);/g, (_match, tag) => BaseReader._entityTable[tag]).replace(/&#(?:x([a-fA-F0-9]+)|([0-9]+));/g, (_match, hexStr, numStr) => String.fromCodePoint(parseInt(hexStr || numStr, hexStr ? 16 : 10))); + } + /** + * Decodes serialized attribute value. + * + * @param text - attribute value to serialize + */ + _decodeAttributeValue(text) { + return this._decodeText(text); + } + /** + * Main parser function which parses the given object and returns an XMLBuilder. + * + * @param node - node to recieve parsed content + * @param obj - object to parse + */ + parse(node, obj) { + return this._parse(node, obj); + } + /** + * Creates a DocType node. + * The node will be skipped if the function returns `undefined`. + * + * @param name - node name + * @param publicId - public identifier + * @param systemId - system identifier + */ + docType(parent, name, publicId, systemId) { + return this._docType(parent, name, publicId, systemId); + } + /** + * Creates a comment node. + * The node will be skipped if the function returns `undefined`. + * + * @param parent - parent node + * @param data - node data + */ + comment(parent, data) { + return this._comment(parent, data); + } + /** + * Creates a text node. + * The node will be skipped if the function returns `undefined`. + * + * @param parent - parent node + * @param data - node data + */ + text(parent, data) { + return this._text(parent, data); + } + /** + * Creates a processing instruction node. + * The node will be skipped if the function returns `undefined`. + * + * @param parent - parent node + * @param target - instruction target + * @param data - node data + */ + instruction(parent, target, data) { + return this._instruction(parent, target, data); + } + /** + * Creates a CData section node. + * The node will be skipped if the function returns `undefined`. + * + * @param parent - parent node + * @param data - node data + */ + cdata(parent, data) { + return this._cdata(parent, data); + } + /** + * Creates an element node. + * The node will be skipped if the function returns `undefined`. + * + * @param parent - parent node + * @param namespace - node namespace + * @param name - node name + */ + element(parent, namespace, name) { + return this._element(parent, namespace, name); + } + /** + * Creates an attribute or namespace declaration. + * The node will be skipped if the function returns `undefined`. + * + * @param parent - parent node + * @param namespace - node namespace + * @param name - node name + * @param value - node value + */ + attribute(parent, namespace, name, value) { + return this._attribute(parent, namespace, name, value); + } + /** + * Sanitizes input strings. + * + * @param str - input string + */ + sanitize(str) { + return this._sanitize(str); + } } -//# sourceMappingURL=defaultRetryPolicy.js.map +exports.BaseReader = BaseReader; +//# sourceMappingURL=BaseReader.js.map /***/ }), -/***/ 46313: +/***/ 24520: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.exponentialRetryPolicyName = void 0; -exports.exponentialRetryPolicy = exponentialRetryPolicy; -const exponentialRetryStrategy_js_1 = __nccwpck_require__(12283); -const retryPolicy_js_1 = __nccwpck_require__(27729); -const constants_js_1 = __nccwpck_require__(58463); -/** - * The programmatic identifier of the exponentialRetryPolicy. - */ -exports.exponentialRetryPolicyName = "exponentialRetryPolicy"; +exports.JSONReader = void 0; +const ObjectReader_1 = __nccwpck_require__(74573); +const BaseReader_1 = __nccwpck_require__(87825); /** - * A policy that attempts to retry requests while introducing an exponentially increasing delay. - * @param options - Options that configure retry logic. + * Parses XML nodes from a JSON string. */ -function exponentialRetryPolicy(options = {}) { - return (0, retryPolicy_js_1.retryPolicy)([ - (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)({ - ...options, - ignoreSystemErrors: true, - }), - ], { - maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, - }); +class JSONReader extends BaseReader_1.BaseReader { + /** + * Parses the given document representation. + * + * @param node - node receive parsed XML nodes + * @param str - JSON string to parse + */ + _parse(node, str) { + return new ObjectReader_1.ObjectReader(this._builderOptions).parse(node, JSON.parse(str)); + } } -//# sourceMappingURL=exponentialRetryPolicy.js.map +exports.JSONReader = JSONReader; +//# sourceMappingURL=JSONReader.js.map /***/ }), -/***/ 51393: +/***/ 74573: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.formDataPolicyName = void 0; -exports.formDataPolicy = formDataPolicy; -const bytesEncoding_js_1 = __nccwpck_require__(88943); -const checkEnvironment_js_1 = __nccwpck_require__(94121); -const httpHeaders_js_1 = __nccwpck_require__(66816); -/** - * The programmatic identifier of the formDataPolicy. - */ -exports.formDataPolicyName = "formDataPolicy"; -function formDataToFormDataMap(formData) { - const formDataMap = {}; - for (const [key, value] of formData.entries()) { - formDataMap[key] ??= []; - formDataMap[key].push(value); - } - return formDataMap; -} +exports.ObjectReader = void 0; +const util_1 = __nccwpck_require__(76195); +const BaseReader_1 = __nccwpck_require__(87825); /** - * A policy that encodes FormData on the request into the body. + * Parses XML nodes from objects and arrays. + * ES6 maps and sets are also supoorted. */ -function formDataPolicy() { - return { - name: exports.formDataPolicyName, - async sendRequest(request, next) { - if (checkEnvironment_js_1.isNodeLike && typeof FormData !== "undefined" && request.body instanceof FormData) { - request.formData = formDataToFormDataMap(request.body); - request.body = undefined; - } - if (request.formData) { - const contentType = request.headers.get("Content-Type"); - if (contentType && contentType.indexOf("application/x-www-form-urlencoded") !== -1) { - request.body = wwwFormUrlEncode(request.formData); +class ObjectReader extends BaseReader_1.BaseReader { + /** + * Parses the given document representation. + * + * @param node - node receive parsed XML nodes + * @param obj - object to parse + */ + _parse(node, obj) { + const options = this._builderOptions; + let lastChild = null; + if ((0, util_1.isFunction)(obj)) { + // evaluate if function + lastChild = this.parse(node, obj.call(this)); + } + else if ((0, util_1.isArray)(obj) || (0, util_1.isSet)(obj)) { + (0, util_1.forEachArray)(obj, item => lastChild = this.parse(node, item), this); + } + else if ((0, util_1.isMap)(obj) || (0, util_1.isObject)(obj)) { + // expand if object + (0, util_1.forEachObject)(obj, (key, val) => { + if ((0, util_1.isFunction)(val)) { + // evaluate if function + val = val.call(this); + } + if (!options.ignoreConverters && key.indexOf(options.convert.att) === 0) { + // assign attributes + if (key === options.convert.att) { + if ((0, util_1.isArray)(val) || (0, util_1.isSet)(val)) { + throw new Error("Invalid attribute: " + val.toString() + ". " + node._debugInfo()); + } + else /* if (isMap(val) || isObject(val)) */ { + (0, util_1.forEachObject)(val, (attrKey, attrVal) => { + lastChild = this.attribute(node, undefined, this.sanitize(attrKey), this._decodeAttributeValue(this.sanitize(attrVal))) || lastChild; + }); + } + } + else { + lastChild = this.attribute(node, undefined, this.sanitize(key.substring(options.convert.att.length)), this._decodeAttributeValue(this.sanitize(val?.toString()))) || lastChild; + } + } + else if (!options.ignoreConverters && key.indexOf(options.convert.text) === 0) { + // text node + if ((0, util_1.isMap)(val) || (0, util_1.isObject)(val)) { + // if the key is #text expand child nodes under this node to support mixed content + lastChild = this.parse(node, val); + } + else { + lastChild = this.text(node, this._decodeText(this.sanitize(val?.toString()))) || lastChild; + } + } + else if (!options.ignoreConverters && key.indexOf(options.convert.cdata) === 0) { + // cdata node + if ((0, util_1.isArray)(val) || (0, util_1.isSet)(val)) { + (0, util_1.forEachArray)(val, item => lastChild = this.cdata(node, this.sanitize(item)) || lastChild, this); + } + else { + lastChild = this.cdata(node, this.sanitize(val?.toString())) || lastChild; + } + } + else if (!options.ignoreConverters && key.indexOf(options.convert.comment) === 0) { + // comment node + if ((0, util_1.isArray)(val) || (0, util_1.isSet)(val)) { + (0, util_1.forEachArray)(val, item => lastChild = this.comment(node, this.sanitize(item)) || lastChild, this); + } + else { + lastChild = this.comment(node, this.sanitize(val?.toString())) || lastChild; + } + } + else if (!options.ignoreConverters && key.indexOf(options.convert.ins) === 0) { + // processing instruction + if ((0, util_1.isString)(val)) { + const insIndex = val.indexOf(' '); + const insTarget = (insIndex === -1 ? val : val.substr(0, insIndex)); + const insValue = (insIndex === -1 ? '' : val.substr(insIndex + 1)); + lastChild = this.instruction(node, this.sanitize(insTarget), this.sanitize(insValue)) || lastChild; + } + else if ((0, util_1.isArray)(val) || (0, util_1.isSet)(val)) { + (0, util_1.forEachArray)(val, item => { + const insIndex = item.indexOf(' '); + const insTarget = (insIndex === -1 ? item : item.substr(0, insIndex)); + const insValue = (insIndex === -1 ? '' : item.substr(insIndex + 1)); + lastChild = this.instruction(node, this.sanitize(insTarget), this.sanitize(insValue)) || lastChild; + }, this); + } + else /* if (isMap(target) || isObject(target)) */ { + (0, util_1.forEachObject)(val, (insTarget, insValue) => lastChild = this.instruction(node, this.sanitize(insTarget), this.sanitize(insValue)) || lastChild, this); + } + } + else if (((0, util_1.isArray)(val) || (0, util_1.isSet)(val)) && (0, util_1.isEmpty)(val)) { + // skip empty arrays + } + else if (((0, util_1.isMap)(val) || (0, util_1.isObject)(val)) && (0, util_1.isEmpty)(val)) { + // empty objects produce one node + lastChild = this.element(node, undefined, this.sanitize(key)) || lastChild; + } + else if (!options.keepNullNodes && (val == null)) { + // skip null and undefined nodes + } + else if ((0, util_1.isArray)(val) || (0, util_1.isSet)(val)) { + // expand list by creating child nodes + (0, util_1.forEachArray)(val, item => { + const childNode = {}; + childNode[key] = item; + lastChild = this.parse(node, childNode); + }, this); + } + else if ((0, util_1.isMap)(val) || (0, util_1.isObject)(val)) { + // create a parent node + const parent = this.element(node, undefined, this.sanitize(key)); + if (parent) { + lastChild = parent; + // expand child nodes under parent + this.parse(parent, val); + } + } + else if (val != null && (!(0, util_1.isString)(val) || val !== '')) { + // leaf element node with a single text node + const parent = this.element(node, undefined, this.sanitize(key)); + if (parent) { + lastChild = parent; + this.text(parent, this._decodeText(this.sanitize(val?.toString()))); + } } else { - await prepareFormData(request.formData, request); + // leaf element node + lastChild = this.element(node, undefined, this.sanitize(key)) || lastChild; } - request.formData = undefined; - } - return next(request); - }, - }; -} -function wwwFormUrlEncode(formData) { - const urlSearchParams = new URLSearchParams(); - for (const [key, value] of Object.entries(formData)) { - if (Array.isArray(value)) { - for (const subValue of value) { - urlSearchParams.append(key, subValue.toString()); - } + }, this); } - else { - urlSearchParams.append(key, value.toString()); + else if (!options.keepNullNodes && (obj == null)) { + // skip null and undefined nodes } - } - return urlSearchParams.toString(); -} -async function prepareFormData(formData, request) { - // validate content type (multipart/form-data) - const contentType = request.headers.get("Content-Type"); - if (contentType && !contentType.startsWith("multipart/form-data")) { - // content type is specified and is not multipart/form-data. Exit. - return; - } - request.headers.set("Content-Type", contentType ?? "multipart/form-data"); - // set body to MultipartRequestBody using content from FormDataMap - const parts = []; - for (const [fieldName, values] of Object.entries(formData)) { - for (const value of Array.isArray(values) ? values : [values]) { - if (typeof value === "string") { - parts.push({ - headers: (0, httpHeaders_js_1.createHttpHeaders)({ - "Content-Disposition": `form-data; name="${fieldName}"`, - }), - body: (0, bytesEncoding_js_1.stringToUint8Array)(value, "utf-8"), - }); - } - else if (value === undefined || value === null || typeof value !== "object") { - throw new Error(`Unexpected value for key ${fieldName}: ${value}. Value should be serialized to string first.`); - } - else { - // using || instead of ?? here since if value.name is empty we should create a file name - const fileName = value.name || "blob"; - const headers = (0, httpHeaders_js_1.createHttpHeaders)(); - headers.set("Content-Disposition", `form-data; name="${fieldName}"; filename="${fileName}"`); - // again, || is used since an empty value.type means the content type is unset - headers.set("Content-Type", value.type || "application/octet-stream"); - parts.push({ - headers, - body: value, - }); - } + else { + // text node + lastChild = this.text(node, this._decodeText(this.sanitize(obj?.toString()))) || lastChild; } + return lastChild || node; } - request.multipartBody = { parts }; } -//# sourceMappingURL=formDataPolicy.js.map - -/***/ }), - -/***/ 81914: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.userAgentPolicyName = exports.userAgentPolicy = exports.tlsPolicyName = exports.tlsPolicy = exports.redirectPolicyName = exports.redirectPolicy = exports.getDefaultProxySettings = exports.proxyPolicyName = exports.proxyPolicy = exports.multipartPolicyName = exports.multipartPolicy = exports.logPolicyName = exports.logPolicy = exports.formDataPolicyName = exports.formDataPolicy = exports.throttlingRetryPolicyName = exports.throttlingRetryPolicy = exports.systemErrorRetryPolicyName = exports.systemErrorRetryPolicy = exports.retryPolicy = exports.exponentialRetryPolicyName = exports.exponentialRetryPolicy = exports.defaultRetryPolicyName = exports.defaultRetryPolicy = exports.decompressResponsePolicyName = exports.decompressResponsePolicy = exports.agentPolicyName = exports.agentPolicy = void 0; -var agentPolicy_js_1 = __nccwpck_require__(73398); -Object.defineProperty(exports, "agentPolicy", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicy; } })); -Object.defineProperty(exports, "agentPolicyName", ({ enumerable: true, get: function () { return agentPolicy_js_1.agentPolicyName; } })); -var decompressResponsePolicy_js_1 = __nccwpck_require__(74162); -Object.defineProperty(exports, "decompressResponsePolicy", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicy; } })); -Object.defineProperty(exports, "decompressResponsePolicyName", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicyName; } })); -var defaultRetryPolicy_js_1 = __nccwpck_require__(20297); -Object.defineProperty(exports, "defaultRetryPolicy", ({ enumerable: true, get: function () { return defaultRetryPolicy_js_1.defaultRetryPolicy; } })); -Object.defineProperty(exports, "defaultRetryPolicyName", ({ enumerable: true, get: function () { return defaultRetryPolicy_js_1.defaultRetryPolicyName; } })); -var exponentialRetryPolicy_js_1 = __nccwpck_require__(46313); -Object.defineProperty(exports, "exponentialRetryPolicy", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicy; } })); -Object.defineProperty(exports, "exponentialRetryPolicyName", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicyName; } })); -var retryPolicy_js_1 = __nccwpck_require__(27729); -Object.defineProperty(exports, "retryPolicy", ({ enumerable: true, get: function () { return retryPolicy_js_1.retryPolicy; } })); -var systemErrorRetryPolicy_js_1 = __nccwpck_require__(32738); -Object.defineProperty(exports, "systemErrorRetryPolicy", ({ enumerable: true, get: function () { return systemErrorRetryPolicy_js_1.systemErrorRetryPolicy; } })); -Object.defineProperty(exports, "systemErrorRetryPolicyName", ({ enumerable: true, get: function () { return systemErrorRetryPolicy_js_1.systemErrorRetryPolicyName; } })); -var throttlingRetryPolicy_js_1 = __nccwpck_require__(92337); -Object.defineProperty(exports, "throttlingRetryPolicy", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicy; } })); -Object.defineProperty(exports, "throttlingRetryPolicyName", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicyName; } })); -var formDataPolicy_js_1 = __nccwpck_require__(51393); -Object.defineProperty(exports, "formDataPolicy", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicy; } })); -Object.defineProperty(exports, "formDataPolicyName", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicyName; } })); -var logPolicy_js_1 = __nccwpck_require__(71610); -Object.defineProperty(exports, "logPolicy", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicy; } })); -Object.defineProperty(exports, "logPolicyName", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicyName; } })); -var multipartPolicy_js_1 = __nccwpck_require__(95316); -Object.defineProperty(exports, "multipartPolicy", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicy; } })); -Object.defineProperty(exports, "multipartPolicyName", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicyName; } })); -var proxyPolicy_js_1 = __nccwpck_require__(57954); -Object.defineProperty(exports, "proxyPolicy", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicy; } })); -Object.defineProperty(exports, "proxyPolicyName", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicyName; } })); -Object.defineProperty(exports, "getDefaultProxySettings", ({ enumerable: true, get: function () { return proxyPolicy_js_1.getDefaultProxySettings; } })); -var redirectPolicy_js_1 = __nccwpck_require__(45125); -Object.defineProperty(exports, "redirectPolicy", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicy; } })); -Object.defineProperty(exports, "redirectPolicyName", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicyName; } })); -var tlsPolicy_js_1 = __nccwpck_require__(24655); -Object.defineProperty(exports, "tlsPolicy", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicy; } })); -Object.defineProperty(exports, "tlsPolicyName", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicyName; } })); -var userAgentPolicy_js_1 = __nccwpck_require__(35402); -Object.defineProperty(exports, "userAgentPolicy", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicy; } })); -Object.defineProperty(exports, "userAgentPolicyName", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicyName; } })); -//# sourceMappingURL=internal.js.map +exports.ObjectReader = ObjectReader; +//# sourceMappingURL=ObjectReader.js.map /***/ }), -/***/ 71610: +/***/ 21190: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.logPolicyName = void 0; -exports.logPolicy = logPolicy; -const log_js_1 = __nccwpck_require__(85930); -const sanitizer_js_1 = __nccwpck_require__(61416); -/** - * The programmatic identifier of the logPolicy. - */ -exports.logPolicyName = "logPolicy"; +exports.XMLReader = void 0; +const XMLStringLexer_1 = __nccwpck_require__(47061); +const interfaces_1 = __nccwpck_require__(97707); +const interfaces_2 = __nccwpck_require__(27305); +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); +const BaseReader_1 = __nccwpck_require__(87825); /** - * A policy that logs all requests and responses. - * @param options - Options to configure logPolicy. + * Parses XML nodes from an XML document string. */ -function logPolicy(options = {}) { - const logger = options.logger ?? log_js_1.logger.info; - const sanitizer = new sanitizer_js_1.Sanitizer({ - additionalAllowedHeaderNames: options.additionalAllowedHeaderNames, - additionalAllowedQueryParameters: options.additionalAllowedQueryParameters, - }); - return { - name: exports.logPolicyName, - async sendRequest(request, next) { - if (!logger.enabled) { - return next(request); +class XMLReader extends BaseReader_1.BaseReader { + /** + * Parses the given document representation. + * + * @param node - node receive parsed XML nodes + * @param str - XML document string to parse + */ + _parse(node, str) { + const lexer = new XMLStringLexer_1.XMLStringLexer(str, { skipWhitespaceOnlyText: this._builderOptions.skipWhitespaceOnlyText }); + let lastChild = node; + let context = node; + let token = lexer.nextToken(); + while (token.type !== interfaces_1.TokenType.EOF) { + switch (token.type) { + case interfaces_1.TokenType.Declaration: + const declaration = token; + const version = this.sanitize(declaration.version); + if (version !== "1.0") { + throw new Error("Invalid xml version: " + version); + } + const builderOptions = { + version: version + }; + if (declaration.encoding) { + builderOptions.encoding = this.sanitize(declaration.encoding); + } + if (declaration.standalone) { + builderOptions.standalone = (this.sanitize(declaration.standalone) === "yes"); + } + context.set(builderOptions); + break; + case interfaces_1.TokenType.DocType: + const doctype = token; + context = this.docType(context, this.sanitize(doctype.name), this.sanitize(doctype.pubId), this.sanitize(doctype.sysId)) || context; + break; + case interfaces_1.TokenType.CDATA: + const cdata = token; + context = this.cdata(context, this.sanitize(cdata.data)) || context; + break; + case interfaces_1.TokenType.Comment: + const comment = token; + context = this.comment(context, this.sanitize(comment.data)) || context; + break; + case interfaces_1.TokenType.PI: + const pi = token; + context = this.instruction(context, this.sanitize(pi.target), this.sanitize(pi.data)) || context; + break; + case interfaces_1.TokenType.Text: + if (context.node.nodeType === interfaces_2.NodeType.Document) + break; + const text = token; + context = this.text(context, this._decodeText(this.sanitize(text.data))) || context; + break; + case interfaces_1.TokenType.Element: + const element = token; + const elementName = this.sanitize(element.name); + // inherit namespace from parent + const [prefix] = (0, algorithm_1.namespace_extractQName)(elementName); + let namespace = context.node.lookupNamespaceURI(prefix); + // override namespace if there is a namespace declaration + // attribute + // also lookup namespace declaration attributes + const nsDeclarations = {}; + for (let [attName, attValue] of element.attributes) { + attName = this.sanitize(attName); + attValue = this.sanitize(attValue); + if (attName === "xmlns") { + namespace = attValue; + } + else { + const [attPrefix, attLocalName] = (0, algorithm_1.namespace_extractQName)(attName); + if (attPrefix === "xmlns") { + if (attLocalName === prefix) { + namespace = attValue; + } + nsDeclarations[attLocalName] = attValue; + } + } + } + // create the DOM element node + const elementNode = (namespace !== null ? + this.element(context, namespace, elementName) : + this.element(context, undefined, elementName)); + if (elementNode === undefined) + break; + if (context.node === node.node) + lastChild = elementNode; + // assign attributes + for (let [attName, attValue] of element.attributes) { + attName = this.sanitize(attName); + attValue = this.sanitize(attValue); + const [attPrefix, attLocalName] = (0, algorithm_1.namespace_extractQName)(attName); + let attNamespace = null; + if (attPrefix === "xmlns" || (attPrefix === null && attLocalName === "xmlns")) { + // namespace declaration attribute + attNamespace = infra_1.namespace.XMLNS; + } + else { + attNamespace = elementNode.node.lookupNamespaceURI(attPrefix); + if (attNamespace !== null && elementNode.node.isDefaultNamespace(attNamespace)) { + attNamespace = null; + } + else if (attNamespace === null && attPrefix !== null) { + attNamespace = nsDeclarations[attPrefix] || null; + } + } + if (attNamespace !== null) + this.attribute(elementNode, attNamespace, attName, this._decodeAttributeValue(attValue)); + else + this.attribute(elementNode, undefined, attName, this._decodeAttributeValue(attValue)); + } + if (!element.selfClosing) { + context = elementNode; + } + break; + case interfaces_1.TokenType.ClosingTag: + /* istanbul ignore else */ + if (context.node.parentNode) { + context = context.up(); + } + break; } - logger(`Request: ${sanitizer.sanitize(request)}`); - const response = await next(request); - logger(`Response status code: ${response.status}`); - logger(`Headers: ${sanitizer.sanitize(response.headers)}`); - return response; - }, - }; + token = lexer.nextToken(); + } + return lastChild; + } } -//# sourceMappingURL=logPolicy.js.map +exports.XMLReader = XMLReader; +//# sourceMappingURL=XMLReader.js.map /***/ }), -/***/ 95316: +/***/ 3905: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.multipartPolicyName = void 0; -exports.multipartPolicy = multipartPolicy; -const bytesEncoding_js_1 = __nccwpck_require__(88943); -const typeGuards_js_1 = __nccwpck_require__(61580); -const uuidUtils_js_1 = __nccwpck_require__(2339); -const concat_js_1 = __nccwpck_require__(96494); -function generateBoundary() { - return `----AzSDKFormBoundary${(0, uuidUtils_js_1.randomUUID)()}`; -} -function encodeHeaders(headers) { - let result = ""; - for (const [key, value] of headers) { - result += `${key}: ${value}\r\n`; - } - return result; -} -function getLength(source) { - if (source instanceof Uint8Array) { - return source.byteLength; - } - else if ((0, typeGuards_js_1.isBlob)(source)) { - // if was created using createFile then -1 means we have an unknown size - return source.size === -1 ? undefined : source.size; - } - else { - return undefined; - } -} -function getTotalLength(sources) { - let total = 0; - for (const source of sources) { - const partLength = getLength(source); - if (partLength === undefined) { - return undefined; - } - else { - total += partLength; - } - } - return total; -} -async function buildRequestBody(request, parts, boundary) { - const sources = [ - (0, bytesEncoding_js_1.stringToUint8Array)(`--${boundary}`, "utf-8"), - ...parts.flatMap((part) => [ - (0, bytesEncoding_js_1.stringToUint8Array)("\r\n", "utf-8"), - (0, bytesEncoding_js_1.stringToUint8Array)(encodeHeaders(part.headers), "utf-8"), - (0, bytesEncoding_js_1.stringToUint8Array)("\r\n", "utf-8"), - part.body, - (0, bytesEncoding_js_1.stringToUint8Array)(`\r\n--${boundary}`, "utf-8"), - ]), - (0, bytesEncoding_js_1.stringToUint8Array)("--\r\n\r\n", "utf-8"), - ]; - const contentLength = getTotalLength(sources); - if (contentLength) { - request.headers.set("Content-Length", contentLength); +exports.YAMLReader = void 0; +const ObjectReader_1 = __nccwpck_require__(74573); +const BaseReader_1 = __nccwpck_require__(87825); +const js_yaml_1 = __nccwpck_require__(21917); +/** + * Parses XML nodes from a YAML string. + */ +class YAMLReader extends BaseReader_1.BaseReader { + /** + * Parses the given document representation. + * + * @param node - node receive parsed XML nodes + * @param str - YAML string to parse + */ + _parse(node, str) { + const result = (0, js_yaml_1.load)(str); + /* istanbul ignore next */ + if (result === undefined) { + throw new Error("Unable to parse YAML document."); + } + return new ObjectReader_1.ObjectReader(this._builderOptions).parse(node, result); } - request.body = await (0, concat_js_1.concat)(sources); } +exports.YAMLReader = YAMLReader; +//# sourceMappingURL=YAMLReader.js.map + +/***/ }), + +/***/ 90241: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.YAMLReader = exports.JSONReader = exports.ObjectReader = exports.XMLReader = void 0; +var XMLReader_1 = __nccwpck_require__(21190); +Object.defineProperty(exports, "XMLReader", ({ enumerable: true, get: function () { return XMLReader_1.XMLReader; } })); +var ObjectReader_1 = __nccwpck_require__(74573); +Object.defineProperty(exports, "ObjectReader", ({ enumerable: true, get: function () { return ObjectReader_1.ObjectReader; } })); +var JSONReader_1 = __nccwpck_require__(24520); +Object.defineProperty(exports, "JSONReader", ({ enumerable: true, get: function () { return JSONReader_1.JSONReader; } })); +var YAMLReader_1 = __nccwpck_require__(3905); +Object.defineProperty(exports, "YAMLReader", ({ enumerable: true, get: function () { return YAMLReader_1.YAMLReader; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 63210: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaseCBWriter = void 0; /** - * Name of multipart policy + * Pre-serializes XML nodes. */ -exports.multipartPolicyName = "multipartPolicy"; -const maxBoundaryLength = 70; -const validBoundaryCharacters = new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`); -function assertValidBoundary(boundary) { - if (boundary.length > maxBoundaryLength) { - throw new Error(`Multipart boundary "${boundary}" exceeds maximum length of 70 characters`); - } - if (Array.from(boundary).some((x) => !validBoundaryCharacters.has(x))) { - throw new Error(`Multipart boundary "${boundary}" contains invalid characters`); +class BaseCBWriter { + _builderOptions; + _writerOptions; + /** + * Gets the current depth of the XML tree. + */ + level = 0; + /** + * Determines whether any data has been written. + */ + hasData; + /** + * Initializes a new instance of `BaseCBWriter`. + * + * @param builderOptions - XML builder options + */ + constructor(builderOptions) { + this._builderOptions = builderOptions; + this._writerOptions = builderOptions; } } -/** - * Pipeline policy for multipart requests - */ -function multipartPolicy() { - return { - name: exports.multipartPolicyName, - async sendRequest(request, next) { - if (!request.multipartBody) { - return next(request); - } - if (request.body) { - throw new Error("multipartBody and regular body cannot be set at the same time"); - } - let boundary = request.multipartBody.boundary; - const contentTypeHeader = request.headers.get("Content-Type") ?? "multipart/mixed"; - const parsedHeader = contentTypeHeader.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/); - if (!parsedHeader) { - throw new Error(`Got multipart request body, but content-type header was not multipart: ${contentTypeHeader}`); - } - const [, contentType, parsedBoundary] = parsedHeader; - if (parsedBoundary && boundary && parsedBoundary !== boundary) { - throw new Error(`Multipart boundary was specified as ${parsedBoundary} in the header, but got ${boundary} in the request body`); - } - boundary ??= parsedBoundary; - if (boundary) { - assertValidBoundary(boundary); - } - else { - boundary = generateBoundary(); - } - request.headers.set("Content-Type", `${contentType}; boundary=${boundary}`); - await buildRequestBody(request, request.multipartBody.parts, boundary); - request.multipartBody = undefined; - return next(request); - }, - }; -} -//# sourceMappingURL=multipartPolicy.js.map +exports.BaseCBWriter = BaseCBWriter; +//# sourceMappingURL=BaseCBWriter.js.map /***/ }), -/***/ 57954: +/***/ 24189: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.globalNoProxyList = exports.proxyPolicyName = void 0; -exports.loadNoProxy = loadNoProxy; -exports.getDefaultProxySettings = getDefaultProxySettings; -exports.proxyPolicy = proxyPolicy; -const https_proxy_agent_1 = __nccwpck_require__(77219); -const http_proxy_agent_1 = __nccwpck_require__(23764); -const log_js_1 = __nccwpck_require__(85930); -const HTTPS_PROXY = "HTTPS_PROXY"; -const HTTP_PROXY = "HTTP_PROXY"; -const ALL_PROXY = "ALL_PROXY"; -const NO_PROXY = "NO_PROXY"; -/** - * The programmatic identifier of the proxyPolicy. - */ -exports.proxyPolicyName = "proxyPolicy"; +exports.BaseWriter = void 0; +const interfaces_1 = __nccwpck_require__(27305); +const LocalNameSet_1 = __nccwpck_require__(19049); +const NamespacePrefixMap_1 = __nccwpck_require__(90283); +const infra_1 = __nccwpck_require__(84251); +const algorithm_1 = __nccwpck_require__(61); +const constants_1 = __nccwpck_require__(9311); /** - * Stores the patterns specified in NO_PROXY environment variable. - * @internal + * Pre-serializes XML nodes. */ -exports.globalNoProxyList = []; -let noProxyListLoaded = false; -/** A cache of whether a host should bypass the proxy. */ -const globalBypassedMap = new Map(); -function getEnvironmentValue(name) { - if (process.env[name]) { - return process.env[name]; +class BaseWriter { + static _VoidElementNames = new Set(['area', 'base', 'basefont', + 'bgsound', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'keygen', + 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']); + _builderOptions; + _writerOptions; + /** + * Initializes a new instance of `BaseWriter`. + * + * @param builderOptions - XML builder options + */ + constructor(builderOptions) { + this._builderOptions = builderOptions; } - else if (process.env[name.toLowerCase()]) { - return process.env[name.toLowerCase()]; + /** + * Used by derived classes to serialize the XML declaration. + * + * @param version - a version number string + * @param encoding - encoding declaration + * @param standalone - standalone document declaration + */ + declaration(version, encoding, standalone) { } + /** + * Used by derived classes to serialize a DocType node. + * + * @param name - node name + * @param publicId - public identifier + * @param systemId - system identifier + */ + docType(name, publicId, systemId) { } + /** + * Used by derived classes to serialize a comment node. + * + * @param data - node data + */ + comment(data) { } + /** + * Used by derived classes to serialize a text node. + * + * @param data - node data + */ + text(data) { } + /** + * Used by derived classes to serialize a processing instruction node. + * + * @param target - instruction target + * @param data - node data + */ + instruction(target, data) { } + /** + * Used by derived classes to serialize a CData section node. + * + * @param data - node data + */ + cdata(data) { } + /** + * Used by derived classes to serialize the beginning of the opening tag of an + * element node. + * + * @param name - node name + */ + openTagBegin(name) { } + /** + * Used by derived classes to serialize the ending of the opening tag of an + * element node. + * + * @param name - node name + * @param selfClosing - whether the element node is self closing + * @param voidElement - whether the element node is a HTML void element + */ + openTagEnd(name, selfClosing, voidElement) { } + /** + * Used by derived classes to serialize the closing tag of an element node. + * + * @param name - node name + */ + closeTag(name) { } + /** + * Used by derived classes to serialize attributes or namespace declarations. + * + * @param attributes - attribute array + */ + attributes(attributes) { + for (const attr of attributes) { + this.attribute(attr[1] === null ? attr[2] : attr[1] + ':' + attr[2], attr[3]); + } } - return undefined; -} -function loadEnvironmentProxyValue() { - if (!process) { - return undefined; + /** + * Used by derived classes to serialize an attribute or namespace declaration. + * + * @param name - node name + * @param value - node value + */ + attribute(name, value) { } + /** + * Used by derived classes to perform any pre-processing steps before starting + * serializing an element node. + * + * @param name - node name + */ + beginElement(name) { } + /** + * Used by derived classes to perform any post-processing steps after + * completing serializing an element node. + * + * @param name - node name + */ + endElement(name) { } + /** + * Gets the current depth of the XML tree. + */ + level = 0; + /** + * Gets the current XML node. + */ + currentNode; + /** + * Produces an XML serialization of the given node. The pre-serializer inserts + * namespace declarations where necessary and produces qualified names for + * nodes and attributes. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + serializeNode(node, requireWellFormed) { + const hasNamespaces = (node._nodeDocument !== undefined && node._nodeDocument._hasNamespaces); + this.level = 0; + this.currentNode = node; + if (hasNamespaces) { + /** From: https://w3c.github.io/DOM-Parsing/#xml-serialization + * + * 1. Let namespace be a context namespace with value null. + * The context namespace tracks the XML serialization algorithm's current + * default namespace. The context namespace is changed when either an Element + * Node has a default namespace declaration, or the algorithm generates a + * default namespace declaration for the Element Node to match its own + * namespace. The algorithm assumes no namespace (null) to start. + * 2. Let prefix map be a new namespace prefix map. + * 3. Add the XML namespace with prefix value "xml" to prefix map. + * 4. Let prefix index be a generated namespace prefix index with value 1. + * The generated namespace prefix index is used to generate a new unique + * prefix value when no suitable existing namespace prefix is available to + * serialize a node's namespaceURI (or the namespaceURI of one of node's + * attributes). See the generate a prefix algorithm. + */ + let namespace = null; + const prefixMap = new NamespacePrefixMap_1.NamespacePrefixMap(); + prefixMap.set("xml", infra_1.namespace.XML); + const prefixIndex = { value: 1 }; + /** + * 5. Return the result of running the XML serialization algorithm on node + * passing the context namespace namespace, namespace prefix map prefix map, + * generated namespace prefix index reference to prefix index, and the + * flag require well-formed. If an exception occurs during the execution + * of the algorithm, then catch that exception and throw an + * "InvalidStateError" DOMException. + */ + this._serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + } + else { + this._serializeNode(node, requireWellFormed); + } } - const httpsProxy = getEnvironmentValue(HTTPS_PROXY); - const allProxy = getEnvironmentValue(ALL_PROXY); - const httpProxy = getEnvironmentValue(HTTP_PROXY); - return httpsProxy || allProxy || httpProxy; -} -/** - * Check whether the host of a given `uri` matches any pattern in the no proxy list. - * If there's a match, any request sent to the same host shouldn't have the proxy settings set. - * This implementation is a port of https://github.com/Azure/azure-sdk-for-net/blob/8cca811371159e527159c7eb65602477898683e2/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs#L210 - */ -function isBypassed(uri, noProxyList, bypassedMap) { - if (noProxyList.length === 0) { - return false; + /** + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + _serializeNodeNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { + this.currentNode = node; + switch (node.nodeType) { + case interfaces_1.NodeType.Element: + this._serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + break; + case interfaces_1.NodeType.Document: + this._serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + break; + case interfaces_1.NodeType.Comment: + this._serializeComment(node, requireWellFormed); + break; + case interfaces_1.NodeType.Text: + this._serializeText(node, requireWellFormed); + break; + case interfaces_1.NodeType.DocumentFragment: + this._serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed); + break; + case interfaces_1.NodeType.DocumentType: + this._serializeDocumentType(node, requireWellFormed); + break; + case interfaces_1.NodeType.ProcessingInstruction: + this._serializeProcessingInstruction(node, requireWellFormed); + break; + case interfaces_1.NodeType.CData: + this._serializeCData(node, requireWellFormed); + break; + default: + throw new Error(`Unknown node type: ${node.nodeType}`); + } } - const host = new URL(uri).hostname; - if (bypassedMap?.has(host)) { - return bypassedMap.get(host); + /** + * Produces an XML serialization of a node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeNode(node, requireWellFormed) { + this.currentNode = node; + switch (node.nodeType) { + case interfaces_1.NodeType.Element: + this._serializeElement(node, requireWellFormed); + break; + case interfaces_1.NodeType.Document: + this._serializeDocument(node, requireWellFormed); + break; + case interfaces_1.NodeType.Comment: + this._serializeComment(node, requireWellFormed); + break; + case interfaces_1.NodeType.Text: + this._serializeText(node, requireWellFormed); + break; + case interfaces_1.NodeType.DocumentFragment: + this._serializeDocumentFragment(node, requireWellFormed); + break; + case interfaces_1.NodeType.DocumentType: + this._serializeDocumentType(node, requireWellFormed); + break; + case interfaces_1.NodeType.ProcessingInstruction: + this._serializeProcessingInstruction(node, requireWellFormed); + break; + case interfaces_1.NodeType.CData: + this._serializeCData(node, requireWellFormed); + break; + default: + throw new Error(`Unknown node type: ${node.nodeType}`); + } } - let isBypassedFlag = false; - for (const pattern of noProxyList) { - if (pattern[0] === ".") { - // This should match either domain it self or any subdomain or host - // .foo.com will match foo.com it self or *.foo.com - if (host.endsWith(pattern)) { - isBypassedFlag = true; + /** + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + _serializeElementNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { + const attributes = []; + /** + * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + * + * 1. If the require well-formed flag is set (its value is true), and this + * node's localName attribute contains the character ":" (U+003A COLON) or + * does not match the XML Name production, then throw an exception; the + * serialization of this node would not be a well-formed element. + */ + if (requireWellFormed && (node.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(node.localName))) { + throw new Error("Node local name contains invalid characters (well-formed required)."); + } + /** + * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). + * 3. Let qualified name be an empty string. + * 4. Let skip end tag be a boolean flag with value false. + * 5. Let ignore namespace definition attribute be a boolean flag with value + * false. + * 6. Given prefix map, copy a namespace prefix map and let map be the + * result. + * 7. Let local prefixes map be an empty map. The map has unique Node prefix + * strings as its keys, with corresponding namespaceURI Node values as the + * map's key values (in this map, the null namespace is represented by the + * empty string). + * + * _Note:_ This map is local to each element. It is used to ensure there + * are no conflicting prefixes should a new namespace prefix attribute need + * to be generated. It is also used to enable skipping of duplicate prefix + * definitions when writing an element's attributes: the map allows the + * algorithm to distinguish between a prefix in the namespace prefix map + * that might be locally-defined (to the current Element) and one that is + * not. + * 8. Let local default namespace be the result of recording the namespace + * information for node given map and local prefixes map. + * + * _Note:_ The above step will update map with any found namespace prefix + * definitions, add the found prefix definitions to the local prefixes map + * and return a local default namespace value defined by a default namespace + * attribute if one exists. Otherwise it returns null. + * 9. Let inherited ns be a copy of namespace. + * 10. Let ns be the value of node's namespaceURI attribute. + */ + let qualifiedName = ''; + let skipEndTag = false; + let ignoreNamespaceDefinitionAttribute = false; + let map = prefixMap.copy(); + let localPrefixesMap = {}; + let localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap); + let inheritedNS = namespace; + let ns = node.namespaceURI; + /** 11. If inherited ns is equal to ns, then: */ + if (inheritedNS === ns) { + /** + * 11.1. If local default namespace is not null, then set ignore + * namespace definition attribute to true. + */ + if (localDefaultNamespace !== null) { + ignoreNamespaceDefinitionAttribute = true; + } + /** + * 11.2. If ns is the XML namespace, then append to qualified name the + * concatenation of the string "xml:" and the value of node's localName. + * 11.3. Otherwise, append to qualified name the value of node's + * localName. The node's prefix if it exists, is dropped. + */ + if (ns === infra_1.namespace.XML) { + qualifiedName = 'xml:' + node.localName; + } + else { + qualifiedName = node.localName; + } + /** 11.4. Append the value of qualified name to markup. */ + this.beginElement(qualifiedName); + this.openTagBegin(qualifiedName); + } + else { + /** + * 12. Otherwise, inherited ns is not equal to ns (the node's own + * namespace is different from the context namespace of its parent). + * Run these sub-steps: + * + * 12.1. Let prefix be the value of node's prefix attribute. + * 12.2. Let candidate prefix be the result of retrieving a preferred + * prefix string prefix from map given namespace ns. The above may return + * null if no namespace key ns exists in map. + */ + let prefix = node.prefix; + /** + * We don't need to run "retrieving a preferred prefix string" algorithm if + * the element has no prefix and its namespace matches to the default + * namespace. + * See: https://github.com/web-platform-tests/wpt/pull/16703 + */ + let candidatePrefix = null; + if (prefix !== null || ns !== localDefaultNamespace) { + candidatePrefix = map.get(prefix, ns); + } + /** + * 12.3. If the value of prefix matches "xmlns", then run the following + * steps: + */ + if (prefix === "xmlns") { + /** + * 12.3.1. If the require well-formed flag is set, then throw an error. + * An Element with prefix "xmlns" will not legally round-trip in a + * conforming XML parser. + */ + if (requireWellFormed) { + throw new Error("An element cannot have the 'xmlns' prefix (well-formed required)."); + } + /** + * 12.3.2. Let candidate prefix be the value of prefix. + */ + candidatePrefix = prefix; + } + /** + * 12.4.Found a suitable namespace prefix: if candidate prefix is not + * null (a namespace prefix is defined which maps to ns), then: + */ + if (candidatePrefix !== null) { + /** + * The following may serialize a different prefix than the Element's + * existing prefix if it already had one. However, the retrieving a + * preferred prefix string algorithm already tried to match the + * existing prefix if possible. + * + * 12.4.1. Append to qualified name the concatenation of candidate + * prefix, ":" (U+003A COLON), and node's localName. There exists on + * this node or the node's ancestry a namespace prefix definition that + * defines the node's namespace. + * 12.4.2. If the local default namespace is not null (there exists a + * locally-defined default namespace declaration attribute) and its + * value is not the XML namespace, then let inherited ns get the value + * of local default namespace unless the local default namespace is the + * empty string in which case let it get null (the context namespace + * is changed to the declared default, rather than this node's own + * namespace). + * + * _Note:_ Any default namespace definitions or namespace prefixes that + * define the XML namespace are omitted when serializing this node's + * attributes. + */ + qualifiedName = candidatePrefix + ':' + node.localName; + if (localDefaultNamespace !== null && localDefaultNamespace !== infra_1.namespace.XML) { + inheritedNS = localDefaultNamespace || null; + } + /** + * 12.4.3. Append the value of qualified name to markup. + */ + this.beginElement(qualifiedName); + this.openTagBegin(qualifiedName); + /** 12.5. Otherwise, if prefix is not null, then: */ + } + else if (prefix !== null) { + /** + * _Note:_ By this step, there is no namespace or prefix mapping + * declaration in this node (or any parent node visited by this + * algorithm) that defines prefix otherwise the step labelled Found + * a suitable namespace prefix would have been followed. The sub-steps + * that follow will create a new namespace prefix declaration for prefix + * and ensure that prefix does not conflict with an existing namespace + * prefix declaration of the same localName in node's attribute list. + * + * 12.5.1. If the local prefixes map contains a key matching prefix, + * then let prefix be the result of generating a prefix providing as + * input map, ns, and prefix index. + */ + if (prefix in localPrefixesMap) { + prefix = this._generatePrefix(ns, map, prefixIndex); + } + /** + * 12.5.2. Add prefix to map given namespace ns. + * 12.5.3. Append to qualified name the concatenation of prefix, ":" + * (U+003A COLON), and node's localName. + * 12.5.4. Append the value of qualified name to markup. + */ + map.set(prefix, ns); + qualifiedName += prefix + ':' + node.localName; + this.beginElement(qualifiedName); + this.openTagBegin(qualifiedName); + /** + * 12.5.5. Append the following to markup, in the order listed: + * + * _Note:_ The following serializes a namespace prefix declaration for + * prefix which was just added to the map. + * + * 12.5.5.1. " " (U+0020 SPACE); + * 12.5.5.2. The string "xmlns:"; + * 12.5.5.3. The value of prefix; + * 12.5.5.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 12.5.5.5. The result of serializing an attribute value given ns and + * the require well-formed flag as input; + * 12.5.5.6. """ (U+0022 QUOTATION MARK). + */ + attributes.push([null, 'xmlns', prefix, + this._serializeAttributeValue(ns, requireWellFormed)]); + /** + * 12.5.5.7. If local default namespace is not null (there exists a + * locally-defined default namespace declaration attribute), then + * let inherited ns get the value of local default namespace unless the + * local default namespace is the empty string in which case let it get + * null. + */ + if (localDefaultNamespace !== null) { + inheritedNS = localDefaultNamespace || null; + } + /** + * 12.6. Otherwise, if local default namespace is null, or local + * default namespace is not null and its value is not equal to ns, then: + */ + } + else if (localDefaultNamespace === null || + (localDefaultNamespace !== null && localDefaultNamespace !== ns)) { + /** + * _Note:_ At this point, the namespace for this node still needs to be + * serialized, but there's no prefix (or candidate prefix) available; the + * following uses the default namespace declaration to define the + * namespace--optionally replacing an existing default declaration + * if present. + * + * 12.6.1. Set the ignore namespace definition attribute flag to true. + * 12.6.2. Append to qualified name the value of node's localName. + * 12.6.3. Let the value of inherited ns be ns. + * + * _Note:_ The new default namespace will be used in the serialization + * to define this node's namespace and act as the context namespace for + * its children. + */ + ignoreNamespaceDefinitionAttribute = true; + qualifiedName += node.localName; + inheritedNS = ns; + /** + * 12.6.4. Append the value of qualified name to markup. + */ + this.beginElement(qualifiedName); + this.openTagBegin(qualifiedName); + /** + * 12.6.5. Append the following to markup, in the order listed: + * + * _Note:_ The following serializes the new (or replacement) default + * namespace definition. + * + * 12.6.5.1. " " (U+0020 SPACE); + * 12.6.5.2. The string "xmlns"; + * 12.6.5.3. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 12.6.5.4. The result of serializing an attribute value given ns + * and the require well-formed flag as input; + * 12.6.5.5. """ (U+0022 QUOTATION MARK). + */ + attributes.push([null, null, 'xmlns', + this._serializeAttributeValue(ns, requireWellFormed)]); + /** + * 12.7. Otherwise, the node has a local default namespace that matches + * ns. Append to qualified name the value of node's localName, let the + * value of inherited ns be ns, and append the value of qualified name + * to markup. + */ } else { - if (host.length === pattern.length - 1 && host === pattern.slice(1)) { - isBypassedFlag = true; - } + qualifiedName += node.localName; + inheritedNS = ns; + this.beginElement(qualifiedName); + this.openTagBegin(qualifiedName); } } + /** + * 13. Append to markup the result of the XML serialization of node's + * attributes given map, prefix index, local prefixes map, ignore namespace + * definition attribute flag, and require well-formed flag. + */ + attributes.push(...this._serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed)); + this.attributes(attributes); + /** + * 14. If ns is the HTML namespace, and the node's list of children is + * empty, and the node's localName matches any one of the following void + * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", + * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", + * "param", "source", "track", "wbr"; then append the following to markup, + * in the order listed: + * 14.1. " " (U+0020 SPACE); + * 14.2. "/" (U+002F SOLIDUS). + * and set the skip end tag flag to true. + * 15. If ns is not the HTML namespace, and the node's list of children is + * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end + * tag flag to true. + * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. + */ + const isHTML = (ns === infra_1.namespace.HTML); + if (isHTML && node.childNodes.length === 0 && + BaseWriter._VoidElementNames.has(node.localName)) { + this.openTagEnd(qualifiedName, true, true); + this.endElement(qualifiedName); + skipEndTag = true; + } + else if (!isHTML && node.childNodes.length === 0) { + this.openTagEnd(qualifiedName, true, false); + this.endElement(qualifiedName); + skipEndTag = true; + } else { - if (host === pattern) { - isBypassedFlag = true; + this.openTagEnd(qualifiedName, false, false); + } + /** + * 17. If the value of skip end tag is true, then return the value of markup + * and skip the remaining steps. The node is a leaf-node. + */ + if (skipEndTag) + return; + /** + * 18. If ns is the HTML namespace, and the node's localName matches the + * string "template", then this is a template element. Append to markup the + * result of XML serializing a DocumentFragment node given the template + * element's template contents (a DocumentFragment), providing inherited + * ns, map, prefix index, and the require well-formed flag. + * + * _Note:_ This allows template content to round-trip, given the rules for + * parsing XHTML documents. + * + * 19. Otherwise, append to markup the result of running the XML + * serialization algorithm on each of node's children, in tree order, + * providing inherited ns, map, prefix index, and the require well-formed + * flag. + */ + if (isHTML && node.localName === "template") { + // TODO: serialize template contents + } + else { + for (const childNode of node.childNodes) { + this.level++; + this._serializeNodeNS(childNode, inheritedNS, map, prefixIndex, requireWellFormed); + this.level--; } } + /** + * 20. Append the following to markup, in the order listed: + * 20.1. "" (U+003E GREATER-THAN SIGN). + * 21. Return the value of markup. + */ + this.closeTag(qualifiedName); + this.endElement(qualifiedName); } - bypassedMap?.set(host, isBypassedFlag); - return isBypassedFlag; -} -function loadNoProxy() { - const noProxy = getEnvironmentValue(NO_PROXY); - noProxyListLoaded = true; - if (noProxy) { - return noProxy - .split(",") - .map((item) => item.trim()) - .filter((item) => item.length); + /** + * Produces an XML serialization of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeElement(node, requireWellFormed) { + /** + * From: https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node + * + * 1. If the require well-formed flag is set (its value is true), and this + * node's localName attribute contains the character ":" (U+003A COLON) or + * does not match the XML Name production, then throw an exception; the + * serialization of this node would not be a well-formed element. + */ + if (requireWellFormed && (node.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(node.localName))) { + throw new Error("Node local name contains invalid characters (well-formed required)."); + } + /** + * 2. Let markup be the string "<" (U+003C LESS-THAN SIGN). + * 3. Let qualified name be an empty string. + * 4. Let skip end tag be a boolean flag with value false. + * 5. Let ignore namespace definition attribute be a boolean flag with value + * false. + * 6. Given prefix map, copy a namespace prefix map and let map be the + * result. + * 7. Let local prefixes map be an empty map. The map has unique Node prefix + * strings as its keys, with corresponding namespaceURI Node values as the + * map's key values (in this map, the null namespace is represented by the + * empty string). + * + * _Note:_ This map is local to each element. It is used to ensure there + * are no conflicting prefixes should a new namespace prefix attribute need + * to be generated. It is also used to enable skipping of duplicate prefix + * definitions when writing an element's attributes: the map allows the + * algorithm to distinguish between a prefix in the namespace prefix map + * that might be locally-defined (to the current Element) and one that is + * not. + * 8. Let local default namespace be the result of recording the namespace + * information for node given map and local prefixes map. + * + * _Note:_ The above step will update map with any found namespace prefix + * definitions, add the found prefix definitions to the local prefixes map + * and return a local default namespace value defined by a default namespace + * attribute if one exists. Otherwise it returns null. + * 9. Let inherited ns be a copy of namespace. + * 10. Let ns be the value of node's namespaceURI attribute. + */ + let skipEndTag = false; + /** 11. If inherited ns is equal to ns, then: */ + /** + * 11.1. If local default namespace is not null, then set ignore + * namespace definition attribute to true. + */ + /** + * 11.2. If ns is the XML namespace, then append to qualified name the + * concatenation of the string "xml:" and the value of node's localName. + * 11.3. Otherwise, append to qualified name the value of node's + * localName. The node's prefix if it exists, is dropped. + */ + const qualifiedName = node.localName; + /** 11.4. Append the value of qualified name to markup. */ + this.beginElement(qualifiedName); + this.openTagBegin(qualifiedName); + /** + * 13. Append to markup the result of the XML serialization of node's + * attributes given map, prefix index, local prefixes map, ignore namespace + * definition attribute flag, and require well-formed flag. + */ + const attributes = this._serializeAttributes(node, requireWellFormed); + this.attributes(attributes); + /** + * 14. If ns is the HTML namespace, and the node's list of children is + * empty, and the node's localName matches any one of the following void + * elements: "area", "base", "basefont", "bgsound", "br", "col", "embed", + * "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", + * "param", "source", "track", "wbr"; then append the following to markup, + * in the order listed: + * 14.1. " " (U+0020 SPACE); + * 14.2. "/" (U+002F SOLIDUS). + * and set the skip end tag flag to true. + * 15. If ns is not the HTML namespace, and the node's list of children is + * empty, then append "/" (U+002F SOLIDUS) to markup and set the skip end + * tag flag to true. + * 16. Append ">" (U+003E GREATER-THAN SIGN) to markup. + */ + if (!node.hasChildNodes()) { + this.openTagEnd(qualifiedName, true, false); + this.endElement(qualifiedName); + skipEndTag = true; + } + else { + this.openTagEnd(qualifiedName, false, false); + } + /** + * 17. If the value of skip end tag is true, then return the value of markup + * and skip the remaining steps. The node is a leaf-node. + */ + if (skipEndTag) + return; + /** + * 18. If ns is the HTML namespace, and the node's localName matches the + * string "template", then this is a template element. Append to markup the + * result of XML serializing a DocumentFragment node given the template + * element's template contents (a DocumentFragment), providing inherited + * ns, map, prefix index, and the require well-formed flag. + * + * _Note:_ This allows template content to round-trip, given the rules for + * parsing XHTML documents. + * + * 19. Otherwise, append to markup the result of running the XML + * serialization algorithm on each of node's children, in tree order, + * providing inherited ns, map, prefix index, and the require well-formed + * flag. + */ + for (const childNode of node._children) { + this.level++; + this._serializeNode(childNode, requireWellFormed); + this.level--; + } + /** + * 20. Append the following to markup, in the order listed: + * 20.1. "" (U+003E GREATER-THAN SIGN). + * 21. Return the value of markup. + */ + this.closeTag(qualifiedName); + this.endElement(qualifiedName); } - return []; -} -/** - * This method converts a proxy url into `ProxySettings` for use with ProxyPolicy. - * If no argument is given, it attempts to parse a proxy URL from the environment - * variables `HTTPS_PROXY` or `HTTP_PROXY`. - * @param proxyUrl - The url of the proxy to use. May contain authentication information. - * @deprecated - Internally this method is no longer necessary when setting proxy information. - */ -function getDefaultProxySettings(proxyUrl) { - if (!proxyUrl) { - proxyUrl = loadEnvironmentProxyValue(); - if (!proxyUrl) { - return undefined; + /** + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + _serializeDocumentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { + /** + * If the require well-formed flag is set (its value is true), and this node + * has no documentElement (the documentElement attribute's value is null), + * then throw an exception; the serialization of this node would not be a + * well-formed document. + */ + if (requireWellFormed && node.documentElement === null) { + throw new Error("Missing document element (well-formed required)."); + } + /** + * Otherwise, run the following steps: + * 1. Let serialized document be an empty string. + * 2. For each child child of node, in tree order, run the XML + * serialization algorithm on the child passing along the provided + * arguments, and append the result to serialized document. + * + * _Note:_ This will serialize any number of ProcessingInstruction and + * Comment nodes both before and after the Document's documentElement node, + * including at most one DocumentType node. (Text nodes are not allowed as + * children of the Document.) + * + * 3. Return the value of serialized document. + */ + for (const childNode of node.childNodes) { + this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); } } - const parsedUrl = new URL(proxyUrl); - const schema = parsedUrl.protocol ? parsedUrl.protocol + "//" : ""; - return { - host: schema + parsedUrl.hostname, - port: Number.parseInt(parsedUrl.port || "80"), - username: parsedUrl.username, - password: parsedUrl.password, - }; -} -/** - * This method attempts to parse a proxy URL from the environment - * variables `HTTPS_PROXY` or `HTTP_PROXY`. - */ -function getDefaultProxySettingsInternal() { - const envProxy = loadEnvironmentProxyValue(); - return envProxy ? new URL(envProxy) : undefined; -} -function getUrlFromProxySettings(settings) { - let parsedProxyUrl; - try { - parsedProxyUrl = new URL(settings.host); + /** + * Produces an XML serialization of a document node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeDocument(node, requireWellFormed) { + /** + * If the require well-formed flag is set (its value is true), and this node + * has no documentElement (the documentElement attribute's value is null), + * then throw an exception; the serialization of this node would not be a + * well-formed document. + */ + if (requireWellFormed && node.documentElement === null) { + throw new Error("Missing document element (well-formed required)."); + } + /** + * Otherwise, run the following steps: + * 1. Let serialized document be an empty string. + * 2. For each child child of node, in tree order, run the XML + * serialization algorithm on the child passing along the provided + * arguments, and append the result to serialized document. + * + * _Note:_ This will serialize any number of ProcessingInstruction and + * Comment nodes both before and after the Document's documentElement node, + * including at most one DocumentType node. (Text nodes are not allowed as + * children of the Document.) + * + * 3. Return the value of serialized document. + */ + for (const childNode of node._children) { + this._serializeNode(childNode, requireWellFormed); + } } - catch { - throw new Error(`Expecting a valid host string in proxy settings, but found "${settings.host}".`); + /** + * Produces an XML serialization of a comment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeComment(node, requireWellFormed) { + /** + * If the require well-formed flag is set (its value is true), and node's + * data contains characters that are not matched by the XML Char production + * or contains "--" (two adjacent U+002D HYPHEN-MINUS characters) or that + * ends with a "-" (U+002D HYPHEN-MINUS) character, then throw an exception; + * the serialization of this node's data would not be well-formed. + */ + if (requireWellFormed && (!(0, algorithm_1.xml_isLegalChar)(node.data) || + node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) { + throw new Error("Comment data contains invalid characters (well-formed required)."); + } + /** + * Otherwise, return the concatenation of "". + */ + this.comment(node.data); } - parsedProxyUrl.port = String(settings.port); - if (settings.username) { - parsedProxyUrl.username = settings.username; + /** + * Produces an XML serialization of a text node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + * @param level - current depth of the XML tree + */ + _serializeText(node, requireWellFormed) { + /** + * 1. If the require well-formed flag is set (its value is true), and + * node's data contains characters that are not matched by the XML Char + * production, then throw an exception; the serialization of this node's + * data would not be well-formed. + */ + if (requireWellFormed && !(0, algorithm_1.xml_isLegalChar)(node.data)) { + throw new Error("Text data contains invalid characters (well-formed required)."); + } + /** + * 2. Let markup be the value of node's data. + * 3. Replace any occurrences of "&" in markup by "&". + * 4. Replace any occurrences of "<" in markup by "<". + * 5. Replace any occurrences of ">" in markup by ">". + * 6. Return the value of markup. + */ + const markup = node.data.replace(constants_1.nonEntityAmpersandRegex, '&') + .replace(//g, '>'); + this.text(markup); } - if (settings.password) { - parsedProxyUrl.password = settings.password; + /** + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param namespace - context namespace + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param requireWellFormed - whether to check conformance + */ + _serializeDocumentFragmentNS(node, namespace, prefixMap, prefixIndex, requireWellFormed) { + /** + * 1. Let markup the empty string. + * 2. For each child child of node, in tree order, run the XML serialization + * algorithm on the child given namespace, prefix map, a reference to prefix + * index, and flag require well-formed. Concatenate the result to markup. + * 3. Return the value of markup. + */ + for (const childNode of node.childNodes) { + this._serializeNodeNS(childNode, namespace, prefixMap, prefixIndex, requireWellFormed); + } } - return parsedProxyUrl; -} -function setProxyAgentOnRequest(request, cachedAgents, proxyUrl) { - // Custom Agent should take precedence so if one is present - // we should skip to avoid overwriting it. - if (request.agent) { - return; + /** + * Produces an XML serialization of a document fragment node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeDocumentFragment(node, requireWellFormed) { + /** + * 1. Let markup the empty string. + * 2. For each child child of node, in tree order, run the XML serialization + * algorithm on the child given namespace, prefix map, a reference to prefix + * index, and flag require well-formed. Concatenate the result to markup. + * 3. Return the value of markup. + */ + for (const childNode of node._children) { + this._serializeNode(childNode, requireWellFormed); + } } - const url = new URL(request.url); - const isInsecure = url.protocol !== "https:"; - if (request.tlsSettings) { - log_js_1.logger.warning("TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored."); + /** + * Produces an XML serialization of a document type node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeDocumentType(node, requireWellFormed) { + /** + * 1. If the require well-formed flag is true and the node's publicId + * attribute contains characters that are not matched by the XML PubidChar + * production, then throw an exception; the serialization of this node + * would not be a well-formed document type declaration. + */ + if (requireWellFormed && !(0, algorithm_1.xml_isPubidChar)(node.publicId)) { + throw new Error("DocType public identifier does not match PubidChar construct (well-formed required)."); + } + /** + * 2. If the require well-formed flag is true and the node's systemId + * attribute contains characters that are not matched by the XML Char + * production or that contains both a """ (U+0022 QUOTATION MARK) and a + * "'" (U+0027 APOSTROPHE), then throw an exception; the serialization + * of this node would not be a well-formed document type declaration. + */ + if (requireWellFormed && + (!(0, algorithm_1.xml_isLegalChar)(node.systemId) || + (node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) { + throw new Error("DocType system identifier contains invalid characters (well-formed required)."); + } + /** + * 3. Let markup be an empty string. + * 4. Append the string "" (U+003E GREATER-THAN SIGN) to markup. + * 11. Return the value of markup. + */ + this.docType(node.name, node.publicId, node.systemId); } - const headers = request.headers.toJSON(); - if (isInsecure) { - if (!cachedAgents.httpProxyAgent) { - cachedAgents.httpProxyAgent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl, { headers }); + /** + * Produces an XML serialization of a processing instruction node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeProcessingInstruction(node, requireWellFormed) { + /** + * 1. If the require well-formed flag is set (its value is true), and node's + * target contains a ":" (U+003A COLON) character or is an ASCII + * case-insensitive match for the string "xml", then throw an exception; + * the serialization of this node's target would not be well-formed. + */ + if (requireWellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) { + throw new Error("Processing instruction target contains invalid characters (well-formed required)."); } - request.agent = cachedAgents.httpProxyAgent; - } - else { - if (!cachedAgents.httpsProxyAgent) { - cachedAgents.httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl, { headers }); + /** + * 2. If the require well-formed flag is set (its value is true), and node's + * data contains characters that are not matched by the XML Char production + * or contains the string "?>" (U+003F QUESTION MARK, + * U+003E GREATER-THAN SIGN), then throw an exception; the serialization of + * this node's data would not be well-formed. + */ + if (requireWellFormed && (!(0, algorithm_1.xml_isLegalChar)(node.data) || + node.data.indexOf("?>") !== -1)) { + throw new Error("Processing instruction data contains invalid characters (well-formed required)."); } - request.agent = cachedAgents.httpsProxyAgent; + /** + * 3. Let markup be the concatenation of the following, in the order listed: + * 3.1. "" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN). + * 4. Return the value of markup. + */ + this.instruction(node.target, node.data); } -} -/** - * A policy that allows one to apply proxy settings to all requests. - * If not passed static settings, they will be retrieved from the HTTPS_PROXY - * or HTTP_PROXY environment variables. - * @param proxySettings - ProxySettings to use on each request. - * @param options - additional settings, for example, custom NO_PROXY patterns - */ -function proxyPolicy(proxySettings, options) { - if (!noProxyListLoaded) { - exports.globalNoProxyList.push(...loadNoProxy()); + /** + * Produces an XML serialization of a CDATA node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeCData(node, requireWellFormed) { + if (requireWellFormed && (node.data.indexOf("]]>") !== -1)) { + throw new Error("CDATA contains invalid characters (well-formed required)."); + } + this.cdata(node.data); } - const defaultProxy = proxySettings - ? getUrlFromProxySettings(proxySettings) - : getDefaultProxySettingsInternal(); - const cachedAgents = {}; - return { - name: exports.proxyPolicyName, - async sendRequest(request, next) { - if (!request.proxySettings && - defaultProxy && - !isBypassed(request.url, options?.customNoProxyList ?? exports.globalNoProxyList, options?.customNoProxyList ? undefined : globalBypassedMap)) { - setProxyAgentOnRequest(request, cachedAgents, defaultProxy); + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param map - namespace prefix map + * @param prefixIndex - generated namespace prefix index + * @param localPrefixesMap - local prefixes map + * @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace + * attributes + * @param requireWellFormed - whether to check conformance + */ + _serializeAttributesNS(node, map, prefixIndex, localPrefixesMap, ignoreNamespaceDefinitionAttribute, requireWellFormed) { + /** + * 1. Let result be the empty string. + * 2. Let localname set be a new empty namespace localname set. This + * localname set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ + const result = []; + const localNameSet = requireWellFormed ? new LocalNameSet_1.LocalNameSet() : undefined; + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (const attr of node.attributes) { + // Optimize common case + if (!requireWellFormed && !ignoreNamespaceDefinitionAttribute && attr.namespaceURI === null) { + result.push([null, null, attr.localName, + this._serializeAttributeValue(attr.value, requireWellFormed)]); + continue; } - else if (request.proxySettings) { - setProxyAgentOnRequest(request, cachedAgents, getUrlFromProxySettings(request.proxySettings)); + /** + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. + */ + if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); } - return next(request); - }, - }; -} -//# sourceMappingURL=proxyPolicy.js.map - -/***/ }), - -/***/ 45125: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.redirectPolicyName = void 0; -exports.redirectPolicy = redirectPolicy; -/** - * The programmatic identifier of the redirectPolicy. - */ -exports.redirectPolicyName = "redirectPolicy"; -/** - * Methods that are allowed to follow redirects 301 and 302 - */ -const allowedRedirect = ["GET", "HEAD"]; -/** - * A policy to follow Location headers from the server in order - * to support server-side redirection. - * In the browser, this policy is not used. - * @param options - Options to control policy behavior. - */ -function redirectPolicy(options = {}) { - const { maxRetries = 20 } = options; - return { - name: exports.redirectPolicyName, - async sendRequest(request, next) { - const response = await next(request); - return handleRedirect(next, response, maxRetries); - }, - }; -} -async function handleRedirect(next, response, maxRetries, currentRetries = 0) { - const { request, status, headers } = response; - const locationHeader = headers.get("location"); - if (locationHeader && - (status === 300 || - (status === 301 && allowedRedirect.includes(request.method)) || - (status === 302 && allowedRedirect.includes(request.method)) || - (status === 303 && request.method === "POST") || - status === 307) && - currentRetries < maxRetries) { - const url = new URL(locationHeader, request.url); - request.url = url.toString(); - // POST request with Status code 303 should be converted into a - // redirected GET request if the redirect url is present in the location header - if (status === 303) { - request.method = "GET"; - request.headers.delete("Content-Length"); - delete request.body; - } - request.headers.delete("Authorization"); - const res = await next(request); - return handleRedirect(next, res, maxRetries, currentRetries + 1); - } - return response; -} -//# sourceMappingURL=redirectPolicy.js.map - -/***/ }), - -/***/ 27729: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.retryPolicy = retryPolicy; -const helpers_js_1 = __nccwpck_require__(59842); -const AbortError_js_1 = __nccwpck_require__(72033); -const logger_js_1 = __nccwpck_require__(36720); -const constants_js_1 = __nccwpck_require__(58463); -const retryPolicyLogger = (0, logger_js_1.createClientLogger)("ts-http-runtime retryPolicy"); -/** - * The programmatic identifier of the retryPolicy. - */ -const retryPolicyName = "retryPolicy"; -/** - * retryPolicy is a generic policy to enable retrying requests when certain conditions are met - */ -function retryPolicy(strategies, options = { maxRetries: constants_js_1.DEFAULT_RETRY_POLICY_COUNT }) { - const logger = options.logger || retryPolicyLogger; - return { - name: retryPolicyName, - async sendRequest(request, next) { - let response; - let responseError; - let retryCount = -1; - retryRequest: while (true) { - retryCount += 1; - response = undefined; - responseError = undefined; - try { - logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId); - response = await next(request); - logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId); - } - catch (e) { - logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId); - // RestErrors are valid targets for the retry strategies. - // If none of the retry strategies can work with them, they will be thrown later in this policy. - // If the received error is not a RestError, it is immediately thrown. - responseError = e; - if (!e || responseError.name !== "RestError") { - throw e; - } - response = responseError.response; - } - if (request.abortSignal?.aborted) { - logger.error(`Retry ${retryCount}: Request aborted.`); - const abortError = new AbortError_js_1.AbortError(); - throw abortError; - } - if (retryCount >= (options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT)) { - logger.info(`Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`); - if (responseError) { - throw responseError; - } - else if (response) { - return response; + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + if (requireWellFormed && localNameSet) + localNameSet.set(attr.namespaceURI, attr.localName); + let attributeNamespace = attr.namespaceURI; + let candidatePrefix = null; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + if (attributeNamespace !== null) { + /** + * 3.5.1. Let candidate prefix be the result of retrieving a preferred + * prefix string from map given namespace attribute namespace with + * preferred prefix being attr's prefix value. + */ + candidatePrefix = map.get(attr.prefix, attributeNamespace); + /** + * 3.5.2. If the value of attribute namespace is the XMLNS namespace, + * then run these steps: + */ + if (attributeNamespace === infra_1.namespace.XMLNS) { + /** + * 3.5.2.1. If any of the following are true, then stop running these + * steps and goto Loop to visit the next attribute: + * - the attr's value is the XML namespace; + * _Note:_ The XML namespace cannot be redeclared and survive + * round-tripping (unless it defines the prefix "xml"). To avoid this + * problem, this algorithm always prefixes elements in the XML + * namespace with "xml" and drops any related definitions as seen + * in the above condition. + * - the attr's prefix is null and the ignore namespace definition + * attribute flag is true (the Element's default namespace attribute + * should be skipped); + * - the attr's prefix is not null and either + * * the attr's localName is not a key contained in the local + * prefixes map, or + * * the attr's localName is present in the local prefixes map but + * the value of the key does not match attr's value + * and furthermore that the attr's localName (as the prefix to find) + * is found in the namespace prefix map given the namespace consisting + * of the attr's value (the current namespace prefix definition was + * exactly defined previously--on an ancestor element not the current + * element whose attributes are being processed). + */ + if (attr.value === infra_1.namespace.XML || + (attr.prefix === null && ignoreNamespaceDefinitionAttribute) || + (attr.prefix !== null && (!(attr.localName in localPrefixesMap) || + localPrefixesMap[attr.localName] !== attr.value) && + map.has(attr.localName, attr.value))) + continue; + /** + * 3.5.2.2. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute matches the XMLNS + * namespace, then throw an exception; the serialization of this + * attribute would produce invalid XML because the XMLNS namespace + * is reserved and cannot be applied as an element's namespace via + * XML parsing. + * + * _Note:_ DOM APIs do allow creation of elements in the XMLNS + * namespace but with strict qualifications. + */ + if (requireWellFormed && attr.value === infra_1.namespace.XMLNS) { + throw new Error("XMLNS namespace is reserved (well-formed required)."); } - else { - throw new Error("Maximum retries reached with no response or error to throw"); + /** + * 3.5.2.3. If the require well-formed flag is set (its value is true), + * and the value of attr's value attribute is the empty string, then + * throw an exception; namespace prefix declarations cannot be used + * to undeclare a namespace (use a default namespace declaration + * instead). + */ + if (requireWellFormed && attr.value === '') { + throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."); } + /** + * 3.5.2.4. the attr's prefix matches the string "xmlns", then let + * candidate prefix be the string "xmlns". + */ + if (attr.prefix === 'xmlns') + candidatePrefix = 'xmlns'; + /** + * 3.5.3. Otherwise, the attribute namespace is not the XMLNS namespace. + * Run these steps: + * + * _Note:_ The (candidatePrefix === null) check is not in the spec. + * We deviate from the spec here. Otherwise a prefix is generated for + * all attributes with namespaces. + */ } - logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`); - strategiesLoop: for (const strategy of strategies) { - const strategyLogger = strategy.logger || logger; - strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`); - const modifiers = strategy.retry({ - retryCount, - response, - responseError, - }); - if (modifiers.skipStrategy) { - strategyLogger.info(`Retry ${retryCount}: Skipped.`); - continue strategiesLoop; - } - const { errorToThrow, retryAfterInMs, redirectTo } = modifiers; - if (errorToThrow) { - strategyLogger.error(`Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`, errorToThrow); - throw errorToThrow; - } - if (retryAfterInMs || retryAfterInMs === 0) { - strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`); - await (0, helpers_js_1.delay)(retryAfterInMs, undefined, { abortSignal: request.abortSignal }); - continue retryRequest; + else if (candidatePrefix === null) { + if (attr.prefix !== null && + (!map.hasPrefix(attr.prefix) || + map.has(attr.prefix, attributeNamespace))) { + /** + * Check if we can use the attribute's own prefix. + * We deviate from the spec here. + * TODO: This is not an efficient way of searching for prefixes. + * Follow developments to the spec. + */ + candidatePrefix = attr.prefix; } - if (redirectTo) { - strategyLogger.info(`Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`); - request.url = redirectTo; - continue retryRequest; + else { + /** + * 3.5.3.1. Let candidate prefix be the result of generating a prefix + * providing map, attribute namespace, and prefix index as input. + */ + candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex); } + /** + * 3.5.3.2. Append the following to result, in the order listed: + * 3.5.3.2.1. " " (U+0020 SPACE); + * 3.5.3.2.2. The string "xmlns:"; + * 3.5.3.2.3. The value of candidate prefix; + * 3.5.3.2.4. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.5.3.2.5. The result of serializing an attribute value given + * attribute namespace and the require well-formed flag as input; + * 3.5.3.2.6. """ (U+0022 QUOTATION MARK). + */ + result.push([null, "xmlns", candidatePrefix, + this._serializeAttributeValue(attributeNamespace, requireWellFormed)]); } - if (responseError) { - logger.info(`None of the retry strategies could work with the received error. Throwing it.`); - throw responseError; - } - if (response) { - logger.info(`None of the retry strategies could work with the received response. Returning it.`); - return response; - } - // If all the retries skip and there's no response, - // we're still in the retry loop, so a new request will be sent - // until `maxRetries` is reached. } - }, - }; -} -//# sourceMappingURL=retryPolicy.js.map - -/***/ }), - -/***/ 32738: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.systemErrorRetryPolicyName = void 0; -exports.systemErrorRetryPolicy = systemErrorRetryPolicy; -const exponentialRetryStrategy_js_1 = __nccwpck_require__(12283); -const retryPolicy_js_1 = __nccwpck_require__(27729); -const constants_js_1 = __nccwpck_require__(58463); -/** - * Name of the {@link systemErrorRetryPolicy} - */ -exports.systemErrorRetryPolicyName = "systemErrorRetryPolicy"; -/** - * A retry policy that specifically seeks to handle errors in the - * underlying transport layer (e.g. DNS lookup failures) rather than - * retryable error codes from the server itself. - * @param options - Options that customize the policy. - */ -function systemErrorRetryPolicy(options = {}) { - return { - name: exports.systemErrorRetryPolicyName, - sendRequest: (0, retryPolicy_js_1.retryPolicy)([ - (0, exponentialRetryStrategy_js_1.exponentialRetryStrategy)({ - ...options, - ignoreHttpStatusCodes: true, - }), - ], { - maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, - }).sendRequest, - }; -} -//# sourceMappingURL=systemErrorRetryPolicy.js.map - -/***/ }), - -/***/ 92337: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.throttlingRetryPolicyName = void 0; -exports.throttlingRetryPolicy = throttlingRetryPolicy; -const throttlingRetryStrategy_js_1 = __nccwpck_require__(90483); -const retryPolicy_js_1 = __nccwpck_require__(27729); -const constants_js_1 = __nccwpck_require__(58463); -/** - * Name of the {@link throttlingRetryPolicy} - */ -exports.throttlingRetryPolicyName = "throttlingRetryPolicy"; -/** - * A policy that retries when the server sends a 429 response with a Retry-After header. - * - * To learn more, please refer to - * https://learn.microsoft.com/azure/azure-resource-manager/resource-manager-request-limits, - * https://learn.microsoft.com/azure/azure-subscription-service-limits and - * https://learn.microsoft.com/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors - * - * @param options - Options that configure retry logic. - */ -function throttlingRetryPolicy(options = {}) { - return { - name: exports.throttlingRetryPolicyName, - sendRequest: (0, retryPolicy_js_1.retryPolicy)([(0, throttlingRetryStrategy_js_1.throttlingRetryStrategy)()], { - maxRetries: options.maxRetries ?? constants_js_1.DEFAULT_RETRY_POLICY_COUNT, - }).sendRequest, - }; -} -//# sourceMappingURL=throttlingRetryPolicy.js.map - -/***/ }), - -/***/ 24655: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.tlsPolicyName = void 0; -exports.tlsPolicy = tlsPolicy; -/** - * Name of the TLS Policy - */ -exports.tlsPolicyName = "tlsPolicy"; -/** - * Gets a pipeline policy that adds the client certificate to the HttpClient agent for authentication. - */ -function tlsPolicy(tlsSettings) { - return { - name: exports.tlsPolicyName, - sendRequest: async (req, next) => { - // Users may define a request tlsSettings, honor those over the client level one - if (!req.tlsSettings) { - req.tlsSettings = tlsSettings; + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + let attrName = ''; + if (candidatePrefix !== null) { + attrName = candidatePrefix; } - return next(req); - }, - }; -} -//# sourceMappingURL=tlsPolicy.js.map - -/***/ }), - -/***/ 35402: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.userAgentPolicyName = void 0; -exports.userAgentPolicy = userAgentPolicy; -const userAgent_js_1 = __nccwpck_require__(8192); -const UserAgentHeaderName = (0, userAgent_js_1.getUserAgentHeaderName)(); -/** - * The programmatic identifier of the userAgentPolicy. - */ -exports.userAgentPolicyName = "userAgentPolicy"; -/** - * A policy that sets the User-Agent header (or equivalent) to reflect - * the library version. - * @param options - Options to customize the user agent value. - */ -function userAgentPolicy(options = {}) { - const userAgentValue = (0, userAgent_js_1.getUserAgentValue)(options.userAgentPrefix); - return { - name: exports.userAgentPolicyName, - async sendRequest(request, next) { - if (!request.headers.has(UserAgentHeaderName)) { - request.headers.set(UserAgentHeaderName, await userAgentValue); + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(attr.localName) || + (attr.localName === "xmlns" && attributeNamespace === null))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); + } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result.push([attributeNamespace, candidatePrefix, attr.localName, + this._serializeAttributeValue(attr.value, requireWellFormed)]); + } + /** + * 4. Return the value of result. + */ + return result; + } + /** + * Produces an XML serialization of the attributes of an element node. + * + * @param node - node to serialize + * @param requireWellFormed - whether to check conformance + */ + _serializeAttributes(node, requireWellFormed) { + /** + * 1. Let result be the empty string. + * 2. Let localname set be a new empty namespace localname set. This + * localname set will contain tuples of unique attribute namespaceURI and + * localName pairs, and is populated as each attr is processed. This set is + * used to [optionally] enforce the well-formed constraint that an element + * cannot have two attributes with the same namespaceURI and localName. + * This can occur when two otherwise identical attributes on the same + * element differ only by their prefix values. + */ + const result = []; + const localNameSet = requireWellFormed ? {} : undefined; + /** + * 3. Loop: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (const attr of node.attributes) { + // Optimize common case + if (!requireWellFormed) { + result.push([null, null, attr.localName, + this._serializeAttributeValue(attr.value, requireWellFormed)]); + continue; + } + /** + * 3.1. If the require well-formed flag is set (its value is true), and the + * localname set contains a tuple whose values match those of a new tuple + * consisting of attr's namespaceURI attribute and localName attribute, + * then throw an exception; the serialization of this attr would fail to + * produce a well-formed element serialization. + */ + if (requireWellFormed && localNameSet && (attr.localName in localNameSet)) { + throw new Error("Element contains duplicate attributes (well-formed required)."); + } + /** + * 3.2. Create a new tuple consisting of attr's namespaceURI attribute and + * localName attribute, and add it to the localname set. + * 3.3. Let attribute namespace be the value of attr's namespaceURI value. + * 3.4. Let candidate prefix be null. + */ + /* istanbul ignore else */ + if (requireWellFormed && localNameSet) + localNameSet[attr.localName] = true; + /** 3.5. If attribute namespace is not null, then run these sub-steps: */ + /** + * 3.6. Append a " " (U+0020 SPACE) to result. + * 3.7. If candidate prefix is not null, then append to result the + * concatenation of candidate prefix with ":" (U+003A COLON). + */ + /** + * 3.8. If the require well-formed flag is set (its value is true), and + * this attr's localName attribute contains the character + * ":" (U+003A COLON) or does not match the XML Name production or + * equals "xmlns" and attribute namespace is null, then throw an + * exception; the serialization of this attr would not be a + * well-formed attribute. + */ + if (requireWellFormed && (attr.localName.indexOf(":") !== -1 || + !(0, algorithm_1.xml_isName)(attr.localName))) { + throw new Error("Attribute local name contains invalid characters (well-formed required)."); + } + /** + * 3.9. Append the following strings to result, in the order listed: + * 3.9.1. The value of attr's localName; + * 3.9.2. "="" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK); + * 3.9.3. The result of serializing an attribute value given attr's value + * attribute and the require well-formed flag as input; + * 3.9.4. """ (U+0022 QUOTATION MARK). + */ + result.push([null, null, attr.localName, + this._serializeAttributeValue(attr.value, requireWellFormed)]); + } + /** + * 4. Return the value of result. + */ + return result; + } + /** + * Records namespace information for the given element and returns the + * default namespace attribute value. + * + * @param node - element node to process + * @param map - namespace prefix map + * @param localPrefixesMap - local prefixes map + */ + _recordNamespaceInformation(node, map, localPrefixesMap) { + /** + * 1. Let default namespace attr value be null. + */ + let defaultNamespaceAttrValue = null; + /** + * 2. Main: For each attribute attr in element's attributes, in the order + * they are specified in the element's attribute list: + */ + for (const attr of node.attributes) { + /** + * _Note:_ The following conditional steps find namespace prefixes. Only + * attributes in the XMLNS namespace are considered (e.g., attributes made + * to look like namespace declarations via + * setAttribute("xmlns:pretend-prefix", "pretend-namespace") are not + * included). + */ + /** 2.1. Let attribute namespace be the value of attr's namespaceURI value. */ + let attributeNamespace = attr.namespaceURI; + /** 2.2. Let attribute prefix be the value of attr's prefix. */ + let attributePrefix = attr.prefix; + /** 2.3. If the attribute namespace is the XMLNS namespace, then: */ + if (attributeNamespace === infra_1.namespace.XMLNS) { + /** + * 2.3.1. If attribute prefix is null, then attr is a default namespace + * declaration. Set the default namespace attr value to attr's value and + * stop running these steps, returning to Main to visit the next + * attribute. + */ + if (attributePrefix === null) { + defaultNamespaceAttrValue = attr.value; + continue; + /** + * 2.3.2. Otherwise, the attribute prefix is not null and attr is a + * namespace prefix definition. Run the following steps: + */ + } + else { + /** 2.3.2.1. Let prefix definition be the value of attr's localName. */ + let prefixDefinition = attr.localName; + /** 2.3.2.2. Let namespace definition be the value of attr's value. */ + let namespaceDefinition = attr.value; + /** + * 2.3.2.3. If namespace definition is the XML namespace, then stop + * running these steps, and return to Main to visit the next + * attribute. + * + * _Note:_ XML namespace definitions in prefixes are completely + * ignored (in order to avoid unnecessary work when there might be + * prefix conflicts). XML namespaced elements are always handled + * uniformly by prefixing (and overriding if necessary) the element's + * localname with the reserved "xml" prefix. + */ + if (namespaceDefinition === infra_1.namespace.XML) { + continue; + } + /** + * 2.3.2.4. If namespace definition is the empty string (the + * declarative form of having no namespace), then let namespace + * definition be null instead. + */ + if (namespaceDefinition === '') { + namespaceDefinition = null; + } + /** + * 2.3.2.5. If prefix definition is found in map given the namespace + * namespace definition, then stop running these steps, and return to + * Main to visit the next attribute. + * + * _Note:_ This step avoids adding duplicate prefix definitions for + * the same namespace in the map. This has the side-effect of avoiding + * later serialization of duplicate namespace prefix declarations in + * any descendant nodes. + */ + if (map.has(prefixDefinition, namespaceDefinition)) { + continue; + } + /** + * 2.3.2.6. Add the prefix prefix definition to map given namespace + * namespace definition. + */ + map.set(prefixDefinition, namespaceDefinition); + /** + * 2.3.2.7. Add the value of prefix definition as a new key to the + * local prefixes map, with the namespace definition as the key's + * value replacing the value of null with the empty string if + * applicable. + */ + localPrefixesMap[prefixDefinition] = namespaceDefinition || ''; + } } - return next(request); - }, - }; + } + /** + * 3. Return the value of default namespace attr value. + * + * _Note:_ The empty string is a legitimate return value and is not + * converted to null. + */ + return defaultNamespaceAttrValue; + } + /** + * Generates a new prefix for the given namespace. + * + * @param newNamespace - a namespace to generate prefix for + * @param prefixMap - namespace prefix map + * @param prefixIndex - generated namespace prefix index + */ + _generatePrefix(newNamespace, prefixMap, prefixIndex) { + /** + * 1. Let generated prefix be the concatenation of the string "ns" and the + * current numerical value of prefix index. + * 2. Let the value of prefix index be incremented by one. + * 3. Add to map the generated prefix given the new namespace namespace. + * 4. Return the value of generated prefix. + */ + const generatedPrefix = "ns" + prefixIndex.value.toString(); + prefixIndex.value++; + prefixMap.set(generatedPrefix, newNamespace); + return generatedPrefix; + } + /** + * Produces an XML serialization of an attribute value. + * + * @param value - attribute value + * @param requireWellFormed - whether to check conformance + */ + _serializeAttributeValue(value, requireWellFormed) { + /** + * From: https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value + * + * 1. If the require well-formed flag is set (its value is true), and + * attribute value contains characters that are not matched by the XML Char + * production, then throw an exception; the serialization of this attribute + * value would fail to produce a well-formed element serialization. + */ + if (requireWellFormed && value !== null && !(0, algorithm_1.xml_isLegalChar)(value)) { + throw new Error("Invalid characters in attribute value."); + } + /** + * 2. If attribute value is null, then return the empty string. + */ + if (value === null) + return ""; + /** + * 3. Otherwise, attribute value is a string. Return the value of attribute + * value, first replacing any occurrences of the following: + * - "&" with "&" + * - """ with """ + * - "<" with "<" + * - ">" with ">" + * NOTE + * This matches behavior present in browsers, and goes above and beyond the + * grammar requirement in the XML specification's AttValue production by + * also replacing ">" characters. + */ + return value.replace(constants_1.nonEntityAmpersandRegex, '&') + .replace(//g, '>') + .replace(/"/g, '"'); + } } -//# sourceMappingURL=userAgentPolicy.js.map +exports.BaseWriter = BaseWriter; +//# sourceMappingURL=BaseWriter.js.map /***/ }), -/***/ 42858: +/***/ 3198: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RestError = void 0; -exports.isRestError = isRestError; -const error_js_1 = __nccwpck_require__(13742); -const inspect_js_1 = __nccwpck_require__(52728); -const sanitizer_js_1 = __nccwpck_require__(61416); -const errorSanitizer = new sanitizer_js_1.Sanitizer(); +exports.JSONCBWriter = void 0; +const BaseCBWriter_1 = __nccwpck_require__(63210); /** - * A custom error type for failed pipeline requests. + * Serializes XML nodes. */ -class RestError extends Error { +class JSONCBWriter extends BaseCBWriter_1.BaseCBWriter { + _hasChildren = []; + _additionalLevel = 0; /** - * Something went wrong when making the request. - * This means the actual request failed for some reason, - * such as a DNS issue or the connection being lost. + * Initializes a new instance of `JSONCBWriter`. + * + * @param builderOptions - XML builder options */ - static REQUEST_SEND_ERROR = "REQUEST_SEND_ERROR"; + constructor(builderOptions) { + super(builderOptions); + } + /** @inheritdoc */ + frontMatter() { + return ""; + } + /** @inheritdoc */ + declaration(version, encoding, standalone) { + return ""; + } + /** @inheritdoc */ + docType(name, publicId, systemId) { + return ""; + } + /** @inheritdoc */ + comment(data) { + // { "!": "hello" } + return this._comma() + this._beginLine() + "{" + this._sep() + + this._key(this._builderOptions.convert.comment) + this._sep() + + this._val(data) + this._sep() + "}"; + } + /** @inheritdoc */ + text(data) { + // { "#": "hello" } + return this._comma() + this._beginLine() + "{" + this._sep() + + this._key(this._builderOptions.convert.text) + this._sep() + + this._val(data) + this._sep() + "}"; + } + /** @inheritdoc */ + instruction(target, data) { + // { "?": "target hello" } + return this._comma() + this._beginLine() + "{" + this._sep() + + this._key(this._builderOptions.convert.ins) + this._sep() + + this._val(data ? target + " " + data : target) + this._sep() + "}"; + } + /** @inheritdoc */ + cdata(data) { + // { "$": "hello" } + return this._comma() + this._beginLine() + "{" + this._sep() + + this._key(this._builderOptions.convert.cdata) + this._sep() + + this._val(data) + this._sep() + "}"; + } + /** @inheritdoc */ + attribute(name, value) { + // { "@name": "val" } + return this._comma() + this._beginLine(1) + "{" + this._sep() + + this._key(this._builderOptions.convert.att + name) + this._sep() + + this._val(value) + this._sep() + "}"; + } + /** @inheritdoc */ + openTagBegin(name) { + // { "node": { "#": [ + let str = this._comma() + this._beginLine() + "{" + this._sep() + this._key(name) + this._sep() + "{"; + this._additionalLevel++; + this.hasData = true; + str += this._beginLine() + this._key(this._builderOptions.convert.text) + this._sep() + "["; + this._hasChildren.push(false); + return str; + } + /** @inheritdoc */ + openTagEnd(name, selfClosing, voidElement) { + if (selfClosing) { + let str = this._sep() + "]"; + this._additionalLevel--; + str += this._beginLine() + "}" + this._sep() + "}"; + return str; + } + else { + return ""; + } + } + /** @inheritdoc */ + closeTag(name) { + // ] } } + let str = this._beginLine() + "]"; + this._additionalLevel--; + str += this._beginLine() + "}" + this._sep() + "}"; + return str; + } + /** @inheritdoc */ + beginElement(name) { } + /** @inheritdoc */ + endElement(name) { this._hasChildren.pop(); } /** - * This means that parsing the response from the server failed. - * It may have been malformed. + * Produces characters to be prepended to a line of string in pretty-print + * mode. */ - static PARSE_ERROR = "PARSE_ERROR"; + _beginLine(additionalOffset = 0) { + if (this._writerOptions.prettyPrint) { + return (this.hasData ? this._writerOptions.newline : "") + + this._indent(this._writerOptions.offset + this.level + additionalOffset); + } + else { + return ""; + } + } /** - * The code of the error itself (use statics on RestError if possible.) + * Produces an indentation string. + * + * @param level - depth of the tree */ - code; + _indent(level) { + if (level + this._additionalLevel <= 0) { + return ""; + } + else { + return this._writerOptions.indent.repeat(level + this._additionalLevel); + } + } /** - * The HTTP status code of the request (if applicable.) + * Produces a comma before a child node if it has previous siblings. */ - statusCode; + _comma() { + const str = (this._hasChildren[this._hasChildren.length - 1] ? "," : ""); + if (this._hasChildren.length > 0) { + this._hasChildren[this._hasChildren.length - 1] = true; + } + return str; + } /** - * The request that was made. - * This property is non-enumerable. + * Produces a separator string. */ - request; + _sep() { + return (this._writerOptions.prettyPrint ? " " : ""); + } /** - * The response received (if any.) - * This property is non-enumerable. + * Produces a JSON key string delimited with double quotes. */ - response; + _key(key) { + return "\"" + key + "\":"; + } /** - * Bonus property set by the throw site. + * Produces a JSON value string delimited with double quotes. */ - details; - constructor(message, options = {}) { - super(message); - this.name = "RestError"; - this.code = options.code; - this.statusCode = options.statusCode; - // The request and response may contain sensitive information in the headers or body. - // To help prevent this sensitive information being accidentally logged, the request and response - // properties are marked as non-enumerable here. This prevents them showing up in the output of - // JSON.stringify and console.log. - Object.defineProperty(this, "request", { value: options.request, enumerable: false }); - Object.defineProperty(this, "response", { value: options.response, enumerable: false }); - // Only include useful agent information in the request for logging, as the full agent object - // may contain large binary data. - const agent = this.request?.agent - ? { - maxFreeSockets: this.request.agent.maxFreeSockets, - maxSockets: this.request.agent.maxSockets, - } - : undefined; - // Logging method for util.inspect in Node - Object.defineProperty(this, inspect_js_1.custom, { - value: () => { - // Extract non-enumerable properties and add them back. This is OK since in this output the request and - // response get sanitized. - return `RestError: ${this.message} \n ${errorSanitizer.sanitize({ - ...this, - request: { ...this.request, agent }, - response: this.response, - })}`; - }, - enumerable: false, - }); - Object.setPrototypeOf(this, RestError.prototype); - } -} -exports.RestError = RestError; -/** - * Typeguard for RestError - * @param e - Something caught by a catch clause. - */ -function isRestError(e) { - if (e instanceof RestError) { - return true; + _val(val) { + return JSON.stringify(val); } - return (0, error_js_1.isError)(e) && e.name === "RestError"; } -//# sourceMappingURL=restError.js.map +exports.JSONCBWriter = JSONCBWriter; +//# sourceMappingURL=JSONCBWriter.js.map /***/ }), -/***/ 12283: +/***/ 53775: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.exponentialRetryStrategy = exponentialRetryStrategy; -exports.isExponentialRetryResponse = isExponentialRetryResponse; -exports.isSystemError = isSystemError; -const delay_js_1 = __nccwpck_require__(34591); -const throttlingRetryStrategy_js_1 = __nccwpck_require__(90483); -// intervals are in milliseconds -const DEFAULT_CLIENT_RETRY_INTERVAL = 1000; -const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1000 * 64; +exports.JSONWriter = void 0; +const ObjectWriter_1 = __nccwpck_require__(24393); +const util_1 = __nccwpck_require__(76195); +const BaseWriter_1 = __nccwpck_require__(24189); /** - * A retry strategy that retries with an exponentially increasing delay in these two cases: - * - When there are errors in the underlying transport layer (e.g. DNS lookup failures). - * - Or otherwise if the outgoing request fails (408, greater or equal than 500, except for 501 and 505). + * Serializes XML nodes into a JSON string. */ -function exponentialRetryStrategy(options = {}) { - const retryInterval = options.retryDelayInMs ?? DEFAULT_CLIENT_RETRY_INTERVAL; - const maxRetryInterval = options.maxRetryDelayInMs ?? DEFAULT_CLIENT_MAX_RETRY_INTERVAL; - return { - name: "exponentialRetryStrategy", - retry({ retryCount, response, responseError }) { - const matchedSystemError = isSystemError(responseError); - const ignoreSystemErrors = matchedSystemError && options.ignoreSystemErrors; - const isExponential = isExponentialRetryResponse(response); - const ignoreExponentialResponse = isExponential && options.ignoreHttpStatusCodes; - const unknownResponse = response && ((0, throttlingRetryStrategy_js_1.isThrottlingRetryResponse)(response) || !isExponential); - if (unknownResponse || ignoreExponentialResponse || ignoreSystemErrors) { - return { skipStrategy: true }; +class JSONWriter extends BaseWriter_1.BaseWriter { + /** + * Initializes a new instance of `JSONWriter`. + * + * @param builderOptions - XML builder options + * @param writerOptions - serialization options + */ + constructor(builderOptions, writerOptions) { + super(builderOptions); + // provide default options + this._writerOptions = (0, util_1.applyDefaults)(writerOptions, { + wellFormed: false, + prettyPrint: false, + indent: ' ', + newline: '\n', + offset: 0, + group: false, + verbose: false + }); + } + /** + * Produces an XML serialization of the given node. + * + * @param node - node to serialize + * @param writerOptions - serialization options + */ + serialize(node) { + // convert to object + const objectWriterOptions = (0, util_1.applyDefaults)(this._writerOptions, { + format: "object", + wellFormed: false + }); + const objectWriter = new ObjectWriter_1.ObjectWriter(this._builderOptions, objectWriterOptions); + const val = objectWriter.serialize(node); + // recursively convert object into JSON string + return this._beginLine(this._writerOptions, 0) + this._convertObject(val, this._writerOptions); + } + /** + * Produces an XML serialization of the given object. + * + * @param obj - object to serialize + * @param options - serialization options + * @param level - depth of the XML tree + */ + _convertObject(obj, options, level = 0) { + let markup = ''; + const isLeaf = this._isLeafNode(obj); + if ((0, util_1.isArray)(obj)) { + markup += '['; + const len = obj.length; + let i = 0; + for (const val of obj) { + markup += this._endLine(options, level + 1) + + this._beginLine(options, level + 1) + + this._convertObject(val, options, level + 1); + if (i < len - 1) { + markup += ','; + } + i++; } - if (responseError && !matchedSystemError && !isExponential) { - return { errorToThrow: responseError }; + markup += this._endLine(options, level) + this._beginLine(options, level); + markup += ']'; + } + else if ((0, util_1.isObject)(obj)) { + markup += '{'; + const len = (0, util_1.objectLength)(obj); + let i = 0; + (0, util_1.forEachObject)(obj, (key, val) => { + if (isLeaf && options.prettyPrint) { + markup += ' '; + } + else { + markup += this._endLine(options, level + 1) + this._beginLine(options, level + 1); + } + markup += this._key(key); + if (options.prettyPrint) { + markup += ' '; + } + markup += this._convertObject(val, options, level + 1); + if (i < len - 1) { + markup += ','; + } + i++; + }, this); + if (isLeaf && options.prettyPrint) { + markup += ' '; } - return (0, delay_js_1.calculateRetryDelay)(retryCount, { - retryDelayInMs: retryInterval, - maxRetryDelayInMs: maxRetryInterval, - }); - }, - }; -} -/** - * A response is a retry response if it has status codes: - * - 408, or - * - Greater or equal than 500, except for 501 and 505. - */ -function isExponentialRetryResponse(response) { - return Boolean(response && - response.status !== undefined && - (response.status >= 500 || response.status === 408) && - response.status !== 501 && - response.status !== 505); -} -/** - * Determines whether an error from a pipeline response was triggered in the network layer. - */ -function isSystemError(err) { - if (!err) { - return false; + else { + markup += this._endLine(options, level) + this._beginLine(options, level); + } + markup += '}'; + } + else { + markup += this._val(obj); + } + return markup; } - return (err.code === "ETIMEDOUT" || - err.code === "ESOCKETTIMEDOUT" || - err.code === "ECONNREFUSED" || - err.code === "ECONNRESET" || - err.code === "ENOENT" || - err.code === "ENOTFOUND"); -} -//# sourceMappingURL=exponentialRetryStrategy.js.map - -/***/ }), - -/***/ 90483: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isThrottlingRetryResponse = isThrottlingRetryResponse; -exports.throttlingRetryStrategy = throttlingRetryStrategy; -const helpers_js_1 = __nccwpck_require__(59842); -/** - * The header that comes back from services representing - * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry). - */ -const RetryAfterHeader = "Retry-After"; -/** - * The headers that come back from services representing - * the amount of time (minimum) to wait to retry. - * - * "retry-after-ms", "x-ms-retry-after-ms" : milliseconds - * "Retry-After" : seconds or timestamp - */ -const AllRetryAfterHeaders = ["retry-after-ms", "x-ms-retry-after-ms", RetryAfterHeader]; -/** - * A response is a throttling retry response if it has a throttling status code (429 or 503), - * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value. - * - * Returns the `retryAfterInMs` value if the response is a throttling retry response. - * If not throttling retry response, returns `undefined`. - * - * @internal - */ -function getRetryAfterInMs(response) { - if (!(response && [429, 503].includes(response.status))) - return undefined; - try { - // Headers: "retry-after-ms", "x-ms-retry-after-ms", "Retry-After" - for (const header of AllRetryAfterHeaders) { - const retryAfterValue = (0, helpers_js_1.parseHeaderValueAsNumber)(response, header); - if (retryAfterValue === 0 || retryAfterValue) { - // "Retry-After" header ==> seconds - // "retry-after-ms", "x-ms-retry-after-ms" headers ==> milli-seconds - const multiplyingFactor = header === RetryAfterHeader ? 1000 : 1; - return retryAfterValue * multiplyingFactor; // in milli-seconds + /** + * Produces characters to be prepended to a line of string in pretty-print + * mode. + * + * @param options - serialization options + * @param level - current depth of the XML tree + */ + _beginLine(options, level) { + if (!options.prettyPrint) { + return ''; + } + else { + const indentLevel = options.offset + level + 1; + if (indentLevel > 0) { + return new Array(indentLevel).join(options.indent); } } - // RetryAfterHeader ("Retry-After") has a special case where it might be formatted as a date instead of a number of seconds - const retryAfterHeader = response.headers.get(RetryAfterHeader); - if (!retryAfterHeader) - return; - const date = Date.parse(retryAfterHeader); - const diff = date - Date.now(); - // negative diff would mean a date in the past, so retry asap with 0 milliseconds - return Number.isFinite(diff) ? Math.max(0, diff) : undefined; + return ''; + } + /** + * Produces characters to be appended to a line of string in pretty-print + * mode. + * + * @param options - serialization options + * @param level - current depth of the XML tree + */ + _endLine(options, level) { + if (!options.prettyPrint) { + return ''; + } + else { + return options.newline; + } + } + /** + * Produces a JSON key string delimited with double quotes. + */ + _key(key) { + return "\"" + key + "\":"; + } + /** + * Produces a JSON value string delimited with double quotes. + */ + _val(val) { + return JSON.stringify(val); } - catch { - return undefined; + /** + * Determines if an object is a leaf node. + * + * @param obj + */ + _isLeafNode(obj) { + return this._descendantCount(obj) <= 1; + } + /** + * Counts the number of descendants of the given object. + * + * @param obj + * @param count + */ + _descendantCount(obj, count = 0) { + if ((0, util_1.isArray)(obj)) { + (0, util_1.forEachArray)(obj, val => count += this._descendantCount(val, count), this); + } + else if ((0, util_1.isObject)(obj)) { + (0, util_1.forEachObject)(obj, (key, val) => count += this._descendantCount(val, count), this); + } + else { + count++; + } + return count; } } -/** - * A response is a retry response if it has a throttling status code (429 or 503), - * as long as one of the [ "Retry-After" or "retry-after-ms" or "x-ms-retry-after-ms" ] headers has a valid value. - */ -function isThrottlingRetryResponse(response) { - return Number.isFinite(getRetryAfterInMs(response)); -} -function throttlingRetryStrategy() { - return { - name: "throttlingRetryStrategy", - retry({ response }) { - const retryAfterInMs = getRetryAfterInMs(response); - if (!Number.isFinite(retryAfterInMs)) { - return { skipStrategy: true }; - } - return { - retryAfterInMs, - }; - }, - }; -} -//# sourceMappingURL=throttlingRetryStrategy.js.map +exports.JSONWriter = JSONWriter; +//# sourceMappingURL=JSONWriter.js.map /***/ }), -/***/ 88943: -/***/ ((__unused_webpack_module, exports) => { +/***/ 99675: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.uint8ArrayToString = uint8ArrayToString; -exports.stringToUint8Array = stringToUint8Array; -/** - * The helper that transforms bytes with specific character encoding into string - * @param bytes - the uint8array bytes - * @param format - the format we use to encode the byte - * @returns a string of the encoded string - */ -function uint8ArrayToString(bytes, format) { - return Buffer.from(bytes).toString(format); -} +exports.MapWriter = void 0; +const util_1 = __nccwpck_require__(76195); +const ObjectWriter_1 = __nccwpck_require__(24393); +const BaseWriter_1 = __nccwpck_require__(24189); /** - * The helper that transforms string to specific character encoded bytes array. - * @param value - the string to be converted - * @param format - the format we use to decode the value - * @returns a uint8array + * Serializes XML nodes into ES6 maps and arrays. */ -function stringToUint8Array(value, format) { - return Buffer.from(value, format); +class MapWriter extends BaseWriter_1.BaseWriter { + /** + * Initializes a new instance of `MapWriter`. + * + * @param builderOptions - XML builder options + * @param writerOptions - serialization options + */ + constructor(builderOptions, writerOptions) { + super(builderOptions); + // provide default options + this._writerOptions = (0, util_1.applyDefaults)(writerOptions, { + format: "map", + wellFormed: false, + group: false, + verbose: false + }); + } + /** + * Produces an XML serialization of the given node. + * + * @param node - node to serialize + */ + serialize(node) { + // convert to object + const objectWriterOptions = (0, util_1.applyDefaults)(this._writerOptions, { + format: "object", + wellFormed: false, + verbose: false + }); + const objectWriter = new ObjectWriter_1.ObjectWriter(this._builderOptions, objectWriterOptions); + const val = objectWriter.serialize(node); + // recursively convert object into Map + return this._convertObject(val); + } + /** + * Recursively converts a JS object into an ES5 map. + * + * @param obj - a JS object + */ + _convertObject(obj) { + if ((0, util_1.isArray)(obj)) { + for (let i = 0; i < obj.length; i++) { + obj[i] = this._convertObject(obj[i]); + } + return obj; + } + else if ((0, util_1.isObject)(obj)) { + const map = new Map(); + for (const key in obj) { + map.set(key, this._convertObject(obj[key])); + } + return map; + } + else { + return obj; + } + } } -//# sourceMappingURL=bytesEncoding.js.map +exports.MapWriter = MapWriter; +//# sourceMappingURL=MapWriter.js.map /***/ }), -/***/ 94121: -/***/ ((__unused_webpack_module, exports) => { +/***/ 24393: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isReactNative = exports.isNodeRuntime = exports.isNodeLike = exports.isBun = exports.isDeno = exports.isWebWorker = exports.isBrowser = void 0; -/** - * A constant that indicates whether the environment the code is running is a Web Browser. - */ -// eslint-disable-next-line @azure/azure-sdk/ts-no-window -exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is a Web Worker. - */ -exports.isWebWorker = typeof self === "object" && - typeof self?.importScripts === "function" && - (self.constructor?.name === "DedicatedWorkerGlobalScope" || - self.constructor?.name === "ServiceWorkerGlobalScope" || - self.constructor?.name === "SharedWorkerGlobalScope"); -/** - * A constant that indicates whether the environment the code is running is Deno. - */ -exports.isDeno = typeof Deno !== "undefined" && - typeof Deno.version !== "undefined" && - typeof Deno.version.deno !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is Bun.sh. - */ -exports.isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is a Node.js compatible environment. - */ -exports.isNodeLike = typeof globalThis.process !== "undefined" && - Boolean(globalThis.process.version) && - Boolean(globalThis.process.versions?.node); -/** - * A constant that indicates whether the environment the code is running is Node.JS. - */ -exports.isNodeRuntime = exports.isNodeLike && !exports.isBun && !exports.isDeno; +exports.ObjectWriter = void 0; +const util_1 = __nccwpck_require__(76195); +const interfaces_1 = __nccwpck_require__(27305); +const BaseWriter_1 = __nccwpck_require__(24189); /** - * A constant that indicates whether the environment the code is running is in React-Native. + * Serializes XML nodes into objects and arrays. */ -// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js -exports.isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; -//# sourceMappingURL=checkEnvironment.js.map - -/***/ }), - -/***/ 96494: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.concat = concat; -const stream_1 = __nccwpck_require__(12781); -const typeGuards_js_1 = __nccwpck_require__(61580); -async function* streamAsyncIterator() { - const reader = this.getReader(); - try { - while (true) { - const { done, value } = await reader.read(); - if (done) { - return; +class ObjectWriter extends BaseWriter_1.BaseWriter { + _currentList; + _currentIndex; + _listRegister; + /** + * Initializes a new instance of `ObjectWriter`. + * + * @param builderOptions - XML builder options + * @param writerOptions - serialization options + */ + constructor(builderOptions, writerOptions) { + super(builderOptions); + this._writerOptions = (0, util_1.applyDefaults)(writerOptions, { + format: "object", + wellFormed: false, + group: false, + verbose: false + }); + } + /** + * Produces an XML serialization of the given node. + * + * @param node - node to serialize + */ + serialize(node) { + this._currentList = []; + this._currentIndex = 0; + this._listRegister = [this._currentList]; + /** + * First pass, serialize nodes + * This creates a list of nodes grouped under node types while preserving + * insertion order. For example: + * [ + * root: [ + * node: [ + * { "@" : { "att1": "val1", "att2": "val2" } + * { "#": "node text" } + * { childNode: [] } + * { "#": "more text" } + * ], + * node: [ + * { "@" : { "att": "val" } + * { "#": [ "text line1", "text line2" ] } + * ] + * ] + * ] + */ + this.serializeNode(node, this._writerOptions.wellFormed); + /** + * Second pass, process node lists. Above example becomes: + * { + * root: { + * node: [ + * { + * "@att1": "val1", + * "@att2": "val2", + * "#1": "node text", + * childNode: {}, + * "#2": "more text" + * }, + * { + * "@att": "val", + * "#": [ "text line1", "text line2" ] + * } + * ] + * } + * } + */ + return this._process(this._currentList, this._writerOptions); + } + _process(items, options) { + if (items.length === 0) + return {}; + // determine if there are non-unique element names + const namesSeen = {}; + let hasNonUniqueNames = false; + let textCount = 0; + let commentCount = 0; + let instructionCount = 0; + let cdataCount = 0; + for (let i = 0; i < items.length; i++) { + const item = items[i]; + const key = Object.keys(item)[0]; + switch (key) { + case "@": + continue; + case "#": + textCount++; + break; + case "!": + commentCount++; + break; + case "?": + instructionCount++; + break; + case "$": + cdataCount++; + break; + default: + if (namesSeen[key]) { + hasNonUniqueNames = true; + } + else { + namesSeen[key] = true; + } + break; } - yield value; + } + const defAttrKey = this._getAttrKey(); + const defTextKey = this._getNodeKey(interfaces_1.NodeType.Text); + const defCommentKey = this._getNodeKey(interfaces_1.NodeType.Comment); + const defInstructionKey = this._getNodeKey(interfaces_1.NodeType.ProcessingInstruction); + const defCdataKey = this._getNodeKey(interfaces_1.NodeType.CData); + if (textCount === 1 && items.length === 1 && (0, util_1.isString)(items[0]["#"])) { + // special case of an element node with a single text node + return items[0]["#"]; + } + else if (hasNonUniqueNames) { + const obj = {}; + // process attributes first + for (let i = 0; i < items.length; i++) { + const item = items[i]; + const key = Object.keys(item)[0]; + if (key === "@") { + const attrs = item["@"]; + const attrKeys = Object.keys(attrs); + if (!options.group || attrKeys.length === 1) { + for (const attrName in attrs) { + obj[defAttrKey + attrName] = attrs[attrName]; + } + } + else { + obj[defAttrKey] = attrs; + } + } + } + // list contains element nodes with non-unique names + // return an array with mixed content notation + const result = []; + for (let i = 0; i < items.length; i++) { + const item = items[i]; + const key = Object.keys(item)[0]; + switch (key) { + case "@": + // attributes were processed above + break; + case "#": + result.push({ [defTextKey]: item["#"] }); + break; + case "!": + result.push({ [defCommentKey]: item["!"] }); + break; + case "?": + result.push({ [defInstructionKey]: item["?"] }); + break; + case "$": + result.push({ [defCdataKey]: item["$"] }); + break; + default: + // element node + const ele = item; + if (ele[key].length !== 0 && (0, util_1.isArray)(ele[key][0])) { + // group of element nodes + const eleGroup = []; + const listOfLists = ele[key]; + for (let i = 0; i < listOfLists.length; i++) { + eleGroup.push(this._process(listOfLists[i], options)); + } + result.push({ [key]: eleGroup }); + } + else { + // single element node + if (options.verbose) { + result.push({ [key]: [this._process(ele[key], options)] }); + } + else { + result.push({ [key]: this._process(ele[key], options) }); + } + } + break; + } + } + obj[defTextKey] = result; + return obj; + } + else { + // all element nodes have unique names + // return an object while prefixing data node keys + let textId = 1; + let commentId = 1; + let instructionId = 1; + let cdataId = 1; + const obj = {}; + for (let i = 0; i < items.length; i++) { + const item = items[i]; + const key = Object.keys(item)[0]; + switch (key) { + case "@": + const attrs = item["@"]; + const attrKeys = Object.keys(attrs); + if (!options.group || attrKeys.length === 1) { + for (const attrName in attrs) { + obj[defAttrKey + attrName] = attrs[attrName]; + } + } + else { + obj[defAttrKey] = attrs; + } + break; + case "#": + textId = this._processSpecItem(item["#"], obj, options.group, defTextKey, textCount, textId); + break; + case "!": + commentId = this._processSpecItem(item["!"], obj, options.group, defCommentKey, commentCount, commentId); + break; + case "?": + instructionId = this._processSpecItem(item["?"], obj, options.group, defInstructionKey, instructionCount, instructionId); + break; + case "$": + cdataId = this._processSpecItem(item["$"], obj, options.group, defCdataKey, cdataCount, cdataId); + break; + default: + // element node + const ele = item; + if (ele[key].length !== 0 && (0, util_1.isArray)(ele[key][0])) { + // group of element nodes + const eleGroup = []; + const listOfLists = ele[key]; + for (let i = 0; i < listOfLists.length; i++) { + eleGroup.push(this._process(listOfLists[i], options)); + } + obj[key] = eleGroup; + } + else { + // single element node + if (options.verbose) { + obj[key] = [this._process(ele[key], options)]; + } + else { + obj[key] = this._process(ele[key], options); + } + } + break; + } + } + return obj; } } - finally { - reader.releaseLock(); + _processSpecItem(item, obj, group, defKey, count, id) { + if (!group && (0, util_1.isArray)(item) && count + item.length > 2) { + for (const subItem of item) { + const key = defKey + (id++).toString(); + obj[key] = subItem; + } + } + else { + const key = count > 1 ? defKey + (id++).toString() : defKey; + obj[key] = item; + } + return id; } -} -function makeAsyncIterable(webStream) { - if (!webStream[Symbol.asyncIterator]) { - webStream[Symbol.asyncIterator] = streamAsyncIterator.bind(webStream); + /** @inheritdoc */ + beginElement(name) { + const childItems = []; + if (this._currentList.length === 0) { + this._currentList.push({ [name]: childItems }); + } + else { + const lastItem = this._currentList[this._currentList.length - 1]; + if (this._isElementNode(lastItem, name)) { + if (lastItem[name].length !== 0 && (0, util_1.isArray)(lastItem[name][0])) { + const listOfLists = lastItem[name]; + listOfLists.push(childItems); + } + else { + lastItem[name] = [lastItem[name], childItems]; + } + } + else { + this._currentList.push({ [name]: childItems }); + } + } + this._currentIndex++; + if (this._listRegister.length > this._currentIndex) { + this._listRegister[this._currentIndex] = childItems; + } + else { + this._listRegister.push(childItems); + } + this._currentList = childItems; } - if (!webStream.values) { - webStream.values = streamAsyncIterator.bind(webStream); + /** @inheritdoc */ + endElement() { + this._currentList = this._listRegister[--this._currentIndex]; } -} -function ensureNodeStream(stream) { - if (stream instanceof ReadableStream) { - makeAsyncIterable(stream); - return stream_1.Readable.fromWeb(stream); + /** @inheritdoc */ + attribute(name, value) { + if (this._currentList.length === 0) { + this._currentList.push({ "@": { [name]: value } }); + } + else { + const lastItem = this._currentList[this._currentList.length - 1]; + /* istanbul ignore else */ + if (this._isAttrNode(lastItem)) { + lastItem["@"][name] = value; + } + else { + this._currentList.push({ "@": { [name]: value } }); + } + } } - else { - return stream; + /** @inheritdoc */ + comment(data) { + if (this._currentList.length === 0) { + this._currentList.push({ "!": data }); + } + else { + const lastItem = this._currentList[this._currentList.length - 1]; + if (this._isCommentNode(lastItem)) { + if ((0, util_1.isArray)(lastItem["!"])) { + lastItem["!"].push(data); + } + else { + lastItem["!"] = [lastItem["!"], data]; + } + } + else { + this._currentList.push({ "!": data }); + } + } } -} -function toStream(source) { - if (source instanceof Uint8Array) { - return stream_1.Readable.from(Buffer.from(source)); + /** @inheritdoc */ + text(data) { + if (this._currentList.length === 0) { + this._currentList.push({ "#": data }); + } + else { + const lastItem = this._currentList[this._currentList.length - 1]; + if (this._isTextNode(lastItem)) { + if ((0, util_1.isArray)(lastItem["#"])) { + lastItem["#"].push(data); + } + else { + lastItem["#"] = [lastItem["#"], data]; + } + } + else { + this._currentList.push({ "#": data }); + } + } } - else if ((0, typeGuards_js_1.isBlob)(source)) { - return ensureNodeStream(source.stream()); + /** @inheritdoc */ + instruction(target, data) { + const value = (data === "" ? target : target + " " + data); + if (this._currentList.length === 0) { + this._currentList.push({ "?": value }); + } + else { + const lastItem = this._currentList[this._currentList.length - 1]; + if (this._isInstructionNode(lastItem)) { + if ((0, util_1.isArray)(lastItem["?"])) { + lastItem["?"].push(value); + } + else { + lastItem["?"] = [lastItem["?"], value]; + } + } + else { + this._currentList.push({ "?": value }); + } + } } - else { - return ensureNodeStream(source); + /** @inheritdoc */ + cdata(data) { + if (this._currentList.length === 0) { + this._currentList.push({ "$": data }); + } + else { + const lastItem = this._currentList[this._currentList.length - 1]; + if (this._isCDATANode(lastItem)) { + if ((0, util_1.isArray)(lastItem["$"])) { + lastItem["$"].push(data); + } + else { + lastItem["$"] = [lastItem["$"], data]; + } + } + else { + this._currentList.push({ "$": data }); + } + } + } + _isAttrNode(x) { + return "@" in x; + } + _isTextNode(x) { + return "#" in x; + } + _isCommentNode(x) { + return "!" in x; + } + _isInstructionNode(x) { + return "?" in x; + } + _isCDATANode(x) { + return "$" in x; + } + _isElementNode(x, name) { + return name in x; + } + /** + * Returns an object key for an attribute or namespace declaration. + */ + _getAttrKey() { + return this._builderOptions.convert.att; + } + /** + * Returns an object key for the given node type. + * + * @param nodeType - node type to get a key for + */ + _getNodeKey(nodeType) { + switch (nodeType) { + case interfaces_1.NodeType.Comment: + return this._builderOptions.convert.comment; + case interfaces_1.NodeType.Text: + return this._builderOptions.convert.text; + case interfaces_1.NodeType.ProcessingInstruction: + return this._builderOptions.convert.ins; + case interfaces_1.NodeType.CData: + return this._builderOptions.convert.cdata; + /* istanbul ignore next */ + default: + throw new Error("Invalid node type."); + } } } -/** - * Utility function that concatenates a set of binary inputs into one combined output. - * - * @param sources - array of sources for the concatenation - * @returns - in Node, a (() =\> NodeJS.ReadableStream) which, when read, produces a concatenation of all the inputs. - * In browser, returns a `Blob` representing all the concatenated inputs. - * - * @internal - */ -async function concat(sources) { - return function () { - const streams = sources.map((x) => (typeof x === "function" ? x() : x)).map(toStream); - return stream_1.Readable.from((async function* () { - for (const stream of streams) { - for await (const chunk of stream) { - yield chunk; - } - } - })()); - }; -} -//# sourceMappingURL=concat.js.map - -/***/ }), - -/***/ 34591: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.calculateRetryDelay = calculateRetryDelay; -const random_js_1 = __nccwpck_require__(25042); -/** - * Calculates the delay interval for retry attempts using exponential delay with jitter. - * @param retryAttempt - The current retry attempt number. - * @param config - The exponential retry configuration. - * @returns An object containing the calculated retry delay. - */ -function calculateRetryDelay(retryAttempt, config) { - // Exponentially increase the delay each time - const exponentialDelay = config.retryDelayInMs * Math.pow(2, retryAttempt); - // Don't let the delay exceed the maximum - const clampedDelay = Math.min(config.maxRetryDelayInMs, exponentialDelay); - // Allow the final value to have some "jitter" (within 50% of the delay size) so - // that retries across multiple clients don't occur simultaneously. - const retryAfterInMs = clampedDelay / 2 + (0, random_js_1.getRandomIntegerInclusive)(0, clampedDelay / 2); - return { retryAfterInMs }; -} -//# sourceMappingURL=delay.js.map +exports.ObjectWriter = ObjectWriter; +//# sourceMappingURL=ObjectWriter.js.map /***/ }), -/***/ 13742: +/***/ 7299: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isError = isError; -const object_js_1 = __nccwpck_require__(7088); +exports.XMLCBWriter = void 0; +const BaseCBWriter_1 = __nccwpck_require__(63210); /** - * Typeguard for an error object shape (has name and message) - * @param e - Something caught by a catch clause. + * Serializes XML nodes. */ -function isError(e) { - if ((0, object_js_1.isObject)(e)) { - const hasName = typeof e.name === "string"; - const hasMessage = typeof e.message === "string"; - return hasName && hasMessage; +class XMLCBWriter extends BaseCBWriter_1.BaseCBWriter { + _lineLength = 0; + /** + * Initializes a new instance of `XMLCBWriter`. + * + * @param builderOptions - XML builder options + */ + constructor(builderOptions) { + super(builderOptions); } - return false; -} -//# sourceMappingURL=error.js.map - -/***/ }), - -/***/ 59842: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.delay = delay; -exports.parseHeaderValueAsNumber = parseHeaderValueAsNumber; -const AbortError_js_1 = __nccwpck_require__(72033); -const StandardAbortMessage = "The operation was aborted."; -/** - * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds. - * @param delayInMs - The number of milliseconds to be delayed. - * @param value - The value to be resolved with after a timeout of t milliseconds. - * @param options - The options for delay - currently abort options - * - abortSignal - The abortSignal associated with containing operation. - * - abortErrorMsg - The abort error message associated with containing operation. - * @returns Resolved promise - */ -function delay(delayInMs, value, options) { - return new Promise((resolve, reject) => { - let timer = undefined; - let onAborted = undefined; - const rejectOnAbort = () => { - return reject(new AbortError_js_1.AbortError(options?.abortErrorMsg ? options?.abortErrorMsg : StandardAbortMessage)); - }; - const removeListeners = () => { - if (options?.abortSignal && onAborted) { - options.abortSignal.removeEventListener("abort", onAborted); + /** @inheritdoc */ + frontMatter() { + return ""; + } + /** @inheritdoc */ + declaration(version, encoding, standalone) { + let markup = this._beginLine() + ""; + return markup; + } + /** @inheritdoc */ + docType(name, publicId, systemId) { + let markup = this._beginLine(); + if (publicId && systemId) { + markup += ""; + } + else if (publicId) { + markup += ""; + } + else if (systemId) { + markup += ""; + } + else { + markup += ""; + } + return markup; + } + /** @inheritdoc */ + comment(data) { + return this._beginLine() + ""; + } + /** @inheritdoc */ + text(data) { + return data; + } + /** @inheritdoc */ + instruction(target, data) { + if (data) { + return this._beginLine() + ""; + } + else { + return this._beginLine() + ""; + } + } + /** @inheritdoc */ + cdata(data) { + return this._beginLine() + ""; + } + /** @inheritdoc */ + openTagBegin(name) { + this._lineLength += 1 + name.length; + return this._beginLine() + "<" + name; + } + /** @inheritdoc */ + openTagEnd(name, selfClosing, voidElement) { + if (voidElement) { + return " />"; + } + else if (selfClosing) { + if (this._writerOptions.allowEmptyTags) { + return ">"; } - }; - onAborted = () => { - if (timer) { - clearTimeout(timer); + else if (this._writerOptions.spaceBeforeSlash) { + return " />"; + } + else { + return "/>"; } - removeListeners(); - return rejectOnAbort(); - }; - if (options?.abortSignal && options.abortSignal.aborted) { - return rejectOnAbort(); } - timer = setTimeout(() => { - removeListeners(); - resolve(value); - }, delayInMs); - if (options?.abortSignal) { - options.abortSignal.addEventListener("abort", onAborted); + else { + return ">"; } - }); -} -/** - * @internal - * @returns the parsed value or undefined if the parsed value is invalid. - */ -function parseHeaderValueAsNumber(response, headerName) { - const value = response.headers.get(headerName); - if (!value) - return; - const valueAsNum = Number(value); - if (Number.isNaN(valueAsNum)) - return; - return valueAsNum; -} -//# sourceMappingURL=helpers.js.map - -/***/ }), - -/***/ 52728: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.custom = void 0; -const node_util_1 = __nccwpck_require__(47261); -exports.custom = node_util_1.inspect.custom; -//# sourceMappingURL=inspect.js.map - -/***/ }), - -/***/ 68152: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Sanitizer = exports.uint8ArrayToString = exports.stringToUint8Array = exports.isWebWorker = exports.isReactNative = exports.isDeno = exports.isNodeRuntime = exports.isNodeLike = exports.isBun = exports.isBrowser = exports.randomUUID = exports.computeSha256Hmac = exports.computeSha256Hash = exports.isError = exports.isObject = exports.getRandomIntegerInclusive = exports.calculateRetryDelay = void 0; -var delay_js_1 = __nccwpck_require__(34591); -Object.defineProperty(exports, "calculateRetryDelay", ({ enumerable: true, get: function () { return delay_js_1.calculateRetryDelay; } })); -var random_js_1 = __nccwpck_require__(25042); -Object.defineProperty(exports, "getRandomIntegerInclusive", ({ enumerable: true, get: function () { return random_js_1.getRandomIntegerInclusive; } })); -var object_js_1 = __nccwpck_require__(7088); -Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return object_js_1.isObject; } })); -var error_js_1 = __nccwpck_require__(13742); -Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return error_js_1.isError; } })); -var sha256_js_1 = __nccwpck_require__(70017); -Object.defineProperty(exports, "computeSha256Hash", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hash; } })); -Object.defineProperty(exports, "computeSha256Hmac", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hmac; } })); -var uuidUtils_js_1 = __nccwpck_require__(2339); -Object.defineProperty(exports, "randomUUID", ({ enumerable: true, get: function () { return uuidUtils_js_1.randomUUID; } })); -var checkEnvironment_js_1 = __nccwpck_require__(94121); -Object.defineProperty(exports, "isBrowser", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBrowser; } })); -Object.defineProperty(exports, "isBun", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBun; } })); -Object.defineProperty(exports, "isNodeLike", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeLike; } })); -Object.defineProperty(exports, "isNodeRuntime", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNodeRuntime; } })); -Object.defineProperty(exports, "isDeno", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isDeno; } })); -Object.defineProperty(exports, "isReactNative", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isReactNative; } })); -Object.defineProperty(exports, "isWebWorker", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isWebWorker; } })); -var bytesEncoding_js_1 = __nccwpck_require__(88943); -Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } })); -Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } })); -var sanitizer_js_1 = __nccwpck_require__(61416); -Object.defineProperty(exports, "Sanitizer", ({ enumerable: true, get: function () { return sanitizer_js_1.Sanitizer; } })); -//# sourceMappingURL=internal.js.map - -/***/ }), - -/***/ 7088: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isObject = isObject; -/** - * Helper to determine when an input is a generic JS object. - * @returns true when input is an object type that is not null, Array, RegExp, or Date. - */ -function isObject(input) { - return (typeof input === "object" && - input !== null && - !Array.isArray(input) && - !(input instanceof RegExp) && - !(input instanceof Date)); -} -//# sourceMappingURL=object.js.map - -/***/ }), - -/***/ 25042: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getRandomIntegerInclusive = getRandomIntegerInclusive; -/** - * Returns a random integer value between a lower and upper bound, - * inclusive of both bounds. - * Note that this uses Math.random and isn't secure. If you need to use - * this for any kind of security purpose, find a better source of random. - * @param min - The smallest integer value allowed. - * @param max - The largest integer value allowed. - */ -function getRandomIntegerInclusive(min, max) { - // Make sure inputs are integers. - min = Math.ceil(min); - max = Math.floor(max); - // Pick a random offset from zero to the size of the range. - // Since Math.random() can never return 1, we have to make the range one larger - // in order to be inclusive of the maximum value after we take the floor. - const offset = Math.floor(Math.random() * (max - min + 1)); - return offset + min; + } + /** @inheritdoc */ + closeTag(name, hasTextPayload) { + const ending = hasTextPayload ? '' : this._beginLine(); + return ending + ""; + } + /** @inheritdoc */ + attribute(name, value) { + let str = name + "=\"" + value + "\""; + if (this._writerOptions.prettyPrint && this._writerOptions.width > 0 && + this._lineLength + 1 + str.length > this._writerOptions.width) { + str = this._beginLine() + this._indent(1) + str; + this._lineLength = str.length; + return str; + } + else { + this._lineLength += 1 + str.length; + return " " + str; + } + } + /** @inheritdoc */ + beginElement(name) { } + /** @inheritdoc */ + endElement(name) { } + /** + * Produces characters to be prepended to a line of string in pretty-print + * mode. + */ + _beginLine() { + if (this._writerOptions.prettyPrint) { + const str = (this.hasData ? this._writerOptions.newline : "") + + this._indent(this._writerOptions.offset + this.level); + this._lineLength = str.length; + return str; + } + else { + return ""; + } + } + /** + * Produces an indentation string. + * + * @param level - depth of the tree + */ + _indent(level) { + if (level <= 0) { + return ""; + } + else { + return this._writerOptions.indent.repeat(level); + } + } } -//# sourceMappingURL=random.js.map +exports.XMLCBWriter = XMLCBWriter; +//# sourceMappingURL=XMLCBWriter.js.map /***/ }), -/***/ 61416: +/***/ 68998: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Sanitizer = void 0; -const object_js_1 = __nccwpck_require__(7088); -const RedactedString = "REDACTED"; -// Make sure this list is up-to-date with the one under core/logger/Readme#Keyconcepts -const defaultAllowedHeaderNames = [ - "x-ms-client-request-id", - "x-ms-return-client-request-id", - "x-ms-useragent", - "x-ms-correlation-request-id", - "x-ms-request-id", - "client-request-id", - "ms-cv", - "return-client-request-id", - "traceparent", - "Access-Control-Allow-Credentials", - "Access-Control-Allow-Headers", - "Access-Control-Allow-Methods", - "Access-Control-Allow-Origin", - "Access-Control-Expose-Headers", - "Access-Control-Max-Age", - "Access-Control-Request-Headers", - "Access-Control-Request-Method", - "Origin", - "Accept", - "Accept-Encoding", - "Cache-Control", - "Connection", - "Content-Length", - "Content-Type", - "Date", - "ETag", - "Expires", - "If-Match", - "If-Modified-Since", - "If-None-Match", - "If-Unmodified-Since", - "Last-Modified", - "Pragma", - "Request-Id", - "Retry-After", - "Server", - "Transfer-Encoding", - "User-Agent", - "WWW-Authenticate", -]; -const defaultAllowedQueryParameters = ["api-version"]; +exports.XMLWriter = void 0; +const util_1 = __nccwpck_require__(76195); +const interfaces_1 = __nccwpck_require__(27305); +const BaseWriter_1 = __nccwpck_require__(24189); +const util_2 = __nccwpck_require__(65282); /** - * A utility class to sanitize objects for logging. + * Serializes XML nodes into strings. */ -class Sanitizer { - allowedHeaderNames; - allowedQueryParameters; - constructor({ additionalAllowedHeaderNames: allowedHeaderNames = [], additionalAllowedQueryParameters: allowedQueryParameters = [], } = {}) { - allowedHeaderNames = defaultAllowedHeaderNames.concat(allowedHeaderNames); - allowedQueryParameters = defaultAllowedQueryParameters.concat(allowedQueryParameters); - this.allowedHeaderNames = new Set(allowedHeaderNames.map((n) => n.toLowerCase())); - this.allowedQueryParameters = new Set(allowedQueryParameters.map((p) => p.toLowerCase())); +class XMLWriter extends BaseWriter_1.BaseWriter { + _refs; + _indentation = {}; + _lengthToLastNewline = 0; + /** + * Initializes a new instance of `XMLWriter`. + * + * @param builderOptions - XML builder options + * @param writerOptions - serialization options + */ + constructor(builderOptions, writerOptions) { + super(builderOptions); + // provide default options + this._writerOptions = (0, util_1.applyDefaults)(writerOptions, { + wellFormed: false, + headless: false, + prettyPrint: false, + indent: " ", + newline: "\n", + offset: 0, + width: 0, + allowEmptyTags: false, + indentTextOnlyNodes: false, + spaceBeforeSlash: false + }); } /** - * Sanitizes an object for logging. - * @param obj - The object to sanitize - * @returns - The sanitized object as a string + * Produces an XML serialization of the given node. + * + * @param node - node to serialize */ - sanitize(obj) { - const seen = new Set(); - return JSON.stringify(obj, (key, value) => { - // Ensure Errors include their interesting non-enumerable members - if (value instanceof Error) { - return { - ...value, - name: value.name, - message: value.message, - }; - } - if (key === "headers") { - return this.sanitizeHeaders(value); - } - else if (key === "url") { - return this.sanitizeUrl(value); - } - else if (key === "query") { - return this.sanitizeQuery(value); - } - else if (key === "body") { - // Don't log the request body - return undefined; - } - else if (key === "response") { - // Don't log response again - return undefined; - } - else if (key === "operationSpec") { - // When using sendOperationRequest, the request carries a massive - // field with the autorest spec. No need to log it. - return undefined; - } - else if (Array.isArray(value) || (0, object_js_1.isObject)(value)) { - if (seen.has(value)) { - return "[Circular]"; + serialize(node) { + this._refs = { suppressPretty: false, emptyNode: false, markup: "" }; + // Serialize XML declaration + if (node.nodeType === interfaces_1.NodeType.Document && !this._writerOptions.headless) { + this.declaration(this._builderOptions.version, this._builderOptions.encoding, this._builderOptions.standalone); + } + // recursively serialize node + this.serializeNode(node, this._writerOptions.wellFormed); + // remove trailing newline + if (this._writerOptions.prettyPrint && + this._refs.markup.slice(-this._writerOptions.newline.length) === this._writerOptions.newline) { + this._refs.markup = this._refs.markup.slice(0, -this._writerOptions.newline.length); + } + return this._refs.markup; + } + /** @inheritdoc */ + declaration(version, encoding, standalone) { + this._beginLine(); + this._refs.markup += ""; + this._endLine(); + } + /** @inheritdoc */ + docType(name, publicId, systemId) { + this._beginLine(); + if (publicId && systemId) { + this._refs.markup += ""; + } + else if (publicId) { + this._refs.markup += ""; + } + else if (systemId) { + this._refs.markup += ""; + } + else { + this._refs.markup += ""; + } + this._endLine(); + } + /** @inheritdoc */ + openTagBegin(name) { + this._beginLine(); + this._refs.markup += "<" + name; + } + /** @inheritdoc */ + openTagEnd(name, selfClosing, voidElement) { + // do not indent text only elements or elements with empty text nodes + this._refs.suppressPretty = false; + this._refs.emptyNode = false; + if (this._writerOptions.prettyPrint && !selfClosing && !voidElement) { + let textOnlyNode = true; + let emptyNode = true; + let childNode = this.currentNode.firstChild; + let cdataCount = 0; + let textCount = 0; + while (childNode) { + if (util_2.Guard.isExclusiveTextNode(childNode)) { + textCount++; } - seen.add(value); + else if (util_2.Guard.isCDATASectionNode(childNode)) { + cdataCount++; + } + else { + textOnlyNode = false; + emptyNode = false; + break; + } + if (childNode.data !== '') { + emptyNode = false; + } + childNode = childNode.nextSibling; } - return value; - }, 2); + this._refs.suppressPretty = !this._writerOptions.indentTextOnlyNodes && textOnlyNode && ((cdataCount <= 1 && textCount === 0) || cdataCount === 0); + this._refs.emptyNode = emptyNode; + } + if ((voidElement || selfClosing || this._refs.emptyNode) && this._writerOptions.allowEmptyTags) { + this._refs.markup += ">"; + } + else { + this._refs.markup += voidElement ? " />" : + (selfClosing || this._refs.emptyNode) ? (this._writerOptions.spaceBeforeSlash ? " />" : "/>") : ">"; + } + this._endLine(); } - /** - * Sanitizes a URL for logging. - * @param value - The URL to sanitize - * @returns - The sanitized URL as a string - */ - sanitizeUrl(value) { - if (typeof value !== "string" || value === null || value === "") { - return value; + /** @inheritdoc */ + closeTag(name) { + if (!this._refs.emptyNode) { + this._beginLine(); + this._refs.markup += ""; } - const url = new URL(value); - if (!url.search) { - return value; + this._refs.suppressPretty = false; + this._refs.emptyNode = false; + this._endLine(); + } + /** @inheritdoc */ + attribute(name, value) { + const str = name + "=\"" + value + "\""; + if (this._writerOptions.prettyPrint && this._writerOptions.width > 0 && + this._refs.markup.length - this._lengthToLastNewline + 1 + str.length > this._writerOptions.width) { + this._endLine(); + this._beginLine(); + this._refs.markup += this._indent(1) + str; } - for (const [key] of url.searchParams) { - if (!this.allowedQueryParameters.has(key.toLowerCase())) { - url.searchParams.set(key, RedactedString); - } + else { + this._refs.markup += " " + str; } - return url.toString(); } - sanitizeHeaders(obj) { - const sanitized = {}; - for (const key of Object.keys(obj)) { - if (this.allowedHeaderNames.has(key.toLowerCase())) { - sanitized[key] = obj[key]; - } - else { - sanitized[key] = RedactedString; - } + /** @inheritdoc */ + text(data) { + if (data !== '') { + this._beginLine(); + this._refs.markup += data; + this._endLine(); } - return sanitized; } - sanitizeQuery(value) { - if (typeof value !== "object" || value === null) { - return value; + /** @inheritdoc */ + cdata(data) { + if (data !== '') { + this._beginLine(); + this._refs.markup += ""; + this._endLine(); } - const sanitized = {}; - for (const k of Object.keys(value)) { - if (this.allowedQueryParameters.has(k.toLowerCase())) { - sanitized[k] = value[k]; - } - else { - sanitized[k] = RedactedString; - } + } + /** @inheritdoc */ + comment(data) { + this._beginLine(); + this._refs.markup += ""; + this._endLine(); + } + /** @inheritdoc */ + instruction(target, data) { + this._beginLine(); + this._refs.markup += ""; + this._endLine(); + } + /** + * Produces characters to be prepended to a line of string in pretty-print + * mode. + */ + _beginLine() { + if (this._writerOptions.prettyPrint && !this._refs.suppressPretty) { + this._refs.markup += this._indent(this._writerOptions.offset + this.level); + } + } + /** + * Produces characters to be appended to a line of string in pretty-print + * mode. + */ + _endLine() { + if (this._writerOptions.prettyPrint && !this._refs.suppressPretty) { + this._refs.markup += this._writerOptions.newline; + this._lengthToLastNewline = this._refs.markup.length; + } + } + /** + * Produces an indentation string. + * + * @param level - depth of the tree + */ + _indent(level) { + if (level <= 0) { + return ""; + } + else if (this._indentation[level] !== undefined) { + return this._indentation[level]; + } + else { + const str = this._writerOptions.indent.repeat(level); + this._indentation[level] = str; + return str; } - return sanitized; } } -exports.Sanitizer = Sanitizer; -//# sourceMappingURL=sanitizer.js.map +exports.XMLWriter = XMLWriter; +//# sourceMappingURL=XMLWriter.js.map /***/ }), -/***/ 70017: +/***/ 32770: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.computeSha256Hmac = computeSha256Hmac; -exports.computeSha256Hash = computeSha256Hash; -const node_crypto_1 = __nccwpck_require__(6005); -/** - * Generates a SHA-256 HMAC signature. - * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash. - * @param stringToSign - The data to be signed. - * @param encoding - The textual encoding to use for the returned HMAC digest. - */ -async function computeSha256Hmac(key, stringToSign, encoding) { - const decodedKey = Buffer.from(key, "base64"); - return (0, node_crypto_1.createHmac)("sha256", decodedKey).update(stringToSign).digest(encoding); -} +exports.YAMLCBWriter = void 0; +const BaseCBWriter_1 = __nccwpck_require__(63210); /** - * Generates a SHA-256 hash. - * @param content - The data to be included in the hash. - * @param encoding - The textual encoding to use for the returned hash. + * Serializes XML nodes. */ -async function computeSha256Hash(content, encoding) { - return (0, node_crypto_1.createHash)("sha256").update(content).digest(encoding); -} -//# sourceMappingURL=sha256.js.map - -/***/ }), - -/***/ 61580: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isNodeReadableStream = isNodeReadableStream; -exports.isWebReadableStream = isWebReadableStream; -exports.isBinaryBody = isBinaryBody; -exports.isReadableStream = isReadableStream; -exports.isBlob = isBlob; -function isNodeReadableStream(x) { - return Boolean(x && typeof x["pipe"] === "function"); -} -function isWebReadableStream(x) { - return Boolean(x && - typeof x.getReader === "function" && - typeof x.tee === "function"); -} -function isBinaryBody(body) { - return (body !== undefined && - (body instanceof Uint8Array || - isReadableStream(body) || - typeof body === "function" || - body instanceof Blob)); -} -function isReadableStream(x) { - return isNodeReadableStream(x) || isWebReadableStream(x); -} -function isBlob(x) { - return typeof x.stream === "function"; -} -//# sourceMappingURL=typeGuards.js.map - -/***/ }), - -/***/ 8192: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getUserAgentHeaderName = getUserAgentHeaderName; -exports.getUserAgentValue = getUserAgentValue; -const userAgentPlatform_js_1 = __nccwpck_require__(76576); -const constants_js_1 = __nccwpck_require__(58463); -function getUserAgentString(telemetryInfo) { - const parts = []; - for (const [key, value] of telemetryInfo) { - const token = value ? `${key}/${value}` : key; - parts.push(token); +class YAMLCBWriter extends BaseCBWriter_1.BaseCBWriter { + _rootWritten = false; + _additionalLevel = 0; + /** + * Initializes a new instance of `BaseCBWriter`. + * + * @param builderOptions - XML builder options + */ + constructor(builderOptions) { + super(builderOptions); + if (builderOptions.indent.length < 2) { + throw new Error("YAML indententation string must be at least two characters long."); + } + if (builderOptions.offset < 0) { + throw new Error("YAML offset should be zero or a positive number."); + } + } + /** @inheritdoc */ + frontMatter() { + return this._beginLine() + "---"; + } + /** @inheritdoc */ + declaration(version, encoding, standalone) { + return ""; + } + /** @inheritdoc */ + docType(name, publicId, systemId) { + return ""; + } + /** @inheritdoc */ + comment(data) { + // "!": "hello" + return this._beginLine() + + this._key(this._builderOptions.convert.comment) + " " + + this._val(data); + } + /** @inheritdoc */ + text(data) { + // "#": "hello" + return this._beginLine() + + this._key(this._builderOptions.convert.text) + " " + + this._val(data); + } + /** @inheritdoc */ + instruction(target, data) { + // "?": "target hello" + return this._beginLine() + + this._key(this._builderOptions.convert.ins) + " " + + this._val(data ? target + " " + data : target); + } + /** @inheritdoc */ + cdata(data) { + // "$": "hello" + return this._beginLine() + + this._key(this._builderOptions.convert.cdata) + " " + + this._val(data); + } + /** @inheritdoc */ + attribute(name, value) { + // "@name": "val" + this._additionalLevel++; + const str = this._beginLine() + + this._key(this._builderOptions.convert.att + name) + " " + + this._val(value); + this._additionalLevel--; + return str; + } + /** @inheritdoc */ + openTagBegin(name) { + // "node": + // "#": + // - + let str = this._beginLine() + this._key(name); + if (!this._rootWritten) { + this._rootWritten = true; + } + this.hasData = true; + this._additionalLevel++; + str += this._beginLine(true) + this._key(this._builderOptions.convert.text); + return str; + } + /** @inheritdoc */ + openTagEnd(name, selfClosing, voidElement) { + if (selfClosing) { + return " " + this._val(""); + } + return ""; + } + /** @inheritdoc */ + closeTag(name) { + this._additionalLevel--; + return ""; + } + /** @inheritdoc */ + beginElement(name) { } + /** @inheritdoc */ + endElement(name) { } + /** + * Produces characters to be prepended to a line of string in pretty-print + * mode. + */ + _beginLine(suppressArray = false) { + return (this.hasData ? this._writerOptions.newline : "") + + this._indent(this._writerOptions.offset + this.level, suppressArray); + } + /** + * Produces an indentation string. + * + * @param level - depth of the tree + * @param suppressArray - whether the suppress array marker + */ + _indent(level, suppressArray) { + if (level + this._additionalLevel <= 0) { + return ""; + } + else { + const chars = this._writerOptions.indent.repeat(level + this._additionalLevel); + if (!suppressArray && this._rootWritten) { + return chars.substr(0, chars.length - 2) + '-' + chars.substr(-1, 1); + } + return chars; + } + } + /** + * Produces a YAML key string delimited with double quotes. + */ + _key(key) { + return "\"" + key + "\":"; + } + /** + * Produces a YAML value string delimited with double quotes. + */ + _val(val) { + return JSON.stringify(val); } - return parts.join(" "); -} -/** - * @internal - */ -function getUserAgentHeaderName() { - return (0, userAgentPlatform_js_1.getHeaderName)(); -} -/** - * @internal - */ -async function getUserAgentValue(prefix) { - const runtimeInfo = new Map(); - runtimeInfo.set("ts-http-runtime", constants_js_1.SDK_VERSION); - await (0, userAgentPlatform_js_1.setPlatformSpecificData)(runtimeInfo); - const defaultAgent = getUserAgentString(runtimeInfo); - const userAgentValue = prefix ? `${prefix} ${defaultAgent}` : defaultAgent; - return userAgentValue; } -//# sourceMappingURL=userAgent.js.map +exports.YAMLCBWriter = YAMLCBWriter; +//# sourceMappingURL=YAMLCBWriter.js.map /***/ }), -/***/ 76576: +/***/ 60469: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getHeaderName = getHeaderName; -exports.setPlatformSpecificData = setPlatformSpecificData; -const tslib_1 = __nccwpck_require__(4351); -const node_os_1 = tslib_1.__importDefault(__nccwpck_require__(70612)); -const node_process_1 = tslib_1.__importDefault(__nccwpck_require__(97742)); -/** - * @internal - */ -function getHeaderName() { - return "User-Agent"; -} +exports.YAMLWriter = void 0; +const ObjectWriter_1 = __nccwpck_require__(24393); +const util_1 = __nccwpck_require__(76195); +const BaseWriter_1 = __nccwpck_require__(24189); /** - * @internal + * Serializes XML nodes into a YAML string. */ -async function setPlatformSpecificData(map) { - if (node_process_1.default && node_process_1.default.versions) { - const osInfo = `${node_os_1.default.type()} ${node_os_1.default.release()}; ${node_os_1.default.arch()}`; - const versions = node_process_1.default.versions; - if (versions.bun) { - map.set("Bun", `${versions.bun} (${osInfo})`); +class YAMLWriter extends BaseWriter_1.BaseWriter { + /** + * Initializes a new instance of `YAMLWriter`. + * + * @param builderOptions - XML builder options + * @param writerOptions - serialization options + */ + constructor(builderOptions, writerOptions) { + super(builderOptions); + // provide default options + this._writerOptions = (0, util_1.applyDefaults)(writerOptions, { + wellFormed: false, + indent: ' ', + newline: '\n', + offset: 0, + group: false, + verbose: false + }); + if (this._writerOptions.indent.length < 2) { + throw new Error("YAML indententation string must be at least two characters long."); } - else if (versions.deno) { - map.set("Deno", `${versions.deno} (${osInfo})`); + if (this._writerOptions.offset < 0) { + throw new Error("YAML offset should be zero or a positive number."); } - else if (versions.node) { - map.set("Node", `${versions.node} (${osInfo})`); + } + /** + * Produces an XML serialization of the given node. + * + * @param node - node to serialize + * @param writerOptions - serialization options + */ + serialize(node) { + // convert to object + const objectWriterOptions = (0, util_1.applyDefaults)(this._writerOptions, { + format: "object", + wellFormed: false + }); + const objectWriter = new ObjectWriter_1.ObjectWriter(this._builderOptions, objectWriterOptions); + const val = objectWriter.serialize(node); + let markup = this._beginLine(this._writerOptions, 0) + '---' + this._endLine(this._writerOptions) + + this._convertObject(val, this._writerOptions, 0); + // remove trailing newline + /* istanbul ignore else */ + if (markup.slice(-this._writerOptions.newline.length) === this._writerOptions.newline) { + markup = markup.slice(0, -this._writerOptions.newline.length); + } + return markup; + } + /** + * Produces an XML serialization of the given object. + * + * @param obj - object to serialize + * @param options - serialization options + * @param level - depth of the XML tree + * @param indentLeaf - indents leaf nodes + */ + _convertObject(obj, options, level, suppressIndent = false) { + let markup = ''; + if ((0, util_1.isArray)(obj)) { + for (const val of obj) { + markup += this._beginLine(options, level, true); + if (!(0, util_1.isObject)(val)) { + markup += this._val(val) + this._endLine(options); + } + else if ((0, util_1.isEmpty)(val)) { + markup += '""' + this._endLine(options); + } + else { + markup += this._convertObject(val, options, level, true); + } + } + } + else /* if (isObject(obj)) */ { + (0, util_1.forEachObject)(obj, (key, val) => { + if (suppressIndent) { + markup += this._key(key); + suppressIndent = false; + } + else { + markup += this._beginLine(options, level) + this._key(key); + } + if (!(0, util_1.isObject)(val) && !(0, util_1.isArray)(val)) { + markup += ' ' + this._val(val) + this._endLine(options); + } + else if ((0, util_1.isEmpty)(val)) { + markup += ' ""' + this._endLine(options); + } + else { + markup += this._endLine(options) + + this._convertObject(val, options, level + 1); + } + }, this); + } + return markup; + } + /** + * Produces characters to be prepended to a line of string in pretty-print + * mode. + * + * @param options - serialization options + * @param level - current depth of the XML tree + * @param isArray - whether this line is an array item + */ + _beginLine(options, level, isArray = false) { + const indentLevel = options.offset + level + 1; + const chars = new Array(indentLevel).join(options.indent); + if (isArray) { + return chars.substr(0, chars.length - 2) + '-' + chars.substr(-1, 1); } + else { + return chars; + } + } + /** + * Produces characters to be appended to a line of string in pretty-print + * mode. + * + * @param options - serialization options + */ + _endLine(options) { + return options.newline; + } + /** + * Produces a YAML key string delimited with double quotes. + */ + _key(key) { + return "\"" + key + "\":"; + } + /** + * Produces a YAML value string delimited with double quotes. + */ + _val(val) { + return JSON.stringify(val); } } -//# sourceMappingURL=userAgentPlatform.js.map +exports.YAMLWriter = YAMLWriter; +//# sourceMappingURL=YAMLWriter.js.map /***/ }), -/***/ 2339: -/***/ ((__unused_webpack_module, exports) => { +/***/ 70469: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.randomUUID = randomUUID; -/** - * Generated Universally Unique Identifier - * - * @returns RFC4122 v4 UUID. - */ -function randomUUID() { - return crypto.randomUUID(); -} -//# sourceMappingURL=uuidUtils.js.map +exports.YAMLWriter = exports.JSONWriter = exports.ObjectWriter = exports.XMLWriter = exports.MapWriter = void 0; +var MapWriter_1 = __nccwpck_require__(99675); +Object.defineProperty(exports, "MapWriter", ({ enumerable: true, get: function () { return MapWriter_1.MapWriter; } })); +var XMLWriter_1 = __nccwpck_require__(68998); +Object.defineProperty(exports, "XMLWriter", ({ enumerable: true, get: function () { return XMLWriter_1.XMLWriter; } })); +var ObjectWriter_1 = __nccwpck_require__(24393); +Object.defineProperty(exports, "ObjectWriter", ({ enumerable: true, get: function () { return ObjectWriter_1.ObjectWriter; } })); +var JSONWriter_1 = __nccwpck_require__(53775); +Object.defineProperty(exports, "JSONWriter", ({ enumerable: true, get: function () { return JSONWriter_1.JSONWriter; } })); +var YAMLWriter_1 = __nccwpck_require__(60469); +Object.defineProperty(exports, "YAMLWriter", ({ enumerable: true, get: function () { return YAMLWriter_1.YAMLWriter; } })); +//# sourceMappingURL=index.js.map /***/ }), diff --git a/package-lock.json b/package-lock.json index b199c073c..382cd32d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@actions/io": "^1.0.2", "@actions/tool-cache": "^2.0.1", "semver": "^7.6.0", - "xmlbuilder2": "^2.4.0" + "xmlbuilder2": "^4.0.3" }, "devDependencies": { "@types/jest": "^29.5.14", @@ -1540,47 +1540,51 @@ } }, "node_modules/@oozcitak/dom": { - "version": "1.15.8", - "resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-1.15.8.tgz", - "integrity": "sha512-MoOnLBNsF+ok0HjpAvxYxR4piUhRDCEWK0ot3upwOOHYudJd30j6M+LNcE8RKpwfnclAX9T66nXXzkytd29XSw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-2.0.2.tgz", + "integrity": "sha512-GjpKhkSYC3Mj4+lfwEyI1dqnsKTgwGy48ytZEhm4A/xnH/8z9M3ZVXKr/YGQi3uCLs1AEBS+x5T2JPiueEDW8w==", + "license": "MIT", "dependencies": { - "@oozcitak/infra": "1.0.8", - "@oozcitak/url": "1.0.4", - "@oozcitak/util": "8.3.8" + "@oozcitak/infra": "^2.0.2", + "@oozcitak/url": "^3.0.0", + "@oozcitak/util": "^10.0.0" }, "engines": { - "node": ">=8.0" + "node": ">=20.0" } }, "node_modules/@oozcitak/infra": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-1.0.8.tgz", - "integrity": "sha512-JRAUc9VR6IGHOL7OGF+yrvs0LO8SlqGnPAMqyzOuFZPSZSXI7Xf2O9+awQPSMXgIWGtgUf/dA6Hs6X6ySEaWTg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-2.0.2.tgz", + "integrity": "sha512-2g+E7hoE2dgCz/APPOEK5s3rMhJvNxSMBrP+U+j1OWsIbtSpWxxlUjq1lU8RIsFJNYv7NMlnVsCuHcUzJW+8vA==", + "license": "MIT", "dependencies": { - "@oozcitak/util": "8.3.8" + "@oozcitak/util": "^10.0.0" }, "engines": { - "node": ">=6.0" + "node": ">=20.0" } }, "node_modules/@oozcitak/url": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@oozcitak/url/-/url-1.0.4.tgz", - "integrity": "sha512-kDcD8y+y3FCSOvnBI6HJgl00viO/nGbQoCINmQ0h98OhnGITrWR3bOGfwYCthgcrV8AnTJz8MzslTQbC3SOAmw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@oozcitak/url/-/url-3.0.0.tgz", + "integrity": "sha512-ZKfET8Ak1wsLAiLWNfFkZc/BraDccuTJKR6svTYc7sVjbR+Iu0vtXdiDMY4o6jaFl5TW2TlS7jbLl4VovtAJWQ==", + "license": "MIT", "dependencies": { - "@oozcitak/infra": "1.0.8", - "@oozcitak/util": "8.3.8" + "@oozcitak/infra": "^2.0.2", + "@oozcitak/util": "^10.0.0" }, "engines": { - "node": ">=8.0" + "node": ">=20.0" } }, "node_modules/@oozcitak/util": { - "version": "8.3.8", - "resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-8.3.8.tgz", - "integrity": "sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-10.0.0.tgz", + "integrity": "sha512-hAX0pT/73190NLqBPPWSdBVGtbY6VOhWYK3qqHqtXQ1gK7kS2yz4+ivsN07hpJ6I3aeMtKP6J6npsEKOAzuTLA==", + "license": "MIT", "engines": { - "node": ">=8.0" + "node": ">=20.0" } }, "node_modules/@protobuf-ts/runtime": { @@ -1711,6 +1715,7 @@ "version": "24.1.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz", "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==", + "dev": true, "license": "MIT", "dependencies": { "undici-types": "~7.8.0" @@ -2143,8 +2148,7 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/async": { "version": "3.2.6", @@ -2900,6 +2904,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -4190,7 +4195,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "dev": true, "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -5002,7 +5006,8 @@ "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true }, "node_modules/stack-utils": { "version": "2.0.6", @@ -5316,6 +5321,7 @@ "version": "7.8.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==", + "dev": true, "license": "MIT" }, "node_modules/update-browserslist-db": { @@ -5441,38 +5447,18 @@ } }, "node_modules/xmlbuilder2": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/xmlbuilder2/-/xmlbuilder2-2.4.1.tgz", - "integrity": "sha512-vliUplZsk5vJnhxXN/mRcij/AE24NObTUm/Zo4vkLusgayO6s3Et5zLEA14XZnY1c3hX5o1ToR0m0BJOPy0UvQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/xmlbuilder2/-/xmlbuilder2-4.0.3.tgz", + "integrity": "sha512-bx8Q1STctnNaaDymWnkfQLKofs0mGNN7rLLapJlGuV3VlvegD7Ls4ggMjE3aUSWItCCzU0PEv45lI87iSigiCA==", + "license": "MIT", "dependencies": { - "@oozcitak/dom": "1.15.8", - "@oozcitak/infra": "1.0.8", - "@oozcitak/util": "8.3.8", - "@types/node": "*", - "js-yaml": "3.14.0" + "@oozcitak/dom": "^2.0.2", + "@oozcitak/infra": "^2.0.2", + "@oozcitak/util": "^10.0.0", + "js-yaml": "^4.1.1" }, "engines": { - "node": ">=10.0" - } - }, - "node_modules/xmlbuilder2/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/xmlbuilder2/node_modules/js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "node": ">=20.0" } }, "node_modules/y18n": { diff --git a/package.json b/package.json index 97b4d0b60..7b10e83df 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@actions/io": "^1.0.2", "@actions/tool-cache": "^2.0.1", "semver": "^7.6.0", - "xmlbuilder2": "^2.4.0" + "xmlbuilder2": "^4.0.3" }, "devDependencies": { "@types/jest": "^29.5.14",