├── .cloudflare ├── public │ ├── _app │ │ ├── immutable │ │ │ ├── assets │ │ │ │ └── _layout-cb330d88.css │ │ │ ├── chunks │ │ │ │ ├── 0-8e8c308f.js │ │ │ │ ├── 1-d7f1c69a.js │ │ │ │ ├── 2-3677231e.js │ │ │ │ ├── index-0c191f98.js │ │ │ │ ├── parse-a9b5aeea.js │ │ │ │ └── singletons-5c8d2b5b.js │ │ │ ├── components │ │ │ │ ├── error.svelte-63101f88.js │ │ │ │ └── pages │ │ │ │ │ ├── _layout.svelte-ebc491c9.js │ │ │ │ │ └── _page.svelte-a3e10c76.js │ │ │ └── start-d54095ea.js │ │ └── version.json │ └── favicon.png ├── worker.js └── worker.js.map ├── .gitignore ├── .npmrc ├── .replit ├── README.md ├── package-lock.json ├── package.json ├── postcss.config.cjs ├── replit.nix ├── src ├── app.d.ts ├── app.html ├── app.postcss ├── lib │ ├── markdownparser.ts │ ├── readablestreamstore.ts │ └── typingindicator.svelte └── routes │ ├── +layout.svelte │ ├── +page.svelte │ └── api │ └── chat │ └── +server.ts ├── static └── favicon.png ├── svelte.config.js ├── tailwind.config.cjs ├── tsconfig.json ├── vite.config.ts └── wrangler.toml /.cloudflare/public/_app/immutable/assets/_layout-cb330d88.css: -------------------------------------------------------------------------------- 1 | /* 2 | ! tailwindcss v3.2.6 | MIT License | https://tailwindcss.com 3 | *//* 4 | 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) 5 | 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) 6 | */ 7 | 8 | *, 9 | ::before, 10 | ::after { 11 | box-sizing: border-box; /* 1 */ 12 | border-width: 0; /* 2 */ 13 | border-style: solid; /* 2 */ 14 | border-color: #e5e7eb; /* 2 */ 15 | } 16 | 17 | ::before, 18 | ::after { 19 | --tw-content: ''; 20 | } 21 | 22 | /* 23 | 1. Use a consistent sensible line-height in all browsers. 24 | 2. Prevent adjustments of font size after orientation changes in iOS. 25 | 3. Use a more readable tab size. 26 | 4. Use the user's configured `sans` font-family by default. 27 | 5. Use the user's configured `sans` font-feature-settings by default. 28 | */ 29 | 30 | html { 31 | line-height: 1.5; /* 1 */ 32 | -webkit-text-size-adjust: 100%; /* 2 */ 33 | -moz-tab-size: 4; /* 3 */ 34 | -o-tab-size: 4; 35 | tab-size: 4; /* 3 */ 36 | font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */ 37 | font-feature-settings: normal; /* 5 */ 38 | } 39 | 40 | /* 41 | 1. Remove the margin in all browsers. 42 | 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. 43 | */ 44 | 45 | body { 46 | margin: 0; /* 1 */ 47 | line-height: inherit; /* 2 */ 48 | } 49 | 50 | /* 51 | 1. Add the correct height in Firefox. 52 | 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) 53 | 3. Ensure horizontal rules are visible by default. 54 | */ 55 | 56 | hr { 57 | height: 0; /* 1 */ 58 | color: inherit; /* 2 */ 59 | border-top-width: 1px; /* 3 */ 60 | } 61 | 62 | /* 63 | Add the correct text decoration in Chrome, Edge, and Safari. 64 | */ 65 | 66 | abbr:where([title]) { 67 | -webkit-text-decoration: underline dotted; 68 | text-decoration: underline dotted; 69 | } 70 | 71 | /* 72 | Remove the default font size and weight for headings. 73 | */ 74 | 75 | h1, 76 | h2, 77 | h3, 78 | h4, 79 | h5, 80 | h6 { 81 | font-size: inherit; 82 | font-weight: inherit; 83 | } 84 | 85 | /* 86 | Reset links to optimize for opt-in styling instead of opt-out. 87 | */ 88 | 89 | a { 90 | color: inherit; 91 | text-decoration: inherit; 92 | } 93 | 94 | /* 95 | Add the correct font weight in Edge and Safari. 96 | */ 97 | 98 | b, 99 | strong { 100 | font-weight: bolder; 101 | } 102 | 103 | /* 104 | 1. Use the user's configured `mono` font family by default. 105 | 2. Correct the odd `em` font sizing in all browsers. 106 | */ 107 | 108 | code, 109 | kbd, 110 | samp, 111 | pre { 112 | font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */ 113 | font-size: 1em; /* 2 */ 114 | } 115 | 116 | /* 117 | Add the correct font size in all browsers. 118 | */ 119 | 120 | small { 121 | font-size: 80%; 122 | } 123 | 124 | /* 125 | Prevent `sub` and `sup` elements from affecting the line height in all browsers. 126 | */ 127 | 128 | sub, 129 | sup { 130 | font-size: 75%; 131 | line-height: 0; 132 | position: relative; 133 | vertical-align: baseline; 134 | } 135 | 136 | sub { 137 | bottom: -0.25em; 138 | } 139 | 140 | sup { 141 | top: -0.5em; 142 | } 143 | 144 | /* 145 | 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) 146 | 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) 147 | 3. Remove gaps between table borders by default. 148 | */ 149 | 150 | table { 151 | text-indent: 0; /* 1 */ 152 | border-color: inherit; /* 2 */ 153 | border-collapse: collapse; /* 3 */ 154 | } 155 | 156 | /* 157 | 1. Change the font styles in all browsers. 158 | 2. Remove the margin in Firefox and Safari. 159 | 3. Remove default padding in all browsers. 160 | */ 161 | 162 | button, 163 | input, 164 | optgroup, 165 | select, 166 | textarea { 167 | font-family: inherit; /* 1 */ 168 | font-size: 100%; /* 1 */ 169 | font-weight: inherit; /* 1 */ 170 | line-height: inherit; /* 1 */ 171 | color: inherit; /* 1 */ 172 | margin: 0; /* 2 */ 173 | padding: 0; /* 3 */ 174 | } 175 | 176 | /* 177 | Remove the inheritance of text transform in Edge and Firefox. 178 | */ 179 | 180 | button, 181 | select { 182 | text-transform: none; 183 | } 184 | 185 | /* 186 | 1. Correct the inability to style clickable types in iOS and Safari. 187 | 2. Remove default button styles. 188 | */ 189 | 190 | button, 191 | [type='button'], 192 | [type='reset'], 193 | [type='submit'] { 194 | -webkit-appearance: button; /* 1 */ 195 | background-color: transparent; /* 2 */ 196 | background-image: none; /* 2 */ 197 | } 198 | 199 | /* 200 | Use the modern Firefox focus style for all focusable elements. 201 | */ 202 | 203 | :-moz-focusring { 204 | outline: auto; 205 | } 206 | 207 | /* 208 | Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) 209 | */ 210 | 211 | :-moz-ui-invalid { 212 | box-shadow: none; 213 | } 214 | 215 | /* 216 | Add the correct vertical alignment in Chrome and Firefox. 217 | */ 218 | 219 | progress { 220 | vertical-align: baseline; 221 | } 222 | 223 | /* 224 | Correct the cursor style of increment and decrement buttons in Safari. 225 | */ 226 | 227 | ::-webkit-inner-spin-button, 228 | ::-webkit-outer-spin-button { 229 | height: auto; 230 | } 231 | 232 | /* 233 | 1. Correct the odd appearance in Chrome and Safari. 234 | 2. Correct the outline style in Safari. 235 | */ 236 | 237 | [type='search'] { 238 | -webkit-appearance: textfield; /* 1 */ 239 | outline-offset: -2px; /* 2 */ 240 | } 241 | 242 | /* 243 | Remove the inner padding in Chrome and Safari on macOS. 244 | */ 245 | 246 | ::-webkit-search-decoration { 247 | -webkit-appearance: none; 248 | } 249 | 250 | /* 251 | 1. Correct the inability to style clickable types in iOS and Safari. 252 | 2. Change font properties to `inherit` in Safari. 253 | */ 254 | 255 | ::-webkit-file-upload-button { 256 | -webkit-appearance: button; /* 1 */ 257 | font: inherit; /* 2 */ 258 | } 259 | 260 | /* 261 | Add the correct display in Chrome and Safari. 262 | */ 263 | 264 | summary { 265 | display: list-item; 266 | } 267 | 268 | /* 269 | Removes the default spacing and border for appropriate elements. 270 | */ 271 | 272 | blockquote, 273 | dl, 274 | dd, 275 | h1, 276 | h2, 277 | h3, 278 | h4, 279 | h5, 280 | h6, 281 | hr, 282 | figure, 283 | p, 284 | pre { 285 | margin: 0; 286 | } 287 | 288 | fieldset { 289 | margin: 0; 290 | padding: 0; 291 | } 292 | 293 | legend { 294 | padding: 0; 295 | } 296 | 297 | ol, 298 | ul, 299 | menu { 300 | list-style: none; 301 | margin: 0; 302 | padding: 0; 303 | } 304 | 305 | /* 306 | Prevent resizing textareas horizontally by default. 307 | */ 308 | 309 | textarea { 310 | resize: vertical; 311 | } 312 | 313 | /* 314 | 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) 315 | 2. Set the default placeholder color to the user's configured gray 400 color. 316 | */ 317 | 318 | input::-moz-placeholder, textarea::-moz-placeholder { 319 | opacity: 1; /* 1 */ 320 | color: #9ca3af; /* 2 */ 321 | } 322 | 323 | input::placeholder, 324 | textarea::placeholder { 325 | opacity: 1; /* 1 */ 326 | color: #9ca3af; /* 2 */ 327 | } 328 | 329 | /* 330 | Set the default cursor for buttons. 331 | */ 332 | 333 | button, 334 | [role="button"] { 335 | cursor: pointer; 336 | } 337 | 338 | /* 339 | Make sure disabled buttons don't get the pointer cursor. 340 | */ 341 | :disabled { 342 | cursor: default; 343 | } 344 | 345 | /* 346 | 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) 347 | 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) 348 | This can trigger a poorly considered lint error in some tools but is included by design. 349 | */ 350 | 351 | img, 352 | svg, 353 | video, 354 | canvas, 355 | audio, 356 | iframe, 357 | embed, 358 | object { 359 | display: block; /* 1 */ 360 | vertical-align: middle; /* 2 */ 361 | } 362 | 363 | /* 364 | Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) 365 | */ 366 | 367 | img, 368 | video { 369 | max-width: 100%; 370 | height: auto; 371 | } 372 | 373 | /* Make elements with the HTML hidden attribute stay hidden by default */ 374 | [hidden] { 375 | display: none; 376 | } 377 | 378 | [type='text'],[type='email'],[type='url'],[type='password'],[type='number'],[type='date'],[type='datetime-local'],[type='month'],[type='search'],[type='tel'],[type='time'],[type='week'],[multiple],textarea,select { 379 | -webkit-appearance: none; 380 | -moz-appearance: none; 381 | appearance: none; 382 | background-color: #fff; 383 | border-color: #6b7280; 384 | border-width: 1px; 385 | border-radius: 0px; 386 | padding-top: 0.5rem; 387 | padding-right: 0.75rem; 388 | padding-bottom: 0.5rem; 389 | padding-left: 0.75rem; 390 | font-size: 1rem; 391 | line-height: 1.5rem; 392 | --tw-shadow: 0 0 #0000; 393 | } 394 | 395 | [type='text']:focus, [type='email']:focus, [type='url']:focus, [type='password']:focus, [type='number']:focus, [type='date']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='week']:focus, [multiple]:focus, textarea:focus, select:focus { 396 | outline: 2px solid transparent; 397 | outline-offset: 2px; 398 | --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); 399 | --tw-ring-offset-width: 0px; 400 | --tw-ring-offset-color: #fff; 401 | --tw-ring-color: #2563eb; 402 | --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); 403 | --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); 404 | box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); 405 | border-color: #2563eb; 406 | } 407 | 408 | input::-moz-placeholder, textarea::-moz-placeholder { 409 | color: #6b7280; 410 | opacity: 1; 411 | } 412 | 413 | input::placeholder,textarea::placeholder { 414 | color: #6b7280; 415 | opacity: 1; 416 | } 417 | 418 | ::-webkit-datetime-edit-fields-wrapper { 419 | padding: 0; 420 | } 421 | 422 | ::-webkit-date-and-time-value { 423 | min-height: 1.5em; 424 | } 425 | 426 | ::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field { 427 | padding-top: 0; 428 | padding-bottom: 0; 429 | } 430 | 431 | select { 432 | background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); 433 | background-position: right 0.5rem center; 434 | background-repeat: no-repeat; 435 | background-size: 1.5em 1.5em; 436 | padding-right: 2.5rem; 437 | -webkit-print-color-adjust: exact; 438 | print-color-adjust: exact; 439 | } 440 | 441 | [multiple] { 442 | background-image: initial; 443 | background-position: initial; 444 | background-repeat: unset; 445 | background-size: initial; 446 | padding-right: 0.75rem; 447 | -webkit-print-color-adjust: unset; 448 | print-color-adjust: unset; 449 | } 450 | 451 | [type='checkbox'],[type='radio'] { 452 | -webkit-appearance: none; 453 | -moz-appearance: none; 454 | appearance: none; 455 | padding: 0; 456 | -webkit-print-color-adjust: exact; 457 | print-color-adjust: exact; 458 | display: inline-block; 459 | vertical-align: middle; 460 | background-origin: border-box; 461 | -webkit-user-select: none; 462 | -moz-user-select: none; 463 | user-select: none; 464 | flex-shrink: 0; 465 | height: 1rem; 466 | width: 1rem; 467 | color: #2563eb; 468 | background-color: #fff; 469 | border-color: #6b7280; 470 | border-width: 1px; 471 | --tw-shadow: 0 0 #0000; 472 | } 473 | 474 | [type='checkbox'] { 475 | border-radius: 0px; 476 | } 477 | 478 | [type='radio'] { 479 | border-radius: 100%; 480 | } 481 | 482 | [type='checkbox']:focus,[type='radio']:focus { 483 | outline: 2px solid transparent; 484 | outline-offset: 2px; 485 | --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); 486 | --tw-ring-offset-width: 2px; 487 | --tw-ring-offset-color: #fff; 488 | --tw-ring-color: #2563eb; 489 | --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); 490 | --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); 491 | box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); 492 | } 493 | 494 | [type='checkbox']:checked,[type='radio']:checked { 495 | border-color: transparent; 496 | background-color: currentColor; 497 | background-size: 100% 100%; 498 | background-position: center; 499 | background-repeat: no-repeat; 500 | } 501 | 502 | [type='checkbox']:checked { 503 | background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); 504 | } 505 | 506 | [type='radio']:checked { 507 | background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e"); 508 | } 509 | 510 | [type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus { 511 | border-color: transparent; 512 | background-color: currentColor; 513 | } 514 | 515 | [type='checkbox']:indeterminate { 516 | background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e"); 517 | border-color: transparent; 518 | background-color: currentColor; 519 | background-size: 100% 100%; 520 | background-position: center; 521 | background-repeat: no-repeat; 522 | } 523 | 524 | [type='checkbox']:indeterminate:hover,[type='checkbox']:indeterminate:focus { 525 | border-color: transparent; 526 | background-color: currentColor; 527 | } 528 | 529 | [type='file'] { 530 | background: unset; 531 | border-color: inherit; 532 | border-width: 0; 533 | border-radius: 0; 534 | padding: 0; 535 | font-size: unset; 536 | line-height: inherit; 537 | } 538 | 539 | [type='file']:focus { 540 | outline: 1px solid ButtonText; 541 | outline: 1px auto -webkit-focus-ring-color; 542 | } 543 | 544 | *, ::before, ::after { 545 | --tw-border-spacing-x: 0; 546 | --tw-border-spacing-y: 0; 547 | --tw-translate-x: 0; 548 | --tw-translate-y: 0; 549 | --tw-rotate: 0; 550 | --tw-skew-x: 0; 551 | --tw-skew-y: 0; 552 | --tw-scale-x: 1; 553 | --tw-scale-y: 1; 554 | --tw-pan-x: ; 555 | --tw-pan-y: ; 556 | --tw-pinch-zoom: ; 557 | --tw-scroll-snap-strictness: proximity; 558 | --tw-ordinal: ; 559 | --tw-slashed-zero: ; 560 | --tw-numeric-figure: ; 561 | --tw-numeric-spacing: ; 562 | --tw-numeric-fraction: ; 563 | --tw-ring-inset: ; 564 | --tw-ring-offset-width: 0px; 565 | --tw-ring-offset-color: #fff; 566 | --tw-ring-color: rgb(59 130 246 / 0.5); 567 | --tw-ring-offset-shadow: 0 0 #0000; 568 | --tw-ring-shadow: 0 0 #0000; 569 | --tw-shadow: 0 0 #0000; 570 | --tw-shadow-colored: 0 0 #0000; 571 | --tw-blur: ; 572 | --tw-brightness: ; 573 | --tw-contrast: ; 574 | --tw-grayscale: ; 575 | --tw-hue-rotate: ; 576 | --tw-invert: ; 577 | --tw-saturate: ; 578 | --tw-sepia: ; 579 | --tw-drop-shadow: ; 580 | --tw-backdrop-blur: ; 581 | --tw-backdrop-brightness: ; 582 | --tw-backdrop-contrast: ; 583 | --tw-backdrop-grayscale: ; 584 | --tw-backdrop-hue-rotate: ; 585 | --tw-backdrop-invert: ; 586 | --tw-backdrop-opacity: ; 587 | --tw-backdrop-saturate: ; 588 | --tw-backdrop-sepia: ; 589 | } 590 | 591 | ::backdrop { 592 | --tw-border-spacing-x: 0; 593 | --tw-border-spacing-y: 0; 594 | --tw-translate-x: 0; 595 | --tw-translate-y: 0; 596 | --tw-rotate: 0; 597 | --tw-skew-x: 0; 598 | --tw-skew-y: 0; 599 | --tw-scale-x: 1; 600 | --tw-scale-y: 1; 601 | --tw-pan-x: ; 602 | --tw-pan-y: ; 603 | --tw-pinch-zoom: ; 604 | --tw-scroll-snap-strictness: proximity; 605 | --tw-ordinal: ; 606 | --tw-slashed-zero: ; 607 | --tw-numeric-figure: ; 608 | --tw-numeric-spacing: ; 609 | --tw-numeric-fraction: ; 610 | --tw-ring-inset: ; 611 | --tw-ring-offset-width: 0px; 612 | --tw-ring-offset-color: #fff; 613 | --tw-ring-color: rgb(59 130 246 / 0.5); 614 | --tw-ring-offset-shadow: 0 0 #0000; 615 | --tw-ring-shadow: 0 0 #0000; 616 | --tw-shadow: 0 0 #0000; 617 | --tw-shadow-colored: 0 0 #0000; 618 | --tw-blur: ; 619 | --tw-brightness: ; 620 | --tw-contrast: ; 621 | --tw-grayscale: ; 622 | --tw-hue-rotate: ; 623 | --tw-invert: ; 624 | --tw-saturate: ; 625 | --tw-sepia: ; 626 | --tw-drop-shadow: ; 627 | --tw-backdrop-blur: ; 628 | --tw-backdrop-brightness: ; 629 | --tw-backdrop-contrast: ; 630 | --tw-backdrop-grayscale: ; 631 | --tw-backdrop-hue-rotate: ; 632 | --tw-backdrop-invert: ; 633 | --tw-backdrop-opacity: ; 634 | --tw-backdrop-saturate: ; 635 | --tw-backdrop-sepia: ; 636 | } 637 | .prose { 638 | color: var(--tw-prose-body); 639 | max-width: 65ch; 640 | } 641 | .prose :where(p):not(:where([class~="not-prose"] *)) { 642 | margin-top: 1.25em; 643 | margin-bottom: 1.25em; 644 | } 645 | .prose :where([class~="lead"]):not(:where([class~="not-prose"] *)) { 646 | color: var(--tw-prose-lead); 647 | font-size: 1.25em; 648 | line-height: 1.6; 649 | margin-top: 1.2em; 650 | margin-bottom: 1.2em; 651 | } 652 | .prose :where(a):not(:where([class~="not-prose"] *)) { 653 | color: var(--tw-prose-links); 654 | text-decoration: underline; 655 | font-weight: 500; 656 | } 657 | .prose :where(strong):not(:where([class~="not-prose"] *)) { 658 | color: var(--tw-prose-bold); 659 | font-weight: 600; 660 | } 661 | .prose :where(a strong):not(:where([class~="not-prose"] *)) { 662 | color: inherit; 663 | } 664 | .prose :where(blockquote strong):not(:where([class~="not-prose"] *)) { 665 | color: inherit; 666 | } 667 | .prose :where(thead th strong):not(:where([class~="not-prose"] *)) { 668 | color: inherit; 669 | } 670 | .prose :where(ol):not(:where([class~="not-prose"] *)) { 671 | list-style-type: decimal; 672 | margin-top: 1.25em; 673 | margin-bottom: 1.25em; 674 | padding-left: 1.625em; 675 | } 676 | .prose :where(ol[type="A"]):not(:where([class~="not-prose"] *)) { 677 | list-style-type: upper-alpha; 678 | } 679 | .prose :where(ol[type="a"]):not(:where([class~="not-prose"] *)) { 680 | list-style-type: lower-alpha; 681 | } 682 | .prose :where(ol[type="A" s]):not(:where([class~="not-prose"] *)) { 683 | list-style-type: upper-alpha; 684 | } 685 | .prose :where(ol[type="a" s]):not(:where([class~="not-prose"] *)) { 686 | list-style-type: lower-alpha; 687 | } 688 | .prose :where(ol[type="I"]):not(:where([class~="not-prose"] *)) { 689 | list-style-type: upper-roman; 690 | } 691 | .prose :where(ol[type="i"]):not(:where([class~="not-prose"] *)) { 692 | list-style-type: lower-roman; 693 | } 694 | .prose :where(ol[type="I" s]):not(:where([class~="not-prose"] *)) { 695 | list-style-type: upper-roman; 696 | } 697 | .prose :where(ol[type="i" s]):not(:where([class~="not-prose"] *)) { 698 | list-style-type: lower-roman; 699 | } 700 | .prose :where(ol[type="1"]):not(:where([class~="not-prose"] *)) { 701 | list-style-type: decimal; 702 | } 703 | .prose :where(ul):not(:where([class~="not-prose"] *)) { 704 | list-style-type: disc; 705 | margin-top: 1.25em; 706 | margin-bottom: 1.25em; 707 | padding-left: 1.625em; 708 | } 709 | .prose :where(ol > li):not(:where([class~="not-prose"] *))::marker { 710 | font-weight: 400; 711 | color: var(--tw-prose-counters); 712 | } 713 | .prose :where(ul > li):not(:where([class~="not-prose"] *))::marker { 714 | color: var(--tw-prose-bullets); 715 | } 716 | .prose :where(hr):not(:where([class~="not-prose"] *)) { 717 | border-color: var(--tw-prose-hr); 718 | border-top-width: 1px; 719 | margin-top: 3em; 720 | margin-bottom: 3em; 721 | } 722 | .prose :where(blockquote):not(:where([class~="not-prose"] *)) { 723 | font-weight: 500; 724 | font-style: italic; 725 | color: var(--tw-prose-quotes); 726 | border-left-width: 0.25rem; 727 | border-left-color: var(--tw-prose-quote-borders); 728 | quotes: "\201C""\201D""\2018""\2019"; 729 | margin-top: 1.6em; 730 | margin-bottom: 1.6em; 731 | padding-left: 1em; 732 | } 733 | .prose :where(blockquote p:first-of-type):not(:where([class~="not-prose"] *))::before { 734 | content: open-quote; 735 | } 736 | .prose :where(blockquote p:last-of-type):not(:where([class~="not-prose"] *))::after { 737 | content: close-quote; 738 | } 739 | .prose :where(h1):not(:where([class~="not-prose"] *)) { 740 | color: var(--tw-prose-headings); 741 | font-weight: 800; 742 | font-size: 2.25em; 743 | margin-top: 0; 744 | margin-bottom: 0.8888889em; 745 | line-height: 1.1111111; 746 | } 747 | .prose :where(h1 strong):not(:where([class~="not-prose"] *)) { 748 | font-weight: 900; 749 | color: inherit; 750 | } 751 | .prose :where(h2):not(:where([class~="not-prose"] *)) { 752 | color: var(--tw-prose-headings); 753 | font-weight: 700; 754 | font-size: 1.5em; 755 | margin-top: 2em; 756 | margin-bottom: 1em; 757 | line-height: 1.3333333; 758 | } 759 | .prose :where(h2 strong):not(:where([class~="not-prose"] *)) { 760 | font-weight: 800; 761 | color: inherit; 762 | } 763 | .prose :where(h3):not(:where([class~="not-prose"] *)) { 764 | color: var(--tw-prose-headings); 765 | font-weight: 600; 766 | font-size: 1.25em; 767 | margin-top: 1.6em; 768 | margin-bottom: 0.6em; 769 | line-height: 1.6; 770 | } 771 | .prose :where(h3 strong):not(:where([class~="not-prose"] *)) { 772 | font-weight: 700; 773 | color: inherit; 774 | } 775 | .prose :where(h4):not(:where([class~="not-prose"] *)) { 776 | color: var(--tw-prose-headings); 777 | font-weight: 600; 778 | margin-top: 1.5em; 779 | margin-bottom: 0.5em; 780 | line-height: 1.5; 781 | } 782 | .prose :where(h4 strong):not(:where([class~="not-prose"] *)) { 783 | font-weight: 700; 784 | color: inherit; 785 | } 786 | .prose :where(img):not(:where([class~="not-prose"] *)) { 787 | margin-top: 2em; 788 | margin-bottom: 2em; 789 | } 790 | .prose :where(figure > *):not(:where([class~="not-prose"] *)) { 791 | margin-top: 0; 792 | margin-bottom: 0; 793 | } 794 | .prose :where(figcaption):not(:where([class~="not-prose"] *)) { 795 | color: var(--tw-prose-captions); 796 | font-size: 0.875em; 797 | line-height: 1.4285714; 798 | margin-top: 0.8571429em; 799 | } 800 | .prose :where(code):not(:where([class~="not-prose"] *)) { 801 | color: var(--tw-prose-code); 802 | font-weight: 600; 803 | font-size: 0.875em; 804 | } 805 | .prose :where(code):not(:where([class~="not-prose"] *))::before { 806 | content: "`"; 807 | } 808 | .prose :where(code):not(:where([class~="not-prose"] *))::after { 809 | content: "`"; 810 | } 811 | .prose :where(a code):not(:where([class~="not-prose"] *)) { 812 | color: inherit; 813 | } 814 | .prose :where(h1 code):not(:where([class~="not-prose"] *)) { 815 | color: inherit; 816 | } 817 | .prose :where(h2 code):not(:where([class~="not-prose"] *)) { 818 | color: inherit; 819 | font-size: 0.875em; 820 | } 821 | .prose :where(h3 code):not(:where([class~="not-prose"] *)) { 822 | color: inherit; 823 | font-size: 0.9em; 824 | } 825 | .prose :where(h4 code):not(:where([class~="not-prose"] *)) { 826 | color: inherit; 827 | } 828 | .prose :where(blockquote code):not(:where([class~="not-prose"] *)) { 829 | color: inherit; 830 | } 831 | .prose :where(thead th code):not(:where([class~="not-prose"] *)) { 832 | color: inherit; 833 | } 834 | .prose :where(pre):not(:where([class~="not-prose"] *)) { 835 | color: var(--tw-prose-pre-code); 836 | background-color: var(--tw-prose-pre-bg); 837 | overflow-x: auto; 838 | font-weight: 400; 839 | font-size: 0.875em; 840 | line-height: 1.7142857; 841 | margin-top: 1.7142857em; 842 | margin-bottom: 1.7142857em; 843 | border-radius: 0.375rem; 844 | padding-top: 0.8571429em; 845 | padding-right: 1.1428571em; 846 | padding-bottom: 0.8571429em; 847 | padding-left: 1.1428571em; 848 | } 849 | .prose :where(pre code):not(:where([class~="not-prose"] *)) { 850 | background-color: transparent; 851 | border-width: 0; 852 | border-radius: 0; 853 | padding: 0; 854 | font-weight: inherit; 855 | color: inherit; 856 | font-size: inherit; 857 | font-family: inherit; 858 | line-height: inherit; 859 | } 860 | .prose :where(pre code):not(:where([class~="not-prose"] *))::before { 861 | content: none; 862 | } 863 | .prose :where(pre code):not(:where([class~="not-prose"] *))::after { 864 | content: none; 865 | } 866 | .prose :where(table):not(:where([class~="not-prose"] *)) { 867 | width: 100%; 868 | table-layout: auto; 869 | text-align: left; 870 | margin-top: 2em; 871 | margin-bottom: 2em; 872 | font-size: 0.875em; 873 | line-height: 1.7142857; 874 | } 875 | .prose :where(thead):not(:where([class~="not-prose"] *)) { 876 | border-bottom-width: 1px; 877 | border-bottom-color: var(--tw-prose-th-borders); 878 | } 879 | .prose :where(thead th):not(:where([class~="not-prose"] *)) { 880 | color: var(--tw-prose-headings); 881 | font-weight: 600; 882 | vertical-align: bottom; 883 | padding-right: 0.5714286em; 884 | padding-bottom: 0.5714286em; 885 | padding-left: 0.5714286em; 886 | } 887 | .prose :where(tbody tr):not(:where([class~="not-prose"] *)) { 888 | border-bottom-width: 1px; 889 | border-bottom-color: var(--tw-prose-td-borders); 890 | } 891 | .prose :where(tbody tr:last-child):not(:where([class~="not-prose"] *)) { 892 | border-bottom-width: 0; 893 | } 894 | .prose :where(tbody td):not(:where([class~="not-prose"] *)) { 895 | vertical-align: baseline; 896 | } 897 | .prose :where(tfoot):not(:where([class~="not-prose"] *)) { 898 | border-top-width: 1px; 899 | border-top-color: var(--tw-prose-th-borders); 900 | } 901 | .prose :where(tfoot td):not(:where([class~="not-prose"] *)) { 902 | vertical-align: top; 903 | } 904 | .prose { 905 | --tw-prose-body: #374151; 906 | --tw-prose-headings: #111827; 907 | --tw-prose-lead: #4b5563; 908 | --tw-prose-links: #111827; 909 | --tw-prose-bold: #111827; 910 | --tw-prose-counters: #6b7280; 911 | --tw-prose-bullets: #d1d5db; 912 | --tw-prose-hr: #e5e7eb; 913 | --tw-prose-quotes: #111827; 914 | --tw-prose-quote-borders: #e5e7eb; 915 | --tw-prose-captions: #6b7280; 916 | --tw-prose-code: #111827; 917 | --tw-prose-pre-code: #e5e7eb; 918 | --tw-prose-pre-bg: #1f2937; 919 | --tw-prose-th-borders: #d1d5db; 920 | --tw-prose-td-borders: #e5e7eb; 921 | --tw-prose-invert-body: #d1d5db; 922 | --tw-prose-invert-headings: #fff; 923 | --tw-prose-invert-lead: #9ca3af; 924 | --tw-prose-invert-links: #fff; 925 | --tw-prose-invert-bold: #fff; 926 | --tw-prose-invert-counters: #9ca3af; 927 | --tw-prose-invert-bullets: #4b5563; 928 | --tw-prose-invert-hr: #374151; 929 | --tw-prose-invert-quotes: #f3f4f6; 930 | --tw-prose-invert-quote-borders: #374151; 931 | --tw-prose-invert-captions: #9ca3af; 932 | --tw-prose-invert-code: #fff; 933 | --tw-prose-invert-pre-code: #d1d5db; 934 | --tw-prose-invert-pre-bg: rgb(0 0 0 / 50%); 935 | --tw-prose-invert-th-borders: #4b5563; 936 | --tw-prose-invert-td-borders: #374151; 937 | font-size: 1rem; 938 | line-height: 1.75; 939 | } 940 | .prose :where(video):not(:where([class~="not-prose"] *)) { 941 | margin-top: 2em; 942 | margin-bottom: 2em; 943 | } 944 | .prose :where(figure):not(:where([class~="not-prose"] *)) { 945 | margin-top: 2em; 946 | margin-bottom: 2em; 947 | } 948 | .prose :where(li):not(:where([class~="not-prose"] *)) { 949 | margin-top: 0.5em; 950 | margin-bottom: 0.5em; 951 | } 952 | .prose :where(ol > li):not(:where([class~="not-prose"] *)) { 953 | padding-left: 0.375em; 954 | } 955 | .prose :where(ul > li):not(:where([class~="not-prose"] *)) { 956 | padding-left: 0.375em; 957 | } 958 | .prose :where(.prose > ul > li p):not(:where([class~="not-prose"] *)) { 959 | margin-top: 0.75em; 960 | margin-bottom: 0.75em; 961 | } 962 | .prose :where(.prose > ul > li > *:first-child):not(:where([class~="not-prose"] *)) { 963 | margin-top: 1.25em; 964 | } 965 | .prose :where(.prose > ul > li > *:last-child):not(:where([class~="not-prose"] *)) { 966 | margin-bottom: 1.25em; 967 | } 968 | .prose :where(.prose > ol > li > *:first-child):not(:where([class~="not-prose"] *)) { 969 | margin-top: 1.25em; 970 | } 971 | .prose :where(.prose > ol > li > *:last-child):not(:where([class~="not-prose"] *)) { 972 | margin-bottom: 1.25em; 973 | } 974 | .prose :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *)) { 975 | margin-top: 0.75em; 976 | margin-bottom: 0.75em; 977 | } 978 | .prose :where(hr + *):not(:where([class~="not-prose"] *)) { 979 | margin-top: 0; 980 | } 981 | .prose :where(h2 + *):not(:where([class~="not-prose"] *)) { 982 | margin-top: 0; 983 | } 984 | .prose :where(h3 + *):not(:where([class~="not-prose"] *)) { 985 | margin-top: 0; 986 | } 987 | .prose :where(h4 + *):not(:where([class~="not-prose"] *)) { 988 | margin-top: 0; 989 | } 990 | .prose :where(thead th:first-child):not(:where([class~="not-prose"] *)) { 991 | padding-left: 0; 992 | } 993 | .prose :where(thead th:last-child):not(:where([class~="not-prose"] *)) { 994 | padding-right: 0; 995 | } 996 | .prose :where(tbody td, tfoot td):not(:where([class~="not-prose"] *)) { 997 | padding-top: 0.5714286em; 998 | padding-right: 0.5714286em; 999 | padding-bottom: 0.5714286em; 1000 | padding-left: 0.5714286em; 1001 | } 1002 | .prose :where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"] *)) { 1003 | padding-left: 0; 1004 | } 1005 | .prose :where(tbody td:last-child, tfoot td:last-child):not(:where([class~="not-prose"] *)) { 1006 | padding-right: 0; 1007 | } 1008 | .prose :where(.prose > :first-child):not(:where([class~="not-prose"] *)) { 1009 | margin-top: 0; 1010 | } 1011 | .prose :where(.prose > :last-child):not(:where([class~="not-prose"] *)) { 1012 | margin-bottom: 0; 1013 | } 1014 | .my-auto { 1015 | margin-top: auto; 1016 | margin-bottom: auto; 1017 | } 1018 | .mb-2 { 1019 | margin-bottom: 0.5rem; 1020 | } 1021 | .mb-3 { 1022 | margin-bottom: 0.75rem; 1023 | } 1024 | .ml-auto { 1025 | margin-left: auto; 1026 | } 1027 | .flex { 1028 | display: flex; 1029 | } 1030 | .inline-flex { 1031 | display: inline-flex; 1032 | } 1033 | .grid { 1034 | display: grid; 1035 | } 1036 | .contents { 1037 | display: contents; 1038 | } 1039 | .hidden { 1040 | display: none; 1041 | } 1042 | .h-10 { 1043 | height: 2.5rem; 1044 | } 1045 | .h-5 { 1046 | height: 1.25rem; 1047 | } 1048 | .h-64 { 1049 | height: 16rem; 1050 | } 1051 | .h-screen { 1052 | height: 100vh; 1053 | } 1054 | .w-10 { 1055 | width: 2.5rem; 1056 | } 1057 | .w-5 { 1058 | width: 1.25rem; 1059 | } 1060 | .w-full { 1061 | width: 100%; 1062 | } 1063 | .max-w-6xl { 1064 | max-width: 72rem; 1065 | } 1066 | @keyframes spin { 1067 | 1068 | to { 1069 | transform: rotate(360deg); 1070 | } 1071 | } 1072 | .animate-spin { 1073 | animation: spin 1s linear infinite; 1074 | } 1075 | .cursor-pointer { 1076 | cursor: pointer; 1077 | } 1078 | .flex-row { 1079 | flex-direction: row; 1080 | } 1081 | .flex-col { 1082 | flex-direction: column; 1083 | } 1084 | .place-items-center { 1085 | place-items: center; 1086 | } 1087 | .items-center { 1088 | align-items: center; 1089 | } 1090 | .justify-center { 1091 | justify-content: center; 1092 | } 1093 | .space-x-4 > :not([hidden]) ~ :not([hidden]) { 1094 | --tw-space-x-reverse: 0; 1095 | margin-right: calc(1rem * var(--tw-space-x-reverse)); 1096 | margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); 1097 | } 1098 | .space-y-2 > :not([hidden]) ~ :not([hidden]) { 1099 | --tw-space-y-reverse: 0; 1100 | margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))); 1101 | margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); 1102 | } 1103 | .rounded-lg { 1104 | border-radius: 0.5rem; 1105 | } 1106 | .rounded-md { 1107 | border-radius: 0.375rem; 1108 | } 1109 | .border { 1110 | border-width: 1px; 1111 | } 1112 | .border-2 { 1113 | border-width: 2px; 1114 | } 1115 | .border-dashed { 1116 | border-style: dashed; 1117 | } 1118 | .border-neutral-300 { 1119 | --tw-border-opacity: 1; 1120 | border-color: rgb(212 212 212 / var(--tw-border-opacity)); 1121 | } 1122 | .border-transparent { 1123 | border-color: transparent; 1124 | } 1125 | .bg-neutral-50 { 1126 | --tw-bg-opacity: 1; 1127 | background-color: rgb(250 250 250 / var(--tw-bg-opacity)); 1128 | } 1129 | .bg-neutral-800 { 1130 | --tw-bg-opacity: 1; 1131 | background-color: rgb(38 38 38 / var(--tw-bg-opacity)); 1132 | } 1133 | .px-4 { 1134 | padding-left: 1rem; 1135 | padding-right: 1rem; 1136 | } 1137 | .py-2 { 1138 | padding-top: 0.5rem; 1139 | padding-bottom: 0.5rem; 1140 | } 1141 | .py-6 { 1142 | padding-top: 1.5rem; 1143 | padding-bottom: 1.5rem; 1144 | } 1145 | .text-3xl { 1146 | font-size: 1.875rem; 1147 | line-height: 2.25rem; 1148 | } 1149 | .text-sm { 1150 | font-size: 0.875rem; 1151 | line-height: 1.25rem; 1152 | } 1153 | .text-xs { 1154 | font-size: 0.75rem; 1155 | line-height: 1rem; 1156 | } 1157 | .font-bold { 1158 | font-weight: 700; 1159 | } 1160 | .font-medium { 1161 | font-weight: 500; 1162 | } 1163 | .font-semibold { 1164 | font-weight: 600; 1165 | } 1166 | .text-black { 1167 | --tw-text-opacity: 1; 1168 | color: rgb(0 0 0 / var(--tw-text-opacity)); 1169 | } 1170 | .text-neutral-400 { 1171 | --tw-text-opacity: 1; 1172 | color: rgb(163 163 163 / var(--tw-text-opacity)); 1173 | } 1174 | .text-neutral-500 { 1175 | --tw-text-opacity: 1; 1176 | color: rgb(115 115 115 / var(--tw-text-opacity)); 1177 | } 1178 | .text-red-500 { 1179 | --tw-text-opacity: 1; 1180 | color: rgb(239 68 68 / var(--tw-text-opacity)); 1181 | } 1182 | .text-white { 1183 | --tw-text-opacity: 1; 1184 | color: rgb(255 255 255 / var(--tw-text-opacity)); 1185 | } 1186 | .underline { 1187 | text-decoration-line: underline; 1188 | } 1189 | .opacity-25 { 1190 | opacity: 0.25; 1191 | } 1192 | .opacity-75 { 1193 | opacity: 0.75; 1194 | } 1195 | .shadow-sm { 1196 | --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); 1197 | --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); 1198 | box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); 1199 | } 1200 | .hover\:bg-black:hover { 1201 | --tw-bg-opacity: 1; 1202 | background-color: rgb(0 0 0 / var(--tw-bg-opacity)); 1203 | } 1204 | .focus\:outline-none:focus { 1205 | outline: 2px solid transparent; 1206 | outline-offset: 2px; 1207 | } 1208 | .focus\:ring-2:focus { 1209 | --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); 1210 | --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); 1211 | box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); 1212 | } 1213 | .focus\:ring-black:focus { 1214 | --tw-ring-opacity: 1; 1215 | --tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity)); 1216 | } 1217 | .focus\:ring-offset-2:focus { 1218 | --tw-ring-offset-width: 2px; 1219 | } 1220 | @media (min-width: 768px) { 1221 | 1222 | .md\:min-w-\[28rem\] { 1223 | min-width: 28rem; 1224 | } 1225 | } 1226 | @media (min-width: 1024px) { 1227 | 1228 | .lg\:min-w-\[32rem\] { 1229 | min-width: 32rem; 1230 | } 1231 | } 1232 | @media (min-width: 1280px) { 1233 | 1234 | .xl\:min-w-\[36rem\] { 1235 | min-width: 36rem; 1236 | } 1237 | } -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/chunks/0-8e8c308f.js: -------------------------------------------------------------------------------- 1 | import { default as default2 } from "../components/pages/_layout.svelte-ebc491c9.js"; 2 | export { 3 | default2 as component 4 | }; 5 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/chunks/1-d7f1c69a.js: -------------------------------------------------------------------------------- 1 | import { default as default2 } from "../components/error.svelte-63101f88.js"; 2 | export { 3 | default2 as component 4 | }; 5 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/chunks/2-3677231e.js: -------------------------------------------------------------------------------- 1 | import { default as default2 } from "../components/pages/_page.svelte-a3e10c76.js"; 2 | export { 3 | default2 as component 4 | }; 5 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/chunks/index-0c191f98.js: -------------------------------------------------------------------------------- 1 | function noop() { 2 | } 3 | function assign(tar, src) { 4 | for (const k in src) 5 | tar[k] = src[k]; 6 | return tar; 7 | } 8 | function run(fn) { 9 | return fn(); 10 | } 11 | function blank_object() { 12 | return /* @__PURE__ */ Object.create(null); 13 | } 14 | function run_all(fns) { 15 | fns.forEach(run); 16 | } 17 | function is_function(thing) { 18 | return typeof thing === "function"; 19 | } 20 | function safe_not_equal(a, b) { 21 | return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function"); 22 | } 23 | function is_empty(obj) { 24 | return Object.keys(obj).length === 0; 25 | } 26 | function subscribe(store, ...callbacks) { 27 | if (store == null) { 28 | return noop; 29 | } 30 | const unsub = store.subscribe(...callbacks); 31 | return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; 32 | } 33 | function component_subscribe(component, store, callback) { 34 | component.$$.on_destroy.push(subscribe(store, callback)); 35 | } 36 | function create_slot(definition, ctx, $$scope, fn) { 37 | if (definition) { 38 | const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); 39 | return definition[0](slot_ctx); 40 | } 41 | } 42 | function get_slot_context(definition, ctx, $$scope, fn) { 43 | return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx; 44 | } 45 | function get_slot_changes(definition, $$scope, dirty, fn) { 46 | if (definition[2] && fn) { 47 | const lets = definition[2](fn(dirty)); 48 | if ($$scope.dirty === void 0) { 49 | return lets; 50 | } 51 | if (typeof lets === "object") { 52 | const merged = []; 53 | const len = Math.max($$scope.dirty.length, lets.length); 54 | for (let i = 0; i < len; i += 1) { 55 | merged[i] = $$scope.dirty[i] | lets[i]; 56 | } 57 | return merged; 58 | } 59 | return $$scope.dirty | lets; 60 | } 61 | return $$scope.dirty; 62 | } 63 | function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) { 64 | if (slot_changes) { 65 | const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); 66 | slot.p(slot_context, slot_changes); 67 | } 68 | } 69 | function get_all_dirty_from_scope($$scope) { 70 | if ($$scope.ctx.length > 32) { 71 | const dirty = []; 72 | const length = $$scope.ctx.length / 32; 73 | for (let i = 0; i < length; i++) { 74 | dirty[i] = -1; 75 | } 76 | return dirty; 77 | } 78 | return -1; 79 | } 80 | function action_destroyer(action_result) { 81 | return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; 82 | } 83 | let is_hydrating = false; 84 | function start_hydrating() { 85 | is_hydrating = true; 86 | } 87 | function end_hydrating() { 88 | is_hydrating = false; 89 | } 90 | function upper_bound(low, high, key, value) { 91 | while (low < high) { 92 | const mid = low + (high - low >> 1); 93 | if (key(mid) <= value) { 94 | low = mid + 1; 95 | } else { 96 | high = mid; 97 | } 98 | } 99 | return low; 100 | } 101 | function init_hydrate(target) { 102 | if (target.hydrate_init) 103 | return; 104 | target.hydrate_init = true; 105 | let children2 = target.childNodes; 106 | if (target.nodeName === "HEAD") { 107 | const myChildren = []; 108 | for (let i = 0; i < children2.length; i++) { 109 | const node = children2[i]; 110 | if (node.claim_order !== void 0) { 111 | myChildren.push(node); 112 | } 113 | } 114 | children2 = myChildren; 115 | } 116 | const m = new Int32Array(children2.length + 1); 117 | const p = new Int32Array(children2.length); 118 | m[0] = -1; 119 | let longest = 0; 120 | for (let i = 0; i < children2.length; i++) { 121 | const current = children2[i].claim_order; 122 | const seqLen = (longest > 0 && children2[m[longest]].claim_order <= current ? longest + 1 : upper_bound(1, longest, (idx) => children2[m[idx]].claim_order, current)) - 1; 123 | p[i] = m[seqLen] + 1; 124 | const newLen = seqLen + 1; 125 | m[newLen] = i; 126 | longest = Math.max(newLen, longest); 127 | } 128 | const lis = []; 129 | const toMove = []; 130 | let last = children2.length - 1; 131 | for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) { 132 | lis.push(children2[cur - 1]); 133 | for (; last >= cur; last--) { 134 | toMove.push(children2[last]); 135 | } 136 | last--; 137 | } 138 | for (; last >= 0; last--) { 139 | toMove.push(children2[last]); 140 | } 141 | lis.reverse(); 142 | toMove.sort((a, b) => a.claim_order - b.claim_order); 143 | for (let i = 0, j = 0; i < toMove.length; i++) { 144 | while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) { 145 | j++; 146 | } 147 | const anchor = j < lis.length ? lis[j] : null; 148 | target.insertBefore(toMove[i], anchor); 149 | } 150 | } 151 | function append_hydration(target, node) { 152 | if (is_hydrating) { 153 | init_hydrate(target); 154 | if (target.actual_end_child === void 0 || target.actual_end_child !== null && target.actual_end_child.parentNode !== target) { 155 | target.actual_end_child = target.firstChild; 156 | } 157 | while (target.actual_end_child !== null && target.actual_end_child.claim_order === void 0) { 158 | target.actual_end_child = target.actual_end_child.nextSibling; 159 | } 160 | if (node !== target.actual_end_child) { 161 | if (node.claim_order !== void 0 || node.parentNode !== target) { 162 | target.insertBefore(node, target.actual_end_child); 163 | } 164 | } else { 165 | target.actual_end_child = node.nextSibling; 166 | } 167 | } else if (node.parentNode !== target || node.nextSibling !== null) { 168 | target.appendChild(node); 169 | } 170 | } 171 | function insert_hydration(target, node, anchor) { 172 | if (is_hydrating && !anchor) { 173 | append_hydration(target, node); 174 | } else if (node.parentNode !== target || node.nextSibling != anchor) { 175 | target.insertBefore(node, anchor || null); 176 | } 177 | } 178 | function detach(node) { 179 | if (node.parentNode) { 180 | node.parentNode.removeChild(node); 181 | } 182 | } 183 | function element(name) { 184 | return document.createElement(name); 185 | } 186 | function svg_element(name) { 187 | return document.createElementNS("http://www.w3.org/2000/svg", name); 188 | } 189 | function text(data) { 190 | return document.createTextNode(data); 191 | } 192 | function space() { 193 | return text(" "); 194 | } 195 | function empty() { 196 | return text(""); 197 | } 198 | function listen(node, event, handler, options) { 199 | node.addEventListener(event, handler, options); 200 | return () => node.removeEventListener(event, handler, options); 201 | } 202 | function attr(node, attribute, value) { 203 | if (value == null) 204 | node.removeAttribute(attribute); 205 | else if (node.getAttribute(attribute) !== value) 206 | node.setAttribute(attribute, value); 207 | } 208 | function children(element2) { 209 | return Array.from(element2.childNodes); 210 | } 211 | function init_claim_info(nodes) { 212 | if (nodes.claim_info === void 0) { 213 | nodes.claim_info = { last_index: 0, total_claimed: 0 }; 214 | } 215 | } 216 | function claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) { 217 | init_claim_info(nodes); 218 | const resultNode = (() => { 219 | for (let i = nodes.claim_info.last_index; i < nodes.length; i++) { 220 | const node = nodes[i]; 221 | if (predicate(node)) { 222 | const replacement = processNode(node); 223 | if (replacement === void 0) { 224 | nodes.splice(i, 1); 225 | } else { 226 | nodes[i] = replacement; 227 | } 228 | if (!dontUpdateLastIndex) { 229 | nodes.claim_info.last_index = i; 230 | } 231 | return node; 232 | } 233 | } 234 | for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) { 235 | const node = nodes[i]; 236 | if (predicate(node)) { 237 | const replacement = processNode(node); 238 | if (replacement === void 0) { 239 | nodes.splice(i, 1); 240 | } else { 241 | nodes[i] = replacement; 242 | } 243 | if (!dontUpdateLastIndex) { 244 | nodes.claim_info.last_index = i; 245 | } else if (replacement === void 0) { 246 | nodes.claim_info.last_index--; 247 | } 248 | return node; 249 | } 250 | } 251 | return createNode(); 252 | })(); 253 | resultNode.claim_order = nodes.claim_info.total_claimed; 254 | nodes.claim_info.total_claimed += 1; 255 | return resultNode; 256 | } 257 | function claim_element_base(nodes, name, attributes, create_element) { 258 | return claim_node(nodes, (node) => node.nodeName === name, (node) => { 259 | const remove = []; 260 | for (let j = 0; j < node.attributes.length; j++) { 261 | const attribute = node.attributes[j]; 262 | if (!attributes[attribute.name]) { 263 | remove.push(attribute.name); 264 | } 265 | } 266 | remove.forEach((v) => node.removeAttribute(v)); 267 | return void 0; 268 | }, () => create_element(name)); 269 | } 270 | function claim_element(nodes, name, attributes) { 271 | return claim_element_base(nodes, name, attributes, element); 272 | } 273 | function claim_svg_element(nodes, name, attributes) { 274 | return claim_element_base(nodes, name, attributes, svg_element); 275 | } 276 | function claim_text(nodes, data) { 277 | return claim_node( 278 | nodes, 279 | (node) => node.nodeType === 3, 280 | (node) => { 281 | const dataStr = "" + data; 282 | if (node.data.startsWith(dataStr)) { 283 | if (node.data.length !== dataStr.length) { 284 | return node.splitText(dataStr.length); 285 | } 286 | } else { 287 | node.data = dataStr; 288 | } 289 | }, 290 | () => text(data), 291 | true 292 | // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements 293 | ); 294 | } 295 | function claim_space(nodes) { 296 | return claim_text(nodes, " "); 297 | } 298 | function set_data(text2, data) { 299 | data = "" + data; 300 | if (text2.wholeText !== data) 301 | text2.data = data; 302 | } 303 | function set_style(node, key, value, important) { 304 | if (value === null) { 305 | node.style.removeProperty(key); 306 | } else { 307 | node.style.setProperty(key, value, important ? "important" : ""); 308 | } 309 | } 310 | function construct_svelte_component(component, props) { 311 | return new component(props); 312 | } 313 | let current_component; 314 | function set_current_component(component) { 315 | current_component = component; 316 | } 317 | function get_current_component() { 318 | if (!current_component) 319 | throw new Error("Function called outside component initialization"); 320 | return current_component; 321 | } 322 | function onMount(fn) { 323 | get_current_component().$$.on_mount.push(fn); 324 | } 325 | function afterUpdate(fn) { 326 | get_current_component().$$.after_update.push(fn); 327 | } 328 | const dirty_components = []; 329 | const binding_callbacks = []; 330 | const render_callbacks = []; 331 | const flush_callbacks = []; 332 | const resolved_promise = Promise.resolve(); 333 | let update_scheduled = false; 334 | function schedule_update() { 335 | if (!update_scheduled) { 336 | update_scheduled = true; 337 | resolved_promise.then(flush); 338 | } 339 | } 340 | function tick() { 341 | schedule_update(); 342 | return resolved_promise; 343 | } 344 | function add_render_callback(fn) { 345 | render_callbacks.push(fn); 346 | } 347 | const seen_callbacks = /* @__PURE__ */ new Set(); 348 | let flushidx = 0; 349 | function flush() { 350 | if (flushidx !== 0) { 351 | return; 352 | } 353 | const saved_component = current_component; 354 | do { 355 | try { 356 | while (flushidx < dirty_components.length) { 357 | const component = dirty_components[flushidx]; 358 | flushidx++; 359 | set_current_component(component); 360 | update(component.$$); 361 | } 362 | } catch (e) { 363 | dirty_components.length = 0; 364 | flushidx = 0; 365 | throw e; 366 | } 367 | set_current_component(null); 368 | dirty_components.length = 0; 369 | flushidx = 0; 370 | while (binding_callbacks.length) 371 | binding_callbacks.pop()(); 372 | for (let i = 0; i < render_callbacks.length; i += 1) { 373 | const callback = render_callbacks[i]; 374 | if (!seen_callbacks.has(callback)) { 375 | seen_callbacks.add(callback); 376 | callback(); 377 | } 378 | } 379 | render_callbacks.length = 0; 380 | } while (dirty_components.length); 381 | while (flush_callbacks.length) { 382 | flush_callbacks.pop()(); 383 | } 384 | update_scheduled = false; 385 | seen_callbacks.clear(); 386 | set_current_component(saved_component); 387 | } 388 | function update($$) { 389 | if ($$.fragment !== null) { 390 | $$.update(); 391 | run_all($$.before_update); 392 | const dirty = $$.dirty; 393 | $$.dirty = [-1]; 394 | $$.fragment && $$.fragment.p($$.ctx, dirty); 395 | $$.after_update.forEach(add_render_callback); 396 | } 397 | } 398 | const outroing = /* @__PURE__ */ new Set(); 399 | let outros; 400 | function group_outros() { 401 | outros = { 402 | r: 0, 403 | c: [], 404 | p: outros 405 | // parent group 406 | }; 407 | } 408 | function check_outros() { 409 | if (!outros.r) { 410 | run_all(outros.c); 411 | } 412 | outros = outros.p; 413 | } 414 | function transition_in(block, local) { 415 | if (block && block.i) { 416 | outroing.delete(block); 417 | block.i(local); 418 | } 419 | } 420 | function transition_out(block, local, detach2, callback) { 421 | if (block && block.o) { 422 | if (outroing.has(block)) 423 | return; 424 | outroing.add(block); 425 | outros.c.push(() => { 426 | outroing.delete(block); 427 | if (callback) { 428 | if (detach2) 429 | block.d(1); 430 | callback(); 431 | } 432 | }); 433 | block.o(local); 434 | } else if (callback) { 435 | callback(); 436 | } 437 | } 438 | function create_component(block) { 439 | block && block.c(); 440 | } 441 | function claim_component(block, parent_nodes) { 442 | block && block.l(parent_nodes); 443 | } 444 | function mount_component(component, target, anchor, customElement) { 445 | const { fragment, after_update } = component.$$; 446 | fragment && fragment.m(target, anchor); 447 | if (!customElement) { 448 | add_render_callback(() => { 449 | const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); 450 | if (component.$$.on_destroy) { 451 | component.$$.on_destroy.push(...new_on_destroy); 452 | } else { 453 | run_all(new_on_destroy); 454 | } 455 | component.$$.on_mount = []; 456 | }); 457 | } 458 | after_update.forEach(add_render_callback); 459 | } 460 | function destroy_component(component, detaching) { 461 | const $$ = component.$$; 462 | if ($$.fragment !== null) { 463 | run_all($$.on_destroy); 464 | $$.fragment && $$.fragment.d(detaching); 465 | $$.on_destroy = $$.fragment = null; 466 | $$.ctx = []; 467 | } 468 | } 469 | function make_dirty(component, i) { 470 | if (component.$$.dirty[0] === -1) { 471 | dirty_components.push(component); 472 | schedule_update(); 473 | component.$$.dirty.fill(0); 474 | } 475 | component.$$.dirty[i / 31 | 0] |= 1 << i % 31; 476 | } 477 | function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) { 478 | const parent_component = current_component; 479 | set_current_component(component); 480 | const $$ = component.$$ = { 481 | fragment: null, 482 | ctx: [], 483 | // state 484 | props, 485 | update: noop, 486 | not_equal, 487 | bound: blank_object(), 488 | // lifecycle 489 | on_mount: [], 490 | on_destroy: [], 491 | on_disconnect: [], 492 | before_update: [], 493 | after_update: [], 494 | context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), 495 | // everything else 496 | callbacks: blank_object(), 497 | dirty, 498 | skip_bound: false, 499 | root: options.target || parent_component.$$.root 500 | }; 501 | append_styles && append_styles($$.root); 502 | let ready = false; 503 | $$.ctx = instance ? instance(component, options.props || {}, (i, ret, ...rest) => { 504 | const value = rest.length ? rest[0] : ret; 505 | if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { 506 | if (!$$.skip_bound && $$.bound[i]) 507 | $$.bound[i](value); 508 | if (ready) 509 | make_dirty(component, i); 510 | } 511 | return ret; 512 | }) : []; 513 | $$.update(); 514 | ready = true; 515 | run_all($$.before_update); 516 | $$.fragment = create_fragment ? create_fragment($$.ctx) : false; 517 | if (options.target) { 518 | if (options.hydrate) { 519 | start_hydrating(); 520 | const nodes = children(options.target); 521 | $$.fragment && $$.fragment.l(nodes); 522 | nodes.forEach(detach); 523 | } else { 524 | $$.fragment && $$.fragment.c(); 525 | } 526 | if (options.intro) 527 | transition_in(component.$$.fragment); 528 | mount_component(component, options.target, options.anchor, options.customElement); 529 | end_hydrating(); 530 | flush(); 531 | } 532 | set_current_component(parent_component); 533 | } 534 | class SvelteComponent { 535 | $destroy() { 536 | destroy_component(this, 1); 537 | this.$destroy = noop; 538 | } 539 | $on(type, callback) { 540 | if (!is_function(callback)) { 541 | return noop; 542 | } 543 | const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); 544 | callbacks.push(callback); 545 | return () => { 546 | const index = callbacks.indexOf(callback); 547 | if (index !== -1) 548 | callbacks.splice(index, 1); 549 | }; 550 | } 551 | $set($$props) { 552 | if (this.$$set && !is_empty($$props)) { 553 | this.$$.skip_bound = true; 554 | this.$$set($$props); 555 | this.$$.skip_bound = false; 556 | } 557 | } 558 | } 559 | export { 560 | destroy_component as A, 561 | tick as B, 562 | noop as C, 563 | create_slot as D, 564 | update_slot_base as E, 565 | get_all_dirty_from_scope as F, 566 | get_slot_changes as G, 567 | append_hydration as H, 568 | component_subscribe as I, 569 | svg_element as J, 570 | claim_svg_element as K, 571 | action_destroyer as L, 572 | listen as M, 573 | run_all as N, 574 | SvelteComponent as S, 575 | space as a, 576 | insert_hydration as b, 577 | claim_space as c, 578 | check_outros as d, 579 | empty as e, 580 | transition_in as f, 581 | group_outros as g, 582 | detach as h, 583 | init as i, 584 | afterUpdate as j, 585 | element as k, 586 | claim_element as l, 587 | children as m, 588 | attr as n, 589 | onMount as o, 590 | set_style as p, 591 | text as q, 592 | claim_text as r, 593 | safe_not_equal as s, 594 | transition_out as t, 595 | set_data as u, 596 | binding_callbacks as v, 597 | construct_svelte_component as w, 598 | create_component as x, 599 | claim_component as y, 600 | mount_component as z 601 | }; 602 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/chunks/parse-a9b5aeea.js: -------------------------------------------------------------------------------- 1 | Object.getOwnPropertyNames(Object.prototype).sort().join("\0"); 2 | const UNDEFINED = -1; 3 | const HOLE = -2; 4 | const NAN = -3; 5 | const POSITIVE_INFINITY = -4; 6 | const NEGATIVE_INFINITY = -5; 7 | const NEGATIVE_ZERO = -6; 8 | function parse(serialized, revivers) { 9 | return unflatten(JSON.parse(serialized), revivers); 10 | } 11 | function unflatten(parsed, revivers) { 12 | if (typeof parsed === "number") 13 | return hydrate(parsed, true); 14 | if (!Array.isArray(parsed) || parsed.length === 0) { 15 | throw new Error("Invalid input"); 16 | } 17 | const values = ( 18 | /** @type {any[]} */ 19 | parsed 20 | ); 21 | const hydrated = Array(values.length); 22 | function hydrate(index, standalone = false) { 23 | if (index === UNDEFINED) 24 | return void 0; 25 | if (index === NAN) 26 | return NaN; 27 | if (index === POSITIVE_INFINITY) 28 | return Infinity; 29 | if (index === NEGATIVE_INFINITY) 30 | return -Infinity; 31 | if (index === NEGATIVE_ZERO) 32 | return -0; 33 | if (standalone) 34 | throw new Error(`Invalid input`); 35 | if (index in hydrated) 36 | return hydrated[index]; 37 | const value = values[index]; 38 | if (!value || typeof value !== "object") { 39 | hydrated[index] = value; 40 | } else if (Array.isArray(value)) { 41 | if (typeof value[0] === "string") { 42 | const type = value[0]; 43 | const reviver = revivers == null ? void 0 : revivers[type]; 44 | if (reviver) { 45 | return hydrated[index] = reviver(hydrate(value[1])); 46 | } 47 | switch (type) { 48 | case "Date": 49 | hydrated[index] = new Date(value[1]); 50 | break; 51 | case "Set": 52 | const set = /* @__PURE__ */ new Set(); 53 | hydrated[index] = set; 54 | for (let i = 1; i < value.length; i += 1) { 55 | set.add(hydrate(value[i])); 56 | } 57 | break; 58 | case "Map": 59 | const map = /* @__PURE__ */ new Map(); 60 | hydrated[index] = map; 61 | for (let i = 1; i < value.length; i += 2) { 62 | map.set(hydrate(value[i]), hydrate(value[i + 1])); 63 | } 64 | break; 65 | case "RegExp": 66 | hydrated[index] = new RegExp(value[1], value[2]); 67 | break; 68 | case "Object": 69 | hydrated[index] = Object(value[1]); 70 | break; 71 | case "BigInt": 72 | hydrated[index] = BigInt(value[1]); 73 | break; 74 | case "null": 75 | const obj = /* @__PURE__ */ Object.create(null); 76 | hydrated[index] = obj; 77 | for (let i = 1; i < value.length; i += 2) { 78 | obj[value[i]] = hydrate(value[i + 1]); 79 | } 80 | break; 81 | default: 82 | throw new Error(`Unknown type ${type}`); 83 | } 84 | } else { 85 | const array = new Array(value.length); 86 | hydrated[index] = array; 87 | for (let i = 0; i < value.length; i += 1) { 88 | const n = value[i]; 89 | if (n === HOLE) 90 | continue; 91 | array[i] = hydrate(n); 92 | } 93 | } 94 | } else { 95 | const object = {}; 96 | hydrated[index] = object; 97 | for (const key in value) { 98 | const n = value[key]; 99 | object[key] = hydrate(n); 100 | } 101 | } 102 | return hydrated[index]; 103 | } 104 | return hydrate(0); 105 | } 106 | export { 107 | parse as p, 108 | unflatten as u 109 | }; 110 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/chunks/singletons-5c8d2b5b.js: -------------------------------------------------------------------------------- 1 | import { C as noop, s as safe_not_equal } from "./index-0c191f98.js"; 2 | const subscriber_queue = []; 3 | function writable(value, start = noop) { 4 | let stop; 5 | const subscribers = /* @__PURE__ */ new Set(); 6 | function set(new_value) { 7 | if (safe_not_equal(value, new_value)) { 8 | value = new_value; 9 | if (stop) { 10 | const run_queue = !subscriber_queue.length; 11 | for (const subscriber of subscribers) { 12 | subscriber[1](); 13 | subscriber_queue.push(subscriber, value); 14 | } 15 | if (run_queue) { 16 | for (let i = 0; i < subscriber_queue.length; i += 2) { 17 | subscriber_queue[i][0](subscriber_queue[i + 1]); 18 | } 19 | subscriber_queue.length = 0; 20 | } 21 | } 22 | } 23 | } 24 | function update(fn) { 25 | set(fn(value)); 26 | } 27 | function subscribe(run, invalidate = noop) { 28 | const subscriber = [run, invalidate]; 29 | subscribers.add(subscriber); 30 | if (subscribers.size === 1) { 31 | stop = start(set) || noop; 32 | } 33 | run(value); 34 | return () => { 35 | subscribers.delete(subscriber); 36 | if (subscribers.size === 0) { 37 | stop(); 38 | stop = null; 39 | } 40 | }; 41 | } 42 | return { set, update, subscribe }; 43 | } 44 | const base = ""; 45 | let assets = base; 46 | function set_assets(path) { 47 | assets = path; 48 | } 49 | let version = ""; 50 | function set_version(value) { 51 | version = value; 52 | } 53 | const SNAPSHOT_KEY = "sveltekit:snapshot"; 54 | const SCROLL_KEY = "sveltekit:scroll"; 55 | const INDEX_KEY = "sveltekit:index"; 56 | const PRELOAD_PRIORITIES = ( 57 | /** @type {const} */ 58 | { 59 | tap: 1, 60 | hover: 2, 61 | viewport: 3, 62 | eager: 4, 63 | off: -1 64 | } 65 | ); 66 | function get_base_uri(doc) { 67 | let baseURI = doc.baseURI; 68 | if (!baseURI) { 69 | const baseTags = doc.getElementsByTagName("base"); 70 | baseURI = baseTags.length ? baseTags[0].href : doc.URL; 71 | } 72 | return baseURI; 73 | } 74 | function scroll_state() { 75 | return { 76 | x: pageXOffset, 77 | y: pageYOffset 78 | }; 79 | } 80 | function link_option(element, name) { 81 | const value = ( 82 | /** @type {ValidLinkOptions | null} */ 83 | element.getAttribute(`data-sveltekit-${name}`) 84 | ); 85 | return value; 86 | } 87 | const levels = { 88 | ...PRELOAD_PRIORITIES, 89 | "": PRELOAD_PRIORITIES.hover 90 | }; 91 | function parent_element(element) { 92 | let parent = element.assignedSlot ?? element.parentNode; 93 | if ((parent == null ? void 0 : parent.nodeType) === 11) 94 | parent = parent.host; 95 | return ( 96 | /** @type {Element} */ 97 | parent 98 | ); 99 | } 100 | function find_anchor(element, target) { 101 | while (element && element !== target) { 102 | if (element.nodeName.toUpperCase() === "A" && element.hasAttribute("href")) { 103 | return ( 104 | /** @type {HTMLAnchorElement | SVGAElement} */ 105 | element 106 | ); 107 | } 108 | element = /** @type {Element} */ 109 | parent_element(element); 110 | } 111 | } 112 | function get_link_info(a, base2) { 113 | let url; 114 | try { 115 | url = new URL(a instanceof SVGAElement ? a.href.baseVal : a.href, document.baseURI); 116 | } catch { 117 | } 118 | const target = a instanceof SVGAElement ? a.target.baseVal : a.target; 119 | const external = !url || !!target || is_external_url(url, base2) || (a.getAttribute("rel") || "").split(/\s+/).includes("external") || a.hasAttribute("download"); 120 | return { url, external, target }; 121 | } 122 | function get_router_options(element) { 123 | let noscroll = null; 124 | let preload_code = null; 125 | let preload_data = null; 126 | let reload = null; 127 | let el = element; 128 | while (el && el !== document.documentElement) { 129 | if (preload_code === null) 130 | preload_code = link_option(el, "preload-code"); 131 | if (preload_data === null) 132 | preload_data = link_option(el, "preload-data"); 133 | if (noscroll === null) 134 | noscroll = link_option(el, "noscroll"); 135 | if (reload === null) 136 | reload = link_option(el, "reload"); 137 | el = /** @type {Element} */ 138 | parent_element(el); 139 | } 140 | return { 141 | preload_code: levels[preload_code ?? "off"], 142 | preload_data: levels[preload_data ?? "off"], 143 | noscroll: noscroll === "off" ? false : noscroll === "" ? true : null, 144 | reload: reload === "off" ? false : reload === "" ? true : null 145 | }; 146 | } 147 | function notifiable_store(value) { 148 | const store = writable(value); 149 | let ready = true; 150 | function notify() { 151 | ready = true; 152 | store.update((val) => val); 153 | } 154 | function set(new_value) { 155 | ready = false; 156 | store.set(new_value); 157 | } 158 | function subscribe(run) { 159 | let old_value; 160 | return store.subscribe((new_value) => { 161 | if (old_value === void 0 || ready && new_value !== old_value) { 162 | run(old_value = new_value); 163 | } 164 | }); 165 | } 166 | return { notify, set, subscribe }; 167 | } 168 | function create_updated_store() { 169 | const { set, subscribe } = writable(false); 170 | let timeout; 171 | async function check() { 172 | clearTimeout(timeout); 173 | const res = await fetch(`${assets}/${"_app/version.json"}`, { 174 | headers: { 175 | pragma: "no-cache", 176 | "cache-control": "no-cache" 177 | } 178 | }); 179 | if (res.ok) { 180 | const data = await res.json(); 181 | const updated = data.version !== version; 182 | if (updated) { 183 | set(true); 184 | clearTimeout(timeout); 185 | } 186 | return updated; 187 | } else { 188 | throw new Error(`Version check failed: ${res.status}`); 189 | } 190 | } 191 | return { 192 | subscribe, 193 | check 194 | }; 195 | } 196 | function is_external_url(url, base2) { 197 | return url.origin !== location.origin || !url.pathname.startsWith(base2); 198 | } 199 | let client; 200 | function init(opts) { 201 | client = opts.client; 202 | } 203 | const stores = { 204 | url: notifiable_store({}), 205 | page: notifiable_store({}), 206 | navigating: writable( 207 | /** @type {import('types').Navigation | null} */ 208 | null 209 | ), 210 | updated: create_updated_store() 211 | }; 212 | export { 213 | INDEX_KEY as I, 214 | PRELOAD_PRIORITIES as P, 215 | SCROLL_KEY as S, 216 | SNAPSHOT_KEY as a, 217 | get_link_info as b, 218 | get_router_options as c, 219 | scroll_state as d, 220 | base as e, 221 | find_anchor as f, 222 | get_base_uri as g, 223 | init as h, 224 | is_external_url as i, 225 | set_assets as j, 226 | set_version as k, 227 | client as l, 228 | stores as s 229 | }; 230 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/components/error.svelte-63101f88.js: -------------------------------------------------------------------------------- 1 | import { S as SvelteComponent, i as init, s as safe_not_equal, k as element, q as text, a as space, l as claim_element, m as children, r as claim_text, h as detach, c as claim_space, b as insert_hydration, H as append_hydration, u as set_data, C as noop, I as component_subscribe } from "../chunks/index-0c191f98.js"; 2 | import { s as stores } from "../chunks/singletons-5c8d2b5b.js"; 3 | const getStores = () => { 4 | const stores$1 = stores; 5 | return { 6 | page: { 7 | subscribe: stores$1.page.subscribe 8 | }, 9 | navigating: { 10 | subscribe: stores$1.navigating.subscribe 11 | }, 12 | updated: stores$1.updated 13 | }; 14 | }; 15 | const page = { 16 | /** @param {(value: any) => void} fn */ 17 | subscribe(fn) { 18 | const store = getStores().page; 19 | return store.subscribe(fn); 20 | } 21 | }; 22 | function create_fragment(ctx) { 23 | var _a; 24 | let h1; 25 | let t0_value = ( 26 | /*$page*/ 27 | ctx[0].status + "" 28 | ); 29 | let t0; 30 | let t1; 31 | let p; 32 | let t2_value = ( 33 | /*$page*/ 34 | ((_a = ctx[0].error) == null ? void 0 : _a.message) + "" 35 | ); 36 | let t2; 37 | return { 38 | c() { 39 | h1 = element("h1"); 40 | t0 = text(t0_value); 41 | t1 = space(); 42 | p = element("p"); 43 | t2 = text(t2_value); 44 | }, 45 | l(nodes) { 46 | h1 = claim_element(nodes, "H1", {}); 47 | var h1_nodes = children(h1); 48 | t0 = claim_text(h1_nodes, t0_value); 49 | h1_nodes.forEach(detach); 50 | t1 = claim_space(nodes); 51 | p = claim_element(nodes, "P", {}); 52 | var p_nodes = children(p); 53 | t2 = claim_text(p_nodes, t2_value); 54 | p_nodes.forEach(detach); 55 | }, 56 | m(target, anchor) { 57 | insert_hydration(target, h1, anchor); 58 | append_hydration(h1, t0); 59 | insert_hydration(target, t1, anchor); 60 | insert_hydration(target, p, anchor); 61 | append_hydration(p, t2); 62 | }, 63 | p(ctx2, [dirty]) { 64 | var _a2; 65 | if (dirty & /*$page*/ 66 | 1 && t0_value !== (t0_value = /*$page*/ 67 | ctx2[0].status + "")) 68 | set_data(t0, t0_value); 69 | if (dirty & /*$page*/ 70 | 1 && t2_value !== (t2_value = /*$page*/ 71 | ((_a2 = ctx2[0].error) == null ? void 0 : _a2.message) + "")) 72 | set_data(t2, t2_value); 73 | }, 74 | i: noop, 75 | o: noop, 76 | d(detaching) { 77 | if (detaching) 78 | detach(h1); 79 | if (detaching) 80 | detach(t1); 81 | if (detaching) 82 | detach(p); 83 | } 84 | }; 85 | } 86 | function instance($$self, $$props, $$invalidate) { 87 | let $page; 88 | component_subscribe($$self, page, ($$value) => $$invalidate(0, $page = $$value)); 89 | return [$page]; 90 | } 91 | let Error$1 = class Error extends SvelteComponent { 92 | constructor(options) { 93 | super(); 94 | init(this, options, instance, create_fragment, safe_not_equal, {}); 95 | } 96 | }; 97 | export { 98 | Error$1 as default 99 | }; 100 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/components/pages/_layout.svelte-ebc491c9.js: -------------------------------------------------------------------------------- 1 | import { S as SvelteComponent, i as init, s as safe_not_equal, D as create_slot, k as element, l as claim_element, m as children, h as detach, n as attr, b as insert_hydration, E as update_slot_base, F as get_all_dirty_from_scope, G as get_slot_changes, f as transition_in, t as transition_out } from "../../chunks/index-0c191f98.js"; 2 | const app = ""; 3 | function create_fragment(ctx) { 4 | let div; 5 | let current; 6 | const default_slot_template = ( 7 | /*#slots*/ 8 | ctx[1].default 9 | ); 10 | const default_slot = create_slot( 11 | default_slot_template, 12 | ctx, 13 | /*$$scope*/ 14 | ctx[0], 15 | null 16 | ); 17 | return { 18 | c() { 19 | div = element("div"); 20 | if (default_slot) 21 | default_slot.c(); 22 | this.h(); 23 | }, 24 | l(nodes) { 25 | div = claim_element(nodes, "DIV", { class: true }); 26 | var div_nodes = children(div); 27 | if (default_slot) 28 | default_slot.l(div_nodes); 29 | div_nodes.forEach(detach); 30 | this.h(); 31 | }, 32 | h() { 33 | attr(div, "class", "grid h-screen place-items-center"); 34 | }, 35 | m(target, anchor) { 36 | insert_hydration(target, div, anchor); 37 | if (default_slot) { 38 | default_slot.m(div, null); 39 | } 40 | current = true; 41 | }, 42 | p(ctx2, [dirty]) { 43 | if (default_slot) { 44 | if (default_slot.p && (!current || dirty & /*$$scope*/ 45 | 1)) { 46 | update_slot_base( 47 | default_slot, 48 | default_slot_template, 49 | ctx2, 50 | /*$$scope*/ 51 | ctx2[0], 52 | !current ? get_all_dirty_from_scope( 53 | /*$$scope*/ 54 | ctx2[0] 55 | ) : get_slot_changes( 56 | default_slot_template, 57 | /*$$scope*/ 58 | ctx2[0], 59 | dirty, 60 | null 61 | ), 62 | null 63 | ); 64 | } 65 | } 66 | }, 67 | i(local) { 68 | if (current) 69 | return; 70 | transition_in(default_slot, local); 71 | current = true; 72 | }, 73 | o(local) { 74 | transition_out(default_slot, local); 75 | current = false; 76 | }, 77 | d(detaching) { 78 | if (detaching) 79 | detach(div); 80 | if (default_slot) 81 | default_slot.d(detaching); 82 | } 83 | }; 84 | } 85 | function instance($$self, $$props, $$invalidate) { 86 | let { $$slots: slots = {}, $$scope } = $$props; 87 | $$self.$$set = ($$props2) => { 88 | if ("$$scope" in $$props2) 89 | $$invalidate(0, $$scope = $$props2.$$scope); 90 | }; 91 | return [$$scope, slots]; 92 | } 93 | class Layout extends SvelteComponent { 94 | constructor(options) { 95 | super(); 96 | init(this, options, instance, create_fragment, safe_not_equal, {}); 97 | } 98 | } 99 | export { 100 | Layout as default 101 | }; 102 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/components/pages/_page.svelte-a3e10c76.js: -------------------------------------------------------------------------------- 1 | import { S as SvelteComponent, i as init, s as safe_not_equal, k as element, q as text, a as space, J as svg_element, l as claim_element, m as children, r as claim_text, h as detach, c as claim_space, K as claim_svg_element, n as attr, b as insert_hydration, H as append_hydration, L as action_destroyer, M as listen, C as noop, N as run_all, u as set_data } from "../../chunks/index-0c191f98.js"; 2 | import { p as parse } from "../../chunks/parse-a9b5aeea.js"; 3 | import { l as client } from "../../chunks/singletons-5c8d2b5b.js"; 4 | client.disable_scroll_handling; 5 | client.goto; 6 | client.invalidate; 7 | const invalidateAll = client.invalidateAll; 8 | client.preload_data; 9 | client.preload_code; 10 | client.before_navigate; 11 | client.after_navigate; 12 | const applyAction = client.apply_action; 13 | function deserialize(result) { 14 | const parsed = JSON.parse(result); 15 | if (parsed.data) { 16 | parsed.data = parse(parsed.data); 17 | } 18 | return parsed; 19 | } 20 | function enhance(form, submit = () => { 21 | }) { 22 | const fallback_callback = async ({ action, result, reset }) => { 23 | if (result.type === "success") { 24 | if (reset !== false) { 25 | HTMLFormElement.prototype.reset.call(form); 26 | } 27 | await invalidateAll(); 28 | } 29 | if (location.origin + location.pathname === action.origin + action.pathname || result.type === "redirect" || result.type === "error") { 30 | applyAction(result); 31 | } 32 | }; 33 | async function handle_submit(event) { 34 | var _a, _b, _c; 35 | event.preventDefault(); 36 | const action = new URL( 37 | // We can't do submitter.formAction directly because that property is always set 38 | // We do cloneNode for avoid DOM clobbering - https://github.com/sveltejs/kit/issues/7593 39 | ((_a = event.submitter) == null ? void 0 : _a.hasAttribute("formaction")) ? ( 40 | /** @type {HTMLButtonElement | HTMLInputElement} */ 41 | event.submitter.formAction 42 | ) : ( 43 | /** @type {HTMLFormElement} */ 44 | HTMLFormElement.prototype.cloneNode.call(form).action 45 | ) 46 | ); 47 | const data = new FormData(form); 48 | const submitter_name = (_b = event.submitter) == null ? void 0 : _b.getAttribute("name"); 49 | if (submitter_name) { 50 | data.append(submitter_name, ((_c = event.submitter) == null ? void 0 : _c.getAttribute("value")) ?? ""); 51 | } 52 | const controller = new AbortController(); 53 | let cancelled = false; 54 | const cancel = () => cancelled = true; 55 | const callback = await submit({ 56 | action, 57 | cancel, 58 | controller, 59 | data, 60 | form 61 | }) ?? fallback_callback; 62 | if (cancelled) 63 | return; 64 | let result; 65 | try { 66 | const response = await fetch(action, { 67 | method: "POST", 68 | headers: { 69 | accept: "application/json", 70 | "x-sveltekit-action": "true" 71 | }, 72 | cache: "no-store", 73 | body: data, 74 | signal: controller.signal 75 | }); 76 | result = deserialize(await response.text()); 77 | if (result.type === "error") 78 | result.status = response.status; 79 | } catch (error) { 80 | if ( 81 | /** @type {any} */ 82 | (error == null ? void 0 : error.name) === "AbortError" 83 | ) 84 | return; 85 | result = { type: "error", error }; 86 | } 87 | callback({ 88 | action, 89 | data, 90 | form, 91 | update: (opts) => fallback_callback({ action, result, reset: opts == null ? void 0 : opts.reset }), 92 | // @ts-expect-error generic constraints stuff we don't care about 93 | result 94 | }); 95 | } 96 | HTMLFormElement.prototype.addEventListener.call(form, "submit", handle_submit); 97 | return { 98 | destroy() { 99 | HTMLFormElement.prototype.removeEventListener.call(form, "submit", handle_submit); 100 | } 101 | }; 102 | } 103 | function create_if_block_2(ctx) { 104 | let span; 105 | let t; 106 | return { 107 | c() { 108 | span = element("span"); 109 | t = text( 110 | /*error*/ 111 | ctx[1] 112 | ); 113 | this.h(); 114 | }, 115 | l(nodes) { 116 | span = claim_element(nodes, "SPAN", { class: true }); 117 | var span_nodes = children(span); 118 | t = claim_text( 119 | span_nodes, 120 | /*error*/ 121 | ctx[1] 122 | ); 123 | span_nodes.forEach(detach); 124 | this.h(); 125 | }, 126 | h() { 127 | attr(span, "class", "my-auto text-red-500"); 128 | }, 129 | m(target, anchor) { 130 | insert_hydration(target, span, anchor); 131 | append_hydration(span, t); 132 | }, 133 | p(ctx2, dirty) { 134 | if (dirty & /*error*/ 135 | 2) 136 | set_data( 137 | t, 138 | /*error*/ 139 | ctx2[1] 140 | ); 141 | }, 142 | d(detaching) { 143 | if (detaching) 144 | detach(span); 145 | } 146 | }; 147 | } 148 | function create_if_block_1(ctx) { 149 | let svg; 150 | let circle; 151 | let path; 152 | return { 153 | c() { 154 | svg = svg_element("svg"); 155 | circle = svg_element("circle"); 156 | path = svg_element("path"); 157 | this.h(); 158 | }, 159 | l(nodes) { 160 | svg = claim_svg_element(nodes, "svg", { 161 | class: true, 162 | xmlns: true, 163 | fill: true, 164 | viewBox: true 165 | }); 166 | var svg_nodes = children(svg); 167 | circle = claim_svg_element(svg_nodes, "circle", { 168 | class: true, 169 | cx: true, 170 | cy: true, 171 | r: true, 172 | stroke: true, 173 | "stroke-width": true 174 | }); 175 | children(circle).forEach(detach); 176 | path = claim_svg_element(svg_nodes, "path", { class: true, fill: true, d: true }); 177 | children(path).forEach(detach); 178 | svg_nodes.forEach(detach); 179 | this.h(); 180 | }, 181 | h() { 182 | attr(circle, "class", "opacity-25"); 183 | attr(circle, "cx", "12"); 184 | attr(circle, "cy", "12"); 185 | attr(circle, "r", "10"); 186 | attr(circle, "stroke", "currentColor"); 187 | attr(circle, "stroke-width", "4"); 188 | attr(path, "class", "opacity-75"); 189 | attr(path, "fill", "currentColor"); 190 | attr(path, "d", "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"); 191 | attr(svg, "class", "my-auto animate-spin h-5 w-5 text-black"); 192 | attr(svg, "xmlns", "http://www.w3.org/2000/svg"); 193 | attr(svg, "fill", "none"); 194 | attr(svg, "viewBox", "0 0 24 24"); 195 | }, 196 | m(target, anchor) { 197 | insert_hydration(target, svg, anchor); 198 | append_hydration(svg, circle); 199 | append_hydration(svg, path); 200 | }, 201 | d(detaching) { 202 | if (detaching) 203 | detach(svg); 204 | } 205 | }; 206 | } 207 | function create_if_block(ctx) { 208 | let div; 209 | let t0; 210 | let article; 211 | let t1; 212 | let t2; 213 | return { 214 | c() { 215 | div = element("div"); 216 | t0 = space(); 217 | article = element("article"); 218 | t1 = text("Summary: "); 219 | t2 = text( 220 | /*summary*/ 221 | ctx[2] 222 | ); 223 | this.h(); 224 | }, 225 | l(nodes) { 226 | div = claim_element(nodes, "DIV", { class: true }); 227 | children(div).forEach(detach); 228 | t0 = claim_space(nodes); 229 | article = claim_element(nodes, "ARTICLE", { class: true }); 230 | var article_nodes = children(article); 231 | t1 = claim_text(article_nodes, "Summary: "); 232 | t2 = claim_text( 233 | article_nodes, 234 | /*summary*/ 235 | ctx[2] 236 | ); 237 | article_nodes.forEach(detach); 238 | this.h(); 239 | }, 240 | h() { 241 | attr(div, "class", "h-10"); 242 | attr(article, "class", "prose"); 243 | }, 244 | m(target, anchor) { 245 | insert_hydration(target, div, anchor); 246 | insert_hydration(target, t0, anchor); 247 | insert_hydration(target, article, anchor); 248 | append_hydration(article, t1); 249 | append_hydration(article, t2); 250 | }, 251 | p(ctx2, dirty) { 252 | if (dirty & /*summary*/ 253 | 4) 254 | set_data( 255 | t2, 256 | /*summary*/ 257 | ctx2[2] 258 | ); 259 | }, 260 | d(detaching) { 261 | if (detaching) 262 | detach(div); 263 | if (detaching) 264 | detach(t0); 265 | if (detaching) 266 | detach(article); 267 | } 268 | }; 269 | } 270 | function create_fragment(ctx) { 271 | let main; 272 | let h1; 273 | let t0; 274 | let t1; 275 | let p0; 276 | let t2; 277 | let a; 278 | let t3; 279 | let t4; 280 | let t5; 281 | let form; 282 | let label; 283 | let div; 284 | let svg; 285 | let path; 286 | let t6; 287 | let p1; 288 | let span0; 289 | let t7; 290 | let t8; 291 | let t9; 292 | let p2; 293 | let t10; 294 | let t11; 295 | let input; 296 | let t12; 297 | let span1; 298 | let t13; 299 | let t14; 300 | let button; 301 | let t15; 302 | let t16; 303 | let mounted; 304 | let dispose; 305 | let if_block0 = ( 306 | /*error*/ 307 | ctx[1] && create_if_block_2(ctx) 308 | ); 309 | let if_block1 = ( 310 | /*loading*/ 311 | ctx[0] && create_if_block_1() 312 | ); 313 | let if_block2 = ( 314 | /*summary*/ 315 | ctx[2] && create_if_block(ctx) 316 | ); 317 | return { 318 | c() { 319 | main = element("main"); 320 | h1 = element("h1"); 321 | t0 = text("PDF Summarizer"); 322 | t1 = space(); 323 | p0 = element("p"); 324 | t2 = text("Example made wiith "); 325 | a = element("a"); 326 | t3 = text("sveltekit-modal"); 327 | t4 = text("."); 328 | t5 = space(); 329 | form = element("form"); 330 | label = element("label"); 331 | div = element("div"); 332 | svg = svg_element("svg"); 333 | path = svg_element("path"); 334 | t6 = space(); 335 | p1 = element("p"); 336 | span0 = element("span"); 337 | t7 = text("Click to upload"); 338 | t8 = text(" or drag and drop"); 339 | t9 = space(); 340 | p2 = element("p"); 341 | t10 = text("PDF"); 342 | t11 = space(); 343 | input = element("input"); 344 | t12 = space(); 345 | span1 = element("span"); 346 | if (if_block0) 347 | if_block0.c(); 348 | t13 = space(); 349 | if (if_block1) 350 | if_block1.c(); 351 | t14 = space(); 352 | button = element("button"); 353 | t15 = text("Summarize!"); 354 | t16 = space(); 355 | if (if_block2) 356 | if_block2.c(); 357 | this.h(); 358 | }, 359 | l(nodes) { 360 | main = claim_element(nodes, "MAIN", { class: true }); 361 | var main_nodes = children(main); 362 | h1 = claim_element(main_nodes, "H1", { class: true }); 363 | var h1_nodes = children(h1); 364 | t0 = claim_text(h1_nodes, "PDF Summarizer"); 365 | h1_nodes.forEach(detach); 366 | t1 = claim_space(main_nodes); 367 | p0 = claim_element(main_nodes, "P", {}); 368 | var p0_nodes = children(p0); 369 | t2 = claim_text(p0_nodes, "Example made wiith "); 370 | a = claim_element(p0_nodes, "A", { 371 | target: true, 372 | rel: true, 373 | class: true, 374 | href: true 375 | }); 376 | var a_nodes = children(a); 377 | t3 = claim_text(a_nodes, "sveltekit-modal"); 378 | a_nodes.forEach(detach); 379 | t4 = claim_text(p0_nodes, "."); 380 | p0_nodes.forEach(detach); 381 | t5 = claim_space(main_nodes); 382 | form = claim_element(main_nodes, "FORM", { method: true, action: true, class: true }); 383 | var form_nodes = children(form); 384 | label = claim_element(form_nodes, "LABEL", { class: true }); 385 | var label_nodes = children(label); 386 | div = claim_element(label_nodes, "DIV", { class: true }); 387 | var div_nodes = children(div); 388 | svg = claim_svg_element(div_nodes, "svg", { 389 | xmlns: true, 390 | fill: true, 391 | viewBox: true, 392 | "stroke-width": true, 393 | stroke: true, 394 | class: true 395 | }); 396 | var svg_nodes = children(svg); 397 | path = claim_svg_element(svg_nodes, "path", { 398 | "stroke-linecap": true, 399 | "stroke-linejoin": true, 400 | d: true 401 | }); 402 | children(path).forEach(detach); 403 | svg_nodes.forEach(detach); 404 | t6 = claim_space(div_nodes); 405 | p1 = claim_element(div_nodes, "P", { class: true }); 406 | var p1_nodes = children(p1); 407 | span0 = claim_element(p1_nodes, "SPAN", { class: true }); 408 | var span0_nodes = children(span0); 409 | t7 = claim_text(span0_nodes, "Click to upload"); 410 | span0_nodes.forEach(detach); 411 | t8 = claim_text(p1_nodes, " or drag and drop"); 412 | p1_nodes.forEach(detach); 413 | t9 = claim_space(div_nodes); 414 | p2 = claim_element(div_nodes, "P", { class: true }); 415 | var p2_nodes = children(p2); 416 | t10 = claim_text(p2_nodes, "PDF"); 417 | p2_nodes.forEach(detach); 418 | div_nodes.forEach(detach); 419 | t11 = claim_space(label_nodes); 420 | input = claim_element(label_nodes, "INPUT", { 421 | type: true, 422 | name: true, 423 | accept: true, 424 | class: true 425 | }); 426 | label_nodes.forEach(detach); 427 | t12 = claim_space(form_nodes); 428 | span1 = claim_element(form_nodes, "SPAN", { class: true }); 429 | var span1_nodes = children(span1); 430 | if (if_block0) 431 | if_block0.l(span1_nodes); 432 | t13 = claim_space(span1_nodes); 433 | if (if_block1) 434 | if_block1.l(span1_nodes); 435 | t14 = claim_space(span1_nodes); 436 | button = claim_element(span1_nodes, "BUTTON", { type: true, class: true }); 437 | var button_nodes = children(button); 438 | t15 = claim_text(button_nodes, "Summarize!"); 439 | button_nodes.forEach(detach); 440 | span1_nodes.forEach(detach); 441 | t16 = claim_space(form_nodes); 442 | if (if_block2) 443 | if_block2.l(form_nodes); 444 | form_nodes.forEach(detach); 445 | main_nodes.forEach(detach); 446 | this.h(); 447 | }, 448 | h() { 449 | attr(h1, "class", "text-3xl font-bold underline"); 450 | attr(a, "target", "_blank"); 451 | attr(a, "rel", "noopener noreferrer"); 452 | attr(a, "class", "underline"); 453 | attr(a, "href", "https://github.com/semicognitive/sveltekit-modal/tree/main"); 454 | attr(path, "stroke-linecap", "round"); 455 | attr(path, "stroke-linejoin", "round"); 456 | attr(path, "d", "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"); 457 | attr(svg, "xmlns", "http://www.w3.org/2000/svg"); 458 | attr(svg, "fill", "none"); 459 | attr(svg, "viewBox", "0 0 24 24"); 460 | attr(svg, "stroke-width", "1.5"); 461 | attr(svg, "stroke", "currentColor"); 462 | attr(svg, "class", "w-10 h-10 mb-3 text-neutral-400"); 463 | attr(span0, "class", "font-semibold"); 464 | attr(p1, "class", "mb-2 text-sm text-neutral-500"); 465 | attr(p2, "class", "text-xs text-neutral-500"); 466 | attr(div, "class", "flex flex-col items-center justify-center py-6"); 467 | attr(input, "type", "file"); 468 | attr(input, "name", "document"); 469 | attr(input, "accept", "application/pdf"); 470 | attr(input, "class", "hidden"); 471 | attr(label, "class", "flex flex-col items-center justify-center w-full h-64 border-2 border-neutral-300 border-dashed rounded-lg cursor-pointer bg-neutral-50"); 472 | attr(button, "type", "submit"); 473 | attr(button, "class", "inline-flex items-center rounded-md border border-transparent bg-neutral-800 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-black focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2"); 474 | attr(span1, "class", "flex flex-row space-x-4 ml-auto"); 475 | attr(form, "method", "POST"); 476 | attr(form, "action", "/api/ask"); 477 | attr(form, "class", "flex flex-col space-y-2 md:min-w-[28rem] lg:min-w-[32rem] xl:min-w-[36rem] max-w-6xl"); 478 | attr(main, "class", "flex flex-col space-y-2"); 479 | }, 480 | m(target, anchor) { 481 | insert_hydration(target, main, anchor); 482 | append_hydration(main, h1); 483 | append_hydration(h1, t0); 484 | append_hydration(main, t1); 485 | append_hydration(main, p0); 486 | append_hydration(p0, t2); 487 | append_hydration(p0, a); 488 | append_hydration(a, t3); 489 | append_hydration(p0, t4); 490 | append_hydration(main, t5); 491 | append_hydration(main, form); 492 | append_hydration(form, label); 493 | append_hydration(label, div); 494 | append_hydration(div, svg); 495 | append_hydration(svg, path); 496 | append_hydration(div, t6); 497 | append_hydration(div, p1); 498 | append_hydration(p1, span0); 499 | append_hydration(span0, t7); 500 | append_hydration(p1, t8); 501 | append_hydration(div, t9); 502 | append_hydration(div, p2); 503 | append_hydration(p2, t10); 504 | append_hydration(label, t11); 505 | append_hydration(label, input); 506 | append_hydration(form, t12); 507 | append_hydration(form, span1); 508 | if (if_block0) 509 | if_block0.m(span1, null); 510 | append_hydration(span1, t13); 511 | if (if_block1) 512 | if_block1.m(span1, null); 513 | append_hydration(span1, t14); 514 | append_hydration(span1, button); 515 | append_hydration(button, t15); 516 | append_hydration(form, t16); 517 | if (if_block2) 518 | if_block2.m(form, null); 519 | if (!mounted) { 520 | dispose = [ 521 | action_destroyer(enhance.call( 522 | null, 523 | form, 524 | /*api_ask*/ 525 | ctx[3] 526 | )), 527 | listen( 528 | form, 529 | "change", 530 | /*change_handler*/ 531 | ctx[4] 532 | ) 533 | ]; 534 | mounted = true; 535 | } 536 | }, 537 | p(ctx2, [dirty]) { 538 | if ( 539 | /*error*/ 540 | ctx2[1] 541 | ) { 542 | if (if_block0) { 543 | if_block0.p(ctx2, dirty); 544 | } else { 545 | if_block0 = create_if_block_2(ctx2); 546 | if_block0.c(); 547 | if_block0.m(span1, t13); 548 | } 549 | } else if (if_block0) { 550 | if_block0.d(1); 551 | if_block0 = null; 552 | } 553 | if ( 554 | /*loading*/ 555 | ctx2[0] 556 | ) { 557 | if (if_block1) 558 | ; 559 | else { 560 | if_block1 = create_if_block_1(); 561 | if_block1.c(); 562 | if_block1.m(span1, t14); 563 | } 564 | } else if (if_block1) { 565 | if_block1.d(1); 566 | if_block1 = null; 567 | } 568 | if ( 569 | /*summary*/ 570 | ctx2[2] 571 | ) { 572 | if (if_block2) { 573 | if_block2.p(ctx2, dirty); 574 | } else { 575 | if_block2 = create_if_block(ctx2); 576 | if_block2.c(); 577 | if_block2.m(form, null); 578 | } 579 | } else if (if_block2) { 580 | if_block2.d(1); 581 | if_block2 = null; 582 | } 583 | }, 584 | i: noop, 585 | o: noop, 586 | d(detaching) { 587 | if (detaching) 588 | detach(main); 589 | if (if_block0) 590 | if_block0.d(); 591 | if (if_block1) 592 | if_block1.d(); 593 | if (if_block2) 594 | if_block2.d(); 595 | mounted = false; 596 | run_all(dispose); 597 | } 598 | }; 599 | } 600 | function instance($$self, $$props, $$invalidate) { 601 | let loading = false; 602 | let error; 603 | let summary; 604 | function api_ask() { 605 | $$invalidate(0, loading = true); 606 | $$invalidate(1, error = void 0); 607 | $$invalidate(2, summary = void 0); 608 | return ({ result }) => { 609 | $$invalidate(0, loading = false); 610 | $$invalidate(1, error = result.error); 611 | $$invalidate(2, summary = result.summary); 612 | }; 613 | } 614 | const change_handler = () => ($$invalidate(1, error = void 0), $$invalidate(2, summary = void 0)); 615 | return [loading, error, summary, api_ask, change_handler]; 616 | } 617 | class Page extends SvelteComponent { 618 | constructor(options) { 619 | super(); 620 | init(this, options, instance, create_fragment, safe_not_equal, {}); 621 | } 622 | } 623 | export { 624 | Page as default 625 | }; 626 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/immutable/start-d54095ea.js: -------------------------------------------------------------------------------- 1 | import { S as SvelteComponent, i as init, s as safe_not_equal, a as space, e as empty, c as claim_space, b as insert_hydration, g as group_outros, t as transition_out, d as check_outros, f as transition_in, h as detach, j as afterUpdate, o as onMount, k as element, l as claim_element, m as children, n as attr, p as set_style, q as text, r as claim_text, u as set_data, v as binding_callbacks, w as construct_svelte_component, x as create_component, y as claim_component, z as mount_component, A as destroy_component, B as tick } from "./chunks/index-0c191f98.js"; 2 | import { S as SCROLL_KEY, a as SNAPSHOT_KEY, I as INDEX_KEY, g as get_base_uri, f as find_anchor, b as get_link_info, c as get_router_options, s as stores, i as is_external_url, d as scroll_state, e as base, P as PRELOAD_PRIORITIES, h as init$1, j as set_assets, k as set_version } from "./chunks/singletons-5c8d2b5b.js"; 3 | import { u as unflatten } from "./chunks/parse-a9b5aeea.js"; 4 | function normalize_path(path, trailing_slash) { 5 | if (path === "/" || trailing_slash === "ignore") 6 | return path; 7 | if (trailing_slash === "never") { 8 | return path.endsWith("/") ? path.slice(0, -1) : path; 9 | } else if (trailing_slash === "always" && !path.endsWith("/")) { 10 | return path + "/"; 11 | } 12 | return path; 13 | } 14 | function decode_pathname(pathname) { 15 | return pathname.split("%25").map(decodeURI).join("%25"); 16 | } 17 | function decode_params(params) { 18 | for (const key in params) { 19 | params[key] = decodeURIComponent(params[key]); 20 | } 21 | return params; 22 | } 23 | const tracked_url_properties = ["href", "pathname", "search", "searchParams", "toString", "toJSON"]; 24 | function make_trackable(url, callback) { 25 | const tracked = new URL(url); 26 | for (const property of tracked_url_properties) { 27 | let value = tracked[property]; 28 | Object.defineProperty(tracked, property, { 29 | get() { 30 | callback(); 31 | return value; 32 | }, 33 | enumerable: true, 34 | configurable: true 35 | }); 36 | } 37 | disable_hash(tracked); 38 | return tracked; 39 | } 40 | function disable_hash(url) { 41 | Object.defineProperty(url, "hash", { 42 | get() { 43 | throw new Error( 44 | "Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead" 45 | ); 46 | } 47 | }); 48 | } 49 | const DATA_SUFFIX = "/__data.json"; 50 | function add_data_suffix(pathname) { 51 | return pathname.replace(/\/$/, "") + DATA_SUFFIX; 52 | } 53 | function get(key) { 54 | try { 55 | return JSON.parse(sessionStorage[key]); 56 | } catch { 57 | } 58 | } 59 | function set(key, value) { 60 | const json = JSON.stringify(value); 61 | try { 62 | sessionStorage[key] = json; 63 | } catch { 64 | } 65 | } 66 | function hash(...values) { 67 | let hash2 = 5381; 68 | for (const value of values) { 69 | if (typeof value === "string") { 70 | let i = value.length; 71 | while (i) 72 | hash2 = hash2 * 33 ^ value.charCodeAt(--i); 73 | } else if (ArrayBuffer.isView(value)) { 74 | const buffer = new Uint8Array(value.buffer, value.byteOffset, value.byteLength); 75 | let i = buffer.length; 76 | while (i) 77 | hash2 = hash2 * 33 ^ buffer[--i]; 78 | } else { 79 | throw new TypeError("value must be a string or TypedArray"); 80 | } 81 | } 82 | return (hash2 >>> 0).toString(36); 83 | } 84 | const native_fetch = window.fetch; 85 | { 86 | window.fetch = (input, init2) => { 87 | const method = input instanceof Request ? input.method : (init2 == null ? void 0 : init2.method) || "GET"; 88 | if (method !== "GET") { 89 | cache.delete(build_selector(input)); 90 | } 91 | return native_fetch(input, init2); 92 | }; 93 | } 94 | const cache = /* @__PURE__ */ new Map(); 95 | function initial_fetch(resource, opts) { 96 | const selector = build_selector(resource, opts); 97 | const script = document.querySelector(selector); 98 | if (script == null ? void 0 : script.textContent) { 99 | const { body, ...init2 } = JSON.parse(script.textContent); 100 | const ttl = script.getAttribute("data-ttl"); 101 | if (ttl) 102 | cache.set(selector, { body, init: init2, ttl: 1e3 * Number(ttl) }); 103 | return Promise.resolve(new Response(body, init2)); 104 | } 105 | return native_fetch(resource, opts); 106 | } 107 | function subsequent_fetch(resource, resolved, opts) { 108 | if (cache.size > 0) { 109 | const selector = build_selector(resource, opts); 110 | const cached = cache.get(selector); 111 | if (cached) { 112 | if (performance.now() < cached.ttl && ["default", "force-cache", "only-if-cached", void 0].includes(opts == null ? void 0 : opts.cache)) { 113 | return new Response(cached.body, cached.init); 114 | } 115 | cache.delete(selector); 116 | } 117 | } 118 | return native_fetch(resolved, opts); 119 | } 120 | function build_selector(resource, opts) { 121 | const url = JSON.stringify(resource instanceof Request ? resource.url : resource); 122 | let selector = `script[data-sveltekit-fetched][data-url=${url}]`; 123 | if ((opts == null ? void 0 : opts.headers) || (opts == null ? void 0 : opts.body)) { 124 | const values = []; 125 | if (opts.headers) { 126 | values.push([...new Headers(opts.headers)].join(",")); 127 | } 128 | if (opts.body && (typeof opts.body === "string" || ArrayBuffer.isView(opts.body))) { 129 | values.push(opts.body); 130 | } 131 | selector += `[data-hash="${hash(...values)}"]`; 132 | } 133 | return selector; 134 | } 135 | const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/; 136 | function parse_route_id(id) { 137 | const params = []; 138 | const pattern = id === "/" ? /^\/$/ : new RegExp( 139 | `^${get_route_segments(id).map((segment) => { 140 | const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment); 141 | if (rest_match) { 142 | params.push({ 143 | name: rest_match[1], 144 | matcher: rest_match[2], 145 | optional: false, 146 | rest: true, 147 | chained: true 148 | }); 149 | return "(?:/(.*))?"; 150 | } 151 | const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment); 152 | if (optional_match) { 153 | params.push({ 154 | name: optional_match[1], 155 | matcher: optional_match[2], 156 | optional: true, 157 | rest: false, 158 | chained: true 159 | }); 160 | return "(?:/([^/]+))?"; 161 | } 162 | if (!segment) { 163 | return; 164 | } 165 | const parts = segment.split(/\[(.+?)\](?!\])/); 166 | const result = parts.map((content, i) => { 167 | if (i % 2) { 168 | if (content.startsWith("x+")) { 169 | return escape(String.fromCharCode(parseInt(content.slice(2), 16))); 170 | } 171 | if (content.startsWith("u+")) { 172 | return escape( 173 | String.fromCharCode( 174 | ...content.slice(2).split("-").map((code) => parseInt(code, 16)) 175 | ) 176 | ); 177 | } 178 | const match = param_pattern.exec(content); 179 | if (!match) { 180 | throw new Error( 181 | `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.` 182 | ); 183 | } 184 | const [, is_optional, is_rest, name, matcher] = match; 185 | params.push({ 186 | name, 187 | matcher, 188 | optional: !!is_optional, 189 | rest: !!is_rest, 190 | chained: is_rest ? i === 1 && parts[0] === "" : false 191 | }); 192 | return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)"; 193 | } 194 | return escape(content); 195 | }).join(""); 196 | return "/" + result; 197 | }).join("")}/?$` 198 | ); 199 | return { pattern, params }; 200 | } 201 | function affects_path(segment) { 202 | return !/^\([^)]+\)$/.test(segment); 203 | } 204 | function get_route_segments(route) { 205 | return route.slice(1).split("/").filter(affects_path); 206 | } 207 | function exec(match, params, matchers2) { 208 | const result = {}; 209 | const values = match.slice(1); 210 | let buffered = 0; 211 | for (let i = 0; i < params.length; i += 1) { 212 | const param = params[i]; 213 | const value = values[i - buffered]; 214 | if (param.chained && param.rest && buffered) { 215 | result[param.name] = values.slice(i - buffered, i + 1).filter((s) => s).join("/"); 216 | buffered = 0; 217 | continue; 218 | } 219 | if (value === void 0) { 220 | if (param.rest) 221 | result[param.name] = ""; 222 | continue; 223 | } 224 | if (!param.matcher || matchers2[param.matcher](value)) { 225 | result[param.name] = value; 226 | continue; 227 | } 228 | if (param.optional && param.chained) { 229 | buffered++; 230 | continue; 231 | } 232 | return; 233 | } 234 | if (buffered) 235 | return; 236 | return result; 237 | } 238 | function escape(str) { 239 | return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&"); 240 | } 241 | function parse(nodes2, server_loads2, dictionary2, matchers2) { 242 | const layouts_with_server_load = new Set(server_loads2); 243 | return Object.entries(dictionary2).map(([id, [leaf, layouts, errors]]) => { 244 | const { pattern, params } = parse_route_id(id); 245 | const route = { 246 | id, 247 | /** @param {string} path */ 248 | exec: (path) => { 249 | const match = pattern.exec(path); 250 | if (match) 251 | return exec(match, params, matchers2); 252 | }, 253 | errors: [1, ...errors || []].map((n) => nodes2[n]), 254 | layouts: [0, ...layouts || []].map(create_layout_loader), 255 | leaf: create_leaf_loader(leaf) 256 | }; 257 | route.errors.length = route.layouts.length = Math.max( 258 | route.errors.length, 259 | route.layouts.length 260 | ); 261 | return route; 262 | }); 263 | function create_leaf_loader(id) { 264 | const uses_server_data = id < 0; 265 | if (uses_server_data) 266 | id = ~id; 267 | return [uses_server_data, nodes2[id]]; 268 | } 269 | function create_layout_loader(id) { 270 | return id === void 0 ? id : [layouts_with_server_load.has(id), nodes2[id]]; 271 | } 272 | } 273 | function create_else_block(ctx) { 274 | let switch_instance; 275 | let switch_instance_anchor; 276 | let current; 277 | var switch_value = ( 278 | /*constructors*/ 279 | ctx[1][0] 280 | ); 281 | function switch_props(ctx2) { 282 | let switch_instance_props = { 283 | data: ( 284 | /*data_0*/ 285 | ctx2[3] 286 | ), 287 | form: ( 288 | /*form*/ 289 | ctx2[2] 290 | ) 291 | }; 292 | return { props: switch_instance_props }; 293 | } 294 | if (switch_value) { 295 | switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); 296 | ctx[12](switch_instance); 297 | } 298 | return { 299 | c() { 300 | if (switch_instance) 301 | create_component(switch_instance.$$.fragment); 302 | switch_instance_anchor = empty(); 303 | }, 304 | l(nodes2) { 305 | if (switch_instance) 306 | claim_component(switch_instance.$$.fragment, nodes2); 307 | switch_instance_anchor = empty(); 308 | }, 309 | m(target, anchor) { 310 | if (switch_instance) 311 | mount_component(switch_instance, target, anchor); 312 | insert_hydration(target, switch_instance_anchor, anchor); 313 | current = true; 314 | }, 315 | p(ctx2, dirty) { 316 | const switch_instance_changes = {}; 317 | if (dirty & /*data_0*/ 318 | 8) 319 | switch_instance_changes.data = /*data_0*/ 320 | ctx2[3]; 321 | if (dirty & /*form*/ 322 | 4) 323 | switch_instance_changes.form = /*form*/ 324 | ctx2[2]; 325 | if (switch_value !== (switch_value = /*constructors*/ 326 | ctx2[1][0])) { 327 | if (switch_instance) { 328 | group_outros(); 329 | const old_component = switch_instance; 330 | transition_out(old_component.$$.fragment, 1, 0, () => { 331 | destroy_component(old_component, 1); 332 | }); 333 | check_outros(); 334 | } 335 | if (switch_value) { 336 | switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); 337 | ctx2[12](switch_instance); 338 | create_component(switch_instance.$$.fragment); 339 | transition_in(switch_instance.$$.fragment, 1); 340 | mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); 341 | } else { 342 | switch_instance = null; 343 | } 344 | } else if (switch_value) { 345 | switch_instance.$set(switch_instance_changes); 346 | } 347 | }, 348 | i(local) { 349 | if (current) 350 | return; 351 | if (switch_instance) 352 | transition_in(switch_instance.$$.fragment, local); 353 | current = true; 354 | }, 355 | o(local) { 356 | if (switch_instance) 357 | transition_out(switch_instance.$$.fragment, local); 358 | current = false; 359 | }, 360 | d(detaching) { 361 | ctx[12](null); 362 | if (detaching) 363 | detach(switch_instance_anchor); 364 | if (switch_instance) 365 | destroy_component(switch_instance, detaching); 366 | } 367 | }; 368 | } 369 | function create_if_block_2(ctx) { 370 | let switch_instance; 371 | let switch_instance_anchor; 372 | let current; 373 | var switch_value = ( 374 | /*constructors*/ 375 | ctx[1][0] 376 | ); 377 | function switch_props(ctx2) { 378 | let switch_instance_props = { 379 | data: ( 380 | /*data_0*/ 381 | ctx2[3] 382 | ), 383 | $$slots: { default: [create_default_slot] }, 384 | $$scope: { ctx: ctx2 } 385 | }; 386 | return { props: switch_instance_props }; 387 | } 388 | if (switch_value) { 389 | switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); 390 | ctx[11](switch_instance); 391 | } 392 | return { 393 | c() { 394 | if (switch_instance) 395 | create_component(switch_instance.$$.fragment); 396 | switch_instance_anchor = empty(); 397 | }, 398 | l(nodes2) { 399 | if (switch_instance) 400 | claim_component(switch_instance.$$.fragment, nodes2); 401 | switch_instance_anchor = empty(); 402 | }, 403 | m(target, anchor) { 404 | if (switch_instance) 405 | mount_component(switch_instance, target, anchor); 406 | insert_hydration(target, switch_instance_anchor, anchor); 407 | current = true; 408 | }, 409 | p(ctx2, dirty) { 410 | const switch_instance_changes = {}; 411 | if (dirty & /*data_0*/ 412 | 8) 413 | switch_instance_changes.data = /*data_0*/ 414 | ctx2[3]; 415 | if (dirty & /*$$scope, constructors, data_1, form, components*/ 416 | 8215) { 417 | switch_instance_changes.$$scope = { dirty, ctx: ctx2 }; 418 | } 419 | if (switch_value !== (switch_value = /*constructors*/ 420 | ctx2[1][0])) { 421 | if (switch_instance) { 422 | group_outros(); 423 | const old_component = switch_instance; 424 | transition_out(old_component.$$.fragment, 1, 0, () => { 425 | destroy_component(old_component, 1); 426 | }); 427 | check_outros(); 428 | } 429 | if (switch_value) { 430 | switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); 431 | ctx2[11](switch_instance); 432 | create_component(switch_instance.$$.fragment); 433 | transition_in(switch_instance.$$.fragment, 1); 434 | mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); 435 | } else { 436 | switch_instance = null; 437 | } 438 | } else if (switch_value) { 439 | switch_instance.$set(switch_instance_changes); 440 | } 441 | }, 442 | i(local) { 443 | if (current) 444 | return; 445 | if (switch_instance) 446 | transition_in(switch_instance.$$.fragment, local); 447 | current = true; 448 | }, 449 | o(local) { 450 | if (switch_instance) 451 | transition_out(switch_instance.$$.fragment, local); 452 | current = false; 453 | }, 454 | d(detaching) { 455 | ctx[11](null); 456 | if (detaching) 457 | detach(switch_instance_anchor); 458 | if (switch_instance) 459 | destroy_component(switch_instance, detaching); 460 | } 461 | }; 462 | } 463 | function create_default_slot(ctx) { 464 | let switch_instance; 465 | let switch_instance_anchor; 466 | let current; 467 | var switch_value = ( 468 | /*constructors*/ 469 | ctx[1][1] 470 | ); 471 | function switch_props(ctx2) { 472 | let switch_instance_props = { 473 | data: ( 474 | /*data_1*/ 475 | ctx2[4] 476 | ), 477 | form: ( 478 | /*form*/ 479 | ctx2[2] 480 | ) 481 | }; 482 | return { props: switch_instance_props }; 483 | } 484 | if (switch_value) { 485 | switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); 486 | ctx[10](switch_instance); 487 | } 488 | return { 489 | c() { 490 | if (switch_instance) 491 | create_component(switch_instance.$$.fragment); 492 | switch_instance_anchor = empty(); 493 | }, 494 | l(nodes2) { 495 | if (switch_instance) 496 | claim_component(switch_instance.$$.fragment, nodes2); 497 | switch_instance_anchor = empty(); 498 | }, 499 | m(target, anchor) { 500 | if (switch_instance) 501 | mount_component(switch_instance, target, anchor); 502 | insert_hydration(target, switch_instance_anchor, anchor); 503 | current = true; 504 | }, 505 | p(ctx2, dirty) { 506 | const switch_instance_changes = {}; 507 | if (dirty & /*data_1*/ 508 | 16) 509 | switch_instance_changes.data = /*data_1*/ 510 | ctx2[4]; 511 | if (dirty & /*form*/ 512 | 4) 513 | switch_instance_changes.form = /*form*/ 514 | ctx2[2]; 515 | if (switch_value !== (switch_value = /*constructors*/ 516 | ctx2[1][1])) { 517 | if (switch_instance) { 518 | group_outros(); 519 | const old_component = switch_instance; 520 | transition_out(old_component.$$.fragment, 1, 0, () => { 521 | destroy_component(old_component, 1); 522 | }); 523 | check_outros(); 524 | } 525 | if (switch_value) { 526 | switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); 527 | ctx2[10](switch_instance); 528 | create_component(switch_instance.$$.fragment); 529 | transition_in(switch_instance.$$.fragment, 1); 530 | mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); 531 | } else { 532 | switch_instance = null; 533 | } 534 | } else if (switch_value) { 535 | switch_instance.$set(switch_instance_changes); 536 | } 537 | }, 538 | i(local) { 539 | if (current) 540 | return; 541 | if (switch_instance) 542 | transition_in(switch_instance.$$.fragment, local); 543 | current = true; 544 | }, 545 | o(local) { 546 | if (switch_instance) 547 | transition_out(switch_instance.$$.fragment, local); 548 | current = false; 549 | }, 550 | d(detaching) { 551 | ctx[10](null); 552 | if (detaching) 553 | detach(switch_instance_anchor); 554 | if (switch_instance) 555 | destroy_component(switch_instance, detaching); 556 | } 557 | }; 558 | } 559 | function create_if_block(ctx) { 560 | let div; 561 | let if_block = ( 562 | /*navigated*/ 563 | ctx[6] && create_if_block_1(ctx) 564 | ); 565 | return { 566 | c() { 567 | div = element("div"); 568 | if (if_block) 569 | if_block.c(); 570 | this.h(); 571 | }, 572 | l(nodes2) { 573 | div = claim_element(nodes2, "DIV", { 574 | id: true, 575 | "aria-live": true, 576 | "aria-atomic": true, 577 | style: true 578 | }); 579 | var div_nodes = children(div); 580 | if (if_block) 581 | if_block.l(div_nodes); 582 | div_nodes.forEach(detach); 583 | this.h(); 584 | }, 585 | h() { 586 | attr(div, "id", "svelte-announcer"); 587 | attr(div, "aria-live", "assertive"); 588 | attr(div, "aria-atomic", "true"); 589 | set_style(div, "position", "absolute"); 590 | set_style(div, "left", "0"); 591 | set_style(div, "top", "0"); 592 | set_style(div, "clip", "rect(0 0 0 0)"); 593 | set_style(div, "clip-path", "inset(50%)"); 594 | set_style(div, "overflow", "hidden"); 595 | set_style(div, "white-space", "nowrap"); 596 | set_style(div, "width", "1px"); 597 | set_style(div, "height", "1px"); 598 | }, 599 | m(target, anchor) { 600 | insert_hydration(target, div, anchor); 601 | if (if_block) 602 | if_block.m(div, null); 603 | }, 604 | p(ctx2, dirty) { 605 | if ( 606 | /*navigated*/ 607 | ctx2[6] 608 | ) { 609 | if (if_block) { 610 | if_block.p(ctx2, dirty); 611 | } else { 612 | if_block = create_if_block_1(ctx2); 613 | if_block.c(); 614 | if_block.m(div, null); 615 | } 616 | } else if (if_block) { 617 | if_block.d(1); 618 | if_block = null; 619 | } 620 | }, 621 | d(detaching) { 622 | if (detaching) 623 | detach(div); 624 | if (if_block) 625 | if_block.d(); 626 | } 627 | }; 628 | } 629 | function create_if_block_1(ctx) { 630 | let t; 631 | return { 632 | c() { 633 | t = text( 634 | /*title*/ 635 | ctx[7] 636 | ); 637 | }, 638 | l(nodes2) { 639 | t = claim_text( 640 | nodes2, 641 | /*title*/ 642 | ctx[7] 643 | ); 644 | }, 645 | m(target, anchor) { 646 | insert_hydration(target, t, anchor); 647 | }, 648 | p(ctx2, dirty) { 649 | if (dirty & /*title*/ 650 | 128) 651 | set_data( 652 | t, 653 | /*title*/ 654 | ctx2[7] 655 | ); 656 | }, 657 | d(detaching) { 658 | if (detaching) 659 | detach(t); 660 | } 661 | }; 662 | } 663 | function create_fragment(ctx) { 664 | let current_block_type_index; 665 | let if_block0; 666 | let t; 667 | let if_block1_anchor; 668 | let current; 669 | const if_block_creators = [create_if_block_2, create_else_block]; 670 | const if_blocks = []; 671 | function select_block_type(ctx2, dirty) { 672 | if ( 673 | /*constructors*/ 674 | ctx2[1][1] 675 | ) 676 | return 0; 677 | return 1; 678 | } 679 | current_block_type_index = select_block_type(ctx); 680 | if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 681 | let if_block1 = ( 682 | /*mounted*/ 683 | ctx[5] && create_if_block(ctx) 684 | ); 685 | return { 686 | c() { 687 | if_block0.c(); 688 | t = space(); 689 | if (if_block1) 690 | if_block1.c(); 691 | if_block1_anchor = empty(); 692 | }, 693 | l(nodes2) { 694 | if_block0.l(nodes2); 695 | t = claim_space(nodes2); 696 | if (if_block1) 697 | if_block1.l(nodes2); 698 | if_block1_anchor = empty(); 699 | }, 700 | m(target, anchor) { 701 | if_blocks[current_block_type_index].m(target, anchor); 702 | insert_hydration(target, t, anchor); 703 | if (if_block1) 704 | if_block1.m(target, anchor); 705 | insert_hydration(target, if_block1_anchor, anchor); 706 | current = true; 707 | }, 708 | p(ctx2, [dirty]) { 709 | let previous_block_index = current_block_type_index; 710 | current_block_type_index = select_block_type(ctx2); 711 | if (current_block_type_index === previous_block_index) { 712 | if_blocks[current_block_type_index].p(ctx2, dirty); 713 | } else { 714 | group_outros(); 715 | transition_out(if_blocks[previous_block_index], 1, 1, () => { 716 | if_blocks[previous_block_index] = null; 717 | }); 718 | check_outros(); 719 | if_block0 = if_blocks[current_block_type_index]; 720 | if (!if_block0) { 721 | if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); 722 | if_block0.c(); 723 | } else { 724 | if_block0.p(ctx2, dirty); 725 | } 726 | transition_in(if_block0, 1); 727 | if_block0.m(t.parentNode, t); 728 | } 729 | if ( 730 | /*mounted*/ 731 | ctx2[5] 732 | ) { 733 | if (if_block1) { 734 | if_block1.p(ctx2, dirty); 735 | } else { 736 | if_block1 = create_if_block(ctx2); 737 | if_block1.c(); 738 | if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); 739 | } 740 | } else if (if_block1) { 741 | if_block1.d(1); 742 | if_block1 = null; 743 | } 744 | }, 745 | i(local) { 746 | if (current) 747 | return; 748 | transition_in(if_block0); 749 | current = true; 750 | }, 751 | o(local) { 752 | transition_out(if_block0); 753 | current = false; 754 | }, 755 | d(detaching) { 756 | if_blocks[current_block_type_index].d(detaching); 757 | if (detaching) 758 | detach(t); 759 | if (if_block1) 760 | if_block1.d(detaching); 761 | if (detaching) 762 | detach(if_block1_anchor); 763 | } 764 | }; 765 | } 766 | function instance($$self, $$props, $$invalidate) { 767 | let { stores: stores2 } = $$props; 768 | let { page } = $$props; 769 | let { constructors } = $$props; 770 | let { components = [] } = $$props; 771 | let { form } = $$props; 772 | let { data_0 = null } = $$props; 773 | let { data_1 = null } = $$props; 774 | afterUpdate(stores2.page.notify); 775 | let mounted = false; 776 | let navigated = false; 777 | let title = null; 778 | onMount(() => { 779 | const unsubscribe = stores2.page.subscribe(() => { 780 | if (mounted) { 781 | $$invalidate(6, navigated = true); 782 | $$invalidate(7, title = document.title || "untitled page"); 783 | } 784 | }); 785 | $$invalidate(5, mounted = true); 786 | return unsubscribe; 787 | }); 788 | function switch_instance_binding($$value) { 789 | binding_callbacks[$$value ? "unshift" : "push"](() => { 790 | components[1] = $$value; 791 | $$invalidate(0, components); 792 | }); 793 | } 794 | function switch_instance_binding_1($$value) { 795 | binding_callbacks[$$value ? "unshift" : "push"](() => { 796 | components[0] = $$value; 797 | $$invalidate(0, components); 798 | }); 799 | } 800 | function switch_instance_binding_2($$value) { 801 | binding_callbacks[$$value ? "unshift" : "push"](() => { 802 | components[0] = $$value; 803 | $$invalidate(0, components); 804 | }); 805 | } 806 | $$self.$$set = ($$props2) => { 807 | if ("stores" in $$props2) 808 | $$invalidate(8, stores2 = $$props2.stores); 809 | if ("page" in $$props2) 810 | $$invalidate(9, page = $$props2.page); 811 | if ("constructors" in $$props2) 812 | $$invalidate(1, constructors = $$props2.constructors); 813 | if ("components" in $$props2) 814 | $$invalidate(0, components = $$props2.components); 815 | if ("form" in $$props2) 816 | $$invalidate(2, form = $$props2.form); 817 | if ("data_0" in $$props2) 818 | $$invalidate(3, data_0 = $$props2.data_0); 819 | if ("data_1" in $$props2) 820 | $$invalidate(4, data_1 = $$props2.data_1); 821 | }; 822 | $$self.$$.update = () => { 823 | if ($$self.$$.dirty & /*stores, page*/ 824 | 768) { 825 | stores2.page.set(page); 826 | } 827 | }; 828 | return [ 829 | components, 830 | constructors, 831 | form, 832 | data_0, 833 | data_1, 834 | mounted, 835 | navigated, 836 | title, 837 | stores2, 838 | page, 839 | switch_instance_binding, 840 | switch_instance_binding_1, 841 | switch_instance_binding_2 842 | ]; 843 | } 844 | class Root extends SvelteComponent { 845 | constructor(options) { 846 | super(); 847 | init(this, options, instance, create_fragment, safe_not_equal, { 848 | stores: 8, 849 | page: 9, 850 | constructors: 1, 851 | components: 0, 852 | form: 2, 853 | data_0: 3, 854 | data_1: 4 855 | }); 856 | } 857 | } 858 | const scriptRel = "modulepreload"; 859 | const assetsURL = function(dep, importerUrl) { 860 | return new URL(dep, importerUrl).href; 861 | }; 862 | const seen = {}; 863 | const __vitePreload = function preload(baseModule, deps, importerUrl) { 864 | if (!deps || deps.length === 0) { 865 | return baseModule(); 866 | } 867 | const links = document.getElementsByTagName("link"); 868 | return Promise.all(deps.map((dep) => { 869 | dep = assetsURL(dep, importerUrl); 870 | if (dep in seen) 871 | return; 872 | seen[dep] = true; 873 | const isCss = dep.endsWith(".css"); 874 | const cssSelector = isCss ? '[rel="stylesheet"]' : ""; 875 | const isBaseRelative = !!importerUrl; 876 | if (isBaseRelative) { 877 | for (let i = links.length - 1; i >= 0; i--) { 878 | const link2 = links[i]; 879 | if (link2.href === dep && (!isCss || link2.rel === "stylesheet")) { 880 | return; 881 | } 882 | } 883 | } else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) { 884 | return; 885 | } 886 | const link = document.createElement("link"); 887 | link.rel = isCss ? "stylesheet" : scriptRel; 888 | if (!isCss) { 889 | link.as = "script"; 890 | link.crossOrigin = ""; 891 | } 892 | link.href = dep; 893 | document.head.appendChild(link); 894 | if (isCss) { 895 | return new Promise((res, rej) => { 896 | link.addEventListener("load", res); 897 | link.addEventListener("error", () => rej(new Error(`Unable to preload CSS for ${dep}`))); 898 | }); 899 | } 900 | })).then(() => baseModule()); 901 | }; 902 | const matchers = {}; 903 | const nodes = [ 904 | () => __vitePreload(() => import("./chunks/0-8e8c308f.js"), true ? ["./chunks/0-8e8c308f.js","./components/pages/_layout.svelte-ebc491c9.js","./chunks/index-0c191f98.js","./assets/_layout-cb330d88.css"] : void 0, import.meta.url), 905 | () => __vitePreload(() => import("./chunks/1-d7f1c69a.js"), true ? ["./chunks/1-d7f1c69a.js","./components/error.svelte-63101f88.js","./chunks/index-0c191f98.js","./chunks/singletons-5c8d2b5b.js"] : void 0, import.meta.url), 906 | () => __vitePreload(() => import("./chunks/2-3677231e.js"), true ? ["./chunks/2-3677231e.js","./components/pages/_page.svelte-a3e10c76.js","./chunks/index-0c191f98.js","./chunks/parse-a9b5aeea.js","./chunks/singletons-5c8d2b5b.js"] : void 0, import.meta.url) 907 | ]; 908 | const server_loads = []; 909 | const dictionary = { 910 | "/": [2] 911 | }; 912 | const hooks = { 913 | handleError: ({ error }) => { 914 | console.error(error); 915 | } 916 | }; 917 | let HttpError = class HttpError2 { 918 | /** 919 | * @param {number} status 920 | * @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body 921 | */ 922 | constructor(status, body) { 923 | this.status = status; 924 | if (typeof body === "string") { 925 | this.body = { message: body }; 926 | } else if (body) { 927 | this.body = body; 928 | } else { 929 | this.body = { message: `Error: ${status}` }; 930 | } 931 | } 932 | toString() { 933 | return JSON.stringify(this.body); 934 | } 935 | }; 936 | let Redirect = class Redirect2 { 937 | /** 938 | * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status 939 | * @param {string} location 940 | */ 941 | constructor(status, location2) { 942 | this.status = status; 943 | this.location = location2; 944 | } 945 | }; 946 | async function unwrap_promises(object) { 947 | var _a; 948 | for (const key in object) { 949 | if (typeof ((_a = object[key]) == null ? void 0 : _a.then) === "function") { 950 | return Object.fromEntries( 951 | await Promise.all(Object.entries(object).map(async ([key2, value]) => [key2, await value])) 952 | ); 953 | } 954 | } 955 | return object; 956 | } 957 | function compact(arr) { 958 | return arr.filter( 959 | /** @returns {val is NonNullable} */ 960 | (val) => val != null 961 | ); 962 | } 963 | const routes = parse(nodes, server_loads, dictionary, matchers); 964 | const default_layout_loader = nodes[0]; 965 | const default_error_loader = nodes[1]; 966 | default_layout_loader(); 967 | default_error_loader(); 968 | const scroll_positions = get(SCROLL_KEY) ?? {}; 969 | const snapshots = get(SNAPSHOT_KEY) ?? {}; 970 | function update_scroll_positions(index) { 971 | scroll_positions[index] = scroll_state(); 972 | } 973 | function create_client({ target }) { 974 | var _a; 975 | const container = document.documentElement; 976 | const invalidated = []; 977 | const components = []; 978 | let load_cache = null; 979 | const callbacks = { 980 | /** @type {Array<(navigation: import('types').BeforeNavigate) => void>} */ 981 | before_navigate: [], 982 | /** @type {Array<(navigation: import('types').AfterNavigate) => void>} */ 983 | after_navigate: [] 984 | }; 985 | let current = { 986 | branch: [], 987 | error: null, 988 | // @ts-ignore - we need the initial value to be null 989 | url: null 990 | }; 991 | let hydrated = false; 992 | let started = false; 993 | let autoscroll = true; 994 | let updating = false; 995 | let navigating = false; 996 | let hash_navigating = false; 997 | let force_invalidation = false; 998 | let root; 999 | let current_history_index = (_a = history.state) == null ? void 0 : _a[INDEX_KEY]; 1000 | if (!current_history_index) { 1001 | current_history_index = Date.now(); 1002 | history.replaceState( 1003 | { ...history.state, [INDEX_KEY]: current_history_index }, 1004 | "", 1005 | location.href 1006 | ); 1007 | } 1008 | const scroll = scroll_positions[current_history_index]; 1009 | if (scroll) { 1010 | history.scrollRestoration = "manual"; 1011 | scrollTo(scroll.x, scroll.y); 1012 | } 1013 | let page; 1014 | let token; 1015 | let pending_invalidate; 1016 | async function invalidate() { 1017 | pending_invalidate = pending_invalidate || Promise.resolve(); 1018 | await pending_invalidate; 1019 | pending_invalidate = null; 1020 | const url = new URL(location.href); 1021 | const intent = get_navigation_intent(url, true); 1022 | load_cache = null; 1023 | await update(intent, url, []); 1024 | } 1025 | function capture_snapshot(index) { 1026 | if (components.some((c) => c == null ? void 0 : c.snapshot)) { 1027 | snapshots[index] = components.map((c) => { 1028 | var _a2; 1029 | return (_a2 = c == null ? void 0 : c.snapshot) == null ? void 0 : _a2.capture(); 1030 | }); 1031 | } 1032 | } 1033 | function restore_snapshot(index) { 1034 | var _a2; 1035 | (_a2 = snapshots[index]) == null ? void 0 : _a2.forEach((value, i) => { 1036 | var _a3, _b; 1037 | (_b = (_a3 = components[i]) == null ? void 0 : _a3.snapshot) == null ? void 0 : _b.restore(value); 1038 | }); 1039 | } 1040 | async function goto(url, { 1041 | noScroll = false, 1042 | replaceState = false, 1043 | keepFocus = false, 1044 | state = {}, 1045 | invalidateAll = false 1046 | }, redirect_chain, nav_token) { 1047 | if (typeof url === "string") { 1048 | url = new URL(url, get_base_uri(document)); 1049 | } 1050 | return navigate({ 1051 | url, 1052 | scroll: noScroll ? scroll_state() : null, 1053 | keepfocus: keepFocus, 1054 | redirect_chain, 1055 | details: { 1056 | state, 1057 | replaceState 1058 | }, 1059 | nav_token, 1060 | accepted: () => { 1061 | if (invalidateAll) { 1062 | force_invalidation = true; 1063 | } 1064 | }, 1065 | blocked: () => { 1066 | }, 1067 | type: "goto" 1068 | }); 1069 | } 1070 | async function preload_data(intent) { 1071 | load_cache = { 1072 | id: intent.id, 1073 | promise: load_route(intent).then((result) => { 1074 | if (result.type === "loaded" && result.state.error) { 1075 | load_cache = null; 1076 | } 1077 | return result; 1078 | }) 1079 | }; 1080 | return load_cache.promise; 1081 | } 1082 | async function preload_code(...pathnames) { 1083 | const matching = routes.filter((route) => pathnames.some((pathname) => route.exec(pathname))); 1084 | const promises = matching.map((r) => { 1085 | return Promise.all([...r.layouts, r.leaf].map((load) => load == null ? void 0 : load[1]())); 1086 | }); 1087 | await Promise.all(promises); 1088 | } 1089 | async function update(intent, url, redirect_chain, previous_history_index, opts, nav_token = {}, callback) { 1090 | var _a2, _b; 1091 | token = nav_token; 1092 | let navigation_result = intent && await load_route(intent); 1093 | if (!navigation_result) { 1094 | navigation_result = await server_fallback( 1095 | url, 1096 | { id: null }, 1097 | await handle_error(new Error(`Not found: ${url.pathname}`), { 1098 | url, 1099 | params: {}, 1100 | route: { id: null } 1101 | }), 1102 | 404 1103 | ); 1104 | } 1105 | url = (intent == null ? void 0 : intent.url) || url; 1106 | if (token !== nav_token) 1107 | return false; 1108 | if (navigation_result.type === "redirect") { 1109 | if (redirect_chain.length > 10 || redirect_chain.includes(url.pathname)) { 1110 | navigation_result = await load_root_error_page({ 1111 | status: 500, 1112 | error: await handle_error(new Error("Redirect loop"), { 1113 | url, 1114 | params: {}, 1115 | route: { id: null } 1116 | }), 1117 | url, 1118 | route: { id: null } 1119 | }); 1120 | } else { 1121 | goto( 1122 | new URL(navigation_result.location, url).href, 1123 | {}, 1124 | [...redirect_chain, url.pathname], 1125 | nav_token 1126 | ); 1127 | return false; 1128 | } 1129 | } else if ( 1130 | /** @type {number} */ 1131 | ((_b = (_a2 = navigation_result.props) == null ? void 0 : _a2.page) == null ? void 0 : _b.status) >= 400 1132 | ) { 1133 | const updated = await stores.updated.check(); 1134 | if (updated) { 1135 | await native_navigation(url); 1136 | } 1137 | } 1138 | invalidated.length = 0; 1139 | force_invalidation = false; 1140 | updating = true; 1141 | if (previous_history_index) { 1142 | update_scroll_positions(previous_history_index); 1143 | capture_snapshot(previous_history_index); 1144 | } 1145 | if (opts && opts.details) { 1146 | const { details } = opts; 1147 | const change = details.replaceState ? 0 : 1; 1148 | details.state[INDEX_KEY] = current_history_index += change; 1149 | history[details.replaceState ? "replaceState" : "pushState"](details.state, "", url); 1150 | if (!details.replaceState) { 1151 | let i = current_history_index + 1; 1152 | while (snapshots[i] || scroll_positions[i]) { 1153 | delete snapshots[i]; 1154 | delete scroll_positions[i]; 1155 | i += 1; 1156 | } 1157 | } 1158 | } 1159 | load_cache = null; 1160 | if (started) { 1161 | current = navigation_result.state; 1162 | if (navigation_result.props.page) { 1163 | navigation_result.props.page.url = url; 1164 | } 1165 | root.$set(navigation_result.props); 1166 | } else { 1167 | initialize(navigation_result); 1168 | } 1169 | if (opts) { 1170 | const { scroll: scroll2, keepfocus } = opts; 1171 | const { activeElement } = document; 1172 | await tick(); 1173 | const changed_focus = ( 1174 | // reset focus only if any manual focus management didn't override it 1175 | document.activeElement !== activeElement && // also refocus when activeElement is body already because the 1176 | // focus event might not have been fired on it yet 1177 | document.activeElement !== document.body 1178 | ); 1179 | if (!keepfocus && !changed_focus) { 1180 | await reset_focus(); 1181 | } 1182 | if (autoscroll) { 1183 | const deep_linked = url.hash && document.getElementById(decodeURIComponent(url.hash.slice(1))); 1184 | if (scroll2) { 1185 | scrollTo(scroll2.x, scroll2.y); 1186 | } else if (deep_linked) { 1187 | deep_linked.scrollIntoView(); 1188 | } else { 1189 | scrollTo(0, 0); 1190 | } 1191 | } 1192 | } else { 1193 | await tick(); 1194 | } 1195 | autoscroll = true; 1196 | if (navigation_result.props.page) { 1197 | page = navigation_result.props.page; 1198 | } 1199 | if (callback) 1200 | callback(); 1201 | updating = false; 1202 | } 1203 | function initialize(result) { 1204 | var _a2; 1205 | current = result.state; 1206 | const style = document.querySelector("style[data-sveltekit]"); 1207 | if (style) 1208 | style.remove(); 1209 | page = /** @type {import('types').Page} */ 1210 | result.props.page; 1211 | root = new Root({ 1212 | target, 1213 | props: { ...result.props, stores, components }, 1214 | hydrate: true 1215 | }); 1216 | restore_snapshot(current_history_index); 1217 | const navigation = { 1218 | from: null, 1219 | to: { 1220 | params: current.params, 1221 | route: { id: ((_a2 = current.route) == null ? void 0 : _a2.id) ?? null }, 1222 | url: new URL(location.href) 1223 | }, 1224 | willUnload: false, 1225 | type: "enter" 1226 | }; 1227 | callbacks.after_navigate.forEach((fn) => fn(navigation)); 1228 | started = true; 1229 | } 1230 | async function get_navigation_result_from_branch({ 1231 | url, 1232 | params, 1233 | branch, 1234 | status, 1235 | error, 1236 | route, 1237 | form 1238 | }) { 1239 | let slash = "never"; 1240 | for (const node of branch) { 1241 | if ((node == null ? void 0 : node.slash) !== void 0) 1242 | slash = node.slash; 1243 | } 1244 | url.pathname = normalize_path(url.pathname, slash); 1245 | url.search = url.search; 1246 | const result = { 1247 | type: "loaded", 1248 | state: { 1249 | url, 1250 | params, 1251 | branch, 1252 | error, 1253 | route 1254 | }, 1255 | props: { 1256 | // @ts-ignore Somehow it's getting SvelteComponent and SvelteComponentDev mixed up 1257 | constructors: compact(branch).map((branch_node) => branch_node.node.component) 1258 | } 1259 | }; 1260 | if (form !== void 0) { 1261 | result.props.form = form; 1262 | } 1263 | let data = {}; 1264 | let data_changed = !page; 1265 | let p = 0; 1266 | for (let i = 0; i < Math.max(branch.length, current.branch.length); i += 1) { 1267 | const node = branch[i]; 1268 | const prev = current.branch[i]; 1269 | if ((node == null ? void 0 : node.data) !== (prev == null ? void 0 : prev.data)) 1270 | data_changed = true; 1271 | if (!node) 1272 | continue; 1273 | data = { ...data, ...node.data }; 1274 | if (data_changed) { 1275 | result.props[`data_${p}`] = data; 1276 | } 1277 | p += 1; 1278 | } 1279 | const page_changed = !current.url || url.href !== current.url.href || current.error !== error || form !== void 0 && form !== page.form || data_changed; 1280 | if (page_changed) { 1281 | result.props.page = { 1282 | error, 1283 | params, 1284 | route: { 1285 | id: (route == null ? void 0 : route.id) ?? null 1286 | }, 1287 | status, 1288 | url: new URL(url), 1289 | form: form ?? null, 1290 | // The whole page store is updated, but this way the object reference stays the same 1291 | data: data_changed ? data : page.data 1292 | }; 1293 | } 1294 | return result; 1295 | } 1296 | async function load_node({ loader, parent, url, params, route, server_data_node }) { 1297 | var _a2, _b, _c; 1298 | let data = null; 1299 | const uses = { 1300 | dependencies: /* @__PURE__ */ new Set(), 1301 | params: /* @__PURE__ */ new Set(), 1302 | parent: false, 1303 | route: false, 1304 | url: false 1305 | }; 1306 | const node = await loader(); 1307 | if ((_a2 = node.universal) == null ? void 0 : _a2.load) { 1308 | let depends = function(...deps) { 1309 | for (const dep of deps) { 1310 | const { href } = new URL(dep, url); 1311 | uses.dependencies.add(href); 1312 | } 1313 | }; 1314 | const load_input = { 1315 | route: { 1316 | get id() { 1317 | uses.route = true; 1318 | return route.id; 1319 | } 1320 | }, 1321 | params: new Proxy(params, { 1322 | get: (target2, key) => { 1323 | uses.params.add( 1324 | /** @type {string} */ 1325 | key 1326 | ); 1327 | return target2[ 1328 | /** @type {string} */ 1329 | key 1330 | ]; 1331 | } 1332 | }), 1333 | data: (server_data_node == null ? void 0 : server_data_node.data) ?? null, 1334 | url: make_trackable(url, () => { 1335 | uses.url = true; 1336 | }), 1337 | async fetch(resource, init2) { 1338 | let requested; 1339 | if (resource instanceof Request) { 1340 | requested = resource.url; 1341 | init2 = { 1342 | // the request body must be consumed in memory until browsers 1343 | // implement streaming request bodies and/or the body getter 1344 | body: resource.method === "GET" || resource.method === "HEAD" ? void 0 : await resource.blob(), 1345 | cache: resource.cache, 1346 | credentials: resource.credentials, 1347 | headers: resource.headers, 1348 | integrity: resource.integrity, 1349 | keepalive: resource.keepalive, 1350 | method: resource.method, 1351 | mode: resource.mode, 1352 | redirect: resource.redirect, 1353 | referrer: resource.referrer, 1354 | referrerPolicy: resource.referrerPolicy, 1355 | signal: resource.signal, 1356 | ...init2 1357 | }; 1358 | } else { 1359 | requested = resource; 1360 | } 1361 | const resolved = new URL(requested, url); 1362 | depends(resolved.href); 1363 | if (resolved.origin === url.origin) { 1364 | requested = resolved.href.slice(url.origin.length); 1365 | } 1366 | return started ? subsequent_fetch(requested, resolved.href, init2) : initial_fetch(requested, init2); 1367 | }, 1368 | setHeaders: () => { 1369 | }, 1370 | // noop 1371 | depends, 1372 | parent() { 1373 | uses.parent = true; 1374 | return parent(); 1375 | } 1376 | }; 1377 | { 1378 | data = await node.universal.load.call(null, load_input) ?? null; 1379 | } 1380 | data = data ? await unwrap_promises(data) : null; 1381 | } 1382 | return { 1383 | node, 1384 | loader, 1385 | server: server_data_node, 1386 | universal: ((_b = node.universal) == null ? void 0 : _b.load) ? { type: "data", data, uses } : null, 1387 | data: data ?? (server_data_node == null ? void 0 : server_data_node.data) ?? null, 1388 | slash: ((_c = node.universal) == null ? void 0 : _c.trailingSlash) ?? (server_data_node == null ? void 0 : server_data_node.slash) 1389 | }; 1390 | } 1391 | function has_changed(parent_changed, route_changed, url_changed, uses, params) { 1392 | if (force_invalidation) 1393 | return true; 1394 | if (!uses) 1395 | return false; 1396 | if (uses.parent && parent_changed) 1397 | return true; 1398 | if (uses.route && route_changed) 1399 | return true; 1400 | if (uses.url && url_changed) 1401 | return true; 1402 | for (const param of uses.params) { 1403 | if (params[param] !== current.params[param]) 1404 | return true; 1405 | } 1406 | for (const href of uses.dependencies) { 1407 | if (invalidated.some((fn) => fn(new URL(href)))) 1408 | return true; 1409 | } 1410 | return false; 1411 | } 1412 | function create_data_node(node, previous) { 1413 | if ((node == null ? void 0 : node.type) === "data") { 1414 | return { 1415 | type: "data", 1416 | data: node.data, 1417 | uses: { 1418 | dependencies: new Set(node.uses.dependencies ?? []), 1419 | params: new Set(node.uses.params ?? []), 1420 | parent: !!node.uses.parent, 1421 | route: !!node.uses.route, 1422 | url: !!node.uses.url 1423 | }, 1424 | slash: node.slash 1425 | }; 1426 | } else if ((node == null ? void 0 : node.type) === "skip") { 1427 | return previous ?? null; 1428 | } 1429 | return null; 1430 | } 1431 | async function load_route({ id, invalidating, url, params, route }) { 1432 | if ((load_cache == null ? void 0 : load_cache.id) === id) { 1433 | return load_cache.promise; 1434 | } 1435 | const { errors, layouts, leaf } = route; 1436 | const loaders = [...layouts, leaf]; 1437 | errors.forEach((loader) => loader == null ? void 0 : loader().catch(() => { 1438 | })); 1439 | loaders.forEach((loader) => loader == null ? void 0 : loader[1]().catch(() => { 1440 | })); 1441 | let server_data = null; 1442 | const url_changed = current.url ? id !== current.url.pathname + current.url.search : false; 1443 | const route_changed = current.route ? route.id !== current.route.id : false; 1444 | let parent_invalid = false; 1445 | const invalid_server_nodes = loaders.map((loader, i) => { 1446 | var _a2; 1447 | const previous = current.branch[i]; 1448 | const invalid = !!(loader == null ? void 0 : loader[0]) && ((previous == null ? void 0 : previous.loader) !== loader[1] || has_changed(parent_invalid, route_changed, url_changed, (_a2 = previous.server) == null ? void 0 : _a2.uses, params)); 1449 | if (invalid) { 1450 | parent_invalid = true; 1451 | } 1452 | return invalid; 1453 | }); 1454 | if (invalid_server_nodes.some(Boolean)) { 1455 | try { 1456 | server_data = await load_data(url, invalid_server_nodes); 1457 | } catch (error) { 1458 | return load_root_error_page({ 1459 | status: error instanceof HttpError ? error.status : 500, 1460 | error: await handle_error(error, { url, params, route: { id: route.id } }), 1461 | url, 1462 | route 1463 | }); 1464 | } 1465 | if (server_data.type === "redirect") { 1466 | return server_data; 1467 | } 1468 | } 1469 | const server_data_nodes = server_data == null ? void 0 : server_data.nodes; 1470 | let parent_changed = false; 1471 | const branch_promises = loaders.map(async (loader, i) => { 1472 | var _a2; 1473 | if (!loader) 1474 | return; 1475 | const previous = current.branch[i]; 1476 | const server_data_node = server_data_nodes == null ? void 0 : server_data_nodes[i]; 1477 | const valid = (!server_data_node || server_data_node.type === "skip") && loader[1] === (previous == null ? void 0 : previous.loader) && !has_changed(parent_changed, route_changed, url_changed, (_a2 = previous.universal) == null ? void 0 : _a2.uses, params); 1478 | if (valid) 1479 | return previous; 1480 | parent_changed = true; 1481 | if ((server_data_node == null ? void 0 : server_data_node.type) === "error") { 1482 | throw server_data_node; 1483 | } 1484 | return load_node({ 1485 | loader: loader[1], 1486 | url, 1487 | params, 1488 | route, 1489 | parent: async () => { 1490 | var _a3; 1491 | const data = {}; 1492 | for (let j = 0; j < i; j += 1) { 1493 | Object.assign(data, (_a3 = await branch_promises[j]) == null ? void 0 : _a3.data); 1494 | } 1495 | return data; 1496 | }, 1497 | server_data_node: create_data_node( 1498 | // server_data_node is undefined if it wasn't reloaded from the server; 1499 | // and if current loader uses server data, we want to reuse previous data. 1500 | server_data_node === void 0 && loader[0] ? { type: "skip" } : server_data_node ?? null, 1501 | loader[0] ? previous == null ? void 0 : previous.server : void 0 1502 | ) 1503 | }); 1504 | }); 1505 | for (const p of branch_promises) 1506 | p.catch(() => { 1507 | }); 1508 | const branch = []; 1509 | for (let i = 0; i < loaders.length; i += 1) { 1510 | if (loaders[i]) { 1511 | try { 1512 | branch.push(await branch_promises[i]); 1513 | } catch (err) { 1514 | if (err instanceof Redirect) { 1515 | return { 1516 | type: "redirect", 1517 | location: err.location 1518 | }; 1519 | } 1520 | let status = 500; 1521 | let error; 1522 | if (server_data_nodes == null ? void 0 : server_data_nodes.includes( 1523 | /** @type {import('types').ServerErrorNode} */ 1524 | err 1525 | )) { 1526 | status = /** @type {import('types').ServerErrorNode} */ 1527 | err.status ?? status; 1528 | error = /** @type {import('types').ServerErrorNode} */ 1529 | err.error; 1530 | } else if (err instanceof HttpError) { 1531 | status = err.status; 1532 | error = err.body; 1533 | } else { 1534 | const updated = await stores.updated.check(); 1535 | if (updated) { 1536 | return await native_navigation(url); 1537 | } 1538 | error = await handle_error(err, { params, url, route: { id: route.id } }); 1539 | } 1540 | const error_load = await load_nearest_error_page(i, branch, errors); 1541 | if (error_load) { 1542 | return await get_navigation_result_from_branch({ 1543 | url, 1544 | params, 1545 | branch: branch.slice(0, error_load.idx).concat(error_load.node), 1546 | status, 1547 | error, 1548 | route 1549 | }); 1550 | } else { 1551 | return await server_fallback(url, { id: route.id }, error, status); 1552 | } 1553 | } 1554 | } else { 1555 | branch.push(void 0); 1556 | } 1557 | } 1558 | return await get_navigation_result_from_branch({ 1559 | url, 1560 | params, 1561 | branch, 1562 | status: 200, 1563 | error: null, 1564 | route, 1565 | // Reset `form` on navigation, but not invalidation 1566 | form: invalidating ? void 0 : null 1567 | }); 1568 | } 1569 | async function load_nearest_error_page(i, branch, errors) { 1570 | while (i--) { 1571 | if (errors[i]) { 1572 | let j = i; 1573 | while (!branch[j]) 1574 | j -= 1; 1575 | try { 1576 | return { 1577 | idx: j + 1, 1578 | node: { 1579 | node: await /** @type {import('types').CSRPageNodeLoader } */ 1580 | errors[i](), 1581 | loader: ( 1582 | /** @type {import('types').CSRPageNodeLoader } */ 1583 | errors[i] 1584 | ), 1585 | data: {}, 1586 | server: null, 1587 | universal: null 1588 | } 1589 | }; 1590 | } catch (e) { 1591 | continue; 1592 | } 1593 | } 1594 | } 1595 | } 1596 | async function load_root_error_page({ status, error, url, route }) { 1597 | const params = {}; 1598 | let server_data_node = null; 1599 | const default_layout_has_server_load = server_loads[0] === 0; 1600 | if (default_layout_has_server_load) { 1601 | try { 1602 | const server_data = await load_data(url, [true]); 1603 | if (server_data.type !== "data" || server_data.nodes[0] && server_data.nodes[0].type !== "data") { 1604 | throw 0; 1605 | } 1606 | server_data_node = server_data.nodes[0] ?? null; 1607 | } catch { 1608 | if (url.origin !== location.origin || url.pathname !== location.pathname || hydrated) { 1609 | await native_navigation(url); 1610 | } 1611 | } 1612 | } 1613 | const root_layout = await load_node({ 1614 | loader: default_layout_loader, 1615 | url, 1616 | params, 1617 | route, 1618 | parent: () => Promise.resolve({}), 1619 | server_data_node: create_data_node(server_data_node) 1620 | }); 1621 | const root_error = { 1622 | node: await default_error_loader(), 1623 | loader: default_error_loader, 1624 | universal: null, 1625 | server: null, 1626 | data: null 1627 | }; 1628 | return await get_navigation_result_from_branch({ 1629 | url, 1630 | params, 1631 | branch: [root_layout, root_error], 1632 | status, 1633 | error, 1634 | route: null 1635 | }); 1636 | } 1637 | function get_navigation_intent(url, invalidating) { 1638 | if (is_external_url(url, base)) 1639 | return; 1640 | const path = get_url_path(url); 1641 | for (const route of routes) { 1642 | const params = route.exec(path); 1643 | if (params) { 1644 | const id = url.pathname + url.search; 1645 | const intent = { id, invalidating, route, params: decode_params(params), url }; 1646 | return intent; 1647 | } 1648 | } 1649 | } 1650 | function get_url_path(url) { 1651 | return decode_pathname(url.pathname.slice(base.length) || "/"); 1652 | } 1653 | function before_navigate({ url, type, intent, delta }) { 1654 | var _a2, _b; 1655 | let should_block = false; 1656 | const navigation = { 1657 | from: { 1658 | params: current.params, 1659 | route: { id: ((_a2 = current.route) == null ? void 0 : _a2.id) ?? null }, 1660 | url: current.url 1661 | }, 1662 | to: { 1663 | params: (intent == null ? void 0 : intent.params) ?? null, 1664 | route: { id: ((_b = intent == null ? void 0 : intent.route) == null ? void 0 : _b.id) ?? null }, 1665 | url 1666 | }, 1667 | willUnload: !intent, 1668 | type 1669 | }; 1670 | if (delta !== void 0) { 1671 | navigation.delta = delta; 1672 | } 1673 | const cancellable = { 1674 | ...navigation, 1675 | cancel: () => { 1676 | should_block = true; 1677 | } 1678 | }; 1679 | if (!navigating) { 1680 | callbacks.before_navigate.forEach((fn) => fn(cancellable)); 1681 | } 1682 | return should_block ? null : navigation; 1683 | } 1684 | async function navigate({ 1685 | url, 1686 | scroll: scroll2, 1687 | keepfocus, 1688 | redirect_chain, 1689 | details, 1690 | type, 1691 | delta, 1692 | nav_token, 1693 | accepted, 1694 | blocked 1695 | }) { 1696 | const intent = get_navigation_intent(url, false); 1697 | const navigation = before_navigate({ url, type, delta, intent }); 1698 | if (!navigation) { 1699 | blocked(); 1700 | return; 1701 | } 1702 | const previous_history_index = current_history_index; 1703 | accepted(); 1704 | navigating = true; 1705 | if (started) { 1706 | stores.navigating.set(navigation); 1707 | } 1708 | await update( 1709 | intent, 1710 | url, 1711 | redirect_chain, 1712 | previous_history_index, 1713 | { 1714 | scroll: scroll2, 1715 | keepfocus, 1716 | details 1717 | }, 1718 | nav_token, 1719 | () => { 1720 | navigating = false; 1721 | callbacks.after_navigate.forEach( 1722 | (fn) => fn( 1723 | /** @type {import('types').AfterNavigate} */ 1724 | navigation 1725 | ) 1726 | ); 1727 | stores.navigating.set(null); 1728 | } 1729 | ); 1730 | } 1731 | async function server_fallback(url, route, error, status) { 1732 | if (url.origin === location.origin && url.pathname === location.pathname && !hydrated) { 1733 | return await load_root_error_page({ 1734 | status, 1735 | error, 1736 | url, 1737 | route 1738 | }); 1739 | } 1740 | return await native_navigation(url); 1741 | } 1742 | function native_navigation(url) { 1743 | location.href = url.href; 1744 | return new Promise(() => { 1745 | }); 1746 | } 1747 | function setup_preload() { 1748 | let mousemove_timeout; 1749 | container.addEventListener("mousemove", (event) => { 1750 | const target2 = ( 1751 | /** @type {Element} */ 1752 | event.target 1753 | ); 1754 | clearTimeout(mousemove_timeout); 1755 | mousemove_timeout = setTimeout(() => { 1756 | preload2(target2, 2); 1757 | }, 20); 1758 | }); 1759 | function tap(event) { 1760 | preload2( 1761 | /** @type {Element} */ 1762 | event.composedPath()[0], 1763 | 1 1764 | ); 1765 | } 1766 | container.addEventListener("mousedown", tap); 1767 | container.addEventListener("touchstart", tap, { passive: true }); 1768 | const observer = new IntersectionObserver( 1769 | (entries) => { 1770 | for (const entry of entries) { 1771 | if (entry.isIntersecting) { 1772 | preload_code( 1773 | get_url_path(new URL( 1774 | /** @type {HTMLAnchorElement} */ 1775 | entry.target.href 1776 | )) 1777 | ); 1778 | observer.unobserve(entry.target); 1779 | } 1780 | } 1781 | }, 1782 | { threshold: 0 } 1783 | ); 1784 | function preload2(element2, priority) { 1785 | const a = find_anchor(element2, container); 1786 | if (!a) 1787 | return; 1788 | const { url, external } = get_link_info(a, base); 1789 | if (external) 1790 | return; 1791 | const options = get_router_options(a); 1792 | if (!options.reload) { 1793 | if (priority <= options.preload_data) { 1794 | const intent = get_navigation_intent( 1795 | /** @type {URL} */ 1796 | url, 1797 | false 1798 | ); 1799 | if (intent) { 1800 | { 1801 | preload_data(intent); 1802 | } 1803 | } 1804 | } else if (priority <= options.preload_code) { 1805 | preload_code(get_url_path( 1806 | /** @type {URL} */ 1807 | url 1808 | )); 1809 | } 1810 | } 1811 | } 1812 | function after_navigate() { 1813 | observer.disconnect(); 1814 | for (const a of container.querySelectorAll("a")) { 1815 | const { url, external } = get_link_info(a, base); 1816 | if (external) 1817 | continue; 1818 | const options = get_router_options(a); 1819 | if (options.reload) 1820 | continue; 1821 | if (options.preload_code === PRELOAD_PRIORITIES.viewport) { 1822 | observer.observe(a); 1823 | } 1824 | if (options.preload_code === PRELOAD_PRIORITIES.eager) { 1825 | preload_code(get_url_path( 1826 | /** @type {URL} */ 1827 | url 1828 | )); 1829 | } 1830 | } 1831 | } 1832 | callbacks.after_navigate.push(after_navigate); 1833 | after_navigate(); 1834 | } 1835 | return { 1836 | after_navigate: (fn) => { 1837 | onMount(() => { 1838 | callbacks.after_navigate.push(fn); 1839 | return () => { 1840 | const i = callbacks.after_navigate.indexOf(fn); 1841 | callbacks.after_navigate.splice(i, 1); 1842 | }; 1843 | }); 1844 | }, 1845 | before_navigate: (fn) => { 1846 | onMount(() => { 1847 | callbacks.before_navigate.push(fn); 1848 | return () => { 1849 | const i = callbacks.before_navigate.indexOf(fn); 1850 | callbacks.before_navigate.splice(i, 1); 1851 | }; 1852 | }); 1853 | }, 1854 | disable_scroll_handling: () => { 1855 | if (updating || !started) { 1856 | autoscroll = false; 1857 | } 1858 | }, 1859 | goto: (href, opts = {}) => { 1860 | return goto(href, opts, []); 1861 | }, 1862 | invalidate: (resource) => { 1863 | if (typeof resource === "function") { 1864 | invalidated.push(resource); 1865 | } else { 1866 | const { href } = new URL(resource, location.href); 1867 | invalidated.push((url) => url.href === href); 1868 | } 1869 | return invalidate(); 1870 | }, 1871 | invalidateAll: () => { 1872 | force_invalidation = true; 1873 | return invalidate(); 1874 | }, 1875 | preload_data: async (href) => { 1876 | const url = new URL(href, get_base_uri(document)); 1877 | const intent = get_navigation_intent(url, false); 1878 | if (!intent) { 1879 | throw new Error(`Attempted to preload a URL that does not belong to this app: ${url}`); 1880 | } 1881 | await preload_data(intent); 1882 | }, 1883 | preload_code, 1884 | apply_action: async (result) => { 1885 | if (result.type === "error") { 1886 | const url = new URL(location.href); 1887 | const { branch, route } = current; 1888 | if (!route) 1889 | return; 1890 | const error_load = await load_nearest_error_page( 1891 | current.branch.length, 1892 | branch, 1893 | route.errors 1894 | ); 1895 | if (error_load) { 1896 | const navigation_result = await get_navigation_result_from_branch({ 1897 | url, 1898 | params: current.params, 1899 | branch: branch.slice(0, error_load.idx).concat(error_load.node), 1900 | status: result.status ?? 500, 1901 | error: result.error, 1902 | route 1903 | }); 1904 | current = navigation_result.state; 1905 | root.$set(navigation_result.props); 1906 | tick().then(reset_focus); 1907 | } 1908 | } else if (result.type === "redirect") { 1909 | goto(result.location, { invalidateAll: true }, []); 1910 | } else { 1911 | const props = { 1912 | form: result.data, 1913 | page: { ...page, form: result.data, status: result.status } 1914 | }; 1915 | root.$set(props); 1916 | if (result.type === "success") { 1917 | tick().then(reset_focus); 1918 | } 1919 | } 1920 | }, 1921 | _start_router: () => { 1922 | var _a2; 1923 | history.scrollRestoration = "manual"; 1924 | addEventListener("beforeunload", (e) => { 1925 | var _a3; 1926 | let should_block = false; 1927 | if (!navigating) { 1928 | const navigation = { 1929 | from: { 1930 | params: current.params, 1931 | route: { id: ((_a3 = current.route) == null ? void 0 : _a3.id) ?? null }, 1932 | url: current.url 1933 | }, 1934 | to: null, 1935 | willUnload: true, 1936 | type: "leave", 1937 | cancel: () => should_block = true 1938 | }; 1939 | callbacks.before_navigate.forEach((fn) => fn(navigation)); 1940 | } 1941 | if (should_block) { 1942 | e.preventDefault(); 1943 | e.returnValue = ""; 1944 | } else { 1945 | history.scrollRestoration = "auto"; 1946 | } 1947 | }); 1948 | addEventListener("visibilitychange", () => { 1949 | if (document.visibilityState === "hidden") { 1950 | update_scroll_positions(current_history_index); 1951 | set(SCROLL_KEY, scroll_positions); 1952 | capture_snapshot(current_history_index); 1953 | set(SNAPSHOT_KEY, snapshots); 1954 | } 1955 | }); 1956 | if (!((_a2 = navigator.connection) == null ? void 0 : _a2.saveData)) { 1957 | setup_preload(); 1958 | } 1959 | container.addEventListener("click", (event) => { 1960 | if (event.button || event.which !== 1) 1961 | return; 1962 | if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) 1963 | return; 1964 | if (event.defaultPrevented) 1965 | return; 1966 | const a = find_anchor( 1967 | /** @type {Element} */ 1968 | event.composedPath()[0], 1969 | container 1970 | ); 1971 | if (!a) 1972 | return; 1973 | const { url, external, target: target2 } = get_link_info(a, base); 1974 | if (!url) 1975 | return; 1976 | if (target2 === "_parent" || target2 === "_top") { 1977 | if (window.parent !== window) 1978 | return; 1979 | } else if (target2 && target2 !== "_self") { 1980 | return; 1981 | } 1982 | const options = get_router_options(a); 1983 | const is_svg_a_element = a instanceof SVGAElement; 1984 | if (!is_svg_a_element && url.protocol !== location.protocol && !(url.protocol === "https:" || url.protocol === "http:")) 1985 | return; 1986 | if (external || options.reload) { 1987 | const navigation = before_navigate({ url, type: "link" }); 1988 | if (!navigation) { 1989 | event.preventDefault(); 1990 | } 1991 | navigating = true; 1992 | return; 1993 | } 1994 | const [nonhash, hash2] = url.href.split("#"); 1995 | if (hash2 !== void 0 && nonhash === location.href.split("#")[0]) { 1996 | hash_navigating = true; 1997 | update_scroll_positions(current_history_index); 1998 | current.url = url; 1999 | stores.page.set({ ...page, url }); 2000 | stores.page.notify(); 2001 | return; 2002 | } 2003 | navigate({ 2004 | url, 2005 | scroll: options.noscroll ? scroll_state() : null, 2006 | keepfocus: false, 2007 | redirect_chain: [], 2008 | details: { 2009 | state: {}, 2010 | replaceState: url.href === location.href 2011 | }, 2012 | accepted: () => event.preventDefault(), 2013 | blocked: () => event.preventDefault(), 2014 | type: "link" 2015 | }); 2016 | }); 2017 | container.addEventListener("submit", (event) => { 2018 | if (event.defaultPrevented) 2019 | return; 2020 | const form = ( 2021 | /** @type {HTMLFormElement} */ 2022 | HTMLFormElement.prototype.cloneNode.call(event.target) 2023 | ); 2024 | const submitter = ( 2025 | /** @type {HTMLButtonElement | HTMLInputElement | null} */ 2026 | event.submitter 2027 | ); 2028 | const method = (submitter == null ? void 0 : submitter.formMethod) || form.method; 2029 | if (method !== "get") 2030 | return; 2031 | const url = new URL( 2032 | (submitter == null ? void 0 : submitter.hasAttribute("formaction")) && (submitter == null ? void 0 : submitter.formAction) || form.action 2033 | ); 2034 | if (is_external_url(url, base)) 2035 | return; 2036 | const event_form = ( 2037 | /** @type {HTMLFormElement} */ 2038 | event.target 2039 | ); 2040 | const { noscroll, reload } = get_router_options(event_form); 2041 | if (reload) 2042 | return; 2043 | event.preventDefault(); 2044 | event.stopPropagation(); 2045 | const data = new FormData(event_form); 2046 | const submitter_name = submitter == null ? void 0 : submitter.getAttribute("name"); 2047 | if (submitter_name) { 2048 | data.append(submitter_name, (submitter == null ? void 0 : submitter.getAttribute("value")) ?? ""); 2049 | } 2050 | url.search = new URLSearchParams(data).toString(); 2051 | navigate({ 2052 | url, 2053 | scroll: noscroll ? scroll_state() : null, 2054 | keepfocus: false, 2055 | redirect_chain: [], 2056 | details: { 2057 | state: {}, 2058 | replaceState: false 2059 | }, 2060 | nav_token: {}, 2061 | accepted: () => { 2062 | }, 2063 | blocked: () => { 2064 | }, 2065 | type: "form" 2066 | }); 2067 | }); 2068 | addEventListener("popstate", async (event) => { 2069 | var _a3; 2070 | if ((_a3 = event.state) == null ? void 0 : _a3[INDEX_KEY]) { 2071 | if (event.state[INDEX_KEY] === current_history_index) 2072 | return; 2073 | const scroll2 = scroll_positions[event.state[INDEX_KEY]]; 2074 | if (current.url.href.split("#")[0] === location.href.split("#")[0]) { 2075 | scroll_positions[current_history_index] = scroll_state(); 2076 | current_history_index = event.state[INDEX_KEY]; 2077 | scrollTo(scroll2.x, scroll2.y); 2078 | return; 2079 | } 2080 | const delta = event.state[INDEX_KEY] - current_history_index; 2081 | let blocked = false; 2082 | await navigate({ 2083 | url: new URL(location.href), 2084 | scroll: scroll2, 2085 | keepfocus: false, 2086 | redirect_chain: [], 2087 | details: null, 2088 | accepted: () => { 2089 | current_history_index = event.state[INDEX_KEY]; 2090 | }, 2091 | blocked: () => { 2092 | history.go(-delta); 2093 | blocked = true; 2094 | }, 2095 | type: "popstate", 2096 | delta 2097 | }); 2098 | if (!blocked) { 2099 | restore_snapshot(current_history_index); 2100 | } 2101 | } 2102 | }); 2103 | addEventListener("hashchange", () => { 2104 | if (hash_navigating) { 2105 | hash_navigating = false; 2106 | history.replaceState( 2107 | { ...history.state, [INDEX_KEY]: ++current_history_index }, 2108 | "", 2109 | location.href 2110 | ); 2111 | } 2112 | }); 2113 | for (const link of document.querySelectorAll("link")) { 2114 | if (link.rel === "icon") 2115 | link.href = link.href; 2116 | } 2117 | addEventListener("pageshow", (event) => { 2118 | if (event.persisted) { 2119 | stores.navigating.set(null); 2120 | } 2121 | }); 2122 | }, 2123 | _hydrate: async ({ 2124 | status = 200, 2125 | error, 2126 | node_ids, 2127 | params, 2128 | route, 2129 | data: server_data_nodes, 2130 | form 2131 | }) => { 2132 | hydrated = true; 2133 | const url = new URL(location.href); 2134 | { 2135 | ({ params = {}, route = { id: null } } = get_navigation_intent(url, false) || {}); 2136 | } 2137 | let result; 2138 | try { 2139 | const branch_promises = node_ids.map(async (n, i) => { 2140 | const server_data_node = server_data_nodes[i]; 2141 | return load_node({ 2142 | loader: nodes[n], 2143 | url, 2144 | params, 2145 | route, 2146 | parent: async () => { 2147 | const data = {}; 2148 | for (let j = 0; j < i; j += 1) { 2149 | Object.assign(data, (await branch_promises[j]).data); 2150 | } 2151 | return data; 2152 | }, 2153 | server_data_node: create_data_node(server_data_node) 2154 | }); 2155 | }); 2156 | result = await get_navigation_result_from_branch({ 2157 | url, 2158 | params, 2159 | branch: await Promise.all(branch_promises), 2160 | status, 2161 | error, 2162 | form, 2163 | route: routes.find(({ id }) => id === route.id) ?? null 2164 | }); 2165 | } catch (error2) { 2166 | if (error2 instanceof Redirect) { 2167 | await native_navigation(new URL(error2.location, location.href)); 2168 | return; 2169 | } 2170 | result = await load_root_error_page({ 2171 | status: error2 instanceof HttpError ? error2.status : 500, 2172 | error: await handle_error(error2, { url, params, route }), 2173 | url, 2174 | route 2175 | }); 2176 | } 2177 | initialize(result); 2178 | } 2179 | }; 2180 | } 2181 | async function load_data(url, invalid) { 2182 | var _a; 2183 | const data_url = new URL(url); 2184 | data_url.pathname = add_data_suffix(url.pathname); 2185 | data_url.searchParams.append( 2186 | "x-sveltekit-invalidated", 2187 | invalid.map((x) => x ? "1" : "").join("_") 2188 | ); 2189 | const res = await native_fetch(data_url.href); 2190 | const data = await res.json(); 2191 | if (!res.ok) { 2192 | throw new HttpError(res.status, data); 2193 | } 2194 | (_a = data.nodes) == null ? void 0 : _a.forEach((node) => { 2195 | if ((node == null ? void 0 : node.type) === "data") { 2196 | node.data = unflatten(node.data); 2197 | node.uses = { 2198 | dependencies: new Set(node.uses.dependencies ?? []), 2199 | params: new Set(node.uses.params ?? []), 2200 | parent: !!node.uses.parent, 2201 | route: !!node.uses.route, 2202 | url: !!node.uses.url 2203 | }; 2204 | } 2205 | }); 2206 | return data; 2207 | } 2208 | function handle_error(error, event) { 2209 | if (error instanceof HttpError) { 2210 | return error.body; 2211 | } 2212 | return hooks.handleError({ error, event }) ?? /** @type {any} */ 2213 | { message: event.route.id != null ? "Internal Error" : "Not Found" }; 2214 | } 2215 | function reset_focus() { 2216 | const autofocus = document.querySelector("[autofocus]"); 2217 | if (autofocus) { 2218 | autofocus.focus(); 2219 | } else { 2220 | const root = document.body; 2221 | const tabindex = root.getAttribute("tabindex"); 2222 | root.tabIndex = -1; 2223 | root.focus({ preventScroll: true }); 2224 | if (tabindex !== null) { 2225 | root.setAttribute("tabindex", tabindex); 2226 | } else { 2227 | root.removeAttribute("tabindex"); 2228 | } 2229 | return new Promise((resolve) => { 2230 | setTimeout(() => { 2231 | var _a; 2232 | resolve((_a = getSelection()) == null ? void 0 : _a.removeAllRanges()); 2233 | }); 2234 | }); 2235 | } 2236 | } 2237 | async function start({ assets, env, hydrate, target, version }) { 2238 | set_assets(assets); 2239 | set_version(version); 2240 | const client = create_client({ 2241 | target 2242 | }); 2243 | init$1({ client }); 2244 | if (hydrate) { 2245 | await client._hydrate(hydrate); 2246 | } else { 2247 | client.goto(location.href, { replaceState: true }); 2248 | } 2249 | client._start_router(); 2250 | } 2251 | export { 2252 | start 2253 | }; 2254 | -------------------------------------------------------------------------------- /.cloudflare/public/_app/version.json: -------------------------------------------------------------------------------- 1 | {"version":"1676323861282"} -------------------------------------------------------------------------------- /.cloudflare/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/semicognitive/sveltekit-chat/0b3b949b70ec50e3aaf81f6b304a9e3a4cfbb612/.cloudflare/public/favicon.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | vite.config.js.timestamp-* 10 | vite.config.ts.timestamp-* 11 | !.env.production -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /.replit: -------------------------------------------------------------------------------- 1 | 2 | hidden = [".config", "package-lock.json"] 3 | run = "npm run dev -- --host" 4 | 5 | [[hints]] 6 | regex = "Error \\[ERR_REQUIRE_ESM\\]" 7 | message = "We see that you are using require(...) inside your code. We currently do not support this syntax. Please use 'import' instead when using external modules. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)" 8 | 9 | [nix] 10 | channel = "stable-22_11" 11 | 12 | [env] 13 | XDG_CONFIG_HOME = "/home/runner/$REPL_SLUG/.config" 14 | PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin" 15 | npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global" 16 | 17 | [gitHubImport] 18 | requiredFiles = [".replit", "replit.nix", ".config", "package.json", "package-lock.json"] 19 | 20 | [packager] 21 | language = "nodejs" 22 | 23 | [packager.features] 24 | packageSearch = true 25 | guessImports = true 26 | enabledForHosting = false 27 | 28 | [unitTest] 29 | language = "nodejs" 30 | 31 | [debugger] 32 | support = true 33 | 34 | [debugger.interactive] 35 | transport = "localhost:0" 36 | startCommand = [ "dap-node" ] 37 | 38 | [debugger.interactive.initializeMessage] 39 | command = "initialize" 40 | type = "request" 41 | 42 | [debugger.interactive.initializeMessage.arguments] 43 | clientID = "replit" 44 | clientName = "replit.com" 45 | columnsStartAt1 = true 46 | linesStartAt1 = true 47 | locale = "en-us" 48 | pathFormat = "path" 49 | supportsInvalidatedEvent = true 50 | supportsProgressReporting = true 51 | supportsRunInTerminalRequest = true 52 | supportsVariablePaging = true 53 | supportsVariableType = true 54 | 55 | [debugger.interactive.launchMessage] 56 | command = "launch" 57 | type = "request" 58 | 59 | [debugger.interactive.launchMessage.arguments] 60 | args = [] 61 | console = "externalTerminal" 62 | cwd = "." 63 | environment = [] 64 | pauseForSourceMap = false 65 | program = "./index.js" 66 | request = "launch" 67 | sourceMaps = true 68 | stopOnEntry = false 69 | type = "pwa-node" 70 | 71 | [languages] 72 | 73 | [languages.javascript] 74 | pattern = "**/{*.js,*.jsx,*.ts,*.tsx}" 75 | 76 | [languages.javascript.languageServer] 77 | start = "typescript-language-server --stdio" 78 | 79 | [deployment] 80 | run = ["sh", "-c", "npm run dev"] 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Xnapper-2023-04-16-02 58 44 2 | 3 | # sveltekit-chat 4 | 5 | Built for ***Intelligent Svelte***. 6 | 7 | An example SvelteKit project. 8 | 9 | ## This example 10 | - Includes a frontend written in [TailwindCSS](https://tailwindcss.com) 11 | - Has a `api/chat` endpoint which takes chats, and returns a response from the OpenAI Api! Written in Python with [LangChain](https://langchain.readthedocs.io/en/latest/) 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sveltekit-modal-stablediffusion", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "dev": "vite dev", 7 | "build": "vite build", 8 | "preview": "vite preview", 9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", 10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" 11 | }, 12 | "devDependencies": { 13 | "@stefanprobst/rehype-shiki": "^2.2.0", 14 | "@sveltejs/adapter-auto": "^2.0.0", 15 | "@sveltejs/adapter-cloudflare-workers": "^1.0.6", 16 | "@sveltejs/kit": "^1.5.0", 17 | "@tailwindcss/forms": "^0.5.3", 18 | "@tailwindcss/typography": "^0.5.9", 19 | "autoprefixer": "^10.4.13", 20 | "langchain": "^0.0.56", 21 | "postcss": "^8.4.21", 22 | "rehype-external-links": "^2.0.1", 23 | "rehype-stringify": "^9.0.3", 24 | "remark-gfm": "^3.0.1", 25 | "remark-parse": "^10.0.1", 26 | "remark-rehype": "^10.1.0", 27 | "shiki-es": "^0.2.0", 28 | "svelte": "^3.54.0", 29 | "svelte-check": "^3.0.1", 30 | "tailwindcss": "^3.2.6", 31 | "tslib": "^2.4.1", 32 | "typescript": "^4.9.3", 33 | "unified": "^10.1.2", 34 | "vite": "^4.0.0" 35 | }, 36 | "type": "module" 37 | } 38 | -------------------------------------------------------------------------------- /postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /replit.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: { 2 | deps = [ 3 | pkgs.nodejs-18_x 4 | pkgs.nodePackages.typescript-language-server 5 | pkgs.yarn 6 | pkgs.replitPackages.jest 7 | ]; 8 | } -------------------------------------------------------------------------------- /src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://kit.svelte.dev/docs/types#app 2 | // for information about these interfaces 3 | declare global { 4 | namespace App { 5 | // interface Error {} 6 | // interface Locals {} 7 | // interface PageData {} 8 | // interface Platform {} 9 | } 10 | } 11 | 12 | export {}; 13 | -------------------------------------------------------------------------------- /src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | sveltekit-chat | Chat 9 | %sveltekit.head% 10 | 11 | 12 | 13 |
%sveltekit.body%
14 | 15 | 16 | -------------------------------------------------------------------------------- /src/app.postcss: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; -------------------------------------------------------------------------------- /src/lib/markdownparser.ts: -------------------------------------------------------------------------------- 1 | import { unified } from 'unified' 2 | import remarkParse from 'remark-parse' 3 | import remarkGfm from 'remark-gfm' 4 | import remarkRehype from 'remark-rehype' 5 | import rehypeExternalLinks from 'rehype-external-links' 6 | import rehypeStringify from 'rehype-stringify' 7 | 8 | import rehypeShiki from '@stefanprobst/rehype-shiki' 9 | import * as shiki from 'shiki-es' 10 | 11 | 12 | let markdown_processor; 13 | 14 | export async function markdownParser(markdown: string) { 15 | markdown_processor ??= unified() 16 | .use(remarkParse) 17 | .use(remarkGfm) 18 | .use(remarkRehype) 19 | .use(rehypeExternalLinks, { rel: ['nofollow'], target: '_blank' }) 20 | .use(rehypeShiki, { highlighter: await shiki.getHighlighter({ theme: 'github-light' }) }) 21 | .use(rehypeStringify) 22 | 23 | const res = (await markdown_processor.process(markdown)).toString(); 24 | 25 | return res; 26 | } -------------------------------------------------------------------------------- /src/lib/readablestreamstore.ts: -------------------------------------------------------------------------------- 1 | import { writable } from "svelte/store"; 2 | 3 | export function readablestreamStore() { 4 | const { subscribe, set, update } = writable({ loading: false, text: "" }); 5 | 6 | async function request(request: Request) { 7 | set({ loading: true, text: "" }); 8 | 9 | try { 10 | const result = await fetch(request); 11 | 12 | if (!result.ok) throw new Error(result.statusText); 13 | if (!result.body) return; 14 | 15 | const reader = result.body.pipeThrough(new TextDecoderStream()).getReader(); 16 | 17 | let finaltext = ""; 18 | while (true) { 19 | const { value: token, done } = await reader.read(); 20 | 21 | if (token != undefined) update((val) => { 22 | finaltext = val.text + token; 23 | return ({ loading: true, text: finaltext }); 24 | }); 25 | if (done) break; 26 | } 27 | 28 | set({ loading: false, text: "" }); 29 | 30 | return finaltext; 31 | } catch (err: any) { 32 | set({ loading: false, text: err.toString() }); 33 | throw err; 34 | } 35 | } 36 | 37 | return { subscribe, request }; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/lib/typingindicator.svelte: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 50 | -------------------------------------------------------------------------------- /src/routes/+layout.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 7 |
8 | -------------------------------------------------------------------------------- /src/routes/+page.svelte: -------------------------------------------------------------------------------- 1 | 39 | 40 |
41 |
42 |

Chat!

43 |

Example made for Intelligent Svelte.

44 |
45 | 46 |
47 |
48 | {#await new Promise((res) => setTimeout(res, 400)) then _} 49 |
50 |
51 | Hello! How can I help you today? 52 |
53 |
54 | {/await} 55 | 56 | {#each chat_history as chat} 57 | {#if chat.role == "user"} 58 |
59 |
60 | {#await markdownParser(chat.content)} 61 | {chat.content} 62 | {:then html} 63 | {@html html} 64 | {/await} 65 |
66 |
67 | {:else} 68 |
69 |
70 | {#await markdownParser(chat.content)} 71 | {chat.content} 72 | {:then html} 73 | {@html html} 74 | {/await} 75 |
76 |
77 | {/if} 78 | {/each} 79 | 80 | {#if $response.loading} 81 | {#await new Promise((res) => setTimeout(res, 400)) then _} 82 |
83 |
84 | {#if $response.text == ""} 85 | 86 | {:else} 87 | {#await markdownParser($response.text)} 88 | {$response.text} 89 | {:then html} 90 | {@html html} 91 | {/await} 92 | {/if} 93 |
94 | {#if $response.text != ""} 95 |
96 |
97 | 98 | 99 | 100 | 101 |
102 | {/if} 103 |
104 | {/await} 105 | {/if} 106 |
107 | 108 |
109 | 110 | 111 | 112 | 113 | 114 | 115 |
116 | 117 | 138 | -------------------------------------------------------------------------------- /src/routes/api/chat/+server.ts: -------------------------------------------------------------------------------- 1 | import { OPENAI_KEY } from "$env/static/private"; 2 | 3 | import { OpenAIChat } from "langchain/llms/openai"; 4 | import { CallbackManager } from "langchain/callbacks"; 5 | import { ChatPromptTemplate, HumanMessagePromptTemplate, PromptTemplate, SystemMessagePromptTemplate } from "langchain/prompts"; 6 | import { LLMChain } from "langchain/chains"; 7 | import { ChatOpenAI } from "langchain/chat_models/openai"; 8 | import { HumanChatMessage, AIChatMessage, SystemChatMessage } from "langchain/schema"; 9 | 10 | import { error } from '@sveltejs/kit'; 11 | 12 | export type MessageBody = { chats: { role: "user" | "assistant", content: string }[] } 13 | 14 | export const POST = async ({ request }) => { 15 | const body: MessageBody = await request.json(); 16 | 17 | if (!body) throw error(400, 'Missing Data'); 18 | 19 | // Create a new readable stream of the chat response 20 | const readableStream = new ReadableStream({ 21 | async start(controller) { 22 | const chat = new ChatOpenAI({ 23 | openAIApiKey: OPENAI_KEY, 24 | modelName: "gpt-4", 25 | streaming: true, 26 | callbackManager: CallbackManager.fromHandlers({ 27 | handleLLMNewToken: async (token: string) => controller.enqueue(token), 28 | }), 29 | }); 30 | 31 | await chat.call([ 32 | new SystemChatMessage("You are a helpful assistant. Limit prose. Answer with markdown where appropiate."), 33 | new AIChatMessage("Hello! How can I help you today?"), 34 | ...body.chats.map(chat => chat.role == "user" 35 | ? new HumanChatMessage(chat.content) 36 | : new AIChatMessage(chat.content) 37 | ) 38 | ]); 39 | 40 | controller.close(); 41 | }, 42 | }); 43 | 44 | // Create and return a response of the readable stream 45 | return new Response(readableStream, { 46 | headers: { 'Content-Type': 'text/plain' }, 47 | }); 48 | } 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/semicognitive/sveltekit-chat/0b3b949b70ec50e3aaf81f6b304a9e3a4cfbb612/static/favicon.png -------------------------------------------------------------------------------- /svelte.config.js: -------------------------------------------------------------------------------- 1 | import adapter from '@sveltejs/adapter-cloudflare-workers'; 2 | import { vitePreprocess } from '@sveltejs/kit/vite'; 3 | 4 | /** @type {import('@sveltejs/kit').Config} */ 5 | const config = { 6 | // Consult https://kit.svelte.dev/docs/integrations#preprocessors 7 | // for more information about preprocessors 8 | preprocess: vitePreprocess(), 9 | 10 | kit: { 11 | adapter: adapter(), 12 | moduleExtensions: [".js", ".ts", ".py"], 13 | } 14 | }; 15 | 16 | export default config; 17 | -------------------------------------------------------------------------------- /tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ['./src/**/*.{html,js,svelte,ts}'], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [ 8 | require('@tailwindcss/forms'), 9 | require('@tailwindcss/typography'), 10 | ], 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.svelte-kit/tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "checkJs": true, 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "resolveJsonModule": true, 9 | "skipLibCheck": true, 10 | "sourceMap": true, 11 | "strict": true 12 | } 13 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias 14 | // 15 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes 16 | // from the referenced tsconfig.json - TypeScript does not merge them in 17 | } 18 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import { defineConfig } from 'vite'; 3 | 4 | export default defineConfig({ 5 | plugins: [sveltekit()] 6 | }); 7 | -------------------------------------------------------------------------------- /wrangler.toml: -------------------------------------------------------------------------------- 1 | name = "sveltekit-modal-stablediffusion" 2 | account_id = "" 3 | 4 | main = "./.cloudflare/worker.js" 5 | site.bucket = "./.cloudflare/public" 6 | 7 | build.command = "npm run build" 8 | 9 | compatibility_date = "2021-11-12" 10 | workers_dev = true 11 | --------------------------------------------------------------------------------