@aopslabs/aops-server 0.2.10 → 0.2.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/THIRD_PARTY_NOTICES +77 -152
- package/THIRD_PARTY_NOTICES.inventory.json +202 -53
- package/build/client/_app/immutable/chunks/qRIvhaXj.js +1 -0
- package/build/client/_app/immutable/entry/{app.wWpgS-lj.js → app.tVDNflbN.js} +2 -2
- package/build/client/_app/immutable/entry/start.DLye8RM1.js +1 -0
- package/build/client/_app/immutable/nodes/{1.ClIe_uwH.js → 1.DlD7dcNg.js} +1 -1
- package/build/client/_app/version.json +1 -1
- package/build/handler.js +10 -3
- package/build/index.js +10 -3
- package/build/server/chunks/{agent-gateway-runtime-D6-UoKQA.js → chunks/agent-gateway-runtime.js-De6jvAjX.js} +11 -18
- package/build/server/chunks/{discovery-BaEpDyWT.js → chunks/discovery.js-CZjXJ_ZV.js} +3 -3
- package/build/server/chunks/chunks/exports.js-BoBrqMaZ.js +215 -0
- package/build/server/chunks/chunks/internal.js-BAGgMnGJ.js +126 -0
- package/build/server/chunks/chunks/json-request-body.js-ewKk-XAX.js +18 -0
- package/build/server/chunks/{registry-3GWqIriK.js → chunks/registry.js-DdOAgkkf.js} +6 -6
- package/build/server/chunks/{request-context-9wzBoKrz.js → chunks/request-context.js-Y9Hk40z6.js} +3 -3
- package/build/server/chunks/chunks/root.js-Di8SnzYO.js +4187 -0
- package/build/server/chunks/chunks/server.js-Bf8x1V_n.js +15 -0
- package/build/server/chunks/chunks/uneval.js-BnYgIxRU.js +521 -0
- package/build/server/chunks/chunks/utils.js-DjaWGEhn.js +1623 -0
- package/build/server/chunks/chunks/utils2.js-BQzn9ikS.js +37 -0
- package/build/server/chunks/{_server.ts-WWdSLatP.js → entries/endpoints/api/_domain_/_...path_/_server.ts.js-C5pGdb58.js} +9 -7
- package/build/server/chunks/{_server.ts-5PfufGhQ.js → entries/endpoints/api/_server.ts.js-sSJl5nE9.js} +3 -1
- package/build/server/chunks/{_server.ts-CCrjMhLK.js → entries/endpoints/api/agent/discovery.json/_server.ts.js-DBhJ_-B2.js} +10 -8
- package/build/server/chunks/{_server.ts-BXCdUW6X.js → entries/endpoints/api/agent/openapi.json/_server.ts.js-DfvqJ5cj.js} +9 -7
- package/build/server/chunks/{_server.ts-ClvARLzg.js → entries/endpoints/api/agent/tools/_server.ts.js-DZKcGR3W.js} +10 -8
- package/build/server/chunks/{_server.ts-Dy3zDemo.js → entries/endpoints/api/agent/tools/_toolId_/_server.ts.js-B5urFDtl.js} +10 -8
- package/build/server/chunks/{_server.ts-C6tCqRgY.js → entries/endpoints/api/agent/tools/_toolId_/invoke/_server.ts.js-BAvkC5Rt.js} +21 -19
- package/build/server/chunks/{_server.ts-BJ4evpqP.js → entries/endpoints/api/aops/docman/flows/_server.ts.js-C0Y7KGXm.js} +13 -14
- package/build/server/chunks/{_server.ts-CGIpzS6K.js → entries/endpoints/api/aops/projectman/flows/_server.ts.js-JYO0h_yB.js} +13 -14
- package/build/server/chunks/{_server.ts-CNd_VT19.js → entries/endpoints/api/aops/settings/database/status/_server.ts.js-Owz6c-s3.js} +5 -3
- package/build/server/chunks/{_server.ts-7-tcIJf2.js → entries/endpoints/api/auth/me/_server.ts.js-CSjwLMYe.js} +4 -2
- package/build/server/chunks/{_server.ts-DCkBCaJM.js → entries/endpoints/api/health/_server.ts.js-CqZW_cm6.js} +6 -4
- package/build/server/chunks/entries/endpoints/api/hello/_server.ts.js-CF4gShRZ.js +11 -0
- package/build/server/chunks/{_server.ts-C7O3p1BG.js → entries/endpoints/api/host-admin/plugins/_server.ts.js-BjoRl46U.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/host-admin/runtime-config/_server.ts.js-BbVXEK2o.js +12 -0
- package/build/server/chunks/{_server.ts-CuifGJTF.js → entries/endpoints/api/host-admin/runtime-config/test/_server.ts.js-4KY0tKLf.js} +5 -3
- package/build/server/chunks/{_server.ts-BzHZDsLU.js → entries/endpoints/api-info.json/_server.ts.js-BjF2mgkA.js} +10 -8
- package/build/server/chunks/{_server.ts-AJ0imKUc.js → entries/endpoints/openapi.json/_server.ts.js-DGXyC49p.js} +9 -7
- package/build/server/chunks/{error.svelte-B5_Vjwmk.js → entries/fallbacks/error.svelte.js-D7yKTuER.js} +5 -1
- package/build/server/chunks/{hooks.server-B8q2QwIQ.js → entries/hooks.server.js-0eTKxvgl.js} +4 -2
- package/build/server/chunks/{handler-BsClyvu7.js → handler-WdL1KixW.js} +3 -2
- package/build/server/chunks/index.js-DOzENJRR.js +4103 -0
- package/build/server/chunks/{manifest.js-zg9yAX8Y.js → manifest.js-Dzrd5JLV.js} +24 -24
- package/build/server/chunks/{1-CCFGO3E8.js → nodes/1.js-JEOiX_Dx.js} +2 -2
- package/host.config.json +2 -2
- package/npm-shrinkwrap.json +80 -94
- package/package.json +16 -18
- package/runtime/agentspace-host-adapter.mjs +19 -5
- package/runtime/agentspace-tooling.mjs +23 -23
- package/runtime/docman-host-adapter.mjs +33 -3
- package/runtime/docman-policy.mjs +1 -0
- package/runtime/projectman-host-adapter.mjs +26 -0
- package/runtime-closure.package.json +30 -32
- package/build/client/_app/immutable/chunks/DOP91BI2.js +0 -1
- package/build/client/_app/immutable/entry/start.B6IoXHM8.js +0 -1
- package/build/server/chunks/_server.ts-CHX_s-fT.js +0 -9
- package/build/server/chunks/_server.ts-DGOwt3F3.js +0 -10
- package/build/server/chunks/index.js--6zD1xCG.js +0 -10803
- /package/build/server/chunks/{aops-runtime-config-CHpDUCdE.js → chunks/aops-runtime-config.js-CHpDUCdE.js} +0 -0
- /package/build/server/chunks/{auth-provider-C07OUlnz.js → chunks/auth-provider.js-C07OUlnz.js} +0 -0
- /package/build/server/chunks/{commercial-admission-loader-ZGZHRPLe.js → chunks/commercial-admission-loader.js-ZGZHRPLe.js} +0 -0
- /package/build/server/chunks/{plugin-error-normalize-DNeRsopQ.js → chunks/plugin-error-normalize.js-DNeRsopQ.js} +0 -0
- /package/build/server/chunks/{project-alias-BdnRxWft.js → chunks/project-alias.js-BdnRxWft.js} +0 -0
- /package/build/server/chunks/{request-base-url-zKJpVUv5.js → chunks/request-base-url.js-zKJpVUv5.js} +0 -0
- /package/build/server/chunks/{xf-result-BRDjvftr.js → chunks/xf-result.js-BRDjvftr.js} +0 -0
- /package/build/server/chunks/{_server.ts-Bly8fCZa.js → entries/endpoints/_server.ts.js-Bly8fCZa.js} +0 -0
- /package/build/server/chunks/{_server.ts-DbdAfdYo.js → entries/endpoints/api/chatv3/v1/rooms/_roomId_/stream/_server.ts.js-DbdAfdYo.js} +0 -0
- /package/build/server/chunks/{_server.ts-Cv-yaXZI.js → entries/endpoints/api-info/_server.ts.js-Cv-yaXZI.js} +0 -0
- /package/build/server/chunks/{0-RfB6m2nq.js → nodes/0.js-RfB6m2nq.js} +0 -0
|
@@ -0,0 +1,1623 @@
|
|
|
1
|
+
import { b as base64_decode } from './utils2.js-BQzn9ikS.js';
|
|
2
|
+
import { u as uneval, U as UNDEFINED, N as NAN, P as POSITIVE_INFINITY, a as NEGATIVE_INFINITY, b as NEGATIVE_ZERO, S as SPARSE, i as is_valid_array_len, c as is_valid_array_index, H as HOLE, D as DevalueError, s as stringify_key, d as stringify_string, M as MAX_ARRAY_INDEX, e as is_plain_object, f as enumerable_symbols, v as valid_array_indices, g as get_type } from './uneval.js-BnYgIxRU.js';
|
|
3
|
+
|
|
4
|
+
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
|
|
5
|
+
|
|
6
|
+
class HttpError {
|
|
7
|
+
/**
|
|
8
|
+
* @param {number} status
|
|
9
|
+
* @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body
|
|
10
|
+
*/
|
|
11
|
+
constructor(status, body) {
|
|
12
|
+
this.status = status;
|
|
13
|
+
if (typeof body === 'string') {
|
|
14
|
+
this.body = { message: body };
|
|
15
|
+
} else if (body) {
|
|
16
|
+
this.body = body;
|
|
17
|
+
} else {
|
|
18
|
+
this.body = { message: `Error: ${status}` };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toString() {
|
|
23
|
+
return JSON.stringify(this.body);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class Redirect {
|
|
28
|
+
/**
|
|
29
|
+
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status
|
|
30
|
+
* @param {string} location
|
|
31
|
+
*/
|
|
32
|
+
constructor(status, location) {
|
|
33
|
+
try {
|
|
34
|
+
new Headers({ location });
|
|
35
|
+
} catch {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Invalid redirect location ${JSON.stringify(location)}: ` +
|
|
38
|
+
'this string contains characters that cannot be used in HTTP headers'
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.status = status;
|
|
43
|
+
this.location = location;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404.
|
|
49
|
+
* `SvelteKitError` goes through `handleError`.
|
|
50
|
+
* @extends Error
|
|
51
|
+
*/
|
|
52
|
+
class SvelteKitError extends Error {
|
|
53
|
+
/**
|
|
54
|
+
* @param {number} status
|
|
55
|
+
* @param {string} text
|
|
56
|
+
* @param {string} message
|
|
57
|
+
*/
|
|
58
|
+
constructor(status, text, message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.status = status;
|
|
61
|
+
this.text = text;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @template [T=undefined]
|
|
67
|
+
*/
|
|
68
|
+
class ActionFailure {
|
|
69
|
+
/**
|
|
70
|
+
* @param {number} status
|
|
71
|
+
* @param {T} data
|
|
72
|
+
*/
|
|
73
|
+
constructor(status, data) {
|
|
74
|
+
this.status = status;
|
|
75
|
+
this.data = data;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const text_encoder = new TextEncoder();
|
|
80
|
+
|
|
81
|
+
/** @import { StandardSchemaV1 } from '@standard-schema/spec' */
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
// TODO 3.0: remove these types as they are not used anymore (we can't remove them yet because that would be a breaking change)
|
|
85
|
+
/**
|
|
86
|
+
* @template {number} TNumber
|
|
87
|
+
* @template {any[]} [TArray=[]]
|
|
88
|
+
* @typedef {TNumber extends TArray['length'] ? TArray[number] : LessThan<TNumber, [...TArray, TArray['length']]>} LessThan
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @template {number} TStart
|
|
93
|
+
* @template {number} TEnd
|
|
94
|
+
* @typedef {Exclude<TEnd | LessThan<TEnd>, LessThan<TStart>>} NumericRange
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
// Keep the status codes as `number` because restricting to certain numbers makes it unnecessarily hard to use compared to the benefits
|
|
98
|
+
// (we have runtime errors already to check for invalid codes). Also see https://github.com/sveltejs/kit/issues/11780
|
|
99
|
+
|
|
100
|
+
// we have to repeat the JSDoc because the display for function overloads is broken
|
|
101
|
+
// see https://github.com/microsoft/TypeScript/issues/55056
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Throws an error with a HTTP status code and an optional message.
|
|
105
|
+
* When called during request handling, this will cause SvelteKit to
|
|
106
|
+
* return an error response without invoking `handleError`.
|
|
107
|
+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
108
|
+
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
109
|
+
* @param {App.Error} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
110
|
+
* @overload
|
|
111
|
+
* @param {number} status
|
|
112
|
+
* @param {App.Error} body
|
|
113
|
+
* @return {never}
|
|
114
|
+
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
115
|
+
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
116
|
+
*/
|
|
117
|
+
/**
|
|
118
|
+
* Throws an error with a HTTP status code and an optional message.
|
|
119
|
+
* When called during request handling, this will cause SvelteKit to
|
|
120
|
+
* return an error response without invoking `handleError`.
|
|
121
|
+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
122
|
+
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
123
|
+
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body] An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
124
|
+
* @overload
|
|
125
|
+
* @param {number} status
|
|
126
|
+
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body]
|
|
127
|
+
* @return {never}
|
|
128
|
+
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
129
|
+
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Throws an error with a HTTP status code and an optional message.
|
|
133
|
+
* When called during request handling, this will cause SvelteKit to
|
|
134
|
+
* return an error response without invoking `handleError`.
|
|
135
|
+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
136
|
+
* @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
137
|
+
* @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
138
|
+
* @return {never}
|
|
139
|
+
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
140
|
+
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
141
|
+
*/
|
|
142
|
+
function error(status, body) {
|
|
143
|
+
if ((isNaN(status) || status < 400 || status > 599)) {
|
|
144
|
+
throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
throw new HttpError(status, body);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Checks whether this is a redirect thrown by {@link redirect}.
|
|
152
|
+
* @param {unknown} e The object to check.
|
|
153
|
+
* @return {e is Redirect}
|
|
154
|
+
*/
|
|
155
|
+
function isRedirect(e) {
|
|
156
|
+
return e instanceof Redirect;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Create a JSON `Response` object from the supplied data.
|
|
161
|
+
* @param {any} data The value that will be serialized as JSON.
|
|
162
|
+
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically.
|
|
163
|
+
*/
|
|
164
|
+
function json(data, init) {
|
|
165
|
+
// TODO deprecate this in favour of `Response.json` when it's
|
|
166
|
+
// more widely supported
|
|
167
|
+
const body = JSON.stringify(data);
|
|
168
|
+
|
|
169
|
+
// we can't just do `text(JSON.stringify(data), init)` because
|
|
170
|
+
// it will set a default `content-type` header. duplicated code
|
|
171
|
+
// means less duplicated work
|
|
172
|
+
const headers = new Headers(init?.headers);
|
|
173
|
+
if (!headers.has('content-length')) {
|
|
174
|
+
headers.set('content-length', text_encoder.encode(body).byteLength.toString());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (!headers.has('content-type')) {
|
|
178
|
+
headers.set('content-type', 'application/json');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return new Response(body, {
|
|
182
|
+
...init,
|
|
183
|
+
headers
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Create a `Response` object from the supplied body.
|
|
189
|
+
* @param {string} body The value that will be used as-is.
|
|
190
|
+
* @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically.
|
|
191
|
+
*/
|
|
192
|
+
function text(body, init) {
|
|
193
|
+
const headers = new Headers(init?.headers);
|
|
194
|
+
if (!headers.has('content-length')) {
|
|
195
|
+
const encoded = text_encoder.encode(body);
|
|
196
|
+
headers.set('content-length', encoded.byteLength.toString());
|
|
197
|
+
return new Response(encoded, {
|
|
198
|
+
...init,
|
|
199
|
+
headers
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return new Response(body, {
|
|
204
|
+
...init,
|
|
205
|
+
headers
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// eslint-disable-next-line n/prefer-global/process
|
|
210
|
+
const IN_WEBCONTAINER = !!globalThis.process?.versions?.webcontainer;
|
|
211
|
+
|
|
212
|
+
/** @import { RequestEvent } from '@sveltejs/kit' */
|
|
213
|
+
/** @import { RequestStore } from 'types' */
|
|
214
|
+
/** @import { AsyncLocalStorage } from 'node:async_hooks' */
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
/** @type {RequestStore | null} */
|
|
218
|
+
let sync_store = null;
|
|
219
|
+
|
|
220
|
+
/** @type {AsyncLocalStorage<RequestStore | null> | null} */
|
|
221
|
+
let als;
|
|
222
|
+
|
|
223
|
+
import('node:async_hooks')
|
|
224
|
+
.then((hooks) => (als = new hooks.AsyncLocalStorage()))
|
|
225
|
+
.catch(() => {
|
|
226
|
+
// can't use AsyncLocalStorage, but can still call getRequestEvent synchronously.
|
|
227
|
+
// this isn't behind `supports` because it's basically just StackBlitz (i.e.
|
|
228
|
+
// in-browser usage) that doesn't support it AFAICT
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @template T
|
|
233
|
+
* @param {RequestStore | null} store
|
|
234
|
+
* @param {() => T} fn
|
|
235
|
+
*/
|
|
236
|
+
function with_request_store(store, fn) {
|
|
237
|
+
try {
|
|
238
|
+
sync_store = store;
|
|
239
|
+
return als ? als.run(store, fn) : fn();
|
|
240
|
+
} finally {
|
|
241
|
+
// Since AsyncLocalStorage is not working in webcontainers, we don't reset `sync_store`
|
|
242
|
+
// and handle only one request at a time in `src/runtime/server/index.js`.
|
|
243
|
+
if (!IN_WEBCONTAINER) {
|
|
244
|
+
sync_store = null;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @template {{ tracing: { enabled: boolean, root: import('@opentelemetry/api').Span, current: import('@opentelemetry/api').Span } }} T
|
|
251
|
+
* @param {T} event_like
|
|
252
|
+
* @param {import('@opentelemetry/api').Span} current
|
|
253
|
+
* @returns {T}
|
|
254
|
+
*/
|
|
255
|
+
function merge_tracing(event_like, current) {
|
|
256
|
+
return {
|
|
257
|
+
...event_like,
|
|
258
|
+
tracing: {
|
|
259
|
+
...event_like.tracing,
|
|
260
|
+
current
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function encode_native(array_buffer) {
|
|
266
|
+
return new Uint8Array(array_buffer).toBase64();
|
|
267
|
+
}
|
|
268
|
+
function decode_native(base64) {
|
|
269
|
+
return Uint8Array.fromBase64(base64).buffer;
|
|
270
|
+
}
|
|
271
|
+
function encode_buffer(array_buffer) {
|
|
272
|
+
return Buffer.from(array_buffer).toString("base64");
|
|
273
|
+
}
|
|
274
|
+
function decode_buffer(base64) {
|
|
275
|
+
return Uint8Array.from(Buffer.from(base64, "base64")).buffer;
|
|
276
|
+
}
|
|
277
|
+
function encode_legacy(array_buffer) {
|
|
278
|
+
const array = new Uint8Array(array_buffer);
|
|
279
|
+
let binary = "";
|
|
280
|
+
const chunk_size = 32768;
|
|
281
|
+
for (let i = 0; i < array.length; i += chunk_size) {
|
|
282
|
+
const chunk = array.subarray(i, i + chunk_size);
|
|
283
|
+
binary += String.fromCharCode.apply(null, chunk);
|
|
284
|
+
}
|
|
285
|
+
return btoa(binary);
|
|
286
|
+
}
|
|
287
|
+
function decode_legacy(base64) {
|
|
288
|
+
const binary_string = atob(base64);
|
|
289
|
+
const len = binary_string.length;
|
|
290
|
+
const array = new Uint8Array(len);
|
|
291
|
+
for (let i = 0; i < len; i++) {
|
|
292
|
+
array[i] = binary_string.charCodeAt(i);
|
|
293
|
+
}
|
|
294
|
+
return array.buffer;
|
|
295
|
+
}
|
|
296
|
+
const native = typeof Uint8Array.fromBase64 === "function";
|
|
297
|
+
const buffer = typeof process === "object" && process.versions?.node !== void 0;
|
|
298
|
+
const encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
|
|
299
|
+
const decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
|
|
300
|
+
function merge_operations(defaults, overrides) {
|
|
301
|
+
return defaults;
|
|
302
|
+
}
|
|
303
|
+
const NOT_PLAIN = Object.freeze({ kind: "not-plain" });
|
|
304
|
+
const SYMBOL_KEYS = Object.freeze({ kind: "symbol-keys" });
|
|
305
|
+
const stringify_operations = {
|
|
306
|
+
identify: (value) => value,
|
|
307
|
+
typeOf: (value) => value === null ? "null" : typeof value,
|
|
308
|
+
toPrimitive: (value) => value,
|
|
309
|
+
tagOf: (value) => get_type(value),
|
|
310
|
+
isThenable: (value) => typeof value.then === "function",
|
|
311
|
+
toPromise: (thenable) => Promise.resolve(thenable),
|
|
312
|
+
unbox: (boxed) => boxed.valueOf(),
|
|
313
|
+
toISOString: (date) => isNaN(date.getDate()) ? "" : date.toISOString(),
|
|
314
|
+
toStringValue: (value) => value.toString(),
|
|
315
|
+
regExpInfo: (regexp) => ({ source: regexp.source, flags: regexp.flags }),
|
|
316
|
+
valuesOf: (set) => set,
|
|
317
|
+
entriesOf: (map) => map,
|
|
318
|
+
viewInfo: (view) => ({
|
|
319
|
+
buffer: view.buffer,
|
|
320
|
+
byteOffset: view.byteOffset,
|
|
321
|
+
byteLength: view.byteLength,
|
|
322
|
+
length: view.length,
|
|
323
|
+
bufferByteLength: view.buffer.byteLength
|
|
324
|
+
}),
|
|
325
|
+
toArrayBuffer: (buffer2) => buffer2,
|
|
326
|
+
lengthOf: (array) => array.length,
|
|
327
|
+
hasOwn: (value, key) => Object.hasOwn(value, key),
|
|
328
|
+
indicesOf: (array) => valid_array_indices(array),
|
|
329
|
+
shapeOf: (value) => {
|
|
330
|
+
if (!is_plain_object(value)) return NOT_PLAIN;
|
|
331
|
+
if (enumerable_symbols(value).length > 0) return SYMBOL_KEYS;
|
|
332
|
+
return {
|
|
333
|
+
kind: Object.getPrototypeOf(value) === null ? "null-proto" : "plain",
|
|
334
|
+
keys: Object.keys(value)
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
get: (value, key) => value[key]
|
|
338
|
+
};
|
|
339
|
+
const default_stringify_operations = Object.freeze(stringify_operations);
|
|
340
|
+
const parse_operations = {
|
|
341
|
+
fromPrimitive: (primitive) => primitive,
|
|
342
|
+
fromISOString: (iso) => new Date(iso),
|
|
343
|
+
fromStringValue: (tag, text2) => {
|
|
344
|
+
if (tag === "URL") return new URL(text2);
|
|
345
|
+
if (tag === "URLSearchParams") return new URLSearchParams(text2);
|
|
346
|
+
return Temporal[tag.slice(9)].from(text2);
|
|
347
|
+
},
|
|
348
|
+
fromArrayBuffer: (buffer2) => buffer2,
|
|
349
|
+
fromRegExpInfo: (source, flags) => new RegExp(source, flags),
|
|
350
|
+
fromViewInfo: (tag, buffer2, byteOffset, length) => {
|
|
351
|
+
const Constructor = (
|
|
352
|
+
/** @type {any} */
|
|
353
|
+
globalThis[tag]
|
|
354
|
+
);
|
|
355
|
+
return byteOffset !== void 0 ? new Constructor(buffer2, byteOffset, length) : new Constructor(buffer2);
|
|
356
|
+
},
|
|
357
|
+
box: (value) => Object(value),
|
|
358
|
+
createArray: (length) => new Array(length),
|
|
359
|
+
createSparseArray: (length) => {
|
|
360
|
+
const array = [];
|
|
361
|
+
array[MAX_ARRAY_INDEX] = void 0;
|
|
362
|
+
delete array[MAX_ARRAY_INDEX];
|
|
363
|
+
array.length = length;
|
|
364
|
+
return array;
|
|
365
|
+
},
|
|
366
|
+
createObject: () => ({}),
|
|
367
|
+
createNullPrototypeObject: () => /* @__PURE__ */ Object.create(null),
|
|
368
|
+
createSet: () => /* @__PURE__ */ new Set(),
|
|
369
|
+
createMap: () => /* @__PURE__ */ new Map(),
|
|
370
|
+
set: (target, key, value) => {
|
|
371
|
+
target[key] = value;
|
|
372
|
+
},
|
|
373
|
+
addValue: (set, value) => {
|
|
374
|
+
set.add(value);
|
|
375
|
+
},
|
|
376
|
+
addEntry: (map, key, value) => {
|
|
377
|
+
map.set(key, value);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
const default_parse_operations = Object.freeze(parse_operations);
|
|
381
|
+
function parse(serialized, revivers, options) {
|
|
382
|
+
return unflatten(JSON.parse(serialized), revivers);
|
|
383
|
+
}
|
|
384
|
+
function unflatten(parsed, revivers, options) {
|
|
385
|
+
const ops = merge_operations(default_parse_operations);
|
|
386
|
+
if (typeof parsed === "number") return hydrate(parsed, true);
|
|
387
|
+
if (!Array.isArray(parsed) || parsed.length === 0) {
|
|
388
|
+
throw new Error("Invalid input");
|
|
389
|
+
}
|
|
390
|
+
const values = (
|
|
391
|
+
/** @type {any[]} */
|
|
392
|
+
parsed
|
|
393
|
+
);
|
|
394
|
+
const hydrated = Array(values.length);
|
|
395
|
+
let hydrating = null;
|
|
396
|
+
function hydrate(index, standalone = false) {
|
|
397
|
+
if (index === UNDEFINED) return ops.fromPrimitive(void 0);
|
|
398
|
+
if (index === NAN) return ops.fromPrimitive(NaN);
|
|
399
|
+
if (index === POSITIVE_INFINITY) return ops.fromPrimitive(Infinity);
|
|
400
|
+
if (index === NEGATIVE_INFINITY) return ops.fromPrimitive(-Infinity);
|
|
401
|
+
if (index === NEGATIVE_ZERO) return ops.fromPrimitive(-0);
|
|
402
|
+
if (standalone || typeof index !== "number") {
|
|
403
|
+
throw new Error(`Invalid input`);
|
|
404
|
+
}
|
|
405
|
+
if (index in hydrated) return hydrated[index];
|
|
406
|
+
const value = values[index];
|
|
407
|
+
if (!value || typeof value !== "object") {
|
|
408
|
+
hydrated[index] = ops.fromPrimitive(value);
|
|
409
|
+
} else if (Array.isArray(value)) {
|
|
410
|
+
if (typeof value[0] === "string") {
|
|
411
|
+
const type = value[0];
|
|
412
|
+
const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : void 0;
|
|
413
|
+
if (reviver) {
|
|
414
|
+
let i = value[1];
|
|
415
|
+
if (typeof i !== "number") {
|
|
416
|
+
i = values.push(value[1]) - 1;
|
|
417
|
+
}
|
|
418
|
+
if (Object.hasOwn(hydrated, i)) {
|
|
419
|
+
return hydrated[index] = reviver(hydrated[i]);
|
|
420
|
+
}
|
|
421
|
+
hydrating ??= /* @__PURE__ */ new Set();
|
|
422
|
+
if (hydrating.has(i)) {
|
|
423
|
+
throw new Error("Invalid circular reference");
|
|
424
|
+
}
|
|
425
|
+
hydrating.add(i);
|
|
426
|
+
hydrated[index] = reviver(hydrate(i));
|
|
427
|
+
hydrating.delete(i);
|
|
428
|
+
return hydrated[index];
|
|
429
|
+
}
|
|
430
|
+
switch (type) {
|
|
431
|
+
case "Date":
|
|
432
|
+
hydrated[index] = ops.fromISOString(value[1]);
|
|
433
|
+
break;
|
|
434
|
+
case "Set":
|
|
435
|
+
const set = ops.createSet();
|
|
436
|
+
hydrated[index] = set;
|
|
437
|
+
for (let i = 1; i < value.length; i += 1) {
|
|
438
|
+
ops.addValue(set, hydrate(value[i]));
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
case "Map":
|
|
442
|
+
const map = ops.createMap();
|
|
443
|
+
hydrated[index] = map;
|
|
444
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
445
|
+
ops.addEntry(map, hydrate(value[i]), hydrate(value[i + 1]));
|
|
446
|
+
}
|
|
447
|
+
break;
|
|
448
|
+
case "RegExp":
|
|
449
|
+
hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
|
|
450
|
+
break;
|
|
451
|
+
case "Object": {
|
|
452
|
+
const wrapped_index = value[1];
|
|
453
|
+
if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") {
|
|
454
|
+
throw new Error("Invalid input");
|
|
455
|
+
}
|
|
456
|
+
hydrated[index] = ops.box(hydrate(wrapped_index));
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
case "BigInt":
|
|
460
|
+
hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
|
|
461
|
+
break;
|
|
462
|
+
case "null":
|
|
463
|
+
const obj = ops.createNullPrototypeObject();
|
|
464
|
+
hydrated[index] = obj;
|
|
465
|
+
for (let i = 1; i < value.length; i += 2) {
|
|
466
|
+
if (value[i] === "__proto__") {
|
|
467
|
+
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
468
|
+
}
|
|
469
|
+
ops.set(obj, value[i], hydrate(value[i + 1]));
|
|
470
|
+
}
|
|
471
|
+
break;
|
|
472
|
+
case "Int8Array":
|
|
473
|
+
case "Uint8Array":
|
|
474
|
+
case "Uint8ClampedArray":
|
|
475
|
+
case "Int16Array":
|
|
476
|
+
case "Uint16Array":
|
|
477
|
+
case "Float16Array":
|
|
478
|
+
case "Int32Array":
|
|
479
|
+
case "Uint32Array":
|
|
480
|
+
case "Float32Array":
|
|
481
|
+
case "Float64Array":
|
|
482
|
+
case "BigInt64Array":
|
|
483
|
+
case "BigUint64Array":
|
|
484
|
+
case "DataView": {
|
|
485
|
+
if (values[value[1]][0] !== "ArrayBuffer") {
|
|
486
|
+
throw new Error("Invalid data");
|
|
487
|
+
}
|
|
488
|
+
const buffer2 = hydrate(value[1]);
|
|
489
|
+
hydrated[index] = ops.fromViewInfo(type, buffer2, value[2], value[3]);
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
case "ArrayBuffer": {
|
|
493
|
+
const base64 = value[1];
|
|
494
|
+
if (typeof base64 !== "string") {
|
|
495
|
+
throw new Error("Invalid ArrayBuffer encoding");
|
|
496
|
+
}
|
|
497
|
+
hydrated[index] = ops.fromArrayBuffer(decode64(base64));
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
case "URL":
|
|
501
|
+
case "URLSearchParams":
|
|
502
|
+
case "Temporal.Duration":
|
|
503
|
+
case "Temporal.Instant":
|
|
504
|
+
case "Temporal.PlainDate":
|
|
505
|
+
case "Temporal.PlainTime":
|
|
506
|
+
case "Temporal.PlainDateTime":
|
|
507
|
+
case "Temporal.PlainMonthDay":
|
|
508
|
+
case "Temporal.PlainYearMonth":
|
|
509
|
+
case "Temporal.ZonedDateTime": {
|
|
510
|
+
hydrated[index] = ops.fromStringValue(type, value[1]);
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
default:
|
|
514
|
+
throw new Error(`Unknown type ${type}`);
|
|
515
|
+
}
|
|
516
|
+
} else if (value[0] === SPARSE) {
|
|
517
|
+
const len = value[1];
|
|
518
|
+
if (!is_valid_array_len(len)) {
|
|
519
|
+
throw new Error("Invalid input");
|
|
520
|
+
}
|
|
521
|
+
const array = ops.createSparseArray(len);
|
|
522
|
+
hydrated[index] = array;
|
|
523
|
+
for (let i = 2; i < value.length; i += 2) {
|
|
524
|
+
const idx = value[i];
|
|
525
|
+
if (!is_valid_array_index(idx) || idx >= len) {
|
|
526
|
+
throw new Error("Invalid input");
|
|
527
|
+
}
|
|
528
|
+
ops.set(array, idx, hydrate(value[i + 1]));
|
|
529
|
+
}
|
|
530
|
+
} else {
|
|
531
|
+
const array = ops.createArray(value.length);
|
|
532
|
+
hydrated[index] = array;
|
|
533
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
534
|
+
const n = value[i];
|
|
535
|
+
if (n === HOLE) continue;
|
|
536
|
+
ops.set(array, i, hydrate(n));
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
} else {
|
|
540
|
+
const object = ops.createObject();
|
|
541
|
+
hydrated[index] = object;
|
|
542
|
+
for (const key of Object.keys(value)) {
|
|
543
|
+
if (key === "__proto__") {
|
|
544
|
+
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
545
|
+
}
|
|
546
|
+
ops.set(object, key, hydrate(value[key]));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return hydrated[index];
|
|
550
|
+
}
|
|
551
|
+
return hydrate(0);
|
|
552
|
+
}
|
|
553
|
+
function stringify$1(value, reducers, options) {
|
|
554
|
+
const stringified = run(false, value, reducers);
|
|
555
|
+
return typeof stringified === "string" ? stringified : `[${stringified.join(",")}]`;
|
|
556
|
+
}
|
|
557
|
+
function run(async, value, reducers, options) {
|
|
558
|
+
const ops = merge_operations(default_stringify_operations);
|
|
559
|
+
const stringified = [];
|
|
560
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
561
|
+
const custom = [];
|
|
562
|
+
if (reducers) {
|
|
563
|
+
for (const key of Object.getOwnPropertyNames(reducers)) {
|
|
564
|
+
custom.push({ key, fn: reducers[key] });
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
const keys = [];
|
|
568
|
+
let p = 0;
|
|
569
|
+
function flatten(thing, index2) {
|
|
570
|
+
const type = ops.typeOf(thing);
|
|
571
|
+
if (type === "undefined") return UNDEFINED;
|
|
572
|
+
let number;
|
|
573
|
+
if (type === "number") {
|
|
574
|
+
number = /** @type {number} */
|
|
575
|
+
ops.toPrimitive(thing);
|
|
576
|
+
if (Number.isNaN(number)) return NAN;
|
|
577
|
+
if (number === Infinity) return POSITIVE_INFINITY;
|
|
578
|
+
if (number === -Infinity) return NEGATIVE_INFINITY;
|
|
579
|
+
if (number === 0 && 1 / number < 0) return NEGATIVE_ZERO;
|
|
580
|
+
}
|
|
581
|
+
const id = ops.identify(thing);
|
|
582
|
+
if (indexes.has(id)) return (
|
|
583
|
+
/** @type {number} */
|
|
584
|
+
indexes.get(id)
|
|
585
|
+
);
|
|
586
|
+
index2 ??= p++;
|
|
587
|
+
indexes.set(id, index2);
|
|
588
|
+
for (const { key, fn } of custom) {
|
|
589
|
+
const value2 = fn(thing);
|
|
590
|
+
if (value2) {
|
|
591
|
+
stringified[index2] = `["${key}",${flatten(value2)}]`;
|
|
592
|
+
return index2;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
if (type === "function") {
|
|
596
|
+
throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
|
|
597
|
+
} else if (type === "symbol") {
|
|
598
|
+
throw new DevalueError(`Cannot stringify a Symbol primitive`, keys, thing, value);
|
|
599
|
+
}
|
|
600
|
+
let str = "";
|
|
601
|
+
if (type !== "object") {
|
|
602
|
+
str = stringify_primitive(type === "number" ? number : ops.toPrimitive(thing));
|
|
603
|
+
} else if (ops.isThenable(thing)) {
|
|
604
|
+
{
|
|
605
|
+
throw new DevalueError(
|
|
606
|
+
`Cannot stringify a Promise or thenable — use stringifyAsync instead`,
|
|
607
|
+
keys,
|
|
608
|
+
thing,
|
|
609
|
+
value
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
} else {
|
|
613
|
+
const tag = ops.tagOf(thing);
|
|
614
|
+
switch (tag) {
|
|
615
|
+
case "Number":
|
|
616
|
+
case "String":
|
|
617
|
+
case "Boolean":
|
|
618
|
+
case "BigInt":
|
|
619
|
+
str = `["Object",${flatten(ops.unbox(thing))}]`;
|
|
620
|
+
break;
|
|
621
|
+
case "Date":
|
|
622
|
+
str = `["Date","${ops.toISOString(thing)}"]`;
|
|
623
|
+
break;
|
|
624
|
+
case "URL":
|
|
625
|
+
str = `["URL",${stringify_string(ops.toStringValue(thing))}]`;
|
|
626
|
+
break;
|
|
627
|
+
case "URLSearchParams":
|
|
628
|
+
str = `["URLSearchParams",${stringify_string(ops.toStringValue(thing))}]`;
|
|
629
|
+
break;
|
|
630
|
+
case "RegExp":
|
|
631
|
+
const { source, flags } = ops.regExpInfo(thing);
|
|
632
|
+
str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
|
|
633
|
+
break;
|
|
634
|
+
case "Array": {
|
|
635
|
+
let mostly_dense = false;
|
|
636
|
+
const length = ops.lengthOf(thing);
|
|
637
|
+
str = "[";
|
|
638
|
+
for (let i = 0; i < length; i += 1) {
|
|
639
|
+
if (i > 0) str += ",";
|
|
640
|
+
if (ops.hasOwn(thing, i)) {
|
|
641
|
+
keys.push(`[${i}]`);
|
|
642
|
+
str += flatten(ops.get(thing, i));
|
|
643
|
+
keys.pop();
|
|
644
|
+
} else if (mostly_dense) {
|
|
645
|
+
str += HOLE;
|
|
646
|
+
} else {
|
|
647
|
+
const populated_keys = ops.indicesOf(thing);
|
|
648
|
+
const population = populated_keys.length;
|
|
649
|
+
const d = String(length).length;
|
|
650
|
+
const hole_cost = (length - population) * 3;
|
|
651
|
+
const sparse_cost = 4 + d + population * (d + 1);
|
|
652
|
+
if (hole_cost > sparse_cost) {
|
|
653
|
+
str = "[" + SPARSE + "," + length;
|
|
654
|
+
for (let j = 0; j < populated_keys.length; j++) {
|
|
655
|
+
const key = populated_keys[j];
|
|
656
|
+
keys.push(`[${key}]`);
|
|
657
|
+
str += "," + key + "," + flatten(ops.get(thing, key));
|
|
658
|
+
keys.pop();
|
|
659
|
+
}
|
|
660
|
+
break;
|
|
661
|
+
} else {
|
|
662
|
+
mostly_dense = true;
|
|
663
|
+
str += HOLE;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
str += "]";
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
case "Set":
|
|
671
|
+
str = '["Set"';
|
|
672
|
+
for (const value2 of ops.valuesOf(thing)) {
|
|
673
|
+
str += `,${flatten(value2)}`;
|
|
674
|
+
}
|
|
675
|
+
str += "]";
|
|
676
|
+
break;
|
|
677
|
+
case "Map":
|
|
678
|
+
str = '["Map"';
|
|
679
|
+
for (const [key, value2] of ops.entriesOf(thing)) {
|
|
680
|
+
const key_type = ops.typeOf(key);
|
|
681
|
+
const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
|
|
682
|
+
keys.push(
|
|
683
|
+
`.get(${key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "..."})`
|
|
684
|
+
);
|
|
685
|
+
str += `,${flatten(key)},${flatten(value2)}`;
|
|
686
|
+
keys.pop();
|
|
687
|
+
}
|
|
688
|
+
str += "]";
|
|
689
|
+
break;
|
|
690
|
+
case "Int8Array":
|
|
691
|
+
case "Uint8Array":
|
|
692
|
+
case "Uint8ClampedArray":
|
|
693
|
+
case "Int16Array":
|
|
694
|
+
case "Uint16Array":
|
|
695
|
+
case "Float16Array":
|
|
696
|
+
case "Int32Array":
|
|
697
|
+
case "Uint32Array":
|
|
698
|
+
case "Float32Array":
|
|
699
|
+
case "Float64Array":
|
|
700
|
+
case "BigInt64Array":
|
|
701
|
+
case "BigUint64Array": {
|
|
702
|
+
const info = ops.viewInfo(thing);
|
|
703
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
704
|
+
if (info.byteLength !== info.bufferByteLength) {
|
|
705
|
+
str += `,${info.byteOffset},${info.length}`;
|
|
706
|
+
}
|
|
707
|
+
str += "]";
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
case "DataView": {
|
|
711
|
+
const info = ops.viewInfo(thing);
|
|
712
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
713
|
+
if (info.byteLength !== info.bufferByteLength) {
|
|
714
|
+
str += `,${info.byteOffset},${info.byteLength}`;
|
|
715
|
+
}
|
|
716
|
+
str += "]";
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
case "ArrayBuffer": {
|
|
720
|
+
const base64 = encode64(ops.toArrayBuffer(thing));
|
|
721
|
+
str = `["ArrayBuffer","${base64}"]`;
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
case "Temporal.Duration":
|
|
725
|
+
case "Temporal.Instant":
|
|
726
|
+
case "Temporal.PlainDate":
|
|
727
|
+
case "Temporal.PlainTime":
|
|
728
|
+
case "Temporal.PlainDateTime":
|
|
729
|
+
case "Temporal.PlainMonthDay":
|
|
730
|
+
case "Temporal.PlainYearMonth":
|
|
731
|
+
case "Temporal.ZonedDateTime":
|
|
732
|
+
str = `["${tag}",${stringify_string(ops.toStringValue(thing))}]`;
|
|
733
|
+
break;
|
|
734
|
+
default: {
|
|
735
|
+
const shape = ops.shapeOf(thing);
|
|
736
|
+
if (shape.kind === "not-plain") {
|
|
737
|
+
throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys, thing, value);
|
|
738
|
+
}
|
|
739
|
+
if (shape.kind === "symbol-keys") {
|
|
740
|
+
throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys, thing, value);
|
|
741
|
+
}
|
|
742
|
+
if (shape.kind === "null-proto") {
|
|
743
|
+
str = '["null"';
|
|
744
|
+
for (const key of shape.keys) {
|
|
745
|
+
if (key === "__proto__") {
|
|
746
|
+
throw new DevalueError(
|
|
747
|
+
`Cannot stringify objects with __proto__ keys`,
|
|
748
|
+
keys,
|
|
749
|
+
thing,
|
|
750
|
+
value
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
keys.push(stringify_key(key));
|
|
754
|
+
str += `,${stringify_string(key)},${flatten(ops.get(thing, key))}`;
|
|
755
|
+
keys.pop();
|
|
756
|
+
}
|
|
757
|
+
str += "]";
|
|
758
|
+
} else {
|
|
759
|
+
str = "{";
|
|
760
|
+
let started = false;
|
|
761
|
+
for (const key of shape.keys) {
|
|
762
|
+
if (key === "__proto__") {
|
|
763
|
+
throw new DevalueError(
|
|
764
|
+
`Cannot stringify objects with __proto__ keys`,
|
|
765
|
+
keys,
|
|
766
|
+
thing,
|
|
767
|
+
value
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
if (started) str += ",";
|
|
771
|
+
started = true;
|
|
772
|
+
keys.push(stringify_key(key));
|
|
773
|
+
str += `${stringify_string(key)}:${flatten(ops.get(thing, key))}`;
|
|
774
|
+
keys.pop();
|
|
775
|
+
}
|
|
776
|
+
str += "}";
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
stringified[index2] = str;
|
|
782
|
+
return index2;
|
|
783
|
+
}
|
|
784
|
+
const index = flatten(value);
|
|
785
|
+
if (index < 0) return `${index}`;
|
|
786
|
+
return stringified;
|
|
787
|
+
}
|
|
788
|
+
function stringify_primitive(thing) {
|
|
789
|
+
const type = typeof thing;
|
|
790
|
+
if (type === "string") return stringify_string(thing);
|
|
791
|
+
if (thing === void 0) return UNDEFINED.toString();
|
|
792
|
+
if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();
|
|
793
|
+
if (type === "bigint") return `["BigInt","${thing}"]`;
|
|
794
|
+
return String(thing);
|
|
795
|
+
}
|
|
796
|
+
const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
|
|
797
|
+
const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
|
798
|
+
const PAGE_METHODS = ["GET", "POST", "HEAD"];
|
|
799
|
+
function noop() {
|
|
800
|
+
}
|
|
801
|
+
function once(fn) {
|
|
802
|
+
let done = false;
|
|
803
|
+
let result;
|
|
804
|
+
return () => {
|
|
805
|
+
if (done) return result;
|
|
806
|
+
done = true;
|
|
807
|
+
return result = fn();
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
const decoder = new TextDecoder();
|
|
811
|
+
function set_nested_value(object, path_string, value) {
|
|
812
|
+
if (path_string.startsWith("n:")) {
|
|
813
|
+
path_string = path_string.slice(2);
|
|
814
|
+
value = value === "" ? void 0 : parseFloat(value);
|
|
815
|
+
} else if (path_string.startsWith("b:")) {
|
|
816
|
+
path_string = path_string.slice(2);
|
|
817
|
+
value = value === "on";
|
|
818
|
+
}
|
|
819
|
+
deep_set(object, split_path(path_string), value);
|
|
820
|
+
}
|
|
821
|
+
const DELETE_KEY = {};
|
|
822
|
+
function convert_formdata(data) {
|
|
823
|
+
const result = {};
|
|
824
|
+
for (let key of data.keys()) {
|
|
825
|
+
const is_array = key.endsWith("[]");
|
|
826
|
+
let values = data.getAll(key);
|
|
827
|
+
if (is_array) key = key.slice(0, -2);
|
|
828
|
+
values = values.filter(
|
|
829
|
+
(entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0
|
|
830
|
+
);
|
|
831
|
+
if (values.length === 0 && !is_array) continue;
|
|
832
|
+
if (key.startsWith("n:")) {
|
|
833
|
+
key = key.slice(2);
|
|
834
|
+
values = values.map((v) => v === "" ? void 0 : parseFloat(
|
|
835
|
+
/** @type {string} */
|
|
836
|
+
v
|
|
837
|
+
));
|
|
838
|
+
} else if (key.startsWith("b:")) {
|
|
839
|
+
key = key.slice(2);
|
|
840
|
+
values = values.map((v) => v === "on");
|
|
841
|
+
}
|
|
842
|
+
if (values.length > 1 && !is_array) {
|
|
843
|
+
throw new Error(`Form cannot contain duplicated keys — "${key}" has ${values.length} values`);
|
|
844
|
+
}
|
|
845
|
+
set_nested_value(result, key, is_array ? values : values[0]);
|
|
846
|
+
}
|
|
847
|
+
return result;
|
|
848
|
+
}
|
|
849
|
+
const BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
|
|
850
|
+
const BINARY_FORM_VERSION = 0;
|
|
851
|
+
const HEADER_BYTES = 1 + 4 + 2;
|
|
852
|
+
async function deserialize_binary_form(request) {
|
|
853
|
+
if (request.headers.get("content-type") !== BINARY_FORM_CONTENT_TYPE) {
|
|
854
|
+
const form_data = await request.formData();
|
|
855
|
+
return { data: convert_formdata(form_data), meta: {}, form_data };
|
|
856
|
+
}
|
|
857
|
+
if (!request.body) {
|
|
858
|
+
throw deserialize_error("no body");
|
|
859
|
+
}
|
|
860
|
+
const reader = request.body.getReader();
|
|
861
|
+
const chunks = [];
|
|
862
|
+
function get_chunk(index) {
|
|
863
|
+
if (index in chunks) return chunks[index];
|
|
864
|
+
let i = chunks.length;
|
|
865
|
+
while (i <= index) {
|
|
866
|
+
chunks[i] = reader.read().then((chunk) => chunk.value);
|
|
867
|
+
i++;
|
|
868
|
+
}
|
|
869
|
+
return chunks[index];
|
|
870
|
+
}
|
|
871
|
+
async function get_buffer(offset, length) {
|
|
872
|
+
let start_chunk;
|
|
873
|
+
let chunk_start = 0;
|
|
874
|
+
let chunk_index;
|
|
875
|
+
for (chunk_index = 0; ; chunk_index++) {
|
|
876
|
+
const chunk = await get_chunk(chunk_index);
|
|
877
|
+
if (!chunk) return null;
|
|
878
|
+
const chunk_end = chunk_start + chunk.byteLength;
|
|
879
|
+
if (offset >= chunk_start && offset < chunk_end) {
|
|
880
|
+
start_chunk = chunk;
|
|
881
|
+
break;
|
|
882
|
+
}
|
|
883
|
+
chunk_start = chunk_end;
|
|
884
|
+
}
|
|
885
|
+
if (offset + length <= chunk_start + start_chunk.byteLength) {
|
|
886
|
+
return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
|
|
887
|
+
}
|
|
888
|
+
const chunks2 = [start_chunk.subarray(offset - chunk_start)];
|
|
889
|
+
let cursor = start_chunk.byteLength - offset + chunk_start;
|
|
890
|
+
while (cursor < length) {
|
|
891
|
+
chunk_index++;
|
|
892
|
+
let chunk = await get_chunk(chunk_index);
|
|
893
|
+
if (!chunk) return null;
|
|
894
|
+
if (chunk.byteLength > length - cursor) {
|
|
895
|
+
chunk = chunk.subarray(0, length - cursor);
|
|
896
|
+
}
|
|
897
|
+
chunks2.push(chunk);
|
|
898
|
+
cursor += chunk.byteLength;
|
|
899
|
+
}
|
|
900
|
+
const buffer2 = new Uint8Array(length);
|
|
901
|
+
cursor = 0;
|
|
902
|
+
for (const chunk of chunks2) {
|
|
903
|
+
buffer2.set(chunk, cursor);
|
|
904
|
+
cursor += chunk.byteLength;
|
|
905
|
+
}
|
|
906
|
+
return buffer2;
|
|
907
|
+
}
|
|
908
|
+
const header = await get_buffer(0, HEADER_BYTES);
|
|
909
|
+
if (!header) throw deserialize_error("too short");
|
|
910
|
+
if (header[0] !== BINARY_FORM_VERSION) {
|
|
911
|
+
throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
|
|
912
|
+
}
|
|
913
|
+
const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
914
|
+
const data_length = header_view.getUint32(1, true);
|
|
915
|
+
const file_offsets_length = header_view.getUint16(5, true);
|
|
916
|
+
const data_buffer = await get_buffer(HEADER_BYTES, data_length);
|
|
917
|
+
if (!data_buffer) throw deserialize_error("data too short");
|
|
918
|
+
let file_offsets;
|
|
919
|
+
let files_start_offset;
|
|
920
|
+
if (file_offsets_length > 0) {
|
|
921
|
+
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
|
922
|
+
if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
|
|
923
|
+
const parsed_offsets = JSON.parse(decoder.decode(file_offsets_buffer));
|
|
924
|
+
if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) {
|
|
925
|
+
throw deserialize_error("invalid file offset table");
|
|
926
|
+
}
|
|
927
|
+
file_offsets = /** @type {Array<number>} */
|
|
928
|
+
parsed_offsets;
|
|
929
|
+
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
|
930
|
+
}
|
|
931
|
+
const file_spans = [];
|
|
932
|
+
const [data, meta] = parse(decoder.decode(data_buffer), {
|
|
933
|
+
File: ([name, type, size, last_modified, index]) => {
|
|
934
|
+
if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") {
|
|
935
|
+
throw deserialize_error("invalid file metadata");
|
|
936
|
+
}
|
|
937
|
+
let offset = file_offsets[index];
|
|
938
|
+
if (offset === void 0) {
|
|
939
|
+
throw deserialize_error("duplicate file offset table index");
|
|
940
|
+
}
|
|
941
|
+
file_offsets[index] = void 0;
|
|
942
|
+
offset += files_start_offset;
|
|
943
|
+
file_spans.push({ offset, size });
|
|
944
|
+
return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), {
|
|
945
|
+
getPrototypeOf() {
|
|
946
|
+
return File.prototype;
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
|
|
952
|
+
for (let i = 1; i < file_spans.length; i++) {
|
|
953
|
+
const previous = file_spans[i - 1];
|
|
954
|
+
const current = file_spans[i];
|
|
955
|
+
const previous_end = previous.offset + previous.size;
|
|
956
|
+
if (previous_end < current.offset) {
|
|
957
|
+
throw deserialize_error("gaps in file data");
|
|
958
|
+
}
|
|
959
|
+
if (previous_end > current.offset) {
|
|
960
|
+
throw deserialize_error("overlapping file data");
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
void (async () => {
|
|
964
|
+
let has_more = true;
|
|
965
|
+
while (has_more) {
|
|
966
|
+
const chunk = await get_chunk(chunks.length);
|
|
967
|
+
has_more = !!chunk;
|
|
968
|
+
}
|
|
969
|
+
})().catch(noop);
|
|
970
|
+
return { data, meta, form_data: null };
|
|
971
|
+
}
|
|
972
|
+
function deserialize_error(message) {
|
|
973
|
+
return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
|
|
974
|
+
}
|
|
975
|
+
class LazyFile {
|
|
976
|
+
/** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
|
|
977
|
+
#get_chunk;
|
|
978
|
+
/** @type {number} */
|
|
979
|
+
#offset;
|
|
980
|
+
/**
|
|
981
|
+
* @param {string} name
|
|
982
|
+
* @param {string} type
|
|
983
|
+
* @param {number} size
|
|
984
|
+
* @param {number} last_modified
|
|
985
|
+
* @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
|
|
986
|
+
* @param {number} offset
|
|
987
|
+
*/
|
|
988
|
+
constructor(name, type, size, last_modified, get_chunk, offset) {
|
|
989
|
+
this.name = name;
|
|
990
|
+
this.type = type;
|
|
991
|
+
this.size = size;
|
|
992
|
+
this.lastModified = last_modified;
|
|
993
|
+
this.webkitRelativePath = "";
|
|
994
|
+
this.#get_chunk = get_chunk;
|
|
995
|
+
this.#offset = offset;
|
|
996
|
+
this.arrayBuffer = this.arrayBuffer.bind(this);
|
|
997
|
+
this.bytes = this.bytes.bind(this);
|
|
998
|
+
this.slice = this.slice.bind(this);
|
|
999
|
+
this.stream = this.stream.bind(this);
|
|
1000
|
+
this.text = this.text.bind(this);
|
|
1001
|
+
}
|
|
1002
|
+
/** @type {ArrayBuffer | undefined} */
|
|
1003
|
+
#buffer;
|
|
1004
|
+
async arrayBuffer() {
|
|
1005
|
+
this.#buffer ??= await new Response(this.stream()).arrayBuffer();
|
|
1006
|
+
return this.#buffer;
|
|
1007
|
+
}
|
|
1008
|
+
async bytes() {
|
|
1009
|
+
return new Uint8Array(await this.arrayBuffer());
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* @param {number=} start
|
|
1013
|
+
* @param {number=} end
|
|
1014
|
+
* @param {string=} contentType
|
|
1015
|
+
*/
|
|
1016
|
+
slice(start = 0, end = this.size, contentType = this.type) {
|
|
1017
|
+
if (start < 0) {
|
|
1018
|
+
start = Math.max(this.size + start, 0);
|
|
1019
|
+
} else {
|
|
1020
|
+
start = Math.min(start, this.size);
|
|
1021
|
+
}
|
|
1022
|
+
if (end < 0) {
|
|
1023
|
+
end = Math.max(this.size + end, 0);
|
|
1024
|
+
} else {
|
|
1025
|
+
end = Math.min(end, this.size);
|
|
1026
|
+
}
|
|
1027
|
+
const size = Math.max(end - start, 0);
|
|
1028
|
+
const file = new LazyFile(
|
|
1029
|
+
this.name,
|
|
1030
|
+
contentType,
|
|
1031
|
+
size,
|
|
1032
|
+
this.lastModified,
|
|
1033
|
+
this.#get_chunk,
|
|
1034
|
+
this.#offset + start
|
|
1035
|
+
);
|
|
1036
|
+
return file;
|
|
1037
|
+
}
|
|
1038
|
+
stream() {
|
|
1039
|
+
let cursor = 0;
|
|
1040
|
+
let chunk_index = 0;
|
|
1041
|
+
return new ReadableStream({
|
|
1042
|
+
start: async (controller) => {
|
|
1043
|
+
let chunk_start = 0;
|
|
1044
|
+
let start_chunk;
|
|
1045
|
+
for (chunk_index = 0; ; chunk_index++) {
|
|
1046
|
+
const chunk = await this.#get_chunk(chunk_index);
|
|
1047
|
+
if (!chunk) return null;
|
|
1048
|
+
const chunk_end = chunk_start + chunk.byteLength;
|
|
1049
|
+
if (this.#offset >= chunk_start && this.#offset < chunk_end) {
|
|
1050
|
+
start_chunk = chunk;
|
|
1051
|
+
break;
|
|
1052
|
+
}
|
|
1053
|
+
chunk_start = chunk_end;
|
|
1054
|
+
}
|
|
1055
|
+
if (this.#offset + this.size <= chunk_start + start_chunk.byteLength) {
|
|
1056
|
+
controller.enqueue(
|
|
1057
|
+
start_chunk.subarray(this.#offset - chunk_start, this.#offset + this.size - chunk_start)
|
|
1058
|
+
);
|
|
1059
|
+
controller.close();
|
|
1060
|
+
} else {
|
|
1061
|
+
controller.enqueue(start_chunk.subarray(this.#offset - chunk_start));
|
|
1062
|
+
cursor = start_chunk.byteLength - this.#offset + chunk_start;
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
pull: async (controller) => {
|
|
1066
|
+
chunk_index++;
|
|
1067
|
+
let chunk = await this.#get_chunk(chunk_index);
|
|
1068
|
+
if (!chunk) {
|
|
1069
|
+
controller.error("incomplete file data");
|
|
1070
|
+
controller.close();
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
if (chunk.byteLength > this.size - cursor) {
|
|
1074
|
+
chunk = chunk.subarray(0, this.size - cursor);
|
|
1075
|
+
}
|
|
1076
|
+
controller.enqueue(chunk);
|
|
1077
|
+
cursor += chunk.byteLength;
|
|
1078
|
+
if (cursor >= this.size) {
|
|
1079
|
+
controller.close();
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
async text() {
|
|
1085
|
+
return decoder.decode(await this.arrayBuffer());
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
const path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
|
|
1089
|
+
function split_path(path) {
|
|
1090
|
+
if (!path_regex.test(path)) {
|
|
1091
|
+
throw new Error(`Invalid path ${path}`);
|
|
1092
|
+
}
|
|
1093
|
+
return path.split(/\.|\[|\]/).filter(Boolean);
|
|
1094
|
+
}
|
|
1095
|
+
function check_prototype_pollution(key) {
|
|
1096
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
1097
|
+
throw new Error(
|
|
1098
|
+
`Invalid key "${key}"`
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
function deep_set(object, keys, value) {
|
|
1103
|
+
let current = object;
|
|
1104
|
+
for (let i = 0; i < keys.length - 1; i += 1) {
|
|
1105
|
+
const key = keys[i];
|
|
1106
|
+
check_prototype_pollution(key);
|
|
1107
|
+
const is_array = /^\d+$/.test(keys[i + 1]);
|
|
1108
|
+
const inner = Object.hasOwn(current, key) ? current[key] : void 0;
|
|
1109
|
+
const exists = inner != null;
|
|
1110
|
+
if (exists && is_array !== Array.isArray(inner)) {
|
|
1111
|
+
throw new Error(`Invalid array key ${keys[i + 1]}`);
|
|
1112
|
+
}
|
|
1113
|
+
if (!exists) {
|
|
1114
|
+
if (value === DELETE_KEY) {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
current[key] = is_array ? [] : {};
|
|
1118
|
+
}
|
|
1119
|
+
current = current[key];
|
|
1120
|
+
}
|
|
1121
|
+
const final_key = keys[keys.length - 1];
|
|
1122
|
+
check_prototype_pollution(final_key);
|
|
1123
|
+
if (value === DELETE_KEY) {
|
|
1124
|
+
delete current[final_key];
|
|
1125
|
+
} else {
|
|
1126
|
+
current[final_key] = value;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
1130
|
+
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
1131
|
+
function stringify(data, transport) {
|
|
1132
|
+
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
|
1133
|
+
return stringify$1(data, encoders);
|
|
1134
|
+
}
|
|
1135
|
+
const remote_object = "__skrao";
|
|
1136
|
+
const remote_map = "__skram";
|
|
1137
|
+
const remote_set = "__skras";
|
|
1138
|
+
const remote_file = "__skraf";
|
|
1139
|
+
function create_remote_arg_revivers(transport) {
|
|
1140
|
+
const remote_fns_revivers = {
|
|
1141
|
+
/** @type {(value: unknown) => unknown} */
|
|
1142
|
+
[remote_object]: (value) => value,
|
|
1143
|
+
/** @type {(value: unknown) => Map<unknown, unknown>} */
|
|
1144
|
+
[remote_map]: (value) => {
|
|
1145
|
+
if (!Array.isArray(value)) {
|
|
1146
|
+
throw new Error("Invalid data for Map reviver");
|
|
1147
|
+
}
|
|
1148
|
+
const map = /* @__PURE__ */ new Map();
|
|
1149
|
+
for (const item of value) {
|
|
1150
|
+
if (!Array.isArray(item) || item.length !== 2 || typeof item[0] !== "string" || typeof item[1] !== "string") {
|
|
1151
|
+
throw new Error("Invalid data for Map reviver");
|
|
1152
|
+
}
|
|
1153
|
+
const [key, val] = item;
|
|
1154
|
+
map.set(parse$1(key), parse$1(val));
|
|
1155
|
+
}
|
|
1156
|
+
return map;
|
|
1157
|
+
},
|
|
1158
|
+
/** @type {(value: unknown) => Set<unknown>} */
|
|
1159
|
+
[remote_set]: (value) => {
|
|
1160
|
+
if (!Array.isArray(value)) {
|
|
1161
|
+
throw new Error("Invalid data for Set reviver");
|
|
1162
|
+
}
|
|
1163
|
+
const set = /* @__PURE__ */ new Set();
|
|
1164
|
+
for (const item of value) {
|
|
1165
|
+
if (typeof item !== "string") {
|
|
1166
|
+
throw new Error("Invalid data for Set reviver");
|
|
1167
|
+
}
|
|
1168
|
+
set.add(parse$1(item));
|
|
1169
|
+
}
|
|
1170
|
+
return set;
|
|
1171
|
+
},
|
|
1172
|
+
/** @type {(value: any) => File} */
|
|
1173
|
+
[remote_file]: (value) => {
|
|
1174
|
+
if (!value || typeof value !== "object" || typeof value.name !== "string" || typeof value.type !== "string" || typeof value.size !== "number" || typeof value.lastModified !== "number" || !(value.data instanceof ArrayBuffer)) {
|
|
1175
|
+
throw new Error("Invalid data for File reviver");
|
|
1176
|
+
}
|
|
1177
|
+
const { data, name, ...meta } = value;
|
|
1178
|
+
return new File([data], name, meta);
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
const user_revivers = Object.fromEntries(
|
|
1182
|
+
Object.entries(transport).map(([k, v]) => [k, v.decode])
|
|
1183
|
+
);
|
|
1184
|
+
const all_revivers = { ...user_revivers, ...remote_fns_revivers };
|
|
1185
|
+
const parse$1 = (data) => parse(data, all_revivers);
|
|
1186
|
+
return all_revivers;
|
|
1187
|
+
}
|
|
1188
|
+
function parse_remote_arg(string, transport) {
|
|
1189
|
+
if (!string) return void 0;
|
|
1190
|
+
const json_string = new TextDecoder().decode(
|
|
1191
|
+
// no need to add back `=` characters, atob can handle it
|
|
1192
|
+
base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
|
|
1193
|
+
);
|
|
1194
|
+
return parse(json_string, create_remote_arg_revivers(transport));
|
|
1195
|
+
}
|
|
1196
|
+
function create_remote_key(id, payload) {
|
|
1197
|
+
return id + "/" + payload;
|
|
1198
|
+
}
|
|
1199
|
+
function split_remote_key(key) {
|
|
1200
|
+
const i = key.lastIndexOf("/");
|
|
1201
|
+
if (i === -1) {
|
|
1202
|
+
throw new Error(`Invalid remote key: ${key}`);
|
|
1203
|
+
}
|
|
1204
|
+
return {
|
|
1205
|
+
id: key.slice(0, i),
|
|
1206
|
+
payload: key.slice(i + 1)
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
function coalesce_to_error(err) {
|
|
1210
|
+
return err instanceof Error || err && /** @type {any} */
|
|
1211
|
+
err.name && /** @type {any} */
|
|
1212
|
+
err.message ? (
|
|
1213
|
+
/** @type {Error} */
|
|
1214
|
+
err
|
|
1215
|
+
) : new Error(JSON.stringify(err));
|
|
1216
|
+
}
|
|
1217
|
+
function normalize_error(error) {
|
|
1218
|
+
return (
|
|
1219
|
+
/** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
|
|
1220
|
+
error
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
function get_status(error) {
|
|
1224
|
+
return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
|
|
1225
|
+
}
|
|
1226
|
+
function get_message(error) {
|
|
1227
|
+
return error instanceof SvelteKitError ? error.text : "Internal Error";
|
|
1228
|
+
}
|
|
1229
|
+
var defaultParseOptions = {
|
|
1230
|
+
decodeValues: true,
|
|
1231
|
+
map: false,
|
|
1232
|
+
silent: false,
|
|
1233
|
+
split: "auto"
|
|
1234
|
+
// auto = split strings but not arrays
|
|
1235
|
+
};
|
|
1236
|
+
function isForbiddenKey(key) {
|
|
1237
|
+
return typeof key !== "string" || key in {};
|
|
1238
|
+
}
|
|
1239
|
+
function createNullObj() {
|
|
1240
|
+
return /* @__PURE__ */ Object.create(null);
|
|
1241
|
+
}
|
|
1242
|
+
function isNonEmptyString(str) {
|
|
1243
|
+
return typeof str === "string" && !!str.trim();
|
|
1244
|
+
}
|
|
1245
|
+
function parseString(setCookieValue, options) {
|
|
1246
|
+
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
1247
|
+
var nameValuePairStr = parts.shift();
|
|
1248
|
+
if (!nameValuePairStr) {
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
var parsed = parseNameValuePair(nameValuePairStr);
|
|
1252
|
+
var name = parsed.name;
|
|
1253
|
+
var value = parsed.value;
|
|
1254
|
+
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
1255
|
+
if (isForbiddenKey(name)) {
|
|
1256
|
+
return null;
|
|
1257
|
+
}
|
|
1258
|
+
try {
|
|
1259
|
+
value = options.decodeValues ? decodeURIComponent(value) : value;
|
|
1260
|
+
} catch (e) {
|
|
1261
|
+
console.error(
|
|
1262
|
+
"set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",
|
|
1263
|
+
e
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
var cookie = createNullObj();
|
|
1267
|
+
cookie.name = name;
|
|
1268
|
+
cookie.value = value;
|
|
1269
|
+
parts.forEach(function(part) {
|
|
1270
|
+
var sides = part.split("=");
|
|
1271
|
+
var key = sides.shift().trim().toLowerCase();
|
|
1272
|
+
if (isForbiddenKey(key)) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
var value2 = sides.join("=").trim();
|
|
1276
|
+
if (key === "expires") {
|
|
1277
|
+
cookie.expires = new Date(value2);
|
|
1278
|
+
} else if (key === "max-age") {
|
|
1279
|
+
var n = parseInt(value2, 10);
|
|
1280
|
+
if (!Number.isNaN(n)) cookie.maxAge = n;
|
|
1281
|
+
} else if (key === "secure") {
|
|
1282
|
+
cookie.secure = true;
|
|
1283
|
+
} else if (key === "httponly") {
|
|
1284
|
+
cookie.httpOnly = true;
|
|
1285
|
+
} else if (key === "samesite") {
|
|
1286
|
+
cookie.sameSite = value2;
|
|
1287
|
+
} else if (key === "partitioned") {
|
|
1288
|
+
cookie.partitioned = true;
|
|
1289
|
+
} else if (key) {
|
|
1290
|
+
cookie[key] = value2;
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
return cookie;
|
|
1294
|
+
}
|
|
1295
|
+
function parseNameValuePair(nameValuePairStr) {
|
|
1296
|
+
var name = "";
|
|
1297
|
+
var value = "";
|
|
1298
|
+
var nameValueArr = nameValuePairStr.split("=");
|
|
1299
|
+
if (nameValueArr.length > 1) {
|
|
1300
|
+
name = nameValueArr.shift();
|
|
1301
|
+
value = nameValueArr.join("=");
|
|
1302
|
+
} else {
|
|
1303
|
+
value = nameValuePairStr;
|
|
1304
|
+
}
|
|
1305
|
+
return { name, value };
|
|
1306
|
+
}
|
|
1307
|
+
function parseSetCookie(input, options) {
|
|
1308
|
+
options = options ? Object.assign({}, defaultParseOptions, options) : defaultParseOptions;
|
|
1309
|
+
if (!input) {
|
|
1310
|
+
if (!options.map) {
|
|
1311
|
+
return [];
|
|
1312
|
+
} else {
|
|
1313
|
+
return createNullObj();
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if (input.headers) {
|
|
1317
|
+
if (typeof input.headers.getSetCookie === "function") {
|
|
1318
|
+
input = input.headers.getSetCookie();
|
|
1319
|
+
} else if (input.headers["set-cookie"]) {
|
|
1320
|
+
input = input.headers["set-cookie"];
|
|
1321
|
+
} else {
|
|
1322
|
+
var sch = input.headers[Object.keys(input.headers).find(function(key) {
|
|
1323
|
+
return key.toLowerCase() === "set-cookie";
|
|
1324
|
+
})];
|
|
1325
|
+
if (!sch && input.headers.cookie && !options.silent) {
|
|
1326
|
+
console.warn(
|
|
1327
|
+
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
1328
|
+
);
|
|
1329
|
+
}
|
|
1330
|
+
input = sch;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
var split = options.split;
|
|
1334
|
+
var isArray = Array.isArray(input);
|
|
1335
|
+
if (split === "auto") {
|
|
1336
|
+
split = !isArray;
|
|
1337
|
+
}
|
|
1338
|
+
if (!isArray) {
|
|
1339
|
+
input = [input];
|
|
1340
|
+
}
|
|
1341
|
+
input = input.filter(isNonEmptyString);
|
|
1342
|
+
if (split) {
|
|
1343
|
+
input = input.map(splitCookiesString).flat();
|
|
1344
|
+
}
|
|
1345
|
+
if (!options.map) {
|
|
1346
|
+
return input.map(function(str) {
|
|
1347
|
+
return parseString(str, options);
|
|
1348
|
+
}).filter(Boolean);
|
|
1349
|
+
} else {
|
|
1350
|
+
var cookies = createNullObj();
|
|
1351
|
+
return input.reduce(function(cookies2, str) {
|
|
1352
|
+
var cookie = parseString(str, options);
|
|
1353
|
+
if (cookie && !isForbiddenKey(cookie.name)) {
|
|
1354
|
+
cookies2[cookie.name] = cookie;
|
|
1355
|
+
}
|
|
1356
|
+
return cookies2;
|
|
1357
|
+
}, cookies);
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
function splitCookiesString(cookiesString) {
|
|
1361
|
+
if (Array.isArray(cookiesString)) {
|
|
1362
|
+
return cookiesString;
|
|
1363
|
+
}
|
|
1364
|
+
if (typeof cookiesString !== "string") {
|
|
1365
|
+
return [];
|
|
1366
|
+
}
|
|
1367
|
+
var cookiesStrings = [];
|
|
1368
|
+
var pos = 0;
|
|
1369
|
+
var start;
|
|
1370
|
+
var ch;
|
|
1371
|
+
var lastComma;
|
|
1372
|
+
var nextStart;
|
|
1373
|
+
var cookiesSeparatorFound;
|
|
1374
|
+
function skipWhitespace() {
|
|
1375
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
1376
|
+
pos += 1;
|
|
1377
|
+
}
|
|
1378
|
+
return pos < cookiesString.length;
|
|
1379
|
+
}
|
|
1380
|
+
function notSpecialChar() {
|
|
1381
|
+
ch = cookiesString.charAt(pos);
|
|
1382
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
1383
|
+
}
|
|
1384
|
+
while (pos < cookiesString.length) {
|
|
1385
|
+
start = pos;
|
|
1386
|
+
cookiesSeparatorFound = false;
|
|
1387
|
+
while (skipWhitespace()) {
|
|
1388
|
+
ch = cookiesString.charAt(pos);
|
|
1389
|
+
if (ch === ",") {
|
|
1390
|
+
lastComma = pos;
|
|
1391
|
+
pos += 1;
|
|
1392
|
+
skipWhitespace();
|
|
1393
|
+
nextStart = pos;
|
|
1394
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
1395
|
+
pos += 1;
|
|
1396
|
+
}
|
|
1397
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
1398
|
+
cookiesSeparatorFound = true;
|
|
1399
|
+
pos = nextStart;
|
|
1400
|
+
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
1401
|
+
start = pos;
|
|
1402
|
+
} else {
|
|
1403
|
+
pos = lastComma + 1;
|
|
1404
|
+
}
|
|
1405
|
+
} else {
|
|
1406
|
+
pos += 1;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
1410
|
+
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
return cookiesStrings;
|
|
1414
|
+
}
|
|
1415
|
+
parseSetCookie.parseSetCookie = parseSetCookie;
|
|
1416
|
+
parseSetCookie.parse = parseSetCookie;
|
|
1417
|
+
parseSetCookie.parseString = parseString;
|
|
1418
|
+
parseSetCookie.splitCookiesString = splitCookiesString;
|
|
1419
|
+
function negotiate(accept, types) {
|
|
1420
|
+
const parts = [];
|
|
1421
|
+
accept.split(",").forEach((str, i) => {
|
|
1422
|
+
const match = /^[ \t]*([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
|
1423
|
+
if (match) {
|
|
1424
|
+
const [, type, subtype, q = "1"] = match;
|
|
1425
|
+
parts.push({ type, subtype, q: +q, i });
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
parts.sort((a, b) => {
|
|
1429
|
+
if (a.q !== b.q) {
|
|
1430
|
+
return b.q - a.q;
|
|
1431
|
+
}
|
|
1432
|
+
if (a.subtype === "*" !== (b.subtype === "*")) {
|
|
1433
|
+
return a.subtype === "*" ? 1 : -1;
|
|
1434
|
+
}
|
|
1435
|
+
if (a.type === "*" !== (b.type === "*")) {
|
|
1436
|
+
return a.type === "*" ? 1 : -1;
|
|
1437
|
+
}
|
|
1438
|
+
return a.i - b.i;
|
|
1439
|
+
});
|
|
1440
|
+
let accepted;
|
|
1441
|
+
let min_priority = Infinity;
|
|
1442
|
+
for (const mimetype of types) {
|
|
1443
|
+
const [type, subtype] = mimetype.split("/");
|
|
1444
|
+
const priority = parts.findIndex(
|
|
1445
|
+
(part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
|
|
1446
|
+
);
|
|
1447
|
+
if (priority !== -1 && priority < min_priority) {
|
|
1448
|
+
accepted = mimetype;
|
|
1449
|
+
min_priority = priority;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
return accepted;
|
|
1453
|
+
}
|
|
1454
|
+
function get_set_cookies(headers) {
|
|
1455
|
+
if (typeof headers.getSetCookie === "function") {
|
|
1456
|
+
return headers.getSetCookie();
|
|
1457
|
+
}
|
|
1458
|
+
const set_cookie = headers.get("set-cookie");
|
|
1459
|
+
return set_cookie ? splitCookiesString(set_cookie) : [];
|
|
1460
|
+
}
|
|
1461
|
+
function is_content_type(request, ...types) {
|
|
1462
|
+
const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
|
|
1463
|
+
return types.includes(type.toLowerCase());
|
|
1464
|
+
}
|
|
1465
|
+
function is_form_content_type(request) {
|
|
1466
|
+
return is_content_type(
|
|
1467
|
+
request,
|
|
1468
|
+
"application/x-www-form-urlencoded",
|
|
1469
|
+
"multipart/form-data",
|
|
1470
|
+
"text/plain",
|
|
1471
|
+
BINARY_FORM_CONTENT_TYPE
|
|
1472
|
+
);
|
|
1473
|
+
}
|
|
1474
|
+
const escape_html_attr_dict = {
|
|
1475
|
+
"&": "&",
|
|
1476
|
+
'"': """
|
|
1477
|
+
// Svelte also escapes < because the escape function could be called inside a `noscript` there
|
|
1478
|
+
// https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
|
|
1479
|
+
// However, that doesn't apply in SvelteKit
|
|
1480
|
+
};
|
|
1481
|
+
const escape_html_dict = {
|
|
1482
|
+
"&": "&",
|
|
1483
|
+
"<": "<"
|
|
1484
|
+
};
|
|
1485
|
+
const surrogates = (
|
|
1486
|
+
// high surrogate without paired low surrogate
|
|
1487
|
+
"[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
|
|
1488
|
+
);
|
|
1489
|
+
const escape_html_attr_regex = new RegExp(
|
|
1490
|
+
`[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
|
|
1491
|
+
"g"
|
|
1492
|
+
);
|
|
1493
|
+
const escape_html_regex = new RegExp(
|
|
1494
|
+
`[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
|
|
1495
|
+
"g"
|
|
1496
|
+
);
|
|
1497
|
+
function escape_html(str, is_attr) {
|
|
1498
|
+
const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
|
|
1499
|
+
const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
|
|
1500
|
+
if (match.length === 2) {
|
|
1501
|
+
return match;
|
|
1502
|
+
}
|
|
1503
|
+
return dict[match] ?? `&#${match.charCodeAt(0)};`;
|
|
1504
|
+
});
|
|
1505
|
+
return escaped_str;
|
|
1506
|
+
}
|
|
1507
|
+
function method_not_allowed(mod, method) {
|
|
1508
|
+
return text(`${method} method not allowed`, {
|
|
1509
|
+
status: 405,
|
|
1510
|
+
headers: {
|
|
1511
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
|
1512
|
+
// "The server must generate an Allow header field in a 405 status code response"
|
|
1513
|
+
allow: allowed_methods(mod).join(", ")
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
function allowed_methods(mod) {
|
|
1518
|
+
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
|
1519
|
+
if ("GET" in mod && !("HEAD" in mod)) {
|
|
1520
|
+
allowed.push("HEAD");
|
|
1521
|
+
}
|
|
1522
|
+
return allowed;
|
|
1523
|
+
}
|
|
1524
|
+
function get_global_name(options) {
|
|
1525
|
+
return `__sveltekit_${options.version_hash}`;
|
|
1526
|
+
}
|
|
1527
|
+
function static_error_page(options, status, message) {
|
|
1528
|
+
let page = options.templates.error({ status, message: escape_html(message) });
|
|
1529
|
+
return text(page, {
|
|
1530
|
+
headers: { "content-type": "text/html; charset=utf-8" },
|
|
1531
|
+
status
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
async function handle_fatal_error(event, state, options, error) {
|
|
1535
|
+
error = error instanceof HttpError ? error : coalesce_to_error(error);
|
|
1536
|
+
const status = get_status(error);
|
|
1537
|
+
const body = await handle_error_and_jsonify(event, state, options, error);
|
|
1538
|
+
const type = negotiate(event.request.headers.get("accept") || "text/html", [
|
|
1539
|
+
"application/json",
|
|
1540
|
+
"text/html"
|
|
1541
|
+
]);
|
|
1542
|
+
if (event.isDataRequest || type === "application/json") {
|
|
1543
|
+
return json(body, {
|
|
1544
|
+
status
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
return static_error_page(options, status, body.message);
|
|
1548
|
+
}
|
|
1549
|
+
async function handle_error_and_jsonify(event, state, options, error) {
|
|
1550
|
+
if (error instanceof HttpError) {
|
|
1551
|
+
return { message: "Unknown Error", ...error.body };
|
|
1552
|
+
}
|
|
1553
|
+
const status = get_status(error);
|
|
1554
|
+
const message = get_message(error);
|
|
1555
|
+
return await with_request_store(
|
|
1556
|
+
{ event, state },
|
|
1557
|
+
() => options.hooks.handleError({ error, event, status, message })
|
|
1558
|
+
) ?? { message };
|
|
1559
|
+
}
|
|
1560
|
+
function redirect_response(status, location) {
|
|
1561
|
+
const response = new Response(void 0, {
|
|
1562
|
+
status,
|
|
1563
|
+
headers: { location }
|
|
1564
|
+
});
|
|
1565
|
+
return response;
|
|
1566
|
+
}
|
|
1567
|
+
function clarify_devalue_error(event, error) {
|
|
1568
|
+
if (error.path) {
|
|
1569
|
+
return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#transport.`;
|
|
1570
|
+
}
|
|
1571
|
+
if (error.path === "") {
|
|
1572
|
+
return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
|
|
1573
|
+
}
|
|
1574
|
+
return error.message;
|
|
1575
|
+
}
|
|
1576
|
+
function serialize_uses(node) {
|
|
1577
|
+
const uses = {};
|
|
1578
|
+
if (node.uses && node.uses.dependencies.size > 0) {
|
|
1579
|
+
uses.dependencies = Array.from(node.uses.dependencies);
|
|
1580
|
+
}
|
|
1581
|
+
if (node.uses && node.uses.search_params.size > 0) {
|
|
1582
|
+
uses.search_params = Array.from(node.uses.search_params);
|
|
1583
|
+
}
|
|
1584
|
+
if (node.uses && node.uses.params.size > 0) {
|
|
1585
|
+
uses.params = Array.from(node.uses.params);
|
|
1586
|
+
}
|
|
1587
|
+
if (node.uses?.parent) uses.parent = 1;
|
|
1588
|
+
if (node.uses?.route) uses.route = 1;
|
|
1589
|
+
if (node.uses?.url) uses.url = 1;
|
|
1590
|
+
return uses;
|
|
1591
|
+
}
|
|
1592
|
+
function has_prerendered_path(manifest, pathname) {
|
|
1593
|
+
return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
|
|
1594
|
+
}
|
|
1595
|
+
function format_server_error(status, error, event) {
|
|
1596
|
+
const formatted_text = `
|
|
1597
|
+
\x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
|
|
1598
|
+
if (status === 404) {
|
|
1599
|
+
return formatted_text;
|
|
1600
|
+
}
|
|
1601
|
+
return `${formatted_text}
|
|
1602
|
+
${error.stack}`;
|
|
1603
|
+
}
|
|
1604
|
+
function get_node_type(node_id) {
|
|
1605
|
+
const parts = node_id?.split("/");
|
|
1606
|
+
const filename = parts?.at(-1);
|
|
1607
|
+
if (!filename) return "unknown";
|
|
1608
|
+
const dot_parts = filename.split(".");
|
|
1609
|
+
return dot_parts.slice(0, -1).join(".");
|
|
1610
|
+
}
|
|
1611
|
+
function create_replacer(transport) {
|
|
1612
|
+
const replacer = (thing) => {
|
|
1613
|
+
for (const key in transport) {
|
|
1614
|
+
const encoded = transport[key].encode(thing);
|
|
1615
|
+
if (encoded) {
|
|
1616
|
+
return `app.decode('${key}', ${uneval(encoded, replacer)})`;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1620
|
+
return replacer;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
export { create_remote_key as A, error as B, parse_remote_arg as C, deserialize_binary_form as D, ENDPOINT_METHODS as E, stringify as F, stringify$1 as G, HttpError as H, INVALIDATED_PARAM as I, ActionFailure as J, split_remote_key as K, SVELTE_KIT_ASSETS as L, PAGE_METHODS as P, Redirect as R, SvelteKitError as S, TRAILING_SLASH_PARAM as T, handle_fatal_error as a, negotiate as b, method_not_allowed as c, handle_error_and_jsonify as d, get_status as e, format_server_error as f, get_set_cookies as g, has_prerendered_path as h, is_form_content_type as i, json as j, get_global_name as k, create_replacer as l, merge_tracing as m, noop as n, serialize_uses as o, parseString as p, clarify_devalue_error as q, redirect_response as r, static_error_page as s, text as t, once as u, normalize_error as v, with_request_store as w, get_node_type as x, isRedirect as y, escape_html as z };
|