wherever-dev 0.10.11 → 0.10.12
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/dist/conversation-mode-hint.d.ts +89 -8
- package/dist/conversation-mode-hint.d.ts.map +1 -1
- package/dist/conversation-mode-hint.js +164 -12
- package/dist/conversation-mode-hint.js.map +1 -1
- package/package.json +1 -1
- package/public/_app/immutable/chunks/{CIOfJygp.js → C802ERXP.js} +2 -2
- package/public/_app/immutable/chunks/{CIOfJygp.js.map → C802ERXP.js.map} +1 -1
- package/public/_app/immutable/chunks/{CP7HQriI.js → DHIEbea_.js} +2 -2
- package/public/_app/immutable/chunks/{CP7HQriI.js.map → DHIEbea_.js.map} +1 -1
- package/public/_app/immutable/chunks/{CgprCr9Q.js → wvFikTuW.js} +2 -2
- package/public/_app/immutable/chunks/{CgprCr9Q.js.map → wvFikTuW.js.map} +1 -1
- package/public/_app/immutable/entry/{app.CSBRfvfP.js → app.CDq0HLUN.js} +3 -3
- package/public/_app/immutable/entry/{app.CSBRfvfP.js.map → app.CDq0HLUN.js.map} +1 -1
- package/public/_app/immutable/entry/start.DVPKM4ve.js +2 -0
- package/public/_app/immutable/entry/start.DVPKM4ve.js.map +1 -0
- package/public/_app/immutable/nodes/{0.BvcOYIBI.js → 0.BX0-WNRM.js} +2 -2
- package/public/_app/immutable/nodes/{0.BvcOYIBI.js.map → 0.BX0-WNRM.js.map} +1 -1
- package/public/_app/immutable/nodes/{1.DT9u4xbp.js → 1.WAaKe5sz.js} +2 -2
- package/public/_app/immutable/nodes/{1.DT9u4xbp.js.map → 1.WAaKe5sz.js.map} +1 -1
- package/public/_app/immutable/nodes/2.q5b1Ictx.js +95 -0
- package/public/_app/immutable/nodes/2.q5b1Ictx.js.map +1 -0
- package/public/_app/version.json +1 -1
- package/public/index.html +10 -10
- package/public/service-worker.js +1 -1
- package/public/_app/immutable/entry/start.Drl3QzB0.js +0 -2
- package/public/_app/immutable/entry/start.Drl3QzB0.js.map +0 -1
- package/public/_app/immutable/nodes/2.CpZdrUY8.js +0 -89
- package/public/_app/immutable/nodes/2.CpZdrUY8.js.map +0 -1
|
@@ -11,11 +11,15 @@ import type { InlineExtension } from '@earendil-works/pi-coding-agent';
|
|
|
11
11
|
*
|
|
12
12
|
* The signal rides the EXISTING `message` WS payload as an optional
|
|
13
13
|
* `conversationMode` boolean (no new WS message type, no new chat role), and is
|
|
14
|
-
* turned into agent-visible context here
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* turned into agent-visible context here, for that turn only, in TWO places:
|
|
15
|
+
* - `before_agent_start` APPENDS one line (CONVERSATION_MODE_HINT) to the
|
|
16
|
+
* assembled system prompt, and
|
|
17
|
+
* - `context` adds a TAIL reminder (CONVERSATION_MODE_REMINDER) before EVERY LLM
|
|
18
|
+
* call of the turn, because the system-prompt line alone is too far from the
|
|
19
|
+
* tail for smaller models to act on (measurements in the reminder's doc).
|
|
20
|
+
*
|
|
21
|
+
* Both are EPHEMERAL: neither is stored in the user message and neither renders
|
|
22
|
+
* as a chat line (only their effect, the resulting `say` tool call, is visible).
|
|
19
23
|
*
|
|
20
24
|
* KEEP IN LOCKSTEP with the CLI-bridge twin,
|
|
21
25
|
* `extension/src/conversation-mode-hint.ts`. The extension is a separate published
|
|
@@ -24,6 +28,28 @@ import type { InlineExtension } from '@earendil-works/pi-coding-agent';
|
|
|
24
28
|
* BOTH modules and fails if the hint text or the latch behaviour drifts.
|
|
25
29
|
*/
|
|
26
30
|
export declare const CONVERSATION_MODE_HINT: string;
|
|
31
|
+
/**
|
|
32
|
+
* The marker that opens the TAIL REMINDER, and the reminder itself.
|
|
33
|
+
*
|
|
34
|
+
* WHY A SECOND, TAIL-PLACED COPY OF THE SAME INSTRUCTION: the system-prompt hint
|
|
35
|
+
* alone measured as a coin flip on smaller local models. Probing a real local
|
|
36
|
+
* 35B (the model the reported session ran on) with a realistic wherever-shaped
|
|
37
|
+
* system prompt: with the hint 3/6 turns called `say`, without it 1/6 - and at
|
|
38
|
+
* the moment that matters most, the post-tool-result synthesis call (the answer
|
|
39
|
+
* after a `web_search`), the hint was ignored almost every time. Two things
|
|
40
|
+
* defeat it: the hint sits far from the tail of a long prompt, and once the
|
|
41
|
+
* transcript contains earlier assistant turns that did NOT speak, the model
|
|
42
|
+
* imitates its own history. A reminder placed at the very TAIL of the message
|
|
43
|
+
* list, re-applied before EVERY LLM call of the turn, is what actually lands.
|
|
44
|
+
*
|
|
45
|
+
* The reminder is EPHEMERAL in the strongest sense: it is added by the `context`
|
|
46
|
+
* event, which the SDK applies to a structuredClone of the messages on the way to
|
|
47
|
+
* the provider (see `transformContext`), so it is never stored in the session
|
|
48
|
+
* file, never rendered in the web transcript or the CLI TUI, and never survives
|
|
49
|
+
* the call it was built for.
|
|
50
|
+
*/
|
|
51
|
+
export declare const CONVERSATION_MODE_REMINDER_MARKER = "[spoken conversation active]";
|
|
52
|
+
export declare const CONVERSATION_MODE_REMINDER: string;
|
|
27
53
|
/**
|
|
28
54
|
* Append the conversation-mode hint to an assembled system prompt.
|
|
29
55
|
*
|
|
@@ -32,6 +58,45 @@ export declare const CONVERSATION_MODE_HINT: string;
|
|
|
32
58
|
* handlers' results) and returns base + hint. Never replaces, never re-fetches.
|
|
33
59
|
*/
|
|
34
60
|
export declare function appendConversationModeHint(systemPrompt: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* The minimal STRUCTURAL shape of a pi context message this module needs. Kept
|
|
63
|
+
* structural (not an SDK type import) so the CLI-bridge twin can be byte-identical
|
|
64
|
+
* and so both copies stay unit-testable without standing up a pi runtime.
|
|
65
|
+
*/
|
|
66
|
+
export interface ContextMessageLike {
|
|
67
|
+
role: string;
|
|
68
|
+
content?: unknown;
|
|
69
|
+
[key: string]: unknown;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether the agent has ALREADY called `say` in the turn the tail of `messages`
|
|
73
|
+
* belongs to (i.e. since the last user message).
|
|
74
|
+
*
|
|
75
|
+
* This is the loop guard AND the anti-nag rule: the reminder asks for a `say`
|
|
76
|
+
* call, `say` is itself a tool, and a tool call means another LLM call with the
|
|
77
|
+
* reminder re-applied. Without this, a model that answers with ONLY a `say` call
|
|
78
|
+
* could be nudged into speaking again, and again. Once the turn has spoken, the
|
|
79
|
+
* reminder has done its job and is not repeated.
|
|
80
|
+
*/
|
|
81
|
+
export declare function saidThisTurn(messages: readonly ContextMessageLike[]): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Return the messages for ONE upcoming LLM call with the spoken-conversation
|
|
84
|
+
* reminder at the TAIL, where a smaller model actually reads it.
|
|
85
|
+
*
|
|
86
|
+
* Placement is deliberately ROLE-SAFE rather than "always append a message":
|
|
87
|
+
* Anthropic's own API merges consecutive same-role turns, but Bedrock (and some
|
|
88
|
+
* compatibility proxies) reject them outright, and after a tool result the tail
|
|
89
|
+
* IS a user-role turn. So:
|
|
90
|
+
* - tail is a `user` or `toolResult` message -> the reminder is added as an extra
|
|
91
|
+
* text block INSIDE a clone of it (no new turn, no role sequence change);
|
|
92
|
+
* - anything else (assistant tail, empty context) -> the reminder is appended as
|
|
93
|
+
* its own `custom` message, which converts to a user turn cleanly.
|
|
94
|
+
*
|
|
95
|
+
* Pure and non-mutating: the input array and its messages are never touched, only
|
|
96
|
+
* the returned array (and the single cloned tail) differ. Idempotent: a tail that
|
|
97
|
+
* already carries the marker is left alone, so re-entry cannot stack reminders.
|
|
98
|
+
*/
|
|
99
|
+
export declare function withConversationModeReminder(messages: readonly ContextMessageLike[]): ContextMessageLike[];
|
|
35
100
|
/**
|
|
36
101
|
* A per-session, per-turn arming latch plus the inline pi extension that acts on
|
|
37
102
|
* it.
|
|
@@ -40,20 +105,36 @@ export declare function appendConversationModeHint(systemPrompt: string): string
|
|
|
40
105
|
* same):
|
|
41
106
|
* - `arm(active)` is called for EVERY user message with that message's flag, so
|
|
42
107
|
* the latest message always wins (a stale value can never outlive it).
|
|
43
|
-
* - the `before_agent_start` handler CONSUMES the
|
|
108
|
+
* - the `before_agent_start` handler CONSUMES the arming (one turn only), so a
|
|
44
109
|
* turn that was not started by a flagged message (an auto-retry, or a message
|
|
45
|
-
* typed straight into the terminal in the bridge case) gets no hint.
|
|
110
|
+
* typed straight into the terminal in the bridge case) gets no hint. Consuming
|
|
111
|
+
* it OPENS the turn: whatever the arming said (on or off) becomes this turn's
|
|
112
|
+
* spoken state, so an unflagged turn also explicitly CLOSES a previous one.
|
|
113
|
+
* - while the turn is open, `applyToContext` adds the TAIL reminder before every
|
|
114
|
+
* LLM call of that turn (the system-prompt hint alone is too weak and too far
|
|
115
|
+
* from the tail for smaller models; see CONVERSATION_MODE_REMINDER).
|
|
116
|
+
* - `endTurn()` (wired to `agent_end`) closes it, so nothing leaks past the turn.
|
|
46
117
|
*/
|
|
47
118
|
export interface ConversationModeSignal {
|
|
48
119
|
/** Arm (true) or disarm (false) the hint for the turn the next message starts. */
|
|
49
120
|
arm(active: boolean): void;
|
|
50
121
|
/** Whether the latch is currently armed (test/diagnostic use). */
|
|
51
122
|
isArmed(): boolean;
|
|
123
|
+
/** Whether a spoken turn is currently OPEN, i.e. the reminder applies (test/diagnostic use). */
|
|
124
|
+
isTurnActive(): boolean;
|
|
52
125
|
/**
|
|
53
126
|
* The system prompt to use for this turn, or undefined to leave it untouched.
|
|
54
|
-
* CONSUMES the arming.
|
|
127
|
+
* CONSUMES the arming and opens/closes the turn accordingly.
|
|
55
128
|
*/
|
|
56
129
|
applyToSystemPrompt(systemPrompt: string): string | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* The messages to send for ONE upcoming LLM call, or undefined to leave them
|
|
132
|
+
* untouched (no spoken turn open). Does NOT consume anything: a turn can make
|
|
133
|
+
* many LLM calls and each one gets the reminder until the agent has spoken.
|
|
134
|
+
*/
|
|
135
|
+
applyToContext(messages: readonly ContextMessageLike[]): ContextMessageLike[] | undefined;
|
|
136
|
+
/** Close the spoken turn (wired to `agent_end`). */
|
|
137
|
+
endTurn(): void;
|
|
57
138
|
/** The inline pi extension to hand to DefaultResourceLoader's extensionFactories. */
|
|
58
139
|
inlineExtension: InlineExtension;
|
|
59
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-mode-hint.d.ts","sourceRoot":"","sources":["../src/conversation-mode-hint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"conversation-mode-hint.d.ts","sourceRoot":"","sources":["../src/conversation-mode-hint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,eAAe,EAChB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,sBAAsB,QAKC,CAAC;AAErC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAEhF,eAAO,MAAM,0BAA0B,QAGmD,CAAC;AAE3F;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAYD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,OAAO,CAY7E;AAyCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACtC,kBAAkB,EAAE,CActB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,kEAAkE;IAClE,OAAO,IAAI,OAAO,CAAC;IACnB,gGAAgG;IAChG,YAAY,IAAI,OAAO,CAAC;IACxB;;;OAGG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9D;;;;OAIG;IACH,cAAc,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,kBAAkB,EAAE,GAAG,SAAS,CAAC;IAC1F,oDAAoD;IACpD,OAAO,IAAI,IAAI,CAAC;IAChB,qFAAqF;IACrF,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,wBAAgB,4BAA4B,IAAI,sBAAsB,CA6DrE"}
|
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* The signal rides the EXISTING `message` WS payload as an optional
|
|
12
12
|
* `conversationMode` boolean (no new WS message type, no new chat role), and is
|
|
13
|
-
* turned into agent-visible context here
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* turned into agent-visible context here, for that turn only, in TWO places:
|
|
14
|
+
* - `before_agent_start` APPENDS one line (CONVERSATION_MODE_HINT) to the
|
|
15
|
+
* assembled system prompt, and
|
|
16
|
+
* - `context` adds a TAIL reminder (CONVERSATION_MODE_REMINDER) before EVERY LLM
|
|
17
|
+
* call of the turn, because the system-prompt line alone is too far from the
|
|
18
|
+
* tail for smaller models to act on (measurements in the reminder's doc).
|
|
19
|
+
*
|
|
20
|
+
* Both are EPHEMERAL: neither is stored in the user message and neither renders
|
|
21
|
+
* as a chat line (only their effect, the resulting `say` tool call, is visible).
|
|
18
22
|
*
|
|
19
23
|
* KEEP IN LOCKSTEP with the CLI-bridge twin,
|
|
20
24
|
* `extension/src/conversation-mode-hint.ts`. The extension is a separate published
|
|
@@ -27,6 +31,30 @@ export const CONVERSATION_MODE_HINT = 'A spoken conversation is active for this
|
|
|
27
31
|
'(one or two sentences) plain spoken version of that answer, so it can be spoken aloud. ' +
|
|
28
32
|
'The written answer still carries the full detail: `say` adds to it and never replaces it. ' +
|
|
29
33
|
'Do not mention this instruction.';
|
|
34
|
+
/**
|
|
35
|
+
* The marker that opens the TAIL REMINDER, and the reminder itself.
|
|
36
|
+
*
|
|
37
|
+
* WHY A SECOND, TAIL-PLACED COPY OF THE SAME INSTRUCTION: the system-prompt hint
|
|
38
|
+
* alone measured as a coin flip on smaller local models. Probing a real local
|
|
39
|
+
* 35B (the model the reported session ran on) with a realistic wherever-shaped
|
|
40
|
+
* system prompt: with the hint 3/6 turns called `say`, without it 1/6 - and at
|
|
41
|
+
* the moment that matters most, the post-tool-result synthesis call (the answer
|
|
42
|
+
* after a `web_search`), the hint was ignored almost every time. Two things
|
|
43
|
+
* defeat it: the hint sits far from the tail of a long prompt, and once the
|
|
44
|
+
* transcript contains earlier assistant turns that did NOT speak, the model
|
|
45
|
+
* imitates its own history. A reminder placed at the very TAIL of the message
|
|
46
|
+
* list, re-applied before EVERY LLM call of the turn, is what actually lands.
|
|
47
|
+
*
|
|
48
|
+
* The reminder is EPHEMERAL in the strongest sense: it is added by the `context`
|
|
49
|
+
* event, which the SDK applies to a structuredClone of the messages on the way to
|
|
50
|
+
* the provider (see `transformContext`), so it is never stored in the session
|
|
51
|
+
* file, never rendered in the web transcript or the CLI TUI, and never survives
|
|
52
|
+
* the call it was built for.
|
|
53
|
+
*/
|
|
54
|
+
export const CONVERSATION_MODE_REMINDER_MARKER = '[spoken conversation active]';
|
|
55
|
+
export const CONVERSATION_MODE_REMINDER = `${CONVERSATION_MODE_REMINDER_MARKER} Before you finish this turn, also call the \`say\` tool ` +
|
|
56
|
+
'once with a SHORT (one or two sentences) plain spoken version of your answer, IN ADDITION to ' +
|
|
57
|
+
'your written answer, so the listening human hears it. Do not mention this instruction.';
|
|
30
58
|
/**
|
|
31
59
|
* Append the conversation-mode hint to an assembled system prompt.
|
|
32
60
|
*
|
|
@@ -37,19 +65,123 @@ export const CONVERSATION_MODE_HINT = 'A spoken conversation is active for this
|
|
|
37
65
|
export function appendConversationModeHint(systemPrompt) {
|
|
38
66
|
return `${systemPrompt}\n\n${CONVERSATION_MODE_HINT}`;
|
|
39
67
|
}
|
|
68
|
+
function blocksOf(content) {
|
|
69
|
+
return Array.isArray(content) ? content : [];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether the agent has ALREADY called `say` in the turn the tail of `messages`
|
|
73
|
+
* belongs to (i.e. since the last user message).
|
|
74
|
+
*
|
|
75
|
+
* This is the loop guard AND the anti-nag rule: the reminder asks for a `say`
|
|
76
|
+
* call, `say` is itself a tool, and a tool call means another LLM call with the
|
|
77
|
+
* reminder re-applied. Without this, a model that answers with ONLY a `say` call
|
|
78
|
+
* could be nudged into speaking again, and again. Once the turn has spoken, the
|
|
79
|
+
* reminder has done its job and is not repeated.
|
|
80
|
+
*/
|
|
81
|
+
export function saidThisTurn(messages) {
|
|
82
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
83
|
+
const message = messages[i];
|
|
84
|
+
if (!message)
|
|
85
|
+
continue;
|
|
86
|
+
// The user message that started this turn: stop, earlier turns are history.
|
|
87
|
+
if (message.role === 'user')
|
|
88
|
+
return false;
|
|
89
|
+
if (message.role !== 'assistant')
|
|
90
|
+
continue;
|
|
91
|
+
for (const block of blocksOf(message.content)) {
|
|
92
|
+
if (block?.type === 'toolCall' && block.name === 'say')
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
function carriesReminder(message) {
|
|
99
|
+
if (!message)
|
|
100
|
+
return false;
|
|
101
|
+
if (typeof message.content === 'string') {
|
|
102
|
+
return message.content.includes(CONVERSATION_MODE_REMINDER_MARKER);
|
|
103
|
+
}
|
|
104
|
+
return blocksOf(message.content).some((block) => typeof block?.text === 'string' && block.text.includes(CONVERSATION_MODE_REMINDER_MARKER));
|
|
105
|
+
}
|
|
106
|
+
/** A clone of `message` with the reminder added as one more text block. */
|
|
107
|
+
function withReminderBlock(message) {
|
|
108
|
+
if (typeof message.content === 'string') {
|
|
109
|
+
return { ...message, content: `${message.content}\n\n${CONVERSATION_MODE_REMINDER}` };
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
...message,
|
|
113
|
+
content: [...blocksOf(message.content), { type: 'text', text: CONVERSATION_MODE_REMINDER }],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The reminder as its own message, for the case where the tail cannot absorb it.
|
|
118
|
+
*
|
|
119
|
+
* A `custom` message is pi's own "context that is not a real chat message" shape:
|
|
120
|
+
* `convertToLlm` turns it into a plain user text message for the provider, and
|
|
121
|
+
* `display: false` keeps it out of any UI that might see it.
|
|
122
|
+
*/
|
|
123
|
+
function reminderMessage() {
|
|
124
|
+
return {
|
|
125
|
+
role: 'custom',
|
|
126
|
+
customType: 'wherever-conversation-mode',
|
|
127
|
+
content: CONVERSATION_MODE_REMINDER,
|
|
128
|
+
display: false,
|
|
129
|
+
timestamp: Date.now(),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Return the messages for ONE upcoming LLM call with the spoken-conversation
|
|
134
|
+
* reminder at the TAIL, where a smaller model actually reads it.
|
|
135
|
+
*
|
|
136
|
+
* Placement is deliberately ROLE-SAFE rather than "always append a message":
|
|
137
|
+
* Anthropic's own API merges consecutive same-role turns, but Bedrock (and some
|
|
138
|
+
* compatibility proxies) reject them outright, and after a tool result the tail
|
|
139
|
+
* IS a user-role turn. So:
|
|
140
|
+
* - tail is a `user` or `toolResult` message -> the reminder is added as an extra
|
|
141
|
+
* text block INSIDE a clone of it (no new turn, no role sequence change);
|
|
142
|
+
* - anything else (assistant tail, empty context) -> the reminder is appended as
|
|
143
|
+
* its own `custom` message, which converts to a user turn cleanly.
|
|
144
|
+
*
|
|
145
|
+
* Pure and non-mutating: the input array and its messages are never touched, only
|
|
146
|
+
* the returned array (and the single cloned tail) differ. Idempotent: a tail that
|
|
147
|
+
* already carries the marker is left alone, so re-entry cannot stack reminders.
|
|
148
|
+
*/
|
|
149
|
+
export function withConversationModeReminder(messages) {
|
|
150
|
+
const out = messages.slice();
|
|
151
|
+
// Already spoken this turn: nothing to nudge, and re-nudging risks a say loop.
|
|
152
|
+
if (saidThisTurn(out))
|
|
153
|
+
return out;
|
|
154
|
+
const tail = out[out.length - 1];
|
|
155
|
+
if (carriesReminder(tail))
|
|
156
|
+
return out;
|
|
157
|
+
if (tail && (tail.role === 'user' || tail.role === 'toolResult')) {
|
|
158
|
+
out[out.length - 1] = withReminderBlock(tail);
|
|
159
|
+
return out;
|
|
160
|
+
}
|
|
161
|
+
out.push(reminderMessage());
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
40
164
|
export function createConversationModeSignal() {
|
|
41
165
|
let armed = false;
|
|
166
|
+
let turnActive = false;
|
|
42
167
|
const applyToSystemPrompt = (systemPrompt) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
|
|
168
|
+
// One turn only: consume the arming so it cannot leak into a later, unflagged
|
|
169
|
+
// turn, and let it decide whether THIS turn is a spoken one (an unflagged turn
|
|
170
|
+
// therefore also closes a turn a missing agent_end might have left open).
|
|
171
|
+
turnActive = armed;
|
|
47
172
|
armed = false;
|
|
173
|
+
if (!turnActive)
|
|
174
|
+
return undefined;
|
|
48
175
|
return appendConversationModeHint(systemPrompt);
|
|
49
176
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
177
|
+
const applyToContext = (messages) => {
|
|
178
|
+
if (!turnActive)
|
|
179
|
+
return undefined;
|
|
180
|
+
return withConversationModeReminder(messages);
|
|
181
|
+
};
|
|
182
|
+
// The SDK-supported way to get these hooks on a server-created session: an
|
|
183
|
+
// INLINE extension, i.e. the same pi.on(...) surface the CLI-bridge extension
|
|
184
|
+
// uses, so both session types run the same shape of handler.
|
|
53
185
|
const factory = (pi) => {
|
|
54
186
|
pi.on('before_agent_start', (event) => {
|
|
55
187
|
const systemPrompt = applyToSystemPrompt(event.systemPrompt);
|
|
@@ -57,6 +189,19 @@ export function createConversationModeSignal() {
|
|
|
57
189
|
return;
|
|
58
190
|
return { systemPrompt };
|
|
59
191
|
});
|
|
192
|
+
// Fired before EVERY LLM call (including the post-tool-result synthesis call,
|
|
193
|
+
// which is exactly where the system-prompt hint gets ignored). The SDK hands
|
|
194
|
+
// us a structuredClone and passes our result straight to convertToLlm, so this
|
|
195
|
+
// never touches session state.
|
|
196
|
+
pi.on('context', (event) => {
|
|
197
|
+
const messages = applyToContext(event.messages);
|
|
198
|
+
if (messages === undefined)
|
|
199
|
+
return;
|
|
200
|
+
return { messages: messages };
|
|
201
|
+
});
|
|
202
|
+
pi.on('agent_end', () => {
|
|
203
|
+
turnActive = false;
|
|
204
|
+
});
|
|
60
205
|
};
|
|
61
206
|
return {
|
|
62
207
|
arm(active) {
|
|
@@ -65,7 +210,14 @@ export function createConversationModeSignal() {
|
|
|
65
210
|
isArmed() {
|
|
66
211
|
return armed;
|
|
67
212
|
},
|
|
213
|
+
isTurnActive() {
|
|
214
|
+
return turnActive;
|
|
215
|
+
},
|
|
68
216
|
applyToSystemPrompt,
|
|
217
|
+
applyToContext,
|
|
218
|
+
endTurn() {
|
|
219
|
+
turnActive = false;
|
|
220
|
+
},
|
|
69
221
|
inlineExtension: { name: 'wherever-conversation-mode', factory },
|
|
70
222
|
};
|
|
71
223
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-mode-hint.js","sourceRoot":"","sources":["../src/conversation-mode-hint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation-mode-hint.js","sourceRoot":"","sources":["../src/conversation-mode-hint.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{bm as Le,aL as Ke,ba as A,aj as U,a$ as T,bg as re,b5 as bt,bh as kt}from"./CRRPBe07.js";class Ae{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ue{constructor(t,n){try{new Headers({location:n})}catch{throw new Error(`Invalid redirect location ${JSON.stringify(n)}: this string contains characters that cannot be used in HTTP headers`)}this.status=t,this.location=n}}class Te extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function St(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function Et(e){return e.split("%25").map(decodeURI).join("%25")}function Rt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function ve({href:e}){return e.split("#")[0]}function C(){}function xt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;function Lt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const At=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&J.delete($e(e)),At(e,t));const J=new Map;function Ut(e,t){const n=$e(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const o=r.getAttribute("data-ttl");return o&&J.set(n,{body:a,init:i,ttl:1e3*Number(o)}),r.getAttribute("data-b64")!==null&&(a=Lt(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Tt(e,t,n){if(J.size>0){const r=$e(e,n),a=J.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);J.delete(r)}}return window.fetch(t,n)}function $e(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${xt(...a)}"]`}return r}const $t=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function It(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Ze(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const o=r.split(/\[(.+?)\](?!\])/);return"/"+o.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return ye(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return ye(String.fromCharCode(...l.slice(2).split("-").map(_=>parseInt(_,16))));const f=$t.exec(l),[,p,w,d,u]=f;return t.push({name:d,matcher:u,optional:!!p,rest:!!w,chained:w?c===1&&o[0]==="":!1}),w?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return ye(l)}).join("")}).join("")}/?$`),params:t}}function Pt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Ze(e){return e.slice(1).split("/").filter(Pt)}function Ot(e,t,n){const r={},a=e.slice(1),i=a.filter(s=>s!==void 0);let o=0;for(let s=0;s<t.length;s+=1){const l=t[s];let c=a[s-o];if(l.chained&&l.rest&&o&&(c=a.slice(s-o,s+1).filter(f=>f).join("/"),o=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const f=t[s+1],p=a[s+1];f&&!f.rest&&f.optional&&p&&l.chained&&(o=0),!f&&!p&&Object.keys(r).length===i.length&&(o=0);continue}if(l.optional&&l.chained){o++;continue}return}if(!o)return r}function ye(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}const Ct=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function dn(e,t){const n=Ze(e),r=e!="/"&&e.endsWith("/");return"/"+n.map(a=>a.replace(Ct,(i,o,s,l)=>{const c=t[l];if(!c){if(o||s&&c!==void 0)return"";throw new Error(`Missing parameter '${l}' in route ${e}`)}if(c.startsWith("/")||c.endsWith("/"))throw new Error(`Parameter '${l}' in route ${e} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return c})).filter(Boolean).join("/")+(r?"/":"")}function jt({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([s,[l,c,f]])=>{const{pattern:p,params:w}=It(s),d={id:s,exec:u=>{const _=p.exec(u);if(_)return Ot(_,w,r)},errors:[1,...f||[]].map(u=>e[u]),layouts:[0,...c||[]].map(o),leaf:i(l)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function i(s){const l=s<0;return l&&(s=~s),[l,e[s]]}function o(s){return s===void 0?s:[a.has(s),e[s]]}}function et(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Fe(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const L=globalThis.__sveltekit_1ahscao?.base??"",Nt=globalThis.__sveltekit_1ahscao?.assets??L??"",qt="673299e",tt="sveltekit:snapshot",nt="sveltekit:scroll",Ie="sveltekit:states",rt="sveltekit:pageurl",D="sveltekit:history",W="sveltekit:navigation",q={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Pe=location.origin;function Oe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function V(){return{x:pageXOffset,y:pageYOffset}}function B(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ge={...q,"":q.hover};function at(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function ot(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=at(e)}}function Se(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const s=location.hash.split("#")[1]||"/";r.hash=`#${s}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||he(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),o=r?.origin===Pe&&e.hasAttribute("download");return{url:r,external:i,target:a,download:o}}function ae(e){let t=null,n=null,r=null,a=null,i=null,o=null,s=e;for(;s&&s!==document.documentElement;)r===null&&(r=B(s,"preload-code")),a===null&&(a=B(s,"preload-data")),t===null&&(t=B(s,"keepfocus")),n===null&&(n=B(s,"noscroll")),i===null&&(i=B(s,"reload")),o===null&&(o=B(s,"replacestate")),s=at(s);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ge[r??"off"],preload_data:Ge[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(o)}}function He(e){const t=Le(e);let n=!0;function r(){n=!0,t.update(o=>o)}function a(o){n=!1,t.set(o)}function i(o){let s;return t.subscribe(l=>{(s===void 0||n&&l!==s)&&o(s=l)})}return{notify:r,set:a,subscribe:i}}const st={v:C};function Dt(){const{set:e,subscribe:t}=Le(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Nt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const o=(await a.json()).version!==qt;return o&&(e(!0),st.v(),clearTimeout(n)),o}catch{return!1}}return{subscribe:t,check:r}}function he(e,t,n){return e.origin!==Pe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function hn(e){}const it=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...it];const Vt=new Set([...it]);[...Vt];function Bt(e){return e.filter(t=>t!=null)}function te(e,t){return e+"/"+t}function Ce(e){return e instanceof Ae||e instanceof Te?e.status:500}function Mt(e){return e instanceof Te?e.text:"Internal Error"}let b,z,be;const Wt=Ke.toString().includes("$$")||/function \w+\(\) \{\}/.test(Ke.toString()),Je="a:";Wt?(b={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(Je)},z={current:null},be={current:!1}):(b=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL(Je));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},z=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},be=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},st.v=()=>be.current=!0);function lt(e){Object.assign(b,e)}const Kt=kt??(e=>e()),Ft=new Set(["icon","shortcut icon","apple-touch-icon"]);let G=null;const N=et(nt)??{},X=et(tt)??{},j={url:He({}),page:He({}),navigating:Le(null),updated:Dt()};function pe(e){N[e]=V()}function ct(e,t){let n=e+1;for(;N[n];)delete N[n],n+=1;for(n=t+1;X[n];)delete X[n],n+=1}function Q(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(C)}async function ut(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(L||"/");e&&await e.update()}}let je,Ee,oe,$,Re,y;const se=[],ie=[];let x=null;function le(){x?.fork?.then(e=>e?.discard()),x=null}const ne=new Map,ft=new Set,Gt=new Set,Y=new Set;let m={branch:[],error:null,url:null},dt=!1,ce=!1,Ye=!0,Z=!1,H=!1,Ne=!1,qe=!1,De,v,E,O;const ue=new Set,ze=new Map,Xe=new Map;async function mn(e,t,n){globalThis.__sveltekit_1ahscao&&(globalThis.__sveltekit_1ahscao.query,globalThis.__sveltekit_1ahscao.prerender),document.URL!==location.href&&(location.href=location.href),y=e,await e.hooks.init?.(),je=jt(e),$=document.documentElement,Re=t,Ee=e.nodes[0],oe=e.nodes[1],Ee(),oe(),v=history.state?.[D],E=history.state?.[W],v||(v=E=Date.now(),history.replaceState({...history.state,[D]:v,[W]:E},""));const r=N[v];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await sn(Re,n)):(await M({type:"enter",url:Oe(y.hash?un(new URL(location.href)):location.href),replace_state:!0}),a()),on()}function Ht(){se.length=0,qe=!1}function ht(e){ie.some(t=>t?.snapshot)&&(X[e]=ie.map(t=>t?.snapshot?.capture()))}function pt(e){X[e]?.forEach((t,n)=>{ie[n]?.snapshot?.restore(t)})}function Qe(){pe(v),Fe(nt,N),ht(E),Fe(tt,X)}async function Jt(e,t,n,r){let a,i;t.invalidateAll&&le(),await M({type:"goto",url:Oe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{if(t.invalidateAll){qe=!0,a=new Set;for(const[o,s]of ze)for(const l of s.keys())a.add(te(o,l));i=new Set;for(const[o,s]of Xe)for(const l of s.keys())i.add(te(o,l))}t.invalidate&&t.invalidate.forEach(an)}}),t.invalidateAll&&re().then(re).then(()=>{for(const[o,s]of ze)for(const[l,{resource:c}]of s)a?.has(te(o,l))&&c.refresh();for(const[o,s]of Xe)for(const[l,{resource:c}]of s)i?.has(te(o,l))&&c.reconnect()})}async function Yt(e){if(e.id!==x?.id){le();const t={};ue.add(t),x={id:e.id,token:t,promise:_t({...e,preload:t}).then(n=>(ue.delete(t),n.type==="loaded"&&n.state.error&&le(),n)),fork:null}}return x.promise}async function ke(e){const t=(await ge(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function gt(e,t,n){const r={params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)};m={...e.state,nav:r};const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),lt(e.props.page),De=new y.root({target:t,props:{...e.props,stores:j,components:ie},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),pt(E),n){const i={from:null,to:{...r,scroll:N[v]??V()},willUnload:!1,type:"enter",complete:Promise.resolve()};Y.forEach(o=>o(i))}ce=!0}async function fe({url:e,params:t,branch:n,errors:r,status:a,error:i,route:o,form:s}){let l="never";if(L&&(e.pathname===L||e.pathname===L+"/"))l="always";else for(const u of n)u?.slash!==void 0&&(l=u.slash);e.pathname=St(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:i,route:o},props:{constructors:Bt(n).map(u=>u.node.component),page:_e(b)}};s!==void 0&&(c.props.form=s);let f={},p=!b,w=0;for(let u=0;u<Math.max(n.length,m.branch.length);u+=1){const _=n[u],g=m.branch[u];_?.data!==g?.data&&(p=!0),_&&(f={...f,..._.data},p&&(c.props[`data_${w}`]=f),w+=1)}return(!m.url||e.href!==m.url.href||m.error!==i||s!==void 0&&s!==b.form||p)&&(c.props.page={error:i,params:t,route:{id:o?.id??null},state:{},status:a,url:new URL(e),form:s??null,data:p?f:b.data}),c}async function Ve({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let o=null;const s={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:i,universal:l.universal?.load?{type:"data",data:o,uses:s}:null,data:o??i?.data??null,slash:l.universal?.trailingSlash??i?.slash}}function zt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=ce?Tt(r,a.href,t):Ut(r,t);return{resolved:a,promise:i}}function Xt(e,t,n,r,a,i){if(qe)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const o of a.search_params)if(r.has(o))return!0;for(const o of a.params)if(i[o]!==m.params[o])return!0;for(const o of a.dependencies)if(se.some(s=>s(new URL(o))))return!0;return!1}function Be(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Qt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(o=>i.includes(o))&&i.every(o=>a.includes(o))&&n.delete(r)}return n}function Zt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:_e(b),constructors:[]}}}async function _t({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(x?.id===e)return ue.delete(x.token),x.promise;const{errors:o,layouts:s,leaf:l}=a,c=[...s,l];o.forEach(g=>g?.().catch(C)),c.forEach(g=>g?.[1]().catch(C));const f=m.url?e!==de(m.url):!1,p=m.route?a.id!==m.route.id:!1,w=Qt(m.url,n);let d=!1;const u=c.map(async(g,h)=>{if(!g)return;const k=m.branch[h];return g[1]===k?.loader&&!Xt(d,p,f,w,k.universal?.uses,r)?k:(d=!0,Ve({loader:g[1],url:n,params:r,route:a,parent:async()=>{const I={};for(let P=0;P<h;P+=1)Object.assign(I,(await u[P])?.data);return I},server_data_node:Be(g[0]?{type:"skip"}:null,g[0]?k?.server:void 0)}))});for(const g of u)g.catch(C);const _=[];for(let g=0;g<c.length;g+=1)if(c[g])try{_.push(await u[g])}catch(h){if(h instanceof Ue)return{type:"redirect",location:h.location};if(ue.has(i))return Zt({error:await ee(h,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let k=Ce(h),R;if(h instanceof Ae)R=h.body;else{if(await j.updated.check())return await ut(),await Q(n);R=await ee(h,{params:r,url:n,route:{id:a.id}})}const I=await en(g,_,o);return I?fe({url:n,params:r,branch:_.slice(0,I.idx).concat(I.node),errors:o,status:k,error:R,route:a}):await wt(n,{id:a.id},R,k)}else _.push(void 0);return fe({url:n,params:r,branch:_,errors:o,status:200,error:null,route:a,form:t?void 0:null})}async function en(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Me({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const o=await Ve({loader:Ee,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Be(i)}),s={node:await oe(),loader:oe,universal:null,server:null,data:null};return fe({url:n,params:a,branch:[o,s],status:e,error:t,errors:[],route:null})}catch(o){if(o instanceof Ue)return Jt(new URL(o.location,location.href),{},0);throw o}}async function tn(e){const t=e.href;if(ne.has(t))return ne.get(t);let n;try{const r=(async()=>{let a=await y.hooks.reroute({url:new URL(e),fetch:async(i,o)=>zt(i,o,e).promise})??e;if(typeof a=="string"){const i=new URL(e);y.hash?i.hash=a:i.pathname=a,a=i}return a})();ne.set(t,r),n=await r}catch{ne.delete(t);return}return n}async function ge(e,t){if(e&&!he(e,L,y.hash)){const n=await tn(e);if(!n)return;const r=nn(n);for(const a of je){const i=a.exec(r);if(i)return{id:de(e),invalidating:t,route:a,params:Rt(i),url:e}}}}function nn(e){return Et(y.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(L.length))||"/"}function de(e){return(y.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function mt({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let o=!1;const s=We(m,n,e,t,i??null);r!==void 0&&(s.navigation.delta=r),a!==void 0&&(s.navigation.event=a);const l={...s.navigation,cancel:()=>{o=!0,s.reject(new Error("navigation cancelled"))}};return Z||ft.forEach(c=>c(l)),o?null:s}async function M({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:o={},redirect_count:s=0,nav_token:l={},accept:c=C,block:f=C,event:p}){const w=O;O=l;const d=await ge(t,!1),u=e==="enter"?We(m,d,t,e):mt({url:t,type:e,delta:n?.delta,intent:d,scroll:n?.scroll,event:p});if(!u){f(),O===l&&(O=w);return}const _=v,g=E;c(),Z=!0,ce&&u.navigation.type!=="enter"&&j.navigating.set(z.current=u.navigation);let h=d&&await _t(d);if(!h){if(he(t,L,y.hash))return await Q(t,i);h=await wt(t,{id:null},await ee(new Te(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=d?.url||t,O!==l)return u.reject(new Error("navigation aborted")),!1;if(h.type==="redirect"){if(s<20){await M({type:e,url:new URL(h.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:o,redirect_count:s+1,nav_token:l}),u.fulfil(void 0);return}h=await Me({status:500,error:await ee(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else h.props.page.status>=400&&await j.updated.check()&&(await ut(),await Q(t,i));if(Ht(),pe(_),ht(g),h.props.page.url.pathname!==t.pathname&&(t.pathname=h.props.page.url.pathname),o=n?n.state:o,!n){const S=i?0:1,K={[D]:v+=S,[W]:E+=S,[Ie]:o};(i?history.replaceState:history.pushState).call(history,K,"",t),i||ct(v,E)}const k=d&&x?.id===d.id?x.fork:null;x?.fork&&!k&&le(),x=null,h.props.page.state=o;let R;if(ce){const S=(await Promise.all(Array.from(Gt,F=>F(u.navigation)))).filter(F=>typeof F=="function");if(S.length>0){let F=function(){S.forEach(we=>{Y.delete(we)})};S.push(F),S.forEach(we=>{Y.add(we)})}const K=u.navigation.to;m={...h.state,nav:{params:K.params,route:K.route,url:K.url}},h.props.page&&(h.props.page.url=t);const me=k&&await k;me?R=me.commit():(G=null,De.$set(h.props),G&&Object.assign(h.props.page,G),lt(h.props.page),R=bt?.()),Ne=!0}else await gt(h,Re,!1);const{activeElement:I}=document;if(await R,await re(),await re(),O!==l)return u.reject(new Error("navigation aborted")),!1;h.props.page&&G&&Object.assign(h.props.page,G);let P=null;if(Ye){const S=n?n.scroll:a?V():null;S?scrollTo(S.x,S.y):(P=t.hash&&document.getElementById(vt(t)))?P.scrollIntoView():scrollTo(0,0)}const yt=document.activeElement!==I&&document.activeElement!==document.body;!r&&!yt&&cn(t,!P),Ye=!0,Z=!1,e==="popstate"&&pt(E),u.fulfil(void 0),u.navigation.to&&(u.navigation.to.scroll=V()),Y.forEach(S=>S(u.navigation)),j.navigating.set(z.current=null)}async function wt(e,t,n,r,a){return e.origin===Pe&&e.pathname===location.pathname&&!dt?await Me({status:r,error:n,url:e,route:t}):await Q(e,a)}function rn(){let e,t={element:void 0,href:void 0},n;$.addEventListener("mousemove",s=>{const l=s.target;clearTimeout(e),e=setTimeout(()=>{i(l,q.hover)},20)});function r(s){s.defaultPrevented||i(s.composedPath()[0],q.tap)}$.addEventListener("mousedown",r),$.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(s=>{for(const l of s)l.isIntersecting&&(ke(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(s,l){const c=ot(s,$),f=c===t.element&&c?.href===t.href&&l>=n;if(!c||f)return;const{url:p,external:w,download:d}=Se(c,L,y.hash);if(w||d)return;const u=ae(c),_=p&&de(m.url)===de(p);if(!(u.reload||_))if(l<=u.preload_data){t={element:c,href:c.href},n=q.tap;const g=await ge(p,!1);if(!g)return;Yt(g)}else l<=u.preload_code&&(t={element:c,href:c.href},n=l,ke(p))}function o(){a.disconnect();for(const s of $.querySelectorAll("a")){const{url:l,external:c,download:f}=Se(s,L,y.hash);if(c||f)continue;const p=ae(s);p.reload||(p.preload_code===q.viewport&&a.observe(s),p.preload_code===q.eager&&ke(l))}}Y.add(o),o()}function ee(e,t){if(e instanceof Ae)return e.body;const n=Ce(e),r=Mt(e);return y.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function an(e){if(typeof e=="function")se.push(e);else{const{href:t}=new URL(e,location.href);se.push(n=>n.href===t)}}function wn(e,t){pe(v);const n={[D]:v+=1,[W]:E,[rt]:b.url.href,[Ie]:t};history.pushState(n,"",Oe(e)),Ne=!0,b.state=t,De.$set({page:Kt(()=>_e(b))}),ct(v,E)}function on(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Qe(),!Z){const r=We(m,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};ft.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Qe()}),navigator.connection?.saveData||rn(),$.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=ot(t.composedPath()[0],$);if(!n)return;const{url:r,external:a,target:i,download:o}=Se(n,L,y.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const s=ae(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||o)return;const[c,f]=(y.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===ve(location);if(a||s.reload&&(!p||!f)){mt({url:r,type:"link",event:t})?Z=!0:t.preventDefault();return}if(f!==void 0&&p){const[,w]=m.url.href.split("#");if(w===f){if(t.preventDefault(),f===""||f==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const d=n.ownerDocument.getElementById(decodeURIComponent(f));d&&(d.scrollIntoView(),d.focus())}return}if(H=!0,pe(v),e(r),!s.replace_state)return;H=!1}t.preventDefault(),await new Promise(w=>{requestAnimationFrame(()=>{setTimeout(w,0)}),setTimeout(w,100)}),await M({type:"link",url:r,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??r.href===location.href,event:t})}),$.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const o=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(he(o,L,!1))return;const s=t.target,l=ae(s);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(s,r);o.search=new URLSearchParams(c).toString(),M({type:"form",url:o,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??o.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!xe){if(t.state?.[D]){const n=t.state[D];if(O={},n===v)return;const r=N[n],a=t.state[Ie]??{},i=new URL(t.state[rt]??location.href),o=t.state[W],s=m.url?ve(location)===ve(m.url):!1;if(o===E&&(Ne||s)){a!==b.state&&(b.state=a),e(i),N[v]=V(),r&&scrollTo(r.x,r.y),v=n;return}const c=n-v;await M({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{v=n,E=o},block:()=>{history.go(-c)},nav_token:O,event:t})}else if(!H){const n=new URL(location.href);e(n),y.hash&&location.reload()}}}),addEventListener("hashchange",()=>{H&&(H=!1,history.replaceState({...history.state,[D]:++v,[W]:E},"",location.href))});for(const t of document.querySelectorAll("link"))Ft.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&j.navigating.set(z.current=null)});function e(t){m.url=b.url=t,j.page.set(_e(b)),j.page.notify()}}async function sn(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:o,data:s,form:l}){dt=!0;const c=new URL(location.href);let f;({params:a={},route:i={id:null}}=await ge(c,!1)||{}),f=je.find(({id:d})=>d===i.id);let p,w=!0;try{const d=r.map(async(_,g)=>{const h=s[g];return h?.uses&&(h.uses=ln(h.uses)),Ve({loader:y.nodes[_],url:c,params:a,route:i,parent:async()=>{const k={};for(let R=0;R<g;R+=1)Object.assign(k,(await d[R]).data);return k},server_data_node:Be(h)})}),u=await Promise.all(d);if(f){const _=f.layouts;for(let g=0;g<_.length;g++)_[g]||u.splice(g,0,void 0)}p=await fe({url:c,params:a,branch:u,status:t,error:n,errors:f?.errors,form:l,route:f??null})}catch(d){if(d instanceof Ue){await Q(new URL(d.location,location.href));return}p=await Me({status:Ce(d),error:await ee(d,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",w=!1}p.props.page&&(p.props.page.state={}),await gt(p,e,w)}function ln(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let xe=!1;function cn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=vt(e);if(r&&document.getElementById(r)){const{x:i,y:o}=V();setTimeout(()=>{const s=history.state;xe=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(s,"",e),t&&scrollTo(i,o),xe=!1})}else{const i=document.body,o=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),o!==null?i.setAttribute("tabindex",o):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let o=0;o<a.rangeCount;o+=1)i.push(a.getRangeAt(o));setTimeout(()=>{if(a.rangeCount===i.length){for(let o=0;o<a.rangeCount;o+=1){const s=i[o],l=a.getRangeAt(o);if(s.commonAncestorContainer!==l.commonAncestorContainer||s.startContainer!==l.startContainer||s.endContainer!==l.endContainer||s.startOffset!==l.startOffset||s.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function We(e,t,n,r,a=null){let i,o;const s=new Promise((c,f)=>{i=c,o=f});return s.catch(C),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:V()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:s},fulfil:i,reject:o}}function _e(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function un(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function vt(e){let t;if(y.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{wn as a,L as b,j as c,hn as l,b as p,dn as r,mn as s,qt as v};
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
import{bm as Le,aL as Ke,ba as A,aj as U,a$ as T,bg as re,b5 as bt,bh as kt}from"./CRRPBe07.js";class Ae{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ue{constructor(t,n){try{new Headers({location:n})}catch{throw new Error(`Invalid redirect location ${JSON.stringify(n)}: this string contains characters that cannot be used in HTTP headers`)}this.status=t,this.location=n}}class Te extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function St(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function Et(e){return e.split("%25").map(decodeURI).join("%25")}function Rt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function ve({href:e}){return e.split("#")[0]}function C(){}function xt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;function Lt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const At=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&J.delete($e(e)),At(e,t));const J=new Map;function Ut(e,t){const n=$e(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const o=r.getAttribute("data-ttl");return o&&J.set(n,{body:a,init:i,ttl:1e3*Number(o)}),r.getAttribute("data-b64")!==null&&(a=Lt(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Tt(e,t,n){if(J.size>0){const r=$e(e,n),a=J.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);J.delete(r)}}return window.fetch(t,n)}function $e(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${xt(...a)}"]`}return r}const $t=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function It(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Ze(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const o=r.split(/\[(.+?)\](?!\])/);return"/"+o.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return ye(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return ye(String.fromCharCode(...l.slice(2).split("-").map(_=>parseInt(_,16))));const f=$t.exec(l),[,p,w,d,u]=f;return t.push({name:d,matcher:u,optional:!!p,rest:!!w,chained:w?c===1&&o[0]==="":!1}),w?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return ye(l)}).join("")}).join("")}/?$`),params:t}}function Pt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Ze(e){return e.slice(1).split("/").filter(Pt)}function Ot(e,t,n){const r={},a=e.slice(1),i=a.filter(s=>s!==void 0);let o=0;for(let s=0;s<t.length;s+=1){const l=t[s];let c=a[s-o];if(l.chained&&l.rest&&o&&(c=a.slice(s-o,s+1).filter(f=>f).join("/"),o=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const f=t[s+1],p=a[s+1];f&&!f.rest&&f.optional&&p&&l.chained&&(o=0),!f&&!p&&Object.keys(r).length===i.length&&(o=0);continue}if(l.optional&&l.chained){o++;continue}return}if(!o)return r}function ye(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}const Ct=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function dn(e,t){const n=Ze(e),r=e!="/"&&e.endsWith("/");return"/"+n.map(a=>a.replace(Ct,(i,o,s,l)=>{const c=t[l];if(!c){if(o||s&&c!==void 0)return"";throw new Error(`Missing parameter '${l}' in route ${e}`)}if(c.startsWith("/")||c.endsWith("/"))throw new Error(`Parameter '${l}' in route ${e} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return c})).filter(Boolean).join("/")+(r?"/":"")}function jt({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([s,[l,c,f]])=>{const{pattern:p,params:w}=It(s),d={id:s,exec:u=>{const _=p.exec(u);if(_)return Ot(_,w,r)},errors:[1,...f||[]].map(u=>e[u]),layouts:[0,...c||[]].map(o),leaf:i(l)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function i(s){const l=s<0;return l&&(s=~s),[l,e[s]]}function o(s){return s===void 0?s:[a.has(s),e[s]]}}function et(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Fe(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const L=globalThis.__sveltekit_181g8n8?.base??"",Nt=globalThis.__sveltekit_181g8n8?.assets??L??"",qt="7e78873",tt="sveltekit:snapshot",nt="sveltekit:scroll",Ie="sveltekit:states",rt="sveltekit:pageurl",D="sveltekit:history",W="sveltekit:navigation",q={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Pe=location.origin;function Oe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function V(){return{x:pageXOffset,y:pageYOffset}}function B(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ge={...q,"":q.hover};function at(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function ot(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=at(e)}}function Se(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const s=location.hash.split("#")[1]||"/";r.hash=`#${s}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||he(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),o=r?.origin===Pe&&e.hasAttribute("download");return{url:r,external:i,target:a,download:o}}function ae(e){let t=null,n=null,r=null,a=null,i=null,o=null,s=e;for(;s&&s!==document.documentElement;)r===null&&(r=B(s,"preload-code")),a===null&&(a=B(s,"preload-data")),t===null&&(t=B(s,"keepfocus")),n===null&&(n=B(s,"noscroll")),i===null&&(i=B(s,"reload")),o===null&&(o=B(s,"replacestate")),s=at(s);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ge[r??"off"],preload_data:Ge[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(o)}}function He(e){const t=Le(e);let n=!0;function r(){n=!0,t.update(o=>o)}function a(o){n=!1,t.set(o)}function i(o){let s;return t.subscribe(l=>{(s===void 0||n&&l!==s)&&o(s=l)})}return{notify:r,set:a,subscribe:i}}const st={v:C};function Dt(){const{set:e,subscribe:t}=Le(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Nt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const o=(await a.json()).version!==qt;return o&&(e(!0),st.v(),clearTimeout(n)),o}catch{return!1}}return{subscribe:t,check:r}}function he(e,t,n){return e.origin!==Pe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function hn(e){}const it=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...it];const Vt=new Set([...it]);[...Vt];function Bt(e){return e.filter(t=>t!=null)}function te(e,t){return e+"/"+t}function Ce(e){return e instanceof Ae||e instanceof Te?e.status:500}function Mt(e){return e instanceof Te?e.text:"Internal Error"}let b,z,be;const Wt=Ke.toString().includes("$$")||/function \w+\(\) \{\}/.test(Ke.toString()),Je="a:";Wt?(b={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(Je)},z={current:null},be={current:!1}):(b=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL(Je));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},z=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},be=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},st.v=()=>be.current=!0);function lt(e){Object.assign(b,e)}const Kt=kt??(e=>e()),Ft=new Set(["icon","shortcut icon","apple-touch-icon"]);let G=null;const N=et(nt)??{},X=et(tt)??{},j={url:He({}),page:He({}),navigating:Le(null),updated:Dt()};function pe(e){N[e]=V()}function ct(e,t){let n=e+1;for(;N[n];)delete N[n],n+=1;for(n=t+1;X[n];)delete X[n],n+=1}function Q(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(C)}async function ut(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(L||"/");e&&await e.update()}}let je,Ee,oe,$,Re,y;const se=[],ie=[];let x=null;function le(){x?.fork?.then(e=>e?.discard()),x=null}const ne=new Map,ft=new Set,Gt=new Set,Y=new Set;let m={branch:[],error:null,url:null},dt=!1,ce=!1,Ye=!0,Z=!1,H=!1,Ne=!1,qe=!1,De,v,E,O;const ue=new Set,ze=new Map,Xe=new Map;async function mn(e,t,n){globalThis.__sveltekit_181g8n8&&(globalThis.__sveltekit_181g8n8.query,globalThis.__sveltekit_181g8n8.prerender),document.URL!==location.href&&(location.href=location.href),y=e,await e.hooks.init?.(),je=jt(e),$=document.documentElement,Re=t,Ee=e.nodes[0],oe=e.nodes[1],Ee(),oe(),v=history.state?.[D],E=history.state?.[W],v||(v=E=Date.now(),history.replaceState({...history.state,[D]:v,[W]:E},""));const r=N[v];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await sn(Re,n)):(await M({type:"enter",url:Oe(y.hash?un(new URL(location.href)):location.href),replace_state:!0}),a()),on()}function Ht(){se.length=0,qe=!1}function ht(e){ie.some(t=>t?.snapshot)&&(X[e]=ie.map(t=>t?.snapshot?.capture()))}function pt(e){X[e]?.forEach((t,n)=>{ie[n]?.snapshot?.restore(t)})}function Qe(){pe(v),Fe(nt,N),ht(E),Fe(tt,X)}async function Jt(e,t,n,r){let a,i;t.invalidateAll&&le(),await M({type:"goto",url:Oe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{if(t.invalidateAll){qe=!0,a=new Set;for(const[o,s]of ze)for(const l of s.keys())a.add(te(o,l));i=new Set;for(const[o,s]of Xe)for(const l of s.keys())i.add(te(o,l))}t.invalidate&&t.invalidate.forEach(an)}}),t.invalidateAll&&re().then(re).then(()=>{for(const[o,s]of ze)for(const[l,{resource:c}]of s)a?.has(te(o,l))&&c.refresh();for(const[o,s]of Xe)for(const[l,{resource:c}]of s)i?.has(te(o,l))&&c.reconnect()})}async function Yt(e){if(e.id!==x?.id){le();const t={};ue.add(t),x={id:e.id,token:t,promise:_t({...e,preload:t}).then(n=>(ue.delete(t),n.type==="loaded"&&n.state.error&&le(),n)),fork:null}}return x.promise}async function ke(e){const t=(await ge(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function gt(e,t,n){const r={params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)};m={...e.state,nav:r};const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),lt(e.props.page),De=new y.root({target:t,props:{...e.props,stores:j,components:ie},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),pt(E),n){const i={from:null,to:{...r,scroll:N[v]??V()},willUnload:!1,type:"enter",complete:Promise.resolve()};Y.forEach(o=>o(i))}ce=!0}async function fe({url:e,params:t,branch:n,errors:r,status:a,error:i,route:o,form:s}){let l="never";if(L&&(e.pathname===L||e.pathname===L+"/"))l="always";else for(const u of n)u?.slash!==void 0&&(l=u.slash);e.pathname=St(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:i,route:o},props:{constructors:Bt(n).map(u=>u.node.component),page:_e(b)}};s!==void 0&&(c.props.form=s);let f={},p=!b,w=0;for(let u=0;u<Math.max(n.length,m.branch.length);u+=1){const _=n[u],g=m.branch[u];_?.data!==g?.data&&(p=!0),_&&(f={...f,..._.data},p&&(c.props[`data_${w}`]=f),w+=1)}return(!m.url||e.href!==m.url.href||m.error!==i||s!==void 0&&s!==b.form||p)&&(c.props.page={error:i,params:t,route:{id:o?.id??null},state:{},status:a,url:new URL(e),form:s??null,data:p?f:b.data}),c}async function Ve({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let o=null;const s={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:i,universal:l.universal?.load?{type:"data",data:o,uses:s}:null,data:o??i?.data??null,slash:l.universal?.trailingSlash??i?.slash}}function zt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=ce?Tt(r,a.href,t):Ut(r,t);return{resolved:a,promise:i}}function Xt(e,t,n,r,a,i){if(qe)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const o of a.search_params)if(r.has(o))return!0;for(const o of a.params)if(i[o]!==m.params[o])return!0;for(const o of a.dependencies)if(se.some(s=>s(new URL(o))))return!0;return!1}function Be(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Qt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(o=>i.includes(o))&&i.every(o=>a.includes(o))&&n.delete(r)}return n}function Zt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:_e(b),constructors:[]}}}async function _t({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(x?.id===e)return ue.delete(x.token),x.promise;const{errors:o,layouts:s,leaf:l}=a,c=[...s,l];o.forEach(g=>g?.().catch(C)),c.forEach(g=>g?.[1]().catch(C));const f=m.url?e!==de(m.url):!1,p=m.route?a.id!==m.route.id:!1,w=Qt(m.url,n);let d=!1;const u=c.map(async(g,h)=>{if(!g)return;const k=m.branch[h];return g[1]===k?.loader&&!Xt(d,p,f,w,k.universal?.uses,r)?k:(d=!0,Ve({loader:g[1],url:n,params:r,route:a,parent:async()=>{const I={};for(let P=0;P<h;P+=1)Object.assign(I,(await u[P])?.data);return I},server_data_node:Be(g[0]?{type:"skip"}:null,g[0]?k?.server:void 0)}))});for(const g of u)g.catch(C);const _=[];for(let g=0;g<c.length;g+=1)if(c[g])try{_.push(await u[g])}catch(h){if(h instanceof Ue)return{type:"redirect",location:h.location};if(ue.has(i))return Zt({error:await ee(h,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let k=Ce(h),R;if(h instanceof Ae)R=h.body;else{if(await j.updated.check())return await ut(),await Q(n);R=await ee(h,{params:r,url:n,route:{id:a.id}})}const I=await en(g,_,o);return I?fe({url:n,params:r,branch:_.slice(0,I.idx).concat(I.node),errors:o,status:k,error:R,route:a}):await wt(n,{id:a.id},R,k)}else _.push(void 0);return fe({url:n,params:r,branch:_,errors:o,status:200,error:null,route:a,form:t?void 0:null})}async function en(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Me({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const o=await Ve({loader:Ee,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Be(i)}),s={node:await oe(),loader:oe,universal:null,server:null,data:null};return fe({url:n,params:a,branch:[o,s],status:e,error:t,errors:[],route:null})}catch(o){if(o instanceof Ue)return Jt(new URL(o.location,location.href),{},0);throw o}}async function tn(e){const t=e.href;if(ne.has(t))return ne.get(t);let n;try{const r=(async()=>{let a=await y.hooks.reroute({url:new URL(e),fetch:async(i,o)=>zt(i,o,e).promise})??e;if(typeof a=="string"){const i=new URL(e);y.hash?i.hash=a:i.pathname=a,a=i}return a})();ne.set(t,r),n=await r}catch{ne.delete(t);return}return n}async function ge(e,t){if(e&&!he(e,L,y.hash)){const n=await tn(e);if(!n)return;const r=nn(n);for(const a of je){const i=a.exec(r);if(i)return{id:de(e),invalidating:t,route:a,params:Rt(i),url:e}}}}function nn(e){return Et(y.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(L.length))||"/"}function de(e){return(y.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function mt({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let o=!1;const s=We(m,n,e,t,i??null);r!==void 0&&(s.navigation.delta=r),a!==void 0&&(s.navigation.event=a);const l={...s.navigation,cancel:()=>{o=!0,s.reject(new Error("navigation cancelled"))}};return Z||ft.forEach(c=>c(l)),o?null:s}async function M({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:o={},redirect_count:s=0,nav_token:l={},accept:c=C,block:f=C,event:p}){const w=O;O=l;const d=await ge(t,!1),u=e==="enter"?We(m,d,t,e):mt({url:t,type:e,delta:n?.delta,intent:d,scroll:n?.scroll,event:p});if(!u){f(),O===l&&(O=w);return}const _=v,g=E;c(),Z=!0,ce&&u.navigation.type!=="enter"&&j.navigating.set(z.current=u.navigation);let h=d&&await _t(d);if(!h){if(he(t,L,y.hash))return await Q(t,i);h=await wt(t,{id:null},await ee(new Te(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=d?.url||t,O!==l)return u.reject(new Error("navigation aborted")),!1;if(h.type==="redirect"){if(s<20){await M({type:e,url:new URL(h.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:o,redirect_count:s+1,nav_token:l}),u.fulfil(void 0);return}h=await Me({status:500,error:await ee(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else h.props.page.status>=400&&await j.updated.check()&&(await ut(),await Q(t,i));if(Ht(),pe(_),ht(g),h.props.page.url.pathname!==t.pathname&&(t.pathname=h.props.page.url.pathname),o=n?n.state:o,!n){const S=i?0:1,K={[D]:v+=S,[W]:E+=S,[Ie]:o};(i?history.replaceState:history.pushState).call(history,K,"",t),i||ct(v,E)}const k=d&&x?.id===d.id?x.fork:null;x?.fork&&!k&&le(),x=null,h.props.page.state=o;let R;if(ce){const S=(await Promise.all(Array.from(Gt,F=>F(u.navigation)))).filter(F=>typeof F=="function");if(S.length>0){let F=function(){S.forEach(we=>{Y.delete(we)})};S.push(F),S.forEach(we=>{Y.add(we)})}const K=u.navigation.to;m={...h.state,nav:{params:K.params,route:K.route,url:K.url}},h.props.page&&(h.props.page.url=t);const me=k&&await k;me?R=me.commit():(G=null,De.$set(h.props),G&&Object.assign(h.props.page,G),lt(h.props.page),R=bt?.()),Ne=!0}else await gt(h,Re,!1);const{activeElement:I}=document;if(await R,await re(),await re(),O!==l)return u.reject(new Error("navigation aborted")),!1;h.props.page&&G&&Object.assign(h.props.page,G);let P=null;if(Ye){const S=n?n.scroll:a?V():null;S?scrollTo(S.x,S.y):(P=t.hash&&document.getElementById(vt(t)))?P.scrollIntoView():scrollTo(0,0)}const yt=document.activeElement!==I&&document.activeElement!==document.body;!r&&!yt&&cn(t,!P),Ye=!0,Z=!1,e==="popstate"&&pt(E),u.fulfil(void 0),u.navigation.to&&(u.navigation.to.scroll=V()),Y.forEach(S=>S(u.navigation)),j.navigating.set(z.current=null)}async function wt(e,t,n,r,a){return e.origin===Pe&&e.pathname===location.pathname&&!dt?await Me({status:r,error:n,url:e,route:t}):await Q(e,a)}function rn(){let e,t={element:void 0,href:void 0},n;$.addEventListener("mousemove",s=>{const l=s.target;clearTimeout(e),e=setTimeout(()=>{i(l,q.hover)},20)});function r(s){s.defaultPrevented||i(s.composedPath()[0],q.tap)}$.addEventListener("mousedown",r),$.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(s=>{for(const l of s)l.isIntersecting&&(ke(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(s,l){const c=ot(s,$),f=c===t.element&&c?.href===t.href&&l>=n;if(!c||f)return;const{url:p,external:w,download:d}=Se(c,L,y.hash);if(w||d)return;const u=ae(c),_=p&&de(m.url)===de(p);if(!(u.reload||_))if(l<=u.preload_data){t={element:c,href:c.href},n=q.tap;const g=await ge(p,!1);if(!g)return;Yt(g)}else l<=u.preload_code&&(t={element:c,href:c.href},n=l,ke(p))}function o(){a.disconnect();for(const s of $.querySelectorAll("a")){const{url:l,external:c,download:f}=Se(s,L,y.hash);if(c||f)continue;const p=ae(s);p.reload||(p.preload_code===q.viewport&&a.observe(s),p.preload_code===q.eager&&ke(l))}}Y.add(o),o()}function ee(e,t){if(e instanceof Ae)return e.body;const n=Ce(e),r=Mt(e);return y.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function an(e){if(typeof e=="function")se.push(e);else{const{href:t}=new URL(e,location.href);se.push(n=>n.href===t)}}function wn(e,t){pe(v);const n={[D]:v+=1,[W]:E,[rt]:b.url.href,[Ie]:t};history.pushState(n,"",Oe(e)),Ne=!0,b.state=t,De.$set({page:Kt(()=>_e(b))}),ct(v,E)}function on(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Qe(),!Z){const r=We(m,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};ft.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Qe()}),navigator.connection?.saveData||rn(),$.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=ot(t.composedPath()[0],$);if(!n)return;const{url:r,external:a,target:i,download:o}=Se(n,L,y.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const s=ae(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||o)return;const[c,f]=(y.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===ve(location);if(a||s.reload&&(!p||!f)){mt({url:r,type:"link",event:t})?Z=!0:t.preventDefault();return}if(f!==void 0&&p){const[,w]=m.url.href.split("#");if(w===f){if(t.preventDefault(),f===""||f==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const d=n.ownerDocument.getElementById(decodeURIComponent(f));d&&(d.scrollIntoView(),d.focus())}return}if(H=!0,pe(v),e(r),!s.replace_state)return;H=!1}t.preventDefault(),await new Promise(w=>{requestAnimationFrame(()=>{setTimeout(w,0)}),setTimeout(w,100)}),await M({type:"link",url:r,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??r.href===location.href,event:t})}),$.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const o=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(he(o,L,!1))return;const s=t.target,l=ae(s);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(s,r);o.search=new URLSearchParams(c).toString(),M({type:"form",url:o,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??o.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!xe){if(t.state?.[D]){const n=t.state[D];if(O={},n===v)return;const r=N[n],a=t.state[Ie]??{},i=new URL(t.state[rt]??location.href),o=t.state[W],s=m.url?ve(location)===ve(m.url):!1;if(o===E&&(Ne||s)){a!==b.state&&(b.state=a),e(i),N[v]=V(),r&&scrollTo(r.x,r.y),v=n;return}const c=n-v;await M({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{v=n,E=o},block:()=>{history.go(-c)},nav_token:O,event:t})}else if(!H){const n=new URL(location.href);e(n),y.hash&&location.reload()}}}),addEventListener("hashchange",()=>{H&&(H=!1,history.replaceState({...history.state,[D]:++v,[W]:E},"",location.href))});for(const t of document.querySelectorAll("link"))Ft.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&j.navigating.set(z.current=null)});function e(t){m.url=b.url=t,j.page.set(_e(b)),j.page.notify()}}async function sn(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:o,data:s,form:l}){dt=!0;const c=new URL(location.href);let f;({params:a={},route:i={id:null}}=await ge(c,!1)||{}),f=je.find(({id:d})=>d===i.id);let p,w=!0;try{const d=r.map(async(_,g)=>{const h=s[g];return h?.uses&&(h.uses=ln(h.uses)),Ve({loader:y.nodes[_],url:c,params:a,route:i,parent:async()=>{const k={};for(let R=0;R<g;R+=1)Object.assign(k,(await d[R]).data);return k},server_data_node:Be(h)})}),u=await Promise.all(d);if(f){const _=f.layouts;for(let g=0;g<_.length;g++)_[g]||u.splice(g,0,void 0)}p=await fe({url:c,params:a,branch:u,status:t,error:n,errors:f?.errors,form:l,route:f??null})}catch(d){if(d instanceof Ue){await Q(new URL(d.location,location.href));return}p=await Me({status:Ce(d),error:await ee(d,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",w=!1}p.props.page&&(p.props.page.state={}),await gt(p,e,w)}function ln(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let xe=!1;function cn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=vt(e);if(r&&document.getElementById(r)){const{x:i,y:o}=V();setTimeout(()=>{const s=history.state;xe=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(s,"",e),t&&scrollTo(i,o),xe=!1})}else{const i=document.body,o=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),o!==null?i.setAttribute("tabindex",o):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let o=0;o<a.rangeCount;o+=1)i.push(a.getRangeAt(o));setTimeout(()=>{if(a.rangeCount===i.length){for(let o=0;o<a.rangeCount;o+=1){const s=i[o],l=a.getRangeAt(o);if(s.commonAncestorContainer!==l.commonAncestorContainer||s.startContainer!==l.startContainer||s.endContainer!==l.endContainer||s.startOffset!==l.startOffset||s.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function We(e,t,n,r,a=null){let i,o;const s=new Promise((c,f)=>{i=c,o=f});return s.catch(C),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:V()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:s},fulfil:i,reject:o}}function _e(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function un(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function vt(e){let t;if(y.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{wn as a,L as b,j as c,hn as l,b as p,dn as r,mn as s,qt as v};
|
|
2
|
+
//# sourceMappingURL=C802ERXP.js.map
|