@deepseek-ai/dsh-client-ui-conversation 0.2.1-alpha.1 → 0.2.1-alpha.3
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/README.i18n.yaml +9 -6
- package/README.md +19 -5
- package/README.zh.md +19 -5
- package/lib/client.js +560 -4031
- package/lib/types/client/contract/conversation.d.ts +10 -0
- package/lib/types/client/contract/records.d.ts +8 -3
- package/lib/types/client/contract/request-inspection.d.ts +2 -1
- package/lib/types/client/contract/slots.d.ts +87 -2
- package/lib/types/client/contract/user-text.d.ts +60 -0
- package/lib/types/client/conversation/assembler.d.ts +3 -0
- package/lib/types/client/conversation/assembly.d.ts +3 -0
- package/lib/types/client/conversation/user-text-document.d.ts +21 -0
- package/lib/types/client/conversation/user-text-registry.d.ts +26 -0
- package/lib/types/client/index.d.ts +21 -2
- package/lib/types/client/locales.d.ts +8 -0
- package/lib/types/client/queue/QueueDock.d.ts +3 -3
- package/lib/types/client/user-text/UserText.d.ts +22 -0
- package/lib/types/client/user-text/session-reference-rule.d.ts +15 -0
- package/lib/types/client/user-text/whitespace-rules.d.ts +7 -0
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +41 -41
package/lib/client.js
CHANGED
|
@@ -33,6 +33,7 @@ window.__ModuleLoader__.load({
|
|
|
33
33
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
34
34
|
let react = require("react");
|
|
35
35
|
react = __toESM(react, 1);
|
|
36
|
+
let zod = require("zod");
|
|
36
37
|
let react_dom = require("react-dom");
|
|
37
38
|
//#region ../../../vendor/cosmokit/lib/index.js
|
|
38
39
|
/** Return true when a value is `null` or `undefined`. */
|
|
@@ -40,7 +41,7 @@ window.__ModuleLoader__.load({
|
|
|
40
41
|
return value === null || value === void 0;
|
|
41
42
|
}
|
|
42
43
|
/** Return true for non-array object values. */
|
|
43
|
-
function isPlainObject
|
|
44
|
+
function isPlainObject(data) {
|
|
44
45
|
return data && typeof data === "object" && !Array.isArray(data);
|
|
45
46
|
}
|
|
46
47
|
/** Filter object entries and return a new object. */
|
|
@@ -52,7 +53,7 @@ window.__ModuleLoader__.load({
|
|
|
52
53
|
return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, transform(value, key)]));
|
|
53
54
|
}
|
|
54
55
|
/** Pick selected keys from an object, optionally including `undefined` values. */
|
|
55
|
-
function pick
|
|
56
|
+
function pick(source, keys, forced) {
|
|
56
57
|
if (!keys) return { ...source };
|
|
57
58
|
const result = {};
|
|
58
59
|
for (const key of keys) if (forced || source[key] !== void 0) result[key] = source[key];
|
|
@@ -150,7 +151,7 @@ window.__ModuleLoader__.load({
|
|
|
150
151
|
Binary.fromHex;
|
|
151
152
|
Binary.toHex;
|
|
152
153
|
/** Deep-clone common JavaScript values while preserving prototypes and cycles. */
|
|
153
|
-
function clone
|
|
154
|
+
function clone(source, refs = /* @__PURE__ */ new Map()) {
|
|
154
155
|
if (!source || typeof source !== "object") return source;
|
|
155
156
|
if (is$1("Date", source)) return new Date(source.valueOf());
|
|
156
157
|
if (is$1("RegExp", source)) return new RegExp(source.source, source.flags);
|
|
@@ -162,7 +163,7 @@ window.__ModuleLoader__.load({
|
|
|
162
163
|
const result = [];
|
|
163
164
|
refs.set(source, result);
|
|
164
165
|
source.forEach((value, index) => {
|
|
165
|
-
result[index] = Reflect.apply(clone
|
|
166
|
+
result[index] = Reflect.apply(clone, null, [value, refs]);
|
|
166
167
|
});
|
|
167
168
|
return result;
|
|
168
169
|
}
|
|
@@ -170,7 +171,7 @@ window.__ModuleLoader__.load({
|
|
|
170
171
|
refs.set(source, result);
|
|
171
172
|
for (const key of Reflect.ownKeys(source)) {
|
|
172
173
|
const descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) };
|
|
173
|
-
if ("value" in descriptor) descriptor.value = Reflect.apply(clone
|
|
174
|
+
if ("value" in descriptor) descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs]);
|
|
174
175
|
Reflect.defineProperty(result, key, descriptor);
|
|
175
176
|
}
|
|
176
177
|
return result;
|
|
@@ -456,7 +457,7 @@ window.__ModuleLoader__.load({
|
|
|
456
457
|
};
|
|
457
458
|
Schema.prototype.pattern = function pattern(regexp) {
|
|
458
459
|
const schema = Schema(this);
|
|
459
|
-
const pattern = pick
|
|
460
|
+
const pattern = pick(regexp, ["source", "flags"]);
|
|
460
461
|
schema.meta = {
|
|
461
462
|
...schema.meta,
|
|
462
463
|
pattern
|
|
@@ -574,7 +575,7 @@ window.__ModuleLoader__.load({
|
|
|
574
575
|
fallback = current?.meta.default;
|
|
575
576
|
}
|
|
576
577
|
if (isNullable(fallback)) return [data];
|
|
577
|
-
data = clone
|
|
578
|
+
data = clone(fallback);
|
|
578
579
|
}
|
|
579
580
|
const callback = resolvers[schema.type];
|
|
580
581
|
if (!callback) throw new ValidationError(`unsupported type "${schema.type}"`, options);
|
|
@@ -775,7 +776,7 @@ window.__ModuleLoader__.load({
|
|
|
775
776
|
return [data.map((_, index) => property(data, index, inner, options))];
|
|
776
777
|
});
|
|
777
778
|
Schema.extend("dict", (data, { inner, sKey }, options, strict) => {
|
|
778
|
-
if (!isPlainObject
|
|
779
|
+
if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
|
|
779
780
|
const result = {};
|
|
780
781
|
for (const key in data) {
|
|
781
782
|
let rKey;
|
|
@@ -798,20 +799,20 @@ window.__ModuleLoader__.load({
|
|
|
798
799
|
result.push(...data.slice(list.length));
|
|
799
800
|
return [result];
|
|
800
801
|
});
|
|
801
|
-
function merge
|
|
802
|
+
function merge(result, data) {
|
|
802
803
|
for (const key in data) {
|
|
803
804
|
if (key in result) continue;
|
|
804
805
|
result[key] = data[key];
|
|
805
806
|
}
|
|
806
807
|
}
|
|
807
808
|
Schema.extend("object", (data, { dict }, options, strict) => {
|
|
808
|
-
if (!isPlainObject
|
|
809
|
+
if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options);
|
|
809
810
|
const result = {};
|
|
810
811
|
for (const key in dict) {
|
|
811
812
|
const value = property(data, key, dict[key], options);
|
|
812
813
|
if (!isNullable(value) || key in data) result[key] = value;
|
|
813
814
|
}
|
|
814
|
-
if (!strict) merge
|
|
815
|
+
if (!strict) merge(result, data);
|
|
815
816
|
return [result];
|
|
816
817
|
});
|
|
817
818
|
Schema.extend("union", (data, { list, toString }, options, strict) => {
|
|
@@ -831,10 +832,10 @@ window.__ModuleLoader__.load({
|
|
|
831
832
|
if (isNullable(value)) continue;
|
|
832
833
|
if (isNullable(result)) result = value;
|
|
833
834
|
else if (typeof result !== typeof value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
|
|
834
|
-
else if (typeof value === "object") merge
|
|
835
|
+
else if (typeof value === "object") merge(result ??= {}, value);
|
|
835
836
|
else if (result !== value) throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options);
|
|
836
837
|
}
|
|
837
|
-
if (!strict && isPlainObject
|
|
838
|
+
if (!strict && isPlainObject(data)) merge(result, data);
|
|
838
839
|
return [result];
|
|
839
840
|
});
|
|
840
841
|
Schema.extend("transform", (data, { inner, callback, preserve }, options) => {
|
|
@@ -2538,6 +2539,9 @@ window.__ModuleLoader__.load({
|
|
|
2538
2539
|
groups = /* @__PURE__ */ new Map();
|
|
2539
2540
|
pendingGroupStores = /* @__PURE__ */ new Set();
|
|
2540
2541
|
activeTargets = /* @__PURE__ */ new Set();
|
|
2542
|
+
/** Matches of the event in dispatch, kept by index; dispatch is not reentrant and reuses both arrays. */
|
|
2543
|
+
matchedDefinitions = [];
|
|
2544
|
+
matchedResults = [];
|
|
2541
2545
|
hasMore = false;
|
|
2542
2546
|
replacePending = true;
|
|
2543
2547
|
timelineDirty = true;
|
|
@@ -2794,25 +2798,45 @@ window.__ModuleLoader__.load({
|
|
|
2794
2798
|
location ??= this.locationIndex.locationOf(event);
|
|
2795
2799
|
return role === "start" ? startMatch ??= conversationMatch(input, role, location) : updateMatch ??= conversationMatch(input, role, location);
|
|
2796
2800
|
};
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
+
const definitions = this.matchedDefinitions;
|
|
2802
|
+
const results = this.matchedResults;
|
|
2803
|
+
definitions.length = 0;
|
|
2804
|
+
results.length = 0;
|
|
2801
2805
|
const routes = this.eventDefinitions.forEvent?.(event.type);
|
|
2802
2806
|
if (routes === void 0) for (const definition of this.eventDefinitions.entries()) {
|
|
2803
2807
|
const result = definition.match(event);
|
|
2804
2808
|
if (result === null) continue;
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
else (otherTargets ??= /* @__PURE__ */ new Set()).add(definition.target);
|
|
2808
|
-
publication = maximumPublication(publication, accept.call(this, definition, result.id, matchFor(result.role)));
|
|
2809
|
+
definitions.push(definition);
|
|
2810
|
+
results.push(result);
|
|
2809
2811
|
}
|
|
2810
2812
|
else for (const { definition, match } of routes) {
|
|
2811
2813
|
const result = match(event);
|
|
2812
2814
|
if (result === null) continue;
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2815
|
+
definitions.push(definition);
|
|
2816
|
+
results.push(result);
|
|
2817
|
+
}
|
|
2818
|
+
let claims;
|
|
2819
|
+
for (let index = 0; index < results.length; index++) {
|
|
2820
|
+
if (results[index].exclusive !== true) continue;
|
|
2821
|
+
const definition = definitions[index];
|
|
2822
|
+
const target = definition.target;
|
|
2823
|
+
if (target === void 0) throw new Error(`conversation Definition "${definition.kind}" claims ${event.type} at seq ${String(event.seq)} without a target`);
|
|
2824
|
+
const claimant = claims?.get(target);
|
|
2825
|
+
if (claimant !== void 0) throw new Error(`conversation Definitions "${claimant}" and "${definition.kind}" both claim ${event.type} at seq ${String(event.seq)} on target "${target}"`);
|
|
2826
|
+
(claims ??= /* @__PURE__ */ new Map()).set(target, definition.kind);
|
|
2827
|
+
}
|
|
2828
|
+
let firstTarget;
|
|
2829
|
+
let secondTarget;
|
|
2830
|
+
let otherTargets;
|
|
2831
|
+
let publication = "none";
|
|
2832
|
+
for (let index = 0; index < results.length; index++) {
|
|
2833
|
+
const definition = definitions[index];
|
|
2834
|
+
const result = results[index];
|
|
2835
|
+
const target = definition.target;
|
|
2836
|
+
if (target !== void 0 && result.exclusive !== true && claims?.has(target) === true) continue;
|
|
2837
|
+
if (target !== void 0 && target !== firstTarget && target !== secondTarget) if (firstTarget === void 0) firstTarget = target;
|
|
2838
|
+
else if (secondTarget === void 0) secondTarget = target;
|
|
2839
|
+
else (otherTargets ??= /* @__PURE__ */ new Set()).add(target);
|
|
2816
2840
|
publication = maximumPublication(publication, accept.call(this, definition, result.id, matchFor(result.role)));
|
|
2817
2841
|
}
|
|
2818
2842
|
const fallback = this.eventDefinitions.fallbackEntry();
|
|
@@ -3640,6 +3664,253 @@ window.__ModuleLoader__.load({
|
|
|
3640
3664
|
}
|
|
3641
3665
|
};
|
|
3642
3666
|
//#endregion
|
|
3667
|
+
//#region lib/types/client/conversation/user-text-document.js
|
|
3668
|
+
var UserTextTransformError = class extends Error {
|
|
3669
|
+
ruleId;
|
|
3670
|
+
constructor(ruleId, cause) {
|
|
3671
|
+
super(`user-text rule "${ruleId}" failed to evaluate`, { cause });
|
|
3672
|
+
this.ruleId = ruleId;
|
|
3673
|
+
this.name = "UserTextTransformError";
|
|
3674
|
+
}
|
|
3675
|
+
};
|
|
3676
|
+
/** Data-layer cache owned by one caller; initialization and refresh share one reconciliation. */
|
|
3677
|
+
var UserTextDocument = class {
|
|
3678
|
+
text;
|
|
3679
|
+
rules;
|
|
3680
|
+
initial = [];
|
|
3681
|
+
output = [];
|
|
3682
|
+
matchers = /* @__PURE__ */ new Map();
|
|
3683
|
+
complete = false;
|
|
3684
|
+
evaluating = false;
|
|
3685
|
+
/**
|
|
3686
|
+
* Reconcile original text using current rule definitions and valid query records.
|
|
3687
|
+
* @param input - original text and readonly Facts, compared by fields actually read.
|
|
3688
|
+
* @param rules - unique definitions ordered by ascending order and stable ID.
|
|
3689
|
+
* @returns complete readonly nodes; failures retain caches but publish no partial result.
|
|
3690
|
+
*/
|
|
3691
|
+
evaluate(input, rules) {
|
|
3692
|
+
if (this.evaluating) throw new Error("user-text document evaluation cannot be reentrant");
|
|
3693
|
+
this.evaluating = true;
|
|
3694
|
+
try {
|
|
3695
|
+
const { changed, matchers } = this.prepare(input, rules);
|
|
3696
|
+
if (!changed && this.complete) return this.output;
|
|
3697
|
+
this.complete = false;
|
|
3698
|
+
this.output = alignNodes(this.reconcile(input, matchers), this.output, this.initial);
|
|
3699
|
+
this.complete = true;
|
|
3700
|
+
return this.output;
|
|
3701
|
+
} finally {
|
|
3702
|
+
this.evaluating = false;
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
prepare(input, rules) {
|
|
3706
|
+
let changed = this.rules !== rules;
|
|
3707
|
+
if (this.text !== input.text) {
|
|
3708
|
+
changed = true;
|
|
3709
|
+
this.text = input.text;
|
|
3710
|
+
this.matchers.clear();
|
|
3711
|
+
this.initial = input.text.length === 0 ? [] : [textNode(input.text, 0, input.text.length)];
|
|
3712
|
+
this.output = this.initial;
|
|
3713
|
+
}
|
|
3714
|
+
const ids = new Set(rules.map((rule) => rule.id));
|
|
3715
|
+
const matchers = [];
|
|
3716
|
+
for (const definition of rules) {
|
|
3717
|
+
let matcher = this.matchers.get(definition.id);
|
|
3718
|
+
if (matcher === void 0 || matcher.definition !== definition || factsChanged(matcher.reads, input)) {
|
|
3719
|
+
matcher = {
|
|
3720
|
+
definition,
|
|
3721
|
+
queries: [],
|
|
3722
|
+
reads: /* @__PURE__ */ new Map()
|
|
3723
|
+
};
|
|
3724
|
+
this.matchers.set(definition.id, matcher);
|
|
3725
|
+
changed = true;
|
|
3726
|
+
}
|
|
3727
|
+
matchers.push(matcher);
|
|
3728
|
+
}
|
|
3729
|
+
for (const id of this.matchers.keys()) if (!ids.has(id)) this.matchers.delete(id);
|
|
3730
|
+
this.rules = rules;
|
|
3731
|
+
return {
|
|
3732
|
+
changed,
|
|
3733
|
+
matchers
|
|
3734
|
+
};
|
|
3735
|
+
}
|
|
3736
|
+
reconcile(input, matchers) {
|
|
3737
|
+
const traversals = matchers.map((matcher) => ({
|
|
3738
|
+
matcher,
|
|
3739
|
+
added: [],
|
|
3740
|
+
index: -1,
|
|
3741
|
+
head: void 0
|
|
3742
|
+
}));
|
|
3743
|
+
const nodes = [];
|
|
3744
|
+
let cursor = 0;
|
|
3745
|
+
try {
|
|
3746
|
+
while (true) {
|
|
3747
|
+
let winner;
|
|
3748
|
+
for (const traversal of traversals) {
|
|
3749
|
+
const node = nextCandidate(traversal, input, cursor);
|
|
3750
|
+
if (node !== void 0 && (winner === void 0 || node.start < winner.start)) winner = node;
|
|
3751
|
+
}
|
|
3752
|
+
if (winner === void 0) {
|
|
3753
|
+
if (cursor < input.text.length) nodes.push(textNode(input.text, cursor, input.text.length));
|
|
3754
|
+
return nodes;
|
|
3755
|
+
}
|
|
3756
|
+
if (cursor < winner.start) nodes.push(textNode(input.text, cursor, winner.start));
|
|
3757
|
+
nodes.push(winner);
|
|
3758
|
+
cursor = winner.end;
|
|
3759
|
+
}
|
|
3760
|
+
} finally {
|
|
3761
|
+
for (const { matcher, added } of traversals) if (added.length > 0) matcher.queries = mergeQueries(matcher.queries, added);
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
};
|
|
3765
|
+
function factsChanged(reads, input) {
|
|
3766
|
+
for (const [key, value] of reads) if (!Object.is(value, input.facts[key])) return true;
|
|
3767
|
+
return false;
|
|
3768
|
+
}
|
|
3769
|
+
function withFacts(input, reads, run) {
|
|
3770
|
+
let active = true;
|
|
3771
|
+
try {
|
|
3772
|
+
return run({ read: (key) => {
|
|
3773
|
+
if (!active) throw new Error("user-text transform context is closed; read is synchronous only");
|
|
3774
|
+
const value = input.facts[key];
|
|
3775
|
+
reads.set(key, value);
|
|
3776
|
+
return value;
|
|
3777
|
+
} });
|
|
3778
|
+
} finally {
|
|
3779
|
+
active = false;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
function nextCandidate(traversal, input, cursor) {
|
|
3783
|
+
const { matcher } = traversal;
|
|
3784
|
+
if (traversal.head === void 0 || traversal.head.node !== void 0 && traversal.head.node.start < cursor) {
|
|
3785
|
+
let next = matcher.queries[traversal.index + 1];
|
|
3786
|
+
while (next !== void 0 && next.from <= cursor) {
|
|
3787
|
+
traversal.index++;
|
|
3788
|
+
next = matcher.queries[traversal.index + 1];
|
|
3789
|
+
}
|
|
3790
|
+
const recorded = matcher.queries[traversal.index];
|
|
3791
|
+
if (recorded !== void 0 && (recorded.error !== void 0 ? recorded.from === cursor : recorded.node === void 0 || recorded.node.start >= cursor)) traversal.head = recorded;
|
|
3792
|
+
else {
|
|
3793
|
+
let node;
|
|
3794
|
+
let error;
|
|
3795
|
+
try {
|
|
3796
|
+
node = withFacts(input, matcher.reads, (context) => matcher.definition.match(input.text, cursor, context));
|
|
3797
|
+
if (node !== void 0) validateCandidate(input.text, matcher.definition.id, cursor, node);
|
|
3798
|
+
} catch (cause) {
|
|
3799
|
+
error = new UserTextTransformError(matcher.definition.id, cause);
|
|
3800
|
+
}
|
|
3801
|
+
traversal.head = {
|
|
3802
|
+
from: cursor,
|
|
3803
|
+
node,
|
|
3804
|
+
error
|
|
3805
|
+
};
|
|
3806
|
+
traversal.added.push(traversal.head);
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
if (traversal.head.error !== void 0) throw traversal.head.error;
|
|
3810
|
+
return traversal.head.node;
|
|
3811
|
+
}
|
|
3812
|
+
function validateCandidate(text, ruleId, from, node) {
|
|
3813
|
+
if (!Number.isInteger(node.start) || !Number.isInteger(node.end) || node.start < from || node.end <= node.start || node.end > text.length) throw new Error(`invalid candidate range [${node.start}, ${node.end}); expected a nonempty range from ${from} to ${text.length}`);
|
|
3814
|
+
if (node.id === "text") {
|
|
3815
|
+
if (node.data.text !== text.slice(node.start, node.end)) throw new Error("text candidate must preserve its original substring");
|
|
3816
|
+
} else if (node.id !== ruleId) throw new Error(`candidate must use rule ID "${ruleId}" or text`);
|
|
3817
|
+
}
|
|
3818
|
+
function mergeQueries(previous, added) {
|
|
3819
|
+
if (previous.length === 0) return added;
|
|
3820
|
+
const merged = [];
|
|
3821
|
+
const remaining = previous.values();
|
|
3822
|
+
let old = remaining.next().value;
|
|
3823
|
+
for (const query of added) {
|
|
3824
|
+
while (old !== void 0 && old.from < query.from) {
|
|
3825
|
+
merged.push(old);
|
|
3826
|
+
old = remaining.next().value;
|
|
3827
|
+
}
|
|
3828
|
+
merged.push(query);
|
|
3829
|
+
}
|
|
3830
|
+
while (old !== void 0) {
|
|
3831
|
+
merged.push(old);
|
|
3832
|
+
old = remaining.next().value;
|
|
3833
|
+
}
|
|
3834
|
+
return merged;
|
|
3835
|
+
}
|
|
3836
|
+
function textNode(text, start, end) {
|
|
3837
|
+
return {
|
|
3838
|
+
id: "text",
|
|
3839
|
+
start,
|
|
3840
|
+
end,
|
|
3841
|
+
data: { text: text.slice(start, end) }
|
|
3842
|
+
};
|
|
3843
|
+
}
|
|
3844
|
+
function alignNodes(output, previous, input) {
|
|
3845
|
+
let previousIndex = 0;
|
|
3846
|
+
let inputIndex = 0;
|
|
3847
|
+
let aligned;
|
|
3848
|
+
for (const [index, node] of output.entries()) {
|
|
3849
|
+
let inputNode = input[inputIndex];
|
|
3850
|
+
while (inputNode && inputNode.start < node.start) inputNode = input[++inputIndex];
|
|
3851
|
+
let previousNode = previous[previousIndex];
|
|
3852
|
+
while (previousNode && previousNode.start < node.start) previousNode = previous[++previousIndex];
|
|
3853
|
+
const reused = inputNode && equalNode(node, inputNode) ? inputNode : previousNode && equalNode(node, previousNode) ? previousNode : node;
|
|
3854
|
+
if (reused !== node && !aligned) aligned = output.slice(0, index);
|
|
3855
|
+
aligned?.push(reused);
|
|
3856
|
+
}
|
|
3857
|
+
const nodes = aligned ?? output;
|
|
3858
|
+
if (equalElements(nodes, previous)) return previous;
|
|
3859
|
+
return equalElements(nodes, input) ? input : nodes;
|
|
3860
|
+
}
|
|
3861
|
+
function equalElements(left, right) {
|
|
3862
|
+
return left === right || left.length === right.length && left.every((node, index) => node === right[index]);
|
|
3863
|
+
}
|
|
3864
|
+
function equalNode(left, right) {
|
|
3865
|
+
return Object.is(left, right) || left.id === right.id && left.start === right.start && left.end === right.end && equalJson(left.data, right.data);
|
|
3866
|
+
}
|
|
3867
|
+
function equalJson(left, right) {
|
|
3868
|
+
if (Object.is(left, right)) return true;
|
|
3869
|
+
if (left === null || right === null || typeof left !== "object" || typeof right !== "object") return false;
|
|
3870
|
+
if (Array.isArray(left) !== Array.isArray(right)) return false;
|
|
3871
|
+
const keys = Object.keys(left);
|
|
3872
|
+
if (keys.length !== Object.keys(right).length) return false;
|
|
3873
|
+
return keys.every((key) => Object.hasOwn(right, key) && equalJson(Reflect.get(left, key), Reflect.get(right, key)));
|
|
3874
|
+
}
|
|
3875
|
+
//#endregion
|
|
3876
|
+
//#region lib/types/client/conversation/user-text-registry.js
|
|
3877
|
+
/** Observable rule revision with no retained documents or document subscriptions. */
|
|
3878
|
+
var UserTextRegistry = class extends ConversationDefinitionRegistry {
|
|
3879
|
+
rules = [];
|
|
3880
|
+
revision = 0;
|
|
3881
|
+
/**
|
|
3882
|
+
* Register a uniquely named rule; invalid IDs, duplicate IDs and non-finite order throw before publication.
|
|
3883
|
+
* @param rule - readonly synchronous candidate matcher with a nonempty ID other than the reserved `text` ID.
|
|
3884
|
+
* @returns idempotent disposer; removal synchronously publishes a new revision.
|
|
3885
|
+
*/
|
|
3886
|
+
register(rule) {
|
|
3887
|
+
if (rule.id.length === 0) throw new Error("user-text rule ID must not be empty");
|
|
3888
|
+
if (rule.id === "text") throw new Error("user-text rule \"text\" is reserved for original text");
|
|
3889
|
+
if (!Number.isFinite(rule.order)) throw new Error(`user-text rule "${rule.id}" order must be finite`);
|
|
3890
|
+
return this.registerDefinition(rule.id, rule, `user-text rule "${rule.id}" is already registered`, `uiConversation.userText.register(${JSON.stringify(rule.id)})`);
|
|
3891
|
+
}
|
|
3892
|
+
/**
|
|
3893
|
+
* Create an independent document evaluator; it reads current rules at each call and never subscribes.
|
|
3894
|
+
* @returns callback owning its document cache, released when the caller releases the callback.
|
|
3895
|
+
*/
|
|
3896
|
+
createEvaluator() {
|
|
3897
|
+
const document = new UserTextDocument();
|
|
3898
|
+
return (input) => document.evaluate(input, this.rules);
|
|
3899
|
+
}
|
|
3900
|
+
/**
|
|
3901
|
+
* Read the observable rule revision.
|
|
3902
|
+
* @returns monotonic revision, stable until a successful registration or disposal.
|
|
3903
|
+
*/
|
|
3904
|
+
getSnapshot() {
|
|
3905
|
+
return this.revision;
|
|
3906
|
+
}
|
|
3907
|
+
refresh() {
|
|
3908
|
+
this.rules = [...this.definitions.values()].sort((a, b) => a.order - b.order || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
3909
|
+
this.revision++;
|
|
3910
|
+
super.refresh();
|
|
3911
|
+
}
|
|
3912
|
+
};
|
|
3913
|
+
//#endregion
|
|
3643
3914
|
//#region lib/types/client/conversation/assembly.js
|
|
3644
3915
|
/** Per-Session target-neutral Conversation assembly. */
|
|
3645
3916
|
var BoundConversation = class {
|
|
@@ -3758,6 +4029,8 @@ window.__ModuleLoader__.load({
|
|
|
3758
4029
|
views;
|
|
3759
4030
|
/** Business grouping rules over already materialized target Nodes. */
|
|
3760
4031
|
groups;
|
|
4032
|
+
/** Pure text rules and parser snapshots, independent of durable Session assembly. */
|
|
4033
|
+
userText;
|
|
3761
4034
|
bindings = new WeakMapWithValues();
|
|
3762
4035
|
images;
|
|
3763
4036
|
/**
|
|
@@ -3770,6 +4043,7 @@ window.__ModuleLoader__.load({
|
|
|
3770
4043
|
this.events = new ConversationEventRegistry(ctx);
|
|
3771
4044
|
this.views = new ConversationViewRegistry(ctx);
|
|
3772
4045
|
this.groups = new ConversationGroupRegistry(ctx, this.views);
|
|
4046
|
+
this.userText = new UserTextRegistry(ctx);
|
|
3773
4047
|
this.images = new HistoricalImageCache(ctx, sessions);
|
|
3774
4048
|
const rebuild = () => {
|
|
3775
4049
|
for (const record of this.bindings.values) record.binding.rebuild();
|
|
@@ -3876,4017 +4150,202 @@ window.__ModuleLoader__.load({
|
|
|
3876
4150
|
* @returns the canonical prompt snapshot and any model-visible change.
|
|
3877
4151
|
*/
|
|
3878
4152
|
inspectRequestPrompt(previous, event, system) {
|
|
3879
|
-
return inspectRequestPrompt(previous, event, system);
|
|
3880
|
-
}
|
|
3881
|
-
drop(record, releaseScope) {
|
|
3882
|
-
if (this.bindings.get(record.source) !== record) return;
|
|
3883
|
-
this.bindings.delete(record.source);
|
|
3884
|
-
record.binding.dispose();
|
|
3885
|
-
if (releaseScope) record.disposeScope();
|
|
3886
|
-
}
|
|
3887
|
-
};
|
|
3888
|
-
//#endregion
|
|
3889
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
3890
|
-
var _a$2;
|
|
3891
|
-
function $constructor(name, initializer, params) {
|
|
3892
|
-
function init(inst, def) {
|
|
3893
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
3894
|
-
value: {
|
|
3895
|
-
def,
|
|
3896
|
-
constr: _,
|
|
3897
|
-
traits: /* @__PURE__ */ new Set()
|
|
3898
|
-
},
|
|
3899
|
-
enumerable: false
|
|
3900
|
-
});
|
|
3901
|
-
if (inst._zod.traits.has(name)) return;
|
|
3902
|
-
inst._zod.traits.add(name);
|
|
3903
|
-
initializer(inst, def);
|
|
3904
|
-
const proto = _.prototype;
|
|
3905
|
-
const keys = Object.keys(proto);
|
|
3906
|
-
for (let i = 0; i < keys.length; i++) {
|
|
3907
|
-
const k = keys[i];
|
|
3908
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
|
-
const Parent = params?.Parent ?? Object;
|
|
3912
|
-
class Definition extends Parent {}
|
|
3913
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
3914
|
-
function _(def) {
|
|
3915
|
-
var _a;
|
|
3916
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
3917
|
-
init(inst, def);
|
|
3918
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
3919
|
-
for (const fn of inst._zod.deferred) fn();
|
|
3920
|
-
return inst;
|
|
3921
|
-
}
|
|
3922
|
-
Object.defineProperty(_, "init", { value: init });
|
|
3923
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
3924
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
3925
|
-
return inst?._zod?.traits?.has(name);
|
|
3926
|
-
} });
|
|
3927
|
-
Object.defineProperty(_, "name", { value: name });
|
|
3928
|
-
return _;
|
|
3929
|
-
}
|
|
3930
|
-
var $ZodAsyncError = class extends Error {
|
|
3931
|
-
constructor() {
|
|
3932
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
3933
|
-
}
|
|
3934
|
-
};
|
|
3935
|
-
var $ZodEncodeError = class extends Error {
|
|
3936
|
-
constructor(name) {
|
|
3937
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
3938
|
-
this.name = "ZodEncodeError";
|
|
3939
|
-
}
|
|
3940
|
-
};
|
|
3941
|
-
(_a$2 = globalThis).__zod_globalConfig ?? (_a$2.__zod_globalConfig = {});
|
|
3942
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
3943
|
-
function config(newConfig) {
|
|
3944
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
3945
|
-
return globalConfig;
|
|
3946
|
-
}
|
|
3947
|
-
//#endregion
|
|
3948
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
3949
|
-
function getEnumValues(entries) {
|
|
3950
|
-
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
3951
|
-
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
3952
|
-
}
|
|
3953
|
-
function jsonStringifyReplacer(_, value) {
|
|
3954
|
-
if (typeof value === "bigint") return value.toString();
|
|
3955
|
-
return value;
|
|
3956
|
-
}
|
|
3957
|
-
function cached(getter) {
|
|
3958
|
-
return { get value() {
|
|
3959
|
-
{
|
|
3960
|
-
const value = getter();
|
|
3961
|
-
Object.defineProperty(this, "value", { value });
|
|
3962
|
-
return value;
|
|
3963
|
-
}
|
|
3964
|
-
throw new Error("cached value already set");
|
|
3965
|
-
} };
|
|
3966
|
-
}
|
|
3967
|
-
function nullish(input) {
|
|
3968
|
-
return input === null || input === void 0;
|
|
3969
|
-
}
|
|
3970
|
-
function cleanRegex(source) {
|
|
3971
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
3972
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
3973
|
-
return source.slice(start, end);
|
|
3974
|
-
}
|
|
3975
|
-
function floatSafeRemainder(val, step) {
|
|
3976
|
-
const ratio = val / step;
|
|
3977
|
-
const roundedRatio = Math.round(ratio);
|
|
3978
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
3979
|
-
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
3980
|
-
return ratio - roundedRatio;
|
|
3981
|
-
}
|
|
3982
|
-
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
3983
|
-
function defineLazy(object, key, getter) {
|
|
3984
|
-
let value = void 0;
|
|
3985
|
-
Object.defineProperty(object, key, {
|
|
3986
|
-
get() {
|
|
3987
|
-
if (value === EVALUATING) return;
|
|
3988
|
-
if (value === void 0) {
|
|
3989
|
-
value = EVALUATING;
|
|
3990
|
-
value = getter();
|
|
3991
|
-
}
|
|
3992
|
-
return value;
|
|
3993
|
-
},
|
|
3994
|
-
set(v) {
|
|
3995
|
-
Object.defineProperty(object, key, { value: v });
|
|
3996
|
-
},
|
|
3997
|
-
configurable: true
|
|
3998
|
-
});
|
|
3999
|
-
}
|
|
4000
|
-
function assignProp(target, prop, value) {
|
|
4001
|
-
Object.defineProperty(target, prop, {
|
|
4002
|
-
value,
|
|
4003
|
-
writable: true,
|
|
4004
|
-
enumerable: true,
|
|
4005
|
-
configurable: true
|
|
4006
|
-
});
|
|
4007
|
-
}
|
|
4008
|
-
function mergeDefs(...defs) {
|
|
4009
|
-
const mergedDescriptors = {};
|
|
4010
|
-
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
4011
|
-
return Object.defineProperties({}, mergedDescriptors);
|
|
4012
|
-
}
|
|
4013
|
-
function esc(str) {
|
|
4014
|
-
return JSON.stringify(str);
|
|
4015
|
-
}
|
|
4016
|
-
function slugify(input) {
|
|
4017
|
-
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
4018
|
-
}
|
|
4019
|
-
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
4020
|
-
function isObject(data) {
|
|
4021
|
-
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
4022
|
-
}
|
|
4023
|
-
const allowsEval = /* @__PURE__*/ cached(() => {
|
|
4024
|
-
if (globalConfig.jitless) return false;
|
|
4025
|
-
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
4026
|
-
try {
|
|
4027
|
-
new Function("");
|
|
4028
|
-
return true;
|
|
4029
|
-
} catch (_) {
|
|
4030
|
-
return false;
|
|
4031
|
-
}
|
|
4032
|
-
});
|
|
4033
|
-
function isPlainObject(o) {
|
|
4034
|
-
if (isObject(o) === false) return false;
|
|
4035
|
-
const ctor = o.constructor;
|
|
4036
|
-
if (ctor === void 0) return true;
|
|
4037
|
-
if (typeof ctor !== "function") return true;
|
|
4038
|
-
const prot = ctor.prototype;
|
|
4039
|
-
if (isObject(prot) === false) return false;
|
|
4040
|
-
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
4041
|
-
return true;
|
|
4042
|
-
}
|
|
4043
|
-
function shallowClone(o) {
|
|
4044
|
-
if (isPlainObject(o)) return { ...o };
|
|
4045
|
-
if (Array.isArray(o)) return [...o];
|
|
4046
|
-
if (o instanceof Map) return new Map(o);
|
|
4047
|
-
if (o instanceof Set) return new Set(o);
|
|
4048
|
-
return o;
|
|
4049
|
-
}
|
|
4050
|
-
const propertyKeyTypes = /* @__PURE__*/ new Set([
|
|
4051
|
-
"string",
|
|
4052
|
-
"number",
|
|
4053
|
-
"symbol"
|
|
4054
|
-
]);
|
|
4055
|
-
function escapeRegex(str) {
|
|
4056
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4057
|
-
}
|
|
4058
|
-
function clone(inst, def, params) {
|
|
4059
|
-
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
4060
|
-
if (!def || params?.parent) cl._zod.parent = inst;
|
|
4061
|
-
return cl;
|
|
4062
|
-
}
|
|
4063
|
-
function normalizeParams(_params) {
|
|
4064
|
-
const params = _params;
|
|
4065
|
-
if (!params) return {};
|
|
4066
|
-
if (typeof params === "string") return { error: () => params };
|
|
4067
|
-
if (params?.message !== void 0) {
|
|
4068
|
-
if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
4069
|
-
params.error = params.message;
|
|
4070
|
-
}
|
|
4071
|
-
delete params.message;
|
|
4072
|
-
if (typeof params.error === "string") return {
|
|
4073
|
-
...params,
|
|
4074
|
-
error: () => params.error
|
|
4075
|
-
};
|
|
4076
|
-
return params;
|
|
4077
|
-
}
|
|
4078
|
-
function optionalKeys(shape) {
|
|
4079
|
-
return Object.keys(shape).filter((k) => {
|
|
4080
|
-
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
4081
|
-
});
|
|
4082
|
-
}
|
|
4083
|
-
const NUMBER_FORMAT_RANGES = {
|
|
4084
|
-
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
4085
|
-
int32: [-2147483648, 2147483647],
|
|
4086
|
-
uint32: [0, 4294967295],
|
|
4087
|
-
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
4088
|
-
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
4089
|
-
};
|
|
4090
|
-
function pick(schema, mask) {
|
|
4091
|
-
const currDef = schema._zod.def;
|
|
4092
|
-
const checks = currDef.checks;
|
|
4093
|
-
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
4094
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
4095
|
-
get shape() {
|
|
4096
|
-
const newShape = {};
|
|
4097
|
-
for (const key in mask) {
|
|
4098
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
4099
|
-
if (!mask[key]) continue;
|
|
4100
|
-
newShape[key] = currDef.shape[key];
|
|
4101
|
-
}
|
|
4102
|
-
assignProp(this, "shape", newShape);
|
|
4103
|
-
return newShape;
|
|
4104
|
-
},
|
|
4105
|
-
checks: []
|
|
4106
|
-
}));
|
|
4107
|
-
}
|
|
4108
|
-
function omit(schema, mask) {
|
|
4109
|
-
const currDef = schema._zod.def;
|
|
4110
|
-
const checks = currDef.checks;
|
|
4111
|
-
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
4112
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
4113
|
-
get shape() {
|
|
4114
|
-
const newShape = { ...schema._zod.def.shape };
|
|
4115
|
-
for (const key in mask) {
|
|
4116
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
4117
|
-
if (!mask[key]) continue;
|
|
4118
|
-
delete newShape[key];
|
|
4119
|
-
}
|
|
4120
|
-
assignProp(this, "shape", newShape);
|
|
4121
|
-
return newShape;
|
|
4122
|
-
},
|
|
4123
|
-
checks: []
|
|
4124
|
-
}));
|
|
4125
|
-
}
|
|
4126
|
-
function extend(schema, shape) {
|
|
4127
|
-
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
4128
|
-
const checks = schema._zod.def.checks;
|
|
4129
|
-
if (checks && checks.length > 0) {
|
|
4130
|
-
const existingShape = schema._zod.def.shape;
|
|
4131
|
-
for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
4132
|
-
}
|
|
4133
|
-
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
4134
|
-
const _shape = {
|
|
4135
|
-
...schema._zod.def.shape,
|
|
4136
|
-
...shape
|
|
4137
|
-
};
|
|
4138
|
-
assignProp(this, "shape", _shape);
|
|
4139
|
-
return _shape;
|
|
4140
|
-
} }));
|
|
4141
|
-
}
|
|
4142
|
-
function safeExtend(schema, shape) {
|
|
4143
|
-
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
4144
|
-
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
4145
|
-
const _shape = {
|
|
4146
|
-
...schema._zod.def.shape,
|
|
4147
|
-
...shape
|
|
4148
|
-
};
|
|
4149
|
-
assignProp(this, "shape", _shape);
|
|
4150
|
-
return _shape;
|
|
4151
|
-
} }));
|
|
4152
|
-
}
|
|
4153
|
-
function merge(a, b) {
|
|
4154
|
-
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
4155
|
-
return clone(a, mergeDefs(a._zod.def, {
|
|
4156
|
-
get shape() {
|
|
4157
|
-
const _shape = {
|
|
4158
|
-
...a._zod.def.shape,
|
|
4159
|
-
...b._zod.def.shape
|
|
4160
|
-
};
|
|
4161
|
-
assignProp(this, "shape", _shape);
|
|
4162
|
-
return _shape;
|
|
4163
|
-
},
|
|
4164
|
-
get catchall() {
|
|
4165
|
-
return b._zod.def.catchall;
|
|
4166
|
-
},
|
|
4167
|
-
checks: b._zod.def.checks ?? []
|
|
4168
|
-
}));
|
|
4169
|
-
}
|
|
4170
|
-
function partial(Class, schema, mask) {
|
|
4171
|
-
const checks = schema._zod.def.checks;
|
|
4172
|
-
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
4173
|
-
return clone(schema, mergeDefs(schema._zod.def, {
|
|
4174
|
-
get shape() {
|
|
4175
|
-
const oldShape = schema._zod.def.shape;
|
|
4176
|
-
const shape = { ...oldShape };
|
|
4177
|
-
if (mask) for (const key in mask) {
|
|
4178
|
-
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
4179
|
-
if (!mask[key]) continue;
|
|
4180
|
-
shape[key] = Class ? new Class({
|
|
4181
|
-
type: "optional",
|
|
4182
|
-
innerType: oldShape[key]
|
|
4183
|
-
}) : oldShape[key];
|
|
4184
|
-
}
|
|
4185
|
-
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
4186
|
-
type: "optional",
|
|
4187
|
-
innerType: oldShape[key]
|
|
4188
|
-
}) : oldShape[key];
|
|
4189
|
-
assignProp(this, "shape", shape);
|
|
4190
|
-
return shape;
|
|
4191
|
-
},
|
|
4192
|
-
checks: []
|
|
4193
|
-
}));
|
|
4194
|
-
}
|
|
4195
|
-
function required(Class, schema, mask) {
|
|
4196
|
-
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
4197
|
-
const oldShape = schema._zod.def.shape;
|
|
4198
|
-
const shape = { ...oldShape };
|
|
4199
|
-
if (mask) for (const key in mask) {
|
|
4200
|
-
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
4201
|
-
if (!mask[key]) continue;
|
|
4202
|
-
shape[key] = new Class({
|
|
4203
|
-
type: "nonoptional",
|
|
4204
|
-
innerType: oldShape[key]
|
|
4205
|
-
});
|
|
4206
|
-
}
|
|
4207
|
-
else for (const key in oldShape) shape[key] = new Class({
|
|
4208
|
-
type: "nonoptional",
|
|
4209
|
-
innerType: oldShape[key]
|
|
4210
|
-
});
|
|
4211
|
-
assignProp(this, "shape", shape);
|
|
4212
|
-
return shape;
|
|
4213
|
-
} }));
|
|
4214
|
-
}
|
|
4215
|
-
function aborted(x, startIndex = 0) {
|
|
4216
|
-
if (x.aborted === true) return true;
|
|
4217
|
-
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
4218
|
-
return false;
|
|
4219
|
-
}
|
|
4220
|
-
function explicitlyAborted(x, startIndex = 0) {
|
|
4221
|
-
if (x.aborted === true) return true;
|
|
4222
|
-
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
|
|
4223
|
-
return false;
|
|
4224
|
-
}
|
|
4225
|
-
function prefixIssues(path, issues) {
|
|
4226
|
-
return issues.map((iss) => {
|
|
4227
|
-
var _a;
|
|
4228
|
-
(_a = iss).path ?? (_a.path = []);
|
|
4229
|
-
iss.path.unshift(path);
|
|
4230
|
-
return iss;
|
|
4231
|
-
});
|
|
4232
|
-
}
|
|
4233
|
-
function unwrapMessage(message) {
|
|
4234
|
-
return typeof message === "string" ? message : message?.message;
|
|
4235
|
-
}
|
|
4236
|
-
function finalizeIssue(iss, ctx, config) {
|
|
4237
|
-
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
4238
|
-
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
4239
|
-
rest.path ?? (rest.path = []);
|
|
4240
|
-
rest.message = message;
|
|
4241
|
-
if (ctx?.reportInput) rest.input = _input;
|
|
4242
|
-
return rest;
|
|
4243
|
-
}
|
|
4244
|
-
function getLengthableOrigin(input) {
|
|
4245
|
-
if (Array.isArray(input)) return "array";
|
|
4246
|
-
if (typeof input === "string") return "string";
|
|
4247
|
-
return "unknown";
|
|
4248
|
-
}
|
|
4249
|
-
function issue(...args) {
|
|
4250
|
-
const [iss, input, inst] = args;
|
|
4251
|
-
if (typeof iss === "string") return {
|
|
4252
|
-
message: iss,
|
|
4253
|
-
code: "custom",
|
|
4254
|
-
input,
|
|
4255
|
-
inst
|
|
4256
|
-
};
|
|
4257
|
-
return { ...iss };
|
|
4258
|
-
}
|
|
4259
|
-
//#endregion
|
|
4260
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
|
|
4261
|
-
const initializer$1 = (inst, def) => {
|
|
4262
|
-
inst.name = "$ZodError";
|
|
4263
|
-
Object.defineProperty(inst, "_zod", {
|
|
4264
|
-
value: inst._zod,
|
|
4265
|
-
enumerable: false
|
|
4266
|
-
});
|
|
4267
|
-
Object.defineProperty(inst, "issues", {
|
|
4268
|
-
value: def,
|
|
4269
|
-
enumerable: false
|
|
4270
|
-
});
|
|
4271
|
-
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
4272
|
-
Object.defineProperty(inst, "toString", {
|
|
4273
|
-
value: () => inst.message,
|
|
4274
|
-
enumerable: false
|
|
4275
|
-
});
|
|
4276
|
-
};
|
|
4277
|
-
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
4278
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
4279
|
-
function flattenError(error, mapper = (issue) => issue.message) {
|
|
4280
|
-
const fieldErrors = {};
|
|
4281
|
-
const formErrors = [];
|
|
4282
|
-
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
4283
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
4284
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
4285
|
-
} else formErrors.push(mapper(sub));
|
|
4286
|
-
return {
|
|
4287
|
-
formErrors,
|
|
4288
|
-
fieldErrors
|
|
4289
|
-
};
|
|
4290
|
-
}
|
|
4291
|
-
function formatError(error, mapper = (issue) => issue.message) {
|
|
4292
|
-
const fieldErrors = { _errors: [] };
|
|
4293
|
-
const processError = (error, path = []) => {
|
|
4294
|
-
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
4295
|
-
else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
4296
|
-
else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
4297
|
-
else {
|
|
4298
|
-
const fullpath = [...path, ...issue.path];
|
|
4299
|
-
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
4300
|
-
else {
|
|
4301
|
-
let curr = fieldErrors;
|
|
4302
|
-
let i = 0;
|
|
4303
|
-
while (i < fullpath.length) {
|
|
4304
|
-
const el = fullpath[i];
|
|
4305
|
-
if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
4306
|
-
else {
|
|
4307
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
4308
|
-
curr[el]._errors.push(mapper(issue));
|
|
4309
|
-
}
|
|
4310
|
-
curr = curr[el];
|
|
4311
|
-
i++;
|
|
4312
|
-
}
|
|
4313
|
-
}
|
|
4314
|
-
}
|
|
4315
|
-
};
|
|
4316
|
-
processError(error);
|
|
4317
|
-
return fieldErrors;
|
|
4318
|
-
}
|
|
4319
|
-
//#endregion
|
|
4320
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
4321
|
-
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
4322
|
-
const ctx = _ctx ? {
|
|
4323
|
-
..._ctx,
|
|
4324
|
-
async: false
|
|
4325
|
-
} : { async: false };
|
|
4326
|
-
const result = schema._zod.run({
|
|
4327
|
-
value,
|
|
4328
|
-
issues: []
|
|
4329
|
-
}, ctx);
|
|
4330
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
4331
|
-
if (result.issues.length) {
|
|
4332
|
-
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
4333
|
-
captureStackTrace(e, _params?.callee);
|
|
4334
|
-
throw e;
|
|
4335
|
-
}
|
|
4336
|
-
return result.value;
|
|
4337
|
-
};
|
|
4338
|
-
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
4339
|
-
const ctx = _ctx ? {
|
|
4340
|
-
..._ctx,
|
|
4341
|
-
async: true
|
|
4342
|
-
} : { async: true };
|
|
4343
|
-
let result = schema._zod.run({
|
|
4344
|
-
value,
|
|
4345
|
-
issues: []
|
|
4346
|
-
}, ctx);
|
|
4347
|
-
if (result instanceof Promise) result = await result;
|
|
4348
|
-
if (result.issues.length) {
|
|
4349
|
-
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
4350
|
-
captureStackTrace(e, params?.callee);
|
|
4351
|
-
throw e;
|
|
4352
|
-
}
|
|
4353
|
-
return result.value;
|
|
4354
|
-
};
|
|
4355
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
4356
|
-
const ctx = _ctx ? {
|
|
4357
|
-
..._ctx,
|
|
4358
|
-
async: false
|
|
4359
|
-
} : { async: false };
|
|
4360
|
-
const result = schema._zod.run({
|
|
4361
|
-
value,
|
|
4362
|
-
issues: []
|
|
4363
|
-
}, ctx);
|
|
4364
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
4365
|
-
return result.issues.length ? {
|
|
4366
|
-
success: false,
|
|
4367
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
4368
|
-
} : {
|
|
4369
|
-
success: true,
|
|
4370
|
-
data: result.value
|
|
4371
|
-
};
|
|
4372
|
-
};
|
|
4373
|
-
const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
4374
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4375
|
-
const ctx = _ctx ? {
|
|
4376
|
-
..._ctx,
|
|
4377
|
-
async: true
|
|
4378
|
-
} : { async: true };
|
|
4379
|
-
let result = schema._zod.run({
|
|
4380
|
-
value,
|
|
4381
|
-
issues: []
|
|
4382
|
-
}, ctx);
|
|
4383
|
-
if (result instanceof Promise) result = await result;
|
|
4384
|
-
return result.issues.length ? {
|
|
4385
|
-
success: false,
|
|
4386
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
4387
|
-
} : {
|
|
4388
|
-
success: true,
|
|
4389
|
-
data: result.value
|
|
4390
|
-
};
|
|
4391
|
-
};
|
|
4392
|
-
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
4393
|
-
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
4394
|
-
const ctx = _ctx ? {
|
|
4395
|
-
..._ctx,
|
|
4396
|
-
direction: "backward"
|
|
4397
|
-
} : { direction: "backward" };
|
|
4398
|
-
return _parse(_Err)(schema, value, ctx);
|
|
4399
|
-
};
|
|
4400
|
-
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
4401
|
-
return _parse(_Err)(schema, value, _ctx);
|
|
4402
|
-
};
|
|
4403
|
-
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4404
|
-
const ctx = _ctx ? {
|
|
4405
|
-
..._ctx,
|
|
4406
|
-
direction: "backward"
|
|
4407
|
-
} : { direction: "backward" };
|
|
4408
|
-
return _parseAsync(_Err)(schema, value, ctx);
|
|
4409
|
-
};
|
|
4410
|
-
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4411
|
-
return _parseAsync(_Err)(schema, value, _ctx);
|
|
4412
|
-
};
|
|
4413
|
-
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
4414
|
-
const ctx = _ctx ? {
|
|
4415
|
-
..._ctx,
|
|
4416
|
-
direction: "backward"
|
|
4417
|
-
} : { direction: "backward" };
|
|
4418
|
-
return _safeParse(_Err)(schema, value, ctx);
|
|
4419
|
-
};
|
|
4420
|
-
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
4421
|
-
return _safeParse(_Err)(schema, value, _ctx);
|
|
4422
|
-
};
|
|
4423
|
-
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4424
|
-
const ctx = _ctx ? {
|
|
4425
|
-
..._ctx,
|
|
4426
|
-
direction: "backward"
|
|
4427
|
-
} : { direction: "backward" };
|
|
4428
|
-
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
4429
|
-
};
|
|
4430
|
-
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
4431
|
-
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
4432
|
-
};
|
|
4433
|
-
//#endregion
|
|
4434
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
|
|
4435
|
-
/**
|
|
4436
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
4437
|
-
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
4438
|
-
* See https://github.com/paralleldrive/cuid.
|
|
4439
|
-
*/
|
|
4440
|
-
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
4441
|
-
const cuid2 = /^[0-9a-z]+$/;
|
|
4442
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
4443
|
-
const xid = /^[0-9a-vA-V]{20}$/;
|
|
4444
|
-
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
4445
|
-
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
4446
|
-
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
4447
|
-
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
4448
|
-
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
4449
|
-
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
4450
|
-
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
4451
|
-
*
|
|
4452
|
-
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
4453
|
-
const uuid = (version) => {
|
|
4454
|
-
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
4455
|
-
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
4456
|
-
};
|
|
4457
|
-
/** Practical email validation */
|
|
4458
|
-
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
4459
|
-
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
4460
|
-
function emoji() {
|
|
4461
|
-
return new RegExp(_emoji$1, "u");
|
|
4462
|
-
}
|
|
4463
|
-
const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
4464
|
-
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
4465
|
-
const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
4466
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
4467
|
-
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
4468
|
-
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
4469
|
-
const httpProtocol = /^https?$/;
|
|
4470
|
-
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
4471
|
-
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
4472
|
-
const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
4473
|
-
function timeSource(args) {
|
|
4474
|
-
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
4475
|
-
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
4476
|
-
}
|
|
4477
|
-
function time$1(args) {
|
|
4478
|
-
return new RegExp(`^${timeSource(args)}$`);
|
|
4479
|
-
}
|
|
4480
|
-
function datetime$1(args) {
|
|
4481
|
-
const time = timeSource({ precision: args.precision });
|
|
4482
|
-
const opts = ["Z"];
|
|
4483
|
-
if (args.local) opts.push("");
|
|
4484
|
-
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
4485
|
-
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
4486
|
-
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
4487
|
-
}
|
|
4488
|
-
const string$1 = (params) => {
|
|
4489
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
4490
|
-
return new RegExp(`^${regex}$`);
|
|
4491
|
-
};
|
|
4492
|
-
const integer = /^-?\d+$/;
|
|
4493
|
-
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
4494
|
-
const boolean$1 = /^(?:true|false)$/i;
|
|
4495
|
-
const lowercase = /^[^A-Z]*$/;
|
|
4496
|
-
const uppercase = /^[^a-z]*$/;
|
|
4497
|
-
//#endregion
|
|
4498
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
|
|
4499
|
-
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
4500
|
-
var _a;
|
|
4501
|
-
inst._zod ?? (inst._zod = {});
|
|
4502
|
-
inst._zod.def = def;
|
|
4503
|
-
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
4504
|
-
});
|
|
4505
|
-
const numericOriginMap = {
|
|
4506
|
-
number: "number",
|
|
4507
|
-
bigint: "bigint",
|
|
4508
|
-
object: "date"
|
|
4509
|
-
};
|
|
4510
|
-
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
4511
|
-
$ZodCheck.init(inst, def);
|
|
4512
|
-
const origin = numericOriginMap[typeof def.value];
|
|
4513
|
-
inst._zod.onattach.push((inst) => {
|
|
4514
|
-
const bag = inst._zod.bag;
|
|
4515
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
4516
|
-
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
4517
|
-
else bag.exclusiveMaximum = def.value;
|
|
4518
|
-
});
|
|
4519
|
-
inst._zod.check = (payload) => {
|
|
4520
|
-
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
4521
|
-
payload.issues.push({
|
|
4522
|
-
origin,
|
|
4523
|
-
code: "too_big",
|
|
4524
|
-
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
4525
|
-
input: payload.value,
|
|
4526
|
-
inclusive: def.inclusive,
|
|
4527
|
-
inst,
|
|
4528
|
-
continue: !def.abort
|
|
4529
|
-
});
|
|
4530
|
-
};
|
|
4531
|
-
});
|
|
4532
|
-
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
4533
|
-
$ZodCheck.init(inst, def);
|
|
4534
|
-
const origin = numericOriginMap[typeof def.value];
|
|
4535
|
-
inst._zod.onattach.push((inst) => {
|
|
4536
|
-
const bag = inst._zod.bag;
|
|
4537
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
4538
|
-
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
4539
|
-
else bag.exclusiveMinimum = def.value;
|
|
4540
|
-
});
|
|
4541
|
-
inst._zod.check = (payload) => {
|
|
4542
|
-
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
4543
|
-
payload.issues.push({
|
|
4544
|
-
origin,
|
|
4545
|
-
code: "too_small",
|
|
4546
|
-
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
4547
|
-
input: payload.value,
|
|
4548
|
-
inclusive: def.inclusive,
|
|
4549
|
-
inst,
|
|
4550
|
-
continue: !def.abort
|
|
4551
|
-
});
|
|
4552
|
-
};
|
|
4553
|
-
});
|
|
4554
|
-
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
4555
|
-
$ZodCheck.init(inst, def);
|
|
4556
|
-
inst._zod.onattach.push((inst) => {
|
|
4557
|
-
var _a;
|
|
4558
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
4559
|
-
});
|
|
4560
|
-
inst._zod.check = (payload) => {
|
|
4561
|
-
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
4562
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
4563
|
-
payload.issues.push({
|
|
4564
|
-
origin: typeof payload.value,
|
|
4565
|
-
code: "not_multiple_of",
|
|
4566
|
-
divisor: def.value,
|
|
4567
|
-
input: payload.value,
|
|
4568
|
-
inst,
|
|
4569
|
-
continue: !def.abort
|
|
4570
|
-
});
|
|
4571
|
-
};
|
|
4572
|
-
});
|
|
4573
|
-
const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
4574
|
-
$ZodCheck.init(inst, def);
|
|
4575
|
-
def.format = def.format || "float64";
|
|
4576
|
-
const isInt = def.format?.includes("int");
|
|
4577
|
-
const origin = isInt ? "int" : "number";
|
|
4578
|
-
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
4579
|
-
inst._zod.onattach.push((inst) => {
|
|
4580
|
-
const bag = inst._zod.bag;
|
|
4581
|
-
bag.format = def.format;
|
|
4582
|
-
bag.minimum = minimum;
|
|
4583
|
-
bag.maximum = maximum;
|
|
4584
|
-
if (isInt) bag.pattern = integer;
|
|
4585
|
-
});
|
|
4586
|
-
inst._zod.check = (payload) => {
|
|
4587
|
-
const input = payload.value;
|
|
4588
|
-
if (isInt) {
|
|
4589
|
-
if (!Number.isInteger(input)) {
|
|
4590
|
-
payload.issues.push({
|
|
4591
|
-
expected: origin,
|
|
4592
|
-
format: def.format,
|
|
4593
|
-
code: "invalid_type",
|
|
4594
|
-
continue: false,
|
|
4595
|
-
input,
|
|
4596
|
-
inst
|
|
4597
|
-
});
|
|
4598
|
-
return;
|
|
4599
|
-
}
|
|
4600
|
-
if (!Number.isSafeInteger(input)) {
|
|
4601
|
-
if (input > 0) payload.issues.push({
|
|
4602
|
-
input,
|
|
4603
|
-
code: "too_big",
|
|
4604
|
-
maximum: Number.MAX_SAFE_INTEGER,
|
|
4605
|
-
note: "Integers must be within the safe integer range.",
|
|
4606
|
-
inst,
|
|
4607
|
-
origin,
|
|
4608
|
-
inclusive: true,
|
|
4609
|
-
continue: !def.abort
|
|
4610
|
-
});
|
|
4611
|
-
else payload.issues.push({
|
|
4612
|
-
input,
|
|
4613
|
-
code: "too_small",
|
|
4614
|
-
minimum: Number.MIN_SAFE_INTEGER,
|
|
4615
|
-
note: "Integers must be within the safe integer range.",
|
|
4616
|
-
inst,
|
|
4617
|
-
origin,
|
|
4618
|
-
inclusive: true,
|
|
4619
|
-
continue: !def.abort
|
|
4620
|
-
});
|
|
4621
|
-
return;
|
|
4622
|
-
}
|
|
4623
|
-
}
|
|
4624
|
-
if (input < minimum) payload.issues.push({
|
|
4625
|
-
origin: "number",
|
|
4626
|
-
input,
|
|
4627
|
-
code: "too_small",
|
|
4628
|
-
minimum,
|
|
4629
|
-
inclusive: true,
|
|
4630
|
-
inst,
|
|
4631
|
-
continue: !def.abort
|
|
4632
|
-
});
|
|
4633
|
-
if (input > maximum) payload.issues.push({
|
|
4634
|
-
origin: "number",
|
|
4635
|
-
input,
|
|
4636
|
-
code: "too_big",
|
|
4637
|
-
maximum,
|
|
4638
|
-
inclusive: true,
|
|
4639
|
-
inst,
|
|
4640
|
-
continue: !def.abort
|
|
4641
|
-
});
|
|
4642
|
-
};
|
|
4643
|
-
});
|
|
4644
|
-
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
4645
|
-
var _a;
|
|
4646
|
-
$ZodCheck.init(inst, def);
|
|
4647
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
4648
|
-
const val = payload.value;
|
|
4649
|
-
return !nullish(val) && val.length !== void 0;
|
|
4650
|
-
});
|
|
4651
|
-
inst._zod.onattach.push((inst) => {
|
|
4652
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
4653
|
-
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
4654
|
-
});
|
|
4655
|
-
inst._zod.check = (payload) => {
|
|
4656
|
-
const input = payload.value;
|
|
4657
|
-
if (input.length <= def.maximum) return;
|
|
4658
|
-
const origin = getLengthableOrigin(input);
|
|
4659
|
-
payload.issues.push({
|
|
4660
|
-
origin,
|
|
4661
|
-
code: "too_big",
|
|
4662
|
-
maximum: def.maximum,
|
|
4663
|
-
inclusive: true,
|
|
4664
|
-
input,
|
|
4665
|
-
inst,
|
|
4666
|
-
continue: !def.abort
|
|
4667
|
-
});
|
|
4668
|
-
};
|
|
4669
|
-
});
|
|
4670
|
-
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
4671
|
-
var _a;
|
|
4672
|
-
$ZodCheck.init(inst, def);
|
|
4673
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
4674
|
-
const val = payload.value;
|
|
4675
|
-
return !nullish(val) && val.length !== void 0;
|
|
4676
|
-
});
|
|
4677
|
-
inst._zod.onattach.push((inst) => {
|
|
4678
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
4679
|
-
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
4680
|
-
});
|
|
4681
|
-
inst._zod.check = (payload) => {
|
|
4682
|
-
const input = payload.value;
|
|
4683
|
-
if (input.length >= def.minimum) return;
|
|
4684
|
-
const origin = getLengthableOrigin(input);
|
|
4685
|
-
payload.issues.push({
|
|
4686
|
-
origin,
|
|
4687
|
-
code: "too_small",
|
|
4688
|
-
minimum: def.minimum,
|
|
4689
|
-
inclusive: true,
|
|
4690
|
-
input,
|
|
4691
|
-
inst,
|
|
4692
|
-
continue: !def.abort
|
|
4693
|
-
});
|
|
4694
|
-
};
|
|
4695
|
-
});
|
|
4696
|
-
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
4697
|
-
var _a;
|
|
4698
|
-
$ZodCheck.init(inst, def);
|
|
4699
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
4700
|
-
const val = payload.value;
|
|
4701
|
-
return !nullish(val) && val.length !== void 0;
|
|
4702
|
-
});
|
|
4703
|
-
inst._zod.onattach.push((inst) => {
|
|
4704
|
-
const bag = inst._zod.bag;
|
|
4705
|
-
bag.minimum = def.length;
|
|
4706
|
-
bag.maximum = def.length;
|
|
4707
|
-
bag.length = def.length;
|
|
4708
|
-
});
|
|
4709
|
-
inst._zod.check = (payload) => {
|
|
4710
|
-
const input = payload.value;
|
|
4711
|
-
const length = input.length;
|
|
4712
|
-
if (length === def.length) return;
|
|
4713
|
-
const origin = getLengthableOrigin(input);
|
|
4714
|
-
const tooBig = length > def.length;
|
|
4715
|
-
payload.issues.push({
|
|
4716
|
-
origin,
|
|
4717
|
-
...tooBig ? {
|
|
4718
|
-
code: "too_big",
|
|
4719
|
-
maximum: def.length
|
|
4720
|
-
} : {
|
|
4721
|
-
code: "too_small",
|
|
4722
|
-
minimum: def.length
|
|
4723
|
-
},
|
|
4724
|
-
inclusive: true,
|
|
4725
|
-
exact: true,
|
|
4726
|
-
input: payload.value,
|
|
4727
|
-
inst,
|
|
4728
|
-
continue: !def.abort
|
|
4729
|
-
});
|
|
4730
|
-
};
|
|
4731
|
-
});
|
|
4732
|
-
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
4733
|
-
var _a, _b;
|
|
4734
|
-
$ZodCheck.init(inst, def);
|
|
4735
|
-
inst._zod.onattach.push((inst) => {
|
|
4736
|
-
const bag = inst._zod.bag;
|
|
4737
|
-
bag.format = def.format;
|
|
4738
|
-
if (def.pattern) {
|
|
4739
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
4740
|
-
bag.patterns.add(def.pattern);
|
|
4741
|
-
}
|
|
4742
|
-
});
|
|
4743
|
-
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
4744
|
-
def.pattern.lastIndex = 0;
|
|
4745
|
-
if (def.pattern.test(payload.value)) return;
|
|
4746
|
-
payload.issues.push({
|
|
4747
|
-
origin: "string",
|
|
4748
|
-
code: "invalid_format",
|
|
4749
|
-
format: def.format,
|
|
4750
|
-
input: payload.value,
|
|
4751
|
-
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
4752
|
-
inst,
|
|
4753
|
-
continue: !def.abort
|
|
4754
|
-
});
|
|
4755
|
-
});
|
|
4756
|
-
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
4757
|
-
});
|
|
4758
|
-
const $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
4759
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
4760
|
-
inst._zod.check = (payload) => {
|
|
4761
|
-
def.pattern.lastIndex = 0;
|
|
4762
|
-
if (def.pattern.test(payload.value)) return;
|
|
4763
|
-
payload.issues.push({
|
|
4764
|
-
origin: "string",
|
|
4765
|
-
code: "invalid_format",
|
|
4766
|
-
format: "regex",
|
|
4767
|
-
input: payload.value,
|
|
4768
|
-
pattern: def.pattern.toString(),
|
|
4769
|
-
inst,
|
|
4770
|
-
continue: !def.abort
|
|
4771
|
-
});
|
|
4772
|
-
};
|
|
4773
|
-
});
|
|
4774
|
-
const $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
4775
|
-
def.pattern ?? (def.pattern = lowercase);
|
|
4776
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
4777
|
-
});
|
|
4778
|
-
const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
4779
|
-
def.pattern ?? (def.pattern = uppercase);
|
|
4780
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
4781
|
-
});
|
|
4782
|
-
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
4783
|
-
$ZodCheck.init(inst, def);
|
|
4784
|
-
const escapedRegex = escapeRegex(def.includes);
|
|
4785
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
4786
|
-
def.pattern = pattern;
|
|
4787
|
-
inst._zod.onattach.push((inst) => {
|
|
4788
|
-
const bag = inst._zod.bag;
|
|
4789
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
4790
|
-
bag.patterns.add(pattern);
|
|
4791
|
-
});
|
|
4792
|
-
inst._zod.check = (payload) => {
|
|
4793
|
-
if (payload.value.includes(def.includes, def.position)) return;
|
|
4794
|
-
payload.issues.push({
|
|
4795
|
-
origin: "string",
|
|
4796
|
-
code: "invalid_format",
|
|
4797
|
-
format: "includes",
|
|
4798
|
-
includes: def.includes,
|
|
4799
|
-
input: payload.value,
|
|
4800
|
-
inst,
|
|
4801
|
-
continue: !def.abort
|
|
4802
|
-
});
|
|
4803
|
-
};
|
|
4804
|
-
});
|
|
4805
|
-
const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
4806
|
-
$ZodCheck.init(inst, def);
|
|
4807
|
-
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
4808
|
-
def.pattern ?? (def.pattern = pattern);
|
|
4809
|
-
inst._zod.onattach.push((inst) => {
|
|
4810
|
-
const bag = inst._zod.bag;
|
|
4811
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
4812
|
-
bag.patterns.add(pattern);
|
|
4813
|
-
});
|
|
4814
|
-
inst._zod.check = (payload) => {
|
|
4815
|
-
if (payload.value.startsWith(def.prefix)) return;
|
|
4816
|
-
payload.issues.push({
|
|
4817
|
-
origin: "string",
|
|
4818
|
-
code: "invalid_format",
|
|
4819
|
-
format: "starts_with",
|
|
4820
|
-
prefix: def.prefix,
|
|
4821
|
-
input: payload.value,
|
|
4822
|
-
inst,
|
|
4823
|
-
continue: !def.abort
|
|
4824
|
-
});
|
|
4825
|
-
};
|
|
4826
|
-
});
|
|
4827
|
-
const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
4828
|
-
$ZodCheck.init(inst, def);
|
|
4829
|
-
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
4830
|
-
def.pattern ?? (def.pattern = pattern);
|
|
4831
|
-
inst._zod.onattach.push((inst) => {
|
|
4832
|
-
const bag = inst._zod.bag;
|
|
4833
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
4834
|
-
bag.patterns.add(pattern);
|
|
4835
|
-
});
|
|
4836
|
-
inst._zod.check = (payload) => {
|
|
4837
|
-
if (payload.value.endsWith(def.suffix)) return;
|
|
4838
|
-
payload.issues.push({
|
|
4839
|
-
origin: "string",
|
|
4840
|
-
code: "invalid_format",
|
|
4841
|
-
format: "ends_with",
|
|
4842
|
-
suffix: def.suffix,
|
|
4843
|
-
input: payload.value,
|
|
4844
|
-
inst,
|
|
4845
|
-
continue: !def.abort
|
|
4846
|
-
});
|
|
4847
|
-
};
|
|
4848
|
-
});
|
|
4849
|
-
const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
4850
|
-
$ZodCheck.init(inst, def);
|
|
4851
|
-
inst._zod.check = (payload) => {
|
|
4852
|
-
payload.value = def.tx(payload.value);
|
|
4853
|
-
};
|
|
4854
|
-
});
|
|
4855
|
-
//#endregion
|
|
4856
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
|
|
4857
|
-
var Doc = class {
|
|
4858
|
-
constructor(args = []) {
|
|
4859
|
-
this.content = [];
|
|
4860
|
-
this.indent = 0;
|
|
4861
|
-
if (this) this.args = args;
|
|
4862
|
-
}
|
|
4863
|
-
indented(fn) {
|
|
4864
|
-
this.indent += 1;
|
|
4865
|
-
fn(this);
|
|
4866
|
-
this.indent -= 1;
|
|
4867
|
-
}
|
|
4868
|
-
write(arg) {
|
|
4869
|
-
if (typeof arg === "function") {
|
|
4870
|
-
arg(this, { execution: "sync" });
|
|
4871
|
-
arg(this, { execution: "async" });
|
|
4872
|
-
return;
|
|
4873
|
-
}
|
|
4874
|
-
const lines = arg.split("\n").filter((x) => x);
|
|
4875
|
-
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
4876
|
-
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
4877
|
-
for (const line of dedented) this.content.push(line);
|
|
4878
|
-
}
|
|
4879
|
-
compile() {
|
|
4880
|
-
const F = Function;
|
|
4881
|
-
const args = this?.args;
|
|
4882
|
-
const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
|
|
4883
|
-
return new F(...args, lines.join("\n"));
|
|
4884
|
-
}
|
|
4885
|
-
};
|
|
4886
|
-
//#endregion
|
|
4887
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
|
|
4888
|
-
const version = {
|
|
4889
|
-
major: 4,
|
|
4890
|
-
minor: 4,
|
|
4891
|
-
patch: 3
|
|
4892
|
-
};
|
|
4893
|
-
//#endregion
|
|
4894
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
|
|
4895
|
-
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
4896
|
-
var _a;
|
|
4897
|
-
inst ?? (inst = {});
|
|
4898
|
-
inst._zod.def = def;
|
|
4899
|
-
inst._zod.bag = inst._zod.bag || {};
|
|
4900
|
-
inst._zod.version = version;
|
|
4901
|
-
const checks = [...inst._zod.def.checks ?? []];
|
|
4902
|
-
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
4903
|
-
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
4904
|
-
if (checks.length === 0) {
|
|
4905
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
4906
|
-
inst._zod.deferred?.push(() => {
|
|
4907
|
-
inst._zod.run = inst._zod.parse;
|
|
4908
|
-
});
|
|
4909
|
-
} else {
|
|
4910
|
-
const runChecks = (payload, checks, ctx) => {
|
|
4911
|
-
let isAborted = aborted(payload);
|
|
4912
|
-
let asyncResult;
|
|
4913
|
-
for (const ch of checks) {
|
|
4914
|
-
if (ch._zod.def.when) {
|
|
4915
|
-
if (explicitlyAborted(payload)) continue;
|
|
4916
|
-
if (!ch._zod.def.when(payload)) continue;
|
|
4917
|
-
} else if (isAborted) continue;
|
|
4918
|
-
const currLen = payload.issues.length;
|
|
4919
|
-
const _ = ch._zod.check(payload);
|
|
4920
|
-
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
4921
|
-
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
4922
|
-
await _;
|
|
4923
|
-
if (payload.issues.length === currLen) return;
|
|
4924
|
-
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
4925
|
-
});
|
|
4926
|
-
else {
|
|
4927
|
-
if (payload.issues.length === currLen) continue;
|
|
4928
|
-
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
4929
|
-
}
|
|
4930
|
-
}
|
|
4931
|
-
if (asyncResult) return asyncResult.then(() => {
|
|
4932
|
-
return payload;
|
|
4933
|
-
});
|
|
4934
|
-
return payload;
|
|
4935
|
-
};
|
|
4936
|
-
const handleCanaryResult = (canary, payload, ctx) => {
|
|
4937
|
-
if (aborted(canary)) {
|
|
4938
|
-
canary.aborted = true;
|
|
4939
|
-
return canary;
|
|
4940
|
-
}
|
|
4941
|
-
const checkResult = runChecks(payload, checks, ctx);
|
|
4942
|
-
if (checkResult instanceof Promise) {
|
|
4943
|
-
if (ctx.async === false) throw new $ZodAsyncError();
|
|
4944
|
-
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
4945
|
-
}
|
|
4946
|
-
return inst._zod.parse(checkResult, ctx);
|
|
4947
|
-
};
|
|
4948
|
-
inst._zod.run = (payload, ctx) => {
|
|
4949
|
-
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
4950
|
-
if (ctx.direction === "backward") {
|
|
4951
|
-
const canary = inst._zod.parse({
|
|
4952
|
-
value: payload.value,
|
|
4953
|
-
issues: []
|
|
4954
|
-
}, {
|
|
4955
|
-
...ctx,
|
|
4956
|
-
skipChecks: true
|
|
4957
|
-
});
|
|
4958
|
-
if (canary instanceof Promise) return canary.then((canary) => {
|
|
4959
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
4960
|
-
});
|
|
4961
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
4962
|
-
}
|
|
4963
|
-
const result = inst._zod.parse(payload, ctx);
|
|
4964
|
-
if (result instanceof Promise) {
|
|
4965
|
-
if (ctx.async === false) throw new $ZodAsyncError();
|
|
4966
|
-
return result.then((result) => runChecks(result, checks, ctx));
|
|
4967
|
-
}
|
|
4968
|
-
return runChecks(result, checks, ctx);
|
|
4969
|
-
};
|
|
4970
|
-
}
|
|
4971
|
-
defineLazy(inst, "~standard", () => ({
|
|
4972
|
-
validate: (value) => {
|
|
4973
|
-
try {
|
|
4974
|
-
const r = safeParse$1(inst, value);
|
|
4975
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
4976
|
-
} catch (_) {
|
|
4977
|
-
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
4978
|
-
}
|
|
4979
|
-
},
|
|
4980
|
-
vendor: "zod",
|
|
4981
|
-
version: 1
|
|
4982
|
-
}));
|
|
4983
|
-
});
|
|
4984
|
-
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
4985
|
-
$ZodType.init(inst, def);
|
|
4986
|
-
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
4987
|
-
inst._zod.parse = (payload, _) => {
|
|
4988
|
-
if (def.coerce) try {
|
|
4989
|
-
payload.value = String(payload.value);
|
|
4990
|
-
} catch (_) {}
|
|
4991
|
-
if (typeof payload.value === "string") return payload;
|
|
4992
|
-
payload.issues.push({
|
|
4993
|
-
expected: "string",
|
|
4994
|
-
code: "invalid_type",
|
|
4995
|
-
input: payload.value,
|
|
4996
|
-
inst
|
|
4997
|
-
});
|
|
4998
|
-
return payload;
|
|
4999
|
-
};
|
|
5000
|
-
});
|
|
5001
|
-
const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
|
|
5002
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
5003
|
-
$ZodString.init(inst, def);
|
|
5004
|
-
});
|
|
5005
|
-
const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => {
|
|
5006
|
-
def.pattern ?? (def.pattern = guid);
|
|
5007
|
-
$ZodStringFormat.init(inst, def);
|
|
5008
|
-
});
|
|
5009
|
-
const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
|
|
5010
|
-
if (def.version) {
|
|
5011
|
-
const v = {
|
|
5012
|
-
v1: 1,
|
|
5013
|
-
v2: 2,
|
|
5014
|
-
v3: 3,
|
|
5015
|
-
v4: 4,
|
|
5016
|
-
v5: 5,
|
|
5017
|
-
v6: 6,
|
|
5018
|
-
v7: 7,
|
|
5019
|
-
v8: 8
|
|
5020
|
-
}[def.version];
|
|
5021
|
-
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
5022
|
-
def.pattern ?? (def.pattern = uuid(v));
|
|
5023
|
-
} else def.pattern ?? (def.pattern = uuid());
|
|
5024
|
-
$ZodStringFormat.init(inst, def);
|
|
5025
|
-
});
|
|
5026
|
-
const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
5027
|
-
def.pattern ?? (def.pattern = email);
|
|
5028
|
-
$ZodStringFormat.init(inst, def);
|
|
5029
|
-
});
|
|
5030
|
-
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
5031
|
-
$ZodStringFormat.init(inst, def);
|
|
5032
|
-
inst._zod.check = (payload) => {
|
|
5033
|
-
try {
|
|
5034
|
-
const trimmed = payload.value.trim();
|
|
5035
|
-
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
5036
|
-
if (!/^https?:\/\//i.test(trimmed)) {
|
|
5037
|
-
payload.issues.push({
|
|
5038
|
-
code: "invalid_format",
|
|
5039
|
-
format: "url",
|
|
5040
|
-
note: "Invalid URL format",
|
|
5041
|
-
input: payload.value,
|
|
5042
|
-
inst,
|
|
5043
|
-
continue: !def.abort
|
|
5044
|
-
});
|
|
5045
|
-
return;
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
const url = new URL(trimmed);
|
|
5049
|
-
if (def.hostname) {
|
|
5050
|
-
def.hostname.lastIndex = 0;
|
|
5051
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
5052
|
-
code: "invalid_format",
|
|
5053
|
-
format: "url",
|
|
5054
|
-
note: "Invalid hostname",
|
|
5055
|
-
pattern: def.hostname.source,
|
|
5056
|
-
input: payload.value,
|
|
5057
|
-
inst,
|
|
5058
|
-
continue: !def.abort
|
|
5059
|
-
});
|
|
5060
|
-
}
|
|
5061
|
-
if (def.protocol) {
|
|
5062
|
-
def.protocol.lastIndex = 0;
|
|
5063
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
5064
|
-
code: "invalid_format",
|
|
5065
|
-
format: "url",
|
|
5066
|
-
note: "Invalid protocol",
|
|
5067
|
-
pattern: def.protocol.source,
|
|
5068
|
-
input: payload.value,
|
|
5069
|
-
inst,
|
|
5070
|
-
continue: !def.abort
|
|
5071
|
-
});
|
|
5072
|
-
}
|
|
5073
|
-
if (def.normalize) payload.value = url.href;
|
|
5074
|
-
else payload.value = trimmed;
|
|
5075
|
-
return;
|
|
5076
|
-
} catch (_) {
|
|
5077
|
-
payload.issues.push({
|
|
5078
|
-
code: "invalid_format",
|
|
5079
|
-
format: "url",
|
|
5080
|
-
input: payload.value,
|
|
5081
|
-
inst,
|
|
5082
|
-
continue: !def.abort
|
|
5083
|
-
});
|
|
5084
|
-
}
|
|
5085
|
-
};
|
|
5086
|
-
});
|
|
5087
|
-
const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
|
|
5088
|
-
def.pattern ?? (def.pattern = emoji());
|
|
5089
|
-
$ZodStringFormat.init(inst, def);
|
|
5090
|
-
});
|
|
5091
|
-
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
5092
|
-
def.pattern ?? (def.pattern = nanoid);
|
|
5093
|
-
$ZodStringFormat.init(inst, def);
|
|
5094
|
-
});
|
|
5095
|
-
/**
|
|
5096
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
5097
|
-
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
5098
|
-
* See https://github.com/paralleldrive/cuid.
|
|
5099
|
-
*/
|
|
5100
|
-
const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => {
|
|
5101
|
-
def.pattern ?? (def.pattern = cuid);
|
|
5102
|
-
$ZodStringFormat.init(inst, def);
|
|
5103
|
-
});
|
|
5104
|
-
const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => {
|
|
5105
|
-
def.pattern ?? (def.pattern = cuid2);
|
|
5106
|
-
$ZodStringFormat.init(inst, def);
|
|
5107
|
-
});
|
|
5108
|
-
const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => {
|
|
5109
|
-
def.pattern ?? (def.pattern = ulid);
|
|
5110
|
-
$ZodStringFormat.init(inst, def);
|
|
5111
|
-
});
|
|
5112
|
-
const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => {
|
|
5113
|
-
def.pattern ?? (def.pattern = xid);
|
|
5114
|
-
$ZodStringFormat.init(inst, def);
|
|
5115
|
-
});
|
|
5116
|
-
const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
5117
|
-
def.pattern ?? (def.pattern = ksuid);
|
|
5118
|
-
$ZodStringFormat.init(inst, def);
|
|
5119
|
-
});
|
|
5120
|
-
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
5121
|
-
def.pattern ?? (def.pattern = datetime$1(def));
|
|
5122
|
-
$ZodStringFormat.init(inst, def);
|
|
5123
|
-
});
|
|
5124
|
-
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
5125
|
-
def.pattern ?? (def.pattern = date$1);
|
|
5126
|
-
$ZodStringFormat.init(inst, def);
|
|
5127
|
-
});
|
|
5128
|
-
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
5129
|
-
def.pattern ?? (def.pattern = time$1(def));
|
|
5130
|
-
$ZodStringFormat.init(inst, def);
|
|
5131
|
-
});
|
|
5132
|
-
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
5133
|
-
def.pattern ?? (def.pattern = duration$1);
|
|
5134
|
-
$ZodStringFormat.init(inst, def);
|
|
5135
|
-
});
|
|
5136
|
-
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
5137
|
-
def.pattern ?? (def.pattern = ipv4);
|
|
5138
|
-
$ZodStringFormat.init(inst, def);
|
|
5139
|
-
inst._zod.bag.format = `ipv4`;
|
|
5140
|
-
});
|
|
5141
|
-
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
5142
|
-
def.pattern ?? (def.pattern = ipv6);
|
|
5143
|
-
$ZodStringFormat.init(inst, def);
|
|
5144
|
-
inst._zod.bag.format = `ipv6`;
|
|
5145
|
-
inst._zod.check = (payload) => {
|
|
5146
|
-
try {
|
|
5147
|
-
new URL(`http://[${payload.value}]`);
|
|
5148
|
-
} catch {
|
|
5149
|
-
payload.issues.push({
|
|
5150
|
-
code: "invalid_format",
|
|
5151
|
-
format: "ipv6",
|
|
5152
|
-
input: payload.value,
|
|
5153
|
-
inst,
|
|
5154
|
-
continue: !def.abort
|
|
5155
|
-
});
|
|
5156
|
-
}
|
|
5157
|
-
};
|
|
5158
|
-
});
|
|
5159
|
-
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
5160
|
-
def.pattern ?? (def.pattern = cidrv4);
|
|
5161
|
-
$ZodStringFormat.init(inst, def);
|
|
5162
|
-
});
|
|
5163
|
-
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
5164
|
-
def.pattern ?? (def.pattern = cidrv6);
|
|
5165
|
-
$ZodStringFormat.init(inst, def);
|
|
5166
|
-
inst._zod.check = (payload) => {
|
|
5167
|
-
const parts = payload.value.split("/");
|
|
5168
|
-
try {
|
|
5169
|
-
if (parts.length !== 2) throw new Error();
|
|
5170
|
-
const [address, prefix] = parts;
|
|
5171
|
-
if (!prefix) throw new Error();
|
|
5172
|
-
const prefixNum = Number(prefix);
|
|
5173
|
-
if (`${prefixNum}` !== prefix) throw new Error();
|
|
5174
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
5175
|
-
new URL(`http://[${address}]`);
|
|
5176
|
-
} catch {
|
|
5177
|
-
payload.issues.push({
|
|
5178
|
-
code: "invalid_format",
|
|
5179
|
-
format: "cidrv6",
|
|
5180
|
-
input: payload.value,
|
|
5181
|
-
inst,
|
|
5182
|
-
continue: !def.abort
|
|
5183
|
-
});
|
|
5184
|
-
}
|
|
5185
|
-
};
|
|
5186
|
-
});
|
|
5187
|
-
function isValidBase64(data) {
|
|
5188
|
-
if (data === "") return true;
|
|
5189
|
-
if (/\s/.test(data)) return false;
|
|
5190
|
-
if (data.length % 4 !== 0) return false;
|
|
5191
|
-
try {
|
|
5192
|
-
atob(data);
|
|
5193
|
-
return true;
|
|
5194
|
-
} catch {
|
|
5195
|
-
return false;
|
|
5196
|
-
}
|
|
5197
|
-
}
|
|
5198
|
-
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
5199
|
-
def.pattern ?? (def.pattern = base64);
|
|
5200
|
-
$ZodStringFormat.init(inst, def);
|
|
5201
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
5202
|
-
inst._zod.check = (payload) => {
|
|
5203
|
-
if (isValidBase64(payload.value)) return;
|
|
5204
|
-
payload.issues.push({
|
|
5205
|
-
code: "invalid_format",
|
|
5206
|
-
format: "base64",
|
|
5207
|
-
input: payload.value,
|
|
5208
|
-
inst,
|
|
5209
|
-
continue: !def.abort
|
|
5210
|
-
});
|
|
5211
|
-
};
|
|
5212
|
-
});
|
|
5213
|
-
function isValidBase64URL(data) {
|
|
5214
|
-
if (!base64url.test(data)) return false;
|
|
5215
|
-
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
5216
|
-
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
5217
|
-
}
|
|
5218
|
-
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
5219
|
-
def.pattern ?? (def.pattern = base64url);
|
|
5220
|
-
$ZodStringFormat.init(inst, def);
|
|
5221
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
5222
|
-
inst._zod.check = (payload) => {
|
|
5223
|
-
if (isValidBase64URL(payload.value)) return;
|
|
5224
|
-
payload.issues.push({
|
|
5225
|
-
code: "invalid_format",
|
|
5226
|
-
format: "base64url",
|
|
5227
|
-
input: payload.value,
|
|
5228
|
-
inst,
|
|
5229
|
-
continue: !def.abort
|
|
5230
|
-
});
|
|
5231
|
-
};
|
|
5232
|
-
});
|
|
5233
|
-
const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => {
|
|
5234
|
-
def.pattern ?? (def.pattern = e164);
|
|
5235
|
-
$ZodStringFormat.init(inst, def);
|
|
5236
|
-
});
|
|
5237
|
-
function isValidJWT(token, algorithm = null) {
|
|
5238
|
-
try {
|
|
5239
|
-
const tokensParts = token.split(".");
|
|
5240
|
-
if (tokensParts.length !== 3) return false;
|
|
5241
|
-
const [header] = tokensParts;
|
|
5242
|
-
if (!header) return false;
|
|
5243
|
-
const parsedHeader = JSON.parse(atob(header));
|
|
5244
|
-
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
5245
|
-
if (!parsedHeader.alg) return false;
|
|
5246
|
-
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
5247
|
-
return true;
|
|
5248
|
-
} catch {
|
|
5249
|
-
return false;
|
|
5250
|
-
}
|
|
5251
|
-
}
|
|
5252
|
-
const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
|
|
5253
|
-
$ZodStringFormat.init(inst, def);
|
|
5254
|
-
inst._zod.check = (payload) => {
|
|
5255
|
-
if (isValidJWT(payload.value, def.alg)) return;
|
|
5256
|
-
payload.issues.push({
|
|
5257
|
-
code: "invalid_format",
|
|
5258
|
-
format: "jwt",
|
|
5259
|
-
input: payload.value,
|
|
5260
|
-
inst,
|
|
5261
|
-
continue: !def.abort
|
|
5262
|
-
});
|
|
5263
|
-
};
|
|
5264
|
-
});
|
|
5265
|
-
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
5266
|
-
$ZodType.init(inst, def);
|
|
5267
|
-
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
5268
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
5269
|
-
if (def.coerce) try {
|
|
5270
|
-
payload.value = Number(payload.value);
|
|
5271
|
-
} catch (_) {}
|
|
5272
|
-
const input = payload.value;
|
|
5273
|
-
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
5274
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
5275
|
-
payload.issues.push({
|
|
5276
|
-
expected: "number",
|
|
5277
|
-
code: "invalid_type",
|
|
5278
|
-
input,
|
|
5279
|
-
inst,
|
|
5280
|
-
...received ? { received } : {}
|
|
5281
|
-
});
|
|
5282
|
-
return payload;
|
|
5283
|
-
};
|
|
5284
|
-
});
|
|
5285
|
-
const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
5286
|
-
$ZodCheckNumberFormat.init(inst, def);
|
|
5287
|
-
$ZodNumber.init(inst, def);
|
|
5288
|
-
});
|
|
5289
|
-
const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
|
|
5290
|
-
$ZodType.init(inst, def);
|
|
5291
|
-
inst._zod.pattern = boolean$1;
|
|
5292
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
5293
|
-
if (def.coerce) try {
|
|
5294
|
-
payload.value = Boolean(payload.value);
|
|
5295
|
-
} catch (_) {}
|
|
5296
|
-
const input = payload.value;
|
|
5297
|
-
if (typeof input === "boolean") return payload;
|
|
5298
|
-
payload.issues.push({
|
|
5299
|
-
expected: "boolean",
|
|
5300
|
-
code: "invalid_type",
|
|
5301
|
-
input,
|
|
5302
|
-
inst
|
|
5303
|
-
});
|
|
5304
|
-
return payload;
|
|
5305
|
-
};
|
|
5306
|
-
});
|
|
5307
|
-
const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
|
|
5308
|
-
$ZodType.init(inst, def);
|
|
5309
|
-
inst._zod.parse = (payload) => payload;
|
|
5310
|
-
});
|
|
5311
|
-
const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
|
|
5312
|
-
$ZodType.init(inst, def);
|
|
5313
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
5314
|
-
payload.issues.push({
|
|
5315
|
-
expected: "never",
|
|
5316
|
-
code: "invalid_type",
|
|
5317
|
-
input: payload.value,
|
|
5318
|
-
inst
|
|
5319
|
-
});
|
|
5320
|
-
return payload;
|
|
5321
|
-
};
|
|
5322
|
-
});
|
|
5323
|
-
function handleArrayResult(result, final, index) {
|
|
5324
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
5325
|
-
final.value[index] = result.value;
|
|
5326
|
-
}
|
|
5327
|
-
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
5328
|
-
$ZodType.init(inst, def);
|
|
5329
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5330
|
-
const input = payload.value;
|
|
5331
|
-
if (!Array.isArray(input)) {
|
|
5332
|
-
payload.issues.push({
|
|
5333
|
-
expected: "array",
|
|
5334
|
-
code: "invalid_type",
|
|
5335
|
-
input,
|
|
5336
|
-
inst
|
|
5337
|
-
});
|
|
5338
|
-
return payload;
|
|
5339
|
-
}
|
|
5340
|
-
payload.value = Array(input.length);
|
|
5341
|
-
const proms = [];
|
|
5342
|
-
for (let i = 0; i < input.length; i++) {
|
|
5343
|
-
const item = input[i];
|
|
5344
|
-
const result = def.element._zod.run({
|
|
5345
|
-
value: item,
|
|
5346
|
-
issues: []
|
|
5347
|
-
}, ctx);
|
|
5348
|
-
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
5349
|
-
else handleArrayResult(result, payload, i);
|
|
5350
|
-
}
|
|
5351
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
5352
|
-
return payload;
|
|
5353
|
-
};
|
|
5354
|
-
});
|
|
5355
|
-
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
5356
|
-
const isPresent = key in input;
|
|
5357
|
-
if (result.issues.length) {
|
|
5358
|
-
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
5359
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
5360
|
-
}
|
|
5361
|
-
if (!isPresent && !isOptionalIn) {
|
|
5362
|
-
if (!result.issues.length) final.issues.push({
|
|
5363
|
-
code: "invalid_type",
|
|
5364
|
-
expected: "nonoptional",
|
|
5365
|
-
input: void 0,
|
|
5366
|
-
path: [key]
|
|
5367
|
-
});
|
|
5368
|
-
return;
|
|
5369
|
-
}
|
|
5370
|
-
if (result.value === void 0) {
|
|
5371
|
-
if (isPresent) final.value[key] = void 0;
|
|
5372
|
-
} else final.value[key] = result.value;
|
|
5373
|
-
}
|
|
5374
|
-
function normalizeDef(def) {
|
|
5375
|
-
const keys = Object.keys(def.shape);
|
|
5376
|
-
for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
5377
|
-
const okeys = optionalKeys(def.shape);
|
|
5378
|
-
return {
|
|
5379
|
-
...def,
|
|
5380
|
-
keys,
|
|
5381
|
-
keySet: new Set(keys),
|
|
5382
|
-
numKeys: keys.length,
|
|
5383
|
-
optionalKeys: new Set(okeys)
|
|
5384
|
-
};
|
|
5385
|
-
}
|
|
5386
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
5387
|
-
const unrecognized = [];
|
|
5388
|
-
const keySet = def.keySet;
|
|
5389
|
-
const _catchall = def.catchall._zod;
|
|
5390
|
-
const t = _catchall.def.type;
|
|
5391
|
-
const isOptionalIn = _catchall.optin === "optional";
|
|
5392
|
-
const isOptionalOut = _catchall.optout === "optional";
|
|
5393
|
-
for (const key in input) {
|
|
5394
|
-
if (key === "__proto__") continue;
|
|
5395
|
-
if (keySet.has(key)) continue;
|
|
5396
|
-
if (t === "never") {
|
|
5397
|
-
unrecognized.push(key);
|
|
5398
|
-
continue;
|
|
5399
|
-
}
|
|
5400
|
-
const r = _catchall.run({
|
|
5401
|
-
value: input[key],
|
|
5402
|
-
issues: []
|
|
5403
|
-
}, ctx);
|
|
5404
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
5405
|
-
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
5406
|
-
}
|
|
5407
|
-
if (unrecognized.length) payload.issues.push({
|
|
5408
|
-
code: "unrecognized_keys",
|
|
5409
|
-
keys: unrecognized,
|
|
5410
|
-
input,
|
|
5411
|
-
inst
|
|
5412
|
-
});
|
|
5413
|
-
if (!proms.length) return payload;
|
|
5414
|
-
return Promise.all(proms).then(() => {
|
|
5415
|
-
return payload;
|
|
5416
|
-
});
|
|
5417
|
-
}
|
|
5418
|
-
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
5419
|
-
$ZodType.init(inst, def);
|
|
5420
|
-
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
5421
|
-
const sh = def.shape;
|
|
5422
|
-
Object.defineProperty(def, "shape", { get: () => {
|
|
5423
|
-
const newSh = { ...sh };
|
|
5424
|
-
Object.defineProperty(def, "shape", { value: newSh });
|
|
5425
|
-
return newSh;
|
|
5426
|
-
} });
|
|
5427
|
-
}
|
|
5428
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
5429
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
5430
|
-
const shape = def.shape;
|
|
5431
|
-
const propValues = {};
|
|
5432
|
-
for (const key in shape) {
|
|
5433
|
-
const field = shape[key]._zod;
|
|
5434
|
-
if (field.values) {
|
|
5435
|
-
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
5436
|
-
for (const v of field.values) propValues[key].add(v);
|
|
5437
|
-
}
|
|
5438
|
-
}
|
|
5439
|
-
return propValues;
|
|
5440
|
-
});
|
|
5441
|
-
const isObject$1 = isObject;
|
|
5442
|
-
const catchall = def.catchall;
|
|
5443
|
-
let value;
|
|
5444
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5445
|
-
value ?? (value = _normalized.value);
|
|
5446
|
-
const input = payload.value;
|
|
5447
|
-
if (!isObject$1(input)) {
|
|
5448
|
-
payload.issues.push({
|
|
5449
|
-
expected: "object",
|
|
5450
|
-
code: "invalid_type",
|
|
5451
|
-
input,
|
|
5452
|
-
inst
|
|
5453
|
-
});
|
|
5454
|
-
return payload;
|
|
5455
|
-
}
|
|
5456
|
-
payload.value = {};
|
|
5457
|
-
const proms = [];
|
|
5458
|
-
const shape = value.shape;
|
|
5459
|
-
for (const key of value.keys) {
|
|
5460
|
-
const el = shape[key];
|
|
5461
|
-
const isOptionalIn = el._zod.optin === "optional";
|
|
5462
|
-
const isOptionalOut = el._zod.optout === "optional";
|
|
5463
|
-
const r = el._zod.run({
|
|
5464
|
-
value: input[key],
|
|
5465
|
-
issues: []
|
|
5466
|
-
}, ctx);
|
|
5467
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
5468
|
-
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
5469
|
-
}
|
|
5470
|
-
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
5471
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
5472
|
-
};
|
|
5473
|
-
});
|
|
5474
|
-
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
5475
|
-
$ZodObject.init(inst, def);
|
|
5476
|
-
const superParse = inst._zod.parse;
|
|
5477
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
5478
|
-
const generateFastpass = (shape) => {
|
|
5479
|
-
const doc = new Doc([
|
|
5480
|
-
"shape",
|
|
5481
|
-
"payload",
|
|
5482
|
-
"ctx"
|
|
5483
|
-
]);
|
|
5484
|
-
const normalized = _normalized.value;
|
|
5485
|
-
const parseStr = (key) => {
|
|
5486
|
-
const k = esc(key);
|
|
5487
|
-
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
5488
|
-
};
|
|
5489
|
-
doc.write(`const input = payload.value;`);
|
|
5490
|
-
const ids = Object.create(null);
|
|
5491
|
-
let counter = 0;
|
|
5492
|
-
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
5493
|
-
doc.write(`const newResult = {};`);
|
|
5494
|
-
for (const key of normalized.keys) {
|
|
5495
|
-
const id = ids[key];
|
|
5496
|
-
const k = esc(key);
|
|
5497
|
-
const schema = shape[key];
|
|
5498
|
-
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
5499
|
-
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
5500
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
5501
|
-
if (isOptionalIn && isOptionalOut) doc.write(`
|
|
5502
|
-
if (${id}.issues.length) {
|
|
5503
|
-
if (${k} in input) {
|
|
5504
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
5505
|
-
...iss,
|
|
5506
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
5507
|
-
})));
|
|
5508
|
-
}
|
|
5509
|
-
}
|
|
5510
|
-
|
|
5511
|
-
if (${id}.value === undefined) {
|
|
5512
|
-
if (${k} in input) {
|
|
5513
|
-
newResult[${k}] = undefined;
|
|
5514
|
-
}
|
|
5515
|
-
} else {
|
|
5516
|
-
newResult[${k}] = ${id}.value;
|
|
5517
|
-
}
|
|
5518
|
-
|
|
5519
|
-
`);
|
|
5520
|
-
else if (!isOptionalIn) doc.write(`
|
|
5521
|
-
const ${id}_present = ${k} in input;
|
|
5522
|
-
if (${id}.issues.length) {
|
|
5523
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
5524
|
-
...iss,
|
|
5525
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
5526
|
-
})));
|
|
5527
|
-
}
|
|
5528
|
-
if (!${id}_present && !${id}.issues.length) {
|
|
5529
|
-
payload.issues.push({
|
|
5530
|
-
code: "invalid_type",
|
|
5531
|
-
expected: "nonoptional",
|
|
5532
|
-
input: undefined,
|
|
5533
|
-
path: [${k}]
|
|
5534
|
-
});
|
|
5535
|
-
}
|
|
5536
|
-
|
|
5537
|
-
if (${id}_present) {
|
|
5538
|
-
if (${id}.value === undefined) {
|
|
5539
|
-
newResult[${k}] = undefined;
|
|
5540
|
-
} else {
|
|
5541
|
-
newResult[${k}] = ${id}.value;
|
|
5542
|
-
}
|
|
5543
|
-
}
|
|
5544
|
-
|
|
5545
|
-
`);
|
|
5546
|
-
else doc.write(`
|
|
5547
|
-
if (${id}.issues.length) {
|
|
5548
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
5549
|
-
...iss,
|
|
5550
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
5551
|
-
})));
|
|
5552
|
-
}
|
|
5553
|
-
|
|
5554
|
-
if (${id}.value === undefined) {
|
|
5555
|
-
if (${k} in input) {
|
|
5556
|
-
newResult[${k}] = undefined;
|
|
5557
|
-
}
|
|
5558
|
-
} else {
|
|
5559
|
-
newResult[${k}] = ${id}.value;
|
|
5560
|
-
}
|
|
5561
|
-
|
|
5562
|
-
`);
|
|
5563
|
-
}
|
|
5564
|
-
doc.write(`payload.value = newResult;`);
|
|
5565
|
-
doc.write(`return payload;`);
|
|
5566
|
-
const fn = doc.compile();
|
|
5567
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
5568
|
-
};
|
|
5569
|
-
let fastpass;
|
|
5570
|
-
const isObject$2 = isObject;
|
|
5571
|
-
const jit = !globalConfig.jitless;
|
|
5572
|
-
const fastEnabled = jit && allowsEval.value;
|
|
5573
|
-
const catchall = def.catchall;
|
|
5574
|
-
let value;
|
|
5575
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5576
|
-
value ?? (value = _normalized.value);
|
|
5577
|
-
const input = payload.value;
|
|
5578
|
-
if (!isObject$2(input)) {
|
|
5579
|
-
payload.issues.push({
|
|
5580
|
-
expected: "object",
|
|
5581
|
-
code: "invalid_type",
|
|
5582
|
-
input,
|
|
5583
|
-
inst
|
|
5584
|
-
});
|
|
5585
|
-
return payload;
|
|
5586
|
-
}
|
|
5587
|
-
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
5588
|
-
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
5589
|
-
payload = fastpass(payload, ctx);
|
|
5590
|
-
if (!catchall) return payload;
|
|
5591
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
5592
|
-
}
|
|
5593
|
-
return superParse(payload, ctx);
|
|
5594
|
-
};
|
|
5595
|
-
});
|
|
5596
|
-
function handleUnionResults(results, final, inst, ctx) {
|
|
5597
|
-
for (const result of results) if (result.issues.length === 0) {
|
|
5598
|
-
final.value = result.value;
|
|
5599
|
-
return final;
|
|
5600
|
-
}
|
|
5601
|
-
const nonaborted = results.filter((r) => !aborted(r));
|
|
5602
|
-
if (nonaborted.length === 1) {
|
|
5603
|
-
final.value = nonaborted[0].value;
|
|
5604
|
-
return nonaborted[0];
|
|
5605
|
-
}
|
|
5606
|
-
final.issues.push({
|
|
5607
|
-
code: "invalid_union",
|
|
5608
|
-
input: final.value,
|
|
5609
|
-
inst,
|
|
5610
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
5611
|
-
});
|
|
5612
|
-
return final;
|
|
5613
|
-
}
|
|
5614
|
-
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
5615
|
-
$ZodType.init(inst, def);
|
|
5616
|
-
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
5617
|
-
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
5618
|
-
defineLazy(inst._zod, "values", () => {
|
|
5619
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
5620
|
-
});
|
|
5621
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
5622
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
5623
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
5624
|
-
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
5625
|
-
}
|
|
5626
|
-
});
|
|
5627
|
-
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
5628
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5629
|
-
if (first) return first(payload, ctx);
|
|
5630
|
-
let async = false;
|
|
5631
|
-
const results = [];
|
|
5632
|
-
for (const option of def.options) {
|
|
5633
|
-
const result = option._zod.run({
|
|
5634
|
-
value: payload.value,
|
|
5635
|
-
issues: []
|
|
5636
|
-
}, ctx);
|
|
5637
|
-
if (result instanceof Promise) {
|
|
5638
|
-
results.push(result);
|
|
5639
|
-
async = true;
|
|
5640
|
-
} else {
|
|
5641
|
-
if (result.issues.length === 0) return result;
|
|
5642
|
-
results.push(result);
|
|
5643
|
-
}
|
|
5644
|
-
}
|
|
5645
|
-
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
5646
|
-
return Promise.all(results).then((results) => {
|
|
5647
|
-
return handleUnionResults(results, payload, inst, ctx);
|
|
5648
|
-
});
|
|
5649
|
-
};
|
|
5650
|
-
});
|
|
5651
|
-
const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
5652
|
-
$ZodType.init(inst, def);
|
|
5653
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5654
|
-
const input = payload.value;
|
|
5655
|
-
const left = def.left._zod.run({
|
|
5656
|
-
value: input,
|
|
5657
|
-
issues: []
|
|
5658
|
-
}, ctx);
|
|
5659
|
-
const right = def.right._zod.run({
|
|
5660
|
-
value: input,
|
|
5661
|
-
issues: []
|
|
5662
|
-
}, ctx);
|
|
5663
|
-
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
5664
|
-
return handleIntersectionResults(payload, left, right);
|
|
5665
|
-
});
|
|
5666
|
-
return handleIntersectionResults(payload, left, right);
|
|
5667
|
-
};
|
|
5668
|
-
});
|
|
5669
|
-
function mergeValues(a, b) {
|
|
5670
|
-
if (a === b) return {
|
|
5671
|
-
valid: true,
|
|
5672
|
-
data: a
|
|
5673
|
-
};
|
|
5674
|
-
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
5675
|
-
valid: true,
|
|
5676
|
-
data: a
|
|
5677
|
-
};
|
|
5678
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
5679
|
-
const bKeys = Object.keys(b);
|
|
5680
|
-
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
5681
|
-
const newObj = {
|
|
5682
|
-
...a,
|
|
5683
|
-
...b
|
|
5684
|
-
};
|
|
5685
|
-
for (const key of sharedKeys) {
|
|
5686
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
|
5687
|
-
if (!sharedValue.valid) return {
|
|
5688
|
-
valid: false,
|
|
5689
|
-
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
5690
|
-
};
|
|
5691
|
-
newObj[key] = sharedValue.data;
|
|
5692
|
-
}
|
|
5693
|
-
return {
|
|
5694
|
-
valid: true,
|
|
5695
|
-
data: newObj
|
|
5696
|
-
};
|
|
5697
|
-
}
|
|
5698
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
5699
|
-
if (a.length !== b.length) return {
|
|
5700
|
-
valid: false,
|
|
5701
|
-
mergeErrorPath: []
|
|
5702
|
-
};
|
|
5703
|
-
const newArray = [];
|
|
5704
|
-
for (let index = 0; index < a.length; index++) {
|
|
5705
|
-
const itemA = a[index];
|
|
5706
|
-
const itemB = b[index];
|
|
5707
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
5708
|
-
if (!sharedValue.valid) return {
|
|
5709
|
-
valid: false,
|
|
5710
|
-
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
5711
|
-
};
|
|
5712
|
-
newArray.push(sharedValue.data);
|
|
5713
|
-
}
|
|
5714
|
-
return {
|
|
5715
|
-
valid: true,
|
|
5716
|
-
data: newArray
|
|
5717
|
-
};
|
|
5718
|
-
}
|
|
5719
|
-
return {
|
|
5720
|
-
valid: false,
|
|
5721
|
-
mergeErrorPath: []
|
|
5722
|
-
};
|
|
5723
|
-
}
|
|
5724
|
-
function handleIntersectionResults(result, left, right) {
|
|
5725
|
-
const unrecKeys = /* @__PURE__ */ new Map();
|
|
5726
|
-
let unrecIssue;
|
|
5727
|
-
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
5728
|
-
unrecIssue ?? (unrecIssue = iss);
|
|
5729
|
-
for (const k of iss.keys) {
|
|
5730
|
-
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
5731
|
-
unrecKeys.get(k).l = true;
|
|
5732
|
-
}
|
|
5733
|
-
} else result.issues.push(iss);
|
|
5734
|
-
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
5735
|
-
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
5736
|
-
unrecKeys.get(k).r = true;
|
|
5737
|
-
}
|
|
5738
|
-
else result.issues.push(iss);
|
|
5739
|
-
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
5740
|
-
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
5741
|
-
...unrecIssue,
|
|
5742
|
-
keys: bothKeys
|
|
5743
|
-
});
|
|
5744
|
-
if (aborted(result)) return result;
|
|
5745
|
-
const merged = mergeValues(left.value, right.value);
|
|
5746
|
-
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
5747
|
-
result.value = merged.data;
|
|
5748
|
-
return result;
|
|
5749
|
-
}
|
|
5750
|
-
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
5751
|
-
$ZodType.init(inst, def);
|
|
5752
|
-
const values = getEnumValues(def.entries);
|
|
5753
|
-
const valuesSet = new Set(values);
|
|
5754
|
-
inst._zod.values = valuesSet;
|
|
5755
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
5756
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
5757
|
-
const input = payload.value;
|
|
5758
|
-
if (valuesSet.has(input)) return payload;
|
|
5759
|
-
payload.issues.push({
|
|
5760
|
-
code: "invalid_value",
|
|
5761
|
-
values,
|
|
5762
|
-
input,
|
|
5763
|
-
inst
|
|
5764
|
-
});
|
|
5765
|
-
return payload;
|
|
5766
|
-
};
|
|
5767
|
-
});
|
|
5768
|
-
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
5769
|
-
$ZodType.init(inst, def);
|
|
5770
|
-
inst._zod.optin = "optional";
|
|
5771
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5772
|
-
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
5773
|
-
const _out = def.transform(payload.value, payload);
|
|
5774
|
-
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
5775
|
-
payload.value = output;
|
|
5776
|
-
payload.fallback = true;
|
|
5777
|
-
return payload;
|
|
5778
|
-
});
|
|
5779
|
-
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
5780
|
-
payload.value = _out;
|
|
5781
|
-
payload.fallback = true;
|
|
5782
|
-
return payload;
|
|
5783
|
-
};
|
|
5784
|
-
});
|
|
5785
|
-
function handleOptionalResult(result, input) {
|
|
5786
|
-
if (input === void 0 && (result.issues.length || result.fallback)) return {
|
|
5787
|
-
issues: [],
|
|
5788
|
-
value: void 0
|
|
5789
|
-
};
|
|
5790
|
-
return result;
|
|
5791
|
-
}
|
|
5792
|
-
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
5793
|
-
$ZodType.init(inst, def);
|
|
5794
|
-
inst._zod.optin = "optional";
|
|
5795
|
-
inst._zod.optout = "optional";
|
|
5796
|
-
defineLazy(inst._zod, "values", () => {
|
|
5797
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
5798
|
-
});
|
|
5799
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
5800
|
-
const pattern = def.innerType._zod.pattern;
|
|
5801
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
5802
|
-
});
|
|
5803
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5804
|
-
if (def.innerType._zod.optin === "optional") {
|
|
5805
|
-
const input = payload.value;
|
|
5806
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
5807
|
-
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
|
|
5808
|
-
return handleOptionalResult(result, input);
|
|
5809
|
-
}
|
|
5810
|
-
if (payload.value === void 0) return payload;
|
|
5811
|
-
return def.innerType._zod.run(payload, ctx);
|
|
5812
|
-
};
|
|
5813
|
-
});
|
|
5814
|
-
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
5815
|
-
$ZodOptional.init(inst, def);
|
|
5816
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5817
|
-
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
5818
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5819
|
-
return def.innerType._zod.run(payload, ctx);
|
|
5820
|
-
};
|
|
5821
|
-
});
|
|
5822
|
-
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
5823
|
-
$ZodType.init(inst, def);
|
|
5824
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
5825
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
5826
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
5827
|
-
const pattern = def.innerType._zod.pattern;
|
|
5828
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
5829
|
-
});
|
|
5830
|
-
defineLazy(inst._zod, "values", () => {
|
|
5831
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
5832
|
-
});
|
|
5833
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5834
|
-
if (payload.value === null) return payload;
|
|
5835
|
-
return def.innerType._zod.run(payload, ctx);
|
|
5836
|
-
};
|
|
5837
|
-
});
|
|
5838
|
-
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
5839
|
-
$ZodType.init(inst, def);
|
|
5840
|
-
inst._zod.optin = "optional";
|
|
5841
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5842
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5843
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5844
|
-
if (payload.value === void 0) {
|
|
5845
|
-
payload.value = def.defaultValue;
|
|
5846
|
-
/**
|
|
5847
|
-
* $ZodDefault returns the default value immediately in forward direction.
|
|
5848
|
-
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
5849
|
-
return payload;
|
|
5850
|
-
}
|
|
5851
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
5852
|
-
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
5853
|
-
return handleDefaultResult(result, def);
|
|
5854
|
-
};
|
|
5855
|
-
});
|
|
5856
|
-
function handleDefaultResult(payload, def) {
|
|
5857
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
5858
|
-
return payload;
|
|
5859
|
-
}
|
|
5860
|
-
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
5861
|
-
$ZodType.init(inst, def);
|
|
5862
|
-
inst._zod.optin = "optional";
|
|
5863
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5864
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5865
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5866
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
5867
|
-
return def.innerType._zod.run(payload, ctx);
|
|
5868
|
-
};
|
|
5869
|
-
});
|
|
5870
|
-
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
5871
|
-
$ZodType.init(inst, def);
|
|
5872
|
-
defineLazy(inst._zod, "values", () => {
|
|
5873
|
-
const v = def.innerType._zod.values;
|
|
5874
|
-
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
5875
|
-
});
|
|
5876
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5877
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
5878
|
-
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
5879
|
-
return handleNonOptionalResult(result, inst);
|
|
5880
|
-
};
|
|
5881
|
-
});
|
|
5882
|
-
function handleNonOptionalResult(payload, inst) {
|
|
5883
|
-
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
5884
|
-
code: "invalid_type",
|
|
5885
|
-
expected: "nonoptional",
|
|
5886
|
-
input: payload.value,
|
|
5887
|
-
inst
|
|
5888
|
-
});
|
|
5889
|
-
return payload;
|
|
5890
|
-
}
|
|
5891
|
-
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
5892
|
-
$ZodType.init(inst, def);
|
|
5893
|
-
inst._zod.optin = "optional";
|
|
5894
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
5895
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5896
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5897
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5898
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
5899
|
-
if (result instanceof Promise) return result.then((result) => {
|
|
5900
|
-
payload.value = result.value;
|
|
5901
|
-
if (result.issues.length) {
|
|
5902
|
-
payload.value = def.catchValue({
|
|
5903
|
-
...payload,
|
|
5904
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
5905
|
-
input: payload.value
|
|
5906
|
-
});
|
|
5907
|
-
payload.issues = [];
|
|
5908
|
-
payload.fallback = true;
|
|
5909
|
-
}
|
|
5910
|
-
return payload;
|
|
5911
|
-
});
|
|
5912
|
-
payload.value = result.value;
|
|
5913
|
-
if (result.issues.length) {
|
|
5914
|
-
payload.value = def.catchValue({
|
|
5915
|
-
...payload,
|
|
5916
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
5917
|
-
input: payload.value
|
|
5918
|
-
});
|
|
5919
|
-
payload.issues = [];
|
|
5920
|
-
payload.fallback = true;
|
|
5921
|
-
}
|
|
5922
|
-
return payload;
|
|
5923
|
-
};
|
|
5924
|
-
});
|
|
5925
|
-
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
5926
|
-
$ZodType.init(inst, def);
|
|
5927
|
-
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
5928
|
-
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
5929
|
-
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
5930
|
-
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
5931
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5932
|
-
if (ctx.direction === "backward") {
|
|
5933
|
-
const right = def.out._zod.run(payload, ctx);
|
|
5934
|
-
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
5935
|
-
return handlePipeResult(right, def.in, ctx);
|
|
5936
|
-
}
|
|
5937
|
-
const left = def.in._zod.run(payload, ctx);
|
|
5938
|
-
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
5939
|
-
return handlePipeResult(left, def.out, ctx);
|
|
5940
|
-
};
|
|
5941
|
-
});
|
|
5942
|
-
function handlePipeResult(left, next, ctx) {
|
|
5943
|
-
if (left.issues.length) {
|
|
5944
|
-
left.aborted = true;
|
|
5945
|
-
return left;
|
|
5946
|
-
}
|
|
5947
|
-
return next._zod.run({
|
|
5948
|
-
value: left.value,
|
|
5949
|
-
issues: left.issues,
|
|
5950
|
-
fallback: left.fallback
|
|
5951
|
-
}, ctx);
|
|
5952
|
-
}
|
|
5953
|
-
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
5954
|
-
$ZodType.init(inst, def);
|
|
5955
|
-
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
5956
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5957
|
-
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
5958
|
-
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
5959
|
-
inst._zod.parse = (payload, ctx) => {
|
|
5960
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
5961
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
5962
|
-
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
5963
|
-
return handleReadonlyResult(result);
|
|
5964
|
-
};
|
|
5965
|
-
});
|
|
5966
|
-
function handleReadonlyResult(payload) {
|
|
5967
|
-
payload.value = Object.freeze(payload.value);
|
|
5968
|
-
return payload;
|
|
5969
|
-
}
|
|
5970
|
-
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
5971
|
-
$ZodCheck.init(inst, def);
|
|
5972
|
-
$ZodType.init(inst, def);
|
|
5973
|
-
inst._zod.parse = (payload, _) => {
|
|
5974
|
-
return payload;
|
|
5975
|
-
};
|
|
5976
|
-
inst._zod.check = (payload) => {
|
|
5977
|
-
const input = payload.value;
|
|
5978
|
-
const r = def.fn(input);
|
|
5979
|
-
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
5980
|
-
handleRefineResult(r, payload, input, inst);
|
|
5981
|
-
};
|
|
5982
|
-
});
|
|
5983
|
-
function handleRefineResult(result, payload, input, inst) {
|
|
5984
|
-
if (!result) {
|
|
5985
|
-
const _iss = {
|
|
5986
|
-
code: "custom",
|
|
5987
|
-
input,
|
|
5988
|
-
inst,
|
|
5989
|
-
path: [...inst._zod.def.path ?? []],
|
|
5990
|
-
continue: !inst._zod.def.abort
|
|
5991
|
-
};
|
|
5992
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
5993
|
-
payload.issues.push(issue(_iss));
|
|
5994
|
-
}
|
|
5995
|
-
}
|
|
5996
|
-
//#endregion
|
|
5997
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
|
|
5998
|
-
var _a$1;
|
|
5999
|
-
var $ZodRegistry = class {
|
|
6000
|
-
constructor() {
|
|
6001
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
6002
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
6003
|
-
}
|
|
6004
|
-
add(schema, ..._meta) {
|
|
6005
|
-
const meta = _meta[0];
|
|
6006
|
-
this._map.set(schema, meta);
|
|
6007
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
6008
|
-
return this;
|
|
6009
|
-
}
|
|
6010
|
-
clear() {
|
|
6011
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
6012
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
6013
|
-
return this;
|
|
6014
|
-
}
|
|
6015
|
-
remove(schema) {
|
|
6016
|
-
const meta = this._map.get(schema);
|
|
6017
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
6018
|
-
this._map.delete(schema);
|
|
6019
|
-
return this;
|
|
6020
|
-
}
|
|
6021
|
-
get(schema) {
|
|
6022
|
-
const p = schema._zod.parent;
|
|
6023
|
-
if (p) {
|
|
6024
|
-
const pm = { ...this.get(p) ?? {} };
|
|
6025
|
-
delete pm.id;
|
|
6026
|
-
const f = {
|
|
6027
|
-
...pm,
|
|
6028
|
-
...this._map.get(schema)
|
|
6029
|
-
};
|
|
6030
|
-
return Object.keys(f).length ? f : void 0;
|
|
6031
|
-
}
|
|
6032
|
-
return this._map.get(schema);
|
|
6033
|
-
}
|
|
6034
|
-
has(schema) {
|
|
6035
|
-
return this._map.has(schema);
|
|
6036
|
-
}
|
|
6037
|
-
};
|
|
6038
|
-
function registry() {
|
|
6039
|
-
return new $ZodRegistry();
|
|
6040
|
-
}
|
|
6041
|
-
(_a$1 = globalThis).__zod_globalRegistry ?? (_a$1.__zod_globalRegistry = registry());
|
|
6042
|
-
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
6043
|
-
//#endregion
|
|
6044
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
|
|
6045
|
-
// @__NO_SIDE_EFFECTS__
|
|
6046
|
-
function _string(Class, params) {
|
|
6047
|
-
return new Class({
|
|
6048
|
-
type: "string",
|
|
6049
|
-
...normalizeParams(params)
|
|
6050
|
-
});
|
|
6051
|
-
}
|
|
6052
|
-
// @__NO_SIDE_EFFECTS__
|
|
6053
|
-
function _email(Class, params) {
|
|
6054
|
-
return new Class({
|
|
6055
|
-
type: "string",
|
|
6056
|
-
format: "email",
|
|
6057
|
-
check: "string_format",
|
|
6058
|
-
abort: false,
|
|
6059
|
-
...normalizeParams(params)
|
|
6060
|
-
});
|
|
6061
|
-
}
|
|
6062
|
-
// @__NO_SIDE_EFFECTS__
|
|
6063
|
-
function _guid(Class, params) {
|
|
6064
|
-
return new Class({
|
|
6065
|
-
type: "string",
|
|
6066
|
-
format: "guid",
|
|
6067
|
-
check: "string_format",
|
|
6068
|
-
abort: false,
|
|
6069
|
-
...normalizeParams(params)
|
|
6070
|
-
});
|
|
6071
|
-
}
|
|
6072
|
-
// @__NO_SIDE_EFFECTS__
|
|
6073
|
-
function _uuid(Class, params) {
|
|
6074
|
-
return new Class({
|
|
6075
|
-
type: "string",
|
|
6076
|
-
format: "uuid",
|
|
6077
|
-
check: "string_format",
|
|
6078
|
-
abort: false,
|
|
6079
|
-
...normalizeParams(params)
|
|
6080
|
-
});
|
|
6081
|
-
}
|
|
6082
|
-
// @__NO_SIDE_EFFECTS__
|
|
6083
|
-
function _uuidv4(Class, params) {
|
|
6084
|
-
return new Class({
|
|
6085
|
-
type: "string",
|
|
6086
|
-
format: "uuid",
|
|
6087
|
-
check: "string_format",
|
|
6088
|
-
abort: false,
|
|
6089
|
-
version: "v4",
|
|
6090
|
-
...normalizeParams(params)
|
|
6091
|
-
});
|
|
6092
|
-
}
|
|
6093
|
-
// @__NO_SIDE_EFFECTS__
|
|
6094
|
-
function _uuidv6(Class, params) {
|
|
6095
|
-
return new Class({
|
|
6096
|
-
type: "string",
|
|
6097
|
-
format: "uuid",
|
|
6098
|
-
check: "string_format",
|
|
6099
|
-
abort: false,
|
|
6100
|
-
version: "v6",
|
|
6101
|
-
...normalizeParams(params)
|
|
6102
|
-
});
|
|
6103
|
-
}
|
|
6104
|
-
// @__NO_SIDE_EFFECTS__
|
|
6105
|
-
function _uuidv7(Class, params) {
|
|
6106
|
-
return new Class({
|
|
6107
|
-
type: "string",
|
|
6108
|
-
format: "uuid",
|
|
6109
|
-
check: "string_format",
|
|
6110
|
-
abort: false,
|
|
6111
|
-
version: "v7",
|
|
6112
|
-
...normalizeParams(params)
|
|
6113
|
-
});
|
|
6114
|
-
}
|
|
6115
|
-
// @__NO_SIDE_EFFECTS__
|
|
6116
|
-
function _url(Class, params) {
|
|
6117
|
-
return new Class({
|
|
6118
|
-
type: "string",
|
|
6119
|
-
format: "url",
|
|
6120
|
-
check: "string_format",
|
|
6121
|
-
abort: false,
|
|
6122
|
-
...normalizeParams(params)
|
|
6123
|
-
});
|
|
6124
|
-
}
|
|
6125
|
-
// @__NO_SIDE_EFFECTS__
|
|
6126
|
-
function _emoji(Class, params) {
|
|
6127
|
-
return new Class({
|
|
6128
|
-
type: "string",
|
|
6129
|
-
format: "emoji",
|
|
6130
|
-
check: "string_format",
|
|
6131
|
-
abort: false,
|
|
6132
|
-
...normalizeParams(params)
|
|
6133
|
-
});
|
|
6134
|
-
}
|
|
6135
|
-
// @__NO_SIDE_EFFECTS__
|
|
6136
|
-
function _nanoid(Class, params) {
|
|
6137
|
-
return new Class({
|
|
6138
|
-
type: "string",
|
|
6139
|
-
format: "nanoid",
|
|
6140
|
-
check: "string_format",
|
|
6141
|
-
abort: false,
|
|
6142
|
-
...normalizeParams(params)
|
|
6143
|
-
});
|
|
6144
|
-
}
|
|
6145
|
-
/**
|
|
6146
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
6147
|
-
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
6148
|
-
* See https://github.com/paralleldrive/cuid.
|
|
6149
|
-
*/
|
|
6150
|
-
// @__NO_SIDE_EFFECTS__
|
|
6151
|
-
function _cuid(Class, params) {
|
|
6152
|
-
return new Class({
|
|
6153
|
-
type: "string",
|
|
6154
|
-
format: "cuid",
|
|
6155
|
-
check: "string_format",
|
|
6156
|
-
abort: false,
|
|
6157
|
-
...normalizeParams(params)
|
|
6158
|
-
});
|
|
6159
|
-
}
|
|
6160
|
-
// @__NO_SIDE_EFFECTS__
|
|
6161
|
-
function _cuid2(Class, params) {
|
|
6162
|
-
return new Class({
|
|
6163
|
-
type: "string",
|
|
6164
|
-
format: "cuid2",
|
|
6165
|
-
check: "string_format",
|
|
6166
|
-
abort: false,
|
|
6167
|
-
...normalizeParams(params)
|
|
6168
|
-
});
|
|
6169
|
-
}
|
|
6170
|
-
// @__NO_SIDE_EFFECTS__
|
|
6171
|
-
function _ulid(Class, params) {
|
|
6172
|
-
return new Class({
|
|
6173
|
-
type: "string",
|
|
6174
|
-
format: "ulid",
|
|
6175
|
-
check: "string_format",
|
|
6176
|
-
abort: false,
|
|
6177
|
-
...normalizeParams(params)
|
|
6178
|
-
});
|
|
6179
|
-
}
|
|
6180
|
-
// @__NO_SIDE_EFFECTS__
|
|
6181
|
-
function _xid(Class, params) {
|
|
6182
|
-
return new Class({
|
|
6183
|
-
type: "string",
|
|
6184
|
-
format: "xid",
|
|
6185
|
-
check: "string_format",
|
|
6186
|
-
abort: false,
|
|
6187
|
-
...normalizeParams(params)
|
|
6188
|
-
});
|
|
6189
|
-
}
|
|
6190
|
-
// @__NO_SIDE_EFFECTS__
|
|
6191
|
-
function _ksuid(Class, params) {
|
|
6192
|
-
return new Class({
|
|
6193
|
-
type: "string",
|
|
6194
|
-
format: "ksuid",
|
|
6195
|
-
check: "string_format",
|
|
6196
|
-
abort: false,
|
|
6197
|
-
...normalizeParams(params)
|
|
6198
|
-
});
|
|
6199
|
-
}
|
|
6200
|
-
// @__NO_SIDE_EFFECTS__
|
|
6201
|
-
function _ipv4(Class, params) {
|
|
6202
|
-
return new Class({
|
|
6203
|
-
type: "string",
|
|
6204
|
-
format: "ipv4",
|
|
6205
|
-
check: "string_format",
|
|
6206
|
-
abort: false,
|
|
6207
|
-
...normalizeParams(params)
|
|
6208
|
-
});
|
|
6209
|
-
}
|
|
6210
|
-
// @__NO_SIDE_EFFECTS__
|
|
6211
|
-
function _ipv6(Class, params) {
|
|
6212
|
-
return new Class({
|
|
6213
|
-
type: "string",
|
|
6214
|
-
format: "ipv6",
|
|
6215
|
-
check: "string_format",
|
|
6216
|
-
abort: false,
|
|
6217
|
-
...normalizeParams(params)
|
|
6218
|
-
});
|
|
6219
|
-
}
|
|
6220
|
-
// @__NO_SIDE_EFFECTS__
|
|
6221
|
-
function _cidrv4(Class, params) {
|
|
6222
|
-
return new Class({
|
|
6223
|
-
type: "string",
|
|
6224
|
-
format: "cidrv4",
|
|
6225
|
-
check: "string_format",
|
|
6226
|
-
abort: false,
|
|
6227
|
-
...normalizeParams(params)
|
|
6228
|
-
});
|
|
6229
|
-
}
|
|
6230
|
-
// @__NO_SIDE_EFFECTS__
|
|
6231
|
-
function _cidrv6(Class, params) {
|
|
6232
|
-
return new Class({
|
|
6233
|
-
type: "string",
|
|
6234
|
-
format: "cidrv6",
|
|
6235
|
-
check: "string_format",
|
|
6236
|
-
abort: false,
|
|
6237
|
-
...normalizeParams(params)
|
|
6238
|
-
});
|
|
6239
|
-
}
|
|
6240
|
-
// @__NO_SIDE_EFFECTS__
|
|
6241
|
-
function _base64(Class, params) {
|
|
6242
|
-
return new Class({
|
|
6243
|
-
type: "string",
|
|
6244
|
-
format: "base64",
|
|
6245
|
-
check: "string_format",
|
|
6246
|
-
abort: false,
|
|
6247
|
-
...normalizeParams(params)
|
|
6248
|
-
});
|
|
6249
|
-
}
|
|
6250
|
-
// @__NO_SIDE_EFFECTS__
|
|
6251
|
-
function _base64url(Class, params) {
|
|
6252
|
-
return new Class({
|
|
6253
|
-
type: "string",
|
|
6254
|
-
format: "base64url",
|
|
6255
|
-
check: "string_format",
|
|
6256
|
-
abort: false,
|
|
6257
|
-
...normalizeParams(params)
|
|
6258
|
-
});
|
|
6259
|
-
}
|
|
6260
|
-
// @__NO_SIDE_EFFECTS__
|
|
6261
|
-
function _e164(Class, params) {
|
|
6262
|
-
return new Class({
|
|
6263
|
-
type: "string",
|
|
6264
|
-
format: "e164",
|
|
6265
|
-
check: "string_format",
|
|
6266
|
-
abort: false,
|
|
6267
|
-
...normalizeParams(params)
|
|
6268
|
-
});
|
|
6269
|
-
}
|
|
6270
|
-
// @__NO_SIDE_EFFECTS__
|
|
6271
|
-
function _jwt(Class, params) {
|
|
6272
|
-
return new Class({
|
|
6273
|
-
type: "string",
|
|
6274
|
-
format: "jwt",
|
|
6275
|
-
check: "string_format",
|
|
6276
|
-
abort: false,
|
|
6277
|
-
...normalizeParams(params)
|
|
6278
|
-
});
|
|
6279
|
-
}
|
|
6280
|
-
// @__NO_SIDE_EFFECTS__
|
|
6281
|
-
function _isoDateTime(Class, params) {
|
|
6282
|
-
return new Class({
|
|
6283
|
-
type: "string",
|
|
6284
|
-
format: "datetime",
|
|
6285
|
-
check: "string_format",
|
|
6286
|
-
offset: false,
|
|
6287
|
-
local: false,
|
|
6288
|
-
precision: null,
|
|
6289
|
-
...normalizeParams(params)
|
|
6290
|
-
});
|
|
6291
|
-
}
|
|
6292
|
-
// @__NO_SIDE_EFFECTS__
|
|
6293
|
-
function _isoDate(Class, params) {
|
|
6294
|
-
return new Class({
|
|
6295
|
-
type: "string",
|
|
6296
|
-
format: "date",
|
|
6297
|
-
check: "string_format",
|
|
6298
|
-
...normalizeParams(params)
|
|
6299
|
-
});
|
|
6300
|
-
}
|
|
6301
|
-
// @__NO_SIDE_EFFECTS__
|
|
6302
|
-
function _isoTime(Class, params) {
|
|
6303
|
-
return new Class({
|
|
6304
|
-
type: "string",
|
|
6305
|
-
format: "time",
|
|
6306
|
-
check: "string_format",
|
|
6307
|
-
precision: null,
|
|
6308
|
-
...normalizeParams(params)
|
|
6309
|
-
});
|
|
6310
|
-
}
|
|
6311
|
-
// @__NO_SIDE_EFFECTS__
|
|
6312
|
-
function _isoDuration(Class, params) {
|
|
6313
|
-
return new Class({
|
|
6314
|
-
type: "string",
|
|
6315
|
-
format: "duration",
|
|
6316
|
-
check: "string_format",
|
|
6317
|
-
...normalizeParams(params)
|
|
6318
|
-
});
|
|
6319
|
-
}
|
|
6320
|
-
// @__NO_SIDE_EFFECTS__
|
|
6321
|
-
function _number(Class, params) {
|
|
6322
|
-
return new Class({
|
|
6323
|
-
type: "number",
|
|
6324
|
-
checks: [],
|
|
6325
|
-
...normalizeParams(params)
|
|
6326
|
-
});
|
|
6327
|
-
}
|
|
6328
|
-
// @__NO_SIDE_EFFECTS__
|
|
6329
|
-
function _int(Class, params) {
|
|
6330
|
-
return new Class({
|
|
6331
|
-
type: "number",
|
|
6332
|
-
check: "number_format",
|
|
6333
|
-
abort: false,
|
|
6334
|
-
format: "safeint",
|
|
6335
|
-
...normalizeParams(params)
|
|
6336
|
-
});
|
|
6337
|
-
}
|
|
6338
|
-
// @__NO_SIDE_EFFECTS__
|
|
6339
|
-
function _boolean(Class, params) {
|
|
6340
|
-
return new Class({
|
|
6341
|
-
type: "boolean",
|
|
6342
|
-
...normalizeParams(params)
|
|
6343
|
-
});
|
|
6344
|
-
}
|
|
6345
|
-
// @__NO_SIDE_EFFECTS__
|
|
6346
|
-
function _unknown(Class) {
|
|
6347
|
-
return new Class({ type: "unknown" });
|
|
6348
|
-
}
|
|
6349
|
-
// @__NO_SIDE_EFFECTS__
|
|
6350
|
-
function _never(Class, params) {
|
|
6351
|
-
return new Class({
|
|
6352
|
-
type: "never",
|
|
6353
|
-
...normalizeParams(params)
|
|
6354
|
-
});
|
|
6355
|
-
}
|
|
6356
|
-
// @__NO_SIDE_EFFECTS__
|
|
6357
|
-
function _lt(value, params) {
|
|
6358
|
-
return new $ZodCheckLessThan({
|
|
6359
|
-
check: "less_than",
|
|
6360
|
-
...normalizeParams(params),
|
|
6361
|
-
value,
|
|
6362
|
-
inclusive: false
|
|
6363
|
-
});
|
|
6364
|
-
}
|
|
6365
|
-
// @__NO_SIDE_EFFECTS__
|
|
6366
|
-
function _lte(value, params) {
|
|
6367
|
-
return new $ZodCheckLessThan({
|
|
6368
|
-
check: "less_than",
|
|
6369
|
-
...normalizeParams(params),
|
|
6370
|
-
value,
|
|
6371
|
-
inclusive: true
|
|
6372
|
-
});
|
|
6373
|
-
}
|
|
6374
|
-
// @__NO_SIDE_EFFECTS__
|
|
6375
|
-
function _gt(value, params) {
|
|
6376
|
-
return new $ZodCheckGreaterThan({
|
|
6377
|
-
check: "greater_than",
|
|
6378
|
-
...normalizeParams(params),
|
|
6379
|
-
value,
|
|
6380
|
-
inclusive: false
|
|
6381
|
-
});
|
|
6382
|
-
}
|
|
6383
|
-
// @__NO_SIDE_EFFECTS__
|
|
6384
|
-
function _gte(value, params) {
|
|
6385
|
-
return new $ZodCheckGreaterThan({
|
|
6386
|
-
check: "greater_than",
|
|
6387
|
-
...normalizeParams(params),
|
|
6388
|
-
value,
|
|
6389
|
-
inclusive: true
|
|
6390
|
-
});
|
|
6391
|
-
}
|
|
6392
|
-
// @__NO_SIDE_EFFECTS__
|
|
6393
|
-
function _multipleOf(value, params) {
|
|
6394
|
-
return new $ZodCheckMultipleOf({
|
|
6395
|
-
check: "multiple_of",
|
|
6396
|
-
...normalizeParams(params),
|
|
6397
|
-
value
|
|
6398
|
-
});
|
|
6399
|
-
}
|
|
6400
|
-
// @__NO_SIDE_EFFECTS__
|
|
6401
|
-
function _maxLength(maximum, params) {
|
|
6402
|
-
return new $ZodCheckMaxLength({
|
|
6403
|
-
check: "max_length",
|
|
6404
|
-
...normalizeParams(params),
|
|
6405
|
-
maximum
|
|
6406
|
-
});
|
|
6407
|
-
}
|
|
6408
|
-
// @__NO_SIDE_EFFECTS__
|
|
6409
|
-
function _minLength(minimum, params) {
|
|
6410
|
-
return new $ZodCheckMinLength({
|
|
6411
|
-
check: "min_length",
|
|
6412
|
-
...normalizeParams(params),
|
|
6413
|
-
minimum
|
|
6414
|
-
});
|
|
6415
|
-
}
|
|
6416
|
-
// @__NO_SIDE_EFFECTS__
|
|
6417
|
-
function _length(length, params) {
|
|
6418
|
-
return new $ZodCheckLengthEquals({
|
|
6419
|
-
check: "length_equals",
|
|
6420
|
-
...normalizeParams(params),
|
|
6421
|
-
length
|
|
6422
|
-
});
|
|
6423
|
-
}
|
|
6424
|
-
// @__NO_SIDE_EFFECTS__
|
|
6425
|
-
function _regex(pattern, params) {
|
|
6426
|
-
return new $ZodCheckRegex({
|
|
6427
|
-
check: "string_format",
|
|
6428
|
-
format: "regex",
|
|
6429
|
-
...normalizeParams(params),
|
|
6430
|
-
pattern
|
|
6431
|
-
});
|
|
6432
|
-
}
|
|
6433
|
-
// @__NO_SIDE_EFFECTS__
|
|
6434
|
-
function _lowercase(params) {
|
|
6435
|
-
return new $ZodCheckLowerCase({
|
|
6436
|
-
check: "string_format",
|
|
6437
|
-
format: "lowercase",
|
|
6438
|
-
...normalizeParams(params)
|
|
6439
|
-
});
|
|
6440
|
-
}
|
|
6441
|
-
// @__NO_SIDE_EFFECTS__
|
|
6442
|
-
function _uppercase(params) {
|
|
6443
|
-
return new $ZodCheckUpperCase({
|
|
6444
|
-
check: "string_format",
|
|
6445
|
-
format: "uppercase",
|
|
6446
|
-
...normalizeParams(params)
|
|
6447
|
-
});
|
|
6448
|
-
}
|
|
6449
|
-
// @__NO_SIDE_EFFECTS__
|
|
6450
|
-
function _includes(includes, params) {
|
|
6451
|
-
return new $ZodCheckIncludes({
|
|
6452
|
-
check: "string_format",
|
|
6453
|
-
format: "includes",
|
|
6454
|
-
...normalizeParams(params),
|
|
6455
|
-
includes
|
|
6456
|
-
});
|
|
6457
|
-
}
|
|
6458
|
-
// @__NO_SIDE_EFFECTS__
|
|
6459
|
-
function _startsWith(prefix, params) {
|
|
6460
|
-
return new $ZodCheckStartsWith({
|
|
6461
|
-
check: "string_format",
|
|
6462
|
-
format: "starts_with",
|
|
6463
|
-
...normalizeParams(params),
|
|
6464
|
-
prefix
|
|
6465
|
-
});
|
|
6466
|
-
}
|
|
6467
|
-
// @__NO_SIDE_EFFECTS__
|
|
6468
|
-
function _endsWith(suffix, params) {
|
|
6469
|
-
return new $ZodCheckEndsWith({
|
|
6470
|
-
check: "string_format",
|
|
6471
|
-
format: "ends_with",
|
|
6472
|
-
...normalizeParams(params),
|
|
6473
|
-
suffix
|
|
6474
|
-
});
|
|
6475
|
-
}
|
|
6476
|
-
// @__NO_SIDE_EFFECTS__
|
|
6477
|
-
function _overwrite(tx) {
|
|
6478
|
-
return new $ZodCheckOverwrite({
|
|
6479
|
-
check: "overwrite",
|
|
6480
|
-
tx
|
|
6481
|
-
});
|
|
6482
|
-
}
|
|
6483
|
-
// @__NO_SIDE_EFFECTS__
|
|
6484
|
-
function _normalize(form) {
|
|
6485
|
-
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
6486
|
-
}
|
|
6487
|
-
// @__NO_SIDE_EFFECTS__
|
|
6488
|
-
function _trim() {
|
|
6489
|
-
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
6490
|
-
}
|
|
6491
|
-
// @__NO_SIDE_EFFECTS__
|
|
6492
|
-
function _toLowerCase() {
|
|
6493
|
-
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
6494
|
-
}
|
|
6495
|
-
// @__NO_SIDE_EFFECTS__
|
|
6496
|
-
function _toUpperCase() {
|
|
6497
|
-
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
6498
|
-
}
|
|
6499
|
-
// @__NO_SIDE_EFFECTS__
|
|
6500
|
-
function _slugify() {
|
|
6501
|
-
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
6502
|
-
}
|
|
6503
|
-
// @__NO_SIDE_EFFECTS__
|
|
6504
|
-
function _array(Class, element, params) {
|
|
6505
|
-
return new Class({
|
|
6506
|
-
type: "array",
|
|
6507
|
-
element,
|
|
6508
|
-
...normalizeParams(params)
|
|
6509
|
-
});
|
|
6510
|
-
}
|
|
6511
|
-
// @__NO_SIDE_EFFECTS__
|
|
6512
|
-
function _refine(Class, fn, _params) {
|
|
6513
|
-
return new Class({
|
|
6514
|
-
type: "custom",
|
|
6515
|
-
check: "custom",
|
|
6516
|
-
fn,
|
|
6517
|
-
...normalizeParams(_params)
|
|
6518
|
-
});
|
|
6519
|
-
}
|
|
6520
|
-
// @__NO_SIDE_EFFECTS__
|
|
6521
|
-
function _superRefine(fn, params) {
|
|
6522
|
-
const ch = /* @__PURE__ */ _check((payload) => {
|
|
6523
|
-
payload.addIssue = (issue$2) => {
|
|
6524
|
-
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
6525
|
-
else {
|
|
6526
|
-
const _issue = issue$2;
|
|
6527
|
-
if (_issue.fatal) _issue.continue = false;
|
|
6528
|
-
_issue.code ?? (_issue.code = "custom");
|
|
6529
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
6530
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
6531
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
6532
|
-
payload.issues.push(issue(_issue));
|
|
6533
|
-
}
|
|
6534
|
-
};
|
|
6535
|
-
return fn(payload.value, payload);
|
|
6536
|
-
}, params);
|
|
6537
|
-
return ch;
|
|
6538
|
-
}
|
|
6539
|
-
// @__NO_SIDE_EFFECTS__
|
|
6540
|
-
function _check(fn, params) {
|
|
6541
|
-
const ch = new $ZodCheck({
|
|
6542
|
-
check: "custom",
|
|
6543
|
-
...normalizeParams(params)
|
|
6544
|
-
});
|
|
6545
|
-
ch._zod.check = fn;
|
|
6546
|
-
return ch;
|
|
6547
|
-
}
|
|
6548
|
-
//#endregion
|
|
6549
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
|
|
6550
|
-
function initializeContext(params) {
|
|
6551
|
-
let target = params?.target ?? "draft-2020-12";
|
|
6552
|
-
if (target === "draft-4") target = "draft-04";
|
|
6553
|
-
if (target === "draft-7") target = "draft-07";
|
|
6554
|
-
return {
|
|
6555
|
-
processors: params.processors ?? {},
|
|
6556
|
-
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
6557
|
-
target,
|
|
6558
|
-
unrepresentable: params?.unrepresentable ?? "throw",
|
|
6559
|
-
override: params?.override ?? (() => {}),
|
|
6560
|
-
io: params?.io ?? "output",
|
|
6561
|
-
counter: 0,
|
|
6562
|
-
seen: /* @__PURE__ */ new Map(),
|
|
6563
|
-
cycles: params?.cycles ?? "ref",
|
|
6564
|
-
reused: params?.reused ?? "inline",
|
|
6565
|
-
external: params?.external ?? void 0
|
|
6566
|
-
};
|
|
6567
|
-
}
|
|
6568
|
-
function process(schema, ctx, _params = {
|
|
6569
|
-
path: [],
|
|
6570
|
-
schemaPath: []
|
|
6571
|
-
}) {
|
|
6572
|
-
var _a;
|
|
6573
|
-
const def = schema._zod.def;
|
|
6574
|
-
const seen = ctx.seen.get(schema);
|
|
6575
|
-
if (seen) {
|
|
6576
|
-
seen.count++;
|
|
6577
|
-
if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
|
|
6578
|
-
return seen.schema;
|
|
6579
|
-
}
|
|
6580
|
-
const result = {
|
|
6581
|
-
schema: {},
|
|
6582
|
-
count: 1,
|
|
6583
|
-
cycle: void 0,
|
|
6584
|
-
path: _params.path
|
|
6585
|
-
};
|
|
6586
|
-
ctx.seen.set(schema, result);
|
|
6587
|
-
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
6588
|
-
if (overrideSchema) result.schema = overrideSchema;
|
|
6589
|
-
else {
|
|
6590
|
-
const params = {
|
|
6591
|
-
..._params,
|
|
6592
|
-
schemaPath: [..._params.schemaPath, schema],
|
|
6593
|
-
path: _params.path
|
|
6594
|
-
};
|
|
6595
|
-
if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
6596
|
-
else {
|
|
6597
|
-
const _json = result.schema;
|
|
6598
|
-
const processor = ctx.processors[def.type];
|
|
6599
|
-
if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
6600
|
-
processor(schema, ctx, _json, params);
|
|
6601
|
-
}
|
|
6602
|
-
const parent = schema._zod.parent;
|
|
6603
|
-
if (parent) {
|
|
6604
|
-
if (!result.ref) result.ref = parent;
|
|
6605
|
-
process(parent, ctx, params);
|
|
6606
|
-
ctx.seen.get(parent).isParent = true;
|
|
6607
|
-
}
|
|
6608
|
-
}
|
|
6609
|
-
const meta = ctx.metadataRegistry.get(schema);
|
|
6610
|
-
if (meta) Object.assign(result.schema, meta);
|
|
6611
|
-
if (ctx.io === "input" && isTransforming(schema)) {
|
|
6612
|
-
delete result.schema.examples;
|
|
6613
|
-
delete result.schema.default;
|
|
6614
|
-
}
|
|
6615
|
-
if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
6616
|
-
delete result.schema._prefault;
|
|
6617
|
-
return ctx.seen.get(schema).schema;
|
|
6618
|
-
}
|
|
6619
|
-
function extractDefs(ctx, schema) {
|
|
6620
|
-
const root = ctx.seen.get(schema);
|
|
6621
|
-
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
6622
|
-
const idToSchema = /* @__PURE__ */ new Map();
|
|
6623
|
-
for (const entry of ctx.seen.entries()) {
|
|
6624
|
-
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
6625
|
-
if (id) {
|
|
6626
|
-
const existing = idToSchema.get(id);
|
|
6627
|
-
if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
6628
|
-
idToSchema.set(id, entry[0]);
|
|
6629
|
-
}
|
|
6630
|
-
}
|
|
6631
|
-
const makeURI = (entry) => {
|
|
6632
|
-
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
6633
|
-
if (ctx.external) {
|
|
6634
|
-
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
6635
|
-
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
6636
|
-
if (externalId) return { ref: uriGenerator(externalId) };
|
|
6637
|
-
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
6638
|
-
entry[1].defId = id;
|
|
6639
|
-
return {
|
|
6640
|
-
defId: id,
|
|
6641
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
6642
|
-
};
|
|
6643
|
-
}
|
|
6644
|
-
if (entry[1] === root) return { ref: "#" };
|
|
6645
|
-
const defUriPrefix = `#/${defsSegment}/`;
|
|
6646
|
-
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
6647
|
-
return {
|
|
6648
|
-
defId,
|
|
6649
|
-
ref: defUriPrefix + defId
|
|
6650
|
-
};
|
|
6651
|
-
};
|
|
6652
|
-
const extractToDef = (entry) => {
|
|
6653
|
-
if (entry[1].schema.$ref) return;
|
|
6654
|
-
const seen = entry[1];
|
|
6655
|
-
const { ref, defId } = makeURI(entry);
|
|
6656
|
-
seen.def = { ...seen.schema };
|
|
6657
|
-
if (defId) seen.defId = defId;
|
|
6658
|
-
const schema = seen.schema;
|
|
6659
|
-
for (const key in schema) delete schema[key];
|
|
6660
|
-
schema.$ref = ref;
|
|
6661
|
-
};
|
|
6662
|
-
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
6663
|
-
const seen = entry[1];
|
|
6664
|
-
if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
6665
|
-
|
|
6666
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
6667
|
-
}
|
|
6668
|
-
for (const entry of ctx.seen.entries()) {
|
|
6669
|
-
const seen = entry[1];
|
|
6670
|
-
if (schema === entry[0]) {
|
|
6671
|
-
extractToDef(entry);
|
|
6672
|
-
continue;
|
|
6673
|
-
}
|
|
6674
|
-
if (ctx.external) {
|
|
6675
|
-
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
6676
|
-
if (schema !== entry[0] && ext) {
|
|
6677
|
-
extractToDef(entry);
|
|
6678
|
-
continue;
|
|
6679
|
-
}
|
|
6680
|
-
}
|
|
6681
|
-
if (ctx.metadataRegistry.get(entry[0])?.id) {
|
|
6682
|
-
extractToDef(entry);
|
|
6683
|
-
continue;
|
|
6684
|
-
}
|
|
6685
|
-
if (seen.cycle) {
|
|
6686
|
-
extractToDef(entry);
|
|
6687
|
-
continue;
|
|
6688
|
-
}
|
|
6689
|
-
if (seen.count > 1) {
|
|
6690
|
-
if (ctx.reused === "ref") {
|
|
6691
|
-
extractToDef(entry);
|
|
6692
|
-
continue;
|
|
6693
|
-
}
|
|
6694
|
-
}
|
|
6695
|
-
}
|
|
6696
|
-
}
|
|
6697
|
-
function finalize(ctx, schema) {
|
|
6698
|
-
const root = ctx.seen.get(schema);
|
|
6699
|
-
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
6700
|
-
const flattenRef = (zodSchema) => {
|
|
6701
|
-
const seen = ctx.seen.get(zodSchema);
|
|
6702
|
-
if (seen.ref === null) return;
|
|
6703
|
-
const schema = seen.def ?? seen.schema;
|
|
6704
|
-
const _cached = { ...schema };
|
|
6705
|
-
const ref = seen.ref;
|
|
6706
|
-
seen.ref = null;
|
|
6707
|
-
if (ref) {
|
|
6708
|
-
flattenRef(ref);
|
|
6709
|
-
const refSeen = ctx.seen.get(ref);
|
|
6710
|
-
const refSchema = refSeen.schema;
|
|
6711
|
-
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
6712
|
-
schema.allOf = schema.allOf ?? [];
|
|
6713
|
-
schema.allOf.push(refSchema);
|
|
6714
|
-
} else Object.assign(schema, refSchema);
|
|
6715
|
-
Object.assign(schema, _cached);
|
|
6716
|
-
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
6717
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
6718
|
-
if (!(key in _cached)) delete schema[key];
|
|
6719
|
-
}
|
|
6720
|
-
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
6721
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
6722
|
-
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
6723
|
-
}
|
|
6724
|
-
}
|
|
6725
|
-
const parent = zodSchema._zod.parent;
|
|
6726
|
-
if (parent && parent !== ref) {
|
|
6727
|
-
flattenRef(parent);
|
|
6728
|
-
const parentSeen = ctx.seen.get(parent);
|
|
6729
|
-
if (parentSeen?.schema.$ref) {
|
|
6730
|
-
schema.$ref = parentSeen.schema.$ref;
|
|
6731
|
-
if (parentSeen.def) for (const key in schema) {
|
|
6732
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
6733
|
-
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
6734
|
-
}
|
|
6735
|
-
}
|
|
6736
|
-
}
|
|
6737
|
-
ctx.override({
|
|
6738
|
-
zodSchema,
|
|
6739
|
-
jsonSchema: schema,
|
|
6740
|
-
path: seen.path ?? []
|
|
6741
|
-
});
|
|
6742
|
-
};
|
|
6743
|
-
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
6744
|
-
const result = {};
|
|
6745
|
-
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
6746
|
-
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
6747
|
-
else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
6748
|
-
else if (ctx.target === "openapi-3.0") {}
|
|
6749
|
-
if (ctx.external?.uri) {
|
|
6750
|
-
const id = ctx.external.registry.get(schema)?.id;
|
|
6751
|
-
if (!id) throw new Error("Schema is missing an `id` property");
|
|
6752
|
-
result.$id = ctx.external.uri(id);
|
|
6753
|
-
}
|
|
6754
|
-
Object.assign(result, root.def ?? root.schema);
|
|
6755
|
-
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
6756
|
-
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
6757
|
-
const defs = ctx.external?.defs ?? {};
|
|
6758
|
-
for (const entry of ctx.seen.entries()) {
|
|
6759
|
-
const seen = entry[1];
|
|
6760
|
-
if (seen.def && seen.defId) {
|
|
6761
|
-
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
6762
|
-
defs[seen.defId] = seen.def;
|
|
6763
|
-
}
|
|
6764
|
-
}
|
|
6765
|
-
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
6766
|
-
else result.definitions = defs;
|
|
6767
|
-
try {
|
|
6768
|
-
const finalized = JSON.parse(JSON.stringify(result));
|
|
6769
|
-
Object.defineProperty(finalized, "~standard", {
|
|
6770
|
-
value: {
|
|
6771
|
-
...schema["~standard"],
|
|
6772
|
-
jsonSchema: {
|
|
6773
|
-
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
6774
|
-
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
6775
|
-
}
|
|
6776
|
-
},
|
|
6777
|
-
enumerable: false,
|
|
6778
|
-
writable: false
|
|
6779
|
-
});
|
|
6780
|
-
return finalized;
|
|
6781
|
-
} catch (_err) {
|
|
6782
|
-
throw new Error("Error converting schema to JSON.");
|
|
6783
|
-
}
|
|
6784
|
-
}
|
|
6785
|
-
function isTransforming(_schema, _ctx) {
|
|
6786
|
-
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
6787
|
-
if (ctx.seen.has(_schema)) return false;
|
|
6788
|
-
ctx.seen.add(_schema);
|
|
6789
|
-
const def = _schema._zod.def;
|
|
6790
|
-
if (def.type === "transform") return true;
|
|
6791
|
-
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
6792
|
-
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
6793
|
-
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
6794
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
|
|
6795
|
-
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
6796
|
-
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
6797
|
-
if (def.type === "pipe") {
|
|
6798
|
-
if (_schema._zod.traits.has("$ZodCodec")) return true;
|
|
6799
|
-
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
6800
|
-
}
|
|
6801
|
-
if (def.type === "object") {
|
|
6802
|
-
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
6803
|
-
return false;
|
|
6804
|
-
}
|
|
6805
|
-
if (def.type === "union") {
|
|
6806
|
-
for (const option of def.options) if (isTransforming(option, ctx)) return true;
|
|
6807
|
-
return false;
|
|
6808
|
-
}
|
|
6809
|
-
if (def.type === "tuple") {
|
|
6810
|
-
for (const item of def.items) if (isTransforming(item, ctx)) return true;
|
|
6811
|
-
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
|
6812
|
-
return false;
|
|
6813
|
-
}
|
|
6814
|
-
return false;
|
|
6815
|
-
}
|
|
6816
|
-
/**
|
|
6817
|
-
* Creates a toJSONSchema method for a schema instance.
|
|
6818
|
-
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
6819
|
-
*/
|
|
6820
|
-
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
6821
|
-
const ctx = initializeContext({
|
|
6822
|
-
...params,
|
|
6823
|
-
processors
|
|
6824
|
-
});
|
|
6825
|
-
process(schema, ctx);
|
|
6826
|
-
extractDefs(ctx, schema);
|
|
6827
|
-
return finalize(ctx, schema);
|
|
6828
|
-
};
|
|
6829
|
-
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
6830
|
-
const { libraryOptions, target } = params ?? {};
|
|
6831
|
-
const ctx = initializeContext({
|
|
6832
|
-
...libraryOptions ?? {},
|
|
6833
|
-
target,
|
|
6834
|
-
io,
|
|
6835
|
-
processors
|
|
6836
|
-
});
|
|
6837
|
-
process(schema, ctx);
|
|
6838
|
-
extractDefs(ctx, schema);
|
|
6839
|
-
return finalize(ctx, schema);
|
|
6840
|
-
};
|
|
6841
|
-
//#endregion
|
|
6842
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
6843
|
-
const formatMap = {
|
|
6844
|
-
guid: "uuid",
|
|
6845
|
-
url: "uri",
|
|
6846
|
-
datetime: "date-time",
|
|
6847
|
-
json_string: "json-string",
|
|
6848
|
-
regex: ""
|
|
6849
|
-
};
|
|
6850
|
-
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
6851
|
-
const json = _json;
|
|
6852
|
-
json.type = "string";
|
|
6853
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
6854
|
-
if (typeof minimum === "number") json.minLength = minimum;
|
|
6855
|
-
if (typeof maximum === "number") json.maxLength = maximum;
|
|
6856
|
-
if (format) {
|
|
6857
|
-
json.format = formatMap[format] ?? format;
|
|
6858
|
-
if (json.format === "") delete json.format;
|
|
6859
|
-
if (format === "time") delete json.format;
|
|
6860
|
-
}
|
|
6861
|
-
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
6862
|
-
if (patterns && patterns.size > 0) {
|
|
6863
|
-
const regexes = [...patterns];
|
|
6864
|
-
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
6865
|
-
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
6866
|
-
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
6867
|
-
pattern: regex.source
|
|
6868
|
-
}))];
|
|
6869
|
-
}
|
|
6870
|
-
};
|
|
6871
|
-
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
6872
|
-
const json = _json;
|
|
6873
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
6874
|
-
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
6875
|
-
else json.type = "number";
|
|
6876
|
-
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
6877
|
-
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
6878
|
-
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
6879
|
-
if (exMin) if (legacy) {
|
|
6880
|
-
json.minimum = exclusiveMinimum;
|
|
6881
|
-
json.exclusiveMinimum = true;
|
|
6882
|
-
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
6883
|
-
else if (typeof minimum === "number") json.minimum = minimum;
|
|
6884
|
-
if (exMax) if (legacy) {
|
|
6885
|
-
json.maximum = exclusiveMaximum;
|
|
6886
|
-
json.exclusiveMaximum = true;
|
|
6887
|
-
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
6888
|
-
else if (typeof maximum === "number") json.maximum = maximum;
|
|
6889
|
-
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
6890
|
-
};
|
|
6891
|
-
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
6892
|
-
json.type = "boolean";
|
|
6893
|
-
};
|
|
6894
|
-
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
6895
|
-
json.not = {};
|
|
6896
|
-
};
|
|
6897
|
-
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
6898
|
-
const def = schema._zod.def;
|
|
6899
|
-
const values = getEnumValues(def.entries);
|
|
6900
|
-
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
6901
|
-
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
6902
|
-
json.enum = values;
|
|
6903
|
-
};
|
|
6904
|
-
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
6905
|
-
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
6906
|
-
};
|
|
6907
|
-
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
6908
|
-
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
6909
|
-
};
|
|
6910
|
-
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
6911
|
-
const json = _json;
|
|
6912
|
-
const def = schema._zod.def;
|
|
6913
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
6914
|
-
if (typeof minimum === "number") json.minItems = minimum;
|
|
6915
|
-
if (typeof maximum === "number") json.maxItems = maximum;
|
|
6916
|
-
json.type = "array";
|
|
6917
|
-
json.items = process(def.element, ctx, {
|
|
6918
|
-
...params,
|
|
6919
|
-
path: [...params.path, "items"]
|
|
6920
|
-
});
|
|
6921
|
-
};
|
|
6922
|
-
const objectProcessor = (schema, ctx, _json, params) => {
|
|
6923
|
-
const json = _json;
|
|
6924
|
-
const def = schema._zod.def;
|
|
6925
|
-
json.type = "object";
|
|
6926
|
-
json.properties = {};
|
|
6927
|
-
const shape = def.shape;
|
|
6928
|
-
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
6929
|
-
...params,
|
|
6930
|
-
path: [
|
|
6931
|
-
...params.path,
|
|
6932
|
-
"properties",
|
|
6933
|
-
key
|
|
6934
|
-
]
|
|
6935
|
-
});
|
|
6936
|
-
const allKeys = new Set(Object.keys(shape));
|
|
6937
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
6938
|
-
const v = def.shape[key]._zod;
|
|
6939
|
-
if (ctx.io === "input") return v.optin === void 0;
|
|
6940
|
-
else return v.optout === void 0;
|
|
6941
|
-
}));
|
|
6942
|
-
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
6943
|
-
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
6944
|
-
else if (!def.catchall) {
|
|
6945
|
-
if (ctx.io === "output") json.additionalProperties = false;
|
|
6946
|
-
} else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
|
|
6947
|
-
...params,
|
|
6948
|
-
path: [...params.path, "additionalProperties"]
|
|
6949
|
-
});
|
|
6950
|
-
};
|
|
6951
|
-
const unionProcessor = (schema, ctx, json, params) => {
|
|
6952
|
-
const def = schema._zod.def;
|
|
6953
|
-
const isExclusive = def.inclusive === false;
|
|
6954
|
-
const options = def.options.map((x, i) => process(x, ctx, {
|
|
6955
|
-
...params,
|
|
6956
|
-
path: [
|
|
6957
|
-
...params.path,
|
|
6958
|
-
isExclusive ? "oneOf" : "anyOf",
|
|
6959
|
-
i
|
|
6960
|
-
]
|
|
6961
|
-
}));
|
|
6962
|
-
if (isExclusive) json.oneOf = options;
|
|
6963
|
-
else json.anyOf = options;
|
|
6964
|
-
};
|
|
6965
|
-
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
6966
|
-
const def = schema._zod.def;
|
|
6967
|
-
const a = process(def.left, ctx, {
|
|
6968
|
-
...params,
|
|
6969
|
-
path: [
|
|
6970
|
-
...params.path,
|
|
6971
|
-
"allOf",
|
|
6972
|
-
0
|
|
6973
|
-
]
|
|
6974
|
-
});
|
|
6975
|
-
const b = process(def.right, ctx, {
|
|
6976
|
-
...params,
|
|
6977
|
-
path: [
|
|
6978
|
-
...params.path,
|
|
6979
|
-
"allOf",
|
|
6980
|
-
1
|
|
6981
|
-
]
|
|
6982
|
-
});
|
|
6983
|
-
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
6984
|
-
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
6985
|
-
};
|
|
6986
|
-
const nullableProcessor = (schema, ctx, json, params) => {
|
|
6987
|
-
const def = schema._zod.def;
|
|
6988
|
-
const inner = process(def.innerType, ctx, params);
|
|
6989
|
-
const seen = ctx.seen.get(schema);
|
|
6990
|
-
if (ctx.target === "openapi-3.0") {
|
|
6991
|
-
seen.ref = def.innerType;
|
|
6992
|
-
json.nullable = true;
|
|
6993
|
-
} else json.anyOf = [inner, { type: "null" }];
|
|
6994
|
-
};
|
|
6995
|
-
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
6996
|
-
const def = schema._zod.def;
|
|
6997
|
-
process(def.innerType, ctx, params);
|
|
6998
|
-
const seen = ctx.seen.get(schema);
|
|
6999
|
-
seen.ref = def.innerType;
|
|
7000
|
-
};
|
|
7001
|
-
const defaultProcessor = (schema, ctx, json, params) => {
|
|
7002
|
-
const def = schema._zod.def;
|
|
7003
|
-
process(def.innerType, ctx, params);
|
|
7004
|
-
const seen = ctx.seen.get(schema);
|
|
7005
|
-
seen.ref = def.innerType;
|
|
7006
|
-
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
7007
|
-
};
|
|
7008
|
-
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
7009
|
-
const def = schema._zod.def;
|
|
7010
|
-
process(def.innerType, ctx, params);
|
|
7011
|
-
const seen = ctx.seen.get(schema);
|
|
7012
|
-
seen.ref = def.innerType;
|
|
7013
|
-
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
7014
|
-
};
|
|
7015
|
-
const catchProcessor = (schema, ctx, json, params) => {
|
|
7016
|
-
const def = schema._zod.def;
|
|
7017
|
-
process(def.innerType, ctx, params);
|
|
7018
|
-
const seen = ctx.seen.get(schema);
|
|
7019
|
-
seen.ref = def.innerType;
|
|
7020
|
-
let catchValue;
|
|
7021
|
-
try {
|
|
7022
|
-
catchValue = def.catchValue(void 0);
|
|
7023
|
-
} catch {
|
|
7024
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
4153
|
+
return inspectRequestPrompt(previous, event, system);
|
|
4154
|
+
}
|
|
4155
|
+
drop(record, releaseScope) {
|
|
4156
|
+
if (this.bindings.get(record.source) !== record) return;
|
|
4157
|
+
this.bindings.delete(record.source);
|
|
4158
|
+
record.binding.dispose();
|
|
4159
|
+
if (releaseScope) record.disposeScope();
|
|
7025
4160
|
}
|
|
7026
|
-
json.default = catchValue;
|
|
7027
|
-
};
|
|
7028
|
-
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
7029
|
-
const def = schema._zod.def;
|
|
7030
|
-
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
7031
|
-
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
7032
|
-
process(innerType, ctx, params);
|
|
7033
|
-
const seen = ctx.seen.get(schema);
|
|
7034
|
-
seen.ref = innerType;
|
|
7035
|
-
};
|
|
7036
|
-
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
7037
|
-
const def = schema._zod.def;
|
|
7038
|
-
process(def.innerType, ctx, params);
|
|
7039
|
-
const seen = ctx.seen.get(schema);
|
|
7040
|
-
seen.ref = def.innerType;
|
|
7041
|
-
json.readOnly = true;
|
|
7042
|
-
};
|
|
7043
|
-
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
7044
|
-
const def = schema._zod.def;
|
|
7045
|
-
process(def.innerType, ctx, params);
|
|
7046
|
-
const seen = ctx.seen.get(schema);
|
|
7047
|
-
seen.ref = def.innerType;
|
|
7048
4161
|
};
|
|
7049
4162
|
//#endregion
|
|
7050
|
-
//#region
|
|
7051
|
-
const
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
$ZodISODate.init(inst, def);
|
|
7060
|
-
ZodStringFormat.init(inst, def);
|
|
7061
|
-
});
|
|
7062
|
-
function date(params) {
|
|
7063
|
-
return /* @__PURE__ */ _isoDate(ZodISODate, params);
|
|
7064
|
-
}
|
|
7065
|
-
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
7066
|
-
$ZodISOTime.init(inst, def);
|
|
7067
|
-
ZodStringFormat.init(inst, def);
|
|
7068
|
-
});
|
|
7069
|
-
function time(params) {
|
|
7070
|
-
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
7071
|
-
}
|
|
7072
|
-
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
7073
|
-
$ZodISODuration.init(inst, def);
|
|
7074
|
-
ZodStringFormat.init(inst, def);
|
|
7075
|
-
});
|
|
7076
|
-
function duration(params) {
|
|
7077
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
4163
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-conversation/src/client/user-text/UserText.module.css.mjs
|
|
4164
|
+
const css$9 = ".BNl2La_root{display:contents}.BNl2La_ellipsis{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:100%;display:block;overflow:hidden}";
|
|
4165
|
+
const tagId$9 = "@deepseek-ai/dsh-client-ui-conversation/UserText.module.css";
|
|
4166
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
|
|
4167
|
+
const tag = document.createElement("style");
|
|
4168
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-conversation";
|
|
4169
|
+
tag.dataset.pluginCss = tagId$9;
|
|
4170
|
+
tag.textContent = css$9;
|
|
4171
|
+
document.head.appendChild(tag);
|
|
7078
4172
|
}
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
$ZodError.init(inst, issues);
|
|
7083
|
-
inst.name = "ZodError";
|
|
7084
|
-
Object.defineProperties(inst, {
|
|
7085
|
-
format: { value: (mapper) => formatError(inst, mapper) },
|
|
7086
|
-
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
7087
|
-
addIssue: { value: (issue) => {
|
|
7088
|
-
inst.issues.push(issue);
|
|
7089
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7090
|
-
} },
|
|
7091
|
-
addIssues: { value: (issues) => {
|
|
7092
|
-
inst.issues.push(...issues);
|
|
7093
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
7094
|
-
} },
|
|
7095
|
-
isEmpty: { get() {
|
|
7096
|
-
return inst.issues.length === 0;
|
|
7097
|
-
} }
|
|
7098
|
-
});
|
|
4173
|
+
var UserText_module_css_default = {
|
|
4174
|
+
"ellipsis": "BNl2La_ellipsis",
|
|
4175
|
+
"root": "BNl2La_root"
|
|
7099
4176
|
};
|
|
7100
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
7101
|
-
//#endregion
|
|
7102
|
-
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
7103
|
-
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
7104
|
-
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
7105
|
-
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
7106
|
-
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
7107
|
-
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
7108
|
-
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
7109
|
-
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
7110
|
-
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
7111
|
-
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
7112
|
-
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
7113
|
-
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
7114
|
-
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
7115
4177
|
//#endregion
|
|
7116
|
-
//#region
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
const bound = fn.bind(this);
|
|
7134
|
-
Object.defineProperty(this, key, {
|
|
7135
|
-
configurable: true,
|
|
7136
|
-
writable: true,
|
|
7137
|
-
enumerable: true,
|
|
7138
|
-
value: bound
|
|
7139
|
-
});
|
|
7140
|
-
return bound;
|
|
7141
|
-
},
|
|
7142
|
-
set(v) {
|
|
7143
|
-
Object.defineProperty(this, key, {
|
|
7144
|
-
configurable: true,
|
|
7145
|
-
writable: true,
|
|
7146
|
-
enumerable: true,
|
|
7147
|
-
value: v
|
|
7148
|
-
});
|
|
7149
|
-
}
|
|
4178
|
+
//#region lib/types/client/user-text/UserText.js
|
|
4179
|
+
/** User-text presentation delegates evaluation to its data-layer document and renders JSON business nodes. */
|
|
4180
|
+
/**
|
|
4181
|
+
* Render original text through pure matching rules and business-owned node Slots.
|
|
4182
|
+
* A failed parse retains the entire original text and reports the rule error.
|
|
4183
|
+
* @param props - original text, confirmed facts, display policy, and framework seats.
|
|
4184
|
+
* @returns ordered inline nodes with raw-text fallbacks for missing registrations.
|
|
4185
|
+
*/
|
|
4186
|
+
function UserText({ text, facts, interactive = false, ellipsis = false, useUserTextRevision, createUserTextEvaluator, reportTransformFailure, renderSlot }) {
|
|
4187
|
+
useUserTextRevision((revision) => revision);
|
|
4188
|
+
const evaluate = (0, react.useMemo)(createUserTextEvaluator, [createUserTextEvaluator]);
|
|
4189
|
+
let nodes;
|
|
4190
|
+
let error;
|
|
4191
|
+
try {
|
|
4192
|
+
nodes = evaluate({
|
|
4193
|
+
text,
|
|
4194
|
+
facts
|
|
7150
4195
|
});
|
|
4196
|
+
} catch (cause) {
|
|
4197
|
+
error = cause;
|
|
7151
4198
|
}
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
7180
|
-
check: ch,
|
|
7181
|
-
def: { check: "custom" },
|
|
7182
|
-
onattach: []
|
|
7183
|
-
} } : ch)] }), { parent: true });
|
|
7184
|
-
},
|
|
7185
|
-
with(...chks) {
|
|
7186
|
-
return this.check(...chks);
|
|
7187
|
-
},
|
|
7188
|
-
clone(def, params) {
|
|
7189
|
-
return clone(this, def, params);
|
|
7190
|
-
},
|
|
7191
|
-
brand() {
|
|
7192
|
-
return this;
|
|
7193
|
-
},
|
|
7194
|
-
register(reg, meta) {
|
|
7195
|
-
reg.add(this, meta);
|
|
7196
|
-
return this;
|
|
7197
|
-
},
|
|
7198
|
-
refine(check, params) {
|
|
7199
|
-
return this.check(refine(check, params));
|
|
7200
|
-
},
|
|
7201
|
-
superRefine(refinement, params) {
|
|
7202
|
-
return this.check(superRefine(refinement, params));
|
|
7203
|
-
},
|
|
7204
|
-
overwrite(fn) {
|
|
7205
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
7206
|
-
},
|
|
7207
|
-
optional() {
|
|
7208
|
-
return optional(this);
|
|
7209
|
-
},
|
|
7210
|
-
exactOptional() {
|
|
7211
|
-
return exactOptional(this);
|
|
7212
|
-
},
|
|
7213
|
-
nullable() {
|
|
7214
|
-
return nullable(this);
|
|
7215
|
-
},
|
|
7216
|
-
nullish() {
|
|
7217
|
-
return optional(nullable(this));
|
|
7218
|
-
},
|
|
7219
|
-
nonoptional(params) {
|
|
7220
|
-
return nonoptional(this, params);
|
|
7221
|
-
},
|
|
7222
|
-
array() {
|
|
7223
|
-
return array(this);
|
|
7224
|
-
},
|
|
7225
|
-
or(arg) {
|
|
7226
|
-
return union([this, arg]);
|
|
7227
|
-
},
|
|
7228
|
-
and(arg) {
|
|
7229
|
-
return intersection(this, arg);
|
|
7230
|
-
},
|
|
7231
|
-
transform(tx) {
|
|
7232
|
-
return pipe(this, transform(tx));
|
|
7233
|
-
},
|
|
7234
|
-
default(d) {
|
|
7235
|
-
return _default(this, d);
|
|
7236
|
-
},
|
|
7237
|
-
prefault(d) {
|
|
7238
|
-
return prefault(this, d);
|
|
7239
|
-
},
|
|
7240
|
-
catch(params) {
|
|
7241
|
-
return _catch(this, params);
|
|
7242
|
-
},
|
|
7243
|
-
pipe(target) {
|
|
7244
|
-
return pipe(this, target);
|
|
7245
|
-
},
|
|
7246
|
-
readonly() {
|
|
7247
|
-
return readonly(this);
|
|
7248
|
-
},
|
|
7249
|
-
describe(description) {
|
|
7250
|
-
const cl = this.clone();
|
|
7251
|
-
globalRegistry.add(cl, { description });
|
|
7252
|
-
return cl;
|
|
7253
|
-
},
|
|
7254
|
-
meta(...args) {
|
|
7255
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
7256
|
-
const cl = this.clone();
|
|
7257
|
-
globalRegistry.add(cl, args[0]);
|
|
7258
|
-
return cl;
|
|
7259
|
-
},
|
|
7260
|
-
isOptional() {
|
|
7261
|
-
return this.safeParse(void 0).success;
|
|
7262
|
-
},
|
|
7263
|
-
isNullable() {
|
|
7264
|
-
return this.safeParse(null).success;
|
|
7265
|
-
},
|
|
7266
|
-
apply(fn) {
|
|
7267
|
-
return fn(this);
|
|
7268
|
-
}
|
|
7269
|
-
});
|
|
7270
|
-
Object.defineProperty(inst, "description", {
|
|
7271
|
-
get() {
|
|
7272
|
-
return globalRegistry.get(inst)?.description;
|
|
7273
|
-
},
|
|
7274
|
-
configurable: true
|
|
7275
|
-
});
|
|
7276
|
-
return inst;
|
|
7277
|
-
});
|
|
7278
|
-
/** @internal */
|
|
7279
|
-
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
7280
|
-
$ZodString.init(inst, def);
|
|
7281
|
-
ZodType.init(inst, def);
|
|
7282
|
-
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
7283
|
-
const bag = inst._zod.bag;
|
|
7284
|
-
inst.format = bag.format ?? null;
|
|
7285
|
-
inst.minLength = bag.minimum ?? null;
|
|
7286
|
-
inst.maxLength = bag.maximum ?? null;
|
|
7287
|
-
_installLazyMethods(inst, "_ZodString", {
|
|
7288
|
-
regex(...args) {
|
|
7289
|
-
return this.check(/* @__PURE__ */ _regex(...args));
|
|
7290
|
-
},
|
|
7291
|
-
includes(...args) {
|
|
7292
|
-
return this.check(/* @__PURE__ */ _includes(...args));
|
|
7293
|
-
},
|
|
7294
|
-
startsWith(...args) {
|
|
7295
|
-
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
7296
|
-
},
|
|
7297
|
-
endsWith(...args) {
|
|
7298
|
-
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
7299
|
-
},
|
|
7300
|
-
min(...args) {
|
|
7301
|
-
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
7302
|
-
},
|
|
7303
|
-
max(...args) {
|
|
7304
|
-
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
7305
|
-
},
|
|
7306
|
-
length(...args) {
|
|
7307
|
-
return this.check(/* @__PURE__ */ _length(...args));
|
|
7308
|
-
},
|
|
7309
|
-
nonempty(...args) {
|
|
7310
|
-
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
7311
|
-
},
|
|
7312
|
-
lowercase(params) {
|
|
7313
|
-
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
7314
|
-
},
|
|
7315
|
-
uppercase(params) {
|
|
7316
|
-
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
7317
|
-
},
|
|
7318
|
-
trim() {
|
|
7319
|
-
return this.check(/* @__PURE__ */ _trim());
|
|
7320
|
-
},
|
|
7321
|
-
normalize(...args) {
|
|
7322
|
-
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
7323
|
-
},
|
|
7324
|
-
toLowerCase() {
|
|
7325
|
-
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
7326
|
-
},
|
|
7327
|
-
toUpperCase() {
|
|
7328
|
-
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
7329
|
-
},
|
|
7330
|
-
slugify() {
|
|
7331
|
-
return this.check(/* @__PURE__ */ _slugify());
|
|
7332
|
-
}
|
|
4199
|
+
const failed = nodes === void 0;
|
|
4200
|
+
(0, react.useEffect)(() => {
|
|
4201
|
+
if (failed) reportTransformFailure(error);
|
|
4202
|
+
}, [
|
|
4203
|
+
failed,
|
|
4204
|
+
error,
|
|
4205
|
+
reportTransformFailure
|
|
4206
|
+
]);
|
|
4207
|
+
const content = (0, react.useMemo)(() => nodes === void 0 ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.UserTextRun, { text }) : (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: nodes.map((node) => {
|
|
4208
|
+
const raw = text.slice(node.start, node.end);
|
|
4209
|
+
return (0, react_jsx_runtime.jsx)(react.Fragment, { children: renderSlot("conversation.user.text.node", {
|
|
4210
|
+
node,
|
|
4211
|
+
raw,
|
|
4212
|
+
interactive
|
|
4213
|
+
}, {
|
|
4214
|
+
entryKey: node.id,
|
|
4215
|
+
fallback: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.UserTextRun, { text: node.id === "text" ? node.data.display ?? raw : raw })
|
|
4216
|
+
}) }, `${node.id}:${node.start}`);
|
|
4217
|
+
}) }), [
|
|
4218
|
+
nodes,
|
|
4219
|
+
text,
|
|
4220
|
+
interactive,
|
|
4221
|
+
renderSlot
|
|
4222
|
+
]);
|
|
4223
|
+
return (0, react_jsx_runtime.jsx)("span", {
|
|
4224
|
+
className: ellipsis ? UserText_module_css_default.ellipsis : UserText_module_css_default.root,
|
|
4225
|
+
children: content
|
|
7333
4226
|
});
|
|
7334
|
-
});
|
|
7335
|
-
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
7336
|
-
$ZodString.init(inst, def);
|
|
7337
|
-
_ZodString.init(inst, def);
|
|
7338
|
-
inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
7339
|
-
inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
7340
|
-
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
7341
|
-
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
7342
|
-
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
7343
|
-
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
7344
|
-
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
7345
|
-
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
7346
|
-
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
7347
|
-
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
7348
|
-
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
7349
|
-
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
7350
|
-
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
7351
|
-
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
7352
|
-
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
7353
|
-
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
7354
|
-
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
7355
|
-
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
7356
|
-
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
7357
|
-
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
7358
|
-
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
7359
|
-
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
7360
|
-
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
7361
|
-
inst.datetime = (params) => inst.check(datetime(params));
|
|
7362
|
-
inst.date = (params) => inst.check(date(params));
|
|
7363
|
-
inst.time = (params) => inst.check(time(params));
|
|
7364
|
-
inst.duration = (params) => inst.check(duration(params));
|
|
7365
|
-
});
|
|
7366
|
-
function string(params) {
|
|
7367
|
-
return /* @__PURE__ */ _string(ZodString, params);
|
|
7368
4227
|
}
|
|
7369
|
-
const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
|
|
7370
|
-
$ZodStringFormat.init(inst, def);
|
|
7371
|
-
_ZodString.init(inst, def);
|
|
7372
|
-
});
|
|
7373
|
-
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
7374
|
-
$ZodEmail.init(inst, def);
|
|
7375
|
-
ZodStringFormat.init(inst, def);
|
|
7376
|
-
});
|
|
7377
|
-
const ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => {
|
|
7378
|
-
$ZodGUID.init(inst, def);
|
|
7379
|
-
ZodStringFormat.init(inst, def);
|
|
7380
|
-
});
|
|
7381
|
-
const ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => {
|
|
7382
|
-
$ZodUUID.init(inst, def);
|
|
7383
|
-
ZodStringFormat.init(inst, def);
|
|
7384
|
-
});
|
|
7385
|
-
const ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => {
|
|
7386
|
-
$ZodURL.init(inst, def);
|
|
7387
|
-
ZodStringFormat.init(inst, def);
|
|
7388
|
-
});
|
|
7389
|
-
const ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => {
|
|
7390
|
-
$ZodEmoji.init(inst, def);
|
|
7391
|
-
ZodStringFormat.init(inst, def);
|
|
7392
|
-
});
|
|
7393
|
-
const ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => {
|
|
7394
|
-
$ZodNanoID.init(inst, def);
|
|
7395
|
-
ZodStringFormat.init(inst, def);
|
|
7396
|
-
});
|
|
7397
4228
|
/**
|
|
7398
|
-
*
|
|
7399
|
-
*
|
|
7400
|
-
*
|
|
4229
|
+
* Display an unmatched substring without business interpretation.
|
|
4230
|
+
* @param props - parser-produced plain-text node.
|
|
4231
|
+
* @returns its inline text.
|
|
7401
4232
|
*/
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
ZodStringFormat.init(inst, def);
|
|
7405
|
-
});
|
|
7406
|
-
const ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => {
|
|
7407
|
-
$ZodCUID2.init(inst, def);
|
|
7408
|
-
ZodStringFormat.init(inst, def);
|
|
7409
|
-
});
|
|
7410
|
-
const ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => {
|
|
7411
|
-
$ZodULID.init(inst, def);
|
|
7412
|
-
ZodStringFormat.init(inst, def);
|
|
7413
|
-
});
|
|
7414
|
-
const ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => {
|
|
7415
|
-
$ZodXID.init(inst, def);
|
|
7416
|
-
ZodStringFormat.init(inst, def);
|
|
7417
|
-
});
|
|
7418
|
-
const ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => {
|
|
7419
|
-
$ZodKSUID.init(inst, def);
|
|
7420
|
-
ZodStringFormat.init(inst, def);
|
|
7421
|
-
});
|
|
7422
|
-
const ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
|
|
7423
|
-
$ZodIPv4.init(inst, def);
|
|
7424
|
-
ZodStringFormat.init(inst, def);
|
|
7425
|
-
});
|
|
7426
|
-
const ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
|
|
7427
|
-
$ZodIPv6.init(inst, def);
|
|
7428
|
-
ZodStringFormat.init(inst, def);
|
|
7429
|
-
});
|
|
7430
|
-
const ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
|
|
7431
|
-
$ZodCIDRv4.init(inst, def);
|
|
7432
|
-
ZodStringFormat.init(inst, def);
|
|
7433
|
-
});
|
|
7434
|
-
const ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => {
|
|
7435
|
-
$ZodCIDRv6.init(inst, def);
|
|
7436
|
-
ZodStringFormat.init(inst, def);
|
|
7437
|
-
});
|
|
7438
|
-
const ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => {
|
|
7439
|
-
$ZodBase64.init(inst, def);
|
|
7440
|
-
ZodStringFormat.init(inst, def);
|
|
7441
|
-
});
|
|
7442
|
-
const ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => {
|
|
7443
|
-
$ZodBase64URL.init(inst, def);
|
|
7444
|
-
ZodStringFormat.init(inst, def);
|
|
7445
|
-
});
|
|
7446
|
-
const ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => {
|
|
7447
|
-
$ZodE164.init(inst, def);
|
|
7448
|
-
ZodStringFormat.init(inst, def);
|
|
7449
|
-
});
|
|
7450
|
-
const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
|
|
7451
|
-
$ZodJWT.init(inst, def);
|
|
7452
|
-
ZodStringFormat.init(inst, def);
|
|
7453
|
-
});
|
|
7454
|
-
const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
7455
|
-
$ZodNumber.init(inst, def);
|
|
7456
|
-
ZodType.init(inst, def);
|
|
7457
|
-
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
7458
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
7459
|
-
gt(value, params) {
|
|
7460
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
7461
|
-
},
|
|
7462
|
-
gte(value, params) {
|
|
7463
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
7464
|
-
},
|
|
7465
|
-
min(value, params) {
|
|
7466
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
7467
|
-
},
|
|
7468
|
-
lt(value, params) {
|
|
7469
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
7470
|
-
},
|
|
7471
|
-
lte(value, params) {
|
|
7472
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
7473
|
-
},
|
|
7474
|
-
max(value, params) {
|
|
7475
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
7476
|
-
},
|
|
7477
|
-
int(params) {
|
|
7478
|
-
return this.check(int(params));
|
|
7479
|
-
},
|
|
7480
|
-
safe(params) {
|
|
7481
|
-
return this.check(int(params));
|
|
7482
|
-
},
|
|
7483
|
-
positive(params) {
|
|
7484
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
7485
|
-
},
|
|
7486
|
-
nonnegative(params) {
|
|
7487
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
7488
|
-
},
|
|
7489
|
-
negative(params) {
|
|
7490
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
7491
|
-
},
|
|
7492
|
-
nonpositive(params) {
|
|
7493
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
7494
|
-
},
|
|
7495
|
-
multipleOf(value, params) {
|
|
7496
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
7497
|
-
},
|
|
7498
|
-
step(value, params) {
|
|
7499
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
7500
|
-
},
|
|
7501
|
-
finite() {
|
|
7502
|
-
return this;
|
|
7503
|
-
}
|
|
7504
|
-
});
|
|
7505
|
-
const bag = inst._zod.bag;
|
|
7506
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
7507
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
7508
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
7509
|
-
inst.isFinite = true;
|
|
7510
|
-
inst.format = bag.format ?? null;
|
|
7511
|
-
});
|
|
7512
|
-
function number(params) {
|
|
7513
|
-
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
7514
|
-
}
|
|
7515
|
-
const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
|
|
7516
|
-
$ZodNumberFormat.init(inst, def);
|
|
7517
|
-
ZodNumber.init(inst, def);
|
|
7518
|
-
});
|
|
7519
|
-
function int(params) {
|
|
7520
|
-
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
7521
|
-
}
|
|
7522
|
-
const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
|
|
7523
|
-
$ZodBoolean.init(inst, def);
|
|
7524
|
-
ZodType.init(inst, def);
|
|
7525
|
-
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
7526
|
-
});
|
|
7527
|
-
function boolean(params) {
|
|
7528
|
-
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
7529
|
-
}
|
|
7530
|
-
const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
|
|
7531
|
-
$ZodUnknown.init(inst, def);
|
|
7532
|
-
ZodType.init(inst, def);
|
|
7533
|
-
inst._zod.processJSONSchema = (ctx, json, params) => void 0;
|
|
7534
|
-
});
|
|
7535
|
-
function unknown() {
|
|
7536
|
-
return /* @__PURE__ */ _unknown(ZodUnknown);
|
|
7537
|
-
}
|
|
7538
|
-
const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
|
|
7539
|
-
$ZodNever.init(inst, def);
|
|
7540
|
-
ZodType.init(inst, def);
|
|
7541
|
-
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
7542
|
-
});
|
|
7543
|
-
function never(params) {
|
|
7544
|
-
return /* @__PURE__ */ _never(ZodNever, params);
|
|
7545
|
-
}
|
|
7546
|
-
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
7547
|
-
$ZodArray.init(inst, def);
|
|
7548
|
-
ZodType.init(inst, def);
|
|
7549
|
-
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
7550
|
-
inst.element = def.element;
|
|
7551
|
-
_installLazyMethods(inst, "ZodArray", {
|
|
7552
|
-
min(n, params) {
|
|
7553
|
-
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
7554
|
-
},
|
|
7555
|
-
nonempty(params) {
|
|
7556
|
-
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
7557
|
-
},
|
|
7558
|
-
max(n, params) {
|
|
7559
|
-
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
7560
|
-
},
|
|
7561
|
-
length(n, params) {
|
|
7562
|
-
return this.check(/* @__PURE__ */ _length(n, params));
|
|
7563
|
-
},
|
|
7564
|
-
unwrap() {
|
|
7565
|
-
return this.element;
|
|
7566
|
-
}
|
|
7567
|
-
});
|
|
7568
|
-
});
|
|
7569
|
-
function array(element, params) {
|
|
7570
|
-
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
7571
|
-
}
|
|
7572
|
-
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
7573
|
-
$ZodObjectJIT.init(inst, def);
|
|
7574
|
-
ZodType.init(inst, def);
|
|
7575
|
-
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
7576
|
-
defineLazy(inst, "shape", () => {
|
|
7577
|
-
return def.shape;
|
|
7578
|
-
});
|
|
7579
|
-
_installLazyMethods(inst, "ZodObject", {
|
|
7580
|
-
keyof() {
|
|
7581
|
-
return _enum(Object.keys(this._zod.def.shape));
|
|
7582
|
-
},
|
|
7583
|
-
catchall(catchall) {
|
|
7584
|
-
return this.clone({
|
|
7585
|
-
...this._zod.def,
|
|
7586
|
-
catchall
|
|
7587
|
-
});
|
|
7588
|
-
},
|
|
7589
|
-
passthrough() {
|
|
7590
|
-
return this.clone({
|
|
7591
|
-
...this._zod.def,
|
|
7592
|
-
catchall: unknown()
|
|
7593
|
-
});
|
|
7594
|
-
},
|
|
7595
|
-
loose() {
|
|
7596
|
-
return this.clone({
|
|
7597
|
-
...this._zod.def,
|
|
7598
|
-
catchall: unknown()
|
|
7599
|
-
});
|
|
7600
|
-
},
|
|
7601
|
-
strict() {
|
|
7602
|
-
return this.clone({
|
|
7603
|
-
...this._zod.def,
|
|
7604
|
-
catchall: never()
|
|
7605
|
-
});
|
|
7606
|
-
},
|
|
7607
|
-
strip() {
|
|
7608
|
-
return this.clone({
|
|
7609
|
-
...this._zod.def,
|
|
7610
|
-
catchall: void 0
|
|
7611
|
-
});
|
|
7612
|
-
},
|
|
7613
|
-
extend(incoming) {
|
|
7614
|
-
return extend(this, incoming);
|
|
7615
|
-
},
|
|
7616
|
-
safeExtend(incoming) {
|
|
7617
|
-
return safeExtend(this, incoming);
|
|
7618
|
-
},
|
|
7619
|
-
merge(other) {
|
|
7620
|
-
return merge(this, other);
|
|
7621
|
-
},
|
|
7622
|
-
pick(mask) {
|
|
7623
|
-
return pick(this, mask);
|
|
7624
|
-
},
|
|
7625
|
-
omit(mask) {
|
|
7626
|
-
return omit(this, mask);
|
|
7627
|
-
},
|
|
7628
|
-
partial(...args) {
|
|
7629
|
-
return partial(ZodOptional, this, args[0]);
|
|
7630
|
-
},
|
|
7631
|
-
required(...args) {
|
|
7632
|
-
return required(ZodNonOptional, this, args[0]);
|
|
7633
|
-
}
|
|
7634
|
-
});
|
|
7635
|
-
});
|
|
7636
|
-
function object(shape, params) {
|
|
7637
|
-
return new ZodObject({
|
|
7638
|
-
type: "object",
|
|
7639
|
-
shape: shape ?? {},
|
|
7640
|
-
...normalizeParams(params)
|
|
7641
|
-
});
|
|
7642
|
-
}
|
|
7643
|
-
const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
|
|
7644
|
-
$ZodUnion.init(inst, def);
|
|
7645
|
-
ZodType.init(inst, def);
|
|
7646
|
-
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
7647
|
-
inst.options = def.options;
|
|
7648
|
-
});
|
|
7649
|
-
function union(options, params) {
|
|
7650
|
-
return new ZodUnion({
|
|
7651
|
-
type: "union",
|
|
7652
|
-
options,
|
|
7653
|
-
...normalizeParams(params)
|
|
7654
|
-
});
|
|
4233
|
+
function PlainUserText({ node }) {
|
|
4234
|
+
return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.UserTextRun, { text: node.data.display ?? node.data.text });
|
|
7655
4235
|
}
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
function
|
|
7662
|
-
return
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
});
|
|
7667
|
-
}
|
|
7668
|
-
const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
7669
|
-
$ZodEnum.init(inst, def);
|
|
7670
|
-
ZodType.init(inst, def);
|
|
7671
|
-
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
7672
|
-
inst.enum = def.entries;
|
|
7673
|
-
inst.options = Object.values(def.entries);
|
|
7674
|
-
const keys = new Set(Object.keys(def.entries));
|
|
7675
|
-
inst.extract = (values, params) => {
|
|
7676
|
-
const newEntries = {};
|
|
7677
|
-
for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
|
|
7678
|
-
else throw new Error(`Key ${value} not found in enum`);
|
|
7679
|
-
return new ZodEnum({
|
|
7680
|
-
...def,
|
|
7681
|
-
checks: [],
|
|
7682
|
-
...normalizeParams(params),
|
|
7683
|
-
entries: newEntries
|
|
7684
|
-
});
|
|
7685
|
-
};
|
|
7686
|
-
inst.exclude = (values, params) => {
|
|
7687
|
-
const newEntries = { ...def.entries };
|
|
7688
|
-
for (const value of values) if (keys.has(value)) delete newEntries[value];
|
|
7689
|
-
else throw new Error(`Key ${value} not found in enum`);
|
|
7690
|
-
return new ZodEnum({
|
|
7691
|
-
...def,
|
|
7692
|
-
checks: [],
|
|
7693
|
-
...normalizeParams(params),
|
|
7694
|
-
entries: newEntries
|
|
7695
|
-
});
|
|
7696
|
-
};
|
|
7697
|
-
});
|
|
7698
|
-
function _enum(values, params) {
|
|
7699
|
-
return new ZodEnum({
|
|
7700
|
-
type: "enum",
|
|
7701
|
-
entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
|
|
7702
|
-
...normalizeParams(params)
|
|
4236
|
+
/**
|
|
4237
|
+
* Display a confirmed Session label without inventing navigation behavior.
|
|
4238
|
+
* @param props - Session reference JSON and its original spelling.
|
|
4239
|
+
* @returns the existing non-interactive Session chip.
|
|
4240
|
+
*/
|
|
4241
|
+
function SessionReference({ node, raw }) {
|
|
4242
|
+
return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.ReferenceChip, {
|
|
4243
|
+
appearance: "session",
|
|
4244
|
+
label: node.data.label,
|
|
4245
|
+
title: raw
|
|
7703
4246
|
});
|
|
7704
4247
|
}
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
4248
|
+
//#endregion
|
|
4249
|
+
//#region lib/types/client/user-text/session-reference-rule.js
|
|
4250
|
+
/** Find the nearest Session reference; bare labels read their Facts only at a non-wire @ position. */
|
|
4251
|
+
const sessionReferenceRule = {
|
|
4252
|
+
id: "session",
|
|
4253
|
+
order: 10,
|
|
4254
|
+
match(text, from, context) {
|
|
4255
|
+
let labels;
|
|
4256
|
+
let readLabels = false;
|
|
4257
|
+
const wire = /@\[([^\]\n]+)\]\(dsh-session:[^)\s]+\)/uy;
|
|
4258
|
+
for (let start = text.indexOf("@", from); start >= 0; start = text.indexOf("@", start + 1)) {
|
|
4259
|
+
wire.lastIndex = start;
|
|
4260
|
+
const explicit = wire.exec(text);
|
|
4261
|
+
if (explicit !== null) return {
|
|
4262
|
+
id: "session",
|
|
4263
|
+
start,
|
|
4264
|
+
end: start + explicit[0].length,
|
|
4265
|
+
data: { label: explicit[1] }
|
|
4266
|
+
};
|
|
4267
|
+
if (!readLabels) {
|
|
4268
|
+
labels = context.read("sessionLabels");
|
|
4269
|
+
readLabels = true;
|
|
7720
4270
|
}
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
function transform(fn) {
|
|
7734
|
-
return new ZodTransform({
|
|
7735
|
-
type: "transform",
|
|
7736
|
-
transform: fn
|
|
7737
|
-
});
|
|
7738
|
-
}
|
|
7739
|
-
const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
|
|
7740
|
-
$ZodOptional.init(inst, def);
|
|
7741
|
-
ZodType.init(inst, def);
|
|
7742
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
7743
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7744
|
-
});
|
|
7745
|
-
function optional(innerType) {
|
|
7746
|
-
return new ZodOptional({
|
|
7747
|
-
type: "optional",
|
|
7748
|
-
innerType
|
|
7749
|
-
});
|
|
7750
|
-
}
|
|
7751
|
-
const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
|
|
7752
|
-
$ZodExactOptional.init(inst, def);
|
|
7753
|
-
ZodType.init(inst, def);
|
|
7754
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
7755
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7756
|
-
});
|
|
7757
|
-
function exactOptional(innerType) {
|
|
7758
|
-
return new ZodExactOptional({
|
|
7759
|
-
type: "optional",
|
|
7760
|
-
innerType
|
|
7761
|
-
});
|
|
7762
|
-
}
|
|
7763
|
-
const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
|
|
7764
|
-
$ZodNullable.init(inst, def);
|
|
7765
|
-
ZodType.init(inst, def);
|
|
7766
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
7767
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7768
|
-
});
|
|
7769
|
-
function nullable(innerType) {
|
|
7770
|
-
return new ZodNullable({
|
|
7771
|
-
type: "nullable",
|
|
7772
|
-
innerType
|
|
7773
|
-
});
|
|
7774
|
-
}
|
|
7775
|
-
const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
|
|
7776
|
-
$ZodDefault.init(inst, def);
|
|
7777
|
-
ZodType.init(inst, def);
|
|
7778
|
-
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
7779
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7780
|
-
inst.removeDefault = inst.unwrap;
|
|
7781
|
-
});
|
|
7782
|
-
function _default(innerType, defaultValue) {
|
|
7783
|
-
return new ZodDefault({
|
|
7784
|
-
type: "default",
|
|
7785
|
-
innerType,
|
|
7786
|
-
get defaultValue() {
|
|
7787
|
-
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
4271
|
+
let best;
|
|
4272
|
+
for (const label of labels ?? []) {
|
|
4273
|
+
if (label.length === 0 || !text.startsWith(label, start + 1)) continue;
|
|
4274
|
+
const end = start + label.length + 1;
|
|
4275
|
+
if (best === void 0 || end > best.end) best = {
|
|
4276
|
+
id: "session",
|
|
4277
|
+
start,
|
|
4278
|
+
end,
|
|
4279
|
+
data: { label }
|
|
4280
|
+
};
|
|
4281
|
+
}
|
|
4282
|
+
if (best !== void 0) return best;
|
|
7788
4283
|
}
|
|
7789
|
-
}
|
|
7790
|
-
}
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
get defaultValue() {
|
|
7802
|
-
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4286
|
+
//#endregion
|
|
4287
|
+
//#region lib/types/client/user-text/whitespace-rules.js
|
|
4288
|
+
function replacement(text, start, end, display) {
|
|
4289
|
+
return {
|
|
4290
|
+
id: "text",
|
|
4291
|
+
start,
|
|
4292
|
+
end,
|
|
4293
|
+
data: {
|
|
4294
|
+
text: text.slice(start, end),
|
|
4295
|
+
display
|
|
7803
4296
|
}
|
|
7804
|
-
}
|
|
7805
|
-
}
|
|
7806
|
-
const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
|
|
7807
|
-
$ZodNonOptional.init(inst, def);
|
|
7808
|
-
ZodType.init(inst, def);
|
|
7809
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
7810
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7811
|
-
});
|
|
7812
|
-
function nonoptional(innerType, params) {
|
|
7813
|
-
return new ZodNonOptional({
|
|
7814
|
-
type: "nonoptional",
|
|
7815
|
-
innerType,
|
|
7816
|
-
...normalizeParams(params)
|
|
7817
|
-
});
|
|
7818
|
-
}
|
|
7819
|
-
const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
|
|
7820
|
-
$ZodCatch.init(inst, def);
|
|
7821
|
-
ZodType.init(inst, def);
|
|
7822
|
-
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
7823
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7824
|
-
inst.removeCatch = inst.unwrap;
|
|
7825
|
-
});
|
|
7826
|
-
function _catch(innerType, catchValue) {
|
|
7827
|
-
return new ZodCatch({
|
|
7828
|
-
type: "catch",
|
|
7829
|
-
innerType,
|
|
7830
|
-
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
7831
|
-
});
|
|
7832
|
-
}
|
|
7833
|
-
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
7834
|
-
$ZodPipe.init(inst, def);
|
|
7835
|
-
ZodType.init(inst, def);
|
|
7836
|
-
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
7837
|
-
inst.in = def.in;
|
|
7838
|
-
inst.out = def.out;
|
|
7839
|
-
});
|
|
7840
|
-
function pipe(in_, out) {
|
|
7841
|
-
return new ZodPipe({
|
|
7842
|
-
type: "pipe",
|
|
7843
|
-
in: in_,
|
|
7844
|
-
out
|
|
7845
|
-
});
|
|
7846
|
-
}
|
|
7847
|
-
const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
|
|
7848
|
-
$ZodReadonly.init(inst, def);
|
|
7849
|
-
ZodType.init(inst, def);
|
|
7850
|
-
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
7851
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
7852
|
-
});
|
|
7853
|
-
function readonly(innerType) {
|
|
7854
|
-
return new ZodReadonly({
|
|
7855
|
-
type: "readonly",
|
|
7856
|
-
innerType
|
|
7857
|
-
});
|
|
7858
|
-
}
|
|
7859
|
-
const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
|
|
7860
|
-
$ZodCustom.init(inst, def);
|
|
7861
|
-
ZodType.init(inst, def);
|
|
7862
|
-
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
7863
|
-
});
|
|
7864
|
-
function refine(fn, _params = {}) {
|
|
7865
|
-
return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
|
|
7866
|
-
}
|
|
7867
|
-
function superRefine(fn, params) {
|
|
7868
|
-
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4297
|
+
};
|
|
7869
4298
|
}
|
|
4299
|
+
/** Offer the next whitespace run whose display collapses to one space. */
|
|
4300
|
+
const collapseWhitespaceRule = {
|
|
4301
|
+
id: "text.collapse-whitespace",
|
|
4302
|
+
order: 1010,
|
|
4303
|
+
match(text, from, context) {
|
|
4304
|
+
if (!context.read("collapseWhitespace")) return void 0;
|
|
4305
|
+
const spaces = /\s+/gu;
|
|
4306
|
+
spaces.lastIndex = from;
|
|
4307
|
+
for (let match = spaces.exec(text); match !== null; match = spaces.exec(text)) {
|
|
4308
|
+
if (match.index > 0 && /\s/u.test(text.slice(match.index - 1, match.index)) || match[0] === " ") continue;
|
|
4309
|
+
return replacement(text, match.index, match.index + match[0].length, " ");
|
|
4310
|
+
}
|
|
4311
|
+
}
|
|
4312
|
+
};
|
|
4313
|
+
/** Offer original document-edge whitespace, winning same-start collisions with collapse. */
|
|
4314
|
+
const trimWhitespaceRule = {
|
|
4315
|
+
id: "text.trim-whitespace",
|
|
4316
|
+
order: 1e3,
|
|
4317
|
+
match(text, from, context) {
|
|
4318
|
+
if (!context.read("trimWhitespace")) return void 0;
|
|
4319
|
+
if (from === 0) {
|
|
4320
|
+
const leading = /^\s+/u.exec(text);
|
|
4321
|
+
if (leading !== null) return replacement(text, 0, leading[0].length, "");
|
|
4322
|
+
}
|
|
4323
|
+
let start = text.length;
|
|
4324
|
+
const whitespace = /\s/u;
|
|
4325
|
+
while (start > 0 && whitespace.test(text.charAt(start - 1))) start--;
|
|
4326
|
+
return start === text.length || start < from ? void 0 : replacement(text, start, text.length, "");
|
|
4327
|
+
}
|
|
4328
|
+
};
|
|
7870
4329
|
//#endregion
|
|
7871
4330
|
//#region lib/types/client/draft.js
|
|
7872
4331
|
/** Semantic draft snapshots shared by storage, programmatic input, and editor restoration. */
|
|
7873
|
-
const referenceSchema = object({
|
|
7874
|
-
source: string(),
|
|
7875
|
-
ref: string(),
|
|
7876
|
-
offset: number().int().nonnegative(),
|
|
7877
|
-
length: number().int().positive(),
|
|
7878
|
-
label: string(),
|
|
7879
|
-
appearance:
|
|
4332
|
+
const referenceSchema = zod.z.object({
|
|
4333
|
+
source: zod.z.string(),
|
|
4334
|
+
ref: zod.z.string(),
|
|
4335
|
+
offset: zod.z.number().int().nonnegative(),
|
|
4336
|
+
length: zod.z.number().int().positive(),
|
|
4337
|
+
label: zod.z.string(),
|
|
4338
|
+
appearance: zod.z.enum([
|
|
7880
4339
|
"session",
|
|
7881
4340
|
"file",
|
|
7882
4341
|
"folder"
|
|
7883
4342
|
]).optional(),
|
|
7884
|
-
clipboardText: string(),
|
|
7885
|
-
invalid: boolean().optional()
|
|
4343
|
+
clipboardText: zod.z.string(),
|
|
4344
|
+
invalid: zod.z.boolean().optional()
|
|
7886
4345
|
});
|
|
7887
|
-
const snapshotSchema = object({
|
|
7888
|
-
text: string(),
|
|
7889
|
-
references: array(referenceSchema)
|
|
4346
|
+
const snapshotSchema = zod.z.object({
|
|
4347
|
+
text: zod.z.string(),
|
|
4348
|
+
references: zod.z.array(referenceSchema)
|
|
7890
4349
|
}).refine((draft) => {
|
|
7891
4350
|
let end = 0;
|
|
7892
4351
|
for (const reference of draft.references) {
|
|
@@ -8243,13 +4702,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8243
4702
|
type: "file",
|
|
8244
4703
|
receiptId: uploadFor(attachment).receiptId
|
|
8245
4704
|
}));
|
|
8246
|
-
if (session.getSnapshot().subagent !== null) {
|
|
8247
|
-
const content = [...await serializeAttachments(), ...text === "" ? [] : [{
|
|
8248
|
-
type: "text",
|
|
8249
|
-
text
|
|
8250
|
-
}]];
|
|
8251
|
-
return (await session.prompt(content, mode, signal)).ok ? { kind: "success" } : { kind: "error" };
|
|
8252
|
-
}
|
|
8253
4705
|
let finishRetirement;
|
|
8254
4706
|
const retirement = attachments.length === 0 ? void 0 : new Promise((resolve) => {
|
|
8255
4707
|
finishRetirement = resolve;
|
|
@@ -17642,8 +14094,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17642
14094
|
return;
|
|
17643
14095
|
}
|
|
17644
14096
|
if (text.length > token.length) {
|
|
17645
|
-
const [tokenNode] = node.splitText(token.length);
|
|
14097
|
+
const [tokenNode, overflow] = node.splitText(token.length);
|
|
17646
14098
|
if (tokenNode !== void 0 && tokenNode.getStyle() !== TOKEN_STYLE) tokenNode.setStyle(TOKEN_STYLE);
|
|
14099
|
+
overflow?.setStyle("");
|
|
17647
14100
|
return;
|
|
17648
14101
|
}
|
|
17649
14102
|
if (node.getStyle() !== TOKEN_STYLE) node.setStyle(TOKEN_STYLE);
|
|
@@ -19632,9 +16085,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19632
16085
|
"row.preparing": "正在准备调用",
|
|
19633
16086
|
"row.failed": "失败",
|
|
19634
16087
|
"row.stopped": "已停止",
|
|
16088
|
+
"row.commandArguments": "命令参数",
|
|
19635
16089
|
"row.input": "输入",
|
|
19636
16090
|
"row.output": "输出",
|
|
19637
16091
|
"row.inspect": "查看",
|
|
16092
|
+
"row.imageSize": "{width}x{height}px,{bytes} 字节",
|
|
16093
|
+
"row.imageSizeDownscaled": "{width}x{height}px(由 {originalWidth}x{originalHeight}px 缩小),{bytes} 字节",
|
|
19638
16094
|
"tool.title.search": "搜索",
|
|
19639
16095
|
"tool.title.read": "读取",
|
|
19640
16096
|
"tool.title.bash": "运行命令",
|
|
@@ -19693,6 +16149,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19693
16149
|
"terminal.signal": "信号 {signal}",
|
|
19694
16150
|
"terminal.exitCode": "退出码 {code}",
|
|
19695
16151
|
"terminal.noExitCode": "未正常退出",
|
|
16152
|
+
"terminal.commandLine": "命令第 {n} 行",
|
|
19696
16153
|
"terminal.running": "运行中",
|
|
19697
16154
|
"terminal.failed": "失败",
|
|
19698
16155
|
"terminal.done": "已完成",
|
|
@@ -20004,9 +16461,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20004
16461
|
"row.preparing": "Preparing tool call",
|
|
20005
16462
|
"row.failed": "Failed",
|
|
20006
16463
|
"row.stopped": "Stopped",
|
|
16464
|
+
"row.commandArguments": "Command arguments",
|
|
20007
16465
|
"row.input": "IN",
|
|
20008
16466
|
"row.output": "OUT",
|
|
20009
16467
|
"row.inspect": "Inspect",
|
|
16468
|
+
"row.imageSize": "{width}x{height}px, {bytes} bytes",
|
|
16469
|
+
"row.imageSizeDownscaled": "{width}x{height}px (downscaled from {originalWidth}x{originalHeight}px), {bytes} bytes",
|
|
20010
16470
|
"tool.title.search": "Search",
|
|
20011
16471
|
"tool.title.read": "Read",
|
|
20012
16472
|
"tool.title.bash": "Bash",
|
|
@@ -20065,6 +16525,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20065
16525
|
"terminal.signal": "signal {signal}",
|
|
20066
16526
|
"terminal.exitCode": "exit code {code}",
|
|
20067
16527
|
"terminal.noExitCode": "no exit code",
|
|
16528
|
+
"terminal.commandLine": "Command line {n}",
|
|
20068
16529
|
"terminal.running": "Running",
|
|
20069
16530
|
"terminal.failed": "Failed",
|
|
20070
16531
|
"terminal.done": "Done",
|
|
@@ -20077,7 +16538,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20077
16538
|
};
|
|
20078
16539
|
//#endregion
|
|
20079
16540
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-conversation/src/client/queue/QueueDock.module.css.mjs
|
|
20080
|
-
const css$6 = "._7yHdaG_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}._7yHdaG_panel{isolation:isolate;border-radius:var(--dsw-radius-lg) var(--dsw-radius-lg) 0 0;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);width:100%;padding:2px 0;position:relative;overflow:hidden}._7yHdaG_panel:before{z-index:-1;border-radius:inherit;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);content:\"\";pointer-events:none;position:absolute;inset:0}._7yHdaG_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:\"\";pointer-events:none;border-bottom:none;position:absolute;inset:0}._7yHdaG_header{box-sizing:border-box;border-radius:var(--dsw-radius-md);width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;padding:4px 12px;display:flex}._7yHdaG_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._7yHdaG_header:disabled{cursor:default}._7yHdaG_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._7yHdaG_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}._7yHdaG_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._7yHdaG_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}._7yHdaG_row{box-sizing:border-box;border-radius:var(--dsw-radius-md);align-items:center;gap:10px;width:100%;min-height:36px;padding:4px 5px 4px 12px;display:flex}._7yHdaG_row+._7yHdaG_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}._7yHdaG_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}._7yHdaG_pendingRow ._7yHdaG_attachments{flex-shrink:1}._7yHdaG_file{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);box-sizing:border-box;flex:0 180px;align-items:center;gap:4px;min-width:74px;height:24px;padding:0 6px;display:inline-flex;overflow:hidden}._7yHdaG_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}._7yHdaG_fileName{min-width:0;color:var(--dsw-alias-label-primary-dimmed);font:var(--dsw-font-xs-13);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._7yHdaG_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}._7yHdaG_thumb{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-base);object-fit:cover;width:24px;height:24px}._7yHdaG_preview{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);color:var(--dsw-alias-label-primary-dimmed);
|
|
16541
|
+
const css$6 = "._7yHdaG_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}._7yHdaG_panel{isolation:isolate;border-radius:var(--dsw-radius-lg) var(--dsw-radius-lg) 0 0;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);width:100%;padding:2px 0;position:relative;overflow:hidden}._7yHdaG_panel:before{z-index:-1;border-radius:inherit;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);content:\"\";pointer-events:none;position:absolute;inset:0}._7yHdaG_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:\"\";pointer-events:none;border-bottom:none;position:absolute;inset:0}._7yHdaG_header{box-sizing:border-box;border-radius:var(--dsw-radius-md);width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;padding:4px 12px;display:flex}._7yHdaG_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._7yHdaG_header:disabled{cursor:default}._7yHdaG_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._7yHdaG_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}._7yHdaG_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._7yHdaG_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}._7yHdaG_row{box-sizing:border-box;border-radius:var(--dsw-radius-md);align-items:center;gap:10px;width:100%;min-height:36px;padding:4px 5px 4px 12px;display:flex}._7yHdaG_row+._7yHdaG_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}._7yHdaG_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}._7yHdaG_pendingRow ._7yHdaG_attachments{flex-shrink:1}._7yHdaG_file{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);box-sizing:border-box;flex:0 180px;align-items:center;gap:4px;min-width:74px;height:24px;padding:0 6px;display:inline-flex;overflow:hidden}._7yHdaG_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}._7yHdaG_fileName{min-width:0;color:var(--dsw-alias-label-primary-dimmed);font:var(--dsw-font-xs-13);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._7yHdaG_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}._7yHdaG_thumb{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-base);object-fit:cover;width:24px;height:24px}._7yHdaG_preview{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);color:var(--dsw-alias-label-primary-dimmed);flex:auto}._7yHdaG_actions{flex:none;align-items:center;gap:10px;display:flex}._7yHdaG_status{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);white-space:nowrap;flex:none}._7yHdaG_action{corner-shape:round;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}._7yHdaG_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._7yHdaG_action:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._7yHdaG_action:disabled{cursor:default;opacity:.45}";
|
|
20081
16542
|
const tagId$6 = "@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css";
|
|
20082
16543
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
|
|
20083
16544
|
const tag = document.createElement("style");
|
|
@@ -20110,12 +16571,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20110
16571
|
//#endregion
|
|
20111
16572
|
//#region lib/types/client/queue/QueueDock.js
|
|
20112
16573
|
const EMPTY_QUEUE = [];
|
|
20113
|
-
const
|
|
20114
|
-
|
|
20115
|
-
|
|
20116
|
-
|
|
20117
|
-
return chars.length > QUEUE_PREVIEW_CHARS ? `${chars.slice(0, QUEUE_PREVIEW_CHARS).join("")}…` : flat;
|
|
20118
|
-
}
|
|
16574
|
+
const QUEUE_TEXT_FACTS = {
|
|
16575
|
+
collapseWhitespace: true,
|
|
16576
|
+
trimWhitespace: true
|
|
16577
|
+
};
|
|
20119
16578
|
function textOf(content) {
|
|
20120
16579
|
if (!content.every((block) => block.type === "text")) return null;
|
|
20121
16580
|
return content.map((block) => block.text).join("");
|
|
@@ -20199,7 +16658,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20199
16658
|
* collapsible count header; an empty queue renders nothing. Local queued submissions
|
|
20200
16659
|
* show sending status and disabled actions until their Host queue rows arrive.
|
|
20201
16660
|
*/
|
|
20202
|
-
function QueueDock({ useSession, useProjection, updateQueue, notify, loadImage, t }) {
|
|
16661
|
+
function QueueDock({ useSession, useProjection, updateQueue, notify, loadImage, renderFactorySlot, t }) {
|
|
20203
16662
|
const inbox = useProjection("inbox");
|
|
20204
16663
|
const pendingSubmissions = useSession((s) => s.pendingSubmissions);
|
|
20205
16664
|
const queue = (0, react.useMemo)(() => {
|
|
@@ -20331,7 +16790,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20331
16790
|
}, `${item.attachment.attachmentId}:${item.attachment.name}:${index}`))
|
|
20332
16791
|
}), (0, react_jsx_runtime.jsx)("span", {
|
|
20333
16792
|
className: QueueDock_module_css_default.preview,
|
|
20334
|
-
children: (
|
|
16793
|
+
children: renderFactorySlot("conversation.user.text", {
|
|
16794
|
+
text: row.content.filter((block) => block.type === "text").map((block) => block.text).join(""),
|
|
16795
|
+
facts: QUEUE_TEXT_FACTS,
|
|
16796
|
+
interactive: false,
|
|
16797
|
+
ellipsis: true
|
|
16798
|
+
})
|
|
20335
16799
|
})] }),
|
|
20336
16800
|
queueMutable && (0, react_jsx_runtime.jsx)("div", {
|
|
20337
16801
|
className: QueueDock_module_css_default.actions,
|
|
@@ -20448,7 +16912,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20448
16912
|
}),
|
|
20449
16913
|
(0, react_jsx_runtime.jsx)("span", {
|
|
20450
16914
|
className: QueueDock_module_css_default.preview,
|
|
20451
|
-
children: (
|
|
16915
|
+
children: renderFactorySlot("conversation.user.text", {
|
|
16916
|
+
text: submission.text,
|
|
16917
|
+
facts: QUEUE_TEXT_FACTS,
|
|
16918
|
+
interactive: false,
|
|
16919
|
+
ellipsis: true
|
|
16920
|
+
})
|
|
20452
16921
|
}),
|
|
20453
16922
|
(0, react_jsx_runtime.jsx)("span", {
|
|
20454
16923
|
className: QueueDock_module_css_default.status,
|
|
@@ -20621,7 +17090,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20621
17090
|
}
|
|
20622
17091
|
//#endregion
|
|
20623
17092
|
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-conversation/src/client/skeleton/ConversationRoot.module.css.mjs
|
|
20624
|
-
const css$4 = ".wSkVaW_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}.wSkVaW_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.wSkVaW_header:where(:not(:has(.wSkVaW_tabs))){min-height:0;padding-bottom:10px}.wSkVaW_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.wSkVaW_headerBlank .wSkVaW_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .wSkVaW_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .wSkVaW_headerSessionless .wSkVaW_titleRow{min-height:0}[data-platform=darwin] .wSkVaW_headerLeading,[data-platform=darwin] .wSkVaW_headerActions,[data-platform=darwin] .wSkVaW_headerUtilities,[data-platform=darwin] .wSkVaW_headerCorner{-webkit-app-region:no-drag}.wSkVaW_titleRow{min-height:30px;grid-column:2;align-items:center;gap:0;padding-inline-start:max(0px, calc(var(--dsh-frame-leading-clearance,0px) - 20px));display:flex;container-type:inline-size}.wSkVaW_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.wSkVaW_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.wSkVaW_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.wSkVaW_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.wSkVaW_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.wSkVaW_crumb{border-radius:var(--dsw-radius-md);max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;padding:4px 8px;font-size:14px;line-height:20px;display:inline-block;overflow:hidden}.wSkVaW_crumbSubagent{font-size:12px;line-height:18px}button.wSkVaW_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.wSkVaW_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.wSkVaW_headerActions{flex:none;align-items:center;gap:8px;display:flex}.wSkVaW_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.wSkVaW_headerUtilities:empty{display:none}.wSkVaW_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.wSkVaW_headerCorner:empty{display:none}.wSkVaW_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.wSkVaW_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 9px;font-size:13px;font-weight:500;line-height:16px;position:relative}.wSkVaW_tab:after{content:\"\";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:-1px;left:0;right:0}.wSkVaW_tabActive{color:var(--dsw-alias-state-business-primary)}.wSkVaW_tabActive:after{background:var(--dsw-alias-state-business-primary)}.wSkVaW_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.wSkVaW_widthHandle{z-index:0;width:min(10px, calc((100% - var(--dsh-chat-content-width)) / 2 - 24px - 24px));cursor:col-resize;position:absolute;top:0;bottom:0}.wSkVaW_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.wSkVaW_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.wSkVaW_widthHandle:after{content:\"\";background:linear-gradient(to bottom, transparent calc(var(--dsh-width-handle-pointer-y,50%) - 36px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) - 8px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) + 8px), transparent calc(var(--dsh-width-handle-pointer-y,50%) + 36px));opacity:0;pointer-events:none;border-radius:2px;width:2px;position:absolute;top:0;bottom:0}.wSkVaW_widthHandle[data-side=left]:after{right:4px}.wSkVaW_widthHandle[data-side=right]:after{left:4px}.wSkVaW_widthHandle:hover:after,.wSkVaW_widthHandle[data-dragging]:after{opacity:1}.wSkVaW_widthHandle[data-dragging]{z-index:8}.wSkVaW_root:has([data-conversation-composer-overlay]) .wSkVaW_widthHandle{display:none}.wSkVaW_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.wSkVaW_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.wSkVaW_root[data-phase=active]{overflow:hidden}.wSkVaW_root[data-phase=active] .wSkVaW_header{flex:none}.wSkVaW_body{--dsh-chat-content-width:var(--dsh-chat-user-width,clamp(680px, calc(var(--dsh-conversation-column-width,0px) * .64), 920px));--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.wSkVaW_embeddedBody{--dsh-chat-content-width:min(calc(100% - 32px), 920px);--dsh-composer-card-max-width:min(calc(100% - 16px), 952px);--dsh-composer-side-clearance:8px;--dsh-composer-dock-inset:8px;overflow:hidden}.wSkVaW_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow-y:auto}.wSkVaW_scrollBody::-webkit-scrollbar-track{margin:2px}.wSkVaW_root[data-phase=active] .wSkVaW_viewArea,.wSkVaW_embeddedBody[data-content-phase=active] .wSkVaW_viewArea{flex:1 0 auto;min-height:auto}.wSkVaW_root[data-phase=active] .wSkVaW_composerSeat,.wSkVaW_embeddedBody[data-content-phase=active] .wSkVaW_composerSeat{z-index:7;background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px);position:sticky;bottom:0}.wSkVaW_root[data-phase=active] .wSkVaW_composerSeat:has([data-trigger-menu]){z-index:9}.wSkVaW_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.wSkVaW_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.wSkVaW_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.wSkVaW_scrollBody:has([data-conversation-composer-overlay])>.wSkVaW_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.wSkVaW_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px}.wSkVaW_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding:0 16px 0 20px;display:flex}.wSkVaW_root[data-phase=hero] .wSkVaW_scrollBody,.wSkVaW_embeddedBody[data-content-phase=hero] .wSkVaW_scrollBody{justify-content:center;overflow-y:auto}.wSkVaW_root[data-phase=settling] .wSkVaW_composerSeat,.wSkVaW_embeddedBody[data-content-phase=settling] .wSkVaW_composerSeat{visibility:hidden}";
|
|
17093
|
+
const css$4 = ".wSkVaW_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}.wSkVaW_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.wSkVaW_header:where(:not(:has(.wSkVaW_tabs))){min-height:0;padding-bottom:10px}.wSkVaW_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.wSkVaW_headerBlank .wSkVaW_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .wSkVaW_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .wSkVaW_headerSessionless .wSkVaW_titleRow{min-height:0}[data-platform=darwin] .wSkVaW_headerLeading,[data-platform=darwin] .wSkVaW_headerActions,[data-platform=darwin] .wSkVaW_headerUtilities,[data-platform=darwin] .wSkVaW_headerCorner{-webkit-app-region:no-drag}.wSkVaW_titleRow{min-height:30px;grid-column:2;align-items:center;gap:0;padding-inline-start:max(0px, calc(var(--dsh-frame-leading-clearance,0px) - 20px));display:flex;container-type:inline-size}.wSkVaW_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.wSkVaW_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.wSkVaW_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.wSkVaW_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.wSkVaW_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.wSkVaW_crumb{border-radius:var(--dsw-radius-md);max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;padding:4px 8px;font-size:14px;line-height:20px;display:inline-block;overflow:hidden}.wSkVaW_crumbSubagent{font-size:12px;line-height:18px}button.wSkVaW_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.wSkVaW_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.wSkVaW_headerActions{flex:none;align-items:center;gap:8px;display:flex}.wSkVaW_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.wSkVaW_headerUtilities:empty{display:none}.wSkVaW_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.wSkVaW_headerCorner:empty{display:none}.wSkVaW_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.wSkVaW_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 9px;font-size:13px;font-weight:500;line-height:16px;position:relative}.wSkVaW_tab:after{content:\"\";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:-1px;left:0;right:0}.wSkVaW_tabActive{color:var(--dsw-alias-state-business-primary)}.wSkVaW_tabActive:after{background:var(--dsw-alias-state-business-primary)}.wSkVaW_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.wSkVaW_widthHandle{z-index:0;width:min(10px, calc((100% - var(--dsh-chat-content-width)) / 2 - 24px - 24px));cursor:col-resize;position:absolute;top:0;bottom:0}.wSkVaW_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.wSkVaW_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.wSkVaW_widthHandle:after{content:\"\";background:linear-gradient(to bottom, transparent calc(var(--dsh-width-handle-pointer-y,50%) - 36px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) - 8px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) + 8px), transparent calc(var(--dsh-width-handle-pointer-y,50%) + 36px));opacity:0;pointer-events:none;border-radius:2px;width:2px;position:absolute;top:0;bottom:0}.wSkVaW_widthHandle[data-side=left]:after{right:4px}.wSkVaW_widthHandle[data-side=right]:after{left:4px}.wSkVaW_widthHandle:hover:after,.wSkVaW_widthHandle[data-dragging]:after{opacity:1}.wSkVaW_widthHandle[data-dragging]{z-index:8}.wSkVaW_root:has([data-conversation-composer-overlay]) .wSkVaW_widthHandle{display:none}.wSkVaW_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.wSkVaW_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.wSkVaW_root[data-phase=active]{overflow:hidden}.wSkVaW_root[data-phase=active] .wSkVaW_header{flex:none}.wSkVaW_body{--dsh-chat-content-width:var(--dsh-chat-user-width,clamp(680px, calc(var(--dsh-conversation-column-width,0px) * .64), 920px));--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.wSkVaW_embeddedBody{--dsh-chat-content-width:min(calc(100% - 32px), 920px);--dsh-composer-card-max-width:min(calc(100% - 16px), 952px);--dsh-composer-side-clearance:8px;--dsh-composer-dock-inset:8px;overflow:hidden}.wSkVaW_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow-y:auto}.wSkVaW_scrollBody::-webkit-scrollbar-track{margin:2px}.wSkVaW_root[data-phase=active] .wSkVaW_viewArea,.wSkVaW_embeddedBody[data-content-phase=active] .wSkVaW_viewArea{flex:1 0 auto;min-height:auto}.wSkVaW_root[data-phase=active] .wSkVaW_composerSeat,.wSkVaW_embeddedBody[data-content-phase=active] .wSkVaW_composerSeat{z-index:7;background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px);position:sticky;bottom:0}.wSkVaW_root[data-phase=active] .wSkVaW_composerSeat:has([data-trigger-menu]){z-index:9}.wSkVaW_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.wSkVaW_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.wSkVaW_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.wSkVaW_scrollBody:has([data-conversation-composer-overlay])>.wSkVaW_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.wSkVaW_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px}.wSkVaW_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding:0 16px 0 20px;display:flex}.wSkVaW_heroOptions{flex:none;align-items:center;gap:2px;min-width:0;margin-left:auto;display:flex}.wSkVaW_heroOptions:empty{display:none}.wSkVaW_root[data-phase=hero] .wSkVaW_scrollBody,.wSkVaW_embeddedBody[data-content-phase=hero] .wSkVaW_scrollBody{justify-content:center;overflow-y:auto}.wSkVaW_root[data-phase=settling] .wSkVaW_composerSeat,.wSkVaW_embeddedBody[data-content-phase=settling] .wSkVaW_composerSeat{visibility:hidden}";
|
|
20625
17094
|
const tagId$4 = "@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css";
|
|
20626
17095
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
|
|
20627
17096
|
const tag = document.createElement("style");
|
|
@@ -20649,6 +17118,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20649
17118
|
"headerLeading": "wSkVaW_headerLeading",
|
|
20650
17119
|
"headerSessionless": "wSkVaW_headerSessionless",
|
|
20651
17120
|
"headerUtilities": "wSkVaW_headerUtilities",
|
|
17121
|
+
"heroOptions": "wSkVaW_heroOptions",
|
|
20652
17122
|
"heroWorkspaceRow": "wSkVaW_heroWorkspaceRow",
|
|
20653
17123
|
"root": "wSkVaW_root",
|
|
20654
17124
|
"scrollBody": "wSkVaW_scrollBody",
|
|
@@ -21107,7 +17577,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21107
17577
|
setPickerOpen(false);
|
|
21108
17578
|
}
|
|
21109
17579
|
}),
|
|
21110
|
-
renderSlot("conversation.hero.agentPreset", {})
|
|
17580
|
+
renderSlot("conversation.hero.agentPreset", {}),
|
|
17581
|
+
sessionId === void 0 ? null : (0, react_jsx_runtime.jsx)("div", {
|
|
17582
|
+
className: ConversationRoot_module_css_default.heroOptions,
|
|
17583
|
+
children: renderSlot("conversation.hero.options", {})
|
|
17584
|
+
})
|
|
21111
17585
|
]
|
|
21112
17586
|
});
|
|
21113
17587
|
const inert = sessionId === void 0 || hero && chipTitle === void 0;
|
|
@@ -21627,7 +18101,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21627
18101
|
*/
|
|
21628
18102
|
function installDraftFilePicker(keyboard, gate, fileInputRef) {
|
|
21629
18103
|
return keyboard.bindFilePicker({
|
|
21630
|
-
available: () => gate.current.canAcceptDrop && fileInputRef.current !== null,
|
|
18104
|
+
available: () => gate.current.canAcceptDrop && fileInputRef.current !== null && !fileInputRef.current.disabled,
|
|
21631
18105
|
open: () => {
|
|
21632
18106
|
fileInputRef.current?.click();
|
|
21633
18107
|
}
|
|
@@ -22147,8 +18621,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22147
18621
|
return installDraftWheel(scrollRef);
|
|
22148
18622
|
}, []);
|
|
22149
18623
|
const intakeFiles = (0, react.useCallback)((files, directories) => {
|
|
22150
|
-
if (subagent !== null || addFiles === void 0 || files.length === 0) return;
|
|
18624
|
+
if (locked || machineBusy || subagent !== null && !continuable || addFiles === void 0 || files.length === 0) return;
|
|
22151
18625
|
const rejected = (() => {
|
|
18626
|
+
if (continuable && files.some((file) => directories?.has(file) || !isImageMediaType(file.type))) return t("image.unsupportedType");
|
|
22152
18627
|
if (imageLimits !== void 0) {
|
|
22153
18628
|
const mediaTypes = imageLimits.mediaTypes;
|
|
22154
18629
|
const images = files.filter((file) => mediaTypes.includes(file.type));
|
|
@@ -22161,14 +18636,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22161
18636
|
})();
|
|
22162
18637
|
if (rejected !== null) showToast(rejected);
|
|
22163
18638
|
}, [
|
|
18639
|
+
locked,
|
|
18640
|
+
machineBusy,
|
|
22164
18641
|
subagent,
|
|
18642
|
+
continuable,
|
|
22165
18643
|
addFiles,
|
|
22166
18644
|
attachments,
|
|
22167
18645
|
imageLimits,
|
|
22168
18646
|
showToast,
|
|
22169
18647
|
t
|
|
22170
18648
|
]);
|
|
22171
|
-
const canAcceptDrop = subagent === null && !locked && !machineBusy && addFiles !== void 0;
|
|
18649
|
+
const canAcceptDrop = (subagent === null || continuable) && !locked && !machineBusy && addFiles !== void 0;
|
|
22172
18650
|
const fileInputRef = (0, react.useRef)(null);
|
|
22173
18651
|
const onPickFiles = (e) => {
|
|
22174
18652
|
const picked = e.target.files === null ? [] : [...e.target.files];
|
|
@@ -22212,6 +18690,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22212
18690
|
const keepFocus = (e) => {
|
|
22213
18691
|
keepDraftFocus(e, editor);
|
|
22214
18692
|
};
|
|
18693
|
+
const onCardMouseDown = (e) => {
|
|
18694
|
+
if (!editable || editor === null || e.button !== 0 || e.defaultPrevented) return;
|
|
18695
|
+
const target = e.target;
|
|
18696
|
+
if (!(target instanceof Element) || !e.currentTarget.contains(target)) return;
|
|
18697
|
+
if (target.closest("[data-composer-overlay]") !== null) return;
|
|
18698
|
+
if (scrollRef.current?.contains(target)) return;
|
|
18699
|
+
const control = target.closest("button, a, input, select, textarea, [role=\"button\"], [contenteditable], [tabindex]");
|
|
18700
|
+
if (control !== null && e.currentTarget.contains(control)) return;
|
|
18701
|
+
e.preventDefault();
|
|
18702
|
+
if (document.activeElement !== editor.getRootElement()) focusDraftEditor(editor, revealSelection);
|
|
18703
|
+
};
|
|
22215
18704
|
const onToggleCommandMenu = () => {
|
|
22216
18705
|
if (keyboard === void 0) return;
|
|
22217
18706
|
if (editor !== null) focusDraftEditor(editor, revealSelection);
|
|
@@ -22271,9 +18760,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22271
18760
|
onPointerDown: workspaceTrigger ? (e) => {
|
|
22272
18761
|
e.stopPropagation();
|
|
22273
18762
|
} : void 0,
|
|
18763
|
+
onMouseDown: onCardMouseDown,
|
|
22274
18764
|
children: [
|
|
22275
18765
|
sessionId !== void 0 && (0, react_jsx_runtime.jsx)("div", {
|
|
22276
18766
|
className: InputBar_module_css_default.overlayAnchor,
|
|
18767
|
+
"data-composer-overlay": true,
|
|
22277
18768
|
children: renderSlot("conversation.input.overlay", {})
|
|
22278
18769
|
}),
|
|
22279
18770
|
accessory !== void 0 && (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -22773,6 +19264,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22773
19264
|
const maxConcurrentFileUploads = config.maxConcurrentFileUploads;
|
|
22774
19265
|
const workspaceNavigation = ctx.get("uiWorkspace");
|
|
22775
19266
|
const uiConversation = new UiConversation(ctx, sessions);
|
|
19267
|
+
uiConversation.userText.register(sessionReferenceRule);
|
|
19268
|
+
uiConversation.userText.register(collapseWhitespaceRule);
|
|
19269
|
+
uiConversation.userText.register(trimWhitespaceRule);
|
|
19270
|
+
slots.registerFactory({
|
|
19271
|
+
name: "conversation.user.text",
|
|
19272
|
+
scope: "session",
|
|
19273
|
+
children: { "conversation.user.text.node": {
|
|
19274
|
+
kind: "keyed",
|
|
19275
|
+
scope: "session",
|
|
19276
|
+
inline: true
|
|
19277
|
+
} },
|
|
19278
|
+
inject: () => ({
|
|
19279
|
+
hooks: { userTextRevision: {
|
|
19280
|
+
getSnapshot: () => uiConversation.userText.getSnapshot(),
|
|
19281
|
+
subscribe: (listener) => uiConversation.userText.subscribe(listener)
|
|
19282
|
+
} },
|
|
19283
|
+
createUserTextEvaluator: () => uiConversation.userText.createEvaluator(),
|
|
19284
|
+
reportTransformFailure: (error) => {
|
|
19285
|
+
console.error("[ui-conversation] user-text transformation failed:", error);
|
|
19286
|
+
}
|
|
19287
|
+
})
|
|
19288
|
+
}, UserText);
|
|
19289
|
+
slots.inject("conversation.user.text.node", function* () {
|
|
19290
|
+
yield slots.register({
|
|
19291
|
+
name: "conversation.user.text.node",
|
|
19292
|
+
key: "text",
|
|
19293
|
+
priority: 100
|
|
19294
|
+
}, PlainUserText);
|
|
19295
|
+
yield slots.register({
|
|
19296
|
+
name: "conversation.user.text.node",
|
|
19297
|
+
key: "session",
|
|
19298
|
+
priority: 100
|
|
19299
|
+
}, SessionReference);
|
|
19300
|
+
});
|
|
22776
19301
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
22777
19302
|
zh,
|
|
22778
19303
|
en
|
|
@@ -23005,6 +19530,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23005
19530
|
"conversation.hero.agentPreset": {
|
|
23006
19531
|
kind: "single",
|
|
23007
19532
|
scope: "session-maybe"
|
|
19533
|
+
},
|
|
19534
|
+
"conversation.hero.options": {
|
|
19535
|
+
kind: "list",
|
|
19536
|
+
scope: "session"
|
|
23008
19537
|
}
|
|
23009
19538
|
},
|
|
23010
19539
|
slots: {
|