aimeat 1.40.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -15
- package/dist/.env.example +528 -495
- package/dist/locales/en.json +314 -297
- package/dist/locales/fi.json +314 -297
- package/dist/public/components/ContactPicker.js +145 -0
- package/dist/public/components/EmptyState.js +22 -7
- package/dist/public/components/NotificationBell.js +92 -7
- package/dist/public/cortex-bundled/aimeat-dag.js +553 -0
- package/dist/public/cortex-bundled/aimeat-dag.yaml +77 -0
- package/dist/public/cortex-bundled/aimeat-flow.js +225 -0
- package/dist/public/cortex-bundled/aimeat-flow.yaml +101 -0
- package/dist/public/cortex-bundled/aimeat-ui-motion.js +323 -0
- package/dist/public/cortex-bundled/aimeat-ui-motion.yaml +86 -0
- package/dist/public/css/components/contact-picker.css +26 -0
- package/dist/public/css/theme.css +52 -2
- package/dist/public/css/views/admin.css +51 -1
- package/dist/public/css/views/agents-detail.css +78 -14
- package/dist/public/css/views/capabilities.css +2 -0
- package/dist/public/css/views/companies.css +0 -1
- package/dist/public/css/views/inbox.css +142 -7
- package/dist/public/css/views/landing.css +2 -0
- package/dist/public/css/views/members.css +0 -1
- package/dist/public/css/views/my-company.css +5 -5
- package/dist/public/css/views/offers.css +0 -3
- package/dist/public/css/views/portal-dev.css +49 -0
- package/dist/public/css/views/profile.css +171 -13
- package/dist/public/css/views/public-knowledge-viewer.css +0 -17
- package/dist/public/css/views/scheduler.css +37 -1
- package/dist/public/css/views/workflows.css +1 -1
- package/dist/public/js/services/admin.js +10 -0
- package/dist/public/js/services/agent-activity.js +15 -0
- package/dist/public/js/services/agent-directives.js +14 -0
- package/dist/public/js/services/agent-integration.js +15 -0
- package/dist/public/js/services/agent-messages.js +14 -0
- package/dist/public/js/services/agent-tasks.js +14 -0
- package/dist/public/js/services/appdev.js +67 -0
- package/dist/public/js/services/apps.js +28 -0
- package/dist/public/js/services/calibrator.js +14 -1
- package/dist/public/js/services/consent.js +17 -0
- package/dist/public/js/services/contacts.js +47 -0
- package/dist/public/js/services/ecosystem.js +14 -0
- package/dist/public/js/services/generator.js +71 -35
- package/dist/public/js/services/knowledge.js +14 -0
- package/dist/public/js/services/ledger.js +18 -0
- package/dist/public/js/services/living.js +14 -0
- package/dist/public/js/services/messages.js +7 -1
- package/dist/public/js/services/organisms.js +48 -4
- package/dist/public/js/services/schedules.js +19 -2
- package/dist/public/js/services/security.js +14 -0
- package/dist/public/js/services/work.js +14 -0
- package/dist/public/lib/VENDORED.md +77 -0
- package/dist/public/lib/drawflow@0.min.css +1 -0
- package/dist/public/lib/drawflow@0.min.js +1 -0
- package/dist/public/lib/fonts/LICENSE.md +13 -0
- package/dist/public/lib/fonts/baloo2-latin-ext.woff2 +0 -0
- package/dist/public/lib/fonts/baloo2-latin.woff2 +0 -0
- package/dist/public/lib/fonts/bangers-latin-ext.woff2 +0 -0
- package/dist/public/lib/fonts/bangers-latin.woff2 +0 -0
- package/dist/public/lib/fonts.css +51 -0
- package/dist/public/lib/p5@1.min.js +2 -0
- package/dist/public/lib/phaser@3.min.js +1 -0
- package/dist/public/lib/pixi-unsafe-eval@8.min.js +22 -0
- package/dist/public/lib/pixi@8.min.js +2329 -0
- package/dist/public/lib/realtime.js +120 -3
- package/dist/public/lib/samples/LICENSE.md +21 -9
- package/dist/public/lib/samples/bass/A1.mp3 +0 -0
- package/dist/public/lib/samples/bass/B2.mp3 +0 -0
- package/dist/public/lib/samples/bass/D2.mp3 +0 -0
- package/dist/public/lib/samples/bass/E1.mp3 +0 -0
- package/dist/public/lib/samples/bass/E3.mp3 +0 -0
- package/dist/public/lib/samples/bass/G2.mp3 +0 -0
- package/dist/public/lib/samples/drums/clap.mp3 +0 -0
- package/dist/public/lib/samples/drums/cowbell.mp3 +0 -0
- package/dist/public/lib/samples/drums/crash.mp3 +0 -0
- package/dist/public/lib/samples/drums/hihat-open.mp3 +0 -0
- package/dist/public/lib/samples/drums/hihat.mp3 +0 -0
- package/dist/public/lib/samples/drums/kick.mp3 +0 -0
- package/dist/public/lib/samples/drums/ride.mp3 +0 -0
- package/dist/public/lib/samples/drums/snare.mp3 +0 -0
- package/dist/public/lib/samples/drums/tom-high.mp3 +0 -0
- package/dist/public/lib/samples/drums/tom-low.mp3 +0 -0
- package/dist/public/lib/samples/drums/tom-mid.mp3 +0 -0
- package/dist/public/lib/samples/flute/A4.mp3 +0 -0
- package/dist/public/lib/samples/flute/A5.mp3 +0 -0
- package/dist/public/lib/samples/flute/C4.mp3 +0 -0
- package/dist/public/lib/samples/flute/C5.mp3 +0 -0
- package/dist/public/lib/samples/flute/C6.mp3 +0 -0
- package/dist/public/lib/samples/flute/E4.mp3 +0 -0
- package/dist/public/lib/samples/flute/E5.mp3 +0 -0
- package/dist/public/lib/samples/guitar/A2.mp3 +0 -0
- package/dist/public/lib/samples/guitar/A4.mp3 +0 -0
- package/dist/public/lib/samples/guitar/B3.mp3 +0 -0
- package/dist/public/lib/samples/guitar/D3.mp3 +0 -0
- package/dist/public/lib/samples/guitar/E2.mp3 +0 -0
- package/dist/public/lib/samples/guitar/E4.mp3 +0 -0
- package/dist/public/lib/samples/guitar/E5.mp3 +0 -0
- package/dist/public/lib/samples/guitar/G3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/A2.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/A4.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/B3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/D3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/E2.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/E4.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/E5.mp3 +0 -0
- package/dist/public/lib/samples/guitar-el/G3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/A2.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/A4.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/B3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/D3.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/E2.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/E4.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/E5.mp3 +0 -0
- package/dist/public/lib/samples/guitar-steel/G3.mp3 +0 -0
- package/dist/public/llms-template.txt +42 -21
- package/dist/public/spa.html +40 -34
- package/dist/public/style-testbed.html +0 -2
- package/dist/public/sw.js +23 -4
- package/dist/public/views/_template.js +21 -8
- package/dist/public/views/admin/cortex-tab.js +2 -2
- package/dist/public/views/admin/database-tab.js +140 -0
- package/dist/public/views/admin/feedback-tab.js +162 -0
- package/dist/public/views/admin/owners-tab.js +19 -29
- package/dist/public/views/admin/push-tab.js +2 -2
- package/dist/public/views/admin/services-tab.js +4 -4
- package/dist/public/views/admin/shared.js +9 -3
- package/dist/public/views/admin/sharing-groups-tab.js +13 -25
- package/dist/public/views/admin/stats-tab.js +33 -33
- package/dist/public/views/admin.js +52 -49
- package/dist/public/views/companies.js +9 -7
- package/dist/public/views/help.js +2 -1
- package/dist/public/views/invite-accept.js +64 -19
- package/dist/public/views/landing.js +41 -8
- package/dist/public/views/members.js +4 -2
- package/dist/public/views/my-company.js +27 -77
- package/dist/public/views/my-company.payments.js +177 -0
- package/dist/public/views/portal-classic.js +0 -4
- package/dist/public/views/portal-dev.js +11 -0
- package/dist/public/views/portal-dev.panels.js +52 -58
- package/dist/public/views/portal.components.js +18 -36
- package/dist/public/views/portal.prompts.js +9 -10
- package/dist/public/views/profile/access-tab/access-tokens.js +3 -3
- package/dist/public/views/profile/access-tab/agent-defaults.js +3 -3
- package/dist/public/views/profile/access-tab/connected-apps.js +5 -3
- package/dist/public/views/profile/access-tab/sharing-groups.js +8 -7
- package/dist/public/views/profile/access-tab.js +26 -10
- package/dist/public/views/profile/agents/agent-card.js +16 -5
- package/dist/public/views/profile/agents/tab-activity.js +27 -9
- package/dist/public/views/profile/agents/tab-agent-config.js +4 -1
- package/dist/public/views/profile/agents/tab-contracts.js +11 -3
- package/dist/public/views/profile/agents/tab-data-access.js +36 -20
- package/dist/public/views/profile/agents/tab-directives.js +2 -1
- package/dist/public/views/profile/agents/tab-integration.js +46 -23
- package/dist/public/views/profile/agents/tab-messages.js +37 -6
- package/dist/public/views/profile/agents/tab-quality.js +32 -8
- package/dist/public/views/profile/agents/tab-schedules.js +15 -10
- package/dist/public/views/profile/agents/tab-usage.js +19 -8
- package/dist/public/views/profile/agents-capabilities-subtab.js +3 -3
- package/dist/public/views/profile/agents-tab.js +11 -1
- package/dist/public/views/profile/appdev-tab.js +275 -0
- package/dist/public/views/profile/apps-tab.js +230 -1
- package/dist/public/views/profile/calibrator-batch.js +2 -2
- package/dist/public/views/profile/calibrator-tab.js +69 -37
- package/dist/public/views/profile/capabilities-tab.js +24 -13
- package/dist/public/views/profile/contacts-tab.js +139 -0
- package/dist/public/views/profile/data-wallet-tab.js +37 -18
- package/dist/public/views/profile/discover-tab.js +2 -1
- package/dist/public/views/profile/ecosystem-tab.automation.js +21 -7
- package/dist/public/views/profile/extensions-tab.js +4 -2
- package/dist/public/views/profile/extensions-tab.maturity.js +40 -0
- package/dist/public/views/profile/generator-dashboard/DebugPanel.js +16 -9
- package/dist/public/views/profile/generator-dashboard/use-dashboard-core.js +46 -26
- package/dist/public/views/profile/generator-dashboard/use-edit-mode.js +29 -25
- package/dist/public/views/profile/generator-dashboard/use-test-execution.js +14 -14
- package/dist/public/views/profile/generator-detail.ai.js +21 -0
- package/dist/public/views/profile/generator-detail.js +59 -26
- package/dist/public/views/profile/generator-detail.results.js +1 -1
- package/dist/public/views/profile/generator-settings.js +51 -47
- package/dist/public/views/profile/generator-tab.js +28 -7
- package/dist/public/views/profile/inbox-tab/components.js +110 -10
- package/dist/public/views/profile/inbox-tab/helpers.js +12 -0
- package/dist/public/views/profile/inbox-tab/panels.js +34 -4
- package/dist/public/views/profile/inbox-tab/use-thread-ux.js +104 -0
- package/dist/public/views/profile/inbox-tab.js +94 -47
- package/dist/public/views/profile/knowledge-tab.helpers.js +20 -0
- package/dist/public/views/profile/knowledge-tab.js +31 -28
- package/dist/public/views/profile/landing-page.cards.js +59 -46
- package/dist/public/views/profile/landing-page.js +6 -5
- package/dist/public/views/profile/landing-page.modals.js +5 -2
- package/dist/public/views/profile/libraries-tab.js +196 -0
- package/dist/public/views/profile/living-tab.js +11 -0
- package/dist/public/views/profile/memory-tab.js +45 -4
- package/dist/public/views/profile/node-stats-tab.js +29 -24
- package/dist/public/views/profile/notebook-card.js +1 -1
- package/dist/public/views/profile/notebook-tab.js +20 -1
- package/dist/public/views/profile/offers-tab.js +2 -1
- package/dist/public/views/profile/openrouter-settings.js +613 -0
- package/dist/public/views/profile/organisms/invite-panel.js +254 -0
- package/dist/public/views/profile/organisms/members.js +110 -177
- package/dist/public/views/profile/organisms/participants-panel.js +6 -2
- package/dist/public/views/profile/organisms/skills-panel.js +2 -1
- package/dist/public/views/profile/organisms/workspace/generator.js +1 -1
- package/dist/public/views/profile/organisms-tab.js +24 -16
- package/dist/public/views/profile/packages-tab.js +28 -38
- package/dist/public/views/profile/scheduler-calendar.js +72 -4
- package/dist/public/views/profile/scheduler-tab.js +16 -5
- package/dist/public/views/profile/security-tab.js +44 -44
- package/dist/public/views/profile/skills-tab.js +3 -2
- package/dist/public/views/profile/wallet-tab.js +34 -7
- package/dist/public/views/profile/work-tab.js +10 -1
- package/dist/public/views/profile/workflows-tab.js +3 -2
- package/dist/public/views/profile.js +38 -44
- package/dist/public/views/public-knowledge-viewer.js +6 -7
- package/dist/public/views/start-flows.js +16 -0
- package/dist/scripts/aeb-ledger.d.ts +2 -0
- package/dist/scripts/aeb-ledger.d.ts.map +1 -0
- package/dist/scripts/aeb-ledger.js +28 -0
- package/dist/scripts/aeb-ledger.js.map +1 -0
- package/dist/scripts/aeb-prove.d.ts +2 -0
- package/dist/scripts/aeb-prove.d.ts.map +1 -0
- package/dist/scripts/aeb-prove.js +124 -0
- package/dist/scripts/aeb-prove.js.map +1 -0
- package/dist/scripts/archive-stale-versions.js +1 -59
- package/dist/scripts/archive-stale-versions.js.map +1 -1
- package/dist/scripts/audit-mcp-tools.d.ts +1 -0
- package/dist/scripts/audit-mcp-tools.d.ts.map +1 -1
- package/dist/scripts/audit-mcp-tools.js +25 -0
- package/dist/scripts/audit-mcp-tools.js.map +1 -1
- package/dist/scripts/consent-audit-prune.js +5 -58
- package/dist/scripts/consent-audit-prune.js.map +1 -1
- package/dist/scripts/db-reset.d.ts +3 -3
- package/dist/scripts/db-reset.js +21 -62
- package/dist/scripts/db-reset.js.map +1 -1
- package/dist/scripts/kill-port.js +25 -5
- package/dist/scripts/kill-port.js.map +1 -1
- package/dist/scripts/kill-test-servers.d.ts +3 -0
- package/dist/scripts/kill-test-servers.d.ts.map +1 -0
- package/dist/scripts/kill-test-servers.js +84 -0
- package/dist/scripts/kill-test-servers.js.map +1 -0
- package/dist/scripts/migrate-to-postgres-kysely.d.ts +2 -0
- package/dist/scripts/migrate-to-postgres-kysely.d.ts.map +1 -0
- package/dist/scripts/migrate-to-postgres-kysely.js +194 -0
- package/dist/scripts/migrate-to-postgres-kysely.js.map +1 -0
- package/dist/scripts/reassign-apps.js +1 -1
- package/dist/scripts/telemetry-prune.d.ts +2 -1
- package/dist/scripts/telemetry-prune.d.ts.map +1 -1
- package/dist/scripts/telemetry-prune.js +7 -58
- package/dist/scripts/telemetry-prune.js.map +1 -1
- package/dist/src/auth/middleware.d.ts +9 -0
- package/dist/src/auth/middleware.d.ts.map +1 -1
- package/dist/src/auth/middleware.js +31 -0
- package/dist/src/auth/middleware.js.map +1 -1
- package/dist/src/cli/config-import.js +2 -2
- package/dist/src/cli/config-import.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-management.d.ts +2 -0
- package/dist/src/cli/connect/mcp/tools/agent-management.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-management.js +8 -0
- package/dist/src/cli/connect/mcp/tools/agent-management.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/appdev.d.ts +17 -0
- package/dist/src/cli/connect/mcp/tools/appdev.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/appdev.js +123 -0
- package/dist/src/cli/connect/mcp/tools/appdev.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/apps.d.ts +3 -1
- package/dist/src/cli/connect/mcp/tools/apps.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/apps.js +49 -1
- package/dist/src/cli/connect/mcp/tools/apps.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/commerce.d.ts +16 -0
- package/dist/src/cli/connect/mcp/tools/commerce.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/commerce.js +102 -0
- package/dist/src/cli/connect/mcp/tools/commerce.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/contacts.d.ts +13 -0
- package/dist/src/cli/connect/mcp/tools/contacts.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/contacts.js +35 -0
- package/dist/src/cli/connect/mcp/tools/contacts.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/dm-messages.d.ts +3 -0
- package/dist/src/cli/connect/mcp/tools/dm-messages.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/dm-messages.js +24 -0
- package/dist/src/cli/connect/mcp/tools/dm-messages.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/feedback.d.ts +14 -0
- package/dist/src/cli/connect/mcp/tools/feedback.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/feedback.js +29 -0
- package/dist/src/cli/connect/mcp/tools/feedback.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/index.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/index.js +10 -0
- package/dist/src/cli/connect/mcp/tools/index.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/onboarding.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/onboarding.js +4 -1
- package/dist/src/cli/connect/mcp/tools/onboarding.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/operator.d.ts +18 -0
- package/dist/src/cli/connect/mcp/tools/operator.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/operator.js +65 -0
- package/dist/src/cli/connect/mcp/tools/operator.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/organisms.d.ts +2 -0
- package/dist/src/cli/connect/mcp/tools/organisms.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/organisms.js +101 -2
- package/dist/src/cli/connect/mcp/tools/organisms.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/workflows.d.ts +1 -0
- package/dist/src/cli/connect/mcp/tools/workflows.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/workflows.js +13 -0
- package/dist/src/cli/connect/mcp/tools/workflows.js.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-agent.d.ts +6 -0
- package/dist/src/cli/connect/tool-call-defs-agent.d.ts.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-agent.js +126 -0
- package/dist/src/cli/connect/tool-call-defs-agent.js.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-apps.d.ts +4 -0
- package/dist/src/cli/connect/tool-call-defs-apps.d.ts.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-apps.js +379 -1
- package/dist/src/cli/connect/tool-call-defs-apps.js.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-organism.d.ts.map +1 -1
- package/dist/src/cli/connect/tool-call-defs-organism.js +46 -1
- package/dist/src/cli/connect/tool-call-defs-organism.js.map +1 -1
- package/dist/src/cli/init-wizard/generate.js +2 -2
- package/dist/src/cli/init-wizard/generate.js.map +1 -1
- package/dist/src/cli/init-wizard/helpers.d.ts +1 -1
- package/dist/src/cli/init-wizard/helpers.d.ts.map +1 -1
- package/dist/src/cli/init-wizard/helpers.js +2 -5
- package/dist/src/cli/init-wizard/helpers.js.map +1 -1
- package/dist/src/cli/init-wizard/presets.d.ts.map +1 -1
- package/dist/src/cli/init-wizard/presets.js +0 -1
- package/dist/src/cli/init-wizard/presets.js.map +1 -1
- package/dist/src/cli/init-wizard/steps-core.d.ts.map +1 -1
- package/dist/src/cli/init-wizard/steps-core.js +7 -11
- package/dist/src/cli/init-wizard/steps-core.js.map +1 -1
- package/dist/src/commerce/sellable-resolvers.d.ts +11 -1
- package/dist/src/commerce/sellable-resolvers.d.ts.map +1 -1
- package/dist/src/commerce/sellable-resolvers.js +55 -0
- package/dist/src/commerce/sellable-resolvers.js.map +1 -1
- package/dist/src/commerce/test-money-handler.d.ts +5 -0
- package/dist/src/commerce/test-money-handler.d.ts.map +1 -0
- package/dist/src/commerce/test-money-handler.js +27 -0
- package/dist/src/commerce/test-money-handler.js.map +1 -0
- package/dist/src/commerce/x402-facilitator.d.ts +113 -0
- package/dist/src/commerce/x402-facilitator.d.ts.map +1 -0
- package/dist/src/commerce/x402-facilitator.js +143 -0
- package/dist/src/commerce/x402-facilitator.js.map +1 -0
- package/dist/src/commerce/x402-handler.d.ts +35 -0
- package/dist/src/commerce/x402-handler.d.ts.map +1 -0
- package/dist/src/commerce/x402-handler.js +54 -0
- package/dist/src/commerce/x402-handler.js.map +1 -0
- package/dist/src/commerce/x402.d.ts +32 -8
- package/dist/src/commerce/x402.d.ts.map +1 -1
- package/dist/src/commerce/x402.js +41 -9
- package/dist/src/commerce/x402.js.map +1 -1
- package/dist/src/config-types.d.ts +21 -2
- package/dist/src/config-types.d.ts.map +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +27 -5
- package/dist/src/config.js.map +1 -1
- package/dist/src/data/app-templates/components.d.ts +13 -1
- package/dist/src/data/app-templates/components.d.ts.map +1 -1
- package/dist/src/data/app-templates/components.js +149 -1
- package/dist/src/data/app-templates/components.js.map +1 -1
- package/dist/src/data/app-templates.d.ts +13 -0
- package/dist/src/data/app-templates.d.ts.map +1 -1
- package/dist/src/data/app-templates.js +39 -1
- package/dist/src/data/app-templates.js.map +1 -1
- package/dist/src/data/appdev-pitfalls.d.ts +56 -0
- package/dist/src/data/appdev-pitfalls.d.ts.map +1 -0
- package/dist/src/data/appdev-pitfalls.js +342 -0
- package/dist/src/data/appdev-pitfalls.js.map +1 -0
- package/dist/src/data/builtin-skills.d.ts +6 -0
- package/dist/src/data/builtin-skills.d.ts.map +1 -1
- package/dist/src/data/builtin-skills.js +151 -0
- package/dist/src/data/builtin-skills.js.map +1 -1
- package/dist/src/data/library-packs/cortex.d.ts +18 -0
- package/dist/src/data/library-packs/cortex.d.ts.map +1 -0
- package/dist/src/data/library-packs/cortex.js +339 -0
- package/dist/src/data/library-packs/cortex.js.map +1 -0
- package/dist/src/data/library-packs/sdk.d.ts +16 -0
- package/dist/src/data/library-packs/sdk.d.ts.map +1 -0
- package/dist/src/data/library-packs/sdk.js +439 -0
- package/dist/src/data/library-packs/sdk.js.map +1 -0
- package/dist/src/data/library-packs/vendored.d.ts +21 -0
- package/dist/src/data/library-packs/vendored.d.ts.map +1 -0
- package/dist/src/data/library-packs/vendored.js +381 -0
- package/dist/src/data/library-packs/vendored.js.map +1 -0
- package/dist/src/data/library-packs.d.ts +151 -0
- package/dist/src/data/library-packs.d.ts.map +1 -0
- package/dist/src/data/library-packs.js +169 -0
- package/dist/src/data/library-packs.js.map +1 -0
- package/dist/src/generated/api-types.d.ts +25542 -14448
- package/dist/src/generated/api-types.d.ts.map +1 -1
- package/dist/src/index-help.d.ts +1 -1
- package/dist/src/index-help.d.ts.map +1 -1
- package/dist/src/index-help.js +3 -3
- package/dist/src/mcp/agent-onboarding.d.ts.map +1 -1
- package/dist/src/mcp/agent-onboarding.js +8 -2
- package/dist/src/mcp/agent-onboarding.js.map +1 -1
- package/dist/src/mcp/annotations.d.ts +1 -0
- package/dist/src/mcp/annotations.d.ts.map +1 -1
- package/dist/src/mcp/annotations.js +24 -0
- package/dist/src/mcp/annotations.js.map +1 -1
- package/dist/src/mcp/app-template-proposals.d.ts +17 -0
- package/dist/src/mcp/app-template-proposals.d.ts.map +1 -0
- package/dist/src/mcp/app-template-proposals.js +94 -0
- package/dist/src/mcp/app-template-proposals.js.map +1 -0
- package/dist/src/mcp/appdev-pitfalls.d.ts +22 -0
- package/dist/src/mcp/appdev-pitfalls.d.ts.map +1 -0
- package/dist/src/mcp/appdev-pitfalls.js +208 -0
- package/dist/src/mcp/appdev-pitfalls.js.map +1 -0
- package/dist/src/mcp/appdev-proofs.d.ts +21 -0
- package/dist/src/mcp/appdev-proofs.d.ts.map +1 -0
- package/dist/src/mcp/appdev-proofs.js +103 -0
- package/dist/src/mcp/appdev-proofs.js.map +1 -0
- package/dist/src/mcp/appdev-research.d.ts +17 -0
- package/dist/src/mcp/appdev-research.d.ts.map +1 -0
- package/dist/src/mcp/appdev-research.js +27 -0
- package/dist/src/mcp/appdev-research.js.map +1 -0
- package/dist/src/mcp/apps.d.ts +6 -0
- package/dist/src/mcp/apps.d.ts.map +1 -1
- package/dist/src/mcp/apps.js +60 -5
- package/dist/src/mcp/apps.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/agent-messaging.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions/agent-messaging.js +38 -0
- package/dist/src/mcp/catalog/definitions/agent-messaging.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/capabilities-groups-skills.d.ts +2 -0
- package/dist/src/mcp/catalog/definitions/capabilities-groups-skills.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions/capabilities-groups-skills.js +139 -5
- package/dist/src/mcp/catalog/definitions/capabilities-groups-skills.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js +41 -3
- package/dist/src/mcp/catalog/definitions/organisms-workspaces-apps.js.map +1 -1
- package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js +20 -0
- package/dist/src/mcp/catalog/definitions/schedules-tasks-memory.js.map +1 -1
- package/dist/src/mcp/catalog/scopes.d.ts +1 -0
- package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
- package/dist/src/mcp/catalog/scopes.js +18 -0
- package/dist/src/mcp/catalog/scopes.js.map +1 -1
- package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
- package/dist/src/mcp/catalog/surfaces.js +17 -4
- package/dist/src/mcp/catalog/surfaces.js.map +1 -1
- package/dist/src/mcp/catalogue.d.ts +1 -0
- package/dist/src/mcp/catalogue.d.ts.map +1 -1
- package/dist/src/mcp/catalogue.js +10 -2
- package/dist/src/mcp/catalogue.js.map +1 -1
- package/dist/src/mcp/commerce.js +1 -1
- package/dist/src/mcp/commerce.js.map +1 -1
- package/dist/src/mcp/contacts.d.ts +19 -0
- package/dist/src/mcp/contacts.d.ts.map +1 -0
- package/dist/src/mcp/contacts.js +58 -0
- package/dist/src/mcp/contacts.js.map +1 -0
- package/dist/src/mcp/core-admin.js +1 -1
- package/dist/src/mcp/core-admin.js.map +1 -1
- package/dist/src/mcp/extensions.d.ts +4 -0
- package/dist/src/mcp/extensions.d.ts.map +1 -1
- package/dist/src/mcp/extensions.js +74 -12
- package/dist/src/mcp/extensions.js.map +1 -1
- package/dist/src/mcp/feedback.d.ts +20 -0
- package/dist/src/mcp/feedback.d.ts.map +1 -0
- package/dist/src/mcp/feedback.js +61 -0
- package/dist/src/mcp/feedback.js.map +1 -0
- package/dist/src/mcp/index.d.ts +1 -0
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +13 -0
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/knowledge.d.ts +4 -0
- package/dist/src/mcp/knowledge.d.ts.map +1 -1
- package/dist/src/mcp/knowledge.js +39 -22
- package/dist/src/mcp/knowledge.js.map +1 -1
- package/dist/src/mcp/organisms-name-invites.d.ts +18 -0
- package/dist/src/mcp/organisms-name-invites.d.ts.map +1 -0
- package/dist/src/mcp/organisms-name-invites.js +143 -0
- package/dist/src/mcp/organisms-name-invites.js.map +1 -0
- package/dist/src/mcp/organisms.d.ts +3 -0
- package/dist/src/mcp/organisms.d.ts.map +1 -1
- package/dist/src/mcp/organisms.js +12 -86
- package/dist/src/mcp/organisms.js.map +1 -1
- package/dist/src/mcp/workflows.d.ts +2 -0
- package/dist/src/mcp/workflows.d.ts.map +1 -1
- package/dist/src/mcp/workflows.js +43 -3
- package/dist/src/mcp/workflows.js.map +1 -1
- package/dist/src/mcp/workspaces.d.ts +4 -0
- package/dist/src/mcp/workspaces.d.ts.map +1 -1
- package/dist/src/mcp/workspaces.js +15 -12
- package/dist/src/mcp/workspaces.js.map +1 -1
- package/dist/src/middleware/workspace-access.d.ts +3 -0
- package/dist/src/middleware/workspace-access.d.ts.map +1 -1
- package/dist/src/middleware/workspace-access.js +7 -3
- package/dist/src/middleware/workspace-access.js.map +1 -1
- package/dist/src/models/agent-onboarding-schemas.d.ts +2 -0
- package/dist/src/models/agent-onboarding-schemas.d.ts.map +1 -1
- package/dist/src/models/agent-onboarding-schemas.js +5 -0
- package/dist/src/models/agent-onboarding-schemas.js.map +1 -1
- package/dist/src/models/contribution-proof.d.ts +29 -0
- package/dist/src/models/contribution-proof.d.ts.map +1 -0
- package/dist/src/models/contribution-proof.js +23 -0
- package/dist/src/models/contribution-proof.js.map +1 -0
- package/dist/src/models/crew-def-schemas.d.ts +114 -0
- package/dist/src/models/crew-def-schemas.d.ts.map +1 -0
- package/dist/src/models/crew-def-schemas.js +140 -0
- package/dist/src/models/crew-def-schemas.js.map +1 -0
- package/dist/src/models/workflow-schemas.d.ts +69 -1
- package/dist/src/models/workflow-schemas.d.ts.map +1 -1
- package/dist/src/models/workflow-schemas.js +26 -0
- package/dist/src/models/workflow-schemas.js.map +1 -1
- package/dist/src/routes/access-tokens.d.ts +2 -0
- package/dist/src/routes/access-tokens.d.ts.map +1 -1
- package/dist/src/routes/access-tokens.js +15 -0
- package/dist/src/routes/access-tokens.js.map +1 -1
- package/dist/src/routes/admin-config.js +1 -1
- package/dist/src/routes/admin-config.js.map +1 -1
- package/dist/src/routes/admin-maintenance.d.ts +3 -0
- package/dist/src/routes/admin-maintenance.d.ts.map +1 -1
- package/dist/src/routes/admin-maintenance.js +20 -0
- package/dist/src/routes/admin-maintenance.js.map +1 -1
- package/dist/src/routes/admin-storage-stats.d.ts +17 -0
- package/dist/src/routes/admin-storage-stats.d.ts.map +1 -0
- package/dist/src/routes/admin-storage-stats.js +56 -0
- package/dist/src/routes/admin-storage-stats.js.map +1 -0
- package/dist/src/routes/admin.d.ts +1 -0
- package/dist/src/routes/admin.d.ts.map +1 -1
- package/dist/src/routes/admin.js +10 -12
- package/dist/src/routes/admin.js.map +1 -1
- package/dist/src/routes/agent-activity.d.ts +6 -0
- package/dist/src/routes/agent-activity.d.ts.map +1 -1
- package/dist/src/routes/agent-activity.js +57 -0
- package/dist/src/routes/agent-activity.js.map +1 -1
- package/dist/src/routes/agent-directives.d.ts.map +1 -1
- package/dist/src/routes/agent-directives.js +30 -0
- package/dist/src/routes/agent-directives.js.map +1 -1
- package/dist/src/routes/agent-messages.d.ts +2 -0
- package/dist/src/routes/agent-messages.d.ts.map +1 -1
- package/dist/src/routes/agent-messages.js +18 -0
- package/dist/src/routes/agent-messages.js.map +1 -1
- package/dist/src/routes/agent-onboarding.d.ts +16 -0
- package/dist/src/routes/agent-onboarding.d.ts.map +1 -1
- package/dist/src/routes/agent-onboarding.js +6 -1
- package/dist/src/routes/agent-onboarding.js.map +1 -1
- package/dist/src/routes/agent-webhook.d.ts +3 -0
- package/dist/src/routes/agent-webhook.d.ts.map +1 -1
- package/dist/src/routes/agent-webhook.js +28 -0
- package/dist/src/routes/agent-webhook.js.map +1 -1
- package/dist/src/routes/agents/device-auth.d.ts +6 -0
- package/dist/src/routes/agents/device-auth.d.ts.map +1 -1
- package/dist/src/routes/agents/device-auth.js +224 -137
- package/dist/src/routes/agents/device-auth.js.map +1 -1
- package/dist/src/routes/agents/offers.d.ts +4 -0
- package/dist/src/routes/agents/offers.d.ts.map +1 -1
- package/dist/src/routes/agents/offers.js +0 -0
- package/dist/src/routes/agents/offers.js.map +1 -1
- package/dist/src/routes/agents/profile-metadata.d.ts +3 -0
- package/dist/src/routes/agents/profile-metadata.d.ts.map +1 -1
- package/dist/src/routes/agents/profile-metadata.js +23 -10
- package/dist/src/routes/agents/profile-metadata.js.map +1 -1
- package/dist/src/routes/app-grants.d.ts.map +1 -1
- package/dist/src/routes/app-grants.js +2 -0
- package/dist/src/routes/app-grants.js.map +1 -1
- package/dist/src/routes/appdev-overview.d.ts +17 -0
- package/dist/src/routes/appdev-overview.d.ts.map +1 -0
- package/dist/src/routes/appdev-overview.js +75 -0
- package/dist/src/routes/appdev-overview.js.map +1 -0
- package/dist/src/routes/appdev-pitfalls.d.ts +20 -0
- package/dist/src/routes/appdev-pitfalls.d.ts.map +1 -0
- package/dist/src/routes/appdev-pitfalls.js +103 -0
- package/dist/src/routes/appdev-pitfalls.js.map +1 -0
- package/dist/src/routes/appeals.d.ts +1 -0
- package/dist/src/routes/appeals.d.ts.map +1 -1
- package/dist/src/routes/appeals.js +3 -1
- package/dist/src/routes/appeals.js.map +1 -1
- package/dist/src/routes/apps/agents-deploy.d.ts +24 -0
- package/dist/src/routes/apps/agents-deploy.d.ts.map +1 -0
- package/dist/src/routes/apps/agents-deploy.js +214 -0
- package/dist/src/routes/apps/agents-deploy.js.map +1 -0
- package/dist/src/routes/apps/catalogue-admin.d.ts +5 -0
- package/dist/src/routes/apps/catalogue-admin.d.ts.map +1 -1
- package/dist/src/routes/apps/catalogue-admin.js +34 -10
- package/dist/src/routes/apps/catalogue-admin.js.map +1 -1
- package/dist/src/routes/apps/drafts.d.ts +2 -0
- package/dist/src/routes/apps/drafts.d.ts.map +1 -1
- package/dist/src/routes/apps/drafts.js +4 -0
- package/dist/src/routes/apps/drafts.js.map +1 -1
- package/dist/src/routes/apps/fork-manage.d.ts +3 -1
- package/dist/src/routes/apps/fork-manage.d.ts.map +1 -1
- package/dist/src/routes/apps/fork-manage.js +26 -0
- package/dist/src/routes/apps/fork-manage.js.map +1 -1
- package/dist/src/routes/apps/publish.d.ts +5 -0
- package/dist/src/routes/apps/publish.d.ts.map +1 -1
- package/dist/src/routes/apps/publish.js +43 -1
- package/dist/src/routes/apps/publish.js.map +1 -1
- package/dist/src/routes/apps.d.ts +2 -0
- package/dist/src/routes/apps.d.ts.map +1 -1
- package/dist/src/routes/apps.js +4 -0
- package/dist/src/routes/apps.js.map +1 -1
- package/dist/src/routes/auth.d.ts +2 -0
- package/dist/src/routes/auth.d.ts.map +1 -1
- package/dist/src/routes/auth.js +11 -0
- package/dist/src/routes/auth.js.map +1 -1
- package/dist/src/routes/bootstrap.d.ts +5 -0
- package/dist/src/routes/bootstrap.d.ts.map +1 -1
- package/dist/src/routes/bootstrap.js +21 -14
- package/dist/src/routes/bootstrap.js.map +1 -1
- package/dist/src/routes/calibrator.d.ts +2 -0
- package/dist/src/routes/calibrator.d.ts.map +1 -1
- package/dist/src/routes/calibrator.js +43 -0
- package/dist/src/routes/calibrator.js.map +1 -1
- package/dist/src/routes/catalogue.d.ts +2 -0
- package/dist/src/routes/catalogue.d.ts.map +1 -1
- package/dist/src/routes/catalogue.js +20 -30
- package/dist/src/routes/catalogue.js.map +1 -1
- package/dist/src/routes/commerce.d.ts.map +1 -1
- package/dist/src/routes/commerce.js +18 -8
- package/dist/src/routes/commerce.js.map +1 -1
- package/dist/src/routes/consent.d.ts.map +1 -1
- package/dist/src/routes/consent.js +10 -0
- package/dist/src/routes/consent.js.map +1 -1
- package/dist/src/routes/contacts.d.ts +20 -0
- package/dist/src/routes/contacts.d.ts.map +1 -0
- package/dist/src/routes/contacts.js +86 -0
- package/dist/src/routes/contacts.js.map +1 -0
- package/dist/src/routes/ecosystem-apps.d.ts +2 -0
- package/dist/src/routes/ecosystem-apps.d.ts.map +1 -1
- package/dist/src/routes/ecosystem-apps.js +34 -0
- package/dist/src/routes/ecosystem-apps.js.map +1 -1
- package/dist/src/routes/extensions/actions.d.ts +3 -0
- package/dist/src/routes/extensions/actions.d.ts.map +1 -1
- package/dist/src/routes/extensions/actions.js +43 -6
- package/dist/src/routes/extensions/actions.js.map +1 -1
- package/dist/src/routes/extensions/manifest.d.ts +2 -0
- package/dist/src/routes/extensions/manifest.d.ts.map +1 -1
- package/dist/src/routes/extensions/manifest.js +68 -8
- package/dist/src/routes/extensions/manifest.js.map +1 -1
- package/dist/src/routes/extensions/paywall.d.ts +30 -0
- package/dist/src/routes/extensions/paywall.d.ts.map +1 -0
- package/dist/src/routes/extensions/paywall.js +107 -0
- package/dist/src/routes/extensions/paywall.js.map +1 -0
- package/dist/src/routes/federation-sync/messaging.d.ts.map +1 -1
- package/dist/src/routes/federation-sync/messaging.js +4 -0
- package/dist/src/routes/federation-sync/messaging.js.map +1 -1
- package/dist/src/routes/feedback.d.ts +23 -0
- package/dist/src/routes/feedback.d.ts.map +1 -0
- package/dist/src/routes/feedback.js +111 -0
- package/dist/src/routes/feedback.js.map +1 -0
- package/dist/src/routes/generator/projects.d.ts.map +1 -1
- package/dist/src/routes/generator/projects.js +18 -0
- package/dist/src/routes/generator/projects.js.map +1 -1
- package/dist/src/routes/generator/prompts.d.ts +14 -3
- package/dist/src/routes/generator/prompts.d.ts.map +1 -1
- package/dist/src/routes/generator/prompts.js +165 -90
- package/dist/src/routes/generator/prompts.js.map +1 -1
- package/dist/src/routes/generator.d.ts +2 -0
- package/dist/src/routes/generator.d.ts.map +1 -1
- package/dist/src/routes/generator.js +2 -0
- package/dist/src/routes/generator.js.map +1 -1
- package/dist/src/routes/ghii/profile.d.ts +2 -0
- package/dist/src/routes/ghii/profile.d.ts.map +1 -1
- package/dist/src/routes/ghii/profile.js +16 -11
- package/dist/src/routes/ghii/profile.js.map +1 -1
- package/dist/src/routes/knowledge/admin.d.ts +1 -0
- package/dist/src/routes/knowledge/admin.d.ts.map +1 -1
- package/dist/src/routes/knowledge/admin.js +30 -40
- package/dist/src/routes/knowledge/admin.js.map +1 -1
- package/dist/src/routes/knowledge/helpers.d.ts +1 -0
- package/dist/src/routes/knowledge/helpers.d.ts.map +1 -1
- package/dist/src/routes/knowledge/helpers.js +5 -1
- package/dist/src/routes/knowledge/helpers.js.map +1 -1
- package/dist/src/routes/knowledge/organism.d.ts +1 -0
- package/dist/src/routes/knowledge/organism.d.ts.map +1 -1
- package/dist/src/routes/knowledge/organism.js +7 -11
- package/dist/src/routes/knowledge/organism.js.map +1 -1
- package/dist/src/routes/knowledge/packages-core.d.ts +1 -0
- package/dist/src/routes/knowledge/packages-core.d.ts.map +1 -1
- package/dist/src/routes/knowledge/packages-core.js +6 -16
- package/dist/src/routes/knowledge/packages-core.js.map +1 -1
- package/dist/src/routes/knowledge/sharing.d.ts +1 -0
- package/dist/src/routes/knowledge/sharing.d.ts.map +1 -1
- package/dist/src/routes/knowledge/sharing.js +11 -31
- package/dist/src/routes/knowledge/sharing.js.map +1 -1
- package/dist/src/routes/knowledge.d.ts +2 -0
- package/dist/src/routes/knowledge.d.ts.map +1 -1
- package/dist/src/routes/knowledge.js +15 -0
- package/dist/src/routes/knowledge.js.map +1 -1
- package/dist/src/routes/ledger.d.ts +4 -0
- package/dist/src/routes/ledger.d.ts.map +1 -1
- package/dist/src/routes/ledger.js +93 -53
- package/dist/src/routes/ledger.js.map +1 -1
- package/dist/src/routes/lib-data.d.ts +2 -0
- package/dist/src/routes/lib-data.d.ts.map +1 -1
- package/dist/src/routes/lib-data.js +7 -4
- package/dist/src/routes/lib-data.js.map +1 -1
- package/dist/src/routes/lib-intake.d.ts +21 -0
- package/dist/src/routes/lib-intake.d.ts.map +1 -0
- package/dist/src/routes/lib-intake.js +63 -0
- package/dist/src/routes/lib-intake.js.map +1 -0
- package/dist/src/routes/lib-organism.d.ts +13 -0
- package/dist/src/routes/lib-organism.d.ts.map +1 -1
- package/dist/src/routes/lib-organism.js +80 -0
- package/dist/src/routes/lib-organism.js.map +1 -1
- package/dist/src/routes/lib-workflows.d.ts +24 -0
- package/dist/src/routes/lib-workflows.d.ts.map +1 -0
- package/dist/src/routes/lib-workflows.js +125 -0
- package/dist/src/routes/lib-workflows.js.map +1 -0
- package/dist/src/routes/library-packs.d.ts +31 -0
- package/dist/src/routes/library-packs.d.ts.map +1 -0
- package/dist/src/routes/library-packs.js +187 -0
- package/dist/src/routes/library-packs.js.map +1 -0
- package/dist/src/routes/libs/audio-lib-part2.d.ts +2 -0
- package/dist/src/routes/libs/audio-lib-part2.d.ts.map +1 -1
- package/dist/src/routes/libs/audio-lib-part2.js +4 -0
- package/dist/src/routes/libs/audio-lib-part2.js.map +1 -1
- package/dist/src/routes/libs/auth-lib-part2.d.ts +5 -0
- package/dist/src/routes/libs/auth-lib-part2.d.ts.map +1 -1
- package/dist/src/routes/libs/auth-lib-part2.js +118 -5
- package/dist/src/routes/libs/auth-lib-part2.js.map +1 -1
- package/dist/src/routes/libs.d.ts +10 -0
- package/dist/src/routes/libs.d.ts.map +1 -1
- package/dist/src/routes/libs.js +28 -149
- package/dist/src/routes/libs.js.map +1 -1
- package/dist/src/routes/living.d.ts +2 -0
- package/dist/src/routes/living.d.ts.map +1 -1
- package/dist/src/routes/living.js +12 -0
- package/dist/src/routes/living.js.map +1 -1
- package/dist/src/routes/matches.d.ts +3 -0
- package/dist/src/routes/matches.d.ts.map +1 -1
- package/dist/src/routes/matches.js +47 -51
- package/dist/src/routes/matches.js.map +1 -1
- package/dist/src/routes/memory/bulk.d.ts.map +1 -1
- package/dist/src/routes/memory/bulk.js +185 -70
- package/dist/src/routes/memory/bulk.js.map +1 -1
- package/dist/src/routes/memory/crud.d.ts +2 -0
- package/dist/src/routes/memory/crud.d.ts.map +1 -1
- package/dist/src/routes/memory/crud.js +70 -39
- package/dist/src/routes/memory/crud.js.map +1 -1
- package/dist/src/routes/memory/key.d.ts +2 -0
- package/dist/src/routes/memory/key.d.ts.map +1 -1
- package/dist/src/routes/memory/key.js +23 -4
- package/dist/src/routes/memory/key.js.map +1 -1
- package/dist/src/routes/memory/shared.d.ts +4 -0
- package/dist/src/routes/memory/shared.d.ts.map +1 -1
- package/dist/src/routes/memory/shared.js.map +1 -1
- package/dist/src/routes/memory.d.ts.map +1 -1
- package/dist/src/routes/memory.js +29 -1
- package/dist/src/routes/memory.js.map +1 -1
- package/dist/src/routes/messages.d.ts +6 -0
- package/dist/src/routes/messages.d.ts.map +1 -1
- package/dist/src/routes/messages.js +39 -26
- package/dist/src/routes/messages.js.map +1 -1
- package/dist/src/routes/notifications.d.ts +2 -0
- package/dist/src/routes/notifications.d.ts.map +1 -1
- package/dist/src/routes/notifications.js +21 -2
- package/dist/src/routes/notifications.js.map +1 -1
- package/dist/src/routes/organisms/crud.d.ts +6 -0
- package/dist/src/routes/organisms/crud.d.ts.map +1 -1
- package/dist/src/routes/organisms/crud.js +80 -62
- package/dist/src/routes/organisms/crud.js.map +1 -1
- package/dist/src/routes/organisms/gates.d.ts.map +1 -1
- package/dist/src/routes/organisms/gates.js +82 -1
- package/dist/src/routes/organisms/gates.js.map +1 -1
- package/dist/src/routes/organisms/intake.d.ts +29 -0
- package/dist/src/routes/organisms/intake.d.ts.map +1 -0
- package/dist/src/routes/organisms/intake.js +251 -0
- package/dist/src/routes/organisms/intake.js.map +1 -0
- package/dist/src/routes/organisms/membership.d.ts +4 -1
- package/dist/src/routes/organisms/membership.d.ts.map +1 -1
- package/dist/src/routes/organisms/membership.js +103 -60
- package/dist/src/routes/organisms/membership.js.map +1 -1
- package/dist/src/routes/organisms/shared.d.ts +28 -0
- package/dist/src/routes/organisms/shared.d.ts.map +1 -1
- package/dist/src/routes/organisms/shared.js +339 -26
- package/dist/src/routes/organisms/shared.js.map +1 -1
- package/dist/src/routes/organisms/workspace-access.d.ts +16 -0
- package/dist/src/routes/organisms/workspace-access.d.ts.map +1 -1
- package/dist/src/routes/organisms/workspace-access.js +136 -52
- package/dist/src/routes/organisms/workspace-access.js.map +1 -1
- package/dist/src/routes/organisms/workspace-ops.d.ts +6 -0
- package/dist/src/routes/organisms/workspace-ops.d.ts.map +1 -1
- package/dist/src/routes/organisms/workspace-ops.js +224 -11
- package/dist/src/routes/organisms/workspace-ops.js.map +1 -1
- package/dist/src/routes/organisms/workspace-read.d.ts +4 -0
- package/dist/src/routes/organisms/workspace-read.d.ts.map +1 -1
- package/dist/src/routes/organisms/workspace-read.js +14 -6
- package/dist/src/routes/organisms/workspace-read.js.map +1 -1
- package/dist/src/routes/organisms.d.ts.map +1 -1
- package/dist/src/routes/organisms.js +2 -0
- package/dist/src/routes/organisms.js.map +1 -1
- package/dist/src/routes/owners.d.ts +2 -0
- package/dist/src/routes/owners.d.ts.map +1 -1
- package/dist/src/routes/owners.js +17 -7
- package/dist/src/routes/owners.js.map +1 -1
- package/dist/src/routes/packages.d.ts.map +1 -1
- package/dist/src/routes/packages.js +10 -0
- package/dist/src/routes/packages.js.map +1 -1
- package/dist/src/routes/portal.d.ts +1 -1
- package/dist/src/routes/portal.d.ts.map +1 -1
- package/dist/src/routes/portal.js +3 -7
- package/dist/src/routes/portal.js.map +1 -1
- package/dist/src/routes/portfolio.d.ts +2 -0
- package/dist/src/routes/portfolio.d.ts.map +1 -1
- package/dist/src/routes/portfolio.js +41 -31
- package/dist/src/routes/portfolio.js.map +1 -1
- package/dist/src/routes/prompts.d.ts.map +1 -1
- package/dist/src/routes/prompts.js +23 -0
- package/dist/src/routes/prompts.js.map +1 -1
- package/dist/src/routes/schedules.d.ts +7 -0
- package/dist/src/routes/schedules.d.ts.map +1 -1
- package/dist/src/routes/schedules.js +102 -39
- package/dist/src/routes/schedules.js.map +1 -1
- package/dist/src/routes/upload.d.ts +4 -0
- package/dist/src/routes/upload.d.ts.map +1 -1
- package/dist/src/routes/upload.js +21 -1
- package/dist/src/routes/upload.js.map +1 -1
- package/dist/src/routes/usage.d.ts +9 -5
- package/dist/src/routes/usage.d.ts.map +1 -1
- package/dist/src/routes/usage.js +26 -5
- package/dist/src/routes/usage.js.map +1 -1
- package/dist/src/routes/wallet.d.ts +3 -0
- package/dist/src/routes/wallet.d.ts.map +1 -1
- package/dist/src/routes/wallet.js +17 -1
- package/dist/src/routes/wallet.js.map +1 -1
- package/dist/src/routes/work.d.ts.map +1 -1
- package/dist/src/routes/work.js +14 -9
- package/dist/src/routes/work.js.map +1 -1
- package/dist/src/routes/workflows.d.ts +4 -0
- package/dist/src/routes/workflows.d.ts.map +1 -1
- package/dist/src/routes/workflows.js +58 -1
- package/dist/src/routes/workflows.js.map +1 -1
- package/dist/src/server-bootstrap/config-init.d.ts.map +1 -1
- package/dist/src/server-bootstrap/config-init.js +7 -6
- package/dist/src/server-bootstrap/config-init.js.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.d.ts +1 -0
- package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.js +27 -7
- package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +4 -0
- package/dist/src/server.js.map +1 -1
- package/dist/src/services/app-agent-deploy.d.ts +26 -0
- package/dist/src/services/app-agent-deploy.d.ts.map +1 -0
- package/dist/src/services/app-agent-deploy.js +91 -0
- package/dist/src/services/app-agent-deploy.js.map +1 -0
- package/dist/src/services/app-template-proposals.d.ts +94 -0
- package/dist/src/services/app-template-proposals.d.ts.map +1 -0
- package/dist/src/services/app-template-proposals.js +114 -0
- package/dist/src/services/app-template-proposals.js.map +1 -0
- package/dist/src/services/appdev-flow-constants.d.ts +33 -0
- package/dist/src/services/appdev-flow-constants.d.ts.map +1 -0
- package/dist/src/services/appdev-flow-constants.js +43 -0
- package/dist/src/services/appdev-flow-constants.js.map +1 -0
- package/dist/src/services/appdev-flow-prompt.d.ts +15 -0
- package/dist/src/services/appdev-flow-prompt.d.ts.map +1 -0
- package/dist/src/services/appdev-flow-prompt.js +40 -0
- package/dist/src/services/appdev-flow-prompt.js.map +1 -0
- package/dist/src/services/appdev-kb.d.ts +71 -0
- package/dist/src/services/appdev-kb.d.ts.map +1 -0
- package/dist/src/services/appdev-kb.js +178 -0
- package/dist/src/services/appdev-kb.js.map +1 -0
- package/dist/src/services/appdev-overview.d.ts +28 -0
- package/dist/src/services/appdev-overview.d.ts.map +1 -0
- package/dist/src/services/appdev-overview.js +189 -0
- package/dist/src/services/appdev-overview.js.map +1 -0
- package/dist/src/services/build-app-prompt.d.ts +14 -0
- package/dist/src/services/build-app-prompt.d.ts.map +1 -1
- package/dist/src/services/build-app-prompt.js +62 -34
- package/dist/src/services/build-app-prompt.js.map +1 -1
- package/dist/src/services/config-schema.d.ts.map +1 -1
- package/dist/src/services/config-schema.js +1 -3
- package/dist/src/services/config-schema.js.map +1 -1
- package/dist/src/services/consent.d.ts.map +1 -1
- package/dist/src/services/consent.js +8 -3
- package/dist/src/services/consent.js.map +1 -1
- package/dist/src/services/contacts.d.ts +64 -0
- package/dist/src/services/contacts.d.ts.map +1 -0
- package/dist/src/services/contacts.js +133 -0
- package/dist/src/services/contacts.js.map +1 -0
- package/dist/src/services/core-jobs.d.ts +4 -0
- package/dist/src/services/core-jobs.d.ts.map +1 -1
- package/dist/src/services/core-jobs.js +23 -0
- package/dist/src/services/core-jobs.js.map +1 -1
- package/dist/src/services/dangling-refs.d.ts +2 -0
- package/dist/src/services/dangling-refs.d.ts.map +1 -1
- package/dist/src/services/dangling-refs.js +3 -2
- package/dist/src/services/dangling-refs.js.map +1 -1
- package/dist/src/services/db/access-tab-db-service.d.ts +49 -0
- package/dist/src/services/db/access-tab-db-service.d.ts.map +1 -0
- package/dist/src/services/db/access-tab-db-service.js +87 -0
- package/dist/src/services/db/access-tab-db-service.js.map +1 -0
- package/dist/src/services/db/agent-activity-overview-db-service.d.ts +62 -0
- package/dist/src/services/db/agent-activity-overview-db-service.d.ts.map +1 -0
- package/dist/src/services/db/agent-activity-overview-db-service.js +88 -0
- package/dist/src/services/db/agent-activity-overview-db-service.js.map +1 -0
- package/dist/src/services/db/agent-data-access-overview-db-service.d.ts +45 -0
- package/dist/src/services/db/agent-data-access-overview-db-service.d.ts.map +1 -0
- package/dist/src/services/db/agent-data-access-overview-db-service.js +42 -0
- package/dist/src/services/db/agent-data-access-overview-db-service.js.map +1 -0
- package/dist/src/services/db/agent-db-service.d.ts +58 -0
- package/dist/src/services/db/agent-db-service.d.ts.map +1 -0
- package/dist/src/services/db/agent-db-service.js +49 -0
- package/dist/src/services/db/agent-db-service.js.map +1 -0
- package/dist/src/services/db/agent-integration-overview-db-service.d.ts +44 -0
- package/dist/src/services/db/agent-integration-overview-db-service.d.ts.map +1 -0
- package/dist/src/services/db/agent-integration-overview-db-service.js +44 -0
- package/dist/src/services/db/agent-integration-overview-db-service.js.map +1 -0
- package/dist/src/services/db/agent-messages-overview-db-service.d.ts +40 -0
- package/dist/src/services/db/agent-messages-overview-db-service.d.ts.map +1 -0
- package/dist/src/services/db/agent-messages-overview-db-service.js +47 -0
- package/dist/src/services/db/agent-messages-overview-db-service.js.map +1 -0
- package/dist/src/services/db/agent-quality-overview-db-service.d.ts +43 -0
- package/dist/src/services/db/agent-quality-overview-db-service.d.ts.map +1 -0
- package/dist/src/services/db/agent-quality-overview-db-service.js +34 -0
- package/dist/src/services/db/agent-quality-overview-db-service.js.map +1 -0
- package/dist/src/services/db/calibrator-detail-db-service.d.ts +41 -0
- package/dist/src/services/db/calibrator-detail-db-service.d.ts.map +1 -0
- package/dist/src/services/db/calibrator-detail-db-service.js +61 -0
- package/dist/src/services/db/calibrator-detail-db-service.js.map +1 -0
- package/dist/src/services/db/data-wallet-db-service.d.ts +48 -0
- package/dist/src/services/db/data-wallet-db-service.d.ts.map +1 -0
- package/dist/src/services/db/data-wallet-db-service.js +74 -0
- package/dist/src/services/db/data-wallet-db-service.js.map +1 -0
- package/dist/src/services/db/generator-state-db-service.d.ts +48 -0
- package/dist/src/services/db/generator-state-db-service.d.ts.map +1 -0
- package/dist/src/services/db/generator-state-db-service.js +45 -0
- package/dist/src/services/db/generator-state-db-service.js.map +1 -0
- package/dist/src/services/db/home-dashboard-service.d.ts +65 -0
- package/dist/src/services/db/home-dashboard-service.d.ts.map +1 -0
- package/dist/src/services/db/home-dashboard-service.js +57 -0
- package/dist/src/services/db/home-dashboard-service.js.map +1 -0
- package/dist/src/services/db/index.d.ts +48 -0
- package/dist/src/services/db/index.d.ts.map +1 -0
- package/dist/src/services/db/index.js +40 -0
- package/dist/src/services/db/index.js.map +1 -0
- package/dist/src/services/db/knowledge-tab-db-service.d.ts +35 -0
- package/dist/src/services/db/knowledge-tab-db-service.d.ts.map +1 -0
- package/dist/src/services/db/knowledge-tab-db-service.js +37 -0
- package/dist/src/services/db/knowledge-tab-db-service.js.map +1 -0
- package/dist/src/services/db/living-docs-db-service.d.ts +43 -0
- package/dist/src/services/db/living-docs-db-service.d.ts.map +1 -0
- package/dist/src/services/db/living-docs-db-service.js +45 -0
- package/dist/src/services/db/living-docs-db-service.js.map +1 -0
- package/dist/src/services/db/memory-db-service.d.ts +122 -0
- package/dist/src/services/db/memory-db-service.d.ts.map +1 -0
- package/dist/src/services/db/memory-db-service.js +171 -0
- package/dist/src/services/db/memory-db-service.js.map +1 -0
- package/dist/src/services/db/memory-tab-db-service.d.ts +54 -0
- package/dist/src/services/db/memory-tab-db-service.d.ts.map +1 -0
- package/dist/src/services/db/memory-tab-db-service.js +94 -0
- package/dist/src/services/db/memory-tab-db-service.js.map +1 -0
- package/dist/src/services/db/messages-inbox-db-service.d.ts +47 -0
- package/dist/src/services/db/messages-inbox-db-service.d.ts.map +1 -0
- package/dist/src/services/db/messages-inbox-db-service.js +76 -0
- package/dist/src/services/db/messages-inbox-db-service.js.map +1 -0
- package/dist/src/services/db/messaging-db-service.d.ts +40 -0
- package/dist/src/services/db/messaging-db-service.d.ts.map +1 -0
- package/dist/src/services/db/messaging-db-service.js +55 -0
- package/dist/src/services/db/messaging-db-service.js.map +1 -0
- package/dist/src/services/db/notebook-db-service.d.ts +35 -0
- package/dist/src/services/db/notebook-db-service.d.ts.map +1 -0
- package/dist/src/services/db/notebook-db-service.js +44 -0
- package/dist/src/services/db/notebook-db-service.js.map +1 -0
- package/dist/src/services/db/owner-identity.d.ts +36 -0
- package/dist/src/services/db/owner-identity.d.ts.map +1 -0
- package/dist/src/services/db/owner-identity.js +27 -0
- package/dist/src/services/db/owner-identity.js.map +1 -0
- package/dist/src/services/db/packages-tab-db-service.d.ts +42 -0
- package/dist/src/services/db/packages-tab-db-service.d.ts.map +1 -0
- package/dist/src/services/db/packages-tab-db-service.js +33 -0
- package/dist/src/services/db/packages-tab-db-service.js.map +1 -0
- package/dist/src/services/db/security-tab-db-service.d.ts +47 -0
- package/dist/src/services/db/security-tab-db-service.d.ts.map +1 -0
- package/dist/src/services/db/security-tab-db-service.js +61 -0
- package/dist/src/services/db/security-tab-db-service.js.map +1 -0
- package/dist/src/services/db/wallet-tab-db-service.d.ts +47 -0
- package/dist/src/services/db/wallet-tab-db-service.d.ts.map +1 -0
- package/dist/src/services/db/wallet-tab-db-service.js +80 -0
- package/dist/src/services/db/wallet-tab-db-service.js.map +1 -0
- package/dist/src/services/db/work-tab-db-service.d.ts +32 -0
- package/dist/src/services/db/work-tab-db-service.d.ts.map +1 -0
- package/dist/src/services/db/work-tab-db-service.js +49 -0
- package/dist/src/services/db/work-tab-db-service.js.map +1 -0
- package/dist/src/services/directory.d.ts +1 -0
- package/dist/src/services/directory.d.ts.map +1 -1
- package/dist/src/services/directory.js +6 -2
- package/dist/src/services/directory.js.map +1 -1
- package/dist/src/services/discovery/setup.d.ts +3 -0
- package/dist/src/services/discovery/setup.d.ts.map +1 -1
- package/dist/src/services/discovery/setup.js +2 -0
- package/dist/src/services/discovery/setup.js.map +1 -1
- package/dist/src/services/discovery/sources/memory-source.d.ts +2 -0
- package/dist/src/services/discovery/sources/memory-source.d.ts.map +1 -1
- package/dist/src/services/discovery/sources/memory-source.js.map +1 -1
- package/dist/src/services/discovery/sources/templates-source.d.ts +20 -0
- package/dist/src/services/discovery/sources/templates-source.d.ts.map +1 -0
- package/dist/src/services/discovery/sources/templates-source.js +52 -0
- package/dist/src/services/discovery/sources/templates-source.js.map +1 -0
- package/dist/src/services/ext-pay-token.d.ts +29 -0
- package/dist/src/services/ext-pay-token.d.ts.map +1 -0
- package/dist/src/services/ext-pay-token.js +63 -0
- package/dist/src/services/ext-pay-token.js.map +1 -0
- package/dist/src/services/extension-runtime.d.ts.map +1 -1
- package/dist/src/services/extension-runtime.js +9 -2
- package/dist/src/services/extension-runtime.js.map +1 -1
- package/dist/src/services/feedback.d.ts +38 -0
- package/dist/src/services/feedback.d.ts.map +1 -0
- package/dist/src/services/feedback.js +118 -0
- package/dist/src/services/feedback.js.map +1 -0
- package/dist/src/services/generator-autopilot.d.ts.map +1 -1
- package/dist/src/services/generator-autopilot.js +12 -19
- package/dist/src/services/generator-autopilot.js.map +1 -1
- package/dist/src/services/generator-prompt-seeds/blueprint-prompts.d.ts.map +1 -1
- package/dist/src/services/generator-prompt-seeds/blueprint-prompts.js +28 -1
- package/dist/src/services/generator-prompt-seeds/blueprint-prompts.js.map +1 -1
- package/dist/src/services/generator-prompt-seeds/cortex-code.d.ts +5 -0
- package/dist/src/services/generator-prompt-seeds/cortex-code.d.ts.map +1 -1
- package/dist/src/services/generator-prompt-seeds/cortex-code.js +54 -3
- package/dist/src/services/generator-prompt-seeds/cortex-code.js.map +1 -1
- package/dist/src/services/generator-prompt-seeds/extension-prompts.d.ts.map +1 -1
- package/dist/src/services/generator-prompt-seeds/extension-prompts.js +106 -2
- package/dist/src/services/generator-prompt-seeds/extension-prompts.js.map +1 -1
- package/dist/src/services/generator-prompt-seeds/shared-fragments.js +1 -1
- package/dist/src/services/generator-prompts/resolvers-blueprint.d.ts.map +1 -1
- package/dist/src/services/generator-prompts/resolvers-blueprint.js +9 -0
- package/dist/src/services/generator-prompts/resolvers-blueprint.js.map +1 -1
- package/dist/src/services/generator-prompts/resolvers-cortex.d.ts.map +1 -1
- package/dist/src/services/generator-prompts/resolvers-cortex.js +4 -0
- package/dist/src/services/generator-prompts/resolvers-cortex.js.map +1 -1
- package/dist/src/services/generator-prompts/resolvers-fix.d.ts +4 -0
- package/dist/src/services/generator-prompts/resolvers-fix.d.ts.map +1 -1
- package/dist/src/services/generator-prompts/resolvers-fix.js +68 -0
- package/dist/src/services/generator-prompts/resolvers-fix.js.map +1 -1
- package/dist/src/services/generator-prompts/resolvers.d.ts.map +1 -1
- package/dist/src/services/generator-prompts/resolvers.js +5 -1
- package/dist/src/services/generator-prompts/resolvers.js.map +1 -1
- package/dist/src/services/generator-prompts/types.d.ts +9 -0
- package/dist/src/services/generator-prompts/types.d.ts.map +1 -1
- package/dist/src/services/handbooks/agent.d.ts +2 -1
- package/dist/src/services/handbooks/agent.d.ts.map +1 -1
- package/dist/src/services/handbooks/agent.js +8 -0
- package/dist/src/services/handbooks/agent.js.map +1 -1
- package/dist/src/services/handbooks/appdev.d.ts +2 -1
- package/dist/src/services/handbooks/appdev.d.ts.map +1 -1
- package/dist/src/services/handbooks/appdev.js +19 -0
- package/dist/src/services/handbooks/appdev.js.map +1 -1
- package/dist/src/services/invitations.d.ts +76 -1
- package/dist/src/services/invitations.d.ts.map +1 -1
- package/dist/src/services/invitations.js +295 -9
- package/dist/src/services/invitations.js.map +1 -1
- package/dist/src/services/job-seeding.d.ts.map +1 -1
- package/dist/src/services/job-seeding.js +2 -0
- package/dist/src/services/job-seeding.js.map +1 -1
- package/dist/src/services/living-author.js +1 -1
- package/dist/src/services/living-author.js.map +1 -1
- package/dist/src/services/llm-strip.d.ts +13 -0
- package/dist/src/services/llm-strip.d.ts.map +1 -0
- package/dist/src/services/llm-strip.js +60 -0
- package/dist/src/services/llm-strip.js.map +1 -0
- package/dist/src/services/manifest-schema.d.ts.map +1 -1
- package/dist/src/services/manifest-schema.js +1 -0
- package/dist/src/services/manifest-schema.js.map +1 -1
- package/dist/src/services/matching.d.ts +1 -0
- package/dist/src/services/matching.d.ts.map +1 -1
- package/dist/src/services/matching.js +28 -19
- package/dist/src/services/matching.js.map +1 -1
- package/dist/src/services/message-send.d.ts.map +1 -1
- package/dist/src/services/message-send.js +5 -0
- package/dist/src/services/message-send.js.map +1 -1
- package/dist/src/services/notebook-classify.js +1 -1
- package/dist/src/services/notebook-classify.js.map +1 -1
- package/dist/src/services/notebook-plan.js +1 -1
- package/dist/src/services/notebook-plan.js.map +1 -1
- package/dist/src/services/notify.d.ts +45 -0
- package/dist/src/services/notify.d.ts.map +1 -1
- package/dist/src/services/notify.js +21 -2
- package/dist/src/services/notify.js.map +1 -1
- package/dist/src/services/owner-memory.d.ts +9 -0
- package/dist/src/services/owner-memory.d.ts.map +1 -1
- package/dist/src/services/owner-memory.js +42 -18
- package/dist/src/services/owner-memory.js.map +1 -1
- package/dist/src/services/perf-trace.d.ts +43 -0
- package/dist/src/services/perf-trace.d.ts.map +1 -0
- package/dist/src/services/perf-trace.js +149 -0
- package/dist/src/services/perf-trace.js.map +1 -0
- package/dist/src/services/prompt-defaults.d.ts.map +1 -1
- package/dist/src/services/prompt-defaults.js +0 -5
- package/dist/src/services/prompt-defaults.js.map +1 -1
- package/dist/src/services/push.d.ts +5 -0
- package/dist/src/services/push.d.ts.map +1 -1
- package/dist/src/services/push.js.map +1 -1
- package/dist/src/services/quota.d.ts +3 -1
- package/dist/src/services/quota.d.ts.map +1 -1
- package/dist/src/services/quota.js +6 -9
- package/dist/src/services/quota.js.map +1 -1
- package/dist/src/services/structure-overview.d.ts +3 -0
- package/dist/src/services/structure-overview.d.ts.map +1 -1
- package/dist/src/services/structure-overview.js +3 -1
- package/dist/src/services/structure-overview.js.map +1 -1
- package/dist/src/services/structure-snapshot.d.ts.map +1 -1
- package/dist/src/services/structure-snapshot.js +24 -1
- package/dist/src/services/structure-snapshot.js.map +1 -1
- package/dist/src/services/tracked-classify.js +1 -1
- package/dist/src/services/tracked-classify.js.map +1 -1
- package/dist/src/services/usage-summary.d.ts +3 -0
- package/dist/src/services/usage-summary.d.ts.map +1 -1
- package/dist/src/services/usage-summary.js +31 -29
- package/dist/src/services/usage-summary.js.map +1 -1
- package/dist/src/services/workflow/engine-human.d.ts +33 -0
- package/dist/src/services/workflow/engine-human.d.ts.map +1 -0
- package/dist/src/services/workflow/engine-human.js +44 -0
- package/dist/src/services/workflow/engine-human.js.map +1 -0
- package/dist/src/services/workflow/engine-steps.d.ts +13 -0
- package/dist/src/services/workflow/engine-steps.d.ts.map +1 -1
- package/dist/src/services/workflow/engine-steps.js +33 -2
- package/dist/src/services/workflow/engine-steps.js.map +1 -1
- package/dist/src/services/workflow/engine.d.ts +20 -0
- package/dist/src/services/workflow/engine.d.ts.map +1 -1
- package/dist/src/services/workflow/engine.js +77 -3
- package/dist/src/services/workflow/engine.js.map +1 -1
- package/dist/src/services/workflow/store.d.ts +3 -0
- package/dist/src/services/workflow/store.d.ts.map +1 -1
- package/dist/src/services/workflow/store.js +29 -4
- package/dist/src/services/workflow/store.js.map +1 -1
- package/dist/src/services/workspace-access.d.ts +12 -0
- package/dist/src/services/workspace-access.d.ts.map +1 -1
- package/dist/src/services/workspace-access.js +24 -5
- package/dist/src/services/workspace-access.js.map +1 -1
- package/dist/src/services/workspace-provision.d.ts +51 -0
- package/dist/src/services/workspace-provision.d.ts.map +1 -0
- package/dist/src/services/workspace-provision.js +56 -0
- package/dist/src/services/workspace-provision.js.map +1 -0
- package/dist/src/services/workspace-versions.d.ts +110 -0
- package/dist/src/services/workspace-versions.d.ts.map +1 -0
- package/dist/src/services/workspace-versions.js +0 -0
- package/dist/src/services/workspace-versions.js.map +1 -0
- package/dist/src/storage/adapter/legacy-memory-adapter.d.ts +61 -0
- package/dist/src/storage/adapter/legacy-memory-adapter.d.ts.map +1 -0
- package/dist/src/storage/adapter/legacy-memory-adapter.js +135 -0
- package/dist/src/storage/adapter/legacy-memory-adapter.js.map +1 -0
- package/dist/src/storage/adapter/memory-adapter.d.ts +126 -0
- package/dist/src/storage/adapter/memory-adapter.d.ts.map +1 -0
- package/dist/src/storage/adapter/memory-adapter.js +2 -0
- package/dist/src/storage/adapter/memory-adapter.js.map +1 -0
- package/dist/src/storage/interface.d.ts +3 -1
- package/dist/src/storage/interface.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/index.d.ts +28 -0
- package/dist/src/storage/providers/mongodb/index.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/index.js +91 -1
- package/dist/src/storage/providers/mongodb/index.js.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/apps.d.ts +9 -0
- package/dist/src/storage/providers/mongodb/methods/apps.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/apps.js +38 -0
- package/dist/src/storage/providers/mongodb/methods/apps.js.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/governance.d.ts +5 -0
- package/dist/src/storage/providers/mongodb/methods/governance.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/governance.js +23 -2
- package/dist/src/storage/providers/mongodb/methods/governance.js.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/identity.d.ts +6 -0
- package/dist/src/storage/providers/mongodb/methods/identity.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/identity.js +51 -9
- package/dist/src/storage/providers/mongodb/methods/identity.js.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/owner-memory-scope.d.ts +34 -0
- package/dist/src/storage/providers/mongodb/methods/owner-memory-scope.d.ts.map +1 -0
- package/dist/src/storage/providers/mongodb/methods/owner-memory-scope.js +77 -0
- package/dist/src/storage/providers/mongodb/methods/owner-memory-scope.js.map +1 -0
- package/dist/src/storage/providers/mongodb/methods/owners-memory-bulk.d.ts +30 -0
- package/dist/src/storage/providers/mongodb/methods/owners-memory-bulk.d.ts.map +1 -0
- package/dist/src/storage/providers/mongodb/methods/owners-memory-bulk.js +0 -0
- package/dist/src/storage/providers/mongodb/methods/owners-memory-bulk.js.map +1 -0
- package/dist/src/storage/providers/mongodb/methods/owners.d.ts +8 -4
- package/dist/src/storage/providers/mongodb/methods/owners.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/owners.js +112 -21
- package/dist/src/storage/providers/mongodb/methods/owners.js.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/sessions.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/sessions.js +4 -0
- package/dist/src/storage/providers/mongodb/methods/sessions.js.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/storage-stats.d.ts +21 -0
- package/dist/src/storage/providers/mongodb/methods/storage-stats.d.ts.map +1 -0
- package/dist/src/storage/providers/mongodb/methods/storage-stats.js +58 -0
- package/dist/src/storage/providers/mongodb/methods/storage-stats.js.map +1 -0
- package/dist/src/storage/providers/mongodb/methods/work.d.ts +8 -0
- package/dist/src/storage/providers/mongodb/methods/work.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/methods/work.js +42 -0
- package/dist/src/storage/providers/mongodb/methods/work.js.map +1 -1
- package/dist/src/storage/providers/postgres/index.d.ts +1 -0
- package/dist/src/storage/providers/postgres/index.d.ts.map +1 -1
- package/dist/src/storage/providers/postgres/index.js +1 -0
- package/dist/src/storage/providers/postgres/index.js.map +1 -1
- package/dist/src/storage/providers/postgres-kysely/db-types.d.ts +1538 -0
- package/dist/src/storage/providers/postgres-kysely/db-types.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/db-types.js +6 -0
- package/dist/src/storage/providers/postgres-kysely/db-types.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/helpers.d.ts +23 -0
- package/dist/src/storage/providers/postgres-kysely/helpers.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/helpers.js +91 -0
- package/dist/src/storage/providers/postgres-kysely/helpers.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/index.d.ts +38 -0
- package/dist/src/storage/providers/postgres-kysely/index.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/index.js +81 -0
- package/dist/src/storage/providers/postgres-kysely/index.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/actions.d.ts +16 -0
- package/dist/src/storage/providers/postgres-kysely/methods/actions.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/actions.js +103 -0
- package/dist/src/storage/providers/postgres-kysely/methods/actions.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-misc.d.ts +37 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-misc.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-misc.js +306 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-misc.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-msg-dispute-invite.d.ts +55 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-msg-dispute-invite.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-msg-dispute-invite.js +247 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-msg-dispute-invite.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-onboarding.d.ts +11 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-onboarding.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-onboarding.js +81 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-onboarding.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-tasks.d.ts +50 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-tasks.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-tasks.js +238 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-tasks.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-usage.d.ts +10 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-usage.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-usage.js +146 -0
- package/dist/src/storage/providers/postgres-kysely/methods/agent-usage.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts +11 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js +51 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-grants.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-purchases.d.ts +10 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-purchases.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-purchases.js +53 -0
- package/dist/src/storage/providers/postgres-kysely/methods/app-purchases.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts +48 -0
- package/dist/src/storage/providers/postgres-kysely/methods/apps.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/apps.js +367 -0
- package/dist/src/storage/providers/postgres-kysely/methods/apps.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/boards.d.ts +28 -0
- package/dist/src/storage/providers/postgres-kysely/methods/boards.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/boards.js +104 -0
- package/dist/src/storage/providers/postgres-kysely/methods/boards.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/capabilities.d.ts +36 -0
- package/dist/src/storage/providers/postgres-kysely/methods/capabilities.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/capabilities.js +222 -0
- package/dist/src/storage/providers/postgres-kysely/methods/capabilities.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/catalogue.d.ts +19 -0
- package/dist/src/storage/providers/postgres-kysely/methods/catalogue.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/catalogue.js +96 -0
- package/dist/src/storage/providers/postgres-kysely/methods/catalogue.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/consent.d.ts +26 -0
- package/dist/src/storage/providers/postgres-kysely/methods/consent.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/consent.js +119 -0
- package/dist/src/storage/providers/postgres-kysely/methods/consent.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/device-auth.d.ts +13 -0
- package/dist/src/storage/providers/postgres-kysely/methods/device-auth.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/device-auth.js +68 -0
- package/dist/src/storage/providers/postgres-kysely/methods/device-auth.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/direct-message.d.ts +72 -0
- package/dist/src/storage/providers/postgres-kysely/methods/direct-message.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/direct-message.js +352 -0
- package/dist/src/storage/providers/postgres-kysely/methods/direct-message.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.d.ts +22 -0
- package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.js +201 -0
- package/dist/src/storage/providers/postgres-kysely/methods/ecosystem.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/federation.d.ts +42 -0
- package/dist/src/storage/providers/postgres-kysely/methods/federation.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/federation.js +295 -0
- package/dist/src/storage/providers/postgres-kysely/methods/federation.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/feedback.d.ts +15 -0
- package/dist/src/storage/providers/postgres-kysely/methods/feedback.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/feedback.js +52 -0
- package/dist/src/storage/providers/postgres-kysely/methods/feedback.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/files.d.ts +20 -0
- package/dist/src/storage/providers/postgres-kysely/methods/files.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/files.js +108 -0
- package/dist/src/storage/providers/postgres-kysely/methods/files.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity-extras.d.ts +19 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity-extras.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity-extras.js +101 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity-extras.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts +34 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity.js +298 -0
- package/dist/src/storage/providers/postgres-kysely/methods/identity.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/knowledge.d.ts +21 -0
- package/dist/src/storage/providers/postgres-kysely/methods/knowledge.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/knowledge.js +65 -0
- package/dist/src/storage/providers/postgres-kysely/methods/knowledge.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/marketplace.d.ts +24 -0
- package/dist/src/storage/providers/postgres-kysely/methods/marketplace.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/marketplace.js +122 -0
- package/dist/src/storage/providers/postgres-kysely/methods/marketplace.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts +81 -0
- package/dist/src/storage/providers/postgres-kysely/methods/memory.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/memory.js +342 -0
- package/dist/src/storage/providers/postgres-kysely/methods/memory.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/micro-memory.d.ts +15 -0
- package/dist/src/storage/providers/postgres-kysely/methods/micro-memory.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/micro-memory.js +55 -0
- package/dist/src/storage/providers/postgres-kysely/methods/micro-memory.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/moderation.d.ts +38 -0
- package/dist/src/storage/providers/postgres-kysely/methods/moderation.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/moderation.js +176 -0
- package/dist/src/storage/providers/postgres-kysely/methods/moderation.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.d.ts +38 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.js +243 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-ext-escrow.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-infra.d.ts +30 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-infra.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-infra.js +158 -0
- package/dist/src/storage/providers/postgres-kysely/methods/node-infra.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/notifications.d.ts +19 -0
- package/dist/src/storage/providers/postgres-kysely/methods/notifications.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/notifications.js +106 -0
- package/dist/src/storage/providers/postgres-kysely/methods/notifications.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/oauth.d.ts +20 -0
- package/dist/src/storage/providers/postgres-kysely/methods/oauth.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/oauth.js +94 -0
- package/dist/src/storage/providers/postgres-kysely/methods/oauth.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/organisms.d.ts +46 -0
- package/dist/src/storage/providers/postgres-kysely/methods/organisms.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/organisms.js +247 -0
- package/dist/src/storage/providers/postgres-kysely/methods/organisms.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/otk.d.ts +10 -0
- package/dist/src/storage/providers/postgres-kysely/methods/otk.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/otk.js +60 -0
- package/dist/src/storage/providers/postgres-kysely/methods/otk.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/packages.d.ts +32 -0
- package/dist/src/storage/providers/postgres-kysely/methods/packages.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/packages.js +228 -0
- package/dist/src/storage/providers/postgres-kysely/methods/packages.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/pat.d.ts +10 -0
- package/dist/src/storage/providers/postgres-kysely/methods/pat.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/pat.js +36 -0
- package/dist/src/storage/providers/postgres-kysely/methods/pat.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schedules.d.ts +32 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schedules.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schedules.js +131 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schedules.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schema.d.ts +10 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schema.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schema.js +88 -0
- package/dist/src/storage/providers/postgres-kysely/methods/schema.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/sessions.d.ts +38 -0
- package/dist/src/storage/providers/postgres-kysely/methods/sessions.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/sessions.js +66 -0
- package/dist/src/storage/providers/postgres-kysely/methods/sessions.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/subdomain-sites.d.ts +10 -0
- package/dist/src/storage/providers/postgres-kysely/methods/subdomain-sites.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/subdomain-sites.js +36 -0
- package/dist/src/storage/providers/postgres-kysely/methods/subdomain-sites.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system-extras.d.ts +23 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system-extras.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system-extras.js +109 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system-extras.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system.d.ts +32 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system.js +144 -0
- package/dist/src/storage/providers/postgres-kysely/methods/system.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/template-listings.d.ts +34 -0
- package/dist/src/storage/providers/postgres-kysely/methods/template-listings.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/template-listings.js +278 -0
- package/dist/src/storage/providers/postgres-kysely/methods/template-listings.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/wallet.d.ts +13 -0
- package/dist/src/storage/providers/postgres-kysely/methods/wallet.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/wallet.js +129 -0
- package/dist/src/storage/providers/postgres-kysely/methods/wallet.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/work.d.ts +14 -0
- package/dist/src/storage/providers/postgres-kysely/methods/work.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/methods/work.js +80 -0
- package/dist/src/storage/providers/postgres-kysely/methods/work.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/migrate.d.ts +4 -0
- package/dist/src/storage/providers/postgres-kysely/migrate.d.ts.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/migrate.js +40 -0
- package/dist/src/storage/providers/postgres-kysely/migrate.js.map +1 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0001_base_schema.sql +2406 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0002_memory_fts.sql +20 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0003_id_defaults.sql +15 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0004_otk_initial.sql +4 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0005_storage_stats.sql +9 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0006_membership_invited_workspaces.sql +5 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0007_contacts_origin.sql +5 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0008_feedback.sql +21 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0009_invitation_return_url.sql +7 -0
- package/dist/src/storage/providers/postgres-kysely/migrations/0010_agent_model.sql +5 -0
- package/dist/src/storage/providers/sqlite/index.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/index.js +4 -1
- package/dist/src/storage/providers/sqlite/index.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts +11 -1
- package/dist/src/storage/providers/sqlite/methods/apps.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/apps.js +40 -0
- package/dist/src/storage/providers/sqlite/methods/apps.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/capability-agents.d.ts +12 -1
- package/dist/src/storage/providers/sqlite/methods/capability-agents.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/capability-agents.js +42 -0
- package/dist/src/storage/providers/sqlite/methods/capability-agents.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/community.d.ts +6 -0
- package/dist/src/storage/providers/sqlite/methods/community.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/community.js +29 -3
- package/dist/src/storage/providers/sqlite/methods/community.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/extensions-notify.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/extensions-notify.js +11 -2
- package/dist/src/storage/providers/sqlite/methods/extensions-notify.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/feedback.d.ts +23 -0
- package/dist/src/storage/providers/sqlite/methods/feedback.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/methods/feedback.js +64 -0
- package/dist/src/storage/providers/sqlite/methods/feedback.js.map +1 -0
- package/dist/src/storage/providers/sqlite/methods/governance.d.ts +5 -0
- package/dist/src/storage/providers/sqlite/methods/governance.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/governance.js +43 -9
- package/dist/src/storage/providers/sqlite/methods/governance.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts +8 -0
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.js +48 -0
- package/dist/src/storage/providers/sqlite/methods/identity-nodes.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/messaging.d.ts +15 -1
- package/dist/src/storage/providers/sqlite/methods/messaging.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/messaging.js +11 -2
- package/dist/src/storage/providers/sqlite/methods/messaging.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/owner-memory-bulk.d.ts +28 -0
- package/dist/src/storage/providers/sqlite/methods/owner-memory-bulk.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/methods/owner-memory-bulk.js +101 -0
- package/dist/src/storage/providers/sqlite/methods/owner-memory-bulk.js.map +1 -0
- package/dist/src/storage/providers/sqlite/methods/owner-memory-scope.d.ts +35 -0
- package/dist/src/storage/providers/sqlite/methods/owner-memory-scope.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/methods/owner-memory-scope.js +118 -0
- package/dist/src/storage/providers/sqlite/methods/owner-memory-scope.js.map +1 -0
- package/dist/src/storage/providers/sqlite/methods/owner.d.ts +6 -0
- package/dist/src/storage/providers/sqlite/methods/owner.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/owner.js +41 -9
- package/dist/src/storage/providers/sqlite/methods/owner.js.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/work.d.ts +8 -0
- package/dist/src/storage/providers/sqlite/methods/work.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/methods/work.js +31 -0
- package/dist/src/storage/providers/sqlite/methods/work.js.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/action.d.ts +3 -0
- package/dist/src/storage/providers/sqlite/repos/action.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/action.js +9 -0
- package/dist/src/storage/providers/sqlite/repos/action.js.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/agent.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/agent.js +8 -4
- package/dist/src/storage/providers/sqlite/repos/agent.js.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/community.d.ts +1 -0
- package/dist/src/storage/providers/sqlite/repos/community.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/community.js +9 -3
- package/dist/src/storage/providers/sqlite/repos/community.js.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/direct-message.d.ts +13 -1
- package/dist/src/storage/providers/sqlite/repos/direct-message.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/direct-message.js +70 -5
- package/dist/src/storage/providers/sqlite/repos/direct-message.js.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/memory.d.ts +7 -0
- package/dist/src/storage/providers/sqlite/repos/memory.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/memory.js +24 -3
- package/dist/src/storage/providers/sqlite/repos/memory.js.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/storage-file.d.ts +12 -0
- package/dist/src/storage/providers/sqlite/repos/storage-file.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/storage-file.js +24 -0
- package/dist/src/storage/providers/sqlite/repos/storage-file.js.map +1 -1
- package/dist/src/storage/providers/sqlite/schema-tables-1.d.ts +1 -0
- package/dist/src/storage/providers/sqlite/schema-tables-1.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema-tables-1.js +18 -1
- package/dist/src/storage/providers/sqlite/schema-tables-1.js.map +1 -1
- package/dist/src/storage/providers/sqlite/schema-tables-2.d.ts +1 -0
- package/dist/src/storage/providers/sqlite/schema-tables-2.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema-tables-2.js +4 -1
- package/dist/src/storage/providers/sqlite/schema-tables-2.js.map +1 -1
- package/dist/src/storage/providers/sqlite/schema-tables-3.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema-tables-3.js +11 -1
- package/dist/src/storage/providers/sqlite/schema-tables-3.js.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.d.ts +0 -1
- package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.js +24 -0
- package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
- package/dist/src/storage/repositories/action.repository.d.ts +2 -0
- package/dist/src/storage/repositories/action.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/agent.repository.d.ts +3 -0
- package/dist/src/storage/repositories/agent.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/app.repository.d.ts +0 -0
- package/dist/src/storage/repositories/app.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/consent.repository.d.ts +10 -0
- package/dist/src/storage/repositories/consent.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/direct-message.repository.d.ts +36 -11
- package/dist/src/storage/repositories/direct-message.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/direct-message.repository.js +2 -0
- package/dist/src/storage/repositories/direct-message.repository.js.map +1 -1
- package/dist/src/storage/repositories/feedback.repository.d.ts +28 -0
- package/dist/src/storage/repositories/feedback.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/feedback.repository.js +13 -0
- package/dist/src/storage/repositories/feedback.repository.js.map +1 -0
- package/dist/src/storage/repositories/file.repository.d.ts +11 -0
- package/dist/src/storage/repositories/file.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/identity.repository.d.ts +7 -0
- package/dist/src/storage/repositories/identity.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/index.d.ts +1 -0
- package/dist/src/storage/repositories/index.d.ts.map +1 -1
- package/dist/src/storage/repositories/invitation.repository.d.ts +3 -0
- package/dist/src/storage/repositories/invitation.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/invitation.repository.js +2 -0
- package/dist/src/storage/repositories/invitation.repository.js.map +1 -1
- package/dist/src/storage/repositories/memory.repository.d.ts +133 -1
- package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/micro-memory.repository.d.ts +6 -0
- package/dist/src/storage/repositories/micro-memory.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/organism.repository.d.ts +10 -0
- package/dist/src/storage/repositories/organism.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/stats.repository.d.ts +31 -2
- package/dist/src/storage/repositories/stats.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/stats.repository.js +5 -2
- package/dist/src/storage/repositories/stats.repository.js.map +1 -1
- package/dist/src/storage/repositories/work.repository.d.ts +7 -0
- package/dist/src/storage/repositories/work.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories-impl/memory-repository.d.ts +78 -0
- package/dist/src/storage/repositories-impl/memory-repository.d.ts.map +1 -0
- package/dist/src/storage/repositories-impl/memory-repository.js +121 -0
- package/dist/src/storage/repositories-impl/memory-repository.js.map +1 -0
- package/dist/src/storage/schema-lock-cache.d.ts +24 -0
- package/dist/src/storage/schema-lock-cache.d.ts.map +1 -0
- package/dist/src/storage/schema-lock-cache.js +19 -0
- package/dist/src/storage/schema-lock-cache.js.map +1 -0
- package/dist/src/storage/storage-factory.d.ts +6 -3
- package/dist/src/storage/storage-factory.d.ts.map +1 -1
- package/dist/src/storage/storage-factory.js +19 -12
- package/dist/src/storage/storage-factory.js.map +1 -1
- package/dist/src/storage/types/agents-messaging.d.ts +33 -0
- package/dist/src/storage/types/agents-messaging.d.ts.map +1 -1
- package/dist/src/storage/types/agents-messaging.js +3 -0
- package/dist/src/storage/types/agents-messaging.js.map +1 -1
- package/dist/src/storage/types/apps.d.ts +13 -0
- package/dist/src/storage/types/apps.d.ts.map +1 -1
- package/dist/src/storage/types/identity.d.ts +8 -0
- package/dist/src/storage/types/identity.d.ts.map +1 -1
- package/dist/src/storage/types/organisms-federation.d.ts +27 -0
- package/dist/src/storage/types/organisms-federation.d.ts.map +1 -1
- package/dist/src/storage/uow/batch-loader.d.ts +44 -0
- package/dist/src/storage/uow/batch-loader.d.ts.map +1 -0
- package/dist/src/storage/uow/batch-loader.js +101 -0
- package/dist/src/storage/uow/batch-loader.js.map +1 -0
- package/dist/src/storage/uow/identity-map.d.ts +0 -0
- package/dist/src/storage/uow/identity-map.d.ts.map +1 -0
- package/dist/src/storage/uow/identity-map.js +0 -0
- package/dist/src/storage/uow/identity-map.js.map +1 -0
- package/dist/src/storage/uow/unit-of-work.d.ts +42 -0
- package/dist/src/storage/uow/unit-of-work.d.ts.map +1 -0
- package/dist/src/storage/uow/unit-of-work.js +89 -0
- package/dist/src/storage/uow/unit-of-work.js.map +1 -0
- package/dist/src/utils/app-badge.d.ts +7 -22
- package/dist/src/utils/app-badge.d.ts.map +1 -1
- package/dist/src/utils/app-badge.js +59 -22
- package/dist/src/utils/app-badge.js.map +1 -1
- package/dist/src/utils/app-protect.d.ts +2 -0
- package/dist/src/utils/app-protect.d.ts.map +1 -1
- package/dist/src/utils/app-protect.js +3 -9
- package/dist/src/utils/app-protect.js.map +1 -1
- package/dist/src/utils/env-config/sections-node.js +4 -4
- package/dist/src/utils/env-config/sections-node.js.map +1 -1
- package/dist/src/utils/env-config/sections-platform.d.ts.map +1 -1
- package/dist/src/utils/env-config/sections-platform.js +0 -11
- package/dist/src/utils/env-config/sections-platform.js.map +1 -1
- package/dist/src/utils/env-validator.d.ts.map +1 -1
- package/dist/src/utils/env-validator.js +10 -6
- package/dist/src/utils/env-validator.js.map +1 -1
- package/dist/src/utils/html-inject.d.ts +23 -0
- package/dist/src/utils/html-inject.d.ts.map +1 -0
- package/dist/src/utils/html-inject.js +42 -0
- package/dist/src/utils/html-inject.js.map +1 -0
- package/dist/src/utils/node-descriptor.d.ts.map +1 -1
- package/dist/src/utils/node-descriptor.js +0 -1
- package/dist/src/utils/node-descriptor.js.map +1 -1
- package/dist/static/app-catalog/_template.html +15 -0
- package/dist/static/app-catalog/js/app-agents.js +232 -0
- package/dist/static/app-catalog/js/cortex.js +114 -0
- package/dist/static/app-catalog/js/detail.js +39 -1
- package/dist/static/app-catalog/js/i18n-data.js +82 -4
- package/dist/static/app-catalog/js/main.js +7 -1
- package/dist/static/app-catalog/js/render.js +30 -11
- package/dist/static/app-catalog/js/server-io.js +10 -1
- package/dist/static/app-catalog/styles/app-catalog.css +96 -9
- package/dist/static/app-catalog.html +542 -32
- package/package.json +19 -20
- package/prisma/schema.postgres.prisma +0 -1789
- package/prisma/schema.prisma +0 -1787
|
@@ -0,0 +1,2329 @@
|
|
|
1
|
+
var IB=Object.defineProperty;var E1=Object.getOwnPropertySymbols;var BB=Object.prototype.hasOwnProperty,FB=Object.prototype.propertyIsEnumerable;var P1=(d,ie,ne)=>ie in d?IB(d,ie,{enumerable:!0,configurable:!0,writable:!0,value:ne}):d[ie]=ne,A1=(d,ie)=>{for(var ne in ie||(ie={}))BB.call(ie,ne)&&P1(d,ne,ie[ne]);if(E1)for(var ne of E1(ie))FB.call(ie,ne)&&P1(d,ne,ie[ne]);return d};/*!
|
|
2
|
+
* PixiJS - v8.19.0
|
|
3
|
+
* Compiled Thu, 04 Jun 2026 08:22:17 UTC
|
|
4
|
+
*
|
|
5
|
+
* PixiJS is licensed under the MIT License.
|
|
6
|
+
* http://www.opensource.org/licenses/mit-license
|
|
7
|
+
*/var PIXI=(function(d){"use strict";"use strict";var ie=Object.defineProperty,ne=Object.defineProperties,aS=Object.getOwnPropertyDescriptors,Ih=Object.getOwnPropertySymbols,oS=Object.prototype.hasOwnProperty,lS=Object.prototype.propertyIsEnumerable,Bh=(r,t,e)=>t in r?ie(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fh=(r,t)=>{for(var e in t||(t={}))oS.call(t,e)&&Bh(r,e,t[e]);if(Ih)for(var e of Ih(t))lS.call(t,e)&&Bh(r,e,t[e]);return r},uS=(r,t)=>ne(r,aS(t)),S=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.TextureUploaderWebGL="texture-uploader-webgl",r.TextureUploaderWebGPU="texture-uploader-webgpu",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(S||{});const Aa=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){const t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=uS(Fh({},t),{ref:r})}if(typeof r=="object")r=Fh({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},ni=(r,t)=>{var e;return(e=Aa(r).priority)!=null?e:t},N={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(Aa).forEach(t=>{t.type.forEach(e=>{var i,n;return(n=(i=this._removeHandlers)[e])==null?void 0:n.call(i,t)})}),this},add(...r){return r.map(Aa).forEach(t=>{t.type.forEach(e=>{var i,n;const s=this._addHandlers,a=this._queue;s[e]?(n=s[e])==null||n.call(s,t):(a[e]=a[e]||[],(i=a[e])==null||i.push(t))})}),this},handle(r,t,e){var i;const n=this._addHandlers,s=this._removeHandlers;n[r]=t,s[r]=e;const a=this._queue;return a[r]&&((i=a[r])==null||i.forEach(o=>t(o)),delete a[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,s)=>ni(s.value,e)-ni(n.value,e)))},i=>{const n=t.findIndex(s=>s.name===i.name);n!==-1&&t.splice(n,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((n,s)=>ni(s,e)-ni(n,e)))},i=>{const n=t.indexOf(i.ref);n!==-1&&t.splice(n,1)})},mixin(r,...t){for(const e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}};var DB=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function cS(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function UB(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function $B(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")&&Object.keys(r).length===1?r.default:r}function kB(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var t=r.default;if(typeof t=="function"){var e=function i(){var n=!1;try{n=this instanceof i}catch(s){}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var n=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return r[i]}})}),e}var sn={exports:{}},LB=sn.exports,Dh;function hS(){return Dh||(Dh=1,(function(r){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function n(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,h,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new n(c,h||l,p),m=e?e+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],f]:l._events[m].push(f):(l._events[m]=f,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new i:delete l._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,f=h.length,m=new Array(f);p<f;p++)m[p]=h[p].fn;return m},o.prototype.listenerCount=function(u){var c=e?e+u:u,h=this._events[c];return h?h.fn?1:h.length:0},o.prototype.emit=function(u,c,h,p,f,m){var g=e?e+u:u;if(!this._events[g])return!1;var _=this._events[g],y=arguments.length,b,x;if(_.fn){switch(_.once&&this.removeListener(u,_.fn,void 0,!0),y){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,c),!0;case 3:return _.fn.call(_.context,c,h),!0;case 4:return _.fn.call(_.context,c,h,p),!0;case 5:return _.fn.call(_.context,c,h,p,f),!0;case 6:return _.fn.call(_.context,c,h,p,f,m),!0}for(x=1,b=new Array(y-1);x<y;x++)b[x-1]=arguments[x];_.fn.apply(_.context,b)}else{var v=_.length,w;for(x=0;x<v;x++)switch(_[x].once&&this.removeListener(u,_[x].fn,void 0,!0),y){case 1:_[x].fn.call(_[x].context);break;case 2:_[x].fn.call(_[x].context,c);break;case 3:_[x].fn.call(_[x].context,c,h);break;case 4:_[x].fn.call(_[x].context,c,h,p);break;default:if(!b)for(w=1,b=new Array(y-1);w<y;w++)b[w-1]=arguments[w];_[x].fn.apply(_[x].context,b)}}return!0},o.prototype.on=function(u,c,h){return s(this,u,c,h,!1)},o.prototype.once=function(u,c,h){return s(this,u,c,h,!0)},o.prototype.removeListener=function(u,c,h,p){var f=e?e+u:u;if(!this._events[f])return this;if(!c)return a(this,f),this;var m=this._events[f];if(m.fn)m.fn===c&&(!p||m.once)&&(!h||m.context===h)&&a(this,f);else{for(var g=0,_=[],y=m.length;g<y;g++)(m[g].fn!==c||p&&!m[g].once||h&&m[g].context!==h)&&_.push(m[g]);_.length?this._events[f]=_.length===1?_[0]:_:a(this,f)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=e?e+u:u,this._events[c]&&a(this,c)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,r.exports=o})(sn)),sn.exports}var dS=hS(),Nt=cS(dS),pS={grad:.9,turn:360,rad:360/(2*Math.PI)},Re=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},Gt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},se=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Uh=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},$h=function(r){return{r:se(r.r,0,255),g:se(r.g,0,255),b:se(r.b,0,255),a:se(r.a)}},Ca=function(r){return{r:Gt(r.r),g:Gt(r.g),b:Gt(r.b),a:Gt(r.a,3)}},fS=/^#([0-9a-f]{3,8})$/i,an=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},kh=function(r){var t=r.r,e=r.g,i=r.b,n=r.a,s=Math.max(t,e,i),a=s-Math.min(t,e,i),o=a?s===t?(e-i)/a:s===e?2+(i-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:s?a/s*100:0,v:s/255*100,a:n}},Lh=function(r){var t=r.h,e=r.s,i=r.v,n=r.a;t=t/360*6,e/=100,i/=100;var s=Math.floor(t),a=i*(1-e),o=i*(1-(t-s)*e),l=i*(1-(1-t+s)*e),u=s%6;return{r:255*[i,o,a,a,l,i][u],g:255*[l,i,i,o,a,a][u],b:255*[a,a,l,i,i,o][u],a:n}},Nh=function(r){return{h:Uh(r.h),s:se(r.s,0,100),l:se(r.l,0,100),a:se(r.a)}},Xh=function(r){return{h:Gt(r.h),s:Gt(r.s),l:Gt(r.l),a:Gt(r.a,3)}},jh=function(r){return Lh((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},si=function(r){return{h:(t=kh(r)).h,s:(n=(200-(e=t.s))*(i=t.v)/100)>0&&n<200?e*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:t.a};var t,e,i,n},mS=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gS=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_S=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yS=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ma={string:[[function(r){var t=fS.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?Gt(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?Gt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=_S.exec(r)||yS.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:$h({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:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=mS.exec(r)||gS.exec(r);if(!t)return null;var e,i,n=Nh({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(pS[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return jh(n)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,n=r.a,s=n===void 0?1:n;return Re(t)&&Re(e)&&Re(i)?$h({r:Number(t),g:Number(e),b:Number(i),a:Number(s)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,n=r.a,s=n===void 0?1:n;if(!Re(t)||!Re(e)||!Re(i))return null;var a=Nh({h:Number(t),s:Number(e),l:Number(i),a:Number(s)});return jh(a)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,n=r.a,s=n===void 0?1:n;if(!Re(t)||!Re(e)||!Re(i))return null;var a=(function(o){return{h:Uh(o.h),s:se(o.s,0,100),v:se(o.v,0,100),a:se(o.a)}})({h:Number(t),s:Number(e),v:Number(i),a:Number(s)});return Lh(a)},"hsv"]]},Hh=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},zh=function(r){return typeof r=="string"?Hh(r.trim(),Ma.string):typeof r=="object"&&r!==null?Hh(r,Ma.object):[null,void 0]},NB=function(r){return zh(r)[1]},Ra=function(r,t){var e=si(r);return{h:e.h,s:se(e.s+100*t,0,100),l:e.l,a:e.a}},Oa=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Wh=function(r,t){var e=si(r);return{h:e.h,s:e.s,l:se(e.l+100*t,0,100),a:e.a}},on=(function(){function r(t){this.parsed=zh(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return Gt(Oa(this.rgba),2)},r.prototype.isDark=function(){return Oa(this.rgba)<.5},r.prototype.isLight=function(){return Oa(this.rgba)>=.5},r.prototype.toHex=function(){return t=Ca(this.rgba),e=t.r,i=t.g,n=t.b,a=(s=t.a)<1?an(Gt(255*s)):"","#"+an(e)+an(i)+an(n)+a;var t,e,i,n,s,a},r.prototype.toRgb=function(){return Ca(this.rgba)},r.prototype.toRgbString=function(){return t=Ca(this.rgba),e=t.r,i=t.g,n=t.b,(s=t.a)<1?"rgba("+e+", "+i+", "+n+", "+s+")":"rgb("+e+", "+i+", "+n+")";var t,e,i,n,s},r.prototype.toHsl=function(){return Xh(si(this.rgba))},r.prototype.toHslString=function(){return t=Xh(si(this.rgba)),e=t.h,i=t.s,n=t.l,(s=t.a)<1?"hsla("+e+", "+i+"%, "+n+"%, "+s+")":"hsl("+e+", "+i+"%, "+n+"%)";var t,e,i,n,s},r.prototype.toHsv=function(){return t=kh(this.rgba),{h:Gt(t.h),s:Gt(t.s),v:Gt(t.v),a:Gt(t.a,3)};var t},r.prototype.invert=function(){return be({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),be(Ra(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),be(Ra(this.rgba,-t))},r.prototype.grayscale=function(){return be(Ra(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),be(Wh(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),be(Wh(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?be({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):Gt(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=si(this.rgba);return typeof t=="number"?be({h:t,s:e.s,l:e.l,a:e.a}):Gt(e.h)},r.prototype.isEqual=function(t){return this.toHex()===be(t).toHex()},r})(),be=function(r){return r instanceof on?r:new on(r)},Vh=[],bS=function(r){r.forEach(function(t){Vh.indexOf(t)<0&&(t(on,Ma),Vh.push(t))})},XB=function(){return new on({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function vS(r,t){var e={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"},i={};for(var n in e)i[e[n]]=n;var s={};r.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,u=i[this.toHex()];if(u)return u;if(a!=null&&a.closest){var c=this.toRgb(),h=1/0,p="black";if(!s.length)for(var f in e)s[f]=new r(e[f]).toRgb();for(var m in e){var g=(o=c,l=s[m],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));g<h&&(h=g,p=m)}return p}},t.string.push([function(a){var o=a.toLowerCase(),l=o==="transparent"?"#0000":e[o];return l?new r(l).toRgb():null},"name"])}var xS=Object.defineProperty,Yh=Object.getOwnPropertySymbols,TS=Object.prototype.hasOwnProperty,SS=Object.prototype.propertyIsEnumerable,Kh=(r,t,e)=>t in r?xS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wS=(r,t)=>{for(var e in t||(t={}))TS.call(t,e)&&Kh(r,e,t[e]);if(Yh)for(var e of Yh(t))SS.call(t,e)&&Kh(r,e,t[e]);return r};bS([vS]);const vr=class rn{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}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(t){return this.value=t,this}set value(t){if(t instanceof rn)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?wS({},t):t}_isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((n,s)=>n===e[s]);if(t!==null&&e!==null){const n=Object.keys(t),s=Object.keys(e);return n.length!==s.length?!1:n.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,n]=this._components;return{r:t,g:e,b:i,a:n}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(n*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,n,s]=this._components;return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,n]=this._components;return t[0]=e,t[1]=i,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,n,s]=rn._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=n,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,n=this._int>>8&255,s=this._int&255;return e&&(i=i*t+.5|0,n=n*t+.5|0,s=s*t+.5|0),(t*255<<24)+(i<<16)+(n<<8)+s}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(t){let e,i,n,s;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,i=(a>>8&255)/255,n=(a&255)/255,s=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,n,s=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,n,s=255]=t,e/=255,i/=255,n/=255,s/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=rn.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=be(t);a.isValid()&&({r:e,g:i,b:n,a:s}=a.rgba,e/=255,i/=255,n/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=n,this._components[3]=s,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((n,s)=>{t[s]=Math.min(Math.max(n,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof rn||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||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!==void 0}};vr.shared=new vr,vr._temp=new vr,vr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let tt=vr;const qh={cullArea:null,cullable:!1,cullableChildren:!0},Zh=Math.PI*2,Qh=180/Math.PI,Jh=Math.PI/180;class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}static get shared(){return Ga.x=0,Ga.y=0,Ga}}const Ga=new lt;class U{constructor(t=1,e=0,i=0,n=1,s=0,a=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,n,s,a){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new lt;const i=t.x,n=t.y;return e.x=this.a*i+this.c*n+this.tx,e.y=this.b*i+this.d*n+this.ty,e}applyInverse(t,e){e=e||new lt;const i=this.a,n=this.b,s=this.c,a=this.d,o=this.tx,l=this.ty,u=1/(i*a+s*-n),c=t.x,h=t.y;return e.x=a*u*c+-s*u*h+(l*s-o*a)*u,e.y=i*u*h+-n*u*c+(-l*i+o*n)*u,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a,s=this.c,a=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=a*e-this.ty*i,this.ty=a*i+this.ty*e,this}append(t){const e=this.a,i=this.b,n=this.c,s=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*s,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*s,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this}appendFrom(t,e){const i=t.a,n=t.b,s=t.c,a=t.d,o=t.tx,l=t.ty,u=e.a,c=e.b,h=e.c,p=e.d;return this.a=i*u+n*h,this.b=i*c+n*p,this.c=s*u+a*h,this.d=s*c+a*p,this.tx=o*u+l*h+e.tx,this.ty=o*c+l*p+e.ty,this}setTransform(t,e,i,n,s,a,o,l,u){return this.a=Math.cos(o+u)*s,this.b=Math.sin(o+u)*s,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=t-(i*this.a+n*this.c),this.ty=e-(i*this.b+n*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,n=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=n*t.a+this.d*t.c,this.d=n*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,n=this.c,s=this.d,a=t.pivot,o=-Math.atan2(-n,s),l=Math.atan2(i,e),u=Math.abs(o+l);return u<1e-5||Math.abs(Zh-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(n*n+s*s),t.position.x=this.tx+(a.x*e+a.y*n),t.position.y=this.ty+(a.x*i+a.y*s),t}invert(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.tx,a=t*n-e*i;return this.a=n/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-n*s)/a,this.ty=-(t*this.ty-e*s)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new U;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}static get IDENTITY(){return PS.identity()}static get shared(){return ES.identity()}}const ES=new U,PS=new U;class bt{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new bt(t!=null?t:this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}const ai={default:-1};function ht(r="default"){return ai[r]===void 0&&(ai[r]=-1),++ai[r]}function AS(){for(const r in ai)delete ai[r]}const qe={_registeredResources:new Set,register(r){this._registeredResources.add(r)},unregister(r){this._registeredResources.delete(r)},release(){this._registeredResources.forEach(r=>r.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(r){return this._registeredResources.has(r)},reset(){this._registeredResources.clear()}};class td{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){var e;let i;return this._index>0?i=this._pool[--this._index]:(i=new this._classType,this._count++),(e=i.init)==null||e.call(i,t),i}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}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 t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}class ed{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new td(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const Pt=new ed;qe.register(Pt);const rd={get isCachedAsTexture(){var r;return!!((r=this.renderGroup)!=null&&r.isCachedAsTexture)},cacheAsTexture(r){typeof r=="boolean"&&r===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(r===!0?{}:r))},updateCacheTexture(){var r;(r=this.renderGroup)==null||r.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){this.cacheAsTexture(r)}};function Ia(r,t,e){const i=r.length;let n;if(t>=i||e===0)return;e=t+e>i?i-t:e;const s=i-e;for(n=t;n<s;++n)r[n]=r[n+e];r.length=s}const id={allowChildren:!0,removeChildren(r=0,t){var e;const i=t!=null?t:this.children.length,n=i-r,s=[];if(n>0&&n<=i){for(let o=i-1;o>=r;o--){const l=this.children[o];l&&(s.push(l),l.parent=null)}Ia(this.children,r,i);const a=this.renderGroup||this.parentRenderGroup;a&&a.removeChildren(s);for(let o=0;o<s.length;++o){const l=s[o];(e=l.parentRenderLayer)==null||e.detach(l),this.emit("childRemoved",l,this,o),s[o].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(n===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){const t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){const t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){const{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);const i=r.parent===this;if(r.parent){const s=r.parent.children.indexOf(r);if(i){if(s===t)return r;r.parent.children.splice(s,1)}else r.removeFromParent()}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15;const n=this.renderGroup||this.parentRenderGroup;return n&&n.addChild(r),this.sortableChildren&&(this.sortDirty=!0),i||(this.emit("childAdded",r,this,t),r.emit("added",this)),r},swapChildren(r,t){if(r===t)return;const e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;const n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var r;(r=this.parent)==null||r.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;const e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r},replaceChild(r,t){r.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(r)),t.setFromMatrix(r.localTransform),t.updateLocalTransform(),this.removeChild(r)}},nd={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){const i=this.children,n=i.length;for(let s=0;s<n;s++)i[s].collectRenderables(r,t,e)},collectRenderablesWithEffects(r,t,e){const{renderPipes:i}=t;for(let n=0;n<this.effects.length;n++){const s=this.effects[n];i[s.pipe].push(s,this,r)}this.collectRenderablesSimple(r,t,e);for(let n=this.effects.length-1;n>=0;n--){const s=this.effects[n];i[s.pipe].pop(s,this,r)}}};class oi{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}class sd{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const i=this._tests[e];if(i.test(t))return Pt.get(i.maskClass,t)}return t}returnMaskEffect(t){Pt.return(t)}}const ln=new sd;N.handleByList(S.MaskEffect,ln._effectClasses);var CS=Object.defineProperty,ad=Object.getOwnPropertySymbols,MS=Object.prototype.hasOwnProperty,RS=Object.prototype.propertyIsEnumerable,od=(r,t,e)=>t in r?CS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ld=(r,t)=>{for(var e in t||(t={}))MS.call(t,e)&&od(r,e,t[e]);if(ad)for(var e of ad(t))RS.call(t,e)&&od(r,e,t[e]);return r};const ud={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){this.effects.indexOf(r)===-1&&(this.effects.push(r),this.effects.sort((t,e)=>t.priority-e.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){const t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){const t=this._maskEffect;(t==null?void 0:t.mask)!==r&&(t&&(this.removeEffect(t),ln.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=ln.getMaskEffect(r),this.addEffect(this._maskEffect)))},get mask(){var r;return(r=this._maskEffect)==null?void 0:r.mask},setMask(r){this._maskOptions=ld(ld({},this._maskOptions),r),r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},set filters(r){var t;!Array.isArray(r)&&r&&(r=[r]);const e=this._filterEffect||(this._filterEffect=new oi);r=r;const i=(r==null?void 0:r.length)>0,n=((t=e.filters)==null?void 0:t.length)>0,s=i!==n;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),s&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=r!=null?r:null))},get filters(){var r;return(r=this._filterEffect)==null?void 0:r.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new oi),this._filterEffect.filterArea=r},get filterArea(){var r;return(r=this._filterEffect)==null?void 0:r.filterArea}},cd={label:null,get name(){return this.label},set name(r){this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){const e=this.children;for(let i=0;i<e.length;i++){const n=e[i];if(n.label===r||r instanceof RegExp&&r.test(n.label))return n}if(t)for(let i=0;i<e.length;i++){const n=e[i].getChildByLabel(r,!0);if(n)return n}return null},getChildrenByLabel(r,t=!1,e=[]){const i=this.children;for(let n=0;n<i.length;n++){const s=i[n];(s.label===r||r instanceof RegExp&&r.test(s.label))&&e.push(s)}if(t)for(let n=0;n<i.length;n++)i[n].getChildrenByLabel(r,!0,e);return e}},un=[new lt,new lt,new lt,new lt];class ut{constructor(t=0,e=0,i=0,n=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),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 ut(0,0,0,0)}clone(){return new ut(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,n=.5){const{width:s,height:a}=this;if(s<=0||a<=0)return!1;const o=this.x,l=this.y,u=i*(1-n),c=i-u,h=o-u,p=o+s+u,f=l-u,m=l+a+u,g=o+c,_=o+s-c,y=l+c,b=l+a-c;return t>=h&&t<=p&&e>=f&&e<=m&&!(t>g&&t<_&&e>y&&e<b)}intersects(t,e){if(!e){const P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;const M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}const i=this.left,n=this.right,s=this.top,a=this.bottom;if(n<=i||a<=s)return!1;const o=un[0].set(t.left,t.top),l=un[1].set(t.left,t.bottom),u=un[2].set(t.right,t.top),c=un[3].set(t.right,t.bottom);if(u.x<=o.x||l.y<=o.y)return!1;const h=Math.sign(e.a*e.d-e.b*e.c);if(h===0||(e.apply(o,o),e.apply(l,l),e.apply(u,u),e.apply(c,c),Math.max(o.x,l.x,u.x,c.x)<=i||Math.min(o.x,l.x,u.x,c.x)>=n||Math.max(o.y,l.y,u.y,c.y)<=s||Math.min(o.y,l.y,u.y,c.y)>=a))return!1;const p=h*(l.y-o.y),f=h*(o.x-l.x),m=p*i+f*s,g=p*n+f*s,_=p*i+f*a,y=p*n+f*a;if(Math.max(m,g,_,y)<=p*o.x+f*o.y||Math.min(m,g,_,y)>=p*c.x+f*c.y)return!1;const b=h*(o.y-u.y),x=h*(u.x-o.x),v=b*i+x*s,w=b*n+x*s,T=b*i+x*a,E=b*n+x*a;return!(Math.max(v,w,T,E)<=b*o.x+x*o.y||Math.min(v,w,T,E)>=b*c.x+x*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=n,this.height=Math.max(s-n,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,n=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=n-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=n,this.height=s-n,this}getBounds(t){return t||(t=new ut),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,n=t.x+t.width,s=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&n>=this.x&&n<this.x+this.width&&s>=this.y&&s<this.y+this.height}set(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this}}const hd=new U;class Mt{constructor(t=1/0,e=1/0,i=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=hd,this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ut);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=hd,this}set(t,e,i,n){this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}addFrame(t,e,i,n,s){s||(s=this.matrix);const a=s.a,o=s.b,l=s.c,u=s.d,c=s.tx,h=s.ty;let p=this.minX,f=this.minY,m=this.maxX,g=this.maxY,_=a*t+l*e+c,y=o*t+u*e+h;_<p&&(p=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),_=a*i+l*e+c,y=o*i+u*e+h,_<p&&(p=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),_=a*t+l*n+c,y=o*t+u*n+h,_<p&&(p=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),_=a*i+l*n+c,y=o*i+u*n+h,_<p&&(p=_),y<f&&(f=y),_>m&&(m=_),y>g&&(g=y),this.minX=p,this.minY=f,this.maxX=m,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,i=this.minY,n=this.maxX,s=this.maxY,{a,b:o,c:l,d:u,tx:c,ty:h}=t;let p=a*e+l*i+c,f=o*e+u*i+h;this.minX=p,this.minY=f,this.maxX=p,this.maxY=f,p=a*n+l*i+c,f=o*n+u*i+h,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*e+l*s+c,f=o*e+u*s+h,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=a*n+l*s+c,f=o*n+u*s+h,this.minX=p<this.minX?p:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=p>this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,n){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>n&&(this.maxY=n),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,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 Mt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}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(t,e,i,n){let s=this.minX,a=this.minY,o=this.maxX,l=this.maxY;n||(n=this.matrix);const u=n.a,c=n.b,h=n.c,p=n.d,f=n.tx,m=n.ty;for(let g=e;g<i;g+=2){const _=t[g],y=t[g+1],b=u*_+h*y+f,x=c*_+p*y+m;s=b<s?b:s,a=x<a?x:a,o=b>o?b:o,l=x>l?x:l}this.minX=s,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}const Dt=Pt.getPool(U),ve=Pt.getPool(Mt),OS=new U,dd={getFastGlobalBounds(r,t){t||(t=new Mt),t.clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;const n=!!this.effects.length;if((this.renderGroup||n)&&(i=ve.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const a=this.bounds;i.addFrame(a.minX,a.minY,a.maxX,a.maxY,this.groupTransform)}const s=this.children;for(let a=0;a<s.length;a++)s[a]._getGlobalBoundsRecursive(r,i,e)}if(n){let s=!1;const a=this.renderGroup||this.parentRenderGroup;for(let o=0;o<this.effects.length;o++)this.effects[o].addBounds&&(s||(s=!0,i.applyMatrix(a.worldTransform)),this.effects[o].addBounds(i,!0));s&&i.applyMatrix(a.worldTransform.copyTo(OS).invert()),t.addBounds(i),ve.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),ve.return(i))}};function li(r,t,e){e.clear();let i,n;return r.parent?t?i=r.parent.worldTransform:(n=Dt.get().identity(),i=cn(r,n)):i=U.IDENTITY,pd(r,e,i,t),n&&Dt.return(n),e.isValid||e.set(0,0,0,0),e}function pd(r,t,e,i){var n,s;if(!r.visible||!r.measurable)return;let a;i?a=r.worldTransform:(r.updateLocalTransform(),a=Dt.get(),a.appendFrom(r.localTransform,e));const o=t,l=!!r.effects.length;if(l&&(t=ve.get().clear()),r.boundsArea)t.addRect(r.boundsArea,a);else{const u=r.bounds;u&&!u.isEmpty()&&(t.matrix=a,t.addBounds(u));for(let c=0;c<r.children.length;c++)pd(r.children[c],t,a,i)}if(l){for(let u=0;u<r.effects.length;u++)(s=(n=r.effects[u]).addBounds)==null||s.call(n,t);o.addBounds(t,U.IDENTITY),ve.return(t)}i||Dt.return(a)}function cn(r,t){const e=r.parent;return e&&(cn(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function Oe(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;const e=r>>16&255,i=r>>8&255,n=r&255,s=t>>16&255,a=t>>8&255,o=t&255,l=e*s/255|0,u=i*a/255|0,c=n*o/255|0;return(l<<16)+(u<<8)+c}const fd=16777215;function ui(r,t){return r===fd?t:t===fd?r:Oe(r,t)}function xe(r){return((r&255)<<16)+(r&65280)+(r>>16&255)}const md={getGlobalAlpha(r){if(r)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(r=new U,t){if(t)return r.copyFrom(this.worldTransform);this.updateLocalTransform();const e=cn(this,Dt.get().identity());return r.appendFrom(this.localTransform,e),Dt.return(e),r},getGlobalTint(r){if(r)return this.renderGroup?xe(this.renderGroup.worldColor):this.parentRenderGroup?xe(ui(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=ui(t,e.localColor),e=e.parent;return xe(t)}};function hn(r,t,e){return t.clear(),e||(e=U.IDENTITY),gd(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function gd(r,t,e,i,n){var s,a;let o;if(n)o=Dt.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();const c=r.localTransform;o=Dt.get(),o.appendFrom(c,e)}const l=t,u=!!r.effects.length;if(u&&(t=ve.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,t.addBounds(r.bounds));const c=r.children;for(let h=0;h<c.length;h++)gd(c[h],t,o,i,!1)}if(u){for(let c=0;c<r.effects.length;c++)(a=(s=r.effects[c]).addLocalBounds)==null||a.call(s,t,i);l.addBounds(t,U.IDENTITY),ve.return(t)}Dt.return(o)}function Ba(r,t){const e=r.children;for(let i=0;i<e.length;i++){const n=e[i],s=n.uid,a=(n._didViewChangeTick&65535)<<16|n._didContainerChangeTick&65535,o=t.index;(t.data[o]!==s||t.data[o+1]!==a)&&(t.data[t.index]=s,t.data[t.index+1]=a,t.didChange=!0),t.index=o+2,n.children.length&&Ba(n,t)}return t.didChange}const GS=new U,_d={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Mt});const r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),Ba(this,r),r.didChange&&hn(this,r.localBounds,GS),r.localBounds},getBounds(r,t){return li(this,r,t||new Mt)}},yd={_onRender:null,set onRender(r){const t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}},bd={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,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(IS))}};function IS(r,t){return r._zIndex-t._zIndex}const vd={getGlobalPosition(r=new lt,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){const i=this.getGlobalTransform(Dt.get(),e);return t=i.apply(r,t),Dt.return(i),t},toLocal(r,t,e,i){t&&(r=t.toGlobal(r,e,i));const n=this.getGlobalTransform(Dt.get(),i);return e=n.applyInverse(r,e),Dt.return(n),e}};class dn{constructor(){this.uid=ht("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}function Ze(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function Fa(r){return!(r&r-1)&&!!r}function BS(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function he(r){const t={};for(const e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var FS=Object.defineProperty,xd=Object.getOwnPropertySymbols,DS=Object.prototype.hasOwnProperty,US=Object.prototype.propertyIsEnumerable,Td=(r,t,e)=>t in r?FS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sd=(r,t)=>{for(var e in t||(t={}))DS.call(t,e)&&Td(r,e,t[e]);if(xd)for(var e of xd(t))US.call(t,e)&&Td(r,e,t[e]);return r};const wd=Object.create(null);function $S(r){const t=wd[r];return t===void 0&&(wd[r]=ht("resource")),t}const Ed=class C1 extends Nt{constructor(t={}){var e,i,n,s,a,o,l;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t=Sd(Sd({},C1.defaultOptions),t),this.addressMode=t.addressMode,this.addressModeU=(e=t.addressModeU)!=null?e:this.addressModeU,this.addressModeV=(i=t.addressModeV)!=null?i:this.addressModeV,this.addressModeW=(n=t.addressModeW)!=null?n:this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=(s=t.magFilter)!=null?s:this.magFilter,this.minFilter=(a=t.minFilter)!=null?a:this.minFilter,this.mipmapFilter=(o=t.mipmapFilter)!=null?o:this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=(l=t.maxAnisotropy)!=null?l:1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,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 t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=$S(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Ed.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Jt=Ed;var kS=Object.defineProperty,Pd=Object.getOwnPropertySymbols,LS=Object.prototype.hasOwnProperty,NS=Object.prototype.propertyIsEnumerable,Ad=(r,t,e)=>t in r?kS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cd=(r,t)=>{for(var e in t||(t={}))LS.call(t,e)&&Ad(r,e,t[e]);if(Pd)for(var e of Pd(t))NS.call(t,e)&&Ad(r,e,t[e]);return r};const Md=class M1 extends Nt{constructor(t={}){var e,i,n,s,a;super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=ht("textureSource"),this._resourceType="textureSource",this._resourceId=ht("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.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t=Cd(Cd({},M1.defaultOptions),t),this.label=(e=t.label)!=null?e:"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource&&(i=this.resourceWidth)!=null?i:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource&&(n=this.resourceHeight)!=null?n:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.viewDimension=(s=t.viewDimension)!=null?s:t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.transient=(a=t.transient)!=null?a:!1,this.alphaMode=t.alphaMode,this.style=new Jt(he(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){var t,e;this._resourceId=ht("resource"),this.emit("change",this),this.emit("unload",this);for(const i in this._gpuData)(e=(t=this._gpuData[i])==null?void 0:t.destroy)==null||e.call(t);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);const n=Math.round(t*i),s=Math.round(e*i);return this.width=n/i,this.height=s/i,this._resolution=i,this.pixelWidth===n&&this.pixelHeight===s?!1:(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=s,this.emit("resize",this),this._resourceId=ht("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Fa(this.pixelWidth)&&Fa(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Md.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let ft=Md;const Qe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Je=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],tr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],er=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Da=[],Rd=[],pn=Math.sign;function XS(){for(let r=0;r<16;r++){const t=[];Da.push(t);for(let e=0;e<16;e++){const i=pn(Qe[r]*Qe[e]+tr[r]*Je[e]),n=pn(Je[r]*Qe[e]+er[r]*Je[e]),s=pn(Qe[r]*tr[e]+tr[r]*er[e]),a=pn(Je[r]*tr[e]+er[r]*er[e]);for(let o=0;o<16;o++)if(Qe[o]===i&&Je[o]===n&&tr[o]===s&&er[o]===a){t.push(o);break}}}for(let r=0;r<16;r++){const t=new U;t.set(Qe[r],Je[r],tr[r],er[r],0,0),Rd.push(t)}}XS();const W={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:r=>Qe[r],uY:r=>Je[r],vX:r=>tr[r],vY:r=>er[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>Da[r][t],sub:(r,t)=>Da[r][W.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?W.S:W.N:Math.abs(t)*2<=Math.abs(r)?r>0?W.E:W.W:t>0?r>0?W.SE:W.SW:r>0?W.NE:W.NW,matrixAppendRotationInv:(r,t,e=0,i=0,n=0,s=0)=>{const a=Rd[W.inv(t)],o=a.a,l=a.b,u=a.c,c=a.d,h=e-Math.min(0,o*n,u*s,o*n+u*s),p=i-Math.min(0,l*n,c*s,l*n+c*s),f=r.a,m=r.b,g=r.c,_=r.d;r.a=o*f+l*g,r.b=o*m+l*_,r.c=u*f+c*g,r.d=u*m+c*_,r.tx=h*f+p*g+r.tx,r.ty=h*m+p*_+r.ty},transformRectCoords:(r,t,e,i)=>{const{x:n,y:s,width:a,height:o}=r,{x:l,y:u,width:c,height:h}=t;return e===W.E?(i.set(n+l,s+u,a,o),i):e===W.S?i.set(c-s-o+l,n+u,o,a):e===W.W?i.set(c-n-a+l,h-s-o+u,a,o):e===W.N?i.set(s+l,h-n-a+u,o,a):i.set(n+l,s+u,a,o)}},Ua=()=>{};var jS=Object.defineProperty,HS=Object.defineProperties,zS=Object.getOwnPropertyDescriptors,Od=Object.getOwnPropertySymbols,WS=Object.prototype.hasOwnProperty,VS=Object.prototype.propertyIsEnumerable,Gd=(r,t,e)=>t in r?jS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,YS=(r,t)=>{for(var e in t||(t={}))WS.call(t,e)&&Gd(r,e,t[e]);if(Od)for(var e of Od(t))VS.call(t,e)&&Gd(r,e,t[e]);return r},KS=(r,t)=>HS(r,zS(t));class fn extends ft{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super(KS(YS({},t),{resource:e,format:i})),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}fn.extension=S.TextureSource;const Id=new U;class $a{constructor(t,e){this.mapCoord=new U,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,typeof e=="undefined"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this._texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this)),this.update()}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let n=0;n<t.length;n+=2){const s=t[n],a=t[n+1];e[n]=s*i.a+a*i.c+i.tx,e[n+1]=s*i.b+a*i.d+i.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const i=t.orig,n=t.trim;n&&(Id.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Id));const s=t.source,a=this.uClampFrame,o=this.clampMargin/s._resolution,l=this.clampOffset/s._resolution;return a[0]=(t.frame.x+o+l)/s.width,a[1]=(t.frame.y+o+l)/s.height,a[2]=(t.frame.x+t.frame.width-o+l)/s.width,a[3]=(t.frame.y+t.frame.height-o+l)/s.height,this.uClampOffset[0]=this.clampOffset/s.pixelWidth,this.uClampOffset[1]=this.clampOffset/s.pixelHeight,this.isSimple=t.frame.width===s.width&&t.frame.height===s.height&&t.rotate===0,!0}}class D extends Nt{constructor({source:t,label:e,frame:i,orig:n,trim:s,defaultAnchor:a,defaultBorders:o,rotate:l,dynamic:u}={}){var c;if(super(),this.uid=ht("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ut,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(c=t==null?void 0:t.source)!=null?c:new ft,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:h,height:p}=this._source;this.frame.width=h,this.frame.height=p}this.orig=n||this.frame,this.trim=s,this.rotate=l!=null?l:0,this.defaultAnchor=a,this.defaultBorders=o,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new $a(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:n}=this._source,s=e.x/i,a=e.y/n,o=e.width/i,l=e.height/n;let u=this.rotate;if(u){const c=o/2,h=l/2,p=s+c,f=a+h;u=W.add(u,W.NW),t.x0=p+c*W.uX(u),t.y0=f+h*W.uY(u),u=W.add(u,2),t.x1=p+c*W.uX(u),t.y1=f+h*W.uY(u),u=W.add(u,2),t.x2=p+c*W.uX(u),t.y2=f+h*W.uY(u),u=W.add(u,2),t.x3=p+c*W.uX(u),t.y3=f+h*W.uY(u)}else t.x0=s,t.y0=a,t.x1=s+o,t.y1=a,t.x2=s+o,t.y2=a+l,t.x3=s,t.y3=a+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(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 this._source}}D.EMPTY=new D({label:"EMPTY",source:new ft({label:"EMPTY"})}),D.EMPTY.destroy=Ua,D.WHITE=new D({source:new fn({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),D.WHITE.destroy=Ua;var qS=Object.defineProperty,ZS=Object.defineProperties,QS=Object.getOwnPropertyDescriptors,Bd=Object.getOwnPropertySymbols,JS=Object.prototype.hasOwnProperty,t2=Object.prototype.propertyIsEnumerable,Fd=(r,t,e)=>t in r?qS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,e2=(r,t)=>{for(var e in t||(t={}))JS.call(t,e)&&Fd(r,e,t[e]);if(Bd)for(var e of Bd(t))t2.call(t,e)&&Fd(r,e,t[e]);return r},r2=(r,t)=>ZS(r,QS(t));let i2=0;class Dd{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new Jt(this.textureOptions)}createTexture(t,e,i,n){const s=new ft(r2(e2({},this.textureOptions),{width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:n}));return new D({source:s,label:`texturePool_${i2++}`})}getOptimalTexture(t,e,i=1,n,s=!1){let a=Math.ceil(t*i-1e-6),o=Math.ceil(e*i-1e-6);a=Ze(a),o=Ze(o);const l=n?1:0,u=s?1:0,c=(a<<17)+(o<<2)+(u<<1)+l;this._texturePool[c]||(this._texturePool[c]=[]);let h=this._texturePool[c].pop();return h||(h=this.createTexture(a,o,n,s)),h.source._resolution=i,h.source.width=a/i,h.source.height=o/i,h.source.pixelWidth=a,h.source.pixelHeight=o,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=c,h}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t,e=!1){const i=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[i].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const i=this._texturePool[e];if(i)for(let n=0;n<i.length;n++)i[n].destroy(!0)}this._texturePool={}}}const vt=new Dd;qe.register(vt);class mn{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new U,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 dn,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let i=0;i<e.length;i++){const n=e[i];n._updateFlags=15,this.addChild(n)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(vt.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.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(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const i=t.children;for(let n=0;n<i.length;n++)this._getChildren(i[n],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new U),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new U),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new U),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function gn(r,t,e={}){for(const i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}const ka=new bt(null),La=new bt(null),Na=new bt(null,1,1),Xa=new bt(null),ci=1,_n=2,xr=4,n2=8;class dt extends Nt{constructor(t={}){var e,i;super(),this.uid=ht("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 U,this.relativeGroupTransform=new U,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new bt(this,0,0),this._scale=Na,this._pivot=La,this._origin=Xa,this._skew=ka,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=[],gn(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(n=>this.addChild(n)),(i=t.parent)==null||i.addChild(this)}static mixin(t){N.mixin(dt,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(t.length>1){for(let n=0;n<t.length;n++)this.addChild(t[n]);return t[0]}const e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let n=0;n<t.length;n++)this.removeChild(t[n]);return t[0]}const e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=Pt.get(mn,this),this.groupTransform=U.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),Pt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new U),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(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Qh}set angle(t){this.rotation=t*Jh}get pivot(){return this._pivot===La&&(this._pivot=new bt(this,0,0)),this._pivot}set pivot(t){this._pivot===La&&(this._pivot=new bt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===ka&&(this._skew=new bt(this,0,0)),this._skew}set skew(t){this._skew===ka&&(this._skew=new bt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Na&&(this._scale=new bt(this,1,1)),this._scale}set scale(t){this._scale===Na&&(this._scale=new bt(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===Xa&&(this._origin=new bt(this,0,0)),this._origin}set origin(t){this._origin===Xa&&(this._origin=new bt(this,0,0)),typeof t=="number"?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){var i;const n=this.getLocalBounds();typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,n.width),e!==void 0&&this._setHeight(e,n.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX:this.scale.x,typeof t.scaleY=="number"?t.scaleY:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,n=this._pivot,s=this._origin,a=this._position,o=i._x,l=i._y,u=n._x,c=n._y,h=-s._x,p=-s._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*l,e.d=this._sy*l,e.tx=a._x-(u*e.a+c*e.c)+(h*e.a+p*e.c)-h,e.ty=a._y-(u*e.b+c*e.d)+(h*e.b+p*e.d)-p}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=ci,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=tt.shared.setValue(t!=null?t:16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=ci,this._onUpdate())}get tint(){return xe(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=_n,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=xr,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=xr,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=xr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var e;if(this.destroyed)return;this.destroyed=!0;let i;if(this.children.length&&(i=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(),(typeof t=="boolean"?t:t==null?void 0:t.children)&&i)for(let n=0;n<i.length;++n)i[n].destroy(t);(e=this.renderGroup)==null||e.destroy(),this.renderGroup=null}}N.mixin(dt,id,dd,vd,yd,_d,ud,cd,bd,qh,rd,md,nd);var Te=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Te||{});class yn{constructor(t,e=null,i=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=n}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!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 e=this.next;return this.next=t?null:e,this.previous=null,e}}const Ud=class re{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 yn(null,null,1/0),this.deltaMS=1/re.targetFPMS,this.elapsedMS=1/re.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Te.NORMAL){return this._addListener(new yn(t,e,i))}addOnce(t,e,i=Te.NORMAL){return this._addListener(new yn(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const s=t-this._lastFrame|0;if(s<this._minElapsedMS)return;this._lastFrame=t-s%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*re.targetFPMS;const i=this._head;let n=i.next;for(;n;)n=n.emit(this);i.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 e=Math.min(Math.max(0,t)/1e3,re.targetFPMS);this._maxElapsedMS=1/e,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){t===0?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!re._shared){const t=re._shared=new re;t.autoStart=!0,t._protected=!0}return re._shared}static get system(){if(!re._system){const t=re._system=new re;t.autoStart=!0,t._protected=!0}return re._system}};Ud.targetFPMS=.06;let Ot=Ud;class ja{constructor(t){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const e=this._canvas.getBoundingClientRect(),i=this._canvas.width,n=this._canvas.height,s=e.width/i*this._renderer.resolution,a=e.height/n*this._renderer.resolution,o=e.left,l=e.top,u=`translate(${o}px, ${l}px) scale(${s}, ${a})`;u!==this._lastTransform&&(this._domElement.style.transform=u,this._lastTransform=u)},this._domElement=t.domElement,this._renderer=t.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(t=>{for(const e of t){if(e.target!==this._canvas)continue;const i=this.canvas.width,n=this.canvas.height,s=e.contentRect.width/i*this._renderer.resolution,a=e.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==s||this._lastScaleY!==a)&&(this.updateTranslation(),this._lastScaleX=s,this._lastScaleY=a)}}),this._observer.observe(this._canvas)):this._tickerAttached||Ot.shared.add(this.updateTranslation,this,Te.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&Ot.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 Tr{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Tr.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new lt,this.page=new lt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}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(t,e,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,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 Ha=/iPhone/i,$d=/iPod/i,kd=/iPad/i,Ld=/\biOS-universal(?:.+)Mac\b/i,za=/\bAndroid(?:.+)Mobile\b/i,Nd=/Android/i,Sr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,bn=/Silk/i,Ge=/Windows Phone/i,Xd=/\bWindows(?:.+)ARM\b/i,jd=/BlackBerry/i,Hd=/BB10/i,zd=/Opera Mini/i,Wd=/\b(CriOS|Chrome)(?:.+)Mobile/i,Vd=/Mobile(?:.+)Firefox\b/i,Yd=function(r){return typeof r!="undefined"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream=="undefined"};function s2(r){return function(t){return t.test(r)}}function Kd(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]!="undefined"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]!="undefined"&&(e=i[0]);var n=s2(e),s={apple:{phone:n(Ha)&&!n(Ge),ipod:n($d),tablet:!n(Ha)&&(n(kd)||Yd(t))&&!n(Ge),universal:n(Ld),device:(n(Ha)||n($d)||n(kd)||n(Ld)||Yd(t))&&!n(Ge)},amazon:{phone:n(Sr),tablet:!n(Sr)&&n(bn),device:n(Sr)||n(bn)},android:{phone:!n(Ge)&&n(Sr)||!n(Ge)&&n(za),tablet:!n(Ge)&&!n(Sr)&&!n(za)&&(n(bn)||n(Nd)),device:!n(Ge)&&(n(Sr)||n(bn)||n(za)||n(Nd))||n(/\bokhttp\b/i)},windows:{phone:n(Ge),tablet:n(Xd),device:n(Ge)||n(Xd)},other:{blackberry:n(jd),blackberry10:n(Hd),opera:n(zd),firefox:n(Vd),chrome:n(Wd),device:n(jd)||n(Hd)||n(zd)||n(Vd)||n(Wd)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var qd;const Zd=((qd=Kd.default)!=null?qd:Kd)(globalThis.navigator);var a2=Object.defineProperty,Qd=Object.getOwnPropertySymbols,o2=Object.prototype.hasOwnProperty,l2=Object.prototype.propertyIsEnumerable,Jd=(r,t,e)=>t in r?a2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,tp=(r,t)=>{for(var e in t||(t={}))o2.call(t,e)&&Jd(r,e,t[e]);if(Qd)for(var e of Qd(t))l2.call(t,e)&&Jd(r,e,t[e]);return r};const u2=9,ep=100,c2=0,h2=0,rp=2,ip=1,d2=-1e3,p2=-1e3,f2=2,Wa=class R1{constructor(t,e=Zd){this._mobileInfo=e,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,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const t=document.createElement("button");t.style.width=`${ip}px`,t.style.height=`${ip}px`,t.style.position="absolute",t.style.top=`${d2}px`,t.style.left=`${p2}px`,t.style.zIndex=f2.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_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=`${c2}px`,this._div.style.left=`${h2}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=rp.toString(),this._canvasObserver=new ja({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const t=this._renderer.view.canvas;if(t.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const e=new MutationObserver(()=>{t.parentNode&&(e.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){var t,e;if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const i of this._children)(t=i._accessibleDiv)!=null&&t.parentNode&&(i._accessibleDiv.parentNode.removeChild(i._accessibleDiv),i._accessibleDiv=null),i._accessibleActive=!1;for(const i in this._pools)this._pools[i].forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),delete this._pools[i];(e=this._div)!=null&&e.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);const e=t.children;if(e)for(let i=0;i<e.length;i++)this._updateAccessibleObjects(e[i])}init(t){const e=R1.defaultOptions,i={accessibilityOptions:tp(tp({},e),(t==null?void 0:t.accessibilityOptions)||{})};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&e.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const n=this._children[i];e.has(i)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,Ia(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const n=this._children[i];if(!n._accessibleActive||!n._accessibleDiv)continue;const s=n._accessibleDiv,a=n.hitArea||n.getBounds().rectangle;if(n.hitArea){const o=n.worldTransform;s.style.left=`${o.tx+a.x*o.a}px`,s.style.top=`${o.ty+a.y*o.d}px`,s.style.width=`${a.width*o.a}px`,s.style.height=`${a.height*o.d}px`}else this._capHitArea(a),s.style.left=`${a.x}px`,s.style.top=`${a.y}px`,s.style.width=`${a.width}px`,s.style.height=`${a.height}px`}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._getPool(t.accessibleType).pop();e?(e.innerHTML="",e.removeAttribute("title"),e.removeAttribute("aria-label"),e.tabIndex=0):(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
|
|
8
|
+
color: transparent;
|
|
9
|
+
pointer-events: none;
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
border: 0;
|
|
13
|
+
outline: 0;
|
|
14
|
+
background: transparent;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
user-select: none;
|
|
17
|
+
-webkit-user-select: none;
|
|
18
|
+
-moz-user-select: none;
|
|
19
|
+
-ms-user-select: none;
|
|
20
|
+
`,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${ep}px`,e.style.height=`${ep}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=rp.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),t.interactive?e.tabIndex=t.tabIndex:e.tabIndex=0,this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv)}_dispatchEvent(t,e){const{container:i}=t.target,n=this._renderer.events.rootBoundary,s=Object.assign(new Tr(n),{target:i});n.rootTarget=this._renderer.lastObjectRendered,e.forEach(a=>n.dispatchEvent(s,a))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode!==u2||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){var t;this._deactivate(),this._destroyTouchHook(),(t=this._canvasObserver)==null||t.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(t){t?this._activate():this._deactivate()}_getPool(t){return this._pools[t]||(this._pools[t]=[]),this._pools[t]}};Wa.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"accessibility"},Wa.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};let np=Wa;const sp={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1};N.add(np),N.mixin(dt,sp);class Va{constructor(t){this._attachedDomElements=[],this._renderer=t,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 ja({domElement:this._domElement,renderer:this._renderer})}addRenderable(t,e){this._attachedDomElements.includes(t)||this._attachedDomElements.push(t)}updateRenderable(t){}validateRenderable(t){return!0}postrender(){const t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let e=0;e<t.length;e++){const i=t[e],n=i.element;if(!i.parent||i.globalDisplayStatus<7)n==null||n.remove(),t.splice(e,1),e--;else{this._domElement.contains(n)||(n.style.position="absolute",n.style.pointerEvents="auto",this._domElement.appendChild(n));const s=i.worldTransform,a=i._anchor,o=i.width*a.x,l=i.height*a.y;n.style.transformOrigin=`${o}px ${l}px`,n.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.tx-o}, ${s.ty-l})`,n.style.opacity=i.groupAlpha.toString()}}}destroy(){var t;this._renderer.runners.postrender.remove(this);for(let e=0;e<this._attachedDomElements.length;e++)(t=this._attachedDomElements[e].element)==null||t.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._canvasObserver.destroy(),this._renderer=null}}Va.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"dom"};class Se extends dt{constructor(t){var e;super(t),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 Mt(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=(e=t.autoGarbageCollect)!=null?e:!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:i,y:n}=t;return i>=e.minX&&i<=e.maxX&&n>=e.minY&&n<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){const{renderPipes:n}=e;n.blendMode.pushBlendMode(this,this.groupBlendMode,t);const s=n[this.renderPipeId];s!=null&&s.addRenderable&&s.addRenderable(this,t),this.didViewUpdate=!1;const a=this.children,o=a.length;for(let l=0;l<o;l++)a[l].collectRenderables(t,e,i);n.blendMode.popBlendMode(t)}}var m2=Object.defineProperty,vn=Object.getOwnPropertySymbols,ap=Object.prototype.hasOwnProperty,op=Object.prototype.propertyIsEnumerable,lp=(r,t,e)=>t in r?m2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,g2=(r,t)=>{for(var e in t||(t={}))ap.call(t,e)&&lp(r,e,t[e]);if(vn)for(var e of vn(t))op.call(t,e)&&lp(r,e,t[e]);return r},_2=(r,t)=>{var e={};for(var i in r)ap.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&vn)for(var i of vn(r))t.indexOf(i)<0&&op.call(r,i)&&(e[i]=r[i]);return e};class y2 extends Se{constructor(t={}){const e=t,{element:i,anchor:n}=e,s=_2(e,["element","anchor"]);super(g2({label:"DOMContainer"},s)),this.renderPipeId="dom",this.batched=!1,this._anchor=new lt(0,0),n&&(this.anchor=n),this.element=t.element||document.createElement("div")}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set element(t){this._element!==t&&(this._element=t,this.onViewUpdate())}get element(){return this._element}updateBounds(){const t=this._bounds,e=this._element;if(!e){t.minX=0,t.minY=0,t.maxX=0,t.maxY=0;return}const{offsetWidth:i,offsetHeight:n}=e;t.minX=0,t.maxX=i,t.minY=0,t.maxY=n}destroy(t=!1){var e,i;super.destroy(t),(i=(e=this._element)==null?void 0:e.parentNode)==null||i.removeChild(this._element),this._element=null,this._anchor=null}}N.add(Va);let b2=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(Ot.system.add(this._tickerUpdate,this,Te.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Ot.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}):new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY}))}_tickerUpdate(t){this._deltaTime+=t.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}};const we=new b2;class hi extends Tr{constructor(){super(...arguments),this.client=new lt,this.movement=new lt,this.offset=new lt,this.global=new lt,this.screen=new lt}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(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,n,s,a,o,l,u,c,h,p,f,m,g){throw new Error("Method not implemented.")}}class ae extends hi{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class rr extends hi{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}rr.DOM_DELTA_PIXEL=0,rr.DOM_DELTA_LINE=1,rr.DOM_DELTA_PAGE=2;const v2=2048,x2=new lt,di=new lt;class up{constructor(t){this.dispatch=new Nt,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,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.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)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,n)=>i.priority-n.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,n=e.length;i<n;i++)e[i].fn(t)}hitTest(t,e){we.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[i](this.rootTarget,this.rootTarget.eventMode,x2.set(t,e),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let n=0,s=i.length-1;n<s;n++)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let n=i.length-2;n>=0;n--)if(t.currentTarget=i[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const n=Array.isArray(e)?e:[e];for(let s=i.length-1;s>=0;s--)n.forEach(a=>{t.currentTarget=i[s],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let i=0;i<v2&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,n,s,a=!1){let o=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(we.pauseUpdate=!1),t.interactiveChildren&&t.children){const c=t.children;for(let h=c.length-1;h>=0;h--){const p=c[h],f=this.hitTestMoveRecursive(p,this._isInteractive(e)?e:p.eventMode,i,n,s,a||s(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const l=this._isInteractive(e),u=t.isInteractive();return u&&u&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:l&&!s(t,i)&&n(t,i)?u?[t]:[]:null}hitTestRecursive(t,e,i,n,s){if(this._interactivePrune(t)||s(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(we.pauseUpdate=!1),t.interactiveChildren&&t.children){const l=t.children,u=i;for(let c=l.length-1;c>=0;c--){const h=l[c],p=this.hitTestRecursive(h,this._isInteractive(e)?e:h.eventMode,u,n,s);if(p){if(p.length>0&&!p[p.length-1].parent)continue;const f=t.isInteractive();return(p.length>0||f)&&p.push(t),p}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&n(t,i)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,di),!t.hitArea.contains(di.x,di.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i<t.effects.length;i++){const n=t.effects[i];if(n.containsPoint&&!n.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t!=null&&t.containsPoint?(t.worldTransform.applyInverse(e,di),t.containsPoint(di)):!1}notifyTarget(t,e){var i,n;if(!t.currentTarget.isInteractive())return;e!=null||(e=t.type);const s=`on${e}`;(n=(i=t.currentTarget)[s])==null||n.call(i,t);const a=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,a),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof ae))return;const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const n=e.button===2;this.dispatchEvent(e,n?"rightdown":"mousedown")}const i=this.trackingData(t.pointerId);i.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,i,n;if(!(t instanceof ae))return;this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const s=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const a=s.pointerType==="mouse"||s.pointerType==="pen",o=this.trackingData(t.pointerId),l=this.findMountedTarget(o.overTargets);if(((e=o.overTargets)==null?void 0:e.length)>0&&l!==s.target){const h=t.type==="mousemove"?"mouseout":"pointerout",p=this.createPointerEvent(t,h,l);if(this.dispatchEvent(p,"pointerout"),a&&this.dispatchEvent(p,"mouseout"),!s.composedPath().includes(l)){const f=this.createPointerEvent(t,"pointerleave",l);for(f.eventPhase=f.AT_TARGET;f.target&&!s.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),a&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(p)}if(l!==s.target){const h=t.type==="mousemove"?"mouseover":"pointerover",p=this.clonePointerEvent(s,h);this.dispatchEvent(p,"pointerover"),a&&this.dispatchEvent(p,"mouseover");let f=l==null?void 0:l.parent;for(;f&&f!==this.rootTarget.parent&&f!==s.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const m=this.clonePointerEvent(s,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==l&&m.target!==this.rootTarget.parent;)m.currentTarget=m.target,this.notifyTarget(m),a&&this.notifyTarget(m,"mouseenter"),m.target=m.target.parent;this.freeEvent(m)}this.freeEvent(p)}const u=[],c=(i=this.enableGlobalMoveEvents)!=null?i:!0;this.moveOnAll?u.push("pointermove"):this.dispatchEvent(s,"pointermove"),c&&u.push("globalpointermove"),s.pointerType==="touch"&&(this.moveOnAll?u.splice(1,0,"touchmove"):this.dispatchEvent(s,"touchmove"),c&&u.push("globaltouchmove")),a&&(this.moveOnAll?u.splice(1,0,"mousemove"):this.dispatchEvent(s,"mousemove"),c&&u.push("globalmousemove"),this.cursor=(n=s.target)==null?void 0:n.cursor),u.length>0&&this.all(s,u),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=s.composedPath(),this.freeEvent(s)}mapPointerOver(t){var e;if(!(t instanceof ae))return;const i=this.trackingData(t.pointerId),n=this.createPointerEvent(t),s=n.pointerType==="mouse"||n.pointerType==="pen";this.dispatchEvent(n,"pointerover"),s&&this.dispatchEvent(n,"mouseover"),n.pointerType==="mouse"&&(this.cursor=(e=n.target)==null?void 0:e.cursor);const a=this.clonePointerEvent(n,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;i.overTargets=n.composedPath(),this.freeEvent(n),this.freeEvent(a)}mapPointerOut(t){if(!(t instanceof ae))return;const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",n=this.findMountedTarget(e.overTargets),s=this.createPointerEvent(t,"pointerout",n);this.dispatchEvent(s),i&&this.dispatchEvent(s,"mouseout");const a=this.createPointerEvent(t,"pointerleave",n);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),i&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(s),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof ae))return;const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const o=i.button===2;this.dispatchEvent(i,o?"rightup":"mouseup")}const n=this.trackingData(t.pointerId),s=this.findMountedTarget(n.pressTargetsByButton[t.button]);let a=s;if(s&&!i.composedPath().includes(s)){let o=s;for(;o&&!i.composedPath().includes(o);){if(i.currentTarget=o,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}o=o.parent}delete n.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(i,"click");o.target=a,o.path=null,n.clicksByButton[t.button]||(n.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const l=n.clicksByButton[t.button];if(l.target===o.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=o.target,l.timeStamp=e,o.detail=l.clickCount,o.pointerType==="mouse"){const u=o.button===2;this.dispatchEvent(o,u?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof ae))return;const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),n=this.createPointerEvent(t);if(i){let s=i;for(;s;)n.currentTarget=s,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),s=s.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(n)}mapWheel(t){if(!(t instanceof rr))return;const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){var n;const s=this.allocateEvent(ae);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=(n=i!=null?i:this.hitTest(s.global.x,s.global.y))!=null?n:this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){const e=this.allocateEvent(rr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const i=this.allocateEvent(ae);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e!=null?e:i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof ae&&e instanceof ae&&(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)}copyMouseData(t,e){t instanceof hi&&e instanceof hi&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let n=0,s=i.length;n<s&&!t.propagationImmediatelyStopped;n++)i[n].once&&t.currentTarget.removeListener(e,i[n].fn,void 0,!0),i[n].fn.call(i[n].context,t)}}var T2=Object.defineProperty,cp=Object.getOwnPropertySymbols,S2=Object.prototype.hasOwnProperty,w2=Object.prototype.propertyIsEnumerable,hp=(r,t,e)=>t in r?T2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,E2=(r,t)=>{for(var e in t||(t={}))S2.call(t,e)&&hp(r,e,t[e]);if(cp)for(var e of cp(t))w2.call(t,e)&&hp(r,e,t[e]);return r};const P2=1,A2={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ya=class Sh{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new up(null),we.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new ae(null),this._rootWheelEvent=new rr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(E2({},Sh.defaultEventFeatures),{set:(e,i,n)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),e[i]=n,!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.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){var e,i;const{canvas:n,resolution:s}=this.renderer;this.setTargetElement(n),this.resolution=s,Sh._defaultEventMode=(e=t.eventMode)!=null?e:"passive",Object.assign(this.features,(i=t.eventFeatures)!=null?i:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){we.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t||(t="default");let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,n=e.length;i<n;i++){const s=e[i],a=this._bootstrapEvent(this._rootPointerEvent,s);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,we.pointerMoved();const e=this._normalizeToPointerData(t);for(let i=0,n=e.length;i<n;i++){const s=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",n=this._normalizeToPointerData(t);for(let s=0,a=n.length;s<a;s++){const o=this._bootstrapEvent(this._rootPointerEvent,n[s]);o.type+=i,this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this._normalizeToPointerData(t);for(let i=0,n=e.length;i<n;i++){const s=this._bootstrapEvent(this._rootPointerEvent,e[i]);this.rootBoundary.mapEvent(s)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,we.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;we.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.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._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;we.removeTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.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=null,this._eventsAdded=!1}mapPositionToPoint(t,e,i){const n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;t.x=(e-n.left)*(this.domElement.width/n.width)*s,t.y=(i-n.top)*(this.domElement.height/n.height)*s}_normalizeToPointerData(t){var e,i,n,s;const a=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let o=0,l=t.changedTouches.length;o<l;o++){const u=t.changedTouches[o];typeof u.button=="undefined"&&(u.button=0),typeof u.buttons=="undefined"&&(u.buttons=1),typeof u.isPrimary=="undefined"&&(u.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof u.width=="undefined"&&(u.width=u.radiusX||1),typeof u.height=="undefined"&&(u.height=u.radiusY||1),typeof u.tiltX=="undefined"&&(u.tiltX=0),typeof u.tiltY=="undefined"&&(u.tiltY=0),typeof u.pointerType=="undefined"&&(u.pointerType="touch"),typeof u.pointerId=="undefined"&&(u.pointerId=u.identifier||0),typeof u.pressure=="undefined"&&(u.pressure=u.force||.5),typeof u.twist=="undefined"&&(u.twist=0),typeof u.tangentialPressure=="undefined"&&(u.tangentialPressure=0),typeof u.layerX=="undefined"&&(u.layerX=u.offsetX=u.clientX),typeof u.layerY=="undefined"&&(u.layerY=u.offsetY=u.clientY),u.isNormalized=!0,u.type=t.type,(e=u.altKey)!=null||(u.altKey=t.altKey),(i=u.ctrlKey)!=null||(u.ctrlKey=t.ctrlKey),(n=u.metaKey)!=null||(u.metaKey=t.metaKey),(s=u.shiftKey)!=null||(u.shiftKey=t.shiftKey),a.push(u)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){const o=t;typeof o.isPrimary=="undefined"&&(o.isPrimary=!0),typeof o.width=="undefined"&&(o.width=1),typeof o.height=="undefined"&&(o.height=1),typeof o.tiltX=="undefined"&&(o.tiltX=0),typeof o.tiltY=="undefined"&&(o.tiltY=0),typeof o.pointerType=="undefined"&&(o.pointerType="mouse"),typeof o.pointerId=="undefined"&&(o.pointerId=P2),typeof o.pressure=="undefined"&&(o.pressure=.5),typeof o.twist=="undefined"&&(o.twist=0),typeof o.tangentialPressure=="undefined"&&(o.tangentialPressure=0),o.isNormalized=!0,a.push(o)}else a.push(t);return a}normalizeWheelEvent(t){const e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,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,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=A2[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Ya.extension={name:"events",type:[S.WebGLSystem,S.CanvasSystem,S.WebGPUSystem],priority:-1},Ya.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Ka=Ya;const dp={onclick: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 this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){var r;return(r=this._internalEventMode)!=null?r:Ka.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,n=typeof e=="object"?e.signal:void 0,s=typeof e=="object"?e.once===!0:!1,a=typeof t=="function"?void 0:t;r=i?`${r}capture`:r;const o=typeof t=="function"?t:t.handleEvent,l=this;n&&n.addEventListener("abort",()=>{l.off(r,o,a)}),s?l.once(r,o,a):l.on(r,o,a)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,n=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,n)},dispatchEvent(r){if(!(r instanceof Tr))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};N.add(Ka),N.mixin(dt,dp);var te=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(te||{});const pp={createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return(r=document.baseURI)!=null?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};let fp=pp;const H={get(){return fp},set(r){fp=r}};function de(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function pi(r){return r.split("?")[0].split("#")[0]}function C2(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M2(r,t,e){return r.replace(new RegExp(C2(t),"g"),e)}function R2(r,t){let e="",i=0,n=-1,s=0,a=-1;for(let o=0;o<=r.length;++o){if(o<r.length)a=r.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(n===o-1||s===1))if(n!==o-1&&s===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),n=o,s=0;continue}}else if(e.length===2||e.length===1){e="",i=0,n=o,s=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(n+1,o)}`:e=r.slice(n+1,o),i=o-n-1;n=o,s=0}else a===46&&s!==-1?++s:s=-1}return e}const zt={toPosix(r){return M2(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){de(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(de(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=pi(this.toPosix(t!=null?t:H.get().getBaseUrl())),n=pi(this.toPosix(e!=null?e:this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?zt.join(n,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(de(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=R2(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return de(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){var t;if(r.length===0)return".";let e;for(let i=0;i<r.length;++i){const n=r[i];if(de(n),n.length>0)if(e===void 0)e=n;else{const s=(t=r[i-1])!=null?t:"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${n}`:e+=`/${n}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(de(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,n=!0;const s=this.getProtocol(r),a=r;r=r.slice(s.length);for(let o=r.length-1;o>=1;--o)if(t=r.charCodeAt(o),t===47){if(!n){i=o;break}}else n=!1;return i===-1?e?"/":this.isUrl(a)?s+r:s:e&&i===1?"//":s+r.slice(0,i)},rootname(r){de(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){de(r),t&&de(t),r=pi(this.toPosix(r));let e=0,i=-1,n=!0,s;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let a=t.length-1,o=-1;for(s=r.length-1;s>=0;--s){const l=r.charCodeAt(s);if(l===47){if(!n){e=s+1;break}}else o===-1&&(n=!1,o=s+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(i=s):(a=-1,i=o))}return e===i?i=o:i===-1&&(i=r.length),r.slice(e,i)}for(s=r.length-1;s>=0;--s)if(r.charCodeAt(s)===47){if(!n){e=s+1;break}}else i===-1&&(n=!1,i=s+1);return i===-1?"":r.slice(e,i)},extname(r){de(r),r=pi(this.toPosix(r));let t=-1,e=0,i=-1,n=!0,s=0;for(let a=r.length-1;a>=0;--a){const o=r.charCodeAt(a);if(o===47){if(!n){e=a+1;break}continue}i===-1&&(n=!1,i=a+1),o===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||i===-1||s===0||s===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){de(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=pi(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let n;const s="";t.root=this.rootname(r),i||this.hasProtocol(r)?n=1:n=0;let a=-1,o=0,l=-1,u=!0,c=r.length-1,h=0;for(;c>=n;--c){if(e=r.charCodeAt(c),e===47){if(!u){o=c+1;break}continue}l===-1&&(u=!1,l=c+1),e===46?a===-1?a=c:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||l===-1||h===0||h===1&&a===l-1&&a===o+1?l!==-1&&(o===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(o,l)):(o===0&&i?(t.name=r.slice(1,a),t.base=r.slice(1,l)):(t.name=r.slice(o,a),t.base=r.slice(o,l)),t.ext=r.slice(a,l)),t.dir=this.dirname(r),s&&(t.dir=s+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]},oe=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r);function mp(r,t,e,i,n){const s=t[e];for(let a=0;a<s.length;a++){const o=s[a];e<t.length-1?mp(r.replace(i[e],o),t,e+1,i,n):n.push(r.replace(i[e],o))}}function gp(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const n=[];e.forEach(s=>{const a=s.substring(1,s.length-1).split(",");n.push(a)}),mp(r,n,0,e,i)}else i.push(r);return i}const fi=r=>!Array.isArray(r);var O2=Object.defineProperty,G2=Object.defineProperties,I2=Object.getOwnPropertyDescriptors,_p=Object.getOwnPropertySymbols,B2=Object.prototype.hasOwnProperty,F2=Object.prototype.propertyIsEnumerable,yp=(r,t,e)=>t in r?O2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ir=(r,t)=>{for(var e in t||(t={}))B2.call(t,e)&&yp(r,e,t[e]);if(_p)for(var e of _p(t))F2.call(t,e)&&yp(r,e,t[e]);return r},D2=(r,t)=>G2(r,I2(t));class $e{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${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(t){var e,i,n;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(i=t.createBundleAssetId)!=null?i:this._createBundleAssetId,this._extractAssetIdFromBundle=(n=t.extractAssetIdFromBundle)!=null?n:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}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(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return oe(e||i,n=>typeof n=="string"?n:Array.isArray(n)?n.map(s=>{var a;return(a=s==null?void 0:s.src)!=null?a:s}):n!=null&&n.src?n.src:n,!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let n=e;Array.isArray(e)||(n=Object.entries(e).map(([s,a])=>typeof a=="string"||Array.isArray(a)?{alias:s,src:a}:ir({alias:s},a))),n.forEach(s=>{const a=s.src,o=s.alias;let l;if(typeof o=="string"){const u=this._createBundleAssetId(t,o);i.push(u),l=[o,u]}else{const u=o.map(c=>this._createBundleAssetId(t,c));i.push(...u),l=[...o,...u]}this.add(D2(ir({},s),{alias:l,src:a}))}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;oe(e).forEach(n=>{const{src:s}=n;let{data:a,format:o,loadParser:l,parser:u}=n;const c=oe(s).map(m=>typeof m=="string"?gp(m):Array.isArray(m)?m:[m]),h=this.getAlias(n),p=[],f=m=>{const g=this._parsers.find(_=>_.test(m));return ir({src:m},g==null?void 0:g.parse(m))};c.forEach(m=>{m.forEach(g=>{var _,y,b,x;let v={};if(typeof g!="object"?v=f(g):(a=(_=g.data)!=null?_:a,o=(y=g.format)!=null?y:o,(g.loadParser||g.parser)&&(l=(b=g.loadParser)!=null?b:l,u=(x=g.parser)!=null?x:u),v=ir(ir({},f(g.src)),g)),!h)throw new Error(`[Resolver] alias is undefined for this asset: ${v.src}`);v=this._buildResolvedAsset(v,{aliases:h,data:a,format:o,loadParser:l,parser:u,progressSize:n.progressSize}),p.push(v)})}),h.forEach(m=>{this._assetMap[m]=p})})}resolveBundle(t){const e=fi(t);t=oe(t);const i={};return t.forEach(n=>{const s=this._bundles[n];if(s){const a=this.resolve(s),o={};for(const l in a){const u=a[l];o[this._extractAssetIdFromBundle(n,l)]=u}i[n]=o}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const n in e)i[n]=e[n].src;return i}return e.src}resolve(t){const e=fi(t);t=oe(t);const i={};return t.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let s=this._assetMap[n];const a=this._getPreferredOrder(s);a==null||a.priority.forEach(o=>{a.params[o].forEach(l=>{const u=s.filter(c=>c[o]?c[o]===l:!1);u.length&&(s=u)})}),this._resolverHash[n]=s[0]}else this._resolverHash[n]=this._buildResolvedAsset({alias:[n],src:n},{});i[n]=this._resolverHash[n]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[e],n=this._preferredOrder.find(s=>s.params.format.includes(i.format));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){var i,n;const{aliases:s,data:a,loadParser:o,parser:l,format:u,progressSize:c}=e;return(this._basePath||this._rootPath)&&(t.src=zt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(i=s!=null?s:t.alias)!=null?i:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=ir(ir({},a||{}),t.data),t.loadParser=o!=null?o:t.loadParser,t.parser=l!=null?l:t.parser,t.format=(n=u!=null?u:t.format)!=null?n:bp(t.src),c!==void 0&&(t.progressSize=c),t}}$e.RETINA_PREFIX=/@([0-9\.]+)x/;function bp(r){return r.split(".").pop().split("?").shift().split("#").shift()}const xn=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r},vp=class nn{constructor(t,e){this.linkedSheets=[];let i=t;(t==null?void 0:t.source)instanceof ft&&(i={texture:t,data:e});const{texture:n,data:s,cachePrefix:a=""}=i;this.cachePrefix=a,this._texture=n instanceof D?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<=nn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,e=!1){let i=t;const n=e?1/0:nn.BATCH_SIZE;for(;i-t<n&&i<this._frameKeys.length;){const s=this._frameKeys[i],a=this._frames[s],o=a.frame;if(o){let l=null,u=null;const c=a.trimmed!==!1&&a.sourceSize?a.sourceSize:a.frame,h=new ut(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);a.rotated?l=new ut(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):l=new ut(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),a.trimmed!==!1&&a.spriteSourceSize&&(u=new ut(Math.floor(a.spriteSourceSize.x)/this.resolution,Math.floor(a.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[s]=new D({source:this.textureSource,frame:l,orig:h,trim:u,rotate:a.rotated?2:0,defaultAnchor:a.anchor,defaultBorders:a.borders,label:s.toString()})}i++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const n=t[e][i];this.animations[e].push(this.textures[n])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*nn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*nn.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};vp.BATCH_SIZE=1e3;let qa=vp;const U2=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function xp(r,t,e){const i={};if(r.forEach(n=>{i[n]=t}),Object.keys(t.textures).forEach(n=>{i[`${t.cachePrefix}${n}`]=t.textures[n]}),!e){const n=zt.dirname(r[0]);t.linkedSheets.forEach((s,a)=>{const o=xp([`${n}/${t.data.meta.related_multi_packs[a]}`],s,!0);Object.assign(i,o)})}return i}const Tp={extension:S.Asset,cache:{test:r=>r instanceof qa,getCacheableAssets:(r,t)=>xp(r,t,!1)},resolver:{extension:{type:S.ResolveParser,name:"resolveSpritesheet"},test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&U2.includes(i)},parse:r=>{var t,e;const i=r.split(".");return{resolution:parseFloat((e=(t=$e.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i[i.length-2],src:r}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:S.LoadParser,priority:te.Normal,name:"spritesheetLoader"},async testParse(r,t){return zt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var i,n,s;const{texture:a,imageFilename:o,textureOptions:l,cachePrefix:u}=(i=t==null?void 0:t.data)!=null?i:{};let c=zt.dirname(t.src);c&&c.lastIndexOf("/")!==c.length-1&&(c+="/");let h;if(a instanceof D)h=a;else{const m=xn(c+(o!=null?o:r.meta.image),t.src);h=(await e.load([{src:m,data:l}]))[m]}const p=new qa({texture:h.source,data:r,cachePrefix:u});await p.parse();const f=(n=r==null?void 0:r.meta)==null?void 0:n.related_multi_packs;if(Array.isArray(f)){const m=[];for(const _ of f){if(typeof _!="string")continue;let y=c+_;(s=t.data)!=null&&s.ignoreMultiPack||(y=xn(y,t.src),m.push(e.load({src:y,data:{textureOptions:l,ignoreMultiPack:!0}})))}const g=await Promise.all(m);p.linkedSheets=g,g.forEach(_=>{_.linkedSheets=[p].concat(p.linkedSheets.filter(y=>y!==_))})}return p},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};N.add(Tp);function Za(r,t,e){const{width:i,height:n}=e.orig,s=e.trim;if(s){const a=s.width,o=s.height;r.minX=s.x-t._x*i,r.maxX=r.minX+a,r.minY=s.y-t._y*n,r.maxY=r.minY+o}else r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*n,r.maxY=r.minY+n}var $2=Object.defineProperty,Tn=Object.getOwnPropertySymbols,Sp=Object.prototype.hasOwnProperty,wp=Object.prototype.propertyIsEnumerable,Ep=(r,t,e)=>t in r?$2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,k2=(r,t)=>{for(var e in t||(t={}))Sp.call(t,e)&&Ep(r,e,t[e]);if(Tn)for(var e of Tn(t))wp.call(t,e)&&Ep(r,e,t[e]);return r},L2=(r,t)=>{var e={};for(var i in r)Sp.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Tn)for(var i of Tn(r))t.indexOf(i)<0&&wp.call(r,i)&&(e[i]=r[i]);return e};class pe extends Se{constructor(t=D.EMPTY){t instanceof D&&(t={texture:t});const e=t,{texture:i=D.EMPTY,anchor:n,roundPixels:s,width:a,height:o}=e,l=L2(e,["texture","anchor","roundPixels","width","height"]);super(k2({label:"Sprite"},l)),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new bt({_onUpdate:()=>{this.onViewUpdate()}}),n?this.anchor=n:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=s!=null?s:!1,a!==void 0&&(this.width=a),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof D?new pe(t):new pe(D.from(t,e))}set texture(t){t||(t=D.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,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 Za(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:n,height:s}=e.orig;i.minX=-t._x*n,i.maxX=i.minX+n,i.minY=-t._y*s,i.maxY=i.minY+s}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){var i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const N2=new Mt;function Sn(r,t,e){const i=N2;r.measurable=!0,li(r,e,i),t.addBoundsMask(i),r.measurable=!1}function wn(r,t,e){const i=ve.get();r.measurable=!0;const n=Dt.get().identity(),s=Pp(r,e,n);hn(r,i,s),r.measurable=!1,t.addBoundsMask(i),Dt.return(n),ve.return(i)}function Pp(r,t,e){return r&&r!==t&&(Pp(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e}class Qa{constructor(t){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof pe),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||Sn(this.mask,t,e)}addLocalBounds(t,e){wn(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof pe}}Qa.extension=S.MaskEffect;class Ja{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Ja.extension=S.MaskEffect;class to{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){Sn(this.mask,t,e)}addLocalBounds(t,e){wn(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof dt}}to.extension=S.MaskEffect;class fe extends ft{constructor(t){t.resource||(t.resource=H.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.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(t=this.width,e=this.height,i=this._resolution){const n=super.resize(t,e,i);return n&&this.resizeCanvas(),n}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}fe.extension=S.TextureSource;class ke extends ft{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}ke.extension=S.TextureSource;let eo;async function ro(){return eo!=null||(eo=(async()=>{var r;const t=H.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const n=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const s=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,s),t.deleteFramebuffer(n),t.deleteTexture(i),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),s[0]<=s[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),eo}var X2=Object.defineProperty,j2=Object.defineProperties,H2=Object.getOwnPropertyDescriptors,Ap=Object.getOwnPropertySymbols,z2=Object.prototype.hasOwnProperty,W2=Object.prototype.propertyIsEnumerable,Cp=(r,t,e)=>t in r?X2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,io=(r,t)=>{for(var e in t||(t={}))z2.call(t,e)&&Cp(r,e,t[e]);if(Ap)for(var e of Ap(t))W2.call(t,e)&&Cp(r,e,t[e]);return r},V2=(r,t)=>j2(r,H2(t));const En=class O1 extends ft{constructor(t){var e;super(t),this.isReady=!1,this.uploadMethodId="video",t=io(io({},O1.defaultOptions),t),this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=(e=t.alphaMode)!=null?e:"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),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=Ot.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!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 t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.isValid||t.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await ro(),this._load=new Promise((i,n)=>{this.isValid?i(this):(this._resolve=i,this._reject=n,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.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 t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.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 t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("loadedmetadata",this._onLoadedMetadata),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ot.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ot.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ot.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};En.extension=S.TextureSource,En.defaultOptions=V2(io({},ft.defaultOptions),{autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1}),En.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let wr=En,Y2=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const i=oe(t);let n;for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];if(u.test(e)){n=u.getCacheableAssets(i,e);break}}const s=new Map(Object.entries(n||{}));n||i.forEach(l=>{s.set(l,e)});const a=[...s.keys()],o={cacheKeys:a,keys:i};i.forEach(l=>{this._cacheMap.set(l,o)}),a.forEach(l=>{const u=n?n[l]:e;this._cache.has(l)&&this._cache.get(l),this._cache.set(l,s.get(l))})}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}};const it=new Y2,no=[];N.handleByList(S.TextureSource,no);function K2(r={}){return so(r)}function so(r={}){const t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let n=0;n<no.length;n++){const s=no[n];if(s.test(e))return new s(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function Mp(r={},t=!1){const e=r&&r.resource,i=e?r.resource:r,n=e?r:{resource:r};if(!t&&it.has(i))return it.get(i);const s=new D({source:so(n)});return s.on("destroy",()=>{it.has(i)&&it.remove(i)}),t||it.set(i,s),s}function Rp(r,t=!1){return typeof r=="string"?it.get(r):r instanceof ft?new D({source:r}):Mp(r,t)}D.from=Rp,ft.from=so,N.add(Qa,Ja,to,wr,ke,fe,fn);let Er;function Op(r){const t=H.get().createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=r,e.fillRect(0,0,6,1),t}function ao(){if(Er!==void 0)return Er;try{const r=Op("#ff00ff"),t=Op("#ffff00"),e=H.get().createCanvas(6,1).getContext("2d");e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0);const i=e.getImageData(2,0,1,1);if(!i)Er=!1;else{const n=i.data;Er=n[0]===255&&n[1]===0&&n[2]===0}}catch(r){Er=!1}return Er}const Q={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:ao(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:r=>{var t,e;const i=r.source,n=i==null?void 0:i.resource;if(!n)return null;const s=i.alphaMode==="premultiplied-alpha",a=(t=i.resourceWidth)!=null?t:i.pixelWidth,o=(e=i.resourceHeight)!=null?e:i.pixelHeight,l=a!==i.pixelWidth||o!==i.pixelHeight;if(s){if((n instanceof HTMLCanvasElement||typeof OffscreenCanvas!="undefined"&&n instanceof OffscreenCanvas)&&!l)return n;const u=Q._unpremultipliedCache.get(i);if((u==null?void 0:u.resourceId)===i._resourceId)return u.canvas}if(n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Uint32Array||n instanceof Int32Array||n instanceof Float32Array||n instanceof ArrayBuffer){const u=Q._canvasSourceCache.get(i);if((u==null?void 0:u.resourceId)===i._resourceId)return u.canvas;const c=H.get().createCanvas(i.pixelWidth,i.pixelHeight),h=c.getContext("2d"),p=h.createImageData(i.pixelWidth,i.pixelHeight),f=p.data,m=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(i.format==="bgra8unorm")for(let g=0;g<f.length&&g+3<m.length;g+=4)f[g]=m[g+2],f[g+1]=m[g+1],f[g+2]=m[g],f[g+3]=m[g+3];else f.set(m.subarray(0,f.length));return h.putImageData(p,0,0),Q._canvasSourceCache.set(i,{canvas:c,resourceId:i._resourceId}),c}if(s){const u=H.get().createCanvas(i.pixelWidth,i.pixelHeight),c=u.getContext("2d",{willReadFrequently:!0});u.width=i.pixelWidth,u.height=i.pixelHeight,c.drawImage(n,0,0);const h=c.getImageData(0,0,u.width,u.height),p=h.data;for(let f=0;f<p.length;f+=4){const m=p[f+3];if(m>0){const g=255/m;p[f]=Math.min(255,p[f]*g+.5),p[f+1]=Math.min(255,p[f+1]*g+.5),p[f+2]=Math.min(255,p[f+2]*g+.5)}}return c.putImageData(h,0,0),Q._unpremultipliedCache.set(i,{canvas:u,resourceId:i._resourceId}),u}if(l){const u=Q._canvasSourceCache.get(i);if((u==null?void 0:u.resourceId)===i._resourceId)return u.canvas;const c=H.get().createCanvas(i.pixelWidth,i.pixelHeight),h=c.getContext("2d");return c.width=i.pixelWidth,c.height=i.pixelHeight,h.drawImage(n,0,0),Q._canvasSourceCache.set(i,{canvas:c,resourceId:i._resourceId}),c}return n},getTintedCanvas:(r,t)=>{const e=r.texture,i=tt.shared.setValue(t).toHex(),n=e.tintCache||(e.tintCache={}),s=n[i],a=e.source._resourceId;if((s==null?void 0:s.tintId)===a)return s;const o=s&&"getContext"in s?s:H.get().createCanvas();if(Q.tintMethod(e,t,o),o.tintId=a,Q.convertTintToImage&&o.toDataURL!==void 0){const l=H.get().createImage();l.src=o.toDataURL(),l.tintId=a,n[i]=l}else n[i]=o;return n[i]},getTintedPattern:(r,t)=>{const e=tt.shared.setValue(t).toHex(),i=r.patternCache||(r.patternCache={}),n=r.source._resourceId;let s=i[e];return(s==null?void 0:s.tintId)===n||(Q.canvas||(Q.canvas=H.get().createCanvas()),Q.tintMethod(r,t,Q.canvas),s=Q.canvas.getContext("2d").createPattern(Q.canvas,"repeat"),s.tintId=n,i[e]=s),s},applyPatternTransform:(r,t,e=!0)=>{if(!t)return;const i=r;if(!i.setTransform)return;const n=globalThis.DOMMatrix;if(!n)return;const s=new n([t.a,t.b,t.c,t.d,t.tx,t.ty]);i.setTransform(e?s.inverse():s)},tintWithMultiply:(r,t,e)=>{var i,n;const s=e.getContext("2d"),a=r.frame.clone(),o=(n=(i=r.source._resolution)!=null?i:r.source.resolution)!=null?n:1,l=r.rotate;a.x*=o,a.y*=o,a.width*=o,a.height*=o;const u=W.isVertical(l),c=u?a.height:a.width,h=u?a.width:a.height;e.width=Math.ceil(c),e.height=Math.ceil(h),s.save(),s.fillStyle=tt.shared.setValue(t).toHex(),s.fillRect(0,0,c,h),s.globalCompositeOperation="multiply";const p=Q.getCanvasSource(r);if(!p){s.restore();return}l&&Q._applyInverseRotation(s,l,a.width,a.height),s.drawImage(p,a.x,a.y,a.width,a.height,0,0,a.width,a.height),s.globalCompositeOperation="destination-atop",s.drawImage(p,a.x,a.y,a.width,a.height,0,0,a.width,a.height),s.restore()},tintWithOverlay:(r,t,e)=>{var i,n;const s=e.getContext("2d"),a=r.frame.clone(),o=(n=(i=r.source._resolution)!=null?i:r.source.resolution)!=null?n:1,l=r.rotate;a.x*=o,a.y*=o,a.width*=o,a.height*=o;const u=W.isVertical(l),c=u?a.height:a.width,h=u?a.width:a.height;e.width=Math.ceil(c),e.height=Math.ceil(h),s.save(),s.globalCompositeOperation="copy",s.fillStyle=tt.shared.setValue(t).toHex(),s.fillRect(0,0,c,h),s.globalCompositeOperation="destination-atop";const p=Q.getCanvasSource(r);if(!p){s.restore();return}l&&Q._applyInverseRotation(s,l,a.width,a.height),s.drawImage(p,a.x,a.y,a.width,a.height,0,0,a.width,a.height),s.restore()},tintWithPerPixel:(r,t,e)=>{var i,n;const s=e.getContext("2d"),a=r.frame.clone(),o=(n=(i=r.source._resolution)!=null?i:r.source.resolution)!=null?n:1,l=r.rotate;a.x*=o,a.y*=o,a.width*=o,a.height*=o;const u=W.isVertical(l),c=u?a.height:a.width,h=u?a.width:a.height;e.width=Math.ceil(c),e.height=Math.ceil(h),s.save(),s.globalCompositeOperation="copy";const p=Q.getCanvasSource(r);if(!p){s.restore();return}l&&Q._applyInverseRotation(s,l,a.width,a.height),s.drawImage(p,a.x,a.y,a.width,a.height,0,0,a.width,a.height),s.restore();const f=t>>16&255,m=t>>8&255,g=t&255,_=s.getImageData(0,0,c,h),y=_.data;for(let b=0;b<y.length;b+=4)y[b]=y[b]*f/255,y[b+1]=y[b+1]*m/255,y[b+2]=y[b+2]*g/255;s.putImageData(_,0,0)},_applyInverseRotation:(r,t,e,i)=>{const n=W.inv(t),s=W.uX(n),a=W.uY(n),o=W.vX(n),l=W.vY(n),u=-Math.min(0,s*e,o*i,s*e+o*i),c=-Math.min(0,a*e,l*i,a*e+l*i);r.transform(s,a,o,l,u,c)}};Q.tintMethod=Q.canUseMultiply?Q.tintWithMultiply:Q.tintWithPerPixel;class Gp{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=H.get().createCanvas();i.width=t,i.height=e;const n=i.getContext("2d");return{canvas:i,context:n}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=Ze(t),e=Ze(e);const n=(t<<17)+(e<<1);this._canvasPool[n]||(this._canvasPool[n]=[]);let s=this._canvasPool[n].pop();return s||(s=this._createCanvasAndContext(t,e)),s}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:n}=e,s=(i<<17)+(n<<1);t.context.resetTransform(),t.context.clearRect(0,0,i,n),this._canvasPool[s].push(t)}clear(){this._canvasPool={}}}const me=new Gp;qe.register(me);function mi(r,t,e,i,n,s){const a=r-e,o=t-i,l=n-e,u=s-i,c=a*l+o*u,h=l*l+u*u;let p=-1;h!==0&&(p=c/h);let f,m;p<0?(f=e,m=i):p>1?(f=n,m=s):(f=e+p*l,m=i+p*u);const g=r-f,_=t-m;return g*g+_*_}function oo(r,t,e,i,n,s,a,o){const l=a-e,u=o-i,c=n-e,h=s-i,p=r-e,f=t-i,m=l*l+u*u,g=l*c+u*h,_=l*p+u*f,y=c*c+h*h,b=c*p+h*f,x=1/(m*y-g*g),v=(y*_-g*b)*x,w=(m*b-g*_)*x;return v>=0&&w>=0&&v+w<1}class Pn{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new Pn(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let n=this.x-t,s=this.y-e;return n*=n,s*=s,n+s<=i}strokeContains(t,e,i,n=.5){if(this.radius===0)return!1;const s=this.x-t,a=this.y-e,o=this.radius,l=(1-n)*i,u=Math.sqrt(s*s+a*a);return u<=o+l&&u>o-(i-l)}getBounds(t){return t||(t=new ut),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}}class An{constructor(t=0,e=0,i=0,n=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=n}clone(){return new An(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,n=(e-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(t,e,i,n=.5){const{halfWidth:s,halfHeight:a}=this;if(s<=0||a<=0)return!1;const o=i*(1-n),l=i-o,u=s-l,c=a-l,h=s+o,p=a+o,f=t-this.x,m=e-this.y,g=f*f/(u*u)+m*m/(c*c),_=f*f/(h*h)+m*m/(p*p);return g>1&&_<=1}getBounds(t){return t||(t=new ut),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}}let q2,Z2;class Pr{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let n=0,s=e.length;n<s;n++)i.push(e[n].x,e[n].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,i=e.length;for(let n=0;n<i;n+=2){const s=e[n],a=e[n+1],o=e[(n+2)%i],l=e[(n+3)%i];t+=(o-s)*(l+a)}return t<0}containsPolygon(t){const e=this.getBounds(q2),i=t.getBounds(Z2);if(!e.containsRect(i))return!1;const n=t.points;for(let s=0;s<n.length;s+=2){const a=n[s],o=n[s+1];if(!this.contains(a,o))return!1}return!0}clone(){const t=this.points.slice(),e=new Pr(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const n=this.points.length/2;for(let s=0,a=n-1;s<n;a=s++){const o=this.points[s*2],l=this.points[s*2+1],u=this.points[a*2],c=this.points[a*2+1];l>e!=c>e&&t<(u-o)*((e-l)/(c-l))+o&&(i=!i)}return i}strokeContains(t,e,i,n=.5){const s=i*i,a=s*(1-n),o=s-a,{points:l}=this,u=l.length-(this.closePath?0:2);for(let c=0;c<u;c+=2){const h=l[c],p=l[c+1],f=l[(c+2)%l.length],m=l[(c+3)%l.length],g=mi(t,e,h,p,f,m),_=Math.sign((f-h)*(e-p)-(m-p)*(t-h));if(g<=(_<0?o:a))return!0}return!1}getBounds(t){t||(t=new ut);const e=this.points;let i=1/0,n=-1/0,s=1/0,a=-1/0;for(let o=0,l=e.length;o<l;o+=2){const u=e[o],c=e[o+1];i=u<i?u:i,n=u>n?u:n,s=c<s?c:s,a=c>a?c:a}return t.x=i,t.width=n-i,t.y=s,t.height=a-s,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const Cn=(r,t,e,i,n,s,a)=>{const o=r-e,l=t-i,u=Math.sqrt(o*o+l*l);return u>=n-s&&u<=n+a};class Mn{constructor(t=0,e=0,i=0,n=0,s=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=n,this.radius=s}getBounds(t){return t||(t=new ut),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Mn(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let n=t-(this.x+i),s=e-(this.y+i);const a=i*i;if(n*n+s*s<=a||(n=t-(this.x+this.width-i),n*n+s*s<=a)||(s=e-(this.y+this.height-i),n*n+s*s<=a)||(n=t-(this.x+i),n*n+s*s<=a))return!0}return!1}strokeContains(t,e,i,n=.5){const{x:s,y:a,width:o,height:l,radius:u}=this,c=i*(1-n),h=i-c,p=s+u,f=a+u,m=o-u*2,g=l-u*2,_=s+o,y=a+l;return(t>=s-c&&t<=s+h||t>=_-h&&t<=_+c)&&e>=f&&e<=f+g||(e>=a-c&&e<=a+h||e>=y-h&&e<=y+c)&&t>=p&&t<=p+m?!0:t<p&&e<f&&Cn(t,e,p,f,u,h,c)||t>_-u&&e<f&&Cn(t,e,_-u,f,u,h,c)||t>_-u&&e>y-u&&Cn(t,e,_-u,y-u,u,h,c)||t<p&&e>y-u&&Cn(t,e,p,y-u,u,h,c)}}class lo{constructor(t=0,e=0,i=0,n=0,s=0,a=0){this.type="triangle",this.x=t,this.y=e,this.x2=i,this.y2=n,this.x3=s,this.y3=a}contains(t,e){const i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),n=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=n<0&&i!==0&&n!==0)return!1;const s=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return s===0||s<0==i+n<=0}strokeContains(t,e,i,n=.5){const s=i/2,a=s*s,{x:o,x2:l,x3:u,y:c,y2:h,y3:p}=this;return mi(t,e,o,c,l,p)<=a||mi(t,e,l,h,u,p)<=a||mi(t,e,u,p,o,c)<=a}clone(){return new lo(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t||(t=new ut);const e=Math.min(this.x,this.x2,this.x3),i=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 t.x=e,t.y=n,t.width=i-e,t.height=s-n,t}}const Ip=new U;function uo(r,t){var e;t.clear();const i=t.matrix;for(let n=0;n<r.length;n++){const s=r[n];if(s.globalDisplayStatus<7)continue;const a=(e=s.renderGroup)!=null?e:s.parentRenderGroup;a!=null&&a.isCachedAsTexture?t.matrix=Ip.copyFrom(a.textureOffsetInverseTransform).append(s.worldTransform):a!=null&&a._parentCacheAsTextureRenderGroup?t.matrix=Ip.copyFrom(a._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(s.groupTransform):t.matrix=s.worldTransform,t.addBounds(s.bounds)}return t.matrix=i,t}const Q2=new Mt;function Rn(r,t,e,i,n=!1){const s=Q2;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;const a=vt.getOptimalTexture(s.width,s.height,i,!1,n);return a.source.uploadMethodId="image",a.source.resource=r,a.source.alphaMode="premultiply-alpha-on-upload",a.frame.width=t/i,a.frame.height=e/i,a.source.emit("update",a.source),a.updateUvs(),a}function co(r){return typeof r.getCanvasFilterString=="function"}let J2=class{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new Mt,this.cssFilterString=""}};class ho{constructor(t){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=t}push(t){const e=this._pushFilterFrame(),i=t.filterEffect.filters;if(e.skip=!1,e.useClip=!1,e.filters=i,e.container=t.container,e.cssFilterString="",i.every(l=>!l.enabled)){e.skip=!0;return}const n=[],s=1;for(const l of i){if(!l.enabled)continue;if(!co(l)){this._warnUnsupportedFilter(l);continue}const u=l.getCanvasFilterString();if(u===null){this._warnUnsupportedFilter(l);continue}u&&n.push(u)}if(n.length===0&&s===1){e.skip=!0;return}e.cssFilterString=n.join(" "),this._calculateFilterArea(t,e.bounds),e.useClip=!!t.filterEffect.filterArea;const a=this.renderer.canvasContext.activeContext,o=a.filter||"none";if(this._savedStates.push({filter:o,alphaMultiplier:this._alphaMultiplier}),e.useClip&&Number.isFinite(e.bounds.width)&&Number.isFinite(e.bounds.height)&&e.bounds.width>0&&e.bounds.height>0){const l=this.renderer.canvasContext.activeResolution||1;a.save(),a.setTransform(1,0,0,1,0,0),a.beginPath(),a.rect(e.bounds.x*l,e.bounds.y*l,e.bounds.width*l,e.bounds.height*l),a.clip()}else e.useClip=!1;s!==1&&(this._alphaMultiplier*=s),e.cssFilterString&&(a.filter=o!=="none"?`${o} ${e.cssFilterString}`:e.cssFilterString)}pop(){const t=this._popFilterFrame();if(t.skip)return;const e=this._savedStates.pop();if(!e)return;const i=this.renderer.canvasContext.activeContext;t.useClip?i.restore():i.filter=e.filter,this._alphaMultiplier=e.alphaMultiplier}generateFilteredTexture({texture:t,filters:e}){var i,n;if(!(e!=null&&e.length)||e.every(x=>!x.enabled))return t;const s=[],a=1;for(const x of e){if(!x.enabled)continue;if(!co(x)){this._warnUnsupportedFilter(x);continue}const v=x.getCanvasFilterString();if(v===null){this._warnUnsupportedFilter(x);continue}v&&s.push(v)}if(s.length===0&&a===1)return t;const o=Q.getCanvasSource(t);if(!o)return t;const l=t.frame,u=(n=(i=t.source._resolution)!=null?i:t.source.resolution)!=null?n:1,c=l.width,h=l.height,p=me.getOptimalCanvasAndContext(c,h,u),{canvas:f,context:m}=p;m.setTransform(1,0,0,1,0,0),m.clearRect(0,0,f.width,f.height),s.length&&(m.filter=s.join(" ")),a!==1&&(m.globalAlpha=a);const g=l.x*u,_=l.y*u,y=c*u,b=h*u;return m.drawImage(o,g,_,y,b,0,0,y,b),m.filter="none",m.globalAlpha=1,Rn(f,c,h,u)}_calculateFilterArea(t,e){if(t.renderables?uo(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,e),t.container){const i=t.container.renderGroup||t.container.parentRenderGroup,n=i==null?void 0:i.cacheToLocalTransform;n&&e.applyMatrix(n)}}_warnUnsupportedFilter(t){var e;const i=((e=t==null?void 0:t.constructor)==null?void 0:e.name)||"Filter";this._warnedFilterTypes.has(i)||(this._warnedFilterTypes.add(i),console.warn(`CanvasRenderer: filter "${i}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new J2),this._filterStackIndex++,t}_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}}ho.extension={type:[S.CanvasSystem],name:"filter"};class po{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}po.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"filter"};const fo=Object.create(null),Bp=Object.create(null);function Ar(r,t){let e=Bp[r];return e===void 0&&(fo[t]===void 0&&(fo[t]=1),Bp[r]=e=fo[t]++),e}let gi;function mo(){return(!gi||gi!=null&&gi.isContextLost())&&(gi=H.get().createCanvas().getContext("webgl",{})),gi}let On;function Fp(){if(!On){On="mediump";const r=mo();r&&r.getShaderPrecisionFormat&&(On=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return On}function Dp(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
|
|
21
|
+
|
|
22
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
23
|
+
#define in varying
|
|
24
|
+
#define finalColor gl_FragColor
|
|
25
|
+
#define texture texture2D
|
|
26
|
+
#endif
|
|
27
|
+
${r}
|
|
28
|
+
`):`
|
|
29
|
+
|
|
30
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
31
|
+
#define in attribute
|
|
32
|
+
#define out varying
|
|
33
|
+
#endif
|
|
34
|
+
${r}
|
|
35
|
+
`}function Up(r,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let n=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return n==="highp"&&i!=="highp"&&(n="mediump"),`precision ${n} float;
|
|
36
|
+
${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}function $p(r,t){return t?`#version 300 es
|
|
37
|
+
${r}`:r}const tw={},ew={};function kp(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?tw:ew;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
|
|
38
|
+
${r}`}function Lp(r,t){return t?r.replace("#version 300 es",""):r}var rw=Object.defineProperty,Np=Object.getOwnPropertySymbols,iw=Object.prototype.hasOwnProperty,nw=Object.prototype.propertyIsEnumerable,Xp=(r,t,e)=>t in r?rw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jp=(r,t)=>{for(var e in t||(t={}))iw.call(t,e)&&Xp(r,e,t[e]);if(Np)for(var e of Np(t))nw.call(t,e)&&Xp(r,e,t[e]);return r};const go={stripVersion:Lp,ensurePrecision:Up,addProgramDefines:Dp,setProgramName:kp,insertVersion:$p},_i=Object.create(null),Hp=class wh{constructor(t){t=jp(jp({},wh.defaultOptions),t);const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Fp()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let n=t.fragment,s=t.vertex;Object.keys(go).forEach(a=>{const o=i[a];n=go[a](n,o,!0),s=go[a](s,o,!1)}),this.fragment=n,this.vertex=s,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Ar(`${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,_i[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return _i[e]||(_i[e]=new wh(t),_i[e]._cacheKey=e),_i[e]}};Hp.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Wt=Hp;const zp={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 Ie(r){var t;return(t=zp[r])!=null?t:zp.float32}const sw={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"},Wp=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function Vp(r,t){var e;let i;for(;(i=Wp.exec(r))!==null;){const n=(e=sw[i[3]])!=null?e:"float32";t[i[2]]={location:parseInt(i[1],10),format:n,stride:Ie(n).stride,offset:0,instance:!1,start:0}}Wp.lastIndex=0}function aw(r){return r.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Yp({source:r,entryPoint:t}){const e={},i=aw(r),n=i.indexOf(`fn ${t}(`);if(n===-1)return e;const s=i.indexOf("->",n);if(s===-1)return e;const a=i.substring(n,s);if(Vp(a,e),Object.keys(e).length===0){const o=a.match(/\(\s*\w+\s*:\s*(\w+)/);if(o){const l=o[1],u=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),c=i.match(u);c&&Vp(c[1],e)}}return e}function Gn(r){var t,e,i;const n=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,s=/@group\((\d+)\)/,a=/@binding\((\d+)\)/,o=/var(<[^>]+>)? (\w+)/,l=/:\s*([\w<>]+)/,u=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,p=(t=r.match(n))==null?void 0:t.map(m=>({group:parseInt(m.match(s)[1],10),binding:parseInt(m.match(a)[1],10),name:m.match(o)[2],isUniform:m.match(o)[1]==="<uniform>",type:m.match(l)[1]}));if(!p)return{groups:[],structs:[]};const f=(i=(e=r.match(u))==null?void 0:e.map(m=>{const g=m.match(h)[1],_=m.match(c).reduce((y,b)=>{const[x,v]=b.split(":");return y[x.trim()]=v.trim(),y},{});return _?{name:g,members:_}:null}).filter(({name:m})=>p.some(g=>g.type===m||g.type.includes(`<${m}>`))))!=null?i:[];return{groups:p,structs:f}}var Le=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(Le||{});function Kp({groups:r}){const t=[];for(let e=0;e<r.length;e++){const i=r[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:Le.VERTEX|Le.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:Le.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"||i.type.startsWith("texture_2d<")?t[i.group].push({binding:i.binding,visibility:Le.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):i.type==="texture_2d_array"||i.type.startsWith("texture_2d_array<")?t[i.group].push({binding:i.binding,visibility:Le.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(i.type==="texture_cube"||i.type.startsWith("texture_cube<"))&&t[i.group].push({binding:i.binding,visibility:Le.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function qp({groups:r}){const t=[];for(let e=0;e<r.length;e++){const i=r[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function Zp(r,t){const e=new Set,i=new Set,n=[...r.structs,...t.structs].filter(a=>e.has(a.name)?!1:(e.add(a.name),!0)),s=[...r.groups,...t.groups].filter(a=>{const o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:n,groups:s}}const yi=Object.create(null);class Xt{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;var e,i;const{fragment:n,vertex:s,layout:a,gpuLayout:o,name:l}=t;if(this.name=l,this.fragment=n,this.vertex=s,n.source===s.source){const u=Gn(n.source);this.structsAndGroups=u}else{const u=Gn(s.source),c=Gn(n.source);this.structsAndGroups=Zp(u,c)}this.layout=a!=null?a:qp(this.structsAndGroups),this.gpuLayout=o!=null?o:Kp(this.structsAndGroups),this.autoAssignGlobalUniforms=((e=this.layout[0])==null?void 0:e.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((i=this.layout[1])==null?void 0:i.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Ar(i,"program")}get attributeData(){var t;return(t=this._attributeData)!=null||(this._attributeData=Yp(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,yi[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return yi[e]||(yi[e]=new Xt(t),yi[e]._cacheKey=e),yi[e]}}class Ee{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const n=t[i];this.setResource(n,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var i,n;const s=this.resources[e];t!==s&&((i=s==null?void 0:s.off)==null||i.call(s,"change",this.onResourceChange,this),(n=t.on)==null||n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const i=this.resources;for(const n in i)i[n]._gcLastUsed=t,i[n]._touched=e}destroy(){var t;const e=this.resources;for(const i in e){const n=e[i];(t=n==null?void 0:n.off)==null||t.call(n,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var It=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.CANVAS=4]="CANVAS",r[r.BOTH=3]="BOTH",r))(It||{});const _o=["f32","i32","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>"],Qp=_o.reduce((r,t)=>(r[t]=!0,r),{});function Jp(r,t){switch(r){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}var ow=Object.defineProperty,tf=Object.getOwnPropertySymbols,lw=Object.prototype.hasOwnProperty,uw=Object.prototype.propertyIsEnumerable,ef=(r,t,e)=>t in r?ow(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rf=(r,t)=>{for(var e in t||(t={}))lw.call(t,e)&&ef(r,e,t[e]);if(tf)for(var e of tf(t))uw.call(t,e)&&ef(r,e,t[e]);return r};const nf=class G1{constructor(t,e){this._touched=0,this.uid=ht("uniform"),this._resourceType="uniformGroup",this._resourceId=ht("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1;var i,n;e=rf(rf({},G1.defaultOptions),e),this.uniformStructures=t;const s={};for(const a in t){const o=t[a];if(o.name=a,o.size=(i=o.size)!=null?i:1,!Qp[o.type]){const l=o.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(l){const[,u,c]=l;throw new Error(`Uniform type ${o.type} is not supported. Use type: '${u}', size: ${c} instead.`)}throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${_o.join(", ")}`)}(n=o.value)!=null||(o.value=Jp(o.type,o.size)),s[a]=o.value}this.uniforms=s,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Ar(Object.keys(s).map(a=>`${a}-${t[a].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};nf.defaultOptions={ubo:!1,isStatic:!1};let At=nf;var cw=Object.defineProperty,In=Object.getOwnPropertySymbols,sf=Object.prototype.hasOwnProperty,af=Object.prototype.propertyIsEnumerable,of=(r,t,e)=>t in r?cw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hw=(r,t)=>{for(var e in t||(t={}))sf.call(t,e)&&of(r,e,t[e]);if(In)for(var e of In(t))af.call(t,e)&&of(r,e,t[e]);return r},dw=(r,t)=>{var e={};for(var i in r)sf.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&In)for(var i of In(r))t.indexOf(i)<0&&af.call(r,i)&&(e[i]=r[i]);return e};class ee extends Nt{constructor(t){super(),this.uid=ht("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:n,resources:s,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=e,this.glProgram=i,a===void 0&&(a=0,e&&(a|=It.WEBGPU),i&&(a|=It.WEBGL)),this.compatibleRenderers=a;const l={};if(!s&&!n&&(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&n&&o)for(const u in o)for(const c in o[u]){const h=o[u][c];l[h]={group:u,binding:c,name:h}}else if(e&&n&&!o){const u=e.structsAndGroups.groups;o={},u.forEach(c=>{o[c.group]=o[c.group]||{},o[c.group][c.binding]=c.name,l[c.name]=c})}else if(s){n={},o={},e&&e.structsAndGroups.groups.forEach(c=>{o[c.group]=o[c.group]||{},o[c.group][c.binding]=c.name,l[c.name]=c});let u=0;for(const c in s)l[c]||(n[99]||(n[99]=new Ee,this._ownedBindGroups.push(n[99])),l[c]={group:99,binding:u,name:c},o[99]=o[99]||{},o[99][u]=c,u++);for(const c in s){const h=c;let p=s[c];!p.source&&!p._resourceType&&(p=new At(p));const f=l[h];f&&(n[f.group]||(n[f.group]=new Ee,this._ownedBindGroups.push(n[f.group])),n[f.group].setResource(p,f.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,l)}addResource(t,e,i){var n,s;(n=this._uniformBindMap)[e]||(n[e]={}),(s=this._uniformBindMap[e])[i]||(s[i]=t),this.groups[e]||(this.groups[e]=new Ee,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const n in e){const s=e[n];Object.defineProperty(i,s.name,{get(){return t[s.group].getResource(s.binding)},set(a){t[s.group].setResource(a,s.binding)}})}return i}destroy(t=!1){var e,i;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(n=>{n.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const e=t,{gpu:i,gl:n}=e,s=dw(e,["gpu","gl"]);let a,o;return i&&(a=Xt.from(i)),n&&(o=Wt.from(n)),new ee(hw({gpuProgram:a,glProgram:o},s))}}const pw={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},yo=0,bo=1,vo=2,xo=3,To=4,So=5,wo=class I1{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<yo)}set blend(t){!!(this.data&1<<yo)!==t&&(this.data^=1<<yo)}get offsets(){return!!(this.data&1<<bo)}set offsets(t){!!(this.data&1<<bo)!==t&&(this.data^=1<<bo)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<vo)}set culling(t){!!(this.data&1<<vo)!==t&&(this.data^=1<<vo)}get depthTest(){return!!(this.data&1<<xo)}set depthTest(t){!!(this.data&1<<xo)!==t&&(this.data^=1<<xo)}get depthMask(){return!!(this.data&1<<So)}set depthMask(t){!!(this.data&1<<So)!==t&&(this.data^=1<<So)}get clockwiseFrontFace(){return!!(this.data&1<<To)}set clockwiseFrontFace(t){!!(this.data&1<<To)!==t&&(this.data^=1<<To)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=pw[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new I1;return t.depthTest=!1,t.blend=!0,t}};wo.default2d=wo.for2d();let Vt=wo;var fw=Object.defineProperty,Bn=Object.getOwnPropertySymbols,lf=Object.prototype.hasOwnProperty,uf=Object.prototype.propertyIsEnumerable,cf=(r,t,e)=>t in r?fw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Eo=(r,t)=>{for(var e in t||(t={}))lf.call(t,e)&&cf(r,e,t[e]);if(Bn)for(var e of Bn(t))uf.call(t,e)&&cf(r,e,t[e]);return r},mw=(r,t)=>{var e={};for(var i in r)lf.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Bn)for(var i of Bn(r))t.indexOf(i)<0&&uf.call(r,i)&&(e[i]=r[i]);return e};const hf=class Eh extends ee{constructor(t){t=Eo(Eo({},Eh.defaultOptions),t),super(t),this.enabled=!0,this._state=Vt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?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(t,e,i,n){t.applyFilter(this,e,i,n)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const e=t,{gpu:i,gl:n}=e,s=mw(e,["gpu","gl"]);let a,o;return i&&(a=Xt.from(i)),n&&(o=Wt.from(n)),new Eh(Eo({gpuProgram:a,glProgram:o},s))}};hf.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let Pe=hf;var bi=`in vec2 aPosition;
|
|
39
|
+
out vec2 vTextureCoord;
|
|
40
|
+
|
|
41
|
+
uniform vec4 uInputSize;
|
|
42
|
+
uniform vec4 uOutputFrame;
|
|
43
|
+
uniform vec4 uOutputTexture;
|
|
44
|
+
|
|
45
|
+
vec4 filterVertexPosition( void )
|
|
46
|
+
{
|
|
47
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
48
|
+
|
|
49
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
50
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
51
|
+
|
|
52
|
+
return vec4(position, 0.0, 1.0);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
vec2 filterTextureCoord( void )
|
|
56
|
+
{
|
|
57
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
void main(void)
|
|
61
|
+
{
|
|
62
|
+
gl_Position = filterVertexPosition();
|
|
63
|
+
vTextureCoord = filterTextureCoord();
|
|
64
|
+
}
|
|
65
|
+
`,df=`in vec2 vTextureCoord;
|
|
66
|
+
out vec4 finalColor;
|
|
67
|
+
uniform sampler2D uTexture;
|
|
68
|
+
void main() {
|
|
69
|
+
finalColor = texture(uTexture, vTextureCoord);
|
|
70
|
+
}
|
|
71
|
+
`,Po=`struct GlobalFilterUniforms {
|
|
72
|
+
uInputSize: vec4<f32>,
|
|
73
|
+
uInputPixel: vec4<f32>,
|
|
74
|
+
uInputClamp: vec4<f32>,
|
|
75
|
+
uOutputFrame: vec4<f32>,
|
|
76
|
+
uGlobalFrame: vec4<f32>,
|
|
77
|
+
uOutputTexture: vec4<f32>,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
|
|
81
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
82
|
+
@group(0) @binding(2) var uSampler: sampler;
|
|
83
|
+
|
|
84
|
+
struct VSOutput {
|
|
85
|
+
@builtin(position) position: vec4<f32>,
|
|
86
|
+
@location(0) uv: vec2<f32>
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
|
|
90
|
+
{
|
|
91
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
92
|
+
|
|
93
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
94
|
+
position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
95
|
+
|
|
96
|
+
return vec4(position, 0.0, 1.0);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
|
|
100
|
+
{
|
|
101
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@vertex
|
|
105
|
+
fn mainVertex(
|
|
106
|
+
@location(0) aPosition: vec2<f32>,
|
|
107
|
+
) -> VSOutput {
|
|
108
|
+
return VSOutput(
|
|
109
|
+
filterVertexPosition(aPosition),
|
|
110
|
+
filterTextureCoord(aPosition)
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@fragment
|
|
115
|
+
fn mainFragment(
|
|
116
|
+
@location(0) uv: vec2<f32>,
|
|
117
|
+
) -> @location(0) vec4<f32> {
|
|
118
|
+
return textureSample(uTexture, uSampler, uv);
|
|
119
|
+
}
|
|
120
|
+
`;class pf extends Pe{constructor(){const t=Xt.from({vertex:{source:Po,entryPoint:"mainVertex"},fragment:{source:Po,entryPoint:"mainFragment"},name:"passthrough-filter"}),e=Wt.from({vertex:bi,fragment:df,name:"passthrough-filter"});super({gpuProgram:t,glProgram:e})}}var at=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(at||{});class Yt extends Nt{constructor(t){let{data:e,size:i}=t;const{usage:n,label:s,shrinkToFit:a}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=ht("buffer"),this._resourceType="buffer",this._resourceId=ht("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i!=null||(i=e==null?void 0:e.byteLength);const o=!!e;this.descriptor={size:i,usage:n,mappedAtCreation:o,label:s},this.shrinkToFit=a!=null?a:!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&at.STATIC)}set static(t){t?this.descriptor.usage|=at.STATIC:this.descriptor.usage&=~at.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const n=this._data;if(this._data=t,this._dataInt32=null,!n||n.length!==t.length){!this.shrinkToFit&&n&&t.byteLength<n.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ht("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t!=null?t:this._updateSize,this._updateID++,this.emit("update",this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function Ao(r,t){if(!(r instanceof Yt)){let e=t?at.INDEX:at.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=at.INDEX|at.COPY_DST):(r=new Float32Array(r),e=at.VERTEX|at.COPY_DST)),r=new Yt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}function ff(r,t,e){const i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const n=i.buffer.data;let s=1/0,a=1/0,o=-1/0,l=-1/0;const u=n.BYTES_PER_ELEMENT,c=(i.offset||0)/u,h=(i.stride||8)/u;for(let p=c;p<n.length;p+=h){const f=n[p],m=n[p+1];f>o&&(o=f),m>l&&(l=m),f<s&&(s=f),m<a&&(a=m)}return e.minX=s,e.minY=a,e.maxX=o,e.maxY=l,e}function gw(r){return(r instanceof Yt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Ao(r.buffer,!1),r}class nr extends Nt{constructor(t={}){var e;super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=ht("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Mt,this._boundsDirty=!0;const{attributes:i,indexBuffer:n,topology:s}=t;if(this.buffers=[],this.attributes={},i)for(const a in i)this.addAttribute(a,i[a]);this.instanceCount=(e=t.instanceCount)!=null?e:1,n&&this.addIndex(n),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const i=gw(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=Ao(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,ff(this,"aPosition",this._bounds)):this._bounds}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(i=>i.destroy()),this.unload(),(e=this.indexBuffer)==null||e.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const _w=new nr({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])});let yw=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new Mt,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}};class Co{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new At({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 Ee({}),this.renderer=t}get activeBackTexture(){var t;return(t=this._activeFilterData)==null?void 0:t.backTexture}push(t){const e=this.renderer,i=t.filterEffect.filters,n=this._pushFilterData();n.skip=!1,n.filters=i,n.container=t.container,n.outputRenderSurface=e.renderTarget.renderSurface;const s=e.renderTarget.renderTarget.colorTexture.source,a=s.resolution,o=s.antialias;if(i.every(f=>!f.enabled)){n.skip=!0;return}const l=n.bounds;if(this._calculateFilterArea(t,l),this._calculateFilterBounds(n,e.renderTarget.rootViewPort,o,a,1),n.skip)return;const u=this._getPreviousFilterData(),c=this._findFilterResolution(a);let h=0,p=0;u&&(h=u.bounds.minX,p=u.bounds.minY),this._calculateGlobalFrame(n,h,p,c,s.width,s.height),this._setupFilterTextures(n,l,e,u)}generateFilteredTexture({texture:t,filters:e}){const i=this._pushFilterData();this._activeFilterData=i,i.skip=!1,i.filters=e;const n=t.source,s=n.resolution,a=n.antialias;if(e.every(c=>!c.enabled))return i.skip=!0,t;const o=i.bounds;if(o.addRect(t.frame),this._calculateFilterBounds(i,o.rectangle,a,s,0),i.skip)return t;const l=s;this._calculateGlobalFrame(i,0,0,l,n.width,n.height),i.outputRenderSurface=vt.getOptimalTexture(o.width,o.height,i.resolution,i.antialias),i.backTexture=D.EMPTY,i.inputTexture=t,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(i,!0);const u=i.outputRenderSurface;return u.source.alphaMode="premultiplied-alpha",u}pop(){const t=this.renderer,e=this._popFilterData();e.skip||(t.globalUniforms.pop(),t.renderTarget.finishRenderPass(),this._activeFilterData=e,this._applyFiltersToTexture(e,!1),e.blendRequired&&vt.returnTexture(e.backTexture),vt.returnTexture(e.inputTexture))}getBackTexture(t,e,i){const n=t.colorTexture.source._resolution,s=vt.getOptimalTexture(e.width,e.height,n,!1);let a=e.minX,o=e.minY;i&&(a-=i.minX,o-=i.minY),a=Math.floor(a*n),o=Math.floor(o*n);const l=Math.ceil(e.width*n),u=Math.ceil(e.height*n);return this.renderer.renderTarget.copyToTexture(t,s,{x:a,y:o},{width:l,height:u},{x:0,y:0}),s}applyFilter(t,e,i,n){const s=this.renderer,a=this._activeFilterData,o=a.outputRenderSurface===i,l=s.renderTarget.rootRenderTarget.colorTexture.source._resolution,u=this._findFilterResolution(l);let c=0,h=0;if(o){const f=this._findPreviousFilterOffset();c=f.x,h=f.y}this._updateFilterUniforms(e,i,a,c,h,u,o,n);const p=t.enabled?t:this._getPassthroughFilter();this._setupBindGroupsAndRender(p,e,s)}calculateSpriteMatrix(t,e){const i=this._activeFilterData,n=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),s=e.worldTransform.copyTo(U.shared),a=e.renderGroup||e.parentRenderGroup;return a&&a.cacheToLocalTransform&&s.prepend(a.cacheToLocalTransform),s.invert(),n.prepend(s),n.scale(1/e.texture.orig.width,1/e.texture.orig.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){var t;(t=this._passthroughFilter)==null||t.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){var t;return(t=this._passthroughFilter)!=null||(this._passthroughFilter=new pf),this._passthroughFilter}_setupBindGroupsAndRender(t,e,i){if(i.renderPipes.uniformBatch){const n=i.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(n,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,i.encoder.draw({geometry:_w,shader:t,state:t._state,topology:"triangle-list"}),i.type===It.WEBGL&&i.renderTarget.finishRenderPass()}_setupFilterTextures(t,e,i,n){if(t.backTexture=D.EMPTY,t.inputTexture=vt.getOptimalTexture(e.width,e.height,t.resolution,t.antialias),t.blendRequired){i.renderTarget.finishRenderPass();const s=i.renderTarget.getRenderTarget(t.outputRenderSurface);t.backTexture=this.getBackTexture(s,e,n==null?void 0:n.bounds)}i.renderTarget.bind(t.inputTexture,!0),i.globalUniforms.push({offset:e})}_calculateGlobalFrame(t,e,i,n,s,a){const o=t.globalFrame;o.x=e*n,o.y=i*n,o.width=s*n,o.height=a*n}_updateFilterUniforms(t,e,i,n,s,a,o,l){const u=this._filterGlobalUniforms.uniforms,c=u.uOutputFrame,h=u.uInputSize,p=u.uInputPixel,f=u.uInputClamp,m=u.uGlobalFrame,g=u.uOutputTexture;o?(c[0]=i.bounds.minX-n,c[1]=i.bounds.minY-s):(c[0]=0,c[1]=0),c[2]=t.frame.width,c[3]=t.frame.height,h[0]=t.source.width,h[1]=t.source.height,h[2]=1/h[0],h[3]=1/h[1],p[0]=t.source.pixelWidth,p[1]=t.source.pixelHeight,p[2]=1/p[0],p[3]=1/p[1],f[0]=.5*p[2],f[1]=.5*p[3],f[2]=t.frame.width*h[2]-.5*p[2],f[3]=t.frame.height*h[3]-.5*p[3];const _=this.renderer.renderTarget.rootRenderTarget.colorTexture;m[0]=n*a,m[1]=s*a,m[2]=_.source.width*a,m[3]=_.source.height*a,e instanceof D&&(e.source.resource=null);const y=this.renderer.renderTarget.getRenderTarget(e);this.renderer.renderTarget.bind(e,!!l),e instanceof D?(g[0]=e.frame.width,g[1]=e.frame.height):(g[0]=y.width,g[1]=y.height),g[2]=y.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(t){let e=this._filterStackIndex-1;for(;e>0&&this._filterStack[e].skip;)--e;return e>0&&this._filterStack[e].inputTexture?this._filterStack[e].inputTexture.source._resolution:t}_findPreviousFilterOffset(){let t=0,e=0,i=this._filterStackIndex;for(;i>0;){i--;const n=this._filterStack[i];if(!n.skip){t=n.bounds.minX,e=n.bounds.minY;break}}return{x:t,y:e}}_calculateFilterArea(t,e){if(t.renderables?uo(t.renderables,e):t.filterEffect.filterArea?(e.clear(),e.addRect(t.filterEffect.filterArea),e.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,e),t.container){const i=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;i&&e.applyMatrix(i)}}_applyFiltersToTexture(t,e){const i=t.inputTexture,n=t.bounds,s=t.filters,a=t.firstEnabledIndex,o=t.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(t.backTexture.source,3),a===o)s[a].apply(this,i,t.outputRenderSurface,e);else{let l=t.inputTexture;const u=vt.getOptimalTexture(n.width,n.height,l.source._resolution,!1);let c=u;for(let h=a;h<o;h++){const p=s[h];if(!p.enabled)continue;p.apply(this,l,c,!0);const f=l;l=c,c=f}s[o].apply(this,l,t.outputRenderSurface,e),vt.returnTexture(u)}}_calculateFilterBounds(t,e,i,n,s){var a,o;const l=this.renderer,u=t.bounds,c=t.filters;let h=1/0,p=0,f=!0,m=!1,g=!1,_=!0,y=-1,b=-1;for(let x=0;x<c.length;x++){const v=c[x];if(v.enabled){if(y===-1&&(y=x),b=x,h=Math.min(h,v.resolution==="inherit"?n:v.resolution),p+=v.padding,v.antialias==="off"?f=!1:v.antialias==="inherit"&&f&&(f=i),v.clipToViewport||(_=!1),!(v.compatibleRenderers&l.type)){g=!1;break}if(v.blendRequired&&!((o=(a=l.backBuffer)==null?void 0:a.useBackBuffer)==null||o)){g=!1;break}g=!0,m||(m=v.blendRequired)}}if(!g){t.skip=!0;return}if(_&&u.fitBounds(0,e.width/n,0,e.height/n),u.scale(h).ceil().scale(1/h).pad((p|0)*s),!u.isPositive){t.skip=!0;return}t.antialias=f,t.resolution=h,t.blendRequired=m,t.firstEnabledIndex=y,t.lastEnabledIndex=b}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let t,e=this._filterStackIndex-1;for(;e>0&&(e--,t=this._filterStack[e],!!t.skip););return t}_pushFilterData(){let t=this._filterStack[this._filterStackIndex];return t||(t=this._filterStack[this._filterStackIndex]=new yw),this._filterStackIndex++,t}}Co.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"filter"},N.add(Co,ho),N.add(po);var bw={__proto__:null};const Mo=[];N.handleByNamedList(S.Environment,Mo);async function Ro(r){if(!r)for(let t=0;t<Mo.length;t++){const e=Mo[t];if(e.value.test()){await e.value.load();return}}}async function vw(r){return Ro(!r)}let vi;function Oo(){if(typeof vi=="boolean")return vi;try{vi=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch(r){vi=!1}return vi}function mf(r,t,e=2){const i=t&&t.length,n=i?t[0]*e:r.length;let s=gf(r,0,n,e,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,u;if(i&&(s=Ew(r,t,s,e)),r.length>80*e){o=r[0],l=r[1];let c=o,h=l;for(let p=e;p<n;p+=e){const f=r[p],m=r[p+1];f<o&&(o=f),m<l&&(l=m),f>c&&(c=f),m>h&&(h=m)}u=Math.max(c-o,h-l),u=u!==0?32767/u:0}return xi(s,a,e,o,l,u,0),a}function gf(r,t,e,i,n){let s;if(n===Bo(r,t,e,i)>0)for(let a=t;a<e;a+=i)s=vf(a/i|0,r[a],r[a+1],s);else for(let a=e-i;a>=t;a-=i)s=vf(a/i|0,r[a],r[a+1],s);return s&&Cr(s,s.next)&&(wi(s),s=s.next),s}function sr(r,t){if(!r)return r;t||(t=r);let e=r,i;do if(i=!1,!e.steiner&&(Cr(e,e.next)||xt(e.prev,e,e.next)===0)){if(wi(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function xi(r,t,e,i,n,s,a){if(!r)return;!a&&s&&Rw(r,i,n,s);let o=r;for(;r.prev!==r.next;){const l=r.prev,u=r.next;if(s?Tw(r,i,n,s):xw(r)){t.push(l.i,r.i,u.i),wi(r),r=u.next,o=u.next;continue}if(r=u,r===o){a?a===1?(r=Sw(sr(r),t),xi(r,t,e,i,n,s,2)):a===2&&ww(r,t,e,i,n,s):xi(sr(r),t,e,i,n,s,1);break}}}function xw(r){const t=r.prev,e=r,i=r.next;if(xt(t,e,i)>=0)return!1;const n=t.x,s=e.x,a=i.x,o=t.y,l=e.y,u=i.y,c=Math.min(n,s,a),h=Math.min(o,l,u),p=Math.max(n,s,a),f=Math.max(o,l,u);let m=i.next;for(;m!==t;){if(m.x>=c&&m.x<=p&&m.y>=h&&m.y<=f&&Ti(n,o,s,l,a,u,m.x,m.y)&&xt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Tw(r,t,e,i){const n=r.prev,s=r,a=r.next;if(xt(n,s,a)>=0)return!1;const o=n.x,l=s.x,u=a.x,c=n.y,h=s.y,p=a.y,f=Math.min(o,l,u),m=Math.min(c,h,p),g=Math.max(o,l,u),_=Math.max(c,h,p),y=Go(f,m,t,e,i),b=Go(g,_,t,e,i);let x=r.prevZ,v=r.nextZ;for(;x&&x.z>=y&&v&&v.z<=b;){if(x.x>=f&&x.x<=g&&x.y>=m&&x.y<=_&&x!==n&&x!==a&&Ti(o,c,l,h,u,p,x.x,x.y)&&xt(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==n&&v!==a&&Ti(o,c,l,h,u,p,v.x,v.y)&&xt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=y;){if(x.x>=f&&x.x<=g&&x.y>=m&&x.y<=_&&x!==n&&x!==a&&Ti(o,c,l,h,u,p,x.x,x.y)&&xt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=b;){if(v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==n&&v!==a&&Ti(o,c,l,h,u,p,v.x,v.y)&&xt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Sw(r,t){let e=r;do{const i=e.prev,n=e.next.next;!Cr(i,n)&&yf(i,e,e.next,n)&&Si(i,n)&&Si(n,i)&&(t.push(i.i,e.i,n.i),wi(e),wi(e.next),e=r=n),e=e.next}while(e!==r);return sr(e)}function ww(r,t,e,i,n,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Iw(a,o)){let l=bf(a,o);a=sr(a,a.next),l=sr(l,l.next),xi(a,t,e,i,n,s,0),xi(l,t,e,i,n,s,0);return}o=o.next}a=a.next}while(a!==r)}function Ew(r,t,e,i){const n=[];for(let s=0,a=t.length;s<a;s++){const o=t[s]*i,l=s<a-1?t[s+1]*i:r.length,u=gf(r,o,l,i,!1);u===u.next&&(u.steiner=!0),n.push(Gw(u))}n.sort(Pw);for(let s=0;s<n.length;s++)e=Aw(n[s],e);return e}function Pw(r,t){let e=r.x-t.x;if(e===0&&(e=r.y-t.y,e===0)){const i=(r.next.y-r.y)/(r.next.x-r.x),n=(t.next.y-t.y)/(t.next.x-t.x);e=i-n}return e}function Aw(r,t){const e=Cw(r,t);if(!e)return t;const i=bf(e,r);return sr(i,i.next),sr(e,e.next)}function Cw(r,t){let e=t;const i=r.x,n=r.y;let s=-1/0,a;if(Cr(r,e))return e;do{if(Cr(r,e.next))return e.next;if(n<=e.y&&n>=e.next.y&&e.next.y!==e.y){const h=e.x+(n-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=i&&h>s&&(s=h,a=e.x<e.next.x?e:e.next,h===i))return a}e=e.next}while(e!==t);if(!a)return null;const o=a,l=a.x,u=a.y;let c=1/0;e=a;do{if(i>=e.x&&e.x>=l&&i!==e.x&&_f(n<u?i:s,n,l,u,n<u?s:i,n,e.x,e.y)){const h=Math.abs(n-e.y)/(i-e.x);Si(e,r)&&(h<c||h===c&&(e.x>a.x||e.x===a.x&&Mw(a,e)))&&(a=e,c=h)}e=e.next}while(e!==o);return a}function Mw(r,t){return xt(r.prev,r,t.prev)<0&&xt(t.next,r,r.next)<0}function Rw(r,t,e,i){let n=r;do n.z===0&&(n.z=Go(n.x,n.y,t,e,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,Ow(n)}function Ow(r){let t,e=1;do{let i=r,n;r=null;let s=null;for(t=0;i;){t++;let a=i,o=0;for(let u=0;u<e&&(o++,a=a.nextZ,!!a);u++);let l=e;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||i.z<=a.z)?(n=i,i=i.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:r=n,n.prevZ=s,s=n;i=a}s.nextZ=null,e*=2}while(t>1);return r}function Go(r,t,e,i,n){return r=(r-e)*n|0,t=(t-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Gw(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function _f(r,t,e,i,n,s,a,o){return(n-a)*(t-o)>=(r-a)*(s-o)&&(r-a)*(i-o)>=(e-a)*(t-o)&&(e-a)*(s-o)>=(n-a)*(i-o)}function Ti(r,t,e,i,n,s,a,o){return!(r===a&&t===o)&&_f(r,t,e,i,n,s,a,o)}function Iw(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Bw(r,t)&&(Si(r,t)&&Si(t,r)&&Fw(r,t)&&(xt(r.prev,r,t.prev)||xt(r,t.prev,t))||Cr(r,t)&&xt(r.prev,r,r.next)>0&&xt(t.prev,t,t.next)>0)}function xt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Cr(r,t){return r.x===t.x&&r.y===t.y}function yf(r,t,e,i){const n=Dn(xt(r,t,e)),s=Dn(xt(r,t,i)),a=Dn(xt(e,i,r)),o=Dn(xt(e,i,t));return!!(n!==s&&a!==o||n===0&&Fn(r,e,t)||s===0&&Fn(r,i,t)||a===0&&Fn(e,r,i)||o===0&&Fn(e,t,i))}function Fn(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Dn(r){return r>0?1:r<0?-1:0}function Bw(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&yf(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Si(r,t){return xt(r.prev,r,r.next)<0?xt(r,t,r.next)>=0&&xt(r,r.prev,t)>=0:xt(r,t,r.prev)<0||xt(r,r.next,t)<0}function Fw(r,t){let e=r,i=!1;const n=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&n<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function bf(r,t){const e=Io(r.i,r.x,r.y),i=Io(t.i,t.x,t.y),n=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=n,n.prev=e,i.next=e,e.prev=i,s.next=i,i.prev=s,i}function vf(r,t,e,i){const n=Io(r,t,e);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function wi(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Io(r,t,e){return{i:r,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function HB(r,t,e,i){const n=t&&t.length,s=n?t[0]*e:r.length;let a=Math.abs(Bo(r,0,s,e));if(n)for(let l=0,u=t.length;l<u;l++){const c=t[l]*e,h=l<u-1?t[l+1]*e:r.length;a-=Math.abs(Bo(r,c,h,e))}let o=0;for(let l=0;l<i.length;l+=3){const u=i[l]*e,c=i[l+1]*e,h=i[l+2]*e;o+=Math.abs((r[u]-r[h])*(r[c+1]-r[u+1])-(r[u]-r[c])*(r[h+1]-r[u+1]))}return a===0&&o===0?0:Math.abs((o-a)/a)}function Bo(r,t,e,i){let n=0;for(let s=t,a=e-i;s<e;s+=i)n+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return n}function zB(r){const t=[],e=[],i=r[0][0].length;let n=0,s=0;for(const a of r){for(const o of a)for(let l=0;l<i;l++)t.push(o[l]);s&&(n+=s,e.push(n)),s=a.length}return{vertices:t,holes:e,dimensions:i}}const xf=mf.default||mf;var Kt=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(Kt||{});class Fo{constructor(t){this.items=[],this._name=t}emit(t,e,i,n,s,a,o,l){const{name:u,items:c}=this;for(let h=0,p=c.length;h<p;h++)c[h][u](t,e,i,n,s,a,o,l);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}var Dw=Object.defineProperty,Tf=Object.getOwnPropertySymbols,Uw=Object.prototype.hasOwnProperty,$w=Object.prototype.propertyIsEnumerable,Sf=(r,t,e)=>t in r?Dw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Un=(r,t)=>{for(var e in t||(t={}))Uw.call(t,e)&&Sf(r,e,t[e]);if(Tf)for(var e of Tf(t))$w.call(t,e)&&Sf(r,e,t[e]);return r};const kw=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],wf=class B1 extends Nt{constructor(t){var e;super(),this.tick=0,this.uid=ht("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const i=[...kw,...(e=this.config.runners)!=null?e:[]];this._addRunners(...i),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Ro(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash){const n=this._systemsHash[i].constructor.defaultOptions;t=Un(Un({},n),t)}t=Un(Un({},B1.defaultOptions),t),this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){var i,n;this.tick++;let s=t;if(s instanceof dt&&(s={container:s},e&&(s.target=e.renderTexture)),s.target||(s.target=this.view.renderTarget),s.target===this.view.renderTarget&&(this._lastObjectRendered=s.container,(i=s.clearColor)!=null||(s.clearColor=this.background.colorRgba),(n=s.clear)!=null||(s.clear=this.background.clearBeforeRender)),s.clearColor){const a=Array.isArray(s.clearColor)&&s.clearColor.length===4;s.clearColor=a?s.clearColor:tt.shared.setValue(s.clearColor).toArray()}s.transform||(s.container.updateLocalTransform(),s.transform=s.container.localTransform),s.container.visible&&(s.container.enableRenderGroup(),this.runners.prerender.emit(s),this.runners.renderStart.emit(s),this.runners.render.emit(s),this.runners.renderEnd.emit(s),this.runners.postrender.emit(s))}resize(t,e,i){const n=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==n&&this.runners.resolutionChange.emit(i)}clear(t={}){var e;const i=this;t.target||(t.target=i.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),(e=t.clear)!=null||(t.clear=Kt.ALL);const{clear:n,clearColor:s,target:a,mipLevel:o,layer:l}=t;tt.shared.setValue(s!=null?s:this.background.colorRgba),i.renderTarget.clear(a,n,tt.shared.toArray(),o!=null?o:0,l!=null?l:0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}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(...t){t.forEach(e=>{this.runners[e]=new Fo(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const n in this.runners)this.runners[n].add(i);return this}_addPipes(t,e){const i=e.reduce((n,s)=>(n[s.name]=s.value,n),{});t.forEach(n=>{const s=n.value,a=n.name,o=i[a];this.renderPipes[a]=new s(this,o?new o:null),this.runners.destroy.add(this.renderPipes[a])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&qe.release(),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Oo())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()}};wf.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let Mr=wf,Do;function Ei(r){return Do!==void 0||(Do=(()=>{var t;const e={stencil:!0,failIfMajorPerformanceCaveat:r!=null?r:Mr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!H.get().getWebGLRenderingContext())return!1;let i=H.get().createCanvas().getContext("webgl",e);const n=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const s=i.getExtension("WEBGL_lose_context");s&&s.loseContext()}return i=null,n}catch(i){return!1}})()),Do}let Uo;async function Pi(r={}){return Uo!==void 0||(Uo=await(async()=>{const t=H.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch(e){return!1}})()),Uo}var Lw=Object.defineProperty,Ef=Object.getOwnPropertySymbols,Nw=Object.prototype.hasOwnProperty,Xw=Object.prototype.propertyIsEnumerable,Pf=(r,t,e)=>t in r?Lw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Rr=(r,t)=>{for(var e in t||(t={}))Nw.call(t,e)&&Pf(r,e,t[e]);if(Ef)for(var e of Ef(t))Xw.call(t,e)&&Pf(r,e,t[e]);return r};const Af=["webgl","webgpu","canvas"];async function Cf(r){var t;let e=[];r.preference?Array.isArray(r.preference)?e=r.preference.slice():(e.push(r.preference),Af.forEach(a=>{a!==r.preference&&e.push(a)})):e=Af.slice();let i,n={};for(let a=0;a<e.length;a++){const o=e[a];if(o==="webgpu"&&await Pi()){const{WebGPURenderer:l}=await Promise.resolve().then(function(){return oG});i=l,n=Rr(Rr({},r),r.webgpu);break}else if(o==="webgl"&&Ei((t=r.failIfMajorPerformanceCaveat)!=null?t:Mr.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:l}=await Promise.resolve().then(function(){return U3});i=l,n=Rr(Rr({},r),r.webgl);break}else if(o==="canvas"){const{CanvasRenderer:l}=await Promise.resolve().then(function(){return LO});i=l,n=Rr(Rr({},r),r.canvasOptions);break}}if(delete n.webgpu,delete n.webgl,delete n.canvasOptions,!i)throw new Error("No available renderer for the current environment");const s=new i;return await s.init(n),s}const jw=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,Ai="8.19.0";class $o{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,Ai)}static destroy(){}}$o.extension=S.Application;class ko{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,Ai)}destroy(){this._renderer=null}}ko.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"initHook",priority:-10};class Lo{static init(t){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;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:s}=this._resizeTo;e=n,i=s}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Lo.extension=S.Application;class No{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),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,Te.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ot.shared:new Ot,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}No.extension=S.Application,N.add(Lo),N.add(No);var Hw=Object.defineProperty,Mf=Object.getOwnPropertySymbols,zw=Object.prototype.hasOwnProperty,Ww=Object.prototype.propertyIsEnumerable,Rf=(r,t,e)=>t in r?Hw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vw=(r,t)=>{for(var e in t||(t={}))zw.call(t,e)&&Rf(r,e,t[e]);if(Mf)for(var e of Mf(t))Ww.call(t,e)&&Rf(r,e,t[e]);return r};const Of=class Ph{constructor(...t){this.stage=new dt}async init(t){t=Vw({},t),this.stage||(this.stage=new dt),this.renderer=await Cf(t),Ph._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){var t;return(t=this.renderer.renderPipes.dom)==null?void 0:t._domElement}destroy(t=!1,e=!1){const i=Ph._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Of._plugins=[];let Gf=Of;N.handleByList(S.Application,Gf._plugins),N.add($o);const $n={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){var t,e,i;const n=r.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const m in n){const g=n[m].match(/^[a-z]+/gm)[0],_=n[m].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),y={};for(const b in _){const x=_[b].split("="),v=x[0],w=x[1].replace(/"/gm,""),T=parseFloat(w),E=isNaN(T)?w:T;y[v]=E}s[g].push(y)}const a={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[o]=s.info,[l]=s.common,[u]=(t=s.distanceField)!=null?t:[];u&&(a.distanceField={range:parseInt(u.distanceRange,10),type:u.fieldType}),a.fontSize=parseInt(o.size,10),a.fontFamily=o.face,a.lineHeight=parseInt(l.lineHeight,10);const c=s.page;for(let m=0;m<c.length;m++)a.pages.push({id:parseInt(c[m].id,10)||0,file:c[m].file});const h={};a.baseLineOffset=a.lineHeight-parseInt(l.base,10);const p=s.char;for(let m=0;m<p.length;m++){const g=p[m],_=parseInt(g.id,10);let y=(i=(e=g.letter)!=null?e:g.char)!=null?i:String.fromCharCode(_);y==="space"&&(y=" "),h[_]=y,a.chars[y]={id:_,page:parseInt(g.page,10)||0,x:parseInt(g.x,10),y:parseInt(g.y,10),width:parseInt(g.width,10),height:parseInt(g.height,10),xOffset:parseInt(g.xoffset,10),yOffset:parseInt(g.yoffset,10),xAdvance:parseInt(g.xadvance,10),kerning:{}}}const f=s.kerning||[];for(let m=0;m<f.length;m++){const g=parseInt(f[m].first,10),_=parseInt(f[m].second,10),y=parseInt(f[m].amount,10);a.chars[h[_]]&&(a.chars[h[_]].kerning[h[g]]=y)}return a}},Xo={test(r){const t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){var t,e;const i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},n=r.getElementsByTagName("info")[0],s=r.getElementsByTagName("common")[0],a=r.getElementsByTagName("distanceField")[0];a&&(i.distanceField={type:a.getAttribute("fieldType"),range:parseInt(a.getAttribute("distanceRange"),10)});const o=r.getElementsByTagName("page"),l=r.getElementsByTagName("char"),u=r.getElementsByTagName("kerning");i.fontSize=parseInt(n.getAttribute("size"),10),i.fontFamily=n.getAttribute("face"),i.lineHeight=parseInt(s.getAttribute("lineHeight"),10);for(let h=0;h<o.length;h++)i.pages.push({id:parseInt(o[h].getAttribute("id"),10)||0,file:o[h].getAttribute("file")});const c={};i.baseLineOffset=i.lineHeight-parseInt(s.getAttribute("base"),10);for(let h=0;h<l.length;h++){const p=l[h],f=parseInt(p.getAttribute("id"),10);let m=(e=(t=p.getAttribute("letter"))!=null?t:p.getAttribute("char"))!=null?e:String.fromCharCode(f);m==="space"&&(m=" "),c[f]=m,i.chars[m]={id:f,page:parseInt(p.getAttribute("page"),10)||0,x:parseInt(p.getAttribute("x"),10),y:parseInt(p.getAttribute("y"),10),width:parseInt(p.getAttribute("width"),10),height:parseInt(p.getAttribute("height"),10),xOffset:parseInt(p.getAttribute("xoffset"),10),yOffset:parseInt(p.getAttribute("yoffset"),10),xAdvance:parseInt(p.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<u.length;h++){const p=parseInt(u[h].getAttribute("first"),10),f=parseInt(u[h].getAttribute("second"),10),m=parseInt(u[h].getAttribute("amount"),10);i.chars[c[f]]&&(i.chars[c[f]].kerning[c[p]]=m)}return i}},jo={test(r){return typeof r=="string"&&r.match(/<font(\s|>)/)?Xo.test(H.get().parseXML(r)):!1},parse(r){return Xo.parse(H.get().parseXML(r))}},Yw=[".xml",".fnt"],If={extension:{type:S.CacheParser,name:"cacheBitmapFont"},test:r=>!!(r!=null&&r.pages)&&!!(r!=null&&r.chars)&&typeof(r==null?void 0:r.fontFamily)=="string"&&r.fontFamily!=="",getCacheableAssets(r,t){const e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},Bf={extension:{type:S.LoadParser,priority:te.Normal},name:"loadBitmapFont",id:"bitmap-font",test(r){return Yw.includes(zt.extname(r).toLowerCase())},async testParse(r){return $n.test(r)||jo.test(r)},async parse(r,t,e){const i=$n.test(r)?$n.parse(r):jo.parse(r),{src:n}=t,{pages:s}=i,a=[],o=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let h=0;h<s.length;++h){const p=s[h].file;let f=zt.join(zt.dirname(n),p);f=xn(f,n),a.push({src:f,data:o})}const[l,{BitmapFont:u}]=await Promise.all([e.load(a),Promise.resolve().then(function(){return qI})]),c=a.map(h=>l[h.src]);return new u({data:i,textures:c},n)},async load(r,t){return await(await H.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};class Ff{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.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 t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}const Df={extension:{type:S.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof D),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((n,s)=>{e[i+(s===0?"":s+1)]=n})}),e}};async function Ho(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const Uf={extension:{type:S.DetectionParser,priority:1},test:async()=>Ho("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")},$f=["png","jpg","jpeg"],kf={extension:{type:S.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...$f],remove:async r=>r.filter(t=>!$f.includes(t))},Kw="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Ci(r){return Kw?!1:document.createElement("video").canPlayType(r)!==""}const Lf={extension:{type:S.DetectionParser,priority:0},test:async()=>Ci("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")},Nf={extension:{type:S.DetectionParser,priority:0},test:async()=>Ci("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")},Xf={extension:{type:S.DetectionParser,priority:0},test:async()=>Ci("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")},jf={extension:{type:S.DetectionParser,priority:0},test:async()=>Ho("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};var qw=Object.defineProperty,Zw=Object.defineProperties,Qw=Object.getOwnPropertyDescriptors,Hf=Object.getOwnPropertySymbols,Jw=Object.prototype.hasOwnProperty,tE=Object.prototype.propertyIsEnumerable,zf=(r,t,e)=>t in r?qw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Or=(r,t)=>{for(var e in t||(t={}))Jw.call(t,e)&&zf(r,e,t[e]);if(Hf)for(var e of Hf(t))tE.call(t,e)&&zf(r,e,t[e]);return r},eE=(r,t)=>Zw(r,Qw(t));const Wf=class xa{constructor(){this.loadOptions=Or({},xa.defaultOptions),this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var n,s;let a=null,o=null;if((e.parser||e.loadParser)&&(o=this._parserHash[e.parser||e.loadParser]),!o){for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];if(u.load&&(n=u.test)!=null&&n.call(u,t,e,this)){o=u;break}}if(!o)return null}a=await o.load(t,e,this),i.parser=o;for(let l=0;l<this.parsers.length;l++){const u=this.parsers[l];u.parse&&u.parse&&await((s=u.testParse)==null?void 0:s.call(u,a,e,this))&&(a=await u.parse(a,e,this)||a,i.parser=u)}return a})(),i}async load(t,e){this._parsersValidated||this._validateParsers();const i=typeof e=="function"?eE(Or(Or({},xa.defaultOptions),this.loadOptions),{onProgress:e}):Or(Or(Or({},xa.defaultOptions),this.loadOptions),e||{}),{onProgress:n,onError:s,strategy:a,retryCount:o,retryDelay:l}=i;let u=0;const c={},h=fi(t),p=oe(t,g=>({alias:[g],src:g,data:{}})),f=p.reduce((g,_)=>g+(_.progressSize||1),0),m=p.map(async g=>{const _=zt.toAbsolute(g.src);c[g.src]||(await this._loadAssetWithRetry(_,g,{onProgress:n,onError:s,strategy:a,retryCount:o,retryDelay:l},c),u+=g.progressSize||1,n&&n(u/f))});return await Promise.all(m),h?c[p[0].src]:c}async unload(t){const e=oe(t,i=>({alias:[i],src:i})).map(async i=>{var n,s;const a=zt.toAbsolute(i.src),o=this.promiseCache[a];if(o){const l=await o.promise;delete this.promiseCache[a],await((s=(n=o.parser)==null?void 0:n.unload)==null?void 0:s.call(n,l,i,this))}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name||t.id).reduce((t,e)=>(!e.name&&!e.id||t[e.name]||t[e.id],t[e.name]=e,e.id&&(t[e.id]=e),t),{})}async _loadAssetWithRetry(t,e,i,n){let s=0;const{onError:a,strategy:o,retryCount:l,retryDelay:u}=i,c=h=>new Promise(p=>setTimeout(p,h));for(;;)try{this.promiseCache[t]||(this.promiseCache[t]=this._getLoadPromiseAndParser(t,e)),n[e.src]=await this.promiseCache[t].promise;return}catch(h){delete this.promiseCache[t],delete n[e.src],s++;const p=o!=="retry"||s>l;if(o==="retry"&&!p){a&&a(h,e),await c(u);continue}if(o==="skip"){a&&a(h,e);return}a&&a(h,e);const f=new Error(`[Loader.load] Failed to load ${t}.
|
|
121
|
+
${h}`);throw h instanceof Error&&h.stack&&(f.stack=h.stack),f}}};Wf.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};let Vf=Wf;function ar(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function le(r,t){const e=r.split("?")[0],i=zt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const rE=".json",iE="application/json",Yf={extension:{type:S.LoadParser,priority:te.Low},name:"loadJson",id:"json",test(r){return ar(r,iE)||le(r,rE)},async load(r){return await(await H.get().fetch(r)).json()}},nE=".txt",sE="text/plain",Kf={name:"loadTxt",id:"text",extension:{type:S.LoadParser,priority:te.Low,name:"loadTxt"},test(r){return ar(r,sE)||le(r,nE)},async load(r){return await(await H.get().fetch(r)).text()}};var aE=Object.defineProperty,oE=Object.defineProperties,lE=Object.getOwnPropertyDescriptors,qf=Object.getOwnPropertySymbols,uE=Object.prototype.hasOwnProperty,cE=Object.prototype.propertyIsEnumerable,Zf=(r,t,e)=>t in r?aE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hE=(r,t)=>{for(var e in t||(t={}))uE.call(t,e)&&Zf(r,e,t[e]);if(qf)for(var e of qf(t))cE.call(t,e)&&Zf(r,e,t[e]);return r},dE=(r,t)=>oE(r,lE(t));const pE=["normal","bold","100","200","300","400","500","600","700","800","900"],fE=[".ttf",".otf",".woff",".woff2"],mE=["font/ttf","font/otf","font/woff","font/woff2"],gE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Qf(r){const t=zt.extname(r),e=zt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(s=>s.charAt(0).toUpperCase()+s.slice(1));let i=e.length>0;for(const s of e)if(!s.match(gE)){i=!1;break}let n=e.join(" ");return i||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}const _E=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function yE(r){return _E.test(r)?r:encodeURI(r)}const Jf={extension:{type:S.LoadParser,priority:te.Low},name:"loadWebFont",id:"web-font",test(r){return ar(r,mE)||le(r,fE)},async load(r,t){var e,i,n,s,a,o;const l=H.get().getFontFaceSet();if(l){const u=[],c=(i=(e=t.data)==null?void 0:e.family)!=null?i:Qf(r),h=(a=(s=(n=t.data)==null?void 0:n.weights)==null?void 0:s.filter(f=>pE.includes(f)))!=null?a:["normal"],p=(o=t.data)!=null?o:{};for(let f=0;f<h.length;f++){const m=h[f],g=new FontFace(c,`url('${yE(r)}')`,dE(hE({},p),{weight:m}));await g.load(),l.add(g),u.push(g)}return it.has(`${c}-and-url`)?it.get(`${c}-and-url`).entries.push({url:r,faces:u}):it.set(`${c}-and-url`,{entries:[{url:r,faces:u}]}),u.length===1?u[0]:u}return null},unload(r){const t=Array.isArray(r)?r:[r],e=t[0].family,i=it.get(`${e}-and-url`),n=i.entries.find(s=>s.faces.some(a=>t.indexOf(a)!==-1));n.faces=n.faces.filter(s=>t.indexOf(s)===-1),n.faces.length===0&&(i.entries=i.entries.filter(s=>s!==n)),t.forEach(s=>{H.get().getFontFaceSet().delete(s)}),i.entries.length===0&&it.remove(`${e}-and-url`)}},zo={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},bE=/([astvzqmhlc])([^astvzqmhlc]*)/gi,vE=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function xE(r){const t=[];return r.replace(bE,(e,i,n)=>{let s=i.toLowerCase(),a=i;const o=TE(n);for(s==="m"&&o.length>2&&(t.push([a,...o.splice(0,2)]),s="l",a=a==="m"?"l":"L");;){if(o.length===zo[s])return t.push([a,...o]),"";if(o.length<zo[s])throw new Error("malformed path data");t.push([a,...o.splice(0,zo[s])])}}),t}function TE(r){const t=r.match(vE);return t?t.map(Number):[]}function tm(r,t){const e=xE(r),i=[];let n=null,s=0,a=0;for(let o=0;o<e.length;o++){const l=e[o],u=l[0],c=l;switch(u){case"M":s=c[1],a=c[2],t.moveTo(s,a);break;case"m":s+=c[1],a+=c[2],t.moveTo(s,a);break;case"H":s=c[1],t.lineTo(s,a);break;case"h":s+=c[1],t.lineTo(s,a);break;case"V":a=c[1],t.lineTo(s,a);break;case"v":a+=c[1],t.lineTo(s,a);break;case"L":s=c[1],a=c[2],t.lineTo(s,a);break;case"l":s+=c[1],a+=c[2],t.lineTo(s,a);break;case"C":s=c[5],a=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],s,a);break;case"c":t.bezierCurveTo(s+c[1],a+c[2],s+c[3],a+c[4],s+c[5],a+c[6]),s+=c[5],a+=c[6];break;case"S":s=c[3],a=c[4],t.bezierCurveToShort(c[1],c[2],s,a);break;case"s":t.bezierCurveToShort(s+c[1],a+c[2],s+c[3],a+c[4]),s+=c[3],a+=c[4];break;case"Q":s=c[3],a=c[4],t.quadraticCurveTo(c[1],c[2],s,a);break;case"q":t.quadraticCurveTo(s+c[1],a+c[2],s+c[3],a+c[4]),s+=c[3],a+=c[4];break;case"T":s=c[1],a=c[2],t.quadraticCurveToShort(s,a);break;case"t":s+=c[1],a+=c[2],t.quadraticCurveToShort(s,a);break;case"A":s=c[6],a=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],s,a);break;case"a":s+=c[6],a+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],s,a);break;case"Z":case"z":t.closePath(),i.length>0&&(n=i.pop(),n?(s=n.startX,a=n.startY):(s=0,a=0)),n=null;break;default:}u!=="Z"&&u!=="z"&&n===null&&(n={startX:s,startY:a},i.push(n))}return t}const em={};function kn(r,t,e){let i=2166136261;for(let n=0;n<t;n++)i^=r[n].uid,i=Math.imul(i,16777619),i>>>=0;return em[i]||SE(r,t,i,e)}function SE(r,t,e,i){const n={};let s=0;for(let o=0;o<i;o++){const l=o<t?r[o]:D.EMPTY.source;n[s++]=l.source,n[s++]=l.style}const a=new Ee(n);return em[e]=a,a}class or{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,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(t){return this[`${t}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(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const rm=new Set,Wo="8.0.0",wE="8.3.4",Gr={quiet:!1,noColor:!1},Mi=((r,t,e=3)=>{if(Gr.quiet||rm.has(t))return;let i=new Error().stack;const n=`${t}
|
|
122
|
+
Deprecated since v${r}`,s=typeof console.groupCollapsed=="function"&&!Gr.noColor;typeof i=="undefined"?console.warn("PixiJS Deprecation Warning: ",n):(i=i.split(`
|
|
123
|
+
`).splice(e).join(`
|
|
124
|
+
`),s?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",n),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",n),console.warn(i))),rm.add(t)});Object.defineProperties(Mi,{quiet:{get:()=>Gr.quiet,set:r=>{Gr.quiet=r},enumerable:!0,configurable:!1},noColor:{get:()=>Gr.noColor,set:r=>{Gr.noColor=r},enumerable:!0,configurable:!1}});function Ln(r,t,e,i){if(e!=null||(e=0),i!=null||(i=Math.min(r.byteLength-e,t.byteLength)),!(e&7)&&!(i&7)){const n=i/8;new Float64Array(t,0,n).set(new Float64Array(r,e,n))}else if(!(e&3)&&!(i&3)){const n=i/4;new Float32Array(t,0,n).set(new Float32Array(r,e,n))}else new Uint8Array(t).set(new Uint8Array(r,e,i))}const im={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var wt=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))(wt||{});function Ir(r,t){return t.alphaMode==="no-premultiply-alpha"&&im[r]||r}const EE=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
125
|
+
`);function PE(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
|
|
126
|
+
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Vo(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const i=EE.replace(/%forloop%/gi,PE(r));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}let Br=null;function nm(){var r;if(Br)return Br;const t=mo();return Br=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Br=Vo(Br,t),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),Br}class sm{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}var AE=Object.defineProperty,am=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,ME=Object.prototype.propertyIsEnumerable,om=(r,t,e)=>t in r?AE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lm=(r,t)=>{for(var e in t||(t={}))CE.call(t,e)&&om(r,e,t[e]);if(am)for(var e of am(t))ME.call(t,e)&&om(r,e,t[e]);return r};class um{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new sm,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 Ri=[];let Nn=0;qe.register({clear:()=>{if(Ri.length>0)for(const r of Ri)r&&r.destroy();Ri.length=0,Nn=0}});function cm(){return Nn>0?Ri[--Nn]:new um}function hm(r){r.elements=null,Ri[Nn++]=r}let Oi=0;const dm=class F1{constructor(t){this.uid=ht("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t=lm(lm({},F1.defaultOptions),t),t.maxTextures||(Mi("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=nm());const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:n}=t;this.attributeBuffer=new or(i*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)hm(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let i=cm(),n=i.textures;n.clear();const s=e[this.elementStart];let a=Ir(s.blendMode,s.texture._source),o=s.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const l=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,c=this.indexBuffer;let h=this._batchIndexSize,p=this._batchIndexStart,f="startBatch",m=[];const g=this.maxTextures;for(let _=this.elementStart;_<this.elementSize;++_){const y=e[_];e[_]=null;const b=y.texture._source,x=Ir(y.blendMode,b),v=a!==x||o!==y.topology;if(b._batchTick===Oi&&!v){y._textureId=b._textureBindLocation,h+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,u,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,u,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=i,m.push(y);continue}b._batchTick=Oi,(n.count>=g||v)&&(this._finishBatch(i,p,h-p,n,a,o,t,f,m),f="renderBatch",p=h,a=x,o=y.topology,i=cm(),n=i.textures,n.clear(),m=[],++Oi),y._textureId=b._textureBindLocation=n.count,n.ids[b.uid]=n.count,n.textures[n.count++]=b,y._batch=i,m.push(y),h+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,u,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,u,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize))}n.count>0&&(this._finishBatch(i,p,h-p,n,a,o,t,f,m),p=h,++Oi),this.elementStart=this.elementSize,this._batchIndexStart=p,this._batchIndexSize=h}_finishBatch(t,e,i,n,s,a,o,l,u){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=n,t.blendMode=s,t.topology=a,t.start=e,t.size=i,t.elements=u,++Oi,this.batches[this.batchIndex++]=t,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),i=new or(e);Ln(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const n=i>65535?new Uint32Array(i):new Uint16Array(i);if(n.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let s=0;s<e.length;s++)n[s]=e[s];else Ln(e.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,n){const s=t.indices,a=t.indexSize,o=t.indexOffset,l=t.attributeOffset;for(let u=0;u<a;u++)e[i++]=n+s[u+o]-l}destroy(t={}){var e;if(this.batches!==null){for(let i=0;i<this.batchIndex;i++)hm(this.batches[i]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&((e=this.shader)==null||e.destroy(),this.shader=null);for(let i=0;i<this._elements.length;i++)this._elements[i]&&(this._elements[i]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};dm.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let pm=dm;const RE=new Float32Array(1),OE=new Uint32Array(1);class fm extends nr{constructor(){const t=new Yt({data:RE,label:"attribute-batch-buffer",usage:at.VERTEX|at.COPY_DST,shrinkToFit:!1}),e=new Yt({data:OE,label:"index-batch-buffer",usage:at.INDEX|at.COPY_DST,shrinkToFit:!1}),i=24;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:20}},indexBuffer:e})}}function Yo(r,t,e){if(r)for(const i in r){const n=i.toLocaleLowerCase(),s=t[n];if(s){let a=r[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&s.push(`//----${e}----//`),s.push(a)}}}const GE=/\{\{(.*?)\}\}/g;function Ko(r){var t,e;const i={};return((e=(t=r.match(GE))==null?void 0:t.map(n=>n.replace(/[{()}]/g,"")))!=null?e:[]).forEach(n=>{i[n]=[]}),i}function mm(r,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function qo(r,t,e=!1){const i=[];mm(t,i),r.forEach(o=>{o.header&&mm(o.header,i)});const n=i;e&&n.sort();const s=n.map((o,l)=>` @location(${l}) ${o},`).join(`
|
|
127
|
+
`);let a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
|
|
128
|
+
${s}
|
|
129
|
+
`),a}function gm(r,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function IE(r){const t=/\b(\w+)\s*:/g.exec(r);return t?t[1]:""}function BE(r){const t=/@.*?\s+/g;return r.replace(t,"")}function _m(r,t){const e=[];gm(t,e),r.forEach(l=>{l.header&&gm(l.header,e)});let i=0;const n=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`,
|
|
130
|
+
`),s=e.sort().map(l=>` var ${BE(l)};`).join(`
|
|
131
|
+
`),a=`return VSOutput(
|
|
132
|
+
${e.sort().map(l=>` ${IE(l)}`).join(`,
|
|
133
|
+
`)});`;let o=t.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
|
|
134
|
+
${n}
|
|
135
|
+
`),o=o.replace("{{start}}",`
|
|
136
|
+
${s}
|
|
137
|
+
`),o=o.replace("{{return}}",`
|
|
138
|
+
${a}
|
|
139
|
+
`),o}function Zo(r,t){let e=r;for(const i in t){const n=t[i];n.join(`
|
|
140
|
+
`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----//
|
|
141
|
+
${n.join(`
|
|
142
|
+
`)}
|
|
143
|
+
//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const lr=Object.create(null),Qo=new Map;let FE=0;function ym({template:r,bits:t}){const e=vm(r,t);if(lr[e])return lr[e];const{vertex:i,fragment:n}=DE(r,t);return lr[e]=xm(i,n,t),lr[e]}function bm({template:r,bits:t}){const e=vm(r,t);return lr[e]||(lr[e]=xm(r.vertex,r.fragment,t)),lr[e]}function DE(r,t){const e=t.map(a=>a.vertex).filter(a=>!!a),i=t.map(a=>a.fragment).filter(a=>!!a);let n=qo(e,r.vertex,!0);n=_m(e,n);const s=qo(i,r.fragment,!0);return{vertex:n,fragment:s}}function vm(r,t){return t.map(e=>(Qo.has(e)||Qo.set(e,FE++),Qo.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function xm(r,t,e){const i=Ko(r),n=Ko(t);return e.forEach(s=>{Yo(s.vertex,i,s.name),Yo(s.fragment,n,s.name)}),{vertex:Zo(r,i),fragment:Zo(t,n)}}const Tm=`
|
|
144
|
+
@in aPosition: vec2<f32>;
|
|
145
|
+
@in aUV: vec2<f32>;
|
|
146
|
+
|
|
147
|
+
@out @builtin(position) vPosition: vec4<f32>;
|
|
148
|
+
@out vUV : vec2<f32>;
|
|
149
|
+
@out vColor : vec4<f32>;
|
|
150
|
+
|
|
151
|
+
{{header}}
|
|
152
|
+
|
|
153
|
+
struct VSOutput {
|
|
154
|
+
{{struct}}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
@vertex
|
|
158
|
+
fn main( {{in}} ) -> VSOutput {
|
|
159
|
+
|
|
160
|
+
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
161
|
+
var modelMatrix = mat3x3<f32>(
|
|
162
|
+
1.0, 0.0, 0.0,
|
|
163
|
+
0.0, 1.0, 0.0,
|
|
164
|
+
0.0, 0.0, 1.0
|
|
165
|
+
);
|
|
166
|
+
var position = aPosition;
|
|
167
|
+
var uv = aUV;
|
|
168
|
+
|
|
169
|
+
{{start}}
|
|
170
|
+
|
|
171
|
+
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
172
|
+
|
|
173
|
+
{{main}}
|
|
174
|
+
|
|
175
|
+
vUV = uv;
|
|
176
|
+
|
|
177
|
+
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
178
|
+
|
|
179
|
+
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
180
|
+
|
|
181
|
+
vColor *= globalUniforms.uWorldColorAlpha;
|
|
182
|
+
|
|
183
|
+
{{end}}
|
|
184
|
+
|
|
185
|
+
{{return}}
|
|
186
|
+
};
|
|
187
|
+
`,Sm=`
|
|
188
|
+
@in vUV : vec2<f32>;
|
|
189
|
+
@in vColor : vec4<f32>;
|
|
190
|
+
|
|
191
|
+
{{header}}
|
|
192
|
+
|
|
193
|
+
@fragment
|
|
194
|
+
fn main(
|
|
195
|
+
{{in}}
|
|
196
|
+
) -> @location(0) vec4<f32> {
|
|
197
|
+
|
|
198
|
+
{{start}}
|
|
199
|
+
|
|
200
|
+
var outColor:vec4<f32>;
|
|
201
|
+
|
|
202
|
+
{{main}}
|
|
203
|
+
|
|
204
|
+
var finalColor:vec4<f32> = outColor * vColor;
|
|
205
|
+
|
|
206
|
+
{{end}}
|
|
207
|
+
|
|
208
|
+
return finalColor;
|
|
209
|
+
};
|
|
210
|
+
`,wm=`
|
|
211
|
+
in vec2 aPosition;
|
|
212
|
+
in vec2 aUV;
|
|
213
|
+
|
|
214
|
+
out vec4 vColor;
|
|
215
|
+
out vec2 vUV;
|
|
216
|
+
|
|
217
|
+
{{header}}
|
|
218
|
+
|
|
219
|
+
void main(void){
|
|
220
|
+
|
|
221
|
+
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
222
|
+
mat3 modelMatrix = mat3(
|
|
223
|
+
1.0, 0.0, 0.0,
|
|
224
|
+
0.0, 1.0, 0.0,
|
|
225
|
+
0.0, 0.0, 1.0
|
|
226
|
+
);
|
|
227
|
+
vec2 position = aPosition;
|
|
228
|
+
vec2 uv = aUV;
|
|
229
|
+
|
|
230
|
+
{{start}}
|
|
231
|
+
|
|
232
|
+
vColor = vec4(1.);
|
|
233
|
+
|
|
234
|
+
{{main}}
|
|
235
|
+
|
|
236
|
+
vUV = uv;
|
|
237
|
+
|
|
238
|
+
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
239
|
+
|
|
240
|
+
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
241
|
+
|
|
242
|
+
vColor *= uWorldColorAlpha;
|
|
243
|
+
|
|
244
|
+
{{end}}
|
|
245
|
+
}
|
|
246
|
+
`,Em=`
|
|
247
|
+
|
|
248
|
+
in vec4 vColor;
|
|
249
|
+
in vec2 vUV;
|
|
250
|
+
|
|
251
|
+
out vec4 finalColor;
|
|
252
|
+
|
|
253
|
+
{{header}}
|
|
254
|
+
|
|
255
|
+
void main(void) {
|
|
256
|
+
|
|
257
|
+
{{start}}
|
|
258
|
+
|
|
259
|
+
vec4 outColor;
|
|
260
|
+
|
|
261
|
+
{{main}}
|
|
262
|
+
|
|
263
|
+
finalColor = outColor * vColor;
|
|
264
|
+
|
|
265
|
+
{{end}}
|
|
266
|
+
}
|
|
267
|
+
`,Pm={name:"global-uniforms-bit",vertex:{header:`
|
|
268
|
+
struct GlobalUniforms {
|
|
269
|
+
uProjectionMatrix:mat3x3<f32>,
|
|
270
|
+
uWorldTransformMatrix:mat3x3<f32>,
|
|
271
|
+
uWorldColorAlpha: vec4<f32>,
|
|
272
|
+
uResolution: vec2<f32>,
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
276
|
+
`}},UE={name:"global-uniforms-ubo-bit",vertex:{header:`
|
|
277
|
+
uniform globalUniforms {
|
|
278
|
+
mat3 uProjectionMatrix;
|
|
279
|
+
mat3 uWorldTransformMatrix;
|
|
280
|
+
vec4 uWorldColorAlpha;
|
|
281
|
+
vec2 uResolution;
|
|
282
|
+
};
|
|
283
|
+
`}},Am={name:"global-uniforms-bit",vertex:{header:`
|
|
284
|
+
uniform mat3 uProjectionMatrix;
|
|
285
|
+
uniform mat3 uWorldTransformMatrix;
|
|
286
|
+
uniform vec4 uWorldColorAlpha;
|
|
287
|
+
uniform vec2 uResolution;
|
|
288
|
+
`}};var $E=Object.defineProperty,Cm=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,LE=Object.prototype.propertyIsEnumerable,Mm=(r,t,e)=>t in r?$E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,NE=(r,t)=>{for(var e in t||(t={}))kE.call(t,e)&&Mm(r,e,t[e]);if(Cm)for(var e of Cm(t))LE.call(t,e)&&Mm(r,e,t[e]);return r};function Fr({bits:r,name:t}){const e=ym({template:{fragment:Sm,vertex:Tm},bits:[Pm,...r]});return Xt.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Dr({bits:r,name:t}){return new Wt(NE({name:t},bm({template:{vertex:wm,fragment:Em},bits:[Am,...r]})))}const Xn={name:"color-bit",vertex:{header:`
|
|
289
|
+
@in aColor: vec4<f32>;
|
|
290
|
+
`,main:`
|
|
291
|
+
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
292
|
+
`}},jn={name:"color-bit",vertex:{header:`
|
|
293
|
+
in vec4 aColor;
|
|
294
|
+
`,main:`
|
|
295
|
+
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
296
|
+
`}},Jo={};function XE(r){const t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i<r;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(`
|
|
297
|
+
`)}function jE(r){const t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
|
|
298
|
+
`)}function Hn(r){return Jo[r]||(Jo[r]={name:"texture-batch-bit",vertex:{header:`
|
|
299
|
+
@in aTextureIdAndRound: vec2<u32>;
|
|
300
|
+
@out @interpolate(flat) vTextureId : u32;
|
|
301
|
+
`,main:`
|
|
302
|
+
vTextureId = aTextureIdAndRound.y;
|
|
303
|
+
`,end:`
|
|
304
|
+
if(aTextureIdAndRound.x == 1)
|
|
305
|
+
{
|
|
306
|
+
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
307
|
+
}
|
|
308
|
+
`},fragment:{header:`
|
|
309
|
+
@in @interpolate(flat) vTextureId: u32;
|
|
310
|
+
|
|
311
|
+
${XE(r)}
|
|
312
|
+
`,main:`
|
|
313
|
+
var uvDx = dpdx(vUV);
|
|
314
|
+
var uvDy = dpdy(vUV);
|
|
315
|
+
|
|
316
|
+
${jE(r)}
|
|
317
|
+
`}}),Jo[r]}const tl={};function HE(r){const t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
318
|
+
`)}function zn(r){return tl[r]||(tl[r]={name:"texture-batch-bit",vertex:{header:`
|
|
319
|
+
in vec2 aTextureIdAndRound;
|
|
320
|
+
out float vTextureId;
|
|
321
|
+
|
|
322
|
+
`,main:`
|
|
323
|
+
vTextureId = aTextureIdAndRound.y;
|
|
324
|
+
`,end:`
|
|
325
|
+
if(aTextureIdAndRound.x == 1.)
|
|
326
|
+
{
|
|
327
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
328
|
+
}
|
|
329
|
+
`},fragment:{header:`
|
|
330
|
+
in float vTextureId;
|
|
331
|
+
|
|
332
|
+
uniform sampler2D uTextures[${r}];
|
|
333
|
+
|
|
334
|
+
`,main:`
|
|
335
|
+
|
|
336
|
+
${HE(r)}
|
|
337
|
+
`}}),tl[r]}const Ur={name:"round-pixels-bit",vertex:{header:`
|
|
338
|
+
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
339
|
+
{
|
|
340
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
341
|
+
}
|
|
342
|
+
`}},$r={name:"round-pixels-bit",vertex:{header:`
|
|
343
|
+
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
344
|
+
{
|
|
345
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
346
|
+
}
|
|
347
|
+
`}},Rm={};function Wn(r){let t=Rm[r];if(t)return t;const e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=Rm[r]=new At({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}class el extends ee{constructor(t){const e=Dr({name:"batch",bits:[jn,zn(t),$r]}),i=Fr({name:"batch",bits:[Xn,Hn(t),Ur]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Wn(t)}}),this.maxTextures=t}}let Gi=null;const Om=class D1 extends pm{constructor(t){super(t),this.geometry=new fm,this.name=D1.extension.name,this.vertexSize=6,Gi!=null||(Gi=new el(t.maxTextures)),this.shader=Gi}packAttributes(t,e,i,n,s){const a=s<<16|t.roundPixels&65535,o=t.transform,l=o.a,u=o.b,c=o.c,h=o.d,p=o.tx,f=o.ty,{positions:m,uvs:g}=t,_=t.color,y=t.attributeOffset,b=y+t.attributeSize;for(let x=y;x<b;x++){const v=x*2,w=m[v],T=m[v+1];e[n++]=l*w+c*T+p,e[n++]=h*T+u*w+f,e[n++]=g[v],e[n++]=g[v+1],i[n++]=_,i[n++]=a}}packQuadAttributes(t,e,i,n,s){const a=t.texture,o=t.transform,l=o.a,u=o.b,c=o.c,h=o.d,p=o.tx,f=o.ty,m=t.bounds,g=m.maxX,_=m.minX,y=m.maxY,b=m.minY,x=a.uvs,v=t.color,w=s<<16|t.roundPixels&65535;e[n+0]=l*_+c*b+p,e[n+1]=h*b+u*_+f,e[n+2]=x.x0,e[n+3]=x.y0,i[n+4]=v,i[n+5]=w,e[n+6]=l*g+c*b+p,e[n+7]=h*b+u*g+f,e[n+8]=x.x1,e[n+9]=x.y1,i[n+10]=v,i[n+11]=w,e[n+12]=l*g+c*y+p,e[n+13]=h*y+u*g+f,e[n+14]=x.x2,e[n+15]=x.y2,i[n+16]=v,i[n+17]=w,e[n+18]=l*_+c*y+p,e[n+19]=h*y+u*_+f,e[n+20]=x.x3,e[n+21]=x.y3,i[n+22]=v,i[n+23]=w}_updateMaxTextures(t){this.shader.maxTextures!==t&&(Gi=new el(t),this.shader=Gi)}destroy(){this.shader=null,super.destroy()}};Om.extension={type:[S.Batcher],name:"default"};let Vn=Om;class Ut{constructor(t){this.items=Object.create(null);const{renderer:e,type:i,onUnload:n,priority:s,name:a}=t;this._renderer=e,e.gc.addResourceHash(this,"items",i,s!=null?s:0),this._onUnload=n,this.name=a}add(t){return this.items[t.uid]?!1:(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){var i;if(!this.items[t.uid])return;const n=t._gpuData[this._renderer.uid];n&&((i=this._onUnload)==null||i.call(this,t,...e),n.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach(e=>e&&this.remove(e,...t))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function rl(r,t,e,i,n,s,a,o=null){let l=0;e*=t,n*=s;const u=o.a,c=o.b,h=o.c,p=o.d,f=o.tx,m=o.ty;for(;l<a;){const g=r[e],_=r[e+1];i[n]=u*g+h*_+f,i[n+1]=c*g+p*_+m,n+=s,e+=t,l++}}function il(r,t,e,i){let n=0;for(t*=e;n<i;)r[t]=0,r[t+1]=0,t+=e,n++}function Yn(r,t,e,i,n){const s=t.a,a=t.b,o=t.c,l=t.d,u=t.tx,c=t.ty;e||(e=0),i||(i=2),n||(n=r.length/i-e);let h=e*i;for(let p=0;p<n;p++){const f=r[h],m=r[h+1];r[h]=s*f+o*m+u,r[h+1]=a*f+l*m+c,h+=i}}const zE=new U;class Kn{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 t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Oe(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||zE}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.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}}var WE=Object.defineProperty,VE=Object.defineProperties,YE=Object.getOwnPropertyDescriptors,Gm=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,Im=(r,t,e)=>t in r?WE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qn=(r,t)=>{for(var e in t||(t={}))KE.call(t,e)&&Im(r,e,t[e]);if(Gm)for(var e of Gm(t))qE.call(t,e)&&Im(r,e,t[e]);return r},Zn=(r,t)=>VE(r,YE(t));const kr={extension:{type:S.ShapeBuilder,name:"circle"},build(r,t){let e,i,n,s,a,o;if(r.type==="circle"){const v=r;if(a=o=v.radius,a<=0)return!1;e=v.x,i=v.y,n=s=0}else if(r.type==="ellipse"){const v=r;if(a=v.halfWidth,o=v.halfHeight,a<=0||o<=0)return!1;e=v.x,i=v.y,n=s=0}else{const v=r,w=v.width/2,T=v.height/2;e=v.x+w,i=v.y+T,a=o=Math.max(0,Math.min(v.radius,Math.min(w,T))),n=w-a,s=T-o}if(n<0||s<0)return!1;const l=Math.ceil(2.3*Math.sqrt(a+o)),u=l*8+(n?4:0)+(s?4:0);if(u===0)return!1;if(l===0)return t[0]=t[6]=e+n,t[1]=t[3]=i+s,t[2]=t[4]=e-n,t[5]=t[7]=i-s,!0;let c=0,h=l*4+(n?2:0)+2,p=h,f=u,m=n+a,g=s,_=e+m,y=e-m,b=i+g;if(t[c++]=_,t[c++]=b,t[--h]=b,t[--h]=y,s){const v=i-g;t[p++]=y,t[p++]=v,t[--f]=v,t[--f]=_}for(let v=1;v<l;v++){const w=Math.PI/2*(v/l),T=n+Math.cos(w)*a,E=s+Math.sin(w)*o,P=e+T,M=e-T,C=i+E,A=i-E;t[c++]=P,t[c++]=C,t[--h]=C,t[--h]=M,t[p++]=M,t[p++]=A,t[--f]=A,t[--f]=P}m=n,g=s+o,_=e+m,y=e-m,b=i+g;const x=i-g;return t[c++]=_,t[c++]=b,t[--f]=x,t[--f]=_,n&&(t[c++]=y,t[c++]=b,t[--f]=x,t[--f]=y),!0},triangulate(r,t,e,i,n,s){if(r.length===0)return;let a=0,o=0;for(let c=0;c<r.length;c+=2)a+=r[c],o+=r[c+1];a/=r.length/2,o/=r.length/2;let l=i;t[l*e]=a,t[l*e+1]=o;const u=l++;for(let c=0;c<r.length;c+=2)t[l*e]=r[c],t[l*e+1]=r[c+1],c>0&&(n[s++]=l,n[s++]=u,n[s++]=l-1),l++;n[s++]=u+1,n[s++]=u,n[s++]=l-1}},Bm=Zn(qn({},kr),{extension:Zn(qn({},kr.extension),{name:"ellipse"})}),Fm=Zn(qn({},kr),{extension:Zn(qn({},kr.extension),{name:"roundedRectangle"})}),nl=1e-4,sl=1e-4;function Dm(r){const t=r.length;if(t<6)return 1;let e=0;for(let i=0,n=r[t-2],s=r[t-1];i<t;i+=2){const a=r[i],o=r[i+1];e+=(a-n)*(o+s),n=a,s=o}return e<0?-1:1}function Um(r,t,e,i,n,s,a,o){const l=r-e*n,u=t-i*n,c=r+e*s,h=t+i*s;let p,f;a?(p=i,f=-e):(p=-i,f=e);const m=l+p,g=u+f,_=c+p,y=h+f;return o.push(m,g),o.push(_,y),2}function ur(r,t,e,i,n,s,a,o){const l=e-r,u=i-t;let c=Math.atan2(l,u),h=Math.atan2(n-r,s-t);o&&c<h?c+=Math.PI*2:!o&&c>h&&(h+=Math.PI*2);let p=c;const f=h-c,m=Math.abs(f),g=Math.sqrt(l*l+u*u),_=(15*m*Math.sqrt(g)/Math.PI>>0)+1,y=f/_;if(p+=y,o){a.push(r,t),a.push(e,i);for(let b=1,x=p;b<_;b++,x+=y)a.push(r,t),a.push(r+Math.sin(x)*g,t+Math.cos(x)*g);a.push(r,t),a.push(n,s)}else{a.push(e,i),a.push(r,t);for(let b=1,x=p;b<_;b++,x+=y)a.push(r+Math.sin(x)*g,t+Math.cos(x)*g),a.push(r,t);a.push(n,s),a.push(r,t)}return _*2}function Qn(r,t,e,i,n,s){const a=nl;if(r.length===0)return;const o=t;let l=o.alignment;if(t.alignment!==.5){let j=Dm(r);e&&(j*=-1),l=(l-.5)*j+.5}const u=new lt(r[0],r[1]),c=new lt(r[r.length-2],r[r.length-1]),h=i,p=Math.abs(u.x-c.x)<a&&Math.abs(u.y-c.y)<a;if(h){r=r.slice(),p&&(r.pop(),r.pop(),c.set(r[r.length-2],r[r.length-1]));const j=(u.x+c.x)*.5,J=(c.y+u.y)*.5;r.unshift(j,J),r.push(j,J)}const f=n,m=r.length/2;let g=r.length;const _=f.length/2,y=o.width/2,b=y*y,x=o.miterLimit*o.miterLimit;let v=r[0],w=r[1],T=r[2],E=r[3],P=0,M=0,C=-(w-E),A=v-T,G=0,F=0,R=Math.sqrt(C*C+A*A);C/=R,A/=R,C*=y,A*=y;const B=l,O=(1-B)*2,I=B*2;h||(o.cap==="round"?g+=ur(v-C*(O-I)*.5,w-A*(O-I)*.5,v-C*O,w-A*O,v+C*I,w+A*I,f,!0)+2:o.cap==="square"&&(g+=Um(v,w,C,A,O,I,!0,f))),f.push(v-C*O,w-A*O),f.push(v+C*I,w+A*I);for(let j=1;j<m-1;++j){v=r[(j-1)*2],w=r[(j-1)*2+1],T=r[j*2],E=r[j*2+1],P=r[(j+1)*2],M=r[(j+1)*2+1],C=-(w-E),A=v-T,R=Math.sqrt(C*C+A*A),C/=R,A/=R,C*=y,A*=y,G=-(E-M),F=T-P,R=Math.sqrt(G*G+F*F),G/=R,F/=R,G*=y,F*=y;const J=T-v,K=w-E,X=T-P,k=M-E,$=J*X+K*k,z=K*X-k*J,rt=z<0;if(Math.abs(z)<.001*Math.abs($)){f.push(T-C*O,E-A*O),f.push(T+C*I,E+A*I),$>=0&&(o.join==="round"?g+=ur(T,E,T-C*O,E-A*O,T-G*O,E-F*O,f,!1)+4:g+=2,f.push(T-G*I,E-F*I),f.push(T+G*O,E+F*O));continue}const _t=(-C+v)*(-A+E)-(-C+T)*(-A+w),et=(-G+P)*(-F+E)-(-G+T)*(-F+M),st=(J*et-X*_t)/z,nt=(k*_t-K*et)/z,ot=(st-T)*(st-T)+(nt-E)*(nt-E),gt=T+(st-T)*O,yt=E+(nt-E)*O,pt=T-(st-T)*I,Y=E-(nt-E)*I,Rt=Math.min(J*J+K*K,X*X+k*k),Ct=rt?O:I,ce=Rt+Ct*Ct*b;ot<=ce?o.join==="bevel"||ot/b>x?(rt?(f.push(gt,yt),f.push(T+C*I,E+A*I),f.push(gt,yt),f.push(T+G*I,E+F*I)):(f.push(T-C*O,E-A*O),f.push(pt,Y),f.push(T-G*O,E-F*O),f.push(pt,Y)),g+=2):o.join==="round"?rt?(f.push(gt,yt),f.push(T+C*I,E+A*I),g+=ur(T,E,T+C*I,E+A*I,T+G*I,E+F*I,f,!0)+4,f.push(gt,yt),f.push(T+G*I,E+F*I)):(f.push(T-C*O,E-A*O),f.push(pt,Y),g+=ur(T,E,T-C*O,E-A*O,T-G*O,E-F*O,f,!1)+4,f.push(T-G*O,E-F*O),f.push(pt,Y)):(f.push(gt,yt),f.push(pt,Y)):(f.push(T-C*O,E-A*O),f.push(T+C*I,E+A*I),o.join==="round"?rt?g+=ur(T,E,T+C*I,E+A*I,T+G*I,E+F*I,f,!0)+2:g+=ur(T,E,T-C*O,E-A*O,T-G*O,E-F*O,f,!1)+2:o.join==="miter"&&ot/b<=x&&(rt?(f.push(pt,Y),f.push(pt,Y)):(f.push(gt,yt),f.push(gt,yt)),g+=2),f.push(T-G*O,E-F*O),f.push(T+G*I,E+F*I),g+=2)}v=r[(m-2)*2],w=r[(m-2)*2+1],T=r[(m-1)*2],E=r[(m-1)*2+1],C=-(w-E),A=v-T,R=Math.sqrt(C*C+A*A),C/=R,A/=R,C*=y,A*=y,f.push(T-C*O,E-A*O),f.push(T+C*I,E+A*I),h||(o.cap==="round"?g+=ur(T-C*(O-I)*.5,E-A*(O-I)*.5,T-C*O,E-A*O,T+C*I,E+A*I,f,!1)+2:o.cap==="square"&&(g+=Um(T,E,C,A,O,I,!1,f)));const L=sl*sl;for(let j=_;j<g+_-2;++j)v=f[j*2],w=f[j*2+1],T=f[(j+1)*2],E=f[(j+1)*2+1],P=f[(j+2)*2],M=f[(j+2)*2+1],!(Math.abs(v*(E-M)+T*(M-w)+P*(w-E))<L)&&s.push(j,j+1,j+2)}function $m(r,t,e,i){const n=nl;if(r.length===0)return;const s=r[0],a=r[1],o=r[r.length-2],l=r[r.length-1],u=t||Math.abs(s-o)<n&&Math.abs(a-l)<n,c=e,h=r.length/2,p=c.length/2;for(let f=0;f<h;f++)c.push(r[f*2]),c.push(r[f*2+1]);for(let f=0;f<h-1;f++)i.push(p+f,p+f+1);u&&i.push(p+h-1,p)}function al(r,t,e,i,n,s,a){const o=xf(r,t,2);if(!o)return;for(let u=0;u<o.length;u+=3)s[a++]=o[u]+n,s[a++]=o[u+1]+n,s[a++]=o[u+2]+n;let l=n*i;for(let u=0;u<r.length;u+=2)e[l]=r[u],e[l+1]=r[u+1],l+=i}const ZE=[],km={extension:{type:S.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return!0},triangulate(r,t,e,i,n,s){al(r,ZE,t,e,i,n,s)}},Lm={extension:{type:S.ShapeBuilder,name:"rectangle"},build(r,t){const e=r,i=e.x,n=e.y,s=e.width,a=e.height;return s>0&&a>0?(t[0]=i,t[1]=n,t[2]=i+s,t[3]=n,t[4]=i+s,t[5]=n+a,t[6]=i,t[7]=n+a,!0):!1},triangulate(r,t,e,i,n,s){let a=0;i*=e,t[i+a]=r[0],t[i+a+1]=r[1],a+=e,t[i+a]=r[2],t[i+a+1]=r[3],a+=e,t[i+a]=r[6],t[i+a+1]=r[7],a+=e,t[i+a]=r[4],t[i+a+1]=r[5],a+=e;const o=i/e;n[s++]=o,n[s++]=o+1,n[s++]=o+2,n[s++]=o+1,n[s++]=o+3,n[s++]=o+2}},Nm={extension:{type:S.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,!0},triangulate(r,t,e,i,n,s){let a=0;i*=e,t[i+a]=r[0],t[i+a+1]=r[1],a+=e,t[i+a]=r[2],t[i+a+1]=r[3],a+=e,t[i+a]=r[4],t[i+a+1]=r[5];const o=i/e;n[s++]=o,n[s++]=o+1,n[s++]=o+2}};var QE=Object.defineProperty,Xm=Object.getOwnPropertySymbols,JE=Object.prototype.hasOwnProperty,tP=Object.prototype.propertyIsEnumerable,jm=(r,t,e)=>t in r?QE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Hm=(r,t)=>{for(var e in t||(t={}))JE.call(t,e)&&jm(r,e,t[e]);if(Xm)for(var e of Xm(t))tP.call(t,e)&&jm(r,e,t[e]);return r};const zm=[{offset:0,color:"white"},{offset:1,color:"black"}],ol=class Ah{constructor(...t){this.uid=ht("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];var e;let i=eP(t);const n=i.type==="radial"?Ah.defaultRadialOptions:Ah.defaultLinearOptions;i=Hm(Hm({},n),he(i)),this._textureSize=i.textureSize,this._wrapMode=i.wrapMode,i.type==="radial"?(this.center=i.center,this.outerCenter=(e=i.outerCenter)!=null?e:this.center,this.innerRadius=i.innerRadius,this.outerRadius=i.outerRadius,this.scale=i.scale,this.rotation=i.rotation):(this.start=i.start,this.end=i.end),this.textureSpace=i.textureSpace,this.type=i.type,i.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:tt.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:n}=this.end,s=i-t,a=n-e;const o=s<0||a<0;if(this._wrapMode==="clamp-to-edge"){if(s<0){const _=t;t=i,i=_,s*=-1}if(a<0){const _=e;e=n,n=_,a*=-1}}const l=this.colorStops.length?this.colorStops:zm,u=this._textureSize,{canvas:c,context:h}=Vm(u,1),p=o?h.createLinearGradient(this._textureSize,0,0,0):h.createLinearGradient(0,0,this._textureSize,0);Wm(p,l),h.fillStyle=p,h.fillRect(0,0,u,1),this.texture=new D({source:new ke({resource:c,addressMode:this._wrapMode})});const f=Math.sqrt(s*s+a*a),m=Math.atan2(a,s),g=new U;g.scale(f/u,1),g.rotate(m),g.translate(t,e),this.textureSpace==="local"&&g.scale(u,u),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:zm,e=this._textureSize,{canvas:i,context:n}=Vm(e,e),{x:s,y:a}=this.center,{x:o,y:l}=this.outerCenter,u=this.innerRadius,c=this.outerRadius,h=o-c,p=l-c,f=e/(c*2),m=(s-h)*f,g=(a-p)*f,_=n.createRadialGradient(m,g,u*f,(o-h)*f,(l-p)*f,c*f);Wm(_,t),n.fillStyle=t[t.length-1].color,n.fillRect(0,0,e,e),n.fillStyle=_,n.translate(m,g),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-m,-g),n.fillRect(0,0,e,e),this.texture=new D({source:new ke({resource:i,addressMode:this._wrapMode})});const y=new U;this.textureSpace==="local"?y.scale(2*c,2*c):y.scale(1/f,1/f),y.translate(h,p),this.transform=y}destroy(){var t;(t=this.texture)==null||t.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}`}};ol.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},ol.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 $t=ol;function Wm(r,t){for(let e=0;e<t.length;e++){const i=t[e];r.addColorStop(i.offset,i.color)}}function Vm(r,t){const e=H.get().createCanvas(r,t),i=e.getContext("2d");return{canvas:e,context:i}}function eP(r){var t,e;let i=(t=r[0])!=null?t:{};return(typeof i=="number"||r[1])&&(i={type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:(e=r[5])!=null?e:$t.defaultLinearOptions.textureSize}),i}const rP=new U,iP=new ut;function ll(r,t,e,i){const n=t.matrix?r.copyFrom(t.matrix).invert():r.identity();if(t.textureSpace==="local"){const a=e.getBounds(iP);t.width&&a.pad(t.width);const{x:o,y:l}=a,u=1/a.width,c=1/a.height,h=-o*u,p=-l*c,f=n.a,m=n.b,g=n.c,_=n.d;n.a*=u,n.b*=u,n.c*=c,n.d*=c,n.tx=h*f+p*g+n.tx,n.ty=h*m+p*_+n.ty}else n.translate(t.texture.frame.x,t.texture.frame.y),n.scale(1/t.texture.source.width,1/t.texture.source.height);const s=t.texture.source.style;return!(t.fill instanceof $t)&&s.addressMode==="clamp-to-edge"&&(s.addressMode="repeat",s.update()),i&&n.append(rP.copyFrom(i).invert()),n}const Ne={};N.handleByMap(S.ShapeBuilder,Ne),N.add(Lm,km,Nm,kr,Bm,Fm);const nP=new ut,sP=new U;function Ym(r,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let n=0;n<r.instructions.length;n++){const s=r.instructions[n];if(s.action==="texture")aP(s.data,i,e);else if(s.action==="fill"||s.action==="stroke"){const a=s.action==="stroke",o=s.data.path.shapePath,l=s.data.style,u=s.data.hole;a&&u&&Km(u.shapePath,l,!0,i,e),u&&(o.shapePrimitives[o.shapePrimitives.length-1].holes=u.shapePath.shapePrimitives),Km(o,l,a,i,e)}}}function aP(r,t,e){const i=[],n=Ne.rectangle,s=nP;s.x=r.dx,s.y=r.dy,s.width=r.dw,s.height=r.dh;const a=r.transform;if(!n.build(s,i))return;const{vertices:o,uvs:l,indices:u}=e,c=u.length,h=o.length/2;a&&Yn(i,a),n.triangulate(i,o,2,h,u,c);const p=r.image,f=p.uvs;l.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);const m=Pt.get(Kn);m.indexOffset=c,m.indexSize=u.length-c,m.attributeOffset=h,m.attributeSize=o.length/2-h,m.baseColor=r.style,m.alpha=r.alpha,m.texture=p,m.geometryData=e,t.push(m)}function Km(r,t,e,i,n){const{vertices:s,uvs:a,indices:o}=n;r.shapePrimitives.forEach(({shape:l,transform:u,holes:c})=>{var h;const p=[],f=Ne[l.type];if(!f.build(l,p))return;const m=o.length,g=s.length/2;let _="triangle-list";if(u&&Yn(p,u),e){const v=(h=l.closePath)!=null?h:!0,w=t;w.pixelLine?($m(p,v,s,o),_="line-list"):Qn(p,w,!1,v,s,o)}else if(c){const v=[],w=p.slice();oP(c).forEach(T=>{v.push(w.length/2),w.push(...T)}),al(w,v,s,2,g,o,m)}else f.triangulate(p,s,2,g,o,m);const y=a.length/2,b=t.texture;if(b!==D.WHITE){const v=ll(sP,t,l,u);rl(s,2,g,a,y,2,s.length/2-g,v)}else il(a,y,2,s.length/2-g);const x=Pt.get(Kn);x.indexOffset=m,x.indexSize=o.length-m,x.attributeOffset=g,x.attributeSize=s.length/2-g,x.baseColor=t.color,x.alpha=t.alpha,x.texture=b,x.geometryData=n,x.topology=_,i.push(x)})}function oP(r){const t=[];for(let e=0;e<r.length;e++){const i=r[e].shape,n=[];Ne[i.type].build(i,n)&&t.push(n)}return t}class qm{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{Pt.return(t)}),this.graphicsData&&Pt.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 Zm{constructor(){this.instructions=new dn}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new Vn({maxTextures:e}),this.instructions.reset()}get geometry(){return this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const ul=class Ch{constructor(t){this._renderer=t,this._managedContexts=new Ut({renderer:t,type:"resource",name:"graphicsContext"})}init(t){var e;Ch.defaultOptions.bezierSmoothness=(e=t==null?void 0:t.bezierSmoothness)!=null?e:Ch.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],i=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&i.reset(),Ym(t,i);const n=t.batchMode;t.customShader||n==="no-batch"?i.isBatchable=!1:n==="auto"?i.isBatchable=i.geometryData.vertices.length<400:i.isBatchable=!0,t.dirty=!1}return i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=Pt.get(Zm,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:n,geometryData:s}=i;i.graphicsData=e;const a=s.vertices.length,o=s.indices.length;for(let h=0;h<n.length;h++)n[h].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(a),l.ensureIndexBuffer(o),l.begin();for(let h=0;h<n.length;h++){const p=n[h];l.add(p)}l.finish(e.instructions);const u=l.geometry;u.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),u.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const c=l.batches;for(let h=0;h<c.length;h++){const p=c[h];p.bindGroup=kn(p.textures.textures,p.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new qm;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};ul.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"graphicsContext"},ul.defaultOptions={bezierSmoothness:.5};let Jn=ul;const lP=8,ts=11920929e-14,uP=1,cl=.01,Lr=0,cr=0;function hl(r,t,e,i,n,s,a,o,l,u){const c=Math.min(.99,Math.max(0,u!=null?u:Jn.defaultOptions.bezierSmoothness));let h=(uP-c)/1;return h*=h,cP(t,e,i,n,s,a,o,l,r,h),r}function cP(r,t,e,i,n,s,a,o,l,u){dl(r,t,e,i,n,s,a,o,l,u,0),l.push(a,o)}function dl(r,t,e,i,n,s,a,o,l,u,c){if(c>lP)return;const h=Math.PI,p=(r+e)/2,f=(t+i)/2,m=(e+n)/2,g=(i+s)/2,_=(n+a)/2,y=(s+o)/2,b=(p+m)/2,x=(f+g)/2,v=(m+_)/2,w=(g+y)/2,T=(b+v)/2,E=(x+w)/2;if(c>0){let P=a-r,M=o-t;const C=Math.abs((e-a)*M-(i-o)*P),A=Math.abs((n-a)*M-(s-o)*P);let G,F;if(C>ts&&A>ts){if((C+A)*(C+A)<=u*(P*P+M*M)){if(Lr<cl){l.push(T,E);return}const R=Math.atan2(s-i,n-e);if(G=Math.abs(R-Math.atan2(i-t,e-r)),F=Math.abs(Math.atan2(o-s,a-n)-R),G>=h&&(G=2*h-G),F>=h&&(F=2*h-F),G+F<Lr){l.push(T,E);return}if(cr!==0){if(G>cr){l.push(e,i);return}if(F>cr){l.push(n,s);return}}}}else if(C>ts){if(C*C<=u*(P*P+M*M)){if(Lr<cl){l.push(T,E);return}if(G=Math.abs(Math.atan2(s-i,n-e)-Math.atan2(i-t,e-r)),G>=h&&(G=2*h-G),G<Lr){l.push(e,i),l.push(n,s);return}if(cr!==0&&G>cr){l.push(e,i);return}}}else if(A>ts){if(A*A<=u*(P*P+M*M)){if(Lr<cl){l.push(T,E);return}if(G=Math.abs(Math.atan2(o-s,a-n)-Math.atan2(s-i,n-e)),G>=h&&(G=2*h-G),G<Lr){l.push(e,i),l.push(n,s);return}if(cr!==0&&G>cr){l.push(n,s);return}}}else if(P=T-(r+a)/2,M=E-(t+o)/2,P*P+M*M<=u){l.push(T,E);return}}dl(r,t,p,f,b,x,T,E,l,u,c+1),dl(T,E,v,w,_,y,a,o,l,u,c+1)}const hP=8,dP=11920929e-14,pP=1,fP=.01,Qm=0;function Jm(r,t,e,i,n,s,a,o){const l=Math.min(.99,Math.max(0,o!=null?o:Jn.defaultOptions.bezierSmoothness));let u=(pP-l)/1;return u*=u,mP(t,e,i,n,s,a,r,u),r}function mP(r,t,e,i,n,s,a,o){pl(a,r,t,e,i,n,s,o,0),a.push(n,s)}function pl(r,t,e,i,n,s,a,o,l){if(l>hP)return;const u=Math.PI,c=(t+i)/2,h=(e+n)/2,p=(i+s)/2,f=(n+a)/2,m=(c+p)/2,g=(h+f)/2;let _=s-t,y=a-e;const b=Math.abs((i-s)*y-(n-a)*_);if(b>dP){if(b*b<=o*(_*_+y*y)){if(Qm<fP){r.push(m,g);return}let x=Math.abs(Math.atan2(a-n,s-i)-Math.atan2(n-e,i-t));if(x>=u&&(x=2*u-x),x<Qm){r.push(m,g);return}}}else if(_=m-(t+s)/2,y=g-(e+a)/2,_*_+y*y<=o){r.push(m,g);return}pl(r,t,e,c,h,m,g,o,l+1),pl(r,m,g,p,f,s,a,o,l+1)}function fl(r,t,e,i,n,s,a,o){let l=Math.abs(n-s);(!a&&n>s||a&&s>n)&&(l=2*Math.PI-l),o||(o=Math.max(6,Math.floor(6*Math.pow(i,.3333333333333333)*(l/Math.PI)))),o=Math.max(o,3);let u=l/o,c=n;u*=a?-1:1;for(let h=0;h<o+1;h++){const p=Math.cos(c),f=Math.sin(c),m=t+p*i,g=e+f*i;r.push(m,g),c+=u}}function tg(r,t,e,i,n,s){const a=r[r.length-2],o=r[r.length-1]-e,l=a-t,u=n-e,c=i-t,h=Math.abs(o*c-l*u);if(h<1e-8||s===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}const p=o*o+l*l,f=u*u+c*c,m=o*u+l*c,g=s*Math.sqrt(p)/h,_=s*Math.sqrt(f)/h,y=g*m/p,b=_*m/f,x=g*c+_*l,v=g*u+_*o,w=l*(_+y),T=o*(_+y),E=c*(g+b),P=u*(g+b),M=Math.atan2(T-v,w-x),C=Math.atan2(P-v,E-x);fl(r,x+t,v+e,s,M,C,l*u>c*o)}const Ii=Math.PI*2,ml={centerX:0,centerY:0,ang1:0,ang2:0},gl=({x:r,y:t},e,i,n,s,a,o,l)=>{r*=e,t*=i;const u=n*r-s*t,c=s*r+n*t;return l.x=u+a,l.y=c+o,l};function gP(r,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,n=Math.cos(r),s=Math.sin(r),a=Math.cos(r+t),o=Math.sin(r+t);return[{x:n-s*i,y:s+n*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}const eg=(r,t,e,i)=>{const n=r*i-t*e<0?-1:1;let s=r*e+t*i;return s>1&&(s=1),s<-1&&(s=-1),n*Math.acos(s)},_P=(r,t,e,i,n,s,a,o,l,u,c,h,p)=>{const f=Math.pow(n,2),m=Math.pow(s,2),g=Math.pow(c,2),_=Math.pow(h,2);let y=f*m-f*_-m*g;y<0&&(y=0),y/=f*_+m*g,y=Math.sqrt(y)*(a===o?-1:1);const b=y*n/s*h,x=y*-s/n*c,v=u*b-l*x+(r+e)/2,w=l*b+u*x+(t+i)/2,T=(c-b)/n,E=(h-x)/s,P=(-c-b)/n,M=(-h-x)/s,C=eg(1,0,T,E);let A=eg(T,E,P,M);o===0&&A>0&&(A-=Ii),o===1&&A<0&&(A+=Ii),p.centerX=v,p.centerY=w,p.ang1=C,p.ang2=A};function rg(r,t,e,i,n,s,a,o=0,l=0,u=0){if(s===0||a===0)return;const c=Math.sin(o*Ii/360),h=Math.cos(o*Ii/360),p=h*(t-i)/2+c*(e-n)/2,f=-c*(t-i)/2+h*(e-n)/2;if(p===0&&f===0)return;s=Math.abs(s),a=Math.abs(a);const m=Math.pow(p,2)/Math.pow(s,2)+Math.pow(f,2)/Math.pow(a,2);m>1&&(s*=Math.sqrt(m),a*=Math.sqrt(m)),_P(t,e,i,n,s,a,l,u,c,h,p,f,ml);let{ang1:g,ang2:_}=ml;const{centerX:y,centerY:b}=ml;let x=Math.abs(_)/(Ii/4);Math.abs(1-x)<1e-7&&(x=1);const v=Math.max(Math.ceil(x),1);_/=v;let w=r[r.length-2],T=r[r.length-1];const E={x:0,y:0};for(let P=0;P<v;P++){const M=gP(g,_),{x:C,y:A}=gl(M[0],s,a,h,c,y,b,E),{x:G,y:F}=gl(M[1],s,a,h,c,y,b,E),{x:R,y:B}=gl(M[2],s,a,h,c,y,b,E);hl(r,w,T,C,A,G,F,R,B),w=R,T=B,g+=_}}function ig(r,t,e){var i;const n=(o,l)=>{const u=l.x-o.x,c=l.y-o.y,h=Math.sqrt(u*u+c*c),p=u/h,f=c/h;return{len:h,nx:p,ny:f}},s=(o,l)=>{o===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y)};let a=t[t.length-1];for(let o=0;o<t.length;o++){const l=t[o%t.length],u=(i=l.radius)!=null?i:e;if(u<=0){s(o,l),a=l;continue}const c=t[(o+1)%t.length],h=n(l,a),p=n(l,c);if(h.len<1e-4||p.len<1e-4){s(o,l),a=l;continue}let f=Math.asin(h.nx*p.ny-h.ny*p.nx),m=1,g=!1;h.nx*p.nx-h.ny*-p.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,m=-1,g=!0):f>0&&(m=-1,g=!0);const _=f/2;let y,b=Math.abs(Math.cos(_)*u/Math.sin(_));b>Math.min(h.len/2,p.len/2)?(b=Math.min(h.len/2,p.len/2),y=Math.abs(b*Math.sin(_)/Math.cos(_))):y=u;const x=l.x+p.nx*b+-p.ny*y*m,v=l.y+p.ny*b+p.nx*y*m,w=Math.atan2(h.ny,h.nx)+Math.PI/2*m,T=Math.atan2(p.ny,p.nx)-Math.PI/2*m;o===0&&r.moveTo(x+Math.cos(w)*y,v+Math.sin(w)*y),r.arc(x,v,y,w,T,g),a=l}}function ng(r,t,e,i){var n;const s=(l,u)=>Math.sqrt((l.x-u.x)**2+(l.y-u.y)**2),a=(l,u,c)=>({x:l.x+(u.x-l.x)*c,y:l.y+(u.y-l.y)*c}),o=t.length;for(let l=0;l<o;l++){const u=t[(l+1)%o],c=(n=u.radius)!=null?n:e;if(c<=0){l===0?r.moveTo(u.x,u.y):r.lineTo(u.x,u.y);continue}const h=t[l],p=t[(l+2)%o],f=s(h,u);let m;if(f<1e-4)m=u;else{const y=Math.min(f/2,c);m=a(u,h,y/f)}const g=s(p,u);let _;if(g<1e-4)_=u;else{const y=Math.min(g/2,c);_=a(u,p,y/g)}l===0?r.moveTo(m.x,m.y):r.lineTo(m.x,m.y),r.quadraticCurveTo(u.x,u.y,_.x,_.y,i)}}const yP=new ut;class sg{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Mt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,n=i[i.length-2],s=i[i.length-1];return(n!==t||s!==e)&&i.push(t,e),this}arc(t,e,i,n,s,a){this._ensurePoly(!1);const o=this._currentPoly.points;return fl(o,t,e,i,n,s,a),this}arcTo(t,e,i,n,s){this._ensurePoly();const a=this._currentPoly.points;return tg(a,t,e,i,n,s),this}arcToSvg(t,e,i,n,s,a,o){const l=this._currentPoly.points;return rg(l,this._currentPoly.lastX,this._currentPoly.lastY,a,o,t,e,i,n,s),this}bezierCurveTo(t,e,i,n,s,a,o){this._ensurePoly();const l=this._currentPoly;return hl(this._currentPoly.points,l.lastX,l.lastY,t,e,i,n,s,a,o),this}quadraticCurveTo(t,e,i,n,s){this._ensurePoly();const a=this._currentPoly;return Jm(this._currentPoly.points,a.lastX,a.lastY,t,e,i,n,s),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const i=this.shapePrimitives,n=i.length;for(let s=0;s<t.instructions.length;s++){const a=t.instructions[s];this[a.action](...a.data)}if(t.checkForHoles&&i.length-n>1){let s=null;for(let a=n;a<i.length;a++){const o=i[a];if(o.shape.type==="polygon"){const l=o.shape,u=s==null?void 0:s.shape;u&&u.containsPolygon(l)?(s.holes||(s.holes=[]),s.holes.push(o),i.copyWithin(a,a+1),i.length--,a--):s=o}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,n,s){return this.drawShape(new ut(t,e,i,n),s),this}circle(t,e,i,n){return this.drawShape(new Pn(t,e,i),n),this}poly(t,e,i){const n=new Pr(t);return n.closePath=e,this.drawShape(n,i),this}regularPoly(t,e,i,n,s=0,a){n=Math.max(n|0,3);const o=-1*Math.PI/2+s,l=Math.PI*2/n,u=[];for(let c=0;c<n;c++){const h=o-c*l;u.push(t+i*Math.cos(h),e+i*Math.sin(h))}return this.poly(u,!0,a),this}roundPoly(t,e,i,n,s,a=0,o){if(n=Math.max(n|0,3),s<=0)return this.regularPoly(t,e,i,n,a);const l=i*Math.sin(Math.PI/n)-.001;s=Math.min(s,l);const u=-1*Math.PI/2+a,c=Math.PI*2/n,h=(n-2)*Math.PI/n/2;for(let p=0;p<n;p++){const f=p*c+u,m=t+i*Math.cos(f),g=e+i*Math.sin(f),_=f+Math.PI+h,y=f-Math.PI-h,b=m+s*Math.cos(_),x=g+s*Math.sin(_),v=m+s*Math.cos(y),w=g+s*Math.sin(y);p===0?this.moveTo(b,x):this.lineTo(b,x),this.quadraticCurveTo(m,g,v,w,o)}return this.closePath()}roundShape(t,e,i=!1,n){return t.length<3?this:(i?ng(this,t,e,n):ig(this,t,e),this.closePath())}filletRect(t,e,i,n,s){if(s===0)return this.rect(t,e,i,n);const a=Math.min(i,n)/2,o=Math.min(a,Math.max(-a,s)),l=t+i,u=e+n,c=o<0?-o:0,h=Math.abs(o);return this.moveTo(t,e+h).arcTo(t+c,e+c,t+h,e,h).lineTo(l-h,e).arcTo(l-c,e+c,l,e+h,h).lineTo(l,u-h).arcTo(l-c,u-c,t+i-h,u,h).lineTo(t+h,u).arcTo(t+c,u-c,t,u-h,h).closePath()}chamferRect(t,e,i,n,s,a){if(s<=0)return this.rect(t,e,i,n);const o=Math.min(s,Math.min(i,n)/2),l=t+i,u=e+n,c=[t+o,e,l-o,e,l,e+o,l,u-o,l-o,u,t+o,u,t,u-o,t,e+o];for(let h=c.length-1;h>=2;h-=2)c[h]===c[h-2]&&c[h-1]===c[h-3]&&c.splice(h-1,2);return this.poly(c,!0,a)}ellipse(t,e,i,n,s){return this.drawShape(new An(t,e,i,n),s),this}roundRect(t,e,i,n,s,a){return this.drawShape(new Mn(t,e,i,n,s),a),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Pr,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Pr,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,n=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const s=e.transform,a=i;i=s.a*i+s.c*n+s.tx,n=s.b*a+s.d*n+s.ty}this._currentPoly.points.push(i,n)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const n=e[i],s=n.shape.getBounds(yP);n.transform?t.addRect(s,n.transform):t.addRect(s)}return t}}class ge{constructor(t,e=!1){this.instructions=[],this.uid=ht("graphicsPath"),this._dirty=!0;var i;this.checkForHoles=e,typeof t=="string"?tm(t,this):this.instructions=(i=t==null?void 0:t.slice())!=null?i:[]}get shapePath(){return this._shapePath||(this._shapePath=new sg(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,n,s){const a=this.instructions[this.instructions.length-1],o=this.getLastPoint(lt.shared);let l=0,u=0;if(!a||a.action!=="bezierCurveTo")l=o.x,u=o.y;else{l=a.data[2],u=a.data[3];const c=o.x,h=o.y;l=c+(c-l),u=h+(h-u)}return this.instructions.push({action:"bezierCurveTo",data:[l,u,t,e,i,n,s]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){const n=this.instructions[this.instructions.length-1],s=this.getLastPoint(lt.shared);let a=0,o=0;if(!n||n.action!=="quadraticCurveTo")a=s.x,o=s.y;else{a=n.data[0],o=n.data[1];const l=s.x,u=s.y;a=l+(l-a),o=u+(u-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,t,e,i]}),this._dirty=!0,this}rect(t,e,i,n,s){return this.instructions.push({action:"rect",data:[t,e,i,n,s]}),this._dirty=!0,this}circle(t,e,i,n){return this.instructions.push({action:"circle",data:[t,e,i,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,n,s,a,o){s||(s=n/2);const l=-1*Math.PI/2+a,u=i*2,c=Math.PI*2/u,h=[];for(let p=0;p<u;p++){const f=p%2?s:n,m=p*c+l;h.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(h,!0,o),this}clone(t=!1){const e=new ge;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){const n=this.instructions[i];e.instructions.push({action:n.action,data:n.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,i=t.b,n=t.c,s=t.d,a=t.tx,o=t.ty;let l=0,u=0,c=0,h=0,p=0,f=0,m=0,g=0;for(let _=0;_<this.instructions.length;_++){const y=this.instructions[_],b=y.data;switch(y.action){case"moveTo":case"lineTo":l=b[0],u=b[1],b[0]=e*l+n*u+a,b[1]=i*l+s*u+o;break;case"bezierCurveTo":c=b[0],h=b[1],p=b[2],f=b[3],l=b[4],u=b[5],b[0]=e*c+n*h+a,b[1]=i*c+s*h+o,b[2]=e*p+n*f+a,b[3]=i*p+s*f+o,b[4]=e*l+n*u+a,b[5]=i*l+s*u+o;break;case"quadraticCurveTo":c=b[0],h=b[1],l=b[2],u=b[3],b[0]=e*c+n*h+a,b[1]=i*c+s*h+o,b[2]=e*l+n*u+a,b[3]=i*l+s*u+o;break;case"arcToSvg":l=b[5],u=b[6],m=b[0],g=b[1],b[0]=e*m+n*g,b[1]=i*m+s*g,b[5]=e*l+n*u+a,b[6]=i*l+s*u+o;break;case"circle":b[4]=Nr(b[3],t);break;case"rect":b[4]=Nr(b[4],t);break;case"ellipse":b[8]=Nr(b[8],t);break;case"roundRect":b[5]=Nr(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=Nr(b[2],t);break;case"regularPoly":case"chamferRect":b[5]=Nr(b[5],t);break;case"closePath":break;default:break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}function Nr(r,t){return r?r.prepend(t):t.clone()}let _l=0;const ag=500;function ue(...r){_l!==ag&&(_l++,_l===ag?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}function Tt(r,t,e){const i=r.getAttribute(t);return i?Number(i):e}function og(r,t){const e=r.querySelectorAll("defs");for(let i=0;i<e.length;i++){const n=e[i];for(let s=0;s<n.children.length;s++){const a=n.children[s];switch(a.nodeName.toLowerCase()){case"lineargradient":t.defs[a.id]=bP(a);break;case"radialgradient":t.defs[a.id]=vP(a);break;default:break}}}}function bP(r){const t=Tt(r,"x1",0),e=Tt(r,"y1",0),i=Tt(r,"x2",1),n=Tt(r,"y2",0),s=r.getAttribute("gradientUnits")||"objectBoundingBox",a=new $t(t,e,i,n,s==="objectBoundingBox"?"local":"global");for(let o=0;o<r.children.length;o++){const l=r.children[o],u=Tt(l,"offset",0),c=tt.shared.setValue(l.getAttribute("stop-color")).toNumber();a.addColorStop(u,c)}return a}function vP(r){return new $t(0,0,1,0)}function yl(r){const t=r.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const bl={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 vl(r,t){const e=r.getAttribute("style"),i={},n={},s={strokeStyle:i,fillStyle:n,useFill:!1,useStroke:!1};for(const a in bl){const o=r.getAttribute(a);o&&lg(t,s,a,o.trim())}if(e){const a=e.split(";");for(let o=0;o<a.length;o++){const l=a[o].trim(),[u,c]=l.split(":");bl[u]&&lg(t,s,u,c.trim())}}return{strokeStyle:s.useStroke?i:null,fillStyle:s.useFill?n:null,useFill:s.useFill,useStroke:s.useStroke}}function lg(r,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){const n=yl(i);t.strokeStyle.fill=r.defs[n]}else t.strokeStyle.color=tt.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){const n=yl(i);t.fillStyle.fill=r.defs[n]}else t.fillStyle.color=tt.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}function ug(r){if(r.length<=2)return!0;const t=r.map(o=>o.area).sort((o,l)=>l-o),[e,i]=t,n=t[t.length-1],s=e/i,a=i/n;return!(s>3&&a<2)}function xP(r,t=0){const e=r.instructions[t];if(!e||e.action!=="fill")throw new Error(`Expected fill instruction at index ${t}, got ${(e==null?void 0:e.action)||"undefined"}`);return e.data}function cg(r){return r.split(/(?=[Mm])/).filter(t=>t.trim().length>0)}function hg(r){const t=r.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),i=[],n=[];for(let u=0;u<e.length;u+=2)u+1<e.length&&(i.push(e[u]),n.push(e[u+1]));if(i.length===0||n.length===0)return 0;const s=Math.min(...i),a=Math.max(...i),o=Math.min(...n),l=Math.max(...n);return(a-s)*(l-o)}function xl(r,t){const e=new ge(r,!1);for(const i of e.instructions)t.instructions.push(i)}var TP=Object.defineProperty,dg=Object.getOwnPropertySymbols,SP=Object.prototype.hasOwnProperty,wP=Object.prototype.propertyIsEnumerable,pg=(r,t,e)=>t in r?TP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,es=(r,t)=>{for(var e in t||(t={}))SP.call(t,e)&&pg(r,e,t[e]);if(dg)for(var e of dg(t))wP.call(t,e)&&pg(r,e,t[e]);return r};function fg(r,t){if(typeof r=="string"){const a=document.createElement("div");a.innerHTML=r.trim(),r=a.querySelector("svg")}const e={context:t,defs:{},path:new ge};og(r,e);const i=r.children,{fillStyle:n,strokeStyle:s}=vl(r,e);for(let a=0;a<i.length;a++){const o=i[a];o.nodeName.toLowerCase()!=="defs"&&mg(o,e,n,s)}return t}function mg(r,t,e,i){const n=r.children,{fillStyle:s,strokeStyle:a}=vl(r,t);s&&e?e=es(es({},e),s):s&&(e=s),a&&i?i=es(es({},i),a):a&&(i=a);const o=!e&&!i;o&&(e={color:0});let l,u,c,h,p,f,m,g,_,y,b,x,v,w,T,E,P;switch(r.nodeName.toLowerCase()){case"path":{w=r.getAttribute("d");const M=r.getAttribute("fill-rule"),C=cg(w),A=M==="evenodd",G=C.length>1;if(A&&G){const F=C.map(R=>({path:R,area:hg(R)}));if(F.sort((R,B)=>B.area-R.area),C.length>3||!ug(F))for(let R=0;R<F.length;R++){const B=F[R],O=R===0;t.context.beginPath();const I=new ge(void 0,!0);xl(B.path,I),t.context.path(I),O?(e&&t.context.fill(e),i&&t.context.stroke(i)):t.context.cut()}else for(let R=0;R<F.length;R++){const B=F[R],O=R%2===1;t.context.beginPath();const I=new ge(void 0,!0);xl(B.path,I),t.context.path(I),O?t.context.cut():(e&&t.context.fill(e),i&&t.context.stroke(i))}}else{const F=M?M==="evenodd":!0;T=new ge(w,F),t.context.path(T),e&&t.context.fill(e),i&&t.context.stroke(i)}break}case"circle":m=Tt(r,"cx",0),g=Tt(r,"cy",0),_=Tt(r,"r",0),t.context.ellipse(m,g,_,_),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":l=Tt(r,"x",0),u=Tt(r,"y",0),E=Tt(r,"width",0),P=Tt(r,"height",0),y=Tt(r,"rx",0),b=Tt(r,"ry",0),y||b?t.context.roundRect(l,u,E,P,y||b):t.context.rect(l,u,E,P),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":m=Tt(r,"cx",0),g=Tt(r,"cy",0),y=Tt(r,"rx",0),b=Tt(r,"ry",0),t.context.beginPath(),t.context.ellipse(m,g,y,b),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Tt(r,"x1",0),h=Tt(r,"y1",0),p=Tt(r,"x2",0),f=Tt(r,"y2",0),t.context.beginPath(),t.context.moveTo(c,h),t.context.lineTo(p,f),i&&t.context.stroke(i);break;case"polygon":v=r.getAttribute("points"),x=v.match(/-?\d+/g).map(M=>parseInt(M,10)),t.context.poly(x,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":v=r.getAttribute("points"),x=v.match(/-?\d+/g).map(M=>parseInt(M,10)),t.context.poly(x,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{ue(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}o&&(e=null);for(let M=0;M<n.length;M++)mg(n[M],t,e,i)}function EP(r){return r.texture!==void 0}const gg={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 Xr{constructor(t,e){this.uid=ht("fillPattern"),this._tick=0,this.transform=new U;var i;const n=EP(t)?t:{texture:t,repetition:e};this.texture=n.texture,this.textureSpace=(i=n.textureSpace)!=null?i:"global";const s=n.repetition;s&&(this.texture.source.style.addressModeU=gg[s].addressModeU,this.texture.source.style.addressModeV=gg[s].addressModeV)}setTransform(t){if(t){if(this.transform.equals(t))return;this.transform.copyFrom(t)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}var PP=Object.defineProperty,rs=Object.getOwnPropertySymbols,_g=Object.prototype.hasOwnProperty,yg=Object.prototype.propertyIsEnumerable,bg=(r,t,e)=>t in r?PP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_e=(r,t)=>{for(var e in t||(t={}))_g.call(t,e)&&bg(r,e,t[e]);if(rs)for(var e of rs(t))yg.call(t,e)&&bg(r,e,t[e]);return r},AP=(r,t)=>{var e={};for(var i in r)_g.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&rs)for(var i of rs(r))t.indexOf(i)<0&&yg.call(r,i)&&(e[i]=r[i]);return e};function CP(r){return tt.isColorLike(r)}function vg(r){return r instanceof Xr}function xg(r){return r instanceof $t}function MP(r){return r instanceof D}function RP(r,t,e){const i=tt.shared.setValue(t!=null?t:0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=D.WHITE,_e(_e({},e),r)}function OP(r,t,e){return r.texture=t,_e(_e({},e),r)}function Tg(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,_e(_e({},e),r)}function Sg(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,_e(_e({},e),r)}function GP(r,t){const e=_e(_e({},t),r),i=tt.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function Xe(r,t){if(r==null)return null;const e={},i=r;return CP(r)?RP(e,r,t):MP(r)?OP(e,r,t):vg(r)?Tg(e,r,t):xg(r)?Sg(e,r,t):i.fill&&vg(i.fill)?Tg(i,i.fill,t):i.fill&&xg(i.fill)?Sg(i,i.fill,t):GP(i,t)}function Bi(r,t){const e=t,{width:i,alignment:n,miterLimit:s,cap:a,join:o,pixelLine:l}=e,u=AP(e,["width","alignment","miterLimit","cap","join","pixelLine"]),c=Xe(r,u);return c?_e({width:i,alignment:n,miterLimit:s,cap:a,join:o,pixelLine:l},c):null}function wg(r,t){let e=1;const i=r.shapePath.shapePrimitives;for(let n=0;n<i.length;n++){const s=i[n].shape;if(s.type!=="polygon")continue;const a=s.points,o=a.length;if(o<6)continue;const l=s.closePath;for(let u=0;u<o;u+=2){if(!l&&(u===0||u===o-2))continue;const c=(u-2+o)%o,h=(u+2)%o,p=a[c],f=a[c+1],m=a[u],g=a[u+1],_=a[h],y=a[h+1],b=p-m,x=f-g,v=_-m,w=y-g,T=b*b+x*x,E=v*v+w*w;if(T<1e-12||E<1e-12)continue;let P=(b*v+x*w)/Math.sqrt(T*E);P<-1?P=-1:P>1&&(P=1);const M=Math.sqrt((1-P)*.5);if(M<1e-6)continue;const C=Math.min(1/M,t);C>e&&(e=C)}}return e}var IP=Object.defineProperty,Eg=Object.getOwnPropertySymbols,BP=Object.prototype.hasOwnProperty,FP=Object.prototype.propertyIsEnumerable,Pg=(r,t,e)=>t in r?IP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jr=(r,t)=>{for(var e in t||(t={}))BP.call(t,e)&&Pg(r,e,t[e]);if(Eg)for(var e of Eg(t))FP.call(t,e)&&Pg(r,e,t[e]);return r};const DP=new lt,Ag=new U,Tl=class Me extends Nt{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=ht("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new ge,this._transform=new U,this._fillStyle=jr({},Me.defaultFillStyle),this._strokeStyle=jr({},Me.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new Mt,this._boundsDirty=!0}clone(){const t=new Me;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle=jr({},this._fillStyle),t._strokeStyle=jr({},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=Xe(t,Me.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Bi(t,Me.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Xe(t,Me.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Xe(t,Me.defaultStrokeStyle),this}texture(t,e,i,n,s,a){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:n||0,dw:s||t.frame.width,dh:a||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?tt.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ge,this}fill(t,e){let i;const n=this.instructions[this.instructions.length-1];return this._tick===0&&(n==null?void 0:n.action)==="stroke"?i=n.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(t={color:t,alpha:e}),this._fillStyle=Xe(t,Me.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(lt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const i=this.instructions[this.instructions.length-1];return this._tick===0&&(i==null?void 0:i.action)==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Bi(t,Me.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,n,s,a){this._tick++;const o=this._transform;return this._activePath.arc(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,i,n,s,a),this}arcTo(t,e,i,n,s){this._tick++;const a=this._transform;return this._activePath.arcTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}arcToSvg(t,e,i,n,s,a,o){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,i,n,s,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(t,e,i,n,s,a,o){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*n+l.tx,l.b*i+l.d*n+l.ty,l.a*s+l.c*a+l.tx,l.b*s+l.d*a+l.ty,o),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,n){return this._tick++,this._activePath.ellipse(t,e,i,n,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,n=this._activePath.instructions,s=i.a*t+i.c*e+i.tx,a=i.b*t+i.d*e+i.ty;return n.length===1&&n[0].action==="moveTo"?(n[0].data[0]=s,n[0].data[1]=a,this):(this._activePath.moveTo(s,a),this)}quadraticCurveTo(t,e,i,n,s){this._tick++;const a=this._transform;return this._activePath.quadraticCurveTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,s),this}rect(t,e,i,n){return this._tick++,this._activePath.rect(t,e,i,n,this._transform.clone()),this}roundRect(t,e,i,n,s){return this._tick++,this._activePath.roundRect(t,e,i,n,s,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,n,s=0,a){return this._tick++,this._activePath.regularPoly(t,e,i,n,s,a),this}roundPoly(t,e,i,n,s,a){return this._tick++,this._activePath.roundPoly(t,e,i,n,s,a),this}roundShape(t,e,i,n){return this._tick++,this._activePath.roundShape(t,e,i,n),this}filletRect(t,e,i,n,s){return this._tick++,this._activePath.filletRect(t,e,i,n,s),this}chamferRect(t,e,i,n,s,a){return this._tick++,this._activePath.chamferRect(t,e,i,n,s,a),this}star(t,e,i,n,s=0,a=0){return this._tick++,this._activePath.star(t,e,i,n,s,a,this._transform.clone()),this}svg(t){return this._tick++,fg(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:jr({},this._fillStyle),strokeStyle:jr({},this._strokeStyle)}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,n,s,a){return t instanceof U?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,n,s,a),this)}transform(t,e,i,n,s,a){return t instanceof U?(this._transform.append(t),this):(Ag.set(t,e,i,n,s,a),this._transform.append(Ag),this)}translate(t,e=t){return this._transform.translate(t,e),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 t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const i=this.instructions[e],n=i.action;if(n==="fill"){const s=i.data;t.addBounds(s.path.bounds)}else if(n==="texture"){const s=i.data;t.addFrame(s.dx,s.dy,s.dx+s.dw,s.dy+s.dh,s.transform)}if(n==="stroke"){const s=i.data,a=s.style.alignment;let o=s.style.width*(1-a);s.style.join==="miter"&&(o*=wg(s.path,s.style.miterLimit));const l=s.path.bounds;t.addFrame(l.minX-o,l.minY-o,l.maxX+o,l.maxY+o)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){var e;if(!this.bounds.containsPoint(t.x,t.y))return!1;const i=this.instructions;let n=!1;for(let s=0;s<i.length;s++){const a=i[s],o=a.data,l=o.path;if(!a.action||!l)continue;const u=o.style,c=l.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){const p=c[h].shape;if(!u||!p)continue;const f=c[h].transform,m=f?f.applyInverse(t,DP):t;if(a.action==="fill")n=p.contains(m.x,m.y);else{const _=u;n=p.strokeContains(m.x,m.y,_.width,_.alignment)}const g=o.hole;if(g){const _=(e=g.shapePath)==null?void 0:e.shapePrimitives;if(_)for(let y=0;y<_.length;y++)_[y].shape.contains(m.x,m.y)&&(n=!1)}if(n)return!0}}return n}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(!this.destroyed){if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(e)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(e))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}}};Tl.defaultFillStyle={color:16777215,alpha:1,texture:D.WHITE,matrix:null,fill:null,textureSpace:"local"},Tl.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:D.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let kt=Tl;function je(r,t=1){var e;const i=(e=$e.RETINA_PREFIX)==null?void 0:e.exec(r);return i?parseFloat(i[1]):t}function He(r,t,e){r.label=e,r._sourceOrigin=e;const i=new D({source:r,label:e}),n=()=>{delete t.promiseCache[e],it.has(e)&&it.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&n()}),i.once("destroy",()=>{r.destroyed||n()}),i}var UP=Object.defineProperty,is=Object.getOwnPropertySymbols,Cg=Object.prototype.hasOwnProperty,Mg=Object.prototype.propertyIsEnumerable,Rg=(r,t,e)=>t in r?UP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$P=(r,t)=>{for(var e in t||(t={}))Cg.call(t,e)&&Rg(r,e,t[e]);if(is)for(var e of is(t))Mg.call(t,e)&&Rg(r,e,t[e]);return r},kP=(r,t)=>{var e={};for(var i in r)Cg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&is)for(var i of is(r))t.indexOf(i)<0&&Mg.call(r,i)&&(e[i]=r[i]);return e};const LP=".svg",NP="image/svg+xml",Og={extension:{type:S.LoadParser,priority:te.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return ar(r,NP)||le(r,LP)},async load(r,t,e){var i,n;return((n=(i=t.data)==null?void 0:i.parseAsGraphicsContext)!=null?n:this.config.parseAsGraphicsContext)?jP(r):XP(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function XP(r,t,e,i){var n,s,a,o,l,u;const c=await H.get().fetch(r),h=H.get().createImage();h.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await c.text())}`,h.crossOrigin=i,await h.decode();const p=(s=(n=t.data)==null?void 0:n.width)!=null?s:h.width,f=(o=(a=t.data)==null?void 0:a.height)!=null?o:h.height,m=((l=t.data)==null?void 0:l.resolution)||je(r),g=Math.ceil(p*m),_=Math.ceil(f*m),y=H.get().createCanvas(g,_),b=y.getContext("2d");b.imageSmoothingEnabled=!0,b.imageSmoothingQuality="high",b.drawImage(h,0,0,p*m,f*m);const x=(u=t.data)!=null?u:{},{parseAsGraphicsContext:v}=x,w=kP(x,["parseAsGraphicsContext"]),T=new ke($P({resource:y,alphaMode:"premultiply-alpha-on-upload",resolution:m},w));return He(T,e,r)}async function jP(r){const t=await(await H.get().fetch(r)).text(),e=new kt;return e.svg(t),e}const HP=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})();
|
|
348
|
+
`;let Hr=null,Sl=class{constructor(){Hr||(Hr=URL.createObjectURL(new Blob([HP],{type:"application/javascript"}))),this.worker=new Worker(Hr)}};Sl.revokeObjectURL=function(){Hr&&(URL.revokeObjectURL(Hr),Hr=null)};const zP='(function(){"use strict";async function s(a,t){const e=await fetch(a);if(!e.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${a}: ${e.status} ${e.statusText}`);const i=await e.blob();return t==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}self.onmessage=async a=>{try{const t=await s(a.data.data[0],a.data.data[1]);self.postMessage({data:t,uuid:a.data.uuid,id:a.data.id},[t])}catch(t){self.postMessage({error:t,uuid:a.data.uuid,id:a.data.id})}}})();\n';let zr=null,Gg=class{constructor(){zr||(zr=URL.createObjectURL(new Blob([zP],{type:"application/javascript"}))),this.worker=new Worker(zr)}};Gg.revokeObjectURL=function(){zr&&(URL.revokeObjectURL(zr),zr=null)};let Ig=0,wl,WP=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new Sl;e.addEventListener("message",i=>{e.terminate(),Sl.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){wl===void 0&&(wl=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<wl&&(this._createdWorkers++,t=new Gg().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){this._resolveHash[t.uuid]&&(t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),delete this._resolveHash[t.uuid])}async _run(t,e){await this._initWorkers();const i=new Promise((n,s)=>{this._queue.push({id:t,arguments:e,resolve:n,reject:s})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[Ig]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Ig++,id:i})}reset(){this._workerPool.forEach(t=>t.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:t})=>{t==null||t(new Error("WorkerManager has been reset before completion"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}};const El=new WP;var VP=Object.defineProperty,Bg=Object.getOwnPropertySymbols,YP=Object.prototype.hasOwnProperty,KP=Object.prototype.propertyIsEnumerable,Fg=(r,t,e)=>t in r?VP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qP=(r,t)=>{for(var e in t||(t={}))YP.call(t,e)&&Fg(r,e,t[e]);if(Bg)for(var e of Bg(t))KP.call(t,e)&&Fg(r,e,t[e]);return r};const ZP=[".jpeg",".jpg",".png",".webp",".avif"],QP=["image/jpeg","image/png","image/webp","image/avif"];async function Dg(r,t){var e;const i=await H.get().fetch(r);if(!i.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${i.status} ${i.statusText}`);const n=await i.blob();return((e=t==null?void 0:t.data)==null?void 0:e.alphaMode)==="premultiplied-alpha"?createImageBitmap(n,{premultiplyAlpha:"none"}):createImageBitmap(n)}const Pl={name:"loadTextures",id:"texture",extension:{type:S.LoadParser,priority:te.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return ar(r,QP)||le(r,ZP)},async load(r,t,e){var i;let n=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await El.isImageBitmapSupported()?n=await El.loadImageBitmap(r,t):n=await Dg(r,t):n=await new Promise((a,o)=>{n=H.get().createImage(),n.crossOrigin=this.config.crossOrigin,n.src=r,n.complete?a(n):(n.onload=()=>{a(n)},n.onerror=o)});const s=new ke(qP({resource:n,alphaMode:"premultiply-alpha-on-upload",resolution:((i=t.data)==null?void 0:i.resolution)||je(r)},t.data));return He(s,e,r)},unload(r){r.destroy(!0)}};var JP=Object.defineProperty,tA=Object.defineProperties,eA=Object.getOwnPropertyDescriptors,Ug=Object.getOwnPropertySymbols,rA=Object.prototype.hasOwnProperty,iA=Object.prototype.propertyIsEnumerable,$g=(r,t,e)=>t in r?JP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Al=(r,t)=>{for(var e in t||(t={}))rA.call(t,e)&&$g(r,e,t[e]);if(Ug)for(var e of Ug(t))iA.call(t,e)&&$g(r,e,t[e]);return r},kg=(r,t)=>tA(r,eA(t));const nA=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"];let Cl,Ml;function Lg(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Xg(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function Ng(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",n),r.load();function i(){s(),t()}function n(a){s(),e(a)}function s(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",n)}})}function Xg(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function sA(){const r=[],t=[];for(const e of nA){const i=wr.MIME_TYPES[e.substring(1)]||`video/${e.substring(1)}`;Ci(i)&&(r.push(e),t.includes(i)||t.push(i))}return{validVideoExtensions:r,validVideoMime:t}}const jg={name:"loadVideo",id:"video",extension:{type:S.LoadParser,name:"loadVideo"},test(r){if(!Cl||!Ml){const{validVideoExtensions:i,validVideoMime:n}=sA();Cl=i,Ml=n}const t=ar(r,Ml),e=le(r,Cl);return t||e},async load(r,t,e){var i,n;const s=Al(kg(Al({},wr.defaultOptions),{resolution:((i=t.data)==null?void 0:i.resolution)||je(r),alphaMode:((n=t.data)==null?void 0:n.alphaMode)||await ro()}),t.data),a=document.createElement("video"),o={preload:s.autoLoad!==!1?"auto":void 0,"webkit-playsinline":s.playsinline!==!1?"":void 0,playsinline:s.playsinline!==!1?"":void 0,muted:s.muted===!0?"":void 0,loop:s.loop===!0?"":void 0,autoplay:s.autoPlay!==!1?"":void 0};Object.keys(o).forEach(c=>{const h=o[c];h!==void 0&&a.setAttribute(c,h)}),s.muted===!0&&(a.muted=!0),Lg(a,r,s.crossorigin);const l=document.createElement("source");let u;if(s.mime)u=s.mime;else if(r.startsWith("data:"))u=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){const c=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();u=wr.MIME_TYPES[c]||`video/${c}`}return l.src=r,u&&(l.type=u),new Promise((c,h)=>{s.preload&&!s.autoPlay&&a.load(),a.addEventListener("canplay",p),a.addEventListener("error",f),l.addEventListener("error",f),a.appendChild(l);async function p(){const g=new wr(kg(Al({},s),{resource:a}));m(),t.data.preload&&await Ng(a),c(He(g,e,r))}function f(g){m(),h(g)}function m(){a.removeEventListener("canplay",p),a.removeEventListener("error",f),l.removeEventListener("error",f)}})},unload(r){r.destroy(!0)}},Rl={extension:{type:S.ResolveParser,name:"resolveTexture"},test:Pl.test,parse:r=>{var t,e;return{resolution:parseFloat((e=(t=$e.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:r.split(".").pop(),src:r}}},Hg={extension:{type:S.ResolveParser,priority:-2,name:"resolveJson"},test:r=>$e.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Rl.parse};var aA=Object.defineProperty,zg=Object.getOwnPropertySymbols,oA=Object.prototype.hasOwnProperty,lA=Object.prototype.propertyIsEnumerable,Wg=(r,t,e)=>t in r?aA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vg=(r,t)=>{for(var e in t||(t={}))oA.call(t,e)&&Wg(r,e,t[e]);if(zg)for(var e of zg(t))lA.call(t,e)&&Wg(r,e,t[e]);return r};class Yg{constructor(){this._detections=[],this._initialized=!1,this.resolver=new $e,this.loader=new Vf,this.cache=it,this._backgroundLoader=new Ff(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,i,n;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let l=t.manifest;typeof l=="string"&&(l=await this.load(l)),this.resolver.addManifest(l)}const s=(i=(e=t.texturePreference)==null?void 0:e.resolution)!=null?i:1,a=typeof s=="number"?[s]:s,o=await this._detectFormats({preferredFormats:(n=t.texturePreference)==null?void 0:n.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences),t.loadOptions&&(this.loader.loadOptions=Vg(Vg({},this.loader.loadOptions),t.loadOptions))}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=fi(t),n=oe(t).map(o=>{if(typeof o!="string"){const l=this.resolver.getAlias(o);return l.some(u=>!this.resolver.hasKey(u))&&this.add(o),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),s=this.resolver.resolve(n),a=await this._mapLoadToResolve(s,e);return i?a[n[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const n=this.resolver.resolveBundle(t),s={},a=Object.keys(n);let o=0;const l=[],u=()=>{e==null||e(l.reduce((h,p)=>h+p,0)/o)},c=a.map((h,p)=>{const f=n[h],m=Object.values(f),g=[...new Set(m.flat())].reduce((_,y)=>_+(y.progressSize||1),0);return l.push(0),o+=g,this._mapLoadToResolve(f,_=>{l[p]=_*g,u()}).then(_=>{s[h]=_})});return await Promise.all(c),i?s[t[0]]:s}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return it.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=it.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const n=await this.loader.load(i,e);this._backgroundLoader.active=!0;const s={};return i.forEach(a=>{const o=n[a.src],l=[a.src];a.alias&&l.push(...a.alias),l.forEach(u=>{s[u]=o}),it.set(l,o)}),s}async unload(t){this._initialized||await this.init();const e=oe(t).map(n=>typeof n!="string"?n.src:n),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=oe(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(n=>this._unloadFromResolved(e[n]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{it.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,n)=>e.indexOf(i)===n),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Fi=new Yg;N.handleByList(S.LoadParser,Fi.loader.parsers).handleByList(S.ResolveParser,Fi.resolver.parsers).handleByList(S.CacheParser,Fi.cache.parsers).handleByList(S.DetectionParser,Fi.detections),N.add(Df,kf,Uf,jf,Lf,Nf,Xf,Yf,Kf,Jf,Og,Pl,jg,Bf,If,Rl,Hg);const Kg={loader:S.LoadParser,resolver:S.ResolveParser,cache:S.CacheParser,detection:S.DetectionParser};N.handle(S.Asset,r=>{const t=r.ref;Object.entries(Kg).filter(([e])=>!!t[e]).forEach(([e,i])=>{var n;return N.add(Object.assign(t[e],{extension:(n=t[e].extension)!=null?n:i}))})},r=>{const t=r.ref;Object.keys(Kg).filter(e=>!!t[e]).forEach(e=>N.remove(t[e]))});const uA={extension:{type:S.DetectionParser,priority:3},test:async()=>!!(await Pi()||Ei()),add:async r=>[...r,"basis"],remove:async r=>r.filter(t=>t!=="basis")};var cA=Object.defineProperty,hA=Object.defineProperties,dA=Object.getOwnPropertyDescriptors,qg=Object.getOwnPropertySymbols,pA=Object.prototype.hasOwnProperty,fA=Object.prototype.propertyIsEnumerable,Zg=(r,t,e)=>t in r?cA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mA=(r,t)=>{for(var e in t||(t={}))pA.call(t,e)&&Zg(r,e,t[e]);if(qg)for(var e of qg(t))fA.call(t,e)&&Zg(r,e,t[e]);return r},gA=(r,t)=>hA(r,dA(t));class Di extends ft{constructor(t){super(gA(mA({},t),{mipLevelCount:t.resource.length})),this.uploadMethodId="compressed"}}let ns;function Ol(){if(ns)return ns;const r=H.get().createCanvas(1,1).getContext("webgl");return r?(ns=[...r.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...r.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...r.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...r.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"]:[]],ns):[]}let ss;async function Gl(){if(ss)return ss;const r=await H.get().getNavigator().gpu.requestAdapter();return ss=[...r.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"]:[],...r.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"]:[],...r.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"]:[]],ss}let Il;async function Bl(){return Il!==void 0||(Il=await(async()=>{const r=await Pi(),t=Ei();if(r&&t){const e=await Gl(),i=Ol();return e.filter(n=>i.includes(n))}else{if(r)return await Gl();if(t)return Ol()}return[]})()),Il}const Qg=["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 as;async function Ui(){if(as!==void 0)return as;const r=await Bl();return as=[...Qg,...r],as}const _A='(function(){"use strict";function g(r,a){const t=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const m=[];for(let e=0;e<s;++e)for(let o=0;o<t;++o){const B=r.getImageTranscodedSizeInBytes(o,e,a),f=new Uint8Array(B);if(!r.transcodeImage(f,o,e,a,1,0))throw new Error("transcodeImage failed");m.push(f)}return m}const w={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function d(r){const a=w[r];if(a)return a;throw new Error(`Unsupported transcoderFormat: ${r}`)}const n={jsUrl:"basis/basis_transcoder.js",wasmUrl:"basis/basis_transcoder.wasm"};let u,i,c;async function l(){if(!c){const r=new URL(n.jsUrl,location.origin).href,a=new URL(n.wasmUrl,location.origin).href;importScripts(r),c=new Promise(t=>{BASIS({locateFile:s=>a}).then(s=>{s.initializeBasis(),t(s.BasisFile)})})}return c}async function b(r,a){const t=await fetch(r);if(t.ok){const s=await t.arrayBuffer();return new a(new Uint8Array(s))}throw new Error(`Failed to load Basis texture: ${r}`)}const h=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function p(r){const a=await l(),t=await b(r,a),s=g(t,u);return{width:t.getImageWidth(0,0),height:t.getImageHeight(0,0),format:i,resource:s,alphaMode:"no-premultiply-alpha"}}async function y(r,a,t){r&&(n.jsUrl=r),a&&(n.wasmUrl=a),i=h.filter(s=>t.includes(s))[0],u=d(i),await l()}const U={init:async r=>{const{jsUrl:a,wasmUrl:t,supportedTextures:s}=r;await y(a,t,s)},load:async r=>{var a;try{const t=await p(r.url);return{type:"load",url:r.url,success:!0,textureOptions:t,transferables:(a=t.resource)==null?void 0:a.map(s=>s.buffer)}}catch(t){throw t}}};self.onmessage=(async r=>{const a=r.data,t=await U[a.type](a);t&&self.postMessage(t,t.transferables)})})();\n';let Wr=null,Jg=class{constructor(){Wr||(Wr=URL.createObjectURL(new Blob([_A],{type:"application/javascript"}))),this.worker=new Worker(Wr)}};Jg.revokeObjectURL=function(){Wr&&(URL.revokeObjectURL(Wr),Wr=null)};const os={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 yA(r){Object.assign(os,r)}let $i;const t_={};function bA(r){return $i||($i=new Jg().worker,$i.onmessage=t=>{const{success:e,url:i,textureOptions:n}=t.data;e||console.warn("Failed to load Basis texture",i),t_[i](n)},$i.postMessage({type:"init",jsUrl:os.jsUrl,wasmUrl:os.wasmUrl,supportedTextures:r})),$i}function e_(r,t){const e=bA(t);return new Promise(i=>{t_[r]=i,e.postMessage({type:"load",url:r})})}var vA=Object.defineProperty,xA=Object.defineProperties,TA=Object.getOwnPropertyDescriptors,r_=Object.getOwnPropertySymbols,SA=Object.prototype.hasOwnProperty,wA=Object.prototype.propertyIsEnumerable,i_=(r,t,e)=>t in r?vA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,EA=(r,t)=>{for(var e in t||(t={}))SA.call(t,e)&&i_(r,e,t[e]);if(r_)for(var e of r_(t))wA.call(t,e)&&i_(r,e,t[e]);return r},PA=(r,t)=>xA(r,TA(t));const AA={extension:{type:S.LoadParser,priority:te.High,name:"loadBasis"},name:"loadBasis",id:"basis",test(r){return le(r,[".basis"])},async load(r,t,e){var i;const n=await Ui(),s=await e_(r,n),a=new Di(PA(EA({},s),{resolution:((i=t.data)==null?void 0:i.resolution)||je(r)}));return He(a,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};function CA(r,t){const e=r.getNumImages(),i=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const n=[];for(let s=0;s<i;++s)for(let a=0;a<e;++a){const o=r.getImageTranscodedSizeInBytes(a,s,t),l=new Uint8Array(o);if(!r.transcodeImage(l,a,s,t,1,0))throw new Error("transcodeImage failed");n.push(l)}return n}const MA={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function RA(r){const t=MA[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const OA={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},GA={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4};var Fl=(r=>(r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",r))(Fl||{}),Dl=(r=>(r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",r))(Dl||{});function Bt(r){return r.charCodeAt(0)+(r.charCodeAt(1)<<8)+(r.charCodeAt(2)<<16)+(r.charCodeAt(3)<<24)}var qt=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.R8G8B8=20]="R8G8B8",r[r.A8R8G8B8=21]="A8R8G8B8",r[r.X8R8G8B8=22]="X8R8G8B8",r[r.R5G6B5=23]="R5G6B5",r[r.X1R5G5B5=24]="X1R5G5B5",r[r.A1R5G5B5=25]="A1R5G5B5",r[r.A4R4G4B4=26]="A4R4G4B4",r[r.R3G3B2=27]="R3G3B2",r[r.A8=28]="A8",r[r.A8R3G3B2=29]="A8R3G3B2",r[r.X4R4G4B4=30]="X4R4G4B4",r[r.A2B10G10R10=31]="A2B10G10R10",r[r.A8B8G8R8=32]="A8B8G8R8",r[r.X8B8G8R8=33]="X8B8G8R8",r[r.G16R16=34]="G16R16",r[r.A2R10G10B10=35]="A2R10G10B10",r[r.A16B16G16R16=36]="A16B16G16R16",r[r.A8P8=40]="A8P8",r[r.P8=41]="P8",r[r.L8=50]="L8",r[r.A8L8=51]="A8L8",r[r.A4L4=52]="A4L4",r[r.V8U8=60]="V8U8",r[r.L6V5U5=61]="L6V5U5",r[r.X8L8V8U8=62]="X8L8V8U8",r[r.Q8W8V8U8=63]="Q8W8V8U8",r[r.V16U16=64]="V16U16",r[r.A2W10V10U10=67]="A2W10V10U10",r[r.Q16W16V16U16=110]="Q16W16V16U16",r[r.R16F=111]="R16F",r[r.G16R16F=112]="G16R16F",r[r.A16B16G16R16F=113]="A16B16G16R16F",r[r.R32F=114]="R32F",r[r.G32R32F=115]="G32R32F",r[r.A32B32G32R32F=116]="A32B32G32R32F",r[r.UYVY=Bt("UYVY")]="UYVY",r[r.R8G8_B8G8=Bt("RGBG")]="R8G8_B8G8",r[r.YUY2=Bt("YUY2")]="YUY2",r[r.D3DFMT_G8R8_G8B8=Bt("GRGB")]="D3DFMT_G8R8_G8B8",r[r.DXT1=Bt("DXT1")]="DXT1",r[r.DXT2=Bt("DXT2")]="DXT2",r[r.DXT3=Bt("DXT3")]="DXT3",r[r.DXT4=Bt("DXT4")]="DXT4",r[r.DXT5=Bt("DXT5")]="DXT5",r[r.ATI1=Bt("ATI1")]="ATI1",r[r.AT1N=Bt("AT1N")]="AT1N",r[r.ATI2=Bt("ATI2")]="ATI2",r[r.AT2N=Bt("AT2N")]="AT2N",r[r.BC4U=Bt("BC4U")]="BC4U",r[r.BC4S=Bt("BC4S")]="BC4S",r[r.BC5U=Bt("BC5U")]="BC5U",r[r.BC5S=Bt("BC5S")]="BC5S",r[r.DX10=Bt("DX10")]="DX10",r))(qt||{});const Ul={[qt.DXT1]:"bc1-rgba-unorm",[qt.DXT2]:"bc2-rgba-unorm",[qt.DXT3]:"bc2-rgba-unorm",[qt.DXT4]:"bc3-rgba-unorm",[qt.DXT5]:"bc3-rgba-unorm",[qt.ATI1]:"bc4-r-unorm",[qt.BC4U]:"bc4-r-unorm",[qt.BC4S]:"bc4-r-snorm",[qt.ATI2]:"bc5-rg-unorm",[qt.BC5U]:"bc5-rg-unorm",[qt.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},Zt={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"},Z={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:OA,HEADER_DX10_FIELDS:GA,DXGI_FORMAT:Fl,D3D10_RESOURCE_DIMENSION:Dl,D3DFMT:qt},n_={"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 s_(r,t){const{format:e,fourCC:i,width:n,height:s,dataOffset:a,mipmapCount:o}=BA(r);if(!t.includes(e))throw new Error(`Unsupported texture format: ${i} ${e}, supported: ${t}`);if(o<=1)return{format:e,width:n,height:s,resource:[new Uint8Array(r,a)],alphaMode:"no-premultiply-alpha"};const l=IA(e,n,s,a,o,r);return{format:e,width:n,height:s,resource:l,alphaMode:"no-premultiply-alpha"}}function IA(r,t,e,i,n,s){const a=[],o=n_[r];let l=t,u=e,c=i;for(let h=0;h<n;++h){const p=Math.ceil(Math.max(4,l)/4)*4,f=Math.ceil(Math.max(4,u)/4)*4,m=o?p/4*f/4*o:l*u*4,g=new Uint8Array(s,c,m);a.push(g),c+=m,l=Math.max(l>>1,1),u=Math.max(u>>1,1)}return a}function BA(r){const t=new Uint32Array(r,0,Z.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[Z.HEADER_FIELDS.MAGIC]!==Z.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const e=t[Z.HEADER_FIELDS.HEIGHT],i=t[Z.HEADER_FIELDS.WIDTH],n=Math.max(1,t[Z.HEADER_FIELDS.MIPMAP_COUNT]),s=t[Z.HEADER_FIELDS.PF_FLAGS],a=t[Z.HEADER_FIELDS.FOURCC],o=FA(t,s,a,r),l=Z.MAGIC_SIZE+Z.HEADER_SIZE+(a===Z.D3DFMT.DX10?Z.HEADER_DX10_SIZE:0);return{format:o,fourCC:a,width:i,height:e,dataOffset:l,mipmapCount:n}}function FA(r,t,e,i){if(t&Z.PIXEL_FORMAT_FLAGS.FOURCC){if(e===Z.D3DFMT.DX10){const n=new Uint32Array(i,Z.MAGIC_SIZE+Z.HEADER_SIZE,Z.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(n[Z.HEADER_DX10_FIELDS.MISC_FLAG]===Z.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(n[Z.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===Z.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const s=n[Z.HEADER_DX10_FIELDS.DXGI_FORMAT];if(s in Zt)return Zt[s];throw new Error(`DDSParser cannot parse texture data with DXGI format ${s}`)}if(e in Ul)return Ul[e];throw new Error(`DDSParser cannot parse texture data with fourCC format ${e}`)}if(t&Z.PIXEL_FORMAT_FLAGS.RGB||t&Z.PIXEL_FORMAT_FLAGS.RGBA)return DA(r);throw t&Z.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):t&Z.PIXEL_FORMAT_FLAGS.LUMINANCE||t&Z.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):t&Z.PIXEL_FORMAT_FLAGS.ALPHA||t&Z.PIXEL_FORMAT_FLAGS.ALPHAPIXELS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}function DA(r){const t=r[Z.HEADER_FIELDS.RGB_BITCOUNT],e=r[Z.HEADER_FIELDS.R_BIT_MASK],i=r[Z.HEADER_FIELDS.G_BIT_MASK],n=r[Z.HEADER_FIELDS.B_BIT_MASK],s=r[Z.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(e===255&&i===65280&&n===16711680&&s===4278190080)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(e===16711680&&i===65280&&n===255&&s===4278190080)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(e===1072693248&&i===1047552&&n===1023&&s===3221225472)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(e===65535&&i===4294901760&&n===0&&s===0)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(e===4294967295&&i===0&&n===0&&s===0)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(e===31744&&i===992&&n===31&&s===32768)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(e===63488&&i===2016&&n===31&&s===0)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(e===3840&&i===240&&n===15&&s===61440)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(e===255&&i===0&&n===0&&s===65280)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(e===65535&&i===0&&n===0&&s===0)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(e===255&&i===0&&n===0&&s===0)return Zt[Z.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM];break}throw new Error(`DDSParser does not support uncompressed texture with configuration:
|
|
349
|
+
bitCount = ${t}, rBitMask = ${e}, gBitMask = ${i}, aBitMask = ${s}`)}var UA=Object.defineProperty,$A=Object.defineProperties,kA=Object.getOwnPropertyDescriptors,a_=Object.getOwnPropertySymbols,LA=Object.prototype.hasOwnProperty,NA=Object.prototype.propertyIsEnumerable,o_=(r,t,e)=>t in r?UA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,XA=(r,t)=>{for(var e in t||(t={}))LA.call(t,e)&&o_(r,e,t[e]);if(a_)for(var e of a_(t))NA.call(t,e)&&o_(r,e,t[e]);return r},jA=(r,t)=>$A(r,kA(t));const HA={extension:{type:S.LoadParser,priority:te.High,name:"loadDDS"},name:"loadDDS",id:"dds",test(r){return le(r,[".dds"])},async load(r,t,e){var i;const n=await Ui(),s=await(await fetch(r)).arrayBuffer(),a=s_(s,n),o=new Di(jA(XA({},a),{resolution:((i=t.data)==null?void 0:i.resolution)||je(r)}));return He(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};var l_=(r=>(r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGBA=6408]="RGBA",r[r.RGBA8UI=36220]="RGBA8UI",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.RGBA8I=36238]="RGBA8I",r[r.RGBA8=32856]="RGBA8",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(l_||{}),zA=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(zA||{}),WA=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(WA||{});const Et={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 u_(r,t){const e=new DataView(r);if(!qA(e))throw new Error("Invalid KTX identifier in header");const{littleEndian:i,glType:n,glFormat:s,glInternalFormat:a,pixelWidth:o,pixelHeight:l,numberOfMipmapLevels:u,offset:c}=KA(e),h=Et.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[a];if(!h)throw new Error(`Unknown texture format ${a}`);if(!t.includes(h))throw new Error(`Unsupported texture format: ${h}, supportedFormats: ${t}`);const p=YA(n,s,a),f=VA(e,n,p,o,l,c,u,i);return{format:h,width:o,height:l,resource:f,alphaMode:"no-premultiply-alpha"}}function VA(r,t,e,i,n,s,a,o){const l=i+3&-4,u=n+3&-4;let c=i*n;t===0&&(c=l*u);let h=c*e,p=i,f=n,m=l,g=u,_=s;const y=new Array(a);for(let b=0;b<a;b++){const x=r.getUint32(_,o);let v=_+4;y[b]=new Uint8Array(r.buffer,v,h),v+=h,_+=x+4,_=_%4!==0?_+4-_%4:_,p=p>>1||1,f=f>>1||1,m=p+4-1&-4,g=f+4-1&-4,h=m*g*e}return y}function YA(r,t,e){let i=Et.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[e];if(r!==0&&(Et.TYPES_TO_BYTES_PER_COMPONENT[r]?i=Et.TYPES_TO_BYTES_PER_COMPONENT[r]*Et.FORMATS_TO_COMPONENTS[t]:i=Et.TYPES_TO_BYTES_PER_PIXEL[r]),i===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return i}function KA(r){const t=r.getUint32(Et.FIELDS.ENDIANNESS,!0)===Et.ENDIANNESS,e=r.getUint32(Et.FIELDS.GL_TYPE,t),i=r.getUint32(Et.FIELDS.GL_FORMAT,t),n=r.getUint32(Et.FIELDS.GL_INTERNAL_FORMAT,t),s=r.getUint32(Et.FIELDS.PIXEL_WIDTH,t),a=r.getUint32(Et.FIELDS.PIXEL_HEIGHT,t)||1,o=r.getUint32(Et.FIELDS.PIXEL_DEPTH,t)||1,l=r.getUint32(Et.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,t)||1,u=r.getUint32(Et.FIELDS.NUMBER_OF_FACES,t),c=r.getUint32(Et.FIELDS.NUMBER_OF_MIPMAP_LEVELS,t),h=r.getUint32(Et.FIELDS.BYTES_OF_KEY_VALUE_DATA,t);if(a===0||o!==1)throw new Error("Only 2D textures are supported");if(u!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(l!==1)throw new Error("WebGL does not support array textures");return{littleEndian:t,glType:e,glFormat:i,glInternalFormat:n,pixelWidth:s,pixelHeight:a,numberOfMipmapLevels:c,offset:Et.FILE_HEADER_SIZE+h}}function qA(r){for(let t=0;t<Et.FILE_IDENTIFIER.length;t++)if(r.getUint8(t)!==Et.FILE_IDENTIFIER[t])return!1;return!0}var ZA=Object.defineProperty,QA=Object.defineProperties,JA=Object.getOwnPropertyDescriptors,c_=Object.getOwnPropertySymbols,tC=Object.prototype.hasOwnProperty,eC=Object.prototype.propertyIsEnumerable,h_=(r,t,e)=>t in r?ZA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rC=(r,t)=>{for(var e in t||(t={}))tC.call(t,e)&&h_(r,e,t[e]);if(c_)for(var e of c_(t))eC.call(t,e)&&h_(r,e,t[e]);return r},iC=(r,t)=>QA(r,JA(t));const nC={extension:{type:S.LoadParser,priority:te.High,name:"loadKTX"},name:"loadKTX",id:"ktx",test(r){return le(r,".ktx")},async load(r,t,e){var i;const n=await Ui(),s=await(await fetch(r)).arrayBuffer(),a=u_(s,n),o=new Di(iC(rC({},a),{resolution:((i=t.data)==null?void 0:i.resolution)||je(r)}));return He(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},sC='(function(){"use strict";const s={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:i},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:i}};function f(r){const t=r.format;if(s[t]){const n=s[t].convertFunction,o=r.resource;for(let e=0;e<o.length;e++)o[e]=n(o[e]);r.format=s[t].convertedFormat}}function i(r){const t=r.byteLength/3,n=new Uint32Array(t);for(let o=0;o<t;++o)n[o]=r[o*3]+(r[o*3+1]<<8)+(r[o*3+2]<<16)+4278190080;return new Uint8Array(n.buffer)}function d(r){const t=[];for(let n=0;n<r.numLevels;n++){const o=r.getImageData(n,0,0),e=new Uint8Array(o.byteLength);e.set(o),t.push(e)}return t}const w={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 p(r){const t=w[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const h={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function F(r){const t=h[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function U(r){return r.classId===2?F(r.vkFormat):p(r.glInternalformat)}const y={"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 T(r){const t=y[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const a={jsUrl:"",wasmUrl:""};let l,u,c;async function g(){if(!c){const r=new URL(a.jsUrl,location.origin).href,t=new URL(a.wasmUrl,location.origin).href;importScripts(r),c=new Promise(n=>{LIBKTX({locateFile:o=>t}).then(o=>{n(o)})})}return c}async function v(r,t){const n=await fetch(r);if(n.ok){const o=await n.arrayBuffer();return new t.ktxTexture(new Uint8Array(o))}throw new Error(`Failed to load KTX(2) texture: ${r}`)}const x=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function B(r){const t=await g(),n=await v(r,t);let o;if(n.needsTranscoding){o=u;const R=t.TranscodeTarget[l];if(n.transcodeBasis(R,0)!==t.ErrorCode.SUCCESS)throw new Error("Unable to transcode basis texture.")}else o=U(n);const e=d(n),b={width:n.baseWidth,height:n.baseHeight,format:o,mipLevelCount:n.numLevels,resource:e,alphaMode:"no-premultiply-alpha"};return f(b),b}async function A(r,t,n){r&&(a.jsUrl=r),t&&(a.wasmUrl=t),u=x.filter(o=>n.includes(o))[0],l=T(u),await g()}const m={init:async r=>{const{jsUrl:t,wasmUrl:n,supportedTextures:o}=r;await A(t,n,o)},load:async r=>{var t;try{const n=await B(r.url);return{type:"load",url:r.url,success:!0,textureOptions:n,transferables:(t=n.resource)==null?void 0:t.map(o=>o.buffer)}}catch(n){throw n}}};self.onmessage=(async r=>{var t;const n=r.data;try{const o=await((t=m[n.type])==null?void 0:t.call(m,n));o&&self.postMessage(o,o.transferables)}catch(o){self.postMessage({type:"error",err:o,url:n.url})}})})();\n';let Vr=null;class d_{constructor(){Vr||(Vr=URL.createObjectURL(new Blob([sC],{type:"application/javascript"}))),this.worker=new Worker(Vr)}}d_.revokeObjectURL=function(){Vr&&(URL.revokeObjectURL(Vr),Vr=null)};const ls={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 aC(r){Object.assign(ls,r)}let ki;const p_={},f_={};function oC(r){return ki||(ki=new d_().worker,ki.onmessage=t=>{const{err:e,success:i,url:n,textureOptions:s}=t.data;if(e){f_[n](e);return}i||console.warn("Failed to load KTX texture",n),p_[n](s)},ki.postMessage({type:"init",jsUrl:ls.jsUrl,wasmUrl:ls.wasmUrl,supportedTextures:r})),ki}function m_(r,t){const e=oC(t);return new Promise((i,n)=>{p_[r]=i,f_[r]=n,e.postMessage({type:"load",url:r})})}var lC=Object.defineProperty,uC=Object.defineProperties,cC=Object.getOwnPropertyDescriptors,g_=Object.getOwnPropertySymbols,hC=Object.prototype.hasOwnProperty,dC=Object.prototype.propertyIsEnumerable,__=(r,t,e)=>t in r?lC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pC=(r,t)=>{for(var e in t||(t={}))hC.call(t,e)&&__(r,e,t[e]);if(g_)for(var e of g_(t))dC.call(t,e)&&__(r,e,t[e]);return r},fC=(r,t)=>uC(r,cC(t));const mC={extension:{type:S.LoadParser,priority:te.High,name:"loadKTX2"},name:"loadKTX2",id:"ktx2",test(r){return le(r,".ktx2")},async load(r,t,e){var i;const n=await Ui(),s=await m_(r,n),a=new Di(fC(pC({},s),{resolution:((i=t.data)==null?void 0:i.resolution)||je(r)}));return He(a,e,r)},async unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},$l={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:y_},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:y_}};function gC(r){const t=r.format;if($l[t]){const e=$l[t].convertFunction,i=r.resource;for(let n=0;n<i.length;n++)i[n]=e(i[n]);r.format=$l[t].convertedFormat}}function y_(r){const t=r.byteLength/3,e=new Uint32Array(t);for(let i=0;i<t;++i)e[i]=r[i*3]+(r[i*3+1]<<8)+(r[i*3+2]<<16)+4278190080;return new Uint8Array(e.buffer)}function _C(r){const t=[];for(let e=0;e<r.numLevels;e++){const i=r.getImageData(e,0,0),n=new Uint8Array(i.byteLength);n.set(i),t.push(n)}return t}const yC={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 b_(r){const t=yC[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const bC={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function v_(r){const t=bC[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function vC(r){return r.classId===2?v_(r.vkFormat):b_(r.glInternalformat)}const xC={"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 TC(r){const t=xC[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const us=["basis","bc7","bc6h","astc","etc2","bc5","bc4","bc3","bc2","bc1","eac"],SC={extension:S.ResolveParser,test:r=>le(r,[".ktx",".ktx2",".dds"]),parse:r=>{var t,e;let i;const n=r.split(".");if(n.length>2){const s=n[n.length-2];us.includes(s)&&(i=s)}else i=n[n.length-1];return{resolution:parseFloat((e=(t=$e.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i,src:r}}};let cs;const wC={extension:{type:S.DetectionParser,priority:2},test:async()=>!!(await Pi()||Ei()),add:async r=>{const t=await Bl();return cs=EC(t),[...cs,...r]},remove:async r=>cs?r.filter(t=>!(t in cs)):r};function EC(r){const t=["basis"],e={};return r.forEach(i=>{const n=i.split("-")[0];n&&!e[n]&&(e[n]=!0,t.push(n))}),t.sort((i,n)=>{const s=us.indexOf(i),a=us.indexOf(n);return s===-1?1:a===-1?-1:s-a}),t}const PC=new Mt,AC=new U,Li=new ut,kl=class{cull(t,e,i=!0){this._cullRecursive(t,e,i)}_cullRecursive(t,e,i=!0){if(t.cullable&&t.measurable&&t.includeInBuild)if(t.cullArea){Li.x=e.x,Li.y=e.y,Li.width=e.width,Li.height=e.height;const n=i?t.worldTransform:t.getGlobalTransform(AC,i);t.culled=!Li.intersects(t.cullArea,n)}else{const n=li(t,i,PC);t.culled=n.x>=e.x+e.width||n.y>=e.y+e.height||n.x+n.width<=e.x||n.y+n.height<=e.y}else t.culled=!1;if(!(!t.cullableChildren||t.culled||!t.renderable||!t.measurable||!t.includeInBuild))for(let n=0;n<t.children.length;n++)this._cullRecursive(t.children[n],e,i)}};kl.shared=new kl;let x_=kl;class T_{static init(t){this._renderRef=this.render.bind(this),this.render=()=>{var e;const i=((e=t==null?void 0:t.culler)==null?void 0:e.updateTransform)!==!0;x_.shared.cull(this.stage,this.renderer.screen,i),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}T_.extension={priority:10,type:S.Application,name:"culler"};const CC={extension:{type:S.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(function(){return bw})}};var S_=`
|
|
350
|
+
in vec2 vTextureCoord;
|
|
351
|
+
in vec4 vColor;
|
|
352
|
+
|
|
353
|
+
out vec4 finalColor;
|
|
354
|
+
|
|
355
|
+
uniform float uBlend;
|
|
356
|
+
|
|
357
|
+
uniform sampler2D uTexture;
|
|
358
|
+
uniform sampler2D uBackTexture;
|
|
359
|
+
|
|
360
|
+
{FUNCTIONS}
|
|
361
|
+
|
|
362
|
+
void main()
|
|
363
|
+
{
|
|
364
|
+
vec4 back = texture(uBackTexture, vTextureCoord);
|
|
365
|
+
vec4 front = texture(uTexture, vTextureCoord);
|
|
366
|
+
float blendedAlpha = front.a + back.a * (1.0 - front.a);
|
|
367
|
+
|
|
368
|
+
{MAIN}
|
|
369
|
+
}
|
|
370
|
+
`,w_=`in vec2 aPosition;
|
|
371
|
+
out vec2 vTextureCoord;
|
|
372
|
+
out vec2 backgroundUv;
|
|
373
|
+
|
|
374
|
+
uniform vec4 uInputSize;
|
|
375
|
+
uniform vec4 uOutputFrame;
|
|
376
|
+
uniform vec4 uOutputTexture;
|
|
377
|
+
|
|
378
|
+
vec4 filterVertexPosition( void )
|
|
379
|
+
{
|
|
380
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
381
|
+
|
|
382
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
383
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
384
|
+
|
|
385
|
+
return vec4(position, 0.0, 1.0);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
vec2 filterTextureCoord( void )
|
|
389
|
+
{
|
|
390
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
void main(void)
|
|
394
|
+
{
|
|
395
|
+
gl_Position = filterVertexPosition();
|
|
396
|
+
vTextureCoord = filterTextureCoord();
|
|
397
|
+
}
|
|
398
|
+
`,E_=`
|
|
399
|
+
struct GlobalFilterUniforms {
|
|
400
|
+
uInputSize:vec4<f32>,
|
|
401
|
+
uInputPixel:vec4<f32>,
|
|
402
|
+
uInputClamp:vec4<f32>,
|
|
403
|
+
uOutputFrame:vec4<f32>,
|
|
404
|
+
uGlobalFrame:vec4<f32>,
|
|
405
|
+
uOutputTexture:vec4<f32>,
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
struct BlendUniforms {
|
|
409
|
+
uBlend:f32,
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
413
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
414
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
415
|
+
@group(0) @binding(3) var uBackTexture: texture_2d<f32>;
|
|
416
|
+
|
|
417
|
+
@group(1) @binding(0) var<uniform> blendUniforms : BlendUniforms;
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
struct VSOutput {
|
|
421
|
+
@builtin(position) position: vec4<f32>,
|
|
422
|
+
@location(0) uv : vec2<f32>
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
426
|
+
{
|
|
427
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
428
|
+
|
|
429
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
430
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
431
|
+
|
|
432
|
+
return vec4(position, 0.0, 1.0);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
436
|
+
{
|
|
437
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
441
|
+
{
|
|
442
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
@vertex
|
|
446
|
+
fn mainVertex(
|
|
447
|
+
@location(0) aPosition : vec2<f32>,
|
|
448
|
+
) -> VSOutput {
|
|
449
|
+
return VSOutput(
|
|
450
|
+
filterVertexPosition(aPosition),
|
|
451
|
+
filterTextureCoord(aPosition)
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
{FUNCTIONS}
|
|
456
|
+
|
|
457
|
+
@fragment
|
|
458
|
+
fn mainFragment(
|
|
459
|
+
@location(0) uv: vec2<f32>
|
|
460
|
+
) -> @location(0) vec4<f32> {
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
var back = textureSample(uBackTexture, uSampler, uv);
|
|
464
|
+
var front = textureSample(uTexture, uSampler, uv);
|
|
465
|
+
var blendedAlpha = front.a + back.a * (1.0 - front.a);
|
|
466
|
+
|
|
467
|
+
var out = vec4<f32>(0.0,0.0,0.0,0.0);
|
|
468
|
+
|
|
469
|
+
{MAIN}
|
|
470
|
+
|
|
471
|
+
return out;
|
|
472
|
+
}`,MC=Object.defineProperty,P_=Object.getOwnPropertySymbols,RC=Object.prototype.hasOwnProperty,OC=Object.prototype.propertyIsEnumerable,A_=(r,t,e)=>t in r?MC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,C_=(r,t)=>{for(var e in t||(t={}))RC.call(t,e)&&A_(r,e,t[e]);if(P_)for(var e of P_(t))OC.call(t,e)&&A_(r,e,t[e]);return r};class GC extends Pe{constructor(t){const e=t.gpu,i=M_(C_({source:E_},e)),n=Xt.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:i,entryPoint:"mainFragment"}}),s=t.gl,a=M_(C_({source:S_},s)),o=Wt.from({vertex:w_,fragment:a}),l=new At({uBlend:{value:1,type:"f32"}});super({gpuProgram:n,glProgram:o,blendRequired:!0,resources:{blendUniforms:l,uBackTexture:D.EMPTY}})}}function M_(r){const{source:t,functions:e,main:i}=r;return t.replace("{FUNCTIONS}",e).replace("{MAIN}",i)}const IC=`
|
|
473
|
+
float getLuminosity(vec3 c) {
|
|
474
|
+
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
vec3 setLuminosity(vec3 c, float lum) {
|
|
478
|
+
float modLum = lum - getLuminosity(c);
|
|
479
|
+
vec3 color = c.rgb + vec3(modLum);
|
|
480
|
+
|
|
481
|
+
// clip back into legal range
|
|
482
|
+
modLum = getLuminosity(color);
|
|
483
|
+
vec3 modLumVec = vec3(modLum);
|
|
484
|
+
|
|
485
|
+
float cMin = min(color.r, min(color.g, color.b));
|
|
486
|
+
float cMax = max(color.r, max(color.g, color.b));
|
|
487
|
+
|
|
488
|
+
if(cMin < 0.0) {
|
|
489
|
+
color = mix(modLumVec, color, modLum / (modLum - cMin));
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if(cMax > 1.0) {
|
|
493
|
+
color = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum));
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
return color;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
float getSaturation(vec3 c) {
|
|
500
|
+
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
vec3 setSaturationMinMidMax(vec3 cSorted, float s) {
|
|
504
|
+
vec3 colorSorted = cSorted;
|
|
505
|
+
|
|
506
|
+
if(colorSorted.z > colorSorted.x) {
|
|
507
|
+
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
|
|
508
|
+
colorSorted.z = s;
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
colorSorted.y = 0.0;
|
|
512
|
+
colorSorted.z = 0.0;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
colorSorted.x = 0.0;
|
|
516
|
+
|
|
517
|
+
return colorSorted;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
vec3 setSaturation(vec3 c, float s) {
|
|
521
|
+
vec3 color = c;
|
|
522
|
+
|
|
523
|
+
if(color.r <= color.g && color.r <= color.b) {
|
|
524
|
+
if(color.g <= color.b) {
|
|
525
|
+
color = setSaturationMinMidMax(color.rgb, s).rgb;
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
color = setSaturationMinMidMax(color.rbg, s).rbg;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
else if(color.g <= color.r && color.g <= color.b) {
|
|
532
|
+
if(color.r <= color.b) {
|
|
533
|
+
color = setSaturationMinMidMax(color.grb, s).grb;
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
color = setSaturationMinMidMax(color.gbr, s).gbr;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
// Using bgr for both fixes part of hue
|
|
541
|
+
if(color.r <= color.g) {
|
|
542
|
+
color = setSaturationMinMidMax(color.brg, s).brg;
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
color = setSaturationMinMidMax(color.bgr, s).bgr;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
return color;
|
|
550
|
+
}
|
|
551
|
+
`,BC=`
|
|
552
|
+
fn getLuminosity(c: vec3<f32>) -> f32
|
|
553
|
+
{
|
|
554
|
+
return 0.3*c.r + 0.59*c.g + 0.11*c.b;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32>
|
|
558
|
+
{
|
|
559
|
+
var modLum: f32 = lum - getLuminosity(c);
|
|
560
|
+
var color: vec3<f32> = c.rgb + modLum;
|
|
561
|
+
|
|
562
|
+
// clip back into legal range
|
|
563
|
+
modLum = getLuminosity(color);
|
|
564
|
+
let modLumVec = vec3<f32>(modLum);
|
|
565
|
+
|
|
566
|
+
let cMin: f32 = min(color.r, min(color.g, color.b));
|
|
567
|
+
let cMax: f32 = max(color.r, max(color.g, color.b));
|
|
568
|
+
|
|
569
|
+
if(cMin < 0.0)
|
|
570
|
+
{
|
|
571
|
+
color = mix(modLumVec, color, modLum / (modLum - cMin));
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if(cMax > 1.0)
|
|
575
|
+
{
|
|
576
|
+
color = mix(modLumVec, color, (1 - modLum) / (cMax - modLum));
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
return color;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
fn getSaturation(c: vec3<f32>) -> f32
|
|
583
|
+
{
|
|
584
|
+
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32>
|
|
588
|
+
{
|
|
589
|
+
var colorSorted = cSorted;
|
|
590
|
+
|
|
591
|
+
if(colorSorted.z > colorSorted.x)
|
|
592
|
+
{
|
|
593
|
+
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
|
|
594
|
+
colorSorted.z = s;
|
|
595
|
+
}
|
|
596
|
+
else
|
|
597
|
+
{
|
|
598
|
+
colorSorted.y = 0;
|
|
599
|
+
colorSorted.z = 0;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
colorSorted.x = 0;
|
|
603
|
+
|
|
604
|
+
return colorSorted;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32>
|
|
608
|
+
{
|
|
609
|
+
var color = c;
|
|
610
|
+
|
|
611
|
+
if (color.r <= color.g && color.r <= color.b)
|
|
612
|
+
{
|
|
613
|
+
if (color.g <= color.b)
|
|
614
|
+
{
|
|
615
|
+
color = vec3<f32>(setSaturationMinMidMax(color.rgb, s)).rgb;
|
|
616
|
+
}
|
|
617
|
+
else
|
|
618
|
+
{
|
|
619
|
+
color = vec3<f32>(setSaturationMinMidMax(color.rbg, s)).rbg;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
else if (color.g <= color.r && color.g <= color.b)
|
|
623
|
+
{
|
|
624
|
+
if (color.r <= color.b)
|
|
625
|
+
{
|
|
626
|
+
color = vec3<f32>(setSaturationMinMidMax(color.grb, s)).grb;
|
|
627
|
+
}
|
|
628
|
+
else
|
|
629
|
+
{
|
|
630
|
+
color = vec3<f32>(setSaturationMinMidMax(color.gbr, s)).gbr;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else
|
|
634
|
+
{
|
|
635
|
+
// Using bgr for both fixes part of hue
|
|
636
|
+
if (color.r <= color.g)
|
|
637
|
+
{
|
|
638
|
+
color = vec3<f32>(setSaturationMinMidMax(color.brg, s)).brg;
|
|
639
|
+
}
|
|
640
|
+
else
|
|
641
|
+
{
|
|
642
|
+
color = vec3<f32>(setSaturationMinMidMax(color.bgr, s)).bgr;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
return color;
|
|
647
|
+
}
|
|
648
|
+
`;var R_=`
|
|
649
|
+
in vec2 vTextureCoord;
|
|
650
|
+
|
|
651
|
+
out vec4 finalColor;
|
|
652
|
+
|
|
653
|
+
uniform float uAlpha;
|
|
654
|
+
uniform sampler2D uTexture;
|
|
655
|
+
|
|
656
|
+
void main()
|
|
657
|
+
{
|
|
658
|
+
finalColor = texture(uTexture, vTextureCoord) * uAlpha;
|
|
659
|
+
}
|
|
660
|
+
`,Ll=`struct GlobalFilterUniforms {
|
|
661
|
+
uInputSize:vec4<f32>,
|
|
662
|
+
uInputPixel:vec4<f32>,
|
|
663
|
+
uInputClamp:vec4<f32>,
|
|
664
|
+
uOutputFrame:vec4<f32>,
|
|
665
|
+
uGlobalFrame:vec4<f32>,
|
|
666
|
+
uOutputTexture:vec4<f32>,
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
struct AlphaUniforms {
|
|
670
|
+
uAlpha:f32,
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
674
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
675
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
676
|
+
|
|
677
|
+
@group(1) @binding(0) var<uniform> alphaUniforms : AlphaUniforms;
|
|
678
|
+
|
|
679
|
+
struct VSOutput {
|
|
680
|
+
@builtin(position) position: vec4<f32>,
|
|
681
|
+
@location(0) uv : vec2<f32>
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
685
|
+
{
|
|
686
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
687
|
+
|
|
688
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
689
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
690
|
+
|
|
691
|
+
return vec4(position, 0.0, 1.0);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
695
|
+
{
|
|
696
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
700
|
+
{
|
|
701
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
fn getSize() -> vec2<f32>
|
|
705
|
+
{
|
|
706
|
+
return gfu.uGlobalFrame.zw;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
@vertex
|
|
710
|
+
fn mainVertex(
|
|
711
|
+
@location(0) aPosition : vec2<f32>,
|
|
712
|
+
) -> VSOutput {
|
|
713
|
+
return VSOutput(
|
|
714
|
+
filterVertexPosition(aPosition),
|
|
715
|
+
filterTextureCoord(aPosition)
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
@fragment
|
|
720
|
+
fn mainFragment(
|
|
721
|
+
@location(0) uv: vec2<f32>,
|
|
722
|
+
@builtin(position) position: vec4<f32>
|
|
723
|
+
) -> @location(0) vec4<f32> {
|
|
724
|
+
|
|
725
|
+
var sample = textureSample(uTexture, uSampler, uv);
|
|
726
|
+
|
|
727
|
+
return sample * alphaUniforms.uAlpha;
|
|
728
|
+
}`,FC=Object.defineProperty,DC=Object.defineProperties,UC=Object.getOwnPropertyDescriptors,hs=Object.getOwnPropertySymbols,O_=Object.prototype.hasOwnProperty,G_=Object.prototype.propertyIsEnumerable,I_=(r,t,e)=>t in r?FC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nl=(r,t)=>{for(var e in t||(t={}))O_.call(t,e)&&I_(r,e,t[e]);if(hs)for(var e of hs(t))G_.call(t,e)&&I_(r,e,t[e]);return r},$C=(r,t)=>DC(r,UC(t)),kC=(r,t)=>{var e={};for(var i in r)O_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&hs)for(var i of hs(r))t.indexOf(i)<0&&G_.call(r,i)&&(e[i]=r[i]);return e};const B_=class U1 extends Pe{constructor(t){t=Nl(Nl({},U1.defaultOptions),t);const e=Xt.from({vertex:{source:Ll,entryPoint:"mainVertex"},fragment:{source:Ll,entryPoint:"mainFragment"}}),i=Wt.from({vertex:bi,fragment:R_,name:"alpha-filter"}),n=t,{alpha:s}=n,a=kC(n,["alpha"]),o=new At({uAlpha:{value:s,type:"f32"}});super($C(Nl({},a),{gpuProgram:e,glProgram:i,resources:{alphaUniforms:o}}))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};B_.defaultOptions={alpha:1};let LC=B_;const Xl={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]},NC=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," %blur%","}"].join(`
|
|
729
|
+
`);function F_(r){const t=Xl[r],e=t.length;let i="";const n="finalColor = ",s=" + ",a="texture(uTexture, vBlurTexCoords[%index%]) * %value%";for(let o=0;o<r;o++){const l=o===0?n:s,u=o<e?o:r-o-1,c=a.replace("%index%",o.toString()).replace("%value%",t[u].toString());i+=`${l}${c}
|
|
730
|
+
`}return NC.replace("%blur%",`${i};`).replace("%size%",r.toString())}const XC=`
|
|
731
|
+
in vec2 aPosition;
|
|
732
|
+
|
|
733
|
+
uniform float uStrength;
|
|
734
|
+
|
|
735
|
+
out vec2 vBlurTexCoords[%size%];
|
|
736
|
+
|
|
737
|
+
uniform vec4 uInputSize;
|
|
738
|
+
uniform vec4 uOutputFrame;
|
|
739
|
+
uniform vec4 uOutputTexture;
|
|
740
|
+
|
|
741
|
+
vec4 filterVertexPosition( void )
|
|
742
|
+
{
|
|
743
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
744
|
+
|
|
745
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
746
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
747
|
+
|
|
748
|
+
return vec4(position, 0.0, 1.0);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
vec2 filterTextureCoord( void )
|
|
752
|
+
{
|
|
753
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
void main(void)
|
|
757
|
+
{
|
|
758
|
+
gl_Position = filterVertexPosition();
|
|
759
|
+
|
|
760
|
+
float pixelStrength = uInputSize.%dimension% * uStrength;
|
|
761
|
+
|
|
762
|
+
vec2 textureCoord = filterTextureCoord();
|
|
763
|
+
%blur%
|
|
764
|
+
}`;function D_(r,t){const e=Math.ceil(r/2);let i=XC,n="",s;t?s="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":s="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let a=0;a<r;a++){let o=s.replace("%index%",a.toString());o=o.replace("%sampleIndex%",`${a-(e-1)}.0`),n+=o,n+=`
|
|
765
|
+
`}return i=i.replace("%blur%",n),i=i.replace("%size%",r.toString()),i=i.replace("%dimension%",t?"z":"w"),i}function U_(r,t){const e=D_(t,r),i=F_(t);return Wt.from({vertex:e,fragment:i,name:`blur-${r?"horizontal":"vertical"}-pass-filter`})}var $_=`
|
|
766
|
+
|
|
767
|
+
struct GlobalFilterUniforms {
|
|
768
|
+
uInputSize:vec4<f32>,
|
|
769
|
+
uInputPixel:vec4<f32>,
|
|
770
|
+
uInputClamp:vec4<f32>,
|
|
771
|
+
uOutputFrame:vec4<f32>,
|
|
772
|
+
uGlobalFrame:vec4<f32>,
|
|
773
|
+
uOutputTexture:vec4<f32>,
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
struct BlurUniforms {
|
|
777
|
+
uStrength:f32,
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
781
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
782
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
783
|
+
|
|
784
|
+
@group(1) @binding(0) var<uniform> blurUniforms : BlurUniforms;
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
struct VSOutput {
|
|
788
|
+
@builtin(position) position: vec4<f32>,
|
|
789
|
+
%blur-struct%
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
793
|
+
{
|
|
794
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
795
|
+
|
|
796
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
797
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
798
|
+
|
|
799
|
+
return vec4(position, 0.0, 1.0);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
803
|
+
{
|
|
804
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
808
|
+
{
|
|
809
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
fn getSize() -> vec2<f32>
|
|
813
|
+
{
|
|
814
|
+
return gfu.uGlobalFrame.zw;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
@vertex
|
|
819
|
+
fn mainVertex(
|
|
820
|
+
@location(0) aPosition : vec2<f32>,
|
|
821
|
+
) -> VSOutput {
|
|
822
|
+
|
|
823
|
+
let filteredCord = filterTextureCoord(aPosition);
|
|
824
|
+
|
|
825
|
+
let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength;
|
|
826
|
+
|
|
827
|
+
return VSOutput(
|
|
828
|
+
filterVertexPosition(aPosition),
|
|
829
|
+
%blur-vertex-out%
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
@fragment
|
|
834
|
+
fn mainFragment(
|
|
835
|
+
@builtin(position) position: vec4<f32>,
|
|
836
|
+
%blur-fragment-in%
|
|
837
|
+
) -> @location(0) vec4<f32> {
|
|
838
|
+
|
|
839
|
+
var finalColor = vec4(0.0);
|
|
840
|
+
|
|
841
|
+
%blur-sampling%
|
|
842
|
+
|
|
843
|
+
return finalColor;
|
|
844
|
+
}
|
|
845
|
+
`;function k_(r,t){const e=Xl[t],i=e.length,n=[],s=[],a=[];for(let h=0;h<t;h++){n[h]=`@location(${h}) offset${h}: vec2<f32>,`,r?s[h]=`filteredCord + vec2(${h-i+1} * pixelStrength, 0.0),`:s[h]=`filteredCord + vec2(0.0, ${h-i+1} * pixelStrength),`;const p=h<i?h:t-h-1,f=e[p].toString();a[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${f};`}const o=n.join(`
|
|
846
|
+
`),l=s.join(`
|
|
847
|
+
`),u=a.join(`
|
|
848
|
+
`),c=$_.replace("%blur-struct%",o).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",o).replace("%blur-sampling%",u).replace("%dimension%",r?"z":"w");return Xt.from({vertex:{source:c,entryPoint:"mainVertex"},fragment:{source:c,entryPoint:"mainFragment"}})}var jC=Object.defineProperty,L_=Object.getOwnPropertySymbols,HC=Object.prototype.hasOwnProperty,zC=Object.prototype.propertyIsEnumerable,N_=(r,t,e)=>t in r?jC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jl=(r,t)=>{for(var e in t||(t={}))HC.call(t,e)&&N_(r,e,t[e]);if(L_)for(var e of L_(t))zC.call(t,e)&&N_(r,e,t[e]);return r};const X_=class $1 extends Pe{constructor(t){var e;t=jl(jl({},$1.defaultOptions),t);const i=U_(t.horizontal,t.kernelSize),n=k_(t.horizontal,t.kernelSize);super(jl({glProgram:i,gpuProgram:n,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},t)),this.horizontal=t.horizontal,this.legacy=(e=t.legacy)!=null?e:!1,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._blurUniforms=this.resources.blurUniforms,this._uniforms=this._blurUniforms.uniforms}apply(t,e,i,n){this.legacy?this._applyLegacy(t,e,i,n):this._applyOptimized(t,e,i,n)}_applyLegacy(t,e,i,n){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)t.applyFilter(this,e,i,n);else{const s=vt.getSameSizeTexture(e);let a=e,o=s;this._state.blend=!1;const l=t.renderer.type===It.WEBGPU;for(let u=0;u<this.passes-1;u++){t.applyFilter(this,a,o,u===0?!0:l);const c=o;o=a,a=c}this._state.blend=!0,t.applyFilter(this,a,i,n),vt.returnTexture(s)}}_applyOptimized(t,e,i,n){if(this._uniforms.uStrength=this._calculateInitialStrength(),this.passes===1)t.applyFilter(this,e,i,n);else{const s=vt.getSameSizeTexture(e);let a=e,o=s;this._state.blend=!1;const l=t.renderer,u=l.type===It.WEBGPU,c=u?l.renderPipes.uniformBatch:null;for(let h=0;h<this.passes-1;h++){c&&this.groups[1].setResource(c.getUboResource(this._blurUniforms),0),t.applyFilter(this,a,o,u);const p=o;o=a,a=p,this._uniforms.uStrength*=.5}c&&this.groups[1].setResource(c.getUboResource(this._blurUniforms),0),this._state.blend=!0,t.applyFilter(this,a,i,n),vt.returnTexture(s)}}_calculateInitialStrength(){let t=1,e=.5;for(let i=1;i<this.passes;i++)t+=e*e,e*=.5;return this.strength/Math.sqrt(t)}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}};X_.defaultOptions={strength:8,quality:4,kernelSize:5,legacy:!1};let ds=X_;var WC=Object.defineProperty,VC=Object.defineProperties,YC=Object.getOwnPropertyDescriptors,ps=Object.getOwnPropertySymbols,j_=Object.prototype.hasOwnProperty,H_=Object.prototype.propertyIsEnumerable,z_=(r,t,e)=>t in r?WC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ni=(r,t)=>{for(var e in t||(t={}))j_.call(t,e)&&z_(r,e,t[e]);if(ps)for(var e of ps(t))H_.call(t,e)&&z_(r,e,t[e]);return r},KC=(r,t)=>VC(r,YC(t)),qC=(r,t)=>{var e={};for(var i in r)j_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ps)for(var i of ps(r))t.indexOf(i)<0&&H_.call(r,i)&&(e[i]=r[i]);return e};class W_ extends Pe{constructor(...t){var e;let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={strength:i},t[1]!==void 0&&(i.quality=t[1]),t[2]!==void 0&&(i.resolution=t[2]||"inherit"),t[3]!==void 0&&(i.kernelSize=t[3])),i=Ni(Ni({},ds.defaultOptions),i);const n=i,{strength:s,strengthX:a,strengthY:o,quality:l}=n,u=qC(n,["strength","strengthX","strengthY","quality"]);super(KC(Ni({},u),{compatibleRenderers:It.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new ds(Ni({horizontal:!0},i)),this.blurYFilter=new ds(Ni({horizontal:!1},i)),this.quality=l,this.strengthX=a!=null?a:s,this.strengthY=o!=null?o:s,this.repeatEdgePixels=!1}apply(t,e,i,n){const s=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(s&&a){const o=vt.getSameSizeTexture(e);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,o,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,o,i,n),vt.returnTexture(o)}else a?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,e,i,n)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(t,e,i,n))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}W_.defaultOptions={strength:8,quality:4,kernelSize:5,legacy:!1};var V_=`
|
|
849
|
+
in vec2 vTextureCoord;
|
|
850
|
+
in vec4 vColor;
|
|
851
|
+
|
|
852
|
+
out vec4 finalColor;
|
|
853
|
+
|
|
854
|
+
uniform float uColorMatrix[20];
|
|
855
|
+
uniform float uAlpha;
|
|
856
|
+
|
|
857
|
+
uniform sampler2D uTexture;
|
|
858
|
+
|
|
859
|
+
float rand(vec2 co)
|
|
860
|
+
{
|
|
861
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
void main()
|
|
865
|
+
{
|
|
866
|
+
vec4 color = texture(uTexture, vTextureCoord);
|
|
867
|
+
float randomValue = rand(gl_FragCoord.xy * 0.2);
|
|
868
|
+
float diff = (randomValue - 0.5) * 0.5;
|
|
869
|
+
|
|
870
|
+
if (uAlpha == 0.0) {
|
|
871
|
+
finalColor = color;
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
if (color.a > 0.0) {
|
|
876
|
+
color.rgb /= color.a;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
vec4 result;
|
|
880
|
+
|
|
881
|
+
result.r = (uColorMatrix[0] * color.r);
|
|
882
|
+
result.r += (uColorMatrix[1] * color.g);
|
|
883
|
+
result.r += (uColorMatrix[2] * color.b);
|
|
884
|
+
result.r += (uColorMatrix[3] * color.a);
|
|
885
|
+
result.r += uColorMatrix[4];
|
|
886
|
+
|
|
887
|
+
result.g = (uColorMatrix[5] * color.r);
|
|
888
|
+
result.g += (uColorMatrix[6] * color.g);
|
|
889
|
+
result.g += (uColorMatrix[7] * color.b);
|
|
890
|
+
result.g += (uColorMatrix[8] * color.a);
|
|
891
|
+
result.g += uColorMatrix[9];
|
|
892
|
+
|
|
893
|
+
result.b = (uColorMatrix[10] * color.r);
|
|
894
|
+
result.b += (uColorMatrix[11] * color.g);
|
|
895
|
+
result.b += (uColorMatrix[12] * color.b);
|
|
896
|
+
result.b += (uColorMatrix[13] * color.a);
|
|
897
|
+
result.b += uColorMatrix[14];
|
|
898
|
+
|
|
899
|
+
result.a = (uColorMatrix[15] * color.r);
|
|
900
|
+
result.a += (uColorMatrix[16] * color.g);
|
|
901
|
+
result.a += (uColorMatrix[17] * color.b);
|
|
902
|
+
result.a += (uColorMatrix[18] * color.a);
|
|
903
|
+
result.a += uColorMatrix[19];
|
|
904
|
+
|
|
905
|
+
vec3 rgb = mix(color.rgb, result.rgb, uAlpha);
|
|
906
|
+
|
|
907
|
+
// Premultiply alpha again.
|
|
908
|
+
rgb *= result.a;
|
|
909
|
+
|
|
910
|
+
finalColor = vec4(rgb, result.a);
|
|
911
|
+
}
|
|
912
|
+
`,Hl=`struct GlobalFilterUniforms {
|
|
913
|
+
uInputSize:vec4<f32>,
|
|
914
|
+
uInputPixel:vec4<f32>,
|
|
915
|
+
uInputClamp:vec4<f32>,
|
|
916
|
+
uOutputFrame:vec4<f32>,
|
|
917
|
+
uGlobalFrame:vec4<f32>,
|
|
918
|
+
uOutputTexture:vec4<f32>,
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
struct ColorMatrixUniforms {
|
|
922
|
+
uColorMatrix:array<vec4<f32>, 5>,
|
|
923
|
+
uAlpha:f32,
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
928
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
929
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
930
|
+
@group(1) @binding(0) var<uniform> colorMatrixUniforms : ColorMatrixUniforms;
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
struct VSOutput {
|
|
934
|
+
@builtin(position) position: vec4<f32>,
|
|
935
|
+
@location(0) uv : vec2<f32>,
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
939
|
+
{
|
|
940
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
941
|
+
|
|
942
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
943
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
944
|
+
|
|
945
|
+
return vec4(position, 0.0, 1.0);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
949
|
+
{
|
|
950
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
@vertex
|
|
954
|
+
fn mainVertex(
|
|
955
|
+
@location(0) aPosition : vec2<f32>,
|
|
956
|
+
) -> VSOutput {
|
|
957
|
+
return VSOutput(
|
|
958
|
+
filterVertexPosition(aPosition),
|
|
959
|
+
filterTextureCoord(aPosition),
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
@fragment
|
|
965
|
+
fn mainFragment(
|
|
966
|
+
@location(0) uv: vec2<f32>,
|
|
967
|
+
) -> @location(0) vec4<f32> {
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
var c = textureSample(uTexture, uSampler, uv);
|
|
971
|
+
|
|
972
|
+
if (colorMatrixUniforms.uAlpha == 0.0) {
|
|
973
|
+
return c;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
978
|
+
if (c.a > 0.0) {
|
|
979
|
+
c.r /= c.a;
|
|
980
|
+
c.g /= c.a;
|
|
981
|
+
c.b /= c.a;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
var cm = colorMatrixUniforms.uColorMatrix;
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
var result = vec4<f32>(0.);
|
|
988
|
+
|
|
989
|
+
result.r = (cm[0][0] * c.r);
|
|
990
|
+
result.r += (cm[0][1] * c.g);
|
|
991
|
+
result.r += (cm[0][2] * c.b);
|
|
992
|
+
result.r += (cm[0][3] * c.a);
|
|
993
|
+
result.r += cm[1][0];
|
|
994
|
+
|
|
995
|
+
result.g = (cm[1][1] * c.r);
|
|
996
|
+
result.g += (cm[1][2] * c.g);
|
|
997
|
+
result.g += (cm[1][3] * c.b);
|
|
998
|
+
result.g += (cm[2][0] * c.a);
|
|
999
|
+
result.g += cm[2][1];
|
|
1000
|
+
|
|
1001
|
+
result.b = (cm[2][2] * c.r);
|
|
1002
|
+
result.b += (cm[2][3] * c.g);
|
|
1003
|
+
result.b += (cm[3][0] * c.b);
|
|
1004
|
+
result.b += (cm[3][1] * c.a);
|
|
1005
|
+
result.b += cm[3][2];
|
|
1006
|
+
|
|
1007
|
+
result.a = (cm[3][3] * c.r);
|
|
1008
|
+
result.a += (cm[4][0] * c.g);
|
|
1009
|
+
result.a += (cm[4][1] * c.b);
|
|
1010
|
+
result.a += (cm[4][2] * c.a);
|
|
1011
|
+
result.a += cm[4][3];
|
|
1012
|
+
|
|
1013
|
+
var rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha);
|
|
1014
|
+
|
|
1015
|
+
rgb.r *= result.a;
|
|
1016
|
+
rgb.g *= result.a;
|
|
1017
|
+
rgb.b *= result.a;
|
|
1018
|
+
|
|
1019
|
+
return vec4(rgb, result.a);
|
|
1020
|
+
}`,ZC=Object.defineProperty,QC=Object.defineProperties,JC=Object.getOwnPropertyDescriptors,Y_=Object.getOwnPropertySymbols,tM=Object.prototype.hasOwnProperty,eM=Object.prototype.propertyIsEnumerable,K_=(r,t,e)=>t in r?ZC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rM=(r,t)=>{for(var e in t||(t={}))tM.call(t,e)&&K_(r,e,t[e]);if(Y_)for(var e of Y_(t))eM.call(t,e)&&K_(r,e,t[e]);return r},iM=(r,t)=>QC(r,JC(t));class nM extends Pe{constructor(t={}){const e=new At({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"}}),i=Xt.from({vertex:{source:Hl,entryPoint:"mainVertex"},fragment:{source:Hl,entryPoint:"mainFragment"}}),n=Wt.from({vertex:bi,fragment:V_,name:"color-matrix-filter"});super(iM(rM({},t),{gpuProgram:i,glProgram:n,resources:{colorMatrixUniforms:e}})),this.alpha=1}_loadMatrix(t,e=!1){if(e){const i=[...t];this._multiply(i,this.matrix,t),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=i}else this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t;this.resources.colorMatrixUniforms.update()}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,n,s]=tt.shared.setValue(t).toArray(),a=[i,0,0,0,0,0,n,0,0,0,0,0,s,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),n=Math.sin(t),s=Math.sqrt,a=1/3,o=s(a),l=i+(1-i)*a,u=a*(1-i)-o*n,c=a*(1-i)+o*n,h=a*(1-i)+o*n,p=i+a*(1-i),f=a*(1-i)-o*n,m=a*(1-i)-o*n,g=a*(1-i)+o*n,_=i+a*(1-i),y=[l,u,c,0,0,h,p,f,0,0,m,g,_,0,0,0,0,0,1,0];this._loadMatrix(y,e)}contrast(t,e){const i=(t||0)+1,n=-.5*(i-1),s=[i,0,0,0,n,0,i,0,0,n,0,0,i,0,n,0,0,0,1,0];this._loadMatrix(s,e)}saturate(t=0,e){const i=t*2/3+1,n=(i-1)*-.5,s=[i,n,n,0,0,n,i,n,0,0,n,n,i,0,0,0,0,0,1,0];this._loadMatrix(s,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,.046249425232852304,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-.2758903984886823,-.231103377548616,-.7501899197440212,1.847597816108189,0,.12137623870388682,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,.24991995145868634,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,.09698983488904393,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,.13972481597886063,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,.1860075629647401,-.037703249837783157,.8609577587992641,.15059552388459913,0,-.14497417640467167,.24113635128153335,-.07441037908422492,.44972182064877153,0,-.029655197167024642,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,.037848179746251466,.02578397704808868,.6441188644374771,.03259127616149294,0,.029265996770472907,.0466055556782719,-.0851232987247891,.5241648018700465,0,.020232119953863904,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,n,s){t||(t=.2),e||(e=.15),i||(i=16770432),n||(n=3375104);const a=tt.shared,[o,l,u]=a.setValue(i).toArray(),[c,h,p]=a.setValue(n).toArray(),f=[.3,.59,.11,0,0,o,l,u,t,0,c,h,p,e,0,o-c,l-h,u-p,0,0];this._loadMatrix(f,s)}night(t,e){t||(t=.1);const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}}var q_=`
|
|
1021
|
+
in vec2 vTextureCoord;
|
|
1022
|
+
in vec2 vFilterUv;
|
|
1023
|
+
|
|
1024
|
+
out vec4 finalColor;
|
|
1025
|
+
|
|
1026
|
+
uniform sampler2D uTexture;
|
|
1027
|
+
uniform sampler2D uMapTexture;
|
|
1028
|
+
|
|
1029
|
+
uniform vec4 uInputClamp;
|
|
1030
|
+
uniform highp vec4 uInputSize;
|
|
1031
|
+
uniform mat2 uRotation;
|
|
1032
|
+
uniform vec2 uScale;
|
|
1033
|
+
|
|
1034
|
+
void main()
|
|
1035
|
+
{
|
|
1036
|
+
vec4 map = texture(uMapTexture, vFilterUv);
|
|
1037
|
+
|
|
1038
|
+
vec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale;
|
|
1039
|
+
|
|
1040
|
+
finalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw));
|
|
1041
|
+
}
|
|
1042
|
+
`,Z_=`in vec2 aPosition;
|
|
1043
|
+
out vec2 vTextureCoord;
|
|
1044
|
+
out vec2 vFilterUv;
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
uniform vec4 uInputSize;
|
|
1048
|
+
uniform vec4 uOutputFrame;
|
|
1049
|
+
uniform vec4 uOutputTexture;
|
|
1050
|
+
|
|
1051
|
+
uniform mat3 uFilterMatrix;
|
|
1052
|
+
|
|
1053
|
+
vec4 filterVertexPosition( void )
|
|
1054
|
+
{
|
|
1055
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
1056
|
+
|
|
1057
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
1058
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
1059
|
+
|
|
1060
|
+
return vec4(position, 0.0, 1.0);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
vec2 filterTextureCoord( void )
|
|
1064
|
+
{
|
|
1065
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
vec2 getFilterCoord( void )
|
|
1069
|
+
{
|
|
1070
|
+
return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
void main(void)
|
|
1075
|
+
{
|
|
1076
|
+
gl_Position = filterVertexPosition();
|
|
1077
|
+
vTextureCoord = filterTextureCoord();
|
|
1078
|
+
vFilterUv = getFilterCoord();
|
|
1079
|
+
}
|
|
1080
|
+
`,zl=`
|
|
1081
|
+
struct GlobalFilterUniforms {
|
|
1082
|
+
uInputSize:vec4<f32>,
|
|
1083
|
+
uInputPixel:vec4<f32>,
|
|
1084
|
+
uInputClamp:vec4<f32>,
|
|
1085
|
+
uOutputFrame:vec4<f32>,
|
|
1086
|
+
uGlobalFrame:vec4<f32>,
|
|
1087
|
+
uOutputTexture:vec4<f32>,
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
struct DisplacementUniforms {
|
|
1091
|
+
uFilterMatrix:mat3x3<f32>,
|
|
1092
|
+
uScale:vec2<f32>,
|
|
1093
|
+
uRotation:mat2x2<f32>
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1099
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1100
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1101
|
+
|
|
1102
|
+
@group(1) @binding(0) var<uniform> filterUniforms : DisplacementUniforms;
|
|
1103
|
+
@group(1) @binding(1) var uMapTexture: texture_2d<f32>;
|
|
1104
|
+
@group(1) @binding(2) var uMapSampler : sampler;
|
|
1105
|
+
|
|
1106
|
+
struct VSOutput {
|
|
1107
|
+
@builtin(position) position: vec4<f32>,
|
|
1108
|
+
@location(0) uv : vec2<f32>,
|
|
1109
|
+
@location(1) filterUv : vec2<f32>,
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1113
|
+
{
|
|
1114
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1115
|
+
|
|
1116
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1117
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1118
|
+
|
|
1119
|
+
return vec4(position, 0.0, 1.0);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1123
|
+
{
|
|
1124
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1128
|
+
{
|
|
1129
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
1133
|
+
{
|
|
1134
|
+
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
fn getSize() -> vec2<f32>
|
|
1138
|
+
{
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
return gfu.uGlobalFrame.zw;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
@vertex
|
|
1145
|
+
fn mainVertex(
|
|
1146
|
+
@location(0) aPosition : vec2<f32>,
|
|
1147
|
+
) -> VSOutput {
|
|
1148
|
+
return VSOutput(
|
|
1149
|
+
filterVertexPosition(aPosition),
|
|
1150
|
+
filterTextureCoord(aPosition),
|
|
1151
|
+
getFilterCoord(aPosition)
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
@fragment
|
|
1156
|
+
fn mainFragment(
|
|
1157
|
+
@location(0) uv: vec2<f32>,
|
|
1158
|
+
@location(1) filterUv: vec2<f32>,
|
|
1159
|
+
@builtin(position) position: vec4<f32>
|
|
1160
|
+
) -> @location(0) vec4<f32> {
|
|
1161
|
+
|
|
1162
|
+
var map = textureSample(uMapTexture, uMapSampler, filterUv);
|
|
1163
|
+
|
|
1164
|
+
var offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale;
|
|
1165
|
+
|
|
1166
|
+
return textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw));
|
|
1167
|
+
}`,sM=Object.defineProperty,aM=Object.defineProperties,oM=Object.getOwnPropertyDescriptors,fs=Object.getOwnPropertySymbols,Q_=Object.prototype.hasOwnProperty,J_=Object.prototype.propertyIsEnumerable,ty=(r,t,e)=>t in r?sM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lM=(r,t)=>{for(var e in t||(t={}))Q_.call(t,e)&&ty(r,e,t[e]);if(fs)for(var e of fs(t))J_.call(t,e)&&ty(r,e,t[e]);return r},uM=(r,t)=>aM(r,oM(t)),cM=(r,t)=>{var e={};for(var i in r)Q_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&fs)for(var i of fs(r))t.indexOf(i)<0&&J_.call(r,i)&&(e[i]=r[i]);return e};class hM extends Pe{constructor(...t){let e=t[0];e instanceof pe&&(e={sprite:e,scale:t[1]});const i=e,{sprite:n,scale:s}=i,a=cM(i,["sprite","scale"]);let o=s!=null?s:20;typeof o=="number"&&(o=new lt(o,o));const l=new At({uFilterMatrix:{value:new U,type:"mat3x3<f32>"},uScale:{value:o,type:"vec2<f32>"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2<f32>"}}),u=Wt.from({vertex:Z_,fragment:q_,name:"displacement-filter"}),c=Xt.from({vertex:{source:zl,entryPoint:"mainVertex"},fragment:{source:zl,entryPoint:"mainFragment"}}),h=n.texture.source;super(uM(lM({},a),{gpuProgram:c,glProgram:u,resources:{filterUniforms:l,uMapTexture:h,uMapSampler:h.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,i,n){const s=this.resources.filterUniforms.uniforms;t.calculateSpriteMatrix(s.uFilterMatrix,this._sprite);const a=this._sprite.worldTransform,o=Math.sqrt(a.a*a.a+a.b*a.b),l=Math.sqrt(a.c*a.c+a.d*a.d);o!==0&&l!==0&&(s.uRotation[0]=a.a/o,s.uRotation[1]=a.b/o,s.uRotation[2]=a.c/l,s.uRotation[3]=a.d/l),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,i,n)}get scale(){return this.resources.filterUniforms.uniforms.uScale}}var ey=`
|
|
1168
|
+
in vec2 vTextureCoord;
|
|
1169
|
+
in vec4 vColor;
|
|
1170
|
+
|
|
1171
|
+
out vec4 finalColor;
|
|
1172
|
+
|
|
1173
|
+
uniform float uNoise;
|
|
1174
|
+
uniform float uSeed;
|
|
1175
|
+
uniform sampler2D uTexture;
|
|
1176
|
+
|
|
1177
|
+
float rand(vec2 co)
|
|
1178
|
+
{
|
|
1179
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
void main()
|
|
1183
|
+
{
|
|
1184
|
+
vec4 color = texture(uTexture, vTextureCoord);
|
|
1185
|
+
float randomValue = rand(gl_FragCoord.xy * uSeed);
|
|
1186
|
+
float diff = (randomValue - 0.5) * uNoise;
|
|
1187
|
+
|
|
1188
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
1189
|
+
if (color.a > 0.0) {
|
|
1190
|
+
color.rgb /= color.a;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
color.r += diff;
|
|
1194
|
+
color.g += diff;
|
|
1195
|
+
color.b += diff;
|
|
1196
|
+
|
|
1197
|
+
// Premultiply alpha again.
|
|
1198
|
+
color.rgb *= color.a;
|
|
1199
|
+
|
|
1200
|
+
finalColor = color;
|
|
1201
|
+
}
|
|
1202
|
+
`,Wl=`
|
|
1203
|
+
|
|
1204
|
+
struct GlobalFilterUniforms {
|
|
1205
|
+
uInputSize:vec4<f32>,
|
|
1206
|
+
uInputPixel:vec4<f32>,
|
|
1207
|
+
uInputClamp:vec4<f32>,
|
|
1208
|
+
uOutputFrame:vec4<f32>,
|
|
1209
|
+
uGlobalFrame:vec4<f32>,
|
|
1210
|
+
uOutputTexture:vec4<f32>,
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
struct NoiseUniforms {
|
|
1214
|
+
uNoise:f32,
|
|
1215
|
+
uSeed:f32,
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1219
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1220
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1221
|
+
|
|
1222
|
+
@group(1) @binding(0) var<uniform> noiseUniforms : NoiseUniforms;
|
|
1223
|
+
|
|
1224
|
+
struct VSOutput {
|
|
1225
|
+
@builtin(position) position: vec4<f32>,
|
|
1226
|
+
@location(0) uv : vec2<f32>
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1230
|
+
{
|
|
1231
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1232
|
+
|
|
1233
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1234
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1235
|
+
|
|
1236
|
+
return vec4(position, 0.0, 1.0);
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1240
|
+
{
|
|
1241
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1245
|
+
{
|
|
1246
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
fn getSize() -> vec2<f32>
|
|
1250
|
+
{
|
|
1251
|
+
return gfu.uGlobalFrame.zw;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
@vertex
|
|
1255
|
+
fn mainVertex(
|
|
1256
|
+
@location(0) aPosition : vec2<f32>,
|
|
1257
|
+
) -> VSOutput {
|
|
1258
|
+
return VSOutput(
|
|
1259
|
+
filterVertexPosition(aPosition),
|
|
1260
|
+
filterTextureCoord(aPosition)
|
|
1261
|
+
);
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
fn rand(co:vec2<f32>) -> f32
|
|
1265
|
+
{
|
|
1266
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
@fragment
|
|
1272
|
+
fn mainFragment(
|
|
1273
|
+
@location(0) uv: vec2<f32>,
|
|
1274
|
+
@builtin(position) position: vec4<f32>
|
|
1275
|
+
) -> @location(0) vec4<f32> {
|
|
1276
|
+
|
|
1277
|
+
var pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy);
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
var sample = textureSample(uTexture, uSampler, uv);
|
|
1281
|
+
var randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed);
|
|
1282
|
+
var diff = (randomValue - 0.5) * noiseUniforms.uNoise;
|
|
1283
|
+
|
|
1284
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
1285
|
+
if (sample.a > 0.0) {
|
|
1286
|
+
sample.r /= sample.a;
|
|
1287
|
+
sample.g /= sample.a;
|
|
1288
|
+
sample.b /= sample.a;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
sample.r += diff;
|
|
1292
|
+
sample.g += diff;
|
|
1293
|
+
sample.b += diff;
|
|
1294
|
+
|
|
1295
|
+
// Premultiply alpha again.
|
|
1296
|
+
sample.r *= sample.a;
|
|
1297
|
+
sample.g *= sample.a;
|
|
1298
|
+
sample.b *= sample.a;
|
|
1299
|
+
|
|
1300
|
+
return sample;
|
|
1301
|
+
}`,dM=Object.defineProperty,pM=Object.defineProperties,fM=Object.getOwnPropertyDescriptors,ms=Object.getOwnPropertySymbols,ry=Object.prototype.hasOwnProperty,iy=Object.prototype.propertyIsEnumerable,ny=(r,t,e)=>t in r?dM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vl=(r,t)=>{for(var e in t||(t={}))ry.call(t,e)&&ny(r,e,t[e]);if(ms)for(var e of ms(t))iy.call(t,e)&&ny(r,e,t[e]);return r},mM=(r,t)=>pM(r,fM(t)),gM=(r,t)=>{var e={};for(var i in r)ry.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ms)for(var i of ms(r))t.indexOf(i)<0&&iy.call(r,i)&&(e[i]=r[i]);return e};const sy=class k1 extends Pe{constructor(t={}){t=Vl(Vl({},k1.defaultOptions),t);const e=Xt.from({vertex:{source:Wl,entryPoint:"mainVertex"},fragment:{source:Wl,entryPoint:"mainFragment"}}),i=Wt.from({vertex:bi,fragment:ey,name:"noise-filter"}),n=t,{noise:s,seed:a}=n,o=gM(n,["noise","seed"]);super(mM(Vl({},o),{gpuProgram:e,glProgram:i,resources:{noiseUniforms:new At({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=s,this.seed=a!=null?a:Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(t){this.resources.noiseUniforms.uniforms.uNoise=t}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(t){this.resources.noiseUniforms.uniforms.uSeed=t}};sy.defaultOptions={noise:.5};let _M=sy;var ay=`in vec2 vMaskCoord;
|
|
1302
|
+
in vec2 vTextureCoord;
|
|
1303
|
+
|
|
1304
|
+
uniform sampler2D uTexture;
|
|
1305
|
+
uniform sampler2D uMaskTexture;
|
|
1306
|
+
|
|
1307
|
+
uniform float uAlpha;
|
|
1308
|
+
uniform vec4 uMaskClamp;
|
|
1309
|
+
uniform float uInverse;
|
|
1310
|
+
uniform float uChannel;
|
|
1311
|
+
|
|
1312
|
+
out vec4 finalColor;
|
|
1313
|
+
|
|
1314
|
+
void main(void)
|
|
1315
|
+
{
|
|
1316
|
+
float clip = step(3.5,
|
|
1317
|
+
step(uMaskClamp.x, vMaskCoord.x) +
|
|
1318
|
+
step(uMaskClamp.y, vMaskCoord.y) +
|
|
1319
|
+
step(vMaskCoord.x, uMaskClamp.z) +
|
|
1320
|
+
step(vMaskCoord.y, uMaskClamp.w));
|
|
1321
|
+
|
|
1322
|
+
// TODO look into why this is needed
|
|
1323
|
+
float npmAlpha = uAlpha;
|
|
1324
|
+
vec4 original = texture(uTexture, vTextureCoord);
|
|
1325
|
+
vec4 masky = texture(uMaskTexture, vMaskCoord);
|
|
1326
|
+
|
|
1327
|
+
float a;
|
|
1328
|
+
if (uChannel == 1.0) {
|
|
1329
|
+
a = masky.a * npmAlpha * clip;
|
|
1330
|
+
} else {
|
|
1331
|
+
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
1332
|
+
a = alphaMul * masky.r * npmAlpha * clip;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
if (uInverse == 1.0) {
|
|
1336
|
+
a = 1.0 - a;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
finalColor = original * a;
|
|
1340
|
+
}
|
|
1341
|
+
`,oy=`in vec2 aPosition;
|
|
1342
|
+
|
|
1343
|
+
out vec2 vTextureCoord;
|
|
1344
|
+
out vec2 vMaskCoord;
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
uniform vec4 uInputSize;
|
|
1348
|
+
uniform vec4 uOutputFrame;
|
|
1349
|
+
uniform vec4 uOutputTexture;
|
|
1350
|
+
uniform mat3 uFilterMatrix;
|
|
1351
|
+
|
|
1352
|
+
vec4 filterVertexPosition( vec2 aPosition )
|
|
1353
|
+
{
|
|
1354
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
1355
|
+
|
|
1356
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
1357
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
1358
|
+
|
|
1359
|
+
return vec4(position, 0.0, 1.0);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
vec2 filterTextureCoord( vec2 aPosition )
|
|
1363
|
+
{
|
|
1364
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
vec2 getFilterCoord( vec2 aPosition )
|
|
1368
|
+
{
|
|
1369
|
+
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
void main(void)
|
|
1373
|
+
{
|
|
1374
|
+
gl_Position = filterVertexPosition(aPosition);
|
|
1375
|
+
vTextureCoord = filterTextureCoord(aPosition);
|
|
1376
|
+
vMaskCoord = getFilterCoord(aPosition);
|
|
1377
|
+
}
|
|
1378
|
+
`,Yl=`struct GlobalFilterUniforms {
|
|
1379
|
+
uInputSize:vec4<f32>,
|
|
1380
|
+
uInputPixel:vec4<f32>,
|
|
1381
|
+
uInputClamp:vec4<f32>,
|
|
1382
|
+
uOutputFrame:vec4<f32>,
|
|
1383
|
+
uGlobalFrame:vec4<f32>,
|
|
1384
|
+
uOutputTexture:vec4<f32>,
|
|
1385
|
+
};
|
|
1386
|
+
|
|
1387
|
+
struct MaskUniforms {
|
|
1388
|
+
uFilterMatrix:mat3x3<f32>,
|
|
1389
|
+
uMaskClamp:vec4<f32>,
|
|
1390
|
+
uAlpha:f32,
|
|
1391
|
+
uInverse:f32,
|
|
1392
|
+
uChannel:f32,
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
|
|
1396
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
1397
|
+
@group(0) @binding(2) var uSampler : sampler;
|
|
1398
|
+
|
|
1399
|
+
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
|
|
1400
|
+
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
|
|
1401
|
+
|
|
1402
|
+
struct VSOutput {
|
|
1403
|
+
@builtin(position) position: vec4<f32>,
|
|
1404
|
+
@location(0) uv : vec2<f32>,
|
|
1405
|
+
@location(1) filterUv : vec2<f32>,
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1408
|
+
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
|
|
1409
|
+
{
|
|
1410
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
1411
|
+
|
|
1412
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
1413
|
+
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
1414
|
+
|
|
1415
|
+
return vec4(position, 0.0, 1.0);
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1419
|
+
{
|
|
1420
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
|
|
1424
|
+
{
|
|
1425
|
+
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
|
|
1429
|
+
{
|
|
1430
|
+
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
fn getSize() -> vec2<f32>
|
|
1434
|
+
{
|
|
1435
|
+
return gfu.uGlobalFrame.zw;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
@vertex
|
|
1439
|
+
fn mainVertex(
|
|
1440
|
+
@location(0) aPosition : vec2<f32>,
|
|
1441
|
+
) -> VSOutput {
|
|
1442
|
+
return VSOutput(
|
|
1443
|
+
filterVertexPosition(aPosition),
|
|
1444
|
+
filterTextureCoord(aPosition),
|
|
1445
|
+
getFilterCoord(aPosition)
|
|
1446
|
+
);
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
@fragment
|
|
1450
|
+
fn mainFragment(
|
|
1451
|
+
@location(0) uv: vec2<f32>,
|
|
1452
|
+
@location(1) filterUv: vec2<f32>,
|
|
1453
|
+
@builtin(position) position: vec4<f32>
|
|
1454
|
+
) -> @location(0) vec4<f32> {
|
|
1455
|
+
|
|
1456
|
+
var maskClamp = filterUniforms.uMaskClamp;
|
|
1457
|
+
var uAlpha = filterUniforms.uAlpha;
|
|
1458
|
+
|
|
1459
|
+
var clip = step(3.5,
|
|
1460
|
+
step(maskClamp.x, filterUv.x) +
|
|
1461
|
+
step(maskClamp.y, filterUv.y) +
|
|
1462
|
+
step(filterUv.x, maskClamp.z) +
|
|
1463
|
+
step(filterUv.y, maskClamp.w));
|
|
1464
|
+
|
|
1465
|
+
var mask = textureSample(uMaskTexture, uSampler, filterUv);
|
|
1466
|
+
var source = textureSample(uTexture, uSampler, uv);
|
|
1467
|
+
|
|
1468
|
+
var a: f32;
|
|
1469
|
+
if (filterUniforms.uChannel == 1.0) {
|
|
1470
|
+
a = mask.a * uAlpha * clip;
|
|
1471
|
+
} else {
|
|
1472
|
+
var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);
|
|
1473
|
+
a = alphaMul * mask.r * uAlpha * clip;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
if (filterUniforms.uInverse == 1.0) {
|
|
1477
|
+
a = 1.0 - a;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
return source * a;
|
|
1481
|
+
}
|
|
1482
|
+
`,yM=Object.defineProperty,bM=Object.defineProperties,vM=Object.getOwnPropertyDescriptors,gs=Object.getOwnPropertySymbols,ly=Object.prototype.hasOwnProperty,uy=Object.prototype.propertyIsEnumerable,cy=(r,t,e)=>t in r?yM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xM=(r,t)=>{for(var e in t||(t={}))ly.call(t,e)&&cy(r,e,t[e]);if(gs)for(var e of gs(t))uy.call(t,e)&&cy(r,e,t[e]);return r},TM=(r,t)=>bM(r,vM(t)),SM=(r,t)=>{var e={};for(var i in r)ly.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&gs)for(var i of gs(r))t.indexOf(i)<0&&uy.call(r,i)&&(e[i]=r[i]);return e};class hy extends Pe{constructor(t){const e=t,{sprite:i}=e,n=SM(e,["sprite"]),s=new $a(i.texture),a=new At({uFilterMatrix:{value:new U,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"},uChannel:{value:t.channel==="alpha"?1:0,type:"f32"}}),o=Xt.from({vertex:{source:Yl,entryPoint:"mainVertex"},fragment:{source:Yl,entryPoint:"mainFragment"}}),l=Wt.from({vertex:oy,fragment:ay,name:"mask-filter"});super(TM(xM({},n),{gpuProgram:o,glProgram:l,clipToViewport:!1,resources:{filterUniforms:a,uMaskTexture:i.texture.source}})),this.sprite=i,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}set channel(t){this.resources.filterUniforms.uniforms.uChannel=t==="alpha"?1:0}get channel(){return this.resources.filterUniforms.uniforms.uChannel===1?"alpha":"red"}apply(t,e,i,n){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,n)}}var wM=`fn getLuminosity(c: vec3<f32>) -> f32 {
|
|
1483
|
+
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32> {
|
|
1487
|
+
let d: f32 = lum - getLuminosity(c);
|
|
1488
|
+
let newColor: vec3<f32> = c.rgb + vec3<f32>(d, d, d);
|
|
1489
|
+
|
|
1490
|
+
// clip back into legal range
|
|
1491
|
+
let newLum: f32 = getLuminosity(newColor);
|
|
1492
|
+
let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b));
|
|
1493
|
+
let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b));
|
|
1494
|
+
|
|
1495
|
+
let t1: f32 = newLum / (newLum - cMin);
|
|
1496
|
+
let t2: f32 = (1.0 - newLum) / (cMax - newLum);
|
|
1497
|
+
|
|
1498
|
+
let finalColor = mix(vec3<f32>(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0));
|
|
1499
|
+
|
|
1500
|
+
return finalColor;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
fn getSaturation(c: vec3<f32>) -> f32 {
|
|
1504
|
+
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
// Set saturation if color components are sorted in ascending order.
|
|
1508
|
+
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32> {
|
|
1509
|
+
var result: vec3<f32>;
|
|
1510
|
+
if (cSorted.z > cSorted.x) {
|
|
1511
|
+
let newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x));
|
|
1512
|
+
result = vec3<f32>(0.0, newY, s);
|
|
1513
|
+
} else {
|
|
1514
|
+
result = vec3<f32>(0.0, 0.0, 0.0);
|
|
1515
|
+
}
|
|
1516
|
+
return vec3<f32>(result.x, result.y, result.z);
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
|
|
1520
|
+
var result: vec3<f32> = c;
|
|
1521
|
+
|
|
1522
|
+
if (c.r <= c.g && c.r <= c.b) {
|
|
1523
|
+
if (c.g <= c.b) {
|
|
1524
|
+
result = setSaturationMinMidMax(result, s);
|
|
1525
|
+
} else {
|
|
1526
|
+
var temp: vec3<f32> = vec3<f32>(result.r, result.b, result.g);
|
|
1527
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1528
|
+
result = vec3<f32>(temp.r, temp.b, temp.g);
|
|
1529
|
+
}
|
|
1530
|
+
} else if (c.g <= c.r && c.g <= c.b) {
|
|
1531
|
+
if (c.r <= c.b) {
|
|
1532
|
+
var temp: vec3<f32> = vec3<f32>(result.g, result.r, result.b);
|
|
1533
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1534
|
+
result = vec3<f32>(temp.g, temp.r, temp.b);
|
|
1535
|
+
} else {
|
|
1536
|
+
var temp: vec3<f32> = vec3<f32>(result.g, result.b, result.r);
|
|
1537
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1538
|
+
result = vec3<f32>(temp.g, temp.b, temp.r);
|
|
1539
|
+
}
|
|
1540
|
+
} else {
|
|
1541
|
+
if (c.r <= c.g) {
|
|
1542
|
+
var temp: vec3<f32> = vec3<f32>(result.b, result.r, result.g);
|
|
1543
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1544
|
+
result = vec3<f32>(temp.b, temp.r, temp.g);
|
|
1545
|
+
} else {
|
|
1546
|
+
var temp: vec3<f32> = vec3<f32>(result.b, result.g, result.r);
|
|
1547
|
+
temp = setSaturationMinMidMax(temp, s);
|
|
1548
|
+
result = vec3<f32>(temp.b, temp.g, temp.r);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
return result;
|
|
1553
|
+
}`;const dy=class L1{constructor(t){this._tick=()=>{this._destroyed||(this.timeout=setTimeout(this._processQueue,0))},this._processQueue=()=>{if(this._destroyed)return;const{queue:e}=this;let i=0;for(;e.length&&i<L1.uploadsPerFrame;){const n=e.shift();this.uploadQueueItem(n),i++}e.length?Ot.system.addOnce(this._tick,this,Te.UTILITY):this._resolve()},this.renderer=t,this.queue=[],this.resolves=[]}getQueue(){return[...this.queue]}add(t){const e=Array.isArray(t)?t:[t];for(const i of e)i instanceof dt?this._addContainer(i):this.resolveQueueItem(i,this.queue);return this}_addContainer(t){this.resolveQueueItem(t,this.queue);for(const e of t.children)this._addContainer(e)}upload(t){return t&&this.add(t),new Promise(e=>{this.queue.length?(this.resolves.push(e),this.dedupeQueue(),Ot.system.addOnce(this._tick,this,Te.UTILITY)):e()})}dedupeQueue(){const t=Object.create(null);let e=0;for(let i=0;i<this.queue.length;i++){const n=this.queue[i];t[n.uid]||(t[n.uid]=!0,this.queue[e++]=n)}this.queue.length=e}destroy(){this._destroyed=!0,clearTimeout(this.timeout)}_resolve(){const{resolves:t}=this,e=t.slice(0);t.length=0;for(const i of e)i()}};dy.uploadsPerFrame=4;let py=dy,EM=class{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}},PM=class{constructor(){this.instructions=new dn}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}};const Kl=class Mh{constructor(t){this._renderer=t,this._managedContexts=new Ut({renderer:t,type:"resource",name:"graphicsContext"})}init(t){var e;Mh.defaultOptions.bezierSmoothness=(e=t==null?void 0:t.bezierSmoothness)!=null?e:Mh.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,i=!!e[this._renderer.uid],n=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!i)&&(i&&n.reset(),n.isBatchable=!1,t.dirty=!1),n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new PM,i=this.getGpuContext(t);return i.graphicsData=e,e.init(),e}_initContext(t){const e=new EM;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};Kl.extension={type:[S.CanvasSystem],name:"graphicsContext"},Kl.defaultOptions={bezierSmoothness:.5};let fy=Kl;class ql{constructor(t,e){this.state=Vt.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ut({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}ql.extension={type:[S.CanvasPipes],name:"graphics"};function AM(r,t,e,i){e[i++]=(r>>16&255)/255,e[i++]=(r>>8&255)/255,e[i++]=(r&255)/255,e[i++]=t}function Yr(r,t,e){const i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}class my{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{Pt.return(t)}),this.batches.length=0}}class Zl{constructor(t,e){this.state=Vt.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ut({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,i=!!t._gpuData,n=this.renderer.graphicsContext.updateGpuContext(e);return!!(n.isBatchable||i!==n.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._getGpuDataForRenderable(t).batches;for(let i=0;i<e.length;i++){const n=e[i];n._batcher.updateElement(n)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;const n=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const s=n.resources.localUniforms.uniforms;s.uTransformMatrix=t.groupTransform,s.uRound=e._roundPixels|t._roundPixels,Yr(t.groupColorAlpha,s.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),i=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),i.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const i=this.renderer.renderPipes.batch,n=this._getGpuDataForRenderable(t).batches;for(let s=0;s<n.length;s++){const a=n[s];i.addToBatch(a,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new my;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const i=t.context,n=this.renderer.graphicsContext.getGpuContext(i),s=this.renderer._roundPixels|t._roundPixels;e.batches=n.batches.map(a=>{const o=Pt.get(Kn);return a.copyTo(o),o.renderable=t,o.roundPixels=s,o})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Zl.extension={type:[S.WebGLPipes,S.WebGPUPipes],name:"graphics"},N.add(ql),N.add(Zl),N.add(fy),N.add(Jn);var CM=Object.defineProperty,_s=Object.getOwnPropertySymbols,gy=Object.prototype.hasOwnProperty,_y=Object.prototype.propertyIsEnumerable,yy=(r,t,e)=>t in r?CM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,MM=(r,t)=>{for(var e in t||(t={}))gy.call(t,e)&&yy(r,e,t[e]);if(_s)for(var e of _s(t))_y.call(t,e)&&yy(r,e,t[e]);return r},RM=(r,t)=>{var e={};for(var i in r)gy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&_s)for(var i of _s(r))t.indexOf(i)<0&&_y.call(r,i)&&(e[i]=r[i]);return e};class hr extends Se{constructor(t){t instanceof kt&&(t={context:t});const e=t||{},{context:i,roundPixels:n}=e,s=RM(e,["context","roundPixels"]);super(MM({label:"Graphics"},s)),this.renderPipeId="graphics",i?this.context=i:(this.context=this._ownedContext=new kt,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=n!=null?n:!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,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(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new hr(this._context.clone()):(this._ownedContext=null,new hr(this._context))}lineStyle(t,e,i){const n={};return t&&(n.width=t),e&&(n.color=e),i&&(n.alpha=i),this.context.strokeStyle=n,this}beginFill(t,e){const i={};return t!==void 0&&(i.color=t),e!==void 0&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){this.context.fill();const t=this.context.strokeStyle;return(t.width!==kt.defaultStrokeStyle.width||t.color!==kt.defaultStrokeStyle.color||t.alpha!==kt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}var OM=Object.defineProperty,by=Object.getOwnPropertySymbols,GM=Object.prototype.hasOwnProperty,IM=Object.prototype.propertyIsEnumerable,vy=(r,t,e)=>t in r?OM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xy=(r,t)=>{for(var e in t||(t={}))GM.call(t,e)&&vy(r,e,t[e]);if(by)for(var e of by(t))IM.call(t,e)&&vy(r,e,t[e]);return r};const Ty=class N1 extends nr{constructor(...t){var e;let i=(e=t[0])!=null?e:{};i instanceof Float32Array&&(i={positions:i,uvs:t[1],indices:t[2]}),i=xy(xy({},N1.defaultOptions),i);const n=i.positions||new Float32Array([0,0,1,0,1,1,0,1]);let s=i.uvs;s||(i.positions?s=new Float32Array(n.length):s=new Float32Array([0,0,1,0,1,1,0,1]));const a=i.indices||new Uint32Array([0,1,2,0,2,3]),o=i.shrinkBuffersToFit,l=new Yt({data:n,label:"attribute-mesh-positions",shrinkToFit:o,usage:at.VERTEX|at.COPY_DST}),u=new Yt({data:s,label:"attribute-mesh-uvs",shrinkToFit:o,usage:at.VERTEX|at.COPY_DST}),c=new Yt({data:a,label:"index-mesh-buffer",shrinkToFit:o,usage:at.INDEX|at.COPY_DST});super({attributes:{aPosition:{buffer:l,format:"float32x2",stride:8,offset:0},aUV:{buffer:u,format:"float32x2",stride:8,offset:0}},indexBuffer:c,topology:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};Ty.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let ze=Ty;class ys{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(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){const t=this.geometry.getBuffer("aUV"),e=t.data;let i=e;const n=this.texture.textureMatrix;return n.isSimple||(i=this._transformedUvs,(this._textureMatrixUpdateId!==n._updateID||this._uvUpdateId!==t._updateID)&&((!i||i.length<e.length)&&(i=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=n._updateID,this._uvUpdateId=t._updateID,n.multiplyUvs(e,i))),i}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 Ql{destroy(){}}class Jl{constructor(t,e){this.localUniforms=new At({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Ee({0:this.localUniforms}),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=this._getMeshData(t),i=e.batched,n=t.batched;if(e.batched=n,i!==n)return!0;if(n){const s=t._geometry;if(s.indices.length!==e.indexSize||s.positions.length!==e.vertexSize)return e.indexSize=s.indices.length,e.vertexSize=s.positions.length,!0;const a=this._getBatchableMesh(t);return a.texture.uid!==t._texture.uid&&(a._textureMatrixUpdateId=-1),!a._batcher.checkAndUpdateTexture(a,t._texture)}return!1}addRenderable(t,e){var i,n;const s=this.renderer.renderPipes.batch,a=this._getMeshData(t);if(t.didViewUpdate&&(a.indexSize=(i=t._geometry.indices)==null?void 0:i.length,a.vertexSize=(n=t._geometry.positions)==null?void 0:n.length),a.batched){const o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,s.addToBatch(o,e)}else s.break(e),e.add(t)}updateRenderable(t){if(t.batched){const e=this._getBatchableMesh(t);e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ir(t.groupBlendMode,t.texture._source);const e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Yr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){var e,i;return(e=t._gpuData)[i=this.renderer.uid]||(e[i]=new Ql),t._gpuData[this.renderer.uid].meshData||this._initMeshData(t)}_initMeshData(t){return t._gpuData[this.renderer.uid].meshData={batched:t.batched,indexSize:0,vertexSize:0},t._gpuData[this.renderer.uid].meshData}_getBatchableMesh(t){var e,i;return(e=t._gpuData)[i=this.renderer.uid]||(e[i]=new Ql),t._gpuData[this.renderer.uid].batchableMesh||this._initBatchableMesh(t)}_initBatchableMesh(t){const e=new ys;return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,t._gpuData[this.renderer.uid].batchableMesh=e,e}destroy(){this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}Jl.extension={type:[S.WebGLPipes,S.WebGPUPipes],name:"mesh"},N.add(Jl);var BM=Object.defineProperty,bs=Object.getOwnPropertySymbols,Sy=Object.prototype.hasOwnProperty,wy=Object.prototype.propertyIsEnumerable,Ey=(r,t,e)=>t in r?BM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,FM=(r,t)=>{for(var e in t||(t={}))Sy.call(t,e)&&Ey(r,e,t[e]);if(bs)for(var e of bs(t))wy.call(t,e)&&Ey(r,e,t[e]);return r},DM=(r,t)=>{var e={};for(var i in r)Sy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&bs)for(var i of bs(r))t.indexOf(i)<0&&wy.call(r,i)&&(e[i]=r[i]);return e};class Kr extends Se{constructor(...t){var e;let i=t[0];i instanceof nr&&(i={geometry:i,shader:t[1]},t[3]&&(i.geometry.topology=t[3]));const n=i,{geometry:s,shader:a,texture:o,roundPixels:l,state:u}=n,c=DM(n,["geometry","shader","texture","roundPixels","state"]);super(FM({label:"Mesh"},c)),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=a!=null?a:null,this.texture=(e=o!=null?o:a==null?void 0:a.texture)!=null?e:D.WHITE,this.state=u!=null?u:Vt.for2d(),this._geometry=s,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=l!=null?l:!1}get material(){return this._shader}set shader(t){this._shader!==t&&(this._shader=t,this.onViewUpdate())}get shader(){return this._shader}set geometry(t){var e;this._geometry!==t&&((e=this._geometry)==null||e.off("update",this.onViewUpdate,this),t.on("update",this.onViewUpdate,this),this._geometry=t,this.onViewUpdate())}get geometry(){return this._geometry}set texture(t){t||(t=D.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=t),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get batched(){return this._shader||(this.state.data&12)!==0?!1:this._geometry instanceof ze?this._geometry.batchMode==="auto"?this._geometry.positions.length/2<=100:this._geometry.batchMode==="batch":!1}get bounds(){return this._geometry.bounds}updateBounds(){this._bounds=this._geometry.bounds}containsPoint(t){const{x:e,y:i}=t;if(!this.bounds.containsPoint(e,i))return!1;const n=this.geometry.getBuffer("aPosition").data,s=this.geometry.topology==="triangle-strip"?3:1;if(this.geometry.getIndex()){const a=this.geometry.getIndex().data,o=a.length;for(let l=0;l+2<o;l+=s){const u=a[l]*2,c=a[l+1]*2,h=a[l+2]*2;if(oo(e,i,n[u],n[u+1],n[c],n[c+1],n[h],n[h+1]))return!0}}else{const a=n.length/2;for(let o=0;o+2<a;o+=s){const l=o*2,u=(o+1)*2,c=(o+2)*2;if(oo(e,i,n[l],n[l+1],n[u],n[u+1],n[c],n[c+1]))return!0}}return!1}destroy(t){var e;if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}(e=this._geometry)==null||e.off("update",this.onViewUpdate,this),this._texture=null,this._geometry=null,this._shader=null}}var UM=Object.defineProperty,$M=Object.defineProperties,kM=Object.getOwnPropertyDescriptors,vs=Object.getOwnPropertySymbols,Py=Object.prototype.hasOwnProperty,Ay=Object.prototype.propertyIsEnumerable,Cy=(r,t,e)=>t in r?UM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,LM=(r,t)=>{for(var e in t||(t={}))Py.call(t,e)&&Cy(r,e,t[e]);if(vs)for(var e of vs(t))Ay.call(t,e)&&Cy(r,e,t[e]);return r},NM=(r,t)=>$M(r,kM(t)),XM=(r,t)=>{var e={};for(var i in r)Py.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&vs)for(var i of vs(r))t.indexOf(i)<0&&Ay.call(r,i)&&(e[i]=r[i]);return e};class Xi extends pe{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const i=e,{animationSpeed:n=1,autoPlay:s=!1,autoUpdate:a=!0,loop:o=!0,onComplete:l=null,onFrameChange:u=null,onLoop:c=null,textures:h,updateAnchor:p=!1}=i,f=XM(i,["animationSpeed","autoPlay","autoUpdate","loop","onComplete","onFrameChange","onLoop","textures","updateAnchor"]),[m]=h;super(NM(LM({},f),{texture:m instanceof D?m:m.texture})),this._textures=null,this._durations=null,this._autoUpdate=a,this._isConnectedToTicker=!1,this.animationSpeed=n,this.loop=o,this.updateAnchor=p,this.onComplete=l,this.onFrameChange=u,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=h,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Ot.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Ot.shared.add(this.update,this,Te.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,i=this.animationSpeed*e,n=this.currentFrame;if(this._durations!==null){let s=this._currentTime%1*this._durations[this.currentFrame];for(s+=i/60*1e3;s<0;)this._currentTime--,s+=this._durations[this.currentFrame];const a=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);s>=this._durations[this.currentFrame];)s-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=s/this._durations[this.currentFrame]}else this._currentTime+=i;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 t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t=!1){if(typeof t=="boolean"?t:t!=null&&t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._textures.forEach(i=>{this.texture!==i&&i.destroy(e)})}this._textures=[],this._durations=null,this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;i<t.length;++i)e.push(D.from(t[i]));return new Xi(e)}static fromImages(t){const e=[];for(let i=0;i<t.length;++i)e.push(D.from(t[i]));return new Xi(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof D)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Ot.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Ot.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class My{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=t!=null?t:new U,this.observer=e,this.position=new bt(this,0,0),this.scale=new bt(this,1,1),this.pivot=new bt(this,0,0),this.skew=new bt(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const t=this._matrix;return this.dirty&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this.dirty=!1),t}_onUpdate(t){var e;this.dirty=!0,t===this.skew&&this.updateSkew(),(e=this.observer)==null||e._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}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}const xs=new U,Be=new U,Ae=[new lt,new lt,new lt,new lt];class tu{constructor(t){this._renderer=t}validateRenderable(t){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){var e,i,n,s,a,o;const l=this._renderer,u=l.canvasContext,c=u.activeContext;c.save(),u.setBlendMode(t.groupBlendMode);const h=(i=(e=l.globalUniforms.globalUniformData)==null?void 0:e.worldColor)!=null?i:4294967295,p=t.groupColorAlpha,f=(h>>>24&255)/255,m=(p>>>24&255)/255,g=(s=(n=l.filter)==null?void 0:n.alphaMultiplier)!=null?s:1,_=f*m*g;if(_<=0){c.restore();return}c.globalAlpha=_;const y=h&16777215,b=p&16777215,x=xe(Oe(b,y)),v=t.texture,w=Q.getTintedPattern(v,x),T=t.width,E=t.height,P=t.groupTransform,M=(o=(a=v.source._resolution)!=null?a:v.source.resolution)!=null?o:1;Be.copyFrom(t._tileTransform.matrix),t.applyAnchorToTexture||Be.translate(-t.anchor.x*T,-t.anchor.y*E);const C=Be.tx,A=Be.ty;Be.scale(1/M,1/M),Be.tx=C,Be.ty=A,xs.identity(),xs.prepend(Be),xs.prepend(P);const G=l._roundPixels|t._roundPixels;u.setContextTransform(xs,G===1),c.fillStyle=w;const F=t.anchor.x*-T,R=t.anchor.y*-E;Ae[0].set(F,R),Ae[1].set(F+T,R),Ae[2].set(F+T,R+E),Ae[3].set(F,R+E);for(let B=0;B<4;B++)Be.applyInverse(Ae[B],Ae[B]);c.beginPath(),c.moveTo(Ae[0].x,Ae[0].y);for(let B=1;B<4;B++)c.lineTo(Ae[B].x,Ae[B].y);c.closePath(),c.fill(),c.restore()}destroy(){this._renderer=null}}tu.extension={type:[S.CanvasPipes],name:"tilingSprite"};var jM=Object.defineProperty,HM=Object.defineProperties,zM=Object.getOwnPropertyDescriptors,Ry=Object.getOwnPropertySymbols,WM=Object.prototype.hasOwnProperty,VM=Object.prototype.propertyIsEnumerable,Oy=(r,t,e)=>t in r?jM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gy=(r,t)=>{for(var e in t||(t={}))WM.call(t,e)&&Oy(r,e,t[e]);if(Ry)for(var e of Ry(t))VM.call(t,e)&&Oy(r,e,t[e]);return r},Iy=(r,t)=>HM(r,zM(t));const qr={name:"local-uniform-bit",vertex:{header:`
|
|
1554
|
+
|
|
1555
|
+
struct LocalUniforms {
|
|
1556
|
+
uTransformMatrix:mat3x3<f32>,
|
|
1557
|
+
uColor:vec4<f32>,
|
|
1558
|
+
uRound:f32,
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
1562
|
+
`,main:`
|
|
1563
|
+
vColor *= localUniforms.uColor;
|
|
1564
|
+
modelMatrix *= localUniforms.uTransformMatrix;
|
|
1565
|
+
`,end:`
|
|
1566
|
+
if(localUniforms.uRound == 1)
|
|
1567
|
+
{
|
|
1568
|
+
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
1569
|
+
}
|
|
1570
|
+
`}},By=Iy(Gy({},qr),{vertex:Iy(Gy({},qr.vertex),{header:qr.vertex.header.replace("group(1)","group(2)")})}),Ts={name:"local-uniform-bit",vertex:{header:`
|
|
1571
|
+
|
|
1572
|
+
uniform mat3 uTransformMatrix;
|
|
1573
|
+
uniform vec4 uColor;
|
|
1574
|
+
uniform float uRound;
|
|
1575
|
+
`,main:`
|
|
1576
|
+
vColor *= uColor;
|
|
1577
|
+
modelMatrix = uTransformMatrix;
|
|
1578
|
+
`,end:`
|
|
1579
|
+
if(uRound == 1.)
|
|
1580
|
+
{
|
|
1581
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
1582
|
+
}
|
|
1583
|
+
`}},Fy={name:"tiling-bit",vertex:{header:`
|
|
1584
|
+
struct TilingUniforms {
|
|
1585
|
+
uMapCoord:mat3x3<f32>,
|
|
1586
|
+
uClampFrame:vec4<f32>,
|
|
1587
|
+
uClampOffset:vec2<f32>,
|
|
1588
|
+
uTextureTransform:mat3x3<f32>,
|
|
1589
|
+
uSizeAnchor:vec4<f32>
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
1593
|
+
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
1594
|
+
@group(2) @binding(2) var uSampler: sampler;
|
|
1595
|
+
`,main:`
|
|
1596
|
+
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
|
1597
|
+
|
|
1598
|
+
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
|
1599
|
+
`},fragment:{header:`
|
|
1600
|
+
struct TilingUniforms {
|
|
1601
|
+
uMapCoord:mat3x3<f32>,
|
|
1602
|
+
uClampFrame:vec4<f32>,
|
|
1603
|
+
uClampOffset:vec2<f32>,
|
|
1604
|
+
uTextureTransform:mat3x3<f32>,
|
|
1605
|
+
uSizeAnchor:vec4<f32>
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
1609
|
+
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
1610
|
+
@group(2) @binding(2) var uSampler: sampler;
|
|
1611
|
+
`,main:`
|
|
1612
|
+
|
|
1613
|
+
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
|
1614
|
+
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
|
1615
|
+
var unclamped = coord;
|
|
1616
|
+
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
|
1617
|
+
|
|
1618
|
+
var bias = 0.;
|
|
1619
|
+
|
|
1620
|
+
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
|
1621
|
+
{
|
|
1622
|
+
bias = -32.;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
1626
|
+
`}},Dy={name:"tiling-bit",vertex:{header:`
|
|
1627
|
+
uniform mat3 uTextureTransform;
|
|
1628
|
+
uniform vec4 uSizeAnchor;
|
|
1629
|
+
|
|
1630
|
+
`,main:`
|
|
1631
|
+
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
|
1632
|
+
|
|
1633
|
+
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
|
1634
|
+
`},fragment:{header:`
|
|
1635
|
+
uniform sampler2D uTexture;
|
|
1636
|
+
uniform mat3 uMapCoord;
|
|
1637
|
+
uniform vec4 uClampFrame;
|
|
1638
|
+
uniform vec2 uClampOffset;
|
|
1639
|
+
`,main:`
|
|
1640
|
+
|
|
1641
|
+
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
|
1642
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
1643
|
+
vec2 unclamped = coord;
|
|
1644
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
1645
|
+
|
|
1646
|
+
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
1647
|
+
|
|
1648
|
+
`}};let eu,ru;class Uy extends ee{constructor(){eu!=null||(eu=Fr({name:"tiling-sprite-shader",bits:[qr,Fy,Ur]})),ru!=null||(ru=Dr({name:"tiling-sprite-shader",bits:[Ts,Dy,$r]}));const t=new At({uMapCoord:{value:new U,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 U,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:ru,gpuProgram:eu,resources:{localUniforms:new At({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:D.EMPTY.source,uSampler:D.EMPTY.source.style}})}updateUniforms(t,e,i,n,s,a){const o=this.resources.tilingUniforms,l=a.width,u=a.height,c=a.textureMatrix,h=o.uniforms.uTextureTransform;h.set(i.a*l/t,i.b*l/e,i.c*u/t,i.d*u/e,i.tx/t,i.ty/e),h.invert(),o.uniforms.uMapCoord=c.mapCoord,o.uniforms.uClampFrame=c.uClampFrame,o.uniforms.uClampOffset=c.uClampOffset,o.uniforms.uTextureTransform=h,o.uniforms.uSizeAnchor[0]=t,o.uniforms.uSizeAnchor[1]=e,o.uniforms.uSizeAnchor[2]=n,o.uniforms.uSizeAnchor[3]=s,a&&(this.resources.uTexture=a.source,this.resources.uSampler=a.source.style)}}class $y extends ze{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 ky(r,t){const e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}function Ly(r,t,e,i){let n=0;const s=r.length/(t||2),a=i.a,o=i.b,l=i.c,u=i.d,c=i.tx,h=i.ty;for(e*=t;n<s;){const p=r[e],f=r[e+1];r[e]=a*p+l*f+c,r[e+1]=o*p+u*f+h,e+=t,n++}}function Ny(r,t){const e=r.texture,i=e.frame.width,n=e.frame.height;let s=0,a=0;r.applyAnchorToTexture&&(s=r.anchor.x,a=r.anchor.y),t[0]=t[6]=-s,t[2]=t[4]=1-s,t[1]=t[3]=-a,t[5]=t[7]=1-a;const o=r._tileTransform.matrix,l=U.shared;l.set(o.a*i/r.width,o.b*i/r.height,o.c*n/r.width,o.d*n/r.height,o.tx/r.width,o.ty/r.height),l.invert(),Ly(t,2,0,l)}const Ss=new $y;class Xy{constructor(){this.canBatch=!0,this.geometry=new ze({indices:Ss.indices.slice(),positions:Ss.positions.slice(),uvs:Ss.uvs.slice()})}destroy(){var t;this.geometry.destroy(),(t=this.shader)==null||t.destroy()}}class iu{constructor(t){this._state=Vt.default2d,this._renderer=t,this._managedTilingSprites=new Ut({renderer:t,type:"renderable",name:"tilingSprite"})}validateRenderable(t){const e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);const n=e.canBatch;if(n&&n===i){const{batchableMesh:s}=e;return!s._batcher.checkAndUpdateTexture(s,t.texture)}return i!==n}addRenderable(t,e){const i=this._renderer.renderPipes.batch;this._updateCanBatch(t);const n=this._getTilingSpriteData(t),{geometry:s,canBatch:a}=n;if(a){n.batchableMesh||(n.batchableMesh=new ys);const o=n.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),o.geometry=s,o.renderable=t,o.transform=t.groupTransform,o.setTexture(t._texture)),o.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(o,e)}else i.break(e),n.shader||(n.shader=new Uy),this.updateRenderable(t),e.add(t)}execute(t){const e=this._renderer,{shader:i}=this._getTilingSpriteData(t);i.groups[0]=e.globalUniforms.bindGroup;const n=i.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Yr(t.groupColorAlpha,n.uColor,0),this._state.blendMode=Ir(t.groupBlendMode,t.texture._source),e.encoder.draw({geometry:Ss,shader:i,state:this._state})}updateRenderable(t){const e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){const{batchableMesh:n}=e;t.didViewUpdate&&this._updateBatchableMesh(t),n._batcher.updateElement(n)}else if(t.didViewUpdate){const{shader:n}=e;n.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}_getTilingSpriteData(t){return t._gpuData[this._renderer.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){const e=new Xy;return e.renderable=t,t._gpuData[this._renderer.uid]=e,this._managedTilingSprites.add(t),e}_updateBatchableMesh(t){const e=this._getTilingSpriteData(t),{geometry:i}=e,n=t.texture.source.style;n.addressMode!=="repeat"&&(n.addressMode="repeat",n.update()),Ny(t,i.uvs),ky(t,i.positions)}destroy(){this._managedTilingSprites.destroy(),this._renderer=null}_updateCanBatch(t){const e=this._getTilingSpriteData(t),i=t.texture;let n=!0;return this._renderer.type===It.WEBGL&&(n=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(n||i.source.isPowerOfTwo),e.canBatch}}iu.extension={type:[S.WebGLPipes,S.WebGPUPipes],name:"tilingSprite"},N.add(tu),N.add(iu);var YM=Object.defineProperty,ws=Object.getOwnPropertySymbols,jy=Object.prototype.hasOwnProperty,Hy=Object.prototype.propertyIsEnumerable,zy=(r,t,e)=>t in r?YM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ji=(r,t)=>{for(var e in t||(t={}))jy.call(t,e)&&zy(r,e,t[e]);if(ws)for(var e of ws(t))Hy.call(t,e)&&zy(r,e,t[e]);return r},KM=(r,t)=>{var e={};for(var i in r)jy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ws)for(var i of ws(r))t.indexOf(i)<0&&Hy.call(r,i)&&(e[i]=r[i]);return e};const Wy=class Ta extends Se{constructor(...t){let e=t[0]||{};e instanceof D&&(e={texture:e}),t.length>1&&(e.width=t[1],e.height=t[2]),e=ji(ji({},Ta.defaultOptions),e);const i=e!=null?e:{},{texture:n,anchor:s,tilePosition:a,tileScale:o,tileRotation:l,width:u,height:c,applyAnchorToTexture:h,roundPixels:p}=i,f=KM(i,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(ji({label:"TilingSprite"},f)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new bt({_onUpdate:()=>{this.onViewUpdate()}}),this.applyAnchorToTexture=h,this.texture=n,this._width=u!=null?u:n.width,this._height=c!=null?c:n.height,this._tileTransform=new My({observer:{_onUpdate:()=>this.onViewUpdate()}}),s&&(this.anchor=s),this.tilePosition=a,this.tileScale=o,this.tileRotation=l,this.roundPixels=p!=null?p:!1}static from(t,e={}){return typeof t=="string"?new Ta(ji({texture:it.get(t)},e)):new Ta(ji({texture:t},e))}get uvRespectAnchor(){return Mi(Wo,"uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture}set uvRespectAnchor(t){Mi(Wo,"uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture=t}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){typeof t=="number"?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}set texture(t){t||(t=D.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}updateBounds(){const t=this._bounds,e=this._anchor,i=this._width,n=this._height;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}containsPoint(t){const e=this._width,i=this._height,n=-e*this._anchor._x;let s=0;return t.x>=n&&t.x<=n+e&&(s=-i*this._anchor._y,t.y>=s&&t.y<=s+i)}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};Wy.defaultOptions={texture:D.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let Vy=Wy;var qM=Object.defineProperty,Es=Object.getOwnPropertySymbols,Yy=Object.prototype.hasOwnProperty,Ky=Object.prototype.propertyIsEnumerable,qy=(r,t,e)=>t in r?qM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ZM=(r,t)=>{for(var e in t||(t={}))Yy.call(t,e)&&qy(r,e,t[e]);if(Es)for(var e of Es(t))Ky.call(t,e)&&qy(r,e,t[e]);return r},QM=(r,t)=>{var e={};for(var i in r)Yy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Es)for(var i of Es(r))t.indexOf(i)<0&&Ky.call(r,i)&&(e[i]=r[i]);return e};class Ps extends Se{constructor(t,e){const i=t,{text:n,resolution:s,style:a,anchor:o,width:l,height:u,roundPixels:c}=i,h=QM(i,["text","resolution","style","anchor","width","height","roundPixels"]);super(ZM({},h)),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=n!=null?n:"",this.style=a,this.resolution=s!=null?s:null,this.allowChildren=!1,this._anchor=new bt({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=c!=null?c:!1,l!==void 0&&(this.width=l),u!==void 0&&(this.height=u)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t||(t={}),(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){var i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,n=-e*this.anchor.x;let s=0;return t.x>=n&&t.x<=n+e&&(s=-i*this.anchor.y,t.y>=s&&t.y<=s+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}function As(r,t){var e;let i=(e=r[0])!=null?e:{};return(typeof i=="string"||r[1])&&(i={text:i,style:r[1]}),i}let dr=null,Fe=null;function JM(r,t){dr||(dr=H.get().createCanvas(256,128),Fe=dr.getContext("2d",{willReadFrequently:!0}),Fe.globalCompositeOperation="copy",Fe.globalAlpha=1),(dr.width<r||dr.height<t)&&(dr.width=Ze(r),dr.height=Ze(t))}function Zy(r,t,e){for(let i=0,n=4*e*t;i<t;++i,n+=4)if(r[n+3]!==0)return!1;return!0}function Qy(r,t,e,i,n){const s=4*t;for(let a=i,o=i*s+4*e;a<=n;++a,o+=s)if(r[o+3]!==0)return!1;return!0}function Jy(...r){var t,e,i;let n=r[0];n.canvas||(n={canvas:r[0],resolution:r[1]});const{canvas:s}=n,a=Math.min((t=n.resolution)!=null?t:1,1),o=(e=n.width)!=null?e:s.width,l=(i=n.height)!=null?i:s.height;let u=n.output;if(JM(o,l),!Fe)throw new TypeError("Failed to get canvas 2D context");Fe.drawImage(s,0,0,o,l,0,0,o*a,l*a);const c=Fe.getImageData(0,0,o,l).data;let h=0,p=0,f=o-1,m=l-1;for(;p<l&&Zy(c,o,p);)++p;if(p===l)return ut.EMPTY;for(;Zy(c,o,m);)--m;for(;Qy(c,o,h,p,m);)++h;for(;Qy(c,o,f,p,m);)--f;return++f,++m,Fe.globalCompositeOperation="source-over",Fe.strokeRect(h,p,f-h,m-p),Fe.globalCompositeOperation="copy",u!=null||(u=new ut),u.set(h/a,p/a,(f-h)/a,(m-p)/a),u}/**
|
|
1649
|
+
* tiny-lru
|
|
1650
|
+
*
|
|
1651
|
+
* @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
1652
|
+
* @license BSD-3-Clause
|
|
1653
|
+
* @version 11.4.7
|
|
1654
|
+
*/class tR{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++){const n=t[i];e[i]=[n,this.get(n)]}return e}evict(t=!1){if(t||this.size>0){const e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,i=0;for(;e!==null;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let n=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(n=A1({},this.first),this.evict(!0));let s=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=s:this.last.next=s,this.last=s}return n}set(t,e,i=!1,n=this.resetTtl){let s=this.items[t];return i||s!==void 0?(s.value=e,i===!1&&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[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=s:this.last.next=s,this.last=s),this}values(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=this.get(t[i]);return e}}function tb(r=1e3,t=0,e=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof e!="boolean")throw new TypeError("Invalid resetTtl value");return new tR(r,t,e)}function Cs(r){return!!r.tagStyles&&Object.keys(r.tagStyles).length>0}function Ms(r){return r.includes("<")}function eR(r,t){return r.clone().assign(t)}function nu(r,t){const e=[],i=t.tagStyles;if(!Cs(t)||!Ms(r))return e.push({text:r,style:t}),e;const n=[t],s=[];let a="",o=0;for(;o<r.length;){const l=r[o];if(l==="<"){const u=r.indexOf(">",o);if(u===-1){a+=l,o++;continue}const c=r.indexOf("<",o+1);if(c!==-1&&c<u){a+=l,o++;continue}const h=r.slice(o+1,u);if(h.startsWith("/")){const p=h.slice(1).trim();if(s.length>0&&s[s.length-1]===p){a.length>0&&(e.push({text:a,style:n[n.length-1]}),a=""),n.pop(),s.pop(),o=u+1;continue}else{a+=r.slice(o,u+1),o=u+1;continue}}else{const p=h.trim();if(i[p]){a.length>0&&(e.push({text:a,style:n[n.length-1]}),a="");const f=n[n.length-1],m=eR(f,i[p]);n.push(m),s.push(p),o=u+1;continue}else{a+=r.slice(o,u+1),o=u+1;continue}}}else a+=l,o++}return a.length>0&&e.push({text:a,style:n[n.length-1]}),e}function rR(r,t){return!Cs(t)||!Ms(r)?r:nu(r,t).map(e=>e.text).join("")}const eb=[10,13],rb=new Set(eb),ib=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],nb=new Set(ib),sb=[9,32],ab=new Set(sb),ob=[45,8208,8211,8212,173],lb=new Set(ob),ub=/(\r\n|\r|\n)/,cb=/(?:\r\n|\r|\n)/;function Hi(r){return typeof r!="string"?!1:rb.has(r.charCodeAt(0))}function Qt(r,t){return typeof r!="string"?!1:nb.has(r.charCodeAt(0))}function su(r){return typeof r!="string"?!1:ab.has(r.charCodeAt(0))}function au(r){return typeof r!="string"?!1:lb.has(r.charCodeAt(0))}function Rs(r){return r==="normal"||r==="pre-line"}function Os(r){return r==="normal"}function Ce(r){if(typeof r!="string")return"";let t=r.length-1;for(;t>=0&&Qt(r[t]);)t--;return t<r.length-1?r.slice(0,t+1):r}function ou(r){const t=[],e=[];if(typeof r!="string")return t;for(let i=0;i<r.length;i++){const n=r[i],s=r[i+1];if(Qt(n,s)||Hi(n)){e.length>0&&(t.push(e.join("")),e.length=0),n==="\r"&&s===`
|
|
1655
|
+
`?(t.push(`\r
|
|
1656
|
+
`),i++):t.push(n);continue}e.push(n),au(n)&&s&&!Qt(s)&&!Hi(s)&&(t.push(e.join("")),e.length=0)}return e.length>0&&t.push(e.join("")),t}function lu(r,t,e,i){const n=e(r),s=[];for(let a=0;a<n.length;a++){let o=n[a],l=o,u=1;for(;n[a+u];){const c=n[a+u];if(!i(l,c,r,a,t))o+=c,l=c,u++;else break}a+=u-1,s.push(o)}return s}const iR=/\r\n|\r|\n/g;function hb(r,t,e,i,n,s,a,o,l){var u,c;const h=nu(r,t);if(Os(t.whiteSpace))for(let B=0;B<h.length;B++){const O=h[B];h[B]={text:O.text.replace(iR," "),style:O.style}}const p=[];let f=[];for(const B of h){const O=B.text.split(ub);for(let I=0;I<O.length;I++){const L=O[I];L===`\r
|
|
1657
|
+
`||L==="\r"||L===`
|
|
1658
|
+
`?(p.push(f),f=[]):L.length>0&&f.push({text:L,style:B.style})}}(f.length>0||p.length===0)&&p.push(f);const m=e?db(p,t,i,s,o,l):p,g=[],_=[],y=[],b=[],x=[];let v=0;const w=t._fontString,T=a(w);T.fontSize===0&&(T.fontSize=t.fontSize,T.ascent=t.fontSize);let E="",P=!!t.dropShadow,M=((u=t._stroke)==null?void 0:u.width)||0;for(const B of m){let O=0,I=T.ascent,L=T.descent,j="";for(const K of B){const X=K.style._fontString,k=a(X);X!==E&&(i.font=X,E=X);const $=n(K.text,K.style.letterSpacing,i);O+=$,I=Math.max(I,k.ascent),L=Math.max(L,k.descent),j+=K.text;const z=((c=K.style._stroke)==null?void 0:c.width)||0;z>M&&(M=z),!P&&K.style.dropShadow&&(P=!0)}B.length===0&&(I=T.ascent,L=T.descent),g.push(O),_.push(I),y.push(L),x.push(j);const J=t.lineHeight||I+L;b.push(J+t.leading),v=Math.max(v,O)}const C=M,A=v+C+(t.dropShadow?t.dropShadow.distance:0);let G=0;for(let B=0;B<b.length;B++)G+=b[B];G=Math.max(G,b[0]+C);const F=G+(t.dropShadow?t.dropShadow.distance:0),R=t.lineHeight||T.fontSize;return{width:A,height:F,lines:x,lineWidths:g,lineHeight:R+t.leading,maxLineWidth:v,fontProperties:T,runsByLine:m,lineAscents:_,lineDescents:y,lineHeights:b,hasDropShadow:P}}function db(r,t,e,i,n,s){var a,o,l;const{letterSpacing:u,whiteSpace:c,wordWrapWidth:h,breakWords:p}=t,f=Rs(c),m=h+u,g={};let _="";const y=(x,v)=>{const w=`${x}|${v.styleKey}`;let T=g[w];if(T===void 0){const E=v._fontString;E!==_&&(e.font=E,_=E),T=i(x,v.letterSpacing,e)+v.letterSpacing,g[w]=T}return T},b=[];for(const x of r){const v=pb(x),w=b.length,T=R=>{let B=0,O=R;do{const{token:I,style:L}=v[O];B+=y(I,L),O++}while(O<v.length&&v[O].continuesFromPrevious);return B},E=R=>{const B=[];let O=R;do B.push({token:v[O].token,style:v[O].style}),O++;while(O<v.length&&v[O].continuesFromPrevious);return B};let P=[],M=0,C=!f,A=null;const G=()=>{A&&A.text.length>0&&P.push(A),A=null},F=()=>{if(G(),P.length>0){const R=P[P.length-1];R.text=Ce(R.text),R.text.length===0&&P.pop()}b.push(P),P=[],M=0,C=!1};for(let R=0;R<v.length;R++){const{token:B,style:O,continuesFromPrevious:I}=v[R],L=y(B,O);if(f){const K=Qt(B),X=(l=(o=A==null?void 0:A.text[A.text.length-1])!=null?o:(a=P[P.length-1])==null?void 0:a.text.slice(-1))!=null?l:"",k=X?Qt(X):!1;if(K&&k)continue}const j=!I,J=j?T(R):L;if(J>m&&j)if(M>0&&F(),p){const K=E(R);for(let X=0;X<K.length;X++){const k=K[X].token,$=K[X].style,z=lu(k,p,s,n);for(const rt of z){const _t=y(rt,$);_t+M>m&&F(),!A||A.style!==$?(G(),A={text:rt,style:$}):A.text+=rt,M+=_t}}R+=K.length-1}else{const K=E(R);G(),b.push(K.map(X=>({text:X.token,style:X.style}))),C=!1,R+=K.length-1}else if(J+M>m&&j){if(Qt(B)){C=!1;continue}F(),A={text:B,style:O},M=L}else if(I&&!p)!A||A.style!==O?(G(),A={text:B,style:O}):A.text+=B,M+=L;else{const K=Qt(B);if(M===0&&K&&!C)continue;!A||A.style!==O?(G(),A={text:B,style:O}):A.text+=B,M+=L}}if(G(),P.length>0){const R=P[P.length-1];R.text=Ce(R.text),R.text.length===0&&P.pop()}(P.length>0||b.length===w)&&b.push(P)}return b}function pb(r){const t=[];let e=!1;for(const i of r){const n=ou(i.text);let s=!0;for(const a of n){const o=Qt(a)||Hi(a),l=s&&e&&!o;t.push({token:a,style:i.style,continuesFromPrevious:l}),e=!o,s=!1}}return t}const nR={willReadFrequently:!0};function fb(r,t,e,i,n){let s=e[r];return typeof s!="number"&&(s=n(r,t,i)+t,e[r]=s),s}function mb(r,t,e,i,n,s,a){const o=e.getContext("2d",nR);o.font=t._fontString;let l=0,u="";const c=[],h=Object.create(null),{letterSpacing:p,whiteSpace:f}=t,m=Rs(f),g=Os(f);let _=!m;const y=t.wordWrapWidth+p,b=ou(r);for(let v=0;v<b.length;v++){let w=b[v];if(Hi(w)){if(!g){c.push(Ce(u)),_=!m,u="",l=0;continue}w=" "}if(m){const E=Qt(w),P=Qt(u[u.length-1]);if(E&&P)continue}const T=fb(w,p,h,o,i);if(T>y)if(u!==""&&(c.push(Ce(u)),u="",l=0),n(w,t.breakWords)){const E=lu(w,t.breakWords,a,s);for(const P of E){const M=fb(P,p,h,o,i);M+l>y&&(c.push(Ce(u)),_=!1,u="",l=0),u+=P,l+=M}}else u.length>0&&(c.push(Ce(u)),u="",l=0),c.push(Ce(w)),_=!1,u="",l=0;else T+l>y&&(_=!1,c.push(Ce(u)),u="",l=0),(u.length>0||!Qt(w)||_)&&(u+=w,l+=T)}const x=Ce(u);return x.length>0&&c.push(x),c.join(`
|
|
1659
|
+
`)}const gb={willReadFrequently:!0},De=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t===void 0){const e=H.get().getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,n,s,a,o,l,u,c){this.text=t,this.style=e,this.width=i,this.height=n,this.lines=s,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=l,this.fontProperties=u,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",e,i=q._canvas,n=e.wordWrap){var s,a;const o=`${t}-${e.styleKey}-wordWrap-${n}`;if(q._measurementCache.has(o))return q._measurementCache.get(o);if(Cs(e)&&Ms(t)){const v=hb(t,e,n,q._context,q._measureText,q._measureTextAdvance,q.measureFont,q.canBreakChars,q.wordWrapSplit),w=new q(t,e,v.width,v.height,v.lines,v.lineWidths,v.lineHeight,v.maxLineWidth,v.fontProperties,{runsByLine:v.runsByLine,lineAscents:v.lineAscents,lineDescents:v.lineDescents,lineHeights:v.lineHeights,hasDropShadow:v.hasDropShadow});return q._measurementCache.set(o,w),w}const l=e._fontString,u=q.measureFont(l);u.fontSize===0&&(u.fontSize=e.fontSize,u.ascent=e.fontSize,u.descent=0);const c=q._context;c.font=l;const h=(n?q._wordWrap(t,e,i):t).split(cb),p=new Array(h.length);let f=0;for(let v=0;v<h.length;v++){const w=q._measureText(h[v],e.letterSpacing,c);p[v]=w,f=Math.max(f,w)}const m=(a=(s=e._stroke)==null?void 0:s.width)!=null?a:0,g=e.lineHeight||u.fontSize,_=q._adjustWidthForStyle(f,e),y=Math.max(g,u.fontSize+m)+(h.length-1)*(g+e.leading),b=q._adjustHeightForStyle(y,e),x=new q(t,e,_,b,h,p,g+e.leading,f,u);return q._measurementCache.set(o,x),x}static _adjustWidthForStyle(t,e){var i;const n=((i=e._stroke)==null?void 0:i.width)||0;let s=t+n;return e.dropShadow&&(s+=e.dropShadow.distance),s}static _adjustHeightForStyle(t,e){let i=t;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _measureText(t,e,i){var n,s;const{metricWidth:a,metrics:o,letterSpacingVal:l}=q._measureTextCore(t,e,i),u=-((n=o.actualBoundingBoxLeft)!=null?n:0);let c=((s=o.actualBoundingBoxRight)!=null?s:0)-u;return o.width>0&&(c+=l),Math.max(a,c)}static _measureTextAdvance(t,e,i){return q._measureTextCore(t,e,i).metricWidth}static _measureTextCore(t,e,i){let n=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,n=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));const s=i.measureText(t);let a=s.width,o=0;return a>0&&(n?o=-e:o=(q.graphemeSegmenter(t).length-1)*e,a+=o),{metricWidth:a,metrics:s,letterSpacingVal:o}}static _wordWrap(t,e,i=q._canvas){return mb(t,e,i,q._measureTextAdvance,q.canBreakWords,q.canBreakChars,q.wordWrapSplit)}static isBreakingSpace(t,e){return Qt(t,e)}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,n,s){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){var e,i;if(q._fonts[t])return q._fonts[t];const n=q._context;n.font=t;const s=n.measureText(q.METRICS_STRING+q.BASELINE_SYMBOL),a=(e=s.actualBoundingBoxAscent)!=null?e:0,o=(i=s.actualBoundingBoxDescent)!=null?i:0,l={ascent:a,descent:o,fontSize:a+o};return q._fonts[t]=l,l}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){if(!q.__canvas){let t;try{const e=new OffscreenCanvas(0,0),i=e.getContext("2d",gb);if(i!=null&&i.measureText)return q.__canvas=e,e;t=H.get().createCanvas()}catch(e){t=H.get().createCanvas()}t.width=t.height=10,q.__canvas=t}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",gb)),q.__context}};De.METRICS_STRING="|\xC9q\xC5",De.BASELINE_SYMBOL="M",De.BASELINE_MULTIPLIER=1.4,De.HEIGHT_MULTIPLIER=2,De.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>{const e=r.segment(t),i=[];let n=0;for(const s of e)i[n++]=s.segment;return i}}return r=>[...r]})(),De.experimentalLetterSpacing=!1,De._fonts={},De._measurementCache=tb(1e3);let St=De;const sR=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Zr(r){const t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize;let e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let n=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!sR.includes(n)&&(n=`"${n}"`),e[i]=n}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}const _b=1e5;function pr(r,t,e,i=0,n=0,s=0){var a;if(r.texture===D.WHITE&&!r.fill)return tt.shared.setValue(r.color).setAlpha((a=r.alpha)!=null?a:1).toHexa();if(r.fill){if(r.fill instanceof Xr){const o=r.fill,l=t.createPattern(o.texture.source.resource,"repeat");return Q.applyPatternTransform(l,o.transform,!1),l}else if(r.fill instanceof $t){const o=r.fill,l=o.type==="linear",u=o.textureSpace==="local";let c=1,h=1;u&&e&&(c=e.width+i,h=e.height+i);let p,f=!1;if(l){const{start:m,end:g}=o;p=t.createLinearGradient(m.x*c+n,m.y*h+s,g.x*c+n,g.y*h+s),f=Math.abs(g.x-m.x)<Math.abs((g.y-m.y)*.1)}else{const{center:m,innerRadius:g,outerCenter:_,outerRadius:y}=o;p=t.createRadialGradient(m.x*c+n,m.y*h+s,g*c,_.x*c+n,_.y*h+s,y*c)}if(f&&u&&e){const m=e.lineHeight/h;for(let g=0;g<e.lines.length;g++){const _=(g*e.lineHeight+i/2)/h;o.colorStops.forEach(y=>{let b=_+y.offset*m;b=Math.max(0,Math.min(1,b)),p.addColorStop(Math.floor(b*_b)/_b,tt.shared.setValue(y.color).toHex())})}}else o.colorStops.forEach(m=>{p.addColorStop(m.offset,tt.shared.setValue(m.color).toHex())});return p}}else{const o=t.createPattern(r.texture.source.resource,"repeat"),l=r.matrix.copyTo(U.shared);return l.scale(r.texture.source.pixelWidth,r.texture.source.pixelHeight),o.setTransform(l),o}return"red"}const yb=new ut;function Qr(r){let t=0;for(let e=0;e<r.length;e++)r.charCodeAt(e)===32&&t++;return t}let aR=class{getCanvasAndContext(t){const{text:e,style:i,resolution:n=1}=t,s=i._getFinalPadding(),a=St.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,a.width)+s*2)*n),l=Math.ceil(Math.ceil(Math.max(1,a.height)+s*2)*n),u=me.getOptimalCanvasAndContext(o,l);this._renderTextToCanvas(i,s,n,u,a);const c=i.trim?Jy({canvas:u.canvas,width:o,height:l,resolution:1,output:yb}):yb.set(0,0,o,l);return{canvasAndContext:u,frame:c}}returnCanvasAndContext(t){me.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,i,n,s){var a,o,l,u,c,h;if(s.runsByLine&&s.runsByLine.length>0){this._renderTaggedTextToCanvas(s,t,e,i,n);return}const{canvas:p,context:f}=n,m=Zr(t),g=s.lines,_=s.lineHeight,y=s.lineWidths,b=s.maxLineWidth,x=s.fontProperties,v=p.height;if(f.resetTransform(),f.scale(i,i),f.textBaseline=t.textBaseline,(a=t._stroke)!=null&&a.width){const C=t._stroke;f.lineWidth=C.width,f.miterLimit=C.miterLimit,f.lineJoin=C.join,f.lineCap=C.cap}f.font=m;let w,T;const E=t.dropShadow?2:1,P=((l=(o=t._stroke)==null?void 0:o.width)!=null?l:0)/2;let M=(_-x.fontSize)/2;_-x.fontSize<0&&(M=0);for(let C=0;C<E;++C){const A=t.dropShadow&&C===0,G=A?Math.ceil(Math.max(1,v)+e*2):0,F=G*i;if(A)this._setupDropShadow(f,t,i,F);else{const R=t._gradientBounds,B=t._gradientOffset;if(R){const O={width:R.width,height:R.height,lineHeight:R.height,lines:s.lines};this._setFillAndStrokeStyles(f,t,O,e,P,(u=B==null?void 0:B.x)!=null?u:0,(c=B==null?void 0:B.y)!=null?c:0)}else B?this._setFillAndStrokeStyles(f,t,s,e,P,B.x,B.y):this._setFillAndStrokeStyles(f,t,s,e,P);f.shadowColor="rgba(0,0,0,0)"}for(let R=0;R<g.length;R++){w=P,T=P+R*_+x.ascent+M,w+=this._getAlignmentOffset(y[R],b,t.align);let B=0;if(t.align==="justify"&&t.wordWrap&&R<g.length-1){const O=Qr(g[R]);O>0&&(B=(b-y[R])/O)}(h=t._stroke)!=null&&h.width&&this._drawLetterSpacing(g[R],t,n,w+e,T+e-G,!0,B),t._fill!==void 0&&this._drawLetterSpacing(g[R],t,n,w+e,T+e-G,!1,B)}}}_renderTaggedTextToCanvas(t,e,i,n,s){var a,o,l,u,c;const{canvas:h,context:p}=s,{runsByLine:f,lineWidths:m,maxLineWidth:g,lineAscents:_,lineHeights:y,hasDropShadow:b}=t,x=h.height;p.resetTransform(),p.scale(n,n),p.textBaseline=e.textBaseline;const v=b?2:1;let w=(o=(a=e._stroke)==null?void 0:a.width)!=null?o:0;for(const P of f)for(const M of P){const C=(u=(l=M.style._stroke)==null?void 0:l.width)!=null?u:0;C>w&&(w=C)}const T=w/2,E=[];for(let P=0;P<f.length;P++){const M=f[P],C=[];for(const A of M){const G=Zr(A.style);p.font=G,C.push({width:St._measureText(A.text,A.style.letterSpacing,p),font:G})}E.push(C)}for(let P=0;P<v;++P){const M=b&&P===0,C=M?Math.ceil(Math.max(1,x)+i*2):0,A=C*n;M||(p.shadowColor="rgba(0,0,0,0)");let G=T;for(let F=0;F<f.length;F++){const R=f[F],B=m[F],O=_[F],I=y[F],L=E[F];let j=T;j+=this._getAlignmentOffset(B,g,e.align);let J=0;if(e.align==="justify"&&e.wordWrap&&F<f.length-1){let k=0;for(const $ of R)k+=Qr($.text);k>0&&(J=(g-B)/k)}const K=G+O;let X=j+i;for(let k=0;k<R.length;k++){const $=R[k],{width:z,font:rt}=L[k];if(p.font=rt,p.textBaseline=$.style.textBaseline,(c=$.style._stroke)!=null&&c.width){const et=$.style._stroke;if(p.lineWidth=et.width,p.miterLimit=et.miterLimit,p.lineJoin=et.join,p.lineCap=et.cap,M)if($.style.dropShadow)this._setupDropShadow(p,$.style,n,A);else{const st=Qr($.text);X+=z+st*J;continue}else{const st=St.measureFont(rt),nt=$.style.lineHeight||st.fontSize,ot={width:z,height:nt,lineHeight:nt,lines:[$.text]};p.strokeStyle=pr(et,p,ot,i*2,X-i,G)}this._drawLetterSpacing($.text,$.style,s,X,K+i-C,!0,J)}const _t=Qr($.text);X+=z+_t*J}X=j+i;for(let k=0;k<R.length;k++){const $=R[k],{width:z,font:rt}=L[k];if(p.font=rt,p.textBaseline=$.style.textBaseline,$.style._fill!==void 0){if(M)if($.style.dropShadow)this._setupDropShadow(p,$.style,n,A);else{const et=Qr($.text);X+=z+et*J;continue}else{const et=St.measureFont(rt),st=$.style.lineHeight||et.fontSize,nt={width:z,height:st,lineHeight:st,lines:[$.text]};p.fillStyle=pr($.style._fill,p,nt,i*2,X-i,G)}this._drawLetterSpacing($.text,$.style,s,X,K+i-C,!1,J)}const _t=Qr($.text);X+=z+_t*J}G+=I}}}_setFillAndStrokeStyles(t,e,i,n,s,a=0,o=0){var l;if(t.fillStyle=e._fill?pr(e._fill,t,i,n*2,a,o):null,(l=e._stroke)!=null&&l.width){const u=s+n*2;t.strokeStyle=pr(e._stroke,t,i,u,a,o)}}_setupDropShadow(t,e,i,n){t.fillStyle="black",t.strokeStyle="black";const s=e.dropShadow,a=s.color,o=s.alpha;t.shadowColor=tt.shared.setValue(a).setAlpha(o).toRgbaString();const l=s.blur*i,u=s.distance*i;t.shadowBlur=l,t.shadowOffsetX=Math.cos(s.angle)*u,t.shadowOffsetY=Math.sin(s.angle)*u+n}_getAlignmentOffset(t,e,i){return i==="right"?e-t:i==="center"?(e-t)/2:0}_drawLetterSpacing(t,e,i,n,s,a=!1,o=0){const{context:l}=i,u=e.letterSpacing;let c=!1;if(St.experimentalLetterSpacingSupported&&(St.experimentalLetterSpacing?(l.letterSpacing=`${u}px`,l.textLetterSpacing=`${u}px`,c=!0):(l.letterSpacing="0px",l.textLetterSpacing="0px")),(u===0||c)&&o===0){a?l.strokeText(t,n,s):l.fillText(t,n,s);return}if(o!==0&&(u===0||c)){const g=t.split(" ");let _=n;const y=l.measureText(" ").width;for(let b=0;b<g.length;b++)a?l.strokeText(g[b],_,s):l.fillText(g[b],_,s),_+=l.measureText(g[b]).width+y+o;return}let h=n;const p=St.graphemeSegmenter(t);let f=l.measureText(t).width,m=0;for(let g=0;g<p.length;++g){const _=p[g];a?l.strokeText(_,h,s):l.fillText(_,h,s);let y="";for(let b=g+1;b<p.length;++b)y+=p[b];m=l.measureText(y).width,h+=f-m+u,_===" "&&(h+=o),f=m}}};const ye=new aR;var oR=Object.defineProperty,lR=Object.defineProperties,uR=Object.getOwnPropertyDescriptors,bb=Object.getOwnPropertySymbols,cR=Object.prototype.hasOwnProperty,hR=Object.prototype.propertyIsEnumerable,vb=(r,t,e)=>t in r?oR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lt=(r,t)=>{for(var e in t||(t={}))cR.call(t,e)&&vb(r,e,t[e]);if(bb)for(var e of bb(t))hR.call(t,e)&&vb(r,e,t[e]);return r},dR=(r,t)=>lR(r,uR(t));const uu=class yr extends Nt{constructor(t={}){var e;super(),this.uid=ht("textStyle"),this._tick=0,this._cachedFontString=null,pR(t),t instanceof yr&&(t=t._toObject());const i=Lt(Lt({},yr.defaultTextStyle),t);for(const n in i){const s=n;this[s]=i[n]}this._tagStyles=(e=t.tagStyles)!=null?e:void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(t!==null&&typeof t=="object"?this._dropShadow=this._createProxy(Lt(Lt({},yr.defaultDropShadow),t)):this._dropShadow=t?this._createProxy(Lt({},yr.defaultDropShadow)):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.update())}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy(Lt(Lt({},kt.defaultFillStyle),t),()=>{this._fill=Xe(Lt({},this._originalFill),kt.defaultFillStyle)})),this._fill=Xe(t===0?"black":t,kt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy(Lt(Lt({},kt.defaultStrokeStyle),t),()=>{this._stroke=Bi(Lt({},this._originalStroke),kt.defaultStrokeStyle)})),this._stroke=Bi(t,kt.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t!=null?t:void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const t=yr.defaultTextStyle;for(const e in t)this[e]=t[e]}assign(t){for(const e in t){const i=e;this[i]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=Zr(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?Lt({},this._dropShadow):null,fill:this._fill?Lt({},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?Lt({},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?Lt({},this._tagStyles):void 0}}clone(){return new yr(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){var e,i,n,s;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const a=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(e=this._fill)!=null&&e.texture&&this._fill.texture.destroy(a),(i=this._originalFill)!=null&&i.texture&&this._originalFill.texture.destroy(a),(n=this._stroke)!=null&&n.texture&&this._stroke.texture.destroy(a),(s=this._originalStroke)!=null&&s.texture&&this._originalStroke.texture.destroy(a)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,n,s)=>(i[n]===s||(i[n]=s,e==null||e(n,s),this.update()),!0)})}_isFillStyle(t){return(t!=null?t:null)!==null&&!(tt.isColorLike(t)||t instanceof $t||t instanceof Xr)}};uu.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},uu.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 jt=uu;function pR(r){var t,e,i,n,s;const a=r;if(typeof a.dropShadow=="boolean"&&a.dropShadow){const o=jt.defaultDropShadow;r.dropShadow={alpha:(t=a.dropShadowAlpha)!=null?t:o.alpha,angle:(e=a.dropShadowAngle)!=null?e:o.angle,blur:(i=a.dropShadowBlur)!=null?i:o.blur,color:(n=a.dropShadowColor)!=null?n:o.color,distance:(s=a.dropShadowDistance)!=null?s:o.distance}}if(a.strokeThickness!==void 0){const o=a.stroke;let l={};if(tt.isColorLike(o))l.color=o;else if(o instanceof $t||o instanceof Xr)l.fill=o;else if(Object.hasOwnProperty.call(o,"color")||Object.hasOwnProperty.call(o,"fill"))l=o;else throw new Error("Invalid stroke value.");r.stroke=dR(Lt({},l),{width:a.strokeThickness})}if(Array.isArray(a.fillGradientStops)){if(!Array.isArray(a.fill)||a.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");a.fill.length,a.fillGradientStops.length;const o=new $t({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),l=a.fillGradientStops.slice(),u=a.fill.map(c=>tt.shared.setValue(c).toNumber());l.forEach((c,h)=>{o.addColorStop(c,u[h])}),r.fill={fill:o}}}function Gs(r,t){const{texture:e,bounds:i}=r,n=t._style._getFinalPadding();Za(i,t._anchor,e);const s=t._anchor._x*n*2,a=t._anchor._y*n*2;i.minX-=n-s,i.minY-=n-a,i.maxX-=n-s,i.maxY-=n-a}class zi{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 xb extends zi{}class cu{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Ut({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e!=null&&e._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),i=t.styleKey;return e.currentKey!==i?!0:t._didTextUpdate}addRenderable(t,e){const i=this._getGpuText(t);if(t._didTextUpdate){const n=t._autoResolution?this._renderer.resolution:t.resolution;(i.currentKey!==t.styleKey||t._resolution!==n)&&this._updateGpuText(t),t._didTextUpdate=!1,Gs(i,t)}this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new xb;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:i}=this._renderer;i.getReferenceCount(e.currentKey)>0?i.decreaseReferenceCount(e.currentKey):e.texture&&i.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}cu.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"text"};class hu{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,i,n){var s;typeof t=="string"&&(t={text:t,style:i,resolution:e}),t.style instanceof jt||(t.style=new jt(t.style)),t.textureStyle instanceof Jt||(t.textureStyle=new Jt(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());const{text:a,style:o,textureStyle:l,autoGenerateMipmaps:u}=t,c=(s=t.resolution)!=null?s:this._renderer.resolution,{frame:h,canvasAndContext:p}=ye.getCanvasAndContext({text:a,style:o,resolution:c}),f=Rn(p.canvas,h.width,h.height,c,u);if(l&&(f.source.style=l),o.trim&&(h.pad(o.padding),f.frame.copyFrom(h),f.frame.scale(1/c),f.updateUvs()),o.filters){const m=this._applyFilters(f,o.filters);return this.returnTexture(f),ye.returnCanvasAndContext(p),m}return this._renderer.texture.initSource(f._source),this._retainCanvasContext||ye.returnCanvasAndContext(p),f}returnTexture(t){const e=t.source,i=e.resource;if(this._retainCanvasContext&&i!=null&&i.getContext){const n=i.getContext("2d");n&&ye.returnCanvasAndContext({canvas:i,context:n})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",vt.returnTexture(t,!0)}renderTextToCanvas(){}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const i=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:i,usageCount:1},i}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){var e,i;return(i=(e=this._activeTextures[t])==null?void 0:e.usageCount)!=null?i:0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const i=this._renderer.renderTarget.renderTarget,n=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(i,!1),n}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class du extends hu{constructor(t){super(t,!0)}}du.extension={type:[S.CanvasSystem],name:"canvasText"};class pu extends hu{constructor(t){super(t,!1)}}pu.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"canvasText"},N.add(du),N.add(pu),N.add(cu);class Wi extends Ps{constructor(...t){var e;const i=As(t,"Text");super(i,jt),this.renderPipeId="text",i.textureStyle&&(this.textureStyle=i.textureStyle instanceof Jt?i.textureStyle:new Jt(i.textureStyle)),this.autoGenerateMipmaps=(e=i.autoGenerateMipmaps)!=null?e:ft.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let i=0,n=0;if(this._style.trim){const{frame:s,canvasAndContext:a}=ye.getCanvasAndContext({text:this.text,style:this._style,resolution:1});ye.returnCanvasAndContext(a),i=s.width,n=s.height}else{const s=St.measureText(this._text,this._style);i=s.width,n=s.height}t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}}class Tb extends py{resolveQueueItem(t,e){return t instanceof dt?this.resolveContainerQueueItem(t,e):t instanceof ft||t instanceof D?e.push(t.source):t instanceof kt&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof pe||t instanceof Vy||t instanceof Kr?e.push(t.texture.source):t instanceof Wi?e.push(t):t instanceof hr?e.push(t.context):t instanceof Xi&&t.textures.forEach(i=>{i.source?e.push(i.source):e.push(i.texture.source)})}resolveGraphicsContextQueueItem(t){this.renderer.graphicsContext.getGpuContext(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:n}=i.data;return n.source}else if(i.action==="fill"){const{texture:n}=i.data.style;return n.source}return null}}class fu extends Nt{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 this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}var fR=Object.defineProperty,Sb=Object.getOwnPropertySymbols,mR=Object.prototype.hasOwnProperty,gR=Object.prototype.propertyIsEnumerable,wb=(r,t,e)=>t in r?fR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Eb=(r,t)=>{for(var e in t||(t={}))mR.call(t,e)&&wb(r,e,t[e]);if(Sb)for(var e of Sb(t))gR.call(t,e)&&wb(r,e,t[e]);return r};const Pb=class X1 extends fu{constructor(t){var e,i,n;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 s=Eb(Eb({},X1.defaultOptions),t);this._textureSize=s.textureSize,this._mipmap=s.mipmap;const a=s.style.clone();s.overrideFill&&(a._fill.color=16777215,a._fill.alpha=1,a._fill.texture=D.WHITE,a._fill.fill=null),this.applyFillAsTint=s.overrideFill;const o=a.fontSize;a.fontSize=this.baseMeasurementFontSize;const l=Zr(a);s.overrideSize?(a._stroke&&(a._stroke.width*=this.baseRenderedFontSize/o),a.dropShadow&&(a.dropShadow.blur*=this.baseRenderedFontSize/o,a.dropShadow.distance*=this.baseRenderedFontSize/o)):a.fontSize=this.baseRenderedFontSize=o,this._style=a,this._skipKerning=(e=s.skipKerning)!=null?e:!1,this.resolution=(i=s.resolution)!=null?i:1,this._padding=(n=s.padding)!=null?n:4,s.textureStyle&&(this._textureStyle=s.textureStyle instanceof Jt?s.textureStyle:new Jt(s.textureStyle)),this.fontMetrics=St.measureFont(l),this.lineHeight=a.lineHeight||this.fontMetrics.fontSize||a.fontSize}ensureCharacters(t){var e,i,n,s;const a=St.graphemeSegmenter(t).filter(w=>!this._currentChars.includes(w)).filter((w,T,E)=>E.indexOf(w)===T);if(!a.length)return;this._currentChars=[...this._currentChars,...a];let o;this._currentPageIndex===-1?o=this._nextPage():o=this.pages[this._currentPageIndex];let{canvas:l,context:u}=o.canvasAndContext,c=o.texture.source;const h=this._style;let p=this._currentX,f=this._currentY,m=this._currentMaxCharHeight;const g=this.baseRenderedFontSize/this.baseMeasurementFontSize,_=((i=(e=h.dropShadow)==null?void 0:e.distance)!=null?i:0)+((s=(n=h._stroke)==null?void 0:n.width)!=null?s:0),y=this._padding+_;let b=!1;const x=l.width/this.resolution,v=l.height/this.resolution;for(let w=0;w<a.length;w++){const T=a[w],E=St.measureText(T,h,l,!1);E.lineHeight=E.height;const P=E.width*g,M=Math.ceil((h.fontStyle==="italic"?2:1)*P),C=E.height*g,A=M+y*2,G=C+y*2;if(b=!1,T!==`
|
|
1660
|
+
`&&T!=="\r"&&T!==" "&&T!==" "&&(b=!0,m=Math.ceil(Math.max(G,m))),p+A>x&&(f+=m,m=G,p=0,f+m>v)){c.update();const R=this._nextPage();l=R.canvasAndContext.canvas,u=R.canvasAndContext.context,c=R.texture.source,p=0,f=0,m=0}const F=u.measureText(T).width/g;if(this.chars[T]={id:T.codePointAt(0),xOffset:-(y/g),yOffset:-(y/g),xAdvance:F,kerning:{}},b){this._drawGlyph(u,E,p+y,f+y,g,h);const R=c.width*g,B=c.height*g,O=new ut(p/R*c.width,f/B*c.height,A/R*c.width,G/B*c.height);this.chars[T].texture=new D({source:c,frame:O}),p+=Math.ceil(A)}}c.update(),this._currentX=p,this._currentY=f,this._currentMaxCharHeight=m,this._skipKerning||this._applyKerning(a,u,g)}get pageTextures(){return this.pages}_applyKerning(t,e,i){const n=this._measureCache;for(let s=0;s<t.length;s++){const a=t[s];for(let o=0;o<this._currentChars.length;o++){const l=this._currentChars[o];let u=n[a];u||(u=n[a]=e.measureText(a).width);let c=n[l];c||(c=n[l]=e.measureText(l).width);let h=e.measureText(a+l).width,p=h-(u+c);p&&this.chars[a]&&(this.chars[a].kerning[l]=p/i),h=e.measureText(a+l).width,p=h-(u+c),p&&this.chars[l]&&(this.chars[l].kerning[a]=p/i)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=me.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),n=new D({source:new ke({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(n.source.style=this._textureStyle);const s={canvasAndContext:e,texture:n};return this.pages[this._currentPageIndex]=s,s}_setupContext(t,e,i){var n;e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=Zr(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const s=e._stroke,a=(n=s==null?void 0:s.width)!=null?n:0;if(s&&(t.lineWidth=a,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=pr(s,t)),e._fill&&(t.fillStyle=pr(e._fill,t)),e.dropShadow){const o=e.dropShadow,l=tt.shared.setValue(o.color).toArray(),u=o.blur*i,c=o.distance*i;t.shadowColor=`rgba(${l[0]*255},${l[1]*255},${l[2]*255},${o.alpha})`,t.shadowBlur=u,t.shadowOffsetX=Math.cos(o.angle)*c,t.shadowOffsetY=Math.sin(o.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,n,s,a){var o;const l=e.text,u=e.fontProperties,c=a._stroke,h=((o=c==null?void 0:c.width)!=null?o:0)*s,p=i+h/2,f=n-h/2,m=u.descent*s,g=e.lineHeight*s;let _=!1;a.stroke&&h&&(_=!0,t.strokeText(l,p,f+g-m));const{shadowBlur:y,shadowOffsetX:b,shadowOffsetY:x}=t;a._fill&&(_&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillText(l,p,f+g-m)),_&&(t.shadowBlur=y,t.shadowOffsetX=b,t.shadowOffsetY=x)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:i}=this.pages[t];me.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};Pb.defaultOptions={textureSize:512,style:new jt,mipmap:!0};let mu=Pb;function Is(r,t,e,i){var n,s;const a={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};a.offsetY=e.baseLineOffset;let o=a.lines[0],l=null,u=!0;const c={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},h=e.baseMeasurementFontSize/t.fontSize,p=t.letterSpacing*h,f=t.wordWrapWidth*h,m=t.lineHeight?t.lineHeight*h:e.lineHeight,g=t.wordWrap&&t.breakWords,_=Rs(t.whiteSpace),y=Os(t.whiteSpace);if(_||y){const w=[];let T=_;for(let E=0;E<r.length;E++){let P=r[E];if(P==="\r"||P===`
|
|
1661
|
+
`)if(y)P==="\r"&&r[E+1]===`
|
|
1662
|
+
`&&E++,P=" ";else{_&&(T=!0),w.push(P);continue}if(Qt(P))if(_&&su(P)){if(T)continue;T=!0,w.push(" ")}else T=!1,w.push(P);else T=!1,w.push(P)}r=w}const b=w=>{const T=o.width;for(let E=0;E<c.index;E++){const P=w.positions[E];o.chars.push(w.chars[E]),o.charPositions.push(P+T)}o.width+=w.width,(c.index>0||!_)&&(u=!1),c.width=0,c.index=0,c.chars.length=0},x=()=>{let w=o.chars.length-1;if(i){let T=o.chars[w];for(;su(T);)o.width-=e.chars[T].xAdvance,o.spacesIndex.pop(),T=o.chars[--w]}a.width=Math.max(a.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},u=!0,a.lines.push(o),a.height+=m},v=w=>w-p>f;for(let w=0;w<r.length+1;w++){let T;const E=w===r.length;E||(T=r[w]);const P=e.chars[T];if(/(?:\s)/.test(T)||T==="\r"||T===`
|
|
1663
|
+
`||E){if(!u&&t.wordWrap&&v(o.width+c.width)?(x(),b(c),!E&&P&&o.charPositions.push(0)):(c.start=o.width,b(c),!E&&P&&o.charPositions.push(0)),T==="\r"||T===`
|
|
1664
|
+
`)x();else if(!E&&P){const M=P.xAdvance+(((n=P.kerning)==null?void 0:n[l])||0)+p;o.width+=M,o.spaceWidth=M,o.spacesIndex.push(o.charPositions.length),o.chars.push(T)}}else if(P){const M=((s=P.kerning)==null?void 0:s[l])||0,C=P.xAdvance+M+p;g&&v(c.width+C)&&(u||x(),b(c),x()),c.positions[c.index++]=c.width+M,c.chars.push(T),c.width+=C,au(T)&&(!u&&t.wordWrap&&v(o.width+c.width)&&x(),b(c))}l=T}return x(),t.align==="center"?_R(a):t.align==="right"?yR(a):t.align==="justify"&&bR(a),a}function _R(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width/2-e.width/2;for(let n=0;n<e.charPositions.length;n++)e.charPositions[n]+=i}}function yR(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width-e.width;for(let n=0;n<e.charPositions.length;n++)e.charPositions[n]+=i}}function bR(r){const t=r.width;for(let e=0;e<r.lines.length-2;e++){const i=r.lines[e];let n=0,s=i.spacesIndex[n++],a=0;const o=i.spacesIndex.length,l=(t-i.width)/o;for(let u=0;u<i.charPositions.length;u++)u===s&&(s=i.spacesIndex[n++],a+=l),i.charPositions[u]+=a}}function Ab(r){if(r==="")return[];typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const n=r[e];if(Array.isArray(n)){if(n.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);if(n[0].length===0||n[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");const s=n[0].charCodeAt(0),a=n[1].charCodeAt(0);if(a<s)throw new Error("[BitmapFont]: Invalid character range.");for(let o=s,l=a;o<=l;o++)t.push(String.fromCharCode(o))}else t.push(...Array.from(n))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var vR=Object.defineProperty,Cb=Object.getOwnPropertySymbols,xR=Object.prototype.hasOwnProperty,TR=Object.prototype.propertyIsEnumerable,Mb=(r,t,e)=>t in r?vR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gu=(r,t)=>{for(var e in t||(t={}))xR.call(t,e)&&Mb(r,e,t[e]);if(Cb)for(var e of Cb(t))TR.call(t,e)&&Mb(r,e,t[e]);return r};let Bs=0,SR=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=tb(1e3)}getFont(t,e){var i,n;let s=`${e.fontFamily}-bitmap`,a=!0;if(it.has(s)){const l=it.get(s);return(i=l.ensureCharacters)==null||i.call(l,t),l}if(e._fill.fill&&!e._stroke?(s+=e._fill.fill.styleKey,a=!1):(e._stroke||e.dropShadow)&&(s=`${e.styleKey}-bitmap`,a=!1),s+=`-${e.fontStyle}`,s+=`-${e.fontVariant}`,s+=`-${e.fontWeight}`,!it.has(s)){const l=Object.create(e);l._lineHeight=0;const u=new mu(gu({style:l,overrideFill:a,overrideSize:!0},this.defaultOptions));Bs++,Bs>50&&ue("BitmapText",`You have dynamically created ${Bs} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),u.once("destroy",()=>{Bs--,it.remove(s)}),it.set(s,u)}const o=it.get(s);return(n=o.ensureCharacters)==null||n.call(o,t),o}getLayout(t,e,i=!0){const n=this.getFont(t,e),s=`${t}-${e.styleKey}-${i}`;if(this.measureCache.has(s))return this.measureCache.get(s);const a=St.graphemeSegmenter(t),o=Is(a,e,n,i);return this.measureCache.set(s,o),o}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var e,i,n,s,a;let o=t[0];typeof o=="string"&&(o={name:o,style:t[1],chars:(e=t[2])==null?void 0:e.chars,resolution:(i=t[2])==null?void 0:i.resolution,padding:(n=t[2])==null?void 0:n.padding,skipKerning:(s=t[2])==null?void 0:s.skipKerning});const l=o==null?void 0:o.name;if(!l)throw new Error("[BitmapFontManager] Property `name` is required.");o=gu(gu({},this.defaultOptions),o);const u=o.style,c=u instanceof jt?u:new jt(u),h=(a=o.dynamicFill)!=null?a:this._canUseTintForStyle(c),p=new mu({style:c,overrideFill:h,skipKerning:o.skipKerning,padding:o.padding,resolution:o.resolution,overrideSize:!1,textureStyle:o.textureStyle}),f=Ab(o.chars);return p.ensureCharacters(f.join("")),it.set(`${l}-bitmap`,p),p.once("destroy",()=>it.remove(`${l}-bitmap`)),p}uninstall(t){const e=`${t}-bitmap`,i=it.get(e);i&&i.destroy()}_canUseTintForStyle(t){return!t._stroke&&(!t.dropShadow||t.dropShadow.color===0)&&!t._fill.fill&&t._fill.color===16777215}};const Jr=new SR;class Rb extends hr{destroy(){this.context.customShader&&this.context.customShader.destroy(),super.destroy()}}class _u{constructor(t){this._renderer=t,this._managedBitmapTexts=new Ut({renderer:t,type:"renderable",priority:-2,name:"bitmapText"})}validateRenderable(t){const e=this._getGpuBitmapText(t);return this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){const i=this._getGpuBitmapText(t);Ob(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}updateRenderable(t){const e=this._getGpuBitmapText(t);Ob(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){const{context:i}=e,n=Jr.getFont(t.text,t._style);if(i.clear(),n.distanceField.type!=="none"){const y=this.getSdfShader();y&&(i.customShader||(i.customShader=y))}const s=St.graphemeSegmenter(t.text),a=t._style;let o=n.baseLineOffset;const l=Is(s,a,n,!0),u=a.padding,c=l.scale;let h=l.width,p=l.height+l.offsetY;a._stroke&&(h+=a._stroke.width/c,p+=a._stroke.width/c),i.translate(-t._anchor._x*h-u,-t._anchor._y*p-u).scale(c,c);const f=n.applyFillAsTint?a._fill.color:16777215;let m=n.fontMetrics.fontSize,g=n.lineHeight;a.lineHeight&&(m=a.fontSize/c,g=a.lineHeight/c);let _=(g-m)/2;_-n.baseLineOffset<0&&(_=0);for(let y=0;y<l.lines.length;y++){const b=l.lines[y];for(let x=0;x<b.charPositions.length;x++){const v=b.chars[x],w=n.chars[v];if(w!=null&&w.texture){const T=w.texture;i.texture(T,f,Math.round(b.charPositions[x]+w.xOffset),Math.round(o+w.yOffset+_),T.orig.width,T.orig.height)}}o+=g}}_getGpuBitmapText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new Rb;return t._gpuData[this._renderer.uid]=e,this._updateContext(t,e),this._managedBitmapTexts.add(t),e}_updateDistanceField(t){const e=this._getGpuBitmapText(t).context,i=t._style.fontFamily,n=it.get(`${i}-bitmap`),{a:s,b:a,c:o,d:l}=t.groupTransform,u=Math.sqrt(s*s+a*a),c=Math.sqrt(o*o+l*l),h=(Math.abs(u)+Math.abs(c))/2,p=n.baseRenderedFontSize/t._style.fontSize,f=h*n.distanceField.range*(1/p);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){this._managedBitmapTexts.destroy(),this._renderer=null,this._managedBitmapTexts=null}}function Ob(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}class yu extends _u{getSdfShader(){return null}}yu.extension={type:[S.CanvasPipes],name:"bitmapText"};const Gb={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
1665
|
+
struct LocalUniforms {
|
|
1666
|
+
uColor:vec4<f32>,
|
|
1667
|
+
uTransformMatrix:mat3x3<f32>,
|
|
1668
|
+
uDistance: f32,
|
|
1669
|
+
uRound:f32,
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
1673
|
+
`,main:`
|
|
1674
|
+
vColor *= localUniforms.uColor;
|
|
1675
|
+
modelMatrix *= localUniforms.uTransformMatrix;
|
|
1676
|
+
`,end:`
|
|
1677
|
+
if(localUniforms.uRound == 1)
|
|
1678
|
+
{
|
|
1679
|
+
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
1680
|
+
}
|
|
1681
|
+
`},fragment:{header:`
|
|
1682
|
+
struct LocalUniforms {
|
|
1683
|
+
uColor:vec4<f32>,
|
|
1684
|
+
uTransformMatrix:mat3x3<f32>,
|
|
1685
|
+
uDistance: f32
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
1689
|
+
`,main:`
|
|
1690
|
+
outColor = vec4<f32>(calculateMSDFAlpha(outColor, vColor, localUniforms.uDistance));
|
|
1691
|
+
`}},Ib={name:"local-uniform-msdf-bit",vertex:{header:`
|
|
1692
|
+
uniform mat3 uTransformMatrix;
|
|
1693
|
+
uniform vec4 uColor;
|
|
1694
|
+
uniform float uRound;
|
|
1695
|
+
`,main:`
|
|
1696
|
+
vColor *= uColor;
|
|
1697
|
+
modelMatrix *= uTransformMatrix;
|
|
1698
|
+
`,end:`
|
|
1699
|
+
if(uRound == 1.)
|
|
1700
|
+
{
|
|
1701
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
1702
|
+
}
|
|
1703
|
+
`},fragment:{header:`
|
|
1704
|
+
uniform float uDistance;
|
|
1705
|
+
`,main:`
|
|
1706
|
+
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
|
|
1707
|
+
`}},Bb={name:"msdf-bit",fragment:{header:`
|
|
1708
|
+
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
|
|
1709
|
+
|
|
1710
|
+
// MSDF
|
|
1711
|
+
var median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
1712
|
+
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
1713
|
+
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
1714
|
+
|
|
1715
|
+
// SDF
|
|
1716
|
+
median = min(median, msdfColor.a);
|
|
1717
|
+
|
|
1718
|
+
var screenPxDistance = distance * (median - 0.5);
|
|
1719
|
+
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
1720
|
+
if (median < 0.01) {
|
|
1721
|
+
alpha = 0.0;
|
|
1722
|
+
} else if (median > 0.99) {
|
|
1723
|
+
alpha = 1.0;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
// Gamma correction for coverage-like alpha
|
|
1727
|
+
var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
|
|
1728
|
+
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
|
|
1729
|
+
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
|
|
1730
|
+
|
|
1731
|
+
return coverage;
|
|
1732
|
+
|
|
1733
|
+
}
|
|
1734
|
+
`}},Fb={name:"msdf-bit",fragment:{header:`
|
|
1735
|
+
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
|
|
1736
|
+
|
|
1737
|
+
// MSDF
|
|
1738
|
+
float median = msdfColor.r + msdfColor.g + msdfColor.b -
|
|
1739
|
+
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
|
|
1740
|
+
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
|
|
1741
|
+
|
|
1742
|
+
// SDF
|
|
1743
|
+
median = min(median, msdfColor.a);
|
|
1744
|
+
|
|
1745
|
+
float screenPxDistance = distance * (median - 0.5);
|
|
1746
|
+
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
|
|
1747
|
+
|
|
1748
|
+
if (median < 0.01) {
|
|
1749
|
+
alpha = 0.0;
|
|
1750
|
+
} else if (median > 0.99) {
|
|
1751
|
+
alpha = 1.0;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
// Gamma correction for coverage-like alpha
|
|
1755
|
+
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
|
|
1756
|
+
float gamma = mix(1.0, 1.0 / 2.2, luma);
|
|
1757
|
+
float coverage = pow(shapeColor.a * alpha, gamma);
|
|
1758
|
+
|
|
1759
|
+
return coverage;
|
|
1760
|
+
}
|
|
1761
|
+
`}};let bu,vu;class Db extends ee{constructor(t){const e=new At({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}});bu!=null||(bu=Fr({name:"sdf-shader",bits:[Xn,Hn(t),Gb,Bb,Ur]})),vu!=null||(vu=Dr({name:"sdf-shader",bits:[jn,zn(t),Ib,Fb,$r]})),super({glProgram:vu,gpuProgram:bu,resources:{localUniforms:e,batchSamplers:Wn(t)}})}}class xu extends _u{getSdfShader(){return new Db(this._renderer.limits.maxBatchableTextures)}}xu.extension={type:[S.WebGLPipes,S.WebGPUPipes],name:"bitmapText"},N.add(yu),N.add(xu);class Tu extends Ps{constructor(...t){var e,i,n;const s=As(t,"BitmapText");(e=s.style)!=null||(s.style=s.style||{}),(n=(i=s.style).fill)!=null||(i.fill=16777215),super(s,jt),this.renderPipeId="bitmapText"}_onTouch(t){var e;this._gcLastUsed=t;for(const i in this._gpuData)(e=this._gpuData[i])==null||e._onTouch(t)}updateBounds(){const t=this._bounds,e=this._anchor,i=Jr.measureText(this.text,this._style),n=i.scale,s=i.offsetY*n;let a=i.width*n,o=i.height*n;const l=this._style._stroke;l&&(a+=l.width,o+=l.width),t.minX=-e._x*a,t.maxX=t.minX+a,t.minY=-e._y*(o+s),t.maxY=t.minY+o}set resolution(t){}get resolution(){return this._resolution}}var wR=Object.defineProperty,Ub=Object.getOwnPropertySymbols,ER=Object.prototype.hasOwnProperty,PR=Object.prototype.propertyIsEnumerable,$b=(r,t,e)=>t in r?wR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Su=(r,t)=>{for(var e in t||(t={}))ER.call(t,e)&&$b(r,e,t[e]);if(Ub)for(var e of Ub(t))PR.call(t,e)&&$b(r,e,t[e]);return r};function kb(r){var t;const e=r._stroke,i=r._fill,n=[`div { ${[`color: ${tt.shared.setValue(i.color).setAlpha((t=i.alpha)!=null?t:1).toHexa()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-break: ${r.breakWords?"break-word":"normal"}`,`max-width: ${r.wordWrapWidth}px`]:[],...e?[Lb(e)]:[],...r.dropShadow?[wu(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return AR(r.tagStyles,n),n.join(" ")}function wu(r){var t;const e=Su({},r),i=tt.shared.setValue(e.color).setAlpha((t=e.alpha)!=null?t:1).toHexa(),n=Math.round(Math.cos(e.angle)*e.distance),s=Math.round(Math.sin(e.angle)*e.distance),a=`${n}px ${s}px`;return e.blur>0?`text-shadow: ${a} ${e.blur}px ${i}`:`text-shadow: ${a} ${i}`}function Lb(r){var t;const e=tt.shared.setValue(r.color).setAlpha((t=r.alpha)!=null?t:1).toHexa();return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${e}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${e}`,"paint-order: stroke"].join(";")}const Nb={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"},Xb={fill:r=>`color: ${tt.shared.setValue(r).toHexa()}`,breakWords:r=>`word-break: ${r?"break-all":"normal"}`,stroke:Lb,dropShadow:r=>r===!0?wu(jt.defaultDropShadow):r&&typeof r=="object"?wu(Su(Su({},jt.defaultDropShadow),r)):""};function AR(r,t){for(const e in r){const i=r[e],n=[];for(const s in i)Xb[s]?n.push(Xb[s](i[s])):Nb[s]&&n.push(Nb[s].replace("{{VALUE}}",i[s]));t.push(`${e} { ${n.join(";")} }`)}}var CR=Object.defineProperty,jb=Object.getOwnPropertySymbols,MR=Object.prototype.hasOwnProperty,RR=Object.prototype.propertyIsEnumerable,Hb=(r,t,e)=>t in r?CR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zb=(r,t)=>{for(var e in t||(t={}))MR.call(t,e)&&Hb(r,e,t[e]);if(jb)for(var e of jb(t))RR.call(t,e)&&Hb(r,e,t[e]);return r};class Fs extends jt{constructor(t={}){var e,i;super(t),this._cssOverrides=[],this.cssOverrides=(e=t.cssOverrides)!=null?e:[],this.tagStyles=(i=t.tagStyles)!=null?i:{}}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t!=null?t:{},this.update())}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}update(){this._cssStyle=null,super.update()}clone(){return new Fs({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?zb({},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:zb({},this.tagStyles)})}get cssStyle(){return this._cssStyle||(this._cssStyle=kb(this)),this._cssStyle}addOverride(...t){const e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){const e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}const Wb="http://www.w3.org/2000/svg",Vb="http://www.w3.org/1999/xhtml";class Eu{constructor(){this.svgRoot=document.createElementNS(Wb,"svg"),this.foreignObject=document.createElementNS(Wb,"foreignObject"),this.domElement=document.createElementNS(Vb,"div"),this.styleElement=document.createElementNS(Vb,"style");const{foreignObject:t,svgRoot:e,styleElement:i,domElement:n}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(n),this.image=H.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 Yb;function Pu(r,t,e,i){i||(i=Yb||(Yb=new Eu));const{domElement:n,styleElement:s,svgRoot:a}=i;n.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,n.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(s.textContent=e),document.body.appendChild(a);let o=n.scrollWidth,l=n.scrollHeight;if(a.remove(),t.dropShadow){const{distance:c,angle:h,blur:p}=t.dropShadow,f=Math.abs(Math.round(Math.cos(h)*c)),m=Math.abs(Math.round(Math.sin(h)*c));o+=f+p,l+=m+p}const u=t.padding*2;return{width:o-u,height:l-u}}class Kb extends zi{constructor(){super(...arguments),this.generatingTexture=!1,this.currentKey="--"}destroy(){this.texturePromise=null,this.generatingTexture=!1,this.currentKey="--",super.destroy()}}class Au{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Ut({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"htmlText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e!=null&&e._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),i=t.styleKey;return e.currentKey!==i}addRenderable(t,e){const i=this._getGpuText(t);if(t._didTextUpdate){const n=t._autoResolution?this._renderer.resolution:t.resolution;(i.currentKey!==t.styleKey||t.resolution!==n)&&this._updateGpuText(t).catch(s=>{console.error(s)}),t._didTextUpdate=!1,Gs(i,t)}this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}async _updateGpuText(t){t._didTextUpdate=!1;const e=this._getGpuText(t);if(e.generatingTexture)return;const i=e.texturePromise;e.texturePromise=null,e.generatingTexture=!0,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let n=this._renderer.htmlText.getTexturePromise(t);i&&(n=n.finally(()=>{this._renderer.htmlText.decreaseReferenceCount(e.currentKey),this._renderer.htmlText.returnTexturePromise(i)})),e.texturePromise=n,e.currentKey=t.styleKey,e.texture=await n;const s=t.renderGroup||t.parentRenderGroup;s&&(s.structureDidChange=!0),e.generatingTexture=!1,Gs(e,t)}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new Kb;return e.renderable=t,e.transform=t.groupTransform,e.texture=D.EMPTY,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{htmlText:i}=this._renderer;i.getReferenceCount(e.currentKey)===null?i.returnTexturePromise(e.texturePromise):i.decreaseReferenceCount(e.currentKey)}destroy(){this._managedTexts.destroy(),this._renderer=null}}Au.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"htmlText"};function Cu(){const{userAgent:r}=H.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}function qb(r,t){const e=t.fontFamily,i=[],n={},s=/font-family:([^;"\s]+)/g,a=r.match(s);function o(l){n[l]||(i.push(l),n[l]=!0)}if(Array.isArray(e))for(let l=0;l<e.length;l++)o(e[l]);else o(e);a&&a.forEach(l=>{const u=l.split(":")[1].trim();o(u)});for(const l in t.tagStyles){const u=t.tagStyles[l].fontFamily;o(u)}return i}async function Zb(r){const t=await(await H.get().fetch(r)).blob(),e=new FileReader;return await new Promise((i,n)=>{e.onloadend=()=>i(e.result),e.onerror=n,e.readAsDataURL(t)})}async function Qb(r,t){const e=await Zb(t);return`@font-face {
|
|
1762
|
+
font-family: "${r.fontFamily}";
|
|
1763
|
+
font-weight: ${r.fontWeight};
|
|
1764
|
+
font-style: ${r.fontStyle};
|
|
1765
|
+
src: url('${e}');
|
|
1766
|
+
}`}const Ds=new Map;async function Jb(r){const t=r.filter(e=>it.has(`${e}-and-url`)).map(e=>{if(!Ds.has(e)){const{entries:i}=it.get(`${e}-and-url`),n=[];i.forEach(s=>{const a=s.url,o=s.faces.map(l=>({weight:l.weight,style:l.style}));n.push(...o.map(l=>Qb({fontWeight:l.weight,fontStyle:l.style,fontFamily:e},a)))}),Ds.set(e,Promise.all(n).then(s=>s.join(`
|
|
1767
|
+
`)))}return Ds.get(e)});return(await Promise.all(t)).join(`
|
|
1768
|
+
`)}function tv(r,t,e,i,n){const{domElement:s,styleElement:a,svgRoot:o}=n;s.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,s.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),a.textContent=i;const{width:l,height:u}=n.image;return o.setAttribute("width",l.toString()),o.setAttribute("height",u.toString()),new XMLSerializer().serializeToString(o)}function ev(r,t){const e=me.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),e}function rv(r,t,e){return new Promise(async i=>{e&&await new Promise(n=>setTimeout(n,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}class Mu{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===It.WEBGPU}getTexture(t){return this.getTexturePromise(t)}getManagedTexture(t){const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].promise;const i=this._buildTexturePromise(t).then(n=>(this._activeTextures[e].texture=n,n));return this._activeTextures[e]={texture:null,promise:i,usageCount:1},i}getReferenceCount(t){var e,i;return(i=(e=this._activeTextures[t])==null?void 0:e.usageCount)!=null?i:null}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e.texture):e.promise.then(i=>{e.texture=i,this._cleanUp(e.texture)}).catch(()=>{}),this._activeTextures[t]=null))}getTexturePromise(t){return this._buildTexturePromise(t)}async _buildTexturePromise(t){const{text:e,style:i,resolution:n,textureStyle:s,autoGenerateMipmaps:a}=t,o=Pt.get(Eu),l=qb(e,i),u=await Jb(l),c=Pu(e,i,u,o),h=Math.ceil(Math.ceil(Math.max(1,c.width)+i.padding*2)*n),p=Math.ceil(Math.ceil(Math.max(1,c.height)+i.padding*2)*n),f=o.image,m=2;f.width=(h|0)+m,f.height=(p|0)+m;const g=tv(e,i,n,u,o);await rv(f,g,Cu()&&l.length>0);const _=f;let y;this._createCanvas&&(y=ev(f,n));const b=Rn(y?y.canvas:_,f.width-m,f.height-m,n,a);return s&&(b.source.style=s),this._createCanvas&&(this._renderer.texture.initSource(b.source),me.returnCanvasAndContext(y)),Pt.return(o),b}returnTexturePromise(t){t.then(e=>{this._cleanUp(e)}).catch(()=>{})}_cleanUp(t){vt.returnTexture(t,!0),t.source.resource=null,t.source.uploadMethodId="unknown"}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexturePromise(this._activeTextures[t].promise);this._activeTextures=null}}Mu.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"htmlText"},N.add(Mu),N.add(Au);class iv extends Ps{constructor(...t){var e;const i=As(t,"HtmlText");super(i,Fs),this.renderPipeId="htmlText",i.textureStyle&&(this.textureStyle=i.textureStyle instanceof Jt?i.textureStyle:new Jt(i.textureStyle)),this.autoGenerateMipmaps=(e=i.autoGenerateMipmaps)!=null?e:ft.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor,i=Pu(this.text,this._style),{width:n,height:s}=i;t.minX=-e._x*n,t.maxX=t.minX+n,t.minY=-e._y*s,t.maxY=t.minY+s}get text(){return this._text}set text(t){const e=this._sanitiseText(t.toString());super.text=e}_sanitiseText(t){return this._removeInvalidHtmlTags(t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," "))}_removeInvalidHtmlTags(t){const e=/<[^>]*?(?=<|$)/g;return t.replace(e,"")}}class nv extends Tb{uploadQueueItem(t){t instanceof ft?this.uploadTextureSource(t):t instanceof Wi?this.uploadText(t):t instanceof iv?this.uploadHTMLText(t):t instanceof Tu?this.uploadBitmapText(t):t instanceof kt&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getGpuContext(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:n}=i.data;this.uploadTextureSource(n.source)}else if(i.action==="fill"){const{texture:n}=i.data.style;this.uploadTextureSource(n.source)}return null}}class sv extends nv{destroy(){super.destroy(),clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}sv.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"prepare"};const Ru=class br{static _getPatternRepeat(t,e){const i=t&&t!=="clamp-to-edge",n=e&&e!=="clamp-to-edge";return i&&n?"repeat":i?"repeat-x":n?"repeat-y":"no-repeat"}start(t,e,i){}execute(t,e){var i,n,s,a,o,l,u,c,h,p;const f=e.elements;if(!f||!f.length)return;const m=t.renderer,g=m.canvasContext,_=g.activeContext;for(let y=0;y<f.length;y++){const b=f[y];if(!b.packAsQuad)continue;const x=b,v=x.texture,w=v?Q.getCanvasSource(v):null;if(!w)continue;const T=v.source.style,E=g.smoothProperty,P=T.scaleMode!=="nearest";_[E]!==P&&(_[E]=P),g.setBlendMode(e.blendMode);const M=(n=(i=m.globalUniforms.globalUniformData)==null?void 0:i.worldColor)!=null?n:4294967295,C=x.color,A=(M>>>24&255)/255,G=(C>>>24&255)/255,F=(a=(s=m.filter)==null?void 0:s.alphaMultiplier)!=null?a:1,R=A*G*F;if(R<=0)continue;_.globalAlpha=R;const B=M&16777215,O=C&16777215,I=xe(Oe(O,B)),L=v.frame,j=(o=T.addressModeU)!=null?o:T.addressMode,J=(l=T.addressModeV)!=null?l:T.addressMode,K=br._getPatternRepeat(j,J),X=(c=(u=v.source._resolution)!=null?u:v.source.resolution)!=null?c:1,k=(p=(h=x.renderable)==null?void 0:h.renderGroup)==null?void 0:p.isCachedAsTexture,$=L.x*X,z=L.y*X,rt=L.width*X,_t=L.height*X,et=x.bounds,st=m.renderTarget.renderTarget.isRoot,nt=et.minX,ot=et.minY,gt=et.maxX-et.minX,yt=et.maxY-et.minY,pt=v.rotate,Y=v.uvs,Rt=Math.min(Y.x0,Y.x1,Y.x2,Y.x3,Y.y0,Y.y1,Y.y2,Y.y3),Ct=Math.max(Y.x0,Y.x1,Y.x2,Y.x3,Y.y0,Y.y1,Y.y2,Y.y3),ce=K!=="no-repeat"&&(Rt<0||Ct>1),va=pt&&!(!ce&&(I!==16777215||pt));va?(br._tempPatternMatrix.copyFrom(x.transform),W.matrixAppendRotationInv(br._tempPatternMatrix,pt,nt,ot,gt,yt),g.setContextTransform(br._tempPatternMatrix,x.roundPixels===1,void 0,k&&st)):g.setContextTransform(x.transform,x.roundPixels===1,void 0,k&&st);const yh=gt,bh=yt;let tn=va?0:nt,en=va?0:ot;if(!va&&x.roundPixels===1&&(tn|=0,en|=0),ce){let _r=w;const ii=I!==16777215&&!pt,RB=L.width<=v.source.width&&L.height<=v.source.height;ii&&RB&&(_r=Q.getTintedCanvas({texture:v},I));const vh=_.createPattern(_r,K);if(!vh)continue;const _1=yh,y1=bh;if(_1===0||y1===0)continue;const b1=1/_1,v1=1/y1,x1=(Y.x1-Y.x0)*b1,T1=(Y.y1-Y.y0)*b1,S1=(Y.x3-Y.x0)*v1,w1=(Y.y3-Y.y0)*v1,OB=Y.x0-x1*tn-S1*en,GB=Y.y0-T1*tn-w1*en,xh=v.source.pixelWidth,Th=v.source.pixelHeight;br._tempPatternMatrix.set(x1*xh,T1*Th,S1*xh,w1*Th,OB*xh,GB*Th),Q.applyPatternTransform(vh,br._tempPatternMatrix),_.fillStyle=vh,_.fillRect(tn,en,yh,bh)}else{const _r=I!==16777215||pt?Q.getTintedCanvas({texture:v},I):w,ii=_r!==w;_.drawImage(_r,ii?0:$,ii?0:z,ii?_r.width:rt,ii?_r.height:_t,tn,en,yh,bh)}}}};Ru._tempPatternMatrix=new U,Ru.extension={type:[S.CanvasPipesAdaptor],name:"batch"};let av=Ru;class Ou{constructor(){this._tempState=Vt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){const n=t.renderer,s=this._didUploadHash[i.uid];n.shader.bind(i,s),s||(this._didUploadHash[i.uid]=!0),n.shader.updateUniformGroup(n.globalUniforms.uniformGroup),n.geometry.bind(e,i.glProgram)}execute(t,e){const i=t.renderer;this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);const n=e.textures.textures;for(let s=0;s<e.textures.count;s++)i.texture.bind(n[s],s);i.geometry.draw(e.topology,e.size,e.start)}}Ou.extension={type:[S.WebGLPipesAdaptor],name:"batch"};function OR(r){const t=[];let e=0;for(let i=0;i<r;i++)t[e]={texture:{sampleType:"float",viewDimension:"2d",multisampled:!1},binding:e,visibility:GPUShaderStage.FRAGMENT},e++,t[e]={sampler:{type:"filtering"},binding:e,visibility:GPUShaderStage.FRAGMENT},e++;return t}function GR(r){const t={};let e=0;for(let i=0;i<r;i++)t[`textureSource${i+1}`]=e++,t[`textureSampler${i+1}`]=e++;return t}const Us=Vt.for2d();class Gu{start(t,e,i){const n=t.renderer,s=n.encoder,a=i.gpuProgram;this._shader=i,this._geometry=e,s.setGeometry(e,a),Us.blendMode="normal",n.pipeline.getPipeline(e,a,Us);const o=n.globalUniforms.bindGroup;s.resetBindGroup(1),s.setBindGroup(0,o,a)}execute(t,e){const i=this._shader.gpuProgram,n=t.renderer,s=n.encoder;if(!e.bindGroup){const l=e.textures;e.bindGroup=kn(l.textures,l.count,n.limits.maxBatchableTextures)}Us.blendMode=e.blendMode;const a=n.bindGroup.getBindGroup(e.bindGroup,i,1),o=n.pipeline.getPipeline(this._geometry,i,Us,e.topology);e.bindGroup._touch(n.gc.now,n.tick),s.setPipeline(o),s.renderPassEncoder.setBindGroup(1,a),s.renderPassEncoder.drawIndexed(e.size,1,e.start)}}Gu.extension={type:[S.WebGPUPipesAdaptor],name:"batch"};const Iu=class j1{constructor(t,e){this.state=Vt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null);var i,n;this.renderer=t,this._adaptor=e,(n=(i=this._adaptor).init)==null||n.call(i,this)}static getBatcher(t,e){return new this._availableBatchers[t]({maxTextures:e})}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new Vn({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(const i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=j1.getBatcher(t.batcherName,this.renderer.limits.maxBatchableTextures),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);const e=this._activeBatches;for(const i in e){const n=e[i],s=n.geometry;s.indexBuffer.setDataWithSize(n.indexBuffer,n.indexSize,!0),s.buffers[0].setDataWithSize(n.attributeBuffer.float32View,n.attributeSize,!1)}}upload(t){const e=this._batchersByInstructionSet[t.uid];for(const i in e){const n=e[i],s=n.geometry;n.dirty&&(n.dirty=!1,s.buffers[0].update(n.attributeSize*4))}}execute(t){if(t.action==="startBatch"){const e=t.batcher,i=e.geometry,n=e.shader;this._adaptor.start(this,i,n)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};Iu.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"batch"},Iu._availableBatchers=Object.create(null);let $s=Iu;N.handleByMap(S.Batcher,$s._availableBatchers),N.add(Vn);function IR(r){const t=r.split(/([\n{}])/g).map(i=>i.trim()).filter(i=>i.length);let e="";return t.map(i=>{let n=e+i;return i==="{"?e+=" ":i==="}"&&(e=e.substr(0,e.length-4),n=e+i),n}).join(`
|
|
1769
|
+
`)}const ov={name:"texture-bit",vertex:{header:`
|
|
1770
|
+
|
|
1771
|
+
struct TextureUniforms {
|
|
1772
|
+
uTextureMatrix:mat3x3<f32>,
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
|
|
1776
|
+
`,main:`
|
|
1777
|
+
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
1778
|
+
`},fragment:{header:`
|
|
1779
|
+
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
1780
|
+
@group(2) @binding(1) var uSampler: sampler;
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
`,main:`
|
|
1784
|
+
outColor = textureSample(uTexture, uSampler, vUV);
|
|
1785
|
+
`}},lv={name:"texture-bit",vertex:{header:`
|
|
1786
|
+
uniform mat3 uTextureMatrix;
|
|
1787
|
+
`,main:`
|
|
1788
|
+
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
|
|
1789
|
+
`},fragment:{header:`
|
|
1790
|
+
uniform sampler2D uTexture;
|
|
1791
|
+
|
|
1792
|
+
|
|
1793
|
+
`,main:`
|
|
1794
|
+
outColor = texture(uTexture, vUV);
|
|
1795
|
+
`}},BR=new Mt;let FR=class extends oi{constructor(){super(),this.filters=[new hy({sprite:new pe(D.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}get channel(){return this.filters[0].channel}set channel(t){this.filters[0].channel=t}};class ks{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){var n;const s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.channel=(n=e._maskOptions.channel)!=null?n:"red",t.renderMaskToTexture){const a=t.mask;a.includeInBuild=!0,a.collectRenderables(i,s,null),a.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){const e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){const n=Pt.get(FR);if(n.inverse=t.inverse,n.channel=t.mask.channel,i){t.mask.mask.measurable=!0;const s=li(t.mask.mask,!0,BR);t.mask.mask.measurable=!1,s.ceil();const a=e.renderTarget.renderTarget.colorTexture.source,o=vt.getOptimalTexture(s.width,s.height,a._resolution,a.antialias);e.renderTarget.push(o,!0),e.globalUniforms.push({offset:s,worldColor:4294967295});const l=n.sprite;l.texture=o,l.worldTransform.tx=s.minX,l.worldTransform.ty=s.minY,this._activeMaskStage.push({filterEffect:n,maskedContainer:t.maskedContainer,filterTexture:o})}else n.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:n,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){const n=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===It.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:n.maskedContainer,filterEffect:n.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();const n=this._activeMaskStage.pop();i&&vt.returnTexture(n.filterTexture),Pt.return(n.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}ks.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"alphaMask"};class Bu{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&t.mask;const s=this._colorStack[this._colorStackIndex];s!==this._currentColor&&(this._currentColor=s,i.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);const n=this._colorStack;this._colorStackIndex--;const s=n[this._colorStackIndex-1];s!==this._currentColor&&(this._currentColor=s,i.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(t){}destroy(){this._renderer=null,this._colorStack=null}}Bu.extension={type:[S.CanvasPipes],name:"colorMask"};class Fu{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&t.mask;const s=this._colorStack[this._colorStackIndex];s!==this._currentColor&&(this._currentColor=s,i.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);const n=this._colorStack;this._colorStackIndex--;const s=n[this._colorStackIndex-1];s!==this._currentColor&&(this._currentColor=s,i.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}Fu.extension={type:[S.WebGLPipes,S.WebGPUPipes],name:"colorMask"};class DR{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){Sn(this.mask,t,e)}addLocalBounds(t,e){wn(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}destroy(){this.reset()}}function UR(r,t,e,i,n,s){s=Math.max(0,Math.min(s,Math.min(i,n)/2)),r.moveTo(t+s,e),r.lineTo(t+i-s,e),r.quadraticCurveTo(t+i,e,t+i,e+s),r.lineTo(t+i,e+n-s),r.quadraticCurveTo(t+i,e+n,t+i-s,e+n),r.lineTo(t+s,e+n),r.quadraticCurveTo(t,e+n,t,e+n-s),r.lineTo(t,e+s),r.quadraticCurveTo(t,e,t+s,e)}function uv(r,t){switch(t.type){case"rectangle":{const e=t;r.rect(e.x,e.y,e.width,e.height);break}case"roundedRectangle":{const e=t;UR(r,e.x,e.y,e.width,e.height,e.radius);break}case"circle":{const e=t;r.moveTo(e.x+e.radius,e.y),r.arc(e.x,e.y,e.radius,0,Math.PI*2);break}case"ellipse":{const e=t;r.ellipse?(r.moveTo(e.x+e.halfWidth,e.y),r.ellipse(e.x,e.y,e.halfWidth,e.halfHeight,0,0,Math.PI*2)):(r.save(),r.translate(e.x,e.y),r.scale(e.halfWidth,e.halfHeight),r.moveTo(1,0),r.arc(0,0,1,0,Math.PI*2),r.restore());break}case"triangle":{const e=t;r.moveTo(e.x,e.y),r.lineTo(e.x2,e.y2),r.lineTo(e.x3,e.y3),r.closePath();break}default:{const e=t,i=e.points;if(!(i!=null&&i.length))break;r.moveTo(i[0],i[1]);for(let n=2;n<i.length;n+=2)r.lineTo(i[n],i[n+1]);e.closePath&&r.closePath();break}}}function $R(r,t,e){var i;const n=[],s=[],a=[],o=Ne[t.type];if(!(o!=null&&o.build(t,n)))return!1;const l=(i=t.closePath)!=null?i:!0;Qn(n,e,!1,l,s,a);for(let u=0;u<a.length;u+=3){const c=a[u]*2,h=a[u+1]*2,p=a[u+2]*2;r.moveTo(s[c],s[c+1]),r.lineTo(s[h],s[h+1]),r.lineTo(s[p],s[p+1]),r.closePath()}return!0}function kR(r,t){if(!(t!=null&&t.length))return!1;for(let e=0;e<t.length;e++){const i=t[e];if(!(i!=null&&i.shape))continue;const n=i.transform,s=n&&!n.isIdentity();s&&(r.save(),r.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),uv(r,i.shape),s&&r.restore()}return!0}class Du{constructor(t){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){var e,i,n;if(t.action!=="pushMaskBegin"&&t.action!=="popMaskEnd")return;const s=this._renderer,a=s.canvasContext,o=a==null?void 0:a.activeContext;if(!o)return;if(t.action==="popMaskEnd"){this._canvasMaskStack.pop()&&o.restore();return}t.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const l=t.mask.mask;if(!(l instanceof hr)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const u=l,c=(e=u.context)==null?void 0:e.instructions;if(!(c!=null&&c.length)){this._canvasMaskStack.push(!1);return}o.save(),a.setContextTransform(u.groupTransform,(s._roundPixels|u._roundPixels)===1),o.beginPath();let h=!1,p=!1;for(let f=0;f<c.length;f++){const m=c[f],g=m.action;if(g!=="fill"&&g!=="stroke")continue;const _=m.data,y=(i=_==null?void 0:_.path)==null?void 0:i.shapePath;if(!((n=y==null?void 0:y.shapePrimitives)!=null&&n.length))continue;const b=g==="stroke",x=y.shapePrimitives;for(let v=0;v<x.length;v++){const w=x[v];if(!(w!=null&&w.shape))continue;const T=w.transform,E=T&&!T.isIdentity();E&&(o.save(),o.transform(T.a,T.b,T.c,T.d,T.tx,T.ty)),b&&_.style?h=$R(o,w.shape,_.style)||h:(uv(o,w.shape),p=kR(o,w.holes)||p,h=!0),E&&o.restore()}}if(!h){o.restore(),this._canvasMaskStack.push(!1);return}p?o.clip("evenodd"):o.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(t,e){this._warnedMaskTypes.has(t)||(this._warnedMaskTypes.add(t),ue(e))}}Du.extension={type:[S.CanvasPipes],name:"stencilMask"};class Uu{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var n,s;const a=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(a.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const l=a.mask;l.includeInBuild=!0,this._maskHash.has(a)||this._maskHash.set(a,{instructionsStart:0,instructionsLength:0});const u=this._maskHash.get(a);u.instructionsStart=i.instructionSize,l.collectRenderables(i,o,null),l.includeInBuild=!1,o.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const c=i.instructionSize-u.instructionsStart-1;u.instructionsLength=c;const h=o.renderTarget.renderTarget.uid;(s=(n=this._maskStackHash)[h])!=null||(n[h]=0)}pop(t,e,i){const n=t,s=this._renderer;s.renderPipes.batch.break(i),s.renderPipes.blendMode.setBlendMode(n.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});const a=this._maskHash.get(t);for(let o=0;o<a.instructionsLength;o++)i.instructions[i.instructionSize++]=i.instructions[a.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e,i;const n=this._renderer,s=n,a=n.renderTarget.renderTarget.uid;let o=(i=(e=this._maskStackHash)[a])!=null?i:e[a]=0;t.action==="pushMaskBegin"?(s.renderTarget.ensureDepthStencil(),s.stencil.setStencilMode(wt.RENDERING_MASK_ADD,o),o++,s.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?s.stencil.setStencilMode(wt.INVERSE_MASK_ACTIVE,o):s.stencil.setStencilMode(wt.MASK_ACTIVE,o),s.colorMask.setMask(15)):t.action==="popMaskBegin"?(s.colorMask.setMask(0),o!==0?s.stencil.setStencilMode(wt.RENDERING_MASK_REMOVE,o):(s.renderTarget.clear(null,Kt.STENCIL),s.stencil.setStencilMode(wt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?s.stencil.setStencilMode(wt.INVERSE_MASK_ACTIVE,o):s.stencil.setStencilMode(wt.MASK_ACTIVE,o),s.colorMask.setMask(15)),this._maskStackHash[a]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}Uu.extension={type:[S.WebGLPipes,S.WebGPUPipes],name:"stencilMask"};const mt="source-over";function cv(){const r=ao(),t=Object.create(null);return t.inherit=mt,t.none=mt,t.normal="source-over",t.add="lighter",t.multiply=r?"multiply":mt,t.screen=r?"screen":mt,t.overlay=r?"overlay":mt,t.darken=r?"darken":mt,t.lighten=r?"lighten":mt,t["color-dodge"]=r?"color-dodge":mt,t["color-burn"]=r?"color-burn":mt,t["hard-light"]=r?"hard-light":mt,t["soft-light"]=r?"soft-light":mt,t.difference=r?"difference":mt,t.exclusion=r?"exclusion":mt,t.saturation=r?"saturation":mt,t.color=r?"color":mt,t.luminosity=r?"luminosity":mt,t["linear-burn"]=r?"color-burn":mt,t["linear-dodge"]=r?"color-dodge":mt,t["linear-light"]=r?"hard-light":mt,t["pin-light"]=r?"hard-light":mt,t["vivid-light"]=r?"hard-light":mt,t["hard-mix"]=mt,t.negation=r?"difference":mt,t["normal-npm"]=t.normal,t["add-npm"]=t.add,t["screen-npm"]=t.screen,t.erase="destination-out",t.subtract=mt,t.divide=mt,t.min=mt,t.max=mt,t}const LR=new U;class $u{constructor(t){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=cv(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=t}resolutionChange(t){this.activeResolution=t}init(){const t=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:t}),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(t,e,i,n){var s;const a=n?U.IDENTITY:((s=this._renderer.globalUniforms.globalUniformData)==null?void 0:s.worldTransformMatrix)||U.IDENTITY;let o=LR;o.copyFrom(a),o.append(t);const l=this._projTransform,u=this.activeResolution;if(i=i||u,l){const c=U.shared;c.copyFrom(o),c.prepend(l),o=c}e?this.activeContext.setTransform(o.a*i,o.b*i,o.c*i,o.d*i,o.tx*u|0,o.ty*u|0):this.activeContext.setTransform(o.a*i,o.b*i,o.c*i,o.d*i,o.tx*u,o.ty*u)}clear(t,e){const i=this.activeContext,n=this._renderer;if(i.clearRect(0,0,n.width,n.height),t){const s=tt.shared.setValue(t);i.globalAlpha=e!=null?e:s.alpha,i.fillStyle=s.toHex(),i.fillRect(0,0,n.width,n.height),i.globalAlpha=1}}setBlendMode(t){if(this._activeBlendMode===t)return;this._activeBlendMode=t,this._outerBlend=!1;const e=this.blendModes[t];if(!e){this._warnedBlendModes.has(t)||(console.warn(`CanvasRenderer: blend mode "${t}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(t)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=e}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}$u.extension={type:[S.CanvasSystem],name:"canvasContext"};class ku{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}ku.extension={type:[S.CanvasSystem],name:"limits"};class Ls{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}Ls.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"customRender"};function Ns(r,t){const e=r.instructionSet,i=e.instructions;for(let n=0;n<e.instructionSize;n++){const s=i[n];t[s.renderPipeId].execute(s)}}class Xs{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(Pt.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){var i;const n=(i=t._batchableRenderGroup)!=null?i:t._batchableRenderGroup=Pt.get(zi);n.renderable=t.root,n.transform=t.root.relativeGroupTransform,n.texture=t.texture,n.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.blendMode.pushBlendMode(t,t.root.groupBlendMode,e),this._renderer.renderPipes.batch.addToBatch(n,e),this._renderer.renderPipes.blendMode.popBlendMode(e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;const e=new U().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295,offset:{x:0,y:0}}),Ns(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),Ns(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}Xs.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"renderGroup"};const NR="#808080",js=new U,XR=new U,jR=new U,Lu=new U;function HR(r,t,e){r.beginPath();for(let i=0;i<e.length;i+=3){const n=e[i]*2,s=e[i+1]*2,a=e[i+2]*2;r.moveTo(t[n],t[n+1]),r.lineTo(t[s],t[s+1]),r.lineTo(t[a],t[a+1]),r.closePath()}r.fill()}function zR(r){return`#${(r&16777215).toString(16).padStart(6,"0")}`}function WR(r,t,e,i,n,s){s=Math.max(0,Math.min(s,Math.min(i,n)/2)),r.moveTo(t+s,e),r.lineTo(t+i-s,e),r.quadraticCurveTo(t+i,e,t+i,e+s),r.lineTo(t+i,e+n-s),r.quadraticCurveTo(t+i,e+n,t+i-s,e+n),r.lineTo(t+s,e+n),r.quadraticCurveTo(t,e+n,t,e+n-s),r.lineTo(t,e+s),r.quadraticCurveTo(t,e,t+s,e)}function Hs(r,t){switch(t.type){case"rectangle":{const e=t;r.rect(e.x,e.y,e.width,e.height);break}case"roundedRectangle":{const e=t;WR(r,e.x,e.y,e.width,e.height,e.radius);break}case"circle":{const e=t;r.arc(e.x,e.y,e.radius,0,Math.PI*2);break}case"ellipse":{const e=t;r.ellipse?r.ellipse(e.x,e.y,e.halfWidth,e.halfHeight,0,0,Math.PI*2):(r.save(),r.translate(e.x,e.y),r.scale(e.halfWidth,e.halfHeight),r.arc(0,0,1,0,Math.PI*2),r.restore());break}case"triangle":{const e=t;r.moveTo(e.x,e.y),r.lineTo(e.x2,e.y2),r.lineTo(e.x3,e.y3),r.closePath();break}default:{const e=t,i=e.points;if(!(i!=null&&i.length))break;r.moveTo(i[0],i[1]);for(let n=2;n<i.length;n+=2)r.lineTo(i[n],i[n+1]);e.closePath&&r.closePath();break}}}function VR(r,t){if(!(t!=null&&t.length))return!1;for(let e=0;e<t.length;e++){const i=t[e];if(!(i!=null&&i.shape))continue;const n=i.transform,s=n&&!n.isIdentity();s&&(r.save(),r.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),Hs(r,i.shape),s&&r.restore()}return!0}function YR(r,t,e,i){const n=r.fill;if(n instanceof $t){n.buildGradient();const a=n.texture;if(a){const o=Q.getTintedPattern(a,t),l=e?Lu.copyFrom(e).scale(a.source.pixelWidth,a.source.pixelHeight):Lu.copyFrom(n.transform);return i&&!r.textureSpace&&l.append(i),Q.applyPatternTransform(o,l),o}}if(n instanceof Xr){const a=Q.getTintedPattern(n.texture,t);return Q.applyPatternTransform(a,n.transform,!1),a}const s=r.texture;if(s&&s!==D.WHITE){if(!s.source.resource)return NR;const a=Q.getTintedPattern(s,t),o=e?Lu.copyFrom(e).scale(s.source.pixelWidth,s.source.pixelHeight):r.matrix;return Q.applyPatternTransform(a,o),a}return zR(t)}class Nu{constructor(){this.shader=null}contextChange(t){}execute(t,e){var i,n,s,a,o,l,u,c,h,p,f,m;const g=t.renderer,_=g.canvasContext,y=_.activeContext,b=e.groupTransform,x=(n=(i=g.globalUniforms.globalUniformData)==null?void 0:i.worldColor)!=null?n:4294967295,v=e.groupColorAlpha,w=(x>>>24&255)/255,T=(v>>>24&255)/255,E=(a=(s=g.filter)==null?void 0:s.alphaMultiplier)!=null?a:1,P=w*T*E;if(P<=0)return;const M=x&16777215,C=v&16777215,A=xe(Oe(C,M)),G=g._roundPixels|e._roundPixels;y.save(),_.setContextTransform(b,G===1),_.setBlendMode(e.groupBlendMode);const F=e.context.instructions;for(let R=0;R<F.length;R++){const B=F[R];if(B.action==="texture"){const k=B.data,$=k.image,z=$?Q.getCanvasSource($):null;if(!z)continue;const rt=k.alpha*P;if(rt<=0)continue;const _t=Oe(k.style,A);y.globalAlpha=rt;let et=z;_t!==16777215&&(et=Q.getTintedCanvas({texture:$},_t));const st=$.frame,nt=(l=(o=$.source._resolution)!=null?o:$.source.resolution)!=null?l:1;let ot=st.x*nt,gt=st.y*nt;const yt=st.width*nt,pt=st.height*nt;et!==z&&(ot=0,gt=0);const Y=k.transform,Rt=Y&&!Y.isIdentity(),Ct=$.rotate;Rt||Ct?(js.copyFrom(b),Rt&&js.append(Y),Ct&&W.matrixAppendRotationInv(js,Ct,k.dx,k.dy,k.dw,k.dh),_.setContextTransform(js,G===1)):_.setContextTransform(b,G===1),y.drawImage(et,ot,gt,et===z?yt:et.width,et===z?pt:et.height,Ct?0:k.dx,Ct?0:k.dy,k.dw,k.dh),(Rt||Ct)&&_.setContextTransform(b,G===1);continue}const O=B.data,I=(u=O==null?void 0:O.path)==null?void 0:u.shapePath;if(!((c=I==null?void 0:I.shapePrimitives)!=null&&c.length))continue;const L=O.style,j=Oe(L.color,A),J=L.alpha*P;if(J<=0)continue;const K=B.action==="stroke";if(y.globalAlpha=J,K){const k=L;y.lineWidth=k.width,y.lineCap=k.cap,y.lineJoin=k.join,y.miterLimit=k.miterLimit}const X=I.shapePrimitives;if(!K&&(f=(p=(h=O.hole)==null?void 0:h.shapePath)==null?void 0:p.shapePrimitives)!=null&&f.length){const k=X[X.length-1];k.holes=O.hole.shapePath.shapePrimitives}for(let k=0;k<X.length;k++){const $=X[k];if(!($!=null&&$.shape))continue;const z=$.transform,rt=z&&!z.isIdentity(),_t=L.texture&&L.texture!==D.WHITE,et=L.textureSpace==="global"?z:null,st=_t?ll(XR,L,$.shape,et):null,nt=rt?jR.copyFrom(b).append(z):b,ot=YR(L,j,st,nt);if(rt&&(y.save(),y.transform(z.a,z.b,z.c,z.d,z.tx,z.ty)),K){const gt=L;if(gt.alignment!==.5&&!gt.pixelLine){const yt=[],pt=[],Y=[],Rt=Ne[$.shape.type];if(Rt!=null&&Rt.build($.shape,yt)){const Ct=(m=$.shape.closePath)!=null?m:!0;Qn(yt,gt,!1,Ct,pt,Y),y.fillStyle=ot,HR(y,pt,Y)}else y.strokeStyle=ot,y.beginPath(),Hs(y,$.shape),y.stroke()}else y.strokeStyle=ot,y.beginPath(),Hs(y,$.shape),y.stroke()}else y.fillStyle=ot,y.beginPath(),Hs(y,$.shape),VR(y,$.holes)?y.fill("evenodd"):y.fill();rt&&y.restore()}}y.restore()}destroy(){this.shader=null}}Nu.extension={type:[S.CanvasPipesAdaptor],name:"graphics"};class zs{constructor(t){this._renderer=t}addRenderable(t,e){const i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=new zi;return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,e}destroy(){this._renderer=null}}zs.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"sprite"};const Vi={};N.handle(S.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Vi[r.name]=r.ref},r=>{delete Vi[r.name]});class Ws{constructor(t){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(t,e,i){this._blendModeStack.push(e),this.setBlendMode(t,e,i)}popBlendMode(t){var e;this._blendModeStack.pop();const i=(e=this._blendModeStack[this._activeBlendMode.length-1])!=null?e:"normal";this.setBlendMode(null,i,t)}setBlendMode(t,e,i){var n;const s=t instanceof mn;if(this._activeBlendMode===e){this._isAdvanced&&t&&!s&&((n=this._renderableList)==null||n.push(t));return}this._isAdvanced&&this._endAdvancedBlendMode(i),this._activeBlendMode=e,t&&(this._isAdvanced=!!Vi[e],this._isAdvanced&&this._beginAdvancedBlendMode(t,i))}_beginAdvancedBlendMode(t,e){this._renderer.renderPipes.batch.break(e);const i=this._activeBlendMode;if(!Vi[i])return;const n=this._ensureFilterEffect(i),s=t instanceof mn,a={renderPipeId:"filter",action:"pushFilter",filterEffect:n,renderables:s?null:[t],container:s?t.root:null,canBundle:!1};this._renderableList=a.renderables,e.add(a)}_ensureFilterEffect(t){let e=this._filterHash[t];return e||(e=this._filterHash[t]=new oi,e.filters=[new Vi[t]]),e}_endAdvancedBlendMode(t){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Ws.extension={type:[S.WebGLPipes,S.WebGPUPipes,S.CanvasPipes],name:"blendMode"};function Vs(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}const KR=new dt,hv=xr|ci|_n;function Xu(r,t=!1){dv(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const n in e){const s=Number(n),a=e[n],o=a.list,l=a.index;for(let u=0;u<l;u++){const c=o[u];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===s&&ju(c,i,0)}Vs(o,l),a.index=0}if(t)for(let n=0;n<r.renderGroupChildren.length;n++)Xu(r.renderGroupChildren[n],t)}function dv(r){const t=r.root;let e;if(r.renderGroupParent){const i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=ui(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function ju(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const n=r.parent;if(n&&!n.renderGroup?(e|=r._updateFlags,r.relativeGroupTransform.appendFrom(i,n.relativeGroupTransform),e&hv&&pv(r,n,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&hv&&pv(r,KR,e)),!r.renderGroup){const s=r.children,a=s.length;for(let u=0;u<a;u++)ju(s[u],t,e);const o=r.parentRenderGroup,l=r;l.renderPipeId&&!o.structureDidChange&&o.updateRenderable(l)}}function pv(r,t,e){if(e&ci){r.groupColor=ui(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&_n&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&xr&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function fv(r,t){const{list:e}=r.childrenRenderablesToUpdate;let i=!1;for(let n=0;n<r.childrenRenderablesToUpdate.index;n++){const s=e[n];if(i=t[s.renderPipeId].validateRenderable(s),i)break}return r.structureDidChange=i,i}const qR=new U;class Hu{constructor(t){this._renderer=t}render({container:t,transform:e}){const i=t.parent,n=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const s=this._renderer,a=qR;e&&(a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const o=s.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),s.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Ns(t.renderGroup,o),o.uniformBatch&&o.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=i,t.renderGroup.renderGroupParent=n}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){var i,n;if(t._parentCacheAsTextureRenderGroup=e,t.isCachedAsTexture){if(!t.textureNeedsUpdate)return;e=t}for(let s=t.renderGroupChildren.length-1;s>=0;s--)this._updateCachedRenderGroups(t.renderGroupChildren[s],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){const s=t.root.getLocalBounds(),a=this._renderer,o=t.textureOptions.resolution||a.view.resolution,l=(i=t.textureOptions.antialias)!=null?i:a.view.antialias,u=(n=t.textureOptions.scaleMode)!=null?n:"linear",c=t.texture;s.ceil(),t.texture&&vt.returnTexture(t.texture,!0);const h=vt.getOptimalTexture(s.width,s.height,o,l);h._source.style=new Jt({scaleMode:u}),t.texture=h,t._textureBounds||(t._textureBounds=new Mt),t._textureBounds.copyFrom(s),c!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(vt.returnTexture(t.texture,!0),t.texture=null)}_updateRenderGroups(t){const e=this._renderer,i=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=i,t.structureDidChange?Vs(t.childrenRenderablesToUpdate.list,0):fv(t,i),Xu(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let n=0;n<t.renderGroupChildren.length;n++)this._updateRenderGroups(t.renderGroupChildren[n])}_updateRenderables(t){const{list:e,index:i}=t.childrenRenderablesToUpdate;for(let n=0;n<i;n++){const s=e[n];s.didViewUpdate&&t.updateRenderable(s)}Vs(e,i)}_buildInstructions(t,e){const i=t.root,n=t.instructionSet;n.reset();const s=e.renderPipes?e:e.batch.renderer,a=s.renderPipes;a.batch.buildStart(n),a.blendMode.buildStart(),a.colorMask.buildStart(),i.sortableChildren&&i.sortChildren(),i.collectRenderablesWithEffects(n,s,null),a.batch.buildEnd(n),a.blendMode.buildEnd(n)}}Hu.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"renderGroup"};var ZR=Object.defineProperty,mv=Object.getOwnPropertySymbols,QR=Object.prototype.hasOwnProperty,JR=Object.prototype.propertyIsEnumerable,gv=(r,t,e)=>t in r?ZR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_v=(r,t)=>{for(var e in t||(t={}))QR.call(t,e)&&gv(r,e,t[e]);if(mv)for(var e of mv(t))JR.call(t,e)&&gv(r,e,t[e]);return r};const zu=class H1{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new tt(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=_v(_v({},H1.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};zu.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"background",priority:0},zu.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let yv=zu;var tO=Object.defineProperty,bv=Object.getOwnPropertySymbols,eO=Object.prototype.hasOwnProperty,rO=Object.prototype.propertyIsEnumerable,vv=(r,t,e)=>t in r?tO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wu=(r,t)=>{for(var e in t||(t={}))eO.call(t,e)&&vv(r,e,t[e]);if(bv)for(var e of bv(t))rO.call(t,e)&&vv(r,e,t[e]);return r};const Vu={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Yu=class z1{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof dt||t instanceof D?Wu({target:t},e):Wu(Wu({},e),t)}async image(t){const e=H.get().createImage();return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,z1.defaultImageOptions);const{format:e,quality:i}=t,n=this.canvas(t);if(n.toBlob!==void 0)return new Promise((s,a)=>{n.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>s(l.result),l.onerror=a,l.readAsDataURL(o)},Vu[e],i)});if(n.toDataURL!==void 0)return n.toDataURL(Vu[e],i);if(n.convertToBlob!==void 0){const s=await n.convertToBlob({type:Vu[e],quality:i});return new Promise((a,o)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer;if(e instanceof D)return i.texture.generateCanvas(e);const n=i.textureGenerator.generateTexture(t),s=i.texture.generateCanvas(n);return n.destroy(!0),s}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,n=e instanceof D?e:i.textureGenerator.generateTexture(t),s=i.texture.getPixels(n);return e instanceof dt&&n.destroy(!0),s}texture(t){return t=this._normalizeOptions(t),t.target instanceof D?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),n=document.createElement("a");n.download=(e=t.filename)!=null?e:"image.png",n.href=i.toDataURL("image/png"),document.body.appendChild(n),n.click(),document.body.removeChild(n)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const n=this.canvas(t),s=n.toDataURL();console.log(`[Pixi Texture] ${n.width}px ${n.height}px`);const a=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",a)}destroy(){this._renderer=null}};Yu.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"extract"},Yu.defaultImageOptions={format:"png",quality:1};let xv=Yu;var iO=Object.defineProperty,nO=Object.defineProperties,sO=Object.getOwnPropertyDescriptors,Ys=Object.getOwnPropertySymbols,Tv=Object.prototype.hasOwnProperty,Sv=Object.prototype.propertyIsEnumerable,wv=(r,t,e)=>t in r?iO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,aO=(r,t)=>{for(var e in t||(t={}))Tv.call(t,e)&&wv(r,e,t[e]);if(Ys)for(var e of Ys(t))Sv.call(t,e)&&wv(r,e,t[e]);return r},oO=(r,t)=>nO(r,sO(t)),lO=(r,t)=>{var e={};for(var i in r)Tv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ys)for(var i of Ys(r))t.indexOf(i)<0&&Sv.call(r,i)&&(e[i]=r[i]);return e};class Ks extends D{static create(t){const e=t,{dynamic:i,textureOptions:n}=e,s=lO(e,["dynamic","textureOptions"]);return new Ks(oO(aO({},n),{source:new ft(s),dynamic:i!=null?i:!1}))}resize(t,e,i){return this.source.resize(t,e,i),this}}var uO=Object.defineProperty,cO=Object.defineProperties,hO=Object.getOwnPropertyDescriptors,Ev=Object.getOwnPropertySymbols,dO=Object.prototype.hasOwnProperty,pO=Object.prototype.propertyIsEnumerable,Pv=(r,t,e)=>t in r?uO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fO=(r,t)=>{for(var e in t||(t={}))dO.call(t,e)&&Pv(r,e,t[e]);if(Ev)for(var e of Ev(t))pO.call(t,e)&&Pv(r,e,t[e]);return r},mO=(r,t)=>cO(r,hO(t));const gO=new ut,_O=new Mt,yO=[0,0,0,0];class Ku{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof dt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,n=t.antialias||this._renderer.view.antialias,s=t.target;let a=t.clearColor;a?a=Array.isArray(a)&&a.length===4?a:tt.shared.setValue(a).toArray():a=yO;const o=((e=t.frame)==null?void 0:e.copyTo(gO))||hn(s,_O).rectangle,l=t.defaultAnchor&&{defaultAnchor:t.defaultAnchor};o.width=Math.max(o.width,1/i)|0,o.height=Math.max(o.height,1/i)|0;const u=Ks.create(mO(fO({},t.textureSourceOptions),{width:o.width,height:o.height,resolution:i,antialias:n,textureOptions:l})),c=U.shared.translate(-o.x,-o.y);return this._renderer.render({container:s,transform:c,target:u,clearColor:a}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Ku.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"textureGenerator"};function Av(r){let t=!1;for(const i in r)if(r[i]==null){t=!0;break}if(!t)return r;const e=Object.create(null);for(const i in r){const n=r[i];n&&(e[i]=n)}return e}function Cv(r){let t=0;for(let e=0;e<r.length;e++)r[e]==null?t++:r[e-t]=r[e];return r.length-=t,r}var bO=Object.defineProperty,Mv=Object.getOwnPropertySymbols,vO=Object.prototype.hasOwnProperty,xO=Object.prototype.propertyIsEnumerable,Rv=(r,t,e)=>t in r?bO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ov=(r,t)=>{for(var e in t||(t={}))vO.call(t,e)&&Rv(r,e,t[e]);if(Mv)for(var e of Mv(t))xO.call(t,e)&&Rv(r,e,t[e]);return r};const qu=class W1{constructor(t){this._managedResources=[],this._managedResourceHashes=[],this._managedCollections=[],this._ready=!1,this._renderer=t}init(t){t=Ov(Ov({},W1.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(t){this.enabled!==t&&(t?(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:i,collection:n,type:s}=e;s==="hash"?i[n]=Av(i[n]):i[n]=Cv(i[n])}},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._collectionsHandler),this._handler=0,this._collectionsHandler=0))}prerender({container:t}){this.now=performance.now(),t.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}postrender(){!this._ready||!this.enabled||(this.run(),this._ready=!1)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e,t.gcTick=e;for(const i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}addCollection(t,e,i){this._managedCollections.push({context:t,collection:e,type:i})}addResource(t,e){var i,n;if(t._gcLastUsed!==-1){t._gcLastUsed=this.now,(i=t._onTouch)==null||i.call(t,this.now);return}const s=this._managedResources.length;t._gcData={index:s,type:e},t._gcLastUsed=this.now,(n=t._onTouch)==null||n.call(t,this.now),t.once("unload",this.removeResource,this),this._managedResources.push(t)}removeResource(t){const e=t._gcData;if(!e)return;const i=e.index,n=this._managedResources.length-1;if(i!==n){const s=this._managedResources[n];this._managedResources[i]=s,s._gcData.index=i}this._managedResources.length--,t._gcData=null,t._gcLastUsed=-1}addResourceHash(t,e,i,n=0){this._managedResourceHashes.push({context:t,hash:e,type:i,priority:n}),this._managedResourceHashes.sort((s,a)=>s.priority-a.priority)}run(){const t=performance.now(),e=this._managedResourceHashes;for(const n of e)this.runOnHash(n,t);let i=0;for(let n=0;n<this._managedResources.length;n++){const s=this._managedResources[n];i=this.runOnResource(s,t,i)}this._managedResources.length=i}updateRenderableGCTick(t,e){var i,n,s,a,o;const l=(i=t.renderGroup)!=null?i:t.parentRenderGroup,u=(s=(n=l==null?void 0:l.instructionSet)==null?void 0:n.gcTick)!=null?s:-1;((a=l==null?void 0:l.gcTick)!=null?a:0)===u&&(t._gcLastUsed=e,(o=t._onTouch)==null||o.call(t,e))}runOnResource(t,e,i){const n=t._gcData;return n.type==="renderable"&&this.updateRenderableGCTick(t,e),e-t._gcLastUsed<this.maxUnusedTime||!t.autoGarbageCollect?(this._managedResources[i]=t,n.index=i,i++):(t.unload(),t._gcData=null,t._gcLastUsed=-1,t.off("unload",this.removeResource,this)),i}_createHashClone(t,e){const i=Object.create(null);for(const n in t){if(n===e)break;t[n]!==null&&(i[n]=t[n])}return i}runOnHash(t,e){var i,n;const{context:s,hash:a,type:o}=t,l=s[a];let u=null,c=0;for(const h in l){const p=l[h];if(p===null){c++,c===1e4&&!u&&(u=this._createHashClone(l,h));continue}if(p._gcLastUsed===-1){p._gcLastUsed=e,(i=p._onTouch)==null||i.call(p,e),u&&(u[h]=p);continue}if(o==="renderable"&&this.updateRenderableGCTick(p,e),!(e-p._gcLastUsed<this.maxUnusedTime)&&p.autoGarbageCollect){if(o==="renderable"){const f=p,m=(n=f.renderGroup)!=null?n:f.parentRenderGroup;m&&(m.structureDidChange=!0)}p.unload(),p._gcData=null,p._gcLastUsed=-1,u||(c+1!==1e4?(l[h]=null,c++):u=this._createHashClone(l,h))}else u&&(u[h]=p)}u&&(s[a]=u)}destroy(){this.enabled=!1,this._managedResources.forEach(t=>{t.off("unload",this.removeResource,this)}),this._managedResources.length=0,this._managedResourceHashes.length=0,this._managedCollections.length=0,this._renderer=null}};qu.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"gc",priority:0},qu.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};let Gv=qu;class Zu{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:n,offset:s}){const a=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:a,worldTransformMatrix:new U,worldColor:4294967295,offset:new lt},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||a.size,worldTransformMatrix:i||o.worldTransformMatrix,worldColor:n||o.worldColor,offset:s||o.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);const c=u.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,Yr(l.worldColor,c.uWorldColorAlpha,0),u.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(h=this._bindGroupPool.pop()||new Ee,this._activeBindGroups.push(h),h.setResource(u,0)),l.bindGroup=h,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===It.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 At({uProjectionMatrix:{value:new U,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new U,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}}Zu.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"globalUniforms"};let TO=1;class Qu{constructor(){this._tasks=[],this._offset=0}init(){Ot.system.add(this._update,this)}repeat(t,e,i=!0){const n=TO++;let s=0;return i&&(this._offset+=1e3,s=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:s,last:performance.now(),repeat:!0,id:n}),n}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const i=this._tasks[e];if(t-i.offset-i.last>=i.duration){const n=t-i.start;i.func(n),i.last=t}}}destroy(){Ot.system.remove(this._update,this),this._tasks.length=0}}Qu.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"scheduler",priority:0};let Iv=!1;function Bv(r){if(!Iv){if(H.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${Ai} (${r}) http://www.pixijs.com/
|
|
1796
|
+
|
|
1797
|
+
`,"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 ${Ai} - ${r} - http://www.pixijs.com/`);Iv=!0}}class qs{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===It.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),Bv(e)}}}qs.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"hello",priority:-2},qs.defaultOptions={hello:!1};var SO=Object.defineProperty,Fv=Object.getOwnPropertySymbols,wO=Object.prototype.hasOwnProperty,EO=Object.prototype.propertyIsEnumerable,Dv=(r,t,e)=>t in r?SO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Uv=(r,t)=>{for(var e in t||(t={}))wO.call(t,e)&&Dv(r,e,t[e]);if(Fv)for(var e of Fv(t))EO.call(t,e)&&Dv(r,e,t[e]);return r};const Ju=class V1{constructor(t){this._renderer=t}init(t){t=Uv(Uv({},V1.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime}get enabled(){return this._renderer.gc.enabled}set enabled(t){this._renderer.gc.enabled=t}addManagedHash(t,e){this._renderer.gc.addCollection(t,e,"hash")}addManagedArray(t,e){this._renderer.gc.addCollection(t,e,"array")}addRenderable(t){this._renderer.gc.addResource(t,"renderable")}run(){this._renderer.gc.run()}destroy(){this._renderer=null}};Ju.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"renderableGC",priority:0},Ju.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let $v=Ju;const tc=class Sa{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(t){this._checkCount=t}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(t){this._renderer.gc.maxUnusedTime=t/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(t){}get active(){return this._renderer.gc.enabled}set active(t){this._renderer.gc.enabled=t}constructor(t){this._renderer=t,this._checkCount=0}init(t){t.textureGCActive!==Sa.defaultOptions.textureGCActive&&(this.active=t.textureGCActive),t.textureGCMaxIdle!==Sa.defaultOptions.textureGCMaxIdle&&(this.maxIdle=t.textureGCMaxIdle),t.textureGCCheckCountMax!==Sa.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=t.textureGCCheckCountMax)}run(){this._renderer.gc.run()}destroy(){this._renderer=null}};tc.extension={type:[S.WebGLSystem,S.WebGPUSystem],name:"textureGC"},tc.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let kv=tc;var PO=Object.defineProperty,Lv=Object.getOwnPropertySymbols,AO=Object.prototype.hasOwnProperty,CO=Object.prototype.propertyIsEnumerable,Nv=(r,t,e)=>t in r?PO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Xv=(r,t)=>{for(var e in t||(t={}))AO.call(t,e)&&Nv(r,e,t[e]);if(Lv)for(var e of Lv(t))CO.call(t,e)&&Nv(r,e,t[e]);return r};const jv=class Y1{constructor(t={}){if(this.uid=ht("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t=Xv(Xv({},Y1.defaultOptions),t),this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new ft({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.source)];const e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof D||t.depthStencilTexture instanceof ft?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new ft({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((s,a)=>{n&&a===0||s.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};jv.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let Zs=jv;var MO=Object.defineProperty,Hv=Object.getOwnPropertySymbols,RO=Object.prototype.hasOwnProperty,OO=Object.prototype.propertyIsEnumerable,zv=(r,t,e)=>t in r?MO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,GO=(r,t)=>{for(var e in t||(t={}))RO.call(t,e)&&zv(r,e,t[e]);if(Hv)for(var e of Hv(t))OO.call(t,e)&&zv(r,e,t[e]);return r};const fr=new Map;qe.register(fr);function ec(r,t){if(!fr.has(r)){const e=new D({source:new fe(GO({resource:r},t))}),i=()=>{fr.get(r)===e&&fr.delete(r)};e.once("destroy",i),e.source.once("destroy",i),fr.set(r,e)}return fr.get(r)}function IO(r){return fr.has(r)}var BO=Object.defineProperty,Wv=Object.getOwnPropertySymbols,FO=Object.prototype.hasOwnProperty,DO=Object.prototype.propertyIsEnumerable,Vv=(r,t,e)=>t in r?BO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Yv=(r,t)=>{for(var e in t||(t={}))FO.call(t,e)&&Vv(r,e,t[e]);if(Wv)for(var e of Wv(t))DO.call(t,e)&&Vv(r,e,t[e]);return r};const rc=class K1{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=Yv(Yv({},K1.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new ut(0,0,t.width,t.height),this.canvas=t.canvas||H.get().createCanvas(),this.antialias=!!t.antialias,this.texture=ec(this.canvas,t),this.renderTarget=new Zs({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};rc.extension={type:[S.WebGLSystem,S.WebGPUSystem,S.CanvasSystem],name:"view",priority:0},rc.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let Kv=rc;const Qs=[yv,Zu,qs,Kv,Hu,Gv,kv,Ku,xv,ko,$v,Qu],ic=[Ws,$s,zs,Xs,ks,Uu,Fu,Ls];function qv(r,t,e,i,n,s){const a=s?1:-1;return r.identity(),r.a=1/i*2,r.d=a*(1/n*2),r.tx=-1-t*r.a,r.ty=-a-e*r.d,r}function Zv(r){const t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}class Js{constructor(t){this.rootViewPort=new ut,this.viewport=new ut,this.mipLevel=0,this.layer=0,this.onRenderTargetChange=new Fo("onRenderTargetChange"),this.projectionMatrix=new U,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.gc.addCollection(this,"_gpuRenderTargetHash","hash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:n,mipLevel:s,layer:a}){var o,l;this._renderTargetStack.length=0,this.push(t,e,i,n,s!=null?s:0,a!=null?a:0),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Zv(this.rootRenderTarget),(l=(o=this.adaptor).prerender)==null||l.call(o,this.rootRenderTarget)}postrender(){var t,e;(e=(t=this.adaptor).postrender)==null||e.call(t,this.rootRenderTarget)}bind(t,e=!0,i,n,s=0,a=0){const o=this.getRenderTarget(t),l=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;const u=this.getGpuRenderTarget(o);(o.pixelWidth!==u.width||o.pixelHeight!==u.height)&&(this.adaptor.resizeGpuRenderTarget(o),u.width=o.pixelWidth,u.height=o.pixelHeight);const c=o.colorTexture,h=this.viewport,p=c.arrayLayerCount||1;if((a|0)!==a&&(a|=0),a<0||a>=p)throw new Error(`[RenderTargetSystem] layer ${a} is out of bounds (arrayLayerCount=${p}).`);this.mipLevel=s|0,this.layer=a|0;const f=Math.max(c.pixelWidth>>s,1),m=Math.max(c.pixelHeight>>s,1);if(!n&&t instanceof D&&(n=t.frame),n){const g=c._resolution,_=1<<Math.max(s|0,0),y=n.x*g+.5|0,b=n.y*g+.5|0,x=n.width*g+.5|0,v=n.height*g+.5|0;let w=Math.floor(y/_),T=Math.floor(b/_),E=Math.ceil(x/_),P=Math.ceil(v/_);w=Math.min(Math.max(w,0),f-1),T=Math.min(Math.max(T,0),m-1),E=Math.min(Math.max(E,1),f-w),P=Math.min(Math.max(P,1),m-T),h.x=w,h.y=T,h.width=E,h.height=P}else h.x=0,h.y=0,h.width=f,h.height=m;return qv(this.projectionMatrix,0,0,h.width/c.resolution,h.height/c.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,i,h,s,a),l&&this.onRenderTargetChange.emit(o),o}clear(t,e=Kt.ALL,i,n=this.mipLevel,s=this.layer){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport,n,s))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Kt.ALL,i,n,s=0,a=0){const o=this.bind(t,e,i,n,s,a);return this._renderTargetStack.push({renderTarget:o,frame:n,mipLevel:s,layer:a}),o}pop(){this._renderTargetStack.pop();const t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame,t.mipLevel,t.layer)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),(e=this._renderSurfaceToRenderTargetHash.get(t))!=null?e:this._initRenderTarget(t)}copyToTexture(t,e,i,n,s){i.x<0&&(n.width+=i.x,s.x-=i.x,i.x=0),i.y<0&&(n.height+=i.y,s.y-=i.y,i.y=0);const{pixelWidth:a,pixelHeight:o}=t;return n.width=Math.min(n.width,a-i.x),n.height=Math.min(n.height,o-i.y),this.adaptor.copyToTexture(t,e,i,n,s)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport,0,this.layer))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return fe.test(t)&&(t=ec(t).source),t instanceof Zs?e=t:t instanceof ft&&(e=new Zs({colorTextures:[t]}),t.source instanceof fe&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);const i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}class Qv{init(t,e){this._renderer=t,this._renderTargetSystem=e}initGpuRenderTarget(t){const e=t.colorTexture,{canvas:i,context:n}=this._ensureCanvas(e);return{canvas:i,context:n,width:i.width,height:i.height}}resizeGpuRenderTarget(t){const e=t.colorTexture,{canvas:i}=this._ensureCanvas(e);i.width=t.pixelWidth,i.height=t.pixelHeight}startRenderPass(t,e,i,n){const s=this._renderTargetSystem.getGpuRenderTarget(t);this._renderer.canvasContext.activeContext=s.context,this._renderer.canvasContext.activeResolution=t.resolution,e&&this.clear(t,e,i,n)}clear(t,e,i,n){const s=this._renderTargetSystem.getGpuRenderTarget(t).context,a=n||{x:0,y:0,width:t.pixelWidth,height:t.pixelHeight};if(s.setTransform(1,0,0,1,0,0),s.clearRect(a.x,a.y,a.width,a.height),i){const o=tt.shared.setValue(i);o.alpha>0&&(s.globalAlpha=o.alpha,s.fillStyle=o.toHex(),s.fillRect(a.x,a.y,a.width,a.height),s.globalAlpha=1)}}finishRenderPass(){}copyToTexture(t,e,i,n,s){var a,o;const l=this._renderTargetSystem.getGpuRenderTarget(t).canvas,u=e.source,{context:c}=this._ensureCanvas(u),h=(a=s==null?void 0:s.x)!=null?a:0,p=(o=s==null?void 0:s.y)!=null?o:0;return c.drawImage(l,i.x,i.y,n.width,n.height,h,p,n.width,n.height),u.update(),e}destroyGpuRenderTarget(t){}_ensureCanvas(t){let e=t.resource;(!e||!fe.test(e))&&(e=H.get().createCanvas(t.pixelWidth,t.pixelHeight),t.resource=e),(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(e.width=t.pixelWidth,e.height=t.pixelHeight);const i=e.getContext("2d");return{canvas:e,context:i}}}class nc extends Js{constructor(t){super(t),this.adaptor=new Qv,this.adaptor.init(t,this)}}nc.extension={type:[S.CanvasSystem],name:"renderTarget"};class sc{constructor(t){}init(){}initSource(t){}generateCanvas(t){var e,i;const n=H.get().createCanvas(),s=n.getContext("2d"),a=Q.getCanvasSource(t);if(!a)return n;const o=t.frame,l=(i=(e=t.source._resolution)!=null?e:t.source.resolution)!=null?i:1,u=o.x*l,c=o.y*l,h=o.width*l,p=o.height*l;return n.width=Math.ceil(h),n.height=Math.ceil(p),s.drawImage(a,u,c,h,p,0,0,h,p),n}getPixels(t){const e=this.generateCanvas(t);return{pixels:e.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e.width,e.height).data,width:e.width,height:e.height}}destroy(){}}sc.extension={type:[S.CanvasSystem],name:"texture"};const UO=[...Qs,$u,ku,sc,nc],$O=[Ws,$s,zs,Xs,ks,Du,Bu,Ls],kO=[av,Nu],Jv=[],tx=[],ex=[];N.handleByNamedList(S.CanvasSystem,Jv),N.handleByNamedList(S.CanvasPipes,tx),N.handleByNamedList(S.CanvasPipesAdaptor,ex),N.add(...UO,...$O,...kO);class rx extends Mr{constructor(){const t={name:"canvas",type:It.CANVAS,systems:Jv,renderPipes:tx,renderPipeAdaptors:ex};super(t)}}var LO={__proto__:null,CanvasRenderer:rx},Yi=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Yi||{});class ix{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class ac{constructor(t){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._managedBuffers=new Ut({renderer:t,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(t){return t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]||this.createGLBuffer(t)}bind(t){const{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){const{_gl:i}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(t){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let i=0,n=this._nextBindBaseIndex;for(;i<2;){n>=this._maxBindings&&(n=this._minBaseLocation,i++);const s=this._boundBufferBases[n];if(s&&s._lastBindCallId===this._bindCallId){n++;continue}break}return e=n,this._nextBindBaseIndex=n+1,i>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){const e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,i,n){const{_gl:s}=this;i||(i=0),e||(e=0),this._boundBufferBases[e]=null,s.bindBufferRange(s.UNIFORM_BUFFER,e||0,t.buffer,i*256,n||256)}updateBuffer(t){const{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);const n=t.data,s=t.descriptor.usage&at.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return n?i.byteLength>=n.byteLength?e.bufferSubData(i.type,0,n,0,t._updateSize/n.BYTES_PER_ELEMENT):(i.byteLength=n.byteLength,e.bufferData(i.type,n,s)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,s)),i}destroyAll(t=!1){this._managedBuffers.removeAll(t)}onBufferUnload(t,e=!1){const i=t._gpuData[this._renderer.uid];i&&(e||this._gl.deleteBuffer(i.buffer))}createGLBuffer(t){const{_gl:e}=this;let i=Yi.ARRAY_BUFFER;t.descriptor.usage&at.INDEX?i=Yi.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&at.UNIFORM&&(i=Yi.UNIFORM_BUFFER);const n=new ix(e.createBuffer(),i);return t._gpuData[this._renderer.uid]=n,this._managedBuffers.add(t),n}resetState(){this._boundBufferBases=Object.create(null)}}ac.extension={type:[S.WebGLSystem],name:"buffer"};var NO=Object.defineProperty,XO=Object.defineProperties,jO=Object.getOwnPropertyDescriptors,nx=Object.getOwnPropertySymbols,HO=Object.prototype.hasOwnProperty,zO=Object.prototype.propertyIsEnumerable,sx=(r,t,e)=>t in r?NO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ta=(r,t)=>{for(var e in t||(t={}))HO.call(t,e)&&sx(r,e,t[e]);if(nx)for(var e of nx(t))zO.call(t,e)&&sx(r,e,t[e]);return r},ax=(r,t)=>XO(r,jO(t));const oc=class q1{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,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(t){this.gl=t,this._renderer.gl=t}init(t){var e,i;t=ta(ta({},q1.defaultOptions),t);let n=this.multiView=t.multiView;if(t.context&&n&&(ue("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),n=!1),n?this.canvas=H.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{const s=this._renderer.background.alpha<1,a=(e=t.premultipliedAlpha)!=null?e:!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:s,premultipliedAlpha:a,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:(i=t.powerPreference)!=null?i:"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&ue("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof H.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);const e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let i;const n=this.canvas;if(t===2&&(i=n.getContext("webgl2",e)),!i&&(i=n.getContext("webgl",e),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,this.initFromContext(this.gl)}getExtensions(){const{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions=ax(ta({},e),{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")});else{this.extensions=ax(ta({},e),{colorBufferFloat:t.getExtension("EXT_color_buffer_float")});const i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var e;this.gl.isContextLost()&&((e=this.extensions.loseContext)==null||e.restoreContext())},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){var t;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(t=this.extensions.loseContext)==null||t.loseContext()}forceContextLoss(){var t;(t=this.extensions.loseContext)==null||t.loseContext(),this._contextLossForced=!0}validateContext(t){const e=t.getContextAttributes();e&&e.stencil;const i=this.supports,n=this.webGLVersion===2,s=this.extensions;i.uint32Indices=n||!!s.uint32ElementIndex,i.uniformBufferObject=n,i.vertexArrayObject=n||!!s.vertexArrayObject,i.srgbTextures=n||!!s.srgb,i.nonPowOf2wrapping=n,i.nonPowOf2mipmaps=n,i.msaa=n,i.uint32Indices}};oc.extension={type:[S.WebGLSystem],name:"context"},oc.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let ox=oc;function lc(r,t){var e,i,n;for(const s in r.attributes){const a=r.attributes[s],o=t[s];o?((e=a.format)!=null||(a.format=o.format),(i=a.offset)!=null||(a.offset=o.offset),(n=a.instance)!=null||(a.instance=o.instance)):ue(`Attribute ${s} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}WO(r)}function WO(r){var t,e;const{buffers:i,attributes:n}=r,s={},a={};for(const o in i){const l=i[o];s[l.uid]=0,a[l.uid]=0}for(const o in n){const l=n[o];s[l.buffer.uid]+=Ie(l.format).stride}for(const o in n){const l=n[o];(t=l.stride)!=null||(l.stride=s[l.buffer.uid]),(e=l.start)!=null||(l.start=a[l.buffer.uid]),a[l.buffer.uid]+=Ie(l.format).stride}}var ea=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(ea||{}),ra=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(ra||{}),lx=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(lx||{}),ct=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ct||{});const ux={uint8x2:ct.UNSIGNED_BYTE,uint8x4:ct.UNSIGNED_BYTE,sint8x2:ct.BYTE,sint8x4:ct.BYTE,unorm8x2:ct.UNSIGNED_BYTE,unorm8x4:ct.UNSIGNED_BYTE,snorm8x2:ct.BYTE,snorm8x4:ct.BYTE,uint16x2:ct.UNSIGNED_SHORT,uint16x4:ct.UNSIGNED_SHORT,sint16x2:ct.SHORT,sint16x4:ct.SHORT,unorm16x2:ct.UNSIGNED_SHORT,unorm16x4:ct.UNSIGNED_SHORT,snorm16x2:ct.SHORT,snorm16x4:ct.SHORT,float16x2:ct.HALF_FLOAT,float16x4:ct.HALF_FLOAT,float32:ct.FLOAT,float32x2:ct.FLOAT,float32x3:ct.FLOAT,float32x4:ct.FLOAT,uint32:ct.UNSIGNED_INT,uint32x2:ct.UNSIGNED_INT,uint32x3:ct.UNSIGNED_INT,uint32x4:ct.UNSIGNED_INT,sint32:ct.INT,sint32x2:ct.INT,sint32x3:ct.INT,sint32x4:ct.INT};function cx(r){var t;return(t=ux[r])!=null?t:ux.float32}const VO={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class hx{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class uc{constructor(t){this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new Ut({renderer:t,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const t=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 e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=n=>e.bindVertexArrayOES(n),t.deleteVertexArray=n=>e.deleteVertexArrayOES(n));const i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(n,s,a,o)=>{i.drawArraysInstancedANGLE(n,s,a,o)},t.drawElementsInstanced=(n,s,a,o,l)=>{i.drawElementsInstancedANGLE(n,s,a,o,l)},t.vertexAttribDivisor=(n,s)=>i.vertexAttribDivisorANGLE(n,s)),this._activeGeometry=null,this._activeVao=null}bind(t,e){const i=this.gl;this._activeGeometry=t;const n=this.getVao(t,e);this._activeVao!==n&&(this._activeVao=n,i.bindVertexArray(n)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){const n=t.buffers[i];e.updateBuffer(n)}t._gcLastUsed=this._renderer.gc.now}checkCompatibility(t,e){const i=t.attributes,n=e._attributeData;for(const s in n)if(!i[s])throw new Error(`shader and geometry incompatible, geometry missing the "${s}" attribute`)}getSignature(t,e){const i=t.attributes,n=e._attributeData,s=["g",t.uid];for(const a in i)n[a]&&s.push(a,n[a].location);return s.join("-")}getVao(t,e){var i;return((i=t._gpuData[this._renderer.uid])==null?void 0:i.vaoCache[e._key])||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){const n=this._renderer.gl,s=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);const a=this.getSignature(t,e);let o=t._gpuData[this._renderer.uid];o||(o=new hx,t._gpuData[this._renderer.uid]=o,this._managedGeometries.add(t));const l=o.vaoCache;let u=l[a];if(u)return l[e._key]=u,u;lc(t,e._attributeData);const c=t.buffers;u=n.createVertexArray(),n.bindVertexArray(u);for(let h=0;h<c.length;h++){const p=c[h];s.bind(p)}return this.activateVao(t,e),l[e._key]=u,l[a]=u,n.bindVertexArray(null),u}onGeometryUnload(t,e=!1){const i=t._gpuData[this._renderer.uid];if(!i)return;const n=i.vaoCache;if(!e)for(const s in n)this._activeVao!==n[s]&&this.resetState(),this.gl.deleteVertexArray(n[s])}destroyAll(t=!1){this._managedGeometries.removeAll(t)}activateVao(t,e){var i,n;const s=this._renderer.gl,a=this._renderer.buffer,o=t.attributes;t.indexBuffer&&a.bind(t.indexBuffer);let l=null;for(const u in o){const c=o[u],h=c.buffer,p=a.getGlBuffer(h),f=e._attributeData[u];if(f){l!==p&&(a.bind(h),l=p);const m=f.location;s.enableVertexAttribArray(m);const g=Ie(c.format),_=cx(c.format);if(((i=f.format)==null?void 0:i.substring(1,4))==="int"?s.vertexAttribIPointer(m,g.size,_,c.stride,c.offset):s.vertexAttribPointer(m,g.size,_,g.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const y=(n=c.divisor)!=null?n:1;s.vertexAttribDivisor(m,y)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,n){const{gl:s}=this._renderer,a=this._activeGeometry,o=VO[t||a.topology];if(n!=null||(n=a.instanceCount),a.indexBuffer){const l=a.indexBuffer.data.BYTES_PER_ELEMENT,u=l===2?s.UNSIGNED_SHORT:s.UNSIGNED_INT;n!==1?s.drawElementsInstanced(o,e||a.indexBuffer.data.length,u,(i||0)*l,n):s.drawElements(o,e||a.indexBuffer.data.length,u,(i||0)*l)}else n!==1?s.drawArraysInstanced(o,i||0,e||a.getSize(),n):s.drawArrays(o,i||0,e||a.getSize());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}}uc.extension={type:[S.WebGLSystem],name:"geometry"};var YO=Object.defineProperty,dx=Object.getOwnPropertySymbols,KO=Object.prototype.hasOwnProperty,qO=Object.prototype.propertyIsEnumerable,px=(r,t,e)=>t in r?YO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fx=(r,t)=>{for(var e in t||(t={}))KO.call(t,e)&&px(r,e,t[e]);if(dx)for(var e of dx(t))qO.call(t,e)&&px(r,e,t[e]);return r};const ZO=new nr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),cc=class Z1{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){const{useBackBuffer:e,antialias:i}=fx(fx({},Z1.defaultOptions),t);this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(ue("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Vt.for2d();const n=new Wt({vertex:`
|
|
1798
|
+
attribute vec2 aPosition;
|
|
1799
|
+
out vec2 vUv;
|
|
1800
|
+
|
|
1801
|
+
void main() {
|
|
1802
|
+
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
1803
|
+
|
|
1804
|
+
vUv = (aPosition + 1.0) / 2.0;
|
|
1805
|
+
|
|
1806
|
+
// flip dem UVs
|
|
1807
|
+
vUv.y = 1.0 - vUv.y;
|
|
1808
|
+
}`,fragment:`
|
|
1809
|
+
in vec2 vUv;
|
|
1810
|
+
out vec4 finalColor;
|
|
1811
|
+
|
|
1812
|
+
uniform sampler2D uTexture;
|
|
1813
|
+
|
|
1814
|
+
void main() {
|
|
1815
|
+
finalColor = texture(uTexture, vUv);
|
|
1816
|
+
}`,name:"big-triangle"});this._bigTriangleShader=new ee({glProgram:n,resources:{uTexture:D.WHITE.source}})}renderStart(t){const e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){const i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:ZO,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new D({source:new ft({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};cc.extension={type:[S.WebGLSystem],name:"backBuffer",priority:1},cc.defaultOptions={useBackBuffer:!1};let mx=cc;class hc{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}}hc.extension={type:[S.WebGLSystem],name:"colorMask"};class dc{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){const e=this._renderer,{geometry:i,shader:n,state:s,skipSync:a,topology:o,size:l,start:u,instanceCount:c}=t;e.shader.bind(n,a),e.geometry.bind(i,e.shader._activeProgram),s&&e.state.set(s),e.geometry.draw(o,l,u,c!=null?c:i.instanceCount)}destroy(){this._renderer=null}}dc.extension={type:[S.WebGLSystem],name:"encoder"};class pc{constructor(t){this._renderer=t}contextChange(){const t=this._renderer.gl;this.maxTextures=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=Vo(this.maxTextures,t);const e=this._renderer.context.webGLVersion===2;this.maxUniformBindings=e?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}}pc.extension={type:[S.WebGLSystem],name:"limits"};class gx{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this._attachedMipLevel=0,this._attachedLayer=0,this.msaaRenderBuffer=[]}}const Ue=[];Ue[wt.NONE]=void 0,Ue[wt.DISABLED]={stencilWriteMask:0,stencilReadMask:0},Ue[wt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},Ue[wt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},Ue[wt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},Ue[wt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}};class fc{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:wt.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:wt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=wt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid],n=this._gl,s=Ue[t],a=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===wt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,n.disable(n.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,n.enable(n.STENCIL_TEST)),(t!==a.stencilMode||a.stencilReference!==e)&&(a.stencilMode=t,a.stencilReference=e,n.stencilFunc(this._comparisonFuncMapping[s.stencilBack.compare],e,255),n.stencilOp(n.KEEP,n.KEEP,this._stencilOpsMapping[s.stencilBack.passOp]))}}fc.extension={type:[S.WebGLSystem],name:"stencil"};class mc{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Oo())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const e=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(e.layout.size/4),usage:at.UNIFORM|at.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const e=t._signature;let i=this._syncFunctionHash[e];if(!i){const n=Object.keys(t.uniformStructures).map(o=>t.uniformStructures[o]),s=this._adaptor.createUboElements(n),a=this._generateUboSync(s.uboElements);i=this._syncFunctionHash[e]={layout:s,syncFunction:a}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){const n=this.getUniformGroupData(t);t.buffer||(t.buffer=new Yt({data:new Float32Array(n.layout.size/4),usage:at.UNIFORM|at.COPY_DST}));let s=null;return e||(e=t.buffer.data,s=t.buffer.dataInt32),i||(i=0),n.syncFunction(t.uniforms,e,s,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const gc={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function _x(r){const t=r.map(s=>({data:s,offset:0,size:0})),e=16;let i=0,n=0;for(let s=0;s<t.length;s++){const a=t[s];if(i=gc[a.data.type],!i)throw new Error(`Unknown type ${a.data.type}`);a.data.size>1&&(i=Math.max(i,e)*a.data.size);const o=i===12?16:i;a.size=i;const l=n%e;l>0&&e-l<o?n+=(e-l)%16:n+=(i-l%i)%i,a.offset=n,n+=i}return n=Math.ceil(n/16)*16,{uboElements:t,size:n}}const We=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
|
|
1817
|
+
var matrix = uv[name].toArray(true);
|
|
1818
|
+
data[offset] = matrix[0];
|
|
1819
|
+
data[offset + 1] = matrix[1];
|
|
1820
|
+
data[offset + 2] = matrix[2];
|
|
1821
|
+
data[offset + 4] = matrix[3];
|
|
1822
|
+
data[offset + 5] = matrix[4];
|
|
1823
|
+
data[offset + 6] = matrix[5];
|
|
1824
|
+
data[offset + 8] = matrix[6];
|
|
1825
|
+
data[offset + 9] = matrix[7];
|
|
1826
|
+
data[offset + 10] = matrix[8];
|
|
1827
|
+
`,uniform:`
|
|
1828
|
+
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
|
|
1829
|
+
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.width!==void 0,ubo:`
|
|
1830
|
+
v = uv[name];
|
|
1831
|
+
data[offset] = v.x;
|
|
1832
|
+
data[offset + 1] = v.y;
|
|
1833
|
+
data[offset + 2] = v.width;
|
|
1834
|
+
data[offset + 3] = v.height;
|
|
1835
|
+
`,uniform:`
|
|
1836
|
+
cv = ud[name].value;
|
|
1837
|
+
v = uv[name];
|
|
1838
|
+
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
|
|
1839
|
+
cv[0] = v.x;
|
|
1840
|
+
cv[1] = v.y;
|
|
1841
|
+
cv[2] = v.width;
|
|
1842
|
+
cv[3] = v.height;
|
|
1843
|
+
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
|
|
1844
|
+
}
|
|
1845
|
+
`},{type:"vec2<f32>",test:r=>r.type==="vec2<f32>"&&r.size===1&&r.value.x!==void 0,ubo:`
|
|
1846
|
+
v = uv[name];
|
|
1847
|
+
data[offset] = v.x;
|
|
1848
|
+
data[offset + 1] = v.y;
|
|
1849
|
+
`,uniform:`
|
|
1850
|
+
cv = ud[name].value;
|
|
1851
|
+
v = uv[name];
|
|
1852
|
+
if (cv[0] !== v.x || cv[1] !== v.y) {
|
|
1853
|
+
cv[0] = v.x;
|
|
1854
|
+
cv[1] = v.y;
|
|
1855
|
+
gl.uniform2f(ud[name].location, v.x, v.y);
|
|
1856
|
+
}
|
|
1857
|
+
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
|
|
1858
|
+
v = uv[name];
|
|
1859
|
+
data[offset] = v.red;
|
|
1860
|
+
data[offset + 1] = v.green;
|
|
1861
|
+
data[offset + 2] = v.blue;
|
|
1862
|
+
data[offset + 3] = v.alpha;
|
|
1863
|
+
`,uniform:`
|
|
1864
|
+
cv = ud[name].value;
|
|
1865
|
+
v = uv[name];
|
|
1866
|
+
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
|
|
1867
|
+
cv[0] = v.red;
|
|
1868
|
+
cv[1] = v.green;
|
|
1869
|
+
cv[2] = v.blue;
|
|
1870
|
+
cv[3] = v.alpha;
|
|
1871
|
+
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
|
|
1872
|
+
}
|
|
1873
|
+
`},{type:"vec3<f32>",test:r=>r.type==="vec3<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
|
|
1874
|
+
v = uv[name];
|
|
1875
|
+
data[offset] = v.red;
|
|
1876
|
+
data[offset + 1] = v.green;
|
|
1877
|
+
data[offset + 2] = v.blue;
|
|
1878
|
+
`,uniform:`
|
|
1879
|
+
cv = ud[name].value;
|
|
1880
|
+
v = uv[name];
|
|
1881
|
+
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
|
|
1882
|
+
cv[0] = v.red;
|
|
1883
|
+
cv[1] = v.green;
|
|
1884
|
+
cv[2] = v.blue;
|
|
1885
|
+
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
|
|
1886
|
+
}
|
|
1887
|
+
`}];function _c(r,t,e,i){const n=[`
|
|
1888
|
+
var v = null;
|
|
1889
|
+
var v2 = null;
|
|
1890
|
+
var t = 0;
|
|
1891
|
+
var index = 0;
|
|
1892
|
+
var name = null;
|
|
1893
|
+
var arrayOffset = null;
|
|
1894
|
+
`];let s=0;for(let o=0;o<r.length;o++){const l=r[o],u=l.data.name;let c=!1,h=0;for(let p=0;p<We.length;p++)if(We[p].test(l.data)){h=l.offset/4,n.push(`name = "${u}";`,`offset += ${h-s};`,We[p][t]||We[p].ubo),c=!0;break}if(!c)if(l.data.size>1)h=l.offset/4,n.push(e(l,h-s));else{const p=i[l.data.type];h=l.offset/4,n.push(`
|
|
1895
|
+
v = uv.${u};
|
|
1896
|
+
offset += ${h-s};
|
|
1897
|
+
${p};
|
|
1898
|
+
`)}s=h}const a=n.join(`
|
|
1899
|
+
`);return new Function("uv","data","dataInt32","offset",a)}var QO=Object.defineProperty,JO=Object.defineProperties,t3=Object.getOwnPropertyDescriptors,yx=Object.getOwnPropertySymbols,e3=Object.prototype.hasOwnProperty,r3=Object.prototype.propertyIsEnumerable,bx=(r,t,e)=>t in r?QO(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,i3=(r,t)=>{for(var e in t||(t={}))e3.call(t,e)&&bx(r,e,t[e]);if(yx)for(var e of yx(t))r3.call(t,e)&&bx(r,e,t[e]);return r},n3=(r,t)=>JO(r,t3(t));function ti(r,t){return`
|
|
1900
|
+
for (let i = 0; i < ${r*t}; i++) {
|
|
1901
|
+
data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i];
|
|
1902
|
+
}
|
|
1903
|
+
`}const yc={f32:`
|
|
1904
|
+
data[offset] = v;`,i32:`
|
|
1905
|
+
dataInt32[offset] = v;`,"vec2<f32>":`
|
|
1906
|
+
data[offset] = v[0];
|
|
1907
|
+
data[offset + 1] = v[1];`,"vec3<f32>":`
|
|
1908
|
+
data[offset] = v[0];
|
|
1909
|
+
data[offset + 1] = v[1];
|
|
1910
|
+
data[offset + 2] = v[2];`,"vec4<f32>":`
|
|
1911
|
+
data[offset] = v[0];
|
|
1912
|
+
data[offset + 1] = v[1];
|
|
1913
|
+
data[offset + 2] = v[2];
|
|
1914
|
+
data[offset + 3] = v[3];`,"vec2<i32>":`
|
|
1915
|
+
dataInt32[offset] = v[0];
|
|
1916
|
+
dataInt32[offset + 1] = v[1];`,"vec3<i32>":`
|
|
1917
|
+
dataInt32[offset] = v[0];
|
|
1918
|
+
dataInt32[offset + 1] = v[1];
|
|
1919
|
+
dataInt32[offset + 2] = v[2];`,"vec4<i32>":`
|
|
1920
|
+
dataInt32[offset] = v[0];
|
|
1921
|
+
dataInt32[offset + 1] = v[1];
|
|
1922
|
+
dataInt32[offset + 2] = v[2];
|
|
1923
|
+
dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":`
|
|
1924
|
+
data[offset] = v[0];
|
|
1925
|
+
data[offset + 1] = v[1];
|
|
1926
|
+
data[offset + 4] = v[2];
|
|
1927
|
+
data[offset + 5] = v[3];`,"mat3x3<f32>":`
|
|
1928
|
+
data[offset] = v[0];
|
|
1929
|
+
data[offset + 1] = v[1];
|
|
1930
|
+
data[offset + 2] = v[2];
|
|
1931
|
+
data[offset + 4] = v[3];
|
|
1932
|
+
data[offset + 5] = v[4];
|
|
1933
|
+
data[offset + 6] = v[5];
|
|
1934
|
+
data[offset + 8] = v[6];
|
|
1935
|
+
data[offset + 9] = v[7];
|
|
1936
|
+
data[offset + 10] = v[8];`,"mat4x4<f32>":`
|
|
1937
|
+
for (let i = 0; i < 16; i++) {
|
|
1938
|
+
data[offset + i] = v[i];
|
|
1939
|
+
}`,"mat3x2<f32>":ti(3,2),"mat4x2<f32>":ti(4,2),"mat2x3<f32>":ti(2,3),"mat4x3<f32>":ti(4,3),"mat2x4<f32>":ti(2,4),"mat3x4<f32>":ti(3,4)},vx=n3(i3({},yc),{"mat2x2<f32>":`
|
|
1940
|
+
data[offset] = v[0];
|
|
1941
|
+
data[offset + 1] = v[1];
|
|
1942
|
+
data[offset + 2] = v[2];
|
|
1943
|
+
data[offset + 3] = v[3];
|
|
1944
|
+
`});function xx(r,t){const e=Math.max(gc[r.data.type]/16,1),i=r.data.value.length/r.data.size,n=(4-i%4)%4,s=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
1945
|
+
v = uv.${r.data.name};
|
|
1946
|
+
offset += ${t};
|
|
1947
|
+
|
|
1948
|
+
arrayOffset = offset;
|
|
1949
|
+
|
|
1950
|
+
t = 0;
|
|
1951
|
+
|
|
1952
|
+
for(var i=0; i < ${r.data.size*e}; i++)
|
|
1953
|
+
{
|
|
1954
|
+
for(var j = 0; j < ${i}; j++)
|
|
1955
|
+
{
|
|
1956
|
+
${s}[arrayOffset++] = v[t++];
|
|
1957
|
+
}
|
|
1958
|
+
${n!==0?`arrayOffset += ${n};`:""}
|
|
1959
|
+
}
|
|
1960
|
+
`}function Tx(r){return _c(r,"uboStd40",xx,yc)}class bc extends mc{constructor(){super({createUboElements:_x,generateUboSync:Tx})}}bc.extension={type:[S.WebGLSystem],name:"ubo"};class Sx{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ut}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new ut;const t=this._renderer.gl;this._drawBuffersCache=[];for(let e=1;e<=16;e++)this._drawBuffersCache[e]=Array.from({length:e},(i,n)=>t.COLOR_ATTACHMENT0+n)}copyToTexture(t,e,i,n,s){const a=this._renderTargetSystem,o=this._renderer,l=a.getGpuRenderTarget(t),u=o.gl;return this.finishRenderPass(t),u.bindFramebuffer(u.FRAMEBUFFER,l.resolveTargetFramebuffer),o.texture.bind(e,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,s.x,s.y,i.x,i.y,n.width,n.height),e}startRenderPass(t,e=!0,i,n,s=0,a=0){const o=this._renderTargetSystem,l=t.colorTexture,u=o.getGpuRenderTarget(t);if(a!==0&&this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to array layers requires WebGL2.");if(s>0){if(u.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.")}let c=n.y;t.isRoot&&(c=l.pixelHeight-n.height-n.y),t.colorTextures.forEach(f=>{this._renderer.texture.unbind(f)});const h=this._renderer.gl;h.bindFramebuffer(h.FRAMEBUFFER,u.framebuffer),!t.isRoot&&(u._attachedMipLevel!==s||u._attachedLayer!==a)&&(t.colorTextures.forEach((f,m)=>{const g=this._renderer.texture.getGlSource(f);if(g.target===h.TEXTURE_2D){if(a!==0)throw new Error("[RenderTargetSystem] layer must be 0 when rendering to 2D textures in WebGL.");h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0+m,h.TEXTURE_2D,g.texture,s)}else if(g.target===h.TEXTURE_2D_ARRAY){if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to 2D array textures requires WebGL2.");h.framebufferTextureLayer(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0+m,g.texture,s,a)}else if(g.target===h.TEXTURE_CUBE_MAP){if(a<0||a>5)throw new Error("[RenderTargetSystem] Cube map layer must be between 0 and 5.");h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0+m,h.TEXTURE_CUBE_MAP_POSITIVE_X+a,g.texture,s)}else throw new Error("[RenderTargetSystem] Unsupported texture target for render-to-layer in WebGL.")}),u._attachedMipLevel=s,u._attachedLayer=a),t.colorTextures.length>1&&this._setDrawBuffers(t,h);const p=this._viewPortCache;(p.x!==n.x||p.y!==c||p.width!==n.width||p.height!==n.height)&&(p.x=n.x,p.y=c,p.width=n.width,p.height=n.height,h.viewport(n.x,c,n.width,n.height)),!u.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(u),this.clear(t,e,i)}finishRenderPass(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;const i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,e.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,e.framebuffer),i.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){const e=this._renderer.gl,i=new gx;return i._attachedMipLevel=0,i._attachedLayer=0,t.colorTexture instanceof fe?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),i.framebuffer=null,i):(this._initColor(t,i),e.bindFramebuffer(e.FRAMEBUFFER,null),i)}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i,n,s=0,a=0){if(!e)return;if(a!==0)throw new Error("[RenderTargetSystem] Clearing array layers is not supported in WebGL renderer.");const o=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Kt.ALL:Kt.NONE);const l=this._renderer.gl;if(e&Kt.COLOR){i!=null||(i=o.defaultClearColor);const u=this._clearColorCache,c=i;(u[0]!==c[0]||u[1]!==c[1]||u[2]!==c[2]||u[3]!==c[3])&&(u[0]=c[0],u[1]=c[1],u[2]=c[2],u[3]=c[3],l.clearColor(c[0],c[1],c[2],c[3]))}l.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;const e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const i=this._renderer,n=i.gl,s=n.createFramebuffer();if(e.resolveTargetFramebuffer=s,n.bindFramebuffer(n.FRAMEBUFFER,s),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((a,o)=>{const l=a.source;l.antialias&&(i.context.supports.msaa?e.msaa=!0:ue("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);const u=i.texture.getGlSource(l),c=u.texture;if(u.target===n.TEXTURE_2D)n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.TEXTURE_2D,c,0);else if(u.target===n.TEXTURE_2D_ARRAY){if(i.context.webGLVersion<2)throw new Error("[RenderTargetSystem] TEXTURE_2D_ARRAY requires WebGL2.");n.framebufferTextureLayer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,c,0,0)}else if(u.target===n.TEXTURE_CUBE_MAP)n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.TEXTURE_CUBE_MAP_POSITIVE_X,c,0);else throw new Error("[RenderTargetSystem] Unsupported texture target for framebuffer attachment.")}),e.msaa){const a=n.createFramebuffer();e.framebuffer=a,n.bindFramebuffer(n.FRAMEBUFFER,a),t.colorTextures.forEach((o,l)=>{const u=n.createRenderbuffer();e.msaaRenderBuffer[l]=u})}else e.framebuffer=s;this._resizeColor(t,e)}_resizeColor(t,e){const i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,e._attachedMipLevel=0,e._attachedLayer=0,t.colorTextures.forEach((n,s)=>{s!==0&&n.source.resize(i.width,i.height,i._resolution)}),e.msaa){const n=this._renderer,s=n.gl,a=e.framebuffer;s.bindFramebuffer(s.FRAMEBUFFER,a),t.colorTextures.forEach((o,l)=>{const u=o.source;n.texture.bindSource(u,0);const c=n.texture.getGlSource(u).internalFormat,h=e.msaaRenderBuffer[l];s.bindRenderbuffer(s.RENDERBUFFER,h),s.renderbufferStorageMultisample(s.RENDERBUFFER,4,c,u.pixelWidth,u.pixelHeight),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+l,s.RENDERBUFFER,h)})}}_initStencil(t){if(t.framebuffer===null)return;const e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){const e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){const e=t.colorTexture.resource;this._renderer.context.multiView&&fe.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&fe.test(t.colorTexture.resource)){const e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}_setDrawBuffers(t,e){const i=t.colorTextures.length,n=this._drawBuffersCache[i];if(this._renderer.context.webGLVersion===1){const s=this._renderer.context.extensions.drawBuffers;s?s.drawBuffersWEBGL(n):ue("[RenderTexture] This WebGL1 context does not support rendering to multiple targets")}else e.drawBuffers(n)}}class vc extends Js{constructor(t){super(t),this.adaptor=new Sx,this.adaptor.init(t,this)}}vc.extension={type:[S.WebGLSystem],name:"renderTarget"};class ia extends Nt{constructor({buffer:t,offset:e,size:i}){super(),this.uid=ht("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ht("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ht("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}function wx(r,t){const e=[],i=[`
|
|
1961
|
+
var g = s.groups;
|
|
1962
|
+
var sS = r.shader;
|
|
1963
|
+
var p = s.glProgram;
|
|
1964
|
+
var ugS = r.uniformGroup;
|
|
1965
|
+
var resources;
|
|
1966
|
+
`];let n=!1,s=0;const a=t._getProgramData(r.glProgram);for(const l in r.groups){const u=r.groups[l];e.push(`
|
|
1967
|
+
resources = g[${l}].resources;
|
|
1968
|
+
`);for(const c in u.resources){const h=u.resources[c];if(h instanceof At)if(h.ubo){const p=r._uniformBindMap[l][Number(c)];e.push(`
|
|
1969
|
+
sS.bindUniformBlock(
|
|
1970
|
+
resources[${c}],
|
|
1971
|
+
'${p}',
|
|
1972
|
+
${r.glProgram._uniformBlockData[p].index}
|
|
1973
|
+
);
|
|
1974
|
+
`)}else e.push(`
|
|
1975
|
+
ugS.updateUniformGroup(resources[${c}], p, sD);
|
|
1976
|
+
`);else if(h instanceof ia){const p=r._uniformBindMap[l][Number(c)];e.push(`
|
|
1977
|
+
sS.bindUniformBlock(
|
|
1978
|
+
resources[${c}],
|
|
1979
|
+
'${p}',
|
|
1980
|
+
${r.glProgram._uniformBlockData[p].index}
|
|
1981
|
+
);
|
|
1982
|
+
`)}else if(h instanceof ft){const p=r._uniformBindMap[l][c],f=a.uniformData[p];f&&(n||(n=!0,i.push(`
|
|
1983
|
+
var tS = r.texture;
|
|
1984
|
+
`)),t._gl.uniform1i(f.location,s),e.push(`
|
|
1985
|
+
tS.bind(resources[${c}], ${s});
|
|
1986
|
+
`),s++)}}}const o=[...i,...e].join(`
|
|
1987
|
+
`);return new Function("r","s","sD",o)}class s3{}class Ex{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function xc(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function Tc(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Sc(r,t){switch(r){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;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 Tc(2*t);case"bvec3":return Tc(3*t);case"bvec4":return Tc(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 na=null;const Px={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_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},a3={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 wc(r,t){if(!na){const e=Object.keys(Px);na={};for(let i=0;i<e.length;++i){const n=e[i];na[r[n]]=Px[n]}}return na[t]}function Ax(r,t){const e=wc(r,t);return a3[e]||"float32"}function Cx(r,t,e=!1){const i={},n=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let a=0;a<n;a++){const o=t.getActiveAttrib(r,a);if(o.name.startsWith("gl_"))continue;const l=Ax(t,o.type);i[o.name]={location:0,format:l,stride:Ie(l).stride,offset:0,instance:!1,start:0}}const s=Object.keys(i);if(e){s.sort((a,o)=>a>o?1:-1);for(let a=0;a<s.length;a++)i[s[a]].location=a,t.bindAttribLocation(r,a,s[a]);t.linkProgram(r)}else for(let a=0;a<s.length;a++)i[s[a]].location=t.getAttribLocation(r,s[a]);return i}function Mx(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let n=0;n<i;n++){const s=t.getActiveUniformBlockName(r,n),a=t.getUniformBlockIndex(r,s),o=t.getActiveUniformBlockParameter(r,n,t.UNIFORM_BLOCK_DATA_SIZE);e[s]={name:s,index:a,size:o}}return e}function Rx(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let n=0;n<i;n++){const s=t.getActiveUniform(r,n),a=s.name.replace(/\[.*?\]$/,""),o=!!s.name.match(/\[.*?\]$/),l=wc(t,s.type);e[a]={name:a,index:n,type:l,size:s.size,isArray:o,value:Sc(l,s.size)}}return e}function Ox(r,t){var e;const i=r.getShaderSource(t);if(i===null){console.error("PixiJS Error: Could not retrieve shader source (WebGL context may be lost).");return}const n=i.split(`
|
|
1988
|
+
`).map((h,p)=>`${p}: ${h}`),s=(e=r.getShaderInfoLog(t))!=null?e:"",a=s.split(`
|
|
1989
|
+
`),o={},l=a.map(h=>parseFloat(h.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(h=>h&&!o[h]?(o[h]=!0,!0):!1),u=[""];l.forEach(h=>{n[h-1]=`%c${n[h-1]}%c`,u.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const c=n.join(`
|
|
1990
|
+
`);u[0]=c,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...u),console.groupEnd()}function Gx(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Ox(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||Ox(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function Ix(r,t){const e=xc(r,r.VERTEX_SHADER,t.vertex),i=xc(r,r.FRAGMENT_SHADER,t.fragment),n=r.createProgram();r.attachShader(n,e),r.attachShader(n,i);const s=t.transformFeedbackVaryings;s&&(typeof r.transformFeedbackVaryings!="function"||r.transformFeedbackVaryings(n,s.names,s.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(n),r.getProgramParameter(n,r.LINK_STATUS)||Gx(r,n,e,i),t._attributeData=Cx(n,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=Rx(n,r),t._uniformBlockData=Mx(n,r),r.deleteShader(e),r.deleteShader(i);const a={};for(const o in t._uniformData){const l=t._uniformData[o];a[o]={location:r.getUniformLocation(n,o),value:Sc(l.type,l.size)}}return new Ex(n,a)}const sa={textureCount:0,blockIndex:0};class Ec{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(t,e){if(this._setProgram(t.glProgram),e)return;sa.textureCount=0,sa.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),i(this._renderer,t,sa)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,sa)}bindUniformBlock(t,e,i=0){const n=this._renderer.buffer,s=this._getProgramData(this._activeProgram),a=t._bufferResource;a||this._renderer.ubo.updateUniformGroup(t);const o=t.buffer,l=n.updateBuffer(o),u=n.freeLocationForBufferBase(l);if(a){const{offset:h,size:p}=t;h===0&&p===o.data.byteLength?n.bindBufferBase(l,u):n.bindBufferRange(l,u,h)}else n.getLastBindBaseLocation(l)!==u&&n.bindBufferBase(l,u);const c=this._activeProgram._uniformBlockData[e].index;s.uniformBlockBindings[i]!==u&&(s.uniformBlockBindings[i]=u,this._renderer.gl.uniformBlockBinding(s.program,c,u))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;const e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){const e=t._key;return this._programDataHash[e]=Ix(this._gl,t),this._programDataHash[e]}destroy(){for(const t of Object.keys(this._programDataHash))this._programDataHash[t].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(t,e){return wx(t,e)}resetState(){this._activeProgram=null}}Ec.extension={type:[S.WebGLSystem],name:"shader"};const Bx={f32:`if (cv !== v) {
|
|
1991
|
+
cu.value = v;
|
|
1992
|
+
gl.uniform1f(location, v);
|
|
1993
|
+
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
1994
|
+
cv[0] = v[0];
|
|
1995
|
+
cv[1] = v[1];
|
|
1996
|
+
gl.uniform2f(location, v[0], v[1]);
|
|
1997
|
+
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
1998
|
+
cv[0] = v[0];
|
|
1999
|
+
cv[1] = v[1];
|
|
2000
|
+
cv[2] = v[2];
|
|
2001
|
+
gl.uniform3f(location, v[0], v[1], v[2]);
|
|
2002
|
+
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2003
|
+
cv[0] = v[0];
|
|
2004
|
+
cv[1] = v[1];
|
|
2005
|
+
cv[2] = v[2];
|
|
2006
|
+
cv[3] = v[3];
|
|
2007
|
+
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
2008
|
+
}`,i32:`if (cv !== v) {
|
|
2009
|
+
cu.value = v;
|
|
2010
|
+
gl.uniform1i(location, v);
|
|
2011
|
+
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
2012
|
+
cv[0] = v[0];
|
|
2013
|
+
cv[1] = v[1];
|
|
2014
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
2015
|
+
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
2016
|
+
cv[0] = v[0];
|
|
2017
|
+
cv[1] = v[1];
|
|
2018
|
+
cv[2] = v[2];
|
|
2019
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
2020
|
+
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2021
|
+
cv[0] = v[0];
|
|
2022
|
+
cv[1] = v[1];
|
|
2023
|
+
cv[2] = v[2];
|
|
2024
|
+
cv[3] = v[3];
|
|
2025
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
2026
|
+
}`,u32:`if (cv !== v) {
|
|
2027
|
+
cu.value = v;
|
|
2028
|
+
gl.uniform1ui(location, v);
|
|
2029
|
+
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
2030
|
+
cv[0] = v[0];
|
|
2031
|
+
cv[1] = v[1];
|
|
2032
|
+
gl.uniform2ui(location, v[0], v[1]);
|
|
2033
|
+
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
2034
|
+
cv[0] = v[0];
|
|
2035
|
+
cv[1] = v[1];
|
|
2036
|
+
cv[2] = v[2];
|
|
2037
|
+
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
2038
|
+
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2039
|
+
cv[0] = v[0];
|
|
2040
|
+
cv[1] = v[1];
|
|
2041
|
+
cv[2] = v[2];
|
|
2042
|
+
cv[3] = v[3];
|
|
2043
|
+
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
2044
|
+
}`,bool:`if (cv !== v) {
|
|
2045
|
+
cu.value = v;
|
|
2046
|
+
gl.uniform1i(location, v);
|
|
2047
|
+
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
|
|
2048
|
+
cv[0] = v[0];
|
|
2049
|
+
cv[1] = v[1];
|
|
2050
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
2051
|
+
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
|
|
2052
|
+
cv[0] = v[0];
|
|
2053
|
+
cv[1] = v[1];
|
|
2054
|
+
cv[2] = v[2];
|
|
2055
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
2056
|
+
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
|
|
2057
|
+
cv[0] = v[0];
|
|
2058
|
+
cv[1] = v[1];
|
|
2059
|
+
cv[2] = v[2];
|
|
2060
|
+
cv[3] = v[3];
|
|
2061
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
2062
|
+
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},Fx={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 Dx(r,t){const e=[`
|
|
2063
|
+
var v = null;
|
|
2064
|
+
var cv = null;
|
|
2065
|
+
var cu = null;
|
|
2066
|
+
var t = 0;
|
|
2067
|
+
var gl = renderer.gl;
|
|
2068
|
+
var name = null;
|
|
2069
|
+
`];for(const i in r.uniforms){if(!t[i]){r.uniforms[i]instanceof At?r.uniforms[i].ubo?e.push(`
|
|
2070
|
+
renderer.shader.bindUniformBlock(uv.${i}, "${i}");
|
|
2071
|
+
`):e.push(`
|
|
2072
|
+
renderer.shader.updateUniformGroup(uv.${i});
|
|
2073
|
+
`):r.uniforms[i]instanceof ia&&e.push(`
|
|
2074
|
+
renderer.shader.bindBufferResource(uv.${i}, "${i}");
|
|
2075
|
+
`);continue}const n=r.uniformStructures[i];let s=!1;for(let a=0;a<We.length;a++){const o=We[a];if(n.type===o.type&&o.test(n)){e.push(`name = "${i}";`,We[a].uniform),s=!0;break}}if(!s){const a=(n.size===1?Bx:Fx)[n.type].replace("location",`ud["${i}"].location`);e.push(`
|
|
2076
|
+
cu = ud["${i}"];
|
|
2077
|
+
cv = cu.value;
|
|
2078
|
+
v = uv["${i}"];
|
|
2079
|
+
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
|
|
2080
|
+
`))}class Pc{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){const n=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==n.uniformDirtyGroups[t.uid])&&(n.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(n.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){var i;return((i=this._uniformGroupSyncHash[t._signature])==null?void 0:i[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),n=this._getSignature(t,e._uniformData,"u");return this._cache[n]||(this._cache[n]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[n],i[e._key]}_generateUniformsSync(t,e){return Dx(t,e)}_getSignature(t,e,i){const n=t.uniforms,s=[`${i}-`];for(const a in n)s.push(a),e[a]&&s.push(e[a].type);return s.join("-")}destroy(){this._renderer=null,this._cache=null}}Pc.extension={type:[S.WebGLSystem],name:"uniformGroup"};function o3(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
|
|
2081
|
+
out vec4 finalColor;
|
|
2082
|
+
${r}
|
|
2083
|
+
`,r}const l3={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 u3(r){return l3[r]}function Ux(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof H.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const c3=0,h3=1,d3=2,p3=3,f3=4,m3=5,$x=class Rh{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[c3]=this.setBlend,this.map[h3]=this.setOffset,this.map[d3]=this.setCullFace,this.map[p3]=this.setDepthTest,this.map[f3]=this.setFrontFace,this.map[m3]=this.setDepthMask,this.checks=[],this.defaultState=Vt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=Ux(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e>>=1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Rh._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Rh._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;const e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}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(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};$x.extension={type:[S.WebGLSystem],name:"state"};let kx=$x;class Ac{constructor(t){this.target=ra.TEXTURE_2D,this._layerInitMask=0,this.texture=t,this.width=-1,this.height=-1,this.type=ct.UNSIGNED_BYTE,this.internalFormat=ea.RGBA,this.format=ea.RGBA,this.samplerType=0}destroy(){}}const Lx={id:"buffer",upload(r,t,e,i,n,s=!1){const a=n||t.target;!s&&t.width===r.width&&t.height===r.height?e.texSubImage2D(a,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(a,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},g3={"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},Nx={id:"compressed",upload(r,t,e,i,n,s){const a=n!=null?n:t.target;e.pixelStorei(e.UNPACK_ALIGNMENT,4);let o=r.pixelWidth,l=r.pixelHeight;const u=!!g3[r.format];for(let c=0;c<r.resource.length;c++){const h=r.resource[c];u?e.compressedTexImage2D(a,c,t.internalFormat,o,l,0,h):e.texImage2D(a,c,t.internalFormat,o,l,0,t.format,t.type,h),o=Math.max(o>>1,1),l=Math.max(l>>1,1)}}},Xx=["right","left","top","bottom","front","back"];function jx(r){return{id:"cube",upload(t,e,i,n){const s=t.faces;for(let a=0;a<Xx.length;a++){const o=Xx[a],l=s[o];(r[l.uploadMethodId]||r.image).upload(l,e,i,n,ra.TEXTURE_CUBE_MAP_POSITIVE_X+a,(e._layerInitMask&1<<a)===0),e._layerInitMask|=1<<a}e.width=t.pixelWidth,e.height=t.pixelHeight}}}const Cc={id:"image",upload(r,t,e,i,n,s=!1){const a=n||t.target,o=r.pixelWidth,l=r.pixelHeight,u=r.resourceWidth,c=r.resourceHeight,h=i===2,p=s||t.width!==o||t.height!==l,f=u>=o&&c>=l,m=r.resource;(h?_3:y3)(e,a,t,o,l,u,c,m,p,f),t.width=o,t.height=l}};function _3(r,t,e,i,n,s,a,o,l,u){if(!u){l&&r.texImage2D(t,0,e.internalFormat,i,n,0,e.format,e.type,null),r.texSubImage2D(t,0,0,0,s,a,e.format,e.type,o);return}if(!l){r.texSubImage2D(t,0,0,0,e.format,e.type,o);return}r.texImage2D(t,0,e.internalFormat,i,n,0,e.format,e.type,o)}function y3(r,t,e,i,n,s,a,o,l,u){if(!u){l&&r.texImage2D(t,0,e.internalFormat,i,n,0,e.format,e.type,null),r.texSubImage2D(t,0,0,0,e.format,e.type,o);return}if(!l){r.texSubImage2D(t,0,0,0,e.format,e.type,o);return}r.texImage2D(t,0,e.internalFormat,e.format,e.type,o)}const b3=Cu(),Hx={id:"video",upload(r,t,e,i,n,s=b3){if(!r.isValid){const a=n!=null?n:t.target;e.texImage2D(a,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Cc.upload(r,t,e,i,n,s)}},Mc={linear:9729,nearest:9728},zx={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},aa={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Wx={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function Rc(r,t,e,i,n,s,a,o){const l=s;if(!o||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const u=aa[a?"clamp-to-edge":r.addressModeU],c=aa[a?"clamp-to-edge":r.addressModeV],h=aa[a?"clamp-to-edge":r.addressModeW];t[n](l,t.TEXTURE_WRAP_S,u),t[n](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[n](l,t.TEXTURE_WRAP_R,h)}if((!o||r.magFilter!=="linear")&&t[n](l,t.TEXTURE_MAG_FILTER,Mc[r.magFilter]),e){if(!o||r.mipmapFilter!=="linear"){const u=zx[r.minFilter][r.mipmapFilter];t[n](l,t.TEXTURE_MIN_FILTER,u)}}else t[n](l,t.TEXTURE_MIN_FILTER,Mc[r.minFilter]);if(i&&r.maxAnisotropy>1){const u=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[n](l,i.TEXTURE_MAX_ANISOTROPY_EXT,u)}r.compare&&t[n](l,t.TEXTURE_COMPARE_FUNC,Wx[r.compare])}function Vx(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var v3=Object.defineProperty,x3=Object.defineProperties,T3=Object.getOwnPropertyDescriptors,Yx=Object.getOwnPropertySymbols,S3=Object.prototype.hasOwnProperty,w3=Object.prototype.propertyIsEnumerable,Kx=(r,t,e)=>t in r?v3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mr=(r,t)=>{for(var e in t||(t={}))S3.call(t,e)&&Kx(r,e,t[e]);if(Yx)for(var e of Yx(t))w3.call(t,e)&&Kx(r,e,t[e]);return r},E3=(r,t)=>x3(r,T3(t));function qx(r,t){let e={},i=r.RGBA;return r instanceof H.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),mr(mr(mr(mr(mr(mr(E3(mr({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.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(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function Qx(r){return{"2d":r.TEXTURE_2D,cube:r.TEXTURE_CUBE_MAP,"1d":null,"3d":(r==null?void 0:r.TEXTURE_3D)||null,"2d-array":(r==null?void 0:r.TEXTURE_2D_ARRAY)||null,"cube-array":(r==null?void 0:r.TEXTURE_CUBE_MAP_ARRAY)||null}}function P3(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const i=r[e+3];if(i!==0){const n=255.001/i;r[e]=r[e]*n+.5,r[e+1]=r[e+1]*n+.5,r[e+2]=r[e+2]*n+.5}}}var A3=Object.defineProperty,C3=Object.defineProperties,M3=Object.getOwnPropertyDescriptors,Jx=Object.getOwnPropertySymbols,R3=Object.prototype.hasOwnProperty,O3=Object.prototype.propertyIsEnumerable,t0=(r,t,e)=>t in r?A3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,e0=(r,t)=>{for(var e in t||(t={}))R3.call(t,e)&&t0(r,e,t[e]);if(Jx)for(var e of Jx(t))O3.call(t,e)&&t0(r,e,t[e]);return r},G3=(r,t)=>C3(r,M3(t));const I3=4,Oc=class Q1{constructor(t){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._managedTextures=new Ut({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});const e=e0({image:Cc,buffer:Lx,video:Hx,compressed:Nx},Q1.uploadExtensions);this._uploads=G3(e0({},e),{cube:jx(e)})}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=qx(t,this._renderer.context.extensions),this._mapFormatToType=Zx(t),this._mapFormatToFormat=Vx(t),this._mapViewDimensionToGlTarget=Qx(t)),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(D.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const i=this._gl;if(t._gcLastUsed=this._renderer.gc.now,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=D.EMPTY.source);const n=this.getGlSource(t);i.bindTexture(n.target,n.texture)}}_bindSampler(t,e=0){const i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}const n=this._getGlSampler(t);this._boundSamplers[e]!==n&&(this._boundSamplers[e]=n,i.bindSampler(e,n))}unbind(t){const e=t.source,i=this._boundTextures,n=this._gl;for(let s=0;s<i.length;s++)if(i[s]===e){this._activateLocation(s);const a=this.getGlSource(e);n.bindTexture(a.target,null),i[s]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,i=new Ac(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],i.target=this._mapViewDimensionToGlTarget[t.viewDimension],i.target===null)throw new Error(`Unsupported view dimension: ${t.viewDimension} with this webgl version: ${this._renderer.context.webGLVersion}`);if(t.uploadMethodId==="cube"&&(i.target=e.TEXTURE_CUBE_MAP),t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const n=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(n))+1}return t._gpuData[this._renderer.uid]=i,this._managedTextures.add(t)&&(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const i=this._gl,n=this.getGlSource(t);i.bindTexture(n.target,n.texture),this._boundTextures[this._activeTextureLocation]=t,Rc(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",n.target,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t,e=!1){const i=t._gpuData[this._renderer.uid];i&&(e||(this.unbind(t),this._gl.deleteTexture(i.texture)),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(i.target,i.texture),this._boundTextures[this._activeTextureLocation]=t;const n=t.alphaMode==="premultiply-alpha-on-upload";if(this._premultiplyAlpha!==n&&(this._premultiplyAlpha=n,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n)),this._uploads[t.uploadMethodId])this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion);else if(i.target===e.TEXTURE_2D)this._initEmptyTexture2D(i,t);else if(i.target===e.TEXTURE_2D_ARRAY)this._initEmptyTexture2DArray(i,t);else if(i.target===e.TEXTURE_CUBE_MAP)this._initEmptyTextureCube(i,t);else throw new Error("[GlTextureSystem] Unsupported texture target for empty allocation.");this._applyMipRange(i,t),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}_initEmptyTexture2D(t,e){const i=this._gl;i.texImage2D(i.TEXTURE_2D,0,t.internalFormat,e.pixelWidth,e.pixelHeight,0,t.format,t.type,null);let n=Math.max(e.pixelWidth>>1,1),s=Math.max(e.pixelHeight>>1,1);for(let a=1;a<e.mipLevelCount;a++)i.texImage2D(i.TEXTURE_2D,a,t.internalFormat,n,s,0,t.format,t.type,null),n=Math.max(n>>1,1),s=Math.max(s>>1,1)}_initEmptyTexture2DArray(t,e){if(this._renderer.context.webGLVersion!==2)throw new Error("[GlTextureSystem] TEXTURE_2D_ARRAY requires WebGL2.");const i=this._gl,n=Math.max(e.arrayLayerCount|0,1);i.texImage3D(i.TEXTURE_2D_ARRAY,0,t.internalFormat,e.pixelWidth,e.pixelHeight,n,0,t.format,t.type,null);let s=Math.max(e.pixelWidth>>1,1),a=Math.max(e.pixelHeight>>1,1);for(let o=1;o<e.mipLevelCount;o++)i.texImage3D(i.TEXTURE_2D_ARRAY,o,t.internalFormat,s,a,n,0,t.format,t.type,null),s=Math.max(s>>1,1),a=Math.max(a>>1,1)}_initEmptyTextureCube(t,e){const i=this._gl,n=6;for(let o=0;o<n;o++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,t.internalFormat,e.pixelWidth,e.pixelHeight,0,t.format,t.type,null);let s=Math.max(e.pixelWidth>>1,1),a=Math.max(e.pixelHeight>>1,1);for(let o=1;o<e.mipLevelCount;o++){for(let l=0;l<n;l++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+l,o,t.internalFormat,s,a,0,t.format,t.type,null);s=Math.max(s>>1,1),a=Math.max(a>>1,1)}}_applyMipRange(t,e){if(this._renderer.context.webGLVersion!==2||e.mipLevelCount<=1)return;const i=this._gl,n=Math.max((e.mipLevelCount|0)-1,0);i.texParameteri(t.target,i.TEXTURE_BASE_LEVEL,0),i.texParameteri(t.target,i.TEXTURE_MAX_LEVEL,n)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Rc(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return t._gcLastUsed=this._renderer.gc.now,t._gpuData[this._renderer.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:n}=this.getPixels(t),s=H.get().createCanvas();s.width=i,s.height=n;const a=s.getContext("2d");if(a){const o=a.createImageData(i,n);o.data.set(e),a.putImageData(o,0,0)}return s}getPixels(t){const e=t.source.resolution,i=t.frame,n=Math.max(Math.round(i.width*e),1),s=Math.max(Math.round(i.height*e),1),a=new Uint8Array(I3*n*s),o=this._renderer,l=o.renderTarget.getRenderTarget(t),u=o.renderTarget.getGpuRenderTarget(l),c=o.gl;return c.bindFramebuffer(c.FRAMEBUFFER,u.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),n,s,c.RGBA,c.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.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(){this._activeTextureLocation=-1,this._boundTextures.fill(D.EMPTY.source),this._boundSamplers=Object.create(null);const t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Oc.extension={type:[S.WebGLSystem],name:"texture"},Oc.uploadExtensions=Object.create(null);let Gc=Oc;N.handleByMap(S.TextureUploaderWebGL,Gc.uploadExtensions);class Ic{contextChange(t){const e=new At({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),i=t.limits.maxBatchableTextures,n=Dr({name:"graphics",bits:[jn,zn(i),Ts,$r]});this.shader=new ee({glProgram:n,resources:{localUniforms:e,batchSamplers:Wn(i)}})}execute(t,e){const i=e.context,n=i.customShader||this.shader,s=t.renderer,a=s.graphicsContext,{batcher:o,instructions:l}=a.getContextRenderData(i);n.groups[0]=s.globalUniforms.bindGroup,s.state.set(t.state),s.shader.bind(n),s.geometry.bind(o.geometry,n.glProgram);const u=l.instructions;for(let c=0;c<l.instructionSize;c++){const h=u[c];if(h.size){for(let p=0;p<h.textures.count;p++)s.texture.bind(h.textures.textures[p],p);s.geometry.draw(h.topology,h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}Ic.extension={type:[S.WebGLPipesAdaptor],name:"graphics"};class Bc{init(){const t=Dr({name:"mesh",bits:[Ts,lv,$r]});this._shader=new ee({glProgram:t,resources:{uTexture:D.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new U}}}})}execute(t,e){const i=t.renderer;let n=e._shader;if(n){if(!n.glProgram)return}else{n=this._shader;const s=e.texture,a=s.source;n.resources.uTexture=a,n.resources.uSampler=a.style,n.resources.textureUniforms.uniforms.uTextureMatrix=s.textureMatrix.mapCoord}n.groups[100]=i.globalUniforms.bindGroup,n.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:n,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Bc.extension={type:[S.WebGLPipesAdaptor],name:"mesh"};const B3=[...Qs,bc,mx,ox,pc,ac,Gc,vc,uc,Pc,Ec,dc,kx,fc,hc],F3=[...ic],D3=[Ou,Bc,Ic],r0=[],i0=[],n0=[];N.handleByNamedList(S.WebGLSystem,r0),N.handleByNamedList(S.WebGLPipes,i0),N.handleByNamedList(S.WebGLPipesAdaptor,n0),N.add(...B3,...F3,...D3);class s0 extends Mr{constructor(){const t={name:"webgl",type:It.WEBGL,systems:r0,renderPipes:i0,renderPipeAdaptors:n0};super(t)}}var U3={__proto__:null,WebGLRenderer:s0};class Fc{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){var n;const s=this._gpu.device,a=e.layout[i],o=[],l=this._renderer;for(const h in a){const p=(n=t.resources[h])!=null?n:t.resources[a[h]];let f;if(p._resourceType==="uniformGroup"){const m=p;l.ubo.updateUniformGroup(m);const g=m.buffer;f={buffer:l.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(p._resourceType==="buffer"){const m=p;f={buffer:l.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(p._resourceType==="bufferResource"){const m=p;f={buffer:l.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size}}else if(p._resourceType==="textureSampler"){const m=p;f=l.texture.getGpuSampler(m)}else if(p._resourceType==="textureSource"){const m=p;f=l.texture.getTextureView(m)}o.push({binding:a[h],resource:f})}const u=l.shader.getProgramData(e).bindGroups[i],c=s.createBindGroup({layout:u,entries:o});return this._hash[t._key]=c,c}destroy(){this._hash=null,this._renderer=null}}Fc.extension={type:[S.WebGPUSystem],name:"bindGroup"};class a0{constructor(t){this.gpuBuffer=t}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class Dc{constructor(t){this._renderer=t,this._managedBuffers=new Ut({renderer:t,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(t){this._gpu=t}getGPUBuffer(t){var e;return t._gcLastUsed=this._renderer.gc.now,((e=t._gpuData[this._renderer.uid])==null?void 0:e.gpuBuffer)||this.createGPUBuffer(t)}updateBuffer(t){const e=this.getGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(t){t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this)}createGPUBuffer(t){const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t._resourceId=ht("resource"),t.data&&(Ln(t.data.buffer,e.getMappedRange(),t.data.byteOffset,t.data.byteLength),e.unmap()),t._gpuData[this._renderer.uid]=new a0(e),this._managedBuffers.add(t)&&(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this)),e}onBufferChange(t){this._managedBuffers.remove(t),t._updateID=0,this.createGPUBuffer(t)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}Dc.extension={type:[S.WebGPUSystem],name:"buffer"};class o0{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this.data=null}}class Uc{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}Uc.extension={type:[S.WebGPUSystem],name:"colorMask"};class oa{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=(t.gpu?Promise.resolve(t.gpu):this._createDeviceAndAdaptor(t)).then(e=>{this.gpu=e,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await H.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(s=>e.features.has(s)),n=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:n}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}}oa.extension={type:[S.WebGPUSystem],name:"device"},oa.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var $3=Object.defineProperty,l0=Object.getOwnPropertySymbols,k3=Object.prototype.hasOwnProperty,L3=Object.prototype.propertyIsEnumerable,u0=(r,t,e)=>t in r?$3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,c0=(r,t)=>{for(var e in t||(t={}))k3.call(t,e)&&u0(r,e,t[e]);if(l0)for(var e of l0(t))L3.call(t,e)&&u0(r,e,t[e]);return r};class $c{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,n){const s=this._renderer.pipeline.getPipeline(t,e,i,n);this.setPipeline(s)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.gc.now,this._renderer.tick);const n=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,n)}setGeometry(t,e){const i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const n in i)this._setVertexBuffer(parseInt(n,10),t.attributes[i[n]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const i in t.groups){const n=t.groups[i];e||this._syncBindGroup(n),this.setBindGroup(i,n,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){const{geometry:e,shader:i,state:n,topology:s,size:a,start:o,instanceCount:l,skipSync:u}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,n,s),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,u),e.indexBuffer?this.renderPassEncoder.drawIndexed(a||e.indexBuffer.data.length,l!=null?l:e.instanceCount,o||0):this.renderPassEncoder.draw(a||e.getSize(),l!=null?l:e.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,i=c0({},this._boundVertexBuffer),n=this._boundIndexBuffer,s=c0({},this._boundBindGroup);this._clearCache();const a=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(a.x,a.y,a.width,a.height,0,1),this.setPipeline(e);for(const o in i)this._setVertexBuffer(o,i[o]);for(const o in s)this.setBindGroup(o,s[o],null);this._setIndexBuffer(n)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=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}contextChange(t){this._gpu=t}}$c.extension={type:[S.WebGPUSystem],name:"encoder",priority:1};class kc{constructor(t){this._renderer=t}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}kc.extension={type:[S.WebGPUSystem],name:"limits"};class Lc{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:wt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;const n=this._renderer;n.pipeline.setStencilMode(t),n.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}Lc.extension={type:[S.WebGPUSystem],name:"stencil"};const Ki={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 h0(r){const t=r.map(i=>({data:i,offset:0,size:0}));let e=0;for(let i=0;i<t.length;i++){const n=t[i];let s=Ki[n.data.type].size;const a=Ki[n.data.type].align;if(!Ki[n.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${n.data.type}`);n.data.size>1&&(s=Math.max(s,a)*n.data.size),e=Math.ceil(e/a)*a,n.size=s,n.offset=e,e+=s}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function d0(r,t){const{size:e,align:i}=Ki[r.data.type],n=(i-e)/4,s=r.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
|
|
2084
|
+
v = uv.${r.data.name};
|
|
2085
|
+
${t!==0?`offset += ${t};`:""}
|
|
2086
|
+
|
|
2087
|
+
arrayOffset = offset;
|
|
2088
|
+
|
|
2089
|
+
t = 0;
|
|
2090
|
+
|
|
2091
|
+
for(var i=0; i < ${r.data.size*(e/4)}; i++)
|
|
2092
|
+
{
|
|
2093
|
+
for(var j = 0; j < ${e/4}; j++)
|
|
2094
|
+
{
|
|
2095
|
+
${s}[arrayOffset++] = v[t++];
|
|
2096
|
+
}
|
|
2097
|
+
${n!==0?`arrayOffset += ${n};`:""}
|
|
2098
|
+
}
|
|
2099
|
+
`}function p0(r){return _c(r,"uboWgsl",d0,vx)}class Nc extends mc{constructor(){super({createUboElements:h0,generateUboSync:p0})}}Nc.extension={type:[S.WebGPUSystem],name:"ubo"};const Ve=128;class Xc{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._batchBuffer=new o0({minUniformOffsetAlignment:Ve});const e=256/Ve;for(let i=0;i<e;i++){let n=at.UNIFORM|at.COPY_DST;i===0&&(n|=at.COPY_SRC),this._buffers.push(new Yt({data:this._batchBuffer.data,usage:n}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){this._bindGroupHash=Object.create(null),this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);const i=t.buffer.data,n=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,n/4),this._bindGroupHash[t.uid]=this._getBindGroup(n/Ve),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);const e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Ve)}getArrayBindGroup(t){const e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Ve)}getArrayBufferResource(t){const e=this._batchBuffer.addGroup(t)/Ve;return this._getBufferResource(e)}_getBufferResource(t){if(!this._bufferResources[t]){const e=this._buffers[t%2];this._bufferResources[t]=new ia({buffer:e,offset:(t/2|0)*256,size:Ve})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){const e=new Ee({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){const t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);const i=this._renderer.gpu.device.createCommandEncoder();for(let n=1;n<this._buffers.length;n++){const s=this._buffers[n];i.copyBufferToBuffer(t.getGPUBuffer(e),Ve,t.getGPUBuffer(s),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.finish()])}destroy(){var t;for(let e=0;e<this._bindGroups.length;e++)(t=this._bindGroups[e])==null||t.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}}Xc.extension={type:[S.WebGPUPipes],name:"uniformBatch"};var N3=Object.defineProperty,X3=Object.defineProperties,j3=Object.getOwnPropertyDescriptors,f0=Object.getOwnPropertySymbols,H3=Object.prototype.hasOwnProperty,z3=Object.prototype.propertyIsEnumerable,m0=(r,t,e)=>t in r?N3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W3=(r,t)=>{for(var e in t||(t={}))H3.call(t,e)&&m0(r,e,t[e]);if(f0)for(var e of f0(t))z3.call(t,e)&&m0(r,e,t[e]);return r},V3=(r,t)=>X3(r,j3(t));const Y3={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};function K3(r,t,e,i,n){return r<<24|t<<16|e<<10|i<<5|n}function q3(r,t,e,i,n){return e<<8|r<<5|i<<3|n<<1|t}class jc{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._colorTargetCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(wt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._colorTargetCount=t.colorTargetCount,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Ue[t],this._updatePipeHash())}setPipeline(t,e,i,n){const s=this.getPipeline(t,e,i);n.setPipeline(s)}getPipeline(t,e,i,n){t._layoutKey||(lc(t,e.attributeData),this._generateBufferKey(t)),n||(n=t.topology);const s=K3(t._layoutKey,e._layoutKey,i.data,i._blendModeId,Y3[n]);return this._pipeCache[s]?this._pipeCache[s]:(this._pipeCache[s]=this._createPipeline(t,e,i,n),this._pipeCache[s])}_createPipeline(t,e,i,n){const s=this._gpu.device,a=this._createVertexBufferLayouts(t,e),o=this._renderer.state.getColorTargets(i,this._colorTargetCount),l=this._stencilMode===wt.RENDERING_MASK_ADD?0:this._colorMask;for(let h=0;h<o.length;h++)o[h].writeMask=l;const u=this._renderer.shader.getProgramData(e).pipeline,c={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:a},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:o},primitive:{topology:n,cullMode:i.cullMode},layout:u,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(c.depthStencil=V3(W3({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"})),s.createRenderPipeline(c)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){const e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){const e=[];let i=0;const n=Object.keys(t.attributes).sort();for(let a=0;a<n.length;a++){const o=t.attributes[n[a]];e[i++]=o.offset,e[i++]=o.format,e[i++]=o.stride,e[i++]=o.instance}const s=e.join("|");return t._layoutKey=Ar(s,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){const e=[];let i=0;const n=Object.keys(t.attributeData).sort();for(let a=0;a<n.length;a++){const o=t.attributeData[n[a]];e[i++]=o.location}const s=e.join("|");return t._attributeLocationsKey=Ar(s,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){const i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];const n=this._createVertexBufferLayouts(t,e),s=Object.create(null),a=e.attributeData;for(let o=0;o<n.length;o++){const l=Object.values(n[o].attributes)[0].shaderLocation;for(const u in a)if(a[u].location===l){s[o]=u;break}}return this._bindingNamesCache[i]=s,s}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);const i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];const n=[];return t.buffers.forEach(s=>{var a;const o={arrayStride:0,stepMode:"vertex",attributes:[]},l=o.attributes;for(const u in e.attributeData){const c=t.attributes[u];((a=c.divisor)!=null?a:1)!==1&&ue(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===s&&(o.arrayStride=c.stride,o.stepMode=c.instance?"instance":"vertex",l.push({shaderLocation:e.attributeData[u].location,offset:c.offset,format:c.format}))}l.length&&n.push(o)}),this._bufferLayoutsCache[i]=n,n}_updatePipeHash(){const t=q3(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment,this._colorTargetCount);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}jc.extension={type:[S.WebGPUSystem],name:"pipeline"};class g0{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class _0{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,n,s){const a=this._renderer,o=this._getGpuColorTexture(t),l=a.texture.getGpuSource(e.source);return a.encoder.commandEncoder.copyTextureToTexture({texture:o,origin:i},{texture:l,origin:s},n),e}startRenderPass(t,e=!0,i,n,s=0,a=0){var o,l;const u=this._renderTargetSystem.getGpuRenderTarget(t);if(a!==0&&(o=u.msaaTextures)!=null&&o.length)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported with MSAA render targets.");if(s>0&&(l=u.msaaTextures)!=null&&l.length)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");const c=this.getDescriptor(t,e,i,s,a);u.descriptor=c,this._renderer.pipeline.setRenderTarget(u),this._renderer.encoder.beginRenderPass(u),this._renderer.encoder.setViewport(n)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i,n=0,s=0){var a;typeof e=="boolean"&&(e=e?Kt.ALL:Kt.NONE);const o=this._renderTargetSystem,l=o.getGpuRenderTarget(t),u=t.colorTextures.map((h,p)=>{const f=l.contexts[p];let m,g;if(f){if(s!==0)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported for canvas targets.");m=f.getCurrentTexture().createView()}else m=this._renderer.texture.getGpuSource(h).createView({dimension:"2d",baseMipLevel:n,mipLevelCount:1,baseArrayLayer:s,arrayLayerCount:1});let _=!1;l.msaaTextures[p]&&(g=m,m=this._renderer.texture.getTextureView(l.msaaTextures[p]),_=l.msaaTextures[p].transient);const y=e&Kt.COLOR?"clear":"load";return i!=null||(i=o.defaultClearColor),{view:m,resolveTarget:g,clearValue:i,storeOp:_?"discard":"store",loadOp:y}});let c;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=l.msaa?4:1,t.depthStencilTexture.source.transient=!!((a=l.msaaTextures[0])!=null&&a.transient)),t.depthStencilTexture){const h=e&Kt.STENCIL?"clear":"load",p=e&Kt.DEPTH?"clear":"load",f=t.depthStencilTexture.source.transient?"discard":"store";c={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView({dimension:"2d",baseMipLevel:n,mipLevelCount:1,baseArrayLayer:s,arrayLayerCount:1}),stencilStoreOp:f,stencilLoadOp:h,depthClearValue:1,depthLoadOp:p,depthStoreOp:f}}return{colorAttachments:u,depthStencilAttachment:c}}clear(t,e=!0,i,n,s=0,a=0){if(!e)return;const{gpu:o,encoder:l}=this._renderer,u=o.device;if(l.commandEncoder===null){const c=u.createCommandEncoder(),h=this.getDescriptor(t,e,i,s,a),p=c.beginRenderPass(h);p.setViewport(n.x,n.y,n.width,n.height,0,1),p.end();const f=c.finish();u.queue.submit([f])}else this.startRenderPass(t,e,i,n,s,a)}initGpuRenderTarget(t){var e;t.isRoot=!0;const i=new g0;return i.colorTargetCount=t.colorTextures.length,t.colorTextures.forEach((n,s)=>{if(n instanceof fe){const a=n.resource.getContext("webgpu"),o=n.transparent?"premultiplied":"opaque";try{a.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:o})}catch(l){console.error(l)}i.contexts[s]=a}if(i.msaa=n.source.antialias,n.source.antialias){const a=new ft({width:0,height:0,sampleCount:4,transient:n.source.transient,arrayLayerCount:n.source.arrayLayerCount});i.msaaTextures[s]=a}}),i.msaa&&(i.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4,t.depthStencilTexture.source.transient=!!((e=i.msaaTextures[0])!=null&&e.transient))),i}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,n)=>{const s=e.msaaTextures[n];s==null||s.resize(i.source.width,i.source.height,i.source._resolution)})}}class Hc extends Js{constructor(t){super(t),this.adaptor=new _0,this.adaptor.init(t,this)}}Hc.extension={type:[S.WebGPUSystem],name:"renderTarget"};class zc{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){const e=this._gpu.device,i=t.gpuLayout.map(s=>e.createBindGroupLayout({entries:s})),n={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(n)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}zc.extension={type:[S.WebGPUSystem],name:"shader"};const Ht={};Ht.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},Ht.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},Ht.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},Ht.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},Ht.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},Ht.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},Ht["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},Ht["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},Ht["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},Ht.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},Ht.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},Ht.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class Wc{constructor(){this.defaultState=new Vt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t,e){const i=Ht[t.blendMode]||Ht.normal,n=[],s={format:"bgra8unorm",writeMask:0,blend:i};for(let a=0;a<e;a++)n[a]=s;return n}destroy(){this.gpu=null}}Wc.extension={type:[S.WebGPUSystem],name:"state"};const y0={type:"image",upload(r,t,e,i=0){const n=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),a=n.byteLength/s;e.device.queue.writeTexture({texture:t,origin:{x:0,y:0,z:i}},n,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelWidth*a},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}},Vc={"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}},Z3={blockBytes:4,blockWidth:1,blockHeight:1},b0={type:"compressed",upload(r,t,e,i=0){let n=r.pixelWidth,s=r.pixelHeight;const a=Vc[r.format]||Z3;for(let o=0;o<r.resource.length;o++){const l=r.resource[o],u=Math.ceil(n/a.blockWidth)*a.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:o,origin:{x:0,y:0,z:i}},l,{offset:0,bytesPerRow:u},{width:Math.ceil(n/a.blockWidth)*a.blockWidth,height:Math.ceil(s/a.blockHeight)*a.blockHeight,depthOrArrayLayers:1}),n=Math.max(n>>1,1),s=Math.max(s>>1,1)}}},v0=["right","left","top","bottom","front","back"];function x0(r){return{type:"cube",upload(t,e,i){const n=t.faces;for(let s=0;s<v0.length;s++){const a=v0[s],o=n[a];(r[o.uploadMethodId]||r.image).upload(o,e,i,s)}}}}const Yc={type:"image",upload(r,t,e,i=0){const n=r.resource;if(!n)return;if(globalThis.HTMLImageElement&&n instanceof HTMLImageElement){const l=H.get().createCanvas(n.width,n.height);l.getContext("2d").drawImage(n,0,0,n.width,n.height),r.resource=l}const s=Math.min(t.width,r.resourceWidth||r.pixelWidth),a=Math.min(t.height,r.resourceHeight||r.pixelHeight),o=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:n},{texture:t,origin:{x:0,y:0,z:i},premultipliedAlpha:o},{width:s,height:a})}},T0={type:"video",upload(r,t,e,i){Yc.upload(r,t,e,i)}};class S0{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
|
|
2100
|
+
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
|
2101
|
+
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
|
2102
|
+
|
|
2103
|
+
struct VertexOutput {
|
|
2104
|
+
@builtin(position) position : vec4<f32>,
|
|
2105
|
+
@location(0) texCoord : vec2<f32>,
|
|
2106
|
+
};
|
|
2107
|
+
|
|
2108
|
+
@vertex
|
|
2109
|
+
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
|
2110
|
+
var output : VertexOutput;
|
|
2111
|
+
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
|
2112
|
+
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
|
2113
|
+
return output;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
@group(0) @binding(0) var imgSampler : sampler;
|
|
2117
|
+
@group(0) @binding(1) var img : texture_2d<f32>;
|
|
2118
|
+
|
|
2119
|
+
@fragment
|
|
2120
|
+
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
|
2121
|
+
return textureSample(img, imgSampler, texCoord);
|
|
2122
|
+
}
|
|
2123
|
+
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){const e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t;const n=t.depthOrArrayLayers||1,s=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!s){const l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:n},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}const a=this.device.createCommandEncoder({}),o=e.getBindGroupLayout(0);for(let l=0;l<n;++l){let u=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),c=s?1:0;for(let h=1;h<t.mipLevelCount;++h){const p=i.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:l,arrayLayerCount:1}),f=a.beginRenderPass({colorAttachments:[{view:p,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:u}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),u=p}}if(!s){const l={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:n};for(let u=1;u<t.mipLevelCount;++u)a.copyTextureToTexture({texture:i,mipLevel:u-1},{texture:t,mipLevel:u},l),l.width=Math.ceil(l.width/2),l.height=Math.ceil(l.height/2)}return this.device.queue.submit([a.finish()]),s||i.destroy(),t}}var Q3=Object.defineProperty,J3=Object.defineProperties,tG=Object.getOwnPropertyDescriptors,w0=Object.getOwnPropertySymbols,eG=Object.prototype.hasOwnProperty,rG=Object.prototype.propertyIsEnumerable,E0=(r,t,e)=>t in r?Q3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,P0=(r,t)=>{for(var e in t||(t={}))eG.call(t,e)&&E0(r,e,t[e]);if(w0)for(var e of w0(t))rG.call(t,e)&&E0(r,e,t[e]);return r},iG=(r,t)=>J3(r,tG(t));class Kc{constructor(t){this.textureView=null,this.gpuTexture=t}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}}const qc=class J1{constructor(t){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=t,t.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new Ut({renderer:t,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});const e=P0({image:Yc,buffer:y0,video:T0,compressed:b0},J1.uploadExtensions);this._uploads=iG(P0({},e),{cube:x0(e)})}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(t){this._gpu=t}initSource(t){var e;return((e=t._gpuData[this._renderer.uid])==null?void 0:e.gpuTexture)||this._initSource(t)}_initSource(t){if(t.autoGenerateMipmaps){const l=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(l))+1}let e;t.sampleCount>1?(e=GPUTextureUsage.RENDER_ATTACHMENT,t.transient&&this._renderer.device.extensions.transientAttachment&&(e|=GPUTextureUsage.TRANSIENT_ATTACHMENT)):(e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC));const i=Vc[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},n=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,s=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,a={label:t.label,size:{width:n,height:s,depthOrArrayLayers:t.arrayLayerCount},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},o=this._gpu.device.createTexture(a);return t._gpuData[this._renderer.uid]=new Kc(o),this._managedTextures.add(t)&&(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(t),o}onSourceUpdate(t){const e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new S0(this._gpu.device));const e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceUnload(t){t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(t){t._gcLastUsed=this._renderer.gc.now;const e=t._gpuData[this._renderer.uid],i=e==null?void 0:e.gpuTexture;i?(i.width!==t.pixelWidth||i.height!==t.pixelHeight)&&(e.destroy(),this._bindGroupHash[t.uid]=null,t._gpuData[this._renderer.uid]=null,this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){var e;return t._gcLastUsed=this._renderer.gc.now,((e=t._gpuData[this._renderer.uid])==null?void 0:e.gpuTexture)||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]||this._createTextureBindGroup(t)}_createTextureBindGroup(t){const e=t.source;return this._bindGroupHash[t.uid]=new Ee({0:e,1:e.style,2:new At({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){const e=t.source;e._gcLastUsed=this._renderer.gc.now;let i=e._gpuData[this._renderer.uid];return i||(this.initSource(e),i=e._gpuData[this._renderer.uid]),i.textureView||(i.textureView=i.gpuTexture.createView({dimension:e.viewDimension})),i.textureView}generateCanvas(t){const e=this._renderer,i=e.gpu.device.createCommandEncoder(),n=H.get().createCanvas();n.width=t.source.pixelWidth,n.height=t.source.pixelHeight;const s=n.getContext("webgpu");return s.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:H.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:s.getCurrentTexture()},{width:n.width,height:n.height}),e.gpu.device.queue.submit([i.finish()]),n}getPixels(t){const e=this.generateCanvas(t),i=me.getOptimalCanvasAndContext(e.width,e.height),n=i.context;n.drawImage(e,0,0);const{width:s,height:a}=e,o=n.getImageData(0,0,s,a),l=new Uint8ClampedArray(o.data.buffer);return me.returnCanvasAndContext(i),{pixels:l,width:s,height:a}}destroy(){this._managedTextures.destroy();for(const t of Object.keys(this._bindGroupHash)){const e=Number(t),i=this._bindGroupHash[e];i==null||i.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};qc.extension={type:[S.WebGPUSystem],name:"texture"},qc.uploadExtensions=Object.create(null);let Zc=qc;N.handleByMap(S.TextureUploaderWebGPU,Zc.uploadExtensions);class Qc{constructor(){this._maxTextures=0}contextChange(t){const e=new At({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=t.limits.maxBatchableTextures;const i=Fr({name:"graphics",bits:[Xn,Hn(this._maxTextures),By,Ur]});this.shader=new ee({gpuProgram:i,resources:{localUniforms:e}})}execute(t,e){const i=e.context,n=i.customShader||this.shader,s=t.renderer,a=s.graphicsContext,{batcher:o,instructions:l}=a.getContextRenderData(i),u=s.encoder;u.setGeometry(o.geometry,n.gpuProgram);const c=s.globalUniforms.bindGroup;u.setBindGroup(0,c,n.gpuProgram);const h=s.renderPipes.uniformBatch.getUniformBindGroup(n.resources.localUniforms,!0);u.setBindGroup(2,h,n.gpuProgram);const p=l.instructions;let f=null;for(let m=0;m<l.instructionSize;m++){const g=p[m];if(g.topology!==f&&(f=g.topology,u.setPipelineFromGeometryProgramAndState(o.geometry,n.gpuProgram,t.state,g.topology)),n.groups[1]=g.bindGroup,!g.gpuBindGroup){const _=g.textures;g.bindGroup=kn(_.textures,_.count,this._maxTextures),g.gpuBindGroup=s.bindGroup.getBindGroup(g.bindGroup,n.gpuProgram,1)}u.setBindGroup(1,g.bindGroup,n.gpuProgram),u.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}Qc.extension={type:[S.WebGPUPipesAdaptor],name:"graphics"};class Jc{init(){const t=Fr({name:"mesh",bits:[qr,ov,Ur]});this._shader=new ee({gpuProgram:t,resources:{uTexture:D.EMPTY._source,uSampler:D.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new U}}}})}execute(t,e){const i=t.renderer;let n=e._shader;if(!n)n=this._shader,n.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!n.gpuProgram)return;const s=n.gpuProgram;if(s.autoAssignGlobalUniforms&&(n.groups[0]=i.globalUniforms.bindGroup),s.autoAssignLocalUniforms){const a=t.localUniforms;n.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(a,!0)}i.encoder.draw({geometry:e._geometry,shader:n,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Jc.extension={type:[S.WebGPUPipesAdaptor],name:"mesh"};const nG=[...Qs,Nc,$c,oa,kc,Dc,Zc,Hc,zc,Wc,jc,Uc,Lc,Fc],sG=[...ic,Xc],aG=[Gu,Jc,Qc],A0=[],C0=[],M0=[];N.handleByNamedList(S.WebGPUSystem,A0),N.handleByNamedList(S.WebGPUPipes,C0),N.handleByNamedList(S.WebGPUPipesAdaptor,M0),N.add(...nG,...sG,...aG);class R0 extends Mr{constructor(){const t={name:"webgpu",type:It.WEBGPU,systems:A0,renderPipes:C0,renderPipeAdaptors:M0};super(t)}}var oG={__proto__:null,WebGPURenderer:R0};const lG={POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},uG=new Proxy(lG,{get(r,t){return r[t]}});var th=(r=>(r.CLAMP="clamp-to-edge",r.REPEAT="repeat",r.MIRRORED_REPEAT="mirror-repeat",r))(th||{});const cG=new Proxy(th,{get(r,t){return r[t]}});var eh=(r=>(r.NEAREST="nearest",r.LINEAR="linear",r))(eh||{});const hG=new Proxy(eh,{get(r,t){return r[t]}});var dG=Object.defineProperty,pG=Object.defineProperties,fG=Object.getOwnPropertyDescriptors,la=Object.getOwnPropertySymbols,O0=Object.prototype.hasOwnProperty,G0=Object.prototype.propertyIsEnumerable,I0=(r,t,e)=>t in r?dG(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mG=(r,t)=>{for(var e in t||(t={}))O0.call(t,e)&&I0(r,e,t[e]);if(la)for(var e of la(t))G0.call(t,e)&&I0(r,e,t[e]);return r},gG=(r,t)=>pG(r,fG(t)),_G=(r,t)=>{var e={};for(var i in r)O0.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&la)for(var i of la(r))t.indexOf(i)<0&&G0.call(r,i)&&(e[i]=r[i]);return e};class ei extends ft{constructor(t){const e=t,{faces:i}=e,n=_G(e,["faces"]);ei._validateFaces(i);const s=i.right,a=s.resolution,o=s.format,l=s.alphaMode;super(gG(mG({},n),{resource:i,width:s.width,height:s.height,dimensions:"2d",viewDimension:"cube",arrayLayerCount:6,resolution:a,format:o,alphaMode:l})),this.uploadMethodId="cube",this.faces=i;for(const u of Object.keys(i)){const c=i[u];c.on("update",this._onFaceUpdate,this),c.on("resize",this._onFaceResize,this),c.on("unload",this._onFaceUpdate,this)}}destroy(){const t=this.faces;if(t)for(const e of Object.keys(t)){const i=t[e];i.off("update",this._onFaceUpdate,this),i.off("resize",this._onFaceResize,this),i.off("unload",this._onFaceUpdate,this)}super.destroy()}_onFaceUpdate(){this.emit("update",this)}_onFaceResize(t){ei._validateFaces(this.faces),this.resize(t.width,t.height,t.resolution)}static _validateFaces(t){if(!t.right||!t.left||!t.top||!t.bottom||!t.front||!t.back)throw new Error("[CubeTextureSource] Requires { left, right, top, bottom, front, back } faces.");const e=t.right,i=e.pixelWidth,n=e.pixelHeight,s=e.format,a=e.alphaMode,o=e.resolution;for(const l of Object.keys(t)){const u=t[l];if(u.pixelWidth!==i||u.pixelHeight!==n)throw new Error(`[CubeTextureSource] Face '${String(l)}' has a different size. All faces must match.`);if(u.format!==s)throw new Error(`[CubeTextureSource] Face '${String(l)}' has a different format. All faces must match.`);if(u.alphaMode!==a)throw new Error(`[CubeTextureSource] Face '${String(l)}' has a different alphaMode. All faces must match.`);if(u.resolution!==o)throw new Error(`[CubeTextureSource] Face '${String(l)}' has a different resolution. All faces must match.`)}}}var yG=Object.defineProperty,bG=Object.defineProperties,vG=Object.getOwnPropertyDescriptors,ua=Object.getOwnPropertySymbols,B0=Object.prototype.hasOwnProperty,F0=Object.prototype.propertyIsEnumerable,D0=(r,t,e)=>t in r?yG(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,U0=(r,t)=>{for(var e in t||(t={}))B0.call(t,e)&&D0(r,e,t[e]);if(ua)for(var e of ua(t))F0.call(t,e)&&D0(r,e,t[e]);return r},xG=(r,t)=>bG(r,vG(t)),TG=(r,t)=>{var e={};for(var i in r)B0.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ua)for(var i of ua(r))t.indexOf(i)<0&&F0.call(r,i)&&(e[i]=r[i]);return e};const rh=["left","right","top","bottom","front","back"];function SG(r,t){const e=t?U0({},t):{};delete e.label;const i=Object.keys(e).sort(),n=i.length?`|${i.map(s=>`${s}=${String(e[s])}`).join("&")}`:"";return`cube:${rh.map(s=>r[s]).join(",")}${n}`}class ca extends Nt{constructor(t){var e;super(),this.uid=ht("cubeTexture"),this.destroyed=!1;const{label:i,source:n}=t;this.label=i,this.source=n,this.source.label=(e=this.label)!=null?e:this.source.label}static from(t,e=!1){if(t instanceof ei)return new ca({source:t});const i=t,{faces:n}=i,s=TG(i,["faces"]);let a=null;const o=rh.every(h=>typeof n[h]=="string");if(!e&&o&&(a=SG(n,s),it.has(a)))return it.get(a);const l=h=>h.isTexture?h:D.from(h),u={};for(const h of rh)u[h]=l(n[h]).source;const c=new ca({source:new ei(xG(U0({},s),{faces:u})),label:s.label});return a&&(it.set(a,c),c.once("destroy",()=>{it.has(a)&&it.remove(a)})),c}destroy(t=!1){this.destroyed||(this.destroyed=!0,t&&this.source.destroy(),this.emit("destroy",this),this.removeAllListeners())}}const ih=Object.create(null),nh=Object.create(null);function wG(r){var t;if(r.type===It.WEBGPU)return nh[t=r.uid]||(nh[t]=r.gpu.device.createTexture({label:"ExternalSource placeholder",size:{width:1,height:1},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST})),nh[r.uid];if(!ih[r.uid]){const e=r.gl,i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null),ih[r.uid]=i}return ih[r.uid]}class EG extends ft{constructor({resource:t,renderer:e,label:i,width:n,height:s}){var a,o;t||(t=wG(e)),n||(n=(a=n!=null?n:t==null?void 0:t.width)!=null?a:1),s||(s=(o=s!=null?s:t==null?void 0:t.height)!=null?o:1),super({resource:t,width:n,height:s,label:i,autoGarbageCollect:!1}),this._renderer=e,this._initGpuData(t)}static test(t){return globalThis.GPUTexture&&t instanceof GPUTexture||globalThis.WebGLTexture&&t instanceof WebGLTexture}_validateTexture(t){const e=this._renderer,i=!!e.gpu,n=globalThis.GPUTexture&&t instanceof GPUTexture,s=globalThis.WebGLTexture&&t instanceof WebGLTexture;if(i&&s)throw new Error("Cannot use WebGLTexture with a WebGPU renderer");if(!i&&n)throw new Error("Cannot use GPUTexture with a WebGL renderer");if(!i){const a=e.gl;if(a&&!a.isTexture(t))throw new Error("WebGLTexture does not belong to this renderer's WebGL context")}}_initGpuData(t){const e=this._renderer;this._validateTexture(t),e.gpu?this._gpuData[e.uid]=new Kc(t):this._gpuData[e.uid]=new Ac(t)}updateGPUTexture(t,e,i){const n=this._renderer,s=this._gpuData[n.uid];if(this.resource=t,n.gpu){this._validateTexture(t);const a=s;if(a.gpuTexture!==t){a.gpuTexture=t,a.textureView=null;const u=n.texture;u!=null&&u._bindGroupHash&&(u._bindGroupHash[this.uid]=null)}const o=e!=null?e:t.width,l=i!=null?i:t.height;this.resize(o,l)}else{this._validateTexture(t);const a=s;a.texture=t,e!==void 0&&i!==void 0&&this.resize(e,i)}this.emit("update",this)}destroy(){const t=this._renderer;delete this._gpuData[t.uid],super.destroy()}}class PG{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(t,e,i){const n=e.width,s=e.height;if(i){const a=t.width/2/n,o=t.height/2/s,l=t.x/n+a,u=t.y/s+o;i=W.add(i,W.NW),this.x0=l+a*W.uX(i),this.y0=u+o*W.uY(i),i=W.add(i,2),this.x1=l+a*W.uX(i),this.y1=u+o*W.uY(i),i=W.add(i,2),this.x2=l+a*W.uX(i),this.y2=u+o*W.uY(i),i=W.add(i,2),this.x3=l+a*W.uX(i),this.y3=u+o*W.uY(i)}else this.x0=t.x/n,this.y0=t.y/s,this.x1=(t.x+t.width)/n,this.y1=t.y/s,this.x2=(t.x+t.width)/n,this.y2=(t.y+t.height)/s,this.x3=t.x/n,this.y3=(t.y+t.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}}function AG(r){const t=r.toString(),e=t.indexOf("{"),i=t.lastIndexOf("}");if(e===-1||i===-1)throw new Error("getFunctionBody: No body found in function definition");return t.slice(e+1,i).trim()}function CG(r,t){return r.getFastGlobalBounds(!0,t)}var MG=Object.defineProperty,ha=Object.getOwnPropertySymbols,$0=Object.prototype.hasOwnProperty,k0=Object.prototype.propertyIsEnumerable,L0=(r,t,e)=>t in r?MG(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,RG=(r,t)=>{for(var e in t||(t={}))$0.call(t,e)&&L0(r,e,t[e]);if(ha)for(var e of ha(t))k0.call(t,e)&&L0(r,e,t[e]);return r},OG=(r,t)=>{var e={};for(var i in r)$0.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ha)for(var i of ha(r))t.indexOf(i)<0&&k0.call(r,i)&&(e[i]=r[i]);return e};class GG extends Se{constructor(t){var e,i;typeof t=="function"&&(t={render:t});const n=t,{render:s}=n,a=OG(n,["render"]);super(RG({label:"RenderContainer"},a)),this.renderPipeId="customRender",this.batched=!1,s&&(this.render=s),this.containsPoint=(e=t.containsPoint)!=null?e:(()=>!1),this.addBounds=(i=t.addBounds)!=null?i:(()=>!1)}updateBounds(){this._bounds.clear(),this.addBounds(this._bounds)}render(t){}}function IG(r,t,e){const i=e.renderPipes?e:e.batch.renderer;return r.collectRenderables(t,i,null)}function BG(r,t){const e=t._scale,i=t._pivot,n=t._position,s=e._x,a=e._y,o=i._x,l=i._y;r.a=t._cx*s,r.b=t._sx*s,r.c=t._cy*a,r.d=t._sy*a,r.tx=n._x-(o*r.a+l*r.c),r.ty=n._y-(o*r.b+l*r.d)}function FG(r,t,e){const i=r.a,n=r.b,s=r.c,a=r.d,o=r.tx,l=r.ty,u=t.a,c=t.b,h=t.c,p=t.d;e.a=i*u+n*h,e.b=i*c+n*p,e.c=s*u+a*h,e.d=s*c+a*p,e.tx=o*u+l*h+t.tx,e.ty=o*c+l*p+t.ty}class N0{constructor(){this._gradients=[],this._nextId=0}addStyle(t){var e;if(!(t.fill instanceof $t))return null;const i=`pixi-grad-${this._nextId++}`;return this._gradients.push({id:i,gradient:t.fill,textureSpace:(e=t.textureSpace)!=null?e:"local"}),`url(#${i})`}build(){var t,e,i,n,s,a,o,l,u,c,h,p,f,m,g,_,y;if(this._gradients.length===0)return"";const b=["<defs>"];for(const{id:x,gradient:v,textureSpace:w}of this._gradients){const T=w==="global"?"userSpaceOnUse":"objectBoundingBox",E=DG(v.colorStops);if(v.type==="radial"){const P=(e=(t=v.outerCenter)==null?void 0:t.x)!=null?e:.5,M=(n=(i=v.outerCenter)==null?void 0:i.y)!=null?n:.5,C=(s=v.outerRadius)!=null?s:.5,A=(o=(a=v.center)==null?void 0:a.x)!=null?o:P,G=(u=(l=v.center)==null?void 0:l.y)!=null?u:M;b.push(`<radialGradient id="${x}" gradientUnits="${T}" cx="${P}" cy="${M}" r="${C}" fx="${A}" fy="${G}">`,E,"</radialGradient>")}else{const P=(h=(c=v.start)==null?void 0:c.x)!=null?h:0,M=(f=(p=v.start)==null?void 0:p.y)!=null?f:0,C=(g=(m=v.end)==null?void 0:m.x)!=null?g:1,A=(y=(_=v.end)==null?void 0:_.y)!=null?y:0;b.push(`<linearGradient id="${x}" gradientUnits="${T}" x1="${P}" y1="${M}" x2="${C}" y2="${A}">`,E,"</linearGradient>")}}return b.push("</defs>"),b.join("")}}function DG(r){return r.map(t=>{const e=tt.shared.setValue(t.color).toHex();return`<stop offset="${t.offset}" stop-color="${e}"/>`}).join("")}const gr=Math.PI*2,UG=new Set(["regularPoly","roundPoly","roundShape","filletRect","chamferRect","arcTo"]);function Ye(r,t=2,e=!1){var i,n,s;if(r.instructions.some(l=>UG.has(l.action)))return NG(r,t,e);const a=[];let o=!1;for(let l=0;l<r.instructions.length;l++){const u=r.instructions[l],c=u.data;switch(u.action){case"moveTo":a.push(`M${Ft(c[0],c[1],null,t)}`),o=!0;break;case"lineTo":a.push(`L${Ft(c[0],c[1],null,t)}`),o=!0;break;case"quadraticCurveTo":a.push(`Q${Ft(c[0],c[1],null,t)} ${Ft(c[2],c[3],null,t)}`),o=!0;break;case"bezierCurveTo":a.push(`C${Ft(c[0],c[1],null,t)} ${Ft(c[2],c[3],null,t)} ${Ft(c[4],c[5],null,t)}`),o=!0;break;case"arcToSvg":a.push(`A${V(c[0],t)} ${V(c[1],t)} ${V(c[2],t)} ${c[3]} ${c[4]} ${Ft(c[5],c[6],null,t)}`),o=!0;break;case"closePath":a.push("Z"),o=!1;break;case"arc":a.push(kG(c[0],c[1],c[2],c[3],c[4],!!c[5],o,t,e)),o=!$G(c[3],c[4],!!c[5]);break;case"rect":a.push(sh(c[0],c[1],c[2],c[3],c[4],t)),o=!1;break;case"circle":a.push(qi(c[0],c[1],c[2],c[2],c[3],t,e)),o=!1;break;case"ellipse":a.push(qi(c[0],c[1],c[2],c[3],c[4],t,e)),o=!1;break;case"roundRect":a.push(X0(c[0],c[1],c[2],c[3],(i=c[4])!=null?i:0,c[5],t,e)),o=!1;break;case"poly":a.push(j0(c[0],(n=c[1])!=null?n:!0,c[2],t)),o=!((s=c[1])==null||s);break;case"addPath":a.push(LG(c[0],c[1],t,e)),o=!0;break}}return a.join("")}function $G(r,t,e){let i=t-r;return e?i>0&&(i-=gr):i<0&&(i+=gr),Math.abs(i)>=gr-1e-6}function V(r,t){return parseFloat(r.toFixed(t)).toString()}function Ft(r,t,e,i){if(e&&!e.isIdentity()){const n=e.a*r+e.c*t+e.tx,s=e.b*r+e.d*t+e.ty;return`${V(n,i)} ${V(s,i)}`}return`${V(r,i)} ${V(t,i)}`}function kG(r,t,e,i,n,s,a,o,l=!1){let u=n-i;if(s?u>0&&(u-=gr):u<0&&(u+=gr),Math.abs(u)>=gr-1e-6)return qi(r,t,e,e,null,o,l);if(l){const _=[];for(let y=0;y<=32;y++){const b=i+y/32*u,x=r+e*Math.cos(b),v=t+e*Math.sin(b),w=y===0?a?"L":"M":"L";_.push(`${w}${V(x,o)} ${V(v,o)}`)}return _.join("")}const c=r+e*Math.cos(i),h=t+e*Math.sin(i),p=r+e*Math.cos(n),f=t+e*Math.sin(n),m=Math.abs(u)>Math.PI?1:0,g=s?0:1;return`${a?"L":"M"}${V(c,o)} ${V(h,o)}A${V(e,o)} ${V(e,o)} 0 ${m} ${g} ${V(p,o)} ${V(f,o)}`}function qi(r,t,e,i,n,s,a=!1){const o=n&&!n.isIdentity()?n:null;if(!o&&!a)return`M${V(r-e,s)} ${V(t,s)}A${V(e,s)} ${V(i,s)} 0 1 1 ${V(r+e,s)} ${V(t,s)}A${V(e,s)} ${V(i,s)} 0 1 1 ${V(r-e,s)} ${V(t,s)}Z`;const l=64,u=[];for(let c=0;c<l;c++){const h=c/l*gr,p=r+e*Math.cos(h),f=t+i*Math.sin(h);u.push(`${c===0?"M":"L"}${Ft(p,f,o,s)}`)}return u.push("Z"),u.join("")}function sh(r,t,e,i,n,s){return`M${Ft(r,t,n,s)}L${Ft(r+e,t,n,s)}L${Ft(r+e,t+i,n,s)}L${Ft(r,t+i,n,s)}Z`}function X0(r,t,e,i,n,s,a,o=!1){const l=s&&!s.isIdentity()?s:null;if(n<=0)return sh(r,t,e,i,l,a);if(n=Math.min(n,Math.min(e,i)/2),l||o){const u=[],c=[[r+e-n,t+n,-Math.PI/2],[r+e-n,t+i-n,0],[r+n,t+i-n,Math.PI/2],[r+n,t+n,Math.PI]];let h=!0;for(let p=0;p<c.length;p++){const[f,m,g]=c[p];for(let _=0;_<=8;_++){const y=g+_/8*(Math.PI/2),b=f+n*Math.cos(y),x=m+n*Math.sin(y);u.push(`${h?"M":"L"}${Ft(b,x,l,a)}`),h=!1}}return u.push("Z"),u.join("")}return`M${V(r+n,a)} ${V(t,a)}L${V(r+e-n,a)} ${V(t,a)}A${V(n,a)} ${V(n,a)} 0 0 1 ${V(r+e,a)} ${V(t+n,a)}L${V(r+e,a)} ${V(t+i-n,a)}A${V(n,a)} ${V(n,a)} 0 0 1 ${V(r+e-n,a)} ${V(t+i,a)}L${V(r+n,a)} ${V(t+i,a)}A${V(n,a)} ${V(n,a)} 0 0 1 ${V(r,a)} ${V(t+i-n,a)}L${V(r,a)} ${V(t+n,a)}A${V(n,a)} ${V(n,a)} 0 0 1 ${V(r+n,a)} ${V(t,a)}Z`}function j0(r,t,e,i){if(r.length===0)return"";const n=[];if(typeof r[0]=="number"){const s=r;n.push(`M${Ft(s[0],s[1],e,i)}`);for(let a=2;a<s.length;a+=2)n.push(`L${Ft(s[a],s[a+1],e,i)}`)}else{const s=r;n.push(`M${Ft(s[0].x,s[0].y,e,i)}`);for(let a=1;a<s.length;a++)n.push(`L${Ft(s[a].x,s[a].y,e,i)}`)}return t&&n.push("Z"),n.join("")}function LG(r,t,e,i){return!t||t.isIdentity()?Ye(r,e,i):Ye(r.clone(!0).transform(t),e,i)}function NG(r,t,e){const i=r.shapePath.shapePrimitives,n=[];for(const s of i){const a=s.shape,o=s.transform;switch(a.type){case"polygon":{const l=a;n.push(j0(l.points,l.closePath,o,t));break}case"circle":{const l=a;n.push(qi(l.x,l.y,l.radius,l.radius,o,t,e));break}case"ellipse":{const l=a;n.push(qi(l.x,l.y,l.halfWidth,l.halfHeight,o,t,e));break}case"rectangle":{const l=a;n.push(sh(l.x,l.y,l.width,l.height,o,t));break}case"roundedRectangle":{const l=a;n.push(X0(l.x,l.y,l.width,l.height,l.radius,o,t,e));break}}}return n.join("")}function H0(r,t){const e=t.addStyle(r),i=[];return e?i.push(`fill="${e}"`):i.push(`fill="${tt.shared.setValue(r.color).toHex()}"`),r.alpha<1&&i.push(`fill-opacity="${r.alpha}"`),i.join(" ")}function z0(r,t){const e=t.addStyle(r),i=[];return i.push('fill="none"'),e?i.push(`stroke="${e}"`):i.push(`stroke="${tt.shared.setValue(r.color).toHex()}"`),i.push(`stroke-width="${r.width}"`),r.cap!=="butt"&&i.push(`stroke-linecap="${r.cap}"`),r.join!=="miter"?i.push(`stroke-linejoin="${r.join}"`):r.miterLimit!==10&&i.push(`stroke-miterlimit="${r.miterLimit}"`),r.alpha<1&&i.push(`stroke-opacity="${r.alpha}"`),i.join(" ")}function XG(r,t=2){const e=r instanceof kt?r:r.context,i=new N0,n=[],s=e.instructions;let a=0;for(;a<s.length;){const m=s[a];switch(m.action){case"fill":{const g=m,_=!!g.data.hole,y=_?Ye(g.data.path,t)+Ye(g.data.hole,t,!0):Ye(g.data.path,t),b=H0(g.data.style,i),x=_?' fill-rule="evenodd"':"";n.push(`<path d="${y}" ${b}${x}/>`);break}case"stroke":{const g=m;let _=Ye(g.data.path,t);g.data.hole&&(_+=Ye(g.data.hole,t,!0));const y=z0(g.data.style,i);n.push(`<path d="${_}" ${y}/>`);break}case"texture":break}a++}const o=e.bounds,l=parseFloat(o.minX.toFixed(t)),u=parseFloat(o.minY.toFixed(t)),c=parseFloat((o.maxX-o.minX).toFixed(t)),h=parseFloat((o.maxY-o.minY).toFixed(t)),p=i.build(),f=n.join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${c}" height="${h}" viewBox="${l} ${u} ${c} ${h}">${p}${f}</svg>`}function jG(r){r instanceof ge&&(r={path:r,textureMatrix:null,out:null});const t=[],e=[],i=[],n=r.path.shapePath,s=r.textureMatrix;n.shapePrimitives.forEach(({shape:o,transform:l})=>{const u=i.length,c=t.length/2,h=[],p=Ne[o.type];p.build(o,h),l&&Yn(h,l),p.triangulate(h,t,2,c,i,u);const f=e.length/2;s?(l&&s.append(l.clone().invert()),rl(t,2,c,e,f,2,t.length/2-c,s)):il(e,f,2,t.length/2-c)});const a=r.out;return a?(a.positions=new Float32Array(t),a.uvs=new Float32Array(e),a.indices=new Uint32Array(i),a):new ze({positions:new Float32Array(t),uvs:new Float32Array(e),indices:new Uint32Array(i)})}var HG=Object.defineProperty,W0=Object.getOwnPropertySymbols,zG=Object.prototype.hasOwnProperty,WG=Object.prototype.propertyIsEnumerable,V0=(r,t,e)=>t in r?HG(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Y0=(r,t)=>{for(var e in t||(t={}))zG.call(t,e)&&V0(r,e,t[e]);if(W0)for(var e of W0(t))WG.call(t,e)&&V0(r,e,t[e]);return r};const K0=class tS extends dt{constructor(t={}){t=Y0(Y0({},tS.defaultOptions),t),super(),this.renderLayerChildren=[],this.sortableChildren=t.sortableChildren,this.sortFunction=t.sortFunction}attach(...t){for(let e=0;e<t.length;e++){const i=t[e];if(i.parentRenderLayer){if(i.parentRenderLayer===this)continue;i.parentRenderLayer.detach(i)}this.renderLayerChildren.push(i),i.parentRenderLayer=this;const n=this.renderGroup||this.parentRenderGroup;n&&(n.structureDidChange=!0)}return t[0]}detach(...t){for(let e=0;e<t.length;e++){const i=t[e],n=this.renderLayerChildren.indexOf(i);n!==-1&&this.renderLayerChildren.splice(n,1),i.parentRenderLayer=null;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0)}return t[0]}detachAll(){const t=this.renderLayerChildren;for(let e=0;e<t.length;e++)t[e].parentRenderLayer=null;this.renderLayerChildren.length=0}collectRenderables(t,e,i){const n=this.renderLayerChildren,s=n.length;this.sortableChildren&&this.sortRenderLayerChildren();for(let a=0;a<s;a++)n[a].parent||ue("Container must be added to both layer and scene graph. Layers only handle render order - the scene graph is required for transforms (addChild)",n[a]),n[a].collectRenderables(t,e,this)}sortRenderLayerChildren(){this.renderLayerChildren.sort(this.sortFunction)}_getGlobalBoundsRecursive(t,e,i){if(!t)return;const n=this.renderLayerChildren;for(let s=0;s<n.length;s++)n[s]._getGlobalBoundsRecursive(!0,e,this)}getFastGlobalBounds(t,e){return super.getFastGlobalBounds(t,e)}addChild(...t){throw new Error("RenderLayer.addChild() is not available. Please use RenderLayer.attach()")}removeChild(...t){throw new Error("RenderLayer.removeChild() is not available. Please use RenderLayer.detach()")}removeChildren(t,e){throw new Error("RenderLayer.removeChildren() is not available. Please use RenderLayer.detach()")}removeChildAt(t){throw new Error("RenderLayer.removeChildAt() is not available")}getChildAt(t){throw new Error("RenderLayer.getChildAt() is not available")}setChildIndex(t,e){throw new Error("RenderLayer.setChildIndex() is not available")}getChildIndex(t){throw new Error("RenderLayer.getChildIndex() is not available")}addChildAt(t,e){throw new Error("RenderLayer.addChildAt() is not available")}swapChildren(t,e){throw new Error("RenderLayer.swapChildren() is not available")}reparentChild(...t){throw new Error("RenderLayer.reparentChild() is not available with the render layer")}reparentChildAt(t,e){throw new Error("RenderLayer.reparentChildAt() is not available with the render layer")}};K0.defaultOptions={sortableChildren:!1,sortFunction:(r,t)=>r.zIndex-t.zIndex};let VG=K0;var YG=Object.defineProperty,q0=Object.getOwnPropertySymbols,KG=Object.prototype.hasOwnProperty,qG=Object.prototype.propertyIsEnumerable,Z0=(r,t,e)=>t in r?YG(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Q0=(r,t)=>{for(var e in t||(t={}))KG.call(t,e)&&Z0(r,e,t[e]);if(q0)for(var e of q0(t))qG.call(t,e)&&Z0(r,e,t[e]);return r};const J0=class eS extends ze{constructor(...t){var e;super({});let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){var e,i,n,s;t=Q0(Q0({},eS.defaultOptions),t),this.verticesX=(e=this.verticesX)!=null?e:t.verticesX,this.verticesY=(i=this.verticesY)!=null?i:t.verticesY,this.width=(n=this.width)!=null?n:t.width,this.height=(s=this.height)!=null?s:t.height;const a=this.verticesX*this.verticesY,o=[],l=[],u=[],c=this.verticesX-1,h=this.verticesY-1,p=this.width/c,f=this.height/h;for(let g=0;g<a;g++){const _=g%this.verticesX,y=g/this.verticesX|0;o.push(_*p,y*f),l.push(_/c,y/h)}const m=c*h;for(let g=0;g<m;g++){const _=g%c,y=g/c|0,b=y*this.verticesX+_,x=y*this.verticesX+_+1,v=(y+1)*this.verticesX+_,w=(y+1)*this.verticesX+_+1;u.push(b,x,v,x,w,v)}this.buffers[0].data=new Float32Array(o),this.buffers[1].data=new Float32Array(l),this.indexBuffer.data=new Uint32Array(u),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};J0.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let da=J0;function tT(r,t,e,i){const n=e.buffers[0],s=n.data,{verticesX:a,verticesY:o}=e,l=r/(a-1),u=t/(o-1);let c=0;const h=i[0],p=i[1],f=i[2],m=i[3],g=i[4],_=i[5],y=i[6],b=i[7],x=i[8];for(let v=0;v<s.length;v+=2){const w=c%a*l,T=(c/a|0)*u,E=h*w+p*T+f,P=m*w+g*T+_,M=y*w+b*T+x;s[v]=E/M,s[v+1]=P/M,c++}n.update()}function eT(r,t){const e=t[0],i=t[1],n=t[2],s=t[3],a=t[4],o=t[5],l=t[6],u=t[7],c=t[8];return r[0]=a*c-o*u,r[1]=n*u-i*c,r[2]=i*o-n*a,r[3]=o*l-s*c,r[4]=e*c-n*l,r[5]=n*s-e*o,r[6]=s*u-a*l,r[7]=i*l-e*u,r[8]=e*a-i*s,r}function rT(r,t,e){const i=t[0],n=t[1],s=t[2],a=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=e[0],f=e[1],m=e[2],g=e[3],_=e[4],y=e[5],b=e[6],x=e[7],v=e[8];return r[0]=p*i+f*a+m*u,r[1]=p*n+f*o+m*c,r[2]=p*s+f*l+m*h,r[3]=g*i+_*a+y*u,r[4]=g*n+_*o+y*c,r[5]=g*s+_*l+y*h,r[6]=b*i+x*a+v*u,r[7]=b*n+x*o+v*c,r[8]=b*s+x*l+v*h,r}function ZG(r,t,e){const i=e[0],n=e[1],s=e[2];return r[0]=t[0]*i+t[1]*n+t[2]*s,r[1]=t[3]*i+t[4]*n+t[5]*s,r[2]=t[6]*i+t[7]*n+t[8]*s,r}const QG=[0,0,0,0,0,0,0,0,0],JG=[0,0,0],pa=[0,0,0];function iT(r,t,e,i,n,s,a,o,l){const u=QG;u[0]=t,u[1]=i,u[2]=s,u[3]=e,u[4]=n,u[5]=a,u[6]=1,u[7]=1,u[8]=1;const c=eT(r,u);pa[0]=o,pa[1]=l,pa[2]=1;const h=ZG(JG,c,pa),p=r;return r[0]=h[0],r[1]=0,r[2]=0,r[3]=0,r[4]=h[1],r[5]=0,r[6]=0,r[7]=0,r[8]=h[2],rT(r,p,u)}const tI=[0,0,0,0,0,0,0,0,0],eI=[0,0,0,0,0,0,0,0,0];function nT(r,t,e,i,n,s,a,o,l,u,c,h,p,f,m,g,_){const y=iT(tI,t,e,s,a,u,c,f,m),b=iT(eI,i,n,o,l,h,p,g,_);return rT(r,eT(y,y),b)}class sT extends da{constructor(t){super(t),this._projectionMatrix=[0,0,0,0,0,0,0,0,0];const{width:e,height:i}=t;this.corners=[0,0,e,0,e,i,0,i]}setCorners(t,e,i,n,s,a,o,l){const u=this.corners;u[0]=t,u[1]=e,u[2]=i,u[3]=n,u[4]=s,u[5]=a,u[6]=o,u[7]=l,this.updateProjection()}updateProjection(){const{width:t,height:e}=this,i=this.corners,n=nT(this._projectionMatrix,0,0,i[0],i[1],t,0,i[2],i[3],t,e,i[4],i[5],0,e,i[6],i[7]);tT(t,e,this,n)}}var rI=Object.defineProperty,iI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,fa=Object.getOwnPropertySymbols,aT=Object.prototype.hasOwnProperty,oT=Object.prototype.propertyIsEnumerable,lT=(r,t,e)=>t in r?rI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ah=(r,t)=>{for(var e in t||(t={}))aT.call(t,e)&&lT(r,e,t[e]);if(fa)for(var e of fa(t))oT.call(t,e)&&lT(r,e,t[e]);return r},sI=(r,t)=>iI(r,nI(t)),aI=(r,t)=>{var e={};for(var i in r)aT.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&fa)for(var i of fa(r))t.indexOf(i)<0&&oT.call(r,i)&&(e[i]=r[i]);return e};const uT=class rS extends Kr{constructor(t){t=ah(ah({},rS.defaultOptions),t);const e=t,{texture:i,verticesX:n,verticesY:s}=e,a=aI(e,["texture","verticesX","verticesY"]),o=new sT(he({width:i.width,height:i.height,verticesX:n,verticesY:s}));super(he(sI(ah({},a),{geometry:o}))),this._texture=i,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){const t=this.geometry;if(!t)return;const{width:e,height:i}=this.texture;(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.updateProjection())}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,i,n,s,a,o,l){this.geometry.setCorners(t,e,i,n,s,a,o,l)}};uT.defaultOptions={texture:D.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let oI=uT;var lI=Object.defineProperty,uI=Object.defineProperties,cI=Object.getOwnPropertyDescriptors,ma=Object.getOwnPropertySymbols,cT=Object.prototype.hasOwnProperty,hT=Object.prototype.propertyIsEnumerable,dT=(r,t,e)=>t in r?lI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hI=(r,t)=>{for(var e in t||(t={}))cT.call(t,e)&&dT(r,e,t[e]);if(ma)for(var e of ma(t))hT.call(t,e)&&dT(r,e,t[e]);return r},dI=(r,t)=>uI(r,cI(t)),pI=(r,t)=>{var e={};for(var i in r)cT.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ma)for(var i of ma(r))t.indexOf(i)<0&&hT.call(r,i)&&(e[i]=r[i]);return e};class fI extends Kr{constructor(t){const e=t,{texture:i,verticesX:n,verticesY:s}=e,a=pI(e,["texture","verticesX","verticesY"]),o=new da(he({width:i.width,height:i.height,verticesX:n,verticesY:s}));super(he(dI(hI({},a),{geometry:o,texture:i}))),this.texture=i,this.autoResize=!0}textureUpdated(){const t=this.geometry,{width:e,height:i}=this.texture;this.autoResize&&(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.build({}))}set texture(t){var e;(e=this._texture)==null||e.off("update",this.textureUpdated,this),super.texture=t,t.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}}var mI=Object.defineProperty,pT=Object.getOwnPropertySymbols,gI=Object.prototype.hasOwnProperty,_I=Object.prototype.propertyIsEnumerable,fT=(r,t,e)=>t in r?mI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mT=(r,t)=>{for(var e in t||(t={}))gI.call(t,e)&&fT(r,e,t[e]);if(pT)for(var e of pT(t))_I.call(t,e)&&fT(r,e,t[e]);return r};const gT=class iS extends ze{constructor(t){const{width:e,points:i,textureScale:n}=mT(mT({},iS.defaultOptions),t);super({positions:new Float32Array(i.length*4),uvs:new Float32Array(i.length*4),indices:new Uint32Array((i.length-1)*6)}),this.points=i,this._width=e,this.textureScale=n,this._build()}get width(){return this._width}_build(){const t=this.points;if(!t)return;const e=this.getBuffer("aPosition"),i=this.getBuffer("aUV"),n=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),n.data=new Uint16Array((t.length-1)*6));const s=i.data,a=n.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let o=0,l=t[0];const u=this._width*this.textureScale,c=t.length;for(let p=0;p<c;p++){const f=p*4;if(this.textureScale>0){const m=l.x-t[p].x,g=l.y-t[p].y,_=Math.sqrt(m*m+g*g);l=t[p],o+=_/u}else o=p/(c-1);s[f]=o,s[f+1]=0,s[f+2]=o,s[f+3]=1}let h=0;for(let p=0;p<c-1;p++){const f=p*2;a[h++]=f,a[h++]=f+1,a[h++]=f+2,a[h++]=f+2,a[h++]=f+1,a[h++]=f+3}i.update(),n.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],i,n=0,s=0;const a=this.buffers[0].data,o=t.length,l=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let u=0;u<o;u++){const c=t[u],h=u*4;u<t.length-1?i=t[u+1]:i=c,s=-(i.x-e.x),n=i.y-e.y;let p=(1-u/(o-1))*10;p>1&&(p=1);const f=Math.sqrt(n*n+s*s);f<1e-6?(n=0,s=0):(n/=f,s/=f,n*=l,s*=l),a[h]=c.x+n,a[h+1]=c.y+s,a[h+2]=c.x-n,a[h+3]=c.y-s,e=c}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};gT.defaultOptions={width:200,points:[],textureScale:0};let _T=gT;var yI=Object.defineProperty,bI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,ga=Object.getOwnPropertySymbols,yT=Object.prototype.hasOwnProperty,bT=Object.prototype.propertyIsEnumerable,vT=(r,t,e)=>t in r?yI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,oh=(r,t)=>{for(var e in t||(t={}))yT.call(t,e)&&vT(r,e,t[e]);if(ga)for(var e of ga(t))bT.call(t,e)&&vT(r,e,t[e]);return r},xI=(r,t)=>bI(r,vI(t)),TI=(r,t)=>{var e={};for(var i in r)yT.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ga)for(var i of ga(r))t.indexOf(i)<0&&bT.call(r,i)&&(e[i]=r[i]);return e};const xT=class nS extends Kr{constructor(t){const e=oh(oh({},nS.defaultOptions),t),{width:i,texture:n,points:s,textureScale:a}=e,o=TI(e,["width","texture","points","textureScale"]),l=new _T(he({width:i!=null?i:n.height,points:s,textureScale:a}));a>0&&(n.source.style.addressMode="repeat"),super(he(xI(oh({},o),{texture:n,geometry:l}))),this.autoUpdate=!0,this.onRender=this._render}_render(){const t=this.geometry;(this.autoUpdate||t._width!==this.texture.height)&&(t._width=this.texture.height,t.update())}};xT.defaultOptions={textureScale:0};let SI=xT;var wI=Object.defineProperty,EI=Object.defineProperties,PI=Object.getOwnPropertyDescriptors,_a=Object.getOwnPropertySymbols,TT=Object.prototype.hasOwnProperty,ST=Object.prototype.propertyIsEnumerable,wT=(r,t,e)=>t in r?wI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,AI=(r,t)=>{for(var e in t||(t={}))TT.call(t,e)&&wT(r,e,t[e]);if(_a)for(var e of _a(t))ST.call(t,e)&&wT(r,e,t[e]);return r},CI=(r,t)=>EI(r,PI(t)),MI=(r,t)=>{var e={};for(var i in r)TT.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&_a)for(var i of _a(r))t.indexOf(i)<0&&ST.call(r,i)&&(e[i]=r[i]);return e};class RI extends Kr{constructor(t){const e=t,{texture:i,vertices:n,uvs:s,indices:a,topology:o}=e,l=MI(e,["texture","vertices","uvs","indices","topology"]),u=new ze(he({positions:n,uvs:s,indices:a,topology:o}));super(he(CI(AI({},l),{texture:i,geometry:u}))),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(t){this.geometry.getBuffer("aPosition").data=t}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}}function OI(r,t){const{width:e,height:i}=r.frame;return t.scale(1/e,1/i),t}class ET{execute(t,e){var i,n,s;const a=t.renderer,o=a.canvasContext.activeContext,l=e.particleChildren,u=e.texture;o.save(),a.canvasContext.setContextTransform(e.worldTransform,e.roundPixels),a.canvasContext.setBlendMode(e.groupBlendMode);const c=e.groupColorAlpha,h=(n=(i=a.filter)==null?void 0:i.alphaMultiplier)!=null?n:1,p=(c>>>24&255)/255*h;for(let f=0;f<l.length;f++){const m=l[f],g=m.texture||u;if(!((s=g==null?void 0:g.source)!=null&&s.resource))continue;const _=m.color,y=(_>>>24&255)/255*p;if(y<=0)continue;const b=_&16777215,x=((b&255)<<16)+(b&65280)+(b>>16&255);let v=g.source.resource;x!==16777215&&(v=Q.getTintedCanvas({texture:g},x));const w=g.frame,T=g.source.resolution,E=w.x*T,P=w.y*T,M=w.width*T,C=w.height*T;o.globalAlpha=y;const A=-m.anchorX*w.width,G=-m.anchorY*w.height;m.rotation!==0||m.scaleX!==1||m.scaleY!==1?(o.save(),o.translate(m.x,m.y),o.rotate(m.rotation),o.scale(m.scaleX,m.scaleY),o.drawImage(v,E,P,M,C,A,G,w.width,w.height),o.restore()):o.drawImage(v,E,P,M,C,m.x+A,m.y+G,w.width,w.height)}o.restore()}}function lh(r,t=null){const e=r*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let i=0,n=0;i<e;i+=6,n+=4)t[i+0]=n+0,t[i+1]=n+1,t[i+2]=n+2,t[i+3]=n+0,t[i+4]=n+2,t[i+5]=n+3;return t}function PT(r){return{dynamicUpdate:AT(r,!0),staticUpdate:AT(r,!1)}}function AT(r,t){const e=[];e.push(`
|
|
2124
|
+
|
|
2125
|
+
var index = 0;
|
|
2126
|
+
|
|
2127
|
+
for (let i = 0; i < ps.length; ++i)
|
|
2128
|
+
{
|
|
2129
|
+
const p = ps[i];
|
|
2130
|
+
|
|
2131
|
+
`);let i=0;for(const s in r){const a=r[s];if(t!==a.dynamic)continue;e.push(`offset = index + ${i}`),e.push(a.code);const o=Ie(a.format);i+=o.stride/4}e.push(`
|
|
2132
|
+
index += stride * 4;
|
|
2133
|
+
}
|
|
2134
|
+
`),e.unshift(`
|
|
2135
|
+
var stride = ${i};
|
|
2136
|
+
`);const n=e.join(`
|
|
2137
|
+
`);return new Function("ps","f32v","u32v",n)}class CT{constructor(t){this._size=0,this._generateParticleUpdateCache={};var e;const i=this._size=(e=t.size)!=null?e:1e3,n=t.properties;let s=0,a=0;for(const h in n){const p=n[h],f=Ie(p.format);p.dynamic?a+=f.stride:s+=f.stride}this._dynamicStride=a/4,this._staticStride=s/4,this.staticAttributeBuffer=new or(i*4*s),this.dynamicAttributeBuffer=new or(i*4*a),this.indexBuffer=lh(i);const o=new nr;let l=0,u=0;this._staticBuffer=new Yt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:at.VERTEX|at.COPY_DST}),this._dynamicBuffer=new Yt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:at.VERTEX|at.COPY_DST});for(const h in n){const p=n[h],f=Ie(p.format);p.dynamic?(o.addAttribute(p.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:l*4,format:p.format}),l+=f.size):(o.addAttribute(p.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:u*4,format:p.format}),u+=f.size)}o.addIndex(this.indexBuffer);const c=this.getParticleUpdate(n);this._dynamicUpload=c.dynamicUpdate,this._staticUpload=c.staticUpdate,this.geometry=o}getParticleUpdate(t){const e=GI(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return PT(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new or(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new or(this._size*this._dynamicStride*4*4),this.indexBuffer=lh(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));const i=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){const n=this.staticAttributeBuffer;this._staticUpload(t,n.float32View,n.uint32View),this._staticBuffer.setDataWithSize(n.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}function GI(r){const t=[];for(const e in r){const i=r[e];t.push(e,i.code,i.dynamic?"d":"s")}return t.join("_")}var MT=`varying vec2 vUV;
|
|
2138
|
+
varying vec4 vColor;
|
|
2139
|
+
|
|
2140
|
+
uniform sampler2D uTexture;
|
|
2141
|
+
|
|
2142
|
+
void main(void){
|
|
2143
|
+
vec4 color = texture2D(uTexture, vUV) * vColor;
|
|
2144
|
+
gl_FragColor = color;
|
|
2145
|
+
}`,RT=`attribute vec2 aVertex;
|
|
2146
|
+
attribute vec2 aUV;
|
|
2147
|
+
attribute vec4 aColor;
|
|
2148
|
+
|
|
2149
|
+
attribute vec2 aPosition;
|
|
2150
|
+
attribute float aRotation;
|
|
2151
|
+
|
|
2152
|
+
uniform mat3 uTranslationMatrix;
|
|
2153
|
+
uniform float uRound;
|
|
2154
|
+
uniform vec2 uResolution;
|
|
2155
|
+
uniform vec4 uColor;
|
|
2156
|
+
|
|
2157
|
+
varying vec2 vUV;
|
|
2158
|
+
varying vec4 vColor;
|
|
2159
|
+
|
|
2160
|
+
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
2161
|
+
{
|
|
2162
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
void main(void){
|
|
2166
|
+
float cosRotation = cos(aRotation);
|
|
2167
|
+
float sinRotation = sin(aRotation);
|
|
2168
|
+
float x = aVertex.x * cosRotation - aVertex.y * sinRotation;
|
|
2169
|
+
float y = aVertex.x * sinRotation + aVertex.y * cosRotation;
|
|
2170
|
+
|
|
2171
|
+
vec2 v = vec2(x, y);
|
|
2172
|
+
v = v + aPosition;
|
|
2173
|
+
|
|
2174
|
+
gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
2175
|
+
|
|
2176
|
+
if(uRound == 1.0)
|
|
2177
|
+
{
|
|
2178
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
vUV = aUV;
|
|
2182
|
+
vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
|
|
2183
|
+
}
|
|
2184
|
+
`,uh=`
|
|
2185
|
+
struct ParticleUniforms {
|
|
2186
|
+
uTranslationMatrix:mat3x3<f32>,
|
|
2187
|
+
uColor:vec4<f32>,
|
|
2188
|
+
uRound:f32,
|
|
2189
|
+
uResolution:vec2<f32>,
|
|
2190
|
+
};
|
|
2191
|
+
|
|
2192
|
+
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
2193
|
+
{
|
|
2194
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
@group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;
|
|
2198
|
+
|
|
2199
|
+
@group(1) @binding(0) var uTexture: texture_2d<f32>;
|
|
2200
|
+
@group(1) @binding(1) var uSampler : sampler;
|
|
2201
|
+
|
|
2202
|
+
struct VSOutput {
|
|
2203
|
+
@builtin(position) position: vec4<f32>,
|
|
2204
|
+
@location(0) uv : vec2<f32>,
|
|
2205
|
+
@location(1) color : vec4<f32>,
|
|
2206
|
+
};
|
|
2207
|
+
@vertex
|
|
2208
|
+
fn mainVertex(
|
|
2209
|
+
@location(0) aVertex: vec2<f32>,
|
|
2210
|
+
@location(1) aPosition: vec2<f32>,
|
|
2211
|
+
@location(2) aUV: vec2<f32>,
|
|
2212
|
+
@location(3) aColor: vec4<f32>,
|
|
2213
|
+
@location(4) aRotation: f32,
|
|
2214
|
+
) -> VSOutput {
|
|
2215
|
+
|
|
2216
|
+
let v = vec2(
|
|
2217
|
+
aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),
|
|
2218
|
+
aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)
|
|
2219
|
+
) + aPosition;
|
|
2220
|
+
|
|
2221
|
+
var position = vec4((uniforms.uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
2222
|
+
|
|
2223
|
+
if(uniforms.uRound == 1.0) {
|
|
2224
|
+
position = vec4(roundPixels(position.xy, uniforms.uResolution), position.zw);
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor;
|
|
2228
|
+
|
|
2229
|
+
return VSOutput(
|
|
2230
|
+
position,
|
|
2231
|
+
aUV,
|
|
2232
|
+
vColor,
|
|
2233
|
+
);
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
@fragment
|
|
2237
|
+
fn mainFragment(
|
|
2238
|
+
@location(0) uv: vec2<f32>,
|
|
2239
|
+
@location(1) color: vec4<f32>,
|
|
2240
|
+
@builtin(position) position: vec4<f32>,
|
|
2241
|
+
) -> @location(0) vec4<f32> {
|
|
2242
|
+
|
|
2243
|
+
var sample = textureSample(uTexture, uSampler, uv) * color;
|
|
2244
|
+
|
|
2245
|
+
return sample;
|
|
2246
|
+
}`;class OT extends ee{constructor(){const t=Wt.from({vertex:RT,fragment:MT}),e=Xt.from({fragment:{source:uh,entryPoint:"mainFragment"},vertex:{source:uh,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:D.WHITE.source,uSampler:new Jt({}),uniforms:{uTranslationMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new tt(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}class Zi{constructor(t,e){this.state=Vt.for2d(),this.localUniforms=new At({uTranslationMatrix:{value:new U,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=t,this.adaptor=e,this.defaultShader=new OT,this.state=Vt.for2d(),this._managedContainers=new Ut({renderer:t,type:"renderable",name:"particleContainer"})}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return t._gpuData[this.renderer.uid]||this._initBuffer(t)}_initBuffer(t){return t._gpuData[this.renderer.uid]=new CT({size:t.particleChildren.length,properties:t._properties}),this._managedContainers.add(t),t._gpuData[this.renderer.uid]}updateRenderable(t){}execute(t){const e=t.particleChildren;if(e.length===0)return;const i=this.renderer,n=this.getBuffers(t);t.texture||(t.texture=e[0].texture);const s=this.state;n.update(e,t._childrenDirty),t._childrenDirty=!1,s.blendMode=Ir(t.groupBlendMode,t.texture._source);const a=this.localUniforms.uniforms,o=a.uTranslationMatrix;t.worldTransform.copyTo(o);const l=i.globalUniforms.globalUniformData;o.tx-=l.offset.x,o.ty-=l.offset.y,o.prepend(l.projectionMatrix),a.uResolution=l.resolution,a.uRound=i._roundPixels|t._roundPixels,Yr(t.groupColorAlpha,a.uColor,0),this.adaptor.execute(this,t)}destroy(){this._managedContainers.destroy(),this.renderer=null,this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}Zi.extension={type:[S.CanvasPipes],name:"particle"};class ch extends Zi{constructor(t){super(t,new ET)}}ch.extension={type:[S.CanvasPipes],name:"particle"};class GT{execute(t,e){const i=t.state,n=t.renderer,s=e.shader||t.defaultShader;s.resources.uTexture=e.texture._source,s.resources.uniforms=t.localUniforms;const a=n.gl,o=t.getBuffers(e);n.shader.bind(s),n.state.set(i),n.geometry.bind(o.geometry,s.glProgram);const l=o.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?a.UNSIGNED_SHORT:a.UNSIGNED_INT;a.drawElements(a.TRIANGLES,e.particleChildren.length*6,l,0)}}class hh extends Zi{constructor(t){super(t,new GT)}}hh.extension={type:[S.WebGLPipes],name:"particle"};class IT{execute(t,e){const i=t.renderer,n=e.shader||t.defaultShader;n.groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),n.groups[1]=i.texture.getTextureBindGroup(e.texture);const s=t.state,a=t.getBuffers(e);i.encoder.draw({geometry:a.geometry,shader:e.shader||t.defaultShader,state:s,size:e.particleChildren.length*6})}}class dh extends Zi{constructor(t){super(t,new IT)}}dh.extension={type:[S.WebGPUPipes],name:"particle"};var II=Object.defineProperty,BT=Object.getOwnPropertySymbols,BI=Object.prototype.hasOwnProperty,FI=Object.prototype.propertyIsEnumerable,FT=(r,t,e)=>t in r?II(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,DT=(r,t)=>{for(var e in t||(t={}))BI.call(t,e)&&FT(r,e,t[e]);if(BT)for(var e of BT(t))FI.call(t,e)&&FT(r,e,t[e]);return r};const UT=class Oh{constructor(t){if(t instanceof D)this.texture=t,gn(this,Oh.defaultOptions,{});else{const e=DT(DT({},Oh.defaultOptions),t);gn(this,e,{})}}get alpha(){return this._alpha}set alpha(t){this._alpha=Math.min(Math.max(t,0),1),this._updateColor()}get tint(){return xe(this._tint)}set tint(t){this._tint=tt.shared.setValue(t!=null?t:16777215).toBgrNumber(),this._updateColor()}_updateColor(){this.color=this._tint+((this._alpha*255|0)<<24)}};UT.defaultOptions={anchorX:0,anchorY:0,x:0,y:0,scaleX:1,scaleY:1,rotation:0,tint:16777215,alpha:1};let DI=UT;const ph={vertex:{attributeName:"aVertex",format:"float32x2",code:`
|
|
2247
|
+
const texture = p.texture;
|
|
2248
|
+
const sx = p.scaleX;
|
|
2249
|
+
const sy = p.scaleY;
|
|
2250
|
+
const ax = p.anchorX;
|
|
2251
|
+
const ay = p.anchorY;
|
|
2252
|
+
const trim = texture.trim;
|
|
2253
|
+
const orig = texture.orig;
|
|
2254
|
+
|
|
2255
|
+
if (trim)
|
|
2256
|
+
{
|
|
2257
|
+
w1 = trim.x - (ax * orig.width);
|
|
2258
|
+
w0 = w1 + trim.width;
|
|
2259
|
+
|
|
2260
|
+
h1 = trim.y - (ay * orig.height);
|
|
2261
|
+
h0 = h1 + trim.height;
|
|
2262
|
+
}
|
|
2263
|
+
else
|
|
2264
|
+
{
|
|
2265
|
+
w1 = -ax * (orig.width);
|
|
2266
|
+
w0 = w1 + orig.width;
|
|
2267
|
+
|
|
2268
|
+
h1 = -ay * (orig.height);
|
|
2269
|
+
h0 = h1 + orig.height;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
f32v[offset] = w1 * sx;
|
|
2273
|
+
f32v[offset + 1] = h1 * sy;
|
|
2274
|
+
|
|
2275
|
+
f32v[offset + stride] = w0 * sx;
|
|
2276
|
+
f32v[offset + stride + 1] = h1 * sy;
|
|
2277
|
+
|
|
2278
|
+
f32v[offset + (stride * 2)] = w0 * sx;
|
|
2279
|
+
f32v[offset + (stride * 2) + 1] = h0 * sy;
|
|
2280
|
+
|
|
2281
|
+
f32v[offset + (stride * 3)] = w1 * sx;
|
|
2282
|
+
f32v[offset + (stride * 3) + 1] = h0 * sy;
|
|
2283
|
+
`,dynamic:!1},position:{attributeName:"aPosition",format:"float32x2",code:`
|
|
2284
|
+
var x = p.x;
|
|
2285
|
+
var y = p.y;
|
|
2286
|
+
|
|
2287
|
+
f32v[offset] = x;
|
|
2288
|
+
f32v[offset + 1] = y;
|
|
2289
|
+
|
|
2290
|
+
f32v[offset + stride] = x;
|
|
2291
|
+
f32v[offset + stride + 1] = y;
|
|
2292
|
+
|
|
2293
|
+
f32v[offset + (stride * 2)] = x;
|
|
2294
|
+
f32v[offset + (stride * 2) + 1] = y;
|
|
2295
|
+
|
|
2296
|
+
f32v[offset + (stride * 3)] = x;
|
|
2297
|
+
f32v[offset + (stride * 3) + 1] = y;
|
|
2298
|
+
`,dynamic:!0},rotation:{attributeName:"aRotation",format:"float32",code:`
|
|
2299
|
+
var rotation = p.rotation;
|
|
2300
|
+
|
|
2301
|
+
f32v[offset] = rotation;
|
|
2302
|
+
f32v[offset + stride] = rotation;
|
|
2303
|
+
f32v[offset + (stride * 2)] = rotation;
|
|
2304
|
+
f32v[offset + (stride * 3)] = rotation;
|
|
2305
|
+
`,dynamic:!1},uvs:{attributeName:"aUV",format:"float32x2",code:`
|
|
2306
|
+
var uvs = p.texture.uvs;
|
|
2307
|
+
|
|
2308
|
+
f32v[offset] = uvs.x0;
|
|
2309
|
+
f32v[offset + 1] = uvs.y0;
|
|
2310
|
+
|
|
2311
|
+
f32v[offset + stride] = uvs.x1;
|
|
2312
|
+
f32v[offset + stride + 1] = uvs.y1;
|
|
2313
|
+
|
|
2314
|
+
f32v[offset + (stride * 2)] = uvs.x2;
|
|
2315
|
+
f32v[offset + (stride * 2) + 1] = uvs.y2;
|
|
2316
|
+
|
|
2317
|
+
f32v[offset + (stride * 3)] = uvs.x3;
|
|
2318
|
+
f32v[offset + (stride * 3) + 1] = uvs.y3;
|
|
2319
|
+
`,dynamic:!1},color:{attributeName:"aColor",format:"unorm8x4",code:`
|
|
2320
|
+
const c = p.color;
|
|
2321
|
+
|
|
2322
|
+
u32v[offset] = c;
|
|
2323
|
+
u32v[offset + stride] = c;
|
|
2324
|
+
u32v[offset + (stride * 2)] = c;
|
|
2325
|
+
u32v[offset + (stride * 3)] = c;
|
|
2326
|
+
`,dynamic:!1}};N.add(hh),N.add(dh),N.add(ch);var UI=Object.defineProperty,$I=Object.defineProperties,kI=Object.getOwnPropertyDescriptors,ya=Object.getOwnPropertySymbols,$T=Object.prototype.hasOwnProperty,kT=Object.prototype.propertyIsEnumerable,LT=(r,t,e)=>t in r?UI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ri=(r,t)=>{for(var e in t||(t={}))$T.call(t,e)&<(r,e,t[e]);if(ya)for(var e of ya(t))kT.call(t,e)&<(r,e,t[e]);return r},NT=(r,t)=>$I(r,kI(t)),LI=(r,t)=>{var e={};for(var i in r)$T.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ya)for(var i of ya(r))t.indexOf(i)<0&&kT.call(r,i)&&(e[i]=r[i]);return e};const NI=new Mt(0,0,0,0),XT=class Gh extends Se{constructor(t={}){t=NT(ri(ri({},Gh.defaultOptions),t),{dynamicProperties:ri(ri({},Gh.defaultOptions.dynamicProperties),t==null?void 0:t.dynamicProperties)});const e=t,{dynamicProperties:i,shader:n,roundPixels:s,texture:a,particles:o}=e,l=LI(e,["dynamicProperties","shader","roundPixels","texture","particles"]);super(ri({label:"ParticleContainer"},l)),this.renderPipeId="particle",this.batched=!1,this._childrenDirty=!1,this.texture=a||null,this.shader=n,this._properties={};for(const u in ph){const c=ph[u],h=i[u];this._properties[u]=NT(ri({},c),{dynamic:h})}this.allowChildren=!0,this.roundPixels=s!=null?s:!1,this.particleChildren=o!=null?o:[]}addParticle(...t){for(let e=0;e<t.length;e++)this.particleChildren.push(t[e]);return this.onViewUpdate(),t[0]}removeParticle(...t){let e=!1;for(let i=0;i<t.length;i++){const n=this.particleChildren.indexOf(t[i]);n>-1&&(this.particleChildren.splice(n,1),e=!0)}return e&&this.onViewUpdate(),t[0]}update(){this._childrenDirty=!0}onViewUpdate(){this._childrenDirty=!0,super.onViewUpdate()}get bounds(){return NI}updateBounds(){}destroy(t=!1){var e,i,n;if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const s=typeof t=="boolean"?t:t==null?void 0:t.textureSource,a=(i=this.texture)!=null?i:(e=this.particleChildren[0])==null?void 0:e.texture;a&&a.destroy(s)}this.texture=null,(n=this.shader)==null||n.destroy()}removeParticles(t,e){t!=null||(t=0),e!=null||(e=this.particleChildren.length);const i=this.particleChildren.splice(t,e-t);return this.onViewUpdate(),i}removeParticleAt(t){const e=this.particleChildren.splice(t,1);return this.onViewUpdate(),e[0]}addParticleAt(t,e){return this.particleChildren.splice(e,0,t),this.onViewUpdate(),t}addChild(...t){throw new Error("ParticleContainer.addChild() is not available. Please use ParticleContainer.addParticle()")}removeChild(...t){throw new Error("ParticleContainer.removeChild() is not available. Please use ParticleContainer.removeParticle()")}removeChildren(t,e){throw new Error("ParticleContainer.removeChildren() is not available. Please use ParticleContainer.removeParticles()")}removeChildAt(t){throw new Error("ParticleContainer.removeChildAt() is not available. Please use ParticleContainer.removeParticleAt()")}getChildAt(t){throw new Error("ParticleContainer.getChildAt() is not available. Please use ParticleContainer.getParticleAt()")}setChildIndex(t,e){throw new Error("ParticleContainer.setChildIndex() is not available. Please use ParticleContainer.setParticleIndex()")}getChildIndex(t){throw new Error("ParticleContainer.getChildIndex() is not available. Please use ParticleContainer.getParticleIndex()")}addChildAt(t,e){throw new Error("ParticleContainer.addChildAt() is not available. Please use ParticleContainer.addParticleAt()")}swapChildren(t,e){throw new Error("ParticleContainer.swapChildren() is not available. Please use ParticleContainer.swapParticles()")}reparentChild(...t){throw new Error("ParticleContainer.reparentChild() is not available with the particle container")}reparentChildAt(t,e){throw new Error("ParticleContainer.reparentChildAt() is not available with the particle container")}};XT.defaultOptions={dynamicProperties:{vertex:!1,position:!0,rotation:!1,uvs:!1,color:!1},roundPixels:!1};let XI=XT;class fh{constructor(t){this._renderer=t}validateRenderable(t){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){var e,i,n,s,a,o;const l=this._renderer,u=l.canvasContext,c=u.activeContext;c.save();const h=t.groupTransform,p=l._roundPixels|t._roundPixels;u.setContextTransform(h,p===1),u.setBlendMode(t.groupBlendMode);const f=(i=(e=l.globalUniforms.globalUniformData)==null?void 0:e.worldColor)!=null?i:4294967295,m=t.groupColorAlpha,g=(f>>>24&255)/255,_=(m>>>24&255)/255,y=(s=(n=l.filter)==null?void 0:n.alphaMultiplier)!=null?s:1,b=g*_*y;if(b<=0){c.restore();return}c.globalAlpha=b;const x=f&16777215,v=m&16777215,w=xe(Oe(v,x)),T=t.texture,E=Q.getCanvasSource(T);if(!E){c.restore();return}const P=u.smoothProperty,M=T.source.style.scaleMode!=="nearest";c[P]!==M&&(c[P]=M);const C=w!==16777215||T.rotate!==0,A=C?Q.getTintedCanvas({texture:T},w):E,{leftWidth:G,topHeight:F,rightWidth:R,bottomHeight:B,width:O,height:I}=t,L=G+R,j=F+B,J=Math.min(L>O?O/L:1,j>I?I/j:1,1),K=G*J,X=R*J,k=F*J,$=B*J,z=Math.max(0,O-K-X),rt=Math.max(0,I-k-$),_t=t.anchor,et=(o=(a=T.source._resolution)!=null?a:T.source.resolution)!=null?o:1;let st=T.frame.x*et,nt=T.frame.y*et;const ot=-_t.x*O,gt=-_t.y*I,yt=G*et,pt=F*et,Y=R*et,Rt=B*et;let Ct=T.frame.width*et,ce=T.frame.height*et;C&&(st=0,nt=0,Ct=A.width,ce=A.height),c.drawImage(A,st,nt,yt,pt,ot,gt,K,k),c.drawImage(A,st+yt,nt,Ct-yt-Y,pt,ot+K,gt,z,k),c.drawImage(A,st+Ct-Y,nt,Y,pt,ot+O-X,gt,X,k),c.drawImage(A,st,nt+pt,yt,ce-pt-Rt,ot,gt+k,K,rt),c.drawImage(A,st+yt,nt+pt,Ct-yt-Y,ce-pt-Rt,ot+K,gt+k,z,rt),c.drawImage(A,st+Ct-Y,nt+pt,Y,ce-pt-Rt,ot+O-X,gt+k,X,rt),c.drawImage(A,st,nt+ce-Rt,yt,Rt,ot,gt+I-$,K,$),c.drawImage(A,st+yt,nt+ce-Rt,Ct-yt-Y,Rt,ot+K,gt+I-$,z,$),c.drawImage(A,st+Ct-Y,nt+ce-Rt,Y,Rt,ot+O-X,gt+I-$,X,$),c.restore()}destroy(){this._renderer=null}}fh.extension={type:[S.CanvasPipes],name:"nineSliceSprite"};var jI=Object.defineProperty,jT=Object.getOwnPropertySymbols,HI=Object.prototype.hasOwnProperty,zI=Object.prototype.propertyIsEnumerable,HT=(r,t,e)=>t in r?jI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zT=(r,t)=>{for(var e in t||(t={}))HI.call(t,e)&&HT(r,e,t[e]);if(jT)for(var e of jT(t))zI.call(t,e)&&HT(r,e,t[e]);return r};const WT=class wa extends da{constructor(t={}){var e,i;t=zT(zT({},wa.defaultOptions),t),super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this._trimX=0,this._trimY=0,this._trimWidth=(e=t.originalWidth)!=null?e:wa.defaultOptions.originalWidth,this._trimHeight=(i=t.originalHeight)!=null?i:wa.defaultOptions.originalHeight,this.update(t)}update(t){var e,i,n,s,a,o,l,u,c,h,p,f,m,g,_,y,b,x;this.width=(e=t.width)!=null?e:this.width,this.height=(i=t.height)!=null?i:this.height,this._originalWidth=(n=t.originalWidth)!=null?n:this._originalWidth,this._originalHeight=(s=t.originalHeight)!=null?s:this._originalHeight,this._leftWidth=(a=t.leftWidth)!=null?a:this._leftWidth,this._rightWidth=(o=t.rightWidth)!=null?o:this._rightWidth,this._topHeight=(l=t.topHeight)!=null?l:this._topHeight,this._bottomHeight=(u=t.bottomHeight)!=null?u:this._bottomHeight,this._anchorX=(c=t.anchor)==null?void 0:c.x,this._anchorY=(h=t.anchor)==null?void 0:h.y,t.trim!==void 0?(this._trimX=(f=(p=t.trim)==null?void 0:p.x)!=null?f:0,this._trimY=(g=(m=t.trim)==null?void 0:m.y)!=null?g:0,this._trimWidth=(y=(_=t.trim)==null?void 0:_.width)!=null?y:this._originalWidth,this._trimHeight=(x=(b=t.trim)==null?void 0:b.height)!=null?x:this._originalHeight):(this._trimWidth=this._originalWidth,this._trimHeight=this._originalHeight),this.updateUvs(),this.updatePositions()}updatePositions(){const t=this.positions,{width:e,height:i,_leftWidth:n,_rightWidth:s,_topHeight:a,_bottomHeight:o,_anchorX:l,_anchorY:u}=this,c=n+s,h=e>c?1:e/c,p=a+o,f=i>p?1:i/p,m=Math.min(h,f),g=l*e,_=u*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=n*m-g,t[4]=t[12]=t[20]=t[28]=e-s*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-_,t[9]=t[11]=t[13]=t[15]=a*m-_,t[17]=t[19]=t[21]=t[23]=i-o*m-_,t[25]=t[27]=t[29]=t[31]=i-_,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs,e=this._originalWidth,i=this._originalHeight,n=this._trimX/e,s=this._trimY/i,a=(this._trimX+this._trimWidth)/e,o=(this._trimY+this._trimHeight)/i;t[0]=t[8]=t[16]=t[24]=n,t[1]=t[3]=t[5]=t[7]=s,t[6]=t[14]=t[22]=t[30]=a,t[25]=t[27]=t[29]=t[31]=o;const l=1/e,u=1/i;t[2]=t[10]=t[18]=t[26]=n+l*this._leftWidth,t[9]=t[11]=t[13]=t[15]=s+u*this._topHeight,t[4]=t[12]=t[20]=t[28]=a-l*this._rightWidth,t[17]=t[19]=t[21]=t[23]=o-u*this._bottomHeight,this.getBuffer("aUV").update()}};WT.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let Ke=WT;class VT extends ys{constructor(){super(),this.geometry=new Ke}destroy(){this.geometry.destroy()}}class mh{constructor(t){this._renderer=t,this._managedSprites=new Ut({renderer:t,type:"renderable",name:"nineSliceSprite"})}addRenderable(t,e){const i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return t._gpuData[this._renderer.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=t._gpuData[this._renderer.uid]=new VT,i=e;return i.renderable=t,i.transform=t.groupTransform,i.texture=t._texture,i.roundPixels=this._renderer._roundPixels|t._roundPixels,this._managedSprites.add(t),t.didViewUpdate||this._updateBatchableSprite(t,i),e}destroy(){this._managedSprites.destroy(),this._renderer=null}}mh.extension={type:[S.WebGLPipes,S.WebGPUPipes],name:"nineSliceSprite"},N.add(fh),N.add(mh);var WI=Object.defineProperty,ba=Object.getOwnPropertySymbols,YT=Object.prototype.hasOwnProperty,KT=Object.prototype.propertyIsEnumerable,qT=(r,t,e)=>t in r?WI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,VI=(r,t)=>{for(var e in t||(t={}))YT.call(t,e)&&qT(r,e,t[e]);if(ba)for(var e of ba(t))KT.call(t,e)&&qT(r,e,t[e]);return r},YI=(r,t)=>{var e={};for(var i in r)YT.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ba)for(var i of ba(r))t.indexOf(i)<0&&KT.call(r,i)&&(e[i]=r[i]);return e};const ZT=class sS extends Se{constructor(t){var e,i,n,s,a,o,l,u,c,h;t instanceof D&&(t={texture:t});const p=t,{width:f,height:m,anchor:g,leftWidth:_,rightWidth:y,topHeight:b,bottomHeight:x,texture:v,roundPixels:w}=p,T=YI(p,["width","height","anchor","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]);super(VI({label:"NineSliceSprite"},T)),this.renderPipeId="nineSliceSprite",this.batched=!0,this._leftWidth=(i=_!=null?_:(e=v==null?void 0:v.defaultBorders)==null?void 0:e.left)!=null?i:Ke.defaultOptions.leftWidth,this._topHeight=(s=b!=null?b:(n=v==null?void 0:v.defaultBorders)==null?void 0:n.top)!=null?s:Ke.defaultOptions.topHeight,this._rightWidth=(o=y!=null?y:(a=v==null?void 0:v.defaultBorders)==null?void 0:a.right)!=null?o:Ke.defaultOptions.rightWidth,this._bottomHeight=(u=x!=null?x:(l=v==null?void 0:v.defaultBorders)==null?void 0:l.bottom)!=null?u:Ke.defaultOptions.bottomHeight,this._width=(c=f!=null?f:v.width)!=null?c:Ke.defaultOptions.width,this._height=(h=m!=null?m:v.height)!=null?h:Ke.defaultOptions.height,this.allowChildren=!1,this.texture=v!=null?v:sS.defaultOptions.texture,this.roundPixels=w!=null?w:!1,this._anchor=new bt({_onUpdate:()=>{this.onViewUpdate()}}),g?this.anchor=g:this.texture.defaultAnchor&&(this.anchor=this.texture.defaultAnchor)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return this._width}set width(t){this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this._height=t,this.onViewUpdate()}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=D.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}get trim(){var t;return(t=this._texture.trim)!=null?t:null}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}updateBounds(){const t=this._bounds,e=this._anchor,i=this._width,n=this._height;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}};ZT.defaultOptions={texture:D.EMPTY};let QT=ZT;class KI extends QT{constructor(...t){let e=t[0];e instanceof D&&(e={texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}),super(e)}}class JT extends fu{constructor(t,e){var i;super();const{textures:n,data:s}=t;Object.keys(s.pages).forEach(a=>{const o=s.pages[parseInt(a,10)],l=n[o.id];this.pages.push({texture:l})}),Object.keys(s.chars).forEach(a=>{var o;const l=s.chars[a],{frame:u,source:c,rotate:h}=n[l.page],p=W.transformRectCoords(l,u,h,new ut),f=new D({frame:p,orig:new ut(0,0,l.width,l.height),source:c,rotate:h});this.chars[a]={id:a.codePointAt(0),xOffset:l.xOffset,yOffset:l.yOffset,xAdvance:l.xAdvance,kerning:(o=l.kerning)!=null?o:{},texture:f}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=(i=s.distanceField)!=null?i:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Jr.install(t)}static uninstall(t){Jr.uninstall(t)}}var qI={__proto__:null,BitmapFont:JT};function t1(r){const{text:t,style:e,chars:i}=r,n=e,s=Jr.getFont(t,n),a=St.graphemeSegmenter(t),o=Is(a,n,s,!0),l=o.scale,u=[],c=[],h=[],p=e.lineHeight?e.lineHeight:s.lineHeight*l;let f=0;for(const m of o.lines){if(m.chars.length===0)continue;const g=new dt({label:"line"});g.y=f,h.push(g);let _=new dt({label:"word"}),y=0;for(let b=0;b<m.chars.length;b++){const x=m.chars[b];if(!x||!s.chars[x])continue;const v=x===" ",w=b===m.chars.length-1;let T;i.length>0?(T=i.shift(),T.text=x,T.style=n,T.label=`char-${x}`,T.x=m.charPositions[b]*l-m.charPositions[y]*l):T=new Tu({text:x,style:n,label:`char-${x}`,x:m.charPositions[b]*l-m.charPositions[y]*l}),v||(u.push(T),_.addChild(T)),(v||w)&&_.children.length>0&&(_.x=m.charPositions[y]*l,c.push(_),g.addChild(_),_=new dt({label:"word"}),y=b+1)}f+=p}return{chars:u,lines:h,words:c}}var e1=Object.getOwnPropertySymbols,ZI=Object.prototype.hasOwnProperty,QI=Object.prototype.propertyIsEnumerable,JI=(r,t)=>{var e={};for(var i in r)ZI.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&e1)for(var i of e1(r))t.indexOf(i)<0&&QI.call(r,i)&&(e[i]=r[i]);return e};class gh extends dt{constructor(t){const e=t,{text:i,style:n,autoSplit:s,lineAnchor:a,wordAnchor:o,charAnchor:l}=e,u=JI(e,["text","style","autoSplit","lineAnchor","wordAnchor","charAnchor"]);super(u),this._dirty=!1,this._canReuseChars=!1,this.chars=[],this.words=[],this.lines=[],this._originalText=i,this._autoSplit=s,this._lineAnchor=a,this._wordAnchor=o,this._charAnchor=l,this.style=n}split(){const t=this.splitFn();this.chars=t.chars,this.words=t.words,this.lines=t.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(t){this._originalText=t,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(t,e,i){let n;typeof t=="number"?n={x:t,y:t}:n={x:t.x,y:t.y},e.forEach(s=>{const a=s.getLocalBounds(),o=a.minX+a.width*n.x,l=a.minY+a.height*n.y;s.origin.set(o,l)}),this[i]=t}get lineAnchor(){return this._lineAnchor}set lineAnchor(t){this._setOrigin(t,this.lines,"_lineAnchor")}get wordAnchor(){return this._wordAnchor}set wordAnchor(t){this._setOrigin(t,this.words,"_wordAnchor")}get charAnchor(){return this._charAnchor}set charAnchor(t){this._setOrigin(t,this.chars,"_charAnchor")}get style(){return this._style}set style(t){t||(t={}),this._style=new jt(t),this.styleChanged()}styleChanged(){this.words.forEach(t=>t.destroy()),this.words.length=0,this.lines.forEach(t=>t.destroy()),this.lines.length=0,this._canReuseChars=!0,this.onTextUpdate()}onTextUpdate(){this._dirty=!0,this._autoSplit&&this.split()}destroy(t){super.destroy(t),this.chars=[],this.words=[],this.lines=[],(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._originalText=""}}var tB=Object.defineProperty,eB=Object.defineProperties,rB=Object.getOwnPropertyDescriptors,r1=Object.getOwnPropertySymbols,iB=Object.prototype.hasOwnProperty,nB=Object.prototype.propertyIsEnumerable,i1=(r,t,e)=>t in r?tB(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qi=(r,t)=>{for(var e in t||(t={}))iB.call(t,e)&&i1(r,e,t[e]);if(r1)for(var e of r1(t))nB.call(t,e)&&i1(r,e,t[e]);return r},sB=(r,t)=>eB(r,rB(t));const n1=class Ea extends gh{constructor(t){var e,i,n;const s=Qi(Qi({},Ea.defaultOptions),t);(e=s.style)!=null||(s.style={}),(n=(i=s.style).fill)!=null||(i.fill=16777215),super(s)}static from(t,e){const i=sB(Qi(Qi({},Ea.defaultOptions),e),{text:t.text,style:new jt(t.style)});t.style.tagStyles&&(t.style._tagStyles=void 0);const n=new Ea(Qi({},i)),s=t.anchor;return(s.x!==0||s.y!==0)&&n.pivot.set(n.width*s.x,n.height*s.y),n}splitFn(){return t1({text:this._originalText,style:this._style,chars:this._canReuseChars?this.chars:[]})}};n1.defaultOptions={autoSplit:!0,lineAnchor:0,wordAnchor:0,charAnchor:0};let aB=n1;function s1(r,t,e){switch(r){case"center":return(e-t)/2;case"right":return e-t;default:return 0}}function _h(r){return r==="\r"||r===`
|
|
2327
|
+
`||r===`\r
|
|
2328
|
+
`}const oB=/^\s*$/;function lB(r,t){const e=[];let i=t.lines[0],n="",s=[],a=0;return r.forEach(o=>{const l=oB.test(o),u=_h(o),c=n.length===0&&l;l&&!u&&c&&(!i||!i.startsWith(o))||(u||(n+=o),s.push(o),n.length>=i.length&&(e.push({line:n,chars:s}),s=[],n="",a++,i=t.lines[a]))}),e}function a1(r){var t,e;const{text:i,style:n,chars:s}=r,a=n,o=St.measureText(i,a);if(o.runsByLine&&o.runsByLine.length>0)return uB(o,a,s,i);const l=St.graphemeSegmenter(i),u=lB(l,o),c=a.align,h=o.lineWidths.reduce((F,R)=>Math.max(F,R),0),p=(t=a._fill)==null?void 0:t.fill,f=(e=a._stroke)==null?void 0:e.fill,m=p instanceof $t,g=f instanceof $t,_=m||g,y=m&&p.textureSpace==="local"||g&&f.textureSpace==="local",b=o.width,x=o.height,v=a.clone();v.align="left";let w=0,T=0;if(v.trim){const{frame:F,canvasAndContext:R}=ye.getCanvasAndContext({text:i,style:a,resolution:1});ye.returnCanvasAndContext(R),w=-F.x,T=-F.y,v.trim=!1}const E=[],P=[],M=[];let C=0,A=0;const G=y?{width:b,height:x}:null;return u.forEach((F,R)=>{const B=new dt({label:`line-${R}`});B.y=C+T,P.push(B);const O=o.lineWidths[R];let I=s1(c,O,h),L=new dt({label:"word"});L.x=I+w;const j=St._context;j.font=v._fontString,St.experimentalLetterSpacingSupported&&(j.letterSpacing="0px",j.textLetterSpacing="0px");let J=F.line,K=j.measureText(J).width;if(F.chars.forEach(X=>{if(_h(X))return;J=J.slice(X.length);const k=J.length>0?j.measureText(J).width:0,$=K-k;if(K=k,$!==0)if(X===" ")L.children.length>0&&(M.push(L),B.addChild(L)),I+=$+a.letterSpacing,L=new dt({label:"word"}),L.x=I+w;else{let z=v;_&&(z=v.clone(),z._gradientOffset={x:-I,y:-C},G&&(z._gradientBounds=G));let rt;A<s.length?(rt=s[A++],rt.text=X,rt.style=z,rt.setFromMatrix(U.IDENTITY),rt.x=I-L.x+w):rt=new Wi({text:X,style:z,x:I-L.x+w}),E.push(rt),L.addChild(rt),I+=$+a.letterSpacing}}),L.children.length>0&&(M.push(L),B.addChild(L)),c==="justify"&&a.wordWrap&&R<u.length-1){const X=B.children,k=X.length-1;if(k>0){const $=(h-O)/k;for(let z=1;z<X.length;z++)X[z].x+=z*$}}C+=o.lineHeight}),{chars:E,lines:P,words:M}}function uB(r,t,e,i){const{runsByLine:n}=r,s=t.align,a=r.lineWidths.reduce((m,g)=>Math.max(m,g),0);let o=0,l=0;if(t.trim){const{frame:m,canvasAndContext:g}=ye.getCanvasAndContext({text:i,style:t,resolution:1});ye.returnCanvasAndContext(g),o=-m.x,l=-m.y}const u=[],c=[],h=[];let p=0,f=0;return n.forEach((m,g)=>{var _,y,b,x;const v=new dt({label:`line-${g}`});v.y=p+l,c.push(v);const w=r.lineWidths[g];let T=s1(s,w,a),E=new dt({label:"word"});E.x=T+o;for(const M of m){const C=M.style,A=(_=C._fill)==null?void 0:_.fill,G=(y=C._stroke)==null?void 0:y.fill,F=A instanceof $t,R=G instanceof $t,B=F||R,O=F&&A.textureSpace==="local"||R&&G.textureSpace==="local",I=St.graphemeSegmenter(M.text),L=C.clone();L.align="left",L.wordWrap=!1,L.trim&&(L.trim=!1),L.tagStyles=void 0,L._lineHeight=0;const j=St._context;j.font=L._fontString,St.experimentalLetterSpacingSupported&&(j.letterSpacing="0px",j.textLetterSpacing="0px");let J=M.text,K=j.measureText(J).width;const X=T,k=K,$=St.measureFont(L._fontString),z=C.lineHeight||$.fontSize,rt=O?{width:k,height:z}:null;for(const _t of I){J=J.slice(_t.length);const et=J.length>0?j.measureText(J).width:0,st=K-et;if(K=et,!_h(_t)&&st!==0)if(_t===" ")E.children.length>0&&(h.push(E),v.addChild(E)),T+=st+C.letterSpacing,E=new dt({label:"word"}),E.x=T+o;else{let nt=L;B&&(nt=L.clone(),O?(nt._gradientOffset={x:-(T-X),y:0},nt._gradientBounds=rt):nt._gradientOffset={x:-(T-X),y:0});let ot;f<e.length?(ot=e[f++],ot.text=_t,ot.style=nt,ot.setFromMatrix(U.IDENTITY),ot.x=T-E.x+o):ot=new Wi({text:_t,style:nt,x:T-E.x+o}),u.push(ot),E.addChild(ot),T+=st+C.letterSpacing}}}if(E.children.length>0&&(h.push(E),v.addChild(E)),s==="justify"&&t.wordWrap&&g<n.length-1){const M=v.children,C=M.length-1;if(C>0){const A=(a-w)/C;for(let G=1;G<M.length;G++)M[G].x+=G*A}}const P=(x=(b=r.lineHeights)==null?void 0:b[g])!=null?x:r.lineHeight;p+=P}),{chars:u,lines:c,words:h}}var cB=Object.defineProperty,hB=Object.defineProperties,dB=Object.getOwnPropertyDescriptors,o1=Object.getOwnPropertySymbols,pB=Object.prototype.hasOwnProperty,fB=Object.prototype.propertyIsEnumerable,l1=(r,t,e)=>t in r?cB(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ji=(r,t)=>{for(var e in t||(t={}))pB.call(t,e)&&l1(r,e,t[e]);if(o1)for(var e of o1(t))fB.call(t,e)&&l1(r,e,t[e]);return r},mB=(r,t)=>hB(r,dB(t));const u1=class Pa extends gh{constructor(t){const e=Ji(Ji({},Pa.defaultOptions),t);super(e)}static from(t,e){const i=mB(Ji(Ji({},Pa.defaultOptions),e),{text:t.text,style:new jt(t.style)}),n=new Pa(Ji({},i)),s=t.anchor;return(s.x!==0||s.y!==0)&&n.pivot.set(n.width*s.x,n.height*s.y),n}splitFn(){return a1({text:this._originalText,style:this._style,chars:this._canReuseChars?this.chars:[]})}};u1.defaultOptions={autoSplit:!0,lineAnchor:0,wordAnchor:0,charAnchor:0};let gB=u1;const c1=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];function _B(r){const t=[];let e=0;for(let i=0;i<c1.length;i++){const n=`_${c1[i]}`;t[e++]=r[n]}return e=h1(r._fill,t,e),e=bB(r._stroke,t,e),e=vB(r.dropShadow,t,e),e=yB(r.filters,t,e),t.join("-")}function yB(r,t,e){if(!r)return e;for(const i of r)t[e++]=i.uid;return e}function h1(r,t,e){var i;return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=(i=r.fill)==null?void 0:i.styleKey),e}function bB(r,t,e){return r&&(e=h1(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function vB(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=tt.shared.setValue(r.color).toNumber()),e}async function xB(r,t,e=200){const i=await t.extract.base64(r);t.type!==It.CANVAS&&await t.encoder.commandFinished;const n=e;console.log(`logging texture ${r.source.width}px ${r.source.height}px`);const s=["font-size: 1px;",`padding: ${n}px 300px;`,`background: url(${i}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}var TB=Object.defineProperty,SB=Object.defineProperties,wB=Object.getOwnPropertyDescriptors,d1=Object.getOwnPropertySymbols,EB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,p1=(r,t,e)=>t in r?TB(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,f1=(r,t)=>{for(var e in t||(t={}))EB.call(t,e)&&p1(r,e,t[e]);if(d1)for(var e of d1(t))PB.call(t,e)&&p1(r,e,t[e]);return r},AB=(r,t)=>SB(r,wB(t));const CB=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let MB=0;function m1(r,t=0,e={color:"#000000"}){r.renderGroup&&(e.color=CB[MB++]);let i="";for(let a=0;a<t;a++)i+=" ";let n=r.label;!n&&r instanceof pe&&(n=`sprite:${r.texture.label}`);let s=`%c ${i}|- ${n} (worldX:${r.worldTransform.tx}, relativeRenderX:${r.relativeGroupTransform.tx}, renderX:${r.groupTransform.tx}, localX:${r.x})`;r.renderGroup&&(s+=" (RenderGroup)"),r.filters&&(s+="(*filters)"),console.log(s,`color:${e.color}; font-weight:bold;`),t++;for(let a=0;a<r.children.length;a++){const o=r.children[a];m1(o,t,f1({},e))}}function g1(r,t=0,e={index:0,color:"#000000"}){let i="";for(let s=0;s<t;s++)i+=" ";const n=`%c ${i}- ${e.index}: ${r.root.label} worldX:${r.worldTransform.tx}`;console.log(n,`color:${e.color}; font-weight:bold;`),t++;for(let s=0;s<r.renderGroupChildren.length;s++){const a=r.renderGroupChildren[s];g1(a,t,AB(f1({},e),{index:s}))}}return d.AbstractBitmapFont=fu,d.AbstractBitmapTextPipe=_u,d.AbstractRenderer=Mr,d.AbstractSplitText=gh,d.AbstractText=Ps,d.AbstractTextSystem=hu,d.AccessibilitySystem=np,d.AlphaFilter=LC,d.AlphaMask=Qa,d.AlphaMaskPipe=ks,d.AnimatedSprite=Xi,d.Application=Gf,d.ApplicationInitHook=$o,d.Assets=Fi,d.AssetsClass=Yg,d.BLEND_TO_NPM=im,d.BREAKING_SPACES=ib,d.BREAKING_SPACES_SET=nb,d.BREAK_AFTER_CHARS=ob,d.BREAK_AFTER_CHARS_SET=lb,d.BUFFER_TYPE=Yi,d.BackgroundLoader=Ff,d.BackgroundSystem=yv,d.Batch=um,d.BatchGeometry=fm,d.BatchTextureArray=sm,d.BatchableGraphics=Kn,d.BatchableHTMLText=Kb,d.BatchableMesh=ys,d.BatchableSprite=zi,d.BatchableText=xb,d.Batcher=pm,d.BatcherPipe=$s,d.BigPool=Pt,d.BindGroup=Ee,d.BindGroupSystem=Fc,d.BitmapFont=JT,d.BitmapFontManager=Jr,d.BitmapText=Tu,d.BitmapTextGraphics=Rb,d.BitmapTextPipe=xu,d.BlendModeFilter=GC,d.BlendModePipe=Ws,d.BlurFilter=W_,d.BlurFilterPass=ds,d.Bounds=Mt,d.BrowserAdapter=pp,d.Buffer=Yt,d.BufferImageSource=fn,d.BufferResource=ia,d.BufferUsage=at,d.CLEAR=Kt,d.COLLAPSIBLE_SPACES=sb,d.COLLAPSIBLE_SPACES_SET=ab,d.Cache=it,d.CanvasBatchAdaptor=av,d.CanvasBitmapTextPipe=yu,d.CanvasColorMaskPipe=Bu,d.CanvasContextSystem=$u,d.CanvasFilterSystem=ho,d.CanvasGraphicsAdaptor=Nu,d.CanvasGraphicsContextSystem=fy,d.CanvasGraphicsPipe=ql,d.CanvasLimitsSystem=ku,d.CanvasNineSliceSpritePipe=fh,d.CanvasObserver=ja,d.CanvasParticleContainerAdaptor=ET,d.CanvasParticleContainerPipe=ch,d.CanvasPool=me,d.CanvasPoolClass=Gp,d.CanvasRenderTargetAdaptor=Qv,d.CanvasRenderTargetSystem=nc,d.CanvasRenderer=rx,d.CanvasRendererTextSystem=du,d.CanvasSource=fe,d.CanvasStencilMaskPipe=Du,d.CanvasTextGenerator=ye,d.CanvasTextMetrics=St,d.CanvasTextPipe=cu,d.CanvasTextSystem=pu,d.CanvasTextureSystem=sc,d.CanvasTilingSpritePipe=tu,d.Circle=Pn,d.Color=tt,d.ColorMask=Ja,d.ColorMaskPipe=Fu,d.ColorMatrixFilter=nM,d.CompressedSource=Di,d.Container=dt,d.CubeTexture=ca,d.CubeTextureSource=ei,d.Culler=x_,d.CullerPlugin=T_,d.CustomRenderPipe=Ls,d.D3D10_RESOURCE_DIMENSION=Dl,d.D3DFMT=qt,d.DATA_URI=jw,d.DDS=Z,d.DEG_TO_RAD=Jh,d.DEPRECATED_SCALE_MODES=eh,d.DEPRECATED_WRAP_MODES=th,d.DOMAdapter=H,d.DOMContainer=y2,d.DOMPipe=Va,d.DRAW_MODES=uG,d.DXGI_FORMAT=Fl,d.DXGI_TO_TEXTURE_FORMAT=Zt,d.DefaultBatcher=Vn,d.DefaultShader=el,d.DisplacementFilter=hM,d.DynamicBitmapFont=mu,d.Ellipse=An,d.EventBoundary=up,d.EventEmitter=Nt,d.EventSystem=Ka,d.EventsTicker=we,d.ExtensionType=S,d.ExternalSource=EG,d.ExtractSystem=xv,d.FOURCC_TO_TEXTURE_FORMAT=Ul,d.FederatedContainer=dp,d.FederatedEvent=Tr,d.FederatedMouseEvent=hi,d.FederatedPointerEvent=ae,d.FederatedWheelEvent=rr,d.FillGradient=$t,d.FillPattern=Xr,d.Filter=Pe,d.FilterEffect=oi,d.FilterPipe=po,d.FilterSystem=Co,d.FontStylePromiseCache=Ds,d.GAUSSIAN_VALUES=Xl,d.GCManagedHash=Ut,d.GCSystem=Gv,d.GL_FORMATS=ea,d.GL_INTERNAL_FORMAT=l_,d.GL_TARGETS=ra,d.GL_TYPES=ct,d.GL_WRAP_MODES=lx,d.GPUTextureGpuData=Kc,d.GenerateTextureSystem=Ku,d.Geometry=nr,d.GlBackBufferSystem=mx,d.GlBatchAdaptor=Ou,d.GlBuffer=ix,d.GlBufferSystem=ac,d.GlColorMaskSystem=hc,d.GlContextSystem=ox,d.GlEncoderSystem=dc,d.GlGeometryGpuData=hx,d.GlGeometrySystem=uc,d.GlGraphicsAdaptor=Ic,d.GlLimitsSystem=pc,d.GlMeshAdaptor=Bc,d.GlParticleContainerAdaptor=GT,d.GlParticleContainerPipe=hh,d.GlProgram=Wt,d.GlProgramData=Ex,d.GlRenderTarget=gx,d.GlRenderTargetAdaptor=Sx,d.GlRenderTargetSystem=vc,d.GlShaderSystem=Ec,d.GlStateSystem=kx,d.GlStencilSystem=fc,d.GlTexture=Ac,d.GlTextureSystem=Gc,d.GlUboSystem=bc,d.GlUniformGroupSystem=Pc,d.GlobalResourceRegistry=qe,d.GlobalUniformSystem=Zu,d.GpuBatchAdaptor=Gu,d.GpuBlendModesToPixi=Ht,d.GpuBufferData=a0,d.GpuBufferSystem=Dc,d.GpuColorMaskSystem=Uc,d.GpuDeviceSystem=oa,d.GpuEncoderSystem=$c,d.GpuGraphicsAdaptor=Qc,d.GpuGraphicsContext=qm,d.GpuLimitsSystem=kc,d.GpuMeshAdapter=Jc,d.GpuMipmapGenerator=S0,d.GpuParticleContainerAdaptor=IT,d.GpuParticleContainerPipe=dh,d.GpuProgram=Xt,d.GpuRenderTarget=g0,d.GpuRenderTargetAdaptor=_0,d.GpuRenderTargetSystem=Hc,d.GpuShaderSystem=zc,d.GpuStateSystem=Wc,d.GpuStencilModesToPixi=Ue,d.GpuStencilSystem=Lc,d.GpuTextureSystem=Zc,d.GpuUboSystem=Nc,d.GpuUniformBatchPipe=Xc,d.Graphics=hr,d.GraphicsContext=kt,d.GraphicsContextRenderData=Zm,d.GraphicsContextSystem=Jn,d.GraphicsGpuData=my,d.GraphicsPath=ge,d.GraphicsPipe=Zl,d.HTMLText=iv,d.HTMLTextPipe=Au,d.HTMLTextRenderData=Eu,d.HTMLTextStyle=Fs,d.HTMLTextSystem=Mu,d.HelloSystem=qs,d.IGLUniformData=s3,d.ImageSource=ke,d.InstructionSet=dn,d.KTX=Et,d.Loader=Vf,d.LoaderParserPriority=te,d.MaskEffectManager=ln,d.MaskEffectManagerClass=sd,d.MaskFilter=hy,d.Matrix=U,d.Mesh=Kr,d.MeshGeometry=ze,d.MeshGpuData=Ql,d.MeshPipe=Jl,d.MeshPlane=fI,d.MeshRope=SI,d.MeshSimple=RI,d.NEWLINES=eb,d.NEWLINES_SET=rb,d.NEWLINE_MATCH_REGEX=cb,d.NEWLINE_SPLIT_REGEX=ub,d.NOOP=Ua,d.NineSliceGeometry=Ke,d.NineSlicePlane=KI,d.NineSliceSprite=QT,d.NineSliceSpriteGpuData=VT,d.NineSliceSpritePipe=mh,d.NoiseFilter=_M,d.ObservablePoint=bt,d.PI_2=Zh,d.Particle=DI,d.ParticleBuffer=CT,d.ParticleContainer=XI,d.ParticleContainerPipe=Zi,d.ParticleShader=OT,d.PassthroughFilter=pf,d.PerspectiveMesh=oI,d.PerspectivePlaneGeometry=sT,d.PipelineSystem=jc,d.PlaneGeometry=da,d.Point=lt,d.Polygon=Pr,d.Pool=td,d.PoolGroupClass=ed,d.PrepareBase=py,d.PrepareQueue=Tb,d.PrepareSystem=sv,d.PrepareUpload=nv,d.QuadGeometry=$y,d.RAD_TO_DEG=Qh,d.Rectangle=ut,d.RenderContainer=GG,d.RenderGroup=mn,d.RenderGroupPipe=Xs,d.RenderGroupSystem=Hu,d.RenderLayer=VG,d.RenderTarget=Zs,d.RenderTargetSystem=Js,d.RenderTexture=Ks,d.RenderableGCSystem=$v,d.RendererInitHook=ko,d.RendererType=It,d.ResizePlugin=Lo,d.Resolver=$e,d.RopeGeometry=_T,d.RoundedRectangle=Mn,d.SCALE_MODES=hG,d.STENCIL_MODES=wt,d.SVGDefsCollector=N0,d.SVGParser=fg,d.SchedulerSystem=Qu,d.ScissorMask=DR,d.SdfShader=Db,d.Shader=ee,d.ShaderStage=Le,d.ShapePath=sg,d.SharedRenderPipes=ic,d.SharedSystems=Qs,d.SplitBitmapText=aB,d.SplitText=gB,d.Sprite=pe,d.SpritePipe=zs,d.Spritesheet=qa,d.State=Vt,d.StencilMask=to,d.StencilMaskPipe=Uu,d.SystemRunner=Fo,d.TEXTURE_FORMAT_BLOCK_SIZE=n_,d.Text=Wi,d.TextStyle=jt,d.Texture=D,d.TextureGCSystem=kv,d.TextureMatrix=$a,d.TexturePool=vt,d.TexturePoolClass=Dd,d.TextureSource=ft,d.TextureStyle=Jt,d.TextureUvs=PG,d.Ticker=Ot,d.TickerListener=yn,d.TickerPlugin=No,d.TilingSprite=Vy,d.TilingSpriteGpuData=Xy,d.TilingSpritePipe=iu,d.TilingSpriteShader=Uy,d.Transform=My,d.Triangle=lo,d.UNIFORM_TO_ARRAY_SETTERS=Fx,d.UNIFORM_TO_SINGLE_SETTERS=Bx,d.UNIFORM_TYPES_MAP=Qp,d.UNIFORM_TYPES_VALUES=_o,d.UPDATE_BLEND=_n,d.UPDATE_COLOR=ci,d.UPDATE_PRIORITY=Te,d.UPDATE_TRANSFORM=n2,d.UPDATE_VISIBLE=xr,d.UboBatch=o0,d.UboSystem=mc,d.UniformGroup=At,d.VERSION=Ai,d.VideoSource=wr,d.ViewContainer=Se,d.ViewSystem=Kv,d.ViewableBuffer=or,d.WGSL_ALIGN_SIZE_DATA=Ki,d.WGSL_TO_STD40_SIZE=gc,d.WRAP_MODES=cG,d.WebGLRenderer=s0,d.WebGPURenderer=R0,d.WorkerManager=El,d.accessibilityTarget=sp,d.addBits=Yo,d.addMaskBounds=Sn,d.addMaskLocalBounds=wn,d.addProgramDefines=Dp,d.alphaFrag=R_,d.alphaWgsl=Ll,d.appendSVGPath=xl,d.applyMatrix=Ly,d.applyProjectiveTransformationToPlane=tT,d.applyStyleParams=Rc,d.assignWithIgnore=gn,d.autoDetectEnvironment=vw,d.autoDetectRenderer=Cf,d.autoDetectSource=K2,d.basisTranscoderUrls=os,d.bgr2rgb=xe,d.bitmapFontCachePlugin=If,d.bitmapFontTextParser=$n,d.bitmapFontXMLParser=Xo,d.bitmapFontXMLStringParser=jo,d.bitmapTextSplit=t1,d.blendTemplateFrag=S_,d.blendTemplateVert=w_,d.blendTemplateWgsl=E_,d.blockDataMap=Vc,d.blurTemplateWgsl=$_,d.boundsPool=ve,d.browserExt=CC,d.buildAdaptiveBezier=hl,d.buildAdaptiveQuadratic=Jm,d.buildArc=fl,d.buildArcTo=tg,d.buildArcToSvg=rg,d.buildCircle=kr,d.buildContextBatches=Ym,d.buildEllipse=Bm,d.buildGeometryFromPath=jG,d.buildLine=Qn,d.buildPixelLine=$m,d.buildPolygon=km,d.buildRectangle=Lm,d.buildRoundedRectangle=Fm,d.buildSVGFillAttributes=H0,d.buildSVGPath=Ye,d.buildSVGStrokeAttributes=z0,d.buildSimpleUvs=il,d.buildTriangle=Nm,d.buildUvs=rl,d.cacheAsTextureMixin=rd,d.cacheTextureArray=Df,d.calculatePathArea=hg,d.calculateProjection=qv,d.canUseNewCanvasBlendModes=ao,d.canvasTextSplit=a1,d.canvasUtils=Q,d.checkChildrenDidChange=Ba,d.checkDataUrl=ar,d.checkExtension=le,d.checkForNestedPattern=ug,d.checkMaxIfStatementsInShader=Vo,d.childrenHelperMixin=id,d.cleanArray=Cv,d.cleanHash=Av,d.clearList=Vs,d.closePointEps=nl,d.collapseNewlines=Os,d.collapseSpaces=Rs,d.collectAllRenderables=IG,d.collectRenderablesMixin=nd,d.color32BitToUniform=Yr,d.colorBit=Xn,d.colorBitGl=jn,d.colorMatrixFilterFrag=V_,d.colorMatrixFilterWgsl=Hl,d.colorToUniform=AM,d.compareModeToGlCompare=Wx,d.compileHighShader=ym,d.compileHighShaderGl=bm,d.compileHighShaderGlProgram=Dr,d.compileHighShaderGpuProgram=Fr,d.compileHooks=Ko,d.compileInputs=qo,d.compileOutputs=_m,d.compileShader=xc,d.compute2DProjection=nT,d.convertFormatIfRequired=gC,d.convertToList=oe,d.copySearchParams=xn,d.createGlUploadCubeTextureResource=jx,d.createGpuUploadCubeTextureResource=x0,d.createIdFromString=Ar,d.createIndicesForQuads=lh,d.createLevelBuffers=CA,d.createLevelBuffersFromKTX=_C,d.createStringVariations=gp,d.createTexture=He,d.createUboElementsSTD40=_x,d.createUboElementsWGSL=h0,d.createUboSyncFunction=_c,d.createUboSyncFunctionSTD40=Tx,d.createUboSyncFunctionWGSL=p0,d.crossOrigin=Lg,d.cullingMixin=qh,d.curveEps=sl,d.defaultFilterVert=bi,d.defaultValue=Sc,d.definedProps=he,d.deprecation=Mi,d.detectAvif=Uf,d.detectBasis=uA,d.detectCompressed=wC,d.detectDefaults=kf,d.detectMp4=Lf,d.detectOgv=Nf,d.detectVideoAlphaMode=ro,d.detectWebm=Xf,d.detectWebp=jf,d.determineCrossOrigin=Xg,d.displacementFrag=q_,d.displacementVert=Z_,d.displacementWgsl=zl,d.earcut=xf,d.effectsMixin=ud,d.ensureAttributes=lc,d.ensureIsBuffer=Ao,d.ensurePrecision=Up,d.ensureTextOptions=As,d.executeInstructions=Ns,d.extensions=N,d.extractAttributesFromGlProgram=Cx,d.extractAttributesFromGpuProgram=Yp,d.extractFontFamilies=qb,d.extractStructAndGroups=Gn,d.extractSubpaths=cg,d.extractSvgUrlId=yl,d.fastCopy=Ln,d.findMixin=cd,d.fontStringFromTextStyle=Zr,d.formatShader=IR,d.fragmentGPUTemplate=Sm,d.fragmentGlTemplate=Em,d.generateArraySyncSTD40=xx,d.generateArraySyncWGSL=d0,d.generateBlurFragSource=F_,d.generateBlurGlProgram=U_,d.generateBlurProgram=k_,d.generateBlurVertSource=D_,d.generateGPULayout=OR,d.generateGpuLayoutGroups=Kp,d.generateLayout=GR,d.generateLayoutHash=qp,d.generateParticleUpdateFunction=PT,d.generateProgram=Ix,d.generateShaderSyncCode=wx,d.generateTextStyleKey=_B,d.generateTextureBatchBit=Hn,d.generateTextureBatchBitGl=zn,d.generateTextureMatrix=ll,d.generateUniformsSync=Dx,d.getAdjustedBlendModeBlend=Ir,d.getAttributeInfoFromFormat=Ie,d.getBatchSamplersUniformGroup=Wn,d.getBitmapTextLayout=Is,d.getCanvasBoundingBox=Jy,d.getCanvasFillStyle=pr,d.getCanvasTexture=ec,d.getCharacterGroups=lu,d.getDefaultUniformValue=Jp,d.getFastGlobalBounds=CG,d.getFastGlobalBoundsMixin=dd,d.getFillInstructionData=xP,d.getFontCss=Jb,d.getFontFamilyName=Qf,d.getGeometryBounds=ff,d.getGlTypeFromFormat=cx,d.getGlobalBounds=li,d.getGlobalMixin=md,d.getGlobalRenderableBounds=uo,d.getLocalBounds=hn,d.getMaxFragmentPrecision=Fp,d.getMaxMiterRatio=wg,d.getMaxTexturesPerBatch=nm,d.getOrientationOfPoints=Dm,d.getPlainText=rR,d.getPo2TextureFromSource=Rn,d.getResolutionOfUrl=je,d.getSVGUrl=tv,d.getSupportedCompressedTextureFormats=Bl,d.getSupportedGPUCompressedTextureFormats=Gl,d.getSupportedGlCompressedTextureFormats=Ol,d.getSupportedTextureFormats=Ui,d.getTemporaryCanvasFromImage=ev,d.getTestContext=mo,d.getTextureBatchBindGroup=kn,d.getTextureDefaultMatrix=OI,d.getTextureFormatFromKTXTexture=vC,d.getUboData=Mx,d.getUniformData=Rx,d.getUrlExtension=bp,d.glFormatToGPUFormat=b_,d.glUploadBufferImageResource=Lx,d.glUploadCompressedTextureResource=Nx,d.glUploadImageResource=Cc,d.glUploadVideoResource=Hx,d.globalUniformsBit=Pm,d.globalUniformsBitGl=Am,d.globalUniformsUBOBitGl=UE,d.gpuFormatToBasisTranscoderFormat=RA,d.gpuFormatToKTXBasisTranscoderFormat=TC,d.gpuUploadBufferImageResource=y0,d.gpuUploadCompressedTextureResource=b0,d.gpuUploadImageResource=Yc,d.gpuUploadVideoResource=T0,d.graphicsContextToSvg=XG,d.groupD8=W,d.hasCachedCanvasTexture=IO,d.hasTagMarkup=Ms,d.hasTagStyles=Cs,d.hslWgsl=wM,d.hslgl=IC,d.hslgpu=BC,d.injectBits=Zo,d.insertVersion=$p,d.isBreakAfterChar=au,d.isBreakingSpace=Qt,d.isCanvasFilterCapable=co,d.isCollapsibleSpace=su,d.isMobile=Zd,d.isNewline=Hi,d.isPow2=Fa,d.isRenderingToScreen=Zv,d.isSafari=Cu,d.isSingleItem=fi,d.isWebGLSupported=Ei,d.isWebGPUSupported=Pi,d.ktxTranscoderUrls=ls,d.loadBasis=AA,d.loadBasisOnWorker=e_,d.loadBitmapFont=Bf,d.loadDDS=HA,d.loadEnvironmentExtensions=Ro,d.loadFontAsBase64=Zb,d.loadFontCSS=Qb,d.loadImageBitmap=Dg,d.loadJson=Yf,d.loadKTX=nC,d.loadKTX2=mC,d.loadKTX2onWorker=m_,d.loadSVGImage=rv,d.loadSvg=Og,d.loadTextures=Pl,d.loadTxt=Kf,d.loadVideoTextures=jg,d.loadWebFont=Jf,d.localUniformBit=qr,d.localUniformBitGl=Ts,d.localUniformBitGroup2=By,d.localUniformMSDFBit=Gb,d.localUniformMSDFBitGl=Ib,d.log2=BS,d.logDebugTexture=xB,d.logProgramError=Gx,d.logRenderGroupScene=g1,d.logScene=m1,d.mSDFBit=Bb,d.mSDFBitGl=Fb,d.mapCanvasBlendModesToPixi=cv,d.mapFormatToGlFormat=Vx,d.mapFormatToGlInternalFormat=qx,d.mapFormatToGlType=Zx,d.mapGlToVertexFormat=Ax,d.mapSize=u3,d.mapType=wc,d.mapViewDimensionToGlTarget=Qx,d.mapWebGLBlendModesToPixi=Ux,d.maskFrag=ay,d.maskVert=oy,d.maskWgsl=Yl,d.matrixPool=Dt,d.measureHtmlText=Pu,d.measureMixin=_d,d.measureTaggedText=hb,d.migrateFragmentFromV7toV8=o3,d.mipmapScaleModeToGlFilter=zx,d.multiplyColors=ui,d.multiplyHexColors=Oe,d.nextPow2=Ze,d.noiseFrag=ey,d.noiseWgsl=Wl,d.nonCompressedFormats=Qg,d.normalizeExtensionPriority=ni,d.onRenderMixin=yd,d.parseDDS=s_,d.parseFunctionBody=AG,d.parseKTX=u_,d.parseSVGDefinitions=og,d.parseSVGFloatAttribute=Tt,d.parseSVGPath=tm,d.parseSVGStyle=vl,d.parseTaggedText=nu,d.particleData=ph,d.particlesFrag=MT,d.particlesVert=RT,d.particlesWgsl=uh,d.passthroughFrag=df,d.passthroughWgsl=Po,d.path=zt,d.pointInTriangle=oo,d.preloadVideo=Ng,d.removeItems=Ia,d.removeStructAndGroupDuplicates=Zp,d.resetUids=AS,d.resolveCharacters=Ab,d.resolveCompressedTextureUrl=SC,d.resolveJsonUrl=Hg,d.resolveTextureUrl=Rl,d.resourceToTexture=Mp,d.roundPixelsBit=Ur,d.roundPixelsBitGl=$r,d.roundedShapeArc=ig,d.roundedShapeQuadraticCurve=ng,d.sayHello=Bv,d.scaleModeToGlFilter=Mc,d.setBasisTranscoderPath=yA,d.setKTXTranscoderPath=aC,d.setPositions=ky,d.setProgramName=kp,d.setUvs=Ny,d.shapeBuilders=Ne,d.sortMixin=bd,d.spritesheetAsset=Tp,d.squaredDistanceToLineSegment=mi,d.stripVersion=Lp,d.styleAttributes=bl,d.testImageFormat=Ho,d.testVideoFormat=Ci,d.textStyleToCSS=kb,d.textureBit=ov,d.textureBitGl=lv,d.textureFrom=Rp,d.tilingBit=Fy,d.tilingBitGl=Dy,d.toFillStyle=Xe,d.toLocalGlobalMixin=vd,d.toStrokeStyle=Bi,d.tokenize=ou,d.tokenizeTaggedRuns=pb,d.transformVertices=Yn,d.triangulateWithHoles=al,d.trimRight=Ce,d.uboSyncFunctionsSTD40=yc,d.uboSyncFunctionsWGSL=vx,d.uid=ht,d.uniformParsers=We,d.unpremultiplyAlpha=P3,d.unsafeEvalSupported=Oo,d.updateLocalTransform=BG,d.updateQuadBounds=Za,d.updateRenderGroupTransform=dv,d.updateRenderGroupTransforms=Xu,d.updateTextBounds=Gs,d.updateTransformAndChildren=ju,d.updateTransformBackwards=cn,d.updateWorldTransform=FG,d.v8_0_0=Wo,d.v8_3_4=wE,d.validFormats=us,d.validateRenderables=fv,d.vertexGPUTemplate=Tm,d.vertexGlTemplate=wm,d.vkFormatToGPUFormat=v_,d.warn=ue,d.wordWrap=mb,d.wordWrapTaggedLines=db,d.wrapModeToGlAddress=aa,d})({});
|
|
2329
|
+
//# sourceMappingURL=pixi.min.js.map
|