diff --git a/CHANGELOG.md b/CHANGELOG.md index 97d1c4d..5a2ebb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## v2.0.4 + +**features** + +- new option `useMultiGet` for `fetchCalendarObjects` and `fetchVCards` which controls the underlying fetching function to + better support fetching from providers which does not support `multiGet` functions + +**improvements** + +- improved documentation +- improved typescript types +- updated deps +- added `.mjs`,`.cjs`,`.min.mjs` and `.min.cjs` versions + ## v2.0.3 **improvements** diff --git a/dist/package.json b/dist/package.json index 0010c99..ff20e3b 100644 --- a/dist/package.json +++ b/dist/package.json @@ -1,6 +1,6 @@ { "name": "tsdav", - "version": "2.0.3", + "version": "2.0.4", "description": "WebDAV, CALDAV, and CARDDAV client for Nodejs and the Browser", "keywords": [ "dav", @@ -31,7 +31,7 @@ "package.json" ], "scripts": { - "build": "yarn -s clean && rollup -c rollup.config.js && copyfiles package.json LICENSE README.md ./dist && rimraf ./dist/ts", + "build": "yarn -s clean && rollup -c rollup.config.mjs && copyfiles package.json LICENSE README.md ./dist && rimraf ./dist/ts", "clean": "rimraf dist*", "lint": "eslint src --ext .ts", "lintFix": "eslint src --ext .ts --fix", @@ -49,41 +49,42 @@ }, "dependencies": { "base-64": "1.0.0", - "cross-fetch": "3.1.5", + "cross-fetch": "3.1.6", "debug": "4.3.4", "xml-js": "1.6.11" }, "devDependencies": { - "@rollup/plugin-commonjs": "22.0.1", - "@rollup/plugin-node-resolve": "13.1.3", - "@rollup/plugin-typescript": "8.3.3", + "@rollup/plugin-commonjs": "25.0.1", + "@rollup/plugin-node-resolve": "15.1.0", + "@rollup/plugin-typescript": "11.1.1", "@types/base-64": "1.0.0", - "@types/debug": "4.1.7", - "@types/jest": "28.1.4", - "@types/node": "18.0.0", - "@typescript-eslint/eslint-plugin": "5.30.3", - "@typescript-eslint/parser": "5.18.0", + "@types/debug": "4.1.8", + "@types/jest": "29.5.2", + "@types/node": "20.3.1", + "@typescript-eslint/eslint-plugin": "5.59.11", + "@typescript-eslint/parser": "5.59.11", "copyfiles": "2.4.1", "cross-env": "7.0.3", - "dotenv": "16.0.1", - "eslint": "8.19.0", + "dotenv": "16.3.0", + "eslint": "8.43.0", "eslint-config-airbnb": "19.0.4", "eslint-config-airbnb-typescript": "17.0.0", - "eslint-config-prettier": "8.5.0", - "eslint-module-utils": "2.7.3", - "eslint-plugin-import": "2.26.0", + "eslint-config-prettier": "8.8.0", + "eslint-module-utils": "2.8.0", + "eslint-plugin-import": "2.27.5", "eslint-plugin-prettier": "4.2.1", - "jest": "28.1.2", - "prettier": "2.7.1", - "rimraf": "3.0.2", - "rollup": "2.75.7", - "rollup-plugin-dts": "4.2.2", + "jest": "29.5.0", + "prettier": "2.8.8", + "rimraf": "5.0.1", + "rollup": "3.25.1", + "rollup-plugin-dts": "5.3.0", "rollup-plugin-node-builtins": "2.1.2", - "rollup-plugin-polyfill-node": "0.9.0", + "rollup-plugin-polyfill-node": "0.12.0", "rollup-plugin-terser": "7.0.2", - "sort-package-json": "1.57.0", - "ts-jest": "28.0.5", - "typescript": "4.7.4" + "sort-package-json": "2.4.1", + "ts-jest": "29.1.0", + "tslib": "2.5.3", + "typescript": "5.1.3" }, "engines": { "node": ">=10" diff --git a/dist/tsdav.cjs b/dist/tsdav.cjs new file mode 100644 index 0000000..322e62a --- /dev/null +++ b/dist/tsdav.cjs @@ -0,0 +1,1689 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var crossFetch = require('cross-fetch'); +var getLogger = require('debug'); +var convert = require('xml-js'); +var base64 = require('base-64'); + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +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 Reflect, Promise */ + + +function __rest(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; +} + +function __awaiter(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()); + }); +} + +exports.DAVNamespace = void 0; +(function (DAVNamespace) { + DAVNamespace["CALENDAR_SERVER"] = "http://calendarserver.org/ns/"; + DAVNamespace["CALDAV_APPLE"] = "http://apple.com/ns/ical/"; + DAVNamespace["CALDAV"] = "urn:ietf:params:xml:ns:caldav"; + DAVNamespace["CARDDAV"] = "urn:ietf:params:xml:ns:carddav"; + DAVNamespace["DAV"] = "DAV:"; +})(exports.DAVNamespace || (exports.DAVNamespace = {})); +const DAVAttributeMap = { + [exports.DAVNamespace.CALDAV]: 'xmlns:c', + [exports.DAVNamespace.CARDDAV]: 'xmlns:card', + [exports.DAVNamespace.CALENDAR_SERVER]: 'xmlns:cs', + [exports.DAVNamespace.CALDAV_APPLE]: 'xmlns:ca', + [exports.DAVNamespace.DAV]: 'xmlns:d', +}; +exports.DAVNamespaceShort = void 0; +(function (DAVNamespaceShort) { + DAVNamespaceShort["CALDAV"] = "c"; + DAVNamespaceShort["CARDDAV"] = "card"; + DAVNamespaceShort["CALENDAR_SERVER"] = "cs"; + DAVNamespaceShort["CALDAV_APPLE"] = "ca"; + DAVNamespaceShort["DAV"] = "d"; +})(exports.DAVNamespaceShort || (exports.DAVNamespaceShort = {})); +var ICALObjects; +(function (ICALObjects) { + ICALObjects["VEVENT"] = "VEVENT"; + ICALObjects["VTODO"] = "VTODO"; + ICALObjects["VJOURNAL"] = "VJOURNAL"; + ICALObjects["VFREEBUSY"] = "VFREEBUSY"; + ICALObjects["VTIMEZONE"] = "VTIMEZONE"; + ICALObjects["VALARM"] = "VALARM"; +})(ICALObjects || (ICALObjects = {})); + +const camelCase = (str) => str.replace(/([-_]\w)/g, (g) => g[1].toUpperCase()); + +const nativeType = (value) => { + const nValue = Number(value); + if (!Number.isNaN(nValue)) { + return nValue; + } + const bValue = value.toLowerCase(); + if (bValue === 'true') { + return true; + } + if (bValue === 'false') { + return false; + } + return value; +}; + +const urlEquals = (urlA, urlB) => { + if (!urlA && !urlB) { + return true; + } + if (!urlA || !urlB) { + return false; + } + const trimmedUrlA = urlA.trim(); + const trimmedUrlB = urlB.trim(); + if (Math.abs(trimmedUrlA.length - trimmedUrlB.length) > 1) { + return false; + } + const strippedUrlA = trimmedUrlA.slice(-1) === '/' ? trimmedUrlA.slice(0, -1) : trimmedUrlA; + const strippedUrlB = trimmedUrlB.slice(-1) === '/' ? trimmedUrlB.slice(0, -1) : trimmedUrlB; + return urlA.includes(strippedUrlB) || urlB.includes(strippedUrlA); +}; +const urlContains = (urlA, urlB) => { + if (!urlA && !urlB) { + return true; + } + if (!urlA || !urlB) { + return false; + } + const trimmedUrlA = urlA.trim(); + const trimmedUrlB = urlB.trim(); + const strippedUrlA = trimmedUrlA.slice(-1) === '/' ? trimmedUrlA.slice(0, -1) : trimmedUrlA; + const strippedUrlB = trimmedUrlB.slice(-1) === '/' ? trimmedUrlB.slice(0, -1) : trimmedUrlB; + return urlA.includes(strippedUrlB) || urlB.includes(strippedUrlA); +}; +const getDAVAttribute = (nsArr) => nsArr.reduce((prev, curr) => (Object.assign(Object.assign({}, prev), { [DAVAttributeMap[curr]]: curr })), {}); +const cleanupFalsy = (obj) => Object.entries(obj).reduce((prev, [key, value]) => { + if (value) + return Object.assign(Object.assign({}, prev), { [key]: value }); + return prev; +}, {}); + +var requestHelpers = /*#__PURE__*/Object.freeze({ + __proto__: null, + cleanupFalsy: cleanupFalsy, + getDAVAttribute: getDAVAttribute, + urlContains: urlContains, + urlEquals: urlEquals +}); + +const debug$5 = getLogger('tsdav:request'); +const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const { url, init, convertIncoming = true, parseOutgoing = true } = params; + const { headers = {}, body, namespace, method, attributes } = init; + const xmlBody = convertIncoming + ? convert.js2xml(Object.assign(Object.assign({ _declaration: { _attributes: { version: '1.0', encoding: 'utf-8' } } }, body), { _attributes: attributes }), { + compact: true, + spaces: 2, + elementNameFn: (name) => { + // add namespace to all keys without namespace + if (namespace && !/^.+:.+/.test(name)) { + return `${namespace}:${name}`; + } + return name; + }, + }) + : body; + // debug('outgoing xml:'); + // debug(`${method} ${url}`); + // debug( + // `headers: ${JSON.stringify( + // { + // 'Content-Type': 'text/xml;charset=UTF-8', + // ...cleanupFalsy(headers), + // }, + // null, + // 2 + // )}` + // ); + // debug(xmlBody); + const davResponse = yield crossFetch.fetch(url, { + headers: Object.assign({ 'Content-Type': 'text/xml;charset=UTF-8' }, cleanupFalsy(headers)), + body: xmlBody, + method, + }); + const resText = yield davResponse.text(); + // filter out invalid responses + // debug('response xml:'); + // debug(resText); + // debug(davResponse); + if (!davResponse.ok || + !((_a = davResponse.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('xml')) || + !parseOutgoing) { + return [ + { + href: davResponse.url, + ok: davResponse.ok, + status: davResponse.status, + statusText: davResponse.statusText, + raw: resText, + }, + ]; + } + const result = convert.xml2js(resText, { + compact: true, + trim: true, + textFn: (value, parentElement) => { + try { + // This is needed for xml-js design reasons + // eslint-disable-next-line no-underscore-dangle + const parentOfParent = parentElement._parent; + const pOpKeys = Object.keys(parentOfParent); + const keyNo = pOpKeys.length; + const keyName = pOpKeys[keyNo - 1]; + const arrOfKey = parentOfParent[keyName]; + const arrOfKeyLen = arrOfKey.length; + if (arrOfKeyLen > 0) { + const arr = arrOfKey; + const arrIndex = arrOfKey.length - 1; + arr[arrIndex] = nativeType(value); + } + else { + parentOfParent[keyName] = nativeType(value); + } + } + catch (e) { + debug$5(e.stack); + } + }, + // remove namespace & camelCase + elementNameFn: (attributeName) => camelCase(attributeName.replace(/^.+:/, '')), + attributesFn: (value) => { + const newVal = Object.assign({}, value); + delete newVal.xmlns; + return newVal; + }, + ignoreDeclaration: true, + }); + const responseBodies = Array.isArray(result.multistatus.response) + ? result.multistatus.response + : [result.multistatus.response]; + return responseBodies.map((responseBody) => { + var _a, _b; + const statusRegex = /^\S+\s(?\d+)\s(?.+)$/; + if (!responseBody) { + return { + status: davResponse.status, + statusText: davResponse.statusText, + ok: davResponse.ok, + }; + } + const matchArr = statusRegex.exec(responseBody.status); + return { + raw: result, + href: responseBody.href, + status: (matchArr === null || matchArr === void 0 ? void 0 : matchArr.groups) ? Number.parseInt(matchArr === null || matchArr === void 0 ? void 0 : matchArr.groups.status, 10) : davResponse.status, + statusText: (_b = (_a = matchArr === null || matchArr === void 0 ? void 0 : matchArr.groups) === null || _a === void 0 ? void 0 : _a.statusText) !== null && _b !== void 0 ? _b : davResponse.statusText, + ok: !responseBody.error, + error: responseBody.error, + responsedescription: responseBody.responsedescription, + props: (Array.isArray(responseBody.propstat) + ? responseBody.propstat + : [responseBody.propstat]).reduce((prev, curr) => { + return Object.assign(Object.assign({}, prev), curr === null || curr === void 0 ? void 0 : curr.prop); + }, {}), + }; + }); +}); +const propfind = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, depth, headers } = params; + return davRequest({ + url, + init: { + method: 'PROPFIND', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: exports.DAVNamespaceShort.DAV, + body: { + propfind: { + _attributes: getDAVAttribute([ + exports.DAVNamespace.CALDAV, + exports.DAVNamespace.CALDAV_APPLE, + exports.DAVNamespace.CALENDAR_SERVER, + exports.DAVNamespace.CARDDAV, + exports.DAVNamespace.DAV, + ]), + prop: props, + }, + }, + }, + }); +}); +const createObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, data, headers } = params; + return crossFetch.fetch(url, { method: 'PUT', body: data, headers }); +}); +const updateObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, data, etag, headers } = params; + return crossFetch.fetch(url, { + method: 'PUT', + body: data, + headers: cleanupFalsy(Object.assign({ 'If-Match': etag }, headers)), + }); +}); +const deleteObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, headers, etag } = params; + return crossFetch.fetch(url, { + method: 'DELETE', + headers: cleanupFalsy(Object.assign({ 'If-Match': etag }, headers)), + }); +}); + +var request = /*#__PURE__*/Object.freeze({ + __proto__: null, + createObject: createObject, + davRequest: davRequest, + deleteObject: deleteObject, + propfind: propfind, + updateObject: updateObject +}); + +function hasFields(obj, fields) { + const inObj = (object) => fields.every((f) => object[f]); + if (Array.isArray(obj)) { + return obj.every((o) => inObj(o)); + } + return inObj(obj); +} +const findMissingFieldNames = (obj, fields) => fields.reduce((prev, curr) => (obj[curr] ? prev : `${prev.length ? `${prev},` : ''}${curr.toString()}`), ''); + +const debug$4 = getLogger('tsdav:collection'); +const collectionQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, body, depth, defaultNamespace = exports.DAVNamespaceShort.DAV, headers } = params; + const queryResults = yield davRequest({ + url, + init: { + method: 'REPORT', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: defaultNamespace, + body, + }, + }); + // empty query result + if (queryResults.length === 1 && !queryResults[0].raw) { + return []; + } + return queryResults; +}); +const makeCollection = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, depth, headers } = params; + return davRequest({ + url, + init: { + method: 'MKCOL', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: exports.DAVNamespaceShort.DAV, + body: props + ? { + mkcol: { + set: { + prop: props, + }, + }, + } + : undefined, + }, + }); +}); +const supportedReportSet = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b, _c, _d, _e; + const { collection, headers } = params; + const res = yield propfind({ + url: collection.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:supported-report-set`]: {}, + }, + depth: '0', + headers, + }); + return ((_e = (_d = (_c = (_b = (_a = res[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.supportedReportSet) === null || _c === void 0 ? void 0 : _c.supportedReport) === null || _d === void 0 ? void 0 : _d.map((sr) => Object.keys(sr.report)[0])) !== null && _e !== void 0 ? _e : []); +}); +const isCollectionDirty = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _f, _g, _h; + const { collection, headers } = params; + const responses = yield propfind({ + url: collection.url, + props: { + [`${exports.DAVNamespaceShort.CALENDAR_SERVER}:getctag`]: {}, + }, + depth: '0', + headers, + }); + const res = responses.filter((r) => urlContains(collection.url, r.href))[0]; + if (!res) { + throw new Error('Collection does not exist on server'); + } + return { + isDirty: collection.ctag !== ((_f = res.props) === null || _f === void 0 ? void 0 : _f.getctag), + newCtag: (_h = (_g = res.props) === null || _g === void 0 ? void 0 : _g.getctag) === null || _h === void 0 ? void 0 : _h.toString(), + }; +}); +/** + * This is for webdav sync-collection only + */ +const syncCollection = (params) => { + const { url, props, headers, syncLevel, syncToken } = params; + return davRequest({ + url, + init: { + method: 'REPORT', + namespace: exports.DAVNamespaceShort.DAV, + headers: Object.assign({}, headers), + body: { + 'sync-collection': { + _attributes: getDAVAttribute([ + exports.DAVNamespace.CALDAV, + exports.DAVNamespace.CARDDAV, + exports.DAVNamespace.DAV, + ]), + 'sync-level': syncLevel, + 'sync-token': syncToken, + [`${exports.DAVNamespaceShort.DAV}:prop`]: props, + }, + }, + }, + }); +}; +/** remote collection to local */ +const smartCollectionSync = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u; + const { collection, method, headers, account, detailedResult } = params; + const requiredFields = ['accountType', 'homeUrl']; + if (!account || !hasFields(account, requiredFields)) { + if (!account) { + throw new Error('no account for smartCollectionSync'); + } + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before smartCollectionSync`); + } + const syncMethod = method !== null && method !== void 0 ? method : (((_j = collection.reports) === null || _j === void 0 ? void 0 : _j.includes('syncCollection')) ? 'webdav' : 'basic'); + debug$4(`smart collection sync with type ${account.accountType} and method ${syncMethod}`); + if (syncMethod === 'webdav') { + const result = yield syncCollection({ + url: collection.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${account.accountType === 'caldav' ? exports.DAVNamespaceShort.CALDAV : exports.DAVNamespaceShort.CARDDAV}:${account.accountType === 'caldav' ? 'calendar-data' : 'address-data'}`]: {}, + [`${exports.DAVNamespaceShort.DAV}:displayname`]: {}, + }, + syncLevel: 1, + syncToken: collection.syncToken, + headers, + }); + const objectResponses = result.filter((r) => { + var _a; + const extName = account.accountType === 'caldav' ? '.ics' : '.vcf'; + return ((_a = r.href) === null || _a === void 0 ? void 0 : _a.slice(-4)) === extName; + }); + const changedObjectUrls = objectResponses.filter((o) => o.status !== 404).map((r) => r.href); + const deletedObjectUrls = objectResponses.filter((o) => o.status === 404).map((r) => r.href); + const multiGetObjectResponse = changedObjectUrls.length + ? (_l = (yield ((_k = collection === null || collection === void 0 ? void 0 : collection.objectMultiGet) === null || _k === void 0 ? void 0 : _k.call(collection, { + url: collection.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${account.accountType === 'caldav' + ? exports.DAVNamespaceShort.CALDAV + : exports.DAVNamespaceShort.CARDDAV}:${account.accountType === 'caldav' ? 'calendar-data' : 'address-data'}`]: {}, + }, + objectUrls: changedObjectUrls, + depth: '1', + headers, + })))) !== null && _l !== void 0 ? _l : [] + : []; + const remoteObjects = multiGetObjectResponse.map((res) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + return { + url: (_a = res.href) !== null && _a !== void 0 ? _a : '', + etag: (_b = res.props) === null || _b === void 0 ? void 0 : _b.getetag, + data: (account === null || account === void 0 ? void 0 : account.accountType) === 'caldav' + ? (_e = (_d = (_c = res.props) === null || _c === void 0 ? void 0 : _c.calendarData) === null || _d === void 0 ? void 0 : _d._cdata) !== null && _e !== void 0 ? _e : (_f = res.props) === null || _f === void 0 ? void 0 : _f.calendarData + : (_j = (_h = (_g = res.props) === null || _g === void 0 ? void 0 : _g.addressData) === null || _h === void 0 ? void 0 : _h._cdata) !== null && _j !== void 0 ? _j : (_k = res.props) === null || _k === void 0 ? void 0 : _k.addressData, + }; + }); + const localObjects = (_m = collection.objects) !== null && _m !== void 0 ? _m : []; + // no existing url + const created = remoteObjects.filter((o) => localObjects.every((lo) => !urlContains(lo.url, o.url))); + // debug(`created objects: ${created.map((o) => o.url).join('\n')}`); + // have same url, but etag different + const updated = localObjects.reduce((prev, curr) => { + const found = remoteObjects.find((ro) => urlContains(ro.url, curr.url)); + if (found && found.etag && found.etag !== curr.etag) { + return [...prev, found]; + } + return prev; + }, []); + // debug(`updated objects: ${updated.map((o) => o.url).join('\n')}`); + const deleted = deletedObjectUrls.map((o) => ({ + url: o, + etag: '', + })); + // debug(`deleted objects: ${deleted.map((o) => o.url).join('\n')}`); + const unchanged = localObjects.filter((lo) => remoteObjects.some((ro) => urlContains(lo.url, ro.url) && ro.etag === lo.etag)); + return Object.assign(Object.assign({}, collection), { objects: detailedResult + ? { created, updated, deleted } + : [...unchanged, ...created, ...updated], + // all syncToken in the results are the same so we use the first one here + syncToken: (_r = (_q = (_p = (_o = result[0]) === null || _o === void 0 ? void 0 : _o.raw) === null || _p === void 0 ? void 0 : _p.multistatus) === null || _q === void 0 ? void 0 : _q.syncToken) !== null && _r !== void 0 ? _r : collection.syncToken }); + } + if (syncMethod === 'basic') { + const { isDirty, newCtag } = yield isCollectionDirty({ + collection, + headers, + }); + const localObjects = (_s = collection.objects) !== null && _s !== void 0 ? _s : []; + const remoteObjects = (_u = (yield ((_t = collection.fetchObjects) === null || _t === void 0 ? void 0 : _t.call(collection, { collection, headers })))) !== null && _u !== void 0 ? _u : []; + // no existing url + const created = remoteObjects.filter((ro) => localObjects.every((lo) => !urlContains(lo.url, ro.url))); + // debug(`created objects: ${created.map((o) => o.url).join('\n')}`); + // have same url, but etag different + const updated = localObjects.reduce((prev, curr) => { + const found = remoteObjects.find((ro) => urlContains(ro.url, curr.url)); + if (found && found.etag && found.etag !== curr.etag) { + return [...prev, found]; + } + return prev; + }, []); + // debug(`updated objects: ${updated.map((o) => o.url).join('\n')}`); + // does not present in remote + const deleted = localObjects.filter((cal) => remoteObjects.every((ro) => !urlContains(ro.url, cal.url))); + // debug(`deleted objects: ${deleted.map((o) => o.url).join('\n')}`); + const unchanged = localObjects.filter((lo) => remoteObjects.some((ro) => urlContains(lo.url, ro.url) && ro.etag === lo.etag)); + if (isDirty) { + return Object.assign(Object.assign({}, collection), { objects: detailedResult + ? { created, updated, deleted } + : [...unchanged, ...created, ...updated], ctag: newCtag }); + } + } + return detailedResult + ? Object.assign(Object.assign({}, collection), { objects: { + created: [], + updated: [], + deleted: [], + } }) : collection; +}); + +var collection = /*#__PURE__*/Object.freeze({ + __proto__: null, + collectionQuery: collectionQuery, + isCollectionDirty: isCollectionDirty, + makeCollection: makeCollection, + smartCollectionSync: smartCollectionSync, + supportedReportSet: supportedReportSet, + syncCollection: syncCollection +}); + +const debug$3 = getLogger('tsdav:addressBook'); +const addressBookQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, filters, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'addressbook-query': { + _attributes: getDAVAttribute([exports.DAVNamespace.CARDDAV, exports.DAVNamespace.DAV]), + [`${exports.DAVNamespaceShort.DAV}:prop`]: props, + filter: filters !== null && filters !== void 0 ? filters : { + 'prop-filter': { + _attributes: { + name: 'FN', + }, + }, + }, + }, + }, + defaultNamespace: exports.DAVNamespaceShort.CARDDAV, + depth, + headers, + }); +}); +const addressBookMultiGet = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, objectUrls, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'addressbook-multiget': { + _attributes: getDAVAttribute([exports.DAVNamespace.DAV, exports.DAVNamespace.CARDDAV]), + [`${exports.DAVNamespaceShort.DAV}:prop`]: props, + [`${exports.DAVNamespaceShort.DAV}:href`]: objectUrls, + }, + }, + defaultNamespace: exports.DAVNamespaceShort.CARDDAV, + depth, + headers, + }); +}); +const fetchAddressBooks = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { account, headers, props: customProps } = params !== null && params !== void 0 ? params : {}; + const requiredFields = ['homeUrl', 'rootUrl']; + if (!account || !hasFields(account, requiredFields)) { + if (!account) { + throw new Error('no account for fetchAddressBooks'); + } + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchAddressBooks`); + } + const res = yield propfind({ + url: account.homeUrl, + props: customProps !== null && customProps !== void 0 ? customProps : { + [`${exports.DAVNamespaceShort.DAV}:displayname`]: {}, + [`${exports.DAVNamespaceShort.CALENDAR_SERVER}:getctag`]: {}, + [`${exports.DAVNamespaceShort.DAV}:resourcetype`]: {}, + [`${exports.DAVNamespaceShort.DAV}:sync-token`]: {}, + }, + depth: '1', + headers, + }); + return Promise.all(res + .filter((r) => { var _a, _b; return Object.keys((_b = (_a = r.props) === null || _a === void 0 ? void 0 : _a.resourcetype) !== null && _b !== void 0 ? _b : {}).includes('addressbook'); }) + .map((rs) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const displayName = (_c = (_b = (_a = rs.props) === null || _a === void 0 ? void 0 : _a.displayname) === null || _b === void 0 ? void 0 : _b._cdata) !== null && _c !== void 0 ? _c : (_d = rs.props) === null || _d === void 0 ? void 0 : _d.displayname; + debug$3(`Found address book named ${typeof displayName === 'string' ? displayName : ''}, + props: ${JSON.stringify(rs.props)}`); + return { + url: new URL((_e = rs.href) !== null && _e !== void 0 ? _e : '', (_f = account.rootUrl) !== null && _f !== void 0 ? _f : '').href, + ctag: (_g = rs.props) === null || _g === void 0 ? void 0 : _g.getctag, + displayName: typeof displayName === 'string' ? displayName : '', + resourcetype: Object.keys((_h = rs.props) === null || _h === void 0 ? void 0 : _h.resourcetype), + syncToken: (_j = rs.props) === null || _j === void 0 ? void 0 : _j.syncToken, + }; + }) + .map((addr) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, addr), { reports: yield supportedReportSet({ collection: addr, headers }) })); + }))); +}); +const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { addressBook, headers, objectUrls, urlFilter = (url) => url, useMultiGet = true } = params; + debug$3(`Fetching vcards from ${addressBook === null || addressBook === void 0 ? void 0 : addressBook.url}`); + const requiredFields = ['url']; + if (!addressBook || !hasFields(addressBook, requiredFields)) { + if (!addressBook) { + throw new Error('cannot fetchVCards for undefined addressBook'); + } + throw new Error(`addressBook must have ${findMissingFieldNames(addressBook, requiredFields)} before fetchVCards`); + } + const vcardUrls = (objectUrls !== null && objectUrls !== void 0 ? objectUrls : + // fetch all objects of the calendar + (yield addressBookQuery({ + url: addressBook.url, + props: { [`${exports.DAVNamespaceShort.DAV}:getetag`]: {} }, + depth: '1', + headers, + })).map((res) => { var _a; return (res.ok ? (_a = res.href) !== null && _a !== void 0 ? _a : '' : ''); })) + .map((url) => (url.startsWith('http') || !url ? url : new URL(url, addressBook.url).href)) + .filter(urlFilter) + .map((url) => new URL(url).pathname); + let vCardResults = []; + if (vcardUrls.length > 0) { + if (useMultiGet) { + vCardResults = yield addressBookMultiGet({ + url: addressBook.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${exports.DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + objectUrls: vcardUrls, + depth: '1', + headers, + }); + } + else { + vCardResults = yield addressBookQuery({ + url: addressBook.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${exports.DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + depth: '1', + headers, + }); + } + } + return vCardResults.map((res) => { + var _a, _b, _c, _d, _e, _f; + return ({ + url: new URL((_a = res.href) !== null && _a !== void 0 ? _a : '', addressBook.url).href, + etag: (_b = res.props) === null || _b === void 0 ? void 0 : _b.getetag, + data: (_e = (_d = (_c = res.props) === null || _c === void 0 ? void 0 : _c.addressData) === null || _d === void 0 ? void 0 : _d._cdata) !== null && _e !== void 0 ? _e : (_f = res.props) === null || _f === void 0 ? void 0 : _f.addressData, + }); + }); +}); +const createVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { addressBook, vCardString, filename, headers } = params; + return createObject({ + url: new URL(filename, addressBook.url).href, + data: vCardString, + headers: Object.assign({ 'content-type': 'text/vcard; charset=utf-8', 'If-None-Match': '*' }, headers), + }); +}); +const updateVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { vCard, headers } = params; + return updateObject({ + url: vCard.url, + data: vCard.data, + etag: vCard.etag, + headers: Object.assign({ 'content-type': 'text/vcard; charset=utf-8' }, headers), + }); +}); +const deleteVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { vCard, headers } = params; + return deleteObject({ + url: vCard.url, + etag: vCard.etag, + headers, + }); +}); + +var addressBook = /*#__PURE__*/Object.freeze({ + __proto__: null, + addressBookMultiGet: addressBookMultiGet, + addressBookQuery: addressBookQuery, + createVCard: createVCard, + deleteVCard: deleteVCard, + fetchAddressBooks: fetchAddressBooks, + fetchVCards: fetchVCards, + updateVCard: updateVCard +}); + +const debug$2 = getLogger('tsdav:calendar'); +const calendarQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, filters, timezone, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'calendar-query': cleanupFalsy({ + _attributes: getDAVAttribute([ + exports.DAVNamespace.CALDAV, + exports.DAVNamespace.CALENDAR_SERVER, + exports.DAVNamespace.CALDAV_APPLE, + exports.DAVNamespace.DAV, + ]), + [`${exports.DAVNamespaceShort.DAV}:prop`]: props, + filter: filters, + timezone, + }), + }, + defaultNamespace: exports.DAVNamespaceShort.CALDAV, + depth, + headers, + }); +}); +const calendarMultiGet = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, objectUrls, filters, timezone, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'calendar-multiget': { + _attributes: getDAVAttribute([exports.DAVNamespace.DAV, exports.DAVNamespace.CALDAV]), + [`${exports.DAVNamespaceShort.DAV}:prop`]: props, + [`${exports.DAVNamespaceShort.DAV}:href`]: objectUrls, + filter: filters, + timezone, + }, + }, + defaultNamespace: exports.DAVNamespaceShort.CALDAV, + depth, + headers, + }); +}); +const makeCalendar = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, depth, headers } = params; + return davRequest({ + url, + init: { + method: 'MKCALENDAR', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: exports.DAVNamespaceShort.DAV, + body: { + [`${exports.DAVNamespaceShort.CALDAV}:mkcalendar`]: { + _attributes: getDAVAttribute([ + exports.DAVNamespace.DAV, + exports.DAVNamespace.CALDAV, + exports.DAVNamespace.CALDAV_APPLE, + ]), + set: { + prop: props, + }, + }, + }, + }, + }); +}); +const fetchCalendars = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { headers, account, props: customProps } = params !== null && params !== void 0 ? params : {}; + const requiredFields = ['homeUrl', 'rootUrl']; + if (!account || !hasFields(account, requiredFields)) { + if (!account) { + throw new Error('no account for fetchCalendars'); + } + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchCalendars`); + } + const res = yield propfind({ + url: account.homeUrl, + props: customProps !== null && customProps !== void 0 ? customProps : { + [`${exports.DAVNamespaceShort.CALDAV}:calendar-description`]: {}, + [`${exports.DAVNamespaceShort.CALDAV}:calendar-timezone`]: {}, + [`${exports.DAVNamespaceShort.DAV}:displayname`]: {}, + [`${exports.DAVNamespaceShort.CALDAV_APPLE}:calendar-color`]: {}, + [`${exports.DAVNamespaceShort.CALENDAR_SERVER}:getctag`]: {}, + [`${exports.DAVNamespaceShort.DAV}:resourcetype`]: {}, + [`${exports.DAVNamespaceShort.CALDAV}:supported-calendar-component-set`]: {}, + [`${exports.DAVNamespaceShort.DAV}:sync-token`]: {}, + }, + depth: '1', + headers, + }); + return Promise.all(res + .filter((r) => { var _a, _b; return Object.keys((_b = (_a = r.props) === null || _a === void 0 ? void 0 : _a.resourcetype) !== null && _b !== void 0 ? _b : {}).includes('calendar'); }) + .filter((rc) => { + var _a, _b, _c; + // filter out none iCal format calendars. + const components = Array.isArray((_a = rc.props) === null || _a === void 0 ? void 0 : _a.supportedCalendarComponentSet.comp) + ? (_b = rc.props) === null || _b === void 0 ? void 0 : _b.supportedCalendarComponentSet.comp.map((sc) => sc._attributes.name) + : [(_c = rc.props) === null || _c === void 0 ? void 0 : _c.supportedCalendarComponentSet.comp._attributes.name] || []; + return components.some((c) => Object.values(ICALObjects).includes(c)); + }) + .map((rs) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; + // debug(`Found calendar ${rs.props?.displayname}`); + const description = (_a = rs.props) === null || _a === void 0 ? void 0 : _a.calendarDescription; + const timezone = (_b = rs.props) === null || _b === void 0 ? void 0 : _b.calendarTimezone; + return { + description: typeof description === 'string' ? description : '', + timezone: typeof timezone === 'string' ? timezone : '', + url: new URL((_c = rs.href) !== null && _c !== void 0 ? _c : '', (_d = account.rootUrl) !== null && _d !== void 0 ? _d : '').href, + ctag: (_e = rs.props) === null || _e === void 0 ? void 0 : _e.getctag, + calendarColor: (_f = rs.props) === null || _f === void 0 ? void 0 : _f.calendarColor, + displayName: (_h = (_g = rs.props) === null || _g === void 0 ? void 0 : _g.displayname._cdata) !== null && _h !== void 0 ? _h : (_j = rs.props) === null || _j === void 0 ? void 0 : _j.displayname, + components: Array.isArray((_k = rs.props) === null || _k === void 0 ? void 0 : _k.supportedCalendarComponentSet.comp) + ? (_l = rs.props) === null || _l === void 0 ? void 0 : _l.supportedCalendarComponentSet.comp.map((sc) => sc._attributes.name) + : [(_m = rs.props) === null || _m === void 0 ? void 0 : _m.supportedCalendarComponentSet.comp._attributes.name], + resourcetype: Object.keys((_o = rs.props) === null || _o === void 0 ? void 0 : _o.resourcetype), + syncToken: (_p = rs.props) === null || _p === void 0 ? void 0 : _p.syncToken, + }; + }) + .map((cal) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, cal), { reports: yield supportedReportSet({ collection: cal, headers }) })); + }))); +}); +const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter = (url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')), useMultiGet = true, } = params; + if (timeRange) { + // validate timeRange + const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; + const ISO_8601_FULL = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i; + if ((!ISO_8601.test(timeRange.start) || !ISO_8601.test(timeRange.end)) && + (!ISO_8601_FULL.test(timeRange.start) || !ISO_8601_FULL.test(timeRange.end))) { + throw new Error('invalid timeRange format, not in ISO8601'); + } + } + debug$2(`Fetching calendar objects from ${calendar === null || calendar === void 0 ? void 0 : calendar.url}`); + const requiredFields = ['url']; + if (!calendar || !hasFields(calendar, requiredFields)) { + if (!calendar) { + throw new Error('cannot fetchCalendarObjects for undefined calendar'); + } + throw new Error(`calendar must have ${findMissingFieldNames(calendar, requiredFields)} before fetchCalendarObjects`); + } + // default to fetch all + const filters = customFilters !== null && customFilters !== void 0 ? customFilters : [ + { + 'comp-filter': { + _attributes: { + name: 'VCALENDAR', + }, + 'comp-filter': Object.assign({ _attributes: { + name: 'VEVENT', + } }, (timeRange + ? { + 'time-range': { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + }, + ]; + const calendarObjectUrls = (objectUrls !== null && objectUrls !== void 0 ? objectUrls : + // fetch all objects of the calendar + (yield calendarQuery({ + url: calendar.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: Object.assign({}, (expand && timeRange + ? { + [`${exports.DAVNamespaceShort.CALDAV}:expand`]: { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + filters, + depth: '1', + headers, + })).map((res) => { var _a; return (_a = res.href) !== null && _a !== void 0 ? _a : ''; })) + .map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full + .filter(urlFilter) // custom filter function on calendar objects + .map((url) => new URL(url).pathname); // obtain pathname of the url + let calendarObjectResults = []; + if (calendarObjectUrls.length > 0) { + if (!useMultiGet || expand) { + calendarObjectResults = yield calendarQuery({ + url: calendar.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${exports.DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange + ? { + [`${exports.DAVNamespaceShort.CALDAV}:expand`]: { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + filters, + depth: '1', + headers, + }); + } + else { + calendarObjectResults = yield calendarMultiGet({ + url: calendar.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${exports.DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange + ? { + [`${exports.DAVNamespaceShort.CALDAV}:expand`]: { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + objectUrls: calendarObjectUrls, + depth: '1', + headers, + }); + } + } + return calendarObjectResults.map((res) => { + var _a, _b, _c, _d, _e, _f; + return ({ + url: new URL((_a = res.href) !== null && _a !== void 0 ? _a : '', calendar.url).href, + etag: `${(_b = res.props) === null || _b === void 0 ? void 0 : _b.getetag}`, + data: (_e = (_d = (_c = res.props) === null || _c === void 0 ? void 0 : _c.calendarData) === null || _d === void 0 ? void 0 : _d._cdata) !== null && _e !== void 0 ? _e : (_f = res.props) === null || _f === void 0 ? void 0 : _f.calendarData, + }); + }); +}); +const createCalendarObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendar, iCalString, filename, headers } = params; + return createObject({ + url: new URL(filename, calendar.url).href, + data: iCalString, + headers: Object.assign({ 'content-type': 'text/calendar; charset=utf-8', 'If-None-Match': '*' }, headers), + }); +}); +const updateCalendarObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendarObject, headers } = params; + return updateObject({ + url: calendarObject.url, + data: calendarObject.data, + etag: calendarObject.etag, + headers: Object.assign({ 'content-type': 'text/calendar; charset=utf-8' }, headers), + }); +}); +const deleteCalendarObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendarObject, headers } = params; + return deleteObject({ url: calendarObject.url, etag: calendarObject.etag, headers }); +}); +/** + * Sync remote calendars to local + */ +const syncCalendars = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const { oldCalendars, account, detailedResult, headers } = params; + if (!account) { + throw new Error('Must have account before syncCalendars'); + } + const localCalendars = (_a = oldCalendars !== null && oldCalendars !== void 0 ? oldCalendars : account.calendars) !== null && _a !== void 0 ? _a : []; + const remoteCalendars = yield fetchCalendars({ account, headers }); + // no existing url + const created = remoteCalendars.filter((rc) => localCalendars.every((lc) => !urlContains(lc.url, rc.url))); + debug$2(`new calendars: ${created.map((cc) => cc.displayName)}`); + // have same url, but syncToken/ctag different + const updated = localCalendars.reduce((prev, curr) => { + const found = remoteCalendars.find((rc) => urlContains(rc.url, curr.url)); + if (found && + ((found.syncToken && found.syncToken !== curr.syncToken) || + (found.ctag && found.ctag !== curr.ctag))) { + return [...prev, found]; + } + return prev; + }, []); + debug$2(`updated calendars: ${updated.map((cc) => cc.displayName)}`); + const updatedWithObjects = yield Promise.all(updated.map((u) => __awaiter(void 0, void 0, void 0, function* () { + const result = yield smartCollectionSync({ + collection: Object.assign(Object.assign({}, u), { objectMultiGet: calendarMultiGet }), + method: 'webdav', + headers, + account, + }); + return result; + }))); + // does not present in remote + const deleted = localCalendars.filter((cal) => remoteCalendars.every((rc) => !urlContains(rc.url, cal.url))); + debug$2(`deleted calendars: ${deleted.map((cc) => cc.displayName)}`); + const unchanged = localCalendars.filter((cal) => remoteCalendars.some((rc) => urlContains(rc.url, cal.url) && + ((rc.syncToken && rc.syncToken !== cal.syncToken) || (rc.ctag && rc.ctag !== cal.ctag)))); + // debug(`unchanged calendars: ${unchanged.map((cc) => cc.displayName)}`); + return detailedResult + ? { + created, + updated, + deleted, + } + : [...unchanged, ...created, ...updatedWithObjects]; +}); +const freeBusyQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, timeRange, depth, headers } = params; + if (timeRange) { + // validate timeRange + const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; + const ISO_8601_FULL = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i; + if ((!ISO_8601.test(timeRange.start) || !ISO_8601.test(timeRange.end)) && + (!ISO_8601_FULL.test(timeRange.start) || !ISO_8601_FULL.test(timeRange.end))) { + throw new Error('invalid timeRange format, not in ISO8601'); + } + } + else { + throw new Error('timeRange is required'); + } + const result = yield collectionQuery({ + url, + body: { + 'free-busy-query': cleanupFalsy({ + _attributes: getDAVAttribute([exports.DAVNamespace.CALDAV]), + [`${exports.DAVNamespaceShort.CALDAV}:time-range`]: { + _attributes: { + start: `${new Date(timeRange.start).toISOString().slice(0, 19).replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end).toISOString().slice(0, 19).replace(/[-:.]/g, '')}Z`, + }, + }, + }), + }, + defaultNamespace: exports.DAVNamespaceShort.CALDAV, + depth, + headers, + }); + return result[0]; +}); + +var calendar = /*#__PURE__*/Object.freeze({ + __proto__: null, + calendarMultiGet: calendarMultiGet, + calendarQuery: calendarQuery, + createCalendarObject: createCalendarObject, + deleteCalendarObject: deleteCalendarObject, + fetchCalendarObjects: fetchCalendarObjects, + fetchCalendars: fetchCalendars, + freeBusyQuery: freeBusyQuery, + makeCalendar: makeCalendar, + syncCalendars: syncCalendars, + updateCalendarObject: updateCalendarObject +}); + +const debug$1 = getLogger('tsdav:account'); +const serviceDiscovery = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b; + debug$1('Service discovery...'); + const { account, headers } = params; + const endpoint = new URL(account.serverUrl); + const uri = new URL(`/.well-known/${account.accountType}`, endpoint); + uri.protocol = (_a = endpoint.protocol) !== null && _a !== void 0 ? _a : 'http'; + try { + const response = yield crossFetch.fetch(uri.href, { + headers, + method: 'PROPFIND', + redirect: 'manual', + }); + if (response.status >= 300 && response.status < 400) { + // http redirect. + const location = response.headers.get('Location'); + if (typeof location === 'string' && location.length) { + debug$1(`Service discovery redirected to ${location}`); + const serviceURL = new URL(location, endpoint); + if (serviceURL.hostname === uri.hostname && uri.port && !serviceURL.port) { + serviceURL.port = uri.port; + } + serviceURL.protocol = (_b = endpoint.protocol) !== null && _b !== void 0 ? _b : 'http'; + return serviceURL.href; + } + } + } + catch (err) { + debug$1(`Service discovery failed: ${err.stack}`); + } + return endpoint.href; +}); +const fetchPrincipalUrl = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _c, _d, _e, _f, _g; + const { account, headers } = params; + const requiredFields = ['rootUrl']; + if (!hasFields(account, requiredFields)) { + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchPrincipalUrl`); + } + debug$1(`Fetching principal url from path ${account.rootUrl}`); + const [response] = yield propfind({ + url: account.rootUrl, + props: { + [`${exports.DAVNamespaceShort.DAV}:current-user-principal`]: {}, + }, + depth: '0', + headers, + }); + if (!response.ok) { + debug$1(`Fetch principal url failed: ${response.statusText}`); + if (response.status === 401) { + throw new Error('Invalid credentials'); + } + } + debug$1(`Fetched principal url ${(_d = (_c = response.props) === null || _c === void 0 ? void 0 : _c.currentUserPrincipal) === null || _d === void 0 ? void 0 : _d.href}`); + return new URL((_g = (_f = (_e = response.props) === null || _e === void 0 ? void 0 : _e.currentUserPrincipal) === null || _f === void 0 ? void 0 : _f.href) !== null && _g !== void 0 ? _g : '', account.rootUrl).href; +}); +const fetchHomeUrl = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _h, _j; + const { account, headers } = params; + const requiredFields = ['principalUrl', 'rootUrl']; + if (!hasFields(account, requiredFields)) { + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchHomeUrl`); + } + debug$1(`Fetch home url from ${account.principalUrl}`); + const responses = yield propfind({ + url: account.principalUrl, + props: account.accountType === 'caldav' + ? { [`${exports.DAVNamespaceShort.CALDAV}:calendar-home-set`]: {} } + : { [`${exports.DAVNamespaceShort.CARDDAV}:addressbook-home-set`]: {} }, + depth: '0', + headers, + }); + const matched = responses.find((r) => urlContains(account.principalUrl, r.href)); + if (!matched || !matched.ok) { + throw new Error('cannot find homeUrl'); + } + const result = new URL(account.accountType === 'caldav' + ? (_h = matched === null || matched === void 0 ? void 0 : matched.props) === null || _h === void 0 ? void 0 : _h.calendarHomeSet.href + : (_j = matched === null || matched === void 0 ? void 0 : matched.props) === null || _j === void 0 ? void 0 : _j.addressbookHomeSet.href, account.rootUrl).href; + debug$1(`Fetched home url ${result}`); + return result; +}); +const createAccount = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { account, headers, loadCollections = false, loadObjects = false } = params; + const newAccount = Object.assign({}, account); + newAccount.rootUrl = yield serviceDiscovery({ account, headers }); + newAccount.principalUrl = yield fetchPrincipalUrl({ account: newAccount, headers }); + newAccount.homeUrl = yield fetchHomeUrl({ account: newAccount, headers }); + // to load objects you must first load collections + if (loadCollections || loadObjects) { + if (account.accountType === 'caldav') { + newAccount.calendars = yield fetchCalendars({ headers, account: newAccount }); + } + else if (account.accountType === 'carddav') { + newAccount.addressBooks = yield fetchAddressBooks({ headers, account: newAccount }); + } + } + if (loadObjects) { + if (account.accountType === 'caldav' && newAccount.calendars) { + newAccount.calendars = yield Promise.all(newAccount.calendars.map((cal) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, cal), { objects: yield fetchCalendarObjects({ calendar: cal, headers }) })); + }))); + } + else if (account.accountType === 'carddav' && newAccount.addressBooks) { + newAccount.addressBooks = yield Promise.all(newAccount.addressBooks.map((addr) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, addr), { objects: yield fetchVCards({ addressBook: addr, headers }) })); + }))); + } + } + return newAccount; +}); + +var account = /*#__PURE__*/Object.freeze({ + __proto__: null, + createAccount: createAccount, + fetchHomeUrl: fetchHomeUrl, + fetchPrincipalUrl: fetchPrincipalUrl, + serviceDiscovery: serviceDiscovery +}); + +const debug = getLogger('tsdav:authHelper'); +/** + * Provide given params as default params to given function with optional params. + * + * suitable only for one param functions + * params are shallow merged + */ +const defaultParam = (fn, params) => (...args) => { + return fn(Object.assign(Object.assign({}, params), args[0])); +}; +const getBasicAuthHeaders = (credentials) => { + debug(`Basic auth token generated: ${base64.encode(`${credentials.username}:${credentials.password}`)}`); + return { + authorization: `Basic ${base64.encode(`${credentials.username}:${credentials.password}`)}`, + }; +}; +const fetchOauthTokens = (credentials) => __awaiter(void 0, void 0, void 0, function* () { + const requireFields = [ + 'authorizationCode', + 'redirectUrl', + 'clientId', + 'clientSecret', + 'tokenUrl', + ]; + if (!hasFields(credentials, requireFields)) { + throw new Error(`Oauth credentials missing: ${findMissingFieldNames(credentials, requireFields)}`); + } + const param = new URLSearchParams({ + grant_type: 'authorization_code', + code: credentials.authorizationCode, + redirect_uri: credentials.redirectUrl, + client_id: credentials.clientId, + client_secret: credentials.clientSecret, + }); + debug(credentials.tokenUrl); + debug(param.toString()); + const response = yield crossFetch.fetch(credentials.tokenUrl, { + method: 'POST', + body: param.toString(), + headers: { + 'content-length': `${param.toString().length}`, + 'content-type': 'application/x-www-form-urlencoded', + }, + }); + if (response.ok) { + const tokens = yield response.json(); + return tokens; + } + debug(`Fetch Oauth tokens failed: ${yield response.text()}`); + return {}; +}); +const refreshAccessToken = (credentials) => __awaiter(void 0, void 0, void 0, function* () { + const requireFields = [ + 'refreshToken', + 'clientId', + 'clientSecret', + 'tokenUrl', + ]; + if (!hasFields(credentials, requireFields)) { + throw new Error(`Oauth credentials missing: ${findMissingFieldNames(credentials, requireFields)}`); + } + const param = new URLSearchParams({ + client_id: credentials.clientId, + client_secret: credentials.clientSecret, + refresh_token: credentials.refreshToken, + grant_type: 'refresh_token', + }); + const response = yield crossFetch.fetch(credentials.tokenUrl, { + method: 'POST', + body: param.toString(), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }); + if (response.ok) { + const tokens = yield response.json(); + return tokens; + } + debug(`Refresh access token failed: ${yield response.text()}`); + return {}; +}); +const getOauthHeaders = (credentials) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + debug('Fetching oauth headers'); + let tokens = {}; + if (!credentials.refreshToken) { + // No refresh token, fetch new tokens + tokens = yield fetchOauthTokens(credentials); + } + else if ((credentials.refreshToken && !credentials.accessToken) || + Date.now() > ((_a = credentials.expiration) !== null && _a !== void 0 ? _a : 0)) { + // have refresh token, but no accessToken, fetch access token only + // or have both, but accessToken was expired + tokens = yield refreshAccessToken(credentials); + } + // now we should have valid access token + debug(`Oauth tokens fetched: ${tokens.access_token}`); + return { + tokens, + headers: { + authorization: `Bearer ${tokens.access_token}`, + }, + }; +}); + +var authHelpers = /*#__PURE__*/Object.freeze({ + __proto__: null, + defaultParam: defaultParam, + fetchOauthTokens: fetchOauthTokens, + getBasicAuthHeaders: getBasicAuthHeaders, + getOauthHeaders: getOauthHeaders, + refreshAccessToken: refreshAccessToken +}); + +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +const createDAVClient = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { serverUrl, credentials, authMethod, defaultAccountType } = params; + const authHeaders = + // eslint-disable-next-line no-nested-ternary + authMethod === 'Basic' + ? getBasicAuthHeaders(credentials) + : authMethod === 'Oauth' + ? (yield getOauthHeaders(credentials)).headers + : {}; + const defaultAccount = defaultAccountType + ? yield createAccount({ + account: { serverUrl, credentials, accountType: defaultAccountType }, + headers: authHeaders, + }) + : undefined; + const davRequest$1 = (params0) => __awaiter(void 0, void 0, void 0, function* () { + const { init } = params0, rest = __rest(params0, ["init"]); + const { headers } = init, restInit = __rest(init, ["headers"]); + return davRequest(Object.assign(Object.assign({}, rest), { init: Object.assign(Object.assign({}, restInit), { headers: Object.assign(Object.assign({}, authHeaders), headers) }) })); + }); + const createObject$1 = defaultParam(createObject, { + url: serverUrl, + headers: authHeaders, + }); + const updateObject$1 = defaultParam(updateObject, { headers: authHeaders, url: serverUrl }); + const deleteObject$1 = defaultParam(deleteObject, { headers: authHeaders, url: serverUrl }); + const propfind$1 = defaultParam(propfind, { headers: authHeaders }); + // account + const createAccount$1 = (params0) => __awaiter(void 0, void 0, void 0, function* () { + const { account, headers, loadCollections, loadObjects } = params0; + return createAccount({ + account: Object.assign({ serverUrl, credentials }, account), + headers: Object.assign(Object.assign({}, authHeaders), headers), + loadCollections, + loadObjects, + }); + }); + // collection + const collectionQuery$1 = defaultParam(collectionQuery, { headers: authHeaders }); + const makeCollection$1 = defaultParam(makeCollection, { headers: authHeaders }); + const syncCollection$1 = defaultParam(syncCollection, { headers: authHeaders }); + const supportedReportSet$1 = defaultParam(supportedReportSet, { + headers: authHeaders, + }); + const isCollectionDirty$1 = defaultParam(isCollectionDirty, { + headers: authHeaders, + }); + const smartCollectionSync$1 = defaultParam(smartCollectionSync, { + headers: authHeaders, + account: defaultAccount, + }); + // calendar + const calendarQuery$1 = defaultParam(calendarQuery, { headers: authHeaders }); + const calendarMultiGet$1 = defaultParam(calendarMultiGet, { headers: authHeaders }); + const makeCalendar$1 = defaultParam(makeCalendar, { headers: authHeaders }); + const fetchCalendars$1 = defaultParam(fetchCalendars, { + headers: authHeaders, + account: defaultAccount, + }); + const fetchCalendarObjects$1 = defaultParam(fetchCalendarObjects, { + headers: authHeaders, + }); + const createCalendarObject$1 = defaultParam(createCalendarObject, { + headers: authHeaders, + }); + const updateCalendarObject$1 = defaultParam(updateCalendarObject, { + headers: authHeaders, + }); + const deleteCalendarObject$1 = defaultParam(deleteCalendarObject, { + headers: authHeaders, + }); + const syncCalendars$1 = defaultParam(syncCalendars, { + account: defaultAccount, + headers: authHeaders, + }); + // addressBook + const addressBookQuery$1 = defaultParam(addressBookQuery, { headers: authHeaders }); + const addressBookMultiGet$1 = defaultParam(addressBookMultiGet, { headers: authHeaders }); + const fetchAddressBooks$1 = defaultParam(fetchAddressBooks, { + account: defaultAccount, + headers: authHeaders, + }); + const fetchVCards$1 = defaultParam(fetchVCards, { headers: authHeaders }); + const createVCard$1 = defaultParam(createVCard, { headers: authHeaders }); + const updateVCard$1 = defaultParam(updateVCard, { headers: authHeaders }); + const deleteVCard$1 = defaultParam(deleteVCard, { headers: authHeaders }); + return { + davRequest: davRequest$1, + propfind: propfind$1, + createAccount: createAccount$1, + createObject: createObject$1, + updateObject: updateObject$1, + deleteObject: deleteObject$1, + calendarQuery: calendarQuery$1, + addressBookQuery: addressBookQuery$1, + collectionQuery: collectionQuery$1, + makeCollection: makeCollection$1, + calendarMultiGet: calendarMultiGet$1, + makeCalendar: makeCalendar$1, + syncCollection: syncCollection$1, + supportedReportSet: supportedReportSet$1, + isCollectionDirty: isCollectionDirty$1, + smartCollectionSync: smartCollectionSync$1, + fetchCalendars: fetchCalendars$1, + fetchCalendarObjects: fetchCalendarObjects$1, + createCalendarObject: createCalendarObject$1, + updateCalendarObject: updateCalendarObject$1, + deleteCalendarObject: deleteCalendarObject$1, + syncCalendars: syncCalendars$1, + fetchAddressBooks: fetchAddressBooks$1, + addressBookMultiGet: addressBookMultiGet$1, + fetchVCards: fetchVCards$1, + createVCard: createVCard$1, + updateVCard: updateVCard$1, + deleteVCard: deleteVCard$1, + }; +}); +class DAVClient { + constructor(params) { + var _a, _b; + this.serverUrl = params.serverUrl; + this.credentials = params.credentials; + this.authMethod = (_a = params.authMethod) !== null && _a !== void 0 ? _a : 'Basic'; + this.accountType = (_b = params.defaultAccountType) !== null && _b !== void 0 ? _b : 'caldav'; + } + login() { + return __awaiter(this, void 0, void 0, function* () { + this.authHeaders = + // eslint-disable-next-line no-nested-ternary + this.authMethod === 'Basic' + ? getBasicAuthHeaders(this.credentials) + : this.authMethod === 'Oauth' + ? (yield getOauthHeaders(this.credentials)).headers + : {}; + this.account = this.accountType + ? yield createAccount({ + account: { + serverUrl: this.serverUrl, + credentials: this.credentials, + accountType: this.accountType, + }, + headers: this.authHeaders, + }) + : undefined; + }); + } + davRequest(params0) { + return __awaiter(this, void 0, void 0, function* () { + const { init } = params0, rest = __rest(params0, ["init"]); + const { headers } = init, restInit = __rest(init, ["headers"]); + return davRequest(Object.assign(Object.assign({}, rest), { init: Object.assign(Object.assign({}, restInit), { headers: Object.assign(Object.assign({}, this.authHeaders), headers) }) })); + }); + } + createObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(createObject, { + url: this.serverUrl, + headers: this.authHeaders, + })(params[0]); + }); + } + updateObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(updateObject, { headers: this.authHeaders, url: this.serverUrl })(params[0]); + }); + } + deleteObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(deleteObject, { headers: this.authHeaders, url: this.serverUrl })(params[0]); + }); + } + propfind(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(propfind, { headers: this.authHeaders })(params[0]); + }); + } + createAccount(params0) { + return __awaiter(this, void 0, void 0, function* () { + const { account, headers, loadCollections, loadObjects } = params0; + return createAccount({ + account: Object.assign({ serverUrl: this.serverUrl, credentials: this.credentials }, account), + headers: Object.assign(Object.assign({}, this.authHeaders), headers), + loadCollections, + loadObjects, + }); + }); + } + collectionQuery(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(collectionQuery, { headers: this.authHeaders })(params[0]); + }); + } + makeCollection(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(makeCollection, { headers: this.authHeaders })(params[0]); + }); + } + syncCollection(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(syncCollection, { headers: this.authHeaders })(params[0]); + }); + } + supportedReportSet(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(supportedReportSet, { headers: this.authHeaders })(params[0]); + }); + } + isCollectionDirty(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(isCollectionDirty, { headers: this.authHeaders })(params[0]); + }); + } + smartCollectionSync(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(smartCollectionSync, { + headers: this.authHeaders, + account: this.account, + })(params[0]); + }); + } + calendarQuery(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(calendarQuery, { headers: this.authHeaders })(params[0]); + }); + } + makeCalendar(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(makeCalendar, { headers: this.authHeaders })(params[0]); + }); + } + calendarMultiGet(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(calendarMultiGet, { headers: this.authHeaders })(params[0]); + }); + } + fetchCalendars(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchCalendars, { headers: this.authHeaders, account: this.account })(params === null || params === void 0 ? void 0 : params[0]); + }); + } + fetchCalendarObjects(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchCalendarObjects, { headers: this.authHeaders })(params[0]); + }); + } + createCalendarObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(createCalendarObject, { headers: this.authHeaders })(params[0]); + }); + } + updateCalendarObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(updateCalendarObject, { headers: this.authHeaders })(params[0]); + }); + } + deleteCalendarObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(deleteCalendarObject, { headers: this.authHeaders })(params[0]); + }); + } + syncCalendars(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(syncCalendars, { + headers: this.authHeaders, + account: this.account, + })(params[0]); + }); + } + addressBookQuery(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(addressBookQuery, { headers: this.authHeaders })(params[0]); + }); + } + addressBookMultiGet(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(addressBookMultiGet, { headers: this.authHeaders })(params[0]); + }); + } + fetchAddressBooks(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchAddressBooks, { headers: this.authHeaders, account: this.account })(params === null || params === void 0 ? void 0 : params[0]); + }); + } + fetchVCards(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchVCards, { headers: this.authHeaders })(params[0]); + }); + } + createVCard(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(createVCard, { headers: this.authHeaders })(params[0]); + }); + } + updateVCard(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(updateVCard, { headers: this.authHeaders })(params[0]); + }); + } + deleteVCard(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(deleteVCard, { headers: this.authHeaders })(params[0]); + }); + } +} + +var client = /*#__PURE__*/Object.freeze({ + __proto__: null, + DAVClient: DAVClient, + createDAVClient: createDAVClient +}); + +var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ DAVNamespace: exports.DAVNamespace, + DAVNamespaceShort: exports.DAVNamespaceShort, + DAVAttributeMap }, client), request), collection), account), addressBook), calendar), authHelpers), requestHelpers); + +exports.DAVAttributeMap = DAVAttributeMap; +exports.DAVClient = DAVClient; +exports.addressBookQuery = addressBookQuery; +exports.calendarMultiGet = calendarMultiGet; +exports.calendarQuery = calendarQuery; +exports.cleanupFalsy = cleanupFalsy; +exports.collectionQuery = collectionQuery; +exports.createAccount = createAccount; +exports.createCalendarObject = createCalendarObject; +exports.createDAVClient = createDAVClient; +exports.createObject = createObject; +exports.createVCard = createVCard; +exports.davRequest = davRequest; +exports.default = index; +exports.deleteCalendarObject = deleteCalendarObject; +exports.deleteObject = deleteObject; +exports.deleteVCard = deleteVCard; +exports.fetchAddressBooks = fetchAddressBooks; +exports.fetchCalendarObjects = fetchCalendarObjects; +exports.fetchCalendars = fetchCalendars; +exports.fetchOauthTokens = fetchOauthTokens; +exports.fetchVCards = fetchVCards; +exports.freeBusyQuery = freeBusyQuery; +exports.getBasicAuthHeaders = getBasicAuthHeaders; +exports.getDAVAttribute = getDAVAttribute; +exports.getOauthHeaders = getOauthHeaders; +exports.isCollectionDirty = isCollectionDirty; +exports.makeCalendar = makeCalendar; +exports.propfind = propfind; +exports.refreshAccessToken = refreshAccessToken; +exports.smartCollectionSync = smartCollectionSync; +exports.supportedReportSet = supportedReportSet; +exports.syncCalendars = syncCalendars; +exports.syncCollection = syncCollection; +exports.updateCalendarObject = updateCalendarObject; +exports.updateObject = updateObject; +exports.updateVCard = updateVCard; +exports.urlContains = urlContains; +exports.urlEquals = urlEquals; diff --git a/dist/tsdav.cjs.js b/dist/tsdav.cjs.js index cfd1b48..322e62a 100644 --- a/dist/tsdav.cjs.js +++ b/dist/tsdav.cjs.js @@ -7,12 +7,7 @@ var getLogger = require('debug'); var convert = require('xml-js'); var base64 = require('base-64'); -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var getLogger__default = /*#__PURE__*/_interopDefaultLegacy(getLogger); -var convert__default = /*#__PURE__*/_interopDefaultLegacy(convert); - -/*! ***************************************************************************** +/****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -26,6 +21,8 @@ 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 Reflect, Promise */ + function __rest(s, e) { var t = {}; @@ -137,19 +134,19 @@ const cleanupFalsy = (obj) => Object.entries(obj).reduce((prev, [key, value]) => var requestHelpers = /*#__PURE__*/Object.freeze({ __proto__: null, - urlEquals: urlEquals, - urlContains: urlContains, + cleanupFalsy: cleanupFalsy, getDAVAttribute: getDAVAttribute, - cleanupFalsy: cleanupFalsy + urlContains: urlContains, + urlEquals: urlEquals }); -const debug$5 = getLogger__default["default"]('tsdav:request'); +const debug$5 = getLogger('tsdav:request'); const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { var _a; const { url, init, convertIncoming = true, parseOutgoing = true } = params; - const { headers, body, namespace, method, attributes } = init; + const { headers = {}, body, namespace, method, attributes } = init; const xmlBody = convertIncoming - ? convert__default["default"].js2xml(Object.assign(Object.assign({ _declaration: { _attributes: { version: '1.0', encoding: 'utf-8' } } }, body), { _attributes: attributes }), { + ? convert.js2xml(Object.assign(Object.assign({ _declaration: { _attributes: { version: '1.0', encoding: 'utf-8' } } }, body), { _attributes: attributes }), { compact: true, spaces: 2, elementNameFn: (name) => { @@ -197,7 +194,7 @@ const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { }, ]; } - const result = convert__default["default"].xml2js(resText, { + const result = convert.xml2js(resText, { compact: true, trim: true, textFn: (value, parentElement) => { @@ -307,11 +304,11 @@ const deleteObject = (params) => __awaiter(void 0, void 0, void 0, function* () var request = /*#__PURE__*/Object.freeze({ __proto__: null, + createObject: createObject, davRequest: davRequest, + deleteObject: deleteObject, propfind: propfind, - createObject: createObject, - updateObject: updateObject, - deleteObject: deleteObject + updateObject: updateObject }); function hasFields(obj, fields) { @@ -323,7 +320,7 @@ function hasFields(obj, fields) { } const findMissingFieldNames = (obj, fields) => fields.reduce((prev, curr) => (obj[curr] ? prev : `${prev.length ? `${prev},` : ''}${curr.toString()}`), ''); -const debug$4 = getLogger__default["default"]('tsdav:collection'); +const debug$4 = getLogger('tsdav:collection'); const collectionQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { const { url, body, depth, defaultNamespace = exports.DAVNamespaceShort.DAV, headers } = params; const queryResults = yield davRequest({ @@ -541,14 +538,14 @@ const smartCollectionSync = (params) => __awaiter(void 0, void 0, void 0, functi var collection = /*#__PURE__*/Object.freeze({ __proto__: null, collectionQuery: collectionQuery, + isCollectionDirty: isCollectionDirty, makeCollection: makeCollection, + smartCollectionSync: smartCollectionSync, supportedReportSet: supportedReportSet, - isCollectionDirty: isCollectionDirty, - syncCollection: syncCollection, - smartCollectionSync: smartCollectionSync + syncCollection: syncCollection }); -const debug$3 = getLogger__default["default"]('tsdav:addressBook'); +const debug$3 = getLogger('tsdav:addressBook'); const addressBookQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { const { url, props, filters, depth, headers } = params; return collectionQuery({ @@ -627,7 +624,7 @@ const fetchAddressBooks = (params) => __awaiter(void 0, void 0, void 0, function }))); }); const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { - const { addressBook, headers, objectUrls, urlFilter } = params; + const { addressBook, headers, objectUrls, urlFilter = (url) => url, useMultiGet = true } = params; debug$3(`Fetching vcards from ${addressBook === null || addressBook === void 0 ? void 0 : addressBook.url}`); const requiredFields = ['url']; if (!addressBook || !hasFields(addressBook, requiredFields)) { @@ -645,20 +642,34 @@ const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { headers, })).map((res) => { var _a; return (res.ok ? (_a = res.href) !== null && _a !== void 0 ? _a : '' : ''); })) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, addressBook.url).href)) - .filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => url)) + .filter(urlFilter) .map((url) => new URL(url).pathname); - const vCardResults = vcardUrls.length > 0 - ? yield addressBookMultiGet({ - url: addressBook.url, - props: { - [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, - [`${exports.DAVNamespaceShort.CARDDAV}:address-data`]: {}, - }, - objectUrls: vcardUrls, - depth: '1', - headers, - }) - : []; + let vCardResults = []; + if (vcardUrls.length > 0) { + if (useMultiGet) { + vCardResults = yield addressBookMultiGet({ + url: addressBook.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${exports.DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + objectUrls: vcardUrls, + depth: '1', + headers, + }); + } + else { + vCardResults = yield addressBookQuery({ + url: addressBook.url, + props: { + [`${exports.DAVNamespaceShort.DAV}:getetag`]: {}, + [`${exports.DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + depth: '1', + headers, + }); + } + } return vCardResults.map((res) => { var _a, _b, _c, _d, _e, _f; return ({ @@ -696,16 +707,16 @@ const deleteVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { var addressBook = /*#__PURE__*/Object.freeze({ __proto__: null, - addressBookQuery: addressBookQuery, addressBookMultiGet: addressBookMultiGet, + addressBookQuery: addressBookQuery, + createVCard: createVCard, + deleteVCard: deleteVCard, fetchAddressBooks: fetchAddressBooks, fetchVCards: fetchVCards, - createVCard: createVCard, - updateVCard: updateVCard, - deleteVCard: deleteVCard + updateVCard: updateVCard }); -const debug$2 = getLogger__default["default"]('tsdav:calendar'); +const debug$2 = getLogger('tsdav:calendar'); const calendarQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { const { url, props, filters, timezone, depth, headers } = params; return collectionQuery({ @@ -827,7 +838,7 @@ const fetchCalendars = (params) => __awaiter(void 0, void 0, void 0, function* ( }))); }); const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, function* () { - const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter, } = params; + const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter = (url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')), useMultiGet = true, } = params; if (timeRange) { // validate timeRange const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; @@ -900,11 +911,11 @@ const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, funct headers, })).map((res) => { var _a; return (_a = res.href) !== null && _a !== void 0 ? _a : ''; })) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full - .filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')))) // filter out non ics calendar objects since apple calendar might have those + .filter(urlFilter) // custom filter function on calendar objects .map((url) => new URL(url).pathname); // obtain pathname of the url let calendarObjectResults = []; if (calendarObjectUrls.length > 0) { - if (expand) { + if (!useMultiGet || expand) { calendarObjectResults = yield calendarQuery({ url: calendar.url, props: { @@ -1073,19 +1084,19 @@ const freeBusyQuery = (params) => __awaiter(void 0, void 0, void 0, function* () var calendar = /*#__PURE__*/Object.freeze({ __proto__: null, - calendarQuery: calendarQuery, calendarMultiGet: calendarMultiGet, - makeCalendar: makeCalendar, - fetchCalendars: fetchCalendars, - fetchCalendarObjects: fetchCalendarObjects, + calendarQuery: calendarQuery, createCalendarObject: createCalendarObject, - updateCalendarObject: updateCalendarObject, deleteCalendarObject: deleteCalendarObject, + fetchCalendarObjects: fetchCalendarObjects, + fetchCalendars: fetchCalendars, + freeBusyQuery: freeBusyQuery, + makeCalendar: makeCalendar, syncCalendars: syncCalendars, - freeBusyQuery: freeBusyQuery + updateCalendarObject: updateCalendarObject }); -const debug$1 = getLogger__default["default"]('tsdav:account'); +const debug$1 = getLogger('tsdav:account'); const serviceDiscovery = (params) => __awaiter(void 0, void 0, void 0, function* () { var _a, _b; debug$1('Service discovery...'); @@ -1201,13 +1212,13 @@ const createAccount = (params) => __awaiter(void 0, void 0, void 0, function* () var account = /*#__PURE__*/Object.freeze({ __proto__: null, - serviceDiscovery: serviceDiscovery, - fetchPrincipalUrl: fetchPrincipalUrl, + createAccount: createAccount, fetchHomeUrl: fetchHomeUrl, - createAccount: createAccount + fetchPrincipalUrl: fetchPrincipalUrl, + serviceDiscovery: serviceDiscovery }); -const debug = getLogger__default["default"]('tsdav:authHelper'); +const debug = getLogger('tsdav:authHelper'); /** * Provide given params as default params to given function with optional params. * @@ -1315,10 +1326,10 @@ const getOauthHeaders = (credentials) => __awaiter(void 0, void 0, void 0, funct var authHelpers = /*#__PURE__*/Object.freeze({ __proto__: null, defaultParam: defaultParam, - getBasicAuthHeaders: getBasicAuthHeaders, fetchOauthTokens: fetchOauthTokens, - refreshAccessToken: refreshAccessToken, - getOauthHeaders: getOauthHeaders + getBasicAuthHeaders: getBasicAuthHeaders, + getOauthHeaders: getOauthHeaders, + refreshAccessToken: refreshAccessToken }); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types @@ -1629,8 +1640,8 @@ class DAVClient { var client = /*#__PURE__*/Object.freeze({ __proto__: null, - createDAVClient: createDAVClient, - DAVClient: DAVClient + DAVClient: DAVClient, + createDAVClient: createDAVClient }); var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ DAVNamespace: exports.DAVNamespace, @@ -1650,7 +1661,7 @@ exports.createDAVClient = createDAVClient; exports.createObject = createObject; exports.createVCard = createVCard; exports.davRequest = davRequest; -exports["default"] = index; +exports.default = index; exports.deleteCalendarObject = deleteCalendarObject; exports.deleteObject = deleteObject; exports.deleteVCard = deleteVCard; diff --git a/dist/tsdav.d.ts b/dist/tsdav.d.ts index 956152d..c795e78 100644 --- a/dist/tsdav.d.ts +++ b/dist/tsdav.d.ts @@ -1,10 +1,10 @@ import * as xml_js from 'xml-js'; import { ElementCompact } from 'xml-js'; -declare type DAVDepth = '0' | '1' | 'infinity'; -declare type DAVMethods = 'COPY' | 'LOCK' | 'MKCOL' | 'MOVE' | 'PROPFIND' | 'PROPPATCH' | 'UNLOCK' | 'REPORT' | 'SEARCH' | 'MKCALENDAR'; -declare type HTTPMethods = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; -declare type DAVResponse = { +type DAVDepth = '0' | '1' | 'infinity'; +type DAVMethods = 'COPY' | 'LOCK' | 'MKCOL' | 'MOVE' | 'PROPFIND' | 'PROPPATCH' | 'UNLOCK' | 'REPORT' | 'SEARCH' | 'MKCALENDAR'; +type HTTPMethods = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; +type DAVResponse = { raw?: any; href?: string; status: number; @@ -23,14 +23,14 @@ declare type DAVResponse = { } | any; }; }; -declare type DAVRequest = { +type DAVRequest = { headers?: Record; method: DAVMethods | HTTPMethods; body: any; namespace?: string; attributes?: Record; }; -declare type DAVTokens = { +type DAVTokens = { access_token?: string; refresh_token?: string; expires_in?: number; @@ -39,7 +39,7 @@ declare type DAVTokens = { scope?: string; }; -declare type DAVCollection = { +type DAVCollection = { objects?: DAVObject[]; ctag?: string; description?: string; @@ -65,12 +65,12 @@ declare type DAVCollection = { headers?: Record; }) => Promise; }; -declare type DAVObject = { +type DAVObject = { data?: any; etag: string; url: string; }; -declare type DAVCredentials = { +type DAVCredentials = { username?: string; password?: string; clientId?: string; @@ -82,7 +82,7 @@ declare type DAVCredentials = { refreshToken?: string; expiration?: number; }; -declare type DAVAccount = { +type DAVAccount = { accountType: 'caldav' | 'carddav'; serverUrl: string; credentials?: DAVCredentials; @@ -92,10 +92,10 @@ declare type DAVAccount = { calendars?: DAVCalendar[]; addressBooks?: DAVAddressBook[]; }; -declare type DAVVCard = DAVObject; -declare type DAVCalendarObject = DAVObject; -declare type DAVAddressBook = DAVCollection; -declare type DAVCalendar = { +type DAVVCard = DAVObject; +type DAVCalendarObject = DAVObject; +type DAVAddressBook = DAVCollection; +type DAVCalendar = { components?: string[]; timezone?: string; } & DAVCollection; @@ -141,8 +141,8 @@ interface SyncCalendars { }): Promise; } -declare type Optional = Pick, K> & Omit; -declare type NoUndefinedField = { +type Optional = Pick, K> & Omit; +type NoUndefinedField = { [P in keyof T]-?: NoUndefinedField>; }; @@ -192,6 +192,7 @@ declare const fetchVCards: (params: { headers?: Record | undefined; objectUrls?: string[] | undefined; urlFilter?: ((url: string) => boolean) | undefined; + useMultiGet?: boolean | undefined; }) => Promise; declare const createVCard: (params: { addressBook: DAVAddressBook; @@ -247,6 +248,7 @@ declare const fetchCalendarObjects: (params: { expand?: boolean | undefined; urlFilter?: ((url: string) => boolean) | undefined; headers?: Record | undefined; + useMultiGet?: boolean | undefined; }) => Promise; declare const createCalendarObject: (params: { calendar: DAVCalendar; @@ -460,6 +462,7 @@ declare const createDAVClient: (params: { expand?: boolean | undefined; urlFilter?: ((url: string) => boolean) | undefined; headers?: Record | undefined; + useMultiGet?: boolean | undefined; }) => Promise; createCalendarObject: (params: { calendar: DAVCalendar; @@ -493,6 +496,7 @@ declare const createDAVClient: (params: { headers?: Record | undefined; objectUrls?: string[] | undefined; urlFilter?: ((url: string) => boolean) | undefined; + useMultiGet?: boolean | undefined; }) => Promise; createVCard: (params: { addressBook: DAVCollection; @@ -593,7 +597,7 @@ declare const urlContains: (urlA?: string, urlB?: string) => boolean; declare const getDAVAttribute: (nsArr: DAVNamespace[]) => { [key: string]: DAVNamespace; }; -declare const cleanupFalsy: (obj: T) => NoUndefinedField; +declare const cleanupFalsy: (obj: T) => NoUndefinedField; declare const _default: { urlEquals: (urlA?: string | undefined, urlB?: string | undefined) => boolean; @@ -601,7 +605,7 @@ declare const _default: { getDAVAttribute: (nsArr: DAVNamespace[]) => { [key: string]: DAVNamespace; }; - cleanupFalsy: (obj: T) => NoUndefinedField; + cleanupFalsy: (obj: T) => NoUndefinedField; defaultParam: any>(fn: F, params: Partial[0]>) => (...args: Parameters) => ReturnType; getBasicAuthHeaders: (credentials: DAVCredentials) => { authorization?: string | undefined; @@ -656,6 +660,7 @@ declare const _default: { expand?: boolean | undefined; urlFilter?: ((url: string) => boolean) | undefined; headers?: Record | undefined; + useMultiGet?: boolean | undefined; }) => Promise; createCalendarObject: (params: { calendar: DAVCalendar; @@ -705,6 +710,7 @@ declare const _default: { headers?: Record | undefined; objectUrls?: string[] | undefined; urlFilter?: ((url: string) => boolean) | undefined; + useMultiGet?: boolean | undefined; }) => Promise; createVCard: (params: { addressBook: DAVCollection; @@ -916,6 +922,7 @@ declare const _default: { expand?: boolean | undefined; urlFilter?: ((url: string) => boolean) | undefined; headers?: Record | undefined; + useMultiGet?: boolean | undefined; }) => Promise; createCalendarObject: (params: { calendar: DAVCalendar; @@ -949,6 +956,7 @@ declare const _default: { headers?: Record | undefined; objectUrls?: string[] | undefined; urlFilter?: ((url: string) => boolean) | undefined; + useMultiGet?: boolean | undefined; }) => Promise; createVCard: (params: { addressBook: DAVCollection; diff --git a/dist/tsdav.esm.js b/dist/tsdav.esm.js index 0873acd..fe7b905 100644 --- a/dist/tsdav.esm.js +++ b/dist/tsdav.esm.js @@ -3,7 +3,7 @@ import getLogger from 'debug'; import convert from 'xml-js'; import { encode } from 'base-64'; -/*! ***************************************************************************** +/****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -17,6 +17,8 @@ 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 Reflect, Promise */ + function __rest(s, e) { var t = {}; @@ -128,17 +130,17 @@ const cleanupFalsy = (obj) => Object.entries(obj).reduce((prev, [key, value]) => var requestHelpers = /*#__PURE__*/Object.freeze({ __proto__: null, - urlEquals: urlEquals, - urlContains: urlContains, + cleanupFalsy: cleanupFalsy, getDAVAttribute: getDAVAttribute, - cleanupFalsy: cleanupFalsy + urlContains: urlContains, + urlEquals: urlEquals }); const debug$5 = getLogger('tsdav:request'); const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { var _a; const { url, init, convertIncoming = true, parseOutgoing = true } = params; - const { headers, body, namespace, method, attributes } = init; + const { headers = {}, body, namespace, method, attributes } = init; const xmlBody = convertIncoming ? convert.js2xml(Object.assign(Object.assign({ _declaration: { _attributes: { version: '1.0', encoding: 'utf-8' } } }, body), { _attributes: attributes }), { compact: true, @@ -298,11 +300,11 @@ const deleteObject = (params) => __awaiter(void 0, void 0, void 0, function* () var request = /*#__PURE__*/Object.freeze({ __proto__: null, + createObject: createObject, davRequest: davRequest, + deleteObject: deleteObject, propfind: propfind, - createObject: createObject, - updateObject: updateObject, - deleteObject: deleteObject + updateObject: updateObject }); function hasFields(obj, fields) { @@ -532,11 +534,11 @@ const smartCollectionSync = (params) => __awaiter(void 0, void 0, void 0, functi var collection = /*#__PURE__*/Object.freeze({ __proto__: null, collectionQuery: collectionQuery, + isCollectionDirty: isCollectionDirty, makeCollection: makeCollection, + smartCollectionSync: smartCollectionSync, supportedReportSet: supportedReportSet, - isCollectionDirty: isCollectionDirty, - syncCollection: syncCollection, - smartCollectionSync: smartCollectionSync + syncCollection: syncCollection }); const debug$3 = getLogger('tsdav:addressBook'); @@ -618,7 +620,7 @@ const fetchAddressBooks = (params) => __awaiter(void 0, void 0, void 0, function }))); }); const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { - const { addressBook, headers, objectUrls, urlFilter } = params; + const { addressBook, headers, objectUrls, urlFilter = (url) => url, useMultiGet = true } = params; debug$3(`Fetching vcards from ${addressBook === null || addressBook === void 0 ? void 0 : addressBook.url}`); const requiredFields = ['url']; if (!addressBook || !hasFields(addressBook, requiredFields)) { @@ -636,20 +638,34 @@ const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { headers, })).map((res) => { var _a; return (res.ok ? (_a = res.href) !== null && _a !== void 0 ? _a : '' : ''); })) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, addressBook.url).href)) - .filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => url)) + .filter(urlFilter) .map((url) => new URL(url).pathname); - const vCardResults = vcardUrls.length > 0 - ? yield addressBookMultiGet({ - url: addressBook.url, - props: { - [`${DAVNamespaceShort.DAV}:getetag`]: {}, - [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, - }, - objectUrls: vcardUrls, - depth: '1', - headers, - }) - : []; + let vCardResults = []; + if (vcardUrls.length > 0) { + if (useMultiGet) { + vCardResults = yield addressBookMultiGet({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + objectUrls: vcardUrls, + depth: '1', + headers, + }); + } + else { + vCardResults = yield addressBookQuery({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + depth: '1', + headers, + }); + } + } return vCardResults.map((res) => { var _a, _b, _c, _d, _e, _f; return ({ @@ -687,13 +703,13 @@ const deleteVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { var addressBook = /*#__PURE__*/Object.freeze({ __proto__: null, - addressBookQuery: addressBookQuery, addressBookMultiGet: addressBookMultiGet, + addressBookQuery: addressBookQuery, + createVCard: createVCard, + deleteVCard: deleteVCard, fetchAddressBooks: fetchAddressBooks, fetchVCards: fetchVCards, - createVCard: createVCard, - updateVCard: updateVCard, - deleteVCard: deleteVCard + updateVCard: updateVCard }); const debug$2 = getLogger('tsdav:calendar'); @@ -818,7 +834,7 @@ const fetchCalendars = (params) => __awaiter(void 0, void 0, void 0, function* ( }))); }); const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, function* () { - const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter, } = params; + const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter = (url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')), useMultiGet = true, } = params; if (timeRange) { // validate timeRange const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; @@ -891,11 +907,11 @@ const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, funct headers, })).map((res) => { var _a; return (_a = res.href) !== null && _a !== void 0 ? _a : ''; })) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full - .filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')))) // filter out non ics calendar objects since apple calendar might have those + .filter(urlFilter) // custom filter function on calendar objects .map((url) => new URL(url).pathname); // obtain pathname of the url let calendarObjectResults = []; if (calendarObjectUrls.length > 0) { - if (expand) { + if (!useMultiGet || expand) { calendarObjectResults = yield calendarQuery({ url: calendar.url, props: { @@ -1064,16 +1080,16 @@ const freeBusyQuery = (params) => __awaiter(void 0, void 0, void 0, function* () var calendar = /*#__PURE__*/Object.freeze({ __proto__: null, - calendarQuery: calendarQuery, calendarMultiGet: calendarMultiGet, - makeCalendar: makeCalendar, - fetchCalendars: fetchCalendars, - fetchCalendarObjects: fetchCalendarObjects, + calendarQuery: calendarQuery, createCalendarObject: createCalendarObject, - updateCalendarObject: updateCalendarObject, deleteCalendarObject: deleteCalendarObject, + fetchCalendarObjects: fetchCalendarObjects, + fetchCalendars: fetchCalendars, + freeBusyQuery: freeBusyQuery, + makeCalendar: makeCalendar, syncCalendars: syncCalendars, - freeBusyQuery: freeBusyQuery + updateCalendarObject: updateCalendarObject }); const debug$1 = getLogger('tsdav:account'); @@ -1192,10 +1208,10 @@ const createAccount = (params) => __awaiter(void 0, void 0, void 0, function* () var account = /*#__PURE__*/Object.freeze({ __proto__: null, - serviceDiscovery: serviceDiscovery, - fetchPrincipalUrl: fetchPrincipalUrl, + createAccount: createAccount, fetchHomeUrl: fetchHomeUrl, - createAccount: createAccount + fetchPrincipalUrl: fetchPrincipalUrl, + serviceDiscovery: serviceDiscovery }); const debug = getLogger('tsdav:authHelper'); @@ -1306,10 +1322,10 @@ const getOauthHeaders = (credentials) => __awaiter(void 0, void 0, void 0, funct var authHelpers = /*#__PURE__*/Object.freeze({ __proto__: null, defaultParam: defaultParam, - getBasicAuthHeaders: getBasicAuthHeaders, fetchOauthTokens: fetchOauthTokens, - refreshAccessToken: refreshAccessToken, - getOauthHeaders: getOauthHeaders + getBasicAuthHeaders: getBasicAuthHeaders, + getOauthHeaders: getOauthHeaders, + refreshAccessToken: refreshAccessToken }); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types @@ -1620,8 +1636,8 @@ class DAVClient { var client = /*#__PURE__*/Object.freeze({ __proto__: null, - createDAVClient: createDAVClient, - DAVClient: DAVClient + DAVClient: DAVClient, + createDAVClient: createDAVClient }); var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ DAVNamespace, diff --git a/dist/tsdav.js b/dist/tsdav.js index b18db51..1dc473d 100644 --- a/dist/tsdav.js +++ b/dist/tsdav.js @@ -1,4 +1,4 @@ -/*! ***************************************************************************** +/****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -12,6 +12,8 @@ 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 Reflect, Promise */ + function __rest(s, e) { var t = {}; @@ -37,10 +39,21 @@ function __awaiter(thisArg, _arguments, P, generator) { var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + function getAugmentedNamespace(n) { + if (n.__esModule) return n; var f = n.default; if (typeof f == "function") { - var a = function () { + var a = function a () { + if (this instanceof a) { + var args = [null]; + args.push.apply(args, arguments); + var Ctor = Function.bind.apply(f, args); + return new Ctor(); + } return f.apply(this, arguments); }; a.prototype = f.prototype; @@ -614,9 +627,11 @@ var browserPonyfill = {exports: {}}; exports.Headers = ctx.Headers; exports.Request = ctx.Request; exports.Response = ctx.Response; - module.exports = exports; + module.exports = exports; } (browserPonyfill, browserPonyfill.exports)); +var browserPonyfillExports = browserPonyfill.exports; + var global$1 = (typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); @@ -1557,10 +1572,11 @@ var common = setup; } catch (error) { return '[UnexpectedJSONParseError]: ' + error.message; } - }; + }; } (browser, browser.exports)); -var getLogger = browser.exports; +var browserExports = browser.exports; +var getLogger = /*@__PURE__*/getDefaultExportFromCjs(browserExports); var DAVNamespace; (function (DAVNamespace) { @@ -1836,7 +1852,7 @@ Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined /* * Export kMaxLength after typed array support is determined. */ -var _kMaxLength = kMaxLength(); +kMaxLength(); function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT @@ -1929,6 +1945,8 @@ Buffer.from = function (value, encodingOrOffset, length) { if (Buffer.TYPED_ARRAY_SUPPORT) { Buffer.prototype.__proto__ = Uint8Array.prototype; Buffer.__proto__ = Uint8Array; + if (typeof Symbol !== 'undefined' && Symbol.species && + Buffer[Symbol.species] === Buffer) ; } function assertSize (size) { @@ -2089,13 +2107,6 @@ function checked (length) { } return length | 0 } - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0; - } - return Buffer.alloc(+length) -} Buffer.isBuffer = isBuffer; function internalIsBuffer (b) { return !!(b != null && b._isBuffer) @@ -3575,15 +3586,6 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0)) } -var _polyfillNode_buffer = /*#__PURE__*/Object.freeze({ - __proto__: null, - Buffer: Buffer, - INSPECT_MAX_BYTES: INSPECT_MAX_BYTES, - SlowBuffer: SlowBuffer, - isBuffer: isBuffer, - kMaxLength: _kMaxLength -}); - var sax$1 = {}; var domain; @@ -4624,240 +4626,229 @@ BufferList.prototype.concat = function (n) { return ret; }; -var string_decoder = {}; - -var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_buffer); - -var hasRequiredString_decoder; - -function requireString_decoder () { - if (hasRequiredString_decoder) return string_decoder; - hasRequiredString_decoder = 1; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var Buffer = require$$0$1.Buffer; - - var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - }; - - - function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } - } +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - // StringDecoder provides an interface for efficiently splitting a series of - // buffers into a series of JS strings without breaking apart multi-byte - // characters. CESU-8 is handled as part of the UTF-8 encoding. - // - // @TODO Handling all encodings inside a single object makes it very difficult - // to reason about this code, so it should be split up in the future. - // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code - // points as used by CESU-8. - var StringDecoder = string_decoder.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; + default: return false; + } + }; - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; - }; +function assertEncoding(encoding) { + if (encoding && !isBufferEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); + } +} - // write decodes the given buffer and returns it as JS string that is - // guaranteed to not contain any partial multi-byte characters. Any partial - // character found at the end of the buffer is buffered up, and will be - // returned when calling write again with the remaining bytes. - // - // Note: Converting a Buffer containing an orphan surrogate to a String - // currently works, but converting a String to a Buffer (via `new Buffer`, or - // Buffer#write) will replace incomplete surrogates with the unicode - // replacement character. See https://codereview.chromium.org/121173009/ . - StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. CESU-8 is handled as part of the UTF-8 encoding. +// +// @TODO Handling all encodings inside a single object makes it very difficult +// to reason about this code, so it should be split up in the future. +// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code +// points as used by CESU-8. +function StringDecoder(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } + + // Enough space to store all bytes of a single character. UTF-8 needs 4 + // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). + this.charBuffer = new Buffer(6); + // Number of bytes received for the current incomplete multi-byte character. + this.charReceived = 0; + // Number of bytes expected for the current incomplete multi-byte character. + this.charLength = 0; +} - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); +// write decodes the given buffer and returns it as JS string that is +// guaranteed to not contain any partial multi-byte characters. Any partial +// character found at the end of the buffer is buffered up, and will be +// returned when calling write again with the remaining bytes. +// +// Note: Converting a Buffer containing an orphan surrogate to a String +// currently works, but converting a String to a Buffer (via `new Buffer`, or +// Buffer#write) will replace incomplete surrogates with the unicode +// replacement character. See https://codereview.chromium.org/121173009/ . +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var available = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, 0, available); + this.charReceived += available; - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; + } - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } + // remove bytes belonging to the current character from the buffer + buffer = buffer.slice(available, buffer.length); - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } + // if there are no more bytes in this buffer, just emit our char + if (buffer.length === 0) { + return charStr; + } + break; + } - // or just emit the charStr - return charStr; - }; + // determine and set charLength / charReceived + this.detectIncompleteChar(buffer); - // detectIncompleteChar determines if there is an incomplete UTF-8 character at - // the end of the given buffer. If so, it sets this.charLength to the byte - // length that character, and sets this.charReceived to the number of bytes - // that are available for this character. - StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); + end -= this.charReceived; + } - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } + charStr += buffer.toString(this.encoding, 0, end); - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; - }; + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + buffer.copy(this.charBuffer, 0, 0, size); + return charStr.substring(0, end); + } - StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); + // or just emit the charStr + return charStr; +}; - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } +// detectIncompleteChar determines if there is an incomplete UTF-8 character at +// the end of the given buffer. If so, it sets this.charLength to the byte +// length that character, and sets this.charReceived to the number of bytes +// that are available for this character. +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; - return res; - }; + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; - function passThroughWrite(buffer) { - return buffer.toString(this.encoding); - } + // See http://en.wikipedia.org/wiki/UTF-8#Description - function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; - } + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } - function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; - } - return string_decoder; + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } + + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } + } + this.charReceived = i; +}; + +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); + + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); + } + + return res; +}; + +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} + +function utf16DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 2; + this.charLength = this.charReceived ? 2 : 0; +} + +function base64DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 3; + this.charLength = this.charReceived ? 3 : 0; } -var string_decoderExports = requireString_decoder(); +var _polyfillNode_string_decoder = /*#__PURE__*/Object.freeze({ + __proto__: null, + StringDecoder: StringDecoder +}); Readable.ReadableState = ReadableState; @@ -4947,7 +4938,7 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - this.decoder = new string_decoderExports.StringDecoder(options.encoding); + this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } } @@ -5054,7 +5045,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - this._readableState.decoder = new string_decoderExports.StringDecoder(enc); + this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; }; @@ -5747,6 +5738,9 @@ function indexOf(xs, x) { } // A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + Writable.WritableState = WritableState; inherits$1(Writable, EventEmitter); @@ -6258,6 +6252,47 @@ function onEndNT(self) { } // a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + inherits$1(Transform, Duplex); function TransformState(stream) { @@ -6498,17 +6533,19 @@ Stream.prototype.pipe = function(dest, options) { var _polyfillNode_stream = /*#__PURE__*/Object.freeze({ __proto__: null, - 'default': Stream, - Readable: Readable, - Writable: Writable, Duplex: Duplex, - Transform: Transform, PassThrough: PassThrough, - Stream: Stream + Readable: Readable, + Stream: Stream, + Transform: Transform, + Writable: Writable, + default: Stream }); var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_stream); +var require$$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_string_decoder); + (function (exports) { (function (sax) { // wrapper for non-node envs sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }; @@ -6742,7 +6779,7 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_stream); typeof Buffer.isBuffer === 'function' && Buffer.isBuffer(data)) { if (!this._decoder) { - var SD = requireString_decoder().StringDecoder; + var SD = require$$1.StringDecoder; this._decoder = new SD('utf8'); } data = this._decoder.write(data); @@ -8072,7 +8109,7 @@ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_stream); } }()); } - })(exports); + })(exports); } (sax$1)); var arrayHelper = { @@ -8168,6 +8205,16 @@ function validateOptions$2(userOptions) { helper$2.ensureKeyExists('name', options); helper$2.ensureKeyExists('elements', options); helper$2.ensureKeyExists('parent', options); + helper$2.checkFnExists('doctype', options); + helper$2.checkFnExists('instruction', options); + helper$2.checkFnExists('cdata', options); + helper$2.checkFnExists('comment', options); + helper$2.checkFnExists('text', options); + helper$2.checkFnExists('instructionName', options); + helper$2.checkFnExists('elementName', options); + helper$2.checkFnExists('attributeName', options); + helper$2.checkFnExists('attributeValue', options); + helper$2.checkFnExists('attributes', options); return options; } @@ -8527,6 +8574,17 @@ function validateOptions(userOptions) { helper.ensureKeyExists('type', options); helper.ensureKeyExists('name', options); helper.ensureKeyExists('elements', options); + helper.checkFnExists('doctype', options); + helper.checkFnExists('instruction', options); + helper.checkFnExists('cdata', options); + helper.checkFnExists('comment', options); + helper.checkFnExists('text', options); + helper.checkFnExists('instructionName', options); + helper.checkFnExists('elementName', options); + helper.checkFnExists('attributeName', options); + helper.checkFnExists('attributeValue', options); + helper.checkFnExists('attributes', options); + helper.checkFnExists('fullTagEmptyElement', options); return options; } @@ -8835,6 +8893,8 @@ var lib = { json2xml: json2xml }; +var convert = /*@__PURE__*/getDefaultExportFromCjs(lib); + const camelCase = (str) => str.replace(/([-_]\w)/g, (g) => g[1].toUpperCase()); const nativeType = (value) => { @@ -8890,19 +8950,19 @@ const cleanupFalsy = (obj) => Object.entries(obj).reduce((prev, [key, value]) => var requestHelpers = /*#__PURE__*/Object.freeze({ __proto__: null, - urlEquals: urlEquals, - urlContains: urlContains, + cleanupFalsy: cleanupFalsy, getDAVAttribute: getDAVAttribute, - cleanupFalsy: cleanupFalsy + urlContains: urlContains, + urlEquals: urlEquals }); const debug$5 = getLogger('tsdav:request'); const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { var _a; const { url, init, convertIncoming = true, parseOutgoing = true } = params; - const { headers, body, namespace, method, attributes } = init; + const { headers = {}, body, namespace, method, attributes } = init; const xmlBody = convertIncoming - ? lib.js2xml(Object.assign(Object.assign({ _declaration: { _attributes: { version: '1.0', encoding: 'utf-8' } } }, body), { _attributes: attributes }), { + ? convert.js2xml(Object.assign(Object.assign({ _declaration: { _attributes: { version: '1.0', encoding: 'utf-8' } } }, body), { _attributes: attributes }), { compact: true, spaces: 2, elementNameFn: (name) => { @@ -8927,7 +8987,7 @@ const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { // )}` // ); // debug(xmlBody); - const davResponse = yield browserPonyfill.exports.fetch(url, { + const davResponse = yield browserPonyfillExports.fetch(url, { headers: Object.assign({ 'Content-Type': 'text/xml;charset=UTF-8' }, cleanupFalsy(headers)), body: xmlBody, method, @@ -8950,7 +9010,7 @@ const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { }, ]; } - const result = lib.xml2js(resText, { + const result = convert.xml2js(resText, { compact: true, trim: true, textFn: (value, parentElement) => { @@ -9040,11 +9100,11 @@ const propfind = (params) => __awaiter(void 0, void 0, void 0, function* () { }); const createObject = (params) => __awaiter(void 0, void 0, void 0, function* () { const { url, data, headers } = params; - return browserPonyfill.exports.fetch(url, { method: 'PUT', body: data, headers }); + return browserPonyfillExports.fetch(url, { method: 'PUT', body: data, headers }); }); const updateObject = (params) => __awaiter(void 0, void 0, void 0, function* () { const { url, data, etag, headers } = params; - return browserPonyfill.exports.fetch(url, { + return browserPonyfillExports.fetch(url, { method: 'PUT', body: data, headers: cleanupFalsy(Object.assign({ 'If-Match': etag }, headers)), @@ -9052,7 +9112,7 @@ const updateObject = (params) => __awaiter(void 0, void 0, void 0, function* () }); const deleteObject = (params) => __awaiter(void 0, void 0, void 0, function* () { const { url, headers, etag } = params; - return browserPonyfill.exports.fetch(url, { + return browserPonyfillExports.fetch(url, { method: 'DELETE', headers: cleanupFalsy(Object.assign({ 'If-Match': etag }, headers)), }); @@ -9060,11 +9120,11 @@ const deleteObject = (params) => __awaiter(void 0, void 0, void 0, function* () var request = /*#__PURE__*/Object.freeze({ __proto__: null, + createObject: createObject, davRequest: davRequest, + deleteObject: deleteObject, propfind: propfind, - createObject: createObject, - updateObject: updateObject, - deleteObject: deleteObject + updateObject: updateObject }); function hasFields(obj, fields) { @@ -9294,11 +9354,11 @@ const smartCollectionSync = (params) => __awaiter(void 0, void 0, void 0, functi var collection = /*#__PURE__*/Object.freeze({ __proto__: null, collectionQuery: collectionQuery, + isCollectionDirty: isCollectionDirty, makeCollection: makeCollection, + smartCollectionSync: smartCollectionSync, supportedReportSet: supportedReportSet, - isCollectionDirty: isCollectionDirty, - syncCollection: syncCollection, - smartCollectionSync: smartCollectionSync + syncCollection: syncCollection }); const debug$3 = getLogger('tsdav:addressBook'); @@ -9380,7 +9440,7 @@ const fetchAddressBooks = (params) => __awaiter(void 0, void 0, void 0, function }))); }); const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { - const { addressBook, headers, objectUrls, urlFilter } = params; + const { addressBook, headers, objectUrls, urlFilter = (url) => url, useMultiGet = true } = params; debug$3(`Fetching vcards from ${addressBook === null || addressBook === void 0 ? void 0 : addressBook.url}`); const requiredFields = ['url']; if (!addressBook || !hasFields(addressBook, requiredFields)) { @@ -9398,20 +9458,34 @@ const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { headers, })).map((res) => { var _a; return (res.ok ? (_a = res.href) !== null && _a !== void 0 ? _a : '' : ''); })) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, addressBook.url).href)) - .filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => url)) + .filter(urlFilter) .map((url) => new URL(url).pathname); - const vCardResults = vcardUrls.length > 0 - ? yield addressBookMultiGet({ - url: addressBook.url, - props: { - [`${DAVNamespaceShort.DAV}:getetag`]: {}, - [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, - }, - objectUrls: vcardUrls, - depth: '1', - headers, - }) - : []; + let vCardResults = []; + if (vcardUrls.length > 0) { + if (useMultiGet) { + vCardResults = yield addressBookMultiGet({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + objectUrls: vcardUrls, + depth: '1', + headers, + }); + } + else { + vCardResults = yield addressBookQuery({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + depth: '1', + headers, + }); + } + } return vCardResults.map((res) => { var _a, _b, _c, _d, _e, _f; return ({ @@ -9449,13 +9523,13 @@ const deleteVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { var addressBook = /*#__PURE__*/Object.freeze({ __proto__: null, - addressBookQuery: addressBookQuery, addressBookMultiGet: addressBookMultiGet, + addressBookQuery: addressBookQuery, + createVCard: createVCard, + deleteVCard: deleteVCard, fetchAddressBooks: fetchAddressBooks, fetchVCards: fetchVCards, - createVCard: createVCard, - updateVCard: updateVCard, - deleteVCard: deleteVCard + updateVCard: updateVCard }); const debug$2 = getLogger('tsdav:calendar'); @@ -9580,7 +9654,7 @@ const fetchCalendars = (params) => __awaiter(void 0, void 0, void 0, function* ( }))); }); const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, function* () { - const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter, } = params; + const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter = (url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')), useMultiGet = true, } = params; if (timeRange) { // validate timeRange const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; @@ -9653,11 +9727,11 @@ const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, funct headers, })).map((res) => { var _a; return (_a = res.href) !== null && _a !== void 0 ? _a : ''; })) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full - .filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')))) // filter out non ics calendar objects since apple calendar might have those + .filter(urlFilter) // custom filter function on calendar objects .map((url) => new URL(url).pathname); // obtain pathname of the url let calendarObjectResults = []; if (calendarObjectUrls.length > 0) { - if (expand) { + if (!useMultiGet || expand) { calendarObjectResults = yield calendarQuery({ url: calendar.url, props: { @@ -9826,16 +9900,16 @@ const freeBusyQuery = (params) => __awaiter(void 0, void 0, void 0, function* () var calendar = /*#__PURE__*/Object.freeze({ __proto__: null, - calendarQuery: calendarQuery, calendarMultiGet: calendarMultiGet, - makeCalendar: makeCalendar, - fetchCalendars: fetchCalendars, - fetchCalendarObjects: fetchCalendarObjects, + calendarQuery: calendarQuery, createCalendarObject: createCalendarObject, - updateCalendarObject: updateCalendarObject, deleteCalendarObject: deleteCalendarObject, + fetchCalendarObjects: fetchCalendarObjects, + fetchCalendars: fetchCalendars, + freeBusyQuery: freeBusyQuery, + makeCalendar: makeCalendar, syncCalendars: syncCalendars, - freeBusyQuery: freeBusyQuery + updateCalendarObject: updateCalendarObject }); const debug$1 = getLogger('tsdav:account'); @@ -9847,7 +9921,7 @@ const serviceDiscovery = (params) => __awaiter(void 0, void 0, void 0, function* const uri = new URL(`/.well-known/${account.accountType}`, endpoint); uri.protocol = (_a = endpoint.protocol) !== null && _a !== void 0 ? _a : 'http'; try { - const response = yield browserPonyfill.exports.fetch(uri.href, { + const response = yield browserPonyfillExports.fetch(uri.href, { headers, method: 'PROPFIND', redirect: 'manual', @@ -9954,15 +10028,16 @@ const createAccount = (params) => __awaiter(void 0, void 0, void 0, function* () var account = /*#__PURE__*/Object.freeze({ __proto__: null, - serviceDiscovery: serviceDiscovery, - fetchPrincipalUrl: fetchPrincipalUrl, + createAccount: createAccount, fetchHomeUrl: fetchHomeUrl, - createAccount: createAccount + fetchPrincipalUrl: fetchPrincipalUrl, + serviceDiscovery: serviceDiscovery }); var base64 = {exports: {}}; /*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */ +base64.exports; (function (module, exports) { (function(root) { @@ -10119,9 +10194,11 @@ var base64 = {exports: {}}; root.base64 = base64; } - }(commonjsGlobal)); + }(commonjsGlobal)); } (base64, base64.exports)); +var base64Exports = base64.exports; + const debug = getLogger('tsdav:authHelper'); /** * Provide given params as default params to given function with optional params. @@ -10133,9 +10210,9 @@ const defaultParam = (fn, params) => (...args) => { return fn(Object.assign(Object.assign({}, params), args[0])); }; const getBasicAuthHeaders = (credentials) => { - debug(`Basic auth token generated: ${base64.exports.encode(`${credentials.username}:${credentials.password}`)}`); + debug(`Basic auth token generated: ${base64Exports.encode(`${credentials.username}:${credentials.password}`)}`); return { - authorization: `Basic ${base64.exports.encode(`${credentials.username}:${credentials.password}`)}`, + authorization: `Basic ${base64Exports.encode(`${credentials.username}:${credentials.password}`)}`, }; }; const fetchOauthTokens = (credentials) => __awaiter(void 0, void 0, void 0, function* () { @@ -10158,7 +10235,7 @@ const fetchOauthTokens = (credentials) => __awaiter(void 0, void 0, void 0, func }); debug(credentials.tokenUrl); debug(param.toString()); - const response = yield browserPonyfill.exports.fetch(credentials.tokenUrl, { + const response = yield browserPonyfillExports.fetch(credentials.tokenUrl, { method: 'POST', body: param.toString(), headers: { @@ -10189,7 +10266,7 @@ const refreshAccessToken = (credentials) => __awaiter(void 0, void 0, void 0, fu refresh_token: credentials.refreshToken, grant_type: 'refresh_token', }); - const response = yield browserPonyfill.exports.fetch(credentials.tokenUrl, { + const response = yield browserPonyfillExports.fetch(credentials.tokenUrl, { method: 'POST', body: param.toString(), headers: { @@ -10230,10 +10307,10 @@ const getOauthHeaders = (credentials) => __awaiter(void 0, void 0, void 0, funct var authHelpers = /*#__PURE__*/Object.freeze({ __proto__: null, defaultParam: defaultParam, - getBasicAuthHeaders: getBasicAuthHeaders, fetchOauthTokens: fetchOauthTokens, - refreshAccessToken: refreshAccessToken, - getOauthHeaders: getOauthHeaders + getBasicAuthHeaders: getBasicAuthHeaders, + getOauthHeaders: getOauthHeaders, + refreshAccessToken: refreshAccessToken }); // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types @@ -10544,8 +10621,8 @@ class DAVClient { var client = /*#__PURE__*/Object.freeze({ __proto__: null, - createDAVClient: createDAVClient, - DAVClient: DAVClient + DAVClient: DAVClient, + createDAVClient: createDAVClient }); var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ DAVNamespace, diff --git a/dist/tsdav.min.cjs b/dist/tsdav.min.cjs new file mode 100644 index 0000000..d2fc9a8 --- /dev/null +++ b/dist/tsdav.min.cjs @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("cross-fetch"),r=require("debug"),o=require("xml-js"),a=require("base-64");function s(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a{const t=Number(e);if(!Number.isNaN(t))return t;const r=e.toLowerCase();return"true"===r||"false"!==r&&e},u=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),o=t.trim();if(Math.abs(r.length-o.length)>1)return!1;const a="/"===r.slice(-1)?r.slice(0,-1):r,s="/"===o.slice(-1)?o.slice(0,-1):o;return e.includes(s)||t.includes(a)},p=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),o=t.trim(),a="/"===r.slice(-1)?r.slice(0,-1):r,s="/"===o.slice(-1)?o.slice(0,-1):o;return e.includes(s)||t.includes(a)},h=e=>e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[d[t]]:t})),{}),v=e=>Object.entries(e).reduce(((e,[t,r])=>r?Object.assign(Object.assign({},e),{[t]:r}):e),{});var f=Object.freeze({__proto__:null,cleanupFalsy:v,getDAVAttribute:h,urlContains:p,urlEquals:u});const m=r("tsdav:request"),A=e=>n(void 0,void 0,void 0,(function*(){var r;const{url:a,init:s,convertIncoming:n=!0,parseOutgoing:d=!0}=e,{headers:i={},body:c,namespace:u,method:p,attributes:h}=s,f=n?o.js2xml(Object.assign(Object.assign({_declaration:{_attributes:{version:"1.0",encoding:"utf-8"}}},c),{_attributes:h}),{compact:!0,spaces:2,elementNameFn:e=>u&&!/^.+:.+/.test(e)?`${u}:${e}`:e}):c,A=yield t.fetch(a,{headers:Object.assign({"Content-Type":"text/xml;charset=UTF-8"},v(i)),body:f,method:p}),D=yield A.text();if(!A.ok||!(null===(r=A.headers.get("content-type"))||void 0===r?void 0:r.includes("xml"))||!d)return[{href:A.url,ok:A.ok,status:A.status,statusText:A.statusText,raw:D}];const y=o.xml2js(D,{compact:!0,trim:!0,textFn:(e,t)=>{try{const r=t._parent,o=Object.keys(r),a=o[o.length-1],s=r[a];if(s.length>0){s[s.length-1]=l(e)}else r[a]=l(e)}catch(e){m(e.stack)}},elementNameFn:e=>e.replace(/^.+:/,"").replace(/([-_]\w)/g,(e=>e[1].toUpperCase())),attributesFn:e=>{const t=Object.assign({},e);return delete t.xmlns,t},ignoreDeclaration:!0});return(Array.isArray(y.multistatus.response)?y.multistatus.response:[y.multistatus.response]).map((e=>{var t,r;if(!e)return{status:A.status,statusText:A.statusText,ok:A.ok};const o=/^\S+\s(?\d+)\s(?.+)$/.exec(e.status);return{raw:y,href:e.href,status:(null==o?void 0:o.groups)?Number.parseInt(null==o?void 0:o.groups.status,10):A.status,statusText:null!==(r=null===(t=null==o?void 0:o.groups)||void 0===t?void 0:t.statusText)&&void 0!==r?r:A.statusText,ok:!e.error,error:e.error,responsedescription:e.responsedescription,props:(Array.isArray(e.propstat)?e.propstat:[e.propstat]).reduce(((e,t)=>Object.assign(Object.assign({},e),null==t?void 0:t.prop)),{})}}))})),D=e=>n(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:o,headers:a}=e;return A({url:t,init:{method:"PROPFIND",headers:v(Object.assign({depth:o},a)),namespace:exports.DAVNamespaceShort.DAV,body:{propfind:{_attributes:h([exports.DAVNamespace.CALDAV,exports.DAVNamespace.CALDAV_APPLE,exports.DAVNamespace.CALENDAR_SERVER,exports.DAVNamespace.CARDDAV,exports.DAVNamespace.DAV]),prop:r}}}})})),y=e=>n(void 0,void 0,void 0,(function*(){const{url:r,data:o,headers:a}=e;return t.fetch(r,{method:"PUT",body:o,headers:a})})),g=e=>n(void 0,void 0,void 0,(function*(){const{url:r,data:o,etag:a,headers:s}=e;return t.fetch(r,{method:"PUT",body:o,headers:v(Object.assign({"If-Match":a},s))})})),V=e=>n(void 0,void 0,void 0,(function*(){const{url:r,headers:o,etag:a}=e;return t.fetch(r,{method:"DELETE",headers:v(Object.assign({"If-Match":a},o))})}));var b=Object.freeze({__proto__:null,createObject:y,davRequest:A,deleteObject:V,propfind:D,updateObject:g});function x(e,t){const r=e=>t.every((t=>e[t]));return Array.isArray(e)?e.every((e=>r(e))):r(e)}const O=(e,t)=>t.reduce(((t,r)=>e[r]?t:`${t.length?`${t},`:""}${r.toString()}`),""),C=r("tsdav:collection"),j=e=>n(void 0,void 0,void 0,(function*(){const{url:t,body:r,depth:o,defaultNamespace:a=exports.DAVNamespaceShort.DAV,headers:s}=e,n=yield A({url:t,init:{method:"REPORT",headers:v(Object.assign({depth:o},s)),namespace:a,body:r}});return 1!==n.length||n[0].raw?n:[]})),S=e=>n(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:o,headers:a}=e;return A({url:t,init:{method:"MKCOL",headers:v(Object.assign({depth:o},a)),namespace:exports.DAVNamespaceShort.DAV,body:r?{mkcol:{set:{prop:r}}}:void 0}})})),N=e=>n(void 0,void 0,void 0,(function*(){var t,r,o,a,s;const{collection:n,headers:d}=e;return null!==(s=null===(a=null===(o=null===(r=null===(t=(yield D({url:n.url,props:{[`${exports.DAVNamespaceShort.DAV}:supported-report-set`]:{}},depth:"0",headers:d}))[0])||void 0===t?void 0:t.props)||void 0===r?void 0:r.supportedReportSet)||void 0===o?void 0:o.supportedReport)||void 0===a?void 0:a.map((e=>Object.keys(e.report)[0])))&&void 0!==s?s:[]})),$=e=>n(void 0,void 0,void 0,(function*(){var t,r,o;const{collection:a,headers:s}=e,n=(yield D({url:a.url,props:{[`${exports.DAVNamespaceShort.CALENDAR_SERVER}:getctag`]:{}},depth:"0",headers:s})).filter((e=>p(a.url,e.href)))[0];if(!n)throw new Error("Collection does not exist on server");return{isDirty:a.ctag!==(null===(t=n.props)||void 0===t?void 0:t.getctag),newCtag:null===(o=null===(r=n.props)||void 0===r?void 0:r.getctag)||void 0===o?void 0:o.toString()}})),k=e=>{const{url:t,props:r,headers:o,syncLevel:a,syncToken:s}=e;return A({url:t,init:{method:"REPORT",namespace:exports.DAVNamespaceShort.DAV,headers:Object.assign({},o),body:{"sync-collection":{_attributes:h([exports.DAVNamespace.CALDAV,exports.DAVNamespace.CARDDAV,exports.DAVNamespace.DAV]),"sync-level":a,"sync-token":s,[`${exports.DAVNamespaceShort.DAV}:prop`]:r}}}})},w=e=>n(void 0,void 0,void 0,(function*(){var t,r,o,a,s,n,d,i,c,l,u;const{collection:h,method:v,headers:f,account:m,detailedResult:A}=e,D=["accountType","homeUrl"];if(!m||!x(m,D)){if(!m)throw new Error("no account for smartCollectionSync");throw new Error(`account must have ${O(m,D)} before smartCollectionSync`)}const y=null!=v?v:(null===(t=h.reports)||void 0===t?void 0:t.includes("syncCollection"))?"webdav":"basic";if(C(`smart collection sync with type ${m.accountType} and method ${y}`),"webdav"===y){const e=yield k({url:h.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:{},[`${"caldav"===m.accountType?exports.DAVNamespaceShort.CALDAV:exports.DAVNamespaceShort.CARDDAV}:${"caldav"===m.accountType?"calendar-data":"address-data"}`]:{},[`${exports.DAVNamespaceShort.DAV}:displayname`]:{}},syncLevel:1,syncToken:h.syncToken,headers:f}),t=e.filter((e=>{var t;const r="caldav"===m.accountType?".ics":".vcf";return(null===(t=e.href)||void 0===t?void 0:t.slice(-4))===r})),c=t.filter((e=>404!==e.status)).map((e=>e.href)),l=t.filter((e=>404===e.status)).map((e=>e.href)),u=(c.length&&null!==(o=yield null===(r=null==h?void 0:h.objectMultiGet)||void 0===r?void 0:r.call(h,{url:h.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:{},[`${"caldav"===m.accountType?exports.DAVNamespaceShort.CALDAV:exports.DAVNamespaceShort.CARDDAV}:${"caldav"===m.accountType?"calendar-data":"address-data"}`]:{}},objectUrls:c,depth:"1",headers:f}))&&void 0!==o?o:[]).map((e=>{var t,r,o,a,s,n,d,i,c,l;return{url:null!==(t=e.href)&&void 0!==t?t:"",etag:null===(r=e.props)||void 0===r?void 0:r.getetag,data:"caldav"===(null==m?void 0:m.accountType)?null!==(s=null===(a=null===(o=e.props)||void 0===o?void 0:o.calendarData)||void 0===a?void 0:a._cdata)&&void 0!==s?s:null===(n=e.props)||void 0===n?void 0:n.calendarData:null!==(c=null===(i=null===(d=e.props)||void 0===d?void 0:d.addressData)||void 0===i?void 0:i._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.addressData}})),v=null!==(a=h.objects)&&void 0!==a?a:[],D=u.filter((e=>v.every((t=>!p(t.url,e.url))))),y=v.reduce(((e,t)=>{const r=u.find((e=>p(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),g=l.map((e=>({url:e,etag:""}))),V=v.filter((e=>u.some((t=>p(e.url,t.url)&&t.etag===e.etag))));return Object.assign(Object.assign({},h),{objects:A?{created:D,updated:y,deleted:g}:[...V,...D,...y],syncToken:null!==(i=null===(d=null===(n=null===(s=e[0])||void 0===s?void 0:s.raw)||void 0===n?void 0:n.multistatus)||void 0===d?void 0:d.syncToken)&&void 0!==i?i:h.syncToken})}if("basic"===y){const{isDirty:e,newCtag:t}=yield $({collection:h,headers:f}),r=null!==(c=h.objects)&&void 0!==c?c:[],o=null!==(u=yield null===(l=h.fetchObjects)||void 0===l?void 0:l.call(h,{collection:h,headers:f}))&&void 0!==u?u:[],a=o.filter((e=>r.every((t=>!p(t.url,e.url))))),s=r.reduce(((e,t)=>{const r=o.find((e=>p(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),n=r.filter((e=>o.every((t=>!p(t.url,e.url))))),d=r.filter((e=>o.some((t=>p(e.url,t.url)&&t.etag===e.etag))));if(e)return Object.assign(Object.assign({},h),{objects:A?{created:a,updated:s,deleted:n}:[...d,...a,...s],ctag:t})}return A?Object.assign(Object.assign({},h),{objects:{created:[],updated:[],deleted:[]}}):h}));var _=Object.freeze({__proto__:null,collectionQuery:j,isCollectionDirty:$,makeCollection:S,smartCollectionSync:w,supportedReportSet:N,syncCollection:k});const R=r("tsdav:addressBook"),U=e=>n(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:o,depth:a,headers:s}=e;return j({url:t,body:{"addressbook-query":{_attributes:h([exports.DAVNamespace.CARDDAV,exports.DAVNamespace.DAV]),[`${exports.DAVNamespaceShort.DAV}:prop`]:r,filter:null!=o?o:{"prop-filter":{_attributes:{name:"FN"}}}}},defaultNamespace:exports.DAVNamespaceShort.CARDDAV,depth:a,headers:s})})),T=e=>n(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:o,depth:a,headers:s}=e;return j({url:t,body:{"addressbook-multiget":{_attributes:h([exports.DAVNamespace.DAV,exports.DAVNamespace.CARDDAV]),[`${exports.DAVNamespaceShort.DAV}:prop`]:r,[`${exports.DAVNamespaceShort.DAV}:href`]:o}},defaultNamespace:exports.DAVNamespaceShort.CARDDAV,depth:a,headers:s})})),E=e=>n(void 0,void 0,void 0,(function*(){const{account:t,headers:r,props:o}=null!=e?e:{},a=["homeUrl","rootUrl"];if(!t||!x(t,a)){if(!t)throw new Error("no account for fetchAddressBooks");throw new Error(`account must have ${O(t,a)} before fetchAddressBooks`)}const s=yield D({url:t.homeUrl,props:null!=o?o:{[`${exports.DAVNamespaceShort.DAV}:displayname`]:{},[`${exports.DAVNamespaceShort.CALENDAR_SERVER}:getctag`]:{},[`${exports.DAVNamespaceShort.DAV}:resourcetype`]:{},[`${exports.DAVNamespaceShort.DAV}:sync-token`]:{}},depth:"1",headers:r});return Promise.all(s.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("addressbook")})).map((e=>{var r,o,a,s,n,d,i,c,l;const u=null!==(a=null===(o=null===(r=e.props)||void 0===r?void 0:r.displayname)||void 0===o?void 0:o._cdata)&&void 0!==a?a:null===(s=e.props)||void 0===s?void 0:s.displayname;return R(`Found address book named ${"string"==typeof u?u:""},\n props: ${JSON.stringify(e.props)}`),{url:new URL(null!==(n=e.href)&&void 0!==n?n:"",null!==(d=t.rootUrl)&&void 0!==d?d:"").href,ctag:null===(i=e.props)||void 0===i?void 0:i.getctag,displayName:"string"==typeof u?u:"",resourcetype:Object.keys(null===(c=e.props)||void 0===c?void 0:c.resourcetype),syncToken:null===(l=e.props)||void 0===l?void 0:l.syncToken}})).map((e=>n(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield N({collection:e,headers:r})})})))))})),L=e=>n(void 0,void 0,void 0,(function*(){const{addressBook:t,headers:r,objectUrls:o,urlFilter:a=(e=>e),useMultiGet:s=!0}=e;R(`Fetching vcards from ${null==t?void 0:t.url}`);const n=["url"];if(!t||!x(t,n)){if(!t)throw new Error("cannot fetchVCards for undefined addressBook");throw new Error(`addressBook must have ${O(t,n)} before fetchVCards`)}const d=(null!=o?o:(yield U({url:t.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:{}},depth:"1",headers:r})).map((e=>{var t;return e.ok&&null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(a).map((e=>new URL(e).pathname));let i=[];return d.length>0&&(i=s?yield T({url:t.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:{},[`${exports.DAVNamespaceShort.CARDDAV}:address-data`]:{}},objectUrls:d,depth:"1",headers:r}):yield U({url:t.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:{},[`${exports.DAVNamespaceShort.CARDDAV}:address-data`]:{}},depth:"1",headers:r})),i.map((e=>{var r,o,a,s,n,d;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:null===(o=e.props)||void 0===o?void 0:o.getetag,data:null!==(n=null===(s=null===(a=e.props)||void 0===a?void 0:a.addressData)||void 0===s?void 0:s._cdata)&&void 0!==n?n:null===(d=e.props)||void 0===d?void 0:d.addressData}}))})),P=e=>n(void 0,void 0,void 0,(function*(){const{addressBook:t,vCardString:r,filename:o,headers:a}=e;return y({url:new URL(o,t.url).href,data:r,headers:Object.assign({"content-type":"text/vcard; charset=utf-8","If-None-Match":"*"},a)})})),H=e=>n(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return g({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/vcard; charset=utf-8"},r)})})),B=e=>n(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return V({url:t.url,etag:t.etag,headers:r})}));var M=Object.freeze({__proto__:null,addressBookMultiGet:T,addressBookQuery:U,createVCard:P,deleteVCard:B,fetchAddressBooks:E,fetchVCards:L,updateVCard:H});const I=r("tsdav:calendar"),F=e=>n(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:o,timezone:a,depth:s,headers:n}=e;return j({url:t,body:{"calendar-query":v({_attributes:h([exports.DAVNamespace.CALDAV,exports.DAVNamespace.CALENDAR_SERVER,exports.DAVNamespace.CALDAV_APPLE,exports.DAVNamespace.DAV]),[`${exports.DAVNamespaceShort.DAV}:prop`]:r,filter:o,timezone:a})},defaultNamespace:exports.DAVNamespaceShort.CALDAV,depth:s,headers:n})})),z=e=>n(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:o,filters:a,timezone:s,depth:n,headers:d}=e;return j({url:t,body:{"calendar-multiget":{_attributes:h([exports.DAVNamespace.DAV,exports.DAVNamespace.CALDAV]),[`${exports.DAVNamespaceShort.DAV}:prop`]:r,[`${exports.DAVNamespaceShort.DAV}:href`]:o,filter:a,timezone:s}},defaultNamespace:exports.DAVNamespaceShort.CALDAV,depth:n,headers:d})})),Z=e=>n(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:o,headers:a}=e;return A({url:t,init:{method:"MKCALENDAR",headers:v(Object.assign({depth:o},a)),namespace:exports.DAVNamespaceShort.DAV,body:{[`${exports.DAVNamespaceShort.CALDAV}:mkcalendar`]:{_attributes:h([exports.DAVNamespace.DAV,exports.DAVNamespace.CALDAV,exports.DAVNamespace.CALDAV_APPLE]),set:{prop:r}}}}})})),q=e=>n(void 0,void 0,void 0,(function*(){const{headers:t,account:r,props:o}=null!=e?e:{},a=["homeUrl","rootUrl"];if(!r||!x(r,a)){if(!r)throw new Error("no account for fetchCalendars");throw new Error(`account must have ${O(r,a)} before fetchCalendars`)}const s=yield D({url:r.homeUrl,props:null!=o?o:{[`${exports.DAVNamespaceShort.CALDAV}:calendar-description`]:{},[`${exports.DAVNamespaceShort.CALDAV}:calendar-timezone`]:{},[`${exports.DAVNamespaceShort.DAV}:displayname`]:{},[`${exports.DAVNamespaceShort.CALDAV_APPLE}:calendar-color`]:{},[`${exports.DAVNamespaceShort.CALENDAR_SERVER}:getctag`]:{},[`${exports.DAVNamespaceShort.DAV}:resourcetype`]:{},[`${exports.DAVNamespaceShort.CALDAV}:supported-calendar-component-set`]:{},[`${exports.DAVNamespaceShort.DAV}:sync-token`]:{}},depth:"1",headers:t});return Promise.all(s.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("calendar")})).filter((e=>{var t,r,o;return(Array.isArray(null===(t=e.props)||void 0===t?void 0:t.supportedCalendarComponentSet.comp)?null===(r=e.props)||void 0===r?void 0:r.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(o=e.props)||void 0===o?void 0:o.supportedCalendarComponentSet.comp._attributes.name]||[]).some((e=>Object.values(c).includes(e)))})).map((e=>{var t,o,a,s,n,d,i,c,l,u,p,h,v,f;const m=null===(t=e.props)||void 0===t?void 0:t.calendarDescription,A=null===(o=e.props)||void 0===o?void 0:o.calendarTimezone;return{description:"string"==typeof m?m:"",timezone:"string"==typeof A?A:"",url:new URL(null!==(a=e.href)&&void 0!==a?a:"",null!==(s=r.rootUrl)&&void 0!==s?s:"").href,ctag:null===(n=e.props)||void 0===n?void 0:n.getctag,calendarColor:null===(d=e.props)||void 0===d?void 0:d.calendarColor,displayName:null!==(c=null===(i=e.props)||void 0===i?void 0:i.displayname._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.displayname,components:Array.isArray(null===(u=e.props)||void 0===u?void 0:u.supportedCalendarComponentSet.comp)?null===(p=e.props)||void 0===p?void 0:p.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(h=e.props)||void 0===h?void 0:h.supportedCalendarComponentSet.comp._attributes.name],resourcetype:Object.keys(null===(v=e.props)||void 0===v?void 0:v.resourcetype),syncToken:null===(f=e.props)||void 0===f?void 0:f.syncToken}})).map((e=>n(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield N({collection:e,headers:t})})})))))})),Q=e=>n(void 0,void 0,void 0,(function*(){const{calendar:t,objectUrls:r,filters:o,timeRange:a,headers:s,expand:n,urlFilter:d=(e=>Boolean(null==e?void 0:e.includes(".ics"))),useMultiGet:i=!0}=e;if(a){const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(a.start)&&e.test(a.end)||t.test(a.start)&&t.test(a.end)))throw new Error("invalid timeRange format, not in ISO8601")}I(`Fetching calendar objects from ${null==t?void 0:t.url}`);const c=["url"];if(!t||!x(t,c)){if(!t)throw new Error("cannot fetchCalendarObjects for undefined calendar");throw new Error(`calendar must have ${O(t,c)} before fetchCalendarObjects`)}const l=null!=o?o:[{"comp-filter":{_attributes:{name:"VCALENDAR"},"comp-filter":Object.assign({_attributes:{name:"VEVENT"}},a?{"time-range":{_attributes:{start:`${new Date(a.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(a.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})}}],u=(null!=r?r:(yield F({url:t.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:Object.assign({},n&&a?{[`${exports.DAVNamespaceShort.CALDAV}:expand`]:{_attributes:{start:`${new Date(a.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(a.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:l,depth:"1",headers:s})).map((e=>{var t;return null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(d).map((e=>new URL(e).pathname));let p=[];return u.length>0&&(p=!i||n?yield F({url:t.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:{},[`${exports.DAVNamespaceShort.CALDAV}:calendar-data`]:Object.assign({},n&&a?{[`${exports.DAVNamespaceShort.CALDAV}:expand`]:{_attributes:{start:`${new Date(a.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(a.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:l,depth:"1",headers:s}):yield z({url:t.url,props:{[`${exports.DAVNamespaceShort.DAV}:getetag`]:{},[`${exports.DAVNamespaceShort.CALDAV}:calendar-data`]:Object.assign({},n&&a?{[`${exports.DAVNamespaceShort.CALDAV}:expand`]:{_attributes:{start:`${new Date(a.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(a.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},objectUrls:u,depth:"1",headers:s})),p.map((e=>{var r,o,a,s,n,d;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:`${null===(o=e.props)||void 0===o?void 0:o.getetag}`,data:null!==(n=null===(s=null===(a=e.props)||void 0===a?void 0:a.calendarData)||void 0===s?void 0:s._cdata)&&void 0!==n?n:null===(d=e.props)||void 0===d?void 0:d.calendarData}}))})),G=e=>n(void 0,void 0,void 0,(function*(){const{calendar:t,iCalString:r,filename:o,headers:a}=e;return y({url:new URL(o,t.url).href,data:r,headers:Object.assign({"content-type":"text/calendar; charset=utf-8","If-None-Match":"*"},a)})})),J=e=>n(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return g({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/calendar; charset=utf-8"},r)})})),K=e=>n(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return V({url:t.url,etag:t.etag,headers:r})})),W=e=>n(void 0,void 0,void 0,(function*(){var t;const{oldCalendars:r,account:o,detailedResult:a,headers:s}=e;if(!o)throw new Error("Must have account before syncCalendars");const d=null!==(t=null!=r?r:o.calendars)&&void 0!==t?t:[],i=yield q({account:o,headers:s}),c=i.filter((e=>d.every((t=>!p(t.url,e.url)))));I(`new calendars: ${c.map((e=>e.displayName))}`);const l=d.reduce(((e,t)=>{const r=i.find((e=>p(e.url,t.url)));return r&&(r.syncToken&&r.syncToken!==t.syncToken||r.ctag&&r.ctag!==t.ctag)?[...e,r]:e}),[]);I(`updated calendars: ${l.map((e=>e.displayName))}`);const u=yield Promise.all(l.map((e=>n(void 0,void 0,void 0,(function*(){return yield w({collection:Object.assign(Object.assign({},e),{objectMultiGet:z}),method:"webdav",headers:s,account:o})}))))),h=d.filter((e=>i.every((t=>!p(t.url,e.url)))));I(`deleted calendars: ${h.map((e=>e.displayName))}`);const v=d.filter((e=>i.some((t=>p(t.url,e.url)&&(t.syncToken&&t.syncToken!==e.syncToken||t.ctag&&t.ctag!==e.ctag)))));return a?{created:c,updated:l,deleted:h}:[...v,...c,...u]})),Y=e=>n(void 0,void 0,void 0,(function*(){const{url:t,timeRange:r,depth:o,headers:a}=e;if(!r)throw new Error("timeRange is required");{const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(r.start)&&e.test(r.end)||t.test(r.start)&&t.test(r.end)))throw new Error("invalid timeRange format, not in ISO8601")}return(yield j({url:t,body:{"free-busy-query":v({_attributes:h([exports.DAVNamespace.CALDAV]),[`${exports.DAVNamespaceShort.CALDAV}:time-range`]:{_attributes:{start:`${new Date(r.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(r.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}})},defaultNamespace:exports.DAVNamespaceShort.CALDAV,depth:o,headers:a}))[0]}));var X=Object.freeze({__proto__:null,calendarMultiGet:z,calendarQuery:F,createCalendarObject:G,deleteCalendarObject:K,fetchCalendarObjects:Q,fetchCalendars:q,freeBusyQuery:Y,makeCalendar:Z,syncCalendars:W,updateCalendarObject:J});const ee=r("tsdav:account"),te=e=>n(void 0,void 0,void 0,(function*(){var r,o;ee("Service discovery...");const{account:a,headers:s}=e,n=new URL(a.serverUrl),d=new URL(`/.well-known/${a.accountType}`,n);d.protocol=null!==(r=n.protocol)&&void 0!==r?r:"http";try{const e=yield t.fetch(d.href,{headers:s,method:"PROPFIND",redirect:"manual"});if(e.status>=300&&e.status<400){const t=e.headers.get("Location");if("string"==typeof t&&t.length){ee(`Service discovery redirected to ${t}`);const e=new URL(t,n);return e.hostname===d.hostname&&d.port&&!e.port&&(e.port=d.port),e.protocol=null!==(o=n.protocol)&&void 0!==o?o:"http",e.href}}}catch(e){ee(`Service discovery failed: ${e.stack}`)}return n.href})),re=e=>n(void 0,void 0,void 0,(function*(){var t,r,o,a,s;const{account:n,headers:d}=e,i=["rootUrl"];if(!x(n,i))throw new Error(`account must have ${O(n,i)} before fetchPrincipalUrl`);ee(`Fetching principal url from path ${n.rootUrl}`);const[c]=yield D({url:n.rootUrl,props:{[`${exports.DAVNamespaceShort.DAV}:current-user-principal`]:{}},depth:"0",headers:d});if(!c.ok&&(ee(`Fetch principal url failed: ${c.statusText}`),401===c.status))throw new Error("Invalid credentials");return ee(`Fetched principal url ${null===(r=null===(t=c.props)||void 0===t?void 0:t.currentUserPrincipal)||void 0===r?void 0:r.href}`),new URL(null!==(s=null===(a=null===(o=c.props)||void 0===o?void 0:o.currentUserPrincipal)||void 0===a?void 0:a.href)&&void 0!==s?s:"",n.rootUrl).href})),oe=e=>n(void 0,void 0,void 0,(function*(){var t,r;const{account:o,headers:a}=e,s=["principalUrl","rootUrl"];if(!x(o,s))throw new Error(`account must have ${O(o,s)} before fetchHomeUrl`);ee(`Fetch home url from ${o.principalUrl}`);const n=(yield D({url:o.principalUrl,props:"caldav"===o.accountType?{[`${exports.DAVNamespaceShort.CALDAV}:calendar-home-set`]:{}}:{[`${exports.DAVNamespaceShort.CARDDAV}:addressbook-home-set`]:{}},depth:"0",headers:a})).find((e=>p(o.principalUrl,e.href)));if(!n||!n.ok)throw new Error("cannot find homeUrl");const d=new URL("caldav"===o.accountType?null===(t=null==n?void 0:n.props)||void 0===t?void 0:t.calendarHomeSet.href:null===(r=null==n?void 0:n.props)||void 0===r?void 0:r.addressbookHomeSet.href,o.rootUrl).href;return ee(`Fetched home url ${d}`),d})),ae=e=>n(void 0,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:o=!1,loadObjects:a=!1}=e,s=Object.assign({},t);return s.rootUrl=yield te({account:t,headers:r}),s.principalUrl=yield re({account:s,headers:r}),s.homeUrl=yield oe({account:s,headers:r}),(o||a)&&("caldav"===t.accountType?s.calendars=yield q({headers:r,account:s}):"carddav"===t.accountType&&(s.addressBooks=yield E({headers:r,account:s}))),a&&("caldav"===t.accountType&&s.calendars?s.calendars=yield Promise.all(s.calendars.map((e=>n(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield Q({calendar:e,headers:r})})}))))):"carddav"===t.accountType&&s.addressBooks&&(s.addressBooks=yield Promise.all(s.addressBooks.map((e=>n(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield L({addressBook:e,headers:r})})}))))))),s}));var se=Object.freeze({__proto__:null,createAccount:ae,fetchHomeUrl:oe,fetchPrincipalUrl:re,serviceDiscovery:te});const ne=r("tsdav:authHelper"),de=(e,t)=>(...r)=>e(Object.assign(Object.assign({},t),r[0])),ie=e=>(ne(`Basic auth token generated: ${a.encode(`${e.username}:${e.password}`)}`),{authorization:`Basic ${a.encode(`${e.username}:${e.password}`)}`}),ce=e=>n(void 0,void 0,void 0,(function*(){const r=["authorizationCode","redirectUrl","clientId","clientSecret","tokenUrl"];if(!x(e,r))throw new Error(`Oauth credentials missing: ${O(e,r)}`);const o=new URLSearchParams({grant_type:"authorization_code",code:e.authorizationCode,redirect_uri:e.redirectUrl,client_id:e.clientId,client_secret:e.clientSecret});ne(e.tokenUrl),ne(o.toString());const a=yield t.fetch(e.tokenUrl,{method:"POST",body:o.toString(),headers:{"content-length":`${o.toString().length}`,"content-type":"application/x-www-form-urlencoded"}});if(a.ok){return yield a.json()}return ne(`Fetch Oauth tokens failed: ${yield a.text()}`),{}})),le=e=>n(void 0,void 0,void 0,(function*(){const r=["refreshToken","clientId","clientSecret","tokenUrl"];if(!x(e,r))throw new Error(`Oauth credentials missing: ${O(e,r)}`);const o=new URLSearchParams({client_id:e.clientId,client_secret:e.clientSecret,refresh_token:e.refreshToken,grant_type:"refresh_token"}),a=yield t.fetch(e.tokenUrl,{method:"POST",body:o.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(a.ok){return yield a.json()}return ne(`Refresh access token failed: ${yield a.text()}`),{}})),ue=e=>n(void 0,void 0,void 0,(function*(){var t;ne("Fetching oauth headers");let r={};return e.refreshToken?(e.refreshToken&&!e.accessToken||Date.now()>(null!==(t=e.expiration)&&void 0!==t?t:0))&&(r=yield le(e)):r=yield ce(e),ne(`Oauth tokens fetched: ${r.access_token}`),{tokens:r,headers:{authorization:`Bearer ${r.access_token}`}}}));var pe=Object.freeze({__proto__:null,defaultParam:de,fetchOauthTokens:ce,getBasicAuthHeaders:ie,getOauthHeaders:ue,refreshAccessToken:le});const he=e=>n(void 0,void 0,void 0,(function*(){const{serverUrl:t,credentials:r,authMethod:o,defaultAccountType:a}=e,d="Basic"===o?ie(r):"Oauth"===o?(yield ue(r)).headers:{},i=a?yield ae({account:{serverUrl:t,credentials:r,accountType:a},headers:d}):void 0,c=de(y,{url:t,headers:d}),l=de(g,{headers:d,url:t}),u=de(V,{headers:d,url:t}),p=de(D,{headers:d}),h=de(j,{headers:d}),v=de(S,{headers:d}),f=de(k,{headers:d}),m=de(N,{headers:d}),b=de($,{headers:d}),x=de(w,{headers:d,account:i}),O=de(F,{headers:d}),C=de(z,{headers:d}),_=de(Z,{headers:d}),R=de(q,{headers:d,account:i}),M=de(Q,{headers:d}),I=de(G,{headers:d}),Y=de(J,{headers:d}),X=de(K,{headers:d}),ee=de(W,{account:i,headers:d}),te=de(U,{headers:d}),re=de(T,{headers:d});return{davRequest:e=>n(void 0,void 0,void 0,(function*(){const{init:t}=e,r=s(e,["init"]),{headers:o}=t,a=s(t,["headers"]);return A(Object.assign(Object.assign({},r),{init:Object.assign(Object.assign({},a),{headers:Object.assign(Object.assign({},d),o)})}))})),propfind:p,createAccount:e=>n(void 0,void 0,void 0,(function*(){const{account:o,headers:a,loadCollections:s,loadObjects:n}=e;return ae({account:Object.assign({serverUrl:t,credentials:r},o),headers:Object.assign(Object.assign({},d),a),loadCollections:s,loadObjects:n})})),createObject:c,updateObject:l,deleteObject:u,calendarQuery:O,addressBookQuery:te,collectionQuery:h,makeCollection:v,calendarMultiGet:C,makeCalendar:_,syncCollection:f,supportedReportSet:m,isCollectionDirty:b,smartCollectionSync:x,fetchCalendars:R,fetchCalendarObjects:M,createCalendarObject:I,updateCalendarObject:Y,deleteCalendarObject:X,syncCalendars:ee,fetchAddressBooks:de(E,{account:i,headers:d}),addressBookMultiGet:re,fetchVCards:de(L,{headers:d}),createVCard:de(P,{headers:d}),updateVCard:de(H,{headers:d}),deleteVCard:de(B,{headers:d})}}));class ve{constructor(e){var t,r;this.serverUrl=e.serverUrl,this.credentials=e.credentials,this.authMethod=null!==(t=e.authMethod)&&void 0!==t?t:"Basic",this.accountType=null!==(r=e.defaultAccountType)&&void 0!==r?r:"caldav"}login(){return n(this,void 0,void 0,(function*(){this.authHeaders="Basic"===this.authMethod?ie(this.credentials):"Oauth"===this.authMethod?(yield ue(this.credentials)).headers:{},this.account=this.accountType?yield ae({account:{serverUrl:this.serverUrl,credentials:this.credentials,accountType:this.accountType},headers:this.authHeaders}):void 0}))}davRequest(e){return n(this,void 0,void 0,(function*(){const{init:t}=e,r=s(e,["init"]),{headers:o}=t,a=s(t,["headers"]);return A(Object.assign(Object.assign({},r),{init:Object.assign(Object.assign({},a),{headers:Object.assign(Object.assign({},this.authHeaders),o)})}))}))}createObject(...e){return n(this,void 0,void 0,(function*(){return de(y,{url:this.serverUrl,headers:this.authHeaders})(e[0])}))}updateObject(...e){return n(this,void 0,void 0,(function*(){return de(g,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}deleteObject(...e){return n(this,void 0,void 0,(function*(){return de(V,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}propfind(...e){return n(this,void 0,void 0,(function*(){return de(D,{headers:this.authHeaders})(e[0])}))}createAccount(e){return n(this,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:o,loadObjects:a}=e;return ae({account:Object.assign({serverUrl:this.serverUrl,credentials:this.credentials},t),headers:Object.assign(Object.assign({},this.authHeaders),r),loadCollections:o,loadObjects:a})}))}collectionQuery(...e){return n(this,void 0,void 0,(function*(){return de(j,{headers:this.authHeaders})(e[0])}))}makeCollection(...e){return n(this,void 0,void 0,(function*(){return de(S,{headers:this.authHeaders})(e[0])}))}syncCollection(...e){return n(this,void 0,void 0,(function*(){return de(k,{headers:this.authHeaders})(e[0])}))}supportedReportSet(...e){return n(this,void 0,void 0,(function*(){return de(N,{headers:this.authHeaders})(e[0])}))}isCollectionDirty(...e){return n(this,void 0,void 0,(function*(){return de($,{headers:this.authHeaders})(e[0])}))}smartCollectionSync(...e){return n(this,void 0,void 0,(function*(){return de(w,{headers:this.authHeaders,account:this.account})(e[0])}))}calendarQuery(...e){return n(this,void 0,void 0,(function*(){return de(F,{headers:this.authHeaders})(e[0])}))}makeCalendar(...e){return n(this,void 0,void 0,(function*(){return de(Z,{headers:this.authHeaders})(e[0])}))}calendarMultiGet(...e){return n(this,void 0,void 0,(function*(){return de(z,{headers:this.authHeaders})(e[0])}))}fetchCalendars(...e){return n(this,void 0,void 0,(function*(){return de(q,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchCalendarObjects(...e){return n(this,void 0,void 0,(function*(){return de(Q,{headers:this.authHeaders})(e[0])}))}createCalendarObject(...e){return n(this,void 0,void 0,(function*(){return de(G,{headers:this.authHeaders})(e[0])}))}updateCalendarObject(...e){return n(this,void 0,void 0,(function*(){return de(J,{headers:this.authHeaders})(e[0])}))}deleteCalendarObject(...e){return n(this,void 0,void 0,(function*(){return de(K,{headers:this.authHeaders})(e[0])}))}syncCalendars(...e){return n(this,void 0,void 0,(function*(){return de(W,{headers:this.authHeaders,account:this.account})(e[0])}))}addressBookQuery(...e){return n(this,void 0,void 0,(function*(){return de(U,{headers:this.authHeaders})(e[0])}))}addressBookMultiGet(...e){return n(this,void 0,void 0,(function*(){return de(T,{headers:this.authHeaders})(e[0])}))}fetchAddressBooks(...e){return n(this,void 0,void 0,(function*(){return de(E,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchVCards(...e){return n(this,void 0,void 0,(function*(){return de(L,{headers:this.authHeaders})(e[0])}))}createVCard(...e){return n(this,void 0,void 0,(function*(){return de(P,{headers:this.authHeaders})(e[0])}))}updateVCard(...e){return n(this,void 0,void 0,(function*(){return de(H,{headers:this.authHeaders})(e[0])}))}deleteVCard(...e){return n(this,void 0,void 0,(function*(){return de(B,{headers:this.authHeaders})(e[0])}))}}var fe=Object.freeze({__proto__:null,DAVClient:ve,createDAVClient:he}),me=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({DAVNamespace:exports.DAVNamespace,DAVNamespaceShort:exports.DAVNamespaceShort,DAVAttributeMap:d},fe),b),_),se),M),X),pe),f);exports.DAVAttributeMap=d,exports.DAVClient=ve,exports.addressBookQuery=U,exports.calendarMultiGet=z,exports.calendarQuery=F,exports.cleanupFalsy=v,exports.collectionQuery=j,exports.createAccount=ae,exports.createCalendarObject=G,exports.createDAVClient=he,exports.createObject=y,exports.createVCard=P,exports.davRequest=A,exports.default=me,exports.deleteCalendarObject=K,exports.deleteObject=V,exports.deleteVCard=B,exports.fetchAddressBooks=E,exports.fetchCalendarObjects=Q,exports.fetchCalendars=q,exports.fetchOauthTokens=ce,exports.fetchVCards=L,exports.freeBusyQuery=Y,exports.getBasicAuthHeaders=ie,exports.getDAVAttribute=h,exports.getOauthHeaders=ue,exports.isCollectionDirty=$,exports.makeCalendar=Z,exports.propfind=D,exports.refreshAccessToken=le,exports.smartCollectionSync=w,exports.supportedReportSet=N,exports.syncCalendars=W,exports.syncCollection=k,exports.updateCalendarObject=J,exports.updateObject=g,exports.updateVCard=H,exports.urlContains=p,exports.urlEquals=u; diff --git a/dist/tsdav.min.js b/dist/tsdav.min.js index 1459981..b07fb9c 100644 --- a/dist/tsdav.min.js +++ b/dist/tsdav.min.js @@ -1,18 +1,2 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -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. -***************************************************************************** */ -function e(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e,t,r,n=f(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=p(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function E(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];E.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,r){return new Promise((function(n,o){var a=new b(e,r);if(a.signal&&a.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new E(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}T.polyfill=!0,e.fetch||(e.fetch=T,e.Headers=h,e.Request=b,e.Response=E),t.Headers=h,t.Request=b,t.Response=E,t.fetch=T,Object.defineProperty(t,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(i,i.exports);var o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}var u=a,c=s;function l(e){if(u===setTimeout)return setTimeout(e,0);if((u===a||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}"function"==typeof o.setTimeout&&(u=setTimeout),"function"==typeof o.clearTimeout&&(c=clearTimeout);var d,h=[],f=!1,p=-1;function g(){f&&d&&(f=!1,d.length?h=d.concat(h):p=-1,h.length&&y())}function y(){if(!f){var e=l(g);f=!0;for(var t=h.length;t;){for(d=h,h=[];++p1)for(var r=1;r=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return S=function(s,u){u=u||{};var c=typeof s;if("string"===c&&s.length>0)return function(a){if((a=String(a)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!s)return;var u=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*o;case"weeks":case"week":case"w":return u*i;case"days":case"day":case"d":return u*n;case"hours":case"hour":case"hrs":case"hr":case"h":return u*r;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(s);if("number"===c&&isFinite(s))return u.long?function(i){var o=Math.abs(i);if(o>=n)return a(i,o,n,"day");if(o>=r)return a(i,o,r,"hour");if(o>=t)return a(i,o,t,"minute");if(o>=e)return a(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=n)return Math.round(i/n)+"d";if(o>=r)return Math.round(i/r)+"h";if(o>=t)return Math.round(i/t)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},S}var I=function(e){function t(e){let n,i,o,a=null;function s(...e){if(!s.enabled)return;const r=s,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==N&&"env"in N&&(e=N.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=I(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(L,L.exports);var k,P=L.exports;!function(e){e.CALENDAR_SERVER="http://calendarserver.org/ns/",e.CALDAV_APPLE="http://apple.com/ns/ical/",e.CALDAV="urn:ietf:params:xml:ns:caldav",e.CARDDAV="urn:ietf:params:xml:ns:carddav",e.DAV="DAV:"}(k||(k={}));const U={[k.CALDAV]:"xmlns:c",[k.CARDDAV]:"xmlns:card",[k.CALENDAR_SERVER]:"xmlns:cs",[k.CALDAV_APPLE]:"xmlns:ca",[k.DAV]:"xmlns:d"};var B,M;!function(e){e.CALDAV="c",e.CARDDAV="card",e.CALENDAR_SERVER="cs",e.CALDAV_APPLE="ca",e.DAV="d"}(B||(B={})),function(e){e.VEVENT="VEVENT",e.VTODO="VTODO",e.VJOURNAL="VJOURNAL",e.VFREEBUSY="VFREEBUSY",e.VTIMEZONE="VTIMEZONE",e.VALARM="VALARM"}(M||(M={}));var V=[],K=[],$="undefined"!=typeof Uint8Array?Uint8Array:Array,Y=!1;function H(){Y=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t>18&63]+V[i>>12&63]+V[i>>6&63]+V[63&i]);return o.join("")}function z(e){var t;Y||H();for(var r=e.length,n=r%3,i="",o=[],a=16383,s=0,u=r-n;su?u:s+a));return 1===n?(t=e[r-1],i+=V[t>>2],i+=V[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=V[t>>10],i+=V[t>>4&63],i+=V[t<<2&63],i+="="),o.push(i),o.join("")}function G(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,l=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=c}return(f?-1:1)*a*Math.pow(2,o-n)}function W(e,t,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;e[r+f]=255&a,f+=p,a/=256,c-=8);e[r+f-p]|=128*g}var Q={}.toString,X=Array.isArray||function(e){return"[object Array]"==Q.call(e)};te.TYPED_ARRAY_SUPPORT=void 0===o.TYPED_ARRAY_SUPPORT||o.TYPED_ARRAY_SUPPORT;var Z=J();function J(){return te.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ee(e,t){if(J()=J())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+J().toString(16)+" bytes");return 0|e}function se(e){return!(null==e||!e._isBuffer)}function ue(e,t){if(se(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return je(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Ie(e).length;default:if(n)return je(e).length;t=(""+t).toLowerCase(),n=!0}}function ce(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Te(this,t,r);case"utf8":case"utf-8":return we(this,t,r);case"ascii":return Ee(this,t,r);case"latin1":case"binary":return Ae(this,t,r);case"base64":return be(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _e(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function le(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function de(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=te.from(t,n)),se(t))return 0===t.length?-1:he(e,t,r,n,i);if("number"==typeof t)return t&=255,te.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):he(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function he(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var d=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function be(e,t,r){return 0===t&&r===e.length?z(e):z(e.slice(t,r))}function we(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,d=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},te.prototype.compare=function(e,t,r,n,i){if(!se(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),l=0;li)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return fe(this,e,t,r);case"utf8":case"utf-8":return pe(this,e,t,r);case"ascii":return ge(this,e,t,r);case"latin1":case"binary":return ye(this,e,t,r);case"base64":return ve(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},te.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ee(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function Oe(e,t,r,n,i,o){if(!se(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function De(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function Re(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function xe(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Se(e,t,r,n,i){return i||xe(e,0,r,4),W(e,t,r,n,23,4),r+4}function Fe(e,t,r,n,i){return i||xe(e,0,r,8),W(e,t,r,n,52,8),r+8}te.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},te.prototype.readUInt8=function(e,t){return t||Ce(e,1,this.length),this[e]},te.prototype.readUInt16LE=function(e,t){return t||Ce(e,2,this.length),this[e]|this[e+1]<<8},te.prototype.readUInt16BE=function(e,t){return t||Ce(e,2,this.length),this[e]<<8|this[e+1]},te.prototype.readUInt32LE=function(e,t){return t||Ce(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},te.prototype.readUInt32BE=function(e,t){return t||Ce(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},te.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ce(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},te.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ce(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},te.prototype.readInt8=function(e,t){return t||Ce(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},te.prototype.readInt16LE=function(e,t){t||Ce(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},te.prototype.readInt16BE=function(e,t){t||Ce(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},te.prototype.readInt32LE=function(e,t){return t||Ce(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},te.prototype.readInt32BE=function(e,t){return t||Ce(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},te.prototype.readFloatLE=function(e,t){return t||Ce(e,4,this.length),G(this,e,!0,23,4)},te.prototype.readFloatBE=function(e,t){return t||Ce(e,4,this.length),G(this,e,!1,23,4)},te.prototype.readDoubleLE=function(e,t){return t||Ce(e,8,this.length),G(this,e,!0,52,8)},te.prototype.readDoubleBE=function(e,t){return t||Ce(e,8,this.length),G(this,e,!1,52,8)},te.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Oe(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},te.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,1,255,0),te.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},te.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,2,65535,0),te.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):De(this,e,t,!0),t+2},te.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,2,65535,0),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):De(this,e,t,!1),t+2},te.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,4,4294967295,0),te.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Re(this,e,t,!0),t+4},te.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,4,4294967295,0),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Re(this,e,t,!1),t+4},te.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Oe(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},te.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Oe(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},te.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,1,127,-128),te.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},te.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,2,32767,-32768),te.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):De(this,e,t,!0),t+2},te.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,2,32767,-32768),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):De(this,e,t,!1),t+2},te.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,4,2147483647,-2147483648),te.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Re(this,e,t,!0),t+4},te.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Oe(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),te.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Re(this,e,t,!1),t+4},te.prototype.writeFloatLE=function(e,t,r){return Se(this,e,t,!0,r)},te.prototype.writeFloatBE=function(e,t,r){return Se(this,e,t,!1,r)},te.prototype.writeDoubleLE=function(e,t,r){return Fe(this,e,t,!0,r)},te.prototype.writeDoubleBE=function(e,t,r){return Fe(this,e,t,!1,r)},te.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!te.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Ie(e){return function(e){var t,r,n,i,o,a;Y||H();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new $(3*s/4-o),n=o>0?s-4:s;var u=0;for(t=0,r=0;t>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=K[e.charCodeAt(t)]<<2|K[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=K[e.charCodeAt(t)]<<10|K[e.charCodeAt(t+1)]<<4|K[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Ne,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ke(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Pe(e){return null!=e&&(!!e._isBuffer||Ue(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Ue(e.slice(0,0))}(e))}function Ue(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Be=Object.freeze({__proto__:null,Buffer:te,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),te.alloc(+e)},isBuffer:Pe,kMaxLength:Z}),Me={};function Ve(){}function Ke(){Ke.init.call(this)}function $e(e){return void 0===e._maxListeners?Ke.defaultMaxListeners:e._maxListeners}function Ye(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Ze(e,n),o=0;o0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=r,++e._eventsCount;return e}function Qe(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Xe(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Ze(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}Ve.prototype=Object.create(null),Ke.EventEmitter=Ke,Ke.usingDomains=!1,Ke.prototype.domain=void 0,Ke.prototype._events=void 0,Ke.prototype._maxListeners=void 0,Ke.defaultMaxListeners=10,Ke.init=function(){this.domain=null,Ke.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Ve,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ke.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Ke.prototype.getMaxListeners=function(){return $e(this)},Ke.prototype.emit=function(e){var t,r,n,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:Ye(r,l,this);break;case 2:He(r,l,this,arguments[1]);break;case 3:qe(r,l,this,arguments[1],arguments[2]);break;case 4:ze(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Ve,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var Je="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},et=/%[sdj%]/g;function tt(e){if(!ft(e)){for(var t=[],r=0;r=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),dt(t)?r.showHidden=t:t&&Et(r,t),pt(r.showHidden)&&(r.showHidden=!1),pt(r.depth)&&(r.depth=2),pt(r.colors)&&(r.colors=!1),pt(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=at),ut(r,e,r.depth)}function at(e,t){var r=ot.styles[t];return r?"["+ot.colors[r][0]+"m"+e+"["+ot.colors[r][1]+"m":e}function st(e,t){return e}function ut(e,t,r){if(e.customInspect&&t&&bt(t.inspect)&&t.inspect!==ot&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return ft(n)||(n=ut(e,n,r)),n}var i=function(e,t){if(pt(t))return e.stylize("undefined","undefined");if(ft(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(n=t,"number"==typeof n)return e.stylize(""+t,"number");var n;if(dt(t))return e.stylize(""+t,"boolean");if(ht(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),mt(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ct(t);if(0===o.length){if(bt(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(gt(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(vt(t))return e.stylize(Date.prototype.toString.call(t),"date");if(mt(t))return ct(t)}var u,c,l="",d=!1,h=["{","}"];(u=t,Array.isArray(u)&&(d=!0,h=["[","]"]),bt(t))&&(l=" [Function"+(t.name?": "+t.name:"")+"]");return gt(t)&&(l=" "+RegExp.prototype.toString.call(t)),vt(t)&&(l=" "+Date.prototype.toUTCString.call(t)),mt(t)&&(l=" "+ct(t)),0!==o.length||d&&0!=t.length?r<0?gt(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),c=d?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,l,h)):h[0]+l+h[1]}function ct(e){return"["+Error.prototype.toString.call(e)+"]"}function lt(e,t,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),At(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=ht(r)?ut(e,u.value,null):ut(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),pt(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function dt(e){return"boolean"==typeof e}function ht(e){return null===e}function ft(e){return"string"==typeof e}function pt(e){return void 0===e}function gt(e){return yt(e)&&"[object RegExp]"===wt(e)}function yt(e){return"object"==typeof e&&null!==e}function vt(e){return yt(e)&&"[object Date]"===wt(e)}function mt(e){return yt(e)&&("[object Error]"===wt(e)||e instanceof Error)}function bt(e){return"function"==typeof e}function wt(e){return Object.prototype.toString.call(e)}function Et(e,t){if(!t||!yt(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function At(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Tt(){this.head=null,this.tail=null,this.length=0}ot.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},ot.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},Tt.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Tt.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},Tt.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Tt.prototype.clear=function(){this.head=this.tail=null,this.length=0},Tt.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},Tt.prototype.concat=function(e){if(0===this.length)return te.alloc(0);if(1===this.length)return this.head.data;for(var t=te.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var _t,Ct={},Ot=n(Be);function Dt(){if(_t)return Ct;_t=1;var e=Ot.Buffer,t=e.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};var r=Ct.StringDecoder=function(r){switch(this.encoding=(r||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!t(e))throw new Error("Unknown encoding: "+e)}(r),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=i;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=n)}this.charBuffer=new e(6),this.charReceived=0,this.charLength=0};function n(e){return e.toString(this.encoding)}function i(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function o(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}return r.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var i;n=(t+=e.toString(this.encoding,0,n)).length-1;if((i=t.charCodeAt(n))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,n)}return t},r.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},r.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t},Ct}var Rt=Dt();Ft.ReadableState=St;var xt=function(e){if(pt(nt)&&(nt=N.env.NODE_DEBUG||""),e=e.toUpperCase(),!it[e])if(new RegExp("\\b"+e+"\\b","i").test(nt)){it[e]=function(){var t=tt.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else it[e]=function(){};return it[e]}("stream");function St(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof ir&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new Tt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Rt.StringDecoder(e.encoding),this.encoding=e.encoding)}function Ft(e){if(!(this instanceof Ft))return new Ft(e);this._readableState=new St(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Ke.call(this)}function Nt(e,t,r,n,i){var o=function(e,t){var r=null;te.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,jt(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||n||(r=t.decoder.write(r),u=!t.objectMode&&0===r.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&jt(e))),function(e,t){t.readingMore||(t.readingMore=!0,v(kt,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function jt(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(xt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?v(It,e):It(e))}function It(e){xt("emit readable"),e.emit("readable"),Bt(e)}function kt(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=te.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function Vt(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,v(Kt,t,e))}function Kt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $t(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return xt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Vt(this):jt(this),null;if(0===(e=Lt(e,t))&&t.ended)return 0===t.length&&Vt(this),null;var n,i=t.needReadable;return xt("need readable",i),(0===t.length||t.length-e0?Mt(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Vt(this)),null!==n&&this.emit("data",n),n},Ft.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Ft.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,xt("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?a:c;function o(e){xt("onunpipe"),e===r&&c()}function a(){xt("onend"),e.end()}n.endEmitted?v(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;xt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Bt(e))}}(r);e.on("drain",s);var u=!1;function c(){xt("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",c),r.removeListener("data",d),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var l=!1;function d(t){xt("ondata"),l=!1,!1!==e.write(t)||l||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==$t(n.pipes,e))&&!u&&(xt("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,l=!0),r.pause())}function h(t){var r;xt("onerror",t),g(),e.removeListener("error",h),0===(r="error",e.listeners(r).length)&&e.emit("error",t)}function f(){e.removeListener("finish",p),g()}function p(){xt("onfinish"),e.removeListener("close",f),g()}function g(){xt("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",r),n.flowing||(xt("pipe resume"),r.resume()),e},Ft.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},zt.prototype._write=function(e,t,r){r(new Error("not implemented"))},zt.prototype._writev=null,zt.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,Jt(e,t),r&&(t.finished?v(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Je(ir,Ft);for(var tr=Object.keys(zt.prototype),rr=0;rr"===o?(_(n,"onsgmldeclaration",n.sgmlDecl),n.sgmlDecl="",n.state=E.TEXT):p(o)?(n.state=E.SGML_DECL_QUOTED,n.sgmlDecl+=o):n.sgmlDecl+=o;continue;case E.SGML_DECL_QUOTED:o===n.q&&(n.state=E.SGML_DECL,n.q=""),n.sgmlDecl+=o;continue;case E.DOCTYPE:">"===o?(n.state=E.TEXT,_(n,"ondoctype",n.doctype),n.doctype=!0):(n.doctype+=o,"["===o?n.state=E.DOCTYPE_DTD:p(o)&&(n.state=E.DOCTYPE_QUOTED,n.q=o));continue;case E.DOCTYPE_QUOTED:n.doctype+=o,o===n.q&&(n.q="",n.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:n.doctype+=o,"]"===o?n.state=E.DOCTYPE:p(o)&&(n.state=E.DOCTYPE_DTD_QUOTED,n.q=o);continue;case E.DOCTYPE_DTD_QUOTED:n.doctype+=o,o===n.q&&(n.state=E.DOCTYPE_DTD,n.q="");continue;case E.COMMENT:"-"===o?n.state=E.COMMENT_ENDING:n.comment+=o;continue;case E.COMMENT_ENDING:"-"===o?(n.state=E.COMMENT_ENDED,n.comment=O(n.opt,n.comment),n.comment&&_(n,"oncomment",n.comment),n.comment=""):(n.comment+="-"+o,n.state=E.COMMENT);continue;case E.COMMENT_ENDED:">"!==o?(x(n,"Malformed comment"),n.comment+="--"+o,n.state=E.COMMENT):n.state=E.TEXT;continue;case E.CDATA:"]"===o?n.state=E.CDATA_ENDING:n.cdata+=o;continue;case E.CDATA_ENDING:"]"===o?n.state=E.CDATA_ENDING_2:(n.cdata+="]"+o,n.state=E.CDATA);continue;case E.CDATA_ENDING_2:">"===o?(n.cdata&&_(n,"oncdata",n.cdata),_(n,"onclosecdata"),n.cdata="",n.state=E.TEXT):"]"===o?n.cdata+="]":(n.cdata+="]]"+o,n.state=E.CDATA);continue;case E.PROC_INST:"?"===o?n.state=E.PROC_INST_ENDING:f(o)?n.state=E.PROC_INST_BODY:n.procInstName+=o;continue;case E.PROC_INST_BODY:if(!n.procInstBody&&f(o))continue;"?"===o?n.state=E.PROC_INST_ENDING:n.procInstBody+=o;continue;case E.PROC_INST_ENDING:">"===o?(_(n,"onprocessinginstruction",{name:n.procInstName,body:n.procInstBody}),n.procInstName=n.procInstBody="",n.state=E.TEXT):(n.procInstBody+="?"+o,n.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:y(l,o)?n.tagName+=o:(S(n),">"===o?L(n):"/"===o?n.state=E.OPEN_TAG_SLASH:(f(o)||x(n,"Invalid character in tag name"),n.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:">"===o?(L(n,!0),j(n)):(x(n,"Forward-slash in opening tag not followed by >"),n.state=E.ATTRIB);continue;case E.ATTRIB:if(f(o))continue;">"===o?L(n):"/"===o?n.state=E.OPEN_TAG_SLASH:y(c,o)?(n.attribName=o,n.attribValue="",n.state=E.ATTRIB_NAME):x(n,"Invalid attribute name");continue;case E.ATTRIB_NAME:"="===o?n.state=E.ATTRIB_VALUE:">"===o?(x(n,"Attribute without value"),n.attribValue=n.attribName,N(n),L(n)):f(o)?n.state=E.ATTRIB_NAME_SAW_WHITE:y(l,o)?n.attribName+=o:x(n,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if("="===o)n.state=E.ATTRIB_VALUE;else{if(f(o))continue;x(n,"Attribute without value"),n.tag.attributes[n.attribName]="",n.attribValue="",_(n,"onattribute",{name:n.attribName,value:""}),n.attribName="",">"===o?L(n):y(c,o)?(n.attribName=o,n.state=E.ATTRIB_NAME):(x(n,"Invalid attribute name"),n.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(f(o))continue;p(o)?(n.q=o,n.state=E.ATTRIB_VALUE_QUOTED):(x(n,"Unquoted attribute value"),n.state=E.ATTRIB_VALUE_UNQUOTED,n.attribValue=o);continue;case E.ATTRIB_VALUE_QUOTED:if(o!==n.q){"&"===o?n.state=E.ATTRIB_VALUE_ENTITY_Q:n.attribValue+=o;continue}N(n),n.q="",n.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:f(o)?n.state=E.ATTRIB:">"===o?L(n):"/"===o?n.state=E.OPEN_TAG_SLASH:y(c,o)?(x(n,"No whitespace between attributes"),n.attribName=o,n.attribValue="",n.state=E.ATTRIB_NAME):x(n,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!g(o)){"&"===o?n.state=E.ATTRIB_VALUE_ENTITY_U:n.attribValue+=o;continue}N(n),">"===o?L(n):n.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(n.tagName)">"===o?j(n):y(l,o)?n.tagName+=o:n.script?(n.script+=""===o?j(n):x(n,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var u,m;switch(n.state){case E.TEXT_ENTITY:u=E.TEXT,m="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:u=E.ATTRIB_VALUE_QUOTED,m="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:u=E.ATTRIB_VALUE_UNQUOTED,m="attribValue"}";"===o?(n[m]+=I(n),n.entity="",n.state=u):y(n.entity.length?h:d,o)?n.entity+=o:(x(n,"Invalid character in entity name"),n[m]+="&"+n.entity+o,n.entity="",n.state=u);continue;default:throw new Error(n,"Unknown state: "+n.state)}return n.position>=n.bufferCheckPosition&&function(t){for(var n=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,o=0,a=r.length;on)switch(r[o]){case"textNode":C(t);break;case"cdata":_(t,"oncdata",t.cdata),t.cdata="";break;case"script":_(t,"onscript",t.script),t.script="";break;default:D(t,"Max buffer length exceeded: "+r[o])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(n),n} -/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;C(e=this),""!==e.cdata&&(_(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(_(e,"onscript",e.script),e.script="")}};try{t=hr.Stream}catch(e){t=function(){}}var i=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function o(e,r){if(!(this instanceof o))return new o(e,r);t.apply(this),this._parser=new n(e,r),this.writable=!0,this.readable=!0;var a=this;this._parser.onend=function(){a.emit("end")},this._parser.onerror=function(e){a.emit("error",e),a._parser.error=null},this._decoder=null,i.forEach((function(e){Object.defineProperty(a,"on"+e,{get:function(){return a._parser["on"+e]},set:function(t){if(!t)return a.removeAllListeners(e),a._parser["on"+e]=t,t;a.on(e,t)},enumerable:!0,configurable:!1})}))}o.prototype=Object.create(t.prototype,{constructor:{value:o}}),o.prototype.write=function(e){if("function"==typeof te.isBuffer&&te.isBuffer(e)){if(!this._decoder){var t=Dt().StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},o.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},o.prototype.on=function(e,r){var n=this;return n._parser["on"+e]||-1===i.indexOf(e)||(n._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),n.emit.apply(n,t)}),t.prototype.on.call(n,e,r)};var a="http://www.w3.org/XML/1998/namespace",s="http://www.w3.org/2000/xmlns/",u={xml:a,xmlns:s},c=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,l=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function f(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function p(e){return'"'===e||"'"===e}function g(e){return">"===e||f(e)}function y(e,t){return e.test(t)}function v(e,t){return!y(e,t)}var m,b,w,E=0;for(var A in e.STATE={BEGIN:E++,BEGIN_WHITESPACE:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var r=e.ENTITIES[t],n="number"==typeof r?String.fromCharCode(r):r;e.ENTITIES[t]=n})),e.STATE)e.STATE[e.STATE[A]]=A;function T(e,t,r){e[t]&&e[t](r)}function _(e,t,r){e.textNode&&C(e),T(e,t,r)}function C(e){e.textNode=O(e.opt,e.textNode),e.textNode&&T(e,"ontext",e.textNode),e.textNode=""}function O(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function D(e,t){return C(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,T(e,"onerror",t),e}function R(e){return e.sawRoot&&!e.closedRoot&&x(e,"Unclosed root tag"),e.state!==E.BEGIN&&e.state!==E.BEGIN_WHITESPACE&&e.state!==E.TEXT&&D(e,"Unexpected end"),C(e),e.c="",e.closed=!0,T(e,"onend"),n.call(e,e.strict,e.opt),e}function x(e,t){if("object"!=typeof e||!(e instanceof n))throw new Error("bad call to strictFail");e.strict&&D(e,t)}function S(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,r=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(r.ns=t.ns),e.attribList.length=0,_(e,"onopentagstart",r)}function F(e,t){var r=e.indexOf(":")<0?["",e]:e.split(":"),n=r[0],i=r[1];return t&&"xmlns"===e&&(n="xmlns",i=""),{prefix:n,local:i}}function N(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=F(e.attribName,!0),r=t.prefix,n=t.local;if("xmlns"===r)if("xml"===n&&e.attribValue!==a)x(e,"xml: prefix must be bound to "+a+"\nActual: "+e.attribValue);else if("xmlns"===n&&e.attribValue!==s)x(e,"xmlns: prefix must be bound to "+s+"\nActual: "+e.attribValue);else{var i=e.tag,o=e.tags[e.tags.length-1]||e;i.ns===o.ns&&(i.ns=Object.create(o.ns)),i.ns[n]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,_(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function L(e,t){if(e.opt.xmlns){var r=e.tag,n=F(e.tagName);r.prefix=n.prefix,r.local=n.local,r.uri=r.ns[n.prefix]||"",r.prefix&&!r.uri&&(x(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),r.uri=n.prefix);var i=e.tags[e.tags.length-1]||e;r.ns&&i.ns!==r.ns&&Object.keys(r.ns).forEach((function(t){_(e,"onopennamespace",{prefix:t,uri:r.ns[t]})}));for(var o=0,a=e.attribList.length;o",e.tagName="",void(e.state=E.SCRIPT);_(e,"onscript",e.script),e.script=""}var t=e.tags.length,r=e.tagName;e.strict||(r=r[e.looseCase]());for(var n=r;t--&&e.tags[t].name!==n;)x(e,"Unexpected close tag");if(t<0)return x(e,"Unmatched closing tag: "+e.tagName),e.textNode+="",void(e.state=E.TEXT);e.tagName=r;for(var i=e.tags.length;i-- >t;){var o=e.tag=e.tags.pop();e.tagName=e.tag.name,_(e,"onclosetag",e.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var u=e.tags[e.tags.length-1]||e;e.opt.xmlns&&o.ns!==u.ns&&Object.keys(o.ns).forEach((function(t){var r=o.ns[t];_(e,"onclosenamespace",{prefix:t,uri:r})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=E.TEXT}function I(e){var t,r=e.entity,n=r.toLowerCase(),i="";return e.ENTITIES[r]?e.ENTITIES[r]:e.ENTITIES[n]?e.ENTITIES[n]:("#"===(r=n).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),i=(t=parseInt(r,16)).toString(16)):(r=r.slice(1),i=(t=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(t)||i.toLowerCase()!==r?(x(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function k(e,t){"<"===t?(e.state=E.OPEN_WAKA,e.startTagPosition=e.position):f(t)||(x(e,"Non-whitespace before first tag."),e.textNode=t,e.state=E.TEXT)}function P(e,t){var r="";return t1114111||b(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?n.push(s):(e=55296+((s-=65536)>>10),t=s%1024+56320,n.push(e,t)),(i+1===o||n.length>r)&&(a+=m.apply(null,n),n.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:w,configurable:!0,writable:!0}):String.fromCodePoint=w)}(Me);var fr,pr,gr=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)},yr=gr,vr={copyOptions:function(e){var t,r={};for(t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r},ensureFlagExists:function(e,t){e in t&&"boolean"==typeof t[e]||(t[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||"number"!=typeof e.spaces&&"string"!=typeof e.spaces)&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){"alwaysArray"in e&&("boolean"==typeof e.alwaysArray||yr(e.alwaysArray))||(e.alwaysArray=!1)},ensureKeyExists:function(e,t){e+"Key"in t&&"string"==typeof t[e+"Key"]||(t[e+"Key"]=t.compact?"_"+e:e)},checkFnExists:function(e,t){return e+"Fn"in t}},mr=Me,br=vr,wr=gr;function Er(e){var t=Number(e);if(!isNaN(t))return t;var r=e.toLowerCase();return"true"===r||"false"!==r&&e}function Ar(e,t){var r;if(fr.compact){if(!pr[fr[e+"Key"]]&&(wr(fr.alwaysArray)?-1!==fr.alwaysArray.indexOf(fr[e+"Key"]):fr.alwaysArray)&&(pr[fr[e+"Key"]]=[]),pr[fr[e+"Key"]]&&!wr(pr[fr[e+"Key"]])&&(pr[fr[e+"Key"]]=[pr[fr[e+"Key"]]]),e+"Fn"in fr&&"string"==typeof t&&(t=fr[e+"Fn"](t,pr)),"instruction"===e&&("instructionFn"in fr||"instructionNameFn"in fr))for(r in t)if(t.hasOwnProperty(r))if("instructionFn"in fr)t[r]=fr.instructionFn(t[r],r,pr);else{var n=t[r];delete t[r],t[fr.instructionNameFn(r,n,pr)]=n}wr(pr[fr[e+"Key"]])?pr[fr[e+"Key"]].push(t):pr[fr[e+"Key"]]=t}else{pr[fr.elementsKey]||(pr[fr.elementsKey]=[]);var i={};if(i[fr.typeKey]=e,"instruction"===e){for(r in t)if(t.hasOwnProperty(r))break;i[fr.nameKey]="instructionNameFn"in fr?fr.instructionNameFn(r,t,pr):r,fr.instructionHasAttributes?(i[fr.attributesKey]=t[r][fr.attributesKey],"instructionFn"in fr&&(i[fr.attributesKey]=fr.instructionFn(i[fr.attributesKey],r,pr))):("instructionFn"in fr&&(t[r]=fr.instructionFn(t[r],r,pr)),i[fr.instructionKey]=t[r])}else e+"Fn"in fr&&(t=fr[e+"Fn"](t,pr)),i[fr[e+"Key"]]=t;fr.addParent&&(i[fr.parentKey]=pr),pr[fr.elementsKey].push(i)}}function Tr(e){var t;if("attributesFn"in fr&&e&&(e=fr.attributesFn(e,pr)),(fr.trim||"attributeValueFn"in fr||"attributeNameFn"in fr||fr.nativeTypeAttributes)&&e)for(t in e)if(e.hasOwnProperty(t)&&(fr.trim&&(e[t]=e[t].trim()),fr.nativeTypeAttributes&&(e[t]=Er(e[t])),"attributeValueFn"in fr&&(e[t]=fr.attributeValueFn(e[t],t,pr)),"attributeNameFn"in fr)){var r=e[t];delete e[t],e[fr.attributeNameFn(t,e[t],pr)]=r}return e}function _r(e){var t={};if(e.body&&("xml"===e.name.toLowerCase()||fr.instructionHasAttributes)){for(var r,n=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;null!==(r=n.exec(e.body));)t[r[1]]=r[2]||r[3]||r[4];t=Tr(t)}if("xml"===e.name.toLowerCase()){if(fr.ignoreDeclaration)return;pr[fr.declarationKey]={},Object.keys(t).length&&(pr[fr.declarationKey][fr.attributesKey]=t),fr.addParent&&(pr[fr.declarationKey][fr.parentKey]=pr)}else{if(fr.ignoreInstruction)return;fr.trim&&(e.body=e.body.trim());var i={};fr.instructionHasAttributes&&Object.keys(t).length?(i[e.name]={},i[e.name][fr.attributesKey]=t):i[e.name]=e.body,Ar("instruction",i)}}function Cr(e,t){var r;if("object"==typeof e&&(t=e.attributes,e=e.name),t=Tr(t),"elementNameFn"in fr&&(e=fr.elementNameFn(e,pr)),fr.compact){var n;if(r={},!fr.ignoreAttributes&&t&&Object.keys(t).length)for(n in r[fr.attributesKey]={},t)t.hasOwnProperty(n)&&(r[fr.attributesKey][n]=t[n]);!(e in pr)&&(wr(fr.alwaysArray)?-1!==fr.alwaysArray.indexOf(e):fr.alwaysArray)&&(pr[e]=[]),pr[e]&&!wr(pr[e])&&(pr[e]=[pr[e]]),wr(pr[e])?pr[e].push(r):pr[e]=r}else pr[fr.elementsKey]||(pr[fr.elementsKey]=[]),(r={})[fr.typeKey]="element",r[fr.nameKey]=e,!fr.ignoreAttributes&&t&&Object.keys(t).length&&(r[fr.attributesKey]=t),fr.alwaysChildren&&(r[fr.elementsKey]=[]),pr[fr.elementsKey].push(r);r[fr.parentKey]=pr,pr=r}function Or(e){fr.ignoreText||(e.trim()||fr.captureSpacesBetweenElements)&&(fr.trim&&(e=e.trim()),fr.nativeType&&(e=Er(e)),fr.sanitize&&(e=e.replace(/&/g,"&").replace(//g,">")),Ar("text",e))}function Dr(e){fr.ignoreComment||(fr.trim&&(e=e.trim()),Ar("comment",e))}function Rr(e){var t=pr[fr.parentKey];fr.addParent||delete pr[fr.parentKey],pr=t}function xr(e){fr.ignoreCdata||(fr.trim&&(e=e.trim()),Ar("cdata",e))}function Sr(e){fr.ignoreDoctype||(e=e.replace(/^ /,""),fr.trim&&(e=e.trim()),Ar("doctype",e))}function Fr(e){e.note=e}var Nr=function(e,t){var r=mr.parser(!0,{}),n={};if(pr=n,fr=function(e){return fr=br.copyOptions(e),br.ensureFlagExists("ignoreDeclaration",fr),br.ensureFlagExists("ignoreInstruction",fr),br.ensureFlagExists("ignoreAttributes",fr),br.ensureFlagExists("ignoreText",fr),br.ensureFlagExists("ignoreComment",fr),br.ensureFlagExists("ignoreCdata",fr),br.ensureFlagExists("ignoreDoctype",fr),br.ensureFlagExists("compact",fr),br.ensureFlagExists("alwaysChildren",fr),br.ensureFlagExists("addParent",fr),br.ensureFlagExists("trim",fr),br.ensureFlagExists("nativeType",fr),br.ensureFlagExists("nativeTypeAttributes",fr),br.ensureFlagExists("sanitize",fr),br.ensureFlagExists("instructionHasAttributes",fr),br.ensureFlagExists("captureSpacesBetweenElements",fr),br.ensureAlwaysArrayExists(fr),br.ensureKeyExists("declaration",fr),br.ensureKeyExists("instruction",fr),br.ensureKeyExists("attributes",fr),br.ensureKeyExists("text",fr),br.ensureKeyExists("comment",fr),br.ensureKeyExists("cdata",fr),br.ensureKeyExists("doctype",fr),br.ensureKeyExists("type",fr),br.ensureKeyExists("name",fr),br.ensureKeyExists("elements",fr),br.ensureKeyExists("parent",fr),fr}(t),r.opt={strictEntities:!0},r.onopentag=Cr,r.ontext=Or,r.oncomment=Dr,r.onclosetag=Rr,r.onerror=Fr,r.oncdata=xr,r.ondoctype=Sr,r.onprocessinginstruction=_r,r.write(e).close(),n[fr.elementsKey]){var i=n[fr.elementsKey];delete n[fr.elementsKey],n[fr.elementsKey]=i,delete n.text}return n},Lr=vr,jr=Nr;var Ir,kr,Pr=vr,Ur=gr;function Br(e,t,r){return(!r&&e.spaces?"\n":"")+Array(t+1).join(e.spaces)}function Mr(e,t,r){if(t.ignoreAttributes)return"";"attributesFn"in t&&(e=t.attributesFn(e,kr,Ir));var n,i,o,a,s=[];for(n in e)e.hasOwnProperty(n)&&null!==e[n]&&void 0!==e[n]&&(a=t.noQuotesForNativeAttributes&&"string"!=typeof e[n]?"":'"',i=(i=""+e[n]).replace(/"/g,"""),o="attributeNameFn"in t?t.attributeNameFn(n,i,kr,Ir):n,s.push(t.spaces&&t.indentAttributes?Br(t,r+1,!1):" "),s.push(o+"="+a+("attributeValueFn"in t?t.attributeValueFn(i,n,kr,Ir):i)+a));return e&&Object.keys(e).length&&t.spaces&&t.indentAttributes&&s.push(Br(t,r,!1)),s.join("")}function Vr(e,t,r){return Ir=e,kr="xml",t.ignoreDeclaration?"":""}function Kr(e,t,r){if(t.ignoreInstruction)return"";var n;for(n in e)if(e.hasOwnProperty(n))break;var i="instructionNameFn"in t?t.instructionNameFn(n,e[n],kr,Ir):n;if("object"==typeof e[n])return Ir=e,kr=i,"";var o=e[n]?e[n]:"";return"instructionFn"in t&&(o=t.instructionFn(o,n,kr,Ir)),""}function $r(e,t){return t.ignoreComment?"":"\x3c!--"+("commentFn"in t?t.commentFn(e,kr,Ir):e)+"--\x3e"}function Yr(e,t){return t.ignoreCdata?"":"","]]]]>"))+"]]>"}function Hr(e,t){return t.ignoreDoctype?"":""}function qr(e,t){return t.ignoreText?"":(e=(e=(e=""+e).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in t?t.textFn(e,kr,Ir):e)}function zr(e,t,r,n){return e.reduce((function(e,i){var o=Br(t,r,n&&!e);switch(i.type){case"element":return e+o+function(e,t,r){Ir=e,kr=e.name;var n=[],i="elementNameFn"in t?t.elementNameFn(e.name,e):e.name;n.push("<"+i),e[t.attributesKey]&&n.push(Mr(e[t.attributesKey],t,r));var o=e[t.elementsKey]&&e[t.elementsKey].length||e[t.attributesKey]&&"preserve"===e[t.attributesKey]["xml:space"];return o||(o="fullTagEmptyElementFn"in t?t.fullTagEmptyElementFn(e.name,e):t.fullTagEmptyElement),o?(n.push(">"),e[t.elementsKey]&&e[t.elementsKey].length&&(n.push(zr(e[t.elementsKey],t,r+1)),Ir=e,kr=e.name),n.push(t.spaces&&function(e,t){var r;if(e.elements&&e.elements.length)for(r=0;r")):n.push("/>"),n.join("")}(i,t,r);case"comment":return e+o+$r(i[t.commentKey],t);case"doctype":return e+o+Hr(i[t.doctypeKey],t);case"cdata":return e+(t.indentCdata?o:"")+Yr(i[t.cdataKey],t);case"text":return e+(t.indentText?o:"")+qr(i[t.textKey],t);case"instruction":var a={};return a[i[t.nameKey]]=i[t.attributesKey]?i:i[t.instructionKey],e+(t.indentInstruction?o:"")+Kr(a,t,r)}}),"")}function Gr(e,t,r){var n;for(n in e)if(e.hasOwnProperty(n))switch(n){case t.parentKey:case t.attributesKey:break;case t.textKey:if(t.indentText||r)return!0;break;case t.cdataKey:if(t.indentCdata||r)return!0;break;case t.instructionKey:if(t.indentInstruction||r)return!0;break;case t.doctypeKey:case t.commentKey:default:return!0}return!1}function Wr(e,t,r,n,i){Ir=e,kr=t;var o="elementNameFn"in r?r.elementNameFn(t,e):t;if(null==e||""===e)return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(t,e)||r.fullTagEmptyElement?"<"+o+">":"<"+o+"/>";var a=[];if(t){if(a.push("<"+o),"object"!=typeof e)return a.push(">"+qr(e,r)+""),a.join("");e[r.attributesKey]&&a.push(Mr(e[r.attributesKey],r,n));var s=Gr(e,r,!0)||e[r.attributesKey]&&"preserve"===e[r.attributesKey]["xml:space"];if(s||(s="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(t,e):r.fullTagEmptyElement),!s)return a.push("/>"),a.join("");a.push(">")}return a.push(Qr(e,r,n+1,!1)),Ir=e,kr=t,t&&a.push((i?Br(r,n,!1):"")+""),a.join("")}function Qr(e,t,r,n){var i,o,a,s=[];for(o in e)if(e.hasOwnProperty(o))for(a=Ur(e[o])?e[o]:[e[o]],i=0;i{const t=Number(e);if(!Number.isNaN(t))return t;const r=e.toLowerCase();return"true"===r||"false"!==r&&e},nn=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),n=t.trim();if(Math.abs(r.length-n.length)>1)return!1;const i="/"===r.slice(-1)?r.slice(0,-1):r,o="/"===n.slice(-1)?n.slice(0,-1):n;return e.includes(o)||t.includes(i)},on=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),n=t.trim(),i="/"===r.slice(-1)?r.slice(0,-1):r,o="/"===n.slice(-1)?n.slice(0,-1):n;return e.includes(o)||t.includes(i)},an=e=>e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[U[t]]:t})),{}),sn=e=>Object.entries(e).reduce(((e,[t,r])=>r?Object.assign(Object.assign({},e),{[t]:r}):e),{});var un=Object.freeze({__proto__:null,urlEquals:nn,urlContains:on,getDAVAttribute:an,cleanupFalsy:sn});const cn=P("tsdav:request"),ln=e=>t(void 0,void 0,void 0,(function*(){var t;const{url:r,init:n,convertIncoming:o=!0,parseOutgoing:a=!0}=e,{headers:s,body:u,namespace:c,method:l,attributes:d}=n,h=o?tn.js2xml(Object.assign(Object.assign({_declaration:{_attributes:{version:"1.0",encoding:"utf-8"}}},u),{_attributes:d}),{compact:!0,spaces:2,elementNameFn:e=>c&&!/^.+:.+/.test(e)?`${c}:${e}`:e}):u,f=yield i.exports.fetch(r,{headers:Object.assign({"Content-Type":"text/xml;charset=UTF-8"},sn(s)),body:h,method:l}),p=yield f.text();if(!f.ok||!(null===(t=f.headers.get("content-type"))||void 0===t?void 0:t.includes("xml"))||!a)return[{href:f.url,ok:f.ok,status:f.status,statusText:f.statusText,raw:p}];const g=tn.xml2js(p,{compact:!0,trim:!0,textFn:(e,t)=>{try{const r=t._parent,n=Object.keys(r),i=n[n.length-1],o=r[i];if(o.length>0){o[o.length-1]=rn(e)}else r[i]=rn(e)}catch(e){cn(e.stack)}},elementNameFn:e=>e.replace(/^.+:/,"").replace(/([-_]\w)/g,(e=>e[1].toUpperCase())),attributesFn:e=>{const t=Object.assign({},e);return delete t.xmlns,t},ignoreDeclaration:!0});return(Array.isArray(g.multistatus.response)?g.multistatus.response:[g.multistatus.response]).map((e=>{var t,r;if(!e)return{status:f.status,statusText:f.statusText,ok:f.ok};const n=/^\S+\s(?\d+)\s(?.+)$/.exec(e.status);return{raw:g,href:e.href,status:(null==n?void 0:n.groups)?Number.parseInt(null==n?void 0:n.groups.status,10):f.status,statusText:null!==(r=null===(t=null==n?void 0:n.groups)||void 0===t?void 0:t.statusText)&&void 0!==r?r:f.statusText,ok:!e.error,error:e.error,responsedescription:e.responsedescription,props:(Array.isArray(e.propstat)?e.propstat:[e.propstat]).reduce(((e,t)=>Object.assign(Object.assign({},e),null==t?void 0:t.prop)),{})}}))})),dn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:n,headers:i}=e;return ln({url:t,init:{method:"PROPFIND",headers:sn(Object.assign({depth:n},i)),namespace:B.DAV,body:{propfind:{_attributes:an([k.CALDAV,k.CALDAV_APPLE,k.CALENDAR_SERVER,k.CARDDAV,k.DAV]),prop:r}}}})})),hn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,data:r,headers:n}=e;return i.exports.fetch(t,{method:"PUT",body:r,headers:n})})),fn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,data:r,etag:n,headers:o}=e;return i.exports.fetch(t,{method:"PUT",body:r,headers:sn(Object.assign({"If-Match":n},o))})})),pn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,headers:r,etag:n}=e;return i.exports.fetch(t,{method:"DELETE",headers:sn(Object.assign({"If-Match":n},r))})}));var gn=Object.freeze({__proto__:null,davRequest:ln,propfind:dn,createObject:hn,updateObject:fn,deleteObject:pn});function yn(e,t){const r=e=>t.every((t=>e[t]));return Array.isArray(e)?e.every((e=>r(e))):r(e)}const vn=(e,t)=>t.reduce(((t,r)=>e[r]?t:`${t.length?`${t},`:""}${r.toString()}`),""),mn=P("tsdav:collection"),bn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,body:r,depth:n,defaultNamespace:i=B.DAV,headers:o}=e,a=yield ln({url:t,init:{method:"REPORT",headers:sn(Object.assign({depth:n},o)),namespace:i,body:r}});return 1!==a.length||a[0].raw?a:[]})),wn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:n,headers:i}=e;return ln({url:t,init:{method:"MKCOL",headers:sn(Object.assign({depth:n},i)),namespace:B.DAV,body:r?{mkcol:{set:{prop:r}}}:void 0}})})),En=e=>t(void 0,void 0,void 0,(function*(){var t,r,n,i,o;const{collection:a,headers:s}=e;return null!==(o=null===(i=null===(n=null===(r=null===(t=(yield dn({url:a.url,props:{[`${B.DAV}:supported-report-set`]:{}},depth:"0",headers:s}))[0])||void 0===t?void 0:t.props)||void 0===r?void 0:r.supportedReportSet)||void 0===n?void 0:n.supportedReport)||void 0===i?void 0:i.map((e=>Object.keys(e.report)[0])))&&void 0!==o?o:[]})),An=e=>t(void 0,void 0,void 0,(function*(){var t,r,n;const{collection:i,headers:o}=e,a=(yield dn({url:i.url,props:{[`${B.CALENDAR_SERVER}:getctag`]:{}},depth:"0",headers:o})).filter((e=>on(i.url,e.href)))[0];if(!a)throw new Error("Collection does not exist on server");return{isDirty:i.ctag!==(null===(t=a.props)||void 0===t?void 0:t.getctag),newCtag:null===(n=null===(r=a.props)||void 0===r?void 0:r.getctag)||void 0===n?void 0:n.toString()}})),Tn=e=>{const{url:t,props:r,headers:n,syncLevel:i,syncToken:o}=e;return ln({url:t,init:{method:"REPORT",namespace:B.DAV,headers:Object.assign({},n),body:{"sync-collection":{_attributes:an([k.CALDAV,k.CARDDAV,k.DAV]),"sync-level":i,"sync-token":o,[`${B.DAV}:prop`]:r}}}})},_n=e=>t(void 0,void 0,void 0,(function*(){var t,r,n,i,o,a,s,u,c,l,d;const{collection:h,method:f,headers:p,account:g,detailedResult:y}=e,v=["accountType","homeUrl"];if(!g||!yn(g,v)){if(!g)throw new Error("no account for smartCollectionSync");throw new Error(`account must have ${vn(g,v)} before smartCollectionSync`)}const m=null!=f?f:(null===(t=h.reports)||void 0===t?void 0:t.includes("syncCollection"))?"webdav":"basic";if(mn(`smart collection sync with type ${g.accountType} and method ${m}`),"webdav"===m){const e=yield Tn({url:h.url,props:{[`${B.DAV}:getetag`]:{},[`${"caldav"===g.accountType?B.CALDAV:B.CARDDAV}:${"caldav"===g.accountType?"calendar-data":"address-data"}`]:{},[`${B.DAV}:displayname`]:{}},syncLevel:1,syncToken:h.syncToken,headers:p}),t=e.filter((e=>{var t;const r="caldav"===g.accountType?".ics":".vcf";return(null===(t=e.href)||void 0===t?void 0:t.slice(-4))===r})),c=t.filter((e=>404!==e.status)).map((e=>e.href)),l=t.filter((e=>404===e.status)).map((e=>e.href)),d=(c.length&&null!==(n=yield null===(r=null==h?void 0:h.objectMultiGet)||void 0===r?void 0:r.call(h,{url:h.url,props:{[`${B.DAV}:getetag`]:{},[`${"caldav"===g.accountType?B.CALDAV:B.CARDDAV}:${"caldav"===g.accountType?"calendar-data":"address-data"}`]:{}},objectUrls:c,depth:"1",headers:p}))&&void 0!==n?n:[]).map((e=>{var t,r,n,i,o,a,s,u,c,l;return{url:null!==(t=e.href)&&void 0!==t?t:"",etag:null===(r=e.props)||void 0===r?void 0:r.getetag,data:"caldav"===(null==g?void 0:g.accountType)?null!==(o=null===(i=null===(n=e.props)||void 0===n?void 0:n.calendarData)||void 0===i?void 0:i._cdata)&&void 0!==o?o:null===(a=e.props)||void 0===a?void 0:a.calendarData:null!==(c=null===(u=null===(s=e.props)||void 0===s?void 0:s.addressData)||void 0===u?void 0:u._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.addressData}})),f=null!==(i=h.objects)&&void 0!==i?i:[],v=d.filter((e=>f.every((t=>!on(t.url,e.url))))),m=f.reduce(((e,t)=>{const r=d.find((e=>on(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),b=l.map((e=>({url:e,etag:""}))),w=f.filter((e=>d.some((t=>on(e.url,t.url)&&t.etag===e.etag))));return Object.assign(Object.assign({},h),{objects:y?{created:v,updated:m,deleted:b}:[...w,...v,...m],syncToken:null!==(u=null===(s=null===(a=null===(o=e[0])||void 0===o?void 0:o.raw)||void 0===a?void 0:a.multistatus)||void 0===s?void 0:s.syncToken)&&void 0!==u?u:h.syncToken})}if("basic"===m){const{isDirty:e,newCtag:t}=yield An({collection:h,headers:p}),r=null!==(c=h.objects)&&void 0!==c?c:[],n=null!==(d=yield null===(l=h.fetchObjects)||void 0===l?void 0:l.call(h,{collection:h,headers:p}))&&void 0!==d?d:[],i=n.filter((e=>r.every((t=>!on(t.url,e.url))))),o=r.reduce(((e,t)=>{const r=n.find((e=>on(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),a=r.filter((e=>n.every((t=>!on(t.url,e.url))))),s=r.filter((e=>n.some((t=>on(e.url,t.url)&&t.etag===e.etag))));if(e)return Object.assign(Object.assign({},h),{objects:y?{created:i,updated:o,deleted:a}:[...s,...i,...o],ctag:t})}return y?Object.assign(Object.assign({},h),{objects:{created:[],updated:[],deleted:[]}}):h}));var Cn=Object.freeze({__proto__:null,collectionQuery:bn,makeCollection:wn,supportedReportSet:En,isCollectionDirty:An,syncCollection:Tn,smartCollectionSync:_n});const On=P("tsdav:addressBook"),Dn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:n,depth:i,headers:o}=e;return bn({url:t,body:{"addressbook-query":{_attributes:an([k.CARDDAV,k.DAV]),[`${B.DAV}:prop`]:r,filter:null!=n?n:{"prop-filter":{_attributes:{name:"FN"}}}}},defaultNamespace:B.CARDDAV,depth:i,headers:o})})),Rn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:n,depth:i,headers:o}=e;return bn({url:t,body:{"addressbook-multiget":{_attributes:an([k.DAV,k.CARDDAV]),[`${B.DAV}:prop`]:r,[`${B.DAV}:href`]:n}},defaultNamespace:B.CARDDAV,depth:i,headers:o})})),xn=e=>t(void 0,void 0,void 0,(function*(){const{account:r,headers:n,props:i}=null!=e?e:{},o=["homeUrl","rootUrl"];if(!r||!yn(r,o)){if(!r)throw new Error("no account for fetchAddressBooks");throw new Error(`account must have ${vn(r,o)} before fetchAddressBooks`)}const a=yield dn({url:r.homeUrl,props:null!=i?i:{[`${B.DAV}:displayname`]:{},[`${B.CALENDAR_SERVER}:getctag`]:{},[`${B.DAV}:resourcetype`]:{},[`${B.DAV}:sync-token`]:{}},depth:"1",headers:n});return Promise.all(a.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("addressbook")})).map((e=>{var t,n,i,o,a,s,u,c,l;const d=null!==(i=null===(n=null===(t=e.props)||void 0===t?void 0:t.displayname)||void 0===n?void 0:n._cdata)&&void 0!==i?i:null===(o=e.props)||void 0===o?void 0:o.displayname;return On(`Found address book named ${"string"==typeof d?d:""},\n props: ${JSON.stringify(e.props)}`),{url:new URL(null!==(a=e.href)&&void 0!==a?a:"",null!==(s=r.rootUrl)&&void 0!==s?s:"").href,ctag:null===(u=e.props)||void 0===u?void 0:u.getctag,displayName:"string"==typeof d?d:"",resourcetype:Object.keys(null===(c=e.props)||void 0===c?void 0:c.resourcetype),syncToken:null===(l=e.props)||void 0===l?void 0:l.syncToken}})).map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield En({collection:e,headers:n})})})))))})),Sn=e=>t(void 0,void 0,void 0,(function*(){const{addressBook:t,headers:r,objectUrls:n,urlFilter:i}=e;On(`Fetching vcards from ${null==t?void 0:t.url}`);const o=["url"];if(!t||!yn(t,o)){if(!t)throw new Error("cannot fetchVCards for undefined addressBook");throw new Error(`addressBook must have ${vn(t,o)} before fetchVCards`)}const a=(null!=n?n:(yield Dn({url:t.url,props:{[`${B.DAV}:getetag`]:{}},depth:"1",headers:r})).map((e=>{var t;return e.ok&&null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(null!=i?i:e=>e).map((e=>new URL(e).pathname));return(a.length>0?yield Rn({url:t.url,props:{[`${B.DAV}:getetag`]:{},[`${B.CARDDAV}:address-data`]:{}},objectUrls:a,depth:"1",headers:r}):[]).map((e=>{var r,n,i,o,a,s;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:null===(n=e.props)||void 0===n?void 0:n.getetag,data:null!==(a=null===(o=null===(i=e.props)||void 0===i?void 0:i.addressData)||void 0===o?void 0:o._cdata)&&void 0!==a?a:null===(s=e.props)||void 0===s?void 0:s.addressData}}))})),Fn=e=>t(void 0,void 0,void 0,(function*(){const{addressBook:t,vCardString:r,filename:n,headers:i}=e;return hn({url:new URL(n,t.url).href,data:r,headers:Object.assign({"content-type":"text/vcard; charset=utf-8","If-None-Match":"*"},i)})})),Nn=e=>t(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return fn({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/vcard; charset=utf-8"},r)})})),Ln=e=>t(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return pn({url:t.url,etag:t.etag,headers:r})}));var jn=Object.freeze({__proto__:null,addressBookQuery:Dn,addressBookMultiGet:Rn,fetchAddressBooks:xn,fetchVCards:Sn,createVCard:Fn,updateVCard:Nn,deleteVCard:Ln});const In=P("tsdav:calendar"),kn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:n,timezone:i,depth:o,headers:a}=e;return bn({url:t,body:{"calendar-query":sn({_attributes:an([k.CALDAV,k.CALENDAR_SERVER,k.CALDAV_APPLE,k.DAV]),[`${B.DAV}:prop`]:r,filter:n,timezone:i})},defaultNamespace:B.CALDAV,depth:o,headers:a})})),Pn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:n,filters:i,timezone:o,depth:a,headers:s}=e;return bn({url:t,body:{"calendar-multiget":{_attributes:an([k.DAV,k.CALDAV]),[`${B.DAV}:prop`]:r,[`${B.DAV}:href`]:n,filter:i,timezone:o}},defaultNamespace:B.CALDAV,depth:a,headers:s})})),Un=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:n,headers:i}=e;return ln({url:t,init:{method:"MKCALENDAR",headers:sn(Object.assign({depth:n},i)),namespace:B.DAV,body:{[`${B.CALDAV}:mkcalendar`]:{_attributes:an([k.DAV,k.CALDAV,k.CALDAV_APPLE]),set:{prop:r}}}}})})),Bn=e=>t(void 0,void 0,void 0,(function*(){const{headers:r,account:n,props:i}=null!=e?e:{},o=["homeUrl","rootUrl"];if(!n||!yn(n,o)){if(!n)throw new Error("no account for fetchCalendars");throw new Error(`account must have ${vn(n,o)} before fetchCalendars`)}const a=yield dn({url:n.homeUrl,props:null!=i?i:{[`${B.CALDAV}:calendar-description`]:{},[`${B.CALDAV}:calendar-timezone`]:{},[`${B.DAV}:displayname`]:{},[`${B.CALDAV_APPLE}:calendar-color`]:{},[`${B.CALENDAR_SERVER}:getctag`]:{},[`${B.DAV}:resourcetype`]:{},[`${B.CALDAV}:supported-calendar-component-set`]:{},[`${B.DAV}:sync-token`]:{}},depth:"1",headers:r});return Promise.all(a.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("calendar")})).filter((e=>{var t,r,n;return(Array.isArray(null===(t=e.props)||void 0===t?void 0:t.supportedCalendarComponentSet.comp)?null===(r=e.props)||void 0===r?void 0:r.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(n=e.props)||void 0===n?void 0:n.supportedCalendarComponentSet.comp._attributes.name]||[]).some((e=>Object.values(M).includes(e)))})).map((e=>{var t,r,i,o,a,s,u,c,l,d,h,f,p,g;const y=null===(t=e.props)||void 0===t?void 0:t.calendarDescription,v=null===(r=e.props)||void 0===r?void 0:r.calendarTimezone;return{description:"string"==typeof y?y:"",timezone:"string"==typeof v?v:"",url:new URL(null!==(i=e.href)&&void 0!==i?i:"",null!==(o=n.rootUrl)&&void 0!==o?o:"").href,ctag:null===(a=e.props)||void 0===a?void 0:a.getctag,calendarColor:null===(s=e.props)||void 0===s?void 0:s.calendarColor,displayName:null!==(c=null===(u=e.props)||void 0===u?void 0:u.displayname._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.displayname,components:Array.isArray(null===(d=e.props)||void 0===d?void 0:d.supportedCalendarComponentSet.comp)?null===(h=e.props)||void 0===h?void 0:h.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(f=e.props)||void 0===f?void 0:f.supportedCalendarComponentSet.comp._attributes.name],resourcetype:Object.keys(null===(p=e.props)||void 0===p?void 0:p.resourcetype),syncToken:null===(g=e.props)||void 0===g?void 0:g.syncToken}})).map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield En({collection:e,headers:r})})})))))})),Mn=e=>t(void 0,void 0,void 0,(function*(){const{calendar:t,objectUrls:r,filters:n,timeRange:i,headers:o,expand:a,urlFilter:s}=e;if(i){const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(i.start)&&e.test(i.end)||t.test(i.start)&&t.test(i.end)))throw new Error("invalid timeRange format, not in ISO8601")}In(`Fetching calendar objects from ${null==t?void 0:t.url}`);const u=["url"];if(!t||!yn(t,u)){if(!t)throw new Error("cannot fetchCalendarObjects for undefined calendar");throw new Error(`calendar must have ${vn(t,u)} before fetchCalendarObjects`)}const c=null!=n?n:[{"comp-filter":{_attributes:{name:"VCALENDAR"},"comp-filter":Object.assign({_attributes:{name:"VEVENT"}},i?{"time-range":{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})}}],l=(null!=r?r:(yield kn({url:t.url,props:{[`${B.DAV}:getetag`]:Object.assign({},a&&i?{[`${B.CALDAV}:expand`]:{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:c,depth:"1",headers:o})).map((e=>{var t;return null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(null!=s?s:e=>Boolean(null==e?void 0:e.includes(".ics"))).map((e=>new URL(e).pathname));let d=[];return l.length>0&&(d=a?yield kn({url:t.url,props:{[`${B.DAV}:getetag`]:{},[`${B.CALDAV}:calendar-data`]:Object.assign({},a&&i?{[`${B.CALDAV}:expand`]:{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:c,depth:"1",headers:o}):yield Pn({url:t.url,props:{[`${B.DAV}:getetag`]:{},[`${B.CALDAV}:calendar-data`]:Object.assign({},a&&i?{[`${B.CALDAV}:expand`]:{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},objectUrls:l,depth:"1",headers:o})),d.map((e=>{var r,n,i,o,a,s;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:`${null===(n=e.props)||void 0===n?void 0:n.getetag}`,data:null!==(a=null===(o=null===(i=e.props)||void 0===i?void 0:i.calendarData)||void 0===o?void 0:o._cdata)&&void 0!==a?a:null===(s=e.props)||void 0===s?void 0:s.calendarData}}))})),Vn=e=>t(void 0,void 0,void 0,(function*(){const{calendar:t,iCalString:r,filename:n,headers:i}=e;return hn({url:new URL(n,t.url).href,data:r,headers:Object.assign({"content-type":"text/calendar; charset=utf-8","If-None-Match":"*"},i)})})),Kn=e=>t(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return fn({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/calendar; charset=utf-8"},r)})})),$n=e=>t(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return pn({url:t.url,etag:t.etag,headers:r})})),Yn=e=>t(void 0,void 0,void 0,(function*(){var r;const{oldCalendars:n,account:i,detailedResult:o,headers:a}=e;if(!i)throw new Error("Must have account before syncCalendars");const s=null!==(r=null!=n?n:i.calendars)&&void 0!==r?r:[],u=yield Bn({account:i,headers:a}),c=u.filter((e=>s.every((t=>!on(t.url,e.url)))));In(`new calendars: ${c.map((e=>e.displayName))}`);const l=s.reduce(((e,t)=>{const r=u.find((e=>on(e.url,t.url)));return r&&(r.syncToken&&r.syncToken!==t.syncToken||r.ctag&&r.ctag!==t.ctag)?[...e,r]:e}),[]);In(`updated calendars: ${l.map((e=>e.displayName))}`);const d=yield Promise.all(l.map((e=>t(void 0,void 0,void 0,(function*(){return yield _n({collection:Object.assign(Object.assign({},e),{objectMultiGet:Pn}),method:"webdav",headers:a,account:i})}))))),h=s.filter((e=>u.every((t=>!on(t.url,e.url)))));In(`deleted calendars: ${h.map((e=>e.displayName))}`);const f=s.filter((e=>u.some((t=>on(t.url,e.url)&&(t.syncToken&&t.syncToken!==e.syncToken||t.ctag&&t.ctag!==e.ctag)))));return o?{created:c,updated:l,deleted:h}:[...f,...c,...d]})),Hn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,timeRange:r,depth:n,headers:i}=e;if(!r)throw new Error("timeRange is required");{const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(r.start)&&e.test(r.end)||t.test(r.start)&&t.test(r.end)))throw new Error("invalid timeRange format, not in ISO8601")}return(yield bn({url:t,body:{"free-busy-query":sn({_attributes:an([k.CALDAV]),[`${B.CALDAV}:time-range`]:{_attributes:{start:`${new Date(r.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(r.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}})},defaultNamespace:B.CALDAV,depth:n,headers:i}))[0]}));var qn=Object.freeze({__proto__:null,calendarQuery:kn,calendarMultiGet:Pn,makeCalendar:Un,fetchCalendars:Bn,fetchCalendarObjects:Mn,createCalendarObject:Vn,updateCalendarObject:Kn,deleteCalendarObject:$n,syncCalendars:Yn,freeBusyQuery:Hn});const zn=P("tsdav:account"),Gn=e=>t(void 0,void 0,void 0,(function*(){var t,r;zn("Service discovery...");const{account:n,headers:o}=e,a=new URL(n.serverUrl),s=new URL(`/.well-known/${n.accountType}`,a);s.protocol=null!==(t=a.protocol)&&void 0!==t?t:"http";try{const e=yield i.exports.fetch(s.href,{headers:o,method:"PROPFIND",redirect:"manual"});if(e.status>=300&&e.status<400){const t=e.headers.get("Location");if("string"==typeof t&&t.length){zn(`Service discovery redirected to ${t}`);const e=new URL(t,a);return e.hostname===s.hostname&&s.port&&!e.port&&(e.port=s.port),e.protocol=null!==(r=a.protocol)&&void 0!==r?r:"http",e.href}}}catch(e){zn(`Service discovery failed: ${e.stack}`)}return a.href})),Wn=e=>t(void 0,void 0,void 0,(function*(){var t,r,n,i,o;const{account:a,headers:s}=e,u=["rootUrl"];if(!yn(a,u))throw new Error(`account must have ${vn(a,u)} before fetchPrincipalUrl`);zn(`Fetching principal url from path ${a.rootUrl}`);const[c]=yield dn({url:a.rootUrl,props:{[`${B.DAV}:current-user-principal`]:{}},depth:"0",headers:s});if(!c.ok&&(zn(`Fetch principal url failed: ${c.statusText}`),401===c.status))throw new Error("Invalid credentials");return zn(`Fetched principal url ${null===(r=null===(t=c.props)||void 0===t?void 0:t.currentUserPrincipal)||void 0===r?void 0:r.href}`),new URL(null!==(o=null===(i=null===(n=c.props)||void 0===n?void 0:n.currentUserPrincipal)||void 0===i?void 0:i.href)&&void 0!==o?o:"",a.rootUrl).href})),Qn=e=>t(void 0,void 0,void 0,(function*(){var t,r;const{account:n,headers:i}=e,o=["principalUrl","rootUrl"];if(!yn(n,o))throw new Error(`account must have ${vn(n,o)} before fetchHomeUrl`);zn(`Fetch home url from ${n.principalUrl}`);const a=(yield dn({url:n.principalUrl,props:"caldav"===n.accountType?{[`${B.CALDAV}:calendar-home-set`]:{}}:{[`${B.CARDDAV}:addressbook-home-set`]:{}},depth:"0",headers:i})).find((e=>on(n.principalUrl,e.href)));if(!a||!a.ok)throw new Error("cannot find homeUrl");const s=new URL("caldav"===n.accountType?null===(t=null==a?void 0:a.props)||void 0===t?void 0:t.calendarHomeSet.href:null===(r=null==a?void 0:a.props)||void 0===r?void 0:r.addressbookHomeSet.href,n.rootUrl).href;return zn(`Fetched home url ${s}`),s})),Xn=e=>t(void 0,void 0,void 0,(function*(){const{account:r,headers:n,loadCollections:i=!1,loadObjects:o=!1}=e,a=Object.assign({},r);return a.rootUrl=yield Gn({account:r,headers:n}),a.principalUrl=yield Wn({account:a,headers:n}),a.homeUrl=yield Qn({account:a,headers:n}),(i||o)&&("caldav"===r.accountType?a.calendars=yield Bn({headers:n,account:a}):"carddav"===r.accountType&&(a.addressBooks=yield xn({headers:n,account:a}))),o&&("caldav"===r.accountType&&a.calendars?a.calendars=yield Promise.all(a.calendars.map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield Mn({calendar:e,headers:n})})}))))):"carddav"===r.accountType&&a.addressBooks&&(a.addressBooks=yield Promise.all(a.addressBooks.map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield Sn({addressBook:e,headers:n})})}))))))),a}));var Zn,Jn,ei=Object.freeze({__proto__:null,serviceDiscovery:Gn,fetchPrincipalUrl:Wn,fetchHomeUrl:Qn,createAccount:Xn}),ti={exports:{}}; -/*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */ -Zn=ti,Jn=ti.exports,function(e){var t=Jn,n=Zn&&Zn.exports==t&&Zn,i="object"==typeof r&&r;i.global!==i&&i.window!==i||(e=i);var o=function(e){this.message=e};(o.prototype=new Error).name="InvalidCharacterError";var a=function(e){throw new o(e)},s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=/[\t\n\f\r ]/g,c={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&a("The string to be encoded contains characters outside of the Latin1 range.");for(var t,r,n,i,o=e.length%3,u="",c=-1,l=e.length-o;++c>18&63)+s.charAt(i>>12&63)+s.charAt(i>>6&63)+s.charAt(63&i);return 2==o?(t=e.charCodeAt(c)<<8,r=e.charCodeAt(++c),u+=s.charAt((i=t+r)>>10)+s.charAt(i>>4&63)+s.charAt(i<<2&63)+"="):1==o&&(i=e.charCodeAt(c),u+=s.charAt(i>>2)+s.charAt(i<<4&63)+"=="),u},decode:function(e){var t=(e=String(e).replace(u,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&a("Invalid character: the string to be decoded is not correctly encoded.");for(var r,n,i=0,o="",c=-1;++c>(-2*i&6)));return o},version:"1.0.0"};if(t&&!t.nodeType)if(n)n.exports=c;else for(var l in c)c.hasOwnProperty(l)&&(t[l]=c[l]);else e.base64=c}(r);const ri=P("tsdav:authHelper"),ni=(e,t)=>(...r)=>e(Object.assign(Object.assign({},t),r[0])),ii=e=>(ri(`Basic auth token generated: ${ti.exports.encode(`${e.username}:${e.password}`)}`),{authorization:`Basic ${ti.exports.encode(`${e.username}:${e.password}`)}`}),oi=e=>t(void 0,void 0,void 0,(function*(){const t=["authorizationCode","redirectUrl","clientId","clientSecret","tokenUrl"];if(!yn(e,t))throw new Error(`Oauth credentials missing: ${vn(e,t)}`);const r=new URLSearchParams({grant_type:"authorization_code",code:e.authorizationCode,redirect_uri:e.redirectUrl,client_id:e.clientId,client_secret:e.clientSecret});ri(e.tokenUrl),ri(r.toString());const n=yield i.exports.fetch(e.tokenUrl,{method:"POST",body:r.toString(),headers:{"content-length":`${r.toString().length}`,"content-type":"application/x-www-form-urlencoded"}});if(n.ok){return yield n.json()}return ri(`Fetch Oauth tokens failed: ${yield n.text()}`),{}})),ai=e=>t(void 0,void 0,void 0,(function*(){const t=["refreshToken","clientId","clientSecret","tokenUrl"];if(!yn(e,t))throw new Error(`Oauth credentials missing: ${vn(e,t)}`);const r=new URLSearchParams({client_id:e.clientId,client_secret:e.clientSecret,refresh_token:e.refreshToken,grant_type:"refresh_token"}),n=yield i.exports.fetch(e.tokenUrl,{method:"POST",body:r.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(n.ok){return yield n.json()}return ri(`Refresh access token failed: ${yield n.text()}`),{}})),si=e=>t(void 0,void 0,void 0,(function*(){var t;ri("Fetching oauth headers");let r={};return e.refreshToken?(e.refreshToken&&!e.accessToken||Date.now()>(null!==(t=e.expiration)&&void 0!==t?t:0))&&(r=yield ai(e)):r=yield oi(e),ri(`Oauth tokens fetched: ${r.access_token}`),{tokens:r,headers:{authorization:`Bearer ${r.access_token}`}}}));var ui=Object.freeze({__proto__:null,defaultParam:ni,getBasicAuthHeaders:ii,fetchOauthTokens:oi,refreshAccessToken:ai,getOauthHeaders:si});const ci=r=>t(void 0,void 0,void 0,(function*(){const{serverUrl:n,credentials:i,authMethod:o,defaultAccountType:a}=r,s="Basic"===o?ii(i):"Oauth"===o?(yield si(i)).headers:{},u=a?yield Xn({account:{serverUrl:n,credentials:i,accountType:a},headers:s}):void 0,c=ni(hn,{url:n,headers:s}),l=ni(fn,{headers:s,url:n}),d=ni(pn,{headers:s,url:n}),h=ni(dn,{headers:s}),f=ni(bn,{headers:s}),p=ni(wn,{headers:s}),g=ni(Tn,{headers:s}),y=ni(En,{headers:s}),v=ni(An,{headers:s}),m=ni(_n,{headers:s,account:u}),b=ni(kn,{headers:s}),w=ni(Pn,{headers:s}),E=ni(Un,{headers:s}),A=ni(Bn,{headers:s,account:u}),T=ni(Mn,{headers:s}),_=ni(Vn,{headers:s}),C=ni(Kn,{headers:s}),O=ni($n,{headers:s}),D=ni(Yn,{account:u,headers:s}),R=ni(Dn,{headers:s}),x=ni(Rn,{headers:s});return{davRequest:r=>t(void 0,void 0,void 0,(function*(){const{init:t}=r,n=e(r,["init"]),{headers:i}=t,o=e(t,["headers"]);return ln(Object.assign(Object.assign({},n),{init:Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},s),i)})}))})),propfind:h,createAccount:e=>t(void 0,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:o,loadObjects:a}=e;return Xn({account:Object.assign({serverUrl:n,credentials:i},t),headers:Object.assign(Object.assign({},s),r),loadCollections:o,loadObjects:a})})),createObject:c,updateObject:l,deleteObject:d,calendarQuery:b,addressBookQuery:R,collectionQuery:f,makeCollection:p,calendarMultiGet:w,makeCalendar:E,syncCollection:g,supportedReportSet:y,isCollectionDirty:v,smartCollectionSync:m,fetchCalendars:A,fetchCalendarObjects:T,createCalendarObject:_,updateCalendarObject:C,deleteCalendarObject:O,syncCalendars:D,fetchAddressBooks:ni(xn,{account:u,headers:s}),addressBookMultiGet:x,fetchVCards:ni(Sn,{headers:s}),createVCard:ni(Fn,{headers:s}),updateVCard:ni(Nn,{headers:s}),deleteVCard:ni(Ln,{headers:s})}}));class li{constructor(e){var t,r;this.serverUrl=e.serverUrl,this.credentials=e.credentials,this.authMethod=null!==(t=e.authMethod)&&void 0!==t?t:"Basic",this.accountType=null!==(r=e.defaultAccountType)&&void 0!==r?r:"caldav"}login(){return t(this,void 0,void 0,(function*(){this.authHeaders="Basic"===this.authMethod?ii(this.credentials):"Oauth"===this.authMethod?(yield si(this.credentials)).headers:{},this.account=this.accountType?yield Xn({account:{serverUrl:this.serverUrl,credentials:this.credentials,accountType:this.accountType},headers:this.authHeaders}):void 0}))}davRequest(r){return t(this,void 0,void 0,(function*(){const{init:t}=r,n=e(r,["init"]),{headers:i}=t,o=e(t,["headers"]);return ln(Object.assign(Object.assign({},n),{init:Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},this.authHeaders),i)})}))}))}createObject(...e){return t(this,void 0,void 0,(function*(){return ni(hn,{url:this.serverUrl,headers:this.authHeaders})(e[0])}))}updateObject(...e){return t(this,void 0,void 0,(function*(){return ni(fn,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}deleteObject(...e){return t(this,void 0,void 0,(function*(){return ni(pn,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}propfind(...e){return t(this,void 0,void 0,(function*(){return ni(dn,{headers:this.authHeaders})(e[0])}))}createAccount(e){return t(this,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:n,loadObjects:i}=e;return Xn({account:Object.assign({serverUrl:this.serverUrl,credentials:this.credentials},t),headers:Object.assign(Object.assign({},this.authHeaders),r),loadCollections:n,loadObjects:i})}))}collectionQuery(...e){return t(this,void 0,void 0,(function*(){return ni(bn,{headers:this.authHeaders})(e[0])}))}makeCollection(...e){return t(this,void 0,void 0,(function*(){return ni(wn,{headers:this.authHeaders})(e[0])}))}syncCollection(...e){return t(this,void 0,void 0,(function*(){return ni(Tn,{headers:this.authHeaders})(e[0])}))}supportedReportSet(...e){return t(this,void 0,void 0,(function*(){return ni(En,{headers:this.authHeaders})(e[0])}))}isCollectionDirty(...e){return t(this,void 0,void 0,(function*(){return ni(An,{headers:this.authHeaders})(e[0])}))}smartCollectionSync(...e){return t(this,void 0,void 0,(function*(){return ni(_n,{headers:this.authHeaders,account:this.account})(e[0])}))}calendarQuery(...e){return t(this,void 0,void 0,(function*(){return ni(kn,{headers:this.authHeaders})(e[0])}))}makeCalendar(...e){return t(this,void 0,void 0,(function*(){return ni(Un,{headers:this.authHeaders})(e[0])}))}calendarMultiGet(...e){return t(this,void 0,void 0,(function*(){return ni(Pn,{headers:this.authHeaders})(e[0])}))}fetchCalendars(...e){return t(this,void 0,void 0,(function*(){return ni(Bn,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchCalendarObjects(...e){return t(this,void 0,void 0,(function*(){return ni(Mn,{headers:this.authHeaders})(e[0])}))}createCalendarObject(...e){return t(this,void 0,void 0,(function*(){return ni(Vn,{headers:this.authHeaders})(e[0])}))}updateCalendarObject(...e){return t(this,void 0,void 0,(function*(){return ni(Kn,{headers:this.authHeaders})(e[0])}))}deleteCalendarObject(...e){return t(this,void 0,void 0,(function*(){return ni($n,{headers:this.authHeaders})(e[0])}))}syncCalendars(...e){return t(this,void 0,void 0,(function*(){return ni(Yn,{headers:this.authHeaders,account:this.account})(e[0])}))}addressBookQuery(...e){return t(this,void 0,void 0,(function*(){return ni(Dn,{headers:this.authHeaders})(e[0])}))}addressBookMultiGet(...e){return t(this,void 0,void 0,(function*(){return ni(Rn,{headers:this.authHeaders})(e[0])}))}fetchAddressBooks(...e){return t(this,void 0,void 0,(function*(){return ni(xn,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchVCards(...e){return t(this,void 0,void 0,(function*(){return ni(Sn,{headers:this.authHeaders})(e[0])}))}createVCard(...e){return t(this,void 0,void 0,(function*(){return ni(Fn,{headers:this.authHeaders})(e[0])}))}updateVCard(...e){return t(this,void 0,void 0,(function*(){return ni(Nn,{headers:this.authHeaders})(e[0])}))}deleteVCard(...e){return t(this,void 0,void 0,(function*(){return ni(Ln,{headers:this.authHeaders})(e[0])}))}}var di=Object.freeze({__proto__:null,createDAVClient:ci,DAVClient:li}),hi=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({DAVNamespace:k,DAVNamespaceShort:B,DAVAttributeMap:U},di),gn),Cn),ei),jn),qn),ui),un);export{U as DAVAttributeMap,li as DAVClient,k as DAVNamespace,B as DAVNamespaceShort,Dn as addressBookQuery,Pn as calendarMultiGet,kn as calendarQuery,sn as cleanupFalsy,bn as collectionQuery,Xn as createAccount,Vn as createCalendarObject,ci as createDAVClient,hn as createObject,Fn as createVCard,ln as davRequest,hi as default,$n as deleteCalendarObject,pn as deleteObject,Ln as deleteVCard,xn as fetchAddressBooks,Mn as fetchCalendarObjects,Bn as fetchCalendars,oi as fetchOauthTokens,Sn as fetchVCards,Hn as freeBusyQuery,ii as getBasicAuthHeaders,an as getDAVAttribute,si as getOauthHeaders,An as isCollectionDirty,Un as makeCalendar,dn as propfind,ai as refreshAccessToken,_n as smartCollectionSync,En as supportedReportSet,Yn as syncCalendars,Tn as syncCollection,Kn as updateCalendarObject,fn as updateObject,Nn as updateVCard,on as urlContains,nn as urlEquals}; +function e(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e,t,r,n=f(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=p(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function E(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},E.error=function(){var e=new E(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];E.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new E(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,r){return new Promise((function(n,o){var a=new b(e,r);if(a.signal&&a.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new E(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}T.polyfill=!0,e.fetch||(e.fetch=T,e.Headers=h,e.Request=b,e.Response=E),t.Headers=h,t.Request=b,t.Response=E,t.fetch=T,Object.defineProperty(t,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(o,o.exports);var a=o.exports,s="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function u(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}var l=u,d=c;function h(e){if(l===setTimeout)return setTimeout(e,0);if((l===u||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}"function"==typeof s.setTimeout&&(l=setTimeout),"function"==typeof s.clearTimeout&&(d=clearTimeout);var f,p=[],g=!1,y=-1;function v(){g&&f&&(g=!1,f.length?p=f.concat(p):y=-1,p.length&&m())}function m(){if(!g){var e=h(v);g=!0;for(var t=p.length;t;){for(f=p,p=[];++y1)for(var r=1;r=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return N=function(s,u){u=u||{};var c=typeof s;if("string"===c&&s.length>0)return function(a){if((a=String(a)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!s)return;var u=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*o;case"weeks":case"week":case"w":return u*i;case"days":case"day":case"d":return u*n;case"hours":case"hour":case"hrs":case"hr":case"h":return u*r;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(s);if("number"===c&&isFinite(s))return u.long?function(i){var o=Math.abs(i);if(o>=n)return a(i,o,n,"day");if(o>=r)return a(i,o,r,"hour");if(o>=t)return a(i,o,t,"minute");if(o>=e)return a(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=n)return Math.round(i/n)+"d";if(o>=r)return Math.round(i/r)+"h";if(o>=t)return Math.round(i/t)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},N}var P=function(e){function t(e){let n,i,o,a=null;function s(...e){if(!s.enabled)return;const r=s,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==j&&"env"in j&&(e=j.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=P(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(I,I.exports);var U,B=n(I.exports);!function(e){e.CALENDAR_SERVER="http://calendarserver.org/ns/",e.CALDAV_APPLE="http://apple.com/ns/ical/",e.CALDAV="urn:ietf:params:xml:ns:caldav",e.CARDDAV="urn:ietf:params:xml:ns:carddav",e.DAV="DAV:"}(U||(U={}));const M={[U.CALDAV]:"xmlns:c",[U.CARDDAV]:"xmlns:card",[U.CALENDAR_SERVER]:"xmlns:cs",[U.CALDAV_APPLE]:"xmlns:ca",[U.DAV]:"xmlns:d"};var V,K;!function(e){e.CALDAV="c",e.CARDDAV="card",e.CALENDAR_SERVER="cs",e.CALDAV_APPLE="ca",e.DAV="d"}(V||(V={})),function(e){e.VEVENT="VEVENT",e.VTODO="VTODO",e.VJOURNAL="VJOURNAL",e.VFREEBUSY="VFREEBUSY",e.VTIMEZONE="VTIMEZONE",e.VALARM="VALARM"}(K||(K={}));var $=[],Y=[],H="undefined"!=typeof Uint8Array?Uint8Array:Array,q=!1;function z(){q=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t>18&63]+$[i>>12&63]+$[i>>6&63]+$[63&i]);return o.join("")}function W(e){var t;q||z();for(var r=e.length,n=r%3,i="",o=[],a=16383,s=0,u=r-n;su?u:s+a));return 1===n?(t=e[r-1],i+=$[t>>2],i+=$[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=$[t>>10],i+=$[t>>4&63],i+=$[t<<2&63],i+="="),o.push(i),o.join("")}function Q(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,l=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=c}return(f?-1:1)*a*Math.pow(2,o-n)}function X(e,t,r,n,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=p,s/=256,i-=8);for(a=a<0;e[r+f]=255&a,f+=p,a/=256,c-=8);e[r+f-p]|=128*g}var Z={}.toString,J=Array.isArray||function(e){return"[object Array]"==Z.call(e)};function ee(){return re.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function te(e,t){if(ee()=ee())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ee().toString(16)+" bytes");return 0|e}function ue(e){return!(null==e||!e._isBuffer)}function ce(e,t){if(ue(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Ie(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return ke(e).length;default:if(n)return Ie(e).length;t=(""+t).toLowerCase(),n=!0}}function le(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return _e(this,t,r);case"utf8":case"utf-8":return Ee(this,t,r);case"ascii":return Ae(this,t,r);case"latin1":case"binary":return Te(this,t,r);case"base64":return we(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function de(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function he(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=re.from(t,n)),ue(t))return 0===t.length?-1:fe(e,t,r,n,i);if("number"==typeof t)return t&=255,re.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):fe(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function fe(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var d=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function we(e,t,r){return 0===t&&r===e.length?W(e):W(e.slice(t,r))}function Ee(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,d=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},re.prototype.compare=function(e,t,r,n,i){if(!ue(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=e.slice(t,r),l=0;li)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return pe(this,e,t,r);case"utf8":case"utf-8":return ge(this,e,t,r);case"ascii":return ye(this,e,t,r);case"latin1":case"binary":return ve(this,e,t,r);case"base64":return me(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},re.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ae(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function De(e,t,r,n,i,o){if(!ue(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function xe(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function Re(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function Fe(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Se(e,t,r,n,i){return i||Fe(e,0,r,4),X(e,t,r,n,23,4),r+4}function Ne(e,t,r,n,i){return i||Fe(e,0,r,8),X(e,t,r,n,52,8),r+8}re.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},re.prototype.readUInt8=function(e,t){return t||Oe(e,1,this.length),this[e]},re.prototype.readUInt16LE=function(e,t){return t||Oe(e,2,this.length),this[e]|this[e+1]<<8},re.prototype.readUInt16BE=function(e,t){return t||Oe(e,2,this.length),this[e]<<8|this[e+1]},re.prototype.readUInt32LE=function(e,t){return t||Oe(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},re.prototype.readUInt32BE=function(e,t){return t||Oe(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},re.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Oe(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},re.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Oe(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},re.prototype.readInt8=function(e,t){return t||Oe(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},re.prototype.readInt16LE=function(e,t){t||Oe(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},re.prototype.readInt16BE=function(e,t){t||Oe(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},re.prototype.readInt32LE=function(e,t){return t||Oe(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},re.prototype.readInt32BE=function(e,t){return t||Oe(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},re.prototype.readFloatLE=function(e,t){return t||Oe(e,4,this.length),Q(this,e,!0,23,4)},re.prototype.readFloatBE=function(e,t){return t||Oe(e,4,this.length),Q(this,e,!1,23,4)},re.prototype.readDoubleLE=function(e,t){return t||Oe(e,8,this.length),Q(this,e,!0,52,8)},re.prototype.readDoubleBE=function(e,t){return t||Oe(e,8,this.length),Q(this,e,!1,52,8)},re.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||De(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},re.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,1,255,0),re.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},re.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,65535,0),re.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):xe(this,e,t,!0),t+2},re.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,65535,0),re.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):xe(this,e,t,!1),t+2},re.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,4294967295,0),re.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Re(this,e,t,!0),t+4},re.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,4294967295,0),re.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Re(this,e,t,!1),t+4},re.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);De(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},re.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);De(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},re.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,1,127,-128),re.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},re.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,32767,-32768),re.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):xe(this,e,t,!0),t+2},re.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,2,32767,-32768),re.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):xe(this,e,t,!1),t+2},re.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,2147483647,-2147483648),re.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Re(this,e,t,!0),t+4},re.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||De(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),re.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Re(this,e,t,!1),t+4},re.prototype.writeFloatLE=function(e,t,r){return Se(this,e,t,!0,r)},re.prototype.writeFloatBE=function(e,t,r){return Se(this,e,t,!1,r)},re.prototype.writeDoubleLE=function(e,t,r){return Ne(this,e,t,!0,r)},re.prototype.writeDoubleBE=function(e,t,r){return Ne(this,e,t,!1,r)},re.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!re.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function ke(e){return function(e){var t,r,n,i,o,a;q||z();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new H(3*s/4-o),n=o>0?s-4:s;var u=0;for(t=0,r=0;t>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=Y[e.charCodeAt(t)]<<2|Y[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=Y[e.charCodeAt(t)]<<10|Y[e.charCodeAt(t+1)]<<4|Y[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Le,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Pe(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Ue(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Be={};function Me(){}function Ve(){Ve.init.call(this)}function Ke(e){return void 0===e._maxListeners?Ve.defaultMaxListeners:e._maxListeners}function $e(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Xe(e,n),o=0;o0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=r,++e._eventsCount;return e}function We(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Qe(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Xe(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}Me.prototype=Object.create(null),Ve.EventEmitter=Ve,Ve.usingDomains=!1,Ve.prototype.domain=void 0,Ve.prototype._events=void 0,Ve.prototype._maxListeners=void 0,Ve.defaultMaxListeners=10,Ve.init=function(){this.domain=null,Ve.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Me,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ve.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Ve.prototype.getMaxListeners=function(){return Ke(this)},Ve.prototype.emit=function(e){var t,r,n,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:$e(r,l,this);break;case 2:Ye(r,l,this,arguments[1]);break;case 3:He(r,l,this,arguments[1],arguments[2]);break;case 4:qe(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Me,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var Ze="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},Je=/%[sdj%]/g;function et(e){if(!ht(e)){for(var t=[],r=0;r=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),lt(t)?r.showHidden=t:t&&wt(r,t),ft(r.showHidden)&&(r.showHidden=!1),ft(r.depth)&&(r.depth=2),ft(r.colors)&&(r.colors=!1),ft(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=ot),st(r,e,r.depth)}function ot(e,t){var r=it.styles[t];return r?"["+it.colors[r][0]+"m"+e+"["+it.colors[r][1]+"m":e}function at(e,t){return e}function st(e,t,r){if(e.customInspect&&t&&mt(t.inspect)&&t.inspect!==it&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return ht(n)||(n=st(e,n,r)),n}var i=function(e,t){if(ft(t))return e.stylize("undefined","undefined");if(ht(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(n=t,"number"==typeof n)return e.stylize(""+t,"number");var n;if(lt(t))return e.stylize(""+t,"boolean");if(dt(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),vt(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ut(t);if(0===o.length){if(mt(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(pt(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(yt(t))return e.stylize(Date.prototype.toString.call(t),"date");if(vt(t))return ut(t)}var u,c,l="",d=!1,h=["{","}"];(u=t,Array.isArray(u)&&(d=!0,h=["[","]"]),mt(t))&&(l=" [Function"+(t.name?": "+t.name:"")+"]");return pt(t)&&(l=" "+RegExp.prototype.toString.call(t)),yt(t)&&(l=" "+Date.prototype.toUTCString.call(t)),vt(t)&&(l=" "+ut(t)),0!==o.length||d&&0!=t.length?r<0?pt(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),c=d?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,l,h)):h[0]+l+h[1]}function ut(e){return"["+Error.prototype.toString.call(e)+"]"}function ct(e,t,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),Et(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=dt(r)?st(e,u.value,null):st(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),ft(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function lt(e){return"boolean"==typeof e}function dt(e){return null===e}function ht(e){return"string"==typeof e}function ft(e){return void 0===e}function pt(e){return gt(e)&&"[object RegExp]"===bt(e)}function gt(e){return"object"==typeof e&&null!==e}function yt(e){return gt(e)&&"[object Date]"===bt(e)}function vt(e){return gt(e)&&("[object Error]"===bt(e)||e instanceof Error)}function mt(e){return"function"==typeof e}function bt(e){return Object.prototype.toString.call(e)}function wt(e,t){if(!t||!gt(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function Et(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function At(){this.head=null,this.tail=null,this.length=0}it.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},it.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},At.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},At.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},At.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},At.prototype.clear=function(){this.head=this.tail=null,this.length=0},At.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},At.prototype.concat=function(e){if(0===this.length)return re.alloc(0);if(1===this.length)return this.head.data;for(var t=re.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var Tt=re.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _t(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Tt(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Ot;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Dt;break;default:return void(this.write=Ct)}this.charBuffer=new re(6),this.charReceived=0,this.charLength=0}function Ct(e){return e.toString(this.encoding)}function Ot(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Dt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}_t.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var i;n=(t+=e.toString(this.encoding,0,n)).length-1;if((i=t.charCodeAt(n))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,n)}return t},_t.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},_t.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t};var xt=Object.freeze({__proto__:null,StringDecoder:_t});St.ReadableState=Ft;var Rt=function(e){if(ft(rt)&&(rt=j.env.NODE_DEBUG||""),e=e.toUpperCase(),!nt[e])if(new RegExp("\\b"+e+"\\b","i").test(rt)){nt[e]=function(){var t=et.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else nt[e]=function(){};return nt[e]}("stream");function Ft(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof ir&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new At,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new _t(e.encoding),this.encoding=e.encoding)}function St(e){if(!(this instanceof St))return new St(e);this._readableState=new Ft(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Ve.call(this)}function Nt(e,t,r,n,i){var o=function(e,t){var r=null;re.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,jt(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||n||(r=t.decoder.write(r),u=!t.objectMode&&0===r.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&jt(e))),function(e,t){t.readingMore||(t.readingMore=!0,b(kt,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function jt(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Rt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?b(It,e):It(e))}function It(e){Rt("emit readable"),e.emit("readable"),Bt(e)}function kt(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=re.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function Vt(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,b(Kt,t,e))}function Kt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function $t(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return Rt("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Vt(this):jt(this),null;if(0===(e=Lt(e,t))&&t.ended)return 0===t.length&&Vt(this),null;var n,i=t.needReadable;return Rt("need readable",i),(0===t.length||t.length-e0?Mt(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Vt(this)),null!==n&&this.emit("data",n),n},St.prototype._read=function(e){this.emit("error",new Error("not implemented"))},St.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,Rt("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?a:c;function o(e){Rt("onunpipe"),e===r&&c()}function a(){Rt("onend"),e.end()}n.endEmitted?b(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;Rt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Bt(e))}}(r);e.on("drain",s);var u=!1;function c(){Rt("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",c),r.removeListener("data",d),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var l=!1;function d(t){Rt("ondata"),l=!1,!1!==e.write(t)||l||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==$t(n.pipes,e))&&!u&&(Rt("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,l=!0),r.pause())}function h(t){var r;Rt("onerror",t),g(),e.removeListener("error",h),0===(r="error",e.listeners(r).length)&&e.emit("error",t)}function f(){e.removeListener("finish",p),g()}function p(){Rt("onfinish"),e.removeListener("close",f),g()}function g(){Rt("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",r),n.flowing||(Rt("pipe resume"),r.resume()),e},St.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},zt.prototype._write=function(e,t,r){r(new Error("not implemented"))},zt.prototype._writev=null,zt.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,Jt(e,t),r&&(t.finished?b(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},Ze(ir,St);for(var tr=Object.keys(zt.prototype),rr=0;rr"===o?(_(n,"onsgmldeclaration",n.sgmlDecl),n.sgmlDecl="",n.state=E.TEXT):p(o)?(n.state=E.SGML_DECL_QUOTED,n.sgmlDecl+=o):n.sgmlDecl+=o;continue;case E.SGML_DECL_QUOTED:o===n.q&&(n.state=E.SGML_DECL,n.q=""),n.sgmlDecl+=o;continue;case E.DOCTYPE:">"===o?(n.state=E.TEXT,_(n,"ondoctype",n.doctype),n.doctype=!0):(n.doctype+=o,"["===o?n.state=E.DOCTYPE_DTD:p(o)&&(n.state=E.DOCTYPE_QUOTED,n.q=o));continue;case E.DOCTYPE_QUOTED:n.doctype+=o,o===n.q&&(n.q="",n.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:n.doctype+=o,"]"===o?n.state=E.DOCTYPE:p(o)&&(n.state=E.DOCTYPE_DTD_QUOTED,n.q=o);continue;case E.DOCTYPE_DTD_QUOTED:n.doctype+=o,o===n.q&&(n.state=E.DOCTYPE_DTD,n.q="");continue;case E.COMMENT:"-"===o?n.state=E.COMMENT_ENDING:n.comment+=o;continue;case E.COMMENT_ENDING:"-"===o?(n.state=E.COMMENT_ENDED,n.comment=O(n.opt,n.comment),n.comment&&_(n,"oncomment",n.comment),n.comment=""):(n.comment+="-"+o,n.state=E.COMMENT);continue;case E.COMMENT_ENDED:">"!==o?(R(n,"Malformed comment"),n.comment+="--"+o,n.state=E.COMMENT):n.state=E.TEXT;continue;case E.CDATA:"]"===o?n.state=E.CDATA_ENDING:n.cdata+=o;continue;case E.CDATA_ENDING:"]"===o?n.state=E.CDATA_ENDING_2:(n.cdata+="]"+o,n.state=E.CDATA);continue;case E.CDATA_ENDING_2:">"===o?(n.cdata&&_(n,"oncdata",n.cdata),_(n,"onclosecdata"),n.cdata="",n.state=E.TEXT):"]"===o?n.cdata+="]":(n.cdata+="]]"+o,n.state=E.CDATA);continue;case E.PROC_INST:"?"===o?n.state=E.PROC_INST_ENDING:f(o)?n.state=E.PROC_INST_BODY:n.procInstName+=o;continue;case E.PROC_INST_BODY:if(!n.procInstBody&&f(o))continue;"?"===o?n.state=E.PROC_INST_ENDING:n.procInstBody+=o;continue;case E.PROC_INST_ENDING:">"===o?(_(n,"onprocessinginstruction",{name:n.procInstName,body:n.procInstBody}),n.procInstName=n.procInstBody="",n.state=E.TEXT):(n.procInstBody+="?"+o,n.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:y(l,o)?n.tagName+=o:(F(n),">"===o?L(n):"/"===o?n.state=E.OPEN_TAG_SLASH:(f(o)||R(n,"Invalid character in tag name"),n.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:">"===o?(L(n,!0),j(n)):(R(n,"Forward-slash in opening tag not followed by >"),n.state=E.ATTRIB);continue;case E.ATTRIB:if(f(o))continue;">"===o?L(n):"/"===o?n.state=E.OPEN_TAG_SLASH:y(c,o)?(n.attribName=o,n.attribValue="",n.state=E.ATTRIB_NAME):R(n,"Invalid attribute name");continue;case E.ATTRIB_NAME:"="===o?n.state=E.ATTRIB_VALUE:">"===o?(R(n,"Attribute without value"),n.attribValue=n.attribName,N(n),L(n)):f(o)?n.state=E.ATTRIB_NAME_SAW_WHITE:y(l,o)?n.attribName+=o:R(n,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if("="===o)n.state=E.ATTRIB_VALUE;else{if(f(o))continue;R(n,"Attribute without value"),n.tag.attributes[n.attribName]="",n.attribValue="",_(n,"onattribute",{name:n.attribName,value:""}),n.attribName="",">"===o?L(n):y(c,o)?(n.attribName=o,n.state=E.ATTRIB_NAME):(R(n,"Invalid attribute name"),n.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(f(o))continue;p(o)?(n.q=o,n.state=E.ATTRIB_VALUE_QUOTED):(R(n,"Unquoted attribute value"),n.state=E.ATTRIB_VALUE_UNQUOTED,n.attribValue=o);continue;case E.ATTRIB_VALUE_QUOTED:if(o!==n.q){"&"===o?n.state=E.ATTRIB_VALUE_ENTITY_Q:n.attribValue+=o;continue}N(n),n.q="",n.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:f(o)?n.state=E.ATTRIB:">"===o?L(n):"/"===o?n.state=E.OPEN_TAG_SLASH:y(c,o)?(R(n,"No whitespace between attributes"),n.attribName=o,n.attribValue="",n.state=E.ATTRIB_NAME):R(n,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!g(o)){"&"===o?n.state=E.ATTRIB_VALUE_ENTITY_U:n.attribValue+=o;continue}N(n),">"===o?L(n):n.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(n.tagName)">"===o?j(n):y(l,o)?n.tagName+=o:n.script?(n.script+=""===o?j(n):R(n,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var u,m;switch(n.state){case E.TEXT_ENTITY:u=E.TEXT,m="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:u=E.ATTRIB_VALUE_QUOTED,m="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:u=E.ATTRIB_VALUE_UNQUOTED,m="attribValue"}";"===o?(n[m]+=I(n),n.entity="",n.state=u):y(n.entity.length?h:d,o)?n.entity+=o:(R(n,"Invalid character in entity name"),n[m]+="&"+n.entity+o,n.entity="",n.state=u);continue;default:throw new Error(n,"Unknown state: "+n.state)}return n.position>=n.bufferCheckPosition&&function(t){for(var n=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,o=0,a=r.length;on)switch(r[o]){case"textNode":C(t);break;case"cdata":_(t,"oncdata",t.cdata),t.cdata="";break;case"script":_(t,"onscript",t.script),t.script="";break;default:D(t,"Max buffer length exceeded: "+r[o])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(n),n} +/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;C(e=this),""!==e.cdata&&(_(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(_(e,"onscript",e.script),e.script="")}};try{t=hr.Stream}catch(e){t=function(){}}var i=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function o(e,r){if(!(this instanceof o))return new o(e,r);t.apply(this),this._parser=new n(e,r),this.writable=!0,this.readable=!0;var a=this;this._parser.onend=function(){a.emit("end")},this._parser.onerror=function(e){a.emit("error",e),a._parser.error=null},this._decoder=null,i.forEach((function(e){Object.defineProperty(a,"on"+e,{get:function(){return a._parser["on"+e]},set:function(t){if(!t)return a.removeAllListeners(e),a._parser["on"+e]=t,t;a.on(e,t)},enumerable:!0,configurable:!1})}))}o.prototype=Object.create(t.prototype,{constructor:{value:o}}),o.prototype.write=function(e){if("function"==typeof re.isBuffer&&re.isBuffer(e)){if(!this._decoder){var t=fr.StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},o.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},o.prototype.on=function(e,r){var n=this;return n._parser["on"+e]||-1===i.indexOf(e)||(n._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),n.emit.apply(n,t)}),t.prototype.on.call(n,e,r)};var a="http://www.w3.org/XML/1998/namespace",s="http://www.w3.org/2000/xmlns/",u={xml:a,xmlns:s},c=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,l=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function f(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function p(e){return'"'===e||"'"===e}function g(e){return">"===e||f(e)}function y(e,t){return e.test(t)}function v(e,t){return!y(e,t)}var m,b,w,E=0;for(var A in e.STATE={BEGIN:E++,BEGIN_WHITESPACE:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var r=e.ENTITIES[t],n="number"==typeof r?String.fromCharCode(r):r;e.ENTITIES[t]=n})),e.STATE)e.STATE[e.STATE[A]]=A;function T(e,t,r){e[t]&&e[t](r)}function _(e,t,r){e.textNode&&C(e),T(e,t,r)}function C(e){e.textNode=O(e.opt,e.textNode),e.textNode&&T(e,"ontext",e.textNode),e.textNode=""}function O(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function D(e,t){return C(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,T(e,"onerror",t),e}function x(e){return e.sawRoot&&!e.closedRoot&&R(e,"Unclosed root tag"),e.state!==E.BEGIN&&e.state!==E.BEGIN_WHITESPACE&&e.state!==E.TEXT&&D(e,"Unexpected end"),C(e),e.c="",e.closed=!0,T(e,"onend"),n.call(e,e.strict,e.opt),e}function R(e,t){if("object"!=typeof e||!(e instanceof n))throw new Error("bad call to strictFail");e.strict&&D(e,t)}function F(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,r=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(r.ns=t.ns),e.attribList.length=0,_(e,"onopentagstart",r)}function S(e,t){var r=e.indexOf(":")<0?["",e]:e.split(":"),n=r[0],i=r[1];return t&&"xmlns"===e&&(n="xmlns",i=""),{prefix:n,local:i}}function N(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=S(e.attribName,!0),r=t.prefix,n=t.local;if("xmlns"===r)if("xml"===n&&e.attribValue!==a)R(e,"xml: prefix must be bound to "+a+"\nActual: "+e.attribValue);else if("xmlns"===n&&e.attribValue!==s)R(e,"xmlns: prefix must be bound to "+s+"\nActual: "+e.attribValue);else{var i=e.tag,o=e.tags[e.tags.length-1]||e;i.ns===o.ns&&(i.ns=Object.create(o.ns)),i.ns[n]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,_(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function L(e,t){if(e.opt.xmlns){var r=e.tag,n=S(e.tagName);r.prefix=n.prefix,r.local=n.local,r.uri=r.ns[n.prefix]||"",r.prefix&&!r.uri&&(R(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),r.uri=n.prefix);var i=e.tags[e.tags.length-1]||e;r.ns&&i.ns!==r.ns&&Object.keys(r.ns).forEach((function(t){_(e,"onopennamespace",{prefix:t,uri:r.ns[t]})}));for(var o=0,a=e.attribList.length;o",e.tagName="",void(e.state=E.SCRIPT);_(e,"onscript",e.script),e.script=""}var t=e.tags.length,r=e.tagName;e.strict||(r=r[e.looseCase]());for(var n=r;t--&&e.tags[t].name!==n;)R(e,"Unexpected close tag");if(t<0)return R(e,"Unmatched closing tag: "+e.tagName),e.textNode+="",void(e.state=E.TEXT);e.tagName=r;for(var i=e.tags.length;i-- >t;){var o=e.tag=e.tags.pop();e.tagName=e.tag.name,_(e,"onclosetag",e.tagName);var a={};for(var s in o.ns)a[s]=o.ns[s];var u=e.tags[e.tags.length-1]||e;e.opt.xmlns&&o.ns!==u.ns&&Object.keys(o.ns).forEach((function(t){var r=o.ns[t];_(e,"onclosenamespace",{prefix:t,uri:r})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=E.TEXT}function I(e){var t,r=e.entity,n=r.toLowerCase(),i="";return e.ENTITIES[r]?e.ENTITIES[r]:e.ENTITIES[n]?e.ENTITIES[n]:("#"===(r=n).charAt(0)&&("x"===r.charAt(1)?(r=r.slice(2),i=(t=parseInt(r,16)).toString(16)):(r=r.slice(1),i=(t=parseInt(r,10)).toString(10))),r=r.replace(/^0+/,""),isNaN(t)||i.toLowerCase()!==r?(R(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function k(e,t){"<"===t?(e.state=E.OPEN_WAKA,e.startTagPosition=e.position):f(t)||(R(e,"Non-whitespace before first tag."),e.textNode=t,e.state=E.TEXT)}function P(e,t){var r="";return t1114111||b(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?n.push(s):(e=55296+((s-=65536)>>10),t=s%1024+56320,n.push(e,t)),(i+1===o||n.length>r)&&(a+=m.apply(null,n),n.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:w,configurable:!0,writable:!0}):String.fromCodePoint=w)}(Be);var pr,gr,yr=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)},vr=yr,mr={copyOptions:function(e){var t,r={};for(t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r},ensureFlagExists:function(e,t){e in t&&"boolean"==typeof t[e]||(t[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||"number"!=typeof e.spaces&&"string"!=typeof e.spaces)&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){"alwaysArray"in e&&("boolean"==typeof e.alwaysArray||vr(e.alwaysArray))||(e.alwaysArray=!1)},ensureKeyExists:function(e,t){e+"Key"in t&&"string"==typeof t[e+"Key"]||(t[e+"Key"]=t.compact?"_"+e:e)},checkFnExists:function(e,t){return e+"Fn"in t}},br=Be,wr=mr,Er=yr;function Ar(e){var t=Number(e);if(!isNaN(t))return t;var r=e.toLowerCase();return"true"===r||"false"!==r&&e}function Tr(e,t){var r;if(pr.compact){if(!gr[pr[e+"Key"]]&&(Er(pr.alwaysArray)?-1!==pr.alwaysArray.indexOf(pr[e+"Key"]):pr.alwaysArray)&&(gr[pr[e+"Key"]]=[]),gr[pr[e+"Key"]]&&!Er(gr[pr[e+"Key"]])&&(gr[pr[e+"Key"]]=[gr[pr[e+"Key"]]]),e+"Fn"in pr&&"string"==typeof t&&(t=pr[e+"Fn"](t,gr)),"instruction"===e&&("instructionFn"in pr||"instructionNameFn"in pr))for(r in t)if(t.hasOwnProperty(r))if("instructionFn"in pr)t[r]=pr.instructionFn(t[r],r,gr);else{var n=t[r];delete t[r],t[pr.instructionNameFn(r,n,gr)]=n}Er(gr[pr[e+"Key"]])?gr[pr[e+"Key"]].push(t):gr[pr[e+"Key"]]=t}else{gr[pr.elementsKey]||(gr[pr.elementsKey]=[]);var i={};if(i[pr.typeKey]=e,"instruction"===e){for(r in t)if(t.hasOwnProperty(r))break;i[pr.nameKey]="instructionNameFn"in pr?pr.instructionNameFn(r,t,gr):r,pr.instructionHasAttributes?(i[pr.attributesKey]=t[r][pr.attributesKey],"instructionFn"in pr&&(i[pr.attributesKey]=pr.instructionFn(i[pr.attributesKey],r,gr))):("instructionFn"in pr&&(t[r]=pr.instructionFn(t[r],r,gr)),i[pr.instructionKey]=t[r])}else e+"Fn"in pr&&(t=pr[e+"Fn"](t,gr)),i[pr[e+"Key"]]=t;pr.addParent&&(i[pr.parentKey]=gr),gr[pr.elementsKey].push(i)}}function _r(e){var t;if("attributesFn"in pr&&e&&(e=pr.attributesFn(e,gr)),(pr.trim||"attributeValueFn"in pr||"attributeNameFn"in pr||pr.nativeTypeAttributes)&&e)for(t in e)if(e.hasOwnProperty(t)&&(pr.trim&&(e[t]=e[t].trim()),pr.nativeTypeAttributes&&(e[t]=Ar(e[t])),"attributeValueFn"in pr&&(e[t]=pr.attributeValueFn(e[t],t,gr)),"attributeNameFn"in pr)){var r=e[t];delete e[t],e[pr.attributeNameFn(t,e[t],gr)]=r}return e}function Cr(e){var t={};if(e.body&&("xml"===e.name.toLowerCase()||pr.instructionHasAttributes)){for(var r,n=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;null!==(r=n.exec(e.body));)t[r[1]]=r[2]||r[3]||r[4];t=_r(t)}if("xml"===e.name.toLowerCase()){if(pr.ignoreDeclaration)return;gr[pr.declarationKey]={},Object.keys(t).length&&(gr[pr.declarationKey][pr.attributesKey]=t),pr.addParent&&(gr[pr.declarationKey][pr.parentKey]=gr)}else{if(pr.ignoreInstruction)return;pr.trim&&(e.body=e.body.trim());var i={};pr.instructionHasAttributes&&Object.keys(t).length?(i[e.name]={},i[e.name][pr.attributesKey]=t):i[e.name]=e.body,Tr("instruction",i)}}function Or(e,t){var r;if("object"==typeof e&&(t=e.attributes,e=e.name),t=_r(t),"elementNameFn"in pr&&(e=pr.elementNameFn(e,gr)),pr.compact){var n;if(r={},!pr.ignoreAttributes&&t&&Object.keys(t).length)for(n in r[pr.attributesKey]={},t)t.hasOwnProperty(n)&&(r[pr.attributesKey][n]=t[n]);!(e in gr)&&(Er(pr.alwaysArray)?-1!==pr.alwaysArray.indexOf(e):pr.alwaysArray)&&(gr[e]=[]),gr[e]&&!Er(gr[e])&&(gr[e]=[gr[e]]),Er(gr[e])?gr[e].push(r):gr[e]=r}else gr[pr.elementsKey]||(gr[pr.elementsKey]=[]),(r={})[pr.typeKey]="element",r[pr.nameKey]=e,!pr.ignoreAttributes&&t&&Object.keys(t).length&&(r[pr.attributesKey]=t),pr.alwaysChildren&&(r[pr.elementsKey]=[]),gr[pr.elementsKey].push(r);r[pr.parentKey]=gr,gr=r}function Dr(e){pr.ignoreText||(e.trim()||pr.captureSpacesBetweenElements)&&(pr.trim&&(e=e.trim()),pr.nativeType&&(e=Ar(e)),pr.sanitize&&(e=e.replace(/&/g,"&").replace(//g,">")),Tr("text",e))}function xr(e){pr.ignoreComment||(pr.trim&&(e=e.trim()),Tr("comment",e))}function Rr(e){var t=gr[pr.parentKey];pr.addParent||delete gr[pr.parentKey],gr=t}function Fr(e){pr.ignoreCdata||(pr.trim&&(e=e.trim()),Tr("cdata",e))}function Sr(e){pr.ignoreDoctype||(e=e.replace(/^ /,""),pr.trim&&(e=e.trim()),Tr("doctype",e))}function Nr(e){e.note=e}var Lr=function(e,t){var r=br.parser(!0,{}),n={};if(gr=n,pr=function(e){return pr=wr.copyOptions(e),wr.ensureFlagExists("ignoreDeclaration",pr),wr.ensureFlagExists("ignoreInstruction",pr),wr.ensureFlagExists("ignoreAttributes",pr),wr.ensureFlagExists("ignoreText",pr),wr.ensureFlagExists("ignoreComment",pr),wr.ensureFlagExists("ignoreCdata",pr),wr.ensureFlagExists("ignoreDoctype",pr),wr.ensureFlagExists("compact",pr),wr.ensureFlagExists("alwaysChildren",pr),wr.ensureFlagExists("addParent",pr),wr.ensureFlagExists("trim",pr),wr.ensureFlagExists("nativeType",pr),wr.ensureFlagExists("nativeTypeAttributes",pr),wr.ensureFlagExists("sanitize",pr),wr.ensureFlagExists("instructionHasAttributes",pr),wr.ensureFlagExists("captureSpacesBetweenElements",pr),wr.ensureAlwaysArrayExists(pr),wr.ensureKeyExists("declaration",pr),wr.ensureKeyExists("instruction",pr),wr.ensureKeyExists("attributes",pr),wr.ensureKeyExists("text",pr),wr.ensureKeyExists("comment",pr),wr.ensureKeyExists("cdata",pr),wr.ensureKeyExists("doctype",pr),wr.ensureKeyExists("type",pr),wr.ensureKeyExists("name",pr),wr.ensureKeyExists("elements",pr),wr.ensureKeyExists("parent",pr),wr.checkFnExists("doctype",pr),wr.checkFnExists("instruction",pr),wr.checkFnExists("cdata",pr),wr.checkFnExists("comment",pr),wr.checkFnExists("text",pr),wr.checkFnExists("instructionName",pr),wr.checkFnExists("elementName",pr),wr.checkFnExists("attributeName",pr),wr.checkFnExists("attributeValue",pr),wr.checkFnExists("attributes",pr),pr}(t),r.opt={strictEntities:!0},r.onopentag=Or,r.ontext=Dr,r.oncomment=xr,r.onclosetag=Rr,r.onerror=Nr,r.oncdata=Fr,r.ondoctype=Sr,r.onprocessinginstruction=Cr,r.write(e).close(),n[pr.elementsKey]){var i=n[pr.elementsKey];delete n[pr.elementsKey],n[pr.elementsKey]=i,delete n.text}return n},jr=mr,Ir=Lr;var kr,Pr,Ur=mr,Br=yr;function Mr(e,t,r){return(!r&&e.spaces?"\n":"")+Array(t+1).join(e.spaces)}function Vr(e,t,r){if(t.ignoreAttributes)return"";"attributesFn"in t&&(e=t.attributesFn(e,Pr,kr));var n,i,o,a,s=[];for(n in e)e.hasOwnProperty(n)&&null!==e[n]&&void 0!==e[n]&&(a=t.noQuotesForNativeAttributes&&"string"!=typeof e[n]?"":'"',i=(i=""+e[n]).replace(/"/g,"""),o="attributeNameFn"in t?t.attributeNameFn(n,i,Pr,kr):n,s.push(t.spaces&&t.indentAttributes?Mr(t,r+1,!1):" "),s.push(o+"="+a+("attributeValueFn"in t?t.attributeValueFn(i,n,Pr,kr):i)+a));return e&&Object.keys(e).length&&t.spaces&&t.indentAttributes&&s.push(Mr(t,r,!1)),s.join("")}function Kr(e,t,r){return kr=e,Pr="xml",t.ignoreDeclaration?"":""}function $r(e,t,r){if(t.ignoreInstruction)return"";var n;for(n in e)if(e.hasOwnProperty(n))break;var i="instructionNameFn"in t?t.instructionNameFn(n,e[n],Pr,kr):n;if("object"==typeof e[n])return kr=e,Pr=i,"";var o=e[n]?e[n]:"";return"instructionFn"in t&&(o=t.instructionFn(o,n,Pr,kr)),""}function Yr(e,t){return t.ignoreComment?"":"\x3c!--"+("commentFn"in t?t.commentFn(e,Pr,kr):e)+"--\x3e"}function Hr(e,t){return t.ignoreCdata?"":"","]]]]>"))+"]]>"}function qr(e,t){return t.ignoreDoctype?"":""}function zr(e,t){return t.ignoreText?"":(e=(e=(e=""+e).replace(/&/g,"&")).replace(/&/g,"&").replace(//g,">"),"textFn"in t?t.textFn(e,Pr,kr):e)}function Gr(e,t,r,n){return e.reduce((function(e,i){var o=Mr(t,r,n&&!e);switch(i.type){case"element":return e+o+function(e,t,r){kr=e,Pr=e.name;var n=[],i="elementNameFn"in t?t.elementNameFn(e.name,e):e.name;n.push("<"+i),e[t.attributesKey]&&n.push(Vr(e[t.attributesKey],t,r));var o=e[t.elementsKey]&&e[t.elementsKey].length||e[t.attributesKey]&&"preserve"===e[t.attributesKey]["xml:space"];return o||(o="fullTagEmptyElementFn"in t?t.fullTagEmptyElementFn(e.name,e):t.fullTagEmptyElement),o?(n.push(">"),e[t.elementsKey]&&e[t.elementsKey].length&&(n.push(Gr(e[t.elementsKey],t,r+1)),kr=e,Pr=e.name),n.push(t.spaces&&function(e,t){var r;if(e.elements&&e.elements.length)for(r=0;r")):n.push("/>"),n.join("")}(i,t,r);case"comment":return e+o+Yr(i[t.commentKey],t);case"doctype":return e+o+qr(i[t.doctypeKey],t);case"cdata":return e+(t.indentCdata?o:"")+Hr(i[t.cdataKey],t);case"text":return e+(t.indentText?o:"")+zr(i[t.textKey],t);case"instruction":var a={};return a[i[t.nameKey]]=i[t.attributesKey]?i:i[t.instructionKey],e+(t.indentInstruction?o:"")+$r(a,t,r)}}),"")}function Wr(e,t,r){var n;for(n in e)if(e.hasOwnProperty(n))switch(n){case t.parentKey:case t.attributesKey:break;case t.textKey:if(t.indentText||r)return!0;break;case t.cdataKey:if(t.indentCdata||r)return!0;break;case t.instructionKey:if(t.indentInstruction||r)return!0;break;case t.doctypeKey:case t.commentKey:default:return!0}return!1}function Qr(e,t,r,n,i){kr=e,Pr=t;var o="elementNameFn"in r?r.elementNameFn(t,e):t;if(null==e||""===e)return"fullTagEmptyElementFn"in r&&r.fullTagEmptyElementFn(t,e)||r.fullTagEmptyElement?"<"+o+">":"<"+o+"/>";var a=[];if(t){if(a.push("<"+o),"object"!=typeof e)return a.push(">"+zr(e,r)+""),a.join("");e[r.attributesKey]&&a.push(Vr(e[r.attributesKey],r,n));var s=Wr(e,r,!0)||e[r.attributesKey]&&"preserve"===e[r.attributesKey]["xml:space"];if(s||(s="fullTagEmptyElementFn"in r?r.fullTagEmptyElementFn(t,e):r.fullTagEmptyElement),!s)return a.push("/>"),a.join("");a.push(">")}return a.push(Xr(e,r,n+1,!1)),kr=e,Pr=t,t&&a.push((i?Mr(r,n,!1):"")+""),a.join("")}function Xr(e,t,r,n){var i,o,a,s=[];for(o in e)if(e.hasOwnProperty(o))for(a=Br(e[o])?e[o]:[e[o]],i=0;i{const t=Number(e);if(!Number.isNaN(t))return t;const r=e.toLowerCase();return"true"===r||"false"!==r&&e},on=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),n=t.trim();if(Math.abs(r.length-n.length)>1)return!1;const i="/"===r.slice(-1)?r.slice(0,-1):r,o="/"===n.slice(-1)?n.slice(0,-1):n;return e.includes(o)||t.includes(i)},an=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),n=t.trim(),i="/"===r.slice(-1)?r.slice(0,-1):r,o="/"===n.slice(-1)?n.slice(0,-1):n;return e.includes(o)||t.includes(i)},sn=e=>e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[M[t]]:t})),{}),un=e=>Object.entries(e).reduce(((e,[t,r])=>r?Object.assign(Object.assign({},e),{[t]:r}):e),{});var cn=Object.freeze({__proto__:null,cleanupFalsy:un,getDAVAttribute:sn,urlContains:an,urlEquals:on});const ln=B("tsdav:request"),dn=e=>t(void 0,void 0,void 0,(function*(){var t;const{url:r,init:n,convertIncoming:i=!0,parseOutgoing:o=!0}=e,{headers:s={},body:u,namespace:c,method:l,attributes:d}=n,h=i?rn.js2xml(Object.assign(Object.assign({_declaration:{_attributes:{version:"1.0",encoding:"utf-8"}}},u),{_attributes:d}),{compact:!0,spaces:2,elementNameFn:e=>c&&!/^.+:.+/.test(e)?`${c}:${e}`:e}):u,f=yield a.fetch(r,{headers:Object.assign({"Content-Type":"text/xml;charset=UTF-8"},un(s)),body:h,method:l}),p=yield f.text();if(!f.ok||!(null===(t=f.headers.get("content-type"))||void 0===t?void 0:t.includes("xml"))||!o)return[{href:f.url,ok:f.ok,status:f.status,statusText:f.statusText,raw:p}];const g=rn.xml2js(p,{compact:!0,trim:!0,textFn:(e,t)=>{try{const r=t._parent,n=Object.keys(r),i=n[n.length-1],o=r[i];if(o.length>0){o[o.length-1]=nn(e)}else r[i]=nn(e)}catch(e){ln(e.stack)}},elementNameFn:e=>e.replace(/^.+:/,"").replace(/([-_]\w)/g,(e=>e[1].toUpperCase())),attributesFn:e=>{const t=Object.assign({},e);return delete t.xmlns,t},ignoreDeclaration:!0});return(Array.isArray(g.multistatus.response)?g.multistatus.response:[g.multistatus.response]).map((e=>{var t,r;if(!e)return{status:f.status,statusText:f.statusText,ok:f.ok};const n=/^\S+\s(?\d+)\s(?.+)$/.exec(e.status);return{raw:g,href:e.href,status:(null==n?void 0:n.groups)?Number.parseInt(null==n?void 0:n.groups.status,10):f.status,statusText:null!==(r=null===(t=null==n?void 0:n.groups)||void 0===t?void 0:t.statusText)&&void 0!==r?r:f.statusText,ok:!e.error,error:e.error,responsedescription:e.responsedescription,props:(Array.isArray(e.propstat)?e.propstat:[e.propstat]).reduce(((e,t)=>Object.assign(Object.assign({},e),null==t?void 0:t.prop)),{})}}))})),hn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:n,headers:i}=e;return dn({url:t,init:{method:"PROPFIND",headers:un(Object.assign({depth:n},i)),namespace:V.DAV,body:{propfind:{_attributes:sn([U.CALDAV,U.CALDAV_APPLE,U.CALENDAR_SERVER,U.CARDDAV,U.DAV]),prop:r}}}})})),fn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,data:r,headers:n}=e;return a.fetch(t,{method:"PUT",body:r,headers:n})})),pn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,data:r,etag:n,headers:i}=e;return a.fetch(t,{method:"PUT",body:r,headers:un(Object.assign({"If-Match":n},i))})})),gn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,headers:r,etag:n}=e;return a.fetch(t,{method:"DELETE",headers:un(Object.assign({"If-Match":n},r))})}));var yn=Object.freeze({__proto__:null,createObject:fn,davRequest:dn,deleteObject:gn,propfind:hn,updateObject:pn});function vn(e,t){const r=e=>t.every((t=>e[t]));return Array.isArray(e)?e.every((e=>r(e))):r(e)}const mn=(e,t)=>t.reduce(((t,r)=>e[r]?t:`${t.length?`${t},`:""}${r.toString()}`),""),bn=B("tsdav:collection"),wn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,body:r,depth:n,defaultNamespace:i=V.DAV,headers:o}=e,a=yield dn({url:t,init:{method:"REPORT",headers:un(Object.assign({depth:n},o)),namespace:i,body:r}});return 1!==a.length||a[0].raw?a:[]})),En=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:n,headers:i}=e;return dn({url:t,init:{method:"MKCOL",headers:un(Object.assign({depth:n},i)),namespace:V.DAV,body:r?{mkcol:{set:{prop:r}}}:void 0}})})),An=e=>t(void 0,void 0,void 0,(function*(){var t,r,n,i,o;const{collection:a,headers:s}=e;return null!==(o=null===(i=null===(n=null===(r=null===(t=(yield hn({url:a.url,props:{[`${V.DAV}:supported-report-set`]:{}},depth:"0",headers:s}))[0])||void 0===t?void 0:t.props)||void 0===r?void 0:r.supportedReportSet)||void 0===n?void 0:n.supportedReport)||void 0===i?void 0:i.map((e=>Object.keys(e.report)[0])))&&void 0!==o?o:[]})),Tn=e=>t(void 0,void 0,void 0,(function*(){var t,r,n;const{collection:i,headers:o}=e,a=(yield hn({url:i.url,props:{[`${V.CALENDAR_SERVER}:getctag`]:{}},depth:"0",headers:o})).filter((e=>an(i.url,e.href)))[0];if(!a)throw new Error("Collection does not exist on server");return{isDirty:i.ctag!==(null===(t=a.props)||void 0===t?void 0:t.getctag),newCtag:null===(n=null===(r=a.props)||void 0===r?void 0:r.getctag)||void 0===n?void 0:n.toString()}})),_n=e=>{const{url:t,props:r,headers:n,syncLevel:i,syncToken:o}=e;return dn({url:t,init:{method:"REPORT",namespace:V.DAV,headers:Object.assign({},n),body:{"sync-collection":{_attributes:sn([U.CALDAV,U.CARDDAV,U.DAV]),"sync-level":i,"sync-token":o,[`${V.DAV}:prop`]:r}}}})},Cn=e=>t(void 0,void 0,void 0,(function*(){var t,r,n,i,o,a,s,u,c,l,d;const{collection:h,method:f,headers:p,account:g,detailedResult:y}=e,v=["accountType","homeUrl"];if(!g||!vn(g,v)){if(!g)throw new Error("no account for smartCollectionSync");throw new Error(`account must have ${mn(g,v)} before smartCollectionSync`)}const m=null!=f?f:(null===(t=h.reports)||void 0===t?void 0:t.includes("syncCollection"))?"webdav":"basic";if(bn(`smart collection sync with type ${g.accountType} and method ${m}`),"webdav"===m){const e=yield _n({url:h.url,props:{[`${V.DAV}:getetag`]:{},[`${"caldav"===g.accountType?V.CALDAV:V.CARDDAV}:${"caldav"===g.accountType?"calendar-data":"address-data"}`]:{},[`${V.DAV}:displayname`]:{}},syncLevel:1,syncToken:h.syncToken,headers:p}),t=e.filter((e=>{var t;const r="caldav"===g.accountType?".ics":".vcf";return(null===(t=e.href)||void 0===t?void 0:t.slice(-4))===r})),c=t.filter((e=>404!==e.status)).map((e=>e.href)),l=t.filter((e=>404===e.status)).map((e=>e.href)),d=(c.length&&null!==(n=yield null===(r=null==h?void 0:h.objectMultiGet)||void 0===r?void 0:r.call(h,{url:h.url,props:{[`${V.DAV}:getetag`]:{},[`${"caldav"===g.accountType?V.CALDAV:V.CARDDAV}:${"caldav"===g.accountType?"calendar-data":"address-data"}`]:{}},objectUrls:c,depth:"1",headers:p}))&&void 0!==n?n:[]).map((e=>{var t,r,n,i,o,a,s,u,c,l;return{url:null!==(t=e.href)&&void 0!==t?t:"",etag:null===(r=e.props)||void 0===r?void 0:r.getetag,data:"caldav"===(null==g?void 0:g.accountType)?null!==(o=null===(i=null===(n=e.props)||void 0===n?void 0:n.calendarData)||void 0===i?void 0:i._cdata)&&void 0!==o?o:null===(a=e.props)||void 0===a?void 0:a.calendarData:null!==(c=null===(u=null===(s=e.props)||void 0===s?void 0:s.addressData)||void 0===u?void 0:u._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.addressData}})),f=null!==(i=h.objects)&&void 0!==i?i:[],v=d.filter((e=>f.every((t=>!an(t.url,e.url))))),m=f.reduce(((e,t)=>{const r=d.find((e=>an(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),b=l.map((e=>({url:e,etag:""}))),w=f.filter((e=>d.some((t=>an(e.url,t.url)&&t.etag===e.etag))));return Object.assign(Object.assign({},h),{objects:y?{created:v,updated:m,deleted:b}:[...w,...v,...m],syncToken:null!==(u=null===(s=null===(a=null===(o=e[0])||void 0===o?void 0:o.raw)||void 0===a?void 0:a.multistatus)||void 0===s?void 0:s.syncToken)&&void 0!==u?u:h.syncToken})}if("basic"===m){const{isDirty:e,newCtag:t}=yield Tn({collection:h,headers:p}),r=null!==(c=h.objects)&&void 0!==c?c:[],n=null!==(d=yield null===(l=h.fetchObjects)||void 0===l?void 0:l.call(h,{collection:h,headers:p}))&&void 0!==d?d:[],i=n.filter((e=>r.every((t=>!an(t.url,e.url))))),o=r.reduce(((e,t)=>{const r=n.find((e=>an(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),a=r.filter((e=>n.every((t=>!an(t.url,e.url))))),s=r.filter((e=>n.some((t=>an(e.url,t.url)&&t.etag===e.etag))));if(e)return Object.assign(Object.assign({},h),{objects:y?{created:i,updated:o,deleted:a}:[...s,...i,...o],ctag:t})}return y?Object.assign(Object.assign({},h),{objects:{created:[],updated:[],deleted:[]}}):h}));var On=Object.freeze({__proto__:null,collectionQuery:wn,isCollectionDirty:Tn,makeCollection:En,smartCollectionSync:Cn,supportedReportSet:An,syncCollection:_n});const Dn=B("tsdav:addressBook"),xn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:n,depth:i,headers:o}=e;return wn({url:t,body:{"addressbook-query":{_attributes:sn([U.CARDDAV,U.DAV]),[`${V.DAV}:prop`]:r,filter:null!=n?n:{"prop-filter":{_attributes:{name:"FN"}}}}},defaultNamespace:V.CARDDAV,depth:i,headers:o})})),Rn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:n,depth:i,headers:o}=e;return wn({url:t,body:{"addressbook-multiget":{_attributes:sn([U.DAV,U.CARDDAV]),[`${V.DAV}:prop`]:r,[`${V.DAV}:href`]:n}},defaultNamespace:V.CARDDAV,depth:i,headers:o})})),Fn=e=>t(void 0,void 0,void 0,(function*(){const{account:r,headers:n,props:i}=null!=e?e:{},o=["homeUrl","rootUrl"];if(!r||!vn(r,o)){if(!r)throw new Error("no account for fetchAddressBooks");throw new Error(`account must have ${mn(r,o)} before fetchAddressBooks`)}const a=yield hn({url:r.homeUrl,props:null!=i?i:{[`${V.DAV}:displayname`]:{},[`${V.CALENDAR_SERVER}:getctag`]:{},[`${V.DAV}:resourcetype`]:{},[`${V.DAV}:sync-token`]:{}},depth:"1",headers:n});return Promise.all(a.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("addressbook")})).map((e=>{var t,n,i,o,a,s,u,c,l;const d=null!==(i=null===(n=null===(t=e.props)||void 0===t?void 0:t.displayname)||void 0===n?void 0:n._cdata)&&void 0!==i?i:null===(o=e.props)||void 0===o?void 0:o.displayname;return Dn(`Found address book named ${"string"==typeof d?d:""},\n props: ${JSON.stringify(e.props)}`),{url:new URL(null!==(a=e.href)&&void 0!==a?a:"",null!==(s=r.rootUrl)&&void 0!==s?s:"").href,ctag:null===(u=e.props)||void 0===u?void 0:u.getctag,displayName:"string"==typeof d?d:"",resourcetype:Object.keys(null===(c=e.props)||void 0===c?void 0:c.resourcetype),syncToken:null===(l=e.props)||void 0===l?void 0:l.syncToken}})).map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield An({collection:e,headers:n})})})))))})),Sn=e=>t(void 0,void 0,void 0,(function*(){const{addressBook:t,headers:r,objectUrls:n,urlFilter:i=(e=>e),useMultiGet:o=!0}=e;Dn(`Fetching vcards from ${null==t?void 0:t.url}`);const a=["url"];if(!t||!vn(t,a)){if(!t)throw new Error("cannot fetchVCards for undefined addressBook");throw new Error(`addressBook must have ${mn(t,a)} before fetchVCards`)}const s=(null!=n?n:(yield xn({url:t.url,props:{[`${V.DAV}:getetag`]:{}},depth:"1",headers:r})).map((e=>{var t;return e.ok&&null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(i).map((e=>new URL(e).pathname));let u=[];return s.length>0&&(u=o?yield Rn({url:t.url,props:{[`${V.DAV}:getetag`]:{},[`${V.CARDDAV}:address-data`]:{}},objectUrls:s,depth:"1",headers:r}):yield xn({url:t.url,props:{[`${V.DAV}:getetag`]:{},[`${V.CARDDAV}:address-data`]:{}},depth:"1",headers:r})),u.map((e=>{var r,n,i,o,a,s;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:null===(n=e.props)||void 0===n?void 0:n.getetag,data:null!==(a=null===(o=null===(i=e.props)||void 0===i?void 0:i.addressData)||void 0===o?void 0:o._cdata)&&void 0!==a?a:null===(s=e.props)||void 0===s?void 0:s.addressData}}))})),Nn=e=>t(void 0,void 0,void 0,(function*(){const{addressBook:t,vCardString:r,filename:n,headers:i}=e;return fn({url:new URL(n,t.url).href,data:r,headers:Object.assign({"content-type":"text/vcard; charset=utf-8","If-None-Match":"*"},i)})})),Ln=e=>t(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return pn({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/vcard; charset=utf-8"},r)})})),jn=e=>t(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return gn({url:t.url,etag:t.etag,headers:r})}));var In=Object.freeze({__proto__:null,addressBookMultiGet:Rn,addressBookQuery:xn,createVCard:Nn,deleteVCard:jn,fetchAddressBooks:Fn,fetchVCards:Sn,updateVCard:Ln});const kn=B("tsdav:calendar"),Pn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:n,timezone:i,depth:o,headers:a}=e;return wn({url:t,body:{"calendar-query":un({_attributes:sn([U.CALDAV,U.CALENDAR_SERVER,U.CALDAV_APPLE,U.DAV]),[`${V.DAV}:prop`]:r,filter:n,timezone:i})},defaultNamespace:V.CALDAV,depth:o,headers:a})})),Un=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:n,filters:i,timezone:o,depth:a,headers:s}=e;return wn({url:t,body:{"calendar-multiget":{_attributes:sn([U.DAV,U.CALDAV]),[`${V.DAV}:prop`]:r,[`${V.DAV}:href`]:n,filter:i,timezone:o}},defaultNamespace:V.CALDAV,depth:a,headers:s})})),Bn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:n,headers:i}=e;return dn({url:t,init:{method:"MKCALENDAR",headers:un(Object.assign({depth:n},i)),namespace:V.DAV,body:{[`${V.CALDAV}:mkcalendar`]:{_attributes:sn([U.DAV,U.CALDAV,U.CALDAV_APPLE]),set:{prop:r}}}}})})),Mn=e=>t(void 0,void 0,void 0,(function*(){const{headers:r,account:n,props:i}=null!=e?e:{},o=["homeUrl","rootUrl"];if(!n||!vn(n,o)){if(!n)throw new Error("no account for fetchCalendars");throw new Error(`account must have ${mn(n,o)} before fetchCalendars`)}const a=yield hn({url:n.homeUrl,props:null!=i?i:{[`${V.CALDAV}:calendar-description`]:{},[`${V.CALDAV}:calendar-timezone`]:{},[`${V.DAV}:displayname`]:{},[`${V.CALDAV_APPLE}:calendar-color`]:{},[`${V.CALENDAR_SERVER}:getctag`]:{},[`${V.DAV}:resourcetype`]:{},[`${V.CALDAV}:supported-calendar-component-set`]:{},[`${V.DAV}:sync-token`]:{}},depth:"1",headers:r});return Promise.all(a.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("calendar")})).filter((e=>{var t,r,n;return(Array.isArray(null===(t=e.props)||void 0===t?void 0:t.supportedCalendarComponentSet.comp)?null===(r=e.props)||void 0===r?void 0:r.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(n=e.props)||void 0===n?void 0:n.supportedCalendarComponentSet.comp._attributes.name]||[]).some((e=>Object.values(K).includes(e)))})).map((e=>{var t,r,i,o,a,s,u,c,l,d,h,f,p,g;const y=null===(t=e.props)||void 0===t?void 0:t.calendarDescription,v=null===(r=e.props)||void 0===r?void 0:r.calendarTimezone;return{description:"string"==typeof y?y:"",timezone:"string"==typeof v?v:"",url:new URL(null!==(i=e.href)&&void 0!==i?i:"",null!==(o=n.rootUrl)&&void 0!==o?o:"").href,ctag:null===(a=e.props)||void 0===a?void 0:a.getctag,calendarColor:null===(s=e.props)||void 0===s?void 0:s.calendarColor,displayName:null!==(c=null===(u=e.props)||void 0===u?void 0:u.displayname._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.displayname,components:Array.isArray(null===(d=e.props)||void 0===d?void 0:d.supportedCalendarComponentSet.comp)?null===(h=e.props)||void 0===h?void 0:h.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(f=e.props)||void 0===f?void 0:f.supportedCalendarComponentSet.comp._attributes.name],resourcetype:Object.keys(null===(p=e.props)||void 0===p?void 0:p.resourcetype),syncToken:null===(g=e.props)||void 0===g?void 0:g.syncToken}})).map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield An({collection:e,headers:r})})})))))})),Vn=e=>t(void 0,void 0,void 0,(function*(){const{calendar:t,objectUrls:r,filters:n,timeRange:i,headers:o,expand:a,urlFilter:s=(e=>Boolean(null==e?void 0:e.includes(".ics"))),useMultiGet:u=!0}=e;if(i){const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(i.start)&&e.test(i.end)||t.test(i.start)&&t.test(i.end)))throw new Error("invalid timeRange format, not in ISO8601")}kn(`Fetching calendar objects from ${null==t?void 0:t.url}`);const c=["url"];if(!t||!vn(t,c)){if(!t)throw new Error("cannot fetchCalendarObjects for undefined calendar");throw new Error(`calendar must have ${mn(t,c)} before fetchCalendarObjects`)}const l=null!=n?n:[{"comp-filter":{_attributes:{name:"VCALENDAR"},"comp-filter":Object.assign({_attributes:{name:"VEVENT"}},i?{"time-range":{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})}}],d=(null!=r?r:(yield Pn({url:t.url,props:{[`${V.DAV}:getetag`]:Object.assign({},a&&i?{[`${V.CALDAV}:expand`]:{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:l,depth:"1",headers:o})).map((e=>{var t;return null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(s).map((e=>new URL(e).pathname));let h=[];return d.length>0&&(h=!u||a?yield Pn({url:t.url,props:{[`${V.DAV}:getetag`]:{},[`${V.CALDAV}:calendar-data`]:Object.assign({},a&&i?{[`${V.CALDAV}:expand`]:{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:l,depth:"1",headers:o}):yield Un({url:t.url,props:{[`${V.DAV}:getetag`]:{},[`${V.CALDAV}:calendar-data`]:Object.assign({},a&&i?{[`${V.CALDAV}:expand`]:{_attributes:{start:`${new Date(i.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(i.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},objectUrls:d,depth:"1",headers:o})),h.map((e=>{var r,n,i,o,a,s;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:`${null===(n=e.props)||void 0===n?void 0:n.getetag}`,data:null!==(a=null===(o=null===(i=e.props)||void 0===i?void 0:i.calendarData)||void 0===o?void 0:o._cdata)&&void 0!==a?a:null===(s=e.props)||void 0===s?void 0:s.calendarData}}))})),Kn=e=>t(void 0,void 0,void 0,(function*(){const{calendar:t,iCalString:r,filename:n,headers:i}=e;return fn({url:new URL(n,t.url).href,data:r,headers:Object.assign({"content-type":"text/calendar; charset=utf-8","If-None-Match":"*"},i)})})),$n=e=>t(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return pn({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/calendar; charset=utf-8"},r)})})),Yn=e=>t(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return gn({url:t.url,etag:t.etag,headers:r})})),Hn=e=>t(void 0,void 0,void 0,(function*(){var r;const{oldCalendars:n,account:i,detailedResult:o,headers:a}=e;if(!i)throw new Error("Must have account before syncCalendars");const s=null!==(r=null!=n?n:i.calendars)&&void 0!==r?r:[],u=yield Mn({account:i,headers:a}),c=u.filter((e=>s.every((t=>!an(t.url,e.url)))));kn(`new calendars: ${c.map((e=>e.displayName))}`);const l=s.reduce(((e,t)=>{const r=u.find((e=>an(e.url,t.url)));return r&&(r.syncToken&&r.syncToken!==t.syncToken||r.ctag&&r.ctag!==t.ctag)?[...e,r]:e}),[]);kn(`updated calendars: ${l.map((e=>e.displayName))}`);const d=yield Promise.all(l.map((e=>t(void 0,void 0,void 0,(function*(){return yield Cn({collection:Object.assign(Object.assign({},e),{objectMultiGet:Un}),method:"webdav",headers:a,account:i})}))))),h=s.filter((e=>u.every((t=>!an(t.url,e.url)))));kn(`deleted calendars: ${h.map((e=>e.displayName))}`);const f=s.filter((e=>u.some((t=>an(t.url,e.url)&&(t.syncToken&&t.syncToken!==e.syncToken||t.ctag&&t.ctag!==e.ctag)))));return o?{created:c,updated:l,deleted:h}:[...f,...c,...d]})),qn=e=>t(void 0,void 0,void 0,(function*(){const{url:t,timeRange:r,depth:n,headers:i}=e;if(!r)throw new Error("timeRange is required");{const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(r.start)&&e.test(r.end)||t.test(r.start)&&t.test(r.end)))throw new Error("invalid timeRange format, not in ISO8601")}return(yield wn({url:t,body:{"free-busy-query":un({_attributes:sn([U.CALDAV]),[`${V.CALDAV}:time-range`]:{_attributes:{start:`${new Date(r.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(r.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}})},defaultNamespace:V.CALDAV,depth:n,headers:i}))[0]}));var zn=Object.freeze({__proto__:null,calendarMultiGet:Un,calendarQuery:Pn,createCalendarObject:Kn,deleteCalendarObject:Yn,fetchCalendarObjects:Vn,fetchCalendars:Mn,freeBusyQuery:qn,makeCalendar:Bn,syncCalendars:Hn,updateCalendarObject:$n});const Gn=B("tsdav:account"),Wn=e=>t(void 0,void 0,void 0,(function*(){var t,r;Gn("Service discovery...");const{account:n,headers:i}=e,o=new URL(n.serverUrl),s=new URL(`/.well-known/${n.accountType}`,o);s.protocol=null!==(t=o.protocol)&&void 0!==t?t:"http";try{const e=yield a.fetch(s.href,{headers:i,method:"PROPFIND",redirect:"manual"});if(e.status>=300&&e.status<400){const t=e.headers.get("Location");if("string"==typeof t&&t.length){Gn(`Service discovery redirected to ${t}`);const e=new URL(t,o);return e.hostname===s.hostname&&s.port&&!e.port&&(e.port=s.port),e.protocol=null!==(r=o.protocol)&&void 0!==r?r:"http",e.href}}}catch(e){Gn(`Service discovery failed: ${e.stack}`)}return o.href})),Qn=e=>t(void 0,void 0,void 0,(function*(){var t,r,n,i,o;const{account:a,headers:s}=e,u=["rootUrl"];if(!vn(a,u))throw new Error(`account must have ${mn(a,u)} before fetchPrincipalUrl`);Gn(`Fetching principal url from path ${a.rootUrl}`);const[c]=yield hn({url:a.rootUrl,props:{[`${V.DAV}:current-user-principal`]:{}},depth:"0",headers:s});if(!c.ok&&(Gn(`Fetch principal url failed: ${c.statusText}`),401===c.status))throw new Error("Invalid credentials");return Gn(`Fetched principal url ${null===(r=null===(t=c.props)||void 0===t?void 0:t.currentUserPrincipal)||void 0===r?void 0:r.href}`),new URL(null!==(o=null===(i=null===(n=c.props)||void 0===n?void 0:n.currentUserPrincipal)||void 0===i?void 0:i.href)&&void 0!==o?o:"",a.rootUrl).href})),Xn=e=>t(void 0,void 0,void 0,(function*(){var t,r;const{account:n,headers:i}=e,o=["principalUrl","rootUrl"];if(!vn(n,o))throw new Error(`account must have ${mn(n,o)} before fetchHomeUrl`);Gn(`Fetch home url from ${n.principalUrl}`);const a=(yield hn({url:n.principalUrl,props:"caldav"===n.accountType?{[`${V.CALDAV}:calendar-home-set`]:{}}:{[`${V.CARDDAV}:addressbook-home-set`]:{}},depth:"0",headers:i})).find((e=>an(n.principalUrl,e.href)));if(!a||!a.ok)throw new Error("cannot find homeUrl");const s=new URL("caldav"===n.accountType?null===(t=null==a?void 0:a.props)||void 0===t?void 0:t.calendarHomeSet.href:null===(r=null==a?void 0:a.props)||void 0===r?void 0:r.addressbookHomeSet.href,n.rootUrl).href;return Gn(`Fetched home url ${s}`),s})),Zn=e=>t(void 0,void 0,void 0,(function*(){const{account:r,headers:n,loadCollections:i=!1,loadObjects:o=!1}=e,a=Object.assign({},r);return a.rootUrl=yield Wn({account:r,headers:n}),a.principalUrl=yield Qn({account:a,headers:n}),a.homeUrl=yield Xn({account:a,headers:n}),(i||o)&&("caldav"===r.accountType?a.calendars=yield Mn({headers:n,account:a}):"carddav"===r.accountType&&(a.addressBooks=yield Fn({headers:n,account:a}))),o&&("caldav"===r.accountType&&a.calendars?a.calendars=yield Promise.all(a.calendars.map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield Vn({calendar:e,headers:n})})}))))):"carddav"===r.accountType&&a.addressBooks&&(a.addressBooks=yield Promise.all(a.addressBooks.map((e=>t(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield Sn({addressBook:e,headers:n})})}))))))),a}));var Jn,ei,ti=Object.freeze({__proto__:null,createAccount:Zn,fetchHomeUrl:Xn,fetchPrincipalUrl:Qn,serviceDiscovery:Wn}),ri={exports:{}};Jn=ri,ei=ri.exports,function(e){var t=ei,n=Jn&&Jn.exports==t&&Jn,i="object"==typeof r&&r;i.global!==i&&i.window!==i||(e=i);var o=function(e){this.message=e};(o.prototype=new Error).name="InvalidCharacterError";var a=function(e){throw new o(e)},s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=/[\t\n\f\r ]/g,c={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&a("The string to be encoded contains characters outside of the Latin1 range.");for(var t,r,n,i,o=e.length%3,u="",c=-1,l=e.length-o;++c>18&63)+s.charAt(i>>12&63)+s.charAt(i>>6&63)+s.charAt(63&i);return 2==o?(t=e.charCodeAt(c)<<8,r=e.charCodeAt(++c),u+=s.charAt((i=t+r)>>10)+s.charAt(i>>4&63)+s.charAt(i<<2&63)+"="):1==o&&(i=e.charCodeAt(c),u+=s.charAt(i>>2)+s.charAt(i<<4&63)+"=="),u},decode:function(e){var t=(e=String(e).replace(u,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&a("Invalid character: the string to be decoded is not correctly encoded.");for(var r,n,i=0,o="",c=-1;++c>(-2*i&6)));return o},version:"1.0.0"};if(t&&!t.nodeType)if(n)n.exports=c;else for(var l in c)c.hasOwnProperty(l)&&(t[l]=c[l]);else e.base64=c}(r);var ni=ri.exports;const ii=B("tsdav:authHelper"),oi=(e,t)=>(...r)=>e(Object.assign(Object.assign({},t),r[0])),ai=e=>(ii(`Basic auth token generated: ${ni.encode(`${e.username}:${e.password}`)}`),{authorization:`Basic ${ni.encode(`${e.username}:${e.password}`)}`}),si=e=>t(void 0,void 0,void 0,(function*(){const t=["authorizationCode","redirectUrl","clientId","clientSecret","tokenUrl"];if(!vn(e,t))throw new Error(`Oauth credentials missing: ${mn(e,t)}`);const r=new URLSearchParams({grant_type:"authorization_code",code:e.authorizationCode,redirect_uri:e.redirectUrl,client_id:e.clientId,client_secret:e.clientSecret});ii(e.tokenUrl),ii(r.toString());const n=yield a.fetch(e.tokenUrl,{method:"POST",body:r.toString(),headers:{"content-length":`${r.toString().length}`,"content-type":"application/x-www-form-urlencoded"}});if(n.ok){return yield n.json()}return ii(`Fetch Oauth tokens failed: ${yield n.text()}`),{}})),ui=e=>t(void 0,void 0,void 0,(function*(){const t=["refreshToken","clientId","clientSecret","tokenUrl"];if(!vn(e,t))throw new Error(`Oauth credentials missing: ${mn(e,t)}`);const r=new URLSearchParams({client_id:e.clientId,client_secret:e.clientSecret,refresh_token:e.refreshToken,grant_type:"refresh_token"}),n=yield a.fetch(e.tokenUrl,{method:"POST",body:r.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(n.ok){return yield n.json()}return ii(`Refresh access token failed: ${yield n.text()}`),{}})),ci=e=>t(void 0,void 0,void 0,(function*(){var t;ii("Fetching oauth headers");let r={};return e.refreshToken?(e.refreshToken&&!e.accessToken||Date.now()>(null!==(t=e.expiration)&&void 0!==t?t:0))&&(r=yield ui(e)):r=yield si(e),ii(`Oauth tokens fetched: ${r.access_token}`),{tokens:r,headers:{authorization:`Bearer ${r.access_token}`}}}));var li=Object.freeze({__proto__:null,defaultParam:oi,fetchOauthTokens:si,getBasicAuthHeaders:ai,getOauthHeaders:ci,refreshAccessToken:ui});const di=r=>t(void 0,void 0,void 0,(function*(){const{serverUrl:n,credentials:i,authMethod:o,defaultAccountType:a}=r,s="Basic"===o?ai(i):"Oauth"===o?(yield ci(i)).headers:{},u=a?yield Zn({account:{serverUrl:n,credentials:i,accountType:a},headers:s}):void 0,c=oi(fn,{url:n,headers:s}),l=oi(pn,{headers:s,url:n}),d=oi(gn,{headers:s,url:n}),h=oi(hn,{headers:s}),f=oi(wn,{headers:s}),p=oi(En,{headers:s}),g=oi(_n,{headers:s}),y=oi(An,{headers:s}),v=oi(Tn,{headers:s}),m=oi(Cn,{headers:s,account:u}),b=oi(Pn,{headers:s}),w=oi(Un,{headers:s}),E=oi(Bn,{headers:s}),A=oi(Mn,{headers:s,account:u}),T=oi(Vn,{headers:s}),_=oi(Kn,{headers:s}),C=oi($n,{headers:s}),O=oi(Yn,{headers:s}),D=oi(Hn,{account:u,headers:s}),x=oi(xn,{headers:s}),R=oi(Rn,{headers:s});return{davRequest:r=>t(void 0,void 0,void 0,(function*(){const{init:t}=r,n=e(r,["init"]),{headers:i}=t,o=e(t,["headers"]);return dn(Object.assign(Object.assign({},n),{init:Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},s),i)})}))})),propfind:h,createAccount:e=>t(void 0,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:o,loadObjects:a}=e;return Zn({account:Object.assign({serverUrl:n,credentials:i},t),headers:Object.assign(Object.assign({},s),r),loadCollections:o,loadObjects:a})})),createObject:c,updateObject:l,deleteObject:d,calendarQuery:b,addressBookQuery:x,collectionQuery:f,makeCollection:p,calendarMultiGet:w,makeCalendar:E,syncCollection:g,supportedReportSet:y,isCollectionDirty:v,smartCollectionSync:m,fetchCalendars:A,fetchCalendarObjects:T,createCalendarObject:_,updateCalendarObject:C,deleteCalendarObject:O,syncCalendars:D,fetchAddressBooks:oi(Fn,{account:u,headers:s}),addressBookMultiGet:R,fetchVCards:oi(Sn,{headers:s}),createVCard:oi(Nn,{headers:s}),updateVCard:oi(Ln,{headers:s}),deleteVCard:oi(jn,{headers:s})}}));class hi{constructor(e){var t,r;this.serverUrl=e.serverUrl,this.credentials=e.credentials,this.authMethod=null!==(t=e.authMethod)&&void 0!==t?t:"Basic",this.accountType=null!==(r=e.defaultAccountType)&&void 0!==r?r:"caldav"}login(){return t(this,void 0,void 0,(function*(){this.authHeaders="Basic"===this.authMethod?ai(this.credentials):"Oauth"===this.authMethod?(yield ci(this.credentials)).headers:{},this.account=this.accountType?yield Zn({account:{serverUrl:this.serverUrl,credentials:this.credentials,accountType:this.accountType},headers:this.authHeaders}):void 0}))}davRequest(r){return t(this,void 0,void 0,(function*(){const{init:t}=r,n=e(r,["init"]),{headers:i}=t,o=e(t,["headers"]);return dn(Object.assign(Object.assign({},n),{init:Object.assign(Object.assign({},o),{headers:Object.assign(Object.assign({},this.authHeaders),i)})}))}))}createObject(...e){return t(this,void 0,void 0,(function*(){return oi(fn,{url:this.serverUrl,headers:this.authHeaders})(e[0])}))}updateObject(...e){return t(this,void 0,void 0,(function*(){return oi(pn,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}deleteObject(...e){return t(this,void 0,void 0,(function*(){return oi(gn,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}propfind(...e){return t(this,void 0,void 0,(function*(){return oi(hn,{headers:this.authHeaders})(e[0])}))}createAccount(e){return t(this,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:n,loadObjects:i}=e;return Zn({account:Object.assign({serverUrl:this.serverUrl,credentials:this.credentials},t),headers:Object.assign(Object.assign({},this.authHeaders),r),loadCollections:n,loadObjects:i})}))}collectionQuery(...e){return t(this,void 0,void 0,(function*(){return oi(wn,{headers:this.authHeaders})(e[0])}))}makeCollection(...e){return t(this,void 0,void 0,(function*(){return oi(En,{headers:this.authHeaders})(e[0])}))}syncCollection(...e){return t(this,void 0,void 0,(function*(){return oi(_n,{headers:this.authHeaders})(e[0])}))}supportedReportSet(...e){return t(this,void 0,void 0,(function*(){return oi(An,{headers:this.authHeaders})(e[0])}))}isCollectionDirty(...e){return t(this,void 0,void 0,(function*(){return oi(Tn,{headers:this.authHeaders})(e[0])}))}smartCollectionSync(...e){return t(this,void 0,void 0,(function*(){return oi(Cn,{headers:this.authHeaders,account:this.account})(e[0])}))}calendarQuery(...e){return t(this,void 0,void 0,(function*(){return oi(Pn,{headers:this.authHeaders})(e[0])}))}makeCalendar(...e){return t(this,void 0,void 0,(function*(){return oi(Bn,{headers:this.authHeaders})(e[0])}))}calendarMultiGet(...e){return t(this,void 0,void 0,(function*(){return oi(Un,{headers:this.authHeaders})(e[0])}))}fetchCalendars(...e){return t(this,void 0,void 0,(function*(){return oi(Mn,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchCalendarObjects(...e){return t(this,void 0,void 0,(function*(){return oi(Vn,{headers:this.authHeaders})(e[0])}))}createCalendarObject(...e){return t(this,void 0,void 0,(function*(){return oi(Kn,{headers:this.authHeaders})(e[0])}))}updateCalendarObject(...e){return t(this,void 0,void 0,(function*(){return oi($n,{headers:this.authHeaders})(e[0])}))}deleteCalendarObject(...e){return t(this,void 0,void 0,(function*(){return oi(Yn,{headers:this.authHeaders})(e[0])}))}syncCalendars(...e){return t(this,void 0,void 0,(function*(){return oi(Hn,{headers:this.authHeaders,account:this.account})(e[0])}))}addressBookQuery(...e){return t(this,void 0,void 0,(function*(){return oi(xn,{headers:this.authHeaders})(e[0])}))}addressBookMultiGet(...e){return t(this,void 0,void 0,(function*(){return oi(Rn,{headers:this.authHeaders})(e[0])}))}fetchAddressBooks(...e){return t(this,void 0,void 0,(function*(){return oi(Fn,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchVCards(...e){return t(this,void 0,void 0,(function*(){return oi(Sn,{headers:this.authHeaders})(e[0])}))}createVCard(...e){return t(this,void 0,void 0,(function*(){return oi(Nn,{headers:this.authHeaders})(e[0])}))}updateVCard(...e){return t(this,void 0,void 0,(function*(){return oi(Ln,{headers:this.authHeaders})(e[0])}))}deleteVCard(...e){return t(this,void 0,void 0,(function*(){return oi(jn,{headers:this.authHeaders})(e[0])}))}}var fi=Object.freeze({__proto__:null,DAVClient:hi,createDAVClient:di}),pi=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({DAVNamespace:U,DAVNamespaceShort:V,DAVAttributeMap:M},fi),yn),On),ti),In),zn),li),cn);export{M as DAVAttributeMap,hi as DAVClient,U as DAVNamespace,V as DAVNamespaceShort,xn as addressBookQuery,Un as calendarMultiGet,Pn as calendarQuery,un as cleanupFalsy,wn as collectionQuery,Zn as createAccount,Kn as createCalendarObject,di as createDAVClient,fn as createObject,Nn as createVCard,dn as davRequest,pi as default,Yn as deleteCalendarObject,gn as deleteObject,jn as deleteVCard,Fn as fetchAddressBooks,Vn as fetchCalendarObjects,Mn as fetchCalendars,si as fetchOauthTokens,Sn as fetchVCards,qn as freeBusyQuery,ai as getBasicAuthHeaders,sn as getDAVAttribute,ci as getOauthHeaders,Tn as isCollectionDirty,Bn as makeCalendar,hn as propfind,ui as refreshAccessToken,Cn as smartCollectionSync,An as supportedReportSet,Hn as syncCalendars,_n as syncCollection,$n as updateCalendarObject,pn as updateObject,Ln as updateVCard,an as urlContains,on as urlEquals}; diff --git a/dist/tsdav.min.mjs b/dist/tsdav.min.mjs new file mode 100644 index 0000000..acb8719 --- /dev/null +++ b/dist/tsdav.min.mjs @@ -0,0 +1 @@ +import{fetch as e}from"cross-fetch";import t from"debug";import r from"xml-js";import{encode as o}from"base-64";function n(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n{const t=Number(e);if(!Number.isNaN(t))return t;const r=e.toLowerCase();return"true"===r||"false"!==r&&e},u=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),o=t.trim();if(Math.abs(r.length-o.length)>1)return!1;const n="/"===r.slice(-1)?r.slice(0,-1):r,a="/"===o.slice(-1)?o.slice(0,-1):o;return e.includes(a)||t.includes(n)},h=(e,t)=>{if(!e&&!t)return!0;if(!e||!t)return!1;const r=e.trim(),o=t.trim(),n="/"===r.slice(-1)?r.slice(0,-1):r,a="/"===o.slice(-1)?o.slice(0,-1):o;return e.includes(a)||t.includes(n)},p=e=>e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[s[t]]:t})),{}),v=e=>Object.entries(e).reduce(((e,[t,r])=>r?Object.assign(Object.assign({},e),{[t]:r}):e),{});var f=Object.freeze({__proto__:null,cleanupFalsy:v,getDAVAttribute:p,urlContains:h,urlEquals:u});const g=t("tsdav:request"),m=t=>a(void 0,void 0,void 0,(function*(){var o;const{url:n,init:a,convertIncoming:d=!0,parseOutgoing:s=!0}=t,{headers:i={},body:c,namespace:u,method:h,attributes:p}=a,f=d?r.js2xml(Object.assign(Object.assign({_declaration:{_attributes:{version:"1.0",encoding:"utf-8"}}},c),{_attributes:p}),{compact:!0,spaces:2,elementNameFn:e=>u&&!/^.+:.+/.test(e)?`${u}:${e}`:e}):c,m=yield e(n,{headers:Object.assign({"Content-Type":"text/xml;charset=UTF-8"},v(i)),body:f,method:h}),y=yield m.text();if(!m.ok||!(null===(o=m.headers.get("content-type"))||void 0===o?void 0:o.includes("xml"))||!s)return[{href:m.url,ok:m.ok,status:m.status,statusText:m.statusText,raw:y}];const b=r.xml2js(y,{compact:!0,trim:!0,textFn:(e,t)=>{try{const r=t._parent,o=Object.keys(r),n=o[o.length-1],a=r[n];if(a.length>0){a[a.length-1]=l(e)}else r[n]=l(e)}catch(e){g(e.stack)}},elementNameFn:e=>e.replace(/^.+:/,"").replace(/([-_]\w)/g,(e=>e[1].toUpperCase())),attributesFn:e=>{const t=Object.assign({},e);return delete t.xmlns,t},ignoreDeclaration:!0});return(Array.isArray(b.multistatus.response)?b.multistatus.response:[b.multistatus.response]).map((e=>{var t,r;if(!e)return{status:m.status,statusText:m.statusText,ok:m.ok};const o=/^\S+\s(?\d+)\s(?.+)$/.exec(e.status);return{raw:b,href:e.href,status:(null==o?void 0:o.groups)?Number.parseInt(null==o?void 0:o.groups.status,10):m.status,statusText:null!==(r=null===(t=null==o?void 0:o.groups)||void 0===t?void 0:t.statusText)&&void 0!==r?r:m.statusText,ok:!e.error,error:e.error,responsedescription:e.responsedescription,props:(Array.isArray(e.propstat)?e.propstat:[e.propstat]).reduce(((e,t)=>Object.assign(Object.assign({},e),null==t?void 0:t.prop)),{})}}))})),y=e=>a(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:o,headers:n}=e;return m({url:t,init:{method:"PROPFIND",headers:v(Object.assign({depth:o},n)),namespace:i.DAV,body:{propfind:{_attributes:p([d.CALDAV,d.CALDAV_APPLE,d.CALENDAR_SERVER,d.CARDDAV,d.DAV]),prop:r}}}})})),b=t=>a(void 0,void 0,void 0,(function*(){const{url:r,data:o,headers:n}=t;return e(r,{method:"PUT",body:o,headers:n})})),A=t=>a(void 0,void 0,void 0,(function*(){const{url:r,data:o,etag:n,headers:a}=t;return e(r,{method:"PUT",body:o,headers:v(Object.assign({"If-Match":n},a))})})),O=t=>a(void 0,void 0,void 0,(function*(){const{url:r,headers:o,etag:n}=t;return e(r,{method:"DELETE",headers:v(Object.assign({"If-Match":n},o))})}));var C=Object.freeze({__proto__:null,createObject:b,davRequest:m,deleteObject:O,propfind:y,updateObject:A});function D(e,t){const r=e=>t.every((t=>e[t]));return Array.isArray(e)?e.every((e=>r(e))):r(e)}const j=(e,t)=>t.reduce(((t,r)=>e[r]?t:`${t.length?`${t},`:""}${r.toString()}`),""),V=t("tsdav:collection"),$=e=>a(void 0,void 0,void 0,(function*(){const{url:t,body:r,depth:o,defaultNamespace:n=i.DAV,headers:a}=e,d=yield m({url:t,init:{method:"REPORT",headers:v(Object.assign({depth:o},a)),namespace:n,body:r}});return 1!==d.length||d[0].raw?d:[]})),w=e=>a(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:o,headers:n}=e;return m({url:t,init:{method:"MKCOL",headers:v(Object.assign({depth:o},n)),namespace:i.DAV,body:r?{mkcol:{set:{prop:r}}}:void 0}})})),k=e=>a(void 0,void 0,void 0,(function*(){var t,r,o,n,a;const{collection:d,headers:s}=e;return null!==(a=null===(n=null===(o=null===(r=null===(t=(yield y({url:d.url,props:{[`${i.DAV}:supported-report-set`]:{}},depth:"0",headers:s}))[0])||void 0===t?void 0:t.props)||void 0===r?void 0:r.supportedReportSet)||void 0===o?void 0:o.supportedReport)||void 0===n?void 0:n.map((e=>Object.keys(e.report)[0])))&&void 0!==a?a:[]})),_=e=>a(void 0,void 0,void 0,(function*(){var t,r,o;const{collection:n,headers:a}=e,d=(yield y({url:n.url,props:{[`${i.CALENDAR_SERVER}:getctag`]:{}},depth:"0",headers:a})).filter((e=>h(n.url,e.href)))[0];if(!d)throw new Error("Collection does not exist on server");return{isDirty:n.ctag!==(null===(t=d.props)||void 0===t?void 0:t.getctag),newCtag:null===(o=null===(r=d.props)||void 0===r?void 0:r.getctag)||void 0===o?void 0:o.toString()}})),R=e=>{const{url:t,props:r,headers:o,syncLevel:n,syncToken:a}=e;return m({url:t,init:{method:"REPORT",namespace:i.DAV,headers:Object.assign({},o),body:{"sync-collection":{_attributes:p([d.CALDAV,d.CARDDAV,d.DAV]),"sync-level":n,"sync-token":a,[`${i.DAV}:prop`]:r}}}})},U=e=>a(void 0,void 0,void 0,(function*(){var t,r,o,n,a,d,s,c,l,u,p;const{collection:v,method:f,headers:g,account:m,detailedResult:y}=e,b=["accountType","homeUrl"];if(!m||!D(m,b)){if(!m)throw new Error("no account for smartCollectionSync");throw new Error(`account must have ${j(m,b)} before smartCollectionSync`)}const A=null!=f?f:(null===(t=v.reports)||void 0===t?void 0:t.includes("syncCollection"))?"webdav":"basic";if(V(`smart collection sync with type ${m.accountType} and method ${A}`),"webdav"===A){const e=yield R({url:v.url,props:{[`${i.DAV}:getetag`]:{},[`${"caldav"===m.accountType?i.CALDAV:i.CARDDAV}:${"caldav"===m.accountType?"calendar-data":"address-data"}`]:{},[`${i.DAV}:displayname`]:{}},syncLevel:1,syncToken:v.syncToken,headers:g}),t=e.filter((e=>{var t;const r="caldav"===m.accountType?".ics":".vcf";return(null===(t=e.href)||void 0===t?void 0:t.slice(-4))===r})),l=t.filter((e=>404!==e.status)).map((e=>e.href)),u=t.filter((e=>404===e.status)).map((e=>e.href)),p=(l.length&&null!==(o=yield null===(r=null==v?void 0:v.objectMultiGet)||void 0===r?void 0:r.call(v,{url:v.url,props:{[`${i.DAV}:getetag`]:{},[`${"caldav"===m.accountType?i.CALDAV:i.CARDDAV}:${"caldav"===m.accountType?"calendar-data":"address-data"}`]:{}},objectUrls:l,depth:"1",headers:g}))&&void 0!==o?o:[]).map((e=>{var t,r,o,n,a,d,s,i,c,l;return{url:null!==(t=e.href)&&void 0!==t?t:"",etag:null===(r=e.props)||void 0===r?void 0:r.getetag,data:"caldav"===(null==m?void 0:m.accountType)?null!==(a=null===(n=null===(o=e.props)||void 0===o?void 0:o.calendarData)||void 0===n?void 0:n._cdata)&&void 0!==a?a:null===(d=e.props)||void 0===d?void 0:d.calendarData:null!==(c=null===(i=null===(s=e.props)||void 0===s?void 0:s.addressData)||void 0===i?void 0:i._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.addressData}})),f=null!==(n=v.objects)&&void 0!==n?n:[],b=p.filter((e=>f.every((t=>!h(t.url,e.url))))),A=f.reduce(((e,t)=>{const r=p.find((e=>h(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),O=u.map((e=>({url:e,etag:""}))),C=f.filter((e=>p.some((t=>h(e.url,t.url)&&t.etag===e.etag))));return Object.assign(Object.assign({},v),{objects:y?{created:b,updated:A,deleted:O}:[...C,...b,...A],syncToken:null!==(c=null===(s=null===(d=null===(a=e[0])||void 0===a?void 0:a.raw)||void 0===d?void 0:d.multistatus)||void 0===s?void 0:s.syncToken)&&void 0!==c?c:v.syncToken})}if("basic"===A){const{isDirty:e,newCtag:t}=yield _({collection:v,headers:g}),r=null!==(l=v.objects)&&void 0!==l?l:[],o=null!==(p=yield null===(u=v.fetchObjects)||void 0===u?void 0:u.call(v,{collection:v,headers:g}))&&void 0!==p?p:[],n=o.filter((e=>r.every((t=>!h(t.url,e.url))))),a=r.reduce(((e,t)=>{const r=o.find((e=>h(e.url,t.url)));return r&&r.etag&&r.etag!==t.etag?[...e,r]:e}),[]),d=r.filter((e=>o.every((t=>!h(t.url,e.url))))),s=r.filter((e=>o.some((t=>h(e.url,t.url)&&t.etag===e.etag))));if(e)return Object.assign(Object.assign({},v),{objects:y?{created:n,updated:a,deleted:d}:[...s,...n,...a],ctag:t})}return y?Object.assign(Object.assign({},v),{objects:{created:[],updated:[],deleted:[]}}):v}));var L=Object.freeze({__proto__:null,collectionQuery:$,isCollectionDirty:_,makeCollection:w,smartCollectionSync:U,supportedReportSet:k,syncCollection:R});const T=t("tsdav:addressBook"),E=e=>a(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:o,depth:n,headers:a}=e;return $({url:t,body:{"addressbook-query":{_attributes:p([d.CARDDAV,d.DAV]),[`${i.DAV}:prop`]:r,filter:null!=o?o:{"prop-filter":{_attributes:{name:"FN"}}}}},defaultNamespace:i.CARDDAV,depth:n,headers:a})})),S=e=>a(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:o,depth:n,headers:a}=e;return $({url:t,body:{"addressbook-multiget":{_attributes:p([d.DAV,d.CARDDAV]),[`${i.DAV}:prop`]:r,[`${i.DAV}:href`]:o}},defaultNamespace:i.CARDDAV,depth:n,headers:a})})),x=e=>a(void 0,void 0,void 0,(function*(){const{account:t,headers:r,props:o}=null!=e?e:{},n=["homeUrl","rootUrl"];if(!t||!D(t,n)){if(!t)throw new Error("no account for fetchAddressBooks");throw new Error(`account must have ${j(t,n)} before fetchAddressBooks`)}const d=yield y({url:t.homeUrl,props:null!=o?o:{[`${i.DAV}:displayname`]:{},[`${i.CALENDAR_SERVER}:getctag`]:{},[`${i.DAV}:resourcetype`]:{},[`${i.DAV}:sync-token`]:{}},depth:"1",headers:r});return Promise.all(d.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("addressbook")})).map((e=>{var r,o,n,a,d,s,i,c,l;const u=null!==(n=null===(o=null===(r=e.props)||void 0===r?void 0:r.displayname)||void 0===o?void 0:o._cdata)&&void 0!==n?n:null===(a=e.props)||void 0===a?void 0:a.displayname;return T(`Found address book named ${"string"==typeof u?u:""},\n props: ${JSON.stringify(e.props)}`),{url:new URL(null!==(d=e.href)&&void 0!==d?d:"",null!==(s=t.rootUrl)&&void 0!==s?s:"").href,ctag:null===(i=e.props)||void 0===i?void 0:i.getctag,displayName:"string"==typeof u?u:"",resourcetype:Object.keys(null===(c=e.props)||void 0===c?void 0:c.resourcetype),syncToken:null===(l=e.props)||void 0===l?void 0:l.syncToken}})).map((e=>a(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield k({collection:e,headers:r})})})))))})),N=e=>a(void 0,void 0,void 0,(function*(){const{addressBook:t,headers:r,objectUrls:o,urlFilter:n=(e=>e),useMultiGet:a=!0}=e;T(`Fetching vcards from ${null==t?void 0:t.url}`);const d=["url"];if(!t||!D(t,d)){if(!t)throw new Error("cannot fetchVCards for undefined addressBook");throw new Error(`addressBook must have ${j(t,d)} before fetchVCards`)}const s=(null!=o?o:(yield E({url:t.url,props:{[`${i.DAV}:getetag`]:{}},depth:"1",headers:r})).map((e=>{var t;return e.ok&&null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(n).map((e=>new URL(e).pathname));let c=[];return s.length>0&&(c=a?yield S({url:t.url,props:{[`${i.DAV}:getetag`]:{},[`${i.CARDDAV}:address-data`]:{}},objectUrls:s,depth:"1",headers:r}):yield E({url:t.url,props:{[`${i.DAV}:getetag`]:{},[`${i.CARDDAV}:address-data`]:{}},depth:"1",headers:r})),c.map((e=>{var r,o,n,a,d,s;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:null===(o=e.props)||void 0===o?void 0:o.getetag,data:null!==(d=null===(a=null===(n=e.props)||void 0===n?void 0:n.addressData)||void 0===a?void 0:a._cdata)&&void 0!==d?d:null===(s=e.props)||void 0===s?void 0:s.addressData}}))})),P=e=>a(void 0,void 0,void 0,(function*(){const{addressBook:t,vCardString:r,filename:o,headers:n}=e;return b({url:new URL(o,t.url).href,data:r,headers:Object.assign({"content-type":"text/vcard; charset=utf-8","If-None-Match":"*"},n)})})),H=e=>a(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return A({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/vcard; charset=utf-8"},r)})})),B=e=>a(void 0,void 0,void 0,(function*(){const{vCard:t,headers:r}=e;return O({url:t.url,etag:t.etag,headers:r})}));var I=Object.freeze({__proto__:null,addressBookMultiGet:S,addressBookQuery:E,createVCard:P,deleteVCard:B,fetchAddressBooks:x,fetchVCards:N,updateVCard:H});const M=t("tsdav:calendar"),F=e=>a(void 0,void 0,void 0,(function*(){const{url:t,props:r,filters:o,timezone:n,depth:a,headers:s}=e;return $({url:t,body:{"calendar-query":v({_attributes:p([d.CALDAV,d.CALENDAR_SERVER,d.CALDAV_APPLE,d.DAV]),[`${i.DAV}:prop`]:r,filter:o,timezone:n})},defaultNamespace:i.CALDAV,depth:a,headers:s})})),z=e=>a(void 0,void 0,void 0,(function*(){const{url:t,props:r,objectUrls:o,filters:n,timezone:a,depth:s,headers:c}=e;return $({url:t,body:{"calendar-multiget":{_attributes:p([d.DAV,d.CALDAV]),[`${i.DAV}:prop`]:r,[`${i.DAV}:href`]:o,filter:n,timezone:a}},defaultNamespace:i.CALDAV,depth:s,headers:c})})),Z=e=>a(void 0,void 0,void 0,(function*(){const{url:t,props:r,depth:o,headers:n}=e;return m({url:t,init:{method:"MKCALENDAR",headers:v(Object.assign({depth:o},n)),namespace:i.DAV,body:{[`${i.CALDAV}:mkcalendar`]:{_attributes:p([d.DAV,d.CALDAV,d.CALDAV_APPLE]),set:{prop:r}}}}})})),G=e=>a(void 0,void 0,void 0,(function*(){const{headers:t,account:r,props:o}=null!=e?e:{},n=["homeUrl","rootUrl"];if(!r||!D(r,n)){if(!r)throw new Error("no account for fetchCalendars");throw new Error(`account must have ${j(r,n)} before fetchCalendars`)}const d=yield y({url:r.homeUrl,props:null!=o?o:{[`${i.CALDAV}:calendar-description`]:{},[`${i.CALDAV}:calendar-timezone`]:{},[`${i.DAV}:displayname`]:{},[`${i.CALDAV_APPLE}:calendar-color`]:{},[`${i.CALENDAR_SERVER}:getctag`]:{},[`${i.DAV}:resourcetype`]:{},[`${i.CALDAV}:supported-calendar-component-set`]:{},[`${i.DAV}:sync-token`]:{}},depth:"1",headers:t});return Promise.all(d.filter((e=>{var t,r;return Object.keys(null!==(r=null===(t=e.props)||void 0===t?void 0:t.resourcetype)&&void 0!==r?r:{}).includes("calendar")})).filter((e=>{var t,r,o;return(Array.isArray(null===(t=e.props)||void 0===t?void 0:t.supportedCalendarComponentSet.comp)?null===(r=e.props)||void 0===r?void 0:r.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(o=e.props)||void 0===o?void 0:o.supportedCalendarComponentSet.comp._attributes.name]||[]).some((e=>Object.values(c).includes(e)))})).map((e=>{var t,o,n,a,d,s,i,c,l,u,h,p,v,f;const g=null===(t=e.props)||void 0===t?void 0:t.calendarDescription,m=null===(o=e.props)||void 0===o?void 0:o.calendarTimezone;return{description:"string"==typeof g?g:"",timezone:"string"==typeof m?m:"",url:new URL(null!==(n=e.href)&&void 0!==n?n:"",null!==(a=r.rootUrl)&&void 0!==a?a:"").href,ctag:null===(d=e.props)||void 0===d?void 0:d.getctag,calendarColor:null===(s=e.props)||void 0===s?void 0:s.calendarColor,displayName:null!==(c=null===(i=e.props)||void 0===i?void 0:i.displayname._cdata)&&void 0!==c?c:null===(l=e.props)||void 0===l?void 0:l.displayname,components:Array.isArray(null===(u=e.props)||void 0===u?void 0:u.supportedCalendarComponentSet.comp)?null===(h=e.props)||void 0===h?void 0:h.supportedCalendarComponentSet.comp.map((e=>e._attributes.name)):[null===(p=e.props)||void 0===p?void 0:p.supportedCalendarComponentSet.comp._attributes.name],resourcetype:Object.keys(null===(v=e.props)||void 0===v?void 0:v.resourcetype),syncToken:null===(f=e.props)||void 0===f?void 0:f.syncToken}})).map((e=>a(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{reports:yield k({collection:e,headers:t})})})))))})),Q=e=>a(void 0,void 0,void 0,(function*(){const{calendar:t,objectUrls:r,filters:o,timeRange:n,headers:a,expand:d,urlFilter:s=(e=>Boolean(null==e?void 0:e.includes(".ics"))),useMultiGet:c=!0}=e;if(n){const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(n.start)&&e.test(n.end)||t.test(n.start)&&t.test(n.end)))throw new Error("invalid timeRange format, not in ISO8601")}M(`Fetching calendar objects from ${null==t?void 0:t.url}`);const l=["url"];if(!t||!D(t,l)){if(!t)throw new Error("cannot fetchCalendarObjects for undefined calendar");throw new Error(`calendar must have ${j(t,l)} before fetchCalendarObjects`)}const u=null!=o?o:[{"comp-filter":{_attributes:{name:"VCALENDAR"},"comp-filter":Object.assign({_attributes:{name:"VEVENT"}},n?{"time-range":{_attributes:{start:`${new Date(n.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(n.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})}}],h=(null!=r?r:(yield F({url:t.url,props:{[`${i.DAV}:getetag`]:Object.assign({},d&&n?{[`${i.CALDAV}:expand`]:{_attributes:{start:`${new Date(n.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(n.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:u,depth:"1",headers:a})).map((e=>{var t;return null!==(t=e.href)&&void 0!==t?t:""}))).map((e=>e.startsWith("http")||!e?e:new URL(e,t.url).href)).filter(s).map((e=>new URL(e).pathname));let p=[];return h.length>0&&(p=!c||d?yield F({url:t.url,props:{[`${i.DAV}:getetag`]:{},[`${i.CALDAV}:calendar-data`]:Object.assign({},d&&n?{[`${i.CALDAV}:expand`]:{_attributes:{start:`${new Date(n.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(n.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},filters:u,depth:"1",headers:a}):yield z({url:t.url,props:{[`${i.DAV}:getetag`]:{},[`${i.CALDAV}:calendar-data`]:Object.assign({},d&&n?{[`${i.CALDAV}:expand`]:{_attributes:{start:`${new Date(n.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(n.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}}:{})},objectUrls:h,depth:"1",headers:a})),p.map((e=>{var r,o,n,a,d,s;return{url:new URL(null!==(r=e.href)&&void 0!==r?r:"",t.url).href,etag:`${null===(o=e.props)||void 0===o?void 0:o.getetag}`,data:null!==(d=null===(a=null===(n=e.props)||void 0===n?void 0:n.calendarData)||void 0===a?void 0:a._cdata)&&void 0!==d?d:null===(s=e.props)||void 0===s?void 0:s.calendarData}}))})),q=e=>a(void 0,void 0,void 0,(function*(){const{calendar:t,iCalString:r,filename:o,headers:n}=e;return b({url:new URL(o,t.url).href,data:r,headers:Object.assign({"content-type":"text/calendar; charset=utf-8","If-None-Match":"*"},n)})})),J=e=>a(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return A({url:t.url,data:t.data,etag:t.etag,headers:Object.assign({"content-type":"text/calendar; charset=utf-8"},r)})})),K=e=>a(void 0,void 0,void 0,(function*(){const{calendarObject:t,headers:r}=e;return O({url:t.url,etag:t.etag,headers:r})})),W=e=>a(void 0,void 0,void 0,(function*(){var t;const{oldCalendars:r,account:o,detailedResult:n,headers:d}=e;if(!o)throw new Error("Must have account before syncCalendars");const s=null!==(t=null!=r?r:o.calendars)&&void 0!==t?t:[],i=yield G({account:o,headers:d}),c=i.filter((e=>s.every((t=>!h(t.url,e.url)))));M(`new calendars: ${c.map((e=>e.displayName))}`);const l=s.reduce(((e,t)=>{const r=i.find((e=>h(e.url,t.url)));return r&&(r.syncToken&&r.syncToken!==t.syncToken||r.ctag&&r.ctag!==t.ctag)?[...e,r]:e}),[]);M(`updated calendars: ${l.map((e=>e.displayName))}`);const u=yield Promise.all(l.map((e=>a(void 0,void 0,void 0,(function*(){return yield U({collection:Object.assign(Object.assign({},e),{objectMultiGet:z}),method:"webdav",headers:d,account:o})}))))),p=s.filter((e=>i.every((t=>!h(t.url,e.url)))));M(`deleted calendars: ${p.map((e=>e.displayName))}`);const v=s.filter((e=>i.some((t=>h(t.url,e.url)&&(t.syncToken&&t.syncToken!==e.syncToken||t.ctag&&t.ctag!==e.ctag)))));return n?{created:c,updated:l,deleted:p}:[...v,...c,...u]})),Y=e=>a(void 0,void 0,void 0,(function*(){const{url:t,timeRange:r,depth:o,headers:n}=e;if(!r)throw new Error("timeRange is required");{const e=/^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i,t=/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i;if(!(e.test(r.start)&&e.test(r.end)||t.test(r.start)&&t.test(r.end)))throw new Error("invalid timeRange format, not in ISO8601")}return(yield $({url:t,body:{"free-busy-query":v({_attributes:p([d.CALDAV]),[`${i.CALDAV}:time-range`]:{_attributes:{start:`${new Date(r.start).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`,end:`${new Date(r.end).toISOString().slice(0,19).replace(/[-:.]/g,"")}Z`}}})},defaultNamespace:i.CALDAV,depth:o,headers:n}))[0]}));var X=Object.freeze({__proto__:null,calendarMultiGet:z,calendarQuery:F,createCalendarObject:q,deleteCalendarObject:K,fetchCalendarObjects:Q,fetchCalendars:G,freeBusyQuery:Y,makeCalendar:Z,syncCalendars:W,updateCalendarObject:J});const ee=t("tsdav:account"),te=t=>a(void 0,void 0,void 0,(function*(){var r,o;ee("Service discovery...");const{account:n,headers:a}=t,d=new URL(n.serverUrl),s=new URL(`/.well-known/${n.accountType}`,d);s.protocol=null!==(r=d.protocol)&&void 0!==r?r:"http";try{const t=yield e(s.href,{headers:a,method:"PROPFIND",redirect:"manual"});if(t.status>=300&&t.status<400){const e=t.headers.get("Location");if("string"==typeof e&&e.length){ee(`Service discovery redirected to ${e}`);const t=new URL(e,d);return t.hostname===s.hostname&&s.port&&!t.port&&(t.port=s.port),t.protocol=null!==(o=d.protocol)&&void 0!==o?o:"http",t.href}}}catch(e){ee(`Service discovery failed: ${e.stack}`)}return d.href})),re=e=>a(void 0,void 0,void 0,(function*(){var t,r,o,n,a;const{account:d,headers:s}=e,c=["rootUrl"];if(!D(d,c))throw new Error(`account must have ${j(d,c)} before fetchPrincipalUrl`);ee(`Fetching principal url from path ${d.rootUrl}`);const[l]=yield y({url:d.rootUrl,props:{[`${i.DAV}:current-user-principal`]:{}},depth:"0",headers:s});if(!l.ok&&(ee(`Fetch principal url failed: ${l.statusText}`),401===l.status))throw new Error("Invalid credentials");return ee(`Fetched principal url ${null===(r=null===(t=l.props)||void 0===t?void 0:t.currentUserPrincipal)||void 0===r?void 0:r.href}`),new URL(null!==(a=null===(n=null===(o=l.props)||void 0===o?void 0:o.currentUserPrincipal)||void 0===n?void 0:n.href)&&void 0!==a?a:"",d.rootUrl).href})),oe=e=>a(void 0,void 0,void 0,(function*(){var t,r;const{account:o,headers:n}=e,a=["principalUrl","rootUrl"];if(!D(o,a))throw new Error(`account must have ${j(o,a)} before fetchHomeUrl`);ee(`Fetch home url from ${o.principalUrl}`);const d=(yield y({url:o.principalUrl,props:"caldav"===o.accountType?{[`${i.CALDAV}:calendar-home-set`]:{}}:{[`${i.CARDDAV}:addressbook-home-set`]:{}},depth:"0",headers:n})).find((e=>h(o.principalUrl,e.href)));if(!d||!d.ok)throw new Error("cannot find homeUrl");const s=new URL("caldav"===o.accountType?null===(t=null==d?void 0:d.props)||void 0===t?void 0:t.calendarHomeSet.href:null===(r=null==d?void 0:d.props)||void 0===r?void 0:r.addressbookHomeSet.href,o.rootUrl).href;return ee(`Fetched home url ${s}`),s})),ne=e=>a(void 0,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:o=!1,loadObjects:n=!1}=e,d=Object.assign({},t);return d.rootUrl=yield te({account:t,headers:r}),d.principalUrl=yield re({account:d,headers:r}),d.homeUrl=yield oe({account:d,headers:r}),(o||n)&&("caldav"===t.accountType?d.calendars=yield G({headers:r,account:d}):"carddav"===t.accountType&&(d.addressBooks=yield x({headers:r,account:d}))),n&&("caldav"===t.accountType&&d.calendars?d.calendars=yield Promise.all(d.calendars.map((e=>a(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield Q({calendar:e,headers:r})})}))))):"carddav"===t.accountType&&d.addressBooks&&(d.addressBooks=yield Promise.all(d.addressBooks.map((e=>a(void 0,void 0,void 0,(function*(){return Object.assign(Object.assign({},e),{objects:yield N({addressBook:e,headers:r})})}))))))),d}));var ae=Object.freeze({__proto__:null,createAccount:ne,fetchHomeUrl:oe,fetchPrincipalUrl:re,serviceDiscovery:te});const de=t("tsdav:authHelper"),se=(e,t)=>(...r)=>e(Object.assign(Object.assign({},t),r[0])),ie=e=>(de(`Basic auth token generated: ${o(`${e.username}:${e.password}`)}`),{authorization:`Basic ${o(`${e.username}:${e.password}`)}`}),ce=t=>a(void 0,void 0,void 0,(function*(){const r=["authorizationCode","redirectUrl","clientId","clientSecret","tokenUrl"];if(!D(t,r))throw new Error(`Oauth credentials missing: ${j(t,r)}`);const o=new URLSearchParams({grant_type:"authorization_code",code:t.authorizationCode,redirect_uri:t.redirectUrl,client_id:t.clientId,client_secret:t.clientSecret});de(t.tokenUrl),de(o.toString());const n=yield e(t.tokenUrl,{method:"POST",body:o.toString(),headers:{"content-length":`${o.toString().length}`,"content-type":"application/x-www-form-urlencoded"}});if(n.ok){return yield n.json()}return de(`Fetch Oauth tokens failed: ${yield n.text()}`),{}})),le=t=>a(void 0,void 0,void 0,(function*(){const r=["refreshToken","clientId","clientSecret","tokenUrl"];if(!D(t,r))throw new Error(`Oauth credentials missing: ${j(t,r)}`);const o=new URLSearchParams({client_id:t.clientId,client_secret:t.clientSecret,refresh_token:t.refreshToken,grant_type:"refresh_token"}),n=yield e(t.tokenUrl,{method:"POST",body:o.toString(),headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(n.ok){return yield n.json()}return de(`Refresh access token failed: ${yield n.text()}`),{}})),ue=e=>a(void 0,void 0,void 0,(function*(){var t;de("Fetching oauth headers");let r={};return e.refreshToken?(e.refreshToken&&!e.accessToken||Date.now()>(null!==(t=e.expiration)&&void 0!==t?t:0))&&(r=yield le(e)):r=yield ce(e),de(`Oauth tokens fetched: ${r.access_token}`),{tokens:r,headers:{authorization:`Bearer ${r.access_token}`}}}));var he=Object.freeze({__proto__:null,defaultParam:se,fetchOauthTokens:ce,getBasicAuthHeaders:ie,getOauthHeaders:ue,refreshAccessToken:le});const pe=e=>a(void 0,void 0,void 0,(function*(){const{serverUrl:t,credentials:r,authMethod:o,defaultAccountType:d}=e,s="Basic"===o?ie(r):"Oauth"===o?(yield ue(r)).headers:{},i=d?yield ne({account:{serverUrl:t,credentials:r,accountType:d},headers:s}):void 0,c=se(b,{url:t,headers:s}),l=se(A,{headers:s,url:t}),u=se(O,{headers:s,url:t}),h=se(y,{headers:s}),p=se($,{headers:s}),v=se(w,{headers:s}),f=se(R,{headers:s}),g=se(k,{headers:s}),C=se(_,{headers:s}),D=se(U,{headers:s,account:i}),j=se(F,{headers:s}),V=se(z,{headers:s}),L=se(Z,{headers:s}),T=se(G,{headers:s,account:i}),I=se(Q,{headers:s}),M=se(q,{headers:s}),Y=se(J,{headers:s}),X=se(K,{headers:s}),ee=se(W,{account:i,headers:s}),te=se(E,{headers:s}),re=se(S,{headers:s});return{davRequest:e=>a(void 0,void 0,void 0,(function*(){const{init:t}=e,r=n(e,["init"]),{headers:o}=t,a=n(t,["headers"]);return m(Object.assign(Object.assign({},r),{init:Object.assign(Object.assign({},a),{headers:Object.assign(Object.assign({},s),o)})}))})),propfind:h,createAccount:e=>a(void 0,void 0,void 0,(function*(){const{account:o,headers:n,loadCollections:a,loadObjects:d}=e;return ne({account:Object.assign({serverUrl:t,credentials:r},o),headers:Object.assign(Object.assign({},s),n),loadCollections:a,loadObjects:d})})),createObject:c,updateObject:l,deleteObject:u,calendarQuery:j,addressBookQuery:te,collectionQuery:p,makeCollection:v,calendarMultiGet:V,makeCalendar:L,syncCollection:f,supportedReportSet:g,isCollectionDirty:C,smartCollectionSync:D,fetchCalendars:T,fetchCalendarObjects:I,createCalendarObject:M,updateCalendarObject:Y,deleteCalendarObject:X,syncCalendars:ee,fetchAddressBooks:se(x,{account:i,headers:s}),addressBookMultiGet:re,fetchVCards:se(N,{headers:s}),createVCard:se(P,{headers:s}),updateVCard:se(H,{headers:s}),deleteVCard:se(B,{headers:s})}}));class ve{constructor(e){var t,r;this.serverUrl=e.serverUrl,this.credentials=e.credentials,this.authMethod=null!==(t=e.authMethod)&&void 0!==t?t:"Basic",this.accountType=null!==(r=e.defaultAccountType)&&void 0!==r?r:"caldav"}login(){return a(this,void 0,void 0,(function*(){this.authHeaders="Basic"===this.authMethod?ie(this.credentials):"Oauth"===this.authMethod?(yield ue(this.credentials)).headers:{},this.account=this.accountType?yield ne({account:{serverUrl:this.serverUrl,credentials:this.credentials,accountType:this.accountType},headers:this.authHeaders}):void 0}))}davRequest(e){return a(this,void 0,void 0,(function*(){const{init:t}=e,r=n(e,["init"]),{headers:o}=t,a=n(t,["headers"]);return m(Object.assign(Object.assign({},r),{init:Object.assign(Object.assign({},a),{headers:Object.assign(Object.assign({},this.authHeaders),o)})}))}))}createObject(...e){return a(this,void 0,void 0,(function*(){return se(b,{url:this.serverUrl,headers:this.authHeaders})(e[0])}))}updateObject(...e){return a(this,void 0,void 0,(function*(){return se(A,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}deleteObject(...e){return a(this,void 0,void 0,(function*(){return se(O,{headers:this.authHeaders,url:this.serverUrl})(e[0])}))}propfind(...e){return a(this,void 0,void 0,(function*(){return se(y,{headers:this.authHeaders})(e[0])}))}createAccount(e){return a(this,void 0,void 0,(function*(){const{account:t,headers:r,loadCollections:o,loadObjects:n}=e;return ne({account:Object.assign({serverUrl:this.serverUrl,credentials:this.credentials},t),headers:Object.assign(Object.assign({},this.authHeaders),r),loadCollections:o,loadObjects:n})}))}collectionQuery(...e){return a(this,void 0,void 0,(function*(){return se($,{headers:this.authHeaders})(e[0])}))}makeCollection(...e){return a(this,void 0,void 0,(function*(){return se(w,{headers:this.authHeaders})(e[0])}))}syncCollection(...e){return a(this,void 0,void 0,(function*(){return se(R,{headers:this.authHeaders})(e[0])}))}supportedReportSet(...e){return a(this,void 0,void 0,(function*(){return se(k,{headers:this.authHeaders})(e[0])}))}isCollectionDirty(...e){return a(this,void 0,void 0,(function*(){return se(_,{headers:this.authHeaders})(e[0])}))}smartCollectionSync(...e){return a(this,void 0,void 0,(function*(){return se(U,{headers:this.authHeaders,account:this.account})(e[0])}))}calendarQuery(...e){return a(this,void 0,void 0,(function*(){return se(F,{headers:this.authHeaders})(e[0])}))}makeCalendar(...e){return a(this,void 0,void 0,(function*(){return se(Z,{headers:this.authHeaders})(e[0])}))}calendarMultiGet(...e){return a(this,void 0,void 0,(function*(){return se(z,{headers:this.authHeaders})(e[0])}))}fetchCalendars(...e){return a(this,void 0,void 0,(function*(){return se(G,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchCalendarObjects(...e){return a(this,void 0,void 0,(function*(){return se(Q,{headers:this.authHeaders})(e[0])}))}createCalendarObject(...e){return a(this,void 0,void 0,(function*(){return se(q,{headers:this.authHeaders})(e[0])}))}updateCalendarObject(...e){return a(this,void 0,void 0,(function*(){return se(J,{headers:this.authHeaders})(e[0])}))}deleteCalendarObject(...e){return a(this,void 0,void 0,(function*(){return se(K,{headers:this.authHeaders})(e[0])}))}syncCalendars(...e){return a(this,void 0,void 0,(function*(){return se(W,{headers:this.authHeaders,account:this.account})(e[0])}))}addressBookQuery(...e){return a(this,void 0,void 0,(function*(){return se(E,{headers:this.authHeaders})(e[0])}))}addressBookMultiGet(...e){return a(this,void 0,void 0,(function*(){return se(S,{headers:this.authHeaders})(e[0])}))}fetchAddressBooks(...e){return a(this,void 0,void 0,(function*(){return se(x,{headers:this.authHeaders,account:this.account})(null==e?void 0:e[0])}))}fetchVCards(...e){return a(this,void 0,void 0,(function*(){return se(N,{headers:this.authHeaders})(e[0])}))}createVCard(...e){return a(this,void 0,void 0,(function*(){return se(P,{headers:this.authHeaders})(e[0])}))}updateVCard(...e){return a(this,void 0,void 0,(function*(){return se(H,{headers:this.authHeaders})(e[0])}))}deleteVCard(...e){return a(this,void 0,void 0,(function*(){return se(B,{headers:this.authHeaders})(e[0])}))}}var fe=Object.freeze({__proto__:null,DAVClient:ve,createDAVClient:pe}),ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({DAVNamespace:d,DAVNamespaceShort:i,DAVAttributeMap:s},fe),C),L),ae),I),X),he),f);export{s as DAVAttributeMap,ve as DAVClient,d as DAVNamespace,i as DAVNamespaceShort,E as addressBookQuery,z as calendarMultiGet,F as calendarQuery,v as cleanupFalsy,$ as collectionQuery,ne as createAccount,q as createCalendarObject,pe as createDAVClient,b as createObject,P as createVCard,m as davRequest,ge as default,K as deleteCalendarObject,O as deleteObject,B as deleteVCard,x as fetchAddressBooks,Q as fetchCalendarObjects,G as fetchCalendars,ce as fetchOauthTokens,N as fetchVCards,Y as freeBusyQuery,ie as getBasicAuthHeaders,p as getDAVAttribute,ue as getOauthHeaders,_ as isCollectionDirty,Z as makeCalendar,y as propfind,le as refreshAccessToken,U as smartCollectionSync,k as supportedReportSet,W as syncCalendars,R as syncCollection,J as updateCalendarObject,A as updateObject,H as updateVCard,h as urlContains,u as urlEquals}; diff --git a/dist/tsdav.mjs b/dist/tsdav.mjs new file mode 100644 index 0000000..fe7b905 --- /dev/null +++ b/dist/tsdav.mjs @@ -0,0 +1,1647 @@ +import { fetch } from 'cross-fetch'; +import getLogger from 'debug'; +import convert from 'xml-js'; +import { encode } from 'base-64'; + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +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 Reflect, Promise */ + + +function __rest(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; +} + +function __awaiter(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()); + }); +} + +var DAVNamespace; +(function (DAVNamespace) { + DAVNamespace["CALENDAR_SERVER"] = "http://calendarserver.org/ns/"; + DAVNamespace["CALDAV_APPLE"] = "http://apple.com/ns/ical/"; + DAVNamespace["CALDAV"] = "urn:ietf:params:xml:ns:caldav"; + DAVNamespace["CARDDAV"] = "urn:ietf:params:xml:ns:carddav"; + DAVNamespace["DAV"] = "DAV:"; +})(DAVNamespace || (DAVNamespace = {})); +const DAVAttributeMap = { + [DAVNamespace.CALDAV]: 'xmlns:c', + [DAVNamespace.CARDDAV]: 'xmlns:card', + [DAVNamespace.CALENDAR_SERVER]: 'xmlns:cs', + [DAVNamespace.CALDAV_APPLE]: 'xmlns:ca', + [DAVNamespace.DAV]: 'xmlns:d', +}; +var DAVNamespaceShort; +(function (DAVNamespaceShort) { + DAVNamespaceShort["CALDAV"] = "c"; + DAVNamespaceShort["CARDDAV"] = "card"; + DAVNamespaceShort["CALENDAR_SERVER"] = "cs"; + DAVNamespaceShort["CALDAV_APPLE"] = "ca"; + DAVNamespaceShort["DAV"] = "d"; +})(DAVNamespaceShort || (DAVNamespaceShort = {})); +var ICALObjects; +(function (ICALObjects) { + ICALObjects["VEVENT"] = "VEVENT"; + ICALObjects["VTODO"] = "VTODO"; + ICALObjects["VJOURNAL"] = "VJOURNAL"; + ICALObjects["VFREEBUSY"] = "VFREEBUSY"; + ICALObjects["VTIMEZONE"] = "VTIMEZONE"; + ICALObjects["VALARM"] = "VALARM"; +})(ICALObjects || (ICALObjects = {})); + +const camelCase = (str) => str.replace(/([-_]\w)/g, (g) => g[1].toUpperCase()); + +const nativeType = (value) => { + const nValue = Number(value); + if (!Number.isNaN(nValue)) { + return nValue; + } + const bValue = value.toLowerCase(); + if (bValue === 'true') { + return true; + } + if (bValue === 'false') { + return false; + } + return value; +}; + +const urlEquals = (urlA, urlB) => { + if (!urlA && !urlB) { + return true; + } + if (!urlA || !urlB) { + return false; + } + const trimmedUrlA = urlA.trim(); + const trimmedUrlB = urlB.trim(); + if (Math.abs(trimmedUrlA.length - trimmedUrlB.length) > 1) { + return false; + } + const strippedUrlA = trimmedUrlA.slice(-1) === '/' ? trimmedUrlA.slice(0, -1) : trimmedUrlA; + const strippedUrlB = trimmedUrlB.slice(-1) === '/' ? trimmedUrlB.slice(0, -1) : trimmedUrlB; + return urlA.includes(strippedUrlB) || urlB.includes(strippedUrlA); +}; +const urlContains = (urlA, urlB) => { + if (!urlA && !urlB) { + return true; + } + if (!urlA || !urlB) { + return false; + } + const trimmedUrlA = urlA.trim(); + const trimmedUrlB = urlB.trim(); + const strippedUrlA = trimmedUrlA.slice(-1) === '/' ? trimmedUrlA.slice(0, -1) : trimmedUrlA; + const strippedUrlB = trimmedUrlB.slice(-1) === '/' ? trimmedUrlB.slice(0, -1) : trimmedUrlB; + return urlA.includes(strippedUrlB) || urlB.includes(strippedUrlA); +}; +const getDAVAttribute = (nsArr) => nsArr.reduce((prev, curr) => (Object.assign(Object.assign({}, prev), { [DAVAttributeMap[curr]]: curr })), {}); +const cleanupFalsy = (obj) => Object.entries(obj).reduce((prev, [key, value]) => { + if (value) + return Object.assign(Object.assign({}, prev), { [key]: value }); + return prev; +}, {}); + +var requestHelpers = /*#__PURE__*/Object.freeze({ + __proto__: null, + cleanupFalsy: cleanupFalsy, + getDAVAttribute: getDAVAttribute, + urlContains: urlContains, + urlEquals: urlEquals +}); + +const debug$5 = getLogger('tsdav:request'); +const davRequest = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const { url, init, convertIncoming = true, parseOutgoing = true } = params; + const { headers = {}, body, namespace, method, attributes } = init; + const xmlBody = convertIncoming + ? convert.js2xml(Object.assign(Object.assign({ _declaration: { _attributes: { version: '1.0', encoding: 'utf-8' } } }, body), { _attributes: attributes }), { + compact: true, + spaces: 2, + elementNameFn: (name) => { + // add namespace to all keys without namespace + if (namespace && !/^.+:.+/.test(name)) { + return `${namespace}:${name}`; + } + return name; + }, + }) + : body; + // debug('outgoing xml:'); + // debug(`${method} ${url}`); + // debug( + // `headers: ${JSON.stringify( + // { + // 'Content-Type': 'text/xml;charset=UTF-8', + // ...cleanupFalsy(headers), + // }, + // null, + // 2 + // )}` + // ); + // debug(xmlBody); + const davResponse = yield fetch(url, { + headers: Object.assign({ 'Content-Type': 'text/xml;charset=UTF-8' }, cleanupFalsy(headers)), + body: xmlBody, + method, + }); + const resText = yield davResponse.text(); + // filter out invalid responses + // debug('response xml:'); + // debug(resText); + // debug(davResponse); + if (!davResponse.ok || + !((_a = davResponse.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('xml')) || + !parseOutgoing) { + return [ + { + href: davResponse.url, + ok: davResponse.ok, + status: davResponse.status, + statusText: davResponse.statusText, + raw: resText, + }, + ]; + } + const result = convert.xml2js(resText, { + compact: true, + trim: true, + textFn: (value, parentElement) => { + try { + // This is needed for xml-js design reasons + // eslint-disable-next-line no-underscore-dangle + const parentOfParent = parentElement._parent; + const pOpKeys = Object.keys(parentOfParent); + const keyNo = pOpKeys.length; + const keyName = pOpKeys[keyNo - 1]; + const arrOfKey = parentOfParent[keyName]; + const arrOfKeyLen = arrOfKey.length; + if (arrOfKeyLen > 0) { + const arr = arrOfKey; + const arrIndex = arrOfKey.length - 1; + arr[arrIndex] = nativeType(value); + } + else { + parentOfParent[keyName] = nativeType(value); + } + } + catch (e) { + debug$5(e.stack); + } + }, + // remove namespace & camelCase + elementNameFn: (attributeName) => camelCase(attributeName.replace(/^.+:/, '')), + attributesFn: (value) => { + const newVal = Object.assign({}, value); + delete newVal.xmlns; + return newVal; + }, + ignoreDeclaration: true, + }); + const responseBodies = Array.isArray(result.multistatus.response) + ? result.multistatus.response + : [result.multistatus.response]; + return responseBodies.map((responseBody) => { + var _a, _b; + const statusRegex = /^\S+\s(?\d+)\s(?.+)$/; + if (!responseBody) { + return { + status: davResponse.status, + statusText: davResponse.statusText, + ok: davResponse.ok, + }; + } + const matchArr = statusRegex.exec(responseBody.status); + return { + raw: result, + href: responseBody.href, + status: (matchArr === null || matchArr === void 0 ? void 0 : matchArr.groups) ? Number.parseInt(matchArr === null || matchArr === void 0 ? void 0 : matchArr.groups.status, 10) : davResponse.status, + statusText: (_b = (_a = matchArr === null || matchArr === void 0 ? void 0 : matchArr.groups) === null || _a === void 0 ? void 0 : _a.statusText) !== null && _b !== void 0 ? _b : davResponse.statusText, + ok: !responseBody.error, + error: responseBody.error, + responsedescription: responseBody.responsedescription, + props: (Array.isArray(responseBody.propstat) + ? responseBody.propstat + : [responseBody.propstat]).reduce((prev, curr) => { + return Object.assign(Object.assign({}, prev), curr === null || curr === void 0 ? void 0 : curr.prop); + }, {}), + }; + }); +}); +const propfind = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, depth, headers } = params; + return davRequest({ + url, + init: { + method: 'PROPFIND', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: DAVNamespaceShort.DAV, + body: { + propfind: { + _attributes: getDAVAttribute([ + DAVNamespace.CALDAV, + DAVNamespace.CALDAV_APPLE, + DAVNamespace.CALENDAR_SERVER, + DAVNamespace.CARDDAV, + DAVNamespace.DAV, + ]), + prop: props, + }, + }, + }, + }); +}); +const createObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, data, headers } = params; + return fetch(url, { method: 'PUT', body: data, headers }); +}); +const updateObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, data, etag, headers } = params; + return fetch(url, { + method: 'PUT', + body: data, + headers: cleanupFalsy(Object.assign({ 'If-Match': etag }, headers)), + }); +}); +const deleteObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, headers, etag } = params; + return fetch(url, { + method: 'DELETE', + headers: cleanupFalsy(Object.assign({ 'If-Match': etag }, headers)), + }); +}); + +var request = /*#__PURE__*/Object.freeze({ + __proto__: null, + createObject: createObject, + davRequest: davRequest, + deleteObject: deleteObject, + propfind: propfind, + updateObject: updateObject +}); + +function hasFields(obj, fields) { + const inObj = (object) => fields.every((f) => object[f]); + if (Array.isArray(obj)) { + return obj.every((o) => inObj(o)); + } + return inObj(obj); +} +const findMissingFieldNames = (obj, fields) => fields.reduce((prev, curr) => (obj[curr] ? prev : `${prev.length ? `${prev},` : ''}${curr.toString()}`), ''); + +const debug$4 = getLogger('tsdav:collection'); +const collectionQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, body, depth, defaultNamespace = DAVNamespaceShort.DAV, headers } = params; + const queryResults = yield davRequest({ + url, + init: { + method: 'REPORT', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: defaultNamespace, + body, + }, + }); + // empty query result + if (queryResults.length === 1 && !queryResults[0].raw) { + return []; + } + return queryResults; +}); +const makeCollection = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, depth, headers } = params; + return davRequest({ + url, + init: { + method: 'MKCOL', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: DAVNamespaceShort.DAV, + body: props + ? { + mkcol: { + set: { + prop: props, + }, + }, + } + : undefined, + }, + }); +}); +const supportedReportSet = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b, _c, _d, _e; + const { collection, headers } = params; + const res = yield propfind({ + url: collection.url, + props: { + [`${DAVNamespaceShort.DAV}:supported-report-set`]: {}, + }, + depth: '0', + headers, + }); + return ((_e = (_d = (_c = (_b = (_a = res[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.supportedReportSet) === null || _c === void 0 ? void 0 : _c.supportedReport) === null || _d === void 0 ? void 0 : _d.map((sr) => Object.keys(sr.report)[0])) !== null && _e !== void 0 ? _e : []); +}); +const isCollectionDirty = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _f, _g, _h; + const { collection, headers } = params; + const responses = yield propfind({ + url: collection.url, + props: { + [`${DAVNamespaceShort.CALENDAR_SERVER}:getctag`]: {}, + }, + depth: '0', + headers, + }); + const res = responses.filter((r) => urlContains(collection.url, r.href))[0]; + if (!res) { + throw new Error('Collection does not exist on server'); + } + return { + isDirty: collection.ctag !== ((_f = res.props) === null || _f === void 0 ? void 0 : _f.getctag), + newCtag: (_h = (_g = res.props) === null || _g === void 0 ? void 0 : _g.getctag) === null || _h === void 0 ? void 0 : _h.toString(), + }; +}); +/** + * This is for webdav sync-collection only + */ +const syncCollection = (params) => { + const { url, props, headers, syncLevel, syncToken } = params; + return davRequest({ + url, + init: { + method: 'REPORT', + namespace: DAVNamespaceShort.DAV, + headers: Object.assign({}, headers), + body: { + 'sync-collection': { + _attributes: getDAVAttribute([ + DAVNamespace.CALDAV, + DAVNamespace.CARDDAV, + DAVNamespace.DAV, + ]), + 'sync-level': syncLevel, + 'sync-token': syncToken, + [`${DAVNamespaceShort.DAV}:prop`]: props, + }, + }, + }, + }); +}; +/** remote collection to local */ +const smartCollectionSync = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u; + const { collection, method, headers, account, detailedResult } = params; + const requiredFields = ['accountType', 'homeUrl']; + if (!account || !hasFields(account, requiredFields)) { + if (!account) { + throw new Error('no account for smartCollectionSync'); + } + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before smartCollectionSync`); + } + const syncMethod = method !== null && method !== void 0 ? method : (((_j = collection.reports) === null || _j === void 0 ? void 0 : _j.includes('syncCollection')) ? 'webdav' : 'basic'); + debug$4(`smart collection sync with type ${account.accountType} and method ${syncMethod}`); + if (syncMethod === 'webdav') { + const result = yield syncCollection({ + url: collection.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${account.accountType === 'caldav' ? DAVNamespaceShort.CALDAV : DAVNamespaceShort.CARDDAV}:${account.accountType === 'caldav' ? 'calendar-data' : 'address-data'}`]: {}, + [`${DAVNamespaceShort.DAV}:displayname`]: {}, + }, + syncLevel: 1, + syncToken: collection.syncToken, + headers, + }); + const objectResponses = result.filter((r) => { + var _a; + const extName = account.accountType === 'caldav' ? '.ics' : '.vcf'; + return ((_a = r.href) === null || _a === void 0 ? void 0 : _a.slice(-4)) === extName; + }); + const changedObjectUrls = objectResponses.filter((o) => o.status !== 404).map((r) => r.href); + const deletedObjectUrls = objectResponses.filter((o) => o.status === 404).map((r) => r.href); + const multiGetObjectResponse = changedObjectUrls.length + ? (_l = (yield ((_k = collection === null || collection === void 0 ? void 0 : collection.objectMultiGet) === null || _k === void 0 ? void 0 : _k.call(collection, { + url: collection.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${account.accountType === 'caldav' + ? DAVNamespaceShort.CALDAV + : DAVNamespaceShort.CARDDAV}:${account.accountType === 'caldav' ? 'calendar-data' : 'address-data'}`]: {}, + }, + objectUrls: changedObjectUrls, + depth: '1', + headers, + })))) !== null && _l !== void 0 ? _l : [] + : []; + const remoteObjects = multiGetObjectResponse.map((res) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + return { + url: (_a = res.href) !== null && _a !== void 0 ? _a : '', + etag: (_b = res.props) === null || _b === void 0 ? void 0 : _b.getetag, + data: (account === null || account === void 0 ? void 0 : account.accountType) === 'caldav' + ? (_e = (_d = (_c = res.props) === null || _c === void 0 ? void 0 : _c.calendarData) === null || _d === void 0 ? void 0 : _d._cdata) !== null && _e !== void 0 ? _e : (_f = res.props) === null || _f === void 0 ? void 0 : _f.calendarData + : (_j = (_h = (_g = res.props) === null || _g === void 0 ? void 0 : _g.addressData) === null || _h === void 0 ? void 0 : _h._cdata) !== null && _j !== void 0 ? _j : (_k = res.props) === null || _k === void 0 ? void 0 : _k.addressData, + }; + }); + const localObjects = (_m = collection.objects) !== null && _m !== void 0 ? _m : []; + // no existing url + const created = remoteObjects.filter((o) => localObjects.every((lo) => !urlContains(lo.url, o.url))); + // debug(`created objects: ${created.map((o) => o.url).join('\n')}`); + // have same url, but etag different + const updated = localObjects.reduce((prev, curr) => { + const found = remoteObjects.find((ro) => urlContains(ro.url, curr.url)); + if (found && found.etag && found.etag !== curr.etag) { + return [...prev, found]; + } + return prev; + }, []); + // debug(`updated objects: ${updated.map((o) => o.url).join('\n')}`); + const deleted = deletedObjectUrls.map((o) => ({ + url: o, + etag: '', + })); + // debug(`deleted objects: ${deleted.map((o) => o.url).join('\n')}`); + const unchanged = localObjects.filter((lo) => remoteObjects.some((ro) => urlContains(lo.url, ro.url) && ro.etag === lo.etag)); + return Object.assign(Object.assign({}, collection), { objects: detailedResult + ? { created, updated, deleted } + : [...unchanged, ...created, ...updated], + // all syncToken in the results are the same so we use the first one here + syncToken: (_r = (_q = (_p = (_o = result[0]) === null || _o === void 0 ? void 0 : _o.raw) === null || _p === void 0 ? void 0 : _p.multistatus) === null || _q === void 0 ? void 0 : _q.syncToken) !== null && _r !== void 0 ? _r : collection.syncToken }); + } + if (syncMethod === 'basic') { + const { isDirty, newCtag } = yield isCollectionDirty({ + collection, + headers, + }); + const localObjects = (_s = collection.objects) !== null && _s !== void 0 ? _s : []; + const remoteObjects = (_u = (yield ((_t = collection.fetchObjects) === null || _t === void 0 ? void 0 : _t.call(collection, { collection, headers })))) !== null && _u !== void 0 ? _u : []; + // no existing url + const created = remoteObjects.filter((ro) => localObjects.every((lo) => !urlContains(lo.url, ro.url))); + // debug(`created objects: ${created.map((o) => o.url).join('\n')}`); + // have same url, but etag different + const updated = localObjects.reduce((prev, curr) => { + const found = remoteObjects.find((ro) => urlContains(ro.url, curr.url)); + if (found && found.etag && found.etag !== curr.etag) { + return [...prev, found]; + } + return prev; + }, []); + // debug(`updated objects: ${updated.map((o) => o.url).join('\n')}`); + // does not present in remote + const deleted = localObjects.filter((cal) => remoteObjects.every((ro) => !urlContains(ro.url, cal.url))); + // debug(`deleted objects: ${deleted.map((o) => o.url).join('\n')}`); + const unchanged = localObjects.filter((lo) => remoteObjects.some((ro) => urlContains(lo.url, ro.url) && ro.etag === lo.etag)); + if (isDirty) { + return Object.assign(Object.assign({}, collection), { objects: detailedResult + ? { created, updated, deleted } + : [...unchanged, ...created, ...updated], ctag: newCtag }); + } + } + return detailedResult + ? Object.assign(Object.assign({}, collection), { objects: { + created: [], + updated: [], + deleted: [], + } }) : collection; +}); + +var collection = /*#__PURE__*/Object.freeze({ + __proto__: null, + collectionQuery: collectionQuery, + isCollectionDirty: isCollectionDirty, + makeCollection: makeCollection, + smartCollectionSync: smartCollectionSync, + supportedReportSet: supportedReportSet, + syncCollection: syncCollection +}); + +const debug$3 = getLogger('tsdav:addressBook'); +const addressBookQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, filters, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'addressbook-query': { + _attributes: getDAVAttribute([DAVNamespace.CARDDAV, DAVNamespace.DAV]), + [`${DAVNamespaceShort.DAV}:prop`]: props, + filter: filters !== null && filters !== void 0 ? filters : { + 'prop-filter': { + _attributes: { + name: 'FN', + }, + }, + }, + }, + }, + defaultNamespace: DAVNamespaceShort.CARDDAV, + depth, + headers, + }); +}); +const addressBookMultiGet = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, objectUrls, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'addressbook-multiget': { + _attributes: getDAVAttribute([DAVNamespace.DAV, DAVNamespace.CARDDAV]), + [`${DAVNamespaceShort.DAV}:prop`]: props, + [`${DAVNamespaceShort.DAV}:href`]: objectUrls, + }, + }, + defaultNamespace: DAVNamespaceShort.CARDDAV, + depth, + headers, + }); +}); +const fetchAddressBooks = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { account, headers, props: customProps } = params !== null && params !== void 0 ? params : {}; + const requiredFields = ['homeUrl', 'rootUrl']; + if (!account || !hasFields(account, requiredFields)) { + if (!account) { + throw new Error('no account for fetchAddressBooks'); + } + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchAddressBooks`); + } + const res = yield propfind({ + url: account.homeUrl, + props: customProps !== null && customProps !== void 0 ? customProps : { + [`${DAVNamespaceShort.DAV}:displayname`]: {}, + [`${DAVNamespaceShort.CALENDAR_SERVER}:getctag`]: {}, + [`${DAVNamespaceShort.DAV}:resourcetype`]: {}, + [`${DAVNamespaceShort.DAV}:sync-token`]: {}, + }, + depth: '1', + headers, + }); + return Promise.all(res + .filter((r) => { var _a, _b; return Object.keys((_b = (_a = r.props) === null || _a === void 0 ? void 0 : _a.resourcetype) !== null && _b !== void 0 ? _b : {}).includes('addressbook'); }) + .map((rs) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const displayName = (_c = (_b = (_a = rs.props) === null || _a === void 0 ? void 0 : _a.displayname) === null || _b === void 0 ? void 0 : _b._cdata) !== null && _c !== void 0 ? _c : (_d = rs.props) === null || _d === void 0 ? void 0 : _d.displayname; + debug$3(`Found address book named ${typeof displayName === 'string' ? displayName : ''}, + props: ${JSON.stringify(rs.props)}`); + return { + url: new URL((_e = rs.href) !== null && _e !== void 0 ? _e : '', (_f = account.rootUrl) !== null && _f !== void 0 ? _f : '').href, + ctag: (_g = rs.props) === null || _g === void 0 ? void 0 : _g.getctag, + displayName: typeof displayName === 'string' ? displayName : '', + resourcetype: Object.keys((_h = rs.props) === null || _h === void 0 ? void 0 : _h.resourcetype), + syncToken: (_j = rs.props) === null || _j === void 0 ? void 0 : _j.syncToken, + }; + }) + .map((addr) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, addr), { reports: yield supportedReportSet({ collection: addr, headers }) })); + }))); +}); +const fetchVCards = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { addressBook, headers, objectUrls, urlFilter = (url) => url, useMultiGet = true } = params; + debug$3(`Fetching vcards from ${addressBook === null || addressBook === void 0 ? void 0 : addressBook.url}`); + const requiredFields = ['url']; + if (!addressBook || !hasFields(addressBook, requiredFields)) { + if (!addressBook) { + throw new Error('cannot fetchVCards for undefined addressBook'); + } + throw new Error(`addressBook must have ${findMissingFieldNames(addressBook, requiredFields)} before fetchVCards`); + } + const vcardUrls = (objectUrls !== null && objectUrls !== void 0 ? objectUrls : + // fetch all objects of the calendar + (yield addressBookQuery({ + url: addressBook.url, + props: { [`${DAVNamespaceShort.DAV}:getetag`]: {} }, + depth: '1', + headers, + })).map((res) => { var _a; return (res.ok ? (_a = res.href) !== null && _a !== void 0 ? _a : '' : ''); })) + .map((url) => (url.startsWith('http') || !url ? url : new URL(url, addressBook.url).href)) + .filter(urlFilter) + .map((url) => new URL(url).pathname); + let vCardResults = []; + if (vcardUrls.length > 0) { + if (useMultiGet) { + vCardResults = yield addressBookMultiGet({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + objectUrls: vcardUrls, + depth: '1', + headers, + }); + } + else { + vCardResults = yield addressBookQuery({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + depth: '1', + headers, + }); + } + } + return vCardResults.map((res) => { + var _a, _b, _c, _d, _e, _f; + return ({ + url: new URL((_a = res.href) !== null && _a !== void 0 ? _a : '', addressBook.url).href, + etag: (_b = res.props) === null || _b === void 0 ? void 0 : _b.getetag, + data: (_e = (_d = (_c = res.props) === null || _c === void 0 ? void 0 : _c.addressData) === null || _d === void 0 ? void 0 : _d._cdata) !== null && _e !== void 0 ? _e : (_f = res.props) === null || _f === void 0 ? void 0 : _f.addressData, + }); + }); +}); +const createVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { addressBook, vCardString, filename, headers } = params; + return createObject({ + url: new URL(filename, addressBook.url).href, + data: vCardString, + headers: Object.assign({ 'content-type': 'text/vcard; charset=utf-8', 'If-None-Match': '*' }, headers), + }); +}); +const updateVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { vCard, headers } = params; + return updateObject({ + url: vCard.url, + data: vCard.data, + etag: vCard.etag, + headers: Object.assign({ 'content-type': 'text/vcard; charset=utf-8' }, headers), + }); +}); +const deleteVCard = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { vCard, headers } = params; + return deleteObject({ + url: vCard.url, + etag: vCard.etag, + headers, + }); +}); + +var addressBook = /*#__PURE__*/Object.freeze({ + __proto__: null, + addressBookMultiGet: addressBookMultiGet, + addressBookQuery: addressBookQuery, + createVCard: createVCard, + deleteVCard: deleteVCard, + fetchAddressBooks: fetchAddressBooks, + fetchVCards: fetchVCards, + updateVCard: updateVCard +}); + +const debug$2 = getLogger('tsdav:calendar'); +const calendarQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, filters, timezone, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'calendar-query': cleanupFalsy({ + _attributes: getDAVAttribute([ + DAVNamespace.CALDAV, + DAVNamespace.CALENDAR_SERVER, + DAVNamespace.CALDAV_APPLE, + DAVNamespace.DAV, + ]), + [`${DAVNamespaceShort.DAV}:prop`]: props, + filter: filters, + timezone, + }), + }, + defaultNamespace: DAVNamespaceShort.CALDAV, + depth, + headers, + }); +}); +const calendarMultiGet = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, objectUrls, filters, timezone, depth, headers } = params; + return collectionQuery({ + url, + body: { + 'calendar-multiget': { + _attributes: getDAVAttribute([DAVNamespace.DAV, DAVNamespace.CALDAV]), + [`${DAVNamespaceShort.DAV}:prop`]: props, + [`${DAVNamespaceShort.DAV}:href`]: objectUrls, + filter: filters, + timezone, + }, + }, + defaultNamespace: DAVNamespaceShort.CALDAV, + depth, + headers, + }); +}); +const makeCalendar = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, props, depth, headers } = params; + return davRequest({ + url, + init: { + method: 'MKCALENDAR', + headers: cleanupFalsy(Object.assign({ depth }, headers)), + namespace: DAVNamespaceShort.DAV, + body: { + [`${DAVNamespaceShort.CALDAV}:mkcalendar`]: { + _attributes: getDAVAttribute([ + DAVNamespace.DAV, + DAVNamespace.CALDAV, + DAVNamespace.CALDAV_APPLE, + ]), + set: { + prop: props, + }, + }, + }, + }, + }); +}); +const fetchCalendars = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { headers, account, props: customProps } = params !== null && params !== void 0 ? params : {}; + const requiredFields = ['homeUrl', 'rootUrl']; + if (!account || !hasFields(account, requiredFields)) { + if (!account) { + throw new Error('no account for fetchCalendars'); + } + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchCalendars`); + } + const res = yield propfind({ + url: account.homeUrl, + props: customProps !== null && customProps !== void 0 ? customProps : { + [`${DAVNamespaceShort.CALDAV}:calendar-description`]: {}, + [`${DAVNamespaceShort.CALDAV}:calendar-timezone`]: {}, + [`${DAVNamespaceShort.DAV}:displayname`]: {}, + [`${DAVNamespaceShort.CALDAV_APPLE}:calendar-color`]: {}, + [`${DAVNamespaceShort.CALENDAR_SERVER}:getctag`]: {}, + [`${DAVNamespaceShort.DAV}:resourcetype`]: {}, + [`${DAVNamespaceShort.CALDAV}:supported-calendar-component-set`]: {}, + [`${DAVNamespaceShort.DAV}:sync-token`]: {}, + }, + depth: '1', + headers, + }); + return Promise.all(res + .filter((r) => { var _a, _b; return Object.keys((_b = (_a = r.props) === null || _a === void 0 ? void 0 : _a.resourcetype) !== null && _b !== void 0 ? _b : {}).includes('calendar'); }) + .filter((rc) => { + var _a, _b, _c; + // filter out none iCal format calendars. + const components = Array.isArray((_a = rc.props) === null || _a === void 0 ? void 0 : _a.supportedCalendarComponentSet.comp) + ? (_b = rc.props) === null || _b === void 0 ? void 0 : _b.supportedCalendarComponentSet.comp.map((sc) => sc._attributes.name) + : [(_c = rc.props) === null || _c === void 0 ? void 0 : _c.supportedCalendarComponentSet.comp._attributes.name] || []; + return components.some((c) => Object.values(ICALObjects).includes(c)); + }) + .map((rs) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; + // debug(`Found calendar ${rs.props?.displayname}`); + const description = (_a = rs.props) === null || _a === void 0 ? void 0 : _a.calendarDescription; + const timezone = (_b = rs.props) === null || _b === void 0 ? void 0 : _b.calendarTimezone; + return { + description: typeof description === 'string' ? description : '', + timezone: typeof timezone === 'string' ? timezone : '', + url: new URL((_c = rs.href) !== null && _c !== void 0 ? _c : '', (_d = account.rootUrl) !== null && _d !== void 0 ? _d : '').href, + ctag: (_e = rs.props) === null || _e === void 0 ? void 0 : _e.getctag, + calendarColor: (_f = rs.props) === null || _f === void 0 ? void 0 : _f.calendarColor, + displayName: (_h = (_g = rs.props) === null || _g === void 0 ? void 0 : _g.displayname._cdata) !== null && _h !== void 0 ? _h : (_j = rs.props) === null || _j === void 0 ? void 0 : _j.displayname, + components: Array.isArray((_k = rs.props) === null || _k === void 0 ? void 0 : _k.supportedCalendarComponentSet.comp) + ? (_l = rs.props) === null || _l === void 0 ? void 0 : _l.supportedCalendarComponentSet.comp.map((sc) => sc._attributes.name) + : [(_m = rs.props) === null || _m === void 0 ? void 0 : _m.supportedCalendarComponentSet.comp._attributes.name], + resourcetype: Object.keys((_o = rs.props) === null || _o === void 0 ? void 0 : _o.resourcetype), + syncToken: (_p = rs.props) === null || _p === void 0 ? void 0 : _p.syncToken, + }; + }) + .map((cal) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, cal), { reports: yield supportedReportSet({ collection: cal, headers }) })); + }))); +}); +const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendar, objectUrls, filters: customFilters, timeRange, headers, expand, urlFilter = (url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')), useMultiGet = true, } = params; + if (timeRange) { + // validate timeRange + const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; + const ISO_8601_FULL = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i; + if ((!ISO_8601.test(timeRange.start) || !ISO_8601.test(timeRange.end)) && + (!ISO_8601_FULL.test(timeRange.start) || !ISO_8601_FULL.test(timeRange.end))) { + throw new Error('invalid timeRange format, not in ISO8601'); + } + } + debug$2(`Fetching calendar objects from ${calendar === null || calendar === void 0 ? void 0 : calendar.url}`); + const requiredFields = ['url']; + if (!calendar || !hasFields(calendar, requiredFields)) { + if (!calendar) { + throw new Error('cannot fetchCalendarObjects for undefined calendar'); + } + throw new Error(`calendar must have ${findMissingFieldNames(calendar, requiredFields)} before fetchCalendarObjects`); + } + // default to fetch all + const filters = customFilters !== null && customFilters !== void 0 ? customFilters : [ + { + 'comp-filter': { + _attributes: { + name: 'VCALENDAR', + }, + 'comp-filter': Object.assign({ _attributes: { + name: 'VEVENT', + } }, (timeRange + ? { + 'time-range': { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + }, + ]; + const calendarObjectUrls = (objectUrls !== null && objectUrls !== void 0 ? objectUrls : + // fetch all objects of the calendar + (yield calendarQuery({ + url: calendar.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: Object.assign({}, (expand && timeRange + ? { + [`${DAVNamespaceShort.CALDAV}:expand`]: { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + filters, + depth: '1', + headers, + })).map((res) => { var _a; return (_a = res.href) !== null && _a !== void 0 ? _a : ''; })) + .map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full + .filter(urlFilter) // custom filter function on calendar objects + .map((url) => new URL(url).pathname); // obtain pathname of the url + let calendarObjectResults = []; + if (calendarObjectUrls.length > 0) { + if (!useMultiGet || expand) { + calendarObjectResults = yield calendarQuery({ + url: calendar.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange + ? { + [`${DAVNamespaceShort.CALDAV}:expand`]: { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + filters, + depth: '1', + headers, + }); + } + else { + calendarObjectResults = yield calendarMultiGet({ + url: calendar.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange + ? { + [`${DAVNamespaceShort.CALDAV}:expand`]: { + _attributes: { + start: `${new Date(timeRange.start) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end) + .toISOString() + .slice(0, 19) + .replace(/[-:.]/g, '')}Z`, + }, + }, + } + : {})), + }, + objectUrls: calendarObjectUrls, + depth: '1', + headers, + }); + } + } + return calendarObjectResults.map((res) => { + var _a, _b, _c, _d, _e, _f; + return ({ + url: new URL((_a = res.href) !== null && _a !== void 0 ? _a : '', calendar.url).href, + etag: `${(_b = res.props) === null || _b === void 0 ? void 0 : _b.getetag}`, + data: (_e = (_d = (_c = res.props) === null || _c === void 0 ? void 0 : _c.calendarData) === null || _d === void 0 ? void 0 : _d._cdata) !== null && _e !== void 0 ? _e : (_f = res.props) === null || _f === void 0 ? void 0 : _f.calendarData, + }); + }); +}); +const createCalendarObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendar, iCalString, filename, headers } = params; + return createObject({ + url: new URL(filename, calendar.url).href, + data: iCalString, + headers: Object.assign({ 'content-type': 'text/calendar; charset=utf-8', 'If-None-Match': '*' }, headers), + }); +}); +const updateCalendarObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendarObject, headers } = params; + return updateObject({ + url: calendarObject.url, + data: calendarObject.data, + etag: calendarObject.etag, + headers: Object.assign({ 'content-type': 'text/calendar; charset=utf-8' }, headers), + }); +}); +const deleteCalendarObject = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { calendarObject, headers } = params; + return deleteObject({ url: calendarObject.url, etag: calendarObject.etag, headers }); +}); +/** + * Sync remote calendars to local + */ +const syncCalendars = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const { oldCalendars, account, detailedResult, headers } = params; + if (!account) { + throw new Error('Must have account before syncCalendars'); + } + const localCalendars = (_a = oldCalendars !== null && oldCalendars !== void 0 ? oldCalendars : account.calendars) !== null && _a !== void 0 ? _a : []; + const remoteCalendars = yield fetchCalendars({ account, headers }); + // no existing url + const created = remoteCalendars.filter((rc) => localCalendars.every((lc) => !urlContains(lc.url, rc.url))); + debug$2(`new calendars: ${created.map((cc) => cc.displayName)}`); + // have same url, but syncToken/ctag different + const updated = localCalendars.reduce((prev, curr) => { + const found = remoteCalendars.find((rc) => urlContains(rc.url, curr.url)); + if (found && + ((found.syncToken && found.syncToken !== curr.syncToken) || + (found.ctag && found.ctag !== curr.ctag))) { + return [...prev, found]; + } + return prev; + }, []); + debug$2(`updated calendars: ${updated.map((cc) => cc.displayName)}`); + const updatedWithObjects = yield Promise.all(updated.map((u) => __awaiter(void 0, void 0, void 0, function* () { + const result = yield smartCollectionSync({ + collection: Object.assign(Object.assign({}, u), { objectMultiGet: calendarMultiGet }), + method: 'webdav', + headers, + account, + }); + return result; + }))); + // does not present in remote + const deleted = localCalendars.filter((cal) => remoteCalendars.every((rc) => !urlContains(rc.url, cal.url))); + debug$2(`deleted calendars: ${deleted.map((cc) => cc.displayName)}`); + const unchanged = localCalendars.filter((cal) => remoteCalendars.some((rc) => urlContains(rc.url, cal.url) && + ((rc.syncToken && rc.syncToken !== cal.syncToken) || (rc.ctag && rc.ctag !== cal.ctag)))); + // debug(`unchanged calendars: ${unchanged.map((cc) => cc.displayName)}`); + return detailedResult + ? { + created, + updated, + deleted, + } + : [...unchanged, ...created, ...updatedWithObjects]; +}); +const freeBusyQuery = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { url, timeRange, depth, headers } = params; + if (timeRange) { + // validate timeRange + const ISO_8601 = /^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$/i; + const ISO_8601_FULL = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i; + if ((!ISO_8601.test(timeRange.start) || !ISO_8601.test(timeRange.end)) && + (!ISO_8601_FULL.test(timeRange.start) || !ISO_8601_FULL.test(timeRange.end))) { + throw new Error('invalid timeRange format, not in ISO8601'); + } + } + else { + throw new Error('timeRange is required'); + } + const result = yield collectionQuery({ + url, + body: { + 'free-busy-query': cleanupFalsy({ + _attributes: getDAVAttribute([DAVNamespace.CALDAV]), + [`${DAVNamespaceShort.CALDAV}:time-range`]: { + _attributes: { + start: `${new Date(timeRange.start).toISOString().slice(0, 19).replace(/[-:.]/g, '')}Z`, + end: `${new Date(timeRange.end).toISOString().slice(0, 19).replace(/[-:.]/g, '')}Z`, + }, + }, + }), + }, + defaultNamespace: DAVNamespaceShort.CALDAV, + depth, + headers, + }); + return result[0]; +}); + +var calendar = /*#__PURE__*/Object.freeze({ + __proto__: null, + calendarMultiGet: calendarMultiGet, + calendarQuery: calendarQuery, + createCalendarObject: createCalendarObject, + deleteCalendarObject: deleteCalendarObject, + fetchCalendarObjects: fetchCalendarObjects, + fetchCalendars: fetchCalendars, + freeBusyQuery: freeBusyQuery, + makeCalendar: makeCalendar, + syncCalendars: syncCalendars, + updateCalendarObject: updateCalendarObject +}); + +const debug$1 = getLogger('tsdav:account'); +const serviceDiscovery = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _a, _b; + debug$1('Service discovery...'); + const { account, headers } = params; + const endpoint = new URL(account.serverUrl); + const uri = new URL(`/.well-known/${account.accountType}`, endpoint); + uri.protocol = (_a = endpoint.protocol) !== null && _a !== void 0 ? _a : 'http'; + try { + const response = yield fetch(uri.href, { + headers, + method: 'PROPFIND', + redirect: 'manual', + }); + if (response.status >= 300 && response.status < 400) { + // http redirect. + const location = response.headers.get('Location'); + if (typeof location === 'string' && location.length) { + debug$1(`Service discovery redirected to ${location}`); + const serviceURL = new URL(location, endpoint); + if (serviceURL.hostname === uri.hostname && uri.port && !serviceURL.port) { + serviceURL.port = uri.port; + } + serviceURL.protocol = (_b = endpoint.protocol) !== null && _b !== void 0 ? _b : 'http'; + return serviceURL.href; + } + } + } + catch (err) { + debug$1(`Service discovery failed: ${err.stack}`); + } + return endpoint.href; +}); +const fetchPrincipalUrl = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _c, _d, _e, _f, _g; + const { account, headers } = params; + const requiredFields = ['rootUrl']; + if (!hasFields(account, requiredFields)) { + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchPrincipalUrl`); + } + debug$1(`Fetching principal url from path ${account.rootUrl}`); + const [response] = yield propfind({ + url: account.rootUrl, + props: { + [`${DAVNamespaceShort.DAV}:current-user-principal`]: {}, + }, + depth: '0', + headers, + }); + if (!response.ok) { + debug$1(`Fetch principal url failed: ${response.statusText}`); + if (response.status === 401) { + throw new Error('Invalid credentials'); + } + } + debug$1(`Fetched principal url ${(_d = (_c = response.props) === null || _c === void 0 ? void 0 : _c.currentUserPrincipal) === null || _d === void 0 ? void 0 : _d.href}`); + return new URL((_g = (_f = (_e = response.props) === null || _e === void 0 ? void 0 : _e.currentUserPrincipal) === null || _f === void 0 ? void 0 : _f.href) !== null && _g !== void 0 ? _g : '', account.rootUrl).href; +}); +const fetchHomeUrl = (params) => __awaiter(void 0, void 0, void 0, function* () { + var _h, _j; + const { account, headers } = params; + const requiredFields = ['principalUrl', 'rootUrl']; + if (!hasFields(account, requiredFields)) { + throw new Error(`account must have ${findMissingFieldNames(account, requiredFields)} before fetchHomeUrl`); + } + debug$1(`Fetch home url from ${account.principalUrl}`); + const responses = yield propfind({ + url: account.principalUrl, + props: account.accountType === 'caldav' + ? { [`${DAVNamespaceShort.CALDAV}:calendar-home-set`]: {} } + : { [`${DAVNamespaceShort.CARDDAV}:addressbook-home-set`]: {} }, + depth: '0', + headers, + }); + const matched = responses.find((r) => urlContains(account.principalUrl, r.href)); + if (!matched || !matched.ok) { + throw new Error('cannot find homeUrl'); + } + const result = new URL(account.accountType === 'caldav' + ? (_h = matched === null || matched === void 0 ? void 0 : matched.props) === null || _h === void 0 ? void 0 : _h.calendarHomeSet.href + : (_j = matched === null || matched === void 0 ? void 0 : matched.props) === null || _j === void 0 ? void 0 : _j.addressbookHomeSet.href, account.rootUrl).href; + debug$1(`Fetched home url ${result}`); + return result; +}); +const createAccount = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { account, headers, loadCollections = false, loadObjects = false } = params; + const newAccount = Object.assign({}, account); + newAccount.rootUrl = yield serviceDiscovery({ account, headers }); + newAccount.principalUrl = yield fetchPrincipalUrl({ account: newAccount, headers }); + newAccount.homeUrl = yield fetchHomeUrl({ account: newAccount, headers }); + // to load objects you must first load collections + if (loadCollections || loadObjects) { + if (account.accountType === 'caldav') { + newAccount.calendars = yield fetchCalendars({ headers, account: newAccount }); + } + else if (account.accountType === 'carddav') { + newAccount.addressBooks = yield fetchAddressBooks({ headers, account: newAccount }); + } + } + if (loadObjects) { + if (account.accountType === 'caldav' && newAccount.calendars) { + newAccount.calendars = yield Promise.all(newAccount.calendars.map((cal) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, cal), { objects: yield fetchCalendarObjects({ calendar: cal, headers }) })); + }))); + } + else if (account.accountType === 'carddav' && newAccount.addressBooks) { + newAccount.addressBooks = yield Promise.all(newAccount.addressBooks.map((addr) => __awaiter(void 0, void 0, void 0, function* () { + return (Object.assign(Object.assign({}, addr), { objects: yield fetchVCards({ addressBook: addr, headers }) })); + }))); + } + } + return newAccount; +}); + +var account = /*#__PURE__*/Object.freeze({ + __proto__: null, + createAccount: createAccount, + fetchHomeUrl: fetchHomeUrl, + fetchPrincipalUrl: fetchPrincipalUrl, + serviceDiscovery: serviceDiscovery +}); + +const debug = getLogger('tsdav:authHelper'); +/** + * Provide given params as default params to given function with optional params. + * + * suitable only for one param functions + * params are shallow merged + */ +const defaultParam = (fn, params) => (...args) => { + return fn(Object.assign(Object.assign({}, params), args[0])); +}; +const getBasicAuthHeaders = (credentials) => { + debug(`Basic auth token generated: ${encode(`${credentials.username}:${credentials.password}`)}`); + return { + authorization: `Basic ${encode(`${credentials.username}:${credentials.password}`)}`, + }; +}; +const fetchOauthTokens = (credentials) => __awaiter(void 0, void 0, void 0, function* () { + const requireFields = [ + 'authorizationCode', + 'redirectUrl', + 'clientId', + 'clientSecret', + 'tokenUrl', + ]; + if (!hasFields(credentials, requireFields)) { + throw new Error(`Oauth credentials missing: ${findMissingFieldNames(credentials, requireFields)}`); + } + const param = new URLSearchParams({ + grant_type: 'authorization_code', + code: credentials.authorizationCode, + redirect_uri: credentials.redirectUrl, + client_id: credentials.clientId, + client_secret: credentials.clientSecret, + }); + debug(credentials.tokenUrl); + debug(param.toString()); + const response = yield fetch(credentials.tokenUrl, { + method: 'POST', + body: param.toString(), + headers: { + 'content-length': `${param.toString().length}`, + 'content-type': 'application/x-www-form-urlencoded', + }, + }); + if (response.ok) { + const tokens = yield response.json(); + return tokens; + } + debug(`Fetch Oauth tokens failed: ${yield response.text()}`); + return {}; +}); +const refreshAccessToken = (credentials) => __awaiter(void 0, void 0, void 0, function* () { + const requireFields = [ + 'refreshToken', + 'clientId', + 'clientSecret', + 'tokenUrl', + ]; + if (!hasFields(credentials, requireFields)) { + throw new Error(`Oauth credentials missing: ${findMissingFieldNames(credentials, requireFields)}`); + } + const param = new URLSearchParams({ + client_id: credentials.clientId, + client_secret: credentials.clientSecret, + refresh_token: credentials.refreshToken, + grant_type: 'refresh_token', + }); + const response = yield fetch(credentials.tokenUrl, { + method: 'POST', + body: param.toString(), + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }); + if (response.ok) { + const tokens = yield response.json(); + return tokens; + } + debug(`Refresh access token failed: ${yield response.text()}`); + return {}; +}); +const getOauthHeaders = (credentials) => __awaiter(void 0, void 0, void 0, function* () { + var _a; + debug('Fetching oauth headers'); + let tokens = {}; + if (!credentials.refreshToken) { + // No refresh token, fetch new tokens + tokens = yield fetchOauthTokens(credentials); + } + else if ((credentials.refreshToken && !credentials.accessToken) || + Date.now() > ((_a = credentials.expiration) !== null && _a !== void 0 ? _a : 0)) { + // have refresh token, but no accessToken, fetch access token only + // or have both, but accessToken was expired + tokens = yield refreshAccessToken(credentials); + } + // now we should have valid access token + debug(`Oauth tokens fetched: ${tokens.access_token}`); + return { + tokens, + headers: { + authorization: `Bearer ${tokens.access_token}`, + }, + }; +}); + +var authHelpers = /*#__PURE__*/Object.freeze({ + __proto__: null, + defaultParam: defaultParam, + fetchOauthTokens: fetchOauthTokens, + getBasicAuthHeaders: getBasicAuthHeaders, + getOauthHeaders: getOauthHeaders, + refreshAccessToken: refreshAccessToken +}); + +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +const createDAVClient = (params) => __awaiter(void 0, void 0, void 0, function* () { + const { serverUrl, credentials, authMethod, defaultAccountType } = params; + const authHeaders = + // eslint-disable-next-line no-nested-ternary + authMethod === 'Basic' + ? getBasicAuthHeaders(credentials) + : authMethod === 'Oauth' + ? (yield getOauthHeaders(credentials)).headers + : {}; + const defaultAccount = defaultAccountType + ? yield createAccount({ + account: { serverUrl, credentials, accountType: defaultAccountType }, + headers: authHeaders, + }) + : undefined; + const davRequest$1 = (params0) => __awaiter(void 0, void 0, void 0, function* () { + const { init } = params0, rest = __rest(params0, ["init"]); + const { headers } = init, restInit = __rest(init, ["headers"]); + return davRequest(Object.assign(Object.assign({}, rest), { init: Object.assign(Object.assign({}, restInit), { headers: Object.assign(Object.assign({}, authHeaders), headers) }) })); + }); + const createObject$1 = defaultParam(createObject, { + url: serverUrl, + headers: authHeaders, + }); + const updateObject$1 = defaultParam(updateObject, { headers: authHeaders, url: serverUrl }); + const deleteObject$1 = defaultParam(deleteObject, { headers: authHeaders, url: serverUrl }); + const propfind$1 = defaultParam(propfind, { headers: authHeaders }); + // account + const createAccount$1 = (params0) => __awaiter(void 0, void 0, void 0, function* () { + const { account, headers, loadCollections, loadObjects } = params0; + return createAccount({ + account: Object.assign({ serverUrl, credentials }, account), + headers: Object.assign(Object.assign({}, authHeaders), headers), + loadCollections, + loadObjects, + }); + }); + // collection + const collectionQuery$1 = defaultParam(collectionQuery, { headers: authHeaders }); + const makeCollection$1 = defaultParam(makeCollection, { headers: authHeaders }); + const syncCollection$1 = defaultParam(syncCollection, { headers: authHeaders }); + const supportedReportSet$1 = defaultParam(supportedReportSet, { + headers: authHeaders, + }); + const isCollectionDirty$1 = defaultParam(isCollectionDirty, { + headers: authHeaders, + }); + const smartCollectionSync$1 = defaultParam(smartCollectionSync, { + headers: authHeaders, + account: defaultAccount, + }); + // calendar + const calendarQuery$1 = defaultParam(calendarQuery, { headers: authHeaders }); + const calendarMultiGet$1 = defaultParam(calendarMultiGet, { headers: authHeaders }); + const makeCalendar$1 = defaultParam(makeCalendar, { headers: authHeaders }); + const fetchCalendars$1 = defaultParam(fetchCalendars, { + headers: authHeaders, + account: defaultAccount, + }); + const fetchCalendarObjects$1 = defaultParam(fetchCalendarObjects, { + headers: authHeaders, + }); + const createCalendarObject$1 = defaultParam(createCalendarObject, { + headers: authHeaders, + }); + const updateCalendarObject$1 = defaultParam(updateCalendarObject, { + headers: authHeaders, + }); + const deleteCalendarObject$1 = defaultParam(deleteCalendarObject, { + headers: authHeaders, + }); + const syncCalendars$1 = defaultParam(syncCalendars, { + account: defaultAccount, + headers: authHeaders, + }); + // addressBook + const addressBookQuery$1 = defaultParam(addressBookQuery, { headers: authHeaders }); + const addressBookMultiGet$1 = defaultParam(addressBookMultiGet, { headers: authHeaders }); + const fetchAddressBooks$1 = defaultParam(fetchAddressBooks, { + account: defaultAccount, + headers: authHeaders, + }); + const fetchVCards$1 = defaultParam(fetchVCards, { headers: authHeaders }); + const createVCard$1 = defaultParam(createVCard, { headers: authHeaders }); + const updateVCard$1 = defaultParam(updateVCard, { headers: authHeaders }); + const deleteVCard$1 = defaultParam(deleteVCard, { headers: authHeaders }); + return { + davRequest: davRequest$1, + propfind: propfind$1, + createAccount: createAccount$1, + createObject: createObject$1, + updateObject: updateObject$1, + deleteObject: deleteObject$1, + calendarQuery: calendarQuery$1, + addressBookQuery: addressBookQuery$1, + collectionQuery: collectionQuery$1, + makeCollection: makeCollection$1, + calendarMultiGet: calendarMultiGet$1, + makeCalendar: makeCalendar$1, + syncCollection: syncCollection$1, + supportedReportSet: supportedReportSet$1, + isCollectionDirty: isCollectionDirty$1, + smartCollectionSync: smartCollectionSync$1, + fetchCalendars: fetchCalendars$1, + fetchCalendarObjects: fetchCalendarObjects$1, + createCalendarObject: createCalendarObject$1, + updateCalendarObject: updateCalendarObject$1, + deleteCalendarObject: deleteCalendarObject$1, + syncCalendars: syncCalendars$1, + fetchAddressBooks: fetchAddressBooks$1, + addressBookMultiGet: addressBookMultiGet$1, + fetchVCards: fetchVCards$1, + createVCard: createVCard$1, + updateVCard: updateVCard$1, + deleteVCard: deleteVCard$1, + }; +}); +class DAVClient { + constructor(params) { + var _a, _b; + this.serverUrl = params.serverUrl; + this.credentials = params.credentials; + this.authMethod = (_a = params.authMethod) !== null && _a !== void 0 ? _a : 'Basic'; + this.accountType = (_b = params.defaultAccountType) !== null && _b !== void 0 ? _b : 'caldav'; + } + login() { + return __awaiter(this, void 0, void 0, function* () { + this.authHeaders = + // eslint-disable-next-line no-nested-ternary + this.authMethod === 'Basic' + ? getBasicAuthHeaders(this.credentials) + : this.authMethod === 'Oauth' + ? (yield getOauthHeaders(this.credentials)).headers + : {}; + this.account = this.accountType + ? yield createAccount({ + account: { + serverUrl: this.serverUrl, + credentials: this.credentials, + accountType: this.accountType, + }, + headers: this.authHeaders, + }) + : undefined; + }); + } + davRequest(params0) { + return __awaiter(this, void 0, void 0, function* () { + const { init } = params0, rest = __rest(params0, ["init"]); + const { headers } = init, restInit = __rest(init, ["headers"]); + return davRequest(Object.assign(Object.assign({}, rest), { init: Object.assign(Object.assign({}, restInit), { headers: Object.assign(Object.assign({}, this.authHeaders), headers) }) })); + }); + } + createObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(createObject, { + url: this.serverUrl, + headers: this.authHeaders, + })(params[0]); + }); + } + updateObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(updateObject, { headers: this.authHeaders, url: this.serverUrl })(params[0]); + }); + } + deleteObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(deleteObject, { headers: this.authHeaders, url: this.serverUrl })(params[0]); + }); + } + propfind(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(propfind, { headers: this.authHeaders })(params[0]); + }); + } + createAccount(params0) { + return __awaiter(this, void 0, void 0, function* () { + const { account, headers, loadCollections, loadObjects } = params0; + return createAccount({ + account: Object.assign({ serverUrl: this.serverUrl, credentials: this.credentials }, account), + headers: Object.assign(Object.assign({}, this.authHeaders), headers), + loadCollections, + loadObjects, + }); + }); + } + collectionQuery(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(collectionQuery, { headers: this.authHeaders })(params[0]); + }); + } + makeCollection(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(makeCollection, { headers: this.authHeaders })(params[0]); + }); + } + syncCollection(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(syncCollection, { headers: this.authHeaders })(params[0]); + }); + } + supportedReportSet(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(supportedReportSet, { headers: this.authHeaders })(params[0]); + }); + } + isCollectionDirty(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(isCollectionDirty, { headers: this.authHeaders })(params[0]); + }); + } + smartCollectionSync(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(smartCollectionSync, { + headers: this.authHeaders, + account: this.account, + })(params[0]); + }); + } + calendarQuery(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(calendarQuery, { headers: this.authHeaders })(params[0]); + }); + } + makeCalendar(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(makeCalendar, { headers: this.authHeaders })(params[0]); + }); + } + calendarMultiGet(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(calendarMultiGet, { headers: this.authHeaders })(params[0]); + }); + } + fetchCalendars(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchCalendars, { headers: this.authHeaders, account: this.account })(params === null || params === void 0 ? void 0 : params[0]); + }); + } + fetchCalendarObjects(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchCalendarObjects, { headers: this.authHeaders })(params[0]); + }); + } + createCalendarObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(createCalendarObject, { headers: this.authHeaders })(params[0]); + }); + } + updateCalendarObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(updateCalendarObject, { headers: this.authHeaders })(params[0]); + }); + } + deleteCalendarObject(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(deleteCalendarObject, { headers: this.authHeaders })(params[0]); + }); + } + syncCalendars(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(syncCalendars, { + headers: this.authHeaders, + account: this.account, + })(params[0]); + }); + } + addressBookQuery(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(addressBookQuery, { headers: this.authHeaders })(params[0]); + }); + } + addressBookMultiGet(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(addressBookMultiGet, { headers: this.authHeaders })(params[0]); + }); + } + fetchAddressBooks(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchAddressBooks, { headers: this.authHeaders, account: this.account })(params === null || params === void 0 ? void 0 : params[0]); + }); + } + fetchVCards(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(fetchVCards, { headers: this.authHeaders })(params[0]); + }); + } + createVCard(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(createVCard, { headers: this.authHeaders })(params[0]); + }); + } + updateVCard(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(updateVCard, { headers: this.authHeaders })(params[0]); + }); + } + deleteVCard(...params) { + return __awaiter(this, void 0, void 0, function* () { + return defaultParam(deleteVCard, { headers: this.authHeaders })(params[0]); + }); + } +} + +var client = /*#__PURE__*/Object.freeze({ + __proto__: null, + DAVClient: DAVClient, + createDAVClient: createDAVClient +}); + +var index = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ DAVNamespace, + DAVNamespaceShort, + DAVAttributeMap }, client), request), collection), account), addressBook), calendar), authHelpers), requestHelpers); + +export { DAVAttributeMap, DAVClient, DAVNamespace, DAVNamespaceShort, addressBookQuery, calendarMultiGet, calendarQuery, cleanupFalsy, collectionQuery, createAccount, createCalendarObject, createDAVClient, createObject, createVCard, davRequest, index as default, deleteCalendarObject, deleteObject, deleteVCard, fetchAddressBooks, fetchCalendarObjects, fetchCalendars, fetchOauthTokens, fetchVCards, freeBusyQuery, getBasicAuthHeaders, getDAVAttribute, getOauthHeaders, isCollectionDirty, makeCalendar, propfind, refreshAccessToken, smartCollectionSync, supportedReportSet, syncCalendars, syncCollection, updateCalendarObject, updateObject, updateVCard, urlContains, urlEquals }; diff --git a/docs/docs/caldav/fetchCalendarObjects.md b/docs/docs/caldav/fetchCalendarObjects.md index 56142e4..0735f1b 100644 --- a/docs/docs/caldav/fetchCalendarObjects.md +++ b/docs/docs/caldav/fetchCalendarObjects.md @@ -24,8 +24,16 @@ const objects = await fetchCalendarObjects({ - `start` start time in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601), format that's not in ISO 8601 will cause an error be thrown. - `end` end time in [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601), format that's not in ISO 8601 will cause an error be thrown. - `headers` request headers -- `urlFilter` predicate function to filter urls from the calendar objects before fetching + :::info + some calendar providers may return their objects with different suffix than .ics such as `http://api.xx/97ec5f81-5ecc-4505-9621-08806f6796a3` or `http://api.xx/calobj1.abc` + in this case, you need to pass in your own calendar object name filter so that you can have results you need. + ::: +- `urlFilter` **default: function which only keep .ics objects** predicate function to filter urls from the calendar objects before fetching - `expand` whether to [expand](https://datatracker.ietf.org/doc/html/rfc4791#section-9.6.5) the calendar objects, forcing the server to expand recurring components into individual calendar objects. + :::info + some calendar providers may not support calendarMultiGet, then it's necessary to use calendarQuery to fetch calendar object data. + ::: +- `useMultiGet` **default: true** whether to use [calendarMultiGet](./calendarMultiGet.md) as underlying function to fetch calendar objects, if set to false, it will use [calendarQuery](./calendarQuery.md) to fetch instead. ### Return Value diff --git a/docs/docs/carddav/fetchVCards.md b/docs/docs/carddav/fetchVCards.md index 36ebcd3..6eb1a99 100644 --- a/docs/docs/carddav/fetchVCards.md +++ b/docs/docs/carddav/fetchVCards.md @@ -20,7 +20,15 @@ const vcards = await fetchVCards({ - `addressBook` **required**, [DAVAddressBook](../types/DAVAddressBook.md) to fetch vcards from - `objectUrls` vcard urls to fetch - `headers` request headers -- `urlFilter` predicate function to filter urls from the address book before fetching + :::info + some providers may return their objects with different suffixes such as `http://api.xx/97ec5f81-5ecc-4505-9621-08806f6796a3` or `http://api.xx/calobj1.abc` + in this case, you can pass in your own object name filter + ::: +- `urlFilter` **default: no filter**predicate function to filter urls from the address book before fetching + :::info + some providers may not support addressBookMultiGet, then it's necessary to use addressBookQuery to fetch vcards. + ::: +- `useMultiGet` **default: true** whether to use [addressBookMultiGet](./addressBookMultiGet.md) as underlying function to fetch vcards, if set to false, it will use [addressBookQuery](./addressBookQuery.md) instead ### Return Value diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index d53400a..1f20de1 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -59,7 +59,7 @@ module.exports = { lastVersion: 'current', versions: { current: { - label: '2.0.3', + label: '2.0.4', }, '1.1.6': { label: '1.1.6', diff --git a/package.json b/package.json index 0010c99..ff20e3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tsdav", - "version": "2.0.3", + "version": "2.0.4", "description": "WebDAV, CALDAV, and CARDDAV client for Nodejs and the Browser", "keywords": [ "dav", @@ -31,7 +31,7 @@ "package.json" ], "scripts": { - "build": "yarn -s clean && rollup -c rollup.config.js && copyfiles package.json LICENSE README.md ./dist && rimraf ./dist/ts", + "build": "yarn -s clean && rollup -c rollup.config.mjs && copyfiles package.json LICENSE README.md ./dist && rimraf ./dist/ts", "clean": "rimraf dist*", "lint": "eslint src --ext .ts", "lintFix": "eslint src --ext .ts --fix", @@ -49,41 +49,42 @@ }, "dependencies": { "base-64": "1.0.0", - "cross-fetch": "3.1.5", + "cross-fetch": "3.1.6", "debug": "4.3.4", "xml-js": "1.6.11" }, "devDependencies": { - "@rollup/plugin-commonjs": "22.0.1", - "@rollup/plugin-node-resolve": "13.1.3", - "@rollup/plugin-typescript": "8.3.3", + "@rollup/plugin-commonjs": "25.0.1", + "@rollup/plugin-node-resolve": "15.1.0", + "@rollup/plugin-typescript": "11.1.1", "@types/base-64": "1.0.0", - "@types/debug": "4.1.7", - "@types/jest": "28.1.4", - "@types/node": "18.0.0", - "@typescript-eslint/eslint-plugin": "5.30.3", - "@typescript-eslint/parser": "5.18.0", + "@types/debug": "4.1.8", + "@types/jest": "29.5.2", + "@types/node": "20.3.1", + "@typescript-eslint/eslint-plugin": "5.59.11", + "@typescript-eslint/parser": "5.59.11", "copyfiles": "2.4.1", "cross-env": "7.0.3", - "dotenv": "16.0.1", - "eslint": "8.19.0", + "dotenv": "16.3.0", + "eslint": "8.43.0", "eslint-config-airbnb": "19.0.4", "eslint-config-airbnb-typescript": "17.0.0", - "eslint-config-prettier": "8.5.0", - "eslint-module-utils": "2.7.3", - "eslint-plugin-import": "2.26.0", + "eslint-config-prettier": "8.8.0", + "eslint-module-utils": "2.8.0", + "eslint-plugin-import": "2.27.5", "eslint-plugin-prettier": "4.2.1", - "jest": "28.1.2", - "prettier": "2.7.1", - "rimraf": "3.0.2", - "rollup": "2.75.7", - "rollup-plugin-dts": "4.2.2", + "jest": "29.5.0", + "prettier": "2.8.8", + "rimraf": "5.0.1", + "rollup": "3.25.1", + "rollup-plugin-dts": "5.3.0", "rollup-plugin-node-builtins": "2.1.2", - "rollup-plugin-polyfill-node": "0.9.0", + "rollup-plugin-polyfill-node": "0.12.0", "rollup-plugin-terser": "7.0.2", - "sort-package-json": "1.57.0", - "ts-jest": "28.0.5", - "typescript": "4.7.4" + "sort-package-json": "2.4.1", + "ts-jest": "29.1.0", + "tslib": "2.5.3", + "typescript": "5.1.3" }, "engines": { "node": ">=10" diff --git a/rollup.config.js b/rollup.config.mjs similarity index 75% rename from rollup.config.js rename to rollup.config.mjs index 6f0d251..3fe3998 100644 --- a/rollup.config.js +++ b/rollup.config.mjs @@ -1,3 +1,4 @@ +/* eslint-disable import/no-extraneous-dependencies */ import resolve from '@rollup/plugin-node-resolve'; import cjs from '@rollup/plugin-commonjs'; import ts from '@rollup/plugin-typescript'; @@ -17,6 +18,24 @@ export default [ file: 'dist/tsdav.esm.js', format: 'es', }, + { + file: 'dist/tsdav.cjs', + format: 'cjs', + }, + { + file: 'dist/tsdav.mjs', + format: 'es', + }, + { + file: 'dist/tsdav.min.cjs', + format: 'cjs', + plugins: [terser()], + }, + { + file: 'dist/tsdav.min.mjs', + format: 'es', + plugins: [terser()], + }, ], plugins: [ ts({ diff --git a/src/addressBook.ts b/src/addressBook.ts index 3d94110..747c741 100644 --- a/src/addressBook.ts +++ b/src/addressBook.ts @@ -117,8 +117,9 @@ export const fetchVCards = async (params: { headers?: Record; objectUrls?: string[]; urlFilter?: (url: string) => boolean; + useMultiGet?: boolean; }): Promise => { - const { addressBook, headers, objectUrls, urlFilter } = params; + const { addressBook, headers, objectUrls, urlFilter = (url) => url, useMultiGet = true } = params; debug(`Fetching vcards from ${addressBook?.url}`); const requiredFields: Array<'url'> = ['url']; if (!addressBook || !hasFields(addressBook, requiredFields)) { @@ -146,22 +147,34 @@ export const fetchVCards = async (params: { ).map((res) => (res.ok ? res.href ?? '' : '')) ) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, addressBook.url).href)) - .filter(urlFilter ?? ((url) => url)) + .filter(urlFilter) .map((url) => new URL(url).pathname); - const vCardResults = - vcardUrls.length > 0 - ? await addressBookMultiGet({ - url: addressBook.url, - props: { - [`${DAVNamespaceShort.DAV}:getetag`]: {}, - [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, - }, - objectUrls: vcardUrls, - depth: '1', - headers, - }) - : []; + let vCardResults: DAVResponse[] = []; + if (vcardUrls.length > 0) { + if (useMultiGet) { + vCardResults = await addressBookMultiGet({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + objectUrls: vcardUrls, + depth: '1', + headers, + }); + } else { + vCardResults = await addressBookQuery({ + url: addressBook.url, + props: { + [`${DAVNamespaceShort.DAV}:getetag`]: {}, + [`${DAVNamespaceShort.CARDDAV}:address-data`]: {}, + }, + depth: '1', + headers, + }); + } + } return vCardResults.map((res) => ({ url: new URL(res.href ?? '', addressBook.url).href, diff --git a/src/calendar.ts b/src/calendar.ts index ca7351d..c00a3e8 100644 --- a/src/calendar.ts +++ b/src/calendar.ts @@ -176,6 +176,7 @@ export const fetchCalendarObjects = async (params: { expand?: boolean; urlFilter?: (url: string) => boolean; headers?: Record; + useMultiGet?: boolean; }): Promise => { const { calendar, @@ -184,7 +185,8 @@ export const fetchCalendarObjects = async (params: { timeRange, headers, expand, - urlFilter, + urlFilter = (url: string) => Boolean(url?.includes('.ics')), + useMultiGet = true, } = params; if (timeRange) { @@ -277,13 +279,13 @@ export const fetchCalendarObjects = async (params: { ).map((res) => res.href ?? '') ) .map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full - .filter(urlFilter ?? ((url: string) => Boolean(url?.includes('.ics')))) // filter out non ics calendar objects since apple calendar might have those + .filter(urlFilter) // custom filter function on calendar objects .map((url) => new URL(url).pathname); // obtain pathname of the url let calendarObjectResults: DAVResponse[] = []; if (calendarObjectUrls.length > 0) { - if (expand) { + if (!useMultiGet || expand) { calendarObjectResults = await calendarQuery({ url: calendar.url, props: { diff --git a/src/request.ts b/src/request.ts index 0098a6d..a7c86f7 100644 --- a/src/request.ts +++ b/src/request.ts @@ -27,7 +27,7 @@ export const davRequest = async (params: { parseOutgoing?: boolean; }): Promise => { const { url, init, convertIncoming = true, parseOutgoing = true } = params; - const { headers, body, namespace, method, attributes } = init; + const { headers = {}, body, namespace, method, attributes } = init; const xmlBody = convertIncoming ? convert.js2xml( { diff --git a/src/util/requestHelpers.ts b/src/util/requestHelpers.ts index 9a034e3..e3119a2 100644 --- a/src/util/requestHelpers.ts +++ b/src/util/requestHelpers.ts @@ -41,7 +41,7 @@ export const urlContains = (urlA?: string, urlB?: string): boolean => { export const getDAVAttribute = (nsArr: DAVNamespace[]): { [key: string]: DAVNamespace } => nsArr.reduce((prev, curr) => ({ ...prev, [DAVAttributeMap[curr]]: curr }), {}); -export const cleanupFalsy = (obj: T): NoUndefinedField => +export const cleanupFalsy = (obj: T): NoUndefinedField => Object.entries(obj).reduce((prev, [key, value]) => { if (value) return { ...prev, [key]: value }; return prev; diff --git a/tsconfig.json b/tsconfig.json index 1be2b43..a0c9e8b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,6 @@ }, "outDir": "./dist" }, - "include": ["src/**/*", "env.d.ts", "rollup.config.js"], + "include": ["src/**/*", "env.d.ts", "rollup.config.mjs"], "exclude": ["node_modules"] } diff --git a/yarn.lock b/yarn.lock index ed98a0b..2e0d439 100644 --- a/yarn.lock +++ b/yarn.lock @@ -257,6 +257,11 @@ resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz#5ac822ce97eec46741ab70a517971e443a70c5a9" integrity sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ== +"@babel/helper-plugin-utils@^7.20.2": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56" + integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg== + "@babel/helper-simple-access@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz#d656654b9ea08dbb9659b69d61063ccd343ff0f7" @@ -426,6 +431,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-jsx@^7.7.2": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.21.4.tgz#f264ed7bf40ffc9ec239edabc17a50c4f5b6fea2" + integrity sha512-5hewiLct5OKyh6PLKEYaFclcqtIgCb6bmELouxjF6up5q3Sov7rOayW4RwhbaBL0dit8rA80GNfY+UuDp2mBbQ== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" @@ -585,35 +597,69 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@eslint/eslintrc@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.0.tgz#29f92c30bb3e771e4a2048c95fa6855392dfac4f" - integrity sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw== +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== + +"@eslint/eslintrc@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.3.tgz#4910db5505f4d503f27774bf356e3704818a0331" + integrity sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.3.2" - globals "^13.15.0" + espree "^9.5.2" + globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" js-yaml "^4.1.0" minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@humanwhocodes/config-array@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.2.tgz#68be55c737023009dfc5fe245d51181bb6476914" - integrity sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA== +"@eslint/js@8.43.0": + version "8.43.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.43.0.tgz#559ca3d9ddbd6bf907ad524320a0d14b85586af0" + integrity sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg== + +"@humanwhocodes/config-array@^0.11.10": + version "0.11.10" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" + integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" - minimatch "^3.0.4" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== "@humanwhocodes/object-schema@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -630,110 +676,110 @@ resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^28.1.1": - version "28.1.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-28.1.1.tgz#305f8ca50b6e70413839f54c0e002b60a0f2fd7d" - integrity sha512-0RiUocPVFEm3WRMOStIHbRWllG6iW6E3/gUPnf4lkrVFyXIIDeCe+vlKeYyFOMhB2EPE6FLFCNADSOOQMaqvyA== +"@jest/console@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.5.0.tgz#593a6c5c0d3f75689835f1b3b4688c4f8544cb57" + integrity sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ== dependencies: - "@jest/types" "^28.1.1" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^28.1.1" - jest-util "^28.1.1" + jest-message-util "^29.5.0" + jest-util "^29.5.0" slash "^3.0.0" -"@jest/core@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-28.1.2.tgz#eac519b9acbd154313854b8823a47b5c645f785a" - integrity sha512-Xo4E+Sb/nZODMGOPt2G3cMmCBqL4/W2Ijwr7/mrXlq4jdJwcFQ/9KrrJZT2adQRk2otVBXXOz1GRQ4Z5iOgvRQ== +"@jest/core@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.5.0.tgz#76674b96904484e8214614d17261cc491e5f1f03" + integrity sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ== dependencies: - "@jest/console" "^28.1.1" - "@jest/reporters" "^28.1.2" - "@jest/test-result" "^28.1.1" - "@jest/transform" "^28.1.2" - "@jest/types" "^28.1.1" + "@jest/console" "^29.5.0" + "@jest/reporters" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" - jest-changed-files "^28.0.2" - jest-config "^28.1.2" - jest-haste-map "^28.1.1" - jest-message-util "^28.1.1" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.1" - jest-resolve-dependencies "^28.1.2" - jest-runner "^28.1.2" - jest-runtime "^28.1.2" - jest-snapshot "^28.1.2" - jest-util "^28.1.1" - jest-validate "^28.1.1" - jest-watcher "^28.1.1" + jest-changed-files "^29.5.0" + jest-config "^29.5.0" + jest-haste-map "^29.5.0" + jest-message-util "^29.5.0" + jest-regex-util "^29.4.3" + jest-resolve "^29.5.0" + jest-resolve-dependencies "^29.5.0" + jest-runner "^29.5.0" + jest-runtime "^29.5.0" + jest-snapshot "^29.5.0" + jest-util "^29.5.0" + jest-validate "^29.5.0" + jest-watcher "^29.5.0" micromatch "^4.0.4" - pretty-format "^28.1.1" - rimraf "^3.0.0" + pretty-format "^29.5.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-28.1.2.tgz#94a052c0c5f9f8c8e6d13ea6da78dbc5d7d9b85b" - integrity sha512-I0CR1RUMmOzd0tRpz10oUfaChBWs+/Hrvn5xYhMEF/ZqrDaaeHwS8yDBqEWCrEnkH2g+WE/6g90oBv3nKpcm8Q== +"@jest/environment@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.5.0.tgz#9152d56317c1fdb1af389c46640ba74ef0bb4c65" + integrity sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ== dependencies: - "@jest/fake-timers" "^28.1.2" - "@jest/types" "^28.1.1" + "@jest/fake-timers" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" - jest-mock "^28.1.1" + jest-mock "^29.5.0" -"@jest/expect-utils@^28.1.1": - version "28.1.1" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-28.1.1.tgz#d84c346025b9f6f3886d02c48a6177e2b0360587" - integrity sha512-n/ghlvdhCdMI/hTcnn4qV57kQuV9OTsZzH1TTCVARANKhl6hXJqLKUkwX69ftMGpsbpt96SsDD8n8LD2d9+FRw== +"@jest/expect-utils@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.5.0.tgz#f74fad6b6e20f924582dc8ecbf2cb800fe43a036" + integrity sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg== dependencies: - jest-get-type "^28.0.2" + jest-get-type "^29.4.3" -"@jest/expect@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-28.1.2.tgz#0b25acedff46e1e1e5606285306c8a399c12534f" - integrity sha512-HBzyZBeFBiOelNbBKN0pilWbbrGvwDUwAqMC46NVJmWm8AVkuE58NbG1s7DR4cxFt4U5cVLxofAoHxgvC5MyOw== +"@jest/expect@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.5.0.tgz#80952f5316b23c483fbca4363ce822af79c38fba" + integrity sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g== dependencies: - expect "^28.1.1" - jest-snapshot "^28.1.2" + expect "^29.5.0" + jest-snapshot "^29.5.0" -"@jest/fake-timers@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-28.1.2.tgz#d49e8ee4e02ba85a6e844a52a5e7c59c23e3b76f" - integrity sha512-xSYEI7Y0D5FbZN2LsCUj/EKRR1zfQYmGuAUVh6xTqhx7V5JhjgMcK5Pa0iR6WIk0GXiHDe0Ke4A+yERKE9saqg== +"@jest/fake-timers@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.5.0.tgz#d4d09ec3286b3d90c60bdcd66ed28d35f1b4dc2c" + integrity sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg== dependencies: - "@jest/types" "^28.1.1" - "@sinonjs/fake-timers" "^9.1.2" + "@jest/types" "^29.5.0" + "@sinonjs/fake-timers" "^10.0.2" "@types/node" "*" - jest-message-util "^28.1.1" - jest-mock "^28.1.1" - jest-util "^28.1.1" + jest-message-util "^29.5.0" + jest-mock "^29.5.0" + jest-util "^29.5.0" -"@jest/globals@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-28.1.2.tgz#92fab296e337c7309c25e4202fb724f62249d83f" - integrity sha512-cz0lkJVDOtDaYhvT3Fv2U1B6FtBnV+OpEyJCzTHM1fdoTsU4QNLAt/H4RkiwEUU+dL4g/MFsoTuHeT2pvbo4Hg== +"@jest/globals@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.5.0.tgz#6166c0bfc374c58268677539d0c181f9c1833298" + integrity sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ== dependencies: - "@jest/environment" "^28.1.2" - "@jest/expect" "^28.1.2" - "@jest/types" "^28.1.1" + "@jest/environment" "^29.5.0" + "@jest/expect" "^29.5.0" + "@jest/types" "^29.5.0" + jest-mock "^29.5.0" -"@jest/reporters@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-28.1.2.tgz#0327be4ce4d0d9ae49e7908656f89669d0c2a260" - integrity sha512-/whGLhiwAqeCTmQEouSigUZJPVl7sW8V26EiboImL+UyXznnr1a03/YZ2BX8OlFw0n+Zlwu+EZAITZtaeRTxyA== +"@jest/reporters@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.5.0.tgz#985dfd91290cd78ddae4914ba7921bcbabe8ac9b" + integrity sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^28.1.1" - "@jest/test-result" "^28.1.1" - "@jest/transform" "^28.1.2" - "@jest/types" "^28.1.1" - "@jridgewell/trace-mapping" "^0.3.13" + "@jest/console" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" + "@jridgewell/trace-mapping" "^0.3.15" "@types/node" "*" chalk "^4.0.0" collect-v8-coverage "^1.0.0" @@ -745,78 +791,77 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.1.3" - jest-message-util "^28.1.1" - jest-util "^28.1.1" - jest-worker "^28.1.1" + jest-message-util "^29.5.0" + jest-util "^29.5.0" + jest-worker "^29.5.0" slash "^3.0.0" string-length "^4.0.1" strip-ansi "^6.0.0" - terminal-link "^2.0.0" v8-to-istanbul "^9.0.1" -"@jest/schemas@^28.0.2": - version "28.0.2" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.0.2.tgz#08c30df6a8d07eafea0aef9fb222c5e26d72e613" - integrity sha512-YVDJZjd4izeTDkij00vHHAymNXQ6WWsdChFRK86qck6Jpr3DCL5W3Is3vslviRlP+bLuMYRLbdp98amMvqudhA== +"@jest/schemas@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.3.tgz#39cf1b8469afc40b6f5a2baaa146e332c4151788" + integrity sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg== dependencies: - "@sinclair/typebox" "^0.23.3" + "@sinclair/typebox" "^0.25.16" -"@jest/source-map@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-28.1.2.tgz#7fe832b172b497d6663cdff6c13b0a920e139e24" - integrity sha512-cV8Lx3BeStJb8ipPHnqVw/IM2VCMWO3crWZzYodSIkxXnRcXJipCdx1JCK0K5MsJJouZQTH73mzf4vgxRaH9ww== +"@jest/source-map@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.4.3.tgz#ff8d05cbfff875d4a791ab679b4333df47951d20" + integrity sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w== dependencies: - "@jridgewell/trace-mapping" "^0.3.13" + "@jridgewell/trace-mapping" "^0.3.15" callsites "^3.0.0" graceful-fs "^4.2.9" -"@jest/test-result@^28.1.1": - version "28.1.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-28.1.1.tgz#c6f18d1bbb01aa88925dd687872a75f8414b317a" - integrity sha512-hPmkugBktqL6rRzwWAtp1JtYT4VHwv8OQ+9lE5Gymj6dHzubI/oJHMUpPOt8NrdVWSrz9S7bHjJUmv2ggFoUNQ== +"@jest/test-result@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.5.0.tgz#7c856a6ca84f45cc36926a4e9c6b57f1973f1408" + integrity sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ== dependencies: - "@jest/console" "^28.1.1" - "@jest/types" "^28.1.1" + "@jest/console" "^29.5.0" + "@jest/types" "^29.5.0" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^28.1.1": - version "28.1.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-28.1.1.tgz#f594ee2331df75000afe0d1ae3237630ecec732e" - integrity sha512-nuL+dNSVMcWB7OOtgb0EGH5AjO4UBCt68SLP08rwmC+iRhyuJWS9MtZ/MpipxFwKAlHFftbMsydXqWre8B0+XA== +"@jest/test-sequencer@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz#34d7d82d3081abd523dbddc038a3ddcb9f6d3cc4" + integrity sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ== dependencies: - "@jest/test-result" "^28.1.1" + "@jest/test-result" "^29.5.0" graceful-fs "^4.2.9" - jest-haste-map "^28.1.1" + jest-haste-map "^29.5.0" slash "^3.0.0" -"@jest/transform@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-28.1.2.tgz#b367962c53fd53821269bde050ce373e111327c1" - integrity sha512-3o+lKF6iweLeJFHBlMJysdaPbpoMmtbHEFsjzSv37HIq/wWt5ijTeO2Yf7MO5yyczCopD507cNwNLeX8Y/CuIg== +"@jest/transform@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.5.0.tgz#cf9c872d0965f0cbd32f1458aa44a2b1988b00f9" + integrity sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw== dependencies: "@babel/core" "^7.11.6" - "@jest/types" "^28.1.1" - "@jridgewell/trace-mapping" "^0.3.13" + "@jest/types" "^29.5.0" + "@jridgewell/trace-mapping" "^0.3.15" babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" - jest-haste-map "^28.1.1" - jest-regex-util "^28.0.2" - jest-util "^28.1.1" + jest-haste-map "^29.5.0" + jest-regex-util "^29.4.3" + jest-util "^29.5.0" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" - write-file-atomic "^4.0.1" + write-file-atomic "^4.0.2" -"@jest/types@^28.1.1": - version "28.1.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.1.tgz#d059bbc80e6da6eda9f081f293299348bd78ee0b" - integrity sha512-vRXVqSg1VhDnB8bWcmvLzmg0Bt9CRKVgHPXqYwvWMX3TvAjeO+nRuK6+VdTKCtWOvYlmkF/HqNAL/z+N3B53Kw== +"@jest/types@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.5.0.tgz#f59ef9b031ced83047c67032700d8c807d6e1593" + integrity sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog== dependencies: - "@jest/schemas" "^28.0.2" + "@jest/schemas" "^29.4.3" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" @@ -840,6 +885,11 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" +"@jridgewell/resolve-uri@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + "@jridgewell/resolve-uri@^3.0.3": version "3.0.8" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.8.tgz#687cc2bbf243f4e9a868ecf2262318e2658873a1" @@ -850,12 +900,17 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== -"@jridgewell/sourcemap-codec@^1.4.10": +"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": version "1.4.14" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.13", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/sourcemap-codec@^1.4.13": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.9": version "0.3.14" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" integrity sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ== @@ -863,6 +918,14 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@jridgewell/trace-mapping@^0.3.15": + version "0.3.18" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" + integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -876,7 +939,7 @@ resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.3": +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -884,75 +947,79 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@rollup/plugin-commonjs@22.0.1": - version "22.0.1" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-22.0.1.tgz#f7cb777d20de3eeeaf994f39080115c336bef810" - integrity sha512-dGfEZvdjDHObBiP5IvwTKMVeq/tBZGMBHZFMdIV1ClMM/YoWS34xrHFGfag9SN2ZtMgNZRFruqvxZQEa70O6nQ== +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + +"@rollup/plugin-commonjs@25.0.1": + version "25.0.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.1.tgz#da984ea47f4450bb830fc1601bda130cfd603eb1" + integrity sha512-2DJ4kv4b1xfTJopWhu61ANdNRHvzQZ2fpaIrlgaP2jOfUv1wDJ0Ucqy8AZlbFmn/iUjiwKoqki9j55Y6L8kyNQ== dependencies: - "@rollup/pluginutils" "^3.1.0" + "@rollup/pluginutils" "^5.0.1" commondir "^1.0.1" - estree-walker "^2.0.1" - glob "^7.1.6" - is-reference "^1.2.1" - magic-string "^0.25.7" - resolve "^1.17.0" + estree-walker "^2.0.2" + glob "^8.0.3" + is-reference "1.2.1" + magic-string "^0.27.0" -"@rollup/plugin-inject@^4.0.0": - version "4.0.3" - resolved "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-4.0.3.tgz#6f04ebc14790a8bf892286fe9b8c0eb1ddf4d5ce" - integrity sha512-lzMXmj0LZjd67MI+M8H9dk/oCxR0TYqYAdZ6ZOejWQLSUtud+FUPu4NCMAO8KyWWAalFo8ean7yFHCMvCNsCZw== +"@rollup/plugin-inject@^5.0.1": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-5.0.3.tgz#0783711efd93a9547d52971db73b2fb6140a67b1" + integrity sha512-411QlbL+z2yXpRWFXSmw/teQRMkXcAAC8aYTemc15gwJRpvEVDQwoe+N/HTFD8RFG8+88Bme9DK2V9CVm7hJdA== dependencies: - "@rollup/pluginutils" "^3.1.0" - estree-walker "^2.0.1" - magic-string "^0.25.7" + "@rollup/pluginutils" "^5.0.1" + estree-walker "^2.0.2" + magic-string "^0.27.0" -"@rollup/plugin-node-resolve@13.1.3": - version "13.1.3" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.1.3.tgz#2ed277fb3ad98745424c1d2ba152484508a92d79" - integrity sha512-BdxNk+LtmElRo5d06MGY4zoepyrXX1tkzX2hrnPEZ53k78GuOMWLqmJDGIIOPwVRIFZrLQOo+Yr6KtCuLIA0AQ== +"@rollup/plugin-node-resolve@15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.1.0.tgz#9ffcd8e8c457080dba89bb9fcb583a6778dc757e" + integrity sha512-xeZHCgsiZ9pzYVgAo9580eCGqwh/XCEUM9q6iQfGNocjgkufHAqC3exA+45URvhiYV8sBF9RlBai650eNs7AsA== dependencies: - "@rollup/pluginutils" "^3.1.0" - "@types/resolve" "1.17.1" - builtin-modules "^3.1.0" + "@rollup/pluginutils" "^5.0.1" + "@types/resolve" "1.20.2" deepmerge "^4.2.2" + is-builtin-module "^3.2.1" is-module "^1.0.0" - resolve "^1.19.0" + resolve "^1.22.1" -"@rollup/plugin-typescript@8.3.3": - version "8.3.3" - resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.3.3.tgz#eee7edab9cfc064f1cfd16570492693cf1432215" - integrity sha512-55L9SyiYu3r/JtqdjhwcwaECXP7JeJ9h1Sg1VWRJKIutla2MdZQodTgcCNybXLMCnqpNLEhS2vGENww98L1npg== +"@rollup/plugin-typescript@11.1.1": + version "11.1.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-11.1.1.tgz#258663a7aa6b51390dd39ae6e5502f2c4b2807cb" + integrity sha512-Ioir+x5Bejv72Lx2Zbz3/qGg7tvGbxQZALCLoJaGrkNXak/19+vKgKYJYM3i/fJxvsb23I9FuFQ8CUBEfsmBRg== dependencies: - "@rollup/pluginutils" "^3.1.0" - resolve "^1.17.0" + "@rollup/pluginutils" "^5.0.1" + resolve "^1.22.1" -"@rollup/pluginutils@^3.1.0": - version "3.1.0" - resolved "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" - integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== +"@rollup/pluginutils@^5.0.1": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33" + integrity sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA== dependencies: - "@types/estree" "0.0.39" - estree-walker "^1.0.1" - picomatch "^2.2.2" + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" -"@sinclair/typebox@^0.23.3": - version "0.23.5" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.23.5.tgz#93f7b9f4e3285a7a9ade7557d9a8d36809cbc47d" - integrity sha512-AFBVi/iT4g20DHoujvMH1aEDn8fGJh4xsRGCP6d8RpLPMqsNPvW01Jcn0QysXTsg++/xj25NmJsGyH9xug/wKg== +"@sinclair/typebox@^0.25.16": + version "0.25.24" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" + integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ== -"@sinonjs/commons@^1.7.0": - version "1.8.3" - resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" - integrity sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== +"@sinonjs/commons@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-2.0.0.tgz#fd4ca5b063554307e8327b4564bd56d3b73924a3" + integrity sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg== dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz#4eaab737fab77332ab132d396a3c0d364bd0ea8c" - integrity sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw== +"@sinonjs/fake-timers@^10.0.2": + version "10.0.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz#d10549ed1f423d80639c528b6c7f5a1017747d0c" + integrity sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw== dependencies: - "@sinonjs/commons" "^1.7.0" + "@sinonjs/commons" "^2.0.0" "@types/babel__core@^7.1.14": version "7.1.15" @@ -992,10 +1059,10 @@ resolved "https://registry.yarnpkg.com/@types/base-64/-/base-64-1.0.0.tgz#de9c6070ea457fbd65a1b5ebf13976b3ac0bdad0" integrity sha512-AvCJx/HrfYHmOQRFdVvgKMplXfzTUizmh0tz9GFTpDePWgCY4uoKll84zKlaRoeiYiCr7c9ZnqSTzkl0BUVD6g== -"@types/debug@4.1.7": - version "4.1.7" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.7.tgz#7cc0ea761509124709b8b2d1090d8f6c17aadb82" - integrity sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg== +"@types/debug@4.1.8": + version "4.1.8" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.8.tgz#cef723a5d0a90990313faec2d1e22aee5eecb317" + integrity sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ== dependencies: "@types/ms" "*" @@ -1004,18 +1071,10 @@ resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83" integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== -"@types/estree@0.0.39": - version "0.0.39" - resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" - integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== - -"@types/glob@^7.1.1": - version "7.1.4" - resolved "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz#ea59e21d2ee5c517914cb4bc8e4153b99e566672" - integrity sha512-w+LsMxKyYQm347Otw+IfBXOv9UWVjpHpCDdbBMt8Kz/xbvCYNjP+0qPh91Km3iKfSRLBB0P7fAMf0KHrPu+MyA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" +"@types/estree@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194" + integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA== "@types/graceful-fs@^4.1.3": version "4.1.5" @@ -1043,13 +1102,13 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@28.1.4": - version "28.1.4" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-28.1.4.tgz#a11ee6c8fd0b52c19c9c18138b78bbcc201dad5a" - integrity sha512-telv6G5N7zRJiLcI3Rs3o+ipZ28EnE+7EvF0pSrt2pZOMnAVI/f+6/LucDxOvcBcTeTL3JMF744BbVQAVBUQRA== +"@types/jest@29.5.2": + version "29.5.2" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.2.tgz#86b4afc86e3a8f3005b297ed8a72494f89e6395b" + integrity sha512-mSoZVJF5YzGVCk+FsDxzDuH7s+SCkzrgKZzf0Z0T2WudhBUPoF6ktoTPC4R0ZoCPCV5xUvuU6ias5NvxcBcMMg== dependencies: - jest-matcher-utils "^28.0.0" - pretty-format "^28.0.0" + expect "^29.0.0" + pretty-format "^29.0.0" "@types/json-schema@^7.0.9": version "7.0.9" @@ -1061,11 +1120,6 @@ resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= -"@types/minimatch@*": - version "3.0.5" - resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" - integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== - "@types/ms@*": version "0.7.31" resolved "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" @@ -1076,22 +1130,25 @@ resolved "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz#c6b9198178da504dfca1fd0be9b2e1002f1586f0" integrity sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A== -"@types/node@18.0.0": - version "18.0.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.0.tgz#67c7b724e1bcdd7a8821ce0d5ee184d3b4dd525a" - integrity sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA== +"@types/node@20.3.1": + version "20.3.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.1.tgz#e8a83f1aa8b649377bb1fb5d7bac5cb90e784dfe" + integrity sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg== "@types/prettier@^2.1.5": version "2.3.2" resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.3.2.tgz#fc8c2825e4ed2142473b4a81064e6e081463d1b3" integrity sha512-eI5Yrz3Qv4KPUa/nSIAi0h+qX0XyewOliug5F2QAtuRg6Kjg6jfmxe1GIwoIRhZspD1A0RP8ANrPwvEXXtRFog== -"@types/resolve@1.17.1": - version "1.17.1" - resolved "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" - integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== - dependencies: - "@types/node" "*" +"@types/resolve@1.20.2": + version "1.20.2" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" + integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== + +"@types/semver@^7.3.12": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" + integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== "@types/stack-utils@^2.0.0": version "2.0.1" @@ -1110,118 +1167,88 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@5.30.3": - version "5.30.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.3.tgz#2f293e56b73c4f281e48d253af4a17f21a55d54c" - integrity sha512-QEgE1uahnDbWEkZlidq7uKB630ny1NN8KbLPmznX+8hYsYpoV1/quG1Nzvs141FVuumuS7O0EpqYw3RB4AVzRg== +"@typescript-eslint/eslint-plugin@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.11.tgz#8d466aa21abea4c3f37129997b198d141f09e76f" + integrity sha512-XxuOfTkCUiOSyBWIvHlUraLw/JT/6Io1365RO6ZuI88STKMavJZPNMU0lFcUTeQXEhHiv64CbxYxBNoDVSmghg== dependencies: - "@typescript-eslint/scope-manager" "5.30.3" - "@typescript-eslint/type-utils" "5.30.3" - "@typescript-eslint/utils" "5.30.3" + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/type-utils" "5.59.11" + "@typescript-eslint/utils" "5.59.11" debug "^4.3.4" - functional-red-black-tree "^1.0.1" + grapheme-splitter "^1.0.4" ignore "^5.2.0" - regexpp "^3.2.0" + natural-compare-lite "^1.4.0" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@5.18.0": - version "5.18.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.18.0.tgz#2bcd4ff21df33621df33e942ccb21cb897f004c6" - integrity sha512-+08nYfurBzSSPndngnHvFw/fniWYJ5ymOrn/63oMIbgomVQOvIDhBoJmYZ9lwQOCnQV9xHGvf88ze3jFGUYooQ== - dependencies: - "@typescript-eslint/scope-manager" "5.18.0" - "@typescript-eslint/types" "5.18.0" - "@typescript-eslint/typescript-estree" "5.18.0" - debug "^4.3.2" - -"@typescript-eslint/scope-manager@5.18.0": - version "5.18.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.18.0.tgz#a7d7b49b973ba8cebf2a3710eefd457ef2fb5505" - integrity sha512-C0CZML6NyRDj+ZbMqh9FnPscg2PrzSaVQg3IpTmpe0NURMVBXlghGZgMYqBw07YW73i0MCqSDqv2SbywnCS8jQ== +"@typescript-eslint/parser@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.11.tgz#af7d4b7110e3068ce0b97550736de455e4250103" + integrity sha512-s9ZF3M+Nym6CAZEkJJeO2TFHHDsKAM3ecNkLuH4i4s8/RCPnF5JRip2GyviYkeEAcwGMJxkqG9h2dAsnA1nZpA== dependencies: - "@typescript-eslint/types" "5.18.0" - "@typescript-eslint/visitor-keys" "5.18.0" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/typescript-estree" "5.59.11" + debug "^4.3.4" -"@typescript-eslint/scope-manager@5.30.3": - version "5.30.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.30.3.tgz#de7edb0b59efd71975a82cbf3f1b97c5c90769f0" - integrity sha512-yVJIIUXeo/vv6Alj6lKBvsqnRs5hcxUpN3Dg3aD9Zv6r7p6Nn106jJcr5rnpRHAReEb/aMI2RWrt3JmL17eCVA== +"@typescript-eslint/scope-manager@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz#5d131a67a19189c42598af9fb2ea1165252001ce" + integrity sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q== dependencies: - "@typescript-eslint/types" "5.30.3" - "@typescript-eslint/visitor-keys" "5.30.3" + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/visitor-keys" "5.59.11" -"@typescript-eslint/type-utils@5.30.3": - version "5.30.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.30.3.tgz#1bb4efcfc8de38086d50096709b2cccf72684515" - integrity sha512-IIzakE7OXOqdwPaXhRiPnaZ8OuJJYBLufOffd9fqzkI4IMFIYq8KC7bghdnF7QUJTirURRErQFrJ/w5UpwIqaw== +"@typescript-eslint/type-utils@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.11.tgz#5eb67121808a84cb57d65a15f48f5bdda25f2346" + integrity sha512-LZqVY8hMiVRF2a7/swmkStMYSoXMFlzL6sXV6U/2gL5cwnLWQgLEG8tjWPpaE4rMIdZ6VKWwcffPlo1jPfk43g== dependencies: - "@typescript-eslint/utils" "5.30.3" + "@typescript-eslint/typescript-estree" "5.59.11" + "@typescript-eslint/utils" "5.59.11" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.18.0": - version "5.18.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.18.0.tgz#4f0425d85fdb863071680983853c59a62ce9566e" - integrity sha512-bhV1+XjM+9bHMTmXi46p1Led5NP6iqQcsOxgx7fvk6gGiV48c6IynY0apQb7693twJDsXiVzNXTflhplmaiJaw== - -"@typescript-eslint/types@5.30.3": - version "5.30.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.30.3.tgz#8ef6313dcec2e297b167dd25ef363e36857c49ff" - integrity sha512-vshU3pjSTgBPNgfd55JLYngHkXuwQP68fxYFUAg1Uq+JrR3xG/XjvL9Dmv28CpOERtqwkaR4QQ3mD0NLZcE2Xw== - -"@typescript-eslint/typescript-estree@5.18.0": - version "5.18.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.18.0.tgz#6498e5ee69a32e82b6e18689e2f72e4060986474" - integrity sha512-wa+2VAhOPpZs1bVij9e5gyVu60ReMi/KuOx4LKjGx2Y3XTNUDJgQ+5f77D49pHtqef/klglf+mibuHs9TrPxdQ== - dependencies: - "@typescript-eslint/types" "5.18.0" - "@typescript-eslint/visitor-keys" "5.18.0" - debug "^4.3.2" - globby "^11.0.4" - is-glob "^4.0.3" - semver "^7.3.5" - tsutils "^3.21.0" +"@typescript-eslint/types@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.11.tgz#1a9018fe3c565ba6969561f2a49f330cf1fe8db1" + integrity sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA== -"@typescript-eslint/typescript-estree@5.30.3": - version "5.30.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.3.tgz#d5ff918499dd56039864c157a898b1322d7bff8c" - integrity sha512-jqVh5N9AJx6+7yRgoA+ZelAFrHezgI9pzI9giv7s84DDOmtpFwTgURcpICDHyz9x6vAeOu91iACZ4dBTVfzIyA== +"@typescript-eslint/typescript-estree@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz#b2caaa31725e17c33970c1197bcd54e3c5f42b9f" + integrity sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA== dependencies: - "@typescript-eslint/types" "5.30.3" - "@typescript-eslint/visitor-keys" "5.30.3" + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/visitor-keys" "5.59.11" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.30.3": - version "5.30.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.30.3.tgz#be2ebaef73e5610c866c4f29ed33669acc89e3fc" - integrity sha512-OEaBXGxxdIy35H+jyXfYAMQ66KMJczK9hEhL3gR6IRbWe5PyK+bPDC9zbQNVII6rNFTfF/Mse0z21NlEU+vOMw== +"@typescript-eslint/utils@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.11.tgz#9dbff49dc80bfdd9289f9f33548f2e8db3c59ba1" + integrity sha512-didu2rHSOMUdJThLk4aZ1Or8IcO3HzCw/ZvEjTTIfjIrcdd5cvSIwwDy2AOlE7htSNp7QIZ10fLMyRCveesMLg== dependencies: + "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.30.3" - "@typescript-eslint/types" "5.30.3" - "@typescript-eslint/typescript-estree" "5.30.3" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/typescript-estree" "5.59.11" eslint-scope "^5.1.1" - eslint-utils "^3.0.0" - -"@typescript-eslint/visitor-keys@5.18.0": - version "5.18.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.18.0.tgz#c7c07709823804171d569017f3b031ced7253e60" - integrity sha512-Hf+t+dJsjAKpKSkg3EHvbtEpFFb/1CiOHnvI8bjHgOD4/wAw3gKrA0i94LrbekypiZVanJu3McWJg7rWDMzRTg== - dependencies: - "@typescript-eslint/types" "5.18.0" - eslint-visitor-keys "^3.0.0" + semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.30.3": - version "5.30.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.3.tgz#2c5f7a16c36748d1c51ea5a9c29bfb64780ce466" - integrity sha512-ep2xtHOhnSRt6fDP9DSSxrA/FqZhdMF7/Y9fYsxrKss2uWJMbzJyBJ/We1fKc786BJ10pHwrzUlhvpz8i7XzBg== +"@typescript-eslint/visitor-keys@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz#dca561ddad169dc27d62396d64f45b2d2c3ecc56" + integrity sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA== dependencies: - "@typescript-eslint/types" "5.30.3" + "@typescript-eslint/types" "5.59.11" eslint-visitor-keys "^3.3.0" abstract-leveldown@~0.12.0, abstract-leveldown@~0.12.1: @@ -1236,10 +1263,10 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn@^8.7.1: - version "8.7.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" - integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== +acorn@^8.8.0: + version "8.8.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" + integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" @@ -1268,6 +1295,11 @@ ansi-regex@^5.0.1: resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== +ansi-regex@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" + integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== + ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -1287,6 +1319,11 @@ ansi-styles@^5.0.0: resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +ansi-styles@^6.1.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + anymatch@^3.0.3: version "3.1.2" resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" @@ -1307,15 +1344,23 @@ argparse@^2.0.1: resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-includes@^3.1.4: - version "3.1.4" - resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz#f5b493162c760f3539631f005ba2bb46acb45ba9" - integrity sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw== +array-buffer-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" + integrity sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" - get-intrinsic "^1.1.1" + is-array-buffer "^3.0.1" + +array-includes@^3.1.6: + version "3.1.6" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.6.tgz#9e9e720e194f198266ba9e18c29e6a9b0e4b225f" + integrity sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" + get-intrinsic "^1.1.3" is-string "^1.0.7" array-union@^2.1.0: @@ -1323,14 +1368,25 @@ array-union@^2.1.0: resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -array.prototype.flat@^1.2.5: - version "1.2.5" - resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz#07e0975d84bbc7c48cd1879d609e682598d33e13" - integrity sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg== +array.prototype.flat@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz#ffc6576a7ca3efc2f46a143b9d1dda9b4b3cf5e2" + integrity sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.0" + define-properties "^1.1.4" + es-abstract "^1.20.4" + es-shim-unscopables "^1.0.0" + +array.prototype.flatmap@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz#1aae7903c2100433cb8261cd4ed310aab5c4a183" + integrity sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" + es-shim-unscopables "^1.0.0" asn1.js@^5.2.0: version "5.4.1" @@ -1342,15 +1398,20 @@ asn1.js@^5.2.0: minimalistic-assert "^1.0.0" safer-buffer "^2.1.0" -babel-jest@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-28.1.2.tgz#2b37fb81439f14d34d8b2cc4a4bd7efabf9acbfe" - integrity sha512-pfmoo6sh4L/+5/G2OOfQrGJgvH7fTa1oChnuYH2G/6gA+JwDvO8PELwvwnofKBMNrQsam0Wy/Rw+QSrBNewq2Q== +available-typed-arrays@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" + integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== + +babel-jest@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.5.0.tgz#3fe3ddb109198e78b1c88f9ebdecd5e4fc2f50a5" + integrity sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q== dependencies: - "@jest/transform" "^28.1.2" + "@jest/transform" "^29.5.0" "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^28.1.1" + babel-preset-jest "^29.5.0" chalk "^4.0.0" graceful-fs "^4.2.9" slash "^3.0.0" @@ -1366,10 +1427,10 @@ babel-plugin-istanbul@^6.1.1: istanbul-lib-instrument "^5.0.4" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-28.1.1.tgz#5e055cdcc47894f28341f87f5e35aad2df680b11" - integrity sha512-NovGCy5Hn25uMJSAU8FaHqzs13cFoOI4lhIujiepssjCKRsAo3TA734RDWSGxuFTsUJXerYOqQQodlxgmtqbzw== +babel-plugin-jest-hoist@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz#a97db437936f441ec196990c9738d4b88538618a" + integrity sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" @@ -1394,12 +1455,12 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" -babel-preset-jest@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-28.1.1.tgz#5b6e5e69f963eb2d70f739c607b8f723c0ee75e4" - integrity sha512-FCq9Oud0ReTeWtcneYf/48981aTfXYuB9gbU4rBNNJVBSQ6ssv7E6v/qvbBxtOWwZFXjLZwpg+W3q7J6vhH25g== +babel-preset-jest@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz#57bc8cc88097af7ff6a5ab59d1cd29d52a5916e2" + integrity sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg== dependencies: - babel-plugin-jest-hoist "^28.1.1" + babel-plugin-jest-hoist "^29.5.0" babel-preset-current-node-syntax "^1.0.0" balanced-match@^1.0.0: @@ -1437,6 +1498,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^3.0.1: version "3.0.2" resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" @@ -1562,10 +1630,10 @@ buffer-xor@^1.0.3: resolved "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= -builtin-modules@^3.1.0: - version "3.2.0" - resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" - integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA== +builtin-modules@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" + integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== call-bind@^1.0.0, call-bind@^1.0.2: version "1.0.2" @@ -1718,13 +1786,18 @@ confusing-browser-globals@^1.0.10: resolved "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz#30d1e7f3d1b882b25ec4933d1d1adac353d20a59" integrity sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA== -convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: +convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.8.0" resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== dependencies: safe-buffer "~5.1.1" +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + copyfiles@2.4.1: version "2.4.1" resolved "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz#d2dcff60aaad1015f09d0b66e7f0f1c5cd3c5da5" @@ -1781,14 +1854,14 @@ cross-env@7.0.3: dependencies: cross-spawn "^7.0.1" -cross-fetch@3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" - integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== +cross-fetch@3.1.6: + version "3.1.6" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.6.tgz#bae05aa31a4da760969756318feeee6e70f15d6c" + integrity sha512-riRvo06crlE8HiqOwIpQhxwdOk4fOeR7FVM/wXoxchFEqMNUjvbs3bfo4OTgMEMHzppd4DxFBDbyySj8Cv781g== dependencies: - node-fetch "2.6.7" + node-fetch "^2.6.11" -cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1821,13 +1894,6 @@ debug@4.3.4, debug@^4.3.4: dependencies: ms "2.1.2" -debug@^2.6.9: - version "2.6.9" - resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debug@^3.2.7: version "3.2.7" resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -1871,6 +1937,14 @@ define-properties@^1.1.3: dependencies: object-keys "^1.0.12" +define-properties@^1.1.4, define-properties@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.0.tgz#52988570670c9eacedd8064f4a990f2405849bd5" + integrity sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA== + dependencies: + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + des.js@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" @@ -1879,20 +1953,25 @@ des.js@^1.0.0: inherits "^2.0.1" minimalistic-assert "^1.0.0" -detect-indent@^6.0.0: - version "6.1.0" - resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" - integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== +detect-indent@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-7.0.1.tgz#cbb060a12842b9c4d333f1cac4aa4da1bb66bc25" + integrity sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g== -detect-newline@3.1.0, detect-newline@^3.0.0: +detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -diff-sequences@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" - integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== +detect-newline@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-4.0.0.tgz#450ac3f864d5f61112b53a524123b012c59581bc" + integrity sha512-1aXUEPdfGdzVPFpzGJJNgq9o81bGg1s09uxTWsqBlo9PI332uyJRQq13+LK/UN4JfxJbFdCXonUFQ9R/p7yCtw== + +diff-sequences@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" + integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA== diffie-hellman@^5.0.0: version "5.0.3" @@ -1924,10 +2003,15 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dotenv@16.0.1: - version "16.0.1" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.1.tgz#8f8f9d94876c35dac989876a5d3a82a267fdce1d" - integrity sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ== +dotenv@16.3.0: + version "16.3.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.0.tgz#1c61ae0a7b6f7b7e2285d50016ebab048f12ec6d" + integrity sha512-tHB+hmf8MRCkT3VVivGiG8kq9HiGTmQ3FzOKgztfpJQH1IWuZTOvKSJmHNnQPowecAmkCJhLrxdPhOr06LLqIQ== + +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== electron-to-chromium@^1.4.17: version "1.4.38" @@ -1952,16 +2036,21 @@ elliptic@^6.5.3: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" -emittery@^0.10.2: - version "0.10.2" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933" - integrity sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw== +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + errno@^0.1.1, errno@~0.1.1: version "0.1.8" resolved "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -2002,6 +2091,62 @@ es-abstract@^1.19.0, es-abstract@^1.19.1: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.1" +es-abstract@^1.20.4: + version "1.21.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.21.2.tgz#a56b9695322c8a185dc25975aa3b8ec31d0e7eff" + integrity sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg== + dependencies: + array-buffer-byte-length "^1.0.0" + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + es-set-tostringtag "^2.0.1" + es-to-primitive "^1.2.1" + function.prototype.name "^1.1.5" + get-intrinsic "^1.2.0" + get-symbol-description "^1.0.0" + globalthis "^1.0.3" + gopd "^1.0.1" + has "^1.0.3" + has-property-descriptors "^1.0.0" + has-proto "^1.0.1" + has-symbols "^1.0.3" + internal-slot "^1.0.5" + is-array-buffer "^3.0.2" + is-callable "^1.2.7" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-typed-array "^1.1.10" + is-weakref "^1.0.2" + object-inspect "^1.12.3" + object-keys "^1.1.1" + object.assign "^4.1.4" + regexp.prototype.flags "^1.4.3" + safe-regex-test "^1.0.0" + string.prototype.trim "^1.2.7" + string.prototype.trimend "^1.0.6" + string.prototype.trimstart "^1.0.6" + typed-array-length "^1.0.4" + unbox-primitive "^1.0.2" + which-typed-array "^1.1.9" + +es-set-tostringtag@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz#338d502f6f674301d710b80c8592de8a15f09cd8" + integrity sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg== + dependencies: + get-intrinsic "^1.1.3" + has "^1.0.3" + has-tostringtag "^1.0.0" + +es-shim-unscopables@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" + integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== + dependencies: + has "^1.0.3" + es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -2057,44 +2202,46 @@ eslint-config-airbnb@19.0.4: object.assign "^4.1.2" object.entries "^1.1.5" -eslint-config-prettier@8.5.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1" - integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q== +eslint-config-prettier@8.8.0: + version "8.8.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348" + integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA== -eslint-import-resolver-node@^0.3.6: - version "0.3.6" - resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" - integrity sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw== +eslint-import-resolver-node@^0.3.7: + version "0.3.7" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7" + integrity sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA== dependencies: debug "^3.2.7" - resolve "^1.20.0" + is-core-module "^2.11.0" + resolve "^1.22.1" -eslint-module-utils@2.7.3, eslint-module-utils@^2.7.3: - version "2.7.3" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz#ad7e3a10552fdd0642e1e55292781bd6e34876ee" - integrity sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ== +eslint-module-utils@2.8.0, eslint-module-utils@^2.7.4: + version "2.8.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz#e439fee65fc33f6bba630ff621efc38ec0375c49" + integrity sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw== dependencies: debug "^3.2.7" - find-up "^2.1.0" -eslint-plugin-import@2.26.0: - version "2.26.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b" - integrity sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA== +eslint-plugin-import@2.27.5: + version "2.27.5" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz#876a6d03f52608a3e5bb439c2550588e51dd6c65" + integrity sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow== dependencies: - array-includes "^3.1.4" - array.prototype.flat "^1.2.5" - debug "^2.6.9" + array-includes "^3.1.6" + array.prototype.flat "^1.3.1" + array.prototype.flatmap "^1.3.1" + debug "^3.2.7" doctrine "^2.1.0" - eslint-import-resolver-node "^0.3.6" - eslint-module-utils "^2.7.3" + eslint-import-resolver-node "^0.3.7" + eslint-module-utils "^2.7.4" has "^1.0.3" - is-core-module "^2.8.1" + is-core-module "^2.11.0" is-glob "^4.0.3" minimatch "^3.1.2" - object.values "^1.1.5" - resolve "^1.22.0" + object.values "^1.1.6" + resolve "^1.22.1" + semver "^6.3.0" tsconfig-paths "^3.14.1" eslint-plugin-prettier@4.2.1: @@ -2112,64 +2259,58 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - -eslint-visitor-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint-visitor-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186" - integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q== - eslint-visitor-keys@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@8.19.0: - version "8.19.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.19.0.tgz#7342a3cbc4fbc5c106a1eefe0fd0b50b6b1a7d28" - integrity sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw== - dependencies: - "@eslint/eslintrc" "^1.3.0" - "@humanwhocodes/config-array" "^0.9.2" +eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + +eslint@8.43.0: + version "8.43.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.43.0.tgz#3e8c6066a57097adfd9d390b8fc93075f257a094" + integrity sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.4.0" + "@eslint/eslintrc" "^2.0.3" + "@eslint/js" "8.43.0" + "@humanwhocodes/config-array" "^0.11.10" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-utils "^3.0.0" - eslint-visitor-keys "^3.3.0" - espree "^9.3.2" - esquery "^1.4.0" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.5.2" + esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^6.0.1" - globals "^13.15.0" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" + is-path-inside "^3.0.3" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" @@ -2177,30 +2318,28 @@ eslint@8.19.0: minimatch "^3.1.2" natural-compare "^1.4.0" optionator "^0.9.1" - regexpp "^3.2.0" strip-ansi "^6.0.1" strip-json-comments "^3.1.0" text-table "^0.2.0" - v8-compile-cache "^2.0.3" -espree@^9.3.2: - version "9.3.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.3.2.tgz#f58f77bd334731182801ced3380a8cc859091596" - integrity sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA== +espree@^9.5.2: + version "9.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.2.tgz#e994e7dc33a082a7a82dceaf12883a829353215b" + integrity sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw== dependencies: - acorn "^8.7.1" + acorn "^8.8.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.3.0" + eslint-visitor-keys "^3.4.1" esprima@^4.0.0: version "4.0.1" resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== dependencies: estraverse "^5.1.0" @@ -2221,14 +2360,9 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== -estree-walker@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" - integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== - -estree-walker@^2.0.1: +estree-walker@^2.0.2: version "2.0.2" - resolved "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== esutils@^2.0.2: @@ -2264,16 +2398,16 @@ exit@^0.1.2: resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= -expect@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-28.1.1.tgz#ca6fff65f6517cf7220c2e805a49c19aea30b420" - integrity sha512-/AANEwGL0tWBwzLNOvO0yUdy2D52jVdNXppOqswC49sxMN2cPWsGCQdzuIf9tj6hHoBQzNvx75JUYuQAckPo3w== +expect@^29.0.0, expect@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.5.0.tgz#68c0509156cb2a0adb8865d413b137eeaae682f7" + integrity sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg== dependencies: - "@jest/expect-utils" "^28.1.1" - jest-get-type "^28.0.2" - jest-matcher-utils "^28.1.1" - jest-message-util "^28.1.1" - jest-util "^28.1.1" + "@jest/expect-utils" "^29.5.0" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.5.0" + jest-message-util "^29.5.0" + jest-util "^29.5.0" fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" @@ -2285,10 +2419,10 @@ fast-diff@^1.1.2: resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== -fast-glob@^3.0.3, fast-glob@^3.1.1: - version "3.2.7" - resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" - integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== +fast-glob@^3.2.11: + version "3.2.12" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -2307,7 +2441,7 @@ fast-glob@^3.2.9: merge2 "^1.3.0" micromatch "^4.0.4" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -2345,13 +2479,6 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-up@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= - dependencies: - locate-path "^2.0.0" - find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -2360,6 +2487,14 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -2373,11 +2508,26 @@ flatted@^3.1.0: resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561" integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA== +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== + dependencies: + is-callable "^1.1.3" + foreach@~2.0.1: version "2.0.5" resolved "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= +foreground-child@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d" + integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -2393,10 +2543,20 @@ function-bind@^1.1.1: resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +function.prototype.name@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" + integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + functions-have-names "^1.2.2" + +functions-have-names@^1.2.2, functions-have-names@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== fwd-stream@^1.0.4: version "1.0.4" @@ -2424,6 +2584,15 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: has "^1.0.3" has-symbols "^1.0.1" +get-intrinsic@^1.1.3, get-intrinsic@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.0.tgz#7ad1dc0535f3a2904bba075772763e5051f6d05f" + integrity sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.3" + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" @@ -2442,10 +2611,10 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" -git-hooks-list@1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/git-hooks-list/-/git-hooks-list-1.0.3.tgz#be5baaf78203ce342f2f844a9d2b03dba1b45156" - integrity sha512-Y7wLWcrLUXwk2noSka166byGCvhMtDRpgHdzCno1UQv/n/Hegp++a2xBWJL1lJarnKD3SWaljD+0z1ztqxuKyQ== +git-hooks-list@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/git-hooks-list/-/git-hooks-list-3.1.0.tgz#386dc531dcc17474cf094743ff30987a3d3e70fc" + integrity sha512-LF8VeHeR7v+wAbXqfgRlTSX/1BJR9Q1vEMR8JAz1cEg6GX07+zyj3sAdDvYjj/xnlIfVuGgj4qBei1K3hKH+PA== glob-parent@^5.1.2: version "5.1.2" @@ -2454,14 +2623,25 @@ glob-parent@^5.1.2: dependencies: is-glob "^4.0.1" -glob-parent@^6.0.1: +glob-parent@^6.0.2: version "6.0.2" - resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: is-glob "^4.0.3" -glob@^7.0.5, glob@^7.1.6: +glob@^10.2.5: + version "10.2.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.2.7.tgz#9dd2828cd5bc7bd861e7738d91e7113dda41d7d8" + integrity sha512-jTKehsravOJo8IJxUGfZILnkvVJM/MOfHRs8QcXolVef2zNI9Tqyy5+SeuOAZd3upViEZQLyFpQhYiHLrMUNmA== + dependencies: + foreground-child "^3.1.0" + jackspeak "^2.0.3" + minimatch "^9.0.1" + minipass "^5.0.0 || ^6.0.2" + path-scurry "^1.7.0" + +glob@^7.0.5: version "7.2.0" resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== @@ -2485,43 +2665,35 @@ glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^8.0.3: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + globals@^11.1.0: version "11.12.0" resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globals@^13.15.0: - version "13.15.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.15.0.tgz#38113218c907d2f7e98658af246cef8b77e90bac" - integrity sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog== +globals@^13.19.0: + version "13.20.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" + integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== dependencies: type-fest "^0.20.2" -globby@10.0.0: - version "10.0.0" - resolved "https://registry.npmjs.org/globby/-/globby-10.0.0.tgz#abfcd0630037ae174a88590132c2f6804e291072" - integrity sha512-3LifW9M4joGZasyYPz2A1U74zbC/45fvpXUvO/9KbSa+VV0aGZarWkfdgKyR9sExNP0t0x0ss/UMJpNpcaTspw== - dependencies: - "@types/glob" "^7.1.1" - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.0.3" - glob "^7.1.3" - ignore "^5.1.1" - merge2 "^1.2.3" - slash "^3.0.0" - -globby@^11.0.4: - version "11.0.4" - resolved "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" - integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== +globalthis@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" + integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.1.1" - ignore "^5.1.4" - merge2 "^1.3.0" - slash "^3.0.0" + define-properties "^1.1.3" globby@^11.1.0: version "11.1.0" @@ -2535,16 +2707,49 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" +globby@^13.1.2: + version "13.1.4" + resolved "https://registry.yarnpkg.com/globby/-/globby-13.1.4.tgz#2f91c116066bcec152465ba36e5caa4a13c01317" + integrity sha512-iui/IiiW+QrJ1X1hKH5qwlMQyv34wJAYwH1vrf8b9kBA4sNiif3gKsMHa+BrdnOpEudWjpotfa7LrTzB1ERS/g== + dependencies: + dir-glob "^3.0.1" + fast-glob "^3.2.11" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^4.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + graceful-fs@^4.2.9: version "4.2.9" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96" integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ== +grapheme-splitter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" + integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== + +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + has-bigints@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== +has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -2555,11 +2760,28 @@ has-flag@^4.0.0: resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-property-descriptors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + dependencies: + get-intrinsic "^1.1.1" + +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + has-symbols@^1.0.1, has-symbols@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + has-tostringtag@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" @@ -2615,11 +2837,6 @@ idb-wrapper@^1.5.0: resolved "https://registry.npmjs.org/idb-wrapper/-/idb-wrapper-1.7.2.tgz#8251afd5e77fe95568b1c16152eb44b396767ea2" integrity sha512-zfNREywMuf0NzDo9mVsL0yegjsirJxHpKHvWcyRozIqQy89g0a3U+oBPOCN4cc0oCiOuYgZHimzaW/R46G1Mpg== -ignore@^5.1.1, ignore@^5.1.4: - version "5.1.8" - resolved "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" - integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== - ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" @@ -2673,6 +2890,24 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" +internal-slot@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.5.tgz#f2a2ee21f668f8627a4667f309dc0f4fb6674986" + integrity sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ== + dependencies: + get-intrinsic "^1.2.0" + has "^1.0.3" + side-channel "^1.0.4" + +is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" + integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.0" + is-typed-array "^1.1.10" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -2693,11 +2928,30 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" +is-builtin-module@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" + integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== + dependencies: + builtin-modules "^3.3.0" + +is-callable@^1.1.3, is-callable@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== + is-callable@^1.1.4, is-callable@^1.2.4: version "1.2.4" resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== +is-core-module@^2.11.0: + version "2.12.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.0.tgz#36ad62f6f73c8253fd6472517a12483cf03e7ec4" + integrity sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ== + dependencies: + has "^1.0.3" + is-core-module@^2.2.0: version "2.6.0" resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz#d7553b2526fe59b92ba3e40c8df757ec8a709e19" @@ -2705,13 +2959,6 @@ is-core-module@^2.2.0: dependencies: has "^1.0.3" -is-core-module@^2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.1.tgz#f59fdfca701d5879d0a6b100a40aa1560ce27211" - integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== - dependencies: - has "^1.0.3" - is-date-object@^1.0.1: version "1.0.5" resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" @@ -2758,6 +3005,11 @@ is-negative-zero@^2.0.1: resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== +is-negative-zero@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== + is-number-object@^1.0.4: version "1.0.6" resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz#6a7aaf838c7f0686a50b4553f7e54a96494e89f0" @@ -2775,14 +3027,19 @@ is-object@~0.1.2: resolved "https://registry.npmjs.org/is-object/-/is-object-0.1.2.tgz#00efbc08816c33cfc4ac8251d132e10dc65098d7" integrity sha1-AO+8CIFsM8/ErIJR0TLhDcZQmNc= -is-plain-obj@2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== -is-reference@^1.2.1: +is-plain-obj@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-4.1.0.tgz#d65025edec3657ce032fd7db63c97883eaed71f0" + integrity sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg== + +is-reference@1.2.1: version "1.2.1" - resolved "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== dependencies: "@types/estree" "*" @@ -2800,6 +3057,13 @@ is-shared-array-buffer@^1.0.1: resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6" integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== + dependencies: + call-bind "^1.0.2" + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -2819,6 +3083,17 @@ is-symbol@^1.0.2, is-symbol@^1.0.3: dependencies: has-symbols "^1.0.2" +is-typed-array@^1.1.10, is-typed-array@^1.1.9: + version "1.1.10" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.10.tgz#36a5b5cb4189b575d1a3e4b08536bfb485801e3f" + integrity sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + is-weakref@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz#842dba4ec17fa9ac9850df2d6efbc1737274f2a2" @@ -2826,6 +3101,13 @@ is-weakref@^1.0.1: dependencies: call-bind "^1.0.0" +is-weakref@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== + dependencies: + call-bind "^1.0.2" + is@~0.2.6: version "0.2.7" resolved "https://registry.npmjs.org/is/-/is-0.2.7.tgz#3b34a2c48f359972f35042849193ae7264b63562" @@ -2898,343 +3180,354 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jest-changed-files@^28.0.2: - version "28.0.2" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-28.0.2.tgz#7d7810660a5bd043af9e9cfbe4d58adb05e91531" - integrity sha512-QX9u+5I2s54ZnGoMEjiM2WeBvJR2J7w/8ZUmH2um/WLAuGAYFQcsVXY9+1YL6k0H/AGUdH8pXUAv6erDqEsvIA== +jackspeak@^2.0.3: + version "2.2.0" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.2.0.tgz#497cbaedc902ec3f31d5d61be804d2364ff9ddad" + integrity sha512-r5XBrqIJfwRIjRt/Xr5fv9Wh09qyhHfKnYddDlpM+ibRR20qrYActpCAgU6U+d53EOEjzkvxPMVHSlgR7leXrQ== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + +jest-changed-files@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.5.0.tgz#e88786dca8bf2aa899ec4af7644e16d9dcf9b23e" + integrity sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag== dependencies: execa "^5.0.0" - throat "^6.0.1" + p-limit "^3.1.0" -jest-circus@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-28.1.2.tgz#0d5a5623eccb244efe87d1edc365696e4fcf80ce" - integrity sha512-E2vdPIJG5/69EMpslFhaA46WkcrN74LI5V/cSJ59L7uS8UNoXbzTxmwhpi9XrIL3zqvMt5T0pl5k2l2u2GwBNQ== +jest-circus@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.5.0.tgz#b5926989449e75bff0d59944bae083c9d7fb7317" + integrity sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA== dependencies: - "@jest/environment" "^28.1.2" - "@jest/expect" "^28.1.2" - "@jest/test-result" "^28.1.1" - "@jest/types" "^28.1.1" + "@jest/environment" "^29.5.0" + "@jest/expect" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" dedent "^0.7.0" is-generator-fn "^2.0.0" - jest-each "^28.1.1" - jest-matcher-utils "^28.1.1" - jest-message-util "^28.1.1" - jest-runtime "^28.1.2" - jest-snapshot "^28.1.2" - jest-util "^28.1.1" - pretty-format "^28.1.1" + jest-each "^29.5.0" + jest-matcher-utils "^29.5.0" + jest-message-util "^29.5.0" + jest-runtime "^29.5.0" + jest-snapshot "^29.5.0" + jest-util "^29.5.0" + p-limit "^3.1.0" + pretty-format "^29.5.0" + pure-rand "^6.0.0" slash "^3.0.0" stack-utils "^2.0.3" - throat "^6.0.1" -jest-cli@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-28.1.2.tgz#b89012e5bad14135e71b1628b85475d3773a1bbc" - integrity sha512-l6eoi5Do/IJUXAFL9qRmDiFpBeEJAnjJb1dcd9i/VWfVWbp3mJhuH50dNtX67Ali4Ecvt4eBkWb4hXhPHkAZTw== +jest-cli@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.5.0.tgz#b34c20a6d35968f3ee47a7437ff8e53e086b4a67" + integrity sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw== dependencies: - "@jest/core" "^28.1.2" - "@jest/test-result" "^28.1.1" - "@jest/types" "^28.1.1" + "@jest/core" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/types" "^29.5.0" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.9" import-local "^3.0.2" - jest-config "^28.1.2" - jest-util "^28.1.1" - jest-validate "^28.1.1" + jest-config "^29.5.0" + jest-util "^29.5.0" + jest-validate "^29.5.0" prompts "^2.0.1" yargs "^17.3.1" -jest-config@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-28.1.2.tgz#ba00ad30caf62286c86e7c1099e915218a0ac8c6" - integrity sha512-g6EfeRqddVbjPVBVY4JWpUY4IvQoFRIZcv4V36QkqzE0IGhEC/VkugFeBMAeUE7PRgC8KJF0yvJNDeQRbamEVA== +jest-config@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.5.0.tgz#3cc972faec8c8aaea9ae158c694541b79f3748da" + integrity sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA== dependencies: "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^28.1.1" - "@jest/types" "^28.1.1" - babel-jest "^28.1.2" + "@jest/test-sequencer" "^29.5.0" + "@jest/types" "^29.5.0" + babel-jest "^29.5.0" chalk "^4.0.0" ci-info "^3.2.0" deepmerge "^4.2.2" glob "^7.1.3" graceful-fs "^4.2.9" - jest-circus "^28.1.2" - jest-environment-node "^28.1.2" - jest-get-type "^28.0.2" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.1" - jest-runner "^28.1.2" - jest-util "^28.1.1" - jest-validate "^28.1.1" + jest-circus "^29.5.0" + jest-environment-node "^29.5.0" + jest-get-type "^29.4.3" + jest-regex-util "^29.4.3" + jest-resolve "^29.5.0" + jest-runner "^29.5.0" + jest-util "^29.5.0" + jest-validate "^29.5.0" micromatch "^4.0.4" parse-json "^5.2.0" - pretty-format "^28.1.1" + pretty-format "^29.5.0" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-28.1.1.tgz#1a3eedfd81ae79810931c63a1d0f201b9120106c" - integrity sha512-/MUUxeR2fHbqHoMMiffe/Afm+U8U4olFRJ0hiVG2lZatPJcnGxx292ustVu7bULhjV65IYMxRdploAKLbcrsyg== +jest-diff@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.5.0.tgz#e0d83a58eb5451dcc1fa61b1c3ee4e8f5a290d63" + integrity sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw== dependencies: chalk "^4.0.0" - diff-sequences "^28.1.1" - jest-get-type "^28.0.2" - pretty-format "^28.1.1" + diff-sequences "^29.4.3" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" -jest-docblock@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-28.1.1.tgz#6f515c3bf841516d82ecd57a62eed9204c2f42a8" - integrity sha512-3wayBVNiOYx0cwAbl9rwm5kKFP8yHH3d/fkEaL02NPTkDojPtheGB7HZSFY4wzX+DxyrvhXz0KSCVksmCknCuA== +jest-docblock@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.4.3.tgz#90505aa89514a1c7dceeac1123df79e414636ea8" + integrity sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg== dependencies: detect-newline "^3.0.0" -jest-each@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-28.1.1.tgz#ba5238dacf4f31d9fe23ddc2c44c01e7c23885c4" - integrity sha512-A042rqh17ZvEhRceDMi784ppoXR7MWGDEKTXEZXb4svt0eShMZvijGxzKsx+yIjeE8QYmHPrnHiTSQVhN4nqaw== +jest-each@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.5.0.tgz#fc6e7014f83eac68e22b7195598de8554c2e5c06" + integrity sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA== dependencies: - "@jest/types" "^28.1.1" + "@jest/types" "^29.5.0" chalk "^4.0.0" - jest-get-type "^28.0.2" - jest-util "^28.1.1" - pretty-format "^28.1.1" - -jest-environment-node@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-28.1.2.tgz#3e2eb47f6d173b0648d5f7c717cb1c26651d5c8a" - integrity sha512-oYsZz9Qw27XKmOgTtnl0jW7VplJkN2oeof+SwAwKFQacq3CLlG9u4kTGuuLWfvu3J7bVutWlrbEQMOCL/jughw== - dependencies: - "@jest/environment" "^28.1.2" - "@jest/fake-timers" "^28.1.2" - "@jest/types" "^28.1.1" + jest-get-type "^29.4.3" + jest-util "^29.5.0" + pretty-format "^29.5.0" + +jest-environment-node@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.5.0.tgz#f17219d0f0cc0e68e0727c58b792c040e332c967" + integrity sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw== + dependencies: + "@jest/environment" "^29.5.0" + "@jest/fake-timers" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" - jest-mock "^28.1.1" - jest-util "^28.1.1" + jest-mock "^29.5.0" + jest-util "^29.5.0" -jest-get-type@^28.0.2: - version "28.0.2" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" - integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== +jest-get-type@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5" + integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg== -jest-haste-map@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-28.1.1.tgz#471685f1acd365a9394745bb97c8fc16289adca3" - integrity sha512-ZrRSE2o3Ezh7sb1KmeLEZRZ4mgufbrMwolcFHNRSjKZhpLa8TdooXOOFlSwoUzlbVs1t0l7upVRW2K7RWGHzbQ== +jest-haste-map@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.5.0.tgz#69bd67dc9012d6e2723f20a945099e972b2e94de" + integrity sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA== dependencies: - "@jest/types" "^28.1.1" + "@jest/types" "^29.5.0" "@types/graceful-fs" "^4.1.3" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.9" - jest-regex-util "^28.0.2" - jest-util "^28.1.1" - jest-worker "^28.1.1" + jest-regex-util "^29.4.3" + jest-util "^29.5.0" + jest-worker "^29.5.0" micromatch "^4.0.4" walker "^1.0.8" optionalDependencies: fsevents "^2.3.2" -jest-leak-detector@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-28.1.1.tgz#537f37afd610a4b3f4cab15e06baf60484548efb" - integrity sha512-4jvs8V8kLbAaotE+wFR7vfUGf603cwYtFf1/PYEsyX2BAjSzj8hQSVTP6OWzseTl0xL6dyHuKs2JAks7Pfubmw== +jest-leak-detector@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz#cf4bdea9615c72bac4a3a7ba7e7930f9c0610c8c" + integrity sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow== dependencies: - jest-get-type "^28.0.2" - pretty-format "^28.1.1" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" -jest-matcher-utils@^28.0.0, jest-matcher-utils@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-28.1.1.tgz#a7c4653c2b782ec96796eb3088060720f1e29304" - integrity sha512-NPJPRWrbmR2nAJ+1nmnfcKKzSwgfaciCCrYZzVnNoxVoyusYWIjkBMNvu0RHJe7dNj4hH3uZOPZsQA+xAYWqsw== +jest-matcher-utils@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz#d957af7f8c0692c5453666705621ad4abc2c59c5" + integrity sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw== dependencies: chalk "^4.0.0" - jest-diff "^28.1.1" - jest-get-type "^28.0.2" - pretty-format "^28.1.1" + jest-diff "^29.5.0" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" -jest-message-util@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-28.1.1.tgz#60aa0b475cfc08c8a9363ed2fb9108514dd9ab89" - integrity sha512-xoDOOT66fLfmTRiqkoLIU7v42mal/SqwDKvfmfiWAdJMSJiU+ozgluO7KbvoAgiwIrrGZsV7viETjc8GNrA/IQ== +jest-message-util@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.5.0.tgz#1f776cac3aca332ab8dd2e3b41625435085c900e" + integrity sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA== dependencies: "@babel/code-frame" "^7.12.13" - "@jest/types" "^28.1.1" + "@jest/types" "^29.5.0" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.9" micromatch "^4.0.4" - pretty-format "^28.1.1" + pretty-format "^29.5.0" slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-28.1.1.tgz#37903d269427fa1ef5b2447be874e1c62a39a371" - integrity sha512-bDCb0FjfsmKweAvE09dZT59IMkzgN0fYBH6t5S45NoJfd2DHkS3ySG2K+hucortryhO3fVuXdlxWcbtIuV/Skw== +jest-mock@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.5.0.tgz#26e2172bcc71d8b0195081ff1f146ac7e1518aed" + integrity sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw== dependencies: - "@jest/types" "^28.1.1" + "@jest/types" "^29.5.0" "@types/node" "*" + jest-util "^29.5.0" jest-pnp-resolver@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== -jest-regex-util@^28.0.2: - version "28.0.2" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead" - integrity sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw== +jest-regex-util@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.4.3.tgz#a42616141e0cae052cfa32c169945d00c0aa0bb8" + integrity sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg== -jest-resolve-dependencies@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-28.1.2.tgz#ca528858e0c6642d5a1dda8fc7cda10230c275bc" - integrity sha512-OXw4vbOZuyRTBi3tapWBqdyodU+T33ww5cPZORuTWkg+Y8lmsxQlVu3MWtJh6NMlKRTHQetF96yGPv01Ye7Mbg== +jest-resolve-dependencies@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz#f0ea29955996f49788bf70996052aa98e7befee4" + integrity sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg== dependencies: - jest-regex-util "^28.0.2" - jest-snapshot "^28.1.2" + jest-regex-util "^29.4.3" + jest-snapshot "^29.5.0" -jest-resolve@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-28.1.1.tgz#bc2eaf384abdcc1aaf3ba7c50d1adf01e59095e5" - integrity sha512-/d1UbyUkf9nvsgdBildLe6LAD4DalgkgZcKd0nZ8XUGPyA/7fsnaQIlKVnDiuUXv/IeZhPEDrRJubVSulxrShA== +jest-resolve@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.5.0.tgz#b053cc95ad1d5f6327f0ac8aae9f98795475ecdc" + integrity sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w== dependencies: chalk "^4.0.0" graceful-fs "^4.2.9" - jest-haste-map "^28.1.1" + jest-haste-map "^29.5.0" jest-pnp-resolver "^1.2.2" - jest-util "^28.1.1" - jest-validate "^28.1.1" + jest-util "^29.5.0" + jest-validate "^29.5.0" resolve "^1.20.0" - resolve.exports "^1.1.0" + resolve.exports "^2.0.0" slash "^3.0.0" -jest-runner@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-28.1.2.tgz#f293409592a62234285a71237e38499a3554e350" - integrity sha512-6/k3DlAsAEr5VcptCMdhtRhOoYClZQmxnVMZvZ/quvPGRpN7OBQYPIC32tWSgOnbgqLXNs5RAniC+nkdFZpD4A== +jest-runner@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.5.0.tgz#6a57c282eb0ef749778d444c1d758c6a7693b6f8" + integrity sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ== dependencies: - "@jest/console" "^28.1.1" - "@jest/environment" "^28.1.2" - "@jest/test-result" "^28.1.1" - "@jest/transform" "^28.1.2" - "@jest/types" "^28.1.1" + "@jest/console" "^29.5.0" + "@jest/environment" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" - emittery "^0.10.2" + emittery "^0.13.1" graceful-fs "^4.2.9" - jest-docblock "^28.1.1" - jest-environment-node "^28.1.2" - jest-haste-map "^28.1.1" - jest-leak-detector "^28.1.1" - jest-message-util "^28.1.1" - jest-resolve "^28.1.1" - jest-runtime "^28.1.2" - jest-util "^28.1.1" - jest-watcher "^28.1.1" - jest-worker "^28.1.1" + jest-docblock "^29.4.3" + jest-environment-node "^29.5.0" + jest-haste-map "^29.5.0" + jest-leak-detector "^29.5.0" + jest-message-util "^29.5.0" + jest-resolve "^29.5.0" + jest-runtime "^29.5.0" + jest-util "^29.5.0" + jest-watcher "^29.5.0" + jest-worker "^29.5.0" + p-limit "^3.1.0" source-map-support "0.5.13" - throat "^6.0.1" - -jest-runtime@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-28.1.2.tgz#d68f34f814a848555a345ceda23289f14d59a688" - integrity sha512-i4w93OsWzLOeMXSi9epmakb2+3z0AchZtUQVF1hesBmcQQy4vtaql5YdVe9KexdJaVRyPDw8DoBR0j3lYsZVYw== - dependencies: - "@jest/environment" "^28.1.2" - "@jest/fake-timers" "^28.1.2" - "@jest/globals" "^28.1.2" - "@jest/source-map" "^28.1.2" - "@jest/test-result" "^28.1.1" - "@jest/transform" "^28.1.2" - "@jest/types" "^28.1.1" + +jest-runtime@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.5.0.tgz#c83f943ee0c1da7eb91fa181b0811ebd59b03420" + integrity sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw== + dependencies: + "@jest/environment" "^29.5.0" + "@jest/fake-timers" "^29.5.0" + "@jest/globals" "^29.5.0" + "@jest/source-map" "^29.4.3" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" + "@types/node" "*" chalk "^4.0.0" cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" - execa "^5.0.0" glob "^7.1.3" graceful-fs "^4.2.9" - jest-haste-map "^28.1.1" - jest-message-util "^28.1.1" - jest-mock "^28.1.1" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.1" - jest-snapshot "^28.1.2" - jest-util "^28.1.1" + jest-haste-map "^29.5.0" + jest-message-util "^29.5.0" + jest-mock "^29.5.0" + jest-regex-util "^29.4.3" + jest-resolve "^29.5.0" + jest-snapshot "^29.5.0" + jest-util "^29.5.0" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@^28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-28.1.2.tgz#93d31b87b11b384f5946fe0767541496135f8d52" - integrity sha512-wzrieFttZYfLvrCVRJxX+jwML2YTArOUqFpCoSVy1QUapx+LlV9uLbV/mMEhYj4t7aMeE9aSQFHSvV/oNoDAMA== +jest-snapshot@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.5.0.tgz#c9c1ce0331e5b63cd444e2f95a55a73b84b1e8ce" + integrity sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g== dependencies: "@babel/core" "^7.11.6" "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" "@babel/plugin-syntax-typescript" "^7.7.2" "@babel/traverse" "^7.7.2" "@babel/types" "^7.3.3" - "@jest/expect-utils" "^28.1.1" - "@jest/transform" "^28.1.2" - "@jest/types" "^28.1.1" + "@jest/expect-utils" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" "@types/babel__traverse" "^7.0.6" "@types/prettier" "^2.1.5" babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^28.1.1" + expect "^29.5.0" graceful-fs "^4.2.9" - jest-diff "^28.1.1" - jest-get-type "^28.0.2" - jest-haste-map "^28.1.1" - jest-matcher-utils "^28.1.1" - jest-message-util "^28.1.1" - jest-util "^28.1.1" + jest-diff "^29.5.0" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.5.0" + jest-message-util "^29.5.0" + jest-util "^29.5.0" natural-compare "^1.4.0" - pretty-format "^28.1.1" + pretty-format "^29.5.0" semver "^7.3.5" -jest-util@^28.0.0, jest-util@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.1.tgz#ff39e436a1aca397c0ab998db5a51ae2b7080d05" - integrity sha512-FktOu7ca1DZSyhPAxgxB6hfh2+9zMoJ7aEQA759Z6p45NuO8mWcqujH+UdHlCm/V6JTWwDztM2ITCzU1ijJAfw== +jest-util@^29.0.0, jest-util@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.5.0.tgz#24a4d3d92fc39ce90425311b23c27a6e0ef16b8f" + integrity sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ== dependencies: - "@jest/types" "^28.1.1" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-28.1.1.tgz#59b7b339b3c85b5144bd0c06ad3600f503a4acc8" - integrity sha512-Kpf6gcClqFCIZ4ti5++XemYJWUPCFUW+N2gknn+KgnDf549iLul3cBuKVe1YcWRlaF8tZV8eJCap0eECOEE3Ug== +jest-validate@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.5.0.tgz#8e5a8f36178d40e47138dc00866a5f3bd9916ffc" + integrity sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ== dependencies: - "@jest/types" "^28.1.1" + "@jest/types" "^29.5.0" camelcase "^6.2.0" chalk "^4.0.0" - jest-get-type "^28.0.2" + jest-get-type "^29.4.3" leven "^3.1.0" - pretty-format "^28.1.1" + pretty-format "^29.5.0" -jest-watcher@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-28.1.1.tgz#533597fb3bfefd52b5cd115cd916cffd237fb60c" - integrity sha512-RQIpeZ8EIJMxbQrXpJQYIIlubBnB9imEHsxxE41f54ZwcqWLysL/A0ZcdMirf+XsMn3xfphVQVV4EW0/p7i7Ug== +jest-watcher@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.5.0.tgz#cf7f0f949828ba65ddbbb45c743a382a4d911363" + integrity sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA== dependencies: - "@jest/test-result" "^28.1.1" - "@jest/types" "^28.1.1" + "@jest/test-result" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - emittery "^0.10.2" - jest-util "^28.1.1" + emittery "^0.13.1" + jest-util "^29.5.0" string-length "^4.0.1" jest-worker@^26.2.1: @@ -3246,24 +3539,25 @@ jest-worker@^26.2.1: merge-stream "^2.0.0" supports-color "^7.0.0" -jest-worker@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-28.1.1.tgz#3480c73247171dfd01eda77200f0063ab6a3bf28" - integrity sha512-Au7slXB08C6h+xbJPp7VIb6U0XX5Kc9uel/WFc6/rcTzGiaVCBRngBExSYuXSLFPULPSYU3cJ3ybS988lNFQhQ== +jest-worker@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.5.0.tgz#bdaefb06811bd3384d93f009755014d8acb4615d" + integrity sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA== dependencies: "@types/node" "*" + jest-util "^29.5.0" merge-stream "^2.0.0" supports-color "^8.0.0" -jest@28.1.2: - version "28.1.2" - resolved "https://registry.yarnpkg.com/jest/-/jest-28.1.2.tgz#451ff24081ce31ca00b07b60c61add13aa96f8eb" - integrity sha512-Tuf05DwLeCh2cfWCQbcz9UxldoDyiR1E9Igaei5khjonKncYdc6LDfynKCEWozK0oLE3GD+xKAo2u8x/0s6GOg== +jest@29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.5.0.tgz#f75157622f5ce7ad53028f2f8888ab53e1f1f24e" + integrity sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ== dependencies: - "@jest/core" "^28.1.2" - "@jest/types" "^28.1.1" + "@jest/core" "^29.5.0" + "@jest/types" "^29.5.0" import-local "^3.0.2" - jest-cli "^28.1.2" + jest-cli "^29.5.0" js-tokens@^4.0.0: version "4.0.0" @@ -3324,6 +3618,11 @@ json5@^2.2.1: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== +json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + kleur@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -3432,14 +3731,6 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -locate-path@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" - integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= - dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" - locate-path@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -3447,6 +3738,13 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash.memoize@4.x: version "4.1.2" resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -3464,24 +3762,29 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lru-cache@^9.0.0: + version "9.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-9.1.1.tgz#c58a93de58630b688de39ad04ef02ef26f1902f1" + integrity sha512-65/Jky17UwSb0BuB9V+MyDpsOtXKmYwzhyl+cOa9XUiI4uV2Ouy/2voFP3+al0BjZbJgMBD8FojMpAf+Z+qn4A== + ltgt@^2.1.2: version "2.2.1" resolved "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= -magic-string@^0.25.7: - version "0.25.7" - resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" - integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== +magic-string@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3" + integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA== dependencies: - sourcemap-codec "^1.4.4" + "@jridgewell/sourcemap-codec" "^1.4.13" -magic-string@^0.26.1: - version "0.26.1" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.1.tgz#ba9b651354fa9512474199acecf9c6dbe93f97fd" - integrity sha512-ndThHmvgtieXe8J/VGPjG+Apu7v7ItcD5mhEIvOscWjPF/ccOiLxHaSuCAS2G+3x4GKsAbT8u7zdyamupui8Tg== +magic-string@^0.30.0: + version "0.30.0" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.0.tgz#fd58a4748c5c4547338a424e90fa5dd17f4de529" + integrity sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ== dependencies: - sourcemap-codec "^1.4.8" + "@jridgewell/sourcemap-codec" "^1.4.13" make-dir@^3.0.0: version "3.1.0" @@ -3516,7 +3819,7 @@ merge-stream@^2.0.0: resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: +merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -3559,13 +3862,27 @@ minimatch@^3.0.3, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimatch@^3.1.2: +minimatch@^3.0.5, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" +minimatch@^5.0.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== + dependencies: + brace-expansion "^2.0.1" + +minimatch@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.1.tgz#8a555f541cf976c622daf078bb28f29fb927c253" + integrity sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.0, minimist@^1.2.5: version "1.2.5" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" @@ -3576,16 +3893,21 @@ minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== +minipass@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" + integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== + +"minipass@^5.0.0 || ^6.0.2": + version "6.0.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-6.0.2.tgz#542844b6c4ce95b202c0995b0a471f1229de4c81" + integrity sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w== + mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -ms@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -3596,15 +3918,20 @@ ms@^2.1.1: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -node-fetch@2.6.7: - version "2.6.7" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" - integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== +node-fetch@^2.6.11: + version "2.6.11" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.11.tgz#cde7fc71deef3131ef80a738919f999e6edfff25" + integrity sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w== dependencies: whatwg-url "^5.0.0" @@ -3648,6 +3975,11 @@ object-inspect@^1.11.0, object-inspect@^1.9.0: resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== +object-inspect@^1.12.3: + version "1.12.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" + integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== + object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" @@ -3677,6 +4009,16 @@ object.assign@^4.1.2: has-symbols "^1.0.1" object-keys "^1.1.1" +object.assign@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" + integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + has-symbols "^1.0.3" + object-keys "^1.1.1" + object.entries@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.5.tgz#e1acdd17c4de2cd96d5a08487cfb9db84d881861" @@ -3686,14 +4028,14 @@ object.entries@^1.1.5: define-properties "^1.1.3" es-abstract "^1.19.1" -object.values@^1.1.5: - version "1.1.5" - resolved "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz#959f63e3ce9ef108720333082131e4a459b716ac" - integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== +object.values@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.6.tgz#4abbaa71eba47d63589d402856f908243eea9b1d" + integrity sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.20.4" octal@^1.0.0: version "1.0.0" @@ -3726,13 +4068,6 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" -p-limit@^1.1.0: - version "1.3.0" - resolved "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" - integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== - dependencies: - p-try "^1.0.0" - p-limit@^2.2.0: version "2.3.0" resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -3740,12 +4075,12 @@ p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-locate@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" - integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= +p-limit@^3.0.2, p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: - p-limit "^1.1.0" + yocto-queue "^0.1.0" p-locate@^4.1.0: version "4.1.0" @@ -3754,10 +4089,12 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" -p-try@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" - integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" p-try@^2.0.0: version "2.2.0" @@ -3792,11 +4129,6 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= - path-exists@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -3817,6 +4149,14 @@ path-parse@^1.0.6, path-parse@^1.0.7: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.7.0.tgz#99c741a2cfbce782294a39994d63748b5a24f6db" + integrity sha512-UkZUeDjczjYRE495+9thsgcVgsaCPkaw80slmfVFgllxY+IO8ubTsOpFVjDPROBqJdHfVPUFRHPBV/WciOVfWg== + dependencies: + lru-cache "^9.0.0" + minipass "^5.0.0" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -3838,11 +4178,16 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.2, picomatch@^2.2.3: +picomatch@^2.0.4, picomatch@^2.2.3: version "2.3.0" resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + pirates@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.4.tgz#07df81e61028e402735cdd49db701e4885b4e6e6" @@ -3867,18 +4212,17 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.7.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" - integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== +prettier@2.8.8: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -pretty-format@^28.0.0, pretty-format@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.1.tgz#f731530394e0f7fcd95aba6b43c50e02d86b95cb" - integrity sha512-wwJbVTGFHeucr5Jw2bQ9P+VYHyLdAqedFLEkdQUVaBF/eiidDwH5OpilINq4mEfhbCjLnirt6HTTDhv1HaTIQw== +pretty-format@^29.0.0, pretty-format@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a" + integrity sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw== dependencies: - "@jest/schemas" "^28.0.2" - ansi-regex "^5.0.1" + "@jest/schemas" "^29.4.3" ansi-styles "^5.0.0" react-is "^18.0.0" @@ -3927,6 +4271,11 @@ punycode@^2.1.0: resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +pure-rand@^6.0.0: + version "6.0.2" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.2.tgz#a9c2ddcae9b68d736a8163036f088a2781c8b306" + integrity sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ== + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -3994,10 +4343,14 @@ readable-stream@~1.0.26, readable-stream@~1.0.26-4, readable-stream@~1.0.31: isarray "0.0.1" string_decoder "~0.10.x" -regexpp@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== +regexp.prototype.flags@^1.4.3: + version "1.5.0" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz#fe7ce25e7e4cca8db37b6634c8a2c7009199b9cb" + integrity sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + functions-have-names "^1.2.3" require-directory@^2.1.1: version "2.1.1" @@ -4021,12 +4374,12 @@ resolve-from@^5.0.0: resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve.exports@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" - integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== +resolve.exports@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" + integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== -resolve@^1.17.0, resolve@^1.19.0, resolve@^1.20.0: +resolve@^1.20.0: version "1.20.0" resolved "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== @@ -4034,12 +4387,12 @@ resolve@^1.17.0, resolve@^1.19.0, resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" -resolve@^1.22.0: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== +resolve@^1.22.1: + version "1.22.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" + integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== dependencies: - is-core-module "^2.8.1" + is-core-module "^2.11.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -4048,7 +4401,14 @@ reusify@^1.0.4: resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@3.0.2, rimraf@^3.0.0, rimraf@^3.0.2: +rimraf@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.1.tgz#0881323ab94ad45fec7c0221f27ea1a142f3f0d0" + integrity sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg== + dependencies: + glob "^10.2.5" + +rimraf@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -4063,14 +4423,14 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rollup-plugin-dts@4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-4.2.2.tgz#82876b8784213af29b02cf260b45e404ff835ce1" - integrity sha512-A3g6Rogyko/PXeKoUlkjxkP++8UDVpgA7C+Tdl77Xj4fgEaIjPSnxRmR53EzvoYy97VMVwLAOcWJudaVAuxneQ== +rollup-plugin-dts@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-5.3.0.tgz#80a95988002f188e376f6db3b7e2f53679168957" + integrity sha512-8FXp0ZkyZj1iU5klkIJYLjIq/YZSwBoERu33QBDxm/1yw5UU4txrEtcmMkrq+ZiKu3Q4qvPCNqc3ovX6rjqzbQ== dependencies: - magic-string "^0.26.1" + magic-string "^0.30.0" optionalDependencies: - "@babel/code-frame" "^7.16.7" + "@babel/code-frame" "^7.18.6" rollup-plugin-node-builtins@2.1.2: version "2.1.2" @@ -4082,12 +4442,12 @@ rollup-plugin-node-builtins@2.1.2: crypto-browserify "^3.11.0" process-es6 "^0.11.2" -rollup-plugin-polyfill-node@0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.9.0.tgz#09cf1a74244a74a5c5007f5fd386d320610ec1d8" - integrity sha512-cVqm7LjgBqtZ77M9hLYayXrLz18nLIVPp3MPqNi2suStrFDg1LsA2cSdMIighr2yeuAQrphu8ymXTAsJNVABow== +rollup-plugin-polyfill-node@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.12.0.tgz#33d421ddb7fcb69c234461e508ca6d2db6193f1d" + integrity sha512-PWEVfDxLEKt8JX1nZ0NkUAgXpkZMTb85rO/Ru9AQ69wYW8VUCfDgP4CGRXXWYni5wDF0vIeR1UoF3Jmw/Lt3Ug== dependencies: - "@rollup/plugin-inject" "^4.0.0" + "@rollup/plugin-inject" "^5.0.1" rollup-plugin-terser@7.0.2: version "7.0.2" @@ -4099,10 +4459,10 @@ rollup-plugin-terser@7.0.2: serialize-javascript "^4.0.0" terser "^5.0.0" -rollup@2.75.7: - version "2.75.7" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.75.7.tgz#221ff11887ae271e37dcc649ba32ce1590aaa0b9" - integrity sha512-VSE1iy0eaAYNCxEXaleThdFXqZJ42qDBatAwrfnPlENEZ8erQ+0LYX4JXOLPceWfZpV1VtZwZ3dFCuOZiSyFtQ== +rollup@3.25.1: + version "3.25.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.25.1.tgz#9fff79d22ff1a904b2b595a2fb9bc3793cb987d8" + integrity sha512-tywOR+rwIt5m2ZAWSe5AIJcTat8vGlnPFAv15ycCrw33t6iFsXZ6mzHVFh2psSjxQPmI+xgzMZZizUAukBI4aQ== optionalDependencies: fsevents "~2.3.2" @@ -4123,6 +4483,15 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-regex-test@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" + integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.3" + is-regex "^1.1.4" + safer-buffer@^2.1.0: version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -4203,6 +4572,11 @@ signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signal-exit@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.0.1.tgz#96a61033896120ec9335d96851d902cc98f0ba2a" + integrity sha512-uUWsN4aOxJAS8KOuf3QMyFtgm1pkb6I+KRZbRF/ghdf5T7sM+B1lLLzPDxswUjkmHyxQAVzEgG35E3NzDM9GVw== + sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" @@ -4213,21 +4587,26 @@ slash@^3.0.0: resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== +slash@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" + integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== + sort-object-keys@^1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/sort-object-keys/-/sort-object-keys-1.1.3.tgz#bff833fe85cab147b34742e45863453c1e190b45" integrity sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg== -sort-package-json@1.57.0: - version "1.57.0" - resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-1.57.0.tgz#e95fb44af8ede0bb6147e3f39258102d4bb23fc4" - integrity sha512-FYsjYn2dHTRb41wqnv+uEqCUvBpK3jZcTp9rbz2qDTmel7Pmdtf+i2rLaaPMRZeSVM60V3Se31GyWFpmKs4Q5Q== - dependencies: - detect-indent "^6.0.0" - detect-newline "3.1.0" - git-hooks-list "1.0.3" - globby "10.0.0" - is-plain-obj "2.1.0" +sort-package-json@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/sort-package-json/-/sort-package-json-2.4.1.tgz#4ea68a0b9ef34c2bc519e86d0d07de56622a7600" + integrity sha512-Nd3rgLBJcZ4iw7tpuOhwBupG6SvUDU0Fy1cZGAMorA2JmDUb+29Dg5phJK9gapa2Ak9d15w/RuMl/viwX+nKwQ== + dependencies: + detect-indent "^7.0.1" + detect-newline "^4.0.0" + git-hooks-list "^3.0.0" + globby "^13.1.2" + is-plain-obj "^4.1.0" sort-object-keys "^1.1.3" source-map-support@0.5.13: @@ -4261,11 +4640,6 @@ source-map@~0.7.2: resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== -sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8: - version "1.4.8" - resolved "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" - integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -4291,6 +4665,15 @@ string-range@~1.2, string-range@~1.2.1: resolved "https://registry.npmjs.org/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd" integrity sha1-qJPtNH5yKZvIO++78qaSqNI51d0= +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^4.1.0, string-width@^4.2.0: version "4.2.2" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" @@ -4300,14 +4683,23 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + +string.prototype.trim@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz#a68352740859f6893f14ce3ef1bb3037f7a90533" + integrity sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" string.prototype.trimend@^1.0.4: version "1.0.4" @@ -4317,6 +4709,15 @@ string.prototype.trimend@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimend@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz#c4a27fa026d979d79c04f17397f250a462944533" + integrity sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" + string.prototype.trimstart@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" @@ -4325,6 +4726,15 @@ string.prototype.trimstart@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimstart@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz#e90ab66aa8e4007d92ef591bbf3cd422c56bdcf4" + integrity sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -4344,6 +4754,13 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" @@ -4358,6 +4775,13 @@ strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" +strip-ansi@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" + integrity sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw== + dependencies: + ansi-regex "^6.0.1" + strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" @@ -4399,27 +4823,11 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.0.0: - version "2.2.0" - resolved "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb" - integrity sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - terser@^5.0.0: version "5.9.0" resolved "https://registry.npmjs.org/terser/-/terser-5.9.0.tgz#47d6e629a522963240f2b55fcaa3c99083d2c351" @@ -4443,11 +4851,6 @@ text-table@^0.2.0: resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -throat@^6.0.1: - version "6.0.1" - resolved "https://registry.npmjs.org/throat/-/throat-6.0.1.tgz#d514fedad95740c12c2d7fc70ea863eb51ade375" - integrity sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w== - through2@^2.0.1: version "2.0.5" resolved "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -4478,15 +4881,15 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= -ts-jest@28.0.5: - version "28.0.5" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.5.tgz#31776f768fba6dfc8c061d488840ed0c8eeac8b9" - integrity sha512-Sx9FyP9pCY7pUzQpy4FgRZf2bhHY3za576HMKJFs+OnQ9jS96Du5vNsDKkyedQkik+sEabbKAnCliv9BEsHZgQ== +ts-jest@29.1.0: + version "29.1.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.0.tgz#4a9db4104a49b76d2b368ea775b6c9535c603891" + integrity sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA== dependencies: bs-logger "0.x" fast-json-stable-stringify "2.x" - jest-util "^28.0.0" - json5 "^2.2.1" + jest-util "^29.0.0" + json5 "^2.2.3" lodash.memoize "4.x" make-error "1.x" semver "7.x" @@ -4502,6 +4905,11 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@2.5.3: + version "2.5.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.3.tgz#24944ba2d990940e6e982c4bea147aba80209913" + integrity sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w== + tslib@^1.8.1: version "1.14.1" resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -4536,6 +4944,15 @@ type-fest@^0.21.3: resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== +typed-array-length@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" + integrity sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng== + dependencies: + call-bind "^1.0.2" + for-each "^0.3.3" + is-typed-array "^1.1.9" + typedarray-to-buffer@~1.0.0: version "1.0.4" resolved "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-1.0.4.tgz#9bb8ba0e841fb3f4cf1fe7c245e9f3fa8a5fe99c" @@ -4546,10 +4963,10 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826" + integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw== unbox-primitive@^1.0.1: version "1.0.1" @@ -4561,6 +4978,16 @@ unbox-primitive@^1.0.1: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== + dependencies: + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" + untildify@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" @@ -4586,11 +5013,6 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1: resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= -v8-compile-cache@^2.0.3: - version "2.3.0" - resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" - integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== - v8-to-istanbul@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" @@ -4631,6 +5053,18 @@ which-boxed-primitive@^1.0.2: is-string "^1.0.5" is-symbol "^1.0.3" +which-typed-array@^1.1.9: + version "1.1.9" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6" + integrity sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + is-typed-array "^1.1.10" + which@^2.0.1: version "2.0.2" resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -4643,6 +5077,15 @@ word-wrap@^1.2.3: resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -4652,15 +5095,24 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write-file-atomic@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.1.tgz#9faa33a964c1c85ff6f849b80b42a88c2c537c8f" - integrity sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ== +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== dependencies: imurmurhash "^0.1.4" signal-exit "^3.0.7" @@ -4747,3 +5199,8 @@ yargs@^17.3.1: string-width "^4.2.3" y18n "^5.0.5" yargs-parser "^21.0.0" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==