loopwind 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -117
- package/dist/cli.js +16 -10
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +6 -10
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/agent.d.ts +8 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +101 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +17 -7
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/render.d.ts.map +1 -1
- package/dist/commands/render.js +17 -19
- package/dist/commands/render.js.map +1 -1
- package/dist/default-templates/AGENTS.md +10 -24
- package/dist/lib/config.d.ts +2 -3
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +4 -9
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +1 -3
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +2 -4
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/installer.d.ts +2 -0
- package/dist/lib/installer.d.ts.map +1 -1
- package/dist/lib/installer.js +6 -7
- package/dist/lib/installer.js.map +1 -1
- package/dist/lib/renderer.d.ts.map +1 -1
- package/dist/lib/renderer.js +14 -8
- package/dist/lib/renderer.js.map +1 -1
- package/dist/lib/resvg-init.d.ts +15 -0
- package/dist/lib/resvg-init.d.ts.map +1 -0
- package/dist/lib/resvg-init.js +55 -0
- package/dist/lib/resvg-init.js.map +1 -0
- package/dist/lib/tailwind/colors.d.ts +8 -0
- package/dist/lib/tailwind/colors.d.ts.map +1 -0
- package/dist/lib/tailwind/colors.js +102 -0
- package/dist/lib/tailwind/colors.js.map +1 -0
- package/dist/lib/tailwind/index.d.ts +10 -0
- package/dist/lib/tailwind/index.d.ts.map +1 -0
- package/dist/lib/tailwind/index.js +9 -0
- package/dist/lib/tailwind/index.js.map +1 -0
- package/dist/lib/tailwind/resolvers.d.ts +28 -0
- package/dist/lib/tailwind/resolvers.d.ts.map +1 -0
- package/dist/lib/tailwind/resolvers.js +94 -0
- package/dist/lib/tailwind/resolvers.js.map +1 -0
- package/dist/lib/tailwind/types.d.ts +29 -0
- package/dist/lib/tailwind/types.d.ts.map +1 -0
- package/dist/lib/tailwind/types.js +8 -0
- package/dist/lib/tailwind/types.js.map +1 -0
- package/dist/lib/tailwind-config-loader.d.ts +8 -45
- package/dist/lib/tailwind-config-loader.d.ts.map +1 -1
- package/dist/lib/tailwind-config-loader.js +6 -429
- package/dist/lib/tailwind-config-loader.js.map +1 -1
- package/dist/lib/tailwind.d.ts +1 -1
- package/dist/lib/tailwind.d.ts.map +1 -1
- package/dist/lib/tailwind.js +1 -1
- package/dist/lib/tailwind.js.map +1 -1
- package/dist/lib/utils.d.ts +13 -29
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +45 -155
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/video-renderer.d.ts.map +1 -1
- package/dist/lib/video-renderer.js +6 -5
- package/dist/lib/video-renderer.js.map +1 -1
- package/dist/types/config.d.ts +0 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/package.json +2 -12
- package/REGISTRY_SETUP.md +0 -363
- package/_dsgn/templates/dashed-stroke-test/template.tsx +0 -73
- package/_dsgn/templates/path-follow-test/template.tsx +0 -176
- package/_dsgn/templates/path-simple-test/template.tsx +0 -98
- package/_dsgn/templates/stroke-dash-test/meta.json +0 -12
- package/_dsgn/templates/stroke-dash-test/template.tsx +0 -53
- package/dist/default-templates/image/template.d.ts +0 -20
- package/dist/default-templates/image/template.d.ts.map +0 -1
- package/dist/default-templates/image/template.js +0 -18
- package/dist/default-templates/image/template.js.map +0 -1
- package/dist/default-templates/image/template.tsx +0 -20
- package/dist/default-templates/kitchen-sink/template.tsx +0 -64
- package/dist/default-templates/page/template.tsx +0 -37
- package/dist/default-templates/video/template.d.ts +0 -26
- package/dist/default-templates/video/template.d.ts.map +0 -1
- package/dist/default-templates/video/template.js +0 -33
- package/dist/default-templates/video/template.js.map +0 -1
- package/dist/default-templates/video/template.tsx +0 -37
- package/dist/default-templates/website/pages/home.tsx +0 -17
- package/dist/default-templates/website/parts/footer.tsx +0 -17
- package/dist/default-templates/website/parts/header.tsx +0 -17
- package/dist/default-templates/website/template.tsx +0 -17
- package/dist/default-templates/website-template/pages/home.tsx +0 -13
- package/dist/default-templates/website-template/parts/footer.tsx +0 -15
- package/dist/default-templates/website-template/parts/header.tsx +0 -15
- package/dist/default-templates/website-template/template.tsx +0 -32
- package/dist/lib/encode-worker.d.ts +0 -2
- package/dist/lib/encode-worker.d.ts.map +0 -1
- package/dist/lib/encode-worker.js +0 -29
- package/dist/lib/encode-worker.js.map +0 -1
- package/dist/lib/mjpeg-muxer.d.ts +0 -46
- package/dist/lib/mjpeg-muxer.d.ts.map +0 -1
- package/dist/lib/mjpeg-muxer.js +0 -513
- package/dist/lib/mjpeg-muxer.js.map +0 -1
- package/dist/lib/tailwind-browser.d.ts +0 -27
- package/dist/lib/tailwind-browser.d.ts.map +0 -1
- package/dist/lib/tailwind-browser.js +0 -853
- package/dist/lib/tailwind-browser.js.map +0 -1
- package/dist/lib/video-player.d.ts +0 -25
- package/dist/lib/video-player.d.ts.map +0 -1
- package/dist/lib/video-player.js +0 -392
- package/dist/lib/video-player.js.map +0 -1
- package/dist/sdk/compiler.d.ts +0 -94
- package/dist/sdk/compiler.d.ts.map +0 -1
- package/dist/sdk/compiler.js +0 -122
- package/dist/sdk/compiler.js.map +0 -1
- package/dist/sdk/index.d.ts +0 -62
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js +0 -141
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/preview.d.ts +0 -65
- package/dist/sdk/preview.d.ts.map +0 -1
- package/dist/sdk/preview.js +0 -262
- package/dist/sdk/preview.js.map +0 -1
- package/dist/sdk/template.d.ts +0 -162
- package/dist/sdk/template.d.ts.map +0 -1
- package/dist/sdk/template.js +0 -231
- package/dist/sdk/template.js.map +0 -1
- package/examples/code-editor-templates.ts +0 -173
- package/examples/nextjs-api/README.md +0 -180
- package/examples/nextjs-api/package.json +0 -21
- package/examples/nextjs-api/pages/api/intro-video.ts +0 -53
- package/examples/nextjs-api/pages/api/og-image.ts +0 -50
- package/examples/nextjs-template-import.ts +0 -58
- package/examples/sdk-video-preview.tsx +0 -120
- package/examples/template-compiler-workflow.ts +0 -251
- package/examples/visual-builder-templates.ts +0 -336
- package/render-examples-600x400.mjs +0 -161
- package/render-spring-variants-fixed.mjs +0 -60
- package/render-staggered-text.mjs +0 -56
- package/test-font-files.mjs +0 -72
- package/test-jsx-support.mjs +0 -146
- package/test-sdk-config.mjs +0 -454
- package/test-sdk-source-config.mjs +0 -427
- package/test-sdk-user-templates.mjs +0 -469
- package/test-static-debug.tsx +0 -19
- package/test-templates/TESTS.md +0 -63
- package/test-templates/config-test.mjs +0 -17
- package/test-templates/demo-intro-props.json +0 -4
- package/test-templates/run-tests.sh +0 -44
- package/test-templates/test-sdk.mjs +0 -139
- package/test-video-props.json +0 -3
- package/website/.astro/content.db +0 -0
- package/website/.astro/integrations/_inox-tools_astro-when/types.d.ts +0 -1
- package/website/.astro/integrations/astro_db/db.d.ts +0 -15
- package/website/.astro/settings.json +0 -5
- package/website/.astro/types.d.ts +0 -2
- package/website/DEPLOYMENT.md +0 -143
- package/website/OG_IMAGES.md +0 -142
- package/website/README.md +0 -158
- package/website/astro.config.mjs +0 -46
- package/website/dist/.gitkeep +0 -5
- package/website/dist/_astro/agents.Yx-L_igG.css +0 -1
- package/website/dist/_routes.json +0 -30
- package/website/dist/_worker.js/_@astrojs-ssr-adapter.mjs +0 -1033
- package/website/dist/_worker.js/_astro-internal_middleware.mjs +0 -40
- package/website/dist/_worker.js/chunks/abap_BTmsHiP5.mjs +0 -1
- package/website/dist/_worker.js/chunks/actionscript-3_DmBelb1E.mjs +0 -1
- package/website/dist/_worker.js/chunks/ada_8-E0ahCN.mjs +0 -1
- package/website/dist/_worker.js/chunks/andromeeda_XI-CXx50.mjs +0 -1
- package/website/dist/_worker.js/chunks/angular-html_DKGh3gGH.mjs +0 -1
- package/website/dist/_worker.js/chunks/angular-ts_-qZGsJoA.mjs +0 -1
- package/website/dist/_worker.js/chunks/apache_ijTUt0Ee.mjs +0 -1
- package/website/dist/_worker.js/chunks/apex_agu1c6Sh.mjs +0 -1
- package/website/dist/_worker.js/chunks/apl_Bj2f7Art.mjs +0 -1
- package/website/dist/_worker.js/chunks/applescript_B_vXrOh3.mjs +0 -1
- package/website/dist/_worker.js/chunks/ara_DCEQ2rnh.mjs +0 -1
- package/website/dist/_worker.js/chunks/asciidoc_CGN_EkYS.mjs +0 -1
- package/website/dist/_worker.js/chunks/asm_BBWZgnDp.mjs +0 -1
- package/website/dist/_worker.js/chunks/astro/assets-service_j52rQLzU.mjs +0 -721
- package/website/dist/_worker.js/chunks/astro/server_Y5_QHO8v.mjs +0 -2401
- package/website/dist/_worker.js/chunks/astro-designed-error-pages_BNTLO-TA.mjs +0 -542
- package/website/dist/_worker.js/chunks/astro_Dr_hht3h.mjs +0 -1
- package/website/dist/_worker.js/chunks/aurora-x_9GHG8nSq.mjs +0 -1
- package/website/dist/_worker.js/chunks/awk_DHRvhXot.mjs +0 -1
- package/website/dist/_worker.js/chunks/ayu-dark_CcvqmEHE.mjs +0 -1
- package/website/dist/_worker.js/chunks/ballerina_C7SdeSZb.mjs +0 -1
- package/website/dist/_worker.js/chunks/bat_Dv4A3u45.mjs +0 -1
- package/website/dist/_worker.js/chunks/beancount_BfPf9Luv.mjs +0 -1
- package/website/dist/_worker.js/chunks/berry_B8rfM3lL.mjs +0 -1
- package/website/dist/_worker.js/chunks/bibtex_TcjYgtJM.mjs +0 -1
- package/website/dist/_worker.js/chunks/bicep_CrlFWCdN.mjs +0 -1
- package/website/dist/_worker.js/chunks/blade_lanKVYID.mjs +0 -1
- package/website/dist/_worker.js/chunks/bsl_BhppzXMB.mjs +0 -1
- package/website/dist/_worker.js/chunks/c_6FBALJTK.mjs +0 -1
- package/website/dist/_worker.js/chunks/cadence_2txU9LVE.mjs +0 -1
- package/website/dist/_worker.js/chunks/cairo_BkrFAIlP.mjs +0 -1
- package/website/dist/_worker.js/chunks/catppuccin-frappe_CkEqIYhU.mjs +0 -1
- package/website/dist/_worker.js/chunks/catppuccin-latte_DG4Gx_-v.mjs +0 -1
- package/website/dist/_worker.js/chunks/catppuccin-macchiato_Cwi3vCXf.mjs +0 -1
- package/website/dist/_worker.js/chunks/catppuccin-mocha_L9_OPlFX.mjs +0 -1
- package/website/dist/_worker.js/chunks/clarity_BEAe4Ulu.mjs +0 -1
- package/website/dist/_worker.js/chunks/clojure_VnUX6p2g.mjs +0 -1
- package/website/dist/_worker.js/chunks/cmake_0-SGkZEj.mjs +0 -1
- package/website/dist/_worker.js/chunks/cobol_92M_KGaE.mjs +0 -1
- package/website/dist/_worker.js/chunks/codeowners_CzMwskBv.mjs +0 -1
- package/website/dist/_worker.js/chunks/codeql_DWJZNHv1.mjs +0 -1
- package/website/dist/_worker.js/chunks/coffee_CQjKU2fh.mjs +0 -1
- package/website/dist/_worker.js/chunks/common-lisp_BBLWDpS5.mjs +0 -1
- package/website/dist/_worker.js/chunks/coq_hedRFV3D.mjs +0 -1
- package/website/dist/_worker.js/chunks/cpp_DlS1i6Zs.mjs +0 -1
- package/website/dist/_worker.js/chunks/crystal_D6n65fKV.mjs +0 -1
- package/website/dist/_worker.js/chunks/csharp_C6FCVFzc.mjs +0 -1
- package/website/dist/_worker.js/chunks/css_C5uJEgmJ.mjs +0 -1
- package/website/dist/_worker.js/chunks/csv_CtMYuuJl.mjs +0 -1
- package/website/dist/_worker.js/chunks/cue_BsPexqx6.mjs +0 -1
- package/website/dist/_worker.js/chunks/cypher_apzf6OBi.mjs +0 -1
- package/website/dist/_worker.js/chunks/d_DcvIRcgm.mjs +0 -1
- package/website/dist/_worker.js/chunks/dark-plus_C01ONtzj.mjs +0 -1
- package/website/dist/_worker.js/chunks/dart_WkzM5WrV.mjs +0 -1
- package/website/dist/_worker.js/chunks/dax_DjXAO5V4.mjs +0 -1
- package/website/dist/_worker.js/chunks/desktop_C92LCxdc.mjs +0 -1
- package/website/dist/_worker.js/chunks/diff_CVwM_9XJ.mjs +0 -1
- package/website/dist/_worker.js/chunks/docker_DPzgJf6Z.mjs +0 -1
- package/website/dist/_worker.js/chunks/dotenv_D_vgANvA.mjs +0 -1
- package/website/dist/_worker.js/chunks/dracula-soft_CLnUBwFm.mjs +0 -1
- package/website/dist/_worker.js/chunks/dracula_lBVpb6Lb.mjs +0 -1
- package/website/dist/_worker.js/chunks/dream-maker_DTLbzd_J.mjs +0 -1
- package/website/dist/_worker.js/chunks/edge_i54JYm3_.mjs +0 -1
- package/website/dist/_worker.js/chunks/elixir_BJCIjTu4.mjs +0 -1
- package/website/dist/_worker.js/chunks/elm_BbXD39-_.mjs +0 -1
- package/website/dist/_worker.js/chunks/emacs-lisp_pxa5cXaN.mjs +0 -1
- package/website/dist/_worker.js/chunks/erb_Ccjijeee.mjs +0 -1
- package/website/dist/_worker.js/chunks/erlang_B2VM_hi7.mjs +0 -1
- package/website/dist/_worker.js/chunks/everforest-dark_BxvIPBim.mjs +0 -1
- package/website/dist/_worker.js/chunks/everforest-light_B7VoyaJM.mjs +0 -1
- package/website/dist/_worker.js/chunks/fennel_D-uo7X6c.mjs +0 -1
- package/website/dist/_worker.js/chunks/fish_BjePoK3m.mjs +0 -1
- package/website/dist/_worker.js/chunks/fluent_C8fgkzLX.mjs +0 -1
- package/website/dist/_worker.js/chunks/fortran-fixed-form_D1pu5zrc.mjs +0 -1
- package/website/dist/_worker.js/chunks/fortran-free-form_CSGOhJD6.mjs +0 -1
- package/website/dist/_worker.js/chunks/fsharp_B0xy-A4Y.mjs +0 -1
- package/website/dist/_worker.js/chunks/gdresource_CWppjlHq.mjs +0 -1
- package/website/dist/_worker.js/chunks/gdscript_eQCHchcS.mjs +0 -1
- package/website/dist/_worker.js/chunks/gdshader_C4kxepX7.mjs +0 -1
- package/website/dist/_worker.js/chunks/genie_ACtQLcDW.mjs +0 -1
- package/website/dist/_worker.js/chunks/gherkin_BFp2uKUd.mjs +0 -1
- package/website/dist/_worker.js/chunks/git-commit_CLg9ZwMV.mjs +0 -1
- package/website/dist/_worker.js/chunks/git-rebase_DG8A80Nt.mjs +0 -1
- package/website/dist/_worker.js/chunks/github-dark-default_BI0EP2Kv.mjs +0 -1
- package/website/dist/_worker.js/chunks/github-dark-dimmed_a_NIC0Xb.mjs +0 -1
- package/website/dist/_worker.js/chunks/github-dark-high-contrast_jZGqT7hk.mjs +0 -1
- package/website/dist/_worker.js/chunks/github-dark_CHCDNd2O.mjs +0 -1
- package/website/dist/_worker.js/chunks/github-light-default_DRbOW5RG.mjs +0 -1
- package/website/dist/_worker.js/chunks/github-light-high-contrast_tn_kWutM.mjs +0 -1
- package/website/dist/_worker.js/chunks/github-light_D9brYzot.mjs +0 -1
- package/website/dist/_worker.js/chunks/gleam_Dmhu1oxW.mjs +0 -1
- package/website/dist/_worker.js/chunks/glimmer-js_BfZbXy8A.mjs +0 -1
- package/website/dist/_worker.js/chunks/glimmer-ts_B9QVICrD.mjs +0 -1
- package/website/dist/_worker.js/chunks/glsl_DD2PPwOs.mjs +0 -1
- package/website/dist/_worker.js/chunks/gnuplot_D2OYChUX.mjs +0 -1
- package/website/dist/_worker.js/chunks/go_DYGFTe3h.mjs +0 -1
- package/website/dist/_worker.js/chunks/graphql_B7XsT3nH.mjs +0 -1
- package/website/dist/_worker.js/chunks/groovy_BO12Uwkl.mjs +0 -1
- package/website/dist/_worker.js/chunks/hack_CB2_ztCP.mjs +0 -1
- package/website/dist/_worker.js/chunks/haml_CyfDcDD3.mjs +0 -1
- package/website/dist/_worker.js/chunks/handlebars_CfpxpWm2.mjs +0 -1
- package/website/dist/_worker.js/chunks/haskell_jUeC5uN5.mjs +0 -1
- package/website/dist/_worker.js/chunks/haxe_B6GxP1WB.mjs +0 -1
- package/website/dist/_worker.js/chunks/hcl_DwoHV2oh.mjs +0 -1
- package/website/dist/_worker.js/chunks/hjson_DV7cJRk4.mjs +0 -1
- package/website/dist/_worker.js/chunks/hlsl_BlFCscPI.mjs +0 -1
- package/website/dist/_worker.js/chunks/houston_COBFG1Mx.mjs +0 -1
- package/website/dist/_worker.js/chunks/html-derivative_C9pJ337h.mjs +0 -1
- package/website/dist/_worker.js/chunks/html_D1OkrZS5.mjs +0 -1
- package/website/dist/_worker.js/chunks/http_DIGXRqvJ.mjs +0 -1
- package/website/dist/_worker.js/chunks/hxml_DEwh9i-c.mjs +0 -1
- package/website/dist/_worker.js/chunks/hy_DDoIgW1K.mjs +0 -1
- package/website/dist/_worker.js/chunks/imba_B00zbHo4.mjs +0 -1
- package/website/dist/_worker.js/chunks/index_C1UTDwYg.mjs +0 -1861
- package/website/dist/_worker.js/chunks/ini_D7XQA_p8.mjs +0 -1
- package/website/dist/_worker.js/chunks/java_B9wdFd8K.mjs +0 -1
- package/website/dist/_worker.js/chunks/javascript_CLsPGOON.mjs +0 -1
- package/website/dist/_worker.js/chunks/jinja_jarBCAN1.mjs +0 -1
- package/website/dist/_worker.js/chunks/jison_oGg3J708.mjs +0 -1
- package/website/dist/_worker.js/chunks/json5_DlZ1Kyaa.mjs +0 -1
- package/website/dist/_worker.js/chunks/json_DaYk_FMp.mjs +0 -1
- package/website/dist/_worker.js/chunks/jsonc_DlwgfSDs.mjs +0 -1
- package/website/dist/_worker.js/chunks/jsonl_BbCCVaZF.mjs +0 -1
- package/website/dist/_worker.js/chunks/jsonnet_Dt-G75xe.mjs +0 -1
- package/website/dist/_worker.js/chunks/jssm_BtKFTj2A.mjs +0 -1
- package/website/dist/_worker.js/chunks/jsx_DDx_xAZ8.mjs +0 -1
- package/website/dist/_worker.js/chunks/julia_CK0lv68l.mjs +0 -1
- package/website/dist/_worker.js/chunks/kanagawa-dragon_BldAK3Oo.mjs +0 -1
- package/website/dist/_worker.js/chunks/kanagawa-lotus_DVM8FX9_.mjs +0 -1
- package/website/dist/_worker.js/chunks/kanagawa-wave_Dpih0AKP.mjs +0 -1
- package/website/dist/_worker.js/chunks/kotlin_kWneB9V_.mjs +0 -1
- package/website/dist/_worker.js/chunks/kusto_BKVATd95.mjs +0 -1
- package/website/dist/_worker.js/chunks/laserwave_BqatxsVl.mjs +0 -1
- package/website/dist/_worker.js/chunks/latex_LVDcGBbc.mjs +0 -1
- package/website/dist/_worker.js/chunks/lean_W7qo-5M2.mjs +0 -1
- package/website/dist/_worker.js/chunks/less_DFNwJnBH.mjs +0 -1
- package/website/dist/_worker.js/chunks/light-plus_Dp0AoWsO.mjs +0 -1
- package/website/dist/_worker.js/chunks/liquid_D24qs0pc.mjs +0 -1
- package/website/dist/_worker.js/chunks/log_IPWMXriF.mjs +0 -1
- package/website/dist/_worker.js/chunks/logo_C6KaatrQ.mjs +0 -1
- package/website/dist/_worker.js/chunks/lua_CwnEf-T7.mjs +0 -1
- package/website/dist/_worker.js/chunks/luau_Br3-CXjS.mjs +0 -1
- package/website/dist/_worker.js/chunks/make_UBNG-kOo.mjs +0 -1
- package/website/dist/_worker.js/chunks/markdown_C7mhJFCm.mjs +0 -1
- package/website/dist/_worker.js/chunks/marko_4tchUvI7.mjs +0 -1
- package/website/dist/_worker.js/chunks/material-theme-darker_SKtaNEPn.mjs +0 -1
- package/website/dist/_worker.js/chunks/material-theme-lighter_zOX_DZCH.mjs +0 -1
- package/website/dist/_worker.js/chunks/material-theme-ocean_BN9WbhdC.mjs +0 -1
- package/website/dist/_worker.js/chunks/material-theme-palenight_DT_covjH.mjs +0 -1
- package/website/dist/_worker.js/chunks/material-theme_6RpeM3kc.mjs +0 -1
- package/website/dist/_worker.js/chunks/matlab_DCOXsPKR.mjs +0 -1
- package/website/dist/_worker.js/chunks/mdc_B9gb2UFP.mjs +0 -1
- package/website/dist/_worker.js/chunks/mdx_DGU7Nu9u.mjs +0 -1
- package/website/dist/_worker.js/chunks/mermaid_B69URzsZ.mjs +0 -1
- package/website/dist/_worker.js/chunks/min-dark_BgxifOMI.mjs +0 -1
- package/website/dist/_worker.js/chunks/min-light_BrPjXxUp.mjs +0 -1
- package/website/dist/_worker.js/chunks/mipsasm_9U-4_t7k.mjs +0 -1
- package/website/dist/_worker.js/chunks/mojo_B0wt7ug3.mjs +0 -1
- package/website/dist/_worker.js/chunks/monokai_B6Pxpoyi.mjs +0 -1
- package/website/dist/_worker.js/chunks/move_1eid4CyR.mjs +0 -1
- package/website/dist/_worker.js/chunks/narrat_Ds6-p5JZ.mjs +0 -1
- package/website/dist/_worker.js/chunks/nextflow_v2N1Qlqa.mjs +0 -1
- package/website/dist/_worker.js/chunks/nginx_Bp9Ab2NH.mjs +0 -1
- package/website/dist/_worker.js/chunks/night-owl_CdwOw_sc.mjs +0 -1
- package/website/dist/_worker.js/chunks/nim_BXGDUe53.mjs +0 -1
- package/website/dist/_worker.js/chunks/nix_CUig1nJH.mjs +0 -1
- package/website/dist/_worker.js/chunks/noop-middleware_DlWGj5t5.mjs +0 -10
- package/website/dist/_worker.js/chunks/nord_SPoG1iae.mjs +0 -1
- package/website/dist/_worker.js/chunks/nushell_DJw1Lca8.mjs +0 -1
- package/website/dist/_worker.js/chunks/objective-c_Bktzl_CO.mjs +0 -1
- package/website/dist/_worker.js/chunks/objective-cpp_CP4DWdDp.mjs +0 -1
- package/website/dist/_worker.js/chunks/ocaml_CeEAs7bZ.mjs +0 -1
- package/website/dist/_worker.js/chunks/one-dark-pro_-hIwCNMi.mjs +0 -1
- package/website/dist/_worker.js/chunks/one-light_DSmYvJ05.mjs +0 -1
- package/website/dist/_worker.js/chunks/pascal_C-S_Ms_o.mjs +0 -1
- package/website/dist/_worker.js/chunks/perl_CKamvo15.mjs +0 -1
- package/website/dist/_worker.js/chunks/php_BlmcX_F3.mjs +0 -1
- package/website/dist/_worker.js/chunks/plastic_Ryt8tVoA.mjs +0 -1
- package/website/dist/_worker.js/chunks/plsql_Cb3v7cBj.mjs +0 -1
- package/website/dist/_worker.js/chunks/po_DZbdNRlo.mjs +0 -1
- package/website/dist/_worker.js/chunks/poimandres_bYmE3_5d.mjs +0 -1
- package/website/dist/_worker.js/chunks/polar_pJkMGwoW.mjs +0 -1
- package/website/dist/_worker.js/chunks/postcss_BAXSOKgk.mjs +0 -1
- package/website/dist/_worker.js/chunks/powerquery_oITMGN4x.mjs +0 -1
- package/website/dist/_worker.js/chunks/powershell_6306-xIF.mjs +0 -1
- package/website/dist/_worker.js/chunks/prisma_DSDxnZGz.mjs +0 -1
- package/website/dist/_worker.js/chunks/prolog_CxG7tjZR.mjs +0 -1
- package/website/dist/_worker.js/chunks/proto_CS9ByXm1.mjs +0 -1
- package/website/dist/_worker.js/chunks/pug_BMtLJo6U.mjs +0 -1
- package/website/dist/_worker.js/chunks/puppet_BfeeSzee.mjs +0 -1
- package/website/dist/_worker.js/chunks/purescript_BFfueNaH.mjs +0 -1
- package/website/dist/_worker.js/chunks/python_Cc4Faapv.mjs +0 -1
- package/website/dist/_worker.js/chunks/qml_C1CTJTK8.mjs +0 -1
- package/website/dist/_worker.js/chunks/qmldir_nG1KaqKR.mjs +0 -1
- package/website/dist/_worker.js/chunks/qss_Cncxk263.mjs +0 -1
- package/website/dist/_worker.js/chunks/r_ChR54Ihi.mjs +0 -1
- package/website/dist/_worker.js/chunks/racket_BDrhptDs.mjs +0 -1
- package/website/dist/_worker.js/chunks/raku_07OUHa0P.mjs +0 -1
- package/website/dist/_worker.js/chunks/razor_DIP3INLa.mjs +0 -1
- package/website/dist/_worker.js/chunks/red_DOPXfj-6.mjs +0 -1
- package/website/dist/_worker.js/chunks/reg_B64SwEDj.mjs +0 -1
- package/website/dist/_worker.js/chunks/regexp_ButFGoB5.mjs +0 -1
- package/website/dist/_worker.js/chunks/rel_BWJAWqZD.mjs +0 -1
- package/website/dist/_worker.js/chunks/riscv_79gXlbsF.mjs +0 -1
- package/website/dist/_worker.js/chunks/rose-pine-dawn_DHIjVGd3.mjs +0 -1
- package/website/dist/_worker.js/chunks/rose-pine-moon_t86aEbs0.mjs +0 -1
- package/website/dist/_worker.js/chunks/rose-pine_BHgrcDCs.mjs +0 -1
- package/website/dist/_worker.js/chunks/rst_D3F4Fcpj.mjs +0 -1
- package/website/dist/_worker.js/chunks/ruby_Cs7vM9iv.mjs +0 -1
- package/website/dist/_worker.js/chunks/rust_DpyRVatH.mjs +0 -1
- package/website/dist/_worker.js/chunks/sas_DW45xZXN.mjs +0 -1
- package/website/dist/_worker.js/chunks/sass_C6SiMwN_.mjs +0 -1
- package/website/dist/_worker.js/chunks/scala_DlZOjNZk.mjs +0 -1
- package/website/dist/_worker.js/chunks/scheme_D2ezSJXu.mjs +0 -1
- package/website/dist/_worker.js/chunks/scss_DG5Spjqu.mjs +0 -1
- package/website/dist/_worker.js/chunks/sdbl_ZCYaj4VN.mjs +0 -1
- package/website/dist/_worker.js/chunks/shaderlab_CAcRkg1_.mjs +0 -1
- package/website/dist/_worker.js/chunks/shellscript_BWwhkDVh.mjs +0 -1
- package/website/dist/_worker.js/chunks/shellsession_BfEA3juK.mjs +0 -1
- package/website/dist/_worker.js/chunks/slack-dark_CL3lSpCc.mjs +0 -1
- package/website/dist/_worker.js/chunks/slack-ochin_DdZKOQVh.mjs +0 -1
- package/website/dist/_worker.js/chunks/smalltalk_DgilzSui.mjs +0 -1
- package/website/dist/_worker.js/chunks/snazzy-light_eJU08Pz_.mjs +0 -1
- package/website/dist/_worker.js/chunks/solarized-dark_Dg_YQywx.mjs +0 -1
- package/website/dist/_worker.js/chunks/solarized-light_BnIsrA6p.mjs +0 -1
- package/website/dist/_worker.js/chunks/solidity_DkseH8pQ.mjs +0 -1
- package/website/dist/_worker.js/chunks/soy_DU7bOYoG.mjs +0 -1
- package/website/dist/_worker.js/chunks/sparql_BuI1DBDH.mjs +0 -1
- package/website/dist/_worker.js/chunks/splunk_B8Ha9Pkg.mjs +0 -1
- package/website/dist/_worker.js/chunks/sql_BniHwea5.mjs +0 -1
- package/website/dist/_worker.js/chunks/ssh-config_CkE1GuVe.mjs +0 -1
- package/website/dist/_worker.js/chunks/stata_Dtqpbd_l.mjs +0 -1
- package/website/dist/_worker.js/chunks/stylus_CXTtglzO.mjs +0 -1
- package/website/dist/_worker.js/chunks/svelte_BjWYcUCN.mjs +0 -1
- package/website/dist/_worker.js/chunks/swift_BzHql_rM.mjs +0 -1
- package/website/dist/_worker.js/chunks/synthwave-84_DLRNhxNA.mjs +0 -1
- package/website/dist/_worker.js/chunks/system-verilog_ChyInPph.mjs +0 -1
- package/website/dist/_worker.js/chunks/systemd_Bi9Qa2qD.mjs +0 -1
- package/website/dist/_worker.js/chunks/talonscript_B3sH_Y-V.mjs +0 -1
- package/website/dist/_worker.js/chunks/tasl_BJ5yipRs.mjs +0 -1
- package/website/dist/_worker.js/chunks/tcl_CoJQjNoP.mjs +0 -1
- package/website/dist/_worker.js/chunks/templ_CrU7Ffil.mjs +0 -1
- package/website/dist/_worker.js/chunks/terraform_DT9JSFpC.mjs +0 -1
- package/website/dist/_worker.js/chunks/tex_5PKu2yA0.mjs +0 -1
- package/website/dist/_worker.js/chunks/tokyo-night_Buo8OK7-.mjs +0 -1
- package/website/dist/_worker.js/chunks/toml_CPuXX3oc.mjs +0 -1
- package/website/dist/_worker.js/chunks/ts-tags_D0M_1VSH.mjs +0 -1
- package/website/dist/_worker.js/chunks/tsv_CuivVNot.mjs +0 -1
- package/website/dist/_worker.js/chunks/tsx_MkuGr8MY.mjs +0 -1
- package/website/dist/_worker.js/chunks/turtle_BqgEPK7f.mjs +0 -1
- package/website/dist/_worker.js/chunks/twig_r1G9rpYJ.mjs +0 -1
- package/website/dist/_worker.js/chunks/typescript_Au5buqzM.mjs +0 -1
- package/website/dist/_worker.js/chunks/typespec_47rhBK_z.mjs +0 -1
- package/website/dist/_worker.js/chunks/typst_BAtuQLh-.mjs +0 -1
- package/website/dist/_worker.js/chunks/v_BIvWImHg.mjs +0 -1
- package/website/dist/_worker.js/chunks/vala_DYEacj30.mjs +0 -1
- package/website/dist/_worker.js/chunks/vb_CikQuqGJ.mjs +0 -1
- package/website/dist/_worker.js/chunks/verilog_BQRENwI-.mjs +0 -1
- package/website/dist/_worker.js/chunks/vesper_DA0kvTmj.mjs +0 -1
- package/website/dist/_worker.js/chunks/vhdl_DHscJIyg.mjs +0 -1
- package/website/dist/_worker.js/chunks/viml_F2pvMwvG.mjs +0 -1
- package/website/dist/_worker.js/chunks/vitesse-black_D9tjNzd0.mjs +0 -1
- package/website/dist/_worker.js/chunks/vitesse-dark_Bnm5d0hd.mjs +0 -1
- package/website/dist/_worker.js/chunks/vitesse-light_CHwbyjNR.mjs +0 -1
- package/website/dist/_worker.js/chunks/vue-html_DyYtbbMK.mjs +0 -1
- package/website/dist/_worker.js/chunks/vue_DofN6juy.mjs +0 -1
- package/website/dist/_worker.js/chunks/vyper_CiR0m-OV.mjs +0 -1
- package/website/dist/_worker.js/chunks/wasm_CwIGgRGf.mjs +0 -1
- package/website/dist/_worker.js/chunks/wasm_jKWhg0J0.mjs +0 -1
- package/website/dist/_worker.js/chunks/wenyan_DKvVZKXW.mjs +0 -1
- package/website/dist/_worker.js/chunks/wgsl_BOWZY7yw.mjs +0 -1
- package/website/dist/_worker.js/chunks/wikitext_CXDhhHPy.mjs +0 -1
- package/website/dist/_worker.js/chunks/wolfram_ChkmGnW0.mjs +0 -1
- package/website/dist/_worker.js/chunks/xml_DXH3hHIu.mjs +0 -1
- package/website/dist/_worker.js/chunks/xsl_DuP2mFjg.mjs +0 -1
- package/website/dist/_worker.js/chunks/yaml_IGiEkTge.mjs +0 -1
- package/website/dist/_worker.js/chunks/zenscript_59iXGyNw.mjs +0 -1
- package/website/dist/_worker.js/chunks/zig_DKzb0zdT.mjs +0 -1
- package/website/dist/_worker.js/index.js +0 -53
- package/website/dist/_worker.js/manifest_CT_D-YDe.mjs +0 -98
- package/website/dist/_worker.js/pages/_image.astro.mjs +0 -24
- package/website/dist/_worker.js/pages/agents.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/animation.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/api/raw-markdown/_---path_.astro.mjs +0 -44
- package/website/dist/_worker.js/pages/config.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/fonts.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/getting-started.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/helpers.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/images.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/index.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/llm.txt.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/preview.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/sdk.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/sitemap.xml.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/styling.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/templates.astro.mjs +0 -1
- package/website/dist/_worker.js/pages/video.astro.mjs +0 -1
- package/website/dist/_worker.js/renderers.mjs +0 -57
- package/website/dist/agents/index.html +0 -52
- package/website/dist/animation/index.html +0 -879
- package/website/dist/config/index.html +0 -184
- package/website/dist/fonts/index.html +0 -198
- package/website/dist/getting-started/index.html +0 -107
- package/website/dist/helpers/index.html +0 -164
- package/website/dist/images/index.html +0 -335
- package/website/dist/index.html +0 -140
- package/website/dist/llm.txt +0 -2776
- package/website/dist/preview/index.html +0 -111
- package/website/dist/robots.txt +0 -40
- package/website/dist/sdk/index.html +0 -1076
- package/website/dist/sitemap.xml +0 -76
- package/website/dist/styling/index.html +0 -366
- package/website/dist/templates/index.html +0 -74
- package/website/dist/video/index.html +0 -319
- package/website/package-lock.json +0 -8089
- package/website/package.json +0 -41
- package/website/public/.gitkeep +0 -5
- package/website/public/robots.txt +0 -40
- package/website/templates/og-image.tsx +0 -60
|
@@ -1,2401 +0,0 @@
|
|
|
1
|
-
globalThis.process ??= {}; globalThis.process.env ??= {};
|
|
2
|
-
import { A as AstroError, I as InvalidComponentArgs, a as AstroGlobUsedOutside, b as AstroGlobNoMatch, E as EndpointDidNotReturnAResponse, M as MissingMediaQueryDirective, N as NoMatchingImport, O as OnlyResponseCanBeReturned, R as ResponseSentError, c as NoMatchingRenderer, d as NoClientOnlyHint, e as NoClientEntrypoint } from './assets-service_j52rQLzU.mjs';
|
|
3
|
-
|
|
4
|
-
function validateArgs(args) {
|
|
5
|
-
if (args.length !== 3) return false;
|
|
6
|
-
if (!args[0] || typeof args[0] !== "object") return false;
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
function baseCreateComponent(cb, moduleId, propagation) {
|
|
10
|
-
const name = moduleId?.split("/").pop()?.replace(".astro", "") ?? "";
|
|
11
|
-
const fn = (...args) => {
|
|
12
|
-
if (!validateArgs(args)) {
|
|
13
|
-
throw new AstroError({
|
|
14
|
-
...InvalidComponentArgs,
|
|
15
|
-
message: InvalidComponentArgs.message(name)
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return cb(...args);
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(fn, "name", { value: name, writable: false });
|
|
21
|
-
fn.isAstroComponentFactory = true;
|
|
22
|
-
fn.moduleId = moduleId;
|
|
23
|
-
fn.propagation = propagation;
|
|
24
|
-
return fn;
|
|
25
|
-
}
|
|
26
|
-
function createComponentWithOptions(opts) {
|
|
27
|
-
const cb = baseCreateComponent(opts.factory, opts.moduleId, opts.propagation);
|
|
28
|
-
return cb;
|
|
29
|
-
}
|
|
30
|
-
function createComponent(arg1, moduleId, propagation) {
|
|
31
|
-
if (typeof arg1 === "function") {
|
|
32
|
-
return baseCreateComponent(arg1, moduleId, propagation);
|
|
33
|
-
} else {
|
|
34
|
-
return createComponentWithOptions(arg1);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const ASTRO_VERSION = "4.16.19";
|
|
39
|
-
const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
|
|
40
|
-
const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
|
|
41
|
-
const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
|
|
42
|
-
const NOOP_MIDDLEWARE_HEADER = "X-Astro-Noop";
|
|
43
|
-
const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
|
|
44
|
-
const DEFAULT_404_COMPONENT = "astro-default-404.astro";
|
|
45
|
-
const REROUTABLE_STATUS_CODES = [404, 500];
|
|
46
|
-
const clientAddressSymbol = Symbol.for("astro.clientAddress");
|
|
47
|
-
const clientLocalsSymbol = Symbol.for("astro.locals");
|
|
48
|
-
const originPathnameSymbol = Symbol.for("astro.originPathname");
|
|
49
|
-
const responseSentSymbol = Symbol.for("astro.responseSent");
|
|
50
|
-
|
|
51
|
-
function createAstroGlobFn() {
|
|
52
|
-
const globHandler = (importMetaGlobResult) => {
|
|
53
|
-
if (typeof importMetaGlobResult === "string") {
|
|
54
|
-
throw new AstroError({
|
|
55
|
-
...AstroGlobUsedOutside,
|
|
56
|
-
message: AstroGlobUsedOutside.message(JSON.stringify(importMetaGlobResult))
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
let allEntries = [...Object.values(importMetaGlobResult)];
|
|
60
|
-
if (allEntries.length === 0) {
|
|
61
|
-
throw new AstroError({
|
|
62
|
-
...AstroGlobNoMatch,
|
|
63
|
-
message: AstroGlobNoMatch.message(JSON.stringify(importMetaGlobResult))
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return Promise.all(allEntries.map((fn) => fn()));
|
|
67
|
-
};
|
|
68
|
-
return globHandler;
|
|
69
|
-
}
|
|
70
|
-
function createAstro(site) {
|
|
71
|
-
return {
|
|
72
|
-
// TODO: this is no longer necessary for `Astro.site`
|
|
73
|
-
// but it somehow allows working around caching issues in content collections for some tests
|
|
74
|
-
site: new URL(site) ,
|
|
75
|
-
generator: `Astro v${ASTRO_VERSION}`,
|
|
76
|
-
glob: createAstroGlobFn()
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY = true;
|
|
81
|
-
if (typeof process !== "undefined") {
|
|
82
|
-
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
83
|
-
isTTY = process.stdout && process.stdout.isTTY;
|
|
84
|
-
}
|
|
85
|
-
const $ = {
|
|
86
|
-
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
|
|
87
|
-
};
|
|
88
|
-
function init(x, y) {
|
|
89
|
-
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
|
|
90
|
-
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
|
|
91
|
-
return function(txt) {
|
|
92
|
-
if (!$.enabled || txt == null) return txt;
|
|
93
|
-
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
const bold = init(1, 22);
|
|
97
|
-
const dim = init(2, 22);
|
|
98
|
-
const red = init(31, 39);
|
|
99
|
-
const yellow = init(33, 39);
|
|
100
|
-
const blue = init(34, 39);
|
|
101
|
-
|
|
102
|
-
async function renderEndpoint(mod, context, ssr, logger) {
|
|
103
|
-
const { request, url } = context;
|
|
104
|
-
const method = request.method.toUpperCase();
|
|
105
|
-
const handler = mod[method] ?? mod["ALL"];
|
|
106
|
-
if (!ssr && ssr === false && method !== "GET") {
|
|
107
|
-
logger.warn(
|
|
108
|
-
"router",
|
|
109
|
-
`${url.pathname} ${bold(
|
|
110
|
-
method
|
|
111
|
-
)} requests are not available for a static site. Update your config to \`output: 'server'\` or \`output: 'hybrid'\` to enable.`
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
if (handler === void 0) {
|
|
115
|
-
logger.warn(
|
|
116
|
-
"router",
|
|
117
|
-
`No API Route handler exists for the method "${method}" for the route "${url.pathname}".
|
|
118
|
-
Found handlers: ${Object.keys(mod).map((exp) => JSON.stringify(exp)).join(", ")}
|
|
119
|
-
` + ("all" in mod ? `One of the exported handlers is "all" (lowercase), did you mean to export 'ALL'?
|
|
120
|
-
` : "")
|
|
121
|
-
);
|
|
122
|
-
return new Response(null, { status: 404 });
|
|
123
|
-
}
|
|
124
|
-
if (typeof handler !== "function") {
|
|
125
|
-
logger.error(
|
|
126
|
-
"router",
|
|
127
|
-
`The route "${url.pathname}" exports a value for the method "${method}", but it is of the type ${typeof handler} instead of a function.`
|
|
128
|
-
);
|
|
129
|
-
return new Response(null, { status: 500 });
|
|
130
|
-
}
|
|
131
|
-
let response = await handler.call(mod, context);
|
|
132
|
-
if (!response || response instanceof Response === false) {
|
|
133
|
-
throw new AstroError(EndpointDidNotReturnAResponse);
|
|
134
|
-
}
|
|
135
|
-
if (REROUTABLE_STATUS_CODES.includes(response.status)) {
|
|
136
|
-
try {
|
|
137
|
-
response.headers.set(REROUTE_DIRECTIVE_HEADER, "no");
|
|
138
|
-
} catch (err) {
|
|
139
|
-
if (err.message?.includes("immutable")) {
|
|
140
|
-
response = new Response(response.body, response);
|
|
141
|
-
response.headers.set(REROUTE_DIRECTIVE_HEADER, "no");
|
|
142
|
-
} else {
|
|
143
|
-
throw err;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return response;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
|
|
152
|
-
*
|
|
153
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
154
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
155
|
-
* in the Software without restriction, including without limitation the rights
|
|
156
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
157
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
158
|
-
* furnished to do so, subject to the following conditions:
|
|
159
|
-
*
|
|
160
|
-
* The above copyright notice and this permission notice shall be included in
|
|
161
|
-
* all copies or substantial portions of the Software.
|
|
162
|
-
*
|
|
163
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
164
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
165
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
166
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
167
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
168
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
169
|
-
* THE SOFTWARE.
|
|
170
|
-
*/
|
|
171
|
-
|
|
172
|
-
const {replace} = '';
|
|
173
|
-
const ca = /[&<>'"]/g;
|
|
174
|
-
|
|
175
|
-
const esca = {
|
|
176
|
-
'&': '&',
|
|
177
|
-
'<': '<',
|
|
178
|
-
'>': '>',
|
|
179
|
-
"'": ''',
|
|
180
|
-
'"': '"'
|
|
181
|
-
};
|
|
182
|
-
const pe = m => esca[m];
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
|
|
186
|
-
* @param {string} es the input to safely escape
|
|
187
|
-
* @returns {string} the escaped input, and it **throws** an error if
|
|
188
|
-
* the input type is unexpected, except for boolean and numbers,
|
|
189
|
-
* converted as string.
|
|
190
|
-
*/
|
|
191
|
-
const escape = es => replace.call(es, ca, pe);
|
|
192
|
-
|
|
193
|
-
function isPromise(value) {
|
|
194
|
-
return !!value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
195
|
-
}
|
|
196
|
-
async function* streamAsyncIterator(stream) {
|
|
197
|
-
const reader = stream.getReader();
|
|
198
|
-
try {
|
|
199
|
-
while (true) {
|
|
200
|
-
const { done, value } = await reader.read();
|
|
201
|
-
if (done) return;
|
|
202
|
-
yield value;
|
|
203
|
-
}
|
|
204
|
-
} finally {
|
|
205
|
-
reader.releaseLock();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const escapeHTML = escape;
|
|
210
|
-
class HTMLBytes extends Uint8Array {
|
|
211
|
-
}
|
|
212
|
-
Object.defineProperty(HTMLBytes.prototype, Symbol.toStringTag, {
|
|
213
|
-
get() {
|
|
214
|
-
return "HTMLBytes";
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
class HTMLString extends String {
|
|
218
|
-
get [Symbol.toStringTag]() {
|
|
219
|
-
return "HTMLString";
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
const markHTMLString = (value) => {
|
|
223
|
-
if (value instanceof HTMLString) {
|
|
224
|
-
return value;
|
|
225
|
-
}
|
|
226
|
-
if (typeof value === "string") {
|
|
227
|
-
return new HTMLString(value);
|
|
228
|
-
}
|
|
229
|
-
return value;
|
|
230
|
-
};
|
|
231
|
-
function isHTMLString(value) {
|
|
232
|
-
return Object.prototype.toString.call(value) === "[object HTMLString]";
|
|
233
|
-
}
|
|
234
|
-
function markHTMLBytes(bytes) {
|
|
235
|
-
return new HTMLBytes(bytes);
|
|
236
|
-
}
|
|
237
|
-
function hasGetReader(obj) {
|
|
238
|
-
return typeof obj.getReader === "function";
|
|
239
|
-
}
|
|
240
|
-
async function* unescapeChunksAsync(iterable) {
|
|
241
|
-
if (hasGetReader(iterable)) {
|
|
242
|
-
for await (const chunk of streamAsyncIterator(iterable)) {
|
|
243
|
-
yield unescapeHTML(chunk);
|
|
244
|
-
}
|
|
245
|
-
} else {
|
|
246
|
-
for await (const chunk of iterable) {
|
|
247
|
-
yield unescapeHTML(chunk);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
function* unescapeChunks(iterable) {
|
|
252
|
-
for (const chunk of iterable) {
|
|
253
|
-
yield unescapeHTML(chunk);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
function unescapeHTML(str) {
|
|
257
|
-
if (!!str && typeof str === "object") {
|
|
258
|
-
if (str instanceof Uint8Array) {
|
|
259
|
-
return markHTMLBytes(str);
|
|
260
|
-
} else if (str instanceof Response && str.body) {
|
|
261
|
-
const body = str.body;
|
|
262
|
-
return unescapeChunksAsync(body);
|
|
263
|
-
} else if (typeof str.then === "function") {
|
|
264
|
-
return Promise.resolve(str).then((value) => {
|
|
265
|
-
return unescapeHTML(value);
|
|
266
|
-
});
|
|
267
|
-
} else if (str[Symbol.for("astro:slot-string")]) {
|
|
268
|
-
return str;
|
|
269
|
-
} else if (Symbol.iterator in str) {
|
|
270
|
-
return unescapeChunks(str);
|
|
271
|
-
} else if (Symbol.asyncIterator in str || hasGetReader(str)) {
|
|
272
|
-
return unescapeChunksAsync(str);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return markHTMLString(str);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const RenderInstructionSymbol = Symbol.for("astro:render");
|
|
279
|
-
function createRenderInstruction(instruction) {
|
|
280
|
-
return Object.defineProperty(instruction, RenderInstructionSymbol, {
|
|
281
|
-
value: true
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
function isRenderInstruction(chunk) {
|
|
285
|
-
return chunk && typeof chunk === "object" && chunk[RenderInstructionSymbol];
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
289
|
-
|
|
290
|
-
const PROP_TYPE = {
|
|
291
|
-
Value: 0,
|
|
292
|
-
JSON: 1,
|
|
293
|
-
// Actually means Array
|
|
294
|
-
RegExp: 2,
|
|
295
|
-
Date: 3,
|
|
296
|
-
Map: 4,
|
|
297
|
-
Set: 5,
|
|
298
|
-
BigInt: 6,
|
|
299
|
-
URL: 7,
|
|
300
|
-
Uint8Array: 8,
|
|
301
|
-
Uint16Array: 9,
|
|
302
|
-
Uint32Array: 10,
|
|
303
|
-
Infinity: 11
|
|
304
|
-
};
|
|
305
|
-
function serializeArray(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
|
|
306
|
-
if (parents.has(value)) {
|
|
307
|
-
throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
|
|
308
|
-
|
|
309
|
-
Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);
|
|
310
|
-
}
|
|
311
|
-
parents.add(value);
|
|
312
|
-
const serialized = value.map((v) => {
|
|
313
|
-
return convertToSerializedForm(v, metadata, parents);
|
|
314
|
-
});
|
|
315
|
-
parents.delete(value);
|
|
316
|
-
return serialized;
|
|
317
|
-
}
|
|
318
|
-
function serializeObject(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
|
|
319
|
-
if (parents.has(value)) {
|
|
320
|
-
throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
|
|
321
|
-
|
|
322
|
-
Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);
|
|
323
|
-
}
|
|
324
|
-
parents.add(value);
|
|
325
|
-
const serialized = Object.fromEntries(
|
|
326
|
-
Object.entries(value).map(([k, v]) => {
|
|
327
|
-
return [k, convertToSerializedForm(v, metadata, parents)];
|
|
328
|
-
})
|
|
329
|
-
);
|
|
330
|
-
parents.delete(value);
|
|
331
|
-
return serialized;
|
|
332
|
-
}
|
|
333
|
-
function convertToSerializedForm(value, metadata = {}, parents = /* @__PURE__ */ new WeakSet()) {
|
|
334
|
-
const tag = Object.prototype.toString.call(value);
|
|
335
|
-
switch (tag) {
|
|
336
|
-
case "[object Date]": {
|
|
337
|
-
return [PROP_TYPE.Date, value.toISOString()];
|
|
338
|
-
}
|
|
339
|
-
case "[object RegExp]": {
|
|
340
|
-
return [PROP_TYPE.RegExp, value.source];
|
|
341
|
-
}
|
|
342
|
-
case "[object Map]": {
|
|
343
|
-
return [PROP_TYPE.Map, serializeArray(Array.from(value), metadata, parents)];
|
|
344
|
-
}
|
|
345
|
-
case "[object Set]": {
|
|
346
|
-
return [PROP_TYPE.Set, serializeArray(Array.from(value), metadata, parents)];
|
|
347
|
-
}
|
|
348
|
-
case "[object BigInt]": {
|
|
349
|
-
return [PROP_TYPE.BigInt, value.toString()];
|
|
350
|
-
}
|
|
351
|
-
case "[object URL]": {
|
|
352
|
-
return [PROP_TYPE.URL, value.toString()];
|
|
353
|
-
}
|
|
354
|
-
case "[object Array]": {
|
|
355
|
-
return [PROP_TYPE.JSON, serializeArray(value, metadata, parents)];
|
|
356
|
-
}
|
|
357
|
-
case "[object Uint8Array]": {
|
|
358
|
-
return [PROP_TYPE.Uint8Array, Array.from(value)];
|
|
359
|
-
}
|
|
360
|
-
case "[object Uint16Array]": {
|
|
361
|
-
return [PROP_TYPE.Uint16Array, Array.from(value)];
|
|
362
|
-
}
|
|
363
|
-
case "[object Uint32Array]": {
|
|
364
|
-
return [PROP_TYPE.Uint32Array, Array.from(value)];
|
|
365
|
-
}
|
|
366
|
-
default: {
|
|
367
|
-
if (value !== null && typeof value === "object") {
|
|
368
|
-
return [PROP_TYPE.Value, serializeObject(value, metadata, parents)];
|
|
369
|
-
}
|
|
370
|
-
if (value === Infinity) {
|
|
371
|
-
return [PROP_TYPE.Infinity, 1];
|
|
372
|
-
}
|
|
373
|
-
if (value === -Infinity) {
|
|
374
|
-
return [PROP_TYPE.Infinity, -1];
|
|
375
|
-
}
|
|
376
|
-
if (value === void 0) {
|
|
377
|
-
return [PROP_TYPE.Value];
|
|
378
|
-
}
|
|
379
|
-
return [PROP_TYPE.Value, value];
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
function serializeProps(props, metadata) {
|
|
384
|
-
const serialized = JSON.stringify(serializeObject(props, metadata));
|
|
385
|
-
return serialized;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
const transitionDirectivesToCopyOnIsland = Object.freeze([
|
|
389
|
-
"data-astro-transition-scope",
|
|
390
|
-
"data-astro-transition-persist",
|
|
391
|
-
"data-astro-transition-persist-props"
|
|
392
|
-
]);
|
|
393
|
-
function extractDirectives(inputProps, clientDirectives) {
|
|
394
|
-
let extracted = {
|
|
395
|
-
isPage: false,
|
|
396
|
-
hydration: null,
|
|
397
|
-
props: {},
|
|
398
|
-
propsWithoutTransitionAttributes: {}
|
|
399
|
-
};
|
|
400
|
-
for (const [key, value] of Object.entries(inputProps)) {
|
|
401
|
-
if (key.startsWith("server:")) {
|
|
402
|
-
if (key === "server:root") {
|
|
403
|
-
extracted.isPage = true;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
if (key.startsWith("client:")) {
|
|
407
|
-
if (!extracted.hydration) {
|
|
408
|
-
extracted.hydration = {
|
|
409
|
-
directive: "",
|
|
410
|
-
value: "",
|
|
411
|
-
componentUrl: "",
|
|
412
|
-
componentExport: { value: "" }
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
switch (key) {
|
|
416
|
-
case "client:component-path": {
|
|
417
|
-
extracted.hydration.componentUrl = value;
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
case "client:component-export": {
|
|
421
|
-
extracted.hydration.componentExport.value = value;
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
case "client:component-hydration": {
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
case "client:display-name": {
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
default: {
|
|
431
|
-
extracted.hydration.directive = key.split(":")[1];
|
|
432
|
-
extracted.hydration.value = value;
|
|
433
|
-
if (!clientDirectives.has(extracted.hydration.directive)) {
|
|
434
|
-
const hydrationMethods = Array.from(clientDirectives.keys()).map((d) => `client:${d}`).join(", ");
|
|
435
|
-
throw new Error(
|
|
436
|
-
`Error: invalid hydration directive "${key}". Supported hydration methods: ${hydrationMethods}`
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
if (extracted.hydration.directive === "media" && typeof extracted.hydration.value !== "string") {
|
|
440
|
-
throw new AstroError(MissingMediaQueryDirective);
|
|
441
|
-
}
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
} else {
|
|
446
|
-
extracted.props[key] = value;
|
|
447
|
-
if (!transitionDirectivesToCopyOnIsland.includes(key)) {
|
|
448
|
-
extracted.propsWithoutTransitionAttributes[key] = value;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
for (const sym of Object.getOwnPropertySymbols(inputProps)) {
|
|
453
|
-
extracted.props[sym] = inputProps[sym];
|
|
454
|
-
extracted.propsWithoutTransitionAttributes[sym] = inputProps[sym];
|
|
455
|
-
}
|
|
456
|
-
return extracted;
|
|
457
|
-
}
|
|
458
|
-
async function generateHydrateScript(scriptOptions, metadata) {
|
|
459
|
-
const { renderer, result, astroId, props, attrs } = scriptOptions;
|
|
460
|
-
const { hydrate, componentUrl, componentExport } = metadata;
|
|
461
|
-
if (!componentExport.value) {
|
|
462
|
-
throw new AstroError({
|
|
463
|
-
...NoMatchingImport,
|
|
464
|
-
message: NoMatchingImport.message(metadata.displayName)
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
const island = {
|
|
468
|
-
children: "",
|
|
469
|
-
props: {
|
|
470
|
-
// This is for HMR, probably can avoid it in prod
|
|
471
|
-
uid: astroId
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
if (attrs) {
|
|
475
|
-
for (const [key, value] of Object.entries(attrs)) {
|
|
476
|
-
island.props[key] = escapeHTML(value);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
island.props["component-url"] = await result.resolve(decodeURI(componentUrl));
|
|
480
|
-
if (renderer.clientEntrypoint) {
|
|
481
|
-
island.props["component-export"] = componentExport.value;
|
|
482
|
-
island.props["renderer-url"] = await result.resolve(decodeURI(renderer.clientEntrypoint));
|
|
483
|
-
island.props["props"] = escapeHTML(serializeProps(props, metadata));
|
|
484
|
-
}
|
|
485
|
-
island.props["ssr"] = "";
|
|
486
|
-
island.props["client"] = hydrate;
|
|
487
|
-
let beforeHydrationUrl = await result.resolve("astro:scripts/before-hydration.js");
|
|
488
|
-
if (beforeHydrationUrl.length) {
|
|
489
|
-
island.props["before-hydration-url"] = beforeHydrationUrl;
|
|
490
|
-
}
|
|
491
|
-
island.props["opts"] = escapeHTML(
|
|
492
|
-
JSON.stringify({
|
|
493
|
-
name: metadata.displayName,
|
|
494
|
-
value: metadata.hydrateArgs || ""
|
|
495
|
-
})
|
|
496
|
-
);
|
|
497
|
-
transitionDirectivesToCopyOnIsland.forEach((name) => {
|
|
498
|
-
if (typeof props[name] !== "undefined") {
|
|
499
|
-
island.props[name] = props[name];
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
return island;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* shortdash - https://github.com/bibig/node-shorthash
|
|
507
|
-
*
|
|
508
|
-
* @license
|
|
509
|
-
*
|
|
510
|
-
* (The MIT License)
|
|
511
|
-
*
|
|
512
|
-
* Copyright (c) 2013 Bibig <bibig@me.com>
|
|
513
|
-
*
|
|
514
|
-
* Permission is hereby granted, free of charge, to any person
|
|
515
|
-
* obtaining a copy of this software and associated documentation
|
|
516
|
-
* files (the "Software"), to deal in the Software without
|
|
517
|
-
* restriction, including without limitation the rights to use,
|
|
518
|
-
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
519
|
-
* copies of the Software, and to permit persons to whom the
|
|
520
|
-
* Software is furnished to do so, subject to the following
|
|
521
|
-
* conditions:
|
|
522
|
-
*
|
|
523
|
-
* The above copyright notice and this permission notice shall be
|
|
524
|
-
* included in all copies or substantial portions of the Software.
|
|
525
|
-
*
|
|
526
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
527
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
528
|
-
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
529
|
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
530
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
531
|
-
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
532
|
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
533
|
-
* OTHER DEALINGS IN THE SOFTWARE.
|
|
534
|
-
*/
|
|
535
|
-
const dictionary = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY";
|
|
536
|
-
const binary = dictionary.length;
|
|
537
|
-
function bitwise(str) {
|
|
538
|
-
let hash = 0;
|
|
539
|
-
if (str.length === 0) return hash;
|
|
540
|
-
for (let i = 0; i < str.length; i++) {
|
|
541
|
-
const ch = str.charCodeAt(i);
|
|
542
|
-
hash = (hash << 5) - hash + ch;
|
|
543
|
-
hash = hash & hash;
|
|
544
|
-
}
|
|
545
|
-
return hash;
|
|
546
|
-
}
|
|
547
|
-
function shorthash(text) {
|
|
548
|
-
let num;
|
|
549
|
-
let result = "";
|
|
550
|
-
let integer = bitwise(text);
|
|
551
|
-
const sign = integer < 0 ? "Z" : "";
|
|
552
|
-
integer = Math.abs(integer);
|
|
553
|
-
while (integer >= binary) {
|
|
554
|
-
num = integer % binary;
|
|
555
|
-
integer = Math.floor(integer / binary);
|
|
556
|
-
result = dictionary[num] + result;
|
|
557
|
-
}
|
|
558
|
-
if (integer > 0) {
|
|
559
|
-
result = dictionary[integer] + result;
|
|
560
|
-
}
|
|
561
|
-
return sign + result;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
function isAstroComponentFactory(obj) {
|
|
565
|
-
return obj == null ? false : obj.isAstroComponentFactory === true;
|
|
566
|
-
}
|
|
567
|
-
function isAPropagatingComponent(result, factory) {
|
|
568
|
-
let hint = factory.propagation || "none";
|
|
569
|
-
if (factory.moduleId && result.componentMetadata.has(factory.moduleId) && hint === "none") {
|
|
570
|
-
hint = result.componentMetadata.get(factory.moduleId).propagation;
|
|
571
|
-
}
|
|
572
|
-
return hint === "in-tree" || hint === "self";
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
const headAndContentSym = Symbol.for("astro.headAndContent");
|
|
576
|
-
function isHeadAndContent(obj) {
|
|
577
|
-
return typeof obj === "object" && obj !== null && !!obj[headAndContentSym];
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!="symbol"?o+"":o,a);{let i={0:t=>m(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>1/0*t},o=t=>{let[l,e]=t;return l in i?i[l](e):void 0},a=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,"Component");d(this,"hydrator");d(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},h=this.querySelectorAll("template[data-astro-template]");for(let r of h){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let p;try{p=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(s+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),r),r}let u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});d(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(\`astro:\${c}\`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[h,{default:p}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),u=this.getAttribute("component-export")||"default";if(!u.includes("."))this.Component=h[u];else{this.Component=h;for(let f of u.split("."))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(\`[astro-island] Error hydrating \${this.getAttribute("component-url")}\`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",y)}})();`;
|
|
581
|
-
|
|
582
|
-
const ISLAND_STYLES = `<style>astro-island,astro-slot,astro-static-slot{display:contents}</style>`;
|
|
583
|
-
function determineIfNeedsHydrationScript(result) {
|
|
584
|
-
if (result._metadata.hasHydrationScript) {
|
|
585
|
-
return false;
|
|
586
|
-
}
|
|
587
|
-
return result._metadata.hasHydrationScript = true;
|
|
588
|
-
}
|
|
589
|
-
function determinesIfNeedsDirectiveScript(result, directive) {
|
|
590
|
-
if (result._metadata.hasDirectives.has(directive)) {
|
|
591
|
-
return false;
|
|
592
|
-
}
|
|
593
|
-
result._metadata.hasDirectives.add(directive);
|
|
594
|
-
return true;
|
|
595
|
-
}
|
|
596
|
-
function getDirectiveScriptText(result, directive) {
|
|
597
|
-
const clientDirectives = result.clientDirectives;
|
|
598
|
-
const clientDirective = clientDirectives.get(directive);
|
|
599
|
-
if (!clientDirective) {
|
|
600
|
-
throw new Error(`Unknown directive: ${directive}`);
|
|
601
|
-
}
|
|
602
|
-
return clientDirective;
|
|
603
|
-
}
|
|
604
|
-
function getPrescripts(result, type, directive) {
|
|
605
|
-
switch (type) {
|
|
606
|
-
case "both":
|
|
607
|
-
return `${ISLAND_STYLES}<script>${getDirectiveScriptText(result, directive)};${astro_island_prebuilt_default}</script>`;
|
|
608
|
-
case "directive":
|
|
609
|
-
return `<script>${getDirectiveScriptText(result, directive)}</script>`;
|
|
610
|
-
}
|
|
611
|
-
return "";
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
const voidElementNames = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
|
|
615
|
-
const htmlBooleanAttributes = /^(?:allowfullscreen|async|autofocus|autoplay|checked|controls|default|defer|disabled|disablepictureinpicture|disableremoteplayback|formnovalidate|hidden|loop|nomodule|novalidate|open|playsinline|readonly|required|reversed|scoped|seamless|selected|itemscope)$/i;
|
|
616
|
-
const htmlEnumAttributes = /^(?:contenteditable|draggable|spellcheck|value)$/i;
|
|
617
|
-
const svgEnumAttributes = /^(?:autoReverse|externalResourcesRequired|focusable|preserveAlpha)$/i;
|
|
618
|
-
const AMPERSAND_REGEX = /&/g;
|
|
619
|
-
const DOUBLE_QUOTE_REGEX = /"/g;
|
|
620
|
-
const STATIC_DIRECTIVES = /* @__PURE__ */ new Set(["set:html", "set:text"]);
|
|
621
|
-
const toIdent = (k) => k.trim().replace(/(?!^)\b\w|\s+|\W+/g, (match, index) => {
|
|
622
|
-
if (/\W/.test(match)) return "";
|
|
623
|
-
return index === 0 ? match : match.toUpperCase();
|
|
624
|
-
});
|
|
625
|
-
const toAttributeString = (value, shouldEscape = true) => shouldEscape ? String(value).replace(AMPERSAND_REGEX, "&").replace(DOUBLE_QUOTE_REGEX, """) : value;
|
|
626
|
-
const kebab = (k) => k.toLowerCase() === k ? k : k.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
627
|
-
const toStyleString = (obj) => Object.entries(obj).filter(([_, v]) => typeof v === "string" && v.trim() || typeof v === "number").map(([k, v]) => {
|
|
628
|
-
if (k[0] !== "-" && k[1] !== "-") return `${kebab(k)}:${v}`;
|
|
629
|
-
return `${k}:${v}`;
|
|
630
|
-
}).join(";");
|
|
631
|
-
function defineScriptVars(vars) {
|
|
632
|
-
let output = "";
|
|
633
|
-
for (const [key, value] of Object.entries(vars)) {
|
|
634
|
-
output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace(
|
|
635
|
-
/<\/script>/g,
|
|
636
|
-
"\\x3C/script>"
|
|
637
|
-
)};
|
|
638
|
-
`;
|
|
639
|
-
}
|
|
640
|
-
return markHTMLString(output);
|
|
641
|
-
}
|
|
642
|
-
function formatList(values) {
|
|
643
|
-
if (values.length === 1) {
|
|
644
|
-
return values[0];
|
|
645
|
-
}
|
|
646
|
-
return `${values.slice(0, -1).join(", ")} or ${values[values.length - 1]}`;
|
|
647
|
-
}
|
|
648
|
-
function addAttribute(value, key, shouldEscape = true) {
|
|
649
|
-
if (value == null) {
|
|
650
|
-
return "";
|
|
651
|
-
}
|
|
652
|
-
if (value === false) {
|
|
653
|
-
if (htmlEnumAttributes.test(key) || svgEnumAttributes.test(key)) {
|
|
654
|
-
return markHTMLString(` ${key}="false"`);
|
|
655
|
-
}
|
|
656
|
-
return "";
|
|
657
|
-
}
|
|
658
|
-
if (STATIC_DIRECTIVES.has(key)) {
|
|
659
|
-
console.warn(`[astro] The "${key}" directive cannot be applied dynamically at runtime. It will not be rendered as an attribute.
|
|
660
|
-
|
|
661
|
-
Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the dynamic spread syntax (\`{...{ "${key}": value }}\`).`);
|
|
662
|
-
return "";
|
|
663
|
-
}
|
|
664
|
-
if (key === "class:list") {
|
|
665
|
-
const listValue = toAttributeString(clsx(value), shouldEscape);
|
|
666
|
-
if (listValue === "") {
|
|
667
|
-
return "";
|
|
668
|
-
}
|
|
669
|
-
return markHTMLString(` ${key.slice(0, -5)}="${listValue}"`);
|
|
670
|
-
}
|
|
671
|
-
if (key === "style" && !(value instanceof HTMLString)) {
|
|
672
|
-
if (Array.isArray(value) && value.length === 2) {
|
|
673
|
-
return markHTMLString(
|
|
674
|
-
` ${key}="${toAttributeString(`${toStyleString(value[0])};${value[1]}`, shouldEscape)}"`
|
|
675
|
-
);
|
|
676
|
-
}
|
|
677
|
-
if (typeof value === "object") {
|
|
678
|
-
return markHTMLString(` ${key}="${toAttributeString(toStyleString(value), shouldEscape)}"`);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
if (key === "className") {
|
|
682
|
-
return markHTMLString(` class="${toAttributeString(value, shouldEscape)}"`);
|
|
683
|
-
}
|
|
684
|
-
if (typeof value === "string" && value.includes("&") && isHttpUrl(value)) {
|
|
685
|
-
return markHTMLString(` ${key}="${toAttributeString(value, false)}"`);
|
|
686
|
-
}
|
|
687
|
-
if (value === true && (key.startsWith("data-") || htmlBooleanAttributes.test(key))) {
|
|
688
|
-
return markHTMLString(` ${key}`);
|
|
689
|
-
} else {
|
|
690
|
-
return markHTMLString(` ${key}="${toAttributeString(value, shouldEscape)}"`);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
function internalSpreadAttributes(values, shouldEscape = true) {
|
|
694
|
-
let output = "";
|
|
695
|
-
for (const [key, value] of Object.entries(values)) {
|
|
696
|
-
output += addAttribute(value, key, shouldEscape);
|
|
697
|
-
}
|
|
698
|
-
return markHTMLString(output);
|
|
699
|
-
}
|
|
700
|
-
function renderElement$1(name, { props: _props, children = "" }, shouldEscape = true) {
|
|
701
|
-
const { lang: _, "data-astro-id": astroId, "define:vars": defineVars, ...props } = _props;
|
|
702
|
-
if (defineVars) {
|
|
703
|
-
if (name === "style") {
|
|
704
|
-
delete props["is:global"];
|
|
705
|
-
delete props["is:scoped"];
|
|
706
|
-
}
|
|
707
|
-
if (name === "script") {
|
|
708
|
-
delete props.hoist;
|
|
709
|
-
children = defineScriptVars(defineVars) + "\n" + children;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
if ((children == null || children == "") && voidElementNames.test(name)) {
|
|
713
|
-
return `<${name}${internalSpreadAttributes(props, shouldEscape)}>`;
|
|
714
|
-
}
|
|
715
|
-
return `<${name}${internalSpreadAttributes(props, shouldEscape)}>${children}</${name}>`;
|
|
716
|
-
}
|
|
717
|
-
const noop = () => {
|
|
718
|
-
};
|
|
719
|
-
class BufferedRenderer {
|
|
720
|
-
chunks = [];
|
|
721
|
-
renderPromise;
|
|
722
|
-
destination;
|
|
723
|
-
constructor(bufferRenderFunction) {
|
|
724
|
-
this.renderPromise = bufferRenderFunction(this);
|
|
725
|
-
Promise.resolve(this.renderPromise).catch(noop);
|
|
726
|
-
}
|
|
727
|
-
write(chunk) {
|
|
728
|
-
if (this.destination) {
|
|
729
|
-
this.destination.write(chunk);
|
|
730
|
-
} else {
|
|
731
|
-
this.chunks.push(chunk);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
async renderToFinalDestination(destination) {
|
|
735
|
-
for (const chunk of this.chunks) {
|
|
736
|
-
destination.write(chunk);
|
|
737
|
-
}
|
|
738
|
-
this.destination = destination;
|
|
739
|
-
await this.renderPromise;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
function renderToBufferDestination(bufferRenderFunction) {
|
|
743
|
-
const renderer = new BufferedRenderer(bufferRenderFunction);
|
|
744
|
-
return renderer;
|
|
745
|
-
}
|
|
746
|
-
const isNode = typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]";
|
|
747
|
-
const isDeno = typeof Deno !== "undefined";
|
|
748
|
-
function promiseWithResolvers() {
|
|
749
|
-
let resolve, reject;
|
|
750
|
-
const promise = new Promise((_resolve, _reject) => {
|
|
751
|
-
resolve = _resolve;
|
|
752
|
-
reject = _reject;
|
|
753
|
-
});
|
|
754
|
-
return {
|
|
755
|
-
promise,
|
|
756
|
-
resolve,
|
|
757
|
-
reject
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
const VALID_PROTOCOLS = ["http:", "https:"];
|
|
761
|
-
function isHttpUrl(url) {
|
|
762
|
-
try {
|
|
763
|
-
const parsedUrl = new URL(url);
|
|
764
|
-
return VALID_PROTOCOLS.includes(parsedUrl.protocol);
|
|
765
|
-
} catch {
|
|
766
|
-
return false;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
const uniqueElements = (item, index, all) => {
|
|
771
|
-
const props = JSON.stringify(item.props);
|
|
772
|
-
const children = item.children;
|
|
773
|
-
return index === all.findIndex((i) => JSON.stringify(i.props) === props && i.children == children);
|
|
774
|
-
};
|
|
775
|
-
function renderAllHeadContent(result) {
|
|
776
|
-
result._metadata.hasRenderedHead = true;
|
|
777
|
-
const styles = Array.from(result.styles).filter(uniqueElements).map(
|
|
778
|
-
(style) => style.props.rel === "stylesheet" ? renderElement$1("link", style) : renderElement$1("style", style)
|
|
779
|
-
);
|
|
780
|
-
result.styles.clear();
|
|
781
|
-
const scripts = Array.from(result.scripts).filter(uniqueElements).map((script) => {
|
|
782
|
-
return renderElement$1("script", script, false);
|
|
783
|
-
});
|
|
784
|
-
const links = Array.from(result.links).filter(uniqueElements).map((link) => renderElement$1("link", link, false));
|
|
785
|
-
let content = styles.join("\n") + links.join("\n") + scripts.join("\n");
|
|
786
|
-
if (result._metadata.extraHead.length > 0) {
|
|
787
|
-
for (const part of result._metadata.extraHead) {
|
|
788
|
-
content += part;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
return markHTMLString(content);
|
|
792
|
-
}
|
|
793
|
-
function renderHead() {
|
|
794
|
-
return createRenderInstruction({ type: "head" });
|
|
795
|
-
}
|
|
796
|
-
function maybeRenderHead() {
|
|
797
|
-
return createRenderInstruction({ type: "maybe-head" });
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
const renderTemplateResultSym = Symbol.for("astro.renderTemplateResult");
|
|
801
|
-
class RenderTemplateResult {
|
|
802
|
-
[renderTemplateResultSym] = true;
|
|
803
|
-
htmlParts;
|
|
804
|
-
expressions;
|
|
805
|
-
error;
|
|
806
|
-
constructor(htmlParts, expressions) {
|
|
807
|
-
this.htmlParts = htmlParts;
|
|
808
|
-
this.error = void 0;
|
|
809
|
-
this.expressions = expressions.map((expression) => {
|
|
810
|
-
if (isPromise(expression)) {
|
|
811
|
-
return Promise.resolve(expression).catch((err) => {
|
|
812
|
-
if (!this.error) {
|
|
813
|
-
this.error = err;
|
|
814
|
-
throw err;
|
|
815
|
-
}
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
return expression;
|
|
819
|
-
});
|
|
820
|
-
}
|
|
821
|
-
async render(destination) {
|
|
822
|
-
const expRenders = this.expressions.map((exp) => {
|
|
823
|
-
return renderToBufferDestination((bufferDestination) => {
|
|
824
|
-
if (exp || exp === 0) {
|
|
825
|
-
return renderChild(bufferDestination, exp);
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
});
|
|
829
|
-
for (let i = 0; i < this.htmlParts.length; i++) {
|
|
830
|
-
const html = this.htmlParts[i];
|
|
831
|
-
const expRender = expRenders[i];
|
|
832
|
-
destination.write(markHTMLString(html));
|
|
833
|
-
if (expRender) {
|
|
834
|
-
await expRender.renderToFinalDestination(destination);
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
function isRenderTemplateResult(obj) {
|
|
840
|
-
return typeof obj === "object" && obj !== null && !!obj[renderTemplateResultSym];
|
|
841
|
-
}
|
|
842
|
-
function renderTemplate(htmlParts, ...expressions) {
|
|
843
|
-
return new RenderTemplateResult(htmlParts, expressions);
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
const slotString = Symbol.for("astro:slot-string");
|
|
847
|
-
class SlotString extends HTMLString {
|
|
848
|
-
instructions;
|
|
849
|
-
[slotString];
|
|
850
|
-
constructor(content, instructions) {
|
|
851
|
-
super(content);
|
|
852
|
-
this.instructions = instructions;
|
|
853
|
-
this[slotString] = true;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
function isSlotString(str) {
|
|
857
|
-
return !!str[slotString];
|
|
858
|
-
}
|
|
859
|
-
function renderSlot(result, slotted, fallback) {
|
|
860
|
-
if (!slotted && fallback) {
|
|
861
|
-
return renderSlot(result, fallback);
|
|
862
|
-
}
|
|
863
|
-
return {
|
|
864
|
-
async render(destination) {
|
|
865
|
-
await renderChild(destination, typeof slotted === "function" ? slotted(result) : slotted);
|
|
866
|
-
}
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
async function renderSlotToString(result, slotted, fallback) {
|
|
870
|
-
let content = "";
|
|
871
|
-
let instructions = null;
|
|
872
|
-
const temporaryDestination = {
|
|
873
|
-
write(chunk) {
|
|
874
|
-
if (chunk instanceof SlotString) {
|
|
875
|
-
content += chunk;
|
|
876
|
-
if (chunk.instructions) {
|
|
877
|
-
instructions ??= [];
|
|
878
|
-
instructions.push(...chunk.instructions);
|
|
879
|
-
}
|
|
880
|
-
} else if (chunk instanceof Response) return;
|
|
881
|
-
else if (typeof chunk === "object" && "type" in chunk && typeof chunk.type === "string") {
|
|
882
|
-
if (instructions === null) {
|
|
883
|
-
instructions = [];
|
|
884
|
-
}
|
|
885
|
-
instructions.push(chunk);
|
|
886
|
-
} else {
|
|
887
|
-
content += chunkToString(result, chunk);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
};
|
|
891
|
-
const renderInstance = renderSlot(result, slotted, fallback);
|
|
892
|
-
await renderInstance.render(temporaryDestination);
|
|
893
|
-
return markHTMLString(new SlotString(content, instructions));
|
|
894
|
-
}
|
|
895
|
-
async function renderSlots(result, slots = {}) {
|
|
896
|
-
let slotInstructions = null;
|
|
897
|
-
let children = {};
|
|
898
|
-
if (slots) {
|
|
899
|
-
await Promise.all(
|
|
900
|
-
Object.entries(slots).map(
|
|
901
|
-
([key, value]) => renderSlotToString(result, value).then((output) => {
|
|
902
|
-
if (output.instructions) {
|
|
903
|
-
if (slotInstructions === null) {
|
|
904
|
-
slotInstructions = [];
|
|
905
|
-
}
|
|
906
|
-
slotInstructions.push(...output.instructions);
|
|
907
|
-
}
|
|
908
|
-
children[key] = output;
|
|
909
|
-
})
|
|
910
|
-
)
|
|
911
|
-
);
|
|
912
|
-
}
|
|
913
|
-
return { slotInstructions, children };
|
|
914
|
-
}
|
|
915
|
-
function createSlotValueFromString(content) {
|
|
916
|
-
return function() {
|
|
917
|
-
return renderTemplate`${unescapeHTML(content)}`;
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
const Fragment = Symbol.for("astro:fragment");
|
|
922
|
-
const Renderer = Symbol.for("astro:renderer");
|
|
923
|
-
const encoder$1 = new TextEncoder();
|
|
924
|
-
const decoder$1 = new TextDecoder();
|
|
925
|
-
function stringifyChunk(result, chunk) {
|
|
926
|
-
if (isRenderInstruction(chunk)) {
|
|
927
|
-
const instruction = chunk;
|
|
928
|
-
switch (instruction.type) {
|
|
929
|
-
case "directive": {
|
|
930
|
-
const { hydration } = instruction;
|
|
931
|
-
let needsHydrationScript = hydration && determineIfNeedsHydrationScript(result);
|
|
932
|
-
let needsDirectiveScript = hydration && determinesIfNeedsDirectiveScript(result, hydration.directive);
|
|
933
|
-
let prescriptType = needsHydrationScript ? "both" : needsDirectiveScript ? "directive" : null;
|
|
934
|
-
if (prescriptType) {
|
|
935
|
-
let prescripts = getPrescripts(result, prescriptType, hydration.directive);
|
|
936
|
-
return markHTMLString(prescripts);
|
|
937
|
-
} else {
|
|
938
|
-
return "";
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
case "head": {
|
|
942
|
-
if (result._metadata.hasRenderedHead || result.partial) {
|
|
943
|
-
return "";
|
|
944
|
-
}
|
|
945
|
-
return renderAllHeadContent(result);
|
|
946
|
-
}
|
|
947
|
-
case "maybe-head": {
|
|
948
|
-
if (result._metadata.hasRenderedHead || result._metadata.headInTree || result.partial) {
|
|
949
|
-
return "";
|
|
950
|
-
}
|
|
951
|
-
return renderAllHeadContent(result);
|
|
952
|
-
}
|
|
953
|
-
case "renderer-hydration-script": {
|
|
954
|
-
const { rendererSpecificHydrationScripts } = result._metadata;
|
|
955
|
-
const { rendererName } = instruction;
|
|
956
|
-
if (!rendererSpecificHydrationScripts.has(rendererName)) {
|
|
957
|
-
rendererSpecificHydrationScripts.add(rendererName);
|
|
958
|
-
return instruction.render();
|
|
959
|
-
}
|
|
960
|
-
return "";
|
|
961
|
-
}
|
|
962
|
-
default: {
|
|
963
|
-
throw new Error(`Unknown chunk type: ${chunk.type}`);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
} else if (chunk instanceof Response) {
|
|
967
|
-
return "";
|
|
968
|
-
} else if (isSlotString(chunk)) {
|
|
969
|
-
let out = "";
|
|
970
|
-
const c = chunk;
|
|
971
|
-
if (c.instructions) {
|
|
972
|
-
for (const instr of c.instructions) {
|
|
973
|
-
out += stringifyChunk(result, instr);
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
out += chunk.toString();
|
|
977
|
-
return out;
|
|
978
|
-
}
|
|
979
|
-
return chunk.toString();
|
|
980
|
-
}
|
|
981
|
-
function chunkToString(result, chunk) {
|
|
982
|
-
if (ArrayBuffer.isView(chunk)) {
|
|
983
|
-
return decoder$1.decode(chunk);
|
|
984
|
-
} else {
|
|
985
|
-
return stringifyChunk(result, chunk);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
function chunkToByteArray(result, chunk) {
|
|
989
|
-
if (ArrayBuffer.isView(chunk)) {
|
|
990
|
-
return chunk;
|
|
991
|
-
} else {
|
|
992
|
-
const stringified = stringifyChunk(result, chunk);
|
|
993
|
-
return encoder$1.encode(stringified.toString());
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
function isRenderInstance(obj) {
|
|
997
|
-
return !!obj && typeof obj === "object" && "render" in obj && typeof obj.render === "function";
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
async function renderChild(destination, child) {
|
|
1001
|
-
if (isPromise(child)) {
|
|
1002
|
-
child = await child;
|
|
1003
|
-
}
|
|
1004
|
-
if (child instanceof SlotString) {
|
|
1005
|
-
destination.write(child);
|
|
1006
|
-
} else if (isHTMLString(child)) {
|
|
1007
|
-
destination.write(child);
|
|
1008
|
-
} else if (Array.isArray(child)) {
|
|
1009
|
-
const childRenders = child.map((c) => {
|
|
1010
|
-
return renderToBufferDestination((bufferDestination) => {
|
|
1011
|
-
return renderChild(bufferDestination, c);
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
for (const childRender of childRenders) {
|
|
1015
|
-
if (!childRender) continue;
|
|
1016
|
-
await childRender.renderToFinalDestination(destination);
|
|
1017
|
-
}
|
|
1018
|
-
} else if (typeof child === "function") {
|
|
1019
|
-
await renderChild(destination, child());
|
|
1020
|
-
} else if (typeof child === "string") {
|
|
1021
|
-
destination.write(markHTMLString(escapeHTML(child)));
|
|
1022
|
-
} else if (!child && child !== 0) ; else if (isRenderInstance(child)) {
|
|
1023
|
-
await child.render(destination);
|
|
1024
|
-
} else if (isRenderTemplateResult(child)) {
|
|
1025
|
-
await child.render(destination);
|
|
1026
|
-
} else if (isAstroComponentInstance(child)) {
|
|
1027
|
-
await child.render(destination);
|
|
1028
|
-
} else if (ArrayBuffer.isView(child)) {
|
|
1029
|
-
destination.write(child);
|
|
1030
|
-
} else if (typeof child === "object" && (Symbol.asyncIterator in child || Symbol.iterator in child)) {
|
|
1031
|
-
for await (const value of child) {
|
|
1032
|
-
await renderChild(destination, value);
|
|
1033
|
-
}
|
|
1034
|
-
} else {
|
|
1035
|
-
destination.write(child);
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
const astroComponentInstanceSym = Symbol.for("astro.componentInstance");
|
|
1040
|
-
class AstroComponentInstance {
|
|
1041
|
-
[astroComponentInstanceSym] = true;
|
|
1042
|
-
result;
|
|
1043
|
-
props;
|
|
1044
|
-
slotValues;
|
|
1045
|
-
factory;
|
|
1046
|
-
returnValue;
|
|
1047
|
-
constructor(result, props, slots, factory) {
|
|
1048
|
-
this.result = result;
|
|
1049
|
-
this.props = props;
|
|
1050
|
-
this.factory = factory;
|
|
1051
|
-
this.slotValues = {};
|
|
1052
|
-
for (const name in slots) {
|
|
1053
|
-
let didRender = false;
|
|
1054
|
-
let value = slots[name](result);
|
|
1055
|
-
this.slotValues[name] = () => {
|
|
1056
|
-
if (!didRender) {
|
|
1057
|
-
didRender = true;
|
|
1058
|
-
return value;
|
|
1059
|
-
}
|
|
1060
|
-
return slots[name](result);
|
|
1061
|
-
};
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
async init(result) {
|
|
1065
|
-
if (this.returnValue !== void 0) return this.returnValue;
|
|
1066
|
-
this.returnValue = this.factory(result, this.props, this.slotValues);
|
|
1067
|
-
if (isPromise(this.returnValue)) {
|
|
1068
|
-
this.returnValue.then((resolved) => {
|
|
1069
|
-
this.returnValue = resolved;
|
|
1070
|
-
}).catch(() => {
|
|
1071
|
-
});
|
|
1072
|
-
}
|
|
1073
|
-
return this.returnValue;
|
|
1074
|
-
}
|
|
1075
|
-
async render(destination) {
|
|
1076
|
-
const returnValue = await this.init(this.result);
|
|
1077
|
-
if (isHeadAndContent(returnValue)) {
|
|
1078
|
-
await returnValue.content.render(destination);
|
|
1079
|
-
} else {
|
|
1080
|
-
await renderChild(destination, returnValue);
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
function validateComponentProps(props, displayName) {
|
|
1085
|
-
if (props != null) {
|
|
1086
|
-
for (const prop of Object.keys(props)) {
|
|
1087
|
-
if (prop.startsWith("client:")) {
|
|
1088
|
-
console.warn(
|
|
1089
|
-
`You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
|
|
1090
|
-
);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
function createAstroComponentInstance(result, displayName, factory, props, slots = {}) {
|
|
1096
|
-
validateComponentProps(props, displayName);
|
|
1097
|
-
const instance = new AstroComponentInstance(result, props, slots, factory);
|
|
1098
|
-
if (isAPropagatingComponent(result, factory)) {
|
|
1099
|
-
result._metadata.propagators.add(instance);
|
|
1100
|
-
}
|
|
1101
|
-
return instance;
|
|
1102
|
-
}
|
|
1103
|
-
function isAstroComponentInstance(obj) {
|
|
1104
|
-
return typeof obj === "object" && obj !== null && !!obj[astroComponentInstanceSym];
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
const DOCTYPE_EXP = /<!doctype html/i;
|
|
1108
|
-
async function renderToString(result, componentFactory, props, children, isPage = false, route) {
|
|
1109
|
-
const templateResult = await callComponentAsTemplateResultOrResponse(
|
|
1110
|
-
result,
|
|
1111
|
-
componentFactory,
|
|
1112
|
-
props,
|
|
1113
|
-
children,
|
|
1114
|
-
route
|
|
1115
|
-
);
|
|
1116
|
-
if (templateResult instanceof Response) return templateResult;
|
|
1117
|
-
let str = "";
|
|
1118
|
-
let renderedFirstPageChunk = false;
|
|
1119
|
-
if (isPage) {
|
|
1120
|
-
await bufferHeadContent(result);
|
|
1121
|
-
}
|
|
1122
|
-
const destination = {
|
|
1123
|
-
write(chunk) {
|
|
1124
|
-
if (isPage && !renderedFirstPageChunk) {
|
|
1125
|
-
renderedFirstPageChunk = true;
|
|
1126
|
-
if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) {
|
|
1127
|
-
const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
|
|
1128
|
-
str += doctype;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
if (chunk instanceof Response) return;
|
|
1132
|
-
str += chunkToString(result, chunk);
|
|
1133
|
-
}
|
|
1134
|
-
};
|
|
1135
|
-
await templateResult.render(destination);
|
|
1136
|
-
return str;
|
|
1137
|
-
}
|
|
1138
|
-
async function renderToReadableStream(result, componentFactory, props, children, isPage = false, route) {
|
|
1139
|
-
const templateResult = await callComponentAsTemplateResultOrResponse(
|
|
1140
|
-
result,
|
|
1141
|
-
componentFactory,
|
|
1142
|
-
props,
|
|
1143
|
-
children,
|
|
1144
|
-
route
|
|
1145
|
-
);
|
|
1146
|
-
if (templateResult instanceof Response) return templateResult;
|
|
1147
|
-
let renderedFirstPageChunk = false;
|
|
1148
|
-
if (isPage) {
|
|
1149
|
-
await bufferHeadContent(result);
|
|
1150
|
-
}
|
|
1151
|
-
return new ReadableStream({
|
|
1152
|
-
start(controller) {
|
|
1153
|
-
const destination = {
|
|
1154
|
-
write(chunk) {
|
|
1155
|
-
if (isPage && !renderedFirstPageChunk) {
|
|
1156
|
-
renderedFirstPageChunk = true;
|
|
1157
|
-
if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) {
|
|
1158
|
-
const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
|
|
1159
|
-
controller.enqueue(encoder$1.encode(doctype));
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
if (chunk instanceof Response) {
|
|
1163
|
-
throw new AstroError({
|
|
1164
|
-
...ResponseSentError
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
const bytes = chunkToByteArray(result, chunk);
|
|
1168
|
-
controller.enqueue(bytes);
|
|
1169
|
-
}
|
|
1170
|
-
};
|
|
1171
|
-
(async () => {
|
|
1172
|
-
try {
|
|
1173
|
-
await templateResult.render(destination);
|
|
1174
|
-
controller.close();
|
|
1175
|
-
} catch (e) {
|
|
1176
|
-
if (AstroError.is(e) && !e.loc) {
|
|
1177
|
-
e.setLocation({
|
|
1178
|
-
file: route?.component
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
setTimeout(() => controller.error(e), 0);
|
|
1182
|
-
}
|
|
1183
|
-
})();
|
|
1184
|
-
},
|
|
1185
|
-
cancel() {
|
|
1186
|
-
result.cancelled = true;
|
|
1187
|
-
}
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
async function callComponentAsTemplateResultOrResponse(result, componentFactory, props, children, route) {
|
|
1191
|
-
const factoryResult = await componentFactory(result, props, children);
|
|
1192
|
-
if (factoryResult instanceof Response) {
|
|
1193
|
-
return factoryResult;
|
|
1194
|
-
} else if (isHeadAndContent(factoryResult)) {
|
|
1195
|
-
if (!isRenderTemplateResult(factoryResult.content)) {
|
|
1196
|
-
throw new AstroError({
|
|
1197
|
-
...OnlyResponseCanBeReturned,
|
|
1198
|
-
message: OnlyResponseCanBeReturned.message(
|
|
1199
|
-
route?.route,
|
|
1200
|
-
typeof factoryResult
|
|
1201
|
-
),
|
|
1202
|
-
location: {
|
|
1203
|
-
file: route?.component
|
|
1204
|
-
}
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
return factoryResult.content;
|
|
1208
|
-
} else if (!isRenderTemplateResult(factoryResult)) {
|
|
1209
|
-
throw new AstroError({
|
|
1210
|
-
...OnlyResponseCanBeReturned,
|
|
1211
|
-
message: OnlyResponseCanBeReturned.message(route?.route, typeof factoryResult),
|
|
1212
|
-
location: {
|
|
1213
|
-
file: route?.component
|
|
1214
|
-
}
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
1217
|
-
return factoryResult;
|
|
1218
|
-
}
|
|
1219
|
-
async function bufferHeadContent(result) {
|
|
1220
|
-
const iterator = result._metadata.propagators.values();
|
|
1221
|
-
while (true) {
|
|
1222
|
-
const { value, done } = iterator.next();
|
|
1223
|
-
if (done) {
|
|
1224
|
-
break;
|
|
1225
|
-
}
|
|
1226
|
-
const returnValue = await value.init(result);
|
|
1227
|
-
if (isHeadAndContent(returnValue)) {
|
|
1228
|
-
result._metadata.extraHead.push(returnValue.head);
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
async function renderToAsyncIterable(result, componentFactory, props, children, isPage = false, route) {
|
|
1233
|
-
const templateResult = await callComponentAsTemplateResultOrResponse(
|
|
1234
|
-
result,
|
|
1235
|
-
componentFactory,
|
|
1236
|
-
props,
|
|
1237
|
-
children,
|
|
1238
|
-
route
|
|
1239
|
-
);
|
|
1240
|
-
if (templateResult instanceof Response) return templateResult;
|
|
1241
|
-
let renderedFirstPageChunk = false;
|
|
1242
|
-
if (isPage) {
|
|
1243
|
-
await bufferHeadContent(result);
|
|
1244
|
-
}
|
|
1245
|
-
let error = null;
|
|
1246
|
-
let next = null;
|
|
1247
|
-
const buffer = [];
|
|
1248
|
-
let renderingComplete = false;
|
|
1249
|
-
const iterator = {
|
|
1250
|
-
async next() {
|
|
1251
|
-
if (result.cancelled) return { done: true, value: void 0 };
|
|
1252
|
-
if (next !== null) {
|
|
1253
|
-
await next.promise;
|
|
1254
|
-
} else if (!renderingComplete && !buffer.length) {
|
|
1255
|
-
next = promiseWithResolvers();
|
|
1256
|
-
await next.promise;
|
|
1257
|
-
}
|
|
1258
|
-
if (!renderingComplete) {
|
|
1259
|
-
next = promiseWithResolvers();
|
|
1260
|
-
}
|
|
1261
|
-
if (error) {
|
|
1262
|
-
throw error;
|
|
1263
|
-
}
|
|
1264
|
-
let length = 0;
|
|
1265
|
-
for (let i = 0, len = buffer.length; i < len; i++) {
|
|
1266
|
-
length += buffer[i].length;
|
|
1267
|
-
}
|
|
1268
|
-
let mergedArray = new Uint8Array(length);
|
|
1269
|
-
let offset = 0;
|
|
1270
|
-
for (let i = 0, len = buffer.length; i < len; i++) {
|
|
1271
|
-
const item = buffer[i];
|
|
1272
|
-
mergedArray.set(item, offset);
|
|
1273
|
-
offset += item.length;
|
|
1274
|
-
}
|
|
1275
|
-
buffer.length = 0;
|
|
1276
|
-
const returnValue = {
|
|
1277
|
-
// The iterator is done when rendering has finished
|
|
1278
|
-
// and there are no more chunks to return.
|
|
1279
|
-
done: length === 0 && renderingComplete,
|
|
1280
|
-
value: mergedArray
|
|
1281
|
-
};
|
|
1282
|
-
return returnValue;
|
|
1283
|
-
},
|
|
1284
|
-
async return() {
|
|
1285
|
-
result.cancelled = true;
|
|
1286
|
-
return { done: true, value: void 0 };
|
|
1287
|
-
}
|
|
1288
|
-
};
|
|
1289
|
-
const destination = {
|
|
1290
|
-
write(chunk) {
|
|
1291
|
-
if (isPage && !renderedFirstPageChunk) {
|
|
1292
|
-
renderedFirstPageChunk = true;
|
|
1293
|
-
if (!result.partial && !DOCTYPE_EXP.test(String(chunk))) {
|
|
1294
|
-
const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
|
|
1295
|
-
buffer.push(encoder$1.encode(doctype));
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
if (chunk instanceof Response) {
|
|
1299
|
-
throw new AstroError(ResponseSentError);
|
|
1300
|
-
}
|
|
1301
|
-
const bytes = chunkToByteArray(result, chunk);
|
|
1302
|
-
if (bytes.length > 0) {
|
|
1303
|
-
buffer.push(bytes);
|
|
1304
|
-
next?.resolve();
|
|
1305
|
-
} else if (buffer.length > 0) {
|
|
1306
|
-
next?.resolve();
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
1310
|
-
const renderPromise = templateResult.render(destination);
|
|
1311
|
-
renderPromise.then(() => {
|
|
1312
|
-
renderingComplete = true;
|
|
1313
|
-
next?.resolve();
|
|
1314
|
-
}).catch((err) => {
|
|
1315
|
-
error = err;
|
|
1316
|
-
renderingComplete = true;
|
|
1317
|
-
next?.resolve();
|
|
1318
|
-
});
|
|
1319
|
-
return {
|
|
1320
|
-
[Symbol.asyncIterator]() {
|
|
1321
|
-
return iterator;
|
|
1322
|
-
}
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
function componentIsHTMLElement(Component) {
|
|
1327
|
-
return typeof HTMLElement !== "undefined" && HTMLElement.isPrototypeOf(Component);
|
|
1328
|
-
}
|
|
1329
|
-
async function renderHTMLElement(result, constructor, props, slots) {
|
|
1330
|
-
const name = getHTMLElementName(constructor);
|
|
1331
|
-
let attrHTML = "";
|
|
1332
|
-
for (const attr in props) {
|
|
1333
|
-
attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
|
|
1334
|
-
}
|
|
1335
|
-
return markHTMLString(
|
|
1336
|
-
`<${name}${attrHTML}>${await renderSlotToString(result, slots?.default)}</${name}>`
|
|
1337
|
-
);
|
|
1338
|
-
}
|
|
1339
|
-
function getHTMLElementName(constructor) {
|
|
1340
|
-
const definedName = customElements.getName(constructor);
|
|
1341
|
-
if (definedName) return definedName;
|
|
1342
|
-
const assignedName = constructor.name.replace(/^HTML|Element$/g, "").replace(/[A-Z]/g, "-$&").toLowerCase().replace(/^-/, "html-");
|
|
1343
|
-
return assignedName;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
function encodeHexUpperCase(data) {
|
|
1347
|
-
let result = "";
|
|
1348
|
-
for (let i = 0; i < data.length; i++) {
|
|
1349
|
-
result += alphabetUpperCase[data[i] >> 4];
|
|
1350
|
-
result += alphabetUpperCase[data[i] & 0x0f];
|
|
1351
|
-
}
|
|
1352
|
-
return result;
|
|
1353
|
-
}
|
|
1354
|
-
function decodeHex(data) {
|
|
1355
|
-
if (data.length % 2 !== 0) {
|
|
1356
|
-
throw new Error("Invalid hex string");
|
|
1357
|
-
}
|
|
1358
|
-
const result = new Uint8Array(data.length / 2);
|
|
1359
|
-
for (let i = 0; i < data.length; i += 2) {
|
|
1360
|
-
if (!(data[i] in decodeMap)) {
|
|
1361
|
-
throw new Error("Invalid character");
|
|
1362
|
-
}
|
|
1363
|
-
if (!(data[i + 1] in decodeMap)) {
|
|
1364
|
-
throw new Error("Invalid character");
|
|
1365
|
-
}
|
|
1366
|
-
result[i / 2] |= decodeMap[data[i]] << 4;
|
|
1367
|
-
result[i / 2] |= decodeMap[data[i + 1]];
|
|
1368
|
-
}
|
|
1369
|
-
return result;
|
|
1370
|
-
}
|
|
1371
|
-
const alphabetUpperCase = "0123456789ABCDEF";
|
|
1372
|
-
const decodeMap = {
|
|
1373
|
-
"0": 0,
|
|
1374
|
-
"1": 1,
|
|
1375
|
-
"2": 2,
|
|
1376
|
-
"3": 3,
|
|
1377
|
-
"4": 4,
|
|
1378
|
-
"5": 5,
|
|
1379
|
-
"6": 6,
|
|
1380
|
-
"7": 7,
|
|
1381
|
-
"8": 8,
|
|
1382
|
-
"9": 9,
|
|
1383
|
-
a: 10,
|
|
1384
|
-
A: 10,
|
|
1385
|
-
b: 11,
|
|
1386
|
-
B: 11,
|
|
1387
|
-
c: 12,
|
|
1388
|
-
C: 12,
|
|
1389
|
-
d: 13,
|
|
1390
|
-
D: 13,
|
|
1391
|
-
e: 14,
|
|
1392
|
-
E: 14,
|
|
1393
|
-
f: 15,
|
|
1394
|
-
F: 15
|
|
1395
|
-
};
|
|
1396
|
-
|
|
1397
|
-
var EncodingPadding$1;
|
|
1398
|
-
(function (EncodingPadding) {
|
|
1399
|
-
EncodingPadding[EncodingPadding["Include"] = 0] = "Include";
|
|
1400
|
-
EncodingPadding[EncodingPadding["None"] = 1] = "None";
|
|
1401
|
-
})(EncodingPadding$1 || (EncodingPadding$1 = {}));
|
|
1402
|
-
var DecodingPadding$1;
|
|
1403
|
-
(function (DecodingPadding) {
|
|
1404
|
-
DecodingPadding[DecodingPadding["Required"] = 0] = "Required";
|
|
1405
|
-
DecodingPadding[DecodingPadding["Ignore"] = 1] = "Ignore";
|
|
1406
|
-
})(DecodingPadding$1 || (DecodingPadding$1 = {}));
|
|
1407
|
-
|
|
1408
|
-
function encodeBase64(bytes) {
|
|
1409
|
-
return encodeBase64_internal(bytes, base64Alphabet, EncodingPadding.Include);
|
|
1410
|
-
}
|
|
1411
|
-
function encodeBase64_internal(bytes, alphabet, padding) {
|
|
1412
|
-
let result = "";
|
|
1413
|
-
for (let i = 0; i < bytes.byteLength; i += 3) {
|
|
1414
|
-
let buffer = 0;
|
|
1415
|
-
let bufferBitSize = 0;
|
|
1416
|
-
for (let j = 0; j < 3 && i + j < bytes.byteLength; j++) {
|
|
1417
|
-
buffer = (buffer << 8) | bytes[i + j];
|
|
1418
|
-
bufferBitSize += 8;
|
|
1419
|
-
}
|
|
1420
|
-
for (let j = 0; j < 4; j++) {
|
|
1421
|
-
if (bufferBitSize >= 6) {
|
|
1422
|
-
result += alphabet[(buffer >> (bufferBitSize - 6)) & 0x3f];
|
|
1423
|
-
bufferBitSize -= 6;
|
|
1424
|
-
}
|
|
1425
|
-
else if (bufferBitSize > 0) {
|
|
1426
|
-
result += alphabet[(buffer << (6 - bufferBitSize)) & 0x3f];
|
|
1427
|
-
bufferBitSize = 0;
|
|
1428
|
-
}
|
|
1429
|
-
else if (padding === EncodingPadding.Include) {
|
|
1430
|
-
result += "=";
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
return result;
|
|
1435
|
-
}
|
|
1436
|
-
const base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1437
|
-
function decodeBase64(encoded) {
|
|
1438
|
-
return decodeBase64_internal(encoded, base64DecodeMap, DecodingPadding.Required);
|
|
1439
|
-
}
|
|
1440
|
-
function decodeBase64_internal(encoded, decodeMap, padding) {
|
|
1441
|
-
const result = new Uint8Array(Math.ceil(encoded.length / 4) * 3);
|
|
1442
|
-
let totalBytes = 0;
|
|
1443
|
-
for (let i = 0; i < encoded.length; i += 4) {
|
|
1444
|
-
let chunk = 0;
|
|
1445
|
-
let bitsRead = 0;
|
|
1446
|
-
for (let j = 0; j < 4; j++) {
|
|
1447
|
-
if (padding === DecodingPadding.Required && encoded[i + j] === "=") {
|
|
1448
|
-
continue;
|
|
1449
|
-
}
|
|
1450
|
-
if (padding === DecodingPadding.Ignore &&
|
|
1451
|
-
(i + j >= encoded.length || encoded[i + j] === "=")) {
|
|
1452
|
-
continue;
|
|
1453
|
-
}
|
|
1454
|
-
if (j > 0 && encoded[i + j - 1] === "=") {
|
|
1455
|
-
throw new Error("Invalid padding");
|
|
1456
|
-
}
|
|
1457
|
-
if (!(encoded[i + j] in decodeMap)) {
|
|
1458
|
-
throw new Error("Invalid character");
|
|
1459
|
-
}
|
|
1460
|
-
chunk |= decodeMap[encoded[i + j]] << ((3 - j) * 6);
|
|
1461
|
-
bitsRead += 6;
|
|
1462
|
-
}
|
|
1463
|
-
if (bitsRead < 24) {
|
|
1464
|
-
let unused;
|
|
1465
|
-
if (bitsRead === 12) {
|
|
1466
|
-
unused = chunk & 0xffff;
|
|
1467
|
-
}
|
|
1468
|
-
else if (bitsRead === 18) {
|
|
1469
|
-
unused = chunk & 0xff;
|
|
1470
|
-
}
|
|
1471
|
-
else {
|
|
1472
|
-
throw new Error("Invalid padding");
|
|
1473
|
-
}
|
|
1474
|
-
if (unused !== 0) {
|
|
1475
|
-
throw new Error("Invalid padding");
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
const byteLength = Math.floor(bitsRead / 8);
|
|
1479
|
-
for (let i = 0; i < byteLength; i++) {
|
|
1480
|
-
result[totalBytes] = (chunk >> (16 - i * 8)) & 0xff;
|
|
1481
|
-
totalBytes++;
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
return result.slice(0, totalBytes);
|
|
1485
|
-
}
|
|
1486
|
-
var EncodingPadding;
|
|
1487
|
-
(function (EncodingPadding) {
|
|
1488
|
-
EncodingPadding[EncodingPadding["Include"] = 0] = "Include";
|
|
1489
|
-
EncodingPadding[EncodingPadding["None"] = 1] = "None";
|
|
1490
|
-
})(EncodingPadding || (EncodingPadding = {}));
|
|
1491
|
-
var DecodingPadding;
|
|
1492
|
-
(function (DecodingPadding) {
|
|
1493
|
-
DecodingPadding[DecodingPadding["Required"] = 0] = "Required";
|
|
1494
|
-
DecodingPadding[DecodingPadding["Ignore"] = 1] = "Ignore";
|
|
1495
|
-
})(DecodingPadding || (DecodingPadding = {}));
|
|
1496
|
-
const base64DecodeMap = {
|
|
1497
|
-
"0": 52,
|
|
1498
|
-
"1": 53,
|
|
1499
|
-
"2": 54,
|
|
1500
|
-
"3": 55,
|
|
1501
|
-
"4": 56,
|
|
1502
|
-
"5": 57,
|
|
1503
|
-
"6": 58,
|
|
1504
|
-
"7": 59,
|
|
1505
|
-
"8": 60,
|
|
1506
|
-
"9": 61,
|
|
1507
|
-
A: 0,
|
|
1508
|
-
B: 1,
|
|
1509
|
-
C: 2,
|
|
1510
|
-
D: 3,
|
|
1511
|
-
E: 4,
|
|
1512
|
-
F: 5,
|
|
1513
|
-
G: 6,
|
|
1514
|
-
H: 7,
|
|
1515
|
-
I: 8,
|
|
1516
|
-
J: 9,
|
|
1517
|
-
K: 10,
|
|
1518
|
-
L: 11,
|
|
1519
|
-
M: 12,
|
|
1520
|
-
N: 13,
|
|
1521
|
-
O: 14,
|
|
1522
|
-
P: 15,
|
|
1523
|
-
Q: 16,
|
|
1524
|
-
R: 17,
|
|
1525
|
-
S: 18,
|
|
1526
|
-
T: 19,
|
|
1527
|
-
U: 20,
|
|
1528
|
-
V: 21,
|
|
1529
|
-
W: 22,
|
|
1530
|
-
X: 23,
|
|
1531
|
-
Y: 24,
|
|
1532
|
-
Z: 25,
|
|
1533
|
-
a: 26,
|
|
1534
|
-
b: 27,
|
|
1535
|
-
c: 28,
|
|
1536
|
-
d: 29,
|
|
1537
|
-
e: 30,
|
|
1538
|
-
f: 31,
|
|
1539
|
-
g: 32,
|
|
1540
|
-
h: 33,
|
|
1541
|
-
i: 34,
|
|
1542
|
-
j: 35,
|
|
1543
|
-
k: 36,
|
|
1544
|
-
l: 37,
|
|
1545
|
-
m: 38,
|
|
1546
|
-
n: 39,
|
|
1547
|
-
o: 40,
|
|
1548
|
-
p: 41,
|
|
1549
|
-
q: 42,
|
|
1550
|
-
r: 43,
|
|
1551
|
-
s: 44,
|
|
1552
|
-
t: 45,
|
|
1553
|
-
u: 46,
|
|
1554
|
-
v: 47,
|
|
1555
|
-
w: 48,
|
|
1556
|
-
x: 49,
|
|
1557
|
-
y: 50,
|
|
1558
|
-
z: 51,
|
|
1559
|
-
"+": 62,
|
|
1560
|
-
"/": 63
|
|
1561
|
-
};
|
|
1562
|
-
|
|
1563
|
-
const ALGORITHM = "AES-GCM";
|
|
1564
|
-
async function decodeKey(encoded) {
|
|
1565
|
-
const bytes = decodeBase64(encoded);
|
|
1566
|
-
return crypto.subtle.importKey("raw", bytes, ALGORITHM, true, ["encrypt", "decrypt"]);
|
|
1567
|
-
}
|
|
1568
|
-
const encoder = new TextEncoder();
|
|
1569
|
-
const decoder = new TextDecoder();
|
|
1570
|
-
const IV_LENGTH = 24;
|
|
1571
|
-
async function encryptString(key, raw) {
|
|
1572
|
-
const iv = crypto.getRandomValues(new Uint8Array(IV_LENGTH / 2));
|
|
1573
|
-
const data = encoder.encode(raw);
|
|
1574
|
-
const buffer = await crypto.subtle.encrypt(
|
|
1575
|
-
{
|
|
1576
|
-
name: ALGORITHM,
|
|
1577
|
-
iv
|
|
1578
|
-
},
|
|
1579
|
-
key,
|
|
1580
|
-
data
|
|
1581
|
-
);
|
|
1582
|
-
return encodeHexUpperCase(iv) + encodeBase64(new Uint8Array(buffer));
|
|
1583
|
-
}
|
|
1584
|
-
async function decryptString(key, encoded) {
|
|
1585
|
-
const iv = decodeHex(encoded.slice(0, IV_LENGTH));
|
|
1586
|
-
const dataArray = decodeBase64(encoded.slice(IV_LENGTH));
|
|
1587
|
-
const decryptedBuffer = await crypto.subtle.decrypt(
|
|
1588
|
-
{
|
|
1589
|
-
name: ALGORITHM,
|
|
1590
|
-
iv
|
|
1591
|
-
},
|
|
1592
|
-
key,
|
|
1593
|
-
dataArray
|
|
1594
|
-
);
|
|
1595
|
-
const decryptedString = decoder.decode(decryptedBuffer);
|
|
1596
|
-
return decryptedString;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
const internalProps = /* @__PURE__ */ new Set([
|
|
1600
|
-
"server:component-path",
|
|
1601
|
-
"server:component-export",
|
|
1602
|
-
"server:component-directive",
|
|
1603
|
-
"server:defer"
|
|
1604
|
-
]);
|
|
1605
|
-
function containsServerDirective(props) {
|
|
1606
|
-
return "server:component-directive" in props;
|
|
1607
|
-
}
|
|
1608
|
-
function safeJsonStringify(obj) {
|
|
1609
|
-
return JSON.stringify(obj).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\//g, "\\u002f");
|
|
1610
|
-
}
|
|
1611
|
-
function renderServerIsland(result, _displayName, props, slots) {
|
|
1612
|
-
return {
|
|
1613
|
-
async render(destination) {
|
|
1614
|
-
const componentPath = props["server:component-path"];
|
|
1615
|
-
const componentExport = props["server:component-export"];
|
|
1616
|
-
const componentId = result.serverIslandNameMap.get(componentPath);
|
|
1617
|
-
if (!componentId) {
|
|
1618
|
-
throw new Error(`Could not find server component name`);
|
|
1619
|
-
}
|
|
1620
|
-
for (const key2 of Object.keys(props)) {
|
|
1621
|
-
if (internalProps.has(key2)) {
|
|
1622
|
-
delete props[key2];
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
destination.write("<!--[if astro]>server-island-start<![endif]-->");
|
|
1626
|
-
const renderedSlots = {};
|
|
1627
|
-
for (const name in slots) {
|
|
1628
|
-
if (name !== "fallback") {
|
|
1629
|
-
const content = await renderSlotToString(result, slots[name]);
|
|
1630
|
-
renderedSlots[name] = content.toString();
|
|
1631
|
-
} else {
|
|
1632
|
-
await renderChild(destination, slots.fallback(result));
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
const key = await result.key;
|
|
1636
|
-
const propsEncrypted = await encryptString(key, JSON.stringify(props));
|
|
1637
|
-
const hostId = crypto.randomUUID();
|
|
1638
|
-
const slash = result.base.endsWith("/") ? "" : "/";
|
|
1639
|
-
const serverIslandUrl = `${result.base}${slash}_server-islands/${componentId}${result.trailingSlash === "always" ? "/" : ""}`;
|
|
1640
|
-
destination.write(`<script async type="module" data-island-id="${hostId}">
|
|
1641
|
-
let componentId = ${safeJsonStringify(componentId)};
|
|
1642
|
-
let componentExport = ${safeJsonStringify(componentExport)};
|
|
1643
|
-
let script = document.querySelector('script[data-island-id="${hostId}"]');
|
|
1644
|
-
let data = {
|
|
1645
|
-
componentExport,
|
|
1646
|
-
encryptedProps: ${safeJsonStringify(propsEncrypted)},
|
|
1647
|
-
slots: ${safeJsonStringify(renderedSlots)},
|
|
1648
|
-
};
|
|
1649
|
-
|
|
1650
|
-
let response = await fetch('${serverIslandUrl}', {
|
|
1651
|
-
method: 'POST',
|
|
1652
|
-
body: JSON.stringify(data),
|
|
1653
|
-
});
|
|
1654
|
-
if (script) {
|
|
1655
|
-
if(response.status === 200 && response.headers.get('content-type') === 'text/html') {
|
|
1656
|
-
let html = await response.text();
|
|
1657
|
-
|
|
1658
|
-
// Swap!
|
|
1659
|
-
while(script.previousSibling &&
|
|
1660
|
-
script.previousSibling.nodeType !== 8 &&
|
|
1661
|
-
script.previousSibling.data !== '[if astro]>server-island-start<![endif]') {
|
|
1662
|
-
script.previousSibling.remove();
|
|
1663
|
-
}
|
|
1664
|
-
script.previousSibling?.remove();
|
|
1665
|
-
|
|
1666
|
-
let frag = document.createRange().createContextualFragment(html);
|
|
1667
|
-
script.before(frag);
|
|
1668
|
-
}
|
|
1669
|
-
script.remove();
|
|
1670
|
-
}
|
|
1671
|
-
</script>`);
|
|
1672
|
-
}
|
|
1673
|
-
};
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
const needsHeadRenderingSymbol = Symbol.for("astro.needsHeadRendering");
|
|
1677
|
-
const rendererAliases = /* @__PURE__ */ new Map([["solid", "solid-js"]]);
|
|
1678
|
-
const clientOnlyValues = /* @__PURE__ */ new Set(["solid-js", "react", "preact", "vue", "svelte", "lit"]);
|
|
1679
|
-
function guessRenderers(componentUrl) {
|
|
1680
|
-
const extname = componentUrl?.split(".").pop();
|
|
1681
|
-
switch (extname) {
|
|
1682
|
-
case "svelte":
|
|
1683
|
-
return ["@astrojs/svelte"];
|
|
1684
|
-
case "vue":
|
|
1685
|
-
return ["@astrojs/vue"];
|
|
1686
|
-
case "jsx":
|
|
1687
|
-
case "tsx":
|
|
1688
|
-
return ["@astrojs/react", "@astrojs/preact", "@astrojs/solid-js", "@astrojs/vue (jsx)"];
|
|
1689
|
-
case void 0:
|
|
1690
|
-
default:
|
|
1691
|
-
return [
|
|
1692
|
-
"@astrojs/react",
|
|
1693
|
-
"@astrojs/preact",
|
|
1694
|
-
"@astrojs/solid-js",
|
|
1695
|
-
"@astrojs/vue",
|
|
1696
|
-
"@astrojs/svelte",
|
|
1697
|
-
"@astrojs/lit"
|
|
1698
|
-
];
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
function isFragmentComponent(Component) {
|
|
1702
|
-
return Component === Fragment;
|
|
1703
|
-
}
|
|
1704
|
-
function isHTMLComponent(Component) {
|
|
1705
|
-
return Component && Component["astro:html"] === true;
|
|
1706
|
-
}
|
|
1707
|
-
const ASTRO_SLOT_EXP = /<\/?astro-slot\b[^>]*>/g;
|
|
1708
|
-
const ASTRO_STATIC_SLOT_EXP = /<\/?astro-static-slot\b[^>]*>/g;
|
|
1709
|
-
function removeStaticAstroSlot(html, supportsAstroStaticSlot = true) {
|
|
1710
|
-
const exp = supportsAstroStaticSlot ? ASTRO_STATIC_SLOT_EXP : ASTRO_SLOT_EXP;
|
|
1711
|
-
return html.replace(exp, "");
|
|
1712
|
-
}
|
|
1713
|
-
async function renderFrameworkComponent(result, displayName, Component, _props, slots = {}) {
|
|
1714
|
-
if (!Component && "client:only" in _props === false) {
|
|
1715
|
-
throw new Error(
|
|
1716
|
-
`Unable to render ${displayName} because it is ${Component}!
|
|
1717
|
-
Did you forget to import the component or is it possible there is a typo?`
|
|
1718
|
-
);
|
|
1719
|
-
}
|
|
1720
|
-
const { renderers, clientDirectives } = result;
|
|
1721
|
-
const metadata = {
|
|
1722
|
-
astroStaticSlot: true,
|
|
1723
|
-
displayName
|
|
1724
|
-
};
|
|
1725
|
-
const { hydration, isPage, props, propsWithoutTransitionAttributes } = extractDirectives(
|
|
1726
|
-
_props,
|
|
1727
|
-
clientDirectives
|
|
1728
|
-
);
|
|
1729
|
-
let html = "";
|
|
1730
|
-
let attrs = void 0;
|
|
1731
|
-
if (hydration) {
|
|
1732
|
-
metadata.hydrate = hydration.directive;
|
|
1733
|
-
metadata.hydrateArgs = hydration.value;
|
|
1734
|
-
metadata.componentExport = hydration.componentExport;
|
|
1735
|
-
metadata.componentUrl = hydration.componentUrl;
|
|
1736
|
-
}
|
|
1737
|
-
const probableRendererNames = guessRenderers(metadata.componentUrl);
|
|
1738
|
-
const validRenderers = renderers.filter((r) => r.name !== "astro:jsx");
|
|
1739
|
-
const { children, slotInstructions } = await renderSlots(result, slots);
|
|
1740
|
-
let renderer;
|
|
1741
|
-
if (metadata.hydrate !== "only") {
|
|
1742
|
-
let isTagged = false;
|
|
1743
|
-
try {
|
|
1744
|
-
isTagged = Component && Component[Renderer];
|
|
1745
|
-
} catch {
|
|
1746
|
-
}
|
|
1747
|
-
if (isTagged) {
|
|
1748
|
-
const rendererName = Component[Renderer];
|
|
1749
|
-
renderer = renderers.find(({ name }) => name === rendererName);
|
|
1750
|
-
}
|
|
1751
|
-
if (!renderer) {
|
|
1752
|
-
let error;
|
|
1753
|
-
for (const r of renderers) {
|
|
1754
|
-
try {
|
|
1755
|
-
if (await r.ssr.check.call({ result }, Component, props, children)) {
|
|
1756
|
-
renderer = r;
|
|
1757
|
-
break;
|
|
1758
|
-
}
|
|
1759
|
-
} catch (e) {
|
|
1760
|
-
error ??= e;
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
if (!renderer && error) {
|
|
1764
|
-
throw error;
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
if (!renderer && typeof HTMLElement === "function" && componentIsHTMLElement(Component)) {
|
|
1768
|
-
const output = await renderHTMLElement(
|
|
1769
|
-
result,
|
|
1770
|
-
Component,
|
|
1771
|
-
_props,
|
|
1772
|
-
slots
|
|
1773
|
-
);
|
|
1774
|
-
return {
|
|
1775
|
-
render(destination) {
|
|
1776
|
-
destination.write(output);
|
|
1777
|
-
}
|
|
1778
|
-
};
|
|
1779
|
-
}
|
|
1780
|
-
} else {
|
|
1781
|
-
if (metadata.hydrateArgs) {
|
|
1782
|
-
const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
|
|
1783
|
-
if (clientOnlyValues.has(rendererName)) {
|
|
1784
|
-
renderer = renderers.find(
|
|
1785
|
-
({ name }) => name === `@astrojs/${rendererName}` || name === rendererName
|
|
1786
|
-
);
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
if (!renderer && validRenderers.length === 1) {
|
|
1790
|
-
renderer = validRenderers[0];
|
|
1791
|
-
}
|
|
1792
|
-
if (!renderer) {
|
|
1793
|
-
const extname = metadata.componentUrl?.split(".").pop();
|
|
1794
|
-
renderer = renderers.find(({ name }) => name === `@astrojs/${extname}` || name === extname);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
if (!renderer) {
|
|
1798
|
-
if (metadata.hydrate === "only") {
|
|
1799
|
-
const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
|
|
1800
|
-
if (clientOnlyValues.has(rendererName)) {
|
|
1801
|
-
const plural = validRenderers.length > 1;
|
|
1802
|
-
throw new AstroError({
|
|
1803
|
-
...NoMatchingRenderer,
|
|
1804
|
-
message: NoMatchingRenderer.message(
|
|
1805
|
-
metadata.displayName,
|
|
1806
|
-
metadata?.componentUrl?.split(".").pop(),
|
|
1807
|
-
plural,
|
|
1808
|
-
validRenderers.length
|
|
1809
|
-
),
|
|
1810
|
-
hint: NoMatchingRenderer.hint(
|
|
1811
|
-
formatList(probableRendererNames.map((r) => "`" + r + "`"))
|
|
1812
|
-
)
|
|
1813
|
-
});
|
|
1814
|
-
} else {
|
|
1815
|
-
throw new AstroError({
|
|
1816
|
-
...NoClientOnlyHint,
|
|
1817
|
-
message: NoClientOnlyHint.message(metadata.displayName),
|
|
1818
|
-
hint: NoClientOnlyHint.hint(
|
|
1819
|
-
probableRendererNames.map((r) => r.replace("@astrojs/", "")).join("|")
|
|
1820
|
-
)
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1823
|
-
} else if (typeof Component !== "string") {
|
|
1824
|
-
const matchingRenderers = validRenderers.filter(
|
|
1825
|
-
(r) => probableRendererNames.includes(r.name)
|
|
1826
|
-
);
|
|
1827
|
-
const plural = validRenderers.length > 1;
|
|
1828
|
-
if (matchingRenderers.length === 0) {
|
|
1829
|
-
throw new AstroError({
|
|
1830
|
-
...NoMatchingRenderer,
|
|
1831
|
-
message: NoMatchingRenderer.message(
|
|
1832
|
-
metadata.displayName,
|
|
1833
|
-
metadata?.componentUrl?.split(".").pop(),
|
|
1834
|
-
plural,
|
|
1835
|
-
validRenderers.length
|
|
1836
|
-
),
|
|
1837
|
-
hint: NoMatchingRenderer.hint(
|
|
1838
|
-
formatList(probableRendererNames.map((r) => "`" + r + "`"))
|
|
1839
|
-
)
|
|
1840
|
-
});
|
|
1841
|
-
} else if (matchingRenderers.length === 1) {
|
|
1842
|
-
renderer = matchingRenderers[0];
|
|
1843
|
-
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
|
1844
|
-
{ result },
|
|
1845
|
-
Component,
|
|
1846
|
-
propsWithoutTransitionAttributes,
|
|
1847
|
-
children,
|
|
1848
|
-
metadata
|
|
1849
|
-
));
|
|
1850
|
-
} else {
|
|
1851
|
-
throw new Error(`Unable to render ${metadata.displayName}!
|
|
1852
|
-
|
|
1853
|
-
This component likely uses ${formatList(probableRendererNames)},
|
|
1854
|
-
but Astro encountered an error during server-side rendering.
|
|
1855
|
-
|
|
1856
|
-
Please ensure that ${metadata.displayName}:
|
|
1857
|
-
1. Does not unconditionally access browser-specific globals like \`window\` or \`document\`.
|
|
1858
|
-
If this is unavoidable, use the \`client:only\` hydration directive.
|
|
1859
|
-
2. Does not conditionally return \`null\` or \`undefined\` when rendered on the server.
|
|
1860
|
-
|
|
1861
|
-
If you're still stuck, please open an issue on GitHub or join us at https://astro.build/chat.`);
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
} else {
|
|
1865
|
-
if (metadata.hydrate === "only") {
|
|
1866
|
-
const rendererName = rendererAliases.has(metadata.hydrateArgs) ? rendererAliases.get(metadata.hydrateArgs) : metadata.hydrateArgs;
|
|
1867
|
-
if (!clientOnlyValues.has(rendererName)) {
|
|
1868
|
-
console.warn(
|
|
1869
|
-
`The client:only directive for ${metadata.displayName} is not recognized. The renderer ${renderer.name} will be used. If you intended to use a different renderer, please provide a valid client:only directive.`
|
|
1870
|
-
);
|
|
1871
|
-
}
|
|
1872
|
-
html = await renderSlotToString(result, slots?.fallback);
|
|
1873
|
-
} else {
|
|
1874
|
-
performance.now();
|
|
1875
|
-
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
|
1876
|
-
{ result },
|
|
1877
|
-
Component,
|
|
1878
|
-
propsWithoutTransitionAttributes,
|
|
1879
|
-
children,
|
|
1880
|
-
metadata
|
|
1881
|
-
));
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
if (renderer && !renderer.clientEntrypoint && renderer.name !== "@astrojs/lit" && metadata.hydrate) {
|
|
1885
|
-
throw new AstroError({
|
|
1886
|
-
...NoClientEntrypoint,
|
|
1887
|
-
message: NoClientEntrypoint.message(
|
|
1888
|
-
displayName,
|
|
1889
|
-
metadata.hydrate,
|
|
1890
|
-
renderer.name
|
|
1891
|
-
)
|
|
1892
|
-
});
|
|
1893
|
-
}
|
|
1894
|
-
if (!html && typeof Component === "string") {
|
|
1895
|
-
const Tag = sanitizeElementName(Component);
|
|
1896
|
-
const childSlots = Object.values(children).join("");
|
|
1897
|
-
const renderTemplateResult = renderTemplate`<${Tag}${internalSpreadAttributes(
|
|
1898
|
-
props
|
|
1899
|
-
)}${markHTMLString(
|
|
1900
|
-
childSlots === "" && voidElementNames.test(Tag) ? `/>` : `>${childSlots}</${Tag}>`
|
|
1901
|
-
)}`;
|
|
1902
|
-
html = "";
|
|
1903
|
-
const destination = {
|
|
1904
|
-
write(chunk) {
|
|
1905
|
-
if (chunk instanceof Response) return;
|
|
1906
|
-
html += chunkToString(result, chunk);
|
|
1907
|
-
}
|
|
1908
|
-
};
|
|
1909
|
-
await renderTemplateResult.render(destination);
|
|
1910
|
-
}
|
|
1911
|
-
if (!hydration) {
|
|
1912
|
-
return {
|
|
1913
|
-
render(destination) {
|
|
1914
|
-
if (slotInstructions) {
|
|
1915
|
-
for (const instruction of slotInstructions) {
|
|
1916
|
-
destination.write(instruction);
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
if (isPage || renderer?.name === "astro:jsx") {
|
|
1920
|
-
destination.write(html);
|
|
1921
|
-
} else if (html && html.length > 0) {
|
|
1922
|
-
destination.write(
|
|
1923
|
-
markHTMLString(removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot))
|
|
1924
|
-
);
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
};
|
|
1928
|
-
}
|
|
1929
|
-
const astroId = shorthash(
|
|
1930
|
-
`<!--${metadata.componentExport.value}:${metadata.componentUrl}-->
|
|
1931
|
-
${html}
|
|
1932
|
-
${serializeProps(
|
|
1933
|
-
props,
|
|
1934
|
-
metadata
|
|
1935
|
-
)}`
|
|
1936
|
-
);
|
|
1937
|
-
const island = await generateHydrateScript(
|
|
1938
|
-
{ renderer, result, astroId, props, attrs },
|
|
1939
|
-
metadata
|
|
1940
|
-
);
|
|
1941
|
-
let unrenderedSlots = [];
|
|
1942
|
-
if (html) {
|
|
1943
|
-
if (Object.keys(children).length > 0) {
|
|
1944
|
-
for (const key of Object.keys(children)) {
|
|
1945
|
-
let tagName = renderer?.ssr?.supportsAstroStaticSlot ? !!metadata.hydrate ? "astro-slot" : "astro-static-slot" : "astro-slot";
|
|
1946
|
-
let expectedHTML = key === "default" ? `<${tagName}>` : `<${tagName} name="${key}">`;
|
|
1947
|
-
if (!html.includes(expectedHTML)) {
|
|
1948
|
-
unrenderedSlots.push(key);
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
} else {
|
|
1953
|
-
unrenderedSlots = Object.keys(children);
|
|
1954
|
-
}
|
|
1955
|
-
const template = unrenderedSlots.length > 0 ? unrenderedSlots.map(
|
|
1956
|
-
(key) => `<template data-astro-template${key !== "default" ? `="${key}"` : ""}>${children[key]}</template>`
|
|
1957
|
-
).join("") : "";
|
|
1958
|
-
island.children = `${html ?? ""}${template}`;
|
|
1959
|
-
if (island.children) {
|
|
1960
|
-
island.props["await-children"] = "";
|
|
1961
|
-
island.children += `<!--astro:end-->`;
|
|
1962
|
-
}
|
|
1963
|
-
return {
|
|
1964
|
-
render(destination) {
|
|
1965
|
-
if (slotInstructions) {
|
|
1966
|
-
for (const instruction of slotInstructions) {
|
|
1967
|
-
destination.write(instruction);
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
destination.write(createRenderInstruction({ type: "directive", hydration }));
|
|
1971
|
-
if (hydration.directive !== "only" && renderer?.ssr.renderHydrationScript) {
|
|
1972
|
-
destination.write(
|
|
1973
|
-
createRenderInstruction({
|
|
1974
|
-
type: "renderer-hydration-script",
|
|
1975
|
-
rendererName: renderer.name,
|
|
1976
|
-
render: renderer.ssr.renderHydrationScript
|
|
1977
|
-
})
|
|
1978
|
-
);
|
|
1979
|
-
}
|
|
1980
|
-
const renderedElement = renderElement$1("astro-island", island, false);
|
|
1981
|
-
destination.write(markHTMLString(renderedElement));
|
|
1982
|
-
}
|
|
1983
|
-
};
|
|
1984
|
-
}
|
|
1985
|
-
function sanitizeElementName(tag) {
|
|
1986
|
-
const unsafe = /[&<>'"\s]+/;
|
|
1987
|
-
if (!unsafe.test(tag)) return tag;
|
|
1988
|
-
return tag.trim().split(unsafe)[0].trim();
|
|
1989
|
-
}
|
|
1990
|
-
async function renderFragmentComponent(result, slots = {}) {
|
|
1991
|
-
const children = await renderSlotToString(result, slots?.default);
|
|
1992
|
-
return {
|
|
1993
|
-
render(destination) {
|
|
1994
|
-
if (children == null) return;
|
|
1995
|
-
destination.write(children);
|
|
1996
|
-
}
|
|
1997
|
-
};
|
|
1998
|
-
}
|
|
1999
|
-
async function renderHTMLComponent(result, Component, _props, slots = {}) {
|
|
2000
|
-
const { slotInstructions, children } = await renderSlots(result, slots);
|
|
2001
|
-
const html = Component({ slots: children });
|
|
2002
|
-
const hydrationHtml = slotInstructions ? slotInstructions.map((instr) => chunkToString(result, instr)).join("") : "";
|
|
2003
|
-
return {
|
|
2004
|
-
render(destination) {
|
|
2005
|
-
destination.write(markHTMLString(hydrationHtml + html));
|
|
2006
|
-
}
|
|
2007
|
-
};
|
|
2008
|
-
}
|
|
2009
|
-
function renderAstroComponent(result, displayName, Component, props, slots = {}) {
|
|
2010
|
-
if (containsServerDirective(props)) {
|
|
2011
|
-
return renderServerIsland(result, displayName, props, slots);
|
|
2012
|
-
}
|
|
2013
|
-
const instance = createAstroComponentInstance(result, displayName, Component, props, slots);
|
|
2014
|
-
return {
|
|
2015
|
-
async render(destination) {
|
|
2016
|
-
await instance.render(destination);
|
|
2017
|
-
}
|
|
2018
|
-
};
|
|
2019
|
-
}
|
|
2020
|
-
async function renderComponent(result, displayName, Component, props, slots = {}) {
|
|
2021
|
-
if (isPromise(Component)) {
|
|
2022
|
-
Component = await Component.catch(handleCancellation);
|
|
2023
|
-
}
|
|
2024
|
-
if (isFragmentComponent(Component)) {
|
|
2025
|
-
return await renderFragmentComponent(result, slots).catch(handleCancellation);
|
|
2026
|
-
}
|
|
2027
|
-
props = normalizeProps(props);
|
|
2028
|
-
if (isHTMLComponent(Component)) {
|
|
2029
|
-
return await renderHTMLComponent(result, Component, props, slots).catch(handleCancellation);
|
|
2030
|
-
}
|
|
2031
|
-
if (isAstroComponentFactory(Component)) {
|
|
2032
|
-
return renderAstroComponent(result, displayName, Component, props, slots);
|
|
2033
|
-
}
|
|
2034
|
-
return await renderFrameworkComponent(result, displayName, Component, props, slots).catch(
|
|
2035
|
-
handleCancellation
|
|
2036
|
-
);
|
|
2037
|
-
function handleCancellation(e) {
|
|
2038
|
-
if (result.cancelled)
|
|
2039
|
-
return {
|
|
2040
|
-
render() {
|
|
2041
|
-
}
|
|
2042
|
-
};
|
|
2043
|
-
throw e;
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
function normalizeProps(props) {
|
|
2047
|
-
if (props["class:list"] !== void 0) {
|
|
2048
|
-
const value = props["class:list"];
|
|
2049
|
-
delete props["class:list"];
|
|
2050
|
-
props["class"] = clsx(props["class"], value);
|
|
2051
|
-
if (props["class"] === "") {
|
|
2052
|
-
delete props["class"];
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
return props;
|
|
2056
|
-
}
|
|
2057
|
-
async function renderComponentToString(result, displayName, Component, props, slots = {}, isPage = false, route) {
|
|
2058
|
-
let str = "";
|
|
2059
|
-
let renderedFirstPageChunk = false;
|
|
2060
|
-
let head = "";
|
|
2061
|
-
if (isPage && !result.partial && nonAstroPageNeedsHeadInjection(Component)) {
|
|
2062
|
-
head += chunkToString(result, maybeRenderHead());
|
|
2063
|
-
}
|
|
2064
|
-
try {
|
|
2065
|
-
const destination = {
|
|
2066
|
-
write(chunk) {
|
|
2067
|
-
if (isPage && !result.partial && !renderedFirstPageChunk) {
|
|
2068
|
-
renderedFirstPageChunk = true;
|
|
2069
|
-
if (!/<!doctype html/i.test(String(chunk))) {
|
|
2070
|
-
const doctype = result.compressHTML ? "<!DOCTYPE html>" : "<!DOCTYPE html>\n";
|
|
2071
|
-
str += doctype + head;
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
if (chunk instanceof Response) return;
|
|
2075
|
-
str += chunkToString(result, chunk);
|
|
2076
|
-
}
|
|
2077
|
-
};
|
|
2078
|
-
const renderInstance = await renderComponent(result, displayName, Component, props, slots);
|
|
2079
|
-
await renderInstance.render(destination);
|
|
2080
|
-
} catch (e) {
|
|
2081
|
-
if (AstroError.is(e) && !e.loc) {
|
|
2082
|
-
e.setLocation({
|
|
2083
|
-
file: route?.component
|
|
2084
|
-
});
|
|
2085
|
-
}
|
|
2086
|
-
throw e;
|
|
2087
|
-
}
|
|
2088
|
-
return str;
|
|
2089
|
-
}
|
|
2090
|
-
function nonAstroPageNeedsHeadInjection(pageComponent) {
|
|
2091
|
-
return !!pageComponent?.[needsHeadRenderingSymbol];
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
const ClientOnlyPlaceholder = "astro-client-only";
|
|
2095
|
-
const hasTriedRenderComponentSymbol = Symbol("hasTriedRenderComponent");
|
|
2096
|
-
async function renderJSX(result, vnode) {
|
|
2097
|
-
switch (true) {
|
|
2098
|
-
case vnode instanceof HTMLString:
|
|
2099
|
-
if (vnode.toString().trim() === "") {
|
|
2100
|
-
return "";
|
|
2101
|
-
}
|
|
2102
|
-
return vnode;
|
|
2103
|
-
case typeof vnode === "string":
|
|
2104
|
-
return markHTMLString(escapeHTML(vnode));
|
|
2105
|
-
case typeof vnode === "function":
|
|
2106
|
-
return vnode;
|
|
2107
|
-
case (!vnode && vnode !== 0):
|
|
2108
|
-
return "";
|
|
2109
|
-
case Array.isArray(vnode):
|
|
2110
|
-
return markHTMLString(
|
|
2111
|
-
(await Promise.all(vnode.map((v) => renderJSX(result, v)))).join("")
|
|
2112
|
-
);
|
|
2113
|
-
}
|
|
2114
|
-
return renderJSXVNode(result, vnode);
|
|
2115
|
-
}
|
|
2116
|
-
async function renderJSXVNode(result, vnode) {
|
|
2117
|
-
if (isVNode(vnode)) {
|
|
2118
|
-
switch (true) {
|
|
2119
|
-
case !vnode.type: {
|
|
2120
|
-
throw new Error(`Unable to render ${result.pathname} because it contains an undefined Component!
|
|
2121
|
-
Did you forget to import the component or is it possible there is a typo?`);
|
|
2122
|
-
}
|
|
2123
|
-
case vnode.type === Symbol.for("astro:fragment"):
|
|
2124
|
-
return renderJSX(result, vnode.props.children);
|
|
2125
|
-
case vnode.type.isAstroComponentFactory: {
|
|
2126
|
-
let props = {};
|
|
2127
|
-
let slots = {};
|
|
2128
|
-
for (const [key, value] of Object.entries(vnode.props ?? {})) {
|
|
2129
|
-
if (key === "children" || value && typeof value === "object" && value["$$slot"]) {
|
|
2130
|
-
slots[key === "children" ? "default" : key] = () => renderJSX(result, value);
|
|
2131
|
-
} else {
|
|
2132
|
-
props[key] = value;
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
const str = await renderToString(result, vnode.type, props, slots);
|
|
2136
|
-
if (str instanceof Response) {
|
|
2137
|
-
throw str;
|
|
2138
|
-
}
|
|
2139
|
-
const html = markHTMLString(str);
|
|
2140
|
-
return html;
|
|
2141
|
-
}
|
|
2142
|
-
case (!vnode.type && vnode.type !== 0):
|
|
2143
|
-
return "";
|
|
2144
|
-
case (typeof vnode.type === "string" && vnode.type !== ClientOnlyPlaceholder):
|
|
2145
|
-
return markHTMLString(await renderElement(result, vnode.type, vnode.props ?? {}));
|
|
2146
|
-
}
|
|
2147
|
-
if (vnode.type) {
|
|
2148
|
-
let extractSlots2 = function(child) {
|
|
2149
|
-
if (Array.isArray(child)) {
|
|
2150
|
-
return child.map((c) => extractSlots2(c));
|
|
2151
|
-
}
|
|
2152
|
-
if (!isVNode(child)) {
|
|
2153
|
-
_slots.default.push(child);
|
|
2154
|
-
return;
|
|
2155
|
-
}
|
|
2156
|
-
if ("slot" in child.props) {
|
|
2157
|
-
_slots[child.props.slot] = [..._slots[child.props.slot] ?? [], child];
|
|
2158
|
-
delete child.props.slot;
|
|
2159
|
-
return;
|
|
2160
|
-
}
|
|
2161
|
-
_slots.default.push(child);
|
|
2162
|
-
};
|
|
2163
|
-
if (typeof vnode.type === "function" && vnode.props["server:root"]) {
|
|
2164
|
-
const output2 = await vnode.type(vnode.props ?? {});
|
|
2165
|
-
return await renderJSX(result, output2);
|
|
2166
|
-
}
|
|
2167
|
-
if (typeof vnode.type === "function") {
|
|
2168
|
-
if (vnode.props[hasTriedRenderComponentSymbol]) {
|
|
2169
|
-
delete vnode.props[hasTriedRenderComponentSymbol];
|
|
2170
|
-
const output2 = await vnode.type(vnode.props ?? {});
|
|
2171
|
-
if (output2?.[AstroJSX] || !output2) {
|
|
2172
|
-
return await renderJSXVNode(result, output2);
|
|
2173
|
-
} else {
|
|
2174
|
-
return;
|
|
2175
|
-
}
|
|
2176
|
-
} else {
|
|
2177
|
-
vnode.props[hasTriedRenderComponentSymbol] = true;
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
const { children = null, ...props } = vnode.props ?? {};
|
|
2181
|
-
const _slots = {
|
|
2182
|
-
default: []
|
|
2183
|
-
};
|
|
2184
|
-
extractSlots2(children);
|
|
2185
|
-
for (const [key, value] of Object.entries(props)) {
|
|
2186
|
-
if (value?.["$$slot"]) {
|
|
2187
|
-
_slots[key] = value;
|
|
2188
|
-
delete props[key];
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
const slotPromises = [];
|
|
2192
|
-
const slots = {};
|
|
2193
|
-
for (const [key, value] of Object.entries(_slots)) {
|
|
2194
|
-
slotPromises.push(
|
|
2195
|
-
renderJSX(result, value).then((output2) => {
|
|
2196
|
-
if (output2.toString().trim().length === 0) return;
|
|
2197
|
-
slots[key] = () => output2;
|
|
2198
|
-
})
|
|
2199
|
-
);
|
|
2200
|
-
}
|
|
2201
|
-
await Promise.all(slotPromises);
|
|
2202
|
-
let output;
|
|
2203
|
-
if (vnode.type === ClientOnlyPlaceholder && vnode.props["client:only"]) {
|
|
2204
|
-
output = await renderComponentToString(
|
|
2205
|
-
result,
|
|
2206
|
-
vnode.props["client:display-name"] ?? "",
|
|
2207
|
-
null,
|
|
2208
|
-
props,
|
|
2209
|
-
slots
|
|
2210
|
-
);
|
|
2211
|
-
} else {
|
|
2212
|
-
output = await renderComponentToString(
|
|
2213
|
-
result,
|
|
2214
|
-
typeof vnode.type === "function" ? vnode.type.name : vnode.type,
|
|
2215
|
-
vnode.type,
|
|
2216
|
-
props,
|
|
2217
|
-
slots
|
|
2218
|
-
);
|
|
2219
|
-
}
|
|
2220
|
-
return markHTMLString(output);
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
return markHTMLString(`${vnode}`);
|
|
2224
|
-
}
|
|
2225
|
-
async function renderElement(result, tag, { children, ...props }) {
|
|
2226
|
-
return markHTMLString(
|
|
2227
|
-
`<${tag}${spreadAttributes(props)}${markHTMLString(
|
|
2228
|
-
(children == null || children == "") && voidElementNames.test(tag) ? `/>` : `>${children == null ? "" : await renderJSX(result, prerenderElementChildren(tag, children))}</${tag}>`
|
|
2229
|
-
)}`
|
|
2230
|
-
);
|
|
2231
|
-
}
|
|
2232
|
-
function prerenderElementChildren(tag, children) {
|
|
2233
|
-
if (typeof children === "string" && (tag === "style" || tag === "script")) {
|
|
2234
|
-
return markHTMLString(children);
|
|
2235
|
-
} else {
|
|
2236
|
-
return children;
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
async function renderPage(result, componentFactory, props, children, streaming, route) {
|
|
2241
|
-
if (!isAstroComponentFactory(componentFactory)) {
|
|
2242
|
-
result._metadata.headInTree = result.componentMetadata.get(componentFactory.moduleId)?.containsHead ?? false;
|
|
2243
|
-
const pageProps = { ...props ?? {}, "server:root": true };
|
|
2244
|
-
const str = await renderComponentToString(
|
|
2245
|
-
result,
|
|
2246
|
-
componentFactory.name,
|
|
2247
|
-
componentFactory,
|
|
2248
|
-
pageProps,
|
|
2249
|
-
{},
|
|
2250
|
-
true,
|
|
2251
|
-
route
|
|
2252
|
-
);
|
|
2253
|
-
const bytes = encoder$1.encode(str);
|
|
2254
|
-
return new Response(bytes, {
|
|
2255
|
-
headers: new Headers([
|
|
2256
|
-
["Content-Type", "text/html; charset=utf-8"],
|
|
2257
|
-
["Content-Length", bytes.byteLength.toString()]
|
|
2258
|
-
])
|
|
2259
|
-
});
|
|
2260
|
-
}
|
|
2261
|
-
result._metadata.headInTree = result.componentMetadata.get(componentFactory.moduleId)?.containsHead ?? false;
|
|
2262
|
-
let body;
|
|
2263
|
-
if (streaming) {
|
|
2264
|
-
if (isNode && !isDeno) {
|
|
2265
|
-
const nodeBody = await renderToAsyncIterable(
|
|
2266
|
-
result,
|
|
2267
|
-
componentFactory,
|
|
2268
|
-
props,
|
|
2269
|
-
children,
|
|
2270
|
-
true,
|
|
2271
|
-
route
|
|
2272
|
-
);
|
|
2273
|
-
body = nodeBody;
|
|
2274
|
-
} else {
|
|
2275
|
-
body = await renderToReadableStream(result, componentFactory, props, children, true, route);
|
|
2276
|
-
}
|
|
2277
|
-
} else {
|
|
2278
|
-
body = await renderToString(result, componentFactory, props, children, true, route);
|
|
2279
|
-
}
|
|
2280
|
-
if (body instanceof Response) return body;
|
|
2281
|
-
const init = result.response;
|
|
2282
|
-
const headers = new Headers(init.headers);
|
|
2283
|
-
if (!streaming && typeof body === "string") {
|
|
2284
|
-
body = encoder$1.encode(body);
|
|
2285
|
-
headers.set("Content-Length", body.byteLength.toString());
|
|
2286
|
-
}
|
|
2287
|
-
if (route?.component.endsWith(".md")) {
|
|
2288
|
-
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
2289
|
-
}
|
|
2290
|
-
let status = init.status;
|
|
2291
|
-
if (route?.route === "/404") {
|
|
2292
|
-
status = 404;
|
|
2293
|
-
} else if (route?.route === "/500") {
|
|
2294
|
-
status = 500;
|
|
2295
|
-
}
|
|
2296
|
-
if (status) {
|
|
2297
|
-
return new Response(body, { ...init, headers, status });
|
|
2298
|
-
} else {
|
|
2299
|
-
return new Response(body, { ...init, headers });
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2304
|
-
|
|
2305
|
-
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".split("").reduce((v, c) => (v[c.charCodeAt(0)] = c, v), []);
|
|
2306
|
-
"-0123456789_".split("").reduce((v, c) => (v[c.charCodeAt(0)] = c, v), []);
|
|
2307
|
-
|
|
2308
|
-
function __astro_tag_component__(Component, rendererName) {
|
|
2309
|
-
if (!Component) return;
|
|
2310
|
-
if (typeof Component !== "function") return;
|
|
2311
|
-
Object.defineProperty(Component, Renderer, {
|
|
2312
|
-
value: rendererName,
|
|
2313
|
-
enumerable: false,
|
|
2314
|
-
writable: false
|
|
2315
|
-
});
|
|
2316
|
-
}
|
|
2317
|
-
function spreadAttributes(values = {}, _name, { class: scopedClassName } = {}) {
|
|
2318
|
-
let output = "";
|
|
2319
|
-
if (scopedClassName) {
|
|
2320
|
-
if (typeof values.class !== "undefined") {
|
|
2321
|
-
values.class += ` ${scopedClassName}`;
|
|
2322
|
-
} else if (typeof values["class:list"] !== "undefined") {
|
|
2323
|
-
values["class:list"] = [values["class:list"], scopedClassName];
|
|
2324
|
-
} else {
|
|
2325
|
-
values.class = scopedClassName;
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
for (const [key, value] of Object.entries(values)) {
|
|
2329
|
-
output += addAttribute(value, key, true);
|
|
2330
|
-
}
|
|
2331
|
-
return markHTMLString(output);
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
const AstroJSX = "astro:jsx";
|
|
2335
|
-
const Empty = Symbol("empty");
|
|
2336
|
-
const toSlotName = (slotAttr) => slotAttr;
|
|
2337
|
-
function isVNode(vnode) {
|
|
2338
|
-
return vnode && typeof vnode === "object" && vnode[AstroJSX];
|
|
2339
|
-
}
|
|
2340
|
-
function transformSlots(vnode) {
|
|
2341
|
-
if (typeof vnode.type === "string") return vnode;
|
|
2342
|
-
const slots = {};
|
|
2343
|
-
if (isVNode(vnode.props.children)) {
|
|
2344
|
-
const child = vnode.props.children;
|
|
2345
|
-
if (!isVNode(child)) return;
|
|
2346
|
-
if (!("slot" in child.props)) return;
|
|
2347
|
-
const name = toSlotName(child.props.slot);
|
|
2348
|
-
slots[name] = [child];
|
|
2349
|
-
slots[name]["$$slot"] = true;
|
|
2350
|
-
delete child.props.slot;
|
|
2351
|
-
delete vnode.props.children;
|
|
2352
|
-
} else if (Array.isArray(vnode.props.children)) {
|
|
2353
|
-
vnode.props.children = vnode.props.children.map((child) => {
|
|
2354
|
-
if (!isVNode(child)) return child;
|
|
2355
|
-
if (!("slot" in child.props)) return child;
|
|
2356
|
-
const name = toSlotName(child.props.slot);
|
|
2357
|
-
if (Array.isArray(slots[name])) {
|
|
2358
|
-
slots[name].push(child);
|
|
2359
|
-
} else {
|
|
2360
|
-
slots[name] = [child];
|
|
2361
|
-
slots[name]["$$slot"] = true;
|
|
2362
|
-
}
|
|
2363
|
-
delete child.props.slot;
|
|
2364
|
-
return Empty;
|
|
2365
|
-
}).filter((v) => v !== Empty);
|
|
2366
|
-
}
|
|
2367
|
-
Object.assign(vnode.props, slots);
|
|
2368
|
-
}
|
|
2369
|
-
function markRawChildren(child) {
|
|
2370
|
-
if (typeof child === "string") return markHTMLString(child);
|
|
2371
|
-
if (Array.isArray(child)) return child.map((c) => markRawChildren(c));
|
|
2372
|
-
return child;
|
|
2373
|
-
}
|
|
2374
|
-
function transformSetDirectives(vnode) {
|
|
2375
|
-
if (!("set:html" in vnode.props || "set:text" in vnode.props)) return;
|
|
2376
|
-
if ("set:html" in vnode.props) {
|
|
2377
|
-
const children = markRawChildren(vnode.props["set:html"]);
|
|
2378
|
-
delete vnode.props["set:html"];
|
|
2379
|
-
Object.assign(vnode.props, { children });
|
|
2380
|
-
return;
|
|
2381
|
-
}
|
|
2382
|
-
if ("set:text" in vnode.props) {
|
|
2383
|
-
const children = vnode.props["set:text"];
|
|
2384
|
-
delete vnode.props["set:text"];
|
|
2385
|
-
Object.assign(vnode.props, { children });
|
|
2386
|
-
return;
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
function createVNode(type, props) {
|
|
2390
|
-
const vnode = {
|
|
2391
|
-
[Renderer]: "astro:jsx",
|
|
2392
|
-
[AstroJSX]: true,
|
|
2393
|
-
type,
|
|
2394
|
-
props: props ?? {}
|
|
2395
|
-
};
|
|
2396
|
-
transformSetDirectives(vnode);
|
|
2397
|
-
transformSlots(vnode);
|
|
2398
|
-
return vnode;
|
|
2399
|
-
}
|
|
2400
|
-
|
|
2401
|
-
export { AstroJSX as A, spreadAttributes as B, commonjsGlobal as C, DEFAULT_404_COMPONENT as D, decryptString as E, Fragment as F, createSlotValueFromString as G, bold as H, red as I, yellow as J, dim as K, blue as L, REROUTABLE_STATUS_CODES as M, NOOP_MIDDLEWARE_HEADER as N, REROUTE_DIRECTIVE_HEADER as R, __astro_tag_component__ as _, renderSlotToString as a, chunkToString as b, createVNode as c, decodeKey as d, escape as e, ROUTE_TYPE_HEADER as f, ASTRO_VERSION as g, clientLocalsSymbol as h, isRenderInstruction as i, clientAddressSymbol as j, responseSentSymbol as k, renderPage as l, REWRITE_DIRECTIVE_HEADER_KEY as m, REWRITE_DIRECTIVE_HEADER_VALUE as n, originPathnameSymbol as o, renderEndpoint as p, createComponent as q, renderJSX as r, maybeRenderHead as s, renderTemplate as t, createAstro as u, addAttribute as v, renderSlot as w, renderComponent as x, renderHead as y, unescapeHTML as z };
|