mirror of
https://github.com/SoPat712/A2ZSoftware.git
synced 2026-02-10 07:28:39 -05:00
all
This commit is contained in:
73
.svelte-kit/output/server/.vite/manifest.json
Normal file
73
.svelte-kit/output/server/.vite/manifest.json
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
".svelte-kit/generated/server/internal.js": {
|
||||
"file": "internal.js",
|
||||
"name": "internal",
|
||||
"src": ".svelte-kit/generated/server/internal.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_internal.js"
|
||||
]
|
||||
},
|
||||
"_equality.js": {
|
||||
"file": "chunks/equality.js",
|
||||
"name": "equality"
|
||||
},
|
||||
"_exports.js": {
|
||||
"file": "chunks/exports.js",
|
||||
"name": "exports",
|
||||
"imports": [
|
||||
"_equality.js"
|
||||
]
|
||||
},
|
||||
"_index.js": {
|
||||
"file": "chunks/index.js",
|
||||
"name": "index"
|
||||
},
|
||||
"_internal.js": {
|
||||
"file": "chunks/internal.js",
|
||||
"name": "internal",
|
||||
"imports": [
|
||||
"_equality.js",
|
||||
"_index.js"
|
||||
]
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte": {
|
||||
"file": "entries/fallbacks/error.svelte.js",
|
||||
"name": "entries/fallbacks/error.svelte",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_index.js",
|
||||
"_equality.js",
|
||||
"_exports.js"
|
||||
]
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/server/index.js": {
|
||||
"file": "index.js",
|
||||
"name": "index",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/server/index.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_internal.js",
|
||||
"_exports.js"
|
||||
]
|
||||
},
|
||||
"src/routes/+layout.svelte": {
|
||||
"file": "entries/pages/_layout.svelte.js",
|
||||
"name": "entries/pages/_layout.svelte",
|
||||
"src": "src/routes/+layout.svelte",
|
||||
"isEntry": true,
|
||||
"css": [
|
||||
"_app/immutable/assets/_layout.2aiTIyXI.css"
|
||||
]
|
||||
},
|
||||
"src/routes/+page.svelte": {
|
||||
"file": "entries/pages/_page.svelte.js",
|
||||
"name": "entries/pages/_page.svelte",
|
||||
"src": "src/routes/+page.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_index.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
/*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-duration:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:rotateX(0);--tw-rotate-y:rotateY(0);--tw-rotate-z:rotateZ(0);--tw-skew-x:skewX(0);--tw-skew-y:skewY(0)}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-700:oklch(50.5% .213 27.518);--color-green-700:oklch(52.7% .154 150.069);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-900:oklch(38.1% .176 304.987);--color-pink-700:oklch(52.5% .223 3.958);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-lg:32rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-bold:700;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.z-10{z-index:10}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-12{margin-top:calc(var(--spacing)*12)}.mr-4{margin-right:calc(var(--spacing)*4)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.mb-10{margin-bottom:calc(var(--spacing)*10)}.mb-12{margin-bottom:calc(var(--spacing)*12)}.mb-16{margin-bottom:calc(var(--spacing)*16)}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.h-6{height:calc(var(--spacing)*6)}.h-16{height:calc(var(--spacing)*16)}.h-48{height:calc(var(--spacing)*48)}.min-h-screen{min-height:100vh}.w-6{width:calc(var(--spacing)*6)}.w-16{width:calc(var(--spacing)*16)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-lg{max-width:var(--container-lg)}.max-w-xs{max-width:var(--container-xs)}.flex-1{flex:1}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-4{gap:calc(var(--spacing)*4)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-6>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*6)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-8>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*8)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-x-reverse)))}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-800{border-color:var(--color-gray-800)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-transparent{background-color:#0000}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-blue-700{--tw-gradient-from:var(--color-blue-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-800{--tw-gradient-from:var(--color-blue-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-900{--tw-gradient-from:var(--color-blue-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-gray-900{--tw-gradient-from:var(--color-gray-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-pink-700{--tw-gradient-from:var(--color-pink-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-700{--tw-gradient-from:var(--color-purple-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-gray-800{--tw-gradient-to:var(--color-gray-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-700{--tw-gradient-to:var(--color-green-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-pink-700{--tw-gradient-to:var(--color-pink-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-700{--tw-gradient-to:var(--color-purple-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-900{--tw-gradient-to:var(--color-purple-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-red-700{--tw-gradient-to:var(--color-red-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.p-2{padding:calc(var(--spacing)*2)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-12{padding-block:calc(var(--spacing)*12)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-8{padding-top:calc(var(--spacing)*8)}.pt-32{padding-top:calc(var(--spacing)*32)}.pb-24{padding-bottom:calc(var(--spacing)*24)}.text-center{text-align:center}.font-sans{font-family:var(--font-sans)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-gray-100{color:var(--color-gray-100)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-white{color:var(--color-white)}.opacity-0{opacity:0}.opacity-100{opacity:1}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-300{transition-delay:.3s}.delay-500{transition-delay:.5s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-1000{--tw-duration:1s;transition-duration:1s}@media (hover:hover){.hover\:-translate-y-2:hover{--tw-translate-y:calc(var(--spacing)*-2);translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\:transform:hover{transform:var(--tw-rotate-x)var(--tw-rotate-y)var(--tw-rotate-z)var(--tw-skew-x)var(--tw-skew-y)}.hover\:bg-blue-500:hover{background-color:var(--color-blue-500)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-white:hover{color:var(--color-white)}}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}@media (min-width:40rem){.sm\:flex-row{flex-direction:row}}@media (min-width:48rem){.md\:mt-0{margin-top:calc(var(--spacing)*0)}.md\:mb-0{margin-bottom:calc(var(--spacing)*0)}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-1\/2{width:50%}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:pl-12{padding-left:calc(var(--spacing)*12)}.md\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.md\:text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}}@media (min-width:64rem){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"*";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"*";inherits:false;initial-value:rotateZ(0)}@property --tw-skew-x{syntax:"*";inherits:false;initial-value:skewX(0)}@property --tw-skew-y{syntax:"*";inherits:false;initial-value:skewY(0)}
|
||||
41
.svelte-kit/output/server/chunks/equality.js
Normal file
41
.svelte-kit/output/server/chunks/equality.js
Normal file
@@ -0,0 +1,41 @@
|
||||
var is_array = Array.isArray;
|
||||
var index_of = Array.prototype.indexOf;
|
||||
var array_from = Array.from;
|
||||
var define_property = Object.defineProperty;
|
||||
var get_descriptor = Object.getOwnPropertyDescriptor;
|
||||
var object_prototype = Object.prototype;
|
||||
var array_prototype = Array.prototype;
|
||||
var get_prototype_of = Object.getPrototypeOf;
|
||||
var is_extensible = Object.isExtensible;
|
||||
const noop = () => {
|
||||
};
|
||||
function run_all(arr) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
arr[i]();
|
||||
}
|
||||
}
|
||||
function equals(value) {
|
||||
return value === this.v;
|
||||
}
|
||||
function safe_not_equal(a, b) {
|
||||
return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
|
||||
}
|
||||
function safe_equals(value) {
|
||||
return !safe_not_equal(value, this.v);
|
||||
}
|
||||
export {
|
||||
array_prototype as a,
|
||||
get_prototype_of as b,
|
||||
is_extensible as c,
|
||||
index_of as d,
|
||||
equals as e,
|
||||
define_property as f,
|
||||
get_descriptor as g,
|
||||
array_from as h,
|
||||
is_array as i,
|
||||
safe_not_equal as j,
|
||||
noop as n,
|
||||
object_prototype as o,
|
||||
run_all as r,
|
||||
safe_equals as s
|
||||
};
|
||||
229
.svelte-kit/output/server/chunks/exports.js
Normal file
229
.svelte-kit/output/server/chunks/exports.js
Normal file
@@ -0,0 +1,229 @@
|
||||
import { n as noop, j as safe_not_equal } from "./equality.js";
|
||||
import "clsx";
|
||||
const internal = new URL("sveltekit-internal://");
|
||||
function resolve(base, path) {
|
||||
if (path[0] === "/" && path[1] === "/") return path;
|
||||
let url = new URL(base, internal);
|
||||
url = new URL(path, url);
|
||||
return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href;
|
||||
}
|
||||
function normalize_path(path, trailing_slash) {
|
||||
if (path === "/" || trailing_slash === "ignore") return path;
|
||||
if (trailing_slash === "never") {
|
||||
return path.endsWith("/") ? path.slice(0, -1) : path;
|
||||
} else if (trailing_slash === "always" && !path.endsWith("/")) {
|
||||
return path + "/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
function decode_pathname(pathname) {
|
||||
return pathname.split("%25").map(decodeURI).join("%25");
|
||||
}
|
||||
function decode_params(params) {
|
||||
for (const key in params) {
|
||||
params[key] = decodeURIComponent(params[key]);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
function make_trackable(url, callback, search_params_callback, allow_hash = false) {
|
||||
const tracked = new URL(url);
|
||||
Object.defineProperty(tracked, "searchParams", {
|
||||
value: new Proxy(tracked.searchParams, {
|
||||
get(obj, key) {
|
||||
if (key === "get" || key === "getAll" || key === "has") {
|
||||
return (param) => {
|
||||
search_params_callback(param);
|
||||
return obj[key](param);
|
||||
};
|
||||
}
|
||||
callback();
|
||||
const value = Reflect.get(obj, key);
|
||||
return typeof value === "function" ? value.bind(obj) : value;
|
||||
}
|
||||
}),
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
const tracked_url_properties = ["href", "pathname", "search", "toString", "toJSON"];
|
||||
if (allow_hash) tracked_url_properties.push("hash");
|
||||
for (const property of tracked_url_properties) {
|
||||
Object.defineProperty(tracked, property, {
|
||||
get() {
|
||||
callback();
|
||||
return url[property];
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
{
|
||||
tracked[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
|
||||
return inspect(url, opts);
|
||||
};
|
||||
tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
|
||||
return inspect(url.searchParams, opts);
|
||||
};
|
||||
}
|
||||
if (!allow_hash) {
|
||||
disable_hash(tracked);
|
||||
}
|
||||
return tracked;
|
||||
}
|
||||
function disable_hash(url) {
|
||||
allow_nodejs_console_log(url);
|
||||
Object.defineProperty(url, "hash", {
|
||||
get() {
|
||||
throw new Error(
|
||||
"Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
function disable_search(url) {
|
||||
allow_nodejs_console_log(url);
|
||||
for (const property of ["search", "searchParams"]) {
|
||||
Object.defineProperty(url, property, {
|
||||
get() {
|
||||
throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function allow_nodejs_console_log(url) {
|
||||
{
|
||||
url[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
|
||||
return inspect(new URL(url), opts);
|
||||
};
|
||||
}
|
||||
}
|
||||
const subscriber_queue = [];
|
||||
function readable(value, start) {
|
||||
return {
|
||||
subscribe: writable(value, start).subscribe
|
||||
};
|
||||
}
|
||||
function writable(value, start = noop) {
|
||||
let stop = null;
|
||||
const subscribers = /* @__PURE__ */ new Set();
|
||||
function set(new_value) {
|
||||
if (safe_not_equal(value, new_value)) {
|
||||
value = new_value;
|
||||
if (stop) {
|
||||
const run_queue = !subscriber_queue.length;
|
||||
for (const subscriber of subscribers) {
|
||||
subscriber[1]();
|
||||
subscriber_queue.push(subscriber, value);
|
||||
}
|
||||
if (run_queue) {
|
||||
for (let i = 0; i < subscriber_queue.length; i += 2) {
|
||||
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
||||
}
|
||||
subscriber_queue.length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function update(fn) {
|
||||
set(fn(
|
||||
/** @type {T} */
|
||||
value
|
||||
));
|
||||
}
|
||||
function subscribe(run, invalidate = noop) {
|
||||
const subscriber = [run, invalidate];
|
||||
subscribers.add(subscriber);
|
||||
if (subscribers.size === 1) {
|
||||
stop = start(set, update) || noop;
|
||||
}
|
||||
run(
|
||||
/** @type {T} */
|
||||
value
|
||||
);
|
||||
return () => {
|
||||
subscribers.delete(subscriber);
|
||||
if (subscribers.size === 0 && stop) {
|
||||
stop();
|
||||
stop = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
return { set, update, subscribe };
|
||||
}
|
||||
function validator(expected) {
|
||||
function validate(module, file) {
|
||||
if (!module) return;
|
||||
for (const key in module) {
|
||||
if (key[0] === "_" || expected.has(key)) continue;
|
||||
const values = [...expected.values()];
|
||||
const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
|
||||
throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
|
||||
}
|
||||
}
|
||||
return validate;
|
||||
}
|
||||
function hint_for_supported_files(key, ext = ".js") {
|
||||
const supported_files = [];
|
||||
if (valid_layout_exports.has(key)) {
|
||||
supported_files.push(`+layout${ext}`);
|
||||
}
|
||||
if (valid_page_exports.has(key)) {
|
||||
supported_files.push(`+page${ext}`);
|
||||
}
|
||||
if (valid_layout_server_exports.has(key)) {
|
||||
supported_files.push(`+layout.server${ext}`);
|
||||
}
|
||||
if (valid_page_server_exports.has(key)) {
|
||||
supported_files.push(`+page.server${ext}`);
|
||||
}
|
||||
if (valid_server_exports.has(key)) {
|
||||
supported_files.push(`+server${ext}`);
|
||||
}
|
||||
if (supported_files.length > 0) {
|
||||
return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
|
||||
}
|
||||
}
|
||||
const valid_layout_exports = /* @__PURE__ */ new Set([
|
||||
"load",
|
||||
"prerender",
|
||||
"csr",
|
||||
"ssr",
|
||||
"trailingSlash",
|
||||
"config"
|
||||
]);
|
||||
const valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
|
||||
const valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
|
||||
const valid_page_server_exports = /* @__PURE__ */ new Set([...valid_layout_server_exports, "actions", "entries"]);
|
||||
const valid_server_exports = /* @__PURE__ */ new Set([
|
||||
"GET",
|
||||
"POST",
|
||||
"PATCH",
|
||||
"PUT",
|
||||
"DELETE",
|
||||
"OPTIONS",
|
||||
"HEAD",
|
||||
"fallback",
|
||||
"prerender",
|
||||
"trailingSlash",
|
||||
"config",
|
||||
"entries"
|
||||
]);
|
||||
const validate_layout_exports = validator(valid_layout_exports);
|
||||
const validate_page_exports = validator(valid_page_exports);
|
||||
const validate_layout_server_exports = validator(valid_layout_server_exports);
|
||||
const validate_page_server_exports = validator(valid_page_server_exports);
|
||||
const validate_server_exports = validator(valid_server_exports);
|
||||
export {
|
||||
decode_params as a,
|
||||
validate_layout_exports as b,
|
||||
validate_page_server_exports as c,
|
||||
disable_search as d,
|
||||
validate_page_exports as e,
|
||||
resolve as f,
|
||||
decode_pathname as g,
|
||||
validate_server_exports as h,
|
||||
make_trackable as m,
|
||||
normalize_path as n,
|
||||
readable as r,
|
||||
validate_layout_server_exports as v,
|
||||
writable as w
|
||||
};
|
||||
141
.svelte-kit/output/server/chunks/index.js
Normal file
141
.svelte-kit/output/server/chunks/index.js
Normal file
@@ -0,0 +1,141 @@
|
||||
import "clsx";
|
||||
const HYDRATION_START = "[";
|
||||
const HYDRATION_END = "]";
|
||||
const HYDRATION_ERROR = {};
|
||||
const UNINITIALIZED = Symbol();
|
||||
function lifecycle_outside_component(name) {
|
||||
{
|
||||
throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
|
||||
}
|
||||
}
|
||||
const ATTR_REGEX = /[&"<]/g;
|
||||
const CONTENT_REGEX = /[&<]/g;
|
||||
function escape_html(value, is_attr) {
|
||||
const str = String(value ?? "");
|
||||
const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
|
||||
pattern.lastIndex = 0;
|
||||
let escaped = "";
|
||||
let last = 0;
|
||||
while (pattern.test(str)) {
|
||||
const i = pattern.lastIndex - 1;
|
||||
const ch = str[i];
|
||||
escaped += str.substring(last, i) + (ch === "&" ? "&" : ch === '"' ? """ : "<");
|
||||
last = i + 1;
|
||||
}
|
||||
return escaped + str.substring(last);
|
||||
}
|
||||
function to_class(value, hash, directives) {
|
||||
var classname = value == null ? "" : "" + value;
|
||||
return classname === "" ? null : classname;
|
||||
}
|
||||
var current_component = null;
|
||||
function getContext(key) {
|
||||
const context_map = get_or_init_context_map();
|
||||
const result = (
|
||||
/** @type {T} */
|
||||
context_map.get(key)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
function setContext(key, context) {
|
||||
get_or_init_context_map().set(key, context);
|
||||
return context;
|
||||
}
|
||||
function get_or_init_context_map(name) {
|
||||
if (current_component === null) {
|
||||
lifecycle_outside_component();
|
||||
}
|
||||
return current_component.c ??= new Map(get_parent_context(current_component) || void 0);
|
||||
}
|
||||
function push(fn) {
|
||||
current_component = { p: current_component, c: null, d: null };
|
||||
}
|
||||
function pop() {
|
||||
var component = (
|
||||
/** @type {Component} */
|
||||
current_component
|
||||
);
|
||||
var ondestroy = component.d;
|
||||
if (ondestroy) {
|
||||
on_destroy.push(...ondestroy);
|
||||
}
|
||||
current_component = component.p;
|
||||
}
|
||||
function get_parent_context(component_context) {
|
||||
let parent = component_context.p;
|
||||
while (parent !== null) {
|
||||
const context_map = parent.c;
|
||||
if (context_map !== null) {
|
||||
return context_map;
|
||||
}
|
||||
parent = parent.p;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
|
||||
const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
|
||||
let on_destroy = [];
|
||||
function props_id_generator(prefix) {
|
||||
let uid = 1;
|
||||
return () => `${prefix}s${uid++}`;
|
||||
}
|
||||
function render(component, options = {}) {
|
||||
const uid = props_id_generator(options.idPrefix ? options.idPrefix + "-" : "");
|
||||
const payload = {
|
||||
out: "",
|
||||
css: /* @__PURE__ */ new Set(),
|
||||
head: { title: "", out: "", css: /* @__PURE__ */ new Set(), uid },
|
||||
uid
|
||||
};
|
||||
const prev_on_destroy = on_destroy;
|
||||
on_destroy = [];
|
||||
payload.out += BLOCK_OPEN;
|
||||
if (options.context) {
|
||||
push();
|
||||
current_component.c = options.context;
|
||||
}
|
||||
component(payload, options.props ?? {}, {}, {});
|
||||
if (options.context) {
|
||||
pop();
|
||||
}
|
||||
payload.out += BLOCK_CLOSE;
|
||||
for (const cleanup of on_destroy) cleanup();
|
||||
on_destroy = prev_on_destroy;
|
||||
let head = payload.head.out + payload.head.title;
|
||||
for (const { hash, code } of payload.css) {
|
||||
head += `<style id="${hash}">${code}</style>`;
|
||||
}
|
||||
return {
|
||||
head,
|
||||
html: payload.out,
|
||||
body: payload.out
|
||||
};
|
||||
}
|
||||
function stringify(value) {
|
||||
return true ? value : value == null ? "" : value + "";
|
||||
}
|
||||
function attr_class(value, hash, directives) {
|
||||
var result = to_class(value);
|
||||
return result ? ` class="${escape_html(result, true)}"` : "";
|
||||
}
|
||||
function ensure_array_like(array_like_or_iterator) {
|
||||
if (array_like_or_iterator) {
|
||||
return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
export {
|
||||
HYDRATION_ERROR as H,
|
||||
UNINITIALIZED as U,
|
||||
HYDRATION_START as a,
|
||||
HYDRATION_END as b,
|
||||
pop as c,
|
||||
ensure_array_like as d,
|
||||
escape_html as e,
|
||||
attr_class as f,
|
||||
getContext as g,
|
||||
stringify as h,
|
||||
push as p,
|
||||
render as r,
|
||||
setContext as s
|
||||
};
|
||||
1771
.svelte-kit/output/server/chunks/internal.js
Normal file
1771
.svelte-kit/output/server/chunks/internal.js
Normal file
@@ -0,0 +1,1771 @@
|
||||
import { o as object_prototype, a as array_prototype, g as get_descriptor, b as get_prototype_of, i as is_array, s as safe_equals, e as equals, c as is_extensible, r as run_all, d as index_of, f as define_property, h as array_from } from "./equality.js";
|
||||
import { U as UNINITIALIZED, H as HYDRATION_ERROR, a as HYDRATION_START, b as HYDRATION_END, r as render, p as push$1, s as setContext, c as pop$1 } from "./index.js";
|
||||
import "clsx";
|
||||
const BROWSER = false;
|
||||
let base = "";
|
||||
let assets = base;
|
||||
const app_dir = "_app";
|
||||
const initial = { base, assets };
|
||||
function override(paths) {
|
||||
base = paths.base;
|
||||
assets = paths.assets;
|
||||
}
|
||||
function reset() {
|
||||
base = initial.base;
|
||||
assets = initial.assets;
|
||||
}
|
||||
function set_assets(path) {
|
||||
assets = initial.assets = path;
|
||||
}
|
||||
let public_env = {};
|
||||
let safe_public_env = {};
|
||||
function set_private_env(environment) {
|
||||
}
|
||||
function set_public_env(environment) {
|
||||
public_env = environment;
|
||||
}
|
||||
function set_safe_public_env(environment) {
|
||||
safe_public_env = environment;
|
||||
}
|
||||
const DERIVED = 1 << 1;
|
||||
const EFFECT = 1 << 2;
|
||||
const RENDER_EFFECT = 1 << 3;
|
||||
const BLOCK_EFFECT = 1 << 4;
|
||||
const BRANCH_EFFECT = 1 << 5;
|
||||
const ROOT_EFFECT = 1 << 6;
|
||||
const BOUNDARY_EFFECT = 1 << 7;
|
||||
const UNOWNED = 1 << 8;
|
||||
const DISCONNECTED = 1 << 9;
|
||||
const CLEAN = 1 << 10;
|
||||
const DIRTY = 1 << 11;
|
||||
const MAYBE_DIRTY = 1 << 12;
|
||||
const INERT = 1 << 13;
|
||||
const DESTROYED = 1 << 14;
|
||||
const EFFECT_RAN = 1 << 15;
|
||||
const EFFECT_TRANSPARENT = 1 << 16;
|
||||
const HEAD_EFFECT = 1 << 19;
|
||||
const EFFECT_HAS_DERIVED = 1 << 20;
|
||||
const EFFECT_IS_UPDATING = 1 << 21;
|
||||
const STATE_SYMBOL = Symbol("$state");
|
||||
const LEGACY_PROPS = Symbol("legacy props");
|
||||
function effect_update_depth_exceeded() {
|
||||
{
|
||||
throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
|
||||
}
|
||||
}
|
||||
function hydration_failed() {
|
||||
{
|
||||
throw new Error(`https://svelte.dev/e/hydration_failed`);
|
||||
}
|
||||
}
|
||||
function state_descriptors_fixed() {
|
||||
{
|
||||
throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
|
||||
}
|
||||
}
|
||||
function state_prototype_fixed() {
|
||||
{
|
||||
throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
|
||||
}
|
||||
}
|
||||
function state_unsafe_mutation() {
|
||||
{
|
||||
throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
|
||||
}
|
||||
}
|
||||
let tracing_mode_flag = false;
|
||||
let component_context = null;
|
||||
function set_component_context(context) {
|
||||
component_context = context;
|
||||
}
|
||||
function push(props, runes = false, fn) {
|
||||
var ctx = component_context = {
|
||||
p: component_context,
|
||||
c: null,
|
||||
d: false,
|
||||
e: null,
|
||||
m: false,
|
||||
s: props,
|
||||
x: null,
|
||||
l: null
|
||||
};
|
||||
teardown(() => {
|
||||
ctx.d = true;
|
||||
});
|
||||
}
|
||||
function pop(component) {
|
||||
const context_stack_item = component_context;
|
||||
if (context_stack_item !== null) {
|
||||
const component_effects = context_stack_item.e;
|
||||
if (component_effects !== null) {
|
||||
var previous_effect = active_effect;
|
||||
var previous_reaction = active_reaction;
|
||||
context_stack_item.e = null;
|
||||
try {
|
||||
for (var i = 0; i < component_effects.length; i++) {
|
||||
var component_effect = component_effects[i];
|
||||
set_active_effect(component_effect.effect);
|
||||
set_active_reaction(component_effect.reaction);
|
||||
effect(component_effect.fn);
|
||||
}
|
||||
} finally {
|
||||
set_active_effect(previous_effect);
|
||||
set_active_reaction(previous_reaction);
|
||||
}
|
||||
}
|
||||
component_context = context_stack_item.p;
|
||||
context_stack_item.m = true;
|
||||
}
|
||||
return (
|
||||
/** @type {T} */
|
||||
{}
|
||||
);
|
||||
}
|
||||
function is_runes() {
|
||||
return true;
|
||||
}
|
||||
function proxy(value) {
|
||||
if (typeof value !== "object" || value === null || STATE_SYMBOL in value) {
|
||||
return value;
|
||||
}
|
||||
const prototype = get_prototype_of(value);
|
||||
if (prototype !== object_prototype && prototype !== array_prototype) {
|
||||
return value;
|
||||
}
|
||||
var sources = /* @__PURE__ */ new Map();
|
||||
var is_proxied_array = is_array(value);
|
||||
var version = /* @__PURE__ */ state(0);
|
||||
var reaction = active_reaction;
|
||||
var with_parent = (fn) => {
|
||||
var previous_reaction = active_reaction;
|
||||
set_active_reaction(reaction);
|
||||
var result = fn();
|
||||
set_active_reaction(previous_reaction);
|
||||
return result;
|
||||
};
|
||||
if (is_proxied_array) {
|
||||
sources.set("length", /* @__PURE__ */ state(
|
||||
/** @type {any[]} */
|
||||
value.length
|
||||
));
|
||||
}
|
||||
return new Proxy(
|
||||
/** @type {any} */
|
||||
value,
|
||||
{
|
||||
defineProperty(_, prop, descriptor) {
|
||||
if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) {
|
||||
state_descriptors_fixed();
|
||||
}
|
||||
var s = sources.get(prop);
|
||||
if (s === void 0) {
|
||||
s = with_parent(() => /* @__PURE__ */ state(descriptor.value));
|
||||
sources.set(prop, s);
|
||||
} else {
|
||||
set(
|
||||
s,
|
||||
with_parent(() => proxy(descriptor.value))
|
||||
);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, prop) {
|
||||
var s = sources.get(prop);
|
||||
if (s === void 0) {
|
||||
if (prop in target) {
|
||||
sources.set(
|
||||
prop,
|
||||
with_parent(() => /* @__PURE__ */ state(UNINITIALIZED))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (is_proxied_array && typeof prop === "string") {
|
||||
var ls = (
|
||||
/** @type {Source<number>} */
|
||||
sources.get("length")
|
||||
);
|
||||
var n = Number(prop);
|
||||
if (Number.isInteger(n) && n < ls.v) {
|
||||
set(ls, n);
|
||||
}
|
||||
}
|
||||
set(s, UNINITIALIZED);
|
||||
update_version(version);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
get(target, prop, receiver) {
|
||||
if (prop === STATE_SYMBOL) {
|
||||
return value;
|
||||
}
|
||||
var s = sources.get(prop);
|
||||
var exists = prop in target;
|
||||
if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
|
||||
s = with_parent(() => /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED)));
|
||||
sources.set(prop, s);
|
||||
}
|
||||
if (s !== void 0) {
|
||||
var v = get(s);
|
||||
return v === UNINITIALIZED ? void 0 : v;
|
||||
}
|
||||
return Reflect.get(target, prop, receiver);
|
||||
},
|
||||
getOwnPropertyDescriptor(target, prop) {
|
||||
var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
||||
if (descriptor && "value" in descriptor) {
|
||||
var s = sources.get(prop);
|
||||
if (s) descriptor.value = get(s);
|
||||
} else if (descriptor === void 0) {
|
||||
var source2 = sources.get(prop);
|
||||
var value2 = source2?.v;
|
||||
if (source2 !== void 0 && value2 !== UNINITIALIZED) {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: value2,
|
||||
writable: true
|
||||
};
|
||||
}
|
||||
}
|
||||
return descriptor;
|
||||
},
|
||||
has(target, prop) {
|
||||
if (prop === STATE_SYMBOL) {
|
||||
return true;
|
||||
}
|
||||
var s = sources.get(prop);
|
||||
var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
|
||||
if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
|
||||
if (s === void 0) {
|
||||
s = with_parent(() => /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED));
|
||||
sources.set(prop, s);
|
||||
}
|
||||
var value2 = get(s);
|
||||
if (value2 === UNINITIALIZED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return has;
|
||||
},
|
||||
set(target, prop, value2, receiver) {
|
||||
var s = sources.get(prop);
|
||||
var has = prop in target;
|
||||
if (is_proxied_array && prop === "length") {
|
||||
for (var i = value2; i < /** @type {Source<number>} */
|
||||
s.v; i += 1) {
|
||||
var other_s = sources.get(i + "");
|
||||
if (other_s !== void 0) {
|
||||
set(other_s, UNINITIALIZED);
|
||||
} else if (i in target) {
|
||||
other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
|
||||
sources.set(i + "", other_s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s === void 0) {
|
||||
if (!has || get_descriptor(target, prop)?.writable) {
|
||||
s = with_parent(() => /* @__PURE__ */ state(void 0));
|
||||
set(
|
||||
s,
|
||||
with_parent(() => proxy(value2))
|
||||
);
|
||||
sources.set(prop, s);
|
||||
}
|
||||
} else {
|
||||
has = s.v !== UNINITIALIZED;
|
||||
set(
|
||||
s,
|
||||
with_parent(() => proxy(value2))
|
||||
);
|
||||
}
|
||||
var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
||||
if (descriptor?.set) {
|
||||
descriptor.set.call(receiver, value2);
|
||||
}
|
||||
if (!has) {
|
||||
if (is_proxied_array && typeof prop === "string") {
|
||||
var ls = (
|
||||
/** @type {Source<number>} */
|
||||
sources.get("length")
|
||||
);
|
||||
var n = Number(prop);
|
||||
if (Number.isInteger(n) && n >= ls.v) {
|
||||
set(ls, n + 1);
|
||||
}
|
||||
}
|
||||
update_version(version);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
ownKeys(target) {
|
||||
get(version);
|
||||
var own_keys = Reflect.ownKeys(target).filter((key2) => {
|
||||
var source3 = sources.get(key2);
|
||||
return source3 === void 0 || source3.v !== UNINITIALIZED;
|
||||
});
|
||||
for (var [key, source2] of sources) {
|
||||
if (source2.v !== UNINITIALIZED && !(key in target)) {
|
||||
own_keys.push(key);
|
||||
}
|
||||
}
|
||||
return own_keys;
|
||||
},
|
||||
setPrototypeOf() {
|
||||
state_prototype_fixed();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
function update_version(signal, d = 1) {
|
||||
set(signal, signal.v + d);
|
||||
}
|
||||
function destroy_derived_effects(derived) {
|
||||
var effects = derived.effects;
|
||||
if (effects !== null) {
|
||||
derived.effects = null;
|
||||
for (var i = 0; i < effects.length; i += 1) {
|
||||
destroy_effect(
|
||||
/** @type {Effect} */
|
||||
effects[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function get_derived_parent_effect(derived) {
|
||||
var parent = derived.parent;
|
||||
while (parent !== null) {
|
||||
if ((parent.f & DERIVED) === 0) {
|
||||
return (
|
||||
/** @type {Effect} */
|
||||
parent
|
||||
);
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function execute_derived(derived) {
|
||||
var value;
|
||||
var prev_active_effect = active_effect;
|
||||
set_active_effect(get_derived_parent_effect(derived));
|
||||
{
|
||||
try {
|
||||
destroy_derived_effects(derived);
|
||||
value = update_reaction(derived);
|
||||
} finally {
|
||||
set_active_effect(prev_active_effect);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function update_derived(derived) {
|
||||
var value = execute_derived(derived);
|
||||
var status = (skip_reaction || (derived.f & UNOWNED) !== 0) && derived.deps !== null ? MAYBE_DIRTY : CLEAN;
|
||||
set_signal_status(derived, status);
|
||||
if (!derived.equals(value)) {
|
||||
derived.v = value;
|
||||
derived.wv = increment_write_version();
|
||||
}
|
||||
}
|
||||
const old_values = /* @__PURE__ */ new Map();
|
||||
function source(v, stack) {
|
||||
var signal = {
|
||||
f: 0,
|
||||
// TODO ideally we could skip this altogether, but it causes type errors
|
||||
v,
|
||||
reactions: null,
|
||||
equals,
|
||||
rv: 0,
|
||||
wv: 0
|
||||
};
|
||||
return signal;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function state(v, stack) {
|
||||
const s = source(v);
|
||||
push_reaction_value(s);
|
||||
return s;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function mutable_source(initial_value, immutable = false) {
|
||||
const s = source(initial_value);
|
||||
if (!immutable) {
|
||||
s.equals = safe_equals;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
function set(source2, value, should_proxy = false) {
|
||||
if (active_reaction !== null && !untracking && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT)) !== 0 && !reaction_sources?.includes(source2)) {
|
||||
state_unsafe_mutation();
|
||||
}
|
||||
let new_value = should_proxy ? proxy(value) : value;
|
||||
return internal_set(source2, new_value);
|
||||
}
|
||||
function internal_set(source2, value) {
|
||||
if (!source2.equals(value)) {
|
||||
var old_value = source2.v;
|
||||
if (is_destroying_effect) {
|
||||
old_values.set(source2, value);
|
||||
} else {
|
||||
old_values.set(source2, old_value);
|
||||
}
|
||||
source2.v = value;
|
||||
if ((source2.f & DERIVED) !== 0) {
|
||||
if ((source2.f & DIRTY) !== 0) {
|
||||
execute_derived(
|
||||
/** @type {Derived} */
|
||||
source2
|
||||
);
|
||||
}
|
||||
set_signal_status(source2, (source2.f & UNOWNED) === 0 ? CLEAN : MAYBE_DIRTY);
|
||||
}
|
||||
source2.wv = increment_write_version();
|
||||
mark_reactions(source2, DIRTY);
|
||||
if (active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
|
||||
if (untracked_writes === null) {
|
||||
set_untracked_writes([source2]);
|
||||
} else {
|
||||
untracked_writes.push(source2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function mark_reactions(signal, status) {
|
||||
var reactions = signal.reactions;
|
||||
if (reactions === null) return;
|
||||
var length = reactions.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var reaction = reactions[i];
|
||||
var flags = reaction.f;
|
||||
if ((flags & DIRTY) !== 0) continue;
|
||||
set_signal_status(reaction, status);
|
||||
if ((flags & (CLEAN | UNOWNED)) !== 0) {
|
||||
if ((flags & DERIVED) !== 0) {
|
||||
mark_reactions(
|
||||
/** @type {Derived} */
|
||||
reaction,
|
||||
MAYBE_DIRTY
|
||||
);
|
||||
} else {
|
||||
schedule_effect(
|
||||
/** @type {Effect} */
|
||||
reaction
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function hydration_mismatch(location) {
|
||||
{
|
||||
console.warn(`https://svelte.dev/e/hydration_mismatch`);
|
||||
}
|
||||
}
|
||||
let hydrating = false;
|
||||
function set_hydrating(value) {
|
||||
hydrating = value;
|
||||
}
|
||||
let hydrate_node;
|
||||
function set_hydrate_node(node) {
|
||||
if (node === null) {
|
||||
hydration_mismatch();
|
||||
throw HYDRATION_ERROR;
|
||||
}
|
||||
return hydrate_node = node;
|
||||
}
|
||||
function hydrate_next() {
|
||||
return set_hydrate_node(
|
||||
/** @type {TemplateNode} */
|
||||
/* @__PURE__ */ get_next_sibling(hydrate_node)
|
||||
);
|
||||
}
|
||||
var $window;
|
||||
var first_child_getter;
|
||||
var next_sibling_getter;
|
||||
function init_operations() {
|
||||
if ($window !== void 0) {
|
||||
return;
|
||||
}
|
||||
$window = window;
|
||||
var element_prototype = Element.prototype;
|
||||
var node_prototype = Node.prototype;
|
||||
var text_prototype = Text.prototype;
|
||||
first_child_getter = get_descriptor(node_prototype, "firstChild").get;
|
||||
next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
|
||||
if (is_extensible(element_prototype)) {
|
||||
element_prototype.__click = void 0;
|
||||
element_prototype.__className = void 0;
|
||||
element_prototype.__attributes = null;
|
||||
element_prototype.__style = void 0;
|
||||
element_prototype.__e = void 0;
|
||||
}
|
||||
if (is_extensible(text_prototype)) {
|
||||
text_prototype.__t = void 0;
|
||||
}
|
||||
}
|
||||
function create_text(value = "") {
|
||||
return document.createTextNode(value);
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function get_first_child(node) {
|
||||
return first_child_getter.call(node);
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function get_next_sibling(node) {
|
||||
return next_sibling_getter.call(node);
|
||||
}
|
||||
function clear_text_content(node) {
|
||||
node.textContent = "";
|
||||
}
|
||||
function push_effect(effect2, parent_effect) {
|
||||
var parent_last = parent_effect.last;
|
||||
if (parent_last === null) {
|
||||
parent_effect.last = parent_effect.first = effect2;
|
||||
} else {
|
||||
parent_last.next = effect2;
|
||||
effect2.prev = parent_last;
|
||||
parent_effect.last = effect2;
|
||||
}
|
||||
}
|
||||
function create_effect(type, fn, sync, push2 = true) {
|
||||
var parent = active_effect;
|
||||
var effect2 = {
|
||||
ctx: component_context,
|
||||
deps: null,
|
||||
nodes_start: null,
|
||||
nodes_end: null,
|
||||
f: type | DIRTY,
|
||||
first: null,
|
||||
fn,
|
||||
last: null,
|
||||
next: null,
|
||||
parent,
|
||||
prev: null,
|
||||
teardown: null,
|
||||
transitions: null,
|
||||
wv: 0
|
||||
};
|
||||
if (sync) {
|
||||
try {
|
||||
update_effect(effect2);
|
||||
effect2.f |= EFFECT_RAN;
|
||||
} catch (e) {
|
||||
destroy_effect(effect2);
|
||||
throw e;
|
||||
}
|
||||
} else if (fn !== null) {
|
||||
schedule_effect(effect2);
|
||||
}
|
||||
var inert = sync && effect2.deps === null && effect2.first === null && effect2.nodes_start === null && effect2.teardown === null && (effect2.f & (EFFECT_HAS_DERIVED | BOUNDARY_EFFECT)) === 0;
|
||||
if (!inert && push2) {
|
||||
if (parent !== null) {
|
||||
push_effect(effect2, parent);
|
||||
}
|
||||
if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0) {
|
||||
var derived = (
|
||||
/** @type {Derived} */
|
||||
active_reaction
|
||||
);
|
||||
(derived.effects ??= []).push(effect2);
|
||||
}
|
||||
}
|
||||
return effect2;
|
||||
}
|
||||
function teardown(fn) {
|
||||
const effect2 = create_effect(RENDER_EFFECT, null, false);
|
||||
set_signal_status(effect2, CLEAN);
|
||||
effect2.teardown = fn;
|
||||
return effect2;
|
||||
}
|
||||
function component_root(fn) {
|
||||
const effect2 = create_effect(ROOT_EFFECT, fn, true);
|
||||
return (options2 = {}) => {
|
||||
return new Promise((fulfil) => {
|
||||
if (options2.outro) {
|
||||
pause_effect(effect2, () => {
|
||||
destroy_effect(effect2);
|
||||
fulfil(void 0);
|
||||
});
|
||||
} else {
|
||||
destroy_effect(effect2);
|
||||
fulfil(void 0);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
function effect(fn) {
|
||||
return create_effect(EFFECT, fn, false);
|
||||
}
|
||||
function branch(fn, push2 = true) {
|
||||
return create_effect(RENDER_EFFECT | BRANCH_EFFECT, fn, true, push2);
|
||||
}
|
||||
function execute_effect_teardown(effect2) {
|
||||
var teardown2 = effect2.teardown;
|
||||
if (teardown2 !== null) {
|
||||
const previously_destroying_effect = is_destroying_effect;
|
||||
const previous_reaction = active_reaction;
|
||||
set_is_destroying_effect(true);
|
||||
set_active_reaction(null);
|
||||
try {
|
||||
teardown2.call(null);
|
||||
} finally {
|
||||
set_is_destroying_effect(previously_destroying_effect);
|
||||
set_active_reaction(previous_reaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
function destroy_effect_children(signal, remove_dom = false) {
|
||||
var effect2 = signal.first;
|
||||
signal.first = signal.last = null;
|
||||
while (effect2 !== null) {
|
||||
var next = effect2.next;
|
||||
if ((effect2.f & ROOT_EFFECT) !== 0) {
|
||||
effect2.parent = null;
|
||||
} else {
|
||||
destroy_effect(effect2, remove_dom);
|
||||
}
|
||||
effect2 = next;
|
||||
}
|
||||
}
|
||||
function destroy_block_effect_children(signal) {
|
||||
var effect2 = signal.first;
|
||||
while (effect2 !== null) {
|
||||
var next = effect2.next;
|
||||
if ((effect2.f & BRANCH_EFFECT) === 0) {
|
||||
destroy_effect(effect2);
|
||||
}
|
||||
effect2 = next;
|
||||
}
|
||||
}
|
||||
function destroy_effect(effect2, remove_dom = true) {
|
||||
var removed = false;
|
||||
if ((remove_dom || (effect2.f & HEAD_EFFECT) !== 0) && effect2.nodes_start !== null) {
|
||||
var node = effect2.nodes_start;
|
||||
var end = effect2.nodes_end;
|
||||
while (node !== null) {
|
||||
var next = node === end ? null : (
|
||||
/** @type {TemplateNode} */
|
||||
/* @__PURE__ */ get_next_sibling(node)
|
||||
);
|
||||
node.remove();
|
||||
node = next;
|
||||
}
|
||||
removed = true;
|
||||
}
|
||||
destroy_effect_children(effect2, remove_dom && !removed);
|
||||
remove_reactions(effect2, 0);
|
||||
set_signal_status(effect2, DESTROYED);
|
||||
var transitions = effect2.transitions;
|
||||
if (transitions !== null) {
|
||||
for (const transition of transitions) {
|
||||
transition.stop();
|
||||
}
|
||||
}
|
||||
execute_effect_teardown(effect2);
|
||||
var parent = effect2.parent;
|
||||
if (parent !== null && parent.first !== null) {
|
||||
unlink_effect(effect2);
|
||||
}
|
||||
effect2.next = effect2.prev = effect2.teardown = effect2.ctx = effect2.deps = effect2.fn = effect2.nodes_start = effect2.nodes_end = null;
|
||||
}
|
||||
function unlink_effect(effect2) {
|
||||
var parent = effect2.parent;
|
||||
var prev = effect2.prev;
|
||||
var next = effect2.next;
|
||||
if (prev !== null) prev.next = next;
|
||||
if (next !== null) next.prev = prev;
|
||||
if (parent !== null) {
|
||||
if (parent.first === effect2) parent.first = next;
|
||||
if (parent.last === effect2) parent.last = prev;
|
||||
}
|
||||
}
|
||||
function pause_effect(effect2, callback) {
|
||||
var transitions = [];
|
||||
pause_children(effect2, transitions, true);
|
||||
run_out_transitions(transitions, () => {
|
||||
destroy_effect(effect2);
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
function run_out_transitions(transitions, fn) {
|
||||
var remaining = transitions.length;
|
||||
if (remaining > 0) {
|
||||
var check = () => --remaining || fn();
|
||||
for (var transition of transitions) {
|
||||
transition.out(check);
|
||||
}
|
||||
} else {
|
||||
fn();
|
||||
}
|
||||
}
|
||||
function pause_children(effect2, transitions, local) {
|
||||
if ((effect2.f & INERT) !== 0) return;
|
||||
effect2.f ^= INERT;
|
||||
if (effect2.transitions !== null) {
|
||||
for (const transition of effect2.transitions) {
|
||||
if (transition.is_global || local) {
|
||||
transitions.push(transition);
|
||||
}
|
||||
}
|
||||
}
|
||||
var child = effect2.first;
|
||||
while (child !== null) {
|
||||
var sibling = child.next;
|
||||
var transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || (child.f & BRANCH_EFFECT) !== 0;
|
||||
pause_children(child, transitions, transparent ? local : false);
|
||||
child = sibling;
|
||||
}
|
||||
}
|
||||
let micro_tasks = [];
|
||||
let idle_tasks = [];
|
||||
function run_micro_tasks() {
|
||||
var tasks = micro_tasks;
|
||||
micro_tasks = [];
|
||||
run_all(tasks);
|
||||
}
|
||||
function run_idle_tasks() {
|
||||
var tasks = idle_tasks;
|
||||
idle_tasks = [];
|
||||
run_all(tasks);
|
||||
}
|
||||
function flush_tasks() {
|
||||
if (micro_tasks.length > 0) {
|
||||
run_micro_tasks();
|
||||
}
|
||||
if (idle_tasks.length > 0) {
|
||||
run_idle_tasks();
|
||||
}
|
||||
}
|
||||
let is_throwing_error = false;
|
||||
let is_flushing = false;
|
||||
let last_scheduled_effect = null;
|
||||
let is_updating_effect = false;
|
||||
let is_destroying_effect = false;
|
||||
function set_is_destroying_effect(value) {
|
||||
is_destroying_effect = value;
|
||||
}
|
||||
let queued_root_effects = [];
|
||||
let dev_effect_stack = [];
|
||||
let active_reaction = null;
|
||||
let untracking = false;
|
||||
function set_active_reaction(reaction) {
|
||||
active_reaction = reaction;
|
||||
}
|
||||
let active_effect = null;
|
||||
function set_active_effect(effect2) {
|
||||
active_effect = effect2;
|
||||
}
|
||||
let reaction_sources = null;
|
||||
function set_reaction_sources(sources) {
|
||||
reaction_sources = sources;
|
||||
}
|
||||
function push_reaction_value(value) {
|
||||
if (active_reaction !== null && active_reaction.f & EFFECT_IS_UPDATING) {
|
||||
if (reaction_sources === null) {
|
||||
set_reaction_sources([value]);
|
||||
} else {
|
||||
reaction_sources.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
let new_deps = null;
|
||||
let skipped_deps = 0;
|
||||
let untracked_writes = null;
|
||||
function set_untracked_writes(value) {
|
||||
untracked_writes = value;
|
||||
}
|
||||
let write_version = 1;
|
||||
let read_version = 0;
|
||||
let skip_reaction = false;
|
||||
function increment_write_version() {
|
||||
return ++write_version;
|
||||
}
|
||||
function check_dirtiness(reaction) {
|
||||
var flags = reaction.f;
|
||||
if ((flags & DIRTY) !== 0) {
|
||||
return true;
|
||||
}
|
||||
if ((flags & MAYBE_DIRTY) !== 0) {
|
||||
var dependencies = reaction.deps;
|
||||
var is_unowned = (flags & UNOWNED) !== 0;
|
||||
if (dependencies !== null) {
|
||||
var i;
|
||||
var dependency;
|
||||
var is_disconnected = (flags & DISCONNECTED) !== 0;
|
||||
var is_unowned_connected = is_unowned && active_effect !== null && !skip_reaction;
|
||||
var length = dependencies.length;
|
||||
if (is_disconnected || is_unowned_connected) {
|
||||
var derived = (
|
||||
/** @type {Derived} */
|
||||
reaction
|
||||
);
|
||||
var parent = derived.parent;
|
||||
for (i = 0; i < length; i++) {
|
||||
dependency = dependencies[i];
|
||||
if (is_disconnected || !dependency?.reactions?.includes(derived)) {
|
||||
(dependency.reactions ??= []).push(derived);
|
||||
}
|
||||
}
|
||||
if (is_disconnected) {
|
||||
derived.f ^= DISCONNECTED;
|
||||
}
|
||||
if (is_unowned_connected && parent !== null && (parent.f & UNOWNED) === 0) {
|
||||
derived.f ^= UNOWNED;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < length; i++) {
|
||||
dependency = dependencies[i];
|
||||
if (check_dirtiness(
|
||||
/** @type {Derived} */
|
||||
dependency
|
||||
)) {
|
||||
update_derived(
|
||||
/** @type {Derived} */
|
||||
dependency
|
||||
);
|
||||
}
|
||||
if (dependency.wv > reaction.wv) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_unowned || active_effect !== null && !skip_reaction) {
|
||||
set_signal_status(reaction, CLEAN);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function propagate_error(error, effect2) {
|
||||
var current = effect2;
|
||||
while (current !== null) {
|
||||
if ((current.f & BOUNDARY_EFFECT) !== 0) {
|
||||
try {
|
||||
current.fn(error);
|
||||
return;
|
||||
} catch {
|
||||
current.f ^= BOUNDARY_EFFECT;
|
||||
}
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
is_throwing_error = false;
|
||||
throw error;
|
||||
}
|
||||
function should_rethrow_error(effect2) {
|
||||
return (effect2.f & DESTROYED) === 0 && (effect2.parent === null || (effect2.parent.f & BOUNDARY_EFFECT) === 0);
|
||||
}
|
||||
function handle_error(error, effect2, previous_effect, component_context2) {
|
||||
if (is_throwing_error) {
|
||||
if (previous_effect === null) {
|
||||
is_throwing_error = false;
|
||||
}
|
||||
if (should_rethrow_error(effect2)) {
|
||||
throw error;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (previous_effect !== null) {
|
||||
is_throwing_error = true;
|
||||
}
|
||||
{
|
||||
propagate_error(error, effect2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
function schedule_possible_effect_self_invalidation(signal, effect2, root2 = true) {
|
||||
var reactions = signal.reactions;
|
||||
if (reactions === null) return;
|
||||
for (var i = 0; i < reactions.length; i++) {
|
||||
var reaction = reactions[i];
|
||||
if (reaction_sources?.includes(signal)) continue;
|
||||
if ((reaction.f & DERIVED) !== 0) {
|
||||
schedule_possible_effect_self_invalidation(
|
||||
/** @type {Derived} */
|
||||
reaction,
|
||||
effect2,
|
||||
false
|
||||
);
|
||||
} else if (effect2 === reaction) {
|
||||
if (root2) {
|
||||
set_signal_status(reaction, DIRTY);
|
||||
} else if ((reaction.f & CLEAN) !== 0) {
|
||||
set_signal_status(reaction, MAYBE_DIRTY);
|
||||
}
|
||||
schedule_effect(
|
||||
/** @type {Effect} */
|
||||
reaction
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function update_reaction(reaction) {
|
||||
var previous_deps = new_deps;
|
||||
var previous_skipped_deps = skipped_deps;
|
||||
var previous_untracked_writes = untracked_writes;
|
||||
var previous_reaction = active_reaction;
|
||||
var previous_skip_reaction = skip_reaction;
|
||||
var previous_reaction_sources = reaction_sources;
|
||||
var previous_component_context = component_context;
|
||||
var previous_untracking = untracking;
|
||||
var flags = reaction.f;
|
||||
new_deps = /** @type {null | Value[]} */
|
||||
null;
|
||||
skipped_deps = 0;
|
||||
untracked_writes = null;
|
||||
skip_reaction = (flags & UNOWNED) !== 0 && (untracking || !is_updating_effect || active_reaction === null);
|
||||
active_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;
|
||||
reaction_sources = null;
|
||||
set_component_context(reaction.ctx);
|
||||
untracking = false;
|
||||
read_version++;
|
||||
reaction.f |= EFFECT_IS_UPDATING;
|
||||
try {
|
||||
var result = (
|
||||
/** @type {Function} */
|
||||
(0, reaction.fn)()
|
||||
);
|
||||
var deps = reaction.deps;
|
||||
if (new_deps !== null) {
|
||||
var i;
|
||||
remove_reactions(reaction, skipped_deps);
|
||||
if (deps !== null && skipped_deps > 0) {
|
||||
deps.length = skipped_deps + new_deps.length;
|
||||
for (i = 0; i < new_deps.length; i++) {
|
||||
deps[skipped_deps + i] = new_deps[i];
|
||||
}
|
||||
} else {
|
||||
reaction.deps = deps = new_deps;
|
||||
}
|
||||
if (!skip_reaction) {
|
||||
for (i = skipped_deps; i < deps.length; i++) {
|
||||
(deps[i].reactions ??= []).push(reaction);
|
||||
}
|
||||
}
|
||||
} else if (deps !== null && skipped_deps < deps.length) {
|
||||
remove_reactions(reaction, skipped_deps);
|
||||
deps.length = skipped_deps;
|
||||
}
|
||||
if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0) {
|
||||
for (i = 0; i < /** @type {Source[]} */
|
||||
untracked_writes.length; i++) {
|
||||
schedule_possible_effect_self_invalidation(
|
||||
untracked_writes[i],
|
||||
/** @type {Effect} */
|
||||
reaction
|
||||
);
|
||||
}
|
||||
}
|
||||
if (previous_reaction !== reaction) {
|
||||
read_version++;
|
||||
if (untracked_writes !== null) {
|
||||
if (previous_untracked_writes === null) {
|
||||
previous_untracked_writes = untracked_writes;
|
||||
} else {
|
||||
previous_untracked_writes.push(.../** @type {Source[]} */
|
||||
untracked_writes);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
new_deps = previous_deps;
|
||||
skipped_deps = previous_skipped_deps;
|
||||
untracked_writes = previous_untracked_writes;
|
||||
active_reaction = previous_reaction;
|
||||
skip_reaction = previous_skip_reaction;
|
||||
reaction_sources = previous_reaction_sources;
|
||||
set_component_context(previous_component_context);
|
||||
untracking = previous_untracking;
|
||||
reaction.f ^= EFFECT_IS_UPDATING;
|
||||
}
|
||||
}
|
||||
function remove_reaction(signal, dependency) {
|
||||
let reactions = dependency.reactions;
|
||||
if (reactions !== null) {
|
||||
var index = index_of.call(reactions, signal);
|
||||
if (index !== -1) {
|
||||
var new_length = reactions.length - 1;
|
||||
if (new_length === 0) {
|
||||
reactions = dependency.reactions = null;
|
||||
} else {
|
||||
reactions[index] = reactions[new_length];
|
||||
reactions.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reactions === null && (dependency.f & DERIVED) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
|
||||
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
|
||||
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
|
||||
(new_deps === null || !new_deps.includes(dependency))) {
|
||||
set_signal_status(dependency, MAYBE_DIRTY);
|
||||
if ((dependency.f & (UNOWNED | DISCONNECTED)) === 0) {
|
||||
dependency.f ^= DISCONNECTED;
|
||||
}
|
||||
destroy_derived_effects(
|
||||
/** @type {Derived} **/
|
||||
dependency
|
||||
);
|
||||
remove_reactions(
|
||||
/** @type {Derived} **/
|
||||
dependency,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
function remove_reactions(signal, start_index) {
|
||||
var dependencies = signal.deps;
|
||||
if (dependencies === null) return;
|
||||
for (var i = start_index; i < dependencies.length; i++) {
|
||||
remove_reaction(signal, dependencies[i]);
|
||||
}
|
||||
}
|
||||
function update_effect(effect2) {
|
||||
var flags = effect2.f;
|
||||
if ((flags & DESTROYED) !== 0) {
|
||||
return;
|
||||
}
|
||||
set_signal_status(effect2, CLEAN);
|
||||
var previous_effect = active_effect;
|
||||
var previous_component_context = component_context;
|
||||
var was_updating_effect = is_updating_effect;
|
||||
active_effect = effect2;
|
||||
is_updating_effect = true;
|
||||
try {
|
||||
if ((flags & BLOCK_EFFECT) !== 0) {
|
||||
destroy_block_effect_children(effect2);
|
||||
} else {
|
||||
destroy_effect_children(effect2);
|
||||
}
|
||||
execute_effect_teardown(effect2);
|
||||
var teardown2 = update_reaction(effect2);
|
||||
effect2.teardown = typeof teardown2 === "function" ? teardown2 : null;
|
||||
effect2.wv = write_version;
|
||||
var deps = effect2.deps;
|
||||
var dep;
|
||||
if (BROWSER && tracing_mode_flag && (effect2.f & DIRTY) !== 0 && deps !== null) ;
|
||||
if (BROWSER) ;
|
||||
} catch (error) {
|
||||
handle_error(error, effect2, previous_effect, previous_component_context || effect2.ctx);
|
||||
} finally {
|
||||
is_updating_effect = was_updating_effect;
|
||||
active_effect = previous_effect;
|
||||
}
|
||||
}
|
||||
function infinite_loop_guard() {
|
||||
try {
|
||||
effect_update_depth_exceeded();
|
||||
} catch (error) {
|
||||
if (last_scheduled_effect !== null) {
|
||||
{
|
||||
handle_error(error, last_scheduled_effect, null);
|
||||
}
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
function flush_queued_root_effects() {
|
||||
var was_updating_effect = is_updating_effect;
|
||||
try {
|
||||
var flush_count = 0;
|
||||
is_updating_effect = true;
|
||||
while (queued_root_effects.length > 0) {
|
||||
if (flush_count++ > 1e3) {
|
||||
infinite_loop_guard();
|
||||
}
|
||||
var root_effects = queued_root_effects;
|
||||
var length = root_effects.length;
|
||||
queued_root_effects = [];
|
||||
for (var i = 0; i < length; i++) {
|
||||
var collected_effects = process_effects(root_effects[i]);
|
||||
flush_queued_effects(collected_effects);
|
||||
}
|
||||
old_values.clear();
|
||||
}
|
||||
} finally {
|
||||
is_flushing = false;
|
||||
is_updating_effect = was_updating_effect;
|
||||
last_scheduled_effect = null;
|
||||
}
|
||||
}
|
||||
function flush_queued_effects(effects) {
|
||||
var length = effects.length;
|
||||
if (length === 0) return;
|
||||
for (var i = 0; i < length; i++) {
|
||||
var effect2 = effects[i];
|
||||
if ((effect2.f & (DESTROYED | INERT)) === 0) {
|
||||
try {
|
||||
if (check_dirtiness(effect2)) {
|
||||
update_effect(effect2);
|
||||
if (effect2.deps === null && effect2.first === null && effect2.nodes_start === null) {
|
||||
if (effect2.teardown === null) {
|
||||
unlink_effect(effect2);
|
||||
} else {
|
||||
effect2.fn = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
handle_error(error, effect2, null, effect2.ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function schedule_effect(signal) {
|
||||
if (!is_flushing) {
|
||||
is_flushing = true;
|
||||
queueMicrotask(flush_queued_root_effects);
|
||||
}
|
||||
var effect2 = last_scheduled_effect = signal;
|
||||
while (effect2.parent !== null) {
|
||||
effect2 = effect2.parent;
|
||||
var flags = effect2.f;
|
||||
if ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
||||
if ((flags & CLEAN) === 0) return;
|
||||
effect2.f ^= CLEAN;
|
||||
}
|
||||
}
|
||||
queued_root_effects.push(effect2);
|
||||
}
|
||||
function process_effects(root2) {
|
||||
var effects = [];
|
||||
var effect2 = root2;
|
||||
while (effect2 !== null) {
|
||||
var flags = effect2.f;
|
||||
var is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
|
||||
var is_skippable_branch = is_branch && (flags & CLEAN) !== 0;
|
||||
if (!is_skippable_branch && (flags & INERT) === 0) {
|
||||
if ((flags & EFFECT) !== 0) {
|
||||
effects.push(effect2);
|
||||
} else if (is_branch) {
|
||||
effect2.f ^= CLEAN;
|
||||
} else {
|
||||
var previous_active_reaction = active_reaction;
|
||||
try {
|
||||
active_reaction = effect2;
|
||||
if (check_dirtiness(effect2)) {
|
||||
update_effect(effect2);
|
||||
}
|
||||
} catch (error) {
|
||||
handle_error(error, effect2, null, effect2.ctx);
|
||||
} finally {
|
||||
active_reaction = previous_active_reaction;
|
||||
}
|
||||
}
|
||||
var child = effect2.first;
|
||||
if (child !== null) {
|
||||
effect2 = child;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
var parent = effect2.parent;
|
||||
effect2 = effect2.next;
|
||||
while (effect2 === null && parent !== null) {
|
||||
effect2 = parent.next;
|
||||
parent = parent.parent;
|
||||
}
|
||||
}
|
||||
return effects;
|
||||
}
|
||||
function flushSync(fn) {
|
||||
var result;
|
||||
flush_tasks();
|
||||
while (queued_root_effects.length > 0) {
|
||||
is_flushing = true;
|
||||
flush_queued_root_effects();
|
||||
flush_tasks();
|
||||
}
|
||||
return (
|
||||
/** @type {T} */
|
||||
result
|
||||
);
|
||||
}
|
||||
function get(signal) {
|
||||
var flags = signal.f;
|
||||
var is_derived = (flags & DERIVED) !== 0;
|
||||
if (active_reaction !== null && !untracking) {
|
||||
if (!reaction_sources?.includes(signal)) {
|
||||
var deps = active_reaction.deps;
|
||||
if (signal.rv < read_version) {
|
||||
signal.rv = read_version;
|
||||
if (new_deps === null && deps !== null && deps[skipped_deps] === signal) {
|
||||
skipped_deps++;
|
||||
} else if (new_deps === null) {
|
||||
new_deps = [signal];
|
||||
} else if (!skip_reaction || !new_deps.includes(signal)) {
|
||||
new_deps.push(signal);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (is_derived && /** @type {Derived} */
|
||||
signal.deps === null && /** @type {Derived} */
|
||||
signal.effects === null) {
|
||||
var derived = (
|
||||
/** @type {Derived} */
|
||||
signal
|
||||
);
|
||||
var parent = derived.parent;
|
||||
if (parent !== null && (parent.f & UNOWNED) === 0) {
|
||||
derived.f ^= UNOWNED;
|
||||
}
|
||||
}
|
||||
if (is_derived) {
|
||||
derived = /** @type {Derived} */
|
||||
signal;
|
||||
if (check_dirtiness(derived)) {
|
||||
update_derived(derived);
|
||||
}
|
||||
}
|
||||
if (is_destroying_effect && old_values.has(signal)) {
|
||||
return old_values.get(signal);
|
||||
}
|
||||
return signal.v;
|
||||
}
|
||||
const STATUS_MASK = -7169;
|
||||
function set_signal_status(signal, status) {
|
||||
signal.f = signal.f & STATUS_MASK | status;
|
||||
}
|
||||
const PASSIVE_EVENTS = ["touchstart", "touchmove"];
|
||||
function is_passive_event(name) {
|
||||
return PASSIVE_EVENTS.includes(name);
|
||||
}
|
||||
const all_registered_events = /* @__PURE__ */ new Set();
|
||||
const root_event_handles = /* @__PURE__ */ new Set();
|
||||
function handle_event_propagation(event) {
|
||||
var handler_element = this;
|
||||
var owner_document = (
|
||||
/** @type {Node} */
|
||||
handler_element.ownerDocument
|
||||
);
|
||||
var event_name = event.type;
|
||||
var path = event.composedPath?.() || [];
|
||||
var current_target = (
|
||||
/** @type {null | Element} */
|
||||
path[0] || event.target
|
||||
);
|
||||
var path_idx = 0;
|
||||
var handled_at = event.__root;
|
||||
if (handled_at) {
|
||||
var at_idx = path.indexOf(handled_at);
|
||||
if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
|
||||
window)) {
|
||||
event.__root = handler_element;
|
||||
return;
|
||||
}
|
||||
var handler_idx = path.indexOf(handler_element);
|
||||
if (handler_idx === -1) {
|
||||
return;
|
||||
}
|
||||
if (at_idx <= handler_idx) {
|
||||
path_idx = at_idx;
|
||||
}
|
||||
}
|
||||
current_target = /** @type {Element} */
|
||||
path[path_idx] || event.target;
|
||||
if (current_target === handler_element) return;
|
||||
define_property(event, "currentTarget", {
|
||||
configurable: true,
|
||||
get() {
|
||||
return current_target || owner_document;
|
||||
}
|
||||
});
|
||||
var previous_reaction = active_reaction;
|
||||
var previous_effect = active_effect;
|
||||
set_active_reaction(null);
|
||||
set_active_effect(null);
|
||||
try {
|
||||
var throw_error;
|
||||
var other_errors = [];
|
||||
while (current_target !== null) {
|
||||
var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
|
||||
current_target.host || null;
|
||||
try {
|
||||
var delegated = current_target["__" + event_name];
|
||||
if (delegated != null && (!/** @type {any} */
|
||||
current_target.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
|
||||
// -> the target could not have been disabled because it emits the event in the first place
|
||||
event.target === current_target)) {
|
||||
if (is_array(delegated)) {
|
||||
var [fn, ...data] = delegated;
|
||||
fn.apply(current_target, [event, ...data]);
|
||||
} else {
|
||||
delegated.call(current_target, event);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (throw_error) {
|
||||
other_errors.push(error);
|
||||
} else {
|
||||
throw_error = error;
|
||||
}
|
||||
}
|
||||
if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
|
||||
break;
|
||||
}
|
||||
current_target = parent_element;
|
||||
}
|
||||
if (throw_error) {
|
||||
for (let error of other_errors) {
|
||||
queueMicrotask(() => {
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
throw throw_error;
|
||||
}
|
||||
} finally {
|
||||
event.__root = handler_element;
|
||||
delete event.currentTarget;
|
||||
set_active_reaction(previous_reaction);
|
||||
set_active_effect(previous_effect);
|
||||
}
|
||||
}
|
||||
function assign_nodes(start, end) {
|
||||
var effect2 = (
|
||||
/** @type {Effect} */
|
||||
active_effect
|
||||
);
|
||||
if (effect2.nodes_start === null) {
|
||||
effect2.nodes_start = start;
|
||||
effect2.nodes_end = end;
|
||||
}
|
||||
}
|
||||
function mount(component, options2) {
|
||||
return _mount(component, options2);
|
||||
}
|
||||
function hydrate(component, options2) {
|
||||
init_operations();
|
||||
options2.intro = options2.intro ?? false;
|
||||
const target = options2.target;
|
||||
const was_hydrating = hydrating;
|
||||
const previous_hydrate_node = hydrate_node;
|
||||
try {
|
||||
var anchor = (
|
||||
/** @type {TemplateNode} */
|
||||
/* @__PURE__ */ get_first_child(target)
|
||||
);
|
||||
while (anchor && (anchor.nodeType !== 8 || /** @type {Comment} */
|
||||
anchor.data !== HYDRATION_START)) {
|
||||
anchor = /** @type {TemplateNode} */
|
||||
/* @__PURE__ */ get_next_sibling(anchor);
|
||||
}
|
||||
if (!anchor) {
|
||||
throw HYDRATION_ERROR;
|
||||
}
|
||||
set_hydrating(true);
|
||||
set_hydrate_node(
|
||||
/** @type {Comment} */
|
||||
anchor
|
||||
);
|
||||
hydrate_next();
|
||||
const instance = _mount(component, { ...options2, anchor });
|
||||
if (hydrate_node === null || hydrate_node.nodeType !== 8 || /** @type {Comment} */
|
||||
hydrate_node.data !== HYDRATION_END) {
|
||||
hydration_mismatch();
|
||||
throw HYDRATION_ERROR;
|
||||
}
|
||||
set_hydrating(false);
|
||||
return (
|
||||
/** @type {Exports} */
|
||||
instance
|
||||
);
|
||||
} catch (error) {
|
||||
if (error === HYDRATION_ERROR) {
|
||||
if (options2.recover === false) {
|
||||
hydration_failed();
|
||||
}
|
||||
init_operations();
|
||||
clear_text_content(target);
|
||||
set_hydrating(false);
|
||||
return mount(component, options2);
|
||||
}
|
||||
throw error;
|
||||
} finally {
|
||||
set_hydrating(was_hydrating);
|
||||
set_hydrate_node(previous_hydrate_node);
|
||||
}
|
||||
}
|
||||
const document_listeners = /* @__PURE__ */ new Map();
|
||||
function _mount(Component, { target, anchor, props = {}, events, context, intro = true }) {
|
||||
init_operations();
|
||||
var registered_events = /* @__PURE__ */ new Set();
|
||||
var event_handle = (events2) => {
|
||||
for (var i = 0; i < events2.length; i++) {
|
||||
var event_name = events2[i];
|
||||
if (registered_events.has(event_name)) continue;
|
||||
registered_events.add(event_name);
|
||||
var passive = is_passive_event(event_name);
|
||||
target.addEventListener(event_name, handle_event_propagation, { passive });
|
||||
var n = document_listeners.get(event_name);
|
||||
if (n === void 0) {
|
||||
document.addEventListener(event_name, handle_event_propagation, { passive });
|
||||
document_listeners.set(event_name, 1);
|
||||
} else {
|
||||
document_listeners.set(event_name, n + 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
event_handle(array_from(all_registered_events));
|
||||
root_event_handles.add(event_handle);
|
||||
var component = void 0;
|
||||
var unmount2 = component_root(() => {
|
||||
var anchor_node = anchor ?? target.appendChild(create_text());
|
||||
branch(() => {
|
||||
if (context) {
|
||||
push({});
|
||||
var ctx = (
|
||||
/** @type {ComponentContext} */
|
||||
component_context
|
||||
);
|
||||
ctx.c = context;
|
||||
}
|
||||
if (events) {
|
||||
props.$$events = events;
|
||||
}
|
||||
if (hydrating) {
|
||||
assign_nodes(
|
||||
/** @type {TemplateNode} */
|
||||
anchor_node,
|
||||
null
|
||||
);
|
||||
}
|
||||
component = Component(anchor_node, props) || {};
|
||||
if (hydrating) {
|
||||
active_effect.nodes_end = hydrate_node;
|
||||
}
|
||||
if (context) {
|
||||
pop();
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
for (var event_name of registered_events) {
|
||||
target.removeEventListener(event_name, handle_event_propagation);
|
||||
var n = (
|
||||
/** @type {number} */
|
||||
document_listeners.get(event_name)
|
||||
);
|
||||
if (--n === 0) {
|
||||
document.removeEventListener(event_name, handle_event_propagation);
|
||||
document_listeners.delete(event_name);
|
||||
} else {
|
||||
document_listeners.set(event_name, n);
|
||||
}
|
||||
}
|
||||
root_event_handles.delete(event_handle);
|
||||
if (anchor_node !== anchor) {
|
||||
anchor_node.parentNode?.removeChild(anchor_node);
|
||||
}
|
||||
};
|
||||
});
|
||||
mounted_components.set(component, unmount2);
|
||||
return component;
|
||||
}
|
||||
let mounted_components = /* @__PURE__ */ new WeakMap();
|
||||
function unmount(component, options2) {
|
||||
const fn = mounted_components.get(component);
|
||||
if (fn) {
|
||||
mounted_components.delete(component);
|
||||
return fn(options2);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
function asClassComponent$1(component) {
|
||||
return class extends Svelte4Component {
|
||||
/** @param {any} options */
|
||||
constructor(options2) {
|
||||
super({
|
||||
component,
|
||||
...options2
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
class Svelte4Component {
|
||||
/** @type {any} */
|
||||
#events;
|
||||
/** @type {Record<string, any>} */
|
||||
#instance;
|
||||
/**
|
||||
* @param {ComponentConstructorOptions & {
|
||||
* component: any;
|
||||
* }} options
|
||||
*/
|
||||
constructor(options2) {
|
||||
var sources = /* @__PURE__ */ new Map();
|
||||
var add_source = (key, value) => {
|
||||
var s = /* @__PURE__ */ mutable_source(value);
|
||||
sources.set(key, s);
|
||||
return s;
|
||||
};
|
||||
const props = new Proxy(
|
||||
{ ...options2.props || {}, $$events: {} },
|
||||
{
|
||||
get(target, prop) {
|
||||
return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
||||
},
|
||||
has(target, prop) {
|
||||
if (prop === LEGACY_PROPS) return true;
|
||||
get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
|
||||
return Reflect.has(target, prop);
|
||||
},
|
||||
set(target, prop, value) {
|
||||
set(sources.get(prop) ?? add_source(prop, value), value);
|
||||
return Reflect.set(target, prop, value);
|
||||
}
|
||||
}
|
||||
);
|
||||
this.#instance = (options2.hydrate ? hydrate : mount)(options2.component, {
|
||||
target: options2.target,
|
||||
anchor: options2.anchor,
|
||||
props,
|
||||
context: options2.context,
|
||||
intro: options2.intro ?? false,
|
||||
recover: options2.recover
|
||||
});
|
||||
if (!options2?.props?.$$host || options2.sync === false) {
|
||||
flushSync();
|
||||
}
|
||||
this.#events = props.$$events;
|
||||
for (const key of Object.keys(this.#instance)) {
|
||||
if (key === "$set" || key === "$destroy" || key === "$on") continue;
|
||||
define_property(this, key, {
|
||||
get() {
|
||||
return this.#instance[key];
|
||||
},
|
||||
/** @param {any} value */
|
||||
set(value) {
|
||||
this.#instance[key] = value;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
this.#instance.$set = /** @param {Record<string, any>} next */
|
||||
(next) => {
|
||||
Object.assign(props, next);
|
||||
};
|
||||
this.#instance.$destroy = () => {
|
||||
unmount(this.#instance);
|
||||
};
|
||||
}
|
||||
/** @param {Record<string, any>} props */
|
||||
$set(props) {
|
||||
this.#instance.$set(props);
|
||||
}
|
||||
/**
|
||||
* @param {string} event
|
||||
* @param {(...args: any[]) => any} callback
|
||||
* @returns {any}
|
||||
*/
|
||||
$on(event, callback) {
|
||||
this.#events[event] = this.#events[event] || [];
|
||||
const cb = (...args) => callback.call(this, ...args);
|
||||
this.#events[event].push(cb);
|
||||
return () => {
|
||||
this.#events[event] = this.#events[event].filter(
|
||||
/** @param {any} fn */
|
||||
(fn) => fn !== cb
|
||||
);
|
||||
};
|
||||
}
|
||||
$destroy() {
|
||||
this.#instance.$destroy();
|
||||
}
|
||||
}
|
||||
let read_implementation = null;
|
||||
function set_read_implementation(fn) {
|
||||
read_implementation = fn;
|
||||
}
|
||||
function set_manifest(_) {
|
||||
}
|
||||
function asClassComponent(component) {
|
||||
const component_constructor = asClassComponent$1(component);
|
||||
const _render = (props, { context } = {}) => {
|
||||
const result = render(component, { props, context });
|
||||
return {
|
||||
css: { code: "", map: null },
|
||||
head: result.head,
|
||||
html: result.body
|
||||
};
|
||||
};
|
||||
component_constructor.render = _render;
|
||||
return component_constructor;
|
||||
}
|
||||
let prerendering = false;
|
||||
function set_building() {
|
||||
}
|
||||
function set_prerendering() {
|
||||
prerendering = true;
|
||||
}
|
||||
function Root($$payload, $$props) {
|
||||
push$1();
|
||||
let {
|
||||
stores,
|
||||
page,
|
||||
constructors,
|
||||
components = [],
|
||||
form,
|
||||
data_0 = null,
|
||||
data_1 = null
|
||||
} = $$props;
|
||||
{
|
||||
setContext("__svelte__", stores);
|
||||
}
|
||||
{
|
||||
stores.page.set(page);
|
||||
}
|
||||
const Pyramid_1 = constructors[1];
|
||||
if (constructors[1]) {
|
||||
$$payload.out += "<!--[-->";
|
||||
const Pyramid_0 = constructors[0];
|
||||
$$payload.out += `<!---->`;
|
||||
Pyramid_0($$payload, {
|
||||
data: data_0,
|
||||
form,
|
||||
children: ($$payload2) => {
|
||||
$$payload2.out += `<!---->`;
|
||||
Pyramid_1($$payload2, { data: data_1, form });
|
||||
$$payload2.out += `<!---->`;
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
$$payload.out += `<!---->`;
|
||||
} else {
|
||||
$$payload.out += "<!--[!-->";
|
||||
const Pyramid_0 = constructors[0];
|
||||
$$payload.out += `<!---->`;
|
||||
Pyramid_0($$payload, { data: data_0, form });
|
||||
$$payload.out += `<!---->`;
|
||||
}
|
||||
$$payload.out += `<!--]--> `;
|
||||
{
|
||||
$$payload.out += "<!--[!-->";
|
||||
}
|
||||
$$payload.out += `<!--]-->`;
|
||||
pop$1();
|
||||
}
|
||||
const root = asClassComponent(Root);
|
||||
const options = {
|
||||
app_template_contains_nonce: false,
|
||||
csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
|
||||
csrf_check_origin: true,
|
||||
embedded: false,
|
||||
env_public_prefix: "PUBLIC_",
|
||||
env_private_prefix: "",
|
||||
hash_routing: false,
|
||||
hooks: null,
|
||||
// added lazily, via `get_hooks`
|
||||
preload_strategy: "modulepreload",
|
||||
root,
|
||||
service_worker: false,
|
||||
templates: {
|
||||
app: ({ head, body, assets: assets2, nonce, env }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="icon" href="' + assets2 + '/favicon.png" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n ' + head + '\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
|
||||
error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
--bg: white;
|
||||
--fg: #222;
|
||||
--divider: #ccc;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Oxygen,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
'Open Sans',
|
||||
'Helvetica Neue',
|
||||
sans-serif;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-width: 32rem;
|
||||
margin: 0 1rem;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-weight: 200;
|
||||
font-size: 3rem;
|
||||
line-height: 1;
|
||||
position: relative;
|
||||
top: -0.05rem;
|
||||
}
|
||||
|
||||
.message {
|
||||
border-left: 1px solid var(--divider);
|
||||
padding: 0 0 0 1rem;
|
||||
margin: 0 0 0 1rem;
|
||||
min-height: 2.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.message h1 {
|
||||
font-weight: 400;
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
--bg: #222;
|
||||
--fg: #ddd;
|
||||
--divider: #666;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error">
|
||||
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
||||
},
|
||||
version_hash: "1du9zss"
|
||||
};
|
||||
async function get_hooks() {
|
||||
let handle;
|
||||
let handleFetch;
|
||||
let handleError;
|
||||
let init;
|
||||
let reroute;
|
||||
let transport;
|
||||
return {
|
||||
handle,
|
||||
handleFetch,
|
||||
handleError,
|
||||
init,
|
||||
reroute,
|
||||
transport
|
||||
};
|
||||
}
|
||||
export {
|
||||
BROWSER as B,
|
||||
assets as a,
|
||||
base as b,
|
||||
app_dir as c,
|
||||
read_implementation as d,
|
||||
options as e,
|
||||
set_private_env as f,
|
||||
get_hooks as g,
|
||||
prerendering as h,
|
||||
set_public_env as i,
|
||||
set_safe_public_env as j,
|
||||
set_read_implementation as k,
|
||||
set_assets as l,
|
||||
set_building as m,
|
||||
set_manifest as n,
|
||||
override as o,
|
||||
public_env as p,
|
||||
set_prerendering as q,
|
||||
reset as r,
|
||||
safe_public_env as s
|
||||
};
|
||||
63
.svelte-kit/output/server/entries/fallbacks/error.svelte.js
Normal file
63
.svelte-kit/output/server/entries/fallbacks/error.svelte.js
Normal file
@@ -0,0 +1,63 @@
|
||||
import { g as getContext, e as escape_html, c as pop, p as push } from "../../chunks/index.js";
|
||||
import "clsx";
|
||||
import { n as noop } from "../../chunks/equality.js";
|
||||
import { w as writable } from "../../chunks/exports.js";
|
||||
const SNAPSHOT_KEY = "sveltekit:snapshot";
|
||||
const SCROLL_KEY = "sveltekit:scroll";
|
||||
function create_updated_store() {
|
||||
const { set, subscribe } = writable(false);
|
||||
{
|
||||
return {
|
||||
subscribe,
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
check: async () => false
|
||||
};
|
||||
}
|
||||
}
|
||||
const is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
|
||||
if (is_legacy) {
|
||||
({
|
||||
data: {},
|
||||
form: null,
|
||||
error: null,
|
||||
params: {},
|
||||
route: { id: null },
|
||||
state: {},
|
||||
status: -1,
|
||||
url: new URL("https://example.com")
|
||||
});
|
||||
}
|
||||
function get(key, parse = JSON.parse) {
|
||||
try {
|
||||
return parse(sessionStorage[key]);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
get(SCROLL_KEY) ?? {};
|
||||
get(SNAPSHOT_KEY) ?? {};
|
||||
const stores = {
|
||||
updated: /* @__PURE__ */ create_updated_store()
|
||||
};
|
||||
({
|
||||
check: stores.updated.check
|
||||
});
|
||||
function context() {
|
||||
return getContext("__request__");
|
||||
}
|
||||
const page$1 = {
|
||||
get error() {
|
||||
return context().page.error;
|
||||
},
|
||||
get status() {
|
||||
return context().page.status;
|
||||
}
|
||||
};
|
||||
const page = page$1;
|
||||
function Error$1($$payload, $$props) {
|
||||
push();
|
||||
$$payload.out += `<h1>${escape_html(page.status)}</h1> <p>${escape_html(page.error?.message)}</p>`;
|
||||
pop();
|
||||
}
|
||||
export {
|
||||
Error$1 as default
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import "clsx";
|
||||
function _layout($$payload, $$props) {
|
||||
let { children } = $$props;
|
||||
children($$payload);
|
||||
$$payload.out += `<!---->`;
|
||||
}
|
||||
export {
|
||||
_layout as default
|
||||
};
|
||||
55
.svelte-kit/output/server/entries/pages/_page.svelte.js
Normal file
55
.svelte-kit/output/server/entries/pages/_page.svelte.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import { d as ensure_array_like, f as attr_class, e as escape_html, c as pop, p as push, h as stringify } from "../../chunks/index.js";
|
||||
function _page($$payload, $$props) {
|
||||
push();
|
||||
const services = [
|
||||
{
|
||||
title: "Digital Transformation",
|
||||
description: "Reimagine your business for the digital age",
|
||||
icon: "🔄"
|
||||
},
|
||||
{
|
||||
title: "Cloud Solutions",
|
||||
description: "Scalable infrastructure for modern enterprises",
|
||||
icon: "☁️"
|
||||
},
|
||||
{
|
||||
title: "AI Integration",
|
||||
description: "Intelligent solutions for complex problems",
|
||||
icon: "🧠"
|
||||
},
|
||||
{
|
||||
title: "Custom Development",
|
||||
description: "Tailored software for your unique needs",
|
||||
icon: "💻"
|
||||
}
|
||||
];
|
||||
const each_array = ensure_array_like(services);
|
||||
$$payload.out += `<div class="min-h-screen bg-gradient-to-b from-gray-900 to-gray-800 font-sans text-gray-100"><nav class="bg-opacity-90 fixed z-10 w-full bg-gray-900"><div class="container mx-auto flex items-center justify-between px-6 py-4"><div class="flex items-center"><span class="text-2xl font-bold text-blue-500">A2Z</span> <span class="text-2xl font-bold">Software</span></div> <div class="hidden space-x-8 md:flex"><a href="#about" class="transition hover:text-blue-400">About</a> <a href="#services" class="transition hover:text-blue-400">Services</a> <a href="#solutions" class="transition hover:text-blue-400">Solutions</a> <a href="#contact" class="transition hover:text-blue-400">Contact</a></div> <button class="focus:outline-none md:hidden" aria-label="Toggle Menu"><svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg></button></div></nav> <section class="px-6 pt-32 pb-24"><div class="container mx-auto text-center"><h1${attr_class(`mb-6 text-5xl font-bold md:text-6xl ${stringify("opacity-0")} transition-opacity duration-1000`)}>Innovating Tomorrow's Technology Today</h1> <p${attr_class(`mx-auto mb-12 max-w-3xl text-xl text-gray-300 md:text-2xl ${stringify("opacity-0")} transition-opacity delay-300 duration-1000`)}>A2ZSoftware delivers cutting-edge solutions at the intersection of technology and business,
|
||||
empowering organizations to thrive in the digital landscape.</p> <div${attr_class(`flex flex-col justify-center gap-4 sm:flex-row ${stringify("opacity-0")} transition-opacity delay-500 duration-1000`)}><a href="#solutions" class="rounded-lg bg-blue-600 px-8 py-3 font-bold text-white transition hover:bg-blue-700">Explore Solutions</a> <a href="#contact" class="rounded-lg border-2 border-blue-500 bg-transparent px-8 py-3 font-bold text-blue-400 transition hover:bg-blue-500 hover:text-white">Contact Us</a></div></div></section> <section id="about" class="bg-opacity-70 bg-gray-800 py-20"><div class="container mx-auto px-6"><div class="flex flex-col items-center md:flex-row"><div class="mb-10 md:mb-0 md:w-1/2"><div class="bg-opacity-20 mb-4 inline-block rounded-lg bg-blue-600 p-2"><span class="font-bold text-blue-400">About Us</span></div> <h2 class="mb-6 text-4xl font-bold">Pioneering the Future of Technology</h2> <p class="mb-6 text-gray-300">At A2ZSoftware, we're a growing startup determined to redefine what's possible in the
|
||||
tech industry. Guided by a spirit of innovation and the drive to offer unique solutions,
|
||||
we help businesses stay competitive in a digital-first world.</p> <p class="mb-6 text-gray-300">Our close-knit team merges deep technical expertise with entrepreneurial insight,
|
||||
crafting tailored strategies that address current challenges and anticipate new market
|
||||
opportunities. We’re committed to pushing boundaries and delivering transformative
|
||||
outcomes.</p> <p class="mb-6 text-gray-300">Although we’re still establishing our footprint, we strive to earn our clients’ trust by
|
||||
streamlining processes, modernizing systems, and enhancing operational efficiency. At
|
||||
A2ZSoftware, we’re passionate about tackling difficult problems and turning them into
|
||||
innovative solutions.</p> <p class="mb-6 text-gray-300">Our culture is built on collaboration, continuous learning, and a commitment to
|
||||
excellence. Every project begins with open communication and ends with tangible results.
|
||||
By embracing emerging technologies and forward-thinking strategies, we believe we can
|
||||
empower businesses to become more adaptable, sustainable, and prepared for the future.</p> <div class="mt-8 flex flex-wrap gap-8"><div class="flex items-center"><div class="mr-4 text-4xl text-blue-500">10+</div> <div class="text-sm text-gray-400">Years of<br>Experience</div></div> <div class="flex items-center"><div class="mr-4 text-4xl text-blue-500">300+</div> <div class="text-sm text-gray-400">Projects<br>Completed</div></div> <div class="flex items-center"><div class="mr-4 text-4xl text-blue-500">98%</div> <div class="text-sm text-gray-400">Client<br>Satisfaction</div></div></div></div> <div class="md:w-1/2 md:pl-12"><div class="grid grid-cols-2 gap-4"><div class="flex h-48 items-center justify-center rounded-lg bg-gradient-to-br from-blue-700 to-purple-700 p-6"><span class="text-5xl">🚀</span></div> <div class="flex h-48 items-center justify-center rounded-lg bg-gradient-to-br from-purple-700 to-pink-700 p-6"><span class="text-5xl">💡</span></div> <div class="flex h-48 items-center justify-center rounded-lg bg-gradient-to-br from-pink-700 to-red-700 p-6"><span class="text-5xl">⚙️</span></div> <div class="flex h-48 items-center justify-center rounded-lg bg-gradient-to-br from-blue-700 to-green-700 p-6"><span class="text-5xl">🔍</span></div></div></div></div></div></section> <section id="services" class="bg-gray-900 py-20"><div class="container mx-auto px-6"><div class="mb-16 text-center"><div class="bg-opacity-20 mb-4 inline-block rounded-lg bg-blue-600 p-2"><span class="font-bold text-blue-400">Our Services</span></div> <h2 class="mb-6 text-4xl font-bold">Comprehensive Technology Solutions</h2> <p class="mx-auto max-w-3xl text-gray-300">We offer a wide range of services designed to help businesses leverage technology for
|
||||
growth, efficiency, and innovation.</p></div> <div class="grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4"><!--[-->`;
|
||||
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
||||
let service = each_array[$$index];
|
||||
$$payload.out += `<div class="bg-opacity-50 rounded-lg bg-gray-800 p-8 transition-all duration-300 hover:-translate-y-2 hover:transform hover:bg-gray-700"><div class="mb-6 text-4xl">${escape_html(service.icon)}</div> <h3 class="mb-4 text-2xl font-bold">${escape_html(service.title)}</h3> <p class="text-gray-300">${escape_html(service.description)}</p></div>`;
|
||||
}
|
||||
$$payload.out += `<!--]--></div></div></section> <section id="solutions" class="bg-gradient-to-r from-blue-900 to-purple-900 py-20"><div class="container mx-auto px-6"><div class="mb-16 text-center"><div class="bg-opacity-20 mb-4 inline-block rounded-lg bg-blue-500 p-2"><span class="font-bold text-blue-300">Our Approach</span></div> <h2 class="mb-6 text-4xl font-bold">Innovative Solutions for Complex Challenges</h2> <p class="mx-auto max-w-3xl text-gray-300">We combine creativity with technical expertise to develop solutions that address your most
|
||||
pressing business challenges.</p></div> <div class="grid grid-cols-1 gap-8 md:grid-cols-3"><div class="bg-opacity-30 rounded-lg bg-gray-800 p-8"><h3 class="mb-4 text-2xl font-bold">Discovery</h3> <p class="mb-6 text-gray-300">We begin by understanding your business, challenges, and goals through in-depth
|
||||
consultation and analysis.</p> <div class="mb-2 flex h-16 w-16 items-center justify-center rounded-full bg-blue-500"><span class="text-2xl">1</span></div></div> <div class="bg-opacity-30 rounded-lg bg-gray-800 p-8"><h3 class="mb-4 text-2xl font-bold">Innovation</h3> <p class="mb-6 text-gray-300">Our experts design tailored solutions leveraging cutting-edge technologies and
|
||||
methodologies.</p> <div class="mb-2 flex h-16 w-16 items-center justify-center rounded-full bg-blue-500"><span class="text-2xl">2</span></div></div> <div class="bg-opacity-30 rounded-lg bg-gray-800 p-8"><h3 class="mb-4 text-2xl font-bold">Implementation</h3> <p class="mb-6 text-gray-300">We bring solutions to life with meticulous development, testing, and deployment
|
||||
processes.</p> <div class="mb-2 flex h-16 w-16 items-center justify-center rounded-full bg-blue-500"><span class="text-2xl">3</span></div></div></div></div></section> <section id="contact" class="bg-gradient-to-r from-blue-800 to-purple-900 py-20"><div class="container mx-auto px-6 text-center"><h2 class="mb-8 text-4xl font-bold">Ready to Transform Your Business?</h2> <p class="mx-auto mb-12 max-w-3xl text-xl text-gray-300">Let's collaborate to create innovative solutions that drive your business forward in the
|
||||
digital age.</p> <form class="mx-auto max-w-lg"><div class="mb-6 flex flex-col gap-4 md:flex-row"><div class="flex-1"><label for="name" class="sr-only">Your Name</label> <input type="text" id="name" placeholder="Your Name" class="w-full rounded-lg border border-gray-700 bg-gray-800 px-4 py-3 text-white focus:border-blue-500 focus:outline-none"></div> <div class="flex-1"><label for="email" class="sr-only">Your Email</label> <input type="email" id="email" placeholder="Your Email" class="w-full rounded-lg border border-gray-700 bg-gray-800 px-4 py-3 text-white focus:border-blue-500 focus:outline-none"></div></div> <div><label for="message" class="sr-only">Your Message</label> <textarea id="message" placeholder="Your Message" rows="4" class="mb-6 w-full rounded-lg border border-gray-700 bg-gray-800 px-4 py-3 text-white focus:border-blue-500 focus:outline-none"></textarea></div> <button type="submit" class="w-full rounded-lg bg-blue-600 px-8 py-3 font-bold text-white transition hover:bg-blue-700">Get in Touch</button></form></div></section> <footer class="bg-gray-900 py-12"><div class="container mx-auto px-6"><div class="flex flex-col justify-between md:flex-row"><div class="mb-8 md:mb-0"><div class="mb-4 flex items-center"><span class="text-2xl font-bold text-blue-500">A2Z</span> <span class="text-2xl font-bold">Software</span></div> <p class="max-w-xs text-gray-400">Transforming businesses through innovative technology solutions.</p></div> <div class="grid grid-cols-2 gap-8 md:grid-cols-3"><div><h3 class="mb-4 text-lg font-bold">Company</h3> <ul class="space-y-2"><li><a href="#about" class="text-gray-400 transition hover:text-white">About</a></li> <li><a href="/careers" class="text-gray-400 transition hover:text-white">Careers</a></li> <li><a href="/blog" class="text-gray-400 transition hover:text-white">Blog</a></li></ul></div> <div><h3 class="mb-4 text-lg font-bold">Services</h3> <ul class="space-y-2"><li><a href="/services/development" class="text-gray-400 transition hover:text-white">Development</a></li> <li><a href="/services/consulting" class="text-gray-400 transition hover:text-white">Consulting</a></li> <li><a href="/services/cloud" class="text-gray-400 transition hover:text-white">Cloud Solutions</a></li> <li><a href="/services/ai-ml" class="text-gray-400 transition hover:text-white">AI & ML</a></li></ul></div> <div><h3 class="mb-4 text-lg font-bold">Connect</h3> <ul class="space-y-2"><li><a href="#contact" class="text-gray-400 transition hover:text-white">Contact</a></li> <li><a href="https://linkedin.com" class="text-gray-400 transition hover:text-white" target="_blank" rel="noopener noreferrer">LinkedIn</a></li> <li><a href="https://twitter.com" class="text-gray-400 transition hover:text-white" target="_blank" rel="noopener noreferrer">Twitter</a></li> <li><a href="https://github.com" class="text-gray-400 transition hover:text-white" target="_blank" rel="noopener noreferrer">GitHub</a></li></ul></div></div></div> <div class="mt-12 flex flex-col items-center justify-between border-t border-gray-800 pt-8 md:flex-row"><p class="text-gray-500">© 2025 A2Z Software Inc. All rights reserved.</p> <div class="mt-4 flex space-x-6 md:mt-0"><a href="https://facebook.com" class="text-gray-400 transition hover:text-white" target="_blank" rel="noopener noreferrer" aria-label="Facebook"><svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.675 0h-21.35c-.732 0-1.325.593-1.325 1.325v21.351c0 .731.593 1.324 1.325 1.324h11.495v-9.294h-3.128v-3.622h3.128v-2.671c0-3.1 1.893-4.788 4.659-4.788 1.325 0 2.463.099 2.795.143v3.24l-1.918.001c-1.504 0-1.795.715-1.795 1.763v2.313h3.587l-.467 3.622h-3.12v9.293h6.116c.73 0 1.323-.593 1.323-1.325v-21.35c0-.732-.593-1.325-1.325-1.325z"></path></svg></a> <a href="https://twitter.com" class="text-gray-400 transition hover:text-white" target="_blank" rel="noopener noreferrer" aria-label="Twitter"><svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"></path></svg></a> <a href="https://github.com" class="text-gray-400 transition hover:text-white" target="_blank" rel="noopener noreferrer" aria-label="GitHub"><svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"></path></svg></a> <a href="https://linkedin.com" class="text-gray-400 transition hover:text-white" target="_blank" rel="noopener noreferrer" aria-label="LinkedIn"><svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z"></path></svg></a></div></div></div></footer></div>`;
|
||||
pop();
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
3321
.svelte-kit/output/server/index.js
Normal file
3321
.svelte-kit/output/server/index.js
Normal file
@@ -0,0 +1,3321 @@
|
||||
import { B as BROWSER, a as assets, b as base, c as app_dir, p as public_env, s as safe_public_env, o as override, r as reset, d as read_implementation, e as options, g as get_hooks, f as set_private_env, h as prerendering, i as set_public_env, j as set_safe_public_env, k as set_read_implementation } from "./chunks/internal.js";
|
||||
import * as devalue from "devalue";
|
||||
import { m as make_trackable, d as disable_search, a as decode_params, r as readable, w as writable, v as validate_layout_server_exports, b as validate_layout_exports, c as validate_page_server_exports, e as validate_page_exports, n as normalize_path, f as resolve, g as decode_pathname, h as validate_server_exports } from "./chunks/exports.js";
|
||||
import { parse, serialize } from "cookie";
|
||||
import * as set_cookie_parser from "set-cookie-parser";
|
||||
const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
|
||||
const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
||||
const PAGE_METHODS = ["GET", "POST", "HEAD"];
|
||||
function negotiate(accept, types) {
|
||||
const parts = [];
|
||||
accept.split(",").forEach((str, i) => {
|
||||
const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
||||
if (match) {
|
||||
const [, type, subtype, q = "1"] = match;
|
||||
parts.push({ type, subtype, q: +q, i });
|
||||
}
|
||||
});
|
||||
parts.sort((a, b) => {
|
||||
if (a.q !== b.q) {
|
||||
return b.q - a.q;
|
||||
}
|
||||
if (a.subtype === "*" !== (b.subtype === "*")) {
|
||||
return a.subtype === "*" ? 1 : -1;
|
||||
}
|
||||
if (a.type === "*" !== (b.type === "*")) {
|
||||
return a.type === "*" ? 1 : -1;
|
||||
}
|
||||
return a.i - b.i;
|
||||
});
|
||||
let accepted;
|
||||
let min_priority = Infinity;
|
||||
for (const mimetype of types) {
|
||||
const [type, subtype] = mimetype.split("/");
|
||||
const priority = parts.findIndex(
|
||||
(part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
|
||||
);
|
||||
if (priority !== -1 && priority < min_priority) {
|
||||
accepted = mimetype;
|
||||
min_priority = priority;
|
||||
}
|
||||
}
|
||||
return accepted;
|
||||
}
|
||||
function is_content_type(request, ...types) {
|
||||
const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
|
||||
return types.includes(type.toLowerCase());
|
||||
}
|
||||
function is_form_content_type(request) {
|
||||
return is_content_type(
|
||||
request,
|
||||
"application/x-www-form-urlencoded",
|
||||
"multipart/form-data",
|
||||
"text/plain"
|
||||
);
|
||||
}
|
||||
let request_event = null;
|
||||
let als;
|
||||
import("node:async_hooks").then((hooks) => als = new hooks.AsyncLocalStorage()).catch(() => {
|
||||
});
|
||||
function with_event(event, fn) {
|
||||
try {
|
||||
request_event = event;
|
||||
return als ? als.run(event, fn) : fn();
|
||||
} finally {
|
||||
request_event = null;
|
||||
}
|
||||
}
|
||||
class HttpError {
|
||||
/**
|
||||
* @param {number} status
|
||||
* @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body
|
||||
*/
|
||||
constructor(status, body2) {
|
||||
this.status = status;
|
||||
if (typeof body2 === "string") {
|
||||
this.body = { message: body2 };
|
||||
} else if (body2) {
|
||||
this.body = body2;
|
||||
} else {
|
||||
this.body = { message: `Error: ${status}` };
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return JSON.stringify(this.body);
|
||||
}
|
||||
}
|
||||
class Redirect {
|
||||
/**
|
||||
* @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status
|
||||
* @param {string} location
|
||||
*/
|
||||
constructor(status, location) {
|
||||
this.status = status;
|
||||
this.location = location;
|
||||
}
|
||||
}
|
||||
class SvelteKitError extends Error {
|
||||
/**
|
||||
* @param {number} status
|
||||
* @param {string} text
|
||||
* @param {string} message
|
||||
*/
|
||||
constructor(status, text2, message) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
this.text = text2;
|
||||
}
|
||||
}
|
||||
class ActionFailure {
|
||||
/**
|
||||
* @param {number} status
|
||||
* @param {T} data
|
||||
*/
|
||||
constructor(status, data) {
|
||||
this.status = status;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
const DATA_SUFFIX = "/__data.json";
|
||||
const HTML_DATA_SUFFIX = ".html__data.json";
|
||||
function has_data_suffix(pathname) {
|
||||
return pathname.endsWith(DATA_SUFFIX) || pathname.endsWith(HTML_DATA_SUFFIX);
|
||||
}
|
||||
function add_data_suffix(pathname) {
|
||||
if (pathname.endsWith(".html")) return pathname.replace(/\.html$/, HTML_DATA_SUFFIX);
|
||||
return pathname.replace(/\/$/, "") + DATA_SUFFIX;
|
||||
}
|
||||
function strip_data_suffix(pathname) {
|
||||
if (pathname.endsWith(HTML_DATA_SUFFIX)) {
|
||||
return pathname.slice(0, -HTML_DATA_SUFFIX.length) + ".html";
|
||||
}
|
||||
return pathname.slice(0, -DATA_SUFFIX.length);
|
||||
}
|
||||
const ROUTE_SUFFIX = "/__route.js";
|
||||
function has_resolution_suffix(pathname) {
|
||||
return pathname.endsWith(ROUTE_SUFFIX);
|
||||
}
|
||||
function add_resolution_suffix(pathname) {
|
||||
return pathname.replace(/\/$/, "") + ROUTE_SUFFIX;
|
||||
}
|
||||
function strip_resolution_suffix(pathname) {
|
||||
return pathname.slice(0, -ROUTE_SUFFIX.length);
|
||||
}
|
||||
function json(data, init2) {
|
||||
const body2 = JSON.stringify(data);
|
||||
const headers2 = new Headers(init2?.headers);
|
||||
if (!headers2.has("content-length")) {
|
||||
headers2.set("content-length", encoder$3.encode(body2).byteLength.toString());
|
||||
}
|
||||
if (!headers2.has("content-type")) {
|
||||
headers2.set("content-type", "application/json");
|
||||
}
|
||||
return new Response(body2, {
|
||||
...init2,
|
||||
headers: headers2
|
||||
});
|
||||
}
|
||||
const encoder$3 = new TextEncoder();
|
||||
function text(body2, init2) {
|
||||
const headers2 = new Headers(init2?.headers);
|
||||
if (!headers2.has("content-length")) {
|
||||
const encoded = encoder$3.encode(body2);
|
||||
headers2.set("content-length", encoded.byteLength.toString());
|
||||
return new Response(encoded, {
|
||||
...init2,
|
||||
headers: headers2
|
||||
});
|
||||
}
|
||||
return new Response(body2, {
|
||||
...init2,
|
||||
headers: headers2
|
||||
});
|
||||
}
|
||||
function coalesce_to_error(err) {
|
||||
return err instanceof Error || err && /** @type {any} */
|
||||
err.name && /** @type {any} */
|
||||
err.message ? (
|
||||
/** @type {Error} */
|
||||
err
|
||||
) : new Error(JSON.stringify(err));
|
||||
}
|
||||
function normalize_error(error) {
|
||||
return (
|
||||
/** @type {import('../runtime/control.js').Redirect | HttpError | SvelteKitError | Error} */
|
||||
error
|
||||
);
|
||||
}
|
||||
function get_status(error) {
|
||||
return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
|
||||
}
|
||||
function get_message(error) {
|
||||
return error instanceof SvelteKitError ? error.text : "Internal Error";
|
||||
}
|
||||
const escape_html_attr_dict = {
|
||||
"&": "&",
|
||||
'"': """
|
||||
// Svelte also escapes < because the escape function could be called inside a `noscript` there
|
||||
// https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
|
||||
// However, that doesn't apply in SvelteKit
|
||||
};
|
||||
const escape_html_dict = {
|
||||
"&": "&",
|
||||
"<": "<"
|
||||
};
|
||||
const surrogates = (
|
||||
// high surrogate without paired low surrogate
|
||||
"[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
|
||||
);
|
||||
const escape_html_attr_regex = new RegExp(
|
||||
`[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
|
||||
"g"
|
||||
);
|
||||
const escape_html_regex = new RegExp(
|
||||
`[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
|
||||
"g"
|
||||
);
|
||||
function escape_html(str, is_attr) {
|
||||
const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
|
||||
const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
|
||||
if (match.length === 2) {
|
||||
return match;
|
||||
}
|
||||
return dict[match] ?? `&#${match.charCodeAt(0)};`;
|
||||
});
|
||||
return escaped_str;
|
||||
}
|
||||
function method_not_allowed(mod, method) {
|
||||
return text(`${method} method not allowed`, {
|
||||
status: 405,
|
||||
headers: {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
||||
// "The server must generate an Allow header field in a 405 status code response"
|
||||
allow: allowed_methods(mod).join(", ")
|
||||
}
|
||||
});
|
||||
}
|
||||
function allowed_methods(mod) {
|
||||
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
||||
if ("GET" in mod || "HEAD" in mod) allowed.push("HEAD");
|
||||
return allowed;
|
||||
}
|
||||
function static_error_page(options2, status, message) {
|
||||
let page = options2.templates.error({ status, message: escape_html(message) });
|
||||
return text(page, {
|
||||
headers: { "content-type": "text/html; charset=utf-8" },
|
||||
status
|
||||
});
|
||||
}
|
||||
async function handle_fatal_error(event, options2, error) {
|
||||
error = error instanceof HttpError ? error : coalesce_to_error(error);
|
||||
const status = get_status(error);
|
||||
const body2 = await handle_error_and_jsonify(event, options2, error);
|
||||
const type = negotiate(event.request.headers.get("accept") || "text/html", [
|
||||
"application/json",
|
||||
"text/html"
|
||||
]);
|
||||
if (event.isDataRequest || type === "application/json") {
|
||||
return json(body2, {
|
||||
status
|
||||
});
|
||||
}
|
||||
return static_error_page(options2, status, body2.message);
|
||||
}
|
||||
async function handle_error_and_jsonify(event, options2, error) {
|
||||
if (error instanceof HttpError) {
|
||||
return error.body;
|
||||
}
|
||||
const status = get_status(error);
|
||||
const message = get_message(error);
|
||||
return await with_event(
|
||||
event,
|
||||
() => options2.hooks.handleError({ error, event, status, message })
|
||||
) ?? { message };
|
||||
}
|
||||
function redirect_response(status, location) {
|
||||
const response = new Response(void 0, {
|
||||
status,
|
||||
headers: { location }
|
||||
});
|
||||
return response;
|
||||
}
|
||||
function clarify_devalue_error(event, error) {
|
||||
if (error.path) {
|
||||
return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (data${error.path})`;
|
||||
}
|
||||
if (error.path === "") {
|
||||
return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
|
||||
}
|
||||
return error.message;
|
||||
}
|
||||
function stringify_uses(node) {
|
||||
const uses = [];
|
||||
if (node.uses && node.uses.dependencies.size > 0) {
|
||||
uses.push(`"dependencies":${JSON.stringify(Array.from(node.uses.dependencies))}`);
|
||||
}
|
||||
if (node.uses && node.uses.search_params.size > 0) {
|
||||
uses.push(`"search_params":${JSON.stringify(Array.from(node.uses.search_params))}`);
|
||||
}
|
||||
if (node.uses && node.uses.params.size > 0) {
|
||||
uses.push(`"params":${JSON.stringify(Array.from(node.uses.params))}`);
|
||||
}
|
||||
if (node.uses?.parent) uses.push('"parent":1');
|
||||
if (node.uses?.route) uses.push('"route":1');
|
||||
if (node.uses?.url) uses.push('"url":1');
|
||||
return `"uses":{${uses.join(",")}}`;
|
||||
}
|
||||
function has_prerendered_path(manifest, pathname) {
|
||||
return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
|
||||
}
|
||||
async function render_endpoint(event, mod, state) {
|
||||
const method = (
|
||||
/** @type {import('types').HttpMethod} */
|
||||
event.request.method
|
||||
);
|
||||
let handler = mod[method] || mod.fallback;
|
||||
if (method === "HEAD" && mod.GET && !mod.HEAD) {
|
||||
handler = mod.GET;
|
||||
}
|
||||
if (!handler) {
|
||||
return method_not_allowed(mod, method);
|
||||
}
|
||||
const prerender = mod.prerender ?? state.prerender_default;
|
||||
if (prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) {
|
||||
throw new Error("Cannot prerender endpoints that have mutative methods");
|
||||
}
|
||||
if (state.prerendering && !state.prerendering.inside_reroute && !prerender) {
|
||||
if (state.depth > 0) {
|
||||
throw new Error(`${event.route.id} is not prerenderable`);
|
||||
} else {
|
||||
return new Response(void 0, { status: 204 });
|
||||
}
|
||||
}
|
||||
try {
|
||||
const response = await with_event(
|
||||
event,
|
||||
() => handler(
|
||||
/** @type {import('@sveltejs/kit').RequestEvent<Record<string, any>>} */
|
||||
event
|
||||
)
|
||||
);
|
||||
if (!(response instanceof Response)) {
|
||||
throw new Error(
|
||||
`Invalid response from route ${event.url.pathname}: handler should return a Response object`
|
||||
);
|
||||
}
|
||||
if (state.prerendering && (!state.prerendering.inside_reroute || prerender)) {
|
||||
const cloned = new Response(response.clone().body, {
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
headers: new Headers(response.headers)
|
||||
});
|
||||
cloned.headers.set("x-sveltekit-prerender", String(prerender));
|
||||
if (state.prerendering.inside_reroute && prerender) {
|
||||
cloned.headers.set(
|
||||
"x-sveltekit-routeid",
|
||||
encodeURI(
|
||||
/** @type {string} */
|
||||
event.route.id
|
||||
)
|
||||
);
|
||||
state.prerendering.dependencies.set(event.url.pathname, { response: cloned, body: null });
|
||||
} else {
|
||||
return cloned;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
} catch (e) {
|
||||
if (e instanceof Redirect) {
|
||||
return new Response(void 0, {
|
||||
status: e.status,
|
||||
headers: { location: e.location }
|
||||
});
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function is_endpoint_request(event) {
|
||||
const { method, headers: headers2 } = event.request;
|
||||
if (ENDPOINT_METHODS.includes(method) && !PAGE_METHODS.includes(method)) {
|
||||
return true;
|
||||
}
|
||||
if (method === "POST" && headers2.get("x-sveltekit-action") === "true") return false;
|
||||
const accept = event.request.headers.get("accept") ?? "*/*";
|
||||
return negotiate(accept, ["*", "text/html"]) !== "text/html";
|
||||
}
|
||||
function compact(arr) {
|
||||
return arr.filter(
|
||||
/** @returns {val is NonNullable<T>} */
|
||||
(val) => val != null
|
||||
);
|
||||
}
|
||||
function is_action_json_request(event) {
|
||||
const accept = negotiate(event.request.headers.get("accept") ?? "*/*", [
|
||||
"application/json",
|
||||
"text/html"
|
||||
]);
|
||||
return accept === "application/json" && event.request.method === "POST";
|
||||
}
|
||||
async function handle_action_json_request(event, options2, server) {
|
||||
const actions = server?.actions;
|
||||
if (!actions) {
|
||||
const no_actions_error = new SvelteKitError(
|
||||
405,
|
||||
"Method Not Allowed",
|
||||
`POST method not allowed. No form actions exist for ${"this page"}`
|
||||
);
|
||||
return action_json(
|
||||
{
|
||||
type: "error",
|
||||
error: await handle_error_and_jsonify(event, options2, no_actions_error)
|
||||
},
|
||||
{
|
||||
status: no_actions_error.status,
|
||||
headers: {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
||||
// "The server must generate an Allow header field in a 405 status code response"
|
||||
allow: "GET"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
check_named_default_separate(actions);
|
||||
try {
|
||||
const data = await call_action(event, actions);
|
||||
if (false) ;
|
||||
if (data instanceof ActionFailure) {
|
||||
return action_json({
|
||||
type: "failure",
|
||||
status: data.status,
|
||||
// @ts-expect-error we assign a string to what is supposed to be an object. That's ok
|
||||
// because we don't use the object outside, and this way we have better code navigation
|
||||
// through knowing where the related interface is used.
|
||||
data: stringify_action_response(
|
||||
data.data,
|
||||
/** @type {string} */
|
||||
event.route.id,
|
||||
options2.hooks.transport
|
||||
)
|
||||
});
|
||||
} else {
|
||||
return action_json({
|
||||
type: "success",
|
||||
status: data ? 200 : 204,
|
||||
// @ts-expect-error see comment above
|
||||
data: stringify_action_response(
|
||||
data,
|
||||
/** @type {string} */
|
||||
event.route.id,
|
||||
options2.hooks.transport
|
||||
)
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
const err = normalize_error(e);
|
||||
if (err instanceof Redirect) {
|
||||
return action_json_redirect(err);
|
||||
}
|
||||
return action_json(
|
||||
{
|
||||
type: "error",
|
||||
error: await handle_error_and_jsonify(event, options2, check_incorrect_fail_use(err))
|
||||
},
|
||||
{
|
||||
status: get_status(err)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
function check_incorrect_fail_use(error) {
|
||||
return error instanceof ActionFailure ? new Error('Cannot "throw fail()". Use "return fail()"') : error;
|
||||
}
|
||||
function action_json_redirect(redirect) {
|
||||
return action_json({
|
||||
type: "redirect",
|
||||
status: redirect.status,
|
||||
location: redirect.location
|
||||
});
|
||||
}
|
||||
function action_json(data, init2) {
|
||||
return json(data, init2);
|
||||
}
|
||||
function is_action_request(event) {
|
||||
return event.request.method === "POST";
|
||||
}
|
||||
async function handle_action_request(event, server) {
|
||||
const actions = server?.actions;
|
||||
if (!actions) {
|
||||
event.setHeaders({
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
||||
// "The server must generate an Allow header field in a 405 status code response"
|
||||
allow: "GET"
|
||||
});
|
||||
return {
|
||||
type: "error",
|
||||
error: new SvelteKitError(
|
||||
405,
|
||||
"Method Not Allowed",
|
||||
`POST method not allowed. No form actions exist for ${"this page"}`
|
||||
)
|
||||
};
|
||||
}
|
||||
check_named_default_separate(actions);
|
||||
try {
|
||||
const data = await call_action(event, actions);
|
||||
if (false) ;
|
||||
if (data instanceof ActionFailure) {
|
||||
return {
|
||||
type: "failure",
|
||||
status: data.status,
|
||||
data: data.data
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: "success",
|
||||
status: 200,
|
||||
// @ts-expect-error this will be removed upon serialization, so `undefined` is the same as omission
|
||||
data
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
const err = normalize_error(e);
|
||||
if (err instanceof Redirect) {
|
||||
return {
|
||||
type: "redirect",
|
||||
status: err.status,
|
||||
location: err.location
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: "error",
|
||||
error: check_incorrect_fail_use(err)
|
||||
};
|
||||
}
|
||||
}
|
||||
function check_named_default_separate(actions) {
|
||||
if (actions.default && Object.keys(actions).length > 1) {
|
||||
throw new Error(
|
||||
"When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions"
|
||||
);
|
||||
}
|
||||
}
|
||||
async function call_action(event, actions) {
|
||||
const url = new URL(event.request.url);
|
||||
let name = "default";
|
||||
for (const param of url.searchParams) {
|
||||
if (param[0].startsWith("/")) {
|
||||
name = param[0].slice(1);
|
||||
if (name === "default") {
|
||||
throw new Error('Cannot use reserved action name "default"');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const action = actions[name];
|
||||
if (!action) {
|
||||
throw new SvelteKitError(404, "Not Found", `No action with name '${name}' found`);
|
||||
}
|
||||
if (!is_form_content_type(event.request)) {
|
||||
throw new SvelteKitError(
|
||||
415,
|
||||
"Unsupported Media Type",
|
||||
`Form actions expect form-encoded data — received ${event.request.headers.get(
|
||||
"content-type"
|
||||
)}`
|
||||
);
|
||||
}
|
||||
return with_event(event, () => action(event));
|
||||
}
|
||||
function validate_action_return(data) {
|
||||
if (data instanceof Redirect) {
|
||||
throw new Error("Cannot `return redirect(...)` — use `redirect(...)` instead");
|
||||
}
|
||||
if (data instanceof HttpError) {
|
||||
throw new Error("Cannot `return error(...)` — use `error(...)` or `return fail(...)` instead");
|
||||
}
|
||||
}
|
||||
function uneval_action_response(data, route_id, transport) {
|
||||
const replacer = (thing) => {
|
||||
for (const key2 in transport) {
|
||||
const encoded = transport[key2].encode(thing);
|
||||
if (encoded) {
|
||||
return `app.decode('${key2}', ${devalue.uneval(encoded, replacer)})`;
|
||||
}
|
||||
}
|
||||
};
|
||||
return try_serialize(data, (value) => devalue.uneval(value, replacer), route_id);
|
||||
}
|
||||
function stringify_action_response(data, route_id, transport) {
|
||||
const encoders = Object.fromEntries(
|
||||
Object.entries(transport).map(([key2, value]) => [key2, value.encode])
|
||||
);
|
||||
return try_serialize(data, (value) => devalue.stringify(value, encoders), route_id);
|
||||
}
|
||||
function try_serialize(data, fn, route_id) {
|
||||
try {
|
||||
return fn(data);
|
||||
} catch (e) {
|
||||
const error = (
|
||||
/** @type {any} */
|
||||
e
|
||||
);
|
||||
if (data instanceof Response) {
|
||||
throw new Error(
|
||||
`Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });`
|
||||
);
|
||||
}
|
||||
if ("path" in error) {
|
||||
let message = `Data returned from action inside ${route_id} is not serializable: ${error.message}`;
|
||||
if (error.path !== "") message += ` (data.${error.path})`;
|
||||
throw new Error(message);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
function validate_depends(route_id, dep) {
|
||||
const match = /^(moz-icon|view-source|jar):/.exec(dep);
|
||||
if (match) {
|
||||
console.warn(
|
||||
`${route_id}: Calling \`depends('${dep}')\` will throw an error in Firefox because \`${match[1]}\` is a special URI scheme`
|
||||
);
|
||||
}
|
||||
}
|
||||
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
||||
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
||||
function b64_encode(buffer) {
|
||||
if (globalThis.Buffer) {
|
||||
return Buffer.from(buffer).toString("base64");
|
||||
}
|
||||
const little_endian = new Uint8Array(new Uint16Array([1]).buffer)[0] > 0;
|
||||
return btoa(
|
||||
new TextDecoder(little_endian ? "utf-16le" : "utf-16be").decode(
|
||||
new Uint16Array(new Uint8Array(buffer))
|
||||
)
|
||||
);
|
||||
}
|
||||
function get_relative_path(from, to) {
|
||||
const from_parts = from.split(/[/\\]/);
|
||||
const to_parts = to.split(/[/\\]/);
|
||||
from_parts.pop();
|
||||
while (from_parts[0] === to_parts[0]) {
|
||||
from_parts.shift();
|
||||
to_parts.shift();
|
||||
}
|
||||
let i = from_parts.length;
|
||||
while (i--) from_parts[i] = "..";
|
||||
return from_parts.concat(to_parts).join("/");
|
||||
}
|
||||
async function load_server_data({ event, state, node, parent }) {
|
||||
if (!node?.server) return null;
|
||||
let is_tracking = true;
|
||||
const uses = {
|
||||
dependencies: /* @__PURE__ */ new Set(),
|
||||
params: /* @__PURE__ */ new Set(),
|
||||
parent: false,
|
||||
route: false,
|
||||
url: false,
|
||||
search_params: /* @__PURE__ */ new Set()
|
||||
};
|
||||
const load = node.server.load;
|
||||
const slash = node.server.trailingSlash;
|
||||
if (!load) {
|
||||
return { type: "data", data: null, uses, slash };
|
||||
}
|
||||
const url = make_trackable(
|
||||
event.url,
|
||||
() => {
|
||||
if (is_tracking) {
|
||||
uses.url = true;
|
||||
}
|
||||
},
|
||||
(param) => {
|
||||
if (is_tracking) {
|
||||
uses.search_params.add(param);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (state.prerendering) {
|
||||
disable_search(url);
|
||||
}
|
||||
let done = false;
|
||||
const result = await with_event(
|
||||
event,
|
||||
() => load.call(null, {
|
||||
...event,
|
||||
fetch: (info, init2) => {
|
||||
const url2 = new URL(info instanceof Request ? info.url : info, event.url);
|
||||
if (BROWSER && done && !uses.dependencies.has(url2.href)) ;
|
||||
return event.fetch(info, init2);
|
||||
},
|
||||
/** @param {string[]} deps */
|
||||
depends: (...deps) => {
|
||||
for (const dep of deps) {
|
||||
const { href } = new URL(dep, event.url);
|
||||
if (BROWSER) ;
|
||||
uses.dependencies.add(href);
|
||||
}
|
||||
},
|
||||
params: new Proxy(event.params, {
|
||||
get: (target, key2) => {
|
||||
if (BROWSER && done && typeof key2 === "string" && !uses.params.has(key2)) ;
|
||||
if (is_tracking) {
|
||||
uses.params.add(key2);
|
||||
}
|
||||
return target[
|
||||
/** @type {string} */
|
||||
key2
|
||||
];
|
||||
}
|
||||
}),
|
||||
parent: async () => {
|
||||
if (BROWSER && done && !uses.parent) ;
|
||||
if (is_tracking) {
|
||||
uses.parent = true;
|
||||
}
|
||||
return parent();
|
||||
},
|
||||
route: new Proxy(event.route, {
|
||||
get: (target, key2) => {
|
||||
if (BROWSER && done && typeof key2 === "string" && !uses.route) ;
|
||||
if (is_tracking) {
|
||||
uses.route = true;
|
||||
}
|
||||
return target[
|
||||
/** @type {'id'} */
|
||||
key2
|
||||
];
|
||||
}
|
||||
}),
|
||||
url,
|
||||
untrack(fn) {
|
||||
is_tracking = false;
|
||||
try {
|
||||
return fn();
|
||||
} finally {
|
||||
is_tracking = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
done = true;
|
||||
return {
|
||||
type: "data",
|
||||
data: result ?? null,
|
||||
uses,
|
||||
slash
|
||||
};
|
||||
}
|
||||
async function load_data({
|
||||
event,
|
||||
fetched,
|
||||
node,
|
||||
parent,
|
||||
server_data_promise,
|
||||
state,
|
||||
resolve_opts,
|
||||
csr
|
||||
}) {
|
||||
const server_data_node = await server_data_promise;
|
||||
if (!node?.universal?.load) {
|
||||
return server_data_node?.data ?? null;
|
||||
}
|
||||
const result = await node.universal.load.call(null, {
|
||||
url: event.url,
|
||||
params: event.params,
|
||||
data: server_data_node?.data ?? null,
|
||||
route: event.route,
|
||||
fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),
|
||||
setHeaders: event.setHeaders,
|
||||
depends: () => {
|
||||
},
|
||||
parent,
|
||||
untrack: (fn) => fn()
|
||||
});
|
||||
return result ?? null;
|
||||
}
|
||||
function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
|
||||
const universal_fetch = async (input, init2) => {
|
||||
const cloned_body = input instanceof Request && input.body ? input.clone().body : null;
|
||||
const cloned_headers = input instanceof Request && [...input.headers].length ? new Headers(input.headers) : init2?.headers;
|
||||
let response = await event.fetch(input, init2);
|
||||
const url = new URL(input instanceof Request ? input.url : input, event.url);
|
||||
const same_origin = url.origin === event.url.origin;
|
||||
let dependency;
|
||||
if (same_origin) {
|
||||
if (state.prerendering) {
|
||||
dependency = { response, body: null };
|
||||
state.prerendering.dependencies.set(url.pathname, dependency);
|
||||
}
|
||||
} else if (url.protocol === "https:" || url.protocol === "http:") {
|
||||
const mode = input instanceof Request ? input.mode : init2?.mode ?? "cors";
|
||||
if (mode === "no-cors") {
|
||||
response = new Response("", {
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
headers: response.headers
|
||||
});
|
||||
} else {
|
||||
const acao = response.headers.get("access-control-allow-origin");
|
||||
if (!acao || acao !== event.url.origin && acao !== "*") {
|
||||
throw new Error(
|
||||
`CORS error: ${acao ? "Incorrect" : "No"} 'Access-Control-Allow-Origin' header is present on the requested resource`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
const proxy = new Proxy(response, {
|
||||
get(response2, key2, _receiver) {
|
||||
async function push_fetched(body2, is_b64) {
|
||||
const status_number = Number(response2.status);
|
||||
if (isNaN(status_number)) {
|
||||
throw new Error(
|
||||
`response.status is not a number. value: "${response2.status}" type: ${typeof response2.status}`
|
||||
);
|
||||
}
|
||||
fetched.push({
|
||||
url: same_origin ? url.href.slice(event.url.origin.length) : url.href,
|
||||
method: event.request.method,
|
||||
request_body: (
|
||||
/** @type {string | ArrayBufferView | undefined} */
|
||||
input instanceof Request && cloned_body ? await stream_to_string(cloned_body) : init2?.body
|
||||
),
|
||||
request_headers: cloned_headers,
|
||||
response_body: body2,
|
||||
response: response2,
|
||||
is_b64
|
||||
});
|
||||
}
|
||||
if (key2 === "arrayBuffer") {
|
||||
return async () => {
|
||||
const buffer = await response2.arrayBuffer();
|
||||
if (dependency) {
|
||||
dependency.body = new Uint8Array(buffer);
|
||||
}
|
||||
if (buffer instanceof ArrayBuffer) {
|
||||
await push_fetched(b64_encode(buffer), true);
|
||||
}
|
||||
return buffer;
|
||||
};
|
||||
}
|
||||
async function text2() {
|
||||
const body2 = await response2.text();
|
||||
if (!body2 || typeof body2 === "string") {
|
||||
await push_fetched(body2, false);
|
||||
}
|
||||
if (dependency) {
|
||||
dependency.body = body2;
|
||||
}
|
||||
return body2;
|
||||
}
|
||||
if (key2 === "text") {
|
||||
return text2;
|
||||
}
|
||||
if (key2 === "json") {
|
||||
return async () => {
|
||||
return JSON.parse(await text2());
|
||||
};
|
||||
}
|
||||
return Reflect.get(response2, key2, response2);
|
||||
}
|
||||
});
|
||||
if (csr) {
|
||||
const get = response.headers.get;
|
||||
response.headers.get = (key2) => {
|
||||
const lower = key2.toLowerCase();
|
||||
const value = get.call(response.headers, lower);
|
||||
if (value && !lower.startsWith("x-sveltekit-")) {
|
||||
const included = resolve_opts.filterSerializedResponseHeaders(lower, value);
|
||||
if (!included) {
|
||||
throw new Error(
|
||||
`Failed to get response header "${lower}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#Server-hooks-handle (at ${event.route.id})`
|
||||
);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
return proxy;
|
||||
};
|
||||
return (input, init2) => {
|
||||
const response = universal_fetch(input, init2);
|
||||
response.catch(() => {
|
||||
});
|
||||
return response;
|
||||
};
|
||||
}
|
||||
async function stream_to_string(stream) {
|
||||
let result = "";
|
||||
const reader = stream.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
result += decoder.decode(value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function hash(...values) {
|
||||
let hash2 = 5381;
|
||||
for (const value of values) {
|
||||
if (typeof value === "string") {
|
||||
let i = value.length;
|
||||
while (i) hash2 = hash2 * 33 ^ value.charCodeAt(--i);
|
||||
} else if (ArrayBuffer.isView(value)) {
|
||||
const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
||||
let i = buffer.length;
|
||||
while (i) hash2 = hash2 * 33 ^ buffer[--i];
|
||||
} else {
|
||||
throw new TypeError("value must be a string or TypedArray");
|
||||
}
|
||||
}
|
||||
return (hash2 >>> 0).toString(36);
|
||||
}
|
||||
const replacements = {
|
||||
"<": "\\u003C",
|
||||
"\u2028": "\\u2028",
|
||||
"\u2029": "\\u2029"
|
||||
};
|
||||
const pattern = new RegExp(`[${Object.keys(replacements).join("")}]`, "g");
|
||||
function serialize_data(fetched, filter, prerendering2 = false) {
|
||||
const headers2 = {};
|
||||
let cache_control = null;
|
||||
let age = null;
|
||||
let varyAny = false;
|
||||
for (const [key2, value] of fetched.response.headers) {
|
||||
if (filter(key2, value)) {
|
||||
headers2[key2] = value;
|
||||
}
|
||||
if (key2 === "cache-control") cache_control = value;
|
||||
else if (key2 === "age") age = value;
|
||||
else if (key2 === "vary" && value.trim() === "*") varyAny = true;
|
||||
}
|
||||
const payload = {
|
||||
status: fetched.response.status,
|
||||
statusText: fetched.response.statusText,
|
||||
headers: headers2,
|
||||
body: fetched.response_body
|
||||
};
|
||||
const safe_payload = JSON.stringify(payload).replace(pattern, (match) => replacements[match]);
|
||||
const attrs = [
|
||||
'type="application/json"',
|
||||
"data-sveltekit-fetched",
|
||||
`data-url="${escape_html(fetched.url, true)}"`
|
||||
];
|
||||
if (fetched.is_b64) {
|
||||
attrs.push("data-b64");
|
||||
}
|
||||
if (fetched.request_headers || fetched.request_body) {
|
||||
const values = [];
|
||||
if (fetched.request_headers) {
|
||||
values.push([...new Headers(fetched.request_headers)].join(","));
|
||||
}
|
||||
if (fetched.request_body) {
|
||||
values.push(fetched.request_body);
|
||||
}
|
||||
attrs.push(`data-hash="${hash(...values)}"`);
|
||||
}
|
||||
if (!prerendering2 && fetched.method === "GET" && cache_control && !varyAny) {
|
||||
const match = /s-maxage=(\d+)/g.exec(cache_control) ?? /max-age=(\d+)/g.exec(cache_control);
|
||||
if (match) {
|
||||
const ttl = +match[1] - +(age ?? "0");
|
||||
attrs.push(`data-ttl="${ttl}"`);
|
||||
}
|
||||
}
|
||||
return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
|
||||
}
|
||||
const s = JSON.stringify;
|
||||
const encoder$2 = new TextEncoder();
|
||||
function sha256(data) {
|
||||
if (!key[0]) precompute();
|
||||
const out = init.slice(0);
|
||||
const array2 = encode(data);
|
||||
for (let i = 0; i < array2.length; i += 16) {
|
||||
const w = array2.subarray(i, i + 16);
|
||||
let tmp;
|
||||
let a;
|
||||
let b;
|
||||
let out0 = out[0];
|
||||
let out1 = out[1];
|
||||
let out2 = out[2];
|
||||
let out3 = out[3];
|
||||
let out4 = out[4];
|
||||
let out5 = out[5];
|
||||
let out6 = out[6];
|
||||
let out7 = out[7];
|
||||
for (let i2 = 0; i2 < 64; i2++) {
|
||||
if (i2 < 16) {
|
||||
tmp = w[i2];
|
||||
} else {
|
||||
a = w[i2 + 1 & 15];
|
||||
b = w[i2 + 14 & 15];
|
||||
tmp = w[i2 & 15] = (a >>> 7 ^ a >>> 18 ^ a >>> 3 ^ a << 25 ^ a << 14) + (b >>> 17 ^ b >>> 19 ^ b >>> 10 ^ b << 15 ^ b << 13) + w[i2 & 15] + w[i2 + 9 & 15] | 0;
|
||||
}
|
||||
tmp = tmp + out7 + (out4 >>> 6 ^ out4 >>> 11 ^ out4 >>> 25 ^ out4 << 26 ^ out4 << 21 ^ out4 << 7) + (out6 ^ out4 & (out5 ^ out6)) + key[i2];
|
||||
out7 = out6;
|
||||
out6 = out5;
|
||||
out5 = out4;
|
||||
out4 = out3 + tmp | 0;
|
||||
out3 = out2;
|
||||
out2 = out1;
|
||||
out1 = out0;
|
||||
out0 = tmp + (out1 & out2 ^ out3 & (out1 ^ out2)) + (out1 >>> 2 ^ out1 >>> 13 ^ out1 >>> 22 ^ out1 << 30 ^ out1 << 19 ^ out1 << 10) | 0;
|
||||
}
|
||||
out[0] = out[0] + out0 | 0;
|
||||
out[1] = out[1] + out1 | 0;
|
||||
out[2] = out[2] + out2 | 0;
|
||||
out[3] = out[3] + out3 | 0;
|
||||
out[4] = out[4] + out4 | 0;
|
||||
out[5] = out[5] + out5 | 0;
|
||||
out[6] = out[6] + out6 | 0;
|
||||
out[7] = out[7] + out7 | 0;
|
||||
}
|
||||
const bytes = new Uint8Array(out.buffer);
|
||||
reverse_endianness(bytes);
|
||||
return base64(bytes);
|
||||
}
|
||||
const init = new Uint32Array(8);
|
||||
const key = new Uint32Array(64);
|
||||
function precompute() {
|
||||
function frac(x) {
|
||||
return (x - Math.floor(x)) * 4294967296;
|
||||
}
|
||||
let prime = 2;
|
||||
for (let i = 0; i < 64; prime++) {
|
||||
let is_prime = true;
|
||||
for (let factor = 2; factor * factor <= prime; factor++) {
|
||||
if (prime % factor === 0) {
|
||||
is_prime = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_prime) {
|
||||
if (i < 8) {
|
||||
init[i] = frac(prime ** (1 / 2));
|
||||
}
|
||||
key[i] = frac(prime ** (1 / 3));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
function reverse_endianness(bytes) {
|
||||
for (let i = 0; i < bytes.length; i += 4) {
|
||||
const a = bytes[i + 0];
|
||||
const b = bytes[i + 1];
|
||||
const c = bytes[i + 2];
|
||||
const d = bytes[i + 3];
|
||||
bytes[i + 0] = d;
|
||||
bytes[i + 1] = c;
|
||||
bytes[i + 2] = b;
|
||||
bytes[i + 3] = a;
|
||||
}
|
||||
}
|
||||
function encode(str) {
|
||||
const encoded = encoder$2.encode(str);
|
||||
const length = encoded.length * 8;
|
||||
const size = 512 * Math.ceil((length + 65) / 512);
|
||||
const bytes = new Uint8Array(size / 8);
|
||||
bytes.set(encoded);
|
||||
bytes[encoded.length] = 128;
|
||||
reverse_endianness(bytes);
|
||||
const words = new Uint32Array(bytes.buffer);
|
||||
words[words.length - 2] = Math.floor(length / 4294967296);
|
||||
words[words.length - 1] = length;
|
||||
return words;
|
||||
}
|
||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
||||
function base64(bytes) {
|
||||
const l = bytes.length;
|
||||
let result = "";
|
||||
let i;
|
||||
for (i = 2; i < l; i += 3) {
|
||||
result += chars[bytes[i - 2] >> 2];
|
||||
result += chars[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
||||
result += chars[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
||||
result += chars[bytes[i] & 63];
|
||||
}
|
||||
if (i === l + 1) {
|
||||
result += chars[bytes[i - 2] >> 2];
|
||||
result += chars[(bytes[i - 2] & 3) << 4];
|
||||
result += "==";
|
||||
}
|
||||
if (i === l) {
|
||||
result += chars[bytes[i - 2] >> 2];
|
||||
result += chars[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
||||
result += chars[(bytes[i - 1] & 15) << 2];
|
||||
result += "=";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const array = new Uint8Array(16);
|
||||
function generate_nonce() {
|
||||
crypto.getRandomValues(array);
|
||||
return base64(array);
|
||||
}
|
||||
const quoted = /* @__PURE__ */ new Set([
|
||||
"self",
|
||||
"unsafe-eval",
|
||||
"unsafe-hashes",
|
||||
"unsafe-inline",
|
||||
"none",
|
||||
"strict-dynamic",
|
||||
"report-sample",
|
||||
"wasm-unsafe-eval",
|
||||
"script"
|
||||
]);
|
||||
const crypto_pattern = /^(nonce|sha\d\d\d)-/;
|
||||
class BaseProvider {
|
||||
/** @type {boolean} */
|
||||
#use_hashes;
|
||||
/** @type {boolean} */
|
||||
#script_needs_csp;
|
||||
/** @type {boolean} */
|
||||
#script_src_needs_csp;
|
||||
/** @type {boolean} */
|
||||
#script_src_elem_needs_csp;
|
||||
/** @type {boolean} */
|
||||
#style_needs_csp;
|
||||
/** @type {boolean} */
|
||||
#style_src_needs_csp;
|
||||
/** @type {boolean} */
|
||||
#style_src_attr_needs_csp;
|
||||
/** @type {boolean} */
|
||||
#style_src_elem_needs_csp;
|
||||
/** @type {import('types').CspDirectives} */
|
||||
#directives;
|
||||
/** @type {import('types').Csp.Source[]} */
|
||||
#script_src;
|
||||
/** @type {import('types').Csp.Source[]} */
|
||||
#script_src_elem;
|
||||
/** @type {import('types').Csp.Source[]} */
|
||||
#style_src;
|
||||
/** @type {import('types').Csp.Source[]} */
|
||||
#style_src_attr;
|
||||
/** @type {import('types').Csp.Source[]} */
|
||||
#style_src_elem;
|
||||
/** @type {string} */
|
||||
#nonce;
|
||||
/**
|
||||
* @param {boolean} use_hashes
|
||||
* @param {import('types').CspDirectives} directives
|
||||
* @param {string} nonce
|
||||
*/
|
||||
constructor(use_hashes, directives, nonce) {
|
||||
this.#use_hashes = use_hashes;
|
||||
this.#directives = directives;
|
||||
const d = this.#directives;
|
||||
this.#script_src = [];
|
||||
this.#script_src_elem = [];
|
||||
this.#style_src = [];
|
||||
this.#style_src_attr = [];
|
||||
this.#style_src_elem = [];
|
||||
const effective_script_src = d["script-src"] || d["default-src"];
|
||||
const script_src_elem = d["script-src-elem"];
|
||||
const effective_style_src = d["style-src"] || d["default-src"];
|
||||
const style_src_attr = d["style-src-attr"];
|
||||
const style_src_elem = d["style-src-elem"];
|
||||
const needs_csp = (directive) => !!directive && !directive.some((value) => value === "unsafe-inline");
|
||||
this.#script_src_needs_csp = needs_csp(effective_script_src);
|
||||
this.#script_src_elem_needs_csp = needs_csp(script_src_elem);
|
||||
this.#style_src_needs_csp = needs_csp(effective_style_src);
|
||||
this.#style_src_attr_needs_csp = needs_csp(style_src_attr);
|
||||
this.#style_src_elem_needs_csp = needs_csp(style_src_elem);
|
||||
this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
|
||||
this.#style_needs_csp = this.#style_src_needs_csp || this.#style_src_attr_needs_csp || this.#style_src_elem_needs_csp;
|
||||
this.script_needs_nonce = this.#script_needs_csp && !this.#use_hashes;
|
||||
this.style_needs_nonce = this.#style_needs_csp && !this.#use_hashes;
|
||||
this.#nonce = nonce;
|
||||
}
|
||||
/** @param {string} content */
|
||||
add_script(content) {
|
||||
if (!this.#script_needs_csp) return;
|
||||
const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
|
||||
if (this.#script_src_needs_csp) {
|
||||
this.#script_src.push(source);
|
||||
}
|
||||
if (this.#script_src_elem_needs_csp) {
|
||||
this.#script_src_elem.push(source);
|
||||
}
|
||||
}
|
||||
/** @param {string} content */
|
||||
add_style(content) {
|
||||
if (!this.#style_needs_csp) return;
|
||||
const source = this.#use_hashes ? `sha256-${sha256(content)}` : `nonce-${this.#nonce}`;
|
||||
if (this.#style_src_needs_csp) {
|
||||
this.#style_src.push(source);
|
||||
}
|
||||
if (this.#style_src_attr_needs_csp) {
|
||||
this.#style_src_attr.push(source);
|
||||
}
|
||||
if (this.#style_src_elem_needs_csp) {
|
||||
const sha256_empty_comment_hash = "sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=";
|
||||
const d = this.#directives;
|
||||
if (d["style-src-elem"] && !d["style-src-elem"].includes(sha256_empty_comment_hash) && !this.#style_src_elem.includes(sha256_empty_comment_hash)) {
|
||||
this.#style_src_elem.push(sha256_empty_comment_hash);
|
||||
}
|
||||
if (source !== sha256_empty_comment_hash) {
|
||||
this.#style_src_elem.push(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {boolean} [is_meta]
|
||||
*/
|
||||
get_header(is_meta = false) {
|
||||
const header = [];
|
||||
const directives = { ...this.#directives };
|
||||
if (this.#style_src.length > 0) {
|
||||
directives["style-src"] = [
|
||||
...directives["style-src"] || directives["default-src"] || [],
|
||||
...this.#style_src
|
||||
];
|
||||
}
|
||||
if (this.#style_src_attr.length > 0) {
|
||||
directives["style-src-attr"] = [
|
||||
...directives["style-src-attr"] || [],
|
||||
...this.#style_src_attr
|
||||
];
|
||||
}
|
||||
if (this.#style_src_elem.length > 0) {
|
||||
directives["style-src-elem"] = [
|
||||
...directives["style-src-elem"] || [],
|
||||
...this.#style_src_elem
|
||||
];
|
||||
}
|
||||
if (this.#script_src.length > 0) {
|
||||
directives["script-src"] = [
|
||||
...directives["script-src"] || directives["default-src"] || [],
|
||||
...this.#script_src
|
||||
];
|
||||
}
|
||||
if (this.#script_src_elem.length > 0) {
|
||||
directives["script-src-elem"] = [
|
||||
...directives["script-src-elem"] || [],
|
||||
...this.#script_src_elem
|
||||
];
|
||||
}
|
||||
for (const key2 in directives) {
|
||||
if (is_meta && (key2 === "frame-ancestors" || key2 === "report-uri" || key2 === "sandbox")) {
|
||||
continue;
|
||||
}
|
||||
const value = (
|
||||
/** @type {string[] | true} */
|
||||
directives[key2]
|
||||
);
|
||||
if (!value) continue;
|
||||
const directive = [key2];
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((value2) => {
|
||||
if (quoted.has(value2) || crypto_pattern.test(value2)) {
|
||||
directive.push(`'${value2}'`);
|
||||
} else {
|
||||
directive.push(value2);
|
||||
}
|
||||
});
|
||||
}
|
||||
header.push(directive.join(" "));
|
||||
}
|
||||
return header.join("; ");
|
||||
}
|
||||
}
|
||||
class CspProvider extends BaseProvider {
|
||||
get_meta() {
|
||||
const content = this.get_header(true);
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
return `<meta http-equiv="content-security-policy" content="${escape_html(content, true)}">`;
|
||||
}
|
||||
}
|
||||
class CspReportOnlyProvider extends BaseProvider {
|
||||
/**
|
||||
* @param {boolean} use_hashes
|
||||
* @param {import('types').CspDirectives} directives
|
||||
* @param {string} nonce
|
||||
*/
|
||||
constructor(use_hashes, directives, nonce) {
|
||||
super(use_hashes, directives, nonce);
|
||||
if (Object.values(directives).filter((v) => !!v).length > 0) {
|
||||
const has_report_to = directives["report-to"]?.length ?? 0 > 0;
|
||||
const has_report_uri = directives["report-uri"]?.length ?? 0 > 0;
|
||||
if (!has_report_to && !has_report_uri) {
|
||||
throw Error(
|
||||
"`content-security-policy-report-only` must be specified with either the `report-to` or `report-uri` directives, or both"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
class Csp {
|
||||
/** @readonly */
|
||||
nonce = generate_nonce();
|
||||
/** @type {CspProvider} */
|
||||
csp_provider;
|
||||
/** @type {CspReportOnlyProvider} */
|
||||
report_only_provider;
|
||||
/**
|
||||
* @param {import('./types.js').CspConfig} config
|
||||
* @param {import('./types.js').CspOpts} opts
|
||||
*/
|
||||
constructor({ mode, directives, reportOnly }, { prerender }) {
|
||||
const use_hashes = mode === "hash" || mode === "auto" && prerender;
|
||||
this.csp_provider = new CspProvider(use_hashes, directives, this.nonce);
|
||||
this.report_only_provider = new CspReportOnlyProvider(use_hashes, reportOnly, this.nonce);
|
||||
}
|
||||
get script_needs_nonce() {
|
||||
return this.csp_provider.script_needs_nonce || this.report_only_provider.script_needs_nonce;
|
||||
}
|
||||
get style_needs_nonce() {
|
||||
return this.csp_provider.style_needs_nonce || this.report_only_provider.style_needs_nonce;
|
||||
}
|
||||
/** @param {string} content */
|
||||
add_script(content) {
|
||||
this.csp_provider.add_script(content);
|
||||
this.report_only_provider.add_script(content);
|
||||
}
|
||||
/** @param {string} content */
|
||||
add_style(content) {
|
||||
this.csp_provider.add_style(content);
|
||||
this.report_only_provider.add_style(content);
|
||||
}
|
||||
}
|
||||
function defer() {
|
||||
let fulfil;
|
||||
let reject;
|
||||
const promise = new Promise((f, r) => {
|
||||
fulfil = f;
|
||||
reject = r;
|
||||
});
|
||||
return { promise, fulfil, reject };
|
||||
}
|
||||
function create_async_iterator() {
|
||||
const deferred = [defer()];
|
||||
return {
|
||||
iterator: {
|
||||
[Symbol.asyncIterator]() {
|
||||
return {
|
||||
next: async () => {
|
||||
const next = await deferred[0].promise;
|
||||
if (!next.done) deferred.shift();
|
||||
return next;
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
push: (value) => {
|
||||
deferred[deferred.length - 1].fulfil({
|
||||
value,
|
||||
done: false
|
||||
});
|
||||
deferred.push(defer());
|
||||
},
|
||||
done: () => {
|
||||
deferred[deferred.length - 1].fulfil({ done: true });
|
||||
}
|
||||
};
|
||||
}
|
||||
function exec(match, params, matchers) {
|
||||
const result = {};
|
||||
const values = match.slice(1);
|
||||
const values_needing_match = values.filter((value) => value !== void 0);
|
||||
let buffered = 0;
|
||||
for (let i = 0; i < params.length; i += 1) {
|
||||
const param = params[i];
|
||||
let value = values[i - buffered];
|
||||
if (param.chained && param.rest && buffered) {
|
||||
value = values.slice(i - buffered, i + 1).filter((s2) => s2).join("/");
|
||||
buffered = 0;
|
||||
}
|
||||
if (value === void 0) {
|
||||
if (param.rest) result[param.name] = "";
|
||||
continue;
|
||||
}
|
||||
if (!param.matcher || matchers[param.matcher](value)) {
|
||||
result[param.name] = value;
|
||||
const next_param = params[i + 1];
|
||||
const next_value = values[i + 1];
|
||||
if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) {
|
||||
buffered = 0;
|
||||
}
|
||||
if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) {
|
||||
buffered = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (param.optional && param.chained) {
|
||||
buffered++;
|
||||
continue;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (buffered) return;
|
||||
return result;
|
||||
}
|
||||
function generate_route_object(route, url, manifest) {
|
||||
const { errors, layouts, leaf } = route;
|
||||
const nodes = [...errors, ...layouts.map((l) => l?.[1]), leaf[1]].filter((n) => typeof n === "number").map((n) => `'${n}': () => ${create_client_import(manifest._.client.nodes?.[n], url)}`).join(",\n ");
|
||||
return [
|
||||
`{
|
||||
id: ${s(route.id)}`,
|
||||
`errors: ${s(route.errors)}`,
|
||||
`layouts: ${s(route.layouts)}`,
|
||||
`leaf: ${s(route.leaf)}`,
|
||||
`nodes: {
|
||||
${nodes}
|
||||
}
|
||||
}`
|
||||
].join(",\n ");
|
||||
}
|
||||
function create_client_import(import_path, url) {
|
||||
if (!import_path) return "Promise.resolve({})";
|
||||
if (import_path[0] === "/") {
|
||||
return `import('${import_path}')`;
|
||||
}
|
||||
if (assets !== "") {
|
||||
return `import('${assets}/${import_path}')`;
|
||||
}
|
||||
let path = get_relative_path(url.pathname, `${base}/${import_path}`);
|
||||
if (path[0] !== ".") path = `./${path}`;
|
||||
return `import('${path}')`;
|
||||
}
|
||||
async function resolve_route(resolved_path, url, manifest) {
|
||||
if (!manifest._.client.routes) {
|
||||
return text("Server-side route resolution disabled", { status: 400 });
|
||||
}
|
||||
let route = null;
|
||||
let params = {};
|
||||
const matchers = await manifest._.matchers();
|
||||
for (const candidate of manifest._.client.routes) {
|
||||
const match = candidate.pattern.exec(resolved_path);
|
||||
if (!match) continue;
|
||||
const matched = exec(match, candidate.params, matchers);
|
||||
if (matched) {
|
||||
route = candidate;
|
||||
params = decode_params(matched);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return create_server_routing_response(route, params, url, manifest).response;
|
||||
}
|
||||
function create_server_routing_response(route, params, url, manifest) {
|
||||
const headers2 = new Headers({
|
||||
"content-type": "application/javascript; charset=utf-8"
|
||||
});
|
||||
if (route) {
|
||||
const csr_route = generate_route_object(route, url, manifest);
|
||||
const body2 = `${create_css_import(route, url, manifest)}
|
||||
export const route = ${csr_route}; export const params = ${JSON.stringify(params)};`;
|
||||
return { response: text(body2, { headers: headers2 }), body: body2 };
|
||||
} else {
|
||||
return { response: text("", { headers: headers2 }), body: "" };
|
||||
}
|
||||
}
|
||||
function create_css_import(route, url, manifest) {
|
||||
const { errors, layouts, leaf } = route;
|
||||
let css = "";
|
||||
for (const node of [...errors, ...layouts.map((l) => l?.[1]), leaf[1]]) {
|
||||
if (typeof node !== "number") continue;
|
||||
const node_css = manifest._.client.css?.[node];
|
||||
for (const css_path of node_css ?? []) {
|
||||
css += `'${assets || base}/${css_path}',`;
|
||||
}
|
||||
}
|
||||
if (!css) return "";
|
||||
return `${create_client_import(
|
||||
/** @type {string} */
|
||||
manifest._.client.start,
|
||||
url
|
||||
)}.then(x => x.load_css([${css}]));`;
|
||||
}
|
||||
const updated = {
|
||||
...readable(false),
|
||||
check: () => false
|
||||
};
|
||||
const encoder$1 = new TextEncoder();
|
||||
async function render_response({
|
||||
branch,
|
||||
fetched,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
page_config,
|
||||
status,
|
||||
error = null,
|
||||
event,
|
||||
resolve_opts,
|
||||
action_result
|
||||
}) {
|
||||
if (state.prerendering) {
|
||||
if (options2.csp.mode === "nonce") {
|
||||
throw new Error('Cannot use prerendering if config.kit.csp.mode === "nonce"');
|
||||
}
|
||||
if (options2.app_template_contains_nonce) {
|
||||
throw new Error("Cannot use prerendering if page template contains %sveltekit.nonce%");
|
||||
}
|
||||
}
|
||||
const { client } = manifest._;
|
||||
const modulepreloads = new Set(client.imports);
|
||||
const stylesheets = new Set(client.stylesheets);
|
||||
const fonts = new Set(client.fonts);
|
||||
const link_header_preloads = /* @__PURE__ */ new Set();
|
||||
const inline_styles = /* @__PURE__ */ new Map();
|
||||
let rendered;
|
||||
const form_value = action_result?.type === "success" || action_result?.type === "failure" ? action_result.data ?? null : null;
|
||||
let base$1 = base;
|
||||
let assets$1 = assets;
|
||||
let base_expression = s(base);
|
||||
{
|
||||
if (!state.prerendering?.fallback) {
|
||||
const segments = event.url.pathname.slice(base.length).split("/").slice(2);
|
||||
base$1 = segments.map(() => "..").join("/") || ".";
|
||||
base_expression = `new URL(${s(base$1)}, location).pathname.slice(0, -1)`;
|
||||
if (!assets || assets[0] === "/" && assets !== SVELTE_KIT_ASSETS) {
|
||||
assets$1 = base$1;
|
||||
}
|
||||
} else if (options2.hash_routing) {
|
||||
base_expression = "new URL('.', location).pathname.slice(0, -1)";
|
||||
}
|
||||
}
|
||||
if (page_config.ssr) {
|
||||
const props = {
|
||||
stores: {
|
||||
page: writable(null),
|
||||
navigating: writable(null),
|
||||
updated
|
||||
},
|
||||
constructors: await Promise.all(
|
||||
branch.map(({ node }) => {
|
||||
if (!node.component) {
|
||||
throw new Error(`Missing +page.svelte component for route ${event.route.id}`);
|
||||
}
|
||||
return node.component();
|
||||
})
|
||||
),
|
||||
form: form_value
|
||||
};
|
||||
let data2 = {};
|
||||
for (let i = 0; i < branch.length; i += 1) {
|
||||
data2 = { ...data2, ...branch[i].data };
|
||||
props[`data_${i}`] = data2;
|
||||
}
|
||||
props.page = {
|
||||
error,
|
||||
params: (
|
||||
/** @type {Record<string, any>} */
|
||||
event.params
|
||||
),
|
||||
route: event.route,
|
||||
status,
|
||||
url: event.url,
|
||||
data: data2,
|
||||
form: form_value,
|
||||
state: {}
|
||||
};
|
||||
override({ base: base$1, assets: assets$1 });
|
||||
const render_opts = {
|
||||
context: /* @__PURE__ */ new Map([
|
||||
[
|
||||
"__request__",
|
||||
{
|
||||
page: props.page
|
||||
}
|
||||
]
|
||||
])
|
||||
};
|
||||
{
|
||||
try {
|
||||
rendered = options2.root.render(props, render_opts);
|
||||
} finally {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
for (const { node } of branch) {
|
||||
for (const url of node.imports) modulepreloads.add(url);
|
||||
for (const url of node.stylesheets) stylesheets.add(url);
|
||||
for (const url of node.fonts) fonts.add(url);
|
||||
if (node.inline_styles && !client.inline) {
|
||||
Object.entries(await node.inline_styles()).forEach(([k, v]) => inline_styles.set(k, v));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rendered = { head: "", html: "", css: { code: "", map: null } };
|
||||
}
|
||||
let head = "";
|
||||
let body2 = rendered.html;
|
||||
const csp = new Csp(options2.csp, {
|
||||
prerender: !!state.prerendering
|
||||
});
|
||||
const prefixed = (path) => {
|
||||
if (path.startsWith("/")) {
|
||||
return base + path;
|
||||
}
|
||||
return `${assets$1}/${path}`;
|
||||
};
|
||||
const style = client.inline ? client.inline?.style : Array.from(inline_styles.values()).join("\n");
|
||||
if (style) {
|
||||
const attributes = [];
|
||||
if (csp.style_needs_nonce) attributes.push(` nonce="${csp.nonce}"`);
|
||||
csp.add_style(style);
|
||||
head += `
|
||||
<style${attributes.join("")}>${style}</style>`;
|
||||
}
|
||||
for (const dep of stylesheets) {
|
||||
const path = prefixed(dep);
|
||||
const attributes = ['rel="stylesheet"'];
|
||||
if (inline_styles.has(dep)) {
|
||||
attributes.push("disabled", 'media="(max-width: 0)"');
|
||||
} else {
|
||||
if (resolve_opts.preload({ type: "css", path })) {
|
||||
const preload_atts = ['rel="preload"', 'as="style"'];
|
||||
link_header_preloads.add(`<${encodeURI(path)}>; ${preload_atts.join(";")}; nopush`);
|
||||
}
|
||||
}
|
||||
head += `
|
||||
<link href="${path}" ${attributes.join(" ")}>`;
|
||||
}
|
||||
for (const dep of fonts) {
|
||||
const path = prefixed(dep);
|
||||
if (resolve_opts.preload({ type: "font", path })) {
|
||||
const ext = dep.slice(dep.lastIndexOf(".") + 1);
|
||||
const attributes = [
|
||||
'rel="preload"',
|
||||
'as="font"',
|
||||
`type="font/${ext}"`,
|
||||
`href="${path}"`,
|
||||
"crossorigin"
|
||||
];
|
||||
head += `
|
||||
<link ${attributes.join(" ")}>`;
|
||||
}
|
||||
}
|
||||
const global = `__sveltekit_${options2.version_hash}`;
|
||||
const { data, chunks } = get_data(
|
||||
event,
|
||||
options2,
|
||||
branch.map((b) => b.server_data),
|
||||
csp,
|
||||
global
|
||||
);
|
||||
if (page_config.ssr && page_config.csr) {
|
||||
body2 += `
|
||||
${fetched.map(
|
||||
(item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!state.prerendering)
|
||||
).join("\n ")}`;
|
||||
}
|
||||
if (page_config.csr) {
|
||||
const route = manifest._.client.routes?.find((r) => r.id === event.route.id) ?? null;
|
||||
if (client.uses_env_dynamic_public && state.prerendering) {
|
||||
modulepreloads.add(`${app_dir}/env.js`);
|
||||
}
|
||||
if (!client.inline) {
|
||||
const included_modulepreloads = Array.from(modulepreloads, (dep) => prefixed(dep)).filter(
|
||||
(path) => resolve_opts.preload({ type: "js", path })
|
||||
);
|
||||
for (const path of included_modulepreloads) {
|
||||
link_header_preloads.add(`<${encodeURI(path)}>; rel="modulepreload"; nopush`);
|
||||
if (options2.preload_strategy !== "modulepreload") {
|
||||
head += `
|
||||
<link rel="preload" as="script" crossorigin="anonymous" href="${path}">`;
|
||||
} else if (state.prerendering) {
|
||||
head += `
|
||||
<link rel="modulepreload" href="${path}">`;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (manifest._.client.routes && state.prerendering && !state.prerendering.fallback) {
|
||||
const pathname = add_resolution_suffix(event.url.pathname);
|
||||
state.prerendering.dependencies.set(
|
||||
pathname,
|
||||
create_server_routing_response(route, event.params, new URL(pathname, event.url), manifest)
|
||||
);
|
||||
}
|
||||
const blocks = [];
|
||||
const load_env_eagerly = client.uses_env_dynamic_public && state.prerendering;
|
||||
const properties = [`base: ${base_expression}`];
|
||||
if (assets) {
|
||||
properties.push(`assets: ${s(assets)}`);
|
||||
}
|
||||
if (client.uses_env_dynamic_public) {
|
||||
properties.push(`env: ${load_env_eagerly ? "null" : s(public_env)}`);
|
||||
}
|
||||
if (chunks) {
|
||||
blocks.push("const deferred = new Map();");
|
||||
properties.push(`defer: (id) => new Promise((fulfil, reject) => {
|
||||
deferred.set(id, { fulfil, reject });
|
||||
})`);
|
||||
properties.push(`resolve: ({ id, data, error }) => {
|
||||
const try_to_resolve = () => {
|
||||
if (!deferred.has(id)) {
|
||||
setTimeout(try_to_resolve, 0);
|
||||
return;
|
||||
}
|
||||
const { fulfil, reject } = deferred.get(id);
|
||||
deferred.delete(id);
|
||||
if (error) reject(error);
|
||||
else fulfil(data);
|
||||
}
|
||||
try_to_resolve();
|
||||
}`);
|
||||
}
|
||||
blocks.push(`${global} = {
|
||||
${properties.join(",\n ")}
|
||||
};`);
|
||||
const args = ["element"];
|
||||
blocks.push("const element = document.currentScript.parentElement;");
|
||||
if (page_config.ssr) {
|
||||
const serialized = { form: "null", error: "null" };
|
||||
if (form_value) {
|
||||
serialized.form = uneval_action_response(
|
||||
form_value,
|
||||
/** @type {string} */
|
||||
event.route.id,
|
||||
options2.hooks.transport
|
||||
);
|
||||
}
|
||||
if (error) {
|
||||
serialized.error = devalue.uneval(error);
|
||||
}
|
||||
const hydrate = [
|
||||
`node_ids: [${branch.map(({ node }) => node.index).join(", ")}]`,
|
||||
`data: ${data}`,
|
||||
`form: ${serialized.form}`,
|
||||
`error: ${serialized.error}`
|
||||
];
|
||||
if (status !== 200) {
|
||||
hydrate.push(`status: ${status}`);
|
||||
}
|
||||
if (manifest._.client.routes) {
|
||||
if (route) {
|
||||
const stringified = generate_route_object(route, event.url, manifest).replaceAll(
|
||||
"\n",
|
||||
"\n "
|
||||
);
|
||||
hydrate.push(`params: ${devalue.uneval(event.params)}`, `server_route: ${stringified}`);
|
||||
}
|
||||
} else if (options2.embedded) {
|
||||
hydrate.push(`params: ${devalue.uneval(event.params)}`, `route: ${s(event.route)}`);
|
||||
}
|
||||
const indent = " ".repeat(load_env_eagerly ? 7 : 6);
|
||||
args.push(`{
|
||||
${indent} ${hydrate.join(`,
|
||||
${indent} `)}
|
||||
${indent}}`);
|
||||
}
|
||||
const boot = client.inline ? `${client.inline.script}
|
||||
|
||||
__sveltekit_${options2.version_hash}.app.start(${args.join(", ")});` : client.app ? `Promise.all([
|
||||
import(${s(prefixed(client.start))}),
|
||||
import(${s(prefixed(client.app))})
|
||||
]).then(([kit, app]) => {
|
||||
kit.start(app, ${args.join(", ")});
|
||||
});` : `import(${s(prefixed(client.start))}).then((app) => {
|
||||
app.start(${args.join(", ")})
|
||||
});`;
|
||||
if (load_env_eagerly) {
|
||||
blocks.push(`import(${s(`${base$1}/${app_dir}/env.js`)}).then(({ env }) => {
|
||||
${global}.env = env;
|
||||
|
||||
${boot.replace(/\n/g, "\n ")}
|
||||
});`);
|
||||
} else {
|
||||
blocks.push(boot);
|
||||
}
|
||||
if (options2.service_worker) {
|
||||
const opts = "";
|
||||
blocks.push(`if ('serviceWorker' in navigator) {
|
||||
addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('${prefixed("service-worker.js")}'${opts});
|
||||
});
|
||||
}`);
|
||||
}
|
||||
const init_app = `
|
||||
{
|
||||
${blocks.join("\n\n ")}
|
||||
}
|
||||
`;
|
||||
csp.add_script(init_app);
|
||||
body2 += `
|
||||
<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ""}>${init_app}<\/script>
|
||||
`;
|
||||
}
|
||||
const headers2 = new Headers({
|
||||
"x-sveltekit-page": "true",
|
||||
"content-type": "text/html"
|
||||
});
|
||||
if (state.prerendering) {
|
||||
const http_equiv = [];
|
||||
const csp_headers = csp.csp_provider.get_meta();
|
||||
if (csp_headers) {
|
||||
http_equiv.push(csp_headers);
|
||||
}
|
||||
if (state.prerendering.cache) {
|
||||
http_equiv.push(`<meta http-equiv="cache-control" content="${state.prerendering.cache}">`);
|
||||
}
|
||||
if (http_equiv.length > 0) {
|
||||
head = http_equiv.join("\n") + head;
|
||||
}
|
||||
} else {
|
||||
const csp_header = csp.csp_provider.get_header();
|
||||
if (csp_header) {
|
||||
headers2.set("content-security-policy", csp_header);
|
||||
}
|
||||
const report_only_header = csp.report_only_provider.get_header();
|
||||
if (report_only_header) {
|
||||
headers2.set("content-security-policy-report-only", report_only_header);
|
||||
}
|
||||
if (link_header_preloads.size) {
|
||||
headers2.set("link", Array.from(link_header_preloads).join(", "));
|
||||
}
|
||||
}
|
||||
head += rendered.head;
|
||||
const html = options2.templates.app({
|
||||
head,
|
||||
body: body2,
|
||||
assets: assets$1,
|
||||
nonce: (
|
||||
/** @type {string} */
|
||||
csp.nonce
|
||||
),
|
||||
env: safe_public_env
|
||||
});
|
||||
const transformed = await resolve_opts.transformPageChunk({
|
||||
html,
|
||||
done: true
|
||||
}) || "";
|
||||
if (!chunks) {
|
||||
headers2.set("etag", `"${hash(transformed)}"`);
|
||||
}
|
||||
return !chunks ? text(transformed, {
|
||||
status,
|
||||
headers: headers2
|
||||
}) : new Response(
|
||||
new ReadableStream({
|
||||
async start(controller) {
|
||||
controller.enqueue(encoder$1.encode(transformed + "\n"));
|
||||
for await (const chunk of chunks) {
|
||||
controller.enqueue(encoder$1.encode(chunk));
|
||||
}
|
||||
controller.close();
|
||||
},
|
||||
type: "bytes"
|
||||
}),
|
||||
{
|
||||
headers: headers2
|
||||
}
|
||||
);
|
||||
}
|
||||
function get_data(event, options2, nodes, csp, global) {
|
||||
let promise_id = 1;
|
||||
let count = 0;
|
||||
const { iterator, push, done } = create_async_iterator();
|
||||
function replacer(thing) {
|
||||
if (typeof thing?.then === "function") {
|
||||
const id = promise_id++;
|
||||
count += 1;
|
||||
thing.then(
|
||||
/** @param {any} data */
|
||||
(data) => ({ data })
|
||||
).catch(
|
||||
/** @param {any} error */
|
||||
async (error) => ({
|
||||
error: await handle_error_and_jsonify(event, options2, error)
|
||||
})
|
||||
).then(
|
||||
/**
|
||||
* @param {{data: any; error: any}} result
|
||||
*/
|
||||
async ({ data, error }) => {
|
||||
count -= 1;
|
||||
let str;
|
||||
try {
|
||||
str = devalue.uneval({ id, data, error }, replacer);
|
||||
} catch {
|
||||
error = await handle_error_and_jsonify(
|
||||
event,
|
||||
options2,
|
||||
new Error(`Failed to serialize promise while rendering ${event.route.id}`)
|
||||
);
|
||||
data = void 0;
|
||||
str = devalue.uneval({ id, data, error }, replacer);
|
||||
}
|
||||
const nonce = csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : "";
|
||||
push(`<script${nonce}>${global}.resolve(${str})<\/script>
|
||||
`);
|
||||
if (count === 0) done();
|
||||
}
|
||||
);
|
||||
return `${global}.defer(${id})`;
|
||||
} else {
|
||||
for (const key2 in options2.hooks.transport) {
|
||||
const encoded = options2.hooks.transport[key2].encode(thing);
|
||||
if (encoded) {
|
||||
return `app.decode('${key2}', ${devalue.uneval(encoded, replacer)})`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
const strings = nodes.map((node) => {
|
||||
if (!node) return "null";
|
||||
return `{"type":"data","data":${devalue.uneval(node.data, replacer)},${stringify_uses(node)}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ""}}`;
|
||||
});
|
||||
return {
|
||||
data: `[${strings.join(",")}]`,
|
||||
chunks: count > 0 ? iterator : null
|
||||
};
|
||||
} catch (e) {
|
||||
throw new Error(clarify_devalue_error(
|
||||
event,
|
||||
/** @type {any} */
|
||||
e
|
||||
));
|
||||
}
|
||||
}
|
||||
class PageNodes {
|
||||
data;
|
||||
/**
|
||||
* @param {Array<import('types').SSRNode | undefined>} nodes
|
||||
*/
|
||||
constructor(nodes) {
|
||||
this.data = nodes;
|
||||
}
|
||||
layouts() {
|
||||
return this.data.slice(0, -1);
|
||||
}
|
||||
page() {
|
||||
return this.data.at(-1);
|
||||
}
|
||||
validate() {
|
||||
for (const layout of this.layouts()) {
|
||||
if (layout) {
|
||||
validate_layout_server_exports(
|
||||
layout.server,
|
||||
/** @type {string} */
|
||||
layout.server_id
|
||||
);
|
||||
validate_layout_exports(
|
||||
layout.universal,
|
||||
/** @type {string} */
|
||||
layout.universal_id
|
||||
);
|
||||
}
|
||||
}
|
||||
const page = this.page();
|
||||
if (page) {
|
||||
validate_page_server_exports(
|
||||
page.server,
|
||||
/** @type {string} */
|
||||
page.server_id
|
||||
);
|
||||
validate_page_exports(
|
||||
page.universal,
|
||||
/** @type {string} */
|
||||
page.universal_id
|
||||
);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @template {'prerender' | 'ssr' | 'csr' | 'trailingSlash' | 'entries'} Option
|
||||
* @template {(import('types').UniversalNode | import('types').ServerNode)[Option]} Value
|
||||
* @param {Option} option
|
||||
* @returns {Value | undefined}
|
||||
*/
|
||||
#get_option(option) {
|
||||
return this.data.reduce(
|
||||
(value, node) => {
|
||||
return (
|
||||
/** @type {Value} TypeScript's too dumb to understand this */
|
||||
node?.universal?.[option] ?? node?.server?.[option] ?? value
|
||||
);
|
||||
},
|
||||
/** @type {Value | undefined} */
|
||||
void 0
|
||||
);
|
||||
}
|
||||
csr() {
|
||||
return this.#get_option("csr") ?? true;
|
||||
}
|
||||
ssr() {
|
||||
return this.#get_option("ssr") ?? true;
|
||||
}
|
||||
prerender() {
|
||||
return this.#get_option("prerender") ?? false;
|
||||
}
|
||||
trailing_slash() {
|
||||
return this.#get_option("trailingSlash") ?? "never";
|
||||
}
|
||||
get_config() {
|
||||
let current = {};
|
||||
for (const node of this.data) {
|
||||
if (!node?.universal?.config && !node?.server?.config) continue;
|
||||
current = {
|
||||
...current,
|
||||
...node?.universal?.config,
|
||||
...node?.server?.config
|
||||
};
|
||||
}
|
||||
return Object.keys(current).length ? current : void 0;
|
||||
}
|
||||
should_prerender_data() {
|
||||
return this.data.some(
|
||||
// prerender in case of trailingSlash because the client retrieves that value from the server
|
||||
(node) => node?.server?.load || node?.server?.trailingSlash !== void 0
|
||||
);
|
||||
}
|
||||
}
|
||||
async function respond_with_error({
|
||||
event,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
status,
|
||||
error,
|
||||
resolve_opts
|
||||
}) {
|
||||
if (event.request.headers.get("x-sveltekit-error")) {
|
||||
return static_error_page(
|
||||
options2,
|
||||
status,
|
||||
/** @type {Error} */
|
||||
error.message
|
||||
);
|
||||
}
|
||||
const fetched = [];
|
||||
try {
|
||||
const branch = [];
|
||||
const default_layout = await manifest._.nodes[0]();
|
||||
const nodes = new PageNodes([default_layout]);
|
||||
const ssr = nodes.ssr();
|
||||
const csr = nodes.csr();
|
||||
if (ssr) {
|
||||
state.error = true;
|
||||
const server_data_promise = load_server_data({
|
||||
event,
|
||||
state,
|
||||
node: default_layout,
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
parent: async () => ({})
|
||||
});
|
||||
const server_data = await server_data_promise;
|
||||
const data = await load_data({
|
||||
event,
|
||||
fetched,
|
||||
node: default_layout,
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
parent: async () => ({}),
|
||||
resolve_opts,
|
||||
server_data_promise,
|
||||
state,
|
||||
csr
|
||||
});
|
||||
branch.push(
|
||||
{
|
||||
node: default_layout,
|
||||
server_data,
|
||||
data
|
||||
},
|
||||
{
|
||||
node: await manifest._.nodes[1](),
|
||||
// 1 is always the root error
|
||||
data: null,
|
||||
server_data: null
|
||||
}
|
||||
);
|
||||
}
|
||||
return await render_response({
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
page_config: {
|
||||
ssr,
|
||||
csr
|
||||
},
|
||||
status,
|
||||
error: await handle_error_and_jsonify(event, options2, error),
|
||||
branch,
|
||||
fetched,
|
||||
event,
|
||||
resolve_opts
|
||||
});
|
||||
} catch (e) {
|
||||
if (e instanceof Redirect) {
|
||||
return redirect_response(e.status, e.location);
|
||||
}
|
||||
return static_error_page(
|
||||
options2,
|
||||
get_status(e),
|
||||
(await handle_error_and_jsonify(event, options2, e)).message
|
||||
);
|
||||
}
|
||||
}
|
||||
function once(fn) {
|
||||
let done = false;
|
||||
let result;
|
||||
return () => {
|
||||
if (done) return result;
|
||||
done = true;
|
||||
return result = fn();
|
||||
};
|
||||
}
|
||||
const encoder = new TextEncoder();
|
||||
async function render_data(event, route, options2, manifest, state, invalidated_data_nodes, trailing_slash) {
|
||||
if (!route.page) {
|
||||
return new Response(void 0, {
|
||||
status: 404
|
||||
});
|
||||
}
|
||||
try {
|
||||
const node_ids = [...route.page.layouts, route.page.leaf];
|
||||
const invalidated = invalidated_data_nodes ?? node_ids.map(() => true);
|
||||
let aborted = false;
|
||||
const url = new URL(event.url);
|
||||
url.pathname = normalize_path(url.pathname, trailing_slash);
|
||||
const new_event = { ...event, url };
|
||||
const functions = node_ids.map((n, i) => {
|
||||
return once(async () => {
|
||||
try {
|
||||
if (aborted) {
|
||||
return (
|
||||
/** @type {import('types').ServerDataSkippedNode} */
|
||||
{
|
||||
type: "skip"
|
||||
}
|
||||
);
|
||||
}
|
||||
const node = n == void 0 ? n : await manifest._.nodes[n]();
|
||||
return load_server_data({
|
||||
event: new_event,
|
||||
state,
|
||||
node,
|
||||
parent: async () => {
|
||||
const data2 = {};
|
||||
for (let j = 0; j < i; j += 1) {
|
||||
const parent = (
|
||||
/** @type {import('types').ServerDataNode | null} */
|
||||
await functions[j]()
|
||||
);
|
||||
if (parent) {
|
||||
Object.assign(data2, parent.data);
|
||||
}
|
||||
}
|
||||
return data2;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
aborted = true;
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
||||
const promises = functions.map(async (fn, i) => {
|
||||
if (!invalidated[i]) {
|
||||
return (
|
||||
/** @type {import('types').ServerDataSkippedNode} */
|
||||
{
|
||||
type: "skip"
|
||||
}
|
||||
);
|
||||
}
|
||||
return fn();
|
||||
});
|
||||
let length = promises.length;
|
||||
const nodes = await Promise.all(
|
||||
promises.map(
|
||||
(p, i) => p.catch(async (error) => {
|
||||
if (error instanceof Redirect) {
|
||||
throw error;
|
||||
}
|
||||
length = Math.min(length, i + 1);
|
||||
return (
|
||||
/** @type {import('types').ServerErrorNode} */
|
||||
{
|
||||
type: "error",
|
||||
error: await handle_error_and_jsonify(event, options2, error),
|
||||
status: error instanceof HttpError || error instanceof SvelteKitError ? error.status : void 0
|
||||
}
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
const { data, chunks } = get_data_json(event, options2, nodes);
|
||||
if (!chunks) {
|
||||
return json_response(data);
|
||||
}
|
||||
return new Response(
|
||||
new ReadableStream({
|
||||
async start(controller) {
|
||||
controller.enqueue(encoder.encode(data));
|
||||
for await (const chunk of chunks) {
|
||||
controller.enqueue(encoder.encode(chunk));
|
||||
}
|
||||
controller.close();
|
||||
},
|
||||
type: "bytes"
|
||||
}),
|
||||
{
|
||||
headers: {
|
||||
// we use a proprietary content type to prevent buffering.
|
||||
// the `text` prefix makes it inspectable
|
||||
"content-type": "text/sveltekit-data",
|
||||
"cache-control": "private, no-store"
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
const error = normalize_error(e);
|
||||
if (error instanceof Redirect) {
|
||||
return redirect_json_response(error);
|
||||
} else {
|
||||
return json_response(await handle_error_and_jsonify(event, options2, error), 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
function json_response(json2, status = 200) {
|
||||
return text(typeof json2 === "string" ? json2 : JSON.stringify(json2), {
|
||||
status,
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"cache-control": "private, no-store"
|
||||
}
|
||||
});
|
||||
}
|
||||
function redirect_json_response(redirect) {
|
||||
return json_response({
|
||||
type: "redirect",
|
||||
location: redirect.location
|
||||
});
|
||||
}
|
||||
function get_data_json(event, options2, nodes) {
|
||||
let promise_id = 1;
|
||||
let count = 0;
|
||||
const { iterator, push, done } = create_async_iterator();
|
||||
const reducers = {
|
||||
...Object.fromEntries(
|
||||
Object.entries(options2.hooks.transport).map(([key2, value]) => [key2, value.encode])
|
||||
),
|
||||
/** @param {any} thing */
|
||||
Promise: (thing) => {
|
||||
if (typeof thing?.then === "function") {
|
||||
const id = promise_id++;
|
||||
count += 1;
|
||||
let key2 = "data";
|
||||
thing.catch(
|
||||
/** @param {any} e */
|
||||
async (e) => {
|
||||
key2 = "error";
|
||||
return handle_error_and_jsonify(
|
||||
event,
|
||||
options2,
|
||||
/** @type {any} */
|
||||
e
|
||||
);
|
||||
}
|
||||
).then(
|
||||
/** @param {any} value */
|
||||
async (value) => {
|
||||
let str;
|
||||
try {
|
||||
str = devalue.stringify(value, reducers);
|
||||
} catch {
|
||||
const error = await handle_error_and_jsonify(
|
||||
event,
|
||||
options2,
|
||||
new Error(`Failed to serialize promise while rendering ${event.route.id}`)
|
||||
);
|
||||
key2 = "error";
|
||||
str = devalue.stringify(error, reducers);
|
||||
}
|
||||
count -= 1;
|
||||
push(`{"type":"chunk","id":${id},"${key2}":${str}}
|
||||
`);
|
||||
if (count === 0) done();
|
||||
}
|
||||
);
|
||||
return id;
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
const strings = nodes.map((node) => {
|
||||
if (!node) return "null";
|
||||
if (node.type === "error" || node.type === "skip") {
|
||||
return JSON.stringify(node);
|
||||
}
|
||||
return `{"type":"data","data":${devalue.stringify(node.data, reducers)},${stringify_uses(
|
||||
node
|
||||
)}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ""}}`;
|
||||
});
|
||||
return {
|
||||
data: `{"type":"data","nodes":[${strings.join(",")}]}
|
||||
`,
|
||||
chunks: count > 0 ? iterator : null
|
||||
};
|
||||
} catch (e) {
|
||||
throw new Error(clarify_devalue_error(
|
||||
event,
|
||||
/** @type {any} */
|
||||
e
|
||||
));
|
||||
}
|
||||
}
|
||||
const MAX_DEPTH = 10;
|
||||
async function render_page(event, page, options2, manifest, state, nodes, resolve_opts) {
|
||||
if (state.depth > MAX_DEPTH) {
|
||||
return text(`Not found: ${event.url.pathname}`, {
|
||||
status: 404
|
||||
// TODO in some cases this should be 500. not sure how to differentiate
|
||||
});
|
||||
}
|
||||
if (is_action_json_request(event)) {
|
||||
const node = await manifest._.nodes[page.leaf]();
|
||||
return handle_action_json_request(event, options2, node?.server);
|
||||
}
|
||||
try {
|
||||
const leaf_node = (
|
||||
/** @type {import('types').SSRNode} */
|
||||
nodes.page()
|
||||
);
|
||||
let status = 200;
|
||||
let action_result = void 0;
|
||||
if (is_action_request(event)) {
|
||||
action_result = await handle_action_request(event, leaf_node.server);
|
||||
if (action_result?.type === "redirect") {
|
||||
return redirect_response(action_result.status, action_result.location);
|
||||
}
|
||||
if (action_result?.type === "error") {
|
||||
status = get_status(action_result.error);
|
||||
}
|
||||
if (action_result?.type === "failure") {
|
||||
status = action_result.status;
|
||||
}
|
||||
}
|
||||
const should_prerender = nodes.prerender();
|
||||
if (should_prerender) {
|
||||
const mod = leaf_node.server;
|
||||
if (mod?.actions) {
|
||||
throw new Error("Cannot prerender pages with actions");
|
||||
}
|
||||
} else if (state.prerendering) {
|
||||
return new Response(void 0, {
|
||||
status: 204
|
||||
});
|
||||
}
|
||||
state.prerender_default = should_prerender;
|
||||
const should_prerender_data = nodes.should_prerender_data();
|
||||
const data_pathname = add_data_suffix(event.url.pathname);
|
||||
const fetched = [];
|
||||
if (nodes.ssr() === false && !(state.prerendering && should_prerender_data)) {
|
||||
if (BROWSER && action_result && !event.request.headers.has("x-sveltekit-action")) ;
|
||||
return await render_response({
|
||||
branch: [],
|
||||
fetched,
|
||||
page_config: {
|
||||
ssr: false,
|
||||
csr: nodes.csr()
|
||||
},
|
||||
status,
|
||||
error: null,
|
||||
event,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
resolve_opts
|
||||
});
|
||||
}
|
||||
const branch = [];
|
||||
let load_error = null;
|
||||
const server_promises = nodes.data.map((node, i) => {
|
||||
if (load_error) {
|
||||
throw load_error;
|
||||
}
|
||||
return Promise.resolve().then(async () => {
|
||||
try {
|
||||
if (node === leaf_node && action_result?.type === "error") {
|
||||
throw action_result.error;
|
||||
}
|
||||
return await load_server_data({
|
||||
event,
|
||||
state,
|
||||
node,
|
||||
parent: async () => {
|
||||
const data = {};
|
||||
for (let j = 0; j < i; j += 1) {
|
||||
const parent = await server_promises[j];
|
||||
if (parent) Object.assign(data, parent.data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
load_error = /** @type {Error} */
|
||||
e;
|
||||
throw load_error;
|
||||
}
|
||||
});
|
||||
});
|
||||
const csr = nodes.csr();
|
||||
const load_promises = nodes.data.map((node, i) => {
|
||||
if (load_error) throw load_error;
|
||||
return Promise.resolve().then(async () => {
|
||||
try {
|
||||
return await load_data({
|
||||
event,
|
||||
fetched,
|
||||
node,
|
||||
parent: async () => {
|
||||
const data = {};
|
||||
for (let j = 0; j < i; j += 1) {
|
||||
Object.assign(data, await load_promises[j]);
|
||||
}
|
||||
return data;
|
||||
},
|
||||
resolve_opts,
|
||||
server_data_promise: server_promises[i],
|
||||
state,
|
||||
csr
|
||||
});
|
||||
} catch (e) {
|
||||
load_error = /** @type {Error} */
|
||||
e;
|
||||
throw load_error;
|
||||
}
|
||||
});
|
||||
});
|
||||
for (const p of server_promises) p.catch(() => {
|
||||
});
|
||||
for (const p of load_promises) p.catch(() => {
|
||||
});
|
||||
for (let i = 0; i < nodes.data.length; i += 1) {
|
||||
const node = nodes.data[i];
|
||||
if (node) {
|
||||
try {
|
||||
const server_data = await server_promises[i];
|
||||
const data = await load_promises[i];
|
||||
branch.push({ node, server_data, data });
|
||||
} catch (e) {
|
||||
const err = normalize_error(e);
|
||||
if (err instanceof Redirect) {
|
||||
if (state.prerendering && should_prerender_data) {
|
||||
const body2 = JSON.stringify({
|
||||
type: "redirect",
|
||||
location: err.location
|
||||
});
|
||||
state.prerendering.dependencies.set(data_pathname, {
|
||||
response: text(body2),
|
||||
body: body2
|
||||
});
|
||||
}
|
||||
return redirect_response(err.status, err.location);
|
||||
}
|
||||
const status2 = get_status(err);
|
||||
const error = await handle_error_and_jsonify(event, options2, err);
|
||||
while (i--) {
|
||||
if (page.errors[i]) {
|
||||
const index = (
|
||||
/** @type {number} */
|
||||
page.errors[i]
|
||||
);
|
||||
const node2 = await manifest._.nodes[index]();
|
||||
let j = i;
|
||||
while (!branch[j]) j -= 1;
|
||||
return await render_response({
|
||||
event,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
resolve_opts,
|
||||
page_config: { ssr: true, csr: true },
|
||||
status: status2,
|
||||
error,
|
||||
branch: compact(branch.slice(0, j + 1)).concat({
|
||||
node: node2,
|
||||
data: null,
|
||||
server_data: null
|
||||
}),
|
||||
fetched
|
||||
});
|
||||
}
|
||||
}
|
||||
return static_error_page(options2, status2, error.message);
|
||||
}
|
||||
} else {
|
||||
branch.push(null);
|
||||
}
|
||||
}
|
||||
if (state.prerendering && should_prerender_data) {
|
||||
let { data, chunks } = get_data_json(
|
||||
event,
|
||||
options2,
|
||||
branch.map((node) => node?.server_data)
|
||||
);
|
||||
if (chunks) {
|
||||
for await (const chunk of chunks) {
|
||||
data += chunk;
|
||||
}
|
||||
}
|
||||
state.prerendering.dependencies.set(data_pathname, {
|
||||
response: text(data),
|
||||
body: data
|
||||
});
|
||||
}
|
||||
const ssr = nodes.ssr();
|
||||
return await render_response({
|
||||
event,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
resolve_opts,
|
||||
page_config: {
|
||||
csr: nodes.csr(),
|
||||
ssr
|
||||
},
|
||||
status,
|
||||
error: null,
|
||||
branch: ssr === false ? [] : compact(branch),
|
||||
action_result,
|
||||
fetched
|
||||
});
|
||||
} catch (e) {
|
||||
return await respond_with_error({
|
||||
event,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
status: 500,
|
||||
error: e,
|
||||
resolve_opts
|
||||
});
|
||||
}
|
||||
}
|
||||
const INVALID_COOKIE_CHARACTER_REGEX = /[\x00-\x1F\x7F()<>@,;:"/[\]?={} \t]/;
|
||||
function validate_options(options2) {
|
||||
if (options2?.path === void 0) {
|
||||
throw new Error("You must specify a `path` when setting, deleting or serializing cookies");
|
||||
}
|
||||
}
|
||||
function get_cookies(request, url) {
|
||||
const header = request.headers.get("cookie") ?? "";
|
||||
const initial_cookies = parse(header, { decode: (value) => value });
|
||||
let normalized_url;
|
||||
const new_cookies = {};
|
||||
const defaults = {
|
||||
httpOnly: true,
|
||||
sameSite: "lax",
|
||||
secure: url.hostname === "localhost" && url.protocol === "http:" ? false : true
|
||||
};
|
||||
const cookies = {
|
||||
// The JSDoc param annotations appearing below for get, set and delete
|
||||
// are necessary to expose the `cookie` library types to
|
||||
// typescript users. `@type {import('@sveltejs/kit').Cookies}` above is not
|
||||
// sufficient to do so.
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {import('cookie').CookieParseOptions} [opts]
|
||||
*/
|
||||
get(name, opts) {
|
||||
const c = new_cookies[name];
|
||||
if (c && domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path)) {
|
||||
return c.value;
|
||||
}
|
||||
const req_cookies = parse(header, { decode: opts?.decode });
|
||||
const cookie = req_cookies[name];
|
||||
return cookie;
|
||||
},
|
||||
/**
|
||||
* @param {import('cookie').CookieParseOptions} [opts]
|
||||
*/
|
||||
getAll(opts) {
|
||||
const cookies2 = parse(header, { decode: opts?.decode });
|
||||
for (const c of Object.values(new_cookies)) {
|
||||
if (domain_matches(url.hostname, c.options.domain) && path_matches(url.pathname, c.options.path)) {
|
||||
cookies2[c.name] = c.value;
|
||||
}
|
||||
}
|
||||
return Object.entries(cookies2).map(([name, value]) => ({ name, value }));
|
||||
},
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {string} value
|
||||
* @param {import('./page/types.js').Cookie['options']} options
|
||||
*/
|
||||
set(name, value, options2) {
|
||||
const illegal_characters = name.match(INVALID_COOKIE_CHARACTER_REGEX);
|
||||
if (illegal_characters) {
|
||||
console.warn(
|
||||
`The cookie name "${name}" will be invalid in SvelteKit 3.0 as it contains ${illegal_characters.join(
|
||||
" and "
|
||||
)}. See RFC 2616 for more details https://datatracker.ietf.org/doc/html/rfc2616#section-2.2`
|
||||
);
|
||||
}
|
||||
validate_options(options2);
|
||||
set_internal(name, value, { ...defaults, ...options2 });
|
||||
},
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {import('./page/types.js').Cookie['options']} options
|
||||
*/
|
||||
delete(name, options2) {
|
||||
validate_options(options2);
|
||||
cookies.set(name, "", { ...options2, maxAge: 0 });
|
||||
},
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {string} value
|
||||
* @param {import('./page/types.js').Cookie['options']} options
|
||||
*/
|
||||
serialize(name, value, options2) {
|
||||
validate_options(options2);
|
||||
let path = options2.path;
|
||||
if (!options2.domain || options2.domain === url.hostname) {
|
||||
if (!normalized_url) {
|
||||
throw new Error("Cannot serialize cookies until after the route is determined");
|
||||
}
|
||||
path = resolve(normalized_url, path);
|
||||
}
|
||||
return serialize(name, value, { ...defaults, ...options2, path });
|
||||
}
|
||||
};
|
||||
function get_cookie_header(destination, header2) {
|
||||
const combined_cookies = {
|
||||
// cookies sent by the user agent have lowest precedence
|
||||
...initial_cookies
|
||||
};
|
||||
for (const key2 in new_cookies) {
|
||||
const cookie = new_cookies[key2];
|
||||
if (!domain_matches(destination.hostname, cookie.options.domain)) continue;
|
||||
if (!path_matches(destination.pathname, cookie.options.path)) continue;
|
||||
const encoder2 = cookie.options.encode || encodeURIComponent;
|
||||
combined_cookies[cookie.name] = encoder2(cookie.value);
|
||||
}
|
||||
if (header2) {
|
||||
const parsed = parse(header2, { decode: (value) => value });
|
||||
for (const name in parsed) {
|
||||
combined_cookies[name] = parsed[name];
|
||||
}
|
||||
}
|
||||
return Object.entries(combined_cookies).map(([name, value]) => `${name}=${value}`).join("; ");
|
||||
}
|
||||
const internal_queue = [];
|
||||
function set_internal(name, value, options2) {
|
||||
if (!normalized_url) {
|
||||
internal_queue.push(() => set_internal(name, value, options2));
|
||||
return;
|
||||
}
|
||||
let path = options2.path;
|
||||
if (!options2.domain || options2.domain === url.hostname) {
|
||||
path = resolve(normalized_url, path);
|
||||
}
|
||||
new_cookies[name] = { name, value, options: { ...options2, path } };
|
||||
}
|
||||
function set_trailing_slash(trailing_slash) {
|
||||
normalized_url = normalize_path(url.pathname, trailing_slash);
|
||||
internal_queue.forEach((fn) => fn());
|
||||
}
|
||||
return { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash };
|
||||
}
|
||||
function domain_matches(hostname, constraint) {
|
||||
if (!constraint) return true;
|
||||
const normalized = constraint[0] === "." ? constraint.slice(1) : constraint;
|
||||
if (hostname === normalized) return true;
|
||||
return hostname.endsWith("." + normalized);
|
||||
}
|
||||
function path_matches(path, constraint) {
|
||||
if (!constraint) return true;
|
||||
const normalized = constraint.endsWith("/") ? constraint.slice(0, -1) : constraint;
|
||||
if (path === normalized) return true;
|
||||
return path.startsWith(normalized + "/");
|
||||
}
|
||||
function add_cookies_to_headers(headers2, cookies) {
|
||||
for (const new_cookie of cookies) {
|
||||
const { name, value, options: options2 } = new_cookie;
|
||||
headers2.append("set-cookie", serialize(name, value, options2));
|
||||
if (options2.path.endsWith(".html")) {
|
||||
const path = add_data_suffix(options2.path);
|
||||
headers2.append("set-cookie", serialize(name, value, { ...options2, path }));
|
||||
}
|
||||
}
|
||||
}
|
||||
function create_fetch({ event, options: options2, manifest, state, get_cookie_header, set_internal }) {
|
||||
const server_fetch = async (info, init2) => {
|
||||
const original_request = normalize_fetch_input(info, init2, event.url);
|
||||
let mode = (info instanceof Request ? info.mode : init2?.mode) ?? "cors";
|
||||
let credentials = (info instanceof Request ? info.credentials : init2?.credentials) ?? "same-origin";
|
||||
return options2.hooks.handleFetch({
|
||||
event,
|
||||
request: original_request,
|
||||
fetch: async (info2, init3) => {
|
||||
const request = normalize_fetch_input(info2, init3, event.url);
|
||||
const url = new URL(request.url);
|
||||
if (!request.headers.has("origin")) {
|
||||
request.headers.set("origin", event.url.origin);
|
||||
}
|
||||
if (info2 !== original_request) {
|
||||
mode = (info2 instanceof Request ? info2.mode : init3?.mode) ?? "cors";
|
||||
credentials = (info2 instanceof Request ? info2.credentials : init3?.credentials) ?? "same-origin";
|
||||
}
|
||||
if ((request.method === "GET" || request.method === "HEAD") && (mode === "no-cors" && url.origin !== event.url.origin || url.origin === event.url.origin)) {
|
||||
request.headers.delete("origin");
|
||||
}
|
||||
if (url.origin !== event.url.origin) {
|
||||
if (`.${url.hostname}`.endsWith(`.${event.url.hostname}`) && credentials !== "omit") {
|
||||
const cookie = get_cookie_header(url, request.headers.get("cookie"));
|
||||
if (cookie) request.headers.set("cookie", cookie);
|
||||
}
|
||||
return fetch(request);
|
||||
}
|
||||
const prefix = assets || base;
|
||||
const decoded = decodeURIComponent(url.pathname);
|
||||
const filename = (decoded.startsWith(prefix) ? decoded.slice(prefix.length) : decoded).slice(1);
|
||||
const filename_html = `${filename}/index.html`;
|
||||
const is_asset = manifest.assets.has(filename) || filename in manifest._.server_assets;
|
||||
const is_asset_html = manifest.assets.has(filename_html) || filename_html in manifest._.server_assets;
|
||||
if (is_asset || is_asset_html) {
|
||||
const file = is_asset ? filename : filename_html;
|
||||
if (state.read) {
|
||||
const type = is_asset ? manifest.mimeTypes[filename.slice(filename.lastIndexOf("."))] : "text/html";
|
||||
return new Response(state.read(file), {
|
||||
headers: type ? { "content-type": type } : {}
|
||||
});
|
||||
} else if (read_implementation && file in manifest._.server_assets) {
|
||||
const length = manifest._.server_assets[file];
|
||||
const type = manifest.mimeTypes[file.slice(file.lastIndexOf("."))];
|
||||
return new Response(read_implementation(file), {
|
||||
headers: {
|
||||
"Content-Length": "" + length,
|
||||
"Content-Type": type
|
||||
}
|
||||
});
|
||||
}
|
||||
return await fetch(request);
|
||||
}
|
||||
if (has_prerendered_path(manifest, base + decoded)) {
|
||||
return await fetch(request);
|
||||
}
|
||||
if (credentials !== "omit") {
|
||||
const cookie = get_cookie_header(url, request.headers.get("cookie"));
|
||||
if (cookie) {
|
||||
request.headers.set("cookie", cookie);
|
||||
}
|
||||
const authorization = event.request.headers.get("authorization");
|
||||
if (authorization && !request.headers.has("authorization")) {
|
||||
request.headers.set("authorization", authorization);
|
||||
}
|
||||
}
|
||||
if (!request.headers.has("accept")) {
|
||||
request.headers.set("accept", "*/*");
|
||||
}
|
||||
if (!request.headers.has("accept-language")) {
|
||||
request.headers.set(
|
||||
"accept-language",
|
||||
/** @type {string} */
|
||||
event.request.headers.get("accept-language")
|
||||
);
|
||||
}
|
||||
const response = await respond(request, options2, manifest, {
|
||||
...state,
|
||||
depth: state.depth + 1
|
||||
});
|
||||
const set_cookie = response.headers.get("set-cookie");
|
||||
if (set_cookie) {
|
||||
for (const str of set_cookie_parser.splitCookiesString(set_cookie)) {
|
||||
const { name, value, ...options3 } = set_cookie_parser.parseString(str, {
|
||||
decodeValues: false
|
||||
});
|
||||
const path = options3.path ?? (url.pathname.split("/").slice(0, -1).join("/") || "/");
|
||||
set_internal(name, value, {
|
||||
path,
|
||||
encode: (value2) => value2,
|
||||
.../** @type {import('cookie').CookieSerializeOptions} */
|
||||
options3
|
||||
});
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
});
|
||||
};
|
||||
return (input, init2) => {
|
||||
const response = server_fetch(input, init2);
|
||||
response.catch(() => {
|
||||
});
|
||||
return response;
|
||||
};
|
||||
}
|
||||
function normalize_fetch_input(info, init2, url) {
|
||||
if (info instanceof Request) {
|
||||
return info;
|
||||
}
|
||||
return new Request(typeof info === "string" ? new URL(info, url) : info, init2);
|
||||
}
|
||||
let body;
|
||||
let etag;
|
||||
let headers;
|
||||
function get_public_env(request) {
|
||||
body ??= `export const env=${JSON.stringify(public_env)}`;
|
||||
etag ??= `W/${Date.now()}`;
|
||||
headers ??= new Headers({
|
||||
"content-type": "application/javascript; charset=utf-8",
|
||||
etag
|
||||
});
|
||||
if (request.headers.get("if-none-match") === etag) {
|
||||
return new Response(void 0, { status: 304, headers });
|
||||
}
|
||||
return new Response(body, { headers });
|
||||
}
|
||||
const default_transform = ({ html }) => html;
|
||||
const default_filter = () => false;
|
||||
const default_preload = ({ type }) => type === "js" || type === "css";
|
||||
const page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "POST"]);
|
||||
const allowed_page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
||||
async function respond(request, options2, manifest, state) {
|
||||
const url = new URL(request.url);
|
||||
if (options2.csrf_check_origin) {
|
||||
const forbidden = is_form_content_type(request) && (request.method === "POST" || request.method === "PUT" || request.method === "PATCH" || request.method === "DELETE") && request.headers.get("origin") !== url.origin;
|
||||
if (forbidden) {
|
||||
const csrf_error = new HttpError(
|
||||
403,
|
||||
`Cross-site ${request.method} form submissions are forbidden`
|
||||
);
|
||||
if (request.headers.get("accept") === "application/json") {
|
||||
return json(csrf_error.body, { status: csrf_error.status });
|
||||
}
|
||||
return text(csrf_error.body.message, { status: csrf_error.status });
|
||||
}
|
||||
}
|
||||
if (options2.hash_routing && url.pathname !== base + "/" && url.pathname !== "/[fallback]") {
|
||||
return text("Not found", { status: 404 });
|
||||
}
|
||||
let invalidated_data_nodes;
|
||||
const is_route_resolution_request = has_resolution_suffix(url.pathname);
|
||||
const is_data_request = has_data_suffix(url.pathname);
|
||||
if (is_route_resolution_request) {
|
||||
url.pathname = strip_resolution_suffix(url.pathname);
|
||||
} else if (is_data_request) {
|
||||
url.pathname = strip_data_suffix(url.pathname) + (url.searchParams.get(TRAILING_SLASH_PARAM) === "1" ? "/" : "") || "/";
|
||||
url.searchParams.delete(TRAILING_SLASH_PARAM);
|
||||
invalidated_data_nodes = url.searchParams.get(INVALIDATED_PARAM)?.split("").map((node) => node === "1");
|
||||
url.searchParams.delete(INVALIDATED_PARAM);
|
||||
}
|
||||
const headers2 = {};
|
||||
const { cookies, new_cookies, get_cookie_header, set_internal, set_trailing_slash } = get_cookies(
|
||||
request,
|
||||
url
|
||||
);
|
||||
const event = {
|
||||
cookies,
|
||||
// @ts-expect-error `fetch` needs to be created after the `event` itself
|
||||
fetch: null,
|
||||
getClientAddress: state.getClientAddress || (() => {
|
||||
throw new Error(
|
||||
`${"@sveltejs/adapter-auto"} does not specify getClientAddress. Please raise an issue`
|
||||
);
|
||||
}),
|
||||
locals: {},
|
||||
params: {},
|
||||
platform: state.platform,
|
||||
request,
|
||||
route: { id: null },
|
||||
setHeaders: (new_headers) => {
|
||||
for (const key2 in new_headers) {
|
||||
const lower = key2.toLowerCase();
|
||||
const value = new_headers[key2];
|
||||
if (lower === "set-cookie") {
|
||||
throw new Error(
|
||||
"Use `event.cookies.set(name, value, options)` instead of `event.setHeaders` to set cookies"
|
||||
);
|
||||
} else if (lower in headers2) {
|
||||
throw new Error(`"${key2}" header is already set`);
|
||||
} else {
|
||||
headers2[lower] = value;
|
||||
if (state.prerendering && lower === "cache-control") {
|
||||
state.prerendering.cache = /** @type {string} */
|
||||
value;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
url,
|
||||
isDataRequest: is_data_request,
|
||||
isSubRequest: state.depth > 0
|
||||
};
|
||||
event.fetch = create_fetch({
|
||||
event,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
get_cookie_header,
|
||||
set_internal
|
||||
});
|
||||
if (state.emulator?.platform) {
|
||||
event.platform = await state.emulator.platform({
|
||||
config: {},
|
||||
prerender: !!state.prerendering?.fallback
|
||||
});
|
||||
}
|
||||
let resolved_path;
|
||||
const prerendering_reroute_state = state.prerendering?.inside_reroute;
|
||||
try {
|
||||
if (state.prerendering) state.prerendering.inside_reroute = true;
|
||||
resolved_path = await options2.hooks.reroute({ url: new URL(url), fetch: event.fetch }) ?? url.pathname;
|
||||
} catch {
|
||||
return text("Internal Server Error", {
|
||||
status: 500
|
||||
});
|
||||
} finally {
|
||||
if (state.prerendering) state.prerendering.inside_reroute = prerendering_reroute_state;
|
||||
}
|
||||
try {
|
||||
resolved_path = decode_pathname(resolved_path);
|
||||
} catch {
|
||||
return text("Malformed URI", { status: 400 });
|
||||
}
|
||||
if (resolved_path !== url.pathname && !state.prerendering?.fallback && has_prerendered_path(manifest, resolved_path)) {
|
||||
const url2 = new URL(request.url);
|
||||
url2.pathname = is_data_request ? add_data_suffix(resolved_path) : is_route_resolution_request ? add_resolution_suffix(resolved_path) : resolved_path;
|
||||
const response = await fetch(url2, request);
|
||||
const headers22 = new Headers(response.headers);
|
||||
if (headers22.has("content-encoding")) {
|
||||
headers22.delete("content-encoding");
|
||||
headers22.delete("content-length");
|
||||
}
|
||||
return new Response(response.body, {
|
||||
headers: headers22,
|
||||
status: response.status,
|
||||
statusText: response.statusText
|
||||
});
|
||||
}
|
||||
let route = null;
|
||||
if (base && !state.prerendering?.fallback) {
|
||||
if (!resolved_path.startsWith(base)) {
|
||||
return text("Not found", { status: 404 });
|
||||
}
|
||||
resolved_path = resolved_path.slice(base.length) || "/";
|
||||
}
|
||||
if (is_route_resolution_request) {
|
||||
return resolve_route(resolved_path, new URL(request.url), manifest);
|
||||
}
|
||||
if (resolved_path === `/${app_dir}/env.js`) {
|
||||
return get_public_env(request);
|
||||
}
|
||||
if (resolved_path.startsWith(`/${app_dir}`)) {
|
||||
const headers22 = new Headers();
|
||||
headers22.set("cache-control", "public, max-age=0, must-revalidate");
|
||||
return text("Not found", { status: 404, headers: headers22 });
|
||||
}
|
||||
if (!state.prerendering?.fallback) {
|
||||
const matchers = await manifest._.matchers();
|
||||
for (const candidate of manifest._.routes) {
|
||||
const match = candidate.pattern.exec(resolved_path);
|
||||
if (!match) continue;
|
||||
const matched = exec(match, candidate.params, matchers);
|
||||
if (matched) {
|
||||
route = candidate;
|
||||
event.route = { id: route.id };
|
||||
event.params = decode_params(matched);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let resolve_opts = {
|
||||
transformPageChunk: default_transform,
|
||||
filterSerializedResponseHeaders: default_filter,
|
||||
preload: default_preload
|
||||
};
|
||||
let trailing_slash = "never";
|
||||
try {
|
||||
const page_nodes = route?.page ? new PageNodes(await load_page_nodes(route.page, manifest)) : void 0;
|
||||
if (route) {
|
||||
if (url.pathname === base || url.pathname === base + "/") {
|
||||
trailing_slash = "always";
|
||||
} else if (page_nodes) {
|
||||
if (BROWSER) ;
|
||||
trailing_slash = page_nodes.trailing_slash();
|
||||
} else if (route.endpoint) {
|
||||
const node = await route.endpoint();
|
||||
trailing_slash = node.trailingSlash ?? "never";
|
||||
if (BROWSER) ;
|
||||
}
|
||||
if (!is_data_request) {
|
||||
const normalized = normalize_path(url.pathname, trailing_slash);
|
||||
if (normalized !== url.pathname && !state.prerendering?.fallback) {
|
||||
return new Response(void 0, {
|
||||
status: 308,
|
||||
headers: {
|
||||
"x-sveltekit-normalize": "1",
|
||||
location: (
|
||||
// ensure paths starting with '//' are not treated as protocol-relative
|
||||
(normalized.startsWith("//") ? url.origin + normalized : normalized) + (url.search === "?" ? "" : url.search)
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (state.before_handle || state.emulator?.platform) {
|
||||
let config = {};
|
||||
let prerender = false;
|
||||
if (route.endpoint) {
|
||||
const node = await route.endpoint();
|
||||
config = node.config ?? config;
|
||||
prerender = node.prerender ?? prerender;
|
||||
} else if (page_nodes) {
|
||||
config = page_nodes.get_config() ?? config;
|
||||
prerender = page_nodes.prerender();
|
||||
}
|
||||
if (state.before_handle) {
|
||||
state.before_handle(event, config, prerender);
|
||||
}
|
||||
if (state.emulator?.platform) {
|
||||
event.platform = await state.emulator.platform({ config, prerender });
|
||||
}
|
||||
}
|
||||
}
|
||||
set_trailing_slash(trailing_slash);
|
||||
if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) {
|
||||
disable_search(url);
|
||||
}
|
||||
const response = await with_event(
|
||||
event,
|
||||
() => options2.hooks.handle({
|
||||
event,
|
||||
resolve: (event2, opts) => (
|
||||
// counter-intuitively, we need to clear the event, so that it's not
|
||||
// e.g. accessible when loading modules needed to handle the request
|
||||
with_event(
|
||||
null,
|
||||
() => resolve2(event2, page_nodes, opts).then((response2) => {
|
||||
for (const key2 in headers2) {
|
||||
const value = headers2[key2];
|
||||
response2.headers.set(
|
||||
key2,
|
||||
/** @type {string} */
|
||||
value
|
||||
);
|
||||
}
|
||||
add_cookies_to_headers(response2.headers, Object.values(new_cookies));
|
||||
if (state.prerendering && event2.route.id !== null) {
|
||||
response2.headers.set("x-sveltekit-routeid", encodeURI(event2.route.id));
|
||||
}
|
||||
return response2;
|
||||
})
|
||||
)
|
||||
)
|
||||
})
|
||||
);
|
||||
if (response.status === 200 && response.headers.has("etag")) {
|
||||
let if_none_match_value = request.headers.get("if-none-match");
|
||||
if (if_none_match_value?.startsWith('W/"')) {
|
||||
if_none_match_value = if_none_match_value.substring(2);
|
||||
}
|
||||
const etag2 = (
|
||||
/** @type {string} */
|
||||
response.headers.get("etag")
|
||||
);
|
||||
if (if_none_match_value === etag2) {
|
||||
const headers22 = new Headers({ etag: etag2 });
|
||||
for (const key2 of [
|
||||
"cache-control",
|
||||
"content-location",
|
||||
"date",
|
||||
"expires",
|
||||
"vary",
|
||||
"set-cookie"
|
||||
]) {
|
||||
const value = response.headers.get(key2);
|
||||
if (value) headers22.set(key2, value);
|
||||
}
|
||||
return new Response(void 0, {
|
||||
status: 304,
|
||||
headers: headers22
|
||||
});
|
||||
}
|
||||
}
|
||||
if (is_data_request && response.status >= 300 && response.status <= 308) {
|
||||
const location = response.headers.get("location");
|
||||
if (location) {
|
||||
return redirect_json_response(new Redirect(
|
||||
/** @type {any} */
|
||||
response.status,
|
||||
location
|
||||
));
|
||||
}
|
||||
}
|
||||
return response;
|
||||
} catch (e) {
|
||||
if (e instanceof Redirect) {
|
||||
const response = is_data_request ? redirect_json_response(e) : route?.page && is_action_json_request(event) ? action_json_redirect(e) : redirect_response(e.status, e.location);
|
||||
add_cookies_to_headers(response.headers, Object.values(new_cookies));
|
||||
return response;
|
||||
}
|
||||
return await handle_fatal_error(event, options2, e);
|
||||
}
|
||||
async function resolve2(event2, page_nodes, opts) {
|
||||
try {
|
||||
if (opts) {
|
||||
resolve_opts = {
|
||||
transformPageChunk: opts.transformPageChunk || default_transform,
|
||||
filterSerializedResponseHeaders: opts.filterSerializedResponseHeaders || default_filter,
|
||||
preload: opts.preload || default_preload
|
||||
};
|
||||
}
|
||||
if (options2.hash_routing || state.prerendering?.fallback) {
|
||||
return await render_response({
|
||||
event: event2,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
page_config: { ssr: false, csr: true },
|
||||
status: 200,
|
||||
error: null,
|
||||
branch: [],
|
||||
fetched: [],
|
||||
resolve_opts
|
||||
});
|
||||
}
|
||||
if (route) {
|
||||
const method = (
|
||||
/** @type {import('types').HttpMethod} */
|
||||
event2.request.method
|
||||
);
|
||||
let response;
|
||||
if (is_data_request) {
|
||||
response = await render_data(
|
||||
event2,
|
||||
route,
|
||||
options2,
|
||||
manifest,
|
||||
state,
|
||||
invalidated_data_nodes,
|
||||
trailing_slash
|
||||
);
|
||||
} else if (route.endpoint && (!route.page || is_endpoint_request(event2))) {
|
||||
response = await render_endpoint(event2, await route.endpoint(), state);
|
||||
} else if (route.page) {
|
||||
if (!page_nodes) {
|
||||
throw new Error("page_nodes not found. This should never happen");
|
||||
} else if (page_methods.has(method)) {
|
||||
response = await render_page(
|
||||
event2,
|
||||
route.page,
|
||||
options2,
|
||||
manifest,
|
||||
state,
|
||||
page_nodes,
|
||||
resolve_opts
|
||||
);
|
||||
} else {
|
||||
const allowed_methods2 = new Set(allowed_page_methods);
|
||||
const node = await manifest._.nodes[route.page.leaf]();
|
||||
if (node?.server?.actions) {
|
||||
allowed_methods2.add("POST");
|
||||
}
|
||||
if (method === "OPTIONS") {
|
||||
response = new Response(null, {
|
||||
status: 204,
|
||||
headers: {
|
||||
allow: Array.from(allowed_methods2.values()).join(", ")
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const mod = [...allowed_methods2].reduce(
|
||||
(acc, curr) => {
|
||||
acc[curr] = true;
|
||||
return acc;
|
||||
},
|
||||
/** @type {Record<string, any>} */
|
||||
{}
|
||||
);
|
||||
response = method_not_allowed(mod, method);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Error("Route is neither page nor endpoint. This should never happen");
|
||||
}
|
||||
if (request.method === "GET" && route.page && route.endpoint) {
|
||||
const vary = response.headers.get("vary")?.split(",")?.map((v) => v.trim().toLowerCase());
|
||||
if (!(vary?.includes("accept") || vary?.includes("*"))) {
|
||||
response = new Response(response.body, {
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
headers: new Headers(response.headers)
|
||||
});
|
||||
response.headers.append("Vary", "Accept");
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
if (state.error && event2.isSubRequest) {
|
||||
const headers22 = new Headers(request.headers);
|
||||
headers22.set("x-sveltekit-error", "true");
|
||||
return await fetch(request, { headers: headers22 });
|
||||
}
|
||||
if (state.error) {
|
||||
return text("Internal Server Error", {
|
||||
status: 500
|
||||
});
|
||||
}
|
||||
if (state.depth === 0) {
|
||||
return await respond_with_error({
|
||||
event: event2,
|
||||
options: options2,
|
||||
manifest,
|
||||
state,
|
||||
status: 404,
|
||||
error: new SvelteKitError(404, "Not Found", `Not found: ${event2.url.pathname}`),
|
||||
resolve_opts
|
||||
});
|
||||
}
|
||||
if (state.prerendering) {
|
||||
return text("not found", { status: 404 });
|
||||
}
|
||||
return await fetch(request);
|
||||
} catch (e) {
|
||||
return await handle_fatal_error(event2, options2, e);
|
||||
} finally {
|
||||
event2.cookies.set = () => {
|
||||
throw new Error("Cannot use `cookies.set(...)` after the response has been generated");
|
||||
};
|
||||
event2.setHeaders = () => {
|
||||
throw new Error("Cannot use `setHeaders(...)` after the response has been generated");
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
function load_page_nodes(page, manifest) {
|
||||
return Promise.all([
|
||||
// we use == here rather than === because [undefined] serializes as "[null]"
|
||||
...page.layouts.map((n) => n == void 0 ? n : manifest._.nodes[n]()),
|
||||
manifest._.nodes[page.leaf]()
|
||||
]);
|
||||
}
|
||||
function filter_private_env(env, { public_prefix, private_prefix }) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(env).filter(
|
||||
([k]) => k.startsWith(private_prefix) && (public_prefix === "" || !k.startsWith(public_prefix))
|
||||
)
|
||||
);
|
||||
}
|
||||
function filter_public_env(env, { public_prefix, private_prefix }) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(env).filter(
|
||||
([k]) => k.startsWith(public_prefix) && (private_prefix === "" || !k.startsWith(private_prefix))
|
||||
)
|
||||
);
|
||||
}
|
||||
const prerender_env_handler = {
|
||||
get({ type }, prop) {
|
||||
throw new Error(
|
||||
`Cannot read values from $env/dynamic/${type} while prerendering (attempted to read env.${prop.toString()}). Use $env/static/${type} instead`
|
||||
);
|
||||
}
|
||||
};
|
||||
let init_promise;
|
||||
class Server {
|
||||
/** @type {import('types').SSROptions} */
|
||||
#options;
|
||||
/** @type {import('@sveltejs/kit').SSRManifest} */
|
||||
#manifest;
|
||||
/** @param {import('@sveltejs/kit').SSRManifest} manifest */
|
||||
constructor(manifest) {
|
||||
this.#options = options;
|
||||
this.#manifest = manifest;
|
||||
}
|
||||
/**
|
||||
* @param {{
|
||||
* env: Record<string, string>;
|
||||
* read?: (file: string) => ReadableStream;
|
||||
* }} opts
|
||||
*/
|
||||
async init({ env, read }) {
|
||||
const prefixes = {
|
||||
public_prefix: this.#options.env_public_prefix,
|
||||
private_prefix: this.#options.env_private_prefix
|
||||
};
|
||||
const private_env = filter_private_env(env, prefixes);
|
||||
const public_env2 = filter_public_env(env, prefixes);
|
||||
set_private_env(
|
||||
prerendering ? new Proxy({ type: "private" }, prerender_env_handler) : private_env
|
||||
);
|
||||
set_public_env(
|
||||
prerendering ? new Proxy({ type: "public" }, prerender_env_handler) : public_env2
|
||||
);
|
||||
set_safe_public_env(public_env2);
|
||||
if (read) {
|
||||
set_read_implementation(read);
|
||||
}
|
||||
await (init_promise ??= (async () => {
|
||||
try {
|
||||
const module = await get_hooks();
|
||||
this.#options.hooks = {
|
||||
handle: module.handle || (({ event, resolve: resolve2 }) => resolve2(event)),
|
||||
handleError: module.handleError || (({ error }) => console.error(error)),
|
||||
handleFetch: module.handleFetch || (({ request, fetch: fetch2 }) => fetch2(request)),
|
||||
reroute: module.reroute || (() => {
|
||||
}),
|
||||
transport: module.transport || {}
|
||||
};
|
||||
if (module.init) {
|
||||
await module.init();
|
||||
}
|
||||
} catch (error) {
|
||||
{
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
})());
|
||||
}
|
||||
/**
|
||||
* @param {Request} request
|
||||
* @param {import('types').RequestOptions} options
|
||||
*/
|
||||
async respond(request, options2) {
|
||||
return respond(request, this.#options, this.#manifest, {
|
||||
...options2,
|
||||
error: false,
|
||||
depth: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
export {
|
||||
Server
|
||||
};
|
||||
13
.svelte-kit/output/server/internal.js
Normal file
13
.svelte-kit/output/server/internal.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { g, e, l, m, n, q, f, i, k, j } from "./chunks/internal.js";
|
||||
export {
|
||||
g as get_hooks,
|
||||
e as options,
|
||||
l as set_assets,
|
||||
m as set_building,
|
||||
n as set_manifest,
|
||||
q as set_prerendering,
|
||||
f as set_private_env,
|
||||
i as set_public_env,
|
||||
k as set_read_implementation,
|
||||
j as set_safe_public_env
|
||||
};
|
||||
36
.svelte-kit/output/server/manifest-full.js
Normal file
36
.svelte-kit/output/server/manifest-full.js
Normal file
@@ -0,0 +1,36 @@
|
||||
export const manifest = (() => {
|
||||
function __memo(fn) {
|
||||
let value;
|
||||
return () => value ??= (value = fn());
|
||||
}
|
||||
|
||||
return {
|
||||
appDir: "_app",
|
||||
appPath: "_app",
|
||||
assets: new Set(["favicon.png"]),
|
||||
mimeTypes: {".png":"image/png"},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.B9R_ECDu.js",app:"_app/immutable/entry/app.JMsWNEBf.js",imports:["_app/immutable/entry/start.B9R_ECDu.js","_app/immutable/chunks/Bkzr8dUC.js","_app/immutable/chunks/7LwFGTVl.js","_app/immutable/chunks/DtKB1_9u.js","_app/immutable/entry/app.JMsWNEBf.js","_app/immutable/chunks/7LwFGTVl.js","_app/immutable/chunks/CvwgUIOn.js","_app/immutable/chunks/C1JNRcsB.js","_app/immutable/chunks/DtKB1_9u.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
__memo(() => import('./nodes/2.js'))
|
||||
],
|
||||
routes: [
|
||||
{
|
||||
id: "/",
|
||||
pattern: /^\/$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 2 },
|
||||
endpoint: null
|
||||
}
|
||||
],
|
||||
prerendered_routes: new Set([]),
|
||||
matchers: async () => {
|
||||
|
||||
return { };
|
||||
},
|
||||
server_assets: {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
36
.svelte-kit/output/server/manifest.js
Normal file
36
.svelte-kit/output/server/manifest.js
Normal file
@@ -0,0 +1,36 @@
|
||||
export const manifest = (() => {
|
||||
function __memo(fn) {
|
||||
let value;
|
||||
return () => value ??= (value = fn());
|
||||
}
|
||||
|
||||
return {
|
||||
appDir: "_app",
|
||||
appPath: "_app",
|
||||
assets: new Set(["favicon.png"]),
|
||||
mimeTypes: {".png":"image/png"},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.B9R_ECDu.js",app:"_app/immutable/entry/app.JMsWNEBf.js",imports:["_app/immutable/entry/start.B9R_ECDu.js","_app/immutable/chunks/Bkzr8dUC.js","_app/immutable/chunks/7LwFGTVl.js","_app/immutable/chunks/DtKB1_9u.js","_app/immutable/entry/app.JMsWNEBf.js","_app/immutable/chunks/7LwFGTVl.js","_app/immutable/chunks/CvwgUIOn.js","_app/immutable/chunks/C1JNRcsB.js","_app/immutable/chunks/DtKB1_9u.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
__memo(() => import('./nodes/2.js'))
|
||||
],
|
||||
routes: [
|
||||
{
|
||||
id: "/",
|
||||
pattern: /^\/$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 2 },
|
||||
endpoint: null
|
||||
}
|
||||
],
|
||||
prerendered_routes: new Set([]),
|
||||
matchers: async () => {
|
||||
|
||||
return { };
|
||||
},
|
||||
server_assets: {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
8
.svelte-kit/output/server/nodes/0.js
Normal file
8
.svelte-kit/output/server/nodes/0.js
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export const index = 0;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/0.C10SzQKY.js","_app/immutable/chunks/C1JNRcsB.js","_app/immutable/chunks/7LwFGTVl.js"];
|
||||
export const stylesheets = ["_app/immutable/assets/0.BJxIG_zl.css"];
|
||||
export const fonts = [];
|
||||
8
.svelte-kit/output/server/nodes/1.js
Normal file
8
.svelte-kit/output/server/nodes/1.js
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export const index = 1;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/1.CmP9Wh21.js","_app/immutable/chunks/C1JNRcsB.js","_app/immutable/chunks/7LwFGTVl.js","_app/immutable/chunks/G3SYufGp.js","_app/immutable/chunks/CvwgUIOn.js","_app/immutable/chunks/Bkzr8dUC.js","_app/immutable/chunks/DtKB1_9u.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
8
.svelte-kit/output/server/nodes/2.js
Normal file
8
.svelte-kit/output/server/nodes/2.js
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export const index = 2;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/2.CpB6OS4x.js","_app/immutable/chunks/C1JNRcsB.js","_app/immutable/chunks/7LwFGTVl.js","_app/immutable/chunks/G3SYufGp.js","_app/immutable/chunks/CvwgUIOn.js","_app/immutable/chunks/DtKB1_9u.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
Reference in New Issue
Block a user