redstone-clara-sdk
Version:
A SDK for C.L.A.R.A.
1,552 lines (1,534 loc) • 1.94 MB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod2) => function __require() {
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from5, except, desc) => {
if (from5 && typeof from5 === "object" || typeof from5 === "function") {
for (let key of __getOwnPropNames(from5))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from5[key], enumerable: !(desc = __getOwnPropDesc(from5, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
mod2
));
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
// node_modules/obliterator/iterator.js
var require_iterator = __commonJS({
"node_modules/obliterator/iterator.js"(exports2, module2) {
function Iterator(next) {
if (typeof next !== "function")
throw new Error("obliterator/iterator: expecting a function!");
this.next = next;
}
if (typeof Symbol !== "undefined")
Iterator.prototype[Symbol.iterator] = function() {
return this;
};
Iterator.of = function() {
var args = arguments, l = args.length, i = 0;
return new Iterator(function() {
if (i >= l) return { done: true };
return { done: false, value: args[i++] };
});
};
Iterator.empty = function() {
var iterator = new Iterator(function() {
return { done: true };
});
return iterator;
};
Iterator.fromSequence = function(sequence) {
var i = 0, l = sequence.length;
return new Iterator(function() {
if (i >= l) return { done: true };
return { done: false, value: sequence[i++] };
});
};
Iterator.is = function(value) {
if (value instanceof Iterator) return true;
return typeof value === "object" && value !== null && typeof value.next === "function";
};
module2.exports = Iterator;
}
});
// node_modules/obliterator/support.js
var require_support = __commonJS({
"node_modules/obliterator/support.js"(exports2) {
exports2.ARRAY_BUFFER_SUPPORT = typeof ArrayBuffer !== "undefined";
exports2.SYMBOL_SUPPORT = typeof Symbol !== "undefined";
}
});
// node_modules/obliterator/foreach.js
var require_foreach = __commonJS({
"node_modules/obliterator/foreach.js"(exports2, module2) {
var support = require_support();
var ARRAY_BUFFER_SUPPORT = support.ARRAY_BUFFER_SUPPORT;
var SYMBOL_SUPPORT = support.SYMBOL_SUPPORT;
module2.exports = function forEach(iterable, callback) {
var iterator, k, i, l, s;
if (!iterable) throw new Error("obliterator/forEach: invalid iterable.");
if (typeof callback !== "function")
throw new Error("obliterator/forEach: expecting a callback.");
if (Array.isArray(iterable) || ARRAY_BUFFER_SUPPORT && ArrayBuffer.isView(iterable) || typeof iterable === "string" || iterable.toString() === "[object Arguments]") {
for (i = 0, l = iterable.length; i < l; i++) callback(iterable[i], i);
return;
}
if (typeof iterable.forEach === "function") {
iterable.forEach(callback);
return;
}
if (SYMBOL_SUPPORT && Symbol.iterator in iterable && typeof iterable.next !== "function") {
iterable = iterable[Symbol.iterator]();
}
if (typeof iterable.next === "function") {
iterator = iterable;
i = 0;
while (s = iterator.next(), s.done !== true) {
callback(s.value, i);
i++;
}
return;
}
for (k in iterable) {
if (iterable.hasOwnProperty(k)) {
callback(iterable[k], k);
}
}
return;
};
}
});
// node_modules/mnemonist/utils/typed-arrays.js
var require_typed_arrays = __commonJS({
"node_modules/mnemonist/utils/typed-arrays.js"(exports2) {
var MAX_8BIT_INTEGER = Math.pow(2, 8) - 1;
var MAX_16BIT_INTEGER = Math.pow(2, 16) - 1;
var MAX_32BIT_INTEGER = Math.pow(2, 32) - 1;
var MAX_SIGNED_8BIT_INTEGER = Math.pow(2, 7) - 1;
var MAX_SIGNED_16BIT_INTEGER = Math.pow(2, 15) - 1;
var MAX_SIGNED_32BIT_INTEGER = Math.pow(2, 31) - 1;
exports2.getPointerArray = function(size5) {
var maxIndex = size5 - 1;
if (maxIndex <= MAX_8BIT_INTEGER)
return Uint8Array;
if (maxIndex <= MAX_16BIT_INTEGER)
return Uint16Array;
if (maxIndex <= MAX_32BIT_INTEGER)
return Uint32Array;
throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.");
};
exports2.getSignedPointerArray = function(size5) {
var maxIndex = size5 - 1;
if (maxIndex <= MAX_SIGNED_8BIT_INTEGER)
return Int8Array;
if (maxIndex <= MAX_SIGNED_16BIT_INTEGER)
return Int16Array;
if (maxIndex <= MAX_SIGNED_32BIT_INTEGER)
return Int32Array;
return Float64Array;
};
exports2.getNumberType = function(value) {
if (value === (value | 0)) {
if (Math.sign(value) === -1) {
if (value <= 127 && value >= -128)
return Int8Array;
if (value <= 32767 && value >= -32768)
return Int16Array;
return Int32Array;
} else {
if (value <= 255)
return Uint8Array;
if (value <= 65535)
return Uint16Array;
return Uint32Array;
}
}
return Float64Array;
};
var TYPE_PRIORITY = {
Uint8Array: 1,
Int8Array: 2,
Uint16Array: 3,
Int16Array: 4,
Uint32Array: 5,
Int32Array: 6,
Float32Array: 7,
Float64Array: 8
};
exports2.getMinimalRepresentation = function(array, getter) {
var maxType = null, maxPriority = 0, p, t, v, i, l;
for (i = 0, l = array.length; i < l; i++) {
v = getter ? getter(array[i]) : array[i];
t = exports2.getNumberType(v);
p = TYPE_PRIORITY[t.name];
if (p > maxPriority) {
maxPriority = p;
maxType = t;
}
}
return maxType;
};
exports2.isTypedArray = function(value) {
return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value);
};
exports2.concat = function() {
var length = 0, i, o, l;
for (i = 0, l = arguments.length; i < l; i++)
length += arguments[i].length;
var array = new arguments[0].constructor(length);
for (i = 0, o = 0; i < l; i++) {
array.set(arguments[i], o);
o += arguments[i].length;
}
return array;
};
exports2.indices = function(length) {
var PointerArray = exports2.getPointerArray(length);
var array = new PointerArray(length);
for (var i = 0; i < length; i++)
array[i] = i;
return array;
};
}
});
// node_modules/mnemonist/utils/iterables.js
var require_iterables = __commonJS({
"node_modules/mnemonist/utils/iterables.js"(exports2) {
var forEach = require_foreach();
var typed = require_typed_arrays();
function isArrayLike2(target) {
return Array.isArray(target) || typed.isTypedArray(target);
}
function guessLength(target) {
if (typeof target.length === "number")
return target.length;
if (typeof target.size === "number")
return target.size;
return;
}
function toArray(target) {
var l = guessLength(target);
var array = typeof l === "number" ? new Array(l) : [];
var i = 0;
forEach(target, function(value) {
array[i++] = value;
});
return array;
}
function toArrayWithIndices(target) {
var l = guessLength(target);
var IndexArray = typeof l === "number" ? typed.getPointerArray(l) : Array;
var array = typeof l === "number" ? new Array(l) : [];
var indices = typeof l === "number" ? new IndexArray(l) : [];
var i = 0;
forEach(target, function(value) {
array[i] = value;
indices[i] = i++;
});
return [array, indices];
}
exports2.isArrayLike = isArrayLike2;
exports2.guessLength = guessLength;
exports2.toArray = toArray;
exports2.toArrayWithIndices = toArrayWithIndices;
}
});
// node_modules/mnemonist/lru-cache.js
var require_lru_cache = __commonJS({
"node_modules/mnemonist/lru-cache.js"(exports2, module2) {
var Iterator = require_iterator();
var forEach = require_foreach();
var typed = require_typed_arrays();
var iterables = require_iterables();
function LRUCache2(Keys, Values, capacity) {
if (arguments.length < 2) {
capacity = Keys;
Keys = null;
Values = null;
}
this.capacity = capacity;
if (typeof this.capacity !== "number" || this.capacity <= 0)
throw new Error("mnemonist/lru-cache: capacity should be positive number.");
else if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity)
throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");
var PointerArray = typed.getPointerArray(capacity);
this.forward = new PointerArray(capacity);
this.backward = new PointerArray(capacity);
this.K = typeof Keys === "function" ? new Keys(capacity) : new Array(capacity);
this.V = typeof Values === "function" ? new Values(capacity) : new Array(capacity);
this.size = 0;
this.head = 0;
this.tail = 0;
this.items = {};
}
LRUCache2.prototype.clear = function() {
this.size = 0;
this.head = 0;
this.tail = 0;
this.items = {};
};
LRUCache2.prototype.splayOnTop = function(pointer) {
var oldHead = this.head;
if (this.head === pointer)
return this;
var previous = this.backward[pointer], next = this.forward[pointer];
if (this.tail === pointer) {
this.tail = previous;
} else {
this.backward[next] = previous;
}
this.forward[previous] = next;
this.backward[oldHead] = pointer;
this.head = pointer;
this.forward[pointer] = oldHead;
return this;
};
LRUCache2.prototype.set = function(key, value) {
var pointer = this.items[key];
if (typeof pointer !== "undefined") {
this.splayOnTop(pointer);
this.V[pointer] = value;
return;
}
if (this.size < this.capacity) {
pointer = this.size++;
} else {
pointer = this.tail;
this.tail = this.backward[pointer];
delete this.items[this.K[pointer]];
}
this.items[key] = pointer;
this.K[pointer] = key;
this.V[pointer] = value;
this.forward[pointer] = this.head;
this.backward[this.head] = pointer;
this.head = pointer;
};
LRUCache2.prototype.setpop = function(key, value) {
var oldValue = null;
var oldKey = null;
var pointer = this.items[key];
if (typeof pointer !== "undefined") {
this.splayOnTop(pointer);
oldValue = this.V[pointer];
this.V[pointer] = value;
return { evicted: false, key, value: oldValue };
}
if (this.size < this.capacity) {
pointer = this.size++;
} else {
pointer = this.tail;
this.tail = this.backward[pointer];
oldValue = this.V[pointer];
oldKey = this.K[pointer];
delete this.items[oldKey];
}
this.items[key] = pointer;
this.K[pointer] = key;
this.V[pointer] = value;
this.forward[pointer] = this.head;
this.backward[this.head] = pointer;
this.head = pointer;
if (oldKey) {
return { evicted: true, key: oldKey, value: oldValue };
} else {
return null;
}
};
LRUCache2.prototype.has = function(key) {
return key in this.items;
};
LRUCache2.prototype.get = function(key) {
var pointer = this.items[key];
if (typeof pointer === "undefined")
return;
this.splayOnTop(pointer);
return this.V[pointer];
};
LRUCache2.prototype.peek = function(key) {
var pointer = this.items[key];
if (typeof pointer === "undefined")
return;
return this.V[pointer];
};
LRUCache2.prototype.forEach = function(callback, scope) {
scope = arguments.length > 1 ? scope : this;
var i = 0, l = this.size;
var pointer = this.head, keys4 = this.K, values = this.V, forward = this.forward;
while (i < l) {
callback.call(scope, values[pointer], keys4[pointer], this);
pointer = forward[pointer];
i++;
}
};
LRUCache2.prototype.keys = function() {
var i = 0, l = this.size;
var pointer = this.head, keys4 = this.K, forward = this.forward;
return new Iterator(function() {
if (i >= l)
return { done: true };
var key = keys4[pointer];
i++;
if (i < l)
pointer = forward[pointer];
return {
done: false,
value: key
};
});
};
LRUCache2.prototype.values = function() {
var i = 0, l = this.size;
var pointer = this.head, values = this.V, forward = this.forward;
return new Iterator(function() {
if (i >= l)
return { done: true };
var value = values[pointer];
i++;
if (i < l)
pointer = forward[pointer];
return {
done: false,
value
};
});
};
LRUCache2.prototype.entries = function() {
var i = 0, l = this.size;
var pointer = this.head, keys4 = this.K, values = this.V, forward = this.forward;
return new Iterator(function() {
if (i >= l)
return { done: true };
var key = keys4[pointer], value = values[pointer];
i++;
if (i < l)
pointer = forward[pointer];
return {
done: false,
value: [key, value]
};
});
};
if (typeof Symbol !== "undefined")
LRUCache2.prototype[Symbol.iterator] = LRUCache2.prototype.entries;
LRUCache2.prototype.inspect = function() {
var proxy = /* @__PURE__ */ new Map();
var iterator = this.entries(), step;
while (step = iterator.next(), !step.done)
proxy.set(step.value[0], step.value[1]);
Object.defineProperty(proxy, "constructor", {
value: LRUCache2,
enumerable: false
});
return proxy;
};
if (typeof Symbol !== "undefined")
LRUCache2.prototype[Symbol.for("nodejs.util.inspect.custom")] = LRUCache2.prototype.inspect;
LRUCache2.from = function(iterable, Keys, Values, capacity) {
if (arguments.length < 2) {
capacity = iterables.guessLength(iterable);
if (typeof capacity !== "number")
throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.");
} else if (arguments.length === 2) {
capacity = Keys;
Keys = null;
Values = null;
}
var cache = new LRUCache2(Keys, Values, capacity);
forEach(iterable, function(value, key) {
cache.set(key, value);
});
return cache;
};
module2.exports = LRUCache2;
}
});
// node_modules/mnemonist/lru-map.js
var require_lru_map = __commonJS({
"node_modules/mnemonist/lru-map.js"(exports2, module2) {
var LRUCache2 = require_lru_cache();
var forEach = require_foreach();
var typed = require_typed_arrays();
var iterables = require_iterables();
function LRUMap(Keys, Values, capacity) {
if (arguments.length < 2) {
capacity = Keys;
Keys = null;
Values = null;
}
this.capacity = capacity;
if (typeof this.capacity !== "number" || this.capacity <= 0)
throw new Error("mnemonist/lru-map: capacity should be positive number.");
else if (!isFinite(this.capacity) || Math.floor(this.capacity) !== this.capacity)
throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");
var PointerArray = typed.getPointerArray(capacity);
this.forward = new PointerArray(capacity);
this.backward = new PointerArray(capacity);
this.K = typeof Keys === "function" ? new Keys(capacity) : new Array(capacity);
this.V = typeof Values === "function" ? new Values(capacity) : new Array(capacity);
this.size = 0;
this.head = 0;
this.tail = 0;
this.items = /* @__PURE__ */ new Map();
}
LRUMap.prototype.clear = function() {
this.size = 0;
this.head = 0;
this.tail = 0;
this.items.clear();
};
LRUMap.prototype.set = function(key, value) {
var pointer = this.items.get(key);
if (typeof pointer !== "undefined") {
this.splayOnTop(pointer);
this.V[pointer] = value;
return;
}
if (this.size < this.capacity) {
pointer = this.size++;
} else {
pointer = this.tail;
this.tail = this.backward[pointer];
this.items.delete(this.K[pointer]);
}
this.items.set(key, pointer);
this.K[pointer] = key;
this.V[pointer] = value;
this.forward[pointer] = this.head;
this.backward[this.head] = pointer;
this.head = pointer;
};
LRUMap.prototype.setpop = function(key, value) {
var oldValue = null;
var oldKey = null;
var pointer = this.items.get(key);
if (typeof pointer !== "undefined") {
this.splayOnTop(pointer);
oldValue = this.V[pointer];
this.V[pointer] = value;
return { evicted: false, key, value: oldValue };
}
if (this.size < this.capacity) {
pointer = this.size++;
} else {
pointer = this.tail;
this.tail = this.backward[pointer];
oldValue = this.V[pointer];
oldKey = this.K[pointer];
this.items.delete(oldKey);
}
this.items.set(key, pointer);
this.K[pointer] = key;
this.V[pointer] = value;
this.forward[pointer] = this.head;
this.backward[this.head] = pointer;
this.head = pointer;
if (oldKey) {
return { evicted: true, key: oldKey, value: oldValue };
} else {
return null;
}
};
LRUMap.prototype.has = function(key) {
return this.items.has(key);
};
LRUMap.prototype.get = function(key) {
var pointer = this.items.get(key);
if (typeof pointer === "undefined")
return;
this.splayOnTop(pointer);
return this.V[pointer];
};
LRUMap.prototype.peek = function(key) {
var pointer = this.items.get(key);
if (typeof pointer === "undefined")
return;
return this.V[pointer];
};
LRUMap.prototype.splayOnTop = LRUCache2.prototype.splayOnTop;
LRUMap.prototype.forEach = LRUCache2.prototype.forEach;
LRUMap.prototype.keys = LRUCache2.prototype.keys;
LRUMap.prototype.values = LRUCache2.prototype.values;
LRUMap.prototype.entries = LRUCache2.prototype.entries;
if (typeof Symbol !== "undefined")
LRUMap.prototype[Symbol.iterator] = LRUMap.prototype.entries;
LRUMap.prototype.inspect = LRUCache2.prototype.inspect;
LRUMap.from = function(iterable, Keys, Values, capacity) {
if (arguments.length < 2) {
capacity = iterables.guessLength(iterable);
if (typeof capacity !== "number")
throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.");
} else if (arguments.length === 2) {
capacity = Keys;
Keys = null;
Values = null;
}
var cache = new LRUMap(Keys, Values, capacity);
forEach(iterable, function(value, key) {
cache.set(key, value);
});
return cache;
};
module2.exports = LRUMap;
}
});
// node_modules/ms/index.js
var require_ms = __commonJS({
"node_modules/ms/index.js"(exports2, module2) {
var s = 1e3;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var w = d * 7;
var y = d * 365.25;
module2.exports = function(val, options) {
options = options || {};
var type3 = typeof val;
if (type3 === "string" && val.length > 0) {
return parse(val);
} else if (type3 === "number" && isFinite(val)) {
return options.long ? fmtLong(val) : fmtShort(val);
}
throw new Error(
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
);
};
function parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
str
);
if (!match) {
return;
}
var n = parseFloat(match[1]);
var type3 = (match[2] || "ms").toLowerCase();
switch (type3) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return n * y;
case "weeks":
case "week":
case "w":
return n * w;
case "days":
case "day":
case "d":
return n * d;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return n * h;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return n * m;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return n * s;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return n;
default:
return void 0;
}
}
function fmtShort(ms) {
var msAbs = Math.abs(ms);
if (msAbs >= d) {
return Math.round(ms / d) + "d";
}
if (msAbs >= h) {
return Math.round(ms / h) + "h";
}
if (msAbs >= m) {
return Math.round(ms / m) + "m";
}
if (msAbs >= s) {
return Math.round(ms / s) + "s";
}
return ms + "ms";
}
function fmtLong(ms) {
var msAbs = Math.abs(ms);
if (msAbs >= d) {
return plural(ms, msAbs, d, "day");
}
if (msAbs >= h) {
return plural(ms, msAbs, h, "hour");
}
if (msAbs >= m) {
return plural(ms, msAbs, m, "minute");
}
if (msAbs >= s) {
return plural(ms, msAbs, s, "second");
}
return ms + " ms";
}
function plural(ms, msAbs, n, name) {
var isPlural = msAbs >= n * 1.5;
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
}
}
});
// node_modules/debug/src/common.js
var require_common = __commonJS({
"node_modules/debug/src/common.js"(exports2, module2) {
function setup(env) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce2;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = require_ms();
createDebug.destroy = destroy;
Object.keys(env).forEach((key) => {
createDebug[key] = env[key];
});
createDebug.names = [];
createDebug.skips = [];
createDebug.formatters = {};
function selectColor(namespace) {
let hash2 = 0;
for (let i = 0; i < namespace.length; i++) {
hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i);
hash2 |= 0;
}
return createDebug.colors[Math.abs(hash2) % createDebug.colors.length];
}
createDebug.selectColor = selectColor;
function createDebug(namespace) {
let prevTime;
let enableOverride = null;
let namespacesCache;
let enabledCache;
function debug2(...args) {
if (!debug2.enabled) {
return;
}
const self2 = debug2;
const curr = Number(/* @__PURE__ */ new Date());
const ms = curr - (prevTime || curr);
self2.diff = ms;
self2.prev = prevTime;
self2.curr = curr;
prevTime = curr;
args[0] = createDebug.coerce(args[0]);
if (typeof args[0] !== "string") {
args.unshift("%O");
}
let index2 = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
if (match === "%%") {
return "%";
}
index2++;
const formatter = createDebug.formatters[format];
if (typeof formatter === "function") {
const val = args[index2];
match = formatter.call(self2, val);
args.splice(index2, 1);
index2--;
}
return match;
});
createDebug.formatArgs.call(self2, args);
const logFn = self2.log || createDebug.log;
logFn.apply(self2, args);
}
debug2.namespace = namespace;
debug2.useColors = createDebug.useColors();
debug2.color = createDebug.selectColor(namespace);
debug2.extend = extend;
debug2.destroy = createDebug.destroy;
Object.defineProperty(debug2, "enabled", {
enumerable: true,
configurable: false,
get: () => {
if (enableOverride !== null) {
return enableOverride;
}
if (namespacesCache !== createDebug.namespaces) {
namespacesCache = createDebug.namespaces;
enabledCache = createDebug.enabled(namespace);
}
return enabledCache;
},
set: (v) => {
enableOverride = v;
}
});
if (typeof createDebug.init === "function") {
createDebug.init(debug2);
}
return debug2;
}
function extend(namespace, delimiter) {
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
newDebug.log = this.log;
return newDebug;
}
function enable(namespaces) {
createDebug.save(namespaces);
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];
const split2 = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
for (const ns of split2) {
if (ns[0] === "-") {
createDebug.skips.push(ns.slice(1));
} else {
createDebug.names.push(ns);
}
}
}
function matchesTemplate(search, template) {
let searchIndex = 0;
let templateIndex = 0;
let starIndex = -1;
let matchIndex = 0;
while (searchIndex < search.length) {
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
if (template[templateIndex] === "*") {
starIndex = templateIndex;
matchIndex = searchIndex;
templateIndex++;
} else {
searchIndex++;
templateIndex++;
}
} else if (starIndex !== -1) {
templateIndex = starIndex + 1;
matchIndex++;
searchIndex = matchIndex;
} else {
return false;
}
}
while (templateIndex < template.length && template[templateIndex] === "*") {
templateIndex++;
}
return templateIndex === template.length;
}
function disable() {
const namespaces = [
...createDebug.names,
...createDebug.skips.map((namespace) => "-" + namespace)
].join(",");
createDebug.enable("");
return namespaces;
}
function enabled(name) {
for (const skip of createDebug.skips) {
if (matchesTemplate(name, skip)) {
return false;
}
}
for (const ns of createDebug.names) {
if (matchesTemplate(name, ns)) {
return true;
}
}
return false;
}
function coerce2(val) {
if (val instanceof Error) {
return val.stack || val.message;
}
return val;
}
function destroy() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
}
createDebug.enable(createDebug.load());
return createDebug;
}
module2.exports = setup;
}
});
// node_modules/debug/src/browser.js
var require_browser = __commonJS({
"node_modules/debug/src/browser.js"(exports2, module2) {
exports2.formatArgs = formatArgs;
exports2.save = save;
exports2.load = load;
exports2.useColors = useColors;
exports2.storage = localstorage();
exports2.destroy = /* @__PURE__ */ (() => {
let warned2 = false;
return () => {
if (!warned2) {
warned2 = true;
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
}
};
})();
exports2.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"
];
function useColors() {
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
return true;
}
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
let m;
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
function formatArgs(args) {
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
if (!this.useColors) {
return;
}
const c = "color: " + this.color;
args.splice(1, 0, c, "color: inherit");
let index2 = 0;
let lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, (match) => {
if (match === "%%") {
return;
}
index2++;
if (match === "%c") {
lastC = index2;
}
});
args.splice(lastC, 0, c);
}
exports2.log = console.debug || console.log || (() => {
});
function save(namespaces) {
try {
if (namespaces) {
exports2.storage.setItem("debug", namespaces);
} else {
exports2.storage.removeItem("debug");
}
} catch (error) {
}
}
function load() {
let r;
try {
r = exports2.storage.getItem("debug");
} catch (error) {
}
if (!r && typeof process !== "undefined" && "env" in process) {
r = process.env.DEBUG;
}
return r;
}
function localstorage() {
try {
return localStorage;
} catch (error) {
}
}
module2.exports = require_common()(exports2);
var { formatters } = module2.exports;
formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (error) {
return "[UnexpectedJSONParseError]: " + error.message;
}
};
}
});
// node_modules/debug/src/node.js
var require_node = __commonJS({
"node_modules/debug/src/node.js"(exports2, module2) {
var tty = require("tty");
var util2 = require("util");
exports2.init = init;
exports2.log = log;
exports2.formatArgs = formatArgs;
exports2.save = save;
exports2.load = load;
exports2.useColors = useColors;
exports2.destroy = util2.deprecate(
() => {
},
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
);
exports2.colors = [6, 2, 3, 4, 5, 1];
try {
const supportsColor = require("supports-color");
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports2.colors = [
20,
21,
26,
27,
32,
33,
38,
39,
40,
41,
42,
43,
44,
45,
56,
57,
62,
63,
68,
69,
74,
75,
76,
77,
78,
79,
80,
81,
92,
93,
98,
99,
112,
113,
128,
129,
134,
135,
148,
149,
160,
161,
162,
163,
164,
165,
166,
167,
168,
169,
170,
171,
172,
173,
178,
179,
184,
185,
196,
197,
198,
199,
200,
201,
202,
203,
204,
205,
206,
207,
208,
209,
214,
215,
220,
221
];
}
} catch (error) {
}
exports2.inspectOpts = Object.keys(process.env).filter((key) => {
return /^debug_/i.test(key);
}).reduce((obj, key) => {
const prop3 = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
return k.toUpperCase();
});
let val = process.env[key];
if (/^(yes|on|true|enabled)$/i.test(val)) {
val = true;
} else if (/^(no|off|false|disabled)$/i.test(val)) {
val = false;
} else if (val === "null") {
val = null;
} else {
val = Number(val);
}
obj[prop3] = val;
return obj;
}, {});
function useColors() {
return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd);
}
function formatArgs(args) {
const { namespace: name, useColors: useColors2 } = this;
if (useColors2) {
const c = this.color;
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
} else {
args[0] = getDate() + name + " " + args[0];
}
}
function getDate() {
if (exports2.inspectOpts.hideDate) {
return "";
}
return (/* @__PURE__ */ new Date()).toISOString() + " ";
}
function log(...args) {
return process.stderr.write(util2.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
}
function save(namespaces) {
if (namespaces) {
process.env.DEBUG = namespaces;
} else {
delete process.env.DEBUG;
}
}
function load() {
return process.env.DEBUG;
}
function init(debug2) {
debug2.inspectOpts = {};
const keys4 = Object.keys(exports2.inspectOpts);
for (let i = 0; i < keys4.length; i++) {
debug2.inspectOpts[keys4[i]] = exports2.inspectOpts[keys4[i]];
}
}
module2.exports = require_common()(exports2);
var { formatters } = module2.exports;
formatters.o = function(v) {
this.inspectOpts.colors = this.useColors;
return util2.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
};
formatters.O = function(v) {
this.inspectOpts.colors = this.useColors;
return util2.inspect(v, this.inspectOpts);
};
}
});
// node_modules/debug/src/index.js
var require_src = __commonJS({
"node_modules/debug/src/index.js"(exports2, module2) {
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
module2.exports = require_browser();
} else {
module2.exports = require_node();
}
}
});
// node_modules/@permaweb/protocol-tag-utils/dist/index.cjs
var require_dist = __commonJS({
"node_modules/@permaweb/protocol-tag-utils/dist/index.cjs"(exports2, module2) {
var __defProp3 = Object.defineProperty;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __export3 = (target, all) => {
for (var name in all)
__defProp3(target, name, { get: all[name], enumerable: true });
};
var __copyProps2 = (to, from5, except, desc) => {
if (from5 && typeof from5 === "object" || typeof from5 === "function") {
for (let key of __getOwnPropNames2(from5))
if (!__hasOwnProp2.call(to, key) && key !== except)
__defProp3(to, key, { get: () => from5[key], enumerable: !(desc = __getOwnPropDesc2(from5, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS2 = (mod2) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod2);
var protocol_tag_utils_exports = {};
__export3(protocol_tag_utils_exports, {
concat: () => concat5,
concatUnassoc: () => concatUnassoc3,
create: () => create,
findAll: () => findAll,
findAllByName: () => findAllByName,
findByName: () => findByName,
parse: () => parse,
parseAll: () => parseAll,
parseAllUnassoc: () => parseAllUnassoc,
parseUnassoc: () => parseUnassoc,
proto: () => proto3,
removeAll: () => removeAll,
removeAllByName: () => removeAllByName,
update: () => update
});
module2.exports = __toCommonJS2(protocol_tag_utils_exports);
var pipe2 = (...fns) => (i) => fns.reduce((acc, fn) => fn(acc), i);
var defaultTo3 = (dVal) => (val) => val == null ? dVal : val;
var propOr3 = (defaultV) => (prop3) => pipe2(
(obj) => obj ? obj[prop3] : obj,
defaultTo3(defaultV)
);
var mapObject = (fn) => (obj) => {
const res = {};
for (const key in obj) {
if (obj.hasOwnProperty(key)) res[key] = fn(obj[key], key, obj);
}
return res;
};
var complement = (fn) => (...args) => !fn(...args);
var findProtocolBoundaries = (protocol) => (tags) => {
const startIdx = tags.findIndex((t) => t.name === "Data-Protocol" && t.value === protocol);
if (startIdx === -1) return [0, 0];
let endIdx = tags.findIndex((t, idx) => idx > startIdx && t.name === "Data-Protocol" && t.value !== protocol);
if (endIdx === -1) endIdx = tags.length;
return [startIdx, endIdx];
};
var findFirstProtocolBoundary = (tags) => {
let idx = tags.findIndex((t) => t.name === "Data-Protocol");
if (idx === -1) idx = tags.length;
return idx;
};
var byName = (name) => (t) => t.name === name;
var findAll = (protocol, tags) => pipe2(
findProtocolBoundaries(protocol),
([start, end]) => tags.slice(start, end)
)(tags);
var findAllByName = (protocol, name, tags) => pipe2(
(tags2) => findAll(protocol, tags2),
(pTags) => pTags.filter(byName(name))
)(tags);
var findByName = (protocol, name, tags) => pipe2(
(tags2) => findAllByName(protocol, name, tags2),
(arr) => arr[0]
)(tags);
var create = (protocol, pTags) => {
pTags = pTags.filter((t) => t.name !== "Data-Protocol" || t.value !== protocol);
if (!pTags.length) return [];
return [
{ name: "Data-Protocol", value: protocol },
...pTags
];
};
var concat5 = (protocol, pTags, tags) => {
const [start, end] = findProtocolBoundaries(protocol)(tags);
let [before, cur, after] = [
tags.slice(0, start),
tags.slice(start, end),
tags.slice(end)
];
if (!cur.length) {
pTags = create(protocol, pTags);
before = after;
after = [];
}
return [before, cur, pTags, after].flat(1);
};
var concatUnassoc3 = (others, tags) => {
const idx = findFirstProtocolBoundary(tags);
const [before, after] = [tags.slice(0, idx), tags.slice(idx)];
return [before, others, after].flat(1);
};
var update = (protocol, pTags, tags) => {
const [start, end] = findProtocolBoundaries(protocol)(tags);
let [before, after] = [tags.slice(0, start), tags.slice(end)];
if (after.length === tags.length) {
before = after;
after = [];
}
return [before, create(protocol, pTags), after].flat(1);
};
var removeAll = (protocol, tags) => update(protocol, [], tags);
var removeAllByName = (protocol, name, tags) => {
const [start, end] = findProtocolBoundaries(protocol)(tags);
const [before, cur, after] = [tags.slice(0, start), tags.slice(start, end), tags.slice(end)];
return [before, create(protocol, cur.filter(complement(byName(name)))), after].flat(1);
};
var parseTags2 = (tags, multi = false) => pipe2(
defaultTo3([]),
/**
* Mutation is okay here, since it's
* an internal data structure
*/
(tags2) => tags2.reduce(
(parsed, tag) => pipe2(
// [value, value, ...] || []
propOr3([])(tag.name),
// [value]
(arr) => {
arr.push(tag.value);
return arr;
},
// { [name]: [value, value, ...] }
(arr) => {
parsed[tag.name] = arr;
return parsed;
}
)(parsed),
{}
),
mapObject((values) => multi ? values : values[0])
)(tags);
var parseProtocol = (protocol, tags, multi) => pipe2(
defaultTo3([]),
(tags2) => findAll(protocol, tags2),
(tags2) => parseTags2(tags2, multi)
)(tags);
var parseAll = (protocol, tags) => parseProtocol(protocol, tags, true);
var parse = (protocol, tags) => parseProtocol(protocol, tags, false);
var parseUnassoc = (tags) => {
const idx = findFirstProtocolBoundary(tags);
return parseTags2(tags.slice(0, idx), false);
};
var parseAllUnassoc = (tags) => {
const idx = findFirstProtocolBoundary(tags);
return parseTags2(tags.slice(0, idx), true);
};
var proto3 = (p) => ({
/**
* @type {import('./types').RemoveFirstArg<findAll>}
*/
findAll: (tags) => findAll(p, tags),
/**
* @type {import('./types').RemoveFirstArg<findAllByName>}
*/
findAllByName: (name, tags) => findAllByName(p, name, tags),
/**
* @type {import('./types').RemoveFirstArg<findByName>}
*/
findByName: (name, tags) => findByName(p, name, tags),
/**
* @type {import('./types').RemoveFirstArg<create>}
*/
create: (tags) => create(p, tags),
/**
* @type {import('./types').RemoveFirstArg<update>}
*/
update: (pTags, tags) => update(p, pTags, tags),
/**
* @type {import('./types').RemoveFirstArg<concat>}
*/
concat: (pTags, tags) => concat5(p, pTags, tags),
/**
* @type {import('./types').RemoveFirstArg<removeAll>}
*/
removeAll: (tags) => removeAll(p, tags),
/**
* @type {import('./types').RemoveFirstArg<removeAllByName>}
*/
removeAllByName: (name, tags) => removeAllByName(p, name, tags),
/**
* @type {import('./types').RemoveFirstArg<parse>}
*/
parse: (tags) => parse(p, tags),
/**
* @type {import('./types').RemoveFirstArg<parseAll>}
*/
parseAll: (tags) => parseAll(p, tags),
concatUnassoc: concatUnassoc3,
parseUnassoc,
parseAllUnassoc
});
}
});
// node_modules/warp-arbundles/build/node/cjs/src/signing/Signer.js
var require_Signer = __commonJS({
"node_modules/warp-arbundles/build/node/cjs/src/signing/Signer.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.Signer = void 0;
var Signer = class {
static verify(_pk, _message, _signature, _opts) {
throw new Error("You must implement verify method on child");
}
};
exports2.Signer = Signer;
}
});
// node_modules/base64url/dist/pad-string.js
var require_pad_string = __commonJS({
"node_modules/base64url/dist/pad-string.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
function padString(input) {
var segmentLength = 4;
var stringLength = input.length;
var diff = stringLength % segmentLength;
if (!diff) {
return input;
}
var position = stringLength;
var padLength = segmentLength - diff;
var paddedStringLength = stringLength + padLength;
var buffer2 = Buffer.alloc(paddedStringLength);
buffer2.write(input);
while (padLength--) {
buffer2.write("=", position++);
}
return buffer2.toString();
}
exports2.default = padString;
}
});
// node_modules/base64url/dist/base64url.js
var require_base64url = __commonJS({
"node_modules/base64url/dist/base64url.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
var pad_string_1 = require_pad_string();
function encode4(input, encoding) {
if (encoding === void 0) {
encoding = "utf8";
}
if (Buffer.isBuffer(input)) {
return fromBase64(input.toString("base64"));
}
return fromBase64(Buffer.from(input, encoding).toString("base64"));
}
function decode2(base64url2, encoding) {
if (encoding === void 0) {
encoding = "utf8";
}
return Buffer.from(toBase64(base64url2), "base64").toString(encoding);
}
function toBase64(base64url2) {
base64url2 = base64url2.toString();
return pad_string_1.default(base64url2).replace(/\-/g, "+").replace(/_/g, "/");
}
function fromBase64(base64) {
return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
}
function toBuffer(base64url2) {
return Buffer.from(toBase64(base64url2), "base64");
}
var base64url = encode4;
base64url.encode = encode4;
base64url.decode = decode2;
base64url.toBase64 = toBase64;
base64url.fromBase64 = fromBase64;
base64url.toBuffer = toBuffer;
exports2.default = base64url;
}
});
// node_modules/base64url/index.js
var require_base64url2 = __commonJS({
"node_modules/base64url/index.js"(exports2, module2) {
module2.exports = require_base64url().default;
module2.exports.default = module2.exports;
}
});
// node_modules/base64-js/index.js
var require_base64_js = __commonJS({
"node_modules/base64-js/index.js"(exports2) {
"use strict";
exports2.byteLength = byteLength;
exports2.toByteArray =