@blade-hq/agent-react 2612.0.0-beta.76 → 2612.0.0-beta.77
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.md +4 -0
- package/dist/chat/TurnNavRail.d.ts +1 -4
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/turn-locate-channel.d.ts +53 -0
- package/dist/{chunk-HCW7SI5Q.js → chunk-26NE55SJ.js} +4 -4
- package/dist/{chunk-WRIMPZPN.js → chunk-EQOKPZI2.js} +35 -21
- package/dist/chunk-EQOKPZI2.js.map +1 -0
- package/dist/{chunk-2DPLLZOU.js → chunk-F2IJZX2Z.js} +3 -3
- package/dist/{chunk-XP6T6SHZ.js → chunk-IVGTMWRV.js} +908 -755
- package/dist/chunk-IVGTMWRV.js.map +1 -0
- package/dist/{chunk-XJ6ZA6LN.js → chunk-VBHHFIII.js} +3 -3
- package/dist/{chunk-J72ZLILV.js → chunk-WO2VCQ5N.js} +5 -2
- package/dist/chunk-WO2VCQ5N.js.map +1 -0
- package/dist/{chunk-QIR73CES.js → chunk-XBEN2ASY.js} +7776 -7140
- package/dist/chunk-XBEN2ASY.js.map +1 -0
- package/dist/{chunk-7MCGQH34.js → chunk-ZIECHNZA.js} +14 -7
- package/dist/chunk-ZIECHNZA.js.map +1 -0
- package/dist/components/AccountConnectorRules.d.ts +7 -0
- package/dist/components/ConnectorRulesPanel.d.ts +9 -0
- package/dist/connectors.d.ts +1 -0
- package/dist/connectors.js +5 -2
- package/dist/hooks/use-turn-navigation.d.ts +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -7
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +10 -8
- package/dist/internal.js.map +1 -1
- package/dist/questions.js +3 -3
- package/dist/rich-input.js +21 -5
- package/dist/rich-input.js.map +1 -1
- package/dist/style.full.css +1 -1
- package/dist/tool-details.js +4 -4
- package/package.json +2 -2
- package/public-api.md +7 -1
- package/dist/chunk-7MCGQH34.js.map +0 -1
- package/dist/chunk-J72ZLILV.js.map +0 -1
- package/dist/chunk-QIR73CES.js.map +0 -1
- package/dist/chunk-WRIMPZPN.js.map +0 -1
- package/dist/chunk-XP6T6SHZ.js.map +0 -1
- /package/dist/{chunk-HCW7SI5Q.js.map → chunk-26NE55SJ.js.map} +0 -0
- /package/dist/{chunk-2DPLLZOU.js.map → chunk-F2IJZX2Z.js.map} +0 -0
- /package/dist/{chunk-XJ6ZA6LN.js.map → chunk-VBHHFIII.js.map} +0 -0
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
useEffectEvent,
|
|
10
10
|
useSessionPluginActivation,
|
|
11
11
|
useSessionSkills
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-F2IJZX2Z.js";
|
|
13
13
|
import {
|
|
14
14
|
ImageLightbox,
|
|
15
15
|
McpAppMessageContext,
|
|
16
16
|
MessageImage,
|
|
17
17
|
ToolUiCardView,
|
|
18
18
|
getRenderer
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-26NE55SJ.js";
|
|
20
20
|
import {
|
|
21
21
|
MarkdownContent
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VBHHFIII.js";
|
|
23
23
|
import {
|
|
24
24
|
BladeProvider,
|
|
25
25
|
ChatEnvironmentProvider,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
useSessionSource,
|
|
62
62
|
useSessionState,
|
|
63
63
|
useSingleSessionSource
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-EQOKPZI2.js";
|
|
65
65
|
import {
|
|
66
66
|
Archive,
|
|
67
67
|
ArrowRight,
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
Zap,
|
|
119
119
|
dist_exports2 as dist_exports,
|
|
120
120
|
useControllableState
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-XBEN2ASY.js";
|
|
122
122
|
|
|
123
123
|
// src/hooks/use-agent-session.ts
|
|
124
124
|
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
@@ -219,8 +219,8 @@ function useAgentSession(sessionId, options = {}) {
|
|
|
219
219
|
}),
|
|
220
220
|
[session]
|
|
221
221
|
);
|
|
222
|
-
const
|
|
223
|
-
return { session, state, error };
|
|
222
|
+
const state2 = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
223
|
+
return { session, state: state2, error };
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/hooks/use-replay.ts
|
|
@@ -246,10 +246,10 @@ function useReplay(session) {
|
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
const pull = () => {
|
|
249
|
-
const
|
|
250
|
-
setReplay(
|
|
251
|
-
setViewerRole(
|
|
252
|
-
setSourceRunning(
|
|
249
|
+
const state2 = session.getState();
|
|
250
|
+
setReplay(state2.replay);
|
|
251
|
+
setViewerRole(state2.viewerRole);
|
|
252
|
+
setSourceRunning(state2.isStreaming || state2.status === "running");
|
|
253
253
|
};
|
|
254
254
|
pull();
|
|
255
255
|
return session.subscribe(pull);
|
|
@@ -471,10 +471,10 @@ function ReplayMismatchPrompt({ mismatch, className }) {
|
|
|
471
471
|
|
|
472
472
|
// src/components/AgentChat.tsx
|
|
473
473
|
import { BladeApiError } from "@blade-hq/agent-client/internal";
|
|
474
|
-
import { useEffect as
|
|
474
|
+
import { useEffect as useEffect28, useMemo as useMemo17, useRef as useRef23, useState as useState31 } from "react";
|
|
475
475
|
|
|
476
476
|
// src/chat/ChatPanel.tsx
|
|
477
|
-
import { useCallback as useCallback16, useEffect as
|
|
477
|
+
import { useCallback as useCallback16, useEffect as useEffect26, useMemo as useMemo16, useState as useState29 } from "react";
|
|
478
478
|
import {
|
|
479
479
|
chatErrorForDisplay as chatErrorForDisplay3,
|
|
480
480
|
latestPostChatFollowup
|
|
@@ -985,8 +985,8 @@ function CurrentPlanPanel({
|
|
|
985
985
|
sessionId,
|
|
986
986
|
className
|
|
987
987
|
}) {
|
|
988
|
-
const messages = useSessionState(sessionId, (
|
|
989
|
-
const isStreaming = useSessionState(sessionId, (
|
|
988
|
+
const messages = useSessionState(sessionId, (state2) => state2.messages);
|
|
989
|
+
const isStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
|
|
990
990
|
const hideTodo = useHideTodo();
|
|
991
991
|
const revealRevision = usePlanRevealRevision(sessionId);
|
|
992
992
|
const { current, updating } = useMemo2(() => getPlanUpdateDisplayState(messages), [messages]);
|
|
@@ -3294,9 +3294,9 @@ function AgentLoopBlock({
|
|
|
3294
3294
|
defaultExpanded = false,
|
|
3295
3295
|
renderDescription
|
|
3296
3296
|
}) {
|
|
3297
|
-
const agentLoops = useSessionState(sessionId, (
|
|
3298
|
-
const messages = useSessionState(sessionId, (
|
|
3299
|
-
const askAnswers = useSessionState(sessionId, (
|
|
3297
|
+
const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
|
|
3298
|
+
const messages = useSessionState(sessionId, (state2) => state2.messages);
|
|
3299
|
+
const askAnswers = useSessionState(sessionId, (state2) => state2.askAnswers);
|
|
3300
3300
|
const loopEntry = useMemo8(() => {
|
|
3301
3301
|
for (const [loopName, info] of Object.entries(agentLoops)) {
|
|
3302
3302
|
if (info.toolCallId === toolCall.id) {
|
|
@@ -3787,9 +3787,9 @@ function RefTokenText({ text, refs }) {
|
|
|
3787
3787
|
return /* @__PURE__ */ jsx26(Fragment12, { children: parts });
|
|
3788
3788
|
}
|
|
3789
3789
|
function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
3790
|
-
const run = useSessionState(sessionId, (
|
|
3791
|
-
const agentLoops = useSessionState(sessionId, (
|
|
3792
|
-
const sessionMessages = useSessionState(sessionId, (
|
|
3790
|
+
const run = useSessionState(sessionId, (state2) => state2.workflowRuns[toolCall.id]);
|
|
3791
|
+
const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
|
|
3792
|
+
const sessionMessages = useSessionState(sessionId, (state2) => state2.messages);
|
|
3793
3793
|
const [collapsed, setCollapsed] = useState16(false);
|
|
3794
3794
|
const stepLoops = useMemo9(
|
|
3795
3795
|
() => Object.entries(agentLoops).filter(([, info]) => info.workflowRunId === toolCall.id).map(([loopName, info]) => ({ loopName, info })),
|
|
@@ -3840,7 +3840,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
3840
3840
|
const status = run?.status ?? "running";
|
|
3841
3841
|
const running = status === "running";
|
|
3842
3842
|
const stepCount = groups.length || stepLoops.length;
|
|
3843
|
-
const viewerRole = useSessionState(sessionId, (
|
|
3843
|
+
const viewerRole = useSessionState(sessionId, (state2) => state2.viewerRole);
|
|
3844
3844
|
const canListSkills = !sessionId.startsWith("share:") && viewerRole !== "viewer";
|
|
3845
3845
|
const { data: sessionSkills = NO_SKILLS } = useSessionSkills(canListSkills ? sessionId : null);
|
|
3846
3846
|
const title = workflowTitle(run?.name || "\u6280\u80FD", toolCall.arguments, sessionSkills);
|
|
@@ -4185,11 +4185,11 @@ function AssistantTurnBlockBase({
|
|
|
4185
4185
|
const displayModeMemoryKey = sessionId && firstEntryId ? `${sessionId}:${firstEntryId}` : null;
|
|
4186
4186
|
const sessionMessages = useSessionState(
|
|
4187
4187
|
sessionId,
|
|
4188
|
-
(
|
|
4188
|
+
(state2) => hasAgentToolCall ? state2.messages : EMPTY_MESSAGES
|
|
4189
4189
|
);
|
|
4190
4190
|
const agentLoops = useSessionState(
|
|
4191
4191
|
sessionId,
|
|
4192
|
-
(
|
|
4192
|
+
(state2) => hasAgentToolCall ? state2.agentLoops : EMPTY_AGENT_LOOPS
|
|
4193
4193
|
);
|
|
4194
4194
|
const turnMessages = useMemo10(
|
|
4195
4195
|
() => hasAgentToolCall ? collectTurnMessages({ rootMessages: messages, sessionMessages, agentLoops }) : messages,
|
|
@@ -5805,8 +5805,8 @@ function LiteMessageList({
|
|
|
5805
5805
|
};
|
|
5806
5806
|
}, [onLoadOlder, historyLoadRevision]);
|
|
5807
5807
|
const showContexts = false;
|
|
5808
|
-
const agentLoops = useSessionState(sessionId, (
|
|
5809
|
-
const askAnswers = useSessionState(sessionId, (
|
|
5808
|
+
const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
|
|
5809
|
+
const askAnswers = useSessionState(sessionId, (state2) => state2.askAnswers);
|
|
5810
5810
|
const rows = useMemo11(
|
|
5811
5811
|
() => buildLiteRows({
|
|
5812
5812
|
messages,
|
|
@@ -6111,11 +6111,11 @@ function LiteFollowup({
|
|
|
6111
6111
|
import { isBackgroundWakeMessage as isBackgroundWakeMessage3 } from "@blade-hq/agent-client/internal";
|
|
6112
6112
|
import {
|
|
6113
6113
|
useCallback as useCallback13,
|
|
6114
|
-
useEffect as
|
|
6114
|
+
useEffect as useEffect24,
|
|
6115
6115
|
useLayoutEffect as useLayoutEffect5,
|
|
6116
6116
|
useMemo as useMemo15,
|
|
6117
6117
|
useRef as useRef21,
|
|
6118
|
-
useState as
|
|
6118
|
+
useState as useState27
|
|
6119
6119
|
} from "react";
|
|
6120
6120
|
|
|
6121
6121
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/useStickToBottom.js
|
|
@@ -6173,14 +6173,14 @@ var useStickToBottom = (options = {}) => {
|
|
|
6173
6173
|
return range.commonAncestorContainer.contains(scrollRef.current) || scrollRef.current?.contains(range.commonAncestorContainer);
|
|
6174
6174
|
}, []);
|
|
6175
6175
|
const setIsAtBottom = useCallback8((isAtBottom2) => {
|
|
6176
|
-
|
|
6176
|
+
state2.isAtBottom = isAtBottom2;
|
|
6177
6177
|
updateIsAtBottom(isAtBottom2);
|
|
6178
6178
|
}, []);
|
|
6179
6179
|
const setEscapedFromLock = useCallback8((escapedFromLock2) => {
|
|
6180
|
-
|
|
6180
|
+
state2.escapedFromLock = escapedFromLock2;
|
|
6181
6181
|
updateEscapedFromLock(escapedFromLock2);
|
|
6182
6182
|
}, []);
|
|
6183
|
-
const
|
|
6183
|
+
const state2 = useMemo12(() => {
|
|
6184
6184
|
let lastCalculation;
|
|
6185
6185
|
return {
|
|
6186
6186
|
escapedFromLock,
|
|
@@ -6195,7 +6195,7 @@ var useStickToBottom = (options = {}) => {
|
|
|
6195
6195
|
set scrollTop(scrollTop) {
|
|
6196
6196
|
if (scrollRef.current) {
|
|
6197
6197
|
scrollRef.current.scrollTop = scrollTop;
|
|
6198
|
-
|
|
6198
|
+
state2.ignoreScrollToTop = scrollRef.current.scrollTop;
|
|
6199
6199
|
}
|
|
6200
6200
|
},
|
|
6201
6201
|
get targetScrollTop() {
|
|
@@ -6244,7 +6244,7 @@ var useStickToBottom = (options = {}) => {
|
|
|
6244
6244
|
const behavior = mergeAnimations(optionsRef.current, scrollOptions.animation);
|
|
6245
6245
|
const { ignoreEscapes = false } = scrollOptions;
|
|
6246
6246
|
let durationElapsed;
|
|
6247
|
-
let startTarget =
|
|
6247
|
+
let startTarget = state2.calculatedTargetScrollTop;
|
|
6248
6248
|
if (scrollOptions.duration instanceof Promise) {
|
|
6249
6249
|
scrollOptions.duration.finally(() => {
|
|
6250
6250
|
durationElapsed = Date.now();
|
|
@@ -6254,16 +6254,16 @@ var useStickToBottom = (options = {}) => {
|
|
|
6254
6254
|
}
|
|
6255
6255
|
const next = async () => {
|
|
6256
6256
|
const promise = new Promise(requestAnimationFrame).then(() => {
|
|
6257
|
-
if (!
|
|
6258
|
-
|
|
6257
|
+
if (!state2.isAtBottom) {
|
|
6258
|
+
state2.animation = void 0;
|
|
6259
6259
|
return false;
|
|
6260
6260
|
}
|
|
6261
|
-
const { scrollTop } =
|
|
6261
|
+
const { scrollTop } = state2;
|
|
6262
6262
|
const tick = performance.now();
|
|
6263
|
-
const tickDelta = (tick - (
|
|
6264
|
-
|
|
6265
|
-
if (
|
|
6266
|
-
|
|
6263
|
+
const tickDelta = (tick - (state2.lastTick ?? tick)) / SIXTY_FPS_INTERVAL_MS;
|
|
6264
|
+
state2.animation || (state2.animation = { behavior, promise, ignoreEscapes });
|
|
6265
|
+
if (state2.animation.behavior === behavior) {
|
|
6266
|
+
state2.lastTick = tick;
|
|
6267
6267
|
}
|
|
6268
6268
|
if (isSelecting()) {
|
|
6269
6269
|
return next();
|
|
@@ -6271,53 +6271,53 @@ var useStickToBottom = (options = {}) => {
|
|
|
6271
6271
|
if (waitElapsed > Date.now()) {
|
|
6272
6272
|
return next();
|
|
6273
6273
|
}
|
|
6274
|
-
if (scrollTop < Math.min(startTarget,
|
|
6275
|
-
if (
|
|
6274
|
+
if (scrollTop < Math.min(startTarget, state2.calculatedTargetScrollTop)) {
|
|
6275
|
+
if (state2.animation?.behavior === behavior) {
|
|
6276
6276
|
if (behavior === "instant") {
|
|
6277
|
-
|
|
6277
|
+
state2.scrollTop = state2.calculatedTargetScrollTop;
|
|
6278
6278
|
return next();
|
|
6279
6279
|
}
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
if (
|
|
6284
|
-
|
|
6280
|
+
state2.velocity = (behavior.damping * state2.velocity + behavior.stiffness * state2.scrollDifference) / behavior.mass;
|
|
6281
|
+
state2.accumulated += state2.velocity * tickDelta;
|
|
6282
|
+
state2.scrollTop += state2.accumulated;
|
|
6283
|
+
if (state2.scrollTop !== scrollTop) {
|
|
6284
|
+
state2.accumulated = 0;
|
|
6285
6285
|
}
|
|
6286
6286
|
}
|
|
6287
6287
|
return next();
|
|
6288
6288
|
}
|
|
6289
6289
|
if (durationElapsed > Date.now()) {
|
|
6290
|
-
startTarget =
|
|
6290
|
+
startTarget = state2.calculatedTargetScrollTop;
|
|
6291
6291
|
return next();
|
|
6292
6292
|
}
|
|
6293
|
-
|
|
6294
|
-
if (
|
|
6293
|
+
state2.animation = void 0;
|
|
6294
|
+
if (state2.scrollTop < state2.calculatedTargetScrollTop) {
|
|
6295
6295
|
return scrollToBottom({
|
|
6296
6296
|
animation: mergeAnimations(optionsRef.current, optionsRef.current.resize),
|
|
6297
6297
|
ignoreEscapes,
|
|
6298
6298
|
duration: Math.max(0, durationElapsed - Date.now()) || void 0
|
|
6299
6299
|
});
|
|
6300
6300
|
}
|
|
6301
|
-
return
|
|
6301
|
+
return state2.isAtBottom;
|
|
6302
6302
|
});
|
|
6303
6303
|
return promise.then((isAtBottom2) => {
|
|
6304
6304
|
requestAnimationFrame(() => {
|
|
6305
|
-
if (!
|
|
6306
|
-
|
|
6307
|
-
|
|
6305
|
+
if (!state2.animation) {
|
|
6306
|
+
state2.lastTick = void 0;
|
|
6307
|
+
state2.velocity = 0;
|
|
6308
6308
|
}
|
|
6309
6309
|
});
|
|
6310
6310
|
return isAtBottom2;
|
|
6311
6311
|
});
|
|
6312
6312
|
};
|
|
6313
6313
|
if (scrollOptions.wait !== true) {
|
|
6314
|
-
|
|
6314
|
+
state2.animation = void 0;
|
|
6315
6315
|
}
|
|
6316
|
-
if (
|
|
6317
|
-
return
|
|
6316
|
+
if (state2.animation?.behavior === behavior) {
|
|
6317
|
+
return state2.animation.promise;
|
|
6318
6318
|
}
|
|
6319
6319
|
return next();
|
|
6320
|
-
}, [setIsAtBottom, isSelecting,
|
|
6320
|
+
}, [setIsAtBottom, isSelecting, state2]);
|
|
6321
6321
|
const stopScroll = useCallback8(() => {
|
|
6322
6322
|
setEscapedFromLock(true);
|
|
6323
6323
|
setIsAtBottom(false);
|
|
@@ -6326,16 +6326,16 @@ var useStickToBottom = (options = {}) => {
|
|
|
6326
6326
|
if (target !== scrollRef.current) {
|
|
6327
6327
|
return;
|
|
6328
6328
|
}
|
|
6329
|
-
const { scrollTop, ignoreScrollToTop } =
|
|
6330
|
-
let { lastScrollTop = scrollTop } =
|
|
6331
|
-
|
|
6332
|
-
|
|
6329
|
+
const { scrollTop, ignoreScrollToTop } = state2;
|
|
6330
|
+
let { lastScrollTop = scrollTop } = state2;
|
|
6331
|
+
state2.lastScrollTop = scrollTop;
|
|
6332
|
+
state2.ignoreScrollToTop = void 0;
|
|
6333
6333
|
if (ignoreScrollToTop && ignoreScrollToTop > scrollTop) {
|
|
6334
6334
|
lastScrollTop = ignoreScrollToTop;
|
|
6335
6335
|
}
|
|
6336
|
-
setIsNearBottom(
|
|
6336
|
+
setIsNearBottom(state2.isNearBottom);
|
|
6337
6337
|
setTimeout(() => {
|
|
6338
|
-
if (
|
|
6338
|
+
if (state2.resizeDifference || scrollTop === ignoreScrollToTop) {
|
|
6339
6339
|
return;
|
|
6340
6340
|
}
|
|
6341
6341
|
if (isSelecting()) {
|
|
@@ -6345,8 +6345,8 @@ var useStickToBottom = (options = {}) => {
|
|
|
6345
6345
|
}
|
|
6346
6346
|
const isScrollingDown = scrollTop > lastScrollTop;
|
|
6347
6347
|
const isScrollingUp = scrollTop < lastScrollTop;
|
|
6348
|
-
if (
|
|
6349
|
-
|
|
6348
|
+
if (state2.animation?.ignoreEscapes) {
|
|
6349
|
+
state2.scrollTop = lastScrollTop;
|
|
6350
6350
|
return;
|
|
6351
6351
|
}
|
|
6352
6352
|
if (isScrollingUp) {
|
|
@@ -6356,11 +6356,11 @@ var useStickToBottom = (options = {}) => {
|
|
|
6356
6356
|
if (isScrollingDown) {
|
|
6357
6357
|
setEscapedFromLock(false);
|
|
6358
6358
|
}
|
|
6359
|
-
if (!
|
|
6359
|
+
if (!state2.escapedFromLock && state2.isNearBottom) {
|
|
6360
6360
|
setIsAtBottom(true);
|
|
6361
6361
|
}
|
|
6362
6362
|
}, 1);
|
|
6363
|
-
}, [setEscapedFromLock, setIsAtBottom, isSelecting,
|
|
6363
|
+
}, [setEscapedFromLock, setIsAtBottom, isSelecting, state2]);
|
|
6364
6364
|
const handleWheel = useCallback8(({ target, deltaY }) => {
|
|
6365
6365
|
let element = target;
|
|
6366
6366
|
while (!["scroll", "auto"].includes(getComputedStyle(element).overflow)) {
|
|
@@ -6369,11 +6369,11 @@ var useStickToBottom = (options = {}) => {
|
|
|
6369
6369
|
}
|
|
6370
6370
|
element = element.parentElement;
|
|
6371
6371
|
}
|
|
6372
|
-
if (element === scrollRef.current && deltaY < 0 && scrollRef.current.scrollHeight > scrollRef.current.clientHeight && !
|
|
6372
|
+
if (element === scrollRef.current && deltaY < 0 && scrollRef.current.scrollHeight > scrollRef.current.clientHeight && !state2.animation?.ignoreEscapes) {
|
|
6373
6373
|
setEscapedFromLock(true);
|
|
6374
6374
|
setIsAtBottom(false);
|
|
6375
6375
|
}
|
|
6376
|
-
}, [setEscapedFromLock, setIsAtBottom,
|
|
6376
|
+
}, [setEscapedFromLock, setIsAtBottom, state2]);
|
|
6377
6377
|
const scrollRef = useRefCallback((scroll) => {
|
|
6378
6378
|
scrollRef.current?.removeEventListener("scroll", handleScroll);
|
|
6379
6379
|
scrollRef.current?.removeEventListener("wheel", handleWheel);
|
|
@@ -6381,19 +6381,19 @@ var useStickToBottom = (options = {}) => {
|
|
|
6381
6381
|
scroll?.addEventListener("wheel", handleWheel, { passive: true });
|
|
6382
6382
|
}, []);
|
|
6383
6383
|
const contentRef = useRefCallback((content) => {
|
|
6384
|
-
|
|
6384
|
+
state2.resizeObserver?.disconnect();
|
|
6385
6385
|
if (!content) {
|
|
6386
6386
|
return;
|
|
6387
6387
|
}
|
|
6388
6388
|
let previousHeight;
|
|
6389
|
-
|
|
6389
|
+
state2.resizeObserver = new ResizeObserver(([entry]) => {
|
|
6390
6390
|
const { height } = entry.contentRect;
|
|
6391
6391
|
const difference = height - (previousHeight ?? height);
|
|
6392
|
-
|
|
6393
|
-
if (
|
|
6394
|
-
|
|
6392
|
+
state2.resizeDifference = difference;
|
|
6393
|
+
if (state2.scrollTop > state2.targetScrollTop) {
|
|
6394
|
+
state2.scrollTop = state2.targetScrollTop;
|
|
6395
6395
|
}
|
|
6396
|
-
setIsNearBottom(
|
|
6396
|
+
setIsNearBottom(state2.isNearBottom);
|
|
6397
6397
|
if (difference >= 0) {
|
|
6398
6398
|
const animation = mergeAnimations(optionsRef.current, previousHeight ? optionsRef.current.resize : optionsRef.current.initial);
|
|
6399
6399
|
scrollToBottom({
|
|
@@ -6403,7 +6403,7 @@ var useStickToBottom = (options = {}) => {
|
|
|
6403
6403
|
duration: animation === "instant" ? void 0 : RETAIN_ANIMATION_DURATION_MS
|
|
6404
6404
|
});
|
|
6405
6405
|
} else {
|
|
6406
|
-
if (
|
|
6406
|
+
if (state2.isNearBottom) {
|
|
6407
6407
|
setEscapedFromLock(false);
|
|
6408
6408
|
setIsAtBottom(true);
|
|
6409
6409
|
}
|
|
@@ -6411,13 +6411,13 @@ var useStickToBottom = (options = {}) => {
|
|
|
6411
6411
|
previousHeight = height;
|
|
6412
6412
|
requestAnimationFrame(() => {
|
|
6413
6413
|
setTimeout(() => {
|
|
6414
|
-
if (
|
|
6415
|
-
|
|
6414
|
+
if (state2.resizeDifference === difference) {
|
|
6415
|
+
state2.resizeDifference = 0;
|
|
6416
6416
|
}
|
|
6417
6417
|
}, 1);
|
|
6418
6418
|
});
|
|
6419
6419
|
});
|
|
6420
|
-
|
|
6420
|
+
state2.resizeObserver?.observe(content);
|
|
6421
6421
|
}, []);
|
|
6422
6422
|
return {
|
|
6423
6423
|
contentRef,
|
|
@@ -6427,7 +6427,7 @@ var useStickToBottom = (options = {}) => {
|
|
|
6427
6427
|
isAtBottom: isAtBottom || isNearBottom,
|
|
6428
6428
|
isNearBottom,
|
|
6429
6429
|
escapedFromLock,
|
|
6430
|
-
state
|
|
6430
|
+
state: state2
|
|
6431
6431
|
};
|
|
6432
6432
|
};
|
|
6433
6433
|
function useRefCallback(callback, deps) {
|
|
@@ -6480,7 +6480,7 @@ function StickToBottom({ instance, children, resize, initial, mass, damping, sti
|
|
|
6480
6480
|
initial,
|
|
6481
6481
|
targetScrollTop
|
|
6482
6482
|
});
|
|
6483
|
-
const { scrollRef, contentRef, scrollToBottom, stopScroll, isAtBottom, escapedFromLock, state } = instance ?? defaultInstance;
|
|
6483
|
+
const { scrollRef, contentRef, scrollToBottom, stopScroll, isAtBottom, escapedFromLock, state: state2 } = instance ?? defaultInstance;
|
|
6484
6484
|
const context = useMemo13(() => ({
|
|
6485
6485
|
scrollToBottom,
|
|
6486
6486
|
stopScroll,
|
|
@@ -6488,7 +6488,7 @@ function StickToBottom({ instance, children, resize, initial, mass, damping, sti
|
|
|
6488
6488
|
isAtBottom,
|
|
6489
6489
|
escapedFromLock,
|
|
6490
6490
|
contentRef,
|
|
6491
|
-
state,
|
|
6491
|
+
state: state2,
|
|
6492
6492
|
get targetScrollTop() {
|
|
6493
6493
|
return customTargetScrollTop.current;
|
|
6494
6494
|
},
|
|
@@ -6502,7 +6502,7 @@ function StickToBottom({ instance, children, resize, initial, mass, damping, sti
|
|
|
6502
6502
|
scrollRef,
|
|
6503
6503
|
stopScroll,
|
|
6504
6504
|
escapedFromLock,
|
|
6505
|
-
|
|
6505
|
+
state2
|
|
6506
6506
|
]);
|
|
6507
6507
|
useImperativeHandle(contextRef, () => context, [context]);
|
|
6508
6508
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -6678,7 +6678,17 @@ function useTurnNavigation({
|
|
|
6678
6678
|
setIndex({ sessionId, items: keep });
|
|
6679
6679
|
load2().then((items) => {
|
|
6680
6680
|
if (seq2 !== indexSeq.current) return;
|
|
6681
|
-
const navItems = items.map((item) => ({
|
|
6681
|
+
const navItems = items.map((item) => ({
|
|
6682
|
+
id: item.entryId,
|
|
6683
|
+
title: item.preview,
|
|
6684
|
+
recaption: item.recaption,
|
|
6685
|
+
artifacts: item.artifacts,
|
|
6686
|
+
entries: item.entries?.map((entry) => ({
|
|
6687
|
+
id: entry.entryId,
|
|
6688
|
+
title: entry.preview,
|
|
6689
|
+
answer: entry.answer
|
|
6690
|
+
}))
|
|
6691
|
+
}));
|
|
6682
6692
|
indexRef.current = { sessionId, items: navItems };
|
|
6683
6693
|
setIndex({ sessionId, items: navItems });
|
|
6684
6694
|
}).catch(() => {
|
|
@@ -6820,10 +6830,10 @@ function initialRevealState(targetText, isLive, resetKey) {
|
|
|
6820
6830
|
};
|
|
6821
6831
|
}
|
|
6822
6832
|
function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
6823
|
-
const [
|
|
6833
|
+
const [state2, setState2] = useState22(() => initialRevealState(targetText, isLive, resetKey));
|
|
6824
6834
|
const targetTextRef = useRef17(targetText);
|
|
6825
6835
|
targetTextRef.current = targetText;
|
|
6826
|
-
const revealedLenRef = useRef17(
|
|
6836
|
+
const revealedLenRef = useRef17(state2.revealedLen);
|
|
6827
6837
|
const priorTargetLenRef = useRef17(targetText.length);
|
|
6828
6838
|
const emaCpsRef = useRef17(REVEAL_INITIAL_CPS);
|
|
6829
6839
|
const lastTickTsRef = useRef17(null);
|
|
@@ -6837,9 +6847,9 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
|
6837
6847
|
stopTicking();
|
|
6838
6848
|
revealedLenRef.current = targetTextRef.current.length;
|
|
6839
6849
|
priorTargetLenRef.current = targetTextRef.current.length;
|
|
6840
|
-
|
|
6850
|
+
setState2((s) => ({ ...s, displayedText: targetTextRef.current, revealedLen: revealedLenRef.current, isRevealing: false }));
|
|
6841
6851
|
}, [stopTicking]);
|
|
6842
|
-
if (
|
|
6852
|
+
if (state2.resetKey !== resetKey) {
|
|
6843
6853
|
const next = initialRevealState(targetText, isLive, resetKey);
|
|
6844
6854
|
revealedLenRef.current = next.revealedLen;
|
|
6845
6855
|
priorTargetLenRef.current = targetText.length;
|
|
@@ -6847,18 +6857,18 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
|
6847
6857
|
lastTickTsRef.current = null;
|
|
6848
6858
|
lastArrivalTsRef.current = null;
|
|
6849
6859
|
stopTicking();
|
|
6850
|
-
|
|
6860
|
+
setState2(next);
|
|
6851
6861
|
} else if (!isLive) {
|
|
6852
|
-
if (
|
|
6862
|
+
if (state2.revealedLen !== targetText.length || state2.displayedText !== targetText) {
|
|
6853
6863
|
revealedLenRef.current = targetText.length;
|
|
6854
6864
|
priorTargetLenRef.current = targetText.length;
|
|
6855
6865
|
stopTicking();
|
|
6856
|
-
|
|
6866
|
+
setState2((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
|
|
6857
6867
|
}
|
|
6858
|
-
} else if (
|
|
6868
|
+
} else if (state2.revealedLen === 0 && targetText.length > 0) {
|
|
6859
6869
|
revealedLenRef.current = targetText.length;
|
|
6860
6870
|
priorTargetLenRef.current = targetText.length;
|
|
6861
|
-
|
|
6871
|
+
setState2((s) => ({ ...s, displayedText: targetText, revealedLen: targetText.length, isRevealing: false }));
|
|
6862
6872
|
}
|
|
6863
6873
|
const tickRef = useRef17(null);
|
|
6864
6874
|
tickRef.current = (ts) => {
|
|
@@ -6886,7 +6896,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
|
6886
6896
|
const advance = Math.max(1, paced, catchUp);
|
|
6887
6897
|
revealedLenRef.current = Math.min(currentTargetLen, revealedLenRef.current + advance);
|
|
6888
6898
|
const revealed = revealedLenRef.current >= currentTargetLen;
|
|
6889
|
-
|
|
6899
|
+
setState2((s) => ({
|
|
6890
6900
|
...s,
|
|
6891
6901
|
displayedText: targetTextRef.current.slice(
|
|
6892
6902
|
0,
|
|
@@ -6904,7 +6914,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
|
6904
6914
|
if (revealedLenRef.current === 0) return;
|
|
6905
6915
|
if (revealedLenRef.current >= targetText.length) return;
|
|
6906
6916
|
if (cancelRef.current != null) return;
|
|
6907
|
-
|
|
6917
|
+
setState2((s) => s.isRevealing ? s : { ...s, isRevealing: true });
|
|
6908
6918
|
cancelRef.current = scheduleAnimationFrame((ts) => tickRef.current?.(ts));
|
|
6909
6919
|
}, [targetText, isLive]);
|
|
6910
6920
|
useEffect19(() => {
|
|
@@ -6919,7 +6929,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
|
6919
6929
|
return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
6920
6930
|
}, [flushNow]);
|
|
6921
6931
|
useEffect19(() => stopTicking, [stopTicking]);
|
|
6922
|
-
return { displayedText:
|
|
6932
|
+
return { displayedText: state2.displayedText, isRevealing: state2.isRevealing, flushNow };
|
|
6923
6933
|
}
|
|
6924
6934
|
|
|
6925
6935
|
// src/chat/plan/PlanSummaryCard.tsx
|
|
@@ -7826,95 +7836,95 @@ function State$1(input, options) {
|
|
|
7826
7836
|
this.firstTabInLine = -1;
|
|
7827
7837
|
this.documents = [];
|
|
7828
7838
|
}
|
|
7829
|
-
function generateError(
|
|
7839
|
+
function generateError(state2, message) {
|
|
7830
7840
|
var mark = {
|
|
7831
|
-
name:
|
|
7832
|
-
buffer:
|
|
7841
|
+
name: state2.filename,
|
|
7842
|
+
buffer: state2.input.slice(0, -1),
|
|
7833
7843
|
// omit trailing \0
|
|
7834
|
-
position:
|
|
7835
|
-
line:
|
|
7836
|
-
column:
|
|
7844
|
+
position: state2.position,
|
|
7845
|
+
line: state2.line,
|
|
7846
|
+
column: state2.position - state2.lineStart
|
|
7837
7847
|
};
|
|
7838
7848
|
mark.snippet = snippet(mark);
|
|
7839
7849
|
return new exception(message, mark);
|
|
7840
7850
|
}
|
|
7841
|
-
function throwError(
|
|
7842
|
-
throw generateError(
|
|
7851
|
+
function throwError(state2, message) {
|
|
7852
|
+
throw generateError(state2, message);
|
|
7843
7853
|
}
|
|
7844
|
-
function throwWarning(
|
|
7845
|
-
if (
|
|
7846
|
-
|
|
7854
|
+
function throwWarning(state2, message) {
|
|
7855
|
+
if (state2.onWarning) {
|
|
7856
|
+
state2.onWarning.call(null, generateError(state2, message));
|
|
7847
7857
|
}
|
|
7848
7858
|
}
|
|
7849
7859
|
var directiveHandlers = {
|
|
7850
|
-
YAML: function handleYamlDirective(
|
|
7860
|
+
YAML: function handleYamlDirective(state2, name, args) {
|
|
7851
7861
|
var match, major, minor;
|
|
7852
|
-
if (
|
|
7853
|
-
throwError(
|
|
7862
|
+
if (state2.version !== null) {
|
|
7863
|
+
throwError(state2, "duplication of %YAML directive");
|
|
7854
7864
|
}
|
|
7855
7865
|
if (args.length !== 1) {
|
|
7856
|
-
throwError(
|
|
7866
|
+
throwError(state2, "YAML directive accepts exactly one argument");
|
|
7857
7867
|
}
|
|
7858
7868
|
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
7859
7869
|
if (match === null) {
|
|
7860
|
-
throwError(
|
|
7870
|
+
throwError(state2, "ill-formed argument of the YAML directive");
|
|
7861
7871
|
}
|
|
7862
7872
|
major = parseInt(match[1], 10);
|
|
7863
7873
|
minor = parseInt(match[2], 10);
|
|
7864
7874
|
if (major !== 1) {
|
|
7865
|
-
throwError(
|
|
7875
|
+
throwError(state2, "unacceptable YAML version of the document");
|
|
7866
7876
|
}
|
|
7867
|
-
|
|
7868
|
-
|
|
7877
|
+
state2.version = args[0];
|
|
7878
|
+
state2.checkLineBreaks = minor < 2;
|
|
7869
7879
|
if (minor !== 1 && minor !== 2) {
|
|
7870
|
-
throwWarning(
|
|
7880
|
+
throwWarning(state2, "unsupported YAML version of the document");
|
|
7871
7881
|
}
|
|
7872
7882
|
},
|
|
7873
|
-
TAG: function handleTagDirective(
|
|
7883
|
+
TAG: function handleTagDirective(state2, name, args) {
|
|
7874
7884
|
var handle, prefix;
|
|
7875
7885
|
if (args.length !== 2) {
|
|
7876
|
-
throwError(
|
|
7886
|
+
throwError(state2, "TAG directive accepts exactly two arguments");
|
|
7877
7887
|
}
|
|
7878
7888
|
handle = args[0];
|
|
7879
7889
|
prefix = args[1];
|
|
7880
7890
|
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
7881
|
-
throwError(
|
|
7891
|
+
throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
|
|
7882
7892
|
}
|
|
7883
|
-
if (_hasOwnProperty$1.call(
|
|
7884
|
-
throwError(
|
|
7893
|
+
if (_hasOwnProperty$1.call(state2.tagMap, handle)) {
|
|
7894
|
+
throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
7885
7895
|
}
|
|
7886
7896
|
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
7887
|
-
throwError(
|
|
7897
|
+
throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
7888
7898
|
}
|
|
7889
7899
|
try {
|
|
7890
7900
|
prefix = decodeURIComponent(prefix);
|
|
7891
7901
|
} catch (err) {
|
|
7892
|
-
throwError(
|
|
7902
|
+
throwError(state2, "tag prefix is malformed: " + prefix);
|
|
7893
7903
|
}
|
|
7894
|
-
|
|
7904
|
+
state2.tagMap[handle] = prefix;
|
|
7895
7905
|
}
|
|
7896
7906
|
};
|
|
7897
|
-
function captureSegment(
|
|
7907
|
+
function captureSegment(state2, start, end, checkJson) {
|
|
7898
7908
|
var _position, _length, _character, _result;
|
|
7899
7909
|
if (start < end) {
|
|
7900
|
-
_result =
|
|
7910
|
+
_result = state2.input.slice(start, end);
|
|
7901
7911
|
if (checkJson) {
|
|
7902
7912
|
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
7903
7913
|
_character = _result.charCodeAt(_position);
|
|
7904
7914
|
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
7905
|
-
throwError(
|
|
7915
|
+
throwError(state2, "expected valid JSON character");
|
|
7906
7916
|
}
|
|
7907
7917
|
}
|
|
7908
7918
|
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
7909
|
-
throwError(
|
|
7919
|
+
throwError(state2, "the stream contains non-printable characters");
|
|
7910
7920
|
}
|
|
7911
|
-
|
|
7921
|
+
state2.result += _result;
|
|
7912
7922
|
}
|
|
7913
7923
|
}
|
|
7914
|
-
function mergeMappings(
|
|
7924
|
+
function mergeMappings(state2, destination, source, overridableKeys) {
|
|
7915
7925
|
var sourceKeys, key, index, quantity;
|
|
7916
7926
|
if (!common.isObject(source)) {
|
|
7917
|
-
throwError(
|
|
7927
|
+
throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
|
|
7918
7928
|
}
|
|
7919
7929
|
sourceKeys = Object.keys(source);
|
|
7920
7930
|
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
@@ -7925,13 +7935,13 @@ function mergeMappings(state, destination, source, overridableKeys) {
|
|
|
7925
7935
|
}
|
|
7926
7936
|
}
|
|
7927
7937
|
}
|
|
7928
|
-
function storeMappingPair(
|
|
7938
|
+
function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
7929
7939
|
var index, quantity;
|
|
7930
7940
|
if (Array.isArray(keyNode)) {
|
|
7931
7941
|
keyNode = Array.prototype.slice.call(keyNode);
|
|
7932
7942
|
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
7933
7943
|
if (Array.isArray(keyNode[index])) {
|
|
7934
|
-
throwError(
|
|
7944
|
+
throwError(state2, "nested arrays are not supported inside keys");
|
|
7935
7945
|
}
|
|
7936
7946
|
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
7937
7947
|
keyNode[index] = "[object Object]";
|
|
@@ -7948,246 +7958,246 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
|
|
7948
7958
|
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
7949
7959
|
if (Array.isArray(valueNode)) {
|
|
7950
7960
|
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
7951
|
-
mergeMappings(
|
|
7961
|
+
mergeMappings(state2, _result, valueNode[index], overridableKeys);
|
|
7952
7962
|
}
|
|
7953
7963
|
} else {
|
|
7954
|
-
mergeMappings(
|
|
7964
|
+
mergeMappings(state2, _result, valueNode, overridableKeys);
|
|
7955
7965
|
}
|
|
7956
7966
|
} else {
|
|
7957
|
-
if (!
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
throwError(
|
|
7967
|
+
if (!state2.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
|
7968
|
+
state2.line = startLine || state2.line;
|
|
7969
|
+
state2.lineStart = startLineStart || state2.lineStart;
|
|
7970
|
+
state2.position = startPos || state2.position;
|
|
7971
|
+
throwError(state2, "duplicated mapping key");
|
|
7962
7972
|
}
|
|
7963
7973
|
setProperty(_result, keyNode, valueNode);
|
|
7964
7974
|
delete overridableKeys[keyNode];
|
|
7965
7975
|
}
|
|
7966
7976
|
return _result;
|
|
7967
7977
|
}
|
|
7968
|
-
function readLineBreak(
|
|
7978
|
+
function readLineBreak(state2) {
|
|
7969
7979
|
var ch;
|
|
7970
|
-
ch =
|
|
7980
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
7971
7981
|
if (ch === 10) {
|
|
7972
|
-
|
|
7982
|
+
state2.position++;
|
|
7973
7983
|
} else if (ch === 13) {
|
|
7974
|
-
|
|
7975
|
-
if (
|
|
7976
|
-
|
|
7984
|
+
state2.position++;
|
|
7985
|
+
if (state2.input.charCodeAt(state2.position) === 10) {
|
|
7986
|
+
state2.position++;
|
|
7977
7987
|
}
|
|
7978
7988
|
} else {
|
|
7979
|
-
throwError(
|
|
7989
|
+
throwError(state2, "a line break is expected");
|
|
7980
7990
|
}
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7991
|
+
state2.line += 1;
|
|
7992
|
+
state2.lineStart = state2.position;
|
|
7993
|
+
state2.firstTabInLine = -1;
|
|
7984
7994
|
}
|
|
7985
|
-
function skipSeparationSpace(
|
|
7986
|
-
var lineBreaks = 0, ch =
|
|
7995
|
+
function skipSeparationSpace(state2, allowComments, checkIndent) {
|
|
7996
|
+
var lineBreaks = 0, ch = state2.input.charCodeAt(state2.position);
|
|
7987
7997
|
while (ch !== 0) {
|
|
7988
7998
|
while (is_WHITE_SPACE(ch)) {
|
|
7989
|
-
if (ch === 9 &&
|
|
7990
|
-
|
|
7999
|
+
if (ch === 9 && state2.firstTabInLine === -1) {
|
|
8000
|
+
state2.firstTabInLine = state2.position;
|
|
7991
8001
|
}
|
|
7992
|
-
ch =
|
|
8002
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
7993
8003
|
}
|
|
7994
8004
|
if (allowComments && ch === 35) {
|
|
7995
8005
|
do {
|
|
7996
|
-
ch =
|
|
8006
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
7997
8007
|
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
7998
8008
|
}
|
|
7999
8009
|
if (is_EOL(ch)) {
|
|
8000
|
-
readLineBreak(
|
|
8001
|
-
ch =
|
|
8010
|
+
readLineBreak(state2);
|
|
8011
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8002
8012
|
lineBreaks++;
|
|
8003
|
-
|
|
8013
|
+
state2.lineIndent = 0;
|
|
8004
8014
|
while (ch === 32) {
|
|
8005
|
-
|
|
8006
|
-
ch =
|
|
8015
|
+
state2.lineIndent++;
|
|
8016
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8007
8017
|
}
|
|
8008
8018
|
} else {
|
|
8009
8019
|
break;
|
|
8010
8020
|
}
|
|
8011
8021
|
}
|
|
8012
|
-
if (checkIndent !== -1 && lineBreaks !== 0 &&
|
|
8013
|
-
throwWarning(
|
|
8022
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) {
|
|
8023
|
+
throwWarning(state2, "deficient indentation");
|
|
8014
8024
|
}
|
|
8015
8025
|
return lineBreaks;
|
|
8016
8026
|
}
|
|
8017
|
-
function testDocumentSeparator(
|
|
8018
|
-
var _position =
|
|
8019
|
-
ch =
|
|
8020
|
-
if ((ch === 45 || ch === 46) && ch ===
|
|
8027
|
+
function testDocumentSeparator(state2) {
|
|
8028
|
+
var _position = state2.position, ch;
|
|
8029
|
+
ch = state2.input.charCodeAt(_position);
|
|
8030
|
+
if ((ch === 45 || ch === 46) && ch === state2.input.charCodeAt(_position + 1) && ch === state2.input.charCodeAt(_position + 2)) {
|
|
8021
8031
|
_position += 3;
|
|
8022
|
-
ch =
|
|
8032
|
+
ch = state2.input.charCodeAt(_position);
|
|
8023
8033
|
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
8024
8034
|
return true;
|
|
8025
8035
|
}
|
|
8026
8036
|
}
|
|
8027
8037
|
return false;
|
|
8028
8038
|
}
|
|
8029
|
-
function writeFoldedLines(
|
|
8039
|
+
function writeFoldedLines(state2, count) {
|
|
8030
8040
|
if (count === 1) {
|
|
8031
|
-
|
|
8041
|
+
state2.result += " ";
|
|
8032
8042
|
} else if (count > 1) {
|
|
8033
|
-
|
|
8043
|
+
state2.result += common.repeat("\n", count - 1);
|
|
8034
8044
|
}
|
|
8035
8045
|
}
|
|
8036
|
-
function readPlainScalar(
|
|
8037
|
-
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind =
|
|
8038
|
-
ch =
|
|
8046
|
+
function readPlainScalar(state2, nodeIndent, withinFlowCollection) {
|
|
8047
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch;
|
|
8048
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8039
8049
|
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
8040
8050
|
return false;
|
|
8041
8051
|
}
|
|
8042
8052
|
if (ch === 63 || ch === 45) {
|
|
8043
|
-
following =
|
|
8053
|
+
following = state2.input.charCodeAt(state2.position + 1);
|
|
8044
8054
|
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
8045
8055
|
return false;
|
|
8046
8056
|
}
|
|
8047
8057
|
}
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
captureStart = captureEnd =
|
|
8058
|
+
state2.kind = "scalar";
|
|
8059
|
+
state2.result = "";
|
|
8060
|
+
captureStart = captureEnd = state2.position;
|
|
8051
8061
|
hasPendingContent = false;
|
|
8052
8062
|
while (ch !== 0) {
|
|
8053
8063
|
if (ch === 58) {
|
|
8054
|
-
following =
|
|
8064
|
+
following = state2.input.charCodeAt(state2.position + 1);
|
|
8055
8065
|
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
8056
8066
|
break;
|
|
8057
8067
|
}
|
|
8058
8068
|
} else if (ch === 35) {
|
|
8059
|
-
preceding =
|
|
8069
|
+
preceding = state2.input.charCodeAt(state2.position - 1);
|
|
8060
8070
|
if (is_WS_OR_EOL(preceding)) {
|
|
8061
8071
|
break;
|
|
8062
8072
|
}
|
|
8063
|
-
} else if (
|
|
8073
|
+
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
8064
8074
|
break;
|
|
8065
8075
|
} else if (is_EOL(ch)) {
|
|
8066
|
-
_line =
|
|
8067
|
-
_lineStart =
|
|
8068
|
-
_lineIndent =
|
|
8069
|
-
skipSeparationSpace(
|
|
8070
|
-
if (
|
|
8076
|
+
_line = state2.line;
|
|
8077
|
+
_lineStart = state2.lineStart;
|
|
8078
|
+
_lineIndent = state2.lineIndent;
|
|
8079
|
+
skipSeparationSpace(state2, false, -1);
|
|
8080
|
+
if (state2.lineIndent >= nodeIndent) {
|
|
8071
8081
|
hasPendingContent = true;
|
|
8072
|
-
ch =
|
|
8082
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8073
8083
|
continue;
|
|
8074
8084
|
} else {
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8085
|
+
state2.position = captureEnd;
|
|
8086
|
+
state2.line = _line;
|
|
8087
|
+
state2.lineStart = _lineStart;
|
|
8088
|
+
state2.lineIndent = _lineIndent;
|
|
8079
8089
|
break;
|
|
8080
8090
|
}
|
|
8081
8091
|
}
|
|
8082
8092
|
if (hasPendingContent) {
|
|
8083
|
-
captureSegment(
|
|
8084
|
-
writeFoldedLines(
|
|
8085
|
-
captureStart = captureEnd =
|
|
8093
|
+
captureSegment(state2, captureStart, captureEnd, false);
|
|
8094
|
+
writeFoldedLines(state2, state2.line - _line);
|
|
8095
|
+
captureStart = captureEnd = state2.position;
|
|
8086
8096
|
hasPendingContent = false;
|
|
8087
8097
|
}
|
|
8088
8098
|
if (!is_WHITE_SPACE(ch)) {
|
|
8089
|
-
captureEnd =
|
|
8099
|
+
captureEnd = state2.position + 1;
|
|
8090
8100
|
}
|
|
8091
|
-
ch =
|
|
8101
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8092
8102
|
}
|
|
8093
|
-
captureSegment(
|
|
8094
|
-
if (
|
|
8103
|
+
captureSegment(state2, captureStart, captureEnd, false);
|
|
8104
|
+
if (state2.result) {
|
|
8095
8105
|
return true;
|
|
8096
8106
|
}
|
|
8097
|
-
|
|
8098
|
-
|
|
8107
|
+
state2.kind = _kind;
|
|
8108
|
+
state2.result = _result;
|
|
8099
8109
|
return false;
|
|
8100
8110
|
}
|
|
8101
|
-
function readSingleQuotedScalar(
|
|
8111
|
+
function readSingleQuotedScalar(state2, nodeIndent) {
|
|
8102
8112
|
var ch, captureStart, captureEnd;
|
|
8103
|
-
ch =
|
|
8113
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8104
8114
|
if (ch !== 39) {
|
|
8105
8115
|
return false;
|
|
8106
8116
|
}
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
captureStart = captureEnd =
|
|
8111
|
-
while ((ch =
|
|
8117
|
+
state2.kind = "scalar";
|
|
8118
|
+
state2.result = "";
|
|
8119
|
+
state2.position++;
|
|
8120
|
+
captureStart = captureEnd = state2.position;
|
|
8121
|
+
while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
|
8112
8122
|
if (ch === 39) {
|
|
8113
|
-
captureSegment(
|
|
8114
|
-
ch =
|
|
8123
|
+
captureSegment(state2, captureStart, state2.position, true);
|
|
8124
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8115
8125
|
if (ch === 39) {
|
|
8116
|
-
captureStart =
|
|
8117
|
-
|
|
8118
|
-
captureEnd =
|
|
8126
|
+
captureStart = state2.position;
|
|
8127
|
+
state2.position++;
|
|
8128
|
+
captureEnd = state2.position;
|
|
8119
8129
|
} else {
|
|
8120
8130
|
return true;
|
|
8121
8131
|
}
|
|
8122
8132
|
} else if (is_EOL(ch)) {
|
|
8123
|
-
captureSegment(
|
|
8124
|
-
writeFoldedLines(
|
|
8125
|
-
captureStart = captureEnd =
|
|
8126
|
-
} else if (
|
|
8127
|
-
throwError(
|
|
8133
|
+
captureSegment(state2, captureStart, captureEnd, true);
|
|
8134
|
+
writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
|
|
8135
|
+
captureStart = captureEnd = state2.position;
|
|
8136
|
+
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
|
8137
|
+
throwError(state2, "unexpected end of the document within a single quoted scalar");
|
|
8128
8138
|
} else {
|
|
8129
|
-
|
|
8130
|
-
captureEnd =
|
|
8139
|
+
state2.position++;
|
|
8140
|
+
captureEnd = state2.position;
|
|
8131
8141
|
}
|
|
8132
8142
|
}
|
|
8133
|
-
throwError(
|
|
8143
|
+
throwError(state2, "unexpected end of the stream within a single quoted scalar");
|
|
8134
8144
|
}
|
|
8135
|
-
function readDoubleQuotedScalar(
|
|
8145
|
+
function readDoubleQuotedScalar(state2, nodeIndent) {
|
|
8136
8146
|
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
8137
|
-
ch =
|
|
8147
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8138
8148
|
if (ch !== 34) {
|
|
8139
8149
|
return false;
|
|
8140
8150
|
}
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
captureStart = captureEnd =
|
|
8145
|
-
while ((ch =
|
|
8151
|
+
state2.kind = "scalar";
|
|
8152
|
+
state2.result = "";
|
|
8153
|
+
state2.position++;
|
|
8154
|
+
captureStart = captureEnd = state2.position;
|
|
8155
|
+
while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
|
8146
8156
|
if (ch === 34) {
|
|
8147
|
-
captureSegment(
|
|
8148
|
-
|
|
8157
|
+
captureSegment(state2, captureStart, state2.position, true);
|
|
8158
|
+
state2.position++;
|
|
8149
8159
|
return true;
|
|
8150
8160
|
} else if (ch === 92) {
|
|
8151
|
-
captureSegment(
|
|
8152
|
-
ch =
|
|
8161
|
+
captureSegment(state2, captureStart, state2.position, true);
|
|
8162
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8153
8163
|
if (is_EOL(ch)) {
|
|
8154
|
-
skipSeparationSpace(
|
|
8164
|
+
skipSeparationSpace(state2, false, nodeIndent);
|
|
8155
8165
|
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
8156
|
-
|
|
8157
|
-
|
|
8166
|
+
state2.result += simpleEscapeMap[ch];
|
|
8167
|
+
state2.position++;
|
|
8158
8168
|
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
8159
8169
|
hexLength = tmp;
|
|
8160
8170
|
hexResult = 0;
|
|
8161
8171
|
for (; hexLength > 0; hexLength--) {
|
|
8162
|
-
ch =
|
|
8172
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8163
8173
|
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
8164
8174
|
hexResult = (hexResult << 4) + tmp;
|
|
8165
8175
|
} else {
|
|
8166
|
-
throwError(
|
|
8176
|
+
throwError(state2, "expected hexadecimal character");
|
|
8167
8177
|
}
|
|
8168
8178
|
}
|
|
8169
|
-
|
|
8170
|
-
|
|
8179
|
+
state2.result += charFromCodepoint(hexResult);
|
|
8180
|
+
state2.position++;
|
|
8171
8181
|
} else {
|
|
8172
|
-
throwError(
|
|
8182
|
+
throwError(state2, "unknown escape sequence");
|
|
8173
8183
|
}
|
|
8174
|
-
captureStart = captureEnd =
|
|
8184
|
+
captureStart = captureEnd = state2.position;
|
|
8175
8185
|
} else if (is_EOL(ch)) {
|
|
8176
|
-
captureSegment(
|
|
8177
|
-
writeFoldedLines(
|
|
8178
|
-
captureStart = captureEnd =
|
|
8179
|
-
} else if (
|
|
8180
|
-
throwError(
|
|
8186
|
+
captureSegment(state2, captureStart, captureEnd, true);
|
|
8187
|
+
writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
|
|
8188
|
+
captureStart = captureEnd = state2.position;
|
|
8189
|
+
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
|
8190
|
+
throwError(state2, "unexpected end of the document within a double quoted scalar");
|
|
8181
8191
|
} else {
|
|
8182
|
-
|
|
8183
|
-
captureEnd =
|
|
8192
|
+
state2.position++;
|
|
8193
|
+
captureEnd = state2.position;
|
|
8184
8194
|
}
|
|
8185
8195
|
}
|
|
8186
|
-
throwError(
|
|
8196
|
+
throwError(state2, "unexpected end of the stream within a double quoted scalar");
|
|
8187
8197
|
}
|
|
8188
|
-
function readFlowCollection(
|
|
8189
|
-
var readNext = true, _line, _lineStart, _pos, _tag =
|
|
8190
|
-
ch =
|
|
8198
|
+
function readFlowCollection(state2, nodeIndent) {
|
|
8199
|
+
var readNext = true, _line, _lineStart, _pos, _tag = state2.tag, _result, _anchor = state2.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
8200
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8191
8201
|
if (ch === 91) {
|
|
8192
8202
|
terminator = 93;
|
|
8193
8203
|
isMapping = false;
|
|
@@ -8199,71 +8209,71 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
8199
8209
|
} else {
|
|
8200
8210
|
return false;
|
|
8201
8211
|
}
|
|
8202
|
-
if (
|
|
8203
|
-
|
|
8212
|
+
if (state2.anchor !== null) {
|
|
8213
|
+
state2.anchorMap[state2.anchor] = _result;
|
|
8204
8214
|
}
|
|
8205
|
-
ch =
|
|
8215
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8206
8216
|
while (ch !== 0) {
|
|
8207
|
-
skipSeparationSpace(
|
|
8208
|
-
ch =
|
|
8217
|
+
skipSeparationSpace(state2, true, nodeIndent);
|
|
8218
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8209
8219
|
if (ch === terminator) {
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8220
|
+
state2.position++;
|
|
8221
|
+
state2.tag = _tag;
|
|
8222
|
+
state2.anchor = _anchor;
|
|
8223
|
+
state2.kind = isMapping ? "mapping" : "sequence";
|
|
8224
|
+
state2.result = _result;
|
|
8215
8225
|
return true;
|
|
8216
8226
|
} else if (!readNext) {
|
|
8217
|
-
throwError(
|
|
8227
|
+
throwError(state2, "missed comma between flow collection entries");
|
|
8218
8228
|
} else if (ch === 44) {
|
|
8219
|
-
throwError(
|
|
8229
|
+
throwError(state2, "expected the node content, but found ','");
|
|
8220
8230
|
}
|
|
8221
8231
|
keyTag = keyNode = valueNode = null;
|
|
8222
8232
|
isPair = isExplicitPair = false;
|
|
8223
8233
|
if (ch === 63) {
|
|
8224
|
-
following =
|
|
8234
|
+
following = state2.input.charCodeAt(state2.position + 1);
|
|
8225
8235
|
if (is_WS_OR_EOL(following)) {
|
|
8226
8236
|
isPair = isExplicitPair = true;
|
|
8227
|
-
|
|
8228
|
-
skipSeparationSpace(
|
|
8229
|
-
}
|
|
8230
|
-
}
|
|
8231
|
-
_line =
|
|
8232
|
-
_lineStart =
|
|
8233
|
-
_pos =
|
|
8234
|
-
composeNode(
|
|
8235
|
-
keyTag =
|
|
8236
|
-
keyNode =
|
|
8237
|
-
skipSeparationSpace(
|
|
8238
|
-
ch =
|
|
8239
|
-
if ((isExplicitPair ||
|
|
8237
|
+
state2.position++;
|
|
8238
|
+
skipSeparationSpace(state2, true, nodeIndent);
|
|
8239
|
+
}
|
|
8240
|
+
}
|
|
8241
|
+
_line = state2.line;
|
|
8242
|
+
_lineStart = state2.lineStart;
|
|
8243
|
+
_pos = state2.position;
|
|
8244
|
+
composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
8245
|
+
keyTag = state2.tag;
|
|
8246
|
+
keyNode = state2.result;
|
|
8247
|
+
skipSeparationSpace(state2, true, nodeIndent);
|
|
8248
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8249
|
+
if ((isExplicitPair || state2.line === _line) && ch === 58) {
|
|
8240
8250
|
isPair = true;
|
|
8241
|
-
ch =
|
|
8242
|
-
skipSeparationSpace(
|
|
8243
|
-
composeNode(
|
|
8244
|
-
valueNode =
|
|
8251
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8252
|
+
skipSeparationSpace(state2, true, nodeIndent);
|
|
8253
|
+
composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
8254
|
+
valueNode = state2.result;
|
|
8245
8255
|
}
|
|
8246
8256
|
if (isMapping) {
|
|
8247
|
-
storeMappingPair(
|
|
8257
|
+
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
8248
8258
|
} else if (isPair) {
|
|
8249
|
-
_result.push(storeMappingPair(
|
|
8259
|
+
_result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
8250
8260
|
} else {
|
|
8251
8261
|
_result.push(keyNode);
|
|
8252
8262
|
}
|
|
8253
|
-
skipSeparationSpace(
|
|
8254
|
-
ch =
|
|
8263
|
+
skipSeparationSpace(state2, true, nodeIndent);
|
|
8264
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8255
8265
|
if (ch === 44) {
|
|
8256
8266
|
readNext = true;
|
|
8257
|
-
ch =
|
|
8267
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8258
8268
|
} else {
|
|
8259
8269
|
readNext = false;
|
|
8260
8270
|
}
|
|
8261
8271
|
}
|
|
8262
|
-
throwError(
|
|
8272
|
+
throwError(state2, "unexpected end of the stream within a flow collection");
|
|
8263
8273
|
}
|
|
8264
|
-
function readBlockScalar(
|
|
8274
|
+
function readBlockScalar(state2, nodeIndent) {
|
|
8265
8275
|
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
8266
|
-
ch =
|
|
8276
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8267
8277
|
if (ch === 124) {
|
|
8268
8278
|
folding = false;
|
|
8269
8279
|
} else if (ch === 62) {
|
|
@@ -8271,24 +8281,24 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
8271
8281
|
} else {
|
|
8272
8282
|
return false;
|
|
8273
8283
|
}
|
|
8274
|
-
|
|
8275
|
-
|
|
8284
|
+
state2.kind = "scalar";
|
|
8285
|
+
state2.result = "";
|
|
8276
8286
|
while (ch !== 0) {
|
|
8277
|
-
ch =
|
|
8287
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8278
8288
|
if (ch === 43 || ch === 45) {
|
|
8279
8289
|
if (CHOMPING_CLIP === chomping) {
|
|
8280
8290
|
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
8281
8291
|
} else {
|
|
8282
|
-
throwError(
|
|
8292
|
+
throwError(state2, "repeat of a chomping mode identifier");
|
|
8283
8293
|
}
|
|
8284
8294
|
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
8285
8295
|
if (tmp === 0) {
|
|
8286
|
-
throwError(
|
|
8296
|
+
throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
8287
8297
|
} else if (!detectedIndent) {
|
|
8288
8298
|
textIndent = nodeIndent + tmp - 1;
|
|
8289
8299
|
detectedIndent = true;
|
|
8290
8300
|
} else {
|
|
8291
|
-
throwError(
|
|
8301
|
+
throwError(state2, "repeat of an indentation width identifier");
|
|
8292
8302
|
}
|
|
8293
8303
|
} else {
|
|
8294
8304
|
break;
|
|
@@ -8296,35 +8306,35 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
8296
8306
|
}
|
|
8297
8307
|
if (is_WHITE_SPACE(ch)) {
|
|
8298
8308
|
do {
|
|
8299
|
-
ch =
|
|
8309
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8300
8310
|
} while (is_WHITE_SPACE(ch));
|
|
8301
8311
|
if (ch === 35) {
|
|
8302
8312
|
do {
|
|
8303
|
-
ch =
|
|
8313
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8304
8314
|
} while (!is_EOL(ch) && ch !== 0);
|
|
8305
8315
|
}
|
|
8306
8316
|
}
|
|
8307
8317
|
while (ch !== 0) {
|
|
8308
|
-
readLineBreak(
|
|
8309
|
-
|
|
8310
|
-
ch =
|
|
8311
|
-
while ((!detectedIndent ||
|
|
8312
|
-
|
|
8313
|
-
ch =
|
|
8318
|
+
readLineBreak(state2);
|
|
8319
|
+
state2.lineIndent = 0;
|
|
8320
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8321
|
+
while ((!detectedIndent || state2.lineIndent < textIndent) && ch === 32) {
|
|
8322
|
+
state2.lineIndent++;
|
|
8323
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8314
8324
|
}
|
|
8315
|
-
if (!detectedIndent &&
|
|
8316
|
-
textIndent =
|
|
8325
|
+
if (!detectedIndent && state2.lineIndent > textIndent) {
|
|
8326
|
+
textIndent = state2.lineIndent;
|
|
8317
8327
|
}
|
|
8318
8328
|
if (is_EOL(ch)) {
|
|
8319
8329
|
emptyLines++;
|
|
8320
8330
|
continue;
|
|
8321
8331
|
}
|
|
8322
|
-
if (
|
|
8332
|
+
if (state2.lineIndent < textIndent) {
|
|
8323
8333
|
if (chomping === CHOMPING_KEEP) {
|
|
8324
|
-
|
|
8334
|
+
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
8325
8335
|
} else if (chomping === CHOMPING_CLIP) {
|
|
8326
8336
|
if (didReadContent) {
|
|
8327
|
-
|
|
8337
|
+
state2.result += "\n";
|
|
8328
8338
|
}
|
|
8329
8339
|
}
|
|
8330
8340
|
break;
|
|
@@ -8332,97 +8342,97 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
8332
8342
|
if (folding) {
|
|
8333
8343
|
if (is_WHITE_SPACE(ch)) {
|
|
8334
8344
|
atMoreIndented = true;
|
|
8335
|
-
|
|
8345
|
+
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
8336
8346
|
} else if (atMoreIndented) {
|
|
8337
8347
|
atMoreIndented = false;
|
|
8338
|
-
|
|
8348
|
+
state2.result += common.repeat("\n", emptyLines + 1);
|
|
8339
8349
|
} else if (emptyLines === 0) {
|
|
8340
8350
|
if (didReadContent) {
|
|
8341
|
-
|
|
8351
|
+
state2.result += " ";
|
|
8342
8352
|
}
|
|
8343
8353
|
} else {
|
|
8344
|
-
|
|
8354
|
+
state2.result += common.repeat("\n", emptyLines);
|
|
8345
8355
|
}
|
|
8346
8356
|
} else {
|
|
8347
|
-
|
|
8357
|
+
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
8348
8358
|
}
|
|
8349
8359
|
didReadContent = true;
|
|
8350
8360
|
detectedIndent = true;
|
|
8351
8361
|
emptyLines = 0;
|
|
8352
|
-
captureStart =
|
|
8362
|
+
captureStart = state2.position;
|
|
8353
8363
|
while (!is_EOL(ch) && ch !== 0) {
|
|
8354
|
-
ch =
|
|
8364
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8355
8365
|
}
|
|
8356
|
-
captureSegment(
|
|
8366
|
+
captureSegment(state2, captureStart, state2.position, false);
|
|
8357
8367
|
}
|
|
8358
8368
|
return true;
|
|
8359
8369
|
}
|
|
8360
|
-
function readBlockSequence(
|
|
8361
|
-
var _line, _tag =
|
|
8362
|
-
if (
|
|
8363
|
-
if (
|
|
8364
|
-
|
|
8370
|
+
function readBlockSequence(state2, nodeIndent) {
|
|
8371
|
+
var _line, _tag = state2.tag, _anchor = state2.anchor, _result = [], following, detected = false, ch;
|
|
8372
|
+
if (state2.firstTabInLine !== -1) return false;
|
|
8373
|
+
if (state2.anchor !== null) {
|
|
8374
|
+
state2.anchorMap[state2.anchor] = _result;
|
|
8365
8375
|
}
|
|
8366
|
-
ch =
|
|
8376
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8367
8377
|
while (ch !== 0) {
|
|
8368
|
-
if (
|
|
8369
|
-
|
|
8370
|
-
throwError(
|
|
8378
|
+
if (state2.firstTabInLine !== -1) {
|
|
8379
|
+
state2.position = state2.firstTabInLine;
|
|
8380
|
+
throwError(state2, "tab characters must not be used in indentation");
|
|
8371
8381
|
}
|
|
8372
8382
|
if (ch !== 45) {
|
|
8373
8383
|
break;
|
|
8374
8384
|
}
|
|
8375
|
-
following =
|
|
8385
|
+
following = state2.input.charCodeAt(state2.position + 1);
|
|
8376
8386
|
if (!is_WS_OR_EOL(following)) {
|
|
8377
8387
|
break;
|
|
8378
8388
|
}
|
|
8379
8389
|
detected = true;
|
|
8380
|
-
|
|
8381
|
-
if (skipSeparationSpace(
|
|
8382
|
-
if (
|
|
8390
|
+
state2.position++;
|
|
8391
|
+
if (skipSeparationSpace(state2, true, -1)) {
|
|
8392
|
+
if (state2.lineIndent <= nodeIndent) {
|
|
8383
8393
|
_result.push(null);
|
|
8384
|
-
ch =
|
|
8394
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8385
8395
|
continue;
|
|
8386
8396
|
}
|
|
8387
8397
|
}
|
|
8388
|
-
_line =
|
|
8389
|
-
composeNode(
|
|
8390
|
-
_result.push(
|
|
8391
|
-
skipSeparationSpace(
|
|
8392
|
-
ch =
|
|
8393
|
-
if ((
|
|
8394
|
-
throwError(
|
|
8395
|
-
} else if (
|
|
8398
|
+
_line = state2.line;
|
|
8399
|
+
composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
8400
|
+
_result.push(state2.result);
|
|
8401
|
+
skipSeparationSpace(state2, true, -1);
|
|
8402
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8403
|
+
if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
|
|
8404
|
+
throwError(state2, "bad indentation of a sequence entry");
|
|
8405
|
+
} else if (state2.lineIndent < nodeIndent) {
|
|
8396
8406
|
break;
|
|
8397
8407
|
}
|
|
8398
8408
|
}
|
|
8399
8409
|
if (detected) {
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8410
|
+
state2.tag = _tag;
|
|
8411
|
+
state2.anchor = _anchor;
|
|
8412
|
+
state2.kind = "sequence";
|
|
8413
|
+
state2.result = _result;
|
|
8404
8414
|
return true;
|
|
8405
8415
|
}
|
|
8406
8416
|
return false;
|
|
8407
8417
|
}
|
|
8408
|
-
function readBlockMapping(
|
|
8409
|
-
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag =
|
|
8410
|
-
if (
|
|
8411
|
-
if (
|
|
8412
|
-
|
|
8418
|
+
function readBlockMapping(state2, nodeIndent, flowIndent) {
|
|
8419
|
+
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state2.tag, _anchor = state2.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
8420
|
+
if (state2.firstTabInLine !== -1) return false;
|
|
8421
|
+
if (state2.anchor !== null) {
|
|
8422
|
+
state2.anchorMap[state2.anchor] = _result;
|
|
8413
8423
|
}
|
|
8414
|
-
ch =
|
|
8424
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8415
8425
|
while (ch !== 0) {
|
|
8416
|
-
if (!atExplicitKey &&
|
|
8417
|
-
|
|
8418
|
-
throwError(
|
|
8426
|
+
if (!atExplicitKey && state2.firstTabInLine !== -1) {
|
|
8427
|
+
state2.position = state2.firstTabInLine;
|
|
8428
|
+
throwError(state2, "tab characters must not be used in indentation");
|
|
8419
8429
|
}
|
|
8420
|
-
following =
|
|
8421
|
-
_line =
|
|
8430
|
+
following = state2.input.charCodeAt(state2.position + 1);
|
|
8431
|
+
_line = state2.line;
|
|
8422
8432
|
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
8423
8433
|
if (ch === 63) {
|
|
8424
8434
|
if (atExplicitKey) {
|
|
8425
|
-
storeMappingPair(
|
|
8435
|
+
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
8426
8436
|
keyTag = keyNode = valueNode = null;
|
|
8427
8437
|
}
|
|
8428
8438
|
detected = true;
|
|
@@ -8432,229 +8442,229 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
8432
8442
|
atExplicitKey = false;
|
|
8433
8443
|
allowCompact = true;
|
|
8434
8444
|
} else {
|
|
8435
|
-
throwError(
|
|
8445
|
+
throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
8436
8446
|
}
|
|
8437
|
-
|
|
8447
|
+
state2.position += 1;
|
|
8438
8448
|
ch = following;
|
|
8439
8449
|
} else {
|
|
8440
|
-
_keyLine =
|
|
8441
|
-
_keyLineStart =
|
|
8442
|
-
_keyPos =
|
|
8443
|
-
if (!composeNode(
|
|
8450
|
+
_keyLine = state2.line;
|
|
8451
|
+
_keyLineStart = state2.lineStart;
|
|
8452
|
+
_keyPos = state2.position;
|
|
8453
|
+
if (!composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
8444
8454
|
break;
|
|
8445
8455
|
}
|
|
8446
|
-
if (
|
|
8447
|
-
ch =
|
|
8456
|
+
if (state2.line === _line) {
|
|
8457
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8448
8458
|
while (is_WHITE_SPACE(ch)) {
|
|
8449
|
-
ch =
|
|
8459
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8450
8460
|
}
|
|
8451
8461
|
if (ch === 58) {
|
|
8452
|
-
ch =
|
|
8462
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8453
8463
|
if (!is_WS_OR_EOL(ch)) {
|
|
8454
|
-
throwError(
|
|
8464
|
+
throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
8455
8465
|
}
|
|
8456
8466
|
if (atExplicitKey) {
|
|
8457
|
-
storeMappingPair(
|
|
8467
|
+
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
8458
8468
|
keyTag = keyNode = valueNode = null;
|
|
8459
8469
|
}
|
|
8460
8470
|
detected = true;
|
|
8461
8471
|
atExplicitKey = false;
|
|
8462
8472
|
allowCompact = false;
|
|
8463
|
-
keyTag =
|
|
8464
|
-
keyNode =
|
|
8473
|
+
keyTag = state2.tag;
|
|
8474
|
+
keyNode = state2.result;
|
|
8465
8475
|
} else if (detected) {
|
|
8466
|
-
throwError(
|
|
8476
|
+
throwError(state2, "can not read an implicit mapping pair; a colon is missed");
|
|
8467
8477
|
} else {
|
|
8468
|
-
|
|
8469
|
-
|
|
8478
|
+
state2.tag = _tag;
|
|
8479
|
+
state2.anchor = _anchor;
|
|
8470
8480
|
return true;
|
|
8471
8481
|
}
|
|
8472
8482
|
} else if (detected) {
|
|
8473
|
-
throwError(
|
|
8483
|
+
throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
8474
8484
|
} else {
|
|
8475
|
-
|
|
8476
|
-
|
|
8485
|
+
state2.tag = _tag;
|
|
8486
|
+
state2.anchor = _anchor;
|
|
8477
8487
|
return true;
|
|
8478
8488
|
}
|
|
8479
8489
|
}
|
|
8480
|
-
if (
|
|
8490
|
+
if (state2.line === _line || state2.lineIndent > nodeIndent) {
|
|
8481
8491
|
if (atExplicitKey) {
|
|
8482
|
-
_keyLine =
|
|
8483
|
-
_keyLineStart =
|
|
8484
|
-
_keyPos =
|
|
8492
|
+
_keyLine = state2.line;
|
|
8493
|
+
_keyLineStart = state2.lineStart;
|
|
8494
|
+
_keyPos = state2.position;
|
|
8485
8495
|
}
|
|
8486
|
-
if (composeNode(
|
|
8496
|
+
if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
8487
8497
|
if (atExplicitKey) {
|
|
8488
|
-
keyNode =
|
|
8498
|
+
keyNode = state2.result;
|
|
8489
8499
|
} else {
|
|
8490
|
-
valueNode =
|
|
8500
|
+
valueNode = state2.result;
|
|
8491
8501
|
}
|
|
8492
8502
|
}
|
|
8493
8503
|
if (!atExplicitKey) {
|
|
8494
|
-
storeMappingPair(
|
|
8504
|
+
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
8495
8505
|
keyTag = keyNode = valueNode = null;
|
|
8496
8506
|
}
|
|
8497
|
-
skipSeparationSpace(
|
|
8498
|
-
ch =
|
|
8507
|
+
skipSeparationSpace(state2, true, -1);
|
|
8508
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8499
8509
|
}
|
|
8500
|
-
if ((
|
|
8501
|
-
throwError(
|
|
8502
|
-
} else if (
|
|
8510
|
+
if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
|
|
8511
|
+
throwError(state2, "bad indentation of a mapping entry");
|
|
8512
|
+
} else if (state2.lineIndent < nodeIndent) {
|
|
8503
8513
|
break;
|
|
8504
8514
|
}
|
|
8505
8515
|
}
|
|
8506
8516
|
if (atExplicitKey) {
|
|
8507
|
-
storeMappingPair(
|
|
8517
|
+
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
8508
8518
|
}
|
|
8509
8519
|
if (detected) {
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8520
|
+
state2.tag = _tag;
|
|
8521
|
+
state2.anchor = _anchor;
|
|
8522
|
+
state2.kind = "mapping";
|
|
8523
|
+
state2.result = _result;
|
|
8514
8524
|
}
|
|
8515
8525
|
return detected;
|
|
8516
8526
|
}
|
|
8517
|
-
function readTagProperty(
|
|
8527
|
+
function readTagProperty(state2) {
|
|
8518
8528
|
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
8519
|
-
ch =
|
|
8529
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8520
8530
|
if (ch !== 33) return false;
|
|
8521
|
-
if (
|
|
8522
|
-
throwError(
|
|
8531
|
+
if (state2.tag !== null) {
|
|
8532
|
+
throwError(state2, "duplication of a tag property");
|
|
8523
8533
|
}
|
|
8524
|
-
ch =
|
|
8534
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8525
8535
|
if (ch === 60) {
|
|
8526
8536
|
isVerbatim = true;
|
|
8527
|
-
ch =
|
|
8537
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8528
8538
|
} else if (ch === 33) {
|
|
8529
8539
|
isNamed = true;
|
|
8530
8540
|
tagHandle = "!!";
|
|
8531
|
-
ch =
|
|
8541
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8532
8542
|
} else {
|
|
8533
8543
|
tagHandle = "!";
|
|
8534
8544
|
}
|
|
8535
|
-
_position =
|
|
8545
|
+
_position = state2.position;
|
|
8536
8546
|
if (isVerbatim) {
|
|
8537
8547
|
do {
|
|
8538
|
-
ch =
|
|
8548
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8539
8549
|
} while (ch !== 0 && ch !== 62);
|
|
8540
|
-
if (
|
|
8541
|
-
tagName =
|
|
8542
|
-
ch =
|
|
8550
|
+
if (state2.position < state2.length) {
|
|
8551
|
+
tagName = state2.input.slice(_position, state2.position);
|
|
8552
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8543
8553
|
} else {
|
|
8544
|
-
throwError(
|
|
8554
|
+
throwError(state2, "unexpected end of the stream within a verbatim tag");
|
|
8545
8555
|
}
|
|
8546
8556
|
} else {
|
|
8547
8557
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
8548
8558
|
if (ch === 33) {
|
|
8549
8559
|
if (!isNamed) {
|
|
8550
|
-
tagHandle =
|
|
8560
|
+
tagHandle = state2.input.slice(_position - 1, state2.position + 1);
|
|
8551
8561
|
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
8552
|
-
throwError(
|
|
8562
|
+
throwError(state2, "named tag handle cannot contain such characters");
|
|
8553
8563
|
}
|
|
8554
8564
|
isNamed = true;
|
|
8555
|
-
_position =
|
|
8565
|
+
_position = state2.position + 1;
|
|
8556
8566
|
} else {
|
|
8557
|
-
throwError(
|
|
8567
|
+
throwError(state2, "tag suffix cannot contain exclamation marks");
|
|
8558
8568
|
}
|
|
8559
8569
|
}
|
|
8560
|
-
ch =
|
|
8570
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8561
8571
|
}
|
|
8562
|
-
tagName =
|
|
8572
|
+
tagName = state2.input.slice(_position, state2.position);
|
|
8563
8573
|
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
8564
|
-
throwError(
|
|
8574
|
+
throwError(state2, "tag suffix cannot contain flow indicator characters");
|
|
8565
8575
|
}
|
|
8566
8576
|
}
|
|
8567
8577
|
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
8568
|
-
throwError(
|
|
8578
|
+
throwError(state2, "tag name cannot contain such characters: " + tagName);
|
|
8569
8579
|
}
|
|
8570
8580
|
try {
|
|
8571
8581
|
tagName = decodeURIComponent(tagName);
|
|
8572
8582
|
} catch (err) {
|
|
8573
|
-
throwError(
|
|
8583
|
+
throwError(state2, "tag name is malformed: " + tagName);
|
|
8574
8584
|
}
|
|
8575
8585
|
if (isVerbatim) {
|
|
8576
|
-
|
|
8577
|
-
} else if (_hasOwnProperty$1.call(
|
|
8578
|
-
|
|
8586
|
+
state2.tag = tagName;
|
|
8587
|
+
} else if (_hasOwnProperty$1.call(state2.tagMap, tagHandle)) {
|
|
8588
|
+
state2.tag = state2.tagMap[tagHandle] + tagName;
|
|
8579
8589
|
} else if (tagHandle === "!") {
|
|
8580
|
-
|
|
8590
|
+
state2.tag = "!" + tagName;
|
|
8581
8591
|
} else if (tagHandle === "!!") {
|
|
8582
|
-
|
|
8592
|
+
state2.tag = "tag:yaml.org,2002:" + tagName;
|
|
8583
8593
|
} else {
|
|
8584
|
-
throwError(
|
|
8594
|
+
throwError(state2, 'undeclared tag handle "' + tagHandle + '"');
|
|
8585
8595
|
}
|
|
8586
8596
|
return true;
|
|
8587
8597
|
}
|
|
8588
|
-
function readAnchorProperty(
|
|
8598
|
+
function readAnchorProperty(state2) {
|
|
8589
8599
|
var _position, ch;
|
|
8590
|
-
ch =
|
|
8600
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8591
8601
|
if (ch !== 38) return false;
|
|
8592
|
-
if (
|
|
8593
|
-
throwError(
|
|
8602
|
+
if (state2.anchor !== null) {
|
|
8603
|
+
throwError(state2, "duplication of an anchor property");
|
|
8594
8604
|
}
|
|
8595
|
-
ch =
|
|
8596
|
-
_position =
|
|
8605
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8606
|
+
_position = state2.position;
|
|
8597
8607
|
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
8598
|
-
ch =
|
|
8608
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8599
8609
|
}
|
|
8600
|
-
if (
|
|
8601
|
-
throwError(
|
|
8610
|
+
if (state2.position === _position) {
|
|
8611
|
+
throwError(state2, "name of an anchor node must contain at least one character");
|
|
8602
8612
|
}
|
|
8603
|
-
|
|
8613
|
+
state2.anchor = state2.input.slice(_position, state2.position);
|
|
8604
8614
|
return true;
|
|
8605
8615
|
}
|
|
8606
|
-
function readAlias(
|
|
8616
|
+
function readAlias(state2) {
|
|
8607
8617
|
var _position, alias, ch;
|
|
8608
|
-
ch =
|
|
8618
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8609
8619
|
if (ch !== 42) return false;
|
|
8610
|
-
ch =
|
|
8611
|
-
_position =
|
|
8620
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8621
|
+
_position = state2.position;
|
|
8612
8622
|
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
8613
|
-
ch =
|
|
8623
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8614
8624
|
}
|
|
8615
|
-
if (
|
|
8616
|
-
throwError(
|
|
8625
|
+
if (state2.position === _position) {
|
|
8626
|
+
throwError(state2, "name of an alias node must contain at least one character");
|
|
8617
8627
|
}
|
|
8618
|
-
alias =
|
|
8619
|
-
if (!_hasOwnProperty$1.call(
|
|
8620
|
-
throwError(
|
|
8628
|
+
alias = state2.input.slice(_position, state2.position);
|
|
8629
|
+
if (!_hasOwnProperty$1.call(state2.anchorMap, alias)) {
|
|
8630
|
+
throwError(state2, 'unidentified alias "' + alias + '"');
|
|
8621
8631
|
}
|
|
8622
|
-
|
|
8623
|
-
skipSeparationSpace(
|
|
8632
|
+
state2.result = state2.anchorMap[alias];
|
|
8633
|
+
skipSeparationSpace(state2, true, -1);
|
|
8624
8634
|
return true;
|
|
8625
8635
|
}
|
|
8626
|
-
function composeNode(
|
|
8636
|
+
function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
8627
8637
|
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
|
8628
|
-
if (
|
|
8629
|
-
|
|
8638
|
+
if (state2.listener !== null) {
|
|
8639
|
+
state2.listener("open", state2);
|
|
8630
8640
|
}
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8641
|
+
state2.tag = null;
|
|
8642
|
+
state2.anchor = null;
|
|
8643
|
+
state2.kind = null;
|
|
8644
|
+
state2.result = null;
|
|
8635
8645
|
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
8636
8646
|
if (allowToSeek) {
|
|
8637
|
-
if (skipSeparationSpace(
|
|
8647
|
+
if (skipSeparationSpace(state2, true, -1)) {
|
|
8638
8648
|
atNewLine = true;
|
|
8639
|
-
if (
|
|
8649
|
+
if (state2.lineIndent > parentIndent) {
|
|
8640
8650
|
indentStatus = 1;
|
|
8641
|
-
} else if (
|
|
8651
|
+
} else if (state2.lineIndent === parentIndent) {
|
|
8642
8652
|
indentStatus = 0;
|
|
8643
|
-
} else if (
|
|
8653
|
+
} else if (state2.lineIndent < parentIndent) {
|
|
8644
8654
|
indentStatus = -1;
|
|
8645
8655
|
}
|
|
8646
8656
|
}
|
|
8647
8657
|
}
|
|
8648
8658
|
if (indentStatus === 1) {
|
|
8649
|
-
while (readTagProperty(
|
|
8650
|
-
if (skipSeparationSpace(
|
|
8659
|
+
while (readTagProperty(state2) || readAnchorProperty(state2)) {
|
|
8660
|
+
if (skipSeparationSpace(state2, true, -1)) {
|
|
8651
8661
|
atNewLine = true;
|
|
8652
8662
|
allowBlockCollections = allowBlockStyles;
|
|
8653
|
-
if (
|
|
8663
|
+
if (state2.lineIndent > parentIndent) {
|
|
8654
8664
|
indentStatus = 1;
|
|
8655
|
-
} else if (
|
|
8665
|
+
} else if (state2.lineIndent === parentIndent) {
|
|
8656
8666
|
indentStatus = 0;
|
|
8657
|
-
} else if (
|
|
8667
|
+
} else if (state2.lineIndent < parentIndent) {
|
|
8658
8668
|
indentStatus = -1;
|
|
8659
8669
|
}
|
|
8660
8670
|
} else {
|
|
@@ -8671,153 +8681,153 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
8671
8681
|
} else {
|
|
8672
8682
|
flowIndent = parentIndent + 1;
|
|
8673
8683
|
}
|
|
8674
|
-
blockIndent =
|
|
8684
|
+
blockIndent = state2.position - state2.lineStart;
|
|
8675
8685
|
if (indentStatus === 1) {
|
|
8676
|
-
if (allowBlockCollections && (readBlockSequence(
|
|
8686
|
+
if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) {
|
|
8677
8687
|
hasContent = true;
|
|
8678
8688
|
} else {
|
|
8679
|
-
if (allowBlockScalars && readBlockScalar(
|
|
8689
|
+
if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) {
|
|
8680
8690
|
hasContent = true;
|
|
8681
|
-
} else if (readAlias(
|
|
8691
|
+
} else if (readAlias(state2)) {
|
|
8682
8692
|
hasContent = true;
|
|
8683
|
-
if (
|
|
8684
|
-
throwError(
|
|
8693
|
+
if (state2.tag !== null || state2.anchor !== null) {
|
|
8694
|
+
throwError(state2, "alias node should not have any properties");
|
|
8685
8695
|
}
|
|
8686
|
-
} else if (readPlainScalar(
|
|
8696
|
+
} else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
8687
8697
|
hasContent = true;
|
|
8688
|
-
if (
|
|
8689
|
-
|
|
8698
|
+
if (state2.tag === null) {
|
|
8699
|
+
state2.tag = "?";
|
|
8690
8700
|
}
|
|
8691
8701
|
}
|
|
8692
|
-
if (
|
|
8693
|
-
|
|
8702
|
+
if (state2.anchor !== null) {
|
|
8703
|
+
state2.anchorMap[state2.anchor] = state2.result;
|
|
8694
8704
|
}
|
|
8695
8705
|
}
|
|
8696
8706
|
} else if (indentStatus === 0) {
|
|
8697
|
-
hasContent = allowBlockCollections && readBlockSequence(
|
|
8707
|
+
hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent);
|
|
8698
8708
|
}
|
|
8699
8709
|
}
|
|
8700
|
-
if (
|
|
8701
|
-
if (
|
|
8702
|
-
|
|
8710
|
+
if (state2.tag === null) {
|
|
8711
|
+
if (state2.anchor !== null) {
|
|
8712
|
+
state2.anchorMap[state2.anchor] = state2.result;
|
|
8703
8713
|
}
|
|
8704
|
-
} else if (
|
|
8705
|
-
if (
|
|
8706
|
-
throwError(
|
|
8714
|
+
} else if (state2.tag === "?") {
|
|
8715
|
+
if (state2.result !== null && state2.kind !== "scalar") {
|
|
8716
|
+
throwError(state2, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state2.kind + '"');
|
|
8707
8717
|
}
|
|
8708
|
-
for (typeIndex = 0, typeQuantity =
|
|
8709
|
-
type2 =
|
|
8710
|
-
if (type2.resolve(
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
if (
|
|
8714
|
-
|
|
8718
|
+
for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
8719
|
+
type2 = state2.implicitTypes[typeIndex];
|
|
8720
|
+
if (type2.resolve(state2.result)) {
|
|
8721
|
+
state2.result = type2.construct(state2.result);
|
|
8722
|
+
state2.tag = type2.tag;
|
|
8723
|
+
if (state2.anchor !== null) {
|
|
8724
|
+
state2.anchorMap[state2.anchor] = state2.result;
|
|
8715
8725
|
}
|
|
8716
8726
|
break;
|
|
8717
8727
|
}
|
|
8718
8728
|
}
|
|
8719
|
-
} else if (
|
|
8720
|
-
if (_hasOwnProperty$1.call(
|
|
8721
|
-
type2 =
|
|
8729
|
+
} else if (state2.tag !== "!") {
|
|
8730
|
+
if (_hasOwnProperty$1.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) {
|
|
8731
|
+
type2 = state2.typeMap[state2.kind || "fallback"][state2.tag];
|
|
8722
8732
|
} else {
|
|
8723
8733
|
type2 = null;
|
|
8724
|
-
typeList =
|
|
8734
|
+
typeList = state2.typeMap.multi[state2.kind || "fallback"];
|
|
8725
8735
|
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
8726
|
-
if (
|
|
8736
|
+
if (state2.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
8727
8737
|
type2 = typeList[typeIndex];
|
|
8728
8738
|
break;
|
|
8729
8739
|
}
|
|
8730
8740
|
}
|
|
8731
8741
|
}
|
|
8732
8742
|
if (!type2) {
|
|
8733
|
-
throwError(
|
|
8743
|
+
throwError(state2, "unknown tag !<" + state2.tag + ">");
|
|
8734
8744
|
}
|
|
8735
|
-
if (
|
|
8736
|
-
throwError(
|
|
8745
|
+
if (state2.result !== null && type2.kind !== state2.kind) {
|
|
8746
|
+
throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type2.kind + '", not "' + state2.kind + '"');
|
|
8737
8747
|
}
|
|
8738
|
-
if (!type2.resolve(
|
|
8739
|
-
throwError(
|
|
8748
|
+
if (!type2.resolve(state2.result, state2.tag)) {
|
|
8749
|
+
throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag");
|
|
8740
8750
|
} else {
|
|
8741
|
-
|
|
8742
|
-
if (
|
|
8743
|
-
|
|
8751
|
+
state2.result = type2.construct(state2.result, state2.tag);
|
|
8752
|
+
if (state2.anchor !== null) {
|
|
8753
|
+
state2.anchorMap[state2.anchor] = state2.result;
|
|
8744
8754
|
}
|
|
8745
8755
|
}
|
|
8746
8756
|
}
|
|
8747
|
-
if (
|
|
8748
|
-
|
|
8757
|
+
if (state2.listener !== null) {
|
|
8758
|
+
state2.listener("close", state2);
|
|
8749
8759
|
}
|
|
8750
|
-
return
|
|
8760
|
+
return state2.tag !== null || state2.anchor !== null || hasContent;
|
|
8751
8761
|
}
|
|
8752
|
-
function readDocument(
|
|
8753
|
-
var documentStart =
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
while ((ch =
|
|
8759
|
-
skipSeparationSpace(
|
|
8760
|
-
ch =
|
|
8761
|
-
if (
|
|
8762
|
+
function readDocument(state2) {
|
|
8763
|
+
var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
8764
|
+
state2.version = null;
|
|
8765
|
+
state2.checkLineBreaks = state2.legacy;
|
|
8766
|
+
state2.tagMap = /* @__PURE__ */ Object.create(null);
|
|
8767
|
+
state2.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
8768
|
+
while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
|
8769
|
+
skipSeparationSpace(state2, true, -1);
|
|
8770
|
+
ch = state2.input.charCodeAt(state2.position);
|
|
8771
|
+
if (state2.lineIndent > 0 || ch !== 37) {
|
|
8762
8772
|
break;
|
|
8763
8773
|
}
|
|
8764
8774
|
hasDirectives = true;
|
|
8765
|
-
ch =
|
|
8766
|
-
_position =
|
|
8775
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8776
|
+
_position = state2.position;
|
|
8767
8777
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
8768
|
-
ch =
|
|
8778
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8769
8779
|
}
|
|
8770
|
-
directiveName =
|
|
8780
|
+
directiveName = state2.input.slice(_position, state2.position);
|
|
8771
8781
|
directiveArgs = [];
|
|
8772
8782
|
if (directiveName.length < 1) {
|
|
8773
|
-
throwError(
|
|
8783
|
+
throwError(state2, "directive name must not be less than one character in length");
|
|
8774
8784
|
}
|
|
8775
8785
|
while (ch !== 0) {
|
|
8776
8786
|
while (is_WHITE_SPACE(ch)) {
|
|
8777
|
-
ch =
|
|
8787
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8778
8788
|
}
|
|
8779
8789
|
if (ch === 35) {
|
|
8780
8790
|
do {
|
|
8781
|
-
ch =
|
|
8791
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8782
8792
|
} while (ch !== 0 && !is_EOL(ch));
|
|
8783
8793
|
break;
|
|
8784
8794
|
}
|
|
8785
8795
|
if (is_EOL(ch)) break;
|
|
8786
|
-
_position =
|
|
8796
|
+
_position = state2.position;
|
|
8787
8797
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
8788
|
-
ch =
|
|
8798
|
+
ch = state2.input.charCodeAt(++state2.position);
|
|
8789
8799
|
}
|
|
8790
|
-
directiveArgs.push(
|
|
8800
|
+
directiveArgs.push(state2.input.slice(_position, state2.position));
|
|
8791
8801
|
}
|
|
8792
|
-
if (ch !== 0) readLineBreak(
|
|
8802
|
+
if (ch !== 0) readLineBreak(state2);
|
|
8793
8803
|
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
|
8794
|
-
directiveHandlers[directiveName](
|
|
8804
|
+
directiveHandlers[directiveName](state2, directiveName, directiveArgs);
|
|
8795
8805
|
} else {
|
|
8796
|
-
throwWarning(
|
|
8806
|
+
throwWarning(state2, 'unknown document directive "' + directiveName + '"');
|
|
8797
8807
|
}
|
|
8798
8808
|
}
|
|
8799
|
-
skipSeparationSpace(
|
|
8800
|
-
if (
|
|
8801
|
-
|
|
8802
|
-
skipSeparationSpace(
|
|
8809
|
+
skipSeparationSpace(state2, true, -1);
|
|
8810
|
+
if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) {
|
|
8811
|
+
state2.position += 3;
|
|
8812
|
+
skipSeparationSpace(state2, true, -1);
|
|
8803
8813
|
} else if (hasDirectives) {
|
|
8804
|
-
throwError(
|
|
8814
|
+
throwError(state2, "directives end mark is expected");
|
|
8805
8815
|
}
|
|
8806
|
-
composeNode(
|
|
8807
|
-
skipSeparationSpace(
|
|
8808
|
-
if (
|
|
8809
|
-
throwWarning(
|
|
8816
|
+
composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
8817
|
+
skipSeparationSpace(state2, true, -1);
|
|
8818
|
+
if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) {
|
|
8819
|
+
throwWarning(state2, "non-ASCII line breaks are interpreted as content");
|
|
8810
8820
|
}
|
|
8811
|
-
|
|
8812
|
-
if (
|
|
8813
|
-
if (
|
|
8814
|
-
|
|
8815
|
-
skipSeparationSpace(
|
|
8821
|
+
state2.documents.push(state2.result);
|
|
8822
|
+
if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
|
8823
|
+
if (state2.input.charCodeAt(state2.position) === 46) {
|
|
8824
|
+
state2.position += 3;
|
|
8825
|
+
skipSeparationSpace(state2, true, -1);
|
|
8816
8826
|
}
|
|
8817
8827
|
return;
|
|
8818
8828
|
}
|
|
8819
|
-
if (
|
|
8820
|
-
throwError(
|
|
8829
|
+
if (state2.position < state2.length - 1) {
|
|
8830
|
+
throwError(state2, "end of the stream or a document separator is expected");
|
|
8821
8831
|
} else {
|
|
8822
8832
|
return;
|
|
8823
8833
|
}
|
|
@@ -8833,21 +8843,21 @@ function loadDocuments(input, options) {
|
|
|
8833
8843
|
input = input.slice(1);
|
|
8834
8844
|
}
|
|
8835
8845
|
}
|
|
8836
|
-
var
|
|
8846
|
+
var state2 = new State$1(input, options);
|
|
8837
8847
|
var nullpos = input.indexOf("\0");
|
|
8838
8848
|
if (nullpos !== -1) {
|
|
8839
|
-
|
|
8840
|
-
throwError(
|
|
8849
|
+
state2.position = nullpos;
|
|
8850
|
+
throwError(state2, "null byte is not allowed in input");
|
|
8841
8851
|
}
|
|
8842
|
-
|
|
8843
|
-
while (
|
|
8844
|
-
|
|
8845
|
-
|
|
8852
|
+
state2.input += "\0";
|
|
8853
|
+
while (state2.input.charCodeAt(state2.position) === 32) {
|
|
8854
|
+
state2.lineIndent += 1;
|
|
8855
|
+
state2.position += 1;
|
|
8846
8856
|
}
|
|
8847
|
-
while (
|
|
8848
|
-
readDocument(
|
|
8857
|
+
while (state2.position < state2.length - 1) {
|
|
8858
|
+
readDocument(state2);
|
|
8849
8859
|
}
|
|
8850
|
-
return
|
|
8860
|
+
return state2.documents;
|
|
8851
8861
|
}
|
|
8852
8862
|
function loadAll$1(input, iterator, options) {
|
|
8853
8863
|
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
@@ -9015,13 +9025,13 @@ function indentString(string, spaces) {
|
|
|
9015
9025
|
}
|
|
9016
9026
|
return result;
|
|
9017
9027
|
}
|
|
9018
|
-
function generateNextLine(
|
|
9019
|
-
return "\n" + common.repeat(" ",
|
|
9028
|
+
function generateNextLine(state2, level) {
|
|
9029
|
+
return "\n" + common.repeat(" ", state2.indent * level);
|
|
9020
9030
|
}
|
|
9021
|
-
function testImplicitResolving(
|
|
9031
|
+
function testImplicitResolving(state2, str2) {
|
|
9022
9032
|
var index, length, type2;
|
|
9023
|
-
for (index = 0, length =
|
|
9024
|
-
type2 =
|
|
9033
|
+
for (index = 0, length = state2.implicitTypes.length; index < length; index += 1) {
|
|
9034
|
+
type2 = state2.implicitTypes[index];
|
|
9025
9035
|
if (type2.resolve(str2)) {
|
|
9026
9036
|
return true;
|
|
9027
9037
|
}
|
|
@@ -9123,30 +9133,30 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
|
|
|
9123
9133
|
}
|
|
9124
9134
|
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
9125
9135
|
}
|
|
9126
|
-
function writeScalar(
|
|
9127
|
-
|
|
9136
|
+
function writeScalar(state2, string, level, iskey, inblock) {
|
|
9137
|
+
state2.dump = (function() {
|
|
9128
9138
|
if (string.length === 0) {
|
|
9129
|
-
return
|
|
9139
|
+
return state2.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
9130
9140
|
}
|
|
9131
|
-
if (!
|
|
9141
|
+
if (!state2.noCompatMode) {
|
|
9132
9142
|
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
9133
|
-
return
|
|
9143
|
+
return state2.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
9134
9144
|
}
|
|
9135
9145
|
}
|
|
9136
|
-
var indent =
|
|
9137
|
-
var lineWidth =
|
|
9138
|
-
var singleLineOnly = iskey ||
|
|
9146
|
+
var indent = state2.indent * Math.max(1, level);
|
|
9147
|
+
var lineWidth = state2.lineWidth === -1 ? -1 : Math.max(Math.min(state2.lineWidth, 40), state2.lineWidth - indent);
|
|
9148
|
+
var singleLineOnly = iskey || state2.flowLevel > -1 && level >= state2.flowLevel;
|
|
9139
9149
|
function testAmbiguity(string2) {
|
|
9140
|
-
return testImplicitResolving(
|
|
9150
|
+
return testImplicitResolving(state2, string2);
|
|
9141
9151
|
}
|
|
9142
9152
|
switch (chooseScalarStyle(
|
|
9143
9153
|
string,
|
|
9144
9154
|
singleLineOnly,
|
|
9145
|
-
|
|
9155
|
+
state2.indent,
|
|
9146
9156
|
lineWidth,
|
|
9147
9157
|
testAmbiguity,
|
|
9148
|
-
|
|
9149
|
-
|
|
9158
|
+
state2.quotingType,
|
|
9159
|
+
state2.forceQuotes && !iskey,
|
|
9150
9160
|
inblock
|
|
9151
9161
|
)) {
|
|
9152
9162
|
case STYLE_PLAIN:
|
|
@@ -9154,9 +9164,9 @@ function writeScalar(state, string, level, iskey, inblock) {
|
|
|
9154
9164
|
case STYLE_SINGLE:
|
|
9155
9165
|
return "'" + string.replace(/'/g, "''") + "'";
|
|
9156
9166
|
case STYLE_LITERAL:
|
|
9157
|
-
return "|" + blockHeader(string,
|
|
9167
|
+
return "|" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(string, indent));
|
|
9158
9168
|
case STYLE_FOLDED:
|
|
9159
|
-
return ">" + blockHeader(string,
|
|
9169
|
+
return ">" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
9160
9170
|
case STYLE_DOUBLE:
|
|
9161
9171
|
return '"' + escapeString(string) + '"';
|
|
9162
9172
|
default:
|
|
@@ -9232,133 +9242,133 @@ function escapeString(string) {
|
|
|
9232
9242
|
}
|
|
9233
9243
|
return result;
|
|
9234
9244
|
}
|
|
9235
|
-
function writeFlowSequence(
|
|
9236
|
-
var _result = "", _tag =
|
|
9245
|
+
function writeFlowSequence(state2, level, object) {
|
|
9246
|
+
var _result = "", _tag = state2.tag, index, length, value;
|
|
9237
9247
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
9238
9248
|
value = object[index];
|
|
9239
|
-
if (
|
|
9240
|
-
value =
|
|
9249
|
+
if (state2.replacer) {
|
|
9250
|
+
value = state2.replacer.call(object, String(index), value);
|
|
9241
9251
|
}
|
|
9242
|
-
if (writeNode(
|
|
9243
|
-
if (_result !== "") _result += "," + (!
|
|
9244
|
-
_result +=
|
|
9252
|
+
if (writeNode(state2, level, value, false, false) || typeof value === "undefined" && writeNode(state2, level, null, false, false)) {
|
|
9253
|
+
if (_result !== "") _result += "," + (!state2.condenseFlow ? " " : "");
|
|
9254
|
+
_result += state2.dump;
|
|
9245
9255
|
}
|
|
9246
9256
|
}
|
|
9247
|
-
|
|
9248
|
-
|
|
9257
|
+
state2.tag = _tag;
|
|
9258
|
+
state2.dump = "[" + _result + "]";
|
|
9249
9259
|
}
|
|
9250
|
-
function writeBlockSequence(
|
|
9251
|
-
var _result = "", _tag =
|
|
9260
|
+
function writeBlockSequence(state2, level, object, compact) {
|
|
9261
|
+
var _result = "", _tag = state2.tag, index, length, value;
|
|
9252
9262
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
9253
9263
|
value = object[index];
|
|
9254
|
-
if (
|
|
9255
|
-
value =
|
|
9264
|
+
if (state2.replacer) {
|
|
9265
|
+
value = state2.replacer.call(object, String(index), value);
|
|
9256
9266
|
}
|
|
9257
|
-
if (writeNode(
|
|
9267
|
+
if (writeNode(state2, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state2, level + 1, null, true, true, false, true)) {
|
|
9258
9268
|
if (!compact || _result !== "") {
|
|
9259
|
-
_result += generateNextLine(
|
|
9269
|
+
_result += generateNextLine(state2, level);
|
|
9260
9270
|
}
|
|
9261
|
-
if (
|
|
9271
|
+
if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
|
|
9262
9272
|
_result += "-";
|
|
9263
9273
|
} else {
|
|
9264
9274
|
_result += "- ";
|
|
9265
9275
|
}
|
|
9266
|
-
_result +=
|
|
9276
|
+
_result += state2.dump;
|
|
9267
9277
|
}
|
|
9268
9278
|
}
|
|
9269
|
-
|
|
9270
|
-
|
|
9279
|
+
state2.tag = _tag;
|
|
9280
|
+
state2.dump = _result || "[]";
|
|
9271
9281
|
}
|
|
9272
|
-
function writeFlowMapping(
|
|
9273
|
-
var _result = "", _tag =
|
|
9282
|
+
function writeFlowMapping(state2, level, object) {
|
|
9283
|
+
var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
9274
9284
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
9275
9285
|
pairBuffer = "";
|
|
9276
9286
|
if (_result !== "") pairBuffer += ", ";
|
|
9277
|
-
if (
|
|
9287
|
+
if (state2.condenseFlow) pairBuffer += '"';
|
|
9278
9288
|
objectKey = objectKeyList[index];
|
|
9279
9289
|
objectValue = object[objectKey];
|
|
9280
|
-
if (
|
|
9281
|
-
objectValue =
|
|
9290
|
+
if (state2.replacer) {
|
|
9291
|
+
objectValue = state2.replacer.call(object, objectKey, objectValue);
|
|
9282
9292
|
}
|
|
9283
|
-
if (!writeNode(
|
|
9293
|
+
if (!writeNode(state2, level, objectKey, false, false)) {
|
|
9284
9294
|
continue;
|
|
9285
9295
|
}
|
|
9286
|
-
if (
|
|
9287
|
-
pairBuffer +=
|
|
9288
|
-
if (!writeNode(
|
|
9296
|
+
if (state2.dump.length > 1024) pairBuffer += "? ";
|
|
9297
|
+
pairBuffer += state2.dump + (state2.condenseFlow ? '"' : "") + ":" + (state2.condenseFlow ? "" : " ");
|
|
9298
|
+
if (!writeNode(state2, level, objectValue, false, false)) {
|
|
9289
9299
|
continue;
|
|
9290
9300
|
}
|
|
9291
|
-
pairBuffer +=
|
|
9301
|
+
pairBuffer += state2.dump;
|
|
9292
9302
|
_result += pairBuffer;
|
|
9293
9303
|
}
|
|
9294
|
-
|
|
9295
|
-
|
|
9304
|
+
state2.tag = _tag;
|
|
9305
|
+
state2.dump = "{" + _result + "}";
|
|
9296
9306
|
}
|
|
9297
|
-
function writeBlockMapping(
|
|
9298
|
-
var _result = "", _tag =
|
|
9299
|
-
if (
|
|
9307
|
+
function writeBlockMapping(state2, level, object, compact) {
|
|
9308
|
+
var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
9309
|
+
if (state2.sortKeys === true) {
|
|
9300
9310
|
objectKeyList.sort();
|
|
9301
|
-
} else if (typeof
|
|
9302
|
-
objectKeyList.sort(
|
|
9303
|
-
} else if (
|
|
9311
|
+
} else if (typeof state2.sortKeys === "function") {
|
|
9312
|
+
objectKeyList.sort(state2.sortKeys);
|
|
9313
|
+
} else if (state2.sortKeys) {
|
|
9304
9314
|
throw new exception("sortKeys must be a boolean or a function");
|
|
9305
9315
|
}
|
|
9306
9316
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
9307
9317
|
pairBuffer = "";
|
|
9308
9318
|
if (!compact || _result !== "") {
|
|
9309
|
-
pairBuffer += generateNextLine(
|
|
9319
|
+
pairBuffer += generateNextLine(state2, level);
|
|
9310
9320
|
}
|
|
9311
9321
|
objectKey = objectKeyList[index];
|
|
9312
9322
|
objectValue = object[objectKey];
|
|
9313
|
-
if (
|
|
9314
|
-
objectValue =
|
|
9323
|
+
if (state2.replacer) {
|
|
9324
|
+
objectValue = state2.replacer.call(object, objectKey, objectValue);
|
|
9315
9325
|
}
|
|
9316
|
-
if (!writeNode(
|
|
9326
|
+
if (!writeNode(state2, level + 1, objectKey, true, true, true)) {
|
|
9317
9327
|
continue;
|
|
9318
9328
|
}
|
|
9319
|
-
explicitPair =
|
|
9329
|
+
explicitPair = state2.tag !== null && state2.tag !== "?" || state2.dump && state2.dump.length > 1024;
|
|
9320
9330
|
if (explicitPair) {
|
|
9321
|
-
if (
|
|
9331
|
+
if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
|
|
9322
9332
|
pairBuffer += "?";
|
|
9323
9333
|
} else {
|
|
9324
9334
|
pairBuffer += "? ";
|
|
9325
9335
|
}
|
|
9326
9336
|
}
|
|
9327
|
-
pairBuffer +=
|
|
9337
|
+
pairBuffer += state2.dump;
|
|
9328
9338
|
if (explicitPair) {
|
|
9329
|
-
pairBuffer += generateNextLine(
|
|
9339
|
+
pairBuffer += generateNextLine(state2, level);
|
|
9330
9340
|
}
|
|
9331
|
-
if (!writeNode(
|
|
9341
|
+
if (!writeNode(state2, level + 1, objectValue, true, explicitPair)) {
|
|
9332
9342
|
continue;
|
|
9333
9343
|
}
|
|
9334
|
-
if (
|
|
9344
|
+
if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) {
|
|
9335
9345
|
pairBuffer += ":";
|
|
9336
9346
|
} else {
|
|
9337
9347
|
pairBuffer += ": ";
|
|
9338
9348
|
}
|
|
9339
|
-
pairBuffer +=
|
|
9349
|
+
pairBuffer += state2.dump;
|
|
9340
9350
|
_result += pairBuffer;
|
|
9341
9351
|
}
|
|
9342
|
-
|
|
9343
|
-
|
|
9352
|
+
state2.tag = _tag;
|
|
9353
|
+
state2.dump = _result || "{}";
|
|
9344
9354
|
}
|
|
9345
|
-
function detectType(
|
|
9355
|
+
function detectType(state2, object, explicit) {
|
|
9346
9356
|
var _result, typeList, index, length, type2, style;
|
|
9347
|
-
typeList = explicit ?
|
|
9357
|
+
typeList = explicit ? state2.explicitTypes : state2.implicitTypes;
|
|
9348
9358
|
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
9349
9359
|
type2 = typeList[index];
|
|
9350
9360
|
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
|
|
9351
9361
|
if (explicit) {
|
|
9352
9362
|
if (type2.multi && type2.representName) {
|
|
9353
|
-
|
|
9363
|
+
state2.tag = type2.representName(object);
|
|
9354
9364
|
} else {
|
|
9355
|
-
|
|
9365
|
+
state2.tag = type2.tag;
|
|
9356
9366
|
}
|
|
9357
9367
|
} else {
|
|
9358
|
-
|
|
9368
|
+
state2.tag = "?";
|
|
9359
9369
|
}
|
|
9360
9370
|
if (type2.represent) {
|
|
9361
|
-
style =
|
|
9371
|
+
style = state2.styleMap[type2.tag] || type2.defaultStyle;
|
|
9362
9372
|
if (_toString.call(type2.represent) === "[object Function]") {
|
|
9363
9373
|
_result = type2.represent(object, style);
|
|
9364
9374
|
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
@@ -9366,100 +9376,100 @@ function detectType(state, object, explicit) {
|
|
|
9366
9376
|
} else {
|
|
9367
9377
|
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
9368
9378
|
}
|
|
9369
|
-
|
|
9379
|
+
state2.dump = _result;
|
|
9370
9380
|
}
|
|
9371
9381
|
return true;
|
|
9372
9382
|
}
|
|
9373
9383
|
}
|
|
9374
9384
|
return false;
|
|
9375
9385
|
}
|
|
9376
|
-
function writeNode(
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
if (!detectType(
|
|
9380
|
-
detectType(
|
|
9386
|
+
function writeNode(state2, level, object, block, compact, iskey, isblockseq) {
|
|
9387
|
+
state2.tag = null;
|
|
9388
|
+
state2.dump = object;
|
|
9389
|
+
if (!detectType(state2, object, false)) {
|
|
9390
|
+
detectType(state2, object, true);
|
|
9381
9391
|
}
|
|
9382
|
-
var type2 = _toString.call(
|
|
9392
|
+
var type2 = _toString.call(state2.dump);
|
|
9383
9393
|
var inblock = block;
|
|
9384
9394
|
var tagStr;
|
|
9385
9395
|
if (block) {
|
|
9386
|
-
block =
|
|
9396
|
+
block = state2.flowLevel < 0 || state2.flowLevel > level;
|
|
9387
9397
|
}
|
|
9388
9398
|
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
|
9389
9399
|
if (objectOrArray) {
|
|
9390
|
-
duplicateIndex =
|
|
9400
|
+
duplicateIndex = state2.duplicates.indexOf(object);
|
|
9391
9401
|
duplicate = duplicateIndex !== -1;
|
|
9392
9402
|
}
|
|
9393
|
-
if (
|
|
9403
|
+
if (state2.tag !== null && state2.tag !== "?" || duplicate || state2.indent !== 2 && level > 0) {
|
|
9394
9404
|
compact = false;
|
|
9395
9405
|
}
|
|
9396
|
-
if (duplicate &&
|
|
9397
|
-
|
|
9406
|
+
if (duplicate && state2.usedDuplicates[duplicateIndex]) {
|
|
9407
|
+
state2.dump = "*ref_" + duplicateIndex;
|
|
9398
9408
|
} else {
|
|
9399
|
-
if (objectOrArray && duplicate && !
|
|
9400
|
-
|
|
9409
|
+
if (objectOrArray && duplicate && !state2.usedDuplicates[duplicateIndex]) {
|
|
9410
|
+
state2.usedDuplicates[duplicateIndex] = true;
|
|
9401
9411
|
}
|
|
9402
9412
|
if (type2 === "[object Object]") {
|
|
9403
|
-
if (block && Object.keys(
|
|
9404
|
-
writeBlockMapping(
|
|
9413
|
+
if (block && Object.keys(state2.dump).length !== 0) {
|
|
9414
|
+
writeBlockMapping(state2, level, state2.dump, compact);
|
|
9405
9415
|
if (duplicate) {
|
|
9406
|
-
|
|
9416
|
+
state2.dump = "&ref_" + duplicateIndex + state2.dump;
|
|
9407
9417
|
}
|
|
9408
9418
|
} else {
|
|
9409
|
-
writeFlowMapping(
|
|
9419
|
+
writeFlowMapping(state2, level, state2.dump);
|
|
9410
9420
|
if (duplicate) {
|
|
9411
|
-
|
|
9421
|
+
state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
|
|
9412
9422
|
}
|
|
9413
9423
|
}
|
|
9414
9424
|
} else if (type2 === "[object Array]") {
|
|
9415
|
-
if (block &&
|
|
9416
|
-
if (
|
|
9417
|
-
writeBlockSequence(
|
|
9425
|
+
if (block && state2.dump.length !== 0) {
|
|
9426
|
+
if (state2.noArrayIndent && !isblockseq && level > 0) {
|
|
9427
|
+
writeBlockSequence(state2, level - 1, state2.dump, compact);
|
|
9418
9428
|
} else {
|
|
9419
|
-
writeBlockSequence(
|
|
9429
|
+
writeBlockSequence(state2, level, state2.dump, compact);
|
|
9420
9430
|
}
|
|
9421
9431
|
if (duplicate) {
|
|
9422
|
-
|
|
9432
|
+
state2.dump = "&ref_" + duplicateIndex + state2.dump;
|
|
9423
9433
|
}
|
|
9424
9434
|
} else {
|
|
9425
|
-
writeFlowSequence(
|
|
9435
|
+
writeFlowSequence(state2, level, state2.dump);
|
|
9426
9436
|
if (duplicate) {
|
|
9427
|
-
|
|
9437
|
+
state2.dump = "&ref_" + duplicateIndex + " " + state2.dump;
|
|
9428
9438
|
}
|
|
9429
9439
|
}
|
|
9430
9440
|
} else if (type2 === "[object String]") {
|
|
9431
|
-
if (
|
|
9432
|
-
writeScalar(
|
|
9441
|
+
if (state2.tag !== "?") {
|
|
9442
|
+
writeScalar(state2, state2.dump, level, iskey, inblock);
|
|
9433
9443
|
}
|
|
9434
9444
|
} else if (type2 === "[object Undefined]") {
|
|
9435
9445
|
return false;
|
|
9436
9446
|
} else {
|
|
9437
|
-
if (
|
|
9447
|
+
if (state2.skipInvalid) return false;
|
|
9438
9448
|
throw new exception("unacceptable kind of an object to dump " + type2);
|
|
9439
9449
|
}
|
|
9440
|
-
if (
|
|
9450
|
+
if (state2.tag !== null && state2.tag !== "?") {
|
|
9441
9451
|
tagStr = encodeURI(
|
|
9442
|
-
|
|
9452
|
+
state2.tag[0] === "!" ? state2.tag.slice(1) : state2.tag
|
|
9443
9453
|
).replace(/!/g, "%21");
|
|
9444
|
-
if (
|
|
9454
|
+
if (state2.tag[0] === "!") {
|
|
9445
9455
|
tagStr = "!" + tagStr;
|
|
9446
9456
|
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
9447
9457
|
tagStr = "!!" + tagStr.slice(18);
|
|
9448
9458
|
} else {
|
|
9449
9459
|
tagStr = "!<" + tagStr + ">";
|
|
9450
9460
|
}
|
|
9451
|
-
|
|
9461
|
+
state2.dump = tagStr + " " + state2.dump;
|
|
9452
9462
|
}
|
|
9453
9463
|
}
|
|
9454
9464
|
return true;
|
|
9455
9465
|
}
|
|
9456
|
-
function getDuplicateReferences(object,
|
|
9466
|
+
function getDuplicateReferences(object, state2) {
|
|
9457
9467
|
var objects = [], duplicatesIndexes = [], index, length;
|
|
9458
9468
|
inspectNode(object, objects, duplicatesIndexes);
|
|
9459
9469
|
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
9460
|
-
|
|
9470
|
+
state2.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
9461
9471
|
}
|
|
9462
|
-
|
|
9472
|
+
state2.usedDuplicates = new Array(length);
|
|
9463
9473
|
}
|
|
9464
9474
|
function inspectNode(object, objects, duplicatesIndexes) {
|
|
9465
9475
|
var objectKeyList, index, length;
|
|
@@ -9486,13 +9496,13 @@ function inspectNode(object, objects, duplicatesIndexes) {
|
|
|
9486
9496
|
}
|
|
9487
9497
|
function dump$1(input, options) {
|
|
9488
9498
|
options = options || {};
|
|
9489
|
-
var
|
|
9490
|
-
if (!
|
|
9499
|
+
var state2 = new State(options);
|
|
9500
|
+
if (!state2.noRefs) getDuplicateReferences(input, state2);
|
|
9491
9501
|
var value = input;
|
|
9492
|
-
if (
|
|
9493
|
-
value =
|
|
9502
|
+
if (state2.replacer) {
|
|
9503
|
+
value = state2.replacer.call({ "": value }, "", value);
|
|
9494
9504
|
}
|
|
9495
|
-
if (writeNode(
|
|
9505
|
+
if (writeNode(state2, 0, value, true, true)) return state2.dump + "\n";
|
|
9496
9506
|
return "";
|
|
9497
9507
|
}
|
|
9498
9508
|
var dump_1 = dump$1;
|
|
@@ -10671,6 +10681,104 @@ function TurnNavRail({
|
|
|
10671
10681
|
);
|
|
10672
10682
|
}
|
|
10673
10683
|
|
|
10684
|
+
// src/chat/turn-locate-channel.ts
|
|
10685
|
+
import { useEffect as useEffect23, useState as useState26 } from "react";
|
|
10686
|
+
var state = {};
|
|
10687
|
+
var statusState = {};
|
|
10688
|
+
var seqCounter = 0;
|
|
10689
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
10690
|
+
function setState(update) {
|
|
10691
|
+
const next = update(state);
|
|
10692
|
+
if (next === state) return;
|
|
10693
|
+
state = next;
|
|
10694
|
+
for (const listener of [...listeners]) listener();
|
|
10695
|
+
}
|
|
10696
|
+
function setStatus(update) {
|
|
10697
|
+
const next = update(statusState);
|
|
10698
|
+
if (next === statusState) return;
|
|
10699
|
+
statusState = next;
|
|
10700
|
+
for (const listener of [...listeners]) listener();
|
|
10701
|
+
}
|
|
10702
|
+
var turnLocateChannel = {
|
|
10703
|
+
getState: () => state,
|
|
10704
|
+
getStatus: () => statusState,
|
|
10705
|
+
request(sessionId, entryId) {
|
|
10706
|
+
seqCounter += 1;
|
|
10707
|
+
const seq2 = seqCounter;
|
|
10708
|
+
setState((current) => ({ ...current, [sessionId]: { entryId, seq: seq2 } }));
|
|
10709
|
+
setStatus((current) => ({ ...current, [sessionId]: { seq: seq2, entryId, state: "pending" } }));
|
|
10710
|
+
},
|
|
10711
|
+
/** 执行侧回传进度;只有最新一次请求的结果会被接受。 */
|
|
10712
|
+
report(sessionId, seq2, state2) {
|
|
10713
|
+
setStatus((current) => {
|
|
10714
|
+
const entry = current[sessionId];
|
|
10715
|
+
if (!entry || entry.seq !== seq2) return current;
|
|
10716
|
+
return { ...current, [sessionId]: { ...entry, state: state2 } };
|
|
10717
|
+
});
|
|
10718
|
+
},
|
|
10719
|
+
/** 定位完成(成功):清掉进度,面板不再显示「正在定位」。 */
|
|
10720
|
+
clearStatus(sessionId, seq2) {
|
|
10721
|
+
setStatus((current) => {
|
|
10722
|
+
const entry = current[sessionId];
|
|
10723
|
+
if (!entry || entry.seq !== seq2) return current;
|
|
10724
|
+
const next = { ...current };
|
|
10725
|
+
delete next[sessionId];
|
|
10726
|
+
return next;
|
|
10727
|
+
});
|
|
10728
|
+
},
|
|
10729
|
+
subscribe(listener) {
|
|
10730
|
+
listeners.add(listener);
|
|
10731
|
+
return () => {
|
|
10732
|
+
listeners.delete(listener);
|
|
10733
|
+
};
|
|
10734
|
+
},
|
|
10735
|
+
/** 某条信令已被消费:同 seq 不再重复定位(避免重新挂载时又跳一次)。 */
|
|
10736
|
+
consume(sessionId, seq2) {
|
|
10737
|
+
setState((current) => {
|
|
10738
|
+
const request = current[sessionId];
|
|
10739
|
+
if (!request || request.seq !== seq2) return current;
|
|
10740
|
+
const next = { ...current };
|
|
10741
|
+
delete next[sessionId];
|
|
10742
|
+
return next;
|
|
10743
|
+
});
|
|
10744
|
+
},
|
|
10745
|
+
/** 只清进度、不动未消费的请求(列表卸载时用)。 */
|
|
10746
|
+
clearStatusForSession(sessionId) {
|
|
10747
|
+
setStatus((current) => {
|
|
10748
|
+
if (!(sessionId in current)) return current;
|
|
10749
|
+
const next = { ...current };
|
|
10750
|
+
delete next[sessionId];
|
|
10751
|
+
return next;
|
|
10752
|
+
});
|
|
10753
|
+
},
|
|
10754
|
+
clearSession(sessionId) {
|
|
10755
|
+
setState((current) => {
|
|
10756
|
+
if (!(sessionId in current)) return current;
|
|
10757
|
+
const next = { ...current };
|
|
10758
|
+
delete next[sessionId];
|
|
10759
|
+
return next;
|
|
10760
|
+
});
|
|
10761
|
+
},
|
|
10762
|
+
reset() {
|
|
10763
|
+
setState(() => ({}));
|
|
10764
|
+
setStatus(() => ({}));
|
|
10765
|
+
}
|
|
10766
|
+
};
|
|
10767
|
+
function useTurnLocateRequest(sessionId) {
|
|
10768
|
+
const [request, setRequest] = useState26(null);
|
|
10769
|
+
useEffect23(() => {
|
|
10770
|
+
if (!sessionId) {
|
|
10771
|
+
setRequest(null);
|
|
10772
|
+
return;
|
|
10773
|
+
}
|
|
10774
|
+
setRequest(turnLocateChannel.getState()[sessionId] ?? null);
|
|
10775
|
+
return turnLocateChannel.subscribe(() => {
|
|
10776
|
+
setRequest(turnLocateChannel.getState()[sessionId] ?? null);
|
|
10777
|
+
});
|
|
10778
|
+
}, [sessionId]);
|
|
10779
|
+
return request;
|
|
10780
|
+
}
|
|
10781
|
+
|
|
10674
10782
|
// src/chat/scroll-anchor.ts
|
|
10675
10783
|
var ENTRY_SCROLL_MARGIN_PX = 24;
|
|
10676
10784
|
function calculateStickyAwareMargin(statusHeight = 0, statusBottomGap = 0) {
|
|
@@ -10815,9 +10923,9 @@ function MessageListBody({
|
|
|
10815
10923
|
}) {
|
|
10816
10924
|
const messages = Array.isArray(rawMessages) ? rawMessages : [];
|
|
10817
10925
|
const session = useSessionHandle(sessionId);
|
|
10818
|
-
const agentLoops = useSessionState(sessionId, (
|
|
10819
|
-
const askAnswers = useSessionState(sessionId, (
|
|
10820
|
-
const stateIsStreaming = useSessionState(sessionId, (
|
|
10926
|
+
const agentLoops = useSessionState(sessionId, (state2) => state2.agentLoops);
|
|
10927
|
+
const askAnswers = useSessionState(sessionId, (state2) => state2.askAnswers);
|
|
10928
|
+
const stateIsStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
|
|
10821
10929
|
const sessionIsStreaming = streamingOverride ?? stateIsStreaming;
|
|
10822
10930
|
const isPreparing = sessionIsStreaming && isPreparingReply(messages);
|
|
10823
10931
|
const agentLoopNameSet = useMemo15(() => new Set(Object.keys(agentLoops ?? {})), [agentLoops]);
|
|
@@ -10843,10 +10951,10 @@ function MessageListBody({
|
|
|
10843
10951
|
isStopping
|
|
10844
10952
|
);
|
|
10845
10953
|
const isRevealingAny = contentReveal.isRevealing || reasoningReveal.isRevealing;
|
|
10846
|
-
|
|
10954
|
+
useEffect24(() => {
|
|
10847
10955
|
onRevealingChange?.(isRevealingAny);
|
|
10848
10956
|
}, [isRevealingAny, onRevealingChange]);
|
|
10849
|
-
|
|
10957
|
+
useEffect24(() => {
|
|
10850
10958
|
if (isStopping) {
|
|
10851
10959
|
contentReveal.flushNow();
|
|
10852
10960
|
reasoningReveal.flushNow();
|
|
@@ -10962,9 +11070,9 @@ function MessageListBody({
|
|
|
10962
11070
|
const observedLatestUserStableIdRef = useRef21(
|
|
10963
11071
|
latestUserIsOptimistic ? null : latestUserStableId
|
|
10964
11072
|
);
|
|
10965
|
-
const [activeTurnId, setActiveTurnId] =
|
|
10966
|
-
const [virtualScrollMargin, setVirtualScrollMargin] =
|
|
10967
|
-
const [scrollContainerElement, setScrollContainerElement] =
|
|
11073
|
+
const [activeTurnId, setActiveTurnId] = useState27(lastTurnId);
|
|
11074
|
+
const [virtualScrollMargin, setVirtualScrollMargin] = useState27(0);
|
|
11075
|
+
const [scrollContainerElement, setScrollContainerElement] = useState27(null);
|
|
10968
11076
|
const loadingOlderRef = useRef21(false);
|
|
10969
11077
|
const virtualizationEnabled = Boolean(useChatEnvironment().useVirtualizer);
|
|
10970
11078
|
const stablePrefixEnd = useMemo15(
|
|
@@ -11026,6 +11134,51 @@ function MessageListBody({
|
|
|
11026
11134
|
stickContextRef.current?.stopScroll();
|
|
11027
11135
|
}
|
|
11028
11136
|
});
|
|
11137
|
+
const outlineLocateRequest = useTurnLocateRequest(isSharedSession ? null : sessionId);
|
|
11138
|
+
const consumedLocateSeq = useRef21(0);
|
|
11139
|
+
const outlineLocateRef = useRef21(null);
|
|
11140
|
+
const navLoadingEntryIdRef = useRef21(navLoadingEntryId);
|
|
11141
|
+
navLoadingEntryIdRef.current = navLoadingEntryId;
|
|
11142
|
+
useEffect24(() => {
|
|
11143
|
+
if (!outlineLocateRequest) return;
|
|
11144
|
+
if (outlineLocateRequest.seq <= consumedLocateSeq.current) return;
|
|
11145
|
+
consumedLocateSeq.current = outlineLocateRequest.seq;
|
|
11146
|
+
const { seq: seq2 } = outlineLocateRequest;
|
|
11147
|
+
outlineLocateRef.current = { seq: seq2, entryId: outlineLocateRequest.entryId };
|
|
11148
|
+
selectNavEntry(outlineLocateRequest.entryId);
|
|
11149
|
+
turnLocateChannel.consume(sessionId, seq2);
|
|
11150
|
+
const frame = window.requestAnimationFrame(() => {
|
|
11151
|
+
if (outlineLocateRef.current?.seq !== seq2) return;
|
|
11152
|
+
if (navLoadingEntryIdRef.current !== null) return;
|
|
11153
|
+
turnLocateChannel.clearStatus(sessionId, seq2);
|
|
11154
|
+
outlineLocateRef.current = null;
|
|
11155
|
+
});
|
|
11156
|
+
return () => window.cancelAnimationFrame(frame);
|
|
11157
|
+
}, [outlineLocateRequest, selectNavEntry, sessionId]);
|
|
11158
|
+
useEffect24(() => {
|
|
11159
|
+
const pending = outlineLocateRef.current;
|
|
11160
|
+
if (!pending) return;
|
|
11161
|
+
if (navError) {
|
|
11162
|
+
turnLocateChannel.report(sessionId, pending.seq, "failed");
|
|
11163
|
+
outlineLocateRef.current = null;
|
|
11164
|
+
return;
|
|
11165
|
+
}
|
|
11166
|
+
const frame = window.requestAnimationFrame(() => {
|
|
11167
|
+
if (outlineLocateRef.current?.seq !== pending.seq) return;
|
|
11168
|
+
if (navLoadingEntryId !== null) return;
|
|
11169
|
+
turnLocateChannel.clearStatus(sessionId, pending.seq);
|
|
11170
|
+
outlineLocateRef.current = null;
|
|
11171
|
+
});
|
|
11172
|
+
return () => window.cancelAnimationFrame(frame);
|
|
11173
|
+
}, [navError, navLoadingEntryId, sessionId]);
|
|
11174
|
+
useEffect24(() => {
|
|
11175
|
+
return () => {
|
|
11176
|
+
const pending = outlineLocateRef.current;
|
|
11177
|
+
if (!pending) return;
|
|
11178
|
+
turnLocateChannel.clearStatus(sessionId, pending.seq);
|
|
11179
|
+
outlineLocateRef.current = null;
|
|
11180
|
+
};
|
|
11181
|
+
}, [sessionId]);
|
|
11029
11182
|
const activeViewportEntryId = useMemo15(() => {
|
|
11030
11183
|
if (!activeTurnId) return null;
|
|
11031
11184
|
const blockIndex = turnIdToBlockIndex.get(activeTurnId);
|
|
@@ -11105,7 +11258,7 @@ function MessageListBody({
|
|
|
11105
11258
|
measureActiveTurn();
|
|
11106
11259
|
});
|
|
11107
11260
|
});
|
|
11108
|
-
|
|
11261
|
+
useEffect24(() => {
|
|
11109
11262
|
void historyLoadRevision;
|
|
11110
11263
|
scrollContainerRef.current = stickContextRef.current?.scrollRef.current ?? findScrollContainer(containerRef.current);
|
|
11111
11264
|
const sc = scrollContainerRef.current;
|
|
@@ -11297,7 +11450,7 @@ function MessageListBody({
|
|
|
11297
11450
|
previousStablePrefixEndRef.current = stablePrefixEnd;
|
|
11298
11451
|
boundaryAnchorRef.current = captureBoundaryAnchor();
|
|
11299
11452
|
}, [captureBoundaryAnchor, stablePrefixEnd]);
|
|
11300
|
-
|
|
11453
|
+
useEffect24(() => {
|
|
11301
11454
|
scheduleMeasure();
|
|
11302
11455
|
}, [lastTurnId, layoutSignature]);
|
|
11303
11456
|
const stopNewTurnScrollAnimation = useCallback13(() => {
|
|
@@ -11368,7 +11521,7 @@ function MessageListBody({
|
|
|
11368
11521
|
placeLatestUserAtTop(anchorId);
|
|
11369
11522
|
});
|
|
11370
11523
|
});
|
|
11371
|
-
|
|
11524
|
+
useEffect24(() => {
|
|
11372
11525
|
const observer = new ResizeObserver((entries) => {
|
|
11373
11526
|
for (const entry of entries) {
|
|
11374
11527
|
const element = entry.target;
|
|
@@ -11504,14 +11657,14 @@ function MessageListBody({
|
|
|
11504
11657
|
}
|
|
11505
11658
|
}
|
|
11506
11659
|
}, [stopNewTurnScrollAnimation]);
|
|
11507
|
-
|
|
11660
|
+
useEffect24(
|
|
11508
11661
|
() => () => {
|
|
11509
11662
|
cancelPendingNewTurnScroll();
|
|
11510
11663
|
stopNewTurnScrollAnimation();
|
|
11511
11664
|
},
|
|
11512
11665
|
[cancelPendingNewTurnScroll, stopNewTurnScrollAnimation]
|
|
11513
11666
|
);
|
|
11514
|
-
|
|
11667
|
+
useEffect24(() => {
|
|
11515
11668
|
const container = scrollContainerElement;
|
|
11516
11669
|
if (!container) return;
|
|
11517
11670
|
const handleScroll = () => {
|
|
@@ -11526,7 +11679,7 @@ function MessageListBody({
|
|
|
11526
11679
|
container.addEventListener("scroll", handleScroll, { passive: true });
|
|
11527
11680
|
return () => container.removeEventListener("scroll", handleScroll);
|
|
11528
11681
|
}, [scrollContainerElement, releaseNewTurnPin]);
|
|
11529
|
-
|
|
11682
|
+
useEffect24(() => {
|
|
11530
11683
|
if (!effectiveNewUserMessageKey) {
|
|
11531
11684
|
const acknowledgedSameTarget = newTurnPinActiveRef.current && latestUserStableId != null && observedLatestUserStableIdRef.current === latestUserStableId;
|
|
11532
11685
|
observedLatestUserStableIdRef.current = latestUserStableId;
|
|
@@ -11562,7 +11715,7 @@ function MessageListBody({
|
|
|
11562
11715
|
releaseNewTurnPin,
|
|
11563
11716
|
sessionIsStreaming
|
|
11564
11717
|
]);
|
|
11565
|
-
|
|
11718
|
+
useEffect24(() => {
|
|
11566
11719
|
scheduleNewTurnSpacerUpdate();
|
|
11567
11720
|
return () => {
|
|
11568
11721
|
if (newTurnSpacerFrameRef.current != null) {
|
|
@@ -11571,11 +11724,11 @@ function MessageListBody({
|
|
|
11571
11724
|
}
|
|
11572
11725
|
};
|
|
11573
11726
|
}, [layoutSignature]);
|
|
11574
|
-
|
|
11727
|
+
useEffect24(() => {
|
|
11575
11728
|
if (!newTurnPinActiveRef.current) return;
|
|
11576
11729
|
scheduleNewTurnSpacerUpdate();
|
|
11577
11730
|
}, [contentReveal.displayedText, reasoningReveal.displayedText]);
|
|
11578
|
-
|
|
11731
|
+
useEffect24(() => () => {
|
|
11579
11732
|
if (startScrollFrameRef.current != null) {
|
|
11580
11733
|
window.cancelAnimationFrame(startScrollFrameRef.current);
|
|
11581
11734
|
startScrollFrameRef.current = null;
|
|
@@ -11595,7 +11748,7 @@ function MessageListBody({
|
|
|
11595
11748
|
appliedStartScrollKeyRef.current = null;
|
|
11596
11749
|
appliedEntryScrollKeyRef.current = null;
|
|
11597
11750
|
}, []);
|
|
11598
|
-
|
|
11751
|
+
useEffect24(() => {
|
|
11599
11752
|
if (!scrollToStartKey || !hasMessages) {
|
|
11600
11753
|
if (startScrollFrameRef.current != null) window.cancelAnimationFrame(startScrollFrameRef.current);
|
|
11601
11754
|
if (startScrollTimeoutRef.current != null) window.clearTimeout(startScrollTimeoutRef.current);
|
|
@@ -11667,7 +11820,7 @@ function MessageListBody({
|
|
|
11667
11820
|
},
|
|
11668
11821
|
[scrollEntryId]
|
|
11669
11822
|
);
|
|
11670
|
-
|
|
11823
|
+
useEffect24(() => {
|
|
11671
11824
|
if (appliedEntryScrollKeyRef.current !== scrollEntryId) {
|
|
11672
11825
|
if (entryScrollFrameRef.current != null) window.cancelAnimationFrame(entryScrollFrameRef.current);
|
|
11673
11826
|
for (const timeoutId of entryScrollTimeoutRefs.current) window.clearTimeout(timeoutId);
|
|
@@ -12121,14 +12274,14 @@ function MessageList(props) {
|
|
|
12121
12274
|
}
|
|
12122
12275
|
|
|
12123
12276
|
// src/chat/runtime/use-chat-actions.ts
|
|
12124
|
-
import { useCallback as useCallback14, useEffect as
|
|
12277
|
+
import { useCallback as useCallback14, useEffect as useEffect25, useRef as useRef22, useState as useState28 } from "react";
|
|
12125
12278
|
function useChatActions(sessionId) {
|
|
12126
12279
|
const source = useSessionSource();
|
|
12127
12280
|
const session = useSessionHandle(sessionId);
|
|
12128
|
-
const isStreaming = useSessionState(sessionId, (
|
|
12129
|
-
const [isStopping, setIsStopping] =
|
|
12130
|
-
const [queueNotice, setQueueNotice] =
|
|
12131
|
-
const [pendingQueueItemId, setPendingQueueItemId] =
|
|
12281
|
+
const isStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
|
|
12282
|
+
const [isStopping, setIsStopping] = useState28(false);
|
|
12283
|
+
const [queueNotice, setQueueNotice] = useState28(null);
|
|
12284
|
+
const [pendingQueueItemId, setPendingQueueItemId] = useState28(null);
|
|
12132
12285
|
const previousSessionIdRef = useRef22(sessionId);
|
|
12133
12286
|
const send = useCallback14(
|
|
12134
12287
|
(msg, targetMode, askuserAnswer, options) => source.whenReady ? source.whenReady(sessionId, (ready) => sendToSession(ready, msg, targetMode, askuserAnswer, options)) : session ? sendToSession(session, msg, targetMode, askuserAnswer, options) : Promise.resolve(false),
|
|
@@ -12193,7 +12346,7 @@ function useChatActions(sessionId) {
|
|
|
12193
12346
|
setIsStopping(false);
|
|
12194
12347
|
}
|
|
12195
12348
|
}, [isStopping, session, sessionId, source]);
|
|
12196
|
-
|
|
12349
|
+
useEffect25(() => {
|
|
12197
12350
|
if (previousSessionIdRef.current !== sessionId) {
|
|
12198
12351
|
previousSessionIdRef.current = sessionId;
|
|
12199
12352
|
setIsStopping(false);
|
|
@@ -12224,8 +12377,8 @@ import { useCallback as useCallback15 } from "react";
|
|
|
12224
12377
|
function useSessionReplay(sessionId) {
|
|
12225
12378
|
const environment = useChatEnvironment();
|
|
12226
12379
|
const session = useSessionHandle(sessionId);
|
|
12227
|
-
const replay = useSessionState(sessionId, (
|
|
12228
|
-
const viewerRole = useSessionState(sessionId, (
|
|
12380
|
+
const replay = useSessionState(sessionId, (state2) => state2.replay);
|
|
12381
|
+
const viewerRole = useSessionState(sessionId, (state2) => state2.viewerRole);
|
|
12229
12382
|
const isReplay = replay?.isReplay ?? false;
|
|
12230
12383
|
const canControl = viewerRole !== "viewer";
|
|
12231
12384
|
const setSpeed = useCallback15(
|
|
@@ -12333,21 +12486,21 @@ function ChatPanel({
|
|
|
12333
12486
|
const scopedEnvironment = useMemo16(() => ({ ...environment, renderMode }), [environment, renderMode]);
|
|
12334
12487
|
const DeveloperMessageList = environment.DeveloperMessageList;
|
|
12335
12488
|
const agentSession = useSessionHandle(sessionId);
|
|
12336
|
-
const messages = useSessionState(sessionId, (
|
|
12337
|
-
const isStreaming = useSessionState(sessionId, (
|
|
12338
|
-
const queue = useSessionState(sessionId, (
|
|
12339
|
-
const turns = useSessionState(sessionId, (
|
|
12340
|
-
const stateMode = useSessionState(sessionId, (
|
|
12341
|
-
const connection = useSessionState(sessionId, (
|
|
12342
|
-
const stateStatus = useSessionState(sessionId, (
|
|
12343
|
-
const viewerRole = useSessionState(sessionId, (
|
|
12344
|
-
const stateError = useSessionState(sessionId, (
|
|
12345
|
-
const nextBefore = useSessionState(sessionId, (
|
|
12346
|
-
const historyLoadingOlder = useSessionState(sessionId, (
|
|
12347
|
-
const historyLoadRevision = useSessionState(sessionId, (
|
|
12348
|
-
const historyRewriteRevision = useSessionState(sessionId, (
|
|
12349
|
-
const activeCompaction = useSessionState(sessionId, (
|
|
12350
|
-
const compactionPending = useSessionState(sessionId, (
|
|
12489
|
+
const messages = useSessionState(sessionId, (state2) => state2.messages);
|
|
12490
|
+
const isStreaming = useSessionState(sessionId, (state2) => state2.isStreaming);
|
|
12491
|
+
const queue = useSessionState(sessionId, (state2) => state2.queue);
|
|
12492
|
+
const turns = useSessionState(sessionId, (state2) => state2.turns);
|
|
12493
|
+
const stateMode = useSessionState(sessionId, (state2) => state2.mode);
|
|
12494
|
+
const connection = useSessionState(sessionId, (state2) => state2.connection);
|
|
12495
|
+
const stateStatus = useSessionState(sessionId, (state2) => state2.status);
|
|
12496
|
+
const viewerRole = useSessionState(sessionId, (state2) => state2.viewerRole);
|
|
12497
|
+
const stateError = useSessionState(sessionId, (state2) => state2.errorMessage);
|
|
12498
|
+
const nextBefore = useSessionState(sessionId, (state2) => state2.nextBefore);
|
|
12499
|
+
const historyLoadingOlder = useSessionState(sessionId, (state2) => state2.loadingOlder);
|
|
12500
|
+
const historyLoadRevision = useSessionState(sessionId, (state2) => state2.historyRevision);
|
|
12501
|
+
const historyRewriteRevision = useSessionState(sessionId, (state2) => state2.timelineRevision);
|
|
12502
|
+
const activeCompaction = useSessionState(sessionId, (state2) => state2.activeCompaction);
|
|
12503
|
+
const compactionPending = useSessionState(sessionId, (state2) => state2.compactionPending);
|
|
12351
12504
|
const {
|
|
12352
12505
|
isStopping,
|
|
12353
12506
|
send,
|
|
@@ -12361,12 +12514,12 @@ function ChatPanel({
|
|
|
12361
12514
|
deliverQueuedMessage,
|
|
12362
12515
|
resumeQueue
|
|
12363
12516
|
} = useChatActions(sessionId);
|
|
12364
|
-
const [isRevealing, setIsRevealing] =
|
|
12517
|
+
const [isRevealing, setIsRevealing] = useState29(false);
|
|
12365
12518
|
const isStreamingDisplay = isStreaming || isRevealing;
|
|
12366
12519
|
const detail = useChatSessionDetail(sessionId);
|
|
12367
12520
|
const { isReplay } = useSessionReplay(sessionId);
|
|
12368
12521
|
const isLoadingHistory = useIsSessionHistoryLoading(sessionId);
|
|
12369
|
-
const [queuePanelVisible, setQueuePanelVisible] =
|
|
12522
|
+
const [queuePanelVisible, setQueuePanelVisible] = useState29(false);
|
|
12370
12523
|
const loadOlder = useCallback16(
|
|
12371
12524
|
async (beforeCommit) => {
|
|
12372
12525
|
if (!agentSession) return false;
|
|
@@ -12376,11 +12529,11 @@ function ChatPanel({
|
|
|
12376
12529
|
},
|
|
12377
12530
|
[agentSession]
|
|
12378
12531
|
);
|
|
12379
|
-
const [paginationActivation, setPaginationActivation] =
|
|
12532
|
+
const [paginationActivation, setPaginationActivation] = useState29(() => ({
|
|
12380
12533
|
sessionId,
|
|
12381
12534
|
activated: Boolean(nextBefore)
|
|
12382
12535
|
}));
|
|
12383
|
-
|
|
12536
|
+
useEffect26(() => {
|
|
12384
12537
|
setPaginationActivation((current) => {
|
|
12385
12538
|
if (current.sessionId !== sessionId) {
|
|
12386
12539
|
return { sessionId, activated: Boolean(nextBefore) };
|
|
@@ -12397,8 +12550,8 @@ function ChatPanel({
|
|
|
12397
12550
|
const isViewer = (viewerRole ?? detail?.viewer_role) === "viewer";
|
|
12398
12551
|
const isCompacting = activeCompaction != null || compactionPending;
|
|
12399
12552
|
const postChatFollowup = useMemo16(() => latestPostChatFollowup(turns), [turns]);
|
|
12400
|
-
const [resultFeedback, setResultFeedback] =
|
|
12401
|
-
|
|
12553
|
+
const [resultFeedback, setResultFeedback] = useState29([]);
|
|
12554
|
+
useEffect26(() => {
|
|
12402
12555
|
setResultFeedback([]);
|
|
12403
12556
|
if (isViewer || !sessionId) return;
|
|
12404
12557
|
let cancelled = false;
|
|
@@ -12664,13 +12817,13 @@ function ChatPanel({
|
|
|
12664
12817
|
}
|
|
12665
12818
|
|
|
12666
12819
|
// src/components/SessionPluginSelector.tsx
|
|
12667
|
-
import { useEffect as
|
|
12820
|
+
import { useEffect as useEffect27, useState as useState30 } from "react";
|
|
12668
12821
|
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
12669
12822
|
function SessionPluginSelector(props) {
|
|
12670
12823
|
return /* @__PURE__ */ jsx39(PluginSelectorState, { ...props }, props.sessionId);
|
|
12671
12824
|
}
|
|
12672
12825
|
function PluginSelectorState({ client, sessionId, className, side = "bottom", onChange }) {
|
|
12673
|
-
const [open, setOpen] =
|
|
12826
|
+
const [open, setOpen] = useState30(false);
|
|
12674
12827
|
return /* @__PURE__ */ jsxs35("div", { className: `relative text-xs ${className ?? ""}`, children: [
|
|
12675
12828
|
/* @__PURE__ */ jsx39(
|
|
12676
12829
|
"button",
|
|
@@ -12694,7 +12847,7 @@ function PluginSelectorList({
|
|
|
12694
12847
|
}) {
|
|
12695
12848
|
const controller = useSessionPluginActivation({ client, sessionId, onChange });
|
|
12696
12849
|
const { reload } = controller;
|
|
12697
|
-
|
|
12850
|
+
useEffect27(() => {
|
|
12698
12851
|
reload();
|
|
12699
12852
|
}, [reload]);
|
|
12700
12853
|
return /* @__PURE__ */ jsxs35(
|
|
@@ -12732,8 +12885,8 @@ function isUnauthorizedError(error) {
|
|
|
12732
12885
|
return error instanceof BladeApiError && error.status === 401;
|
|
12733
12886
|
}
|
|
12734
12887
|
function LoginCard({ client, onLoggedIn }) {
|
|
12735
|
-
const [loggingIn, setLoggingIn] =
|
|
12736
|
-
const [loginError, setLoginError] =
|
|
12888
|
+
const [loggingIn, setLoggingIn] = useState31(false);
|
|
12889
|
+
const [loginError, setLoginError] = useState31(null);
|
|
12737
12890
|
const handleLogin = async () => {
|
|
12738
12891
|
setLoggingIn(true);
|
|
12739
12892
|
setLoginError(null);
|
|
@@ -12765,8 +12918,8 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
12765
12918
|
}
|
|
12766
12919
|
function AgentChat(props) {
|
|
12767
12920
|
const client = useBladeClient();
|
|
12768
|
-
const [attempt, setAttempt] =
|
|
12769
|
-
const [needLogin, setNeedLogin] =
|
|
12921
|
+
const [attempt, setAttempt] = useState31(0);
|
|
12922
|
+
const [needLogin, setNeedLogin] = useState31(() => !client.hasToken());
|
|
12770
12923
|
if (needLogin) {
|
|
12771
12924
|
return /* @__PURE__ */ jsx40(
|
|
12772
12925
|
"div",
|
|
@@ -12806,38 +12959,38 @@ function ChatSessionView({
|
|
|
12806
12959
|
}) {
|
|
12807
12960
|
const client = useBladeClient();
|
|
12808
12961
|
const host = useBladeHost();
|
|
12809
|
-
const { session, state, error } = useAgentSession(sessionId, {
|
|
12962
|
+
const { session, state: state2, error } = useAgentSession(sessionId, {
|
|
12810
12963
|
createOptions,
|
|
12811
12964
|
onSessionCreated
|
|
12812
12965
|
});
|
|
12813
12966
|
const replay = useReplay(session);
|
|
12814
|
-
const [notice, setNotice] =
|
|
12815
|
-
const source = useSingleSessionSource(session, !session ||
|
|
12967
|
+
const [notice, setNotice] = useState31(null);
|
|
12968
|
+
const source = useSingleSessionSource(session, !session || state2 === null);
|
|
12816
12969
|
const resolvedSessionId = session?.sessionId;
|
|
12817
|
-
const isViewer =
|
|
12818
|
-
const replaySpeed =
|
|
12819
|
-
const replaying =
|
|
12820
|
-
|
|
12970
|
+
const isViewer = state2?.viewerRole === "viewer";
|
|
12971
|
+
const replaySpeed = state2?.replay?.speed;
|
|
12972
|
+
const replaying = state2?.replay?.isReplay;
|
|
12973
|
+
useEffect28(() => {
|
|
12821
12974
|
setNotice(null);
|
|
12822
12975
|
}, [resolvedSessionId, replaySpeed, replaying]);
|
|
12823
12976
|
const onSessionReadyRef = useRef23(onSessionReady);
|
|
12824
12977
|
const readySessionRef = useRef23(null);
|
|
12825
12978
|
const hasOnSessionReady = onSessionReady !== void 0;
|
|
12826
|
-
|
|
12979
|
+
useEffect28(() => {
|
|
12827
12980
|
onSessionReadyRef.current = onSessionReady;
|
|
12828
12981
|
}, [onSessionReady]);
|
|
12829
|
-
|
|
12982
|
+
useEffect28(() => {
|
|
12830
12983
|
const handler = onSessionReadyRef.current;
|
|
12831
12984
|
if (!session || !hasOnSessionReady || !handler || readySessionRef.current === session) return;
|
|
12832
12985
|
readySessionRef.current = session;
|
|
12833
12986
|
handler(session);
|
|
12834
12987
|
}, [session, hasOnSessionReady]);
|
|
12835
|
-
|
|
12988
|
+
useEffect28(() => {
|
|
12836
12989
|
if (isUnauthorizedError(error)) {
|
|
12837
12990
|
onUnauthorized();
|
|
12838
12991
|
}
|
|
12839
12992
|
}, [error, onUnauthorized]);
|
|
12840
|
-
|
|
12993
|
+
useEffect28(() => {
|
|
12841
12994
|
if (!session || !commands) return;
|
|
12842
12995
|
const unsubscribes = Object.entries(commands).map(
|
|
12843
12996
|
([action, handler]) => session.onCommand(action, (payload) => handler(payload))
|
|
@@ -12880,20 +13033,20 @@ function ChatSessionView({
|
|
|
12880
13033
|
|
|
12881
13034
|
// src/components/LlmChat.tsx
|
|
12882
13035
|
import { chatErrorForDisplay as chatErrorForDisplay4 } from "@blade-hq/agent-client/internal";
|
|
12883
|
-
import { useEffect as
|
|
13036
|
+
import { useEffect as useEffect29, useMemo as useMemo19, useState as useState34 } from "react";
|
|
12884
13037
|
|
|
12885
13038
|
// src/hooks/use-llm-chat.ts
|
|
12886
|
-
import { useCallback as useCallback17, useMemo as useMemo18, useRef as useRef24, useState as
|
|
13039
|
+
import { useCallback as useCallback17, useMemo as useMemo18, useRef as useRef24, useState as useState32 } from "react";
|
|
12887
13040
|
var DEFAULT_HISTORY_TURNS = 12;
|
|
12888
13041
|
var DEFAULT_MAX_TOOL_ROUNDS = 4;
|
|
12889
13042
|
var syntheticIdSeq = 0;
|
|
12890
13043
|
function useLlmChat(options) {
|
|
12891
|
-
const [history, setHistory] =
|
|
12892
|
-
const [streamingText, setStreamingText] =
|
|
12893
|
-
const [streamingCalls, setStreamingCalls] =
|
|
12894
|
-
const [failedToolIds, setFailedToolIds] =
|
|
12895
|
-
const [error, setError] =
|
|
12896
|
-
const [isStreaming, setIsStreaming] =
|
|
13044
|
+
const [history, setHistory] = useState32([]);
|
|
13045
|
+
const [streamingText, setStreamingText] = useState32(null);
|
|
13046
|
+
const [streamingCalls, setStreamingCalls] = useState32([]);
|
|
13047
|
+
const [failedToolIds, setFailedToolIds] = useState32([]);
|
|
13048
|
+
const [error, setError] = useState32(null);
|
|
13049
|
+
const [isStreaming, setIsStreaming] = useState32(false);
|
|
12897
13050
|
const abortRef = useRef24(null);
|
|
12898
13051
|
const activeStartedAtRef = useRef24(null);
|
|
12899
13052
|
const assistantTimingsRef = useRef24(/* @__PURE__ */ new WeakMap());
|
|
@@ -13239,7 +13392,7 @@ function toToolCallInfo(call, results, failedToolIds) {
|
|
|
13239
13392
|
}
|
|
13240
13393
|
|
|
13241
13394
|
// src/components/LlmAdvancedSettings.tsx
|
|
13242
|
-
import { useState as
|
|
13395
|
+
import { useState as useState33 } from "react";
|
|
13243
13396
|
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
13244
13397
|
var FIELDS = [
|
|
13245
13398
|
{ id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
|
|
@@ -13286,8 +13439,8 @@ function writeOverride(settings, baseURL, override) {
|
|
|
13286
13439
|
}
|
|
13287
13440
|
function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
13288
13441
|
const normalized = normalizeAdvanced(settings);
|
|
13289
|
-
const [open, setOpen] =
|
|
13290
|
-
const [draft, setDraft] =
|
|
13442
|
+
const [open, setOpen] = useState33(false);
|
|
13443
|
+
const [draft, setDraft] = useState33(override);
|
|
13291
13444
|
if (!normalized) return null;
|
|
13292
13445
|
const fields = FIELDS.filter((field) => normalized[field.id]);
|
|
13293
13446
|
const dirty = Object.keys(override).length > 0;
|
|
@@ -13370,12 +13523,12 @@ function LlmChat({
|
|
|
13370
13523
|
onOverrideChange,
|
|
13371
13524
|
...options
|
|
13372
13525
|
}) {
|
|
13373
|
-
const [override, setOverride] =
|
|
13526
|
+
const [override, setOverride] = useState34(() => readOverride(advanced, options.baseURL));
|
|
13374
13527
|
const effective = { ...options, ...override };
|
|
13375
13528
|
const { messages, isStreaming, error, send, stop, reset } = useLlmChat(effective);
|
|
13376
|
-
const [inputText, setInputText] =
|
|
13377
|
-
const [stopRequested, setStopRequested] =
|
|
13378
|
-
const [isRevealing, setIsRevealing] =
|
|
13529
|
+
const [inputText, setInputText] = useState34("");
|
|
13530
|
+
const [stopRequested, setStopRequested] = useState34(false);
|
|
13531
|
+
const [isRevealing, setIsRevealing] = useState34(false);
|
|
13379
13532
|
const isStreamingDisplay = isStreaming || isRevealing;
|
|
13380
13533
|
const handle = useMemo19(
|
|
13381
13534
|
() => ({
|
|
@@ -13386,7 +13539,7 @@ ${text}` : text),
|
|
|
13386
13539
|
}),
|
|
13387
13540
|
[send, reset]
|
|
13388
13541
|
);
|
|
13389
|
-
|
|
13542
|
+
useEffect29(() => {
|
|
13390
13543
|
onReady?.(handle);
|
|
13391
13544
|
}, [handle, onReady]);
|
|
13392
13545
|
const customization = useMemo19(() => ({ classNames, renderers }), [classNames, renderers]);
|
|
@@ -13487,7 +13640,7 @@ function ChatView(props) {
|
|
|
13487
13640
|
}
|
|
13488
13641
|
|
|
13489
13642
|
// src/components/TopicAssetSubmitDialog.tsx
|
|
13490
|
-
import { useRef as useRef25, useState as
|
|
13643
|
+
import { useRef as useRef25, useState as useState35 } from "react";
|
|
13491
13644
|
import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
13492
13645
|
function useTopicAssetSubmissionAccess(sessionId) {
|
|
13493
13646
|
const client = useBladeClient();
|
|
@@ -13504,12 +13657,12 @@ function useTopicAssetSubmissionAccess(sessionId) {
|
|
|
13504
13657
|
}
|
|
13505
13658
|
function TopicAssetSubmitDialog({ sessionId, topicId, path, onClose, onSubmitted }) {
|
|
13506
13659
|
const client = useBladeClient();
|
|
13507
|
-
const [folder, setFolder] =
|
|
13508
|
-
const [message, setMessage] =
|
|
13509
|
-
const [error, setError] =
|
|
13510
|
-
const [busy, setBusy] =
|
|
13660
|
+
const [folder, setFolder] = useState35("");
|
|
13661
|
+
const [message, setMessage] = useState35("");
|
|
13662
|
+
const [error, setError] = useState35(null);
|
|
13663
|
+
const [busy, setBusy] = useState35(false);
|
|
13511
13664
|
const submitting = useRef25(false);
|
|
13512
|
-
const [revision, setRevision] =
|
|
13665
|
+
const [revision, setRevision] = useState35(0);
|
|
13513
13666
|
const assets = useAsyncValue(`${sessionId}:${topicId}:${revision}`, async () => {
|
|
13514
13667
|
const [session, groups, result] = await Promise.all([
|
|
13515
13668
|
client.sessions.getSession(sessionId),
|
|
@@ -13619,4 +13772,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
13619
13772
|
js-yaml/dist/js-yaml.mjs:
|
|
13620
13773
|
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
13621
13774
|
*/
|
|
13622
|
-
//# sourceMappingURL=chunk-
|
|
13775
|
+
//# sourceMappingURL=chunk-IVGTMWRV.js.map
|