tuix
Version:
A performant TUI framework for Bun with JSX and reactive state management
1,558 lines (1,530 loc) • 1.64 MB
JavaScript
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);
// node_modules/effect/dist/esm/Function.js
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
switch (arguments.length) {
case 1:
return a;
case 2:
return ab(a);
case 3:
return bc(ab(a));
case 4:
return cd(bc(ab(a)));
case 5:
return de(cd(bc(ab(a))));
case 6:
return ef(de(cd(bc(ab(a)))));
case 7:
return fg(ef(de(cd(bc(ab(a))))));
case 8:
return gh(fg(ef(de(cd(bc(ab(a)))))));
case 9:
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
default: {
let ret = arguments[0];
for (let i = 1;i < arguments.length; i++) {
ret = arguments[i](ret);
}
return ret;
}
}
}
var isFunction = (input) => typeof input === "function", dual = function(arity, body) {
if (typeof arity === "function") {
return function() {
if (arity(arguments)) {
return body.apply(this, arguments);
}
return (self) => body(self, ...arguments);
};
}
switch (arity) {
case 0:
case 1:
throw new RangeError(`Invalid arity ${arity}`);
case 2:
return function(a, b) {
if (arguments.length >= 2) {
return body(a, b);
}
return function(self) {
return body(self, a);
};
};
case 3:
return function(a, b, c) {
if (arguments.length >= 3) {
return body(a, b, c);
}
return function(self) {
return body(self, a, b);
};
};
case 4:
return function(a, b, c, d) {
if (arguments.length >= 4) {
return body(a, b, c, d);
}
return function(self) {
return body(self, a, b, c);
};
};
case 5:
return function(a, b, c, d, e) {
if (arguments.length >= 5) {
return body(a, b, c, d, e);
}
return function(self) {
return body(self, a, b, c, d);
};
};
default:
return function() {
if (arguments.length >= arity) {
return body.apply(this, arguments);
}
const args = arguments;
return function(self) {
return body(self, ...args);
};
};
}
}, identity = (a) => a, constant = (value) => () => value, constTrue, constFalse, constNull, constUndefined, constVoid;
var init_Function = __esm(() => {
constTrue = /* @__PURE__ */ constant(true);
constFalse = /* @__PURE__ */ constant(false);
constNull = /* @__PURE__ */ constant(null);
constUndefined = /* @__PURE__ */ constant(undefined);
constVoid = constUndefined;
});
// node_modules/effect/dist/esm/Equivalence.js
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that), isStrictEquivalent = (x, y) => x === y, strict = () => isStrictEquivalent, number, mapInput, Date2, array = (item) => make((self, that) => {
if (self.length !== that.length) {
return false;
}
for (let i = 0;i < self.length; i++) {
const isEq = item(self[i], that[i]);
if (!isEq) {
return false;
}
}
return true;
});
var init_Equivalence = __esm(() => {
init_Function();
number = /* @__PURE__ */ strict();
mapInput = /* @__PURE__ */ dual(2, (self, f) => make((x, y) => self(f(x), f(y))));
Date2 = /* @__PURE__ */ mapInput(number, (date) => date.getTime());
});
// node_modules/effect/dist/esm/internal/doNotation.js
var let_ = (map) => dual(3, (self, name, f) => map(self, (a) => ({
...a,
[name]: f(a)
}))), bindTo = (map) => dual(2, (self, name) => map(self, (a) => ({
[name]: a
}))), bind = (map, flatMap) => dual(3, (self, name, f) => flatMap(self, (a) => map(f(a), (b) => ({
...a,
[name]: b
}))));
var init_doNotation = __esm(() => {
init_Function();
});
// node_modules/effect/dist/esm/internal/version.js
var moduleVersion = "3.16.9", getCurrentVersion = () => moduleVersion;
// node_modules/effect/dist/esm/GlobalValue.js
var globalStoreId, globalStore, globalValue = (id, compute) => {
if (!globalStore) {
globalThis[globalStoreId] ??= new Map;
globalStore = globalThis[globalStoreId];
}
if (!globalStore.has(id)) {
globalStore.set(id, compute());
}
return globalStore.get(id);
};
var init_GlobalValue = __esm(() => {
globalStoreId = `effect/GlobalValue/globalStoreId/${/* @__PURE__ */ getCurrentVersion()}`;
});
// node_modules/effect/dist/esm/Predicate.js
var isString = (input) => typeof input === "string", isNumber = (input) => typeof input === "number", isBoolean = (input) => typeof input === "boolean", isBigInt = (input) => typeof input === "bigint", isSymbol = (input) => typeof input === "symbol", isFunction2, isUndefined = (input) => input === undefined, isNever = (_) => false, isRecordOrArray = (input) => typeof input === "object" && input !== null, isObject = (input) => isRecordOrArray(input) || isFunction2(input), hasProperty, isTagged, isNullable = (input) => input === null || input === undefined, isNotNullable = (input) => input !== null && input !== undefined, isDate = (input) => input instanceof Date, isIterable = (input) => hasProperty(input, Symbol.iterator), isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input), isPromiseLike = (input) => hasProperty(input, "then") && isFunction2(input.then);
var init_Predicate = __esm(() => {
init_Function();
isFunction2 = isFunction;
hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && (property in self));
isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
});
// node_modules/effect/dist/esm/internal/errors.js
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
// node_modules/effect/dist/esm/Utils.js
class PCGRandom {
_state;
constructor(seedHi, seedLo, incHi, incLo) {
if (isNullable(seedLo) && isNullable(seedHi)) {
seedLo = Math.random() * 4294967295 >>> 0;
seedHi = 0;
} else if (isNullable(seedLo)) {
seedLo = seedHi;
seedHi = 0;
}
if (isNullable(incLo) && isNullable(incHi)) {
incLo = this._state ? this._state[3] : defaultIncLo;
incHi = this._state ? this._state[2] : defaultIncHi;
} else if (isNullable(incLo)) {
incLo = incHi;
incHi = 0;
}
this._state = new Int32Array([0, 0, incHi >>> 0, ((incLo || 0) | 1) >>> 0]);
this._next();
add64(this._state, this._state[0], this._state[1], seedHi >>> 0, seedLo >>> 0);
this._next();
return this;
}
getState() {
return [this._state[0], this._state[1], this._state[2], this._state[3]];
}
setState(state) {
this._state[0] = state[0];
this._state[1] = state[1];
this._state[2] = state[2];
this._state[3] = state[3] | 1;
}
integer(max) {
return Math.round(this.number() * Number.MAX_SAFE_INTEGER) % max;
}
number() {
const hi = (this._next() & 67108863) * 1;
const lo = (this._next() & 134217727) * 1;
return (hi * BIT_27 + lo) / BIT_53;
}
_next() {
const oldHi = this._state[0] >>> 0;
const oldLo = this._state[1] >>> 0;
mul64(this._state, oldHi, oldLo, MUL_HI, MUL_LO);
add64(this._state, this._state[0], this._state[1], this._state[2], this._state[3]);
let xsHi = oldHi >>> 18;
let xsLo = (oldLo >>> 18 | oldHi << 14) >>> 0;
xsHi = (xsHi ^ oldHi) >>> 0;
xsLo = (xsLo ^ oldLo) >>> 0;
const xorshifted = (xsLo >>> 27 | xsHi << 5) >>> 0;
const rot = oldHi >>> 27;
const rot2 = (-rot >>> 0 & 31) >>> 0;
return (xorshifted >>> rot | xorshifted << rot2) >>> 0;
}
}
function mul64(out, aHi, aLo, bHi, bLo) {
let c1 = (aLo >>> 16) * (bLo & 65535) >>> 0;
let c0 = (aLo & 65535) * (bLo >>> 16) >>> 0;
let lo = (aLo & 65535) * (bLo & 65535) >>> 0;
let hi = (aLo >>> 16) * (bLo >>> 16) + ((c0 >>> 16) + (c1 >>> 16)) >>> 0;
c0 = c0 << 16 >>> 0;
lo = lo + c0 >>> 0;
if (lo >>> 0 < c0 >>> 0) {
hi = hi + 1 >>> 0;
}
c1 = c1 << 16 >>> 0;
lo = lo + c1 >>> 0;
if (lo >>> 0 < c1 >>> 0) {
hi = hi + 1 >>> 0;
}
hi = hi + Math.imul(aLo, bHi) >>> 0;
hi = hi + Math.imul(aHi, bLo) >>> 0;
out[0] = hi;
out[1] = lo;
}
function add64(out, aHi, aLo, bHi, bLo) {
let hi = aHi + bHi >>> 0;
const lo = aLo + bLo >>> 0;
if (lo >>> 0 < aLo >>> 0) {
hi = hi + 1 | 0;
}
out[0] = hi;
out[1] = lo;
}
function yieldWrapGet(self) {
if (typeof self === "object" && self !== null && YieldWrapTypeId in self) {
return self[YieldWrapTypeId]();
}
throw new Error(getBugErrorMessage("yieldWrapGet"));
}
var GenKindTypeId, isGenKind = (u) => isObject(u) && (GenKindTypeId in u), GenKindImpl, SingleShotGen, adapter = () => function() {
let x = arguments[0];
for (let i = 1;i < arguments.length; i++) {
x = arguments[i](x);
}
return new GenKindImpl(x);
}, defaultIncHi = 335903614, defaultIncLo = 4150755663, MUL_HI, MUL_LO, BIT_53 = 9007199254740992, BIT_27 = 134217728, YieldWrapTypeId, YieldWrap, structuralRegionState, standard, forced, isNotOptimizedAway, internalCall, genConstructor, isGeneratorFunction = (u) => isObject(u) && u.constructor === genConstructor;
var init_Utils = __esm(() => {
init_Function();
init_GlobalValue();
init_Predicate();
GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
GenKindImpl = class GenKindImpl {
value;
constructor(value) {
this.value = value;
}
get _F() {
return identity;
}
get _R() {
return (_) => _;
}
get _O() {
return (_) => _;
}
get _E() {
return (_) => _;
}
[GenKindTypeId] = GenKindTypeId;
[Symbol.iterator]() {
return new SingleShotGen(this);
}
};
SingleShotGen = class SingleShotGen {
self;
called = false;
constructor(self) {
this.self = self;
}
next(a) {
return this.called ? {
value: a,
done: true
} : (this.called = true, {
value: this.self,
done: false
});
}
return(a) {
return {
value: a,
done: true
};
}
throw(e) {
throw e;
}
[Symbol.iterator]() {
return new SingleShotGen(this.self);
}
};
MUL_HI = 1481765933 >>> 0;
MUL_LO = 1284865837 >>> 0;
YieldWrapTypeId = /* @__PURE__ */ Symbol.for("effect/Utils/YieldWrap");
YieldWrap = class YieldWrap {
#value;
constructor(value) {
this.#value = value;
}
[YieldWrapTypeId]() {
return this.#value;
}
};
structuralRegionState = /* @__PURE__ */ globalValue("effect/Utils/isStructuralRegion", () => ({
enabled: false,
tester: undefined
}));
standard = {
effect_internal_function: (body) => {
return body();
}
};
forced = {
effect_internal_function: (body) => {
try {
return body();
} finally {}
}
};
isNotOptimizedAway = /* @__PURE__ */ standard.effect_internal_function(() => new Error().stack)?.includes("effect_internal_function") === true;
internalCall = isNotOptimizedAway ? standard.effect_internal_function : forced.effect_internal_function;
genConstructor = function* () {}.constructor;
});
// node_modules/effect/dist/esm/Hash.js
var randomHashCache, symbol, hash = (self) => {
if (structuralRegionState.enabled === true) {
return 0;
}
switch (typeof self) {
case "number":
return number2(self);
case "bigint":
return string(self.toString(10));
case "boolean":
return string(String(self));
case "symbol":
return string(String(self));
case "string":
return string(self);
case "undefined":
return string("undefined");
case "function":
case "object": {
if (self === null) {
return string("null");
} else if (self instanceof Date) {
return hash(self.toISOString());
} else if (self instanceof URL) {
return hash(self.href);
} else if (isHash(self)) {
return self[symbol]();
} else {
return random(self);
}
}
default:
throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
}
}, random = (self) => {
if (!randomHashCache.has(self)) {
randomHashCache.set(self, number2(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)));
}
return randomHashCache.get(self);
}, combine = (b) => (self) => self * 53 ^ b, optimize = (n) => n & 3221225471 | n >>> 1 & 1073741824, isHash = (u) => hasProperty(u, symbol), number2 = (n) => {
if (n !== n || n === Infinity) {
return 0;
}
let h = n | 0;
if (h !== n) {
h ^= n * 4294967295;
}
while (n > 4294967295) {
h ^= n /= 4294967295;
}
return optimize(h);
}, string = (str) => {
let h = 5381, i = str.length;
while (i) {
h = h * 33 ^ str.charCodeAt(--i);
}
return optimize(h);
}, structureKeys = (o, keys) => {
let h = 12289;
for (let i = 0;i < keys.length; i++) {
h ^= pipe(string(keys[i]), combine(hash(o[keys[i]])));
}
return optimize(h);
}, structure = (o) => structureKeys(o, Object.keys(o)), array2 = (arr) => {
let h = 6151;
for (let i = 0;i < arr.length; i++) {
h = pipe(h, combine(hash(arr[i])));
}
return optimize(h);
}, cached = function() {
if (arguments.length === 1) {
const self2 = arguments[0];
return function(hash3) {
Object.defineProperty(self2, symbol, {
value() {
return hash3;
},
enumerable: false
});
return hash3;
};
}
const self = arguments[0];
const hash2 = arguments[1];
Object.defineProperty(self, symbol, {
value() {
return hash2;
},
enumerable: false
});
return hash2;
};
var init_Hash = __esm(() => {
init_Function();
init_GlobalValue();
init_Predicate();
init_Utils();
randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap);
symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
});
// node_modules/effect/dist/esm/Equal.js
function equals() {
if (arguments.length === 1) {
return (self) => compareBoth(self, arguments[0]);
}
return compareBoth(arguments[0], arguments[1]);
}
function compareBoth(self, that) {
if (self === that) {
return true;
}
const selfType = typeof self;
if (selfType !== typeof that) {
return false;
}
if (selfType === "object" || selfType === "function") {
if (self !== null && that !== null) {
if (isEqual(self) && isEqual(that)) {
if (hash(self) === hash(that) && self[symbol2](that)) {
return true;
} else {
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
}
} else if (self instanceof Date && that instanceof Date) {
return self.toISOString() === that.toISOString();
} else if (self instanceof URL && that instanceof URL) {
return self.href === that.href;
}
}
if (structuralRegionState.enabled) {
if (Array.isArray(self) && Array.isArray(that)) {
return self.length === that.length && self.every((v, i) => compareBoth(v, that[i]));
}
if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(self) === Object.prototype) {
const keysSelf = Object.keys(self);
const keysThat = Object.keys(that);
if (keysSelf.length === keysThat.length) {
for (const key of keysSelf) {
if (!((key in that) && compareBoth(self[key], that[key]))) {
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
}
}
return true;
}
}
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
}
}
return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
}
var symbol2, isEqual = (u) => hasProperty(u, symbol2), equivalence = () => equals;
var init_Equal = __esm(() => {
init_Hash();
init_Predicate();
init_Utils();
symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
});
// node_modules/effect/dist/esm/Inspectable.js
var NodeInspectSymbol, toJSON = (x) => {
try {
if (hasProperty(x, "toJSON") && isFunction2(x["toJSON"]) && x["toJSON"].length === 0) {
return x.toJSON();
} else if (Array.isArray(x)) {
return x.map(toJSON);
}
} catch {
return {};
}
return redact(x);
}, format = (x) => JSON.stringify(x, null, 2), BaseProto, toStringUnknown = (u, whitespace = 2) => {
if (typeof u === "string") {
return u;
}
try {
return typeof u === "object" ? stringifyCircular(u, whitespace) : String(u);
} catch {
return String(u);
}
}, stringifyCircular = (obj, whitespace) => {
let cache = [];
const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache.includes(value) ? undefined : cache.push(value) && (redactableState.fiberRefs !== undefined && isRedactable(value) ? value[symbolRedactable](redactableState.fiberRefs) : value) : value, whitespace);
cache = undefined;
return retVal;
}, symbolRedactable, isRedactable = (u) => typeof u === "object" && u !== null && (symbolRedactable in u), redactableState, withRedactableContext = (context, f) => {
const prev = redactableState.fiberRefs;
redactableState.fiberRefs = context;
try {
return f();
} finally {
redactableState.fiberRefs = prev;
}
}, redact = (u) => {
if (isRedactable(u) && redactableState.fiberRefs !== undefined) {
return u[symbolRedactable](redactableState.fiberRefs);
}
return u;
};
var init_Inspectable = __esm(() => {
init_GlobalValue();
init_Predicate();
NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
BaseProto = {
toJSON() {
return toJSON(this);
},
[NodeInspectSymbol]() {
return this.toJSON();
},
toString() {
return format(this.toJSON());
}
};
symbolRedactable = /* @__PURE__ */ Symbol.for("effect/Inspectable/Redactable");
redactableState = /* @__PURE__ */ globalValue("effect/Inspectable/redactableState", () => ({
fiberRefs: undefined
}));
});
// node_modules/effect/dist/esm/Pipeable.js
var pipeArguments = (self, args) => {
switch (args.length) {
case 0:
return self;
case 1:
return args[0](self);
case 2:
return args[1](args[0](self));
case 3:
return args[2](args[1](args[0](self)));
case 4:
return args[3](args[2](args[1](args[0](self))));
case 5:
return args[4](args[3](args[2](args[1](args[0](self)))));
case 6:
return args[5](args[4](args[3](args[2](args[1](args[0](self))))));
case 7:
return args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))));
case 8:
return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
case 9:
return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
default: {
let ret = self;
for (let i = 0, len = args.length;i < len; i++) {
ret = args[i](ret);
}
return ret;
}
}
};
var init_Pipeable = () => {};
// node_modules/effect/dist/esm/internal/opCodes/effect.js
var OP_ASYNC = "Async", OP_COMMIT = "Commit", OP_FAILURE = "Failure", OP_ON_FAILURE = "OnFailure", OP_ON_SUCCESS = "OnSuccess", OP_ON_SUCCESS_AND_FAILURE = "OnSuccessAndFailure", OP_SUCCESS = "Success", OP_SYNC = "Sync", OP_TAG = "Tag", OP_UPDATE_RUNTIME_FLAGS = "UpdateRuntimeFlags", OP_WHILE = "While", OP_ITERATOR = "Iterator", OP_WITH_RUNTIME = "WithRuntime", OP_YIELD = "Yield", OP_REVERT_FLAGS = "RevertFlags";
// node_modules/effect/dist/esm/internal/effectable.js
var EffectTypeId, StreamTypeId, SinkTypeId, ChannelTypeId, effectVariance, sinkVariance, channelVariance, EffectPrototype, StructuralPrototype, CommitPrototype, StructuralCommitPrototype, Base;
var init_effectable = __esm(() => {
init_Equal();
init_Hash();
init_Pipeable();
init_Utils();
EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
effectVariance = {
_R: (_) => _,
_E: (_) => _,
_A: (_) => _,
_V: /* @__PURE__ */ getCurrentVersion()
};
sinkVariance = {
_A: (_) => _,
_In: (_) => _,
_L: (_) => _,
_E: (_) => _,
_R: (_) => _
};
channelVariance = {
_Env: (_) => _,
_InErr: (_) => _,
_InElem: (_) => _,
_InDone: (_) => _,
_OutErr: (_) => _,
_OutElem: (_) => _,
_OutDone: (_) => _
};
EffectPrototype = {
[EffectTypeId]: effectVariance,
[StreamTypeId]: effectVariance,
[SinkTypeId]: sinkVariance,
[ChannelTypeId]: channelVariance,
[symbol2](that) {
return this === that;
},
[symbol]() {
return cached(this, random(this));
},
[Symbol.iterator]() {
return new SingleShotGen(new YieldWrap(this));
},
pipe() {
return pipeArguments(this, arguments);
}
};
StructuralPrototype = {
[symbol]() {
return cached(this, structure(this));
},
[symbol2](that) {
const selfKeys = Object.keys(this);
const thatKeys = Object.keys(that);
if (selfKeys.length !== thatKeys.length) {
return false;
}
for (const key of selfKeys) {
if (!((key in that) && equals(this[key], that[key]))) {
return false;
}
}
return true;
}
};
CommitPrototype = {
...EffectPrototype,
_op: OP_COMMIT
};
StructuralCommitPrototype = {
...CommitPrototype,
...StructuralPrototype
};
Base = /* @__PURE__ */ function() {
function Base2() {}
Base2.prototype = CommitPrototype;
return Base2;
}();
});
// node_modules/effect/dist/esm/internal/option.js
var TypeId, CommonProto, SomeProto, NoneHash, NoneProto, isOption = (input) => hasProperty(input, TypeId), isNone = (fa) => fa._tag === "None", isSome = (fa) => fa._tag === "Some", none, some = (value) => {
const a = Object.create(SomeProto);
a.value = value;
return a;
};
var init_option = __esm(() => {
init_Equal();
init_Hash();
init_Inspectable();
init_Predicate();
init_effectable();
TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
CommonProto = {
...EffectPrototype,
[TypeId]: {
_A: (_) => _
},
[NodeInspectSymbol]() {
return this.toJSON();
},
toString() {
return format(this.toJSON());
}
};
SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
_tag: "Some",
_op: "Some",
[symbol2](that) {
return isOption(that) && isSome(that) && equals(this.value, that.value);
},
[symbol]() {
return cached(this, combine(hash(this._tag))(hash(this.value)));
},
toJSON() {
return {
_id: "Option",
_tag: this._tag,
value: toJSON(this.value)
};
}
});
NoneHash = /* @__PURE__ */ hash("None");
NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
_tag: "None",
_op: "None",
[symbol2](that) {
return isOption(that) && isNone(that);
},
[symbol]() {
return NoneHash;
},
toJSON() {
return {
_id: "Option",
_tag: this._tag
};
}
});
none = /* @__PURE__ */ Object.create(NoneProto);
});
// node_modules/effect/dist/esm/internal/either.js
var TypeId2, CommonProto2, RightProto, LeftProto, isEither = (input) => hasProperty(input, TypeId2), isLeft = (ma) => ma._tag === "Left", isRight = (ma) => ma._tag === "Right", left = (left2) => {
const a = Object.create(LeftProto);
a.left = left2;
return a;
}, right = (right2) => {
const a = Object.create(RightProto);
a.right = right2;
return a;
}, getLeft = (self) => isRight(self) ? none : some(self.left), getRight = (self) => isLeft(self) ? none : some(self.right), fromOption;
var init_either = __esm(() => {
init_Equal();
init_Function();
init_Hash();
init_Inspectable();
init_Predicate();
init_effectable();
init_option();
TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
CommonProto2 = {
...EffectPrototype,
[TypeId2]: {
_R: (_) => _
},
[NodeInspectSymbol]() {
return this.toJSON();
},
toString() {
return format(this.toJSON());
}
};
RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
_tag: "Right",
_op: "Right",
[symbol2](that) {
return isEither(that) && isRight(that) && equals(this.right, that.right);
},
[symbol]() {
return combine(hash(this._tag))(hash(this.right));
},
toJSON() {
return {
_id: "Either",
_tag: this._tag,
right: toJSON(this.right)
};
}
});
LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
_tag: "Left",
_op: "Left",
[symbol2](that) {
return isEither(that) && isLeft(that) && equals(this.left, that.left);
},
[symbol]() {
return combine(hash(this._tag))(hash(this.left));
},
toJSON() {
return {
_id: "Either",
_tag: this._tag,
left: toJSON(this.left)
};
}
});
fromOption = /* @__PURE__ */ dual(2, (self, onNone) => isNone(self) ? left(onNone()) : right(self.value));
});
// node_modules/effect/dist/esm/Either.js
var right2, left2, fromOption2, isEither2, isLeft2, isRight2, mapLeft, map, match, merge, getOrThrowWith, getOrThrow, all = (input) => {
if (Symbol.iterator in input) {
const out2 = [];
for (const e of input) {
if (isLeft2(e)) {
return e;
}
out2.push(e.right);
}
return right2(out2);
}
const out = {};
for (const key of Object.keys(input)) {
const e = input[key];
if (isLeft2(e)) {
return e;
}
out[key] = e.right;
}
return right2(out);
};
var init_Either = __esm(() => {
init_Equivalence();
init_Function();
init_doNotation();
init_either();
init_option();
init_Predicate();
init_Utils();
right2 = right;
left2 = left;
fromOption2 = fromOption;
isEither2 = isEither;
isLeft2 = isLeft;
isRight2 = isRight;
mapLeft = /* @__PURE__ */ dual(2, (self, f) => isLeft2(self) ? left2(f(self.left)) : right2(self.right));
map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
match = /* @__PURE__ */ dual(2, (self, {
onLeft,
onRight
}) => isLeft2(self) ? onLeft(self.left) : onRight(self.right));
merge = /* @__PURE__ */ match({
onLeft: identity,
onRight: identity
});
getOrThrowWith = /* @__PURE__ */ dual(2, (self, onLeft) => {
if (isRight2(self)) {
return self.right;
}
throw onLeft(self.left);
});
getOrThrow = /* @__PURE__ */ getOrThrowWith(() => new Error("getOrThrow called on a Left"));
});
// node_modules/effect/dist/esm/internal/array.js
var isNonEmptyArray = (self) => self.length > 0;
// node_modules/effect/dist/esm/Order.js
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that), number3, mapInput2, all2 = (collection) => {
return make2((x, y) => {
const len = Math.min(x.length, y.length);
let collectionLength = 0;
for (const O of collection) {
if (collectionLength >= len) {
break;
}
const o = O(x[collectionLength], y[collectionLength]);
if (o !== 0) {
return o;
}
collectionLength++;
}
return 0;
});
}, tuple = (...elements) => all2(elements), greaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
var init_Order = __esm(() => {
init_Function();
number3 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
mapInput2 = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
});
// node_modules/effect/dist/esm/Option.js
var exports_Option = {};
__export(exports_Option, {
zipWith: () => zipWith,
zipRight: () => zipRight,
zipLeft: () => zipLeft,
void: () => void_,
toRefinement: () => toRefinement,
toArray: () => toArray,
tap: () => tap,
some: () => some2,
reduceCompact: () => reduceCompact,
productMany: () => productMany,
product: () => product,
partitionMap: () => partitionMap,
orElseSome: () => orElseSome,
orElseEither: () => orElseEither,
orElse: () => orElse,
none: () => none2,
mergeWith: () => mergeWith,
match: () => match2,
map: () => map2,
liftThrowable: () => liftThrowable,
liftPredicate: () => liftPredicate,
liftNullable: () => liftNullable,
lift2: () => lift2,
let: () => let_2,
isSome: () => isSome2,
isOption: () => isOption2,
isNone: () => isNone2,
getRight: () => getRight2,
getOrder: () => getOrder,
getOrUndefined: () => getOrUndefined,
getOrThrowWith: () => getOrThrowWith2,
getOrThrow: () => getOrThrow2,
getOrNull: () => getOrNull,
getOrElse: () => getOrElse,
getLeft: () => getLeft2,
getEquivalence: () => getEquivalence,
gen: () => gen,
fromNullable: () => fromNullable,
fromIterable: () => fromIterable,
flatten: () => flatten,
flatMapNullable: () => flatMapNullable,
flatMap: () => flatMap,
firstSomeOf: () => firstSomeOf,
filterMap: () => filterMap,
filter: () => filter,
exists: () => exists,
containsWith: () => containsWith,
contains: () => contains,
composeK: () => composeK,
bindTo: () => bindTo2,
bind: () => bind2,
asVoid: () => asVoid,
as: () => as,
ap: () => ap,
andThen: () => andThen,
all: () => all3,
TypeId: () => TypeId3,
Do: () => Do
});
var TypeId3, none2 = () => none, some2, isOption2, isNone2, isSome2, match2, toRefinement = (f) => (a) => isSome2(f(a)), fromIterable = (collection) => {
for (const a of collection) {
return some2(a);
}
return none2();
}, getRight2, getLeft2, getOrElse, orElse, orElseSome, orElseEither, firstSomeOf = (collection) => {
let out = none2();
for (out of collection) {
if (isSome2(out)) {
return out;
}
}
return out;
}, fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue), liftNullable = (f) => (...a) => fromNullable(f(...a)), getOrNull, getOrUndefined, liftThrowable = (f) => (...a) => {
try {
return some2(f(...a));
} catch {
return none2();
}
}, getOrThrowWith2, getOrThrow2, map2, as, asVoid, void_, flatMap, andThen, flatMapNullable, flatten, zipRight, zipLeft, composeK, tap, product = (self, that) => isSome2(self) && isSome2(that) ? some2([self.value, that.value]) : none2(), productMany = (self, collection) => {
if (isNone2(self)) {
return none2();
}
const out = [self.value];
for (const o of collection) {
if (isNone2(o)) {
return none2();
}
out.push(o.value);
}
return some2(out);
}, all3 = (input) => {
if (Symbol.iterator in input) {
const out2 = [];
for (const o of input) {
if (isNone2(o)) {
return none2();
}
out2.push(o.value);
}
return some2(out2);
}
const out = {};
for (const key of Object.keys(input)) {
const o = input[key];
if (isNone2(o)) {
return none2();
}
out[key] = o.value;
}
return some2(out);
}, zipWith, ap, reduceCompact, toArray = (self) => isNone2(self) ? [] : [self.value], partitionMap, filterMap, filter, getEquivalence = (isEquivalent) => make((x, y) => isNone2(x) ? isNone2(y) : isNone2(y) ? false : isEquivalent(x.value, y.value)), getOrder = (O) => make2((self, that) => isSome2(self) ? isSome2(that) ? O(self.value, that.value) : 1 : -1), lift2 = (f) => dual(2, (self, that) => zipWith(self, that, f)), liftPredicate, containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false : isEquivalent(self.value, a)), _equivalence, contains, exists, bindTo2, let_2, bind2, Do, adapter2, gen = (...args) => {
const f = args.length === 1 ? args[0] : args[1].bind(args[0]);
const iterator = f(adapter2);
let state = iterator.next();
while (!state.done) {
const current = isGenKind(state.value) ? state.value.value : yieldWrapGet(state.value);
if (isNone2(current)) {
return current;
}
state = iterator.next(current.value);
}
return some2(state.value);
}, mergeWith = (f) => (o1, o2) => {
if (isNone2(o1)) {
return o2;
} else if (isNone2(o2)) {
return o1;
}
return some2(f(o1.value, o2.value));
};
var init_Option = __esm(() => {
init_Equal();
init_Equivalence();
init_Function();
init_doNotation();
init_either();
init_option();
init_Order();
init_Utils();
TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
some2 = some;
isOption2 = isOption;
isNone2 = isNone;
isSome2 = isSome;
match2 = /* @__PURE__ */ dual(2, (self, {
onNone,
onSome
}) => isNone2(self) ? onNone() : onSome(self.value));
getRight2 = getRight;
getLeft2 = getLeft;
getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some2(onNone()) : self);
orElseEither = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? map2(that(), right) : map2(self, left));
getOrNull = /* @__PURE__ */ getOrElse(constNull);
getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
getOrThrowWith2 = /* @__PURE__ */ dual(2, (self, onNone) => {
if (isSome2(self)) {
return self.value;
}
throw onNone();
});
getOrThrow2 = /* @__PURE__ */ getOrThrowWith2(() => new Error("getOrThrow called on a None"));
map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
as = /* @__PURE__ */ dual(2, (self, b) => map2(self, () => b));
asVoid = /* @__PURE__ */ as(undefined);
void_ = /* @__PURE__ */ some2(undefined);
flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value));
andThen = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => {
const b = isFunction(f) ? f(a) : f;
return isOption2(b) ? b : some2(b);
}));
flatMapNullable = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : fromNullable(f(self.value)));
flatten = /* @__PURE__ */ flatMap(identity);
zipRight = /* @__PURE__ */ dual(2, (self, that) => flatMap(self, () => that));
zipLeft = /* @__PURE__ */ dual(2, (self, that) => tap(self, () => that));
composeK = /* @__PURE__ */ dual(2, (afb, bfc) => (a) => flatMap(afb(a), bfc));
tap = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => map2(f(a), () => a)));
zipWith = /* @__PURE__ */ dual(3, (self, that, f) => map2(product(self, that), ([a, b]) => f(a, b)));
ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f, a) => f(a)));
reduceCompact = /* @__PURE__ */ dual(3, (self, b, f) => {
let out = b;
for (const oa of self) {
if (isSome2(oa)) {
out = f(out, oa.value);
}
}
return out;
});
partitionMap = /* @__PURE__ */ dual(2, (self, f) => {
if (isNone2(self)) {
return [none2(), none2()];
}
const e = f(self.value);
return isLeft(e) ? [some2(e.left), none2()] : [none2(), some2(e.right)];
});
filterMap = flatMap;
filter = /* @__PURE__ */ dual(2, (self, predicate) => filterMap(self, (b) => predicate(b) ? some(b) : none));
liftPredicate = /* @__PURE__ */ dual(2, (b, predicate) => predicate(b) ? some2(b) : none2());
_equivalence = /* @__PURE__ */ equivalence();
contains = /* @__PURE__ */ containsWith(_equivalence);
exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
bindTo2 = /* @__PURE__ */ bindTo(map2);
let_2 = /* @__PURE__ */ let_(map2);
bind2 = /* @__PURE__ */ bind(map2, flatMap);
Do = /* @__PURE__ */ some2({});
adapter2 = /* @__PURE__ */ adapter();
});
// node_modules/effect/dist/esm/Tuple.js
var make3 = (...elements) => elements;
var init_Tuple = __esm(() => {
init_Equivalence();
init_Function();
init_Order();
init_Predicate();
});
// node_modules/effect/dist/esm/Iterable.js
var unsafeHead = (self) => {
const iterator = self[Symbol.iterator]();
const result = iterator.next();
if (result.done)
throw new Error("unsafeHead: empty iterable");
return result.value;
}, findFirst, constEmpty, constEmptyIterator, empty = () => constEmpty;
var init_Iterable = __esm(() => {
init_Either();
init_Equal();
init_Function();
init_Option();
init_Predicate();
init_Tuple();
findFirst = /* @__PURE__ */ dual(2, (self, f) => {
let i = 0;
for (const a of self) {
const o = f(a, i);
if (isBoolean(o)) {
if (o) {
return some2(a);
}
} else {
if (isSome2(o)) {
return o;
}
}
i++;
}
return none2();
});
constEmpty = {
[Symbol.iterator]() {
return constEmptyIterator;
}
};
constEmptyIterator = {
next() {
return {
done: true,
value: undefined
};
}
};
});
// node_modules/effect/dist/esm/Record.js
var init_Record = __esm(() => {
init_Either();
init_Equal();
init_Function();
init_Option();
});
// node_modules/effect/dist/esm/Array.js
var allocate = (n) => new Array(n), makeBy, fromIterable2 = (collection) => Array.isArray(collection) ? collection : Array.from(collection), ensure = (self) => Array.isArray(self) ? self : [self], matchLeft, prepend, append, appendAll, isArray, isEmptyArray = (self) => self.length === 0, isEmptyReadonlyArray, isNonEmptyArray2, isNonEmptyReadonlyArray, isOutOfBounds = (i, as2) => i < 0 || i >= as2.length, clamp = (i, as2) => Math.floor(Math.min(Math.max(0, i), as2.length)), get, unsafeGet, head, headNonEmpty, last = (self) => isNonEmptyReadonlyArray(self) ? some2(lastNonEmpty(self)) : none2(), lastNonEmpty = (self) => self[self.length - 1], tailNonEmpty = (self) => self.slice(1), spanIndex = (self, predicate) => {
let i = 0;
for (const a of self) {
if (!predicate(a, i)) {
break;
}
i++;
}
return i;
}, span, drop, findFirstIndex, findLastIndex, findFirst2, findLast, modify, remove, reverse = (self) => Array.from(self).reverse(), sort, zip, zipWith2, unzip = (self) => {
const input = fromIterable2(self);
if (isNonEmptyReadonlyArray(input)) {
const fa = [input[0][0]];
const fb = [input[0][1]];
for (let i = 1;i < input.length; i++) {
fa[i] = input[i][0];
fb[i] = input[i][1];
}
return [fa, fb];
}
return [[], []];
}, containsWith2 = (isEquivalent) => dual(2, (self, a) => {
for (const i of self) {
if (isEquivalent(a, i)) {
return true;
}
}
return false;
}), _equivalence2, contains2, splitAt, splitNonEmptyAt, copy = (self) => self.slice(), unionWith, union, intersectionWith = (isEquivalent) => {
const has = containsWith2(isEquivalent);
return dual(2, (self, that) => fromIterable2(self).filter((a) => has(that, a)));
}, intersection, differenceWith = (isEquivalent) => {
const has = containsWith2(isEquivalent);
return dual(2, (self, that) => fromIterable2(self).filter((a) => !has(that, a)));
}, difference, empty2 = () => [], of = (a) => [a], map3, flatMap2, flatten2, filterMap2, filterMapWhile, partitionMap2, getSomes, filter2, partition, separate, reduce, reduceRight, every, unfold = (b, f) => {
const out = [];
let next = b;
let o;
while (isSome2(o = f(next))) {
const [a, b2] = o.value;
out.push(a);
next = b2;
}
return out;
}, getEquivalence2, dedupeWith, dedupe = (self) => dedupeWith(self, equivalence()), dedupeAdjacentWith, dedupeAdjacent, join, mapAccum;
var init_Array = __esm(() => {
init_Either();
init_Equal();
init_Equivalence();
init_Function();
init_doNotation();
init_Iterable();
init_Option();
init_Order();
init_Predicate();
init_Record();
init_Tuple();
makeBy = /* @__PURE__ */ dual(2, (n, f) => {
const max2 = Math.max(1, Math.floor(n));
const out = new Array(max2);
for (let i = 0;i < max2; i++) {
out[i] = f(i);
}
return out;
});
matchLeft = /* @__PURE__ */ dual(2, (self, {
onEmpty,
onNonEmpty
}) => isNonEmptyReadonlyArray(self) ? onNonEmpty(headNonEmpty(self), tailNonEmpty(self)) : onEmpty());
prepend = /* @__PURE__ */ dual(2, (self, head) => [head, ...self]);
append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable2(self).concat(fromIterable2(that)));
isArray = Array.isArray;
isEmptyReadonlyArray = isEmptyArray;
isNonEmptyArray2 = isNonEmptyArray;
isNonEmptyReadonlyArray = isNonEmptyArray;
get = /* @__PURE__ */ dual(2, (self, index) => {
const i = Math.floor(index);
return isOutOfBounds(i, self) ? none2() : some2(self[i]);
});
unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
const i = Math.floor(index);
if (isOutOfBounds(i, self)) {
throw new Error(`Index ${i} out of bounds`);
}
return self[i];
});
head = /* @__PURE__ */ get(0);
headNonEmpty = /* @__PURE__ */ unsafeGet(0);
span = /* @__PURE__ */ dual(2, (self, predicate) => splitAt(self, spanIndex(self, predicate)));
drop = /* @__PURE__ */ dual(2, (self, n) => {
const input = fromIterable2(self);
return input.slice(clamp(n, input), input.length);
});
findFirstIndex = /* @__PURE__ */ dual(2, (self, predicate) => {
let i = 0;
for (const a of self) {
if (predicate(a, i)) {
return some2(i);
}
i++;
}
return none2();
});
findLastIndex = /* @__PURE__ */ dual(2, (self, predicate) => {
const input = fromIterable2(self);
for (let i = input.length - 1;i >= 0; i--) {
if (predicate(input[i], i)) {
return some2(i);
}
}
return none2();
});
findFirst2 = findFirst;
findLast = /* @__PURE__ */ dual(2, (self, f) => {
const input = fromIterable2(self);
for (let i = input.length - 1;i >= 0; i--) {
const a = input[i];
const o = f(a, i);
if (isBoolean(o)) {
if (o) {
return some2(a);
}
} else {
if (isSome2(o)) {
return o;
}
}
}
return none2();
});
modify = /* @__PURE__ */ dual(3, (self, i, f) => {
const out = Array.from(self);
if (isOutOfBounds(i, out)) {
return out;
}
const b = f(out[i]);
out[i] = b;
return out;
});
remove = /* @__PURE__ */ dual(2, (self, i) => {
const out = Array.from(self);
if (isOutOfBounds(i, out)) {
return out;
}
out.splice(i, 1);
return out;
});
sort = /* @__PURE__ */ dual(2, (self, O) => {
const out = Array.from(self);
out.sort(O);
return out;
});
zip = /* @__PURE__ */ dual(2, (self, that) => zipWith2(self, that, make3));
zipWith2 = /* @__PURE__ */ dual(3, (self, that, f) => {
const as2 = fromIterable2(self);
const bs = fromIterable2(that);
if (isNonEmptyReadonlyArray(as2) && isNonEmptyReadonlyArray(bs)) {
const out = [f(headNonEmpty(as2), headNonEmpty(bs))];
const len = Math.min(as2.length, bs.length);
for (let i = 1;i < len; i++) {
out[i] = f(as2[i], bs[i]);
}
return out;
}
return [];
});
_equivalence2 = /* @__PURE__ */ equivalence();
contains2 = /* @__PURE__ */ containsWith2(_equivalence2);
splitAt = /* @__PURE__ */ dual(2, (self, n) => {
const input = Array.from(self);
const _n = Math.floor(n);
if (isNonEmptyReadonlyArray(input)) {
if (_n >= 1) {
return splitNonEmptyAt(input, _n);
}
return [[], input];
}
return [input, []];
});
splitNonEmptyAt = /* @__PURE__ */ dual(2, (self, n) => {
const _n = Math.max(1, Math.floor(n));
return _n >= self.length ? [copy(self), []] : [prepend(self.slice(1, _n), headNonEmpty(self)), self.slice(_n)];
});
unionWith = /* @__PURE__ */ dual(3, (self, that, isEquivalent) => {
const a = fromIterable2(self);
const b = fromIterable2(that);
if (isNonEmptyReadonlyArray(a)) {
if (isNonEmptyReadonlyArray(b)) {
const dedupe = dedupeWith(isEquivalent);
return dedupe(appendAll(a, b));
}
return a;
}
return b;
});
union = /* @__PURE__ */ dual(2, (self, that) => unionWith(self, that, _equivalence2));
intersection = /* @__PURE__ */ intersectionWith(_equivalence2);
difference = /* @__PURE__ */ differenceWith(_equivalence2);
map3 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
if (isEmptyReadonlyArray(self)) {
return [];
}
const out = [];
for (let i = 0;i < self.length; i++) {
const inner = f(self[i], i);
for (let j = 0;j < inner.length; j++) {
out.push(inner[j]);
}
}
return out;
});
flatten2 = /* @__PURE__ */ flatMap2(identity);
filterMap2 = /* @__PURE__ */ dual(2, (self, f) => {
const as2 = fromIterable2(self);
const out = [];
for (let i = 0;i < as2.length; i++) {
const o = f(as2[i], i);
if (isSome2(o)) {
out.push(o.value);
}
}
return out;
});
filterMapWhile = /* @__PURE__ */ dual(2, (self, f) => {
let i = 0;
const out = [];
for (const a of self) {
const b = f(a, i);
if (isSome2(b)) {
out.push(b.value);
} else {
break;
}
i++;
}
return out;
});
partitionMap2 = /* @__PURE__ */ dual(2, (self, f) => {
const left3 = [];
const right3 = [];
const as2 = fromIterable2(self);
for (let i = 0;i < as2.length; i++) {
const e = f(as2[i], i);
if (isLeft2(e)) {
left3.push(e.left);
} else {
right3.push(e.right);
}
}
return [left3, right3];
});
getSomes = /* @__PURE__ */ filterMap2(identity);
filter2 = /* @__PURE__ */ dual(2, (self, predicate) => {
const as2 = fromIterable2(self);
const out = [];
for (let i = 0;i < as2.length; i++) {
if (predicate(as2[i], i)) {
out.push(as2[i]);
}
}
return out;
});
partition = /* @__PURE__ */ dual(2, (self, predicate) => {
const left3 = [];
const right3 = [];
const as2 = fromIterable2(self);
for (let i = 0;i < as2.length; i++) {
if (predicate(as2[i], i)) {
right3.push(as2[i]);
} else {
left3.push(as2[i]);
}
}
return [left3, right3];
});
separate = /* @__PURE__ */ partitionMap2(identity);
reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable2(self).reduce((b2, a, i) => f(b2, a, i), b));
reduceRight = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable2(self).reduceRight((b2, a, i) => f(b2, a, i), b));
every = /* @__PURE__ */ dual(2, (self, refinement) => self.every(refinement));
getEquivalence2 = array;
dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
const input = fromIterable2(self);
if (isNonEmptyReadonlyArray(input)) {
const out = [headNonEmpty(input)];
const rest = tailNonEmpty(input);
for (const r of rest) {
if (out.every((a) => !isEquivalent(r, a))) {
out.push(r);
}
}
return out;
}
return [];
});
dedupeAdjacentWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
const out = [];
let lastA = none2();
for (const a of self) {
if (isNone2(lastA) || !isEquivalent(a, lastA.value)) {
out.push(a);
lastA = some2(a);
}
}
return out;
});
dedupeAdjacent = /* @__PURE__ */ dedupeAdjacentWith(/* @__PURE__ */ equivalence());
join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable2(self).join(sep));
mapAccum = /* @__PURE__ */ dual(3, (self, s, f) => {
let i = 0;
let s1 = s;
const out = [];
for (const a of self) {
const r = f(s1, a, i);
s1 = r[0];
out.push(r[1]);
i++;
}
return [s1, out];
});
});
// node_modules/fast-check/lib/esm/fast-check-default.js
var init_fast_check_default = () => {};
// node_modules/fast-check/lib/esm/fast-check.js
var init_fast_check = __esm(() => {
init_fast_check_default();
});
// node_modules/effect/dist/esm/FastCheck.js
var init_FastCheck = __esm(() => {
init_fast_check();