diff --git "a/build/server/index.js.map" "b/build/server/index.js.map" --- "a/build/server/index.js.map" +++ "b/build/server/index.js.map" @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../node_modules/devalue/src/utils.js","../../node_modules/devalue/src/uneval.js","../../node_modules/devalue/src/constants.js","../../node_modules/devalue/src/stringify.js","../../.svelte-kit/adapter-node/chunks/index2.js","../../node_modules/cookie/index.js","../../node_modules/set-cookie-parser/lib/set-cookie.js","../../.svelte-kit/adapter-node/chunks/internal.js","../../.svelte-kit/adapter-node/index.js"],"sourcesContent":["/** @type {Record} */\nexport const escaped = {\n\t'<': '\\\\u003C',\n\t'\\\\': '\\\\\\\\',\n\t'\\b': '\\\\b',\n\t'\\f': '\\\\f',\n\t'\\n': '\\\\n',\n\t'\\r': '\\\\r',\n\t'\\t': '\\\\t',\n\t'\\u2028': '\\\\u2028',\n\t'\\u2029': '\\\\u2029'\n};\n\nexport class DevalueError extends Error {\n\t/**\n\t * @param {string} message\n\t * @param {string[]} keys\n\t */\n\tconstructor(message, keys) {\n\t\tsuper(message);\n\t\tthis.name = 'DevalueError';\n\t\tthis.path = keys.join('');\n\t}\n}\n\n/** @param {any} thing */\nexport function is_primitive(thing) {\n\treturn Object(thing) !== thing;\n}\n\nconst object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(\n\tObject.prototype\n)\n\t.sort()\n\t.join('\\0');\n\n/** @param {any} thing */\nexport function is_plain_object(thing) {\n\tconst proto = Object.getPrototypeOf(thing);\n\n\treturn (\n\t\tproto === Object.prototype ||\n\t\tproto === null ||\n\t\tObject.getOwnPropertyNames(proto).sort().join('\\0') === object_proto_names\n\t);\n}\n\n/** @param {any} thing */\nexport function get_type(thing) {\n\treturn Object.prototype.toString.call(thing).slice(8, -1);\n}\n\n/** @param {string} char */\nfunction get_escaped_char(char) {\n\tswitch (char) {\n\t\tcase '\"':\n\t\t\treturn '\\\\\"';\n\t\tcase '<':\n\t\t\treturn '\\\\u003C';\n\t\tcase '\\\\':\n\t\t\treturn '\\\\\\\\';\n\t\tcase '\\n':\n\t\t\treturn '\\\\n';\n\t\tcase '\\r':\n\t\t\treturn '\\\\r';\n\t\tcase '\\t':\n\t\t\treturn '\\\\t';\n\t\tcase '\\b':\n\t\t\treturn '\\\\b';\n\t\tcase '\\f':\n\t\t\treturn '\\\\f';\n\t\tcase '\\u2028':\n\t\t\treturn '\\\\u2028';\n\t\tcase '\\u2029':\n\t\t\treturn '\\\\u2029';\n\t\tdefault:\n\t\t\treturn char < ' '\n\t\t\t\t? `\\\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`\n\t\t\t\t: '';\n\t}\n}\n\n/** @param {string} str */\nexport function stringify_string(str) {\n\tlet result = '';\n\tlet last_pos = 0;\n\tconst len = str.length;\n\n\tfor (let i = 0; i < len; i += 1) {\n\t\tconst char = str[i];\n\t\tconst replacement = get_escaped_char(char);\n\t\tif (replacement) {\n\t\t\tresult += str.slice(last_pos, i) + replacement;\n\t\t\tlast_pos = i + 1;\n\t\t}\n\t}\n\n\treturn `\"${last_pos === 0 ? str : result + str.slice(last_pos)}\"`;\n}\n","import {\n\tDevalueError,\n\tescaped,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_string\n} from './utils.js';\n\nconst chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';\nconst unsafe_chars = /[<\\b\\f\\n\\r\\t\\0\\u2028\\u2029]/g;\nconst reserved =\n\t/^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;\n\n/**\n * Turn a value into the JavaScript that creates an equivalent value\n * @param {any} value\n * @param {(value: any) => string | void} [replacer]\n */\nexport function uneval(value, replacer) {\n\tconst counts = new Map();\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tconst custom = new Map();\n\n\t/** @param {any} thing */\n\tfunction walk(thing) {\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys);\n\t\t}\n\n\t\tif (!is_primitive(thing)) {\n\t\t\tif (counts.has(thing)) {\n\t\t\t\tcounts.set(thing, counts.get(thing) + 1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcounts.set(thing, 1);\n\n\t\t\tif (replacer) {\n\t\t\t\tconst str = replacer(thing);\n\n\t\t\t\tif (typeof str === 'string') {\n\t\t\t\t\tcustom.set(thing, str);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'BigInt':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\tcase 'Date':\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\treturn;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\t/** @type {any[]} */ (thing).forEach((value, i) => {\n\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\twalk(value);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tArray.from(thing).forEach(walk);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\twalk(value);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getOwnPropertySymbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\twalk(thing[key]);\n\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\twalk(value);\n\n\tconst names = new Map();\n\n\tArray.from(counts)\n\t\t.filter((entry) => entry[1] > 1)\n\t\t.sort((a, b) => b[1] - a[1])\n\t\t.forEach((entry, i) => {\n\t\t\tnames.set(entry[0], get_name(i));\n\t\t});\n\n\t/**\n\t * @param {any} thing\n\t * @returns {string}\n\t */\n\tfunction stringify(thing) {\n\t\tif (names.has(thing)) {\n\t\t\treturn names.get(thing);\n\t\t}\n\n\t\tif (is_primitive(thing)) {\n\t\t\treturn stringify_primitive(thing);\n\t\t}\n\n\t\tif (custom.has(thing)) {\n\t\t\treturn custom.get(thing);\n\t\t}\n\n\t\tconst type = get_type(thing);\n\n\t\tswitch (type) {\n\t\t\tcase 'Number':\n\t\t\tcase 'String':\n\t\t\tcase 'Boolean':\n\t\t\t\treturn `Object(${stringify(thing.valueOf())})`;\n\n\t\t\tcase 'RegExp':\n\t\t\t\treturn `new RegExp(${stringify_string(thing.source)}, \"${\n\t\t\t\t\tthing.flags\n\t\t\t\t}\")`;\n\n\t\t\tcase 'Date':\n\t\t\t\treturn `new Date(${thing.getTime()})`;\n\n\t\t\tcase 'Array':\n\t\t\t\tconst members = /** @type {any[]} */ (thing).map((v, i) =>\n\t\t\t\t\ti in thing ? stringify(v) : ''\n\t\t\t\t);\n\t\t\t\tconst tail = thing.length === 0 || thing.length - 1 in thing ? '' : ',';\n\t\t\t\treturn `[${members.join(',')}${tail}]`;\n\n\t\t\tcase 'Set':\n\t\t\tcase 'Map':\n\t\t\t\treturn `new ${type}([${Array.from(thing).map(stringify).join(',')}])`;\n\n\t\t\tdefault:\n\t\t\t\tconst obj = `{${Object.keys(thing)\n\t\t\t\t\t.map((key) => `${safe_key(key)}:${stringify(thing[key])}`)\n\t\t\t\t\t.join(',')}}`;\n\t\t\t\tconst proto = Object.getPrototypeOf(thing);\n\t\t\t\tif (proto === null) {\n\t\t\t\t\treturn Object.keys(thing).length > 0\n\t\t\t\t\t\t? `Object.assign(Object.create(null),${obj})`\n\t\t\t\t\t\t: `Object.create(null)`;\n\t\t\t\t}\n\n\t\t\t\treturn obj;\n\t\t}\n\t}\n\n\tconst str = stringify(value);\n\n\tif (names.size) {\n\t\t/** @type {string[]} */\n\t\tconst params = [];\n\n\t\t/** @type {string[]} */\n\t\tconst statements = [];\n\n\t\t/** @type {string[]} */\n\t\tconst values = [];\n\n\t\tnames.forEach((name, thing) => {\n\t\t\tparams.push(name);\n\n\t\t\tif (custom.has(thing)) {\n\t\t\t\tvalues.push(/** @type {string} */ (custom.get(thing)));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (is_primitive(thing)) {\n\t\t\t\tvalues.push(stringify_primitive(thing));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tvalues.push(`Object(${stringify(thing.valueOf())})`);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tvalues.push(thing.toString());\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tvalues.push(`new Date(${thing.getTime()})`);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\tvalues.push(`Array(${thing.length})`);\n\t\t\t\t\t/** @type {any[]} */ (thing).forEach((v, i) => {\n\t\t\t\t\t\tstatements.push(`${name}[${i}]=${stringify(v)}`);\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tvalues.push(`new Set`);\n\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t`${name}.${Array.from(thing)\n\t\t\t\t\t\t\t.map((v) => `add(${stringify(v)})`)\n\t\t\t\t\t\t\t.join('.')}`\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tvalues.push(`new Map`);\n\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t`${name}.${Array.from(thing)\n\t\t\t\t\t\t\t.map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`)\n\t\t\t\t\t\t\t.join('.')}`\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tvalues.push(\n\t\t\t\t\t\tObject.getPrototypeOf(thing) === null ? 'Object.create(null)' : '{}'\n\t\t\t\t\t);\n\t\t\t\t\tObject.keys(thing).forEach((key) => {\n\t\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t\t`${name}${safe_prop(key)}=${stringify(thing[key])}`\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tstatements.push(`return ${str}`);\n\n\t\treturn `(function(${params.join(',')}){${statements.join(\n\t\t\t';'\n\t\t)}}(${values.join(',')}))`;\n\t} else {\n\t\treturn str;\n\t}\n}\n\n/** @param {number} num */\nfunction get_name(num) {\n\tlet name = '';\n\n\tdo {\n\t\tname = chars[num % chars.length] + name;\n\t\tnum = ~~(num / chars.length) - 1;\n\t} while (num >= 0);\n\n\treturn reserved.test(name) ? `${name}0` : name;\n}\n\n/** @param {string} c */\nfunction escape_unsafe_char(c) {\n\treturn escaped[c] || c;\n}\n\n/** @param {string} str */\nfunction escape_unsafe_chars(str) {\n\treturn str.replace(unsafe_chars, escape_unsafe_char);\n}\n\n/** @param {string} key */\nfunction safe_key(key) {\n\treturn /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)\n\t\t? key\n\t\t: escape_unsafe_chars(JSON.stringify(key));\n}\n\n/** @param {string} key */\nfunction safe_prop(key) {\n\treturn /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)\n\t\t? `.${key}`\n\t\t: `[${escape_unsafe_chars(JSON.stringify(key))}]`;\n}\n\n/** @param {any} thing */\nfunction stringify_primitive(thing) {\n\tif (typeof thing === 'string') return stringify_string(thing);\n\tif (thing === void 0) return 'void 0';\n\tif (thing === 0 && 1 / thing < 0) return '-0';\n\tconst str = String(thing);\n\tif (typeof thing === 'number') return str.replace(/^(-)?0\\./, '$1.');\n\tif (typeof thing === 'bigint') return thing + 'n';\n\treturn str;\n}\n","export const UNDEFINED = -1;\nexport const HOLE = -2;\nexport const NAN = -3;\nexport const POSITIVE_INFINITY = -4;\nexport const NEGATIVE_INFINITY = -5;\nexport const NEGATIVE_ZERO = -6;\n","import {\n\tDevalueError,\n\tget_type,\n\tis_plain_object,\n\tis_primitive,\n\tstringify_string\n} from './utils.js';\nimport {\n\tHOLE,\n\tNAN,\n\tNEGATIVE_INFINITY,\n\tNEGATIVE_ZERO,\n\tPOSITIVE_INFINITY,\n\tUNDEFINED\n} from './constants.js';\n\n/**\n * Turn a value into a JSON string that can be parsed with `devalue.parse`\n * @param {any} value\n * @param {Record any>} [reducers]\n */\nexport function stringify(value, reducers) {\n\t/** @type {any[]} */\n\tconst stringified = [];\n\n\t/** @type {Map} */\n\tconst indexes = new Map();\n\n\t/** @type {Array<{ key: string, fn: (value: any) => any }>} */\n\tconst custom = [];\n\tfor (const key in reducers) {\n\t\tcustom.push({ key, fn: reducers[key] });\n\t}\n\n\t/** @type {string[]} */\n\tconst keys = [];\n\n\tlet p = 0;\n\n\t/** @param {any} thing */\n\tfunction flatten(thing) {\n\t\tif (typeof thing === 'function') {\n\t\t\tthrow new DevalueError(`Cannot stringify a function`, keys);\n\t\t}\n\n\t\tif (indexes.has(thing)) return indexes.get(thing);\n\n\t\tif (thing === undefined) return UNDEFINED;\n\t\tif (Number.isNaN(thing)) return NAN;\n\t\tif (thing === Infinity) return POSITIVE_INFINITY;\n\t\tif (thing === -Infinity) return NEGATIVE_INFINITY;\n\t\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;\n\n\t\tconst index = p++;\n\t\tindexes.set(thing, index);\n\n\t\tfor (const { key, fn } of custom) {\n\t\t\tconst value = fn(thing);\n\t\t\tif (value) {\n\t\t\t\tstringified[index] = `[\"${key}\",${flatten(value)}]`;\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\n\t\tlet str = '';\n\n\t\tif (is_primitive(thing)) {\n\t\t\tstr = stringify_primitive(thing);\n\t\t} else {\n\t\t\tconst type = get_type(thing);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Number':\n\t\t\t\tcase 'String':\n\t\t\t\tcase 'Boolean':\n\t\t\t\t\tstr = `[\"Object\",${stringify_primitive(thing)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'BigInt':\n\t\t\t\t\tstr = `[\"BigInt\",${thing}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Date':\n\t\t\t\t\tstr = `[\"Date\",\"${thing.toISOString()}\"]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RegExp':\n\t\t\t\t\tconst { source, flags } = thing;\n\t\t\t\t\tstr = flags\n\t\t\t\t\t\t? `[\"RegExp\",${stringify_string(source)},\"${flags}\"]`\n\t\t\t\t\t\t: `[\"RegExp\",${stringify_string(source)}]`;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\tstr = '[';\n\n\t\t\t\t\tfor (let i = 0; i < thing.length; i += 1) {\n\t\t\t\t\t\tif (i > 0) str += ',';\n\n\t\t\t\t\t\tif (i in thing) {\n\t\t\t\t\t\t\tkeys.push(`[${i}]`);\n\t\t\t\t\t\t\tstr += flatten(thing[i]);\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tstr += HOLE;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Set':\n\t\t\t\t\tstr = '[\"Set\"';\n\n\t\t\t\t\tfor (const value of thing) {\n\t\t\t\t\t\tstr += `,${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Map':\n\t\t\t\t\tstr = '[\"Map\"';\n\n\t\t\t\t\tfor (const [key, value] of thing) {\n\t\t\t\t\t\tkeys.push(\n\t\t\t\t\t\t\t`.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tstr += `,${flatten(key)},${flatten(value)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tstr += ']';\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tif (!is_plain_object(thing)) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify arbitrary non-POJOs`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getOwnPropertySymbols(thing).length > 0) {\n\t\t\t\t\t\tthrow new DevalueError(\n\t\t\t\t\t\t\t`Cannot stringify POJOs with symbolic keys`,\n\t\t\t\t\t\t\tkeys\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.getPrototypeOf(thing) === null) {\n\t\t\t\t\t\tstr = '[\"null\"';\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `,${stringify_string(key)},${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += ']';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstr = '{';\n\t\t\t\t\t\tlet started = false;\n\t\t\t\t\t\tfor (const key in thing) {\n\t\t\t\t\t\t\tif (started) str += ',';\n\t\t\t\t\t\t\tstarted = true;\n\t\t\t\t\t\t\tkeys.push(`.${key}`);\n\t\t\t\t\t\t\tstr += `${stringify_string(key)}:${flatten(thing[key])}`;\n\t\t\t\t\t\t\tkeys.pop();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += '}';\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstringified[index] = str;\n\t\treturn index;\n\t}\n\n\tconst index = flatten(value);\n\n\t// special case — value is represented as a negative index\n\tif (index < 0) return `${index}`;\n\n\treturn `[${stringified.join(',')}]`;\n}\n\n/**\n * @param {any} thing\n * @returns {string}\n */\nfunction stringify_primitive(thing) {\n\tconst type = typeof thing;\n\tif (type === 'string') return stringify_string(thing);\n\tif (thing instanceof String) return stringify_string(thing.toString());\n\tif (thing === void 0) return UNDEFINED.toString();\n\tif (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();\n\tif (type === 'bigint') return `[\"BigInt\",\"${thing}\"]`;\n\treturn String(thing);\n}\n","import { q as noop, r as safe_not_equal } from \"./ssr.js\";\nconst subscriber_queue = [];\nfunction readable(value, start) {\n return {\n subscribe: writable(value, start).subscribe\n };\n}\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = /* @__PURE__ */ new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) {\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe(run, invalidate = noop) {\n const subscriber = [run, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set, update) || noop;\n }\n run(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0 && stop) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe };\n}\nexport {\n readable as r,\n writable as w\n};\n","/*!\n * cookie\n * Copyright(c) 2012-2014 Roman Shtylman\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nexports.parse = parse;\nexports.serialize = serialize;\n\n/**\n * Module variables.\n * @private\n */\n\nvar __toString = Object.prototype.toString\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\n\nvar fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n *\n * @param {string} str\n * @param {object} [options]\n * @return {object}\n * @public\n */\n\nfunction parse(str, options) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {}\n var opt = options || {};\n var dec = opt.decode || decode;\n\n var index = 0\n while (index < str.length) {\n var eqIdx = str.indexOf('=', index)\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break\n }\n\n var endIdx = str.indexOf(';', index)\n\n if (endIdx === -1) {\n endIdx = str.length\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1\n continue\n }\n\n var key = str.slice(index, eqIdx).trim()\n\n // only assign once\n if (undefined === obj[key]) {\n var val = str.slice(eqIdx + 1, endIdx).trim()\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1)\n }\n\n obj[key] = tryDecode(val, dec);\n }\n\n index = endIdx + 1\n }\n\n return obj;\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n *\n * @param {string} name\n * @param {string} val\n * @param {object} [options]\n * @return {string}\n * @public\n */\n\nfunction serialize(name, val, options) {\n var opt = options || {};\n var enc = opt.encode || encode;\n\n if (typeof enc !== 'function') {\n throw new TypeError('option encode is invalid');\n }\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n var value = enc(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n var str = name + '=' + value;\n\n if (null != opt.maxAge) {\n var maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid')\n }\n\n str += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n str += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n str += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n var expires = opt.expires\n\n if (!isDate(expires) || isNaN(expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n str += '; Expires=' + expires.toUTCString()\n }\n\n if (opt.httpOnly) {\n str += '; HttpOnly';\n }\n\n if (opt.secure) {\n str += '; Secure';\n }\n\n if (opt.partitioned) {\n str += '; Partitioned'\n }\n\n if (opt.priority) {\n var priority = typeof opt.priority === 'string'\n ? opt.priority.toLowerCase()\n : opt.priority\n\n switch (priority) {\n case 'low':\n str += '; Priority=Low'\n break\n case 'medium':\n str += '; Priority=Medium'\n break\n case 'high':\n str += '; Priority=High'\n break\n default:\n throw new TypeError('option priority is invalid')\n }\n }\n\n if (opt.sameSite) {\n var sameSite = typeof opt.sameSite === 'string'\n ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n str += '; SameSite=Strict';\n break;\n case 'lax':\n str += '; SameSite=Lax';\n break;\n case 'strict':\n str += '; SameSite=Strict';\n break;\n case 'none':\n str += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return str;\n}\n\n/**\n * URL-decode string value. Optimized to skip native call when no %.\n *\n * @param {string} str\n * @returns {string}\n */\n\nfunction decode (str) {\n return str.indexOf('%') !== -1\n ? decodeURIComponent(str)\n : str\n}\n\n/**\n * URL-encode value.\n *\n * @param {string} val\n * @returns {string}\n */\n\nfunction encode (val) {\n return encodeURIComponent(val)\n}\n\n/**\n * Determine if value is a Date.\n *\n * @param {*} val\n * @private\n */\n\nfunction isDate (val) {\n return __toString.call(val) === '[object Date]' ||\n val instanceof Date\n}\n\n/**\n * Try decoding a string using a decoding function.\n *\n * @param {string} str\n * @param {function} decode\n * @private\n */\n\nfunction tryDecode(str, decode) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n","\"use strict\";\n\nvar defaultParseOptions = {\n decodeValues: true,\n map: false,\n silent: false,\n};\n\nfunction isNonEmptyString(str) {\n return typeof str === \"string\" && !!str.trim();\n}\n\nfunction parseString(setCookieValue, options) {\n var parts = setCookieValue.split(\";\").filter(isNonEmptyString);\n\n var nameValuePairStr = parts.shift();\n var parsed = parseNameValuePair(nameValuePairStr);\n var name = parsed.name;\n var value = parsed.value;\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n try {\n value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value\n } catch (e) {\n console.error(\n \"set-cookie-parser encountered an error while decoding a cookie with value '\" +\n value +\n \"'. Set options.decodeValues to false to disable this feature.\",\n e\n );\n }\n\n var cookie = {\n name: name,\n value: value,\n };\n\n parts.forEach(function (part) {\n var sides = part.split(\"=\");\n var key = sides.shift().trimLeft().toLowerCase();\n var value = sides.join(\"=\");\n if (key === \"expires\") {\n cookie.expires = new Date(value);\n } else if (key === \"max-age\") {\n cookie.maxAge = parseInt(value, 10);\n } else if (key === \"secure\") {\n cookie.secure = true;\n } else if (key === \"httponly\") {\n cookie.httpOnly = true;\n } else if (key === \"samesite\") {\n cookie.sameSite = value;\n } else {\n cookie[key] = value;\n }\n });\n\n return cookie;\n}\n\nfunction parseNameValuePair(nameValuePairStr) {\n // Parses name-value-pair according to rfc6265bis draft\n\n var name = \"\";\n var value = \"\";\n var nameValueArr = nameValuePairStr.split(\"=\");\n if (nameValueArr.length > 1) {\n name = nameValueArr.shift();\n value = nameValueArr.join(\"=\"); // everything after the first =, joined by a \"=\" if there was more than one part\n } else {\n value = nameValuePairStr;\n }\n\n return { name: name, value: value };\n}\n\nfunction parse(input, options) {\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!input) {\n if (!options.map) {\n return [];\n } else {\n return {};\n }\n }\n\n if (input.headers) {\n if (typeof input.headers.getSetCookie === \"function\") {\n // for fetch responses - they combine headers of the same type in the headers array,\n // but getSetCookie returns an uncombined array\n input = input.headers.getSetCookie();\n } else if (input.headers[\"set-cookie\"]) {\n // fast-path for node.js (which automatically normalizes header names to lower-case\n input = input.headers[\"set-cookie\"];\n } else {\n // slow-path for other environments - see #25\n var sch =\n input.headers[\n Object.keys(input.headers).find(function (key) {\n return key.toLowerCase() === \"set-cookie\";\n })\n ];\n // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36\n if (!sch && input.headers.cookie && !options.silent) {\n console.warn(\n \"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.\"\n );\n }\n input = sch;\n }\n }\n if (!Array.isArray(input)) {\n input = [input];\n }\n\n options = options\n ? Object.assign({}, defaultParseOptions, options)\n : defaultParseOptions;\n\n if (!options.map) {\n return input.filter(isNonEmptyString).map(function (str) {\n return parseString(str, options);\n });\n } else {\n var cookies = {};\n return input.filter(isNonEmptyString).reduce(function (cookies, str) {\n var cookie = parseString(str, options);\n cookies[cookie.name] = cookie;\n return cookies;\n }, cookies);\n }\n}\n\n/*\n Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas\n that are within a single set-cookie field-value, such as in the Expires portion.\n\n This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2\n Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128\n React Native's fetch does this for *every* header, including set-cookie.\n\n Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25\n Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation\n*/\nfunction splitCookiesString(cookiesString) {\n if (Array.isArray(cookiesString)) {\n return cookiesString;\n }\n if (typeof cookiesString !== \"string\") {\n return [];\n }\n\n var cookiesStrings = [];\n var pos = 0;\n var start;\n var ch;\n var lastComma;\n var nextStart;\n var cookiesSeparatorFound;\n\n function skipWhitespace() {\n while (pos < cookiesString.length && /\\s/.test(cookiesString.charAt(pos))) {\n pos += 1;\n }\n return pos < cookiesString.length;\n }\n\n function notSpecialChar() {\n ch = cookiesString.charAt(pos);\n\n return ch !== \"=\" && ch !== \";\" && ch !== \",\";\n }\n\n while (pos < cookiesString.length) {\n start = pos;\n cookiesSeparatorFound = false;\n\n while (skipWhitespace()) {\n ch = cookiesString.charAt(pos);\n if (ch === \",\") {\n // ',' is a cookie separator if we have later first '=', not ';' or ','\n lastComma = pos;\n pos += 1;\n\n skipWhitespace();\n nextStart = pos;\n\n while (pos < cookiesString.length && notSpecialChar()) {\n pos += 1;\n }\n\n // currently special character\n if (pos < cookiesString.length && cookiesString.charAt(pos) === \"=\") {\n // we found cookies separator\n cookiesSeparatorFound = true;\n // pos is inside the next cookie, so back up and return it.\n pos = nextStart;\n cookiesStrings.push(cookiesString.substring(start, lastComma));\n start = pos;\n } else {\n // in param ',' or param separator ';',\n // we continue from that comma\n pos = lastComma + 1;\n }\n } else {\n pos += 1;\n }\n }\n\n if (!cookiesSeparatorFound || pos >= cookiesString.length) {\n cookiesStrings.push(cookiesString.substring(start, cookiesString.length));\n }\n }\n\n return cookiesStrings;\n}\n\nmodule.exports = parse;\nmodule.exports.parse = parse;\nmodule.exports.parseString = parseString;\nmodule.exports.splitCookiesString = splitCookiesString;\n","import { c as create_ssr_component, s as setContext, v as validate_component, m as missing_component } from \"./ssr.js\";\nimport \"./paths.js\";\nimport \"./shared-server.js\";\nfunction afterUpdate() {\n}\nlet prerendering = false;\nfunction set_building() {\n}\nfunction set_prerendering() {\n prerendering = true;\n}\nconst Root = create_ssr_component(($$result, $$props, $$bindings, slots) => {\n let { stores } = $$props;\n let { page } = $$props;\n let { constructors } = $$props;\n let { components = [] } = $$props;\n let { form } = $$props;\n let { data_0 = null } = $$props;\n let { data_1 = null } = $$props;\n {\n setContext(\"__svelte__\", stores);\n }\n afterUpdate(stores.page.notify);\n if ($$props.stores === void 0 && $$bindings.stores && stores !== void 0)\n $$bindings.stores(stores);\n if ($$props.page === void 0 && $$bindings.page && page !== void 0)\n $$bindings.page(page);\n if ($$props.constructors === void 0 && $$bindings.constructors && constructors !== void 0)\n $$bindings.constructors(constructors);\n if ($$props.components === void 0 && $$bindings.components && components !== void 0)\n $$bindings.components(components);\n if ($$props.form === void 0 && $$bindings.form && form !== void 0)\n $$bindings.form(form);\n if ($$props.data_0 === void 0 && $$bindings.data_0 && data_0 !== void 0)\n $$bindings.data_0(data_0);\n if ($$props.data_1 === void 0 && $$bindings.data_1 && data_1 !== void 0)\n $$bindings.data_1(data_1);\n let $$settled;\n let $$rendered;\n let previous_head = $$result.head;\n do {\n $$settled = true;\n $$result.head = previous_head;\n {\n stores.page.set(page);\n }\n $$rendered = ` ${constructors[1] ? `${validate_component(constructors[0] || missing_component, \"svelte:component\").$$render(\n $$result,\n { data: data_0, this: components[0] },\n {\n this: ($$value) => {\n components[0] = $$value;\n $$settled = false;\n }\n },\n {\n default: () => {\n return `${validate_component(constructors[1] || missing_component, \"svelte:component\").$$render(\n $$result,\n { data: data_1, form, this: components[1] },\n {\n this: ($$value) => {\n components[1] = $$value;\n $$settled = false;\n }\n },\n {}\n )}`;\n }\n }\n )}` : `${validate_component(constructors[0] || missing_component, \"svelte:component\").$$render(\n $$result,\n { data: data_0, form, this: components[0] },\n {\n this: ($$value) => {\n components[0] = $$value;\n $$settled = false;\n }\n },\n {}\n )}`} ${``}`;\n } while (!$$settled);\n return $$rendered;\n});\nconst options = {\n app_dir: \"_app\",\n app_template_contains_nonce: false,\n csp: { \"mode\": \"auto\", \"directives\": { \"upgrade-insecure-requests\": false, \"block-all-mixed-content\": false }, \"reportOnly\": { \"upgrade-insecure-requests\": false, \"block-all-mixed-content\": false } },\n csrf_check_origin: true,\n embedded: false,\n env_public_prefix: \"PUBLIC_\",\n env_private_prefix: \"\",\n hooks: null,\n // added lazily, via `get_hooks`\n preload_strategy: \"modulepreload\",\n root: Root,\n service_worker: false,\n templates: {\n app: ({ head, body, assets, nonce, env }) => '\\r\\n\\r\\n\t\\r\\n\t\t\\r\\n\t\t\\r\\n\t\t\\r\\n\t\t' + head + '\\r\\n\t\\r\\n\t\\r\\n\t\t
' + body + \"
\\r\\n\t\\r\\n\\r\\n\",\n error: ({ status, message }) => '\\n\\n\t\\n\t\t\\n\t\t' + message + `\n\n\t\t\n\t\n\t\n\t\t
\n\t\t\t` + status + '\\n\t\t\t
\\n\t\t\t\t

' + message + \"

\\n\t\t\t
\\n\t\t
\\n\t\\n\\n\"\n },\n version_hash: \"1fmuylt\"\n};\nasync function get_hooks() {\n return {};\n}\nexport {\n set_prerendering as a,\n get_hooks as g,\n options as o,\n prerendering as p,\n set_building as s\n};\n","import { b as base, a as assets, o as override, r as reset } from \"./chunks/paths.js\";\nimport { H as HttpError, S as SvelteKitError, t as text, j as json, R as Redirect, A as ActionFailure } from \"./chunks/index.js\";\nimport { m as make_trackable, d as disable_search, n as normalize_path, a as add_data_suffix, r as resolve, b as decode_pathname, h as has_data_suffix, s as strip_data_suffix, c as decode_params, v as validate_layout_server_exports, e as validate_layout_exports, f as validate_page_server_exports, g as validate_page_exports, i as validate_server_exports } from \"./chunks/exports.js\";\nimport * as devalue from \"devalue\";\nimport { r as readable, w as writable } from \"./chunks/index2.js\";\nimport { p as public_env, s as safe_public_env, a as set_private_env, b as set_public_env, c as set_safe_public_env } from \"./chunks/shared-server.js\";\nimport { parse, serialize } from \"cookie\";\nimport * as set_cookie_parser from \"set-cookie-parser\";\nimport { o as options, p as prerendering, g as get_hooks } from \"./chunks/internal.js\";\nconst DEV = false;\nconst SVELTE_KIT_ASSETS = \"/_svelte_kit_assets\";\nconst ENDPOINT_METHODS = [\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"OPTIONS\", \"HEAD\"];\nconst PAGE_METHODS = [\"GET\", \"POST\", \"HEAD\"];\nfunction negotiate(accept, types) {\n const parts = [];\n accept.split(\",\").forEach((str, i) => {\n const match = /([^/]+)\\/([^;]+)(?:;q=([0-9.]+))?/.exec(str);\n if (match) {\n const [, type, subtype, q = \"1\"] = match;\n parts.push({ type, subtype, q: +q, i });\n }\n });\n parts.sort((a, b) => {\n if (a.q !== b.q) {\n return b.q - a.q;\n }\n if (a.subtype === \"*\" !== (b.subtype === \"*\")) {\n return a.subtype === \"*\" ? 1 : -1;\n }\n if (a.type === \"*\" !== (b.type === \"*\")) {\n return a.type === \"*\" ? 1 : -1;\n }\n return a.i - b.i;\n });\n let accepted;\n let min_priority = Infinity;\n for (const mimetype of types) {\n const [type, subtype] = mimetype.split(\"/\");\n const priority = parts.findIndex(\n (part) => (part.type === type || part.type === \"*\") && (part.subtype === subtype || part.subtype === \"*\")\n );\n if (priority !== -1 && priority < min_priority) {\n accepted = mimetype;\n min_priority = priority;\n }\n }\n return accepted;\n}\nfunction is_content_type(request, ...types) {\n const type = request.headers.get(\"content-type\")?.split(\";\", 1)[0].trim() ?? \"\";\n return types.includes(type.toLowerCase());\n}\nfunction is_form_content_type(request) {\n return is_content_type(\n request,\n \"application/x-www-form-urlencoded\",\n \"multipart/form-data\",\n \"text/plain\"\n );\n}\nfunction coalesce_to_error(err) {\n return err instanceof Error || err && /** @type {any} */\n err.name && /** @type {any} */\n err.message ? (\n /** @type {Error} */\n err\n ) : new Error(JSON.stringify(err));\n}\nfunction normalize_error(error) {\n return (\n /** @type {import('../runtime/control.js').Redirect | HttpError | SvelteKitError | Error} */\n error\n );\n}\nfunction get_status(error) {\n return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;\n}\nfunction get_message(error) {\n return error instanceof SvelteKitError ? error.text : \"Internal Error\";\n}\nfunction method_not_allowed(mod, method) {\n return text(`${method} method not allowed`, {\n status: 405,\n headers: {\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405\n // \"The server must generate an Allow header field in a 405 status code response\"\n allow: allowed_methods(mod).join(\", \")\n }\n });\n}\nfunction allowed_methods(mod) {\n const allowed = ENDPOINT_METHODS.filter((method) => method in mod);\n if (\"GET\" in mod || \"HEAD\" in mod)\n allowed.push(\"HEAD\");\n return allowed;\n}\nfunction static_error_page(options2, status, message) {\n let page = options2.templates.error({ status, message });\n return text(page, {\n headers: { \"content-type\": \"text/html; charset=utf-8\" },\n status\n });\n}\nasync function handle_fatal_error(event, options2, error) {\n error = error instanceof HttpError ? error : coalesce_to_error(error);\n const status = get_status(error);\n const body2 = await handle_error_and_jsonify(event, options2, error);\n const type = negotiate(event.request.headers.get(\"accept\") || \"text/html\", [\n \"application/json\",\n \"text/html\"\n ]);\n if (event.isDataRequest || type === \"application/json\") {\n return json(body2, {\n status\n });\n }\n return static_error_page(options2, status, body2.message);\n}\nasync function handle_error_and_jsonify(event, options2, error) {\n if (error instanceof HttpError) {\n return error.body;\n }\n const status = get_status(error);\n const message = get_message(error);\n return await options2.hooks.handleError({ error, event, status, message }) ?? { message };\n}\nfunction redirect_response(status, location) {\n const response = new Response(void 0, {\n status,\n headers: { location }\n });\n return response;\n}\nfunction clarify_devalue_error(event, error) {\n if (error.path) {\n return `Data returned from \\`load\\` while rendering ${event.route.id} is not serializable: ${error.message} (data${error.path})`;\n }\n if (error.path === \"\") {\n return `Data returned from \\`load\\` while rendering ${event.route.id} is not a plain object`;\n }\n return error.message;\n}\nfunction stringify_uses(node) {\n const uses = [];\n if (node.uses && node.uses.dependencies.size > 0) {\n uses.push(`\"dependencies\":${JSON.stringify(Array.from(node.uses.dependencies))}`);\n }\n if (node.uses && node.uses.search_params.size > 0) {\n uses.push(`\"search_params\":${JSON.stringify(Array.from(node.uses.search_params))}`);\n }\n if (node.uses && node.uses.params.size > 0) {\n uses.push(`\"params\":${JSON.stringify(Array.from(node.uses.params))}`);\n }\n if (node.uses?.parent)\n uses.push('\"parent\":1');\n if (node.uses?.route)\n uses.push('\"route\":1');\n if (node.uses?.url)\n uses.push('\"url\":1');\n return `\"uses\":{${uses.join(\",\")}}`;\n}\nasync function render_endpoint(event, mod, state) {\n const method = (\n /** @type {import('types').HttpMethod} */\n event.request.method\n );\n let handler = mod[method] || mod.fallback;\n if (method === \"HEAD\" && mod.GET && !mod.HEAD) {\n handler = mod.GET;\n }\n if (!handler) {\n return method_not_allowed(mod, method);\n }\n const prerender = mod.prerender ?? state.prerender_default;\n if (prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) {\n throw new Error(\"Cannot prerender endpoints that have mutative methods\");\n }\n if (state.prerendering && !prerender) {\n if (state.depth > 0) {\n throw new Error(`${event.route.id} is not prerenderable`);\n } else {\n return new Response(void 0, { status: 204 });\n }\n }\n try {\n let response = await handler(\n /** @type {import('@sveltejs/kit').RequestEvent>} */\n event\n );\n if (!(response instanceof Response)) {\n throw new Error(\n `Invalid response from route ${event.url.pathname}: handler should return a Response object`\n );\n }\n if (state.prerendering) {\n response = new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers: new Headers(response.headers)\n });\n response.headers.set(\"x-sveltekit-prerender\", String(prerender));\n }\n return response;\n } catch (e) {\n if (e instanceof Redirect) {\n return new Response(void 0, {\n status: e.status,\n headers: { location: e.location }\n });\n }\n throw e;\n }\n}\nfunction is_endpoint_request(event) {\n const { method, headers: headers2 } = event.request;\n if (ENDPOINT_METHODS.includes(method) && !PAGE_METHODS.includes(method)) {\n return true;\n }\n if (method === \"POST\" && headers2.get(\"x-sveltekit-action\") === \"true\")\n return false;\n const accept = event.request.headers.get(\"accept\") ?? \"*/*\";\n return negotiate(accept, [\"*\", \"text/html\"]) !== \"text/html\";\n}\nfunction compact(arr) {\n return arr.filter(\n /** @returns {val is NonNullable} */\n (val) => val != null\n );\n}\nfunction is_action_json_request(event) {\n const accept = negotiate(event.request.headers.get(\"accept\") ?? \"*/*\", [\n \"application/json\",\n \"text/html\"\n ]);\n return accept === \"application/json\" && event.request.method === \"POST\";\n}\nasync function handle_action_json_request(event, options2, server) {\n const actions = server?.actions;\n if (!actions) {\n const no_actions_error = new SvelteKitError(\n 405,\n \"Method Not Allowed\",\n \"POST method not allowed. No actions exist for this page\"\n );\n return action_json(\n {\n type: \"error\",\n error: await handle_error_and_jsonify(event, options2, no_actions_error)\n },\n {\n status: no_actions_error.status,\n headers: {\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405\n // \"The server must generate an Allow header field in a 405 status code response\"\n allow: \"GET\"\n }\n }\n );\n }\n check_named_default_separate(actions);\n try {\n const data = await call_action(event, actions);\n if (false)\n ;\n if (data instanceof ActionFailure) {\n return action_json({\n type: \"failure\",\n status: data.status,\n // @ts-expect-error we assign a string to what is supposed to be an object. That's ok\n // because we don't use the object outside, and this way we have better code navigation\n // through knowing where the related interface is used.\n data: stringify_action_response(\n data.data,\n /** @type {string} */\n event.route.id\n )\n });\n } else {\n return action_json({\n type: \"success\",\n status: data ? 200 : 204,\n // @ts-expect-error see comment above\n data: stringify_action_response(\n data,\n /** @type {string} */\n event.route.id\n )\n });\n }\n } catch (e) {\n const err = normalize_error(e);\n if (err instanceof Redirect) {\n return action_json_redirect(err);\n }\n return action_json(\n {\n type: \"error\",\n error: await handle_error_and_jsonify(event, options2, check_incorrect_fail_use(err))\n },\n {\n status: get_status(err)\n }\n );\n }\n}\nfunction check_incorrect_fail_use(error) {\n return error instanceof ActionFailure ? new Error('Cannot \"throw fail()\". Use \"return fail()\"') : error;\n}\nfunction action_json_redirect(redirect) {\n return action_json({\n type: \"redirect\",\n status: redirect.status,\n location: redirect.location\n });\n}\nfunction action_json(data, init2) {\n return json(data, init2);\n}\nfunction is_action_request(event) {\n return event.request.method === \"POST\";\n}\nasync function handle_action_request(event, server) {\n const actions = server?.actions;\n if (!actions) {\n event.setHeaders({\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405\n // \"The server must generate an Allow header field in a 405 status code response\"\n allow: \"GET\"\n });\n return {\n type: \"error\",\n error: new SvelteKitError(\n 405,\n \"Method Not Allowed\",\n \"POST method not allowed. No actions exist for this page\"\n )\n };\n }\n check_named_default_separate(actions);\n try {\n const data = await call_action(event, actions);\n if (false)\n ;\n if (data instanceof ActionFailure) {\n return {\n type: \"failure\",\n status: data.status,\n data: data.data\n };\n } else {\n return {\n type: \"success\",\n status: 200,\n // @ts-expect-error this will be removed upon serialization, so `undefined` is the same as omission\n data\n };\n }\n } catch (e) {\n const err = normalize_error(e);\n if (err instanceof Redirect) {\n return {\n type: \"redirect\",\n status: err.status,\n location: err.location\n };\n }\n return {\n type: \"error\",\n error: check_incorrect_fail_use(err)\n };\n }\n}\nfunction check_named_default_separate(actions) {\n if (actions.default && Object.keys(actions).length > 1) {\n throw new Error(\n \"When using named actions, the default action cannot be used. See the docs for more info: https://kit.svelte.dev/docs/form-actions#named-actions\"\n );\n }\n}\nasync function call_action(event, actions) {\n const url = new URL(event.request.url);\n let name = \"default\";\n for (const param of url.searchParams) {\n if (param[0].startsWith(\"/\")) {\n name = param[0].slice(1);\n if (name === \"default\") {\n throw new Error('Cannot use reserved action name \"default\"');\n }\n break;\n }\n }\n const action = actions[name];\n if (!action) {\n throw new SvelteKitError(404, \"Not Found\", `No action with name '${name}' found`);\n }\n if (!is_form_content_type(event.request)) {\n throw new SvelteKitError(\n 415,\n \"Unsupported Media Type\",\n `Form actions expect form-encoded data — received ${event.request.headers.get(\n \"content-type\"\n )}`\n );\n }\n return action(event);\n}\nfunction validate_action_return(data) {\n if (data instanceof Redirect) {\n throw new Error(\"Cannot `return redirect(...)` — use `redirect(...)` instead\");\n }\n if (data instanceof HttpError) {\n throw new Error(\"Cannot `return error(...)` — use `error(...)` or `return fail(...)` instead\");\n }\n}\nfunction uneval_action_response(data, route_id) {\n return try_deserialize(data, devalue.uneval, route_id);\n}\nfunction stringify_action_response(data, route_id) {\n return try_deserialize(data, devalue.stringify, route_id);\n}\nfunction try_deserialize(data, fn, route_id) {\n try {\n return fn(data);\n } catch (e) {\n const error = (\n /** @type {any} */\n e\n );\n if (\"path\" in error) {\n let message = `Data returned from action inside ${route_id} is not serializable: ${error.message}`;\n if (error.path !== \"\")\n message += ` (data.${error.path})`;\n throw new Error(message);\n }\n throw error;\n }\n}\nconst INVALIDATED_PARAM = \"x-sveltekit-invalidated\";\nconst TRAILING_SLASH_PARAM = \"x-sveltekit-trailing-slash\";\nasync function load_server_data({ event, state, node, parent }) {\n if (!node?.server)\n return null;\n let is_tracking = true;\n const uses = {\n dependencies: /* @__PURE__ */ new Set(),\n params: /* @__PURE__ */ new Set(),\n parent: false,\n route: false,\n url: false,\n search_params: /* @__PURE__ */ new Set()\n };\n const url = make_trackable(\n event.url,\n () => {\n if (is_tracking) {\n uses.url = true;\n }\n },\n (param) => {\n if (is_tracking) {\n uses.search_params.add(param);\n }\n }\n );\n if (state.prerendering) {\n disable_search(url);\n }\n const result = await node.server.load?.call(null, {\n ...event,\n fetch: (info, init2) => {\n new URL(info instanceof Request ? info.url : info, event.url);\n return event.fetch(info, init2);\n },\n /** @param {string[]} deps */\n depends: (...deps) => {\n for (const dep of deps) {\n const { href } = new URL(dep, event.url);\n uses.dependencies.add(href);\n }\n },\n params: new Proxy(event.params, {\n get: (target, key2) => {\n if (is_tracking) {\n uses.params.add(key2);\n }\n return target[\n /** @type {string} */\n key2\n ];\n }\n }),\n parent: async () => {\n if (is_tracking) {\n uses.parent = true;\n }\n return parent();\n },\n route: new Proxy(event.route, {\n get: (target, key2) => {\n if (is_tracking) {\n uses.route = true;\n }\n return target[\n /** @type {'id'} */\n key2\n ];\n }\n }),\n url,\n untrack(fn) {\n is_tracking = false;\n try {\n return fn();\n } finally {\n is_tracking = true;\n }\n }\n });\n return {\n type: \"data\",\n data: result ?? null,\n uses,\n slash: node.server.trailingSlash\n };\n}\nasync function load_data({\n event,\n fetched,\n node,\n parent,\n server_data_promise,\n state,\n resolve_opts,\n csr\n}) {\n const server_data_node = await server_data_promise;\n if (!node?.universal?.load) {\n return server_data_node?.data ?? null;\n }\n const result = await node.universal.load.call(null, {\n url: event.url,\n params: event.params,\n data: server_data_node?.data ?? null,\n route: event.route,\n fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),\n setHeaders: event.setHeaders,\n depends: () => {\n },\n parent,\n untrack: (fn) => fn()\n });\n return result ?? null;\n}\nfunction b64_encode(buffer) {\n if (globalThis.Buffer) {\n return Buffer.from(buffer).toString(\"base64\");\n }\n const little_endian = new Uint8Array(new Uint16Array([1]).buffer)[0] > 0;\n return btoa(\n new TextDecoder(little_endian ? \"utf-16le\" : \"utf-16be\").decode(\n new Uint16Array(new Uint8Array(buffer))\n )\n );\n}\nfunction create_universal_fetch(event, state, fetched, csr, resolve_opts) {\n const universal_fetch = async (input, init2) => {\n const cloned_body = input instanceof Request && input.body ? input.clone().body : null;\n const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init2?.headers;\n let response = await event.fetch(input, init2);\n const url = new URL(input instanceof Request ? input.url : input, event.url);\n const same_origin = url.origin === event.url.origin;\n let dependency;\n if (same_origin) {\n if (state.prerendering) {\n dependency = { response, body: null };\n state.prerendering.dependencies.set(url.pathname, dependency);\n }\n } else {\n const mode = input instanceof Request ? input.mode : init2?.mode ?? \"cors\";\n if (mode === \"no-cors\") {\n response = new Response(\"\", {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers\n });\n } else {\n const acao = response.headers.get(\"access-control-allow-origin\");\n if (!acao || acao !== event.url.origin && acao !== \"*\") {\n throw new Error(\n `CORS error: ${acao ? \"Incorrect\" : \"No\"} 'Access-Control-Allow-Origin' header is present on the requested resource`\n );\n }\n }\n }\n const proxy = new Proxy(response, {\n get(response2, key2, _receiver) {\n async function push_fetched(body2, is_b64) {\n const status_number = Number(response2.status);\n if (isNaN(status_number)) {\n throw new Error(\n `response.status is not a number. value: \"${response2.status}\" type: ${typeof response2.status}`\n );\n }\n fetched.push({\n url: same_origin ? url.href.slice(event.url.origin.length) : url.href,\n method: event.request.method,\n request_body: (\n /** @type {string | ArrayBufferView | undefined} */\n input instanceof Request && cloned_body ? await stream_to_string(cloned_body) : init2?.body\n ),\n request_headers: cloned_headers,\n response_body: body2,\n response: response2,\n is_b64\n });\n }\n if (key2 === \"arrayBuffer\") {\n return async () => {\n const buffer = await response2.arrayBuffer();\n if (dependency) {\n dependency.body = new Uint8Array(buffer);\n }\n if (buffer instanceof ArrayBuffer) {\n await push_fetched(b64_encode(buffer), true);\n }\n return buffer;\n };\n }\n async function text2() {\n const body2 = await response2.text();\n if (!body2 || typeof body2 === \"string\") {\n await push_fetched(body2, false);\n }\n if (dependency) {\n dependency.body = body2;\n }\n return body2;\n }\n if (key2 === \"text\") {\n return text2;\n }\n if (key2 === \"json\") {\n return async () => {\n return JSON.parse(await text2());\n };\n }\n return Reflect.get(response2, key2, response2);\n }\n });\n if (csr) {\n const get = response.headers.get;\n response.headers.get = (key2) => {\n const lower = key2.toLowerCase();\n const value = get.call(response.headers, lower);\n if (value && !lower.startsWith(\"x-sveltekit-\")) {\n const included = resolve_opts.filterSerializedResponseHeaders(lower, value);\n if (!included) {\n throw new Error(\n `Failed to get response header \"${lower}\" — it must be included by the \\`filterSerializedResponseHeaders\\` option: https://kit.svelte.dev/docs/hooks#server-hooks-handle (at ${event.route.id})`\n );\n }\n }\n return value;\n };\n }\n return proxy;\n };\n return (input, init2) => {\n const response = universal_fetch(input, init2);\n response.catch(() => {\n });\n return response;\n };\n}\nasync function stream_to_string(stream) {\n let result = \"\";\n const reader = stream.getReader();\n const decoder = new TextDecoder();\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n result += decoder.decode(value);\n }\n return result;\n}\nfunction hash(...values) {\n let hash2 = 5381;\n for (const value of values) {\n if (typeof value === \"string\") {\n let i = value.length;\n while (i)\n hash2 = hash2 * 33 ^ value.charCodeAt(--i);\n } else if (ArrayBuffer.isView(value)) {\n const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);\n let i = buffer.length;\n while (i)\n hash2 = hash2 * 33 ^ buffer[--i];\n } else {\n throw new TypeError(\"value must be a string or TypedArray\");\n }\n }\n return (hash2 >>> 0).toString(36);\n}\nconst escape_html_attr_dict = {\n \"&\": \"&\",\n '\"': \""\"\n};\nconst escape_html_attr_regex = new RegExp(\n // special characters\n `[${Object.keys(escape_html_attr_dict).join(\"\")}]|[\\\\ud800-\\\\udbff](?![\\\\udc00-\\\\udfff])|[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]|[\\\\udc00-\\\\udfff]`,\n \"g\"\n);\nfunction escape_html_attr(str) {\n const escaped_str = str.replace(escape_html_attr_regex, (match) => {\n if (match.length === 2) {\n return match;\n }\n return escape_html_attr_dict[match] ?? `&#${match.charCodeAt(0)};`;\n });\n return `\"${escaped_str}\"`;\n}\nconst replacements = {\n \"<\": \"\\\\u003C\",\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\"\n};\nconst pattern = new RegExp(`[${Object.keys(replacements).join(\"\")}]`, \"g\");\nfunction serialize_data(fetched, filter, prerendering2 = false) {\n const headers2 = {};\n let cache_control = null;\n let age = null;\n let varyAny = false;\n for (const [key2, value] of fetched.response.headers) {\n if (filter(key2, value)) {\n headers2[key2] = value;\n }\n if (key2 === \"cache-control\")\n cache_control = value;\n else if (key2 === \"age\")\n age = value;\n else if (key2 === \"vary\" && value.trim() === \"*\")\n varyAny = true;\n }\n const payload = {\n status: fetched.response.status,\n statusText: fetched.response.statusText,\n headers: headers2,\n body: fetched.response_body\n };\n const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);\n const attrs = [\n 'type=\"application/json\"',\n \"data-sveltekit-fetched\",\n `data-url=${escape_html_attr(fetched.url)}`\n ];\n if (fetched.is_b64) {\n attrs.push(\"data-b64\");\n }\n if (fetched.request_headers || fetched.request_body) {\n const values = [];\n if (fetched.request_headers) {\n values.push([...new Headers(fetched.request_headers)].join(\",\"));\n }\n if (fetched.request_body) {\n values.push(fetched.request_body);\n }\n attrs.push(`data-hash=\"${hash(...values)}\"`);\n }\n if (!prerendering2 && fetched.method === \"GET\" && cache_control && !varyAny) {\n const match = /s-maxage=(\\d+)/g.exec(cache_control) ?? /max-age=(\\d+)/g.exec(cache_control);\n if (match) {\n const ttl = +match[1] - +(age ?? \"0\");\n attrs.push(`data-ttl=\"${ttl}\"`);\n }\n }\n return `