UNPKG

@adeze/raindrop-mcp

Version:

MCP Server for Raindrop.io bookmark management

1,576 lines (1,561 loc) 1.84 MB
import { createRequire } from "node:module"; var __create = Object.create; var __getProtoOf = Object.getPrototypeOf; var __defProp = Object.defineProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __hasOwnProp = Object.prototype.hasOwnProperty; var __toESM = (mod, isNodeMode, target) => { target = mod != null ? __create(__getProtoOf(mod)) : {}; const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target; for (let key of __getOwnPropNames(mod)) if (!__hasOwnProp.call(to, key)) __defProp(to, key, { get: () => mod[key], enumerable: true }); return to; }; var __moduleCache = /* @__PURE__ */ new WeakMap; var __toCommonJS = (from) => { var entry = __moduleCache.get(from), desc; if (entry) return entry; entry = __defProp({}, "__esModule", { value: true }); if (from && typeof from === "object" || typeof from === "function") __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable })); __moduleCache.set(from, entry); return entry; }; var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true, configurable: true, set: (newValue) => all[name] = () => newValue }); }; var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res); var __require = /* @__PURE__ */ createRequire(import.meta.url); // node_modules/bytes/index.js var require_bytes = __commonJS((exports, module) => { /*! * bytes * Copyright(c) 2012-2014 TJ Holowaychuk * Copyright(c) 2015 Jed Watson * MIT Licensed */ module.exports = bytes; module.exports.format = format; module.exports.parse = parse; var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; var map = { b: 1, kb: 1 << 10, mb: 1 << 20, gb: 1 << 30, tb: Math.pow(1024, 4), pb: Math.pow(1024, 5) }; var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; function bytes(value, options) { if (typeof value === "string") { return parse(value); } if (typeof value === "number") { return format(value, options); } return null; } function format(value, options) { if (!Number.isFinite(value)) { return null; } var mag = Math.abs(value); var thousandsSeparator = options && options.thousandsSeparator || ""; var unitSeparator = options && options.unitSeparator || ""; var decimalPlaces = options && options.decimalPlaces !== undefined ? options.decimalPlaces : 2; var fixedDecimals = Boolean(options && options.fixedDecimals); var unit = options && options.unit || ""; if (!unit || !map[unit.toLowerCase()]) { if (mag >= map.pb) { unit = "PB"; } else if (mag >= map.tb) { unit = "TB"; } else if (mag >= map.gb) { unit = "GB"; } else if (mag >= map.mb) { unit = "MB"; } else if (mag >= map.kb) { unit = "KB"; } else { unit = "B"; } } var val = value / map[unit.toLowerCase()]; var str = val.toFixed(decimalPlaces); if (!fixedDecimals) { str = str.replace(formatDecimalsRegExp, "$1"); } if (thousandsSeparator) { str = str.split(".").map(function(s, i) { return i === 0 ? s.replace(formatThousandsRegExp, thousandsSeparator) : s; }).join("."); } return str + unitSeparator + unit; } function parse(val) { if (typeof val === "number" && !isNaN(val)) { return val; } if (typeof val !== "string") { return null; } var results = parseRegExp.exec(val); var floatValue; var unit = "b"; if (!results) { floatValue = parseInt(val, 10); unit = "b"; } else { floatValue = parseFloat(results[1]); unit = results[4].toLowerCase(); } if (isNaN(floatValue)) { return null; } return Math.floor(map[unit] * floatValue); } }); // node_modules/depd/index.js var require_depd = __commonJS((exports, module) => { /*! * depd * Copyright(c) 2014-2018 Douglas Christopher Wilson * MIT Licensed */ var relative = __require("path").relative; module.exports = depd; var basePath = process.cwd(); function containsNamespace(str, namespace) { var vals = str.split(/[ ,]+/); var ns = String(namespace).toLowerCase(); for (var i = 0;i < vals.length; i++) { var val = vals[i]; if (val && (val === "*" || val.toLowerCase() === ns)) { return true; } } return false; } function convertDataDescriptorToAccessor(obj, prop, message) { var descriptor = Object.getOwnPropertyDescriptor(obj, prop); var value = descriptor.value; descriptor.get = function getter() { return value; }; if (descriptor.writable) { descriptor.set = function setter(val) { return value = val; }; } delete descriptor.value; delete descriptor.writable; Object.defineProperty(obj, prop, descriptor); return descriptor; } function createArgumentsString(arity) { var str = ""; for (var i = 0;i < arity; i++) { str += ", arg" + i; } return str.substr(2); } function createStackString(stack) { var str = this.name + ": " + this.namespace; if (this.message) { str += " deprecated " + this.message; } for (var i = 0;i < stack.length; i++) { str += ` at ` + stack[i].toString(); } return str; } function depd(namespace) { if (!namespace) { throw new TypeError("argument namespace is required"); } var stack = getStack(); var site = callSiteLocation(stack[1]); var file = site[0]; function deprecate(message) { log.call(deprecate, message); } deprecate._file = file; deprecate._ignored = isignored(namespace); deprecate._namespace = namespace; deprecate._traced = istraced(namespace); deprecate._warned = Object.create(null); deprecate.function = wrapfunction; deprecate.property = wrapproperty; return deprecate; } function eehaslisteners(emitter, type) { var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type); return count > 0; } function isignored(namespace) { if (process.noDeprecation) { return true; } var str = process.env.NO_DEPRECATION || ""; return containsNamespace(str, namespace); } function istraced(namespace) { if (process.traceDeprecation) { return true; } var str = process.env.TRACE_DEPRECATION || ""; return containsNamespace(str, namespace); } function log(message, site) { var haslisteners = eehaslisteners(process, "deprecation"); if (!haslisteners && this._ignored) { return; } var caller; var callFile; var callSite; var depSite; var i = 0; var seen = false; var stack = getStack(); var file = this._file; if (site) { depSite = site; callSite = callSiteLocation(stack[1]); callSite.name = depSite.name; file = callSite[0]; } else { i = 2; depSite = callSiteLocation(stack[i]); callSite = depSite; } for (;i < stack.length; i++) { caller = callSiteLocation(stack[i]); callFile = caller[0]; if (callFile === file) { seen = true; } else if (callFile === this._file) { file = this._file; } else if (seen) { break; } } var key = caller ? depSite.join(":") + "__" + caller.join(":") : undefined; if (key !== undefined && key in this._warned) { return; } this._warned[key] = true; var msg = message; if (!msg) { msg = callSite === depSite || !callSite.name ? defaultMessage(depSite) : defaultMessage(callSite); } if (haslisteners) { var err = DeprecationError(this._namespace, msg, stack.slice(i)); process.emit("deprecation", err); return; } var format = process.stderr.isTTY ? formatColor : formatPlain; var output = format.call(this, msg, caller, stack.slice(i)); process.stderr.write(output + ` `, "utf8"); } function callSiteLocation(callSite) { var file = callSite.getFileName() || "<anonymous>"; var line = callSite.getLineNumber(); var colm = callSite.getColumnNumber(); if (callSite.isEval()) { file = callSite.getEvalOrigin() + ", " + file; } var site = [file, line, colm]; site.callSite = callSite; site.name = callSite.getFunctionName(); return site; } function defaultMessage(site) { var callSite = site.callSite; var funcName = site.name; if (!funcName) { funcName = "<anonymous@" + formatLocation(site) + ">"; } var context = callSite.getThis(); var typeName = context && callSite.getTypeName(); if (typeName === "Object") { typeName = undefined; } if (typeName === "Function") { typeName = context.name || typeName; } return typeName && callSite.getMethodName() ? typeName + "." + funcName : funcName; } function formatPlain(msg, caller, stack) { var timestamp = new Date().toUTCString(); var formatted = timestamp + " " + this._namespace + " deprecated " + msg; if (this._traced) { for (var i = 0;i < stack.length; i++) { formatted += ` at ` + stack[i].toString(); } return formatted; } if (caller) { formatted += " at " + formatLocation(caller); } return formatted; } function formatColor(msg, caller, stack) { var formatted = "\x1B[36;1m" + this._namespace + "\x1B[22;39m" + " \x1B[33;1mdeprecated\x1B[22;39m" + " \x1B[0m" + msg + "\x1B[39m"; if (this._traced) { for (var i = 0;i < stack.length; i++) { formatted += ` \x1B[36mat ` + stack[i].toString() + "\x1B[39m"; } return formatted; } if (caller) { formatted += " \x1B[36m" + formatLocation(caller) + "\x1B[39m"; } return formatted; } function formatLocation(callSite) { return relative(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2]; } function getStack() { var limit = Error.stackTraceLimit; var obj = {}; var prep = Error.prepareStackTrace; Error.prepareStackTrace = prepareObjectStackTrace; Error.stackTraceLimit = Math.max(10, limit); Error.captureStackTrace(obj); var stack = obj.stack.slice(1); Error.prepareStackTrace = prep; Error.stackTraceLimit = limit; return stack; } function prepareObjectStackTrace(obj, stack) { return stack; } function wrapfunction(fn, message) { if (typeof fn !== "function") { throw new TypeError("argument fn must be a function"); } var args = createArgumentsString(fn.length); var stack = getStack(); var site = callSiteLocation(stack[1]); site.name = fn.name; var deprecatedfn = new Function("fn", "log", "deprecate", "message", "site", `"use strict" ` + "return function (" + args + ") {" + `log.call(deprecate, message, site) ` + `return fn.apply(this, arguments) ` + "}")(fn, log, this, message, site); return deprecatedfn; } function wrapproperty(obj, prop, message) { if (!obj || typeof obj !== "object" && typeof obj !== "function") { throw new TypeError("argument obj must be object"); } var descriptor = Object.getOwnPropertyDescriptor(obj, prop); if (!descriptor) { throw new TypeError("must call property on owner object"); } if (!descriptor.configurable) { throw new TypeError("property must be configurable"); } var deprecate = this; var stack = getStack(); var site = callSiteLocation(stack[1]); site.name = prop; if ("value" in descriptor) { descriptor = convertDataDescriptorToAccessor(obj, prop, message); } var get = descriptor.get; var set = descriptor.set; if (typeof get === "function") { descriptor.get = function getter() { log.call(deprecate, message, site); return get.apply(this, arguments); }; } if (typeof set === "function") { descriptor.set = function setter() { log.call(deprecate, message, site); return set.apply(this, arguments); }; } Object.defineProperty(obj, prop, descriptor); } function DeprecationError(namespace, message, stack) { var error = new Error; var stackString; Object.defineProperty(error, "constructor", { value: DeprecationError }); Object.defineProperty(error, "message", { configurable: true, enumerable: false, value: message, writable: true }); Object.defineProperty(error, "name", { enumerable: false, configurable: true, value: "DeprecationError", writable: true }); Object.defineProperty(error, "namespace", { configurable: true, enumerable: false, value: namespace, writable: true }); Object.defineProperty(error, "stack", { configurable: true, enumerable: false, get: function() { if (stackString !== undefined) { return stackString; } return stackString = createStackString.call(this, stack); }, set: function setter(val) { stackString = val; } }); return error; } }); // node_modules/setprototypeof/index.js var require_setprototypeof = __commonJS((exports, module) => { module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties); function setProtoOf(obj, proto) { obj.__proto__ = proto; return obj; } function mixinProperties(obj, proto) { for (var prop in proto) { if (!Object.prototype.hasOwnProperty.call(obj, prop)) { obj[prop] = proto[prop]; } } return obj; } }); // node_modules/http-errors/node_modules/statuses/codes.json var require_codes = __commonJS((exports, module) => { module.exports = { "100": "Continue", "101": "Switching Protocols", "102": "Processing", "103": "Early Hints", "200": "OK", "201": "Created", "202": "Accepted", "203": "Non-Authoritative Information", "204": "No Content", "205": "Reset Content", "206": "Partial Content", "207": "Multi-Status", "208": "Already Reported", "226": "IM Used", "300": "Multiple Choices", "301": "Moved Permanently", "302": "Found", "303": "See Other", "304": "Not Modified", "305": "Use Proxy", "307": "Temporary Redirect", "308": "Permanent Redirect", "400": "Bad Request", "401": "Unauthorized", "402": "Payment Required", "403": "Forbidden", "404": "Not Found", "405": "Method Not Allowed", "406": "Not Acceptable", "407": "Proxy Authentication Required", "408": "Request Timeout", "409": "Conflict", "410": "Gone", "411": "Length Required", "412": "Precondition Failed", "413": "Payload Too Large", "414": "URI Too Long", "415": "Unsupported Media Type", "416": "Range Not Satisfiable", "417": "Expectation Failed", "418": "I'm a Teapot", "421": "Misdirected Request", "422": "Unprocessable Entity", "423": "Locked", "424": "Failed Dependency", "425": "Too Early", "426": "Upgrade Required", "428": "Precondition Required", "429": "Too Many Requests", "431": "Request Header Fields Too Large", "451": "Unavailable For Legal Reasons", "500": "Internal Server Error", "501": "Not Implemented", "502": "Bad Gateway", "503": "Service Unavailable", "504": "Gateway Timeout", "505": "HTTP Version Not Supported", "506": "Variant Also Negotiates", "507": "Insufficient Storage", "508": "Loop Detected", "509": "Bandwidth Limit Exceeded", "510": "Not Extended", "511": "Network Authentication Required" }; }); // node_modules/http-errors/node_modules/statuses/index.js var require_statuses = __commonJS((exports, module) => { /*! * statuses * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ var codes = require_codes(); module.exports = status; status.message = codes; status.code = createMessageToStatusCodeMap(codes); status.codes = createStatusCodeList(codes); status.redirect = { 300: true, 301: true, 302: true, 303: true, 305: true, 307: true, 308: true }; status.empty = { 204: true, 205: true, 304: true }; status.retry = { 502: true, 503: true, 504: true }; function createMessageToStatusCodeMap(codes2) { var map = {}; Object.keys(codes2).forEach(function forEachCode(code) { var message = codes2[code]; var status2 = Number(code); map[message.toLowerCase()] = status2; }); return map; } function createStatusCodeList(codes2) { return Object.keys(codes2).map(function mapCode(code) { return Number(code); }); } function getStatusCode(message) { var msg = message.toLowerCase(); if (!Object.prototype.hasOwnProperty.call(status.code, msg)) { throw new Error('invalid status message: "' + message + '"'); } return status.code[msg]; } function getStatusMessage(code) { if (!Object.prototype.hasOwnProperty.call(status.message, code)) { throw new Error("invalid status code: " + code); } return status.message[code]; } function status(code) { if (typeof code === "number") { return getStatusMessage(code); } if (typeof code !== "string") { throw new TypeError("code must be a number or string"); } var n = parseInt(code, 10); if (!isNaN(n)) { return getStatusMessage(n); } return getStatusCode(code); } }); // node_modules/inherits/inherits_browser.js var require_inherits_browser = __commonJS((exports, module) => { if (typeof Object.create === "function") { module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); } }; } else { module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor; var TempCtor = function() {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor; ctor.prototype.constructor = ctor; } }; } }); // node_modules/inherits/inherits.js var require_inherits = __commonJS((exports, module) => { try { util3 = __require("util"); if (typeof util3.inherits !== "function") throw ""; module.exports = util3.inherits; } catch (e) { module.exports = require_inherits_browser(); } var util3; }); // node_modules/toidentifier/index.js var require_toidentifier = __commonJS((exports, module) => { /*! * toidentifier * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ module.exports = toIdentifier; function toIdentifier(str) { return str.split(" ").map(function(token) { return token.slice(0, 1).toUpperCase() + token.slice(1); }).join("").replace(/[^ _0-9a-z]/gi, ""); } }); // node_modules/http-errors/index.js var require_http_errors = __commonJS((exports, module) => { /*! * http-errors * Copyright(c) 2014 Jonathan Ong * Copyright(c) 2016 Douglas Christopher Wilson * MIT Licensed */ var deprecate = require_depd()("http-errors"); var setPrototypeOf = require_setprototypeof(); var statuses = require_statuses(); var inherits = require_inherits(); var toIdentifier = require_toidentifier(); module.exports = createError; module.exports.HttpError = createHttpErrorConstructor(); module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError); populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError); function codeClass(status) { return Number(String(status).charAt(0) + "00"); } function createError() { var err; var msg; var status = 500; var props = {}; for (var i = 0;i < arguments.length; i++) { var arg = arguments[i]; var type = typeof arg; if (type === "object" && arg instanceof Error) { err = arg; status = err.status || err.statusCode || status; } else if (type === "number" && i === 0) { status = arg; } else if (type === "string") { msg = arg; } else if (type === "object") { props = arg; } else { throw new TypeError("argument #" + (i + 1) + " unsupported type " + type); } } if (typeof status === "number" && (status < 400 || status >= 600)) { deprecate("non-error status code; use only 4xx or 5xx status codes"); } if (typeof status !== "number" || !statuses.message[status] && (status < 400 || status >= 600)) { status = 500; } var HttpError = createError[status] || createError[codeClass(status)]; if (!err) { err = HttpError ? new HttpError(msg) : new Error(msg || statuses.message[status]); Error.captureStackTrace(err, createError); } if (!HttpError || !(err instanceof HttpError) || err.status !== status) { err.expose = status < 500; err.status = err.statusCode = status; } for (var key in props) { if (key !== "status" && key !== "statusCode") { err[key] = props[key]; } } return err; } function createHttpErrorConstructor() { function HttpError() { throw new TypeError("cannot construct abstract class"); } inherits(HttpError, Error); return HttpError; } function createClientErrorConstructor(HttpError, name, code) { var className = toClassName(name); function ClientError(message) { var msg = message != null ? message : statuses.message[code]; var err = new Error(msg); Error.captureStackTrace(err, ClientError); setPrototypeOf(err, ClientError.prototype); Object.defineProperty(err, "message", { enumerable: true, configurable: true, value: msg, writable: true }); Object.defineProperty(err, "name", { enumerable: false, configurable: true, value: className, writable: true }); return err; } inherits(ClientError, HttpError); nameFunc(ClientError, className); ClientError.prototype.status = code; ClientError.prototype.statusCode = code; ClientError.prototype.expose = true; return ClientError; } function createIsHttpErrorFunction(HttpError) { return function isHttpError(val) { if (!val || typeof val !== "object") { return false; } if (val instanceof HttpError) { return true; } return val instanceof Error && typeof val.expose === "boolean" && typeof val.statusCode === "number" && val.status === val.statusCode; }; } function createServerErrorConstructor(HttpError, name, code) { var className = toClassName(name); function ServerError(message) { var msg = message != null ? message : statuses.message[code]; var err = new Error(msg); Error.captureStackTrace(err, ServerError); setPrototypeOf(err, ServerError.prototype); Object.defineProperty(err, "message", { enumerable: true, configurable: true, value: msg, writable: true }); Object.defineProperty(err, "name", { enumerable: false, configurable: true, value: className, writable: true }); return err; } inherits(ServerError, HttpError); nameFunc(ServerError, className); ServerError.prototype.status = code; ServerError.prototype.statusCode = code; ServerError.prototype.expose = false; return ServerError; } function nameFunc(func, name) { var desc = Object.getOwnPropertyDescriptor(func, "name"); if (desc && desc.configurable) { desc.value = name; Object.defineProperty(func, "name", desc); } } function populateConstructorExports(exports2, codes, HttpError) { codes.forEach(function forEachCode(code) { var CodeError; var name = toIdentifier(statuses.message[code]); switch (codeClass(code)) { case 400: CodeError = createClientErrorConstructor(HttpError, name, code); break; case 500: CodeError = createServerErrorConstructor(HttpError, name, code); break; } if (CodeError) { exports2[code] = CodeError; exports2[name] = CodeError; } }); } function toClassName(name) { return name.substr(-5) !== "Error" ? name + "Error" : name; } }); // node_modules/safer-buffer/safer.js var require_safer = __commonJS((exports, module) => { var buffer = __require("buffer"); var Buffer2 = buffer.Buffer; var safer = {}; var key; for (key in buffer) { if (!buffer.hasOwnProperty(key)) continue; if (key === "SlowBuffer" || key === "Buffer") continue; safer[key] = buffer[key]; } var Safer = safer.Buffer = {}; for (key in Buffer2) { if (!Buffer2.hasOwnProperty(key)) continue; if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue; Safer[key] = Buffer2[key]; } safer.Buffer.prototype = Buffer2.prototype; if (!Safer.from || Safer.from === Uint8Array.from) { Safer.from = function(value, encodingOrOffset, length) { if (typeof value === "number") { throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value); } if (value && typeof value.length === "undefined") { throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); } return Buffer2(value, encodingOrOffset, length); }; } if (!Safer.alloc) { Safer.alloc = function(size, fill, encoding) { if (typeof size !== "number") { throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size); } if (size < 0 || size >= 2 * (1 << 30)) { throw new RangeError('The value "' + size + '" is invalid for option "size"'); } var buf = Buffer2(size); if (!fill || fill.length === 0) { buf.fill(0); } else if (typeof encoding === "string") { buf.fill(fill, encoding); } else { buf.fill(fill); } return buf; }; } if (!safer.kStringMaxLength) { try { safer.kStringMaxLength = process.binding("buffer").kStringMaxLength; } catch (e) {} } if (!safer.constants) { safer.constants = { MAX_LENGTH: safer.kMaxLength }; if (safer.kStringMaxLength) { safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength; } } module.exports = safer; }); // node_modules/iconv-lite/lib/bom-handling.js var require_bom_handling = __commonJS((exports) => { var BOMChar = "\uFEFF"; exports.PrependBOM = PrependBOMWrapper; function PrependBOMWrapper(encoder, options) { this.encoder = encoder; this.addBOM = true; } PrependBOMWrapper.prototype.write = function(str) { if (this.addBOM) { str = BOMChar + str; this.addBOM = false; } return this.encoder.write(str); }; PrependBOMWrapper.prototype.end = function() { return this.encoder.end(); }; exports.StripBOM = StripBOMWrapper; function StripBOMWrapper(decoder, options) { this.decoder = decoder; this.pass = false; this.options = options || {}; } StripBOMWrapper.prototype.write = function(buf) { var res = this.decoder.write(buf); if (this.pass || !res) return res; if (res[0] === BOMChar) { res = res.slice(1); if (typeof this.options.stripBOM === "function") this.options.stripBOM(); } this.pass = true; return res; }; StripBOMWrapper.prototype.end = function() { return this.decoder.end(); }; }); // node_modules/iconv-lite/encodings/internal.js var require_internal = __commonJS((exports, module) => { var Buffer2 = require_safer().Buffer; module.exports = { utf8: { type: "_internal", bomAware: true }, cesu8: { type: "_internal", bomAware: true }, unicode11utf8: "utf8", ucs2: { type: "_internal", bomAware: true }, utf16le: "ucs2", binary: { type: "_internal" }, base64: { type: "_internal" }, hex: { type: "_internal" }, _internal: InternalCodec }; function InternalCodec(codecOptions, iconv) { this.enc = codecOptions.encodingName; this.bomAware = codecOptions.bomAware; if (this.enc === "base64") this.encoder = InternalEncoderBase64; else if (this.enc === "cesu8") { this.enc = "utf8"; this.encoder = InternalEncoderCesu8; if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\uD83D\uDCA9") { this.decoder = InternalDecoderCesu8; this.defaultCharUnicode = iconv.defaultCharUnicode; } } } InternalCodec.prototype.encoder = InternalEncoder; InternalCodec.prototype.decoder = InternalDecoder; var StringDecoder = __require("string_decoder").StringDecoder; if (!StringDecoder.prototype.end) StringDecoder.prototype.end = function() {}; function InternalDecoder(options, codec) { this.decoder = new StringDecoder(codec.enc); } InternalDecoder.prototype.write = function(buf) { if (!Buffer2.isBuffer(buf)) { buf = Buffer2.from(buf); } return this.decoder.write(buf); }; InternalDecoder.prototype.end = function() { return this.decoder.end(); }; function InternalEncoder(options, codec) { this.enc = codec.enc; } InternalEncoder.prototype.write = function(str) { return Buffer2.from(str, this.enc); }; InternalEncoder.prototype.end = function() {}; function InternalEncoderBase64(options, codec) { this.prevStr = ""; } InternalEncoderBase64.prototype.write = function(str) { str = this.prevStr + str; var completeQuads = str.length - str.length % 4; this.prevStr = str.slice(completeQuads); str = str.slice(0, completeQuads); return Buffer2.from(str, "base64"); }; InternalEncoderBase64.prototype.end = function() { return Buffer2.from(this.prevStr, "base64"); }; function InternalEncoderCesu8(options, codec) {} InternalEncoderCesu8.prototype.write = function(str) { var buf = Buffer2.alloc(str.length * 3), bufIdx = 0; for (var i = 0;i < str.length; i++) { var charCode = str.charCodeAt(i); if (charCode < 128) buf[bufIdx++] = charCode; else if (charCode < 2048) { buf[bufIdx++] = 192 + (charCode >>> 6); buf[bufIdx++] = 128 + (charCode & 63); } else { buf[bufIdx++] = 224 + (charCode >>> 12); buf[bufIdx++] = 128 + (charCode >>> 6 & 63); buf[bufIdx++] = 128 + (charCode & 63); } } return buf.slice(0, bufIdx); }; InternalEncoderCesu8.prototype.end = function() {}; function InternalDecoderCesu8(options, codec) { this.acc = 0; this.contBytes = 0; this.accBytes = 0; this.defaultCharUnicode = codec.defaultCharUnicode; } InternalDecoderCesu8.prototype.write = function(buf) { var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, res = ""; for (var i = 0;i < buf.length; i++) { var curByte = buf[i]; if ((curByte & 192) !== 128) { if (contBytes > 0) { res += this.defaultCharUnicode; contBytes = 0; } if (curByte < 128) { res += String.fromCharCode(curByte); } else if (curByte < 224) { acc = curByte & 31; contBytes = 1; accBytes = 1; } else if (curByte < 240) { acc = curByte & 15; contBytes = 2; accBytes = 1; } else { res += this.defaultCharUnicode; } } else { if (contBytes > 0) { acc = acc << 6 | curByte & 63; contBytes--; accBytes++; if (contBytes === 0) { if (accBytes === 2 && acc < 128 && acc > 0) res += this.defaultCharUnicode; else if (accBytes === 3 && acc < 2048) res += this.defaultCharUnicode; else res += String.fromCharCode(acc); } } else { res += this.defaultCharUnicode; } } } this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; return res; }; InternalDecoderCesu8.prototype.end = function() { var res = 0; if (this.contBytes > 0) res += this.defaultCharUnicode; return res; }; }); // node_modules/iconv-lite/encodings/utf32.js var require_utf32 = __commonJS((exports) => { var Buffer2 = require_safer().Buffer; exports._utf32 = Utf32Codec; function Utf32Codec(codecOptions, iconv) { this.iconv = iconv; this.bomAware = true; this.isLE = codecOptions.isLE; } exports.utf32le = { type: "_utf32", isLE: true }; exports.utf32be = { type: "_utf32", isLE: false }; exports.ucs4le = "utf32le"; exports.ucs4be = "utf32be"; Utf32Codec.prototype.encoder = Utf32Encoder; Utf32Codec.prototype.decoder = Utf32Decoder; function Utf32Encoder(options, codec) { this.isLE = codec.isLE; this.highSurrogate = 0; } Utf32Encoder.prototype.write = function(str) { var src = Buffer2.from(str, "ucs2"); var dst = Buffer2.alloc(src.length * 2); var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE; var offset = 0; for (var i = 0;i < src.length; i += 2) { var code = src.readUInt16LE(i); var isHighSurrogate = 55296 <= code && code < 56320; var isLowSurrogate = 56320 <= code && code < 57344; if (this.highSurrogate) { if (isHighSurrogate || !isLowSurrogate) { write32.call(dst, this.highSurrogate, offset); offset += 4; } else { var codepoint = (this.highSurrogate - 55296 << 10 | code - 56320) + 65536; write32.call(dst, codepoint, offset); offset += 4; this.highSurrogate = 0; continue; } } if (isHighSurrogate) this.highSurrogate = code; else { write32.call(dst, code, offset); offset += 4; this.highSurrogate = 0; } } if (offset < dst.length) dst = dst.slice(0, offset); return dst; }; Utf32Encoder.prototype.end = function() { if (!this.highSurrogate) return; var buf = Buffer2.alloc(4); if (this.isLE) buf.writeUInt32LE(this.highSurrogate, 0); else buf.writeUInt32BE(this.highSurrogate, 0); this.highSurrogate = 0; return buf; }; function Utf32Decoder(options, codec) { this.isLE = codec.isLE; this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0); this.overflow = []; } Utf32Decoder.prototype.write = function(src) { if (src.length === 0) return ""; var i = 0; var codepoint = 0; var dst = Buffer2.alloc(src.length + 4); var offset = 0; var isLE = this.isLE; var overflow = this.overflow; var badChar = this.badChar; if (overflow.length > 0) { for (;i < src.length && overflow.length < 4; i++) overflow.push(src[i]); if (overflow.length === 4) { if (isLE) { codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24; } else { codepoint = overflow[i + 3] | overflow[i + 2] << 8 | overflow[i + 1] << 16 | overflow[i] << 24; } overflow.length = 0; offset = _writeCodepoint(dst, offset, codepoint, badChar); } } for (;i < src.length - 3; i += 4) { if (isLE) { codepoint = src[i] | src[i + 1] << 8 | src[i + 2] << 16 | src[i + 3] << 24; } else { codepoint = src[i + 3] | src[i + 2] << 8 | src[i + 1] << 16 | src[i] << 24; } offset = _writeCodepoint(dst, offset, codepoint, badChar); } for (;i < src.length; i++) { overflow.push(src[i]); } return dst.slice(0, offset).toString("ucs2"); }; function _writeCodepoint(dst, offset, codepoint, badChar) { if (codepoint < 0 || codepoint > 1114111) { codepoint = badChar; } if (codepoint >= 65536) { codepoint -= 65536; var high = 55296 | codepoint >> 10; dst[offset++] = high & 255; dst[offset++] = high >> 8; var codepoint = 56320 | codepoint & 1023; } dst[offset++] = codepoint & 255; dst[offset++] = codepoint >> 8; return offset; } Utf32Decoder.prototype.end = function() { this.overflow.length = 0; }; exports.utf32 = Utf32AutoCodec; exports.ucs4 = "utf32"; function Utf32AutoCodec(options, iconv) { this.iconv = iconv; } Utf32AutoCodec.prototype.encoder = Utf32AutoEncoder; Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder; function Utf32AutoEncoder(options, codec) { options = options || {}; if (options.addBOM === undefined) options.addBOM = true; this.encoder = codec.iconv.getEncoder(options.defaultEncoding || "utf-32le", options); } Utf32AutoEncoder.prototype.write = function(str) { return this.encoder.write(str); }; Utf32AutoEncoder.prototype.end = function() { return this.encoder.end(); }; function Utf32AutoDecoder(options, codec) { this.decoder = null; this.initialBufs = []; this.initialBufsLen = 0; this.options = options || {}; this.iconv = codec.iconv; } Utf32AutoDecoder.prototype.write = function(buf) { if (!this.decoder) { this.initialBufs.push(buf); this.initialBufsLen += buf.length; if (this.initialBufsLen < 32) return ""; var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); this.decoder = this.iconv.getDecoder(encoding, this.options); var resStr = ""; for (var i = 0;i < this.initialBufs.length; i++) resStr += this.decoder.write(this.initialBufs[i]); this.initialBufs.length = this.initialBufsLen = 0; return resStr; } return this.decoder.write(buf); }; Utf32AutoDecoder.prototype.end = function() { if (!this.decoder) { var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); this.decoder = this.iconv.getDecoder(encoding, this.options); var resStr = ""; for (var i = 0;i < this.initialBufs.length; i++) resStr += this.decoder.write(this.initialBufs[i]); var trail = this.decoder.end(); if (trail) resStr += trail; this.initialBufs.length = this.initialBufsLen = 0; return resStr; } return this.decoder.end(); }; function detectEncoding(bufs, defaultEncoding) { var b = []; var charsProcessed = 0; var invalidLE = 0, invalidBE = 0; var bmpCharsLE = 0, bmpCharsBE = 0; outer_loop: for (var i = 0;i < bufs.length; i++) { var buf = bufs[i]; for (var j = 0;j < buf.length; j++) { b.push(buf[j]); if (b.length === 4) { if (charsProcessed === 0) { if (b[0] === 255 && b[1] === 254 && b[2] === 0 && b[3] === 0) { return "utf-32le"; } if (b[0] === 0 && b[1] === 0 && b[2] === 254 && b[3] === 255) { return "utf-32be"; } } if (b[0] !== 0 || b[1] > 16) invalidBE++; if (b[3] !== 0 || b[2] > 16) invalidLE++; if (b[0] === 0 && b[1] === 0 && (b[2] !== 0 || b[3] !== 0)) bmpCharsBE++; if ((b[0] !== 0 || b[1] !== 0) && b[2] === 0 && b[3] === 0) bmpCharsLE++; b.length = 0; charsProcessed++; if (charsProcessed >= 100) { break outer_loop; } } } } if (bmpCharsBE - invalidBE > bmpCharsLE - invalidLE) return "utf-32be"; if (bmpCharsBE - invalidBE < bmpCharsLE - invalidLE) return "utf-32le"; return defaultEncoding || "utf-32le"; } }); // node_modules/iconv-lite/encodings/utf16.js var require_utf16 = __commonJS((exports) => { var Buffer2 = require_safer().Buffer; exports.utf16be = Utf16BECodec; function Utf16BECodec() {} Utf16BECodec.prototype.encoder = Utf16BEEncoder; Utf16BECodec.prototype.decoder = Utf16BEDecoder; Utf16BECodec.prototype.bomAware = true; function Utf16BEEncoder() {} Utf16BEEncoder.prototype.write = function(str) { var buf = Buffer2.from(str, "ucs2"); for (var i = 0;i < buf.length; i += 2) { var tmp = buf[i]; buf[i] = buf[i + 1]; buf[i + 1] = tmp; } return buf; }; Utf16BEEncoder.prototype.end = function() {}; function Utf16BEDecoder() { this.overflowByte = -1; } Utf16BEDecoder.prototype.write = function(buf) { if (buf.length == 0) return ""; var buf2 = Buffer2.alloc(buf.length + 1), i = 0, j = 0; if (this.overflowByte !== -1) { buf2[0] = buf[0]; buf2[1] = this.overflowByte; i = 1; j = 2; } for (;i < buf.length - 1; i += 2, j += 2) { buf2[j] = buf[i + 1]; buf2[j + 1] = buf[i]; } this.overflowByte = i == buf.length - 1 ? buf[buf.length - 1] : -1; return buf2.slice(0, j).toString("ucs2"); }; Utf16BEDecoder.prototype.end = function() { this.overflowByte = -1; }; exports.utf16 = Utf16Codec; function Utf16Codec(codecOptions, iconv) { this.iconv = iconv; } Utf16Codec.prototype.encoder = Utf16Encoder; Utf16Codec.prototype.decoder = Utf16Decoder; function Utf16Encoder(options, codec) { options = options || {}; if (options.addBOM === undefined) options.addBOM = true; this.encoder = codec.iconv.getEncoder("utf-16le", options); } Utf16Encoder.prototype.write = function(str) { return this.encoder.write(str); }; Utf16Encoder.prototype.end = function() { return this.encoder.end(); }; function Utf16Decoder(options, codec) { this.decoder = null; this.initialBufs = []; this.initialBufsLen = 0; this.options = options || {}; this.iconv = codec.iconv; } Utf16Decoder.prototype.write = function(buf) { if (!this.decoder) { this.initialBufs.push(buf); this.initialBufsLen += buf.length; if (this.initialBufsLen < 16) return ""; var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); this.decoder = this.iconv.getDecoder(encoding, this.options); var resStr = ""; for (var i = 0;i < this.initialBufs.length; i++) resStr += this.decoder.write(this.initialBufs[i]); this.initialBufs.length = this.initialBufsLen = 0; return resStr; } return this.decoder.write(buf); }; Utf16Decoder.prototype.end = function() { if (!this.decoder) { var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); this.decoder = this.iconv.getDecoder(encoding, this.options); var resStr = ""; for (var i = 0;i < this.initialBufs.length; i++) resStr += this.decoder.write(this.initialBufs[i]); var trail = this.decoder.end(); if (trail) resStr += trail; this.initialBufs.length = this.initialBufsLen = 0; return resStr; } return this.decoder.end(); }; function detectEncoding(bufs, defaultEncoding) { var b = []; var charsProcessed = 0; var asciiCharsLE = 0, asciiCharsBE = 0; outer_loop: for (var i = 0;i < bufs.length; i++) { var buf = bufs[i]; for (var j = 0;j < buf.length; j++) { b.push(buf[j]); if (b.length === 2) { if (charsProcessed === 0) { if (b[0] === 255 && b[1] === 254) return "utf-16le"; if (b[0] === 254 && b[1] === 255) return "utf-16be"; } if (b[0] === 0 && b[1] !== 0) asciiCharsBE++; if (b[0] !== 0 && b[1] === 0) asciiCharsLE++; b.length = 0; charsProcessed++; if (charsProcessed >= 100) { break outer_loop; } } } } if (asciiCharsBE > asciiCharsLE) return "utf-16be"; if (asciiCharsBE < asciiCharsLE) return "utf-16le"; return defaultEncoding || "utf-16le"; } }); // node_modules/iconv-lite/encodings/utf7.js var require_utf7 = __commonJS((exports) => { var Buffer2 = require_safer().Buffer; exports.utf7 = Utf7Codec; exports.unicode11utf7 = "utf7"; function Utf7Codec(codecOptions, iconv) { this.iconv = iconv; } Utf7Codec.prototype.encoder = Utf7Encoder; Utf7Codec.prototype.decoder = Utf7Decoder; Utf7Codec.prototype.bomAware = true; var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; function Utf7Encoder(options, codec) { this.iconv = codec.iconv; } Utf7Encoder.prototype.write = function(str) { return Buffer2.from(str.replace(nonDirectChars, function(chunk) { return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-"; }.bind(this))); }; Utf7Encoder.prototype.end = function() {}; function Utf7Decoder(options, codec) { this.iconv = codec.iconv; this.inBase64 = false; this.base64Accum = ""; } var base64Regex2 = /[A-Za-z0-9\/+]/; var base64Chars = []; for (i = 0;i < 256; i++) base64Chars[i] = base64Regex2.test(String.fromCharCode(i)); var i; var plusChar = 43; var minusChar = 45; var andChar = 38; Utf7Decoder.prototype.write = function(buf) { var res = "", lastI = 0, inBase64 = this.inBase64, base64Accum = this.base64Accum; for (var i2 = 0;i2 < buf.length; i2++) { if (!inBase64) { if (buf[i2] == plusChar) { res += this.iconv.decode(buf.slice(lastI, i2), "ascii"); lastI = i2 + 1; inBase64 = true; } } else { if (!base64Chars[buf[i2]]) { if (i2 == lastI && buf[i2] == minusChar) { res += "+"; } else { var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii"); res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be"); } if (buf[i2] != minusChar) i2--; lastI = i2 + 1; inBase64 = false; base64Accum = ""; } } } if (!inBase64) { res += this.iconv.decode(buf.slice(lastI), "ascii"); } else { var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii"); var canBeDecoded = b64str.length - b64str.length % 8; base64Accum = b64str.slice(canBeDecoded); b64str = b64str.slice(0, canBeDecoded); res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be"); } this.inBase64 = inBase64; this.base64Accum = base64Accum; return res; }; Utf7Decoder.prototype.end = function() { var res = ""; if (this.inBase64 && this.base64Accum.length > 0) res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be"); this.inBase64 = false; this.base64Accum = ""; return res; }; exports.utf7imap = Utf7IMAPCodec; function Utf7IMAPCodec(codecOptions, iconv) { this.iconv = iconv; } Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; Utf7IMAPCodec.prototype.bomAware = true; function Utf7IMAPEncoder(options, codec) { this.iconv = codec.iconv; this.inBase64 = false; this.base64Accum = Buffer2.alloc(6); this.base64AccumIdx = 0; } Utf7IMAPEncoder.prototype.write = function(str) { var inBase64 = this.inBase64, base64Accum = this.base64Accum, base64AccumIdx = this.base64AccumIdx, buf = Buffer2.alloc(str.length * 5 + 10), bufIdx = 0; for (var i2 = 0;i2 < str.length; i2++) { var uChar = str.charCodeAt(i2); if (32 <= uChar && uChar <= 126) { if (inBase64) { if (base64AccumIdx > 0) { bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx); base64AccumIdx = 0; } buf[bufIdx++] = minusChar; inBase64 = false; } if (!inBase64) { buf[bufIdx++] = uChar; if (uChar === andChar) buf[bufIdx++] = minusChar; } } else { if (!inBase64) { buf[bufIdx++] = andChar; inBase64 = true; } if (inBase64) { base64Accum[base64AccumIdx++] = uChar >> 8; base64Accum[base64AccumIdx++] = uChar & 255; if (base64AccumIdx == base64Accum.length) { bufIdx += buf.write(base64Accum.toString("base64").replace(/\//g, ","), bufIdx); base64AccumIdx = 0; } } } } this.inBase64 = inBase64; this.base64AccumIdx = base64AccumIdx; return buf.slice(0, bufIdx); }; Utf7IMAPEncoder.prototype.end = function() { var buf = Buffer2.alloc(10), bufIdx = 0; if (this.inBase64) { if (this.base64AccumIdx > 0) { bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx); this.base64AccumIdx = 0; } buf[bufIdx++] = minusChar;