@effect/language-service 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +203 -203
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +19 -19
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +2897 -636
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +19 -19
- package/transform.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm
|
|
3
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Function.js
|
|
4
4
|
var isFunction = (input) => typeof input === "function";
|
|
5
5
|
var dual = function(arity, body) {
|
|
6
6
|
if (typeof arity === "function") {
|
|
@@ -65,6 +65,8 @@ var dual = function(arity, body) {
|
|
|
65
65
|
};
|
|
66
66
|
var identity = (a) => a;
|
|
67
67
|
var constant = (value) => () => value;
|
|
68
|
+
var constTrue = /* @__PURE__ */ constant(true);
|
|
69
|
+
var constFalse = /* @__PURE__ */ constant(false);
|
|
68
70
|
var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
69
71
|
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
70
72
|
switch (arguments.length) {
|
|
@@ -96,7 +98,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
// node_modules/.pnpm
|
|
101
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Equivalence.js
|
|
100
102
|
var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
101
103
|
var array = (item) => make((self, that) => {
|
|
102
104
|
if (self.length !== that.length) {
|
|
@@ -111,7 +113,7 @@ var array = (item) => make((self, that) => {
|
|
|
111
113
|
return true;
|
|
112
114
|
});
|
|
113
115
|
|
|
114
|
-
// node_modules/.pnpm
|
|
116
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/GlobalValue.js
|
|
115
117
|
var globalStoreId = `effect/GlobalValue`;
|
|
116
118
|
var globalStore;
|
|
117
119
|
var globalValue = (id, compute) => {
|
|
@@ -125,7 +127,7 @@ var globalValue = (id, compute) => {
|
|
|
125
127
|
return globalStore.get(id);
|
|
126
128
|
};
|
|
127
129
|
|
|
128
|
-
// node_modules/.pnpm
|
|
130
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Predicate.js
|
|
129
131
|
var isString = (input) => typeof input === "string";
|
|
130
132
|
var isNumber = (input) => typeof input === "number";
|
|
131
133
|
var isBoolean = (input) => typeof input === "boolean";
|
|
@@ -133,9 +135,13 @@ var isFunction2 = isFunction;
|
|
|
133
135
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
134
136
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
135
137
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
138
|
+
var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
|
|
136
139
|
var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
|
|
137
140
|
|
|
138
|
-
// node_modules/.pnpm
|
|
141
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/errors.js
|
|
142
|
+
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
143
|
+
|
|
144
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Utils.js
|
|
139
145
|
var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
|
|
140
146
|
var GenKindImpl = class {
|
|
141
147
|
value;
|
|
@@ -257,7 +263,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
|
|
|
257
263
|
var genConstructor = function* () {
|
|
258
264
|
}.constructor;
|
|
259
265
|
|
|
260
|
-
// node_modules/.pnpm
|
|
266
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Hash.js
|
|
261
267
|
var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
|
|
262
268
|
var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
|
|
263
269
|
var hash = (self) => {
|
|
@@ -324,14 +330,21 @@ var string = (str) => {
|
|
|
324
330
|
}
|
|
325
331
|
return optimize(h);
|
|
326
332
|
};
|
|
327
|
-
var structureKeys = (o,
|
|
333
|
+
var structureKeys = (o, keys3) => {
|
|
328
334
|
let h = 12289;
|
|
329
|
-
for (let i = 0; i <
|
|
330
|
-
h ^= pipe(string(
|
|
335
|
+
for (let i = 0; i < keys3.length; i++) {
|
|
336
|
+
h ^= pipe(string(keys3[i]), combine(hash(o[keys3[i]])));
|
|
331
337
|
}
|
|
332
338
|
return optimize(h);
|
|
333
339
|
};
|
|
334
340
|
var structure = (o) => structureKeys(o, Object.keys(o));
|
|
341
|
+
var array2 = (arr) => {
|
|
342
|
+
let h = 6151;
|
|
343
|
+
for (let i = 0; i < arr.length; i++) {
|
|
344
|
+
h = pipe(h, combine(hash(arr[i])));
|
|
345
|
+
}
|
|
346
|
+
return optimize(h);
|
|
347
|
+
};
|
|
335
348
|
var cached = function() {
|
|
336
349
|
if (arguments.length === 1) {
|
|
337
350
|
const self2 = arguments[0];
|
|
@@ -356,7 +369,7 @@ var cached = function() {
|
|
|
356
369
|
return hash2;
|
|
357
370
|
};
|
|
358
371
|
|
|
359
|
-
// node_modules/.pnpm
|
|
372
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Equal.js
|
|
360
373
|
var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
|
|
361
374
|
function equals() {
|
|
362
375
|
if (arguments.length === 1) {
|
|
@@ -410,7 +423,7 @@ function compareBoth(self, that) {
|
|
|
410
423
|
var isEqual = (u) => hasProperty(u, symbol2);
|
|
411
424
|
var equivalence = () => equals;
|
|
412
425
|
|
|
413
|
-
// node_modules/.pnpm
|
|
426
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Inspectable.js
|
|
414
427
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
415
428
|
var toJSON = (x) => {
|
|
416
429
|
try {
|
|
@@ -450,6 +463,12 @@ var Class = class {
|
|
|
450
463
|
return format(this.toJSON());
|
|
451
464
|
}
|
|
452
465
|
};
|
|
466
|
+
var stringifyCircular = (obj, whitespace) => {
|
|
467
|
+
let cache = [];
|
|
468
|
+
const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache.includes(value) ? void 0 : cache.push(value) && (redactableState.fiberRefs !== void 0 && isRedactable(value) ? value[symbolRedactable](redactableState.fiberRefs) : value) : value, whitespace);
|
|
469
|
+
cache = void 0;
|
|
470
|
+
return retVal;
|
|
471
|
+
};
|
|
453
472
|
var symbolRedactable = /* @__PURE__ */ Symbol.for("effect/Inspectable/Redactable");
|
|
454
473
|
var isRedactable = (u) => typeof u === "object" && u !== null && symbolRedactable in u;
|
|
455
474
|
var redactableState = /* @__PURE__ */ globalValue("effect/Inspectable/redactableState", () => ({
|
|
@@ -462,7 +481,7 @@ var redact = (u) => {
|
|
|
462
481
|
return u;
|
|
463
482
|
};
|
|
464
483
|
|
|
465
|
-
// node_modules/.pnpm
|
|
484
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Pipeable.js
|
|
466
485
|
var pipeArguments = (self, args2) => {
|
|
467
486
|
switch (args2.length) {
|
|
468
487
|
case 0:
|
|
@@ -495,14 +514,16 @@ var pipeArguments = (self, args2) => {
|
|
|
495
514
|
}
|
|
496
515
|
};
|
|
497
516
|
|
|
498
|
-
// node_modules/.pnpm
|
|
517
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
499
518
|
var OP_COMMIT = "Commit";
|
|
519
|
+
var OP_FAILURE = "Failure";
|
|
520
|
+
var OP_WITH_RUNTIME = "WithRuntime";
|
|
500
521
|
|
|
501
|
-
// node_modules/.pnpm
|
|
522
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/version.js
|
|
502
523
|
var moduleVersion = "3.18.4";
|
|
503
524
|
var getCurrentVersion = () => moduleVersion;
|
|
504
525
|
|
|
505
|
-
// node_modules/.pnpm
|
|
526
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/effectable.js
|
|
506
527
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
507
528
|
var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
|
|
508
529
|
var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
|
|
@@ -589,7 +610,7 @@ var StructuralCommitPrototype = {
|
|
|
589
610
|
...StructuralPrototype
|
|
590
611
|
};
|
|
591
612
|
|
|
592
|
-
// node_modules/.pnpm
|
|
613
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/option.js
|
|
593
614
|
var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
|
|
594
615
|
var CommonProto = {
|
|
595
616
|
...EffectPrototype,
|
|
@@ -647,7 +668,7 @@ var some = (value) => {
|
|
|
647
668
|
return a;
|
|
648
669
|
};
|
|
649
670
|
|
|
650
|
-
// node_modules/.pnpm
|
|
671
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/either.js
|
|
651
672
|
var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
|
|
652
673
|
var CommonProto2 = {
|
|
653
674
|
...EffectPrototype,
|
|
@@ -709,7 +730,7 @@ var right = (right3) => {
|
|
|
709
730
|
return a;
|
|
710
731
|
};
|
|
711
732
|
|
|
712
|
-
// node_modules/.pnpm
|
|
733
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Either.js
|
|
713
734
|
var right2 = right;
|
|
714
735
|
var left2 = left;
|
|
715
736
|
var isLeft2 = isLeft;
|
|
@@ -717,14 +738,16 @@ var isRight2 = isRight;
|
|
|
717
738
|
var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
|
|
718
739
|
var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
|
|
719
740
|
|
|
720
|
-
// node_modules/.pnpm
|
|
741
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/array.js
|
|
721
742
|
var isNonEmptyArray = (self) => self.length > 0;
|
|
722
743
|
|
|
723
|
-
// node_modules/.pnpm
|
|
744
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Order.js
|
|
724
745
|
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
725
746
|
var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
747
|
+
var number2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
748
|
+
var mapInput = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
|
|
726
749
|
|
|
727
|
-
// node_modules/.pnpm
|
|
750
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Option.js
|
|
728
751
|
var none2 = () => none;
|
|
729
752
|
var some2 = some;
|
|
730
753
|
var isNone2 = isNone;
|
|
@@ -735,7 +758,7 @@ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nu
|
|
|
735
758
|
var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
736
759
|
var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
|
|
737
760
|
|
|
738
|
-
// node_modules/.pnpm
|
|
761
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Record.js
|
|
739
762
|
var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
740
763
|
const out = {
|
|
741
764
|
...self
|
|
@@ -747,7 +770,7 @@ var map3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
747
770
|
});
|
|
748
771
|
var keys = (self) => Object.keys(self);
|
|
749
772
|
|
|
750
|
-
// node_modules/.pnpm
|
|
773
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Array.js
|
|
751
774
|
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
752
775
|
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
753
776
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
|
|
@@ -770,6 +793,7 @@ var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
|
|
|
770
793
|
var head = /* @__PURE__ */ get(0);
|
|
771
794
|
var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
|
|
772
795
|
var tailNonEmpty = (self) => self.slice(1);
|
|
796
|
+
var reverse = (self) => Array.from(self).reverse();
|
|
773
797
|
var sort = /* @__PURE__ */ dual(2, (self, O) => {
|
|
774
798
|
const out = Array.from(self);
|
|
775
799
|
out.sort(O);
|
|
@@ -785,8 +809,8 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => {
|
|
|
785
809
|
});
|
|
786
810
|
var _equivalence = /* @__PURE__ */ equivalence();
|
|
787
811
|
var intersectionWith = (isEquivalent) => {
|
|
788
|
-
const
|
|
789
|
-
return dual(2, (self, that) => fromIterable(self).filter((a) =>
|
|
812
|
+
const has3 = containsWith(isEquivalent);
|
|
813
|
+
return dual(2, (self, that) => fromIterable(self).filter((a) => has3(that, a)));
|
|
790
814
|
};
|
|
791
815
|
var intersection = /* @__PURE__ */ intersectionWith(_equivalence);
|
|
792
816
|
var empty = () => [];
|
|
@@ -828,6 +852,7 @@ var partition = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
|
828
852
|
}
|
|
829
853
|
return [left3, right3];
|
|
830
854
|
});
|
|
855
|
+
var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b2, a, i) => f(b2, a, i), b));
|
|
831
856
|
var every = /* @__PURE__ */ dual(2, (self, refinement) => self.every(refinement));
|
|
832
857
|
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
833
858
|
const input = fromIterable(self);
|
|
@@ -1917,10 +1942,10 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1917
1942
|
const sectionOverrides = {};
|
|
1918
1943
|
const skippedRules = [];
|
|
1919
1944
|
const regex = /@effect-diagnostics(-next-line)?((?:\s[a-zA-Z0-9/]+:(?:off|warning|error|message|suggestion|skip-file))+)?/gm;
|
|
1920
|
-
let
|
|
1921
|
-
while ((
|
|
1922
|
-
const nextLineCaptureGroup =
|
|
1923
|
-
const rulesCaptureGroup =
|
|
1945
|
+
let match3;
|
|
1946
|
+
while ((match3 = regex.exec(sourceFile.text)) !== null) {
|
|
1947
|
+
const nextLineCaptureGroup = match3[1];
|
|
1948
|
+
const rulesCaptureGroup = match3[2];
|
|
1924
1949
|
if (rulesCaptureGroup) {
|
|
1925
1950
|
const trimmedRuleString = rulesCaptureGroup.trim();
|
|
1926
1951
|
if (trimmedRuleString) {
|
|
@@ -1932,7 +1957,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1932
1957
|
if (ruleLevel === "skip-file") skippedRules.push(ruleName);
|
|
1933
1958
|
const isOverrideNextLine = nextLineCaptureGroup && nextLineCaptureGroup.trim().toLowerCase() === "-next-line";
|
|
1934
1959
|
if (isOverrideNextLine) {
|
|
1935
|
-
const foundNode = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile,
|
|
1960
|
+
const foundNode = tsUtils.findNodeWithLeadingCommentAtPosition(sourceFile, match3.index);
|
|
1936
1961
|
if (foundNode) {
|
|
1937
1962
|
lineOverrides[ruleName] = lineOverrides[ruleName] || [];
|
|
1938
1963
|
lineOverrides[ruleName].unshift({
|
|
@@ -1945,7 +1970,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
1945
1970
|
} else {
|
|
1946
1971
|
sectionOverrides[ruleName] = sectionOverrides[ruleName] || [];
|
|
1947
1972
|
sectionOverrides[ruleName].unshift({
|
|
1948
|
-
pos:
|
|
1973
|
+
pos: match3.index,
|
|
1949
1974
|
level: ruleLevel
|
|
1950
1975
|
});
|
|
1951
1976
|
}
|
|
@@ -2088,9 +2113,9 @@ var getCodegensForSourceFile = fn("LSP.getApplicableCodegens")(function* (codege
|
|
|
2088
2113
|
const tsUtils = yield* service(TypeScriptUtils);
|
|
2089
2114
|
const result = [];
|
|
2090
2115
|
const regex = /@effect-codegens((?:\s[a-zA-Z0-9]+(?::(?:[a-zA-Z0-9]+))?)+)+/gmid;
|
|
2091
|
-
let
|
|
2092
|
-
while ((
|
|
2093
|
-
const pos =
|
|
2116
|
+
let match3;
|
|
2117
|
+
while ((match3 = regex.exec(sourceFile.text)) !== null) {
|
|
2118
|
+
const pos = match3.indices?.[0]?.[0];
|
|
2094
2119
|
if (!pos) continue;
|
|
2095
2120
|
const commentRange = tsUtils.getCommentAtPosition(sourceFile, pos);
|
|
2096
2121
|
if (!commentRange) continue;
|
|
@@ -3994,9 +4019,9 @@ var effectCodegensComment = createCompletion({
|
|
|
3994
4019
|
apply: fn("effectCodegensComment")(function* (sourceFile, position) {
|
|
3995
4020
|
const ts = yield* service(TypeScriptApi);
|
|
3996
4021
|
const sourceText = sourceFile.text;
|
|
3997
|
-
const
|
|
3998
|
-
if (
|
|
3999
|
-
const lastIndex =
|
|
4022
|
+
const match3 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
4023
|
+
if (match3 && match3.indices) {
|
|
4024
|
+
const lastIndex = match3.indices[2][0];
|
|
4000
4025
|
const replacementSpan = {
|
|
4001
4026
|
start: lastIndex,
|
|
4002
4027
|
length: Math.max(0, position - lastIndex)
|
|
@@ -4048,40 +4073,2270 @@ var effectDataClasses = createCompletion({
|
|
|
4048
4073
|
})
|
|
4049
4074
|
});
|
|
4050
4075
|
|
|
4051
|
-
// node_modules/.pnpm
|
|
4052
|
-
var
|
|
4076
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Chunk.js
|
|
4077
|
+
var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Chunk");
|
|
4078
|
+
function copy(src, srcPos, dest, destPos, len) {
|
|
4079
|
+
for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
|
|
4080
|
+
dest[destPos + i - srcPos] = src[i];
|
|
4081
|
+
}
|
|
4082
|
+
return dest;
|
|
4083
|
+
}
|
|
4084
|
+
var emptyArray = [];
|
|
4085
|
+
var getEquivalence = (isEquivalent) => make((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet2(that, i))));
|
|
4086
|
+
var _equivalence2 = /* @__PURE__ */ getEquivalence(equals);
|
|
4087
|
+
var ChunkProto = {
|
|
4088
|
+
[TypeId3]: {
|
|
4089
|
+
_A: (_) => _
|
|
4090
|
+
},
|
|
4091
|
+
toString() {
|
|
4092
|
+
return format(this.toJSON());
|
|
4093
|
+
},
|
|
4094
|
+
toJSON() {
|
|
4095
|
+
return {
|
|
4096
|
+
_id: "Chunk",
|
|
4097
|
+
values: toReadonlyArray(this).map(toJSON)
|
|
4098
|
+
};
|
|
4099
|
+
},
|
|
4100
|
+
[NodeInspectSymbol]() {
|
|
4101
|
+
return this.toJSON();
|
|
4102
|
+
},
|
|
4103
|
+
[symbol2](that) {
|
|
4104
|
+
return isChunk(that) && _equivalence2(this, that);
|
|
4105
|
+
},
|
|
4106
|
+
[symbol]() {
|
|
4107
|
+
return cached(this, array2(toReadonlyArray(this)));
|
|
4108
|
+
},
|
|
4109
|
+
[Symbol.iterator]() {
|
|
4110
|
+
switch (this.backing._tag) {
|
|
4111
|
+
case "IArray": {
|
|
4112
|
+
return this.backing.array[Symbol.iterator]();
|
|
4113
|
+
}
|
|
4114
|
+
case "IEmpty": {
|
|
4115
|
+
return emptyArray[Symbol.iterator]();
|
|
4116
|
+
}
|
|
4117
|
+
default: {
|
|
4118
|
+
return toReadonlyArray(this)[Symbol.iterator]();
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
},
|
|
4122
|
+
pipe() {
|
|
4123
|
+
return pipeArguments(this, arguments);
|
|
4124
|
+
}
|
|
4125
|
+
};
|
|
4126
|
+
var makeChunk = (backing) => {
|
|
4127
|
+
const chunk = Object.create(ChunkProto);
|
|
4128
|
+
chunk.backing = backing;
|
|
4129
|
+
switch (backing._tag) {
|
|
4130
|
+
case "IEmpty": {
|
|
4131
|
+
chunk.length = 0;
|
|
4132
|
+
chunk.depth = 0;
|
|
4133
|
+
chunk.left = chunk;
|
|
4134
|
+
chunk.right = chunk;
|
|
4135
|
+
break;
|
|
4136
|
+
}
|
|
4137
|
+
case "IConcat": {
|
|
4138
|
+
chunk.length = backing.left.length + backing.right.length;
|
|
4139
|
+
chunk.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
|
|
4140
|
+
chunk.left = backing.left;
|
|
4141
|
+
chunk.right = backing.right;
|
|
4142
|
+
break;
|
|
4143
|
+
}
|
|
4144
|
+
case "IArray": {
|
|
4145
|
+
chunk.length = backing.array.length;
|
|
4146
|
+
chunk.depth = 0;
|
|
4147
|
+
chunk.left = _empty;
|
|
4148
|
+
chunk.right = _empty;
|
|
4149
|
+
break;
|
|
4150
|
+
}
|
|
4151
|
+
case "ISingleton": {
|
|
4152
|
+
chunk.length = 1;
|
|
4153
|
+
chunk.depth = 0;
|
|
4154
|
+
chunk.left = _empty;
|
|
4155
|
+
chunk.right = _empty;
|
|
4156
|
+
break;
|
|
4157
|
+
}
|
|
4158
|
+
case "ISlice": {
|
|
4159
|
+
chunk.length = backing.length;
|
|
4160
|
+
chunk.depth = backing.chunk.depth + 1;
|
|
4161
|
+
chunk.left = _empty;
|
|
4162
|
+
chunk.right = _empty;
|
|
4163
|
+
break;
|
|
4164
|
+
}
|
|
4165
|
+
}
|
|
4166
|
+
return chunk;
|
|
4167
|
+
};
|
|
4168
|
+
var isChunk = (u) => hasProperty(u, TypeId3);
|
|
4169
|
+
var _empty = /* @__PURE__ */ makeChunk({
|
|
4170
|
+
_tag: "IEmpty"
|
|
4171
|
+
});
|
|
4172
|
+
var empty2 = () => _empty;
|
|
4173
|
+
var make4 = (...as) => unsafeFromNonEmptyArray(as);
|
|
4174
|
+
var of = (a) => makeChunk({
|
|
4175
|
+
_tag: "ISingleton",
|
|
4176
|
+
a
|
|
4177
|
+
});
|
|
4178
|
+
var fromIterable2 = (self) => isChunk(self) ? self : unsafeFromArray(fromIterable(self));
|
|
4179
|
+
var copyToArray = (self, array3, initial) => {
|
|
4180
|
+
switch (self.backing._tag) {
|
|
4181
|
+
case "IArray": {
|
|
4182
|
+
copy(self.backing.array, 0, array3, initial, self.length);
|
|
4183
|
+
break;
|
|
4184
|
+
}
|
|
4185
|
+
case "IConcat": {
|
|
4186
|
+
copyToArray(self.left, array3, initial);
|
|
4187
|
+
copyToArray(self.right, array3, initial + self.left.length);
|
|
4188
|
+
break;
|
|
4189
|
+
}
|
|
4190
|
+
case "ISingleton": {
|
|
4191
|
+
array3[initial] = self.backing.a;
|
|
4192
|
+
break;
|
|
4193
|
+
}
|
|
4194
|
+
case "ISlice": {
|
|
4195
|
+
let i = 0;
|
|
4196
|
+
let j = initial;
|
|
4197
|
+
while (i < self.length) {
|
|
4198
|
+
array3[j] = unsafeGet2(self, i);
|
|
4199
|
+
i += 1;
|
|
4200
|
+
j += 1;
|
|
4201
|
+
}
|
|
4202
|
+
break;
|
|
4203
|
+
}
|
|
4204
|
+
}
|
|
4205
|
+
};
|
|
4206
|
+
var toReadonlyArray_ = (self) => {
|
|
4207
|
+
switch (self.backing._tag) {
|
|
4208
|
+
case "IEmpty": {
|
|
4209
|
+
return emptyArray;
|
|
4210
|
+
}
|
|
4211
|
+
case "IArray": {
|
|
4212
|
+
return self.backing.array;
|
|
4213
|
+
}
|
|
4214
|
+
default: {
|
|
4215
|
+
const arr = new Array(self.length);
|
|
4216
|
+
copyToArray(self, arr, 0);
|
|
4217
|
+
self.backing = {
|
|
4218
|
+
_tag: "IArray",
|
|
4219
|
+
array: arr
|
|
4220
|
+
};
|
|
4221
|
+
self.left = _empty;
|
|
4222
|
+
self.right = _empty;
|
|
4223
|
+
self.depth = 0;
|
|
4224
|
+
return arr;
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
};
|
|
4228
|
+
var toReadonlyArray = toReadonlyArray_;
|
|
4229
|
+
var reverseChunk = (self) => {
|
|
4230
|
+
switch (self.backing._tag) {
|
|
4231
|
+
case "IEmpty":
|
|
4232
|
+
case "ISingleton":
|
|
4233
|
+
return self;
|
|
4234
|
+
case "IArray": {
|
|
4235
|
+
return makeChunk({
|
|
4236
|
+
_tag: "IArray",
|
|
4237
|
+
array: reverse(self.backing.array)
|
|
4238
|
+
});
|
|
4239
|
+
}
|
|
4240
|
+
case "IConcat": {
|
|
4241
|
+
return makeChunk({
|
|
4242
|
+
_tag: "IConcat",
|
|
4243
|
+
left: reverse2(self.backing.right),
|
|
4244
|
+
right: reverse2(self.backing.left)
|
|
4245
|
+
});
|
|
4246
|
+
}
|
|
4247
|
+
case "ISlice":
|
|
4248
|
+
return unsafeFromArray(reverse(toReadonlyArray(self)));
|
|
4249
|
+
}
|
|
4250
|
+
};
|
|
4251
|
+
var reverse2 = reverseChunk;
|
|
4252
|
+
var unsafeFromArray = (self) => self.length === 0 ? empty2() : self.length === 1 ? of(self[0]) : makeChunk({
|
|
4253
|
+
_tag: "IArray",
|
|
4254
|
+
array: self
|
|
4255
|
+
});
|
|
4256
|
+
var unsafeFromNonEmptyArray = (self) => unsafeFromArray(self);
|
|
4257
|
+
var unsafeGet2 = /* @__PURE__ */ dual(2, (self, index) => {
|
|
4258
|
+
switch (self.backing._tag) {
|
|
4259
|
+
case "IEmpty": {
|
|
4260
|
+
throw new Error(`Index out of bounds`);
|
|
4261
|
+
}
|
|
4262
|
+
case "ISingleton": {
|
|
4263
|
+
if (index !== 0) {
|
|
4264
|
+
throw new Error(`Index out of bounds`);
|
|
4265
|
+
}
|
|
4266
|
+
return self.backing.a;
|
|
4267
|
+
}
|
|
4268
|
+
case "IArray": {
|
|
4269
|
+
if (index >= self.length || index < 0) {
|
|
4270
|
+
throw new Error(`Index out of bounds`);
|
|
4271
|
+
}
|
|
4272
|
+
return self.backing.array[index];
|
|
4273
|
+
}
|
|
4274
|
+
case "IConcat": {
|
|
4275
|
+
return index < self.left.length ? unsafeGet2(self.left, index) : unsafeGet2(self.right, index - self.left.length);
|
|
4276
|
+
}
|
|
4277
|
+
case "ISlice": {
|
|
4278
|
+
return unsafeGet2(self.backing.chunk, index + self.backing.offset);
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
});
|
|
4282
|
+
var prepend = /* @__PURE__ */ dual(2, (self, elem) => appendAll2(of(elem), self));
|
|
4283
|
+
var appendAll2 = /* @__PURE__ */ dual(2, (self, that) => {
|
|
4284
|
+
if (self.backing._tag === "IEmpty") {
|
|
4285
|
+
return that;
|
|
4286
|
+
}
|
|
4287
|
+
if (that.backing._tag === "IEmpty") {
|
|
4288
|
+
return self;
|
|
4289
|
+
}
|
|
4290
|
+
const diff = that.depth - self.depth;
|
|
4291
|
+
if (Math.abs(diff) <= 1) {
|
|
4292
|
+
return makeChunk({
|
|
4293
|
+
_tag: "IConcat",
|
|
4294
|
+
left: self,
|
|
4295
|
+
right: that
|
|
4296
|
+
});
|
|
4297
|
+
} else if (diff < -1) {
|
|
4298
|
+
if (self.left.depth >= self.right.depth) {
|
|
4299
|
+
const nr = appendAll2(self.right, that);
|
|
4300
|
+
return makeChunk({
|
|
4301
|
+
_tag: "IConcat",
|
|
4302
|
+
left: self.left,
|
|
4303
|
+
right: nr
|
|
4304
|
+
});
|
|
4305
|
+
} else {
|
|
4306
|
+
const nrr = appendAll2(self.right.right, that);
|
|
4307
|
+
if (nrr.depth === self.depth - 3) {
|
|
4308
|
+
const nr = makeChunk({
|
|
4309
|
+
_tag: "IConcat",
|
|
4310
|
+
left: self.right.left,
|
|
4311
|
+
right: nrr
|
|
4312
|
+
});
|
|
4313
|
+
return makeChunk({
|
|
4314
|
+
_tag: "IConcat",
|
|
4315
|
+
left: self.left,
|
|
4316
|
+
right: nr
|
|
4317
|
+
});
|
|
4318
|
+
} else {
|
|
4319
|
+
const nl = makeChunk({
|
|
4320
|
+
_tag: "IConcat",
|
|
4321
|
+
left: self.left,
|
|
4322
|
+
right: self.right.left
|
|
4323
|
+
});
|
|
4324
|
+
return makeChunk({
|
|
4325
|
+
_tag: "IConcat",
|
|
4326
|
+
left: nl,
|
|
4327
|
+
right: nrr
|
|
4328
|
+
});
|
|
4329
|
+
}
|
|
4330
|
+
}
|
|
4331
|
+
} else {
|
|
4332
|
+
if (that.right.depth >= that.left.depth) {
|
|
4333
|
+
const nl = appendAll2(self, that.left);
|
|
4334
|
+
return makeChunk({
|
|
4335
|
+
_tag: "IConcat",
|
|
4336
|
+
left: nl,
|
|
4337
|
+
right: that.right
|
|
4338
|
+
});
|
|
4339
|
+
} else {
|
|
4340
|
+
const nll = appendAll2(self, that.left.left);
|
|
4341
|
+
if (nll.depth === that.depth - 3) {
|
|
4342
|
+
const nl = makeChunk({
|
|
4343
|
+
_tag: "IConcat",
|
|
4344
|
+
left: nll,
|
|
4345
|
+
right: that.left.right
|
|
4346
|
+
});
|
|
4347
|
+
return makeChunk({
|
|
4348
|
+
_tag: "IConcat",
|
|
4349
|
+
left: nl,
|
|
4350
|
+
right: that.right
|
|
4351
|
+
});
|
|
4352
|
+
} else {
|
|
4353
|
+
const nr = makeChunk({
|
|
4354
|
+
_tag: "IConcat",
|
|
4355
|
+
left: that.left.right,
|
|
4356
|
+
right: that.right
|
|
4357
|
+
});
|
|
4358
|
+
return makeChunk({
|
|
4359
|
+
_tag: "IConcat",
|
|
4360
|
+
left: nll,
|
|
4361
|
+
right: nr
|
|
4362
|
+
});
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
});
|
|
4367
|
+
var isEmpty = (self) => self.length === 0;
|
|
4368
|
+
var isNonEmpty = (self) => self.length > 0;
|
|
4369
|
+
var unsafeHead = (self) => unsafeGet2(self, 0);
|
|
4370
|
+
var headNonEmpty2 = unsafeHead;
|
|
4053
4371
|
|
|
4054
|
-
// node_modules/.pnpm
|
|
4055
|
-
var
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4372
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/config.js
|
|
4373
|
+
var SIZE = 5;
|
|
4374
|
+
var BUCKET_SIZE = /* @__PURE__ */ Math.pow(2, SIZE);
|
|
4375
|
+
var MASK = BUCKET_SIZE - 1;
|
|
4376
|
+
var MAX_INDEX_NODE = BUCKET_SIZE / 2;
|
|
4377
|
+
var MIN_ARRAY_NODE = BUCKET_SIZE / 4;
|
|
4378
|
+
|
|
4379
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
|
|
4380
|
+
function popcount(x) {
|
|
4381
|
+
x -= x >> 1 & 1431655765;
|
|
4382
|
+
x = (x & 858993459) + (x >> 2 & 858993459);
|
|
4383
|
+
x = x + (x >> 4) & 252645135;
|
|
4384
|
+
x += x >> 8;
|
|
4385
|
+
x += x >> 16;
|
|
4386
|
+
return x & 127;
|
|
4387
|
+
}
|
|
4388
|
+
function hashFragment(shift, h) {
|
|
4389
|
+
return h >>> shift & MASK;
|
|
4390
|
+
}
|
|
4391
|
+
function toBitmap(x) {
|
|
4392
|
+
return 1 << x;
|
|
4393
|
+
}
|
|
4394
|
+
function fromBitmap(bitmap, bit) {
|
|
4395
|
+
return popcount(bitmap & bit - 1);
|
|
4396
|
+
}
|
|
4397
|
+
|
|
4398
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/stack.js
|
|
4399
|
+
var make5 = (value, previous) => ({
|
|
4400
|
+
value,
|
|
4401
|
+
previous
|
|
4402
|
+
});
|
|
4403
|
+
|
|
4404
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/array.js
|
|
4405
|
+
function arrayUpdate(mutate3, at, v, arr) {
|
|
4406
|
+
let out = arr;
|
|
4407
|
+
if (!mutate3) {
|
|
4408
|
+
const len = arr.length;
|
|
4409
|
+
out = new Array(len);
|
|
4410
|
+
for (let i = 0; i < len; ++i) out[i] = arr[i];
|
|
4411
|
+
}
|
|
4412
|
+
out[at] = v;
|
|
4413
|
+
return out;
|
|
4414
|
+
}
|
|
4415
|
+
function arraySpliceOut(mutate3, at, arr) {
|
|
4416
|
+
const newLen = arr.length - 1;
|
|
4417
|
+
let i = 0;
|
|
4418
|
+
let g = 0;
|
|
4419
|
+
let out = arr;
|
|
4420
|
+
if (mutate3) {
|
|
4421
|
+
i = g = at;
|
|
4422
|
+
} else {
|
|
4423
|
+
out = new Array(newLen);
|
|
4424
|
+
while (i < at) out[g++] = arr[i++];
|
|
4064
4425
|
}
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4426
|
+
++i;
|
|
4427
|
+
while (i <= newLen) out[g++] = arr[i++];
|
|
4428
|
+
if (mutate3) {
|
|
4429
|
+
out.length = newLen;
|
|
4069
4430
|
}
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4431
|
+
return out;
|
|
4432
|
+
}
|
|
4433
|
+
function arraySpliceIn(mutate3, at, v, arr) {
|
|
4434
|
+
const len = arr.length;
|
|
4435
|
+
if (mutate3) {
|
|
4436
|
+
let i2 = len;
|
|
4437
|
+
while (i2 >= at) arr[i2--] = arr[i2];
|
|
4438
|
+
arr[at] = v;
|
|
4439
|
+
return arr;
|
|
4440
|
+
}
|
|
4441
|
+
let i = 0, g = 0;
|
|
4442
|
+
const out = new Array(len + 1);
|
|
4443
|
+
while (i < at) out[g++] = arr[i++];
|
|
4444
|
+
out[at] = v;
|
|
4445
|
+
while (i < len) out[++g] = arr[i++];
|
|
4446
|
+
return out;
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4449
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap/node.js
|
|
4450
|
+
var EmptyNode = class _EmptyNode {
|
|
4451
|
+
_tag = "EmptyNode";
|
|
4452
|
+
modify(edit, _shift, f, hash2, key, size4) {
|
|
4453
|
+
const v = f(none2());
|
|
4454
|
+
if (isNone2(v)) return new _EmptyNode();
|
|
4455
|
+
++size4.value;
|
|
4456
|
+
return new LeafNode(edit, hash2, key, v);
|
|
4457
|
+
}
|
|
4458
|
+
};
|
|
4459
|
+
function isEmptyNode(a) {
|
|
4460
|
+
return isTagged(a, "EmptyNode");
|
|
4461
|
+
}
|
|
4462
|
+
function isLeafNode(node) {
|
|
4463
|
+
return isEmptyNode(node) || node._tag === "LeafNode" || node._tag === "CollisionNode";
|
|
4464
|
+
}
|
|
4465
|
+
function canEditNode(node, edit) {
|
|
4466
|
+
return isEmptyNode(node) ? false : edit === node.edit;
|
|
4467
|
+
}
|
|
4468
|
+
var LeafNode = class _LeafNode {
|
|
4469
|
+
edit;
|
|
4470
|
+
hash;
|
|
4471
|
+
key;
|
|
4472
|
+
value;
|
|
4473
|
+
_tag = "LeafNode";
|
|
4474
|
+
constructor(edit, hash2, key, value) {
|
|
4475
|
+
this.edit = edit;
|
|
4476
|
+
this.hash = hash2;
|
|
4477
|
+
this.key = key;
|
|
4478
|
+
this.value = value;
|
|
4479
|
+
}
|
|
4480
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4481
|
+
if (equals(key, this.key)) {
|
|
4482
|
+
const v2 = f(this.value);
|
|
4483
|
+
if (v2 === this.value) return this;
|
|
4484
|
+
else if (isNone2(v2)) {
|
|
4485
|
+
--size4.value;
|
|
4486
|
+
return new EmptyNode();
|
|
4487
|
+
}
|
|
4488
|
+
if (canEditNode(this, edit)) {
|
|
4489
|
+
this.value = v2;
|
|
4490
|
+
return this;
|
|
4491
|
+
}
|
|
4492
|
+
return new _LeafNode(edit, hash2, key, v2);
|
|
4493
|
+
}
|
|
4494
|
+
const v = f(none2());
|
|
4495
|
+
if (isNone2(v)) return this;
|
|
4496
|
+
++size4.value;
|
|
4497
|
+
return mergeLeaves(edit, shift, this.hash, this, hash2, new _LeafNode(edit, hash2, key, v));
|
|
4498
|
+
}
|
|
4499
|
+
};
|
|
4500
|
+
var CollisionNode = class _CollisionNode {
|
|
4501
|
+
edit;
|
|
4502
|
+
hash;
|
|
4503
|
+
children;
|
|
4504
|
+
_tag = "CollisionNode";
|
|
4505
|
+
constructor(edit, hash2, children) {
|
|
4506
|
+
this.edit = edit;
|
|
4507
|
+
this.hash = hash2;
|
|
4508
|
+
this.children = children;
|
|
4509
|
+
}
|
|
4510
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4511
|
+
if (hash2 === this.hash) {
|
|
4512
|
+
const canEdit = canEditNode(this, edit);
|
|
4513
|
+
const list = this.updateCollisionList(canEdit, edit, this.hash, this.children, f, key, size4);
|
|
4514
|
+
if (list === this.children) return this;
|
|
4515
|
+
return list.length > 1 ? new _CollisionNode(edit, this.hash, list) : list[0];
|
|
4516
|
+
}
|
|
4517
|
+
const v = f(none2());
|
|
4518
|
+
if (isNone2(v)) return this;
|
|
4519
|
+
++size4.value;
|
|
4520
|
+
return mergeLeaves(edit, shift, this.hash, this, hash2, new LeafNode(edit, hash2, key, v));
|
|
4521
|
+
}
|
|
4522
|
+
updateCollisionList(mutate3, edit, hash2, list, f, key, size4) {
|
|
4523
|
+
const len = list.length;
|
|
4524
|
+
for (let i = 0; i < len; ++i) {
|
|
4525
|
+
const child = list[i];
|
|
4526
|
+
if ("key" in child && equals(key, child.key)) {
|
|
4527
|
+
const value = child.value;
|
|
4528
|
+
const newValue2 = f(value);
|
|
4529
|
+
if (newValue2 === value) return list;
|
|
4530
|
+
if (isNone2(newValue2)) {
|
|
4531
|
+
--size4.value;
|
|
4532
|
+
return arraySpliceOut(mutate3, i, list);
|
|
4533
|
+
}
|
|
4534
|
+
return arrayUpdate(mutate3, i, new LeafNode(edit, hash2, key, newValue2), list);
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
const newValue = f(none2());
|
|
4538
|
+
if (isNone2(newValue)) return list;
|
|
4539
|
+
++size4.value;
|
|
4540
|
+
return arrayUpdate(mutate3, len, new LeafNode(edit, hash2, key, newValue), list);
|
|
4541
|
+
}
|
|
4542
|
+
};
|
|
4543
|
+
var IndexedNode = class _IndexedNode {
|
|
4544
|
+
edit;
|
|
4545
|
+
mask;
|
|
4546
|
+
children;
|
|
4547
|
+
_tag = "IndexedNode";
|
|
4548
|
+
constructor(edit, mask, children) {
|
|
4549
|
+
this.edit = edit;
|
|
4550
|
+
this.mask = mask;
|
|
4551
|
+
this.children = children;
|
|
4552
|
+
}
|
|
4553
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4554
|
+
const mask = this.mask;
|
|
4555
|
+
const children = this.children;
|
|
4556
|
+
const frag = hashFragment(shift, hash2);
|
|
4557
|
+
const bit = toBitmap(frag);
|
|
4558
|
+
const indx = fromBitmap(mask, bit);
|
|
4559
|
+
const exists = mask & bit;
|
|
4560
|
+
const canEdit = canEditNode(this, edit);
|
|
4561
|
+
if (!exists) {
|
|
4562
|
+
const _newChild = new EmptyNode().modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
4563
|
+
if (!_newChild) return this;
|
|
4564
|
+
return children.length >= MAX_INDEX_NODE ? expand(edit, frag, _newChild, mask, children) : new _IndexedNode(edit, mask | bit, arraySpliceIn(canEdit, indx, _newChild, children));
|
|
4565
|
+
}
|
|
4566
|
+
const current = children[indx];
|
|
4567
|
+
const child = current.modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
4568
|
+
if (current === child) return this;
|
|
4569
|
+
let bitmap = mask;
|
|
4570
|
+
let newChildren;
|
|
4571
|
+
if (isEmptyNode(child)) {
|
|
4572
|
+
bitmap &= ~bit;
|
|
4573
|
+
if (!bitmap) return new EmptyNode();
|
|
4574
|
+
if (children.length <= 2 && isLeafNode(children[indx ^ 1])) {
|
|
4575
|
+
return children[indx ^ 1];
|
|
4576
|
+
}
|
|
4577
|
+
newChildren = arraySpliceOut(canEdit, indx, children);
|
|
4578
|
+
} else {
|
|
4579
|
+
newChildren = arrayUpdate(canEdit, indx, child, children);
|
|
4580
|
+
}
|
|
4581
|
+
if (canEdit) {
|
|
4582
|
+
this.mask = bitmap;
|
|
4583
|
+
this.children = newChildren;
|
|
4584
|
+
return this;
|
|
4585
|
+
}
|
|
4586
|
+
return new _IndexedNode(edit, bitmap, newChildren);
|
|
4587
|
+
}
|
|
4588
|
+
};
|
|
4589
|
+
var ArrayNode = class _ArrayNode {
|
|
4590
|
+
edit;
|
|
4591
|
+
size;
|
|
4592
|
+
children;
|
|
4593
|
+
_tag = "ArrayNode";
|
|
4594
|
+
constructor(edit, size4, children) {
|
|
4595
|
+
this.edit = edit;
|
|
4596
|
+
this.size = size4;
|
|
4597
|
+
this.children = children;
|
|
4598
|
+
}
|
|
4599
|
+
modify(edit, shift, f, hash2, key, size4) {
|
|
4600
|
+
let count = this.size;
|
|
4601
|
+
const children = this.children;
|
|
4602
|
+
const frag = hashFragment(shift, hash2);
|
|
4603
|
+
const child = children[frag];
|
|
4604
|
+
const newChild = (child || new EmptyNode()).modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
4605
|
+
if (child === newChild) return this;
|
|
4606
|
+
const canEdit = canEditNode(this, edit);
|
|
4607
|
+
let newChildren;
|
|
4608
|
+
if (isEmptyNode(child) && !isEmptyNode(newChild)) {
|
|
4609
|
+
++count;
|
|
4610
|
+
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
4611
|
+
} else if (!isEmptyNode(child) && isEmptyNode(newChild)) {
|
|
4612
|
+
--count;
|
|
4613
|
+
if (count <= MIN_ARRAY_NODE) {
|
|
4614
|
+
return pack(edit, count, frag, children);
|
|
4615
|
+
}
|
|
4616
|
+
newChildren = arrayUpdate(canEdit, frag, new EmptyNode(), children);
|
|
4617
|
+
} else {
|
|
4618
|
+
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
4619
|
+
}
|
|
4620
|
+
if (canEdit) {
|
|
4621
|
+
this.size = count;
|
|
4622
|
+
this.children = newChildren;
|
|
4623
|
+
return this;
|
|
4624
|
+
}
|
|
4625
|
+
return new _ArrayNode(edit, count, newChildren);
|
|
4626
|
+
}
|
|
4627
|
+
};
|
|
4628
|
+
function pack(edit, count, removed, elements) {
|
|
4629
|
+
const children = new Array(count - 1);
|
|
4630
|
+
let g = 0;
|
|
4631
|
+
let bitmap = 0;
|
|
4632
|
+
for (let i = 0, len = elements.length; i < len; ++i) {
|
|
4633
|
+
if (i !== removed) {
|
|
4634
|
+
const elem = elements[i];
|
|
4635
|
+
if (elem && !isEmptyNode(elem)) {
|
|
4636
|
+
children[g++] = elem;
|
|
4637
|
+
bitmap |= 1 << i;
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
return new IndexedNode(edit, bitmap, children);
|
|
4642
|
+
}
|
|
4643
|
+
function expand(edit, frag, child, bitmap, subNodes) {
|
|
4644
|
+
const arr = [];
|
|
4645
|
+
let bit = bitmap;
|
|
4646
|
+
let count = 0;
|
|
4647
|
+
for (let i = 0; bit; ++i) {
|
|
4648
|
+
if (bit & 1) arr[i] = subNodes[count++];
|
|
4649
|
+
bit >>>= 1;
|
|
4650
|
+
}
|
|
4651
|
+
arr[frag] = child;
|
|
4652
|
+
return new ArrayNode(edit, count + 1, arr);
|
|
4653
|
+
}
|
|
4654
|
+
function mergeLeavesInner(edit, shift, h1, n1, h2, n2) {
|
|
4655
|
+
if (h1 === h2) return new CollisionNode(edit, h1, [n2, n1]);
|
|
4656
|
+
const subH1 = hashFragment(shift, h1);
|
|
4657
|
+
const subH2 = hashFragment(shift, h2);
|
|
4658
|
+
if (subH1 === subH2) {
|
|
4659
|
+
return (child) => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]);
|
|
4660
|
+
} else {
|
|
4661
|
+
const children = subH1 < subH2 ? [n1, n2] : [n2, n1];
|
|
4662
|
+
return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children);
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4665
|
+
function mergeLeaves(edit, shift, h1, n1, h2, n2) {
|
|
4666
|
+
let stack = void 0;
|
|
4667
|
+
let currentShift = shift;
|
|
4668
|
+
while (true) {
|
|
4669
|
+
const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
|
|
4670
|
+
if (typeof res === "function") {
|
|
4671
|
+
stack = make5(res, stack);
|
|
4672
|
+
currentShift = currentShift + SIZE;
|
|
4673
|
+
} else {
|
|
4674
|
+
let final = res;
|
|
4675
|
+
while (stack != null) {
|
|
4676
|
+
final = stack.value(final);
|
|
4677
|
+
stack = stack.previous;
|
|
4678
|
+
}
|
|
4679
|
+
return final;
|
|
4680
|
+
}
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashMap.js
|
|
4685
|
+
var HashMapSymbolKey = "effect/HashMap";
|
|
4686
|
+
var HashMapTypeId = /* @__PURE__ */ Symbol.for(HashMapSymbolKey);
|
|
4687
|
+
var HashMapProto = {
|
|
4688
|
+
[HashMapTypeId]: HashMapTypeId,
|
|
4689
|
+
[Symbol.iterator]() {
|
|
4690
|
+
return new HashMapIterator(this, (k, v) => [k, v]);
|
|
4691
|
+
},
|
|
4692
|
+
[symbol]() {
|
|
4693
|
+
let hash2 = hash(HashMapSymbolKey);
|
|
4694
|
+
for (const item of this) {
|
|
4695
|
+
hash2 ^= pipe(hash(item[0]), combine(hash(item[1])));
|
|
4696
|
+
}
|
|
4697
|
+
return cached(this, hash2);
|
|
4698
|
+
},
|
|
4699
|
+
[symbol2](that) {
|
|
4700
|
+
if (isHashMap(that)) {
|
|
4701
|
+
if (that._size !== this._size) {
|
|
4702
|
+
return false;
|
|
4703
|
+
}
|
|
4704
|
+
for (const item of this) {
|
|
4705
|
+
const elem = pipe(that, getHash(item[0], hash(item[0])));
|
|
4706
|
+
if (isNone2(elem)) {
|
|
4707
|
+
return false;
|
|
4708
|
+
} else {
|
|
4709
|
+
if (!equals(item[1], elem.value)) {
|
|
4710
|
+
return false;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
return true;
|
|
4715
|
+
}
|
|
4716
|
+
return false;
|
|
4717
|
+
},
|
|
4718
|
+
toString() {
|
|
4719
|
+
return format(this.toJSON());
|
|
4720
|
+
},
|
|
4721
|
+
toJSON() {
|
|
4722
|
+
return {
|
|
4723
|
+
_id: "HashMap",
|
|
4724
|
+
values: Array.from(this).map(toJSON)
|
|
4725
|
+
};
|
|
4726
|
+
},
|
|
4727
|
+
[NodeInspectSymbol]() {
|
|
4728
|
+
return this.toJSON();
|
|
4729
|
+
},
|
|
4730
|
+
pipe() {
|
|
4731
|
+
return pipeArguments(this, arguments);
|
|
4732
|
+
}
|
|
4733
|
+
};
|
|
4734
|
+
var makeImpl = (editable, edit, root, size4) => {
|
|
4735
|
+
const map9 = Object.create(HashMapProto);
|
|
4736
|
+
map9._editable = editable;
|
|
4737
|
+
map9._edit = edit;
|
|
4738
|
+
map9._root = root;
|
|
4739
|
+
map9._size = size4;
|
|
4740
|
+
return map9;
|
|
4741
|
+
};
|
|
4742
|
+
var HashMapIterator = class _HashMapIterator {
|
|
4743
|
+
map;
|
|
4744
|
+
f;
|
|
4745
|
+
v;
|
|
4746
|
+
constructor(map9, f) {
|
|
4747
|
+
this.map = map9;
|
|
4748
|
+
this.f = f;
|
|
4749
|
+
this.v = visitLazy(this.map._root, this.f, void 0);
|
|
4750
|
+
}
|
|
4751
|
+
next() {
|
|
4752
|
+
if (isNone2(this.v)) {
|
|
4753
|
+
return {
|
|
4754
|
+
done: true,
|
|
4755
|
+
value: void 0
|
|
4756
|
+
};
|
|
4757
|
+
}
|
|
4758
|
+
const v0 = this.v.value;
|
|
4759
|
+
this.v = applyCont(v0.cont);
|
|
4760
|
+
return {
|
|
4761
|
+
done: false,
|
|
4762
|
+
value: v0.value
|
|
4763
|
+
};
|
|
4764
|
+
}
|
|
4765
|
+
[Symbol.iterator]() {
|
|
4766
|
+
return new _HashMapIterator(this.map, this.f);
|
|
4767
|
+
}
|
|
4768
|
+
};
|
|
4769
|
+
var applyCont = (cont) => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none2();
|
|
4770
|
+
var visitLazy = (node, f, cont = void 0) => {
|
|
4771
|
+
switch (node._tag) {
|
|
4772
|
+
case "LeafNode": {
|
|
4773
|
+
if (isSome2(node.value)) {
|
|
4774
|
+
return some2({
|
|
4775
|
+
value: f(node.key, node.value.value),
|
|
4776
|
+
cont
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4779
|
+
return applyCont(cont);
|
|
4780
|
+
}
|
|
4781
|
+
case "CollisionNode":
|
|
4782
|
+
case "ArrayNode":
|
|
4783
|
+
case "IndexedNode": {
|
|
4784
|
+
const children = node.children;
|
|
4785
|
+
return visitLazyChildren(children.length, children, 0, f, cont);
|
|
4786
|
+
}
|
|
4787
|
+
default: {
|
|
4788
|
+
return applyCont(cont);
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
};
|
|
4792
|
+
var visitLazyChildren = (len, children, i, f, cont) => {
|
|
4793
|
+
while (i < len) {
|
|
4794
|
+
const child = children[i++];
|
|
4795
|
+
if (child && !isEmptyNode(child)) {
|
|
4796
|
+
return visitLazy(child, f, [len, children, i, f, cont]);
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
return applyCont(cont);
|
|
4800
|
+
};
|
|
4801
|
+
var _empty2 = /* @__PURE__ */ makeImpl(false, 0, /* @__PURE__ */ new EmptyNode(), 0);
|
|
4802
|
+
var empty3 = () => _empty2;
|
|
4803
|
+
var isHashMap = (u) => hasProperty(u, HashMapTypeId);
|
|
4804
|
+
var getHash = /* @__PURE__ */ dual(3, (self, key, hash2) => {
|
|
4805
|
+
let node = self._root;
|
|
4806
|
+
let shift = 0;
|
|
4807
|
+
while (true) {
|
|
4808
|
+
switch (node._tag) {
|
|
4809
|
+
case "LeafNode": {
|
|
4810
|
+
return equals(key, node.key) ? node.value : none2();
|
|
4811
|
+
}
|
|
4812
|
+
case "CollisionNode": {
|
|
4813
|
+
if (hash2 === node.hash) {
|
|
4814
|
+
const children = node.children;
|
|
4815
|
+
for (let i = 0, len = children.length; i < len; ++i) {
|
|
4816
|
+
const child = children[i];
|
|
4817
|
+
if ("key" in child && equals(key, child.key)) {
|
|
4818
|
+
return child.value;
|
|
4819
|
+
}
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
return none2();
|
|
4823
|
+
}
|
|
4824
|
+
case "IndexedNode": {
|
|
4825
|
+
const frag = hashFragment(shift, hash2);
|
|
4826
|
+
const bit = toBitmap(frag);
|
|
4827
|
+
if (node.mask & bit) {
|
|
4828
|
+
node = node.children[fromBitmap(node.mask, bit)];
|
|
4829
|
+
shift += SIZE;
|
|
4830
|
+
break;
|
|
4831
|
+
}
|
|
4832
|
+
return none2();
|
|
4833
|
+
}
|
|
4834
|
+
case "ArrayNode": {
|
|
4835
|
+
node = node.children[hashFragment(shift, hash2)];
|
|
4836
|
+
if (node) {
|
|
4837
|
+
shift += SIZE;
|
|
4838
|
+
break;
|
|
4839
|
+
}
|
|
4840
|
+
return none2();
|
|
4841
|
+
}
|
|
4842
|
+
default:
|
|
4843
|
+
return none2();
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
});
|
|
4847
|
+
var set = /* @__PURE__ */ dual(3, (self, key, value) => modifyAt(self, key, () => some2(value)));
|
|
4848
|
+
var setTree = /* @__PURE__ */ dual(3, (self, newRoot, newSize) => {
|
|
4849
|
+
if (self._editable) {
|
|
4850
|
+
;
|
|
4851
|
+
self._root = newRoot;
|
|
4852
|
+
self._size = newSize;
|
|
4853
|
+
return self;
|
|
4854
|
+
}
|
|
4855
|
+
return newRoot === self._root ? self : makeImpl(self._editable, self._edit, newRoot, newSize);
|
|
4856
|
+
});
|
|
4857
|
+
var keys2 = (self) => new HashMapIterator(self, (key) => key);
|
|
4858
|
+
var size = (self) => self._size;
|
|
4859
|
+
var beginMutation = (self) => makeImpl(true, self._edit + 1, self._root, self._size);
|
|
4860
|
+
var modifyAt = /* @__PURE__ */ dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
|
|
4861
|
+
var modifyHash = /* @__PURE__ */ dual(4, (self, key, hash2, f) => {
|
|
4862
|
+
const size4 = {
|
|
4863
|
+
value: self._size
|
|
4864
|
+
};
|
|
4865
|
+
const newRoot = self._root.modify(self._editable ? self._edit : NaN, 0, f, hash2, key, size4);
|
|
4866
|
+
return pipe(self, setTree(newRoot, size4.value));
|
|
4867
|
+
});
|
|
4868
|
+
var forEach = /* @__PURE__ */ dual(2, (self, f) => reduce2(self, void 0, (_, value, key) => f(value, key)));
|
|
4869
|
+
var reduce2 = /* @__PURE__ */ dual(3, (self, zero2, f) => {
|
|
4870
|
+
const root = self._root;
|
|
4871
|
+
if (root._tag === "LeafNode") {
|
|
4872
|
+
return isSome2(root.value) ? f(zero2, root.value.value, root.key) : zero2;
|
|
4873
|
+
}
|
|
4874
|
+
if (root._tag === "EmptyNode") {
|
|
4875
|
+
return zero2;
|
|
4876
|
+
}
|
|
4877
|
+
const toVisit = [root.children];
|
|
4878
|
+
let children;
|
|
4879
|
+
while (children = toVisit.pop()) {
|
|
4880
|
+
for (let i = 0, len = children.length; i < len; ) {
|
|
4881
|
+
const child = children[i++];
|
|
4882
|
+
if (child && !isEmptyNode(child)) {
|
|
4883
|
+
if (child._tag === "LeafNode") {
|
|
4884
|
+
if (isSome2(child.value)) {
|
|
4885
|
+
zero2 = f(zero2, child.value.value, child.key);
|
|
4886
|
+
}
|
|
4887
|
+
} else {
|
|
4888
|
+
toVisit.push(child.children);
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4893
|
+
return zero2;
|
|
4894
|
+
});
|
|
4895
|
+
|
|
4896
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/hashSet.js
|
|
4897
|
+
var HashSetSymbolKey = "effect/HashSet";
|
|
4898
|
+
var HashSetTypeId = /* @__PURE__ */ Symbol.for(HashSetSymbolKey);
|
|
4899
|
+
var HashSetProto = {
|
|
4900
|
+
[HashSetTypeId]: HashSetTypeId,
|
|
4901
|
+
[Symbol.iterator]() {
|
|
4902
|
+
return keys2(this._keyMap);
|
|
4903
|
+
},
|
|
4904
|
+
[symbol]() {
|
|
4905
|
+
return cached(this, combine(hash(this._keyMap))(hash(HashSetSymbolKey)));
|
|
4906
|
+
},
|
|
4907
|
+
[symbol2](that) {
|
|
4908
|
+
if (isHashSet(that)) {
|
|
4909
|
+
return size(this._keyMap) === size(that._keyMap) && equals(this._keyMap, that._keyMap);
|
|
4910
|
+
}
|
|
4911
|
+
return false;
|
|
4912
|
+
},
|
|
4913
|
+
toString() {
|
|
4914
|
+
return format(this.toJSON());
|
|
4915
|
+
},
|
|
4916
|
+
toJSON() {
|
|
4917
|
+
return {
|
|
4918
|
+
_id: "HashSet",
|
|
4919
|
+
values: Array.from(this).map(toJSON)
|
|
4920
|
+
};
|
|
4921
|
+
},
|
|
4922
|
+
[NodeInspectSymbol]() {
|
|
4923
|
+
return this.toJSON();
|
|
4924
|
+
},
|
|
4925
|
+
pipe() {
|
|
4926
|
+
return pipeArguments(this, arguments);
|
|
4927
|
+
}
|
|
4928
|
+
};
|
|
4929
|
+
var makeImpl2 = (keyMap) => {
|
|
4930
|
+
const set2 = Object.create(HashSetProto);
|
|
4931
|
+
set2._keyMap = keyMap;
|
|
4932
|
+
return set2;
|
|
4933
|
+
};
|
|
4934
|
+
var isHashSet = (u) => hasProperty(u, HashSetTypeId);
|
|
4935
|
+
var _empty3 = /* @__PURE__ */ makeImpl2(/* @__PURE__ */ empty3());
|
|
4936
|
+
var empty4 = () => _empty3;
|
|
4937
|
+
var size2 = (self) => size(self._keyMap);
|
|
4938
|
+
var beginMutation2 = (self) => makeImpl2(beginMutation(self._keyMap));
|
|
4939
|
+
var endMutation = (self) => {
|
|
4940
|
+
;
|
|
4941
|
+
self._keyMap._editable = false;
|
|
4942
|
+
return self;
|
|
4943
|
+
};
|
|
4944
|
+
var mutate = /* @__PURE__ */ dual(2, (self, f) => {
|
|
4945
|
+
const transient = beginMutation2(self);
|
|
4946
|
+
f(transient);
|
|
4947
|
+
return endMutation(transient);
|
|
4948
|
+
});
|
|
4949
|
+
var add = /* @__PURE__ */ dual(2, (self, value) => self._keyMap._editable ? (set(value, true)(self._keyMap), self) : makeImpl2(set(value, true)(self._keyMap)));
|
|
4950
|
+
var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate(empty4(), (set2) => {
|
|
4951
|
+
forEach2(self, (value) => add(set2, value));
|
|
4952
|
+
for (const value of that) {
|
|
4953
|
+
add(set2, value);
|
|
4954
|
+
}
|
|
4955
|
+
}));
|
|
4956
|
+
var forEach2 = /* @__PURE__ */ dual(2, (self, f) => forEach(self._keyMap, (_, k) => f(k)));
|
|
4957
|
+
|
|
4958
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/HashSet.js
|
|
4959
|
+
var empty5 = empty4;
|
|
4960
|
+
var size3 = size2;
|
|
4961
|
+
var add2 = add;
|
|
4962
|
+
var union3 = union2;
|
|
4963
|
+
|
|
4964
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/data.js
|
|
4965
|
+
var ArrayProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Array.prototype), {
|
|
4966
|
+
[symbol]() {
|
|
4967
|
+
return cached(this, array2(this));
|
|
4968
|
+
},
|
|
4969
|
+
[symbol2](that) {
|
|
4970
|
+
if (Array.isArray(that) && this.length === that.length) {
|
|
4971
|
+
return this.every((v, i) => equals(v, that[i]));
|
|
4972
|
+
} else {
|
|
4973
|
+
return false;
|
|
4974
|
+
}
|
|
4975
|
+
}
|
|
4976
|
+
});
|
|
4977
|
+
var Structural = /* @__PURE__ */ (function() {
|
|
4978
|
+
function Structural2(args2) {
|
|
4979
|
+
if (args2) {
|
|
4980
|
+
Object.assign(this, args2);
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
Structural2.prototype = StructuralPrototype;
|
|
4984
|
+
return Structural2;
|
|
4985
|
+
})();
|
|
4986
|
+
|
|
4987
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/opCodes/cause.js
|
|
4988
|
+
var OP_DIE = "Die";
|
|
4989
|
+
var OP_EMPTY = "Empty";
|
|
4990
|
+
var OP_FAIL = "Fail";
|
|
4991
|
+
var OP_INTERRUPT = "Interrupt";
|
|
4992
|
+
var OP_PARALLEL = "Parallel";
|
|
4993
|
+
var OP_SEQUENTIAL = "Sequential";
|
|
4994
|
+
|
|
4995
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/cause.js
|
|
4996
|
+
var CauseSymbolKey = "effect/Cause";
|
|
4997
|
+
var CauseTypeId = /* @__PURE__ */ Symbol.for(CauseSymbolKey);
|
|
4998
|
+
var variance = {
|
|
4999
|
+
/* c8 ignore next */
|
|
5000
|
+
_E: (_) => _
|
|
5001
|
+
};
|
|
5002
|
+
var proto = {
|
|
5003
|
+
[CauseTypeId]: variance,
|
|
5004
|
+
[symbol]() {
|
|
5005
|
+
return pipe(hash(CauseSymbolKey), combine(hash(flattenCause(this))), cached(this));
|
|
5006
|
+
},
|
|
5007
|
+
[symbol2](that) {
|
|
5008
|
+
return isCause(that) && causeEquals(this, that);
|
|
5009
|
+
},
|
|
5010
|
+
pipe() {
|
|
5011
|
+
return pipeArguments(this, arguments);
|
|
5012
|
+
},
|
|
5013
|
+
toJSON() {
|
|
5014
|
+
switch (this._tag) {
|
|
5015
|
+
case "Empty":
|
|
5016
|
+
return {
|
|
5017
|
+
_id: "Cause",
|
|
5018
|
+
_tag: this._tag
|
|
5019
|
+
};
|
|
5020
|
+
case "Die":
|
|
5021
|
+
return {
|
|
5022
|
+
_id: "Cause",
|
|
5023
|
+
_tag: this._tag,
|
|
5024
|
+
defect: toJSON(this.defect)
|
|
5025
|
+
};
|
|
5026
|
+
case "Interrupt":
|
|
5027
|
+
return {
|
|
5028
|
+
_id: "Cause",
|
|
5029
|
+
_tag: this._tag,
|
|
5030
|
+
fiberId: this.fiberId.toJSON()
|
|
5031
|
+
};
|
|
5032
|
+
case "Fail":
|
|
5033
|
+
return {
|
|
5034
|
+
_id: "Cause",
|
|
5035
|
+
_tag: this._tag,
|
|
5036
|
+
failure: toJSON(this.error)
|
|
5037
|
+
};
|
|
5038
|
+
case "Sequential":
|
|
5039
|
+
case "Parallel":
|
|
5040
|
+
return {
|
|
5041
|
+
_id: "Cause",
|
|
5042
|
+
_tag: this._tag,
|
|
5043
|
+
left: toJSON(this.left),
|
|
5044
|
+
right: toJSON(this.right)
|
|
5045
|
+
};
|
|
5046
|
+
}
|
|
5047
|
+
},
|
|
5048
|
+
toString() {
|
|
5049
|
+
return pretty(this);
|
|
5050
|
+
},
|
|
5051
|
+
[NodeInspectSymbol]() {
|
|
5052
|
+
return this.toJSON();
|
|
5053
|
+
}
|
|
5054
|
+
};
|
|
5055
|
+
var fail2 = (error) => {
|
|
5056
|
+
const o = Object.create(proto);
|
|
5057
|
+
o._tag = OP_FAIL;
|
|
5058
|
+
o.error = error;
|
|
5059
|
+
return o;
|
|
5060
|
+
};
|
|
5061
|
+
var parallel = (left3, right3) => {
|
|
5062
|
+
const o = Object.create(proto);
|
|
5063
|
+
o._tag = OP_PARALLEL;
|
|
5064
|
+
o.left = left3;
|
|
5065
|
+
o.right = right3;
|
|
5066
|
+
return o;
|
|
5067
|
+
};
|
|
5068
|
+
var sequential = (left3, right3) => {
|
|
5069
|
+
const o = Object.create(proto);
|
|
5070
|
+
o._tag = OP_SEQUENTIAL;
|
|
5071
|
+
o.left = left3;
|
|
5072
|
+
o.right = right3;
|
|
5073
|
+
return o;
|
|
5074
|
+
};
|
|
5075
|
+
var isCause = (u) => hasProperty(u, CauseTypeId);
|
|
5076
|
+
var isInterruptedOnly = (self) => reduceWithContext(void 0, IsInterruptedOnlyCauseReducer)(self);
|
|
5077
|
+
var causeEquals = (left3, right3) => {
|
|
5078
|
+
let leftStack = of(left3);
|
|
5079
|
+
let rightStack = of(right3);
|
|
5080
|
+
while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
|
|
5081
|
+
const [leftParallel, leftSequential] = pipe(headNonEmpty2(leftStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
|
|
5082
|
+
const [par, seq] = evaluateCause(cause);
|
|
5083
|
+
return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll2(seq))]);
|
|
5084
|
+
}));
|
|
5085
|
+
const [rightParallel, rightSequential] = pipe(headNonEmpty2(rightStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
|
|
5086
|
+
const [par, seq] = evaluateCause(cause);
|
|
5087
|
+
return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll2(seq))]);
|
|
5088
|
+
}));
|
|
5089
|
+
if (!equals(leftParallel, rightParallel)) {
|
|
5090
|
+
return false;
|
|
5091
|
+
}
|
|
5092
|
+
leftStack = leftSequential;
|
|
5093
|
+
rightStack = rightSequential;
|
|
5094
|
+
}
|
|
5095
|
+
return true;
|
|
5096
|
+
};
|
|
5097
|
+
var flattenCause = (cause) => {
|
|
5098
|
+
return flattenCauseLoop(of(cause), empty2());
|
|
5099
|
+
};
|
|
5100
|
+
var flattenCauseLoop = (causes, flattened) => {
|
|
5101
|
+
while (1) {
|
|
5102
|
+
const [parallel2, sequential2] = pipe(causes, reduce([empty5(), empty2()], ([parallel3, sequential3], cause) => {
|
|
5103
|
+
const [par, seq] = evaluateCause(cause);
|
|
5104
|
+
return [pipe(parallel3, union3(par)), pipe(sequential3, appendAll2(seq))];
|
|
5105
|
+
}));
|
|
5106
|
+
const updated = size3(parallel2) > 0 ? pipe(flattened, prepend(parallel2)) : flattened;
|
|
5107
|
+
if (isEmpty(sequential2)) {
|
|
5108
|
+
return reverse2(updated);
|
|
5109
|
+
}
|
|
5110
|
+
causes = sequential2;
|
|
5111
|
+
flattened = updated;
|
|
5112
|
+
}
|
|
5113
|
+
throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
|
|
5114
|
+
};
|
|
5115
|
+
var evaluateCause = (self) => {
|
|
5116
|
+
let cause = self;
|
|
5117
|
+
const stack = [];
|
|
5118
|
+
let _parallel = empty5();
|
|
5119
|
+
let _sequential = empty2();
|
|
5120
|
+
while (cause !== void 0) {
|
|
5121
|
+
switch (cause._tag) {
|
|
5122
|
+
case OP_EMPTY: {
|
|
5123
|
+
if (stack.length === 0) {
|
|
5124
|
+
return [_parallel, _sequential];
|
|
5125
|
+
}
|
|
5126
|
+
cause = stack.pop();
|
|
5127
|
+
break;
|
|
5128
|
+
}
|
|
5129
|
+
case OP_FAIL: {
|
|
5130
|
+
_parallel = add2(_parallel, make4(cause._tag, cause.error));
|
|
5131
|
+
if (stack.length === 0) {
|
|
5132
|
+
return [_parallel, _sequential];
|
|
5133
|
+
}
|
|
5134
|
+
cause = stack.pop();
|
|
5135
|
+
break;
|
|
5136
|
+
}
|
|
5137
|
+
case OP_DIE: {
|
|
5138
|
+
_parallel = add2(_parallel, make4(cause._tag, cause.defect));
|
|
5139
|
+
if (stack.length === 0) {
|
|
5140
|
+
return [_parallel, _sequential];
|
|
5141
|
+
}
|
|
5142
|
+
cause = stack.pop();
|
|
5143
|
+
break;
|
|
5144
|
+
}
|
|
5145
|
+
case OP_INTERRUPT: {
|
|
5146
|
+
_parallel = add2(_parallel, make4(cause._tag, cause.fiberId));
|
|
5147
|
+
if (stack.length === 0) {
|
|
5148
|
+
return [_parallel, _sequential];
|
|
5149
|
+
}
|
|
5150
|
+
cause = stack.pop();
|
|
5151
|
+
break;
|
|
5152
|
+
}
|
|
5153
|
+
case OP_SEQUENTIAL: {
|
|
5154
|
+
switch (cause.left._tag) {
|
|
5155
|
+
case OP_EMPTY: {
|
|
5156
|
+
cause = cause.right;
|
|
5157
|
+
break;
|
|
5158
|
+
}
|
|
5159
|
+
case OP_SEQUENTIAL: {
|
|
5160
|
+
cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
|
|
5161
|
+
break;
|
|
5162
|
+
}
|
|
5163
|
+
case OP_PARALLEL: {
|
|
5164
|
+
cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
|
|
5165
|
+
break;
|
|
5166
|
+
}
|
|
5167
|
+
default: {
|
|
5168
|
+
_sequential = prepend(_sequential, cause.right);
|
|
5169
|
+
cause = cause.left;
|
|
5170
|
+
break;
|
|
5171
|
+
}
|
|
5172
|
+
}
|
|
5173
|
+
break;
|
|
5174
|
+
}
|
|
5175
|
+
case OP_PARALLEL: {
|
|
5176
|
+
stack.push(cause.right);
|
|
5177
|
+
cause = cause.left;
|
|
5178
|
+
break;
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
}
|
|
5182
|
+
throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
|
|
5183
|
+
};
|
|
5184
|
+
var IsInterruptedOnlyCauseReducer = {
|
|
5185
|
+
emptyCase: constTrue,
|
|
5186
|
+
failCase: constFalse,
|
|
5187
|
+
dieCase: constFalse,
|
|
5188
|
+
interruptCase: constTrue,
|
|
5189
|
+
sequentialCase: (_, left3, right3) => left3 && right3,
|
|
5190
|
+
parallelCase: (_, left3, right3) => left3 && right3
|
|
5191
|
+
};
|
|
5192
|
+
var OP_SEQUENTIAL_CASE = "SequentialCase";
|
|
5193
|
+
var OP_PARALLEL_CASE = "ParallelCase";
|
|
5194
|
+
var reduce4 = /* @__PURE__ */ dual(3, (self, zero2, pf) => {
|
|
5195
|
+
let accumulator = zero2;
|
|
5196
|
+
let cause = self;
|
|
5197
|
+
const causes = [];
|
|
5198
|
+
while (cause !== void 0) {
|
|
5199
|
+
const option2 = pf(accumulator, cause);
|
|
5200
|
+
accumulator = isSome2(option2) ? option2.value : accumulator;
|
|
5201
|
+
switch (cause._tag) {
|
|
5202
|
+
case OP_SEQUENTIAL: {
|
|
5203
|
+
causes.push(cause.right);
|
|
5204
|
+
cause = cause.left;
|
|
5205
|
+
break;
|
|
5206
|
+
}
|
|
5207
|
+
case OP_PARALLEL: {
|
|
5208
|
+
causes.push(cause.right);
|
|
5209
|
+
cause = cause.left;
|
|
5210
|
+
break;
|
|
5211
|
+
}
|
|
5212
|
+
default: {
|
|
5213
|
+
cause = void 0;
|
|
5214
|
+
break;
|
|
5215
|
+
}
|
|
5216
|
+
}
|
|
5217
|
+
if (cause === void 0 && causes.length > 0) {
|
|
5218
|
+
cause = causes.pop();
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
return accumulator;
|
|
5222
|
+
});
|
|
5223
|
+
var reduceWithContext = /* @__PURE__ */ dual(3, (self, context, reducer) => {
|
|
5224
|
+
const input = [self];
|
|
5225
|
+
const output = [];
|
|
5226
|
+
while (input.length > 0) {
|
|
5227
|
+
const cause = input.pop();
|
|
5228
|
+
switch (cause._tag) {
|
|
5229
|
+
case OP_EMPTY: {
|
|
5230
|
+
output.push(right2(reducer.emptyCase(context)));
|
|
5231
|
+
break;
|
|
5232
|
+
}
|
|
5233
|
+
case OP_FAIL: {
|
|
5234
|
+
output.push(right2(reducer.failCase(context, cause.error)));
|
|
5235
|
+
break;
|
|
5236
|
+
}
|
|
5237
|
+
case OP_DIE: {
|
|
5238
|
+
output.push(right2(reducer.dieCase(context, cause.defect)));
|
|
5239
|
+
break;
|
|
5240
|
+
}
|
|
5241
|
+
case OP_INTERRUPT: {
|
|
5242
|
+
output.push(right2(reducer.interruptCase(context, cause.fiberId)));
|
|
5243
|
+
break;
|
|
5244
|
+
}
|
|
5245
|
+
case OP_SEQUENTIAL: {
|
|
5246
|
+
input.push(cause.right);
|
|
5247
|
+
input.push(cause.left);
|
|
5248
|
+
output.push(left2({
|
|
5249
|
+
_tag: OP_SEQUENTIAL_CASE
|
|
5250
|
+
}));
|
|
5251
|
+
break;
|
|
5252
|
+
}
|
|
5253
|
+
case OP_PARALLEL: {
|
|
5254
|
+
input.push(cause.right);
|
|
5255
|
+
input.push(cause.left);
|
|
5256
|
+
output.push(left2({
|
|
5257
|
+
_tag: OP_PARALLEL_CASE
|
|
5258
|
+
}));
|
|
5259
|
+
break;
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
const accumulator = [];
|
|
5264
|
+
while (output.length > 0) {
|
|
5265
|
+
const either = output.pop();
|
|
5266
|
+
switch (either._tag) {
|
|
5267
|
+
case "Left": {
|
|
5268
|
+
switch (either.left._tag) {
|
|
5269
|
+
case OP_SEQUENTIAL_CASE: {
|
|
5270
|
+
const left3 = accumulator.pop();
|
|
5271
|
+
const right3 = accumulator.pop();
|
|
5272
|
+
const value = reducer.sequentialCase(context, left3, right3);
|
|
5273
|
+
accumulator.push(value);
|
|
5274
|
+
break;
|
|
5275
|
+
}
|
|
5276
|
+
case OP_PARALLEL_CASE: {
|
|
5277
|
+
const left3 = accumulator.pop();
|
|
5278
|
+
const right3 = accumulator.pop();
|
|
5279
|
+
const value = reducer.parallelCase(context, left3, right3);
|
|
5280
|
+
accumulator.push(value);
|
|
5281
|
+
break;
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
break;
|
|
5285
|
+
}
|
|
5286
|
+
case "Right": {
|
|
5287
|
+
accumulator.push(either.right);
|
|
5288
|
+
break;
|
|
5289
|
+
}
|
|
5290
|
+
}
|
|
5291
|
+
}
|
|
5292
|
+
if (accumulator.length === 0) {
|
|
5293
|
+
throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
5294
|
+
}
|
|
5295
|
+
return accumulator.pop();
|
|
5296
|
+
});
|
|
5297
|
+
var pretty = (cause, options) => {
|
|
5298
|
+
if (isInterruptedOnly(cause)) {
|
|
5299
|
+
return "All fibers interrupted without errors.";
|
|
5300
|
+
}
|
|
5301
|
+
return prettyErrors(cause).map(function(e) {
|
|
5302
|
+
if (options?.renderErrorCause !== true || e.cause === void 0) {
|
|
5303
|
+
return e.stack;
|
|
5304
|
+
}
|
|
5305
|
+
return `${e.stack} {
|
|
5306
|
+
${renderErrorCause(e.cause, " ")}
|
|
5307
|
+
}`;
|
|
5308
|
+
}).join("\n");
|
|
5309
|
+
};
|
|
5310
|
+
var renderErrorCause = (cause, prefix) => {
|
|
5311
|
+
const lines = cause.stack.split("\n");
|
|
5312
|
+
let stack = `${prefix}[cause]: ${lines[0]}`;
|
|
5313
|
+
for (let i = 1, len = lines.length; i < len; i++) {
|
|
5314
|
+
stack += `
|
|
5315
|
+
${prefix}${lines[i]}`;
|
|
5316
|
+
}
|
|
5317
|
+
if (cause.cause) {
|
|
5318
|
+
stack += ` {
|
|
5319
|
+
${renderErrorCause(cause.cause, `${prefix} `)}
|
|
5320
|
+
${prefix}}`;
|
|
5321
|
+
}
|
|
5322
|
+
return stack;
|
|
5323
|
+
};
|
|
5324
|
+
var PrettyError = class _PrettyError extends globalThis.Error {
|
|
5325
|
+
span = void 0;
|
|
5326
|
+
constructor(originalError) {
|
|
5327
|
+
const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
|
|
5328
|
+
const prevLimit = Error.stackTraceLimit;
|
|
5329
|
+
Error.stackTraceLimit = 1;
|
|
5330
|
+
super(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
|
|
5331
|
+
cause: new _PrettyError(originalError.cause)
|
|
5332
|
+
} : void 0);
|
|
5333
|
+
if (this.message === "") {
|
|
5334
|
+
this.message = "An error has occurred";
|
|
5335
|
+
}
|
|
5336
|
+
Error.stackTraceLimit = prevLimit;
|
|
5337
|
+
this.name = originalError instanceof Error ? originalError.name : "Error";
|
|
5338
|
+
if (originalErrorIsObject) {
|
|
5339
|
+
if (spanSymbol in originalError) {
|
|
5340
|
+
this.span = originalError[spanSymbol];
|
|
5341
|
+
}
|
|
5342
|
+
Object.keys(originalError).forEach((key) => {
|
|
5343
|
+
if (!(key in this)) {
|
|
5344
|
+
this[key] = originalError[key];
|
|
5345
|
+
}
|
|
5346
|
+
});
|
|
5347
|
+
}
|
|
5348
|
+
this.stack = prettyErrorStack(`${this.name}: ${this.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", this.span);
|
|
5349
|
+
}
|
|
5350
|
+
};
|
|
5351
|
+
var prettyErrorMessage = (u) => {
|
|
5352
|
+
if (typeof u === "string") {
|
|
5353
|
+
return u;
|
|
5354
|
+
}
|
|
5355
|
+
if (typeof u === "object" && u !== null && u instanceof Error) {
|
|
5356
|
+
return u.message;
|
|
5357
|
+
}
|
|
5358
|
+
try {
|
|
5359
|
+
if (hasProperty(u, "toString") && isFunction2(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
|
|
5360
|
+
return u["toString"]();
|
|
5361
|
+
}
|
|
5362
|
+
} catch {
|
|
5363
|
+
}
|
|
5364
|
+
return stringifyCircular(u);
|
|
5365
|
+
};
|
|
5366
|
+
var locationRegex = /\((.*)\)/g;
|
|
5367
|
+
var spanToTrace = /* @__PURE__ */ globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
5368
|
+
var prettyErrorStack = (message, stack, span) => {
|
|
5369
|
+
const out = [message];
|
|
5370
|
+
const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
|
|
5371
|
+
for (let i = 1; i < lines.length; i++) {
|
|
5372
|
+
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
5373
|
+
i++;
|
|
5374
|
+
continue;
|
|
5375
|
+
}
|
|
5376
|
+
if (lines[i].includes("Generator.next")) {
|
|
5377
|
+
break;
|
|
5378
|
+
}
|
|
5379
|
+
if (lines[i].includes("effect_internal_function")) {
|
|
5380
|
+
break;
|
|
5381
|
+
}
|
|
5382
|
+
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
|
|
5383
|
+
}
|
|
5384
|
+
if (span) {
|
|
5385
|
+
let current = span;
|
|
5386
|
+
let i = 0;
|
|
5387
|
+
while (current && current._tag === "Span" && i < 10) {
|
|
5388
|
+
const stackFn = spanToTrace.get(current);
|
|
5389
|
+
if (typeof stackFn === "function") {
|
|
5390
|
+
const stack2 = stackFn();
|
|
5391
|
+
if (typeof stack2 === "string") {
|
|
5392
|
+
const locationMatchAll = stack2.matchAll(locationRegex);
|
|
5393
|
+
let match3 = false;
|
|
5394
|
+
for (const [, location] of locationMatchAll) {
|
|
5395
|
+
match3 = true;
|
|
5396
|
+
out.push(` at ${current.name} (${location})`);
|
|
5397
|
+
}
|
|
5398
|
+
if (!match3) {
|
|
5399
|
+
out.push(` at ${current.name} (${stack2.replace(/^at /, "")})`);
|
|
5400
|
+
}
|
|
5401
|
+
} else {
|
|
5402
|
+
out.push(` at ${current.name}`);
|
|
5403
|
+
}
|
|
5404
|
+
} else {
|
|
5405
|
+
out.push(` at ${current.name}`);
|
|
5406
|
+
}
|
|
5407
|
+
current = getOrUndefined(current.parent);
|
|
5408
|
+
i++;
|
|
5409
|
+
}
|
|
5410
|
+
}
|
|
5411
|
+
return out.join("\n");
|
|
5412
|
+
};
|
|
5413
|
+
var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
|
|
5414
|
+
var prettyErrors = (cause) => reduceWithContext(cause, void 0, {
|
|
5415
|
+
emptyCase: () => [],
|
|
5416
|
+
dieCase: (_, unknownError) => {
|
|
5417
|
+
return [new PrettyError(unknownError)];
|
|
5418
|
+
},
|
|
5419
|
+
failCase: (_, error) => {
|
|
5420
|
+
return [new PrettyError(error)];
|
|
5421
|
+
},
|
|
5422
|
+
interruptCase: () => [],
|
|
5423
|
+
parallelCase: (_, l, r) => [...l, ...r],
|
|
5424
|
+
sequentialCase: (_, l, r) => [...l, ...r]
|
|
5425
|
+
});
|
|
5426
|
+
|
|
5427
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/singleShotGen.js
|
|
5428
|
+
var SingleShotGen3 = class _SingleShotGen {
|
|
5429
|
+
self;
|
|
5430
|
+
called = false;
|
|
5431
|
+
constructor(self) {
|
|
5432
|
+
this.self = self;
|
|
5433
|
+
}
|
|
5434
|
+
next(a) {
|
|
5435
|
+
return this.called ? {
|
|
5436
|
+
value: a,
|
|
5437
|
+
done: true
|
|
5438
|
+
} : (this.called = true, {
|
|
5439
|
+
value: this.self,
|
|
5440
|
+
done: false
|
|
5441
|
+
});
|
|
5442
|
+
}
|
|
5443
|
+
return(a) {
|
|
5444
|
+
return {
|
|
5445
|
+
value: a,
|
|
5446
|
+
done: true
|
|
5447
|
+
};
|
|
5448
|
+
}
|
|
5449
|
+
throw(e) {
|
|
5450
|
+
throw e;
|
|
5451
|
+
}
|
|
5452
|
+
[Symbol.iterator]() {
|
|
5453
|
+
return new _SingleShotGen(this.self);
|
|
5454
|
+
}
|
|
5455
|
+
};
|
|
5456
|
+
|
|
5457
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/core.js
|
|
5458
|
+
var EffectTypeId2 = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
5459
|
+
var EffectPrimitive = class {
|
|
5460
|
+
_op;
|
|
5461
|
+
effect_instruction_i0 = void 0;
|
|
5462
|
+
effect_instruction_i1 = void 0;
|
|
5463
|
+
effect_instruction_i2 = void 0;
|
|
5464
|
+
trace = void 0;
|
|
5465
|
+
[EffectTypeId2] = effectVariance;
|
|
5466
|
+
constructor(_op) {
|
|
5467
|
+
this._op = _op;
|
|
5468
|
+
}
|
|
5469
|
+
[symbol2](that) {
|
|
5470
|
+
return this === that;
|
|
5471
|
+
}
|
|
5472
|
+
[symbol]() {
|
|
5473
|
+
return cached(this, random(this));
|
|
5474
|
+
}
|
|
5475
|
+
pipe() {
|
|
5476
|
+
return pipeArguments(this, arguments);
|
|
5477
|
+
}
|
|
5478
|
+
toJSON() {
|
|
5479
|
+
return {
|
|
5480
|
+
_id: "Effect",
|
|
5481
|
+
_op: this._op,
|
|
5482
|
+
effect_instruction_i0: toJSON(this.effect_instruction_i0),
|
|
5483
|
+
effect_instruction_i1: toJSON(this.effect_instruction_i1),
|
|
5484
|
+
effect_instruction_i2: toJSON(this.effect_instruction_i2)
|
|
5485
|
+
};
|
|
5486
|
+
}
|
|
5487
|
+
toString() {
|
|
5488
|
+
return format(this.toJSON());
|
|
5489
|
+
}
|
|
5490
|
+
[NodeInspectSymbol]() {
|
|
5491
|
+
return this.toJSON();
|
|
5492
|
+
}
|
|
5493
|
+
[Symbol.iterator]() {
|
|
5494
|
+
return new SingleShotGen3(new YieldWrap(this));
|
|
5495
|
+
}
|
|
5496
|
+
};
|
|
5497
|
+
var EffectPrimitiveFailure = class {
|
|
5498
|
+
_op;
|
|
5499
|
+
effect_instruction_i0 = void 0;
|
|
5500
|
+
effect_instruction_i1 = void 0;
|
|
5501
|
+
effect_instruction_i2 = void 0;
|
|
5502
|
+
trace = void 0;
|
|
5503
|
+
[EffectTypeId2] = effectVariance;
|
|
5504
|
+
constructor(_op) {
|
|
5505
|
+
this._op = _op;
|
|
5506
|
+
this._tag = _op;
|
|
5507
|
+
}
|
|
5508
|
+
[symbol2](that) {
|
|
5509
|
+
return exitIsExit(that) && that._op === "Failure" && // @ts-expect-error
|
|
5510
|
+
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
5511
|
+
}
|
|
5512
|
+
[symbol]() {
|
|
5513
|
+
return pipe(
|
|
5514
|
+
// @ts-expect-error
|
|
5515
|
+
string(this._tag),
|
|
5516
|
+
// @ts-expect-error
|
|
5517
|
+
combine(hash(this.effect_instruction_i0)),
|
|
5518
|
+
cached(this)
|
|
5519
|
+
);
|
|
5520
|
+
}
|
|
5521
|
+
get cause() {
|
|
5522
|
+
return this.effect_instruction_i0;
|
|
5523
|
+
}
|
|
5524
|
+
pipe() {
|
|
5525
|
+
return pipeArguments(this, arguments);
|
|
5526
|
+
}
|
|
5527
|
+
toJSON() {
|
|
5528
|
+
return {
|
|
5529
|
+
_id: "Exit",
|
|
5530
|
+
_tag: this._op,
|
|
5531
|
+
cause: this.cause.toJSON()
|
|
5532
|
+
};
|
|
5533
|
+
}
|
|
5534
|
+
toString() {
|
|
5535
|
+
return format(this.toJSON());
|
|
5536
|
+
}
|
|
5537
|
+
[NodeInspectSymbol]() {
|
|
5538
|
+
return this.toJSON();
|
|
5539
|
+
}
|
|
5540
|
+
[Symbol.iterator]() {
|
|
5541
|
+
return new SingleShotGen3(new YieldWrap(this));
|
|
5542
|
+
}
|
|
5543
|
+
};
|
|
5544
|
+
var EffectPrimitiveSuccess = class {
|
|
5545
|
+
_op;
|
|
5546
|
+
effect_instruction_i0 = void 0;
|
|
5547
|
+
effect_instruction_i1 = void 0;
|
|
5548
|
+
effect_instruction_i2 = void 0;
|
|
5549
|
+
trace = void 0;
|
|
5550
|
+
[EffectTypeId2] = effectVariance;
|
|
5551
|
+
constructor(_op) {
|
|
5552
|
+
this._op = _op;
|
|
5553
|
+
this._tag = _op;
|
|
5554
|
+
}
|
|
5555
|
+
[symbol2](that) {
|
|
5556
|
+
return exitIsExit(that) && that._op === "Success" && // @ts-expect-error
|
|
5557
|
+
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
5558
|
+
}
|
|
5559
|
+
[symbol]() {
|
|
5560
|
+
return pipe(
|
|
5561
|
+
// @ts-expect-error
|
|
5562
|
+
string(this._tag),
|
|
5563
|
+
// @ts-expect-error
|
|
5564
|
+
combine(hash(this.effect_instruction_i0)),
|
|
5565
|
+
cached(this)
|
|
5566
|
+
);
|
|
5567
|
+
}
|
|
5568
|
+
get value() {
|
|
5569
|
+
return this.effect_instruction_i0;
|
|
5570
|
+
}
|
|
5571
|
+
pipe() {
|
|
5572
|
+
return pipeArguments(this, arguments);
|
|
5573
|
+
}
|
|
5574
|
+
toJSON() {
|
|
5575
|
+
return {
|
|
5576
|
+
_id: "Exit",
|
|
5577
|
+
_tag: this._op,
|
|
5578
|
+
value: toJSON(this.value)
|
|
5579
|
+
};
|
|
5580
|
+
}
|
|
5581
|
+
toString() {
|
|
5582
|
+
return format(this.toJSON());
|
|
5583
|
+
}
|
|
5584
|
+
[NodeInspectSymbol]() {
|
|
5585
|
+
return this.toJSON();
|
|
5586
|
+
}
|
|
5587
|
+
[Symbol.iterator]() {
|
|
5588
|
+
return new SingleShotGen3(new YieldWrap(this));
|
|
5589
|
+
}
|
|
5590
|
+
};
|
|
5591
|
+
var isEffect = (u) => hasProperty(u, EffectTypeId2);
|
|
5592
|
+
var withFiberRuntime = (withRuntime) => {
|
|
5593
|
+
const effect = new EffectPrimitive(OP_WITH_RUNTIME);
|
|
5594
|
+
effect.effect_instruction_i0 = withRuntime;
|
|
5595
|
+
return effect;
|
|
5596
|
+
};
|
|
5597
|
+
var originalSymbol = /* @__PURE__ */ Symbol.for("effect/OriginalAnnotation");
|
|
5598
|
+
var capture = (obj, span) => {
|
|
5599
|
+
if (isSome2(span)) {
|
|
5600
|
+
return new Proxy(obj, {
|
|
5601
|
+
has(target, p) {
|
|
5602
|
+
return p === spanSymbol || p === originalSymbol || p in target;
|
|
5603
|
+
},
|
|
5604
|
+
get(target, p) {
|
|
5605
|
+
if (p === spanSymbol) {
|
|
5606
|
+
return span.value;
|
|
5607
|
+
}
|
|
5608
|
+
if (p === originalSymbol) {
|
|
5609
|
+
return obj;
|
|
5610
|
+
}
|
|
5611
|
+
return target[p];
|
|
5612
|
+
}
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5615
|
+
return obj;
|
|
5616
|
+
};
|
|
5617
|
+
var fail3 = (error) => isObject(error) && !(spanSymbol in error) ? withFiberRuntime((fiber) => failCause(fail2(capture(error, currentSpanFromFiber(fiber))))) : failCause(fail2(error));
|
|
5618
|
+
var failCause = (cause) => {
|
|
5619
|
+
const effect = new EffectPrimitiveFailure(OP_FAILURE);
|
|
5620
|
+
effect.effect_instruction_i0 = cause;
|
|
5621
|
+
return effect;
|
|
5622
|
+
};
|
|
5623
|
+
var logLevelAll = {
|
|
5624
|
+
_tag: "All",
|
|
5625
|
+
syslog: 0,
|
|
5626
|
+
label: "ALL",
|
|
5627
|
+
ordinal: Number.MIN_SAFE_INTEGER,
|
|
5628
|
+
pipe() {
|
|
5629
|
+
return pipeArguments(this, arguments);
|
|
5630
|
+
}
|
|
5631
|
+
};
|
|
5632
|
+
var logLevelNone = {
|
|
5633
|
+
_tag: "None",
|
|
5634
|
+
syslog: 7,
|
|
5635
|
+
label: "OFF",
|
|
5636
|
+
ordinal: Number.MAX_SAFE_INTEGER,
|
|
5637
|
+
pipe() {
|
|
5638
|
+
return pipeArguments(this, arguments);
|
|
5639
|
+
}
|
|
5640
|
+
};
|
|
5641
|
+
var RequestResolverSymbolKey = "effect/RequestResolver";
|
|
5642
|
+
var RequestResolverTypeId = /* @__PURE__ */ Symbol.for(RequestResolverSymbolKey);
|
|
5643
|
+
var requestResolverVariance = {
|
|
5644
|
+
/* c8 ignore next */
|
|
5645
|
+
_A: (_) => _,
|
|
5646
|
+
/* c8 ignore next */
|
|
5647
|
+
_R: (_) => _
|
|
5648
|
+
};
|
|
5649
|
+
var RequestResolverImpl = class _RequestResolverImpl {
|
|
5650
|
+
runAll;
|
|
5651
|
+
target;
|
|
5652
|
+
[RequestResolverTypeId] = requestResolverVariance;
|
|
5653
|
+
constructor(runAll, target) {
|
|
5654
|
+
this.runAll = runAll;
|
|
5655
|
+
this.target = target;
|
|
5656
|
+
}
|
|
5657
|
+
[symbol]() {
|
|
5658
|
+
return cached(this, this.target ? hash(this.target) : random(this));
|
|
5659
|
+
}
|
|
5660
|
+
[symbol2](that) {
|
|
5661
|
+
return this.target ? isRequestResolver(that) && equals(this.target, that.target) : this === that;
|
|
5662
|
+
}
|
|
5663
|
+
identified(...ids) {
|
|
5664
|
+
return new _RequestResolverImpl(this.runAll, fromIterable2(ids));
|
|
5665
|
+
}
|
|
5666
|
+
pipe() {
|
|
5667
|
+
return pipeArguments(this, arguments);
|
|
5668
|
+
}
|
|
5669
|
+
};
|
|
5670
|
+
var isRequestResolver = (u) => hasProperty(u, RequestResolverTypeId);
|
|
5671
|
+
var YieldableError = /* @__PURE__ */ (function() {
|
|
5672
|
+
class YieldableError2 extends globalThis.Error {
|
|
5673
|
+
commit() {
|
|
5674
|
+
return fail3(this);
|
|
5675
|
+
}
|
|
5676
|
+
toJSON() {
|
|
5677
|
+
const obj = {
|
|
5678
|
+
...this
|
|
5679
|
+
};
|
|
5680
|
+
if (this.message) obj.message = this.message;
|
|
5681
|
+
if (this.cause) obj.cause = this.cause;
|
|
5682
|
+
return obj;
|
|
5683
|
+
}
|
|
5684
|
+
[NodeInspectSymbol]() {
|
|
5685
|
+
if (this.toString !== globalThis.Error.prototype.toString) {
|
|
5686
|
+
return this.stack ? `${this.toString()}
|
|
5687
|
+
${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
5688
|
+
} else if ("Bun" in globalThis) {
|
|
5689
|
+
return pretty(fail2(this), {
|
|
5690
|
+
renderErrorCause: true
|
|
5691
|
+
});
|
|
5692
|
+
}
|
|
5693
|
+
return this;
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
Object.assign(YieldableError2.prototype, StructuralCommitPrototype);
|
|
5697
|
+
return YieldableError2;
|
|
5698
|
+
})();
|
|
5699
|
+
var makeException = (proto2, tag) => {
|
|
5700
|
+
class Base extends YieldableError {
|
|
5701
|
+
_tag = tag;
|
|
5702
|
+
}
|
|
5703
|
+
Object.assign(Base.prototype, proto2);
|
|
5704
|
+
Base.prototype.name = tag;
|
|
5705
|
+
return Base;
|
|
5706
|
+
};
|
|
5707
|
+
var RuntimeExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/RuntimeException");
|
|
5708
|
+
var RuntimeException = /* @__PURE__ */ makeException({
|
|
5709
|
+
[RuntimeExceptionTypeId]: RuntimeExceptionTypeId
|
|
5710
|
+
}, "RuntimeException");
|
|
5711
|
+
var InterruptedExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/InterruptedException");
|
|
5712
|
+
var InterruptedException = /* @__PURE__ */ makeException({
|
|
5713
|
+
[InterruptedExceptionTypeId]: InterruptedExceptionTypeId
|
|
5714
|
+
}, "InterruptedException");
|
|
5715
|
+
var IllegalArgumentExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/IllegalArgument");
|
|
5716
|
+
var IllegalArgumentException = /* @__PURE__ */ makeException({
|
|
5717
|
+
[IllegalArgumentExceptionTypeId]: IllegalArgumentExceptionTypeId
|
|
5718
|
+
}, "IllegalArgumentException");
|
|
5719
|
+
var NoSuchElementExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/NoSuchElement");
|
|
5720
|
+
var NoSuchElementException = /* @__PURE__ */ makeException({
|
|
5721
|
+
[NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId
|
|
5722
|
+
}, "NoSuchElementException");
|
|
5723
|
+
var InvalidPubSubCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException");
|
|
5724
|
+
var InvalidPubSubCapacityException = /* @__PURE__ */ makeException({
|
|
5725
|
+
[InvalidPubSubCapacityExceptionTypeId]: InvalidPubSubCapacityExceptionTypeId
|
|
5726
|
+
}, "InvalidPubSubCapacityException");
|
|
5727
|
+
var ExceededCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/ExceededCapacityException");
|
|
5728
|
+
var ExceededCapacityException = /* @__PURE__ */ makeException({
|
|
5729
|
+
[ExceededCapacityExceptionTypeId]: ExceededCapacityExceptionTypeId
|
|
5730
|
+
}, "ExceededCapacityException");
|
|
5731
|
+
var TimeoutExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/Timeout");
|
|
5732
|
+
var TimeoutException = /* @__PURE__ */ makeException({
|
|
5733
|
+
[TimeoutExceptionTypeId]: TimeoutExceptionTypeId
|
|
5734
|
+
}, "TimeoutException");
|
|
5735
|
+
var exitIsExit = (u) => isEffect(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
|
|
5736
|
+
var currentSpanFromFiber = (fiber) => {
|
|
5737
|
+
const span = fiber.currentSpan;
|
|
5738
|
+
return span !== void 0 && span._tag === "Span" ? some2(span) : none2();
|
|
5739
|
+
};
|
|
5740
|
+
|
|
5741
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Data.js
|
|
5742
|
+
var Class2 = Structural;
|
|
5743
|
+
var Error2 = /* @__PURE__ */ (function() {
|
|
5744
|
+
const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
|
|
5745
|
+
const O = {
|
|
5746
|
+
BaseEffectError: class extends YieldableError {
|
|
5747
|
+
constructor(args2) {
|
|
5748
|
+
super(args2?.message, args2?.cause ? {
|
|
5749
|
+
cause: args2.cause
|
|
5750
|
+
} : void 0);
|
|
5751
|
+
if (args2) {
|
|
5752
|
+
Object.assign(this, args2);
|
|
5753
|
+
Object.defineProperty(this, plainArgsSymbol, {
|
|
5754
|
+
value: args2,
|
|
5755
|
+
enumerable: false
|
|
5756
|
+
});
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5759
|
+
toJSON() {
|
|
5760
|
+
return {
|
|
5761
|
+
...this[plainArgsSymbol],
|
|
5762
|
+
...this
|
|
5763
|
+
};
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
};
|
|
5767
|
+
return O.BaseEffectError;
|
|
5768
|
+
})();
|
|
5769
|
+
var TaggedError = (tag) => {
|
|
5770
|
+
const O = {
|
|
5771
|
+
BaseEffectError: class extends Error2 {
|
|
5772
|
+
_tag = tag;
|
|
5773
|
+
}
|
|
5774
|
+
};
|
|
5775
|
+
O.BaseEffectError.prototype.name = tag;
|
|
5776
|
+
return O.BaseEffectError;
|
|
5777
|
+
};
|
|
5778
|
+
|
|
5779
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/encoding/common.js
|
|
5780
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
5781
|
+
|
|
5782
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/encoding/base64.js
|
|
5783
|
+
var encode = (bytes) => {
|
|
5784
|
+
const length = bytes.length;
|
|
5785
|
+
let result = "";
|
|
5786
|
+
let i;
|
|
5787
|
+
for (i = 2; i < length; i += 3) {
|
|
5788
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5789
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5790
|
+
result += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
5791
|
+
result += base64abc[bytes[i] & 63];
|
|
5792
|
+
}
|
|
5793
|
+
if (i === length + 1) {
|
|
5794
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5795
|
+
result += base64abc[(bytes[i - 2] & 3) << 4];
|
|
5796
|
+
result += "==";
|
|
5797
|
+
}
|
|
5798
|
+
if (i === length) {
|
|
5799
|
+
result += base64abc[bytes[i - 2] >> 2];
|
|
5800
|
+
result += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
5801
|
+
result += base64abc[(bytes[i - 1] & 15) << 2];
|
|
5802
|
+
result += "=";
|
|
5803
|
+
}
|
|
5804
|
+
return result;
|
|
5805
|
+
};
|
|
5806
|
+
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
5807
|
+
|
|
5808
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
5809
|
+
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
5810
|
+
|
|
5811
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Encoding.js
|
|
5812
|
+
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
5813
|
+
|
|
5814
|
+
// node_modules/.pnpm/@pkg.pr.new+Effect-TS+effect@97ff1dc_6ntygjheib5kdugabxjhox4fte/node_modules/effect/dist/esm/Graph.js
|
|
5815
|
+
var TypeId4 = "~effect/Graph";
|
|
5816
|
+
var Edge = class extends Class2 {
|
|
5817
|
+
};
|
|
5818
|
+
var ProtoGraph = {
|
|
5819
|
+
[TypeId4]: TypeId4,
|
|
5820
|
+
[Symbol.iterator]() {
|
|
5821
|
+
return this.nodes[Symbol.iterator]();
|
|
5822
|
+
},
|
|
5823
|
+
[NodeInspectSymbol]() {
|
|
5824
|
+
return this.toJSON();
|
|
5825
|
+
},
|
|
5826
|
+
[symbol2](that) {
|
|
5827
|
+
if (isGraph(that)) {
|
|
5828
|
+
if (this.nodes.size !== that.nodes.size || this.edges.size !== that.edges.size || this.type !== that.type) {
|
|
5829
|
+
return false;
|
|
5830
|
+
}
|
|
5831
|
+
for (const [nodeIndex, nodeData] of this.nodes) {
|
|
5832
|
+
if (!that.nodes.has(nodeIndex)) {
|
|
5833
|
+
return false;
|
|
5834
|
+
}
|
|
5835
|
+
const otherNodeData = that.nodes.get(nodeIndex);
|
|
5836
|
+
if (!equals(nodeData, otherNodeData)) {
|
|
5837
|
+
return false;
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
for (const [edgeIndex, edgeData] of this.edges) {
|
|
5841
|
+
if (!that.edges.has(edgeIndex)) {
|
|
5842
|
+
return false;
|
|
5843
|
+
}
|
|
5844
|
+
const otherEdge = that.edges.get(edgeIndex);
|
|
5845
|
+
if (!equals(edgeData, otherEdge)) {
|
|
5846
|
+
return false;
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
return true;
|
|
5850
|
+
}
|
|
5851
|
+
return false;
|
|
5852
|
+
},
|
|
5853
|
+
[symbol]() {
|
|
5854
|
+
let hash2 = string("Graph");
|
|
5855
|
+
hash2 = hash2 ^ string(this.type);
|
|
5856
|
+
hash2 = hash2 ^ number(this.nodes.size);
|
|
5857
|
+
hash2 = hash2 ^ number(this.edges.size);
|
|
5858
|
+
for (const [nodeIndex, nodeData] of this.nodes) {
|
|
5859
|
+
hash2 = hash2 ^ hash(nodeIndex) + hash(nodeData);
|
|
5860
|
+
}
|
|
5861
|
+
for (const [edgeIndex, edgeData] of this.edges) {
|
|
5862
|
+
hash2 = hash2 ^ hash(edgeIndex) + hash(edgeData);
|
|
5863
|
+
}
|
|
5864
|
+
return hash2;
|
|
5865
|
+
},
|
|
5866
|
+
toJSON() {
|
|
5867
|
+
return {
|
|
5868
|
+
_id: "Graph",
|
|
5869
|
+
nodeCount: this.nodes.size,
|
|
5870
|
+
edgeCount: this.edges.size,
|
|
5871
|
+
type: this.type
|
|
5872
|
+
};
|
|
5873
|
+
},
|
|
5874
|
+
toString() {
|
|
5875
|
+
return format(this);
|
|
5876
|
+
},
|
|
5877
|
+
pipe() {
|
|
5878
|
+
return pipeArguments(this, arguments);
|
|
5879
|
+
}
|
|
5880
|
+
};
|
|
5881
|
+
var GraphError = class extends (/* @__PURE__ */ TaggedError("GraphError")) {
|
|
5882
|
+
};
|
|
5883
|
+
var missingNode = (node) => new GraphError({
|
|
5884
|
+
message: `Node ${node} does not exist`
|
|
5885
|
+
});
|
|
5886
|
+
var isGraph = (u) => typeof u === "object" && u !== null && TypeId4 in u;
|
|
5887
|
+
var directed = (mutate3) => {
|
|
5888
|
+
const graph = Object.create(ProtoGraph);
|
|
5889
|
+
graph.type = "directed";
|
|
5890
|
+
graph.nodes = /* @__PURE__ */ new Map();
|
|
5891
|
+
graph.edges = /* @__PURE__ */ new Map();
|
|
5892
|
+
graph.adjacency = /* @__PURE__ */ new Map();
|
|
5893
|
+
graph.reverseAdjacency = /* @__PURE__ */ new Map();
|
|
5894
|
+
graph.nextNodeIndex = 0;
|
|
5895
|
+
graph.nextEdgeIndex = 0;
|
|
5896
|
+
graph.isAcyclic = some2(true);
|
|
5897
|
+
graph.mutable = false;
|
|
5898
|
+
if (mutate3) {
|
|
5899
|
+
const mutable = beginMutation3(graph);
|
|
5900
|
+
mutate3(mutable);
|
|
5901
|
+
return endMutation2(mutable);
|
|
5902
|
+
}
|
|
5903
|
+
return graph;
|
|
5904
|
+
};
|
|
5905
|
+
var beginMutation3 = (graph) => {
|
|
5906
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
5907
|
+
const reverseAdjacency = /* @__PURE__ */ new Map();
|
|
5908
|
+
for (const [nodeIndex, edges2] of graph.adjacency) {
|
|
5909
|
+
adjacency.set(nodeIndex, [...edges2]);
|
|
5910
|
+
}
|
|
5911
|
+
for (const [nodeIndex, edges2] of graph.reverseAdjacency) {
|
|
5912
|
+
reverseAdjacency.set(nodeIndex, [...edges2]);
|
|
5913
|
+
}
|
|
5914
|
+
const mutable = Object.create(ProtoGraph);
|
|
5915
|
+
mutable.type = graph.type;
|
|
5916
|
+
mutable.nodes = new Map(graph.nodes);
|
|
5917
|
+
mutable.edges = new Map(graph.edges);
|
|
5918
|
+
mutable.adjacency = adjacency;
|
|
5919
|
+
mutable.reverseAdjacency = reverseAdjacency;
|
|
5920
|
+
mutable.nextNodeIndex = graph.nextNodeIndex;
|
|
5921
|
+
mutable.nextEdgeIndex = graph.nextEdgeIndex;
|
|
5922
|
+
mutable.isAcyclic = graph.isAcyclic;
|
|
5923
|
+
mutable.mutable = true;
|
|
5924
|
+
return mutable;
|
|
5925
|
+
};
|
|
5926
|
+
var endMutation2 = (mutable) => {
|
|
5927
|
+
const graph = Object.create(ProtoGraph);
|
|
5928
|
+
graph.type = mutable.type;
|
|
5929
|
+
graph.nodes = new Map(mutable.nodes);
|
|
5930
|
+
graph.edges = new Map(mutable.edges);
|
|
5931
|
+
graph.adjacency = mutable.adjacency;
|
|
5932
|
+
graph.reverseAdjacency = mutable.reverseAdjacency;
|
|
5933
|
+
graph.nextNodeIndex = mutable.nextNodeIndex;
|
|
5934
|
+
graph.nextEdgeIndex = mutable.nextEdgeIndex;
|
|
5935
|
+
graph.isAcyclic = mutable.isAcyclic;
|
|
5936
|
+
graph.mutable = false;
|
|
5937
|
+
return graph;
|
|
5938
|
+
};
|
|
5939
|
+
var mutate2 = /* @__PURE__ */ dual(2, (graph, f) => {
|
|
5940
|
+
const mutable = beginMutation3(graph);
|
|
5941
|
+
f(mutable);
|
|
5942
|
+
return endMutation2(mutable);
|
|
5943
|
+
});
|
|
5944
|
+
var addNode = (mutable, data) => {
|
|
5945
|
+
const nodeIndex = mutable.nextNodeIndex;
|
|
5946
|
+
mutable.nodes.set(nodeIndex, data);
|
|
5947
|
+
mutable.adjacency.set(nodeIndex, []);
|
|
5948
|
+
mutable.reverseAdjacency.set(nodeIndex, []);
|
|
5949
|
+
mutable.nextNodeIndex = mutable.nextNodeIndex + 1;
|
|
5950
|
+
return nodeIndex;
|
|
5951
|
+
};
|
|
5952
|
+
var getNode = (graph, nodeIndex) => graph.nodes.has(nodeIndex) ? some2(graph.nodes.get(nodeIndex)) : none2();
|
|
5953
|
+
var hasNode = (graph, nodeIndex) => graph.nodes.has(nodeIndex);
|
|
5954
|
+
var nodeCount = (graph) => graph.nodes.size;
|
|
5955
|
+
var reverse3 = (mutable) => {
|
|
5956
|
+
for (const [index, edgeData] of mutable.edges) {
|
|
5957
|
+
mutable.edges.set(index, {
|
|
5958
|
+
source: edgeData.target,
|
|
5959
|
+
target: edgeData.source,
|
|
5960
|
+
data: edgeData.data
|
|
5961
|
+
});
|
|
5962
|
+
}
|
|
5963
|
+
mutable.adjacency.clear();
|
|
5964
|
+
mutable.reverseAdjacency.clear();
|
|
5965
|
+
for (const [edgeIndex, edgeData] of mutable.edges) {
|
|
5966
|
+
const sourceEdges = mutable.adjacency.get(edgeData.source) || [];
|
|
5967
|
+
sourceEdges.push(edgeIndex);
|
|
5968
|
+
mutable.adjacency.set(edgeData.source, sourceEdges);
|
|
5969
|
+
const targetEdges = mutable.reverseAdjacency.get(edgeData.target) || [];
|
|
5970
|
+
targetEdges.push(edgeIndex);
|
|
5971
|
+
mutable.reverseAdjacency.set(edgeData.target, targetEdges);
|
|
5972
|
+
}
|
|
5973
|
+
mutable.isAcyclic = none2();
|
|
5974
|
+
};
|
|
5975
|
+
var invalidateCycleFlagOnRemoval = (mutable) => {
|
|
5976
|
+
if (isSome2(mutable.isAcyclic) && mutable.isAcyclic.value === false) {
|
|
5977
|
+
mutable.isAcyclic = none2();
|
|
5978
|
+
}
|
|
5979
|
+
};
|
|
5980
|
+
var invalidateCycleFlagOnAddition = (mutable) => {
|
|
5981
|
+
if (isSome2(mutable.isAcyclic) && mutable.isAcyclic.value === true) {
|
|
5982
|
+
mutable.isAcyclic = none2();
|
|
5983
|
+
}
|
|
5984
|
+
};
|
|
5985
|
+
var addEdge = (mutable, source, target, data) => {
|
|
5986
|
+
if (!mutable.nodes.has(source)) {
|
|
5987
|
+
throw missingNode(source);
|
|
5988
|
+
}
|
|
5989
|
+
if (!mutable.nodes.has(target)) {
|
|
5990
|
+
throw missingNode(target);
|
|
5991
|
+
}
|
|
5992
|
+
const edgeIndex = mutable.nextEdgeIndex;
|
|
5993
|
+
const edgeData = new Edge({
|
|
5994
|
+
source,
|
|
5995
|
+
target,
|
|
5996
|
+
data
|
|
5997
|
+
});
|
|
5998
|
+
mutable.edges.set(edgeIndex, edgeData);
|
|
5999
|
+
const sourceAdjacency = mutable.adjacency.get(source);
|
|
6000
|
+
if (sourceAdjacency !== void 0) {
|
|
6001
|
+
sourceAdjacency.push(edgeIndex);
|
|
6002
|
+
}
|
|
6003
|
+
const targetReverseAdjacency = mutable.reverseAdjacency.get(target);
|
|
6004
|
+
if (targetReverseAdjacency !== void 0) {
|
|
6005
|
+
targetReverseAdjacency.push(edgeIndex);
|
|
6006
|
+
}
|
|
6007
|
+
if (mutable.type === "undirected") {
|
|
6008
|
+
const targetAdjacency = mutable.adjacency.get(target);
|
|
6009
|
+
if (targetAdjacency !== void 0) {
|
|
6010
|
+
targetAdjacency.push(edgeIndex);
|
|
6011
|
+
}
|
|
6012
|
+
const sourceReverseAdjacency = mutable.reverseAdjacency.get(source);
|
|
6013
|
+
if (sourceReverseAdjacency !== void 0) {
|
|
6014
|
+
sourceReverseAdjacency.push(edgeIndex);
|
|
6015
|
+
}
|
|
6016
|
+
}
|
|
6017
|
+
mutable.nextEdgeIndex = mutable.nextEdgeIndex + 1;
|
|
6018
|
+
invalidateCycleFlagOnAddition(mutable);
|
|
6019
|
+
return edgeIndex;
|
|
6020
|
+
};
|
|
6021
|
+
var removeNode = (mutable, nodeIndex) => {
|
|
6022
|
+
if (!mutable.nodes.has(nodeIndex)) {
|
|
6023
|
+
return;
|
|
6024
|
+
}
|
|
6025
|
+
const edgesToRemove = [];
|
|
6026
|
+
const outgoingEdges = mutable.adjacency.get(nodeIndex);
|
|
6027
|
+
if (outgoingEdges !== void 0) {
|
|
6028
|
+
for (const edge of outgoingEdges) {
|
|
6029
|
+
edgesToRemove.push(edge);
|
|
6030
|
+
}
|
|
6031
|
+
}
|
|
6032
|
+
const incomingEdges = mutable.reverseAdjacency.get(nodeIndex);
|
|
6033
|
+
if (incomingEdges !== void 0) {
|
|
6034
|
+
for (const edge of incomingEdges) {
|
|
6035
|
+
edgesToRemove.push(edge);
|
|
6036
|
+
}
|
|
6037
|
+
}
|
|
6038
|
+
for (const edgeIndex of edgesToRemove) {
|
|
6039
|
+
removeEdgeInternal(mutable, edgeIndex);
|
|
6040
|
+
}
|
|
6041
|
+
mutable.nodes.delete(nodeIndex);
|
|
6042
|
+
mutable.adjacency.delete(nodeIndex);
|
|
6043
|
+
mutable.reverseAdjacency.delete(nodeIndex);
|
|
6044
|
+
invalidateCycleFlagOnRemoval(mutable);
|
|
6045
|
+
};
|
|
6046
|
+
var removeEdgeInternal = (mutable, edgeIndex) => {
|
|
6047
|
+
const edge = mutable.edges.get(edgeIndex);
|
|
6048
|
+
if (edge === void 0) {
|
|
6049
|
+
return false;
|
|
6050
|
+
}
|
|
6051
|
+
const {
|
|
6052
|
+
source,
|
|
6053
|
+
target
|
|
6054
|
+
} = edge;
|
|
6055
|
+
const sourceAdjacency = mutable.adjacency.get(source);
|
|
6056
|
+
if (sourceAdjacency !== void 0) {
|
|
6057
|
+
const index = sourceAdjacency.indexOf(edgeIndex);
|
|
6058
|
+
if (index !== -1) {
|
|
6059
|
+
sourceAdjacency.splice(index, 1);
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6062
|
+
const targetReverseAdjacency = mutable.reverseAdjacency.get(target);
|
|
6063
|
+
if (targetReverseAdjacency !== void 0) {
|
|
6064
|
+
const index = targetReverseAdjacency.indexOf(edgeIndex);
|
|
6065
|
+
if (index !== -1) {
|
|
6066
|
+
targetReverseAdjacency.splice(index, 1);
|
|
6067
|
+
}
|
|
6068
|
+
}
|
|
6069
|
+
if (mutable.type === "undirected") {
|
|
6070
|
+
const targetAdjacency = mutable.adjacency.get(target);
|
|
6071
|
+
if (targetAdjacency !== void 0) {
|
|
6072
|
+
const index = targetAdjacency.indexOf(edgeIndex);
|
|
6073
|
+
if (index !== -1) {
|
|
6074
|
+
targetAdjacency.splice(index, 1);
|
|
6075
|
+
}
|
|
6076
|
+
}
|
|
6077
|
+
const sourceReverseAdjacency = mutable.reverseAdjacency.get(source);
|
|
6078
|
+
if (sourceReverseAdjacency !== void 0) {
|
|
6079
|
+
const index = sourceReverseAdjacency.indexOf(edgeIndex);
|
|
6080
|
+
if (index !== -1) {
|
|
6081
|
+
sourceReverseAdjacency.splice(index, 1);
|
|
6082
|
+
}
|
|
6083
|
+
}
|
|
6084
|
+
}
|
|
6085
|
+
mutable.edges.delete(edgeIndex);
|
|
6086
|
+
return true;
|
|
6087
|
+
};
|
|
6088
|
+
var neighborsDirected = (graph, nodeIndex, direction) => {
|
|
6089
|
+
const adjacencyMap = direction === "incoming" ? graph.reverseAdjacency : graph.adjacency;
|
|
6090
|
+
const adjacencyList = adjacencyMap.get(nodeIndex);
|
|
6091
|
+
if (adjacencyList === void 0) {
|
|
6092
|
+
return [];
|
|
6093
|
+
}
|
|
6094
|
+
const result = [];
|
|
6095
|
+
for (const edgeIndex of adjacencyList) {
|
|
6096
|
+
const edge = graph.edges.get(edgeIndex);
|
|
6097
|
+
if (edge !== void 0) {
|
|
6098
|
+
const neighborNode = direction === "incoming" ? edge.source : edge.target;
|
|
6099
|
+
result.push(neighborNode);
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
return result;
|
|
6103
|
+
};
|
|
6104
|
+
var escapeMermaidLabel = (label) => {
|
|
6105
|
+
return label.replace(/#/g, "#35;").replace(/"/g, "#quot;").replace(/</g, "#lt;").replace(/>/g, "#gt;").replace(/&/g, "#amp;").replace(/\[/g, "#91;").replace(/\]/g, "#93;").replace(/\{/g, "#123;").replace(/\}/g, "#125;").replace(/\(/g, "#40;").replace(/\)/g, "#41;").replace(/\|/g, "#124;").replace(/\\/g, "#92;").replace(/\n/g, "<br/>");
|
|
6106
|
+
};
|
|
6107
|
+
var formatMermaidNode = (nodeId, label, shape) => {
|
|
6108
|
+
switch (shape) {
|
|
6109
|
+
case "rectangle":
|
|
6110
|
+
return `${nodeId}["${label}"]`;
|
|
6111
|
+
case "rounded":
|
|
6112
|
+
return `${nodeId}("${label}")`;
|
|
6113
|
+
case "circle":
|
|
6114
|
+
return `${nodeId}(("${label}"))`;
|
|
6115
|
+
case "diamond":
|
|
6116
|
+
return `${nodeId}{"${label}"}`;
|
|
6117
|
+
case "hexagon":
|
|
6118
|
+
return `${nodeId}{{"${label}"}}`;
|
|
6119
|
+
case "stadium":
|
|
6120
|
+
return `${nodeId}(["${label}"])`;
|
|
6121
|
+
case "subroutine":
|
|
6122
|
+
return `${nodeId}[["${label}"]]`;
|
|
6123
|
+
case "cylindrical":
|
|
6124
|
+
return `${nodeId}[("${label}")]`;
|
|
6125
|
+
}
|
|
6126
|
+
};
|
|
6127
|
+
var toMermaid = (graph, options) => {
|
|
6128
|
+
const {
|
|
6129
|
+
diagramType,
|
|
6130
|
+
direction = "TD",
|
|
6131
|
+
edgeLabel = (data) => String(data),
|
|
6132
|
+
nodeLabel = (data) => String(data),
|
|
6133
|
+
nodeShape = () => "rectangle"
|
|
6134
|
+
} = options ?? {};
|
|
6135
|
+
const finalDiagramType = diagramType ?? (graph.type === "directed" ? "flowchart" : "graph");
|
|
6136
|
+
const lines = [];
|
|
6137
|
+
lines.push(`${finalDiagramType} ${direction}`);
|
|
6138
|
+
for (const [nodeIndex, nodeData] of graph.nodes) {
|
|
6139
|
+
const nodeId = String(nodeIndex);
|
|
6140
|
+
const label = escapeMermaidLabel(nodeLabel(nodeData));
|
|
6141
|
+
const shape = nodeShape(nodeData);
|
|
6142
|
+
const formattedNode = formatMermaidNode(nodeId, label, shape);
|
|
6143
|
+
lines.push(` ${formattedNode}`);
|
|
6144
|
+
}
|
|
6145
|
+
const edgeOperator = finalDiagramType === "flowchart" ? "-->" : "---";
|
|
6146
|
+
for (const [, edgeData] of graph.edges) {
|
|
6147
|
+
const sourceId = String(edgeData.source);
|
|
6148
|
+
const targetId = String(edgeData.target);
|
|
6149
|
+
const label = escapeMermaidLabel(edgeLabel(edgeData.data));
|
|
6150
|
+
if (label) {
|
|
6151
|
+
lines.push(` ${sourceId} ${edgeOperator}|"${label}"| ${targetId}`);
|
|
6152
|
+
} else {
|
|
6153
|
+
lines.push(` ${sourceId} ${edgeOperator} ${targetId}`);
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
return lines.join("\n");
|
|
6157
|
+
};
|
|
6158
|
+
var Walker = class {
|
|
6159
|
+
// @ts-ignore
|
|
6160
|
+
[Symbol.iterator];
|
|
6161
|
+
/**
|
|
6162
|
+
* Visits each element and maps it to a value using the provided function.
|
|
6163
|
+
*
|
|
6164
|
+
* Takes a function that receives the index and data,
|
|
6165
|
+
* and returns an iterable of the mapped values. Skips elements that
|
|
6166
|
+
* no longer exist in the graph.
|
|
6167
|
+
*
|
|
6168
|
+
* @example
|
|
6169
|
+
* ```ts
|
|
6170
|
+
* import { Graph } from "effect"
|
|
6171
|
+
*
|
|
6172
|
+
* const graph = Graph.directed<string, number>((mutable) => {
|
|
6173
|
+
* const a = Graph.addNode(mutable, "A")
|
|
6174
|
+
* const b = Graph.addNode(mutable, "B")
|
|
6175
|
+
* Graph.addEdge(mutable, a, b, 1)
|
|
6176
|
+
* })
|
|
6177
|
+
*
|
|
6178
|
+
* const dfs = Graph.dfs(graph, { start: [0] })
|
|
6179
|
+
*
|
|
6180
|
+
* // Map to just the node data
|
|
6181
|
+
* const values = Array.from(dfs.visit((index, data) => data))
|
|
6182
|
+
* console.log(values) // ["A", "B"]
|
|
6183
|
+
*
|
|
6184
|
+
* // Map to custom objects
|
|
6185
|
+
* const custom = Array.from(dfs.visit((index, data) => ({ id: index, name: data })))
|
|
6186
|
+
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
|
6187
|
+
* ```
|
|
6188
|
+
*
|
|
6189
|
+
* @since 3.18.0
|
|
6190
|
+
* @category iterators
|
|
6191
|
+
*/
|
|
6192
|
+
visit;
|
|
6193
|
+
constructor(visit) {
|
|
6194
|
+
this.visit = visit;
|
|
6195
|
+
this[Symbol.iterator] = visit((index, data) => [index, data])[Symbol.iterator];
|
|
6196
|
+
}
|
|
6197
|
+
};
|
|
6198
|
+
var indices = (walker) => walker.visit((index, _) => index);
|
|
6199
|
+
var values2 = (walker) => walker.visit((_, data) => data);
|
|
6200
|
+
var entries = (walker) => walker.visit((index, data) => [index, data]);
|
|
6201
|
+
var dfsPostOrder = (graph, config = {}) => {
|
|
6202
|
+
const start = config.start ?? [];
|
|
6203
|
+
const direction = config.direction ?? "outgoing";
|
|
6204
|
+
for (const nodeIndex of start) {
|
|
6205
|
+
if (!hasNode(graph, nodeIndex)) {
|
|
6206
|
+
throw missingNode(nodeIndex);
|
|
6207
|
+
}
|
|
6208
|
+
}
|
|
6209
|
+
return new Walker((f) => ({
|
|
6210
|
+
[Symbol.iterator]: () => {
|
|
6211
|
+
const stack = [];
|
|
6212
|
+
const discovered = /* @__PURE__ */ new Set();
|
|
6213
|
+
const finished = /* @__PURE__ */ new Set();
|
|
6214
|
+
for (let i = start.length - 1; i >= 0; i--) {
|
|
6215
|
+
stack.push({
|
|
6216
|
+
node: start[i],
|
|
6217
|
+
visitedChildren: false
|
|
6218
|
+
});
|
|
6219
|
+
}
|
|
6220
|
+
const nextMapped = () => {
|
|
6221
|
+
while (stack.length > 0) {
|
|
6222
|
+
const current = stack[stack.length - 1];
|
|
6223
|
+
if (!discovered.has(current.node)) {
|
|
6224
|
+
discovered.add(current.node);
|
|
6225
|
+
current.visitedChildren = false;
|
|
6226
|
+
}
|
|
6227
|
+
if (!current.visitedChildren) {
|
|
6228
|
+
current.visitedChildren = true;
|
|
6229
|
+
const neighbors = neighborsDirected(graph, current.node, direction);
|
|
6230
|
+
for (let i = neighbors.length - 1; i >= 0; i--) {
|
|
6231
|
+
const neighbor = neighbors[i];
|
|
6232
|
+
if (!discovered.has(neighbor) && !finished.has(neighbor)) {
|
|
6233
|
+
stack.push({
|
|
6234
|
+
node: neighbor,
|
|
6235
|
+
visitedChildren: false
|
|
6236
|
+
});
|
|
6237
|
+
}
|
|
6238
|
+
}
|
|
6239
|
+
} else {
|
|
6240
|
+
const nodeToEmit = stack.pop().node;
|
|
6241
|
+
if (!finished.has(nodeToEmit)) {
|
|
6242
|
+
finished.add(nodeToEmit);
|
|
6243
|
+
const nodeData = getNode(graph, nodeToEmit);
|
|
6244
|
+
if (isSome2(nodeData)) {
|
|
6245
|
+
return {
|
|
6246
|
+
done: false,
|
|
6247
|
+
value: f(nodeToEmit, nodeData.value)
|
|
6248
|
+
};
|
|
6249
|
+
}
|
|
6250
|
+
return nextMapped();
|
|
6251
|
+
}
|
|
6252
|
+
}
|
|
6253
|
+
}
|
|
6254
|
+
return {
|
|
6255
|
+
done: true,
|
|
6256
|
+
value: void 0
|
|
6257
|
+
};
|
|
6258
|
+
};
|
|
6259
|
+
return {
|
|
6260
|
+
next: nextMapped
|
|
6261
|
+
};
|
|
6262
|
+
}
|
|
6263
|
+
}));
|
|
6264
|
+
};
|
|
6265
|
+
var nodes = (graph) => new Walker((f) => ({
|
|
6266
|
+
[Symbol.iterator]() {
|
|
6267
|
+
const nodeMap = graph.nodes;
|
|
6268
|
+
const iterator = nodeMap.entries();
|
|
6269
|
+
return {
|
|
6270
|
+
next() {
|
|
6271
|
+
const result = iterator.next();
|
|
6272
|
+
if (result.done) {
|
|
6273
|
+
return {
|
|
6274
|
+
done: true,
|
|
6275
|
+
value: void 0
|
|
6276
|
+
};
|
|
6277
|
+
}
|
|
6278
|
+
const [nodeIndex, nodeData] = result.value;
|
|
6279
|
+
return {
|
|
6280
|
+
done: false,
|
|
6281
|
+
value: f(nodeIndex, nodeData)
|
|
6282
|
+
};
|
|
6283
|
+
}
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
6286
|
+
}));
|
|
6287
|
+
var edges = (graph) => new Walker((f) => ({
|
|
6288
|
+
[Symbol.iterator]() {
|
|
6289
|
+
const edgeMap = graph.edges;
|
|
6290
|
+
const iterator = edgeMap.entries();
|
|
6291
|
+
return {
|
|
6292
|
+
next() {
|
|
6293
|
+
const result = iterator.next();
|
|
6294
|
+
if (result.done) {
|
|
6295
|
+
return {
|
|
6296
|
+
done: true,
|
|
6297
|
+
value: void 0
|
|
6298
|
+
};
|
|
6299
|
+
}
|
|
6300
|
+
const [edgeIndex, edgeData] = result.value;
|
|
6301
|
+
return {
|
|
6302
|
+
done: false,
|
|
6303
|
+
value: f(edgeIndex, edgeData)
|
|
6304
|
+
};
|
|
6305
|
+
}
|
|
6306
|
+
};
|
|
4075
6307
|
}
|
|
4076
|
-
|
|
6308
|
+
}));
|
|
6309
|
+
var externals = (graph, config = {}) => {
|
|
6310
|
+
const direction = config.direction ?? "outgoing";
|
|
6311
|
+
return new Walker((f) => ({
|
|
6312
|
+
[Symbol.iterator]: () => {
|
|
6313
|
+
const nodeMap = graph.nodes;
|
|
6314
|
+
const adjacencyMap = direction === "incoming" ? graph.reverseAdjacency : graph.adjacency;
|
|
6315
|
+
const nodeIterator = nodeMap.entries();
|
|
6316
|
+
const nextMapped = () => {
|
|
6317
|
+
let current = nodeIterator.next();
|
|
6318
|
+
while (!current.done) {
|
|
6319
|
+
const [nodeIndex, nodeData] = current.value;
|
|
6320
|
+
const adjacencyList = adjacencyMap.get(nodeIndex);
|
|
6321
|
+
if (adjacencyList === void 0 || adjacencyList.length === 0) {
|
|
6322
|
+
return {
|
|
6323
|
+
done: false,
|
|
6324
|
+
value: f(nodeIndex, nodeData)
|
|
6325
|
+
};
|
|
6326
|
+
}
|
|
6327
|
+
current = nodeIterator.next();
|
|
6328
|
+
}
|
|
6329
|
+
return {
|
|
6330
|
+
done: true,
|
|
6331
|
+
value: void 0
|
|
6332
|
+
};
|
|
6333
|
+
};
|
|
6334
|
+
return {
|
|
6335
|
+
next: nextMapped
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
}));
|
|
4077
6339
|
};
|
|
4078
|
-
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
4079
|
-
|
|
4080
|
-
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/internal/encoding/base64Url.js
|
|
4081
|
-
var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
4082
|
-
|
|
4083
|
-
// node_modules/.pnpm/effect@3.18.4/node_modules/effect/dist/esm/Encoding.js
|
|
4084
|
-
var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
|
|
4085
6340
|
|
|
4086
6341
|
// src/diagnostics/classSelfMismatch.ts
|
|
4087
6342
|
var classSelfMismatch = createDiagnostic({
|
|
@@ -4373,8 +6628,8 @@ var effectInVoidSuccess = createDiagnostic({
|
|
|
4373
6628
|
}
|
|
4374
6629
|
return yield* fail(typeParserIssue("expectedEffect success is not void"));
|
|
4375
6630
|
});
|
|
4376
|
-
const
|
|
4377
|
-
for (const [node, expectedType, valueNode, realType] of
|
|
6631
|
+
const entries2 = typeCheckerUtils.expectedAndRealType(sourceFile);
|
|
6632
|
+
for (const [node, expectedType, valueNode, realType] of entries2) {
|
|
4378
6633
|
if (expectedType !== realType) {
|
|
4379
6634
|
yield* pipe(
|
|
4380
6635
|
checkForEffectInVoid(
|
|
@@ -4794,8 +7049,8 @@ var missingEffectContext = createDiagnostic({
|
|
|
4794
7049
|
)
|
|
4795
7050
|
);
|
|
4796
7051
|
const sortTypes = sort(typeCheckerUtils.deterministicTypeOrder);
|
|
4797
|
-
const
|
|
4798
|
-
for (const [node, expectedType, valueNode, realType] of
|
|
7052
|
+
const entries2 = getEffectLspPatchSourceFileMetadata(sourceFile)?.relationErrors || typeCheckerUtils.expectedAndRealType(sourceFile);
|
|
7053
|
+
for (const [node, expectedType, valueNode, realType] of entries2) {
|
|
4799
7054
|
if (expectedType !== realType) {
|
|
4800
7055
|
yield* pipe(
|
|
4801
7056
|
checkForMissingContextTypes(
|
|
@@ -4860,8 +7115,8 @@ var missingEffectError = createDiagnostic({
|
|
|
4860
7115
|
)
|
|
4861
7116
|
);
|
|
4862
7117
|
const sortTypes = sort(typeCheckerUtils.deterministicTypeOrder);
|
|
4863
|
-
const
|
|
4864
|
-
for (const [node, expectedType, valueNode, realType] of
|
|
7118
|
+
const entries2 = getEffectLspPatchSourceFileMetadata(sourceFile)?.relationErrors || typeCheckerUtils.expectedAndRealType(sourceFile);
|
|
7119
|
+
for (const [node, expectedType, valueNode, realType] of entries2) {
|
|
4865
7120
|
if (expectedType !== realType) {
|
|
4866
7121
|
yield* pipe(
|
|
4867
7122
|
checkForMissingErrorTypes(
|
|
@@ -5625,9 +7880,9 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
5625
7880
|
return { methodIdentifier };
|
|
5626
7881
|
}
|
|
5627
7882
|
const reportIfLayerRequireScope = (type, node, methodIdentifier) => {
|
|
5628
|
-
const
|
|
7883
|
+
const entries2 = typeCheckerUtils.unrollUnionMembers(type);
|
|
5629
7884
|
return pipe(
|
|
5630
|
-
firstSuccessOf(
|
|
7885
|
+
firstSuccessOf(entries2.map((type2) => typeParser.scopeType(type2, node))),
|
|
5631
7886
|
map5(
|
|
5632
7887
|
() => report({
|
|
5633
7888
|
location: node,
|
|
@@ -5708,29 +7963,29 @@ var strictBooleanExpressions = createDiagnostic({
|
|
|
5708
7963
|
while (nodeToVisit.length > 0) {
|
|
5709
7964
|
const node = nodeToVisit.shift();
|
|
5710
7965
|
ts.forEachChild(node, appendNodeToVisit);
|
|
5711
|
-
const
|
|
7966
|
+
const nodes2 = [];
|
|
5712
7967
|
if (ts.isIfStatement(node)) {
|
|
5713
7968
|
conditionChecks.set(node, true);
|
|
5714
|
-
|
|
7969
|
+
nodes2.push(node.expression);
|
|
5715
7970
|
} else if (ts.isWhileStatement(node)) {
|
|
5716
7971
|
conditionChecks.set(node, true);
|
|
5717
|
-
|
|
7972
|
+
nodes2.push(node.expression);
|
|
5718
7973
|
} else if (ts.isConditionalExpression(node)) {
|
|
5719
7974
|
conditionChecks.set(node, true);
|
|
5720
|
-
|
|
7975
|
+
nodes2.push(node.condition);
|
|
5721
7976
|
} else if (ts.isPrefixUnaryExpression(node) && node.operator === ts.SyntaxKind.ExclamationToken) {
|
|
5722
7977
|
conditionChecks.set(node, true);
|
|
5723
|
-
|
|
7978
|
+
nodes2.push(node.operand);
|
|
5724
7979
|
} else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
|
|
5725
7980
|
if (conditionChecks.has(node.parent)) conditionChecks.set(node, true);
|
|
5726
|
-
|
|
5727
|
-
|
|
7981
|
+
nodes2.push(node.left);
|
|
7982
|
+
nodes2.push(node.right);
|
|
5728
7983
|
} else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
5729
7984
|
if (conditionChecks.has(node.parent)) conditionChecks.set(node, true);
|
|
5730
|
-
|
|
5731
|
-
|
|
7985
|
+
nodes2.push(node.left);
|
|
7986
|
+
nodes2.push(node.right);
|
|
5732
7987
|
}
|
|
5733
|
-
for (const nodeToCheck of
|
|
7988
|
+
for (const nodeToCheck of nodes2) {
|
|
5734
7989
|
if (!nodeToCheck) continue;
|
|
5735
7990
|
if (!conditionChecks.has(nodeToCheck.parent)) continue;
|
|
5736
7991
|
const nodeType = typeChecker.getTypeAtLocation(nodeToCheck);
|
|
@@ -6055,9 +8310,9 @@ var effectDiagnosticsComment = createCompletion({
|
|
|
6055
8310
|
apply: fn("effectDiagnosticsComment")(function* (sourceFile, position) {
|
|
6056
8311
|
const ts = yield* service(TypeScriptApi);
|
|
6057
8312
|
const sourceText = sourceFile.text;
|
|
6058
|
-
const
|
|
6059
|
-
if (
|
|
6060
|
-
const lastIndex =
|
|
8313
|
+
const match3 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
8314
|
+
if (match3 && match3.indices) {
|
|
8315
|
+
const lastIndex = match3.indices[2][0];
|
|
6061
8316
|
const replacementSpan = {
|
|
6062
8317
|
start: lastIndex,
|
|
6063
8318
|
length: Math.max(0, position - lastIndex)
|
|
@@ -6088,9 +8343,9 @@ var effectJsdocComment = createCompletion({
|
|
|
6088
8343
|
apply: fn("effectJsdocComment")(function* (sourceFile, position) {
|
|
6089
8344
|
const ts = yield* service(TypeScriptApi);
|
|
6090
8345
|
const sourceText = sourceFile.text;
|
|
6091
|
-
const
|
|
6092
|
-
if (
|
|
6093
|
-
const lastIndex =
|
|
8346
|
+
const match3 = /(\/\/|\/\*(?:\*?))\s*(@)\s*$/id.exec(sourceText.substring(0, position));
|
|
8347
|
+
if (match3 && match3.indices) {
|
|
8348
|
+
const lastIndex = match3.indices[2][0];
|
|
6094
8349
|
const replacementSpan = {
|
|
6095
8350
|
start: lastIndex,
|
|
6096
8351
|
length: Math.max(0, position - lastIndex)
|
|
@@ -8085,10 +10340,10 @@ var putShortMSB = (s, b) => {
|
|
|
8085
10340
|
s.pending_buf[s.pending++] = b >>> 8 & 255;
|
|
8086
10341
|
s.pending_buf[s.pending++] = b & 255;
|
|
8087
10342
|
};
|
|
8088
|
-
var read_buf = (strm, buf, start,
|
|
10343
|
+
var read_buf = (strm, buf, start, size4) => {
|
|
8089
10344
|
let len = strm.avail_in;
|
|
8090
|
-
if (len >
|
|
8091
|
-
len =
|
|
10345
|
+
if (len > size4) {
|
|
10346
|
+
len = size4;
|
|
8092
10347
|
}
|
|
8093
10348
|
if (len === 0) {
|
|
8094
10349
|
return 0;
|
|
@@ -8107,7 +10362,7 @@ var read_buf = (strm, buf, start, size) => {
|
|
|
8107
10362
|
var longest_match = (s, cur_match) => {
|
|
8108
10363
|
let chain_length = s.max_chain_length;
|
|
8109
10364
|
let scan = s.strstart;
|
|
8110
|
-
let
|
|
10365
|
+
let match3;
|
|
8111
10366
|
let len;
|
|
8112
10367
|
let best_len = s.prev_length;
|
|
8113
10368
|
let nice_match = s.nice_match;
|
|
@@ -8125,14 +10380,14 @@ var longest_match = (s, cur_match) => {
|
|
|
8125
10380
|
nice_match = s.lookahead;
|
|
8126
10381
|
}
|
|
8127
10382
|
do {
|
|
8128
|
-
|
|
8129
|
-
if (_win[
|
|
10383
|
+
match3 = cur_match;
|
|
10384
|
+
if (_win[match3 + best_len] !== scan_end || _win[match3 + best_len - 1] !== scan_end1 || _win[match3] !== _win[scan] || _win[++match3] !== _win[scan + 1]) {
|
|
8130
10385
|
continue;
|
|
8131
10386
|
}
|
|
8132
10387
|
scan += 2;
|
|
8133
|
-
|
|
10388
|
+
match3++;
|
|
8134
10389
|
do {
|
|
8135
|
-
} while (_win[++scan] === _win[++
|
|
10390
|
+
} while (_win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && _win[++scan] === _win[++match3] && scan < strend);
|
|
8136
10391
|
len = MAX_MATCH - (strend - scan);
|
|
8137
10392
|
scan = strend - MAX_MATCH;
|
|
8138
10393
|
if (len > best_len) {
|
|
@@ -8710,11 +10965,11 @@ var deflateReset = (strm) => {
|
|
|
8710
10965
|
}
|
|
8711
10966
|
return ret;
|
|
8712
10967
|
};
|
|
8713
|
-
var deflateSetHeader = (strm,
|
|
10968
|
+
var deflateSetHeader = (strm, head3) => {
|
|
8714
10969
|
if (deflateStateCheck(strm) || strm.state.wrap !== 2) {
|
|
8715
10970
|
return Z_STREAM_ERROR$2;
|
|
8716
10971
|
}
|
|
8717
|
-
strm.state.gzhead =
|
|
10972
|
+
strm.state.gzhead = head3;
|
|
8718
10973
|
return Z_OK$3;
|
|
8719
10974
|
};
|
|
8720
10975
|
var deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {
|
|
@@ -8868,20 +11123,20 @@ var deflate$2 = (strm, flush) => {
|
|
|
8868
11123
|
let beg = s.pending;
|
|
8869
11124
|
let left3 = (s.gzhead.extra.length & 65535) - s.gzindex;
|
|
8870
11125
|
while (s.pending + left3 > s.pending_buf_size) {
|
|
8871
|
-
let
|
|
8872
|
-
s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex +
|
|
11126
|
+
let copy2 = s.pending_buf_size - s.pending;
|
|
11127
|
+
s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy2), s.pending);
|
|
8873
11128
|
s.pending = s.pending_buf_size;
|
|
8874
11129
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
8875
11130
|
strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
8876
11131
|
}
|
|
8877
|
-
s.gzindex +=
|
|
11132
|
+
s.gzindex += copy2;
|
|
8878
11133
|
flush_pending(strm);
|
|
8879
11134
|
if (s.pending !== 0) {
|
|
8880
11135
|
s.last_flush = -1;
|
|
8881
11136
|
return Z_OK$3;
|
|
8882
11137
|
}
|
|
8883
11138
|
beg = 0;
|
|
8884
|
-
left3 -=
|
|
11139
|
+
left3 -= copy2;
|
|
8885
11140
|
}
|
|
8886
11141
|
let gzhead_extra = new Uint8Array(s.gzhead.extra);
|
|
8887
11142
|
s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left3), s.pending);
|
|
@@ -9833,7 +12088,7 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
9833
12088
|
let mask;
|
|
9834
12089
|
let next;
|
|
9835
12090
|
let base = null;
|
|
9836
|
-
let
|
|
12091
|
+
let match3;
|
|
9837
12092
|
const count = new Uint16Array(MAXBITS + 1);
|
|
9838
12093
|
const offs = new Uint16Array(MAXBITS + 1);
|
|
9839
12094
|
let extra = null;
|
|
@@ -9889,15 +12144,15 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
9889
12144
|
}
|
|
9890
12145
|
if (type === CODES$1) {
|
|
9891
12146
|
base = extra = work;
|
|
9892
|
-
|
|
12147
|
+
match3 = 20;
|
|
9893
12148
|
} else if (type === LENS$1) {
|
|
9894
12149
|
base = lbase;
|
|
9895
12150
|
extra = lext;
|
|
9896
|
-
|
|
12151
|
+
match3 = 257;
|
|
9897
12152
|
} else {
|
|
9898
12153
|
base = dbase;
|
|
9899
12154
|
extra = dext;
|
|
9900
|
-
|
|
12155
|
+
match3 = 0;
|
|
9901
12156
|
}
|
|
9902
12157
|
huff = 0;
|
|
9903
12158
|
sym = 0;
|
|
@@ -9913,12 +12168,12 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
9913
12168
|
}
|
|
9914
12169
|
for (; ; ) {
|
|
9915
12170
|
here_bits = len - drop;
|
|
9916
|
-
if (work[sym] + 1 <
|
|
12171
|
+
if (work[sym] + 1 < match3) {
|
|
9917
12172
|
here_op = 0;
|
|
9918
12173
|
here_val = work[sym];
|
|
9919
|
-
} else if (work[sym] >=
|
|
9920
|
-
here_op = extra[work[sym] -
|
|
9921
|
-
here_val = base[work[sym] -
|
|
12174
|
+
} else if (work[sym] >= match3) {
|
|
12175
|
+
here_op = extra[work[sym] - match3];
|
|
12176
|
+
here_val = base[work[sym] - match3];
|
|
9922
12177
|
} else {
|
|
9923
12178
|
here_op = 32 + 64;
|
|
9924
12179
|
here_val = 0;
|
|
@@ -10190,7 +12445,7 @@ var fixedtables = (state) => {
|
|
|
10190
12445
|
state.distcode = distfix;
|
|
10191
12446
|
state.distbits = 5;
|
|
10192
12447
|
};
|
|
10193
|
-
var updatewindow = (strm, src, end,
|
|
12448
|
+
var updatewindow = (strm, src, end, copy2) => {
|
|
10194
12449
|
let dist;
|
|
10195
12450
|
const state = strm.state;
|
|
10196
12451
|
if (state.window === null) {
|
|
@@ -10199,20 +12454,20 @@ var updatewindow = (strm, src, end, copy) => {
|
|
|
10199
12454
|
state.whave = 0;
|
|
10200
12455
|
state.window = new Uint8Array(state.wsize);
|
|
10201
12456
|
}
|
|
10202
|
-
if (
|
|
12457
|
+
if (copy2 >= state.wsize) {
|
|
10203
12458
|
state.window.set(src.subarray(end - state.wsize, end), 0);
|
|
10204
12459
|
state.wnext = 0;
|
|
10205
12460
|
state.whave = state.wsize;
|
|
10206
12461
|
} else {
|
|
10207
12462
|
dist = state.wsize - state.wnext;
|
|
10208
|
-
if (dist >
|
|
10209
|
-
dist =
|
|
10210
|
-
}
|
|
10211
|
-
state.window.set(src.subarray(end -
|
|
10212
|
-
|
|
10213
|
-
if (
|
|
10214
|
-
state.window.set(src.subarray(end -
|
|
10215
|
-
state.wnext =
|
|
12463
|
+
if (dist > copy2) {
|
|
12464
|
+
dist = copy2;
|
|
12465
|
+
}
|
|
12466
|
+
state.window.set(src.subarray(end - copy2, end - copy2 + dist), state.wnext);
|
|
12467
|
+
copy2 -= dist;
|
|
12468
|
+
if (copy2) {
|
|
12469
|
+
state.window.set(src.subarray(end - copy2, end), 0);
|
|
12470
|
+
state.wnext = copy2;
|
|
10216
12471
|
state.whave = state.wsize;
|
|
10217
12472
|
} else {
|
|
10218
12473
|
state.wnext += dist;
|
|
@@ -10235,7 +12490,7 @@ var inflate$2 = (strm, flush) => {
|
|
|
10235
12490
|
let hold;
|
|
10236
12491
|
let bits;
|
|
10237
12492
|
let _in, _out;
|
|
10238
|
-
let
|
|
12493
|
+
let copy2;
|
|
10239
12494
|
let from;
|
|
10240
12495
|
let from_source;
|
|
10241
12496
|
let here = 0;
|
|
@@ -10434,11 +12689,11 @@ var inflate$2 = (strm, flush) => {
|
|
|
10434
12689
|
/* falls through */
|
|
10435
12690
|
case EXTRA:
|
|
10436
12691
|
if (state.flags & 1024) {
|
|
10437
|
-
|
|
10438
|
-
if (
|
|
10439
|
-
|
|
12692
|
+
copy2 = state.length;
|
|
12693
|
+
if (copy2 > have) {
|
|
12694
|
+
copy2 = have;
|
|
10440
12695
|
}
|
|
10441
|
-
if (
|
|
12696
|
+
if (copy2) {
|
|
10442
12697
|
if (state.head) {
|
|
10443
12698
|
len = state.head.extra_len - state.length;
|
|
10444
12699
|
if (!state.head.extra) {
|
|
@@ -10449,18 +12704,18 @@ var inflate$2 = (strm, flush) => {
|
|
|
10449
12704
|
next,
|
|
10450
12705
|
// extra field is limited to 65536 bytes
|
|
10451
12706
|
// - no need for additional size check
|
|
10452
|
-
next +
|
|
12707
|
+
next + copy2
|
|
10453
12708
|
),
|
|
10454
12709
|
/*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
|
|
10455
12710
|
len
|
|
10456
12711
|
);
|
|
10457
12712
|
}
|
|
10458
12713
|
if (state.flags & 512 && state.wrap & 4) {
|
|
10459
|
-
state.check = crc32_1(state.check, input,
|
|
12714
|
+
state.check = crc32_1(state.check, input, copy2, next);
|
|
10460
12715
|
}
|
|
10461
|
-
have -=
|
|
10462
|
-
next +=
|
|
10463
|
-
state.length -=
|
|
12716
|
+
have -= copy2;
|
|
12717
|
+
next += copy2;
|
|
12718
|
+
state.length -= copy2;
|
|
10464
12719
|
}
|
|
10465
12720
|
if (state.length) {
|
|
10466
12721
|
break inf_leave;
|
|
@@ -10474,18 +12729,18 @@ var inflate$2 = (strm, flush) => {
|
|
|
10474
12729
|
if (have === 0) {
|
|
10475
12730
|
break inf_leave;
|
|
10476
12731
|
}
|
|
10477
|
-
|
|
12732
|
+
copy2 = 0;
|
|
10478
12733
|
do {
|
|
10479
|
-
len = input[next +
|
|
12734
|
+
len = input[next + copy2++];
|
|
10480
12735
|
if (state.head && len && state.length < 65536) {
|
|
10481
12736
|
state.head.name += String.fromCharCode(len);
|
|
10482
12737
|
}
|
|
10483
|
-
} while (len &&
|
|
12738
|
+
} while (len && copy2 < have);
|
|
10484
12739
|
if (state.flags & 512 && state.wrap & 4) {
|
|
10485
|
-
state.check = crc32_1(state.check, input,
|
|
12740
|
+
state.check = crc32_1(state.check, input, copy2, next);
|
|
10486
12741
|
}
|
|
10487
|
-
have -=
|
|
10488
|
-
next +=
|
|
12742
|
+
have -= copy2;
|
|
12743
|
+
next += copy2;
|
|
10489
12744
|
if (len) {
|
|
10490
12745
|
break inf_leave;
|
|
10491
12746
|
}
|
|
@@ -10500,18 +12755,18 @@ var inflate$2 = (strm, flush) => {
|
|
|
10500
12755
|
if (have === 0) {
|
|
10501
12756
|
break inf_leave;
|
|
10502
12757
|
}
|
|
10503
|
-
|
|
12758
|
+
copy2 = 0;
|
|
10504
12759
|
do {
|
|
10505
|
-
len = input[next +
|
|
12760
|
+
len = input[next + copy2++];
|
|
10506
12761
|
if (state.head && len && state.length < 65536) {
|
|
10507
12762
|
state.head.comment += String.fromCharCode(len);
|
|
10508
12763
|
}
|
|
10509
|
-
} while (len &&
|
|
12764
|
+
} while (len && copy2 < have);
|
|
10510
12765
|
if (state.flags & 512 && state.wrap & 4) {
|
|
10511
|
-
state.check = crc32_1(state.check, input,
|
|
12766
|
+
state.check = crc32_1(state.check, input, copy2, next);
|
|
10512
12767
|
}
|
|
10513
|
-
have -=
|
|
10514
|
-
next +=
|
|
12768
|
+
have -= copy2;
|
|
12769
|
+
next += copy2;
|
|
10515
12770
|
if (len) {
|
|
10516
12771
|
break inf_leave;
|
|
10517
12772
|
}
|
|
@@ -10646,23 +12901,23 @@ var inflate$2 = (strm, flush) => {
|
|
|
10646
12901
|
state.mode = COPY;
|
|
10647
12902
|
/* falls through */
|
|
10648
12903
|
case COPY:
|
|
10649
|
-
|
|
10650
|
-
if (
|
|
10651
|
-
if (
|
|
10652
|
-
|
|
12904
|
+
copy2 = state.length;
|
|
12905
|
+
if (copy2) {
|
|
12906
|
+
if (copy2 > have) {
|
|
12907
|
+
copy2 = have;
|
|
10653
12908
|
}
|
|
10654
|
-
if (
|
|
10655
|
-
|
|
12909
|
+
if (copy2 > left3) {
|
|
12910
|
+
copy2 = left3;
|
|
10656
12911
|
}
|
|
10657
|
-
if (
|
|
12912
|
+
if (copy2 === 0) {
|
|
10658
12913
|
break inf_leave;
|
|
10659
12914
|
}
|
|
10660
|
-
output.set(input.subarray(next, next +
|
|
10661
|
-
have -=
|
|
10662
|
-
next +=
|
|
10663
|
-
left3 -=
|
|
10664
|
-
put +=
|
|
10665
|
-
state.length -=
|
|
12915
|
+
output.set(input.subarray(next, next + copy2), put);
|
|
12916
|
+
have -= copy2;
|
|
12917
|
+
next += copy2;
|
|
12918
|
+
left3 -= copy2;
|
|
12919
|
+
put += copy2;
|
|
12920
|
+
state.length -= copy2;
|
|
10666
12921
|
break;
|
|
10667
12922
|
}
|
|
10668
12923
|
state.mode = TYPE;
|
|
@@ -10763,7 +13018,7 @@ var inflate$2 = (strm, flush) => {
|
|
|
10763
13018
|
break;
|
|
10764
13019
|
}
|
|
10765
13020
|
len = state.lens[state.have - 1];
|
|
10766
|
-
|
|
13021
|
+
copy2 = 3 + (hold & 3);
|
|
10767
13022
|
hold >>>= 2;
|
|
10768
13023
|
bits -= 2;
|
|
10769
13024
|
} else if (here_val === 17) {
|
|
@@ -10779,7 +13034,7 @@ var inflate$2 = (strm, flush) => {
|
|
|
10779
13034
|
hold >>>= here_bits;
|
|
10780
13035
|
bits -= here_bits;
|
|
10781
13036
|
len = 0;
|
|
10782
|
-
|
|
13037
|
+
copy2 = 3 + (hold & 7);
|
|
10783
13038
|
hold >>>= 3;
|
|
10784
13039
|
bits -= 3;
|
|
10785
13040
|
} else {
|
|
@@ -10795,16 +13050,16 @@ var inflate$2 = (strm, flush) => {
|
|
|
10795
13050
|
hold >>>= here_bits;
|
|
10796
13051
|
bits -= here_bits;
|
|
10797
13052
|
len = 0;
|
|
10798
|
-
|
|
13053
|
+
copy2 = 11 + (hold & 127);
|
|
10799
13054
|
hold >>>= 7;
|
|
10800
13055
|
bits -= 7;
|
|
10801
13056
|
}
|
|
10802
|
-
if (state.have +
|
|
13057
|
+
if (state.have + copy2 > state.nlen + state.ndist) {
|
|
10803
13058
|
strm.msg = "invalid bit length repeat";
|
|
10804
13059
|
state.mode = BAD;
|
|
10805
13060
|
break;
|
|
10806
13061
|
}
|
|
10807
|
-
while (
|
|
13062
|
+
while (copy2--) {
|
|
10808
13063
|
state.lens[state.have++] = len;
|
|
10809
13064
|
}
|
|
10810
13065
|
}
|
|
@@ -11023,39 +13278,39 @@ var inflate$2 = (strm, flush) => {
|
|
|
11023
13278
|
if (left3 === 0) {
|
|
11024
13279
|
break inf_leave;
|
|
11025
13280
|
}
|
|
11026
|
-
|
|
11027
|
-
if (state.offset >
|
|
11028
|
-
|
|
11029
|
-
if (
|
|
13281
|
+
copy2 = _out - left3;
|
|
13282
|
+
if (state.offset > copy2) {
|
|
13283
|
+
copy2 = state.offset - copy2;
|
|
13284
|
+
if (copy2 > state.whave) {
|
|
11030
13285
|
if (state.sane) {
|
|
11031
13286
|
strm.msg = "invalid distance too far back";
|
|
11032
13287
|
state.mode = BAD;
|
|
11033
13288
|
break;
|
|
11034
13289
|
}
|
|
11035
13290
|
}
|
|
11036
|
-
if (
|
|
11037
|
-
|
|
11038
|
-
from = state.wsize -
|
|
13291
|
+
if (copy2 > state.wnext) {
|
|
13292
|
+
copy2 -= state.wnext;
|
|
13293
|
+
from = state.wsize - copy2;
|
|
11039
13294
|
} else {
|
|
11040
|
-
from = state.wnext -
|
|
13295
|
+
from = state.wnext - copy2;
|
|
11041
13296
|
}
|
|
11042
|
-
if (
|
|
11043
|
-
|
|
13297
|
+
if (copy2 > state.length) {
|
|
13298
|
+
copy2 = state.length;
|
|
11044
13299
|
}
|
|
11045
13300
|
from_source = state.window;
|
|
11046
13301
|
} else {
|
|
11047
13302
|
from_source = output;
|
|
11048
13303
|
from = put - state.offset;
|
|
11049
|
-
|
|
13304
|
+
copy2 = state.length;
|
|
11050
13305
|
}
|
|
11051
|
-
if (
|
|
11052
|
-
|
|
13306
|
+
if (copy2 > left3) {
|
|
13307
|
+
copy2 = left3;
|
|
11053
13308
|
}
|
|
11054
|
-
left3 -=
|
|
11055
|
-
state.length -=
|
|
13309
|
+
left3 -= copy2;
|
|
13310
|
+
state.length -= copy2;
|
|
11056
13311
|
do {
|
|
11057
13312
|
output[put++] = from_source[from++];
|
|
11058
|
-
} while (--
|
|
13313
|
+
} while (--copy2);
|
|
11059
13314
|
if (state.length === 0) {
|
|
11060
13315
|
state.mode = LEN;
|
|
11061
13316
|
}
|
|
@@ -11165,7 +13420,7 @@ var inflateEnd = (strm) => {
|
|
|
11165
13420
|
strm.state = null;
|
|
11166
13421
|
return Z_OK$1;
|
|
11167
13422
|
};
|
|
11168
|
-
var inflateGetHeader = (strm,
|
|
13423
|
+
var inflateGetHeader = (strm, head3) => {
|
|
11169
13424
|
if (inflateStateCheck(strm)) {
|
|
11170
13425
|
return Z_STREAM_ERROR$1;
|
|
11171
13426
|
}
|
|
@@ -11173,8 +13428,8 @@ var inflateGetHeader = (strm, head2) => {
|
|
|
11173
13428
|
if ((state.wrap & 2) === 0) {
|
|
11174
13429
|
return Z_STREAM_ERROR$1;
|
|
11175
13430
|
}
|
|
11176
|
-
state.head =
|
|
11177
|
-
|
|
13431
|
+
state.head = head3;
|
|
13432
|
+
head3.done = false;
|
|
11178
13433
|
return Z_OK$1;
|
|
11179
13434
|
};
|
|
11180
13435
|
var inflateSetDictionary = (strm, dictionary) => {
|
|
@@ -11412,7 +13667,7 @@ var { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;
|
|
|
11412
13667
|
var { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;
|
|
11413
13668
|
var deflate_1 = deflate;
|
|
11414
13669
|
|
|
11415
|
-
// src/
|
|
13670
|
+
// src/core/LayerGraph.ts
|
|
11416
13671
|
var UnableToProduceLayerGraphError = class {
|
|
11417
13672
|
constructor(message, node) {
|
|
11418
13673
|
this.message = message;
|
|
@@ -11420,250 +13675,419 @@ var UnableToProduceLayerGraphError = class {
|
|
|
11420
13675
|
}
|
|
11421
13676
|
_tag = "@effect/language-service/UnableToProduceLayerGraphError";
|
|
11422
13677
|
};
|
|
11423
|
-
var
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
13678
|
+
var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
|
|
13679
|
+
const ts = yield* service(TypeScriptApi);
|
|
13680
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
13681
|
+
const typeParser = yield* service(TypeParser);
|
|
13682
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
13683
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13684
|
+
const sourceFile = tsUtils.getSourceFileOfNode(node);
|
|
13685
|
+
const layerModuleName = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(sourceFile, "effect", "Layer") || "Layer";
|
|
13686
|
+
const visitedNodes = /* @__PURE__ */ new WeakSet();
|
|
13687
|
+
const nodeInPipeContext = /* @__PURE__ */ new WeakSet();
|
|
13688
|
+
const nodeToGraph = /* @__PURE__ */ new WeakMap();
|
|
13689
|
+
const nodeToVisit = [node];
|
|
13690
|
+
const appendNodeToVisit = (node2) => {
|
|
13691
|
+
nodeToVisit.push(node2);
|
|
13692
|
+
return void 0;
|
|
13693
|
+
};
|
|
13694
|
+
const mutableGraph = beginMutation3(directed());
|
|
13695
|
+
const extractNodeInfo = fn("extractNodeInfo")(function* (node2) {
|
|
13696
|
+
let provides = [];
|
|
13697
|
+
let requires = [];
|
|
13698
|
+
let layerType = void 0;
|
|
13699
|
+
let layerTypes = void 0;
|
|
13700
|
+
if (nodeInPipeContext.has(node2)) {
|
|
13701
|
+
if (ts.isExpression(node2)) {
|
|
13702
|
+
const contextualType = typeChecker.getContextualType(node2);
|
|
13703
|
+
if (contextualType) {
|
|
13704
|
+
const callSignatures = typeChecker.getSignaturesOfType(contextualType, ts.SignatureKind.Call);
|
|
13705
|
+
if (callSignatures.length === 1) {
|
|
13706
|
+
layerType = typeChecker.getReturnTypeOfSignature(callSignatures[0]);
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
11454
13709
|
}
|
|
11455
|
-
|
|
13710
|
+
} else {
|
|
13711
|
+
layerType = typeChecker.getTypeAtLocation(node2);
|
|
11456
13712
|
}
|
|
11457
|
-
if (
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
13713
|
+
if (layerType) {
|
|
13714
|
+
layerTypes = yield* pipe(typeParser.layerType(layerType, node2), orElse2(() => void_));
|
|
13715
|
+
}
|
|
13716
|
+
if (!layerTypes) layerType = void 0;
|
|
13717
|
+
if (layerTypes) {
|
|
13718
|
+
provides = typeCheckerUtils.unrollUnionMembers(layerTypes.ROut).filter((_) => !(_.flags & ts.TypeFlags.Never));
|
|
13719
|
+
requires = typeCheckerUtils.unrollUnionMembers(layerTypes.RIn).filter((_) => !(_.flags & ts.TypeFlags.Never));
|
|
13720
|
+
}
|
|
13721
|
+
return { node: node2, layerType, layerTypes, provides, requires };
|
|
13722
|
+
});
|
|
13723
|
+
const addNode2 = fn("addNode")(function* (node2, nodeInfo) {
|
|
13724
|
+
const graphNode = addNode(mutableGraph, nodeInfo ? nodeInfo : yield* extractNodeInfo(node2));
|
|
13725
|
+
nodeToGraph.set(node2, graphNode);
|
|
13726
|
+
return graphNode;
|
|
13727
|
+
});
|
|
13728
|
+
while (nodeToVisit.length > 0) {
|
|
13729
|
+
const node2 = nodeToVisit.pop();
|
|
13730
|
+
const pipeArgs = yield* pipe(typeParser.pipeCall(node2), orElse2(() => void_));
|
|
13731
|
+
if (pipeArgs) {
|
|
13732
|
+
if (!visitedNodes.has(node2)) {
|
|
13733
|
+
appendNodeToVisit(node2);
|
|
13734
|
+
appendNodeToVisit(pipeArgs.subject);
|
|
13735
|
+
pipeArgs.args.forEach(appendNodeToVisit);
|
|
13736
|
+
pipeArgs.args.forEach((_) => nodeInPipeContext.add(_));
|
|
13737
|
+
visitedNodes.add(node2);
|
|
13738
|
+
} else {
|
|
13739
|
+
const childNodes = [pipeArgs.subject, ...pipeArgs.args].map((_) => nodeToGraph.get(_)).filter(
|
|
13740
|
+
isNumber
|
|
13741
|
+
).filter(
|
|
13742
|
+
(_) => hasNode(mutableGraph, _)
|
|
11463
13743
|
);
|
|
11464
|
-
if (
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
argNodes.value,
|
|
11479
|
-
outTypes,
|
|
11480
|
-
inTypes
|
|
11481
|
-
);
|
|
13744
|
+
if (childNodes.length === pipeArgs.args.length + 1) {
|
|
13745
|
+
let lastNode = null;
|
|
13746
|
+
for (const childNode of childNodes) {
|
|
13747
|
+
if (lastNode !== null) addEdge(mutableGraph, childNode, lastNode, { relationship: "pipe" });
|
|
13748
|
+
lastNode = childNode;
|
|
13749
|
+
}
|
|
13750
|
+
if (lastNode !== null) {
|
|
13751
|
+
const graphNode = yield* addNode2(node2);
|
|
13752
|
+
addEdge(mutableGraph, graphNode, lastNode, { relationship: "pipe" });
|
|
13753
|
+
}
|
|
13754
|
+
} else {
|
|
13755
|
+
childNodes.forEach((_) => removeNode(mutableGraph, _));
|
|
13756
|
+
const nodeInfo = yield* extractNodeInfo(node2);
|
|
13757
|
+
if (nodeInfo.layerTypes) yield* addNode2(node2, nodeInfo);
|
|
11482
13758
|
}
|
|
11483
13759
|
}
|
|
13760
|
+
continue;
|
|
11484
13761
|
}
|
|
11485
|
-
if (
|
|
11486
|
-
|
|
11487
|
-
if (
|
|
11488
|
-
const
|
|
11489
|
-
if (
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
)
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
13762
|
+
if (ts.isCallExpression(node2)) {
|
|
13763
|
+
let shouldExplode = !opts.explodeOnlyLayerCalls;
|
|
13764
|
+
if (opts.explodeOnlyLayerCalls) {
|
|
13765
|
+
const isLayerCall = ts.isPropertyAccessExpression(node2.expression) && ts.isIdentifier(node2.expression.expression) && ts.idText(node2.expression.expression) === layerModuleName;
|
|
13766
|
+
if (isLayerCall) shouldExplode = true;
|
|
13767
|
+
}
|
|
13768
|
+
if (shouldExplode) {
|
|
13769
|
+
if (!visitedNodes.has(node2)) {
|
|
13770
|
+
appendNodeToVisit(node2);
|
|
13771
|
+
node2.arguments.forEach(appendNodeToVisit);
|
|
13772
|
+
visitedNodes.add(node2);
|
|
13773
|
+
} else {
|
|
13774
|
+
const childNodes = node2.arguments.map((_) => nodeToGraph.get(_)).filter(isNumber).filter(
|
|
13775
|
+
(_) => hasNode(mutableGraph, _)
|
|
13776
|
+
);
|
|
13777
|
+
if (childNodes.length === node2.arguments.length) {
|
|
13778
|
+
const graphNode = yield* addNode2(node2);
|
|
13779
|
+
childNodes.forEach(
|
|
13780
|
+
(_, argumentIndex) => addEdge(mutableGraph, graphNode, _, { relationship: "call", argumentIndex })
|
|
11503
13781
|
);
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
if (isSome2(argNodes) && argNodes.value.length === node.arguments.length) {
|
|
11509
|
-
return new GraphNodeCompoundTransform(
|
|
11510
|
-
ctx.nextId(),
|
|
11511
|
-
node,
|
|
11512
|
-
[pipedInGraphNode, ...argNodes.value],
|
|
11513
|
-
outTypes,
|
|
11514
|
-
inTypes
|
|
11515
|
-
);
|
|
11516
|
-
}
|
|
11517
|
-
}
|
|
11518
|
-
const argNode = yield* option(processLayerGraphNode(ctx, node, void 0));
|
|
11519
|
-
if (isSome2(argNode)) {
|
|
11520
|
-
return new GraphNodeCompoundTransform(
|
|
11521
|
-
ctx.nextId(),
|
|
11522
|
-
node,
|
|
11523
|
-
[pipedInGraphNode, argNode.value],
|
|
11524
|
-
outTypes,
|
|
11525
|
-
inTypes
|
|
11526
|
-
);
|
|
11527
|
-
} else {
|
|
11528
|
-
return new GraphNodeCompoundTransform(
|
|
11529
|
-
ctx.nextId(),
|
|
11530
|
-
node,
|
|
11531
|
-
[pipedInGraphNode],
|
|
11532
|
-
outTypes,
|
|
11533
|
-
inTypes
|
|
11534
|
-
);
|
|
11535
|
-
}
|
|
13782
|
+
} else {
|
|
13783
|
+
childNodes.forEach((_) => removeNode(mutableGraph, _));
|
|
13784
|
+
const nodeInfo = yield* extractNodeInfo(node2);
|
|
13785
|
+
if (nodeInfo.layerTypes) yield* addNode2(node2, nodeInfo);
|
|
11536
13786
|
}
|
|
11537
13787
|
}
|
|
13788
|
+
continue;
|
|
11538
13789
|
}
|
|
11539
13790
|
}
|
|
11540
|
-
if (ts.
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
);
|
|
11549
|
-
const { allIndexes: inTypes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
11550
|
-
ctx.services,
|
|
11551
|
-
maybeLayer.value.RIn,
|
|
11552
|
-
excludeNever
|
|
13791
|
+
if (opts.arrayLiteralAsMerge && ts.isArrayLiteralExpression(node2)) {
|
|
13792
|
+
if (!visitedNodes.has(node2)) {
|
|
13793
|
+
appendNodeToVisit(node2);
|
|
13794
|
+
node2.elements.forEach(appendNodeToVisit);
|
|
13795
|
+
visitedNodes.add(node2);
|
|
13796
|
+
} else {
|
|
13797
|
+
const childNodes = node2.elements.map((_) => nodeToGraph.get(_)).filter(isNumber).filter(
|
|
13798
|
+
(_) => hasNode(mutableGraph, _)
|
|
11553
13799
|
);
|
|
11554
|
-
|
|
13800
|
+
if (childNodes.length > 0) {
|
|
13801
|
+
const graphNode = yield* addNode2(node2);
|
|
13802
|
+
childNodes.forEach(
|
|
13803
|
+
(_, index) => addEdge(mutableGraph, graphNode, _, { relationship: "arrayLiteral", index })
|
|
13804
|
+
);
|
|
13805
|
+
}
|
|
11555
13806
|
}
|
|
13807
|
+
continue;
|
|
11556
13808
|
}
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
switch (graph._tag) {
|
|
11563
|
-
case "GraphNodeLeaf":
|
|
11564
|
-
return graph[kind].indexOf(key) > -1 ? [graph] : [];
|
|
11565
|
-
case "GraphNodeCompoundTransform": {
|
|
11566
|
-
if (graph[kind].indexOf(key) > -1) {
|
|
11567
|
-
let result = [];
|
|
11568
|
-
for (const child of graph.args) {
|
|
11569
|
-
result = result.concat(findInnermostGraphEdge(child, kind, key));
|
|
11570
|
-
}
|
|
11571
|
-
if (result.length > 0) return result;
|
|
11572
|
-
return [graph];
|
|
13809
|
+
if (ts.isExpression(node2)) {
|
|
13810
|
+
const nodeInfo = yield* extractNodeInfo(node2);
|
|
13811
|
+
if (nodeInfo.layerTypes) {
|
|
13812
|
+
yield* addNode2(node2, nodeInfo);
|
|
13813
|
+
continue;
|
|
11573
13814
|
}
|
|
11574
|
-
return [];
|
|
11575
13815
|
}
|
|
13816
|
+
return yield* fail(new UnableToProduceLayerGraphError("Unable to produce layer graph for node", node2));
|
|
11576
13817
|
}
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
13818
|
+
return endMutation2(mutableGraph);
|
|
13819
|
+
});
|
|
13820
|
+
var formatLayerGraph = fn("formatLayerGraph")(function* (layerGraph) {
|
|
13821
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13822
|
+
return toMermaid(layerGraph, {
|
|
13823
|
+
edgeLabel: (edge) => JSON.stringify(edge),
|
|
13824
|
+
nodeLabel: (graphNode) => {
|
|
13825
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
13826
|
+
return sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
13827
|
+
}
|
|
13828
|
+
});
|
|
13829
|
+
});
|
|
13830
|
+
var formatNestedLayerGraph = fn("formatNestedLayerGraph")(function* (layerGraph) {
|
|
13831
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13832
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
13833
|
+
const ts = yield* service(TypeScriptApi);
|
|
13834
|
+
const mermaidSafe = (value) => value.replace(/\n/g, " ").replace(
|
|
13835
|
+
/\s+/g,
|
|
13836
|
+
" "
|
|
13837
|
+
).substring(0, 50).replace(/"/g, "#quot;").replace(/</mg, "#lt;").replace(/>/mg, "#gt;").trim();
|
|
13838
|
+
const typeNameCache = /* @__PURE__ */ new Map();
|
|
13839
|
+
const typeName = (type) => {
|
|
13840
|
+
if (typeNameCache.has(type)) return typeNameCache.get(type);
|
|
13841
|
+
const name = typeChecker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
|
|
13842
|
+
typeNameCache.set(type, name);
|
|
13843
|
+
return name;
|
|
13844
|
+
};
|
|
13845
|
+
let result = [];
|
|
13846
|
+
for (const [graphNodeIndex, graphNode] of entries(nodes(layerGraph))) {
|
|
11585
13847
|
let subgraphDefs = [];
|
|
11586
|
-
|
|
11587
|
-
const
|
|
11588
|
-
for (
|
|
11589
|
-
|
|
11590
|
-
const typeString = typeChecker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
|
|
11591
|
-
subgraphsIn.push("subgraph " + graph.id + "_rin_" + serviceId + ' ["`' + escapeMermaid(typeString) + '`"]');
|
|
11592
|
-
subgraphsIn.push("end");
|
|
11593
|
-
}
|
|
11594
|
-
const subgraphsOut = [];
|
|
11595
|
-
for (const serviceId of graph.rout) {
|
|
11596
|
-
const type = ctxL.services.get(serviceId);
|
|
11597
|
-
const typeString = typeChecker.typeToString(type, void 0, ts.TypeFormatFlags.NoTruncation);
|
|
11598
|
-
subgraphsOut.push("subgraph " + graph.id + "_rout_" + serviceId + ' ["`' + escapeMermaid(typeString) + '`"]');
|
|
11599
|
-
subgraphsOut.push("end");
|
|
11600
|
-
}
|
|
11601
|
-
const sourceFile = graph.node.getSourceFile();
|
|
11602
|
-
const nodePosition = graph.node.getStart(sourceFile, false);
|
|
11603
|
-
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
11604
|
-
if (subgraphsIn.length > 0) {
|
|
11605
|
-
subgraphDefs = [
|
|
11606
|
-
...subgraphDefs,
|
|
11607
|
-
"subgraph " + graph.id + "_rin [Requires]",
|
|
11608
|
-
...subgraphsIn,
|
|
11609
|
-
"end",
|
|
11610
|
-
"style " + graph.id + "_rin stroke:none"
|
|
11611
|
-
];
|
|
13848
|
+
for (const kind of ["requires", "provides"]) {
|
|
13849
|
+
const typesMermaidNodes = [];
|
|
13850
|
+
for (let i = 0; i < graphNode[kind].length; i++) {
|
|
13851
|
+
typesMermaidNodes.push(`${graphNodeIndex}_${kind}_${i}["${mermaidSafe(typeName(graphNode[kind][i]))}"]`);
|
|
11612
13852
|
}
|
|
11613
|
-
if (
|
|
13853
|
+
if (typesMermaidNodes.length > 0) {
|
|
11614
13854
|
subgraphDefs = [
|
|
11615
13855
|
...subgraphDefs,
|
|
11616
|
-
|
|
11617
|
-
...
|
|
11618
|
-
|
|
11619
|
-
|
|
13856
|
+
`subgraph ${graphNodeIndex}_${kind} [${kind === "provides" ? "Provides" : "Requires"}]`,
|
|
13857
|
+
...typesMermaidNodes.map((_) => ` ${_}`),
|
|
13858
|
+
`end`,
|
|
13859
|
+
`style ${graphNodeIndex}_${kind} stroke:none`
|
|
11620
13860
|
];
|
|
11621
13861
|
}
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11646
|
-
|
|
13862
|
+
}
|
|
13863
|
+
subgraphDefs = [
|
|
13864
|
+
`subgraph ${graphNodeIndex}_wrap[" "]`,
|
|
13865
|
+
...subgraphDefs.map((_) => ` ${_}`),
|
|
13866
|
+
`end`,
|
|
13867
|
+
`style ${graphNodeIndex}_wrap fill:transparent`,
|
|
13868
|
+
`style ${graphNodeIndex}_wrap stroke:none`
|
|
13869
|
+
];
|
|
13870
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
13871
|
+
const nodePosition = graphNode.node.getStart(sourceFile, false);
|
|
13872
|
+
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
13873
|
+
const nodeText = sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
13874
|
+
result = [
|
|
13875
|
+
...result,
|
|
13876
|
+
`subgraph ${graphNodeIndex} ["\`${mermaidSafe(nodeText)}<br/>_at ln ${line + 1} col ${character}_\`"]`,
|
|
13877
|
+
...subgraphDefs.map((_) => ` ${_}`),
|
|
13878
|
+
`end`,
|
|
13879
|
+
`style ${graphNodeIndex} fill:transparent`
|
|
13880
|
+
];
|
|
13881
|
+
}
|
|
13882
|
+
for (const edgeInfo of values2(edges(layerGraph))) {
|
|
13883
|
+
const sourceData = layerGraph.nodes.get(edgeInfo.source);
|
|
13884
|
+
const targetData = layerGraph.nodes.get(edgeInfo.target);
|
|
13885
|
+
let connected = false;
|
|
13886
|
+
for (const kind of ["requires", "provides"]) {
|
|
13887
|
+
for (let i = 0; i < sourceData[kind].length; i++) {
|
|
13888
|
+
const targetIdx = targetData[kind].indexOf(sourceData[kind][i]);
|
|
13889
|
+
if (targetIdx > -1) {
|
|
13890
|
+
result.push(`${edgeInfo.source}_${kind}_${i} -.-> ${edgeInfo.target}_${kind}_${targetIdx}`);
|
|
13891
|
+
connected = true;
|
|
11647
13892
|
}
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
13893
|
+
}
|
|
13894
|
+
}
|
|
13895
|
+
if (!connected) {
|
|
13896
|
+
result.push(`${edgeInfo.source} -.-x ${edgeInfo.target}`);
|
|
13897
|
+
}
|
|
13898
|
+
}
|
|
13899
|
+
return [
|
|
13900
|
+
`flowchart TB`,
|
|
13901
|
+
...result.map((_) => ` ${_}`)
|
|
13902
|
+
].join("\n");
|
|
13903
|
+
});
|
|
13904
|
+
var extractOutlineGraph = fn("extractOutlineGraph")(function* (layerGraph) {
|
|
13905
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
13906
|
+
const mutableGraph = beginMutation3(directed());
|
|
13907
|
+
const providers = /* @__PURE__ */ new WeakMap();
|
|
13908
|
+
const knownSymbols = /* @__PURE__ */ new WeakSet();
|
|
13909
|
+
const leafNodes = values2(externals(layerGraph, { direction: "outgoing" }));
|
|
13910
|
+
const dedupedLeafNodes = [];
|
|
13911
|
+
for (const leafNode of leafNodes) {
|
|
13912
|
+
const symbol3 = typeChecker.getSymbolAtLocation(leafNode.node);
|
|
13913
|
+
if (!symbol3) {
|
|
13914
|
+
dedupedLeafNodes.push(leafNode);
|
|
13915
|
+
} else if (symbol3 && !knownSymbols.has(symbol3)) {
|
|
13916
|
+
dedupedLeafNodes.push(leafNode);
|
|
13917
|
+
knownSymbols.add(symbol3);
|
|
13918
|
+
}
|
|
13919
|
+
}
|
|
13920
|
+
for (const leafNode of dedupedLeafNodes) {
|
|
13921
|
+
const nodeIndex = addNode(mutableGraph, {
|
|
13922
|
+
node: leafNode.node,
|
|
13923
|
+
requires: leafNode.requires,
|
|
13924
|
+
provides: leafNode.provides
|
|
13925
|
+
});
|
|
13926
|
+
for (const providedType of leafNode.provides) {
|
|
13927
|
+
if (leafNode.requires.indexOf(providedType) > -1) continue;
|
|
13928
|
+
const previousProviders = providers.get(providedType) || [];
|
|
13929
|
+
providers.set(providedType, [...previousProviders, nodeIndex]);
|
|
13930
|
+
}
|
|
13931
|
+
}
|
|
13932
|
+
for (const [nodeIndex, nodeInfo] of entries(nodes(mutableGraph))) {
|
|
13933
|
+
for (const requiredType of nodeInfo.requires) {
|
|
13934
|
+
for (const providerNodeIndex of providers.get(requiredType) || []) {
|
|
13935
|
+
addEdge(mutableGraph, nodeIndex, providerNodeIndex, {});
|
|
13936
|
+
}
|
|
13937
|
+
}
|
|
13938
|
+
}
|
|
13939
|
+
return endMutation2(mutableGraph);
|
|
13940
|
+
});
|
|
13941
|
+
var formatLayerOutlineGraph = fn("formatLayerOutlineGraph")(
|
|
13942
|
+
function* (layerOutlineGraph) {
|
|
13943
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
13944
|
+
return toMermaid(layerOutlineGraph, {
|
|
13945
|
+
edgeLabel: () => "",
|
|
13946
|
+
nodeLabel: (graphNode) => {
|
|
13947
|
+
const sourceFile = tsUtils.getSourceFileOfNode(graphNode.node);
|
|
13948
|
+
return sourceFile.text.substring(graphNode.node.pos, graphNode.node.end).trim();
|
|
13949
|
+
}
|
|
13950
|
+
});
|
|
13951
|
+
}
|
|
13952
|
+
);
|
|
13953
|
+
var convertOutlineGraphToLayerMagic = fn("convertOutlineGraphToLayerMagic")(
|
|
13954
|
+
function* (outlineGraph, targetOutput) {
|
|
13955
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
13956
|
+
const ts = yield* service(TypeScriptApi);
|
|
13957
|
+
const result = [];
|
|
13958
|
+
const missingOutputTypes = new Set(typeCheckerUtils.unrollUnionMembers(targetOutput));
|
|
13959
|
+
const currentRequiredTypes = /* @__PURE__ */ new Set();
|
|
13960
|
+
const reversedGraph = mutate2(outlineGraph, reverse3);
|
|
13961
|
+
const rootIndexes = fromIterable(indices(externals(reversedGraph, { direction: "incoming" })));
|
|
13962
|
+
const allNodes = fromIterable(values2(dfsPostOrder(reversedGraph, { start: rootIndexes })));
|
|
13963
|
+
for (const nodeInfo of allNodes) {
|
|
13964
|
+
if (!ts.isExpression(nodeInfo.node)) continue;
|
|
13965
|
+
const reallyProvidedTypes = nodeInfo.provides.filter((_) => nodeInfo.requires.indexOf(_) === -1);
|
|
13966
|
+
const shouldMerge = reallyProvidedTypes.some((_) => missingOutputTypes.has(_));
|
|
13967
|
+
if (shouldMerge) {
|
|
13968
|
+
reallyProvidedTypes.forEach((_) => missingOutputTypes.delete(_));
|
|
13969
|
+
}
|
|
13970
|
+
nodeInfo.provides.forEach((_) => currentRequiredTypes.delete(_));
|
|
13971
|
+
nodeInfo.requires.forEach((_) => currentRequiredTypes.add(_));
|
|
13972
|
+
result.push({
|
|
13973
|
+
merges: shouldMerge,
|
|
13974
|
+
provides: true,
|
|
13975
|
+
layerExpression: nodeInfo.node
|
|
13976
|
+
});
|
|
13977
|
+
}
|
|
13978
|
+
return {
|
|
13979
|
+
layerMagicNodes: result,
|
|
13980
|
+
missingOutputTypes
|
|
13981
|
+
};
|
|
13982
|
+
}
|
|
13983
|
+
);
|
|
13984
|
+
var walkLeavesMatching = (graph, predicate, config = {}) => {
|
|
13985
|
+
const start = config.start ?? [];
|
|
13986
|
+
const direction = config.direction ?? "outgoing";
|
|
13987
|
+
return new Walker((f) => ({
|
|
13988
|
+
[Symbol.iterator]: () => {
|
|
13989
|
+
let queue = [...start];
|
|
13990
|
+
const discovered = /* @__PURE__ */ new Set();
|
|
13991
|
+
const nextMapped = () => {
|
|
13992
|
+
while (queue.length > 0) {
|
|
13993
|
+
const current = queue.shift();
|
|
13994
|
+
if (discovered.has(current)) continue;
|
|
13995
|
+
discovered.add(current);
|
|
13996
|
+
const neighbors = neighborsDirected(graph, current, direction);
|
|
13997
|
+
const neighborsMatching = [];
|
|
13998
|
+
for (const neighbor of neighbors) {
|
|
13999
|
+
const neighborNode = getNode(graph, neighbor);
|
|
14000
|
+
if (isSome2(neighborNode) && predicate(neighborNode.value)) {
|
|
14001
|
+
neighborsMatching.push(neighbor);
|
|
14002
|
+
}
|
|
11655
14003
|
}
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
14004
|
+
if (neighborsMatching.length > 0) {
|
|
14005
|
+
queue = [...queue, ...neighborsMatching];
|
|
14006
|
+
} else {
|
|
14007
|
+
const nodeData = getNode(graph, current);
|
|
14008
|
+
if (isSome2(nodeData) && predicate(nodeData.value)) {
|
|
14009
|
+
return { done: false, value: f(current, nodeData.value) };
|
|
14010
|
+
}
|
|
11660
14011
|
}
|
|
11661
14012
|
}
|
|
11662
|
-
return
|
|
14013
|
+
return { done: true, value: void 0 };
|
|
14014
|
+
};
|
|
14015
|
+
return { next: nextMapped };
|
|
14016
|
+
}
|
|
14017
|
+
}));
|
|
14018
|
+
};
|
|
14019
|
+
var extractProvidersAndRequirers = fn("extractProvidersAndRequirers")(
|
|
14020
|
+
function* (layerGraph) {
|
|
14021
|
+
const typeCheckerUtils = yield* service(TypeCheckerUtils);
|
|
14022
|
+
const rootWalker = externals(layerGraph, { direction: "outgoing" });
|
|
14023
|
+
const rootNodes = fromIterable(values2(rootWalker));
|
|
14024
|
+
const rootNodeIndexes = fromIterable(indices(rootWalker));
|
|
14025
|
+
const result = [];
|
|
14026
|
+
const walkTypes = (rootTypes, kind) => {
|
|
14027
|
+
const sortedTypes = pipe(fromIterable(rootTypes), sort(typeCheckerUtils.deterministicTypeOrder));
|
|
14028
|
+
for (const layerType of sortedTypes) {
|
|
14029
|
+
const tsNodes = [];
|
|
14030
|
+
for (const layerNode of values2(
|
|
14031
|
+
walkLeavesMatching(
|
|
14032
|
+
layerGraph,
|
|
14033
|
+
(_) => (kind === "provided" ? _.provides : _.requires).indexOf(layerType) > -1,
|
|
14034
|
+
{ start: rootNodeIndexes }
|
|
14035
|
+
)
|
|
14036
|
+
)) {
|
|
14037
|
+
tsNodes.push(layerNode.node);
|
|
14038
|
+
}
|
|
14039
|
+
result.push({
|
|
14040
|
+
kind,
|
|
14041
|
+
type: layerType,
|
|
14042
|
+
nodes: tsNodes
|
|
14043
|
+
});
|
|
14044
|
+
}
|
|
14045
|
+
};
|
|
14046
|
+
walkTypes(new Set(rootNodes.flatMap((_) => _.provides)), "provided");
|
|
14047
|
+
walkTypes(new Set(rootNodes.flatMap((_) => _.requires)), "required");
|
|
14048
|
+
return result;
|
|
14049
|
+
}
|
|
14050
|
+
);
|
|
14051
|
+
var formatLayerProvidersAndRequirersInfo = fn("formatLayerProvidersAndRequirersInfo")(
|
|
14052
|
+
function* (info) {
|
|
14053
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
14054
|
+
const ts = yield* service(TypeScriptApi);
|
|
14055
|
+
const tsUtils = yield* service(TypeScriptUtils);
|
|
14056
|
+
if (info.length === 0) return "";
|
|
14057
|
+
const textualExplanation = [];
|
|
14058
|
+
const appendInfo = (infoNode) => {
|
|
14059
|
+
const typeString = typeChecker.typeToString(
|
|
14060
|
+
infoNode.type,
|
|
14061
|
+
void 0,
|
|
14062
|
+
ts.TypeFormatFlags.NoTruncation
|
|
14063
|
+
);
|
|
14064
|
+
const positions = infoNode.nodes.map((_) => {
|
|
14065
|
+
const sourceFile = tsUtils.getSourceFileOfNode(_);
|
|
14066
|
+
const nodePosition = ts.getTokenPosOfNode(_, sourceFile);
|
|
14067
|
+
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
14068
|
+
const nodeText = sourceFile.text.substring(_.pos, _.end).trim().replace(/\n/g, " ").substr(0, 50);
|
|
14069
|
+
return `ln ${line + 1} col ${character} by \`${nodeText}\``;
|
|
14070
|
+
});
|
|
14071
|
+
textualExplanation.push(`- ${typeString} ${infoNode.kind} at ${positions.join(", ")}`);
|
|
14072
|
+
};
|
|
14073
|
+
const providedItems = info.filter((_) => _.kind === "provided");
|
|
14074
|
+
const requiredItems = info.filter((_) => _.kind === "required");
|
|
14075
|
+
if (providedItems.length > 0) {
|
|
14076
|
+
for (const item of providedItems) {
|
|
14077
|
+
appendInfo(item);
|
|
11663
14078
|
}
|
|
14079
|
+
if (textualExplanation.length > 0 && requiredItems.length > 0) textualExplanation.push("");
|
|
11664
14080
|
}
|
|
11665
|
-
|
|
11666
|
-
|
|
14081
|
+
if (requiredItems.length > 0) {
|
|
14082
|
+
for (const item of requiredItems) {
|
|
14083
|
+
appendInfo(item);
|
|
14084
|
+
}
|
|
14085
|
+
}
|
|
14086
|
+
return "/**\n" + textualExplanation.map((l) => " * " + l).join("\n") + "\n */";
|
|
14087
|
+
}
|
|
14088
|
+
);
|
|
14089
|
+
|
|
14090
|
+
// src/quickinfo/layerInfo.ts
|
|
11667
14091
|
function generateMarmaidUri(code) {
|
|
11668
14092
|
return gen(function* () {
|
|
11669
14093
|
const state = JSON.stringify({ code });
|
|
@@ -11695,61 +14119,32 @@ function getAdjustedNode(sourceFile, position) {
|
|
|
11695
14119
|
return { node, layerNode };
|
|
11696
14120
|
});
|
|
11697
14121
|
}
|
|
11698
|
-
function parseLayerGraph(
|
|
14122
|
+
function parseLayerGraph(layerNode) {
|
|
11699
14123
|
return gen(function* () {
|
|
11700
|
-
const
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
const
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
};
|
|
11712
|
-
const mermaidLines = yield* processNodeMermaid(rootNode, ctx, graphCtx);
|
|
11713
|
-
const mermaidCode = "flowchart TB\n" + mermaidLines.join("\n");
|
|
11714
|
-
const textualExplanation = [];
|
|
11715
|
-
const appendInfo = (providesNode, type, kindText) => {
|
|
11716
|
-
const typeString = typeChecker.typeToString(
|
|
11717
|
-
type,
|
|
11718
|
-
void 0,
|
|
11719
|
-
ts.TypeFormatFlags.NoTruncation
|
|
11720
|
-
);
|
|
11721
|
-
const positions = providesNode.map((_) => {
|
|
11722
|
-
const nodePosition = _.node.getStart(sourceFile, false);
|
|
11723
|
-
const { character, line } = ts.getLineAndCharacterOfPosition(sourceFile, nodePosition);
|
|
11724
|
-
const nodeText = _.node.getText().trim().replace(/\n/g, " ").substr(0, 50);
|
|
11725
|
-
return "ln " + (line + 1) + " col " + character + " by `" + nodeText + "`";
|
|
11726
|
-
});
|
|
11727
|
-
textualExplanation.push("- " + typeString + " " + kindText + " at " + positions.join(", "));
|
|
11728
|
-
};
|
|
11729
|
-
for (const providesKey of rootNode.rout) {
|
|
11730
|
-
const providesNode = findInnermostGraphEdge(rootNode, "rout", providesKey);
|
|
11731
|
-
appendInfo(providesNode, graphCtx.services.get(providesKey), "provided");
|
|
11732
|
-
}
|
|
11733
|
-
if (textualExplanation.length > 0) textualExplanation.push("");
|
|
11734
|
-
for (const requiresKey of rootNode.rin) {
|
|
11735
|
-
const requiresNode = findInnermostGraphEdge(rootNode, "rin", requiresKey);
|
|
11736
|
-
appendInfo(requiresNode, graphCtx.services.get(requiresKey), "required");
|
|
11737
|
-
}
|
|
11738
|
-
return { mermaidCode, textualExplanation };
|
|
14124
|
+
const layerGraph = yield* extractLayerGraph(layerNode, {
|
|
14125
|
+
arrayLiteralAsMerge: false,
|
|
14126
|
+
explodeOnlyLayerCalls: false
|
|
14127
|
+
});
|
|
14128
|
+
const nestedGraphMermaid = yield* formatNestedLayerGraph(layerGraph);
|
|
14129
|
+
const outlineGraph = yield* extractOutlineGraph(layerGraph);
|
|
14130
|
+
const outlineGraphMermaid = yield* formatLayerOutlineGraph(outlineGraph);
|
|
14131
|
+
const providersAndRequirers = yield* extractProvidersAndRequirers(layerGraph);
|
|
14132
|
+
const providersAndRequirersTextualExplanation = yield* formatLayerProvidersAndRequirersInfo(
|
|
14133
|
+
providersAndRequirers
|
|
14134
|
+
);
|
|
14135
|
+
return { nestedGraphMermaid, outlineGraphMermaid, providersAndRequirersTextualExplanation };
|
|
11739
14136
|
});
|
|
11740
14137
|
}
|
|
11741
14138
|
function effectApiGetLayerGraph(sourceFile, line, character) {
|
|
11742
|
-
return
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
})
|
|
11752
|
-
);
|
|
14139
|
+
return gen(function* () {
|
|
14140
|
+
const ts = yield* service(TypeScriptApi);
|
|
14141
|
+
const position = ts.getPositionOfLineAndCharacter(sourceFile, line, character);
|
|
14142
|
+
const maybeNodes = yield* getAdjustedNode(sourceFile, position);
|
|
14143
|
+
if (!maybeNodes) return yield* fail(new UnableToProduceLayerGraphError("No node found"));
|
|
14144
|
+
const { layerNode, node } = maybeNodes;
|
|
14145
|
+
const { nestedGraphMermaid } = yield* parseLayerGraph(layerNode);
|
|
14146
|
+
return { start: node.pos, end: node.end, mermaidCode: nestedGraphMermaid };
|
|
14147
|
+
});
|
|
11753
14148
|
}
|
|
11754
14149
|
function layerInfo(sourceFile, position, quickInfo2) {
|
|
11755
14150
|
return pipe(
|
|
@@ -11760,35 +14155,36 @@ function layerInfo(sourceFile, position, quickInfo2) {
|
|
|
11760
14155
|
if (!maybeNodes) return quickInfo2;
|
|
11761
14156
|
const { layerNode, node } = maybeNodes;
|
|
11762
14157
|
const layerInfoDisplayParts = yield* pipe(
|
|
11763
|
-
parseLayerGraph(
|
|
14158
|
+
parseLayerGraph(layerNode),
|
|
11764
14159
|
flatMap2(
|
|
11765
|
-
({
|
|
14160
|
+
({ nestedGraphMermaid, outlineGraphMermaid, providersAndRequirersTextualExplanation }) => gen(function* () {
|
|
11766
14161
|
const linkParts = [];
|
|
11767
14162
|
if (!options.noExternal) {
|
|
11768
|
-
const mermaidUri = yield* generateMarmaidUri(
|
|
14163
|
+
const mermaidUri = yield* generateMarmaidUri(nestedGraphMermaid);
|
|
14164
|
+
const outlineMermaidUri = yield* generateMarmaidUri(outlineGraphMermaid);
|
|
11769
14165
|
linkParts.push({ kind: "space", text: "\n" });
|
|
11770
14166
|
linkParts.push({ kind: "link", text: "{@link " });
|
|
11771
14167
|
linkParts.push({ kind: "linkText", text: mermaidUri + " Show full Layer graph" });
|
|
11772
14168
|
linkParts.push({ kind: "link", text: "}" });
|
|
14169
|
+
linkParts.push({ kind: "text", text: " - " });
|
|
14170
|
+
linkParts.push({ kind: "link", text: "{@link " });
|
|
14171
|
+
linkParts.push({ kind: "linkText", text: outlineMermaidUri + " Show Layer outline" });
|
|
14172
|
+
linkParts.push({ kind: "link", text: "}" });
|
|
11773
14173
|
linkParts.push({ kind: "space", text: "\n" });
|
|
11774
14174
|
}
|
|
11775
|
-
if (
|
|
14175
|
+
if (providersAndRequirersTextualExplanation.length === 0) return linkParts;
|
|
11776
14176
|
return [
|
|
11777
14177
|
{
|
|
11778
14178
|
kind: "text",
|
|
11779
|
-
text: "```\n
|
|
14179
|
+
text: "```\n" + providersAndRequirersTextualExplanation + "\n```\n"
|
|
11780
14180
|
},
|
|
11781
14181
|
...linkParts
|
|
11782
14182
|
];
|
|
11783
14183
|
})
|
|
11784
14184
|
),
|
|
11785
|
-
orElse2(
|
|
11786
|
-
(e) => succeed([{
|
|
11787
|
-
kind: "text",
|
|
11788
|
-
text: "```\n/** layer graph not created: " + e.message + " */\n```\n"
|
|
11789
|
-
}])
|
|
11790
|
-
)
|
|
14185
|
+
orElse2(() => succeed([]))
|
|
11791
14186
|
);
|
|
14187
|
+
if (layerInfoDisplayParts.length === 0) return quickInfo2;
|
|
11792
14188
|
if (!quickInfo2) {
|
|
11793
14189
|
const start = ts.getTokenPosOfNode(node, sourceFile);
|
|
11794
14190
|
const end = node.end;
|
|
@@ -12304,71 +14700,6 @@ var functionToArrow = createRefactor({
|
|
|
12304
14700
|
});
|
|
12305
14701
|
|
|
12306
14702
|
// src/refactors/layerMagic.ts
|
|
12307
|
-
function sortDependencies(nodes) {
|
|
12308
|
-
const result = [];
|
|
12309
|
-
const visited = /* @__PURE__ */ new Set();
|
|
12310
|
-
const visiting = /* @__PURE__ */ new Set();
|
|
12311
|
-
const cycles = [];
|
|
12312
|
-
const providesMap = /* @__PURE__ */ new Map();
|
|
12313
|
-
Object.entries(nodes).forEach(([nodeId, node]) => {
|
|
12314
|
-
node.provides.forEach((service2) => {
|
|
12315
|
-
if (!providesMap.has(service2)) {
|
|
12316
|
-
providesMap.set(service2, []);
|
|
12317
|
-
}
|
|
12318
|
-
providesMap.get(service2).push(nodeId);
|
|
12319
|
-
});
|
|
12320
|
-
});
|
|
12321
|
-
providesMap.forEach((nodeIds) => {
|
|
12322
|
-
nodeIds.sort((a, b) => {
|
|
12323
|
-
const nodeA = nodes[a];
|
|
12324
|
-
const nodeB = nodes[b];
|
|
12325
|
-
return nodeA.requires.length - nodeB.requires.length;
|
|
12326
|
-
});
|
|
12327
|
-
});
|
|
12328
|
-
const visit = (nodeId, path) => {
|
|
12329
|
-
if (visited.has(nodeId)) {
|
|
12330
|
-
return;
|
|
12331
|
-
}
|
|
12332
|
-
if (visiting.has(nodeId)) {
|
|
12333
|
-
const cycleStart = path.indexOf(nodeId);
|
|
12334
|
-
const cycle = path.slice(cycleStart).concat([nodeId]);
|
|
12335
|
-
const cycleServices = cycle.map((id) => {
|
|
12336
|
-
const node2 = nodes[id];
|
|
12337
|
-
return `${node2.provides.join(", ")} (requires: ${node2.requires.join(", ")})`;
|
|
12338
|
-
});
|
|
12339
|
-
cycles.push(cycleServices);
|
|
12340
|
-
return;
|
|
12341
|
-
}
|
|
12342
|
-
visiting.add(nodeId);
|
|
12343
|
-
const currentPath = [...path, nodeId];
|
|
12344
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
12345
|
-
const node = nodes[nodeId];
|
|
12346
|
-
node.requires.forEach((requiredService) => {
|
|
12347
|
-
const providers = providesMap.get(requiredService) || [];
|
|
12348
|
-
providers.forEach((providerId) => {
|
|
12349
|
-
if (providerId !== nodeId) {
|
|
12350
|
-
dependencies.add(providerId);
|
|
12351
|
-
}
|
|
12352
|
-
});
|
|
12353
|
-
});
|
|
12354
|
-
dependencies.forEach((depId) => {
|
|
12355
|
-
visit(depId, currentPath);
|
|
12356
|
-
});
|
|
12357
|
-
visiting.delete(nodeId);
|
|
12358
|
-
visited.add(nodeId);
|
|
12359
|
-
result.push(node);
|
|
12360
|
-
};
|
|
12361
|
-
Object.keys(nodes).forEach((nodeId) => {
|
|
12362
|
-
if (!visited.has(nodeId)) {
|
|
12363
|
-
visit(nodeId, []);
|
|
12364
|
-
}
|
|
12365
|
-
});
|
|
12366
|
-
return {
|
|
12367
|
-
sorted: result,
|
|
12368
|
-
cycles,
|
|
12369
|
-
hasCycles: cycles.length > 0
|
|
12370
|
-
};
|
|
12371
|
-
}
|
|
12372
14703
|
var layerMagic = createRefactor({
|
|
12373
14704
|
name: "layerMagic",
|
|
12374
14705
|
description: "Layer Magic",
|
|
@@ -12383,56 +14714,6 @@ var layerMagic = createRefactor({
|
|
|
12383
14714
|
"effect",
|
|
12384
14715
|
"Layer"
|
|
12385
14716
|
) || "Layer";
|
|
12386
|
-
const extractArrayLiteral = (node) => {
|
|
12387
|
-
if (ts.isArrayLiteralExpression(node)) {
|
|
12388
|
-
return pipe(
|
|
12389
|
-
all(...node.elements.map((element) => extractLayers(element, false))),
|
|
12390
|
-
map5(flatten)
|
|
12391
|
-
);
|
|
12392
|
-
}
|
|
12393
|
-
return TypeParserIssue.issue;
|
|
12394
|
-
};
|
|
12395
|
-
const extractLayerExpression = (node) => {
|
|
12396
|
-
if (ts.isExpression(node)) {
|
|
12397
|
-
return pipe(
|
|
12398
|
-
typeParser.layerType(typeChecker.getTypeAtLocation(node), node),
|
|
12399
|
-
map5((_) => [{ node, ..._ }])
|
|
12400
|
-
);
|
|
12401
|
-
}
|
|
12402
|
-
return TypeParserIssue.issue;
|
|
12403
|
-
};
|
|
12404
|
-
const extractLayerApi = (node) => {
|
|
12405
|
-
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.expression) && ts.idText(node.expression.expression) === layerIdentifier && ts.isIdentifier(node.expression.name) && ["provide", "provideMerge", "merge", "mergeAll"].map((_) => _.toLowerCase()).indexOf(
|
|
12406
|
-
ts.idText(node.expression.name).toLowerCase()
|
|
12407
|
-
) > -1) {
|
|
12408
|
-
return pipe(
|
|
12409
|
-
all(...node.arguments.map((element) => extractLayers(element, false))),
|
|
12410
|
-
map5(flatten)
|
|
12411
|
-
);
|
|
12412
|
-
}
|
|
12413
|
-
return TypeParserIssue.issue;
|
|
12414
|
-
};
|
|
12415
|
-
const extractPipeSequencing = (node) => {
|
|
12416
|
-
return pipe(
|
|
12417
|
-
typeParser.pipeCall(node),
|
|
12418
|
-
flatMap2((_) => {
|
|
12419
|
-
return all(...[_.subject, ..._.args].map((element) => extractLayers(element, true)));
|
|
12420
|
-
}),
|
|
12421
|
-
map5(flatten)
|
|
12422
|
-
);
|
|
12423
|
-
};
|
|
12424
|
-
const extractLayers = cachedBy(
|
|
12425
|
-
fn("layerMagic.apply.extractLayerArray")(function* (node, _inPipeContext) {
|
|
12426
|
-
return yield* pipe(
|
|
12427
|
-
extractArrayLiteral(node),
|
|
12428
|
-
orElse2(() => extractLayerApi(node)),
|
|
12429
|
-
_inPipeContext ? (x) => x : orElse2(() => extractPipeSequencing(node)),
|
|
12430
|
-
orElse2(() => extractLayerExpression(node))
|
|
12431
|
-
);
|
|
12432
|
-
}),
|
|
12433
|
-
"layerMagic.apply.extractLayerArray",
|
|
12434
|
-
(node) => node
|
|
12435
|
-
);
|
|
12436
14717
|
const adjustedNode = (node) => {
|
|
12437
14718
|
if (node.parent && (ts.isVariableDeclaration(node.parent) || ts.isPropertyDeclaration(node.parent)) && ts.isIdentifier(node) && node.parent.initializer && node.parent.name === node) {
|
|
12438
14719
|
return node.parent.initializer;
|
|
@@ -12442,9 +14723,13 @@ var layerMagic = createRefactor({
|
|
|
12442
14723
|
const computeAsAnyAsLayerRefactor = (node) => {
|
|
12443
14724
|
const atLocation = adjustedNode(node);
|
|
12444
14725
|
return pipe(
|
|
12445
|
-
|
|
14726
|
+
extractLayerGraph(atLocation, {
|
|
14727
|
+
arrayLiteralAsMerge: true,
|
|
14728
|
+
explodeOnlyLayerCalls: true
|
|
14729
|
+
}),
|
|
14730
|
+
flatMap2(extractOutlineGraph),
|
|
12446
14731
|
flatMap2(
|
|
12447
|
-
(extractedLayer) => extractedLayer
|
|
14732
|
+
(extractedLayer) => nodeCount(extractedLayer) <= 1 ? TypeParserIssue.issue : succeed(extractedLayer)
|
|
12448
14733
|
),
|
|
12449
14734
|
map5((extractedLayers) => ({
|
|
12450
14735
|
kind: "refactor.rewrite.effect.layerMagicPrepare",
|
|
@@ -12452,21 +14737,27 @@ var layerMagic = createRefactor({
|
|
|
12452
14737
|
apply: pipe(
|
|
12453
14738
|
gen(function* () {
|
|
12454
14739
|
const changeTracker = yield* service(ChangeTracker);
|
|
12455
|
-
const
|
|
12456
|
-
for (const layer of extractedLayers) {
|
|
12457
|
-
|
|
12458
|
-
memory,
|
|
12459
|
-
layer.ROut,
|
|
12460
|
-
(_) => succeed((_.flags & ts.TypeFlags.Never) !== 0)
|
|
12461
|
-
);
|
|
14740
|
+
const layerOutputTypes = /* @__PURE__ */ new Set();
|
|
14741
|
+
for (const layer of values2(nodes(extractedLayers))) {
|
|
14742
|
+
layer.provides.forEach((_) => layerOutputTypes.add(_));
|
|
12462
14743
|
}
|
|
14744
|
+
const layerNodes = pipe(
|
|
14745
|
+
values2(nodes(extractedLayers)),
|
|
14746
|
+
fromIterable,
|
|
14747
|
+
map4((_) => _.node),
|
|
14748
|
+
filter(ts.isExpression),
|
|
14749
|
+
sort(mapInput(
|
|
14750
|
+
number2,
|
|
14751
|
+
(_) => _.pos
|
|
14752
|
+
))
|
|
14753
|
+
);
|
|
12463
14754
|
const previouslyProvided = yield* pipe(
|
|
12464
14755
|
typeParser.layerType(typeChecker.getTypeAtLocation(atLocation), atLocation),
|
|
12465
14756
|
map5((_) => _.ROut),
|
|
12466
14757
|
option
|
|
12467
14758
|
);
|
|
12468
14759
|
const [existingBefore, newlyIntroduced] = pipe(
|
|
12469
|
-
fromIterable(
|
|
14760
|
+
fromIterable(layerOutputTypes),
|
|
12470
14761
|
sort(typeCheckerUtils.deterministicTypeOrder),
|
|
12471
14762
|
partition(
|
|
12472
14763
|
(_) => isNone2(previouslyProvided) || typeChecker.isTypeAssignableTo(_, previouslyProvided.value)
|
|
@@ -12491,7 +14782,7 @@ var layerMagic = createRefactor({
|
|
|
12491
14782
|
);
|
|
12492
14783
|
const newDeclaration = ts.factory.createAsExpression(
|
|
12493
14784
|
ts.factory.createAsExpression(
|
|
12494
|
-
ts.factory.createArrayLiteralExpression(
|
|
14785
|
+
ts.factory.createArrayLiteralExpression(layerNodes),
|
|
12495
14786
|
ts.factory.createTypeReferenceNode("any")
|
|
12496
14787
|
),
|
|
12497
14788
|
ts.factory.createTypeReferenceNode(
|
|
@@ -12513,8 +14804,9 @@ var layerMagic = createRefactor({
|
|
|
12513
14804
|
if (ts.isAsExpression(node) && ts.isTypeReferenceNode(node.type)) {
|
|
12514
14805
|
const expression = node.expression;
|
|
12515
14806
|
if (ts.isAsExpression(expression) && expression.type.kind === ts.SyntaxKind.AnyKeyword) {
|
|
14807
|
+
const type = typeChecker.getTypeAtLocation(node.type);
|
|
12516
14808
|
return pipe(
|
|
12517
|
-
typeParser.layerType(
|
|
14809
|
+
typeParser.layerType(type, node.type),
|
|
12518
14810
|
map5((_) => ({ node, ..._, castedStructure: expression.expression }))
|
|
12519
14811
|
);
|
|
12520
14812
|
}
|
|
@@ -12527,80 +14819,49 @@ var layerMagic = createRefactor({
|
|
|
12527
14819
|
parseAsAnyAsLayer(atLocation),
|
|
12528
14820
|
flatMap2(
|
|
12529
14821
|
(_targetLayer) => pipe(
|
|
12530
|
-
|
|
12531
|
-
|
|
14822
|
+
extractLayerGraph(_targetLayer.castedStructure, {
|
|
14823
|
+
arrayLiteralAsMerge: true,
|
|
14824
|
+
explodeOnlyLayerCalls: true
|
|
14825
|
+
}),
|
|
14826
|
+
flatMap2(extractOutlineGraph),
|
|
12532
14827
|
flatMap2(
|
|
12533
|
-
(extractedLayer) => extractedLayer
|
|
14828
|
+
(extractedLayer) => nodeCount(extractedLayer) <= 1 ? TypeParserIssue.issue : succeed(extractedLayer)
|
|
12534
14829
|
),
|
|
12535
14830
|
map5((extractedLayers) => ({
|
|
12536
14831
|
kind: "refactor.rewrite.effect.layerMagicBuild",
|
|
12537
14832
|
description: "Compose layers automatically with target output services",
|
|
12538
14833
|
apply: gen(function* () {
|
|
12539
14834
|
const changeTracker = yield* service(ChangeTracker);
|
|
12540
|
-
const
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
14835
|
+
const { layerMagicNodes, missingOutputTypes } = yield* pipe(
|
|
14836
|
+
convertOutlineGraphToLayerMagic(
|
|
14837
|
+
extractedLayers,
|
|
14838
|
+
_targetLayer.ROut
|
|
14839
|
+
),
|
|
14840
|
+
provideService(TypeCheckerApi, typeChecker),
|
|
14841
|
+
provideService(TypeCheckerUtils, typeCheckerUtils),
|
|
14842
|
+
provideService(TypeScriptApi, ts)
|
|
12545
14843
|
);
|
|
12546
|
-
const nodes = {};
|
|
12547
|
-
for (let i = 0; i < extractedLayers.length; i++) {
|
|
12548
|
-
const layer = extractedLayers[i];
|
|
12549
|
-
const { allIndexes: providedIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
12550
|
-
memory,
|
|
12551
|
-
layer.ROut,
|
|
12552
|
-
(_) => succeed((_.flags & ts.TypeFlags.Never) !== 0)
|
|
12553
|
-
);
|
|
12554
|
-
const { allIndexes: requiredIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
12555
|
-
memory,
|
|
12556
|
-
layer.RIn,
|
|
12557
|
-
(_) => succeed((_.flags & ts.TypeFlags.Never) !== 0)
|
|
12558
|
-
);
|
|
12559
|
-
nodes[`node_${i}`] = {
|
|
12560
|
-
provides: providedIndexes.filter((_) => requiredIndexes.indexOf(_) === -1),
|
|
12561
|
-
// only provide indexes that are not required
|
|
12562
|
-
requires: requiredIndexes,
|
|
12563
|
-
node: layer.node
|
|
12564
|
-
};
|
|
12565
|
-
}
|
|
12566
|
-
const sortResult = sortDependencies(nodes);
|
|
12567
|
-
const sortedNodes = sortResult.sorted.reverse();
|
|
12568
|
-
const missingOutput = new Set(outputIndexes);
|
|
12569
|
-
const missingInternal = /* @__PURE__ */ new Set();
|
|
12570
|
-
const outputEntry = [];
|
|
12571
|
-
for (let i = 0; i < sortedNodes.length; i++) {
|
|
12572
|
-
const graphNode = sortedNodes[i];
|
|
12573
|
-
const mergeOutput = graphNode.provides.filter((_) => missingOutput.has(_));
|
|
12574
|
-
const provideInternal = graphNode.provides.filter((_) => missingInternal.has(_));
|
|
12575
|
-
graphNode.requires.forEach((_) => missingInternal.add(_));
|
|
12576
|
-
mergeOutput.forEach((_) => missingOutput.delete(_));
|
|
12577
|
-
outputEntry.push({
|
|
12578
|
-
merges: mergeOutput.length > 0,
|
|
12579
|
-
provides: provideInternal.length > 0,
|
|
12580
|
-
node: graphNode.node
|
|
12581
|
-
});
|
|
12582
|
-
}
|
|
12583
14844
|
const newDeclaration = ts.factory.createCallExpression(
|
|
12584
14845
|
ts.factory.createPropertyAccessExpression(
|
|
12585
|
-
|
|
14846
|
+
layerMagicNodes[0].layerExpression,
|
|
12586
14847
|
"pipe"
|
|
12587
14848
|
),
|
|
12588
14849
|
[],
|
|
12589
|
-
|
|
14850
|
+
layerMagicNodes.slice(1).map(
|
|
12590
14851
|
(_) => ts.factory.createCallExpression(
|
|
12591
14852
|
ts.factory.createPropertyAccessExpression(
|
|
12592
14853
|
ts.factory.createIdentifier(layerIdentifier),
|
|
12593
14854
|
_.merges && _.provides ? "provideMerge" : _.merges ? "merge" : "provide"
|
|
12594
14855
|
),
|
|
12595
14856
|
[],
|
|
12596
|
-
[_.
|
|
14857
|
+
[_.layerExpression]
|
|
12597
14858
|
)
|
|
12598
14859
|
)
|
|
12599
14860
|
);
|
|
12600
|
-
const newDeclarationWithComment =
|
|
14861
|
+
const newDeclarationWithComment = missingOutputTypes.size > 0 ? ts.addSyntheticTrailingComment(
|
|
12601
14862
|
newDeclaration,
|
|
12602
14863
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
12603
|
-
" Unable to find " + fromIterable(
|
|
14864
|
+
" Unable to find " + fromIterable(missingOutputTypes.values()).map(
|
|
12604
14865
|
(_) => typeChecker.typeToString(_, void 0, ts.TypeFormatFlags.NoTruncation)
|
|
12605
14866
|
).join(", ") + " in the provided layers. ",
|
|
12606
14867
|
false
|