@dioramajs/diorama 0.1.1 → 0.1.2
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/dist/cdn/{ambient-D9XlnBha.js → ambient-DIZGYvSi.js} +1 -1
- package/dist/cdn/{assemble-D14Im2UN.js → assemble-MJ_EvuR8.js} +1 -1
- package/dist/cdn/auto.js +3 -3
- package/dist/cdn/{beam-VmgB6FLS.js → beam-CRy7xI4S.js} +1 -1
- package/dist/cdn/{beat-C24ln4i2.js → beat-DLeilsFn.js} +1 -1
- package/dist/cdn/{bitmap-B-zWPVnC-DU22YoJN.js → bitmap-B-zWPVnC-u-0Jd8aY.js} +1 -1
- package/dist/cdn/{blinds-Bk5uMM0-.js → blinds-DTbiwlQc.js} +1 -1
- package/dist/cdn/{blobs-DnDOG6gi.js → blobs-CtJwaqgN.js} +1 -1
- package/dist/cdn/{book-Dhbt6TZr.js → book-Ce25Qhm7.js} +1 -1
- package/dist/cdn/{box-CwDaEGbi.js → box-BRuNrJbg.js} +1 -1
- package/dist/cdn/{carousel-Dg0gymV1.js → carousel-Du9hL4Hj.js} +1 -1
- package/dist/cdn/{chart-Dxvb8NTZ.js → chart-BJBhQqS9.js} +1 -1
- package/dist/cdn/{clouds-C07VT0se.js → clouds-DtluDSlt.js} +1 -1
- package/dist/cdn/{coin-BqQf_34O.js → coin-B5K_aStV.js} +1 -1
- package/dist/cdn/{compare-pozbfhux.js → compare-BfUVwqGR.js} +1 -1
- package/dist/cdn/{confetti-BZxAjlUW.js → confetti-W7jfbR94.js} +1 -1
- package/dist/cdn/{counter-DGSouXYQ.js → counter-CSEioZKX.js} +1 -1
- package/dist/cdn/{cover-sL1CQbeu.js → cover-5obZq-u-.js} +1 -1
- package/dist/cdn/{coverflow-DhRMk_eT.js → coverflow-DO-FebEb.js} +1 -1
- package/dist/cdn/{curtain-BBafCfVM.js → curtain-CbAuf4ZU.js} +1 -1
- package/dist/cdn/{deck-C1kqdqrs-BsIoTQP9.js → deck-C1kqdqrs-Cdh9s95v.js} +1 -1
- package/dist/cdn/{device-Ci2uv5OD.js → device-DOPGKWbR.js} +1 -1
- package/dist/cdn/dist-7b15V3X3.js +1 -0
- package/dist/cdn/{dist-B9m2D8i7.js → dist-BMV8xl5-.js} +1 -1
- package/dist/cdn/{dist-Db6RjFbk.js → dist-BeaOPyWn.js} +1 -1
- package/dist/cdn/{dist-DGV8ItID.js → dist-BzvtjGBm.js} +1 -1
- package/dist/cdn/dist-CQQi9P-c.js +1 -0
- package/dist/cdn/{dist-C-JNG8i5.js → dist-CvtbpzPe.js} +1 -1
- package/dist/cdn/{dist-BHTLK8y2.js → dist-DFFVgRA4.js} +1 -1
- package/dist/cdn/{dist-CJVnx9gh.js → dist-DX6TxChi.js} +1 -1
- package/dist/cdn/{dist-BWPAV84C.js → dist-DjdCf6RM.js} +1 -1
- package/dist/cdn/dist-DkCpGHmT.js +1 -0
- package/dist/cdn/{dist-Cs-A3G6z.js → dist-lpY6kHhX.js} +1 -1
- package/dist/cdn/{dist-77NXfk7b.js → dist-oIIwBspx.js} +1 -1
- package/dist/cdn/{dots-BXJrsWh3.js → dots-D8yyE7C5.js} +1 -1
- package/dist/cdn/{drops-BbylXN5V.js → drops-SReNSu4T.js} +1 -1
- package/dist/cdn/{dust-CDy7dxoO.js → dust-Ba53-2Od.js} +1 -1
- package/dist/cdn/{emboss-DUkxsex9.js → emboss-B3zm-CQg.js} +1 -1
- package/dist/cdn/{emoji-Cg4_FuSD.js → emoji-CUFvppuC.js} +1 -1
- package/dist/cdn/{expand-DoRLigJh.js → expand-Ct4bDkE7.js} +1 -1
- package/dist/cdn/{explode-NNAZA3NK.js → explode-DmvDuRJM.js} +1 -1
- package/dist/cdn/{extrude-DDJqV0UO.js → extrude-BMoYqE6D.js} +1 -1
- package/dist/cdn/{fire-BI-HVaXp.js → fire-BmydGRu2.js} +1 -1
- package/dist/cdn/{flare-Dwz5riNj.js → flare-BmSONTgn.js} +1 -1
- package/dist/cdn/{flipbook-C2rIYAlo.js → flipbook-CH_3YZxX.js} +1 -1
- package/dist/cdn/{focus-B2oqkeBA-BNKrapyF.js → focus-B2oqkeBA-DWlH1Yp4.js} +1 -1
- package/dist/cdn/{frost-DKbp2nYJ.js → frost-Bm6r2w_2.js} +1 -1
- package/dist/cdn/{gallery-DNQAdpvv.js → gallery-BToSExwQ.js} +1 -1
- package/dist/cdn/{glitch-vPvcgP6n.js → glitch-Bed4mvJx.js} +1 -1
- package/dist/cdn/{globe-DxTfOR8x.js → globe-CQ2eHYhM.js} +1 -1
- package/dist/cdn/{glow-abQAu0AK.js → glow-C7zdbiI9.js} +1 -1
- package/dist/cdn/{gradient-qjcOv8xD.js → gradient-D3DqQqOq.js} +1 -1
- package/dist/cdn/{graph-BBREVOP2.js → graph-D3H2eUVr.js} +1 -1
- package/dist/cdn/{grid-BUHYCDMP.js → grid-CCgUhAtC.js} +1 -1
- package/dist/cdn/{heatmap-O_-9ZlUJ.js → heatmap-CIbRSzEq.js} +1 -1
- package/dist/cdn/{hologram-B4Csmbj2.js → hologram-B5Y_wKDp.js} +1 -1
- package/dist/cdn/{horizontal-BlMB365o.js → horizontal-B_WSeATL.js} +1 -1
- package/dist/cdn/{hover-preview-Bw5ITAeO.js → hover-preview-_UiH86w9.js} +1 -1
- package/dist/cdn/image-DrrHgBDZ.js +1 -0
- package/dist/cdn/{inflate-4s9DrJ-1.js → inflate-D0hUrvfE.js} +1 -1
- package/dist/cdn/{ink-BuIqWW1a-DqBXQK08.js → ink-BuIqWW1a-LH0T-7Ym.js} +1 -1
- package/dist/cdn/{inspect-CMJ44mep-V5hvLIlY.js → inspect-CMJ44mep-CH0YStPl.js} +1 -1
- package/dist/cdn/instances-DqmbgxOT-DvtH0UQa.js +1 -0
- package/dist/cdn/{keycaps-CTEki83p.js → keycaps-BUe3ZHtn.js} +1 -1
- package/dist/cdn/{kit-BM0qCXzI.js → kit-B5sROK9w.js} +1 -1
- package/dist/cdn/{label-Bzitsbhe.js → label-x3oJGzxx.js} +1 -1
- package/dist/cdn/{lens-C6mk3jjq.js → lens-D2SHCO1D.js} +1 -1
- package/dist/cdn/{lightbox-BnNL-BAD.js → lightbox-BByhvkFX.js} +1 -1
- package/dist/cdn/{liquid-B3unrFqj.js → liquid-DexApgs4.js} +1 -1
- package/dist/cdn/{magnet-DL-1tu4W.js → magnet-CWdE24zq.js} +1 -1
- package/dist/cdn/{map-pw1qOPsC.js → map-DpSGvJy-.js} +1 -1
- package/dist/cdn/{marquee-e8bzjMjR.js → marquee-BoFUSKyN.js} +1 -1
- package/dist/cdn/{melt-DcWKZz97.js → melt-CsHl_9i4.js} +1 -1
- package/dist/cdn/{model-C8lYklQk.js → model-Zaxb6O_P.js} +1 -1
- package/dist/cdn/{neon-CjJIyEY6.js → neon-DZTPn2d8.js} +1 -1
- package/dist/cdn/{orbit-BIBD9AYi.js → orbit-DprDlH5X.js} +1 -1
- package/dist/cdn/{paint-XpIPgN9_-CZPzy07M.js → paint-XpIPgN9_-DVLxr5Rf.js} +1 -1
- package/dist/cdn/{panorama-CVPmRklf.js → panorama-fjmwKUBz.js} +1 -1
- package/dist/cdn/{parallax-BhNp9Z1E.js → parallax-BS4cjREz.js} +1 -1
- package/dist/cdn/{physics-QayZbZMl.js → physics-B0gmpVWd.js} +1 -1
- package/dist/cdn/{pins-DJCbI3n7.js → pins-toALcmW2.js} +1 -1
- package/dist/cdn/{pixelate-BCXIwH_a.js → pixelate-CdU_1Wix.js} +1 -1
- package/dist/cdn/{points-3Fg6fQYz-CDGHYSao.js → points-3Fg6fQYz-Dp_GTrYY.js} +1 -1
- package/dist/cdn/{polaroids-0cdwGu8x.js → polaroids-DzIsNq6h.js} +1 -1
- package/dist/cdn/{prism-CwqCNr2M.js → prism-DB99ig6Q.js} +1 -1
- package/dist/cdn/{reflection-24bwh_vr.js → reflection-Ch4MkBnW.js} +1 -1
- package/dist/cdn/{reveal-D_wnqM0Z.js → reveal-BoaWK4H7.js} +1 -1
- package/dist/cdn/{ribbon-BrA4STmy.js → ribbon-DMJb7Ubo.js} +1 -1
- package/dist/cdn/runtime-DRryYdMT.js +1 -0
- package/dist/cdn/{scramble-8VHS7KD3.js → scramble-PJ4TsmNP.js} +1 -1
- package/dist/cdn/{scrub-CBSYhc0m.js → scrub-Br_seUEa.js} +1 -1
- package/dist/cdn/{sequence-CzA8DT9s.js → sequence-BKFTjdum.js} +1 -1
- package/dist/cdn/{shatter-C-4anYeT.js → shatter-B0PpiG19.js} +1 -1
- package/dist/cdn/{shimmer-4KAhpqkx.js → shimmer-BqiIpO8g.js} +1 -1
- package/dist/cdn/{shine-PA3aTZe5.js → shine-BTuQduW0.js} +1 -1
- package/dist/cdn/{smoke-6VXb_muy.js → smoke-BdTuN_-F.js} +1 -1
- package/dist/cdn/{snow-Qirj8pYg.js → snow-BXvR3N6h.js} +1 -1
- package/dist/cdn/{sparkles-DI85yvM3.js → sparkles-CMx-Vm41.js} +1 -1
- package/dist/cdn/{spin-CZ1cPYxi.js → spin-TtDxqifD.js} +1 -1
- package/dist/cdn/{split-flap-CWh71CY1.js → split-flap-CWCOtV__.js} +1 -1
- package/dist/cdn/{spotlight-_4BVSvdY.js → spotlight-CxHjttPn.js} +1 -1
- package/dist/cdn/{stack-DkcLqYg1.js → stack-CRmnKC3h.js} +1 -1
- package/dist/cdn/{stars-ugpczSZW.js → stars-p9oqxjUv.js} +1 -1
- package/dist/cdn/{studio-BuaMR-l8-C4L6wD0d.js → studio-BuaMR-l8-xmE25_P-.js} +1 -1
- package/dist/cdn/{text-glitch-De0pWcUb.js → text-glitch-33ElrOXQ.js} +1 -1
- package/dist/cdn/{text-reveal-DoxYa9Lk.js → text-reveal-BpAgAVSr.js} +1 -1
- package/dist/cdn/{tilt-CxO_nVkJ.js → tilt-f5MU5kjL.js} +1 -1
- package/dist/cdn/{tone-DxOcjwm6.js → tone-BbRDyAyH.js} +1 -1
- package/dist/{esm/track-BeG2aIt_-CvOvbBt_.js → cdn/track-BeG2aIt_-D6vBB6gj.js} +1 -1
- package/dist/cdn/{tunnel-D_G4C2_z.js → tunnel-B8vCM_7f.js} +1 -1
- package/dist/cdn/{turn-BIjT-ygb-3oM7rKcy.js → turn-BIjT-ygb-BJjv3T5r.js} +1 -1
- package/dist/cdn/{unfold-D52Mm2nR.js → unfold-B3kDqhA7.js} +1 -1
- package/dist/cdn/{video-hover-CgmfEuxU.js → video-hover-B1Xqv_6U.js} +1 -1
- package/dist/cdn/{video-text-DZWRlKym.js → video-text-ClDbMvvD.js} +1 -1
- package/dist/cdn/{vinyl-CMwJkNCW.js → vinyl-DN3u2keG.js} +1 -1
- package/dist/cdn/{visualizer-DhneEzbf.js → visualizer-ByIbDQP9.js} +1 -1
- package/dist/cdn/{voxel-BCO-K4Ce.js → voxel-BGEgV3Fl.js} +1 -1
- package/dist/cdn/{water-Cv-2ML7B.js → water-eWtyzNOa.js} +1 -1
- package/dist/cdn/{wave-1kEzoGsE.js → wave-BVs3mtr4.js} +1 -1
- package/dist/cdn/{waves-dGbSw2jh.js → waves-DS01PfgC.js} +1 -1
- package/dist/cdn/{zoom-D8PBTLlq.js → zoom-BQVIAvF6.js} +1 -1
- package/dist/cdn/{zoom-scroll-gGlkUz0o.js → zoom-scroll-DypyL1NE.js} +1 -1
- package/dist/esm/{ambient-Qk1w8lYJ.js → ambient-Cdp45mcb.js} +1 -1
- package/dist/esm/{assemble-Ba1M1MVg.js → assemble-Cfoe1gvx.js} +1 -1
- package/dist/esm/{beam-ClQUAkE7.js → beam-B_LDOqXC.js} +1 -1
- package/dist/esm/{beat-CEiKdQdZ.js → beat-BBrKft7_.js} +1 -1
- package/dist/esm/{bitmap-B-zWPVnC-CaZ1gd-a.js → bitmap-B-zWPVnC-Dw5c6dU_.js} +1 -1
- package/dist/esm/{blinds-Dl5mOTKr.js → blinds-C8EzA7Fo.js} +1 -1
- package/dist/esm/{blobs-B44mlwR6.js → blobs-DnqdqyVF.js} +1 -1
- package/dist/esm/{book-D1wt_E6_.js → book-Dmje1Q11.js} +1 -1
- package/dist/esm/{box-DM44GR2O.js → box-BRKfJU1u.js} +1 -1
- package/dist/esm/{carousel-dmxUZFZv.js → carousel-DKX_0Ck4.js} +1 -1
- package/dist/esm/{chart-Dh3Kacbi.js → chart-BA6rHoJH.js} +1 -1
- package/dist/esm/{clouds-Ct4hGDwZ.js → clouds-Dz2UCaSS.js} +1 -1
- package/dist/esm/{coin-DBJfFokf.js → coin-DYSGv31E.js} +1 -1
- package/dist/esm/{compare-B0hlKFqt.js → compare-CoZmY9ad.js} +1 -1
- package/dist/esm/{confetti-Cd1gRKJc.js → confetti-DZCMbuTg.js} +1 -1
- package/dist/esm/{counter-DVu70mYg.js → counter-D-zoMmRl.js} +1 -1
- package/dist/esm/{cover-B6byVpLO.js → cover-D7LZA48a.js} +1 -1
- package/dist/esm/{coverflow-B4ML7z8_.js → coverflow-BBpN2X8R.js} +1 -1
- package/dist/esm/{curtain-D7hBZ9Pm.js → curtain-C4v6A2DZ.js} +1 -1
- package/dist/esm/{deck-C1kqdqrs-Dt7ZbAPu.js → deck-C1kqdqrs-9fGcRmUv.js} +1 -1
- package/dist/esm/{device-CrXFH8xV.js → device-D7K0JgZp.js} +1 -1
- package/dist/esm/dist-BC2BEMZt.js +1 -0
- package/dist/esm/{dist-C-YePnn3.js → dist-BxTri4p8.js} +1 -1
- package/dist/esm/dist-BzHg0BTN.js +1 -0
- package/dist/esm/{dist-DHF_Ykj5.js → dist-C8-H8Ydv.js} +1 -1
- package/dist/esm/{dist-_6VGLQBA.js → dist-C8ZH4c0R.js} +1 -1
- package/dist/esm/dist-CQQi9P-c.js +1 -0
- package/dist/esm/{dist-CJd5Mdwb.js → dist-CvE4MVle.js} +1 -1
- package/dist/esm/{dist-rurRPzMV.js → dist-D4qgVKLZ.js} +1 -1
- package/dist/esm/{dist-CJVnx9gh.js → dist-DX6TxChi.js} +1 -1
- package/dist/esm/{dist-CHbggwLI.js → dist-DiiSTwcx.js} +1 -1
- package/dist/esm/{dist-Cdr7dxto.js → dist-XTXHnsNv.js} +1 -1
- package/dist/esm/{dist-BwDPR4Cj.js → dist-dVSMGzky.js} +1 -1
- package/dist/esm/{dots-DKjGzDRp.js → dots-g96d3JFh.js} +1 -1
- package/dist/esm/{drops-D7a7wtcS.js → drops-BkwM693o.js} +1 -1
- package/dist/esm/{dust-C-bzAqLV.js → dust-Tes1owoS.js} +1 -1
- package/dist/esm/{emboss-CWH1brl0.js → emboss-bRL0GIl1.js} +1 -1
- package/dist/esm/{emoji-DKgJAgmo.js → emoji-BFxwyyMp.js} +1 -1
- package/dist/esm/{expand-Cga16EVG.js → expand-_AdA72hX.js} +1 -1
- package/dist/esm/{explode-BqfxknJx.js → explode-DaBP5A_l.js} +1 -1
- package/dist/esm/{extrude-cKg8PSTW.js → extrude-BQ4Po06y.js} +1 -1
- package/dist/esm/{fire-zGK0eb7_.js → fire-DnYo6Fcp.js} +1 -1
- package/dist/esm/{flare-Dxk9k98E.js → flare-W-sFp2YW.js} +1 -1
- package/dist/esm/{flipbook-Bhdttqn4.js → flipbook-BDAUFEay.js} +1 -1
- package/dist/esm/{focus-B2oqkeBA-OpTt_TCP.js → focus-B2oqkeBA-BAeaC3SB.js} +1 -1
- package/dist/esm/{frost-Bg2bkU3J.js → frost-W_lJJSu8.js} +1 -1
- package/dist/esm/{gallery-CxKmSfaa.js → gallery-BPBvhrwM.js} +1 -1
- package/dist/esm/{glitch-e663rfbc.js → glitch-C0xIbw2H.js} +1 -1
- package/dist/esm/{globe-FyaOvpiz.js → globe-hGhuLOSR.js} +1 -1
- package/dist/esm/{glow-Dc2bf-cF.js → glow-kJ_lXSXR.js} +1 -1
- package/dist/esm/{gradient-BufiXb8K.js → gradient-DbJT2qkK.js} +1 -1
- package/dist/esm/{graph-DqgRpx2u.js → graph-BzBZEppr.js} +1 -1
- package/dist/esm/{grid-gd48GpTT.js → grid-PWVOZHt-.js} +1 -1
- package/dist/esm/{heatmap-DoVICfdW.js → heatmap-BDwfwXxL.js} +1 -1
- package/dist/esm/{hologram-OMmy8aci.js → hologram-eqg1NhbS.js} +1 -1
- package/dist/esm/{horizontal-tsslgB_5.js → horizontal-D0e4U4dk.js} +1 -1
- package/dist/esm/{hover-preview-By-lZZYF.js → hover-preview-CtrrxyxG.js} +1 -1
- package/dist/esm/image-C8BD6F7U.js +1 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/{inflate-D348p12R.js → inflate-CImx9Sck.js} +1 -1
- package/dist/esm/{ink-BuIqWW1a-CwLkzSja.js → ink-BuIqWW1a-DOMnJX6K.js} +1 -1
- package/dist/esm/{inspect-CMJ44mep-C1Nt7pXw.js → inspect-CMJ44mep-Bl3l1Jr0.js} +1 -1
- package/dist/esm/instances-DqmbgxOT-DvtH0UQa.js +1 -0
- package/dist/esm/{keycaps-BkkkrYAv.js → keycaps-Bk24JPlr.js} +1 -1
- package/dist/esm/{kit-5IzkOXD0.js → kit-DIwHK01X.js} +1 -1
- package/dist/esm/{label-Ba8KZ-8R.js → label-DbI2sN7Z.js} +1 -1
- package/dist/esm/{lens-eWuubBny.js → lens-BowwSOrJ.js} +1 -1
- package/dist/esm/{lightbox-CPMav-kX.js → lightbox-CVK9lgJw.js} +1 -1
- package/dist/esm/{liquid-BlqTaXK9.js → liquid-BLxDbMEa.js} +1 -1
- package/dist/esm/{magnet-4GjWvmON.js → magnet-On56lP34.js} +1 -1
- package/dist/esm/{map-ByjTTYk8.js → map-DYLP1gqu.js} +1 -1
- package/dist/esm/{marquee-Dso6ayor.js → marquee-C816jR-L.js} +1 -1
- package/dist/esm/{melt-DdarmsNG.js → melt-C2Xly1pz.js} +1 -1
- package/dist/esm/{model-SwCA4OEC.js → model-nEAs_rn0.js} +1 -1
- package/dist/esm/{neon-DvKOzW82.js → neon-95PrphVe.js} +1 -1
- package/dist/esm/{orbit-CdHRKHM1.js → orbit-DWRtVcyn.js} +1 -1
- package/dist/esm/{paint-XpIPgN9_-BgvP0P5g.js → paint-XpIPgN9_-CgDq0G_v.js} +1 -1
- package/dist/esm/{panorama-O5Ztwhvy.js → panorama-C9AS8BJp.js} +1 -1
- package/dist/esm/{parallax-BziRgfl7.js → parallax-DqIE_Nlk.js} +1 -1
- package/dist/esm/{physics-soZZBmlp.js → physics-CwPt2zLb.js} +1 -1
- package/dist/esm/{pins-C-r9f95M.js → pins-D5g4pnPT.js} +1 -1
- package/dist/esm/{pixelate-B58MILZ3.js → pixelate-Cay2eriT.js} +1 -1
- package/dist/esm/{points-3Fg6fQYz-YV7m16tF.js → points-3Fg6fQYz-Dp8jGvN3.js} +1 -1
- package/dist/esm/{polaroids-BuPAHO7O.js → polaroids-Cc4VmT6G.js} +1 -1
- package/dist/esm/{prism-DScLVhKQ.js → prism-BtL99l7t.js} +1 -1
- package/dist/esm/{reflection-kujvoe7O.js → reflection-BQ1Sm8o2.js} +1 -1
- package/dist/esm/{reveal-CrpZIvcO.js → reveal-Bw7G-jLH.js} +1 -1
- package/dist/esm/{ribbon-wM-wUNtq.js → ribbon-BcZjjvuQ.js} +1 -1
- package/dist/esm/runtime-DO6qioXd.js +1 -0
- package/dist/esm/{scramble-BPnsD4vT.js → scramble-DAte1H39.js} +1 -1
- package/dist/esm/{scrub-CUe7bpvT.js → scrub-DX83LFFV.js} +1 -1
- package/dist/esm/{sequence-HqzSr0PQ.js → sequence-DdNQe7PM.js} +1 -1
- package/dist/esm/{shatter-B3jwfOHN.js → shatter-Dm-k3NCA.js} +1 -1
- package/dist/esm/{shimmer-DfMZglK5.js → shimmer-BA6fH-ee.js} +1 -1
- package/dist/esm/{shine-Ay1WACR4.js → shine-BUGxnUAK.js} +1 -1
- package/dist/esm/{smoke-Bv1_ncmq.js → smoke-DjoGr7fo.js} +1 -1
- package/dist/esm/{snow-GSqJdbHR.js → snow-JCiQsGHf.js} +1 -1
- package/dist/esm/{sparkles-D0VFzp-O.js → sparkles-C8MjHp2r.js} +1 -1
- package/dist/esm/{spin-3CaE6ZeJ.js → spin-DJ-YoiST.js} +1 -1
- package/dist/esm/{split-flap-xf6Wu6fi.js → split-flap-dRmSO-lh.js} +1 -1
- package/dist/esm/{spotlight-DOME4rCd.js → spotlight-DVA7Azih.js} +1 -1
- package/dist/esm/{stack-AvQ0QZ_c.js → stack-Bqzc2OQQ.js} +1 -1
- package/dist/esm/{stars-C2dU7VFw.js → stars-CWTNzDKU.js} +1 -1
- package/dist/esm/{studio-BuaMR-l8-tyeaa2Lj.js → studio-BuaMR-l8-DaL_nHEk.js} +1 -1
- package/dist/esm/{text-glitch-BkqEi4gB.js → text-glitch-D2sNzZ6I.js} +1 -1
- package/dist/esm/{text-reveal-D7UoRND6.js → text-reveal-AThQMONY.js} +1 -1
- package/dist/esm/{tilt-CGLwUbyT.js → tilt-CgKbQn8v.js} +1 -1
- package/dist/esm/{tone-CL6JiA7_.js → tone-DHD2i4LU.js} +1 -1
- package/dist/{cdn/track-BeG2aIt_-BLqvFioo.js → esm/track-BeG2aIt_-mu8DgKlm.js} +1 -1
- package/dist/esm/{tunnel-Cw3a7LuG.js → tunnel-Djd-6KgJ.js} +1 -1
- package/dist/esm/{turn-BIjT-ygb-NYN-Dbdm.js → turn-BIjT-ygb-Dldj4HIv.js} +1 -1
- package/dist/esm/{unfold-BSjqKe5-.js → unfold-X5OAOaXY.js} +1 -1
- package/dist/esm/{video-hover-3rs01JrX.js → video-hover-CyMqU7sF.js} +1 -1
- package/dist/esm/{video-text-q_2wgJid.js → video-text-BQ7wkZec.js} +1 -1
- package/dist/esm/{vinyl-DXRO3h2r.js → vinyl-C2kuMJqU.js} +1 -1
- package/dist/esm/{visualizer-7VTstbsD.js → visualizer-BLXSUJfy.js} +1 -1
- package/dist/esm/{voxel-Bg-d9LUv.js → voxel-DwWFnTEj.js} +1 -1
- package/dist/esm/{water-BwAStrxc.js → water-DeAwMJwO.js} +1 -1
- package/dist/esm/{wave-C0C_dRYT.js → wave-BlEpZGm9.js} +1 -1
- package/dist/esm/{waves-DUXDa0C1.js → waves-moqzvDQn.js} +1 -1
- package/dist/esm/{zoom-AkyIKgf4.js → zoom-BsqNVzZz.js} +1 -1
- package/dist/esm/{zoom-scroll-DYuRf_mR.js → zoom-scroll-ZXDHlq4h.js} +1 -1
- package/package.json +19 -19
- package/dist/cdn/dist-795LSiOz.js +0 -1
- package/dist/cdn/dist-BbuDFxNj.js +0 -1
- package/dist/cdn/dist-CR87ECQe.js +0 -1
- package/dist/cdn/image-kqGWJmx6.js +0 -1
- package/dist/cdn/instances-c3i719QK-CaL29HhG.js +0 -1
- package/dist/cdn/runtime-DpS-LDcC.js +0 -1
- package/dist/esm/dist-795LSiOz.js +0 -1
- package/dist/esm/dist-BBFulD4b.js +0 -1
- package/dist/esm/dist-CMGUWaxD.js +0 -1
- package/dist/esm/image-Unfr7Whu.js +0 -1
- package/dist/esm/instances-c3i719QK-CaL29HhG.js +0 -1
- package/dist/esm/runtime-fsXy2qz_.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={beam:{load:()=>import(`./beam-
|
|
1
|
+
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={beam:{load:()=>import(`./beam-B_LDOqXC.js`),params:{color:e(`#ffaa40`),color2:e(`#9c40ff`),length:240,speed:200,thickness:2,glow:.8,fps:60}},glow:{load:()=>import(`./glow-kJ_lXSXR.js`),params:{color:e(`#ffffff`),radius:320,border:1,fill:.12,ease:.1},when:`hover`},shine:{load:()=>import(`./shine-BUGxnUAK.js`),params:{angle:120,width:.35,color:e(`#ffffff`),duration:1.1,interval:4,strength:.5},reducedMotion:`off`}};export{t as blocks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,s as t}from"./dist-
|
|
1
|
+
import{r as e,s as t}from"./dist-CQQi9P-c.js";import{Color as n,DataTexture as r,LinearMipmapLinearFilter as i,NoColorSpace as a,NodeMaterial as o,PMREMGenerator as s,PerspectiveCamera as c,QuadMesh as l,SRGBColorSpace as u,Scene as d,Texture as f,WebGPURenderer as p}from"three/webgpu";import{renderOutput as m,screenUV as h,texture as g}from"three/tsl";const _=/* @__PURE__ */ new WeakMap;function v(){let e=typeof navigator>`u`?void 0:navigator.gpu;if(!e)return Promise.resolve(!1);let t=_.get(e);t||(t=Promise.resolve().then(()=>e.requestAdapter({featureLevel:`compatibility`})).then(e=>e!=null,()=>!1),_.set(e,t));let n,r=new Promise(e=>{n=setTimeout(e,1e3,!1)});return Promise.race([t,r]).finally(()=>clearTimeout(n))}const y=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,b=/^(rgba?|hsla?)\(([^)]*)\)$/i,x={deg:1,grad:.9,rad:180/Math.PI,turn:360},S=(e,t,n)=>`#${[e,t,n].map(e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,`0`)).join(``)}`;function C(e,t){if(e===`none`)return 0;let n=Number.parseFloat(e);return/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?%?$/i.test(e)?e.endsWith(`%`)?n/100*t:n:NaN}function w(e){let[,t=``,n=`deg`]=/^([-+]?[\d.]+(?:e[-+]?\d+)?)([a-z]*)$/i.exec(e)??[],r=x[n.toLowerCase()||`deg`];return e===`none`?0:r?Number.parseFloat(t)*r:NaN}function T(e,t){let n=t.trim().split(/\s*[,/]\s*|\s+/);if(n.length<3||n.length>4)return;let[r=``,i=``,a=``]=n,o;if(e.startsWith(`rgb`))o=[C(r,255),C(i,255),C(a,255)];else{let e=(w(r)%360+360)%360/30,t=Math.min(1,Math.max(0,C(i,1)/(i.endsWith(`%`)?1:100))),n=Math.min(1,Math.max(0,C(a,1)/(a.endsWith(`%`)?1:100))),s=t*Math.min(n,1-n),c=t=>{let r=(t+e)%12;return(n-s*Math.max(-1,Math.min(r-3,9-r,1)))*255};o=[c(0),c(8),c(4)]}return o.every(Number.isFinite)?S(o[0],o[1],o[2]):void 0}let E;const D=/* @__PURE__ */ new Map;function O(e){if(D.has(e))return D.get(e);if(E===void 0)try{E=(typeof OffscreenCanvas==`function`?new OffscreenCanvas(1,1):typeof document>`u`?void 0:document.createElement(`canvas`))?.getContext(`2d`,{willReadFrequently:!0})??null}catch{E=null}let t;if(E){E.fillStyle=`#000`,E.fillStyle=e;let n=E.fillStyle;if(E.fillStyle=`#fff`,E.fillStyle=e,n===E.fillStyle){E.globalCompositeOperation=`copy`,E.fillRect(0,0,1,1);let[e=0,n=0,r=0]=Array.from(E.getImageData(0,0,1,1).data);t=S(e,n,r)}}return D.set(e,t),t}function k(e,t,n=0){let r=``,i=0;for(;;){let a=e.toLowerCase().indexOf(`var(`,i);if(a<0)break;let o=a+3;for(let t=0;o<e.length;o++)if(e[o]===`(`)t++;else if(e[o]===`)`&&--t===0)break;if(o>=e.length)break;let s=e.slice(a+4,o),c=s.indexOf(`,`),l=(c<0?s:s.slice(0,c)).trim(),u=c<0?``:s.slice(c+1),d=t.getPropertyValue(l).trim()||u.trim();r+=e.slice(i,a)+(n<8?k(d,t,n+1):``),i=o+1}return(r+e.slice(i)).replace(/\bcurrentcolor\b/gi,()=>t.color)}function A(e,t){let r=e.trim();t&&/var\(|currentcolor/i.test(r)&&(r=k(r,getComputedStyle(t)).trim());let i=y.exec(r)?.[1];if(i)return`#${(i.length<6?[...i].map(e=>e+e).join(``):i).slice(0,6).toLowerCase()}`;let a=b.exec(r);if(a)return T(a[1].toLowerCase(),a[2]);let o=n.NAMES[r.toLowerCase()];return o===void 0?r?O(r):void 0:`#${o.toString(16).padStart(6,`0`)}`}function j(e){let t=e.compileAsync;if(typeof t!=`function`)return;let n=Promise.resolve();e.compileAsync=(...r)=>{let i=n.then(()=>t.apply(e,r));return n=i.catch(()=>{}),i}}function M(e){let t=e._animation,n=t?.getContext?.();if(!n||typeof t?.setContext!=`function`||typeof t.getAnimationLoop!=`function`||typeof t.stop!=`function`)return;let r=t,i;return r.stop(),r.setContext({requestAnimationFrame(e){return r.getAnimationLoop()===null?(i=e,-1):n.requestAnimationFrame(e)},cancelAnimationFrame(e){i=void 0,e!==-1&&n.cancelAnimationFrame(e)}}),{tick(e){let t=i;i=void 0,t?.(e)}}}async function N(e){let t=new r(/* @__PURE__ */ new Uint8Array(4),1,1);t.needsUpdate=!0;let n=new o;n.fragmentNode=m(g(t,h),e.toneMapping,e.outputColorSpace);let i=new l(n);try{await e.compileAsync(i,i.camera)}catch{}try{n.dispose(),t.dispose()}catch{}await P(e)}async function P(e){if(typeof createImageBitmap==`function`&&typeof ImageData==`function`)for(let t of[u,a]){let n,r;try{n=await createImageBitmap(new ImageData(4,4),{imageOrientation:`flipY`}),r=new f(n),r.colorSpace=t,r.flipY=!1,r.minFilter=i,r.needsUpdate=!0,e.initTexture(r)}catch{}finally{r?.dispose(),n?.close()}}}const F=/*#__PURE__*/ e({name:`render`,dependencies:[`stage`],defaults:{antialias:!0,distance:1e3,maxPixels:4e6,forceWebGL:!1,background:null,environment:`none`},async setup(e,n){let{stage:r}=e,i=r.canvas;if(!i)throw Error(`render needs a DOM`);let a=await I(e,n,i),o=new d,{distance:s}=n,l=new c(45,1,1,s*10);l.position.z=s;let u=t(1/0);L(e,n,a,o,l,u);let f=(e,t,n={x:0,y:0})=>(n.x=e-r.width.peek()/2,n.y=r.height.peek()/2-t,n),p={x:0,y:0};return{maxPixelRatio:u,environment:R(e,n,a,o),renderer:a,scene:o,camera:l,backend:`isWebGPUBackend`in a.backend?`webgpu`:`webgl2`,toWorld:f,place(e,t){f(t.x+t.width/2,t.y+t.height/2,p),e.position.set(p.x,p.y,0),e.scale.set(t.width,t.height,1)}}}});async function I(e,t,n){let r=t.background;if(typeof r==`string`){let t=A(r);t||e.log.warn(`render: background "${r}" is not a colour, kept transparent`),r=t??null}let i=t.antialias===`auto`?e.stage.pixelRatio.peek()<2:t.antialias,a=t.forceWebGL||!await v(),o=new p({canvas:n,antialias:i,alpha:r===null,forceWebGL:a});await o.init(),j(o),e.onDispose(o),o.setClearColor(r??0,r===null?0:1),await N(o);let s=M(o);return s?e.system(`input`,e=>s.tick(e.now),{name:`render:three`}):e.log.warn(`render: unknown three.js frame loop, three keeps asking for frames at rest`),o}function L(e,t,n,r,i,a){let{stage:o}=e,{distance:s}=t,c=!0;e.effect(()=>{o.width.value,o.height.value,o.pixelRatio.value,a.value,c=!0,e.invalidate()});let l=()=>{let e=o.width.peek(),r=o.height.peek(),c=Math.sqrt(t.maxPixels/Math.max(1,e*r));n.setPixelRatio(Math.min(o.pixelRatio.peek(),c,a.peek())),n.setSize(e,r,!1),i.aspect=e/(r||1),i.fov=2*Math.atan(r/2/s)*180/Math.PI,i.updateProjectionMatrix()},u=()=>n.render(r,i);e.system(`render`,()=>{c&&(c=!1,l()),e.callHook(`render:frame`,u)()},{name:`render`})}function R(e,t,n,r){let i=0,a,o,c=()=>{r.environment===o?.texture&&(r.environment=null),o?.dispose(),o=void 0,a=void 0};return e.onDispose(()=>{i=0,c()}),()=>{if(t.environment!==`room`)return{ready:Promise.resolve(),off:()=>{}};i++,a??=import(`three/addons/environments/RoomEnvironment.js`).then(({RoomEnvironment:t})=>{if(!i||a!==l)return;let c=new t,u=new s(n);o=u.fromScene(c,.04),u.dispose(),c.dispose(),r.environment=o.texture,e.invalidate()});let l=a,u=!1;return{ready:l,off:()=>{u||(u=!0,--i===0&&c())}}}}export{F as n,A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./dev-CoKR705i.js";const t={config:`CONFIG_INVALID`,setup:`PLUGIN_SETUP`,listener:`LISTENER`,hook:`HOOK`,system:`SYSTEM`,effect:`EFFECT`,dispose:`DISPOSE`,loop:`LOOP`,report:`REPORTED`};var n=class extends Error{code;plugin;problems;constructor(t,n,r={}){let i=r.plugin?`[diorama:${r.plugin}]`:`[diorama]`;super(e(`${i} ${t}: ${n}`,t),r.cause===void 0?void 0:{cause:r.cause}),this.name=`DioramaError`,this.code=t,this.plugin=r.plugin,this.problems=r.problems??[]}};function r(e,t){if(typeof e!=`object`||!e)return!1;let n=e;return n.name===`DioramaError`&&typeof n.code==`string`&&(!t||n.code===t)}function i(e){return e instanceof Error?e.message:String(e)}function a(e,a,o){return r(e)?e:new n(t[a],i(e),{plugin:o,cause:e})}const o=e=>e===void 0?[]:typeof e==`string`?[e]:e;function s(e,t,n){let r=Array(e).fill(0);for(let e of t)for(let t of e)r[t]=(r[t]??0)+1;let i=Array(e).fill(!1),a=[];for(;;){let o=-1;for(let t=0;t<e;t++)!i[t]&&r[t]===0&&(o<0||n(t,o))&&(o=t);if(o<0)break;i[o]=!0,a.push(o);for(let e of t[o]??[])r[e]=(r[e]??0)-1}return a.length===e?a:{stuck:[...i.keys()].filter(e=>!i[e])}}function c(e,t){let n=new Set(t),r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=[],o=t=>{r.add(t),a.push(t);for(let s of e[t]??[]){if(!n.has(s)||i.has(s))continue;if(r.has(s))return[...a.slice(a.indexOf(s)),s];let e=o(s);if(e)return e}a.pop(),r.delete(t),i.add(t)};for(let e of t){let t=i.has(e)?void 0:o(e);if(t)return t}return[...t]}function l(e){let t=e.map(()=>[]);e.forEach((n,r)=>{e.forEach((e,i)=>{r!==i&&(n.before.some(t=>e.labels.includes(t))&&t[r]?.push(i),n.after.some(t=>e.labels.includes(t))&&t[i]?.push(r))})});let n=s(e.length,t,(t,n)=>{let r=e[t],i=e[n];return r.rank===i.rank?r.seq<i.seq:r.rank<i.rank});return Array.isArray(n)?n.map(t=>e[t]):{cycle:c(t,n.stuck).map(t=>e[t])}}const u={debug:0,info:1,warn:2,error:3,silent:4},d=()=>{},f=Promise.resolve();function p(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&typeof e.then==`function`}function m(e,t){let n={...e};if(!t)return n;for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function h(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;return n.every(e=>Object.is(r[e],i[e]))}function g(){return typeof performance>`u`?Date.now():performance.now()}function _(e,t,n){let r=u[t],i=t=>(...i)=>{u[t]<r||(n?e[t](n,...i):e[t](...i))};return{debug:i(`debug`),info:i(`info`),warn:i(`warn`),error:i(`error`)}}const v=Symbol.for(`diorama.plugin`),y=Symbol.for(`diorama.preset`),b=e=>{if(typeof e==`string`)return e;let t=e?.name;return typeof t==`string`?t:void 0},x=e=>typeof e==`function`?e[v]:void 0,ee=e=>typeof e==`object`&&!!e&&y in e;function te(e){let t=[];typeof e.name==`string`&&/^[a-z][A-Za-z0-9]*$/.test(e.name)||t.push(`name "${String(e.name)}" must be a lowerCamelCase identifier`),typeof e.setup!=`function`&&t.push(`setup must be a function`);let n=[e.dependencies??[],e.optionalDependencies??[]];return n.every(Array.isArray)?n.flat().some(e=>b(e)===void 0)&&t.push(`dependencies must be names or plugins`):t.push(`dependencies must be arrays`),e.core!==void 0&&typeof e.core!=`string`&&t.push(`core must be a semver range`),e.defaults!==void 0&&(typeof e.defaults!=`object`||e.defaults===null)&&t.push(`defaults must be an object`),e.schema!==void 0&&typeof e.schema?.[`~standard`]?.validate!=`function`&&t.push(`schema must implement Standard Schema`),t}function ne(e,t){let n=n=>ne(e,m(t,n)),r=e=>Object.freeze(Array.isArray(e)?e.map(e=>b(e)??``):[]);return Object.defineProperties(n,{name:{value:e.name},version:{value:e.version,enumerable:!0},options:{value:Object.freeze({...t}),enumerable:!0},defaults:{value:Object.freeze({...e.defaults}),enumerable:!0},schema:{value:e.schema,enumerable:!0},dependencies:{value:r(e.dependencies),enumerable:!0},optionalDependencies:{value:r(e.optionalDependencies),enumerable:!0},[v]:{value:e}}),Object.freeze(n)}function S(e){return ne(e,{})}function re(e){return Object.freeze({name:e.name,plugins:C(e.plugins),presets:C(e.presets),[y]:!0})}const C=e=>Array.isArray(e)?Object.freeze([...e]):e??[],ie=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/,w=`(\\*|x|X|\\d+)`,ae=RegExp(`^(\\^|~|>=|<=|>|<|=)?v?${w}(?:\\.${w})?(?:\\.${w})?(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$`);function oe(e,t){let n=ce(e);return n?t.split(`||`).some(e=>se(n,e)):!1}function se(e,t){let n=t.trim().replace(/(\^|~|>=|<=|>|<|=)\s+/g,`$1`).split(/\s+/).filter(Boolean),r=[];for(let e of n){let t=le(e);if(!t)return!1;r.push(...t)}if(!r.every(t=>de(e,t)))return!1;if(!e.pre.length)return!0;let i=E(...e.triple);return r.some(e=>e.version.pre.length>0&&fe(E(...e.version.triple),i)===0)}function ce(e){let t=ie.exec(e.trim());if(t)return{triple:[Number(t[1]),Number(t[2]),Number(t[3])],pre:t[4]?t[4].split(`.`):[]}}function le(e){let t=ae.exec(e);if(!t)return;let n=t[1]??``,[r,i,a]=[t[2],t[3],t[4]],o=t[5]?t[5].split(`.`):[];if(D(r))return n===``||n===`=`||n===`>=`||n===`<=`?[]:void 0;let s=Number(r),c=D(i)?void 0:Number(i),l=D(a)?void 0:Number(a);if(n===`^`){let e=E(s,c??0,l??0,o);return T(e,ue(s,c,l))}let u=c===void 0||l===void 0;if(n===`~`||(n===``||n===`=`)&&u){let e=E(s,c??0,l??0,o),t=c===void 0?E(s+1,0,0):E(s,c+1,0);return T(e,t)}if(u){let e=c===void 0?E(s+1,0,0):E(s,c+1,0),t=E(s,c??0,0);return n===`>`?[{op:`>=`,version:e}]:n===`<=`?[{op:`<`,version:e}]:[{op:n,version:t}]}return[{op:n===``?`=`:n,version:E(s,c,l,o)}]}function ue(e,t,n){return e>0||t===void 0?E(e+1,0,0):t>0||n===void 0?E(0,t+1,0):E(0,0,n+1)}const T=(e,t)=>[{op:`>=`,version:e},{op:`<`,version:t}];function de(e,t){let n=fe(e,t.version);switch(t.op){case`<`:return n<0;case`<=`:return n<=0;case`>`:return n>0;case`>=`:return n>=0;default:return n===0}}function fe(e,t){for(let n=0;n<3;n++){let r=(e.triple[n]??0)-(t.triple[n]??0);if(r!==0)return r}if(!e.pre.length||!t.pre.length)return t.pre.length-e.pre.length;for(let n=0;n<Math.max(e.pre.length,t.pre.length);n++){let r=e.pre[n],i=t.pre[n];if(r===void 0)return-1;if(i===void 0)return 1;let a=pe(r,i);if(a!==0)return a}return 0}function pe(e,t){let n=/^\d+$/.test(e),r=/^\d+$/.test(t);return n&&r?Number(e)-Number(t):n?-1:r?1:e<t?-1:+(e>t)}const E=(e,t,n,r=[])=>({triple:[e,t,n],pre:r}),D=e=>e===void 0||e===`*`||e===`x`||e===`X`,me=[`then`,`toJSON`,`spawn`,`query`,`tick`];function he(e,t){let r=[],i=(e,i)=>{if(!e)return;let a=x(e);a?r.push({plugin:e,def:a,layer:i,index:r.length}):t.push(new n(`PLUGIN_INVALID`,`not a plugin: ${String(e)}`))},a=(e,r)=>{if(e&&!r.has(e)){if(!ee(e))t.push(new n(`PLUGIN_INVALID`,`not a preset: ${String(e)}`));else if(r.add(e),!Array.isArray(e.presets)||!Array.isArray(e.plugins))t.push(new n(`PLUGIN_INVALID`,`preset "${e.name}" needs arrays`));else{for(let t of e.presets)a(t,r);for(let t of e.plugins)i(t,1)}}},o=r=>{let i=e.options[r];return i===void 0||Array.isArray(i)?i??[]:(t.push(new n(`CONFIG_INVALID`,`${r} must be an array`)),[])};if(e.options.defaults!==!1)for(let t of e.defaults)i(t,0);for(let e of o(`presets`))a(e,/* @__PURE__ */ new Set);for(let e of o(`plugins`))i(e,2);return r.filter(t=>t.layer===2||!e.disabled.has(String(t.def.name)))}function ge(e,t){return e.disabled.has(t)?` (removed via disable)`:e.options.defaults===!1&&e.defaults.some(e=>e.name===t)?` (defaults are off)`:``}async function _e(e,t,r){let i=/* @__PURE__ */ new Map;for(let e of t){let t=String(e.def.name);i.set(t,[...i.get(t)??[],e])}let a=[],o=/* @__PURE__ */ new Map;for(let[e,t]of i){let r=Math.max(...t.map(e=>e.layer)),i=t.find(e=>e.layer===r),s=Ce(i.def,be(t,i));a.push(s),t.some(e=>e.layer===r&&e.def!==i.def)&&o.set(s,new n(`PLUGIN_DUPLICATE`,`two different plugins named "${e}"`,{plugin:e}))}for(let t of a){let n=o.get(t)??await xe(t,e.reserved);n&&o.set(t,n)}let s=new Set(a.map(e=>e.name));for(let t of a){let i=t.deps.find(e=>!s.has(e)&&!r?.(e));i===void 0||o.has(t)||o.set(t,new n(`PLUGIN_MISSING_DEPENDENCY`,`requires "${i}"${ge(e,i)}`,{plugin:t.name}))}return{list:a,failures:o}}function ve(e){let t=t=>e[t],n=new Map(e.map((e,t)=>[e.name,t])),r=e.map(()=>[]),i=[];e.forEach((e,t)=>{for(let i of e.deps){let e=n.get(i);e!==void 0&&r[e]?.push(t)}e.optional.forEach((e,r)=>{let a=n.get(e);a!==void 0&&i.push({from:a,to:t,position:r})})});let a=s(e.length,r,O);if(!Array.isArray(a))return{cycle:c(r,a.stuck).map(t)};for(;;){let n=r.map(e=>[...e]);for(let e of i)n[e.from]?.push(e.to);let a=s(e.length,n,O);if(Array.isArray(a))return a.map(t);let o=we(i,n,new Set(a.stuck));if(!o)return{cycle:a.stuck.map(t)};i.splice(i.indexOf(o),1)}}const ye=e=>new n(`PLUGIN_CYCLE`,`required dependencies form a cycle: ${e.map(e=>e.name).join(` → `)}`);function be(e,t){let n=e.filter(e=>e.def===t.def).sort((e,t)=>e.layer-t.layer||e.index-t.index),r={...t.def.defaults};for(let e of n)r=m(r,e.plugin.options);return r}async function xe(e,t){let r=e.name,a=te(e.def);if(!a.length&&t(e.name)&&a.push(`name "${e.name}" is reserved by the App API`),a.length)return new n(`PLUGIN_INVALID`,a.join(`; `),{plugin:r});let{core:o,schema:s}=e.def;if(o!==void 0&&!oe(`0.1.2`,o))return new n(`PLUGIN_INCOMPATIBLE`,`requires core ${o}, running 0.1.2`,{plugin:r});let c=e.raw;if(s)try{let t=await s[`~standard`].validate(e.raw);if(t.issues)return new n(`PLUGIN_OPTIONS`,Se(t.issues),{plugin:r});c=t.value}catch(e){return new n(`PLUGIN_OPTIONS`,i(e),{plugin:r,cause:e})}e.options=Object.freeze({...c})}function Se(e){return e.map(e=>{let t=e.path?.map(e=>String(typeof e==`object`?e.key:e)).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `)}function Ce(e,t){let n=e=>Array.isArray(e)?e.map(e=>b(e)??``):[];return{name:String(e.name),def:e,deps:n(e.dependencies),optional:n(e.optionalDependencies),critical:e.critical===!0,raw:t,options:t,status:`pending`,ordinal:-1,service:void 0,hasService:!1,scope:void 0,error:void 0,release:void 0}}const O=(e,t)=>e<t;function we(e,t,n){let r=(e,r)=>{let i=/* @__PURE__ */ new Set,a=e=>e===r||!i.has(e)&&(i.add(e),(t[e]??[]).some(e=>n.has(e)&&a(e)));return a(e)},i;for(let t of e)n.has(t.from)&&n.has(t.to)&&(i&&(t.to<i.to||t.to===i.to&&t.position<=i.position)||r(t.to,t.from)&&(i=t));return i}var Te=class{#e=/* @__PURE__ */ new Map;#t;#n;constructor(e,t){this.#t=e,this.#n=t}on(e,t,n,r){if(!n.open())return d;let i={fn:t,owner:n,once:r,active:!0,off:d};return this.#e.set(e,[...this.#e.get(e)??[],i]),i.off=n.add(()=>{if(!i.active)return;i.active=!1;let t=(this.#e.get(e)??[]).filter(e=>e!==i);t.length?this.#e.set(e,t):this.#e.delete(e)}),i.off}emit(e,t){let r=this.#e.get(e);if(r){if(this.#n.value>=64)this.#t(new n(`RECURSION`,`"${e}" nested too deep`),`listener`,void 0,e);else{this.#n.value++;try{for(let n of r)if(n.active&&!n.owner.disposed){n.once&&n.off();try{let r=n.fn(t);p(r)&&r.then(void 0,t=>this.#t(t,`listener`,n.owner,e))}catch(t){this.#t(t,`listener`,n.owner,e)}}}finally{this.#n.value--}}}}};Object.freeze({"~cancel":!0,reason:void 0});function k(e){return typeof e==`object`&&!!e&&e[`~cancel`]===!0}function Ee(e,t){let n=t??e.label;return e.plugin&&e.plugin!==n?[n,e.plugin]:[n]}var De=class{#e=/* @__PURE__ */ new Map;#t=/* @__PURE__ */ new Map;#n=0;#r;#i;constructor(e,t){this.#r=e,this.#i=t}add(e,t,r,i){if(!r.open())return d;let a={fn:t,owner:r,active:!0,labels:Ee(r,i?.name),before:o(i?.before),after:o(i?.after),rank:r.rank,seq:this.#n++},s=l([...this.#e.get(e)??[],a]);if(!Array.isArray(s))throw new n(`ORDER_CYCLE`,`hook "${e}": ${s.cycle.map(e=>e.labels[0]).join(` → `)}`,{plugin:r.plugin});return this.#a(e,s),r.add(()=>{if(!a.active)return;a.active=!1;let t=(this.#e.get(e)??[]).filter(e=>e!==a);this.#a(e,t)})}call(e,t,r){let i=this.#e.get(e);if(!i)return t;if(this.#i.value>=64)return this.#r(new n(`RECURSION`,`hook "${e}" nested too deep`),`hook`,void 0,e),t;this.#i.value++;try{for(let n of i){if(!n.active||n.owner.disposed)continue;let i;try{i=n.fn(t,r)}catch(t){this.#r(t,`hook`,n.owner,e);continue}if(i!==void 0){if(p(i)){i.then(void 0,d);let t=/* @__PURE__ */ Error(`async handler in sync hook "${e}"`);this.#r(t,`hook`,n.owner,e)}else if(k(i))return i;else t=i}}return t}finally{this.#i.value--}}async callAsync(e,t,n){for(let r of this.#e.get(e)??[]){if(!r.active||r.owner.disposed)continue;let i;try{i=await r.fn(t,n)}catch(t){this.#r(t,`hook`,r.owner,e);continue}if(!(i===void 0||r.owner.disposed)){if(k(i))return i;t=i}}return t}version(e){return this.#t.get(e)??0}#a(e,t){t.length?this.#e.set(e,t):this.#e.delete(e),this.#t.set(e,this.version(e)+1)}};function Oe(e,t){let n=/* @__PURE__ */ new Set,r=()=>{for(let e of n)if(e.requested)return!0;return!1};return{all:n,attach:i=>{let a={tick:i,requested:!1,request(){n.has(a)&&(a.requested=!0,e())},cancel(){a.requested=!1,r()||t()},detach(){n.delete(a),a.cancel()}};return n.add(a),a},anyRequested:r,tickRequested:e=>{let t=!1;for(let r of n)r.requested&&(r.requested=!1,r.tick(e)&&(t=!0));return t}}}function ke(){let e,t=t=>{e=void 0,n.tickRequested(t)},n=Oe(()=>{e===void 0&&typeof requestAnimationFrame==`function`&&(e=requestAnimationFrame(t))},()=>{e!==void 0&&typeof cancelAnimationFrame==`function`&&(cancelAnimationFrame(e),e=void 0)});return{name:`raf`,now:g,attach:n.attach}}function Ae(e,t={}){let n=t.now??g,r,i=()=>{r?.(),r=void 0},a=e=>{s.tickRequested(e??n()),s.anyRequested()||i()},o=!1,s=Oe(()=>{if(!(r||o)){o=!0;try{r=e(a)}finally{o=!1}s.anyRequested()||i()}},i);return{name:t.name??`ticker`,now:n,attach:s.attach}}const je=[`input`,`layout`,`update`,`render`,`afterRender`],Me=1/60;var Ne=class{time;stats;#e={delta:0,rawDelta:0,elapsed:0,now:0,frame:0,resumed:!0};#t={frames:0,wakes:0,reason:`none`,invalidatedBy:``,interval:Me};#n;#r;#i=[];#a=je.map(e=>({name:e,afterOf:void 0,systems:[]}));#o=[];#s=/* @__PURE__ */ new Set;#c=/* @__PURE__ */ new Set;#l=/* @__PURE__ */ new Set;#u=[];#d=[];#f=[];#p=!0;#m;#h=!1;#g=!1;#_=!1;#v=!1;#y=!1;#b=!0;#x=0;#S;#C=Me;#w=0;#T;constructor(e,t,n){this.#T=t,this.time=this.#e,this.stats=this.#t,this.#n={mode:`demand`,maxDelta:.1,maxFps:0,timeScale:1,...Ie(e??{},n)},this.#r=e?.driver??ke()}#E(e){for(let t=this.#i.length;t--;){let n=this.#i[t]?.settings?.[e];if(n!==void 0)return n}return this.#n[e]}get mode(){return this.#E(`mode`)}get maxDelta(){return this.#E(`maxDelta`)}get maxFps(){return this.#E(`maxFps`)}get timeScale(){return this.#E(`timeScale`)}get driver(){for(let e=this.#i.length;e--;){let t=this.#i[e]?.driver;if(t)return t}return this.#r}get awake(){return this.#g||this.#_}get paused(){return this.#l.size>0}overrideLoop(e,t){return this.#D(e,{settings:Ie(t,t=>e.log.warn(t))})}setDriver(e,t){return this.#D(e,{driver:t})}#D(e,t){if(!e.open())return d;let n=e=>{let t=this.driver,n=this.#x-t.now();e(),this.driver!==t&&(this.#x=n>0?this.driver.now()+n:0,this.#h&&(this.#M(),this.#j())),this.#k()};return n(()=>this.#i.push(t)),e.add(()=>n(()=>A(this.#i,t)))}profile(e,t){return e.open()?(this.#u=[...this.#u,t],e.add(()=>{this.#u=this.#u.filter(e=>e!==t)})):d}addStage(e,t,r){if(!r.open())return d;let i=r.plugin;if(this.#a.some(t=>t.name===e))throw new n(`STAGE_DUPLICATE`,`stage "${e}" exists`,{plugin:i});let a=t.before??t.after,o=this.#a.findIndex(e=>e.name===a);if(o<0)throw new n(`STAGE_UNKNOWN`,`no stage "${a}"`,{plugin:i});if(t.after!==void 0)for(o++;this.#a[o]?.afterOf===a;)o++;let s=this.#o.filter(t=>t.stage===e),c={name:e,afterOf:t.after,systems:l(s)};for(let e of c.systems)A(this.#o,e),e.parked=!1;return this.#a.splice(o,0,c),this.#p=!0,r.add(()=>{if(A(this.#a,c)){for(let e of c.systems)e.parked=!0;this.#o.push(...c.systems),this.#p=!0}})}system(e,t,r,i){let a={name:r?.name??i.label,stage:e,owner:i.label,scope:i,run:t,labels:Ee(i,r?.name),before:o(r?.before),after:o(r?.after),rank:i.rank,seq:this.#w++,active:!1,parked:!1,enabled:!0,failures:0,error:void 0},s=d,c=Pe(a,()=>s());if(!i.open())return c;let u=this.#a.find(t=>t.name===e),f=l([...u?u.systems:this.#o.filter(t=>t.stage===e),a]);if(!Array.isArray(f))throw new n(`ORDER_CYCLE`,`stage "${e}": ${f.cycle.map(e=>e.name).join(` → `)}`,{plugin:i.plugin});return u?u.systems=f:(a.parked=!0,this.#o.push(a),this.#s.has(e)||(this.#s.add(e),i.log.warn(`stage "${e}" does not exist yet; system parked`))),a.active=!0,this.#p=!0,s=i.add(()=>{a.active=!1;for(let e of this.#a)e.systems=e.systems.filter(e=>e!==a);A(this.#o,a),this.#p=!0}),c}invalidate(e){this.#v=!0,this.#t.invalidatedBy=e.label,this.#k()}keepAwake(e,t){t>0&&(this.#x=Math.max(this.#x,this.driver.now()+t*1e3)),this.invalidate(e)}hold(e){if(!e.open())return d;let t={};return this.#c.add(t),this.#k(),e.add(()=>this.#c.delete(t)&&this.invalidate(e))}pause(e){if(!e.open())return d;let t={};return this.#l.add(t),this.#g&&=(this.#m?.cancel(),!1),e.add(()=>{this.#l.delete(t)&&!this.#l.size&&(this.#b=!0,this.#k())})}attach(){this.#h=!0,this.#j(),this.#v=!0,this.#k()}stop(){this.#h=!1,this.#M()}#O(){return this.#v||this.#c.size>0||this.mode===`always`||this.#x>0&&this.driver.now()<this.#x}#k(){!this.#h||this.#l.size||this.#g||this.#_||this.#O()&&this.#A()}#A(){this.#g=!0,this.#m?.request()}#j(){this.#m=this.driver.attach((e,t)=>this.#N(e,t)),this.#b=!0,this.#S=void 0,this.#g=!1}#M(){this.#m?.cancel(),this.#m?.detach(),this.#m=void 0,this.#g=!1}#N(e,t){if(this.#_||!this.#h)return!1;if(Number.isFinite(e)||(e=this.#S??0),this.#g=!1,t===void 0){if(this.#l.size||!this.#O())return this.#y=!1,!1;let t=this.maxFps,n=this.#S===void 0?1/0:e-this.#S;if(t>0&&!this.#b&&n>=0&&n<1e3/t-1)return this.#A(),!1}return this.#P(e,t),!0}#P(e,t){if(this.#t.reason=this.#L(t),this.#F(e,t),this.#v=!1,this.#p){this.#f.length=0;for(let e of this.#a)this.#f.push(...e.systems);this.#p=!1}this.#I(),this.#y=this.#h&&!this.#l.size&&this.#O(),this.#y&&this.#A()}#F(e,t){let n=this.#e,r=this.#t,i=this.#C,a=this.#S===void 0?i:Math.max(0,(e-this.#S)/1e3),o=this.#b||this.#S===void 0||!this.#y&&a>=3*i;this.#b=!1,n.delta=(t??Math.min(a,o?i:this.maxDelta))*this.timeScale,t===void 0&&!o&&(this.#C=Fe(i,a)),n.rawDelta=a,n.elapsed+=n.delta,n.now=e,n.frame++,n.resumed=o&&t===void 0,this.#S=e,r.frames++,n.resumed&&r.wakes++,r.interval=this.#C}#I(){this.#d=this.#u,this.#_=!0;try{this.#z(`frameStart`,this.#e);for(let e of this.#f){if(!this.#h)break;e.active&&!e.parked&&e.enabled&&e.scope.ready&&this.#R(e)}this.#z(`frameEnd`,this.#e)}finally{this.#_=!1}}#L(e){return e===void 0?this.#v?`invalidate`:this.#c.size?`hold`:this.mode===`always`?`always`:`timed`:`step`}#R(e){this.#z(`systemStart`,e);try{let t=e.run(this.#e);if(p(t))throw t.then(void 0,d),Error(`system "${e.name}" returned a promise`);e.failures=0}catch(t){if(++e.failures===1&&this.#T(t,`system`,e.scope,e.name),e.failures>=10){e.enabled=!1,e.error=t;let r=new n(`SYSTEM_DISABLED`,`"${e.name}" failed 10 frames in a row`,{plugin:e.scope.plugin,cause:t});this.#T(r,`system`,e.scope,e.name)}}this.#z(`systemEnd`,e)}#z(e,t){for(let n of this.#d)if(this.#u.includes(n))try{n[e](t)}catch(e){this.#u=this.#u.filter(e=>e!==n),this.#T(e,`loop`,void 0,`profiler`)}}};function Pe(e,t){let n=(()=>t());return Object.defineProperties(n,{name:{value:e.name},enabled:{get:()=>e.enabled,set:t=>{e.enabled=t,t&&(e.failures=0,e.error=void 0)}},error:{get:()=>e.error}}),n}function Fe(e,t){let n=t>0&&t<3*e?e+(t-e)*.1:e;return Math.min(Math.max(n,1/240),1/30)}function Ie(e,t){let n={},{mode:r}=e;r===`demand`||r===`always`?n.mode=r:r!==void 0&&t(`loop: invalid mode "${String(r)}" ignored`);for(let r of[`maxDelta`,`maxFps`,`timeScale`]){let i=e[r];Le(i)?n[r]=i:i!==void 0&&t(`loop: invalid ${r} ignored`)}return n}const Le=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function A(e,t){let n=e.indexOf(t);return n>=0&&e.splice(n,1),n>=0}var Re=class e{env;label;rank;plugin;allowed;disposed=!1;abortOnAdd=!1;#e;#t;#n;#r=/* @__PURE__ */ new Set;#i;#a;#o;constructor(e){this.env=e.env,this.label=e.label,this.rank=e.rank,this.plugin=e.plugin,this.allowed=e.allowed}get ready(){return this.#e??this.#t?.ready??!0}set ready(e){this.#e=e}get signal(){return this.#i||(this.#i=new AbortController,this.disposed&&this.#i.abort()),this.#i.signal}get log(){return this.#o??=this.env.logFor(this),this.#o}open(){if(!this.disposed)return!0;if(this.abortOnAdd)throw new n(`ABORTED`,`setup was aborted`,{plugin:this.plugin});return this.log.warn(`registration on a closed scope ignored`),!1}add(e){return this.disposed?(this.#s(e),this.open(),d):(this.#r.add(e),()=>{this.#r.delete(e)&&this.#s(e)})}child(t){let n=new e({env:this.env,label:t?.label??this.label,rank:t?.rank??this.rank,plugin:t&&`plugin`in t?t.plugin:this.plugin,allowed:t&&`allowed`in t?t.allowed:this.allowed});if(n.#t=this,this.disposed)n.disposed=!0;else{let e=()=>n.dispose();this.#r.add(e),n.#n=()=>this.#r.delete(e)}return n}dispose(){if(this.#a)return this.#a;let e=d;this.#a=new Promise(t=>{e=t}),this.disposed=!0,this.#n?.();let t=[...this.#r].reverse();this.#r.clear(),this.#i?.abort();let n=t.map(e=>this.#s(e)).filter(p);return e(n.length?Promise.all(n).then(d):f),this.#a}#s(e){try{let t=e();return p(t)?Promise.resolve(t).then(void 0,e=>this.env.report(e,`dispose`,this)):void 0}catch(e){this.env.report(e,`dispose`,this)}}};let j,M=0,N=!1;const P=[];function ze(e){let t=globalThis.reportError;typeof t==`function`?t(e):console.error(e)}function Be(e){j&&!j.has(e)&&j.set(e,e.version)}function F(){if(!(N||M>0)){N=!0;try{let e=0;for(;P.length;){if(++e>100){for(let e of P)e.queued=!1;P.length=0,ze(new n(`SIGNAL_CYCLE`,`effects did not settle after 100 passes`));break}let t=P.splice(0);for(let e of t)e.queued=!1,e.stale()&&e.run()}}finally{N=!1}}}function Ve(e,t,n){if(n){for(let n of e.deps.keys())t.has(n)||n.unwatch(e);for(let n of t.keys())e.deps.has(n)||n.watch(e)}e.deps=t}var He=class{version=0;#e=/* @__PURE__ */ new Set;#t;#n;constructor(e,t){this.#t=e,this.#n=t?.equals??Object.is}get value(){return Be(this),this.#t}set value(e){if(!this.#n(this.#t,e)){this.#t=e,this.version++;for(let e of this.#e)e.notify();F()}}peek(){return this.#t}subscribe(e){return We(this,e)}refresh(){}watch(e){this.#e.add(e)}unwatch(e){this.#e.delete(e)}},Ue=class{deps=/* @__PURE__ */ new Map;queued=!1;#e=!1;#t;#n;#r;constructor(e,t){this.#n=e,this.#r=t}notify(){this.queued||this.#e||(this.queued=!0,P.push(this))}stale(){if(this.#e)return!1;for(let[e,t]of this.deps){try{e.refresh()}catch{return!0}if(e.version!==t)return!0}return!1}run(){if(this.#e)return;this.#a();let e=j,t=/* @__PURE__ */ new Map;j=t;try{let e=this.#n();typeof e==`function`?this.#t=e:p(e)&&e.then(void 0,this.#r)}catch(e){this.#r(e)}finally{j=e,this.#e?this.#a():this.#i(t)}}#i(e){Ve(this,e,!0);for(let[t,n]of e)if(t.version!==n){this.notify(),F();return}}dispose(){if(!this.#e){this.#e=!0;for(let e of this.deps.keys())e.unwatch(this);this.deps.clear(),this.#a()}}#a(){let e=this.#t;if(this.#t=void 0,!e)return;let t=j;j=void 0;try{e()}catch(e){this.#r(e)}finally{j=t}}};function We(e,t){let n=!0,r=new Ue(()=>{let n=e.value;qe(()=>t(n))},e=>{if(n)throw e;ze(e)});try{r.run()}catch(e){throw r.dispose(),e}finally{n=!1}return()=>r.dispose()}function I(e,t){return new He(e,t)}function Ge(e,t){let n=new Ue(e,t);return n.run(),()=>n.dispose()}function Ke(e){M++;try{return e()}finally{M--,F()}}function qe(e){let t=j;j=void 0;try{return e()}finally{j=t}}const L=Symbol(`diorama.owner`),R=Symbol(`diorama.kernel`),z=e=>e[R],B=e=>e[L],Je={use(e){return z(this).use(e,B(this))},remove(e,t){return z(this).remove(e,t,B(this))},has(e){return z(this).has(e)},get(e){return z(this).service(B(this),e,!0)},find(e){return z(this).service(B(this),e,!1)},on(e,t){return z(this).events.on(e,t,B(this),!1)},once(e,t){return z(this).events.on(e,t,B(this),!0)},emit(e,t){B(this).disposed||z(this).events.emit(e,t)},hook(e,t,n){return z(this).hooks.add(e,t,B(this),n)},callHook(e,t,n){return B(this).disposed?t:z(this).hooks.call(e,t,n)},callHookAsync(e,t,n){return B(this).disposed?Promise.resolve(t):z(this).hooks.callAsync(e,t,n)},hookVersion(e){return z(this).hooks.version(e)},get loop(){return z(this).loop},system(e,t,n){return z(this).loop.system(e,t,n,B(this))},addStage(e,t){return z(this).loop.addStage(e,t,B(this))},invalidate(){let e=B(this);e.disposed||z(this).loop.invalidate(e)},keepAwake(e){let t=B(this);t.disposed||z(this).loop.keepAwake(t,e)},hold(){return z(this).loop.hold(B(this))},pause(){return z(this).loop.pause(B(this))},overrideLoop(e){return z(this).loop.overrideLoop(B(this),e)},setDriver(e){return z(this).loop.setDriver(B(this),e)},profile(e){return z(this).loop.profile(B(this),e)},effect(e){let t=z(this),n=B(this);return n.open()?n.add(Ge(e,e=>t.report(e,`effect`,n))):d},scope(){return z(this).view(B(this).child(),!0)},onDispose(e){return B(this).add(typeof e==`function`?e:()=>e.dispose())},get abortSignal(){return B(this).signal},get log(){return B(this).log},report(e,t){let n=B(this);e?.name===`AbortError`&&n.signal.aborted||z(this).report(e,`report`,n,t)}},V={get name(){return z(this).name},get state(){return z(this).state},start(){return z(this).start()},destroy(){return z(this).destroy()}},Ye={dispose(){return B(this).dispose()},get disposed(){return B(this).disposed}},H=e=>Object.getOwnPropertyDescriptors(e),Xe=Object.defineProperties({},H(Je)),Ze=e=>e in Xe||e in V||e in Ye||me.includes(e),Qe=2**31-1,U=e=>new n(`ABORTED`,`start was aborted`,{plugin:e}),W=()=>new n(`APP_DESTROYED`,`the app is destroyed`);var $e=class{name;state=I(`idle`);events;hooks;loop;root;rootView;#e;#t;#n;#r;#i;#a;#o=/* @__PURE__ */ new Map;#s=/* @__PURE__ */ new Set;#c=[];#l;#u;#d=f;#f=new AbortController;#p=!1;#m=!1;#h=0;constructor(e,t){this.#e=e,this.#t={options:e,defaults:t,disabled:new Set(Array.isArray(e.disable)?e.disable:[]),reserved:Ze},this.name=e.name??`app`;let n=e.logger??console,r=e.logLevel??`warn`;this.#n=_(n,r,``);let i=e.setupTimeout;this.#r=typeof i==`number`&&i>0?i:30;let a={value:0},o=this.report.bind(this);this.events=new Te(o,a),this.hooks=new De(o,a);let s=t=>{let i=[`diorama`,e.name,t.plugin].filter(Boolean);return _(n,r,`[${i.join(`:`)}]`)};this.root=new Re({env:{report:o,logFor:s},label:`app`,rank:1/0}),this.loop=new Ne(e.loop,o,e=>this.root.log.warn(e)),this.#i=Object.create(Xe,{[R]:{value:this}}),this.#a=Object.create(this.#i,H(Ye)),this.rootView=Object.create(Object.create(this.#i,H(V)),{[L]:{value:this.root}})}view(e,t){return Object.create(t?this.#a:this.#i,{[L]:{value:e}})}report(e,t,n,r){let i=a(e,t,n?.plugin);if(this.#m)console.error(i);else{this.#m=!0;try{this.#n.error(i);let e={error:i,source:t,plugin:n?.plugin??i.plugin,target:r};this.events.emit(`app:error`,e),this.#e.onError?.(e)}catch(e){console.error(e)}finally{this.#m=!1}}}has(e){return this.#o.get(b(e)??``)?.status===`running`}service(e,t,r){let i=b(t)??String(t);if(e.allowed&&!e.allowed.has(i))throw new n(`UNDECLARED_DEPENDENCY`,`"${i}" is not a declared dependency`,{plugin:e.plugin});let a=this.#o.get(i);if(!e.disposed&&a?.status===`running`)return a.service;if(r)throw new n(`SERVICE_UNAVAILABLE`,this.#g(i,a,e),{plugin:e.plugin})}#g(e,t,n){return this.state.peek()===`destroyed`?`"${e}": the app is destroyed`:n.disposed?`"${e}": this view is closed`:t?`"${e}" is ${t.status}${t.error?`: ${t.error.message}`:``}`:`"${e}" is not installed${ge(this.#t,e)}`}start(){if(this.#l)return this.#l;if(this.#u)return Promise.reject(W());let e=d;return this.#d=new Promise(t=>{e=t}),this.#l=this.#_(),this.#l.then(e,e),this.#l}async#_(){this.state.value=`starting`;let{signal:e}=this.#f;try{let t=[],n=he(this.#t,t),{list:r,failures:i}=await _e(this.#t,n);if(e.aborted)throw U();let a=this.#v(r,i,t);for(let t of a){if(e.aborted)throw U();if(t.status===`failed`)continue;let n=t.deps.find(e=>!this.has(e)),r=n===void 0?await this.#C(t,e):this.#y(t,n);if(r&&(t.critical||this.#e.failFast&&n===void 0))return this.#b(r)}if(e.aborted)throw U()}catch(t){if(e.aborted||this.state.peek()!==`starting`)throw t;let n=a(t,`config`,void 0);return this.report(n,`config`,void 0),this.#b(n)}if(this.state.value=`running`,this.#u)throw U();return this.loop.attach(),this.events.emit(`app:start`,void 0),this.rootView}#v(e,t,r){let i=ve(e);Array.isArray(i)||r.push(ye(i.cycle));for(let[e,n]of t)(e.critical||this.#e.failFast)&&r.push(n);if(r.length||!Array.isArray(i)){let e=r.length===1?r[0]:new n(`CONFIG_INVALID`,`${r.length} configuration problems`,{problems:r});return this.report(e,`config`,void 0),this.#b(e)}for(let e of i)e.ordinal=this.#h++,this.#o.set(e.name,e);for(let[e,n]of t)e.error=n,this.#S(e,`failed`,n),this.report(n,`config`,void 0);return i}#y(e,t){let r=new n(`PLUGIN_DEPENDENCY_FAILED`,`dependency "${t}" is not running`,{plugin:e.name});return e.error=r,this.root.log.warn(r.message),this.#S(e,`skipped`,r),r}#b(e){for(let e of this.#x())this.#c.push(this.#E(e));throw this.#c.push(this.root.dispose()),this.loop.stop(),this.state.value=`failed`,e}#x(){return[...this.#o.values()].filter(e=>e.scope).sort((e,t)=>t.ordinal-e.ordinal)}#S(e,t,n){let r=e.status;e.status=t,this.events.emit(`plugin:status`,{name:e.name,status:t,previous:r,error:n})}async#C(e,t){let r=this.root.child({label:e.name,rank:e.ordinal,plugin:e.name,allowed:/* @__PURE__ */ new Set([e.name,...e.deps,...e.optional])});r.ready=!1,e.scope=r,e.error=void 0,this.#S(e,`starting`);let i;try{let a;this.#p=!0;try{a=e.def.setup(this.view(r,!1),e.options)}finally{this.#p=!1}if(i=p(a)?await this.#T(a,e.name,t,r):a,r.disposed)throw U(e.name);let o=e.deps.find(e=>!this.has(e));if(o!==void 0)throw new n(`PLUGIN_DEPENDENCY_FAILED`,`dependency "${o}" stopped during setup`,{plugin:e.name})}catch(n){return this.#w(e,r,t,n)}if(e.service=i,e.hasService=i!==void 0,r.ready=!0,e.hasService){let t=this;Object.defineProperty(this.#i,e.name,{configurable:!0,get(){return t.service(this[L],e.name,!1)}})}this.#S(e,`running`)}#w(e,t,a,o){if(t.abortOnAdd=!0,t.dispose(),e.scope===t&&(e.scope=void 0),r(o,`ABORTED`)&&(a.aborted||e.status!==`starting`))throw o;let s=r(o,`PLUGIN_TIMEOUT`)||r(o,`PLUGIN_DEPENDENCY_FAILED`)?o:new n(`PLUGIN_SETUP`,i(o),{plugin:e.name,cause:o});return e.error=s,this.#S(e,`failed`,s),this.report(s,`setup`,t),s}#T(e,t,r,i){let a=Promise.resolve(e),o=a.then(d,d);return this.#s.add(o),o.then(()=>this.#s.delete(o)),new Promise((e,o)=>{let s=[r,i.signal];if(s.some(e=>e.aborted))return o(U(t));let c=this.#r*1e3,l=c<=Qe?setTimeout(()=>{o(new n(`PLUGIN_TIMEOUT`,`setup did not finish in ${this.#r} s (awaiting use() or remove() from setup deadlocks)`,{plugin:t}))},c):void 0,u=()=>o(U(t));for(let e of s)e.addEventListener(`abort`,u,{once:!0});let d=()=>{clearTimeout(l);for(let e of s)e.removeEventListener(`abort`,u)};a.then(t=>{d(),e(t)},e=>{d(),o(e)})})}#E(e){let{scope:t}=e;if(!t)return f;e.status===`starting`&&(t.abortOnAdd=!0),this.#S(e,`stopping`),e.hasService&&Reflect.deleteProperty(this.#i,e.name),e.hasService=!1,e.service=void 0,e.scope=void 0,e.release?.(),e.release=void 0;let n=t.dispose();return this.#S(e,`stopped`),n}#D(e){if(this.#o.get(e.name)!==e)return f;let t=this.#M(e.name).sort((e,t)=>t.ordinal-e.ordinal);return Promise.all([...t,e].map(e=>this.#E(e)))}destroy(){if(this.#u)return this.#u;let e=d;this.#u=new Promise(t=>{e=t});let t=this.state.peek(),n=[...this.#c],r=/* @__PURE__ */ new Set;if(t!==`idle`&&t!==`failed`){this.state.value=`destroying`,this.#f.abort(),t===`running`&&this.events.emit(`app:destroy`,void 0),this.loop.stop();for(let e of this.#x())r.add(e.name),n.push(this.#E(e).finally(()=>r.delete(e.name)))}return n.push(this.root.dispose(),...this.#s),this.state.value=`destroyed`,e(this.#O(n,r)),this.#u}#O(e,t){let n=Promise.allSettled(e).then(d),r=this.#r*1e3;return r>Qe?n:new Promise(e=>{let i=setTimeout(()=>{let n=`destroy: cleanups still pending after ${this.#r} s`;this.root.log.warn(n,[...t]),e()},r);n.then(()=>{clearTimeout(i),e()})})}#k(e,t){let r=this.state.peek();if(r===`destroying`||r===`destroyed`)return Promise.reject(W());if(r===`idle`||r===`failed`)return Promise.reject(new n(`APP_STATE`,`the app is ${r}`));let i=e.plugin&&this.#o.get(e.plugin)?.status===`starting`;if(this.#p||i)return Promise.reject(new n(`PLUGIN_REENTRANT`,`use() and remove() cannot be called from setup`,{plugin:e.plugin}));let a=this.#d.then(()=>{if(this.#u)throw W();if(e.disposed)throw U();if(this.state.peek()!==`running`)throw new n(`APP_STATE`,`the app did not start`);return t()});return this.#d=a.then(d,d),a}use(e,t){return this.#k(t,()=>this.#A(e,t))}async#A(e,t){let r=tt(e).map((e,t)=>{let r=x(e);if(!r)throw new n(`PLUGIN_INVALID`,`not a plugin: ${String(e)}`);return{plugin:e,def:r,layer:3,index:t}}),{list:i,failures:a}=await _e(this.#t,r,e=>this.has(e)),o=()=>this.#f.signal.aborted||t.disposed;if(o())throw U();for(let e of a.values())throw e;let s=ve(i.filter(e=>this.#j(e)));if(!Array.isArray(s))throw ye(s.cycle);let c=[];try{for(let e of s){if(o())throw U();e.ordinal=this.#h++,this.#o.set(e.name,e),t!==this.root&&(e.release=t.add(()=>e.scope?this.#D(e):void 0));let n=await this.#C(e,this.#f.signal);if(n)throw n;c.push(e)}}catch(e){for(let e of c.reverse())await this.#E(e);for(let e of s)e.release?.(),e.release=void 0;throw e}return typeof e==`function`?this.#o.get(e.name)?.service:void 0}#j(e){let t=this.#o.get(e.name);if(t?.status!==`running`)return!0;if(t.def===e.def&&h(t.raw,e.raw))return!1;throw new n(`PLUGIN_DUPLICATE`,`"${e.name}" is already running with other options`,{plugin:e.name})}remove(e,t,r){return this.#k(r,async()=>{let r=b(e)??``,i=this.#o.get(r);if(!i)return!1;if(i.status===`running`){let e=this.#M(r);if(e.length&&!t?.cascade)throw new n(`PLUGIN_HAS_DEPENDENTS`,`required by ${e.map(e=>e.name).join(`, `)}`,{plugin:r});await this.#D(i)}return i.release?.(),this.#o.delete(r),!0})}#M(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of this.#o.values())r.status===`running`&&r.deps.includes(e)&&!t.has(r)&&(t.add(r),n(r.name))};return n(e),[...t]}};function et(e,t){return new $e(e??{},t).rootView}function tt(e){let t=[],n=e=>{Array.isArray(e)?e.forEach(n):ee(e)?[...e.presets,...e.plugins].forEach(n):e&&t.push(e)};return n(e),t}function G(e,t){if(typeof document>`u`||typeof MutationObserver>`u`)return;let n=document.body,r=new MutationObserver(()=>{let e=document.body;if(!e||e===n)return;let r=n;n=e,t(e,r)});r.observe(document.documentElement,{childList:!0}),e.onDispose(()=>r.disconnect())}const nt=(e,t)=>{let n=null;for(let r=e;r;r=r.parentElement){let e=t.get(r);if(e===void 0&&(e=getComputedStyle(r).position,t.set(r,e)),e===`fixed`)return`fixed`;e===`sticky`&&(n=r.parentElement)}return n},rt=(e,t,n,r)=>e-n<2*r&&t-n>-r,it=/*#__PURE__*/ S({name:`anchors`,dependencies:[`stage`,`scroll`],setup(e){let{stage:t,scroll:n}=e,r=/* @__PURE__ */ new Set,i=!0,a=!1,o=0,s=()=>{i=!0,e.invalidate()},c=typeof ResizeObserver>`u`?void 0:new ResizeObserver(s),l=/* @__PURE__ */ new Map,u=e=>{let t=l.get(e)??0;l.set(e,t+1),t||c?.observe(e)},f=e=>{let t=(l.get(e)??1)-1;t?l.set(e,t):l.delete(e)&&c?.unobserve(e)};typeof document<`u`&&(u(document.body),window.addEventListener(`resize`,s,{signal:e.abortSignal}),document.fonts?.ready.then(s,d),G(e,(e,t)=>{f(t),u(e),s()})),e.onDispose(()=>{c?.disconnect(),l.clear(),r.clear()});let p=(e,t,n)=>{let r=e.element.getBoundingClientRect();e.pageX=r.left+t,e.pageY=r.top+n,e.width=r.width,e.height=r.height};return e.system(`layout`,()=>{let{x:e,y:s,axis:c}=n.state,l=t.width.peek(),u=t.height.peek();a!==(c===`x`)&&(a=!a,i=!0);let d=a?e:s,f=a?l:u,m=i?/* @__PURE__ */ new Map:void 0,h=Math.abs(d-o)>f;i=!1,o=d;for(let t of r){if(m){p(t,e,s),t.version++;let n=nt(t.element,m),r=n&&n!==`fixed`?n.getBoundingClientRect():void 0;t.live=t.manual||n!==null;let i=n?1/0:-1/0;t.start=r?(a?r.left:r.top)+d:-i,t.end=r?(a?r.right:r.bottom)+d:i}else if(t.live){let n=a?t.pageX:t.pageY,r=n+(a?t.width:t.height);(h||rt(t.start,t.end,d,f)||rt(n,r,d,f))&&p(t,e,s)}t.x=t.pageX-e,t.y=t.pageY-s,t.visible=t.width>0&&t.x<l&&t.x+t.width>0&&t.y<u&&t.y+t.height>0;let n=a?t.x:t.y,r=a?t.width:t.height;t.progress=Math.min(1,Math.max(0,(f-n)/(f+r||1)));let i=r-f;t.pin=i>0?Math.min(1,Math.max(0,-n/i)):+(n<=0)}},{name:`anchors`}),{refresh:s,track(e,t){let n=t?.live===!0,i={element:e,x:0,y:0,width:0,height:0,visible:!1,progress:0,pin:0,version:0,pageX:0,pageY:0,manual:n,live:n,start:1/0,end:-1/0,dispose(){r.delete(i)&&f(e)}};return r.add(i),u(e),s(),i}}}});function K(e){let t=0,n=0;return{get value(){return t&&(e.loop.driver.now()-n>100?t=0:e.invalidate()),t},update(e,r){let i=r.delta>0?e/r.delta:0;t+=(i-t)*(1-Math.exp(-r.delta*10)),Math.abs(t)<=1&&(t=0),n=r.now}}}const at=/*#__PURE__*/ S({name:`pointer`,dependencies:[`stage`],setup(e){let t=K(e),n=K(e),r=0,i=0,a=!1,o=-1,s=()=>{o=e.loop.time.frame},c={get x(){return s(),r},get y(){return s(),i},get nx(){return s(),r/(e.stage.width.peek()||1)*2-1},get ny(){return s(),1-i/(e.stage.height.peek()||1)*2},get vx(){return s(),t.value},get vy(){return s(),n.value},get inside(){return s(),a},type:`mouse`};if(typeof window>`u`)return{state:c};let l=()=>{o>=e.loop.time.frame&&e.invalidate()},u={signal:e.abortSignal,passive:!0},d=e=>{r=e.clientX,i=e.clientY;let{pointerType:t}=e;c.type=t===`touch`||t===`pen`?t:`mouse`,a=!0,l()},f=()=>{a=!1,l()},p=e=>{e.pointerType===`touch`&&f()};window.addEventListener(`pointermove`,d,u),window.addEventListener(`pointerdown`,d,u),window.addEventListener(`pointerup`,p,u),window.addEventListener(`pointercancel`,p,u),document.documentElement.addEventListener(`pointerleave`,f,u);let m=0,h=0,g=!1;return e.system(`input`,e=>{let o=a&&!g;g=a,t.update(o?0:r-m,e),n.update(o?0:i-h,e),m=r,h=i},{name:`pointer`}),{state:c}}}),q=(e,t)=>Number.isFinite(e)?e:t,ot=/*#__PURE__*/ S({name:`scroll`,setup(e){let t=K(e),n={x:0,y:0,get velocity(){return t.value},get direction(){return Math.sign(t.value)},progress:0,axis:`y`};if(typeof window>`u`)return{state:n,measure:d,source:()=>d};let r=document.documentElement,i=window.scrollX,a=window.scrollY,o=0,s=0;n.x=i,n.y=a;let c={signal:e.abortSignal,passive:!0};window.addEventListener(`scroll`,()=>{i=window.scrollX,a=window.scrollY,e.invalidate()},c);let l=()=>{o=Math.max(0,r.scrollWidth-r.clientWidth),s=Math.max(0,r.scrollHeight-r.clientHeight),e.invalidate()};l(),window.addEventListener(`resize`,l,c);let u=typeof ResizeObserver>`u`?void 0:new ResizeObserver(l);u?.observe(document.body),u&&e.onDispose(()=>u.disconnect()),G(e,(e,t)=>{u?.unobserve(t),u?.observe(e),l()});let f=[],p={x:0,y:0,travel:0},m=a,h=!0,g=!1,_=()=>{h=!0,g=!1,e.invalidate()},v=e=>(f.push(e),_(),()=>{let t=f.indexOf(e);t<0||(f.splice(t,1),_())}),y=t=>{p.x=i,p.y=a,p.travel=m;try{t.read(p);let e=t.limit?.();return p.x=q(p.x,i),p.y=q(p.y,a),p.travel=q(p.travel,m),g&&(h=!0),g=!1,e}catch(n){g||e.report(n,`scroll:${t.name}`),g=!0,p.x=i,p.y=a,p.travel=m;return}};return e.system(`input`,e=>{let r=f.at(-1),c;r?c=y(r):(p.x=i,p.y=a,p.travel=a);let l=r?.axis??`y`,u=p.travel-m;h||e.resumed||Math.abs(u)>(l===`x`?innerWidth:innerHeight)?h=!1:t.update(u,e),m=p.travel;let d=l===`x`?o:s;Number.isFinite(c)&&c>0&&(d=c);let g=l===`x`?p.x:p.y;n.axis=l,n.x=p.x,n.y=p.y,n.progress=d>0?Math.min(1,Math.max(0,g/d)):0},{name:`scroll`}),{state:n,measure:l,source:v}}}),J=`dio-stage-scroll`,Y=1e6,st=.5;let X,ct=0;function lt(e){let t=document.documentElement,n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Set,i=++ct,a,o=!1,s=0,c=!1,l=0,u=[],d=J,f=0,p;e.system(`layout`,()=>{if(!a)return;if(Z(p),!c){let{animationName:e,animationTimeline:t}=a.computed;o=e.startsWith(J)&&t?.startsWith(`scroll(`)!==!1}let e=window.visualViewport?.height??t.clientHeight,n=t.scrollHeight-Math.max(e,0);s=o?Math.max(0,Math.min(window.scrollY,n,Y)):0},{name:`stage`}),e.system(`afterRender`,()=>{if(!a)return;let{canvas:e}=a,t=!1;if(o)for(let e of n)e()&&(t=!0);if(o&&!t){let e=ut(r);dt(e,u)||(u=e,u.length?(d=`${J}-${i}-${++f%2}`,p??=new CSSStyleSheet,p.replaceSync(pt(d,u)),Z(p)):d=J)}let m=t?`none`:d;(c!==t||e.style.animationName!==m)&&(e.style.animationName=m),c=t;let h=t?0:s-ft(u,s);h!==l&&(l=h,e.style.translate=h?`0px ${h}px`:``)},{name:`stage`}),e.onDispose(()=>{p&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==p))});let m=(e=>{let t=mt(e);t&&(a={canvas:e,computed:t})});return m.hold=e=>{let t=()=>e();return n.add(t),()=>void n.delete(t)},m.pin=e=>{let t=()=>e();return r.add(t),()=>void r.delete(t)},m}function ut(e){let t=[];for(let n of e)for(let[e,r]of n()){let n=Math.max(0,e),i=Math.min(Y,r);i>n&&t.push([n,i])}t.sort((e,t)=>e[0]-t[0]);let n=[];for(let e of t){let t=n.at(-1);t&&e[0]<=t[1]?t[1]=Math.max(t[1],e[1]):n.push(e)}return n}const dt=(e,t)=>e.length===t.length&&e.every(([e,n],r)=>{let[i,a]=t[r];return Math.abs(e-i)<st&&Math.abs(n-a)<st});function ft(e,t){let n=0;for(let[r,i]of e)n+=Math.max(0,Math.min(t,i)-r);return n}function pt(e,t){let n=(e,t)=>`${(e/Y*100).toFixed(6)}%{transform:translateY(${-t}px)}`,r=[n(0,0)],i=0;for(let[e,a]of t)r.push(n(e,e-i)),i+=a-e,r.push(n(a,a-i));return r.push(n(Y,Y-i)),`@keyframes ${e}{${r.join(``)}}`}function Z(e){X||(X=new CSSStyleSheet,X.replaceSync(`@keyframes ${J} { to { transform: translateY(-${Y}px) } }`));let t=document.adoptedStyleSheets,n=[X,e].filter(e=>!!e&&!t.includes(e));n.length&&(document.adoptedStyleSheets=[...t,...n])}function mt(e){if(typeof CSS<`u`&&CSS.supports?.(`animation-timeline: scroll(root y)`))return Z(),e.style.cssText+=`animation:${J} linear both;animation-timeline:scroll(root y);animation-range:0px ${Y}px`,getComputedStyle(e)}const ht={canvas:void 0,zIndex:1,maxPixelRatio:2,followScroll:!0},Q=[`100vh`,`100lvh`];function gt(){let e=document.createElement(`div`);e.style.cssText=`position:fixed;top:0;left:0;width:0;visibility:hidden;pointer-events:none;height:${Q[0]};height:${Q[1]}`,document.documentElement.append(e);let{height:t}=e.getBoundingClientRect();return e.remove(),t}const $=/* @__PURE__ */ new WeakSet,_t=/*#__PURE__*/ S({name:`stage`,defaults:ht,setup(e,t){let n=I(0),r=I(0),i=I(1),a=I(!1),o={canvas:void 0,width:n,height:r,pixelRatio:i,reducedMotion:a,hold:()=>d,pin:()=>d};if(typeof document>`u`)return o;let s=document.documentElement,c=()=>{Ke(()=>{n.value=s.clientWidth,r.value=Math.max(s.clientHeight,gt()),i.value=Math.min(window.devicePixelRatio||1,t.maxPixelRatio)}),e.invalidate()};c();let l={signal:e.abortSignal};window.addEventListener(`resize`,c,l);let u=window.matchMedia?.(`(prefers-reduced-motion: reduce)`);if(u){let e=()=>{a.value=u.matches};e(),u.addEventListener(`change`,e,l)}let f=lt(e),p,m=n=>{t.followScroll&&f(n),$.add(n),e.onDispose(()=>{$.delete(n),n.remove()}),G(e,t=>{for(let e of t.querySelectorAll(`canvas[data-dio-canvas]`))$.has(e)||e.remove();n.isConnected||t.append(n),e.invalidate()})};return{...o,hold:f.hold,pin:f.pin,get canvas(){return p??=vt(t,m),p}}}});function vt(e,t){let{canvas:r}=e;if(r instanceof HTMLCanvasElement)return r;if(typeof r==`string`){let e=document.querySelector(r);if(e instanceof HTMLCanvasElement)return e;throw new n(`PLUGIN_OPTIONS`,`no canvas matches "${r}"`,{plugin:`stage`})}let i=document.createElement(`canvas`);return i.setAttribute(`aria-hidden`,`true`),i.setAttribute(`data-dio-canvas`,``),i.setAttribute(`data-turbo-temporary`,``),Object.assign(i.style,{position:`fixed`,inset:`0`,width:`100%`,height:Q[0],pointerEvents:`none`,zIndex:String(e.zIndex)}),i.style.height=Q[1],document.body.append(i),t(i),i}const yt=[/* @__PURE__ */ S({name:`visibility`,defaults:{pause:!0},setup(e,t){let n=I(!0);if(typeof document>`u`)return{visible:n};let r,i=()=>{n.value=document.visibilityState!==`hidden`,!n.peek()&&t.pause?r??=e.pause(`hidden`):r&&=(r(),void 0)};return i(),document.addEventListener(`visibilitychange`,i,{signal:e.abortSignal}),{visible:n}}}),_t,ot,at,it];function bt(e){return et(e,yt)}export{k as a,_t as c,re as i,Ae as l,bt as n,r as o,S as r,I as s,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={globe:{load:()=>import(`./globe-
|
|
1
|
+
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={globe:{load:()=>import(`./globe-hGhuLOSR.js`),params:{lat:20,lng:0,spin:3.6,drag:!0,scale:.8,color:e(`#0d1220`),land:e(`#5b6b8c`),marker:e(`#ffb547`),arc:e(`#ffb547`),atmosphere:e(`#6ea8ff`),glow:.4,markerSize:6,fps:30}}};export{t as globe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={confetti:{load:()=>import(`./confetti-
|
|
1
|
+
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={confetti:{load:()=>import(`./confetti-DZCMbuTg.js`),params:{fire:0,once:!1,count:200,angle:90,spread:70,speed:1400,gravity:1600,decay:1.2,duration:3,scale:1},reducedMotion:`off`},sparkles:{load:()=>import(`./sparkles-C8MjHp2r.js`),params:{count:12,scale:1,color:e(`#ffd75e`),spread:24,duration:1.1,fps:30},reducedMotion:`off`},snow:{load:()=>import(`./snow-JCiQsGHf.js`),params:{count:160,scale:1,speed:1,wind:.2,pile:0,push:.5,fps:30},reducedMotion:`off`},emoji:{load:()=>import(`./emoji-BFxwyyMp.js`),params:{fire:0,once:!1,count:8,scale:1,speed:1,spread:40,sway:12,spin:1,duration:2.4,interval:1.5},reducedMotion:`off`},drops:{load:()=>import(`./drops-BkwM693o.js`),params:{fire:0,rate:10,count:140,scale:1,speed:1,trail:.6,dry:8,lifetime:0,merge:!0,x:.5,y:.5,duration:2.4,color:e(`#ffffff`)},reducedMotion:`off`}};export{t as particles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,s as t}from"./dist-
|
|
1
|
+
import{r as e,s as t}from"./dist-CQQi9P-c.js";const n=2e3,r=1.5;var i=class{period=0;#e=[];#t=[];#n=0;#r=0;#i;#a=-1/0;get share(){return this.#t.length?this.#r/this.#t.length:0}frame(e){let t=this.#i;if(this.#i=e,t===void 0)return!1;let i=e-t;if(t<this.#a||i>250)return!1;if(!this.period){if(this.#e.push(i),this.#e.reduce((e,t)=>e+t,0)>=1e3){let e=[...this.#e].sort((e,t)=>e-t);this.period=e[Math.floor(e.length*.1)]}return!1}for(this.#t.push(i),this.#n+=i,i>r*this.period&&this.#r++;this.#n-this.#t[0]>=n;)this.#o();return this.#n>=n&&this.share>=.25}stop(){this.#i=void 0}quiet(e){this.#a=Math.max(this.#a,e)}clear(){for(;this.#t.length;)this.#o()}#o(){let e=this.#t.shift();this.#n-=e,e>r*this.period&&this.#r--}};const a=[[`software`,/swiftshader|llvmpipe|lavapipe|basic render|software/i],[`mobile`,/mali|adreno|powervr|apple gpu|^(qualcomm|arm|imagination)\b/i],[`integrated`,/intel.*\b(hd|uhd|iris|gen-\d|xe-lp)|radeon\(tm\) graphics|apple m\d/i],[`discrete`,/nvidia|geforce|rtx|radeon rx|\barc\b|xe-hp/i]],o=e=>a.find(([,t])=>t.test(e))?.[0]??`unknown`;function s(e,t){let n=(t.memory??8)<=3||(t.cores??8)<=4,r=e.class===`software`?`low`:e.class===`mobile`?n?`low`:`medium`:e.class===`integrated`?/apple m\d/i.test(e.name)?`high`:`medium`:e.class===`discrete`||!t.coarse?`high`:`medium`;return r===`high`&&t.ratio>=3&&t.pixels>=15e5?`medium`:r}function c(e){let{backend:t}=e,n=e.renderer.backend,r=``;try{let e=n?.device?.adapterInfo,t=n?.gl;if(e)r=[e.vendor,e.architecture,e.description].filter(Boolean).join(` `);else if(t){let e=t.getExtension(`WEBGL_debug_renderer_info`);r=String(t.getParameter(e?e.UNMASKED_RENDERER_WEBGL:t.RENDERER)??``)}}catch{}return{backend:t,name:r,class:o(r)}}function l(){let e=typeof navigator>`u`?{}:navigator,t=typeof devicePixelRatio==`number`?devicePixelRatio:1,n=typeof window>`u`?void 0:window.screen;return{memory:e.deviceMemory,cores:e.hardwareConcurrency,coarse:typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches,ratio:t,pixels:(n?.width??0)*(n?.height??0)*t*t}}const u=[`low`,`medium`,`high`],d={low:1,medium:1.5,high:1/0},f={tier:`auto`,adapt:!0,remember:!0,pixelRatio:d},p=`dio:quality`,m=()=>performance.now();function h(e){try{let t=JSON.parse(sessionStorage.getItem(p)??`null`);return t?.gpu===e&&t.tier&&u.includes(t.tier)?t.tier:void 0}catch{return}}function g(e,t){try{sessionStorage.setItem(p,JSON.stringify({gpu:e,tier:t}))}catch{}}const _=/*#__PURE__*/ e({name:`quality`,dependencies:[`render`,`stage`],defaults:f,setup(e,n){let{render:r}=e,a={...d,...n.pixelRatio},o=c(r),f=s(o,l()),p=n.remember?h(o.name):void 0,_=n.tier!==`auto`,v=t(_?n.tier:p??f),y=t(_?`pinned`:p?`remembered`:`detected`),b=new i,x=!_,S=0,C=-1/0,w=0,T=r.maxPixelRatio.peek();r.maxPixelRatio.value=a[v.peek()],e.onDispose(()=>{w&&cancelAnimationFrame(w),r.maxPixelRatio.value=T});let E=(t,i)=>{y.value=i,x&&n.remember&&g(o.name,t),t!==v.peek()&&(v.value=t,r.maxPixelRatio.value=a[t],b.quiet(m()+1e3),e.emit(`quality:tier`,{tier:t,reason:i}))},D=()=>x&&n.adapt&&S<2&&v.peek()!==`low`,O=()=>b.quiet(m()+500),k=/* @__PURE__ */ new Map;e.on(`effects:status`,({element:e,effect:t,status:n})=>{let r=k.get(e);n===`loading`?k.set(e,new Set(r).add(t)):r?.delete(t)&&!r.size&&k.delete(e)});let A=e=>{w=0,k.size&&b.quiet(e+500),D()&&b.frame(e)&&(S++,E(u[u.indexOf(v.peek())-1],`slow`),b.clear(),b.quiet(e+3e3)),D()&&m()-C<=100?w=requestAnimationFrame(A):b.stop()};e.system(`afterRender`,e=>{C=m(),e.resumed&&O(),!w&&D()&&(w=requestAnimationFrame(A))},{name:`quality`}),e.on(`effects:status`,({status:e})=>{e===`running`&&O()});for(let t of[`page:leave`,`page:enter`])e.on(t,O);let j=!1;return e.effect(()=>{e.stage.width.value,e.stage.height.value,j&&O(),j=!0}),{tier:v,reason:y,gpu:o,set(t){t!==`auto`&&!u.includes(t)?e.log.warn(`quality.set: "${String(t)}" is not a tier`):(S=0,b.clear(),x=t===`auto`,t===`auto`?E(s(o,l()),`detected`):E(t,`pinned`))},stats:()=>({refresh:b.period?1e3/b.period:0,slowShare:b.share,steps:S})}}});export{_ as quality};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./intro-BdismCiL.js";import{o as n}from"./define-BwEwaSnA-xcf1zhk4.js";const r={image:()=>import(`./image-
|
|
1
|
+
import{n as e,t}from"./intro-BdismCiL.js";import{o as n}from"./define-BwEwaSnA-xcf1zhk4.js";const r={image:()=>import(`./image-C8BD6F7U.js`),ripple:{load:()=>import(`./ripple-BGPIAJw1.js`),params:{strength:1,frequency:40,speed:6},when:`hover`},bend:{load:()=>import(`./bend-QXWstuRn.js`),params:{strength:1,split:1}},reveal:{load:()=>import(`./reveal-Bw7G-jLH.js`),params:{duration:1.2,delay:0,threshold:.2,zoom:1.12,softness:.12},reducedMotion:`off`},parallax:{load:()=>import(`./parallax-DqIE_Nlk.js`),params:{depth:.04,scroll:.12,ease:.12,focus:.5},reducedMotion:`off`},gallery:{load:()=>import(`./gallery-BPBvhrwM.js`),params:{index:0,duration:1.1,strength:.25,interval:0,click:!0,swipe:!0,loop:!0}},ambient:{load:()=>import(`./ambient-Cdp45mcb.js`),params:{strength:.5,spread:.35,blur:.6,saturation:1.2,fps:10,ease:.5}},"hover-preview":{load:()=>import(`./hover-preview-CtrrxyxG.js`),params:{width:320,ease:.15,stretch:.4,tilt:6,duration:.35,offset:[0,0],radius:0},when:`(hover: hover) and (pointer: fine)`},sequence:{load:()=>import(`./sequence-DdNQe7PM.js`),params:{start:0,end:1,frame:0,blend:!1,ease:0,cache:6},reducedMotion:`off`},expand:{load:()=>import(`./expand-_AdA72hX.js`),params:{position:0,start:0,end:.5,out:1,zoom:1.1,radius:0,ease:0},reducedMotion:`off`},"zoom-scroll":{load:()=>import(`./zoom-scroll-ZXDHlq4h.js`),params:{start:0,end:.7,zoom:1.2,radius:0,reverse:!1,ease:0},reducedMotion:`off`},compare:{load:()=>import(`./compare-CoZmY9ad.js`),params:{position:.5,radius:120,softness:0,thickness:2,color:n(`#ffffff`),handle:!0,start:.2,end:.8,hint:!0}},zoom:{load:()=>import(`./zoom-BsqNVzZz.js`),params:{zoom:2.5,radius:80,ease:.08},when:`(hover: hover) and (pointer: fine)`},lightbox:{load:()=>import(`./lightbox-CVK9lgJw.js`),params:{index:-1,margin:24,zoom:3,duration:.45,backdrop:n(`#0b0b0c`),dim:.92,loop:!1,swipe:!0}},panorama:{load:()=>import(`./panorama-C9AS8BJp.js`),params:{yaw:0,pitch:0,fov:75,range:[35,100],spin:0,drag:!0,zoom:!0,gyro:!1,marker:n(`#ffffff`),markerSize:28,fps:30}},tilt:{load:()=>import(`./tilt-CgKbQn8v.js`),params:{tilt:12,lift:20,perspective:800,ease:.12,glare:.25,foil:0,shadow:.35,reverse:!1,gyro:!1}},tone:{load:()=>import(`./tone-DHD2i4LU.js`),params:{color:n(`#000000`),background:n(`#ffffff`),strength:1,contrast:1,cell:6,angle:45,radius:140,duration:.4}},flipbook:{load:()=>import(`./flipbook-BDAUFEay.js`),params:{index:0,cover:!0,duration:.9,curl:.6,shade:.5,click:!0,swipe:!0}},spin:{load:()=>import(`./spin-DJ-YoiST.js`),params:{frame:0,row:0,sensitivity:1,spin:0,inertia:0,loop:!0,reverse:!1,blend:!1,hint:!0,cache:8,fps:30}},glitch:{load:()=>import(`./glitch-C0xIbw2H.js`),params:{strength:1,blocks:12,split:8,interval:3,duration:.45,seed:1},reducedMotion:`off`},pixelate:{load:()=>import(`./pixelate-Cay2eriT.js`),params:{cell:32,duration:1.2,delay:0},intro:e},"video-hover":{load:()=>import(`./video-hover-CyMqU7sF.js`),params:{duration:.3,delay:.15,from:0,loop:!0},when:`(hover: hover) and (pointer: fine)`,reducedMotion:`off`},stack:{load:()=>import(`./stack-Bqzc2OQQ.js`),params:{index:0,rotate:6,offset:12,duration:.6,shadow:.35,loop:!0,swipe:!0,click:!0,seed:1}},coverflow:{load:()=>import(`./coverflow-BBpN2X8R.js`),params:{index:0,angle:60,spacing:.3,depth:.6,shade:.4,reflection:0,perspective:900,duration:.5,loop:!1,drag:!0,wheel:!0,click:!0}},carousel:{load:()=>import(`./carousel-DKX_0Ck4.js`),params:{index:0,interval:0,spacing:.4,tilt:8,focus:1.15,shade:.5,reflection:0,perspective:1200,duration:.7,drag:!0,wheel:!0,click:!0,pause:!0}},polaroids:{load:()=>import(`./polaroids-Cc4VmT6G.js`),params:{index:0,open:-1,rotate:8,spread:1,border:10,paper:n(`#fbfaf6`),shadow:.45,zoom:2,duration:.5,drag:!0,seed:1}},spotlight:{load:()=>import(`./spotlight-DVA7Azih.js`),params:{radius:140,softness:.5,dim:.8,color:n(`#000000`),blur:12,rest:0,ease:.08,duration:.3}},scrub:{load:()=>import(`./scrub-DX83LFFV.js`),params:{start:0,end:1,position:0,from:0,ease:.1,blend:.12},reducedMotion:`off`},chroma:{load:()=>import(`./chroma-CTMwDMM-.js`),params:{screen:n(`#00b140`),similarity:.45,softness:.1,spill:.5,blur:1,crop:[0,0,0,0]},intro:!0},liquid:{load:()=>import(`./liquid-BLxDbMEa.js`),params:{strength:1,radius:80,duration:1.5,swirl:.5,shine:.5,split:1},reducedMotion:`off`},horizontal:{load:()=>import(`./horizontal-D0e4U4dk.js`),params:{strength:1,stretch:.15,parallax:.06,pace:1,reverse:!1,ease:.3},reducedMotion:`off`},curtain:{load:()=>import(`./curtain-C4v6A2DZ.js`),params:{position:0,start:.15,end:.85,out:1,count:5,color:n(`#0b0b0c`),zoom:1.1,shade:.5,ease:0},reducedMotion:`off`,intro:t},flare:{load:()=>import(`./flare-W-sFp2YW.js`),params:{strength:.6,glow:.25,ghosts:4,streak:0,color:n(`#ffe8c8`),position:[.8,.2],travel:.6,angle:115,width:.3,rest:0,ease:.12,duration:.4}},frost:{load:()=>import(`./frost-W_lJJSu8.js`),params:{blur:22,strength:.45,grain:.5,radius:70,refog:4,refill:1,duration:1.2,start:.15,end:.5,cover:1,x:.5,y:.5,middle:0,color:n(`#eef3f7`)}},reflection:{load:()=>import(`./reflection-BQ1Sm8o2.js`),params:{strength:.35,reach:.45,blur:8,gap:0,trim:!0,ripple:0,shadow:0,fps:30}}};export{r as media};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={beat:{load:()=>import(`./beat-
|
|
1
|
+
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={beat:{load:()=>import(`./beat-BBrKft7_.js`),params:{color:e(`#ff5a36`),zoom:1.06,shake:0,glow:.8,spread:28,sensitivity:.5,duration:.25,fps:60}},visualizer:{load:()=>import(`./visualizer-BLXSUJfy.js`),params:{bars:48,color:e(`#ffffff`),accent:e(`#ff5a36`),gap:.3,radius:2,range:[-90,-20],smooth:.75,mirror:!1,seek:!0,fps:30}}};export{t as audio};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={gradient:{load:()=>import(`./gradient-
|
|
1
|
+
import{o as e}from"./define-BwEwaSnA-xcf1zhk4.js";const t={gradient:{load:()=>import(`./gradient-DbJT2qkK.js`),params:{color1:e(`#0b1d3a`),color2:e(`#3a2b8c`),color3:e(`#e35d6a`),color4:e(`#f6c177`),speed:.2,scale:1,warp:.4,attract:.15,scroll:.25,grain:.03,fps:30}},dots:{load:()=>import(`./dots-g96d3JFh.js`),params:{gap:24,dot:2,color:e(`#a3acb9`),accent:e(`#5b6cff`),radius:140,strength:.6,speed:0,fade:0}},waves:{load:()=>import(`./waves-moqzvDQn.js`),params:{lines:16,color:e(`#3b6a8f`),background:e(`#0c1424`),warp:.5,speed:.3,thickness:1.2,scroll:.3,fps:30}},stars:{load:()=>import(`./stars-CWTNzDKU.js`),params:{count:800,depth:.5,twinkle:.5,speed:.3,warp:.5,scale:1,color:e(`#ffffff`),background:e(`#04060f`),shooting:4,fps:30}},blobs:{load:()=>import(`./blobs-DnqdqyVF.js`),params:{count:6,color1:e(`#6d5dfc`),color2:e(`#22d3ee`),color3:e(`#f472b6`),color4:e(`#fbbf24`),background:e(`#0b1026`),scale:1,softness:.3,warp:.3,speed:.15,attract:.2,scroll:.25,grain:.03,fps:30}},clouds:{load:()=>import(`./clouds-Dz2UCaSS.js`),params:{cover:.5,speed:.2,scale:1,sun:.6,depth:.2,scroll:.3,fps:30}},grid:{load:()=>import(`./grid-PWVOZHt-.js`),params:{color:e(`#ff4fd8`),background:e(`#0d0221`),accent:e(`#ff8a3d`),cells:14,horizon:.5,speed:.4,sun:.5,thickness:1.2,depth:.2,scroll:.3,fps:30}}};export{t as backgrounds};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dev-CoKR705i.js";import{t}from"./target-CVFjw9e--rWdFTtdC.js";import{i as n,n as r}from"./effect-DJHvQTKy.js";import{a as i}from"./kit-
|
|
1
|
+
import{t as e}from"./dev-CoKR705i.js";import{t}from"./target-CVFjw9e--rWdFTtdC.js";import{i as n,n as r}from"./effect-DJHvQTKy.js";import{a as i}from"./kit-DIwHK01X.js";import{t as a}from"./dist-C8ZH4c0R.js";import{Color as o,Vector2 as s}from"three/webgpu";import{abs as c,clamp as l,dFdx as u,dFdy as d,exp as f,float as p,floor as m,length as h,max as g,min as _,mix as v,select as y,smoothstep as b,uniform as x,vec2 as S,vec4 as C}from"three/tsl";const w=e=>Object.freeze({"~kind":`color`,value:e}),T=.12,E=new s(-.8,-.6),D=r({name:`dots`,params:{style:n(`dots`,`plus`,`squares`),mode:n(`grow`,`push`,`glow`),gap:24,dot:2,color:w(`#a3acb9`),accent:w(`#5b6cff`),radius:140,strength:.6,speed:0,fade:0},animate:{fps:e=>e.params.speed>0?30:0},quality:{low:{speed:0}},setup(n){let{params:r,surface:a,u:w}=n;e&&t(n,`dots`);let D=x(new s(-1e4,-1e4)),k=x(0),A=x(new s),j=globalThis.matchMedia?.(`(hover: hover)`).matches??!0,[M,N]=O(n.element),P=x(new o(M));a.color((e,{box:t,radius:n})=>{let i=w.size,a=S(t.x.mul(i.x),p(1).sub(t.y).mul(i.y)),o=g(c(u(a.x)).add(c(d(a.x))),1e-4),s=g(w.gap,2),x=g(w.dot,.5).mul(.5),T=g(w.radius,1),E=m(a.add(A).div(s)).add(.5).mul(s).sub(A),O=(e,t)=>{let n=c(e);if(r.style===`squares`)return g(n.x,n.y).sub(t);if(r.style===`plus`){let e=t.mul(.5),r=t.mul(4),i=(t,n)=>g(t.sub(r),n.sub(e));return _(i(n.x,n.y),i(n.y,n.x))}return h(e).sub(t)},j=e=>{let t=l(p(1).sub(h(e.sub(D)).div(T)),0,1);return t.mul(t).mul(p(3).sub(t.mul(2))).mul(k)},M=e=>l(p(.5).sub(e.div(o)),0,1),F,I;if(r.mode===`push`){F=p(0),I=p(0);for(let e=-1;e<=1;e++)for(let t=-1;t<=1;t++){let n=E.add(S(t,e).mul(s)),r=n.sub(D),i=j(n),o=n.add(r.div(g(h(r),.001)).mul(i.mul(s).mul(.9))),c=M(O(a.sub(o),x));I=y(c.greaterThan(F),i,I),F=g(F,c)}}else{let e=j(E),t=a.sub(E),n=r.mode===`grow`?x.mul(e.mul(2.2).add(1)):x;if(F=M(O(t,_(n,s.mul(r.style===`plus`?.11:.45)))),I=e,r.mode===`glow`){let n=h(t).div(s.mul(.25));F=g(F,f(n.mul(n).negate()).mul(e).mul(.55))}}let L=h(t.sub(.5).mul(2)),R=p(1).sub(b(v(1.42,.25,w.fade),v(1.42,1,w.fade).add(.001),L)),z=F.mul(R),B=z.add(p(N).mul(p(1).sub(z))),V=v(w.color,w.accent,I).mul(z).add(P.mul(N).mul(p(1).sub(z))).div(g(B,1e-4));return C(V,B.mul(n))});let F=0,I=0,L=0,R=D.value,z=A.value;return e=>{let t=e.reducedMotion;if(r.speed>0&&!t){let t=r.speed*e.delta,n=Math.max(r.gap,2);z.x=(z.x+E.x*t)%n,z.y=(z.y+E.y*t)%n}let a=j&&!t&&r.strength>0&&r.radius>0&&e.over;if(a){let t=e.pointer;I=t.x*e.width,L=(1-t.y)*e.height,F<.01?R.set(I,L):(R.x=i(R.x,I,T*.5,e.delta),R.y=i(R.y,L,T*.5,e.delta),(R.x-I)**2+(R.y-L)**2<.01&&R.set(I,L))}let o=+!!a;F=i(F,o,T,e.delta,.001),k.value=F*Math.max(0,r.strength);let s=a&&(R.x!==I||R.y!==L);(F!==o||s)&&n.invalidate()}}});function O(e){let t=getComputedStyle(e).backgroundColor,n=/\(([^)]*)\)/.exec(t)?.[1]?.split(/[\s,/]+/).filter(Boolean)??[],r=n.length>3?Number.parseFloat(n[3]):t&&t!==`transparent`?1:0,i=r>0?a(t):void 0;return i?[i,Number.isFinite(r)?Math.min(1,r):1]:[`#000000`,0]}export{D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./effect-DJHvQTKy.js";import{b as n}from"./kit-
|
|
1
|
+
import{i as e,n as t}from"./effect-DJHvQTKy.js";import{b as n}from"./kit-DIwHK01X.js";import{ClampToEdgeWrapping as r,DataTexture as i,DynamicDrawUsage as a,InstancedBufferAttribute as o,InstancedBufferGeometry as s,LinearFilter as c,Mesh as l,MeshBasicNodeMaterial as u,NoColorSpace as d,PlaneGeometry as f,RGBAFormat as p,UnsignedByteType as m,Vector4 as h}from"three/webgpu";import{atan as g,attribute as _,clamp as v,dot as ee,float as y,fwidth as te,hash as ne,instanceIndex as re,length as b,max as x,mix as S,normalize as ie,positionGeometry as C,select as ae,sin as oe,smoothstep as w,sqrt as se,step as T,texture as ce,uniform as E,varying as D,vec2 as O,vec3 as k,vec4 as le}from"three/tsl";const A=e=>Object.freeze({"~kind":`color`,value:e}),j=480,M=1600,N=6,P=.5,F=1;var ue=class{pool;drops=[];trails=new Float32Array(M*6);head=0;laid=0;time=0;wet=-1/0;#e;#t=[];#n=0;constructor(e,t=480){this.pool=t,this.#e=n(e)}add(e,t,n,r){if(n<=0)return;if(r.merge){for(let r of this.drops)if(Math.hypot(r.x-e,r.y-t)<(r.r+n)*.8)return this.#l(r,e,t,n),r}if(this.drops.length>=this.pool){let e=-1;if(this.drops.forEach((t,n)=>{t.vy===0&&(e<0||t.life<this.drops[e].life)&&(e=n)}),e<0)return;this.drops.splice(e,1)}let i=this.#e,a={x:e,y:t,r:n,vy:0,lean:(i()-.5)*.25,hold:i()*.6,life:r.dry*P*(.6+.8*i()),age:0,fed:0,grow:0,running:!1,mx:e,my:t,seed:i()};return this.drops.push(a),a}radius(e,t=.1){let n=this.#e,r=n();return(r<.62-t/2?1.2+1.8*n()**1.5:r<1-t?3+2.5*n():6.3+4.3*n())*e}thaw(e,t,n,r){this.#t.push({x:e,y:t,t:0,duration:Math.max(r,.001),count:n,made:0})}shower(e,t){for(let n=0;n<e;n++)this.#i(t,.12)}get thawing(){return this.#t.length>0}step(e,t,n=0){let r=Math.min(Math.max(e,0),.1);this.time+=r;let i=this.#t.length>0||n>0;for(this.#n+=n*r;this.#n>=1;)this.#n--,this.#i(t,.08);this.#r(r,t);let{drops:a}=this,o=this.#e,s=6*t.scale;for(let e=0;e<a.length;e++){let n=a[e];if(n.age+=r,n.fed>0&&(n.fed-=r,n.r+=n.grow*r,i=!0),n.r>=s&&t.speed>0&&(n.running=!0),!n.running||n.r<s*.62||t.speed<=0){n.running&&(n.running=!1,n.vy=0,n.life=Math.max(1,t.dry*P*(.4+.4*o()))),n.life-=r;continue}if(i=!0,n.hold>0){n.hold-=r;continue}let c=t.speed*(120+380*Math.min(1,(n.r-s)/(2*s)));n.vy+=(c-n.vy)*Math.min(1,r*8);let l=n.vy*r;if(n.y+=l,n.x+=n.lean*l,o()<r*.6&&(n.hold=.03+o()*.12),o()<r*1.5&&(n.lean=(o()-.5)*.3),n.r=Math.max(0,n.r-l*.0018*t.scale),o()<l*.012){let e=n.r*(.1+.12*o());n.r=Math.sqrt(Math.max(0,n.r*n.r-e*e)),this.#o(n,e,t)}Math.hypot(n.x-n.mx,n.y-n.my)>=3*t.scale&&this.#s(n,t),t.merge&&this.#c(e)}let c=t.lifetime??0;for(let e=a.length-1;e>=0;e--){let n=a[e];(n.life<=0||n.r<.5||n.y-n.r>t.height+4||c>0&&n.age>=c)&&a.splice(e,1)}return i?`moving`:a.length||this.time-this.wet<t.dry?`drying`:`still`}#r(e,t){let{width:n,height:r}=t;for(let i=this.#t.length-1;i>=0;i--){let a=this.#t[i];a.t+=e;let o=Math.min(1,a.t/a.duration),s=Math.hypot(Math.max(a.x,n-a.x),Math.max(a.y,r-a.y)),c=1-(1-o)**2,l=c*(s+160)-40,u=Math.round(a.count*c);for(;a.made<u;a.made++)for(let e=0;e<6;e++){let e=this.#e()*Math.PI*2,i=l-this.#e()*80;if(i<=0)break;let o=a.x+Math.cos(e)*i,s=a.y+Math.sin(e)*i;if(o<0||s<0||o>n||s>r)continue;let c=this.add(o,s,this.radius(t.scale,.12),t);c&&this.#a(c,t);break}o>=1&&this.#t.splice(i,1)}}#i(e,t){let n=this.#e;this.add(n()*e.width,n()*e.height,this.radius(e.scale,t),e)}#a(e,t){let n=this.#e;e.fed=.4+n()*1.6;let r=6*t.scale,i=n()<.55?r*(1.05+n()*.6):e.r*(1+n()*.2);e.grow=Math.max(0,i-e.r)/e.fed,e.life=Math.max(e.life,e.fed+Math.max(1,t.dry*P*n()))}#o(e,t,n){if(t<.6||this.drops.length>=this.pool)return;let r=e.x-e.lean*e.r,i=e.y-e.r*1.3,a=this.add(r,i,t,{...n,merge:!1});a&&(a.hold=0,a.age=e.age,a.life=n.dry*P*(.3+.4*this.#e()))}#s(e,t){if(t.trail>0){let n=this.head*6,r=this.trails;r[n]=e.mx,r[n+1]=e.my,r[n+2]=e.x,r[n+3]=e.y,r[n+4]=e.r*.42*B(e,t.lifetime??0),r[n+5]=this.time,this.head=(this.head+1)%M,this.laid=Math.min(M,this.laid+1),this.wet=this.time}e.mx=e.x,e.my=e.y}#c(e){let{drops:t}=this,n=t[e];for(let r=t.length-1;r>=0;r--){if(r===e)continue;let i=t[r],a=n.r+i.r;Math.abs(i.y-n.y)>a||Math.hypot(i.x-n.x,i.y-n.y)>=a*.8||(this.#l(n,i.x,i.y,i.r),n.vy=Math.max(n.vy,i.vy),t.splice(r,1),r<e&&e--)}}#l(e,t,n,r){let i=e.r*e.r,a=r*r;e.x=(e.x*i+t*a)/(i+a),e.y=Math.max(e.y,(e.y*i+n*a)/(i+a)),e.r=Math.sqrt(i+a),e.life=Math.max(e.life,0)}};function I(e){let t=Math.min(1,Math.abs(e)),n=Math.min(1,Math.max(0,(t-.5)/.5)),r=(.05+.16*(n*n*(3-2*n)))*(1-t**6),i=Math.max(0,1-(t/.3)**2)*.16,a=r+i;return{alpha:a,light:a>0?i/a:0}}function de(){let e=/* @__PURE__ */ new Uint8Array(256);for(let t=0;t<64;t++){let{alpha:n,light:r}=I((t+.5)/64*2-1);e[t*4]=Math.round(n*255),e[t*4+1]=Math.round(r*255),e[t*4+3]=255}let t=new i(e,64,1,p,m);return t.magFilter=t.minFilter=c,t.wrapS=t.wrapT=r,t.colorSpace=d,t.needsUpdate=!0,t}const fe=/* @__PURE__ */ new WeakMap,L=t({name:`drops`,params:{motion:e(`rain`,`thaw`),trigger:e(`view`,`manual`),fire:0,rate:10,count:140,scale:1,speed:1,trail:.6,dry:8,lifetime:0,merge:!0,x:.5,y:.5,duration:2.4,color:A(`#ffffff`),seed:1},rebuild:[`seed`],reducedMotion:`off`,animate:{fps:e=>fe.get(e.signal)??0},quality:{low:{count:70,rate:2}},async setup(e){let{params:t,u:n,element:r,app:i,signal:a}=e,o=r===document.body||r===document.documentElement,s=e.quality===`low`,c=new ue(t.seed,s?240:480),u=s?30:60,d=E(new h),f=e=>T(0,e.x).mul(T(e.x,d.z)).mul(T(0,e.y)).mul(T(e.y,d.w)),p=E(0),m=/* @__PURE__ */ new Float32Array(1920),A=/* @__PURE__ */ new Float32Array(960),j=R([[`drop`,m,4],[`shape`,A,2]]),N=_(`drop`,`vec4`),P=_(`shape`,`vec2`),F=P.x.mul(2).add(1),I=C.x.mul(2.5),L=C.y.add(.5).mul(F.add(1.25)).sub(1.25),z=N.z,B=O(d.x.add(N.x).add(I.mul(z)),d.y.sub(N.y).add(L.mul(z))),V=pe();V.positionNode=k(B,0);let he=f(D(O(N.x.add(I.mul(z)),N.y.sub(L.mul(z))))),H=D(O(I,L)),ge=D(F),_e=D(N.w),ve=D(P.y),U=O(H.x,ae(H.y.greaterThan(0),H.y.div(ge),H.y)),ye=g(U.y,U.x),be=oe(ye.mul(3).add(ve.mul(6.28))).mul(.05).add(oe(ye.mul(5).add(ve.mul(17))).mul(.025)),W=b(U).mul(be.add(1)),xe=v(y(1).sub(W).div(x(te(W),.001)),0,1),Se=se(x(y(1).sub(W.mul(W)),0)),Ce=ie(k(U.x,U.y,Se.mul(1.1))),we=x(ee(Ce,ie(k(-.42,.62,.66))),0).pow(70).mul(1.3),Te=w(.1,-.85,U.y),Ee=U.y.mul(-.5).add(.5).clamp(0,1),De=Ee.pow(1.6).mul(.32),Oe=Ee.oneMinus().mul(.2),ke=w(.74,.97,W).mul(Te.mul(.35).add(.32)),Ae=w(.58,.82,W).mul(w(.96,.84,W)).mul(Te).mul(.55),je=w(1.3,.95,b(U.sub(O(.1,-.32)))).mul(.16),Me=n.color,Ne=k(1).mul(we).add(Me.mul(De.add(Ae))),Pe=we.add(De).add(Oe).add(ke).add(Ae).clamp(0,1),Fe=S(je,Pe,xe);V.colorNode=le(Ne.mul(xe).div(x(Fe,.001)),Fe.mul(_e).mul(n.presence).mul(he));let G=new l(j,V);G.frustumCulled=!1,G.renderOrder=1;let Ie=de(),Le=new Float32Array(M*4),Re=new Float32Array(M*2),K=R([[`seg`,Le,4],[`wet`,Re,2]]),q=_(`seg`,`vec4`),ze=_(`wet`,`vec2`),Be=O(q.x,q.y),J=O(q.z,q.w).sub(Be),Ve=x(b(J),.001),Y=J.div(Ve),He=O(Y.y.negate(),Y.x),X=Be.add(J.mul(.5)).add(Y.mul(C.y.mul(Ve))).add(He.mul(C.x.mul(ze.x).mul(2))),Z=pe();Z.positionNode=k(d.x.add(X.x),d.y.sub(X.y),0);let Ue=D(C.x.mul(2)),We=D(S(.3,1,ne(re))),Ge=D(p.sub(ze.y)),Ke=y(1).sub(Ge.div(x(n.dry,.05))).clamp(0,1).pow(.7),qe=ce(Ie,O(Ue.mul(.5).add(.5),.5)),Je=qe.r.mul(Ke).mul(We).mul(n.trail.clamp(0,1)).mul(n.presence).mul(f(D(X)));Z.colorNode=le(k(qe.g),Je);let Ye=new l(K,Z);if(Ye.frustumCulled=!1,e.overlay.add(Ye,G),e.onDispose(()=>{j.dispose(),K.dispose(),V.dispose(),Z.dispose(),Ie.dispose()}),await e.compile(e.overlay),a.aborted)return;let Q=t.fire,Xe=!1,$=`still`;(o||getComputedStyle(r).position===`fixed`)&&e.onDispose(i.stage.hold(()=>$!==`still`));let Ze=(e,n)=>({width:e,height:n,scale:Math.max(t.scale,.1),speed:Math.max(t.speed,0),trail:t.trail,dry:Math.max(t.dry,.1),lifetime:Math.max(t.lifetime,0),merge:t.merge});return e=>{let n=i.stage.width.peek(),r=i.stage.height.peek(),[s,l,f,h]=o?[0,0,n,r]:[e.x,e.y,e.width,e.height];d.value.set(s-n/2,r/2-l,f,h);let g=Ze(f,h),_=()=>{t.motion===`thaw`?c.thaw(t.x*f,t.y*h,Math.max(0,Math.round(t.count)),t.duration):c.shower(Math.max(0,Math.round(t.count)),g)};Xe||(Xe=!0,t.trigger===`view`&&_()),t.trigger===`manual`&&t.fire!==Q&&(t.fire>Q&&_(),Q=t.fire);let v=t.motion===`rain`&&t.trigger===`view`;$=c.step(e.delta,g,v?Math.max(t.rate,0):0),p.value=c.time,me(c,g.lifetime??0,m,A,Le,Re),j.instanceCount=c.drops.length,K.instanceCount=c.laid;for(let e of[j,K])for(let t of Object.values(e.attributes))t.isInstancedBufferAttribute&&(t.needsUpdate=!0);fe.set(a,$===`moving`?u:$===`drying`?15:0)}}});function pe(){let e=new u({transparent:!0,depthTest:!1,depthWrite:!1});return e.forceSinglePass=!0,e}function R(e){let t=new f(1,1),n=new s;n.setIndex(t.getIndex()),n.setAttribute(`position`,t.getAttribute(`position`)),n.setAttribute(`uv`,t.getAttribute(`uv`)),t.dispose();for(let[t,r,i]of e){let e=new o(r,i);e.setUsage(a),n.setAttribute(t,e)}return n.instanceCount=0,n}function z(e,t=0){let n=e.running||e.fed>0?1:Math.min(1,Math.max(0,e.life)/1);return Math.min(n,B(e,t))}function B(e,t){return t<=0?1:Math.min(1,Math.max(0,(t-e.age)/Math.max(1,t*.3333333333333333)))}function me(e,t,n,r,i,a){e.drops.forEach((e,i)=>{n[i*4]=e.x,n[i*4+1]=e.y,n[i*4+2]=e.r,n[i*4+3]=z(e,t),r[i*2]=e.vy>0?Math.min(1.4,e.vy/260):0,r[i*2+1]=e.seed});let o=e.trails;for(let t=0;t<e.laid;t++){let e=t*6;i[t*4]=o[e],i[t*4+1]=o[e+1],i[t*4+2]=o[e+2],i[t*4+3]=o[e+3],a[t*2]=o[e+4],a[t*2+1]=o[e+5]}}export{F as FADE,ue as Glass,j as POOL,N as SLIDE,M as TRAILS,L as default,z as opacity,I as trailProfile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dev-CoKR705i.js";import{a as t,i as n,n as r,s as i,t as a}from"./points-3Fg6fQYz-YV7m16tF.js";import{a as o,l as s,u as c}from"./raster-Bf0CGQIc-CYX6ZFTt.js";import{i as l,n as u}from"./effect-DJHvQTKy.js";import{b as d,t as f}from"./kit-5IzkOXD0.js";import{CanvasTexture as p,DataTexture as m,Group as h,Mesh as g,MeshBasicNodeMaterial as _,NearestFilter as v,NoColorSpace as y,Vector2 as b,Vector4 as x}from"three/webgpu";import{abs as S,attribute as C,cos as w,cross as T,dot as E,exp as ee,float as D,floor as te,fwidth as O,length as ne,max as k,min as A,mix as j,normalize as re,positionGeometry as M,pow as N,sRGBTransferEOTF as ie,select as ae,sin as P,smoothstep as F,step as oe,texture as I,uniform as L,varying as R,vec2 as z,vec3 as B,vec4 as V}from"three/tsl";const H=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,U=(e,t,n)=>Math.floor((e-t)/n);function se(e,t,n){let[r,i,a,o]=e.frame,s=Math.max(.5,n.cell),c={count:0,home:/* @__PURE__ */ new Float32Array(4),ink:/* @__PURE__ */ new Float32Array(4),random:/* @__PURE__ */ new Float32Array(4),index:/* @__PURE__ */ new Uint32Array(1),cell:s,cols:1,rows:1,bounds:[0,0,0,0]};if(!t)return c;let{data:l,width:u,height:f}=t,p=u/a,m=f/o;for(let e=0;e<6;e++){let t=Math.max(1,Math.ceil(a/s)),h=Math.max(1,Math.ceil(o/s)),g=Int32Array.from({length:u},(e,n)=>Math.min(t-1,U(r+(n+.5)/p,r,s))),_=Int32Array.from({length:f},(e,t)=>Math.min(h-1,U(i+(t+.5)/m,i,s))),v=new Float64Array(t*h*5);for(let e=0;e<f;e++){let n=_[e]*t;for(let t=0;t<u;t++){let r=(e*u+t)*4,i=(n+g[t])*5,a=l[r+3];v[i+4]=v[i+4]+1,a&&(v[i]=v[i]+a,v[i+1]=v[i+1]+l[r]*a,v[i+2]=v[i+2]+l[r+1]*a,v[i+3]=v[i+3]+l[r+2]*a)}}let y=[];for(let e=0;e<t*h;e++){let t=v[e*5+4];t&&v[e*5]/(t*255)>=.02&&y.push(e)}if(!y.length)return c;if(y.length>n.max&&e<5){s*=Math.sqrt(y.length/n.max)*1.03;continue}let b=Math.min(y.length,n.max),x=new Float32Array(b*4),S=new Float32Array(b*4),C=new Float32Array(b*4),w=new Uint32Array(b),T=d(n.seed),E=[1/0,1/0,-1/0,-1/0];for(let e=0;e<b;e++){let n=y[e],a=n%t,o=Math.floor(n/t),c=r+(a+.5)*s,l=i+(o+.5)*s,u=n*5,d=v[u];x.set([c,l,0,Math.min(1,d/(v[u+4]*255))],e*4),S.set([H(v[u+1]/d/255),H(v[u+2]/d/255),H(v[u+3]/d/255),T()],e*4),C.set([T(),T(),T(),T()],e*4),w[e]=n,E[0]=Math.min(E[0],c-s/2),E[1]=Math.min(E[1],l-s/2),E[2]=Math.max(E[2],c+s/2),E[3]=Math.max(E[3],l+s/2)}return{count:b,home:x,ink:S,random:C,index:w,cell:s,cols:t,rows:h,bounds:E}}return c}const ce=`grainHome`,le=`grainInk`,ue=`grainRandom`,W=(()=>{let e=[-.45,.6,.66],t=Math.hypot(...e);return e.map(e=>e/t)})(),de=.5,fe=de+.5*W[2],pe={wind:{flow:1.6,spin:2.5,round:[.04,.32]},rise:{flow:2.4,spin:1.2,round:[.15,.6]},explode:{flow:2,spin:3.2,round:[2,3]}};function me(e,t,n){let r=w(n),i=P(n);return e.mul(r).add(T(t,e).mul(i)).add(t.mul(E(t,e).mul(r.oneMinus())))}function G(e,t){let n=d(e*7919+17),r=[1,2.1,4.3].map((e,t)=>{let r=n()*Math.PI*2,i=n()*Math.PI*2;return{frequency:e,weight:[1,.5,.25][t],direction:[Math.cos(r),Math.sin(r)],zDirection:[Math.cos(i),Math.sin(i)],phase:n()*Math.PI*2,zPhase:n()*Math.PI*2}}),i=[n()*6.28,n()*6.28],a=D(1).div(t);return e=>{let t=e.x.mul(a),n=e.y.mul(a),o=t.add(P(n.mul(1.7).add(i[0])).mul(.6)),s=n.add(P(t.mul(1.3).add(i[1])).mul(.6)),c=D(0),l=D(0),u=D(0);for(let e of r){let t=o.mul(e.direction[0]).add(s.mul(e.direction[1])).mul(e.frequency).add(e.phase),n=w(t).mul(e.weight);c=c.add(n.mul(e.direction[0])),l=l.add(n.mul(e.direction[1]));let r=o.mul(e.zDirection[0]).add(s.mul(e.zDirection[1])).mul(e.frequency).add(e.zPhase);u=u.add(P(r).mul(e.weight))}return B(l,c.negate(),u.mul(.6))}}function K(e){let t=C(ce,`vec4`),n=C(le,`vec4`),r=C(ue,`vec4`),[i,a,o,s,c]=[n.w,r.x,r.y,r.z,r.w],l=pe[e.motion],u=e.front.sub(t.z).div(e.span).clamp(0,1),d=oe(1e-4,u).mul(oe(u,.9999)).mul(e.calm.oneMinus()),f=B(t.x.sub(e.half.x),e.half.y.sub(t.y),0),p=e.reach.mul(a.mul(.9).add(.55)),m=B(0,1,0),h=B(e.way.x,e.way.y,0),g=o.mul(1.25).sub(.25),_=e=>ee(e.mul(-3.2)).oneMinus().div(1-Math.exp(-3.2)),v;if(e.motion===`rise`)v=t=>m.mul(p.mul(.9).mul(N(t,1.3))).add(h.mul(p.mul(.15).mul(t))).add(B(0,0,p.mul(.5).mul(e.depth).mul(g).mul(t)));else if(e.motion===`explode`){let t=f.xy.sub(z(e.middle.x.sub(e.half.x),e.half.y.sub(e.middle.y))),n=k(ne(t),e.em.mul(.5)),r=t.div(n),i=B(r.x.mul(.9).add(s.sub(.5).mul(.7)),r.y.mul(.9).add(c.sub(.5).mul(.7)),o.mul(.95).sub(.3).mul(e.depth));v=e=>i.mul(p.mul(_(e)).mul(s.mul(.6).add(.6))).sub(m.mul(p.mul(.25).mul(e).mul(e)))}else v=t=>h.mul(p.mul(N(t,1.6))).add(m.mul(p.mul(.16).mul(t).mul(t))).add(B(0,0,p.mul(.4).mul(e.depth).mul(g).mul(N(t,1.2))));let y=G(e.seed,e.em.mul(l.flow)),b=e.em.mul(e.motion===`explode`?.5:e.motion===`rise`?2:1.4).mul(e.turbulence).mul(s.mul(.8).add(.6)),x=B(0,0,0);for(let t=0;t<5;t++){let n=u.mul((t+.5)/5),r=y(f.add(v(n)).add(x)),i=F(0,.3,n);x=x.add(r.mul(B(1,1,e.depth)).mul(b.mul(i).mul(u).div(5)))}let S=f.add(v(u)).add(x),T=re(B(w(c.mul(6.2832)),P(c.mul(6.2832)),i.mul(2).sub(1))),E=u.mul(l.spin*6.2832).mul(i.mul(1.2).add(.4)),[te,O]=l.round,A=F(te,O,u),M=e.dot.mul(s.mul(.9).add(.55)),ie=e.motion===`explode`?e.cell.mul(j(D(1),D(.6),u)):j(e.cell,M,F(0,.8,u)),ae=a.mul(.3).add(.7);return{centre:S,progress:u,loose:d,axis:T,angle:E,size:ie,round:A,fade:F(ae.mul(.6),ae,u).oneMinus()}}function he(e){let t=e=>{let t=new p(e);return t.premultiplyAlpha=!0,t},n=t(e),r=[];return{read:e=>{let t=I(n,e);return r.push(t),t},set:e=>{let i=n;n=t(e);for(let e of r)e.value=n;i.dispose()},dispose:()=>n.dispose()}}const q=`dustBox`;function ge(e){let t=new Float32Array(Math.max(1,e.quads.length)*4);return e.quads.forEach((e,n)=>{t.set([e.x,e.y,e.width,e.height],n*4)}),n(e.quads.length,{[q]:[t,4]})}function _e(e,t,n,r,i,a){let o=C(q,`vec4`),s=M.xy.add(.5),c=o.x.add(s.x.mul(o.z)),l=o.y.add(s.y.oneMinus().mul(o.w)),u=new _({transparent:!0,depthTest:!1,depthWrite:!1});u.positionNode=B(c.sub(n.x),n.y.sub(l),0);let d=R(z(c.sub(r.x).div(r.z),l.sub(r.y).div(r.w).oneMinus())),f=R(z(c,l)),p=R(z(c.div(n.x.mul(2)),l.div(n.y.mul(2)).oneMinus())),m=t(d),h=ie(m.rgb.div(k(m.a,1e-4)));u.colorNode=V(h,m.a.mul(i(f)).mul(a(p.clamp(0,1))));let v=new g(ge(e),u);return v.frustumCulled=!1,v}const ve=(e,t)=>z(e.x.add(t.x).div(t.x.mul(2)),e.y.add(t.y).div(t.y.mul(2))).clamp(0,1);function ye(e,t,n){let r=C(ce,`vec4`),i=C(le,`vec4`),a=K(e),o=a.centre.z,s=S(o).mul(.006),c=a.size.add(s.mul(2)).add(2).mul(a.loose),l=M.xy.mul(c),u=me(B(l.x,l.y,0),a.axis,a.angle),d=new _({transparent:!0,depthTest:!1,depthWrite:!1});d.positionNode=a.centre.add(u);let f=me(B(0,0,1),a.axis,a.angle),p=ae(f.z.lessThan(0),f.negate(),f),m=B(...W),h=k(E(p,m),0).mul(.5).add(de).div(fe),g=re(m.add(B(0,0,1))),v=E(i.xyz,B(.2126,.7152,.0722)),y=N(k(E(p,g),0),60).mul(j(D(.12),D(.6),v.sqrt())).mul(F(.02,.12,a.progress)),b=o.div(400).clamp(-1,1),x=R(h.mul(b.max(0).mul(.15).add(1))),w=R(y),[T,ee,te,P]=[e.frame.x,e.frame.y,e.frame.z,e.frame.w],I=R(l),L=R(a.size),H=R(s),U=R(z(r.x.sub(T).div(te),r.y.sub(ee).div(P).oneMinus())),se=R(z(e.cell.div(te),e.cell.div(P))),ue=t(U.add(I.div(k(L,.001)).mul(se))),pe=ie(ue.rgb.div(k(ue.a,1e-4))),G=oe(S(I.x),L.mul(.5)).mul(oe(S(I.y),L.mul(.5))),he=ue.a.mul(G),q=ne(I).sub(L.mul(.5)),ge=k(O(q),H.mul(2)),_e=L.mul(L).div(L.mul(L).add(H.mul(H).mul(2))),ye=R(A(r.w.mul(e.cell.mul(e.cell)).div(k(a.size.mul(a.size).mul(.785),.001)),1)),be=D(.5).sub(q.div(k(ge,1e-4))).clamp(0,1).mul(ye).mul(_e),J=R(a.round),Y=j(pe,R(i.xyz),J).mul(x).add(B(1,.96,.88).mul(w)),xe=R(b.min(0).mul(.6).add(1)),Se=R(a.fade.mul(a.loose).mul(n(ve(a.centre,e.half))));return d.colorNode=V(Y,j(he,be,J).mul(Se).mul(xe).clamp(0,1)),d}function be(e,t){let n=C(ce,`vec4`),r=K(e),i=k(r.centre.z,0),a=r.size.add(i.mul(.05)),o=a.add(i.mul(.06)).add(2).mul(r.loose),s=M.xy.mul(o),c=r.centre.xy.add(z(-W[0]/W[2],-W[1]/W[2]).mul(i.mul(.5))),l=new _({transparent:!0,depthTest:!1,depthWrite:!1});l.positionNode=B(c.x.add(s.x),c.y.add(s.y),0);let u=R(s),d=R(a.mul(.5)),f=R(i.mul(.03).add(.5)),p=ne(u).sub(d),m=D(.5).sub(p.div(k(O(p),f.mul(2)))).clamp(0,1),h=r.size.div(a.add(i.mul(.06))),g=C(le,`vec4`),v=E(g.xyz,B(.2126,.7152,.0722)).sqrt(),y=F(2,40,i).mul(h.mul(h).max(.04)).mul(j(D(1),D(.3),v)),b=R(r.fade.mul(r.loose).mul(n.w).mul(y).mul(e.shadow).mul(.3).mul(t(ve(B(c.x,c.y,0),e.half))));return l.colorNode=V(B(0,0,0),m.mul(b)),l}const J={per:.02,min:1.4,max:2.2},Y={wind:1,rise:1.15,explode:2.8},xe=(e,t,n)=>Math.min(J.max,Math.max(J.min,t*J.per))*Y[e]/Math.sqrt(Math.max(n,.05)),Se=2e4,Ce={wind:.6,rise:.65,explode:.7},we={wind:1,rise:1,explode:.3},Te=.4,Ee=65535,De=/* @__PURE__ */ new WeakSet;function Oe(e,t,n,r,a){let o=i(a+13),[s,c,l,u]=e,d=(s+l)/2,f=(c+u)/2,p=1/Math.max(r*.7,4),m=(e,t)=>Math.min(1,Math.max(0,(o(e*p,t*p)-.5)*2.2+.5));if(t===`explode`){let e=Math.hypot(l-d,u-f)||1;return(t,n)=>Math.min(we.explode,Math.hypot(t-d,n-f)/e*.24+m(t,n)*.06)}let h=n*Math.PI/180,g=Math.cos(h),_=-Math.sin(h),v=[s*g+c*_,l*g+c*_,s*g+u*_,l*g+u*_],y=Math.min(...v),b=Math.max(...v)-y||1;return(e,t)=>Math.min(1,Math.max(0,(y+b-e*g-t*_)/b*.72+m(e,t)*.28))}function ke(e,t,n,r){return e===`rise`?Math.min(520,Math.max(90,n*1.6,r*2.6)):e===`explode`?Math.min(640,Math.max(100,t*.35,r*3.5)):Math.min(720,Math.max(100,t*.45,r*3))}const Ae=u({name:`dust`,params:{motion:l(`wind`,`rise`,`explode`),trigger:l(`scroll`,`click`,`view`),density:1,dot:1.6,duration:2.2,angle:15,turbulence:1,depth:1,shadow:.5,seed:1},rebuild:[`density`,`seed`],on:`:not(img, video, canvas, svg, input, textarea)`,presence:`custom`,bleed:600,quality:{low:{density:.6,shadow:0}},async setup(i){let{element:l,u,params:d,app:p,signal:_}=i,{stage:S}=p,{trigger:C,motion:w}=d,T=t=>{e&&p.log.warn(`dust: ${t}, the text stays as it is`,l)},E=i.quality===`low`?1:2,ee=Math.round(Se*a[i.quality]),D=c(l)??await o(l),O=D?void 0:s(l,`line`,E);if(_.aborted)return;let ne=e=>se(e,t(e),{cell:xe(w,r(e),d.density),max:ee,seed:d.seed}),A=O?ne(O):void 0;if(!O||!A?.count){D&&T(`${D} cannot be drawn`),i.showDom(!0);return}let re=Ce[w],M=L(0),N=L(0),ie=L(new b(1,0)),ae=L(new b),P=L(200),F=L(16),R=L(A.cell),B=L(new b(1,1)),V=L(new x(...O.frame)),H=u.size.mul(.5),U=e=>i.mask(e),W=k(M,u.presence.oneMinus()),de=W.mul(we[w]+re),fe=new m(/* @__PURE__ */ new Uint8Array(4),1,1),pe=[],me=(e,t,n)=>{let i=r(e),a=Oe(t.bounds,w,n,i,d.seed),o=new Uint8Array(t.cols*t.rows*4);for(let e=0;e<t.count;e++){let n=t.home[e*4],r=t.home[e*4+1],i=(t.ink[e*4+3]-.5)*.04,s=Math.round(Math.min(1,Math.max(0,a(n,r)+i))*Ee);t.home[e*4+2]=s/Ee;let c=t.index[e]*4;o[c]=s>>8,o[c+1]=s&255,o[c+3]=255}let s=new m(o,t.cols,t.rows);s.magFilter=s.minFilter=v,s.generateMipmaps=!1,s.colorSpace=y,s.needsUpdate=!0;let c=fe;fe=s;for(let e of pe)e.value=s;c.dispose();let[l,u,f,p]=t.bounds;ae.value.set((l+f)/2,(u+p)/2),R.value=t.cell,B.value.set(t.cols,t.rows),F.value=i,P.value=ke(w,f-l,p-u,i)},G=d.angle;me(O,A,G),i.onDispose(()=>fe.dispose());let K=he(O.canvas);i.onDispose(()=>K.dispose());let q=_e(O,K.read,H,V,e=>{let t=te(e.x.sub(V.x).div(R)),n=te(e.y.sub(V.y).div(R)),r=I(fe,z(t.add(.5).div(B.x),n.add(.5).div(B.y)));pe.push(r);let i=r,a=i.x.mul(65280).add(i.y.mul(255)).div(Ee);return j(oe(de,a),W.oneMinus(),N)},U),ve={motion:w,front:de,span:re,way:ie,middle:ae,reach:P,em:F,cell:R,dot:u.dot,turbulence:u.turbulence,depth:u.depth,shadow:u.shadow,calm:N,half:H,frame:V,seed:d.seed},J=e=>n(e.count,{[ce]:[e.home,4],[le]:[e.ink,4],[ue]:[e.random,4]}),Y=J(A),Ae=new g(Y,ye(ve,K.read,U)),je=new g(Y,be(ve,U));for(let e of[je,Ae])e.frustumCulled=!1;q.renderOrder=1,Ae.renderOrder=2;let Me=new h;if(Me.add(q,je,Ae),i.place(Me,{fit:`none`,replace:!0}),await i.compile(Me),_.aborted)return;let Ne=(e,t)=>{O=e,A=t,me(e,t,G);let n=Y;Y=J(t),Ae.geometry=je.geometry=Y,n.dispose();let r=q.geometry;q.geometry=ge(e),r.dispose(),K.set(e.canvas),V.value.set(...e.frame)},Pe=!0,Fe=e=>{Pe=e,i.showDom(e)},X=De.has(l),Ie=e=>{Me.visible=!e};Ie(X),Fe(!X);let Le,Re,ze=async()=>{Le=void 0;let e=await o(l);if(_.aborted)return;if(e&&e!==Re&&T(`${e} cannot be drawn`),Re=e,e){i.invalidate();return}let t=s(l,`line`,E),n=t&&ne(t);t&&n?.count&&(Ne(t,n),i.invalidate())},Be=()=>{if(Le?.(),Pe&&typeof requestIdleCallback==`function`){let e=requestIdleCallback(()=>void ze(),{timeout:1e3});Le=()=>cancelIdleCallback(e)}else{let e=setTimeout(()=>void ze(),150);Le=()=>clearTimeout(e)}};i.onDispose(()=>Le?.());let Ve=new MutationObserver(Be);Ve.observe(l,{characterData:!0,childList:!0,subtree:!0}),i.onDispose(()=>Ve.disconnect());let He=new ResizeObserver(()=>{let e=l.getBoundingClientRect().width;Math.abs(e-(O?.width??e))>.5&&Be()});He.observe(l),i.onDispose(()=>He.disconnect()),document.fonts?.addEventListener(`loadingdone`,Be,{signal:_});let Z=+!!X,Q=Z,$=!1,Ue=()=>{X||Q===1||(Q=1,l.setAttribute(`data-dio-dust`,`playing`),$=!0,i.invalidate())};return C===`click`&&(l.addEventListener(`click`,Ue,{signal:_}),l.addEventListener(`keydown`,e=>{e.key===`Enter`&&e.target===l&&!l.matches(`button, a[href]`)&&Ue()},{signal:_})),e=>{let t=i.params,n=e.reducedMotion;if(N.value=+!!n,je.visible=t.shadow>0,Re||n&&C!==`click`)return Fe(!0),$;t.angle!==G&&A&&O&&(G=t.angle,me(O,A,G),Y.getAttribute(ce).needsUpdate=!0);let r=G*Math.PI/180;ie.value.set(Math.cos(r),Math.sin(r));let a=S.height.peek(),o=e.y+(typeof scrollY==`number`?scrollY:0),s=Math.max(0,Math.min(a*.3,o-1)),c=Math.min(1,Math.max(0,(s-e.y)/(s+e.height*.5||1)));if(C===`view`&&(c>.2?Q=1:c<=0&&(Q=0),Q!==Z&&($=!0)),C===`scroll`)Z=c;else if(Z!==Q){let r=n?Te:Math.max(t.duration,.001)/(Q<Z?1.6:1);Z=f(Z,Q,e.delta/r)}else $=!1;return M.value=Z,C===`click`&&Z>=1&&!X&&(X=!0,De.add(l),$=!1,l.setAttribute(`data-dio-dust`,`done`),l.dispatchEvent(new CustomEvent(`dio:dust`,{bubbles:!0}))),Ie(X),Fe(!X&&Z<=0&&e.presence>=1),$}}});export{Te as CALM,Se as MAX_GRAINS,xe as cellSide,Ae as default,ke as reachOf,Oe as sweep};
|
|
1
|
+
import{t as e}from"./dev-CoKR705i.js";import{a as t,i as n,n as r,s as i,t as a}from"./points-3Fg6fQYz-Dp8jGvN3.js";import{a as o,l as s,u as c}from"./raster-Bf0CGQIc-CYX6ZFTt.js";import{i as l,n as u}from"./effect-DJHvQTKy.js";import{b as d,t as f}from"./kit-DIwHK01X.js";import{CanvasTexture as p,DataTexture as m,Group as h,Mesh as g,MeshBasicNodeMaterial as _,NearestFilter as v,NoColorSpace as y,Vector2 as b,Vector4 as x}from"three/webgpu";import{abs as S,attribute as C,cos as w,cross as T,dot as E,exp as ee,float as D,floor as te,fwidth as O,length as ne,max as k,min as A,mix as j,normalize as re,positionGeometry as M,pow as N,sRGBTransferEOTF as ie,select as ae,sin as P,smoothstep as F,step as oe,texture as I,uniform as L,varying as R,vec2 as z,vec3 as B,vec4 as V}from"three/tsl";const H=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,U=(e,t,n)=>Math.floor((e-t)/n);function se(e,t,n){let[r,i,a,o]=e.frame,s=Math.max(.5,n.cell),c={count:0,home:/* @__PURE__ */ new Float32Array(4),ink:/* @__PURE__ */ new Float32Array(4),random:/* @__PURE__ */ new Float32Array(4),index:/* @__PURE__ */ new Uint32Array(1),cell:s,cols:1,rows:1,bounds:[0,0,0,0]};if(!t)return c;let{data:l,width:u,height:f}=t,p=u/a,m=f/o;for(let e=0;e<6;e++){let t=Math.max(1,Math.ceil(a/s)),h=Math.max(1,Math.ceil(o/s)),g=Int32Array.from({length:u},(e,n)=>Math.min(t-1,U(r+(n+.5)/p,r,s))),_=Int32Array.from({length:f},(e,t)=>Math.min(h-1,U(i+(t+.5)/m,i,s))),v=new Float64Array(t*h*5);for(let e=0;e<f;e++){let n=_[e]*t;for(let t=0;t<u;t++){let r=(e*u+t)*4,i=(n+g[t])*5,a=l[r+3];v[i+4]=v[i+4]+1,a&&(v[i]=v[i]+a,v[i+1]=v[i+1]+l[r]*a,v[i+2]=v[i+2]+l[r+1]*a,v[i+3]=v[i+3]+l[r+2]*a)}}let y=[];for(let e=0;e<t*h;e++){let t=v[e*5+4];t&&v[e*5]/(t*255)>=.02&&y.push(e)}if(!y.length)return c;if(y.length>n.max&&e<5){s*=Math.sqrt(y.length/n.max)*1.03;continue}let b=Math.min(y.length,n.max),x=new Float32Array(b*4),S=new Float32Array(b*4),C=new Float32Array(b*4),w=new Uint32Array(b),T=d(n.seed),E=[1/0,1/0,-1/0,-1/0];for(let e=0;e<b;e++){let n=y[e],a=n%t,o=Math.floor(n/t),c=r+(a+.5)*s,l=i+(o+.5)*s,u=n*5,d=v[u];x.set([c,l,0,Math.min(1,d/(v[u+4]*255))],e*4),S.set([H(v[u+1]/d/255),H(v[u+2]/d/255),H(v[u+3]/d/255),T()],e*4),C.set([T(),T(),T(),T()],e*4),w[e]=n,E[0]=Math.min(E[0],c-s/2),E[1]=Math.min(E[1],l-s/2),E[2]=Math.max(E[2],c+s/2),E[3]=Math.max(E[3],l+s/2)}return{count:b,home:x,ink:S,random:C,index:w,cell:s,cols:t,rows:h,bounds:E}}return c}const ce=`grainHome`,le=`grainInk`,ue=`grainRandom`,W=(()=>{let e=[-.45,.6,.66],t=Math.hypot(...e);return e.map(e=>e/t)})(),de=.5,fe=de+.5*W[2],pe={wind:{flow:1.6,spin:2.5,round:[.04,.32]},rise:{flow:2.4,spin:1.2,round:[.15,.6]},explode:{flow:2,spin:3.2,round:[2,3]}};function me(e,t,n){let r=w(n),i=P(n);return e.mul(r).add(T(t,e).mul(i)).add(t.mul(E(t,e).mul(r.oneMinus())))}function G(e,t){let n=d(e*7919+17),r=[1,2.1,4.3].map((e,t)=>{let r=n()*Math.PI*2,i=n()*Math.PI*2;return{frequency:e,weight:[1,.5,.25][t],direction:[Math.cos(r),Math.sin(r)],zDirection:[Math.cos(i),Math.sin(i)],phase:n()*Math.PI*2,zPhase:n()*Math.PI*2}}),i=[n()*6.28,n()*6.28],a=D(1).div(t);return e=>{let t=e.x.mul(a),n=e.y.mul(a),o=t.add(P(n.mul(1.7).add(i[0])).mul(.6)),s=n.add(P(t.mul(1.3).add(i[1])).mul(.6)),c=D(0),l=D(0),u=D(0);for(let e of r){let t=o.mul(e.direction[0]).add(s.mul(e.direction[1])).mul(e.frequency).add(e.phase),n=w(t).mul(e.weight);c=c.add(n.mul(e.direction[0])),l=l.add(n.mul(e.direction[1]));let r=o.mul(e.zDirection[0]).add(s.mul(e.zDirection[1])).mul(e.frequency).add(e.zPhase);u=u.add(P(r).mul(e.weight))}return B(l,c.negate(),u.mul(.6))}}function K(e){let t=C(ce,`vec4`),n=C(le,`vec4`),r=C(ue,`vec4`),[i,a,o,s,c]=[n.w,r.x,r.y,r.z,r.w],l=pe[e.motion],u=e.front.sub(t.z).div(e.span).clamp(0,1),d=oe(1e-4,u).mul(oe(u,.9999)).mul(e.calm.oneMinus()),f=B(t.x.sub(e.half.x),e.half.y.sub(t.y),0),p=e.reach.mul(a.mul(.9).add(.55)),m=B(0,1,0),h=B(e.way.x,e.way.y,0),g=o.mul(1.25).sub(.25),_=e=>ee(e.mul(-3.2)).oneMinus().div(1-Math.exp(-3.2)),v;if(e.motion===`rise`)v=t=>m.mul(p.mul(.9).mul(N(t,1.3))).add(h.mul(p.mul(.15).mul(t))).add(B(0,0,p.mul(.5).mul(e.depth).mul(g).mul(t)));else if(e.motion===`explode`){let t=f.xy.sub(z(e.middle.x.sub(e.half.x),e.half.y.sub(e.middle.y))),n=k(ne(t),e.em.mul(.5)),r=t.div(n),i=B(r.x.mul(.9).add(s.sub(.5).mul(.7)),r.y.mul(.9).add(c.sub(.5).mul(.7)),o.mul(.95).sub(.3).mul(e.depth));v=e=>i.mul(p.mul(_(e)).mul(s.mul(.6).add(.6))).sub(m.mul(p.mul(.25).mul(e).mul(e)))}else v=t=>h.mul(p.mul(N(t,1.6))).add(m.mul(p.mul(.16).mul(t).mul(t))).add(B(0,0,p.mul(.4).mul(e.depth).mul(g).mul(N(t,1.2))));let y=G(e.seed,e.em.mul(l.flow)),b=e.em.mul(e.motion===`explode`?.5:e.motion===`rise`?2:1.4).mul(e.turbulence).mul(s.mul(.8).add(.6)),x=B(0,0,0);for(let t=0;t<5;t++){let n=u.mul((t+.5)/5),r=y(f.add(v(n)).add(x)),i=F(0,.3,n);x=x.add(r.mul(B(1,1,e.depth)).mul(b.mul(i).mul(u).div(5)))}let S=f.add(v(u)).add(x),T=re(B(w(c.mul(6.2832)),P(c.mul(6.2832)),i.mul(2).sub(1))),E=u.mul(l.spin*6.2832).mul(i.mul(1.2).add(.4)),[te,O]=l.round,A=F(te,O,u),M=e.dot.mul(s.mul(.9).add(.55)),ie=e.motion===`explode`?e.cell.mul(j(D(1),D(.6),u)):j(e.cell,M,F(0,.8,u)),ae=a.mul(.3).add(.7);return{centre:S,progress:u,loose:d,axis:T,angle:E,size:ie,round:A,fade:F(ae.mul(.6),ae,u).oneMinus()}}function he(e){let t=e=>{let t=new p(e);return t.premultiplyAlpha=!0,t},n=t(e),r=[];return{read:e=>{let t=I(n,e);return r.push(t),t},set:e=>{let i=n;n=t(e);for(let e of r)e.value=n;i.dispose()},dispose:()=>n.dispose()}}const q=`dustBox`;function ge(e){let t=new Float32Array(Math.max(1,e.quads.length)*4);return e.quads.forEach((e,n)=>{t.set([e.x,e.y,e.width,e.height],n*4)}),n(e.quads.length,{[q]:[t,4]})}function _e(e,t,n,r,i,a){let o=C(q,`vec4`),s=M.xy.add(.5),c=o.x.add(s.x.mul(o.z)),l=o.y.add(s.y.oneMinus().mul(o.w)),u=new _({transparent:!0,depthTest:!1,depthWrite:!1});u.positionNode=B(c.sub(n.x),n.y.sub(l),0);let d=R(z(c.sub(r.x).div(r.z),l.sub(r.y).div(r.w).oneMinus())),f=R(z(c,l)),p=R(z(c.div(n.x.mul(2)),l.div(n.y.mul(2)).oneMinus())),m=t(d),h=ie(m.rgb.div(k(m.a,1e-4)));u.colorNode=V(h,m.a.mul(i(f)).mul(a(p.clamp(0,1))));let v=new g(ge(e),u);return v.frustumCulled=!1,v}const ve=(e,t)=>z(e.x.add(t.x).div(t.x.mul(2)),e.y.add(t.y).div(t.y.mul(2))).clamp(0,1);function ye(e,t,n){let r=C(ce,`vec4`),i=C(le,`vec4`),a=K(e),o=a.centre.z,s=S(o).mul(.006),c=a.size.add(s.mul(2)).add(2).mul(a.loose),l=M.xy.mul(c),u=me(B(l.x,l.y,0),a.axis,a.angle),d=new _({transparent:!0,depthTest:!1,depthWrite:!1});d.positionNode=a.centre.add(u);let f=me(B(0,0,1),a.axis,a.angle),p=ae(f.z.lessThan(0),f.negate(),f),m=B(...W),h=k(E(p,m),0).mul(.5).add(de).div(fe),g=re(m.add(B(0,0,1))),v=E(i.xyz,B(.2126,.7152,.0722)),y=N(k(E(p,g),0),60).mul(j(D(.12),D(.6),v.sqrt())).mul(F(.02,.12,a.progress)),b=o.div(400).clamp(-1,1),x=R(h.mul(b.max(0).mul(.15).add(1))),w=R(y),[T,ee,te,P]=[e.frame.x,e.frame.y,e.frame.z,e.frame.w],I=R(l),L=R(a.size),H=R(s),U=R(z(r.x.sub(T).div(te),r.y.sub(ee).div(P).oneMinus())),se=R(z(e.cell.div(te),e.cell.div(P))),ue=t(U.add(I.div(k(L,.001)).mul(se))),pe=ie(ue.rgb.div(k(ue.a,1e-4))),G=oe(S(I.x),L.mul(.5)).mul(oe(S(I.y),L.mul(.5))),he=ue.a.mul(G),q=ne(I).sub(L.mul(.5)),ge=k(O(q),H.mul(2)),_e=L.mul(L).div(L.mul(L).add(H.mul(H).mul(2))),ye=R(A(r.w.mul(e.cell.mul(e.cell)).div(k(a.size.mul(a.size).mul(.785),.001)),1)),be=D(.5).sub(q.div(k(ge,1e-4))).clamp(0,1).mul(ye).mul(_e),J=R(a.round),Y=j(pe,R(i.xyz),J).mul(x).add(B(1,.96,.88).mul(w)),xe=R(b.min(0).mul(.6).add(1)),Se=R(a.fade.mul(a.loose).mul(n(ve(a.centre,e.half))));return d.colorNode=V(Y,j(he,be,J).mul(Se).mul(xe).clamp(0,1)),d}function be(e,t){let n=C(ce,`vec4`),r=K(e),i=k(r.centre.z,0),a=r.size.add(i.mul(.05)),o=a.add(i.mul(.06)).add(2).mul(r.loose),s=M.xy.mul(o),c=r.centre.xy.add(z(-W[0]/W[2],-W[1]/W[2]).mul(i.mul(.5))),l=new _({transparent:!0,depthTest:!1,depthWrite:!1});l.positionNode=B(c.x.add(s.x),c.y.add(s.y),0);let u=R(s),d=R(a.mul(.5)),f=R(i.mul(.03).add(.5)),p=ne(u).sub(d),m=D(.5).sub(p.div(k(O(p),f.mul(2)))).clamp(0,1),h=r.size.div(a.add(i.mul(.06))),g=C(le,`vec4`),v=E(g.xyz,B(.2126,.7152,.0722)).sqrt(),y=F(2,40,i).mul(h.mul(h).max(.04)).mul(j(D(1),D(.3),v)),b=R(r.fade.mul(r.loose).mul(n.w).mul(y).mul(e.shadow).mul(.3).mul(t(ve(B(c.x,c.y,0),e.half))));return l.colorNode=V(B(0,0,0),m.mul(b)),l}const J={per:.02,min:1.4,max:2.2},Y={wind:1,rise:1.15,explode:2.8},xe=(e,t,n)=>Math.min(J.max,Math.max(J.min,t*J.per))*Y[e]/Math.sqrt(Math.max(n,.05)),Se=2e4,Ce={wind:.6,rise:.65,explode:.7},we={wind:1,rise:1,explode:.3},Te=.4,Ee=65535,De=/* @__PURE__ */ new WeakSet;function Oe(e,t,n,r,a){let o=i(a+13),[s,c,l,u]=e,d=(s+l)/2,f=(c+u)/2,p=1/Math.max(r*.7,4),m=(e,t)=>Math.min(1,Math.max(0,(o(e*p,t*p)-.5)*2.2+.5));if(t===`explode`){let e=Math.hypot(l-d,u-f)||1;return(t,n)=>Math.min(we.explode,Math.hypot(t-d,n-f)/e*.24+m(t,n)*.06)}let h=n*Math.PI/180,g=Math.cos(h),_=-Math.sin(h),v=[s*g+c*_,l*g+c*_,s*g+u*_,l*g+u*_],y=Math.min(...v),b=Math.max(...v)-y||1;return(e,t)=>Math.min(1,Math.max(0,(y+b-e*g-t*_)/b*.72+m(e,t)*.28))}function ke(e,t,n,r){return e===`rise`?Math.min(520,Math.max(90,n*1.6,r*2.6)):e===`explode`?Math.min(640,Math.max(100,t*.35,r*3.5)):Math.min(720,Math.max(100,t*.45,r*3))}const Ae=u({name:`dust`,params:{motion:l(`wind`,`rise`,`explode`),trigger:l(`scroll`,`click`,`view`),density:1,dot:1.6,duration:2.2,angle:15,turbulence:1,depth:1,shadow:.5,seed:1},rebuild:[`density`,`seed`],on:`:not(img, video, canvas, svg, input, textarea)`,presence:`custom`,bleed:600,quality:{low:{density:.6,shadow:0}},async setup(i){let{element:l,u,params:d,app:p,signal:_}=i,{stage:S}=p,{trigger:C,motion:w}=d,T=t=>{e&&p.log.warn(`dust: ${t}, the text stays as it is`,l)},E=i.quality===`low`?1:2,ee=Math.round(Se*a[i.quality]),D=c(l)??await o(l),O=D?void 0:s(l,`line`,E);if(_.aborted)return;let ne=e=>se(e,t(e),{cell:xe(w,r(e),d.density),max:ee,seed:d.seed}),A=O?ne(O):void 0;if(!O||!A?.count){D&&T(`${D} cannot be drawn`),i.showDom(!0);return}let re=Ce[w],M=L(0),N=L(0),ie=L(new b(1,0)),ae=L(new b),P=L(200),F=L(16),R=L(A.cell),B=L(new b(1,1)),V=L(new x(...O.frame)),H=u.size.mul(.5),U=e=>i.mask(e),W=k(M,u.presence.oneMinus()),de=W.mul(we[w]+re),fe=new m(/* @__PURE__ */ new Uint8Array(4),1,1),pe=[],me=(e,t,n)=>{let i=r(e),a=Oe(t.bounds,w,n,i,d.seed),o=new Uint8Array(t.cols*t.rows*4);for(let e=0;e<t.count;e++){let n=t.home[e*4],r=t.home[e*4+1],i=(t.ink[e*4+3]-.5)*.04,s=Math.round(Math.min(1,Math.max(0,a(n,r)+i))*Ee);t.home[e*4+2]=s/Ee;let c=t.index[e]*4;o[c]=s>>8,o[c+1]=s&255,o[c+3]=255}let s=new m(o,t.cols,t.rows);s.magFilter=s.minFilter=v,s.generateMipmaps=!1,s.colorSpace=y,s.needsUpdate=!0;let c=fe;fe=s;for(let e of pe)e.value=s;c.dispose();let[l,u,f,p]=t.bounds;ae.value.set((l+f)/2,(u+p)/2),R.value=t.cell,B.value.set(t.cols,t.rows),F.value=i,P.value=ke(w,f-l,p-u,i)},G=d.angle;me(O,A,G),i.onDispose(()=>fe.dispose());let K=he(O.canvas);i.onDispose(()=>K.dispose());let q=_e(O,K.read,H,V,e=>{let t=te(e.x.sub(V.x).div(R)),n=te(e.y.sub(V.y).div(R)),r=I(fe,z(t.add(.5).div(B.x),n.add(.5).div(B.y)));pe.push(r);let i=r,a=i.x.mul(65280).add(i.y.mul(255)).div(Ee);return j(oe(de,a),W.oneMinus(),N)},U),ve={motion:w,front:de,span:re,way:ie,middle:ae,reach:P,em:F,cell:R,dot:u.dot,turbulence:u.turbulence,depth:u.depth,shadow:u.shadow,calm:N,half:H,frame:V,seed:d.seed},J=e=>n(e.count,{[ce]:[e.home,4],[le]:[e.ink,4],[ue]:[e.random,4]}),Y=J(A),Ae=new g(Y,ye(ve,K.read,U)),je=new g(Y,be(ve,U));for(let e of[je,Ae])e.frustumCulled=!1;q.renderOrder=1,Ae.renderOrder=2;let Me=new h;if(Me.add(q,je,Ae),i.place(Me,{fit:`none`,replace:!0}),await i.compile(Me),_.aborted)return;let Ne=(e,t)=>{O=e,A=t,me(e,t,G);let n=Y;Y=J(t),Ae.geometry=je.geometry=Y,n.dispose();let r=q.geometry;q.geometry=ge(e),r.dispose(),K.set(e.canvas),V.value.set(...e.frame)},Pe=!0,Fe=e=>{Pe=e,i.showDom(e)},X=De.has(l),Ie=e=>{Me.visible=!e};Ie(X),Fe(!X);let Le,Re,ze=async()=>{Le=void 0;let e=await o(l);if(_.aborted)return;if(e&&e!==Re&&T(`${e} cannot be drawn`),Re=e,e){i.invalidate();return}let t=s(l,`line`,E),n=t&&ne(t);t&&n?.count&&(Ne(t,n),i.invalidate())},Be=()=>{if(Le?.(),Pe&&typeof requestIdleCallback==`function`){let e=requestIdleCallback(()=>void ze(),{timeout:1e3});Le=()=>cancelIdleCallback(e)}else{let e=setTimeout(()=>void ze(),150);Le=()=>clearTimeout(e)}};i.onDispose(()=>Le?.());let Ve=new MutationObserver(Be);Ve.observe(l,{characterData:!0,childList:!0,subtree:!0}),i.onDispose(()=>Ve.disconnect());let He=new ResizeObserver(()=>{let e=l.getBoundingClientRect().width;Math.abs(e-(O?.width??e))>.5&&Be()});He.observe(l),i.onDispose(()=>He.disconnect()),document.fonts?.addEventListener(`loadingdone`,Be,{signal:_});let Z=+!!X,Q=Z,$=!1,Ue=()=>{X||Q===1||(Q=1,l.setAttribute(`data-dio-dust`,`playing`),$=!0,i.invalidate())};return C===`click`&&(l.addEventListener(`click`,Ue,{signal:_}),l.addEventListener(`keydown`,e=>{e.key===`Enter`&&e.target===l&&!l.matches(`button, a[href]`)&&Ue()},{signal:_})),e=>{let t=i.params,n=e.reducedMotion;if(N.value=+!!n,je.visible=t.shadow>0,Re||n&&C!==`click`)return Fe(!0),$;t.angle!==G&&A&&O&&(G=t.angle,me(O,A,G),Y.getAttribute(ce).needsUpdate=!0);let r=G*Math.PI/180;ie.value.set(Math.cos(r),Math.sin(r));let a=S.height.peek(),o=e.y+(typeof scrollY==`number`?scrollY:0),s=Math.max(0,Math.min(a*.3,o-1)),c=Math.min(1,Math.max(0,(s-e.y)/(s+e.height*.5||1)));if(C===`view`&&(c>.2?Q=1:c<=0&&(Q=0),Q!==Z&&($=!0)),C===`scroll`)Z=c;else if(Z!==Q){let r=n?Te:Math.max(t.duration,.001)/(Q<Z?1.6:1);Z=f(Z,Q,e.delta/r)}else $=!1;return M.value=Z,C===`click`&&Z>=1&&!X&&(X=!0,De.add(l),$=!1,l.setAttribute(`data-dio-dust`,`done`),l.dispatchEvent(new CustomEvent(`dio:dust`,{bubbles:!0}))),Ie(X),Fe(!X&&Z<=0&&e.presence>=1),$}}});export{Te as CALM,Se as MAX_GRAINS,xe as cellSide,Ae as default,ke as reachOf,Oe as sweep};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dev-CoKR705i.js";import{a as t,l as n,t as r,u as i}from"./raster-Bf0CGQIc-CYX6ZFTt.js";import{n as a,r as o,t as s}from"./sdf-CQr4aUMC-C64-EhF4.js";import{t as c}from"./paint-XpIPgN9_-BgvP0P5g.js";import{i as l,n as u}from"./effect-DJHvQTKy.js";import{a as d,b as f,o as p}from"./kit-5IzkOXD0.js";import{t as m}from"./dist-_6VGLQBA.js";import{BufferAttribute as h,BufferGeometry as g,CanvasTexture as _,Color as v,DataTexture as y,DataUtils as b,HalfFloatType as x,LinearFilter as S,Mesh as ee,MeshBasicNodeMaterial as te,RGBAFormat as ne,RepeatWrapping as C,SRGBColorSpace as w,Vector3 as re,Vector4 as ie}from"three/webgpu";import{cameraPosition as ae,clamp as T,dot as E,float as D,fract as O,length as k,max as A,min as j,mix as M,normalize as N,positionGeometry as oe,positionWorld as se,pow as P,screenCoordinate as ce,smoothstep as le,sqrt as ue,texture as de,uniform as F,varying as fe,vec2 as I,vec3 as L,vec4 as pe}from"three/tsl";const me={paper:{base:`#f3efe6`,relief:.2,spec:.035,shine:6,metal:!1,wrap:.25,pressed:.95,tint:0},leather:{base:`#6a4330`,relief:.32,spec:.12,shine:14,metal:!1,wrap:.1,pressed:.55,tint:.5},metal:{base:`#b4b8bf`,relief:.16,spec:.42,shine:60,metal:!0,wrap:0,pressed:.9,tint:.7},stone:{base:`#9a968f`,relief:.45,spec:.07,shine:14,metal:!1,wrap:.05,pressed:.9,tint:0},plaster:{base:`#ece8e1`,relief:.5,spec:.025,shine:5,metal:!1,wrap:.2,pressed:.94,tint:0}},R=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*r*(r*(r*6-15)+10)},he=e=>e*e*e*(e*(e*6-15)+10);function ge(e,t,n){let r=new Float32Array(e*t);for(let e=0;e<r.length;e++)r[e]=n()*2-1;return{values:r,nx:e,ny:t}}function z(e,t,n){let r=t/512*e.nx,i=n/512*e.ny,a=Math.floor(r),o=Math.floor(i),s=he(r-a),c=he(i-o),l=(a%e.nx+e.nx)%e.nx,u=(o%e.ny+e.ny)%e.ny,d=(l+1)%e.nx,f=(u+1)%e.ny,p=e.values[u*e.nx+l],m=e.values[u*e.nx+d],h=e.values[f*e.nx+l],g=e.values[f*e.nx+d];return p+(m-p)*s+(h-p)*c+(p-m-h+g)*s*c}function B(e,t,n){for(let[r,i,a]of n){let n=ge(r,i,t);for(let t=0;t<512;t++)for(let r=0;r<512;r++){let i=t*512+r;e[i]=e[i]+z(n,r,t)*a}}}const V=(e,t)=>(t%512+512)%512*512+(e%512+512)%512;function H(e,t,n){let r=/* @__PURE__ */ new Float32Array(262144);for(let e=0;e<xe;e++){let e=n()*512,t=n()*512,i=n()*Math.PI*2,a=(n()-.5)*.08,o=5+n()**2*26,s=.4+n()*.4,c=.2+n()*.5;for(let n=0;n<o;n+=.5){e+=Math.cos(i)*.5,t+=Math.sin(i)*.5,i+=a;let n=Math.round(e),o=Math.round(t);for(let i=-2;i<=2;i++)for(let a=-2;a<=2;a++){let l=(n+a-e)**2+(o+i-t)**2,u=c*Math.exp(-l/(2*s*s)),d=V(n+a,o+i);u>r[d]&&(r[d]=u)}}}let i=/* @__PURE__ */ new Float32Array(262144);B(i,n,[[64,64,.25],[128,128,.4],[256,256,.3]]);let a=/* @__PURE__ */ new Float32Array(262144);B(a,n,[[8,8,.6],[16,16,.3],[32,32,.15]]);for(let n=0;n<e.length;n++)e[n]=r[n]*.45+i[n]+a[n]*.3,t[n]=1+a[n]*.02+r[n]*.01}function U(e,t,n){let r=512/96,i=/* @__PURE__ */ new Float32Array(18432);for(let e=0;e<9216;e++)i[e*2]=n(),i[e*2+1]=n();let a=/* @__PURE__ */ new Float32Array(262144);B(a,n,[[64,64,.5],[128,128,.3]]);let o=/* @__PURE__ */ new Float32Array(262144);B(o,n,[[16,16,1],[32,32,.5]]);let s=/* @__PURE__ */ new Float32Array(262144);B(s,n,[[6,6,1],[12,12,.5]]);for(let n=0;n<512;n++)for(let c=0;c<512;c++){let l=o[n*512+c]*.45,u=c/r+l,d=n/r-l*.7,f=Math.floor(u),p=Math.floor(d),m=9,h=9,g=0;for(let e=-1;e<=1;e++)for(let t=-1;t<=1;t++){let n=f+t,r=p+e,a=(r%96+96)%96*96+(n%96+96)%96,o=n+i[a*2]*.8+.1,s=r+i[a*2+1]*.8+.1,c=Math.hypot(o-u,s-d);c<m?(h=m,m=c,g=a):c<h&&(h=c)}let _=R(0,.6,h-m)*(.6+.4*i[g*2]),v=n*512+c,y=1-R(0,.25,h-m),b=a[v];e[v]=_*.8+b*.2+s[v]*.25,t[v]=1-y*.08+b*.04+s[v]*.05}}function _e(e,t,n){B(e,n,[[3,512,1],[7,512,.6],[16,256,.35],[2,128,.25]]);let r=/* @__PURE__ */ new Float32Array(262144);B(r,n,[[4,4,.5],[8,8,.25]]);for(let n=0;n<e.length;n++)t[n]=1+e[n]*.05+r[n]*.04}function ve(e,t,n){B(e,n,[[32,32,.35],[96,96,.3],[256,256,.3]]);let r=/* @__PURE__ */ new Float32Array(262144);B(r,n,[[6,6,.6],[14,14,.35]]);for(let e=0;e<t.length;e++)t[e]=1+r[e]*.06;for(let r=0;r<Se;r++){let r=n()*512,i=n()*512,a=.5+n()**3*2.2,o=n()<.62?-(.18+n()*.35):.12+n()*.22,s=n()<.25?-.6:0;for(let n=-3;n<=3;n++)for(let c=-3;c<=3;c++){let l=Math.hypot(Math.round(r)+c-r,Math.round(i)+n-i),u=Math.min(1,Math.max(0,a+.5-l));if(u<=0)continue;let d=V(Math.round(r)+c,Math.round(i)+n);t[d]=t[d]+o*u,e[d]=e[d]+s*u}}}function ye(e,t,n){let r=/* @__PURE__ */ new Float32Array(262144);B(r,n,[[4,6,1.6],[8,10,.8],[16,16,.3]]),B(e,n,[[128,128,.25],[256,256,.2]]);for(let n=0;n<e.length;n++)e[n]=e[n]+r[n]*2.2,t[n]=1+r[n]*.02;for(let r=0;r<W;r++){let r=Math.round(n()*512),i=Math.round(n()*512),a=.6+n()*1.3;for(let n=-2;n<=2;n++)for(let o=-2;o<=2;o++){let s=Math.min(1,Math.max(0,a+.5-Math.hypot(o,n))),c=V(r+o,i+n);e[c]=e[c]-s*.7,t[c]=t[c]-s*.05}}}const be={paper:H,leather:U,metal:_e,stone:ve,plaster:ye},xe=1800,Se=9e3,W=500,Ce=/* @__PURE__ */ new Map;function we(e){let t=Ce.get(e);if(t)return t;let n=/* @__PURE__ */ new Float32Array(262144),r=(/* @__PURE__ */ new Float32Array(262144)).fill(1);be[e](n,r,f(24301+e.length*7919));let i=0,a=0;for(let e of n)i+=e,a+=e*e;let o=i/n.length,s=Math.sqrt(Math.max(1e-9,a/n.length-o*o)),c=me[e].relief/s,l=b.toHalfFloat,u=/* @__PURE__ */ new Uint16Array(1048576);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let i=e*512+t,a=i*4,o=(n[V(t+1,e)]-n[V(t-1,e)])*.5*c,s=(n[V(t,e+1)]-n[V(t,e-1)])*.5*c;u[a]=l(Math.max(-8,Math.min(8,o))),u[a+1]=l(Math.max(-8,Math.min(8,s))),u[a+2]=l(Math.max(.3,Math.min(1.7,r[i]))),u[a+3]=l(0)}return Ce.set(e,u),u}function Te(e,t,n){let r=Math.max(.35,n);if(e===`emboss`||e===`stamp`)return R(-.45*r,1.05*r,t);if(e===`deboss`)return-R(-.25*r,.85*r,t);let i=Math.exp(-(((t+1.9*r)/r)**2));return-.62*R(-1.1*r,.1*r,t)+.035*i}function Ee(e,t,n){let[r,i,a,o,s]=n,c=Math.abs(e-(r+a/2))-(a/2-s),l=Math.abs(t-(i+o/2))-(o/2-s);return-(Math.hypot(Math.max(c,0),Math.max(l,0))+Math.min(Math.max(c,l),0)-s)}function De(e,t,n,i){let[c,l,u,d]=e.frame,p=Math.max(1,...e.quads.map(e=>e.em)),m=t===`stamp`&&u<(d+p*.6)*2.4,h=Math.ceil(t===`stamp`?m?Math.max(u-d,0)/2+p*.8:p*.8:p*.45)+4,g=Math.min(2,i,r/Math.max(u+2*h,d+2*h)),_=Math.max(1,Math.ceil((u+2*h)*g)),v=Math.max(1,Math.ceil((d+2*h)*g)),y=c-h,x=l-h,S=document.createElement(`canvas`);S.width=_,S.height=v;let ee=e.canvas.width/Math.max(1e-6,u);S.getContext(`2d`)?.drawImage(e.canvas,h*g,h*g,e.canvas.width/ee*g,e.canvas.height/ee*g);let te=a(S,_,v),ne=o(te,_,v),C=[...e.quads].sort((e,t)=>e.y-t.y),w=new Float32Array(v);for(let e=0;e<v;e++){let t=x+(e+.5)/g,n=p,r=1/0;for(let e of C){let i=t<e.y?e.y-t:t>e.y+e.height?t-e.y-e.height:0;i<r&&(r=i,n=e.em)}w[e]=n}let re=[0,0,0,0,0],ie;if(t===`stamp`){let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let i=0;i<v;i++)for(let a=0;a<_;a++)te[i*_+a]>.3&&(e=Math.min(e,a),n=Math.max(n,a+1),t=Math.min(t,i),r=Math.max(r,i+1));Number.isFinite(e)||([e,t,n,r]=[h*g,h*g,_-h*g,v-h*g]);let i=(n-e)/g+p*.72,a=(r-t)/g+p*.6,o=y+(e+n)/2/g,s=x+(t+r)/2/g;m&&(i=Math.max(i,a)+p*.2,a=i),re=[o-i/2,s-a/2,i,a,m?i/2:Math.min(a/2,i/2,p*.38)];let[c,l]=re,u=ge(9,9,f(1441));ie=(e,t)=>z(u,(e-c)/Math.max(1,i)*512,(t-l)/Math.max(1,a)*512)}let ae=new Float32Array(_*v);for(let e=0;e<v;e++){let r=w[e],i=Math.max(0,n)*r*(t===`stamp`?1.6:1),a=x+(e+.5)/g;for(let n=0;n<_;n++){let o=e*_+n,s=Te(t,-ne[o]/g,i),c=s*r;if(t===`stamp`){let e=y+(n+.5)/g,t=Ee(e,a,re)+(ie?.(e,a)??0)*p*.035;c=(R(-.05*p,.07*p,t)*.32+Math.exp(-(((t-.12*p)/(.045*p))**2))*.6+s*.62)*p}ae[o]=c}}let T=Math.max(0,n)*p*g,E=s(ae,_,v,Math.max(.5,T*.12)),D=s(E,_,v,Math.max(1,p*.06*g)),O=new Uint16Array(_*v*4),k=0,A=b.toHalfFloat;for(let e=0;e<v;e++){let t=Math.max(0,e-1)*_,n=Math.min(v-1,e+1)*_,r=e*_;for(let e=0;e<_;e++){let i=r+e,a=r+Math.max(0,e-1),o=r+Math.min(_-1,e+1),s=i*4;O[s]=A((E[o]-E[a])*g/2),O[s+1]=A((E[n+e]-E[t+e])*g/2),O[s+2]=A(E[i]),k=Math.max(k,E[i]),O[s+3]=A(Math.max(0,D[i]-E[i]))}}return{data:O,width:_,height:v,frame:[y,x,_/g,v/g],em:p,pad:re,top:k}}const Oe=22,ke=.12,Ae=Math.PI/180,je=.42,Me=.75;function Ne(e,t){let n=getComputedStyle(t),r=e.trim();for(let e=0;e<8;e++){let e=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.*))?\)$/is.exec(r);if(!e)break;r=n.getPropertyValue(e[1]).trim()||(e[2]??``).trim()}if(!r||r.toLowerCase()===`currentcolor`){let e=n.getPropertyValue(`-webkit-text-fill-color`);r=e&&!/^(transparent|rgba\(.*,\s*0\))$/.test(e)?e:n.color}return m(r)}function Pe(e){let t=getComputedStyle(e).backgroundColor??``;return c(t)>=.5?m(t):void 0}function Fe(e){for(let t=e.parentElement;t;t=t.parentElement){let e=Pe(t);if(e)return e}return`#ffffff`}function Ie(e,t,n,r,i){let a=Math.max(t,n,240),o=a*.55,s=e*Ae,c=Math.max(-o,Math.min(o,(i/2-r)*.45));return[Math.sin(s)*o,-Math.cos(s)*o+c,Math.min(700,Math.max(140,a*.45))]}function Le(e,t,n,r){let i=Math.max(n,r,240)*.9+160,a=Math.hypot(e,t);if(a<1e-6)return[0,0];let o=i*Math.tanh(a/i)/a;return[e*o,t*o]}function Re(e){let t=new _(e);return t.premultiplyAlpha=!0,t.colorSpace=w,t.generateMipmaps=!1,t.minFilter=S,t.magFilter=S,t}function ze(e,t,n,r){let i=new y(e,t,n,ne,x);return i.minFilter=S,i.magFilter=S,i.generateMipmaps=!1,r&&(i.wrapS=C,i.wrapT=C),i.needsUpdate=!0,i}function Be(e,t){if(t)return e.canvas;let n=document.createElement(`canvas`);n.width=e.canvas.width,n.height=e.canvas.height;let r=n.getContext(`2d`);if(!r)return n;let i=e.canvas.width/Math.max(1e-6,e.frame[2]);for(let t of e.quads){if(t.em>=22)continue;let a=Math.max(0,Math.floor((t.y-e.frame[1])*i)),o=Math.min(n.height-a,Math.ceil(t.height*i)+1);o>0&&r.drawImage(e.canvas,0,a,n.width,o,0,a,n.width,o)}return n}function Ve(){let e=new g;return e.setIndex([0,2,1,2,3,1]),e.setAttribute(`position`,new h(new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]),3)),e}const He=/* @__PURE__ */ new WeakMap,Ue=u({name:`emboss`,params:{style:l(`emboss`,`deboss`,`letterpress`,`stamp`),material:l(`paper`,`leather`,`metal`,`stone`,`plaster`),depth:.05,bevel:.03,light:315,follow:1,grain:1,color:``},on:`:not(img, video, canvas, svg, input, textarea)`,bleed:60,quality:{},animate:{fps:e=>He.get(e.signal)?.()??0},async setup(r){let{element:a,u:o,params:s,app:c,signal:l}=r,{stage:u}=c,f=r.quality===`low`?1:2,m=r.quality===`low`?8:16,h=i(a),g=(h===`text-shadow`?void 0:h)??await t(a),_=g?void 0:n(a,`line`,f);if(l.aborted)return;if(!_?.quads.length){g&&e&&c.log.warn(`emboss: ${g} cannot be drawn, the text stays as it is`,a),r.showDom(!0);return}let y=s.style,b=me[s.material],x=s.color.trim(),S=x?Ne(x,a):void 0;x&&!S&&e&&c.log.warn(`emboss: "${x}" is not a color, left out`,a);let ne=getComputedStyle(a).backgroundImage;e&&ne&&ne!==`none`&&c.log.warn(`emboss: a background image is not drawn, only the background color`,a);let C=y===`letterpress`||y===`stamp`||!!S,w=De(_,y,r.params.bevel,f),R=r.params.bevel,he=()=>Pe(a),ge=he(),z=F(new ie(..._.frame)),B=F(new ie(...w.frame)),V=F(new re(0,-400,400)),H=F(+!!ge),U=F(new v(ge??Fe(a))),_e=F(new v(S??Ne(``,a)??`#222222`)),ve=F(+!!S),ye=F(w.em),be=F(w.top),xe=F(1),Se=o.size.mul(.5),W=L(Se.x.add(V.x),Se.y.add(V.y),V.z),Ce=M(j(B.x,0),D(0),H),Te=M(j(B.y,0),D(0),H),Ee=M(A(B.x.add(B.z),o.size.x),o.size.x,H),Oe=M(A(B.y.add(B.w),o.size.y),o.size.y,H),Ae=oe.xy.add(.5),Ue=Ce.add(Ae.x.mul(Ee.sub(Ce))),We=Te.add(Ae.y.oneMinus().mul(Oe.sub(Te))),Ge=new te({transparent:!0,depthTest:!1,depthWrite:!1});Ge.positionNode=L(Ue.sub(Se.x),Se.y.sub(We),0);let G=fe(I(Ue,We)),Ke=ze(w.data,w.width,w.height,!1),qe=ze(we(s.material),512,512,!0),Je=Re(Be(_,C)),Ye=[],Xe=e=>{let t=de(Ke,I(e.x.sub(B.x).div(B.z),e.y.sub(B.y).div(B.w)));return Ye.push(t),t},K=Xe(G),q=A(o.depth,0),Ze=K.z.mul(q),Qe=de(qe,G.div(512)),$e=de(qe,G.div(2406.4).add(I(.37,.61))),J=de(Je,I(G.x.sub(z.x).div(z.z),G.y.sub(z.y).div(z.w).oneMinus())),et=K.z.div(ye),tt=le(.08,.5,et.negate()),nt=y===`stamp`?le(.1,.26,et):D(0),rt=T(k(I(K.x,K.y)).mul(q),0,2),it=M(T(J.a.mul(.6).add(nt.mul(.3)),0,1),D(1),H),Y=T(o.grain,0,3).mul(tt.mul(.45).oneMinus(),it);y===`letterpress`&&(Y=Y.mul(rt.mul(.8).add(1))),y===`stamp`&&(Y=Y.mul(M(1,.12,nt)));let at=K.x.mul(q).add(Qe.x.mul(Y)),ot=K.y.mul(q).add(Qe.y.mul(Y)),st=N(L(at.negate(),ot,1)),ct=L(W.x.sub(G.x),G.y.sub(W.y),W.z.sub(Ze)),lt=N(ct),ut=b.wrap,dt=T(E(st,lt).add(ut).div(1+ut),0,1),ft=N(L(W.x.sub(G.x),G.y.sub(W.y),W.z)),pt=T(ft.z.add(ut).div(1+ut),0,1),mt=I(W.x.sub(G.x),W.y.sub(G.y)),ht=A(k(mt),.001),gt=mt.div(ht),_t=W.z.sub(Ze).div(ht),vt=j(j(ht,ye.mul(.7)),A(be.mul(q).sub(Ze),0).div(A(_t,.001)).add(.5)),yt=O(O(ce.x.mul(.06711056).add(ce.y.mul(.00583715))).mul(52.9829189)),bt=D(0);for(let e=0;e<m;e++){let t=vt.mul(P(D(e+1).sub(yt).div(m),1.5)),n=Xe(G.add(gt.mul(t))).z.mul(q).sub(Ze.add(_t.mul(t)));bt=A(bt,le(0,t.mul(.16).add(.35),n))}let xt=bt.mul(.88).oneMinus(),St=T(K.w.mul(q).div(ye.mul(.03)),0,1).mul(.4).oneMinus(),Ct=N(ae.sub(se)),wt=N(lt.add(Ct)),Tt=A(E(st,wt),0),Et=le(0,.15,E(st,lt)),X;if(b.metal){let e=N(L(1,0,0).sub(st.mul(st.x))),t=E(e,wt);X=P(ue(A(t.mul(t).oneMinus(),0)),b.shine).mul(b.spec).add(P(Tt,20).mul(.08))}else X=P(Tt,b.shine).mul(b.spec);y===`stamp`&&(X=M(X,P(Tt,70).mul(.6).add(P(Tt,9).mul(.07)),nt)),X=X.mul(xt,Et);let Dt=N(ft.add(Ct)),Ot=b.metal?D(0):P(A(Dt.z,0),b.shine).mul(b.spec),kt=Qe.z.sub(1).add($e.z.sub(1).mul(.6)).mul(T(o.grain,0,3)).add(1),At=M(U,P(U,L(1.3)),b.tint),jt=M(U,At.mul(b.pressed),tt).mul(kt),Mt=J.a,Nt=J.rgb.div(A(Mt,.001)),Pt=M(Nt,_e,ve),Ft=y===`letterpress`?T(Qe.z.sub(1).mul(1.5).add(.97).add(rt.mul(.05)),0,1):D(1),It=y===`stamp`?nt:Mt.mul(Ft),Lt=y===`stamp`?_e.mul(M(.9,1.06,$e.z)):Pt.mul(M(1,Qe.z,.4)),Rt=M(jt,Lt,It),zt=D(je).mul(St).add(dt.mul(Me,xt,M(1,St,.5))).mul(xe,b.metal?.85:1),Bt=D(je).add(pt.mul(Me)).mul(xe),Vt=M(L(1),U.div(A(U.x,A(U.y,U.z)).max(.05)),b.tint),Ht=Rt.mul(zt).add(Vt.mul(X)),Ut=zt.div(A(Bt,.001)),Wt=j(Ut,1),Gt=T(Ut.sub(1).mul(1.2),0,.7).add(A(X.sub(Ot),0)).clamp(0,1),Kt=Wt.mul(Gt.oneMinus()),qt=D(1).sub(It.oneMinus().mul(Kt)),Jt=Lt.mul(It,Kt).add(Gt).div(A(qt,1e-4)),Yt=I(G.x.div(o.size.x),G.y.div(o.size.y).oneMinus()),Xt=I(.5,.5).div(A(o.size,I(1,1))),Zt=r.mask(T(Yt,Xt,Xt.oneMinus()));Ge.colorNode=pe(M(Jt,Ht,H).add(p()),M(qt,D(1),H).clamp(0,1).mul(Zt));let Qt=new ee(Ve(),Ge);if(Qt.frustumCulled=!1,r.onDispose(()=>{(Ye[0]?.value)?.dispose(),qe.dispose(),J.value.dispose()}),r.place(Qt,{fit:`none`,replace:!0}),await r.compile(Qt),l.aborted)return;let $t=(e,t)=>{let n=Ye[0]?.value,i=ze(t.data,t.width,t.height,!1);for(let e of Ye)e.value=i;n?.dispose();let o=J.value;J.value=Re(Be(e,C)),o.dispose(),z.value.set(...e.frame),B.value.set(...t.frame),ye.value=t.em,be.value=t.top;let s=he();H.value=+!!s,U.value.set(s??Fe(a)),S||_e.value.set(Ne(``,a)??`#222222`),_=e,r.invalidate()},en,tn=async()=>{if(en=void 0,await t(a)||l.aborted)return;let e=n(a,`line`,f);e?.quads.length&&(R=r.params.bevel,$t(e,De(e,y,R,f)))},nn=()=>{clearTimeout(en),en=setTimeout(()=>void tn(),150)};r.onDispose(()=>clearTimeout(en));let rn=new MutationObserver(nn);rn.observe(a,{characterData:!0,childList:!0,subtree:!0}),r.onDispose(()=>rn.disconnect());let an=new ResizeObserver(()=>{let e=a.getBoundingClientRect().width;Math.abs(e-(_?.width??e))>.5&&nn()});an.observe(a),r.onDispose(()=>an.disconnect()),document.fonts?.addEventListener(`loadingdone`,nn,{signal:l});let Z,on=e=>{e.pointerType!==`touch`&&(Z={x:e.clientX,y:e.clientY},r.params.follow>0&&!u.reducedMotion.peek()&&r.invalidate())},sn=()=>{Z&&(Z=void 0,r.invalidate())};addEventListener(`pointermove`,on,{passive:!0,signal:l}),document.documentElement.addEventListener(`pointerleave`,sn,{signal:l}),addEventListener(`blur`,sn,{signal:l});let cn=0;He.set(l,()=>cn);let Q=0,$=0,ln=!1;return e=>{let t=r.params;Math.abs(t.bevel-R)>.001&&!en&&(R=t.bevel,nn());let n=e.reducedMotion,i=Math.min(e.delta,.1),a=e.width,o=e.height,s=u.height.peek()||o,c=e.y+o/2,[l,f,p]=Ie(t.light,a,o,n?s/2:c,s),m=l,h=f,g=n?0:Math.min(1,Math.max(0,t.follow));if(g>0&&Z){let[t,n]=Le(Z.x-(e.x+a/2),Z.y-c,a,o);m+=(t-l)*g,h+=(n-f)*g}!ln||n?(Q=m,$=h,ln=!0):(Q=d(Q,m,ke,i),$=d($,h,ke,i));let _=Math.abs(Q-m)>.5||Math.abs($-h)>.5;_||(Q=m,$=h),V.value.set(Q,$,p);let[v,y]=Ie(t.light,a,o,s/2,s),x=p/Math.hypot(v,y,p);xe.value=1/(je+Me*Math.min(1,(x+b.wrap)/(1+b.wrap))),cn=_?60:0}}});export{Oe as SMALL,Pe as backgroundOf,Ue as default,Le as reachOf,Ie as rest};
|
|
1
|
+
import{t as e}from"./dev-CoKR705i.js";import{a as t,l as n,t as r,u as i}from"./raster-Bf0CGQIc-CYX6ZFTt.js";import{n as a,r as o,t as s}from"./sdf-CQr4aUMC-C64-EhF4.js";import{t as c}from"./paint-XpIPgN9_-CgDq0G_v.js";import{i as l,n as u}from"./effect-DJHvQTKy.js";import{a as d,b as f,o as p}from"./kit-DIwHK01X.js";import{t as m}from"./dist-C8ZH4c0R.js";import{BufferAttribute as h,BufferGeometry as g,CanvasTexture as _,Color as v,DataTexture as y,DataUtils as b,HalfFloatType as x,LinearFilter as S,Mesh as ee,MeshBasicNodeMaterial as te,RGBAFormat as ne,RepeatWrapping as C,SRGBColorSpace as w,Vector3 as re,Vector4 as ie}from"three/webgpu";import{cameraPosition as ae,clamp as T,dot as E,float as D,fract as O,length as k,max as A,min as j,mix as M,normalize as N,positionGeometry as oe,positionWorld as se,pow as P,screenCoordinate as ce,smoothstep as le,sqrt as ue,texture as de,uniform as F,varying as fe,vec2 as I,vec3 as L,vec4 as pe}from"three/tsl";const me={paper:{base:`#f3efe6`,relief:.2,spec:.035,shine:6,metal:!1,wrap:.25,pressed:.95,tint:0},leather:{base:`#6a4330`,relief:.32,spec:.12,shine:14,metal:!1,wrap:.1,pressed:.55,tint:.5},metal:{base:`#b4b8bf`,relief:.16,spec:.42,shine:60,metal:!0,wrap:0,pressed:.9,tint:.7},stone:{base:`#9a968f`,relief:.45,spec:.07,shine:14,metal:!1,wrap:.05,pressed:.9,tint:0},plaster:{base:`#ece8e1`,relief:.5,spec:.025,shine:5,metal:!1,wrap:.2,pressed:.94,tint:0}},R=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*r*(r*(r*6-15)+10)},he=e=>e*e*e*(e*(e*6-15)+10);function ge(e,t,n){let r=new Float32Array(e*t);for(let e=0;e<r.length;e++)r[e]=n()*2-1;return{values:r,nx:e,ny:t}}function z(e,t,n){let r=t/512*e.nx,i=n/512*e.ny,a=Math.floor(r),o=Math.floor(i),s=he(r-a),c=he(i-o),l=(a%e.nx+e.nx)%e.nx,u=(o%e.ny+e.ny)%e.ny,d=(l+1)%e.nx,f=(u+1)%e.ny,p=e.values[u*e.nx+l],m=e.values[u*e.nx+d],h=e.values[f*e.nx+l],g=e.values[f*e.nx+d];return p+(m-p)*s+(h-p)*c+(p-m-h+g)*s*c}function B(e,t,n){for(let[r,i,a]of n){let n=ge(r,i,t);for(let t=0;t<512;t++)for(let r=0;r<512;r++){let i=t*512+r;e[i]=e[i]+z(n,r,t)*a}}}const V=(e,t)=>(t%512+512)%512*512+(e%512+512)%512;function H(e,t,n){let r=/* @__PURE__ */ new Float32Array(262144);for(let e=0;e<xe;e++){let e=n()*512,t=n()*512,i=n()*Math.PI*2,a=(n()-.5)*.08,o=5+n()**2*26,s=.4+n()*.4,c=.2+n()*.5;for(let n=0;n<o;n+=.5){e+=Math.cos(i)*.5,t+=Math.sin(i)*.5,i+=a;let n=Math.round(e),o=Math.round(t);for(let i=-2;i<=2;i++)for(let a=-2;a<=2;a++){let l=(n+a-e)**2+(o+i-t)**2,u=c*Math.exp(-l/(2*s*s)),d=V(n+a,o+i);u>r[d]&&(r[d]=u)}}}let i=/* @__PURE__ */ new Float32Array(262144);B(i,n,[[64,64,.25],[128,128,.4],[256,256,.3]]);let a=/* @__PURE__ */ new Float32Array(262144);B(a,n,[[8,8,.6],[16,16,.3],[32,32,.15]]);for(let n=0;n<e.length;n++)e[n]=r[n]*.45+i[n]+a[n]*.3,t[n]=1+a[n]*.02+r[n]*.01}function U(e,t,n){let r=512/96,i=/* @__PURE__ */ new Float32Array(18432);for(let e=0;e<9216;e++)i[e*2]=n(),i[e*2+1]=n();let a=/* @__PURE__ */ new Float32Array(262144);B(a,n,[[64,64,.5],[128,128,.3]]);let o=/* @__PURE__ */ new Float32Array(262144);B(o,n,[[16,16,1],[32,32,.5]]);let s=/* @__PURE__ */ new Float32Array(262144);B(s,n,[[6,6,1],[12,12,.5]]);for(let n=0;n<512;n++)for(let c=0;c<512;c++){let l=o[n*512+c]*.45,u=c/r+l,d=n/r-l*.7,f=Math.floor(u),p=Math.floor(d),m=9,h=9,g=0;for(let e=-1;e<=1;e++)for(let t=-1;t<=1;t++){let n=f+t,r=p+e,a=(r%96+96)%96*96+(n%96+96)%96,o=n+i[a*2]*.8+.1,s=r+i[a*2+1]*.8+.1,c=Math.hypot(o-u,s-d);c<m?(h=m,m=c,g=a):c<h&&(h=c)}let _=R(0,.6,h-m)*(.6+.4*i[g*2]),v=n*512+c,y=1-R(0,.25,h-m),b=a[v];e[v]=_*.8+b*.2+s[v]*.25,t[v]=1-y*.08+b*.04+s[v]*.05}}function _e(e,t,n){B(e,n,[[3,512,1],[7,512,.6],[16,256,.35],[2,128,.25]]);let r=/* @__PURE__ */ new Float32Array(262144);B(r,n,[[4,4,.5],[8,8,.25]]);for(let n=0;n<e.length;n++)t[n]=1+e[n]*.05+r[n]*.04}function ve(e,t,n){B(e,n,[[32,32,.35],[96,96,.3],[256,256,.3]]);let r=/* @__PURE__ */ new Float32Array(262144);B(r,n,[[6,6,.6],[14,14,.35]]);for(let e=0;e<t.length;e++)t[e]=1+r[e]*.06;for(let r=0;r<Se;r++){let r=n()*512,i=n()*512,a=.5+n()**3*2.2,o=n()<.62?-(.18+n()*.35):.12+n()*.22,s=n()<.25?-.6:0;for(let n=-3;n<=3;n++)for(let c=-3;c<=3;c++){let l=Math.hypot(Math.round(r)+c-r,Math.round(i)+n-i),u=Math.min(1,Math.max(0,a+.5-l));if(u<=0)continue;let d=V(Math.round(r)+c,Math.round(i)+n);t[d]=t[d]+o*u,e[d]=e[d]+s*u}}}function ye(e,t,n){let r=/* @__PURE__ */ new Float32Array(262144);B(r,n,[[4,6,1.6],[8,10,.8],[16,16,.3]]),B(e,n,[[128,128,.25],[256,256,.2]]);for(let n=0;n<e.length;n++)e[n]=e[n]+r[n]*2.2,t[n]=1+r[n]*.02;for(let r=0;r<W;r++){let r=Math.round(n()*512),i=Math.round(n()*512),a=.6+n()*1.3;for(let n=-2;n<=2;n++)for(let o=-2;o<=2;o++){let s=Math.min(1,Math.max(0,a+.5-Math.hypot(o,n))),c=V(r+o,i+n);e[c]=e[c]-s*.7,t[c]=t[c]-s*.05}}}const be={paper:H,leather:U,metal:_e,stone:ve,plaster:ye},xe=1800,Se=9e3,W=500,Ce=/* @__PURE__ */ new Map;function we(e){let t=Ce.get(e);if(t)return t;let n=/* @__PURE__ */ new Float32Array(262144),r=(/* @__PURE__ */ new Float32Array(262144)).fill(1);be[e](n,r,f(24301+e.length*7919));let i=0,a=0;for(let e of n)i+=e,a+=e*e;let o=i/n.length,s=Math.sqrt(Math.max(1e-9,a/n.length-o*o)),c=me[e].relief/s,l=b.toHalfFloat,u=/* @__PURE__ */ new Uint16Array(1048576);for(let e=0;e<512;e++)for(let t=0;t<512;t++){let i=e*512+t,a=i*4,o=(n[V(t+1,e)]-n[V(t-1,e)])*.5*c,s=(n[V(t,e+1)]-n[V(t,e-1)])*.5*c;u[a]=l(Math.max(-8,Math.min(8,o))),u[a+1]=l(Math.max(-8,Math.min(8,s))),u[a+2]=l(Math.max(.3,Math.min(1.7,r[i]))),u[a+3]=l(0)}return Ce.set(e,u),u}function Te(e,t,n){let r=Math.max(.35,n);if(e===`emboss`||e===`stamp`)return R(-.45*r,1.05*r,t);if(e===`deboss`)return-R(-.25*r,.85*r,t);let i=Math.exp(-(((t+1.9*r)/r)**2));return-.62*R(-1.1*r,.1*r,t)+.035*i}function Ee(e,t,n){let[r,i,a,o,s]=n,c=Math.abs(e-(r+a/2))-(a/2-s),l=Math.abs(t-(i+o/2))-(o/2-s);return-(Math.hypot(Math.max(c,0),Math.max(l,0))+Math.min(Math.max(c,l),0)-s)}function De(e,t,n,i){let[c,l,u,d]=e.frame,p=Math.max(1,...e.quads.map(e=>e.em)),m=t===`stamp`&&u<(d+p*.6)*2.4,h=Math.ceil(t===`stamp`?m?Math.max(u-d,0)/2+p*.8:p*.8:p*.45)+4,g=Math.min(2,i,r/Math.max(u+2*h,d+2*h)),_=Math.max(1,Math.ceil((u+2*h)*g)),v=Math.max(1,Math.ceil((d+2*h)*g)),y=c-h,x=l-h,S=document.createElement(`canvas`);S.width=_,S.height=v;let ee=e.canvas.width/Math.max(1e-6,u);S.getContext(`2d`)?.drawImage(e.canvas,h*g,h*g,e.canvas.width/ee*g,e.canvas.height/ee*g);let te=a(S,_,v),ne=o(te,_,v),C=[...e.quads].sort((e,t)=>e.y-t.y),w=new Float32Array(v);for(let e=0;e<v;e++){let t=x+(e+.5)/g,n=p,r=1/0;for(let e of C){let i=t<e.y?e.y-t:t>e.y+e.height?t-e.y-e.height:0;i<r&&(r=i,n=e.em)}w[e]=n}let re=[0,0,0,0,0],ie;if(t===`stamp`){let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let i=0;i<v;i++)for(let a=0;a<_;a++)te[i*_+a]>.3&&(e=Math.min(e,a),n=Math.max(n,a+1),t=Math.min(t,i),r=Math.max(r,i+1));Number.isFinite(e)||([e,t,n,r]=[h*g,h*g,_-h*g,v-h*g]);let i=(n-e)/g+p*.72,a=(r-t)/g+p*.6,o=y+(e+n)/2/g,s=x+(t+r)/2/g;m&&(i=Math.max(i,a)+p*.2,a=i),re=[o-i/2,s-a/2,i,a,m?i/2:Math.min(a/2,i/2,p*.38)];let[c,l]=re,u=ge(9,9,f(1441));ie=(e,t)=>z(u,(e-c)/Math.max(1,i)*512,(t-l)/Math.max(1,a)*512)}let ae=new Float32Array(_*v);for(let e=0;e<v;e++){let r=w[e],i=Math.max(0,n)*r*(t===`stamp`?1.6:1),a=x+(e+.5)/g;for(let n=0;n<_;n++){let o=e*_+n,s=Te(t,-ne[o]/g,i),c=s*r;if(t===`stamp`){let e=y+(n+.5)/g,t=Ee(e,a,re)+(ie?.(e,a)??0)*p*.035;c=(R(-.05*p,.07*p,t)*.32+Math.exp(-(((t-.12*p)/(.045*p))**2))*.6+s*.62)*p}ae[o]=c}}let T=Math.max(0,n)*p*g,E=s(ae,_,v,Math.max(.5,T*.12)),D=s(E,_,v,Math.max(1,p*.06*g)),O=new Uint16Array(_*v*4),k=0,A=b.toHalfFloat;for(let e=0;e<v;e++){let t=Math.max(0,e-1)*_,n=Math.min(v-1,e+1)*_,r=e*_;for(let e=0;e<_;e++){let i=r+e,a=r+Math.max(0,e-1),o=r+Math.min(_-1,e+1),s=i*4;O[s]=A((E[o]-E[a])*g/2),O[s+1]=A((E[n+e]-E[t+e])*g/2),O[s+2]=A(E[i]),k=Math.max(k,E[i]),O[s+3]=A(Math.max(0,D[i]-E[i]))}}return{data:O,width:_,height:v,frame:[y,x,_/g,v/g],em:p,pad:re,top:k}}const Oe=22,ke=.12,Ae=Math.PI/180,je=.42,Me=.75;function Ne(e,t){let n=getComputedStyle(t),r=e.trim();for(let e=0;e<8;e++){let e=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.*))?\)$/is.exec(r);if(!e)break;r=n.getPropertyValue(e[1]).trim()||(e[2]??``).trim()}if(!r||r.toLowerCase()===`currentcolor`){let e=n.getPropertyValue(`-webkit-text-fill-color`);r=e&&!/^(transparent|rgba\(.*,\s*0\))$/.test(e)?e:n.color}return m(r)}function Pe(e){let t=getComputedStyle(e).backgroundColor??``;return c(t)>=.5?m(t):void 0}function Fe(e){for(let t=e.parentElement;t;t=t.parentElement){let e=Pe(t);if(e)return e}return`#ffffff`}function Ie(e,t,n,r,i){let a=Math.max(t,n,240),o=a*.55,s=e*Ae,c=Math.max(-o,Math.min(o,(i/2-r)*.45));return[Math.sin(s)*o,-Math.cos(s)*o+c,Math.min(700,Math.max(140,a*.45))]}function Le(e,t,n,r){let i=Math.max(n,r,240)*.9+160,a=Math.hypot(e,t);if(a<1e-6)return[0,0];let o=i*Math.tanh(a/i)/a;return[e*o,t*o]}function Re(e){let t=new _(e);return t.premultiplyAlpha=!0,t.colorSpace=w,t.generateMipmaps=!1,t.minFilter=S,t.magFilter=S,t}function ze(e,t,n,r){let i=new y(e,t,n,ne,x);return i.minFilter=S,i.magFilter=S,i.generateMipmaps=!1,r&&(i.wrapS=C,i.wrapT=C),i.needsUpdate=!0,i}function Be(e,t){if(t)return e.canvas;let n=document.createElement(`canvas`);n.width=e.canvas.width,n.height=e.canvas.height;let r=n.getContext(`2d`);if(!r)return n;let i=e.canvas.width/Math.max(1e-6,e.frame[2]);for(let t of e.quads){if(t.em>=22)continue;let a=Math.max(0,Math.floor((t.y-e.frame[1])*i)),o=Math.min(n.height-a,Math.ceil(t.height*i)+1);o>0&&r.drawImage(e.canvas,0,a,n.width,o,0,a,n.width,o)}return n}function Ve(){let e=new g;return e.setIndex([0,2,1,2,3,1]),e.setAttribute(`position`,new h(new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]),3)),e}const He=/* @__PURE__ */ new WeakMap,Ue=u({name:`emboss`,params:{style:l(`emboss`,`deboss`,`letterpress`,`stamp`),material:l(`paper`,`leather`,`metal`,`stone`,`plaster`),depth:.05,bevel:.03,light:315,follow:1,grain:1,color:``},on:`:not(img, video, canvas, svg, input, textarea)`,bleed:60,quality:{},animate:{fps:e=>He.get(e.signal)?.()??0},async setup(r){let{element:a,u:o,params:s,app:c,signal:l}=r,{stage:u}=c,f=r.quality===`low`?1:2,m=r.quality===`low`?8:16,h=i(a),g=(h===`text-shadow`?void 0:h)??await t(a),_=g?void 0:n(a,`line`,f);if(l.aborted)return;if(!_?.quads.length){g&&e&&c.log.warn(`emboss: ${g} cannot be drawn, the text stays as it is`,a),r.showDom(!0);return}let y=s.style,b=me[s.material],x=s.color.trim(),S=x?Ne(x,a):void 0;x&&!S&&e&&c.log.warn(`emboss: "${x}" is not a color, left out`,a);let ne=getComputedStyle(a).backgroundImage;e&&ne&&ne!==`none`&&c.log.warn(`emboss: a background image is not drawn, only the background color`,a);let C=y===`letterpress`||y===`stamp`||!!S,w=De(_,y,r.params.bevel,f),R=r.params.bevel,he=()=>Pe(a),ge=he(),z=F(new ie(..._.frame)),B=F(new ie(...w.frame)),V=F(new re(0,-400,400)),H=F(+!!ge),U=F(new v(ge??Fe(a))),_e=F(new v(S??Ne(``,a)??`#222222`)),ve=F(+!!S),ye=F(w.em),be=F(w.top),xe=F(1),Se=o.size.mul(.5),W=L(Se.x.add(V.x),Se.y.add(V.y),V.z),Ce=M(j(B.x,0),D(0),H),Te=M(j(B.y,0),D(0),H),Ee=M(A(B.x.add(B.z),o.size.x),o.size.x,H),Oe=M(A(B.y.add(B.w),o.size.y),o.size.y,H),Ae=oe.xy.add(.5),Ue=Ce.add(Ae.x.mul(Ee.sub(Ce))),We=Te.add(Ae.y.oneMinus().mul(Oe.sub(Te))),Ge=new te({transparent:!0,depthTest:!1,depthWrite:!1});Ge.positionNode=L(Ue.sub(Se.x),Se.y.sub(We),0);let G=fe(I(Ue,We)),Ke=ze(w.data,w.width,w.height,!1),qe=ze(we(s.material),512,512,!0),Je=Re(Be(_,C)),Ye=[],Xe=e=>{let t=de(Ke,I(e.x.sub(B.x).div(B.z),e.y.sub(B.y).div(B.w)));return Ye.push(t),t},K=Xe(G),q=A(o.depth,0),Ze=K.z.mul(q),Qe=de(qe,G.div(512)),$e=de(qe,G.div(2406.4).add(I(.37,.61))),J=de(Je,I(G.x.sub(z.x).div(z.z),G.y.sub(z.y).div(z.w).oneMinus())),et=K.z.div(ye),tt=le(.08,.5,et.negate()),nt=y===`stamp`?le(.1,.26,et):D(0),rt=T(k(I(K.x,K.y)).mul(q),0,2),it=M(T(J.a.mul(.6).add(nt.mul(.3)),0,1),D(1),H),Y=T(o.grain,0,3).mul(tt.mul(.45).oneMinus(),it);y===`letterpress`&&(Y=Y.mul(rt.mul(.8).add(1))),y===`stamp`&&(Y=Y.mul(M(1,.12,nt)));let at=K.x.mul(q).add(Qe.x.mul(Y)),ot=K.y.mul(q).add(Qe.y.mul(Y)),st=N(L(at.negate(),ot,1)),ct=L(W.x.sub(G.x),G.y.sub(W.y),W.z.sub(Ze)),lt=N(ct),ut=b.wrap,dt=T(E(st,lt).add(ut).div(1+ut),0,1),ft=N(L(W.x.sub(G.x),G.y.sub(W.y),W.z)),pt=T(ft.z.add(ut).div(1+ut),0,1),mt=I(W.x.sub(G.x),W.y.sub(G.y)),ht=A(k(mt),.001),gt=mt.div(ht),_t=W.z.sub(Ze).div(ht),vt=j(j(ht,ye.mul(.7)),A(be.mul(q).sub(Ze),0).div(A(_t,.001)).add(.5)),yt=O(O(ce.x.mul(.06711056).add(ce.y.mul(.00583715))).mul(52.9829189)),bt=D(0);for(let e=0;e<m;e++){let t=vt.mul(P(D(e+1).sub(yt).div(m),1.5)),n=Xe(G.add(gt.mul(t))).z.mul(q).sub(Ze.add(_t.mul(t)));bt=A(bt,le(0,t.mul(.16).add(.35),n))}let xt=bt.mul(.88).oneMinus(),St=T(K.w.mul(q).div(ye.mul(.03)),0,1).mul(.4).oneMinus(),Ct=N(ae.sub(se)),wt=N(lt.add(Ct)),Tt=A(E(st,wt),0),Et=le(0,.15,E(st,lt)),X;if(b.metal){let e=N(L(1,0,0).sub(st.mul(st.x))),t=E(e,wt);X=P(ue(A(t.mul(t).oneMinus(),0)),b.shine).mul(b.spec).add(P(Tt,20).mul(.08))}else X=P(Tt,b.shine).mul(b.spec);y===`stamp`&&(X=M(X,P(Tt,70).mul(.6).add(P(Tt,9).mul(.07)),nt)),X=X.mul(xt,Et);let Dt=N(ft.add(Ct)),Ot=b.metal?D(0):P(A(Dt.z,0),b.shine).mul(b.spec),kt=Qe.z.sub(1).add($e.z.sub(1).mul(.6)).mul(T(o.grain,0,3)).add(1),At=M(U,P(U,L(1.3)),b.tint),jt=M(U,At.mul(b.pressed),tt).mul(kt),Mt=J.a,Nt=J.rgb.div(A(Mt,.001)),Pt=M(Nt,_e,ve),Ft=y===`letterpress`?T(Qe.z.sub(1).mul(1.5).add(.97).add(rt.mul(.05)),0,1):D(1),It=y===`stamp`?nt:Mt.mul(Ft),Lt=y===`stamp`?_e.mul(M(.9,1.06,$e.z)):Pt.mul(M(1,Qe.z,.4)),Rt=M(jt,Lt,It),zt=D(je).mul(St).add(dt.mul(Me,xt,M(1,St,.5))).mul(xe,b.metal?.85:1),Bt=D(je).add(pt.mul(Me)).mul(xe),Vt=M(L(1),U.div(A(U.x,A(U.y,U.z)).max(.05)),b.tint),Ht=Rt.mul(zt).add(Vt.mul(X)),Ut=zt.div(A(Bt,.001)),Wt=j(Ut,1),Gt=T(Ut.sub(1).mul(1.2),0,.7).add(A(X.sub(Ot),0)).clamp(0,1),Kt=Wt.mul(Gt.oneMinus()),qt=D(1).sub(It.oneMinus().mul(Kt)),Jt=Lt.mul(It,Kt).add(Gt).div(A(qt,1e-4)),Yt=I(G.x.div(o.size.x),G.y.div(o.size.y).oneMinus()),Xt=I(.5,.5).div(A(o.size,I(1,1))),Zt=r.mask(T(Yt,Xt,Xt.oneMinus()));Ge.colorNode=pe(M(Jt,Ht,H).add(p()),M(qt,D(1),H).clamp(0,1).mul(Zt));let Qt=new ee(Ve(),Ge);if(Qt.frustumCulled=!1,r.onDispose(()=>{(Ye[0]?.value)?.dispose(),qe.dispose(),J.value.dispose()}),r.place(Qt,{fit:`none`,replace:!0}),await r.compile(Qt),l.aborted)return;let $t=(e,t)=>{let n=Ye[0]?.value,i=ze(t.data,t.width,t.height,!1);for(let e of Ye)e.value=i;n?.dispose();let o=J.value;J.value=Re(Be(e,C)),o.dispose(),z.value.set(...e.frame),B.value.set(...t.frame),ye.value=t.em,be.value=t.top;let s=he();H.value=+!!s,U.value.set(s??Fe(a)),S||_e.value.set(Ne(``,a)??`#222222`),_=e,r.invalidate()},en,tn=async()=>{if(en=void 0,await t(a)||l.aborted)return;let e=n(a,`line`,f);e?.quads.length&&(R=r.params.bevel,$t(e,De(e,y,R,f)))},nn=()=>{clearTimeout(en),en=setTimeout(()=>void tn(),150)};r.onDispose(()=>clearTimeout(en));let rn=new MutationObserver(nn);rn.observe(a,{characterData:!0,childList:!0,subtree:!0}),r.onDispose(()=>rn.disconnect());let an=new ResizeObserver(()=>{let e=a.getBoundingClientRect().width;Math.abs(e-(_?.width??e))>.5&&nn()});an.observe(a),r.onDispose(()=>an.disconnect()),document.fonts?.addEventListener(`loadingdone`,nn,{signal:l});let Z,on=e=>{e.pointerType!==`touch`&&(Z={x:e.clientX,y:e.clientY},r.params.follow>0&&!u.reducedMotion.peek()&&r.invalidate())},sn=()=>{Z&&(Z=void 0,r.invalidate())};addEventListener(`pointermove`,on,{passive:!0,signal:l}),document.documentElement.addEventListener(`pointerleave`,sn,{signal:l}),addEventListener(`blur`,sn,{signal:l});let cn=0;He.set(l,()=>cn);let Q=0,$=0,ln=!1;return e=>{let t=r.params;Math.abs(t.bevel-R)>.001&&!en&&(R=t.bevel,nn());let n=e.reducedMotion,i=Math.min(e.delta,.1),a=e.width,o=e.height,s=u.height.peek()||o,c=e.y+o/2,[l,f,p]=Ie(t.light,a,o,n?s/2:c,s),m=l,h=f,g=n?0:Math.min(1,Math.max(0,t.follow));if(g>0&&Z){let[t,n]=Le(Z.x-(e.x+a/2),Z.y-c,a,o);m+=(t-l)*g,h+=(n-f)*g}!ln||n?(Q=m,$=h,ln=!0):(Q=d(Q,m,ke,i),$=d($,h,ke,i));let _=Math.abs(Q-m)>.5||Math.abs($-h)>.5;_||(Q=m,$=h),V.value.set(Q,$,p);let[v,y]=Ie(t.light,a,o,s/2,s),x=p/Math.hypot(v,y,p);xe.value=1/(je+Me*Math.min(1,(x+b.wrap)/(1+b.wrap))),cn=_?60:0}}});export{Oe as SMALL,Pe as backgroundOf,Ue as default,Le as reachOf,Ie as rest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dev-CoKR705i.js";import{i as t,n}from"./effect-DJHvQTKy.js";import{b as r}from"./kit-
|
|
1
|
+
import{t as e}from"./dev-CoKR705i.js";import{i as t,n}from"./effect-DJHvQTKy.js";import{b as r}from"./kit-DIwHK01X.js";import{CanvasTexture as i,DynamicDrawUsage as a,InstancedBufferAttribute as o,InstancedBufferGeometry as s,Mesh as c,MeshBasicNodeMaterial as ee,PlaneGeometry as l,Vector2 as u}from"three/webgpu";import{attribute as d,clamp as f,cos as p,exp as m,float as h,floor as g,fract as te,max as ne,mix as re,mod as _,positionGeometry as v,sRGBTransferEOTF as y,sin as b,smoothstep as x,step as S,texture as ie,uniform as ae,uv as oe,varying as se,vec2 as ce,vec3 as le,vec4 as ue}from"three/tsl";const C=300,de=16,fe=.8,pe=.01,me=Math.PI/180,he={float:{sway:1,rock:.22,end:.75},rain:{sway:1.4,rock:.3,end:1},burst:{sway:.25,rock:.08,end:.6},fountain:{sway:.25,rock:.08,end:.85}},w=/^(?:\p{Extended_Pictographic}|\p{Regional_Indicator})/u,ge=/* @__PURE__ */ new WeakSet,T=/* @__PURE__ */ new WeakSet,E=e=>/\/|^data:|\.(?:png|jpe?g|gif|webp|avif|svg)(?:[?#]|$)/i.test(e);function _e(e){let t=Intl.Segmenter,n=t?new t(void 0,{granularity:`grapheme`}):void 0,r=[];for(let t of e.trim().split(/\s+/)){if(!t)continue;let e=n&&!E(t)?[...n.segment(t)].map(e=>e.segment):[t];e.length>1&&e.every(e=>w.test(e))?r.push(...e):r.push(t)}return[...new Set(r)]}function ve(e){let t=new Image;t.decoding=`async`;try{new URL(e,location.href).origin!==location.origin&&(t.crossOrigin=`anonymous`)}catch{}return t.src=e,t.decode().then(()=>t,()=>void 0)}function ye(e,t,n,r){let i=document.createElement(`canvas`),a=i.getContext(`2d`);if(!a)return;let o=Math.max(1,Math.ceil(Math.sqrt(t.length)));i.width=i.height=o*r;let s=getComputedStyle(e),c=r*fe,ee=`${Math.round(c*.86)}px "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji","Twemoji Mozilla", ${s.fontFamily||`sans-serif`}`;return t.forEach((e,t)=>{let i=(t%o+.5)*r,l=(Math.floor(t/o)+.5)*r,u=n[t];if(u){let e=u.naturalWidth||1,t=u.naturalHeight||e,n=c/Math.max(e,t);a.drawImage(u,i-e*n/2,l-t*n/2,e*n,t*n);return}a.font=ee,a.fillStyle=s.color||`#000`,a.textAlign=`left`,a.textBaseline=`alphabetic`;let d=a.measureText(e),f=d.actualBoundingBoxLeft||0,p=d.actualBoundingBoxRight||d.width,m=d.actualBoundingBoxAscent||c*.7,h=d.actualBoundingBoxDescent||0,g=Math.min(1,c/Math.max(f+p,m+h,1));a.save(),a.translate(i,l),a.scale(g,g),a.fillText(e,(f-p)/2,(m-h)/2),a.restore()}),{canvas:i,grid:o,items:t}}const D=n({name:`emoji`,params:{trigger:t(`click`,`view`,`event`,`manual`,`interval`),motion:t(`float`,`burst`,`rain`,`fountain`),emoji:`❤️`,event:``,fire:0,once:!1,origin:t(`center`,`pointer`),count:8,scale:1,speed:1,spread:40,sway:12,spin:1,duration:2.4,interval:1.5,seed:1},rebuild:[`seed`],reducedMotion:`off`,bleed:1e5,quality:{low:{count:12},medium:{count:24}},animate:e=>T.has(e.signal),async setup(t){let{params:n,signal:C,render:de,u:w,app:D,element:O}=t,{trigger:k,origin:be}=n,xe=n.motion,Se=he[xe],A=r(n.seed),j=_e(n.emoji);j.length>16&&(e&&D.log.warn(`emoji: ${j.length} items, the first 16 are drawn`,O),j=j.slice(0,16));let Ce=await Promise.all(j.map(e=>E(e)?ve(e):void 0));if(C.aborted)return;let we=j.filter((e,t)=>E(e)&&!Ce[t]);we.length&&e&&D.log.warn(`emoji: ${we.join(`, `)} did not load`,O);let Te=j.flatMap((e,t)=>E(e)&&!Ce[t]?[]:[t]),Ee=Math.min(2,globalThis.devicePixelRatio||1),De=Math.min(256,Math.max(128,2**Math.ceil(Math.log2(32*n.scale*Ee*1.25)))),M=Te.length?ye(O,Te.map(e=>j[e]),Te.map(e=>Ce[e]),De):void 0,Oe=M?.items.length??0,N=M?.grid??1,ke=new i(M?.canvas??document.createElement(`canvas`));ke.premultiplyAlpha=!0,t.onDispose(()=>ke.dispose());let P=/* @__PURE__ */ new Float32Array(1200),F=/* @__PURE__ */ new Float32Array(1200),I=/* @__PURE__ */ new Float32Array(1200);for(let e=0;e<300;e++)P[e*4+2]=-1e6;let L=new l(1,1),R=new s;R.setIndex(L.getIndex()),R.setAttribute(`position`,L.getAttribute(`position`)),R.setAttribute(`uv`,L.getAttribute(`uv`)),L.dispose();let Ae=[[`emojiStart`,P],[`emojiFly`,F],[`emojiForm`,I]].map(([e,t])=>{let n=new o(t,4).setUsage(a);return R.setAttribute(e,n),n});R.instanceCount=1;let je=ae(0),z=ae(new u),B=d(`emojiStart`,`vec4`),V=d(`emojiFly`,`vec4`),H=d(`emojiForm`,`vec4`),U=je.sub(B.z),W=ne(U,0),Me=B.w,Ne=ne(V.z,pe),G=m(Ne.mul(W).negate()).oneMinus().div(Ne),K=H.z,Pe=b(W.mul(1.9).add(K)).mul(w.sway,te(K.mul(2.9)).mul(.6).add(.7),x(0,.6,W),Se.sway),Fe=B.x.add(V.x.mul(G)).add(Pe).add(z.x),Ie=B.y.add(V.y.mul(G)).sub(V.w.mul(W.sub(G)).div(Ne)).add(z.y),Le=w.spin.mul(H.w.mul(G).add(b(W.mul(2.1).add(K.mul(1.7))).mul(Se.rock)).add(te(K.mul(1.3)).sub(.5).mul(.35))),Re=f(W.div(.22),0,1).sub(1),ze=Re.mul(Re).mul(Re.mul(2.70158).add(1.70158)).add(1),Be=x(Me.mul(.7),Me,U),Ve=S(0,U).mul(S(U,Me)),He=w.scale.mul(32/fe).mul(H.y,ze,re(h(1),Se.end,Be),Ve),q=v.xy.mul(He),Ue=p(Le),We=b(Le),Ge=new ee({transparent:!0,depthTest:!1,depthWrite:!1});Ge.positionNode=le(Fe.add(q.x.mul(Ue)).sub(q.y.mul(We)),Ie.add(q.x.mul(We)).add(q.y.mul(Ue)),0);let Ke=se(Be.oneMinus().mul(w.presence)),qe=H.x,Je=oe().add(ce(_(qe,N),h(N-1).sub(g(qe.div(N))))).div(N),Ye=ie(ke,Je),Xe=y(Ye.rgb.div(ne(Ye.a,1e-4)));Ge.colorNode=ue(Xe,Ye.a.mul(Ke));let J=new c(R,Ge);if(J.frustumCulled=!1,t.overlay.add(J),await t.compile(J),J.visible=!1,C.aborted)return;let Y=0,Ze=0,Qe=0,X=-1/0,$e=n.fire,et,tt=[],nt={x:0,y:0},Z=(e={})=>{n.once&&ge.has(O)||(ge.add(O),tt.push(e),T.add(C),t.invalidate())},rt=()=>{let e=D.pointer.state;return be===`pointer`&&e.inside?{x:e.x,y:e.y}:void 0},it=(e,t)=>O.addEventListener(e,t,{signal:C,passive:!0}),Q=typeof IntersectionObserver!=`function`,$,at=e=>{clearTimeout($),$=setTimeout(ot,e*1e3)},ot=()=>{$=void 0;let e=n.interval;!C.aborted&&Q&&O.isConnected&&e>0&&(!tt.length&&document.visibilityState!==`hidden`&&Z({at:rt()}),at(e))},st=()=>{k===`interval`&&Q&&!$&&n.interval>0&&O.isConnected&&at(n.interval*.25)};if(t.onDispose(()=>clearTimeout($)),k===`click`)it(`click`,e=>{let t=e,n=t.detail>0||t.clientX!==0||t.clientY!==0;Z({at:be===`pointer`&&n?{x:t.clientX,y:t.clientY}:void 0})});else if(k===`event`){let t=n.event.trim();t?it(t,e=>{let t=e.detail,n=t&&typeof t==`object`?t:{};Z({emoji:n.emoji,count:n.count,at:rt()})}):e&&D.log.warn(`EFFECT_PARAM: emoji with data-dio-trigger="event" needs data-dio-event`)}else if(k===`view`||k===`interval`){let e=e=>{let t=e.rootBounds;return e.isIntersecting&&(e.intersectionRatio>=.5||!!t&&e.intersectionRect.height>=.5*t.height)};if(typeof IntersectionObserver==`function`){let n=new IntersectionObserver(t=>{if(k===`view`){if(!t.some(e))return;n.disconnect(),Z()}else Q=t[t.length-1]?.isIntersecting??Q,Q?st():(clearTimeout($),$=void 0)},{threshold:[0,.1,.2,.3,.4,.5]});n.observe(O),t.onDispose(()=>n.disconnect())}else k===`view`&&Z();st()}let ct=(e,t)=>{let r=Math.max(0,Math.round(n.count)),i=Math.min(300,e.count===void 0?r:Math.min(r,e.count));if(!Oe||!(i>0))return;let a=e.emoji===void 0?-1:M?.items.indexOf(e.emoji)??-1,o=D.stage.width.peek(),s=D.stage.height.peek(),c=Math.max(0,n.speed),ee=Math.min(360,Math.max(0,n.spread)),l=Math.max(.2,n.duration),u=Y-.016666666666666666,d=Math.max(4,32*n.scale),f=()=>e.at?{x:e.at.x+(A()-.5)*8,y:e.at.y}:{x:t.x+t.width*(.5+(A()-.5)*.4),y:t.y+Math.min(t.height/2,d*.25)},p=Math.min(o,Math.max(0,t.x)),m=Math.min(o,Math.max(0,t.x+t.width)),h=Math.max(t.y,0)-d*.2,g=Math.min(t.y+t.height,s)+d*.6,te=m-p>=d?[p,m-p]:[0,o],ne=g-h>=d*2?g:s+d,re=k===`interval`?Math.max(.1,n.interval):l*.6,_=-1/0;for(let n=0;n<i;n++){let r=Ze;Ze=(Ze+1)%300,Qe=Math.max(Qe,r+1);let o=r*4,s=l*(.8+.4*A()),p,m,g,v,y,b,x,S=u;if(xe===`float`)p=f(),m=90+(A()-.5)*ee,g=170*(.75+.5*A()),v=1.1,y=-80,b=(A()-.5)*.6,x=.8+.4*A(),S+=n*Math.min(.1,.8/i);else if(xe===`burst`)p=e.at?{x:e.at.x,y:e.at.y}:{x:t.x+t.width*(.5+(A()-.5)/3),y:t.y+t.height*(.5+(A()-.5)/3)},m=(n/i+A()*.25)*360,g=560*(.5+.6*A()),v=3.4,y=260,b=(A()<.5?-1:1)*(2+3*A()),x=.7+.5*A(),S+=A()*.03;else if(xe===`fountain`)p=f(),m=90+((A()+A())/2-.5)*ee,g=900*(.8+.3*A()),v=.4,y=1700,b=(A()<.5?-1:1)*(1+3*A()),x=.75+.45*A(),S+=n*Math.min(.04,.6/i);else{let e=h-A()*d*.4;p={x:te[0]+A()*te[1],y:e},m=270+(A()-.5)*12,g=(ne-e)/(s*.9),v=pe,y=0,b=(A()-.5)*1.2,x=.6+.6*A(),S+=A()*re}let ie=de.toWorld(p.x,p.y,nt);P[o]=ie.x-z.value.x,P[o+1]=ie.y-z.value.y,P[o+2]=S,P[o+3]=s,F[o]=Math.cos(m*me)*g*c,F[o+1]=Math.sin(m*me)*g*c,F[o+2]=v,F[o+3]=y*c,I[o]=a>=0?a:Math.floor(A()*Oe),I[o+1]=x,I[o+2]=A()*Math.PI*2,I[o+3]=b,_=Math.max(_,S+s)}X=Math.max(X,_);for(let e of Ae)e.needsUpdate=!0;R.instanceCount=Qe};return e=>{k===`manual`&&n.fire!==$e&&(n.fire>$e&&Z({at:rt()}),$e=n.fire),et??={x:e.x,y:e.y},z.value.set(e.x-et.x,et.y-e.y),Y<X&&(Y+=e.delta);for(let t of tt.splice(0))ct(t,e);st();let t=400*Math.max(1,n.speed)+32*n.scale,r=D.stage.width.peek(),i=D.stage.height.peek();(e.y>i+t||e.y+e.height<-t||e.x>r+t||e.x+e.width<-t)&&(X=Math.min(X,Y)),je.value=Y;let a=Y<X;J.visible=a,a?T.add(C):T.delete(C)}}});export{de as MAX_GLYPHS,C as POOL,D as default,_e as glyphs,E as isPicture};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./effect-DJHvQTKy.js";import{a as n,n as r,s as i}from"./kit-
|
|
1
|
+
import{i as e,n as t}from"./effect-DJHvQTKy.js";import{a as n,n as r,s as i}from"./kit-DIwHK01X.js";const a=e=>Math.min(1,Math.max(0,e));function o(e){for(let t=e.parentElement;t;t=t.parentElement)if(getComputedStyle(t).position===`sticky`)return t}const s=t({name:`expand`,params:{into:``,by:e(`pin`,`progress`,`manual`),position:0,start:0,end:.5,out:1,zoom:1.1,radius:0,ease:0},media:!0,reducedMotion:`off`,quality:{},setup(e){let{params:t,app:s,element:c,render:l}=e,u=t.into.trim(),d=u?c.parentElement?.closest(u):o(c);u&&!d&&s.log.warn(`expand: no ancestor matches "${u}", the image grows to the viewport`);let f=d?s.anchors.track(d,{live:!0}):void 0;f&&e.onDispose(()=>f.dispose());let{surface:p}=e;p.zoom(1);let m=t.by,h=n=>{if(m===`manual`)return 0;let i=m===`pin`?e.section().pin:n.progress,a=t.out<1?r(i,t.out,1):0;return Math.min(r(i,t.start,t.end),1-a)},g={x:0,y:0},_=-1;return r=>{let o=Math.max(a(t.position),i(`cubicInOut`,h(r)));_=_<0?o:n(_,o,t.ease,r.delta,1e-4);let c=_!==o;if(p.zoom(1+(Math.max(t.zoom,1)-1)*Math.sin(Math.PI*_)),_<=0)return c;let u=f??{x:0,y:0,width:s.stage.width.peek(),height:s.stage.height.peek()},{width:d,height:m}=u,{x:v,y}=l.toWorld(u.x+d/2,u.y+m/2,g),b={x:v,y,width:d,height:m,radius:t.radius,clip:!1,above:1};return e.pose(e.layer,b,_),c}}});export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./dev-CoKR705i.js";import{a as t,i as n,r}from"./rig-DqcDPLdU.js";import{i,n as a}from"./effect-DJHvQTKy.js";import{a as o,s}from"./kit-
|
|
1
|
+
import{t as e}from"./dev-CoKR705i.js";import{a as t,i as n,r}from"./rig-DqcDPLdU.js";import{i,n as a}from"./effect-DJHvQTKy.js";import{a as o,s}from"./kit-DIwHK01X.js";import{Matrix3 as c,Matrix4 as l,Vector3 as u}from"three/webgpu";const d=Math.PI/180;function f(e){let t=e;for(;;){let e=t.children.length===1?t.children[0]:void 0;if(!e||e.isMesh||!e.children.length)break;t=e}return t.children}function p(e,r,i,a=[0,1,0]){e.updateWorldMatrix(!0,!0);let o=new l().copy(e.matrixWorld).invert(),s=[],d;if(i.length){d=[];for(let n of i){let r=t(e,n);r?d.push(r):s.push(n)}}else r===`extras`?(d=[],e.traverse(t=>{t!==e&&m(t)&&d.push(t)})):d=f(e);d=d.filter(e=>!n(e,o).isEmpty()||m(e));let p=n(e,o),h=p.getCenter(new u),g=Math.max(...p.getSize(new u).toArray())||1,_=d.map(e=>n(e,o)),v=_.map(e=>e.getCenter(new u)),y;if(r===`extras`)y=d.map(e=>new u().fromArray(m(e)??[0,0,0]));else if(r===`axis`){let e=new u(...a);e.lengthSq()===0&&e.set(0,1,0),e.normalize();let t=v.map(t=>t.clone().sub(h).dot(e)),n=[...t].sort((e,t)=>e-t),r=[];for(let e of n){let t=r[r.length-1];(t===void 0||e-t>.02*g)&&r.push(e)}let i=e=>{let t=0;for(let n=0;n<r.length;n++)e>=r[n]&&(t=n);return t},o=Math.max(1,r.length-1);y=t.map(t=>e.clone().multiplyScalar((i(t)-(r.length-1)/2)*g/o))}else y=v.map(e=>e.clone().sub(h));let b=d.map((t,n)=>{let r=t.parent??e,i=new c().setFromMatrix4(new l().multiplyMatrices(o,r.matrixWorld).invert()),a=[];for(let n=t.parent;n&&n!==e;n=n.parent){let e=d.indexOf(n);e>=0&&a.push(e)}return{node:t,box:_[n],offset:y[n],toParent:i,outer:a}}),x=new Set(d),S=[],C=new l;return e.traverse(t=>{let n=t;if(!n.isMesh||!n.geometry)return;for(let t=n;t&&t!==e;t=t.parent)if(x.has(t))return;n.geometry.boundingBox||n.geometry.computeBoundingBox();let r=n.geometry.boundingBox;r&&S.push(r.clone().applyMatrix4(C.multiplyMatrices(o,n.matrixWorld)))}),{pieces:b,missing:s,whole:p,still:S}}function m(e){let t=e.userData.explode;return Array.isArray(t)&&t.length===3&&t.every(e=>typeof e==`number`)?t:void 0}function h(e,t,n){let r=new u;return[...t,...e.map((e,t)=>{r.copy(n[t]);for(let t of e.outer)r.add(n[t]);return e.box.clone().translate(r)})]}const g=a({name:`explode`,params:{mode:i(`radial`,`axis`,`extras`),by:i(`pin`,`progress`,`manual`),pieces:``,axis:[0,1,0],spread:1,start:0,end:1,position:0,cascade:.3,twist:0,ease:.15,contain:!0},rebuild:[`axis`],presence:`custom`,quality:{},setup(t){let{element:n,params:i,signal:a}=t,{mode:c,by:l,axis:f}=i,m=i.pieces.split(`,`).map(e=>e.trim()).filter(Boolean);if(e){let e=n.getAttribute(`data-dio`)?.split(/\s+/);e&&!e.includes(`model`)&&t.app.log.warn(`explode works on a model of the same element: data-dio="model explode"`)}let g,_=[],v=[],y=[],b=[],x=-1,S=new u,C=()=>{g&&(_.forEach((e,t)=>{e.node.position.copy(v[t])}),g.scene.rotation.y=0,g.contain(void 0),g.invalidate(),g=void 0,_=[])};r(n,n=>{if(C(),!n)return;g=n;let r=p(n.file,c,m,f);if(_=r.pieces,b=r.still,v=_.map(e=>e.node.position.clone()),y=_.map(()=>new u),x=-1,e&&r.missing.length){let e=[];n.file.traverse(t=>{t!==n.file&&t.name&&e.push(t.name)}),t.app.log.warn(`explode: no piece "${r.missing.join(`, `)}" in the model. Nodes: ${e.join(`, `)}`)}else e&&_.length<2&&t.app.log.warn(c===`extras`?`explode: no node of the model has extras.explode = [x, y, z]`:`explode: the model has fewer than two parts to move; name them in data-dio-pieces`);t.invalidate()},a),t.onDispose(C);let w=()=>{let e=_.map((e,t)=>[e.offset.length(),t]);e.sort((e,t)=>t[0]-e[0]);let t=[];return e.forEach(([,e],n)=>{t[e]=n}),t},T=[],E;return e=>{if(!g)return!1;let n=e.reducedMotion,r;if(l===`manual`)r=i.position;else if(n)r=1;else{let n=l===`pin`?t.section().pin:e.progress,a=i.end-i.start;r=a?(n-i.start)/a:n<i.start?0:1}r=Math.min(1,Math.max(0,r)),x=x<0||n?r:o(x,r,i.ease,e.delta,1e-4),E!==_&&(T=w(),E=_);let a=i.spread,c=Math.min(.9,Math.max(0,i.cascade)),u=_.length;_.forEach((e,t)=>{let n=u>1?c*T[t]/(u-1):0,r=Math.min(1,Math.max(0,(x-n)/(1-c))),i=s(`cubicInOut`,r)*a,o=y[t].copy(e.offset).multiplyScalar(i);S.copy(o).applyMatrix3(e.toParent),e.node.position.copy(v[t]).add(S)});let f=s(`cubicInOut`,x);return g.scene.rotation.y=n?0:i.twist*d*f,g.contain(i.contain?h(_,b,y):void 0),x!==r}}});export{g as default,h as extent,p as layout};
|