@funpixel/tools 0.0.0-stage → 0.1.1
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/LICENSE +115 -0
- package/NOTICE +28 -0
- package/README.md +110 -2
- package/bench/LICENSE +674 -0
- package/bench/README.md +10 -0
- package/bench/entrypoint.py +94 -0
- package/bench/handlers/__init__.py +53 -0
- package/bench/handlers/apply_skin.py +192 -0
- package/bench/handlers/apply_texture.py +195 -0
- package/bench/handlers/audit_clips.py +351 -0
- package/bench/handlers/author_clips.py +297 -0
- package/bench/handlers/author_motion.py +298 -0
- package/bench/handlers/bake_emissive.py +136 -0
- package/bench/handlers/build_level.py +395 -0
- package/bench/handlers/decimate.py +220 -0
- package/bench/handlers/fit_rig.py +273 -0
- package/bench/handlers/fracture.py +233 -0
- package/bench/handlers/humanoid.py +119 -0
- package/bench/handlers/inspect.py +212 -0
- package/bench/handlers/level_check.py +68 -0
- package/bench/handlers/level_geo.py +150 -0
- package/bench/handlers/level_proof.py +117 -0
- package/bench/handlers/level_props.py +135 -0
- package/bench/handlers/lod.py +83 -0
- package/bench/handlers/merge_clips.py +122 -0
- package/bench/handlers/mirror_limb.py +336 -0
- package/bench/handlers/motion_specs.json +11 -0
- package/bench/handlers/normalize_materials.py +182 -0
- package/bench/handlers/normalize_transform.py +174 -0
- package/bench/handlers/prune_clips.py +141 -0
- package/bench/handlers/raster.py +98 -0
- package/bench/handlers/render.py +239 -0
- package/bench/handlers/render_views.py +101 -0
- package/bench/handlers/retarget_clips.py +185 -0
- package/bench/handlers/scene.py +311 -0
- package/bench/handlers/sheet.py +118 -0
- package/bench/handlers/texels.py +176 -0
- package/bench/handlers/views.py +232 -0
- package/dist/api/generated/openapi.js +1 -0
- package/dist/api/http.js +71 -0
- package/dist/api/jobs.js +94 -0
- package/dist/assets/bakeoff.js +61 -0
- package/dist/assets/counts.js +60 -0
- package/dist/assets/gen.js +230 -0
- package/dist/assets/lock.js +77 -0
- package/dist/assets/manifest.js +236 -0
- package/dist/assets/palette-fit.js +99 -0
- package/dist/assets/pixelart.js +192 -0
- package/dist/assets/pixels.js +131 -0
- package/dist/assets/plan.js +169 -0
- package/dist/assets/process.js +209 -0
- package/dist/assets/script.js +194 -0
- package/dist/assets/steps.js +294 -0
- package/dist/bin.js +8 -0
- package/dist/board/board.js +99 -0
- package/dist/cast/library.js +102 -0
- package/dist/cast/measure.js +222 -0
- package/dist/cli.js +2917 -0
- package/dist/clip/clip.js +83 -0
- package/dist/commands/account.js +158 -0
- package/dist/commands/assets-pixels.js +106 -0
- package/dist/commands/assets.js +473 -0
- package/dist/commands/beats.js +77 -0
- package/dist/commands/board.js +162 -0
- package/dist/commands/boxes.js +89 -0
- package/dist/commands/capture-all.js +92 -0
- package/dist/commands/cast.js +84 -0
- package/dist/commands/character.js +58 -0
- package/dist/commands/check.js +404 -0
- package/dist/commands/clip.js +112 -0
- package/dist/commands/compare-takes.js +204 -0
- package/dist/commands/compare-target.js +149 -0
- package/dist/commands/compare.js +117 -0
- package/dist/commands/compose-variations.js +202 -0
- package/dist/commands/compose.js +163 -0
- package/dist/commands/cut.js +13 -0
- package/dist/commands/decide.js +90 -0
- package/dist/commands/depth.js +171 -0
- package/dist/commands/dev.js +138 -0
- package/dist/commands/directions.js +106 -0
- package/dist/commands/doctor.js +281 -0
- package/dist/commands/export.js +88 -0
- package/dist/commands/feedback.js +496 -0
- package/dist/commands/feel.js +144 -0
- package/dist/commands/fidelity.js +95 -0
- package/dist/commands/find.js +116 -0
- package/dist/commands/firstlook.js +138 -0
- package/dist/commands/flow.js +600 -0
- package/dist/commands/framing.js +53 -0
- package/dist/commands/gdd.js +227 -0
- package/dist/commands/gen.js +512 -0
- package/dist/commands/greenlight.js +148 -0
- package/dist/commands/hook.js +171 -0
- package/dist/commands/init.js +234 -0
- package/dist/commands/inspect.js +161 -0
- package/dist/commands/job.js +41 -0
- package/dist/commands/jobs.js +87 -0
- package/dist/commands/journal.js +58 -0
- package/dist/commands/journey.js +228 -0
- package/dist/commands/judge.js +191 -0
- package/dist/commands/lanes.js +571 -0
- package/dist/commands/lessons.js +74 -0
- package/dist/commands/life.js +134 -0
- package/dist/commands/login.js +134 -0
- package/dist/commands/look-3d.js +105 -0
- package/dist/commands/look-fit.js +116 -0
- package/dist/commands/look-hud.js +180 -0
- package/dist/commands/look-read.js +162 -0
- package/dist/commands/look-sheet.js +152 -0
- package/dist/commands/look-theme.js +136 -0
- package/dist/commands/look.js +373 -0
- package/dist/commands/loop.js +112 -0
- package/dist/commands/loudness.js +69 -0
- package/dist/commands/mobile-qa.js +119 -0
- package/dist/commands/model.js +256 -0
- package/dist/commands/models.js +93 -0
- package/dist/commands/motion.js +305 -0
- package/dist/commands/next.js +72 -0
- package/dist/commands/note.js +294 -0
- package/dist/commands/optimize.js +212 -0
- package/dist/commands/owner.js +109 -0
- package/dist/commands/pack.js +66 -0
- package/dist/commands/parts.js +635 -0
- package/dist/commands/phone.js +398 -0
- package/dist/commands/pick.js +146 -0
- package/dist/commands/pitch.js +205 -0
- package/dist/commands/places.js +89 -0
- package/dist/commands/play.js +368 -0
- package/dist/commands/playable.js +51 -0
- package/dist/commands/playtest.js +262 -0
- package/dist/commands/profile.js +292 -0
- package/dist/commands/progress.js +537 -0
- package/dist/commands/publish.js +165 -0
- package/dist/commands/reach.js +72 -0
- package/dist/commands/reel.js +177 -0
- package/dist/commands/review.js +112 -0
- package/dist/commands/rooms.js +180 -0
- package/dist/commands/schema.js +29 -0
- package/dist/commands/score.js +326 -0
- package/dist/commands/serve.js +67 -0
- package/dist/commands/setup.js +254 -0
- package/dist/commands/sim.js +179 -0
- package/dist/commands/simulator.js +154 -0
- package/dist/commands/smoke-build.js +305 -0
- package/dist/commands/smoke.js +37 -0
- package/dist/commands/spec.js +114 -0
- package/dist/commands/store.js +154 -0
- package/dist/commands/test.js +104 -0
- package/dist/commands/trailer.js +255 -0
- package/dist/commands/unity-editor.js +322 -0
- package/dist/commands/unity-player.js +672 -0
- package/dist/commands/unity.js +198 -0
- package/dist/commands/upgrade.js +186 -0
- package/dist/commands/variety.js +108 -0
- package/dist/commands/verify.js +293 -0
- package/dist/commands/walk.js +449 -0
- package/dist/commands/widen.js +133 -0
- package/dist/commands/world.js +175 -0
- package/dist/commands/wow.js +143 -0
- package/dist/commands/zero.js +71 -0
- package/dist/compose/adsheet.js +61 -0
- package/dist/compose/contract.js +248 -0
- package/dist/compose/facts.js +81 -0
- package/dist/compose/hyperframes.js +102 -0
- package/dist/compose/page.js +216 -0
- package/dist/compose/probe.js +160 -0
- package/dist/compose/run.js +170 -0
- package/dist/compose/sheet.js +92 -0
- package/dist/compose/starters.js +247 -0
- package/dist/compose/variations.js +203 -0
- package/dist/criteria.js +35 -0
- package/dist/depth/experience.js +61 -0
- package/dist/depth/fill.js +102 -0
- package/dist/depth/inventory.js +161 -0
- package/dist/depth/pacing.js +173 -0
- package/dist/depth/story.js +97 -0
- package/dist/dev/devtools.js +119 -0
- package/dist/dev/hold.js +46 -0
- package/dist/dev/lan.js +15 -0
- package/dist/dev/open.js +30 -0
- package/dist/dev/qr.js +124 -0
- package/dist/devtools/LICENSES/pixi.js.LICENSE +21 -0
- package/dist/devtools/LICENSES/preact.LICENSE +21 -0
- package/dist/devtools/LICENSES/source-map-js.LICENSE +28 -0
- package/dist/devtools/LICENSES/three.LICENSE +21 -0
- package/dist/devtools/inspector/funpixel-inspector.pixi.min.js +1 -0
- package/dist/devtools/inspector/funpixel-inspector.threejs.min.js +1 -0
- package/dist/devtools/inspector/hooked-engines/pixi.min.js +8 -0
- package/dist/devtools/inspector/hooked-engines/preact.min.js +1 -0
- package/dist/devtools/inspector/hooked-engines/threejs.min.js +12 -0
- package/dist/devtools/kapture/funpixel-kapture.min.js +1 -0
- package/dist/devtools/profiler/funpixel-profiler.pixi.min.js +1 -0
- package/dist/devtools/profiler/funpixel-profiler.threejs.min.js +1 -0
- package/dist/direct/moves.js +234 -0
- package/dist/direct/read.js +59 -0
- package/dist/direct/round.js +80 -0
- package/dist/doctor/host.js +245 -0
- package/dist/doctor/unity-checks.js +380 -0
- package/dist/doctor/unity-history.js +589 -0
- package/dist/doctor/unity-host.js +160 -0
- package/dist/doctor/unity-import-rules.js +874 -0
- package/dist/doctor/unity-meta.js +225 -0
- package/dist/doctor/unity-project.js +297 -0
- package/dist/doctor/unity.js +171 -0
- package/dist/export/export.js +165 -0
- package/dist/export/metadata.js +25 -0
- package/dist/export/runtime.js +119 -0
- package/dist/export/scan.js +78 -0
- package/dist/export/select.js +193 -0
- package/dist/export/strip.js +42 -0
- package/dist/feedback/ab.js +55 -0
- package/dist/feedback/auto.js +44 -0
- package/dist/feedback/learn.js +255 -0
- package/dist/feedback/measure.js +49 -0
- package/dist/feedback/page.js +66 -0
- package/dist/feel/feedback.js +85 -0
- package/dist/feel/judge.js +420 -0
- package/dist/feel/run.js +185 -0
- package/dist/feel/spec.js +124 -0
- package/dist/feel/sweep.js +156 -0
- package/dist/fidelity/consistency.js +205 -0
- package/dist/fidelity/match.js +675 -0
- package/dist/fidelity/run.js +107 -0
- package/dist/find/keywords.js +97 -0
- package/dist/find/names.js +45 -0
- package/dist/find/route.js +59 -0
- package/dist/firstlook/quality.js +261 -0
- package/dist/firstlook/render.js +111 -0
- package/dist/firstlook/set.js +218 -0
- package/dist/flow/flow.js +455 -0
- package/dist/flow/look.js +139 -0
- package/dist/frame/behaviour.js +53 -0
- package/dist/frame/clock.js +117 -0
- package/dist/frame/contract.js +111 -0
- package/dist/frame/genre.js +65 -0
- package/dist/frame/idle.js +58 -0
- package/dist/frame/opening.js +171 -0
- package/dist/frames/loop.js +52 -0
- package/dist/frames/sheet.js +69 -0
- package/dist/gdd/book.js +483 -0
- package/dist/gdd/chapters.js +71 -0
- package/dist/gdd/design.js +135 -0
- package/dist/gdd/doc.js +32 -0
- package/dist/gdd/levelmap.js +428 -0
- package/dist/gdd/measures.js +477 -0
- package/dist/gdd/page.js +111 -0
- package/dist/gdd/rubric.js +250 -0
- package/dist/gdd/size.js +83 -0
- package/dist/gdd/tiers.js +148 -0
- package/dist/gdd/world.js +98 -0
- package/dist/gdd/worth.js +507 -0
- package/dist/gen/kinds.js +451 -0
- package/dist/gen/local/doctor.js +25 -0
- package/dist/gen/local/index.js +3 -0
- package/dist/gen/local/kokoro.js +334 -0
- package/dist/gen/local/master.js +248 -0
- package/dist/gen/local/provider.js +65 -0
- package/dist/gen/local/voice-rules.js +156 -0
- package/dist/gen/models.generated.js +469 -0
- package/dist/gen/models.js +53 -0
- package/dist/gen/prompt-lint.js +35 -0
- package/dist/gen/record.js +73 -0
- package/dist/gen/save.js +101 -0
- package/dist/gen/title.js +55 -0
- package/dist/gen/unity.js +334 -0
- package/dist/goals/goals.js +204 -0
- package/dist/goals/run.js +90 -0
- package/dist/greenlight/ambition.js +42 -0
- package/dist/greenlight/bible.js +138 -0
- package/dist/greenlight/lock.js +48 -0
- package/dist/greenlight/match.js +19 -0
- package/dist/greenlight/md.js +82 -0
- package/dist/greenlight/page.js +100 -0
- package/dist/greenlight/pitches.js +66 -0
- package/dist/greenlight/worth.js +90 -0
- package/dist/guidance.js +24 -0
- package/dist/init/bare.js +114 -0
- package/dist/init/git.js +56 -0
- package/dist/init/starter.js +166 -0
- package/dist/init/starters.js +179 -0
- package/dist/inspect/describe.js +125 -0
- package/dist/inspect/devserver.js +40 -0
- package/dist/journey/diff.js +74 -0
- package/dist/journey/from-round.js +44 -0
- package/dist/journey/record.js +76 -0
- package/dist/journey/run.js +139 -0
- package/dist/journey/script.js +223 -0
- package/dist/judge/common.js +60 -0
- package/dist/judge/identity.js +68 -0
- package/dist/judge/sources.js +37 -0
- package/dist/judge/structure.js +59 -0
- package/dist/keys/device.js +145 -0
- package/dist/keys/store.js +167 -0
- package/dist/lanes/fence.js +108 -0
- package/dist/lanes/gate.js +123 -0
- package/dist/lanes/lanes.js +355 -0
- package/dist/lanes/union.js +62 -0
- package/dist/lanes/where.js +49 -0
- package/dist/lessons/motifs.js +97 -0
- package/dist/lessons/store.js +56 -0
- package/dist/look/anim.js +206 -0
- package/dist/look/boxes.js +209 -0
- package/dist/look/dressing.js +24 -0
- package/dist/look/feedback.js +50 -0
- package/dist/look/fit.js +123 -0
- package/dist/look/held.js +92 -0
- package/dist/look/hook.js +169 -0
- package/dist/look/hud.js +189 -0
- package/dist/look/image-io.js +50 -0
- package/dist/look/life.js +96 -0
- package/dist/look/light.js +42 -0
- package/dist/look/look.js +85 -0
- package/dist/look/loops.js +108 -0
- package/dist/look/made-of.js +242 -0
- package/dist/look/moments.js +32 -0
- package/dist/look/motion.js +44 -0
- package/dist/look/phone-play.js +142 -0
- package/dist/look/player.js +32 -0
- package/dist/look/png.js +117 -0
- package/dist/look/readability.js +100 -0
- package/dist/look/roles.js +109 -0
- package/dist/look/sheet.js +104 -0
- package/dist/look/theme.js +278 -0
- package/dist/look/touch.js +129 -0
- package/dist/look/ui-style.js +102 -0
- package/dist/machine/procs.js +117 -0
- package/dist/managed.js +15 -0
- package/dist/mcp/hosted.js +174 -0
- package/dist/mcp/models.generated.js +538 -0
- package/dist/mcp/models.js +35 -0
- package/dist/mcp/server.js +330 -0
- package/dist/memory/decisions.js +138 -0
- package/dist/memory/journal.js +108 -0
- package/dist/model/bench.js +83 -0
- package/dist/model/blender.js +106 -0
- package/dist/model/clips.js +34 -0
- package/dist/model/finalize.js +33 -0
- package/dist/motion/checks.js +173 -0
- package/dist/motion/contract.js +177 -0
- package/dist/motion/encode.js +37 -0
- package/dist/motion/render.js +167 -0
- package/dist/motion/starter.js +54 -0
- package/dist/optimize/check.js +29 -0
- package/dist/optimize/helper.js +80 -0
- package/dist/owner/bar.js +285 -0
- package/dist/owner/match.js +105 -0
- package/dist/pack/build.js +97 -0
- package/dist/pack/deps.js +28 -0
- package/dist/pack/leaks.js +77 -0
- package/dist/pack/limits.js +51 -0
- package/dist/pack/report.js +35 -0
- package/dist/phone/baguette.js +139 -0
- package/dist/phone/listen.js +65 -0
- package/dist/pipeline/pipeline.js +929 -0
- package/dist/plan/actions.js +18 -0
- package/dist/plan/notes.js +15 -0
- package/dist/play/clock.js +40 -0
- package/dist/play/condition.js +45 -0
- package/dist/play/frames.js +60 -0
- package/dist/play/input.js +118 -0
- package/dist/play/pointer.js +21 -0
- package/dist/play/report.js +124 -0
- package/dist/play/server.js +274 -0
- package/dist/play/session.js +231 -0
- package/dist/play/steps.js +192 -0
- package/dist/playable/build.js +90 -0
- package/dist/playable/cta.js +88 -0
- package/dist/playable/networks.js +33 -0
- package/dist/playable/scan.js +46 -0
- package/dist/playtest/after-round.js +60 -0
- package/dist/playtest/assemble.js +168 -0
- package/dist/playtest/experience-run.js +69 -0
- package/dist/playtest/experience.js +77 -0
- package/dist/playtest/facts.js +90 -0
- package/dist/playtest/fidelity.js +179 -0
- package/dist/playtest/history.js +115 -0
- package/dist/playtest/hits.js +48 -0
- package/dist/playtest/hosted.js +98 -0
- package/dist/playtest/keep.js +110 -0
- package/dist/playtest/ledger.js +77 -0
- package/dist/playtest/length.js +113 -0
- package/dist/playtest/measure.js +181 -0
- package/dist/playtest/mobile-qa.js +391 -0
- package/dist/playtest/mockups.js +198 -0
- package/dist/playtest/moments.js +28 -0
- package/dist/playtest/prepare.js +162 -0
- package/dist/playtest/rank.js +184 -0
- package/dist/playtest/report.js +209 -0
- package/dist/playtest/route.js +139 -0
- package/dist/playtest/seats.js +128 -0
- package/dist/playtest/sheet.js +38 -0
- package/dist/playtest/stop.js +54 -0
- package/dist/playtest/stuck.js +47 -0
- package/dist/production/contract.js +61 -0
- package/dist/production/mirror.js +96 -0
- package/dist/production/tier.js +66 -0
- package/dist/profile/compare.js +171 -0
- package/dist/progress/answers.js +35 -0
- package/dist/progress/holds.js +106 -0
- package/dist/progress/notify.js +25 -0
- package/dist/progress/progress.js +300 -0
- package/dist/publish/build.js +54 -0
- package/dist/publish/folder.js +106 -0
- package/dist/publish/funpixel.js +96 -0
- package/dist/publish/hosts.js +48 -0
- package/dist/reach/envelope.js +111 -0
- package/dist/reach/load.js +84 -0
- package/dist/reach/side.js +320 -0
- package/dist/reach/spec3d.js +338 -0
- package/dist/reach/tiles.js +163 -0
- package/dist/reel/encode.js +34 -0
- package/dist/reel/tour.js +81 -0
- package/dist/relay/bots.js +62 -0
- package/dist/relay/bridge.js +54 -0
- package/dist/relay/local.js +82 -0
- package/dist/relay/redis.js +40 -0
- package/dist/review/audio.js +72 -0
- package/dist/review/ledger.js +60 -0
- package/dist/review/media.js +114 -0
- package/dist/review/model.js +348 -0
- package/dist/review/picture.js +113 -0
- package/dist/review/specs.js +134 -0
- package/dist/review/video.js +248 -0
- package/dist/schema/game.js +308 -0
- package/dist/score/comfort.js +79 -0
- package/dist/score/light.js +62 -0
- package/dist/score/measure.js +386 -0
- package/dist/score/vision.js +59 -0
- package/dist/serve/webgl.js +415 -0
- package/dist/setup/lsp.js +42 -0
- package/dist/sim/curve.js +122 -0
- package/dist/sim/judge.js +240 -0
- package/dist/sim/skeleton.js +65 -0
- package/dist/simulator/lease.js +159 -0
- package/dist/simulator/orient.js +57 -0
- package/dist/simulator/screen.js +113 -0
- package/dist/simulator/simctl.js +79 -0
- package/dist/smoke/art.js +20 -0
- package/dist/smoke/checks.js +165 -0
- package/dist/smoke/logic.js +73 -0
- package/dist/smoke/orphans.js +78 -0
- package/dist/smoke/palette.js +16 -0
- package/dist/smoke/sources.js +36 -0
- package/dist/sound/beats.js +95 -0
- package/dist/sound/loudness.js +94 -0
- package/dist/spec/extract.js +123 -0
- package/dist/spec/lint.js +261 -0
- package/dist/spec/presets.js +30 -0
- package/dist/spec/rooms.js +188 -0
- package/dist/spec/scaffold.js +457 -0
- package/dist/spec/sections.js +16 -0
- package/dist/spec/tunables.js +74 -0
- package/dist/stage/harnessignore.js +90 -0
- package/dist/stage/stage.js +57 -0
- package/dist/stage/tar.js +41 -0
- package/dist/status/board.js +172 -0
- package/dist/status/file.js +112 -0
- package/dist/status/inbox.js +55 -0
- package/dist/status/status.js +311 -0
- package/dist/store/answers.js +47 -0
- package/dist/store/doctor.js +120 -0
- package/dist/store/images.js +65 -0
- package/dist/store/init.js +101 -0
- package/dist/store/lint.js +392 -0
- package/dist/store/plan.js +133 -0
- package/dist/store/sdks.js +107 -0
- package/dist/studio/forks.js +93 -0
- package/dist/studio/pitch.js +294 -0
- package/dist/studio/widen.js +212 -0
- package/dist/suite/node-run.js +81 -0
- package/dist/suite/test-types.js +71 -0
- package/dist/trailer/assemble.js +90 -0
- package/dist/trailer/beats.js +74 -0
- package/dist/trailer/cards.js +77 -0
- package/dist/trailer/cues.js +78 -0
- package/dist/trailer/cut.js +49 -0
- package/dist/trailer/find.js +33 -0
- package/dist/trailer/mix.js +109 -0
- package/dist/trailer/placement.js +30 -0
- package/dist/types.js +1 -0
- package/dist/ui.js +79 -0
- package/dist/unity/bridge.js +251 -0
- package/dist/unity/disk.js +666 -0
- package/dist/unity/editor.js +471 -0
- package/dist/unity/gc.js +140 -0
- package/dist/unity/mcp-stdio.js +141 -0
- package/dist/unity/probe/budgets.js +84 -0
- package/dist/unity/probe/client.js +93 -0
- package/dist/unity/probe/install.js +118 -0
- package/dist/unity/probe/player.js +255 -0
- package/dist/unity/probe/report.js +102 -0
- package/dist/unity/probe/script.js +225 -0
- package/dist/unity/queue.js +353 -0
- package/dist/unity/run.js +172 -0
- package/dist/update.js +111 -0
- package/dist/variety/compare.js +104 -0
- package/dist/variety/places.js +109 -0
- package/dist/variety/profile.js +127 -0
- package/dist/vendor/verify/README.md +19 -0
- package/dist/vendor/verify/package.json +14 -0
- package/dist/vendor/verify/src/index.d.ts +105 -0
- package/dist/vendor/verify/src/index.js +78 -0
- package/dist/vendor/verify/src/init/preview_shim.js +63 -0
- package/dist/vendor/verify/src/page/actors.js +258 -0
- package/dist/vendor/verify/src/page/audio.js +106 -0
- package/dist/vendor/verify/src/page/audio_cues.js +141 -0
- package/dist/vendor/verify/src/page/audio_files.js +56 -0
- package/dist/vendor/verify/src/page/bot_sweep.js +72 -0
- package/dist/vendor/verify/src/page/capture_view.js +164 -0
- package/dist/vendor/verify/src/page/context_loss_listener.js +23 -0
- package/dist/vendor/verify/src/page/dressing.js +106 -0
- package/dist/vendor/verify/src/page/enter_view.js +33 -0
- package/dist/vendor/verify/src/page/feel.js +126 -0
- package/dist/vendor/verify/src/page/feel_sweep.js +75 -0
- package/dist/vendor/verify/src/page/first_paint.js +54 -0
- package/dist/vendor/verify/src/page/fonts.js +50 -0
- package/dist/vendor/verify/src/page/frame_honesty.js +44 -0
- package/dist/vendor/verify/src/page/front_door.js +197 -0
- package/dist/vendor/verify/src/page/grounding.js +448 -0
- package/dist/vendor/verify/src/page/hooks.js +74 -0
- package/dist/vendor/verify/src/page/hud.js +261 -0
- package/dist/vendor/verify/src/page/inventory.js +15 -0
- package/dist/vendor/verify/src/page/layout.js +378 -0
- package/dist/vendor/verify/src/page/levels.js +40 -0
- package/dist/vendor/verify/src/page/life.js +123 -0
- package/dist/vendor/verify/src/page/life_anim.js +501 -0
- package/dist/vendor/verify/src/page/made_of.js +83 -0
- package/dist/vendor/verify/src/page/mechanic_check.js +272 -0
- package/dist/vendor/verify/src/page/moments.js +36 -0
- package/dist/vendor/verify/src/page/motion.js +139 -0
- package/dist/vendor/verify/src/page/perf.js +255 -0
- package/dist/vendor/verify/src/page/phone_check.js +229 -0
- package/dist/vendor/verify/src/page/play.js +117 -0
- package/dist/vendor/verify/src/page/play_act.js +164 -0
- package/dist/vendor/verify/src/page/preview.js +33 -0
- package/dist/vendor/verify/src/page/recorder.js +54 -0
- package/dist/vendor/verify/src/page/render_health.js +83 -0
- package/dist/vendor/verify/src/page/renderer.js +75 -0
- package/dist/vendor/verify/src/page/scene.js +222 -0
- package/dist/vendor/verify/src/page/self_test.js +25 -0
- package/dist/vendor/verify/src/page/step_clock.js +247 -0
- package/dist/vendor/verify/src/page/surfaces.js +261 -0
- package/dist/vendor/verify/src/page/world_actors.js +264 -0
- package/dist/verify/browser.js +245 -0
- package/dist/verify/console.js +34 -0
- package/dist/verify/fingerprint.js +72 -0
- package/dist/verify/gpu.js +33 -0
- package/dist/verify/health.js +172 -0
- package/dist/verify/hooks.js +34 -0
- package/dist/verify/judge.js +303 -0
- package/dist/verify/players.js +123 -0
- package/dist/verify/probe.js +236 -0
- package/dist/verify/reads.js +32 -0
- package/dist/verify/run.js +56 -0
- package/dist/verify/serve.js +36 -0
- package/dist/walk/film.js +37 -0
- package/dist/walk/judge.js +287 -0
- package/dist/walk/routes.js +199 -0
- package/dist/walk/world.js +292 -0
- package/dist/world/brief.js +86 -0
- package/dist/world/check.js +254 -0
- package/dist/world/forge.js +542 -0
- package/dist/world/format.js +40 -0
- package/dist/world/variety.js +59 -0
- package/dist/wow/catalogue.js +86 -0
- package/dist/wow/picks.js +74 -0
- package/package.json +51 -4
- package/panel/asset-identity.md +61 -0
- package/panel/asset-structure.md +55 -0
- package/panel/blockers.md +47 -0
- package/panel/brief.md +89 -0
- package/panel/clip.md +54 -0
- package/panel/experience-personas.json +4 -0
- package/panel/experience.md +96 -0
- package/panel/fidelity-ui.md +74 -0
- package/panel/fidelity.md +83 -0
- package/panel/greenlight-pitch.md +69 -0
- package/panel/greenlight.md +87 -0
- package/panel/mobile-qa.md +128 -0
- package/panel/personas.json +6 -0
- package/panel/reference-match.md +12 -0
- package/panel/versus.md +31 -0
- package/plugins/.agents/plugins/marketplace.json +18 -0
- package/plugins/.claude-plugin/marketplace.json +17 -0
- package/plugins/.cursor-plugin/marketplace.json +13 -0
- package/plugins/LICENSE +115 -0
- package/plugins/README.md +16 -0
- package/plugins/THIRD_PARTY_NOTICES.md +75 -0
- package/plugins/claude/.claude-plugin/plugin.json +19 -0
- package/plugins/claude/.mcp.json +10 -0
- package/plugins/claude/LICENSE +115 -0
- package/plugins/claude/README.md +14 -0
- package/plugins/claude/THIRD_PARTY_NOTICES.md +75 -0
- package/plugins/claude/agents/art-director.md +54 -0
- package/plugins/claude/agents/audio-director.md +51 -0
- package/plugins/claude/agents/critic.md +113 -0
- package/plugins/claude/agents/lane.md +38 -0
- package/plugins/claude/agents/level-designer.md +45 -0
- package/plugins/claude/agents/mobile-qa.md +71 -0
- package/plugins/claude/agents/player.md +144 -0
- package/plugins/claude/agents/qa-lead.md +52 -0
- package/plugins/claude/commands/first-look.md +59 -0
- package/plugins/claude/commands/flow.md +50 -0
- package/plugins/claude/commands/lanes.md +38 -0
- package/plugins/claude/commands/mobile-qa.md +28 -0
- package/plugins/claude/commands/new.md +94 -0
- package/plugins/claude/commands/playtest.md +66 -0
- package/plugins/claude/commands/publish.md +23 -0
- package/plugins/claude/commands/smoke-build.md +25 -0
- package/plugins/claude/commands/verify.md +20 -0
- package/plugins/claude/hooks/brief.md +135 -0
- package/plugins/claude/hooks/critic-receipts.mjs +86 -0
- package/plugins/claude/hooks/durable.mjs +56 -0
- package/plugins/claude/hooks/fence.mjs +30 -0
- package/plugins/claude/hooks/floors.mjs +181 -0
- package/plugins/claude/hooks/flow.mjs +154 -0
- package/plugins/claude/hooks/front-door.mjs +68 -0
- package/plugins/claude/hooks/guidance.json +3 -0
- package/plugins/claude/hooks/hints.mjs +183 -0
- package/plugins/claude/hooks/hooks.json +62 -0
- package/plugins/claude/hooks/lib.mjs +362 -0
- package/plugins/claude/hooks/memory.mjs +92 -0
- package/plugins/claude/hooks/mobile-qa.mjs +43 -0
- package/plugins/claude/hooks/note.mjs +63 -0
- package/plugins/claude/hooks/nudge.mjs +98 -0
- package/plugins/claude/hooks/pipeline.mjs +207 -0
- package/plugins/claude/hooks/prompt.mjs +51 -0
- package/plugins/claude/hooks/quality.mjs +310 -0
- package/plugins/claude/hooks/reach.mjs +93 -0
- package/plugins/claude/hooks/scope.mjs +44 -0
- package/plugins/claude/hooks/session-log.mjs +101 -0
- package/plugins/claude/hooks/session-start.mjs +194 -0
- package/plugins/claude/hooks/skill-names.json +19 -0
- package/plugins/claude/hooks/stop-gate.mjs +303 -0
- package/plugins/claude/hooks/vendor/direct/round.mjs +81 -0
- package/plugins/claude/hooks/vendor/find/names.mjs +46 -0
- package/plugins/claude/hooks/vendor/firstlook/set.mjs +219 -0
- package/plugins/claude/hooks/vendor/flow/flow.mjs +456 -0
- package/plugins/claude/hooks/vendor/flow/look.mjs +140 -0
- package/plugins/claude/hooks/vendor/gdd/book.mjs +484 -0
- package/plugins/claude/hooks/vendor/gdd/chapters.mjs +72 -0
- package/plugins/claude/hooks/vendor/gdd/doc.mjs +33 -0
- package/plugins/claude/hooks/vendor/gdd/levelmap.mjs +429 -0
- package/plugins/claude/hooks/vendor/gdd/rubric.mjs +251 -0
- package/plugins/claude/hooks/vendor/gdd/worth.mjs +508 -0
- package/plugins/claude/hooks/vendor/lanes/fence.mjs +109 -0
- package/plugins/claude/hooks/vendor/lanes/lanes.mjs +356 -0
- package/plugins/claude/hooks/vendor/lanes/union.mjs +63 -0
- package/plugins/claude/hooks/vendor/lessons/motifs.mjs +98 -0
- package/plugins/claude/hooks/vendor/lessons/store.mjs +57 -0
- package/plugins/claude/hooks/vendor/look/made-of.mjs +243 -0
- package/plugins/claude/hooks/vendor/look/roles.mjs +110 -0
- package/plugins/claude/hooks/vendor/memory/decisions.mjs +139 -0
- package/plugins/claude/hooks/vendor/memory/journal.mjs +109 -0
- package/plugins/claude/hooks/vendor/owner/bar.mjs +286 -0
- package/plugins/claude/hooks/vendor/pipeline/pipeline.mjs +930 -0
- package/plugins/claude/hooks/vendor/playtest/keep.mjs +111 -0
- package/plugins/claude/hooks/vendor/playtest/stuck.mjs +48 -0
- package/plugins/claude/hooks/vendor/progress/holds.mjs +107 -0
- package/plugins/claude/hooks/vendor/progress/progress.mjs +301 -0
- package/plugins/claude/hooks/vendor/sim/judge.mjs +241 -0
- package/plugins/claude/hooks/vendor/spec/rooms.mjs +189 -0
- package/plugins/claude/hooks/vendor/spec/tunables.mjs +75 -0
- package/plugins/claude/hooks/vendor/stage/harnessignore.mjs +91 -0
- package/plugins/claude/hooks/vendor/stage/stage.mjs +58 -0
- package/plugins/claude/hooks/vendor/status/board.mjs +173 -0
- package/plugins/claude/hooks/vendor/status/file.mjs +113 -0
- package/plugins/claude/hooks/vendor/studio/forks.mjs +94 -0
- package/plugins/claude/hooks/vendor/studio/pitch.mjs +295 -0
- package/plugins/claude/hooks/vendor/verify/fingerprint.mjs +73 -0
- package/plugins/claude/hooks/vendor/verify/reads.mjs +33 -0
- package/plugins/claude/hooks/vendor/wow/picks.mjs +75 -0
- package/plugins/claude/skills/3d/SKILL.md +89 -0
- package/plugins/claude/skills/3d/references/bake-off.md +48 -0
- package/plugins/claude/skills/3d/references/bench.md +103 -0
- package/plugins/claude/skills/3d/references/budgets.md +48 -0
- package/plugins/claude/skills/3d/references/characters.md +67 -0
- package/plugins/claude/skills/3d/references/concept-image.md +47 -0
- package/plugins/claude/skills/3d/references/engine-targets.md +31 -0
- package/plugins/claude/skills/3d/references/hero-route.md +104 -0
- package/plugins/claude/skills/3d/references/level-spec.md +109 -0
- package/plugins/claude/skills/3d/references/levels.md +84 -0
- package/plugins/claude/skills/3d/references/light-and-places.md +141 -0
- package/plugins/claude/skills/3d/references/models.md +111 -0
- package/plugins/claude/skills/3d/references/painted-target.md +184 -0
- package/plugins/claude/skills/3d/references/reading.md +41 -0
- package/plugins/claude/skills/3d/references/skin.md +85 -0
- package/plugins/claude/skills/3d/references/skyboxes.md +65 -0
- package/plugins/claude/skills/3d/references/textures.md +71 -0
- package/plugins/claude/skills/3d/references/three-loading.md +199 -0
- package/plugins/claude/skills/3d/references/unity.md +78 -0
- package/plugins/claude/skills/art/SKILL.md +104 -0
- package/plugins/claude/skills/art/references/2d-assets.md +108 -0
- package/plugins/claude/skills/art/references/animation.md +126 -0
- package/plugins/claude/skills/art/references/cast.md +73 -0
- package/plugins/claude/skills/art/references/characters.md +49 -0
- package/plugins/claude/skills/art/references/cost.md +107 -0
- package/plugins/claude/skills/art/references/effects.md +85 -0
- package/plugins/claude/skills/art/references/frames.md +87 -0
- package/plugins/claude/skills/art/references/judging-frames.md +64 -0
- package/plugins/claude/skills/art/references/look.md +102 -0
- package/plugins/claude/skills/art/references/measure.md +119 -0
- package/plugins/claude/skills/art/references/pipeline.md +185 -0
- package/plugins/claude/skills/art/references/pixi.md +277 -0
- package/plugins/claude/skills/art/references/planes.md +27 -0
- package/plugins/claude/skills/art/references/prompts.md +171 -0
- package/plugins/claude/skills/art/references/sheets.md +141 -0
- package/plugins/claude/skills/art/references/style-file.md +39 -0
- package/plugins/claude/skills/art/references/three.md +232 -0
- package/plugins/claude/skills/art/references/ui.md +163 -0
- package/plugins/claude/skills/art/references/unity.md +78 -0
- package/plugins/claude/skills/art/references/wiring.md +41 -0
- package/plugins/claude/skills/audio/SKILL.md +92 -0
- package/plugins/claude/skills/audio/references/adaptive-music.md +204 -0
- package/plugins/claude/skills/audio/references/engine.md +78 -0
- package/plugins/claude/skills/audio/references/measure.md +101 -0
- package/plugins/claude/skills/audio/references/unity.md +74 -0
- package/plugins/claude/skills/feedback/SKILL.md +120 -0
- package/plugins/claude/skills/feedback/references/memory.md +99 -0
- package/plugins/claude/skills/game-feel/SKILL.md +104 -0
- package/plugins/claude/skills/game-feel/references/contact.md +110 -0
- package/plugins/claude/skills/game-feel/references/measure.md +125 -0
- package/plugins/claude/skills/game-feel/references/motion.md +134 -0
- package/plugins/claude/skills/game-feel/references/payoffs.md +35 -0
- package/plugins/claude/skills/game-feel/references/recipes.md +107 -0
- package/plugins/claude/skills/game-feel/references/unity.md +73 -0
- package/plugins/claude/skills/game-logic/SKILL.md +113 -0
- package/plugins/claude/skills/game-logic/references/balance.md +88 -0
- package/plugins/claude/skills/game-logic/references/content-at-scale.md +147 -0
- package/plugins/claude/skills/game-logic/references/depth.md +89 -0
- package/plugins/claude/skills/game-logic/references/escalation.md +41 -0
- package/plugins/claude/skills/game-logic/references/levels.md +61 -0
- package/plugins/claude/skills/game-logic/references/probes.md +122 -0
- package/plugins/claude/skills/game-logic/references/unity.md +108 -0
- package/plugins/claude/skills/game-spine/SKILL.md +118 -0
- package/plugins/claude/skills/game-spine/references/camera.md +94 -0
- package/plugins/claude/skills/game-spine/references/multiplayer.md +101 -0
- package/plugins/claude/skills/game-spine/references/patterns.md +103 -0
- package/plugins/claude/skills/game-spine/references/performance.md +96 -0
- package/plugins/claude/skills/game-spine/references/pixi.md +26 -0
- package/plugins/claude/skills/game-spine/references/replay.md +102 -0
- package/plugins/claude/skills/game-spine/references/room-api.md +63 -0
- package/plugins/claude/skills/game-spine/references/room-modes.md +40 -0
- package/plugins/claude/skills/game-spine/references/sdk.md +114 -0
- package/plugins/claude/skills/game-spine/references/three.md +62 -0
- package/plugins/claude/skills/gdd/SKILL.md +116 -0
- package/plugins/claude/skills/gdd/references/as-built.md +40 -0
- package/plugins/claude/skills/gdd/references/design-measures.md +24 -0
- package/plugins/claude/skills/gdd/references/design-note.md +88 -0
- package/plugins/claude/skills/gdd/references/experience.md +92 -0
- package/plugins/claude/skills/gdd/references/first-look.md +226 -0
- package/plugins/claude/skills/gdd/references/floors.md +62 -0
- package/plugins/claude/skills/gdd/references/frame.md +75 -0
- package/plugins/claude/skills/gdd/references/gameplay-contract.md +81 -0
- package/plugins/claude/skills/gdd/references/gdd-template.md +417 -0
- package/plugins/claude/skills/gdd/references/genre-card.md +109 -0
- package/plugins/claude/skills/gdd/references/genre-platformer.md +159 -0
- package/plugins/claude/skills/gdd/references/genre-puzzle.md +145 -0
- package/plugins/claude/skills/gdd/references/genre-racing.md +137 -0
- package/plugins/claude/skills/gdd/references/genre-rpg.md +125 -0
- package/plugins/claude/skills/gdd/references/genre-shooter.md +128 -0
- package/plugins/claude/skills/gdd/references/genre-simulation.md +112 -0
- package/plugins/claude/skills/gdd/references/genre-strategy.md +116 -0
- package/plugins/claude/skills/gdd/references/genre-survival.md +122 -0
- package/plugins/claude/skills/gdd/references/in-the-loop.md +106 -0
- package/plugins/claude/skills/gdd/references/invent-first.md +131 -0
- package/plugins/claude/skills/gdd/references/level-and-fun.md +112 -0
- package/plugins/claude/skills/gdd/references/pages.md +47 -0
- package/plugins/claude/skills/gdd/references/plan-at-size.md +140 -0
- package/plugins/claude/skills/gdd/references/production-tiers.md +117 -0
- package/plugins/claude/skills/gdd/references/sections.md +148 -0
- package/plugins/claude/skills/gdd/references/spec-folder.md +131 -0
- package/plugins/claude/skills/gdd/references/start.md +110 -0
- package/plugins/claude/skills/gdd/references/starters.md +175 -0
- package/plugins/claude/skills/gdd/references/the-path.md +133 -0
- package/plugins/claude/skills/gdd/references/track.md +29 -0
- package/plugins/claude/skills/gdd/references/world-and-identity.md +165 -0
- package/plugins/claude/skills/gdd/references/worth.md +74 -0
- package/plugins/claude/skills/mobile-ui/SKILL.md +107 -0
- package/plugins/claude/skills/mobile-ui/references/contrast.md +123 -0
- package/plugins/claude/skills/mobile-ui/references/hud-and-title.md +108 -0
- package/plugins/claude/skills/mobile-ui/references/hud-genres.md +124 -0
- package/plugins/claude/skills/mobile-ui/references/phone-check.md +156 -0
- package/plugins/claude/skills/mobile-ui/references/recipes.md +279 -0
- package/plugins/claude/skills/mobile-ui/references/restyle-ui.md +229 -0
- package/plugins/claude/skills/mobile-ui/references/unity.md +61 -0
- package/plugins/claude/skills/publishing/SKILL.md +109 -0
- package/plugins/claude/skills/publishing/references/compose.md +113 -0
- package/plugins/claude/skills/publishing/references/motion.md +120 -0
- package/plugins/claude/skills/publishing/references/networks.md +75 -0
- package/plugins/claude/skills/publishing/references/other-hosts.md +65 -0
- package/plugins/claude/skills/publishing/references/playable-ad.md +90 -0
- package/plugins/claude/skills/publishing/references/server-build.md +85 -0
- package/plugins/claude/skills/publishing/references/store-shots.md +85 -0
- package/plugins/claude/skills/publishing/references/trailer.md +55 -0
- package/plugins/claude/skills/publishing/references/what-ships.md +30 -0
- package/plugins/claude/skills/store/SKILL.md +81 -0
- package/plugins/claude/skills/store/references/app-store.md +73 -0
- package/plugins/claude/skills/store/references/google-play.md +141 -0
- package/plugins/claude/skills/store/references/ios-release.md +63 -0
- package/plugins/claude/skills/store/references/money.md +66 -0
- package/plugins/claude/skills/store/references/purchases-and-review.md +74 -0
- package/plugins/claude/skills/store/references/readiness-page.md +24 -0
- package/plugins/claude/skills/store/references/readiness.md +107 -0
- package/plugins/claude/skills/store/references/steam.md +38 -0
- package/plugins/claude/skills/store/references/unity-store.md +55 -0
- package/plugins/claude/skills/store/references/web-portals.md +43 -0
- package/plugins/claude/skills/unity-game/SKILL.md +103 -0
- package/plugins/claude/skills/unity-game/references/agent-ops.md +54 -0
- package/plugins/claude/skills/unity-game/references/fixes.md +40 -0
- package/plugins/claude/skills/unity-game/references/from-a-web-game.md +108 -0
- package/plugins/claude/skills/unity-game/references/handing-off.md +42 -0
- package/plugins/claude/skills/unity-game/references/performance.md +59 -0
- package/plugins/claude/skills/unity-game/references/probe.md +80 -0
- package/plugins/claude/skills/unity-game/references/shared-mac.md +121 -0
- package/plugins/claude/skills/unity-game/references/traps.md +108 -0
- package/plugins/claude/skills/verifying/SKILL.md +109 -0
- package/plugins/claude/skills/verifying/references/actors.md +94 -0
- package/plugins/claude/skills/verifying/references/bar.md +62 -0
- package/plugins/claude/skills/verifying/references/checks.md +69 -0
- package/plugins/claude/skills/verifying/references/experience.md +67 -0
- package/plugins/claude/skills/verifying/references/eyes.md +54 -0
- package/plugins/claude/skills/verifying/references/fidelity.md +126 -0
- package/plugins/claude/skills/verifying/references/hit-bar.md +31 -0
- package/plugins/claude/skills/verifying/references/journeys.md +77 -0
- package/plugins/claude/skills/verifying/references/mobile-qa.md +123 -0
- package/plugins/claude/skills/verifying/references/playtest.md +161 -0
- package/plugins/claude/skills/verifying/references/review.md +105 -0
- package/plugins/claude/skills/verifying/references/rubric.md +67 -0
- package/plugins/claude/skills/verifying/references/scenes.md +49 -0
- package/plugins/claude/skills/verifying/references/unity.md +60 -0
- package/plugins/claude/skills/world-and-story/SKILL.md +99 -0
- package/plugins/claude/skills/world-and-story/references/atmosphere.md +208 -0
- package/plugins/claude/skills/world-and-story/references/forged-world.md +79 -0
- package/plugins/claude/skills/world-and-story/references/living-world.md +237 -0
- package/plugins/claude/skills/world-and-story/references/opening-and-chapters.md +215 -0
- package/plugins/claude/skills/world-and-story/references/shelf.md +80 -0
- package/plugins/claude/skills/world-and-story/references/story-at-size.md +159 -0
- package/plugins/claude/skills/world-and-story/references/voice.md +175 -0
- package/plugins/claude/skills/world-and-story/references/world-kit.md +154 -0
- package/plugins/codex/.codex-plugin/plugin.json +27 -0
- package/plugins/codex/.mcp.json +7 -0
- package/plugins/codex/AGENTS.md +135 -0
- package/plugins/codex/LICENSE +115 -0
- package/plugins/codex/README.md +17 -0
- package/plugins/codex/THIRD_PARTY_NOTICES.md +75 -0
- package/plugins/codex/hooks/brief.md +135 -0
- package/plugins/codex/hooks/codex-critic.mjs +15 -0
- package/plugins/codex/hooks/critic-receipts.mjs +86 -0
- package/plugins/codex/hooks/durable.mjs +56 -0
- package/plugins/codex/hooks/fence.mjs +30 -0
- package/plugins/codex/hooks/floors.mjs +181 -0
- package/plugins/codex/hooks/flow.mjs +154 -0
- package/plugins/codex/hooks/front-door.mjs +68 -0
- package/plugins/codex/hooks/guidance.json +3 -0
- package/plugins/codex/hooks/hints.mjs +183 -0
- package/plugins/codex/hooks/hooks.json +59 -0
- package/plugins/codex/hooks/host.md +54 -0
- package/plugins/codex/hooks/lib.mjs +362 -0
- package/plugins/codex/hooks/memory.mjs +92 -0
- package/plugins/codex/hooks/mobile-qa.mjs +43 -0
- package/plugins/codex/hooks/note.mjs +63 -0
- package/plugins/codex/hooks/nudge.mjs +98 -0
- package/plugins/codex/hooks/pipeline.mjs +207 -0
- package/plugins/codex/hooks/prompt.mjs +51 -0
- package/plugins/codex/hooks/quality.mjs +310 -0
- package/plugins/codex/hooks/reach.mjs +93 -0
- package/plugins/codex/hooks/scope.mjs +44 -0
- package/plugins/codex/hooks/session-log.mjs +101 -0
- package/plugins/codex/hooks/session-start.mjs +194 -0
- package/plugins/codex/hooks/stop-gate.mjs +303 -0
- package/plugins/codex/hooks/vendor/direct/round.mjs +81 -0
- package/plugins/codex/hooks/vendor/find/names.mjs +46 -0
- package/plugins/codex/hooks/vendor/firstlook/set.mjs +219 -0
- package/plugins/codex/hooks/vendor/flow/flow.mjs +456 -0
- package/plugins/codex/hooks/vendor/flow/look.mjs +140 -0
- package/plugins/codex/hooks/vendor/gdd/book.mjs +484 -0
- package/plugins/codex/hooks/vendor/gdd/chapters.mjs +72 -0
- package/plugins/codex/hooks/vendor/gdd/doc.mjs +33 -0
- package/plugins/codex/hooks/vendor/gdd/levelmap.mjs +429 -0
- package/plugins/codex/hooks/vendor/gdd/rubric.mjs +251 -0
- package/plugins/codex/hooks/vendor/gdd/worth.mjs +508 -0
- package/plugins/codex/hooks/vendor/lanes/fence.mjs +109 -0
- package/plugins/codex/hooks/vendor/lanes/lanes.mjs +356 -0
- package/plugins/codex/hooks/vendor/lanes/union.mjs +63 -0
- package/plugins/codex/hooks/vendor/lessons/motifs.mjs +98 -0
- package/plugins/codex/hooks/vendor/lessons/store.mjs +57 -0
- package/plugins/codex/hooks/vendor/look/made-of.mjs +243 -0
- package/plugins/codex/hooks/vendor/look/roles.mjs +110 -0
- package/plugins/codex/hooks/vendor/memory/decisions.mjs +139 -0
- package/plugins/codex/hooks/vendor/memory/journal.mjs +109 -0
- package/plugins/codex/hooks/vendor/owner/bar.mjs +286 -0
- package/plugins/codex/hooks/vendor/pipeline/pipeline.mjs +930 -0
- package/plugins/codex/hooks/vendor/playtest/keep.mjs +111 -0
- package/plugins/codex/hooks/vendor/playtest/stuck.mjs +48 -0
- package/plugins/codex/hooks/vendor/progress/holds.mjs +107 -0
- package/plugins/codex/hooks/vendor/progress/progress.mjs +301 -0
- package/plugins/codex/hooks/vendor/sim/judge.mjs +241 -0
- package/plugins/codex/hooks/vendor/spec/rooms.mjs +189 -0
- package/plugins/codex/hooks/vendor/spec/tunables.mjs +75 -0
- package/plugins/codex/hooks/vendor/stage/harnessignore.mjs +91 -0
- package/plugins/codex/hooks/vendor/stage/stage.mjs +58 -0
- package/plugins/codex/hooks/vendor/status/board.mjs +173 -0
- package/plugins/codex/hooks/vendor/status/file.mjs +113 -0
- package/plugins/codex/hooks/vendor/studio/forks.mjs +94 -0
- package/plugins/codex/hooks/vendor/studio/pitch.mjs +295 -0
- package/plugins/codex/hooks/vendor/verify/fingerprint.mjs +73 -0
- package/plugins/codex/hooks/vendor/verify/reads.mjs +33 -0
- package/plugins/codex/hooks/vendor/wow/picks.mjs +75 -0
- package/plugins/codex/mcp.json +9 -0
- package/plugins/codex/plugin.json +26 -0
- package/plugins/codex/skills/fp-art-director/SKILL.md +58 -0
- package/plugins/codex/skills/fp-art-director/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-art-director/references/codex.md +54 -0
- package/plugins/codex/skills/fp-audio-director/SKILL.md +55 -0
- package/plugins/codex/skills/fp-audio-director/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-audio-director/references/codex.md +54 -0
- package/plugins/codex/skills/fp-critic/SKILL.md +117 -0
- package/plugins/codex/skills/fp-critic/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-critic/references/codex.md +54 -0
- package/plugins/codex/skills/fp-first-look/SKILL.md +59 -0
- package/plugins/codex/skills/fp-first-look/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-flow/SKILL.md +50 -0
- package/plugins/codex/skills/fp-flow/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-lane/SKILL.md +41 -0
- package/plugins/codex/skills/fp-lane/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-lane/references/codex.md +54 -0
- package/plugins/codex/skills/fp-lanes/SKILL.md +38 -0
- package/plugins/codex/skills/fp-lanes/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-level-designer/SKILL.md +49 -0
- package/plugins/codex/skills/fp-level-designer/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-level-designer/references/codex.md +54 -0
- package/plugins/codex/skills/fp-mobile-qa/SKILL.md +28 -0
- package/plugins/codex/skills/fp-mobile-qa/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-mobile-qa-seat/SKILL.md +74 -0
- package/plugins/codex/skills/fp-mobile-qa-seat/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-mobile-qa-seat/references/codex.md +54 -0
- package/plugins/codex/skills/fp-new/SKILL.md +94 -0
- package/plugins/codex/skills/fp-new/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-player/SKILL.md +147 -0
- package/plugins/codex/skills/fp-player/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-player/references/codex.md +54 -0
- package/plugins/codex/skills/fp-playtest/SKILL.md +66 -0
- package/plugins/codex/skills/fp-playtest/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-publish/SKILL.md +23 -0
- package/plugins/codex/skills/fp-publish/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-qa-lead/SKILL.md +56 -0
- package/plugins/codex/skills/fp-qa-lead/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-qa-lead/references/codex.md +54 -0
- package/plugins/codex/skills/fp-smoke-build/SKILL.md +25 -0
- package/plugins/codex/skills/fp-smoke-build/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-studio/SKILL.md +59 -0
- package/plugins/codex/skills/fp-studio/agents/openai.yaml +12 -0
- package/plugins/codex/skills/fp-verify/SKILL.md +20 -0
- package/plugins/codex/skills/fp-verify/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-3d/SKILL.md +89 -0
- package/plugins/codex/skills/funpixel-3d/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-3d/references/bake-off.md +48 -0
- package/plugins/codex/skills/funpixel-3d/references/bench.md +103 -0
- package/plugins/codex/skills/funpixel-3d/references/budgets.md +48 -0
- package/plugins/codex/skills/funpixel-3d/references/characters.md +67 -0
- package/plugins/codex/skills/funpixel-3d/references/concept-image.md +47 -0
- package/plugins/codex/skills/funpixel-3d/references/engine-targets.md +31 -0
- package/plugins/codex/skills/funpixel-3d/references/hero-route.md +104 -0
- package/plugins/codex/skills/funpixel-3d/references/level-spec.md +109 -0
- package/plugins/codex/skills/funpixel-3d/references/levels.md +84 -0
- package/plugins/codex/skills/funpixel-3d/references/light-and-places.md +141 -0
- package/plugins/codex/skills/funpixel-3d/references/models.md +111 -0
- package/plugins/codex/skills/funpixel-3d/references/painted-target.md +184 -0
- package/plugins/codex/skills/funpixel-3d/references/reading.md +41 -0
- package/plugins/codex/skills/funpixel-3d/references/skin.md +85 -0
- package/plugins/codex/skills/funpixel-3d/references/skyboxes.md +65 -0
- package/plugins/codex/skills/funpixel-3d/references/textures.md +71 -0
- package/plugins/codex/skills/funpixel-3d/references/three-loading.md +199 -0
- package/plugins/codex/skills/funpixel-3d/references/unity.md +78 -0
- package/plugins/codex/skills/funpixel-art/SKILL.md +104 -0
- package/plugins/codex/skills/funpixel-art/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-art/references/2d-assets.md +108 -0
- package/plugins/codex/skills/funpixel-art/references/animation.md +126 -0
- package/plugins/codex/skills/funpixel-art/references/cast.md +73 -0
- package/plugins/codex/skills/funpixel-art/references/characters.md +49 -0
- package/plugins/codex/skills/funpixel-art/references/cost.md +107 -0
- package/plugins/codex/skills/funpixel-art/references/effects.md +85 -0
- package/plugins/codex/skills/funpixel-art/references/frames.md +87 -0
- package/plugins/codex/skills/funpixel-art/references/judging-frames.md +64 -0
- package/plugins/codex/skills/funpixel-art/references/look.md +102 -0
- package/plugins/codex/skills/funpixel-art/references/measure.md +119 -0
- package/plugins/codex/skills/funpixel-art/references/pipeline.md +185 -0
- package/plugins/codex/skills/funpixel-art/references/pixi.md +277 -0
- package/plugins/codex/skills/funpixel-art/references/planes.md +27 -0
- package/plugins/codex/skills/funpixel-art/references/prompts.md +171 -0
- package/plugins/codex/skills/funpixel-art/references/sheets.md +141 -0
- package/plugins/codex/skills/funpixel-art/references/style-file.md +39 -0
- package/plugins/codex/skills/funpixel-art/references/three.md +232 -0
- package/plugins/codex/skills/funpixel-art/references/ui.md +163 -0
- package/plugins/codex/skills/funpixel-art/references/unity.md +78 -0
- package/plugins/codex/skills/funpixel-art/references/wiring.md +41 -0
- package/plugins/codex/skills/funpixel-audio/SKILL.md +92 -0
- package/plugins/codex/skills/funpixel-audio/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-audio/references/adaptive-music.md +204 -0
- package/plugins/codex/skills/funpixel-audio/references/engine.md +78 -0
- package/plugins/codex/skills/funpixel-audio/references/measure.md +101 -0
- package/plugins/codex/skills/funpixel-audio/references/unity.md +74 -0
- package/plugins/codex/skills/funpixel-feedback/SKILL.md +120 -0
- package/plugins/codex/skills/funpixel-feedback/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-feedback/references/memory.md +99 -0
- package/plugins/codex/skills/funpixel-game-feel/SKILL.md +104 -0
- package/plugins/codex/skills/funpixel-game-feel/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-game-feel/references/contact.md +110 -0
- package/plugins/codex/skills/funpixel-game-feel/references/measure.md +125 -0
- package/plugins/codex/skills/funpixel-game-feel/references/motion.md +134 -0
- package/plugins/codex/skills/funpixel-game-feel/references/payoffs.md +35 -0
- package/plugins/codex/skills/funpixel-game-feel/references/recipes.md +107 -0
- package/plugins/codex/skills/funpixel-game-feel/references/unity.md +73 -0
- package/plugins/codex/skills/funpixel-game-logic/SKILL.md +113 -0
- package/plugins/codex/skills/funpixel-game-logic/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-game-logic/references/balance.md +88 -0
- package/plugins/codex/skills/funpixel-game-logic/references/content-at-scale.md +147 -0
- package/plugins/codex/skills/funpixel-game-logic/references/depth.md +89 -0
- package/plugins/codex/skills/funpixel-game-logic/references/escalation.md +41 -0
- package/plugins/codex/skills/funpixel-game-logic/references/levels.md +61 -0
- package/plugins/codex/skills/funpixel-game-logic/references/probes.md +122 -0
- package/plugins/codex/skills/funpixel-game-logic/references/unity.md +108 -0
- package/plugins/codex/skills/funpixel-game-spine/SKILL.md +118 -0
- package/plugins/codex/skills/funpixel-game-spine/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-game-spine/references/camera.md +94 -0
- package/plugins/codex/skills/funpixel-game-spine/references/multiplayer.md +101 -0
- package/plugins/codex/skills/funpixel-game-spine/references/patterns.md +103 -0
- package/plugins/codex/skills/funpixel-game-spine/references/performance.md +96 -0
- package/plugins/codex/skills/funpixel-game-spine/references/pixi.md +26 -0
- package/plugins/codex/skills/funpixel-game-spine/references/replay.md +102 -0
- package/plugins/codex/skills/funpixel-game-spine/references/room-api.md +63 -0
- package/plugins/codex/skills/funpixel-game-spine/references/room-modes.md +40 -0
- package/plugins/codex/skills/funpixel-game-spine/references/sdk.md +114 -0
- package/plugins/codex/skills/funpixel-game-spine/references/three.md +62 -0
- package/plugins/codex/skills/funpixel-gdd/SKILL.md +116 -0
- package/plugins/codex/skills/funpixel-gdd/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-gdd/references/as-built.md +40 -0
- package/plugins/codex/skills/funpixel-gdd/references/design-measures.md +24 -0
- package/plugins/codex/skills/funpixel-gdd/references/design-note.md +88 -0
- package/plugins/codex/skills/funpixel-gdd/references/experience.md +92 -0
- package/plugins/codex/skills/funpixel-gdd/references/first-look.md +226 -0
- package/plugins/codex/skills/funpixel-gdd/references/floors.md +62 -0
- package/plugins/codex/skills/funpixel-gdd/references/frame.md +75 -0
- package/plugins/codex/skills/funpixel-gdd/references/gameplay-contract.md +81 -0
- package/plugins/codex/skills/funpixel-gdd/references/gdd-template.md +417 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-card.md +109 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-platformer.md +159 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-puzzle.md +145 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-racing.md +137 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-rpg.md +125 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-shooter.md +128 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-simulation.md +112 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-strategy.md +116 -0
- package/plugins/codex/skills/funpixel-gdd/references/genre-survival.md +122 -0
- package/plugins/codex/skills/funpixel-gdd/references/in-the-loop.md +106 -0
- package/plugins/codex/skills/funpixel-gdd/references/invent-first.md +131 -0
- package/plugins/codex/skills/funpixel-gdd/references/level-and-fun.md +112 -0
- package/plugins/codex/skills/funpixel-gdd/references/pages.md +47 -0
- package/plugins/codex/skills/funpixel-gdd/references/plan-at-size.md +140 -0
- package/plugins/codex/skills/funpixel-gdd/references/production-tiers.md +117 -0
- package/plugins/codex/skills/funpixel-gdd/references/sections.md +148 -0
- package/plugins/codex/skills/funpixel-gdd/references/spec-folder.md +131 -0
- package/plugins/codex/skills/funpixel-gdd/references/start.md +110 -0
- package/plugins/codex/skills/funpixel-gdd/references/starters.md +175 -0
- package/plugins/codex/skills/funpixel-gdd/references/the-path.md +133 -0
- package/plugins/codex/skills/funpixel-gdd/references/track.md +29 -0
- package/plugins/codex/skills/funpixel-gdd/references/world-and-identity.md +165 -0
- package/plugins/codex/skills/funpixel-gdd/references/worth.md +74 -0
- package/plugins/codex/skills/funpixel-mobile-ui/SKILL.md +107 -0
- package/plugins/codex/skills/funpixel-mobile-ui/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-mobile-ui/references/contrast.md +123 -0
- package/plugins/codex/skills/funpixel-mobile-ui/references/hud-and-title.md +108 -0
- package/plugins/codex/skills/funpixel-mobile-ui/references/hud-genres.md +124 -0
- package/plugins/codex/skills/funpixel-mobile-ui/references/phone-check.md +156 -0
- package/plugins/codex/skills/funpixel-mobile-ui/references/recipes.md +279 -0
- package/plugins/codex/skills/funpixel-mobile-ui/references/restyle-ui.md +229 -0
- package/plugins/codex/skills/funpixel-mobile-ui/references/unity.md +61 -0
- package/plugins/codex/skills/funpixel-publish/SKILL.md +109 -0
- package/plugins/codex/skills/funpixel-publish/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-publish/references/compose.md +113 -0
- package/plugins/codex/skills/funpixel-publish/references/motion.md +120 -0
- package/plugins/codex/skills/funpixel-publish/references/networks.md +75 -0
- package/plugins/codex/skills/funpixel-publish/references/other-hosts.md +65 -0
- package/plugins/codex/skills/funpixel-publish/references/playable-ad.md +90 -0
- package/plugins/codex/skills/funpixel-publish/references/server-build.md +85 -0
- package/plugins/codex/skills/funpixel-publish/references/store-shots.md +85 -0
- package/plugins/codex/skills/funpixel-publish/references/trailer.md +55 -0
- package/plugins/codex/skills/funpixel-publish/references/what-ships.md +30 -0
- package/plugins/codex/skills/funpixel-store/SKILL.md +81 -0
- package/plugins/codex/skills/funpixel-store/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-store/references/app-store.md +73 -0
- package/plugins/codex/skills/funpixel-store/references/google-play.md +141 -0
- package/plugins/codex/skills/funpixel-store/references/ios-release.md +63 -0
- package/plugins/codex/skills/funpixel-store/references/money.md +66 -0
- package/plugins/codex/skills/funpixel-store/references/purchases-and-review.md +74 -0
- package/plugins/codex/skills/funpixel-store/references/readiness-page.md +24 -0
- package/plugins/codex/skills/funpixel-store/references/readiness.md +107 -0
- package/plugins/codex/skills/funpixel-store/references/steam.md +38 -0
- package/plugins/codex/skills/funpixel-store/references/unity-store.md +55 -0
- package/plugins/codex/skills/funpixel-store/references/web-portals.md +43 -0
- package/plugins/codex/skills/funpixel-unity-game/SKILL.md +103 -0
- package/plugins/codex/skills/funpixel-unity-game/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-unity-game/references/agent-ops.md +54 -0
- package/plugins/codex/skills/funpixel-unity-game/references/fixes.md +40 -0
- package/plugins/codex/skills/funpixel-unity-game/references/from-a-web-game.md +108 -0
- package/plugins/codex/skills/funpixel-unity-game/references/handing-off.md +42 -0
- package/plugins/codex/skills/funpixel-unity-game/references/performance.md +59 -0
- package/plugins/codex/skills/funpixel-unity-game/references/probe.md +80 -0
- package/plugins/codex/skills/funpixel-unity-game/references/shared-mac.md +121 -0
- package/plugins/codex/skills/funpixel-unity-game/references/traps.md +108 -0
- package/plugins/codex/skills/funpixel-verify/SKILL.md +109 -0
- package/plugins/codex/skills/funpixel-verify/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-verify/references/actors.md +94 -0
- package/plugins/codex/skills/funpixel-verify/references/bar.md +62 -0
- package/plugins/codex/skills/funpixel-verify/references/checks.md +69 -0
- package/plugins/codex/skills/funpixel-verify/references/experience.md +67 -0
- package/plugins/codex/skills/funpixel-verify/references/eyes.md +54 -0
- package/plugins/codex/skills/funpixel-verify/references/fidelity.md +126 -0
- package/plugins/codex/skills/funpixel-verify/references/hit-bar.md +31 -0
- package/plugins/codex/skills/funpixel-verify/references/journeys.md +77 -0
- package/plugins/codex/skills/funpixel-verify/references/mobile-qa.md +123 -0
- package/plugins/codex/skills/funpixel-verify/references/playtest.md +161 -0
- package/plugins/codex/skills/funpixel-verify/references/review.md +105 -0
- package/plugins/codex/skills/funpixel-verify/references/rubric.md +67 -0
- package/plugins/codex/skills/funpixel-verify/references/scenes.md +49 -0
- package/plugins/codex/skills/funpixel-verify/references/unity.md +60 -0
- package/plugins/codex/skills/funpixel-world-and-story/SKILL.md +99 -0
- package/plugins/codex/skills/funpixel-world-and-story/agents/openai.yaml +12 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/atmosphere.md +208 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/forged-world.md +79 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/living-world.md +237 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/opening-and-chapters.md +215 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/shelf.md +80 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/story-at-size.md +159 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/voice.md +175 -0
- package/plugins/codex/skills/funpixel-world-and-story/references/world-kit.md +154 -0
- package/plugins/cursor/.cursor-plugin/plugin.json +26 -0
- package/plugins/cursor/LICENSE +115 -0
- package/plugins/cursor/README.md +13 -0
- package/plugins/cursor/THIRD_PARTY_NOTICES.md +75 -0
- package/plugins/cursor/agents/art-director.md +54 -0
- package/plugins/cursor/agents/audio-director.md +51 -0
- package/plugins/cursor/agents/critic.md +113 -0
- package/plugins/cursor/agents/lane.md +37 -0
- package/plugins/cursor/agents/level-designer.md +45 -0
- package/plugins/cursor/agents/mobile-qa.md +70 -0
- package/plugins/cursor/agents/player.md +143 -0
- package/plugins/cursor/agents/qa-lead.md +52 -0
- package/plugins/cursor/commands/first-look.md +59 -0
- package/plugins/cursor/commands/flow.md +50 -0
- package/plugins/cursor/commands/lanes.md +38 -0
- package/plugins/cursor/commands/mobile-qa.md +28 -0
- package/plugins/cursor/commands/new.md +94 -0
- package/plugins/cursor/commands/playtest.md +66 -0
- package/plugins/cursor/commands/publish.md +23 -0
- package/plugins/cursor/commands/smoke-build.md +25 -0
- package/plugins/cursor/commands/verify.md +20 -0
- package/plugins/cursor/hooks/brief.md +135 -0
- package/plugins/cursor/hooks/critic-receipts.mjs +86 -0
- package/plugins/cursor/hooks/durable.mjs +56 -0
- package/plugins/cursor/hooks/fence.mjs +30 -0
- package/plugins/cursor/hooks/floors.mjs +181 -0
- package/plugins/cursor/hooks/flow.mjs +154 -0
- package/plugins/cursor/hooks/front-door.mjs +68 -0
- package/plugins/cursor/hooks/guidance.json +3 -0
- package/plugins/cursor/hooks/hints.mjs +183 -0
- package/plugins/cursor/hooks/hooks.json +26 -0
- package/plugins/cursor/hooks/lib.mjs +362 -0
- package/plugins/cursor/hooks/memory.mjs +92 -0
- package/plugins/cursor/hooks/mobile-qa.mjs +43 -0
- package/plugins/cursor/hooks/note.mjs +63 -0
- package/plugins/cursor/hooks/nudge.mjs +98 -0
- package/plugins/cursor/hooks/pipeline.mjs +207 -0
- package/plugins/cursor/hooks/prompt.mjs +51 -0
- package/plugins/cursor/hooks/quality.mjs +310 -0
- package/plugins/cursor/hooks/reach.mjs +93 -0
- package/plugins/cursor/hooks/scope.mjs +44 -0
- package/plugins/cursor/hooks/session-log.mjs +101 -0
- package/plugins/cursor/hooks/session-start.mjs +194 -0
- package/plugins/cursor/hooks/stop-gate.mjs +303 -0
- package/plugins/cursor/hooks/vendor/direct/round.mjs +81 -0
- package/plugins/cursor/hooks/vendor/find/names.mjs +46 -0
- package/plugins/cursor/hooks/vendor/firstlook/set.mjs +219 -0
- package/plugins/cursor/hooks/vendor/flow/flow.mjs +456 -0
- package/plugins/cursor/hooks/vendor/flow/look.mjs +140 -0
- package/plugins/cursor/hooks/vendor/gdd/book.mjs +484 -0
- package/plugins/cursor/hooks/vendor/gdd/chapters.mjs +72 -0
- package/plugins/cursor/hooks/vendor/gdd/doc.mjs +33 -0
- package/plugins/cursor/hooks/vendor/gdd/levelmap.mjs +429 -0
- package/plugins/cursor/hooks/vendor/gdd/rubric.mjs +251 -0
- package/plugins/cursor/hooks/vendor/gdd/worth.mjs +508 -0
- package/plugins/cursor/hooks/vendor/lanes/fence.mjs +109 -0
- package/plugins/cursor/hooks/vendor/lanes/lanes.mjs +356 -0
- package/plugins/cursor/hooks/vendor/lanes/union.mjs +63 -0
- package/plugins/cursor/hooks/vendor/lessons/motifs.mjs +98 -0
- package/plugins/cursor/hooks/vendor/lessons/store.mjs +57 -0
- package/plugins/cursor/hooks/vendor/look/made-of.mjs +243 -0
- package/plugins/cursor/hooks/vendor/look/roles.mjs +110 -0
- package/plugins/cursor/hooks/vendor/memory/decisions.mjs +139 -0
- package/plugins/cursor/hooks/vendor/memory/journal.mjs +109 -0
- package/plugins/cursor/hooks/vendor/owner/bar.mjs +286 -0
- package/plugins/cursor/hooks/vendor/pipeline/pipeline.mjs +930 -0
- package/plugins/cursor/hooks/vendor/playtest/keep.mjs +111 -0
- package/plugins/cursor/hooks/vendor/playtest/stuck.mjs +48 -0
- package/plugins/cursor/hooks/vendor/progress/holds.mjs +107 -0
- package/plugins/cursor/hooks/vendor/progress/progress.mjs +301 -0
- package/plugins/cursor/hooks/vendor/sim/judge.mjs +241 -0
- package/plugins/cursor/hooks/vendor/spec/rooms.mjs +189 -0
- package/plugins/cursor/hooks/vendor/spec/tunables.mjs +75 -0
- package/plugins/cursor/hooks/vendor/stage/harnessignore.mjs +91 -0
- package/plugins/cursor/hooks/vendor/stage/stage.mjs +58 -0
- package/plugins/cursor/hooks/vendor/status/board.mjs +173 -0
- package/plugins/cursor/hooks/vendor/status/file.mjs +113 -0
- package/plugins/cursor/hooks/vendor/studio/forks.mjs +94 -0
- package/plugins/cursor/hooks/vendor/studio/pitch.mjs +295 -0
- package/plugins/cursor/hooks/vendor/verify/fingerprint.mjs +73 -0
- package/plugins/cursor/hooks/vendor/verify/reads.mjs +33 -0
- package/plugins/cursor/hooks/vendor/wow/picks.mjs +75 -0
- package/plugins/cursor/mcp.json +10 -0
- package/plugins/cursor/rules/funpixel-brief.mdc +141 -0
- package/plugins/cursor/skills/funpixel-3d/SKILL.md +89 -0
- package/plugins/cursor/skills/funpixel-3d/references/bake-off.md +48 -0
- package/plugins/cursor/skills/funpixel-3d/references/bench.md +103 -0
- package/plugins/cursor/skills/funpixel-3d/references/budgets.md +48 -0
- package/plugins/cursor/skills/funpixel-3d/references/characters.md +67 -0
- package/plugins/cursor/skills/funpixel-3d/references/concept-image.md +47 -0
- package/plugins/cursor/skills/funpixel-3d/references/engine-targets.md +31 -0
- package/plugins/cursor/skills/funpixel-3d/references/hero-route.md +104 -0
- package/plugins/cursor/skills/funpixel-3d/references/level-spec.md +109 -0
- package/plugins/cursor/skills/funpixel-3d/references/levels.md +84 -0
- package/plugins/cursor/skills/funpixel-3d/references/light-and-places.md +141 -0
- package/plugins/cursor/skills/funpixel-3d/references/models.md +111 -0
- package/plugins/cursor/skills/funpixel-3d/references/painted-target.md +184 -0
- package/plugins/cursor/skills/funpixel-3d/references/reading.md +41 -0
- package/plugins/cursor/skills/funpixel-3d/references/skin.md +85 -0
- package/plugins/cursor/skills/funpixel-3d/references/skyboxes.md +65 -0
- package/plugins/cursor/skills/funpixel-3d/references/textures.md +71 -0
- package/plugins/cursor/skills/funpixel-3d/references/three-loading.md +199 -0
- package/plugins/cursor/skills/funpixel-3d/references/unity.md +78 -0
- package/plugins/cursor/skills/funpixel-art/SKILL.md +104 -0
- package/plugins/cursor/skills/funpixel-art/references/2d-assets.md +108 -0
- package/plugins/cursor/skills/funpixel-art/references/animation.md +126 -0
- package/plugins/cursor/skills/funpixel-art/references/cast.md +73 -0
- package/plugins/cursor/skills/funpixel-art/references/characters.md +49 -0
- package/plugins/cursor/skills/funpixel-art/references/cost.md +107 -0
- package/plugins/cursor/skills/funpixel-art/references/effects.md +85 -0
- package/plugins/cursor/skills/funpixel-art/references/frames.md +87 -0
- package/plugins/cursor/skills/funpixel-art/references/judging-frames.md +64 -0
- package/plugins/cursor/skills/funpixel-art/references/look.md +102 -0
- package/plugins/cursor/skills/funpixel-art/references/measure.md +119 -0
- package/plugins/cursor/skills/funpixel-art/references/pipeline.md +185 -0
- package/plugins/cursor/skills/funpixel-art/references/pixi.md +277 -0
- package/plugins/cursor/skills/funpixel-art/references/planes.md +27 -0
- package/plugins/cursor/skills/funpixel-art/references/prompts.md +171 -0
- package/plugins/cursor/skills/funpixel-art/references/sheets.md +141 -0
- package/plugins/cursor/skills/funpixel-art/references/style-file.md +39 -0
- package/plugins/cursor/skills/funpixel-art/references/three.md +232 -0
- package/plugins/cursor/skills/funpixel-art/references/ui.md +163 -0
- package/plugins/cursor/skills/funpixel-art/references/unity.md +78 -0
- package/plugins/cursor/skills/funpixel-art/references/wiring.md +41 -0
- package/plugins/cursor/skills/funpixel-audio/SKILL.md +92 -0
- package/plugins/cursor/skills/funpixel-audio/references/adaptive-music.md +204 -0
- package/plugins/cursor/skills/funpixel-audio/references/engine.md +78 -0
- package/plugins/cursor/skills/funpixel-audio/references/measure.md +101 -0
- package/plugins/cursor/skills/funpixel-audio/references/unity.md +74 -0
- package/plugins/cursor/skills/funpixel-feedback/SKILL.md +120 -0
- package/plugins/cursor/skills/funpixel-feedback/references/memory.md +99 -0
- package/plugins/cursor/skills/funpixel-game-feel/SKILL.md +104 -0
- package/plugins/cursor/skills/funpixel-game-feel/references/contact.md +110 -0
- package/plugins/cursor/skills/funpixel-game-feel/references/measure.md +125 -0
- package/plugins/cursor/skills/funpixel-game-feel/references/motion.md +134 -0
- package/plugins/cursor/skills/funpixel-game-feel/references/payoffs.md +35 -0
- package/plugins/cursor/skills/funpixel-game-feel/references/recipes.md +107 -0
- package/plugins/cursor/skills/funpixel-game-feel/references/unity.md +73 -0
- package/plugins/cursor/skills/funpixel-game-logic/SKILL.md +113 -0
- package/plugins/cursor/skills/funpixel-game-logic/references/balance.md +88 -0
- package/plugins/cursor/skills/funpixel-game-logic/references/content-at-scale.md +147 -0
- package/plugins/cursor/skills/funpixel-game-logic/references/depth.md +89 -0
- package/plugins/cursor/skills/funpixel-game-logic/references/escalation.md +41 -0
- package/plugins/cursor/skills/funpixel-game-logic/references/levels.md +61 -0
- package/plugins/cursor/skills/funpixel-game-logic/references/probes.md +122 -0
- package/plugins/cursor/skills/funpixel-game-logic/references/unity.md +108 -0
- package/plugins/cursor/skills/funpixel-game-spine/SKILL.md +118 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/camera.md +94 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/multiplayer.md +101 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/patterns.md +103 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/performance.md +96 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/pixi.md +26 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/replay.md +102 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/room-api.md +63 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/room-modes.md +40 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/sdk.md +114 -0
- package/plugins/cursor/skills/funpixel-game-spine/references/three.md +62 -0
- package/plugins/cursor/skills/funpixel-gdd/SKILL.md +116 -0
- package/plugins/cursor/skills/funpixel-gdd/references/as-built.md +40 -0
- package/plugins/cursor/skills/funpixel-gdd/references/design-measures.md +24 -0
- package/plugins/cursor/skills/funpixel-gdd/references/design-note.md +88 -0
- package/plugins/cursor/skills/funpixel-gdd/references/experience.md +92 -0
- package/plugins/cursor/skills/funpixel-gdd/references/first-look.md +226 -0
- package/plugins/cursor/skills/funpixel-gdd/references/floors.md +62 -0
- package/plugins/cursor/skills/funpixel-gdd/references/frame.md +75 -0
- package/plugins/cursor/skills/funpixel-gdd/references/gameplay-contract.md +81 -0
- package/plugins/cursor/skills/funpixel-gdd/references/gdd-template.md +417 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-card.md +109 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-platformer.md +159 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-puzzle.md +145 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-racing.md +137 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-rpg.md +125 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-shooter.md +128 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-simulation.md +112 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-strategy.md +116 -0
- package/plugins/cursor/skills/funpixel-gdd/references/genre-survival.md +122 -0
- package/plugins/cursor/skills/funpixel-gdd/references/in-the-loop.md +106 -0
- package/plugins/cursor/skills/funpixel-gdd/references/invent-first.md +131 -0
- package/plugins/cursor/skills/funpixel-gdd/references/level-and-fun.md +112 -0
- package/plugins/cursor/skills/funpixel-gdd/references/pages.md +47 -0
- package/plugins/cursor/skills/funpixel-gdd/references/plan-at-size.md +140 -0
- package/plugins/cursor/skills/funpixel-gdd/references/production-tiers.md +117 -0
- package/plugins/cursor/skills/funpixel-gdd/references/sections.md +148 -0
- package/plugins/cursor/skills/funpixel-gdd/references/spec-folder.md +131 -0
- package/plugins/cursor/skills/funpixel-gdd/references/start.md +110 -0
- package/plugins/cursor/skills/funpixel-gdd/references/starters.md +175 -0
- package/plugins/cursor/skills/funpixel-gdd/references/the-path.md +133 -0
- package/plugins/cursor/skills/funpixel-gdd/references/track.md +29 -0
- package/plugins/cursor/skills/funpixel-gdd/references/world-and-identity.md +165 -0
- package/plugins/cursor/skills/funpixel-gdd/references/worth.md +74 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/SKILL.md +107 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/references/contrast.md +123 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/references/hud-and-title.md +108 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/references/hud-genres.md +124 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/references/phone-check.md +156 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/references/recipes.md +279 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/references/restyle-ui.md +229 -0
- package/plugins/cursor/skills/funpixel-mobile-ui/references/unity.md +61 -0
- package/plugins/cursor/skills/funpixel-publish/SKILL.md +109 -0
- package/plugins/cursor/skills/funpixel-publish/references/compose.md +113 -0
- package/plugins/cursor/skills/funpixel-publish/references/motion.md +120 -0
- package/plugins/cursor/skills/funpixel-publish/references/networks.md +75 -0
- package/plugins/cursor/skills/funpixel-publish/references/other-hosts.md +65 -0
- package/plugins/cursor/skills/funpixel-publish/references/playable-ad.md +90 -0
- package/plugins/cursor/skills/funpixel-publish/references/server-build.md +85 -0
- package/plugins/cursor/skills/funpixel-publish/references/store-shots.md +85 -0
- package/plugins/cursor/skills/funpixel-publish/references/trailer.md +55 -0
- package/plugins/cursor/skills/funpixel-publish/references/what-ships.md +30 -0
- package/plugins/cursor/skills/funpixel-store/SKILL.md +81 -0
- package/plugins/cursor/skills/funpixel-store/references/app-store.md +73 -0
- package/plugins/cursor/skills/funpixel-store/references/google-play.md +141 -0
- package/plugins/cursor/skills/funpixel-store/references/ios-release.md +63 -0
- package/plugins/cursor/skills/funpixel-store/references/money.md +66 -0
- package/plugins/cursor/skills/funpixel-store/references/purchases-and-review.md +74 -0
- package/plugins/cursor/skills/funpixel-store/references/readiness-page.md +24 -0
- package/plugins/cursor/skills/funpixel-store/references/readiness.md +107 -0
- package/plugins/cursor/skills/funpixel-store/references/steam.md +38 -0
- package/plugins/cursor/skills/funpixel-store/references/unity-store.md +55 -0
- package/plugins/cursor/skills/funpixel-store/references/web-portals.md +43 -0
- package/plugins/cursor/skills/funpixel-unity-game/SKILL.md +103 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/agent-ops.md +54 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/fixes.md +40 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/from-a-web-game.md +108 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/handing-off.md +42 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/performance.md +59 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/probe.md +80 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/shared-mac.md +121 -0
- package/plugins/cursor/skills/funpixel-unity-game/references/traps.md +108 -0
- package/plugins/cursor/skills/funpixel-verify/SKILL.md +109 -0
- package/plugins/cursor/skills/funpixel-verify/references/actors.md +94 -0
- package/plugins/cursor/skills/funpixel-verify/references/bar.md +62 -0
- package/plugins/cursor/skills/funpixel-verify/references/checks.md +69 -0
- package/plugins/cursor/skills/funpixel-verify/references/experience.md +67 -0
- package/plugins/cursor/skills/funpixel-verify/references/eyes.md +54 -0
- package/plugins/cursor/skills/funpixel-verify/references/fidelity.md +126 -0
- package/plugins/cursor/skills/funpixel-verify/references/hit-bar.md +31 -0
- package/plugins/cursor/skills/funpixel-verify/references/journeys.md +77 -0
- package/plugins/cursor/skills/funpixel-verify/references/mobile-qa.md +123 -0
- package/plugins/cursor/skills/funpixel-verify/references/playtest.md +161 -0
- package/plugins/cursor/skills/funpixel-verify/references/review.md +105 -0
- package/plugins/cursor/skills/funpixel-verify/references/rubric.md +67 -0
- package/plugins/cursor/skills/funpixel-verify/references/scenes.md +49 -0
- package/plugins/cursor/skills/funpixel-verify/references/unity.md +60 -0
- package/plugins/cursor/skills/funpixel-world-and-story/SKILL.md +99 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/atmosphere.md +208 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/forged-world.md +79 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/living-world.md +237 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/opening-and-chapters.md +215 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/shelf.md +80 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/story-at-size.md +159 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/voice.md +175 -0
- package/plugins/cursor/skills/funpixel-world-and-story/references/world-kit.md +154 -0
- package/plugins/kiro/AGENTS.md +135 -0
- package/plugins/kiro/LICENSE +115 -0
- package/plugins/kiro/README.md +17 -0
- package/plugins/kiro/THIRD_PARTY_NOTICES.md +75 -0
- package/plugins/kiro/agent.template.json +45 -0
- package/plugins/kiro/hooks/brief.md +135 -0
- package/plugins/kiro/hooks/critic-receipts.mjs +86 -0
- package/plugins/kiro/hooks/durable.mjs +56 -0
- package/plugins/kiro/hooks/fence.mjs +30 -0
- package/plugins/kiro/hooks/floors.mjs +181 -0
- package/plugins/kiro/hooks/flow.mjs +154 -0
- package/plugins/kiro/hooks/front-door.mjs +68 -0
- package/plugins/kiro/hooks/guidance.json +3 -0
- package/plugins/kiro/hooks/hints.mjs +183 -0
- package/plugins/kiro/hooks/host.md +43 -0
- package/plugins/kiro/hooks/kiro-prompt.mjs +26 -0
- package/plugins/kiro/hooks/lib.mjs +362 -0
- package/plugins/kiro/hooks/memory.mjs +92 -0
- package/plugins/kiro/hooks/mobile-qa.mjs +43 -0
- package/plugins/kiro/hooks/note.mjs +63 -0
- package/plugins/kiro/hooks/nudge.mjs +98 -0
- package/plugins/kiro/hooks/pipeline.mjs +207 -0
- package/plugins/kiro/hooks/prompt.mjs +51 -0
- package/plugins/kiro/hooks/quality.mjs +310 -0
- package/plugins/kiro/hooks/reach.mjs +93 -0
- package/plugins/kiro/hooks/scope.mjs +44 -0
- package/plugins/kiro/hooks/session-log.mjs +101 -0
- package/plugins/kiro/hooks/session-start.mjs +194 -0
- package/plugins/kiro/hooks/stop-gate.mjs +303 -0
- package/plugins/kiro/hooks/vendor/direct/round.mjs +81 -0
- package/plugins/kiro/hooks/vendor/find/names.mjs +46 -0
- package/plugins/kiro/hooks/vendor/firstlook/set.mjs +219 -0
- package/plugins/kiro/hooks/vendor/flow/flow.mjs +456 -0
- package/plugins/kiro/hooks/vendor/flow/look.mjs +140 -0
- package/plugins/kiro/hooks/vendor/gdd/book.mjs +484 -0
- package/plugins/kiro/hooks/vendor/gdd/chapters.mjs +72 -0
- package/plugins/kiro/hooks/vendor/gdd/doc.mjs +33 -0
- package/plugins/kiro/hooks/vendor/gdd/levelmap.mjs +429 -0
- package/plugins/kiro/hooks/vendor/gdd/rubric.mjs +251 -0
- package/plugins/kiro/hooks/vendor/gdd/worth.mjs +508 -0
- package/plugins/kiro/hooks/vendor/lanes/fence.mjs +109 -0
- package/plugins/kiro/hooks/vendor/lanes/lanes.mjs +356 -0
- package/plugins/kiro/hooks/vendor/lanes/union.mjs +63 -0
- package/plugins/kiro/hooks/vendor/lessons/motifs.mjs +98 -0
- package/plugins/kiro/hooks/vendor/lessons/store.mjs +57 -0
- package/plugins/kiro/hooks/vendor/look/made-of.mjs +243 -0
- package/plugins/kiro/hooks/vendor/look/roles.mjs +110 -0
- package/plugins/kiro/hooks/vendor/memory/decisions.mjs +139 -0
- package/plugins/kiro/hooks/vendor/memory/journal.mjs +109 -0
- package/plugins/kiro/hooks/vendor/owner/bar.mjs +286 -0
- package/plugins/kiro/hooks/vendor/pipeline/pipeline.mjs +930 -0
- package/plugins/kiro/hooks/vendor/playtest/keep.mjs +111 -0
- package/plugins/kiro/hooks/vendor/playtest/stuck.mjs +48 -0
- package/plugins/kiro/hooks/vendor/progress/holds.mjs +107 -0
- package/plugins/kiro/hooks/vendor/progress/progress.mjs +301 -0
- package/plugins/kiro/hooks/vendor/sim/judge.mjs +241 -0
- package/plugins/kiro/hooks/vendor/spec/rooms.mjs +189 -0
- package/plugins/kiro/hooks/vendor/spec/tunables.mjs +75 -0
- package/plugins/kiro/hooks/vendor/stage/harnessignore.mjs +91 -0
- package/plugins/kiro/hooks/vendor/stage/stage.mjs +58 -0
- package/plugins/kiro/hooks/vendor/status/board.mjs +173 -0
- package/plugins/kiro/hooks/vendor/status/file.mjs +113 -0
- package/plugins/kiro/hooks/vendor/studio/forks.mjs +94 -0
- package/plugins/kiro/hooks/vendor/studio/pitch.mjs +295 -0
- package/plugins/kiro/hooks/vendor/verify/fingerprint.mjs +73 -0
- package/plugins/kiro/hooks/vendor/verify/reads.mjs +33 -0
- package/plugins/kiro/hooks/vendor/wow/picks.mjs +75 -0
- package/plugins/kiro/install.mjs +37 -0
- package/plugins/kiro/skills/fp-art-director/SKILL.md +58 -0
- package/plugins/kiro/skills/fp-art-director/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-audio-director/SKILL.md +55 -0
- package/plugins/kiro/skills/fp-audio-director/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-critic/SKILL.md +117 -0
- package/plugins/kiro/skills/fp-critic/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-first-look/SKILL.md +61 -0
- package/plugins/kiro/skills/fp-flow/SKILL.md +52 -0
- package/plugins/kiro/skills/fp-lane/SKILL.md +41 -0
- package/plugins/kiro/skills/fp-lane/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-lanes/SKILL.md +40 -0
- package/plugins/kiro/skills/fp-level-designer/SKILL.md +49 -0
- package/plugins/kiro/skills/fp-level-designer/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-mobile-qa/SKILL.md +30 -0
- package/plugins/kiro/skills/fp-mobile-qa-seat/SKILL.md +74 -0
- package/plugins/kiro/skills/fp-mobile-qa-seat/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-new/SKILL.md +96 -0
- package/plugins/kiro/skills/fp-player/SKILL.md +147 -0
- package/plugins/kiro/skills/fp-player/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-playtest/SKILL.md +68 -0
- package/plugins/kiro/skills/fp-publish/SKILL.md +25 -0
- package/plugins/kiro/skills/fp-qa-lead/SKILL.md +56 -0
- package/plugins/kiro/skills/fp-qa-lead/references/kiro.md +43 -0
- package/plugins/kiro/skills/fp-smoke-build/SKILL.md +27 -0
- package/plugins/kiro/skills/fp-studio/SKILL.md +48 -0
- package/plugins/kiro/skills/fp-verify/SKILL.md +22 -0
- package/plugins/kiro/skills/funpixel-3d/SKILL.md +89 -0
- package/plugins/kiro/skills/funpixel-3d/references/bake-off.md +48 -0
- package/plugins/kiro/skills/funpixel-3d/references/bench.md +103 -0
- package/plugins/kiro/skills/funpixel-3d/references/budgets.md +48 -0
- package/plugins/kiro/skills/funpixel-3d/references/characters.md +67 -0
- package/plugins/kiro/skills/funpixel-3d/references/concept-image.md +47 -0
- package/plugins/kiro/skills/funpixel-3d/references/engine-targets.md +31 -0
- package/plugins/kiro/skills/funpixel-3d/references/hero-route.md +104 -0
- package/plugins/kiro/skills/funpixel-3d/references/level-spec.md +109 -0
- package/plugins/kiro/skills/funpixel-3d/references/levels.md +84 -0
- package/plugins/kiro/skills/funpixel-3d/references/light-and-places.md +141 -0
- package/plugins/kiro/skills/funpixel-3d/references/models.md +111 -0
- package/plugins/kiro/skills/funpixel-3d/references/painted-target.md +184 -0
- package/plugins/kiro/skills/funpixel-3d/references/reading.md +41 -0
- package/plugins/kiro/skills/funpixel-3d/references/skin.md +85 -0
- package/plugins/kiro/skills/funpixel-3d/references/skyboxes.md +65 -0
- package/plugins/kiro/skills/funpixel-3d/references/textures.md +71 -0
- package/plugins/kiro/skills/funpixel-3d/references/three-loading.md +199 -0
- package/plugins/kiro/skills/funpixel-3d/references/unity.md +78 -0
- package/plugins/kiro/skills/funpixel-art/SKILL.md +104 -0
- package/plugins/kiro/skills/funpixel-art/references/2d-assets.md +108 -0
- package/plugins/kiro/skills/funpixel-art/references/animation.md +126 -0
- package/plugins/kiro/skills/funpixel-art/references/cast.md +73 -0
- package/plugins/kiro/skills/funpixel-art/references/characters.md +49 -0
- package/plugins/kiro/skills/funpixel-art/references/cost.md +107 -0
- package/plugins/kiro/skills/funpixel-art/references/effects.md +85 -0
- package/plugins/kiro/skills/funpixel-art/references/frames.md +87 -0
- package/plugins/kiro/skills/funpixel-art/references/judging-frames.md +64 -0
- package/plugins/kiro/skills/funpixel-art/references/look.md +102 -0
- package/plugins/kiro/skills/funpixel-art/references/measure.md +119 -0
- package/plugins/kiro/skills/funpixel-art/references/pipeline.md +185 -0
- package/plugins/kiro/skills/funpixel-art/references/pixi.md +277 -0
- package/plugins/kiro/skills/funpixel-art/references/planes.md +27 -0
- package/plugins/kiro/skills/funpixel-art/references/prompts.md +171 -0
- package/plugins/kiro/skills/funpixel-art/references/sheets.md +141 -0
- package/plugins/kiro/skills/funpixel-art/references/style-file.md +39 -0
- package/plugins/kiro/skills/funpixel-art/references/three.md +232 -0
- package/plugins/kiro/skills/funpixel-art/references/ui.md +163 -0
- package/plugins/kiro/skills/funpixel-art/references/unity.md +78 -0
- package/plugins/kiro/skills/funpixel-art/references/wiring.md +41 -0
- package/plugins/kiro/skills/funpixel-audio/SKILL.md +92 -0
- package/plugins/kiro/skills/funpixel-audio/references/adaptive-music.md +204 -0
- package/plugins/kiro/skills/funpixel-audio/references/engine.md +78 -0
- package/plugins/kiro/skills/funpixel-audio/references/measure.md +101 -0
- package/plugins/kiro/skills/funpixel-audio/references/unity.md +74 -0
- package/plugins/kiro/skills/funpixel-feedback/SKILL.md +120 -0
- package/plugins/kiro/skills/funpixel-feedback/references/memory.md +99 -0
- package/plugins/kiro/skills/funpixel-game-feel/SKILL.md +104 -0
- package/plugins/kiro/skills/funpixel-game-feel/references/contact.md +110 -0
- package/plugins/kiro/skills/funpixel-game-feel/references/measure.md +125 -0
- package/plugins/kiro/skills/funpixel-game-feel/references/motion.md +134 -0
- package/plugins/kiro/skills/funpixel-game-feel/references/payoffs.md +35 -0
- package/plugins/kiro/skills/funpixel-game-feel/references/recipes.md +107 -0
- package/plugins/kiro/skills/funpixel-game-feel/references/unity.md +73 -0
- package/plugins/kiro/skills/funpixel-game-logic/SKILL.md +113 -0
- package/plugins/kiro/skills/funpixel-game-logic/references/balance.md +88 -0
- package/plugins/kiro/skills/funpixel-game-logic/references/content-at-scale.md +147 -0
- package/plugins/kiro/skills/funpixel-game-logic/references/depth.md +89 -0
- package/plugins/kiro/skills/funpixel-game-logic/references/escalation.md +41 -0
- package/plugins/kiro/skills/funpixel-game-logic/references/levels.md +61 -0
- package/plugins/kiro/skills/funpixel-game-logic/references/probes.md +122 -0
- package/plugins/kiro/skills/funpixel-game-logic/references/unity.md +108 -0
- package/plugins/kiro/skills/funpixel-game-spine/SKILL.md +118 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/camera.md +94 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/multiplayer.md +101 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/patterns.md +103 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/performance.md +96 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/pixi.md +26 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/replay.md +102 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/room-api.md +63 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/room-modes.md +40 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/sdk.md +114 -0
- package/plugins/kiro/skills/funpixel-game-spine/references/three.md +62 -0
- package/plugins/kiro/skills/funpixel-gdd/SKILL.md +116 -0
- package/plugins/kiro/skills/funpixel-gdd/references/as-built.md +40 -0
- package/plugins/kiro/skills/funpixel-gdd/references/design-measures.md +24 -0
- package/plugins/kiro/skills/funpixel-gdd/references/design-note.md +88 -0
- package/plugins/kiro/skills/funpixel-gdd/references/experience.md +92 -0
- package/plugins/kiro/skills/funpixel-gdd/references/first-look.md +226 -0
- package/plugins/kiro/skills/funpixel-gdd/references/floors.md +62 -0
- package/plugins/kiro/skills/funpixel-gdd/references/frame.md +75 -0
- package/plugins/kiro/skills/funpixel-gdd/references/gameplay-contract.md +81 -0
- package/plugins/kiro/skills/funpixel-gdd/references/gdd-template.md +417 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-card.md +109 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-platformer.md +159 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-puzzle.md +145 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-racing.md +137 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-rpg.md +125 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-shooter.md +128 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-simulation.md +112 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-strategy.md +116 -0
- package/plugins/kiro/skills/funpixel-gdd/references/genre-survival.md +122 -0
- package/plugins/kiro/skills/funpixel-gdd/references/in-the-loop.md +106 -0
- package/plugins/kiro/skills/funpixel-gdd/references/invent-first.md +131 -0
- package/plugins/kiro/skills/funpixel-gdd/references/level-and-fun.md +112 -0
- package/plugins/kiro/skills/funpixel-gdd/references/pages.md +47 -0
- package/plugins/kiro/skills/funpixel-gdd/references/plan-at-size.md +140 -0
- package/plugins/kiro/skills/funpixel-gdd/references/production-tiers.md +117 -0
- package/plugins/kiro/skills/funpixel-gdd/references/sections.md +148 -0
- package/plugins/kiro/skills/funpixel-gdd/references/spec-folder.md +131 -0
- package/plugins/kiro/skills/funpixel-gdd/references/start.md +110 -0
- package/plugins/kiro/skills/funpixel-gdd/references/starters.md +175 -0
- package/plugins/kiro/skills/funpixel-gdd/references/the-path.md +133 -0
- package/plugins/kiro/skills/funpixel-gdd/references/track.md +29 -0
- package/plugins/kiro/skills/funpixel-gdd/references/world-and-identity.md +165 -0
- package/plugins/kiro/skills/funpixel-gdd/references/worth.md +74 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/SKILL.md +107 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/references/contrast.md +123 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/references/hud-and-title.md +108 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/references/hud-genres.md +124 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/references/phone-check.md +156 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/references/recipes.md +279 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/references/restyle-ui.md +229 -0
- package/plugins/kiro/skills/funpixel-mobile-ui/references/unity.md +61 -0
- package/plugins/kiro/skills/funpixel-publish/SKILL.md +109 -0
- package/plugins/kiro/skills/funpixel-publish/references/compose.md +113 -0
- package/plugins/kiro/skills/funpixel-publish/references/motion.md +120 -0
- package/plugins/kiro/skills/funpixel-publish/references/networks.md +75 -0
- package/plugins/kiro/skills/funpixel-publish/references/other-hosts.md +65 -0
- package/plugins/kiro/skills/funpixel-publish/references/playable-ad.md +90 -0
- package/plugins/kiro/skills/funpixel-publish/references/server-build.md +85 -0
- package/plugins/kiro/skills/funpixel-publish/references/store-shots.md +85 -0
- package/plugins/kiro/skills/funpixel-publish/references/trailer.md +55 -0
- package/plugins/kiro/skills/funpixel-publish/references/what-ships.md +30 -0
- package/plugins/kiro/skills/funpixel-store/SKILL.md +81 -0
- package/plugins/kiro/skills/funpixel-store/references/app-store.md +73 -0
- package/plugins/kiro/skills/funpixel-store/references/google-play.md +141 -0
- package/plugins/kiro/skills/funpixel-store/references/ios-release.md +63 -0
- package/plugins/kiro/skills/funpixel-store/references/money.md +66 -0
- package/plugins/kiro/skills/funpixel-store/references/purchases-and-review.md +74 -0
- package/plugins/kiro/skills/funpixel-store/references/readiness-page.md +24 -0
- package/plugins/kiro/skills/funpixel-store/references/readiness.md +107 -0
- package/plugins/kiro/skills/funpixel-store/references/steam.md +38 -0
- package/plugins/kiro/skills/funpixel-store/references/unity-store.md +55 -0
- package/plugins/kiro/skills/funpixel-store/references/web-portals.md +43 -0
- package/plugins/kiro/skills/funpixel-unity-game/SKILL.md +103 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/agent-ops.md +54 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/fixes.md +40 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/from-a-web-game.md +108 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/handing-off.md +42 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/performance.md +59 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/probe.md +80 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/shared-mac.md +121 -0
- package/plugins/kiro/skills/funpixel-unity-game/references/traps.md +108 -0
- package/plugins/kiro/skills/funpixel-verify/SKILL.md +109 -0
- package/plugins/kiro/skills/funpixel-verify/references/actors.md +94 -0
- package/plugins/kiro/skills/funpixel-verify/references/bar.md +62 -0
- package/plugins/kiro/skills/funpixel-verify/references/checks.md +69 -0
- package/plugins/kiro/skills/funpixel-verify/references/experience.md +67 -0
- package/plugins/kiro/skills/funpixel-verify/references/eyes.md +54 -0
- package/plugins/kiro/skills/funpixel-verify/references/fidelity.md +126 -0
- package/plugins/kiro/skills/funpixel-verify/references/hit-bar.md +31 -0
- package/plugins/kiro/skills/funpixel-verify/references/journeys.md +77 -0
- package/plugins/kiro/skills/funpixel-verify/references/mobile-qa.md +123 -0
- package/plugins/kiro/skills/funpixel-verify/references/playtest.md +161 -0
- package/plugins/kiro/skills/funpixel-verify/references/review.md +105 -0
- package/plugins/kiro/skills/funpixel-verify/references/rubric.md +67 -0
- package/plugins/kiro/skills/funpixel-verify/references/scenes.md +49 -0
- package/plugins/kiro/skills/funpixel-verify/references/unity.md +60 -0
- package/plugins/kiro/skills/funpixel-world-and-story/SKILL.md +99 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/atmosphere.md +208 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/forged-world.md +79 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/living-world.md +237 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/opening-and-chapters.md +215 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/shelf.md +80 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/story-at-size.md +159 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/voice.md +175 -0
- package/plugins/kiro/skills/funpixel-world-and-story/references/world-kit.md +154 -0
- package/plugins/robin/LICENSE +115 -0
- package/plugins/robin/README.md +27 -0
- package/plugins/robin/THIRD_PARTY_NOTICES.md +75 -0
- package/plugins/robin/claude/.claude-plugin/plugin.json +19 -0
- package/plugins/robin/claude/.mcp.json +10 -0
- package/plugins/robin/claude/LICENSE +115 -0
- package/plugins/robin/claude/README.md +14 -0
- package/plugins/robin/claude/THIRD_PARTY_NOTICES.md +75 -0
- package/plugins/robin/claude/agents/art-director.md +54 -0
- package/plugins/robin/claude/agents/audio-director.md +51 -0
- package/plugins/robin/claude/agents/critic.md +113 -0
- package/plugins/robin/claude/agents/lane.md +38 -0
- package/plugins/robin/claude/agents/level-designer.md +45 -0
- package/plugins/robin/claude/agents/mobile-qa.md +71 -0
- package/plugins/robin/claude/agents/player.md +144 -0
- package/plugins/robin/claude/agents/qa-lead.md +52 -0
- package/plugins/robin/claude/commands/first-look.md +59 -0
- package/plugins/robin/claude/commands/flow.md +50 -0
- package/plugins/robin/claude/commands/lanes.md +38 -0
- package/plugins/robin/claude/commands/mobile-qa.md +28 -0
- package/plugins/robin/claude/commands/new.md +94 -0
- package/plugins/robin/claude/commands/playtest.md +66 -0
- package/plugins/robin/claude/commands/publish.md +23 -0
- package/plugins/robin/claude/commands/smoke-build.md +25 -0
- package/plugins/robin/claude/commands/verify.md +20 -0
- package/plugins/robin/claude/hooks/brief.md +135 -0
- package/plugins/robin/claude/hooks/critic-receipts.mjs +86 -0
- package/plugins/robin/claude/hooks/durable.mjs +56 -0
- package/plugins/robin/claude/hooks/fence.mjs +30 -0
- package/plugins/robin/claude/hooks/floors.mjs +181 -0
- package/plugins/robin/claude/hooks/flow.mjs +154 -0
- package/plugins/robin/claude/hooks/front-door.mjs +68 -0
- package/plugins/robin/claude/hooks/guidance.json +3 -0
- package/plugins/robin/claude/hooks/hints.mjs +183 -0
- package/plugins/robin/claude/hooks/hooks.json +62 -0
- package/plugins/robin/claude/hooks/lib.mjs +362 -0
- package/plugins/robin/claude/hooks/memory.mjs +92 -0
- package/plugins/robin/claude/hooks/mobile-qa.mjs +43 -0
- package/plugins/robin/claude/hooks/note.mjs +63 -0
- package/plugins/robin/claude/hooks/nudge.mjs +98 -0
- package/plugins/robin/claude/hooks/pipeline.mjs +207 -0
- package/plugins/robin/claude/hooks/prompt.mjs +51 -0
- package/plugins/robin/claude/hooks/quality.mjs +310 -0
- package/plugins/robin/claude/hooks/reach.mjs +93 -0
- package/plugins/robin/claude/hooks/scope.mjs +44 -0
- package/plugins/robin/claude/hooks/session-log.mjs +101 -0
- package/plugins/robin/claude/hooks/session-start.mjs +194 -0
- package/plugins/robin/claude/hooks/skill-names.json +19 -0
- package/plugins/robin/claude/hooks/stop-gate.mjs +303 -0
- package/plugins/robin/claude/hooks/vendor/direct/round.mjs +81 -0
- package/plugins/robin/claude/hooks/vendor/find/names.mjs +46 -0
- package/plugins/robin/claude/hooks/vendor/firstlook/set.mjs +219 -0
- package/plugins/robin/claude/hooks/vendor/flow/flow.mjs +456 -0
- package/plugins/robin/claude/hooks/vendor/flow/look.mjs +140 -0
- package/plugins/robin/claude/hooks/vendor/gdd/book.mjs +484 -0
- package/plugins/robin/claude/hooks/vendor/gdd/chapters.mjs +72 -0
- package/plugins/robin/claude/hooks/vendor/gdd/doc.mjs +33 -0
- package/plugins/robin/claude/hooks/vendor/gdd/levelmap.mjs +429 -0
- package/plugins/robin/claude/hooks/vendor/gdd/rubric.mjs +251 -0
- package/plugins/robin/claude/hooks/vendor/gdd/worth.mjs +508 -0
- package/plugins/robin/claude/hooks/vendor/lanes/fence.mjs +109 -0
- package/plugins/robin/claude/hooks/vendor/lanes/lanes.mjs +356 -0
- package/plugins/robin/claude/hooks/vendor/lanes/union.mjs +63 -0
- package/plugins/robin/claude/hooks/vendor/lessons/motifs.mjs +98 -0
- package/plugins/robin/claude/hooks/vendor/lessons/store.mjs +57 -0
- package/plugins/robin/claude/hooks/vendor/look/made-of.mjs +243 -0
- package/plugins/robin/claude/hooks/vendor/look/roles.mjs +110 -0
- package/plugins/robin/claude/hooks/vendor/memory/decisions.mjs +139 -0
- package/plugins/robin/claude/hooks/vendor/memory/journal.mjs +109 -0
- package/plugins/robin/claude/hooks/vendor/owner/bar.mjs +286 -0
- package/plugins/robin/claude/hooks/vendor/pipeline/pipeline.mjs +930 -0
- package/plugins/robin/claude/hooks/vendor/playtest/keep.mjs +111 -0
- package/plugins/robin/claude/hooks/vendor/playtest/stuck.mjs +48 -0
- package/plugins/robin/claude/hooks/vendor/progress/holds.mjs +107 -0
- package/plugins/robin/claude/hooks/vendor/progress/progress.mjs +301 -0
- package/plugins/robin/claude/hooks/vendor/sim/judge.mjs +241 -0
- package/plugins/robin/claude/hooks/vendor/spec/rooms.mjs +189 -0
- package/plugins/robin/claude/hooks/vendor/spec/tunables.mjs +75 -0
- package/plugins/robin/claude/hooks/vendor/stage/harnessignore.mjs +91 -0
- package/plugins/robin/claude/hooks/vendor/stage/stage.mjs +58 -0
- package/plugins/robin/claude/hooks/vendor/status/board.mjs +173 -0
- package/plugins/robin/claude/hooks/vendor/status/file.mjs +113 -0
- package/plugins/robin/claude/hooks/vendor/studio/forks.mjs +94 -0
- package/plugins/robin/claude/hooks/vendor/studio/pitch.mjs +295 -0
- package/plugins/robin/claude/hooks/vendor/verify/fingerprint.mjs +73 -0
- package/plugins/robin/claude/hooks/vendor/verify/reads.mjs +33 -0
- package/plugins/robin/claude/hooks/vendor/wow/picks.mjs +75 -0
- package/plugins/robin/claude/skills/3d/SKILL.md +89 -0
- package/plugins/robin/claude/skills/3d/references/bake-off.md +48 -0
- package/plugins/robin/claude/skills/3d/references/bench.md +103 -0
- package/plugins/robin/claude/skills/3d/references/budgets.md +48 -0
- package/plugins/robin/claude/skills/3d/references/characters.md +67 -0
- package/plugins/robin/claude/skills/3d/references/concept-image.md +47 -0
- package/plugins/robin/claude/skills/3d/references/engine-targets.md +31 -0
- package/plugins/robin/claude/skills/3d/references/hero-route.md +104 -0
- package/plugins/robin/claude/skills/3d/references/level-spec.md +109 -0
- package/plugins/robin/claude/skills/3d/references/levels.md +84 -0
- package/plugins/robin/claude/skills/3d/references/light-and-places.md +141 -0
- package/plugins/robin/claude/skills/3d/references/models.md +111 -0
- package/plugins/robin/claude/skills/3d/references/painted-target.md +184 -0
- package/plugins/robin/claude/skills/3d/references/reading.md +41 -0
- package/plugins/robin/claude/skills/3d/references/skin.md +85 -0
- package/plugins/robin/claude/skills/3d/references/skyboxes.md +65 -0
- package/plugins/robin/claude/skills/3d/references/textures.md +71 -0
- package/plugins/robin/claude/skills/3d/references/three-loading.md +199 -0
- package/plugins/robin/claude/skills/3d/references/unity.md +78 -0
- package/plugins/robin/claude/skills/art/SKILL.md +104 -0
- package/plugins/robin/claude/skills/art/references/2d-assets.md +108 -0
- package/plugins/robin/claude/skills/art/references/animation.md +126 -0
- package/plugins/robin/claude/skills/art/references/cast.md +73 -0
- package/plugins/robin/claude/skills/art/references/characters.md +49 -0
- package/plugins/robin/claude/skills/art/references/cost.md +107 -0
- package/plugins/robin/claude/skills/art/references/effects.md +85 -0
- package/plugins/robin/claude/skills/art/references/frames.md +87 -0
- package/plugins/robin/claude/skills/art/references/judging-frames.md +64 -0
- package/plugins/robin/claude/skills/art/references/look.md +102 -0
- package/plugins/robin/claude/skills/art/references/measure.md +119 -0
- package/plugins/robin/claude/skills/art/references/pipeline.md +185 -0
- package/plugins/robin/claude/skills/art/references/pixi.md +277 -0
- package/plugins/robin/claude/skills/art/references/planes.md +27 -0
- package/plugins/robin/claude/skills/art/references/prompts.md +171 -0
- package/plugins/robin/claude/skills/art/references/sheets.md +141 -0
- package/plugins/robin/claude/skills/art/references/style-file.md +39 -0
- package/plugins/robin/claude/skills/art/references/three.md +232 -0
- package/plugins/robin/claude/skills/art/references/ui.md +163 -0
- package/plugins/robin/claude/skills/art/references/unity.md +78 -0
- package/plugins/robin/claude/skills/art/references/wiring.md +41 -0
- package/plugins/robin/claude/skills/audio/SKILL.md +92 -0
- package/plugins/robin/claude/skills/audio/references/adaptive-music.md +204 -0
- package/plugins/robin/claude/skills/audio/references/engine.md +78 -0
- package/plugins/robin/claude/skills/audio/references/measure.md +101 -0
- package/plugins/robin/claude/skills/audio/references/unity.md +74 -0
- package/plugins/robin/claude/skills/feedback/SKILL.md +120 -0
- package/plugins/robin/claude/skills/feedback/references/memory.md +99 -0
- package/plugins/robin/claude/skills/game-feel/SKILL.md +104 -0
- package/plugins/robin/claude/skills/game-feel/references/contact.md +110 -0
- package/plugins/robin/claude/skills/game-feel/references/measure.md +125 -0
- package/plugins/robin/claude/skills/game-feel/references/motion.md +134 -0
- package/plugins/robin/claude/skills/game-feel/references/payoffs.md +35 -0
- package/plugins/robin/claude/skills/game-feel/references/recipes.md +107 -0
- package/plugins/robin/claude/skills/game-feel/references/unity.md +73 -0
- package/plugins/robin/claude/skills/game-logic/SKILL.md +113 -0
- package/plugins/robin/claude/skills/game-logic/references/balance.md +88 -0
- package/plugins/robin/claude/skills/game-logic/references/content-at-scale.md +147 -0
- package/plugins/robin/claude/skills/game-logic/references/depth.md +89 -0
- package/plugins/robin/claude/skills/game-logic/references/escalation.md +41 -0
- package/plugins/robin/claude/skills/game-logic/references/levels.md +61 -0
- package/plugins/robin/claude/skills/game-logic/references/probes.md +122 -0
- package/plugins/robin/claude/skills/game-logic/references/unity.md +108 -0
- package/plugins/robin/claude/skills/game-spine/SKILL.md +118 -0
- package/plugins/robin/claude/skills/game-spine/references/camera.md +94 -0
- package/plugins/robin/claude/skills/game-spine/references/multiplayer.md +101 -0
- package/plugins/robin/claude/skills/game-spine/references/patterns.md +103 -0
- package/plugins/robin/claude/skills/game-spine/references/performance.md +96 -0
- package/plugins/robin/claude/skills/game-spine/references/pixi.md +26 -0
- package/plugins/robin/claude/skills/game-spine/references/replay.md +102 -0
- package/plugins/robin/claude/skills/game-spine/references/room-api.md +63 -0
- package/plugins/robin/claude/skills/game-spine/references/room-modes.md +40 -0
- package/plugins/robin/claude/skills/game-spine/references/sdk.md +114 -0
- package/plugins/robin/claude/skills/game-spine/references/three.md +62 -0
- package/plugins/robin/claude/skills/gdd/SKILL.md +116 -0
- package/plugins/robin/claude/skills/gdd/references/as-built.md +40 -0
- package/plugins/robin/claude/skills/gdd/references/design-measures.md +24 -0
- package/plugins/robin/claude/skills/gdd/references/design-note.md +88 -0
- package/plugins/robin/claude/skills/gdd/references/experience.md +92 -0
- package/plugins/robin/claude/skills/gdd/references/first-look.md +226 -0
- package/plugins/robin/claude/skills/gdd/references/floors.md +62 -0
- package/plugins/robin/claude/skills/gdd/references/frame.md +75 -0
- package/plugins/robin/claude/skills/gdd/references/gameplay-contract.md +81 -0
- package/plugins/robin/claude/skills/gdd/references/gdd-template.md +417 -0
- package/plugins/robin/claude/skills/gdd/references/genre-card.md +109 -0
- package/plugins/robin/claude/skills/gdd/references/genre-platformer.md +159 -0
- package/plugins/robin/claude/skills/gdd/references/genre-puzzle.md +145 -0
- package/plugins/robin/claude/skills/gdd/references/genre-racing.md +137 -0
- package/plugins/robin/claude/skills/gdd/references/genre-rpg.md +125 -0
- package/plugins/robin/claude/skills/gdd/references/genre-shooter.md +128 -0
- package/plugins/robin/claude/skills/gdd/references/genre-simulation.md +112 -0
- package/plugins/robin/claude/skills/gdd/references/genre-strategy.md +116 -0
- package/plugins/robin/claude/skills/gdd/references/genre-survival.md +122 -0
- package/plugins/robin/claude/skills/gdd/references/in-the-loop.md +106 -0
- package/plugins/robin/claude/skills/gdd/references/invent-first.md +131 -0
- package/plugins/robin/claude/skills/gdd/references/level-and-fun.md +112 -0
- package/plugins/robin/claude/skills/gdd/references/pages.md +47 -0
- package/plugins/robin/claude/skills/gdd/references/plan-at-size.md +140 -0
- package/plugins/robin/claude/skills/gdd/references/production-tiers.md +117 -0
- package/plugins/robin/claude/skills/gdd/references/sections.md +148 -0
- package/plugins/robin/claude/skills/gdd/references/spec-folder.md +131 -0
- package/plugins/robin/claude/skills/gdd/references/start.md +110 -0
- package/plugins/robin/claude/skills/gdd/references/starters.md +175 -0
- package/plugins/robin/claude/skills/gdd/references/the-path.md +133 -0
- package/plugins/robin/claude/skills/gdd/references/track.md +29 -0
- package/plugins/robin/claude/skills/gdd/references/world-and-identity.md +165 -0
- package/plugins/robin/claude/skills/gdd/references/worth.md +74 -0
- package/plugins/robin/claude/skills/mobile-ui/SKILL.md +107 -0
- package/plugins/robin/claude/skills/mobile-ui/references/contrast.md +123 -0
- package/plugins/robin/claude/skills/mobile-ui/references/hud-and-title.md +108 -0
- package/plugins/robin/claude/skills/mobile-ui/references/hud-genres.md +124 -0
- package/plugins/robin/claude/skills/mobile-ui/references/phone-check.md +156 -0
- package/plugins/robin/claude/skills/mobile-ui/references/recipes.md +279 -0
- package/plugins/robin/claude/skills/mobile-ui/references/restyle-ui.md +229 -0
- package/plugins/robin/claude/skills/mobile-ui/references/unity.md +61 -0
- package/plugins/robin/claude/skills/publishing/SKILL.md +109 -0
- package/plugins/robin/claude/skills/publishing/references/compose.md +113 -0
- package/plugins/robin/claude/skills/publishing/references/motion.md +120 -0
- package/plugins/robin/claude/skills/publishing/references/networks.md +75 -0
- package/plugins/robin/claude/skills/publishing/references/other-hosts.md +65 -0
- package/plugins/robin/claude/skills/publishing/references/playable-ad.md +90 -0
- package/plugins/robin/claude/skills/publishing/references/server-build.md +85 -0
- package/plugins/robin/claude/skills/publishing/references/store-shots.md +85 -0
- package/plugins/robin/claude/skills/publishing/references/trailer.md +55 -0
- package/plugins/robin/claude/skills/publishing/references/what-ships.md +30 -0
- package/plugins/robin/claude/skills/store/SKILL.md +81 -0
- package/plugins/robin/claude/skills/store/references/app-store.md +73 -0
- package/plugins/robin/claude/skills/store/references/google-play.md +141 -0
- package/plugins/robin/claude/skills/store/references/ios-release.md +63 -0
- package/plugins/robin/claude/skills/store/references/money.md +66 -0
- package/plugins/robin/claude/skills/store/references/purchases-and-review.md +74 -0
- package/plugins/robin/claude/skills/store/references/readiness-page.md +24 -0
- package/plugins/robin/claude/skills/store/references/readiness.md +107 -0
- package/plugins/robin/claude/skills/store/references/steam.md +38 -0
- package/plugins/robin/claude/skills/store/references/unity-store.md +55 -0
- package/plugins/robin/claude/skills/store/references/web-portals.md +43 -0
- package/plugins/robin/claude/skills/unity-game/SKILL.md +103 -0
- package/plugins/robin/claude/skills/unity-game/references/agent-ops.md +54 -0
- package/plugins/robin/claude/skills/unity-game/references/fixes.md +40 -0
- package/plugins/robin/claude/skills/unity-game/references/from-a-web-game.md +108 -0
- package/plugins/robin/claude/skills/unity-game/references/handing-off.md +42 -0
- package/plugins/robin/claude/skills/unity-game/references/performance.md +59 -0
- package/plugins/robin/claude/skills/unity-game/references/probe.md +80 -0
- package/plugins/robin/claude/skills/unity-game/references/shared-mac.md +121 -0
- package/plugins/robin/claude/skills/unity-game/references/traps.md +108 -0
- package/plugins/robin/claude/skills/verifying/SKILL.md +109 -0
- package/plugins/robin/claude/skills/verifying/references/actors.md +94 -0
- package/plugins/robin/claude/skills/verifying/references/bar.md +62 -0
- package/plugins/robin/claude/skills/verifying/references/checks.md +69 -0
- package/plugins/robin/claude/skills/verifying/references/experience.md +67 -0
- package/plugins/robin/claude/skills/verifying/references/eyes.md +54 -0
- package/plugins/robin/claude/skills/verifying/references/fidelity.md +126 -0
- package/plugins/robin/claude/skills/verifying/references/hit-bar.md +31 -0
- package/plugins/robin/claude/skills/verifying/references/journeys.md +77 -0
- package/plugins/robin/claude/skills/verifying/references/mobile-qa.md +123 -0
- package/plugins/robin/claude/skills/verifying/references/playtest.md +161 -0
- package/plugins/robin/claude/skills/verifying/references/review.md +105 -0
- package/plugins/robin/claude/skills/verifying/references/rubric.md +67 -0
- package/plugins/robin/claude/skills/verifying/references/scenes.md +49 -0
- package/plugins/robin/claude/skills/verifying/references/unity.md +60 -0
- package/plugins/robin/claude/skills/world-and-story/SKILL.md +99 -0
- package/plugins/robin/claude/skills/world-and-story/references/atmosphere.md +208 -0
- package/plugins/robin/claude/skills/world-and-story/references/forged-world.md +79 -0
- package/plugins/robin/claude/skills/world-and-story/references/living-world.md +237 -0
- package/plugins/robin/claude/skills/world-and-story/references/opening-and-chapters.md +215 -0
- package/plugins/robin/claude/skills/world-and-story/references/shelf.md +80 -0
- package/plugins/robin/claude/skills/world-and-story/references/story-at-size.md +159 -0
- package/plugins/robin/claude/skills/world-and-story/references/voice.md +175 -0
- package/plugins/robin/claude/skills/world-and-story/references/world-kit.md +154 -0
- package/plugins/robin/mcp-servers.json +25 -0
- package/plugins/robin/plugin.json +20 -0
- package/plugins/robin/skills/fp-first-look/SKILL.md +59 -0
- package/plugins/robin/skills/fp-flow/SKILL.md +50 -0
- package/plugins/robin/skills/fp-lanes/SKILL.md +38 -0
- package/plugins/robin/skills/fp-mobile-qa/SKILL.md +28 -0
- package/plugins/robin/skills/fp-new/SKILL.md +94 -0
- package/plugins/robin/skills/fp-playtest/SKILL.md +66 -0
- package/plugins/robin/skills/fp-publish/SKILL.md +23 -0
- package/plugins/robin/skills/fp-smoke-build/SKILL.md +25 -0
- package/plugins/robin/skills/fp-verify/SKILL.md +20 -0
- package/plugins/robin/skills/funpixel-3d/SKILL.md +89 -0
- package/plugins/robin/skills/funpixel-3d/references/bake-off.md +48 -0
- package/plugins/robin/skills/funpixel-3d/references/bench.md +103 -0
- package/plugins/robin/skills/funpixel-3d/references/budgets.md +48 -0
- package/plugins/robin/skills/funpixel-3d/references/characters.md +67 -0
- package/plugins/robin/skills/funpixel-3d/references/concept-image.md +47 -0
- package/plugins/robin/skills/funpixel-3d/references/engine-targets.md +31 -0
- package/plugins/robin/skills/funpixel-3d/references/hero-route.md +104 -0
- package/plugins/robin/skills/funpixel-3d/references/level-spec.md +109 -0
- package/plugins/robin/skills/funpixel-3d/references/levels.md +84 -0
- package/plugins/robin/skills/funpixel-3d/references/light-and-places.md +141 -0
- package/plugins/robin/skills/funpixel-3d/references/models.md +111 -0
- package/plugins/robin/skills/funpixel-3d/references/painted-target.md +184 -0
- package/plugins/robin/skills/funpixel-3d/references/reading.md +41 -0
- package/plugins/robin/skills/funpixel-3d/references/skin.md +85 -0
- package/plugins/robin/skills/funpixel-3d/references/skyboxes.md +65 -0
- package/plugins/robin/skills/funpixel-3d/references/textures.md +71 -0
- package/plugins/robin/skills/funpixel-3d/references/three-loading.md +199 -0
- package/plugins/robin/skills/funpixel-3d/references/unity.md +78 -0
- package/plugins/robin/skills/funpixel-art/SKILL.md +104 -0
- package/plugins/robin/skills/funpixel-art/references/2d-assets.md +108 -0
- package/plugins/robin/skills/funpixel-art/references/animation.md +126 -0
- package/plugins/robin/skills/funpixel-art/references/cast.md +73 -0
- package/plugins/robin/skills/funpixel-art/references/characters.md +49 -0
- package/plugins/robin/skills/funpixel-art/references/cost.md +107 -0
- package/plugins/robin/skills/funpixel-art/references/effects.md +85 -0
- package/plugins/robin/skills/funpixel-art/references/frames.md +87 -0
- package/plugins/robin/skills/funpixel-art/references/judging-frames.md +64 -0
- package/plugins/robin/skills/funpixel-art/references/look.md +102 -0
- package/plugins/robin/skills/funpixel-art/references/measure.md +119 -0
- package/plugins/robin/skills/funpixel-art/references/pipeline.md +185 -0
- package/plugins/robin/skills/funpixel-art/references/pixi.md +277 -0
- package/plugins/robin/skills/funpixel-art/references/planes.md +27 -0
- package/plugins/robin/skills/funpixel-art/references/prompts.md +171 -0
- package/plugins/robin/skills/funpixel-art/references/sheets.md +141 -0
- package/plugins/robin/skills/funpixel-art/references/style-file.md +39 -0
- package/plugins/robin/skills/funpixel-art/references/three.md +232 -0
- package/plugins/robin/skills/funpixel-art/references/ui.md +163 -0
- package/plugins/robin/skills/funpixel-art/references/unity.md +78 -0
- package/plugins/robin/skills/funpixel-art/references/wiring.md +41 -0
- package/plugins/robin/skills/funpixel-audio/SKILL.md +92 -0
- package/plugins/robin/skills/funpixel-audio/references/adaptive-music.md +204 -0
- package/plugins/robin/skills/funpixel-audio/references/engine.md +78 -0
- package/plugins/robin/skills/funpixel-audio/references/measure.md +101 -0
- package/plugins/robin/skills/funpixel-audio/references/unity.md +74 -0
- package/plugins/robin/skills/funpixel-brief/SKILL.md +163 -0
- package/plugins/robin/skills/funpixel-feedback/SKILL.md +120 -0
- package/plugins/robin/skills/funpixel-feedback/references/memory.md +99 -0
- package/plugins/robin/skills/funpixel-game-feel/SKILL.md +104 -0
- package/plugins/robin/skills/funpixel-game-feel/references/contact.md +110 -0
- package/plugins/robin/skills/funpixel-game-feel/references/measure.md +125 -0
- package/plugins/robin/skills/funpixel-game-feel/references/motion.md +134 -0
- package/plugins/robin/skills/funpixel-game-feel/references/payoffs.md +35 -0
- package/plugins/robin/skills/funpixel-game-feel/references/recipes.md +107 -0
- package/plugins/robin/skills/funpixel-game-feel/references/unity.md +73 -0
- package/plugins/robin/skills/funpixel-game-logic/SKILL.md +113 -0
- package/plugins/robin/skills/funpixel-game-logic/references/balance.md +88 -0
- package/plugins/robin/skills/funpixel-game-logic/references/content-at-scale.md +147 -0
- package/plugins/robin/skills/funpixel-game-logic/references/depth.md +89 -0
- package/plugins/robin/skills/funpixel-game-logic/references/escalation.md +41 -0
- package/plugins/robin/skills/funpixel-game-logic/references/levels.md +61 -0
- package/plugins/robin/skills/funpixel-game-logic/references/probes.md +122 -0
- package/plugins/robin/skills/funpixel-game-logic/references/unity.md +108 -0
- package/plugins/robin/skills/funpixel-game-spine/SKILL.md +118 -0
- package/plugins/robin/skills/funpixel-game-spine/references/camera.md +94 -0
- package/plugins/robin/skills/funpixel-game-spine/references/multiplayer.md +101 -0
- package/plugins/robin/skills/funpixel-game-spine/references/patterns.md +103 -0
- package/plugins/robin/skills/funpixel-game-spine/references/performance.md +96 -0
- package/plugins/robin/skills/funpixel-game-spine/references/pixi.md +26 -0
- package/plugins/robin/skills/funpixel-game-spine/references/replay.md +102 -0
- package/plugins/robin/skills/funpixel-game-spine/references/room-api.md +63 -0
- package/plugins/robin/skills/funpixel-game-spine/references/room-modes.md +40 -0
- package/plugins/robin/skills/funpixel-game-spine/references/sdk.md +114 -0
- package/plugins/robin/skills/funpixel-game-spine/references/three.md +62 -0
- package/plugins/robin/skills/funpixel-gdd/SKILL.md +116 -0
- package/plugins/robin/skills/funpixel-gdd/references/as-built.md +40 -0
- package/plugins/robin/skills/funpixel-gdd/references/design-measures.md +24 -0
- package/plugins/robin/skills/funpixel-gdd/references/design-note.md +88 -0
- package/plugins/robin/skills/funpixel-gdd/references/experience.md +92 -0
- package/plugins/robin/skills/funpixel-gdd/references/first-look.md +226 -0
- package/plugins/robin/skills/funpixel-gdd/references/floors.md +62 -0
- package/plugins/robin/skills/funpixel-gdd/references/frame.md +75 -0
- package/plugins/robin/skills/funpixel-gdd/references/gameplay-contract.md +81 -0
- package/plugins/robin/skills/funpixel-gdd/references/gdd-template.md +417 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-card.md +109 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-platformer.md +159 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-puzzle.md +145 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-racing.md +137 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-rpg.md +125 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-shooter.md +128 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-simulation.md +112 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-strategy.md +116 -0
- package/plugins/robin/skills/funpixel-gdd/references/genre-survival.md +122 -0
- package/plugins/robin/skills/funpixel-gdd/references/in-the-loop.md +106 -0
- package/plugins/robin/skills/funpixel-gdd/references/invent-first.md +131 -0
- package/plugins/robin/skills/funpixel-gdd/references/level-and-fun.md +112 -0
- package/plugins/robin/skills/funpixel-gdd/references/pages.md +47 -0
- package/plugins/robin/skills/funpixel-gdd/references/plan-at-size.md +140 -0
- package/plugins/robin/skills/funpixel-gdd/references/production-tiers.md +117 -0
- package/plugins/robin/skills/funpixel-gdd/references/sections.md +148 -0
- package/plugins/robin/skills/funpixel-gdd/references/spec-folder.md +131 -0
- package/plugins/robin/skills/funpixel-gdd/references/start.md +110 -0
- package/plugins/robin/skills/funpixel-gdd/references/starters.md +175 -0
- package/plugins/robin/skills/funpixel-gdd/references/the-path.md +133 -0
- package/plugins/robin/skills/funpixel-gdd/references/track.md +29 -0
- package/plugins/robin/skills/funpixel-gdd/references/world-and-identity.md +165 -0
- package/plugins/robin/skills/funpixel-gdd/references/worth.md +74 -0
- package/plugins/robin/skills/funpixel-mobile-ui/SKILL.md +107 -0
- package/plugins/robin/skills/funpixel-mobile-ui/references/contrast.md +123 -0
- package/plugins/robin/skills/funpixel-mobile-ui/references/hud-and-title.md +108 -0
- package/plugins/robin/skills/funpixel-mobile-ui/references/hud-genres.md +124 -0
- package/plugins/robin/skills/funpixel-mobile-ui/references/phone-check.md +156 -0
- package/plugins/robin/skills/funpixel-mobile-ui/references/recipes.md +279 -0
- package/plugins/robin/skills/funpixel-mobile-ui/references/restyle-ui.md +229 -0
- package/plugins/robin/skills/funpixel-mobile-ui/references/unity.md +61 -0
- package/plugins/robin/skills/funpixel-publish/SKILL.md +109 -0
- package/plugins/robin/skills/funpixel-publish/references/compose.md +113 -0
- package/plugins/robin/skills/funpixel-publish/references/motion.md +120 -0
- package/plugins/robin/skills/funpixel-publish/references/networks.md +75 -0
- package/plugins/robin/skills/funpixel-publish/references/other-hosts.md +65 -0
- package/plugins/robin/skills/funpixel-publish/references/playable-ad.md +90 -0
- package/plugins/robin/skills/funpixel-publish/references/server-build.md +85 -0
- package/plugins/robin/skills/funpixel-publish/references/store-shots.md +85 -0
- package/plugins/robin/skills/funpixel-publish/references/trailer.md +55 -0
- package/plugins/robin/skills/funpixel-publish/references/what-ships.md +30 -0
- package/plugins/robin/skills/funpixel-store/SKILL.md +81 -0
- package/plugins/robin/skills/funpixel-store/references/app-store.md +73 -0
- package/plugins/robin/skills/funpixel-store/references/google-play.md +141 -0
- package/plugins/robin/skills/funpixel-store/references/ios-release.md +63 -0
- package/plugins/robin/skills/funpixel-store/references/money.md +66 -0
- package/plugins/robin/skills/funpixel-store/references/purchases-and-review.md +74 -0
- package/plugins/robin/skills/funpixel-store/references/readiness-page.md +24 -0
- package/plugins/robin/skills/funpixel-store/references/readiness.md +107 -0
- package/plugins/robin/skills/funpixel-store/references/steam.md +38 -0
- package/plugins/robin/skills/funpixel-store/references/unity-store.md +55 -0
- package/plugins/robin/skills/funpixel-store/references/web-portals.md +43 -0
- package/plugins/robin/skills/funpixel-unity-game/SKILL.md +103 -0
- package/plugins/robin/skills/funpixel-unity-game/references/agent-ops.md +54 -0
- package/plugins/robin/skills/funpixel-unity-game/references/fixes.md +40 -0
- package/plugins/robin/skills/funpixel-unity-game/references/from-a-web-game.md +108 -0
- package/plugins/robin/skills/funpixel-unity-game/references/handing-off.md +42 -0
- package/plugins/robin/skills/funpixel-unity-game/references/performance.md +59 -0
- package/plugins/robin/skills/funpixel-unity-game/references/probe.md +80 -0
- package/plugins/robin/skills/funpixel-unity-game/references/shared-mac.md +121 -0
- package/plugins/robin/skills/funpixel-unity-game/references/traps.md +108 -0
- package/plugins/robin/skills/funpixel-verify/SKILL.md +109 -0
- package/plugins/robin/skills/funpixel-verify/references/actors.md +94 -0
- package/plugins/robin/skills/funpixel-verify/references/bar.md +62 -0
- package/plugins/robin/skills/funpixel-verify/references/checks.md +69 -0
- package/plugins/robin/skills/funpixel-verify/references/experience.md +67 -0
- package/plugins/robin/skills/funpixel-verify/references/eyes.md +54 -0
- package/plugins/robin/skills/funpixel-verify/references/fidelity.md +126 -0
- package/plugins/robin/skills/funpixel-verify/references/hit-bar.md +31 -0
- package/plugins/robin/skills/funpixel-verify/references/journeys.md +77 -0
- package/plugins/robin/skills/funpixel-verify/references/mobile-qa.md +123 -0
- package/plugins/robin/skills/funpixel-verify/references/playtest.md +161 -0
- package/plugins/robin/skills/funpixel-verify/references/review.md +105 -0
- package/plugins/robin/skills/funpixel-verify/references/rubric.md +67 -0
- package/plugins/robin/skills/funpixel-verify/references/scenes.md +49 -0
- package/plugins/robin/skills/funpixel-verify/references/unity.md +60 -0
- package/plugins/robin/skills/funpixel-world-and-story/SKILL.md +99 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/atmosphere.md +208 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/forged-world.md +79 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/living-world.md +237 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/opening-and-chapters.md +215 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/shelf.md +80 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/story-at-size.md +159 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/voice.md +175 -0
- package/plugins/robin/skills/funpixel-world-and-story/references/world-kit.md +154 -0
- package/templates/common/.agents/skills/funpixel-3d/SKILL.md +89 -0
- package/templates/common/.agents/skills/funpixel-3d/references/bake-off.md +48 -0
- package/templates/common/.agents/skills/funpixel-3d/references/bench.md +103 -0
- package/templates/common/.agents/skills/funpixel-3d/references/budgets.md +48 -0
- package/templates/common/.agents/skills/funpixel-3d/references/characters.md +67 -0
- package/templates/common/.agents/skills/funpixel-3d/references/concept-image.md +47 -0
- package/templates/common/.agents/skills/funpixel-3d/references/engine-targets.md +31 -0
- package/templates/common/.agents/skills/funpixel-3d/references/hero-route.md +104 -0
- package/templates/common/.agents/skills/funpixel-3d/references/level-spec.md +109 -0
- package/templates/common/.agents/skills/funpixel-3d/references/levels.md +84 -0
- package/templates/common/.agents/skills/funpixel-3d/references/light-and-places.md +141 -0
- package/templates/common/.agents/skills/funpixel-3d/references/models.md +111 -0
- package/templates/common/.agents/skills/funpixel-3d/references/painted-target.md +184 -0
- package/templates/common/.agents/skills/funpixel-3d/references/reading.md +41 -0
- package/templates/common/.agents/skills/funpixel-3d/references/skin.md +85 -0
- package/templates/common/.agents/skills/funpixel-3d/references/skyboxes.md +65 -0
- package/templates/common/.agents/skills/funpixel-3d/references/textures.md +71 -0
- package/templates/common/.agents/skills/funpixel-3d/references/three-loading.md +199 -0
- package/templates/common/.agents/skills/funpixel-3d/references/unity.md +78 -0
- package/templates/common/.agents/skills/funpixel-art/SKILL.md +104 -0
- package/templates/common/.agents/skills/funpixel-art/references/2d-assets.md +108 -0
- package/templates/common/.agents/skills/funpixel-art/references/animation.md +126 -0
- package/templates/common/.agents/skills/funpixel-art/references/cast.md +73 -0
- package/templates/common/.agents/skills/funpixel-art/references/characters.md +49 -0
- package/templates/common/.agents/skills/funpixel-art/references/cost.md +107 -0
- package/templates/common/.agents/skills/funpixel-art/references/effects.md +85 -0
- package/templates/common/.agents/skills/funpixel-art/references/frames.md +87 -0
- package/templates/common/.agents/skills/funpixel-art/references/judging-frames.md +64 -0
- package/templates/common/.agents/skills/funpixel-art/references/look.md +102 -0
- package/templates/common/.agents/skills/funpixel-art/references/measure.md +119 -0
- package/templates/common/.agents/skills/funpixel-art/references/pipeline.md +185 -0
- package/templates/common/.agents/skills/funpixel-art/references/pixi.md +277 -0
- package/templates/common/.agents/skills/funpixel-art/references/planes.md +27 -0
- package/templates/common/.agents/skills/funpixel-art/references/prompts.md +171 -0
- package/templates/common/.agents/skills/funpixel-art/references/sheets.md +141 -0
- package/templates/common/.agents/skills/funpixel-art/references/style-file.md +39 -0
- package/templates/common/.agents/skills/funpixel-art/references/three.md +232 -0
- package/templates/common/.agents/skills/funpixel-art/references/ui.md +163 -0
- package/templates/common/.agents/skills/funpixel-art/references/unity.md +78 -0
- package/templates/common/.agents/skills/funpixel-art/references/wiring.md +41 -0
- package/templates/common/.agents/skills/funpixel-audio/SKILL.md +92 -0
- package/templates/common/.agents/skills/funpixel-audio/references/adaptive-music.md +204 -0
- package/templates/common/.agents/skills/funpixel-audio/references/engine.md +78 -0
- package/templates/common/.agents/skills/funpixel-audio/references/measure.md +101 -0
- package/templates/common/.agents/skills/funpixel-audio/references/unity.md +74 -0
- package/templates/common/.agents/skills/funpixel-feedback/SKILL.md +120 -0
- package/templates/common/.agents/skills/funpixel-feedback/references/memory.md +99 -0
- package/templates/common/.agents/skills/funpixel-game-feel/SKILL.md +104 -0
- package/templates/common/.agents/skills/funpixel-game-feel/references/contact.md +110 -0
- package/templates/common/.agents/skills/funpixel-game-feel/references/measure.md +125 -0
- package/templates/common/.agents/skills/funpixel-game-feel/references/motion.md +134 -0
- package/templates/common/.agents/skills/funpixel-game-feel/references/payoffs.md +35 -0
- package/templates/common/.agents/skills/funpixel-game-feel/references/recipes.md +107 -0
- package/templates/common/.agents/skills/funpixel-game-feel/references/unity.md +73 -0
- package/templates/common/.agents/skills/funpixel-game-logic/SKILL.md +113 -0
- package/templates/common/.agents/skills/funpixel-game-logic/references/balance.md +88 -0
- package/templates/common/.agents/skills/funpixel-game-logic/references/content-at-scale.md +147 -0
- package/templates/common/.agents/skills/funpixel-game-logic/references/depth.md +89 -0
- package/templates/common/.agents/skills/funpixel-game-logic/references/escalation.md +41 -0
- package/templates/common/.agents/skills/funpixel-game-logic/references/levels.md +61 -0
- package/templates/common/.agents/skills/funpixel-game-logic/references/probes.md +122 -0
- package/templates/common/.agents/skills/funpixel-game-logic/references/unity.md +108 -0
- package/templates/common/.agents/skills/funpixel-game-spine/SKILL.md +118 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/camera.md +94 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/multiplayer.md +101 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/patterns.md +103 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/performance.md +96 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/pixi.md +26 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/replay.md +102 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/room-api.md +63 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/room-modes.md +40 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/sdk.md +114 -0
- package/templates/common/.agents/skills/funpixel-game-spine/references/three.md +62 -0
- package/templates/common/.agents/skills/funpixel-gdd/SKILL.md +116 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/as-built.md +40 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/design-measures.md +24 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/design-note.md +88 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/experience.md +92 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/first-look.md +226 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/floors.md +62 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/frame.md +75 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/gameplay-contract.md +81 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/gdd-template.md +417 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-card.md +109 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-platformer.md +159 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-puzzle.md +145 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-racing.md +137 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-rpg.md +125 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-shooter.md +128 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-simulation.md +112 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-strategy.md +116 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/genre-survival.md +122 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/in-the-loop.md +106 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/invent-first.md +131 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/level-and-fun.md +112 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/pages.md +47 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/plan-at-size.md +140 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/production-tiers.md +117 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/sections.md +148 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/spec-folder.md +131 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/start.md +110 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/starters.md +175 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/the-path.md +133 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/track.md +29 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/world-and-identity.md +165 -0
- package/templates/common/.agents/skills/funpixel-gdd/references/worth.md +74 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/SKILL.md +107 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/references/contrast.md +123 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/references/hud-and-title.md +108 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/references/hud-genres.md +124 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/references/phone-check.md +156 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/references/recipes.md +279 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/references/restyle-ui.md +229 -0
- package/templates/common/.agents/skills/funpixel-mobile-ui/references/unity.md +61 -0
- package/templates/common/.agents/skills/funpixel-publish/SKILL.md +109 -0
- package/templates/common/.agents/skills/funpixel-publish/references/compose.md +113 -0
- package/templates/common/.agents/skills/funpixel-publish/references/motion.md +120 -0
- package/templates/common/.agents/skills/funpixel-publish/references/networks.md +75 -0
- package/templates/common/.agents/skills/funpixel-publish/references/other-hosts.md +65 -0
- package/templates/common/.agents/skills/funpixel-publish/references/playable-ad.md +90 -0
- package/templates/common/.agents/skills/funpixel-publish/references/server-build.md +85 -0
- package/templates/common/.agents/skills/funpixel-publish/references/store-shots.md +85 -0
- package/templates/common/.agents/skills/funpixel-publish/references/trailer.md +55 -0
- package/templates/common/.agents/skills/funpixel-publish/references/what-ships.md +30 -0
- package/templates/common/.agents/skills/funpixel-store/SKILL.md +81 -0
- package/templates/common/.agents/skills/funpixel-store/references/app-store.md +73 -0
- package/templates/common/.agents/skills/funpixel-store/references/google-play.md +141 -0
- package/templates/common/.agents/skills/funpixel-store/references/ios-release.md +63 -0
- package/templates/common/.agents/skills/funpixel-store/references/money.md +66 -0
- package/templates/common/.agents/skills/funpixel-store/references/purchases-and-review.md +74 -0
- package/templates/common/.agents/skills/funpixel-store/references/readiness-page.md +24 -0
- package/templates/common/.agents/skills/funpixel-store/references/readiness.md +107 -0
- package/templates/common/.agents/skills/funpixel-store/references/steam.md +38 -0
- package/templates/common/.agents/skills/funpixel-store/references/unity-store.md +55 -0
- package/templates/common/.agents/skills/funpixel-store/references/web-portals.md +43 -0
- package/templates/common/.agents/skills/funpixel-unity-game/SKILL.md +103 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/agent-ops.md +54 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/fixes.md +40 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/from-a-web-game.md +108 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/handing-off.md +42 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/performance.md +59 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/probe.md +80 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/shared-mac.md +121 -0
- package/templates/common/.agents/skills/funpixel-unity-game/references/traps.md +108 -0
- package/templates/common/.agents/skills/funpixel-verify/SKILL.md +109 -0
- package/templates/common/.agents/skills/funpixel-verify/references/actors.md +94 -0
- package/templates/common/.agents/skills/funpixel-verify/references/bar.md +62 -0
- package/templates/common/.agents/skills/funpixel-verify/references/checks.md +69 -0
- package/templates/common/.agents/skills/funpixel-verify/references/experience.md +67 -0
- package/templates/common/.agents/skills/funpixel-verify/references/eyes.md +54 -0
- package/templates/common/.agents/skills/funpixel-verify/references/fidelity.md +126 -0
- package/templates/common/.agents/skills/funpixel-verify/references/hit-bar.md +31 -0
- package/templates/common/.agents/skills/funpixel-verify/references/journeys.md +77 -0
- package/templates/common/.agents/skills/funpixel-verify/references/mobile-qa.md +123 -0
- package/templates/common/.agents/skills/funpixel-verify/references/playtest.md +161 -0
- package/templates/common/.agents/skills/funpixel-verify/references/review.md +105 -0
- package/templates/common/.agents/skills/funpixel-verify/references/rubric.md +67 -0
- package/templates/common/.agents/skills/funpixel-verify/references/scenes.md +49 -0
- package/templates/common/.agents/skills/funpixel-verify/references/unity.md +60 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/SKILL.md +99 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/atmosphere.md +208 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/forged-world.md +79 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/living-world.md +237 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/opening-and-chapters.md +215 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/shelf.md +80 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/story-at-size.md +159 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/voice.md +175 -0
- package/templates/common/.agents/skills/funpixel-world-and-story/references/world-kit.md +154 -0
- package/templates/common/.claude/settings.json +3 -0
- package/templates/common/.harnessignore +28 -0
- package/templates/common/AGENTS.md +135 -0
- package/templates/common/CLAUDE.md +1 -0
- package/templates/common/assets/assets.example.json +9 -0
- package/templates/common/index.html +13 -0
- package/templates/common/src/art/files.mjs +27 -0
- package/templates/common/src/assets.ts +62 -0
- package/templates/common/src/beat.ts +50 -0
- package/templates/common/src/characters.ts +54 -0
- package/templates/common/src/expose.ts +63 -0
- package/templates/common/src/feel.ts +78 -0
- package/templates/common/src/fpx-hooks.ts +46 -0
- package/templates/common/src/frame.ts +63 -0
- package/templates/common/src/grade.ts +47 -0
- package/templates/common/src/hud-kit.css +29 -0
- package/templates/common/src/hud-kit.tsx +85 -0
- package/templates/common/src/hud.tsx +55 -0
- package/templates/common/src/icons.tsx +35 -0
- package/templates/common/src/input.ts +70 -0
- package/templates/common/src/juice.ts +92 -0
- package/templates/common/src/levels.ts +43 -0
- package/templates/common/src/living.ts +91 -0
- package/templates/common/src/look.json +19 -0
- package/templates/common/src/look.ts +54 -0
- package/templates/common/src/main.tsx +31 -0
- package/templates/common/src/markers.ts +60 -0
- package/templates/common/src/motion-sample.ts +71 -0
- package/templates/common/src/motion.ts +92 -0
- package/templates/common/src/pin.ts +32 -0
- package/templates/common/src/platform.ts +67 -0
- package/templates/common/src/pose.ts +22 -0
- package/templates/common/src/probe-human.ts +29 -0
- package/templates/common/src/probe-kit.ts +99 -0
- package/templates/common/src/rules.ts +99 -0
- package/templates/common/src/save.ts +21 -0
- package/templates/common/src/screens.css +34 -0
- package/templates/common/src/screens.tsx +95 -0
- package/templates/common/src/selftests.ts +22 -0
- package/templates/common/src/session.ts +99 -0
- package/templates/common/src/sound.ts +85 -0
- package/templates/common/src/splash-funpixel/OFL.txt +94 -0
- package/templates/common/src/splash-funpixel/card.css +18 -0
- package/templates/common/src/splash-funpixel/card.tsx +22 -0
- package/templates/common/src/splash.css +15 -0
- package/templates/common/src/splash.tsx +86 -0
- package/templates/common/src/store.ts +68 -0
- package/templates/common/src/strike.ts +82 -0
- package/templates/common/src/styles.css +81 -0
- package/templates/common/src/toasts.ts +75 -0
- package/templates/common/src/world.ts +91 -0
- package/templates/common/test/feel.json +36 -0
- package/templates/common/test/platform.test.ts +42 -0
- package/templates/common/test/probes.ts +72 -0
- package/templates/common/test/rules.test.ts +88 -0
- package/templates/common/tsconfig.json +16 -0
- package/templates/common/vite.config.ts +6 -0
- package/templates/pixi/src/character.ts +63 -0
- package/templates/pixi/src/game.ts +99 -0
- package/templates/pixi/src/world-hud.ts +16 -0
- package/templates/spec/common/src/chapters.ts +97 -0
- package/templates/spec/common/src/levels.ts +68 -0
- package/templates/spec/common/src/probe-rooms.ts +63 -0
- package/templates/spec/common/src/room-map.tsx +30 -0
- package/templates/spec/common/src/tune.ts +93 -0
- package/templates/spec/common/test/rooms.test.ts +59 -0
- package/templates/spec/common/test/rooms.ts +53 -0
- package/templates/spec/three-world/test/rooms.ts +54 -0
- package/templates/three/src/character.ts +65 -0
- package/templates/three/src/game.ts +99 -0
- package/templates/three/src/world-hud.ts +22 -0
- package/templates/three-world/src/bot.ts +43 -0
- package/templates/three-world/src/budget.ts +73 -0
- package/templates/three-world/src/camera-rig.ts +99 -0
- package/templates/three-world/src/controls.tsx +49 -0
- package/templates/three-world/src/cutout-atlas.ts +26 -0
- package/templates/three-world/src/cutout-math.ts +47 -0
- package/templates/three-world/src/cutouts.ts +99 -0
- package/templates/three-world/src/dressing-math.ts +98 -0
- package/templates/three-world/src/dressing.ts +84 -0
- package/templates/three-world/src/expose.ts +82 -0
- package/templates/three-world/src/feel.ts +79 -0
- package/templates/three-world/src/game.ts +99 -0
- package/templates/three-world/src/hud.tsx +44 -0
- package/templates/three-world/src/icons.tsx +36 -0
- package/templates/three-world/src/input.ts +73 -0
- package/templates/three-world/src/juice.ts +91 -0
- package/templates/three-world/src/layout.ts +73 -0
- package/templates/three-world/src/light-math.ts +78 -0
- package/templates/three-world/src/light.ts +77 -0
- package/templates/three-world/src/look.json +30 -0
- package/templates/three-world/src/main.tsx +38 -0
- package/templates/three-world/src/models.ts +62 -0
- package/templates/three-world/src/palette.ts +21 -0
- package/templates/three-world/src/places.json +50 -0
- package/templates/three-world/src/places.ts +56 -0
- package/templates/three-world/src/pose.ts +22 -0
- package/templates/three-world/src/post.ts +47 -0
- package/templates/three-world/src/rest-math.ts +29 -0
- package/templates/three-world/src/rules.ts +89 -0
- package/templates/three-world/src/screens.css +45 -0
- package/templates/three-world/src/screens.tsx +96 -0
- package/templates/three-world/src/selftests.ts +25 -0
- package/templates/three-world/src/session.ts +99 -0
- package/templates/three-world/src/shots.ts +59 -0
- package/templates/three-world/src/sky.ts +48 -0
- package/templates/three-world/src/stage.ts +83 -0
- package/templates/three-world/src/styles.css +95 -0
- package/templates/three-world/src/surfaces.ts +55 -0
- package/templates/three-world/src/world.ts +70 -0
- package/templates/three-world/test/feel.json +29 -0
- package/templates/three-world/test/probes.ts +65 -0
- package/templates/three-world/test/resolve.mjs +13 -0
- package/templates/three-world/test/rules.test.ts +81 -0
- package/unity/com.funpixel.probe/Editor/Funpixel.Probe.Editor.asmdef +16 -0
- package/unity/com.funpixel.probe/Editor/Funpixel.Probe.Editor.asmdef.meta +7 -0
- package/unity/com.funpixel.probe/Editor/ProbeBuild.cs +97 -0
- package/unity/com.funpixel.probe/Editor/ProbeBuild.cs.meta +11 -0
- package/unity/com.funpixel.probe/Editor/ReleaseGuard.cs +23 -0
- package/unity/com.funpixel.probe/Editor/ReleaseGuard.cs.meta +11 -0
- package/unity/com.funpixel.probe/Editor.meta +8 -0
- package/unity/com.funpixel.probe/Runtime/Api/Funpixel.Probe.asmdef +14 -0
- package/unity/com.funpixel.probe/Runtime/Api/Funpixel.Probe.asmdef.meta +7 -0
- package/unity/com.funpixel.probe/Runtime/Api/FunpixelProbe.cs +146 -0
- package/unity/com.funpixel.probe/Runtime/Api/FunpixelProbe.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Api.meta +8 -0
- package/unity/com.funpixel.probe/Runtime/Player/Args.cs +87 -0
- package/unity/com.funpixel.probe/Runtime/Player/Args.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/Boot.cs +67 -0
- package/unity/com.funpixel.probe/Runtime/Player/Boot.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/Bridge.cs +559 -0
- package/unity/com.funpixel.probe/Runtime/Player/Bridge.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/Capture.cs +145 -0
- package/unity/com.funpixel.probe/Runtime/Player/Capture.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/Funpixel.Probe.Player.asmdef +32 -0
- package/unity/com.funpixel.probe/Runtime/Player/Funpixel.Probe.Player.asmdef.meta +7 -0
- package/unity/com.funpixel.probe/Runtime/Player/Inject.cs +127 -0
- package/unity/com.funpixel.probe/Runtime/Player/Inject.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/Json.cs +246 -0
- package/unity/com.funpixel.probe/Runtime/Player/Json.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/Probe.cs +194 -0
- package/unity/com.funpixel.probe/Runtime/Player/Probe.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/Stats.cs +266 -0
- package/unity/com.funpixel.probe/Runtime/Player/Stats.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player/UiTargets.cs +134 -0
- package/unity/com.funpixel.probe/Runtime/Player/UiTargets.cs.meta +11 -0
- package/unity/com.funpixel.probe/Runtime/Player.meta +8 -0
- package/unity/com.funpixel.probe/Runtime/link.xml +7 -0
- package/unity/com.funpixel.probe/Runtime/link.xml.meta +7 -0
- package/unity/com.funpixel.probe/Runtime.meta +8 -0
- package/unity/com.funpixel.probe/Tests/Editor/Funpixel.Probe.Tests.asmdef +25 -0
- package/unity/com.funpixel.probe/Tests/Editor/Funpixel.Probe.Tests.asmdef.meta +7 -0
- package/unity/com.funpixel.probe/Tests/Editor/StatsTests.cs +147 -0
- package/unity/com.funpixel.probe/Tests/Editor/StatsTests.cs.meta +11 -0
- package/unity/com.funpixel.probe/Tests/Editor/WireTests.cs +86 -0
- package/unity/com.funpixel.probe/Tests/Editor/WireTests.cs.meta +11 -0
- package/unity/com.funpixel.probe/Tests/Editor.meta +8 -0
- package/unity/com.funpixel.probe/Tests.meta +8 -0
- package/unity/com.funpixel.probe/package.json +14 -0
- package/unity/com.funpixel.probe/package.json.meta +7 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var e=(e=>(e.Application="application",e.WebGLPipes="webgl-pipes",e.WebGLPipesAdaptor="webgl-pipes-adaptor",e.WebGLSystem="webgl-system",e.WebGLLoader="webgl-loader",e.WebGPUPipes="webgpu-pipes",e.WebGPUPipesAdaptor="webgpu-pipes-adaptor",e.WebGPUSystem="webgpu-system",e.WebGPULoader="webgpu-loader",e.CanvasSystem="canvas-system",e.CanvasPipesAdaptor="canvas-pipes-adaptor",e.CanvasPipes="canvas-pipes",e.CanvasLoader="canvas-loader",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e.MaskEffect="mask-effect",e.BlendMode="blend-mode",e.TextureSource="texture-source",e.TextureUploaderWebGL="texture-uploader-webgl",e.TextureUploaderWebGPU="texture-uploader-webgpu",e.Environment="environment",e.ShapeBuilder="shape-builder",e.Batcher="batcher",e))(e||{});const t=e=>{if("function"==typeof e||"object"==typeof e&&e.extension){if(!e.extension)throw new Error("Extension class must have an extension object");e={..."object"!=typeof e.extension?{type:e.extension}:e.extension,ref:e}}if("object"!=typeof e)throw new Error("Invalid extension type");return"string"==typeof(e={...e}).type&&(e.type=[e.type]),e},r=(e,r)=>t(e).priority??r,n={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(t).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...e){return e.map(t).forEach(e=>{e.type.forEach(t=>{const r=this._addHandlers,n=this._queue;r[t]?r[t]?.(e):(n[t]=n[t]||[],n[t]?.push(e))})}),this},handle(e,t,r){const n=this._addHandlers,s=this._removeHandlers;if(n[e]||s[e])throw new Error(`Extension type ${e} already has a handler`);n[e]=t,s[e]=r;const i=this._queue;return i[e]&&(i[e]?.forEach(e=>t(e)),delete i[e]),this},handleByMap(e,t){return this.handle(e,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(e,t,n=-1){return this.handle(e,e=>{t.findIndex(t=>t.name===e.name)>=0||(t.push({name:e.name,value:e.ref}),t.sort((e,t)=>r(t.value,n)-r(e.value,n)))},e=>{const r=t.findIndex(t=>t.name===e.name);-1!==r&&t.splice(r,1)})},handleByList(e,t,n=-1){return this.handle(e,e=>{t.includes(e.ref)||(t.push(e.ref),t.sort((e,t)=>r(t,n)-r(e,n)))},e=>{const r=t.indexOf(e.ref);-1!==r&&t.splice(r,1)})},mixin(e,...t){for(const r of t)Object.defineProperties(e.prototype,Object.getOwnPropertyDescriptors(r))}},s={extension:{type:e.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(function(){return JT})}},i={extension:{type:e.Environment,name:"webworker",priority:0},test:()=>"undefined"!=typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await Promise.resolve().then(function(){return eS})}};class o{constructor(e,t,r){this._x=t||0,this._y=r||0,this._observer=e}clone(e){return new o(e??this._observer,this._x,this._y)}set(e=0,t=e){return this._x===e&&this._y===t||(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return this._x===e.x&&this._y===e.y||(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var l,u={exports:{}};var h=(l||(l=1,function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(e,t,n,i,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,i||e,o),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,s=[];if(0===this._eventsCount)return s;for(n in e=this._events)t.call(e,n)&&s.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,i=n.length,o=new Array(i);s<i;s++)o[s]=n[s].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,s,i,o){var a=r?r+e:e;if(!this._events[a])return!1;var l,u,h=this._events[a],c=arguments.length;if(h.fn){switch(h.once&&this.removeListener(e,h.fn,void 0,!0),c){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,t),!0;case 3:return h.fn.call(h.context,t,n),!0;case 4:return h.fn.call(h.context,t,n,s),!0;case 5:return h.fn.call(h.context,t,n,s,i),!0;case 6:return h.fn.call(h.context,t,n,s,i,o),!0}for(u=1,l=new Array(c-1);u<c;u++)l[u-1]=arguments[u];h.fn.apply(h.context,l)}else{var d,p=h.length;for(u=0;u<p;u++)switch(h[u].once&&this.removeListener(e,h[u].fn,void 0,!0),c){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,t);break;case 3:h[u].fn.call(h[u].context,t,n);break;case 4:h[u].fn.call(h[u].context,t,n,s);break;default:if(!l)for(d=1,l=new Array(c-1);d<c;d++)l[d-1]=arguments[d];h[u].fn.apply(h[u].context,l)}}return!0},a.prototype.on=function(e,t,r){return i(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return i(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,s){var i=r?r+e:e;if(!this._events[i])return this;if(!t)return o(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||s&&!a.once||n&&a.context!==n||o(this,i);else{for(var l=0,u=[],h=a.length;l<h;l++)(a[l].fn!==t||s&&!a[l].once||n&&a[l].context!==n)&&u.push(a[l]);u.length?this._events[i]=1===u.length?u[0]:u:o(this,i)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a}(u)),u.exports),c=a(h);const d=2*Math.PI,p=180/Math.PI,f=Math.PI/180;class m{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new m(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return g.x=0,g.y=0,g}}const g=new m;class _{constructor(e=1,t=0,r=0,n=1,s=0,i=0){this.array=null,this.a=e,this.b=t,this.c=r,this.d=n,this.tx=s,this.ty=i}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,r,n,s,i){return this.a=e,this.b=t,this.c=r,this.d=n,this.tx=s,this.ty=i,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const r=t||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(e,t){t=t||new m;const r=e.x,n=e.y;return t.x=this.a*r+this.c*n+this.tx,t.y=this.b*r+this.d*n+this.ty,t}applyInverse(e,t){t=t||new m;const r=this.a,n=this.b,s=this.c,i=this.d,o=this.tx,a=this.ty,l=1/(r*i+s*-n),u=e.x,h=e.y;return t.x=i*l*u+-s*l*h+(a*s-o*i)*l,t.y=r*l*h+-n*l*u+(-a*r+o*n)*l,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),r=Math.sin(e),n=this.a,s=this.c,i=this.tx;return this.a=n*t-this.b*r,this.b=n*r+this.b*t,this.c=s*t-this.d*r,this.d=s*r+this.d*t,this.tx=i*t-this.ty*r,this.ty=i*r+this.ty*t,this}append(e){const t=this.a,r=this.b,n=this.c,s=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*r+e.b*s,this.c=e.c*t+e.d*n,this.d=e.c*r+e.d*s,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*r+e.ty*s+this.ty,this}appendFrom(e,t){const r=e.a,n=e.b,s=e.c,i=e.d,o=e.tx,a=e.ty,l=t.a,u=t.b,h=t.c,c=t.d;return this.a=r*l+n*h,this.b=r*u+n*c,this.c=s*l+i*h,this.d=s*u+i*c,this.tx=o*l+a*h+t.tx,this.ty=o*u+a*c+t.ty,this}setTransform(e,t,r,n,s,i,o,a,l){return this.a=Math.cos(o+l)*s,this.b=Math.sin(o+l)*s,this.c=-Math.sin(o-a)*i,this.d=Math.cos(o-a)*i,this.tx=e-(r*this.a+n*this.c),this.ty=t-(r*this.b+n*this.d),this}prepend(e){const t=this.tx;if(1!==e.a||0!==e.b||0!==e.c||1!==e.d){const t=this.a,r=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=r*e.a+this.d*e.c,this.d=r*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,r=this.b,n=this.c,s=this.d,i=e.pivot,o=-Math.atan2(-n,s),a=Math.atan2(r,t),l=Math.abs(o+a);let u=Math.sqrt(t*t+r*r);return l<1e-5||Math.abs(d-l)<1e-5?(e.rotation=a,e.skew.x=e.skew.y=0):Math.abs(Math.PI-l)<1e-5?(e.rotation=a-Math.PI,e.skew.x=e.skew.y=0,u=-u):(e.rotation=0,e.skew.x=o,e.skew.y=a),e.scale.x=u,e.scale.y=Math.sqrt(n*n+s*s),e.position.x=this.tx+(i.x*t+i.y*n),e.position.y=this.ty+(i.x*r+i.y*s),e}invert(){const e=this.a,t=this.b,r=this.c,n=this.d,s=this.tx,i=e*n-t*r;return this.a=n/i,this.b=-t/i,this.c=-r/i,this.d=e/i,this.tx=(r*this.ty-n*s)/i,this.ty=-(e*this.ty-t*s)/i,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new _;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return b.identity()}static get shared(){return x.identity()}}const x=new _,b=new _,y=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],v=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],T=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],S=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],w=[],E=[],A=Math.sign;!function(){for(let e=0;e<16;e++){const t=[];w.push(t);for(let r=0;r<16;r++){const n=A(y[e]*y[r]+T[e]*v[r]),s=A(v[e]*y[r]+S[e]*v[r]),i=A(y[e]*T[r]+T[e]*S[r]),o=A(v[e]*T[r]+S[e]*S[r]);for(let e=0;e<16;e++)if(y[e]===n&&v[e]===s&&T[e]===i&&S[e]===o){t.push(e);break}}}for(let e=0;e<16;e++){const t=new _;t.set(y[e],v[e],T[e],S[e],0,0),E.push(t)}}();const R={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:e=>y[e],uY:e=>v[e],vX:e=>T[e],vY:e=>S[e],inv:e=>8&e?15&e:7&-e,add:(e,t)=>w[e][t],sub:(e,t)=>w[e][R.inv(t)],rotate180:e=>4^e,isVertical:e=>2==(3&e),byDirection:(e,t)=>2*Math.abs(e)<=Math.abs(t)?t>=0?R.S:R.N:2*Math.abs(t)<=Math.abs(e)?e>0?R.E:R.W:t>0?e>0?R.SE:R.SW:e>0?R.NE:R.NW,matrixAppendRotationInv:(e,t,r=0,n=0,s=0,i=0)=>{const o=E[R.inv(t)],a=o.a,l=o.b,u=o.c,h=o.d,c=r-Math.min(0,a*s,u*i,a*s+u*i),d=n-Math.min(0,l*s,h*i,l*s+h*i),p=e.a,f=e.b,m=e.c,g=e.d;e.a=a*p+l*m,e.b=a*f+l*g,e.c=u*p+h*m,e.d=u*f+h*g,e.tx=c*p+d*m+e.tx,e.ty=c*f+d*g+e.ty},transformRectCoords:(e,t,r,n)=>{const{x:s,y:i,width:o,height:a}=e,{x:l,y:u,width:h,height:c}=t;return r===R.E?(n.set(s+l,i+u,o,a),n):r===R.S?n.set(h-i-a+l,s+u,a,o):r===R.W?n.set(h-s-o+l,c-i-a+u,o,a):r===R.N?n.set(i+l,c-s-o+u,a,o):n.set(s+l,i+u,o,a)}},C=[new m,new m,new m,new m];class M{constructor(e=0,t=0,r=0,n=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(r),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new M(0,0,0,0)}clone(){return new M(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return!(this.width<=0||this.height<=0)&&(e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height)}strokeContains(e,t,r,n=.5){const{width:s,height:i}=this;if(s<=0||i<=0)return!1;const o=this.x,a=this.y,l=r*(1-n),u=r-l;return e>=o-l&&e<=o+s+l&&t>=a-l&&t<=a+i+l&&!(e>o+u&&e<o+s-u&&t>a+u&&t<a+i-u)}intersects(e,t){if(!t){const t=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=t)return!1;const r=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>r}const r=this.left,n=this.right,s=this.top,i=this.bottom;if(n<=r||i<=s)return!1;const o=C[0].set(e.left,e.top),a=C[1].set(e.left,e.bottom),l=C[2].set(e.right,e.top),u=C[3].set(e.right,e.bottom);if(l.x<=o.x||a.y<=o.y)return!1;const h=Math.sign(t.a*t.d-t.b*t.c);if(0===h)return!1;if(t.apply(o,o),t.apply(a,a),t.apply(l,l),t.apply(u,u),Math.max(o.x,a.x,l.x,u.x)<=r||Math.min(o.x,a.x,l.x,u.x)>=n||Math.max(o.y,a.y,l.y,u.y)<=s||Math.min(o.y,a.y,l.y,u.y)>=i)return!1;const c=h*(a.y-o.y),d=h*(o.x-a.x),p=c*r+d*s,f=c*n+d*s,m=c*r+d*i,g=c*n+d*i;if(Math.max(p,f,m,g)<=c*o.x+d*o.y||Math.min(p,f,m,g)>=c*u.x+d*u.y)return!1;const _=h*(o.y-l.y),x=h*(l.x-o.x),b=_*r+x*s,y=_*n+x*s,v=_*r+x*i,T=_*n+x*i;return!(Math.max(b,y,v,T)<=_*o.x+x*o.y||Math.min(b,y,v,T)>=_*u.x+x*u.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=2*e,this.height+=2*t,this}fit(e){const t=Math.max(this.x,e.x),r=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),s=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(r-t,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(e=1,t=.001){const r=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=r-this.x,this.height=n-this.y,this}scale(e,t=e){return this.x*=e,this.y*=t,this.width*=e,this.height*=t,this}enlarge(e){const t=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),s=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=r-t,this.y=n,this.height=s-n,this}getBounds(e){return e||(e=new M),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const t=e.x,r=e.y,n=e.x+e.width,s=e.y+e.height;return t>=this.x&&t<this.x+this.width&&r>=this.y&&r<this.y+this.height&&n>=this.x&&n<=this.x+this.width&&s>=this.y&&s<=this.y+this.height}set(e,t,r,n){return this.x=e,this.y=t,this.width=r,this.height=n,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const P={default:-1};function G(e="default"){return void 0===P[e]&&(P[e]=-1),++P[e]}function B(){for(const e in P)delete P[e]}const F=new Set,I="8.0.0",O="8.3.4",D="8.21.0",U="8.22.0",k={quiet:!1,noColor:!1},L=(e,t,r=3)=>{if(k.quiet||F.has(t))return;let n=(new Error).stack;const s=`${t}\nDeprecated since v${e}`,i="function"==typeof console.groupCollapsed&&!k.noColor;void 0===n?console.warn("PixiJS Deprecation Warning: ",s):(n=n.split("\n").splice(r).join("\n"),i?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(n),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(n))),F.add(t)};Object.defineProperties(L,{quiet:{get:()=>k.quiet,set:e=>{k.quiet=e},enumerable:!0,configurable:!1},noColor:{get:()=>k.noColor,set:e=>{k.noColor=e},enumerable:!0,configurable:!1}});const N=()=>{};function X(e){return e.endsWith("int")}function H(e){return e+=0===e?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}function z(e){return!(e&e-1||!e)}function V(e){let t=(e>65535?1:0)<<4,r=((e>>>=t)>255?1:0)<<3;return t|=r,r=((e>>>=r)>15?1:0)<<2,t|=r,r=((e>>>=r)>3?1:0)<<1,t|=r,t|(e>>>=r)>>1}function W(e){const t={};for(const r in e)void 0!==e[r]&&(t[r]=e[r]);return t}const $=Object.create(null);const Y=class e extends c{constructor(t={}){super(),this._resourceType="textureSampler",this._maxAnisotropy=1,this.destroyed=!1,t={...e.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){L(I,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=function(e){const t=$[e];return void 0===t&&($[e]=G("resource")),t}(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Y.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let j=Y;const q=class e extends c{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=G("textureSource"),this._resourceType="textureSource",this._resourceId=G("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.depth=1,this._ownsStyle=!1,this.antialias=!1,this.transient=!1,this.storage=!1,this._batchTick=-1,this._textureBindLocation=-1;const r=t,n=function(e){return e.viewDimension?e.viewDimension:e.depth?"3d":e.arrayLayerCount>1?"2d-array":"2d"}(t={...e.defaultOptions,...t}),s="3d"===n||"1d"===n?n:"2d";!function(e,t,r){if(void 0!==e.depth&&"number"!=typeof e.depth)throw new Error(`[TextureSource] depth is a 3D texture's depth in texels, but got ${e.depth}. For a depth buffer, use the depth option of a RenderTarget or the renderer.`);if(e.depth&&e.arrayLayerCount>1)throw new Error("[TextureSource] depth and arrayLayerCount can't be combined: use depth for a 3D texture or arrayLayerCount for a 2D array.");if(e.depth&&"3d"!==t)throw new Error(`[TextureSource] depth makes a 3D texture, but viewDimension is '${t}'. Use arrayLayerCount for layered textures.`);if("3d"===t&&e.arrayLayerCount>1)throw new Error("[TextureSource] a 3D texture takes depth, not arrayLayerCount.");if(e.dimensions&&e.dimensions!==r)throw new Error(`[TextureSource] dimensions '${e.dimensions}' doesn't match viewDimension '${t}'. Leave dimensions out; it is derived from the view.`);e.dimensions&&L(U,"TextureSource dimensions is derived from viewDimension and depth; leave it out.");if("3d"===r&&e.antialias)throw new Error("[TextureSource] a 3D texture can't be antialiased: WebGPU has no multisampled 3D textures.")}(r,n,s),this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=s,this.viewDimension=n,this.arrayLayerCount=t.arrayLayerCount,this.depth="3d"===s?t.depth??1:1,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias="3d"!==s&&t.antialias,this.transient=t.transient??!1,this.storage=t.storage??!1,this.alphaMode=t.alphaMode,this.style=new j(W(t)),this._ownsStyle=!0,this.destroyed=!1,this._refreshPOT()}get depthOrArrayLayers(){return"3d"===this.dimension?this.depth:this.arrayLayerCount||1}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._ownsStyle=!1,this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._ownsStyle&&this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=G("resource"),this.emit("change",this),this.emit("unload",this);for(const e in this._gpuData)this._gpuData[e]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){const{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){const{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,t,r){r||(r=this._resolution),e||(e=this.width),t||(t=this.height);const n=Math.round(e*r),s=Math.round(t*r);return this.width=n/r,this.height=s/r,this._resolution=r,(this.pixelWidth!==n||this.pixelHeight!==s)&&(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=G("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=z(this.pixelWidth)&&z(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};q.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let K=q;class Z extends K{constructor(e){const t=e.depth??e.arrayLayerCount??1,r=e.resource||new Float32Array(e.width*e.height*t*4);let n=e.format;n||(n=r instanceof Float32Array?"rgba32float":r instanceof Int32Array||r instanceof Uint32Array?"rgba32uint":r instanceof Int16Array||r instanceof Uint16Array?"rgba16uint":(Int8Array,"bgra8unorm"));super({...(X(n)||t>1)&&{alphaMode:"no-premultiply-alpha"},...e,resource:r,format:n}),this.uploadMethodId="buffer",this._updateStart=0,this._updateEnd=1/0}update(e=0,t=1/0){if((e>0||t<1/0)&&this.depthOrArrayLayers>1)throw new Error("[BufferImageSource] a 3D texture or 2D array uploads whole: call update() with no range.");this._updateStart=e,this._updateEnd=t,super.update(),this._updateStart=0,this._updateEnd=1/0}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}Z.extension=e.TextureSource;const Q=new _;class J{constructor(e,t){this.mapCoord=new _,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===t?e.width<10?0:.5:t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this)),this.update()}destroy(){this._texture?.removeListener("update",this.update,this),this._texture=null}multiplyUvs(e,t){void 0===t&&(t=e);const r=this.mapCoord;for(let n=0;n<e.length;n+=2){const s=e[n],i=e[n+1];t[n]=s*r.a+i*r.c+r.tx,t[n+1]=s*r.b+i*r.d+r.ty}return t}update(){const e=this._texture;this._updateID++;const t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);const r=e.orig,n=e.trim;n&&(Q.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Q));const s=e.source,i=this.uClampFrame,o=this.clampMargin/s._resolution,a=this.clampOffset/s._resolution;return i[0]=(e.frame.x+o+a)/s.width,i[1]=(e.frame.y+o+a)/s.height,i[2]=(e.frame.x+e.frame.width-o+a)/s.width,i[3]=(e.frame.y+e.frame.height-o+a)/s.height,this.uClampOffset[0]=this.clampOffset/s.pixelWidth,this.uClampOffset[1]=this.clampOffset/s.pixelHeight,this.isSimple=e.frame.width===s.width&&e.frame.height===s.height&&0===e.rotate,!0}}class ee extends c{constructor({source:e,label:t,frame:r,orig:n,trim:s,defaultAnchor:i,defaultBorders:o,rotate:a,dynamic:l}={}){if(super(),this.uid=G("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new M,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new K,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:e,height:t}=this._source;this.frame.width=e,this.frame.height=t}this.orig=n||this.frame,this.trim=s,this.rotate=a??0,this.defaultAnchor=i,this.defaultBorders=o,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new J(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:e,frame:t}=this,{width:r,height:n}=this._source,s=t.x/r,i=t.y/n,o=t.width/r,a=t.height/n;let l=this.rotate;if(l){const t=o/2,r=a/2,n=s+t,u=i+r;l=R.add(l,R.NW),e.x0=n+t*R.uX(l),e.y0=u+r*R.uY(l),l=R.add(l,2),e.x1=n+t*R.uX(l),e.y1=u+r*R.uY(l),l=R.add(l,2),e.x2=n+t*R.uX(l),e.y2=u+r*R.uY(l),l=R.add(l,2),e.x3=n+t*R.uX(l),e.y3=u+r*R.uY(l)}else e.x0=s,e.y0=i,e.x1=s+o,e.y1=i,e.x2=s+o,e.y2=i+a,e.x3=s,e.y3=i+a}destroy(e=!1){this._source&&(this._source.off("resize",this.update,this),e&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return L(I,"Texture.baseTexture is now Texture.source"),this._source}}function te(e,t,r){const{width:n,height:s}=r.orig,i=r.trim;if(i){const r=i.width,o=i.height;e.minX=i.x-t._x*n,e.maxX=e.minX+r,e.minY=i.y-t._y*s,e.maxY=e.minY+o}else e.minX=-t._x*n,e.maxX=e.minX+n,e.minY=-t._y*s,e.maxY=e.minY+s}ee.EMPTY=new ee({label:"EMPTY",source:new K({label:"EMPTY"})}),ee.EMPTY.destroy=N,ee.WHITE=new ee({source:new Z({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),ee.WHITE.destroy=N;const re=new _;class ne{constructor(e=1/0,t=1/0,r=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=re,this.minX=e,this.minY=t,this.maxX=r,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new M);const e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=re,this}set(e,t,r,n){this.minX=e,this.minY=t,this.maxX=r,this.maxY=n}addFrame(e,t,r,n,s){s||(s=this.matrix);const i=s.a,o=s.b,a=s.c,l=s.d,u=s.tx,h=s.ty;let c=this.minX,d=this.minY,p=this.maxX,f=this.maxY,m=i*e+a*t+u,g=o*e+l*t+h;m<c&&(c=m),g<d&&(d=g),m>p&&(p=m),g>f&&(f=g),m=i*r+a*t+u,g=o*r+l*t+h,m<c&&(c=m),g<d&&(d=g),m>p&&(p=m),g>f&&(f=g),m=i*e+a*n+u,g=o*e+l*n+h,m<c&&(c=m),g<d&&(d=g),m>p&&(p=m),g>f&&(f=g),m=i*r+a*n+u,g=o*r+l*n+h,m<c&&(c=m),g<d&&(d=g),m>p&&(p=m),g>f&&(f=g),this.minX=c,this.minY=d,this.maxX=p,this.maxY=f}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){const t=this.minX,r=this.minY,n=this.maxX,s=this.maxY,{a:i,b:o,c:a,d:l,tx:u,ty:h}=e;let c=i*t+a*r+u,d=o*t+l*r+h;this.minX=c,this.minY=d,this.maxX=c,this.maxY=d,c=i*n+a*r+u,d=o*n+l*r+h,this.minX=c<this.minX?c:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=c>this.maxX?c:this.maxX,this.maxY=d>this.maxY?d:this.maxY,c=i*t+a*s+u,d=o*t+l*s+h,this.minX=c<this.minX?c:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=c>this.maxX?c:this.maxX,this.maxY=d>this.maxY?d:this.maxY,c=i*n+a*s+u,d=o*n+l*s+h,this.minX=c<this.minX?c:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=c>this.maxX?c:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,r,n){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<r&&(this.minY=r),this.maxY>n&&(this.maxY=n),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new ne(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){const t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){const t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,t,r,n){let s=this.minX,i=this.minY,o=this.maxX,a=this.maxY;n||(n=this.matrix);const l=n.a,u=n.b,h=n.c,c=n.d,d=n.tx,p=n.ty;for(let n=t;n<r;n+=2){const t=e[n],r=e[n+1],f=l*t+h*r+d,m=u*t+c*r+p;s=f<s?f:s,i=m<i?m:i,o=f>o?f:o,a=m>a?m:a}this.minX=s,this.minY=i,this.maxX=o,this.maxY=a}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}var se={grad:.9,turn:360,rad:360/(2*Math.PI)},ie=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},oe=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r+0},ae=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e>t?e:t},le=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},ue=function(e){return{r:ae(e.r,0,255),g:ae(e.g,0,255),b:ae(e.b,0,255),a:ae(e.a)}},he=function(e){return{r:oe(e.r),g:oe(e.g),b:oe(e.b),a:oe(e.a,3)}},ce=/^#([0-9a-f]{3,8})$/i,de=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},pe=function(e){var t=e.r,r=e.g,n=e.b,s=e.a,i=Math.max(t,r,n),o=i-Math.min(t,r,n),a=o?i===t?(r-n)/o:i===r?2+(n-t)/o:4+(t-r)/o:0;return{h:60*(a<0?a+6:a),s:i?o/i*100:0,v:i/255*100,a:s}},fe=function(e){var t=e.h,r=e.s,n=e.v,s=e.a;t=t/360*6,r/=100,n/=100;var i=Math.floor(t),o=n*(1-r),a=n*(1-(t-i)*r),l=n*(1-(1-t+i)*r),u=i%6;return{r:255*[n,a,o,o,l,n][u],g:255*[l,n,n,a,o,o][u],b:255*[o,o,l,n,n,a][u],a:s}},me=function(e){return{h:le(e.h),s:ae(e.s,0,100),l:ae(e.l,0,100),a:ae(e.a)}},ge=function(e){return{h:oe(e.h),s:oe(e.s),l:oe(e.l),a:oe(e.a,3)}},_e=function(e){return fe((r=(t=e).s,{h:t.h,s:(r*=((n=t.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:t.a}));var t,r,n},xe=function(e){return{h:(t=pe(e)).h,s:(s=(200-(r=t.s))*(n=t.v)/100)>0&&s<200?r*n/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,r,n,s},be=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ye=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ve=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Te=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Se={string:[[function(e){var t=ce.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?oe(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?oe(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=ve.exec(e)||Te.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:ue({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=be.exec(e)||ye.exec(e);if(!t)return null;var r,n,s=me({h:(r=t[1],n=t[2],void 0===n&&(n="deg"),Number(r)*(se[n]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return _e(s)},"hsl"]],object:[[function(e){var t=e.r,r=e.g,n=e.b,s=e.a,i=void 0===s?1:s;return ie(t)&&ie(r)&&ie(n)?ue({r:Number(t),g:Number(r),b:Number(n),a:Number(i)}):null},"rgb"],[function(e){var t=e.h,r=e.s,n=e.l,s=e.a,i=void 0===s?1:s;if(!ie(t)||!ie(r)||!ie(n))return null;var o=me({h:Number(t),s:Number(r),l:Number(n),a:Number(i)});return _e(o)},"hsl"],[function(e){var t=e.h,r=e.s,n=e.v,s=e.a,i=void 0===s?1:s;if(!ie(t)||!ie(r)||!ie(n))return null;var o=function(e){return{h:le(e.h),s:ae(e.s,0,100),v:ae(e.v,0,100),a:ae(e.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(i)});return fe(o)},"hsv"]]},we=function(e,t){for(var r=0;r<t.length;r++){var n=t[r][0](e);if(n)return[n,t[r][1]]}return[null,void 0]},Ee=function(e,t){var r=xe(e);return{h:r.h,s:ae(r.s+100*t,0,100),l:r.l,a:r.a}},Ae=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Re=function(e,t){var r=xe(e);return{h:r.h,s:r.s,l:ae(r.l+100*t,0,100),a:r.a}},Ce=function(){function e(e){this.parsed=function(e){return"string"==typeof e?we(e.trim(),Se.string):"object"==typeof e&&null!==e?we(e,Se.object):[null,void 0]}(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return oe(Ae(this.rgba),2)},e.prototype.isDark=function(){return Ae(this.rgba)<.5},e.prototype.isLight=function(){return Ae(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=he(this.rgba)).r,r=e.g,n=e.b,i=(s=e.a)<1?de(oe(255*s)):"","#"+de(t)+de(r)+de(n)+i;var e,t,r,n,s,i},e.prototype.toRgb=function(){return he(this.rgba)},e.prototype.toRgbString=function(){return t=(e=he(this.rgba)).r,r=e.g,n=e.b,(s=e.a)<1?"rgba("+t+", "+r+", "+n+", "+s+")":"rgb("+t+", "+r+", "+n+")";var e,t,r,n,s},e.prototype.toHsl=function(){return ge(xe(this.rgba))},e.prototype.toHslString=function(){return t=(e=ge(xe(this.rgba))).h,r=e.s,n=e.l,(s=e.a)<1?"hsla("+t+", "+r+"%, "+n+"%, "+s+")":"hsl("+t+", "+r+"%, "+n+"%)";var e,t,r,n,s},e.prototype.toHsv=function(){return e=pe(this.rgba),{h:oe(e.h),s:oe(e.s),v:oe(e.v),a:oe(e.a,3)};var e},e.prototype.invert=function(){return Me({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Me(Ee(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Me(Ee(this.rgba,-e))},e.prototype.grayscale=function(){return Me(Ee(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Me(Re(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Me(Re(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Me({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):oe(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=xe(this.rgba);return"number"==typeof e?Me({h:e,s:t.s,l:t.l,a:t.a}):oe(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Me(e).toHex()},e}(),Me=function(e){return e instanceof Ce?e:new Ce(e)},Pe=[];!function(e){e.forEach(function(e){Pe.indexOf(e)<0&&(e(Ce,Se),Pe.push(e))})}([function(e,t){var r={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},n={};for(var s in r)n[r[s]]=s;var i={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var s,o,a=n[this.toHex()];if(a)return a;if(null==t?void 0:t.closest){var l=this.toRgb(),u=1/0,h="black";if(!i.length)for(var c in r)i[c]=new e(r[c]).toRgb();for(var d in r){var p=(s=l,o=i[d],Math.pow(s.r-o.r,2)+Math.pow(s.g-o.g,2)+Math.pow(s.b-o.b,2));p<u&&(u=p,h=d)}return h}},t.string.push([function(t){var n=t.toLowerCase(),s="transparent"===n?"#0000":r[n];return s?new e(s).toRgb():null},"name"])}]);const Ge=class e{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(t){if(t instanceof e)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(null===t)throw new Error("Cannot set Color#value to null");null!==this._value&&this._isSourceEqual(this._value,t)||(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return"string"==typeof e||"number"==typeof e||e instanceof Number||null===e?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):"object"==typeof e&&null!==e?{...e}:e}_isSourceEqual(e,t){const r=typeof e;if(r!==typeof t)return!1;if("number"===r||"string"===r||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length===t.length&&e.every((e,r)=>e===t[r]);if(null!==e&&null!==t){const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(r=>e[r]===t[r])}return e===t}toRgba(){const[e,t,r,n]=this._components;return{r:e,g:t,b:r,a:n}}toRgb(){const[e,t,r]=this._components;return{r:e,g:t,b:r}}toRgbaString(){const[e,t,r]=this.toUint8RgbArray();return`rgba(${e},${t},${r},${this.alpha})`}toUint8RgbArray(e){const[t,r,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(255*t),e[1]=Math.round(255*r),e[2]=Math.round(255*n),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[t,r,n,s]=this._components;return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[t,r,n]=this._components;return e[0]=t,e[1]=r,e[2]=n,e}toNumber(){return this._int}toBgrNumber(){const[e,t,r]=this.toUint8RgbArray();return(r<<16)+(t<<8)+e}toLittleEndianNumber(){const e=this._int;return(e>>16)+(65280&e)+((255&e)<<16)}multiply(t){const[r,n,s,i]=e._temp.setValue(t)._components;return this._components[0]*=r,this._components[1]*=n,this._components[2]*=s,this._components[3]*=i,this._refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(1===e)return(255<<24)+this._int;if(0===e)return t?0:this._int;let r=this._int>>16&255,n=this._int>>8&255,s=255&this._int;return t&&(r=r*e+.5|0,n=n*e+.5|0,s=s*e+.5|0),(255*e<<24)+(r<<16)+(n<<8)+s}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const e=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this._value=null,this}_normalize(t){let r,n,s,i;if(("number"==typeof t||t instanceof Number)&&t>=0&&t<=16777215){r=(t>>16&255)/255,n=(t>>8&255)/255,s=(255&t)/255,i=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[r,n,s,i=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[r,n,s,i=255]=t,r/=255,n/=255,s/=255,i/=255;else if("string"==typeof t||"object"==typeof t){if("string"==typeof t){const r=e.HEX_PATTERN.exec(t);r&&(t=`#${r[2]}`)}const o=Me(t);o.isValid()&&(({r:r,g:n,b:s,a:i}=o.rgba),r/=255,n/=255,s/=255)}if(void 0===r)throw new Error(`Unable to convert color ${t}`);this._components[0]=r,this._components[1]=n,this._components[2]=s,this._components[3]=i,this._refreshInt()}_refreshInt(){this._clamp(this._components);const[e,t,r]=this._components;this._int=(255*e<<16)+(255*t<<8)+(255*r|0)}_clamp(e,t=0,r=1){return"number"==typeof e?Math.min(Math.max(e,t),r):(e.forEach((n,s)=>{e[s]=Math.min(Math.max(n,t),r)}),e)}static isColorLike(t){return"number"==typeof t||"string"==typeof t||t instanceof Number||t instanceof e||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||void 0!==t.r&&void 0!==t.g&&void 0!==t.b||void 0!==t.r&&void 0!==t.g&&void 0!==t.b&&void 0!==t.a||void 0!==t.h&&void 0!==t.s&&void 0!==t.l||void 0!==t.h&&void 0!==t.s&&void 0!==t.l&&void 0!==t.a||void 0!==t.h&&void 0!==t.s&&void 0!==t.v||void 0!==t.h&&void 0!==t.s&&void 0!==t.v&&void 0!==t.a}};Ge.shared=new Ge,Ge._temp=new Ge,Ge.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Be=Ge;const Fe={cullArea:null,cullable:!1,cullableChildren:!0};let Ie=0;function Oe(...e){500!==Ie&&(Ie++,500===Ie?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...e))}const De={_registeredResources:new Set,register(e){this._registeredResources.add(e)},unregister(e){this._registeredResources.delete(e)},release(){this._registeredResources.forEach(e=>e.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(e){return this._registeredResources.has(e)},reset(){this._registeredResources.clear()}};class Ue{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?t=this._pool[--this._index]:(t=new this._classType,this._count++),t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}}class ke{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new Ue(e)),this._poolsByClass.get(e)}stats(){const e={};return this._poolsByClass.forEach(t=>{const r=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[r]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}}const Le=new ke;De.register(Le);const Ne={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(e){"boolean"==typeof e&&!1===e?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(!0===e?{}:e))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(e){L("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(e)}};function Xe(e,t,r){const n=e.length;let s;if(t>=n||0===r)return;const i=n-(r=t+r>n?n-t:r);for(s=t;s<i;++s)e[s]=e[s+r];e.length=i}const He={allowChildren:!0,removeChildren(e=0,t){const r=t??this.children.length,n=r-e,s=[];if(n>0&&n<=r){for(let t=r-1;t>=e;t--){const e=this.children[t];e&&(s.push(e),e.parent=null)}Xe(this.children,e,r);const t=this.renderGroup||this.parentRenderGroup;t&&t.removeChildren(s);for(let e=0;e<s.length;++e){const t=s[e];t.parentRenderLayer?.detach(t),this.emit("childRemoved",t,this,e),s[e].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}if(0===n&&0===this.children.length)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(e){const t=this.getChildAt(e);return this.removeChild(t)},getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]},setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(e),this.addChildAt(e,t)},getChildIndex(e){const t=this.children.indexOf(e);if(-1===t)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(e,t){this.allowChildren||L(I,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:r}=this;if(t<0||t>r.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${r.length}`);const n=e.parent===this;if(e.parent){const r=e.parent.children.indexOf(e);if(n){if(r===t)return e;e.parent.children.splice(r,1)}else e.removeFromParent()}t===r.length?r.push(e):r.splice(t,0,e);const s=this.renderGroup||this.parentRenderGroup;return this.sortableChildren&&(this.sortDirty=!0),n?(s&&(s.structureDidChange=!0),e):(e.parent=this,e.didChange=!0,e._updateFlags=15,s&&s.addChild(e),this.emit("childAdded",e,this,t),e.emit("added",this),e)},swapChildren(e,t){if(e===t)return;const r=this.getChildIndex(e),n=this.getChildIndex(t);this.children[r]=t,this.children[n]=e;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...e){return 1===e.length?this.reparentChildAt(e[0],this.children.length):(e.forEach(e=>this.reparentChildAt(e,this.children.length)),e[0])},reparentChildAt(e,t){if(e.parent===this)return this.setChildIndex(e,t),e;const r=e.worldTransform.clone();e.removeFromParent(),this.addChildAt(e,t);const n=this.worldTransform.clone();return n.invert(),r.prepend(n),e.setFromMatrix(r),e},replaceChild(e,t){e.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(e)),t.setFromMatrix(e.localTransform),t.updateLocalTransform(),this.removeChild(e)}},ze={collectRenderables(e,t,r){this.parentRenderLayer&&this.parentRenderLayer!==r||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(e,t,r):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,e):this.collectRenderablesWithEffects(e,t,r))},collectRenderablesSimple(e,t,r){const n=this.children,s=n.length;for(let i=0;i<s;i++)n[i].collectRenderables(e,t,r)},collectRenderablesWithEffects(e,t,r){const{renderPipes:n}=t;for(let t=0;t<this.effects.length;t++){const r=this.effects[t];n[r.pipe].push(r,this,e)}this.collectRenderablesSimple(e,t,r);for(let t=this.effects.length-1;t>=0;t--){const r=this.effects[t];n[r.pipe].pop(r,this,e)}}};class Ve{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}class We{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t<this._tests.length;t++){const r=this._tests[t];if(r.test(e))return Le.get(r.maskClass,e)}return e}returnMaskEffect(e){Le.return(e)}}const $e=new We;n.handleByList(e.MaskEffect,$e._effectClasses);const Ye={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0)},addEffect(e){-1===this.effects.indexOf(e)&&(this.effects.push(e),this.effects.sort((e,t)=>e.priority-t.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(e){const t=this.effects.indexOf(e);-1!==t&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(e){const t=this._maskEffect;t?.mask!==e&&(t&&(this.removeEffect(t),$e.returnMaskEffect(t),this._maskEffect=null),null!=e&&(this._maskEffect=$e.getMaskEffect(e),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(e){this._maskOptions={...this._maskOptions,...e},e.mask&&(this.mask=e.mask),this._markStructureAsChanged()},set filters(e){!Array.isArray(e)&&e&&(e=[e]);const t=this._filterEffect||(this._filterEffect=new Ve),r=e?.length>0,n=r!==t.filters?.length>0;e=Array.isArray(e)?e.slice(0):e,t.filters=Object.freeze(e),n&&(r?this.addEffect(t):(this.removeEffect(t),t.filters=e??null))},get filters(){return this._filterEffect?.filters},set filterArea(e){this._filterEffect||(this._filterEffect=new Ve),this._filterEffect.filterArea=e},get filterArea(){return this._filterEffect?.filterArea}},je={label:null,get name(){return L(I,"Container.name property has been removed, use Container.label instead"),this.label},set name(e){L(I,"Container.name property has been removed, use Container.label instead"),this.label=e},getChildByName(e,t=!1){return this.getChildByLabel(e,t)},getChildByLabel(e,t=!1){const r=this.children;for(let t=0;t<r.length;t++){const n=r[t];if(n.label===e||e instanceof RegExp&&e.test(n.label))return n}if(t)for(let t=0;t<r.length;t++){const n=r[t].getChildByLabel(e,!0);if(n)return n}return null},getChildrenByLabel(e,t=!1,r=[]){const n=this.children;for(let t=0;t<n.length;t++){const s=n[t];(s.label===e||e instanceof RegExp&&e.test(s.label))&&r.push(s)}if(t)for(let t=0;t<n.length;t++)n[t].getChildrenByLabel(e,!0,r);return r}},qe=Le.getPool(_),Ke=Le.getPool(ne),Ze=new _,Qe={getFastGlobalBounds(e,t){t||(t=new ne),t.clear(),this._getGlobalBoundsRecursive(!!e,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const r=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(r.worldTransform),t},_getGlobalBoundsRecursive(e,t,r){let n=t;if(e&&this.parentRenderLayer&&this.parentRenderLayer!==r)return;if(7!==this.localDisplayStatus||!this.measurable)return;const s=!!this.effects.length;if((this.renderGroup||s)&&(n=Ke.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const e=this.bounds;n.addFrame(e.minX,e.minY,e.maxX,e.maxY,this.groupTransform)}const t=this.children;for(let s=0;s<t.length;s++)t[s]._getGlobalBoundsRecursive(e,n,r)}if(s){let e=!1;const r=this.renderGroup||this.parentRenderGroup;for(let t=0;t<this.effects.length;t++)this.effects[t].addBounds&&(e||(e=!0,n.applyMatrix(r.worldTransform)),this.effects[t].addBounds(n,!0));e&&n.applyMatrix(r.worldTransform.copyTo(Ze).invert()),t.addBounds(n),Ke.return(n)}else this.renderGroup&&(t.addBounds(n,this.relativeGroupTransform),Ke.return(n))}};function Je(e,t,r){let n,s;return r.clear(),e.parent?t?n=e.parent.worldTransform:(s=qe.get().identity(),n=tt(e,s)):n=_.IDENTITY,et(e,r,n,t),s&&qe.return(s),r.isValid||r.set(0,0,0,0),r}function et(e,t,r,n){if(!e.visible||!e.measurable)return;let s;n?s=e.worldTransform:(e.updateLocalTransform(),s=qe.get(),s.appendFrom(e.localTransform,r));const i=t,o=!!e.effects.length;if(o&&(t=Ke.get().clear()),e.boundsArea)t.addRect(e.boundsArea,s);else{const r=e.bounds;r&&!r.isEmpty()&&(t.matrix=s,t.addBounds(r));for(let r=0;r<e.children.length;r++)et(e.children[r],t,s,n)}if(o){for(let r=0;r<e.effects.length;r++)e.effects[r].addBounds?.(t);i.addBounds(t,_.IDENTITY),Ke.return(t)}n||qe.return(s)}function tt(e,t){const r=e.parent;return r&&(tt(r,t),r.updateLocalTransform(),t.append(r.localTransform)),t}function rt(e,t){if(16777215===e||!t)return t;if(16777215===t||!e)return e;return(((e>>16&255)*(t>>16&255)/255|0)<<16)+(((e>>8&255)*(t>>8&255)/255|0)<<8)+((255&e)*(255&t)/255|0)}const nt=16777215;function st(e,t){return e===nt?t:t===nt?e:rt(e,t)}function it(e){return((255&e)<<16)+(65280&e)+(e>>16&255)}const ot={getGlobalAlpha(e){if(e)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,r=this.parent;for(;r;)t*=r.alpha,r=r.parent;return t},getGlobalTransform(e=new _,t){if(t)return e.copyFrom(this.worldTransform);this.updateLocalTransform();const r=tt(this,qe.get().identity());return e.appendFrom(this.localTransform,r),qe.return(r),e},getGlobalTint(e){if(e)return this.renderGroup?it(this.renderGroup.worldColor):this.parentRenderGroup?it(st(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,r=this.parent;for(;r;)t=st(t,r.localColor),r=r.parent;return it(t)}};function at(e,t,r){return t.clear(),r||(r=_.IDENTITY),lt(e,t,r,e,!0),t.isValid||t.set(0,0,0,0),t}function lt(e,t,r,n,s){let i;if(s)i=qe.get(),i=r.copyTo(i);else{if(!e.visible||!e.measurable)return;e.updateLocalTransform();const t=e.localTransform;i=qe.get(),i.appendFrom(t,r)}const o=t,a=!!e.effects.length;if(a&&(t=Ke.get().clear()),e.boundsArea)t.addRect(e.boundsArea,i);else{e.renderPipeId&&(t.matrix=i,t.addBounds(e.bounds));const r=e.children;for(let e=0;e<r.length;e++)lt(r[e],t,i,n,!1)}if(a){for(let r=0;r<e.effects.length;r++)e.effects[r].addLocalBounds?.(t,n);o.addBounds(t,_.IDENTITY),Ke.return(t)}qe.return(i)}function ut(e,t){const r=e.children;for(let e=0;e<r.length;e++){const n=r[e],s=n.uid,i=(65535&n._didViewChangeTick)<<16|65535&n._didContainerChangeTick,o=t.index;t.data[o]===s&&t.data[o+1]===i||(t.data[t.index]=s,t.data[t.index+1]=i,t.didChange=!0),t.index=o+2,n.children.length&&ut(n,t)}return t.didChange}const ht=new _,ct={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(e,t){const r=Math.sign(this.scale.x)||1;this.scale.x=0!==t?e/t*r:r},_setHeight(e,t){const r=Math.sign(this.scale.y)||1;this.scale.y=0!==t?e/t*r:r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new ne});const e=this._localBoundsCacheData;return e.index=1,e.didChange=!1,e.data[0]!==this._didViewChangeTick&&(e.didChange=!0,e.data[0]=this._didViewChangeTick),ut(this,e),e.didChange&&at(this,e.localBounds,ht),e.localBounds},getBounds(e,t){return Je(this,e,t||new ne)}},dt={_onRender:null,set onRender(e){const t=this.renderGroup||this.parentRenderGroup;if(!e)return this._onRender&&t?.removeOnRender(this),void(this._onRender=null);this._onRender||t?.addOnRender(this),this._onRender=e},get onRender(){return this._onRender}},pt={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(ft))}};function ft(e,t){return e._zIndex-t._zIndex}const mt={getGlobalPosition(e=new m,t=!1){return this.parent?this.parent.toGlobal(this._position,e,t):(e.x=this._position.x,e.y=this._position.y),e},toGlobal(e,t,r=!1){const n=this.getGlobalTransform(qe.get(),r);return t=n.apply(e,t),qe.return(n),t},toLocal(e,t,r,n){t&&(e=t.toGlobal(e,r,n));const s=this.getGlobalTransform(qe.get(),n);return r=s.applyInverse(e,r),qe.return(s),r}};class gt{constructor(){this.uid=G("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){if(this.renderPipes)for(const e in this.renderPipes)this.renderPipes[e].destroyInstructionSet?.(this);this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}class _t{constructor(){this._screenSizes=new Map,this._widths=[],this._heights=[]}get size(){return this._screenSizes.size}set(e,t,r){const n=this._screenSizes.get(e);return(!n||n.pixelWidth!==t||n.pixelHeight!==r)&&(this._screenSizes.set(e,{pixelWidth:t,pixelHeight:r}),this._update(),!0)}remove(e){return!!this._screenSizes.delete(e)&&(this._update(),!0)}getFittingWidth(e){return this._getFittingAxis(e,this._widths)}getFittingHeight(e){return this._getFittingAxis(e,this._heights)}hasWidth(e){return this._widths.includes(e)}hasHeight(e){return this._heights.includes(e)}_getFittingAxis(e,t){for(let r=0;r<t.length;r++){const n=t[r];if(n>=e)return n}}_update(){this._widths=[...this._screenSizes.values()].map(e=>e.pixelWidth).filter((e,t,r)=>r.indexOf(e)===t).sort((e,t)=>e-t),this._heights=[...this._screenSizes.values()].map(e=>e.pixelHeight).filter((e,t,r)=>r.indexOf(e)===t).sort((e,t)=>e-t)}}let xt=0;const bt=32767,yt=Object.create(null);let vt=0;function Tt(e,t,r,n,s,i){return(e<<17)+(t<<2)+((n?1:0)<<1)+(r?1:0)+4294967296*("nearest"===i?1:0)+8589934592*function(e){const t=yt[e];return void 0!==t?t:yt[e]=vt++}(s)}class St{constructor(e){this._buckets=new Map,this._poolKey=Object.create(null),this._poolStyle=Object.create(null),this._screens=new _t,this._enableFullScreen=!1,this.textureOptions=e||{}}get textureStyle(){return L(D,"TexturePool.textureStyle is no longer used, pooled textures carry their own style. Pass scaleMode in the request instead."),this._textureStyle||(this._textureStyle=new j(this.textureOptions)),this._textureStyle}set textureStyle(e){L(D,"TexturePool.textureStyle is no longer used, pooled textures carry their own style. Pass scaleMode in the request instead."),this._textureStyle=e}get enableFullScreen(){return L(D,"TexturePool.enableFullScreen is no longer used, the pool sizes textures to the screens registered with setScreenSize."),this._enableFullScreen}set enableFullScreen(e){L(D,"TexturePool.enableFullScreen is no longer used, the pool sizes textures to the screens registered with setScreenSize."),this._enableFullScreen=e}createTexture(...e){let t=e[0];"number"==typeof t&&(L(D,"TexturePool.createTexture params are now an options object. See params: { width, height, antialias, autoGenerateMipmaps }"),t={width:t,height:e[1],antialias:e[2]??!1,autoGenerateMipmaps:e[3]??!1});const r=t.format??this.textureOptions.format??K.defaultOptions.format,n=t.scaleMode??this.textureOptions.scaleMode??j.defaultOptions.scaleMode,s=new K({...this.textureOptions,width:t.width,height:t.height,resolution:1,antialias:t.antialias??!1,autoGarbageCollect:!1,autoGenerateMipmaps:t.autoGenerateMipmaps??!1,format:r,scaleMode:n});return new ee({source:s,label:"texturePool_"+xt++})}getOptimalTexture(...e){let t=e[0];"number"==typeof t&&(L(D,"TexturePool.getOptimalTexture params are now an options object. See params: { width, height, resolution, antialias, autoGenerateMipmaps }"),t={width:t,height:e[1],resolution:e[2]??1,antialias:e[3]??!1,autoGenerateMipmaps:e[4]??!1});const r=t.width,n=t.height,s=t.resolution??1,i=t.antialias??!1,o=t.autoGenerateMipmaps??!1,a=t.format??this.textureOptions.format??K.defaultOptions.format,l=t.scaleMode??this.textureOptions.scaleMode??j.defaultOptions.scaleMode,{width:u,height:h}=this.getOptimalSize(r,n,s);(u>bt||h>bt)&&Oe(`TexturePool: ${u}x${h} is larger than the 32767px pool key limit, textures of this size may be pooled together`);const c=Tt(u,h,i,o,a,l);let d=this._buckets.get(c);d||(d=[],this._buckets.set(c,d));let p=d.pop();return p||(p=this.createTexture({width:u,height:h,antialias:i,autoGenerateMipmaps:o,format:a,scaleMode:l}),this._poolStyle[p.uid]=p.source.style),p.source._resolution=s,p.source.width=u/s,p.source.height=h/s,p.source.pixelWidth=u,p.source.pixelHeight=h,p.frame.x=0,p.frame.y=0,p.frame.width=r,p.frame.height=n,p.updateUvs(),this._poolKey[p.uid]=c,p}getOptimalSize(e,t,r=1){const n=Math.ceil(e*r-1e-6),s=Math.ceil(t*r-1e-6),i=H(n),o=this._screens.getFittingWidth(n),a=H(s),l=this._screens.getFittingHeight(s);return{width:void 0!==o?Math.min(o,i):i,height:void 0!==l?Math.min(l,a):a}}getSameSizeTexture(e,t=!1){const r=e.source;return this.getOptimalTexture({width:e.width,height:e.height,resolution:r._resolution,antialias:t})}returnTexture(e,t=!1){const r=e.uid,n=this._poolKey[r];if(void 0===n)return void Oe("TexturePool: returnTexture was passed a texture that did not come from this pool, ignoring it");const s=this._poolStyle[r];t&&e.source.style!==s&&(e.source.style=s);const i=this._buckets.get(n);if(!i)return delete this._poolKey[r],delete this._poolStyle[r],void e.destroy(!0);i.push(e)}setScreenSize(e,t,r){this._screens.set(e,t,r)&&this._pruneScreenTextures()}removeScreen(e){this._screens.remove(e)&&this._pruneScreenTextures()}_pruneScreenTextures(){for(const[e,t]of this._buckets){const r=e>>>0,n=r>>>17,s=r>>>2&32767;(z(n)||this._screens.hasWidth(n))&&(z(s)||this._screens.hasHeight(s))||(this._dropTextures(t,!0),this._buckets.delete(e))}}_dropTextures(e,t){for(let r=0;r<e.length;r++){const n=e[r];delete this._poolKey[n.uid],delete this._poolStyle[n.uid],t&&n.destroy(!0)}}clear(e){for(const t of this._buckets.values())this._dropTextures(t,!1!==e);this._buckets.clear()}}const wt=new St;De.register(wt);class Et{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new _,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new gt,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;const t=e.children;for(let e=0;e<t.length;e++){const r=t[e];r._updateFlags=15,this.addChild(r)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(wt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const e in this.childrenToUpdate){const t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){const t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup)return void this.addRenderGroupChild(e.renderGroup);e._onRender&&this.addOnRender(e);const t=e.children;for(let e=0;e<t.length;e++)this.addChild(t[e])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup)return void this._removeRenderGroupChild(e.renderGroup);const t=e.children;for(let e=0;e<t.length;e++)this.removeChild(t[e])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return 7===this.root.localDisplayStatus&&this.worldAlpha>0}addOnRender(e){-1===this._onRenderContainers.indexOf(e)&&this._onRenderContainers.push(e)}removeOnRender(e){const t=this._onRenderContainers.indexOf(e);-1!==t&&this._onRenderContainers.splice(t,1)}runOnRender(e){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender(e)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet?.destroy(),this.instructionSet=null}getChildren(e=[]){const t=this.root.children;for(let r=0;r<t.length;r++)this._getChildren(t[r],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;const r=e.children;for(let e=0;e<r.length;e++)this._getChildren(r[e],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return 1&this._matrixDirty?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new _),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return 2&this._matrixDirty?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new _),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(4&this._matrixDirty))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new _),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function At(e,t,r={}){for(const n in t)r[n]||void 0===t[n]||(e[n]=t[n])}const Rt=new o(null),Ct=new o(null),Mt=new o(null,1,1),Pt=new o(null),Gt=1,Bt=2,Ft=4,It=8;let Ot=class e extends c{constructor(e={}){super(),this.uid=G("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new _,this.relativeGroupTransform=new _,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new o(this,0,0),this._scale=Mt,this._pivot=Ct,this._origin=Pt,this._skew=Rt,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],At(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(e=>this.addChild(e)),e.parent?.addChild(this)}static mixin(t){L("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),n.mixin(e,t)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=4095&e}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...e){if(this.allowChildren||L(I,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let t=0;t<e.length;t++)this.addChild(e[t]);return e[0]}const t=e[0],r=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),r&&(r.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,r&&r.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,0!==t._zIndex&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let t=0;t<e.length;t++)this.removeChild(e[t]);return e[0]}const t=e[0],r=this.children.indexOf(t);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,r),t.emit("removed",this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,this.didChange||(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=Le.get(Et,this),this.groupTransform=_.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e?.removeChild(this),Le.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&0===this.effects.length}get worldTransform(){return this._worldTransform||(this._worldTransform=new _),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*p}set angle(e){this.rotation=e*f}get pivot(){return this._pivot===Ct&&(this._pivot=new o(this,0,0)),this._pivot}set pivot(e){this._pivot===Ct&&(this._pivot=new o(this,0,0),this._origin!==Pt&&Oe("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof e?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===Rt&&(this._skew=new o(this,0,0)),this._skew}set skew(e){this._skew===Rt&&(this._skew=new o(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===Mt&&(this._scale=new o(this,1,1)),this._scale}set scale(e){this._scale===Mt&&(this._scale=new o(this,0,0)),"string"==typeof e&&(e=parseFloat(e)),"number"==typeof e?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===Pt&&(this._origin=new o(this,0,0)),this._origin}set origin(e){this._origin===Pt&&(this._origin=new o(this,0,0),this._pivot!==Ct&&Oe("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof e?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){const t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){const t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});const t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){const r=this.getLocalBounds();"object"==typeof e?(t=e.height??e.width,e=e.width):t??(t=e),void 0!==e&&this._setWidth(e,r.width),void 0!==t&&this._setHeight(t,r.height)}_updateSkew(){const e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set("number"==typeof e.x?e.x:this.position.x,"number"==typeof e.y?e.y:this.position.y),this.scale.set("number"==typeof e.scaleX?e.scaleX:this.scale.x,"number"==typeof e.scaleY?e.scaleY:this.scale.y),this.rotation="number"==typeof e.rotation?e.rotation:this.rotation,this.skew.set("number"==typeof e.skewX?e.skewX:this.skew.x,"number"==typeof e.skewY?e.skewY:this.skew.y),this.pivot.set("number"==typeof e.pivotX?e.pivotX:this.pivot.x,"number"==typeof e.pivotY?e.pivotY:this.pivot.y),this.origin.set("number"==typeof e.originX?e.originX:this.origin.x,"number"==typeof e.originY?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){const e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;const t=this.localTransform,r=this._scale,n=this._pivot,s=this._origin,i=this._position,o=r._x,a=r._y,l=n._x,u=n._y,h=-s._x,c=-s._y;t.a=this._cx*o,t.b=this._sx*o,t.c=this._cy*a,t.d=this._sy*a,t.tx=i._x-(l*t.a+u*t.c)+(h*t.a+c*t.c)-h,t.ty=i._y-(l*t.b+u*t.d)+(h*t.b+c*t.d)-c}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=1,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const t=Be.shared.setValue(e??16777215).toBgrNumber();t!==this.localColor&&(this.localColor=t,this._updateFlags|=1,this._onUpdate())}get tint(){return it(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=2,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(2&this.localDisplayStatus)}set visible(e){const t=e?2:0;(2&this.localDisplayStatus)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=4,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",e))}get culled(){return!(4&this.localDisplayStatus)}set culled(e){const t=e?0:4;(4&this.localDisplayStatus)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=4,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(1&this.localDisplayStatus)}set renderable(e){const t=e?1:0;(1&this.localDisplayStatus)!==t&&(this._updateFlags|=4,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return 7===this.localDisplayStatus&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;let t;this.destroyed=!0,this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners();if(("boolean"==typeof e?e:e?.children)&&t)for(let r=0;r<t.length;++r)t[r].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}};n.mixin(Ot,He,Qe,mt,dt,ct,Ye,je,pt,Fe,Ne,ot,ze);class Dt extends Ot{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new ne(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=e.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){const t=this.bounds,{x:r,y:n}=e;return r>=t.minX&&r<=t.maxX&&n>=t.minY&&n<=t.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(const e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(e){this.unload(),super.destroy(e),this._bounds=null}collectRenderablesSimple(e,t,r){const{renderPipes:n}=t;n.blendMode.pushBlendMode(this,this.groupBlendMode,e);const s=n[this.renderPipeId];s?.addRenderable&&s.addRenderable(this,e),this.didViewUpdate=!1;const i=this.children,o=i.length;for(let n=0;n<o;n++)i[n].collectRenderables(e,t,r);n.blendMode.popBlendMode(e)}}let Ut=class e extends Dt{constructor(e=ee.EMPTY){e instanceof ee&&(e={texture:e});const{texture:t=ee.EMPTY,anchor:r,roundPixels:n,width:s,height:i,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new o({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:t.defaultAnchor&&(this.anchor=t.defaultAnchor),this.texture=t,this.allowChildren=!1,this.roundPixels=n??!1,void 0!==s&&(this.width=s),void 0!==i&&(this.height=i)}static from(t,r=!1){return new e(t instanceof ee?t:ee.from(t,r))}set texture(e){e||(e=ee.EMPTY);const t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return te(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return L("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,t=this._texture,r=this._bounds,{width:n,height:s}=t.orig;r.minX=-e._x*n,r.maxX=r.minX+n,r.minY=-e._y*s,r.maxY=r.minY+s}destroy(e=!1){super.destroy(e);if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource;this._texture.destroy(t)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,t){"object"==typeof e?(t=e.height??e.width,e=e.width):t??(t=e),void 0!==e&&this._setWidth(e,this._texture.orig.width),void 0!==t&&this._setHeight(t,this._texture.orig.height)}};const kt=new ne;function Lt(e,t,r){const n=kt;e.measurable=!0,Je(e,r,n),t.addBoundsMask(n),e.measurable=!1}function Nt(e,t,r){const n=Ke.get();e.measurable=!0;const s=qe.get().identity();at(e,n,Xt(e,r,s)),e.measurable=!1,t.addBoundsMask(n),qe.return(s),Ke.return(n)}function Xt(e,t,r){return e?(e!==t&&(Xt(e.parent,t,r),e.updateLocalTransform(),r.append(e.localTransform)),r):(Oe("Mask bounds, renderable is not inside the root container"),r)}class Ht{constructor(e){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof Ut),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask=null)}addBounds(e,t){this.inverse||Lt(this.mask,e,t)}addLocalBounds(e,t){Nt(this.mask,e,t)}containsPoint(e,t){return t(this.mask,e)}destroy(){this.reset()}static test(e){return e instanceof Ut}}Ht.extension=e.MaskEffect;class zt{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return"number"==typeof e}}zt.extension=e.MaskEffect;class Vt{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,t){Lt(this.mask,e,t)}addLocalBounds(e,t){Nt(this.mask,e,t)}containsPoint(e,t){return t(this.mask,e)}destroy(){this.reset()}static test(e){return e instanceof Ot}}Vt.extension=e.MaskEffect;const Wt={createCanvas:(e,t)=>{const r=document.createElement("canvas");return r.width=e,r.height=t,r},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>(new DOMParser).parseFromString(e,"text/xml")};let $t=Wt;const Yt={get:()=>$t,set(e){$t=e}};class jt extends K{constructor(e){e.resource||(e.resource=Yt.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),this.resource.width===this.pixelWidth&&this.resource.height===this.pixelHeight||(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,r=this._resolution){const n=super.resize(e,t,r);return n&&this.resizeCanvas(),n}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}jt.extension=e.TextureSource;class qt extends K{constructor(e){super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}}qt.extension=e.TextureSource;var Kt=(e=>(e[e.INTERACTION=50]="INTERACTION",e[e.HIGH=25]="HIGH",e[e.NORMAL=0]="NORMAL",e[e.LOW=-25]="LOW",e[e.UTILITY=-50]="UTILITY",e))(Kt||{});class Zt{constructor(e,t=null,r=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=r,this._once=n}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));const t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const Qt=class e{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Zt(null,null,1/0),this.deltaMS=1/e.targetFPMS,this.elapsedMS=1/e.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,r=Kt.NORMAL){return this._addListener(new Zt(e,t,r))}addOnce(e,t,r=Kt.NORMAL){return this._addListener(new Zt(e,t,r,!0))}_addListener(e){let t=this._head.next,r=this._head;if(t){for(;t;){if(e.priority>t.priority){e.connect(r);break}r=t,t=t.next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this}remove(e,t){let r=this._head.next;for(;r;)r=r.match(e,t)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let r;if(t>this.lastTime){if(r=this.elapsedMS=t-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){const e=t-this._lastFrame|0;if(e<this._minElapsedMS)return;this._lastFrame=t-e%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*e.targetFPMS;const n=this._head;let s=n.next;for(;s;)s=s.emit(this);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const r=Math.min(Math.max(0,t)/1e3,e.targetFPMS);this._maxElapsedMS=1/r,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){0===e?this._minElapsedMS=0:(e<this.minFPS&&(this.minFPS=e),this._minElapsedMS=1/(e/1e3))}static get shared(){if(!e._shared){const t=e._shared=new e;t.autoStart=!0,t._protected=!0}return e._shared}static get system(){if(!e._system){const t=e._system=new e;t.autoStart=!0,t._protected=!0}return e._system}};Qt.targetFPMS=.06;let Jt,er=Qt;async function tr(){return Jt??(Jt=(async()=>{const e=Yt.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const t=await new Promise(e=>{const t=document.createElement("video");t.onloadeddata=()=>e(t),t.onerror=()=>e(null),t.autoplay=!1,t.crossOrigin="anonymous",t.preload="auto",t.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",t.load()});if(!t)return"premultiply-alpha-on-upload";const r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);const n=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);const s=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,s),e.deleteFramebuffer(n),e.deleteTexture(r),e.getExtension("WEBGL_lose_context")?.loseContext(),s[0]<=s[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Jt}const rr=class e extends K{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...e.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==t.autoPlay,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),!1!==t.autoLoad&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const e=er.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const e=this.resource,t=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(t.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.isValid||e.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await tr(),this._load=new Promise((r,n)=>{this.isValid?r(this):(this._resolve=r,this._reject=n,void 0!==t.preloadTimeoutMs&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${t.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&this.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("loadedmetadata",this._onLoadedMetadata),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(er.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(er.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(er.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};rr.extension=e.TextureSource,rr.defaultOptions={...K.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},rr.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let nr=rr;const sr=(e,t,r=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(e=>"string"==typeof e||r?t(e):e):e);const ir=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);return t||Oe(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){const r=sr(e);let n;for(let e=0;e<this.parsers.length;e++){const s=this.parsers[e];if(s.test(t)){n=s.getCacheableAssets(r,t);break}}const s=new Map(Object.entries(n||{}));n||r.forEach(e=>{s.set(e,t)});const i=[...s.keys()],o={cacheKeys:i,keys:r};r.forEach(e=>{this._cacheMap.set(e,o)}),i.forEach(e=>{const r=n?n[e]:t;this._cache.has(e)&&this._cache.get(e)!==r&&Oe("[Cache] already has key:",e),this._cache.set(e,s.get(e))})}remove(e){if(!this._cacheMap.has(e))return void Oe(`[Assets] Asset id ${e} was not found in the Cache`);const t=this._cacheMap.get(e);t.cacheKeys.forEach(e=>{this._cache.delete(e)}),t.keys.forEach(e=>{this._cacheMap.delete(e)})}get parsers(){return this._parsers}},or=[];function ar(e={}){return lr(e)}function lr(e={}){const t=e&&e.resource,r=t?e.resource:e,n=t?e:{resource:e};for(let e=0;e<or.length;e++){const t=or[e];if(t.test(r))return new t(n)}throw new Error(`Could not find a source type for resource: ${n.resource}`)}function ur(e={},t=!1){const r=e&&e.resource,n=r?e.resource:e,s=r?e:{resource:e};if(!t&&ir.has(n))return ir.get(n);const i=new ee({source:lr(s)});return i.on("destroy",()=>{ir.has(n)&&ir.remove(n)}),t||ir.set(n,i),i}function hr(e,t=!1){return"string"==typeof e?ir.get(e):e instanceof K?new ee({source:e}):ur(e,t)}n.handleByList(e.TextureSource,or),ee.from=hr,K.from=lr,n.add(Ht,zt,Vt,nr,qt,jt,Z);var cr=(e=>(e[e.Low=0]="Low",e[e.Normal=1]="Normal",e[e.High=2]="High",e))(cr||{});function dr(e){if("string"!=typeof e)throw new TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function pr(e){return e.split("?")[0].split("#")[0]}const fr={toPosix(e){return t="\\",r="/",e.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),r);var t,r},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl:e=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e),isBlobUrl:e=>e.startsWith("blob:"),hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){dr(e),e=this.toPosix(e);const t=/^file:\/\/\//.exec(e);if(t)return t[0];const r=/^[^/:]+:\/{0,2}/.exec(e);return r?r[0]:""},toAbsolute(e,t,r){if(dr(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;const n=pr(this.toPosix(t??Yt.get().getBaseUrl())),s=pr(this.toPosix(r??this.rootname(n)));if((e=this.toPosix(e)).startsWith("/"))return fr.join(s,e.slice(1));return this.isAbsolute(e)?e:this.join(n,e)},normalize(e){if(dr(e),0===e.length)return".";if(this.isDataUrl(e)||this.isBlobUrl(e))return e;let t="";const r=(e=this.toPosix(e)).startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));const n=e.endsWith("/");return e=function(e){let t="",r=0,n=-1,s=0,i=-1;for(let o=0;o<=e.length;++o){if(o<e.length)i=e.charCodeAt(o);else{if(47===i)break;i=47}if(47===i){if(n===o-1||1===s);else if(n!==o-1&&2===s){if(t.length<2||2!==r||46!==t.charCodeAt(t.length-1)||46!==t.charCodeAt(t.length-2))if(t.length>2){const e=t.lastIndexOf("/");if(e!==t.length-1){-1===e?(t="",r=0):(t=t.slice(0,e),r=t.length-1-t.lastIndexOf("/")),n=o,s=0;continue}}else if(2===t.length||1===t.length){t="",r=0,n=o,s=0;continue}}else t.length>0?t+=`/${e.slice(n+1,o)}`:t=e.slice(n+1,o),r=o-n-1;n=o,s=0}else 46===i&&-1!==s?++s:s=-1}return t}(e),e.length>0&&n&&(e+="/"),r?`/${e}`:t+e},isAbsolute(e){return dr(e),e=this.toPosix(e),!!this.hasProtocol(e)||e.startsWith("/")},join(...e){if(0===e.length)return".";let t;for(let r=0;r<e.length;++r){const n=e[r];if(dr(n),n.length>0)if(void 0===t)t=n;else{const s=e[r-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${n}`:t+=`/${n}`}}return void 0===t?".":this.normalize(t)},dirname(e){if(dr(e),0===e.length)return".";let t=(e=this.toPosix(e)).charCodeAt(0);const r=47===t;let n=-1,s=!0;const i=this.getProtocol(e),o=e;for(let r=(e=e.slice(i.length)).length-1;r>=1;--r)if(t=e.charCodeAt(r),47===t){if(!s){n=r;break}}else s=!1;return-1===n?r?"/":this.isUrl(o)?i+e:i:r&&1===n?"//":i+e.slice(0,n)},rootname(e){dr(e);let t="";if(t=(e=this.toPosix(e)).startsWith("/")?"/":this.getProtocol(e),this.isUrl(e)){const r=e.indexOf("/",t.length);t=-1!==r?e.slice(0,r):e,t.endsWith("/")||(t+="/")}return t},basename(e,t){dr(e),t&&dr(t),e=pr(this.toPosix(e));let r,n=0,s=-1,i=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let o=t.length-1,a=-1;for(r=e.length-1;r>=0;--r){const l=e.charCodeAt(r);if(47===l){if(!i){n=r+1;break}}else-1===a&&(i=!1,a=r+1),o>=0&&(l===t.charCodeAt(o)?-1===--o&&(s=r):(o=-1,s=a))}return n===s?s=a:-1===s&&(s=e.length),e.slice(n,s)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!i){n=r+1;break}}else-1===s&&(i=!1,s=r+1);return-1===s?"":e.slice(n,s)},extname(e){dr(e);let t=-1,r=0,n=-1,s=!0,i=0;for(let o=(e=pr(this.toPosix(e))).length-1;o>=0;--o){const a=e.charCodeAt(o);if(47!==a)-1===n&&(s=!1,n=o+1),46===a?-1===t?t=o:1!==i&&(i=1):-1!==t&&(i=-1);else if(!s){r=o+1;break}}return-1===t||-1===n||0===i||1===i&&t===n-1&&t===r+1?"":e.slice(t,n)},parse(e){dr(e);const t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;let r=(e=pr(this.toPosix(e))).charCodeAt(0);const n=this.isAbsolute(e);let s;t.root=this.rootname(e),s=n||this.hasProtocol(e)?1:0;let i=-1,o=0,a=-1,l=!0,u=e.length-1,h=0;for(;u>=s;--u)if(r=e.charCodeAt(u),47!==r)-1===a&&(l=!1,a=u+1),46===r?-1===i?i=u:1!==h&&(h=1):-1!==i&&(h=-1);else if(!l){o=u+1;break}return-1===i||-1===a||0===h||1===h&&i===a-1&&i===o+1?-1!==a&&(t.base=t.name=0===o&&n?e.slice(1,a):e.slice(o,a)):(0===o&&n?(t.name=e.slice(1,i),t.base=e.slice(1,a)):(t.name=e.slice(o,i),t.base=e.slice(o,a)),t.ext=e.slice(i,a)),t.dir=this.dirname(e),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function mr(e,t,r,n,s){const i=t[r];for(let o=0;o<i.length;o++){const a=i[o];r<t.length-1?mr(e.replace(n[r],a),t,r+1,n,s):s.push(e.replace(n[r],a))}}function gr(e){const t=e.match(/\{(.*?)\}/g),r=[];if(t){const n=[];t.forEach(e=>{const t=e.substring(1,e.length-1).split(",");n.push(t)}),mr(e,n,0,t,r)}else r.push(e);return r}const _r=e=>!Array.isArray(e);class xr{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if("string"==typeof e)this._defaultSearchParams=e;else{const t=e;this._defaultSearchParams=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}}getAlias(e){const{alias:t,src:r}=e,n=sr(t||r,e=>"string"==typeof e?e:Array.isArray(e)?e.map(e=>e?.src??e):e?.src?e.src:e,!0);return n}removeAlias(e,t){this._assetMap[e]&&(t&&t!==this._resolverHash[e]||(delete this._resolverHash[e],delete this._assetMap[e]))}addManifest(e){this._manifest&&Oe("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(e,t){const r=[];let n=t;Array.isArray(t)||(n=Object.entries(t).map(([e,t])=>"string"==typeof t||Array.isArray(t)?{alias:e,src:t}:{alias:e,...t})),n.forEach(t=>{const n=t.src,s=t.alias;let i;if("string"==typeof s){const t=this._createBundleAssetId(e,s);r.push(t),i=[s,t]}else{const t=s.map(t=>this._createBundleAssetId(e,t));r.push(...t),i=[...s,...t]}this.add({...t,alias:i,src:n})}),this._bundles[e]=r}add(e){const t=[];let r;Array.isArray(e)?t.push(...e):t.push(e),r=e=>{this.hasKey(e)&&Oe(`[Resolver] already has key: ${e} overwriting`)};sr(t).forEach(e=>{const{src:t}=e;let{data:n,format:s,loadParser:i,parser:o}=e;const a=sr(t).map(e=>"string"==typeof e?gr(e):Array.isArray(e)?e:[e]),l=this.getAlias(e);Array.isArray(l)?l.forEach(r):r(l);const u=[],h=e=>{const t=this._parsers.find(t=>t.test(e));return{src:e,...t?.parse(e)}};a.forEach(t=>{t.forEach(t=>{let r={};if("object"!=typeof t?r=h(t):(n=t.data??n,s=t.format??s,(t.loadParser||t.parser)&&(i=t.loadParser??i,o=t.parser??o),r={...h(t.src),...t}),!l)throw new Error(`[Resolver] alias is undefined for this asset: ${r.src}`);r=this._buildResolvedAsset(r,{aliases:l,data:n,format:s,loadParser:i,parser:o,progressSize:e.progressSize}),u.push(r)})}),l.forEach(e=>{this._assetMap[e]=u})})}resolveBundle(e){const t=_r(e);e=sr(e);const r={};return e.forEach(e=>{const t=this._bundles[e];if(t){const n=this.resolve(t),s={};for(const t in n){const r=n[t];s[this._extractAssetIdFromBundle(e,t)]=r}r[e]=s}}),t?r[e[0]]:r}resolveUrl(e){const t=this.resolve(e);if("string"!=typeof e){const e={};for(const r in t)e[r]=t[r].src;return e}return t.src}resolve(e){const t=_r(e);e=sr(e);const r={};return e.forEach(e=>{if(!this._resolverHash[e])if(this._assetMap[e]){let t=this._assetMap[e];const r=this._getPreferredOrder(t);r?.priority.forEach(e=>{r.params[e].forEach(r=>{const n=t.filter(t=>!!t[e]&&t[e]===r);n.length&&(t=n)})}),this._resolverHash[e]=t[0]}else this._resolverHash[e]=this._buildResolvedAsset({alias:[e],src:e},{});r[e]=this._resolverHash[e]}),t?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){const r=e[t],n=this._preferredOrder.find(e=>e.params.format.includes(r.format));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;return`${e}${/\?/.test(e)?"&":"?"}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){const{aliases:r,data:n,loadParser:s,parser:i,format:o,progressSize:a}=t;return(this._basePath||this._rootPath)&&(e.src=fr.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=r??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...n||{},...e.data},e.loadParser=s??e.loadParser,e.parser=i??e.parser,e.format=o??e.format??br(e.src),void 0!==a&&(e.progressSize=a),e}}function br(e){return e.split(".").pop().split("?").shift().split("#").shift()}xr.RETINA_PREFIX=/@([0-9\.]+)x/;const yr=(e,t)=>{const r=t.split("?")[1];return r&&(e+=`?${r}`),e},vr=class e{constructor(e,t){this.linkedSheets=[];let r=e;e?.source instanceof K&&(r={texture:e,data:t});const{texture:n,data:s,cachePrefix:i=""}=r;this.cachePrefix=i,this._texture=n instanceof ee?n:null,this.textureSource=n.source,this.textures={},this.animations={},this.data=s;const o=parseFloat(s.meta.scale);o?(this.resolution=o,n.source.resolution=this.resolution):this.resolution=n.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=e.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,r=!1){let n=t;const s=r?1/0:e.BATCH_SIZE;for(;n-t<s&&n<this._frameKeys.length;){const e=this._frameKeys[n],t=this._frames[e],r=t.frame;if(r){let n=null,s=null;const i=!1!==t.trimmed&&t.sourceSize?t.sourceSize:t.frame,o=new M(0,0,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution);n=t.rotated?new M(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.h)/this.resolution,Math.floor(r.w)/this.resolution):new M(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution),!1!==t.trimmed&&t.spriteSourceSize&&(s=new M(Math.floor(t.spriteSourceSize.x)/this.resolution,Math.floor(t.spriteSourceSize.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution)),this.textures[e]=new ee({source:this.textureSource,frame:n,orig:o,trim:s,rotate:t.rotated?2:0,defaultAnchor:t.anchor,defaultBorders:t.borders,label:e.toString()})}n++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let r=0;r<e[t].length;r++){const n=e[t][r];this.animations[t].push(this.textures[n])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*e.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*e.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(const e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};vr.BATCH_SIZE=1e3;let Tr=vr;const Sr=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function wr(e,t,r){const n={};if(e.forEach(e=>{n[e]=t}),Object.keys(t.textures).forEach(e=>{n[`${t.cachePrefix}${e}`]=t.textures[e]}),!r){const r=fr.dirname(e[0]);t.linkedSheets.forEach((e,s)=>{const i=wr([`${r}/${t.data.meta.related_multi_packs[s]}`],e,!0);Object.assign(n,i)})}return n}const Er={extension:e.Asset,cache:{test:e=>e instanceof Tr,getCacheableAssets:(e,t)=>wr(e,t,!1)},resolver:{extension:{type:e.ResolveParser,name:"resolveSpritesheet"},test:e=>{const t=e.split("?")[0].split("."),r=t.pop(),n=t.pop();return"json"===r&&Sr.includes(n)},parse:e=>{const t=e.split(".");return{resolution:parseFloat(xr.RETINA_PREFIX.exec(e)?.[1]??"1"),format:t[t.length-2],src:e}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:e.LoadParser,priority:cr.Normal,name:"spritesheetLoader"},testParse:async(e,t)=>".json"===fr.extname(t.src).toLowerCase()&&!!e.frames,async parse(e,t,r){const{texture:n,imageFilename:s,textureOptions:i,cachePrefix:o}=t?.data??{};let a,l=fr.dirname(t.src);if(l&&l.lastIndexOf("/")!==l.length-1&&(l+="/"),n instanceof ee)a=n;else{const n=yr(l+(s??e.meta.image),t.src);a=(await r.load([{src:n,data:i}]))[n]}const u=new Tr({texture:a.source,data:e,cachePrefix:o});await u.parse();const h=e?.meta?.related_multi_packs;if(Array.isArray(h)){const e=[];for(const n of h){if("string"!=typeof n)continue;let s=l+n;t.data?.ignoreMultiPack||(s=yr(s,t.src),e.push(r.load({src:s,data:{textureOptions:i,ignoreMultiPack:!0}})))}const n=await Promise.all(e);u.linkedSheets=n,n.forEach(e=>{e.linkedSheets=[u].concat(u.linkedSheets.filter(t=>t!==e))})}return u},async unload(e,t,r){await r.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}};n.add(Er);class Ar{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const e=this._canvas.getBoundingClientRect(),t=this._canvas.width,r=this._canvas.height,n=e.width/t*this._renderer.resolution,s=e.height/r*this._renderer.resolution,i=`translate(${e.left}px, ${e.top}px) scale(${n}, ${s})`;i!==this._lastTransform&&(this._domElement.style.transform=i,this._lastTransform=i)},this._domElement=e.domElement,this._renderer=e.renderer,globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas||(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const e=this.canvas.width,r=this.canvas.height,n=t.contentRect.width/e*this._renderer.resolution,s=t.contentRect.height/r*this._renderer.resolution;(this._lastScaleX!==n||this._lastScaleY!==s)&&(this.updateTranslation(),this._lastScaleX=n,this._lastScaleY=s)}}),this._observer.observe(this._canvas)):this._tickerAttached||er.shared.add(this.updateTranslation,this,Kt.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&er.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class Rr{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Rr.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,r,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var Cr=/iPhone/i,Mr=/iPod/i,Pr=/iPad/i,Gr=/\biOS-universal(?:.+)Mac\b/i,Br=/\bAndroid(?:.+)Mobile\b/i,Fr=/Android/i,Ir=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Or=/Silk/i,Dr=/Windows Phone/i,Ur=/\bWindows(?:.+)ARM\b/i,kr=/BlackBerry/i,Lr=/BB10/i,Nr=/Opera Mini/i,Xr=/\b(CriOS|Chrome)(?:.+)Mobile/i,Hr=/Mobile(?:.+)Firefox\b/i,zr=function(e){return void 0!==e&&"MacIntel"===e.platform&&"number"==typeof e.maxTouchPoints&&e.maxTouchPoints>1&&"undefined"==typeof MSStream};function Vr(e){var t={userAgent:"",platform:"",maxTouchPoints:0};e||"undefined"==typeof navigator?"string"==typeof e?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0}):t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var r=t.userAgent,n=r.split("[FBAN");void 0!==n[1]&&(r=n[0]),void 0!==(n=r.split("Twitter"))[1]&&(r=n[0]);var s=function(e){return function(t){return t.test(e)}}(r),i={apple:{phone:s(Cr)&&!s(Dr),ipod:s(Mr),tablet:!s(Cr)&&(s(Pr)||zr(t))&&!s(Dr),universal:s(Gr),device:(s(Cr)||s(Mr)||s(Pr)||s(Gr)||zr(t))&&!s(Dr)},amazon:{phone:s(Ir),tablet:!s(Ir)&&s(Or),device:s(Ir)||s(Or)},android:{phone:!s(Dr)&&s(Ir)||!s(Dr)&&s(Br),tablet:!s(Dr)&&!s(Ir)&&!s(Br)&&(s(Or)||s(Fr)),device:!s(Dr)&&(s(Ir)||s(Or)||s(Br)||s(Fr))||s(/\bokhttp\b/i)},windows:{phone:s(Dr),tablet:s(Ur),device:s(Dr)||s(Ur)},other:{blackberry:s(kr),blackberry10:s(Lr),opera:s(Nr),firefox:s(Hr),chrome:s(Xr),device:s(kr)||s(Lr)||s(Nr)||s(Hr)||s(Xr)},any:!1,phone:!1,tablet:!1};return i.any=i.apple.device||i.android.device||i.windows.device||i.other.device,i.phone=i.apple.phone||i.android.phone||i.windows.phone,i.tablet=i.apple.tablet||i.android.tablet||i.windows.tablet,i}const Wr=(Vr.default??Vr)(globalThis.navigator),$r=class e{constructor(e,t=Wr){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width="1px",e.style.height="1px",e.style.position="absolute",e.style.top="-1000px",e.style.left="-1000px",e.style.zIndex=2..toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top="0px",this._div.style.left="0px",this._div.style.pointerEvents="none",this._div.style.zIndex=2..toString(),this._canvasObserver=new Ar({domElement:this._div,renderer:this._renderer})),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(this._isActive&&!this._isMobileAccessibility){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools){this._pools[e].forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),delete this._pools[e]}this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let e=0;e<t.length;e++)this._updateAccessibleObjects(t[e])}init(t){const r={accessibilityOptions:{...e.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),r.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount)return;if(this._androidUpdateCount=e+this._androidUpdateFrequency,!(this._renderer.renderingToScreen&&this._renderer.view.canvas||this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const e of this._children)e._renderId===this._renderId&&t.add(this._children.indexOf(e))}for(let e=this._children.length-1;e>=0;e--){const r=this._children[e];if(!t.has(e)){if(r._accessibleDiv&&r._accessibleDiv.parentNode){r._accessibleDiv.parentNode.removeChild(r._accessibleDiv);this._getPool(r.accessibleType).push(r._accessibleDiv),r._accessibleDiv=null}r._accessibleActive=!1,Xe(this._children,e,1)}}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let e=0;e<this._children.length;e++){const t=this._children[e];if(!t._accessibleActive||!t._accessibleDiv)continue;const r=t._accessibleDiv,n=t.hitArea||t.getBounds().rectangle;if(t.hitArea){const e=t.worldTransform;r.style.left=`${e.tx+n.x*e.a}px`,r.style.top=`${e.ty+n.y*e.d}px`,r.style.width=n.width*e.a+"px",r.style.height=n.height*e.d+"px"}else this._capHitArea(n),r.style.left=`${n.x}px`,r.style.top=`${n.y}px`,r.style.width=`${n.width}px`,r.style.height=`${n.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:r}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>r&&(e.height=r-e.y)}_addChild(e){let t=this._getPool(e.accessibleType).pop();t?(t.innerHTML="",t.removeAttribute("title"),t.removeAttribute("aria-label"),t.tabIndex=0):("button"===e.accessibleType?(t=document.createElement("button"),this.debug||(t.style.color="transparent")):(t=document.createElement(e.accessibleType),t.style.cssText="\n color: transparent;\n pointer-events: none;\n padding: 0;\n margin: 0;\n border: 0;\n outline: 0;\n background: transparent;\n box-sizing: border-box;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n "),t.style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2..toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleText&&(t.innerText=e.accessibleText),e.accessibleTitle&&null!==e.accessibleTitle?t.title=e.accessibleTitle:e.accessibleHint&&null!==e.accessibleHint||(t.title=`container ${e.tabIndex}`),e.accessibleHint&&null!==e.accessibleHint&&t.setAttribute("aria-label",e.accessibleHint),e.interactive?t.tabIndex=e.tabIndex:t.tabIndex=0,this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,t){const{container:r}=e.target,n=this._renderer.events.rootBoundary,s=Object.assign(new Rr(n),{target:r});n.rootTarget=this._renderer.lastObjectRendered,t.forEach(e=>n.dispatchEvent(s,e))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){9===e.keyCode&&this._activateOnTab&&this._activate()}_onMouseMove(e){0===e.movementX&&0===e.movementY||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}};$r.extension={type:[e.WebGLSystem,e.WebGPUSystem],name:"accessibility"},$r.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};let Yr=$r;const jr={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1},qr=Object.create(null),Kr=Object.create(null);function Zr(e,t){let r=Kr[e];return void 0===r&&(void 0===qr[t]&&(qr[t]=1),Kr[e]=r=qr[t]++),r}let Qr,Jr;function en(){if(!Qr||Qr?.isContextLost()){const e=Yt.get().createCanvas();Qr=e.getContext("webgl",{})}return Qr}function tn(){if(!Jr){Jr="mediump";const e=en();if(e&&e.getShaderPrecisionFormat){const t=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT);Jr=t.precision?"highp":"mediump"}}return Jr}function rn(e,t,r){return t?e:r?`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in varying\n #define finalColor gl_FragColor\n #define texture texture2D\n #endif\n ${e=e.replace("out vec4 finalColor;","")}\n `:`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in attribute\n #define out varying\n #endif\n ${e}\n `}const nn=/\buniform\s+([iu]?sampler\w+)/g,sn=/\bprecision\s+\w+\s+([iu]?sampler\w+)\s*;/g,on={sampler2D:"lowp",samplerCube:"lowp"};function an(e,t,r){const n=r?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if("precision"!==e.substring(0,9)){let s=r?t.requestedFragmentPrecision:t.requestedVertexPrecision;"highp"===s&&"highp"!==n&&(s="mediump"),e=`precision ${s} float;\n${e}`}else"highp"!==n&&"precision highp"===e.substring(0,15)&&(e=e.replace("precision highp","precision mediump"));return function(e,t){const r=new Set;let n="";for(const[,t]of e.matchAll(sn))r.add(t);for(const[,s]of e.matchAll(nn))r.has(s)||(r.add(s),n+=`precision ${on[s]??t} ${s};\n`);return n+e}(e,"highp"===t.maxSupportedFragmentPrecision?"highp":"mediump")}function ln(e,t){return t?`#version 300 es\n${e}`:e}const un={},hn={};function cn(e,{name:t="pixi-program"},r=!0){t=t.replace(/\s+/g,"-");const n=r?un:hn;if(n[t+=r?"-fragment":"-vertex"]?(n[t]++,t+=`-${n[t]}`):n[t]=1,-1!==e.indexOf("#define SHADER_NAME"))return e;return`${`#define SHADER_NAME ${t}`}\n${e}`}function dn(e,t){return t?e.replace("#version 300 es",""):e}const pn={stripVersion:dn,ensurePrecision:an,addProgramDefines:rn,setProgramName:cn,insertVersion:ln},fn=Object.create(null),mn=class e{constructor(t){const r=-1!==(t={...e.defaultOptions,...t}).fragment.indexOf("#version 300 es"),n={stripVersion:r,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:tn()},setProgramName:{name:t.name},addProgramDefines:r,insertVersion:r};let s=t.fragment,i=t.vertex;Object.keys(pn).forEach(e=>{const t=n[e];s=pn[e](s,t,!0),i=pn[e](i,t,!1)}),this.fragment=s,this.vertex=i,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Zr(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,fn[this._cacheKey]=null}static from(t){const r=`${t.vertex}:${t.fragment}`;return fn[r]||(fn[r]=new e(t),fn[r]._cacheKey=r),fn[r]}};mn.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let gn=mn;const _n={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function xn(e){return _n[e]??_n.float32}const bn={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},yn=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function vn(e,t){let r;for(;null!==(r=yn.exec(e));){const e=bn[r[3]]??"float32";t[r[2]]={location:parseInt(r[1],10),format:e,stride:xn(e).stride,offset:0,instance:!1,start:0}}yn.lastIndex=0}function Tn({source:e,entryPoint:t}){const r={},n=function(e){return e.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}(e),s=n.indexOf(`fn ${t}(`);if(-1===s)return r;const i=n.indexOf("->",s);if(-1===i)return r;const o=n.substring(s,i);if(vn(o,r),0===Object.keys(r).length){const e=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(e){const t=e[1],s=new RegExp(`struct\\s+${t}\\s*\\{([^}]+)\\}`,"s"),i=n.match(s);i&&vn(i[1],r)}}return r}function Sn(e){const t=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,s=/:\s*([\w<>]+)/,i=/(\w+)\s*:\s*([\w\<\>]+)/g,o=/struct\s+(\w+)/,a=e.match(/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g)?.map(e=>{const i=e.match(n),o=i?.[1]??"";let a;return"<uniform>"===o?a="uniform":o.startsWith("<storage")&&(a="storage"),{group:parseInt(e.match(t)[1],10),binding:parseInt(e.match(r)[1],10),name:i[2],accessMode:a,type:e.match(s)[1]}});if(!a)return{groups:[],structs:[]};const l=e.match(/struct\s+(\w+)\s*{([^}]+)}/g)?.map(e=>{const t=e.match(o)[1],r=e.match(i).reduce((e,t)=>{const[r,n]=t.split(":");return e[r.trim()]=n.trim(),e},{});return r?{name:t,members:r}:null}).filter(({name:e})=>a.some(t=>t.type===e||t.type.includes(`<${e}>`)))??[];return{groups:a,structs:l}}var wn=(e=>(e[e.VERTEX=1]="VERTEX",e[e.FRAGMENT=2]="FRAGMENT",e[e.COMPUTE=4]="COMPUTE",e))(wn||{});function En(e){return e.endsWith("<u32>")?"uint":e.endsWith("<i32>")?"sint":"float"}function An({groups:e}){const t=[];for(let r=0;r<e.length;r++){const n=e[r];t[n.group]||(t[n.group]=[]),"uniform"===n.accessMode?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,buffer:{type:"uniform"}}):"storage"===n.accessMode?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,buffer:{type:"read-only-storage"}}):"sampler"===n.type?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,sampler:{type:"filtering"}}):"sampler_comparison"===n.type?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,sampler:{type:"comparison"}}):"texture_2d"===n.type||n.type.startsWith("texture_2d<")?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,texture:{sampleType:En(n.type),viewDimension:"2d",multisampled:!1}}):"texture_depth_2d"===n.type?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d",multisampled:!1}}):"texture_depth_2d_array"===n.type?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,texture:{sampleType:"depth",viewDimension:"2d-array",multisampled:!1}}):"texture_2d_array"===n.type||n.type.startsWith("texture_2d_array<")?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,texture:{sampleType:En(n.type),viewDimension:"2d-array",multisampled:!1}}):"texture_3d"===n.type||n.type.startsWith("texture_3d<")?t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,texture:{sampleType:En(n.type),viewDimension:"3d",multisampled:!1}}):("texture_cube"===n.type||n.type.startsWith("texture_cube<"))&&t[n.group].push({binding:n.binding,visibility:wn.VERTEX|wn.FRAGMENT,texture:{sampleType:En(n.type),viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function Rn({groups:e}){const t=[];for(let r=0;r<e.length;r++){const n=e[r];t[n.group]||(t[n.group]={}),t[n.group][n.name]=n.binding}return t}function Cn(e,t){const r=new Set,n=new Set;return{structs:[...e.structs,...t.structs].filter(e=>!r.has(e.name)&&(r.add(e.name),!0)),groups:[...e.groups,...t.groups].filter(e=>{const t=`${e.name}-${e.binding}`;return!n.has(t)&&(n.add(t),!0)})}}const Mn=Object.create(null);class Pn{constructor(e){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:t,vertex:r,layout:n,gpuLayout:s,name:i}=e;if(this.name=i,this.fragment=t,this.vertex=r,t.source===r.source){const e=Sn(t.source);this.structsAndGroups=e}else{const e=Sn(r.source),n=Sn(t.source);this.structsAndGroups=Cn(e,n)}this.layout=n??Rn(this.structsAndGroups),this.gpuLayout=s??An(this.structsAndGroups),this.autoAssignGlobalUniforms=!(void 0===this.layout[0]?.globalUniforms),this.autoAssignLocalUniforms=!(void 0===this.layout[1]?.localUniforms),this._generateProgramKey()}_generateProgramKey(){const{vertex:e,fragment:t}=this,r=e.source+t.source+e.entryPoint+t.entryPoint;this._layoutKey=Zr(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Tn(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Mn[this._cacheKey]=null}static from(e){const t=`${e.vertex.source}:${e.fragment.source}:${e.fragment.entryPoint}:${e.vertex.entryPoint}`;return Mn[t]||(Mn[t]=new Pn(e),Mn[t]._cacheKey=t),Mn[t]}}const Gn=["f32","i32","u32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>","vec2<u32>","vec3<u32>","vec4<u32>"],Bn=Gn.reduce((e,t)=>(e[t]=!0,e),{});function Fn(e,t){switch(e){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const In=class e extends c{constructor(t,r){super(),this.uid=G("uniform"),this._resourceType="uniformGroup",this._resourceId=G("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r={...e.defaultOptions,...r},this.uniformStructures=t;const n={};for(const e in t){const r=t[e];if(r.name=e,r.size=r.size??1,!Bn[r.type]){const e=r.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(e){const[,t,n]=e;throw new Error(`Uniform type ${r.type} is not supported. Use type: '${t}', size: ${n} instead.`)}throw new Error(`Uniform type ${r.type} is not supported. Supported uniform types are: ${Gn.join(", ")}`)}r.value??(r.value=Fn(r.type,r.size)),n[e]=r.value}this.uniforms=n,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=Zr(Object.keys(n).map(e=>`${e}-${t[e].type}`).join("-"),"uniform-group")}get buffer(){return this._buffer}set buffer(e){this._buffer!==e&&(this._buffer?.off("change",this.onBufferChange,this),this._buffer=e,e?.on("change",this.onBufferChange,this))}get _gcLastUsed(){return this._buffer?._gcLastUsed??-1}set _gcLastUsed(e){this._buffer&&(this._buffer._gcLastUsed=e)}onBufferChange(){this._resourceId=G("resource"),this.emit("change",this)}update(){this._dirtyId++}};In.defaultOptions={ubo:!1,isStatic:!1};let On=In;class Dn{constructor(e){this.resources=Object.create(null),this._resourceKeysValue=null,this._dirty=!0;let t=0;for(const r in e){const n=e[r];this.setResource(n,t++)}}get _resourceKeys(){return this._resourceKeysValue??(this._resourceKeysValue=Object.keys(this.resources).map(Number)),this._resourceKeysValue}get _key(){if(this._dirty){this._dirty=!1;const e=[];let t=0;for(const r in this.resources)e[t++]=this.resources[r]?this.resources[r]._resourceId:-1;this._keyValue=e.join("|")}return this._keyValue}setResource(e,t){const r=this.resources[t];e!==r&&(r&&r.off?.("change",this.onResourceChange,this),e.on?.("change",this.onResourceChange,this),void 0===r&&(this._resourceKeysValue=null),this.resources[t]=e,this._dirty=!0)}getResource(e){return this.resources[e]}_touch(e){const t=this.resources,r=this._resourceKeys;for(let n=0;n<r.length;n++){const s=t[r[n]];s&&(s._gcLastUsed=e)}}destroy(){const e=this.resources;for(const t in e){const r=e[t];r?.off?.("change",this.onResourceChange,this)}this.resources=null,this._resourceKeysValue=null}onResourceChange(e){if(this._dirty=!0,e.destroyed){const t=this.resources;for(const r in t)t[r]===e&&(t[r]=null);Oe(`[BindGroup] a '${e._resourceType}' was destroyed while still bound to a shader. Remove it from the shader before destroying it.`)}}}var Un=(e=>(e[e.WEBGL=1]="WEBGL",e[e.WEBGPU=2]="WEBGPU",e[e.CANVAS=4]="CANVAS",e[e.BOTH=3]="BOTH",e))(Un||{});class kn{constructor(e){this.data={...e};const t=Object.keys(e).sort().map(t=>`${t}:${e[t]}`).join("|");this.id=Zr(t,"shader-overrides")}static from(e){return e instanceof kn?e:new kn(e)}}class Ln extends c{constructor(e){super(),this.uid=G("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:t,glProgram:r,groups:n,resources:s,compatibleRenderers:i,groupMap:o,overrides:a}=e;this._overrides=a?kn.from(a):null,this.gpuProgram=t,this.glProgram=r,void 0===i&&(i=0,t&&(i|=Un.WEBGPU),r&&(i|=Un.WEBGL)),this.compatibleRenderers=i;const l={};if(o)for(const e in o)for(const t in o[e]){const r=o[e][t];l[r]={group:e,binding:t,name:r}}if(s||n||(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!t&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(t&&n&&!o){const e=t.structsAndGroups.groups;o={},e.forEach(e=>{o[e.group]=o[e.group]||{},o[e.group][e.binding]=e.name,l[e.name]=e})}else if(s){if(n={},o||(o={}),t){t.structsAndGroups.groups.forEach(e=>{o[e.group]=o[e.group]||{},o[e.group][e.binding]=e.name,l[e.name]=e})}let e=0;for(const i in s)l[i]||(t&&!r&&Oe(`[Shader] the resource '${i}' matches no binding in the WGSL source — is the name correct?`),n[99]||(n[99]=new Dn,this._ownedBindGroups.push(n[99])),l[i]={group:99,binding:e,name:i},o[99]=o[99]||{},o[99][e]=i,e++);for(const e in s){const t=e;let r=s[e];r.source||r._resourceType||(r=new On(r));const i=l[t];i&&(n[i.group]||(n[i.group]=new Dn,this._ownedBindGroups.push(n[i.group])),n[i.group].setResource(r,i.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(e,t,r){var n,s;(n=this._uniformBindMap)[t]||(n[t]={}),(s=this._uniformBindMap[t])[r]||(s[r]=e),this.groups[t]||(this.groups[t]=new Dn,this._ownedBindGroups.push(this.groups[t]))}_buildResourceAccessor(e,t){const r={};for(const n in t){const s=t[n];Object.defineProperty(r,s.name,{get:()=>e[s.group].getResource(s.binding),set(t){e[s.group].setResource(t,s.binding)}})}return r}destroy(e=!1){this._destroyed||(this._destroyed=!0,this.emit("destroy",this),e&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null,this._overrides=null)}static from(e){const{gpu:t,gl:r,...n}=e;let s,i;return t&&(s=Pn.from(t)),r&&(i=gn.from(r)),new Ln({gpuProgram:s,glProgram:i,...n})}}const Nn={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Xn={BLEND:0,OFFSET:1,CULLING:2,DEPTH_TEST:3,WINDING:4,DEPTH_MASK:5},{BLEND:Hn,OFFSET:zn,CULLING:Vn,DEPTH_TEST:Wn,WINDING:$n,DEPTH_MASK:Yn}=Xn,jn=class e{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Hn)}set blend(e){!!(this.data&1<<Hn)!==e&&(this.data^=1<<Hn)}get offsets(){return!!(this.data&1<<zn)}set offsets(e){!!(this.data&1<<zn)!==e&&(this.data^=1<<zn)}set cullMode(e){"none"!==e?(this.culling=!0,this.clockwiseFrontFace="front"===e):this.culling=!1}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Vn)}set culling(e){!!(this.data&1<<Vn)!==e&&(this.data^=1<<Vn)}get depthTest(){return!!(this.data&1<<Wn)}set depthTest(e){!!(this.data&1<<Wn)!==e&&(this.data^=1<<Wn)}get depthMask(){return!!(this.data&1<<Yn)}set depthMask(e){!!(this.data&1<<Yn)!==e&&(this.data^=1<<Yn)}get clockwiseFrontFace(){return!!(this.data&1<<$n)}set clockwiseFrontFace(e){!!(this.data&1<<$n)!==e&&(this.data^=1<<$n)}get blendMode(){return this._blendMode}set blendMode(e){this.blend="none"!==e,this._blendMode=e,this._blendModeId=Nn[e]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const t=new e;return t.depthTest=!1,t.depthMask=!1,t.blend=!0,t}};jn.default2d=jn.for2d();let qn=jn;const Kn=class e extends Ln{constructor(t){super(t={...e.defaultOptions,...t}),this.enabled=!0,this._state=qn.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,"boolean"==typeof t.antialias?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1),t.blendRequired&&this.addResource("uBackTexture",0,3)}apply(e,t,r,n){e.applyFilter(this,t,r,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(t){const{gpu:r,gl:n,...s}=t;let i,o;return r&&(i=Pn.from(r)),n&&(o=gn.from(n)),new e({gpuProgram:i,glProgram:o,...s})}};Kn.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let Zn=Kn;var Qn="\nin vec2 vTextureCoord;\nin vec4 vColor;\n\nout vec4 finalColor;\n\nuniform float uBlend;\n\nuniform sampler2D uTexture;\nuniform sampler2D uBackTexture;\n\n{FUNCTIONS}\n\nvoid main()\n{ \n vec4 back = texture(uBackTexture, vTextureCoord);\n vec4 front = texture(uTexture, vTextureCoord);\n float blendedAlpha = front.a + back.a * (1.0 - front.a);\n \n {MAIN}\n}\n",Jn="in vec2 aPosition;\nout vec2 vTextureCoord;\nout vec2 backgroundUv;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",es="\nstruct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct BlendUniforms {\n uBlend:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n@group(0) @binding(3) var uBackTexture: texture_2d<f32>;\n\n@group(1) @binding(0) var<uniform> blendUniforms : BlendUniforms;\n\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n };\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition)\n );\n}\n\n{FUNCTIONS}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>\n) -> @location(0) vec4<f32> {\n\n\n var back = textureSample(uBackTexture, uSampler, uv);\n var front = textureSample(uTexture, uSampler, uv);\n var blendedAlpha = front.a + back.a * (1.0 - front.a);\n \n var out = vec4<f32>(0.0,0.0,0.0,0.0);\n\n {MAIN}\n\n return out;\n}";class ts extends Zn{constructor(e){const t=e.gpu,r=rs({source:es,...t}),n=Pn.from({vertex:{source:r,entryPoint:"mainVertex"},fragment:{source:r,entryPoint:"mainFragment"}}),s=e.gl,i=rs({source:Qn,...s});super({gpuProgram:n,glProgram:gn.from({vertex:Jn,fragment:i}),blendRequired:!0,resources:{blendUniforms:new On({uBlend:{value:1,type:"f32"}}),uBackTexture:ee.EMPTY}})}}function rs(e){const{source:t,functions:r,main:n}=e;return t.replace("{FUNCTIONS}",r).replace("{MAIN}",n)}const ns="\n\tfloat getLuminosity(vec3 c) {\n\t\treturn 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;\n\t}\n\n\tvec3 setLuminosity(vec3 c, float lum) {\n\t\tfloat modLum = lum - getLuminosity(c);\n\t\tvec3 color = c.rgb + vec3(modLum);\n\n\t\t// clip back into legal range\n\t\tmodLum = getLuminosity(color);\n\t\tvec3 modLumVec = vec3(modLum);\n\n\t\tfloat cMin = min(color.r, min(color.g, color.b));\n\t\tfloat cMax = max(color.r, max(color.g, color.b));\n\n\t\tif(cMin < 0.0) {\n\t\t\tcolor = mix(modLumVec, color, modLum / (modLum - cMin));\n\t\t}\n\n\t\tif(cMax > 1.0) {\n\t\t\tcolor = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum));\n\t\t}\n\n\t\treturn color;\n\t}\n\n\tfloat getSaturation(vec3 c) {\n\t\treturn max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));\n\t}\n\n\tvec3 setSaturationMinMidMax(vec3 cSorted, float s) {\n\t\tvec3 colorSorted = cSorted;\n\n\t\tif(colorSorted.z > colorSorted.x) {\n\t\t\tcolorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));\n\t\t\tcolorSorted.z = s;\n\t\t}\n\t\telse {\n\t\t\tcolorSorted.y = 0.0;\n\t\t\tcolorSorted.z = 0.0;\n\t\t}\n\n\t\tcolorSorted.x = 0.0;\n\n\t\treturn colorSorted;\n\t}\n\n\tvec3 setSaturation(vec3 c, float s) {\n\t\tvec3 color = c;\n\n\t\tif(color.r <= color.g && color.r <= color.b) {\n\t\t\tif(color.g <= color.b) {\n\t\t\t\tcolor = setSaturationMinMidMax(color.rgb, s).rgb;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcolor = setSaturationMinMidMax(color.rbg, s).rbg;\n\t\t\t}\n\t\t}\n\t\telse if(color.g <= color.r && color.g <= color.b) {\n\t\t\tif(color.r <= color.b) {\n\t\t\t\tcolor = setSaturationMinMidMax(color.grb, s).grb;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcolor = setSaturationMinMidMax(color.gbr, s).gbr;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// Using bgr for both fixes part of hue\n\t\t\tif(color.r <= color.g) {\n\t\t\t\tcolor = setSaturationMinMidMax(color.brg, s).brg;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcolor = setSaturationMinMidMax(color.bgr, s).bgr;\n\t\t\t}\n\t\t}\n\n\t\treturn color;\n\t}\n ",ss="\n\tfn getLuminosity(c: vec3<f32>) -> f32\n\t{\n\t\treturn 0.3*c.r + 0.59*c.g + 0.11*c.b;\n\t}\n\n\tfn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32>\n\t{\n\t\tvar modLum: f32 = lum - getLuminosity(c);\n\t\tvar color: vec3<f32> = c.rgb + modLum;\n\n\t\t// clip back into legal range\n\t\tmodLum = getLuminosity(color);\n\t\tlet modLumVec = vec3<f32>(modLum);\n\n\t\tlet cMin: f32 = min(color.r, min(color.g, color.b));\n\t\tlet cMax: f32 = max(color.r, max(color.g, color.b));\n\n\t\tif(cMin < 0.0)\n\t\t{\n\t\t\tcolor = mix(modLumVec, color, modLum / (modLum - cMin));\n\t\t}\n\n\t\tif(cMax > 1.0)\n\t\t{\n\t\t\tcolor = mix(modLumVec, color, (1 - modLum) / (cMax - modLum));\n\t\t}\n\n\t\treturn color;\n\t}\n\n\tfn getSaturation(c: vec3<f32>) -> f32\n\t{\n\t\treturn max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));\n\t}\n\n\tfn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32>\n\t{\n\t\tvar colorSorted = cSorted;\n\n\t\tif(colorSorted.z > colorSorted.x)\n\t\t{\n\t\t\tcolorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));\n\t\t\tcolorSorted.z = s;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcolorSorted.y = 0;\n\t\t\tcolorSorted.z = 0;\n\t\t}\n\n\t\tcolorSorted.x = 0;\n\n\t\treturn colorSorted;\n\t}\n\n\tfn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32>\n\t{\n\t\tvar color = c;\n\n\t\tif (color.r <= color.g && color.r <= color.b)\n\t\t{\n\t\t\tif (color.g <= color.b)\n\t\t\t{\n\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.rgb, s)).rgb;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.rbg, s)).rbg;\n\t\t\t}\n\t\t}\n\t\telse if (color.g <= color.r && color.g <= color.b)\n\t\t{\n\t\t\tif (color.r <= color.b)\n\t\t\t{\n\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.grb, s)).grb;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.gbr, s)).gbr;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Using bgr for both fixes part of hue\n\t\t\tif (color.r <= color.g)\n\t\t\t{\n\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.brg, s)).brg;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.bgr, s)).bgr;\n\t\t\t}\n\t\t}\n\n\t\treturn color;\n\t}\n\t";class is extends ts{constructor(){super({gl:{functions:`\n ${ns}\n\n vec3 blendColor(vec3 base, vec3 blend, float opacity)\n {\n return (setLuminosity(blend, getLuminosity(base)) * opacity + base * (1.0 - opacity));\n }\n `,main:"\n finalColor = vec4(blendColor(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:`\n ${ss}\n\n fn blendColorOpacity(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n return (setLuminosity(blend, getLuminosity(base)) * opacity + base * (1.0 - opacity));\n }\n `,main:"\n out = vec4<f32>(blendColorOpacity(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}is.extension={name:"color",type:e.BlendMode};class os extends ts{constructor(){super({gl:{functions:"\n float colorBurn(float base, float blend)\n {\n return max((1.0 - ((1.0 - base) / blend)), 0.0);\n }\n\n vec3 blendColorBurn(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n colorBurn(base.r, blend.r),\n colorBurn(base.g, blend.g),\n colorBurn(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendColorBurn(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn colorBurn(base:f32, blend:f32) -> f32\n {\n return max((1.0-((1.0-base)/blend)),0.0);\n }\n\n fn blendColorBurn(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n colorBurn(base.r, blend.r),\n colorBurn(base.g, blend.g),\n colorBurn(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendColorBurn(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}os.extension={name:"color-burn",type:e.BlendMode};class as extends ts{constructor(){super({gl:{functions:"\n float colorDodge(float base, float blend)\n {\n return base / (1.0 - blend);\n }\n\n vec3 blendColorDodge(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n colorDodge(base.r, blend.r),\n colorDodge(base.g, blend.g),\n colorDodge(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendColorDodge(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn colorDodge(base: f32, blend: f32) -> f32\n {\n return base / (1.0 - blend);\n }\n\n fn blendColorDodge(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n colorDodge(base.r, blend.r),\n colorDodge(base.g, blend.g),\n colorDodge(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendColorDodge(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}as.extension={name:"color-dodge",type:e.BlendMode};class ls extends ts{constructor(){super({gl:{functions:"\n vec3 blendDarken(vec3 base, vec3 blend, float opacity)\n {\n return (min(base, blend) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendDarken(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn blendDarken(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n return (min(blend,base) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendDarken(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}ls.extension={name:"darken",type:e.BlendMode};class us extends ts{constructor(){super({gl:{functions:"\n vec3 blendDifference(vec3 base, vec3 blend, float opacity)\n {\n return (abs(blend - base) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendDifference(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn blendDifference(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n return (abs(blend - base) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendDifference(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}us.extension={name:"difference",type:e.BlendMode};class hs extends ts{constructor(){super({gl:{functions:"\n float divide(float base, float blend)\n {\n return (blend > 0.0) ? clamp(base / blend, 0.0, 1.0) : 1.0;\n }\n\n vec3 blendDivide(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n divide(base.r, blend.r),\n divide(base.g, blend.g),\n divide(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendDivide(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn divide(base: f32, blend: f32) -> f32\n {\n return select(1.0, clamp(base / blend, 0.0, 1.0), blend > 0.0);\n }\n\n fn blendDivide(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n divide(base.r, blend.r),\n divide(base.g, blend.g),\n divide(base.b, blend.b)\n );\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendDivide(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}hs.extension={name:"divide",type:e.BlendMode};class cs extends ts{constructor(){super({gl:{functions:"\n vec3 exclusion(vec3 base, vec3 blend)\n {\n return base + blend - 2.0 * base * blend;\n }\n\n vec3 blendExclusion(vec3 base, vec3 blend, float opacity)\n {\n return (exclusion(base, blend) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendExclusion(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn exclusion(base: vec3<f32>, blend: vec3<f32>) -> vec3<f32>\n {\n return base+blend-2.0*base*blend;\n }\n\n fn blendExclusion(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n return (exclusion(base, blend) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendExclusion(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}cs.extension={name:"exclusion",type:e.BlendMode};class ds extends ts{constructor(){super({gl:{functions:"\n float hardLight(float base, float blend)\n {\n return (blend < 0.5) ? 2.0 * base * blend : 1.0 - 2.0 * (1.0 - base) * (1.0 - blend);\n }\n\n vec3 blendHardLight(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n hardLight(base.r, blend.r),\n hardLight(base.g, blend.g),\n hardLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendHardLight(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn hardLight(base: f32, blend: f32) -> f32\n {\n return select(1.0 - 2.0 * (1.0 - base) * (1.0 - blend), 2.0 * base * blend, blend < 0.5);\n }\n\n fn blendHardLight(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n hardLight(base.r, blend.r),\n hardLight(base.g, blend.g),\n hardLight(base.b, blend.b)\n );\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendHardLight(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}ds.extension={name:"hard-light",type:e.BlendMode};class ps extends ts{constructor(){super({gl:{functions:"\n float hardMix(float base, float blend)\n {\n return (base + blend >= 1.0) ? 1.0 : 0.0;\n }\n\n vec3 blendHardMix(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n hardMix(base.r, blend.r),\n hardMix(base.g, blend.g),\n hardMix(base.b, blend.b)\n );\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendHardMix(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn hardMix(base: f32, blend: f32) -> f32\n {\n return select(0.0, 1.0, base + blend >= 1.0);\n }\n\n fn blendHardMix(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended: vec3<f32> = vec3<f32>(\n hardMix(base.r, blend.r),\n hardMix(base.g, blend.g),\n hardMix(base.b, blend.b)\n );\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendHardMix(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}ps.extension={name:"hard-mix",type:e.BlendMode};class fs extends ts{constructor(){super({gl:{functions:"\n vec3 blendLighten(vec3 base, vec3 blend, float opacity)\n {\n return (max(base, blend) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendLighten(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn blendLighten(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n return (max(base, blend) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendLighten(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}fs.extension={name:"lighten",type:e.BlendMode};class ms extends ts{constructor(){super({gl:{functions:"\n float linearBurn(float base, float blend)\n {\n return max(0.0, base + blend - 1.0);\n }\n\n vec3 blendLinearBurn(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n linearBurn(base.r, blend.r),\n linearBurn(base.g, blend.g),\n linearBurn(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendLinearBurn(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn linearBurn(base: f32, blend: f32) -> f32\n {\n return max(0.0, base + blend - 1.0);\n }\n\n fn blendLinearBurn(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n linearBurn(base.r, blend.r),\n linearBurn(base.g, blend.g),\n linearBurn(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendLinearBurn(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}ms.extension={name:"linear-burn",type:e.BlendMode};class gs extends ts{constructor(){super({gl:{functions:"\n float linearDodge(float base, float blend) {\n return min(1.0, base + blend);\n }\n\n vec3 blendLinearDodge(vec3 base, vec3 blend, float opacity) {\n vec3 blended = vec3(\n linearDodge(base.r, blend.r),\n linearDodge(base.g, blend.g),\n linearDodge(base.b, blend.b)\n );\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendLinearDodge(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn linearDodge(base: f32, blend: f32) -> f32\n {\n return min(1, base + blend);\n }\n\n fn blendLinearDodge(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n linearDodge(base.r, blend.r),\n linearDodge(base.g, blend.g),\n linearDodge(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendLinearDodge(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}gs.extension={name:"linear-dodge",type:e.BlendMode};class _s extends ts{constructor(){super({gl:{functions:"\n float linearBurn(float base, float blend) {\n return max(0.0, base + blend - 1.0);\n }\n\n float linearDodge(float base, float blend) {\n return min(1.0, base + blend);\n }\n\n float linearLight(float base, float blend) {\n return (blend <= 0.5) ? linearBurn(base,2.0*blend) : linearBurn(base,2.0*(blend-0.5));\n }\n\n vec3 blendLinearLight(vec3 base, vec3 blend, float opacity) {\n vec3 blended = vec3(\n linearLight(base.r, blend.r),\n linearLight(base.g, blend.g),\n linearLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendLinearLight(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn linearBurn(base: f32, blend: f32) -> f32\n {\n return max(0.0, base + blend - 1.0);\n }\n\n fn linearDodge(base: f32, blend: f32) -> f32\n {\n return min(1.0, base + blend);\n }\n\n fn linearLight(base: f32, blend: f32) -> f32\n {\n return select(linearBurn(base,2.0*(blend-0.5)), linearBurn(base,2.0*blend), blend <= 0.5);\n }\n\n fn blendLinearLightOpacity(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n linearLight(base.r, blend.r),\n linearLight(base.g, blend.g),\n linearLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendLinearLightOpacity(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}_s.extension={name:"linear-light",type:e.BlendMode};class xs extends ts{constructor(){super({gl:{functions:`\n ${ns}\n\n vec3 blendLuminosity(vec3 base, vec3 blend, float opacity)\n {\n vec3 blendLuminosity = setLuminosity(base, getLuminosity(blend));\n return (blendLuminosity * opacity + base * (1.0 - opacity));\n }\n `,main:"\n finalColor = vec4(blendLuminosity(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:`\n ${ss}\n\n fn blendLuminosity(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blendLuminosity: vec3<f32> = setLuminosity(base, getLuminosity(blend));\n return (blendLuminosity * opacity + base * (1.0 - opacity));\n }\n `,main:"\n out = vec4<f32>(blendLuminosity(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}xs.extension={name:"luminosity",type:e.BlendMode};class bs extends ts{constructor(){super({gl:{functions:"\n vec3 negation(vec3 base, vec3 blend)\n {\n return 1.0-abs(1.0-base-blend);\n }\n\n vec3 blendNegation(vec3 base, vec3 blend, float opacity)\n {\n return (negation(base, blend) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendNegation(back.rgb, front.rgb, front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn blendNegation(base: vec3<f32>, blend: vec3<f32>) -> vec3<f32>\n {\n return 1.0-abs(1.0-base-blend);\n }\n\n fn blendNegationOpacity(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n return (blendNegation(base, blend) * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendNegationOpacity(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}bs.extension={name:"negation",type:e.BlendMode};class ys extends ts{constructor(){super({gl:{functions:"\n float overlay(float base, float blend)\n {\n return (base < 0.5) ? (2.0*base*blend) : (1.0-2.0*(1.0-base)*(1.0-blend));\n }\n\n vec3 blendOverlay(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n overlay(base.r, blend.r),\n overlay(base.g, blend.g),\n overlay(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendOverlay(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn overlay(base: f32, blend: f32) -> f32\n {\n return select((1.0-2.0*(1.0-base)*(1.0-blend)), (2.0*base*blend), base < 0.5);\n }\n\n fn blendOverlay(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n overlay(base.r, blend.r),\n overlay(base.g, blend.g),\n overlay(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendOverlay(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}ys.extension={name:"overlay",type:e.BlendMode};class vs extends ts{constructor(){super({gl:{functions:"\n float pinLight(float base, float blend)\n {\n return (blend <= 0.5) ? min(base, 2.0 * blend) : max(base, 2.0 * (blend - 0.5));\n }\n\n vec3 blendPinLight(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n pinLight(base.r, blend.r),\n pinLight(base.g, blend.g),\n pinLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendPinLight(back.rgb, front.rgb, front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn pinLight(base: f32, blend: f32) -> f32\n {\n return select(max(base,2.0*(blend-0.5)), min(base,2.0*blend), blend <= 0.5);\n }\n\n fn blendPinLight(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n pinLight(base.r, blend.r),\n pinLight(base.g, blend.g),\n pinLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendPinLight(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}vs.extension={name:"pin-light",type:e.BlendMode};class Ts extends ts{constructor(){super({gl:{functions:`\n ${ns}\n\n vec3 blendSaturation(vec3 base, vec3 blend, float opacity)\n {\n vec3 blendSaturation = setLuminosity(setSaturation(base, getSaturation(blend)), getLuminosity(base));\n return (blendSaturation * opacity + base * (1.0 - opacity));\n }\n `,main:"\n finalColor = vec4(blendSaturation(back.rgb, front.rgb, front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:`\n ${ss}\n\n fn blendSaturation(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blendSaturation = setLuminosity(setSaturation(base, getSaturation(blend)), getLuminosity(base));\n return (blendSaturation * opacity + base * (1.0 - opacity));\n }\n `,main:"\n out = vec4<f32>(blendSaturation(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}Ts.extension={name:"saturation",type:e.BlendMode};class Ss extends ts{constructor(){super({gl:{functions:"\n float softLight(float base, float blend)\n {\n return (blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend));\n }\n\n vec3 blendSoftLight(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n softLight(base.r, blend.r),\n softLight(base.g, blend.g),\n softLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendSoftLight(back.rgb, front.rgb, front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn softLight(base: f32, blend: f32) -> f32\n {\n return select(2.0 * base * blend + base * base * (1.0 - 2.0 * blend), sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend), blend < 0.5);\n }\n\n fn blendSoftLight(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended: vec3<f32> = vec3<f32>(\n softLight(base.r, blend.r),\n softLight(base.g, blend.g),\n softLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendSoftLight(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}Ss.extension={name:"soft-light",type:e.BlendMode};class ws extends ts{constructor(){super({gl:{functions:"\n float subtract(float base, float blend)\n {\n return max(0.0, base - blend);\n }\n\n vec3 blendSubtract(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n subtract(base.r, blend.r),\n subtract(base.g, blend.g),\n subtract(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendSubtract(back.rgb, front.rgb, front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn subtract(base: f32, blend: f32) -> f32\n {\n return max(0, base - blend);\n }\n\n fn blendSubtract(base:vec3<f32>, blend:vec3<f32>, opacity:f32) -> vec3<f32>\n {\n let blended = vec3<f32>(\n subtract(base.r, blend.r),\n subtract(base.g, blend.g),\n subtract(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendSubtract(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}ws.extension={name:"subtract",type:e.BlendMode};class Es extends ts{constructor(){super({gl:{functions:"\n float colorBurn(float base, float blend)\n {\n return max((1.0-((1.0-base)/blend)),0.0);\n }\n\n float colorDodge(float base, float blend)\n {\n return min(1.0, base / (1.0-blend));\n }\n\n float vividLight(float base, float blend)\n {\n return (blend < 0.5) ? colorBurn(base,(2.0*blend)) : colorDodge(base,(2.0*(blend-0.5)));\n }\n\n vec3 blendVividLight(vec3 base, vec3 blend, float opacity)\n {\n vec3 blended = vec3(\n vividLight(base.r, blend.r),\n vividLight(base.g, blend.g),\n vividLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n finalColor = vec4(blendVividLight(back.rgb, front.rgb,front.a), blendedAlpha) * uBlend;\n "},gpu:{functions:"\n fn colorBurn(base:f32, blend:f32) -> f32\n {\n return max((1.0-((1.0-base)/blend)),0.0);\n }\n\n fn colorDodge(base: f32, blend: f32) -> f32\n {\n return min(1.0, base / (1.0-blend));\n }\n\n fn vividLight(base: f32, blend: f32) -> f32\n {\n return select(colorDodge(base,(2.0*(blend-0.5))), colorBurn(base,(2.0*blend)), blend<0.5);\n }\n\n fn blendVividLight(base: vec3<f32>, blend: vec3<f32>, opacity: f32) -> vec3<f32>\n {\n let blended: vec3<f32> = vec3<f32>(\n vividLight(base.r, blend.r),\n vividLight(base.g, blend.g),\n vividLight(base.b, blend.b)\n );\n\n return (blended * opacity + base * (1.0 - opacity));\n }\n ",main:"\n out = vec4<f32>(blendVividLight(back.rgb, front.rgb, front.a), blendedAlpha) * blendUniforms.uBlend;\n "}})}}Es.extension={name:"vivid-light",type:e.BlendMode};const As=[];async function Rs(e){if(!e)for(let e=0;e<As.length;e++){const t=As[e];if(t.value.test())return void await t.value.load()}}async function Cs(e){return Rs(!e)}let Ms;function Ps(){if("boolean"==typeof Ms)return Ms;try{const e=new Function("param1","param2","param3","return param1[param2] === param3;");Ms=!0===e({a:"b"},"a","b")}catch(e){Ms=!1}return Ms}function Gs(e,t,r=2){const n=t&&t.length,s=n?t[0]*r:e.length;let i=Bs(e,0,s,r,!0);const o=[];if(!i||i.next===i.prev)return o;let a,l,u;if(n&&(i=function(e,t,r,n){const s=[];for(let r=0,i=t.length;r<i;r++){const o=Bs(e,t[r]*n,r<i-1?t[r+1]*n:e.length,n,!1);o===o.next&&(o.steiner=!0),s.push(zs(o))}s.sort(Ls);for(let e=0;e<s.length;e++)r=Ns(s[e],r);return r}(e,t,i,r)),e.length>80*r){a=e[0],l=e[1];let t=a,n=l;for(let i=r;i<s;i+=r){const r=e[i],s=e[i+1];r<a&&(a=r),s<l&&(l=s),r>t&&(t=r),s>n&&(n=s)}u=Math.max(t-a,n-l),u=0!==u?32767/u:0}return Is(i,o,r,a,l,u,0),o}function Bs(e,t,r,n,s){let i;if(s===function(e,t,r,n){let s=0;for(let i=t,o=r-n;i<r;i+=n)s+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return s}(e,t,r,n)>0)for(let s=t;s<r;s+=n)i=ei(s/n|0,e[s],e[s+1],i);else for(let s=r-n;s>=t;s-=n)i=ei(s/n|0,e[s],e[s+1],i);return i&&js(i,i.next)&&(ti(i),i=i.next),i}function Fs(e,t){if(!e)return e;t||(t=e);let r,n=e;do{if(r=!1,n.steiner||!js(n,n.next)&&0!==Ys(n.prev,n,n.next))n=n.next;else{if(ti(n),n=t=n.prev,n===n.next)break;r=!0}}while(r||n!==t);return t}function Is(e,t,r,n,s,i,o){if(!e)return;!o&&i&&function(e,t,r,n){let s=e;do{0===s.z&&(s.z=Hs(s.x,s.y,t,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,function(e){let t,r=1;do{let n,s=e;e=null;let i=null;for(t=0;s;){t++;let o=s,a=0;for(let e=0;e<r&&(a++,o=o.nextZ,o);e++);let l=r;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||s.z<=o.z)?(n=s,s=s.nextZ,a--):(n=o,o=o.nextZ,l--),i?i.nextZ=n:e=n,n.prevZ=i,i=n;s=o}i.nextZ=null,r*=2}while(t>1)}(s)}(e,n,s,i);let a=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(i?Ds(e,n,s,i):Os(e))t.push(l.i,e.i,u.i),ti(e),e=u.next,a=u.next;else if((e=u)===a){o?1===o?Is(e=Us(Fs(e),t),t,r,n,s,i,2):2===o&&ks(e,t,r,n,s,i):Is(Fs(e),t,r,n,s,i,1);break}}}function Os(e){const t=e.prev,r=e,n=e.next;if(Ys(t,r,n)>=0)return!1;const s=t.x,i=r.x,o=n.x,a=t.y,l=r.y,u=n.y,h=Math.min(s,i,o),c=Math.min(a,l,u),d=Math.max(s,i,o),p=Math.max(a,l,u);let f=n.next;for(;f!==t;){if(f.x>=h&&f.x<=d&&f.y>=c&&f.y<=p&&Ws(s,a,i,l,o,u,f.x,f.y)&&Ys(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Ds(e,t,r,n){const s=e.prev,i=e,o=e.next;if(Ys(s,i,o)>=0)return!1;const a=s.x,l=i.x,u=o.x,h=s.y,c=i.y,d=o.y,p=Math.min(a,l,u),f=Math.min(h,c,d),m=Math.max(a,l,u),g=Math.max(h,c,d),_=Hs(p,f,t,r,n),x=Hs(m,g,t,r,n);let b=e.prevZ,y=e.nextZ;for(;b&&b.z>=_&&y&&y.z<=x;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==o&&Ws(a,h,l,c,u,d,b.x,b.y)&&Ys(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==s&&y!==o&&Ws(a,h,l,c,u,d,y.x,y.y)&&Ys(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;b&&b.z>=_;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==o&&Ws(a,h,l,c,u,d,b.x,b.y)&&Ys(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;y&&y.z<=x;){if(y.x>=p&&y.x<=m&&y.y>=f&&y.y<=g&&y!==s&&y!==o&&Ws(a,h,l,c,u,d,y.x,y.y)&&Ys(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Us(e,t){let r=e;do{const n=r.prev,s=r.next.next;!js(n,s)&&qs(n,r,r.next,s)&&Qs(n,s)&&Qs(s,n)&&(t.push(n.i,r.i,s.i),ti(r),ti(r.next),r=e=s),r=r.next}while(r!==e);return Fs(r)}function ks(e,t,r,n,s,i){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&$s(o,e)){let a=Js(o,e);return o=Fs(o,o.next),a=Fs(a,a.next),Is(o,t,r,n,s,i,0),void Is(a,t,r,n,s,i,0)}e=e.next}o=o.next}while(o!==e)}function Ls(e,t){let r=e.x-t.x;if(0===r&&(r=e.y-t.y,0===r)){r=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}return r}function Ns(e,t){const r=function(e,t){let r=t;const n=e.x,s=e.y;let i,o=-1/0;if(js(e,r))return r;do{if(js(e,r.next))return r.next;if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){const e=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=n&&e>o&&(o=e,i=r.x<r.next.x?r:r.next,e===n))return i}r=r.next}while(r!==t);if(!i)return null;const a=i,l=i.x,u=i.y;let h=1/0;r=i;do{if(n>=r.x&&r.x>=l&&n!==r.x&&Vs(s<u?n:o,s,l,u,s<u?o:n,s,r.x,r.y)){const t=Math.abs(s-r.y)/(n-r.x);Qs(r,e)&&(t<h||t===h&&(r.x>i.x||r.x===i.x&&Xs(i,r)))&&(i=r,h=t)}r=r.next}while(r!==a);return i}(e,t);if(!r)return t;const n=Js(r,e);return Fs(n,n.next),Fs(r,r.next)}function Xs(e,t){return Ys(e.prev,e,t.prev)<0&&Ys(t.next,e,e.next)<0}function Hs(e,t,r,n,s){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function zs(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Vs(e,t,r,n,s,i,o,a){return(s-o)*(t-a)>=(e-o)*(i-a)&&(e-o)*(n-a)>=(r-o)*(t-a)&&(r-o)*(i-a)>=(s-o)*(n-a)}function Ws(e,t,r,n,s,i,o,a){return!(e===o&&t===a)&&Vs(e,t,r,n,s,i,o,a)}function $s(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&qs(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(Qs(e,t)&&Qs(t,e)&&function(e,t){let r=e,n=!1;const s=(e.x+t.x)/2,i=(e.y+t.y)/2;do{r.y>i!=r.next.y>i&&r.next.y!==r.y&&s<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)&&(Ys(e.prev,e,t.prev)||Ys(e,t.prev,t))||js(e,t)&&Ys(e.prev,e,e.next)>0&&Ys(t.prev,t,t.next)>0)}function Ys(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function js(e,t){return e.x===t.x&&e.y===t.y}function qs(e,t,r,n){const s=Zs(Ys(e,t,r)),i=Zs(Ys(e,t,n)),o=Zs(Ys(r,n,e)),a=Zs(Ys(r,n,t));return s!==i&&o!==a||(!(0!==s||!Ks(e,r,t))||(!(0!==i||!Ks(e,n,t))||(!(0!==o||!Ks(r,e,n))||!(0!==a||!Ks(r,t,n)))))}function Ks(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Zs(e){return e>0?1:e<0?-1:0}function Qs(e,t){return Ys(e.prev,e,e.next)<0?Ys(e,t,e.next)>=0&&Ys(e,e.prev,t)>=0:Ys(e,t,e.prev)<0||Ys(e,e.next,t)<0}function Js(e,t){const r=ri(e.i,e.x,e.y),n=ri(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function ei(e,t,r,n){const s=ri(e,t,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function ti(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ri(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}n.handleByNamedList(e.Environment,As);const ni=Gs.default||Gs;var si=(e=>(e[e.NONE=0]="NONE",e[e.COLOR=16384]="COLOR",e[e.STENCIL=1024]="STENCIL",e[e.DEPTH=256]="DEPTH",e[e.COLOR_DEPTH=16640]="COLOR_DEPTH",e[e.COLOR_STENCIL=17408]="COLOR_STENCIL",e[e.DEPTH_STENCIL=1280]="DEPTH_STENCIL",e[e.ALL=17664]="ALL",e))(si||{});class ii{constructor(e){this.items=[],this._name=e}emit(e,t,r,n,s,i,o,a){const{name:l,items:u}=this;for(let h=0,c=u.length;h<c;h++)u[h][l](e,t,r,n,s,i,o,a);return this}add(e){return e[this._name]&&(this.remove(e),this.items.push(e)),this}remove(e){const t=this.items.indexOf(e);return-1!==t&&this.items.splice(t,1),this}contains(e){return-1!==this.items.indexOf(e)}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}const oi=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],ai=class e extends c{constructor(e){super(),this.tick=0,this.uid=G("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=e.type,this.name=e.name,this.config=e;const t=[...oi,...this.config.runners??[]];this._addRunners(...t),this._unsafeEvalCheck()}async init(t={}){const r=!0===t.skipExtensionImports||!1===t.manageImports;await Rs(r),!r&&this.config.loaders&&await Promise.all(this.config.loaders.map(e=>e.value.load())),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const e in this._systemsHash){t={...this._systemsHash[e].constructor.defaultOptions,...t}}t={...e.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let e=0;e<this.runners.init.items.length;e++)await this.runners.init.items[e].init(t);this._initOptions=t}render(e,t){this.tick++;let r=e;if(r instanceof Ot&&(r={container:r},t&&(L(I,"passing a second argument is deprecated, please use render options instead"),r.target=t.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){const e=Array.isArray(r.clearColor)&&4===r.clearColor.length;r.clearColor=e?r.clearColor:Be.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.visible&&(r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r))}resize(e,t,r){const n=this.view.resolution;this.view.resize(e,t,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),void 0!==r&&r!==n&&this.runners.resolutionChange.emit(r)}clear(e={}){e.target||(e.target=this.renderTarget.renderTarget),e.clearColor||(e.clearColor=this.background.colorRgba),e.clear??(e.clear=si.ALL);const{clear:t,clearColor:r,target:n,mipLevel:s,layer:i}=e;Be.shared.setValue(r??this.background.colorRgba),this.renderTarget.clear(n,t,Be.shared.toArray(),s??0,i??0)}get resolution(){return this.view.resolution}set resolution(e){this.view.resolution=e,this.runners.resolutionChange.emit(e)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...e){e.forEach(e=>{this.runners[e]=new ii(e)})}_addSystems(e){let t;for(t in e){const r=e[t];this._addSystem(r.value,r.name)}}_addSystem(e,t){const r=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=r,this._systemsHash[t]=r;for(const e in this.runners)this.runners[e].add(r);return this}_addPipes(e,t){const r=t.reduce((e,t)=>(e[t.name]=t.value,e),{});e.forEach(e=>{const t=e.value,n=e.name,s=r[n];this.renderPipes[n]=new t(this,s?new s:null),this.runners.destroy.add(this.renderPipes[n])})}destroy(e=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(e),(!0===e||"object"==typeof e&&e.releaseGlobalResources)&&De.release(),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(e){return this.textureGenerator.generateTexture(e)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Ps())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};ai.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let li,ui,hi=ai;function ci(e){return void 0!==li||(li=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:e??hi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Yt.get().getWebGLRenderingContext())return!1;let e=Yt.get().createCanvas().getContext("webgl",t);const r=!!e?.getContextAttributes()?.stencil;if(e){const t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}return e=null,r}catch(e){return!1}})()),li}async function di(e={}){return void 0!==ui||(ui=await(async()=>{const t=Yt.get().getNavigator().gpu;if(!t)return!1;try{const r=await t.requestAdapter(e);return await r.requestDevice(),!0}catch(e){return!1}})()),ui}const pi=["webgl","webgpu","canvas"];async function fi(e){let t,r=[];e.preference?Array.isArray(e.preference)?r=e.preference.slice():(r.push(e.preference),pi.forEach(t=>{t!==e.preference&&r.push(t)})):r=pi.slice();let n={};for(let s=0;s<r.length;s++){const i=r[s];if("webgpu"===i&&await di()){const{WebGPURenderer:r}=await Promise.resolve().then(function(){return wy});t=r,n={...e,...e.webgpu};break}if("webgl"===i&&ci(e.failIfMajorPerformanceCaveat??hi.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:r}=await Promise.resolve().then(function(){return db});t=r,n={...e,...e.webgl};break}if("canvas"===i){const{CanvasRenderer:r}=await Promise.resolve().then(function(){return h_});t=r,n={...e,...e.canvasOptions};break}}if(delete n.webgpu,delete n.webgl,delete n.canvasOptions,!t)throw new Error("No available renderer for the current environment");const s=new t;return await s.init(n),s}const mi=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,gi="8.22.0";class _i{static init(){globalThis.__PIXI_APP_INIT__?.(this,gi)}static destroy(){}}_i.extension=e.Application;class xi{constructor(e){this._renderer=e}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,gi)}destroy(){this._renderer=null}}xi.extension={type:[e.WebGLSystem,e.WebGPUSystem],name:"initHook",priority:-10};class bi{static init(e){Object.defineProperty(this,"resizeTo",{configurable:!0,set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let e,t;if(this._cancelResize(),this._resizeTo===globalThis.window)e=globalThis.innerWidth,t=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,t=n}this.renderer.resize(e,t),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}bi.extension=e.Application;class yi{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Kt.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?er.shared:new er,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}yi.extension=e.Application,n.add(bi),n.add(yi);const vi=class e{constructor(...e){this.stage=new Ot,void 0!==e[0]&&L(I,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new Ot),this.renderer=await fi(t),e._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return L(I,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){return this.renderer.renderPipes.dom?._domElement}destroy(t=!1,r=!1){const n=e._plugins.slice(0);n.reverse(),n.forEach(e=>{e.destroy.call(this)}),this.stage.destroy(r),this.stage=null,this.renderer.destroy(t),this.renderer=null}};vi._plugins=[];let Ti=vi;n.handleByList(e.Application,Ti._plugins),n.add(_i);const Si={test:e=>"string"==typeof e&&e.startsWith("info face="),parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const e in t){const n=t[e].match(/^[a-z]+/gm)[0],s=t[e].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),i={};for(const e in s){const t=s[e].split("="),r=t[0],n=t[1].replace(/"/gm,""),o=parseFloat(n),a=isNaN(o)?n:o;i[r]=a}r[n].push(i)}const n={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=r.info,[i]=r.common,[o]=r.distanceField??[];o&&(n.distanceField={range:parseInt(o.distanceRange,10),type:o.fieldType}),n.fontSize=parseInt(s.size,10),n.fontFamily=s.face,n.lineHeight=parseInt(i.lineHeight,10);const a=r.page;for(let e=0;e<a.length;e++)n.pages.push({id:parseInt(a[e].id,10)||0,file:a[e].file});const l={};n.baseLineOffset=void 0===i.base?0:n.lineHeight-parseInt(i.base,10);const u=r.char;for(let e=0;e<u.length;e++){const t=u[e],r=parseInt(t.id,10);let s=t.letter??t.char??String.fromCharCode(r);"space"===s&&(s=" "),l[r]=s,n.chars[s]={id:r,page:parseInt(t.page,10)||0,x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xOffset:parseInt(t.xoffset,10),yOffset:parseInt(t.yoffset,10),xAdvance:parseInt(t.xadvance,10),kerning:{}}}const h=r.kerning||[];for(let e=0;e<h.length;e++){const t=parseInt(h[e].first,10),r=parseInt(h[e].second,10),s=parseInt(h[e].amount,10);n.chars[l[r]]&&(n.chars[l[r]].kerning[l[t]]=s)}return n}},wi={test(e){const t=e;return"string"!=typeof t&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")},parse(e){const t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},r=e.getElementsByTagName("info")[0],n=e.getElementsByTagName("common")[0],s=e.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});const i=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning");t.fontSize=parseInt(r.getAttribute("size"),10),t.fontFamily=r.getAttribute("face"),t.lineHeight=parseInt(n.getAttribute("lineHeight"),10);for(let e=0;e<i.length;e++)t.pages.push({id:parseInt(i[e].getAttribute("id"),10)||0,file:i[e].getAttribute("file")});const l={},u=n.getAttribute("base");t.baseLineOffset=null===u?0:t.lineHeight-parseInt(u,10);for(let e=0;e<o.length;e++){const r=o[e],n=parseInt(r.getAttribute("id"),10);let s=r.getAttribute("letter")??r.getAttribute("char")??String.fromCharCode(n);"space"===s&&(s=" "),l[n]=s,t.chars[s]={id:n,page:parseInt(r.getAttribute("page"),10)||0,x:parseInt(r.getAttribute("x"),10),y:parseInt(r.getAttribute("y"),10),width:parseInt(r.getAttribute("width"),10),height:parseInt(r.getAttribute("height"),10),xOffset:parseInt(r.getAttribute("xoffset"),10),yOffset:parseInt(r.getAttribute("yoffset"),10),xAdvance:parseInt(r.getAttribute("xadvance"),10),kerning:{}}}for(let e=0;e<a.length;e++){const r=parseInt(a[e].getAttribute("first"),10),n=parseInt(a[e].getAttribute("second"),10),s=parseInt(a[e].getAttribute("amount"),10);t.chars[l[n]]&&(t.chars[l[n]].kerning[l[r]]=s)}return t}},Ei={test:e=>!("string"!=typeof e||!e.match(/<font(\s|>)/))&&wi.test(Yt.get().parseXML(e)),parse:e=>wi.parse(Yt.get().parseXML(e))},Ai=[".xml",".fnt"],Ri={extension:{type:e.CacheParser,name:"cacheBitmapFont"},test:e=>!!e?.pages&&!!e?.chars&&"string"==typeof e?.fontFamily&&""!==e.fontFamily,getCacheableAssets(e,t){const r={};return e.forEach(e=>{r[e]=t,r[`${e}-bitmap`]=t}),r[`${t.fontFamily}-bitmap`]=t,r}},Ci={extension:{type:e.LoadParser,priority:cr.Normal},name:"loadBitmapFont",id:"bitmap-font",test:e=>Ai.includes(fr.extname(e).toLowerCase()),testParse:async e=>Si.test(e)||Ei.test(e),async parse(e,t,r){const n=Si.test(e)?Si.parse(e):Ei.parse(e),{src:s}=t,{pages:i}=n,o=[],a=n.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let e=0;e<i.length;++e){const t=i[e].file;let r=fr.join(fr.dirname(s),t);r=yr(r,s),o.push({src:r,data:a})}const[l,{BitmapFont:u}]=await Promise.all([r.load(o),Promise.resolve().then(function(){return pT})]);return new u({data:n,textures:o.map(e=>l[e.src])},s)},async load(e,t){const r=await Yt.get().fetch(e);return await r.text()},async unload(e,t,r){await Promise.all(e.pages.map(e=>r.unload(e.texture.source._sourceOrigin))),e.destroy()}};class Mi{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<t;r++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}}const Pi={extension:{type:e.CacheParser,name:"cacheTextureArray"},test:e=>Array.isArray(e)&&e.every(e=>e instanceof ee),getCacheableAssets:(e,t)=>{const r={};return e.forEach(e=>{t.forEach((t,n)=>{r[e+(0===n?"":n+1)]=t})}),r}};async function Gi(e){if("Image"in globalThis)return new Promise(t=>{const r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(e)).blob();await createImageBitmap(t)}catch(e){return!1}return!0}return!1}const Bi={extension:{type:e.DetectionParser,priority:1},test:async()=>Gi("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async e=>[...e,"avif"],remove:async e=>e.filter(e=>"avif"!==e)},Fi=["png","jpg","jpeg"],Ii={extension:{type:e.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async e=>[...e,...Fi],remove:async e=>e.filter(e=>!Fi.includes(e))},Oi="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Di(e){if(Oi)return!1;return""!==document.createElement("video").canPlayType(e)}const Ui={extension:{type:e.DetectionParser,priority:0},test:async()=>Di("video/mp4"),add:async e=>[...e,"mp4","m4v"],remove:async e=>e.filter(e=>"mp4"!==e&&"m4v"!==e)},ki={extension:{type:e.DetectionParser,priority:0},test:async()=>Di("video/ogg"),add:async e=>[...e,"ogv"],remove:async e=>e.filter(e=>"ogv"!==e)},Li={extension:{type:e.DetectionParser,priority:0},test:async()=>Di("video/webm"),add:async e=>[...e,"webm"],remove:async e=>e.filter(e=>"webm"!==e)},Ni={extension:{type:e.DetectionParser,priority:0},test:async()=>Gi("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async e=>[...e,"webp"],remove:async e=>e.filter(e=>"webp"!==e)},Xi=class e{constructor(){this.loadOptions={...e.defaultOptions},this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,r)=>(this._parsersValidated=!1,e[t]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const r={promise:null,parser:null};return r.promise=(async()=>{let n=null,s=null;if((t.parser||t.loadParser)&&(s=this._parserHash[t.parser||t.loadParser],t.loadParser&&Oe(`[Assets] "loadParser" is deprecated, use "parser" instead for ${e}`),s||Oe(`[Assets] specified load parser "${t.parser||t.loadParser}" not found while loading ${e}`)),!s){for(let r=0;r<this.parsers.length;r++){const n=this.parsers[r];if(n.load&&n.test?.(e,t,this)){s=n;break}}if(!s)return Oe(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}n=await s.load(e,t,this),r.parser=s;for(let e=0;e<this.parsers.length;e++){const s=this.parsers[e];s.parse&&s.parse&&await(s.testParse?.(n,t,this))&&(n=await s.parse(n,t,this)||n,r.parser=s)}return n})(),r}async load(t,r){this._parsersValidated||this._validateParsers();const n="function"==typeof r?{...e.defaultOptions,...this.loadOptions,onProgress:r}:{...e.defaultOptions,...this.loadOptions,...r||{}},{onProgress:s,onError:i,strategy:o,retryCount:a,retryDelay:l}=n;let u=0;const h={},c=_r(t),d=sr(t,e=>({alias:[e],src:e,data:{}})),p=d.reduce((e,t)=>e+(t.progressSize||1),0),f=d.map(async e=>{const t=fr.toAbsolute(e.src);h[e.src]||(await this._loadAssetWithRetry(t,e,{onProgress:s,onError:i,strategy:o,retryCount:a,retryDelay:l},h),u+=e.progressSize||1,s&&s(u/p))});return await Promise.all(f),c?h[d[0].src]:h}async unload(e){const t=sr(e,e=>({alias:[e],src:e})).map(async e=>{const t=fr.toAbsolute(e.src),r=this.promiseCache[t];if(r){const n=await r.promise;delete this.promiseCache[t],await(r.parser?.unload?.(n,e,this))}});await Promise.all(t)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name||e.id).reduce((e,t)=>(t.name||t.id?(e[t.name]||e[t.id])&&Oe(`[Assets] parser id conflict "${t.id}"`):Oe("[Assets] parser should have an id"),e[t.name]=t,t.id&&(e[t.id]=t),e),{})}async _loadAssetWithRetry(e,t,r,n){let s=0;const{onError:i,strategy:o,retryCount:a,retryDelay:l}=r,u=e=>new Promise(t=>setTimeout(t,e));for(;;)try{return this.promiseCache[e]||(this.promiseCache[e]=this._getLoadPromiseAndParser(e,t)),void(n[t.src]=await this.promiseCache[e].promise)}catch(r){delete this.promiseCache[e],delete n[t.src],s++;if("retry"===o&&!("retry"!==o||s>a)){i&&i(r,t),await u(l);continue}if("skip"===o)return void(i&&i(r,t));i&&i(r,t);const h=new Error(`[Loader.load] Failed to load ${e}.\n${r}`);throw r instanceof Error&&r.stack&&(h.stack=r.stack),h}}};Xi.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};let Hi=Xi;function zi(e,t){if(Array.isArray(t)){for(const r of t)if(e.startsWith(`data:${r}`))return!0;return!1}return e.startsWith(`data:${t}`)}function Vi(e,t){const r=e.split("?")[0],n=fr.extname(r).toLowerCase();return Array.isArray(t)?t.includes(n):n===t}const Wi={extension:{type:e.LoadParser,priority:cr.Low},name:"loadJson",id:"json",test:e=>zi(e,"application/json")||Vi(e,".json"),async load(e){const t=await Yt.get().fetch(e);return await t.json()}},$i={name:"loadTxt",id:"text",extension:{type:e.LoadParser,priority:cr.Low,name:"loadTxt"},test:e=>zi(e,"text/plain")||Vi(e,".txt"),async load(e){const t=await Yt.get().fetch(e);return await t.text()}},Yi=["normal","bold","100","200","300","400","500","600","700","800","900"],ji=[".ttf",".otf",".woff",".woff2"],qi=["font/ttf","font/otf","font/woff","font/woff2"],Ki=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Zi(e){const t=fr.extname(e),r=fr.basename(e,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1));let n=r.length>0;for(const e of r)if(!e.match(Ki)){n=!1;break}let s=r.join(" ");return n||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const Qi=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Ji(e){return Qi.test(e)?e:encodeURI(e)}const eo={extension:{type:e.LoadParser,priority:cr.Low},name:"loadWebFont",id:"web-font",test:e=>zi(e,qi)||Vi(e,ji),async load(e,t){const r=Yt.get().getFontFaceSet();if(r){const n=[],s=t.data?.family??Zi(e),i=t.data?.weights?.filter(e=>Yi.includes(e))??["normal"],o=t.data??{};for(let t=0;t<i.length;t++){const a=i[t],l=new FontFace(s,`url('${Ji(e)}')`,{...o,weight:a});await l.load(),r.add(l),n.push(l)}if(ir.has(`${s}-and-url`)){ir.get(`${s}-and-url`).entries.push({url:e,faces:n})}else ir.set(`${s}-and-url`,{entries:[{url:e,faces:n}]});return 1===n.length?n[0]:n}return Oe("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(e){const t=Array.isArray(e)?e:[e],r=t[0].family,n=ir.get(`${r}-and-url`),s=n.entries.find(e=>e.faces.some(e=>-1!==t.indexOf(e)));s.faces=s.faces.filter(e=>-1===t.indexOf(e)),0===s.faces.length&&(n.entries=n.entries.filter(e=>e!==s)),t.forEach(e=>{Yt.get().getFontFaceSet().delete(e)}),0===n.entries.length&&ir.remove(`${r}-and-url`)}},to={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},ro=/([astvzqmhlc])([^astvzqmhlc]*)/gi,no=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function so(e){const t=[];return e.replace(ro,(e,r,n)=>{let s=r.toLowerCase(),i=r;const o=function(e){const t=e.match(no);return t?t.map(Number):[]}(n);for("m"===s&&o.length>2&&(t.push([i,...o.splice(0,2)]),s="l",i="m"===i?"l":"L");;){if(o.length===to[s])return t.push([i,...o]),"";if(o.length<to[s])throw new Error("malformed path data");t.push([i,...o.splice(0,to[s])])}}),t}function io(e,t){const r=so(e),n=[];let s=null,i=0,o=0;for(let e=0;e<r.length;e++){const a=r[e],l=a[0],u=a;switch(l){case"M":i=u[1],o=u[2],t.moveTo(i,o);break;case"m":i+=u[1],o+=u[2],t.moveTo(i,o);break;case"H":i=u[1],t.lineTo(i,o);break;case"h":i+=u[1],t.lineTo(i,o);break;case"V":o=u[1],t.lineTo(i,o);break;case"v":o+=u[1],t.lineTo(i,o);break;case"L":i=u[1],o=u[2],t.lineTo(i,o);break;case"l":i+=u[1],o+=u[2],t.lineTo(i,o);break;case"C":i=u[5],o=u[6],t.bezierCurveTo(u[1],u[2],u[3],u[4],i,o);break;case"c":t.bezierCurveTo(i+u[1],o+u[2],i+u[3],o+u[4],i+u[5],o+u[6]),i+=u[5],o+=u[6];break;case"S":i=u[3],o=u[4],t.bezierCurveToShort(u[1],u[2],i,o);break;case"s":t.bezierCurveToShort(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"Q":i=u[3],o=u[4],t.quadraticCurveTo(u[1],u[2],i,o);break;case"q":t.quadraticCurveTo(i+u[1],o+u[2],i+u[3],o+u[4]),i+=u[3],o+=u[4];break;case"T":i=u[1],o=u[2],t.quadraticCurveToShort(i,o);break;case"t":i+=u[1],o+=u[2],t.quadraticCurveToShort(i,o);break;case"A":i=u[6],o=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"a":i+=u[6],o+=u[7],t.arcToSvg(u[1],u[2],u[3],u[4],u[5],i,o);break;case"Z":case"z":t.closePath(),n.length>0&&(s=n.pop(),s?(i=s.startX,o=s.startY):(i=0,o=0)),s=null;break;default:Oe(`Unknown SVG path command: ${l}`)}"Z"!==l&&"z"!==l&&null===s&&(s={startX:i,startY:o},n.push(s))}return t}class oo{constructor(e=0,t=0,r=0){this.type="circle",this.x=e,this.y=t,this.radius=r}clone(){return new oo(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const r=this.radius*this.radius;let n=this.x-e,s=this.y-t;return n*=n,s*=s,n+s<=r}strokeContains(e,t,r,n=.5){if(0===this.radius)return!1;const s=this.x-e,i=this.y-t,o=this.radius,a=(1-n)*r,l=Math.sqrt(s*s+i*i);return l<=o+a&&l>o-(r-a)}getBounds(e){return e||(e=new M),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=2*this.radius,e.height=2*this.radius,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class ao{constructor(e=0,t=0,r=0,n=0){this.type="ellipse",this.x=e,this.y=t,this.halfWidth=r,this.halfHeight=n}clone(){return new ao(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(e-this.x)/this.halfWidth,n=(t-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(e,t,r,n=.5){const{halfWidth:s,halfHeight:i}=this;if(s<=0||i<=0)return!1;const o=r*(1-n),a=r-o,l=s-a,u=i-a,h=s+o,c=i+o,d=e-this.x,p=t-this.y;if(d*d/(h*h)+p*p/(c*c)>1)return!1;if(l<=0||u<=0)return!0;return d*d/(l*l)+p*p/(u*u)>1}getBounds(e){return e||(e=new M),e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=2*this.halfWidth,e.height=2*this.halfHeight,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function lo(e){const t=e.length;if(t<6)return 1;let r=0;for(let n=0,s=e[t-2],i=e[t-1];n<t;n+=2){const t=e[n],o=e[n+1];r+=(t-s)*(o+i),s=t,i=o}return r<0?-1:1}function uo(e,t,r,n,s,i){const o=s-r,a=i-n,l=o*o+a*a;let u,h,c=-1;0!==l&&(c=((e-r)*o+(t-n)*a)/l),c<0?(u=r,h=n):c>1?(u=s,h=i):(u=r+c*o,h=n+c*a);const d=e-u,p=t-h;return d*d+p*p}class ho{constructor(...e){this.type="polygon";let t=Array.isArray(e[0])?e[0]:e;if("number"!=typeof t[0]){const e=[];for(let r=0,n=t.length;r<n;r++)e.push(t[r].x,t[r].y);t=e}this.points=t,this.closePath=!0}isClockwise(){let e=0;const t=this.points,r=t.length;for(let n=0;n<r;n+=2){const s=t[n],i=t[n+1];e+=(t[(n+2)%r]-s)*(t[(n+3)%r]+i)}return e<0}containsPolygon(e){const t=this.getBounds(void 0),r=e.getBounds(void 0);if(!t.containsRect(r))return!1;const n=e.points;for(let e=0;e<n.length;e+=2){const t=n[e],r=n[e+1];if(!this.contains(t,r))return!1}return!0}clone(){const e=this.points.slice(),t=new ho(e);return t.closePath=this.closePath,t}contains(e,t){let r=!1;const n=this.points.length/2;for(let s=0,i=n-1;s<n;i=s++){const n=this.points[2*s],o=this.points[2*s+1],a=this.points[2*i],l=this.points[2*i+1];o>t!=l>t&&e<(t-o)/(l-o)*(a-n)+n&&(r=!r)}return r}strokeContains(e,t,r,n=.5){const{points:s}=this,i=r*(.5===n?n:(n-.5)*lo(s)+.5),o=r-i,a=i*i,l=o*o,u=s.length-(this.closePath?0:2);for(let r=0;r<u;r+=2){const n=s[r],i=s[r+1],o=s[(r+2)%s.length],u=s[(r+3)%s.length];if(uo(e,t,n,i,o,u)<=(Math.sign((o-n)*(t-i)-(u-i)*(e-n))<0?a:l))return!0}return!1}getBounds(e){e||(e=new M);const t=this.points;let r=1/0,n=-1/0,s=1/0,i=-1/0;for(let e=0,o=t.length;e<o;e+=2){const o=t[e],a=t[e+1];r=o<r?o:r,n=o>n?o:n,s=a<s?a:s,i=a>i?a:i}return e.x=r,e.width=n-r,e.y=s,e.height=i-s,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,t)=>`${e}, ${t}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return L("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return L("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const co=(e,t,r,n,s,i,o)=>{const a=e-r,l=t-n,u=Math.sqrt(a*a+l*l);return u>=s-i&&u<=s+o};class po{constructor(e=0,t=0,r=0,n=0,s=20){this.type="roundedRectangle",this.x=e,this.y=t,this.width=r,this.height=n,this.radius=s}getBounds(e){return e||(e=new M),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new po(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){const r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+r&&t<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let n=e-(this.x+r),s=t-(this.y+r);const i=r*r;if(n*n+s*s<=i)return!0;if(n=e-(this.x+this.width-r),n*n+s*s<=i)return!0;if(s=t-(this.y+this.height-r),n*n+s*s<=i)return!0;if(n=e-(this.x+r),n*n+s*s<=i)return!0}return!1}strokeContains(e,t,r,n=.5){const{x:s,y:i,width:o,height:a,radius:l}=this,u=r*(1-n),h=r-u,c=s+l,d=i+l,p=s+o,f=i+a;return(e>=s-u&&e<=s+h||e>=p-h&&e<=p+u)&&t>=d&&t<=d+(a-2*l)||((t>=i-u&&t<=i+h||t>=f-h&&t<=f+u)&&e>=c&&e<=c+(o-2*l)||(e<c&&t<d&&co(e,t,c,d,l,h,u)||e>p-l&&t<d&&co(e,t,p-l,d,l,h,u)||e>p-l&&t>f-l&&co(e,t,p-l,f-l,l,h,u)||e<c&&t>f-l&&co(e,t,c,f-l,l,h,u)))}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const fo={};function mo(e,t,r){let n=2166136261;for(let r=0;r<t;r++)n^=e[r].uid,n=Math.imul(n,16777619),n>>>=0;return fo[n]||function(e,t,r,n){const s={};let i=0;for(let r=0;r<n;r++){const n=r<t?e[r]:ee.EMPTY.source;s[i++]=n.source,s[i++]=n.style}const o=new Dn(s);return fo[r]=o,o}(e,t,n,r)}class go{constructor(e){"number"==typeof e?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}function _o(e,t,r,n){if(r??(r=0),n??(n=Math.min(e.byteLength-r,t.byteLength)),7&r||7&n)if(3&r||3&n)new Uint8Array(t).set(new Uint8Array(e,r,n));else{const s=n/4;new Float32Array(t,0,s).set(new Float32Array(e,r,s))}else{const s=n/8;new Float64Array(t,0,s).set(new Float64Array(e,r,s))}}const xo={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var bo=(e=>(e[e.DISABLED=0]="DISABLED",e[e.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",e[e.MASK_ACTIVE=2]="MASK_ACTIVE",e[e.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",e[e.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",e[e.NONE=5]="NONE",e))(bo||{});function yo(e,t){return"no-premultiply-alpha"===t.alphaMode&&xo[e]||e}const vo=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function To(e){let t="";for(let r=0;r<e;++r)r>0&&(t+="\nelse "),r<e-1&&(t+=`if(test == ${r}.0){}`);return t}function So(e,t){if(0===e)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const r=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const n=vo.replace(/%forloop%/gi,To(e));if(t.shaderSource(r,n),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS))break;e=e/2|0}}finally{t.deleteShader(r)}return e}let wo=null;function Eo(){if(wo)return wo;const e=en();return wo=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),wo=So(wo,e),e.getExtension("WEBGL_lose_context")?.loseContext(),wo}class Ao{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let e=0;e<this.count;e++){const t=this.textures[e];this.textures[e]=null,this.ids[t.uid]=null}this.count=0}}class Ro{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ao,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const Co=[];let Mo=0;function Po(){return Mo>0?Co[--Mo]:new Ro}function Go(e){e.elements=null,Co[Mo++]=e}De.register({clear:()=>{if(Co.length>0)for(const e of Co)e&&e.destroy();Co.length=0,Mo=0}});let Bo=0;const Fo=class e{constructor(t){this.uid=G("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],(t={...e.defaultOptions,...t}).maxTextures||(L("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Eo());const{maxTextures:r,attributesInitialSize:n,indicesInitialSize:s}=t;this.attributeBuffer=new go(4*n),this.indexBuffer=new Uint16Array(s),this.maxTextures=r}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let e=0;e<this.batchIndex;e++)Go(this.batches[e]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(e){this._elements[this.elementSize++]=e,e._indexStart=this.indexSize,e._attributeStart=this.attributeSize,e._batcher=this,this.indexSize+=e.indexSize,this.attributeSize+=e.attributeSize*this.vertexSize}checkAndUpdateTexture(e,t){const r=e._batch.textures.ids[t._source.uid];return!(!r&&0!==r)&&(e._textureId=r,e.texture=t,!0)}updateElement(e){this.dirty=!0;const t=this.attributeBuffer;e.packAsQuad?this.packQuadAttributes(e,t.float32View,t.uint32View,e._attributeStart,e._textureId):this.packAttributes(e,t.float32View,t.uint32View,e._attributeStart,e._textureId)}break(e){const t=this._elements;if(!t[this.elementStart])return;let r=Po(),n=r.textures;n.clear();const s=t[this.elementStart];let i=yo(s.blendMode,s.texture._source),o=s.topology;4*this.attributeSize>this.attributeBuffer.size&&this._resizeAttributeBuffer(4*this.attributeSize),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,u=this.indexBuffer;let h=this._batchIndexSize,c=this._batchIndexStart,d="startBatch",p=[];const f=this.maxTextures;for(let s=this.elementStart;s<this.elementSize;++s){const m=t[s];t[s]=null;const g=m.texture._source,_=yo(m.blendMode,g),x=i!==_||o!==m.topology;g._batchTick!==Bo||x?(g._batchTick=Bo,(n.count>=f||x)&&(this._finishBatch(r,c,h-c,n,i,o,e,d,p),d="renderBatch",c=h,i=_,o=m.topology,r=Po(),n=r.textures,n.clear(),p=[],++Bo),m._textureId=g._textureBindLocation=n.count,n.ids[g.uid]=n.count,n.textures[n.count++]=g,m._batch=r,p.push(m),h+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,a,l,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,a,l,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize))):(m._textureId=g._textureBindLocation,h+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,a,l,m._attributeStart,m._textureId),this.packQuadIndex(u,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,a,l,m._attributeStart,m._textureId),this.packIndex(m,u,m._indexStart,m._attributeStart/this.vertexSize)),m._batch=r,p.push(m))}n.count>0&&(this._finishBatch(r,c,h-c,n,i,o,e,d,p),c=h,++Bo),this.elementStart=this.elementSize,this._batchIndexStart=c,this._batchIndexSize=h}_finishBatch(e,t,r,n,s,i,o,a,l){e.gpuBindGroup=null,e.bindGroup=null,e.action=a,e.batcher=this,e.textures=n,e.blendMode=s,e.topology=i,e.start=t,e.size=r,e.elements=l,++Bo,this.batches[this.batchIndex++]=e,o.add(e)}finish(e){this.break(e)}ensureAttributeBuffer(e){4*e<=this.attributeBuffer.size||this._resizeAttributeBuffer(4*e)}ensureIndexBuffer(e){e<=this.indexBuffer.length||this._resizeIndexBuffer(e)}_resizeAttributeBuffer(e){const t=Math.max(e,2*this.attributeBuffer.size),r=new go(t);_o(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(e){const t=this.indexBuffer;let r=Math.max(e,1.5*t.length);r+=r%2;const n=r>65535?new Uint32Array(r):new Uint16Array(r);if(n.BYTES_PER_ELEMENT!==t.BYTES_PER_ELEMENT)for(let e=0;e<t.length;e++)n[e]=t[e];else _o(t.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(e,t,r){e[t]=r+0,e[t+1]=r+1,e[t+2]=r+2,e[t+3]=r+0,e[t+4]=r+2,e[t+5]=r+3}packIndex(e,t,r,n){const s=e.indices,i=e.indexSize,o=e.indexOffset,a=e.attributeOffset;for(let e=0;e<i;e++)t[r++]=n+s[e+o]-a}destroy(e={}){if(null!==this.batches){for(let e=0;e<this.batchIndex;e++)Go(this.batches[e]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,e.shader&&(this.shader?.destroy(),this.shader=null);for(let e=0;e<this._elements.length;e++)this._elements[e]&&(this._elements[e]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};Fo.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Io=Fo;var Oo=(e=>(e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE",e[e.STATIC=1024]="STATIC",e))(Oo||{});class Do extends c{constructor(e){let{data:t,size:r}=e;const{usage:n,label:s,shrinkToFit:i}=e;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=G("buffer"),this._resourceType="buffer",this._resourceId=G("resource"),this._updateID=1,this._updateOffset=0,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,t instanceof Array&&(t=new Float32Array(t)),this._data=t,r??(r=t?.byteLength);const o=!!t;this.descriptor={size:r,usage:n,mappedAtCreation:o,label:s},this.shrinkToFit=i??!0}get data(){return this._data}set data(e){this.setDataWithSize(e,e.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&Oo.STATIC)}set static(e){e?this.descriptor.usage|=Oo.STATIC:this.descriptor.usage&=~Oo.STATIC}setDataWithSize(e,t,r){if(this._updateID++,this._updateSize=t*e.BYTES_PER_ELEMENT,this._updateOffset=0,this._data===e)return void(r&&this.emit("update",this));const n=this._data;this._data=e,this._dataInt32=null,n&&n.length===e.length||!this.shrinkToFit&&n&&e.byteLength<n.byteLength?r&&this.emit("update",this):(this.descriptor.size=e.byteLength,this._resourceId=G("resource"),this.emit("change",this))}update(e,t){this._updateSize=e??this._updateSize,this._updateOffset=t||0,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(const e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null),this.destroyed||(this._resourceId=G("resource"),this.emit("change",this))}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function Uo(e,t){if(!(e instanceof Do)){let r=t?Oo.INDEX:Oo.VERTEX;e instanceof Array&&(t?(e=new Uint32Array(e),r=Oo.INDEX|Oo.COPY_DST):(e=new Float32Array(e),r=Oo.VERTEX|Oo.COPY_DST)),e=new Do({data:e,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:r})}return e}function ko(e,t,r){const n=e.getAttribute(t);if(!n)return r.minX=0,r.minY=0,r.maxX=0,r.maxY=0,r;const s=n.buffer.data;let i=1/0,o=1/0,a=-1/0,l=-1/0;const u=s.BYTES_PER_ELEMENT,h=(n.offset||0)/u,c=(n.stride||8)/u;for(let e=h;e<s.length;e+=c){const t=s[e],r=s[e+1];t>a&&(a=t),r>l&&(l=r),t<i&&(i=t),r<o&&(o=r)}return r.minX=i,r.minY=o,r.maxX=a,r.maxY=l,r}class Lo extends c{constructor(e={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=G("geometry"),this._layoutKey=0,this.instanceCount=1,this.indexCount=0,this._bounds=new ne,this._boundsDirty=!0,this._vertexCount=0,this._vertexCountDirty=!0;const{attributes:t,indexBuffer:r,topology:n}=e;if(this.buffers=[],this.attributes={},t)for(const e in t)this.addAttribute(e,t[e]);this.instanceCount=e.instanceCount??1,this.indexCount=e.indexCount??0,r&&this.addIndex(r),this.topology=n||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this._vertexCountDirty=!0,this.emit("update",this)}getAttribute(e){return this.attributes[e]}getIndex(){return this.indexBuffer}getBuffer(e){return this.getAttribute(e).buffer}get vertexCount(){if(!this._vertexCountDirty)return this._vertexCount;this._vertexCountDirty=!1;const e=this.attributes;for(const t in e){const r=e[t];if(r.instance)continue;const n=r.buffer;return this._vertexCount=n.data.length/(r.stride/4||r.size),this._vertexCount}return this._vertexCount=0,0}getSize(){return L("8.20.0","Geometry.getSize is deprecated, please use Geometry.vertexCount instead."),this.vertexCount}addAttribute(e,t){const r=function(e){return(e instanceof Do||Array.isArray(e)||e.BYTES_PER_ELEMENT)&&(e={buffer:e}),e.buffer=Uo(e.buffer,!1),e}(t);-1===this.buffers.indexOf(r.buffer)&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[e]=r,this._vertexCountDirty=!0}addIndex(e){this.indexBuffer=Uo(e,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,ko(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(const e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null)}destroy(e=!1){this.emit("destroy",this);for(const t of this.buffers)t.off("update",this.onBufferUpdate,this),t.off("change",this.onBufferUpdate,this),e&&t.destroy();this.unload(),this.removeAllListeners(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const No=new Float32Array(1),Xo=new Uint32Array(1);class Ho extends Lo{constructor(){const e=new Do({data:No,label:"attribute-batch-buffer",usage:Oo.VERTEX|Oo.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:24,offset:0},aUV:{buffer:e,format:"float32x2",stride:24,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:24,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:24,offset:20}},indexBuffer:new Do({data:Xo,label:"index-batch-buffer",usage:Oo.INDEX|Oo.COPY_DST,shrinkToFit:!1})})}}function zo(e,t,r){if(e)for(const n in e){const s=t[n.toLocaleLowerCase()];if(s){let t=e[n];"header"===n&&(t=t.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),r&&s.push(`//----${r}----//`),s.push(t)}else Oe(`${n} placement hook does not exist in shader`)}}const Vo=/\{\{(.*?)\}\}/g;function Wo(e){const t={};return(e.match(Vo)?.map(e=>e.replace(/[{()}]/g,""))??[]).forEach(e=>{t[e]=[]}),t}function $o(e,t){let r;const n=/@in\s+([^;]+);/g;for(;null!==(r=n.exec(e));)t.push(r[1])}function Yo(e,t,r=!1){const n=[];$o(t,n),e.forEach(e=>{e.header&&$o(e.header,n)});const s=n;r&&s.sort();const i=s.map((e,t)=>` @location(${t}) ${e},`).join("\n");let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`\n${i}\n`),o}function jo(e,t){let r;const n=/@out\s+([^;]+);/g;for(;null!==(r=n.exec(e));)t.push(r[1])}function qo(e,t){const r=[];jo(t,r),e.forEach(e=>{e.header&&jo(e.header,r)});let n=0;const s=r.sort().map(e=>e.indexOf("builtin")>-1?e:`@location(${n++}) ${e}`).join(",\n"),i=r.sort().map(e=>{return` var ${t=e,t.replace(/@.*?\s+/g,"")};`;var t}).join("\n"),o=`return VSOutput(\n ${r.sort().map(e=>` ${function(e){const t=/\b(\w+)\s*:/g.exec(e);return t?t[1]:""}(e)}`).join(",\n")});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`\n${s}\n`),a=a.replace("{{start}}",`\n${i}\n`),a=a.replace("{{return}}",`\n${o}\n`),a}function Ko(e,t){let r=e;for(const e in t){const n=t[e];r=n.join("\n").length?r.replace(`{{${e}}}`,`//-----${e} START-----//\n${n.join("\n")}\n//----${e} FINISH----//`):r.replace(`{{${e}}}`,"")}return r}const Zo=Object.create(null),Qo=new Map;let Jo=0;function ea({template:e,bits:t}){const r=ra(e,t);if(Zo[r])return Zo[r];const{vertex:n,fragment:s}=function(e,t){const r=t.map(e=>e.vertex).filter(e=>!!e),n=t.map(e=>e.fragment).filter(e=>!!e);let s=Yo(r,e.vertex,!0);s=qo(r,s);const i=Yo(n,e.fragment,!0);return{vertex:s,fragment:i}}(e,t);return Zo[r]=na(n,s,t),Zo[r]}function ta({template:e,bits:t}){const r=ra(e,t);return Zo[r]||(Zo[r]=na(e.vertex,e.fragment,t)),Zo[r]}function ra(e,t){return t.map(e=>(Qo.has(e)||Qo.set(e,Jo++),Qo.get(e))).sort((e,t)=>e-t).join("-")+e.vertex+e.fragment}function na(e,t,r){const n=Wo(e),s=Wo(t);return r.forEach(e=>{zo(e.vertex,n,e.name),zo(e.fragment,s,e.name)}),{vertex:Ko(e,n),fragment:Ko(t,s)}}const sa="\n @in aPosition: vec2<f32>;\n @in aUV: vec2<f32>;\n\n @out @builtin(position) vPosition: vec4<f32>;\n @out vUV : vec2<f32>;\n @out vColor : vec4<f32>;\n\n {{header}}\n\n struct VSOutput {\n {{struct}}\n };\n\n @vertex\n fn main( {{in}} ) -> VSOutput {\n\n var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;\n var modelMatrix = mat3x3<f32>(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n var position = aPosition;\n var uv = aUV;\n\n {{start}}\n\n vColor = vec4<f32>(1., 1., 1., 1.);\n\n {{main}}\n\n vUV = uv;\n\n var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= globalUniforms.uWorldColorAlpha;\n\n {{end}}\n\n {{return}}\n };\n",ia="\n @in vUV : vec2<f32>;\n @in vColor : vec4<f32>;\n\n {{header}}\n\n @fragment\n fn main(\n {{in}}\n ) -> @location(0) vec4<f32> {\n\n {{start}}\n\n var outColor:vec4<f32>;\n\n {{main}}\n\n var finalColor:vec4<f32> = outColor * vColor;\n\n {{end}}\n\n return finalColor;\n };\n",oa="\n in vec2 aPosition;\n in vec2 aUV;\n\n out vec4 vColor;\n out vec2 vUV;\n\n {{header}}\n\n void main(void){\n\n mat3 worldTransformMatrix = uWorldTransformMatrix;\n mat3 modelMatrix = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n vec2 position = aPosition;\n vec2 uv = aUV;\n\n {{start}}\n\n vColor = vec4(1.);\n\n {{main}}\n\n vUV = uv;\n\n mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= uWorldColorAlpha;\n\n {{end}}\n }\n",aa="\n\n in vec4 vColor;\n in vec2 vUV;\n\n out vec4 finalColor;\n\n {{header}}\n\n void main(void) {\n\n {{start}}\n\n vec4 outColor;\n\n {{main}}\n\n finalColor = outColor * vColor;\n\n {{end}}\n }\n",la={name:"global-uniforms-bit",vertex:{header:"\n struct GlobalUniforms {\n uProjectionMatrix:mat3x3<f32>,\n uWorldTransformMatrix:mat3x3<f32>,\n uWorldColorAlpha: vec4<f32>,\n uResolution: vec2<f32>,\n }\n\n @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n "}},ua={name:"global-uniforms-ubo-bit",vertex:{header:"\n uniform globalUniforms {\n mat3 uProjectionMatrix;\n mat3 uWorldTransformMatrix;\n vec4 uWorldColorAlpha;\n vec2 uResolution;\n };\n "}},ha={name:"global-uniforms-bit",vertex:{header:"\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform vec4 uWorldColorAlpha;\n uniform vec2 uResolution;\n "}};function ca({bits:e,name:t}){const r=ea({template:{fragment:ia,vertex:sa},bits:[la,...e]});return Pn.from({name:t,vertex:{source:r.vertex,entryPoint:"main"},fragment:{source:r.fragment,entryPoint:"main"}})}function da({bits:e,name:t}){return new gn({name:t,...ta({template:{vertex:oa,fragment:aa},bits:[ha,...e]})})}const pa={name:"color-bit",vertex:{header:"\n @in aColor: vec4<f32>;\n ",main:"\n vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);\n "}},fa={name:"color-bit",vertex:{header:"\n in vec4 aColor;\n ",main:"\n vColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n "}},ma={};function ga(e){const t=[];if(1===e)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let r=0;for(let n=0;n<e;n++)t.push(`@group(1) @binding(${r++}) var textureSource${n+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${r++}) var textureSampler${n+1}: sampler;`)}return t.join("\n")}function _a(e){const t=[];if(1===e)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let r=0;r<e;r++)r===e-1?t.push(" default:{"):t.push(` case ${r}:{`),t.push(` outColor = textureSampleGrad(textureSource${r+1}, textureSampler${r+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join("\n")}function xa(e){return ma[e]||(ma[e]={name:"texture-batch-bit",vertex:{header:"\n @in aTextureIdAndRound: vec2<u32>;\n @out @interpolate(flat) vTextureId : u32;\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1)\n {\n vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "},fragment:{header:`\n @in @interpolate(flat) vTextureId: u32;\n\n ${ga(e)}\n `,main:`\n var uvDx = dpdx(vUV);\n var uvDy = dpdy(vUV);\n\n ${_a(e)}\n `}}),ma[e]}const ba={};function ya(e){const t=[];for(let r=0;r<e;r++)r>0&&t.push("else"),r<e-1&&t.push(`if(vTextureId < ${r}.5)`),t.push("{"),t.push(`\toutColor = texture(uTextures[${r}], vUV);`),t.push("}");return t.join("\n")}function va(e){return ba[e]||(ba[e]={name:"texture-batch-bit",vertex:{header:"\n in vec2 aTextureIdAndRound;\n out float vTextureId;\n\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "},fragment:{header:`\n in float vTextureId;\n\n uniform sampler2D uTextures[${e}];\n\n `,main:`\n\n ${ya(e)}\n `}}),ba[e]}const Ta={name:"round-pixels-bit",vertex:{header:"\n fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}},Sa={name:"round-pixels-bit",vertex:{header:"\n vec2 roundPixels(vec2 position, vec2 targetSize)\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}},wa={};function Ea(e){let t=wa[e];if(t)return t;const r=new Int32Array(e);for(let t=0;t<e;t++)r[t]=t;return t=wa[e]=new On({uTextures:{value:r,type:"i32",size:e}},{isStatic:!0}),t}class Aa extends Ln{constructor(e){super({glProgram:da({name:"batch",bits:[fa,va(e),Sa]}),gpuProgram:ca({name:"batch",bits:[pa,xa(e),Ta]}),resources:{batchSamplers:Ea(e)}}),this.maxTextures=e}}let Ra=null;const Ca=class e extends Io{constructor(t){super(t),this.geometry=new Ho,this.name=e.extension.name,this.vertexSize=6,Ra??(Ra=new Aa(t.maxTextures)),this.shader=Ra}packAttributes(e,t,r,n,s){const i=s<<16|65535&e.roundPixels,o=e.transform,a=o.a,l=o.b,u=o.c,h=o.d,c=o.tx,d=o.ty,{positions:p,uvs:f}=e,m=e.color,g=e.attributeOffset,_=g+e.attributeSize;for(let e=g;e<_;e++){const s=2*e,o=p[s],g=p[s+1];t[n++]=a*o+u*g+c,t[n++]=h*g+l*o+d,t[n++]=f[s],t[n++]=f[s+1],r[n++]=m,r[n++]=i}}packQuadAttributes(e,t,r,n,s){const i=e.texture,o=e.transform,a=o.a,l=o.b,u=o.c,h=o.d,c=o.tx,d=o.ty,p=e.bounds,f=p.maxX,m=p.minX,g=p.maxY,_=p.minY,x=i.uvs,b=e.color,y=s<<16|65535&e.roundPixels;t[n+0]=a*m+u*_+c,t[n+1]=h*_+l*m+d,t[n+2]=x.x0,t[n+3]=x.y0,r[n+4]=b,r[n+5]=y,t[n+6]=a*f+u*_+c,t[n+7]=h*_+l*f+d,t[n+8]=x.x1,t[n+9]=x.y1,r[n+10]=b,r[n+11]=y,t[n+12]=a*f+u*g+c,t[n+13]=h*g+l*f+d,t[n+14]=x.x2,t[n+15]=x.y2,r[n+16]=b,r[n+17]=y,t[n+18]=a*m+u*g+c,t[n+19]=h*g+l*m+d,t[n+20]=x.x3,t[n+21]=x.y3,r[n+22]=b,r[n+23]=y}_updateMaxTextures(e){this.shader.maxTextures!==e&&(Ra=new Aa(e),this.shader=Ra)}destroy(){this.shader=null,super.destroy()}};Ca.extension={type:[e.Batcher],name:"default"};let Ma=Ca;class Pa{constructor(e){this.items=Object.create(null);const{renderer:t,type:r,onUnload:n,priority:s,name:i}=e;this._renderer=t,t.gc.addResourceHash(this,"items",r,s??0),this._onUnload=n,this.name=i}add(e){return!this.items[e.uid]&&(this.items[e.uid]=e,e.once("unload",this.remove,this),e._gcLastUsed=this._renderer.gc.now,!0)}remove(e,...t){if(!this.items[e.uid])return;const r=e._gpuData[this._renderer.uid];r&&(this._onUnload?.(e,...t),e.off("unload",this.remove,this),r.destroy(),e._gpuData[this._renderer.uid]=null,this.items[e.uid]=null)}removeAll(...e){Object.values(this.items).forEach(t=>t&&this.remove(t,...e))}destroy(...e){this.removeAll(...e),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function Ga(e,t,r,n,s,i,o,a=null){let l=0;r*=t,s*=i;const u=a.a,h=a.b,c=a.c,d=a.d,p=a.tx,f=a.ty;for(;l<o;){const o=e[r],a=e[r+1];n[s]=u*o+c*a+p,n[s+1]=h*o+d*a+f,s+=i,r+=t,l++}}function Ba(e,t,r,n){let s=0;for(t*=r;s<n;)e[t]=0,e[t+1]=0,t+=r,s++}function Fa(e,t,r,n,s){const i=t.a,o=t.b,a=t.c,l=t.d,u=t.tx,h=t.ty;r||(r=0),n||(n=2),s||(s=e.length/n-r);let c=r*n;for(let t=0;t<s;t++){const t=e[c],r=e[c+1];e[c]=i*t+a*r+u,e[c+1]=o*t+l*r+h,c+=n}}const Ia=new _;class Oa{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const e=this.baseColor,t=e>>16|65280&e|(255&e)<<16,r=this.renderable;return r?rt(t,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):t+(255*this.alpha<<24)}get transform(){return this.renderable?.groupTransform||Ia}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const Da={extension:{type:e.ShapeBuilder,name:"circle"},build(e,t){let r,n,s,i,o,a;if("circle"===e.type){const t=e;if(o=a=t.radius,o<=0)return!1;r=t.x,n=t.y,s=i=0}else if("ellipse"===e.type){const t=e;if(o=t.halfWidth,a=t.halfHeight,o<=0||a<=0)return!1;r=t.x,n=t.y,s=i=0}else{const t=e,l=t.width/2,u=t.height/2;r=t.x+l,n=t.y+u,o=a=Math.max(0,Math.min(t.radius,Math.min(l,u))),s=l-o,i=u-a}if(s<0||i<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),u=8*l+(s?4:0)+(i?4:0);if(0===u)return!1;if(0===l)return t[0]=t[6]=r+s,t[1]=t[3]=n+i,t[2]=t[4]=r-s,t[5]=t[7]=n-i,!0;let h=0,c=4*l+(s?2:0)+2,d=c,p=u,f=s+o,m=i,g=r+f,_=r-f,x=n+m;if(t[h++]=g,t[h++]=x,t[--c]=x,t[--c]=_,i){const e=n-m;t[d++]=_,t[d++]=e,t[--p]=e,t[--p]=g}for(let e=1;e<l;e++){const u=Math.PI/2*(e/l),f=s+Math.cos(u)*o,m=i+Math.sin(u)*a,g=r+f,_=r-f,x=n+m,b=n-m;t[h++]=g,t[h++]=x,t[--c]=x,t[--c]=_,t[d++]=_,t[d++]=b,t[--p]=b,t[--p]=g}f=s,m=i+a,g=r+f,_=r-f,x=n+m;const b=n-m;return t[h++]=g,t[h++]=x,t[--p]=b,t[--p]=g,s&&(t[h++]=_,t[h++]=x,t[--p]=b,t[--p]=_),!0},triangulate(e,t,r,n,s,i){if(0===e.length)return;let o=0,a=0;for(let t=0;t<e.length;t+=2)o+=e[t],a+=e[t+1];o/=e.length/2,a/=e.length/2;let l=n;t[l*r]=o,t[l*r+1]=a;const u=l++;for(let n=0;n<e.length;n+=2)t[l*r]=e[n],t[l*r+1]=e[n+1],n>0&&(s[i++]=l,s[i++]=u,s[i++]=l-1),l++;s[i++]=u+1,s[i++]=u,s[i++]=l-1}},Ua={...Da,extension:{...Da.extension,name:"ellipse"}},ka={...Da,extension:{...Da.extension,name:"roundedRectangle"}},La=1e-4,Na=1e-4;function Xa(e,t,r,n,s,i,o,a){let l,u;o?(l=n,u=-r):(l=-n,u=r);const h=e-r*s+l,c=t-n*s+u,d=e+r*i+l,p=t+n*i+u;return a.push(h,c),a.push(d,p),2}function Ha(e,t,r,n,s,i,o,a){const l=r-e,u=n-t;let h=Math.atan2(l,u),c=Math.atan2(s-e,i-t);a&&h<c?h+=2*Math.PI:!a&&h>c&&(c+=2*Math.PI);let d=h;const p=c-h,f=Math.abs(p),m=Math.sqrt(l*l+u*u),g=1+(15*f*Math.sqrt(m)/Math.PI|0),_=p/g;if(d+=_,a){o.push(e,t),o.push(r,n);for(let r=1,n=d;r<g;r++,n+=_)o.push(e,t),o.push(e+Math.sin(n)*m,t+Math.cos(n)*m);o.push(e,t),o.push(s,i)}else{o.push(r,n),o.push(e,t);for(let r=1,n=d;r<g;r++,n+=_)o.push(e+Math.sin(n)*m,t+Math.cos(n)*m),o.push(e,t);o.push(s,i),o.push(e,t)}return 2*g}function za(e,t,r,n,s,i){const o=La;if(0===e.length)return;const a=t;let l=a.alignment;if(.5!==t.alignment){let t=lo(e);r&&(t*=-1),l=(l-.5)*t+.5}const u=new m(e[0],e[1]),h=new m(e[e.length-2],e[e.length-1]),c=n,d=Math.abs(u.x-h.x)<o&&Math.abs(u.y-h.y)<o;if(c){e=e.slice(),d&&(e.pop(),e.pop(),h.set(e[e.length-2],e[e.length-1]));const t=.5*(u.x+h.x),r=.5*(h.y+u.y);e.unshift(t,r),e.push(t,r)}const p=s,f=e.length/2;let g=e.length;const _=p.length/2,x=a.width/2,b=x*x,y=a.miterLimit*a.miterLimit;let v=e[0],T=e[1],S=e[2],w=e[3],E=0,A=0,R=-(T-w),C=v-S,M=0,P=0,G=Math.sqrt(R*R+C*C);R/=G,C/=G,R*=x,C*=x;const B=2*(1-l),F=2*l;c||("round"===a.cap?g+=Ha(v-R*(B-F)*.5,T-C*(B-F)*.5,v-R*B,T-C*B,v+R*F,T+C*F,p,!0)+2:"square"===a.cap&&(g+=Xa(v,T,R,C,B,F,!0,p))),p.push(v-R*B,T-C*B),p.push(v+R*F,T+C*F);for(let t=1;t<f-1;++t){v=e[2*(t-1)],T=e[2*(t-1)+1],S=e[2*t],w=e[2*t+1],E=e[2*(t+1)],A=e[2*(t+1)+1],R=-(T-w),C=v-S,G=Math.sqrt(R*R+C*C),R/=G,C/=G,R*=x,C*=x,M=-(w-A),P=S-E,G=Math.sqrt(M*M+P*P),M/=G,P/=G,M*=x,P*=x;const r=S-v,n=T-w,s=S-E,i=A-w,o=r*s+n*i,l=n*s-i*r,u=l<0;if(Math.abs(l)<.001*Math.abs(o)){p.push(S-R*B,w-C*B),p.push(S+R*F,w+C*F),o>=0&&("round"===a.join?g+=Ha(S,w,S-R*B,w-C*B,S-M*B,w-P*B,p,!1)+4:g+=2,p.push(S-M*F,w-P*F),p.push(S+M*B,w+P*B));continue}const h=(-R+v)*(-C+w)-(-R+S)*(-C+T),c=(-M+E)*(-P+w)-(-M+S)*(-P+A),d=(r*c-s*h)/l,f=(i*h-n*c)/l,m=(d-S)*(d-S)+(f-w)*(f-w),_=S+(d-S)*B,I=w+(f-w)*B,O=S-(d-S)*F,D=w-(f-w)*F,U=u?B:F;m<=Math.min(r*r+n*n,s*s+i*i)+U*U*b?"bevel"===a.join||m/b>y?(u?(p.push(_,I),p.push(S+R*F,w+C*F),p.push(_,I),p.push(S+M*F,w+P*F)):(p.push(S-R*B,w-C*B),p.push(O,D),p.push(S-M*B,w-P*B),p.push(O,D)),g+=2):"round"===a.join?u?(p.push(_,I),p.push(S+R*F,w+C*F),g+=Ha(S,w,S+R*F,w+C*F,S+M*F,w+P*F,p,!0)+4,p.push(_,I),p.push(S+M*F,w+P*F)):(p.push(S-R*B,w-C*B),p.push(O,D),g+=Ha(S,w,S-R*B,w-C*B,S-M*B,w-P*B,p,!1)+4,p.push(S-M*B,w-P*B),p.push(O,D)):(p.push(_,I),p.push(O,D)):(p.push(S-R*B,w-C*B),p.push(S+R*F,w+C*F),"round"===a.join?g+=u?Ha(S,w,S+R*F,w+C*F,S+M*F,w+P*F,p,!0)+2:Ha(S,w,S-R*B,w-C*B,S-M*B,w-P*B,p,!1)+2:"miter"===a.join&&m/b<=y&&(u?(p.push(O,D),p.push(O,D)):(p.push(_,I),p.push(_,I)),g+=2),p.push(S-M*B,w-P*B),p.push(S+M*F,w+P*F),g+=2)}v=e[2*(f-2)],T=e[2*(f-2)+1],S=e[2*(f-1)],w=e[2*(f-1)+1],R=-(T-w),C=v-S,G=Math.sqrt(R*R+C*C),R/=G,C/=G,R*=x,C*=x,p.push(S-R*B,w-C*B),p.push(S+R*F,w+C*F),c||("round"===a.cap?g+=Ha(S-R*(B-F)*.5,w-C*(B-F)*.5,S-R*B,w-C*B,S+R*F,w+C*F,p,!1)+2:"square"===a.cap&&(g+=Xa(S,w,R,C,B,F,!1,p)));for(let e=_;e<g+_-2;++e)v=p[2*e],T=p[2*e+1],S=p[2*(e+1)],w=p[2*(e+1)+1],E=p[2*(e+2)],A=p[2*(e+2)+1],Math.abs(v*(w-A)+S*(A-T)+E*(T-w))<1e-8||i.push(e,e+1,e+2)}function Va(e,t,r,n){const s=La;if(0===e.length)return;const i=e[0],o=e[1],a=e[e.length-2],l=e[e.length-1],u=t||Math.abs(i-a)<s&&Math.abs(o-l)<s,h=r,c=e.length/2,d=h.length/2;for(let t=0;t<c;t++)h.push(e[2*t]),h.push(e[2*t+1]);for(let e=0;e<c-1;e++)n.push(d+e,d+e+1);u&&n.push(d+c-1,d)}function Wa(e,t,r,n,s,i,o){const a=ni(e,t,2);if(!a)return;for(let e=0;e<a.length;e+=3)i[o++]=a[e]+s,i[o++]=a[e+1]+s,i[o++]=a[e+2]+s;let l=s*n;for(let t=0;t<e.length;t+=2)r[l]=e[t],r[l+1]=e[t+1],l+=n}const $a=[],Ya={extension:{type:e.ShapeBuilder,name:"polygon"},build(e,t){for(let r=0;r<e.points.length;r++)t[r]=e.points[r];return!0},triangulate(e,t,r,n,s,i){Wa(e,$a,t,r,n,s,i)}},ja={extension:{type:e.ShapeBuilder,name:"rectangle"},build(e,t){const r=e,n=r.x,s=r.y,i=r.width,o=r.height;return i>0&&o>0&&(t[0]=n,t[1]=s,t[2]=n+i,t[3]=s,t[4]=n+i,t[5]=s+o,t[6]=n,t[7]=s+o,!0)},triangulate(e,t,r,n,s,i){let o=0;t[(n*=r)+o]=e[0],t[n+o+1]=e[1],o+=r,t[n+o]=e[2],t[n+o+1]=e[3],o+=r,t[n+o]=e[6],t[n+o+1]=e[7],o+=r,t[n+o]=e[4],t[n+o+1]=e[5],o+=r;const a=n/r;s[i++]=a,s[i++]=a+1,s[i++]=a+2,s[i++]=a+1,s[i++]=a+3,s[i++]=a+2}},qa={extension:{type:e.ShapeBuilder,name:"triangle"},build:(e,t)=>(t[0]=e.x,t[1]=e.y,t[2]=e.x2,t[3]=e.y2,t[4]=e.x3,t[5]=e.y3,!0),triangulate(e,t,r,n,s,i){let o=0;t[(n*=r)+o]=e[0],t[n+o+1]=e[1],o+=r,t[n+o]=e[2],t[n+o+1]=e[3],o+=r,t[n+o]=e[4],t[n+o+1]=e[5];const a=n/r;s[i++]=a,s[i++]=a+1,s[i++]=a+2}},Ka=[{offset:0,color:"white"},{offset:1,color:"black"}],Za=class e{constructor(...t){this.uid=G("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let r=function(e){let t=e[0]??{};("number"==typeof t||e[1])&&(L("8.5.2","use options object instead"),t={type:"linear",start:{x:e[0],y:e[1]},end:{x:e[2],y:e[3]},textureSpace:e[4],textureSize:e[5]??Qa.defaultLinearOptions.textureSize});return t}(t);r={..."radial"===r.type?e.defaultRadialOptions:e.defaultLinearOptions,...W(r)},this._textureSize=r.textureSize,this._wrapMode=r.wrapMode,"radial"===r.type?(this.center=r.center,this.outerCenter=r.outerCenter??this.center,this.innerRadius=r.innerRadius,this.outerRadius=r.outerRadius,this.scale=r.scale,this.rotation=r.rotation):(this.start=r.start,this.end=r.end),this.textureSpace=r.textureSpace,this.type=r.type,r.colorStops.forEach(e=>{this.addColorStop(e.offset,e.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:Be.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:r,y:n}=this.end,s=r-e,i=n-t;const o=s<0||i<0;if("clamp-to-edge"===this._wrapMode){if(s<0){const t=e;e=r,r=t,s*=-1}if(i<0){const e=t;t=n,n=e,i*=-1}}const a=this.colorStops.length?this.colorStops:Ka,l=this._textureSize,{canvas:u,context:h}=el(l,1),c=o?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);Ja(c,a),h.fillStyle=c,h.fillRect(0,0,l,1),this.texture=new ee({source:new qt({resource:u,addressMode:this._wrapMode})});const d=Math.sqrt(s*s+i*i),p=Math.atan2(i,s),f=new _;f.scale(d/l,1),f.rotate(p),f.translate(e,t),"local"===this.textureSpace&&f.scale(l,l),this.transform=f}buildGradient(){this.texture||this._tick++,"linear"===this.type?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const e=this.colorStops.length?this.colorStops:Ka,t=this._textureSize,{canvas:r,context:n}=el(t,t),{x:s,y:i}=this.center,{x:o,y:a}=this.outerCenter,l=this.innerRadius,u=this.outerRadius,h=o-u,c=a-u,d=t/(2*u),p=(s-h)*d,f=(i-c)*d,m=n.createRadialGradient(p,f,l*d,(o-h)*d,(a-c)*d,u*d);Ja(m,e),n.fillStyle=e[e.length-1].color,n.fillRect(0,0,t,t),n.fillStyle=m,n.translate(p,f),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-p,-f),n.fillRect(0,0,t,t),this.texture=new ee({source:new qt({resource:r,addressMode:this._wrapMode})});const g=new _;"local"===this.textureSpace?g.scale(2*u,2*u):g.scale(1/d,1/d),g.translate(h,c),this.transform=g}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};Za.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},Za.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Qa=Za;function Ja(e,t){for(let r=0;r<t.length;r++){const n=t[r];e.addColorStop(n.offset,n.color)}}function el(e,t){const r=Yt.get().createCanvas(e,t),n=r.getContext("2d");return{canvas:r,context:n}}const tl=new _,rl=new M,nl=new _;function sl(e,t,r,n){const s=t.matrix?e.copyFrom(t.matrix).invert():e.identity();if("local"===t.textureSpace){const e=r.getBounds(rl);t.width&&e.pad(t.width);const{x:n,y:i}=e,o=1/e.width,a=1/e.height,l=-n*o,u=-i*a,h=s.a,c=s.b,d=s.c,p=s.d;s.a*=o,s.b*=o,s.c*=a,s.d*=a,s.tx=l*h+u*d+s.tx,s.ty=l*c+u*p+s.ty}else if(t.texture.rotate){const{uvs:e,orig:r}=t.texture;s.scale(1/r.width,1/r.height),s.prepend(nl.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0))}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);const i=t.texture.source.style;return t.fill instanceof Qa||"clamp-to-edge"!==i.addressMode||(i.addressMode="repeat",i.update()),n&&s.append(tl.copyFrom(n).invert()),s}const il={};n.handleByMap(e.ShapeBuilder,il),n.add(ja,Ya,qa,Da,Ua,ka);const ol=new M,al=new _;function ll(e,t){const{geometryData:r,batches:n}=t;n.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let t=0;t<e.instructions.length;t++){const s=e.instructions[t];if("texture"===s.action)ul(s.data,n,r);else if("fill"===s.action||"stroke"===s.action){const e="stroke"===s.action,t=s.data.path.shapePath,i=s.data.style,o=s.data.hole;e&&o&&hl(o.shapePath,i,!0,n,r),o&&(t.shapePrimitives[t.shapePrimitives.length-1].holes=o.shapePath.shapePrimitives),hl(t,i,e,n,r)}}}function ul(e,t,r){const n=[],s=il.rectangle,i=ol;i.x=e.dx,i.y=e.dy,i.width=e.dw,i.height=e.dh;const o=e.transform;if(!s.build(i,n))return;const{vertices:a,uvs:l,indices:u}=r,h=u.length,c=a.length/2;o&&Fa(n,o),s.triangulate(n,a,2,c,u,h);const d=e.image,p=d.uvs;l.push(p.x0,p.y0,p.x1,p.y1,p.x3,p.y3,p.x2,p.y2);const f=Le.get(Oa);f.indexOffset=h,f.indexSize=u.length-h,f.attributeOffset=c,f.attributeSize=a.length/2-c,f.baseColor=e.style,f.alpha=e.alpha,f.texture=d,f.geometryData=r,t.push(f)}function hl(e,t,r,n,s){const{vertices:i,uvs:o,indices:a}=s;e.shapePrimitives.forEach(({shape:e,transform:l,holes:u})=>{const h=[],c=il[e.type];if(!c.build(e,h))return;const d=a.length,p=i.length/2;let f="triangle-list";if(l&&Fa(h,l),r){const r=e.closePath??!0,n=t;n.pixelLine?(Va(h,r,i,a),f="line-list"):za(h,n,!1,r,i,a)}else if(u){const e=[],t=h.slice(),r=function(e){const t=[];for(let r=0;r<e.length;r++){const n=e[r].shape,s=[];il[n.type].build(n,s)&&t.push(s)}return t}(u);r.forEach(r=>{e.push(t.length/2),t.push(...r)}),Wa(t,e,i,2,p,a,d)}else c.triangulate(h,i,2,p,a,d);const m=o.length/2,g=t.texture;if(g!==ee.WHITE){const r=sl(al,t,e,l);Ga(i,2,p,o,m,2,i.length/2-p,r)}else Ba(o,m,2,i.length/2-p);const _=Le.get(Oa);_.indexOffset=d,_.indexSize=a.length-d,_.attributeOffset=p,_.attributeSize=i.length/2-p,_.baseColor=t.color,_.alpha=t.alpha,_.texture=g,_.geometryData=s,_.topology=f,n.push(_)})}class cl{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{Le.return(e)}),this.graphicsData&&Le.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class dl{constructor(){this.instructions=new gt}init(e){const t=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(t):this.batcher=new Ma({maxTextures:t}),this.instructions.reset()}get geometry(){return L(O,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const pl=class e{constructor(e){this._renderer=e,this._managedContexts=new Pa({renderer:e,type:"resource",name:"graphicsContext"})}init(t){e.defaultOptions.bezierSmoothness=t?.bezierSmoothness??e.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const t=!!e._gpuData[this._renderer.uid],r=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!t){t&&r.reset(),ll(e,r);const n=e.batchMode;e.customShader||"no-batch"===n?r.isBatchable=!1:r.isBatchable="auto"!==n||r.geometryData.vertices.length<400,e.dirty=!1}return r}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const t=Le.get(dl,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=e._gpuData[this._renderer.uid],{batches:n,geometryData:s}=r;r.graphicsData=t;const i=s.vertices.length,o=s.indices.length;for(let e=0;e<n.length;e++)n[e].applyTransform=!1;const a=t.batcher;a.ensureAttributeBuffer(i),a.ensureIndexBuffer(o),a.begin();for(let e=0;e<n.length;e++){const t=n[e];a.add(t)}a.finish(t.instructions);const l=a.geometry;l.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),l.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);const u=a.batches;for(let e=0;e<a.batchIndex;e++){const t=u[e];t.bindGroup=mo(t.textures.textures,t.textures.count,this._renderer.limits.maxBatchableTextures)}return t}_initContext(e){const t=new cl;return t.context=e,e._gpuData[this._renderer.uid]=t,this._managedContexts.add(e),t}destroy(){this._managedContexts.destroy(),this._renderer=null}};pl.extension={type:[e.WebGLSystem,e.WebGPUSystem],name:"graphicsContext"},pl.defaultOptions={bezierSmoothness:.5};let fl=pl;const ml=1.1920929e-7;function gl(e,t,r,n,s,i,o,a,l,u){let h=(1-Math.min(.99,Math.max(0,u??fl.defaultOptions.bezierSmoothness)))/1;return h*=h,function(e,t,r,n,s,i,o,a,l,u){_l(e,t,r,n,s,i,o,a,l,u,0),l.push(o,a)}(t,r,n,s,i,o,a,l,e,h),e}function _l(e,t,r,n,s,i,o,a,l,u,h){if(h>8)return;const c=(e+r)/2,d=(t+n)/2,p=(r+s)/2,f=(n+i)/2,m=(s+o)/2,g=(i+a)/2,_=(c+p)/2,x=(d+f)/2,b=(p+m)/2,y=(f+g)/2,v=(_+b)/2,T=(x+y)/2;if(h>0){let h=o-e,c=a-t;const d=Math.abs((r-o)*c-(n-a)*h),p=Math.abs((s-o)*c-(i-a)*h);if(d>ml&&p>ml){if((d+p)*(d+p)<=u*(h*h+c*c))return void l.push(v,T)}else if(d>ml){if(d*d<=u*(h*h+c*c))return void l.push(v,T)}else if(p>ml){if(p*p<=u*(h*h+c*c))return void l.push(v,T)}else if(h=v-(e+o)/2,c=T-(t+a)/2,h*h+c*c<=u)return void l.push(v,T)}_l(e,t,c,d,_,x,v,T,l,u,h+1),_l(v,T,b,y,m,g,o,a,l,u,h+1)}function xl(e,t,r,n,s,i,o,a){let l=(1-Math.min(.99,Math.max(0,a??fl.defaultOptions.bezierSmoothness)))/1;return l*=l,function(e,t,r,n,s,i,o,a){bl(o,e,t,r,n,s,i,a,0),o.push(s,i)}(t,r,n,s,i,o,e,l),e}function bl(e,t,r,n,s,i,o,a,l){if(l>8)return;const u=(t+n)/2,h=(r+s)/2,c=(n+i)/2,d=(s+o)/2,p=(u+c)/2,f=(h+d)/2;let m=i-t,g=o-r;const _=Math.abs((n-i)*g-(s-o)*m);if(_>1.1920929e-7){if(_*_<=a*(m*m+g*g))return void e.push(p,f)}else if(m=p-(t+i)/2,g=f-(r+o)/2,m*m+g*g<=a)return void e.push(p,f);bl(e,t,r,u,h,p,f,a,l+1),bl(e,p,f,c,d,i,o,a,l+1)}function yl(e,t,r,n,s,i,o,a){let l=Math.abs(s-i);(!o&&s>i||o&&i>s)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(n,1/3)*(l/Math.PI))));let u=l/(a=Math.max(a,3)),h=s;u*=o?-1:1;for(let s=0;s<a+1;s++){const s=t+Math.cos(h)*n,i=r+Math.sin(h)*n;e.push(s,i),h+=u}}function vl(e,t,r,n,s,i){const o=e[e.length-2],a=e[e.length-1]-r,l=o-t,u=s-r,h=n-t,c=Math.abs(a*h-l*u);if(c<1e-8||0===i)return void(e[e.length-2]===t&&e[e.length-1]===r||e.push(t,r));const d=a*a+l*l,p=u*u+h*h,f=a*u+l*h,m=i*Math.sqrt(d)/c,g=i*Math.sqrt(p)/c,_=m*f/d,x=g*f/p,b=m*h+g*l,y=m*u+g*a,v=l*(g+_),T=a*(g+_),S=h*(m+x),w=u*(m+x);yl(e,b+t,y+r,i,Math.atan2(T-y,v-b),Math.atan2(w-y,S-b),l*u>h*a)}const Tl=2*Math.PI,Sl={centerX:0,centerY:0,ang1:0,ang2:0},wl=({x:e,y:t},r,n,s,i,o,a,l)=>{const u=s*(e*=r)-i*(t*=n),h=i*e+s*t;return l.x=u+o,l.y=h+a,l};function El(e,t){const r=-1.5707963267948966===t?-.551915024494:4/3*Math.tan(t/4),n=1.5707963267948966===t?.551915024494:r,s=Math.cos(e),i=Math.sin(e),o=Math.cos(e+t),a=Math.sin(e+t);return[{x:s-i*n,y:i+s*n},{x:o+a*n,y:a-o*n},{x:o,y:a}]}const Al=(e,t,r,n)=>{let s=e*r+t*n;return s>1&&(s=1),s<-1&&(s=-1),(e*n-t*r<0?-1:1)*Math.acos(s)};function Rl(e,t,r,n,s,i,o,a=0,l=0,u=0){if(0===i||0===o)return;const h=Math.sin(a*Tl/360),c=Math.cos(a*Tl/360),d=c*(t-n)/2+h*(r-s)/2,p=-h*(t-n)/2+c*(r-s)/2;if(0===d&&0===p)return;i=Math.abs(i),o=Math.abs(o);const f=Math.pow(d,2)/Math.pow(i,2)+Math.pow(p,2)/Math.pow(o,2);f>1&&(i*=Math.sqrt(f),o*=Math.sqrt(f)),((e,t,r,n,s,i,o,a,l,u,h,c,d)=>{const p=Math.pow(s,2),f=Math.pow(i,2),m=Math.pow(h,2),g=Math.pow(c,2);let _=p*f-p*g-f*m;_<0&&(_=0),_/=p*g+f*m,_=Math.sqrt(_)*(o===a?-1:1);const x=_*s/i*c,b=_*-i/s*h,y=u*x-l*b+(e+r)/2,v=l*x+u*b+(t+n)/2,T=(h-x)/s,S=(c-b)/i,w=(-h-x)/s,E=(-c-b)/i,A=Al(1,0,T,S);let R=Al(T,S,w,E);0===a&&R>0&&(R-=Tl),1===a&&R<0&&(R+=Tl),d.centerX=y,d.centerY=v,d.ang1=A,d.ang2=R})(t,r,n,s,i,o,l,u,h,c,d,p,Sl);let{ang1:m,ang2:g}=Sl;const{centerX:_,centerY:x}=Sl;let b=Math.abs(g)/(Tl/4);Math.abs(1-b)<1e-7&&(b=1);const y=Math.max(Math.ceil(b),1);g/=y;let v=e[e.length-2],T=e[e.length-1];const S={x:0,y:0};for(let t=0;t<y;t++){const t=El(m,g),{x:r,y:n}=wl(t[0],i,o,c,h,_,x,S),{x:s,y:a}=wl(t[1],i,o,c,h,_,x,S),{x:l,y:u}=wl(t[2],i,o,c,h,_,x,S);gl(e,v,T,r,n,s,a,l,u),v=l,T=u,m+=g}}function Cl(e,t,r){const n=(e,t)=>{const r=t.x-e.x,n=t.y-e.y,s=Math.sqrt(r*r+n*n);return{len:s,nx:r/s,ny:n/s}},s=(t,r)=>{0===t?e.moveTo(r.x,r.y):e.lineTo(r.x,r.y)};let i=t[t.length-1];for(let o=0;o<t.length;o++){const a=t[o%t.length],l=a.radius??r;if(l<=0){s(o,a),i=a;continue}const u=t[(o+1)%t.length],h=n(a,i),c=n(a,u);if(h.len<1e-4||c.len<1e-4){s(o,a),i=a;continue}let d=Math.asin(h.nx*c.ny-h.ny*c.nx),p=1,f=!1;h.nx*c.nx-h.ny*-c.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,p=-1,f=!0):d>0&&(p=-1,f=!0);const m=d/2;let g,_=Math.abs(Math.cos(m)*l/Math.sin(m));_>Math.min(h.len/2,c.len/2)?(_=Math.min(h.len/2,c.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=l;const x=a.x+c.nx*_+-c.ny*g*p,b=a.y+c.ny*_+c.nx*g*p,y=Math.atan2(h.ny,h.nx)+Math.PI/2*p,v=Math.atan2(c.ny,c.nx)-Math.PI/2*p;0===o&&e.moveTo(x+Math.cos(y)*g,b+Math.sin(y)*g),e.arc(x,b,g,y,v,f),i=a}}function Ml(e,t,r,n){const s=(e,t)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),i=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r}),o=t.length;for(let a=0;a<o;a++){const l=t[(a+1)%o],u=l.radius??r;if(u<=0){0===a?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y);continue}const h=t[a],c=t[(a+2)%o],d=s(h,l);let p;if(d<1e-4)p=l;else{p=i(l,h,Math.min(d/2,u)/d)}const f=s(c,l);let m;if(f<1e-4)m=l;else{m=i(l,c,Math.min(f/2,u)/f)}0===a?e.moveTo(p.x,p.y):e.lineTo(p.x,p.y),e.quadraticCurveTo(l.x,l.y,m.x,m.y,n)}}const Pl=new M;class Gl{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ne,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();const r=this._currentPoly.points,n=r[r.length-2],s=r[r.length-1];return n===e&&s===t||r.push(e,t),this}arc(e,t,r,n,s,i){this._ensurePoly(!1);return yl(this._currentPoly.points,e,t,r,n,s,i),this}arcTo(e,t,r,n,s){this._ensurePoly();return vl(this._currentPoly.points,e,t,r,n,s),this}arcToSvg(e,t,r,n,s,i,o){return Rl(this._currentPoly.points,this._currentPoly.lastX,this._currentPoly.lastY,i,o,e,t,r,n,s),this}bezierCurveTo(e,t,r,n,s,i,o){this._ensurePoly();const a=this._currentPoly;return gl(this._currentPoly.points,a.lastX,a.lastY,e,t,r,n,s,i,o),this}quadraticCurveTo(e,t,r,n,s){this._ensurePoly();const i=this._currentPoly;return xl(this._currentPoly.points,i.lastX,i.lastY,e,t,r,n,s),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0)).transform(t);const r=this.shapePrimitives,n=r.length;for(let t=0;t<e.instructions.length;t++){const r=e.instructions[t];this[r.action](...r.data)}if(e.checkForHoles&&r.length-n>1){let e=null;for(let t=n;t<r.length;t++){const n=r[t];if("polygon"===n.shape.type){const s=n.shape,i=e?.shape;i&&i.containsPolygon(s)?(e.holes||(e.holes=[]),e.holes.push(n),r.copyWithin(t,t+1),r.length--,t--):e=n}}}return this}finish(e=!1){this.endPoly(e)}rect(e,t,r,n,s){return this.drawShape(new M(e,t,r,n),s),this}circle(e,t,r,n){return this.drawShape(new oo(e,t,r),n),this}poly(e,t,r){const n=new ho(e);return n.closePath=t,this.drawShape(n,r),this}regularPoly(e,t,r,n,s=0,i){n=Math.max(0|n,3);const o=-1*Math.PI/2+s,a=2*Math.PI/n,l=[];for(let s=0;s<n;s++){const n=o-s*a;l.push(e+r*Math.cos(n),t+r*Math.sin(n))}return this.poly(l,!0,i),this}roundPoly(e,t,r,n,s,i=0,o){if(n=Math.max(0|n,3),s<=0)return this.regularPoly(e,t,r,n,i);const a=r*Math.sin(Math.PI/n)-.001;s=Math.min(s,a);const l=-1*Math.PI/2+i,u=2*Math.PI/n,h=(n-2)*Math.PI/n/2;for(let i=0;i<n;i++){const n=i*u+l,a=e+r*Math.cos(n),c=t+r*Math.sin(n),d=n+Math.PI+h,p=n-Math.PI-h,f=a+s*Math.cos(d),m=c+s*Math.sin(d),g=a+s*Math.cos(p),_=c+s*Math.sin(p);0===i?this.moveTo(f,m):this.lineTo(f,m),this.quadraticCurveTo(a,c,g,_,o)}return this.closePath()}roundShape(e,t,r=!1,n){return e.length<3?this:(r?Ml(this,e,t,n):Cl(this,e,t),this.closePath())}filletRect(e,t,r,n,s){if(0===s)return this.rect(e,t,r,n);const i=Math.min(r,n)/2,o=Math.min(i,Math.max(-i,s)),a=e+r,l=t+n,u=o<0?-o:0,h=Math.abs(o);return this.moveTo(e,t+h).arcTo(e+u,t+u,e+h,t,h).lineTo(a-h,t).arcTo(a-u,t+u,a,t+h,h).lineTo(a,l-h).arcTo(a-u,l-u,e+r-h,l,h).lineTo(e+h,l).arcTo(e+u,l-u,e,l-h,h).closePath()}chamferRect(e,t,r,n,s,i){if(s<=0)return this.rect(e,t,r,n);const o=Math.min(s,Math.min(r,n)/2),a=e+r,l=t+n,u=[e+o,t,a-o,t,a,t+o,a,l-o,a-o,l,e+o,l,e,l-o,e,t+o];for(let e=u.length-1;e>=2;e-=2)u[e]===u[e-2]&&u[e-1]===u[e-3]&&u.splice(e-1,2);return this.poly(u,!0,i)}ellipse(e,t,r,n,s){return this.drawShape(new ao(e,t,r,n),s),this}roundRect(e,t,r,n,s,i){return this.drawShape(new po(e,t,r,n,s),i),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let r=this._currentPoly;return r&&this.endPoly(),r=new ho,r.points.push(e,t),this._currentPoly=r,this}endPoly(e=!1){const t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new ho,e)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let t=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,s=t;t=n.a*t+n.c*r+n.tx,r=n.b*s+n.d*r+n.ty}this._currentPoly.points.push(t,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t<e.instructions.length;t++){const r=e.instructions[t];this[r.action](...r.data)}this.finish()}get bounds(){const e=this._bounds;e.clear();const t=this.shapePrimitives;for(let r=0;r<t.length;r++){const n=t[r],s=n.shape.getBounds(Pl);n.transform?e.addRect(s,n.transform):e.addRect(s)}return e}}class Bl{constructor(e,t=!1){this.instructions=[],this.uid=G("graphicsPath"),this._dirty=!0,this.checkForHoles=t,"string"==typeof e?io(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Gl(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:"addPath",data:[e,t]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:"arc",data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:"arcTo",data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:"arcToSvg",data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:"bezierCurveTo",data:e}),this._dirty=!0,this}bezierCurveToShort(e,t,r,n,s){const i=this.instructions[this.instructions.length-1],o=this.getLastPoint(m.shared);let a=0,l=0;if(i&&"bezierCurveTo"===i.action){a=i.data[2],l=i.data[3];const e=o.x,t=o.y;a=e+(e-a),l=t+(t-l)}else a=o.x,l=o.y;return this.instructions.push({action:"bezierCurveTo",data:[a,l,e,t,r,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:"ellipse",data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:"lineTo",data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:"moveTo",data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:"quadraticCurveTo",data:e}),this._dirty=!0,this}quadraticCurveToShort(e,t,r){const n=this.instructions[this.instructions.length-1],s=this.getLastPoint(m.shared);let i=0,o=0;if(n&&"quadraticCurveTo"===n.action){i=n.data[0],o=n.data[1];const e=s.x,t=s.y;i=e+(e-i),o=t+(t-o)}else i=s.x,o=s.y;return this.instructions.push({action:"quadraticCurveTo",data:[i,o,e,t,r]}),this._dirty=!0,this}rect(e,t,r,n,s){return this.instructions.push({action:"rect",data:[e,t,r,n,s]}),this._dirty=!0,this}circle(e,t,r,n){return this.instructions.push({action:"circle",data:[e,t,r,n]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:"roundRect",data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:"poly",data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:"regularPoly",data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:"roundPoly",data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:"roundShape",data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:"filletRect",data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:"chamferRect",data:e}),this._dirty=!0,this}star(e,t,r,n,s,i,o){s||(s=n/2);const a=-1*Math.PI/2+i,l=2*r,u=2*Math.PI/l,h=[];for(let r=0;r<l;r++){const i=r%2?s:n,o=r*u+a;h.push(e+i*Math.cos(o),t+i*Math.sin(o))}return this.poly(h,!0,o),this}clone(e=!1){const t=new Bl;if(t.checkForHoles=this.checkForHoles,e)for(let e=0;e<this.instructions.length;e++){const r=this.instructions[e];t.instructions.push({action:r.action,data:r.data.slice()})}else t.instructions=this.instructions.slice();return t}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;const t=e.a,r=e.b,n=e.c,s=e.d,i=e.tx,o=e.ty;let a=0,l=0,u=0,h=0,c=0,d=0,p=0,f=0;for(let m=0;m<this.instructions.length;m++){const g=this.instructions[m],_=g.data;switch(g.action){case"moveTo":case"lineTo":a=_[0],l=_[1],_[0]=t*a+n*l+i,_[1]=r*a+s*l+o;break;case"bezierCurveTo":u=_[0],h=_[1],c=_[2],d=_[3],a=_[4],l=_[5],_[0]=t*u+n*h+i,_[1]=r*u+s*h+o,_[2]=t*c+n*d+i,_[3]=r*c+s*d+o,_[4]=t*a+n*l+i,_[5]=r*a+s*l+o;break;case"quadraticCurveTo":u=_[0],h=_[1],a=_[2],l=_[3],_[0]=t*u+n*h+i,_[1]=r*u+s*h+o,_[2]=t*a+n*l+i,_[3]=r*a+s*l+o;break;case"arcToSvg":a=_[5],l=_[6],p=_[0],f=_[1],_[0]=t*p+n*f,_[1]=r*p+s*f,_[5]=t*a+n*l+i,_[6]=r*a+s*l+o;break;case"circle":_[4]=Fl(_[3],e);break;case"rect":_[4]=Fl(_[4],e);break;case"ellipse":_[8]=Fl(_[8],e);break;case"roundRect":case"regularPoly":case"chamferRect":_[5]=Fl(_[5],e);break;case"addPath":_[0].transform(e);break;case"poly":_[2]=Fl(_[2],e);break;case"closePath":break;default:Oe("unknown transform action",g.action)}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,r=this.instructions[t];if(!r)return e.x=0,e.y=0,e;for(;"closePath"===r.action;){if(t--,t<0)return e.x=0,e.y=0,e;r=this.instructions[t]}switch(r.action){case"moveTo":case"lineTo":e.x=r.data[0],e.y=r.data[1];break;case"quadraticCurveTo":e.x=r.data[2],e.y=r.data[3];break;case"bezierCurveTo":e.x=r.data[4],e.y=r.data[5];break;case"arc":case"arcToSvg":e.x=r.data[5],e.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(e)}return e}}function Fl(e,t){return e?e.prepend(t):t.clone()}function Il(e,t,r){const n=e.getAttribute(t);return n?Number(n):r}function Ol(e,t){const r=e.querySelectorAll("defs");for(let e=0;e<r.length;e++){const n=r[e];for(let e=0;e<n.children.length;e++){const r=n.children[e];switch(r.nodeName.toLowerCase()){case"lineargradient":t.defs[r.id]=Ll(r);break;case"radialgradient":t.defs[r.id]=Nl(r)}}}}function Dl(e,t,r){const n=e.getAttribute(t);if(n?.trim().endsWith("%")){const e=Number(n.trim().slice(0,-1));return Number.isNaN(e)?r:e/100}return Il(e,t,r)}function Ul(e){return"objectBoundingBox"===(e.getAttribute("gradientUnits")||"objectBoundingBox")?"local":"global"}function kl(e){const t=[];for(let r=0;r<e.children.length;r++){const n=e.children[r],s=Dl(n,"offset",0),i=Be.shared.setValue(n.getAttribute("stop-color")).toNumber();t.push({offset:s,color:i})}return t}function Ll(e){const t=Dl(e,"x1",0),r=Dl(e,"y1",0),n=Dl(e,"x2",1),s=Dl(e,"y2",0);return new Qa({type:"linear",start:{x:t,y:r},end:{x:n,y:s},textureSpace:Ul(e),colorStops:kl(e)})}function Nl(e){const t=Dl(e,"cx",.5),r=Dl(e,"cy",.5),n=Dl(e,"r",.5),s=Dl(e,"fx",t),i=Dl(e,"fy",r),o=Dl(e,"fr",0);return new Qa({type:"radial",center:{x:s,y:i},innerRadius:o,outerCenter:{x:t,y:r},outerRadius:n,textureSpace:Ul(e),colorStops:kl(e)})}function Xl(e){const t=e.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const Hl={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function zl(e,t){const r=e.getAttribute("style"),n={},s={},i={strokeStyle:n,fillStyle:s,useFill:!1,useStroke:!1};for(const r in Hl){const n=e.getAttribute(r);n&&Vl(t,i,r,n.trim())}if(r){const e=r.split(";");for(let r=0;r<e.length;r++){const n=e[r].trim(),[s,o]=n.split(":");Hl[s]&&Vl(t,i,s,o.trim())}}return{strokeStyle:i.useStroke?n:null,fillStyle:i.useFill?s:null,useFill:i.useFill,useStroke:i.useStroke}}function Vl(e,t,r,n){switch(r){case"stroke":if("none"!==n){if(n.startsWith("url(")){const r=Xl(n);t.strokeStyle.fill=e.defs[r]}else t.strokeStyle.color=Be.shared.setValue(n).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(n);break;case"fill":if("none"!==n){if(n.startsWith("url(")){const r=Xl(n);t.fillStyle.fill=e.defs[r]}else t.fillStyle.color=Be.shared.setValue(n).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(n);break;case"stroke-opacity":t.strokeStyle.alpha=Number(n);break;case"opacity":t.fillStyle.alpha=Number(n),t.strokeStyle.alpha=Number(n)}}function Wl(e){if(e.length<=2)return!0;const t=e.map(e=>e.area).sort((e,t)=>t-e),[r,n]=t,s=t[t.length-1];return!(r/n>3&&n/s<2)}function $l(e,t=0){const r=e.instructions[t];if(!r||"fill"!==r.action)throw new Error(`Expected fill instruction at index ${t}, got ${r?.action||"undefined"}`);return r.data}function Yl(e){return e.split(/(?=[Mm])/).filter(e=>e.trim().length>0)}function jl(e){const t=e.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const r=t.map(Number),n=[],s=[];for(let e=0;e<r.length;e+=2)e+1<r.length&&(n.push(r[e]),s.push(r[e+1]));if(0===n.length||0===s.length)return 0;const i=Math.min(...n),o=Math.max(...n),a=Math.min(...s);return(o-i)*(Math.max(...s)-a)}function ql(e,t){const r=new Bl(e,!1);for(const e of r.instructions)t.instructions.push(e)}function Kl(e,t){if("string"==typeof e){const t=document.createElement("div");t.innerHTML=e.trim(),e=t.querySelector("svg")}const r={context:t,defs:{},path:new Bl};Ol(e,r);const n=e.children,{fillStyle:s,strokeStyle:i}=zl(e,r);for(let e=0;e<n.length;e++){const t=n[e];"defs"!==t.nodeName.toLowerCase()&&Zl(t,r,s,i)}return t}function Zl(e,t,r,n){const s=e.children,{fillStyle:i,strokeStyle:o}=zl(e,t);i&&r?r={...r,...i}:i&&(r=i),o&&n?n={...n,...o}:o&&(n=o);const a=!r&&!n;let l,u,h,c,d,p,f,m,g,_,x,b,y,v,T,S,w;switch(a&&(r={color:0}),e.nodeName.toLowerCase()){case"path":{v=e.getAttribute("d");const s=e.getAttribute("fill-rule"),i=Yl(v),o="evenodd"===s,a=i.length>1;if(o&&a){const e=i.map(e=>({path:e,area:jl(e)}));e.sort((e,t)=>t.area-e.area);if(i.length>3||!Wl(e))for(let s=0;s<e.length;s++){const i=e[s],o=0===s;t.context.beginPath();const a=new Bl(void 0,!0);ql(i.path,a),t.context.path(a),o?(r&&t.context.fill(r),n&&t.context.stroke(n)):t.context.cut()}else for(let s=0;s<e.length;s++){const i=e[s],o=s%2==1;t.context.beginPath();const a=new Bl(void 0,!0);ql(i.path,a),t.context.path(a),o?t.context.cut():(r&&t.context.fill(r),n&&t.context.stroke(n))}}else{T=new Bl(v,!s||"evenodd"===s),t.context.path(T),r&&t.context.fill(r),n&&t.context.stroke(n)}break}case"circle":f=Il(e,"cx",0),m=Il(e,"cy",0),g=Il(e,"r",0),t.context.ellipse(f,m,g,g),r&&t.context.fill(r),n&&t.context.stroke(n);break;case"rect":l=Il(e,"x",0),u=Il(e,"y",0),S=Il(e,"width",0),w=Il(e,"height",0),_=Il(e,"rx",0),x=Il(e,"ry",0),_||x?t.context.roundRect(l,u,S,w,_||x):t.context.rect(l,u,S,w),r&&t.context.fill(r),n&&t.context.stroke(n);break;case"ellipse":f=Il(e,"cx",0),m=Il(e,"cy",0),_=Il(e,"rx",0),x=Il(e,"ry",0),t.context.beginPath(),t.context.ellipse(f,m,_,x),r&&t.context.fill(r),n&&t.context.stroke(n);break;case"line":h=Il(e,"x1",0),c=Il(e,"y1",0),d=Il(e,"x2",0),p=Il(e,"y2",0),t.context.beginPath(),t.context.moveTo(h,c),t.context.lineTo(d,p),n&&t.context.stroke(n);break;case"polygon":y=e.getAttribute("points"),b=y.match(/-?\d+/g).map(e=>parseInt(e,10)),t.context.poly(b,!0),r&&t.context.fill(r),n&&t.context.stroke(n);break;case"polyline":y=e.getAttribute("points"),b=y.match(/-?\d+/g).map(e=>parseInt(e,10)),t.context.poly(b,!1),n&&t.context.stroke(n);break;case"g":case"svg":break;default:Oe(`[SVG parser] <${e.nodeName}> elements unsupported`)}a&&(r=null);for(let e=0;e<s.length;e++)Zl(s[e],t,r,n)}const Ql={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class Jl{constructor(e,t){this.uid=G("fillPattern"),this._tick=0,this.transform=new _;const r=void 0!==e.texture?e:{texture:e,repetition:t};this.texture=r.texture,this.textureSpace=r.textureSpace??"global";const n=r.repetition;n&&(this.texture.source.style.addressModeU=Ql[n].addressModeU,this.texture.source.style.addressModeV=Ql[n].addressModeV)}setTransform(e){if(e){if(this.transform.equals(e))return;this.transform.copyFrom(e)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function eu(e){return e instanceof Jl}function tu(e){return e instanceof Qa}function ru(e,t,r){return e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,e.textureSpace=t.textureSpace,{...r,...e}}function nu(e,t,r){return t.buildGradient(),e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,e.textureSpace=t.textureSpace,{...r,...e}}function su(e,t){if(null==e)return null;const r={},n=e;return function(e){return Be.isColorLike(e)}(e)?function(e,t,r){const n=Be.shared.setValue(t??0);return e.color=n.toNumber(),e.alpha=1===n.alpha?r.alpha:n.alpha,e.texture=ee.WHITE,{...r,...e}}(r,e,t):function(e){return e instanceof ee}(e)?function(e,t,r){return e.texture=t,{...r,...e}}(r,e,t):eu(e)?ru(r,e,t):tu(e)?nu(r,e,t):n.fill&&eu(n.fill)?ru(n,n.fill,t):n.fill&&tu(n.fill)?nu(n,n.fill,t):function(e,t){const r={...t,...e},n=Be.shared.setValue(r.color);return r.alpha*=n.alpha,r.color=n.toNumber(),r}(n,t)}function iu(e,t){const{width:r,alignment:n,miterLimit:s,cap:i,join:o,pixelLine:a,...l}=t,u=su(e,l);return u?{width:r,alignment:n,miterLimit:s,cap:i,join:o,pixelLine:a,...u}:null}function ou(e,t){let r=1;const n=e.shapePath.shapePrimitives;for(let e=0;e<n.length;e++){const s=n[e].shape;if("polygon"!==s.type)continue;const i=s.points,o=i.length;if(o<6)continue;const a=s.closePath;for(let e=0;e<o;e+=2){if(!a&&(0===e||e===o-2))continue;const n=(e-2+o)%o,s=(e+2)%o,l=i[n],u=i[n+1],h=i[e],c=i[e+1],d=l-h,p=u-c,f=i[s]-h,m=i[s+1]-c,g=d*d+p*p,_=f*f+m*m;if(g<1e-12||_<1e-12)continue;let x=(d*f+p*m)/Math.sqrt(g*_);x<-1?x=-1:x>1&&(x=1);const b=Math.sqrt(.5*(1-x));if(b<1e-6)continue;const y=Math.min(1/b,t);y>r&&(r=y)}}return r}const au=new m,lu=new _,uu=class e extends c{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=G("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new Bl,this._transform=new _,this._fillStyle={...e.defaultFillStyle},this._strokeStyle={...e.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new ne,this._boundsDirty=!0}clone(){const t=new e;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=su(t,e.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=iu(t,e.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=su(t,e.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=su(t,e.defaultStrokeStyle),this}texture(e,t,r,n,s,i){return this.instructions.push({action:"texture",data:{image:e,dx:r||0,dy:n||0,dw:s||e.frame.width,dh:i||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:t||0===t?Be.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Bl,this}fill(t,r){let n;const s=this.instructions[this.instructions.length-1];return n=0===this._tick&&"stroke"===s?.action?s.data.path:this._activePath.clone(),n?(null!=t&&(void 0!==r&&"number"==typeof t&&(L(I,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:r}),this._fillStyle=su(t,e.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:e,y:t}=this._activePath.getLastPoint(m.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(t){let r;const n=this.instructions[this.instructions.length-1];return r=0===this._tick&&"fill"===n?.action?n.data.path:this._activePath.clone(),r?(null!=t&&(this._strokeStyle=iu(t,e.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){const t=this.instructions[this.instructions.length-1-e],r=this._activePath.clone();if(t&&("stroke"===t.action||"fill"===t.action)){if(!t.data.hole){t.data.hole=r;break}t.data.hole.addPath(r)}}return this._initNextPathLocation(),this}arc(e,t,r,n,s,i){this._tick++;const o=this._transform;return this._activePath.arc(o.a*e+o.c*t+o.tx,o.b*e+o.d*t+o.ty,r,n,s,i),this}arcTo(e,t,r,n,s){this._tick++;const i=this._transform;return this._activePath.arcTo(i.a*e+i.c*t+i.tx,i.b*e+i.d*t+i.ty,i.a*r+i.c*n+i.tx,i.b*r+i.d*n+i.ty,s),this}arcToSvg(e,t,r,n,s,i,o){this._tick++;const a=this._transform;return this._activePath.arcToSvg(e,t,r,n,s,a.a*i+a.c*o+a.tx,a.b*i+a.d*o+a.ty),this}bezierCurveTo(e,t,r,n,s,i,o){this._tick++;const a=this._transform;return this._activePath.bezierCurveTo(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,a.a*s+a.c*i+a.tx,a.b*s+a.d*i+a.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,t,r,n){return this._tick++,this._activePath.ellipse(e,t,r,n,this._transform.clone()),this}circle(e,t,r){return this._tick++,this._activePath.circle(e,t,r,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*e+r.c*t+r.tx,r.b*e+r.d*t+r.ty),this}moveTo(e,t){this._tick++;const r=this._transform,n=this._activePath.instructions,s=r.a*e+r.c*t+r.tx,i=r.b*e+r.d*t+r.ty;return 1===n.length&&"moveTo"===n[0].action?(n[0].data[0]=s,n[0].data[1]=i,this):(this._activePath.moveTo(s,i),this)}quadraticCurveTo(e,t,r,n,s){this._tick++;const i=this._transform;return this._activePath.quadraticCurveTo(i.a*e+i.c*t+i.tx,i.b*e+i.d*t+i.ty,i.a*r+i.c*n+i.tx,i.b*r+i.d*n+i.ty,s),this}rect(e,t,r,n){return this._tick++,this._activePath.rect(e,t,r,n,this._transform.clone()),this}roundRect(e,t,r,n,s){return this._tick++,this._activePath.roundRect(e,t,r,n,s,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,r,n,s=0,i){return this._tick++,this._activePath.regularPoly(e,t,r,n,s,i),this}roundPoly(e,t,r,n,s,i){return this._tick++,this._activePath.roundPoly(e,t,r,n,s,i),this}roundShape(e,t,r,n){return this._tick++,this._activePath.roundShape(e,t,r,n),this}filletRect(e,t,r,n,s){return this._tick++,this._activePath.filletRect(e,t,r,n,s),this}chamferRect(e,t,r,n,s,i){return this._tick++,this._activePath.chamferRect(e,t,r,n,s,i),this}star(e,t,r,n,s=0,i=0){return this._tick++,this._activePath.star(e,t,r,n,s,i,this._transform.clone()),this}svg(e){return this._tick++,Kl(e,this),this}restore(){const e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,t=e){return this._transform.scale(e,t),this}setTransform(e,t,r,n,s,i){return e instanceof _?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,r,n,s,i),this)}transform(e,t,r,n,s,i){return e instanceof _?(this._transform.append(e),this):(lu.set(e,t,r,n,s,i),this._transform.append(lu),this)}translate(e,t=e){return this._transform.translate(e,t),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const e=this._bounds;e.clear();for(let t=0;t<this.instructions.length;t++){const r=this.instructions[t],n=r.action;if("fill"===n){const t=r.data;e.addBounds(t.path.bounds)}else if("texture"===n){const t=r.data;e.addFrame(t.dx,t.dy,t.dx+t.dw,t.dy+t.dh,t.transform)}if("stroke"===n){const t=r.data,n=t.style.alignment;let s=t.style.width*(1-n);"miter"===t.style.join&&(s*=ou(t.path,t.style.miterLimit));const i=t.path.bounds;e.addFrame(i.minX-s,i.minY-s,i.maxX+s,i.maxY+s)}}return e.isValid||e.set(0,0,0,0),e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;const t=this.instructions;let r=!1;for(let n=0;n<t.length;n++){const s=t[n],i=s.data,o=i.path;if(!s.action||!o)continue;const a=i.style,l=o.shapePath.shapePrimitives;for(let t=0;t<l.length;t++){const n=l[t].shape;if(!a||!n)continue;const o=l[t].transform,u=o?o.applyInverse(e,au):e;if("fill"===s.action)r=n.contains(u.x,u.y);else{const e=a;r=n.strokeContains(u.x,u.y,e.width,e.alignment)}const h=i.hole;if(h){const e=h.shapePath?.shapePrimitives;if(e)for(let t=0;t<e.length;t++)e[t].shape.contains(u.x,u.y)&&(r=!1)}if(r)return!0}}return r}unload(){this.emit("unload",this);for(const e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null)}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners();if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(t)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(t))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};uu.defaultFillStyle={color:16777215,alpha:1,texture:ee.WHITE,matrix:null,fill:null,textureSpace:"local"},uu.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:ee.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let hu=uu;function cu(e,t=1){const r=xr.RETINA_PREFIX?.exec(e);return r?parseFloat(r[1]):t}function du(e,t,r){e.label=r,e._sourceOrigin=r;const n=new ee({source:e,label:r}),s=()=>{delete t.promiseCache[r],ir.has(r)&&ir.remove(r)};return n.source.once("destroy",()=>{t.promiseCache[r]&&(Oe("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),n.once("destroy",()=>{e.destroyed||(Oe("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),n}const pu={extension:{type:e.LoadParser,priority:cr.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test:e=>zi(e,"image/svg+xml")||Vi(e,".svg"),async load(e,t,r){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?async function(e){const t=await Yt.get().fetch(e),r=await t.text(),n=new hu;return n.svg(r),n}(e):async function(e,t,r,n){const s=await Yt.get().fetch(e),i=Yt.get().createImage();i.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await s.text())}`,i.crossOrigin=n,await i.decode();const o=t.data?.width??i.width,a=t.data?.height??i.height,l=t.data?.resolution||cu(e),u=Math.ceil(o*l),h=Math.ceil(a*l),c=Yt.get().createCanvas(u,h),d=c.getContext("2d");d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(i,0,0,o*l,a*l);const{parseAsGraphicsContext:p,...f}=t.data??{};return du(new qt({resource:c,alphaMode:"premultiply-alpha-on-upload",resolution:l,...f}),r,e)}(e,t,r,this.config.crossOrigin)},unload(e){e.destroy(!0)}};let fu=null,mu=class{constructor(){fu||(fu=URL.createObjectURL(new Blob(['(function () {\n \'use strict\';\n\n const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";\n async function checkImageBitmap() {\n try {\n if (typeof createImageBitmap !== "function") return false;\n const response = await fetch(WHITE_PNG);\n const imageBlob = await response.blob();\n const imageBitmap = await createImageBitmap(imageBlob);\n return imageBitmap.width === 1 && imageBitmap.height === 1;\n } catch (_e) {\n return false;\n }\n }\n void checkImageBitmap().then((result) => {\n self.postMessage(result);\n });\n\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(fu)}};mu.revokeObjectURL=function(){fu&&(URL.revokeObjectURL(fu),fu=null)};let gu=null,_u=class{constructor(){gu||(gu=URL.createObjectURL(new Blob(['(function () {\n \'use strict\';\n\n async function loadImageBitmap(url, alphaMode) {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${url}: ${response.status} ${response.statusText}`);\n }\n const imageBlob = await response.blob();\n return alphaMode === "premultiplied-alpha" ? createImageBitmap(imageBlob, { premultiplyAlpha: "none" }) : createImageBitmap(imageBlob);\n }\n self.onmessage = async (event) => {\n try {\n const imageBitmap = await loadImageBitmap(event.data.data[0], event.data.data[1]);\n self.postMessage({\n data: imageBitmap,\n uuid: event.data.uuid,\n id: event.data.id\n }, [imageBitmap]);\n } catch (e) {\n self.postMessage({\n error: e,\n uuid: event.data.uuid,\n id: event.data.id\n });\n }\n };\n\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(gu)}};_u.revokeObjectURL=function(){gu&&(URL.revokeObjectURL(gu),gu=null)};let xu,bu=0;const yu=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise(e=>{const{worker:t}=new mu;t.addEventListener("message",r=>{t.terminate(),mu.revokeObjectURL(),e(r.data)})})),this._isImageBitmapSupported}loadImageBitmap(e,t){return this._run("loadImageBitmap",[e,t?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){void 0===xu&&(xu=navigator.hardwareConcurrency||4);let e=this._workerPool.pop();return!e&&this._createdWorkers<xu&&(this._createdWorkers++,e=(new _u).worker,e.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),e}_returnWorker(e){this._workerPool.push(e)}_complete(e){this._resolveHash[e.uuid]&&(void 0!==e.error?this._resolveHash[e.uuid].reject(e.error):this._resolveHash[e.uuid].resolve(e.data),delete this._resolveHash[e.uuid])}async _run(e,t){await this._initWorkers();const r=new Promise((r,n)=>{this._queue.push({id:e,arguments:t,resolve:r,reject:n})});return this._next(),r}_next(){if(!this._queue.length)return;const e=this._getWorker();if(!e)return;const t=this._queue.pop(),r=t.id;this._resolveHash[bu]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:bu++,id:r})}reset(){this._workerPool.forEach(e=>e.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:e})=>{e?.(new Error("WorkerManager has been reset before completion"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}},vu=[".jpeg",".jpg",".png",".webp",".avif"],Tu=["image/jpeg","image/png","image/webp","image/avif"];async function Su(e,t){const r=await Yt.get().fetch(e);if(!r.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${e}: ${r.status} ${r.statusText}`);const n=await r.blob();return"premultiplied-alpha"===t?.data?.alphaMode?createImageBitmap(n,{premultiplyAlpha:"none"}):createImageBitmap(n)}const wu={name:"loadTextures",id:"texture",extension:{type:e.LoadParser,priority:cr.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:e=>zi(e,Tu)||Vi(e,vu),async load(e,t,r){let n=null;n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await yu.isImageBitmapSupported()?await yu.loadImageBitmap(e,t):await Su(e,t):await new Promise((t,r)=>{n=Yt.get().createImage(),n.crossOrigin=this.config.crossOrigin,n.src=e,n.complete?t(n):(n.onload=()=>{t(n)},n.onerror=r)});return du(new qt({resource:n,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||cu(e),...t.data}),r,e)},unload(e){e.destroy(!0)}},Eu=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"];let Au,Ru;function Cu(e,t,r){void 0!==r||t.startsWith("data:")?!1!==r&&(e.crossOrigin="string"==typeof r?r:"anonymous"):e.crossOrigin=Pu(t)}function Mu(e){return new Promise((t,r)=>{function n(){i(),t()}function s(e){i(),r(e)}function i(){e.removeEventListener("canplaythrough",n),e.removeEventListener("error",s)}e.addEventListener("canplaythrough",n),e.addEventListener("error",s),e.load()})}function Pu(e,t=globalThis.location){if(e.startsWith("data:"))return"";t||(t=globalThis.location);const r=new URL(e,document.baseURI);return r.hostname!==t.hostname||r.port!==t.port||r.protocol!==t.protocol?"anonymous":""}const Gu={name:"loadVideo",id:"video",extension:{type:e.LoadParser,name:"loadVideo"},test(e){if(!Au||!Ru){const{validVideoExtensions:e,validVideoMime:t}=function(){const e=[],t=[];for(const r of Eu){const n=nr.MIME_TYPES[r.substring(1)]||`video/${r.substring(1)}`;Di(n)&&(e.push(r),t.includes(n)||t.push(n))}return{validVideoExtensions:e,validVideoMime:t}}();Au=e,Ru=t}const t=zi(e,Ru),r=Vi(e,Au);return t||r},async load(e,t,r){const n={...nr.defaultOptions,resolution:t.data?.resolution||cu(e),alphaMode:t.data?.alphaMode||await tr(),...t.data},s=document.createElement("video"),i={preload:!1!==n.autoLoad?"auto":void 0,"webkit-playsinline":!1!==n.playsinline?"":void 0,playsinline:!1!==n.playsinline?"":void 0,muted:!0===n.muted?"":void 0,loop:!0===n.loop?"":void 0,autoplay:!1!==n.autoPlay?"":void 0};Object.keys(i).forEach(e=>{const t=i[e];void 0!==t&&s.setAttribute(e,t)}),!0===n.muted&&(s.muted=!0),Cu(s,e,n.crossorigin);const o=document.createElement("source");let a;if(n.mime)a=n.mime;else if(e.startsWith("data:"))a=e.slice(5,e.indexOf(";"));else if(!e.startsWith("blob:")){const t=e.split("?")[0].slice(e.lastIndexOf(".")+1).toLowerCase();a=nr.MIME_TYPES[t]||`video/${t}`}return o.src=e,a&&(o.type=a),new Promise((i,a)=>{async function l(){const o=new nr({...n,resource:s});h(),t.data.preload&&await Mu(s),i(du(o,r,e))}function u(e){h(),a(e)}function h(){s.removeEventListener("canplay",l),s.removeEventListener("error",u),o.removeEventListener("error",u)}n.preload&&!n.autoPlay&&s.load(),s.addEventListener("canplay",l),s.addEventListener("error",u),o.addEventListener("error",u),s.appendChild(o)})},unload(e){e.destroy(!0)}},Bu={extension:{type:e.ResolveParser,name:"resolveTexture"},test:wu.test,parse:e=>({resolution:parseFloat(xr.RETINA_PREFIX.exec(e)?.[1]??"1"),format:e.split(".").pop(),src:e})},Fu={extension:{type:e.ResolveParser,priority:-2,name:"resolveJson"},test:e=>xr.RETINA_PREFIX.test(e)&&e.endsWith(".json"),parse:Bu.parse};class Iu{constructor(){this._detections=[],this._initialized=!1,this.resolver=new xr,this.loader=new Hi,this.cache=ir,this._backgroundLoader=new Mi(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized)return void Oe("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let t=e.manifest;"string"==typeof t&&(t=await this.load(t)),this.resolver.addManifest(t)}const t=e.texturePreference?.resolution??1,r="number"==typeof t?[t]:t,n=await this._detectFormats({preferredFormats:e.texturePreference?.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:n,resolution:r}}),e.preferences&&this.setPreferences(e.preferences),e.loadOptions&&(this.loader.loadOptions={...this.loader.loadOptions,...e.loadOptions})}add(e){this.resolver.add(e)}async load(e,t){this._initialized||await this.init();const r=_r(e),n=sr(e).map(e=>{if("string"!=typeof e){const t=this.resolver.getAlias(e);return t.some(e=>!this.resolver.hasKey(e))&&this.add(e),Array.isArray(t)?t[0]:t}return this.resolver.hasKey(e)||this.add({alias:e,src:e}),e}),s=this.resolver.resolve(n),i=await this._mapLoadToResolve(s,t);return r?i[n[0]]:i}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let r=!1;"string"==typeof e&&(r=!0,e=[e]);const n=this.resolver.resolveBundle(e),s={},i=Object.keys(n);let o=0;const a=[],l=i.map((e,r)=>{const i=n[e],l=Object.values(i),u=[...new Set(l.flat())].reduce((e,t)=>e+(t.progressSize||1),0);return a.push(0),o+=u,this._mapLoadToResolve(i,e=>{a[r]=e*u,t?.(a.reduce((e,t)=>e+t,0)/o)}).then(t=>{s[e]=t})});return await Promise.all(l),r?s[e[0]]:s}async backgroundLoad(e){this._initialized||await this.init(),"string"==typeof e&&(e=[e]);const t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),"string"==typeof e&&(e=[e]);const t=this.resolver.resolveBundle(e);Object.values(t).forEach(e=>{this._backgroundLoader.add(Object.values(e))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if("string"==typeof e)return ir.get(e);const t={};for(let r=0;r<e.length;r++)t[r]=ir.get(e[r]);return t}async _mapLoadToResolve(e,t){const r=[...new Set(Object.values(e))];this._backgroundLoader.active=!1;const n=await this.loader.load(r,t);this._backgroundLoader.active=!0;const s={};return r.forEach(e=>{const t=n[e.src],r=[e.src];e.alias&&r.push(...e.alias),r.forEach(e=>{s[e]=t}),ir.set(r,t)}),s}async unload(e){this._initialized||await this.init();const t=sr(e).map(e=>"string"!=typeof e?e.src:e),r=this.resolver.resolve(t);await this._unloadFromResolved(r)}async unloadBundle(e){this._initialized||await this.init(),e=sr(e);const t=this.resolver.resolveBundle(e),r=Object.keys(t).map(e=>this._unloadFromResolved(t[e]));await Promise.all(r)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(e=>{ir.remove(e.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(const r of e.detections)e.skipDetections||await r.test()?t=await r.add(t):e.skipDetections||(t=await r.remove(t));return t=t.filter((e,r)=>t.indexOf(e)===r),t}get detections(){return this._detections}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(t=>t in e).forEach(r=>{t.config[r]=e[r]})})}}const Ou=new Iu;n.handleByList(e.LoadParser,Ou.loader.parsers).handleByList(e.ResolveParser,Ou.resolver.parsers).handleByList(e.CacheParser,Ou.cache.parsers).handleByList(e.DetectionParser,Ou.detections),n.add(Pi,Ii,Bi,Ni,Ui,ki,Li,Wi,$i,eo,pu,wu,Gu,Ci,Ri,Bu,Fu);const Du={loader:e.LoadParser,resolver:e.ResolveParser,cache:e.CacheParser,detection:e.DetectionParser};n.handle(e.Asset,e=>{const t=e.ref;Object.entries(Du).filter(([e])=>!!t[e]).forEach(([e,r])=>n.add(Object.assign(t[e],{extension:t[e].extension??r})))},e=>{const t=e.ref;Object.keys(Du).filter(e=>!!t[e]).forEach(e=>n.remove(t[e]))});const Uu={extension:{type:e.DetectionParser,priority:3},test:async()=>!!await di()||!!ci(),add:async e=>[...e,"basis"],remove:async e=>e.filter(e=>"basis"!==e)};class ku extends K{constructor(e){super({...e,mipLevelCount:e.resource.length}),this.uploadMethodId="compressed"}}let Lu,Nu,Xu;function Hu(){if(Lu)return Lu;const e=Yt.get().createCanvas(1,1).getContext("webgl");return e?(Lu=[...e.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...e.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...e.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...e.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...e.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...e.getExtension("WEBGL_compressed_texture_astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Lu):[]}async function zu(){if(Nu)return Nu;const e=await Yt.get().getNavigator().gpu.requestAdapter();return Nu=[...e.features.has("texture-compression-bc")?["bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...e.features.has("texture-compression-etc2")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"]:[],...e.features.has("texture-compression-astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Nu}async function Vu(){return void 0!==Xu||(Xu=await(async()=>{const e=await di(),t=ci();if(e&&t){const e=await zu(),t=Hu();return e.filter(e=>t.includes(e))}return e?await zu():t?Hu():[]})()),Xu}const Wu=["r8unorm","r8snorm","r8uint","r8sint","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];let $u;async function Yu(){if(void 0!==$u)return $u;const e=await Vu();return $u=[...Wu,...e],$u}let ju=null,qu=class{constructor(){ju||(ju=URL.createObjectURL(new Blob(['(function () {\n \'use strict\';\n\n function createLevelBuffers(basisTexture, basisTranscoderFormat) {\n const images = basisTexture.getNumImages();\n const levels = basisTexture.getNumLevels(0);\n const success = basisTexture.startTranscoding();\n if (!success) {\n throw new Error("startTranscoding failed");\n }\n const levelBuffers = [];\n for (let levelIndex = 0; levelIndex < levels; ++levelIndex) {\n for (let sliceIndex = 0; sliceIndex < images; ++sliceIndex) {\n const transcodeSize = basisTexture.getImageTranscodedSizeInBytes(sliceIndex, levelIndex, basisTranscoderFormat);\n const levelBuffer = new Uint8Array(transcodeSize);\n const success2 = basisTexture.transcodeImage(levelBuffer, sliceIndex, levelIndex, basisTranscoderFormat, 1, 0);\n if (!success2) {\n throw new Error("transcodeImage failed");\n }\n levelBuffers.push(levelBuffer);\n }\n }\n return levelBuffers;\n }\n\n const gpuFormatToBasisTranscoderFormatMap = {\n "bc3-rgba-unorm": 3,\n // cTFBC3_RGBA\n "bc7-rgba-unorm": 6,\n // cTFBC7_RGBA,\n "etc2-rgba8unorm": 1,\n // cTFETC2_RGBA,\n "astc-4x4-unorm": 10,\n // cTFASTC_4x4_RGBA,\n // Uncompressed\n rgba8unorm: 13,\n // cTFRGBA32,\n rgba4unorm: 16\n // cTFRGBA4444,\n };\n function gpuFormatToBasisTranscoderFormat(transcoderFormat) {\n const format = gpuFormatToBasisTranscoderFormatMap[transcoderFormat];\n if (format) {\n return format;\n }\n throw new Error(`Unsupported transcoderFormat: ${transcoderFormat}`);\n }\n\n const settings = {\n jsUrl: "basis/basis_transcoder.js",\n wasmUrl: "basis/basis_transcoder.wasm"\n };\n let basisTranscoderFormat;\n let basisTranscodedTextureFormat;\n let basisPromise;\n async function getBasis() {\n if (!basisPromise) {\n const absoluteJsUrl = new URL(settings.jsUrl, location.origin).href;\n const absoluteWasmUrl = new URL(settings.wasmUrl, location.origin).href;\n importScripts(absoluteJsUrl);\n basisPromise = new Promise((resolve) => {\n BASIS({\n locateFile: (_file) => absoluteWasmUrl\n }).then((module) => {\n module.initializeBasis();\n resolve(module.BasisFile);\n });\n });\n }\n return basisPromise;\n }\n async function fetchBasisTexture(url, BasisTexture) {\n const basisResponse = await fetch(url);\n if (basisResponse.ok) {\n const basisArrayBuffer = await basisResponse.arrayBuffer();\n return new BasisTexture(new Uint8Array(basisArrayBuffer));\n }\n throw new Error(`Failed to load Basis texture: ${url}`);\n }\n const preferredTranscodedFormat = [\n "bc7-rgba-unorm",\n "astc-4x4-unorm",\n "etc2-rgba8unorm",\n "bc3-rgba-unorm",\n "rgba8unorm"\n ];\n async function load(url) {\n const BasisTexture = await getBasis();\n const basisTexture = await fetchBasisTexture(url, BasisTexture);\n const levelBuffers = createLevelBuffers(basisTexture, basisTranscoderFormat);\n return {\n width: basisTexture.getImageWidth(0, 0),\n height: basisTexture.getImageHeight(0, 0),\n format: basisTranscodedTextureFormat,\n resource: levelBuffers,\n alphaMode: "no-premultiply-alpha"\n };\n }\n async function init(jsUrl, wasmUrl, supportedTextures) {\n if (jsUrl) settings.jsUrl = jsUrl;\n if (wasmUrl) settings.wasmUrl = wasmUrl;\n basisTranscodedTextureFormat = preferredTranscodedFormat.filter((format) => supportedTextures.includes(format))[0];\n basisTranscoderFormat = gpuFormatToBasisTranscoderFormat(basisTranscodedTextureFormat);\n await getBasis();\n }\n const messageHandlers = {\n init: async (data) => {\n const { jsUrl, wasmUrl, supportedTextures } = data;\n await init(jsUrl, wasmUrl, supportedTextures);\n },\n load: async (data) => {\n try {\n const textureOptions = await load(data.url);\n return {\n type: "load",\n url: data.url,\n success: true,\n textureOptions,\n transferables: textureOptions.resource?.map((arr) => arr.buffer)\n };\n } catch (e) {\n throw e;\n }\n }\n };\n self.onmessage = (async (messageEvent) => {\n const message = messageEvent.data;\n const response = await messageHandlers[message.type](message);\n if (response) {\n self.postMessage(response, response.transferables);\n }\n });\n\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(ju)}};qu.revokeObjectURL=function(){ju&&(URL.revokeObjectURL(ju),ju=null)};const Ku={jsUrl:"https://cdn.jsdelivr.net/npm/pixi.js/transcoders/basis/basis_transcoder.js",wasmUrl:"https://cdn.jsdelivr.net/npm/pixi.js/transcoders/basis/basis_transcoder.wasm"};function Zu(e){Object.assign(Ku,e)}let Qu;const Ju={};function eh(e,t){const r=function(e){return Qu||(Qu=(new qu).worker,Qu.onmessage=e=>{const{success:t,url:r,textureOptions:n}=e.data;t||console.warn("Failed to load Basis texture",r),Ju[r](n)},Qu.postMessage({type:"init",jsUrl:Ku.jsUrl,wasmUrl:Ku.wasmUrl,supportedTextures:e})),Qu}(t);return new Promise(t=>{Ju[e]=t,r.postMessage({type:"load",url:e})})}const th={extension:{type:e.LoadParser,priority:cr.High,name:"loadBasis"},name:"loadBasis",id:"basis",test:e=>Vi(e,[".basis"]),async load(e,t,r){const n=await Yu(),s=await eh(e,n);return du(new ku({...s,resolution:t.data?.resolution||cu(e)}),r,e)},unload(e){Array.isArray(e)?e.forEach(e=>e.destroy(!0)):e.destroy(!0)}};function rh(e,t){const r=e.getNumImages(),n=e.getNumLevels(0);if(!e.startTranscoding())throw new Error("startTranscoding failed");const s=[];for(let i=0;i<n;++i)for(let n=0;n<r;++n){const r=e.getImageTranscodedSizeInBytes(n,i,t),o=new Uint8Array(r);if(!e.transcodeImage(o,n,i,t,1,0))throw new Error("transcodeImage failed");s.push(o)}return s}const nh={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function sh(e){const t=nh[e];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${e}`)}var ih=(e=>(e[e.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",e[e.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",e[e.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",e[e.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",e[e.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",e[e.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",e[e.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",e[e.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",e[e.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",e[e.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",e[e.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",e[e.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",e[e.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",e[e.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",e[e.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",e[e.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",e[e.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",e[e.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",e[e.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",e[e.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",e[e.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",e[e.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",e[e.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",e[e.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",e[e.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",e[e.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",e[e.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",e[e.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",e[e.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",e[e.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",e[e.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",e[e.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",e[e.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",e[e.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",e[e.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",e[e.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",e[e.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",e[e.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",e[e.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",e[e.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",e[e.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",e[e.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",e[e.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",e[e.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",e[e.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",e[e.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",e[e.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",e[e.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",e[e.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",e[e.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",e[e.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",e[e.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",e[e.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",e[e.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",e[e.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",e[e.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",e[e.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",e[e.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",e[e.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",e[e.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",e[e.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",e[e.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",e[e.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",e[e.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",e[e.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",e[e.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",e[e.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",e[e.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",e[e.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",e[e.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",e[e.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",e[e.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",e[e.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",e[e.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",e[e.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",e[e.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",e[e.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",e[e.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",e[e.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",e[e.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",e[e.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",e[e.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",e[e.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",e[e.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",e[e.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",e[e.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",e[e.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",e[e.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",e[e.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",e[e.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",e[e.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",e[e.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",e[e.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",e[e.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",e[e.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",e[e.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",e[e.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",e[e.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",e[e.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",e[e.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",e[e.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",e[e.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",e[e.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",e[e.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",e[e.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",e[e.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",e[e.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",e[e.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",e[e.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",e[e.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",e[e.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",e[e.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",e[e.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",e[e.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",e[e.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",e[e.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",e[e.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",e[e.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",e[e.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",e[e.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",e[e.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",e[e.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",e))(ih||{}),oh=(e=>(e[e.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",e[e.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",e[e.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",e))(oh||{});function ah(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var lh,uh=((lh=uh||{})[lh.UNKNOWN=0]="UNKNOWN",lh[lh.R8G8B8=20]="R8G8B8",lh[lh.A8R8G8B8=21]="A8R8G8B8",lh[lh.X8R8G8B8=22]="X8R8G8B8",lh[lh.R5G6B5=23]="R5G6B5",lh[lh.X1R5G5B5=24]="X1R5G5B5",lh[lh.A1R5G5B5=25]="A1R5G5B5",lh[lh.A4R4G4B4=26]="A4R4G4B4",lh[lh.R3G3B2=27]="R3G3B2",lh[lh.A8=28]="A8",lh[lh.A8R3G3B2=29]="A8R3G3B2",lh[lh.X4R4G4B4=30]="X4R4G4B4",lh[lh.A2B10G10R10=31]="A2B10G10R10",lh[lh.A8B8G8R8=32]="A8B8G8R8",lh[lh.X8B8G8R8=33]="X8B8G8R8",lh[lh.G16R16=34]="G16R16",lh[lh.A2R10G10B10=35]="A2R10G10B10",lh[lh.A16B16G16R16=36]="A16B16G16R16",lh[lh.A8P8=40]="A8P8",lh[lh.P8=41]="P8",lh[lh.L8=50]="L8",lh[lh.A8L8=51]="A8L8",lh[lh.A4L4=52]="A4L4",lh[lh.V8U8=60]="V8U8",lh[lh.L6V5U5=61]="L6V5U5",lh[lh.X8L8V8U8=62]="X8L8V8U8",lh[lh.Q8W8V8U8=63]="Q8W8V8U8",lh[lh.V16U16=64]="V16U16",lh[lh.A2W10V10U10=67]="A2W10V10U10",lh[lh.Q16W16V16U16=110]="Q16W16V16U16",lh[lh.R16F=111]="R16F",lh[lh.G16R16F=112]="G16R16F",lh[lh.A16B16G16R16F=113]="A16B16G16R16F",lh[lh.R32F=114]="R32F",lh[lh.G32R32F=115]="G32R32F",lh[lh.A32B32G32R32F=116]="A32B32G32R32F",lh[lh.UYVY=ah("UYVY")]="UYVY",lh[lh.R8G8_B8G8=ah("RGBG")]="R8G8_B8G8",lh[lh.YUY2=ah("YUY2")]="YUY2",lh[lh.D3DFMT_G8R8_G8B8=ah("GRGB")]="D3DFMT_G8R8_G8B8",lh[lh.DXT1=ah("DXT1")]="DXT1",lh[lh.DXT2=ah("DXT2")]="DXT2",lh[lh.DXT3=ah("DXT3")]="DXT3",lh[lh.DXT4=ah("DXT4")]="DXT4",lh[lh.DXT5=ah("DXT5")]="DXT5",lh[lh.ATI1=ah("ATI1")]="ATI1",lh[lh.AT1N=ah("AT1N")]="AT1N",lh[lh.ATI2=ah("ATI2")]="ATI2",lh[lh.AT2N=ah("AT2N")]="AT2N",lh[lh.BC4U=ah("BC4U")]="BC4U",lh[lh.BC4S=ah("BC4S")]="BC4S",lh[lh.BC5U=ah("BC5U")]="BC5U",lh[lh.BC5S=ah("BC5S")]="BC5S",lh[lh.DX10=ah("DX10")]="DX10",lh);const hh={[uh.DXT1]:"bc1-rgba-unorm",[uh.DXT2]:"bc2-rgba-unorm",[uh.DXT3]:"bc2-rgba-unorm",[uh.DXT4]:"bc3-rgba-unorm",[uh.DXT5]:"bc3-rgba-unorm",[uh.ATI1]:"bc4-r-unorm",[uh.BC4U]:"bc4-r-unorm",[uh.BC4S]:"bc4-r-snorm",[uh.ATI2]:"bc5-rg-unorm",[uh.BC5U]:"bc5-rg-unorm",[uh.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},ch={70:"bc1-rgba-unorm",71:"bc1-rgba-unorm",72:"bc1-rgba-unorm-srgb",73:"bc2-rgba-unorm",74:"bc2-rgba-unorm",75:"bc2-rgba-unorm-srgb",76:"bc3-rgba-unorm",77:"bc3-rgba-unorm",78:"bc3-rgba-unorm-srgb",79:"bc4-r-unorm",80:"bc4-r-unorm",81:"bc4-r-snorm",82:"bc5-rg-unorm",83:"bc5-rg-unorm",84:"bc5-rg-snorm",94:"bc6h-rgb-ufloat",95:"bc6h-rgb-ufloat",96:"bc6h-rgb-float",97:"bc7-rgba-unorm",98:"bc7-rgba-unorm",99:"bc7-rgba-unorm-srgb",28:"rgba8unorm",29:"rgba8unorm-srgb",87:"bgra8unorm",91:"bgra8unorm-srgb",41:"r32float",49:"rg8unorm",56:"r16uint",61:"r8unorm",24:"rgb10a2unorm",11:"rgba16uint",13:"rgba16sint",10:"rgba16float",54:"r16float",34:"rg16float",16:"rg32float",2:"rgba32float"},dh={MAGIC_VALUE:542327876,MAGIC_SIZE:4,HEADER_SIZE:124,HEADER_DX10_SIZE:20,PIXEL_FORMAT_FLAGS:{ALPHAPIXELS:1,ALPHA:2,FOURCC:4,RGB:64,RGBA:65,YUV:512,LUMINANCE:131072,LUMINANCEA:131073},RESOURCE_MISC_TEXTURECUBE:4,HEADER_FIELDS:{MAGIC:0,SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19,PF_FLAGS:20,FOURCC:21,RGB_BITCOUNT:22,R_BIT_MASK:23,G_BIT_MASK:24,B_BIT_MASK:25,A_BIT_MASK:26},HEADER_DX10_FIELDS:{DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},DXGI_FORMAT:ih,D3D10_RESOURCE_DIMENSION:oh,D3DFMT:uh},ph={"bc1-rgba-unorm":8,"bc1-rgba-unorm-srgb":8,"bc2-rgba-unorm":16,"bc2-rgba-unorm-srgb":16,"bc3-rgba-unorm":16,"bc3-rgba-unorm-srgb":16,"bc4-r-unorm":8,"bc4-r-snorm":8,"bc5-rg-unorm":16,"bc5-rg-snorm":16,"bc6h-rgb-ufloat":16,"bc6h-rgb-float":16,"bc7-rgba-unorm":16,"bc7-rgba-unorm-srgb":16};function fh(e,t){const{format:r,fourCC:n,width:s,height:i,dataOffset:o,mipmapCount:a}=function(e){const t=new Uint32Array(e,0,dh.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[dh.HEADER_FIELDS.MAGIC]!==dh.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const r=t[dh.HEADER_FIELDS.HEIGHT],n=t[dh.HEADER_FIELDS.WIDTH],s=Math.max(1,t[dh.HEADER_FIELDS.MIPMAP_COUNT]),i=t[dh.HEADER_FIELDS.PF_FLAGS],o=t[dh.HEADER_FIELDS.FOURCC],a=function(e,t,r,n){if(t&dh.PIXEL_FORMAT_FLAGS.FOURCC){if(r===dh.D3DFMT.DX10){const e=new Uint32Array(n,dh.MAGIC_SIZE+dh.HEADER_SIZE,dh.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(e[dh.HEADER_DX10_FIELDS.MISC_FLAG]===dh.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(e[dh.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===dh.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const t=e[dh.HEADER_DX10_FIELDS.DXGI_FORMAT];if(t in ch)return ch[t];throw new Error(`DDSParser cannot parse texture data with DXGI format ${t}`)}if(r in hh)return hh[r];throw new Error(`DDSParser cannot parse texture data with fourCC format ${r}`)}if(t&dh.PIXEL_FORMAT_FLAGS.RGB||t&dh.PIXEL_FORMAT_FLAGS.RGBA)return function(e){const t=e[dh.HEADER_FIELDS.RGB_BITCOUNT],r=e[dh.HEADER_FIELDS.R_BIT_MASK],n=e[dh.HEADER_FIELDS.G_BIT_MASK],s=e[dh.HEADER_FIELDS.B_BIT_MASK],i=e[dh.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(255===r&&65280===n&&16711680===s&&4278190080===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(16711680===r&&65280===n&&255===s&&4278190080===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(1072693248===r&&1047552===n&&1023===s&&3221225472===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(65535===r&&4294901760===n&&0===s&&0===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(4294967295===r&&0===n&&0===s&&0===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(31744===r&&992===n&&31===s&&32768===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(63488===r&&2016===n&&31===s&&0===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(3840===r&&240===n&&15===s&&61440===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(255===r&&0===n&&0===s&&65280===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(65535===r&&0===n&&0===s&&0===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(255===r&&0===n&&0===s&&0===i)return ch[dh.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM]}throw new Error(`DDSParser does not support uncompressed texture with configuration:\n bitCount = ${t}, rBitMask = ${r}, gBitMask = ${n}, aBitMask = ${i}`)}(e);if(t&dh.PIXEL_FORMAT_FLAGS.YUV)throw new Error("DDSParser does not supported YUV uncompressed texture data.");if(t&dh.PIXEL_FORMAT_FLAGS.LUMINANCE||t&dh.PIXEL_FORMAT_FLAGS.LUMINANCEA)throw new Error("DDSParser does not support single-channel (lumninance) texture data!");if(t&dh.PIXEL_FORMAT_FLAGS.ALPHA||t&dh.PIXEL_FORMAT_FLAGS.ALPHAPIXELS)throw new Error("DDSParser does not support single-channel (alpha) texture data!");throw new Error("DDSParser failed to load a texture file due to an unknown reason!")}(t,i,o,e),l=dh.MAGIC_SIZE+dh.HEADER_SIZE+(o===dh.D3DFMT.DX10?dh.HEADER_DX10_SIZE:0);return{format:a,fourCC:o,width:n,height:r,dataOffset:l,mipmapCount:s}}(e);if(!t.includes(r))throw new Error(`Unsupported texture format: ${n} ${r}, supported: ${t}`);if(a<=1)return{format:r,width:s,height:i,resource:[new Uint8Array(e,o)],alphaMode:"no-premultiply-alpha"};const l=function(e,t,r,n,s,i){const o=[],a=ph[e];let l=t,u=r,h=n;for(let e=0;e<s;++e){const e=4*Math.ceil(Math.max(4,l)/4),t=4*Math.ceil(Math.max(4,u)/4),r=a?e/4*t/4*a:l*u*4,n=new Uint8Array(i,h,r);o.push(n),h+=r,l=Math.max(l>>1,1),u=Math.max(u>>1,1)}return o}(r,s,i,o,a,e);return{format:r,width:s,height:i,resource:l,alphaMode:"no-premultiply-alpha"}}const mh={extension:{type:e.LoadParser,priority:cr.High,name:"loadDDS"},name:"loadDDS",id:"dds",test:e=>Vi(e,[".dds"]),async load(e,t,r){const n=await Yu(),s=await fetch(e),i=fh(await s.arrayBuffer(),n);return du(new ku({...i,resolution:t.data?.resolution||cu(e)}),r,e)},unload(e){Array.isArray(e)?e.forEach(e=>e.destroy(!0)):e.destroy(!0)}};var gh=(e=>(e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGBA=6408]="RGBA",e[e.RGBA8UI=36220]="RGBA8UI",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.RGBA8I=36238]="RGBA8I",e[e.RGBA8=32856]="RGBA8",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e))(gh||{});const _h={FILE_HEADER_SIZE:64,FILE_IDENTIFIER:[171,75,84,88,32,49,49,187,13,10,26,10],FORMATS_TO_COMPONENTS:{6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:{33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},INTERNAL_FORMAT_TO_TEXTURE_FORMATS:{33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},FIELDS:{FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},TYPES_TO_BYTES_PER_COMPONENT:{5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},TYPES_TO_BYTES_PER_PIXEL:{32819:2,32820:2,33635:2},ENDIANNESS:67305985};function xh(e,t){const r=new DataView(e);if(!function(e){for(let t=0;t<_h.FILE_IDENTIFIER.length;t++)if(e.getUint8(t)!==_h.FILE_IDENTIFIER[t])return!1;return!0}(r))throw new Error("Invalid KTX identifier in header");const{littleEndian:n,glType:s,glFormat:i,glInternalFormat:o,pixelWidth:a,pixelHeight:l,numberOfMipmapLevels:u,offset:h}=function(e){const t=e.getUint32(_h.FIELDS.ENDIANNESS,!0)===_h.ENDIANNESS,r=e.getUint32(_h.FIELDS.GL_TYPE,t),n=e.getUint32(_h.FIELDS.GL_FORMAT,t),s=e.getUint32(_h.FIELDS.GL_INTERNAL_FORMAT,t),i=e.getUint32(_h.FIELDS.PIXEL_WIDTH,t),o=e.getUint32(_h.FIELDS.PIXEL_HEIGHT,t)||1,a=e.getUint32(_h.FIELDS.PIXEL_DEPTH,t)||1,l=e.getUint32(_h.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,t)||1,u=e.getUint32(_h.FIELDS.NUMBER_OF_FACES,t),h=e.getUint32(_h.FIELDS.NUMBER_OF_MIPMAP_LEVELS,t),c=e.getUint32(_h.FIELDS.BYTES_OF_KEY_VALUE_DATA,t);if(0===o||1!==a)throw new Error("Only 2D textures are supported");if(1!==u)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==l)throw new Error("WebGL does not support array textures");return{littleEndian:t,glType:r,glFormat:n,glInternalFormat:s,pixelWidth:i,pixelHeight:o,numberOfMipmapLevels:h,offset:_h.FILE_HEADER_SIZE+c}}(r),c=_h.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[o];if(!c)throw new Error(`Unknown texture format ${o}`);if(!t.includes(c))throw new Error(`Unsupported texture format: ${c}, supportedFormats: ${t}`);const d=function(e,t,r){let n=_h.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[r];0!==e&&(n=_h.TYPES_TO_BYTES_PER_COMPONENT[e]?_h.TYPES_TO_BYTES_PER_COMPONENT[e]*_h.FORMATS_TO_COMPONENTS[t]:_h.TYPES_TO_BYTES_PER_PIXEL[e]);if(void 0===n)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return n}(s,i,o),p=function(e,t,r,n,s,i,o,a){const l=n+3&-4,u=s+3&-4;let h=n*s;0===t&&(h=l*u);let c=h*r,d=n,p=s,f=l,m=u,g=i;const _=new Array(o);for(let t=0;t<o;t++){const n=e.getUint32(g,a);let s=g+4;_[t]=new Uint8Array(e.buffer,s,c),s+=c,g+=n+4,g=g%4!=0?g+4-g%4:g,d=d>>1||1,p=p>>1||1,f=d+4-1&-4,m=p+4-1&-4,c=f*m*r}return _}(r,s,d,a,l,h,u,n);return{format:c,width:a,height:l,resource:p,alphaMode:"no-premultiply-alpha"}}const bh={extension:{type:e.LoadParser,priority:cr.High,name:"loadKTX"},name:"loadKTX",id:"ktx",test:e=>Vi(e,".ktx"),async load(e,t,r){const n=await Yu(),s=await fetch(e),i=xh(await s.arrayBuffer(),n);return du(new ku({...i,resolution:t.data?.resolution||cu(e)}),r,e)},unload(e){Array.isArray(e)?e.forEach(e=>e.destroy(!0)):e.destroy(!0)}};let yh=null;class vh{constructor(){yh||(yh=URL.createObjectURL(new Blob(['(function () {\n \'use strict\';\n\n const converters = {\n rgb8unorm: {\n convertedFormat: "rgba8unorm",\n convertFunction: convertRGBtoRGBA\n },\n "rgb8unorm-srgb": {\n convertedFormat: "rgba8unorm-srgb",\n convertFunction: convertRGBtoRGBA\n }\n };\n function convertFormatIfRequired(textureOptions) {\n const format = textureOptions.format;\n if (converters[format]) {\n const convertFunction = converters[format].convertFunction;\n const levelBuffers = textureOptions.resource;\n for (let i = 0; i < levelBuffers.length; i++) {\n levelBuffers[i] = convertFunction(levelBuffers[i]);\n }\n textureOptions.format = converters[format].convertedFormat;\n }\n }\n function convertRGBtoRGBA(levelBuffer) {\n const pixelCount = levelBuffer.byteLength / 3;\n const levelBufferWithAlpha = new Uint32Array(pixelCount);\n for (let i = 0; i < pixelCount; ++i) {\n levelBufferWithAlpha[i] = levelBuffer[i * 3] + (levelBuffer[i * 3 + 1] << 8) + (levelBuffer[i * 3 + 2] << 16) + 4278190080;\n }\n return new Uint8Array(levelBufferWithAlpha.buffer);\n }\n\n function createLevelBuffersFromKTX(ktxTexture) {\n const levelBuffers = [];\n for (let i = 0; i < ktxTexture.numLevels; i++) {\n const imageData = ktxTexture.getImageData(i, 0, 0);\n const levelBuffer = new Uint8Array(imageData.byteLength);\n levelBuffer.set(imageData);\n levelBuffers.push(levelBuffer);\n }\n return levelBuffers;\n }\n\n const glFormatToGPUFormatMap = {\n 6408: "rgba8unorm",\n 32856: "bgra8unorm",\n //\n 32857: "rgb10a2unorm",\n 33189: "depth16unorm",\n 33190: "depth24plus",\n 33321: "r8unorm",\n 33323: "rg8unorm",\n 33325: "r16float",\n 33326: "r32float",\n 33327: "rg16float",\n 33328: "rg32float",\n 33329: "r8sint",\n 33330: "r8uint",\n 33331: "r16sint",\n 33332: "r16uint",\n 33333: "r32sint",\n 33334: "r32uint",\n 33335: "rg8sint",\n 33336: "rg8uint",\n 33337: "rg16sint",\n 33338: "rg16uint",\n 33339: "rg32sint",\n 33340: "rg32uint",\n 33778: "bc2-rgba-unorm",\n 33779: "bc3-rgba-unorm",\n 34836: "rgba32float",\n 34842: "rgba16float",\n 35056: "depth24plus-stencil8",\n 35898: "rg11b10ufloat",\n 35901: "rgb9e5ufloat",\n 35907: "rgba8unorm-srgb",\n // bgra8unorm-srgb\n 36012: "depth32float",\n 36013: "depth32float-stencil8",\n 36168: "stencil8",\n 36208: "rgba32uint",\n 36214: "rgba16uint",\n 36220: "rgba8uint",\n 36226: "rgba32sint",\n 36232: "rgba16sint",\n 36238: "rgba8sint",\n 36492: "bc7-rgba-unorm",\n 36756: "r8snorm",\n 36757: "rg8snorm",\n 36759: "rgba8snorm",\n 37496: "etc2-rgba8unorm",\n 37808: "astc-4x4-unorm"\n };\n function glFormatToGPUFormat(glInternalFormat) {\n const format = glFormatToGPUFormatMap[glInternalFormat];\n if (format) {\n return format;\n }\n throw new Error(`Unsupported glInternalFormat: ${glInternalFormat}`);\n }\n\n const vkFormatToGPUFormatMap = {\n 23: "rgb8unorm",\n // VK_FORMAT_R8G8B8_UNORM\n 37: "rgba8unorm",\n // VK_FORMAT_R8G8B8A8_UNORM\n 43: "rgba8unorm-srgb"\n // VK_FORMAT_R8G8B8A8_SRGB\n // TODO add more!\n };\n function vkFormatToGPUFormat(vkFormat) {\n const format = vkFormatToGPUFormatMap[vkFormat];\n if (format) {\n return format;\n }\n throw new Error(`Unsupported VkFormat: ${vkFormat}`);\n }\n\n function getTextureFormatFromKTXTexture(ktxTexture) {\n if (ktxTexture.classId === 2) {\n return vkFormatToGPUFormat(ktxTexture.vkFormat);\n }\n return glFormatToGPUFormat(ktxTexture.glInternalformat);\n }\n\n const gpuFormatToBasisTranscoderFormatMap = {\n "bc3-rgba-unorm": "BC3_RGBA",\n "bc7-rgba-unorm": "BC7_M5_RGBA",\n "etc2-rgba8unorm": "ETC2_RGBA",\n "astc-4x4-unorm": "ASTC_4x4_RGBA",\n // Uncompressed\n rgba8unorm: "RGBA32",\n rg11b10ufloat: "R11F_G11F_B10F"\n };\n function gpuFormatToKTXBasisTranscoderFormat(transcoderFormat) {\n const format = gpuFormatToBasisTranscoderFormatMap[transcoderFormat];\n if (format) {\n return format;\n }\n throw new Error(`Unsupported transcoderFormat: ${transcoderFormat}`);\n }\n\n const settings = {\n jsUrl: "",\n wasmUrl: ""\n };\n let basisTranscoderFormat;\n let basisTranscodedTextureFormat;\n let ktxPromise;\n async function getKTX() {\n if (!ktxPromise) {\n const absoluteJsUrl = new URL(settings.jsUrl, location.origin).href;\n const absoluteWasmUrl = new URL(settings.wasmUrl, location.origin).href;\n importScripts(absoluteJsUrl);\n ktxPromise = new Promise((resolve) => {\n LIBKTX({\n locateFile: (_file) => absoluteWasmUrl\n }).then((libktx) => {\n resolve(libktx);\n });\n });\n }\n return ktxPromise;\n }\n async function fetchKTXTexture(url, ktx) {\n const ktx2Response = await fetch(url);\n if (ktx2Response.ok) {\n const ktx2ArrayBuffer = await ktx2Response.arrayBuffer();\n return new ktx.ktxTexture(new Uint8Array(ktx2ArrayBuffer));\n }\n throw new Error(`Failed to load KTX(2) texture: ${url}`);\n }\n const preferredTranscodedFormat = [\n "bc7-rgba-unorm",\n "astc-4x4-unorm",\n "etc2-rgba8unorm",\n "bc3-rgba-unorm",\n "rgba8unorm"\n ];\n async function load(url) {\n const ktx = await getKTX();\n const ktxTexture = await fetchKTXTexture(url, ktx);\n let format;\n if (ktxTexture.needsTranscoding) {\n format = basisTranscodedTextureFormat;\n const transcodeFormat = ktx.TranscodeTarget[basisTranscoderFormat];\n const result = ktxTexture.transcodeBasis(transcodeFormat, 0);\n if (result !== ktx.ErrorCode.SUCCESS) {\n throw new Error("Unable to transcode basis texture.");\n }\n } else {\n format = getTextureFormatFromKTXTexture(ktxTexture);\n }\n const levelBuffers = createLevelBuffersFromKTX(ktxTexture);\n const textureOptions = {\n width: ktxTexture.baseWidth,\n height: ktxTexture.baseHeight,\n format,\n mipLevelCount: ktxTexture.numLevels,\n resource: levelBuffers,\n alphaMode: "no-premultiply-alpha"\n };\n convertFormatIfRequired(textureOptions);\n return textureOptions;\n }\n async function init(jsUrl, wasmUrl, supportedTextures) {\n if (jsUrl) settings.jsUrl = jsUrl;\n if (wasmUrl) settings.wasmUrl = wasmUrl;\n basisTranscodedTextureFormat = preferredTranscodedFormat.filter((format) => supportedTextures.includes(format))[0];\n basisTranscoderFormat = gpuFormatToKTXBasisTranscoderFormat(basisTranscodedTextureFormat);\n await getKTX();\n }\n const messageHandlers = {\n init: async (data) => {\n const { jsUrl, wasmUrl, supportedTextures } = data;\n await init(jsUrl, wasmUrl, supportedTextures);\n },\n load: async (data) => {\n try {\n const textureOptions = await load(data.url);\n return {\n type: "load",\n url: data.url,\n success: true,\n textureOptions,\n transferables: textureOptions.resource?.map((arr) => arr.buffer)\n };\n } catch (e) {\n throw e;\n }\n }\n };\n self.onmessage = (async (messageEvent) => {\n const message = messageEvent.data;\n try {\n const response = await messageHandlers[message.type]?.(message);\n if (response) {\n self.postMessage(response, response.transferables);\n }\n } catch (err) {\n self.postMessage({\n type: "error",\n err,\n url: message.url\n });\n }\n });\n\n})();\n'],{type:"application/javascript"}))),this.worker=new Worker(yh)}}vh.revokeObjectURL=function(){yh&&(URL.revokeObjectURL(yh),yh=null)};const Th={jsUrl:"https://cdn.jsdelivr.net/npm/pixi.js/transcoders/ktx/libktx.js",wasmUrl:"https://cdn.jsdelivr.net/npm/pixi.js/transcoders/ktx/libktx.wasm"};function Sh(e){Object.assign(Th,e)}let wh;const Eh={},Ah={};function Rh(e,t){const r=function(e){return wh||(wh=(new vh).worker,wh.onmessage=e=>{const{err:t,success:r,url:n,textureOptions:s}=e.data;t?Ah[n](t):(r||console.warn("Failed to load KTX texture",n),Eh[n](s))},wh.postMessage({type:"init",jsUrl:Th.jsUrl,wasmUrl:Th.wasmUrl,supportedTextures:e})),wh}(t);return new Promise((t,n)=>{Eh[e]=t,Ah[e]=n,r.postMessage({type:"load",url:e})})}const Ch={extension:{type:e.LoadParser,priority:cr.High,name:"loadKTX2"},name:"loadKTX2",id:"ktx2",test:e=>Vi(e,".ktx2"),async load(e,t,r){const n=await Yu(),s=await Rh(e,n);return du(new ku({...s,resolution:t.data?.resolution||cu(e)}),r,e)},async unload(e){Array.isArray(e)?e.forEach(e=>e.destroy(!0)):e.destroy(!0)}},Mh={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:Gh},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:Gh}};function Ph(e){const t=e.format;if(Mh[t]){const r=Mh[t].convertFunction,n=e.resource;for(let e=0;e<n.length;e++)n[e]=r(n[e]);e.format=Mh[t].convertedFormat}}function Gh(e){const t=e.byteLength/3,r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=e[3*n]+(e[3*n+1]<<8)+(e[3*n+2]<<16)+4278190080;return new Uint8Array(r.buffer)}function Bh(e){const t=[];for(let r=0;r<e.numLevels;r++){const n=e.getImageData(r,0,0),s=new Uint8Array(n.byteLength);s.set(n),t.push(s)}return t}const Fh={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function Ih(e){const t=Fh[e];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${e}`)}const Oh={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function Dh(e){const t=Oh[e];if(t)return t;throw new Error(`Unsupported VkFormat: ${e}`)}function Uh(e){return 2===e.classId?Dh(e.vkFormat):Ih(e.glInternalformat)}const kh={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function Lh(e){const t=kh[e];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${e}`)}const Nh=["basis","bc7","bc6h","astc","etc2","bc5","bc4","bc3","bc2","bc1","eac"],Xh={extension:e.ResolveParser,test:e=>Vi(e,[".ktx",".ktx2",".dds"]),parse:e=>{let t;const r=e.split(".");if(r.length>2){const e=r[r.length-2];Nh.includes(e)&&(t=e)}else t=r[r.length-1];return{resolution:parseFloat(xr.RETINA_PREFIX.exec(e)?.[1]??"1"),format:t,src:e}}};let Hh;const zh={extension:{type:e.DetectionParser,priority:2},test:async()=>!!await di()||!!ci(),add:async e=>{const t=await Vu();return Hh=function(e){const t=["basis"],r={};return e.forEach(e=>{const n=e.split("-")[0];n&&!r[n]&&(r[n]=!0,t.push(n))}),t.sort((e,t)=>{const r=Nh.indexOf(e),n=Nh.indexOf(t);return-1===r?1:-1===n?-1:r-n}),t}(t),[...Hh,...e]},remove:async e=>Hh?e.filter(e=>!(e in Hh)):e};const Vh=new ne,Wh=new _,$h=new M,Yh=class{cull(e,t,r=!0){this._cullRecursive(e,t,r)}_cullRecursive(e,t,r=!0){if(e.cullable&&e.measurable&&e.includeInBuild)if(e.cullArea){$h.x=t.x,$h.y=t.y,$h.width=t.width,$h.height=t.height;const n=r?e.worldTransform:e.getGlobalTransform(Wh,r);e.culled=!$h.intersects(e.cullArea,n)}else{const n=Je(e,r,Vh);e.culled=n.x>=t.x+t.width||n.y>=t.y+t.height||n.x+n.width<=t.x||n.y+n.height<=t.y}else e.culled=!1;if(e.cullableChildren&&!e.culled&&e.renderable&&e.measurable&&e.includeInBuild)for(let n=0;n<e.children.length;n++)this._cullRecursive(e.children[n],t,r)}};Yh.shared=new Yh;let jh=Yh;class qh{static init(e){this._renderRef=this.render.bind(this),this.render=()=>{const t=!0!==e?.culler?.updateTransform;jh.shared.cull(this.stage,this.renderer.screen,t),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}qh.extension={priority:10,type:e.Application,name:"culler"};class Kh extends Dt{constructor(e={}){const{element:t,anchor:r,...n}=e;super({label:"DOMContainer",...n}),this.renderPipeId="dom",this.batched=!1,this._anchor=new m(0,0),r&&(this.anchor=r),this.element=e.element||document.createElement("div")}get anchor(){return this._anchor}set anchor(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)}set element(e){this._element!==e&&(this._element=e,this.onViewUpdate())}get element(){return this._element}updateBounds(){const e=this._bounds,t=this._element;if(!t)return e.minX=0,e.minY=0,e.maxX=0,void(e.maxY=0);const{offsetWidth:r,offsetHeight:n}=t;e.minX=0,e.maxX=r,e.minY=0,e.maxY=n}destroy(e=!1){super.destroy(e),this._element?.parentNode?.removeChild(this._element),this._element=null,this._anchor=null}}class Zh{constructor(e){this._attachedDomElements=[],this._renderer=e,this._renderer.runners.postrender.add(this),this._renderer.runners.init.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}init(){this._canvasObserver=new Ar({domElement:this._domElement,renderer:this._renderer})}addRenderable(e,t){this._attachedDomElements.includes(e)||this._attachedDomElements.push(e)}updateRenderable(e){}validateRenderable(e){return!0}postrender(){const e=this._attachedDomElements;if(0!==e.length){this._canvasObserver.ensureAttached();for(let t=0;t<e.length;t++){const r=e[t],n=r.element;if(!r.parent||r.globalDisplayStatus<7)n?.remove(),e.splice(t,1),t--;else{this._domElement.contains(n)||(n.style.position="absolute",n.style.pointerEvents="auto",this._domElement.appendChild(n));const e=r.worldTransform,t=r._anchor,s=r.width*t.x,i=r.height*t.y;n.style.transformOrigin=`${s}px ${i}px`,n.style.transform=`matrix(${e.a}, ${e.b}, ${e.c}, ${e.d}, ${e.tx-s}, ${e.ty-i})`,n.style.opacity=r.groupAlpha.toString()}}}else this._domElement.remove()}destroy(){this._renderer.runners.postrender.remove(this);for(let e=0;e<this._attachedDomElements.length;e++){const t=this._attachedDomElements[e];t.element?.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._canvasObserver.destroy(),this._renderer=null}}Zh.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"dom"};var Qh,Jh,ec={},tc={},rc={};function nc(){if(Qh)return rc;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}Qh=1;var t=e({HTML:"text/html",isHTML:function(e){return e===t.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),n=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,s=new RegExp("[\\-\\.0-9"+n.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+n.source+s.source+"*(?::"+n.source+s.source+"*)?$");return rc.assign=function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},rc.find=function(e,t,r){if(void 0===r&&(r=Array.prototype),e&&"function"==typeof r.find)return r.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var s=e[n];if(t.call(void 0,s,n,e))return s}},rc.freeze=e,rc.MIME_TYPE=t,rc.NAMESPACE=r,rc.nameStartChar=n,rc.nameChar=s,rc.tagNamePattern=i,rc}function sc(){if(Jh)return tc;Jh=1;var e=nc(),t=e.find,r=e.NAMESPACE,n=e.tagNamePattern;function s(e){return""!==e}function i(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function o(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(s):[]}(e);return Object.keys(t.reduce(i,{}))}function a(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function l(e,t){var r=e.prototype;if(!(r instanceof t)){function n(){}n.prototype=t.prototype,a(r,n=new n),e.prototype=r=n}r.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),r.constructor=e)}var u={},h=u.ELEMENT_NODE=1,c=u.ATTRIBUTE_NODE=2,d=u.TEXT_NODE=3,p=u.CDATA_SECTION_NODE=4,f=u.ENTITY_REFERENCE_NODE=5,m=u.ENTITY_NODE=6,g=u.PROCESSING_INSTRUCTION_NODE=7,_=u.COMMENT_NODE=8,x=u.DOCUMENT_NODE=9,b=u.DOCUMENT_TYPE_NODE=10,y=u.DOCUMENT_FRAGMENT_NODE=11,v=u.NOTATION_NODE=12,T={},S={};T.INDEX_SIZE_ERR=(S[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(S[2]="DOMString size error",2);var w=T.HIERARCHY_REQUEST_ERR=(S[3]="Hierarchy request error",3);T.WRONG_DOCUMENT_ERR=(S[4]="Wrong document",4);var E=T.INVALID_CHARACTER_ERR=(S[5]="Invalid character",5);T.NO_DATA_ALLOWED_ERR=(S[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(S[7]="No modification allowed",7);var A=T.NOT_FOUND_ERR=(S[8]="Not found",8);T.NOT_SUPPORTED_ERR=(S[9]="Not supported",9);var R=T.INUSE_ATTRIBUTE_ERR=(S[10]="Attribute in use",10),C=T.INVALID_STATE_ERR=(S[11]="Invalid state",11);function M(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,S[e]),this.message=S[e],Error.captureStackTrace&&Error.captureStackTrace(this,M);return r.code=e,t&&(this.message=this.message+": "+t),r}function P(){}function G(e,t){this._node=e,this._refresh=t,B(this)}function B(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(ve(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)Object.prototype.hasOwnProperty.call(e,n)&&delete e[n];a(r,e),e._inc=t}}function F(){this._nameIndex=Object.create(null)}function I(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function O(e,t){e._nameIndex[t.nodeName]===t&&delete e._nameIndex[t.nodeName]}function D(e,t,n,s){if(s?(t[I(t,s)]=n,O(t,s)):t[t.length++]=n,function(e,t){e._nameIndex[t.nodeName]=t}(t,n),e){n.ownerElement=e;var i=e.ownerDocument;i&&(s&&V(i,e,s),function(e,t,n){e&&e._inc++;var s=n.namespaceURI;s===r.XMLNS&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(i,e,n))}}function U(e,t,r){var n=I(t,r);if(!(n>=0))throw new M(A,new Error(e.tagName+"@"+r));for(var s=t.length-1;n<s;)t[n]=t[++n];if(t.length=s,O(t,r),e){var i=e.ownerDocument;i&&(V(i,e,r),r.ownerElement=null)}}function k(){}function L(){}function N(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function X(e,t){return H(e,null,{enter:function(e){return!t(e)||H.STOP}})===H.STOP}function H(e,t,r){for(var n=[{node:e,context:t,phase:H.ENTER}];n.length>0;){var s=n.pop();if(s.phase===H.ENTER){var i=r.enter(s.node,s.context);if(i===H.STOP)return H.STOP;if(n.push({node:s.node,context:i,phase:H.EXIT}),null==i)continue;for(var o=s.node.lastChild;o;)n.push({node:o,context:i,phase:H.ENTER}),o=o.previousSibling}else r.exit&&r.exit(s.node,s.context)}}function z(){this.ownerDocument=this}function V(e,t,n,s){e&&e._inc++,n.namespaceURI===r.XMLNS&&delete t._nsMap[n.prefix?n.localName:""]}function W(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var s=t.firstChild,i=0;s;)n[i++]=s,s=s.nextSibling;n.length=i,delete n[n.length]}}}function $(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,W(e.ownerDocument,e),t}function Y(e){return e&&e.nodeType===L.DOCUMENT_TYPE_NODE}function j(e){return e&&e.nodeType===L.ELEMENT_NODE}function q(e){return e&&e.nodeType===L.TEXT_NODE}function K(e,r){var n=e.childNodes||[];if(t(n,j)||Y(r))return!1;var s=t(n,Y);return!(r&&s&&n.indexOf(s)>n.indexOf(r))}function Z(e,r){var n=e.childNodes||[];if(t(n,function(e){return j(e)&&e!==r}))return!1;var s=t(n,Y);return!(r&&s&&n.indexOf(s)>n.indexOf(r))}function Q(e,t,r){if(!function(e){return e&&(e.nodeType===L.DOCUMENT_NODE||e.nodeType===L.DOCUMENT_FRAGMENT_NODE||e.nodeType===L.ELEMENT_NODE)}(e))throw new M(w,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new M(A,"child not in parent");if(!function(e){return e&&(j(e)||q(e)||Y(e)||e.nodeType===L.DOCUMENT_FRAGMENT_NODE||e.nodeType===L.COMMENT_NODE||e.nodeType===L.PROCESSING_INSTRUCTION_NODE)}(t)||Y(t)&&e.nodeType!==L.DOCUMENT_NODE)throw new M(w,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function J(e,r,n){var s=e.childNodes||[],i=r.childNodes||[];if(r.nodeType===L.DOCUMENT_FRAGMENT_NODE){var o=i.filter(j);if(o.length>1||t(i,q))throw new M(w,"More than one element or text in fragment");if(1===o.length&&!K(e,n))throw new M(w,"Element in fragment can not be inserted before doctype")}if(j(r)&&!K(e,n))throw new M(w,"Only one element can be added and only after doctype");if(Y(r)){if(t(s,Y))throw new M(w,"Only one doctype is allowed");var a=t(s,j);if(n&&s.indexOf(a)<s.indexOf(n))throw new M(w,"Doctype can only be inserted before an element");if(!n&&a)throw new M(w,"Doctype can not be appended since element is present")}}function ee(e,r,n){var s=e.childNodes||[],i=r.childNodes||[];if(r.nodeType===L.DOCUMENT_FRAGMENT_NODE){var o=i.filter(j);if(o.length>1||t(i,q))throw new M(w,"More than one element or text in fragment");if(1===o.length&&!Z(e,n))throw new M(w,"Element in fragment can not be inserted before doctype")}if(j(r)&&!Z(e,n))throw new M(w,"Only one element can be added and only after doctype");if(Y(r)){function l(e){return Y(e)&&e!==n}if(t(s,l))throw new M(w,"Only one doctype is allowed");var a=t(s,j);if(n&&s.indexOf(a)<s.indexOf(n))throw new M(w,"Doctype can only be inserted before an element")}}function te(e,t,r,n){Q(e,t,r),e.nodeType===L.DOCUMENT_NODE&&(n||J)(e,t,r);var s=t.parentNode;if(s&&s.removeChild(t),t.nodeType===y){var i=t.firstChild;if(null==i)return t;var o=t.lastChild}else i=o=t;var a=r?r.previousSibling:e.lastChild;i.previousSibling=a,o.nextSibling=r,a?a.nextSibling=i:e.firstChild=i,null==r?e.lastChild=o:r.previousSibling=o;do{i.parentNode=e,re(i,e.ownerDocument||e)}while(i!==o&&(i=i.nextSibling));return W(e.ownerDocument||e,e),t.nodeType==y&&(t.firstChild=t.lastChild=null),t}function re(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===h&&e.attributes)for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);n&&(n.ownerDocument=t)}for(var s=e.firstChild;s;)re(s,t),s=s.nextSibling}}function ne(){this._nsMap={}}function se(){}function ie(){}function oe(){}function ae(){}function le(){}function ue(){}function he(){}function ce(){}function de(){}function pe(){}function fe(){}function me(){}function ge(e,t,r){var n=!!r&&!!r.requireWellFormed,s=[],i=9==this.nodeType&&this.documentElement||this,o=i.prefix,a=i.namespaceURI;if(a&&null==o&&null==(o=i.lookupPrefix(a)))var l=[{namespace:a,prefix:null}];return be(this,s,e,t,l,n),s.join("")}function _e(e,t,n){var s=e.prefix||"",i=e.namespaceURI;if(!i)return!1;if("xml"===s&&i===r.XML||i===r.XMLNS)return!1;for(var o=n.length;o--;){var a=n[o];if(a.prefix===s)return a.namespace!==i}return!0}function xe(e,t,r,s){if(s&&!n.test(t))throw new M(C,'The attribute name "'+t+'" is not a valid XML QName');e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,N),'"')}function be(e,t,s,i,o,a){o||(o=[]),H(e,{ns:o,isHTML:s},{enter:function(e,s){var o=s.ns,l=s.isHTML;if(i){if(!(e=i(e)))return null;if("string"==typeof e)return t.push(e),null}switch(e.nodeType){case h:var u=e.attributes,m=u.length,v=e.tagName,T=v;if(!(l=r.isHTML(e.namespaceURI)||l)&&!e.prefix&&e.namespaceURI){for(var S,w=0;w<u.length;w++)if("xmlns"===u.item(w).name){S=u.item(w).value;break}if(!S)for(var E=o.length-1;E>=0;E--){if(""===(A=o[E]).prefix&&A.namespace===e.namespaceURI){S=A.namespace;break}}if(S!==e.namespaceURI)for(E=o.length-1;E>=0;E--){var A;if((A=o[E]).namespace===e.namespaceURI){A.prefix&&(T=A.prefix+":"+v);break}}}if(a&&!n.test(T))throw new M(C,'The element name "'+T+'" is not a valid XML QName');t.push("<",T);for(var R=o.slice(),P=0;P<m;P++){"xmlns"==(G=u.item(P)).prefix?R.push({prefix:G.localName,namespace:G.value}):"xmlns"==G.nodeName&&R.push({prefix:"",namespace:G.value})}for(P=0;P<m;P++){var G;if(_e(G=u.item(P),0,R)){var B=G.prefix||"",F=G.namespaceURI;xe(t,B?"xmlns:"+B:"xmlns",F,a),R.push({prefix:B,namespace:F})}var I=i?i(G):G;I&&("string"==typeof I?t.push(I):xe(t,I.name,I.value,a))}if(v===T&&_e(e,0,R)){var O=e.prefix||"";F=e.namespaceURI;xe(t,O?"xmlns:"+O:"xmlns",F,a),R.push({prefix:O,namespace:F})}var D=e.firstChild;if(D||l&&!/^(?:meta|link|img|br|hr|input)$/i.test(v)){if(t.push(">"),l&&/^script$/i.test(v)){for(;D;)D.data?t.push(D.data):be(D,t,l,i,R.slice(),a),D=D.nextSibling;return t.push("</",v,">"),null}return{ns:R,isHTML:l,tag:T}}return t.push("/>"),null;case x:case y:return{ns:o.slice(),isHTML:l,tag:null};case c:return xe(t,e.name,e.value,a),null;case d:return t.push(e.data.replace(/[<&>]/g,N)),null;case p:if(a&&-1!==e.data.indexOf("]]>"))throw new M(C,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",e.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case _:if(a&&-1!==e.data.indexOf("--\x3e"))throw new M(C,'The comment node data contains "--\x3e"');return t.push("\x3c!--",e.data,"--\x3e"),null;case b:if(a){if(!n.test(e.name))throw new M(C,'The doctype name "'+e.name+'" is not a valid XML Name');if(e.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(e.publicId))throw new M(C,"DocumentType publicId is not a valid PubidLiteral");if(e.systemId&&!/^("[^"]*"|'[^']*')$/.test(e.systemId))throw new M(C,"DocumentType systemId is not a valid SystemLiteral");if(e.internalSubset&&-1!==e.internalSubset.indexOf("]>"))throw new M(C,'DocumentType internalSubset contains "]>"')}var U=e.publicId,k=e.systemId;if(t.push("<!DOCTYPE ",e.name),U)t.push(" PUBLIC ",U),k&&"."!=k&&t.push(" ",k),t.push(">");else if(k&&"."!=k)t.push(" SYSTEM ",k,">");else{var L=e.internalSubset;L&&t.push(" [",L,"]"),t.push(">")}return null;case g:if(a){if(!n.test(e.target)||-1!==e.target.indexOf(":")||"xml"===e.target.toLowerCase())throw new M(C,'The processing instruction target "'+e.target+'" is not a valid XML NCName or is reserved');if(-1!==e.data.indexOf("?>"))throw new M(C,'The ProcessingInstruction data contains "?>"')}return t.push("<?",e.target," ",e.data,"?>"),null;case f:if(a&&!n.test(e.nodeName))throw new M(C,'The entity reference name "'+e.nodeName+'" is not a valid XML Name');return t.push("&",e.nodeName,";"),null;default:return t.push("??",e.nodeName),null}},exit:function(e,r){r&&r.tag&&t.push("</",r.tag,">")}})}function ye(e,t,r){var n;return H(t,null,{enter:function(t,s){var i=new t.constructor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var a=t[o];"object"!=typeof a&&a!=i[o]&&(i[o]=a)}t.childNodes&&(i.childNodes=new P),i.ownerDocument=e;var l=r;switch(i.nodeType){case h:var u=t.attributes,d=i.attributes=new F,p=u.length;d._ownerElement=i;for(var f=0;f<p;f++)i.setAttributeNode(ye(e,u.item(f),!0));break;case c:l=!0}return null!==s?s.appendChild(i):n=i,l?i:null}}),n}function ve(e,t,r){e[t]=r}T.SYNTAX_ERR=(S[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(S[13]="Invalid modification",13),T.NAMESPACE_ERR=(S[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(S[15]="Invalid access",15),M.prototype=Error.prototype,a(T,M),P.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t,r){for(var n=!!r&&!!r.requireWellFormed,s=[],i=0;i<this.length;i++)be(this[i],s,e,t,null,n);return s.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},G.prototype.item=function(e){return B(this),this[e]||null},l(G,P),F.prototype={length:0,item:P.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new M(R);var r=this._nameIndex[e.nodeName];return D(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new M(R);return t=this.getNamedItemNS(e.namespaceURI,e.localName),D(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return U(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return U(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var n=this[r];if(n.localName==t&&n.namespaceURI==e)return n}return null}},k.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new z;if(n.implementation=this,n.childNodes=new P,n.doctype=r||null,r&&n.appendChild(r),t){var s=n.createElementNS(e,t);n.appendChild(s)}return n},createDocumentType:function(e,t,r){var n=new ue;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}},L.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return te(this,e,t)},replaceChild:function(e,t){te(this,e,t,ee),t&&this.removeChild(t)},removeChild:function(e){return $(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ye(this.ownerDocument||this,this,e)},normalize:function(){H(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;if(null!==r&&r.nodeType===d&&t.nodeType===d){for(var n=[],s=r;null!==s&&s.nodeType===d;)n.push(s.data),s=s.nextSibling;for(var i=t.nextSibling;i!==s;){var o=i.nextSibling;i.parentNode=null,i.previousSibling=null,i.nextSibling=null,i=o}t.nextSibling=s,null!==s?s.previousSibling=t:e.lastChild=t,t.appendData(n.join("")),W(e.ownerDocument,e),t=s}else t=r}return!0}})},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&r[n]===e)return n;t=t.nodeType==c?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==c?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},a(u,L),a(u,L.prototype),H.STOP=Symbol("walkDOM.STOP"),H.ENTER=0,H.EXIT=1,z.prototype={nodeName:"#document",nodeType:x,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==y){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return te(this,e,t),re(e,this),null===this.documentElement&&e.nodeType===h&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),$(this,e)},replaceChild:function(e,t){te(this,e,t,ee),re(e,this),t&&this.removeChild(t),j(e)&&(this.documentElement=e)},importNode:function(e,t){return function(e,t,r){var n;return H(t,null,{enter:function(t,s){var i=t.cloneNode(!1);return i.ownerDocument=e,i.parentNode=null,null===s?n=i:s.appendChild(i),t.nodeType===c||r?i:null}}),n}(this,e,t)},getElementById:function(e){var t=null;return X(this.documentElement,function(r){if(r.nodeType==h&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=o(e);return new G(this,function(r){var n=[];return t.length>0&&X(r.documentElement,function(s){if(s!==r&&s.nodeType===h){var i=s.getAttribute("class");if(i){var a=e===i;if(!a){var l=o(i);a=t.every((u=l,function(e){return u&&-1!==u.indexOf(e)}))}a&&n.push(s)}}var u}),n})},createElement:function(e){var t=new ne;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new P,(t.attributes=new F)._ownerElement=t,t},createDocumentFragment:function(){var e=new pe;return e.ownerDocument=this,e.childNodes=new P,e},createTextNode:function(e){var t=new oe;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ae;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(-1!==e.indexOf("]]>"))throw new M(E,'data contains "]]>"');var t=new le;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new fe;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new se;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){if(!n.test(e))throw new M(E,'not a valid xml name "'+e+'"');var t=new de;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new ne,n=t.split(":"),s=r.attributes=new F;return r.childNodes=new P,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=t,s._ownerElement=r,r},createAttributeNS:function(e,t){var r=new se,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==n.length?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}},l(z,L),ne.prototype={nodeType:h,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===y?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,W(e.ownerDocument,e,t),re(t,e.ownerDocument||e),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new G(this,function(t){var r=[];return X(t,function(n){n===t||n.nodeType!=h||"*"!==e&&n.tagName!=e||r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new G(this,function(r){var n=[];return X(r,function(s){s===r||s.nodeType!==h||"*"!==e&&s.namespaceURI!==e||"*"!==t&&s.localName!=t||n.push(s)}),n})}},z.prototype.getElementsByTagName=ne.prototype.getElementsByTagName,z.prototype.getElementsByTagNameNS=ne.prototype.getElementsByTagNameNS,l(ne,L),se.prototype.nodeType=c,l(se,L),ie.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(S[w])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},l(ie,L),oe.prototype={nodeName:"#text",nodeType:d,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},l(oe,ie),ae.prototype={nodeName:"#comment",nodeType:_},l(ae,ie),le.prototype={nodeName:"#cdata-section",nodeType:p},l(le,ie),ue.prototype.nodeType=b,l(ue,L),he.prototype.nodeType=v,l(he,L),ce.prototype.nodeType=m,l(ce,L),de.prototype.nodeType=f,l(de,L),pe.prototype.nodeName="#document-fragment",pe.prototype.nodeType=y,l(pe,L),fe.prototype.nodeType=g,l(fe,L),me.prototype.serializeToString=function(e,t,r,n){return ge.call(e,t,r,n)},L.prototype.toString=ge;try{Object.defineProperty&&(Object.defineProperty(G.prototype,"length",{get:function(){return B(this),this.$$length}}),Object.defineProperty(L.prototype,"textContent",{get:function(){if(this.nodeType===h||this.nodeType===y){var e=[];return H(this,null,{enter:function(t){return t.nodeType===h||t.nodeType===y||(t.nodeType===g||t.nodeType===_?null:void e.push(t.nodeValue))}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case h:case y:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ve=function(e,t,r){e["$$"+t]=r})}catch(e){}return tc.DocumentType=ue,tc.DOMException=M,tc.DOMImplementation=k,tc.Element=ne,tc.Node=L,tc.NodeList=P,tc.walkDOM=H,tc.XMLSerializer=me,tc}var ic,oc={},ac={};function lc(){return ic||(ic=1,e=ac,t=nc().freeze,e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),e.entityMap=e.HTML_ENTITIES),ac;var e,t}var uc,hc,cc,dc={};function pc(){if(uc)return dc;uc=1;var e=nc().NAMESPACE,t=nc().tagNamePattern;function r(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,r)}function n(){}function s(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function i(t,r,n,s,i,o){function a(e,t,r){n.attributeNames.hasOwnProperty(e)&&o.fatalError("Attribute "+e+" redefined"),n.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),r)}for(var l,u=++r,h=0;;){var c=t.charAt(u);if(0===h&&"<"===c)throw new Error("unexpected < in tag name: "+t.slice(r,u));switch(c){case"=":if(1===h)l=t.slice(r,u),h=3;else{if(2!==h)throw new Error("attribute equal must after attrName");h=3}break;case"'":case'"':if(3===h||1===h){if(1===h&&(o.warning('attribute value must after "="'),l=t.slice(r,u)),r=u+1,!((u=t.indexOf(c,r))>0))throw new Error("attribute value no end '"+c+"' match");a(l,d=t.slice(r,u),r-1),h=5}else{if(4!=h)throw new Error('attribute value must after "="');a(l,d=t.slice(r,u),r),o.warning('attribute "'+l+'" missed start quot('+c+")!!"),r=u+1,h=5}break;case"/":switch(h){case 0:n.setTagName(t.slice(r,u));case 5:case 6:case 7:h=7,n.closed=!0;case 4:case 1:break;case 2:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==h&&n.setTagName(t.slice(r,u)),u;case">":switch(h){case 0:n.setTagName(t.slice(r,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=t.slice(r,u)).slice(-1)&&(n.closed=!0,d=d.slice(0,-1));case 2:2===h&&(d=l),4==h?(o.warning('attribute "'+d+'" missed quot(")!'),a(l,d,r)):(e.isHTML(s[""])&&d.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),a(d,d,r));break;case 3:throw new Error("attribute value missed!!")}return u;case"":c=" ";default:if(c<=" ")switch(h){case 0:n.setTagName(t.slice(r,u)),h=6;break;case 1:l=t.slice(r,u),h=2;break;case 4:var d=t.slice(r,u);o.warning('attribute "'+d+'" missed quot(")!!'),a(l,d,r);case 5:h=6}else switch(h){case 2:n.tagName,e.isHTML(s[""])&&l.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,r),r=u,h=1;break;case 5:o.warning('attribute space is required"'+l+'"!!');case 6:h=1,r=u;break;case 3:h=4,r=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function o(t,r,n){for(var s=t.tagName,i=null,o=t.length;o--;){var a=t[o],l=a.qName,u=a.value;if((p=l.indexOf(":"))>0)var h=a.prefix=l.slice(0,p),c=l.slice(p+1),d="xmlns"===h&&c;else c=l,h=null,d="xmlns"===l&&"";a.localName=c,!1!==d&&(null==i&&(i={},n=Object.create(n)),n[d]=i[d]=u,a.uri=e.XMLNS,r.startPrefixMapping(d,u))}for(o=t.length;o--;){(h=(a=t[o]).prefix)&&("xml"===h&&(a.uri=e.XML),"xmlns"!==h&&(a.uri=n[h||""]))}var p;(p=s.indexOf(":"))>0?(h=t.prefix=s.slice(0,p),c=t.localName=s.slice(p+1)):(h=null,c=t.localName=s);var f=t.uri=n[h||""];if(r.startElement(f,c,s,t),!t.closed)return t.currentNSMap=n,t.localNSMap=i,!0;if(r.endElement(f,c,s),i)for(h in i)Object.prototype.hasOwnProperty.call(i,h)&&r.endPrefixMapping(h)}function a(e,t,r,n,s){if(/^(?:script|textarea)$/i.test(r)){var i=e.indexOf("</"+r+">",t),o=e.substring(t+1,i);if(/[&<]/.test(o))return/^script$/i.test(r)?(s.characters(o,0,o.length),i):(o=o.replace(/&#?\w+;/g,n),s.characters(o,0,o.length),i)}return t+1}function l(e,t,r,n){var s=n[r];return null==s&&((s=e.lastIndexOf("</"+r+">"))<t&&(s=e.lastIndexOf("</"+r)),n[r]=s),s<t}function u(e,t,r,n){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(s=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,s-t-4),s+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var s=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,s-t-9),r.endCDATA(),s+3}var i=function(e,t){var r,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=t,s.exec(e);for(;r=s.exec(e);)if(n.push(r),r[1])return n}(e,t),o=i.length;if(o>1&&/!doctype/i.test(i[0][0])){var a=i[1][0],l=!1,u=!1;o>3&&(/^public$/i.test(i[2][0])?(l=i[3][0],u=o>4&&i[4][0]):/^system$/i.test(i[2][0])&&(u=i[3][0]));var h=i[o-1];return r.startDTD(a,l,u),r.endDTD(),h.index+h[0].length}return-1}function h(e,t,r){var n=e.indexOf("?>",t);if(n){var s=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)$/);return s?(s[0].length,r.processingInstruction(s[1],s[2]),n+2):-1}return-1}function c(){this.attributeNames={}}return r.prototype=new Error,r.prototype.name=r.name,n.prototype={parse:function(n,d,p){var f=this.domBuilder;f.startDocument(),function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}(d,d={}),function(n,d,p,f,m){function g(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}function _(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(p,t)?p[t]:"#"===t.charAt(0)?g(parseInt(t.substr(1).replace("x","0x"))):(m.error("entity not found:"+e),e)}function x(e){if(e>A){var t=n.substring(A,e).replace(/&#?\w+;/g,_);S&&b(A),f.characters(t,0,e-A),A=e}}function b(e,t){for(;e>=v&&(t=T.exec(n));)y=t.index,v=y+t[0].length,S.lineNumber++;S.columnNumber=e-y+1}var y=0,v=0,T=/.*(?:\r\n?|\n)|.*$/g,S=f.locator,w=[{currentNSMap:d}],E={},A=0;for(;;){try{var R=n.indexOf("<",A);if(R<0){if(!n.substr(A).match(/^\s*$/)){var C=f.doc,M=C.createTextNode(n.substr(A));C.appendChild(M),f.currentElement=M}return}switch(R>A&&x(R),n.charAt(R+1)){case"/":var P=n.indexOf(">",R+3),G=n.substring(R+2,P).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/,"$1"),B=w.pop();P<0?(G=n.substring(R+2).replace(/[\s<].*/,""),m.error("end tag name: "+G+" is not complete:"+B.tagName),P=R+1+G.length):G.match(/\s</)?(G=G.replace(/[\s<].*/,""),m.error("end tag name: "+G+" maybe not complete"),P=R+1+G.length):/[ \t\n\r]/.test(G)&&t.test(G.split(/[ \t\n\r]/)[0])&&m.error('end tag name is followed by whitespace and trailing content: "'+G+'"');var F=B.localNSMap,I=B.tagName==G;if(I||B.tagName&&B.tagName.toLowerCase()==G.toLowerCase()){if(f.endElement(B.uri,B.localName,G),F)for(var O in F)Object.prototype.hasOwnProperty.call(F,O)&&f.endPrefixMapping(O);I||m.fatalError("end tag name: "+G+" is not match the current start tagName:"+B.tagName)}else w.push(B);P++;break;case"?":S&&b(R),P=h(n,R,f);break;case"!":S&&b(R),P=u(n,R,f,m);break;default:S&&b(R);var D=new c,U=w[w.length-1].currentNSMap,k=(P=i(n,R,D,U,_,m),D.length);if(!D.closed&&l(n,P,D.tagName,E)&&(D.closed=!0,p.nbsp||m.warning("unclosed xml attribute")),S&&k){for(var L=s(S,{}),N=0;N<k;N++){var X=D[N];b(X.offset),X.locator=s(S,{})}f.locator=L,o(D,f,U)&&w.push(D),f.locator=S}else o(D,f,U)&&w.push(D);e.isHTML(D.uri)&&!D.closed?P=a(n,P,D.tagName,_,f):P++}}catch(e){if(e instanceof r)throw e;m.error("element parse error: "+e),P=-1}P>A?A=P:x(Math.max(R,A)+1)}}(n,d,p,f,this.errorHandler),f.endDocument()}},c.prototype={setTagName:function(e){if(!t.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,r,n){if(!t.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:r,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},dc.XMLReader=n,dc.ParseError=r,dc}function fc(){if(hc)return oc;hc=1;var e=nc(),t=sc(),r=lc(),n=pc(),s=t.DOMImplementation,i=e.NAMESPACE,o=n.ParseError,a=n.XMLReader;function l(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function u(e){this.options=e||{locator:{}}}function h(){this.cdata=!1}function c(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function d(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function p(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function f(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}return u.prototype.parseFromString=function(e,t){var n=this.options,s=new a,o=n.domBuilder||new h,u=n.errorHandler,c=n.locator,p=n.xmlns||{},f=/\/x?html?$/.test(t),m=f?r.HTML_ENTITIES:r.XML_ENTITIES;c&&o.setDocumentLocator(c),s.errorHandler=function(e,t,r){if(!e){if(t instanceof h)return t;e=t}var n={},s=e instanceof Function;function i(t){var i=e[t];!i&&s&&(i=2==e.length?function(r){e(t,r)}:e),n[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+d(r))}||function(){}}return r=r||{},i("warning"),i("error"),i("fatalError"),n}(u,o,c),s.domBuilder=n.domBuilder||o,f&&(p[""]=i.HTML),p.xml=p.xml||i.XML;var g=n.normalizeLineEndings||l;return e&&"string"==typeof e?s.parse(g(e),p,m):s.errorHandler.error("invalid doc source"),o.doc},h.prototype={startDocument:function(){this.doc=(new s).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var s=this.doc,i=s.createElementNS(e,r||t),o=n.length;f(this,i),this.currentElement=i,this.locator&&c(this.locator,i);for(var a=0;a<o;a++){e=n.getURI(a);var l=n.getValue(a),u=(r=n.getQName(a),s.createAttributeNS(e,r));this.locator&&c(n.getLocator(a),u),u.value=u.nodeValue=l,i.setAttributeNode(u)}},endElement:function(e,t,r){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&c(this.locator,r),f(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=p.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&c(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=p.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&c(this.locator,n),f(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(e,t,r);this.locator&&c(this.locator,s),f(this,s),this.doc.doctype=s}},warning:function(e){console.warn("[xmldom warning]\t"+e,d(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,d(this.locator))},fatalError:function(e){throw new o(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){h.prototype[e]=function(){return null}}),oc.__DOMHandler=h,oc.normalizeLineEndings=l,oc.DOMParser=u,oc}var mc=function(){if(cc)return ec;cc=1;var e=sc();return ec.DOMImplementation=e.DOMImplementation,ec.XMLSerializer=e.XMLSerializer,ec.DOMParser=fc().DOMParser,ec}();const gc={createCanvas:(e,t)=>new OffscreenCanvas(e??0,t??0),createImage:()=>new Image,getCanvasRenderingContext2D:()=>OffscreenCanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>globalThis.location.href,getFontFaceSet:()=>globalThis.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>(new mc.DOMParser).parseFromString(e,"text/xml")};const _c=new class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){!this._tickerAdded&&this.domElement&&(er.system.add(this._tickerUpdate,this,Kt.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(er.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove)return void(this._didMove=!1);const e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&"touch"===e.pointerType||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}):new MouseEvent("mousemove",{clientX:e.clientX,clientY:e.clientY}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this._update())}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}};class xc extends Rr{constructor(){super(...arguments),this.client=new m,this.movement=new m,this.offset=new m,this.global=new m,this.screen=new m}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,r){return e.worldTransform.applyInverse(r||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,r,n,s,i,o,a,l,u,h,c,d,p,f){throw new Error("Method not implemented.")}}class bc extends xc{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1,this.persistentDeviceId=0}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class yc extends xc{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}yc.DOM_DELTA_PIXEL=0,yc.DOM_DELTA_LINE=1,yc.DOM_DELTA_PAGE=2;const vc=new m,Tc=new m;class Sc{constructor(e){this.dispatch=new c,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mapContextMenu=this.mapContextMenu.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel),this.addEventMapping("contextmenu",this.mapContextMenu)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((e,t)=>e.priority-t.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let r=0,n=t.length;r<n;r++)t[r].fn(e);else Oe(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){_c.pauseUpdate=!0;const r=this[this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive"](this.rootTarget,this.rootTarget.eventMode,vc.set(e,t),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(e,t){if(!e.target)return;const r=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let n=0,s=r.length-1;n<s;n++)if(e.currentTarget=r[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!e.propagationStopped&&!e.propagationImmediatelyStopped){e.eventPhase=e.BUBBLING_PHASE;for(let n=r.length-2;n>=0;n--)if(e.currentTarget=r[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,r=this._allInteractiveElements){if(0===r.length)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let t=r.length-1;t>=0;t--)n.forEach(n=>{e.currentTarget=r[t],this.notifyTarget(e,n)})}propagationPath(e){const t=[e];for(let r=0;r<2048&&e!==this.rootTarget&&e.parent;r++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,r,n,s,i=!1){let o=!1;if(this._interactivePrune(e))return null;if("dynamic"!==e.eventMode&&"dynamic"!==t||(_c.pauseUpdate=!1),e.interactiveChildren&&e.children){const a=e.children;for(let l=a.length-1;l>=0;l--){const u=a[l],h=this.hitTestMoveRecursive(u,this._isInteractive(t)?t:u.eventMode,r,n,s,i||s(e,r));if(h){if(h.length>0&&!h[h.length-1].parent)continue;const t=e.isInteractive();(h.length>0||t)&&(t&&this._allInteractiveElements.push(e),h.push(e)),0===this._hitElements.length&&(this._hitElements=h),o=!0}}}const a=this._isInteractive(t),l=e.isInteractive();return l&&l&&this._allInteractiveElements.push(e),i||this._hitElements.length>0?null:o?this._hitElements:a&&!s(e,r)&&n(e,r)?l?[e]:[]:null}hitTestRecursive(e,t,r,n,s){if(this._interactivePrune(e)||s(e,r))return null;if("dynamic"!==e.eventMode&&"dynamic"!==t||(_c.pauseUpdate=!1),e.interactiveChildren&&e.children){const i=e.children,o=r;for(let r=i.length-1;r>=0;r--){const a=i[r],l=this.hitTestRecursive(a,this._isInteractive(t)?t:a.eventMode,o,n,s);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const t=e.isInteractive();return(l.length>0||t)&&l.push(e),l}}}const i=this._isInteractive(t),o=e.isInteractive();return i&&n(e,r)?o?[e]:[]:null}_isInteractive(e){return"static"===e||"dynamic"===e}_interactivePrune(e){return!(e&&e.visible&&e.renderable&&e.measurable)||("none"===e.eventMode||"passive"===e.eventMode&&!e.interactiveChildren)}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,Tc),!e.hitArea.contains(Tc.x,Tc.y)))return!0;if(e.effects&&e.effects.length)for(let r=0;r<e.effects.length;r++){const n=e.effects[r];if(n.containsPoint){if(!n.containsPoint(t,this.hitTestFn))return!0}}return!1}hitTestFn(e,t){return!!e.hitArea||!!e?.containsPoint&&(e.worldTransform.applyInverse(t,Tc),e.containsPoint(Tc))}notifyTarget(e,t){if(!e.currentTarget.isInteractive())return;t??(t=e.type);const r=`on${t}`;e.currentTarget[r]?.(e);const n=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this._notifyListeners(e,n),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof bc))return void Oe("EventBoundary cannot map a non-pointer event as a pointer event");const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),"touch"===t.pointerType)this.dispatchEvent(t,"touchstart");else if("mouse"===t.pointerType||"pen"===t.pointerType){const e=2===t.button;this.dispatchEvent(t,e?"rightdown":"mousedown")}this.trackingData(e.pointerId).pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){if(!(e instanceof bc))return void Oe("EventBoundary cannot map a non-pointer event as a pointer event");this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const r="mouse"===t.pointerType||"pen"===t.pointerType,n=this.trackingData(e.pointerId),s=this.findMountedTarget(n.overTargets);if(n.overTargets?.length>0&&s!==t.target){const n="mousemove"===e.type?"mouseout":"pointerout",i=this.createPointerEvent(e,n,s);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!t.composedPath().includes(s)){const n=this.createPointerEvent(e,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&!t.composedPath().includes(n.target);)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;this.freeEvent(n)}this.freeEvent(i)}if(s!==t.target){const n="mousemove"===e.type?"mouseover":"pointerover",i=this.clonePointerEvent(t,n);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let o=s?.parent;for(;o&&o!==this.rootTarget.parent&&o!==t.target;)o=o.parent;if(!o||o===this.rootTarget.parent){const e=this.clonePointerEvent(t,"pointerenter");for(e.eventPhase=e.AT_TARGET;e.target&&e.target!==s&&e.target!==this.rootTarget.parent;)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseenter"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}const i=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?i.push("pointermove"):this.dispatchEvent(t,"pointermove"),o&&i.push("globalpointermove"),"touch"===t.pointerType&&(this.moveOnAll?i.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),o&&i.push("globaltouchmove")),r&&(this.moveOnAll?i.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),o&&i.push("globalmousemove"),this.cursor=t.target?.cursor),i.length>0&&this.all(t,i),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof bc))return void Oe("EventBoundary cannot map a non-pointer event as a pointer event");const t=this.trackingData(e.pointerId),r=this.createPointerEvent(e),n="mouse"===r.pointerType||"pen"===r.pointerType;this.dispatchEvent(r,"pointerover"),n&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=r.target?.cursor);const s=this.clonePointerEvent(r,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),n&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;t.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(s)}mapPointerOut(e){if(!(e instanceof bc))return void Oe("EventBoundary cannot map a non-pointer event as a pointer event");const t=this.trackingData(e.pointerId);if(t.overTargets){const r="mouse"===e.pointerType||"pen"===e.pointerType,n=this.findMountedTarget(t.overTargets),s=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(s),r&&this.dispatchEvent(s,"mouseout");const i=this.createPointerEvent(e,"pointerleave",n);for(i.eventPhase=i.AT_TARGET;i.target&&i.target!==this.rootTarget.parent;)i.currentTarget=i.target,this.notifyTarget(i),r&&this.notifyTarget(i,"mouseleave"),i.target=i.target.parent;t.overTargets=null,this.freeEvent(s),this.freeEvent(i)}this.cursor=null}mapPointerUp(e){if(!(e instanceof bc))return void Oe("EventBoundary cannot map a non-pointer event as a pointer event");const t=performance.now(),r=this.createPointerEvent(e);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if("mouse"===r.pointerType||"pen"===r.pointerType){const e=2===r.button;this.dispatchEvent(r,e?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),s=this.findMountedTarget(n.pressTargetsByButton[e.button]);let i=s;if(s&&!r.composedPath().includes(s)){let t=s;for(;t&&!r.composedPath().includes(t);){if(r.currentTarget=t,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType)this.notifyTarget(r,"touchendoutside");else if("mouse"===r.pointerType||"pen"===r.pointerType){const e=2===r.button;this.notifyTarget(r,e?"rightupoutside":"mouseupoutside")}t=t.parent}delete n.pressTargetsByButton[e.button],i=t}if(i){const s=this.clonePointerEvent(r,"click");s.target=i,s.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:s.target,timeStamp:t});const o=n.clicksByButton[e.button];if(o.target===s.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=s.target,o.timeStamp=t,s.detail=o.clickCount,"mouse"===s.pointerType){const e=2===s.button;this.dispatchEvent(s,e?"rightclick":"click")}else"touch"===s.pointerType&&this.dispatchEvent(s,"tap");this.dispatchEvent(s,"pointertap"),this.freeEvent(s)}this.freeEvent(r)}mapPointerUpOutside(e){if(!(e instanceof bc))return void Oe("EventBoundary cannot map a non-pointer event as a pointer event");const t=this.trackingData(e.pointerId),r=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(r){let s=r;for(;s;)n.currentTarget=s,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):"mouse"!==n.pointerType&&"pen"!==n.pointerType||this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),s=s.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(n)}mapWheel(e){if(!(e instanceof yc))return void Oe("EventBoundary cannot map a non-wheel event as a wheel event");const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}mapContextMenu(e){if(!(e instanceof bc))return void Oe("EventBoundary cannot map a non-pointer event as a pointer event");const t=this.createPointerEvent(e);this.dispatchEvent(t,"contextmenu"),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let r=1;r<e.length&&e[r].parent===t;r++)t=e[r];return t}createPointerEvent(e,t,r){const n=this.allocateEvent(bc);return this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n.originalEvent=e,n.target=r??this.hitTest(n.global.x,n.global.y)??this._hitElements[0],"string"==typeof t&&(n.type=t),n}createWheelEvent(e){const t=this.allocateEvent(yc);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const r=this.allocateEvent(bc);return r.nativeEvent=e.nativeEvent,r.originalEvent=e.originalEvent,this.copyPointerData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.target=e.target,r.path=e.composedPath().slice(),r.type=t??r.type,r}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof bc&&t instanceof bc&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,t.persistentDeviceId=e.persistentDeviceId)}copyMouseData(e,t){e instanceof xc&&t instanceof xc&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.defaultPrevented=!1,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}_notifyListeners(e,t){const r=e.currentTarget._events[t];if(r)if("fn"in r)r.once&&e.currentTarget.removeListener(t,r.fn,void 0,!0),r.fn.call(r.context,e);else for(let n=0,s=r.length;n<s&&!e.propagationImmediatelyStopped;n++)r[n].once&&e.currentTarget.removeListener(t,r[n].fn,void 0,!0),r[n].fn.call(r[n].context,e)}}const wc={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ec=class e{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Sc(null),_c.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new bc(null),this._rootWheelEvent=new yc(null),this._rootContextMenuEvent=new bc(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...e.defaultEventFeatures},{set:(e,t,r)=>("globalMove"===t&&(this.rootBoundary.enableGlobalMoveEvents=r),e[t]=r,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){const{canvas:r,resolution:n}=this.renderer;this.setTargetElement(r),this.resolution=n,e._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){_c.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;const r=this.cursorStyles[e];if(r)switch(typeof r){case"string":t&&(this.domElement.style.cursor=r);break;case"function":r(e);break;case"object":t&&Object.assign(this.domElement.style,r)}else t&&"string"==typeof e&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);if(this.autoPreventDefault&&t[0].isNormalized){(e.cancelable||!("cancelable"in e))&&e.preventDefault()}for(let e=0,r=t.length;e<r;e++){const r=t[e],n=this._bootstrapEvent(this._rootPointerEvent,r);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,_c.pointerMoved();const t=this._normalizeToPointerData(e);for(let e=0,r=t.length;e<r;e++){const r=this._bootstrapEvent(this._rootPointerEvent,t[e]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const r=t!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let e=0,t=n.length;e<t;e++){const t=this._bootstrapEvent(this._rootPointerEvent,n[e]);t.type+=r,this.rootBoundary.mapEvent(t)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);for(let e=0,r=t.length;e<r;e++){const r=this._bootstrapEvent(this._rootPointerEvent,t[e]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}_onContextMenu(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);for(let e=0,r=t.length;e<r;e++){const r=this._bootstrapEvent(this._rootContextMenuEvent,t[e]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this._removeEvents(),this.domElement=e,_c.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;_c.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.domElement.addEventListener("contextmenu",this._onContextMenu,!0),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;_c.removeTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement.removeEventListener("contextmenu",this._onContextMenu,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(e,t,r){const n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;e.x=(t-n.left)*(this.domElement.width/n.width)*s,e.y=(r-n.top)*(this.domElement.height/n.height)*s}_normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let r=0,n=e.changedTouches.length;r<n;r++){const n=e.changedTouches[r];void 0===n.button&&(n.button=0),void 0===n.buttons&&(n.buttons=1),void 0===n.isPrimary&&(n.isPrimary=1===e.touches.length&&"touchstart"===e.type),void 0===n.width&&(n.width=n.radiusX||1),void 0===n.height&&(n.height=n.radiusY||1),void 0===n.tiltX&&(n.tiltX=0),void 0===n.tiltY&&(n.tiltY=0),void 0===n.pointerType&&(n.pointerType="touch"),void 0===n.pointerId&&(n.pointerId=n.identifier||0),void 0===n.pressure&&(n.pressure=n.force||.5),void 0===n.twist&&(n.twist=0),void 0===n.tangentialPressure&&(n.tangentialPressure=0),void 0===n.layerX&&(n.layerX=n.offsetX=n.clientX),void 0===n.layerY&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=e.type,n.altKey??(n.altKey=e.altKey),n.ctrlKey??(n.ctrlKey=e.ctrlKey),n.metaKey??(n.metaKey=e.metaKey),n.shiftKey??(n.shiftKey=e.shiftKey),t.push(n)}else if(globalThis.MouseEvent&&(!(e instanceof MouseEvent)||this.supportsPointerEvents&&e instanceof globalThis.PointerEvent))t.push(e);else{const r=e;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=1),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,t.push(r)}return t}normalizeWheelEvent(e){const t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,"pointerleave"===e.type&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=wc[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};Ec.extension={name:"events",type:[e.WebGLSystem,e.CanvasSystem,e.WebGPUSystem],priority:-1},Ec.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Ac=Ec;const Rc={onclick:null,oncontextmenu:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return"dynamic"===this.eventMode||"static"===this.eventMode},set interactive(e){this.eventMode=e?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Ac.defaultEventMode},set eventMode(e){this._internalEventMode=e},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(e,t,r){const n="boolean"==typeof r&&r||"object"==typeof r&&r.capture,s="object"==typeof r?r.signal:void 0,i="object"==typeof r&&!0===r.once,o="function"==typeof t?void 0:t;e=n?`${e}capture`:e;const a="function"==typeof t?t:t.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(e,a,o)}),i?l.once(e,a,o):l.on(e,a,o)},removeEventListener(e,t,r){const n="function"==typeof t?void 0:t;e="boolean"==typeof r&&r||"object"==typeof r&&r.capture?`${e}capture`:e,t="function"==typeof t?t:t.handleEvent,this.off(e,t,n)},dispatchEvent(e){if(!(e instanceof Rr))throw new Error("Container cannot propagate events outside of the Federated Events API");return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}};let Cc;function Mc(e){const t=Yt.get().createCanvas(6,1),r=t.getContext("2d");return r.fillStyle=e,r.fillRect(0,0,6,1),t}function Pc(){if(void 0!==Cc)return Cc;try{const e=Mc("#ff00ff"),t=Mc("#ffff00"),r=Yt.get().createCanvas(6,1).getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(e,0,0),r.drawImage(t,2,0);const n=r.getImageData(2,0,1,1);if(n){const e=n.data;Cc=255===e[0]&&0===e[1]&&0===e[2]}else Cc=!1}catch(e){Cc=!1}return Cc}const Gc={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:Pc(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:e=>{const t=e.source,r=t?.resource;if(!r)return null;const n="premultiplied-alpha"===t.alphaMode,s=t.resourceWidth??t.pixelWidth,i=t.resourceHeight??t.pixelHeight,o=s!==t.pixelWidth||i!==t.pixelHeight;if(n){if((r instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&r instanceof OffscreenCanvas)&&!o)return r;const e=Gc._unpremultipliedCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas}if(r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int8Array||r instanceof Uint16Array||r instanceof Int16Array||r instanceof Uint32Array||r instanceof Int32Array||r instanceof Float32Array||r instanceof ArrayBuffer){const e=Gc._canvasSourceCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas;const n=Yt.get().createCanvas(t.pixelWidth,t.pixelHeight),s=n.getContext("2d"),i=s.createImageData(t.pixelWidth,t.pixelHeight),o=i.data,a=r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength);if("bgra8unorm"===t.format)for(let e=0;e<o.length&&e+3<a.length;e+=4)o[e]=a[e+2],o[e+1]=a[e+1],o[e+2]=a[e],o[e+3]=a[e+3];else o.set(a.subarray(0,o.length));return s.putImageData(i,0,0),Gc._canvasSourceCache.set(t,{canvas:n,resourceId:t._resourceId}),n}if(n){const e=Yt.get().createCanvas(t.pixelWidth,t.pixelHeight),n=e.getContext("2d",{willReadFrequently:!0});e.width=t.pixelWidth,e.height=t.pixelHeight,n.drawImage(r,0,0);const s=n.getImageData(0,0,e.width,e.height),i=s.data;for(let e=0;e<i.length;e+=4){const t=i[e+3];if(t>0){const r=255/t;i[e]=Math.min(255,i[e]*r+.5),i[e+1]=Math.min(255,i[e+1]*r+.5),i[e+2]=Math.min(255,i[e+2]*r+.5)}}return n.putImageData(s,0,0),Gc._unpremultipliedCache.set(t,{canvas:e,resourceId:t._resourceId}),e}if(o){const e=Gc._canvasSourceCache.get(t);if(e?.resourceId===t._resourceId)return e.canvas;const n=Yt.get().createCanvas(t.pixelWidth,t.pixelHeight),s=n.getContext("2d");return n.width=t.pixelWidth,n.height=t.pixelHeight,s.drawImage(r,0,0),Gc._canvasSourceCache.set(t,{canvas:n,resourceId:t._resourceId}),n}return r},getTintedCanvas:(e,t)=>{const r=e.texture,n=Be.shared.setValue(t).toHex(),s=r.tintCache||(r.tintCache={}),i=s[n],o=r.source._resourceId;if(i?.tintId===o)return i;const a=i&&"getContext"in i?i:Yt.get().createCanvas();if(Gc.tintMethod(r,t,a),a.tintId=o,Gc.convertTintToImage&&void 0!==a.toDataURL){const e=Yt.get().createImage();e.src=a.toDataURL(),e.tintId=o,s[n]=e}else s[n]=a;return s[n]},getTintedPattern:(e,t)=>{const r=Be.shared.setValue(t).toHex(),n=e.patternCache||(e.patternCache={}),s=e.source._resourceId;let i=n[r];if(i?.tintId===s)return i;Gc.canvas||(Gc.canvas=Yt.get().createCanvas()),Gc.tintMethod(e,t,Gc.canvas);return i=Gc.canvas.getContext("2d").createPattern(Gc.canvas,"repeat"),i.tintId=s,n[r]=i,i},applyPatternTransform:(e,t,r=!0)=>{if(!t)return;const n=e;if(!n.setTransform)return;const s=globalThis.DOMMatrix;if(!s)return;const i=new s([t.a,t.b,t.c,t.d,t.tx,t.ty]);n.setTransform(r?i.inverse():i)},tintWithMultiply:(e,t,r)=>{const n=r.getContext("2d"),s=e.frame.clone(),i=e.source._resolution??e.source.resolution??1,o=e.rotate;s.x*=i,s.y*=i,s.width*=i,s.height*=i;const a=R.isVertical(o),l=a?s.height:s.width,u=a?s.width:s.height;r.width=Math.ceil(l),r.height=Math.ceil(u),n.save(),16777215!==t&&(n.fillStyle=Be.shared.setValue(t).toHex(),n.fillRect(0,0,l,u),n.globalCompositeOperation="multiply");const h=Gc.getCanvasSource(e);h?(o&&Gc._applyInverseRotation(n,o,s.width,s.height),n.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height),16777215!==t&&(n.globalCompositeOperation="destination-atop",n.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height)),n.restore()):n.restore()},tintWithOverlay:(e,t,r)=>{const n=r.getContext("2d"),s=e.frame.clone(),i=e.source._resolution??e.source.resolution??1,o=e.rotate;s.x*=i,s.y*=i,s.width*=i,s.height*=i;const a=R.isVertical(o),l=a?s.height:s.width,u=a?s.width:s.height;r.width=Math.ceil(l),r.height=Math.ceil(u),n.save(),n.globalCompositeOperation="copy",n.fillStyle=Be.shared.setValue(t).toHex(),n.fillRect(0,0,l,u),n.globalCompositeOperation="destination-atop";const h=Gc.getCanvasSource(e);h?(o&&Gc._applyInverseRotation(n,o,s.width,s.height),n.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height),n.restore()):n.restore()},tintWithPerPixel:(e,t,r)=>{const n=r.getContext("2d"),s=e.frame.clone(),i=e.source._resolution??e.source.resolution??1,o=e.rotate;s.x*=i,s.y*=i,s.width*=i,s.height*=i;const a=R.isVertical(o),l=a?s.height:s.width,u=a?s.width:s.height;r.width=Math.ceil(l),r.height=Math.ceil(u),n.save(),n.globalCompositeOperation="copy";const h=Gc.getCanvasSource(e);if(!h)return void n.restore();o&&Gc._applyInverseRotation(n,o,s.width,s.height),n.drawImage(h,s.x,s.y,s.width,s.height,0,0,s.width,s.height),n.restore();const c=t>>16&255,d=t>>8&255,p=255&t,f=n.getImageData(0,0,l,u),m=f.data;for(let e=0;e<m.length;e+=4)m[e]=m[e]*c/255,m[e+1]=m[e+1]*d/255,m[e+2]=m[e+2]*p/255;n.putImageData(f,0,0)},_applyInverseRotation:(e,t,r,n)=>{const s=R.inv(t),i=R.uX(s),o=R.uY(s),a=R.vX(s),l=R.vY(s),u=-Math.min(0,i*r,a*n,i*r+a*n),h=-Math.min(0,o*r,l*n,o*r+l*n);e.transform(i,o,a,l,u,h)}};Gc.tintMethod=Gc.canUseMultiply?Gc.tintWithMultiply:Gc.tintWithPerPixel;const Bc=32767;function Fc(e,t){return(e<<17)+(t<<2)}class Ic{constructor(e){this._buckets=new Map,this._screens=new _t,this._enableFullScreen=!1,this.canvasOptions=e||{}}get enableFullScreen(){return L(D,"CanvasPool.enableFullScreen is no longer used, the pool sizes canvases to the screens registered with setScreenSize."),this._enableFullScreen}set enableFullScreen(e){L(D,"CanvasPool.enableFullScreen is no longer used, the pool sizes canvases to the screens registered with setScreenSize."),this._enableFullScreen=e}_createCanvasAndContext(e,t){const r=Yt.get().createCanvas();r.width=e,r.height=t;const n=r.getContext("2d");return{canvas:r,context:n}}getOptimalCanvasAndContext(e,t,r=1){const{width:n,height:s}=this.getOptimalSize(e,t,r);(n>Bc||s>Bc)&&Oe(`CanvasPool: ${n}x${s} is larger than the 32767px pool key limit, canvases of this size may be pooled together`);const i=Fc(n,s);let o=this._buckets.get(i);o||(o=[],this._buckets.set(i,o));let a=o.pop();return a||(a=this._createCanvasAndContext(n,s)),a}getOptimalSize(e,t,r=1){const n=Math.ceil(e*r-1e-6),s=Math.ceil(t*r-1e-6),i=H(n),o=this._screens.getFittingWidth(n),a=H(s),l=this._screens.getFittingHeight(s);return{width:void 0!==o?Math.min(o,i):i,height:void 0!==l?Math.min(l,a):a}}returnCanvasAndContext(e){const t=e.canvas,{width:r,height:n}=t,s=this._buckets.get(Fc(r,n));s&&(e.context.resetTransform(),e.context.clearRect(0,0,r,n),s.push(e))}setScreenSize(e,t,r){this._screens.set(e,t,r)&&this._pruneScreenCanvases()}removeScreen(e){this._screens.remove(e)&&this._pruneScreenCanvases()}clear(){this._buckets.clear()}_pruneScreenCanvases(){for(const[e]of this._buckets){const t=e>>>17,r=e>>>2&32767;(z(t)||this._screens.hasWidth(t))&&(z(r)||this._screens.hasHeight(r))||this._buckets.delete(e)}}}const Oc=new Ic;function Dc(e,t,r,n,s,i,o,a){const l=o-r,u=a-n,h=s-r,c=i-n,d=e-r,p=t-n,f=l*l+u*u,m=l*h+u*c,g=l*d+u*p,_=h*h+c*c,x=h*d+c*p,b=1/(f*_-m*m),y=(_*g-m*x)*b,v=(f*x-m*g)*b;return y>=0&&v>=0&&y+v<1}De.register(Oc);class Uc{constructor(e=0,t=0,r=0,n=0,s=0,i=0){this.type="triangle",this.x=e,this.y=t,this.x2=r,this.y2=n,this.x3=s,this.y3=i}contains(e,t){const r=(this.x-this.x3)*(t-this.y3)-(this.y-this.y3)*(e-this.x3),n=(this.x2-this.x)*(t-this.y)-(this.y2-this.y)*(e-this.x);if(r<0!=n<0&&0!==r&&0!==n)return!1;const s=(this.x3-this.x2)*(t-this.y2)-(this.y3-this.y2)*(e-this.x2);return 0===s||s<0==r+n<=0}strokeContains(e,t,r,n=.5){const s=r/2,i=s*s,{x:o,x2:a,x3:l,y:u,y2:h,y3:c}=this;return uo(e,t,o,u,a,h)<=i||uo(e,t,a,h,l,c)<=i||uo(e,t,l,c,o,u)<=i}clone(){return new Uc(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(e){return this.x=e.x,this.y=e.y,this.x2=e.x2,this.y2=e.y2,this.x3=e.x3,this.y3=e.y3,this}copyTo(e){return e.copyFrom(this),e}getBounds(e){e||(e=new M);const t=Math.min(this.x,this.x2,this.x3),r=Math.max(this.x,this.x2,this.x3),n=Math.min(this.y,this.y2,this.y3),s=Math.max(this.y,this.y2,this.y3);return e.x=t,e.y=n,e.width=r-t,e.height=s-n,e}}const kc=new _;function Lc(e,t){t.clear();const r=t.matrix;for(let r=0;r<e.length;r++){const n=e[r];if(n.globalDisplayStatus<7)continue;const s=n.renderGroup??n.parentRenderGroup;t.matrix=s?.isCachedAsTexture?kc.copyFrom(s.textureOffsetInverseTransform).append(n.worldTransform):s?._parentCacheAsTextureRenderGroup?kc.copyFrom(s._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(n.groupTransform):n.worldTransform,t.addBounds(n.bounds)}return t.matrix=r,t}const Nc=new ne;function Xc(e,t,r,n,s=!1,i){const o=Nc;o.minX=0,o.minY=0,o.maxX=e.width/n|0,o.maxY=e.height/n|0;const a=wt.getOptimalTexture({width:o.width,height:o.height,resolution:n,autoGenerateMipmaps:s,scaleMode:i});return a.source.uploadMethodId="image",a.source.resource=e,a.source.alphaMode="premultiply-alpha-on-upload",a.frame.width=t/n,a.frame.height=r/n,a.source.emit("update",a.source),a.updateUvs(),a}function Hc(e){return"function"==typeof e.getCanvasFilterString}class zc{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new ne,this.cssFilterString=""}}class Vc{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){const t=this._pushFilterFrame(),r=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=r,t.container=e.container,t.cssFilterString="",r.every(e=>!e.enabled))return void(t.skip=!0);const n=[];for(const e of r){if(!e.enabled)continue;if(!Hc(e)){this._warnUnsupportedFilter(e);continue}const t=e.getCanvasFilterString();null!==t?t&&n.push(t):this._warnUnsupportedFilter(e)}if(0===n.length)return void(t.skip=!0);t.cssFilterString=n.join(" "),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;const s=this.renderer.canvasContext.activeContext,i=s.filter||"none";if(this._savedStates.push({filter:i,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){const e=this.renderer.canvasContext.activeResolution||1;s.save(),s.setTransform(1,0,0,1,0,0),s.beginPath(),s.rect(t.bounds.x*e,t.bounds.y*e,t.bounds.width*e,t.bounds.height*e),s.clip()}else t.useClip=!1;t.cssFilterString&&(s.filter="none"!==i?`${i} ${t.cssFilterString}`:t.cssFilterString)}pop(){const e=this._popFilterFrame();if(e.skip)return;const t=this._savedStates.pop();if(!t)return;const r=this.renderer.canvasContext.activeContext;e.useClip?r.restore():r.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!t?.length||t.every(e=>!e.enabled))return e;const r=[];for(const e of t){if(!e.enabled)continue;if(!Hc(e)){this._warnUnsupportedFilter(e);continue}const t=e.getCanvasFilterString();null!==t?t&&r.push(t):this._warnUnsupportedFilter(e)}if(0===r.length)return e;const n=Gc.getCanvasSource(e);if(!n)return e;const s=e.frame,i=e.source._resolution??e.source.resolution??1,o=s.width,a=s.height,l=Oc.getOptimalCanvasAndContext(o,a,i),{canvas:u,context:h}=l;h.setTransform(1,0,0,1,0,0),h.clearRect(0,0,u.width,u.height),r.length&&(h.filter=r.join(" "));const c=s.x*i,d=s.y*i,p=o*i,f=a*i;return h.drawImage(n,c,d,p,f,0,0,p,f),h.filter="none",h.globalAlpha=1,Xc(u,o,a,i)}_calculateFilterArea(e,t){if(e.renderables?Lc(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const r=e.container.renderGroup||e.container.parentRenderGroup,n=r?.cacheToLocalTransform;n&&t.applyMatrix(n)}}_warnUnsupportedFilter(e){const t=e?.constructor?.name||"Filter";this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new zc),this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}}Vc.extension={type:[e.CanvasSystem],name:"filter"};var Wc="in vec2 aPosition;\nout vec2 vTextureCoord;\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",$c="\nin vec2 vTextureCoord;\n\nout vec4 finalColor;\n\nuniform float uAlpha;\nuniform sampler2D uTexture;\n\nvoid main()\n{\n finalColor = texture(uTexture, vTextureCoord) * uAlpha;\n}\n",Yc="struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct AlphaUniforms {\n uAlpha:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> alphaUniforms : AlphaUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n };\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2<f32>\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition)\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n \n var sample = textureSample(uTexture, uSampler, uv);\n \n return sample * alphaUniforms.uAlpha;\n}";const jc=class e extends Zn{constructor(t){t={...e.defaultOptions,...t};const r=Pn.from({vertex:{source:Yc,entryPoint:"mainVertex"},fragment:{source:Yc,entryPoint:"mainFragment"}}),n=gn.from({vertex:Wc,fragment:$c,name:"alpha-filter"}),{alpha:s,...i}=t;super({...i,gpuProgram:r,glProgram:n,resources:{alphaUniforms:new On({uAlpha:{value:s,type:"f32"}})}})}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(e){this.resources.alphaUniforms.uniforms.uAlpha=e}};jc.defaultOptions={alpha:1};let qc=jc;const Kc={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},Zc=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","uniform vec4 uInputClamp;","out vec4 finalColor;","void main(void)","{"," %blur%","}"].join("\n");function Qc(e){const t=Kc[e],r=t.length;let n="";for(let s=0;s<e;s++){const i=s<r?s:e-s-1;n+=`${0===s?"finalColor = ":" + "}${"texture(uTexture, clamp(vBlurTexCoords[%index%], uInputClamp.xy, uInputClamp.zw)) * %value%".replace("%index%",s.toString()).replace("%value%",t[i].toString())}\n`}return Zc.replace("%blur%",`${n};`).replace("%size%",e.toString())}function Jc(e,t){const r=Math.ceil(e/2);let n,s="\n in vec2 aPosition;\n\n uniform float uStrength;\n\n out vec2 vBlurTexCoords[%size%];\n\n uniform vec4 uInputSize;\n uniform vec4 uOutputFrame;\n uniform vec4 uOutputTexture;\n\n vec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\n vec2 filterTextureCoord( void )\n {\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n float pixelStrength = uInputSize.%dimension% * uStrength;\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }",i="";n=t?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let t=0;t<e;t++){let e=n.replace("%index%",t.toString());e=e.replace("%sampleIndex%",t-(r-1)+".0"),i+=e,i+="\n"}return s=s.replace("%blur%",i),s=s.replace("%size%",e.toString()),s=s.replace("%dimension%",t?"z":"w"),s}function ed(e,t){const r=Jc(t,e),n=Qc(t);return gn.from({vertex:r,fragment:n,name:`blur-${e?"horizontal":"vertical"}-pass-filter`})}var td="\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct BlurUniforms {\n uStrength:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> blurUniforms : BlurUniforms;\n\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n %blur-struct%\n };\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);\n}\n\nfn getSize() -> vec2<f32>\n{\n return gfu.uGlobalFrame.zw;\n}\n\n\n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>,\n) -> VSOutput {\n\n let filteredCord = filterTextureCoord(aPosition);\n\n let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength;\n\n return VSOutput(\n filterVertexPosition(aPosition),\n %blur-vertex-out%\n );\n}\n\n@fragment\nfn mainFragment(\n @builtin(position) position: vec4<f32>,\n %blur-fragment-in%\n) -> @location(0) vec4<f32> {\n\n var finalColor = vec4(0.0);\n\n %blur-sampling%\n\n return finalColor;\n}\n";function rd(e,t){const r=Kc[t],n=r.length,s=[],i=[],o=[];for(let a=0;a<t;a++){s[a]=`@location(${a}) offset${a}: vec2<f32>,`,i[a]=e?`filteredCord + vec2(${a-n+1} * pixelStrength, 0.0),`:`filteredCord + vec2(0.0, ${a-n+1} * pixelStrength),`;const l=r[a<n?a:t-a-1].toString();o[a]=`finalColor += textureSample(uTexture, uSampler,\n clamp(offset${a}, gfu.uInputClamp.xy, gfu.uInputClamp.zw)) * ${l};`}const a=s.join("\n"),l=i.join("\n"),u=o.join("\n"),h=td.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",u).replace("%dimension%",e?"z":"w");return Pn.from({vertex:{source:h,entryPoint:"mainVertex"},fragment:{source:h,entryPoint:"mainFragment"}})}const nd=class e extends Zn{constructor(t){super({glProgram:ed((t={...e.defaultOptions,...t}).horizontal,t.kernelSize),gpuProgram:rd(t.horizontal,t.kernelSize),resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}},...t}),this.horizontal=t.horizontal,this.legacy=t.legacy??!1,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._blurUniforms=this.resources.blurUniforms,this._uniforms=this._blurUniforms.uniforms}apply(e,t,r,n){this.legacy?this._applyLegacy(e,t,r,n):this._applyOptimized(e,t,r,n)}_applyLegacy(e,t,r,n){if(this._uniforms.uStrength=this.strength/this.passes,1===this.passes)e.applyFilter(this,t,r,n);else{const s=wt.getSameSizeTexture(t);let i=t,o=s;this._state.blend=!1;const a=e.renderer.type===Un.WEBGPU;for(let t=0;t<this.passes-1;t++){e.applyFilter(this,i,o,0===t||a);const r=o;o=i,i=r}this._state.blend=!0,e.applyFilter(this,i,r,n),wt.returnTexture(s)}}_applyOptimized(e,t,r,n){if(this._uniforms.uStrength=this._calculateInitialStrength(),1===this.passes)e.applyFilter(this,t,r,n);else{const s=wt.getSameSizeTexture(t);let i=t,o=s;this._state.blend=!1;const a=e.renderer,l=a.type===Un.WEBGPU,u=l?a.renderPipes.uniformBatch:null;for(let t=0;t<this.passes-1;t++){u&&this.groups[1].setResource(u.getUboResource(this._blurUniforms),0),e.applyFilter(this,i,o,l);const t=o;o=i,i=t,this._uniforms.uStrength*=.5}u&&this.groups[1].setResource(u.getUboResource(this._blurUniforms),0),this._state.blend=!0,e.applyFilter(this,i,r,n),wt.returnTexture(s)}}_calculateInitialStrength(){let e=1,t=.5;for(let r=1;r<this.passes;r++)e+=t*t,t*=.5;return this.strength/Math.sqrt(e)}get blur(){return this.strength}set blur(e){this.padding=1+2*Math.abs(e),this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}};nd.defaultOptions={strength:8,quality:4,kernelSize:5,legacy:!1};let sd=nd;class id extends Zn{constructor(...e){let t=e[0]??{};"number"==typeof t&&(L(I,"BlurFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }"),t={strength:t},void 0!==e[1]&&(t.quality=e[1]),void 0!==e[2]&&(t.resolution=e[2]||"inherit"),void 0!==e[3]&&(t.kernelSize=e[3])),t={...sd.defaultOptions,...t};const{strength:r,strengthX:n,strengthY:s,quality:i,...o}=t;super({...o,compatibleRenderers:Un.BOTH,resources:{}}),this._repeatEdgePixels=!1,this.blurXFilter=new sd({horizontal:!0,...t}),this.blurYFilter=new sd({horizontal:!1,...t}),this.quality=i,this.strengthX=n??r,this.strengthY=s??r,this.repeatEdgePixels=!1}apply(e,t,r,n){const s=Math.abs(this.blurXFilter.strength),i=Math.abs(this.blurYFilter.strength);if(s&&i){const s=wt.getSameSizeTexture(t);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(e,t,s,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,s,r,n),wt.returnTexture(s)}else i?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,t,r,n)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(e,t,r,n))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get strengthX(){return this.blurXFilter.blur}set strengthX(e){this.blurXFilter.blur=e,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(e){this.blurYFilter.blur=e,this.updatePadding()}get blur(){return L("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength}set blur(e){L("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength=e}get blurX(){return L("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX}set blurX(e){L("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX=e}get blurY(){return L("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY}set blurY(e){L("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}}id.defaultOptions={strength:8,quality:4,kernelSize:5,legacy:!1};var od="\nin vec2 vTextureCoord;\nin vec4 vColor;\n\nout vec4 finalColor;\n\nuniform float uColorMatrix[20];\nuniform float uAlpha;\n\nuniform sampler2D uTexture;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture(uTexture, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * 0.2);\n float diff = (randomValue - 0.5) * 0.5;\n\n if (uAlpha == 0.0) {\n finalColor = color;\n return;\n }\n\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n vec4 result;\n\n result.r = (uColorMatrix[0] * color.r);\n result.r += (uColorMatrix[1] * color.g);\n result.r += (uColorMatrix[2] * color.b);\n result.r += (uColorMatrix[3] * color.a);\n result.r += uColorMatrix[4];\n\n result.g = (uColorMatrix[5] * color.r);\n result.g += (uColorMatrix[6] * color.g);\n result.g += (uColorMatrix[7] * color.b);\n result.g += (uColorMatrix[8] * color.a);\n result.g += uColorMatrix[9];\n\n result.b = (uColorMatrix[10] * color.r);\n result.b += (uColorMatrix[11] * color.g);\n result.b += (uColorMatrix[12] * color.b);\n result.b += (uColorMatrix[13] * color.a);\n result.b += uColorMatrix[14];\n\n result.a = (uColorMatrix[15] * color.r);\n result.a += (uColorMatrix[16] * color.g);\n result.a += (uColorMatrix[17] * color.b);\n result.a += (uColorMatrix[18] * color.a);\n result.a += uColorMatrix[19];\n\n vec3 rgb = mix(color.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n finalColor = vec4(rgb, result.a);\n}\n",ad="struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct ColorMatrixUniforms {\n uColorMatrix:array<vec4<f32>, 5>,\n uAlpha:f32,\n};\n\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n@group(1) @binding(0) var<uniform> colorMatrixUniforms : ColorMatrixUniforms;\n\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n };\n \nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition),\n );\n}\n\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n) -> @location(0) vec4<f32> {\n\n\n var c = textureSample(uTexture, uSampler, uv);\n \n if (colorMatrixUniforms.uAlpha == 0.0) {\n return c;\n }\n\n \n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.r /= c.a;\n c.g /= c.a;\n c.b /= c.a;\n }\n\n var cm = colorMatrixUniforms.uColorMatrix;\n\n\n var result = vec4<f32>(0.);\n\n result.r = (cm[0][0] * c.r);\n result.r += (cm[0][1] * c.g);\n result.r += (cm[0][2] * c.b);\n result.r += (cm[0][3] * c.a);\n result.r += cm[1][0];\n\n result.g = (cm[1][1] * c.r);\n result.g += (cm[1][2] * c.g);\n result.g += (cm[1][3] * c.b);\n result.g += (cm[2][0] * c.a);\n result.g += cm[2][1];\n\n result.b = (cm[2][2] * c.r);\n result.b += (cm[2][3] * c.g);\n result.b += (cm[3][0] * c.b);\n result.b += (cm[3][1] * c.a);\n result.b += cm[3][2];\n\n result.a = (cm[3][3] * c.r);\n result.a += (cm[4][0] * c.g);\n result.a += (cm[4][1] * c.b);\n result.a += (cm[4][2] * c.a);\n result.a += cm[4][3];\n\n var rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha);\n\n rgb.r *= result.a;\n rgb.g *= result.a;\n rgb.b *= result.a;\n\n return vec4(rgb, result.a);\n}";class ld extends Zn{constructor(e={}){const t=new On({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}});super({...e,gpuProgram:Pn.from({vertex:{source:ad,entryPoint:"mainVertex"},fragment:{source:ad,entryPoint:"mainFragment"}}),glProgram:gn.from({vertex:Wc,fragment:od,name:"color-matrix-filter"}),resources:{colorMatrixUniforms:t}}),this.alpha=1}_loadMatrix(e,t=!1){if(t){const t=[...e];this._multiply(t,this.matrix,e),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}else this.resources.colorMatrixUniforms.uniforms.uColorMatrix=e;this.resources.colorMatrixUniforms.update()}_multiply(e,t,r){return e[0]=t[0]*r[0]+t[1]*r[5]+t[2]*r[10]+t[3]*r[15],e[1]=t[0]*r[1]+t[1]*r[6]+t[2]*r[11]+t[3]*r[16],e[2]=t[0]*r[2]+t[1]*r[7]+t[2]*r[12]+t[3]*r[17],e[3]=t[0]*r[3]+t[1]*r[8]+t[2]*r[13]+t[3]*r[18],e[4]=t[0]*r[4]+t[1]*r[9]+t[2]*r[14]+t[3]*r[19]+t[4],e[5]=t[5]*r[0]+t[6]*r[5]+t[7]*r[10]+t[8]*r[15],e[6]=t[5]*r[1]+t[6]*r[6]+t[7]*r[11]+t[8]*r[16],e[7]=t[5]*r[2]+t[6]*r[7]+t[7]*r[12]+t[8]*r[17],e[8]=t[5]*r[3]+t[6]*r[8]+t[7]*r[13]+t[8]*r[18],e[9]=t[5]*r[4]+t[6]*r[9]+t[7]*r[14]+t[8]*r[19]+t[9],e[10]=t[10]*r[0]+t[11]*r[5]+t[12]*r[10]+t[13]*r[15],e[11]=t[10]*r[1]+t[11]*r[6]+t[12]*r[11]+t[13]*r[16],e[12]=t[10]*r[2]+t[11]*r[7]+t[12]*r[12]+t[13]*r[17],e[13]=t[10]*r[3]+t[11]*r[8]+t[12]*r[13]+t[13]*r[18],e[14]=t[10]*r[4]+t[11]*r[9]+t[12]*r[14]+t[13]*r[19]+t[14],e[15]=t[15]*r[0]+t[16]*r[5]+t[17]*r[10]+t[18]*r[15],e[16]=t[15]*r[1]+t[16]*r[6]+t[17]*r[11]+t[18]*r[16],e[17]=t[15]*r[2]+t[16]*r[7]+t[17]*r[12]+t[18]*r[17],e[18]=t[15]*r[3]+t[16]*r[8]+t[17]*r[13]+t[18]*r[18],e[19]=t[15]*r[4]+t[16]*r[9]+t[17]*r[14]+t[18]*r[19]+t[19],e}brightness(e,t){const r=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)}tint(e,t){const[r,n,s]=Be.shared.setValue(e).toArray(),i=[r,0,0,0,0,0,n,0,0,0,0,0,s,0,0,0,0,0,1,0];this._loadMatrix(i,t)}greyscale(e,t){const r=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)}grayscale(e,t){this.greyscale(e,t)}blackAndWhite(e){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],e)}hue(e,t){e=(e||0)/180*Math.PI;const r=Math.cos(e),n=Math.sin(e),s=1/3,i=(0,Math.sqrt)(s),o=[r+(1-r)*s,s*(1-r)-i*n,s*(1-r)+i*n,0,0,s*(1-r)+i*n,r+s*(1-r),s*(1-r)-i*n,0,0,s*(1-r)-i*n,s*(1-r)+i*n,r+s*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,t)}contrast(e,t){const r=(e||0)+1,n=-.5*(r-1),s=[r,0,0,0,n,0,r,0,0,n,0,0,r,0,n,0,0,0,1,0];this._loadMatrix(s,t)}saturate(e=0,t){const r=2*e/3+1,n=-.5*(r-1),s=[r,n,n,0,0,n,r,n,0,0,n,n,r,0,0,0,0,0,1,0];this._loadMatrix(s,t)}desaturate(){this.saturate(-1)}negative(e){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e)}sepia(e){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],e)}technicolor(e){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,.046249425232852304,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.2758903984886823,-.231103377548616,-.7501899197440212,1.847597816108189,0,.12137623870388682,0,0,0,1,0],e)}polaroid(e){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],e)}toBGR(e){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],e)}kodachrome(e){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,.24991995145868634,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,.09698983488904393,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,.13972481597886063,0,0,0,1,0],e)}browni(e){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,.1860075629647401,-.037703249837783157,.8609577587992641,.15059552388459913,0,-.14497417640467167,.24113635128153335,-.07441037908422492,.44972182064877153,0,-.029655197167024642,0,0,0,1,0],e)}vintage(e){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,.037848179746251466,.02578397704808868,.6441188644374771,.03259127616149294,0,.029265996770472907,.0466055556782719,-.0851232987247891,.5241648018700465,0,.020232119953863904,0,0,0,1,0],e)}colorTone(e,t,r,n,s){e||(e=.2),t||(t=.15),r||(r=16770432),n||(n=3375104);const i=Be.shared,[o,a,l]=i.setValue(r).toArray(),[u,h,c]=i.setValue(n).toArray(),d=[.3,.59,.11,0,0,o,a,l,e,0,u,h,c,t,0,o-u,a-h,l-c,0,0];this._loadMatrix(d,s)}night(e,t){e||(e=.1);const r=[-2*e,-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(r,t)}predator(e,t){const r=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(r,t)}lsd(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(e){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=e}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(e){this.resources.colorMatrixUniforms.uniforms.uAlpha=e}}var ud="\nin vec2 vTextureCoord;\nin vec2 vFilterUv;\n\nout vec4 finalColor;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMapTexture;\n\nuniform vec4 uInputClamp;\nuniform highp vec4 uInputSize;\nuniform mat2 uRotation;\nuniform vec2 uScale;\n\nvoid main()\n{\n vec4 map = texture(uMapTexture, vFilterUv);\n \n vec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale; \n\n finalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw));\n}\n",hd="in vec2 aPosition;\nout vec2 vTextureCoord;\nout vec2 vFilterUv;\n\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\n\nuniform mat3 uFilterMatrix;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvec2 getFilterCoord( void )\n{\n return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy;\n}\n\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vFilterUv = getFilterCoord();\n}\n",cd="\nstruct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct DisplacementUniforms {\n uFilterMatrix:mat3x3<f32>,\n uScale:vec2<f32>,\n uRotation:mat2x2<f32>\n};\n\n\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> filterUniforms : DisplacementUniforms;\n@group(1) @binding(1) var uMapTexture: texture_2d<f32>;\n@group(1) @binding(2) var uMapSampler : sampler;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) filterUv : vec2<f32>,\n };\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n{\n return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n}\n\nfn getSize() -> vec2<f32>\n{\n\n \n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition),\n getFilterCoord(aPosition)\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @location(1) filterUv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n\n var map = textureSample(uMapTexture, uMapSampler, filterUv);\n\n var offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale; \n \n return textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n}";class dd extends Zn{constructor(...e){let t=e[0];t instanceof Ut&&(e[1]&&L(I,"DisplacementFilter now uses options object instead of params. {sprite, scale}"),t={sprite:t,scale:e[1]});const{sprite:r,scale:n,...s}=t;let i=n??20;"number"==typeof i&&(i=new m(i,i));const o=new On({uFilterMatrix:{value:new _,type:"mat3x3<f32>"},uScale:{value:i,type:"vec2<f32>"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2<f32>"}}),a=gn.from({vertex:hd,fragment:ud,name:"displacement-filter"}),l=Pn.from({vertex:{source:cd,entryPoint:"mainVertex"},fragment:{source:cd,entryPoint:"mainFragment"}}),u=r.texture.source;super({...s,gpuProgram:l,glProgram:a,resources:{filterUniforms:o,uMapTexture:u,uMapSampler:u.style}}),this._sprite=t.sprite,this._sprite.renderable=!1}apply(e,t,r,n){const s=this.resources.filterUniforms.uniforms;e.calculateSpriteMatrix(s.uFilterMatrix,this._sprite);const i=this._sprite.worldTransform,o=Math.sqrt(i.a*i.a+i.b*i.b),a=Math.sqrt(i.c*i.c+i.d*i.d);0!==o&&0!==a&&(s.uRotation[0]=i.a/o,s.uRotation[1]=i.b/o,s.uRotation[2]=i.c/a,s.uRotation[3]=i.d/a),this.resources.uMapTexture=this._sprite.texture.source,e.applyFilter(this,t,r,n)}get scale(){return this.resources.filterUniforms.uniforms.uScale}}var pd="\nin vec2 vTextureCoord;\nin vec4 vColor;\n\nout vec4 finalColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uTexture;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture(uTexture, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n finalColor = color;\n}\n",fd="\n\nstruct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct NoiseUniforms {\n uNoise:f32,\n uSeed:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> noiseUniforms : NoiseUniforms;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n };\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n}\n\nfn getSize() -> vec2<f32>\n{\n return gfu.uGlobalFrame.zw;\n}\n \n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>, \n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition)\n );\n}\n\nfn rand(co:vec2<f32>) -> f32\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\n\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n\n var pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy);\n \n \n var sample = textureSample(uTexture, uSampler, uv);\n var randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed);\n var diff = (randomValue - 0.5) * noiseUniforms.uNoise;\n \n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (sample.a > 0.0) {\n sample.r /= sample.a;\n sample.g /= sample.a;\n sample.b /= sample.a;\n }\n\n sample.r += diff;\n sample.g += diff;\n sample.b += diff;\n\n // Premultiply alpha again.\n sample.r *= sample.a;\n sample.g *= sample.a;\n sample.b *= sample.a;\n \n return sample;\n}";const md=class e extends Zn{constructor(t={}){t={...e.defaultOptions,...t};const r=Pn.from({vertex:{source:fd,entryPoint:"mainVertex"},fragment:{source:fd,entryPoint:"mainFragment"}}),n=gn.from({vertex:Wc,fragment:pd,name:"noise-filter"}),{noise:s,seed:i,...o}=t;super({...o,gpuProgram:r,glProgram:n,resources:{noiseUniforms:new On({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}}),this.noise=s,this.seed=i??Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(e){this.resources.noiseUniforms.uniforms.uNoise=e}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(e){this.resources.noiseUniforms.uniforms.uSeed=e}};md.defaultOptions={noise:.5};let gd=md;var _d="in vec2 vTextureCoord;\nout vec4 finalColor;\nuniform sampler2D uTexture;\nvoid main() {\n finalColor = texture(uTexture, vTextureCoord);\n}\n",xd="struct GlobalFilterUniforms {\n uInputSize: vec4<f32>,\n uInputPixel: vec4<f32>,\n uInputClamp: vec4<f32>,\n uOutputFrame: vec4<f32>,\n uGlobalFrame: vec4<f32>,\n uOutputTexture: vec4<f32>,\n};\n\n@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler: sampler;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv: vec2<f32>\n};\n\nfn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\n@vertex\nfn mainVertex(\n @location(0) aPosition: vec2<f32>,\n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition)\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n) -> @location(0) vec4<f32> {\n return textureSample(uTexture, uSampler, uv);\n}\n";class bd extends Zn{constructor(){super({gpuProgram:Pn.from({vertex:{source:xd,entryPoint:"mainVertex"},fragment:{source:xd,entryPoint:"mainFragment"},name:"passthrough-filter"}),glProgram:gn.from({vertex:Wc,fragment:_d,name:"passthrough-filter"})})}}class yd{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){"pushFilter"===e.action?this._renderer.filter.push(e):"popFilter"===e.action&&this._renderer.filter.pop()}destroy(){this._renderer=null}}yd.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"filter"};const vd=new Lo({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});class Td{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new ne,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}}class Sd{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new On({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Dn({}),this.renderer=e}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){const t=this.renderer,r=e.filterEffect.filters,n=this._pushFilterData();n.skip=!1,n.filters=r,n.container=e.container,n.outputRenderSurface=t.renderTarget.renderSurface;const s=t.renderTarget.renderTarget.colorTexture.source,i=s.resolution,o=s.antialias;if(r.every(e=>!e.enabled))return void(n.skip=!0);const a=n.bounds;if(this._calculateFilterArea(e,a),this._calculateFilterBounds(n,t.renderTarget.rootViewPort,o,i,1),n.skip)return;const l=this._getPreviousFilterData();this._setupFilterTextures(n,a,t,l)}generateFilteredTexture({texture:e,filters:t}){if(t.every(e=>!e.enabled))return e;const r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=t;const n=e.source,s=n.resolution,i=n.antialias,o=r.bounds;if(o.clear(),o.addRect(e.frame),this._calculateFilterBounds(r,o.rectangle,i,s,0),r.skip)return this._popFilterData(),e;r.outputRenderSurface=wt.getOptimalTexture({width:o.width,height:o.height,resolution:r.resolution,antialias:r.antialias}),r.backTexture=ee.EMPTY,r.inputTexture=e;this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);const a=r.outputRenderSurface;return a.source.alphaMode="premultiplied-alpha",this._popFilterData(),a}pop(){const e=this.renderer,t=this._popFilterData();t.skip||(e.globalUniforms.pop(),e.renderTarget.finishRenderPass(),this._activeFilterData=t,this._applyFiltersToTexture(t,!1),t.blendRequired&&wt.returnTexture(t.backTexture),wt.returnTexture(t.inputTexture))}getBackTexture(e,t,r){const n=e.colorTexture.source._resolution,s=wt.getOptimalTexture({width:t.width,height:t.height,resolution:n});let i=t.minX,o=t.minY;r&&(i-=r.minX,o-=r.minY),i=Math.floor(i*n),o=Math.floor(o*n);const a=Math.ceil(t.width*n),l=Math.ceil(t.height*n);return this.renderer.renderTarget.copyToTexture(e,s,{x:i,y:o},{width:a,height:l},{x:0,y:0}),s}applyFilter(e,t,r,n){const s=this.renderer,i=this._activeFilterData,o=i.outputRenderSurface===r,a=this._findClosestFilterData(),l=a?a.inputTexture.source._resolution:s.renderTarget.rootRenderTarget.colorTexture.source._resolution;let u=0,h=0;o&&a&&(u=a.bounds.minX,h=a.bounds.minY),this._updateFilterUniforms(t,r,i,u,h,l,o,n);const c=e.enabled?e:this._getPassthroughFilter();this._setupBindGroupsAndRender(c,t,s)}calculateSpriteMatrix(e,t){const r=this._activeFilterData,n=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),s=t.worldTransform.copyTo(_.shared),i=t.renderGroup||t.parentRenderGroup;return i&&i.cacheToLocalTransform&&s.prepend(i.cacheToLocalTransform),s.invert(),n.prepend(s),n.scale(1/t.texture.orig.width,1/t.texture.orig.height),n.translate(t.anchor.x,t.anchor.y),n}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new bd),this._passthroughFilter}_setupBindGroupsAndRender(e,t,r){if(r.renderPipes.uniformBatch){const e=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(e,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:vd,shader:e,state:e._state,topology:"triangle-list"}),r.type===Un.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(e,t,r,n){if(e.backTexture=ee.EMPTY,e.inputTexture=wt.getOptimalTexture({width:t.width,height:t.height,resolution:e.resolution,antialias:e.antialias}),e.blendRequired){r.renderTarget.finishRenderPass();const s=r.renderTarget.getRenderTarget(e.outputRenderSurface);e.backTexture=this.getBackTexture(s,t,n?.bounds)}r.renderTarget.bind({target:e.inputTexture,clear:!0}),r.globalUniforms.push({offset:t})}_updateFilterUniforms(e,t,r,n,s,i,o,a){const l=this._filterGlobalUniforms.uniforms,u=l.uOutputFrame,h=l.uInputSize,c=l.uInputPixel,d=l.uInputClamp,p=l.uGlobalFrame,f=l.uOutputTexture;o?(u[0]=r.bounds.minX-n,u[1]=r.bounds.minY-s):(u[0]=0,u[1]=0),u[2]=e.frame.width,u[3]=e.frame.height,h[0]=e.source.width,h[1]=e.source.height,h[2]=1/h[0],h[3]=1/h[1],c[0]=e.source.pixelWidth,c[1]=e.source.pixelHeight,c[2]=1/c[0],c[3]=1/c[1],d[0]=.5*c[2],d[1]=.5*c[3],d[2]=e.frame.width*h[2]-.5*c[2],d[3]=e.frame.height*h[3]-.5*c[3];const m=this.renderer.renderTarget.rootRenderTarget.colorTexture;p[0]=n*i,p[1]=s*i,p[2]=m.source.width*i,p[3]=m.source.height*i,t instanceof ee&&(t.source.resource=null);const g=this.renderer.renderTarget.getRenderTarget(t);this.renderer.renderTarget.bind({target:t,clear:!!a}),t instanceof ee?(f[0]=t.frame.width,f[1]=t.frame.height):(f[0]=g.width,f[1]=g.height),f[2]=g.isRoot?-1:1,this._filterGlobalUniforms.update()}_findClosestFilterData(){for(let e=this._filterStackIndex-1;e>=0;e--){const t=this._filterStack[e];if(!t.skip)return t}return null}_calculateFilterArea(e,t){if(e.renderables?Lc(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const r=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;r&&t.applyMatrix(r)}}_applyFiltersToTexture(e,t){const r=e.inputTexture,n=e.bounds,s=e.filters,i=e.firstEnabledIndex,o=e.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(e.backTexture.source,3),i===o)s[i].apply(this,r,e.outputRenderSurface,t);else{let r=e.inputTexture;const a=wt.getOptimalTexture({width:n.width,height:n.height,resolution:r.source._resolution});let l=a;for(let e=i;e<o;e++){const t=s[e];if(!t.enabled)continue;t.apply(this,r,l,!0);const n=r;r=l,l=n}s[o].apply(this,r,e.outputRenderSurface,t),wt.returnTexture(a)}}_calculateFilterBounds(e,t,r,n,s){const i=this.renderer,o=e.bounds,a=e.filters;let l=1/0,u=0,h=!0,c=!1,d=!1,p=!0,f=-1,m=-1;for(let e=0;e<a.length;e++){const t=a[e];if(!t.enabled)continue;-1===f&&(f=e),m=e,l=Math.min(l,"inherit"===t.resolution?n:t.resolution),u+=t.padding,"off"===t.antialias?h=!1:"inherit"===t.antialias&&h&&(h=r),t.clipToViewport||(p=!1);if(!!!(t.compatibleRenderers&i.type)){d=!1;break}if(t.blendRequired&&!(i.backBuffer?.useBackBuffer??1)){Oe("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),d=!1;break}d=!0,c||(c=t.blendRequired)}d?(p&&o.fitBounds(0,t.width/n,0,t.height/n),o.scale(l).ceil().scale(1/l).pad((0|u)*s),o.isPositive?(e.antialias=h,e.resolution=l,e.blendRequired=c,e.firstEnabledIndex=f,e.lastEnabledIndex=m):e.skip=!0):e.skip=!0}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){for(let e=this._filterStackIndex-2;e>=0;e--){const t=this._filterStack[e];if(!t.skip)return t}return null}_pushFilterData(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new Td),this._filterStackIndex++,e}}Sd.extension={type:[e.WebGLSystem,e.WebGPUSystem],name:"filter"};var wd="in vec2 vMaskCoord;\nin vec2 vTextureCoord;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMaskTexture;\n\nuniform float uAlpha;\nuniform vec4 uMaskClamp;\nuniform float uInverse;\nuniform float uChannel;\n\nout vec4 finalColor;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(uMaskClamp.x, vMaskCoord.x) +\n step(uMaskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, uMaskClamp.z) +\n step(vMaskCoord.y, uMaskClamp.w));\n\n // TODO look into why this is needed\n float npmAlpha = uAlpha;\n vec4 original = texture(uTexture, vTextureCoord);\n vec4 masky = texture(uMaskTexture, vMaskCoord);\n\n float a;\n if (uChannel == 1.0) {\n a = masky.a * npmAlpha * clip;\n } else {\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n a = alphaMul * masky.r * npmAlpha * clip;\n }\n\n if (uInverse == 1.0) {\n a = 1.0 - a;\n }\n\n finalColor = original * a;\n}\n",Ed="in vec2 aPosition;\n\nout vec2 vTextureCoord;\nout vec2 vMaskCoord;\n\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\nuniform mat3 uFilterMatrix;\n\nvec4 filterVertexPosition( vec2 aPosition )\n{\n vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n \n position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( vec2 aPosition )\n{\n return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvec2 getFilterCoord( vec2 aPosition )\n{\n return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n} \n\nvoid main(void)\n{\n gl_Position = filterVertexPosition(aPosition);\n vTextureCoord = filterTextureCoord(aPosition);\n vMaskCoord = getFilterCoord(aPosition);\n}\n",Ad="struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n};\n\nstruct MaskUniforms {\n uFilterMatrix:mat3x3<f32>,\n uMaskClamp:vec4<f32>,\n uAlpha:f32,\n uInverse:f32,\n uChannel:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;\n@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) filterUv : vec2<f32>,\n};\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);\n}\n\nfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n{\n return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n}\n\nfn getSize() -> vec2<f32>\n{\n return gfu.uGlobalFrame.zw;\n}\n\n@vertex\nfn mainVertex(\n @location(0) aPosition : vec2<f32>,\n) -> VSOutput {\n return VSOutput(\n filterVertexPosition(aPosition),\n filterTextureCoord(aPosition),\n getFilterCoord(aPosition)\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @location(1) filterUv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n\n var maskClamp = filterUniforms.uMaskClamp;\n var uAlpha = filterUniforms.uAlpha;\n\n var clip = step(3.5,\n step(maskClamp.x, filterUv.x) +\n step(maskClamp.y, filterUv.y) +\n step(filterUv.x, maskClamp.z) +\n step(filterUv.y, maskClamp.w));\n\n var mask = textureSample(uMaskTexture, uSampler, filterUv);\n var source = textureSample(uTexture, uSampler, uv);\n\n var a: f32;\n if (filterUniforms.uChannel == 1.0) {\n a = mask.a * uAlpha * clip;\n } else {\n var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);\n a = alphaMul * mask.r * uAlpha * clip;\n }\n\n if (filterUniforms.uInverse == 1.0) {\n a = 1.0 - a;\n }\n\n return source * a;\n}\n";class Rd extends Zn{constructor(e){const{sprite:t,...r}=e,n=new J(t.texture),s=new On({uFilterMatrix:{value:new _,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"},uChannel:{value:"alpha"===e.channel?1:0,type:"f32"}});super({...r,gpuProgram:Pn.from({vertex:{source:Ad,entryPoint:"mainVertex"},fragment:{source:Ad,entryPoint:"mainFragment"}}),glProgram:gn.from({vertex:Ed,fragment:wd,name:"mask-filter"}),clipToViewport:!1,resources:{filterUniforms:s,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=n}setSprite(e){this.sprite=e;const t=this._getSafeTexture();this._textureMatrix.texture=t,this.resources.uMaskTexture=t.source}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return 1===this.resources.filterUniforms.uniforms.uInverse}set channel(e){this.resources.filterUniforms.uniforms.uChannel="alpha"===e?1:0}get channel(){return 1===this.resources.filterUniforms.uniforms.uChannel?"alpha":"red"}apply(e,t,r,n){const s=this._getSafeTexture();this._textureMatrix.texture=s,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=s.source,e.applyFilter(this,t,r,n)}_getSafeTexture(){const e=this.sprite.texture;return e.destroyed||!e.source||e.source.destroyed?(Oe("[MaskFilter] The mask texture was destroyed while the mask is still in use. Remove the mask before destroying its texture."),ee.EMPTY):e}destroy(e=!1){this._textureMatrix.destroy(),super.destroy(e)}}var Cd="fn getLuminosity(c: vec3<f32>) -> f32 {\n return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;\n}\n\nfn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32> {\n let d: f32 = lum - getLuminosity(c);\n let newColor: vec3<f32> = c.rgb + vec3<f32>(d, d, d);\n\n // clip back into legal range\n let newLum: f32 = getLuminosity(newColor);\n let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b));\n let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b));\n\n let t1: f32 = newLum / (newLum - cMin);\n let t2: f32 = (1.0 - newLum) / (cMax - newLum);\n\n let finalColor = mix(vec3<f32>(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0));\n\n return finalColor;\n}\n\nfn getSaturation(c: vec3<f32>) -> f32 {\n return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));\n}\n\n// Set saturation if color components are sorted in ascending order.\nfn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32> {\n var result: vec3<f32>;\n if (cSorted.z > cSorted.x) {\n let newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x));\n result = vec3<f32>(0.0, newY, s);\n } else {\n result = vec3<f32>(0.0, 0.0, 0.0);\n }\n return vec3<f32>(result.x, result.y, result.z);\n}\n\nfn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {\n var result: vec3<f32> = c;\n\n if (c.r <= c.g && c.r <= c.b) {\n if (c.g <= c.b) {\n result = setSaturationMinMidMax(result, s);\n } else {\n var temp: vec3<f32> = vec3<f32>(result.r, result.b, result.g);\n temp = setSaturationMinMidMax(temp, s);\n result = vec3<f32>(temp.r, temp.b, temp.g);\n }\n } else if (c.g <= c.r && c.g <= c.b) {\n if (c.r <= c.b) {\n var temp: vec3<f32> = vec3<f32>(result.g, result.r, result.b);\n temp = setSaturationMinMidMax(temp, s);\n result = vec3<f32>(temp.g, temp.r, temp.b);\n } else {\n var temp: vec3<f32> = vec3<f32>(result.g, result.b, result.r);\n temp = setSaturationMinMidMax(temp, s);\n result = vec3<f32>(temp.g, temp.b, temp.r);\n }\n } else {\n if (c.r <= c.g) {\n var temp: vec3<f32> = vec3<f32>(result.b, result.r, result.g);\n temp = setSaturationMinMidMax(temp, s);\n result = vec3<f32>(temp.b, temp.r, temp.g);\n } else {\n var temp: vec3<f32> = vec3<f32>(result.b, result.g, result.r);\n temp = setSaturationMinMidMax(temp, s);\n result = vec3<f32>(temp.b, temp.g, temp.r);\n }\n }\n\n return result;\n}";const Md=class e{constructor(t){this._tick=()=>{this._destroyed||(this.timeout=setTimeout(this._processQueue,0))},this._processQueue=()=>{if(this._destroyed)return;const{queue:t}=this;let r=0;for(;t.length&&r<e.uploadsPerFrame;){const e=t.shift();this.uploadQueueItem(e),r++}t.length?er.system.addOnce(this._tick,this,Kt.UTILITY):this._resolve()},this.renderer=t,this.queue=[],this.resolves=[]}getQueue(){return[...this.queue]}add(e){const t=Array.isArray(e)?e:[e];for(const e of t)e instanceof Ot?this._addContainer(e):this.resolveQueueItem(e,this.queue);return this}_addContainer(e){this.resolveQueueItem(e,this.queue);for(const t of e.children)this._addContainer(t)}upload(e){return e&&this.add(e),new Promise(e=>{this.queue.length?(this.resolves.push(e),this.dedupeQueue(),er.system.addOnce(this._tick,this,Kt.UTILITY)):e()})}dedupeQueue(){const e=Object.create(null);let t=0;for(let r=0;r<this.queue.length;r++){const n=this.queue[r];e[n.uid]||(e[n.uid]=!0,this.queue[t++]=n)}this.queue.length=t}destroy(){this._destroyed=!0,clearTimeout(this.timeout)}_resolve(){const{resolves:e}=this,t=e.slice(0);e.length=0;for(const e of t)e()}};Md.uploadsPerFrame=4;let Pd=Md;class Gd{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class Bd{constructor(){this.instructions=new gt}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const Fd=class e{constructor(e){this._renderer=e,this._managedContexts=new Pa({renderer:e,type:"resource",name:"graphicsContext"})}init(t){e.defaultOptions.bezierSmoothness=t?.bezierSmoothness??e.defaultOptions.bezierSmoothness}getContextRenderData(e){return this.getGpuContext(e).graphicsData||this._initContextRenderData(e)}updateGpuContext(e){const t=e._gpuData,r=!!t[this._renderer.uid],n=t[this._renderer.uid]||this._initContext(e);return!e.dirty&&r||(r&&n.reset(),n.isBatchable=!1,e.dirty=!1),n}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){const t=new Bd;return this.getGpuContext(e).graphicsData=t,t.init(),t}_initContext(e){const t=new Gd;return t.context=e,e._gpuData[this._renderer.uid]=t,this._managedContexts.add(e),t}destroy(){this._managedContexts.destroy(),this._renderer=null}};Fd.extension={type:[e.CanvasSystem],name:"graphicsContext"},Fd.defaultOptions={bezierSmoothness:.5};let Id=Fd;class Od{constructor(e,t){this.state=qn.for2d(),this.renderer=e,this._adaptor=t,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Pa({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){return!1}addRenderable(e,t){this._managedGraphics.add(e),this.renderer.renderPipes.batch.break(t),t.add(e)}updateRenderable(e){}execute(e){e.isRenderable&&this._adaptor.execute(this,e)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}function Dd(e,t,r,n){r[n++]=(e>>16&255)/255,r[n++]=(e>>8&255)/255,r[n++]=(255&e)/255,r[n++]=t}function Ud(e,t,r){const n=(e>>24&255)/255;t[r++]=(255&e)/255*n,t[r++]=(e>>8&255)/255*n,t[r++]=(e>>16&255)/255*n,t[r++]=n}Od.extension={type:[e.CanvasPipes],name:"graphics"};class kd{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(e=>{Le.return(e)}),this.batches.length=0}}class Ld{constructor(e,t){this.state=qn.for2d(),this.renderer=e,this._adaptor=t,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Pa({renderer:e,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(e){const t=e.context,r=!!e._gpuData,n=this.renderer.graphicsContext.updateGpuContext(t);return!(!n.isBatchable&&r===n.isBatchable)}addRenderable(e,t){const r=this.renderer.graphicsContext.updateGpuContext(e.context);!e.didViewUpdate&&e._gpuData[this.renderer.uid]||this._rebuild(e),r.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){const t=this._getGpuDataForRenderable(e).batches;for(let e=0;e<t.length;e++){const r=t[e];r._batcher.updateElement(r)}}execute(e){if(!e.isRenderable)return;const t=this.renderer,r=e.context;if(!t.graphicsContext.getGpuContext(r).batches.length)return;const n=r.customShader||this._adaptor.shader;this.state.blendMode=e.groupBlendMode;const s=n.resources.localUniforms.uniforms;s.uTransformMatrix=e.groupTransform,s.uRound=t._roundPixels|e._roundPixels,Ud(e.groupColorAlpha,s.uColor,0),this._adaptor.execute(this,e)}_rebuild(e){const t=this._getGpuDataForRenderable(e),r=this.renderer.graphicsContext.updateGpuContext(e.context);t.destroy(),r.isBatchable&&this._updateBatchesForRenderable(e,t)}_addToBatcher(e,t){const r=this.renderer.renderPipes.batch,n=this._getGpuDataForRenderable(e).batches;for(let e=0;e<n.length;e++){const s=n[e];r.addToBatch(s,t)}}_getGpuDataForRenderable(e){return e._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(e)}_initGpuDataForRenderable(e){const t=new kd;return e._gpuData[this.renderer.uid]=t,this._managedGraphics.add(e),t}_updateBatchesForRenderable(e,t){const r=e.context,n=this.renderer.graphicsContext.getGpuContext(r),s=this.renderer._roundPixels|e._roundPixels;t.batches=n.batches.map(t=>{const r=Le.get(Oa);return t.copyTo(r),r.renderable=e,r.roundPixels=s,r})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Ld.extension={type:[e.WebGLPipes,e.WebGPUPipes],name:"graphics"},n.add(Od),n.add(Ld),n.add(Id),n.add(fl);let Nd=class e extends Dt{constructor(e){e instanceof hu&&(e={context:e});const{context:t,roundPixels:r,...n}=e||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",t?this.context=t:(this.context=this._ownedContext=new hu,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(e){e!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=e,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(e){return this._context.containsPoint(e)}destroy(e){this._ownedContext&&!e?this._ownedContext.destroy(e):!0!==e&&!0!==e?.context||this._context.destroy(e),this._context?.off("update",this.onViewUpdate,this),this._context?.off("unload",this.unload,this),this._ownedContext=null,this._context=null,super.destroy(e)}_onTouch(e){this._gcLastUsed=e,this._context._gcLastUsed=e}_callContextMethod(e,t){return this.context[e](...t),this}setFillStyle(...e){return this._callContextMethod("setFillStyle",e)}setStrokeStyle(...e){return this._callContextMethod("setStrokeStyle",e)}fill(...e){return this._callContextMethod("fill",e)}stroke(...e){return this._callContextMethod("stroke",e)}texture(...e){return this._callContextMethod("texture",e)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...e){return this._callContextMethod("arc",e)}arcTo(...e){return this._callContextMethod("arcTo",e)}arcToSvg(...e){return this._callContextMethod("arcToSvg",e)}bezierCurveTo(...e){return this._callContextMethod("bezierCurveTo",e)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...e){return this._callContextMethod("ellipse",e)}circle(...e){return this._callContextMethod("circle",e)}path(...e){return this._callContextMethod("path",e)}lineTo(...e){return this._callContextMethod("lineTo",e)}moveTo(...e){return this._callContextMethod("moveTo",e)}quadraticCurveTo(...e){return this._callContextMethod("quadraticCurveTo",e)}rect(...e){return this._callContextMethod("rect",e)}roundRect(...e){return this._callContextMethod("roundRect",e)}poly(...e){return this._callContextMethod("poly",e)}regularPoly(...e){return this._callContextMethod("regularPoly",e)}roundPoly(...e){return this._callContextMethod("roundPoly",e)}roundShape(...e){return this._callContextMethod("roundShape",e)}filletRect(...e){return this._callContextMethod("filletRect",e)}chamferRect(...e){return this._callContextMethod("chamferRect",e)}star(...e){return this._callContextMethod("star",e)}svg(...e){return this._callContextMethod("svg",e)}restore(...e){return this._callContextMethod("restore",e)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...e){return this._callContextMethod("rotate",e)}scaleTransform(...e){return this._callContextMethod("scale",e)}setTransform(...e){return this._callContextMethod("setTransform",e)}transform(...e){return this._callContextMethod("transform",e)}translateTransform(...e){return this._callContextMethod("translate",e)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(e){this._context.fillStyle=e}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(e){this._context.strokeStyle=e}clone(t=!1){if(t)return new e(this._context.clone());this._ownedContext=null;return new e(this._context)}lineStyle(e,t,r){L(I,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const n={};return e&&(n.width=e),t&&(n.color=t),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(e,t){L(I,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const r={};return void 0!==e&&(r.color=e),void 0!==t&&(r.alpha=t),this.context.fillStyle=r,this}endFill(){L(I,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const e=this.context.strokeStyle;return e.width===hu.defaultStrokeStyle.width&&e.color===hu.defaultStrokeStyle.color&&e.alpha===hu.defaultStrokeStyle.alpha||this.context.stroke(),this}drawCircle(...e){return L(I,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",e)}drawEllipse(...e){return L(I,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",e)}drawPolygon(...e){return L(I,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",e)}drawRect(...e){return L(I,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",e)}drawRoundedRect(...e){return L(I,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",e)}drawStar(...e){return L(I,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",e)}};const Xd=class e extends Lo{constructor(...t){let r=t[0]??{};r instanceof Float32Array&&(L(I,"use new MeshGeometry({ positions, uvs, indices }) instead"),r={positions:r,uvs:t[1],indices:t[2]}),r={...e.defaultOptions,...r};const n=r.positions||new Float32Array([0,0,1,0,1,1,0,1]);let s=r.uvs;s||(s=r.positions?new Float32Array(n.length):new Float32Array([0,0,1,0,1,1,0,1]));const i=r.indices||new Uint32Array([0,1,2,0,2,3]),o=r.shrinkBuffersToFit;super({attributes:{aPosition:{buffer:new Do({data:n,label:"attribute-mesh-positions",shrinkToFit:o,usage:Oo.VERTEX|Oo.COPY_DST}),format:"float32x2",stride:8,offset:0},aUV:{buffer:new Do({data:s,label:"attribute-mesh-uvs",shrinkToFit:o,usage:Oo.VERTEX|Oo.COPY_DST}),format:"float32x2",stride:8,offset:0}},indexBuffer:new Do({data:i,label:"index-mesh-buffer",shrinkToFit:o,usage:Oo.INDEX|Oo.COPY_DST}),topology:r.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(e){this.attributes.aPosition.buffer.data=e}get uvs(){return this.attributes.aUV.buffer.data}set uvs(e){this.attributes.aUV.buffer.data=e}get indices(){return this.indexBuffer.data}set indices(e){this.indexBuffer.data=e}};Xd.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let Hd=Xd;class zd{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(e){this._topology=e}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(e){this.texture!==e&&(this.texture=e,this._textureMatrixUpdateId=-1)}get uvs(){const e=this.geometry.getBuffer("aUV"),t=e.data;let r=t;const n=this.texture.textureMatrix;return n.isSimple||(r=this._transformedUvs,this._textureMatrixUpdateId===n._updateID&&this._uvUpdateId===e._updateID||((!r||r.length<t.length)&&(r=this._transformedUvs=new Float32Array(t.length)),this._textureMatrixUpdateId=n._updateID,this._uvUpdateId=e._updateID,n.multiplyUvs(t,r))),r}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}class Vd{destroy(){}}class Wd{constructor(e,t){this.localUniforms=new On({uTransformMatrix:{value:new _,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Dn({0:this.localUniforms}),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){const t=this._getMeshData(e),r=t.batched,n=e.batched;if(t.batched=n,r!==n)return!0;if(n){const r=e._geometry;if(r.indices.length!==t.indexSize||r.positions.length!==t.vertexSize)return t.indexSize=r.indices.length,t.vertexSize=r.positions.length,!0;const n=this._getBatchableMesh(e);return n.texture.uid!==e._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,e._texture)}return!1}addRenderable(e,t){const r=this.renderer.renderPipes.batch,n=this._getMeshData(e);if(e.didViewUpdate&&(n.indexSize=e._geometry.indices?.length,n.vertexSize=e._geometry.positions?.length),n.batched){const n=this._getBatchableMesh(e);n.setTexture(e._texture),n.geometry=e._geometry,r.addToBatch(n,t)}else r.break(t),t.add(e)}updateRenderable(e){if(e.batched){const t=this._getBatchableMesh(e);t.setTexture(e._texture),t.geometry=e._geometry,t._batcher.updateElement(t)}}execute(e){if(!e.isRenderable)return;e.state.blend&&(e.state.blendMode=yo(e.groupBlendMode,e.texture._source));const t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),Ud(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){var t,r;return(t=e._gpuData)[r=this.renderer.uid]||(t[r]=new Vd),e._gpuData[this.renderer.uid].meshData||this._initMeshData(e)}_initMeshData(e){return e._gpuData[this.renderer.uid].meshData={batched:e.batched,indexSize:0,vertexSize:0},e._gpuData[this.renderer.uid].meshData}_getBatchableMesh(e){var t,r;return(t=e._gpuData)[r=this.renderer.uid]||(t[r]=new Vd),e._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(e)}_initBatchableMesh(e){const t=new zd;return t.renderable=e,t.setTexture(e._texture),t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,e._gpuData[this.renderer.uid].batchableMesh=t,t}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}Wd.extension={type:[e.WebGLPipes,e.WebGPUPipes],name:"mesh"},n.add(Wd);let $d=class extends Dt{constructor(...e){let t=e[0];t instanceof Lo&&(L(I,"Mesh: use new Mesh({ geometry, shader }) instead"),t={geometry:t,shader:e[1]},e[3]&&(L(I,"Mesh: drawMode argument has been removed, use geometry.topology instead"),t.geometry.topology=e[3]));const{geometry:r,shader:n,texture:s,roundPixels:i,state:o,...a}=t;super({label:"Mesh",...a}),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=n??null,this.texture=s??n?.texture??ee.WHITE,this.state=o??qn.for2d(),this._geometry=r,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=i??!1}get material(){return L(I,"mesh.material property has been removed, use mesh.shader instead"),this._shader}set shader(e){this._shader!==e&&(this._shader=e,this.onViewUpdate())}get shader(){return this._shader}set geometry(e){this._geometry!==e&&(this._geometry?.off("update",this.onViewUpdate,this),e.on("update",this.onViewUpdate,this),this._geometry=e,this.onViewUpdate())}get geometry(){return this._geometry}set texture(e){e||(e=ee.EMPTY);const t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=e),this._texture=e,this.onViewUpdate())}get texture(){return this._texture}get batched(){return!this._shader&&(!(12&this.state.data)&&(this._geometry instanceof Hd&&("auto"===this._geometry.batchMode?this._geometry.positions.length/2<=100:"batch"===this._geometry.batchMode)))}get bounds(){return this._geometry.bounds}updateBounds(){this._bounds=this._geometry.bounds}containsPoint(e){const{x:t,y:r}=e;if(!this.bounds.containsPoint(t,r))return!1;const n=this.geometry.getBuffer("aPosition").data,s="triangle-strip"===this.geometry.topology?3:1;if(this.geometry.getIndex()){const e=this.geometry.getIndex().data,i=e.length;for(let o=0;o+2<i;o+=s){const s=2*e[o],i=2*e[o+1],a=2*e[o+2];if(Dc(t,r,n[s],n[s+1],n[i],n[i+1],n[a],n[a+1]))return!0}}else{const e=n.length/2;for(let i=0;i+2<e;i+=s){const e=2*i,s=2*(i+1),o=2*(i+2);if(Dc(t,r,n[e],n[e+1],n[s],n[s+1],n[o],n[o+1]))return!0}}return!1}destroy(e){super.destroy(e);if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource;this._texture.destroy(t)}this._geometry?.off("update",this.onViewUpdate,this),this._texture=null,this._geometry=null,this._shader=null}},Yd=class e extends Ut{constructor(...e){let t=e[0];Array.isArray(e[0])&&(t={textures:e[0],autoUpdate:e[1]});const{animationSpeed:r=1,autoPlay:n=!1,autoUpdate:s=!0,loop:i=!0,onComplete:o=null,onFrameChange:a=null,onLoop:l=null,textures:u,updateAnchor:h=!1,...c}=t,[d]=u;super({...c,texture:d instanceof ee?d:d.texture}),this._textures=null,this._durations=null,this._autoUpdate=s,this._isConnectedToTicker=!1,this.animationSpeed=r,this.loop=i,this.updateAnchor=h,this.onComplete=o,this.onFrameChange=a,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,n&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(er.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(er.shared.add(this.update,this,Kt.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;const t=e.deltaTime,r=this.animationSpeed*t,n=this.currentFrame;if(null!==this._durations){let e=this._currentTime%1*this._durations[this.currentFrame];for(e+=r/60*1e3;e<0;)this._currentTime--,e+=this._durations[this.currentFrame];const n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);e>=this._durations[this.currentFrame];)e-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=e/this._durations[this.currentFrame]}else this._currentTime+=r;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n||this.animationSpeed<0&&this.currentFrame>n)&&this.onLoop(),this._updateTexture())}_updateTexture(){const e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(e=!1){if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource;this._textures.forEach(e=>{this.texture!==e&&e.destroy(t)})}this._textures=[],this._durations=null,this.stop(),super.destroy(e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const r=[];for(let e=0;e<t.length;++e)r.push(ee.from(t[e]));return new e(r)}static fromImages(t){const r=[];for(let e=0;e<t.length;++e)r.push(ee.from(t[e]));return new e(r)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof ee)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(er.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(er.shared.add(this.update,this),this._isConnectedToTicker=!0))}};class jd{constructor({matrix:e,observer:t}={}){this.dirty=!0,this._matrix=e??new _,this.observer=t,this.position=new o(this,0,0),this.scale=new o(this,1,1),this.pivot=new o(this,0,0),this.skew=new o(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const e=this._matrix;return this.dirty?(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this.dirty=!1,e):e}_onUpdate(e){this.dirty=!0,e===this.skew&&this.updateSkew(),this.observer?._onUpdate(this)}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this.dirty=!0}toString(){return`[pixi.js/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`}setFromMatrix(e){e.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this.skew))}}const qd=new _,Kd=new _,Zd=[new m,new m,new m,new m];class Qd{constructor(e){this._renderer=e}validateRenderable(e){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}updateRenderable(e){}execute(e){const t=this._renderer,r=t.canvasContext,n=r.activeContext;n.save(),r.setBlendMode(e.groupBlendMode);const s=t.globalUniforms.globalUniformData?.worldColor??4294967295,i=e.groupColorAlpha,o=(s>>>24&255)/255*((i>>>24&255)/255)*(t.filter?.alphaMultiplier??1);if(o<=0)return void n.restore();n.globalAlpha=o;const a=it(rt(16777215&i,16777215&s)),l=e.texture,u=Gc.getTintedPattern(l,a),h=e.width,c=e.height,d=e.groupTransform,p=l.source._resolution??l.source.resolution??1;Kd.copyFrom(e._tileTransform.matrix),e.applyAnchorToTexture||Kd.translate(-e.anchor.x*h,-e.anchor.y*c);const f=Kd.tx,m=Kd.ty;Kd.scale(1/p,1/p),Kd.tx=f,Kd.ty=m,qd.identity(),qd.prepend(Kd),qd.prepend(d);const g=t._roundPixels|e._roundPixels;r.setContextTransform(qd,1===g),n.fillStyle=u;const _=e.anchor.x*-h,x=e.anchor.y*-c;Zd[0].set(_,x),Zd[1].set(_+h,x),Zd[2].set(_+h,x+c),Zd[3].set(_,x+c);for(let e=0;e<4;e++)Kd.applyInverse(Zd[e],Zd[e]);n.beginPath(),n.moveTo(Zd[0].x,Zd[0].y);for(let e=1;e<4;e++)n.lineTo(Zd[e].x,Zd[e].y);n.closePath(),n.fill(),n.restore()}destroy(){this._renderer=null}}Qd.extension={type:[e.CanvasPipes],name:"tilingSprite"};const Jd={name:"local-uniform-bit",vertex:{header:"\n\n struct LocalUniforms {\n uTransformMatrix:mat3x3<f32>,\n uColor:vec4<f32>,\n uRound:f32,\n }\n\n @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;\n ",main:"\n vColor *= localUniforms.uColor;\n modelMatrix *= localUniforms.uTransformMatrix;\n ",end:"\n if(localUniforms.uRound == 1)\n {\n vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "}},ep={...Jd,vertex:{...Jd.vertex,header:Jd.vertex.header.replace("group(1)","group(2)")}},tp={name:"local-uniform-bit",vertex:{header:"\n\n uniform mat3 uTransformMatrix;\n uniform vec4 uColor;\n uniform float uRound;\n ",main:"\n vColor *= uColor;\n modelMatrix = uTransformMatrix;\n ",end:"\n if(uRound == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "}},rp={name:"tiling-bit",vertex:{header:"\n struct TilingUniforms {\n uMapCoord:mat3x3<f32>,\n uClampFrame:vec4<f32>,\n uClampOffset:vec2<f32>,\n uTextureTransform:mat3x3<f32>,\n uSizeAnchor:vec4<f32>\n };\n\n @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d<f32>;\n @group(2) @binding(2) var uSampler: sampler;\n ",main:"\n uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;\n\n position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;\n "},fragment:{header:"\n struct TilingUniforms {\n uMapCoord:mat3x3<f32>,\n uClampFrame:vec4<f32>,\n uClampOffset:vec2<f32>,\n uTextureTransform:mat3x3<f32>,\n uSizeAnchor:vec4<f32>\n };\n\n @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n @group(2) @binding(1) var uTexture: texture_2d<f32>;\n @group(2) @binding(2) var uSampler: sampler;\n ",main:"\n\n var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);\n coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;\n var unclamped = coord;\n coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);\n\n var bias = 0.;\n\n if(unclamped.x == coord.x && unclamped.y == coord.y)\n {\n bias = -32.;\n }\n\n outColor = textureSampleBias(uTexture, uSampler, coord, bias);\n "}},np={name:"tiling-bit",vertex:{header:"\n uniform mat3 uTextureTransform;\n uniform vec4 uSizeAnchor;\n\n ",main:"\n uv = (uTextureTransform * vec3(aUV, 1.0)).xy;\n\n position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;\n "},fragment:{header:"\n uniform sampler2D uTexture;\n uniform mat3 uMapCoord;\n uniform vec4 uClampFrame;\n uniform vec2 uClampOffset;\n ",main:"\n\n vec2 coord = vUV + ceil(uClampOffset - vUV);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0\n\n "}};let sp,ip;class op extends Ln{constructor(){sp??(sp=ca({name:"tiling-sprite-shader",bits:[Jd,rp,Ta]})),ip??(ip=da({name:"tiling-sprite-shader",bits:[tp,np,Sa]}));const e=new On({uMapCoord:{value:new _,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new _,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:ip,gpuProgram:sp,resources:{localUniforms:new On({uTransformMatrix:{value:new _,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:e,uTexture:ee.EMPTY.source,uSampler:ee.EMPTY.source.style}})}updateUniforms(e,t,r,n,s,i){const o=this.resources.tilingUniforms,a=i.width,l=i.height,u=i.textureMatrix,h=o.uniforms.uTextureTransform;h.set(r.a*a/e,r.b*a/t,r.c*l/e,r.d*l/t,r.tx/e,r.ty/t),h.invert(),o.uniforms.uMapCoord=u.mapCoord,o.uniforms.uClampFrame=u.uClampFrame,o.uniforms.uClampOffset=u.uClampOffset,o.uniforms.uTextureTransform=h,o.uniforms.uSizeAnchor[0]=e,o.uniforms.uSizeAnchor[1]=t,o.uniforms.uSizeAnchor[2]=n,o.uniforms.uSizeAnchor[3]=s,i&&(this.resources.uTexture=i.source,this.resources.uSampler=i.source.style)}}class ap extends Hd{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function lp(e,t){const r=e.anchor.x,n=e.anchor.y;t[0]=-r*e.width,t[1]=-n*e.height,t[2]=(1-r)*e.width,t[3]=-n*e.height,t[4]=(1-r)*e.width,t[5]=(1-n)*e.height,t[6]=-r*e.width,t[7]=(1-n)*e.height}function up(e,t,r,n){let s=0;const i=e.length/(t||2),o=n.a,a=n.b,l=n.c,u=n.d,h=n.tx,c=n.ty;for(r*=t;s<i;){const n=e[r],i=e[r+1];e[r]=o*n+l*i+h,e[r+1]=a*n+u*i+c,r+=t,s++}}function hp(e,t){const r=e.texture,n=r.frame.width,s=r.frame.height;let i=0,o=0;e.applyAnchorToTexture&&(i=e.anchor.x,o=e.anchor.y),t[0]=t[6]=-i,t[2]=t[4]=1-i,t[1]=t[3]=-o,t[5]=t[7]=1-o;const a=e._tileTransform.matrix,l=_.shared;l.set(a.a*n/e.width,a.b*n/e.height,a.c*s/e.width,a.d*s/e.height,a.tx/e.width,a.ty/e.height),l.invert(),up(t,2,0,l)}const cp=new ap;class dp{constructor(){this.canBatch=!0,this.geometry=new Hd({indices:cp.indices.slice(),positions:cp.positions.slice(),uvs:cp.uvs.slice()})}destroy(){this.geometry.destroy(),this.shader?.destroy()}}class pp{constructor(e){this._state=qn.default2d,this._renderer=e,this._managedTilingSprites=new Pa({renderer:e,type:"renderable",name:"tilingSprite"})}validateRenderable(e){const t=this._getTilingSpriteData(e),r=t.canBatch;this._updateCanBatch(e);const n=t.canBatch;if(n&&n===r){const{batchableMesh:r}=t;return!r._batcher.checkAndUpdateTexture(r,e.texture)}return r!==n}addRenderable(e,t){const r=this._renderer.renderPipes.batch;this._updateCanBatch(e);const n=this._getTilingSpriteData(e),{geometry:s,canBatch:i}=n;if(i){n.batchableMesh||(n.batchableMesh=new zd);const i=n.batchableMesh;e.didViewUpdate&&(this._updateBatchableMesh(e),i.geometry=s,i.renderable=e,i.transform=e.groupTransform,i.setTexture(e._texture)),i.roundPixels=this._renderer._roundPixels|e._roundPixels,r.addToBatch(i,t)}else r.break(t),n.shader||(n.shader=new op),this.updateRenderable(e),t.add(e)}execute(e){const t=this._renderer,{shader:r}=this._getTilingSpriteData(e);r.groups[0]=t.globalUniforms.bindGroup;const n=r.resources.localUniforms.uniforms;n.uTransformMatrix=e.groupTransform,n.uRound=t._roundPixels|e._roundPixels,Ud(e.groupColorAlpha,n.uColor,0),this._state.blendMode=yo(e.groupBlendMode,e.texture._source),t.encoder.draw({geometry:cp,shader:r,state:this._state})}updateRenderable(e){const t=this._getTilingSpriteData(e),{canBatch:r}=t;if(r){const{batchableMesh:r}=t;e.didViewUpdate&&this._updateBatchableMesh(e),r._batcher.updateElement(r)}else if(e.didViewUpdate){const{shader:r}=t;r.updateUniforms(e.width,e.height,e._tileTransform.matrix,e.anchor.x,e.anchor.y,e.texture)}}_getTilingSpriteData(e){return e._gpuData[this._renderer.uid]||this._initTilingSpriteData(e)}_initTilingSpriteData(e){const t=new dp;return t.renderable=e,e._gpuData[this._renderer.uid]=t,this._managedTilingSprites.add(e),t}_updateBatchableMesh(e){const t=this._getTilingSpriteData(e),{geometry:r}=t,n=e.texture.source.style;"repeat"!==n.addressMode&&(n.addressMode="repeat",n.update()),hp(e,r.uvs),lp(e,r.positions)}destroy(){this._managedTilingSprites.destroy(),this._renderer=null}_updateCanBatch(e){const t=this._getTilingSpriteData(e),r=e.texture;let n=!0;return this._renderer.type===Un.WEBGL&&(n=this._renderer.context.supports.nonPowOf2wrapping),t.canBatch=r.textureMatrix.isSimple&&(n||r.source.isPowerOfTwo),t.canBatch}}pp.extension={type:[e.WebGLPipes,e.WebGPUPipes],name:"tilingSprite"},n.add(Qd),n.add(pp);const fp=class e extends Dt{constructor(...t){let r=t[0]||{};r instanceof ee&&(r={texture:r}),t.length>1&&(L(I,"use new TilingSprite({ texture, width:100, height:100 }) instead"),r.width=t[1],r.height=t[2]),r={...e.defaultOptions,...r};const{texture:n,anchor:s,tilePosition:i,tileScale:a,tileRotation:l,width:u,height:h,applyAnchorToTexture:c,roundPixels:d,...p}=r??{};super({label:"TilingSprite",...p}),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new o({_onUpdate:()=>{this.onViewUpdate()}}),this.applyAnchorToTexture=c,this.texture=n,this._width=u??n.width,this._height=h??n.height,this._tileTransform=new jd({observer:{_onUpdate:()=>this.onViewUpdate()}}),s&&(this.anchor=s),this.tilePosition=i,this.tileScale=a,this.tileRotation=l,this.roundPixels=d??!1}static from(t,r={}){return new e("string"==typeof t?{texture:ir.get(t),...r}:{texture:t,...r})}get uvRespectAnchor(){return L(I,"uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture}set uvRespectAnchor(e){L(I,"uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture=e}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(e){this._texture.textureMatrix.clampMargin=e}get anchor(){return this._anchor}set anchor(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)}get tilePosition(){return this._tileTransform.position}set tilePosition(e){this._tileTransform.position.copyFrom(e)}get tileScale(){return this._tileTransform.scale}set tileScale(e){"number"==typeof e?this._tileTransform.scale.set(e):this._tileTransform.scale.copyFrom(e)}set tileRotation(e){this._tileTransform.rotation=e}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}set texture(e){e||(e=ee.EMPTY);const t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this.onViewUpdate())}get texture(){return this._texture}set width(e){this._width=e,this.onViewUpdate()}get width(){return this._width}set height(e){this._height=e,this.onViewUpdate()}get height(){return this._height}setSize(e,t){"object"==typeof e&&(t=e.height??e.width,e=e.width),this._width=e,this._height=t??e,this.onViewUpdate()}getSize(e){return e||(e={}),e.width=this._width,e.height=this._height,e}updateBounds(){const e=this._bounds,t=this._anchor,r=this._width,n=this._height;e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*n,e.maxY=e.minY+n}containsPoint(e){const t=this._width,r=this._height,n=-t*this._anchor._x;let s=0;return e.x>=n&&e.x<=n+t&&(s=-r*this._anchor._y,e.y>=s&&e.y<=s+r)}destroy(e=!1){super.destroy(e),this._anchor=null,this._tileTransform=null,this._bounds=null;if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource;this._texture.destroy(t)}this._texture=null}};fp.defaultOptions={texture:ee.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let mp=fp;class gp extends Dt{constructor(e,t){const{text:r,resolution:n,style:s,anchor:i,width:a,height:l,roundPixels:u,...h}=e;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=r??"",this.style=s,this.resolution=n??null,this.allowChildren=!1,this._anchor=new o({_onUpdate:()=>{this.onViewUpdate()}}),i&&(this.anchor=i),this.roundPixels=u??!1,void 0!==a&&(this.width=a),void 0!==l&&(this.height=l)}get anchor(){return this._anchor}set anchor(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=null===e,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){"object"==typeof e?(t=e.height??e.width,e=e.width):t??(t=e),void 0!==e&&this._setWidth(e,this.bounds.width),void 0!==t&&this._setHeight(t,this.bounds.height)}containsPoint(e){const t=this.bounds.width,r=this.bounds.height,n=-t*this.anchor.x;let s=0;return e.x>=n&&e.x<=n+t&&(s=-r*this.anchor.y,e.y>=s&&e.y<=s+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(e=!1){this._style?.off("update",this.onViewUpdate,this),super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof e?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}function _p(e,t){let r=e[0]??{};return("string"==typeof r||e[1])&&(L(I,`use new ${t}({ text: "hi!", style }) instead`),r={text:r,style:e[1]}),r}let xp=null,bp=null;function yp(e,t,r){for(let n=0,s=4*r*t;n<t;++n,s+=4)if(0!==e[s+3])return!1;return!0}function vp(e,t,r,n,s){const i=4*t;for(let t=n,o=n*i+4*r;t<=s;++t,o+=i)if(0!==e[o+3])return!1;return!0}function Tp(...e){let t=e[0];t.canvas||(t={canvas:e[0],resolution:e[1]});const{canvas:r}=t,n=Math.min(t.resolution??1,1),s=t.width??r.width,i=t.height??r.height;let o=t.output;if(function(e,t){xp||(xp=Yt.get().createCanvas(256,128),bp=xp.getContext("2d",{willReadFrequently:!0}),bp.globalCompositeOperation="copy",bp.globalAlpha=1),(xp.width<e||xp.height<t)&&(xp.width=H(e),xp.height=H(t))}(s,i),!bp)throw new TypeError("Failed to get canvas 2D context");bp.drawImage(r,0,0,s,i,0,0,s*n,i*n);const a=bp.getImageData(0,0,s,i).data;let l=0,u=0,h=s-1,c=i-1;for(;u<i&&yp(a,s,u);)++u;if(u===i)return M.EMPTY;for(;yp(a,s,c);)--c;for(;vp(a,s,l,u,c);)++l;for(;vp(a,s,h,u,c);)--h;return++h,++c,bp.globalCompositeOperation="source-over",bp.strokeRect(l,u,h-l,c-u),bp.globalCompositeOperation="copy",o??(o=new M),o.set(l/n,u/n,(h-l)/n,(c-u)/n),o}
|
|
2
|
+
/**
|
|
3
|
+
* tiny-lru
|
|
4
|
+
*
|
|
5
|
+
* @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
6
|
+
* @license BSD-3-Clause
|
|
7
|
+
* @version 11.4.7
|
|
8
|
+
*/class Sp{constructor(e=0,t=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=r,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){const t=new Array(e.length);for(let r=0;r<e.length;r++){const n=e[r];t[r]=[n,this.get(n)]}return t}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0===--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){const t=this.items[e];if(void 0!==t)return this.ttl>0&&t.expiry<=Date.now()?void this.delete(e):(this.moveToEnd(t),t.value)}has(e){return e in this.items}moveToEnd(e){this.last!==e&&(null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),e.prev=this.last,e.next=null,null!==this.last&&(this.last.next=e),this.last=e,null===this.first&&(this.first=e))}keys(){const e=new Array(this.size);let t=this.first,r=0;for(;null!==t;)e[r++]=t.key,t=t.next;return e}setWithEvicted(e,t,r=this.resetTtl){let n=null;if(this.has(e))this.set(e,t,!0,r);else{this.max>0&&this.size===this.max&&(n={...this.first},this.evict(!0));let r=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t};1===++this.size?this.first=r:this.last.next=r,this.last=r}return n}set(e,t,r=!1,n=this.resetTtl){let s=this.items[e];return r||void 0!==s?(s.value=t,!1===r&&n&&(s.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(s)):(this.max>0&&this.size===this.max&&this.evict(!0),s=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1===++this.size?this.first=s:this.last.next=s,this.last=s),this}values(e=this.keys()){const t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=this.get(e[r]);return t}}function wp(e=1e3,t=0,r=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof r)throw new TypeError("Invalid resetTtl value");return new Sp(e,t,r)}function Ep(e){return!!e.tagStyles&&Object.keys(e.tagStyles).length>0}function Ap(e){return e.includes("<")}function Rp(e,t){return e.clone().assign(t)}function Cp(e,t){const r=[],n=t.tagStyles;if(!Ep(t)||!Ap(e))return r.push({text:e,style:t}),r;const s=[t],i=[];let o="",a=0;for(;a<e.length;){const t=e[a];if("<"===t){const l=e.indexOf(">",a);if(-1===l){o+=t,a++;continue}const u=e.indexOf("<",a+1);if(-1!==u&&u<l){o+=t,a++;continue}const h=e.slice(a+1,l);if(h.startsWith("/")){const t=h.slice(1).trim();if(i.length>0&&i[i.length-1]===t){o.length>0&&(r.push({text:o,style:s[s.length-1]}),o=""),s.pop(),i.pop(),a=l+1;continue}o+=e.slice(a,l+1),a=l+1;continue}{const t=h.trim();if(n[t]){o.length>0&&(r.push({text:o,style:s[s.length-1]}),o="");const e=Rp(s[s.length-1],n[t]);s.push(e),i.push(t),a=l+1;continue}o+=e.slice(a,l+1),a=l+1;continue}}o+=t,a++}return o.length>0&&r.push({text:o,style:s[s.length-1]}),r}function Mp(e,t){if(!Ep(t)||!Ap(e))return e;return Cp(e,t).map(e=>e.text).join("")}const Pp=[10,13],Gp=new Set(Pp),Bp=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Fp=new Set(Bp),Ip=[9,32],Op=new Set(Ip),Dp=[45,8208,8211,8212,173],Up=new Set(Dp),kp=/(\r\n|\r|\n)/,Lp=/(?:\r\n|\r|\n)/;function Np(e){return"string"==typeof e&&Gp.has(e.charCodeAt(0))}function Xp(e,t){return"string"==typeof e&&Fp.has(e.charCodeAt(0))}function Hp(e){return"string"==typeof e&&Op.has(e.charCodeAt(0))}function zp(e){return"string"==typeof e&&Up.has(e.charCodeAt(0))}function Vp(e){return"normal"===e||"pre-line"===e}function Wp(e){return"normal"===e}function $p(e){if("string"!=typeof e)return"";let t=e.length-1;for(;t>=0&&Xp(e[t]);)t--;return t<e.length-1?e.slice(0,t+1):e}function Yp(e){const t=[],r=[];if("string"!=typeof e)return t;for(let n=0;n<e.length;n++){const s=e[n],i=e[n+1];Xp(s)||Np(s)?(r.length>0&&(t.push(r.join("")),r.length=0),"\r"===s&&"\n"===i?(t.push("\r\n"),n++):t.push(s)):(r.push(s),zp(s)&&i&&!Xp(i)&&!Np(i)&&(t.push(r.join("")),r.length=0))}return r.length>0&&t.push(r.join("")),t}function jp(e,t,r,n){const s=r(e),i=[];for(let r=0;r<s.length;r++){let o=s[r],a=o,l=1;for(;s[r+l];){const i=s[r+l];if(n(a,i,e,r,t))break;o+=i,a=i,l++}r+=l-1,i.push(o)}return i}const qp=/\r\n|\r|\n/g;function Kp(e,t,r,n,s,i,o,a,l){const u=Cp(e,t);if(Wp(t.whiteSpace))for(let e=0;e<u.length;e++){const t=u[e];u[e]={text:t.text.replace(qp," "),style:t.style}}const h=[];let c=[];for(const e of u){const t=e.text.split(kp);for(let r=0;r<t.length;r++){const n=t[r];"\r\n"===n||"\r"===n||"\n"===n?(h.push(c),c=[]):n.length>0&&c.push({text:n,style:e.style})}}(c.length>0||0===h.length)&&h.push(c);const d=r?Zp(h,t,n,i,a,l):h,p=[],f=[],m=[],g=[],_=[];let x=0;const b=o(t._fontString);0===b.fontSize&&(b.fontSize=t.fontSize,b.ascent=t.fontSize);let y="",v=!!t.dropShadow,T=t._stroke?.width||0;for(const e of d){let r=0,i=b.ascent,a=b.descent,l="";for(const t of e){const e=t.style._fontString,u=o(e);e!==y&&(n.font=e,y=e);r+=s(t.text,t.style.letterSpacing,n),i=Math.max(i,u.ascent),a=Math.max(a,u.descent),l+=t.text;const h=t.style._stroke?.width||0;h>T&&(T=h),!v&&t.style.dropShadow&&(v=!0)}0===e.length&&(i=b.ascent,a=b.descent),p.push(r),f.push(i),m.push(a),_.push(l);const u=t.lineHeight||i+a;g.push(u+t.leading),x=Math.max(x,r)}const S=T,w=x+S+(t.dropShadow?t.dropShadow.distance:0);let E=0;for(let e=0;e<g.length;e++)E+=g[e];E=Math.max(E,g[0]+S);return{width:w,height:E+(t.dropShadow?t.dropShadow.distance:0),lines:_,lineWidths:p,lineHeight:(t.lineHeight||b.fontSize)+t.leading,maxLineWidth:x,fontProperties:b,runsByLine:d,lineAscents:f,lineDescents:m,lineHeights:g,hasDropShadow:v}}function Zp(e,t,r,n,s,i){const{letterSpacing:o,whiteSpace:a,wordWrapWidth:l,breakWords:u}=t,h=Vp(a),c=l+o,d={};let p="";const f=(e,t)=>{const s=`${e}|${t.styleKey}`;let i=d[s];if(void 0===i){const o=t._fontString;o!==p&&(r.font=o,p=o),i=n(e,t.letterSpacing,r)+t.letterSpacing,d[s]=i}return i},m=[];for(const t of e){const e=Qp(t),r=m.length,n=t=>{let r=0,n=t;do{const{token:t,style:s}=e[n];r+=f(t,s),n++}while(n<e.length&&e[n].continuesFromPrevious);return r},o=t=>{const r=[];let n=t;do{r.push({token:e[n].token,style:e[n].style}),n++}while(n<e.length&&e[n].continuesFromPrevious);return r};let a=[],l=0,d=!h,p=null;const g=()=>{p&&p.text.length>0&&a.push(p),p=null},_=()=>{if(g(),a.length>0){const e=a[a.length-1];e.text=$p(e.text),0===e.text.length&&a.pop()}m.push(a),a=[],l=0,d=!1};for(let t=0;t<e.length;t++){const{token:r,style:x,continuesFromPrevious:b}=e[t],y=f(r,x);if(h){const e=Xp(r),t=p?.text[p.text.length-1]??a[a.length-1]?.text.slice(-1)??"",n=!!t&&Xp(t);if(e&&n)continue}const v=!b,T=v?n(t):y;if(T>c&&v)if(l>0&&_(),u){const e=o(t);for(let t=0;t<e.length;t++){const r=e[t].token,n=e[t].style,o=jp(r,u,i,s);for(const e of o){const t=f(e,n);t+l>c&&_(),p&&p.style===n?p.text+=e:(g(),p={text:e,style:n}),l+=t}}t+=e.length-1}else{const e=o(t);g(),m.push(e.map(e=>({text:e.token,style:e.style}))),d=!1,t+=e.length-1}else if(T+l>c&&v){if(Xp(r)){d=!1;continue}_(),p={text:r,style:x},l=y}else if(b&&!u)p&&p.style===x?p.text+=r:(g(),p={text:r,style:x}),l+=y;else{const e=Xp(r);if(0===l&&e&&!d)continue;p&&p.style===x?p.text+=r:(g(),p={text:r,style:x}),l+=y}}if(g(),a.length>0){const e=a[a.length-1];e.text=$p(e.text),0===e.text.length&&a.pop()}(a.length>0||m.length===r)&&m.push(a)}return m}function Qp(e){const t=[];let r=!1;for(const n of e){const e=Yp(n.text);let s=!0;for(const i of e){const e=Xp(i)||Np(i),o=s&&r&&!e;t.push({token:i,style:n.style,continuesFromPrevious:o}),r=!e,s=!1}}return t}const Jp={willReadFrequently:!0};function ef(e,t,r,n,s){let i=r[e];return"number"!=typeof i&&(i=s(e,t,n)+t,r[e]=i),i}function tf(e,t,r,n,s,i,o){const a=r.getContext("2d",Jp);a.font=t._fontString;let l=0,u="";const h=[],c=Object.create(null),{letterSpacing:d,whiteSpace:p}=t,f=Vp(p),m=Wp(p);let g=!f;const _=t.wordWrapWidth+d,x=Yp(e);for(let e=0;e<x.length;e++){let r=x[e];if(Np(r)){if(!m){h.push($p(u)),g=!f,u="",l=0;continue}r=" "}if(f){const e=Xp(r),t=Xp(u[u.length-1]);if(e&&t)continue}const p=ef(r,d,c,a,n);if(p>_)if(""!==u&&(h.push($p(u)),u="",l=0),s(r,t.breakWords)){const e=jp(r,t.breakWords,o,i);for(const t of e){const e=ef(t,d,c,a,n);e+l>_&&(h.push($p(u)),g=!1,u="",l=0),u+=t,l+=e}}else u.length>0&&(h.push($p(u)),u="",l=0),h.push($p(r)),g=!1,u="",l=0;else p+l>_&&(g=!1,h.push($p(u)),u="",l=0),(u.length>0||!Xp(r)||g)&&(u+=r,l+=p)}const b=$p(u);return b.length>0&&h.push(b),h.join("\n")}const rf={willReadFrequently:!0},nf=class e{static get experimentalLetterSpacingSupported(){let t=e._experimentalLetterSpacingSupported;if(void 0===t){const r=Yt.get().getCanvasRenderingContext2D().prototype;t=e._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return t}constructor(e,t,r,n,s,i,o,a,l,u){this.text=e,this.style=t,this.width=r,this.height=n,this.lines=s,this.lineWidths=i,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=l,u&&(this.runsByLine=u.runsByLine,this.lineAscents=u.lineAscents,this.lineDescents=u.lineDescents,this.lineHeights=u.lineHeights,this.hasDropShadow=u.hasDropShadow)}static measureText(t=" ",r,n=e._canvas,s=r.wordWrap){const i=`${t}-${r.styleKey}-wordWrap-${s}`;if(e._measurementCache.has(i))return e._measurementCache.get(i);if(Ep(r)&&Ap(t)){const n=Kp(t,r,s,e._context,e._measureText,e._measureTextAdvance,e.measureFont,e.canBreakChars,e.wordWrapSplit),o=new e(t,r,n.width,n.height,n.lines,n.lineWidths,n.lineHeight,n.maxLineWidth,n.fontProperties,{runsByLine:n.runsByLine,lineAscents:n.lineAscents,lineDescents:n.lineDescents,lineHeights:n.lineHeights,hasDropShadow:n.hasDropShadow});return e._measurementCache.set(i,o),o}const o=r._fontString,a=e.measureFont(o);0===a.fontSize&&(a.fontSize=r.fontSize,a.ascent=r.fontSize,a.descent=0);const l=e._context;l.font=o;const u=(s?e._wordWrap(t,r,n):t).split(Lp),h=new Array(u.length);let c=0;for(let t=0;t<u.length;t++){const n=e._measureText(u[t],r.letterSpacing,l);h[t]=n,c=Math.max(c,n)}const d=r._stroke?.width??0,p=r.lineHeight||a.fontSize,f=e._adjustWidthForStyle(c,r),m=Math.max(p,a.fontSize+d)+(u.length-1)*(p+r.leading),g=e._adjustHeightForStyle(m,r),_=new e(t,r,f,g,u,h,p+r.leading,c,a);return e._measurementCache.set(i,_),_}static _adjustWidthForStyle(e,t){let r=e+(t._stroke?.width||0);return t.dropShadow&&(r+=t.dropShadow.distance),r}static _adjustHeightForStyle(e,t){let r=e;return t.dropShadow&&(r+=t.dropShadow.distance),r}static _measureText(t,r,n){const{metricWidth:s,metrics:i,letterSpacingVal:o}=e._measureTextCore(t,r,n),a=-(i.actualBoundingBoxLeft??0);let l=(i.actualBoundingBoxRight??0)-a;return i.width>0&&(l+=o),Math.max(s,l)}static _measureTextAdvance(t,r,n){return e._measureTextCore(t,r,n).metricWidth}static _measureTextCore(t,r,n){let s=!1;e.experimentalLetterSpacingSupported&&(e.experimentalLetterSpacing?(n.letterSpacing=`${r}px`,n.textLetterSpacing=`${r}px`,s=!0):(n.letterSpacing="0px",n.textLetterSpacing="0px"));const i=n.measureText(t);let o=i.width,a=0;return o>0&&(a=s?-r:(e.graphemeSegmenter(t).length-1)*r,o+=a),{metricWidth:o,metrics:i,letterSpacingVal:a}}static _wordWrap(t,r,n=e._canvas){return tf(t,r,n,e._measureTextAdvance,e.canBreakWords,e.canBreakChars,e.wordWrapSplit)}static isBreakingSpace(e,t){return Xp(e)}static canBreakWords(e,t){return t}static canBreakChars(e,t,r,n,s){return!0}static wordWrapSplit(t){return e.graphemeSegmenter(t)}static measureFont(t){if(e._fonts[t])return e._fonts[t];const r=e._context;r.font=t;const n=r.measureText(e.METRICS_STRING+e.BASELINE_SYMBOL),s=n.actualBoundingBoxAscent??0,i=n.actualBoundingBoxDescent??0,o={ascent:s,descent:i,fontSize:s+i};return e._fonts[t]=o,o}static clearMetrics(t=""){t?delete e._fonts[t]:e._fonts={}}static get _canvas(){if(!e.__canvas){let t;try{const r=new OffscreenCanvas(0,0),n=r.getContext("2d",rf);if(n?.measureText)return e.__canvas=r,r;t=Yt.get().createCanvas()}catch(e){t=Yt.get().createCanvas()}t.width=t.height=10,e.__canvas=t}return e.__canvas}static get _context(){return e.__context||(e.__context=e._canvas.getContext("2d",rf)),e.__context}};nf.METRICS_STRING="|ÉqÅ",nf.BASELINE_SYMBOL="M",nf.BASELINE_MULTIPLIER=1.4,nf.HEIGHT_MULTIPLIER=2,nf.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){const e=new Intl.Segmenter;return t=>{const r=e.segment(t),n=[];let s=0;for(const e of r)n[s++]=e.segment;return n}}return e=>[...e]})(),nf.experimentalLetterSpacing=!1,nf._fonts={},nf._measurementCache=wp(1e3);let sf=nf;const of=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function af(e){const t="number"==typeof e.fontSize?`${e.fontSize}px`:e.fontSize;let r=e.fontFamily;Array.isArray(e.fontFamily)||(r=e.fontFamily.split(","));for(let e=r.length-1;e>=0;e--){let t=r[e].trim();/([\"\'])[^\'\"]+\1/.test(t)||of.includes(t)||(t=`"${t}"`),r[e]=t}return`${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${r.join(",")}`}const lf=1e5;function uf(e,t,r,n=0,s=0,i=0){if(e.texture===ee.WHITE&&!e.fill)return Be.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();if(!e.fill){const r=t.createPattern(e.texture.source.resource,"repeat"),n=e.matrix.copyTo(_.shared);return n.scale(e.texture.source.pixelWidth,e.texture.source.pixelHeight),r.setTransform(n),r}if(e.fill instanceof Jl){const r=e.fill,n=t.createPattern(r.texture.source.resource,"repeat");return Gc.applyPatternTransform(n,r.transform,!1),n}if(e.fill instanceof Qa){const o=e.fill,a="linear"===o.type,l="local"===o.textureSpace;let u,h=1,c=1;l&&r&&(h=r.width+n,c=r.height+n);let d=!1;if(a){const{start:e,end:r}=o;u=t.createLinearGradient(e.x*h+s,e.y*c+i,r.x*h+s,r.y*c+i),d=Math.abs(r.x-e.x)<Math.abs(.1*(r.y-e.y))}else{const{center:e,innerRadius:r,outerCenter:n,outerRadius:a}=o;u=t.createRadialGradient(e.x*h+s,e.y*c+i,r*h,n.x*h+s,n.y*c+i,a*h)}if(d&&l&&r){const e=r.lineHeight/c;for(let t=0;t<r.lines.length;t++){const s=(t*r.lineHeight+n/2)/c;o.colorStops.forEach(t=>{let r=s+t.offset*e;r=Math.max(0,Math.min(1,r)),u.addColorStop(Math.floor(r*lf)/lf,Be.shared.setValue(t.color).toHex())})}}else o.colorStops.forEach(e=>{u.addColorStop(e.offset,Be.shared.setValue(e.color).toHex())});return u}return Oe("FillStyle not recognised",e),"red"}const hf=new M;function cf(e){let t=0;for(let r=0;r<e.length;r++)32===e.charCodeAt(r)&&t++;return t}const df=new class{getCanvasAndContext(e){const{text:t,style:r,resolution:n=1}=e,s=r._getFinalPadding(),i=sf.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,i.width)+2*s)*n),a=Math.ceil(Math.ceil(Math.max(1,i.height)+2*s)*n),l=Oc.getOptimalCanvasAndContext(o,a);this._renderTextToCanvas(r,s,n,l,i);return{canvasAndContext:l,frame:r.trim?Tp({canvas:l.canvas,width:o,height:a,resolution:1,output:hf}):hf.set(0,0,o,a)}}returnCanvasAndContext(e){Oc.returnCanvasAndContext(e)}_renderTextToCanvas(e,t,r,n,s){if(s.runsByLine&&s.runsByLine.length>0)return void this._renderTaggedTextToCanvas(s,e,t,r,n);const{canvas:i,context:o}=n,a=af(e),l=s.lines,u=s.lineHeight,h=s.lineWidths,c=s.maxLineWidth,d=s.fontProperties,p=i.height;if(o.resetTransform(),o.scale(r,r),o.textBaseline=e.textBaseline,e._stroke?.width){const t=e._stroke;o.lineWidth=t.width,o.miterLimit=t.miterLimit,o.lineJoin=t.join,o.lineCap=t.cap}let f,m;o.font=a;const g=e.dropShadow?2:1,_=(e._stroke?.width??0)/2;let x=(u-d.fontSize)/2;u-d.fontSize<0&&(x=0);for(let i=0;i<g;++i){const a=e.dropShadow&&0===i,g=a?Math.ceil(Math.max(1,p)+2*t):0,b=g*r;if(a)this._setupDropShadow(o,e,r,b);else{const r=e._gradientBounds,n=e._gradientOffset;if(r){const i={width:r.width,height:r.height,lineHeight:r.height,lines:s.lines};this._setFillAndStrokeStyles(o,e,i,t,_,n?.x??0,n?.y??0)}else n?this._setFillAndStrokeStyles(o,e,s,t,_,n.x,n.y):this._setFillAndStrokeStyles(o,e,s,t,_);o.shadowColor="rgba(0,0,0,0)"}for(let r=0;r<l.length;r++){f=_,m=_+r*u+d.ascent+x,f+=this._getAlignmentOffset(h[r],c,e.align);let s=0;if("justify"===e.align&&e.wordWrap&&r<l.length-1){const e=cf(l[r]);e>0&&(s=(c-h[r])/e)}e._stroke?.width&&this._drawLetterSpacing(l[r],e,n,f+t,m+t-g,!0,s),void 0!==e._fill&&this._drawLetterSpacing(l[r],e,n,f+t,m+t-g,!1,s)}}}_renderTaggedTextToCanvas(e,t,r,n,s){const{canvas:i,context:o}=s,{runsByLine:a,lineWidths:l,maxLineWidth:u,lineAscents:h,lineHeights:c,hasDropShadow:d}=e,p=i.height;o.resetTransform(),o.scale(n,n),o.textBaseline=t.textBaseline;const f=d?2:1;let m=t._stroke?.width??0;for(const e of a)for(const t of e){const e=t.style._stroke?.width??0;e>m&&(m=e)}const g=m/2,_=[];for(let e=0;e<a.length;e++){const t=a[e],r=[];for(const e of t){const t=af(e.style);o.font=t,r.push({width:sf._measureText(e.text,e.style.letterSpacing,o),font:t})}_.push(r)}for(let e=0;e<f;++e){const i=d&&0===e,f=i?Math.ceil(Math.max(1,p)+2*r):0,m=f*n;i||(o.shadowColor="rgba(0,0,0,0)");let x=g;for(let e=0;e<a.length;e++){const d=a[e],p=l[e],b=h[e],y=c[e],v=_[e];let T=g;T+=this._getAlignmentOffset(p,u,t.align);let S=0;if("justify"===t.align&&t.wordWrap&&e<a.length-1){let e=0;for(const t of d)e+=cf(t.text);e>0&&(S=(u-p)/e)}const w=x+b;let E=T+r;for(let e=0;e<d.length;e++){const t=d[e],{width:a,font:l}=v[e];if(o.font=l,o.textBaseline=t.style.textBaseline,t.style._stroke?.width){const e=t.style._stroke;if(o.lineWidth=e.width,o.miterLimit=e.miterLimit,o.lineJoin=e.join,o.lineCap=e.cap,i){if(!t.style.dropShadow){E+=a+cf(t.text)*S;continue}this._setupDropShadow(o,t.style,n,m)}else{const n=sf.measureFont(l),s=t.style.lineHeight||n.fontSize,i={width:a,height:s,lineHeight:s,lines:[t.text]};o.strokeStyle=uf(e,o,i,2*r,E-r,x)}this._drawLetterSpacing(t.text,t.style,s,E,w+r-f,!0,S)}E+=a+cf(t.text)*S}E=T+r;for(let e=0;e<d.length;e++){const t=d[e],{width:a,font:l}=v[e];if(o.font=l,o.textBaseline=t.style.textBaseline,void 0!==t.style._fill){if(i){if(!t.style.dropShadow){E+=a+cf(t.text)*S;continue}this._setupDropShadow(o,t.style,n,m)}else{const e=sf.measureFont(l),n=t.style.lineHeight||e.fontSize,s={width:a,height:n,lineHeight:n,lines:[t.text]};o.fillStyle=uf(t.style._fill,o,s,2*r,E-r,x)}this._drawLetterSpacing(t.text,t.style,s,E,w+r-f,!1,S)}E+=a+cf(t.text)*S}x+=y}}}_setFillAndStrokeStyles(e,t,r,n,s,i=0,o=0){if(e.fillStyle=t._fill?uf(t._fill,e,r,2*n,i,o):null,t._stroke?.width){const a=s+2*n;e.strokeStyle=uf(t._stroke,e,r,a,i,o)}}_setupDropShadow(e,t,r,n){e.fillStyle="black",e.strokeStyle="black";const s=t.dropShadow,i=s.color,o=s.alpha;e.shadowColor=Be.shared.setValue(i).setAlpha(o).toRgbaString();const a=s.blur*r,l=s.distance*r;e.shadowBlur=a,e.shadowOffsetX=Math.cos(s.angle)*l,e.shadowOffsetY=Math.sin(s.angle)*l+n}_getAlignmentOffset(e,t,r){return"right"===r?t-e:"center"===r?(t-e)/2:0}_drawLetterSpacing(e,t,r,n,s,i=!1,o=0){const{context:a}=r,l=t.letterSpacing;let u=!1;if(sf.experimentalLetterSpacingSupported&&(sf.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,u=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),(0===l||u)&&0===o)return void(i?a.strokeText(e,n,s):a.fillText(e,n,s));if(0!==o&&(0===l||u)){const t=e.split(" ");let r=n;const l=a.measureText(" ").width;for(let e=0;e<t.length;e++)i?a.strokeText(t[e],r,s):a.fillText(t[e],r,s),r+=a.measureText(t[e]).width+l+o;return}let h=n;const c=sf.graphemeSegmenter(e);let d=a.measureText(e).width,p=0;for(let e=0;e<c.length;++e){const t=c[e];i?a.strokeText(t,h,s):a.fillText(t,h,s);let r="";for(let t=e+1;t<c.length;++t)r+=c[t];p=a.measureText(r).width,h+=d-p+l," "===t&&(h+=o),d=p}}},pf=class e extends c{constructor(t={}){super(),this.uid=G("textStyle"),this._tick=0,this._cachedFontString=null,function(e){const t=e;if("boolean"==typeof t.dropShadow&&t.dropShadow){const r=ff.defaultDropShadow;e.dropShadow={alpha:t.dropShadowAlpha??r.alpha,angle:t.dropShadowAngle??r.angle,blur:t.dropShadowBlur??r.blur,color:t.dropShadowColor??r.color,distance:t.dropShadowDistance??r.distance}}if(void 0!==t.strokeThickness){L(I,"strokeThickness is now a part of stroke");const r=t.stroke;let n={};if(Be.isColorLike(r))n.color=r;else if(r instanceof Qa||r instanceof Jl)n.fill=r;else{if(!Object.hasOwnProperty.call(r,"color")&&!Object.hasOwnProperty.call(r,"fill"))throw new Error("Invalid stroke value.");n=r}e.stroke={...n,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){if(L(I,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||0===t.fill.length)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&Oe("The number of fill colors must match the number of fill gradient stops.");const r=new Qa({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),n=t.fillGradientStops.slice(),s=t.fill.map(e=>Be.shared.setValue(e).toNumber());n.forEach((e,t)=>{r.addColorStop(e,s[t])}),e.fill={fill:r}}}(t);t instanceof e&&(t=t._toObject());const r={...e.defaultTextStyle,...t};for(const e in r){this[e]=r[e]}this._tagStyles=t.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.update())}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=null!==t&&"object"==typeof t?this._createProxy({...e.defaultDropShadow,...t}):t?this._createProxy({...e.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.update())}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(this._fontSize="string"==typeof e?parseInt(e,10):e,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.update())}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.update())}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.update())}get filters(){return this._filters}set filters(e){this._filters!==e&&(this._filters=Object.freeze(e),this.update())}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.update())}get fill(){return this._originalFill}set fill(e){e!==this._originalFill&&(this._originalFill=e,this._isFillStyle(e)&&(this._originalFill=this._createProxy({...hu.defaultFillStyle,...e},()=>{this._fill=su({...this._originalFill},hu.defaultFillStyle)})),this._fill=su(0===e?"black":e,hu.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(e){e!==this._originalStroke&&(this._originalStroke=e,this._isFillStyle(e)&&(this._originalStroke=this._createProxy({...hu.defaultStrokeStyle,...e},()=>{this._stroke=iu({...this._originalStroke},hu.defaultStrokeStyle)})),this._stroke=iu(e,hu.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(e){this._tagStyles!==e&&(this._tagStyles=e??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const t=e.defaultTextStyle;for(const e in t)this[e]=t[e]}assign(e){for(const t in e){this[t]=e[t]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=af(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new e(this._toObject())}_getFinalPadding(){let e=0;if(this._filters)for(let t=0;t<this._filters.length;t++)e+=this._filters[t].padding;return Math.max(this._padding,e)}destroy(e=!1){this.removeAllListeners();if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource;this._fill?.texture&&this._fill.texture.destroy(t),this._originalFill?.texture&&this._originalFill.texture.destroy(t),this._stroke?.texture&&this._stroke.texture.destroy(t),this._originalStroke?.texture&&this._originalStroke.texture.destroy(t)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(e,t){return new Proxy(e,{set:(e,r,n)=>(e[r]===n||(e[r]=n,t?.(r,n),this.update()),!0)})}_isFillStyle(e){return null!==(e??null)&&!(Be.isColorLike(e)||e instanceof Qa||e instanceof Jl)}};pf.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},pf.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ff=pf;let mf=!1;function gf(e){if(mf)return;const t=new j({scaleMode:e.scaleMode});e._resourceId!==t._resourceId&&(mf=!0,Oe("Text textureStyle: only scaleMode is applied to a text texture, the other fields are ignored"))}function _f(e,t){const{texture:r,bounds:n}=e,s=t._style._getFinalPadding();te(n,t._anchor,r);const i=t._anchor._x*s*2,o=t._anchor._y*s*2;n.minX-=s-i,n.minY-=s-o,n.maxX-=s-i,n.maxY-=s-o}class xf{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}class bf extends xf{}class yf{constructor(e){this._renderer=e,e.runners.resolutionChange.add(this),e.runners.contextChange.add(this),this._managedTexts=new Pa({renderer:e,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const e in this._managedTexts.items){const t=this._managedTexts.items[e];t?._autoResolution&&t.onViewUpdate()}}contextChange(){for(const e in this._managedTexts.items)this._managedTexts.items[e]?.unload()}validateRenderable(e){const t=this._getGpuText(e),r=e.styleKey;return t.currentKey!==r||e._didTextUpdate}addRenderable(e,t){const r=this._getGpuText(e);if(e._didTextUpdate||r.currentKey!==e.styleKey){const t=e._autoResolution?this._renderer.resolution:e.resolution;r.currentKey===e.styleKey&&e._resolution===t||this._updateGpuText(e),e._didTextUpdate=!1,_f(r,e)}this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuText(e);t._batcher.updateElement(t)}_updateGpuText(e){const t=this._getGpuText(e);t.texture&&this._renderer.canvasText.decreaseReferenceCount(t.currentKey),e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,t.texture=this._renderer.canvasText.getManagedTexture(e),t.currentKey=e.styleKey}_getGpuText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){const t=new bf;return t.currentKey="--",t.renderable=e,t.transform=e.groupTransform,t.bounds={minX:0,maxX:1,minY:0,maxY:0},t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,this._managedTexts.add(e),t}onTextUnload(e){const t=e._gpuData[this._renderer.uid];if(!t)return;const{canvasText:r}=this._renderer;r.getReferenceCount(t.currentKey)>0?r.decreaseReferenceCount(t.currentKey):t.texture&&r.returnTexture(t.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}yf.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"text"};class vf{constructor(e,t){this._activeTextures={},this._renderer=e,this._retainCanvasContext=t}getTexture(e,t,r,n){"string"==typeof e&&(L("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),e={text:e,style:r,resolution:t}),e.style instanceof ff||(e.style=new ff(e.style)),"string"!=typeof e.text&&(e.text=e.text.toString());const{text:s,style:i,textureStyle:o,autoGenerateMipmaps:a}=e,l=e.resolution??this._renderer.resolution,{frame:u,canvasAndContext:h}=df.getCanvasAndContext({text:s,style:i,resolution:l}),c=Xc(h.canvas,u.width,u.height,l,a,o?.scaleMode);if(i.trim&&(u.pad(i.padding),c.frame.copyFrom(u),c.frame.scale(1/l),c.updateUvs()),i.filters){const e=this._applyFilters(c,i.filters);return this.returnTexture(c),df.returnCanvasAndContext(h),e}return this._renderer.texture.initSource(c._source),this._retainCanvasContext||df.returnCanvasAndContext(h),c}returnTexture(e){const t=e.source,r=t.resource;if(this._retainCanvasContext&&r?.getContext){const e=r.getContext("2d");e&&df.returnCanvasAndContext({canvas:r,context:e})}t.resource=null,t.uploadMethodId="unknown",t.alphaMode="no-premultiply-alpha",wt.returnTexture(e)}renderTextToCanvas(){L("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(e){e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;const t=e.styleKey;if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].texture;const r=this.getTexture({text:e.text,style:e.style,resolution:e._resolution,textureStyle:e.textureStyle,autoGenerateMipmaps:e.autoGenerateMipmaps});return this._activeTextures[t]={texture:r,usageCount:1},r}decreaseReferenceCount(e){const t=this._activeTextures[e];t&&(t.usageCount--,0===t.usageCount&&(this.returnTexture(t.texture),this._activeTextures[e]=null))}getReferenceCount(e){return this._activeTextures[e]?.usageCount??0}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}_applyFilters(e,t){const r=this._renderer.renderTarget.renderTarget,n=this._renderer.filter.generateFilteredTexture({texture:e,filters:t});return this._renderer.renderTarget.bind({target:r,clear:!1}),n}destroy(){this._renderer=null;for(const e in this._activeTextures)this._activeTextures[e]&&this.returnTexture(this._activeTextures[e].texture);this._activeTextures=null}}class Tf extends vf{constructor(e){super(e,!0)}}Tf.extension={type:[e.CanvasSystem],name:"canvasText"};class Sf extends vf{constructor(e){super(e,!1)}}Sf.extension={type:[e.WebGLSystem,e.WebGPUSystem],name:"canvasText"},n.add(Tf),n.add(Sf),n.add(yf);let wf=class extends gp{constructor(...e){const t=_p(e,"Text");super(t,ff),this.renderPipeId="text",t.textureStyle&&(this.textureStyle=t.textureStyle instanceof j?t.textureStyle:new j(t.textureStyle),gf(this.textureStyle)),this.autoGenerateMipmaps=t.autoGenerateMipmaps??K.defaultOptions.autoGenerateMipmaps}updateBounds(){const e=this._bounds,t=this._anchor;let r=0,n=0;if(this._style.trim){const{frame:e,canvasAndContext:t}=df.getCanvasAndContext({text:this.text,style:this._style,resolution:1});df.returnCanvasAndContext(t),r=e.width,n=e.height}else{const e=sf.measureText(this._text,this._style);r=e.width,n=e.height}e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*n,e.maxY=e.minY+n}};class Ef extends Pd{resolveQueueItem(e,t){return e instanceof Ot?this.resolveContainerQueueItem(e,t):e instanceof K||e instanceof ee?t.push(e.source):e instanceof hu&&t.push(e),null}resolveContainerQueueItem(e,t){e instanceof Ut||e instanceof mp||e instanceof $d?t.push(e.texture.source):e instanceof wf?t.push(e):e instanceof Nd?t.push(e.context):e instanceof Yd&&e.textures.forEach(e=>{e.source?t.push(e.source):t.push(e.texture.source)})}resolveGraphicsContextQueueItem(e){this.renderer.graphicsContext.getGpuContext(e);const{instructions:t}=e;for(const e of t){if("texture"===e.action){const{image:t}=e.data;return t.source}if("fill"===e.action){const{texture:t}=e.data.style;return t.source}}return null}}class Af extends c{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return L(I,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return L(I,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return L(I,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return L(I,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return L(I,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){this.emit("destroy",this),this.removeAllListeners();for(const e in this.chars)this.chars[e].texture?.destroy();this.chars=null,e&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}const Rf=class e extends Af{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const r={...e.defaultOptions,...t};this._textureSize=r.textureSize,this._mipmap=r.mipmap;const n=r.style.clone();r.overrideFill&&(n._fill.color=16777215,n._fill.alpha=1,n._fill.texture=ee.WHITE,n._fill.fill=null),this.applyFillAsTint=r.overrideFill;const s=n.fontSize;n.fontSize=this.baseMeasurementFontSize;const i=af(n);r.overrideSize?(n._stroke&&(n._stroke.width*=this.baseRenderedFontSize/s),n.dropShadow&&(n.dropShadow.blur*=this.baseRenderedFontSize/s,n.dropShadow.distance*=this.baseRenderedFontSize/s)):n.fontSize=this.baseRenderedFontSize=s,this._style=n,this._skipKerning=r.skipKerning??!1,this.resolution=r.resolution??1,this._padding=r.padding??4,r.textureStyle&&(this._textureStyle=r.textureStyle instanceof j?r.textureStyle:new j(r.textureStyle)),this.fontMetrics=sf.measureFont(i),this.lineHeight=n.lineHeight||this.fontMetrics.fontSize||n.fontSize}ensureCharacters(e){const t=sf.graphemeSegmenter(e).filter(e=>!this._currentChars.includes(e)).filter((e,t,r)=>r.indexOf(e)===t);if(!t.length)return;let r;this._currentChars=[...this._currentChars,...t],r=-1===this._currentPageIndex?this._nextPage():this.pages[this._currentPageIndex];let{canvas:n,context:s}=r.canvasAndContext,i=r.texture.source;const o=this._style;let a=this._currentX,l=this._currentY,u=this._currentMaxCharHeight;const h=this.baseRenderedFontSize/this.baseMeasurementFontSize,c=(o.dropShadow?.distance??0)+(o._stroke?.width??0),d=this._padding+c;let p=!1;const f=n.width/this.resolution,m=n.height/this.resolution;for(let e=0;e<t.length;e++){const r=t[e],c=sf.measureText(r,o,n,!1);c.lineHeight=c.height;const g=c.width*h,_=Math.ceil(("italic"===o.fontStyle?2:1)*g)+2*d,x=c.height*h+2*d;if(p=!1,"\n"!==r&&"\r"!==r&&"\t"!==r&&" "!==r&&(p=!0,u=Math.ceil(Math.max(x,u))),a+_>f&&(l+=u,u=x,a=0,l+u>m)){i.update();const e=this._nextPage();n=e.canvasAndContext.canvas,s=e.canvasAndContext.context,i=e.texture.source,a=0,l=0,u=0}const b=s.measureText(r).width/h;if(this.chars[r]={id:r.codePointAt(0),xOffset:-d/h,yOffset:-d/h,xAdvance:b,kerning:{}},p){this._drawGlyph(s,c,a+d,l+d,h,o);const e=i.width*h,t=i.height*h,n=new M(a/e*i.width,l/t*i.height,_/e*i.width,x/t*i.height);this.chars[r].texture=new ee({source:i,frame:n}),a+=Math.ceil(_)}}i.update(),this._currentX=a,this._currentY=l,this._currentMaxCharHeight=u,this._skipKerning||this._applyKerning(t,s,h)}get pageTextures(){return L(I,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t,r){const n=this._measureCache;for(let s=0;s<e.length;s++){const i=e[s];for(let e=0;e<this._currentChars.length;e++){const s=this._currentChars[e];let o=n[i];o||(o=n[i]=t.measureText(i).width);let a=n[s];a||(a=n[s]=t.measureText(s).width);let l=t.measureText(i+s).width,u=l-(o+a);u&&this.chars[i]&&(this.chars[i].kerning[s]=u/r),l=t.measureText(i+s).width,u=l-(o+a),u&&this.chars[s]&&(this.chars[s].kerning[i]=u/r)}}}_nextPage(){this._currentPageIndex++;const e=this.resolution,t=Oc.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(t.context,this._style,e);const r=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),n=new ee({source:new qt({resource:t.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(n.source.style=this._textureStyle);const s={canvasAndContext:t,texture:n};return this.pages[this._currentPageIndex]=s,s}_setupContext(e,t,r){t.fontSize=this.baseRenderedFontSize,e.scale(r,r),e.font=af(t),t.fontSize=this.baseMeasurementFontSize,e.textBaseline=t.textBaseline;const n=t._stroke,s=n?.width??0;if(n&&(e.lineWidth=s,e.lineJoin=n.join,e.miterLimit=n.miterLimit,e.strokeStyle=uf(n,e)),t._fill&&(e.fillStyle=uf(t._fill,e)),t.dropShadow){const n=t.dropShadow,s=Be.shared.setValue(n.color).toArray(),i=n.blur*r,o=n.distance*r;e.shadowColor=`rgba(${255*s[0]},${255*s[1]},${255*s[2]},${n.alpha})`,e.shadowBlur=i,e.shadowOffsetX=Math.cos(n.angle)*o,e.shadowOffsetY=Math.sin(n.angle)*o}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,t,r,n,s,i){const o=t.text,a=t.fontProperties,l=i._stroke,u=(l?.width??0)*s,h=r+u/2,c=n-u/2,d=a.descent*s,p=t.lineHeight*s;let f=!1;i.stroke&&u&&(f=!0,e.strokeText(o,h,c+p-d));const{shadowBlur:m,shadowOffsetX:g,shadowOffsetY:_}=e;i._fill&&(f&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillText(o,h,c+p-d)),f&&(e.shadowBlur=m,e.shadowOffsetX=g,e.shadowOffsetY=_)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){const{canvasAndContext:t,texture:r}=this.pages[e];Oc.returnCanvasAndContext(t),r.destroy(!0)}this.pages=null}};Rf.defaultOptions={textureSize:512,style:new ff,mipmap:!0};let Cf=Rf;function Mf(e,t,r,n){const s={width:0,height:0,offsetY:0,scale:t.fontSize/r.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=r.baseLineOffset;let i=s.lines[0],o=null,a=!0;const l={width:0,start:0,index:0,positions:[],chars:[]},u=r.baseMeasurementFontSize/t.fontSize,h=t.letterSpacing*u,c=t.wordWrapWidth*u,d=t.lineHeight?t.lineHeight*u:r.lineHeight,p=t.wordWrap&&t.breakWords,f=Vp(t.whiteSpace),m=Wp(t.whiteSpace);if(f||m){const t=[];let r=f;for(let n=0;n<e.length;n++){let s=e[n];if("\r"===s||"\n"===s){if(!m){f&&(r=!0),t.push(s);continue}"\r"===s&&"\n"===e[n+1]&&n++,s=" "}if(Xp(s))if(f&&Hp(s)){if(r)continue;r=!0,t.push(" ")}else r=!1,t.push(s);else r=!1,t.push(s)}e=t}const g=e=>{const t=i.width;for(let r=0;r<l.index;r++){const n=e.positions[r];i.chars.push(e.chars[r]),i.charPositions.push(n+t)}i.width+=e.width,(l.index>0||!f)&&(a=!1),l.width=0,l.index=0,l.chars.length=0},_=()=>{let e=i.chars.length-1;if(n){let t=i.chars[e];for(;Hp(t);)i.width-=r.chars[t].xAdvance,i.spacesIndex.pop(),t=i.chars[--e]}s.width=Math.max(s.width,i.width),i={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(i),s.height+=d},x=e=>e-h>c;for(let n=0;n<e.length+1;n++){let s;const u=n===e.length;u||(s=e[n]);const c=r.chars[s];if(/(?:\s)/.test(s)||"\r"===s||"\n"===s||u){if(!a&&t.wordWrap&&x(i.width+l.width)?(_(),g(l),!u&&c&&i.charPositions.push(0)):(l.start=i.width,g(l),!u&&c&&i.charPositions.push(0)),"\r"===s||"\n"===s)_();else if(!u&&c){const e=c.xAdvance+(c.kerning?.[o]||0)+h;i.width+=e,i.spaceWidth=e,i.spacesIndex.push(i.charPositions.length),i.chars.push(s)}}else if(c){const e=c.kerning?.[o]||0,r=c.xAdvance+e+h;if(p&&x(l.width+r)&&(a||_(),g(l),_()),l.positions[l.index++]=l.width+e,l.chars.push(s),l.width+=r,zp(s)){!a&&t.wordWrap&&x(i.width+l.width)&&_(),g(l)}}o=s}return _(),"center"===t.align?function(e){for(let t=0;t<e.lines.length;t++){const r=e.lines[t],n=e.width/2-r.width/2;for(let e=0;e<r.charPositions.length;e++)r.charPositions[e]+=n}}(s):"right"===t.align?function(e){for(let t=0;t<e.lines.length;t++){const r=e.lines[t],n=e.width-r.width;for(let e=0;e<r.charPositions.length;e++)r.charPositions[e]+=n}}(s):"justify"===t.align&&function(e){const t=e.width;for(let r=0;r<e.lines.length-2;r++){const n=e.lines[r];let s=0,i=n.spacesIndex[s++],o=0;const a=n.spacesIndex.length,l=(t-n.width)/a;for(let e=0;e<n.charPositions.length;e++)e===i&&(i=n.spacesIndex[s++],o+=l),n.charPositions[e]+=o}}(s),s}function Pf(e){if(""===e)return[];"string"==typeof e&&(e=[e]);const t=[];for(let r=0,n=e.length;r<n;r++){const n=e[r];if(Array.isArray(n)){if(2!==n.length)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);if(0===n[0].length||0===n[1].length)throw new Error("[BitmapFont]: Invalid character delimiter.");const e=n[0].charCodeAt(0),r=n[1].charCodeAt(0);if(r<e)throw new Error("[BitmapFont]: Invalid character range.");for(let n=e,s=r;n<=s;n++)t.push(String.fromCharCode(n))}else t.push(...Array.from(n))}if(0===t.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}let Gf=0;const Bf=new class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1,textureStyle:null},this.measureCache=wp(1e3)}getFont(e,t){let r=`${t.fontFamily}-bitmap`,n=!0;if(ir.has(r)){const t=ir.get(r);return t.ensureCharacters?.(e),t}if(t._fill.fill&&!t._stroke?(r+=t._fill.fill.styleKey,n=!1):(t._stroke||t.dropShadow)&&(r=`${t.styleKey}-bitmap`,n=!1),r+=`-${t.fontStyle}`,r+=`-${t.fontVariant}`,r+=`-${t.fontWeight}`,!ir.has(r)){const e=Object.create(t);e._lineHeight=0;const s=new Cf({style:e,overrideFill:n,overrideSize:!0,...this.defaultOptions});Gf++,Gf>50&&Oe("BitmapText",`You have dynamically created ${Gf} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),s.once("destroy",()=>{Gf--,ir.remove(r)}),ir.set(r,s)}const s=ir.get(r);return s.ensureCharacters?.(e),s}getLayout(e,t,r=!0){const n=this.getFont(e,t),s=`${e}-${t.styleKey}-${r}`;if(this.measureCache.has(s))return this.measureCache.get(s);const i=Mf(sf.graphemeSegmenter(e),t,n,r);return this.measureCache.set(s,i),i}measureText(e,t,r=!0){return this.getLayout(e,t,r)}install(...e){let t=e[0];"string"==typeof t&&(t={name:t,style:e[1],chars:e[2]?.chars,resolution:e[2]?.resolution,padding:e[2]?.padding,skipKerning:e[2]?.skipKerning},L(I,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const r=t?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};const n=t.style,s=n instanceof ff?n:new ff(n),i=t.dynamicFill??this._canUseTintForStyle(s),o=new Cf({style:s,overrideFill:i,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1,textureStyle:t.textureStyle}),a=Pf(t.chars);return o.ensureCharacters(a.join("")),ir.set(`${r}-bitmap`,o),o.once("destroy",()=>ir.remove(`${r}-bitmap`)),o}uninstall(e){const t=`${e}-bitmap`,r=ir.get(t);r&&r.destroy()}_canUseTintForStyle(e){return!(e._stroke||e.dropShadow&&0!==e.dropShadow.color||e._fill.fill||16777215!==e._fill.color)}};class Ff extends Nd{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy()}}class If{constructor(e){this._renderer=e,this._managedBitmapTexts=new Pa({renderer:e,type:"renderable",priority:-2,name:"bitmapText"})}validateRenderable(e){const t=this._getGpuBitmapText(e);return this._renderer.renderPipes.graphics.validateRenderable(t)}addRenderable(e,t){const r=this._getGpuBitmapText(e);Of(e,r),e._didTextUpdate&&(e._didTextUpdate=!1,this._updateContext(e,r)),this._renderer.renderPipes.graphics.addRenderable(r,t),r.context.customShader&&this._updateDistanceField(e)}updateRenderable(e){const t=this._getGpuBitmapText(e);Of(e,t),this._renderer.renderPipes.graphics.updateRenderable(t),t.context.customShader&&this._updateDistanceField(e)}_updateContext(e,t){const{context:r}=t,n=Bf.getFont(e.text,e._style);if(r.clear(),"none"!==n.distanceField.type){const e=this.getSdfShader();e&&(r.customShader||(r.customShader=e))}const s=sf.graphemeSegmenter(e.text),i=e._style;let o=n.baseLineOffset;const a=Mf(s,i,n,!0),l=i.padding,u=a.scale;let h=a.width,c=a.height+a.offsetY;i._stroke&&(h+=i._stroke.width/u,c+=i._stroke.width/u),r.translate(-e._anchor._x*h-l,-e._anchor._y*c-l).scale(u,u);const d=n.applyFillAsTint?i._fill.color:16777215;let p=n.fontMetrics.fontSize,f=n.lineHeight;i.lineHeight&&(p=i.fontSize/u,f=i.lineHeight/u);let m=(f-p)/2;m-n.baseLineOffset<0&&(m=0);for(let e=0;e<a.lines.length;e++){const t=a.lines[e];for(let e=0;e<t.charPositions.length;e++){const s=t.chars[e],i=n.chars[s];if(i?.texture){const n=i.texture;r.texture(n,d,Math.round(t.charPositions[e]+i.xOffset),Math.round(o+i.yOffset+m),n.orig.width,n.orig.height)}}o+=f}}_getGpuBitmapText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){const t=new Ff;return e._gpuData[this._renderer.uid]=t,this._updateContext(e,t),this._managedBitmapTexts.add(e),t}_updateDistanceField(e){const t=this._getGpuBitmapText(e).context,r=e._style.fontFamily,n=ir.get(`${r}-bitmap`),{a:s,b:i,c:o,d:a}=e.groupTransform,l=Math.sqrt(s*s+i*i),u=Math.sqrt(o*o+a*a),h=(Math.abs(l)+Math.abs(u))/2,c=n.baseRenderedFontSize/e._style.fontSize,d=h*n.distanceField.range*(1/c);t.customShader.resources.localUniforms.uniforms.uDistance=d}destroy(){this._managedBitmapTexts.destroy(),this._renderer=null,this._managedBitmapTexts=null}}function Of(e,t){t.groupTransform=e.groupTransform,t.groupColorAlpha=e.groupColorAlpha,t.groupColor=e.groupColor,t.groupBlendMode=e.groupBlendMode,t.globalDisplayStatus=e.globalDisplayStatus,t.groupTransform=e.groupTransform,t.localDisplayStatus=e.localDisplayStatus,t.groupAlpha=e.groupAlpha,t._roundPixels=e._roundPixels}class Df extends If{getSdfShader(){return null}}Df.extension={type:[e.CanvasPipes],name:"bitmapText"};const Uf={name:"local-uniform-msdf-bit",vertex:{header:"\n struct LocalUniforms {\n uColor:vec4<f32>,\n uTransformMatrix:mat3x3<f32>,\n uDistance: f32,\n uRound:f32,\n }\n\n @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;\n ",main:"\n vColor *= localUniforms.uColor;\n modelMatrix *= localUniforms.uTransformMatrix;\n ",end:"\n if(localUniforms.uRound == 1)\n {\n vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "},fragment:{header:"\n struct LocalUniforms {\n uColor:vec4<f32>,\n uTransformMatrix:mat3x3<f32>,\n uDistance: f32\n }\n\n @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;\n ",main:"\n outColor = vec4<f32>(calculateMSDFAlpha(outColor, vColor, localUniforms.uDistance));\n "}},kf={name:"local-uniform-msdf-bit",vertex:{header:"\n uniform mat3 uTransformMatrix;\n uniform vec4 uColor;\n uniform float uRound;\n ",main:"\n vColor *= uColor;\n modelMatrix *= uTransformMatrix;\n ",end:"\n if(uRound == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "},fragment:{header:"\n uniform float uDistance;\n ",main:"\n outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));\n "}},Lf={name:"msdf-bit",fragment:{header:"\n fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {\n\n // MSDF\n var median = msdfColor.r + msdfColor.g + msdfColor.b -\n min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -\n max(msdfColor.r, max(msdfColor.g, msdfColor.b));\n\n // SDF\n median = min(median, msdfColor.a);\n\n var screenPxDistance = distance * (median - 0.5);\n var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\n if (median < 0.01) {\n alpha = 0.0;\n } else if (median > 0.99) {\n alpha = 1.0;\n }\n\n // Gamma correction for coverage-like alpha\n var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));\n var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);\n var coverage: f32 = pow(shapeColor.a * alpha, gamma);\n\n return coverage;\n\n }\n "}},Nf={name:"msdf-bit",fragment:{header:"\n float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {\n\n // MSDF\n float median = msdfColor.r + msdfColor.g + msdfColor.b -\n min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -\n max(msdfColor.r, max(msdfColor.g, msdfColor.b));\n\n // SDF\n median = min(median, msdfColor.a);\n\n float screenPxDistance = distance * (median - 0.5);\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\n\n if (median < 0.01) {\n alpha = 0.0;\n } else if (median > 0.99) {\n alpha = 1.0;\n }\n\n // Gamma correction for coverage-like alpha\n float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));\n float gamma = mix(1.0, 1.0 / 2.2, luma);\n float coverage = pow(shapeColor.a * alpha, gamma);\n\n return coverage;\n }\n "}};let Xf,Hf;class zf extends Ln{constructor(e){const t=new On({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new _,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});Xf??(Xf=ca({name:"sdf-shader",bits:[pa,xa(e),Uf,Lf,Ta]})),Hf??(Hf=da({name:"sdf-shader",bits:[fa,va(e),kf,Nf,Sa]})),super({glProgram:Hf,gpuProgram:Xf,resources:{localUniforms:t,batchSamplers:Ea(e)}})}}class Vf extends If{getSdfShader(){return new zf(this._renderer.limits.maxBatchableTextures)}}Vf.extension={type:[e.WebGLPipes,e.WebGPUPipes],name:"bitmapText"},n.add(Df),n.add(Vf);let Wf=class extends gp{constructor(...e){var t;const r=_p(e,"BitmapText");r.style??(r.style=r.style||{}),(t=r.style).fill??(t.fill=16777215),super(r,ff),this.renderPipeId="bitmapText"}_onTouch(e){this._gcLastUsed=e;for(const t in this._gpuData)this._gpuData[t]?._onTouch(e)}updateBounds(){const e=this._bounds,t=this._anchor,r=Bf.measureText(this.text,this._style),n=r.scale,s=r.offsetY*n;let i=r.width*n,o=r.height*n;const a=this._style._stroke;a&&(i+=a.width,o+=a.width),e.minX=-t._x*i,e.maxX=e.minX+i,e.minY=-t._y*(o+s),e.maxY=e.minY+o}set resolution(e){null!==e&&Oe("[BitmapText] dynamically updating the resolution is not supported. Resolution should be managed by the BitmapFont.")}get resolution(){return this._resolution}};function $f(e){const t=e._stroke,r=e._fill,n=[`div { ${[`color: ${Be.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa()}`,`font-size: ${e.fontSize}px`,`font-family: ${e.fontFamily}`,`font-weight: ${e.fontWeight}`,`font-style: ${e.fontStyle}`,`font-variant: ${e.fontVariant}`,`letter-spacing: ${e.letterSpacing}px`,`text-align: ${e.align}`,`padding: ${e.padding}px`,`white-space: ${"pre"===e.whiteSpace&&e.wordWrap?"pre-wrap":e.whiteSpace}`,...e.lineHeight?[`line-height: ${e.lineHeight}px`]:[],...e.wordWrap?["word-break: "+(e.breakWords?"break-word":"normal"),`max-width: ${e.wordWrapWidth}px`]:[],...t?[jf(t)]:[],...e.dropShadow?[Yf(e.dropShadow)]:[],...e.cssOverrides].join(";")} }`];return function(e,t){for(const r in e){const n=e[r],s=[];for(const e in n)Kf[e]?s.push(Kf[e](n[e])):qf[e]&&s.push(qf[e].replace("{{VALUE}}",n[e]));t.push(`${r} { ${s.join(";")} }`)}}(e.tagStyles,n),n.join(" ")}function Yf(e){const t={...e},r=Be.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa(),n=`${Math.round(Math.cos(t.angle)*t.distance)}px ${Math.round(Math.sin(t.angle)*t.distance)}px`;return t.blur>0?`text-shadow: ${n} ${t.blur}px ${r}`:`text-shadow: ${n} ${r}`}function jf(e){const t=Be.shared.setValue(e.color).setAlpha(e.alpha??1).toHexa();return[`-webkit-text-stroke-width: ${e.width}px`,`-webkit-text-stroke-color: ${t}`,`text-stroke-width: ${e.width}px`,`text-stroke-color: ${t}`,"paint-order: stroke"].join(";")}const qf={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Kf={fill:e=>`color: ${Be.shared.setValue(e).toHexa()}`,breakWords:e=>"word-break: "+(e?"break-all":"normal"),stroke:jf,dropShadow:e=>!0===e?Yf(ff.defaultDropShadow):e&&"object"==typeof e?Yf({...ff.defaultDropShadow,...e}):""};class Zf extends ff{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides=e.cssOverrides??[],this.tagStyles=e.tagStyles??{}}get tagStyles(){return this._tagStyles}set tagStyles(e){this._tagStyles!==e&&(this._tagStyles=e??{},this.update())}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}update(){this._cssStyle=null,super.update()}clone(){return new Zf({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides,tagStyles:{...this.tagStyles}})}get cssStyle(){return this._cssStyle||(this._cssStyle=$f(this)),this._cssStyle}addOverride(...e){const t=e.filter(e=>!this.cssOverrides.includes(e));t.length>0&&(this.cssOverrides.push(...t),this.update())}removeOverride(...e){const t=e.filter(e=>this.cssOverrides.includes(e));t.length>0&&(this.cssOverrides=this.cssOverrides.filter(e=>!t.includes(e)),this.update())}set fill(e){"string"!=typeof e&&"number"!=typeof e&&Oe("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&"string"!=typeof e&&"number"!=typeof e&&Oe("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}const Qf="http://www.w3.org/2000/svg",Jf="http://www.w3.org/1999/xhtml";class em{constructor(){this.svgRoot=document.createElementNS(Qf,"svg"),this.foreignObject=document.createElementNS(Qf,"foreignObject"),this.domElement=document.createElementNS(Jf,"div"),this.styleElement=document.createElementNS(Jf,"style");const{foreignObject:e,svgRoot:t,styleElement:r,domElement:n}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(r),e.appendChild(n),this.image=Yt.get().createImage()}destroy(){this.svgRoot.remove(),this.foreignObject.remove(),this.styleElement.remove(),this.domElement.remove(),this.image.src="",this.image.remove(),this.svgRoot=null,this.foreignObject=null,this.styleElement=null,this.domElement=null,this.image=null,this.canvasAndContext=null}}let tm;function rm(e,t,r,n){n||(n=tm||(tm=new em));const{domElement:s,styleElement:i,svgRoot:o}=n;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${e}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),r&&(i.textContent=r),document.body.appendChild(o);let a=s.scrollWidth,l=s.scrollHeight;if(o.remove(),t.dropShadow){const{distance:e,angle:r,blur:n}=t.dropShadow;a+=Math.abs(Math.round(Math.cos(r)*e))+n,l+=Math.abs(Math.round(Math.sin(r)*e))+n}const u=2*t.padding;return{width:a-u,height:l-u}}class nm extends xf{constructor(){super(...arguments),this.generatingTexture=!1,this.currentKey="--"}destroy(){this.texturePromise=null,this.generatingTexture=!1,this.currentKey="--",super.destroy()}}class sm{constructor(e){this._renderer=e,e.runners.resolutionChange.add(this),e.runners.contextChange.add(this),this._managedTexts=new Pa({renderer:e,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"htmlText"})}resolutionChange(){for(const e in this._managedTexts.items){const t=this._managedTexts.items[e];t?._autoResolution&&t.onViewUpdate()}}contextChange(){for(const e in this._managedTexts.items)this._managedTexts.items[e]?.unload()}validateRenderable(e){const t=this._getGpuText(e),r=e.styleKey;return t.currentKey!==r}addRenderable(e,t){const r=this._getGpuText(e);if(e._didTextUpdate||r.currentKey!==e.styleKey){const t=e._autoResolution?this._renderer.resolution:e.resolution;r.currentKey===e.styleKey&&e.resolution===t||this._updateGpuText(e).catch(e=>{console.error(e)}),e._didTextUpdate=!1,_f(r,e)}this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuText(e);t._batcher.updateElement(t)}async _updateGpuText(e){e._didTextUpdate=!1;const t=this._getGpuText(e);if(t.generatingTexture)return;const r=t.texturePromise;t.texturePromise=null,t.generatingTexture=!0,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution;let n=this._renderer.htmlText.getTexturePromise(e);r&&(n=n.finally(()=>{this._renderer.htmlText.decreaseReferenceCount(t.currentKey),this._renderer.htmlText.returnTexturePromise(r)})),t.texturePromise=n,t.currentKey=e.styleKey;const s=await n;if(!t.renderable)return;t.texture=s;const i=e.renderGroup||e.parentRenderGroup;i&&(i.structureDidChange=!0),t.generatingTexture=!1,_f(t,e)}_getGpuText(e){return e._gpuData[this._renderer.uid]||this.initGpuText(e)}initGpuText(e){const t=new nm;return t.renderable=e,t.transform=e.groupTransform,t.texture=ee.EMPTY,t.bounds={minX:0,maxX:1,minY:0,maxY:0},t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._resolution=e._autoResolution?this._renderer.resolution:e.resolution,e._gpuData[this._renderer.uid]=t,this._managedTexts.add(e),t}onTextUnload(e){const t=e._gpuData[this._renderer.uid];if(!t?.texturePromise)return;const{htmlText:r}=this._renderer;null===r.getReferenceCount(t.currentKey)?r.returnTexturePromise(t.texturePromise):r.decreaseReferenceCount(t.currentKey)}destroy(){this._managedTexts.destroy(),this._renderer=null}}function im(){const{userAgent:e}=Yt.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}function om(e,t){const r=t.fontFamily,n=[],s={},i=e.match(/font-family:([^;"\s]+)/g);function o(e){s[e]||(n.push(e),s[e]=!0)}if(Array.isArray(r))for(let e=0;e<r.length;e++)o(r[e]);else o(r);i&&i.forEach(e=>{o(e.split(":")[1].trim())});for(const e in t.tagStyles){o(t.tagStyles[e].fontFamily)}return n}async function am(e){const t=await Yt.get().fetch(e),r=await t.blob(),n=new FileReader;return await new Promise((e,t)=>{n.onloadend=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)})}async function lm(e,t){const r=await am(t);return`@font-face {\n font-family: "${e.fontFamily}";\n font-weight: ${e.fontWeight};\n font-style: ${e.fontStyle};\n src: url('${r}');\n }`}sm.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"htmlText"};const um=new Map;async function hm(e){const t=e.filter(e=>ir.has(`${e}-and-url`)).map(e=>{if(!um.has(e)){const{entries:t}=ir.get(`${e}-and-url`),r=[];t.forEach(t=>{const n=t.url,s=t.faces.map(e=>({weight:e.weight,style:e.style}));r.push(...s.map(t=>lm({fontWeight:t.weight,fontStyle:t.style,fontFamily:e},n)))}),um.set(e,Promise.all(r).then(e=>e.join("\n")))}return um.get(e)});return(await Promise.all(t)).join("\n")}function cm(e,t,r,n,s){const{domElement:i,styleElement:o,svgRoot:a}=s;i.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${e}</div>`,i.setAttribute("style",`transform: scale(${r});transform-origin: top left; display: inline-block`),o.textContent=n;const{width:l,height:u}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",u.toString()),(new XMLSerializer).serializeToString(a)}function dm(e,t){const r=Oc.getOptimalCanvasAndContext(e.width,e.height,t),{context:n}=r;return n.clearRect(0,0,e.width,e.height),n.drawImage(e,0,0),r}function pm(e,t,r){return new Promise(async n=>{r&&await new Promise(e=>setTimeout(e,100)),e.onload=()=>{n()},e.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,e.crossOrigin="anonymous"})}class fm{constructor(e){this._activeTextures={},this._renderer=e,this._createCanvas=e.type===Un.WEBGPU}getTexture(e){return this.getTexturePromise(e)}getManagedTexture(e){const t=e.styleKey;if(this._activeTextures[t])return this._increaseReferenceCount(t),this._activeTextures[t].promise;const r=this._buildTexturePromise(e).then(e=>(this._activeTextures[t].texture=e,e));return this._activeTextures[t]={texture:null,promise:r,usageCount:1},r}getReferenceCount(e){return this._activeTextures[e]?.usageCount??null}_increaseReferenceCount(e){this._activeTextures[e].usageCount++}decreaseReferenceCount(e){const t=this._activeTextures[e];t&&(t.usageCount--,0===t.usageCount&&(t.texture?this._cleanUp(t.texture):t.promise.then(e=>{t.texture=e,this._cleanUp(t.texture)}).catch(()=>{Oe("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[e]=null))}getTexturePromise(e){return this._buildTexturePromise(e)}async _buildTexturePromise(e){const{text:t,style:r,resolution:n,textureStyle:s,autoGenerateMipmaps:i}=e,o=Le.get(em),a=om(t,r),l=await hm(a),u=rm(t,r,l,o),h=Math.ceil(Math.ceil(Math.max(1,u.width)+2*r.padding)*n),c=Math.ceil(Math.ceil(Math.max(1,u.height)+2*r.padding)*n),d=o.image;d.width=2+(0|h),d.height=2+(0|c);const p=cm(t,r,n,l,o);await pm(d,p,im()&&a.length>0);const f=d;let m;this._createCanvas&&(m=dm(d,n));const g=Xc(m?m.canvas:f,d.width-2,d.height-2,n,i,s?.scaleMode);return this._renderer?.texture.initSource(g.source),this._createCanvas&&Oc.returnCanvasAndContext(m),Le.return(o),g}returnTexturePromise(e){e.then(e=>{this._cleanUp(e)}).catch(()=>{Oe("HTMLTextSystem: Failed to clean texture")})}_cleanUp(e){const t=e.source;wt.returnTexture(e),t.resource=null,t.uploadMethodId="unknown"}destroy(){this._renderer=null;for(const e in this._activeTextures)this._activeTextures[e]&&this.returnTexturePromise(this._activeTextures[e].promise);this._activeTextures=null}}fm.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"htmlText"},n.add(fm),n.add(sm);let mm=class extends gp{constructor(...e){const t=_p(e,"HtmlText");super(t,Zf),this.renderPipeId="htmlText",t.textureStyle&&(this.textureStyle=t.textureStyle instanceof j?t.textureStyle:new j(t.textureStyle),gf(this.textureStyle)),this.autoGenerateMipmaps=t.autoGenerateMipmaps??K.defaultOptions.autoGenerateMipmaps}updateBounds(){const e=this._bounds,t=this._anchor,r=rm(this.text,this._style),{width:n,height:s}=r;e.minX=-t._x*n,e.maxX=e.minX+n,e.minY=-t._y*s,e.maxY=e.minY+s}get text(){return this._text}set text(e){const t=this._sanitiseText(e.toString());super.text=t}_sanitiseText(e){return this._removeInvalidHtmlTags(e.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," "))}_removeInvalidHtmlTags(e){return e.replace(/<[^>]*?(?=<|$)/g,"")}};class gm extends Ef{uploadQueueItem(e){e instanceof K?this.uploadTextureSource(e):e instanceof wf?this.uploadText(e):e instanceof mm?this.uploadHTMLText(e):e instanceof Wf?this.uploadBitmapText(e):e instanceof hu&&this.uploadGraphicsContext(e)}uploadTextureSource(e){this.renderer.texture.initSource(e)}uploadText(e){this.renderer.renderPipes.text.initGpuText(e)}uploadBitmapText(e){this.renderer.renderPipes.bitmapText.initGpuText(e)}uploadHTMLText(e){this.renderer.renderPipes.htmlText.initGpuText(e)}uploadGraphicsContext(e){this.renderer.graphicsContext.getGpuContext(e);const{instructions:t}=e;for(const e of t)if("texture"===e.action){const{image:t}=e.data;this.uploadTextureSource(t.source)}else if("fill"===e.action){const{texture:t}=e.data.style;this.uploadTextureSource(t.source)}return null}}class _m extends gm{destroy(){super.destroy(),clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}_m.extension={type:[e.WebGLSystem,e.WebGPUSystem],name:"prepare"};const xm=class e{static _getPatternRepeat(e,t){const r=e&&"clamp-to-edge"!==e,n=t&&"clamp-to-edge"!==t;return r&&n?"repeat":r?"repeat-x":n?"repeat-y":"no-repeat"}start(e,t,r){}execute(t,r){const n=r.elements;if(!n||!n.length)return;const s=t.renderer,i=s.canvasContext,o=i.activeContext;for(let t=0;t<n.length;t++){const a=n[t];if(!a.packAsQuad)continue;const l=a,u=l.texture,h=u?Gc.getCanvasSource(u):null;if(!h)continue;const c=u.source.style,d=i.smoothProperty,p="nearest"!==c.scaleMode;o[d]!==p&&(o[d]=p),i.setBlendMode(r.blendMode);const f=s.globalUniforms.globalUniformData?.worldColor??4294967295,m=l.color,g=(f>>>24&255)/255*((m>>>24&255)/255)*(s.filter?.alphaMultiplier??1);if(g<=0)continue;o.globalAlpha=g;const _=it(rt(16777215&m,16777215&f)),x=u.frame,b=c.addressModeU??c.addressMode,y=c.addressModeV??c.addressMode,v=e._getPatternRepeat(b,y),T=u.source._resolution??u.source.resolution??1,S=l.renderable?.renderGroup?.isCachedAsTexture,w=x.x*T,E=x.y*T,A=x.width*T,C=x.height*T,M=l.bounds,P=s.renderTarget.renderTarget.isRoot,G=M.minX,B=M.minY,F=M.maxX-M.minX,I=M.maxY-M.minY,O=u.rotate,D=u.uvs,U=Math.min(D.x0,D.x1,D.x2,D.x3,D.y0,D.y1,D.y2,D.y3),k=Math.max(D.x0,D.x1,D.x2,D.x3,D.y0,D.y1,D.y2,D.y3),L="no-repeat"!==v&&(U<0||k>1),N=O&&!(!L&&(16777215!==_||O));N?(e._tempPatternMatrix.copyFrom(l.transform),R.matrixAppendRotationInv(e._tempPatternMatrix,O,G,B,F,I),i.setContextTransform(e._tempPatternMatrix,1===l.roundPixels,void 0,S&&P)):i.setContextTransform(l.transform,1===l.roundPixels,void 0,S&&P);const X=F,H=I;let z=N?0:G,V=N?0:B;if(N||1!==l.roundPixels||(z|=0,V|=0),L){let t=h;const r=16777215!==_&&!O,n=x.width<=u.source.width&&x.height<=u.source.height;r&&n&&(t=Gc.getTintedCanvas({texture:u},_));const s=o.createPattern(t,v);if(!s)continue;const i=X,a=H;if(0===i||0===a)continue;const l=1/i,c=1/a,d=(D.x1-D.x0)*l,p=(D.y1-D.y0)*l,f=(D.x3-D.x0)*c,m=(D.y3-D.y0)*c,g=D.x0-d*z-f*V,b=D.y0-p*z-m*V,y=u.source.pixelWidth,T=u.source.pixelHeight;e._tempPatternMatrix.set(d*y,p*T,f*y,m*T,g*y,b*T),Gc.applyPatternTransform(s,e._tempPatternMatrix),o.fillStyle=s,o.fillRect(z,V,X,H)}else{const e=16777215!==_||O?Gc.getTintedCanvas({texture:u},_):h,t=e!==h;o.drawImage(e,t?0:w,t?0:E,t?e.width:A,t?e.height:C,z,V,X,H)}}}};xm._tempPatternMatrix=new _,xm.extension={type:[e.CanvasPipesAdaptor],name:"batch"};let bm=xm;class ym{constructor(){this._tempState=qn.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,t,r){const n=e.renderer,s=this._didUploadHash[r.uid];n.shader.bind(r,s),s||(this._didUploadHash[r.uid]=!0),n.shader.updateUniformGroup(n.globalUniforms.uniformGroup),n.geometry.bind(t,r.glProgram)}execute(e,t){const r=e.renderer;this._tempState.blendMode=t.blendMode,r.state.set(this._tempState);const n=t.textures.textures;for(let e=0;e<t.textures.count;e++)r.texture.bind(n[e],e);r.texture.unbindIntegerTextures(t.textures.count),r.geometry.draw(t.topology,t.size,t.start)}}function vm(e){const t=[];let r=0;for(let n=0;n<e;n++)t[r]={texture:{sampleType:"float",viewDimension:"2d",multisampled:!1},binding:r,visibility:GPUShaderStage.FRAGMENT},r++,t[r]={sampler:{type:"filtering"},binding:r,visibility:GPUShaderStage.FRAGMENT},r++;return t}function Tm(e){const t={};let r=0;for(let n=0;n<e;n++)t[`textureSource${n+1}`]=r++,t[`textureSampler${n+1}`]=r++;return t}ym.extension={type:[e.WebGLPipesAdaptor],name:"batch"};const Sm=qn.for2d();class wm{start(e,t,r){const n=e.renderer,s=n.encoder,i=r.gpuProgram;this._shader=r,this._geometry=t,s.setGeometry(t,i),Sm.blendMode="normal",n.pipeline.getPipeline(t,i,Sm,void 0,r._overrides);const o=n.globalUniforms.bindGroup;s.resetBindGroup(1),s.setBindGroup(0,o,i)}execute(e,t){const r=this._shader.gpuProgram,n=e.renderer,s=n.encoder;if(!t.bindGroup){const e=t.textures;t.bindGroup=mo(e.textures,e.count,n.limits.maxBatchableTextures)}Sm.blendMode=t.blendMode;const i=n.bindGroup.getBindGroup(t.bindGroup,r,1),o=n.pipeline.getPipeline(this._geometry,r,Sm,t.topology,this._shader._overrides);t.bindGroup._touch(n.gc.now),s.setPipeline(o),s.renderPassEncoder.setBindGroup(1,i),s.renderPassEncoder.drawIndexed(t.size,1,t.start)}}wm.extension={type:[e.WebGPUPipesAdaptor],name:"batch"};const Em=class e{constructor(e,t){this.state=qn.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e,t){return new this._availableBatchers[e]({maxTextures:t})}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new Ma({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(const e in this._activeBatches)this._activeBatches[e].begin()}addToBatch(t,r){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(r);let n=this._activeBatches[t.batcherName];n||(n=this._activeBatches[t.batcherName]=e.getBatcher(t.batcherName,this.renderer.limits.maxBatchableTextures),n.begin()),this._activeBatch=n}this._activeBatch.add(t)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);const t=this._activeBatches;for(const e in t){const r=t[e],n=r.geometry;n.indexBuffer.setDataWithSize(r.indexBuffer,r.indexSize,!0),n.buffers[0].setDataWithSize(r.attributeBuffer.float32View,r.attributeSize,!1)}}upload(e){const t=this._batchersByInstructionSet[e.uid];for(const e in t){const r=t[e],n=r.geometry;r.dirty&&(r.dirty=!1,n.buffers[0].update(4*r.attributeSize))}}execute(e){if("startBatch"===e.action){const t=e.batcher,r=t.geometry,n=t.shader;this._adaptor.start(this,r,n)}this._adaptor.execute(this,e)}destroyInstructionSet(e){const t=this._batchersByInstructionSet[e.uid];if(t){for(const e in t)t[e].destroy();delete this._batchersByInstructionSet[e.uid],this._activeBatches===t&&(this._activeBatches=Object.create(null),this._activeBatch=null)}}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};Em.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"batch"},Em._availableBatchers=Object.create(null);let Am=Em;function Rm(e){const t=e.split(/([\n{}])/g).map(e=>e.trim()).filter(e=>e.length);let r="";const n=t.map(e=>{let t=r+e;return"{"===e?r+=" ":"}"===e&&(r=r.substr(0,r.length-4),t=r+e),t}).join("\n");return n}n.handleByMap(e.Batcher,Am._availableBatchers),n.add(Ma);const Cm={name:"texture-bit",vertex:{header:"\n\n struct TextureUniforms {\n uTextureMatrix:mat3x3<f32>,\n }\n\n @group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;\n ",main:"\n uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;\n "},fragment:{header:"\n @group(2) @binding(0) var uTexture: texture_2d<f32>;\n @group(2) @binding(1) var uSampler: sampler;\n\n\n ",main:"\n outColor = textureSample(uTexture, uSampler, vUV);\n "}},Mm={name:"texture-bit",vertex:{header:"\n uniform mat3 uTextureMatrix;\n ",main:"\n uv = (uTextureMatrix * vec3(uv, 1.0)).xy;\n "},fragment:{header:"\n uniform sampler2D uTexture;\n\n\n ",main:"\n outColor = texture(uTexture, vUV);\n "}},Pm=new ne;class Gm extends Ve{constructor(){super(),this._placeholderSprite=new Ut(ee.EMPTY),this.filters=[new Rd({sprite:this._placeholderSprite,inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].setSprite(e)}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}get channel(){return this.filters[0].channel}set channel(e){this.filters[0].channel=e}reset(){this._placeholderSprite.texture=ee.EMPTY,this.sprite=this._placeholderSprite}}class Bm{constructor(e){this._activeMaskStage=[],this._usedEffects=[],this._renderer=e,e.runners.postrender.add(this)}push(e,t,r){const n=this._renderer;if(n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.channel=t._maskOptions.channel??"red",e.renderMaskToTexture){const t=e.mask;t.includeInBuild=!0,t.collectRenderables(r,n,null),t.includeInBuild=!1}n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){const t=this._renderer,r=e.mask.renderMaskToTexture;if("pushMaskBegin"===e.action){const n=Le.get(Gm);if(n.inverse=e.inverse,n.channel=e.mask.channel,r){e.mask.mask.measurable=!0;const r=Je(e.mask.mask,!0,Pm);e.mask.mask.measurable=!1,r.ceil();const s=t.renderTarget.renderTarget.colorTexture.source,i=wt.getOptimalTexture({width:r.width,height:r.height,resolution:s._resolution,antialias:s.antialias});t.renderTarget.push({target:i,clear:!0}),t.globalUniforms.push({offset:r,worldColor:4294967295});const o=n.sprite;o.texture=i,o.worldTransform.tx=r.minX,o.worldTransform.ty=r.minY,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer,filterTexture:i})}else n.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer})}else if("pushMaskEnd"===e.action){const e=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===Un.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:e.maskedContainer,filterEffect:e.filterEffect,canBundle:!1})}else if("popMaskEnd"===e.action){t.filter.pop();const e=this._activeMaskStage.pop();r&&wt.returnTexture(e.filterTexture),this._usedEffects.push(e.filterEffect)}}postrender(){const e=this._usedEffects;for(let t=0;t<e.length;t++)Le.return(e[t]);e.length=0}destroy(){this.postrender(),this._renderer.runners.postrender.remove(this),this._renderer=null,this._activeMaskStage=null,this._usedEffects=null}}Bm.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"alphaMask"};class Fm{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;const s=this._colorStack[this._colorStackIndex];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;this._colorStackIndex--;const s=n[this._colorStackIndex-1];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(e){}destroy(){this._renderer=null,this._colorStack=null}}Fm.extension={type:[e.CanvasPipes],name:"colorMask"};class Im{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;const s=this._colorStack[this._colorStackIndex];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;this._colorStackIndex--;const s=n[this._colorStackIndex-1];s!==this._currentColor&&(this._currentColor=s,r.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}Im.extension={type:[e.WebGLPipes,e.WebGPUPipes],name:"colorMask"};class Om{constructor(e){this.priority=0,this.pipe="scissorMask",this.mask=e,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(e,t){Lt(this.mask,e,t)}addLocalBounds(e,t){Nt(this.mask,e,t)}containsPoint(e,t){return t(this.mask,e)}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask=null)}destroy(){this.reset()}}function Dm(e,t){switch(t.type){case"rectangle":{const r=t;e.rect(r.x,r.y,r.width,r.height);break}case"roundedRectangle":{const r=t;!function(e,t,r,n,s,i){i=Math.max(0,Math.min(i,Math.min(n,s)/2)),e.moveTo(t+i,r),e.lineTo(t+n-i,r),e.quadraticCurveTo(t+n,r,t+n,r+i),e.lineTo(t+n,r+s-i),e.quadraticCurveTo(t+n,r+s,t+n-i,r+s),e.lineTo(t+i,r+s),e.quadraticCurveTo(t,r+s,t,r+s-i),e.lineTo(t,r+i),e.quadraticCurveTo(t,r,t+i,r)}(e,r.x,r.y,r.width,r.height,r.radius);break}case"circle":{const r=t;e.moveTo(r.x+r.radius,r.y),e.arc(r.x,r.y,r.radius,0,2*Math.PI);break}case"ellipse":{const r=t;e.ellipse?(e.moveTo(r.x+r.halfWidth,r.y),e.ellipse(r.x,r.y,r.halfWidth,r.halfHeight,0,0,2*Math.PI)):(e.save(),e.translate(r.x,r.y),e.scale(r.halfWidth,r.halfHeight),e.moveTo(1,0),e.arc(0,0,1,0,2*Math.PI),e.restore());break}case"triangle":{const r=t;e.moveTo(r.x,r.y),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3),e.closePath();break}default:{const r=t,n=r.points;if(!n?.length)break;e.moveTo(n[0],n[1]);for(let t=2;t<n.length;t+=2)e.lineTo(n[t],n[t+1]);r.closePath&&e.closePath();break}}}function Um(e,t,r){const n=[],s=[],i=[],o=il[t.type];if(!o?.build(t,n))return!1;za(n,r,!1,t.closePath??!0,s,i);for(let t=0;t<i.length;t+=3){const r=2*i[t],n=2*i[t+1],o=2*i[t+2];e.moveTo(s[r],s[r+1]),e.lineTo(s[n],s[n+1]),e.lineTo(s[o],s[o+1]),e.closePath()}return!0}function km(e,t){if(!t?.length)return!1;for(let r=0;r<t.length;r++){const n=t[r];if(!n?.shape)continue;const s=n.transform,i=s&&!s.isIdentity();i&&(e.save(),e.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),Dm(e,n.shape),i&&e.restore()}return!0}class Lm{constructor(e){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){if("pushMaskBegin"!==e.action&&"popMaskEnd"!==e.action)return;const t=this._renderer,r=t.canvasContext,n=r?.activeContext;if(!n)return;if("popMaskEnd"===e.action){return void(this._canvasMaskStack.pop()&&n.restore())}e.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const s=e.mask.mask;if(!(s instanceof Nd))return this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),void this._canvasMaskStack.push(!1);const i=s,o=i.context?.instructions;if(!o?.length)return void this._canvasMaskStack.push(!1);n.save(),r.setContextTransform(i.groupTransform,1===(t._roundPixels|i._roundPixels)),n.beginPath();let a=!1,l=!1;for(let e=0;e<o.length;e++){const t=o[e],r=t.action;if("fill"!==r&&"stroke"!==r)continue;const s=t.data,i=s?.path?.shapePath;if(!i?.shapePrimitives?.length)continue;const u="stroke"===r,h=i.shapePrimitives;for(let e=0;e<h.length;e++){const t=h[e];if(!t?.shape)continue;const r=t.transform,i=r&&!r.isIdentity();i&&(n.save(),n.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)),u&&s.style?a=Um(n,t.shape,s.style)||a:(Dm(n,t.shape),l=km(n,t.holes)||l,a=!0),i&&n.restore()}}if(!a)return n.restore(),void this._canvasMaskStack.push(!1);l?n.clip("evenodd"):n.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(e,t){this._warnedMaskTypes.has(e)||(this._warnedMaskTypes.add(e),Oe(t))}}Lm.extension={type:[e.CanvasPipes],name:"stencilMask"};class Nm{constructor(e){this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){const n=e,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const i=n.mask;i.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});const o=this._maskHash.get(n);o.instructionsStart=r.instructionSize,i.collectRenderables(r,s,null),i.includeInBuild=!1,s.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const a=r.instructionSize-o.instructionsStart-1;o.instructionsLength=a}pop(e,t,r){const n=e,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});const i=this._maskHash.get(e);for(let e=0;e<i.instructionsLength;e++)r.instructions[r.instructionSize++]=r.instructions[i.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){const t=this._renderer,r=t.renderTarget.getGpuRenderTarget(t.renderTarget.renderTarget);let n=r.maskStackIndex;"pushMaskBegin"===e.action?(t.renderTarget.ensureDepthStencil(),t.stencil.setStencilMode(bo.RENDERING_MASK_ADD,n),n++,t.colorMask.setMask(0)):"pushMaskEnd"===e.action?(e.inverse?t.stencil.setStencilMode(bo.INVERSE_MASK_ACTIVE,n):t.stencil.setStencilMode(bo.MASK_ACTIVE,n),t.colorMask.setMask(15)):"popMaskBegin"===e.action?(t.colorMask.setMask(0),0!==n?t.stencil.setStencilMode(bo.RENDERING_MASK_REMOVE,n):(t.renderTarget.clear(null,si.STENCIL),t.stencil.setStencilMode(bo.DISABLED,n)),n--):"popMaskEnd"===e.action&&(e.inverse?t.stencil.setStencilMode(bo.INVERSE_MASK_ACTIVE,n):t.stencil.setStencilMode(bo.MASK_ACTIVE,n),t.colorMask.setMask(15)),r.maskStackIndex=n}destroy(){this._renderer=null,this._maskHash=null}}Nm.extension={type:[e.WebGLPipes,e.WebGPUPipes],name:"stencilMask"};const Xm="source-over";function Hm(){const e=Pc(),t=Object.create(null);return t.inherit=Xm,t.none=Xm,t.normal="source-over",t.add="lighter",t.multiply=e?"multiply":Xm,t.screen=e?"screen":Xm,t.overlay=e?"overlay":Xm,t.darken=e?"darken":Xm,t.lighten=e?"lighten":Xm,t["color-dodge"]=e?"color-dodge":Xm,t["color-burn"]=e?"color-burn":Xm,t["hard-light"]=e?"hard-light":Xm,t["soft-light"]=e?"soft-light":Xm,t.difference=e?"difference":Xm,t.exclusion=e?"exclusion":Xm,t.saturation=e?"saturation":Xm,t.color=e?"color":Xm,t.luminosity=e?"luminosity":Xm,t["linear-burn"]=e?"color-burn":Xm,t["linear-dodge"]=e?"color-dodge":Xm,t["linear-light"]=e?"hard-light":Xm,t["pin-light"]=e?"hard-light":Xm,t["vivid-light"]=e?"hard-light":Xm,t["hard-mix"]=Xm,t.negation=e?"difference":Xm,t["normal-npm"]=t.normal,t["add-npm"]=t.add,t["screen-npm"]=t.screen,t.erase="destination-out",t.subtract=Xm,t.divide=Xm,t.min=Xm,t.max=Xm,t}const zm=new _;class Vm{constructor(e){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=Hm(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=e}resolutionChange(e){this.activeResolution=e}init(){const e=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:e}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const e=this.rootContext;e.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":e.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":e.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":e.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(e,t,r,n){const s=n?_.IDENTITY:this._renderer.globalUniforms.globalUniformData?.worldTransformMatrix||_.IDENTITY;let i=zm;i.copyFrom(s),i.append(e);const o=this._projTransform,a=this.activeResolution;if(r=r||a,o){const e=_.shared;e.copyFrom(i),e.prepend(o),i=e}t?this.activeContext.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*a|0,i.ty*a|0):this.activeContext.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*a,i.ty*a)}clear(e,t){const r=this.activeContext,n=this._renderer;if(r.clearRect(0,0,n.width,n.height),e){const s=Be.shared.setValue(e);r.globalAlpha=t??s.alpha,r.fillStyle=s.toHex(),r.fillRect(0,0,n.width,n.height),r.globalAlpha=1}}setBlendMode(e){if(this._activeBlendMode===e)return;this._activeBlendMode=e,this._outerBlend=!1;const t=this.blendModes[e];if(!t)return this._warnedBlendModes.has(e)||(console.warn(`CanvasRenderer: blend mode "${e}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(e)),void(this.activeContext.globalCompositeOperation="source-over");this.activeContext.globalCompositeOperation=t}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}Vm.extension={type:[e.CanvasSystem],name:"canvasContext"};class Wm{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}Wm.extension={type:[e.CanvasSystem],name:"limits"};class $m{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}function Ym(e,t){const r=e.instructionSet,n=r.instructions;for(let e=0;e<r.instructionSize;e++){const r=n[e];t[r.renderPipeId].execute(r)}}$m.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"customRender"};class jm{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(Le.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){const r=e._batchableRenderGroup??(e._batchableRenderGroup=Le.get(xf));r.renderable=e.root,r.transform=e.root.relativeGroupTransform,r.texture=e.texture,r.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.blendMode.pushBlendMode(e,e.root.groupBlendMode,t),this._renderer.renderPipes.batch.addToBatch(r,t),this._renderer.renderPipes.blendMode.popBlendMode(t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;const t=(new _).translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push({target:e.texture,clear:!0,frame:e.texture.frame}),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295,offset:{x:0,y:0}}),Ym(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),Ym(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}jm.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"renderGroup"};const qm=new _,Km=new _,Zm=new _,Qm=new _,Jm=new _;function eg(e,t,r){e.beginPath();for(let n=0;n<r.length;n+=3){const s=2*r[n],i=2*r[n+1],o=2*r[n+2];e.moveTo(t[s],t[s+1]),e.lineTo(t[i],t[i+1]),e.lineTo(t[o],t[o+1]),e.closePath()}e.fill()}function tg(e,t){switch(t.type){case"rectangle":{const r=t;e.rect(r.x,r.y,r.width,r.height);break}case"roundedRectangle":{const r=t;!function(e,t,r,n,s,i){i=Math.max(0,Math.min(i,Math.min(n,s)/2)),e.moveTo(t+i,r),e.lineTo(t+n-i,r),e.quadraticCurveTo(t+n,r,t+n,r+i),e.lineTo(t+n,r+s-i),e.quadraticCurveTo(t+n,r+s,t+n-i,r+s),e.lineTo(t+i,r+s),e.quadraticCurveTo(t,r+s,t,r+s-i),e.lineTo(t,r+i),e.quadraticCurveTo(t,r,t+i,r)}(e,r.x,r.y,r.width,r.height,r.radius);break}case"circle":{const r=t;e.arc(r.x,r.y,r.radius,0,2*Math.PI);break}case"ellipse":{const r=t;e.ellipse?e.ellipse(r.x,r.y,r.halfWidth,r.halfHeight,0,0,2*Math.PI):(e.save(),e.translate(r.x,r.y),e.scale(r.halfWidth,r.halfHeight),e.arc(0,0,1,0,2*Math.PI),e.restore());break}case"triangle":{const r=t;e.moveTo(r.x,r.y),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3),e.closePath();break}default:{const r=t,n=r.points;if(!n?.length)break;e.moveTo(n[0],n[1]);for(let t=2;t<n.length;t+=2)e.lineTo(n[t],n[t+1]);r.closePath&&e.closePath();break}}}function rg(e,t){if(!t?.length)return!1;for(let r=0;r<t.length;r++){const n=t[r];if(!n?.shape)continue;const s=n.transform,i=s&&!s.isIdentity();i&&(e.save(),e.transform(s.a,s.b,s.c,s.d,s.tx,s.ty)),tg(e,n.shape),i&&e.restore()}return!0}function ng(e,t,r,n){const s=e.fill;if(s instanceof Qa){s.buildGradient();const i=s.texture;if(i){const o=Gc.getTintedPattern(i,t),a=r?Qm.copyFrom(r).scale(i.source.pixelWidth,i.source.pixelHeight):Qm.copyFrom(s.transform);return n&&!e.textureSpace&&a.append(n),Gc.applyPatternTransform(o,a),o}}if(s instanceof Jl){const e=Gc.getTintedPattern(s.texture,t);return Gc.applyPatternTransform(e,s.transform,!1),e}const i=e.texture;if(i&&i!==ee.WHITE){if(!i.source.resource)return"#808080";const n=Gc.getTintedPattern(i,t);let s=e.matrix;if(r){const{resolution:e}=i.source;if(s=Qm.copyFrom(r),i.rotate){const{uvs:t,orig:r}=i;s.prepend(Jm.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0).invert()).scale(r.width*e,r.height*e)}else s.scale(i.source.pixelWidth,i.source.pixelHeight).translate(-i.frame.x*e,-i.frame.y*e)}return Gc.applyPatternTransform(n,s),n}return`#${(16777215&t).toString(16).padStart(6,"0")}`}class sg{constructor(){this.shader=null}contextChange(e){}execute(e,t){const r=e.renderer,n=r.canvasContext,s=n.activeContext,i=t.groupTransform,o=r.globalUniforms.globalUniformData?.worldColor??4294967295,a=t.groupColorAlpha,l=(o>>>24&255)/255*((a>>>24&255)/255)*(r.filter?.alphaMultiplier??1);if(l<=0)return;const u=it(rt(16777215&a,16777215&o)),h=r._roundPixels|t._roundPixels;s.save(),n.setContextTransform(i,1===h),n.setBlendMode(t.groupBlendMode);const c=t.context.instructions;for(let e=0;e<c.length;e++){const t=c[e];if("texture"===t.action){const e=t.data,r=e.image,o=r?Gc.getCanvasSource(r):null;if(!o)continue;const a=e.alpha*l;if(a<=0)continue;const c=rt(e.style,u);s.globalAlpha=a;let d=o;16777215!==c&&(d=Gc.getTintedCanvas({texture:r},c));const p=r.frame,f=r.source._resolution??r.source.resolution??1;let m=p.x*f,g=p.y*f;const _=p.width*f,x=p.height*f;d!==o&&(m=0,g=0);const b=e.transform,y=b&&!b.isIdentity(),v=r.rotate;y||v?(qm.copyFrom(i),y&&qm.append(b),v&&R.matrixAppendRotationInv(qm,v,e.dx,e.dy,e.dw,e.dh),n.setContextTransform(qm,1===h)):n.setContextTransform(i,1===h),s.drawImage(d,m,g,d===o?_:d.width,d===o?x:d.height,v?0:e.dx,v?0:e.dy,e.dw,e.dh),(y||v)&&n.setContextTransform(i,1===h);continue}const r=t.data,o=r?.path?.shapePath;if(!o?.shapePrimitives?.length)continue;const a=r.style,d=rt(a.color,u),p=a.alpha*l;if(p<=0)continue;const f="stroke"===t.action;if(s.globalAlpha=p,f){const e=a;s.lineWidth=e.width,s.lineCap=e.cap,s.lineJoin=e.join,s.miterLimit=e.miterLimit}const m=o.shapePrimitives;if(!f&&r.hole?.shapePath?.shapePrimitives?.length){m[m.length-1].holes=r.hole.shapePath.shapePrimitives}for(let e=0;e<m.length;e++){const t=m[e];if(!t?.shape)continue;const r=t.transform,n=r&&!r.isIdentity(),o=a.texture&&a.texture!==ee.WHITE,l="global"===a.textureSpace?r:null,u=ng(a,d,o?sl(Km,a,t.shape,l):null,n?Zm.copyFrom(i).append(r):i);if(n&&(s.save(),s.transform(r.a,r.b,r.c,r.d,r.tx,r.ty)),f){const e=a;if(.5!==e.alignment&&!e.pixelLine){const r=[],n=[],i=[],o=il[t.shape.type];if(o?.build(t.shape,r)){za(r,e,!1,t.shape.closePath??!0,n,i),s.fillStyle=u,eg(s,n,i)}else s.strokeStyle=u,s.beginPath(),tg(s,t.shape),s.stroke()}else s.strokeStyle=u,s.beginPath(),tg(s,t.shape),s.stroke()}else{s.fillStyle=u,s.beginPath(),tg(s,t.shape);rg(s,t.holes)?s.fill("evenodd"):s.fill()}n&&s.restore()}}s.restore()}destroy(){this.shader=null}}sg.extension={type:[e.CanvasPipesAdaptor],name:"graphics"};class ig{constructor(e){this._renderer=e}addRenderable(e,t){const r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=new xf;return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,t}destroy(){this._renderer=null}}ig.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"sprite"};const og={};n.handle(e.BlendMode,e=>{if(!e.name)throw new Error("BlendMode extension must have a name property");og[e.name]=e.ref},e=>{delete og[e.name]});class ag{constructor(e){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(e,t,r){this._blendModeStack.push(t),this.setBlendMode(e,t,r)}popBlendMode(e){this._blendModeStack.pop();const t=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,t,e)}setBlendMode(e,t,r){const n=e instanceof Et;this._activeBlendMode!==t?(this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=t,e&&(this._isAdvanced=!!og[t],this._isAdvanced&&this._beginAdvancedBlendMode(e,r))):this._isAdvanced&&e&&!n&&this._renderableList?.push(e)}_beginAdvancedBlendMode(e,t){this._renderer.renderPipes.batch.break(t);const r=this._activeBlendMode;if(!og[r])return void Oe(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);const n=this._ensureFilterEffect(r),s=e instanceof Et,i={renderPipeId:"filter",action:"pushFilter",filterEffect:n,renderables:s?null:[e],container:s?e.root:null,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_ensureFilterEffect(e){let t=this._filterHash[e];return t||(t=this._filterHash[e]=new Ve,t.filters=[new og[e]]),t}_endAdvancedBlendMode(e){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(const e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}function lg(e,t){t||(t=0);for(let r=t;r<e.length&&e[r];r++)e[r]=null}ag.extension={type:[e.WebGLPipes,e.WebGPUPipes,e.CanvasPipes],name:"blendMode"};const ug=new Ot;function hg(e,t=!1){cg(e);const r=e.childrenToUpdate,n=e.updateTick++;for(const t in r){const s=Number(t),i=r[t],o=i.list,a=i.index;for(let t=0;t<a;t++){const r=o[t];r.parentRenderGroup===e&&r.relativeRenderGroupDepth===s&&dg(r,n,0)}lg(o,a),i.index=0}if(t)for(let r=0;r<e.renderGroupChildren.length;r++)hg(e.renderGroupChildren[r],t)}function cg(e){const t=e.root;let r;if(e.renderGroupParent){const n=e.renderGroupParent;e.worldTransform.appendFrom(t.relativeGroupTransform,n.worldTransform),e.worldColor=st(t.groupColor,n.worldColor),r=t.groupAlpha*n.worldAlpha}else e.worldTransform.copyFrom(t.localTransform),e.worldColor=t.localColor,r=t.localAlpha;r=r<0?0:r>1?1:r,e.worldAlpha=r,e.worldColorAlpha=e.worldColor+(255*r<<24)}function dg(e,t,r){if(t===e.updateTick)return;e.updateTick=t,e.didChange=!1;const n=e.localTransform;e.updateLocalTransform();const s=e.parent;if(s&&!s.renderGroup?(r|=e._updateFlags,e.relativeGroupTransform.appendFrom(n,s.relativeGroupTransform),7&r&&pg(e,s,r)):(r=e._updateFlags,e.relativeGroupTransform.copyFrom(n),7&r&&pg(e,ug,r)),!e.renderGroup){const n=e.children,s=n.length;for(let e=0;e<s;e++)dg(n[e],t,r);const i=e.parentRenderGroup,o=e;o.renderPipeId&&!i.structureDidChange&&i.updateRenderable(o)}}function pg(e,t,r){if(1&r){e.groupColor=st(e.localColor,t.groupColor);let r=e.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,e.groupAlpha=r,e.groupColorAlpha=e.groupColor+(255*r<<24)}2&r&&(e.groupBlendMode="inherit"===e.localBlendMode?t.groupBlendMode:e.localBlendMode),4&r&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}function fg(e,t){const{list:r}=e.childrenRenderablesToUpdate;let n=!1;for(let s=0;s<e.childrenRenderablesToUpdate.index;s++){const e=r[s];if(n=t[e.renderPipeId].validateRenderable(e),n)break}return e.structureDidChange=n,n}const mg=new _;class gg{constructor(e){this._renderer=e}render({container:e,transform:t}){const r=e.parent,n=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;const s=this._renderer,i=mg;t&&(i.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));const o=s.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),s.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),Ym(e.renderGroup,o),o.uniformBatch&&o.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(i),e.parent=r,e.renderGroup.renderGroupParent=n}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e._parentCacheAsTextureRenderGroup=t,e.isCachedAsTexture){if(!e.textureNeedsUpdate)return;t=e}for(let r=e.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){const t=e.root.getLocalBounds(),r=this._renderer,n=e.textureOptions.resolution||r.view.resolution,s=e.textureOptions.antialias??r.view.antialias,i=e.textureOptions.scaleMode??"linear",o=e.texture;t.ceil(),e.texture&&wt.returnTexture(e.texture);const a=wt.getOptimalTexture({width:t.width,height:t.height,resolution:n,antialias:s,scaleMode:i});e.texture=a,e._textureBounds||(e._textureBounds=new ne),e._textureBounds.copyFrom(t),o!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(wt.returnTexture(e.texture),e.texture=null)}_updateRenderGroups(e){const t=this._renderer,r=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=r,e.structureDidChange?lg(e.childrenRenderablesToUpdate.list,0):fg(e,r),hg(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!e.isCachedAsTexture||e.textureNeedsUpdate)for(let t=0;t<e.renderGroupChildren.length;t++)this._updateRenderGroups(e.renderGroupChildren[t])}_updateRenderables(e){const{list:t,index:r}=e.childrenRenderablesToUpdate;for(let n=0;n<r;n++){const r=t[n];r.didViewUpdate&&e.updateRenderable(r)}lg(t,r)}_buildInstructions(e,t){const r=e.root,n=e.instructionSet;n.reset();const s=t.renderPipes?t:t.batch.renderer,i=s.renderPipes;i.batch.buildStart(n),i.blendMode.buildStart(),i.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(n,s,null),i.batch.buildEnd(n),i.blendMode.buildEnd(n)}}gg.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"renderGroup"};const _g=class e{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Be(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...e.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){Be.shared.setValue(e).alpha<1&&1===this._backgroundColor.alpha&&Oe("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};_g.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"background",priority:0},_g.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let xg=_g;const bg={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},yg=class e{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof Ot||e instanceof ee?{target:e,...t}:{...t,...e}}async image(e){const t=Yt.get().createImage();return t.src=await this.base64(e),t}async base64(t){t=this._normalizeOptions(t,e.defaultImageOptions);const{format:r,quality:n}=t,s=this.canvas(t);if(void 0!==s.toBlob)return new Promise((e,t)=>{s.toBlob(r=>{if(!r)return void t(new Error("ICanvas.toBlob failed!"));const n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)},bg[r],n)});if(void 0!==s.toDataURL)return s.toDataURL(bg[r],n);if(void 0!==s.convertToBlob){const e=await s.convertToBlob({type:bg[r],quality:n});return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){const t=(e=this._normalizeOptions(e)).target,r=this._renderer;if(t instanceof ee)return r.texture.generateCanvas(t);const n=r.textureGenerator.generateTexture(e),s=r.texture.generateCanvas(n);return n.destroy(!0),s}pixels(e){const t=(e=this._normalizeOptions(e)).target,r=this._renderer,n=t instanceof ee?t:r.textureGenerator.generateTexture(e),s=r.texture.getPixels(n);return t instanceof Ot&&n.destroy(!0),s}texture(e){return(e=this._normalizeOptions(e)).target instanceof ee?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);const t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){const t=e.width??200;e=this._normalizeOptions(e);const r=this.canvas(e),n=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);const s=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}};yg.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"extract"},yg.defaultImageOptions={format:"png",quality:1};let vg=yg;class Tg extends ee{static create(e){const{dynamic:t,textureOptions:r,...n}=e;return new Tg({...r,source:new K(n),dynamic:t??!1})}resize(e,t,r){return this.source.resize(e,t,r),this}}const Sg=new M,wg=new ne,Eg=[0,0,0,0];class Ag{constructor(e){this._renderer=e}generateTexture(e){e instanceof Ot&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});const t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,n=e.target;let s=e.clearColor;if(s){s=Array.isArray(s)&&4===s.length?s:Be.shared.setValue(s).toArray()}else s=Eg;const i=e.frame?.copyTo(Sg)||at(n,wg).rectangle,o=e.defaultAnchor&&{defaultAnchor:e.defaultAnchor};i.width=0|Math.max(i.width,1/t),i.height=0|Math.max(i.height,1/t);const a=Tg.create({...e.textureSourceOptions,width:i.width,height:i.height,resolution:t,antialias:r,textureOptions:o}),l=_.shared.translate(-i.x,-i.y);return this._renderer.render({container:n,transform:l,target:a,clearColor:s}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}}function Rg(e){let t=!1;for(const r in e)if(null==e[r]){t=!0;break}if(!t)return e;const r=Object.create(null);for(const t in e){const n=e[t];n&&(r[t]=n)}return r}function Cg(e){let t=0;for(let r=0;r<e.length;r++)null==e[r]?t++:e[r-t]=e[r];return e.length-=t,e}Ag.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"textureGenerator"};const Mg=class e{constructor(e){this._managedResources=[],this._managedResourceHashes=[],this._managedCollections=[],this._ready=!1,this._running=!1,this._renderer=e}init(t){t={...e.defaultOptions,...t},this.maxUnusedTime=t.gcMaxUnusedTime,this._frequency=t.gcFrequency,this.enabled=t.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>{this._ready=!0},this._frequency,!1),this._collectionsHandler=this._renderer.scheduler.repeat(()=>{for(const e of this._managedCollections){const{context:t,collection:r,type:n}=e;t[r]="hash"===n?Rg(t[r]):Cg(t[r])}},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._collectionsHandler),this._handler=0,this._collectionsHandler=0))}prerender({container:e}){this.now=performance.now(),e.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}postrender(){this._ready&&this.enabled&&(this.run(),this._ready=!1)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t,e.gcTick=t;for(const r of e.renderGroupChildren)this._updateInstructionGCTick(r,t)}addCollection(e,t,r){this._managedCollections.push({context:e,collection:t,type:r})}addResource(e,t){if(-1!==e._gcLastUsed)return e._gcLastUsed=this.now,void e._onTouch?.(this.now);const r=this._managedResources.length;e._gcData={index:r,type:t},e._gcLastUsed=this.now,e._onTouch?.(this.now),e.once("unload",this.removeResource,this),this._managedResources.push(e)}removeResource(e){const t=e._gcData;if(!t)return;const r=t.index,n=this._managedResources.length-1;if(this._running)this._managedResources[r]=null;else{if(r!==n){const e=this._managedResources[n];this._managedResources[r]=e,e._gcData.index=r}this._managedResources.length--}e._gcData=null,e._gcLastUsed=-1}addResourceHash(e,t,r,n=0){this._managedResourceHashes.push({context:e,hash:t,type:r,priority:n}),this._managedResourceHashes.sort((e,t)=>e.priority-t.priority)}run(){if(this._running)return;const e=performance.now(),t=this._managedResourceHashes,r=this._managedResources;this._running=!0;try{for(const r of t)this.runOnHash(r,e);const n=r.length;for(let t=0;t<n;t++){const n=r[t];n&&this.runOnResource(n,e)}}finally{let e=0;for(let t=0;t<r.length;t++){const n=r[t];n&&(e!==t&&(r[e]=n,n._gcData.index=e),e++)}r.length=e,this._running=!1}}updateRenderableGCTick(e,t){const r=e.renderGroup??e.parentRenderGroup,n=r?.instructionSet?.gcTick??-1;(r?.gcTick??0)===n&&(e._gcLastUsed=t,e._onTouch?.(t))}runOnResource(e,t){"renderable"===e._gcData.type&&this.updateRenderableGCTick(e,t);!(t-e._gcLastUsed<this.maxUnusedTime)&&e.autoGarbageCollect&&(e.off("unload",this.removeResource,this),e.unload(),this.removeResource(e))}_createHashClone(e,t){const r=Object.create(null);for(const n in e){if(n===t)break;null!==e[n]&&(r[n]=e[n])}return r}runOnHash(e,t){const{context:r,hash:n,type:s}=e,i=r[n];let o=null,a=0;for(const e in i){const r=i[e];if(null===r){a++,1e4!==a||o||(o=this._createHashClone(i,e));continue}if(-1===r._gcLastUsed){r._gcLastUsed=t,r._onTouch?.(t),o&&(o[e]=r);continue}"renderable"===s&&this.updateRenderableGCTick(r,t);if(!(t-r._gcLastUsed<this.maxUnusedTime)&&r.autoGarbageCollect){if("renderable"===s){const e=r,t=e.renderGroup??e.parentRenderGroup;t&&(t.structureDidChange=!0)}r.unload(),r._gcData=null,r._gcLastUsed=-1,o||(a+1!==1e4?(i[e]=null,a++):o=this._createHashClone(i,e))}else o&&(o[e]=r)}o&&(r[n]=o)}destroy(){this.enabled=!1,this._managedResources.forEach(e=>{e?.off("unload",this.removeResource,this)}),this._managedResources.length=0,this._managedResourceHashes.length=0,this._managedCollections.length=0,this._renderer=null}};Mg.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"gc",priority:0},Mg.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};let Pg=Mg;class Gg{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:r,worldColor:n,offset:s}){const i=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{worldTransformMatrix:new _,worldColor:4294967295,offset:new m},a={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||i.size,worldTransformMatrix:r||o.worldTransformMatrix,worldColor:n||o.worldColor,offset:s||o.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const u=l.uniforms;let h;u.uProjectionMatrix=a.projectionMatrix,u.uResolution=a.resolution,u.uWorldTransformMatrix.copyFrom(a.worldTransformMatrix),u.uWorldTransformMatrix.tx-=a.offset.x,u.uWorldTransformMatrix.ty-=a.offset.y,Ud(a.worldColor,u.uWorldColorAlpha,0),l.update(),this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(h=this._bindGroupPool.pop()||new Dn,this._activeBindGroups.push(h),h.setResource(l,0)),a.bindGroup=h,this._currentGlobalUniformData=a}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Un.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new On({uProjectionMatrix:{value:new _,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new _,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}}Gg.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"globalUniforms"};let Bg=1;class Fg{constructor(){this._tasks=[],this._offset=0}init(){er.system.add(this._update,this)}repeat(e,t,r=!0){const n=Bg++;let s=0;return r&&(this._offset+=1e3,s=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:s,last:performance.now(),repeat:!0,id:n}),n}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e)return void this._tasks.splice(t,1)}_update(){const e=performance.now();for(let t=0;t<this._tasks.length;t++){const r=this._tasks[t];if(e-r.offset-r.last>=r.duration){const t=e-r.start;r.func(t),r.last=e}}}destroy(){er.system.remove(this._update,this),this._tasks.length=0}}Fg.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"scheduler",priority:0};let Ig=!1;function Og(e){if(!Ig){if(Yt.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${gi} (${e}) http://www.pixijs.com/\n\n`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${gi} - ${e} - http://www.pixijs.com/`);Ig=!0}}class Dg{constructor(e){this._renderer=e}init(e){if(e.hello){let e=this._renderer.name;this._renderer.type===Un.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),Og(e)}}}Dg.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"hello",priority:-2},Dg.defaultOptions={hello:!1};const Ug=class e{constructor(e){this._renderer=e}init(t){t={...e.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime}get enabled(){return L("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled}set enabled(e){L("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled=e}addManagedHash(e,t){L("8.15.0","RenderableGCSystem.addManagedHash is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"hash")}addManagedArray(e,t){L("8.15.0","RenderableGCSystem.addManagedArray is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"array")}addRenderable(e){L("8.15.0","RenderableGCSystem.addRenderable is deprecated, please use the GCSystem instead."),this._renderer.gc.addResource(e,"renderable")}run(){L("8.15.0","RenderableGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};Ug.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"renderableGC",priority:0},Ug.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let kg=Ug;const Lg=class e{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(e){L("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=e}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(e){L("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=e/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(e){L("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(e){L("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=e}constructor(e){this._renderer=e,this._checkCount=0}init(t){t.textureGCActive!==e.defaultOptions.textureGCActive&&(this.active=t.textureGCActive),t.textureGCMaxIdle!==e.defaultOptions.textureGCMaxIdle&&(this.maxIdle=t.textureGCMaxIdle),t.textureGCCheckCountMax!==e.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=t.textureGCCheckCountMax)}run(){L("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};Lg.extension={type:[e.WebGLSystem,e.WebGPUSystem],name:"textureGC"},Lg.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let Ng=Lg;const Xg=class e extends c{constructor(e={}){super(),this.uid=G("renderTarget"),this.colorAttachments=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,this._depth=!1,this._stencil=!1,this._colorTextures=null;const t="colorAttachments"in e?e:this._normalizeOptions(e);if(this.isRoot=t.isRoot??!1,this.label=t.label,this.colorAttachments=t.colorAttachments,this.depthStencilAttachment=t.depthStencilAttachment,this.depthStencilAttachment){const e=this.depthStencilAttachment.texture.format;this._depth||(this._depth=e.includes("depth")),this._stencil||(this._stencil=e.includes("stencil"))}if(0===this.colorAttachments.length&&!this.depthStencilAttachment)throw new Error("[RenderTarget] no color textures or depth textures were provided. Provide a depthStencilTexture or set depth/stencil to true when using colorTextures: 0.");if(this.colorAttachments.length>0){const e=this.colorTexture;this.resize(e.width,e.height,e._resolution)}this.sizeSource&&this.sizeSource.on("resize",this.onSourceResize,this)}_normalizeOptions(t){const r={...e.defaultOptions,...t},n=[];let s;if("number"==typeof r.colorTextures){if(r.colorTextures>0){this._managedColorTextures=!0;for(let e=0;e<r.colorTextures;e++)n.push({texture:new K({width:r.width,height:r.height,resolution:r.resolution,antialias:r.antialias}),loadOp:"clear",storeOp:"store"})}}else r.colorTextures.forEach(e=>{n.push({texture:e.source,loadOp:"clear",storeOp:"store"})});const i=!0===r.depthStencilTexture;if(this._depth=!(!r.depth&&!i),this._stencil=!(!r.stencil&&!i),r.depthStencilTexture instanceof ee||r.depthStencilTexture instanceof K){if(r.isRoot)throw new Error("[RenderTarget] cannot attach a depth-stencil texture to the screen — the canvas owns its own depth/stencil buffers. Render to a texture target instead.");s={texture:r.depthStencilTexture.source}}else(i&&!r.isRoot||(r.stencil||r.depth)&&0===n.length)&&(s=this._createDepthStencilTexture(r.width,r.height,r.resolution));return{colorAttachments:n,depthStencilAttachment:s,isRoot:r.isRoot,label:r.label}}get size(){const e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.sizeSource.width}get height(){return this.sizeSource.height}get pixelWidth(){return this.sizeSource.pixelWidth}get pixelHeight(){return this.sizeSource.pixelHeight}get resolution(){return this.sizeSource._resolution}get colorTextures(){return this._colorTextures||(this._colorTextures=this.colorAttachments.map(e=>e.texture)),this._colorTextures}get depthStencilTexture(){return this.depthStencilAttachment?.texture??null}get depth(){return this._depth}get stencil(){return this._stencil}get colorTexture(){return this.colorAttachments[0]?.texture}get sizeSource(){return this.colorAttachments[0]?.texture??this.depthStencilAttachment?.texture}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this._createDepthStencilTexture(this.sizeSource.width,this.sizeSource.height,this.sizeSource._resolution),this._depth=!0,this._stencil=!0}resize(e,t,r=this.resolution,n=!1){if(this.dirtyId++,this.colorAttachments.forEach((s,i)=>{n&&0===i||s.texture.resize(e,t,r)}),this.depthStencilAttachment){if(n&&0===this.colorAttachments.length)return;this.depthStencilAttachment.texture.resize(e,t,r)}}destroy(){(this.colorAttachments||this.depthStencilAttachment)&&(this.emit("destroy",this),this.sizeSource.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorAttachments.forEach(e=>{e.texture.destroy()}),this.depthStencilAttachment&&(this.depthStencilAttachment.texture.destroy(),delete this.depthStencilAttachment),this.colorAttachments=null,this._colorTextures=null,this.removeAllListeners())}_createDepthStencilTexture(e,t,r){return this.depthStencilAttachment??(this.depthStencilAttachment={texture:new K({width:e,height:t,resolution:r,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1})}),this.depthStencilAttachment}};Xg.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let Hg=Xg;const zg=new Map;function Vg(e,t){if(!zg.has(e)){const r=new ee({source:new jt({resource:e,...t})}),n=()=>{zg.get(e)===r&&zg.delete(e)};r.once("destroy",n),r.source.once("destroy",n),zg.set(e,r)}return zg.get(e)}function Wg(e){return zg.has(e)}De.register(zg);const $g=class e{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}constructor(e){this._renderer=e}init(t){(t={...e.defaultOptions,...t}).view&&(L(I,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new M(0,0,t.width,t.height),this.canvas=t.canvas||Yt.get().createCanvas(),this.antialias=!!t.antialias;const{depth:r,...n}=t;this.texture=Vg(this.canvas,n),this.renderTarget=new Hg({colorTextures:[this.texture],depth:!!r,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.texture.source.on("resize",this._updateScreenSize,this),this.resolution=t.resolution,this._updateScreenSize()}resize(e,t,r){this.texture.source.resize(e,t,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){("boolean"==typeof e?e:!!e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.source.off("resize",this._updateScreenSize,this),wt.removeScreen(this._renderer.uid),Oc.removeScreen(this._renderer.uid),this.texture.destroy()}_updateScreenSize(){const{pixelWidth:e,pixelHeight:t}=this.texture.source,r=this._renderer.uid;wt.setScreenSize(r,e,t),Oc.setScreenSize(r,e,t)}};$g.extension={type:[e.WebGLSystem,e.WebGPUSystem,e.CanvasSystem],name:"view",priority:0},$g.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let Yg=$g;const jg=[xg,Gg,Dg,Yg,gg,Pg,Ng,Ag,vg,xi,kg,Fg],qg=[ag,Am,ig,jm,Bm,Nm,Im,$m];function Kg(e,t,r,n,s,i){const o=i?1:-1;return e.identity(),e.a=1/n*2,e.d=o*(1/s*2),e.tx=-1-t*e.a,e.ty=-o-r*e.d,e}function Zg(e){if(0===e.colorAttachments.length)return!1;const t=e.colorTexture.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}class Qg{constructor(e){this.rootViewPort=new M,this.viewport=new M,this.onRenderTargetChange=new ii("onRenderTargetChange"),this.projectionMatrix=new _,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._bindState={target:null,frame:void 0,mipLevel:0,layer:0,flipY:!1},this._bindFrame=new M,this._renderer=e,e.gc.addCollection(this,"_gpuRenderTargetHash","hash")}get renderSurface(){return this._bindState.target}get mipLevel(){return this._bindState.mipLevel}get layer(){return this._bindState.layer}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart(e){this._renderTargetStack.length=0,this.push(e),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Zg(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!0,r,n,s=0,i=0,o){let a;"target"in e?a=e:(L("8.20.0","RenderTargetSystem.bind: positional arguments are deprecated, please use an options object instead: bind({ target, clear, clearColor, frame, mipLevel, layer, flipY })"),a={target:e,clear:t,clearColor:r,frame:n,mipLevel:s,layer:i,flipY:o});const l=a.target;t=a.clear??!0,r=a.clearColor,s=0|(a.mipLevel??0),i=0|(a.layer??0),o=a.flipY,n=a.frame;const u=this.getRenderTarget(l),h=this.renderTarget!==u||!!u.flipY!=!!o;this.renderTarget=u;const c=this.getGpuRenderTarget(u);u.pixelWidth===c.width&&u.pixelHeight===c.height||(this.adaptor.resizeGpuRenderTarget(u),c.width=u.pixelWidth,c.height=u.pixelHeight);const d=u.colorAttachments[0]?.texture||u.depthStencilAttachment?.texture,p=this.viewport,f="3d"===d.dimension?Math.max(d.depth>>s,1):d.depthOrArrayLayers;if(i<0||i>=f)throw new Error(`[RenderTargetSystem] layer ${i} is out of bounds (layer count=${f}).`);const m=this._bindState;m.target=l,m.frame=n?this._bindFrame.copyFrom(n):void 0,m.mipLevel=s,m.layer=i,m.flipY=o;const g=Math.max(d.pixelWidth>>s,1),_=Math.max(d.pixelHeight>>s,1);if(!n&&l instanceof ee&&(n=l.frame),n){const e=d._resolution,t=1<<Math.max(s,0),r=n.x*e+.5|0,i=n.y*e+.5|0,o=n.width*e+.5|0,a=n.height*e+.5|0;let l=Math.floor(r/t),u=Math.floor(i/t),h=Math.ceil(o/t),c=Math.ceil(a/t);l<0&&(h+=l,l=0),u<0&&(c+=u,u=0),l=Math.min(l,g-1),u=Math.min(u,_-1),h=Math.min(h,g-l),c=Math.min(c,_-u),h=Math.max(h,1),c=Math.max(c,1),p.x=l,p.y=u,p.width=h,p.height=c}else p.x=0,p.y=0,p.width=g,p.height=_;return u.flipY=o,Kg(this.projectionMatrix,0,0,p.width/d.resolution,p.height/d.resolution,!u.isRoot!=!!u.flipY),this.adaptor.startRenderPass(u,t,r,p,s,i),h&&this.onRenderTargetChange.emit(u),u}getBindState(e){if(!this.renderTarget)throw new Error("[RenderTargetSystem] getBindState is only valid while a render surface is bound");const t=this._bindState;return e??(e={}),e.target=t.target,e.clear=si.NONE,e.clearColor=void 0,t.frame?e.frame?e.frame.copyFrom(t.frame):e.frame=t.frame.clone():e.frame=void 0,e.mipLevel=t.mipLevel,e.layer=t.layer,e.flipY=!!t.flipY,e}isFrontFaceInverted(e,t){if(!e){if(!(e=this.renderTarget))return!1;t=e.flipY}return!!t!=(this._renderer.type===Un.WEBGL&&!e.isRoot)}get frontFaceInverted(){return L(D,"RenderTargetSystem.frontFaceInverted is deprecated, use isFrontFaceInverted() instead"),this.isFrontFaceInverted()}clear(e,t=si.ALL,r,n=this.mipLevel,s=this.layer){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport,n,s))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=si.ALL,r,n,s=0,i=0,o){let a;"target"in e?a=e:(L("8.20.0","RenderTargetSystem.push: positional arguments are deprecated, please use an options object instead: push({ target, clear, clearColor, frame, mipLevel, layer, flipY })"),a={target:e,clear:t,clearColor:r,frame:n,mipLevel:s,layer:i,flipY:o});const l=this.bind(a);return this._renderTargetStack.push({target:a.target,clear:!1,clearColor:void 0,frame:a.frame?a.frame.clone():void 0,mipLevel:a.mipLevel,layer:a.layer,flipY:a.flipY}),l}pop(){this._renderTargetStack.pop();const e=this._renderTargetStack[this._renderTargetStack.length-1];if(!e)throw new Error("[RenderTargetSystem] pop: no previous binding to restore (unbalanced pop)");return this.bind(e)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,n,s){const i=this.getRenderTarget(e);r.x<0&&(n.width+=r.x,s.x-=r.x,r.x=0),r.y<0&&(n.height+=r.y,s.y-=r.y,r.y=0);const{pixelWidth:o,pixelHeight:a}=i;return n.width=Math.min(n.width,o-r.x),n.height=Math.min(n.height,a-r.y),this.adaptor.copyToTexture(i,t,r,n,s)}copyDepthTexture(e,t,r,n,s={x:0,y:0}){const i=this.getRenderTarget(e);if(!i.depthStencilAttachment)return void Oe("[RenderTargetSystem] copyDepthTexture: the source render target has no depth attachment to copy from");const o=t.source;if(!o.format.includes("depth")&&!o.format.includes("stencil"))return void Oe(`[RenderTargetSystem] copyDepthTexture: the destination texture must have a depth/stencil format (got '${o.format}')`);let a=r.x,l=r.y,u=s.x,h=s.y,c=n.width,d=n.height;a<0&&(c+=a,u-=a,a=0),l<0&&(d+=l,h-=l,l=0),c=Math.min(c,i.pixelWidth-a),d=Math.min(d,i.pixelHeight-l),c=Math.min(c,o.pixelWidth-u),d=Math.min(d,o.pixelHeight-h),c<=0||d<=0||this.adaptor.copyDepthTexture(i,t,{x:a,y:l},{width:c,height:d},{x:u,y:h})}ensureDepthStencil(){if(!this.renderTarget.stencil){if(this.renderTarget.depthStencilTexture)return void Oe(`[RenderTargetSystem] a stencil mask is being used, but the render target's depthStencilTexture format '${this.renderTarget.depthStencilTexture.format}' has no stencil aspect, so masking cannot work here. Use a 'depth24plus-stencil8' texture instead.`);this.renderTarget._depth=!0,this.renderTarget._stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport,0,this.layer)}}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t?this._releaseRenderTarget(t,e):e.off("destroy",this._onRenderTargetDestroy,this)}),this._renderSurfaceToRenderTargetHash.clear();for(const e of Object.values(this._gpuRenderTargetHash))e&&this.adaptor.destroyGpuRenderTarget(e);this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;if(jt.test(e)&&(e=Vg(e).source),e instanceof Hg)t=e,e.once("destroy",this._onRenderTargetDestroy,this);else if(e instanceof K){const r=e.format,n=r.includes("depth")||r.includes("stencil");t=new Hg(n?{colorTextures:0,depthStencilTexture:e}:{colorTextures:[e]}),e.source instanceof jt&&(t.isRoot=!0),e.once("destroy",this._onRenderSurfaceDestroy,this)}return this._renderSurfaceToRenderTargetHash.set(e,t),t}_onRenderSurfaceDestroy(e){const t=this._renderSurfaceToRenderTargetHash.get(e);t&&this._releaseRenderTarget(e,t)}_onRenderTargetDestroy(e){this._renderSurfaceToRenderTargetHash.delete(e),this._releaseGpuRenderTarget(e)}_releaseRenderTarget(e,t){t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e),e.off("destroy",this._onRenderSurfaceDestroy,this),this._releaseGpuRenderTarget(t)}_releaseGpuRenderTarget(e){const t=this._gpuRenderTargetHash[e.uid];t&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(t))}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this._bindState.target=null}}class Jg{init(e,t){this._renderer=e,this._renderTargetSystem=t}initGpuRenderTarget(e){const t=e.colorTexture,{canvas:r,context:n}=this._ensureCanvas(t);return{canvas:r,context:n,width:r.width,height:r.height}}resizeGpuRenderTarget(e){const t=e.colorTexture,{canvas:r}=this._ensureCanvas(t);r.width=e.pixelWidth,r.height=e.pixelHeight}startRenderPass(e,t,r,n){const s=this._renderTargetSystem.getGpuRenderTarget(e);this._renderer.canvasContext.activeContext=s.context,this._renderer.canvasContext.activeResolution=e.resolution,t&&this.clear(e,t,r,n)}clear(e,t,r,n){const s=this._renderTargetSystem.getGpuRenderTarget(e).context,i=n||{x:0,y:0,width:e.pixelWidth,height:e.pixelHeight};if(s.setTransform(1,0,0,1,0,0),s.clearRect(i.x,i.y,i.width,i.height),r){const e=Be.shared.setValue(r);e.alpha>0&&(s.globalAlpha=e.alpha,s.fillStyle=e.toHex(),s.fillRect(i.x,i.y,i.width,i.height),s.globalAlpha=1)}}finishRenderPass(){}copyToTexture(e,t,r,n,s){const i=this._renderTargetSystem.getGpuRenderTarget(e).canvas,o=t.source,{context:a}=this._ensureCanvas(o),l=s?.x??0,u=s?.y??0;return a.drawImage(i,r.x,r.y,n.width,n.height,l,u,n.width,n.height),o.update(),t}copyDepthTexture(e,t,r,n,s){Oe("[CanvasRenderTargetAdaptor] copyDepthTexture is not supported in the canvas renderer")}destroyGpuRenderTarget(e){}_ensureCanvas(e){let t=e.resource;t&&jt.test(t)||(t=Yt.get().createCanvas(e.pixelWidth,e.pixelHeight),e.resource=t),t.width===e.pixelWidth&&t.height===e.pixelHeight||(t.width=e.pixelWidth,t.height=e.pixelHeight);const r=t.getContext("2d");return{canvas:t,context:r}}}class e_ extends Qg{constructor(e){super(e),this.adaptor=new Jg,this.adaptor.init(e,this)}}e_.extension={type:[e.CanvasSystem],name:"renderTarget"};class t_{constructor(e){}init(){}initSource(e){}generateCanvas(e){const t=Yt.get().createCanvas(),r=t.getContext("2d"),n=Gc.getCanvasSource(e);if(!n)return t;const s=e.frame,i=e.source._resolution??e.source.resolution??1,o=s.x*i,a=s.y*i,l=s.width*i,u=s.height*i;return t.width=Math.ceil(l),t.height=Math.ceil(u),r.drawImage(n,o,a,l,u,0,0,l,u),t}getPixels(e){const t=this.generateCanvas(e);return{pixels:t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}destroy(){}}t_.extension={type:[e.CanvasSystem],name:"texture"};const r_=[...jg,Vm,Wm,t_,e_],n_=[ag,Am,ig,jm,Bm,Lm,Fm,$m],s_=[bm,sg],i_=[],o_=[],a_=[],l_=[];n.handleByNamedList(e.CanvasSystem,i_),n.handleByNamedList(e.CanvasPipes,o_),n.handleByNamedList(e.CanvasPipesAdaptor,a_),n.handleByNamedList(e.CanvasLoader,l_),n.add(...r_,...n_,...s_);class u_ extends hi{constructor(){super({name:"canvas",type:Un.CANVAS,systems:i_,renderPipes:o_,renderPipeAdaptors:a_,loaders:l_})}}var h_=Object.freeze({__proto__:null,CanvasRenderer:u_}),c_=(e=>(e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e))(c_||{});class d_{constructor(e,t){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=t}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class p_{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new Pa({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:t}=this,r=this.getGlBuffer(e);t.bindBuffer(r.type,r.buffer)}bindBufferBase(e,t){const{_gl:r}=this;this._boundBufferBases[t]!==e&&(this._boundBufferBases[t]=e,e._lastBindBaseLocation=t,r.bindBufferBase(r.UNIFORM_BUFFER,t,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let t=this.getLastBindBaseLocation(e);if(t>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,t;let r=0,n=this._nextBindBaseIndex;for(;r<2;){n>=this._maxBindings&&(n=this._minBaseLocation,r++);const e=this._boundBufferBases[n];if(!e||e._lastBindCallId!==this._bindCallId)break;n++}return t=n,this._nextBindBaseIndex=n+1,r>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[t]=null,t)}getLastBindBaseLocation(e){const t=e._lastBindBaseLocation;return this._boundBufferBases[t]===e?t:-1}bindBufferRange(e,t,r,n){const{_gl:s}=this;r||(r=0),t||(t=0),this._boundBufferBases[t]=null,s.bindBufferRange(s.UNIFORM_BUFFER,t||0,e.buffer,256*r,n||256)}updateBuffer(e){const{_gl:t}=this,r=this.getGlBuffer(e);if(e._updateID===r.updateID)return r;r.updateID=e._updateID,t.bindBuffer(r.type,r.buffer);const n=e.data,s=e.descriptor.usage&Oo.STATIC?t.STATIC_DRAW:t.DYNAMIC_DRAW;return n?r.byteLength>=n.byteLength?t.bufferSubData(r.type,e._updateOffset,n,e._updateOffset/n.BYTES_PER_ELEMENT,(e._updateSize||n.byteLength)/n.BYTES_PER_ELEMENT):(r.byteLength=n.byteLength,t.bufferData(r.type,n,s)):(r.byteLength=e.descriptor.size,t.bufferData(r.type,r.byteLength,s)),r}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,t=!1){const r=e._gpuData[this._renderer.uid];r&&(t||this._gl.deleteBuffer(r.buffer))}createGLBuffer(e){const{_gl:t}=this;let r=c_.ARRAY_BUFFER;e.descriptor.usage&Oo.INDEX?r=c_.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&Oo.UNIFORM&&(r=c_.UNIFORM_BUFFER);const n=new d_(t.createBuffer(),r);return e._gpuData[this._renderer.uid]=n,this._managedBuffers.add(e),n}resetState(){this._boundBufferBases=Object.create(null)}}p_.extension={type:[e.WebGLSystem],name:"buffer"};const f_=class e{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(t){t={...e.defaultOptions,...t};let r=this.multiView=t.multiView;if(t.context&&r&&(Oe("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),this.canvas=r?Yt.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{const e=this._renderer.background.alpha<1,r=t.premultipliedAlpha??!0,n=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:e,premultipliedAlpha:r,antialias:n,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView)return void(e!==this.canvas&&Oe("multiView is disabled, but targetCanvas is not the main canvas"));const{canvas:t}=this;(t.width<e.width||t.height<e.height)&&(t.width=Math.max(e.width,e.width),t.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof Yt.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const t=this._renderer.view.canvas;t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,t){let r;const n=this.canvas;if(2===e&&(r=n.getContext("webgl2",t)),!r&&(r=n.getContext("webgl",t),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,t={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(1===this.webGLVersion)this.extensions={...t,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...t,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const r=e.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(e){const t=e.getContextAttributes();t&&!t.stencil&&Oe("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=this.supports,n=2===this.webGLVersion,s=this.extensions;r.uint32Indices=n||!!s.uint32ElementIndex,r.uniformBufferObject=n,r.vertexArrayObject=n||!!s.vertexArrayObject,r.srgbTextures=n||!!s.srgb,r.nonPowOf2wrapping=n,r.nonPowOf2mipmaps=n,r.msaa=n,r.uint32Indices||Oe("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};f_.extension={type:[e.WebGLSystem],name:"context"},f_.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let m_=f_;function g_(e,t){for(const r in e.attributes){const n=e.attributes[r],s=t[r];s?(n.format??(n.format=s.format),n.offset??(n.offset=s.offset),n.instance??(n.instance=s.instance)):n.format||Oe(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}!function(e){const{buffers:t,attributes:r}=e,n={},s={};for(const e in t){const r=t[e];n[r.uid]=0,s[r.uid]=0}for(const e in r){const t=r[e];n[t.buffer.uid]+=xn(t.format).stride}for(const e in r){const t=r[e];t.stride??(t.stride=n[t.buffer.uid]),t.start??(t.start=s[t.buffer.uid]),s[t.buffer.uid]+=xn(t.format).stride}}(e)}var __=(e=>(e[e.RGBA=6408]="RGBA",e[e.RGB=6407]="RGB",e[e.RG=33319]="RG",e[e.RED=6403]="RED",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.ALPHA=6406]="ALPHA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e))(__||{}),x_=(e=>(e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e))(x_||{}),b_=(e=>(e[e.CLAMP=33071]="CLAMP",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e))(b_||{}),y_=(e=>(e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.BYTE=5120]="BYTE",e[e.SHORT=5122]="SHORT",e[e.INT=5124]="INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.HALF_FLOAT=36193]="HALF_FLOAT",e))(y_||{});const v_={uint8x2:y_.UNSIGNED_BYTE,uint8x4:y_.UNSIGNED_BYTE,sint8x2:y_.BYTE,sint8x4:y_.BYTE,unorm8x2:y_.UNSIGNED_BYTE,unorm8x4:y_.UNSIGNED_BYTE,snorm8x2:y_.BYTE,snorm8x4:y_.BYTE,uint16x2:y_.UNSIGNED_SHORT,uint16x4:y_.UNSIGNED_SHORT,sint16x2:y_.SHORT,sint16x4:y_.SHORT,unorm16x2:y_.UNSIGNED_SHORT,unorm16x4:y_.UNSIGNED_SHORT,snorm16x2:y_.SHORT,snorm16x4:y_.SHORT,float16x2:y_.HALF_FLOAT,float16x4:y_.HALF_FLOAT,float32:y_.FLOAT,float32x2:y_.FLOAT,float32x3:y_.FLOAT,float32x4:y_.FLOAT,uint32:y_.UNSIGNED_INT,uint32x2:y_.UNSIGNED_INT,uint32x3:y_.UNSIGNED_INT,uint32x4:y_.UNSIGNED_INT,sint32:y_.INT,sint32x2:y_.INT,sint32x3:y_.INT,sint32x4:y_.INT};function T_(e){return v_[e]??v_.float32}const S_={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class w_{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class E_{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new Pa({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const t=this._renderer.context.extensions.vertexArrayObject;t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e));const r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(e.drawArraysInstanced=(e,t,n,s)=>{r.drawArraysInstancedANGLE(e,t,n,s)},e.drawElementsInstanced=(e,t,n,s,i)=>{r.drawElementsInstancedANGLE(e,t,n,s,i)},e.vertexAttribDivisor=(e,t)=>r.vertexAttribDivisorANGLE(e,t)),this._activeGeometry=null,this._activeVao=null}bind(e,t){const r=this.gl;this._activeGeometry=e;const n=this.getVao(e,t);this._activeVao!==n&&(this._activeVao=n,r.bindVertexArray(n)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this._renderer.buffer;for(let r=0;r<e.buffers.length;r++){const n=e.buffers[r];t.updateBuffer(n)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,t){const r=e.attributes,n=t._attributeData;for(const e in n)if(!r[e])throw new Error(`shader and geometry incompatible, geometry missing the "${e}" attribute`)}getSignature(e,t){const r=e.attributes,n=t._attributeData,s=["g",e.uid];for(const e in r)n[e]&&s.push(e,n[e].location);return s.join("-")}getVao(e,t){return e._gpuData[this._renderer.uid]?.vaoCache[t._key]||this.initGeometryVao(e,t)}initGeometryVao(e,t,r=!0){const n=this._renderer.gl,s=this._renderer.buffer;this._renderer.shader._getProgramData(t),this.checkCompatibility(e,t);const i=this.getSignature(e,t);let o=e._gpuData[this._renderer.uid];o||(o=new w_,e._gpuData[this._renderer.uid]=o,this._managedGeometries.add(e));const a=o.vaoCache;let l=a[i];if(l)return a[t._key]=l,l;g_(e,t._attributeData);const u=e.buffers;l=n.createVertexArray(),n.bindVertexArray(l);for(let e=0;e<u.length;e++){const t=u[e];s.bind(t)}return this.activateVao(e,t),a[t._key]=l,a[i]=l,n.bindVertexArray(null),l}onGeometryUnload(e,t=!1){const r=e._gpuData[this._renderer.uid];if(!r)return;const n=r.vaoCache;if(!t)for(const e in n)this._activeVao===n[e]&&this.resetState(),this.gl.deleteVertexArray(n[e])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,t){const r=this._renderer.gl,n=this._renderer.buffer,s=e.attributes;e.indexBuffer&&n.bind(e.indexBuffer);let i=null;for(const e in s){const o=s[e],a=o.buffer,l=n.getGlBuffer(a),u=t._attributeData[e];if(u){i!==l&&(n.bind(a),i=l);const e=u.location;r.enableVertexAttribArray(e);const t=xn(o.format),s=T_(o.format);if("int"===u.format?.substring(1,4)?r.vertexAttribIPointer(e,t.size,s,o.stride,o.offset):r.vertexAttribPointer(e,t.size,s,t.normalised,o.stride,o.offset),o.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");{const t=o.divisor??1;r.vertexAttribDivisor(e,t)}}}}}draw(e,t,r,n){const{gl:s}=this._renderer,i=this._activeGeometry,o=S_[e||i.topology];if(n??(n=i.instanceCount),i.indexBuffer){const e=i.indexBuffer.data.BYTES_PER_ELEMENT,a=2===e?s.UNSIGNED_SHORT:s.UNSIGNED_INT,l=t||i.indexCount||i.indexBuffer.data.length,u=(r||0)*e;1!==n?s.drawElementsInstanced(o,l,a,u,n):s.drawElements(o,l,a,u)}else 1!==n?s.drawArraysInstanced(o,r||0,t||i.vertexCount,n):s.drawArrays(o,r||0,t||i.vertexCount);return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}E_.extension={type:[e.WebGLSystem],name:"geometry"};const A_=new Lo({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),R_=class e{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(t={}){const{useBackBuffer:r,antialias:n}={...e.defaultOptions,...t};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(Oe("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=qn.for2d();const s=new gn({vertex:"\n attribute vec2 aPosition;\n out vec2 vUv;\n\n void main() {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n\n vUv = (aPosition + 1.0) / 2.0;\n\n // flip dem UVs\n vUv.y = 1.0 - vUv.y;\n }",fragment:"\n in vec2 vUv;\n out vec4 finalColor;\n\n uniform sampler2D uTexture;\n\n void main() {\n finalColor = texture(uTexture, vUv);\n }",name:"big-triangle"});this._bigTriangleShader=new Ln({glProgram:s,resources:{uTexture:ee.WHITE.source}})}renderStart(e){const t=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!t.isRoot,this._useBackBufferThisRender){const t=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=t.colorTexture,e.target=this._getBackBufferTexture(t.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind({target:this._targetTexture,clear:!1}),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:A_,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new ee({source:new K({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};R_.extension={type:[e.WebGLSystem],name:"backBuffer",priority:1},R_.defaultOptions={useBackBuffer:!1};let C_=R_;class M_{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(8&e),!!(4&e),!!(2&e),!!(1&e)))}}M_.extension={type:[e.WebGLSystem],name:"colorMask"};class P_{constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,t){this._renderer.geometry.bind(e,t.glProgram)}finishRenderPass(){}draw(e){const t=this._renderer,{geometry:r,shader:n,state:s,skipSync:i,topology:o,size:a,start:l,instanceCount:u}=e;t.shader.bind(n,i),t.geometry.bind(r,t.shader._activeProgram),s&&t.state.set(s),t.geometry.draw(o,a,l,u??r.instanceCount)}destroy(){this._renderer=null}}P_.extension={type:[e.WebGLSystem],name:"encoder"};class G_{constructor(e){this._renderer=e}contextChange(){const e=this._renderer.gl;this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=So(this.maxTextures,e);const t=2===this._renderer.context.webGLVersion;this.maxUniformBindings=t?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}}G_.extension={type:[e.WebGLSystem],name:"limits"};class B_{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this._attachedMipLevel=0,this._attachedLayer=0,this.msaaRenderBuffer=[],this.stencilMode=bo.DISABLED,this.stencilReference=0,this.maskStackIndex=0}}const F_=[];F_[bo.NONE]=void 0,F_[bo.DISABLED]={stencilWriteMask:0,stencilReadMask:0},F_[bo.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},F_[bo.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},F_[bo.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},F_[bo.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}};class I_{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:bo.NONE},this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this._activeGpuRenderTarget=null,this.resetState()}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;const t=this._renderer.renderTarget.getGpuRenderTarget(e);this._activeGpuRenderTarget=t,this.setStencilMode(t.stencilMode,t.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=bo.NONE,this._stencilCache.stencilReference=0}setStencilMode(e,t){const r=this._activeGpuRenderTarget??(this._activeGpuRenderTarget=this._renderer.renderTarget.getGpuRenderTarget(this._activeRenderTarget)),n=this._gl,s=F_[e],i=this._stencilCache;r.stencilMode=e,r.stencilReference=t,e!==bo.DISABLED?(this._stencilCache.enabled||(this._stencilCache.enabled=!0,n.enable(n.STENCIL_TEST)),e===i.stencilMode&&i.stencilReference===t||(i.stencilMode=e,i.stencilReference=t,n.stencilFunc(this._comparisonFuncMapping[s.stencilBack.compare],t,255),n.stencilOp(n.KEEP,n.KEEP,this._stencilOpsMapping[s.stencilBack.passOp]))):this._stencilCache.enabled&&(this._stencilCache.enabled=!1,n.disable(n.STENCIL_TEST))}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._gl=null,this._activeRenderTarget=null,this._activeGpuRenderTarget=null}}I_.extension={type:[e.WebGLSystem],name:"stencil"};class O_{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!Ps())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){const t=this.getUniformGroupData(e);e.buffer||(e.buffer=new Do({data:new Float32Array(t.layout.size/4),usage:Oo.UNIFORM|Oo.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){const t=e._signature;let r=this._syncFunctionHash[t];if(!r){const n=Object.keys(e.uniformStructures).map(t=>e.uniformStructures[t]),s=this._adaptor.createUboElements(n),i=this._generateUboSync(s.uboElements);r=this._syncFunctionHash[t]={layout:s,syncFunction:i}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,r){const n=this.getUniformGroupData(e);e.buffer||(e.buffer=new Do({data:new Float32Array(n.layout.size/4),usage:Oo.UNIFORM|Oo.COPY_DST}));let s=null;return t||(t=e.buffer.data,s=e.buffer.dataInt32),r||(r=0),n.syncFunction(e.uniforms,t,s,r),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;const t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}const D_={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,u32:4,"vec2<u32>":8,"vec3<u32>":12,"vec4<u32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function U_(e){const t=e.map(e=>({data:e,offset:0,size:0}));let r=0,n=0;for(let e=0;e<t.length;e++){const s=t[e];if(r=D_[s.data.type],!r)throw new Error(`Unknown type ${s.data.type}`);s.data.size>1&&(r=Math.max(r,16)*s.data.size);const i=12===r?16:r;s.size=r;const o=n%16;n+=o>0&&16-o<i?(16-o)%16:(r-o%r)%r,s.offset=n,n+=r}return n=16*Math.ceil(n/16),{uboElements:t,size:n}}const k_=[{type:"mat3x3<f32>",test:e=>void 0!==e.value.a,ubo:"\n var matrix = uv[name].toArray(true);\n data[offset] = matrix[0];\n data[offset + 1] = matrix[1];\n data[offset + 2] = matrix[2];\n data[offset + 4] = matrix[3];\n data[offset + 5] = matrix[4];\n data[offset + 6] = matrix[5];\n data[offset + 8] = matrix[6];\n data[offset + 9] = matrix[7];\n data[offset + 10] = matrix[8];\n ",uniform:"\n gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));\n "},{type:"vec4<f32>",test:e=>"vec4<f32>"===e.type&&1===e.size&&void 0!==e.value.width,ubo:"\n v = uv[name];\n data[offset] = v.x;\n data[offset + 1] = v.y;\n data[offset + 2] = v.width;\n data[offset + 3] = v.height;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);\n }\n "},{type:"vec2<f32>",test:e=>"vec2<f32>"===e.type&&1===e.size&&void 0!==e.value.x,ubo:"\n v = uv[name];\n data[offset] = v.x;\n data[offset + 1] = v.y;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.x || cv[1] !== v.y) {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[name].location, v.x, v.y);\n }\n "},{type:"vec4<f32>",test:e=>"vec4<f32>"===e.type&&1===e.size&&void 0!==e.value.red,ubo:"\n v = uv[name];\n data[offset] = v.red;\n data[offset + 1] = v.green;\n data[offset + 2] = v.blue;\n data[offset + 3] = v.alpha;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n cv[3] = v.alpha;\n gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);\n }\n "},{type:"vec3<f32>",test:e=>"vec3<f32>"===e.type&&1===e.size&&void 0!==e.value.red,ubo:"\n v = uv[name];\n data[offset] = v.red;\n data[offset + 1] = v.green;\n data[offset + 2] = v.blue;\n ",uniform:"\n cv = ud[name].value;\n v = uv[name];\n if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {\n cv[0] = v.red;\n cv[1] = v.green;\n cv[2] = v.blue;\n gl.uniform3f(ud[name].location, v.red, v.green, v.blue);\n }\n "}];function L_(e,t,r){const n=["\n var v = null;\n var v2 = null;\n var t = 0;\n var index = 0;\n var name = null;\n var arrayOffset = null;\n "];let s=0;for(let i=0;i<e.length;i++){const o=e[i],a=o.data.name;let l=!1,u=0;for(let e=0;e<k_.length;e++){if(k_[e].test(o.data)){u=o.offset/4,n.push(`name = "${a}";`,`offset += ${u-s};`,k_[e].ubo),l=!0;break}}if(!l)if(o.data.size>1)u=o.offset/4,n.push(r(o,u-s));else{const e=t[o.data.type];u=o.offset/4,n.push(`\n v = uv.${a};\n offset += ${u-s};\n ${e};\n `)}s=u}const i=n.join("\n");return new Function("uv","data","dataInt32","offset",i)}function N_(e,t){return`\n for (let i = 0; i < ${e*t}; i++) {\n data[offset + (((i / ${e})|0) * 4) + (i % ${e})] = v[i];\n }\n `}const X_={f32:"\n data[offset] = v;",i32:"\n dataInt32[offset] = v;",u32:"\n dataInt32[offset] = v;","vec2<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];","vec3<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];","vec4<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 3] = v[3];","vec2<i32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];","vec3<i32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];\n dataInt32[offset + 2] = v[2];","vec4<i32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];\n dataInt32[offset + 2] = v[2];\n dataInt32[offset + 3] = v[3];","vec2<u32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];","vec3<u32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];\n dataInt32[offset + 2] = v[2];","vec4<u32>":"\n dataInt32[offset] = v[0];\n dataInt32[offset + 1] = v[1];\n dataInt32[offset + 2] = v[2];\n dataInt32[offset + 3] = v[3];","mat2x2<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 4] = v[2];\n data[offset + 5] = v[3];","mat3x3<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];","mat4x4<f32>":"\n for (let i = 0; i < 16; i++) {\n data[offset + i] = v[i];\n }","mat3x2<f32>":N_(3,2),"mat4x2<f32>":N_(4,2),"mat2x3<f32>":N_(2,3),"mat4x3<f32>":N_(4,3),"mat2x4<f32>":N_(2,4),"mat3x4<f32>":N_(3,4)},H_={...X_,"mat2x2<f32>":"\n data[offset] = v[0];\n data[offset + 1] = v[1];\n data[offset + 2] = v[2];\n data[offset + 3] = v[3];\n "};function z_(e,t){const r=Math.max(D_[e.data.type]/16,1),n=e.data.value.length/e.data.size,s=(4-n%4)%4,i=e.data.type.indexOf("i32")>=0?"dataInt32":"data";return`\n v = uv.${e.data.name};\n offset += ${t};\n\n arrayOffset = offset;\n\n t = 0;\n\n for(var i=0; i < ${e.data.size*r}; i++)\n {\n for(var j = 0; j < ${n}; j++)\n {\n ${i}[arrayOffset++] = v[t++];\n }\n ${0!==s?`arrayOffset += ${s};`:""}\n }\n `}function V_(e){return L_(e,X_,z_)}class W_ extends O_{constructor(){super({createUboElements:U_,generateUboSync:V_})}}W_.extension={type:[e.WebGLSystem],name:"ubo"};class $_{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new M,this._boundFramebuffer=void 0}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new M,this._boundFramebuffer=void 0;const e=this._renderer.gl;this._drawBuffersCache=[];for(let t=1;t<=16;t++)this._drawBuffersCache[t]=Array.from({length:t},(t,r)=>e.COLOR_ATTACHMENT0+r)}copyToTexture(e,t,r,n,s){const i=this._renderTargetSystem,o=this._renderer,a=i.getGpuRenderTarget(e),l=o.gl;return this.finishRenderPass(e),l.bindFramebuffer(l.FRAMEBUFFER,a.resolveTargetFramebuffer),this._boundFramebuffer=a.resolveTargetFramebuffer,o.texture.bind(t,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,s.x,s.y,r.x,r.y,n.width,n.height),t}copyDepthTexture(e,t,r,n,s){const i=this._renderTargetSystem,o=this._renderer.gl;this.finishRenderPass(e);const a=i.getRenderTarget(t),l=i.getGpuRenderTarget(e),u=i.getGpuRenderTarget(a);o.bindFramebuffer(o.READ_FRAMEBUFFER,l.framebuffer),o.bindFramebuffer(o.DRAW_FRAMEBUFFER,u.framebuffer),this._boundFramebuffer=void 0,o.blitFramebuffer(r.x,r.y,r.x+n.width,r.y+n.height,s.x,s.y,s.x+n.width,s.y+n.height,o.DEPTH_BUFFER_BIT,o.NEAREST)}startRenderPass(e,t=!0,r,n,s=0,i=0){const o=this._renderTargetSystem.getGpuRenderTarget(e);if(0!==i&&this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to array layers requires WebGL2.");if(s>0){if(o.msaa)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to mip levels requires WebGL2.")}e.colorAttachments.forEach(e=>{this._renderer.texture.unbind(e.texture)});const a=this._renderer.gl;this.bindFramebuffer(o.framebuffer),!e.isRoot&&e.colorAttachments.length>0&&(o._attachedMipLevel!==s||o._attachedLayer!==i)&&(e.colorAttachments.forEach((e,t)=>{const r=e.texture,n=this._renderer.texture.getGlSource(r);if(n.target===a.TEXTURE_2D){if(0!==i)throw new Error("[RenderTargetSystem] layer must be 0 when rendering to 2D textures in WebGL.");a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+t,a.TEXTURE_2D,n.texture,s)}else if(n.target===a.TEXTURE_2D_ARRAY||n.target===a.TEXTURE_3D)a.framebufferTextureLayer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+t,n.texture,s,i);else{if(n.target!==a.TEXTURE_CUBE_MAP)throw new Error("[RenderTargetSystem] Unsupported texture target for render-to-layer in WebGL.");if(i<0||i>5)throw new Error("[RenderTargetSystem] Cube map layer must be between 0 and 5.");a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+t,a.TEXTURE_CUBE_MAP_POSITIVE_X+i,n.texture,s)}}),o._attachedMipLevel=s,o._attachedLayer=i),o.framebuffer&&(e.depthStencilAttachment?this._attachDepthStencilTexture(e,s,i):o.depthStencilRenderBuffer||!e.stencil&&!e.depth||this._initStencil(o)),e.colorAttachments.length>1&&this._setDrawBuffers(e,a);let l=n.y;e.isRoot&&(l=e.pixelHeight-n.height-n.y);const u=this._viewPortCache;u.x===n.x&&u.y===l&&u.width===n.width&&u.height===n.height||(u.x=n.x,u.y=l,u.width=n.width,u.height=n.height,a.viewport(n.x,l,n.width,n.height)),this.clear(e,t,r)}finishRenderPass(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);if(!t.msaa||0===e.colorAttachments.length)return;const r=this._renderer.gl;r.bindFramebuffer(r.FRAMEBUFFER,t.resolveTargetFramebuffer),r.bindFramebuffer(r.READ_FRAMEBUFFER,t.framebuffer),r.blitFramebuffer(0,0,t.width,t.height,0,0,t.width,t.height,r.COLOR_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,t.framebuffer),this._boundFramebuffer=t.framebuffer}initGpuRenderTarget(e){const t=this._renderer.gl,r=new B_;r._attachedMipLevel=0,r._attachedLayer=0;const n=e.colorTexture;return n instanceof jt?(this._renderer.context.ensureCanvasSize(n.resource),r.framebuffer=null,r):(r.width=e.pixelWidth,r.height=e.pixelHeight,0===e.colorAttachments.length?this._initDepth(e,r):this._initColor(e,r),e.depthStencilAttachment&&this._attachDepthStencilTexture(e,0,0),t.bindFramebuffer(t.FRAMEBUFFER,null),this._boundFramebuffer=null,r)}destroyGpuRenderTarget(e){const t=this._renderer.gl;e.framebuffer&&(t.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(t.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(t.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(e=>{t.deleteRenderbuffer(e)}),e.msaaRenderBuffer.length=0}clear(e,t,r,n,s=0,i=0){if(!t)return;if(0!==i)throw new Error("[RenderTargetSystem] Clearing array layers is not supported in WebGL renderer.");const o=this._renderTargetSystem;if("boolean"==typeof t&&(t=t?si.ALL:si.NONE),0===e.colorAttachments.length&&!(t&=~si.COLOR))return;const a=this._renderer.gl,l=!!(t&si.DEPTH)&&!this._renderer.state.depthMaskEnabled;if(t&si.COLOR){r??(r=o.defaultClearColor);const e=this._clearColorCache,t=r;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]||(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],a.clearColor(t[0],t[1],t[2],t[3]))}l&&a.depthMask(!0),a.clear(t),l&&a.depthMask(!1)}resizeGpuRenderTarget(e){if(e.isRoot)return;const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.pixelWidth,t.height=e.pixelHeight,e.colorAttachments.length>0&&this._resizeColor(e,t),t.depthStencilRenderBuffer&&this._resizeStencil(t),this._boundFramebuffer=void 0}_initColor(e,t){const r=this._renderer,n=r.gl,s=n.createFramebuffer();t.resolveTargetFramebuffer=s,n.bindFramebuffer(n.FRAMEBUFFER,s);if(e.colorAttachments.forEach((e,s)=>{const i=e.texture;i.antialias&&(r.context.supports.msaa?t.msaa=!0:Oe("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(i,0);const o=r.texture.getGlSource(i),a=o.texture;if(o.target===n.TEXTURE_2D)n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+s,n.TEXTURE_2D,a,0);else if(o.target===n.TEXTURE_2D_ARRAY||o.target===n.TEXTURE_3D)n.framebufferTextureLayer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+s,a,0,0);else{if(o.target!==n.TEXTURE_CUBE_MAP)throw new Error("[RenderTargetSystem] Unsupported texture target for framebuffer attachment.");n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+s,n.TEXTURE_CUBE_MAP_POSITIVE_X,a,0)}}),t.msaa){const r=n.createFramebuffer();t.framebuffer=r,n.bindFramebuffer(n.FRAMEBUFFER,r),e.colorAttachments.forEach((e,r)=>{const s=n.createRenderbuffer();t.msaaRenderBuffer[r]=s})}else t.framebuffer=s;this._resizeColor(e,t)}_initDepth(e,t){const r=this._renderer;if(r.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Depth-only render targets require WebGL2.");const n=r.gl,s=n.createFramebuffer();t.resolveTargetFramebuffer=s,t.framebuffer=s,n.bindFramebuffer(n.FRAMEBUFFER,s),n.drawBuffers([n.NONE]),n.readBuffer(n.NONE)}_resizeColor(e,t){const r=e.colorAttachments[0].texture;if(t._attachedMipLevel=0,t._attachedLayer=0,e.colorAttachments.forEach((e,t)=>{0!==t&&e.texture.resize(r.width,r.height,r._resolution)}),t.msaa){const r=this._renderer,n=r.gl,s=t.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,s),e.colorAttachments.forEach((e,s)=>{const i=e.texture;r.texture.bindSource(i,0);const o=r.texture.getGlSource(i).internalFormat,a=t.msaaRenderBuffer[s];n.bindRenderbuffer(n.RENDERBUFFER,a),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,o,i.pixelWidth,i.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+s,n.RENDERBUFFER,a)})}}_attachDepthStencilTexture(e,t,r){const n=this._renderer,s=n.gl,i=e.depthStencilAttachment.texture,o=n.texture.getGlSource(i),a=o.texture,l=i.format;let u;u="depth24plus-stencil8"===l||"depth32float-stencil8"===l?s.DEPTH_STENCIL_ATTACHMENT:"stencil8"===l?s.STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,o.target===s.TEXTURE_2D?s.framebufferTexture2D(s.FRAMEBUFFER,u,s.TEXTURE_2D,a,t):o.target===s.TEXTURE_2D_ARRAY||o.target===s.TEXTURE_3D?s.framebufferTextureLayer(s.FRAMEBUFFER,u,a,t,r):o.target===s.TEXTURE_CUBE_MAP&&s.framebufferTexture2D(s.FRAMEBUFFER,u,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,t)}_initStencil(e){if(null===e.framebuffer)return;const t=this._renderer.gl,r=t.createRenderbuffer();e.depthStencilRenderBuffer=r,t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),this._resizeStencil(e)}_resizeStencil(e){const t=this._renderer.gl;t.bindRenderbuffer(t.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?t.renderbufferStorageMultisample(t.RENDERBUFFER,4,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,2===this._renderer.context.webGLVersion?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL,e.width,e.height)}prerender(e){if(0===e.colorAttachments.length)return;const t=e.colorAttachments[0].texture.resource;this._renderer.context.multiView&&jt.test(t)&&this._renderer.context.ensureCanvasSize(t)}postrender(e){if(!this._renderer.context.multiView||0===e.colorAttachments.length)return;const t=e.colorAttachments[0].texture;if(jt.test(t.resource)){const e=this._renderer.context.canvas,r=t;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}_setDrawBuffers(e,t){const r=e.colorAttachments.length,n=this._drawBuffersCache[r];if(1===this._renderer.context.webGLVersion){const e=this._renderer.context.extensions.drawBuffers;e?e.drawBuffersWEBGL(n):Oe("[RenderTexture] This WebGL1 context does not support rendering to multiple targets")}else t.drawBuffers(n)}resetState(){this._boundFramebuffer=void 0,this._viewPortCache=new M,this._clearColorCache=[0,0,0,0]}bindFramebuffer(e){this._boundFramebuffer!==e&&(this._boundFramebuffer=e,this._renderer.gl.bindFramebuffer(this._renderer.gl.FRAMEBUFFER,e))}}class Y_ extends Qg{constructor(e){super(e),this.adaptor=new $_,this.adaptor.init(e,this)}resetState(){this.adaptor.resetState()}}Y_.extension={type:[e.WebGLSystem],name:"renderTarget"};class j_ extends c{constructor({buffer:e,offset:t,size:r}){super(),this.uid=G("buffer"),this._resourceType="bufferResource",this._resourceId=G("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=0|t,this.size=r,this.buffer.on("change",this.onBufferChange,this)}get _gcLastUsed(){return this.buffer?._gcLastUsed??-1}set _gcLastUsed(e){this.buffer&&(this.buffer._gcLastUsed=e)}onBufferChange(){this._resourceId=G("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}class q_ extends c{constructor(e,t){super(),this._resourceType="textureView",this._resourceId=G("resource"),this.source=e,this.viewDescriptor=t,this._onChange=this._onChange.bind(this),this._onDestroy=this._onDestroy.bind(this),this.source.on("change",this._onChange),this.source.on("destroy",this._onDestroy)}_onChange(){this.emit("change",this)}_onDestroy(){this.destroy()}get destroyed(){return this.source.destroyed}destroy(){this.source&&(this.source.off("change",this._onChange),this.source.off("destroy",this._onDestroy)),this.emit("destroy",this),this.removeAllListeners()}}function K_(e,t){const r=[],n=["\n var g = s.groups;\n var sS = r.shader;\n var p = s.glProgram;\n var ugS = r.uniformGroup;\n var resources;\n "];let s=!1,i=0;const o=t._getProgramData(e.glProgram);for(const a in e.groups){const l=e.groups[a];r.push(`\n resources = g[${a}].resources;\n `);for(const u in l.resources){const h=l.resources[u];if(h instanceof On)if(h.ubo){const t=e._uniformBindMap[a][Number(u)];r.push(`\n sS.bindUniformBlock(\n resources[${u}],\n '${t}',\n ${e.glProgram._uniformBlockData[t].index}\n );\n `)}else r.push(`\n ugS.updateUniformGroup(resources[${u}], p, sD);\n `);else if(h instanceof j_){const t=e._uniformBindMap[a][Number(u)];r.push(`\n sS.bindUniformBlock(\n resources[${u}],\n '${t}',\n ${e.glProgram._uniformBlockData[t].index}\n );\n `)}else if(h instanceof K||h instanceof q_){const l=e._uniformBindMap[a][u],h=o.uniformData[l];h&&(s||(s=!0,n.push("\n var tS = r.texture;\n ")),t._gl.uniform1i(h.location,i),r.push(`\n tS.bind(resources[${u}], ${i});\n `),i++)}}}const a=[...n,...r].join("\n");return new Function("r","s","sD",a)}class Z_{}class Q_{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function J_(e,t,r){const n=e.createShader(t);return e.shaderSource(n,r),e.compileShader(n),n}function ex(e){const t=new Array(e);for(let e=0;e<t.length;e++)t[e]=!1;return t}function tx(e,t){switch(e){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":case"sampler3D":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return ex(2*t);case"bvec3":return ex(3*t);case"bvec4":return ex(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}let rx=null;const nx={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_2D_SHADOW:"sampler2DShadow",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_CUBE_SHADOW:"samplerCubeShadow",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray",SAMPLER_2D_ARRAY_SHADOW:"sampler2DArrayShadow",SAMPLER_3D:"sampler3D",INT_SAMPLER_3D:"sampler3D",UNSIGNED_INT_SAMPLER_3D:"sampler3D"},sx={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"};function ix(e,t){if(!rx){const t=Object.keys(nx);rx={};for(let r=0;r<t.length;++r){const n=t[r];rx[e[n]]=nx[n]}}return rx[t]}function ox(e,t){const r=ix(e,t);return sx[r]||"float32"}function ax(e,t,r=!1){const n={},s=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<s;r++){const s=t.getActiveAttrib(e,r);if(s.name.startsWith("gl_"))continue;const i=ox(t,s.type);n[s.name]={location:0,format:i,stride:xn(i).stride,offset:0,instance:!1,start:0}}const i=Object.keys(n);if(r){i.sort((e,t)=>e>t?1:-1);for(let r=0;r<i.length;r++)n[i[r]].location=r,t.bindAttribLocation(e,r,i[r]);t.linkProgram(e)}else for(let r=0;r<i.length;r++)n[i[r]].location=t.getAttribLocation(e,i[r]);return n}function lx(e,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};const r={},n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<n;s++){const n=t.getActiveUniformBlockName(e,s),i=t.getUniformBlockIndex(e,n),o=t.getActiveUniformBlockParameter(e,s,t.UNIFORM_BLOCK_DATA_SIZE);r[n]={name:n,index:i,size:o}}return r}function ux(e,t){const r={},n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let s=0;s<n;s++){const n=t.getActiveUniform(e,s),i=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),a=ix(t,n.type);r[i]={name:i,index:s,type:a,size:n.size,isArray:o,value:tx(a,n.size)}}return r}function hx(e,t){const r=e.getShaderSource(t);if(null===r)return void console.error("PixiJS Error: Could not retrieve shader source (WebGL context may be lost).");const n=r.split("\n").map((e,t)=>`${t}: ${e}`),s=e.getShaderInfoLog(t)??"",i=s.split("\n"),o={},a=i.map(e=>parseFloat(e.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(e=>!(!e||o[e])&&(o[e]=!0,!0)),l=[""];a.forEach(e=>{n[e-1]=`%c${n[e-1]}%c`,l.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const u=n.join("\n");l[0]=u,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...l),console.groupEnd()}function cx(e,t,r,n){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(r,e.COMPILE_STATUS)||hx(e,r),e.getShaderParameter(n,e.COMPILE_STATUS)||hx(e,n),console.error("PixiJS Error: Could not initialize shader."),""!==e.getProgramInfoLog(t)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(t)))}function dx(e,t){const r=J_(e,e.VERTEX_SHADER,t.vertex),n=J_(e,e.FRAGMENT_SHADER,t.fragment),s=e.createProgram();e.attachShader(s,r),e.attachShader(s,n);const i=t.transformFeedbackVaryings;i&&("function"!=typeof e.transformFeedbackVaryings?Oe("TransformFeedback is not supported but TransformFeedbackVaryings are given."):e.transformFeedbackVaryings(s,i.names,"separate"===i.bufferMode?e.SEPARATE_ATTRIBS:e.INTERLEAVED_ATTRIBS)),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS)||cx(e,s,r,n),t._attributeData=ax(s,e,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=ux(s,e),t._uniformBlockData=lx(s,e),e.deleteShader(r),e.deleteShader(n);const o={};for(const r in t._uniformData){const n=t._uniformData[r];o[r]={location:e.getUniformLocation(s,r),value:tx(n.type,n.size)}}return new Q_(s,o)}const px={textureCount:0,blockIndex:0};class fx{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(e,t){if(this._setProgram(e.glProgram),t)return;px.textureCount=0,px.blockIndex=0;let r=this._shaderSyncFunctions[e.glProgram._key];r||(r=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),r(this._renderer,e,px)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,px)}bindUniformBlock(e,t,r=0){const n=this._renderer.buffer,s=this._getProgramData(this._activeProgram),i=e._bufferResource;i||this._renderer.ubo.updateUniformGroup(e);const o=e.buffer,a=n.updateBuffer(o),l=n.freeLocationForBufferBase(a);if(i){const{offset:t,size:r}=e;0===t&&r===o.data.byteLength?n.bindBufferBase(a,l):n.bindBufferRange(a,l,t)}else n.getLastBindBaseLocation(a)!==l&&n.bindBufferBase(a,l);const u=this._activeProgram._uniformBlockData[t].index;s.uniformBlockBindings[r]!==l&&(s.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(s.program,u,l))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;const t=this._getProgramData(e);this._gl.useProgram(t.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){const t=e._key;return this._programDataHash[t]=dx(this._gl,e),this._programDataHash[t]}destroy(){for(const e of Object.keys(this._programDataHash))this._programDataHash[e].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(e,t){return K_(e,t)}resetState(){this._activeProgram=null}}fx.extension={type:[e.WebGLSystem],name:"shader"};const mx={f32:"if (cv !== v) {\n cu.value = v;\n gl.uniform1f(location, v);\n }","vec2<f32>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1]);\n }","vec3<f32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3f(location, v[0], v[1], v[2]);\n }","vec4<f32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",i32:"if (cv !== v) {\n cu.value = v;\n gl.uniform1i(location, v);\n }","vec2<i32>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2i(location, v[0], v[1]);\n }","vec3<i32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3i(location, v[0], v[1], v[2]);\n }","vec4<i32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",u32:"if (cv !== v) {\n cu.value = v;\n gl.uniform1ui(location, v);\n }","vec2<u32>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2ui(location, v[0], v[1]);\n }","vec3<u32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }","vec4<u32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",bool:"if (cv !== v) {\n cu.value = v;\n gl.uniform1i(location, v);\n }","vec2<bool>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2i(location, v[0], v[1]);\n }","vec3<bool>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n gl.uniform3i(location, v[0], v[1], v[2]);\n }","vec4<bool>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},gx={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"};function _x(e,t){const r=["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n var name = null;\n "];for(const n in e.uniforms){if(!t[n]){e.uniforms[n]instanceof On?e.uniforms[n].ubo?r.push(`\n renderer.shader.bindUniformBlock(uv.${n}, "${n}");\n `):r.push(`\n renderer.shader.updateUniformGroup(uv.${n});\n `):e.uniforms[n]instanceof j_&&r.push(`\n renderer.shader.bindBufferResource(uv.${n}, "${n}");\n `);continue}const s=e.uniformStructures[n];let i=!1;for(let e=0;e<k_.length;e++){const t=k_[e];if(s.type===t.type&&t.test(s)){r.push(`name = "${n}";`,k_[e].uniform),i=!0;break}}if(!i){const e=(1===s.size?mx:gx)[s.type].replace("location",`ud["${n}"].location`);r.push(`\n cu = ud["${n}"];\n cv = cu.value;\n v = uv["${n}"];\n ${e};`)}}return new Function("ud","uv","renderer","syncData",r.join("\n"))}class xx{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,t,r){const n=this._renderer.shader._getProgramData(t);if(!e.isStatic||e._dirtyId!==n.uniformDirtyGroups[e.uid]){n.uniformDirtyGroups[e.uid]=e._dirtyId;this._getUniformSyncFunction(e,t)(n.uniformData,e.uniforms,this._renderer,r)}}_getUniformSyncFunction(e,t){return this._uniformGroupSyncHash[e._signature]?.[t._key]||this._createUniformSyncFunction(e,t)}_createUniformSyncFunction(e,t){const r=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),n=this._getSignature(e,t._uniformData,"u");return this._cache[n]||(this._cache[n]=this._generateUniformsSync(e,t._uniformData)),r[t._key]=this._cache[n],r[t._key]}_generateUniformsSync(e,t){return _x(e,t)}_getSignature(e,t,r){const n=e.uniforms,s=[`${r}-`];for(const e in n)s.push(e),t[e]&&s.push(t[e].type);return s.join("-")}destroy(){this._renderer=null,this._cache=null}}function bx(e){return e=`\n out vec4 finalColor;\n ${e=e.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in")}\n `}xx.extension={type:[e.WebGLSystem],name:"uniformGroup"};const yx={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function vx(e){return yx[e]}function Tx(e){const t={};t.normal=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t.add=[e.ONE,e.ONE],t.multiply=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.screen=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t["screen-npm"]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t.erase=[e.ZERO,e.ONE_MINUS_SRC_ALPHA];if(!(e instanceof Yt.get().getWebGLRenderingContext()))t.min=[e.ONE,e.ONE,e.ONE,e.ONE,e.MIN,e.MIN],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,e.MAX,e.MAX];else{const r=e.getExtension("EXT_blend_minmax");r&&(t.min=[e.ONE,e.ONE,e.ONE,e.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[e.ONE,e.ONE,e.ONE,e.ONE,r.MAX_EXT,r.MAX_EXT])}return t}const{BLEND:Sx,OFFSET:wx,CULLING:Ex,DEPTH_TEST:Ax,WINDING:Rx,DEPTH_MASK:Cx}=Xn,Mx=class e{constructor(e){this._invertFrontFace=!1,this._renderer=e,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[Sx]=this.setBlend,this.map[wx]=this.setOffset,this.map[Ex]=this.setCullFace,this.map[Ax]=this.setDepthTest,this.map[Rx]=this.setFrontFace,this.map[Cx]=this.setDepthMask,this.checks=[],this.defaultState=qn.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=this._renderer.renderTarget.isFrontFaceInverted(e,e.flipY),this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=Tx(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let t=this.stateId^e.data,r=0;for(;t;)1&t&&this.map[r].call(this,!!(e.data&1<<r)),t>>=1,r++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||(e=this.defaultState);for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(t){this._updateCheck(e._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(e._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}get depthMaskEnabled(){return!!(this.stateId&1<<Cx)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;const t=this._invertFrontFace?!e:e;this._glFrontFace!==t&&(this._glFrontFace=t,this.gl.frontFace(this.gl[t?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;const t=this.blendModesMap[e],r=this.gl;2===t.length?r.blendFunc(t[0],t[1]):r.blendFuncSeparate(t[0],t[1],t[2],t[3]),6===t.length?(this._blendEq=!0,r.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,t){const r=this.checks.indexOf(e);t&&-1===r?this.checks.push(e):t||-1===r||this.checks.splice(r,1)}static _checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static _checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null,this.checks.length=0,this._renderer=null}};Mx.extension={type:[e.WebGLSystem],name:"state"};let Px=Mx;class Gx{constructor(e){this.target=x_.TEXTURE_2D,this._layerInitMask=0,this.texture=e,this.width=-1,this.height=-1,this.type=y_.UNSIGNED_BYTE,this.internalFormat=__.RGBA,this.format=__.RGBA,this.samplerType=0}destroy(){}}function Bx(e,t,r,n,s){if((e=Math.max(0,e))>=(t=Math.min(t,r*n)))return 0;const i=Math.floor(e/r),o=e-i*r,a=Math.floor(t/r),l=t-a*r;if(i===a)return s[0].set(o,i,l-o,1),1;let u=0,h=i;return o>0&&(s[u++].set(o,i,r-o,1),h++),a>h&&s[u++].set(0,h,r,a-h),l>0&&s[u++].set(0,a,l,1),u}const Fx=[new M,new M,new M],Ix={id:"buffer",upload(e,t,r,n,s,i=!1){const o=s||t.target,a=e.resource;if(o===x_.TEXTURE_3D||o===x_.TEXTURE_2D_ARRAY)return i||t.width!==e.width||t.height!==e.height?r.texImage3D(o,0,t.internalFormat,e.width,e.height,e.depthOrArrayLayers,0,t.format,t.type,a):r.texSubImage3D(o,0,0,0,0,e.width,e.height,e.depthOrArrayLayers,t.format,t.type,a),t.width=e.width,void(t.height=e.height);const l=e.width*e.height,u=i||t.width!==e.width||t.height!==e.height,h=e._updateStart>0||e._updateEnd<l;if(u)r.texImage2D(o,0,t.internalFormat,e.width,e.height,0,t.format,t.type,a);else if(h){const n=a.length/l,s=Bx(e._updateStart,e._updateEnd,e.width,e.height,Fx);for(let i=0;i<s;i++){const s=Fx[i],l=(s.y*e.width+s.x)*n;r.texSubImage2D(o,0,s.x,s.y,s.width,s.height,t.format,t.type,a.subarray(l,l+s.width*s.height*n))}}else r.texSubImage2D(o,0,0,0,e.width,e.height,t.format,t.type,a);t.width=e.width,t.height=e.height}},Ox={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Dx={id:"compressed",upload(e,t,r,n,s,i){const o=s??t.target;r.pixelStorei(r.UNPACK_ALIGNMENT,4);let a=e.pixelWidth,l=e.pixelHeight;const u=!!Ox[e.format];for(let n=0;n<e.resource.length;n++){const s=e.resource[n];u?r.compressedTexImage2D(o,n,t.internalFormat,a,l,0,s):r.texImage2D(o,n,t.internalFormat,a,l,0,t.format,t.type,s),a=Math.max(a>>1,1),l=Math.max(l>>1,1)}}},Ux=["right","left","top","bottom","front","back"];function kx(e){return{id:"cube",upload(t,r,n,s){const i=t.faces;for(let t=0;t<Ux.length;t++){const o=i[Ux[t]];if(!o.resource)continue;(e[o.uploadMethodId]||e.image).upload(o,r,n,s,x_.TEXTURE_CUBE_MAP_POSITIVE_X+t,!(r._layerInitMask&1<<t)),r._layerInitMask|=1<<t}r.width=t.pixelWidth,r.height=t.pixelHeight}}}const Lx={id:"image",upload(e,t,r,n,s,i=!1){const o=s||t.target,a=e.pixelWidth,l=e.pixelHeight,u=e.resourceWidth,h=e.resourceHeight,c=2===n,d=i||t.width!==a||t.height!==l,p=u>=a&&h>=l;(c?Nx:Xx)(r,o,t,a,l,u,h,e.resource,d,p),t.width=a,t.height=l}};function Nx(e,t,r,n,s,i,o,a,l,u){if(!u)return l&&e.texImage2D(t,0,r.internalFormat,n,s,0,r.format,r.type,null),void e.texSubImage2D(t,0,0,0,i,o,r.format,r.type,a);l?e.texImage2D(t,0,r.internalFormat,n,s,0,r.format,r.type,a):e.texSubImage2D(t,0,0,0,r.format,r.type,a)}function Xx(e,t,r,n,s,i,o,a,l,u){if(!u)return l&&e.texImage2D(t,0,r.internalFormat,n,s,0,r.format,r.type,null),void e.texSubImage2D(t,0,0,0,r.format,r.type,a);l?e.texImage2D(t,0,r.internalFormat,r.format,r.type,a):e.texSubImage2D(t,0,0,0,r.format,r.type,a)}const Hx=im(),zx={id:"video",upload(e,t,r,n,s,i=Hx){if(!e.isValid){const e=s??t.target;return void r.texImage2D(e,0,t.internalFormat,1,1,0,t.format,t.type,null)}Lx.upload(e,t,r,n,s,i)}},Vx={linear:9729,nearest:9728},Wx={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},$x={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Yx={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function jx(e,t,r,n,s,i,o,a){const l=i;if(!a||"repeat"!==e.addressModeU||"repeat"!==e.addressModeV||"repeat"!==e.addressModeW){const r=$x[o?"clamp-to-edge":e.addressModeU],n=$x[o?"clamp-to-edge":e.addressModeV],i=$x[o?"clamp-to-edge":e.addressModeW];t[s](l,t.TEXTURE_WRAP_S,r),t[s](l,t.TEXTURE_WRAP_T,n),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,i)}if(a&&"linear"===e.magFilter||t[s](l,t.TEXTURE_MAG_FILTER,Vx[e.magFilter]),r){if(!a||"linear"!==e.mipmapFilter){const r=Wx[e.minFilter][e.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,r)}}else t[s](l,t.TEXTURE_MIN_FILTER,Vx[e.minFilter]);if(n&&e.maxAnisotropy>1){const r=Math.min(e.maxAnisotropy,t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,n.TEXTURE_MAX_ANISOTROPY_EXT,r)}e.compare?(t[s](l,t.TEXTURE_COMPARE_FUNC,Yx[e.compare]),t[s](l,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE)):a||t[s](l,t.TEXTURE_COMPARE_MODE,t.NONE)}function qx(e){return{r8unorm:e.RED,r8snorm:e.RED,r8uint:e.RED_INTEGER,r8sint:e.RED_INTEGER,r16uint:e.RED_INTEGER,r16sint:e.RED_INTEGER,r16float:e.RED,rg8unorm:e.RG,rg8snorm:e.RG,rg8uint:e.RG_INTEGER,rg8sint:e.RG_INTEGER,r32uint:e.RED_INTEGER,r32sint:e.RED_INTEGER,r32float:e.RED,rg16uint:e.RG_INTEGER,rg16sint:e.RG_INTEGER,rg16float:e.RG,rgba8unorm:e.RGBA,"rgba8unorm-srgb":e.RGBA,rgba8snorm:e.RGBA,rgba8uint:e.RGBA_INTEGER,rgba8sint:e.RGBA_INTEGER,bgra8unorm:e.RGBA,"bgra8unorm-srgb":e.RGBA,rgb9e5ufloat:e.RGB,rgb10a2unorm:e.RGBA,rg11b10ufloat:e.RGB,rg32uint:e.RG_INTEGER,rg32sint:e.RG_INTEGER,rg32float:e.RG,rgba16uint:e.RGBA_INTEGER,rgba16sint:e.RGBA_INTEGER,rgba16float:e.RGBA,rgba32uint:e.RGBA_INTEGER,rgba32sint:e.RGBA_INTEGER,rgba32float:e.RGBA,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT,depth24plus:e.DEPTH_COMPONENT,"depth24plus-stencil8":e.DEPTH_STENCIL,depth32float:e.DEPTH_COMPONENT,"depth32float-stencil8":e.DEPTH_STENCIL}}function Kx(e,t){let r={},n=e.RGBA;return e instanceof Yt.get().getWebGLRenderingContext()?t.srgb&&(r={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":e.SRGB8_ALPHA8,"bgra8unorm-srgb":e.SRGB8_ALPHA8},n=e.RGBA8),{r8unorm:e.R8,r8snorm:e.R8_SNORM,r8uint:e.R8UI,r8sint:e.R8I,r16uint:e.R16UI,r16sint:e.R16I,r16float:e.R16F,rg8unorm:e.RG8,rg8snorm:e.RG8_SNORM,rg8uint:e.RG8UI,rg8sint:e.RG8I,r32uint:e.R32UI,r32sint:e.R32I,r32float:e.R32F,rg16uint:e.RG16UI,rg16sint:e.RG16I,rg16float:e.RG16F,rgba8unorm:e.RGBA,...r,rgba8snorm:e.RGBA8_SNORM,rgba8uint:e.RGBA8UI,rgba8sint:e.RGBA8I,bgra8unorm:n,rgb9e5ufloat:e.RGB9_E5,rgb10a2unorm:e.RGB10_A2,rg11b10ufloat:e.R11F_G11F_B10F,rg32uint:e.RG32UI,rg32sint:e.RG32I,rg32float:e.RG32F,rgba16uint:e.RGBA16UI,rgba16sint:e.RGBA16I,rgba16float:e.RGBA16F,rgba32uint:e.RGBA32UI,rgba32sint:e.RGBA32I,rgba32float:e.RGBA32F,stencil8:e.STENCIL_INDEX8,depth16unorm:e.DEPTH_COMPONENT16,depth24plus:e.DEPTH_COMPONENT24,"depth24plus-stencil8":e.DEPTH24_STENCIL8,depth32float:e.DEPTH_COMPONENT32F,"depth32float-stencil8":e.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}function Zx(e){return{r8unorm:e.UNSIGNED_BYTE,r8snorm:e.BYTE,r8uint:e.UNSIGNED_BYTE,r8sint:e.BYTE,r16uint:e.UNSIGNED_SHORT,r16sint:e.SHORT,r16float:e.HALF_FLOAT,rg8unorm:e.UNSIGNED_BYTE,rg8snorm:e.BYTE,rg8uint:e.UNSIGNED_BYTE,rg8sint:e.BYTE,r32uint:e.UNSIGNED_INT,r32sint:e.INT,r32float:e.FLOAT,rg16uint:e.UNSIGNED_SHORT,rg16sint:e.SHORT,rg16float:e.HALF_FLOAT,rgba8unorm:e.UNSIGNED_BYTE,"rgba8unorm-srgb":e.UNSIGNED_BYTE,rgba8snorm:e.BYTE,rgba8uint:e.UNSIGNED_BYTE,rgba8sint:e.BYTE,bgra8unorm:e.UNSIGNED_BYTE,"bgra8unorm-srgb":e.UNSIGNED_BYTE,rgb9e5ufloat:e.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:e.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:e.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:e.UNSIGNED_INT,rg32sint:e.INT,rg32float:e.FLOAT,rgba16uint:e.UNSIGNED_SHORT,rgba16sint:e.SHORT,rgba16float:e.HALF_FLOAT,rgba32uint:e.UNSIGNED_INT,rgba32sint:e.INT,rgba32float:e.FLOAT,stencil8:e.UNSIGNED_BYTE,depth16unorm:e.UNSIGNED_SHORT,depth24plus:e.UNSIGNED_INT,"depth24plus-stencil8":e.UNSIGNED_INT_24_8,depth32float:e.FLOAT,"depth32float-stencil8":e.FLOAT_32_UNSIGNED_INT_24_8_REV}}function Qx(e){return{"2d":e.TEXTURE_2D,cube:e.TEXTURE_CUBE_MAP,"1d":null,"3d":e?.TEXTURE_3D||null,"2d-array":e?.TEXTURE_2D_ARRAY||null,"cube-array":e?.TEXTURE_CUBE_MAP_ARRAY||null}}function Jx(e){e instanceof Uint8ClampedArray&&(e=new Uint8Array(e.buffer));const t=e.length;for(let r=0;r<t;r+=4){const t=e[r+3];if(0!==t){const n=255.001/t;e[r]=e[r]*n+.5,e[r+1]=e[r+1]*n+.5,e[r+2]=e[r+2]*n+.5}}}const eb=class e{constructor(t){this._glSamplers=Object.create(null),this._boundTextures=[],this._integerUnits=0,this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._managedTextures=new Pa({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});const r={image:Lx,buffer:Ix,video:zx,compressed:Dx,...e.uploadExtensions};this._uploads={...r,cube:kx(r)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Kx(e,this._renderer.context.extensions),this._mapFormatToType=Zx(e),this._mapFormatToFormat=qx(e),this._mapViewDimensionToGlTarget=Qx(e)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(ee.EMPTY,e)}initSource(e){this.bind(e)}bind(e,t=0){const r=e.source;e?(this.bindSource(r,t),this._useSeparateSamplers&&this._bindSampler(r.style,t)):(this.bindSource(null,t),this._useSeparateSamplers&&this._bindSampler(null,t))}bindSource(e,t=0){const r=this._gl;if(e._gcLastUsed=this._renderer.gc.now,this._boundTextures[t]!==e){this._setBoundTexture(t,e),this._activateLocation(t),e||(e=ee.EMPTY.source);const n=this.getGlSource(e);r.bindTexture(n.target,n.texture)}}unbindIntegerTextures(e){if(e>=32)return;let t=this._integerUnits>>>e<<e;for(;t;){const e=31-Math.clz32(t);t&=~(1<<e),this.bind(ee.EMPTY,e)}}_setBoundTexture(e,t){this._boundTextures[e]=t,e<0||e>31||t&&"2d"===t.viewDimension&&(X(t.format)?this._integerUnits|=1<<e:this._integerUnits&=~(1<<e))}_bindSampler(e,t=0){const r=this._gl;if(!e)return this._boundSamplers[t]=null,void r.bindSampler(t,null);const n=this._getGlSampler(e);this._boundSamplers[t]!==n&&(this._boundSamplers[t]=n,r.bindSampler(t,n))}unbind(e){const t=e.source,r=this._boundTextures,n=this._gl;for(let e=0;e<r.length;e++)if(r[e]===t){this._activateLocation(e);const r=this.getGlSource(t);n.bindTexture(r.target,null),this._setBoundTexture(e,null)}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){const t=this._gl,r=new Gx(t.createTexture());if(r.type=this._mapFormatToType[e.format],r.internalFormat=this._mapFormatToInternalFormat[e.format],r.format=this._mapFormatToFormat[e.format],r.target=this._mapViewDimensionToGlTarget[e.viewDimension],null===r.target)throw new Error(`Unsupported view dimension: ${e.viewDimension} with this webgl version: ${this._renderer.context.webGLVersion}`);if(e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){const t=Math.max(e.width,e.height,e.depth);e.mipLevelCount=Math.floor(Math.log2(t))+1}e._gpuData[this._renderer.uid]=r;return this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),this.updateStyle(e,!1),r}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,t){const r=this._gl,n=this.getGlSource(e);r.bindTexture(n.target,n.texture),this._setBoundTexture(this._activeTextureLocation,e),jx(e.style,r,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",n.target,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,t)}onSourceUnload(e,t=!1){const r=e._gpuData[this._renderer.uid];r&&(t||(this.unbind(e),this._gl.deleteTexture(r.texture)),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(e){const t=this._gl,r=this.getGlSource(e);t.bindTexture(r.target,r.texture),this._setBoundTexture(this._activeTextureLocation,e);const n="premultiply-alpha-on-upload"===e.alphaMode&&!X(e.format)&&r.target!==t.TEXTURE_3D&&r.target!==t.TEXTURE_2D_ARRAY;if(this._premultiplyAlpha!==n&&(this._premultiplyAlpha=n,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n)),this._uploads[e.uploadMethodId])this._uploads[e.uploadMethodId].upload(e,r,t,this._renderer.context.webGLVersion);else if(r.target===t.TEXTURE_2D)this._initEmptyTexture2D(r,e);else if(r.target===t.TEXTURE_2D_ARRAY||r.target===t.TEXTURE_3D)this._initEmptyTexture3D(r,e);else{if(r.target!==t.TEXTURE_CUBE_MAP)throw new Error("[GlTextureSystem] Unsupported texture target for empty allocation.");this._initEmptyTextureCube(r,e)}this._applyMipRange(r,e),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,t=!0){t&&this.bindSource(e,0);const r=this.getGlSource(e);this._gl.generateMipmap(r.target)}_initEmptyTexture2D(e,t){const r=this._gl;r.texImage2D(r.TEXTURE_2D,0,e.internalFormat,t.pixelWidth,t.pixelHeight,0,e.format,e.type,null);let n=Math.max(t.pixelWidth>>1,1),s=Math.max(t.pixelHeight>>1,1);for(let i=1;i<t.mipLevelCount;i++)r.texImage2D(r.TEXTURE_2D,i,e.internalFormat,n,s,0,e.format,e.type,null),n=Math.max(n>>1,1),s=Math.max(s>>1,1)}_initEmptyTexture3D(e,t){const r=this._gl,n=e.target===r.TEXTURE_3D;let s=t.pixelWidth,i=t.pixelHeight,o=t.depthOrArrayLayers;for(let a=0;a<t.mipLevelCount;a++)r.texImage3D(e.target,a,e.internalFormat,s,i,o,0,e.format,e.type,null),s=Math.max(s>>1,1),i=Math.max(i>>1,1),n&&(o=Math.max(o>>1,1))}_initEmptyTextureCube(e,t){const r=this._gl;for(let n=0;n<6;n++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,e.internalFormat,t.pixelWidth,t.pixelHeight,0,e.format,e.type,null);let n=Math.max(t.pixelWidth>>1,1),s=Math.max(t.pixelHeight>>1,1);for(let i=1;i<t.mipLevelCount;i++){for(let t=0;t<6;t++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,e.internalFormat,n,s,0,e.format,e.type,null);n=Math.max(n>>1,1),s=Math.max(s>>1,1)}}_applyMipRange(e,t){if(2!==this._renderer.context.webGLVersion)return;if(t.mipLevelCount<=1)return;const r=this._gl,n=Math.max((0|t.mipLevelCount)-1,0);r.texParameteri(e.target,r.TEXTURE_BASE_LEVEL,0),r.texParameteri(e.target,r.TEXTURE_MAX_LEVEL,n)}_initSampler(e){const t=this._gl,r=this._gl.createSampler();return this._glSamplers[e._resourceId]=r,jx(e,t,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this._initSource(e)}generateCanvas(e){const{pixels:t,width:r,height:n}=this.getPixels(e),s=Yt.get().createCanvas();s.width=r,s.height=n;const i=s.getContext("2d");if(i){const e=i.createImageData(r,n);e.data.set(t),i.putImageData(e,0,0)}return s}getPixels(e){const t=e.source.resolution,r=e.frame,n=Math.max(Math.round(r.width*t),1),s=Math.max(Math.round(r.height*t),1),i=new Uint8Array(4*n*s),o=this._renderer,a=o.renderTarget.getRenderTarget(e),l=o.renderTarget.getGpuRenderTarget(a),u=o.gl;return o.renderTarget.adaptor.bindFramebuffer(l.resolveTargetFramebuffer),u.readPixels(Math.round(r.x*t),Math.round(r.y*t),n,s,u.RGBA,u.UNSIGNED_BYTE,i),{pixels:new Uint8ClampedArray(i.buffer),width:n,height:s}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){const e=this._renderer.limits.maxTextures;this._activeTextureLocation=-1,this._boundTextures.fill(null),this._integerUnits=e>=32?-1:(1<<e)-1,this._boundSamplers=Object.create(null);const t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};eb.extension={type:[e.WebGLSystem],name:"texture"},eb.uploadExtensions=Object.create(null);let tb=eb;n.handleByMap(e.TextureUploaderWebGL,tb.uploadExtensions);class rb{contextChange(e){const t=new On({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new _,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),r=e.limits.maxBatchableTextures,n=da({name:"graphics",bits:[fa,va(r),tp,Sa]});this.shader=new Ln({glProgram:n,resources:{localUniforms:t,batchSamplers:Ea(r)}})}execute(e,t){const r=t.context,n=r.customShader||this.shader,s=e.renderer,i=s.graphicsContext,{batcher:o,instructions:a}=i.getContextRenderData(r);n.groups[0]=s.globalUniforms.bindGroup,s.state.set(e.state),s.shader.bind(n),s.geometry.bind(o.geometry,n.glProgram);const l=a.instructions;for(let e=0;e<a.instructionSize;e++){const t=l[e];if(t.size){for(let e=0;e<t.textures.count;e++)s.texture.bind(t.textures.textures[e],e);s.texture.unbindIntegerTextures(t.textures.count),s.geometry.draw(t.topology,t.size,t.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}rb.extension={type:[e.WebGLPipesAdaptor],name:"graphics"};class nb{init(){const e=da({name:"mesh",bits:[tp,Mm,Sa]});this._shader=new Ln({glProgram:e,resources:{uTexture:ee.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new _}}}})}execute(e,t){const r=e.renderer;let n=t._shader;if(n){if(!n.glProgram)return void Oe("Mesh shader has no glProgram",t.shader)}else{n=this._shader;const e=t.texture,r=e.source;n.resources.uTexture=r,n.resources.uSampler=r.style,n.resources.textureUniforms.uniforms.uTextureMatrix=e.textureMatrix.mapCoord}n.groups[100]=r.globalUniforms.bindGroup,n.groups[101]=e.localUniformsBindGroup,r.encoder.draw({geometry:t._geometry,shader:n,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}nb.extension={type:[e.WebGLPipesAdaptor],name:"mesh"};const sb=[...jg,W_,C_,m_,G_,p_,tb,Y_,E_,xx,fx,P_,Px,I_,M_],ib=[...qg],ob=[ym,nb,rb],ab=[],lb=[],ub=[],hb=[];n.handleByNamedList(e.WebGLSystem,ab),n.handleByNamedList(e.WebGLPipes,lb),n.handleByNamedList(e.WebGLPipesAdaptor,ub),n.handleByNamedList(e.WebGLLoader,hb),n.add(...sb,...ib,...ob);class cb extends hi{constructor(){super({name:"webgl",type:Un.WEBGL,systems:ab,renderPipes:lb,renderPipeAdaptors:ub,loaders:hb})}}var db=Object.freeze({__proto__:null,WebGLRenderer:cb});class pb{constructor(e,t){this.autoGarbageCollect=!0,this._gpuData=null,this.gpuBindGroup=e,this._gcLastUsed=t}unload(){this.gpuBindGroup=null}}class fb{constructor(e){this._hash=Object.create(null),this._renderer=e,e.gc.addResourceHash(this,"_hash","resource"),e.gc.addCollection(this,"_hash","hash")}contextChange(e){this._gpu=e,this._hash=Object.create(null)}getBindGroup(e,t,r){const n=`${e._key}:${t._layoutKey<<4|r}`,s=this._hash[n];return s?(s._gcLastUsed=this._renderer.gc.now,s.gpuBindGroup):this._createBindGroup(n,e,t,r)}_createBindGroup(e,t,r,n){const s=this._gpu.device,i=r.layout[n],o=[],a=this._renderer;for(const e in i){const r=t.resources[e]??t.resources[i[e]];if(!r||r.destroyed)throw new Error(`[BindGroup] the resource bound as '${e}' was destroyed while a shader still uses it. Remove it from the shader before destroying it.`);let n;if("uniformGroup"===r._resourceType){const e=r;a.ubo.updateUniformGroup(e);const t=e.buffer;n={buffer:a.buffer.getGPUBuffer(t),offset:0,size:t.descriptor.size}}else if("buffer"===r._resourceType){const e=r;n={buffer:a.buffer.getGPUBuffer(e),offset:0,size:e.descriptor.size}}else if("bufferResource"===r._resourceType){const e=r;n={buffer:a.buffer.getGPUBuffer(e.buffer),offset:e.offset,size:e.size??e.buffer.descriptor.size}}else if("textureSampler"===r._resourceType){const e=r;n=a.texture.getGpuSampler(e)}else if("textureSource"===r._resourceType){const e=r;n=a.texture.getTextureView(e)}else if("textureView"===r._resourceType){const e=r;n=a.texture.getTextureView(e.source,e.viewDescriptor)}o.push({binding:i[e],resource:n})}const l=a.shader.getProgramData(r).bindGroups[n],u=s.createBindGroup({layout:l,entries:o});return this._hash[e]=new pb(u,a.gc.now),u}destroy(){this._hash=null,this._renderer=null}}fb.extension={type:[e.WebGPUSystem],name:"bindGroup"};class mb{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class gb{constructor(e){this._renderer=e,this._managedBuffers=new Pa({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e,this.destroyAll()}getGPUBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuBuffer||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,e._updateOffset,r.buffer,r.byteOffset+e._updateOffset,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(_o(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new mb(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}gb.extension={type:[e.WebGPUSystem],name:"buffer"};class _b{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error("UniformBufferBatch: array is too large: "+4*e);const t=this.byteIndex;let r=t+4*e;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>4*this.data.length)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class xb{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}xb.extension={type:[e.WebGPUSystem],name:"colorMask"};const bb=new Set(["apple","arm","qualcomm","img-tec"]);class yb{constructor(e){this._renderer=e}async init(e){return this._initPromise||(this._options=e,this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(e=>this._setGpu(e))),this._initPromise}_setGpu(e){this.gpu=e,this.extensions={transientAttachment:"number"==typeof GPUTextureUsage.TRANSIENT_ATTACHMENT,tileBased:bb.has(e.adapter?.info?.vendor)},this._options.gpu||e.device.lost.then(()=>this._restoreDevice()).catch(e=>Oe("WebGPU device was lost and could not be restored",e)),this._renderer.runners.contextChange.emit(this.gpu)}async _restoreDevice(){if(!this._renderer)return;const e=await this._createDeviceAndAdaptor(this._options);this._renderer?this._setGpu(e):e.device.destroy()}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await Yt.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter});if(!t)throw new Error("WebGPU not supported. No GPU adapter was returned by navigator.gpu.requestAdapter().");const r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2","indirect-first-instance","bgra8unorm-storage","texture-formats-tier1"].filter(e=>t.features.has(e)),n=await t.requestDevice({requiredFeatures:r,requiredLimits:{maxSampledTexturesPerShaderStage:t.limits.maxSampledTexturesPerShaderStage,maxSamplersPerShaderStage:t.limits.maxSamplersPerShaderStage}});return{adapter:t,device:n}}destroy(){this._options?.gpu||this.gpu?.device.destroy(),this.gpu=null,this.extensions=null,this._renderer=null}}yb.extension={type:[e.WebGPUSystem],name:"device"},yb.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class vb{constructor(e,t,r,n){this.gpuBundle=e,this.stateKey=t,this.device=r,this.label=n}}class Tb{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e;for(let e=0;e<16;e++)this._boundBindGroup[e]={bindGroup:null,program:null,key:null}}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){return this.endRenderPass(),this._clearCache(),this._passEncoder=this.commandEncoder.beginRenderPass(e.descriptor),this.renderPassEncoder=this._passEncoder,this._passEncoder}endRenderPass(){this._passEncoder&&this._passEncoder.end(),this.renderPassEncoder=null,this._passEncoder=null}beginBundle(e){if(this._passEncoder!==this.renderPassEncoder)throw new Error("Cannot begin a new render bundle while one is already being recorded.");this._clearCache();const t=this._renderer.pipeline,r=t.getBundleDescriptor();r.label=e,this._bundleStateKey=t.bundleStateKey,this._bundleLabel=e,this.renderPassEncoder=this._gpu.device.createRenderBundleEncoder(r)}endBundle(){const e=this.renderPassEncoder;if(!e||!("finish"in e))throw new Error("endBundle called without an active render bundle.");const t=e.finish({label:this._bundleLabel});return this.renderPassEncoder=this._passEncoder,this._clearCache(),new vb(t,this._bundleStateKey,this._gpu.device,this._bundleLabel)}isBundleValid(e){return e?.stateKey===this._renderer.pipeline.bundleStateKey&&e.device===this._gpu.device}executeBundle(e){const t=[];if(Array.isArray(e))for(let r=0;r<e.length;r++)t[r]=this._getGpuBundle(e[r]);else t[0]=this._getGpuBundle(e);this._clearCache(),this._passEncoder.executeBundles(t)}_getGpuBundle(e){return this.isBundleValid(e)||Oe(`Render bundle ${e?.label??"(unlabeled)"} was recorded against a different render target state or on a lost device. Re-record it — replaying it will either be rejected by WebGPU or draw with the wrong winding. Check encoder.isBundleValid(bundle) before executing.`),e.gpuBundle}setViewport(e){this._passEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setStencilReference(e){this._passEncoder.setStencilReference(e)}setPipelineFromGeometryProgramAndState(e,t,r,n,s){const i=this._renderer.pipeline.getPipeline(e,t,r,n,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=2===e.data.BYTES_PER_ELEMENT?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){const t=this._boundBindGroup[e];t.bindGroup=null,t.program=null,t.key=null}setBindGroup(e,t,r){const n=this._boundBindGroup[e];if(n.bindGroup===t&&n.program===r&&n.key===t._key)return;n.bindGroup=t,n.program=r,n.key=t._key,t._touch(this._renderer.gc.now);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(let t=0;t<r.length;t++)this._setVertexBuffer(t,e.attributes[r[t]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){const r=e.gpuProgram,n=r.layout;for(let s=0;s<n.length;s++){const i=e.groups[s];n[s]&&i&&(t||this._syncBindGroup(i),this.setBindGroup(s,i,r))}}_syncBindGroup(e){const t=e.resources,r=e._resourceKeys;for(let e=0;e<r.length;e++){const n=t[r[e]];n&&(n.isUniformGroup&&this._renderer.ubo.updateUniformGroup(n))}}draw(e){const{geometry:t,shader:r,state:n,topology:s,size:i,start:o,baseVertex:a,instanceCount:l,skipSync:u,firstInstance:h}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,n,s,r._overrides),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,u),t.indexBuffer?this.renderPassEncoder.drawIndexed(i||t.indexCount||t.indexBuffer.data.length,l??t.instanceCount,o||0,a||0,h||0):this.renderPassEncoder.draw(i||t.vertexCount,l??t.instanceCount,o||0,h||0)}drawIndirect(e){const{geometry:t,shader:r,state:n,topology:s,skipSync:i,indirectBuffer:o,indirectOffset:a}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,n,s,r._overrides),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,i),t.indexBuffer?this.renderPassEncoder.drawIndexedIndirect(o,a):this.renderPassEncoder.drawIndirect(o,a)}finishRenderPass(){this._passEncoder&&(this._passEncoder.end(),this.renderPassEncoder=null,this._passEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}_clearCache(){for(let e=0;e<16;e++){const t=this._boundBindGroup[e];t.bindGroup=null,t.program=null,t.key=null,this._boundVertexBuffer[e]=null}this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null,this.renderPassEncoder=null,this._passEncoder=null}contextChange(e){this._gpu=e}}Tb.extension={type:[e.WebGPUSystem],name:"encoder",priority:1};class Sb{constructor(e){this.supportsOverrideConstants=!1,this._renderer=e}contextChange(){const e=this._renderer.device.gpu.device;this.maxTextures=Math.min(e.limits.maxSampledTexturesPerShaderStage,e.limits.maxSamplersPerShaderStage),this.maxBatchableTextures=this.maxTextures,this._detectOverrideConstantsSupport(e)}_detectOverrideConstantsSupport(e){e.pushErrorScope("validation");const t=e.createShaderModule({code:"override TEST_VALUE: f32 = 0.0;\n@compute @workgroup_size(1) fn main() {}"});e.createComputePipeline({layout:"auto",compute:{module:t,entryPoint:"main",constants:{TEST_VALUE:1}}}),e.popErrorScope().then(e=>{this.supportsOverrideConstants=!e})}destroy(){}}Sb.extension={type:[e.WebGPUSystem],name:"limits"};class wb{constructor(e){this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}contextChange(){this._activeGpuRenderTarget=null}onRenderTargetChange(e){const t=this._renderer.renderTarget.getGpuRenderTarget(e);this._activeRenderTarget=e,this._activeGpuRenderTarget=t,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._activeGpuRenderTarget??(this._activeGpuRenderTarget=this._renderer.renderTarget.getGpuRenderTarget(this._activeRenderTarget));r.stencilMode=e,r.stencilReference=t;const n=this._renderer;n.pipeline.setStencilMode(e),n.encoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._activeGpuRenderTarget=null}}wb.extension={type:[e.WebGPUSystem],name:"stencil"};const Eb={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function Ab(e){const t=e.map(e=>({data:e,offset:0,size:0}));let r=0;for(let e=0;e<t.length;e++){const n=t[e];let s=Eb[n.data.type].size;const i=Eb[n.data.type].align;if(!Eb[n.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${n.data.type}`);n.data.size>1&&(s=Math.max(s,i)*n.data.size),r=Math.ceil(r/i)*i,n.size=s,n.offset=r,r+=s}return r=16*Math.ceil(r/16),{uboElements:t,size:r}}function Rb(e,t){const{size:r,align:n}=Eb[e.data.type],s=(Math.max(r,n)-r)/4,i=e.data.type.indexOf("i32")>=0?"dataInt32":"data";return`\n v = uv.${e.data.name};\n ${0!==t?`offset += ${t};`:""}\n\n arrayOffset = offset;\n\n t = 0;\n\n for(var i=0; i < ${e.data.size}; i++)\n {\n for(var j = 0; j < ${r/4}; j++)\n {\n ${i}[arrayOffset++] = v[t++];\n }\n ${0!==s?`arrayOffset += ${s};`:""}\n }\n `}function Cb(e){return L_(e,H_,Rb)}class Mb extends O_{constructor(){super({createUboElements:Ab,generateUboSync:Cb})}}Mb.extension={type:[e.WebGPUSystem],name:"ubo"};const Pb=128;class Gb{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new _b({minUniformOffsetAlignment:Pb});for(let e=0;e<2;e++){let t=Oo.UNIFORM|Oo.COPY_DST;0===e&&(t|=Oo.COPY_SRC),this._buffers.push(new Do({data:this._batchBuffer.data,usage:t}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){this._bindGroupHash=Object.create(null),this._batchBuffer.clear()}getUniformBindGroup(e,t){if(!t&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);const r=e.buffer.data,n=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,n/4),this._bindGroupHash[e.uid]=this._getBindGroup(n/Pb),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);const t=e.buffer.data,r=this._batchBuffer.addGroup(t);return this._getBufferResource(r/Pb)}getArrayBindGroup(e){const t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/Pb)}getArrayBufferResource(e){const t=this._batchBuffer.addGroup(e)/Pb;return this._getBufferResource(t)}_getBufferResource(e){if(!this._bufferResources[e]){const t=this._buffers[e%2];this._bufferResources[e]=new j_({buffer:t,offset:256*(e/2|0),size:Pb})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){const t=new Dn({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){const e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);const r=this._renderer.gpu.device.createCommandEncoder();for(let n=1;n<this._buffers.length;n++){const s=this._buffers[n];r.copyBufferToBuffer(e.getGPUBuffer(t),Pb,e.getGPUBuffer(s),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let e=0;e<this._bindGroups.length;e++)this._bindGroups[e]?.destroy();this._bindGroups=null,this._bindGroupHash=null;for(let e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers=null;for(let e=0;e<this._bufferResources.length;e++)this._bufferResources[e].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._renderer=null}}Gb.extension={type:[e.WebGPUPipes],name:"uniformBatch"};const Bb={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4},Fb=new kn({}),Ib={"depth24plus-stencil8":{depth:!0,stencil:!0,index:1},depth24plus:{depth:!0,stencil:!1,index:2},depth32float:{depth:!0,stencil:!1,index:3},"depth32float-stencil8":{depth:!0,stencil:!0,index:4},depth16unorm:{depth:!0,stencil:!1,index:5},stencil8:{depth:!1,stencil:!0,index:6}},Ob={depth:!1,stencil:!1,index:0};function Db(e,t){for(const[r,n]of Object.entries(t)){const t=new RegExp(`override\\s+${r}\\s*:\\s*(\\w+)\\s*(?:=[^;]*)?;`);e=e.replace(t,(e,t)=>{let s;return s="u32"===t?`${Math.trunc(n)}u`:"i32"===t?`${Math.trunc(n)}`:Number.isInteger(n)?`${n}.0`:`${n}`,`const ${r}: ${t} = ${s};`})}return e}function Ub(e,t,r,n,s,i){return 35184372088832*e+536870912*t+16384*i+(r<<8)+(n<<3)+s}const kb=Object.create(null);let Lb=0;function Nb(e){let t=kb[e];return void 0===t&&(t=kb[e]=Lb++),t}class Xb{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=new Map,this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._colorTargetCount=1,this._colorFormat="bgra8unorm",this._colorFormatId=Nb("bgra8unorm"),this._depthStencilFormat="depth24plus-stencil8",this._depthStencilFormatData=Ob,this._depthReadOnly=!1,this._stencilReadOnly=!1,this._invertFrontFace=!1,this._renderer=e}contextChange(e){this._gpu=e,this._moduleCache=Object.create(null),this._pipeStateCaches=Object.create(null),this.setStencilMode(bo.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){const t=e.colorAttachments[0]?.texture;this._multisampleCount=t?.source.antialias?4:1,this._colorTargetCount=e.colorAttachments.length,this._colorFormat=t?.format??"bgra8unorm",this._colorFormatId=Nb(this._colorFormat),this._depthStencilFormat=e.depthStencilAttachment?.texture.format,this._depthStencilFormatData=Ib[this._depthStencilFormat]||Ob,this._depthReadOnly=e.depthStencilAttachment?.depthReadOnly??!1,this._stencilReadOnly=e.depthStencilAttachment?.stencilReadOnly??this._depthReadOnly,this._invertFrontFace=this._renderer.renderTarget.isFrontFaceInverted(e,e.flipY),this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=F_[e],this._updatePipeHash())}get bundleStateKey(){const e=this._depthStencilFormatData;return t=1===this._multisampleCount?0:1,r=this._colorTargetCount,n=e.index,s=e.depth&&this._depthReadOnly?1:0,i=e.stencil&&this._stencilReadOnly?1:0,o=this._invertFrontFace?1:0,this._colorFormatId<<11|o<<10|i<<9|s<<8|n<<5|r<<1|t;var t,r,n,s,i,o}getBundleDescriptor(){const e=[];for(let t=0;t<this._colorTargetCount;t++)e.push(this._colorFormat);const t={colorFormats:e,sampleCount:this._multisampleCount},r=this._depthStencilFormatData;return(r.depth||r.stencil)&&(t.depthStencilFormat=this._depthStencilFormat,r.depth&&this._depthReadOnly&&(t.depthReadOnly=!0),r.stencil&&this._stencilReadOnly&&(t.stencilReadOnly=!0)),t}setPipeline(e,t,r,n){const s=this.getPipeline(e,t,r);n.setPipeline(s)}getPipelineKey(e,t,r,n,s){return e._layoutKey||(g_(e,t.attributeData),this._generateBufferKey(e)),Ub(e._layoutKey,t._layoutKey,r.data,r._blendModeId,Bb[n],s.id)}getPipeline(e,t,r,n,s){e._layoutKey||(g_(e,t.attributeData),this._generateBufferKey(e)),n||(n=e.topology),s||(s=Fb);const i=Ub(e._layoutKey,t._layoutKey,r.data,r._blendModeId,Bb[n],s.id);let o=this._pipeCache.get(i);return o||(o=this._createPipeline(e,t,r,n,s),this._pipeCache.set(i,o)),o}_createPipeline(e,t,r,n,s){const i=this._gpu.device,o=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(r,this._colorTargetCount,this._colorFormat),l=this._stencilMode===bo.RENDERING_MASK_ADD?0:this._colorMask;for(let e=0;e<a.length;e++)a[e].writeMask=l;const u=this._renderer.shader.getProgramData(t).pipeline,h=Object.keys(s.data).length>0;let c,d=t.vertex.source,p=t.fragment.source;h&&(this._renderer.limits.supportsOverrideConstants?c=s.data:(d=Db(d,s.data),p=Db(p,s.data)));const f={vertex:{module:this._getModule(d),entryPoint:t.vertex.entryPoint,constants:c,buffers:o},fragment:{module:this._getModule(p),entryPoint:t.fragment.entryPoint,targets:a,constants:c},primitive:{topology:n,cullMode:r.culling?"back":"none",frontFace:r.clockwiseFrontFace!==this._invertFrontFace?"cw":"ccw"},layout:u,multisample:{count:this._multisampleCount},label:t.name?`PIXI Pipeline (${t.name})`:"PIXI Pipeline"};if(this._depthStencilFormatData.depth||this._depthStencilFormatData.stencil){const e=this._depthStencilFormatData;f.depthStencil={...this._stencilState,format:this._depthStencilFormat,depthWriteEnabled:!!e.depth&&(r.depthMask&&!this._depthReadOnly),depthCompare:e.depth&&r.depthTest?"less":"always"}}return i.createRenderPipeline(f)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){const t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){const t=[];let r=0;const n=Object.keys(e.attributes).sort();for(let s=0;s<n.length;s++){const i=e.attributes[n[s]];t[r++]=i.offset,t[r++]=i.format,t[r++]=i.stride,t[r++]=i.instance}const s=t.join("|");return e._layoutKey=Zr(s,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){const t=[];let r=0;const n=Object.keys(e.attributeData).sort();for(let s=0;s<n.length;s++){const i=e.attributeData[n[s]];t[r++]=i.location}const s=t.join("|");return e._attributeLocationsKey=Zr(s,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,t){const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];const n=this._createVertexBufferLayouts(e,t),s=[],i=t.attributeData;for(let e=0;e<n.length;e++){const t=Object.values(n[e].attributes)[0].shaderLocation;for(const r in i)if(i[r].location===t){s[e]=r;break}}return this._bindingNamesCache[r]=s,s}_createVertexBufferLayouts(e,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];const n=[];return e.buffers.forEach(r=>{const s={arrayStride:0,stepMode:"vertex",attributes:[]},i=s.attributes;for(const n in t.attributeData){const o=e.attributes[n];1!==(o.divisor??1)&&Oe(`Attribute ${n} has an invalid divisor value of '${o.divisor}'. WebGPU only supports a divisor value of 1`),o.buffer===r&&(s.arrayStride=o.stride,s.stepMode=o.instance?"instance":"vertex",i.push({shaderLocation:t.attributeData[n].location,offset:o.offset,format:o.format}))}i.length&&n.push(s)}),this._bufferLayoutsCache[r]=n,n}_updatePipeHash(){var e;const t=(r=this._stencilMode,n=1===this._multisampleCount?0:1,s=this._colorMask,i=this._colorTargetCount,o=this._depthStencilFormatData.index,a=this._colorFormatId,l=this._depthReadOnly?1:0,(this._invertFrontFace?1:0)<<20|a<<16|o<<13|s<<9|r<<6|l<<5|i<<1|n);var r,n,s,i,o,a,l;this._pipeCache=(e=this._pipeStateCaches)[t]??(e[t]=new Map)}destroy(){this._bufferLayoutsCache=null,this._pipeCache=null,this._gpu=null,this._renderer=null,this._bindingNamesCache=null,this._pipeStateCaches=null,this._moduleCache=null}}Xb.extension={type:[e.WebGPUSystem],name:"pipeline"};class Hb{constructor(e){this._pipelines=Object.create(null),this._modules=Object.create(null),this._bindGroups=new WeakMap,this._renderer=e,this._device=e.gpu.device,this._layout=this._device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"unfilterable-float"}}]}),this._pipelineLayout=this._device.createPipelineLayout({bindGroupLayouts:[this._layout]})}copy(e,t,r,n){var s;const i=this._renderer.renderTarget.getGpuRenderTarget(t),o=t.colorAttachments[r].texture;(s=i.msaaBackTextures)[r]??(s[r]=new K({label:"msaa-back-texture",width:o.width,height:o.height,resolution:o._resolution,format:i.msaaTextures[r].format,autoGenerateMipmaps:!1,autoGarbageCollect:!0}));const a=this._renderer.texture.getGpuSource(i.msaaBackTextures[r]);e.copyTextureToTexture({texture:n},{texture:a},{width:Math.min(n.width,a.width),height:Math.min(n.height,a.height)})}draw(e,t,r){var n;const s=this._renderer.renderTarget.getGpuRenderTarget(t),i=this._renderer.texture.getGpuSource(s.msaaBackTextures[r]);let o=t.depthStencilAttachment?.texture.format??"";for(const e of t.colorAttachments)o+=`|${e.texture.format}`;const a=(n=this._pipelines)[o]??(n[o]=[]);let l=this._bindGroups.get(i);l||(l=this._device.createBindGroup({layout:this._layout,entries:[{binding:0,resource:i.createView()}]}),this._bindGroups.set(i,l)),e.setPipeline(a[r]??(a[r]=this._createPipeline(t,r))),e.setBindGroup(0,l),e.draw(3)}_getModule(e){var t;return(t=this._modules)[e]??(t[e]=this._device.createShaderModule({label:"msaa-restore",code:`\n @group(0) @binding(0) var resolved: texture_2d<f32>;\n\n @vertex\n fn vertexMain(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> {\n let pos = array<vec2<f32>, 3>(vec2<f32>(-1.0, -1.0), vec2<f32>(3.0, -1.0), vec2<f32>(-1.0, 3.0));\n\n return vec4<f32>(pos[i], 0.0, 1.0);\n }\n\n @fragment\n fn fragmentMain(@builtin(position) position: vec4<f32>) -> @location(${e}) vec4<f32> {\n return textureLoad(resolved, vec2<i32>(position.xy), 0);\n }\n `})),this._modules[e]}_createPipeline(e,t){const r=e.depthStencilAttachment?.texture.format;let n;r&&(n={format:r},r.includes("depth")&&(n.depthWriteEnabled=!1,n.depthCompare="always"));const s=this._getModule(t);return this._device.createRenderPipeline({label:"msaa-restore",layout:this._pipelineLayout,vertex:{module:s,entryPoint:"vertexMain"},fragment:{module:s,entryPoint:"fragmentMain",targets:e.colorAttachments.map((e,r)=>({format:e.texture.format,writeMask:r===t?GPUColorWrite.ALL:0}))},depthStencil:n,multisample:{count:4}})}}class zb{constructor(){this.contexts=[],this.canvasTextures=[],this.msaaTextures=[],this.transient=!1,this.msaaSamples=1,this.msaaBackTextures=[],this.stencilMode=bo.DISABLED,this.stencilReference=0,this.maskStackIndex=0}}const Vb={bgra8unorm:!0,rgba8unorm:!0,rgba16float:!0};class Wb{constructor(){this._activePass=null}init(e,t){this._renderer=e,this._renderTargetSystem=t,e.runners.contextChange.add(this),e.runners.destroy.add(this)}contextChange(){this._msaaRestore=null}destroy(){this._msaaRestore=null}copyToTexture(e,t,r,n,s){const i=this._renderer;this.finishRenderPass();const o=this._getGpuColorTexture(e),a=i.texture.getGpuSource(t.source);return i.encoder.commandEncoder.copyTextureToTexture({texture:o,origin:r},{texture:a,origin:s},n),t}copyDepthTexture(e,t,r,n,s){const i=this._renderer;this.finishRenderPass();const o=e.depthStencilAttachment.texture,a=i.texture.getGpuSource(o),l=i.texture.getGpuSource(t.source),u=null===i.encoder.commandEncoder,h=u?i.gpu.device.createCommandEncoder():i.encoder.commandEncoder;h.copyTextureToTexture({texture:a,origin:r},{texture:l,origin:s},{width:n.width,height:n.height}),u&&i.gpu.device.queue.submit([h.finish()])}startRenderPass(e,t=!0,r,n,s=0,i=0){const o=this._renderTargetSystem.getGpuRenderTarget(e);if(0!==i&&o.msaaTextures?.length)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported with MSAA render targets.");if(s>0&&o.msaaTextures?.length)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");let a=t;"boolean"==typeof a&&(a=a?si.ALL:si.NONE),!e.stencil&&!e.depth||e.depthStencilAttachment||e.ensureDepthStencilTexture();const l=!!e.depthStencilAttachment,u=this._activePass,h=null!==u&&u.renderTarget===e&&u.mipLevel===s&&u.layer===i&&u.depthStencil===l&&null!==this._renderer.encoder.renderPassEncoder&&a===si.NONE;if(this._renderer.pipeline.setRenderTarget(e),h)return void this._renderer.encoder.setViewport(n);const{descriptor:c,restore:d}=this._buildDescriptor(e,t,r,s,i);o.descriptor=c;const p=this._renderer.encoder;d?(p.endRenderPass(),this._beginRestoredPass(e,d,p.commandEncoder,()=>p.beginRenderPass(o))):p.beginRenderPass(o),p.setViewport(n),this._activePass={renderTarget:e,mipLevel:s,layer:i,depthStencil:l}}finishRenderPass(){this._renderer.encoder.endRenderPass(),this._activePass=null}_beginRestoredPass(e,t,r,n){const s=this._msaaRestore??(this._msaaRestore=new Hb(this._renderer));for(const n of t)s.copy(r,e,n,this._getGpuColorTexture(e,n));const i=n();for(const r of t)s.draw(i,e,r);return i}_getGpuColorTexture(e,t=0){if(0===e.colorAttachments.length)throw new Error("[GpuRenderTargetAdaptor] cannot get gpu color texture from a depth-only render target");const r=e.colorAttachments[t].texture;return r instanceof jt&&r._gpuContext?r._gpuContext.getCurrentTexture():this._renderer.texture.getGpuSource(r)}getDescriptor(e,t,r,n=0,s=0){return this._buildDescriptor(e,t,r,n,s).descriptor}_buildDescriptor(e,t,r,n=0,s=0){let i=null;"boolean"==typeof t&&(t=t?si.ALL:si.NONE);const o=this._renderTargetSystem,a=o.getGpuRenderTarget(e),l=e.colorAttachments.map((e,l)=>{const u=e.texture,h=u instanceof jt?u._gpuContext:null;let c,d,p=!1;if(h){if(0!==s)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported for canvas targets.");const t=h.getCurrentTexture();p=a.canvasTextures[l]!==t,a.canvasTextures[l]=t;c=t.createView(e.viewDescriptor)}else c=this._renderer.texture.getTextureRenderTargetView(e.texture,n,s,e.viewDescriptor);const f=a.msaaTextures[l];f&&(d=c,c=this._renderer.texture.getTextureView(f));let m=e.loadOp;void 0!==t&&(m=t&si.COLOR?"clear":"load"),r??(r=o.defaultClearColor);const g=!!f?.transient,_=g&&"clear"!==m;_&&(m="clear",_&&!p&&(i??(i=[])).push(l));const x={view:c,resolveTarget:d,storeOp:g?"discard":e.storeOp??"store",loadOp:m};"3d"===u.dimension&&(x.depthSlice=s),_?x.clearValue=[0,0,0,0]:"clear"===m&&(r??(r=e.clearValue??o.defaultClearColor),x.clearValue=r);for(const t in e)"texture"!==t&&"viewDescriptor"!==t&&"clearValue"!==t&&"loadOp"!==t&&"storeOp"!==t&&(x[t]=e[t]);return x});let u;if(e.depthStencilAttachment){this._prepareDepthStencil(e,a);const r=e.depthStencilAttachment,i=r.texture.format.includes("stencil"),o=r.texture.format.includes("depth"),l=a.transient?"discard":"store",h=a.transient?"clear":"load";u={view:this._renderer.texture.getTextureRenderTargetView(r.texture,n,s,r.viewDescriptor)};const c=r.depthReadOnly??!1,d=r.stencilReadOnly??c;i&&!d?(u.stencilLoadOp=t&si.STENCIL?"clear":r.stencilLoadOp??h,u.stencilStoreOp=r.stencilStoreOp??l,"clear"===u.stencilLoadOp&&(u.stencilClearValue=r.stencilClearValue??0)):i&&d&&(u.stencilReadOnly=!0),o&&!c?(u.depthLoadOp=t&si.DEPTH?"clear":r.depthLoadOp??h,u.depthStoreOp=r.depthStoreOp??l,"clear"===u.depthLoadOp&&(u.depthClearValue=r.depthClearValue??1)):o&&c&&(u.depthReadOnly=!0);for(const e in r)"texture"!==e&&"viewDescriptor"!==e&&"stencilLoadOp"!==e&&"stencilStoreOp"!==e&&"stencilClearValue"!==e&&"stencilReadOnly"!==e&&"depthLoadOp"!==e&&"depthStoreOp"!==e&&"depthClearValue"!==e&&"depthReadOnly"!==e&&(u[e]=r[e])}return{descriptor:{colorAttachments:l,depthStencilAttachment:u,label:e.label},restore:i}}clear(e,t=!0,r,n,s=0,i=0){if(!t)return;const{gpu:o,encoder:a}=this._renderer,l=o.device;if(null===a.commandEncoder){const o=l.createCommandEncoder(),{descriptor:a,restore:u}=this._buildDescriptor(e,t,r,s,i),h=()=>o.beginRenderPass(a),c=u?this._beginRestoredPass(e,u,o,h):h();c.setViewport(n.x,n.y,n.width,n.height,0,1),c.end();const d=o.finish();l.queue.submit([d])}else this.startRenderPass(e,t,r,n,s,i)}initGpuRenderTarget(e){e.isRoot=!0;const t=new zb;return t.transient=!!e.colorTexture?.antialias&&!!e.colorTexture.transient,e.colorAttachments.forEach((e,r)=>{const n=e.texture;if(n instanceof jt){const e=n._gpuContext??(n._gpuContext=n.resource.getContext("webgpu")),s=n.transparent?"premultiplied":"opaque",i=function(e){if(Vb[e])return e;const t=navigator.gpu.getPreferredCanvasFormat();return Oe(`[WebGPU] CanvasSource format '${e}' is not a valid GPUCanvasContext format. Falling back to '${t}'. Allowed formats are: bgra8unorm, rgba8unorm, rgba16float.`),t}(n.format);try{e.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:i,alphaMode:s,..."rgba16float"===i?{toneMapping:{mode:"extended"}}:{}})}catch(e){console.error(e)}t.contexts[r]=e}if(t.msaa=n.source.antialias,n.antialias){const e=new K({width:0,height:0,sampleCount:4,autoGenerateMipmaps:!1,transient:this._renderer.device.extensions.tileBased||t.transient,arrayLayerCount:n.arrayLayerCount,format:n.format});t.msaaTextures[r]=e}}),t.msaa&&(t.msaaSamples=4),t}_prepareDepthStencil(e,t){const r=e.depthStencilAttachment?.texture;r&&t.msaa&&(r.sampleCount=4,r.transient=t.transient)}destroyGpuRenderTarget(e){e.contexts.forEach(e=>{e.unconfigure()}),e.msaaTextures.forEach(e=>{e.destroy()}),e.msaaBackTextures.forEach(e=>{e?.destroy()}),e.msaaTextures.length=0,e.msaaBackTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){this._prepareDepthStencil(e,this._renderTargetSystem.getGpuRenderTarget(e))}resizeGpuRenderTarget(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorAttachments.forEach((e,r)=>{const n=e.texture;t.msaaTextures[r]?.resize(n.width,n.height,n._resolution),t.msaaBackTextures[r]?.resize(n.width,n.height,n._resolution)})}}class $b extends Qg{constructor(e){super(e),this.adaptor=new Wb,this.adaptor.init(e,this)}}$b.extension={type:[e.WebGPUSystem],name:"renderTarget"};class Yb{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e,this._gpuProgramData=Object.create(null)}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){const t=this._gpu.device,r=e.gpuLayout.map(e=>t.createBindGroupLayout({entries:e})),n={bindGroupLayouts:r};return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout(n)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}Yb.extension={type:[e.WebGPUSystem],name:"shader"};const jb={normal:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},add:{alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},multiply:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},screen:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},overlay:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},none:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},"normal-npm":{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},"add-npm":{alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},"screen-npm":{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},erase:{alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},min:{alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},max:{alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}};class qb{constructor(){this.defaultState=new qn,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e,t,r){const n=e.blend?jb[e.blendMode]||jb.normal:void 0,s=[];for(let e=0;e<t;e++)s[e]={format:r,writeMask:0,blend:n};return s}destroy(){this.gpu=null}}qb.extension={type:[e.WebGPUSystem],name:"state"};const Kb=[new M,new M,new M],Zb={type:"image",upload(e,t,r,n=0){const s=e.resource,i=0|e.pixelWidth,o=0|e.pixelHeight,a=e.depthOrArrayLayers,l=s.byteLength/(i*o*a);if(a>1)return void r.device.queue.writeTexture({texture:t,origin:{x:0,y:0,z:n}},s,{offset:0,rowsPerImage:o,bytesPerRow:i*l},{width:i,height:o,depthOrArrayLayers:a});const u=Bx(e._updateStart,e._updateEnd,i,o,Kb);for(let e=0;e<u;e++){const o=Kb[e];r.device.queue.writeTexture({texture:t,origin:{x:o.x,y:o.y,z:n}},s,{offset:(o.y*i+o.x)*l,rowsPerImage:o.height,bytesPerRow:i*l},{width:o.width,height:o.height,depthOrArrayLayers:1})}}},Qb={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},Jb={blockBytes:4,blockWidth:1,blockHeight:1},ey={type:"compressed",upload(e,t,r,n=0){let s=e.pixelWidth,i=e.pixelHeight;const o=Qb[e.format]||Jb;for(let a=0;a<e.resource.length;a++){const l=e.resource[a],u=Math.ceil(s/o.blockWidth)*o.blockBytes;r.device.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:n}},l,{offset:0,bytesPerRow:u},{width:Math.ceil(s/o.blockWidth)*o.blockWidth,height:Math.ceil(i/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},ty=["right","left","top","bottom","front","back"];function ry(e){return{type:"cube",upload(t,r,n){const s=t.faces;for(let t=0;t<ty.length;t++){const i=s[ty[t]];(e[i.uploadMethodId]||e.image).upload(i,r,n,t)}}}}const ny={type:"image",upload(e,t,r,n=0){const s=e.resource;if(!s)return;if(globalThis.HTMLImageElement&&s instanceof HTMLImageElement){const t=Yt.get().createCanvas(s.width,s.height);t.getContext("2d").drawImage(s,0,0,s.width,s.height),e.resource=t,Oe("ImageSource: Image element passed, converting to canvas and replacing resource.")}const i=Math.min(t.width,e.resourceWidth||e.pixelWidth),o=Math.min(t.height,e.resourceHeight||e.pixelHeight),a="premultiply-alpha-on-upload"===e.alphaMode;r.device.queue.copyExternalImageToTexture({source:s},{texture:t,origin:{x:0,y:0,z:n},premultipliedAlpha:a},{width:i,height:o})}},sy={type:"video",upload(e,t,r,n){ny.upload(e,t,r,n)}},iy=["rgba8unorm","rgba16float"];function oy(e,t){if(!t)throw new Error("[Gpu3dMipmapGenerator] generating mipmaps for a 3D texture needs storage: true.");if(!iy.includes(e))throw new Error(`[Gpu3dMipmapGenerator] format '${e}' can't be downsampled. Use ${iy.join(", ")}.`)}class ay{constructor(e){this._pipelines={},this._device=e,this._sampler=e.createSampler({magFilter:"linear",minFilter:"linear"})}_getMipmapPipeline(e){var t;return(t=this._pipelines)[e]??(t[e]=this._device.createComputePipeline({layout:"auto",compute:{module:this._device.createShaderModule({code:`\n @group(0) @binding(0) var srcSampler : sampler;\n @group(0) @binding(1) var src : texture_3d<f32>;\n @group(0) @binding(2) var dst : texture_storage_3d<${e}, write>;\n\n @compute @workgroup_size(4, 4, 4)\n fn main(@builtin(global_invocation_id) gid : vec3<u32>) {\n let dstSize = textureDimensions(dst);\n\n if (gid.x >= dstSize.x || gid.y >= dstSize.y || gid.z >= dstSize.z) {\n return;\n }\n\n // centre of the 2x2x2 footprint in the previous mip. When a dimension is\n // odd its last texel, row or slice is never sampled, as in the 2D generator\n let uv = (vec3<f32>(gid) * 2.0 + 1.0) / vec3<f32>(textureDimensions(src));\n\n textureStore(dst, gid, textureSampleLevel(src, srcSampler, uv, 0.0));\n }\n `}),entryPoint:"main"}})),this._pipelines[e]}generateMipmap(e){if("3d"!==e.dimension)throw new Error("[Gpu3dMipmapGenerator] generateMipmap expects a 3D texture.");if(e.mipLevelCount<2)return;oy(e.format,0!==(e.usage&GPUTextureUsage.STORAGE_BINDING));const t=this._getMipmapPipeline(e.format),r=t.getBindGroupLayout(0),n=this._device.createCommandEncoder({label:"Gpu3dMipmapGenerator"}),s=n.beginComputePass();s.setPipeline(t);let i=e.width,o=e.height,a=e.depthOrArrayLayers,l=e.createView({dimension:"3d",baseMipLevel:0,mipLevelCount:1});for(let t=1;t<e.mipLevelCount;t++){i=Math.max(1,i>>1),o=Math.max(1,o>>1),a=Math.max(1,a>>1);const n=e.createView({dimension:"3d",baseMipLevel:t,mipLevelCount:1});s.setBindGroup(0,this._device.createBindGroup({layout:r,entries:[{binding:0,resource:this._sampler},{binding:1,resource:l},{binding:2,resource:n}]})),s.dispatchWorkgroups(Math.ceil(i/4),Math.ceil(o/4),Math.ceil(a/4)),l=n}s.end(),this._device.queue.submit([n.finish()])}}class ly{constructor(e){this._pipelines={},this._device=e,this._sampler=e.createSampler({minFilter:"linear"})}_getMipmapPipeline(e){let t=this._pipelines[e];return t||(this._mipmapShaderModule||(this._mipmapShaderModule=this._device.createShaderModule({code:"\n var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(\n vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));\n\n struct VertexOutput {\n @builtin(position) position : vec4<f32>,\n @location(0) texCoord : vec2<f32>,\n };\n\n @vertex\n fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {\n var output : VertexOutput;\n output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);\n return output;\n }\n\n @group(0) @binding(0) var imgSampler : sampler;\n @group(0) @binding(1) var img : texture_2d<f32>;\n\n @fragment\n fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {\n return textureSample(img, imgSampler, texCoord);\n }\n "})),t=this._device.createRenderPipeline({layout:"auto",vertex:{module:this._mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this._mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this._pipelines[e]=t),t}generateMipmap(e){if("3d"===e.dimension)throw new Error("[GpuMipmapGenerator] a 3D texture uses Gpu3dMipmapGenerator.");if("1d"===e.dimension)throw new Error("Generating mipmaps for 1d textures is currently unsupported!");const t=this._getMipmapPipeline(e.format);let r=e;const n=e.depthOrArrayLayers||1,s=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!s){const t={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:n},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this._device.createTexture(t)}const i=this._device.createCommandEncoder({}),o=t.getBindGroupLayout(0);for(let a=0;a<n;++a){let n=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:a,arrayLayerCount:1}),l=s?1:0;for(let s=1;s<e.mipLevelCount;++s){const e=r.createView({baseMipLevel:l++,mipLevelCount:1,dimension:"2d",baseArrayLayer:a,arrayLayerCount:1}),s=i.beginRenderPass({colorAttachments:[{view:e,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),u=this._device.createBindGroup({layout:o,entries:[{binding:0,resource:this._sampler},{binding:1,resource:n}]});s.setPipeline(t),s.setBindGroup(0,u),s.draw(3,1,0,0),s.end(),n=e}}if(!s){const t={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:n};for(let n=1;n<e.mipLevelCount;++n)i.copyTextureToTexture({texture:r,mipLevel:n-1},{texture:e,mipLevel:n},t),t.width=Math.ceil(t.width/2),t.height=Math.ceil(t.height/2)}return this._device.queue.submit([i.finish()]),s||r.destroy(),e}}class uy{constructor(e){this.textureView=null,this.textureViews=Object.create(null),this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.textureViews=null,this.gpuTexture=null}}const hy=/^(rgba8|bgra8|bc[1237]-rgba-|etc2-rgb8|etc2-rgb8a1|etc2-rgba8|astc-\d+x\d+-)unorm$/;function cy(e){return`${e.format||""}.${e.dimension||""}.${e.aspect||""}.${e.baseMipLevel||0}.${e.mipLevelCount||""}.${e.baseArrayLayer||0}.${e.arrayLayerCount||""}`}const dy=class e{constructor(t){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=t,t.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new Pa({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});const r={image:ny,buffer:Zb,video:sy,compressed:ey,...e.uploadExtensions};this._uploads={...r,cube:ry(r)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e,this._managedTextures.removeAll(),this._gpuSamplers=Object.create(null),this._mipmapGenerator=null,this._mipmap3dGenerator=null}initSource(e){return e._gpuData[this._renderer.uid]?.gpuTexture||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){"3d"===e.dimension&&oy(e.format,e.storage);const t=Math.max(e.pixelWidth,e.pixelHeight,e.depth);e.mipLevelCount=Math.floor(Math.log2(t))+1}let t,r;var n;e.sampleCount>1?(t=GPUTextureUsage.RENDER_ATTACHMENT,e.transient&&this._renderer.device.extensions.transientAttachment&&(t|=GPUTextureUsage.TRANSIENT_ATTACHMENT)):(t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,"compressed"!==e.uploadMethodId&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC),e.storage&&(t|=GPUTextureUsage.STORAGE_BINDING),n=e.format,r=hy.test(n)?[`${n}-srgb`]:void 0);const s=Qb[e.format]||{blockWidth:1,blockHeight:1},i=Math.ceil(e.pixelWidth/s.blockWidth)*s.blockWidth,o=Math.ceil(e.pixelHeight/s.blockHeight)*s.blockHeight,a={label:e.label,size:{width:i,height:o,depthOrArrayLayers:e.depthOrArrayLayers},format:e.format,viewFormats:r,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},l=this._gpu.device.createTexture(a);e._gpuData[this._renderer.uid]=new uy(l);return this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),l}onSourceUpdate(e){const t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){const t=this.getGpuSource(e);if("3d"===e.dimension)return this._mipmap3dGenerator??(this._mipmap3dGenerator=new ay(this._gpu.device)),void this._mipmap3dGenerator.generateMipmap(t);this._mipmapGenerator??(this._mipmapGenerator=new ly(this._gpu.device)),this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t?.gpuTexture;r?r.width===e.pixelWidth&&r.height===e.pixelHeight||(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]?.gpuTexture||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new Dn({0:t,1:t.style,2:new On({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e,t){var r;const n=e.source;n._gcLastUsed=this._renderer.gc.now;let s=n._gpuData[this._renderer.uid];s||(this.initSource(n),s=n._gpuData[this._renderer.uid]);const i=t?cy(t):0;return(r=s.textureViews)[i]||(r[i]=s.gpuTexture.createView({dimension:n.viewDimension,...t})),s.textureViews[i]}getTextureRenderTargetView(e,t=0,r=0,n){var s;const i=e.source;i._gcLastUsed=this._renderer.gc.now;let o=i._gpuData[this._renderer.uid];o||(this.initSource(i),o=i._gpuData[this._renderer.uid]);const a="3d"===i.dimension;a&&(r=0);let l=r*(i.mipLevelCount||1)+t+1;return n&&(l=`${l}.${cy(n)}`),(s=o.textureViews)[l]||(s[l]=o.gpuTexture.createView({dimension:a?"3d":"2d",baseMipLevel:t,mipLevelCount:1,baseArrayLayer:r,arrayLayerCount:1,...n})),o.textureViews[l]}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),n=Yt.get().createCanvas();n.width=e.source.pixelWidth,n.height=e.source.pixelHeight;const s=n.getContext("webgpu");return s.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Yt.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:s.getCurrentTexture()},{width:n.width,height:n.height}),t.gpu.device.queue.submit([r.finish()]),n}getPixels(e){const t=this.generateCanvas(e),r=Oc.getOptimalCanvasAndContext(t.width,t.height),n=r.context;n.drawImage(t,0,0);const{width:s,height:i}=t,o=n.getImageData(0,0,s,i),a=new Uint8ClampedArray(o.data.buffer);return Oc.returnCanvasAndContext(r),{pixels:a,width:s,height:i}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e),r=this._bindGroupHash[t];r?.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._mipmap3dGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};dy.extension={type:[e.WebGPUSystem],name:"texture"},dy.uploadExtensions=Object.create(null);let py=dy;n.handleByMap(e.TextureUploaderWebGPU,py.uploadExtensions);class fy{constructor(){this._maxTextures=0}contextChange(e){const t=new On({uTransformMatrix:{value:new _,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=e.limits.maxBatchableTextures;const r=ca({name:"graphics",bits:[pa,xa(this._maxTextures),ep,Ta]});this.shader=new Ln({gpuProgram:r,resources:{localUniforms:t}})}execute(e,t){const r=t.context,n=r.customShader||this.shader,s=e.renderer,i=s.graphicsContext,{batcher:o,instructions:a}=i.getContextRenderData(r),l=s.encoder;l.setGeometry(o.geometry,n.gpuProgram);const u=s.globalUniforms.bindGroup;l.setBindGroup(0,u,n.gpuProgram);const h=s.renderPipes.uniformBatch.getUniformBindGroup(n.resources.localUniforms,!0);l.setBindGroup(2,h,n.gpuProgram);const c=a.instructions;let d=null;for(let t=0;t<a.instructionSize;t++){const r=c[t];if(r.topology!==d&&(d=r.topology,l.setPipelineFromGeometryProgramAndState(o.geometry,n.gpuProgram,e.state,r.topology,n._overrides)),n.groups[1]=r.bindGroup,!r.gpuBindGroup){const e=r.textures;r.bindGroup=mo(e.textures,e.count,this._maxTextures),r.gpuBindGroup=s.bindGroup.getBindGroup(r.bindGroup,n.gpuProgram,1)}l.setBindGroup(1,r.bindGroup,n.gpuProgram),l.renderPassEncoder.drawIndexed(r.size,1,r.start)}}destroy(){this.shader.destroy(),this.shader=null}}fy.extension={type:[e.WebGPUPipesAdaptor],name:"graphics"};class my{init(){const e=ca({name:"mesh",bits:[Jd,Cm,Ta]});this._shader=new Ln({gpuProgram:e,resources:{uTexture:ee.EMPTY._source,uSampler:ee.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new _}}}})}execute(e,t){const r=e.renderer;let n=t._shader;if(n){if(!n.gpuProgram)return void Oe("Mesh shader has no gpuProgram",t.shader)}else n=this._shader,n.groups[2]=r.texture.getTextureBindGroup(t.texture);const s=n.gpuProgram;if(s.autoAssignGlobalUniforms&&(n.groups[0]=r.globalUniforms.bindGroup),s.autoAssignLocalUniforms){const t=e.localUniforms;n.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(t,!0)}r.encoder.draw({geometry:t._geometry,shader:n,state:t.state})}destroy(){this._shader.destroy(),this._shader=null}}my.extension={type:[e.WebGPUPipesAdaptor],name:"mesh"};const gy=[...jg,Mb,Tb,yb,Sb,gb,py,$b,Yb,qb,Xb,xb,wb,fb],_y=[...qg,Gb],xy=[wm,my,fy],by=[],yy=[],vy=[],Ty=[];n.handleByNamedList(e.WebGPUSystem,by),n.handleByNamedList(e.WebGPUPipes,yy),n.handleByNamedList(e.WebGPUPipesAdaptor,vy),n.handleByNamedList(e.WebGPULoader,Ty),n.add(...gy,..._y,...xy);class Sy extends hi{constructor(){super({name:"webgpu",type:Un.WEBGPU,systems:by,renderPipes:yy,renderPipeAdaptors:vy,loaders:Ty})}}var wy=Object.freeze({__proto__:null,WebGPURenderer:Sy});const Ey={POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},Ay=new Proxy(Ey,{get:(e,t)=>(L(I,`DRAW_MODES.${t} is deprecated, use '${Ey[t]}' instead`),e[t])});var Ry=(e=>(e.CLAMP="clamp-to-edge",e.REPEAT="repeat",e.MIRRORED_REPEAT="mirror-repeat",e))(Ry||{});const Cy=new Proxy(Ry,{get:(e,t)=>(L(I,`DRAW_MODES.${t} is deprecated, use '${Ry[t]}' instead`),e[t])});var My=(e=>(e.NEAREST="nearest",e.LINEAR="linear",e))(My||{});const Py=new Proxy(My,{get:(e,t)=>(L(I,`DRAW_MODES.${t} is deprecated, use '${My[t]}' instead`),e[t])});class Gy extends K{constructor(e){const{faces:t,...r}=e;Gy._validateFaces(t);const n=t.right,s=n.resolution,i=n.format,o=n.alphaMode,a=["resolution","format","alphaMode","dimensions","viewDimension"].filter(e=>void 0!==r[e]);a.length&&Oe(`[CubeTextureSource] Ignoring option(s) [${a.join(", ")}]; these are derived from face sources.`),super({...r,resource:t,width:n.width,height:n.height,viewDimension:"cube",arrayLayerCount:6,resolution:s,format:i,alphaMode:o}),this.uploadMethodId="cube",this.faces=t;for(const e of Object.keys(t)){const r=t[e];r.on("update",this._onFaceUpdate,this),r.on("resize",this._onFaceResize,this),r.on("unload",this._onFaceUpdate,this)}}destroy(){const e=this.faces;if(e)for(const t of Object.keys(e)){const r=e[t];r.off("update",this._onFaceUpdate,this),r.off("resize",this._onFaceResize,this),r.off("unload",this._onFaceUpdate,this)}super.destroy()}_onFaceUpdate(){this.emit("update",this)}_onFaceResize(e){Gy._validateFaces(this.faces),this.resize(e.width,e.height,e.resolution)}static _validateFaces(e){if(!(e.right&&e.left&&e.top&&e.bottom&&e.front&&e.back))throw new Error("[CubeTextureSource] Requires { left, right, top, bottom, front, back } faces.");const t=e.right,r=t.pixelWidth,n=t.pixelHeight,s=t.format,i=t.alphaMode,o=t.resolution;for(const t of Object.keys(e)){const a=e[t];if(a.pixelWidth!==r||a.pixelHeight!==n)throw new Error(`[CubeTextureSource] Face '${String(t)}' has a different size. All faces must match.`);if(a.format!==s)throw new Error(`[CubeTextureSource] Face '${String(t)}' has a different format. All faces must match.`);if(a.alphaMode!==i)throw new Error(`[CubeTextureSource] Face '${String(t)}' has a different alphaMode. All faces must match.`);if(a.resolution!==o)throw new Error(`[CubeTextureSource] Face '${String(t)}' has a different resolution. All faces must match.`)}}}const By=["left","right","top","bottom","front","back"];class Fy extends c{constructor(e){super(),this.uid=G("cubeTexture"),this.destroyed=!1;const{label:t,source:r}=e;this.label=t,this.source=r,this.source.label=this.label??this.source.label}static from(e,t=!1){if(e instanceof Gy)return new Fy({source:e});const{faces:r,...n}=e;let s=null;const i=By.every(e=>"string"==typeof r[e]);if(!t&&i&&(s=function(e,t){const r=t?{...t}:{};delete r.label;const n=Object.keys(r).sort(),s=n.length?`|${n.map(e=>`${e}=${String(r[e])}`).join("&")}`:"",i=By.map(t=>e[t]).join(",");return`cube:${i}${s}`}(r,n),ir.has(s)))return ir.get(s);const o=e=>e.isTexture?e:ee.from(e),a={};for(const e of By)a[e]=o(r[e]).source;const l=new Fy({source:new Gy({...n,faces:a}),label:n.label});return s&&(ir.set(s,l),l.once("destroy",()=>{ir.has(s)&&ir.remove(s)})),l}destroy(e=!1){this.destroyed||(this.destroyed=!0,e&&this.source.destroy(),this.emit("destroy",this),this.removeAllListeners())}}const Iy=Object.create(null),Oy=Object.create(null);class Dy extends K{constructor({resource:e,renderer:t,label:r,width:n,height:s}){e||(e=function(e){var t;if(e.type===Un.WEBGPU)return Oy[t=e.uid]||(Oy[t]=e.gpu.device.createTexture({label:"ExternalSource placeholder",size:{width:1,height:1},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST})),Oy[e.uid];if(!Iy[e.uid]){const t=e.gl,r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null),Iy[e.uid]=r}return Iy[e.uid]}(t)),n||(n=n??e?.width??1),s||(s=s??e?.height??1),super({resource:e,width:n,height:s,label:r,autoGarbageCollect:!1}),this._renderer=t,this._initGpuData(e)}static test(e){return globalThis.GPUTexture&&e instanceof GPUTexture||globalThis.WebGLTexture&&e instanceof WebGLTexture}_validateTexture(e){const t=this._renderer,r=!!t.gpu,n=globalThis.GPUTexture&&e instanceof GPUTexture,s=globalThis.WebGLTexture&&e instanceof WebGLTexture;if(r&&s)throw new Error("Cannot use WebGLTexture with a WebGPU renderer");if(!r&&n)throw new Error("Cannot use GPUTexture with a WebGL renderer");if(!r){const r=t.gl;if(r&&!r.isTexture(e))throw new Error("WebGLTexture does not belong to this renderer's WebGL context")}}_initGpuData(e){const t=this._renderer;this._validateTexture(e),t.gpu?this._gpuData[t.uid]=new uy(e):this._gpuData[t.uid]=new Gx(e)}updateGPUTexture(e,t,r){const n=this._renderer,s=this._gpuData[n.uid];if(this.resource=e,n.gpu){this._validateTexture(e);const n=s;n.gpuTexture!==e&&(n.gpuTexture=e,n.textureView=null,n.textureViews=Object.create(null),this._resourceId=G("resource"),this.emit("change",this));const i=t??e.width,o=r??e.height;this.resize(i,o)}else{this._validateTexture(e);s.texture=e,void 0!==t&&void 0!==r&&this.resize(t,r)}this.emit("update",this)}destroy(){const e=this._renderer;delete this._gpuData[e.uid],super.destroy()}}class Uy{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(e,t,r){const n=t.width,s=t.height;if(r){const t=e.width/2/n,i=e.height/2/s,o=e.x/n+t,a=e.y/s+i;r=R.add(r,R.NW),this.x0=o+t*R.uX(r),this.y0=a+i*R.uY(r),r=R.add(r,2),this.x1=o+t*R.uX(r),this.y1=a+i*R.uY(r),r=R.add(r,2),this.x2=o+t*R.uX(r),this.y2=a+i*R.uY(r),r=R.add(r,2),this.x3=o+t*R.uX(r),this.y3=a+i*R.uY(r)}else this.x0=e.x/n,this.y0=e.y/s,this.x1=(e.x+e.width)/n,this.y1=e.y/s,this.x2=(e.x+e.width)/n,this.y2=(e.y+e.height)/s,this.x3=e.x/n,this.y3=(e.y+e.height)/s;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}toString(){return`[pixi.js/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`}}function ky(e){const t=e.toString(),r=t.indexOf("{"),n=t.lastIndexOf("}");if(-1===r||-1===n)throw new Error("getFunctionBody: No body found in function definition");return t.slice(r+1,n).trim()}function Ly(e,t){return L("8.7.0","Use container.getFastGlobalBounds() instead"),e.getFastGlobalBounds(!0,t)}class Ny extends Dt{constructor(e){"function"==typeof e&&(e={render:e});const{render:t,...r}=e;super({label:"RenderContainer",...r}),this.renderPipeId="customRender",this.batched=!1,t&&(this.render=t),this.containsPoint=e.containsPoint??(()=>!1),this.addBounds=e.addBounds??(()=>!1)}updateBounds(){this._bounds.clear(),this.addBounds(this._bounds)}render(e){}}function Xy(e,t,r){L("8.7.0","Please use container.collectRenderables instead.");const n=r.renderPipes?r:r.batch.renderer;return e.collectRenderables(t,n,null)}function Hy(e,t){const r=t._scale,n=t._pivot,s=t._position,i=r._x,o=r._y,a=n._x,l=n._y;e.a=t._cx*i,e.b=t._sx*i,e.c=t._cy*o,e.d=t._sy*o,e.tx=s._x-(a*e.a+l*e.c),e.ty=s._y-(a*e.b+l*e.d)}function zy(e,t,r){const n=e.a,s=e.b,i=e.c,o=e.d,a=e.tx,l=e.ty,u=t.a,h=t.b,c=t.c,d=t.d;r.a=n*u+s*c,r.b=n*h+s*d,r.c=i*u+o*c,r.d=i*h+o*d,r.tx=a*u+l*c+t.tx,r.ty=a*h+l*d+t.ty}class Vy{constructor(){this._gradients=[],this._nextId=0}addStyle(e){if(!(e.fill instanceof Qa))return null;const t="pixi-grad-"+this._nextId++;return this._gradients.push({id:t,gradient:e.fill,textureSpace:e.textureSpace??"local"}),`url(#${t})`}build(){if(0===this._gradients.length)return"";const e=["<defs>"];for(const{id:t,gradient:r,textureSpace:n}of this._gradients){const s="global"===n?"userSpaceOnUse":"objectBoundingBox",i=Wy(r.colorStops);if("radial"===r.type){const n=r.outerCenter?.x??.5,o=r.outerCenter?.y??.5,a=r.outerRadius??.5,l=r.center?.x??n,u=r.center?.y??o;e.push(`<radialGradient id="${t}" gradientUnits="${s}" cx="${n}" cy="${o}" r="${a}" fx="${l}" fy="${u}">`,i,"</radialGradient>")}else{const n=r.start?.x??0,o=r.start?.y??0,a=r.end?.x??1,l=r.end?.y??0;e.push(`<linearGradient id="${t}" gradientUnits="${s}" x1="${n}" y1="${o}" x2="${a}" y2="${l}">`,i,"</linearGradient>")}}return e.push("</defs>"),e.join("")}}function Wy(e){return e.map(e=>{const t=Be.shared.setValue(e.color).toHex();return`<stop offset="${e.offset}" stop-color="${t}"/>`}).join("")}const $y=2*Math.PI,Yy=new Set(["regularPoly","roundPoly","roundShape","filletRect","chamferRect","arcTo"]);function jy(e,t=2,r=!1){if(e.instructions.some(e=>Yy.has(e.action)))return function(e,t,r){const n=e.shapePath.shapePrimitives,s=[];for(const e of n){const n=e.shape,i=e.transform;switch(n.type){case"polygon":{const e=n;s.push(rv(e.points,e.closePath,i,t));break}case"circle":{const e=n;s.push(Jy(e.x,e.y,e.radius,e.radius,i,t,r));break}case"ellipse":{const e=n;s.push(Jy(e.x,e.y,e.halfWidth,e.halfHeight,i,t,r));break}case"rectangle":{const e=n;s.push(ev(e.x,e.y,e.width,e.height,i,t));break}case"roundedRectangle":{const e=n;s.push(tv(e.x,e.y,e.width,e.height,e.radius,i,t,r));break}}}return s.join("")}(e,t,r);const n=[];let s=!1;for(let i=0;i<e.instructions.length;i++){const o=e.instructions[i],a=o.data;switch(o.action){case"moveTo":n.push(`M${Zy(a[0],a[1],null,t)}`),s=!0;break;case"lineTo":n.push(`L${Zy(a[0],a[1],null,t)}`),s=!0;break;case"quadraticCurveTo":n.push(`Q${Zy(a[0],a[1],null,t)} ${Zy(a[2],a[3],null,t)}`),s=!0;break;case"bezierCurveTo":n.push(`C${Zy(a[0],a[1],null,t)} ${Zy(a[2],a[3],null,t)} ${Zy(a[4],a[5],null,t)}`),s=!0;break;case"arcToSvg":n.push(`A${Ky(a[0],t)} ${Ky(a[1],t)} ${Ky(a[2],t)} ${a[3]} ${a[4]} ${Zy(a[5],a[6],null,t)}`),s=!0;break;case"closePath":n.push("Z"),s=!1;break;case"arc":n.push(Qy(a[0],a[1],a[2],a[3],a[4],!!a[5],s,t,r)),s=!qy(a[3],a[4],!!a[5]);break;case"rect":n.push(ev(a[0],a[1],a[2],a[3],a[4],t)),s=!1;break;case"circle":n.push(Jy(a[0],a[1],a[2],a[2],a[3],t,r)),s=!1;break;case"ellipse":n.push(Jy(a[0],a[1],a[2],a[3],a[4],t,r)),s=!1;break;case"roundRect":n.push(tv(a[0],a[1],a[2],a[3],a[4]??0,a[5],t,r)),s=!1;break;case"poly":n.push(rv(a[0],a[1]??!0,a[2],t)),s=!(a[1]??1);break;case"addPath":n.push(nv(a[0],a[1],t,r)),s=!0}}return n.join("")}function qy(e,t,r){let n=t-e;return r?n>0&&(n-=$y):n<0&&(n+=$y),Math.abs(n)>=$y-1e-6}function Ky(e,t){return parseFloat(e.toFixed(t)).toString()}function Zy(e,t,r,n){if(r&&!r.isIdentity()){const s=r.a*e+r.c*t+r.tx,i=r.b*e+r.d*t+r.ty;return`${Ky(s,n)} ${Ky(i,n)}`}return`${Ky(e,n)} ${Ky(t,n)}`}function Qy(e,t,r,n,s,i,o,a,l=!1){let u=s-n;if(i?u>0&&(u-=$y):u<0&&(u+=$y),Math.abs(u)>=$y-1e-6)return Jy(e,t,r,r,null,a,l);if(l){const s=32,i=[];for(let l=0;l<=s;l++){const h=n+l/s*u,c=e+r*Math.cos(h),d=t+r*Math.sin(h),p=0===l?o?"L":"M":"L";i.push(`${p}${Ky(c,a)} ${Ky(d,a)}`)}return i.join("")}const h=e+r*Math.cos(n),c=t+r*Math.sin(n),d=e+r*Math.cos(s),p=t+r*Math.sin(s),f=Math.abs(u)>Math.PI?1:0,m=i?0:1;return`${o?"L":"M"}${Ky(h,a)} ${Ky(c,a)}A${Ky(r,a)} ${Ky(r,a)} 0 ${f} ${m} ${Ky(d,a)} ${Ky(p,a)}`}function Jy(e,t,r,n,s,i,o=!1){const a=s&&!s.isIdentity()?s:null;if(!a&&!o)return`M${Ky(e-r,i)} ${Ky(t,i)}A${Ky(r,i)} ${Ky(n,i)} 0 1 1 ${Ky(e+r,i)} ${Ky(t,i)}A${Ky(r,i)} ${Ky(n,i)} 0 1 1 ${Ky(e-r,i)} ${Ky(t,i)}Z`;const l=[];for(let s=0;s<64;s++){const o=s/64*$y,u=e+r*Math.cos(o),h=t+n*Math.sin(o);l.push(`${0===s?"M":"L"}${Zy(u,h,a,i)}`)}return l.push("Z"),l.join("")}function ev(e,t,r,n,s,i){return`M${Zy(e,t,s,i)}L${Zy(e+r,t,s,i)}L${Zy(e+r,t+n,s,i)}L${Zy(e,t+n,s,i)}Z`}function tv(e,t,r,n,s,i,o,a=!1){const l=i&&!i.isIdentity()?i:null;if(s<=0)return ev(e,t,r,n,l,o);if(s=Math.min(s,Math.min(r,n)/2),l||a){const i=[],a=8,u=[[e+r-s,t+s,-Math.PI/2],[e+r-s,t+n-s,0],[e+s,t+n-s,Math.PI/2],[e+s,t+s,Math.PI]];let h=!0;for(let e=0;e<u.length;e++){const[t,r,n]=u[e];for(let e=0;e<=a;e++){const u=n+e/a*(Math.PI/2),c=t+s*Math.cos(u),d=r+s*Math.sin(u);i.push(`${h?"M":"L"}${Zy(c,d,l,o)}`),h=!1}}return i.push("Z"),i.join("")}return`M${Ky(e+s,o)} ${Ky(t,o)}L${Ky(e+r-s,o)} ${Ky(t,o)}A${Ky(s,o)} ${Ky(s,o)} 0 0 1 ${Ky(e+r,o)} ${Ky(t+s,o)}L${Ky(e+r,o)} ${Ky(t+n-s,o)}A${Ky(s,o)} ${Ky(s,o)} 0 0 1 ${Ky(e+r-s,o)} ${Ky(t+n,o)}L${Ky(e+s,o)} ${Ky(t+n,o)}A${Ky(s,o)} ${Ky(s,o)} 0 0 1 ${Ky(e,o)} ${Ky(t+n-s,o)}L${Ky(e,o)} ${Ky(t+s,o)}A${Ky(s,o)} ${Ky(s,o)} 0 0 1 ${Ky(e+s,o)} ${Ky(t,o)}Z`}function rv(e,t,r,n){if(0===e.length)return"";const s=[];if("number"==typeof e[0]){const t=e;s.push(`M${Zy(t[0],t[1],r,n)}`);for(let e=2;e<t.length;e+=2)s.push(`L${Zy(t[e],t[e+1],r,n)}`)}else{const t=e;s.push(`M${Zy(t[0].x,t[0].y,r,n)}`);for(let e=1;e<t.length;e++)s.push(`L${Zy(t[e].x,t[e].y,r,n)}`)}return t&&s.push("Z"),s.join("")}function nv(e,t,r,n){return!t||t.isIdentity()?jy(e,r,n):jy(e.clone(!0).transform(t),r,n)}function sv(e,t){const r=t.addStyle(e),n=[];return r?n.push(`fill="${r}"`):n.push(`fill="${Be.shared.setValue(e.color).toHex()}"`),e.alpha<1&&n.push(`fill-opacity="${e.alpha}"`),n.join(" ")}function iv(e,t){const r=t.addStyle(e),n=[];return n.push('fill="none"'),r?n.push(`stroke="${r}"`):n.push(`stroke="${Be.shared.setValue(e.color).toHex()}"`),n.push(`stroke-width="${e.width}"`),"butt"!==e.cap&&n.push(`stroke-linecap="${e.cap}"`),"miter"!==e.join?n.push(`stroke-linejoin="${e.join}"`):10!==e.miterLimit&&n.push(`stroke-miterlimit="${e.miterLimit}"`),e.alpha<1&&n.push(`stroke-opacity="${e.alpha}"`),n.join(" ")}function ov(e,t=2){const r=e instanceof hu?e:e.context,n=new Vy,s=[],i=r.instructions;let o=0;for(;o<i.length;){const e=i[o];switch(e.action){case"fill":{const r=e,i=!!r.data.hole,o=i?jy(r.data.path,t)+jy(r.data.hole,t,!0):jy(r.data.path,t),a=sv(r.data.style,n),l=i?' fill-rule="evenodd"':"";s.push(`<path d="${o}" ${a}${l}/>`);break}case"stroke":{const r=e;let i=jy(r.data.path,t);r.data.hole&&(i+=jy(r.data.hole,t,!0));const o=iv(r.data.style,n);s.push(`<path d="${i}" ${o}/>`);break}}o++}const a=r.bounds,l=parseFloat(a.minX.toFixed(t)),u=parseFloat(a.minY.toFixed(t)),h=parseFloat((a.maxX-a.minX).toFixed(t)),c=parseFloat((a.maxY-a.minY).toFixed(t));return`<svg xmlns="http://www.w3.org/2000/svg" width="${h}" height="${c}" viewBox="${l} ${u} ${h} ${c}">${n.build()}${s.join("")}</svg>`}function av(e){e instanceof Bl&&(e={path:e,textureMatrix:null,out:null});const t=[],r=[],n=[],s=e.path.shapePath,i=e.textureMatrix;s.shapePrimitives.forEach(({shape:e,transform:s})=>{const o=n.length,a=t.length/2,l=[],u=il[e.type];u.build(e,l),s&&Fa(l,s),u.triangulate(l,t,2,a,n,o);const h=r.length/2;i?(s&&i.append(s.clone().invert()),Ga(t,2,a,r,h,2,t.length/2-a,i)):Ba(r,h,2,t.length/2-a)});const o=e.out;if(o)return o.positions=new Float32Array(t),o.uvs=new Float32Array(r),o.indices=new Uint32Array(n),o;return new Hd({positions:new Float32Array(t),uvs:new Float32Array(r),indices:new Uint32Array(n)})}const lv=class e extends Ot{constructor(t={}){t={...e.defaultOptions,...t},super(),this.renderLayerChildren=[],this.sortableChildren=t.sortableChildren,this.sortFunction=t.sortFunction}attach(...e){for(let t=0;t<e.length;t++){const r=e[t];if(r.parentRenderLayer){if(r.parentRenderLayer===this)continue;r.parentRenderLayer.detach(r)}this.renderLayerChildren.push(r),r.parentRenderLayer=this;const n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0)}return e[0]}detach(...e){for(let t=0;t<e.length;t++){const r=e[t],n=this.renderLayerChildren.indexOf(r);-1!==n&&this.renderLayerChildren.splice(n,1),r.parentRenderLayer=null;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0)}return e[0]}detachAll(){const e=this.renderLayerChildren;for(let t=0;t<e.length;t++)e[t].parentRenderLayer=null;this.renderLayerChildren.length=0}collectRenderables(e,t,r){const n=this.renderLayerChildren,s=n.length;this.sortableChildren&&this.sortRenderLayerChildren();for(let r=0;r<s;r++)n[r].parent||Oe("Container must be added to both layer and scene graph. Layers only handle render order - the scene graph is required for transforms (addChild)",n[r]),n[r].collectRenderables(e,t,this)}sortRenderLayerChildren(){this.renderLayerChildren.sort(this.sortFunction)}_getGlobalBoundsRecursive(e,t,r){if(!e)return;const n=this.renderLayerChildren;for(let e=0;e<n.length;e++)n[e]._getGlobalBoundsRecursive(!0,t,this)}getFastGlobalBounds(e,t){return super.getFastGlobalBounds(e,t)}addChild(...e){throw new Error("RenderLayer.addChild() is not available. Please use RenderLayer.attach()")}removeChild(...e){throw new Error("RenderLayer.removeChild() is not available. Please use RenderLayer.detach()")}removeChildren(e,t){throw new Error("RenderLayer.removeChildren() is not available. Please use RenderLayer.detach()")}removeChildAt(e){throw new Error("RenderLayer.removeChildAt() is not available")}getChildAt(e){throw new Error("RenderLayer.getChildAt() is not available")}setChildIndex(e,t){throw new Error("RenderLayer.setChildIndex() is not available")}getChildIndex(e){throw new Error("RenderLayer.getChildIndex() is not available")}addChildAt(e,t){throw new Error("RenderLayer.addChildAt() is not available")}swapChildren(e,t){throw new Error("RenderLayer.swapChildren() is not available")}reparentChild(...e){throw new Error("RenderLayer.reparentChild() is not available with the render layer")}reparentChildAt(e,t){throw new Error("RenderLayer.reparentChildAt() is not available with the render layer")}};lv.defaultOptions={sortableChildren:!1,sortFunction:(e,t)=>e.zIndex-t.zIndex};let uv=lv;const hv=class e extends Hd{constructor(...e){super({});let t=e[0]??{};"number"==typeof t&&(L(I,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),t={width:t,height:e[1],verticesX:e[2],verticesY:e[3]}),this.build(t)}build(t){t={...e.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;const r=this.verticesX*this.verticesY,n=[],s=[],i=[],o=this.verticesX-1,a=this.verticesY-1,l=this.width/o,u=this.height/a;for(let e=0;e<r;e++){const t=e%this.verticesX,r=e/this.verticesX|0;n.push(t*l,r*u),s.push(t/o,r/a)}const h=o*a;for(let e=0;e<h;e++){const t=e%o,r=e/o|0,n=r*this.verticesX+t,s=r*this.verticesX+t+1,a=(r+1)*this.verticesX+t,l=(r+1)*this.verticesX+t+1;i.push(n,s,a,s,l,a)}this.buffers[0].data=new Float32Array(n),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(i),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};hv.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let cv=hv;function dv(e,t,r,n){const s=r.buffers[0],i=s.data,{verticesX:o,verticesY:a}=r,l=e/(o-1),u=t/(a-1);let h=0;const c=n[0],d=n[1],p=n[2],f=n[3],m=n[4],g=n[5],_=n[6],x=n[7],b=n[8];for(let e=0;e<i.length;e+=2){const t=h%o*l,r=(h/o|0)*u,n=c*t+d*r+p,s=f*t+m*r+g,a=_*t+x*r+b;i[e]=n/a,i[e+1]=s/a,h++}s.update()}function pv(e,t){const r=t[0],n=t[1],s=t[2],i=t[3],o=t[4],a=t[5],l=t[6],u=t[7],h=t[8];return e[0]=o*h-a*u,e[1]=s*u-n*h,e[2]=n*a-s*o,e[3]=a*l-i*h,e[4]=r*h-s*l,e[5]=s*i-r*a,e[6]=i*u-o*l,e[7]=n*l-r*u,e[8]=r*o-n*i,e}function fv(e,t,r){const n=t[0],s=t[1],i=t[2],o=t[3],a=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=r[0],p=r[1],f=r[2],m=r[3],g=r[4],_=r[5],x=r[6],b=r[7],y=r[8];return e[0]=d*n+p*o+f*u,e[1]=d*s+p*a+f*h,e[2]=d*i+p*l+f*c,e[3]=m*n+g*o+_*u,e[4]=m*s+g*a+_*h,e[5]=m*i+g*l+_*c,e[6]=x*n+b*o+y*u,e[7]=x*s+b*a+y*h,e[8]=x*i+b*l+y*c,e}const mv=[0,0,0,0,0,0,0,0,0],gv=[0,0,0],_v=[0,0,0];function xv(e,t,r,n,s,i,o,a,l){const u=mv;u[0]=t,u[1]=n,u[2]=i,u[3]=r,u[4]=s,u[5]=o,u[6]=1,u[7]=1,u[8]=1;const h=pv(e,u);_v[0]=a,_v[1]=l,_v[2]=1;const c=function(e,t,r){const n=r[0],s=r[1],i=r[2];return e[0]=t[0]*n+t[1]*s+t[2]*i,e[1]=t[3]*n+t[4]*s+t[5]*i,e[2]=t[6]*n+t[7]*s+t[8]*i,e}(gv,h,_v),d=e;return e[0]=c[0],e[1]=0,e[2]=0,e[3]=0,e[4]=c[1],e[5]=0,e[6]=0,e[7]=0,e[8]=c[2],fv(e,d,u)}const bv=[0,0,0,0,0,0,0,0,0],yv=[0,0,0,0,0,0,0,0,0];function vv(e,t,r,n,s,i,o,a,l,u,h,c,d,p,f,m,g){const _=xv(bv,t,r,i,o,u,h,p,f),x=xv(yv,n,s,a,l,c,d,m,g);return fv(e,pv(_,_),x)}class Tv extends cv{constructor(e){super(e),this._projectionMatrix=[0,0,0,0,0,0,0,0,0];const{width:t,height:r}=e;this.corners=[0,0,t,0,t,r,0,r]}setCorners(e,t,r,n,s,i,o,a){const l=this.corners;l[0]=e,l[1]=t,l[2]=r,l[3]=n,l[4]=s,l[5]=i,l[6]=o,l[7]=a,this.updateProjection()}updateProjection(){const{width:e,height:t}=this,r=this.corners;dv(e,t,this,vv(this._projectionMatrix,0,0,r[0],r[1],e,0,r[2],r[3],e,t,r[4],r[5],0,t,r[6],r[7]))}}const Sv=class e extends $d{constructor(t){t={...e.defaultOptions,...t};const{texture:r,verticesX:n,verticesY:s,...i}=t,o=new Tv(W({width:r.width,height:r.height,verticesX:n,verticesY:s}));super(W({...i,geometry:o})),this._texture=r,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){const e=this.geometry;if(!e)return;const{width:t,height:r}=this.texture;e.width===t&&e.height===r||(e.width=t,e.height=r,e.updateProjection())}set texture(e){this._texture!==e&&(super.texture=e,this.textureUpdated())}get texture(){return this._texture}setCorners(e,t,r,n,s,i,o,a){this.geometry.setCorners(e,t,r,n,s,i,o,a)}};Sv.defaultOptions={texture:ee.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let wv=Sv,Ev=class extends $d{constructor(e){const{texture:t,verticesX:r,verticesY:n,...s}=e,i=new cv(W({width:t.width,height:t.height,verticesX:r,verticesY:n}));super(W({...s,geometry:i,texture:t})),this.texture=t,this.autoResize=!0}textureUpdated(){const e=this.geometry,{width:t,height:r}=this.texture;!this.autoResize||e.width===t&&e.height===r||(e.width=t,e.height=r,e.build({}))}set texture(e){this._texture?.off("update",this.textureUpdated,this),super.texture=e,e.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(e){this.texture.off("update",this.textureUpdated,this),super.destroy(e)}};const Av=class e extends Hd{constructor(t){const{width:r,points:n,textureScale:s}={...e.defaultOptions,...t};super({positions:new Float32Array(4*n.length),uvs:new Float32Array(4*n.length),indices:new Uint32Array(6*(n.length-1))}),this.points=n,this._width=r,this.textureScale=s,this._build()}get width(){return this._width}_build(){const e=this.points;if(!e)return;const t=this.getBuffer("aPosition"),r=this.getBuffer("aUV"),n=this.getIndex();if(e.length<1)return;t.data.length/4!==e.length&&(t.data=new Float32Array(4*e.length),r.data=new Float32Array(4*e.length),n.data=new Uint16Array(6*(e.length-1)));const s=r.data,i=n.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let o=0,a=e[0];const l=this._width*this.textureScale,u=e.length;for(let t=0;t<u;t++){const r=4*t;if(this.textureScale>0){const r=a.x-e[t].x,n=a.y-e[t].y,s=Math.sqrt(r*r+n*n);a=e[t],o+=s/l}else o=t/(u-1);s[r]=o,s[r+1]=0,s[r+2]=o,s[r+3]=1}let h=0;for(let e=0;e<u-1;e++){const t=2*e;i[h++]=t,i[h++]=t+1,i[h++]=t+2,i[h++]=t+2,i[h++]=t+1,i[h++]=t+3}r.update(),n.update(),this.updateVertices()}updateVertices(){const e=this.points;if(e.length<1)return;let t,r=e[0],n=0,s=0;const i=this.buffers[0].data,o=e.length,a=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<o;l++){const o=e[l],u=4*l;t=l<e.length-1?e[l+1]:o,s=-(t.x-r.x),n=t.y-r.y;const h=Math.sqrt(n*n+s*s);h<1e-6?(n=0,s=0):(n/=h,s/=h,n*=a,s*=a),i[u]=o.x+n,i[u+1]=o.y+s,i[u+2]=o.x-n,i[u+3]=o.y-s,r=o}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};Av.defaultOptions={width:200,points:[],textureScale:0};let Rv=Av;const Cv=class e extends $d{constructor(t){const{width:r,texture:n,points:s,textureScale:i,...o}={...e.defaultOptions,...t},a=new Rv(W({width:r??n.height,points:s,textureScale:i}));i>0&&(n.source.style.addressMode="repeat"),super(W({...o,texture:n,geometry:a})),this.autoUpdate=!0,this.onRender=this._render}_render(){const e=this.geometry;(this.autoUpdate||e._width!==this.texture.height)&&(e._width=this.texture.height,e.update())}};Cv.defaultOptions={textureScale:0};let Mv=Cv,Pv=class extends $d{constructor(e){const{texture:t,vertices:r,uvs:n,indices:s,topology:i,...o}=e,a=new Hd(W({positions:r,uvs:n,indices:s,topology:i}));super(W({...o,texture:t,geometry:a})),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(e){this.geometry.getBuffer("aPosition").data=e}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}};function Gv(e,t){const{width:r,height:n}=e.frame;return t.scale(1/r,1/n),t}class Bv{execute(e,t){const r=e.renderer,n=r.canvasContext.activeContext,s=t.particleChildren,i=t.texture;n.save(),r.canvasContext.setContextTransform(t.worldTransform,t.roundPixels),r.canvasContext.setBlendMode(t.groupBlendMode);const o=(t.groupColorAlpha>>>24&255)/255*(r.filter?.alphaMultiplier??1);for(let e=0;e<s.length;e++){const t=s[e],r=t.texture||i;if(!r?.source?.resource)continue;const a=t.color,l=(a>>>24&255)/255*o;if(l<=0)continue;const u=16777215&a,h=((255&u)<<16)+(65280&u)+(u>>16&255);let c=r.source.resource;16777215!==h&&(c=Gc.getTintedCanvas({texture:r},h));const d=r.frame,p=r.source.resolution,f=d.x*p,m=d.y*p,g=d.width*p,_=d.height*p;n.globalAlpha=l;const x=-t.anchorX*d.width,b=-t.anchorY*d.height;0!==t.rotation||1!==t.scaleX||1!==t.scaleY?(n.save(),n.translate(t.x,t.y),n.rotate(t.rotation),n.scale(t.scaleX,t.scaleY),n.drawImage(c,f,m,g,_,x,b,d.width,d.height),n.restore()):n.drawImage(c,f,m,g,_,t.x+x,t.y+b,d.width,d.height)}n.restore()}}function Fv(e,t=null){const r=6*e;if(r>65535?t||(t=new Uint32Array(r)):t||(t=new Uint16Array(r)),t.length!==r)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${r}`);for(let e=0,n=0;e<r;e+=6,n+=4)t[e+0]=n+0,t[e+1]=n+1,t[e+2]=n+2,t[e+3]=n+0,t[e+4]=n+2,t[e+5]=n+3;return t}function Iv(e){return{dynamicUpdate:Ov(e,!0),staticUpdate:Ov(e,!1)}}function Ov(e,t){const r=[];r.push("\n\n var index = 0;\n\n for (let i = 0; i < ps.length; ++i)\n {\n const p = ps[i];\n\n ");let n=0;for(const s in e){const i=e[s];if(t!==i.dynamic)continue;r.push(`offset = index + ${n}`),r.push(i.code);n+=xn(i.format).stride/4}r.push("\n index += stride * 4;\n }\n "),r.unshift(`\n var stride = ${n};\n `);const s=r.join("\n");return new Function("ps","f32v","u32v",s)}class Dv{constructor(e){this._size=0,this._generateParticleUpdateCache={};const t=this._size=e.size??1e3,r=e.properties;let n=0,s=0;for(const e in r){const t=r[e],i=xn(t.format);t.dynamic?s+=i.stride:n+=i.stride}this._dynamicStride=s/4,this._staticStride=n/4,this.staticAttributeBuffer=new go(4*t*n),this.dynamicAttributeBuffer=new go(4*t*s),this.indexBuffer=Fv(t);const i=new Lo;let o=0,a=0;this._staticBuffer=new Do({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:Oo.VERTEX|Oo.COPY_DST}),this._dynamicBuffer=new Do({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:Oo.VERTEX|Oo.COPY_DST});for(const e in r){const t=r[e],n=xn(t.format);t.dynamic?(i.addAttribute(t.attributeName,{buffer:this._dynamicBuffer,stride:4*this._dynamicStride,offset:4*o,format:t.format}),o+=n.size):(i.addAttribute(t.attributeName,{buffer:this._staticBuffer,stride:4*this._staticStride,offset:4*a,format:t.format}),a+=n.size)}i.addIndex(this.indexBuffer);const l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=i}getParticleUpdate(e){const t=function(e){const t=[];for(const r in e){const n=e[r];t.push(r,n.code,n.dynamic?"d":"s")}return t.join("_")}(e);return this._generateParticleUpdateCache[t]||(this._generateParticleUpdateCache[t]=this.generateParticleUpdate(e)),this._generateParticleUpdateCache[t]}generateParticleUpdate(e){return Iv(e)}update(e,t){e.length>this._size&&(t=!0,this._size=Math.max(e.length,1.5*this._size|0),this.staticAttributeBuffer=new go(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new go(this._size*this._dynamicStride*4*4),this.indexBuffer=Fv(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));const r=this.dynamicAttributeBuffer;if(this._dynamicUpload(e,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,e.length*this._dynamicStride*4,!0),t){const t=this.staticAttributeBuffer;this._staticUpload(e,t.float32View,t.uint32View),this._staticBuffer.setDataWithSize(t.float32View,e.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}var Uv="varying vec2 vUV;\nvarying vec4 vColor;\n\nuniform sampler2D uTexture;\n\nvoid main(void){\n vec4 color = texture2D(uTexture, vUV) * vColor;\n gl_FragColor = color;\n}",kv="attribute vec2 aVertex;\nattribute vec2 aUV;\nattribute vec4 aColor;\n\nattribute vec2 aPosition;\nattribute float aRotation;\n\nuniform mat3 uTranslationMatrix;\nuniform float uRound;\nuniform vec2 uResolution;\nuniform vec4 uColor;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n\nvec2 roundPixels(vec2 position, vec2 targetSize)\n{ \n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n}\n\nvoid main(void){\n float cosRotation = cos(aRotation);\n float sinRotation = sin(aRotation);\n float x = aVertex.x * cosRotation - aVertex.y * sinRotation;\n float y = aVertex.x * sinRotation + aVertex.y * cosRotation;\n\n vec2 v = vec2(x, y);\n v = v + aPosition;\n\n gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n if(uRound == 1.0)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n\n vUV = aUV;\n vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;\n}\n",Lv="\nstruct ParticleUniforms {\n uTranslationMatrix:mat3x3<f32>,\n uColor:vec4<f32>,\n uRound:f32,\n uResolution:vec2<f32>,\n};\n\nfn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>\n{\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n}\n\n@group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;\n\n@group(1) @binding(0) var uTexture: texture_2d<f32>;\n@group(1) @binding(1) var uSampler : sampler;\n\nstruct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) color : vec4<f32>,\n };\n@vertex\nfn mainVertex(\n @location(0) aVertex: vec2<f32>,\n @location(1) aPosition: vec2<f32>,\n @location(2) aUV: vec2<f32>,\n @location(3) aColor: vec4<f32>,\n @location(4) aRotation: f32,\n) -> VSOutput {\n \n let v = vec2(\n aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),\n aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)\n ) + aPosition;\n\n var position = vec4((uniforms.uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n if(uniforms.uRound == 1.0) {\n position = vec4(roundPixels(position.xy, uniforms.uResolution), position.zw);\n }\n\n let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor;\n\n return VSOutput(\n position,\n aUV,\n vColor,\n );\n}\n\n@fragment\nfn mainFragment(\n @location(0) uv: vec2<f32>,\n @location(1) color: vec4<f32>,\n @builtin(position) position: vec4<f32>,\n) -> @location(0) vec4<f32> {\n\n var sample = textureSample(uTexture, uSampler, uv) * color;\n \n return sample;\n}";class Nv extends Ln{constructor(){super({glProgram:gn.from({vertex:kv,fragment:Uv}),gpuProgram:Pn.from({fragment:{source:Lv,entryPoint:"mainFragment"},vertex:{source:Lv,entryPoint:"mainVertex"}}),resources:{uTexture:ee.WHITE.source,uSampler:new j({}),uniforms:{uTranslationMatrix:{value:new _,type:"mat3x3<f32>"},uColor:{value:new Be(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}class Xv{constructor(e,t){this.state=qn.for2d(),this.localUniforms=new On({uTranslationMatrix:{value:new _,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=e,this.adaptor=t,this.defaultShader=new Nv,this.state=qn.for2d(),this._managedContainers=new Pa({renderer:e,type:"renderable",name:"particleContainer"})}validateRenderable(e){return!1}addRenderable(e,t){this.renderer.renderPipes.batch.break(t),t.add(e)}getBuffers(e){return e._gpuData[this.renderer.uid]||this._initBuffer(e)}_initBuffer(e){return e._gpuData[this.renderer.uid]=new Dv({size:e.particleChildren.length,properties:e._properties}),this._managedContainers.add(e),e._gpuData[this.renderer.uid]}updateRenderable(e){}execute(e){const t=e.particleChildren;if(0===t.length)return;const r=this.renderer,n=this.getBuffers(e);e.texture||(e.texture=t[0].texture);const s=this.state;n.update(t,e._childrenDirty),e._childrenDirty=!1,s.blendMode=yo(e.groupBlendMode,e.texture._source);const i=this.localUniforms.uniforms,o=i.uTranslationMatrix;e.worldTransform.copyTo(o);const a=r.globalUniforms.globalUniformData;o.tx-=a.offset.x,o.ty-=a.offset.y,o.prepend(a.projectionMatrix),i.uResolution=a.resolution,i.uRound=r._roundPixels|e._roundPixels;const l=e.groupColorAlpha,u=a.worldColor;Ud((((l>>>24)*(u>>>24)/255|0)<<24|rt(16777215&l,16777215&u))>>>0,i.uColor,0),this.adaptor.execute(this,e)}destroy(){this._managedContainers.destroy(),this.renderer=null,this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}Xv.extension={type:[e.CanvasPipes],name:"particle"};class Hv extends Xv{constructor(e){super(e,new Bv)}}Hv.extension={type:[e.CanvasPipes],name:"particle"};class zv{execute(e,t){const r=e.state,n=e.renderer,s=t.shader||e.defaultShader;s.resources.uTexture=t.texture._source,s.resources.uniforms=e.localUniforms;const i=n.gl,o=e.getBuffers(t);n.shader.bind(s),n.state.set(r),n.geometry.bind(o.geometry,s.glProgram);const a=2===o.geometry.indexBuffer.data.BYTES_PER_ELEMENT?i.UNSIGNED_SHORT:i.UNSIGNED_INT;i.drawElements(i.TRIANGLES,6*t.particleChildren.length,a,0)}}class Vv extends Xv{constructor(e){super(e,new zv)}}Vv.extension={type:[e.WebGLPipes],name:"particle"};class Wv{execute(e,t){const r=e.renderer,n=t.shader||e.defaultShader;n.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(e.localUniforms,!0),n.groups[1]=r.texture.getTextureBindGroup(t.texture);const s=e.state,i=e.getBuffers(t);r.encoder.draw({geometry:i.geometry,shader:t.shader||e.defaultShader,state:s,size:6*t.particleChildren.length})}}class $v extends Xv{constructor(e){super(e,new Wv)}}$v.extension={type:[e.WebGPUPipes],name:"particle"};const Yv=class e{constructor(t){if(t instanceof ee)this.texture=t,At(this,e.defaultOptions,{});else{At(this,{...e.defaultOptions,...t},{})}}get alpha(){return this._alpha}set alpha(e){this._alpha=Math.min(Math.max(e,0),1),this._updateColor()}get tint(){return it(this._tint)}set tint(e){this._tint=Be.shared.setValue(e??16777215).toBgrNumber(),this._updateColor()}_updateColor(){this.color=this._tint+(255*this._alpha<<24)}};Yv.defaultOptions={anchorX:0,anchorY:0,x:0,y:0,scaleX:1,scaleY:1,rotation:0,tint:16777215,alpha:1};let jv=Yv;const qv={vertex:{attributeName:"aVertex",format:"float32x2",code:"\n const texture = p.texture;\n const sx = p.scaleX;\n const sy = p.scaleY;\n const ax = p.anchorX;\n const ay = p.anchorY;\n const trim = texture.trim;\n const orig = texture.orig;\n\n if (trim)\n {\n w1 = trim.x - (ax * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (ay * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -ax * (orig.width);\n w0 = w1 + orig.width;\n\n h1 = -ay * (orig.height);\n h0 = h1 + orig.height;\n }\n\n f32v[offset] = w1 * sx;\n f32v[offset + 1] = h1 * sy;\n\n f32v[offset + stride] = w0 * sx;\n f32v[offset + stride + 1] = h1 * sy;\n\n f32v[offset + (stride * 2)] = w0 * sx;\n f32v[offset + (stride * 2) + 1] = h0 * sy;\n\n f32v[offset + (stride * 3)] = w1 * sx;\n f32v[offset + (stride * 3) + 1] = h0 * sy;\n ",dynamic:!1},position:{attributeName:"aPosition",format:"float32x2",code:"\n var x = p.x;\n var y = p.y;\n\n f32v[offset] = x;\n f32v[offset + 1] = y;\n\n f32v[offset + stride] = x;\n f32v[offset + stride + 1] = y;\n\n f32v[offset + (stride * 2)] = x;\n f32v[offset + (stride * 2) + 1] = y;\n\n f32v[offset + (stride * 3)] = x;\n f32v[offset + (stride * 3) + 1] = y;\n ",dynamic:!0},rotation:{attributeName:"aRotation",format:"float32",code:"\n var rotation = p.rotation;\n\n f32v[offset] = rotation;\n f32v[offset + stride] = rotation;\n f32v[offset + (stride * 2)] = rotation;\n f32v[offset + (stride * 3)] = rotation;\n ",dynamic:!1},uvs:{attributeName:"aUV",format:"float32x2",code:"\n var uvs = p.texture.uvs;\n\n f32v[offset] = uvs.x0;\n f32v[offset + 1] = uvs.y0;\n\n f32v[offset + stride] = uvs.x1;\n f32v[offset + stride + 1] = uvs.y1;\n\n f32v[offset + (stride * 2)] = uvs.x2;\n f32v[offset + (stride * 2) + 1] = uvs.y2;\n\n f32v[offset + (stride * 3)] = uvs.x3;\n f32v[offset + (stride * 3) + 1] = uvs.y3;\n ",dynamic:!1},color:{attributeName:"aColor",format:"unorm8x4",code:"\n const c = p.color;\n\n u32v[offset] = c;\n u32v[offset + stride] = c;\n u32v[offset + (stride * 2)] = c;\n u32v[offset + (stride * 3)] = c;\n ",dynamic:!1}};n.add(Vv),n.add($v),n.add(Hv);const Kv=new ne(0,0,0,0),Zv=class e extends Dt{constructor(t={}){t={...e.defaultOptions,...t,dynamicProperties:{...e.defaultOptions.dynamicProperties,...t?.dynamicProperties}};const{dynamicProperties:r,shader:n,roundPixels:s,texture:i,particles:o,...a}=t;super({label:"ParticleContainer",...a}),this.renderPipeId="particle",this.batched=!1,this._childrenDirty=!1,this.texture=i||null,this.shader=n,this._properties={};for(const e in qv){const t=qv[e],n=r[e];this._properties[e]={...t,dynamic:n}}this.allowChildren=!0,this.roundPixels=s??!1,this.particleChildren=o??[]}addParticle(...e){for(let t=0;t<e.length;t++)this.particleChildren.push(e[t]);return this.onViewUpdate(),e[0]}removeParticle(...e){let t=!1;for(let r=0;r<e.length;r++){const n=this.particleChildren.indexOf(e[r]);n>-1&&(this.particleChildren.splice(n,1),t=!0)}return t&&this.onViewUpdate(),e[0]}update(){this._childrenDirty=!0}onViewUpdate(){this._childrenDirty=!0,super.onViewUpdate()}get bounds(){return Kv}updateBounds(){}destroy(e=!1){super.destroy(e);if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource,r=this.texture??this.particleChildren[0]?.texture;r&&r.destroy(t)}this.texture=null,this.shader?.destroy()}removeParticles(e,t){e??(e=0),t??(t=this.particleChildren.length);const r=this.particleChildren.splice(e,t-e);return this.onViewUpdate(),r}removeParticleAt(e){const t=this.particleChildren.splice(e,1);return this.onViewUpdate(),t[0]}addParticleAt(e,t){return this.particleChildren.splice(t,0,e),this.onViewUpdate(),e}addChild(...e){throw new Error("ParticleContainer.addChild() is not available. Please use ParticleContainer.addParticle()")}removeChild(...e){throw new Error("ParticleContainer.removeChild() is not available. Please use ParticleContainer.removeParticle()")}removeChildren(e,t){throw new Error("ParticleContainer.removeChildren() is not available. Please use ParticleContainer.removeParticles()")}removeChildAt(e){throw new Error("ParticleContainer.removeChildAt() is not available. Please use ParticleContainer.removeParticleAt()")}getChildAt(e){throw new Error("ParticleContainer.getChildAt() is not available. Please use ParticleContainer.getParticleAt()")}setChildIndex(e,t){throw new Error("ParticleContainer.setChildIndex() is not available. Please use ParticleContainer.setParticleIndex()")}getChildIndex(e){throw new Error("ParticleContainer.getChildIndex() is not available. Please use ParticleContainer.getParticleIndex()")}addChildAt(e,t){throw new Error("ParticleContainer.addChildAt() is not available. Please use ParticleContainer.addParticleAt()")}swapChildren(e,t){throw new Error("ParticleContainer.swapChildren() is not available. Please use ParticleContainer.swapParticles()")}reparentChild(...e){throw new Error("ParticleContainer.reparentChild() is not available with the particle container")}reparentChildAt(e,t){throw new Error("ParticleContainer.reparentChildAt() is not available with the particle container")}};Zv.defaultOptions={dynamicProperties:{vertex:!1,position:!0,rotation:!1,uvs:!1,color:!1},roundPixels:!1};let Qv=Zv;const Jv=[[0,0],[0,0],[0,0]],eT=[[0,0],[0,0],[0,0]],tT=[[0,0],[0,0],[0,0]],rT=[[0,0],[0,0],[0,0]];function nT(e,t,r,n,s,i,o){e[0][0]=t,e[0][1]=r,e[1][0]=n,e[1][1]=s,e[2][0]=i,e[2][1]=o}class sT{constructor(e){this._renderer=e}validateRenderable(e){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}updateRenderable(e){}execute(e){const t=this._renderer,r=t.canvasContext,n=r.activeContext;n.save();const s=e.groupTransform,i=t._roundPixels|e._roundPixels;r.setContextTransform(s,1===i),r.setBlendMode(e.groupBlendMode);const o=t.globalUniforms.globalUniformData?.worldColor??4294967295,a=e.groupColorAlpha,l=(o>>>24&255)/255*((a>>>24&255)/255)*(t.filter?.alphaMultiplier??1);if(l<=0)return void n.restore();n.globalAlpha=l;const u=it(rt(16777215&a,16777215&o)),h=e.texture,c=Gc.getCanvasSource(h);if(!c)return void n.restore();const d=r.smoothProperty,p="nearest"!==h.source.style.scaleMode;n[d]!==p&&(n[d]=p);const f=16777215!==u||0!==h.rotate,m=f?Gc.getTintedCanvas({texture:h},u):c,{leftWidth:g,topHeight:_,rightWidth:x,bottomHeight:b,width:y,height:v}=e,T=g+x,S=_+b,w=Math.min(T>y?y/T:1,S>v?v/S:1,1),E=g*w,A=x*w,R=_*w,C=b*w,M=Math.max(0,y-E-A),P=Math.max(0,v-R-C),G=e.anchor,B=h.source._resolution??h.source.resolution??1;let F=h.frame.x*B,I=h.frame.y*B;const O=-G.x*y,D=-G.y*v,U=g*B,k=_*B,L=x*B,N=b*B;let X=h.frame.width*B,H=h.frame.height*B;f&&(F=0,I=0,X=m.width,H=m.height);const z=X-U-L,V=H-k-N,W=z>0?F+U:Math.max(F,Math.min(F+U,F+X-1)),$=z>0?z:1,Y=V>0?I+k:Math.max(I,Math.min(I+k,I+H-1)),j=V>0?V:1;nT(Jv,F,U,W,$,F+X-L,L),nT(eT,I,k,Y,j,I+H-N,N),nT(tT,O,E,O+E,M,O+y-A,A),nT(rT,D,R,D+R,P,D+v-C,C);for(let e=0;e<3;e++){const t=tT[e][1];if(t<=0)continue;const r=Jv[e][0],s=Jv[e][1],i=tT[e][0];for(let e=0;e<3;e++){const o=rT[e][1];o<=0||n.drawImage(m,r,eT[e][0],s,eT[e][1],i,rT[e][0],t,o)}}n.restore()}destroy(){this._renderer=null}}sT.extension={type:[e.CanvasPipes],name:"nineSliceSprite"};const iT=class e extends cv{constructor(t={}){super({width:(t={...e.defaultOptions,...t}).width,height:t.height,verticesX:4,verticesY:4}),this._trimX=0,this._trimY=0,this._trimWidth=t.originalWidth??e.defaultOptions.originalWidth,this._trimHeight=t.originalHeight??e.defaultOptions.originalHeight,this.update(t)}update(e){this.width=e.width??this.width,this.height=e.height??this.height,this._originalWidth=e.originalWidth??this._originalWidth,this._originalHeight=e.originalHeight??this._originalHeight,this._leftWidth=e.leftWidth??this._leftWidth,this._rightWidth=e.rightWidth??this._rightWidth,this._topHeight=e.topHeight??this._topHeight,this._bottomHeight=e.bottomHeight??this._bottomHeight,this._anchorX=e.anchor?.x,this._anchorY=e.anchor?.y,void 0!==e.trim?(this._trimX=e.trim?.x??0,this._trimY=e.trim?.y??0,this._trimWidth=e.trim?.width??this._originalWidth,this._trimHeight=e.trim?.height??this._originalHeight):(this._trimWidth=this._originalWidth,this._trimHeight=this._originalHeight),this.updateUvs(),this.updatePositions()}updatePositions(){const e=this.positions,{width:t,height:r,_leftWidth:n,_rightWidth:s,_topHeight:i,_bottomHeight:o,_anchorX:a,_anchorY:l}=this,u=n+s,h=t>u?1:t/u,c=i+o,d=r>c?1:r/c,p=Math.min(h,d),f=a*t,m=l*r;e[0]=e[8]=e[16]=e[24]=-f,e[2]=e[10]=e[18]=e[26]=n*p-f,e[4]=e[12]=e[20]=e[28]=t-s*p-f,e[6]=e[14]=e[22]=e[30]=t-f,e[1]=e[3]=e[5]=e[7]=-m,e[9]=e[11]=e[13]=e[15]=i*p-m,e[17]=e[19]=e[21]=e[23]=r-o*p-m,e[25]=e[27]=e[29]=e[31]=r-m,this.getBuffer("aPosition").update()}updateUvs(){const e=this.uvs,t=this._originalWidth,r=this._originalHeight,n=this._trimX/t,s=this._trimY/r,i=(this._trimX+this._trimWidth)/t,o=(this._trimY+this._trimHeight)/r;e[0]=e[8]=e[16]=e[24]=n,e[1]=e[3]=e[5]=e[7]=s,e[6]=e[14]=e[22]=e[30]=i,e[25]=e[27]=e[29]=e[31]=o;const a=1/t,l=1/r;e[2]=e[10]=e[18]=e[26]=n+a*this._leftWidth,e[9]=e[11]=e[13]=e[15]=s+l*this._topHeight,e[4]=e[12]=e[20]=e[28]=i-a*this._rightWidth,e[17]=e[19]=e[21]=e[23]=o-l*this._bottomHeight,this.getBuffer("aUV").update()}};iT.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let oT=iT;class aT extends zd{constructor(){super(),this.geometry=new oT}destroy(){this.geometry.destroy()}}class lT{constructor(e){this._renderer=e,this._managedSprites=new Pa({renderer:e,type:"renderable",name:"nineSliceSprite"})}addRenderable(e,t){const r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.geometry.update(e),t.setTexture(e._texture)}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=e._gpuData[this._renderer.uid]=new aT,r=t;return r.renderable=e,r.transform=e.groupTransform,r.texture=e._texture,r.roundPixels=this._renderer._roundPixels|e._roundPixels,this._managedSprites.add(e),e.didViewUpdate||this._updateBatchableSprite(e,r),t}destroy(){this._managedSprites.destroy(),this._renderer=null}}lT.extension={type:[e.WebGLPipes,e.WebGPUPipes],name:"nineSliceSprite"},n.add(sT),n.add(lT);const uT=class e extends Dt{constructor(t){t instanceof ee&&(t={texture:t});const{width:r,height:n,anchor:s,leftWidth:i,rightWidth:a,topHeight:l,bottomHeight:u,texture:h,roundPixels:c,...d}=t;super({label:"NineSliceSprite",...d}),this.renderPipeId="nineSliceSprite",this.batched=!0,this._leftWidth=i??h?.defaultBorders?.left??oT.defaultOptions.leftWidth,this._topHeight=l??h?.defaultBorders?.top??oT.defaultOptions.topHeight,this._rightWidth=a??h?.defaultBorders?.right??oT.defaultOptions.rightWidth,this._bottomHeight=u??h?.defaultBorders?.bottom??oT.defaultOptions.bottomHeight,this._width=r??h.width??oT.defaultOptions.width,this._height=n??h.height??oT.defaultOptions.height,this.allowChildren=!1,this.texture=h??e.defaultOptions.texture,this.roundPixels=c??!1,this._anchor=new o({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:this.texture.defaultAnchor&&(this.anchor=this.texture.defaultAnchor)}get anchor(){return this._anchor}set anchor(e){"number"==typeof e?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return this._width}set width(e){this._width=e,this.onViewUpdate()}get height(){return this._height}set height(e){this._height=e,this.onViewUpdate()}setSize(e,t){"object"==typeof e&&(t=e.height??e.width,e=e.width),this._width=e,this._height=t??e,this.onViewUpdate()}getSize(e){return e||(e={}),e.width=this._width,e.height=this._height,e}get leftWidth(){return this._leftWidth}set leftWidth(e){this._leftWidth=e,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(e){this._topHeight=e,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(e){this._rightWidth=e,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(e){this._bottomHeight=e,this.onViewUpdate()}get texture(){return this._texture}set texture(e){e||(e=ee.EMPTY);const t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}get trim(){return this._texture.trim??null}destroy(e){super.destroy(e);if("boolean"==typeof e?e:e?.texture){const t="boolean"==typeof e?e:e?.textureSource;this._texture.destroy(t)}this._texture=null}updateBounds(){const e=this._bounds,t=this._anchor,r=this._width,n=this._height;e.minX=-t._x*r,e.maxX=e.minX+r,e.minY=-t._y*n,e.maxY=e.minY+n}};uT.defaultOptions={texture:ee.EMPTY};let hT=uT;class cT extends hT{constructor(...e){let t=e[0];t instanceof ee&&(L(I,"NineSlicePlane now uses the options object {texture, leftWidth, rightWidth, topHeight, bottomHeight}"),t={texture:t,leftWidth:e[1],topHeight:e[2],rightWidth:e[3],bottomHeight:e[4]}),L(I,"NineSlicePlane is deprecated. Use NineSliceSprite instead."),super(t)}}class dT extends Af{constructor(e,t){super();const{textures:r,data:n}=e;Object.keys(n.pages).forEach(e=>{const t=n.pages[parseInt(e,10)],s=r[t.id];this.pages.push({texture:s})}),Object.keys(n.chars).forEach(e=>{const t=n.chars[e],{frame:s,source:i,rotate:o}=r[t.page],a=R.transformRectCoords(t,s,o,new M),l=new ee({frame:a,orig:new M(0,0,t.width,t.height),source:i,rotate:o});this.chars[e]={id:e.codePointAt(0),xOffset:t.xOffset,yOffset:t.yOffset,xAdvance:t.xAdvance,kerning:t.kerning??{},texture:l}}),this.baseRenderedFontSize=n.fontSize,this.baseMeasurementFontSize=n.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:n.fontSize},this.baseLineOffset=n.baseLineOffset,this.lineHeight=n.lineHeight,this.fontFamily=n.fontFamily,this.distanceField=n.distanceField??{type:"none",range:0},this.url=t}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){const{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){Bf.install(e)}static uninstall(e){Bf.uninstall(e)}}var pT=Object.freeze({__proto__:null,BitmapFont:dT});function fT(e){const{text:t,style:r,chars:n}=e,s=r,i=Bf.getFont(t,s),o=Mf(sf.graphemeSegmenter(t),s,i,!0),a=o.scale,l=[],u=[],h=[],c=r.lineHeight?r.lineHeight:i.lineHeight*a;let d=0;for(const e of o.lines){if(0===e.chars.length)continue;const t=new Ot({label:"line"});t.y=d,h.push(t);let r=new Ot({label:"word"}),o=0;for(let h=0;h<e.chars.length;h++){const c=e.chars[h];if(!c)continue;if(!i.chars[c])continue;const d=" "===c,p=h===e.chars.length-1;let f;n.length>0?(f=n.shift(),f.text=c,f.style=s,f.label=`char-${c}`,f.x=e.charPositions[h]*a-e.charPositions[o]*a):f=new Wf({text:c,style:s,label:`char-${c}`,x:e.charPositions[h]*a-e.charPositions[o]*a}),d||(l.push(f),r.addChild(f)),(d||p)&&r.children.length>0&&(r.x=e.charPositions[o]*a,u.push(r),t.addChild(r),r=new Ot({label:"word"}),o=h+1)}d+=c}return{chars:l,lines:h,words:u}}class mT extends Ot{constructor(e){const{text:t,style:r,autoSplit:n,lineAnchor:s,wordAnchor:i,charAnchor:o,...a}=e;super(a),this._dirty=!1,this._canReuseChars=!1,this.chars=[],this.words=[],this.lines=[],this._originalText=t,this._autoSplit=n,this._lineAnchor=s,this._wordAnchor=i,this._charAnchor=o,this.style=r}split(){const e=this.splitFn();this.chars=e.chars,this.words=e.words,this.lines=e.lines,this.addChild(...this.lines),this.charAnchor=this._charAnchor,this.wordAnchor=this._wordAnchor,this.lineAnchor=this._lineAnchor,this._dirty=!1,this._canReuseChars=!0}get text(){return this._originalText}set text(e){this._originalText=e,this.lines.forEach(e=>e.destroy({children:!0})),this.lines.length=0,this.words.length=0,this.chars.length=0,this._canReuseChars=!1,this.onTextUpdate()}_setOrigin(e,t,r){let n;n="number"==typeof e?{x:e,y:e}:{x:e.x,y:e.y},t.forEach(e=>{const t=e.getLocalBounds(),r=t.minX+t.width*n.x,s=t.minY+t.height*n.y;e.origin.set(r,s)}),this[r]=e}get lineAnchor(){return this._lineAnchor}set lineAnchor(e){this._setOrigin(e,this.lines,"_lineAnchor")}get wordAnchor(){return this._wordAnchor}set wordAnchor(e){this._setOrigin(e,this.words,"_wordAnchor")}get charAnchor(){return this._charAnchor}set charAnchor(e){this._setOrigin(e,this.chars,"_charAnchor")}get style(){return this._style}set style(e){e||(e={}),this._style=new ff(e),this.styleChanged()}styleChanged(){this.words.forEach(e=>e.destroy()),this.words.length=0,this.lines.forEach(e=>e.destroy()),this.lines.length=0,this._canReuseChars=!0,this.onTextUpdate()}onTextUpdate(){this._dirty=!0,this._autoSplit&&this.split()}destroy(e){super.destroy(e),this.chars=[],this.words=[],this.lines=[],("boolean"==typeof e?e:e?.style)&&this._style.destroy(e),this._style=null,this._originalText=""}}const gT=class e extends mT{constructor(t){var r;const n={...e.defaultOptions,...t};n.style??(n.style={}),(r=n.style).fill??(r.fill=16777215),super(n)}static from(t,r){const n={...e.defaultOptions,...r,text:t.text,style:new ff(t.style)};t.style.tagStyles&&(Oe("[SplitBitmapText] Tag styles are not supported for SplitBitmapText. They will be ignored."),t.style._tagStyles=void 0);const s=new e({...n}),i=t.anchor;return 0===i.x&&0===i.y||s.pivot.set(s.width*i.x,s.height*i.y),s}splitFn(){return fT({text:this._originalText,style:this._style,chars:this._canReuseChars?this.chars:[]})}};gT.defaultOptions={autoSplit:!0,lineAnchor:0,wordAnchor:0,charAnchor:0};let _T=gT;function xT(e,t,r){switch(e){case"center":return(r-t)/2;case"right":return r-t;default:return 0}}function bT(e){return"\r"===e||"\n"===e||"\r\n"===e}const yT=/^\s*$/;function vT(e){const{text:t,style:r,chars:n}=e,s=r,i=sf.measureText(t,s);if(i.runsByLine&&i.runsByLine.length>0)return function(e,t,r,n){const{runsByLine:s}=e,i=t.align,o=e.lineWidths.reduce((e,t)=>Math.max(e,t),0);let a=0,l=0;if(t.trim){const{frame:e,canvasAndContext:r}=df.getCanvasAndContext({text:n,style:t,resolution:1});df.returnCanvasAndContext(r),a=-e.x,l=-e.y}const u=[],h=[],c=[];let d=0,p=0;return s.forEach((n,f)=>{const m=new Ot({label:`line-${f}`});m.y=d+l,h.push(m);const g=e.lineWidths[f];let x=xT(i,g,o),b=new Ot({label:"word"});b.x=x+a;for(const e of n){const t=e.style,n=t._fill?.fill,s=t._stroke?.fill,i=n instanceof Qa,o=s instanceof Qa,l=i||o,h=i&&"local"===n.textureSpace||o&&"local"===s.textureSpace,d=sf.graphemeSegmenter(e.text),f=t.clone();f.align="left",f.wordWrap=!1,f.trim&&(f.trim=!1),f.tagStyles=void 0,f._lineHeight=0;const g=sf._context;g.font=f._fontString,sf.experimentalLetterSpacingSupported&&(g.letterSpacing="0px",g.textLetterSpacing="0px");let y=e.text,v=g.measureText(y).width;const T=x,S=v,w=sf.measureFont(f._fontString),E=t.lineHeight||w.fontSize,A=h?{width:S,height:E}:null;for(const e of d){y=y.slice(e.length);const n=y.length>0?g.measureText(y).width:0,s=v-n;if(v=n,!bT(e)&&0!==s)if(" "===e)b.children.length>0&&(c.push(b),m.addChild(b)),x+=s+t.letterSpacing,b=new Ot({label:"word"}),b.x=x+a;else{let n,i=f;l&&(i=f.clone(),h?(i._gradientOffset={x:-(x-T),y:0},i._gradientBounds=A):i._gradientOffset={x:-(x-T),y:0}),p<r.length?(n=r[p++],n.text=e,n.style=i,n.setFromMatrix(_.IDENTITY),n.x=x-b.x+a):n=new wf({text:e,style:i,x:x-b.x+a}),u.push(n),b.addChild(n),x+=s+t.letterSpacing}}}if(b.children.length>0&&(c.push(b),m.addChild(b)),"justify"===i&&t.wordWrap&&f<s.length-1){const e=m.children,t=e.length-1;if(t>0){const r=(o-g)/t;for(let t=1;t<e.length;t++)e[t].x+=t*r}}const y=e.lineHeights?.[f]??e.lineHeight;d+=y}),{chars:u,lines:h,words:c}}(i,s,n,t);const o=function(e,t){const r=[];let n=t.lines[0],s="",i=[],o=0;return e.forEach(e=>{const a=yT.test(e),l=bT(e),u=0===s.length&&a;(!a||l||!u||n&&n.startsWith(e))&&(l||(s+=e),i.push(e),s.length>=n.length&&(r.push({line:s,chars:i}),i=[],s="",o++,n=t.lines[o]))}),r}(sf.graphemeSegmenter(t),i),a=s.align,l=i.lineWidths.reduce((e,t)=>Math.max(e,t),0),u=s._fill?.fill,h=s._stroke?.fill,c=u instanceof Qa,d=h instanceof Qa,p=c||d,f=c&&"local"===u.textureSpace||d&&"local"===h.textureSpace,m=i.width,g=i.height,x=s.clone();x.align="left";let b=0,y=0;if(x.trim){const{frame:e,canvasAndContext:r}=df.getCanvasAndContext({text:t,style:s,resolution:1});df.returnCanvasAndContext(r),b=-e.x,y=-e.y,x.trim=!1}const v=[],T=[],S=[];let w=0,E=0;const A=f?{width:m,height:g}:null;return o.forEach((e,t)=>{const r=new Ot({label:`line-${t}`});r.y=w+y,T.push(r);const u=i.lineWidths[t];let h=xT(a,u,l),c=new Ot({label:"word"});c.x=h+b;const d=sf._context;d.font=x._fontString,sf.experimentalLetterSpacingSupported&&(d.letterSpacing="0px",d.textLetterSpacing="0px");let f=e.line,m=d.measureText(f).width;if(e.chars.forEach(e=>{if(bT(e))return;f=f.slice(e.length);const t=f.length>0?d.measureText(f).width:0,i=m-t;if(m=t,0!==i)if(" "===e)c.children.length>0&&(S.push(c),r.addChild(c)),h+=i+s.letterSpacing,c=new Ot({label:"word"}),c.x=h+b;else{let t,r=x;p&&(r=x.clone(),r._gradientOffset={x:-h,y:-w},A&&(r._gradientBounds=A)),E<n.length?(t=n[E++],t.text=e,t.style=r,t.setFromMatrix(_.IDENTITY),t.x=h-c.x+b):t=new wf({text:e,style:r,x:h-c.x+b}),v.push(t),c.addChild(t),h+=i+s.letterSpacing}}),c.children.length>0&&(S.push(c),r.addChild(c)),"justify"===a&&s.wordWrap&&t<o.length-1){const e=r.children,t=e.length-1;if(t>0){const r=(l-u)/t;for(let t=1;t<e.length;t++)e[t].x+=t*r}}w+=i.lineHeight}),{chars:v,lines:T,words:S}}const TT=class e extends mT{constructor(t){super({...e.defaultOptions,...t})}static from(t,r){const n={...e.defaultOptions,...r,text:t.text,style:new ff(t.style)},s=new e({...n}),i=t.anchor;return 0===i.x&&0===i.y||s.pivot.set(s.width*i.x,s.height*i.y),s}splitFn(){return vT({text:this._originalText,style:this._style,chars:this._canReuseChars?this.chars:[]})}};TT.defaultOptions={autoSplit:!0,lineAnchor:0,wordAnchor:0,charAnchor:0};let ST=TT;const wT=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];function ET(e){const t=[];let r=0;for(let n=0;n<wT.length;n++){const s=`_${wT[n]}`;t[r++]=e[s]}return r=AT(e._fill,t,r),r=function(e,t,r){return e?(r=AT(e,t,r),t[r++]=e.width,t[r++]=e.alignment,t[r++]=e.cap,t[r++]=e.join,t[r++]=e.miterLimit,r):r}(e._stroke,t,r),r=function(e,t,r){return e?(t[r++]=e.alpha,t[r++]=e.angle,t[r++]=e.blur,t[r++]=e.distance,t[r++]=Be.shared.setValue(e.color).toNumber(),r):r}(e.dropShadow,t,r),r=function(e,t,r){if(!e)return r;for(const n of e)t[r++]=n.uid;return r}(e.filters,t,r),t.join("-")}function AT(e,t,r){return e?(t[r++]=e.color,t[r++]=e.alpha,t[r++]=e.fill?.styleKey,r):r}async function RT(e,t,r=200){const n=await t.extract.base64(e);t.type!==Un.CANVAS&&await t.encoder.commandFinished;const s=r;console.log(`logging texture ${e.source.width}px ${e.source.height}px`);const i=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",i)}const CT=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let MT=0;function PT(e,t=0,r={color:"#000000"}){e.renderGroup&&(r.color=CT[MT++]);let n="";for(let e=0;e<t;e++)n+=" ";let s=e.label;!s&&e instanceof Ut&&(s=`sprite:${e.texture.label}`);let i=`%c ${n}|- ${s} (worldX:${e.worldTransform.tx}, relativeRenderX:${e.relativeGroupTransform.tx}, renderX:${e.groupTransform.tx}, localX:${e.x})`;e.renderGroup&&(i+=" (RenderGroup)"),e.filters&&(i+="(*filters)"),console.log(i,`color:${r.color}; font-weight:bold;`),t++;for(let n=0;n<e.children.length;n++){PT(e.children[n],t,{...r})}}function GT(e,t=0,r={index:0,color:"#000000"}){let n="";for(let e=0;e<t;e++)n+=" ";const s=`%c ${n}- ${r.index}: ${e.root.label} worldX:${e.worldTransform.tx}`;console.log(s,`color:${r.color}; font-weight:bold;`),t++;for(let n=0;n<e.renderGroupChildren.length;n++){GT(e.renderGroupChildren[n],t,{...r,index:n})}}n.add(s,i);var BT=Object.freeze({__proto__:null,AbstractBitmapFont:Af,AbstractBitmapTextPipe:If,AbstractRenderer:hi,AbstractSplitText:mT,AbstractText:gp,AbstractTextSystem:vf,AccessibilitySystem:Yr,AlphaFilter:qc,AlphaMask:Ht,AlphaMaskPipe:Bm,AnimatedSprite:Yd,Application:Ti,ApplicationInitHook:_i,Assets:Ou,AssetsClass:Iu,BLEND_TO_NPM:xo,BREAKING_SPACES:Bp,BREAKING_SPACES_SET:Fp,BREAK_AFTER_CHARS:Dp,BREAK_AFTER_CHARS_SET:Up,BUFFER_TYPE:c_,BackgroundLoader:Mi,BackgroundSystem:xg,Batch:Ro,BatchGeometry:Ho,BatchTextureArray:Ao,BatchableGraphics:Oa,BatchableHTMLText:nm,BatchableMesh:zd,BatchableSprite:xf,BatchableText:bf,Batcher:Io,BatcherPipe:Am,BigPool:Le,BindGroup:Dn,BindGroupSystem:fb,BitmapFont:dT,BitmapFontManager:Bf,BitmapText:Wf,BitmapTextGraphics:Ff,BitmapTextPipe:Vf,BlendModeFilter:ts,BlendModePipe:ag,BlurFilter:id,BlurFilterPass:sd,Bounds:ne,BrowserAdapter:Wt,Buffer:Do,BufferImageSource:Z,BufferResource:j_,BufferUsage:Oo,CLEAR:si,COLLAPSIBLE_SPACES:Ip,COLLAPSIBLE_SPACES_SET:Op,Cache:ir,CanvasBatchAdaptor:bm,CanvasBitmapTextPipe:Df,CanvasColorMaskPipe:Fm,CanvasContextSystem:Vm,CanvasFilterSystem:Vc,CanvasGraphicsAdaptor:sg,CanvasGraphicsContextSystem:Id,CanvasGraphicsPipe:Od,CanvasLimitsSystem:Wm,CanvasNineSliceSpritePipe:sT,CanvasObserver:Ar,CanvasParticleContainerAdaptor:Bv,CanvasParticleContainerPipe:Hv,CanvasPool:Oc,CanvasPoolClass:Ic,CanvasRenderTargetAdaptor:Jg,CanvasRenderTargetSystem:e_,CanvasRenderer:u_,CanvasRendererTextSystem:Tf,CanvasSource:jt,CanvasStencilMaskPipe:Lm,CanvasTextGenerator:df,CanvasTextMetrics:sf,CanvasTextPipe:yf,CanvasTextSystem:Sf,CanvasTextureSystem:t_,CanvasTilingSpritePipe:Qd,Circle:oo,Color:Be,ColorBlend:is,ColorBurnBlend:os,ColorDodgeBlend:as,ColorMask:zt,ColorMaskPipe:Im,ColorMatrixFilter:ld,CompressedSource:ku,Container:Ot,CubeTexture:Fy,CubeTextureSource:Gy,Culler:jh,CullerPlugin:qh,CustomRenderPipe:$m,D3D10_RESOURCE_DIMENSION:oh,D3DFMT:uh,DATA_URI:mi,DDS:dh,DEG_TO_RAD:f,DEPRECATED_SCALE_MODES:My,DEPRECATED_WRAP_MODES:Ry,DOMAdapter:Yt,DOMContainer:Kh,DOMPipe:Zh,DRAW_MODES:Ay,DXGI_FORMAT:ih,DXGI_TO_TEXTURE_FORMAT:ch,DarkenBlend:ls,DefaultBatcher:Ma,DefaultShader:Aa,DifferenceBlend:us,DisplacementFilter:dd,DivideBlend:hs,DynamicBitmapFont:Cf,Ellipse:ao,EventBoundary:Sc,EventEmitter:c,EventSystem:Ac,EventsTicker:_c,ExclusionBlend:cs,ExtensionType:e,ExternalSource:Dy,ExtractSystem:vg,FOURCC_TO_TEXTURE_FORMAT:hh,FederatedContainer:Rc,FederatedEvent:Rr,FederatedMouseEvent:xc,FederatedPointerEvent:bc,FederatedWheelEvent:yc,FillGradient:Qa,FillPattern:Jl,Filter:Zn,FilterEffect:Ve,FilterPipe:yd,FilterSystem:Sd,FontStylePromiseCache:um,GAUSSIAN_VALUES:Kc,GCManagedHash:Pa,GCSystem:Pg,GL_FORMATS:__,GL_INTERNAL_FORMAT:gh,GL_TARGETS:x_,GL_TYPES:y_,GL_WRAP_MODES:b_,GPUTextureGpuData:uy,GenerateTextureSystem:Ag,Geometry:Lo,GlBackBufferSystem:C_,GlBatchAdaptor:ym,GlBuffer:d_,GlBufferSystem:p_,GlColorMaskSystem:M_,GlContextSystem:m_,GlEncoderSystem:P_,GlGeometryGpuData:w_,GlGeometrySystem:E_,GlGraphicsAdaptor:rb,GlLimitsSystem:G_,GlMeshAdaptor:nb,GlParticleContainerAdaptor:zv,GlParticleContainerPipe:Vv,GlProgram:gn,GlProgramData:Q_,GlRenderTarget:B_,GlRenderTargetAdaptor:$_,GlRenderTargetSystem:Y_,GlShaderSystem:fx,GlStateSystem:Px,GlStencilSystem:I_,GlTexture:Gx,GlTextureSystem:tb,GlUboSystem:W_,GlUniformGroupSystem:xx,GlobalResourceRegistry:De,GlobalUniformSystem:Gg,Gpu3dMipmapGenerator:ay,GpuBatchAdaptor:wm,GpuBlendModesToPixi:jb,GpuBufferData:mb,GpuBufferSystem:gb,GpuColorMaskSystem:xb,GpuDeviceSystem:yb,GpuEncoderSystem:Tb,GpuGraphicsAdaptor:fy,GpuGraphicsContext:cl,GpuLimitsSystem:Sb,GpuMeshAdapter:my,GpuMipmapGenerator:ly,GpuMsaaRestore:Hb,GpuParticleContainerAdaptor:Wv,GpuParticleContainerPipe:$v,GpuProgram:Pn,GpuRenderTarget:zb,GpuRenderTargetAdaptor:Wb,GpuRenderTargetSystem:$b,GpuShaderSystem:Yb,GpuStateSystem:qb,GpuStencilModesToPixi:F_,GpuStencilSystem:wb,GpuTextureSystem:py,GpuUboSystem:Mb,GpuUniformBatchPipe:Gb,Graphics:Nd,GraphicsContext:hu,GraphicsContextRenderData:dl,GraphicsContextSystem:fl,GraphicsGpuData:kd,GraphicsPath:Bl,GraphicsPipe:Ld,HTMLText:mm,HTMLTextPipe:sm,HTMLTextRenderData:em,HTMLTextStyle:Zf,HTMLTextSystem:fm,HardLightBlend:ds,HardMixBlend:ps,HelloSystem:Dg,IGLUniformData:Z_,ImageSource:qt,InstructionSet:gt,KTX:_h,LightenBlend:fs,LinearBurnBlend:ms,LinearDodgeBlend:gs,LinearLightBlend:_s,Loader:Hi,LoaderParserPriority:cr,LuminosityBlend:xs,MaskEffectManager:$e,MaskEffectManagerClass:We,MaskFilter:Rd,Matrix:_,Mesh:$d,MeshGeometry:Hd,MeshGpuData:Vd,MeshPipe:Wd,MeshPlane:Ev,MeshRope:Mv,MeshSimple:Pv,NEWLINES:Pp,NEWLINES_SET:Gp,NEWLINE_MATCH_REGEX:Lp,NEWLINE_SPLIT_REGEX:kp,NOOP:N,NegationBlend:bs,NineSliceGeometry:oT,NineSlicePlane:cT,NineSliceSprite:hT,NineSliceSpriteGpuData:aT,NineSliceSpritePipe:lT,NoiseFilter:gd,ObservablePoint:o,OverlayBlend:ys,PI_2:d,Particle:jv,ParticleBuffer:Dv,ParticleContainer:Qv,ParticleContainerPipe:Xv,ParticleShader:Nv,PassthroughFilter:bd,PerspectiveMesh:wv,PerspectivePlaneGeometry:Tv,PinLightBlend:vs,PipelineSystem:Xb,PlaneGeometry:cv,Point:m,Polygon:ho,Pool:Ue,PoolGroupClass:ke,PrepareBase:Pd,PrepareQueue:Ef,PrepareSystem:_m,PrepareUpload:gm,QuadGeometry:ap,RAD_TO_DEG:p,Rectangle:M,RenderBundle:vb,RenderContainer:Ny,RenderGroup:Et,RenderGroupPipe:jm,RenderGroupSystem:gg,RenderLayer:uv,RenderTarget:Hg,RenderTargetSystem:Qg,RenderTexture:Tg,RenderableGCSystem:kg,RendererInitHook:xi,RendererType:Un,ResizePlugin:bi,Resolver:xr,RopeGeometry:Rv,RoundedRectangle:po,SCALE_MODES:Py,STATE_BITS:Xn,STENCIL_MODES:bo,SVGDefsCollector:Vy,SVGParser:Kl,SaturationBlend:Ts,SchedulerSystem:Fg,ScissorMask:Om,ScreenSizeRegistry:_t,SdfShader:zf,Shader:Ln,ShaderOverrides:kn,ShaderStage:wn,ShapePath:Gl,SharedRenderPipes:qg,SharedSystems:jg,SoftLightBlend:Ss,SplitBitmapText:_T,SplitText:ST,Sprite:Ut,SpritePipe:ig,Spritesheet:Tr,State:qn,StencilMask:Vt,StencilMaskPipe:Nm,SubtractBlend:ws,SystemRunner:ii,TEXTURE_FORMAT_BLOCK_SIZE:ph,Text:wf,TextStyle:ff,Texture:ee,TextureGCSystem:Ng,TextureMatrix:J,TexturePool:wt,TexturePoolClass:St,TextureSource:K,TextureStyle:j,TextureUvs:Uy,TextureView:q_,Ticker:er,TickerListener:Zt,TickerPlugin:yi,TilingSprite:mp,TilingSpriteGpuData:dp,TilingSpritePipe:pp,TilingSpriteShader:op,Transform:jd,Triangle:Uc,UNIFORM_TO_ARRAY_SETTERS:gx,UNIFORM_TO_SINGLE_SETTERS:mx,UNIFORM_TYPES_MAP:Bn,UNIFORM_TYPES_VALUES:Gn,UPDATE_BLEND:2,UPDATE_COLOR:1,UPDATE_PRIORITY:Kt,UPDATE_TRANSFORM:8,UPDATE_VISIBLE:4,UboBatch:_b,UboSystem:O_,UniformGroup:On,VERSION:gi,VideoSource:nr,ViewContainer:Dt,ViewSystem:Yg,ViewableBuffer:go,VividLightBlend:Es,WGSL_ALIGN_SIZE_DATA:Eb,WGSL_TO_STD40_SIZE:D_,WRAP_MODES:Cy,WebGLRenderer:cb,WebGPURenderer:Sy,WebWorkerAdapter:gc,WorkerManager:yu,accessibilityTarget:jr,addBits:zo,addMaskBounds:Lt,addMaskLocalBounds:Nt,addProgramDefines:rn,alphaFrag:$c,alphaWgsl:Yc,appendSVGPath:ql,applyMatrix:up,applyProjectiveTransformationToPlane:dv,applyStyleParams:jx,assertMipmap3dTexture:oy,assignWithIgnore:At,autoDetectEnvironment:Cs,autoDetectRenderer:fi,autoDetectSource:ar,bakeOverridesIntoSource:Db,basisTranscoderUrls:Ku,bgr2rgb:it,bitmapFontCachePlugin:Ri,bitmapFontTextParser:Si,bitmapFontXMLParser:wi,bitmapFontXMLStringParser:Ei,bitmapTextSplit:fT,blendTemplateFrag:Qn,blendTemplateVert:Jn,blendTemplateWgsl:es,blockDataMap:Qb,blurTemplateWgsl:td,boundsPool:Ke,browserExt:s,buildAdaptiveBezier:gl,buildAdaptiveQuadratic:xl,buildArc:yl,buildArcTo:vl,buildArcToSvg:Rl,buildCircle:Da,buildContextBatches:ll,buildEllipse:Ua,buildGeometryFromPath:av,buildLine:za,buildPixelLine:Va,buildPolygon:Ya,buildRectangle:ja,buildRoundedRectangle:ka,buildSVGFillAttributes:sv,buildSVGPath:jy,buildSVGStrokeAttributes:iv,buildSimpleUvs:Ba,buildTriangle:qa,buildUvs:Ga,cacheAsTextureMixin:Ne,cacheTextureArray:Pi,calculatePathArea:jl,calculateProjection:Kg,canUseNewCanvasBlendModes:Pc,canvasTextSplit:vT,canvasUtils:Gc,checkChildrenDidChange:ut,checkDataUrl:zi,checkExtension:Vi,checkForNestedPattern:Wl,checkMaxIfStatementsInShader:So,childrenHelperMixin:He,cleanArray:Cg,cleanHash:Rg,clearList:lg,closePointEps:La,collapseNewlines:Wp,collapseSpaces:Vp,collectAllRenderables:Xy,collectRenderablesMixin:ze,color32BitToUniform:Ud,colorBit:pa,colorBitGl:fa,colorMatrixFilterFrag:od,colorMatrixFilterWgsl:ad,colorToUniform:Dd,compareModeToGlCompare:Yx,compileBufferSync:L_,compileHighShader:ea,compileHighShaderGl:ta,compileHighShaderGlProgram:da,compileHighShaderGpuProgram:ca,compileHooks:Wo,compileInputs:Yo,compileOutputs:qo,compileShader:J_,compute2DProjection:vv,convertFormatIfRequired:Ph,convertToList:sr,copySearchParams:yr,createGlUploadCubeTextureResource:kx,createGpuUploadCubeTextureResource:ry,createIdFromString:Zr,createIndicesForQuads:Fv,createLevelBuffers:rh,createLevelBuffersFromKTX:Bh,createStringVariations:gr,createTexture:du,createUboElementsSTD40:U_,createUboElementsWGSL:Ab,createUboSyncFunctionSTD40:V_,createUboSyncFunctionWGSL:Cb,crossOrigin:Cu,cullingMixin:Fe,curveEps:Na,defaultFilterVert:Wc,defaultValue:tx,definedProps:W,deprecation:L,detectAvif:Bi,detectBasis:Uu,detectCompressed:zh,detectDefaults:Ii,detectMp4:Ui,detectOgv:ki,detectVideoAlphaMode:tr,detectWebm:Li,detectWebp:Ni,determineCrossOrigin:Pu,displacementFrag:ud,displacementVert:hd,displacementWgsl:cd,earcut:ni,effectsMixin:Ye,ensureAttributes:g_,ensureIsBuffer:Uo,ensurePrecision:an,ensureTextOptions:_p,executeInstructions:Ym,extensions:n,extractAttributesFromGlProgram:ax,extractAttributesFromGpuProgram:Tn,extractFontFamilies:om,extractStructAndGroups:Sn,extractSubpaths:Yl,extractSvgUrlId:Xl,fastCopy:_o,findMixin:je,fontStringFromTextStyle:af,formatShader:Rm,fragmentGPUTemplate:ia,fragmentGlTemplate:aa,generateArraySyncSTD40:z_,generateArraySyncWGSL:Rb,generateBlurFragSource:Qc,generateBlurGlProgram:ed,generateBlurProgram:rd,generateBlurVertSource:Jc,generateGPULayout:vm,generateGpuLayoutGroups:An,generateLayout:Tm,generateLayoutHash:Rn,generateParticleUpdateFunction:Iv,generateProgram:dx,generateShaderSyncCode:K_,generateTextStyleKey:ET,generateTextureBatchBit:xa,generateTextureBatchBitGl:va,generateTextureMatrix:sl,generateUniformsSync:_x,getAdjustedBlendModeBlend:yo,getAttributeInfoFromFormat:xn,getBatchSamplersUniformGroup:Ea,getBitmapTextLayout:Mf,getCanvasBoundingBox:Tp,getCanvasFillStyle:uf,getCanvasTexture:Vg,getCharacterGroups:jp,getDefaultUniformValue:Fn,getFastGlobalBounds:Ly,getFastGlobalBoundsMixin:Qe,getFillInstructionData:$l,getFontCss:hm,getFontFamilyName:Zi,getGeometryBounds:ko,getGlTypeFromFormat:T_,getGlobalBounds:Je,getGlobalMixin:ot,getGlobalRenderableBounds:Lc,getLocalBounds:at,getMaxFragmentPrecision:tn,getMaxMiterRatio:ou,getMaxTexturesPerBatch:Eo,getOrientationOfPoints:lo,getPlainText:Mp,getPo2TextureFromSource:Xc,getResolutionOfUrl:cu,getSVGUrl:cm,getSupportedCompressedTextureFormats:Vu,getSupportedGPUCompressedTextureFormats:zu,getSupportedGlCompressedTextureFormats:Hu,getSupportedTextureFormats:Yu,getTemporaryCanvasFromImage:dm,getTestContext:en,getTexelRangeRects:Bx,getTextureBatchBindGroup:mo,getTextureDefaultMatrix:Gv,getTextureFormatFromKTXTexture:Uh,getUboData:lx,getUniformData:ux,getUrlExtension:br,glFormatToGPUFormat:Ih,glUploadBufferImageResource:Ix,glUploadCompressedTextureResource:Dx,glUploadImageResource:Lx,glUploadVideoResource:zx,globalUniformsBit:la,globalUniformsBitGl:ha,globalUniformsUBOBitGl:ua,gpuFormatToBasisTranscoderFormat:sh,gpuFormatToKTXBasisTranscoderFormat:Lh,gpuUploadBufferImageResource:Zb,gpuUploadCompressedTextureResource:ey,gpuUploadImageResource:ny,gpuUploadVideoResource:sy,graphicsContextToSvg:ov,groupD8:R,hasCachedCanvasTexture:Wg,hasTagMarkup:Ap,hasTagStyles:Ep,hslWgsl:Cd,hslgl:ns,hslgpu:ss,injectBits:Ko,insertVersion:ln,isBreakAfterChar:zp,isBreakingSpace:Xp,isCanvasFilterCapable:Hc,isCollapsibleSpace:Hp,isIntegerFormat:X,isMobile:Wr,isNewline:Np,isPow2:z,isRenderingToScreen:Zg,isSafari:im,isSingleItem:_r,isWebGLSupported:ci,isWebGPUSupported:di,ktxTranscoderUrls:Th,loadBasis:th,loadBasisOnWorker:eh,loadBitmapFont:Ci,loadDDS:mh,loadEnvironmentExtensions:Rs,loadFontAsBase64:am,loadFontCSS:lm,loadImageBitmap:Su,loadJson:Wi,loadKTX:bh,loadKTX2:Ch,loadKTX2onWorker:Rh,loadSVGImage:pm,loadSvg:pu,loadTextures:wu,loadTxt:$i,loadVideoTextures:Gu,loadWebFont:eo,localUniformBit:Jd,localUniformBitGl:tp,localUniformBitGroup2:ep,localUniformMSDFBit:Uf,localUniformMSDFBitGl:kf,log2:V,logDebugTexture:RT,logProgramError:cx,logRenderGroupScene:GT,logScene:PT,mSDFBit:Lf,mSDFBitGl:Nf,mapCanvasBlendModesToPixi:Hm,mapFormatToGlFormat:qx,mapFormatToGlInternalFormat:Kx,mapFormatToGlType:Zx,mapGlToVertexFormat:ox,mapSize:vx,mapType:ix,mapViewDimensionToGlTarget:Qx,mapWebGLBlendModesToPixi:Tx,maskFrag:wd,maskVert:Ed,maskWgsl:Ad,matrixPool:qe,measureHtmlText:rm,measureMixin:ct,measureTaggedText:Kp,migrateFragmentFromV7toV8:bx,mipmapScaleModeToGlFilter:Wx,multiplyColors:st,multiplyHexColors:rt,nextPow2:H,noiseFrag:pd,noiseWgsl:fd,nonCompressedFormats:Wu,normalizeExtensionPriority:r,onRenderMixin:dt,parseDDS:fh,parseFunctionBody:ky,parseKTX:xh,parseSVGDefinitions:Ol,parseSVGFloatAttribute:Il,parseSVGPath:io,parseSVGStyle:zl,parseTaggedText:Cp,particleData:qv,particlesFrag:Uv,particlesVert:kv,particlesWgsl:Lv,passthroughFrag:_d,passthroughWgsl:xd,path:fr,pointInTriangle:Dc,preloadVideo:Mu,removeItems:Xe,removeStructAndGroupDuplicates:Cn,resetUids:B,resolveCharacters:Pf,resolveCompressedTextureUrl:Xh,resolveJsonUrl:Fu,resolveTextureUrl:Bu,resourceToTexture:ur,roundPixelsBit:Ta,roundPixelsBitGl:Sa,roundedShapeArc:Cl,roundedShapeQuadraticCurve:Ml,sayHello:Og,scaleModeToGlFilter:Vx,setBasisTranscoderPath:Zu,setKTXTranscoderPath:Sh,setPositions:lp,setProgramName:cn,setUvs:hp,shapeBuilders:il,sortMixin:pt,spritesheetAsset:Er,squaredDistanceToLineSegment:uo,stripVersion:dn,styleAttributes:Hl,testImageFormat:Gi,testVideoFormat:Di,textStyleToCSS:$f,textureBit:Cm,textureBitGl:Mm,textureFrom:hr,tilingBit:rp,tilingBitGl:np,toFillStyle:su,toLocalGlobalMixin:mt,toStrokeStyle:iu,tokenize:Yp,tokenizeTaggedRuns:Qp,transformVertices:Fa,triangulateWithHoles:Wa,trimRight:$p,uboSyncFunctionsSTD40:X_,uboSyncFunctionsWGSL:H_,uid:G,uniformParsers:k_,unpremultiplyAlpha:Jx,unsafeEvalSupported:Ps,updateLocalTransform:Hy,updateQuadBounds:te,updateRenderGroupTransform:cg,updateRenderGroupTransforms:hg,updateTextBounds:_f,updateTransformAndChildren:dg,updateTransformBackwards:tt,updateWorldTransform:zy,v8_0_0:I,v8_21_0:D,v8_22_0:U,v8_3_4:O,validFormats:Nh,validateRenderables:fg,vertexGPUTemplate:sa,vertexGlTemplate:oa,vkFormatToGPUFormat:Dh,warn:Oe,warnIgnoredTextureStyle:gf,webworkerExt:i,wordWrap:tf,wordWrapTaggedLines:Zp,wrapModeToGlAddress:$x});const FT=/funpixel-|__FUNPIXEL|hooked-|hookFactory|makeHooked|node_modules|@vite\/|webpack|rollup/;const IT={};function OT(e,t,r){const n=class extends e{constructor(...e){super(...e),this.__src=function(){const e=(new Error).stack;if(!e)return null;const t=e.split("\n");for(let e=2;e<t.length;e++){const r=t[e];if(FT.test(r))continue;const n=r.match(/(?:\(|@)(https?:\/\/[^\s)]+):(\d+):(\d+)/)||r.match(/\((file:\/\/[^\s)]+):(\d+):(\d+)\)/)||r.match(/at\s+(https?:\/\/[^\s]+):(\d+):(\d+)/);if(n)return{f:n[1],l:+n[2],c:+n[3]}}return null}(),IT[t]=(IT[t]||0)+1,this.__n=this.label||this.name||r(this,e,t)||`${t}_${IT[t]}`,"undefined"!=typeof window&&window.__FUNPIXEL_TRACK__&&window.__FUNPIXEL_TRACK__(this,this.__n)}};return Object.defineProperty(n,"name",{value:t}),n}function DT(e,t,r){return e.texture?.textureCacheIds?.[0]?e.texture.textureCacheIds[0]:e.texture?.source?.label?e.texture.source.label:e.text&&"string"==typeof e.text?`text:"${e.text.slice(0,20)}"`:null}function UT(){return null}"undefined"!=typeof window&&(window.PIXI=BT);class kT extends Ti{constructor(...e){super(...e),"undefined"!=typeof window&&(window.__PIXI_APP__=this)}async init(e){const t={...e,preserveDrawingBuffer:!0};return super.init(t)}}const LT=OT(Ot,"Container",UT),NT=OT(Ut,"Sprite",DT),XT=OT(Nd,"Graphics",UT),HT=OT(wf,"Text",DT),zT=OT($d,"Mesh",UT),VT=OT(Yd,"AnimatedSprite",DT),WT=OT(mp,"TilingSprite",DT),$T=OT(Qv,"ParticleContainer",UT),YT=OT(Wf,"BitmapText",DT),jT=OT(mm,"HTMLText",DT),qT=OT(Pv,"MeshSimple",UT),KT=OT(Ev,"MeshPlane",UT),ZT=OT(Mv,"MeshRope",UT),QT=OT(hT,"NineSliceSprite",UT);n.add(Yr),n.mixin(Ot,jr),n.add(Zh),n.add(Ac),n.mixin(Ot,Rc),n.add(Sd,Vc),n.add(yd);var JT=Object.freeze({__proto__:null}),eS=Object.freeze({__proto__:null});export{Af as AbstractBitmapFont,If as AbstractBitmapTextPipe,hi as AbstractRenderer,mT as AbstractSplitText,gp as AbstractText,vf as AbstractTextSystem,Yr as AccessibilitySystem,qc as AlphaFilter,Ht as AlphaMask,Bm as AlphaMaskPipe,VT as AnimatedSprite,kT as Application,_i as ApplicationInitHook,Ou as Assets,Iu as AssetsClass,xo as BLEND_TO_NPM,Bp as BREAKING_SPACES,Fp as BREAKING_SPACES_SET,Dp as BREAK_AFTER_CHARS,Up as BREAK_AFTER_CHARS_SET,c_ as BUFFER_TYPE,Mi as BackgroundLoader,xg as BackgroundSystem,Ro as Batch,Ho as BatchGeometry,Ao as BatchTextureArray,Oa as BatchableGraphics,nm as BatchableHTMLText,zd as BatchableMesh,xf as BatchableSprite,bf as BatchableText,Io as Batcher,Am as BatcherPipe,Le as BigPool,Dn as BindGroup,fb as BindGroupSystem,dT as BitmapFont,Bf as BitmapFontManager,YT as BitmapText,Ff as BitmapTextGraphics,Vf as BitmapTextPipe,ts as BlendModeFilter,ag as BlendModePipe,id as BlurFilter,sd as BlurFilterPass,ne as Bounds,Wt as BrowserAdapter,Do as Buffer,Z as BufferImageSource,j_ as BufferResource,Oo as BufferUsage,si as CLEAR,Ip as COLLAPSIBLE_SPACES,Op as COLLAPSIBLE_SPACES_SET,ir as Cache,bm as CanvasBatchAdaptor,Df as CanvasBitmapTextPipe,Fm as CanvasColorMaskPipe,Vm as CanvasContextSystem,Vc as CanvasFilterSystem,sg as CanvasGraphicsAdaptor,Id as CanvasGraphicsContextSystem,Od as CanvasGraphicsPipe,Wm as CanvasLimitsSystem,sT as CanvasNineSliceSpritePipe,Ar as CanvasObserver,Bv as CanvasParticleContainerAdaptor,Hv as CanvasParticleContainerPipe,Oc as CanvasPool,Ic as CanvasPoolClass,Jg as CanvasRenderTargetAdaptor,e_ as CanvasRenderTargetSystem,u_ as CanvasRenderer,Tf as CanvasRendererTextSystem,jt as CanvasSource,Lm as CanvasStencilMaskPipe,df as CanvasTextGenerator,sf as CanvasTextMetrics,yf as CanvasTextPipe,Sf as CanvasTextSystem,t_ as CanvasTextureSystem,Qd as CanvasTilingSpritePipe,oo as Circle,Be as Color,is as ColorBlend,os as ColorBurnBlend,as as ColorDodgeBlend,zt as ColorMask,Im as ColorMaskPipe,ld as ColorMatrixFilter,ku as CompressedSource,LT as Container,Fy as CubeTexture,Gy as CubeTextureSource,jh as Culler,qh as CullerPlugin,$m as CustomRenderPipe,oh as D3D10_RESOURCE_DIMENSION,uh as D3DFMT,mi as DATA_URI,dh as DDS,f as DEG_TO_RAD,My as DEPRECATED_SCALE_MODES,Ry as DEPRECATED_WRAP_MODES,Yt as DOMAdapter,Kh as DOMContainer,Zh as DOMPipe,Ay as DRAW_MODES,ih as DXGI_FORMAT,ch as DXGI_TO_TEXTURE_FORMAT,ls as DarkenBlend,Ma as DefaultBatcher,Aa as DefaultShader,us as DifferenceBlend,dd as DisplacementFilter,hs as DivideBlend,Cf as DynamicBitmapFont,ao as Ellipse,Sc as EventBoundary,c as EventEmitter,Ac as EventSystem,_c as EventsTicker,cs as ExclusionBlend,e as ExtensionType,Dy as ExternalSource,vg as ExtractSystem,hh as FOURCC_TO_TEXTURE_FORMAT,Rc as FederatedContainer,Rr as FederatedEvent,xc as FederatedMouseEvent,bc as FederatedPointerEvent,yc as FederatedWheelEvent,Qa as FillGradient,Jl as FillPattern,Zn as Filter,Ve as FilterEffect,yd as FilterPipe,Sd as FilterSystem,um as FontStylePromiseCache,Kc as GAUSSIAN_VALUES,Pa as GCManagedHash,Pg as GCSystem,__ as GL_FORMATS,gh as GL_INTERNAL_FORMAT,x_ as GL_TARGETS,y_ as GL_TYPES,b_ as GL_WRAP_MODES,uy as GPUTextureGpuData,Ag as GenerateTextureSystem,Lo as Geometry,C_ as GlBackBufferSystem,ym as GlBatchAdaptor,d_ as GlBuffer,p_ as GlBufferSystem,M_ as GlColorMaskSystem,m_ as GlContextSystem,P_ as GlEncoderSystem,w_ as GlGeometryGpuData,E_ as GlGeometrySystem,rb as GlGraphicsAdaptor,G_ as GlLimitsSystem,nb as GlMeshAdaptor,zv as GlParticleContainerAdaptor,Vv as GlParticleContainerPipe,gn as GlProgram,Q_ as GlProgramData,B_ as GlRenderTarget,$_ as GlRenderTargetAdaptor,Y_ as GlRenderTargetSystem,fx as GlShaderSystem,Px as GlStateSystem,I_ as GlStencilSystem,Gx as GlTexture,tb as GlTextureSystem,W_ as GlUboSystem,xx as GlUniformGroupSystem,De as GlobalResourceRegistry,Gg as GlobalUniformSystem,ay as Gpu3dMipmapGenerator,wm as GpuBatchAdaptor,jb as GpuBlendModesToPixi,mb as GpuBufferData,gb as GpuBufferSystem,xb as GpuColorMaskSystem,yb as GpuDeviceSystem,Tb as GpuEncoderSystem,fy as GpuGraphicsAdaptor,cl as GpuGraphicsContext,Sb as GpuLimitsSystem,my as GpuMeshAdapter,ly as GpuMipmapGenerator,Hb as GpuMsaaRestore,Wv as GpuParticleContainerAdaptor,$v as GpuParticleContainerPipe,Pn as GpuProgram,zb as GpuRenderTarget,Wb as GpuRenderTargetAdaptor,$b as GpuRenderTargetSystem,Yb as GpuShaderSystem,qb as GpuStateSystem,F_ as GpuStencilModesToPixi,wb as GpuStencilSystem,py as GpuTextureSystem,Mb as GpuUboSystem,Gb as GpuUniformBatchPipe,XT as Graphics,hu as GraphicsContext,dl as GraphicsContextRenderData,fl as GraphicsContextSystem,kd as GraphicsGpuData,Bl as GraphicsPath,Ld as GraphicsPipe,jT as HTMLText,sm as HTMLTextPipe,em as HTMLTextRenderData,Zf as HTMLTextStyle,fm as HTMLTextSystem,ds as HardLightBlend,ps as HardMixBlend,Dg as HelloSystem,Z_ as IGLUniformData,qt as ImageSource,gt as InstructionSet,_h as KTX,fs as LightenBlend,ms as LinearBurnBlend,gs as LinearDodgeBlend,_s as LinearLightBlend,Hi as Loader,cr as LoaderParserPriority,xs as LuminosityBlend,$e as MaskEffectManager,We as MaskEffectManagerClass,Rd as MaskFilter,_ as Matrix,zT as Mesh,Hd as MeshGeometry,Vd as MeshGpuData,Wd as MeshPipe,KT as MeshPlane,ZT as MeshRope,qT as MeshSimple,Pp as NEWLINES,Gp as NEWLINES_SET,Lp as NEWLINE_MATCH_REGEX,kp as NEWLINE_SPLIT_REGEX,N as NOOP,bs as NegationBlend,oT as NineSliceGeometry,cT as NineSlicePlane,QT as NineSliceSprite,aT as NineSliceSpriteGpuData,lT as NineSliceSpritePipe,gd as NoiseFilter,o as ObservablePoint,ys as OverlayBlend,d as PI_2,jv as Particle,Dv as ParticleBuffer,$T as ParticleContainer,Xv as ParticleContainerPipe,Nv as ParticleShader,bd as PassthroughFilter,wv as PerspectiveMesh,Tv as PerspectivePlaneGeometry,vs as PinLightBlend,Xb as PipelineSystem,cv as PlaneGeometry,m as Point,ho as Polygon,Ue as Pool,ke as PoolGroupClass,Pd as PrepareBase,Ef as PrepareQueue,_m as PrepareSystem,gm as PrepareUpload,ap as QuadGeometry,p as RAD_TO_DEG,M as Rectangle,vb as RenderBundle,Ny as RenderContainer,Et as RenderGroup,jm as RenderGroupPipe,gg as RenderGroupSystem,uv as RenderLayer,Hg as RenderTarget,Qg as RenderTargetSystem,Tg as RenderTexture,kg as RenderableGCSystem,xi as RendererInitHook,Un as RendererType,bi as ResizePlugin,xr as Resolver,Rv as RopeGeometry,po as RoundedRectangle,Py as SCALE_MODES,Xn as STATE_BITS,bo as STENCIL_MODES,Vy as SVGDefsCollector,Kl as SVGParser,Ts as SaturationBlend,Fg as SchedulerSystem,Om as ScissorMask,_t as ScreenSizeRegistry,zf as SdfShader,Ln as Shader,kn as ShaderOverrides,wn as ShaderStage,Gl as ShapePath,qg as SharedRenderPipes,jg as SharedSystems,Ss as SoftLightBlend,_T as SplitBitmapText,ST as SplitText,NT as Sprite,ig as SpritePipe,Tr as Spritesheet,qn as State,Vt as StencilMask,Nm as StencilMaskPipe,ws as SubtractBlend,ii as SystemRunner,ph as TEXTURE_FORMAT_BLOCK_SIZE,HT as Text,ff as TextStyle,ee as Texture,Ng as TextureGCSystem,J as TextureMatrix,wt as TexturePool,St as TexturePoolClass,K as TextureSource,j as TextureStyle,Uy as TextureUvs,q_ as TextureView,er as Ticker,Zt as TickerListener,yi as TickerPlugin,WT as TilingSprite,dp as TilingSpriteGpuData,pp as TilingSpritePipe,op as TilingSpriteShader,jd as Transform,Uc as Triangle,gx as UNIFORM_TO_ARRAY_SETTERS,mx as UNIFORM_TO_SINGLE_SETTERS,Bn as UNIFORM_TYPES_MAP,Gn as UNIFORM_TYPES_VALUES,Bt as UPDATE_BLEND,Gt as UPDATE_COLOR,Kt as UPDATE_PRIORITY,It as UPDATE_TRANSFORM,Ft as UPDATE_VISIBLE,_b as UboBatch,O_ as UboSystem,On as UniformGroup,gi as VERSION,nr as VideoSource,Dt as ViewContainer,Yg as ViewSystem,go as ViewableBuffer,Es as VividLightBlend,Eb as WGSL_ALIGN_SIZE_DATA,D_ as WGSL_TO_STD40_SIZE,Cy as WRAP_MODES,cb as WebGLRenderer,Sy as WebGPURenderer,gc as WebWorkerAdapter,yu as WorkerManager,jr as accessibilityTarget,zo as addBits,Lt as addMaskBounds,Nt as addMaskLocalBounds,rn as addProgramDefines,$c as alphaFrag,Yc as alphaWgsl,ql as appendSVGPath,up as applyMatrix,dv as applyProjectiveTransformationToPlane,jx as applyStyleParams,oy as assertMipmap3dTexture,At as assignWithIgnore,Cs as autoDetectEnvironment,fi as autoDetectRenderer,ar as autoDetectSource,Db as bakeOverridesIntoSource,Ku as basisTranscoderUrls,it as bgr2rgb,Ri as bitmapFontCachePlugin,Si as bitmapFontTextParser,wi as bitmapFontXMLParser,Ei as bitmapFontXMLStringParser,fT as bitmapTextSplit,Qn as blendTemplateFrag,Jn as blendTemplateVert,es as blendTemplateWgsl,Qb as blockDataMap,td as blurTemplateWgsl,Ke as boundsPool,s as browserExt,gl as buildAdaptiveBezier,xl as buildAdaptiveQuadratic,yl as buildArc,vl as buildArcTo,Rl as buildArcToSvg,Da as buildCircle,ll as buildContextBatches,Ua as buildEllipse,av as buildGeometryFromPath,za as buildLine,Va as buildPixelLine,Ya as buildPolygon,ja as buildRectangle,ka as buildRoundedRectangle,sv as buildSVGFillAttributes,jy as buildSVGPath,iv as buildSVGStrokeAttributes,Ba as buildSimpleUvs,qa as buildTriangle,Ga as buildUvs,Ne as cacheAsTextureMixin,Pi as cacheTextureArray,jl as calculatePathArea,Kg as calculateProjection,Pc as canUseNewCanvasBlendModes,vT as canvasTextSplit,Gc as canvasUtils,ut as checkChildrenDidChange,zi as checkDataUrl,Vi as checkExtension,Wl as checkForNestedPattern,So as checkMaxIfStatementsInShader,He as childrenHelperMixin,Cg as cleanArray,Rg as cleanHash,lg as clearList,La as closePointEps,Wp as collapseNewlines,Vp as collapseSpaces,Xy as collectAllRenderables,ze as collectRenderablesMixin,Ud as color32BitToUniform,pa as colorBit,fa as colorBitGl,od as colorMatrixFilterFrag,ad as colorMatrixFilterWgsl,Dd as colorToUniform,Yx as compareModeToGlCompare,L_ as compileBufferSync,ea as compileHighShader,ta as compileHighShaderGl,da as compileHighShaderGlProgram,ca as compileHighShaderGpuProgram,Wo as compileHooks,Yo as compileInputs,qo as compileOutputs,J_ as compileShader,vv as compute2DProjection,Ph as convertFormatIfRequired,sr as convertToList,yr as copySearchParams,kx as createGlUploadCubeTextureResource,ry as createGpuUploadCubeTextureResource,Zr as createIdFromString,Fv as createIndicesForQuads,rh as createLevelBuffers,Bh as createLevelBuffersFromKTX,gr as createStringVariations,du as createTexture,U_ as createUboElementsSTD40,Ab as createUboElementsWGSL,V_ as createUboSyncFunctionSTD40,Cb as createUboSyncFunctionWGSL,Cu as crossOrigin,Fe as cullingMixin,Na as curveEps,Wc as defaultFilterVert,tx as defaultValue,W as definedProps,L as deprecation,Bi as detectAvif,Uu as detectBasis,zh as detectCompressed,Ii as detectDefaults,Ui as detectMp4,ki as detectOgv,tr as detectVideoAlphaMode,Li as detectWebm,Ni as detectWebp,Pu as determineCrossOrigin,ud as displacementFrag,hd as displacementVert,cd as displacementWgsl,ni as earcut,Ye as effectsMixin,g_ as ensureAttributes,Uo as ensureIsBuffer,an as ensurePrecision,_p as ensureTextOptions,Ym as executeInstructions,n as extensions,ax as extractAttributesFromGlProgram,Tn as extractAttributesFromGpuProgram,om as extractFontFamilies,Sn as extractStructAndGroups,Yl as extractSubpaths,Xl as extractSvgUrlId,_o as fastCopy,je as findMixin,af as fontStringFromTextStyle,Rm as formatShader,ia as fragmentGPUTemplate,aa as fragmentGlTemplate,z_ as generateArraySyncSTD40,Rb as generateArraySyncWGSL,Qc as generateBlurFragSource,ed as generateBlurGlProgram,rd as generateBlurProgram,Jc as generateBlurVertSource,vm as generateGPULayout,An as generateGpuLayoutGroups,Tm as generateLayout,Rn as generateLayoutHash,Iv as generateParticleUpdateFunction,dx as generateProgram,K_ as generateShaderSyncCode,ET as generateTextStyleKey,xa as generateTextureBatchBit,va as generateTextureBatchBitGl,sl as generateTextureMatrix,_x as generateUniformsSync,yo as getAdjustedBlendModeBlend,xn as getAttributeInfoFromFormat,Ea as getBatchSamplersUniformGroup,Mf as getBitmapTextLayout,Tp as getCanvasBoundingBox,uf as getCanvasFillStyle,Vg as getCanvasTexture,jp as getCharacterGroups,Fn as getDefaultUniformValue,Ly as getFastGlobalBounds,Qe as getFastGlobalBoundsMixin,$l as getFillInstructionData,hm as getFontCss,Zi as getFontFamilyName,ko as getGeometryBounds,T_ as getGlTypeFromFormat,Je as getGlobalBounds,ot as getGlobalMixin,Lc as getGlobalRenderableBounds,at as getLocalBounds,tn as getMaxFragmentPrecision,ou as getMaxMiterRatio,Eo as getMaxTexturesPerBatch,lo as getOrientationOfPoints,Mp as getPlainText,Xc as getPo2TextureFromSource,cu as getResolutionOfUrl,cm as getSVGUrl,Vu as getSupportedCompressedTextureFormats,zu as getSupportedGPUCompressedTextureFormats,Hu as getSupportedGlCompressedTextureFormats,Yu as getSupportedTextureFormats,dm as getTemporaryCanvasFromImage,en as getTestContext,Bx as getTexelRangeRects,mo as getTextureBatchBindGroup,Gv as getTextureDefaultMatrix,Uh as getTextureFormatFromKTXTexture,lx as getUboData,ux as getUniformData,br as getUrlExtension,Ih as glFormatToGPUFormat,Ix as glUploadBufferImageResource,Dx as glUploadCompressedTextureResource,Lx as glUploadImageResource,zx as glUploadVideoResource,la as globalUniformsBit,ha as globalUniformsBitGl,ua as globalUniformsUBOBitGl,sh as gpuFormatToBasisTranscoderFormat,Lh as gpuFormatToKTXBasisTranscoderFormat,Zb as gpuUploadBufferImageResource,ey as gpuUploadCompressedTextureResource,ny as gpuUploadImageResource,sy as gpuUploadVideoResource,ov as graphicsContextToSvg,R as groupD8,Wg as hasCachedCanvasTexture,Ap as hasTagMarkup,Ep as hasTagStyles,Cd as hslWgsl,ns as hslgl,ss as hslgpu,Ko as injectBits,ln as insertVersion,zp as isBreakAfterChar,Xp as isBreakingSpace,Hc as isCanvasFilterCapable,Hp as isCollapsibleSpace,X as isIntegerFormat,Wr as isMobile,Np as isNewline,z as isPow2,Zg as isRenderingToScreen,im as isSafari,_r as isSingleItem,ci as isWebGLSupported,di as isWebGPUSupported,Th as ktxTranscoderUrls,th as loadBasis,eh as loadBasisOnWorker,Ci as loadBitmapFont,mh as loadDDS,Rs as loadEnvironmentExtensions,am as loadFontAsBase64,lm as loadFontCSS,Su as loadImageBitmap,Wi as loadJson,bh as loadKTX,Ch as loadKTX2,Rh as loadKTX2onWorker,pm as loadSVGImage,pu as loadSvg,wu as loadTextures,$i as loadTxt,Gu as loadVideoTextures,eo as loadWebFont,Jd as localUniformBit,tp as localUniformBitGl,ep as localUniformBitGroup2,Uf as localUniformMSDFBit,kf as localUniformMSDFBitGl,V as log2,RT as logDebugTexture,cx as logProgramError,GT as logRenderGroupScene,PT as logScene,Lf as mSDFBit,Nf as mSDFBitGl,Hm as mapCanvasBlendModesToPixi,qx as mapFormatToGlFormat,Kx as mapFormatToGlInternalFormat,Zx as mapFormatToGlType,ox as mapGlToVertexFormat,vx as mapSize,ix as mapType,Qx as mapViewDimensionToGlTarget,Tx as mapWebGLBlendModesToPixi,wd as maskFrag,Ed as maskVert,Ad as maskWgsl,qe as matrixPool,rm as measureHtmlText,ct as measureMixin,Kp as measureTaggedText,bx as migrateFragmentFromV7toV8,Wx as mipmapScaleModeToGlFilter,st as multiplyColors,rt as multiplyHexColors,H as nextPow2,pd as noiseFrag,fd as noiseWgsl,Wu as nonCompressedFormats,r as normalizeExtensionPriority,dt as onRenderMixin,fh as parseDDS,ky as parseFunctionBody,xh as parseKTX,Ol as parseSVGDefinitions,Il as parseSVGFloatAttribute,io as parseSVGPath,zl as parseSVGStyle,Cp as parseTaggedText,qv as particleData,Uv as particlesFrag,kv as particlesVert,Lv as particlesWgsl,_d as passthroughFrag,xd as passthroughWgsl,fr as path,Dc as pointInTriangle,Mu as preloadVideo,Xe as removeItems,Cn as removeStructAndGroupDuplicates,B as resetUids,Pf as resolveCharacters,Xh as resolveCompressedTextureUrl,Fu as resolveJsonUrl,Bu as resolveTextureUrl,ur as resourceToTexture,Ta as roundPixelsBit,Sa as roundPixelsBitGl,Cl as roundedShapeArc,Ml as roundedShapeQuadraticCurve,Og as sayHello,Vx as scaleModeToGlFilter,Zu as setBasisTranscoderPath,Sh as setKTXTranscoderPath,lp as setPositions,cn as setProgramName,hp as setUvs,il as shapeBuilders,pt as sortMixin,Er as spritesheetAsset,uo as squaredDistanceToLineSegment,dn as stripVersion,Hl as styleAttributes,Gi as testImageFormat,Di as testVideoFormat,$f as textStyleToCSS,Cm as textureBit,Mm as textureBitGl,hr as textureFrom,rp as tilingBit,np as tilingBitGl,su as toFillStyle,mt as toLocalGlobalMixin,iu as toStrokeStyle,Yp as tokenize,Qp as tokenizeTaggedRuns,Fa as transformVertices,Wa as triangulateWithHoles,$p as trimRight,X_ as uboSyncFunctionsSTD40,H_ as uboSyncFunctionsWGSL,G as uid,k_ as uniformParsers,Jx as unpremultiplyAlpha,Ps as unsafeEvalSupported,Hy as updateLocalTransform,te as updateQuadBounds,cg as updateRenderGroupTransform,hg as updateRenderGroupTransforms,_f as updateTextBounds,dg as updateTransformAndChildren,tt as updateTransformBackwards,zy as updateWorldTransform,I as v8_0_0,D as v8_21_0,U as v8_22_0,O as v8_3_4,Nh as validFormats,fg as validateRenderables,sa as vertexGPUTemplate,oa as vertexGlTemplate,Dh as vkFormatToGPUFormat,Oe as warn,gf as warnIgnoredTextureStyle,i as webworkerExt,tf as wordWrap,Zp as wordWrapTaggedLines,$x as wrapModeToGlAddress};
|