@vgai/editor 0.2.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/LICENSE +661 -0
- package/README.md +35 -0
- package/dist/a/b/c/test-nested.json +1 -0
- package/dist/assets/CCDIKSolver-Dz-ysxZF.js +1 -0
- package/dist/assets/SelectionBox-BXsv_6aH.js +1 -0
- package/dist/assets/browser-project-scripts-DOru4L1x.js +2 -0
- package/dist/assets/browserAll-CEkWYlFk.js +1 -0
- package/dist/assets/collision-world-DniMB0qq.glb +0 -0
- package/dist/assets/create-runtime-DYIWr3va.js +1 -0
- package/dist/assets/data-asset-Bb9sIM7i.js +5 -0
- package/dist/assets/esbuild-BHljloGq.wasm +0 -0
- package/dist/assets/fake-three-BMTQ9rl_.js +1 -0
- package/dist/assets/game-8SDZPPgH.js +1 -0
- package/dist/assets/game-BI111o5f.js +10 -0
- package/dist/assets/game-CevorxyV.js +1 -0
- package/dist/assets/game-Di1H0gFj.js +1 -0
- package/dist/assets/game-Di7XlywD.js +1 -0
- package/dist/assets/game-DjnCaw8R.js +1 -0
- package/dist/assets/game-Q9A0aXSV.js +1 -0
- package/dist/assets/game-pt_1lQLv.js +1 -0
- package/dist/assets/game-source-CvidN7AB.js +1 -0
- package/dist/assets/game-xsOho_wg.js +83 -0
- package/dist/assets/index-Bp5cecD6.js +12 -0
- package/dist/assets/index-CPVV6pjw.js +1 -0
- package/dist/assets/index-CpOnYyeD.js +213 -0
- package/dist/assets/index-Cs8xwv3e.js +1 -0
- package/dist/assets/index-DL7RcQ0n.js +27 -0
- package/dist/assets/index-Dr8H_6Rl.js +1 -0
- package/dist/assets/index-_bCaipUk.js +13650 -0
- package/dist/assets/ingest-siblings-Dz8eEqrV.js +1 -0
- package/dist/assets/mount-manifest-Bhk0ohsl.js +1 -0
- package/dist/assets/recast-navigation.wasm-compat-CvP4UGK6.js +1 -0
- package/dist/assets/scene-query-BivAHhJu.js +1 -0
- package/dist/assets/stats.module--VATS4Kh.js +1 -0
- package/dist/assets/webworkerAll-BLrH0F6F.js +1 -0
- package/dist/assets/xstate-animation-binding-1NGLmw6y.js +1 -0
- package/dist/assets/xstate.esm-BgUD33nl.js +3 -0
- package/dist/index.html +37 -0
- package/dist/ingest/racing-game/UPSTREAM.md +68 -0
- package/dist/ingest/racing-game/a/Inter-Black.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Black.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-BlackItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-BlackItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Bold.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Bold.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-BoldItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-BoldItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBold.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBold.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBoldItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraBoldItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLight.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLight.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLightItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ExtraLightItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Italic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Italic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Light.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Light.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-LightItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-LightItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Medium.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Medium.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-MediumItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-MediumItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Regular.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Regular.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBold.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBold.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBoldItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-SemiBoldItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-Thin.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-Thin.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-ThinItalic.woff +0 -0
- package/dist/ingest/racing-game/a/Inter-ThinItalic.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-italic.var.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter-roman.var.woff2 +0 -0
- package/dist/ingest/racing-game/a/Inter.var.woff2 +0 -0
- package/dist/ingest/racing-game/a/index.css +1 -0
- package/dist/ingest/racing-game/images/bronze.png +0 -0
- package/dist/ingest/racing-game/images/gold.png +0 -0
- package/dist/ingest/racing-game/images/silver.png +0 -0
- package/dist/ingest/racing-game/index.html +15 -0
- package/dist/ingest/racing-game/models/chassis-draco.glb +0 -0
- package/dist/ingest/racing-game/models/track-draco.glb +0 -0
- package/dist/ingest/racing-game/models/wheel-draco.glb +0 -0
- package/dist/ingest/racing-game/rg-entry.js +1 -0
- package/dist/ingest/racing-game/sounds/accelerate.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/boost.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/crash.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/engine.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/honk.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/tire-brake.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/train.mp3 +0 -0
- package/dist/ingest/racing-game/sounds/water.mp3 +0 -0
- package/dist/ingest/racing-game/textures/cursor.svg +3 -0
- package/dist/ingest/racing-game/textures/dikhololo_night_1k.hdr +0 -0
- package/dist/ingest/racing-game/textures/heightmap_1024.png +0 -0
- package/dist/ingest/racing-game/textures/mask.svg +11 -0
- package/dist/ingest/racing-game/textures/no_sound.png +0 -0
- package/dist/ingest/racing-game/three-r139.module.js +50617 -0
- package/dist/ingest/racing-game/vendor.js +179 -0
- package/dist/ingest/racing-game/vgai.game.json +20 -0
- package/dist/ingest/simcity/UPSTREAM.md +65 -0
- package/dist/ingest/simcity/favicon.ico +0 -0
- package/dist/ingest/simcity/fonts/Bebas-Regular.otf +0 -0
- package/dist/ingest/simcity/fonts/Digitalt.otf +0 -0
- package/dist/ingest/simcity/fonts/Stanberry.ttf +0 -0
- package/dist/ingest/simcity/icons/bulldozer-color.png +0 -0
- package/dist/ingest/simcity/icons/bulldozer.png +0 -0
- package/dist/ingest/simcity/icons/calendar.png +0 -0
- package/dist/ingest/simcity/icons/factory-color.png +0 -0
- package/dist/ingest/simcity/icons/factory.png +0 -0
- package/dist/ingest/simcity/icons/house-color.png +0 -0
- package/dist/ingest/simcity/icons/house.png +0 -0
- package/dist/ingest/simcity/icons/job.png +0 -0
- package/dist/ingest/simcity/icons/office.png +0 -0
- package/dist/ingest/simcity/icons/pause-color.png +0 -0
- package/dist/ingest/simcity/icons/pause.png +0 -0
- package/dist/ingest/simcity/icons/person.png +0 -0
- package/dist/ingest/simcity/icons/play-color.png +0 -0
- package/dist/ingest/simcity/icons/play.png +0 -0
- package/dist/ingest/simcity/icons/power-color.png +0 -0
- package/dist/ingest/simcity/icons/power-line-color.png +0 -0
- package/dist/ingest/simcity/icons/power.png +0 -0
- package/dist/ingest/simcity/icons/road-color.png +0 -0
- package/dist/ingest/simcity/icons/road.png +0 -0
- package/dist/ingest/simcity/icons/select-color.png +0 -0
- package/dist/ingest/simcity/icons/select.png +0 -0
- package/dist/ingest/simcity/icons/store-color.png +0 -0
- package/dist/ingest/simcity/index.html +94 -0
- package/dist/ingest/simcity/index.js +58 -0
- package/dist/ingest/simcity/main.css +233 -0
- package/dist/ingest/simcity/models/armored-truck.glb +0 -0
- package/dist/ingest/simcity/models/building-block-4floor-corner.glb +0 -0
- package/dist/ingest/simcity/models/building-block-4floor-short.glb +0 -0
- package/dist/ingest/simcity/models/building-block-5floor.glb +0 -0
- package/dist/ingest/simcity/models/building-burger-joint.glb +0 -0
- package/dist/ingest/simcity/models/building-cafe.glb +0 -0
- package/dist/ingest/simcity/models/building-casino.glb +0 -0
- package/dist/ingest/simcity/models/building-cinema.glb +0 -0
- package/dist/ingest/simcity/models/building-house-block-big.glb +0 -0
- package/dist/ingest/simcity/models/building-house-family-large.glb +0 -0
- package/dist/ingest/simcity/models/building-house-family-small.glb +0 -0
- package/dist/ingest/simcity/models/building-office-balcony.glb +0 -0
- package/dist/ingest/simcity/models/building-office-big.glb +0 -0
- package/dist/ingest/simcity/models/building-office-pyramid.glb +0 -0
- package/dist/ingest/simcity/models/building-office-tall.glb +0 -0
- package/dist/ingest/simcity/models/building-office.glb +0 -0
- package/dist/ingest/simcity/models/building-restaurant.glb +0 -0
- package/dist/ingest/simcity/models/building-skyscraper.glb +0 -0
- package/dist/ingest/simcity/models/car-ambulance-pickup.glb +0 -0
- package/dist/ingest/simcity/models/car-baywatch.glb +0 -0
- package/dist/ingest/simcity/models/car-hippie-van.glb +0 -0
- package/dist/ingest/simcity/models/car-passenger-race.glb +0 -0
- package/dist/ingest/simcity/models/car-passenger.glb +0 -0
- package/dist/ingest/simcity/models/car-police.glb +0 -0
- package/dist/ingest/simcity/models/car-taxi.glb +0 -0
- package/dist/ingest/simcity/models/car-tow-truck.glb +0 -0
- package/dist/ingest/simcity/models/car-truck-dump.glb +0 -0
- package/dist/ingest/simcity/models/car-veteran.glb +0 -0
- package/dist/ingest/simcity/models/construction-small.glb +0 -0
- package/dist/ingest/simcity/models/data-center.glb +0 -0
- package/dist/ingest/simcity/models/industry-factory-old.glb +0 -0
- package/dist/ingest/simcity/models/industry-factory.glb +0 -0
- package/dist/ingest/simcity/models/industry-refinery.glb +0 -0
- package/dist/ingest/simcity/models/industry-warehouse.glb +0 -0
- package/dist/ingest/simcity/models/power_line_pole_modified.glb +0 -0
- package/dist/ingest/simcity/models/tile-plain_grass.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-curve.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-end.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-intersection-t.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-intersection.glb +0 -0
- package/dist/ingest/simcity/models/tile-road-straight.glb +0 -0
- package/dist/ingest/simcity/models/truck.glb +0 -0
- package/dist/ingest/simcity/statusIcons/no-power.png +0 -0
- package/dist/ingest/simcity/statusIcons/no-road-access.png +0 -0
- package/dist/ingest/simcity/textures/base.png +0 -0
- package/dist/ingest/simcity/textures/grid.png +0 -0
- package/dist/ingest/simcity/textures/specular.png +0 -0
- package/dist/ingest/simcity/three-r155.module.js +51466 -0
- package/dist/ingest/simcity/vgai.game.json +20 -0
- package/dist/ingest/tanks/UPSTREAM.md +69 -0
- package/dist/ingest/tanks/index.html +214 -0
- package/dist/ingest/tanks/models/pixelTank.fbx +0 -0
- package/dist/ingest/tanks/tanks-entry.js +92 -0
- package/dist/ingest/tanks/three-r170.module.js +54571 -0
- package/dist/ingest/tanks/vgai.game.json +20 -0
- package/dist/inputmaps/default.inputmap.json +41 -0
- package/dist/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/dist/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/dist/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/dist/scenes/untitled.vscn.json +29 -0
- package/dist/textures/waternormals.jpg +0 -0
- package/dist-server/packaged.mjs +18155 -0
- package/package.json +36 -0
- package/server/asset-library-routes.ts +833 -0
- package/server/canonical-path.ts +50 -0
- package/server/cloud-asset-catalog.ts +101 -0
- package/server/dev.ts +350 -0
- package/server/editor-server.ts +1537 -0
- package/server/editor-sse.ts +73 -0
- package/server/game-globals-shadow.ts +58 -0
- package/server/local-asset-catalog.ts +163 -0
- package/server/packaged.ts +571 -0
- package/server/prod.ts +75 -0
- package/server/project-optimize-deps-entries.ts +149 -0
- package/server/project-view.ts +65 -0
- package/server/server-utils.ts +430 -0
- package/server/session-registry.ts +93 -0
- package/src/EditorContext.tsx +87 -0
- package/src/achieved-tier.ts +126 -0
- package/src/action-registry.ts +268 -0
- package/src/adapter-resolver.ts +1858 -0
- package/src/asset-events.ts +100 -0
- package/src/authoring/active-adapter.ts +98 -0
- package/src/authoring/active-systems.ts +50 -0
- package/src/authoring/boundary-authoring-adapter.ts +178 -0
- package/src/authoring/composite-authoring-adapter.ts +891 -0
- package/src/authoring/design-time-layers.ts +776 -0
- package/src/authoring/edit-mode-authoring.ts +643 -0
- package/src/authoring/embed-only-adapter.ts +57 -0
- package/src/authoring/ephemeral-persistence.ts +26 -0
- package/src/authoring/eyedropper-session.ts +69 -0
- package/src/authoring/first-party-hierarchy-menu.ts +74 -0
- package/src/authoring/first-party-inspector/AddSectionMenu.tsx +118 -0
- package/src/authoring/first-party-inspector/EnvironmentSection.tsx +550 -0
- package/src/authoring/first-party-inspector/HeaderSection.tsx +329 -0
- package/src/authoring/first-party-inspector/is-first-party-selection.ts +44 -0
- package/src/authoring/first-party-inspector/register.tsx +108 -0
- package/src/authoring/ingest-authoring-adapter.ts +475 -0
- package/src/authoring/ingest-capture.ts +94 -0
- package/src/authoring/ingest-game-adapter.ts +291 -0
- package/src/authoring/ingest-iframe-adapter.ts +38 -0
- package/src/authoring/ingest-iframe-reachable-adapter.ts +401 -0
- package/src/authoring/ingest-overlay.ts +193 -0
- package/src/authoring/layered-pick.ts +87 -0
- package/src/authoring/mount-failure-report.ts +112 -0
- package/src/authoring/overlay-report.ts +52 -0
- package/src/authoring/project-scenes.ts +111 -0
- package/src/authoring/react-dom-authoring-adapter.ts +795 -0
- package/src/authoring/react-inspector-section.tsx +1041 -0
- package/src/authoring/react-world-authoring-adapter.ts +2400 -0
- package/src/authoring/root-activation.ts +61 -0
- package/src/authoring/scene-ui-layer.ts +485 -0
- package/src/authoring/story-overlay.ts +48 -0
- package/src/authoring/ui-authoring-adapter.ts +325 -0
- package/src/authoring/ui-hierarchy-menu.ts +40 -0
- package/src/authoring/ui-inspector-sections.tsx +156 -0
- package/src/authoring/undo-timeline.ts +145 -0
- package/src/authoring/vgai-scene-authoring-adapter.ts +746 -0
- package/src/authoring/viewport-pick-context.ts +31 -0
- package/src/authoring/viewport-raycast.ts +80 -0
- package/src/authoring/world-overlay.ts +76 -0
- package/src/authoring/world-pan-state.ts +115 -0
- package/src/authoring/world-session-state.ts +102 -0
- package/src/authoring/world2d-authoring-adapter.ts +313 -0
- package/src/browser-external-watch.ts +98 -0
- package/src/browser-play-entry.ts +112 -0
- package/src/browser-project-scripts.ts +112 -0
- package/src/browser-transpile.ts +246 -0
- package/src/browser-watch-reload.ts +100 -0
- package/src/command-listener.ts +326 -0
- package/src/components/AlignToolbar.tsx +189 -0
- package/src/components/AppRoot.tsx +73 -0
- package/src/components/AssetBrowser.tsx +502 -0
- package/src/components/BottomPanel.tsx +326 -0
- package/src/components/BuildPanel.tsx +455 -0
- package/src/components/CameraInfo.tsx +56 -0
- package/src/components/CommandPalette.tsx +265 -0
- package/src/components/ConsolePanel.tsx +272 -0
- package/src/components/DataPanel.tsx +1268 -0
- package/src/components/DefaultEditorLayout.tsx +509 -0
- package/src/components/FolderTree.tsx +179 -0
- package/src/components/GameHierarchy.tsx +1349 -0
- package/src/components/Inspector.tsx +671 -0
- package/src/components/InspectorToolSection.tsx +74 -0
- package/src/components/MountFailureBanner.tsx +110 -0
- package/src/components/NetworkSection.tsx +109 -0
- package/src/components/OnlineAssetBrowser.tsx +448 -0
- package/src/components/OverlayReportBanner.tsx +122 -0
- package/src/components/PlayBar.tsx +356 -0
- package/src/components/PrefabSaveDialog.tsx +201 -0
- package/src/components/ProjectHeader.tsx +174 -0
- package/src/components/ProjectScreen.tsx +1004 -0
- package/src/components/RightPanel.tsx +166 -0
- package/src/components/RootActivateDialog.tsx +105 -0
- package/src/components/SaveDialog.tsx +197 -0
- package/src/components/SaveStatus.tsx +69 -0
- package/src/components/StatsOverlay.tsx +35 -0
- package/src/components/ToolHost.tsx +80 -0
- package/src/components/Toolbar.tsx +307 -0
- package/src/components/ViewportOverlay.tsx +234 -0
- package/src/components/ViewportPanel.tsx +369 -0
- package/src/components/WorldContextMenu.tsx +257 -0
- package/src/components/WorldSelectionOverlay.tsx +2003 -0
- package/src/components/WorldTextEditor.tsx +86 -0
- package/src/components/asset-viewers/AssetViewer.tsx +38 -0
- package/src/components/asset-viewers/AudioViewer.tsx +149 -0
- package/src/components/asset-viewers/GenericJsonViewer.tsx +77 -0
- package/src/components/asset-viewers/ImageViewer.tsx +65 -0
- package/src/components/asset-viewers/InputMapViewer.tsx +206 -0
- package/src/components/asset-viewers/ModelViewer.tsx +180 -0
- package/src/components/asset-viewers/OnlineAssetDetail.tsx +236 -0
- package/src/components/data-csv.ts +301 -0
- package/src/components/entity-name-commit.ts +18 -0
- package/src/components/inspector-property-grouping.ts +65 -0
- package/src/components/inspector-widgets/AlignmentGrid.tsx +188 -0
- package/src/components/inspector-widgets/BorderEditor.tsx +305 -0
- package/src/components/inspector-widgets/ColorPicker.tsx +548 -0
- package/src/components/inspector-widgets/FilterEditor.tsx +108 -0
- package/src/components/inspector-widgets/FontPicker.tsx +196 -0
- package/src/components/inspector-widgets/GradientEditor.tsx +277 -0
- package/src/components/inspector-widgets/ScrubbableInput.tsx +152 -0
- package/src/components/inspector-widgets/ShadowEditor.tsx +332 -0
- package/src/components/inspector-widgets/color-utils.ts +202 -0
- package/src/components/inspector-widgets/gallery-main.tsx +167 -0
- package/src/components/inspector-widgets/index.ts +22 -0
- package/src/components/inspector-widgets/shared.tsx +135 -0
- package/src/components/inspectors/AnimationSection.tsx +143 -0
- package/src/components/inspectors/AudioSection.tsx +215 -0
- package/src/components/inspectors/BoneAttachmentSection.tsx +82 -0
- package/src/components/inspectors/CameraSection.tsx +105 -0
- package/src/components/inspectors/ComponentsSection.tsx +358 -0
- package/src/components/inspectors/JointsSection.tsx +255 -0
- package/src/components/inspectors/LightSection.tsx +116 -0
- package/src/components/inspectors/MaterialSection.tsx +1189 -0
- package/src/components/inspectors/MeshSection.tsx +99 -0
- package/src/components/inspectors/NavigationSection.tsx +58 -0
- package/src/components/inspectors/ParticleSection.tsx +681 -0
- package/src/components/inspectors/PhysicsSection.tsx +326 -0
- package/src/components/inspectors/PostProcessingSection.tsx +1290 -0
- package/src/components/inspectors/RenderingSection.tsx +109 -0
- package/src/components/inspectors/ShadowSection.tsx +84 -0
- package/src/components/inspectors/SplineSection.tsx +191 -0
- package/src/components/inspectors/TransformSection.tsx +191 -0
- package/src/components/inspectors/json-schema-fields.ts +281 -0
- package/src/components/inspectors/multi-edit-utils.ts +49 -0
- package/src/components/inspectors/zod-fields.ts +184 -0
- package/src/components/primitives/ColorInput.tsx +109 -0
- package/src/components/primitives/JsonInput.tsx +98 -0
- package/src/components/primitives/NumberInput.tsx +164 -0
- package/src/components/primitives/Panel.tsx +68 -0
- package/src/components/primitives/SectionHeader.tsx +45 -0
- package/src/components/primitives/Tooltip.tsx +82 -0
- package/src/components/primitives/Vec3Input.tsx +62 -0
- package/src/components/world-overlay-gestures.ts +1438 -0
- package/src/doctor/data-checks.ts +285 -0
- package/src/doctor/report.ts +386 -0
- package/src/editor-api.ts +700 -0
- package/src/editor-console.ts +194 -0
- package/src/editor-hotkeys.ts +441 -0
- package/src/editor-layers.ts +2 -0
- package/src/editor-mode.ts +28 -0
- package/src/editor-store.ts +2225 -0
- package/src/editor-viewport.ts +1924 -0
- package/src/entity-factory.ts +221 -0
- package/src/game-globals-prelude.ts +27 -0
- package/src/gated-globals.ts +131 -0
- package/src/generated/setup-by-example.generated.ts +53 -0
- package/src/gizmo-registry.ts +608 -0
- package/src/handle-system.ts +221 -0
- package/src/hierarchy-menu-registry.ts +70 -0
- package/src/hierarchy-rows.ts +73 -0
- package/src/hosted-example.ts +160 -0
- package/src/hotkeys.ts +142 -0
- package/src/ingest/discovery-react.ts +132 -0
- package/src/ingest/discovery.ts +205 -0
- package/src/ingest/discovery2d.ts +204 -0
- package/src/ingest/esm-entry-resolution.ts +102 -0
- package/src/ingest/games/bloom-composer/game.js +99 -0
- package/src/ingest/games/bloom-composer/vgai.game.json +21 -0
- package/src/ingest/games/embed-bundle/embed.html +10 -0
- package/src/ingest/games/embed-bundle/vgai.game.json +21 -0
- package/src/ingest/games/games-fps/assets/collision-world.glb +0 -0
- package/src/ingest/games/games-fps/game.js +479 -0
- package/src/ingest/games/games-fps/vgai.game.json +24 -0
- package/src/ingest/games/iframe-reachable/game-source.js +58 -0
- package/src/ingest/games/iframe-reachable/vgai.game.json +21 -0
- package/src/ingest/games/interactive-cubes/game.js +139 -0
- package/src/ingest/games/interactive-cubes/vgai.game.json +21 -0
- package/src/ingest/games/mismatched-three/fake-three.js +38 -0
- package/src/ingest/games/mismatched-three/game.js +10 -0
- package/src/ingest/games/mismatched-three/vgai.game.json +22 -0
- package/src/ingest/games/own-three-bundled/game.js +43 -0
- package/src/ingest/games/own-three-bundled/vgai.game.json +21 -0
- package/src/ingest/games/pointerlock-maze/game.js +288 -0
- package/src/ingest/games/pointerlock-maze/vgai.game.json +22 -0
- package/src/ingest/games-2d/_fixtures/first-party-scene.scn2d.json +124 -0
- package/src/ingest/games-2d/bubbo-bubbo/vgai.game.json +25 -0
- package/src/ingest/games-2d/bunnymark/game.ts +88 -0
- package/src/ingest/games-2d/bunnymark/vgai.game.json +21 -0
- package/src/ingest/games-2d/flappy/game.ts +148 -0
- package/src/ingest/games-2d/flappy/vgai.game.json +21 -0
- package/src/ingest/games-2d/flappy-pixi/vgai.game.json +25 -0
- package/src/ingest/games-2d/puzzling-potions/vgai.game.json +25 -0
- package/src/ingest/games-2d/tilemap-camera/game.ts +115 -0
- package/src/ingest/games-2d/tilemap-camera/vgai.game.json +21 -0
- package/src/ingest/games-react/react-rpg/entry.tsx +185 -0
- package/src/ingest/games-react/react-rpg/shims.d.ts +26 -0
- package/src/ingest/games-react/react-rpg/src/ui/game-state.tsx +129 -0
- package/src/ingest/games-react/react-rpg/vgai.game.json +21 -0
- package/src/ingest/host-namespace-registry.ts +196 -0
- package/src/ingest/types.ts +127 -0
- package/src/ingest-hierarchy-rows.ts +207 -0
- package/src/ingest-mode.ts +2092 -0
- package/src/ingest-siblings.ts +466 -0
- package/src/initial-scene.ts +194 -0
- package/src/inspector-section-registry.ts +117 -0
- package/src/interactive-edit-scope.ts +34 -0
- package/src/main.tsx +23 -0
- package/src/manifest-project.ts +43 -0
- package/src/model-thumbnail.ts +156 -0
- package/src/module-mode.ts +513 -0
- package/src/navmesh-handler.ts +94 -0
- package/src/packaged-runtime.ts +49 -0
- package/src/play-mode.ts +1148 -0
- package/src/playground/main.ts +206 -0
- package/src/project-manager.ts +173 -0
- package/src/scene-diff.ts +112 -0
- package/src/scene-serializer.ts +144 -0
- package/src/scene-sync.ts +587 -0
- package/src/scene-ui-mode/active-scene-ui.ts +58 -0
- package/src/scene-ui-mode/scene-ui-palette-panel.tsx +152 -0
- package/src/scene-ui-mode/scene-ui-timeline-tab.tsx +29 -0
- package/src/scene-ui-mode/ui-prefab-dialog-host.tsx +74 -0
- package/src/scene-ui-mode/ui-prefab-hierarchy-menu.ts +49 -0
- package/src/scene-ui-mode/ui-prefab-io.ts +76 -0
- package/src/script-loader.ts +143 -0
- package/src/storage/fsa-storage.ts +55 -0
- package/src/storage/handle-storage.ts +150 -0
- package/src/storage/handle-store.ts +116 -0
- package/src/storage/http-storage.ts +137 -0
- package/src/storage/index.ts +147 -0
- package/src/storage/mem-storage.ts +135 -0
- package/src/storage/opfs-storage.ts +25 -0
- package/src/storage/paths.ts +26 -0
- package/src/storage/seed.ts +106 -0
- package/src/storage/types.ts +110 -0
- package/src/tool-loader.ts +291 -0
- package/src/ui-editor/inspector.tsx +563 -0
- package/src/ui-editor/node-ops.ts +266 -0
- package/src/ui-editor/overlay.tsx +380 -0
- package/src/ui-editor/palette.tsx +114 -0
- package/src/ui-editor/react-store.ts +78 -0
- package/src/ui-editor/timeline-panel.tsx +443 -0
- package/src/ui-editor/ui-edit-store.ts +552 -0
- package/src/ui-editor/ui-prefab.ts +95 -0
- package/src/ui-source/inspect.ts +544 -0
- package/src/ui-source/oid-transform.ts +133 -0
- package/src/ui-source/source-write-backend.ts +203 -0
- package/src/ui-source/tailwind-map.ts +174 -0
- package/src/ui-source/writer.ts +1175 -0
- package/src/widgets/index.ts +73 -0
- package/template/.claude/skills/editor/SKILL.md +252 -0
- package/template/CLAUDE.md +512 -0
- package/template/LICENSE +30 -0
- package/template/emit-schemas.ts +42 -0
- package/template/index.html +17 -0
- package/template/package.json +53 -0
- package/template/project.json +9 -0
- package/template/public/audio/ambient-arena.wav +0 -0
- package/template/public/audio/ambient-music.wav +0 -0
- package/template/public/audio/ambient-nature.wav +0 -0
- package/template/public/audio/ambient-wind.wav +0 -0
- package/template/public/inputmaps/default.inputmap.json +41 -0
- package/template/public/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/template/public/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/template/public/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/template/public/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/template/public/scenes/default.vscn.json +43 -0
- package/template/public/scenes/untitled.vscn.json +29 -0
- package/template/public/textures/waternormals.jpg +0 -0
- package/template/server/colyseus-setup.ts +85 -0
- package/template/server/main.ts +34 -0
- package/template/server/rooms/arena-room.ts +420 -0
- package/template/server/rooms/game-room.ts +162 -0
- package/template/server/rooms.ts +15 -0
- package/template/server/tsconfig.json +19 -0
- package/template/src/data/README.md +40 -0
- package/template/src/data/assets.ts +31 -0
- package/template/src/data/tuning.data.json +5 -0
- package/template/src/data/tuning.schema.json +21 -0
- package/template/src/data/tuning.schema.ts +34 -0
- package/template/src/data/tuning.ts +24 -0
- package/template/src/main.ts +157 -0
- package/template/src/scripts/components/data-spinner.ts +45 -0
- package/template/src/scripts/components/scene-camera.ts +40 -0
- package/template/src/scripts/main.ts +94 -0
- package/template/src/scripts/registry.ts +46 -0
- package/template/src/tools/README.md +14 -0
- package/template/src/tools/example.tool.tsx +91 -0
- package/template/src/tools/spin.tool.tsx +101 -0
- package/template/src/ui/Button.tsx +27 -0
- package/template/src/ui/DefaultHud.tsx +40 -0
- package/template/src/ui/KeyHint.tsx +25 -0
- package/template/src/ui/Panel.tsx +52 -0
- package/template/src/ui/RebindPanel.tsx +129 -0
- package/template/src/ui/Slider.tsx +28 -0
- package/template/src/ui/StatusDot.tsx +22 -0
- package/template/src/ui/Toggle.tsx +19 -0
- package/template/src/ui/game-state.tsx +37 -0
- package/template/src/ui/index.ts +7 -0
- package/template/src/ui/mount-default-hud.tsx +19 -0
- package/template/src/ui/mount-ui.ts +15 -0
- package/template/tsconfig.json +36 -0
- package/template/validate-asset-content.ts +78 -0
- package/template/validate-manifest.ts +55 -0
- package/template/validate-scenes.ts +211 -0
- package/template/vgai.game.json +21 -0
- package/template/vite.config.ts +128 -0
- package/vite-plugin-example-assets.ts +60 -0
- package/vite-plugin-game-globals.ts +46 -0
- package/vite-plugin-game-static.ts +71 -0
- package/vite-plugin-project-game-static.ts +84 -0
- package/vite-plugin-react-game-static.ts +98 -0
- package/vite-plugin-react-world-provider.ts +81 -0
- package/vite-plugin-react-world-runtime.ts +76 -0
- package/vite-plugin-ui-oid.ts +561 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{bd as y,a4 as g,a5 as V,a8 as b,a6 as O,a3 as S,be as ct,bf as C,bg as Mt,b7 as lt,bh as at,bi as Et,bj as Ft}from"./index-_bCaipUk.js";var nt={},L={},pt;function G(){if(pt)return L;pt=1,Object.defineProperty(L,"__esModule",{value:!0}),L.Collector=void 0;let s=class{constructor(i){this.emit=(...e)=>{i.emitCollecting(this,e)}}};return L.Collector=s,L}var R={},ft;function Bt(){if(ft)return R;ft=1,Object.defineProperty(R,"__esModule",{value:!0}),R.CollectorArray=void 0;const s=G();let t=class extends s.Collector{constructor(){super(...arguments),this.result=[]}handleResult(e){return this.result.push(e),!0}getResult(){return this.result}reset(){this.result.length=0}};return R.CollectorArray=t,R}var H={},gt;function Dt(){if(gt)return H;gt=1,Object.defineProperty(H,"__esModule",{value:!0}),H.CollectorLast=void 0;const s=G();let t=class extends s.Collector{handleResult(e){return this.result=e,!0}getResult(){return this.result}reset(){delete this.result}};return H.CollectorLast=t,H}var N={},_t;function Ut(){if(_t)return N;_t=1,Object.defineProperty(N,"__esModule",{value:!0}),N.CollectorUntil0=void 0;const s=G();let t=class extends s.Collector{constructor(){super(...arguments),this.result=!1}handleResult(e){return this.result=e,this.result}getResult(){return this.result}reset(){this.result=!1}};return N.CollectorUntil0=t,N}var W={},wt;function Lt(){if(wt)return W;wt=1,Object.defineProperty(W,"__esModule",{value:!0}),W.CollectorWhile0=void 0;const s=G();let t=class extends s.Collector{constructor(){super(...arguments),this.result=!1}handleResult(e){return this.result=e,!this.result}getResult(){return this.result}reset(){this.result=!1}};return W.CollectorWhile0=t,W}var $={},z={},mt;function Rt(){if(mt)return z;mt=1,Object.defineProperty(z,"__esModule",{value:!0}),z.SignalConnectionImpl=void 0;class s{constructor(i,e){this.link=i,this.parentCleanup=e}disconnect(){return this.link!==null?(this.link.unlink(),this.link=null,this.parentCleanup(),this.parentCleanup=null,!0):!1}set enabled(i){this.link&&this.link.setEnabled(i)}get enabled(){return this.link!==null&&this.link.isEnabled()}}return z.SignalConnectionImpl=s,z}var j={},vt;function Ht(){if(vt)return j;vt=1,Object.defineProperty(j,"__esModule",{value:!0}),j.SignalLink=void 0;let s=class Vt{constructor(i=null,e=null,h=0){this.enabled=!0,this.newLink=!1,this.callback=null,this.prev=i??this,this.next=e??this,this.order=h}isEnabled(){return this.enabled&&!this.newLink}setEnabled(i){this.enabled=i}unlink(){this.callback=null,this.next.prev=this.prev,this.prev.next=this.next}insert(i,e){let h=this.prev;for(;h!==this&&!(h.order<=e);)h=h.prev;const n=new Vt(h,h.next,e);return n.callback=i,h.next=n,n.next.prev=n,n}};return j.SignalLink=s,j}var bt;function Nt(){if(bt)return $;bt=1,Object.defineProperty($,"__esModule",{value:!0}),$.Signal=void 0;const s=Rt(),t=Ht();let i=class{constructor(){this.head=new t.SignalLink,this.hasNewLinks=!1,this.emitDepth=0,this.connectionsCount=0}getConnectionsCount(){return this.connectionsCount}hasConnections(){return this.connectionsCount>0}connect(h,n=0){this.connectionsCount++;const r=this.head.insert(h,n);return this.emitDepth>0&&(this.hasNewLinks=!0,r.newLink=!0),new s.SignalConnectionImpl(r,()=>this.decrementConnectionCount())}decrementConnectionCount(){this.connectionsCount--}disconnect(h){for(let n=this.head.next;n!==this.head;n=n.next)if(n.callback===h)return this.decrementConnectionCount(),n.unlink(),!0;return!1}disconnectAll(){for(;this.head.next!==this.head;)this.head.next.unlink();this.connectionsCount=0}emit(...h){this.emitDepth++;for(let n=this.head.next;n!==this.head;n=n.next)n.isEnabled()&&n.callback&&n.callback.apply(null,h);this.emitDepth--,this.unsetNewLink()}emitCollecting(h,n){this.emitDepth++;for(let r=this.head.next;r!==this.head;r=r.next)if(r.isEnabled()&&r.callback){const o=r.callback.apply(null,n);if(!h.handleResult(o))break}this.emitDepth--,this.unsetNewLink()}unsetNewLink(){if(this.hasNewLinks&&this.emitDepth===0){for(let h=this.head.next;h!==this.head;h=h.next)h.newLink=!1;this.hasNewLinks=!1}}};return $.Signal=i,$}var X={},xt;function Wt(){if(xt)return X;xt=1,Object.defineProperty(X,"__esModule",{value:!0}),X.SignalConnections=void 0;let s=class{constructor(){this.list=[]}add(i){this.list.push(i)}disconnectAll(){for(const i of this.list)i.disconnect();this.list=[]}getCount(){return this.list.length}isEmpty(){return this.list.length===0}};return X.SignalConnections=s,X}var yt;function $t(){return yt||(yt=1,(function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.SignalConnections=s.Signal=s.CollectorWhile0=s.CollectorUntil0=s.CollectorLast=s.CollectorArray=s.Collector=void 0;var t=G();Object.defineProperty(s,"Collector",{enumerable:!0,get:function(){return t.Collector}});var i=Bt();Object.defineProperty(s,"CollectorArray",{enumerable:!0,get:function(){return i.CollectorArray}});var e=Dt();Object.defineProperty(s,"CollectorLast",{enumerable:!0,get:function(){return e.CollectorLast}});var h=Ut();Object.defineProperty(s,"CollectorUntil0",{enumerable:!0,get:function(){return h.CollectorUntil0}});var n=Lt();Object.defineProperty(s,"CollectorWhile0",{enumerable:!0,get:function(){return n.CollectorWhile0}});var r=Nt();Object.defineProperty(s,"Signal",{enumerable:!0,get:function(){return r.Signal}});var o=Wt();Object.defineProperty(s,"SignalConnections",{enumerable:!0,get:function(){return o.SignalConnections}})})(nt)),nt}var f=$t(),zt=Object.defineProperty,jt=(s,t,i)=>t in s?zt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,P=(s,t,i)=>jt(s,typeof t!="symbol"?t+"":t,i);class Xt{constructor(){P(this,"_isMouseIn"),P(this,"_isDown"),P(this,"onDown"),P(this,"onUp"),P(this,"onUpOut"),P(this,"onOut"),P(this,"onPress"),P(this,"onHover"),this.onPress=new f.Signal,this.onDown=new f.Signal,this.onUp=new f.Signal,this.onHover=new f.Signal,this.onOut=new f.Signal,this.onUpOut=new f.Signal}connectEvents(t){y.any?(t.on("pointerdown",this.processDown,this),t.on("pointerup",this.processUp,this),t.on("pointerupoutside",this.processUpOut,this),t.on("pointerout",this.processOut,this),t.on("pointertap",this.processPress,this),t.on("pointerover",this.processOver,this)):(t.on("mousedown",this.processDown,this),t.on("mouseup",this.processUp,this),t.on("mouseupoutside",this.processUpOut,this),t.on("mouseout",this.processOut,this),t.on("click",this.processPress,this),t.on("mouseover",this.processOver,this))}disconnectEvents(t){y.any?(t.off("pointerdown",this.processDown,this),t.off("pointerup",this.processUp,this),t.off("pointerupoutside",this.processUpOut,this),t.off("pointerout",this.processOut,this),t.off("pointertap",this.processPress,this),t.off("pointerover",this.processOver,this)):(t.off("mousedown",this.processDown,this),t.off("mouseup",this.processUp,this),t.off("mouseupoutside",this.processUpOut,this),t.off("mouseout",this.processOut,this),t.off("click",this.processPress,this),t.off("mouseover",this.processOver,this))}processDown(t){this._isDown=!0,this.onDown.emit(this,t),this.down(t)}processUp(t){this._isDown&&(this.onUp.emit(this,t),this.up(t)),this._isDown=!1}processUpOut(t){this._isDown&&(this.onUp.emit(this,t),this.onUpOut.emit(this,t),this.up(t),this.upOut(t)),this._isDown=!1}processOut(t){this._isMouseIn&&(this._isMouseIn=!1,this.onOut.emit(this,t),this.out(t))}processPress(t){this._isDown=!1,this.onPress.emit(this,t),this.press(t)}processOver(t){y.any||(this._isMouseIn=!0,this.onHover.emit(this,t),this.hover(t))}down(t){}up(t){}upOut(t){}out(t){}press(t){}hover(t){}get isDown(){return this._isDown}}var Yt=Object.defineProperty,qt=(s,t,i)=>t in s?Yt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,T=(s,t,i)=>qt(s,typeof t!="symbol"?t+"":t,i);class Jt extends Xt{constructor(t){super(),T(this,"_view"),t&&(this.view=t,this.enabled=!0)}set view(t){!!this._view&&this.disconnectEvents(this._view),this._view=t,this.connectEvents(this._view)}get view(){return this._view}set enabled(t){if(!this.view){console.error("Button view is not set. Please set it before enabling the button.");return}this.view.eventMode=t?"static":"auto",this.view.cursor=t?"pointer":"default",!t&&this.isDown&&this.processUp()}get enabled(){return this.view.eventMode==="static"}}class Kt extends g{constructor(t){super(),T(this,"button"),T(this,"onDown"),T(this,"onUp"),T(this,"onUpOut"),T(this,"onOut"),T(this,"onPress"),T(this,"onHover"),this.button=new Jt(this),this.button.enabled=!0,t&&this.addChild(t),this.onPress=this.button.onPress,this.onDown=this.button.onDown,this.onUp=this.button.onUp,this.onHover=this.button.onHover,this.onOut=this.button.onOut,this.onUpOut=this.button.onUpOut}set enabled(t){this.button.enabled=t}get enabled(){return this.button.enabled}}function w(s){return typeof s=="string"?V.from(s):s instanceof b?new V(s):s}var Gt=Object.defineProperty,Qt=(s,t,i)=>t in s?Gt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,Q=(s,t,i)=>Qt(s,typeof t!="symbol"?t+"":t,i);class Zt extends g{constructor(t,i,e){super(),Q(this,"_triggerEvents",new Set(["onPress"])),Q(this,"innerView"),Q(this,"_active"),Q(this,"onChange"),this.innerView=new g,this.addChild(this.innerView),this.onChange=new f.Signal,t&&(this.views=t),i&&(this.triggerEvents=i),e&&this.views.length>0&&(this.active=e),this.setInteractionEvents()}setInteractionEvents(){this.innerView.eventMode="static",this.innerView.on("pointerdown",()=>this.handleEvents("onDown")),this.innerView.on("pointerup",()=>this.handleEvents("onUp")),this.innerView.on("pointerupoutside",()=>this.handleEvents("onUpOut")),this.innerView.on("pointerout",()=>this.handleEvents("onOut")),this.innerView.on("pointertap",()=>this.handleEvents("onPress")),this.innerView.on("pointerover",()=>this.handleEvents("onHover"))}handleEvents(t){this._triggerEvents.has(t)&&this.switch()}get activeView(){if(this.views&&this.views[this.active])return this.views[this.active]}set views(t){this.innerView.removeChildren(),t.forEach(i=>this.add(i))}get views(){return this.innerView.children}add(t){const i=w(t);this.innerView.addChild(i),i.visible=!1,this.views.length===1&&(this.active=0)}remove(t){this.views[t]&&this.innerView.removeChild(this.views[t])}set triggerEvents(t){this._triggerEvents=new Set(Array.isArray(t)?t:[t])}get triggerEvents(){return Array.from(this._triggerEvents)}switch(t){if(t!==void 0&&t===this.active)return;const i=this.active;if(this.forceSwitch(t),i!==this.active){const e=this.views.length>2?this.active:this.active===1;this.onChange.emit(e)}}forceSwitch(t){if(!(t!==void 0&&t===this.active)){if(this.activeView&&(this.activeView.visible=!1),t!==void 0&&!this.views[t])throw new Error(`View with id ${t} does not exist.`);this._active=t!==void 0?t:this.nextActive,this._active!==void 0&&(this.views[this.active].visible=!0)}}get nextActive(){if(this.views.length!==0)return this.active<this.views.length-1?this.active+1:0}set active(t){this.switch(t)}get active(){return this._active}}function ti(s){s&&(s.parent&&s.parent.removeChild(s),s.destroy(),s=null)}var ii=Object.defineProperty,ei=(s,t,i)=>t in s?ii(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,Z=(s,t,i)=>ei(s,typeof t!="symbol"?t+"":t,i);class Qi extends Zt{constructor(t){super(),Z(this,"labelText"),Z(this,"onCheck"),Z(this,"_style"),Z(this,"_textClass"),this._textClass=t.TextClass??O,this.text=t.text,this.style=t.style,this.checked=t.checked,this.triggerEvents=["onPress"],this.innerView.cursor="pointer",this.onCheck=new f.Signal,this.onChange.connect(()=>this.onCheck.emit(this.checked))}addLabel(t,i){t&&(this.labelText=new this._textClass({text:t??"",style:i??this._style?.text}),this.addChild(this.labelText),this.labelText.cursor="pointer",this.labelText.eventMode="static",this.labelText.on("pointertap",()=>this.checked=!this.checked),this.alignText())}set text(t){if(!t){ti(this.labelText),this.labelText=void 0;return}this.labelText?this.labelText.text=t:this.addLabel(t),this.alignText()}get text(){return this.labelText?.text??""}set style(t){const i=this.checked;this._style=t;const{unchecked:e,checked:h}=t,n=w(e),r=w(h);this.views=[n,r],i?(r.visible=!0,this.active=1):n.visible=!0,this.labelText?(r.visible=!0,this.active=1,t.text&&(this.labelText.style=t.text),this.alignText()):n.visible=!0}get style(){return this._style}alignText(){if(!this.style||!this.labelText||!this.views)return;const t=this.views[0];t&&(this.labelText.x=t.width+10+(this._style?.textOffset?.x??0),this.labelText.y=(t.height-this.labelText.height)/2+(this._style?.textOffset?.y??0))}get checked(){return this.active===1}set checked(t){this.switch(t?1:0)}forceCheck(t){this.forceSwitch(t?1:0)}}var si=Object.defineProperty,hi=(s,t,i)=>t in s?si(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,Y=(s,t,i)=>hi(s,typeof t!="symbol"?t+"":t,i);class Zi extends g{constructor(t){super(),Y(this,"_progress",0),Y(this,"options"),Y(this,"bgCircle",new S),Y(this,"fillCircle",new S),Y(this,"innerView",new g),this.options=t,this.addChild(this.innerView),this.innerView.addChild(this.bgCircle,this.fillCircle),this.addBackground(),t.value&&(this.progress=t.value)}addBackground(){const{backgroundColor:t,lineWidth:i,radius:e,backgroundAlpha:h}=this.options;let n=1;h>0&&(n=h),t===void 0&&(n=1e-6),this.bgCircle.circle(0,0,e).stroke({width:i,color:t,alpha:n})}set progress(t){t>100&&(t=100),t<0&&(t=0),this._progress=t;const{lineWidth:i,radius:e,fillColor:h,fillAlpha:n,cap:r}=this.options;if(t===0&&n===0){this.fillCircle.clear();return}const o=0,a=360/100*t;this.fillCircle.clear().arc(0,0,e,(-90+o)*ct,(-90+o+a)*ct).stroke({width:i,color:h,cap:r,alpha:n})}get progress(){return this._progress}}var ni=Object.defineProperty,ri=(s,t,i)=>t in s?ni(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,k=(s,t,i)=>ri(s,typeof t!="symbol"?t+"":t,i);class oi extends g{constructor(t){super(),k(this,"bg"),k(this,"fill"),k(this,"fillMask"),k(this,"progressStart",0),k(this,"_progress",0),k(this,"options"),k(this,"innerView"),k(this,"_view"),this.options=t,this.innerView=new g,this.addChild(this.innerView),t?.bg&&t?.fill&&this.init(t)}init({bg:t,fill:i,fillPaddings:e,progress:h}){this.setBackground(t),this.setFill(i,e),this.progress=h}setBackground(t){this.bg&&this.bg.destroy(),this.options?.nineSliceSprite&&(typeof t=="string"?this.bg=new C({texture:b.from(t),leftWidth:this.options.nineSliceSprite.bg[0],topHeight:this.options.nineSliceSprite.bg[1],rightWidth:this.options.nineSliceSprite.bg[2],bottomHeight:this.options.nineSliceSprite.bg[3]}):t instanceof b?this.bg=new C({texture:t,leftWidth:this.options.nineSliceSprite.bg[0],topHeight:this.options.nineSliceSprite.bg[1],rightWidth:this.options.nineSliceSprite.bg[2],bottomHeight:this.options.nineSliceSprite.bg[3]}):console.warn(`NineSliceSprite can not be used with views set as Container.
|
|
2
|
+
Pass the texture or texture name as instead of the Container extended instance.`)),this.bg||(this.bg=w(t)),this.innerView.addChildAt(this.bg,0)}setFill(t,i){if(this.fill&&this.fill.destroy(),this.bg instanceof V&&t===this.bg){console.warn("Can not use same Sprite instance for bg and fill.");return}this.options?.nineSliceSprite?typeof t=="string"||t instanceof b?this.fill=new C({texture:typeof t=="string"?b.from(t):t,leftWidth:this.options.nineSliceSprite.fill[0],topHeight:this.options.nineSliceSprite.fill[1],rightWidth:this.options.nineSliceSprite.fill[2],bottomHeight:this.options.nineSliceSprite.fill[3]}):(console.warn(`NineSliceSprite can not be used with views set as Container.
|
|
3
|
+
Pass the texture or texture name as instead of the Container extended instance.`),this.fill=w(t)):this.fill=w(t),this.innerView.addChildAt(this.fill,1);const e=i?.left??0,h=i?.top??0;this.fill.x=e,this.fill.y=h,this.fillMask&&(this.fill.mask=null,this.fillMask.destroy());const n=this.fill.width/2,r=this.fill.width/2,o=this.fill.height/2,a=this.fill.height/2;let l=b.WHITE;this.fill instanceof V&&this.fill.texture&&(l=this.fill.texture),this.fillMask=new C({texture:l,leftWidth:n,topHeight:o,rightWidth:r,bottomHeight:a}),this.fillMask.position.copyFrom(this.fill),this.addChild(this.fillMask),this.fill.mask=this.fillMask}validate(t){return t=Math.round(t),t<0?0:t>100?100:t}set progress(t){this._progress=this.validate(t),this.fill&&this.fillMask&&(this.fill.mask=null,this.fillMask.width=this.fill.width/100*(this._progress-this.progressStart),this.fillMask.x=this.progressStart/100*this.fill.width+this.fill.x,this.fillMask.height=this.fill.height,this.fill.mask=this.fillMask)}get progress(){return this._progress}set width(t){if(this.options?.nineSliceSprite){if(this.bg&&(this.bg.width=t),this.fill){const i=this.options.fillPaddings?.left??0,e=this.options.fillPaddings?.right??0;this.fill.width=t-i-e,this.fillMask.width=t-i-e}this.progress=this._progress}else super.width=t}get width(){return super.width}set height(t){if(this.options?.nineSliceSprite){if(this.bg&&(this.bg.height=t),this.fill){const i=this.options.fillPaddings?.top??0,e=this.options.fillPaddings?.bottom??0;this.fill.height=t-i-e,this.fillMask.height=t-i-e}this.progress=this._progress}else super.height=t}get height(){return super.height}setSize(t,i){if(this.options?.nineSliceSprite){if(this.bg&&this.bg.setSize(t,i),this.fill){typeof t=="object"?(i=t.height??t.width,t=t.width):i=i??t;const e=this.options.fillPaddings?.top??0,h=this.options.fillPaddings?.bottom??0,n=this.options.fillPaddings?.left??0,r=this.options.fillPaddings?.right??0;this.fill.setSize(t-n-r,i-e-h),this.fillMask.setSize(t-n-r,i-e-h)}this.progress=this._progress}else super.setSize(t,i)}}var ai=Object.defineProperty,li=(s,t,i)=>t in s?ai(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,m=(s,t,i)=>li(s,typeof t!="symbol"?t+"":t,i);class Pt extends oi{constructor(t){super(t),m(this,"_slider1"),m(this,"_slider2"),m(this,"value1Text"),m(this,"value2Text"),m(this,"_value1"),m(this,"_value2"),m(this,"dragging",0),m(this,"_min",0),m(this,"_max",100),m(this,"_step",1),m(this,"startX"),m(this,"startUpdateValue1"),m(this,"startUpdateValue2"),m(this,"settings"),this.settings=t,this.slider1=t.slider1,this.slider2=t.slider2,this.min=t.min??0,this.max=t.max??100}init(t){super.init(t),this.fill&&(this.fill.eventMode="none")}set slider1(t){if(t&&(this._slider1&&(this.slider1.removeAllListeners(),this.slider1.destroy()),this._slider1=this.createSlider(t),this.settings.showValue&&!this.value1Text)){const i=this.settings.valueTextClass??O;this.value1Text=new i({text:"",style:this.settings.valueTextStyle||{fill:16777215}}),this.value1Text.anchor.set(.5),this.addChild(this.value1Text)}}get slider1(){return this._slider1}set slider2(t){if(t&&(this._slider2&&(this.slider2.removeAllListeners(),this.slider2.destroy()),this._slider2=this.createSlider(t),this.settings.showValue&&!this.value2Text)){const i=this.settings.valueTextClass??O;this.value2Text=new i({text:"",style:this.settings.valueTextStyle||{fill:16777215}}),this.value2Text.anchor.set(.5),this.addChild(this.value2Text)}}get slider2(){return this._slider2}setBackground(t){this.bg&&this.bg.removeAllListeners(),super.setBackground(t),this.activateBG()}activateBG(){this.bg.eventMode="static",this.bg.on("pointerdown",this.startUpdate,this).on("globalpointermove",this.update,this).on("pointerup",this.endUpdate,this).on("pointerupoutside",this.endUpdate,this)}createSlider(t){const i=w(t),e=n=>{this.bg&&(n.currentTarget=this.bg),this.startUpdate(n)};i.eventMode="static",i.on("pointerdown",e).on("pointerup",this.endUpdate,this).on("pointerupoutside",this.endUpdate,this),i.x=i.width/2;const h=new g;return h.addChild(i),i instanceof V&&i.anchor.set(.5),h.y=this.bg?.height?this.bg?.height/2:0,this.addChild(h),h}startUpdate(t){this.dragging=1;const i=t.currentTarget;this.startX=i.parent.worldTransform.applyInverse(t.global).x,this.startUpdateValue1=this._value1,this.startUpdateValue2=this._value2,this.update(t)}endUpdate(){this.dragging&&(this.dragging=0,(this.startX||this.startUpdateValue1!==this._value1||this.startUpdateValue2!==this._value2)&&this.change(),this.startUpdateValue1=null,this.startUpdateValue2=null)}onClick(){this.change()}update(t){const i=t.currentTarget,{x:e}=i.parent.worldTransform.applyInverse(t.global);e!==this.startX&&(this.startX=null)}change(){}set max(t){this._max=t}get max(){return this._max}set min(t){this._min=t}get min(){return this._min}set step(t){this._step=t}get step(){return this._step}}var di=Object.defineProperty,ui=(s,t,i)=>t in s?di(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,tt=(s,t,i)=>ui(s,typeof t!="symbol"?t+"":t,i);class te extends Pt{constructor(t){super(t),tt(this,"sliderOptions"),tt(this,"activeValue"),tt(this,"onChange",new f.Signal),tt(this,"onUpdate",new f.Signal),this.sliderOptions=t,this.setInitialState()}setInitialState(){this.validateValues();const{value1:t,value2:i}=this.sliderOptions;this.updateProgress(t,i),this.value2=i,this.value1=t}updateProgress(t=this.value1,i=this.value2){this.progressStart=(t-this.min)/(this.max-this.min)*100,this.progress=(i-this.min)/(this.max-this.min)*100}validateValues(){this.sliderOptions.value1||(this.sliderOptions.value1=this.min),this.sliderOptions.value2||(this.sliderOptions.value2=this.sliderOptions.max),this.sliderOptions.value2<this.sliderOptions.value1&&(this.sliderOptions.value2=this.sliderOptions.value1),this.sliderOptions.value1<this.sliderOptions.min&&(this.sliderOptions.value1=this.sliderOptions.min),this.sliderOptions.value1>this.sliderOptions.max&&(this.sliderOptions.value1=this.sliderOptions.max),this.sliderOptions.value2>this.sliderOptions.max&&(this.sliderOptions.value2=this.sliderOptions.max)}get value1(){return this._value1}set value1(t){t!==this._value1&&(t<this.min&&(t=this.min),t>this._value2&&(t=this._value2),this._value1=t,this.updateSlider1(),this.onUpdate?.emit(this.value1,this.value2))}get value2(){return this._value2}set value2(t){t!==this._value2&&(t<this._value1&&(t=this._value1),t>this.max&&(t=this.max),this._value2=t,this.updateSlider2(),this.onUpdate?.emit(this.value1,this.value2))}update(t){if(super.update(t),!this.dragging)return;const i=t.currentTarget,{x:e}=i.parent.worldTransform.applyInverse(t.global),h=Math.abs(e-this._slider1.x-this._slider1.width),n=Math.abs(e-this._slider2.x);this.activeValue||(this.slider1&&e<this.slider1.x?this.activeValue="value1":this.slider2&&e>this.slider2.x?this.activeValue="value2":this.activeValue=h<n?"value1":"value2");const r=this.validate(e/this.bg?.width*100);this.activeValue==="value1"?(this.progressStart=r,this.value1=this.min+(this.max-this.min)/100*r,this.updateProgress(this.value1,this.value2)):(this.progress=r,this.value2=this.min+(this.max-this.min)/100*r,this.updateProgress(this.value1,this.value2))}endUpdate(){super.endUpdate(),this.activeValue=null}change(){this.onChange?.emit(this.value1,this.value2)}set slider1(t){super.slider1=t,this.updateSlider1()}get slider1(){return this._slider1}set slider2(t){super.slider2=t,this.updateSlider2()}get slider2(){return this._slider2}updateSlider1(){if(this.updateProgress(this.value1,this.value2),this._slider1.x=this.bg?.width/100*this.progressStart-this._slider1.width/2,this._slider1.y=this.bg?.height/2,this._slider2&&this._slider1.x>this._slider2.x&&(this._slider1.x=this._slider2.x),this.sliderOptions?.showValue){this.value1Text.text=`${Math.round(this.value1)}`;const t=this._slider1.x+this._slider1.width/2,i=this._slider1.y;this.value1Text.x=t+(this.sliderOptions.valueTextOffset?.x??0),this.value1Text.y=i+(this.sliderOptions.valueTextOffset?.y??0)}}updateSlider2(){if(this.updateProgress(this.value1,this.value2),this._slider2.x=this.bg?.width/100*this.progress-this._slider2.width/2,this._slider2.y=this.bg?.height/2,this._slider2.x<this._slider1.x&&(this._slider2.x=this._slider1.x),this.sliderOptions?.showValue){this.value2Text.text=`${Math.round(this.value2)}`;const t=this._slider2.x+this._slider2.width/2,i=this._slider2.y;this.value2Text.x=t+(this.sliderOptions.valueTextOffset?.x??0),this.value2Text.y=i+(this.sliderOptions.valueTextOffset?.y??0)}}set width(t){super.width=t,this.updateSlider1(),this.updateSlider2()}get width(){return super.width}set height(t){super.height=t,this.updateSlider1(),this.updateSlider2()}get height(){return super.height}setSize(t,i){super.setSize(t,i),this.updateSlider1(),this.updateSlider2()}}/*!
|
|
4
|
+
* tweedle.js - v2.1.0
|
|
5
|
+
* Compiled Wed, 05 Apr 2023 15:21:25 UTC
|
|
6
|
+
*
|
|
7
|
+
* tweedle.js is licensed under the MIT License.
|
|
8
|
+
* http://www.opensource.org/licenses/mit-license
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2019-2021, Milton Candelero <miltoncandelero@gmail.com>, All Rights Reserved
|
|
11
|
+
*/let K;typeof self>"u"&&typeof process<"u"&&process.hrtime?K=function(){const s=process.hrtime();return s[0]*1e3+s[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?K=self.performance.now.bind(self.performance):Date.now!==void 0?K=Date.now:K=function(){return new Date().getTime()};class x{constructor(){x.prototype.__init.call(this),x.prototype.__init2.call(this),x.prototype.__init3.call(this),x.prototype.__init4.call(this)}__init(){this._tweens={}}static get shared(){return x._shared||(x._shared=new x),x._shared}__init2(){this._paused=!1}isPaused(){return this._paused}pause(){this._paused=!0}resume(){this._paused=!1}__init3(){this._lastUpdateTime=void 0}__init4(){this.now=K}getAll(){return Object.keys(this._tweens).map(t=>this._tweens[t])}removeAll(){this._tweens={}}add(t){this._tweens[t.getId()]=t}remove(t){delete this._tweens[t.getId()]}update(t,i=!1){if(t==null&&(this._lastUpdateTime==null?(this._lastUpdateTime=this.now(),t=0):t=this.now()-this._lastUpdateTime),this._lastUpdateTime=this.now(),this._paused)return!1;const e=Object.keys(this._tweens);if(e.length==0)return!1;for(let h=0;h<e.length;h++){const n=this._tweens[e[h]];n&&n.update(t,!0)==!1&&!i&&delete this._tweens[e[h]]}return!0}}const ci={Linear:{None(s){return s}}},kt={Geom:{Linear(s,t){const i=s.length-1,e=i*t,h=Math.floor(e),n=kt.Utils.Linear;return t<0?n(s[0],s[1],e):t>1?n(s[i],s[i-1],i-e):n(s[h],s[h+1>i?i:h+1],e-h)}},Utils:{Linear(s,t,i){return(t-s)*i+s}}};class et{static __initStatic(){this._nextId=0}static nextId(){return et._nextId++}}et.__initStatic();const it={safetyCheckFunction:s=>!0,easingFunction:ci.Linear.None,yoyoEasingFunction:void 0,interpolationFunction:kt.Geom.Linear};class u{__init(){this._isPaused=!1}__init2(){this._valuesStart={}}__init3(){this._valuesEnd={}}__init4(){this._valuesStartRepeat={}}__init5(){this._duration=0}__init6(){this._repeatCount=0}__init7(){this._repeat=0}__init8(){this._yoyo=!1}__init9(){this._isPlaying=!1}get _reversed(){return this.yoyo&&this._repeatCount%2!==0}__init10(){this._delayTime=0}__init11(){this._startTime=0}__init12(){this._elapsedTime=0}__init13(){this._timescale=1}__init14(){this._safetyCheckFunction=it.safetyCheckFunction}__init15(){this._easingFunction=it.easingFunction}__init16(){this._yoyoEasingFunction=it.yoyoEasingFunction}__init17(){this._interpolationFunction=it.interpolationFunction}__init18(){this._chainedTweens=[]}__init19(){this._onStartCallbackFired=!1}__init20(){this._onAfterDelayCallbackFired=!1}__init21(){this._id=et.nextId()}__init22(){this._isChainStopped=!1}get _group(){return this._groupRef?this._groupRef:x.shared}set _group(t){this._groupRef=t}constructor(t,i){u.prototype.__init.call(this),u.prototype.__init2.call(this),u.prototype.__init3.call(this),u.prototype.__init4.call(this),u.prototype.__init5.call(this),u.prototype.__init6.call(this),u.prototype.__init7.call(this),u.prototype.__init8.call(this),u.prototype.__init9.call(this),u.prototype.__init10.call(this),u.prototype.__init11.call(this),u.prototype.__init12.call(this),u.prototype.__init13.call(this),u.prototype.__init14.call(this),u.prototype.__init15.call(this),u.prototype.__init16.call(this),u.prototype.__init17.call(this),u.prototype.__init18.call(this),u.prototype.__init19.call(this),u.prototype.__init20.call(this),u.prototype.__init21.call(this),u.prototype.__init22.call(this),this._object=t,this._group=i}getId(){return this._id}getGroup(){return this._group}getTimescale(){return this._timescale}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}from(t){try{JSON.stringify(t)}catch{throw new Error("The object you provided to the from() method has a circular reference!")}return this._setupProperties(t,this._valuesStart,t,this._valuesStartRepeat,!0),this}to(t,i){try{this._valuesEnd=JSON.parse(JSON.stringify(t))}catch{return console.warn("The object you provided to the to() method has a circular reference!. It can't be cloned. Falling back to dynamic targeting"),this.dynamicTo(t,i)}return i!==void 0&&(this._duration=i),this}dynamicTo(t,i){return this._valuesEnd=t,i!==void 0&&(this._duration=i),this}duration(t){return this._duration=t,this}start(t){return this._isPlaying?this:(t!=null&&(this._delayTime=t),this._group.add(this),this._reversed&&(this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd),this._valuesStart=JSON.parse(JSON.stringify(this._valuesStartRepeat))),this._repeatCount=0,this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onAfterDelayCallbackFired=!1,this._isChainStopped=!1,this._startTime=-this._delayTime,this._elapsedTime=0,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,!1),this)}restart(t){return this.reset(),this.start(t)}reset(){return this._isPlaying&&this.stop(),this._valuesStart={},this._valuesStartRepeat={},this}rewind(){this._isPlaying&&this.stop(),this._reversed&&this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd);const t=this._easingFunction(0);return this._updateProperties(this._object,this._valuesStart,this._valuesEnd,t),this}_setupProperties(t,i,e,h,n){for(const r in e){const o=t[r],a=Array.isArray(o),l=!Number.isNaN(Number(o)),p=a?"array":typeof o,M=p=="object",U=typeof e[r]=="object",E=!a&&Array.isArray(e[r]);p=="undefined"||p=="function"||e[r]==null||!a&&!l&&!M||((M||a||U)&&o&&!E?(typeof i[r]>"u"&&(i[r]=a?[]:{}),typeof h[r]>"u"&&(h[r]=a?[]:{}),this._setupProperties(o,i[r],e[r],h[r],n)):((typeof i[r]>"u"||n)&&(i[r]=o),(typeof h[r]>"u"||n)&&(E?h[r]=e[r].slice().reverse()[0]:h[r]=i[r]||0)))}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object,this),this):this}end(t=!1){let i=[];if(t||(i=this._chainedTweens,this._chainedTweens=[]),this.resume(),this.update(1/0),!t){this._chainedTweens=i;for(let e=0,h=this._chainedTweens.length;e<h;e++)this._chainedTweens[e].start()}return this}skip(t,i=!1){return this.resume(),this.update(t*this._duration-(i?this._elapsedTime:0)),this}pause(){return this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._group.remove(this),this)}resume(){return!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._group.add(this),this)}stopChainedTweens(){for(let t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].stop();return this}startChainedTweens(t=!1){t&&this.stop();for(let i=0,e=this._chainedTweens.length;i<e;i++)this._chainedTweens[i].start();return this}group(t){return this._group=t,this}delay(t){return this._delayTime=t,this}timescale(t){return this._timescale=t,this}repeat(t=1/0){return this._repeat=t,this}repeatDelay(t){return this._repeatDelayTime=t,this}yoyo(t=!0){return this._yoyo=t,this}easing(t){return this._easingFunction=t,this}safetyCheck(t){return this._safetyCheckFunction=t,this}yoyoEasing(t){return this._yoyoEasingFunction=t,this}interpolation(t){return this._interpolationFunction=t,this}chain(...t){return this._chainedTweens=t,this}onStart(t){return this._onStartCallback=t,this}onAfterDelay(t){return this._onAfterDelayCallback=t,this}onUpdate(t){return this._onUpdateCallback=t,this}onRepeat(t){return this._onRepeatCallback=t,this}onComplete(t){return this._onCompleteCallback=t,this}onStop(t){return this._onStopCallback=t,this}update(t,i=!1){const e=this._internalUpdate(t);return!e&&!i&&this._group.remove(this),e}_internalUpdate(t){if(!this._safetyCheckFunction(this._object)||this._isPaused)return!1;t*=this._timescale;let i;this._elapsedTime+=t;const e=this._duration,h=this._startTime+this._elapsedTime;if(h>e&&!this._isPlaying)return!1;this.isPlaying||this.start(),this._onStartCallbackFired==!1&&(this._onStartCallback&&this._onStartCallback(this._object,this),this._onStartCallbackFired=!0),this._onAfterDelayCallbackFired==!1&&h>=0&&(this._onAfterDelayCallback&&this._onAfterDelayCallback(this._object,this),this._onAfterDelayCallbackFired=!0),i=h/this._duration,this._duration==0&&(h>=0?i=1:i=0),i=Math.min(1,i),i=Math.max(0,i);let n=Number.isFinite(h)?h%this._duration:h;Number.isNaN(n)&&(n=0);const r=Math.floor(h/this._duration);let o;if(this._reversed&&this._yoyoEasingFunction?o=this._yoyoEasingFunction(i):o=this._easingFunction(i),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&(i!=1||this._repeat-this._repeatCount<=0)&&this._onUpdateCallback(this._object,i,this),i==1){if(this._repeat-this._repeatCount>0){const a=this._repeatCount;if(this._repeatCount=Math.min(this._repeat+1,this._repeatCount+r),this._onUpdateCallback&&(this._repeat-this._repeatCount<0||n<=0)&&this._onUpdateCallback(this._object,i,this),this._yoyo?this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd):this._moveForwardStartRepeatValues(this._valuesStartRepeat,this._valuesEnd),this._valuesStart=JSON.parse(JSON.stringify(this._valuesStartRepeat)),this._repeatDelayTime!==void 0?this._startTime=-this._repeatDelayTime:this._startTime=0,this._onRepeatCallback){let l=1;Number.isFinite(r)?l=this._repeatCount-a:Number.isFinite(this._repeat)&&(l=this._repeat-a);for(let p=0;p<l;p++)this._onRepeatCallback(this._object,a+1+p,this)}if(this._elapsedTime=0,this._repeat-this._repeatCount>=0)return n>0&&Number.isFinite(this._repeat)&&this._internalUpdate(n),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object,this);for(let a=0,l=this._chainedTweens.length;a<l;a++)this._chainedTweens[a].start(),n>0&&this._chainedTweens[a].update(n);return this._isPlaying=!1,!1}return!0}_updateProperties(t,i,e,h){for(const n in e){if(i[n]==null)continue;const r=i[n];let o=e[n];const a=Array.isArray(t[n]),l=Array.isArray(o);!a&&l?this._reversed?t[n]=this._interpolationFunction(o.concat([r]),h):t[n]=this._interpolationFunction([r].concat(o),h):typeof o=="object"&&o?this._updateProperties(t[n],r,o,h):(o=this._handleRelativeValue(r,o),typeof o=="number"&&(typeof r=="number"||typeof r=="string")&&(t[n]=Number(r)+(o-Number(r))*h,typeof r=="string"&&(t[n]=String(t[n]))))}}_handleRelativeValue(t,i){return typeof i!="string"?i:i.charAt(0)=="+"||i.charAt(0)=="-"?t+Number(i):Number(i)}_swapEndStartRepeatValues(t,i){for(const e in t){const h=!Array.isArray(t[e])&&Array.isArray(i[e]);if(typeof t[e]=="object")this._swapEndStartRepeatValues(t[e],i[e]);else{const n=t[e];if(typeof i[e]=="string")t[e]=Number(t[e])+Number(i[e]),i[e]=n;else if(h){const r=i[e].slice().reverse();t[e]=r[0],i[e]=r}else t[e]=i[e],i[e]=n}}}_moveForwardStartRepeatValues(t,i){for(const e in t)typeof i[e]=="object"?this._moveForwardStartRepeatValues(t[e],i[e]):typeof i[e]=="string"&&(t[e]=Number(t[e])+Number(i[e]))}}function St(s,t,i=0,e=!0){let h=t.scale.x,n=t.scale.y;if(!s)throw new Error("Parent is not defined");const r=s.width-i*2,o=s.height-i*2,a=r-Math.round(t.width),l=o-Math.round(t.height);if(a<0&&(h=r/(t.width/h)),l<0&&(n=o/(t.height/n)),h<=0||n<=0){t.scale.set(0);return}if(e||t.scale.x===t.scale.y){const p=Math.min(h,n);t.scale.set(p,p)}else{const p=t.scale.x/t.scale.y;a<l?t.scale.set(h,h/p):t.scale.set(n*p,n)}}function pi(s){return typeof s=="string"||typeof s=="number"?new O({text:String(s)}):s}var fi=Object.defineProperty,gi=(s,t,i)=>t in s?fi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,_=(s,t,i)=>gi(s,typeof t!="symbol"?t+"":t,i);class rt extends Kt{constructor(t){super(),_(this,"animations"),_(this,"originalInnerViewState"),_(this,"defaultDuration",100),_(this,"options"),_(this,"_padding"),_(this,"_offset"),_(this,"_textOffset"),_(this,"iconOffset"),_(this,"innerView",new g),_(this,"_views",{}),_(this,"state"),_(this,"anchor"),_(this,"_defaultTextScale",{x:1,y:1}),_(this,"_defaultIconScale",{x:1,y:1}),_(this,"_defaultTextAnchor",{x:.5,y:.5}),_(this,"_defaultIconAnchor",{x:.5,y:.5}),this.options=t??{};const{defaultView:i,hoverView:e,pressedView:h,disabledView:n,text:r,padding:o,offset:a,textOffset:l,iconOffset:p,defaultTextScale:M,defaultIconScale:U,defaultTextAnchor:E,defaultIconAnchor:st,scale:ht,anchor:dt,anchorX:Tt,anchorY:At,icon:Ot,animations:ut}=t??{};this.addChild(this.innerView),this.anchor=new Mt({_onUpdate:()=>this.updateAnchor()}),this.anchor.set(Tt??dt??0,At??dt??0),this.padding=o??0,this.offset=a,this.textOffset=l,this.iconOffset=p,this.defaultTextScale=M,this.defaultIconScale=U,this.defaultTextAnchor=E,this.defaultIconAnchor=st,this.scale.set(ht??1),ut&&(this.animations=ut,lt.shared.add(()=>x.shared.update())),this.setState("default"),this.defaultView=i,this.hoverView=e,this.pressedView=h,this.disabledView=n,this.text=r,this.iconView=Ot,this.initStateControl()}set text(t){if(!t||t===0){this.removeView("textView");return}if(!this._views.textView){this.createTextView(t);return}this._views.textView.text=t.toString()}get text(){return this._views.textView?.text}set enabled(t){this.button.enabled=t,this.setState(t?"default":"disabled")}get enabled(){return this.button.enabled}setState(t,i=!1){if(!i&&this.state===t)return;const e=this.getStateView(this.state);e&&(e.visible=!1),this.state=t;const h=this.getStateView(t);h&&(this.setOffset(h,t,this.offset),h.visible=!0),this.updateAnchor(),this.playAnimations(t)}createTextView(t){if(this._views.textView=pi(t),this.options?.defaultTextScale===void 0){const{x:i,y:e}=this._views.textView.scale;this._defaultTextScale={x:i,y:e}}this.innerView.addChild(this._views.textView),this.adjustTextView(this.state)}setOffset(t,i,e){const h=e?e[i]:{x:0,y:0},n=e?.default;h?(t.x+=h.x??0,t.y+=h.y??0):n?(t.x+=n.x??0,t.y+=n.y??0):(e.x||e.y)&&(t.x+=e.x??0,t.y+=e.y??0)}getStateView(t){if(this._views)switch(t){case"hover":return this._views.hoverView??this._views.defaultView??void 0;case"pressed":return this._views.pressedView??this._views.hoverView??this._views.defaultView??void 0;case"disabled":return this._views.disabledView??this._views.defaultView??void 0;case"default":return this._views.defaultView??void 0;default:return}}adjustTextView(t){if(!this.text)return;const i=this.getStateView(this.state),{x:e,y:h}=this._defaultTextAnchor;if(i){if(this.options.ignoreRefitting||this._views.textView.scale.set(this._defaultTextScale.x,this._defaultTextScale.y),this.contentFittingMode==="default"&&St(i,this._views.textView,this.padding,!1),this.contentFittingMode==="fill"){this._views.textView.scale.set(1);const n=i.width-this.padding*2,r=i.height-this.padding*2,o=n/this._views.textView.width,a=r/this._views.textView.height,l=Math.min(o,a);this._views.textView.scale.set(l*this._defaultTextScale.x,l*this._defaultTextScale.y)}this._views.textView.x=i.x+i.width/2,this._views.textView.y=i.y+i.height/2}this._views.textView.anchor.set(e,h),this.setOffset(this._views.textView,t,this.textOffset)}adjustIconView(t){if(!this._views.iconView)return;const i=this.getStateView(t);if(!i)return;if(this.options.ignoreRefitting||this._views.iconView.scale.set(this._defaultIconScale.x,this._defaultIconScale.y),this.contentFittingMode==="default"&&St(i,this._views.iconView,this.padding,!1),this.contentFittingMode==="fill"){this._views.iconView.scale.set(1);const n=i.width-this.padding*2,r=i.height-this.padding*2,o=n/this._views.iconView.width,a=r/this._views.iconView.height,l=Math.min(o,a);this._views.iconView.scale.set(l*this._defaultIconScale.x,l*this._defaultIconScale.y)}const{x:e,y:h}=this._defaultIconAnchor;"anchor"in this._views.iconView?this._views.iconView.anchor.set(e,h):this._views.iconView.pivot.set(e*(this._views.iconView.width/this._views.iconView.scale.x),h*(this._views.iconView.height/this._views.iconView.scale.y)),this._views.iconView.x=i.x+i.width/2,this._views.iconView.y=i.y+i.height/2,this.setOffset(this._views.iconView,t,this.iconOffset)}updateAnchor(){if(!this._views)return;const t=this.anchor.x??0,i=this.anchor.y??0;if([this._views.defaultView,this._views.hoverView,this._views.pressedView,this._views.disabledView].forEach(h=>{h&&(h.anchor?.set(0),h.x=-h.width*t,h.y=-h.height*i)}),this._views.defaultView){const{x:h,y:n,width:r,height:o}=this._views.defaultView;this.hitArea=new at(h,n,r,o)}this.adjustIconView(this.state),this.adjustTextView(this.state)}set contentFittingMode(t){this.options.contentFittingMode=t}get contentFittingMode(){return this.options.contentFittingMode??"default"}set defaultView(t){this.updateView("defaultView",t),this._views.disabledView&&this.state!=="default"&&(this._views.disabledView.visible=!1)}get defaultView(){return this._views.defaultView}set hoverView(t){this.updateView("hoverView",t),this._views.hoverView&&this.state!=="hover"&&(this._views.hoverView.visible=!1)}get hoverView(){return this._views.hoverView}set pressedView(t){this.updateView("pressedView",t),this._views.pressedView&&this.state!=="pressed"&&(this._views.pressedView.visible=!1)}get pressedView(){return this._views.pressedView}set disabledView(t){this.updateView("disabledView",t),this._views.disabledView&&this.state!=="disabled"&&(this._views.disabledView.visible=!1)}get disabledView(){return this._views.disabledView}updateView(t,i){i!==void 0&&(this.removeView(t),i!==null&&(this.options?.nineSliceSprite&&(typeof i=="string"?this._views[t]=new C({texture:b.from(i),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):i instanceof b?this._views[t]=new C({texture:i,leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):console.warn("NineSliceSprite can not be used with views set as Container. Pass the texture or texture name as instead of the Container extended instance.")),this._views[t]||(this._views[t]=w(i)),this.setOffset(this._views[t],this.state,this.offset),this._views[t].parent||this.innerView.addChild(this._views[t]),this.updateAnchor(),this._views.iconView&&this.innerView.addChild(this._views.iconView),this._views.textView&&this.innerView.addChild(this._views.textView),this.setState(this.state,!0)))}removeView(t){this._views[t]&&(this.innerView.removeChild(this._views[t]),this._views[t]=null)}set textView(t){t!==void 0&&(this.removeView("textView"),t!==null&&this.createTextView(t))}get textView(){return this._views.textView}set iconView(t){if(t!==void 0&&(this.removeView("iconView"),t!==null)){if(this._views.iconView=w(t),this.options?.defaultIconScale===void 0){const{x:i,y:e}=this._views.iconView.scale;this._defaultIconScale={x:i,y:e}}this._views.iconView.parent||this.innerView.addChild(this._views.iconView),this.setState(this.state,!0)}}get iconView(){return this._views.iconView}playAnimations(t){if(!this.animations)return;if(t==="default"&&!this.originalInnerViewState){this.originalInnerViewState={x:this.innerView.x,y:this.innerView.y,width:this.innerView.width,height:this.innerView.height,scale:{x:this.innerView.scale.x,y:this.innerView.scale.y}};const e=this.animations?.default;if(e){this.innerView.x=e.props.x??this.originalInnerViewState.x,this.innerView.y=e.props.y??this.originalInnerViewState.y,this.innerView.width=e.props.width??this.originalInnerViewState.width,this.innerView.height=e.props.height??this.originalInnerViewState.height,this.innerView.scale.x=e.props.scale.x??this.originalInnerViewState.scale.x,this.innerView.scale.y=e.props.scale.y??this.originalInnerViewState.scale.y;return}}const i=this.animations[t]??this.animations.default;if(i){const e=i;this.defaultDuration=e.duration,new u(this.innerView).to(e.props,e.duration).start();return}new u(this.innerView).to(this.originalInnerViewState,this.defaultDuration).start()}initStateControl(){this.onDown.connect(()=>{this.setState("pressed")}),this.onUp.connect(()=>{y.any?this.setState("default"):this.setState("hover")}),this.onUpOut.connect(()=>{this.setState("default")}),this.onOut.connect(()=>{this.button.isDown||this.setState("default")}),this.onPress.connect(()=>{y.any?this.setState("default"):this.setState("hover")}),this.onHover.connect(()=>{this.button.isDown||(y.any?this.setState("default"):this.setState("hover"))})}set padding(t){this._padding=t,this.adjustTextView(this.state),this.adjustIconView(this.state)}get padding(){return this._padding}set offset(t){this._offset=t,this.updateAnchor()}get offset(){return this._offset}set textOffset(t){this._textOffset=t,this.adjustTextView(this.state)}get textOffset(){return this._textOffset}set defaultTextScale(t){if(t===void 0)return;this.options.defaultTextScale=t;const i=typeof t=="number";this._defaultTextScale.x=i?t:t.x??1,this._defaultTextScale.y=i?t:t.y??1,this.adjustTextView(this.state)}get defaultTextScale(){return this.defaultTextScale}set defaultIconScale(t){if(t===void 0)return;this.options.defaultIconScale=t;const i=typeof t=="number";this._defaultIconScale.x=i?t:t.x??1,this._defaultIconScale.y=i?t:t.y??1,this.adjustIconView(this.state)}get defaultIconScale(){return this.defaultIconScale}set defaultTextAnchor(t){if(t===void 0)return;this.options.defaultTextAnchor=t;const i=typeof t=="number";this._defaultTextAnchor.x=i?t:t.x??1,this._defaultTextAnchor.y=i?t:t.y??1,this.adjustTextView(this.state)}get defaultTextAnchor(){return this.defaultTextAnchor}set defaultIconAnchor(t){if(t===void 0)return;this.options.defaultIconAnchor=t;const i=typeof t=="number";this._defaultIconAnchor.x=i?t:t.x??1,this._defaultIconAnchor.y=i?t:t.y??1,this.adjustIconView(this.state)}get defaultIconAnchor(){return this.defaultIconAnchor}set width(t){this.options?.nineSliceSprite?(this._views.defaultView&&(this._views.defaultView.width=t),this._views.hoverView&&(this._views.hoverView.width=t),this._views.pressedView&&(this._views.pressedView.width=t),this._views.disabledView&&(this._views.disabledView.width=t),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.width=t}get width(){return super.width}set height(t){this.options?.nineSliceSprite?(this._views.defaultView&&(this._views.defaultView.height=t),this._views.hoverView&&(this._views.hoverView.height=t),this._views.pressedView&&(this._views.pressedView.height=t),this._views.disabledView&&(this._views.disabledView.height=t),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.height=t}get height(){return super.height}setSize(t,i){this.options?.nineSliceSprite?(this._views.defaultView&&this._views.defaultView.setSize(t,i),this._views.hoverView&&this._views.hoverView.setSize(t,i),this._views.pressedView&&this._views.pressedView.setSize(t,i),this._views.disabledView&&this._views.disabledView.setSize(t,i),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.setSize(t,i)}}var _i=Object.defineProperty,wi=(s,t,i)=>t in s?_i(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,c=(s,t,i)=>wi(s,typeof t!="symbol"?t+"":t,i);const mi="*";class ie extends g{constructor(t){super(),c(this,"_bg"),c(this,"inputMask"),c(this,"_cursor"),c(this,"_value",""),c(this,"_secure"),c(this,"inputField"),c(this,"placeholder"),c(this,"editing",!1),c(this,"tick",0),c(this,"lastInputData"),c(this,"activation",!1),c(this,"options"),c(this,"input"),c(this,"handleActivationBinding",this.handleActivation.bind(this)),c(this,"onKeyUpBinding",this.onKeyUp.bind(this)),c(this,"stopEditingBinding",this.stopEditing.bind(this)),c(this,"onInputBinding",this.onInput.bind(this)),c(this,"onPasteBinding",this.onPaste.bind(this)),c(this,"onEnter"),c(this,"onChange"),c(this,"paddingTop",0),c(this,"paddingRight",0),c(this,"paddingBottom",0),c(this,"paddingLeft",0),this.options=t,this.options=t,this.padding=t.padding,this._secure=t.secure??!1,this.cursor="text",this.interactive=!0,this.on("pointertap",()=>{this.activation=!0,y.any&&this.handleActivation()}),window.addEventListener(y.any?"touchstart":"click",this.handleActivationBinding),this.onEnter=new f.Signal,this.onChange=new f.Signal,lt.shared.add(i=>this.update(i.deltaTime)),t.bg?this.bg=t.bg:console.error("Input: bg is not defined, please define it.")}onInput(t){this.lastInputData=t.data}onKeyUp(t){const i=t.key;["Shift","Control","Alt","Meta","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","CapsLock","AltGraph","Tab","ContextMenu","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","ScrollLock","Pause","Insert","Delete","Home","End","PageUp","PageDown","NumLock","Dead"].includes(i)||t.metaKey||t.ctrlKey||(i==="Backspace"?this._delete():i==="Escape"||i==="Enter"?this.stopEditing():i.length===1?this._add(i):this.lastInputData&&this.lastInputData.length===1&&this._add(this.lastInputData),this.input&&(this.input.value=""))}init(){const t=this.options,i={fill:0,align:"center"};this.options.textStyle=t.textStyle??i,this.options.TextClass=t.TextClass??O;const e={...i,...t.textStyle},h=e.fill&&Et.isColorLike(e.fill)?e.fill:0;this.inputField=new this.options.TextClass({text:"",style:e}),this._cursor=new V(b.WHITE),this._cursor.tint=h,this._cursor.anchor.set(.5),this._cursor.width=2,this._cursor.height=this.inputField.height*.8,this._cursor.alpha=0,this.placeholder=new this.options.TextClass({text:t.placeholder,style:e??i}),this.placeholder.visible=!!t.placeholder,this.addChild(this.inputField,this.placeholder,this._cursor),this.value=t.value??"",this.align()}set bg(t){this._bg&&this._bg.destroy(),this.options?.nineSliceSprite&&(typeof t=="string"?this._bg=new C({texture:b.from(t),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):t instanceof b?this._bg=new C({texture:t,leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):console.warn(`NineSliceSprite can not be used with views set as Container.
|
|
12
|
+
Pass the texture or texture name as instead of the Container extended instance.`)),this._bg||(this._bg=w(t)),this._bg.cursor="text",this._bg.interactive=!0,this.addChildAt(this._bg,0),this.inputField||this.init(),this.options.addMask&&this.createInputMask(t)}get bg(){return this._bg}_add(t){this.editing&&(this.options.maxLength&&this.value.length>=this.options.maxLength||(this.value=this.value+t,this.onChange.emit(this.value)))}_delete(){const t=this.value.length;!this.editing||t===0||(this.value=this.value.substring(0,t-1),this.onChange.emit(this.value))}_startEditing(){this.options.cleanOnFocus&&(this.value=""),this.tick=0,this.editing=!0,this.placeholder.visible=!1,this._cursor.alpha=1,this.createInputField(),this.align()}createInputField(){this.input&&(this.input.removeEventListener("blur",this.stopEditingBinding),this.input.removeEventListener("keydown",this.onKeyUpBinding),this.input.removeEventListener("input",this.onInputBinding),this.input.removeEventListener("paste",this.onPasteBinding),this.input?.blur(),this.input?.remove(),this.input=null);const t=document.createElement("input");document.body.appendChild(t),t.style.position="fixed",t.style.left=`${this.getGlobalPosition().x}px`,t.style.top=`${this.getGlobalPosition().y}px`,t.style.opacity="0.0000001",t.style.width=`${this._bg.width}px`,t.style.height=`${this._bg.height}px`,t.style.border="none",t.style.outline="none",t.style.background="white",y.android.device?setTimeout(()=>{t.focus(),t.click()},100):(t.focus(),t.click()),t.addEventListener("blur",this.stopEditingBinding),t.addEventListener("keydown",this.onKeyUpBinding),t.addEventListener("input",this.onInputBinding),t.addEventListener("paste",this.onPasteBinding),this.input=t,this.align()}handleActivation(){this.editing||(this.stopEditing(),this.activation&&(this._startEditing(),this.activation=!1))}stopEditing(){this.editing&&(this._cursor.alpha=0,this.editing=!1,this.inputField.text===""&&(this.placeholder.visible=!0),this.value.length===0&&(this.placeholder.visible=!0),this.input?.blur(),this.input?.remove(),this.input=null,this.align(),this.onEnter.emit(this.value))}update(t){this.editing&&(this.tick+=t*.1,this._cursor.alpha=Math.round(Math.sin(this.tick)*.5+.5))}align(){if(!this._bg)return;const t=this.getAlign();this.inputField.anchor.set(t,.5),this.inputField.x=this._bg.width*t+(t===1?-this.paddingRight:this.paddingLeft),this.inputField.y=this._bg.height/2+this.paddingTop-this.paddingBottom,this.placeholder.anchor.set(t,.5),this.placeholder.x=this._bg.width*t+(t===1?-this.paddingRight:this.paddingLeft),this.placeholder.y=this._bg.height/2,this._cursor.x=this.getCursorPosX(),this._cursor.y=this.inputField.y}getAlign(){const t=this._bg.width*.95,i=this.paddingLeft+this.paddingRight-10;if(this.inputField.width+i>t)return this.editing?1:0;switch(this.options.align){case"left":return 0;case"center":return .5;case"right":return 1;default:return 0}}getCursorPosX(){switch(this.getAlign()){case 0:return this.inputField.x+this.inputField.width;case .5:return this.inputField.x+this.inputField.width*.5;case 1:return this.inputField.x;default:return 0}}set value(t){const i=t.length;this._value=t,this.inputField.text=this.secure?mi.repeat(i):t,i!==0?this.placeholder.visible=!1:this.placeholder.visible=!this.editing,this.align()}get value(){return this._value}set secure(t){this._secure=t,this.value=this._value}get secure(){return this._secure}set padding(t){typeof t=="number"&&(this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t),Array.isArray(t)?(this.paddingTop=t[0]??0,this.paddingRight=t[1]??t[0]??0,this.paddingBottom=t[2]??t[0]??0,this.paddingLeft=t[3]??t[1]??t[0]??0):typeof t=="object"&&(this.paddingTop=t.top??0,this.paddingRight=t.right??0,this.paddingBottom=t.bottom??0,this.paddingLeft=t.left??0)}get padding(){return[this.paddingTop,this.paddingRight,this.paddingBottom,this.paddingLeft]}destroy(t){this.off("pointertap"),window.removeEventListener(y.any?"touchstart":"click",this.handleActivationBinding),super.destroy(t)}set width(t){this.options?.nineSliceSprite?(this._bg&&(this._bg.width=t),this.updateInputMaskSize(),this.align()):super.width=t}get width(){return super.width}set height(t){this.options?.nineSliceSprite?(this._bg&&(this._bg.height=t),this.updateInputMaskSize(),this.align()):super.height=t}get height(){return super.height}setSize(t,i){this.options?.nineSliceSprite?(this._bg&&this._bg.setSize(t,i),this.updateInputMaskSize(),this.align()):super.setSize(t,i)}createInputMask(t){this.inputMask&&(this.inputField.mask=null,this._cursor.mask=null,this.inputMask.destroy()),this.options?.nineSliceSprite&&typeof t=="string"?this.inputMask=new C({texture:b.from(t),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):t instanceof V?this.inputMask=new V(t.texture):t instanceof S?this.inputMask=t.clone(!0):this.inputMask=w(t),this.inputField.mask=this.inputMask,this._cursor.mask=this.inputMask,this.updateInputMaskSize(),this.addChildAt(this.inputMask,0)}updateInputMaskSize(){!this.inputMask||!this._bg||(this.inputMask.setSize(this._bg.width-this.paddingLeft-this.paddingRight,this._bg.height-this.paddingTop-this.paddingBottom),this.inputMask.position.set(this.paddingLeft,this.paddingTop))}onPaste(t){t.preventDefault();const i=(t.clipboardData||window.clipboardData).getData("text");i&&this._add(i)}}var vi=Object.defineProperty,bi=(s,t,i)=>t in s?vi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,q=(s,t,i)=>bi(s,typeof t!="symbol"?t+"":t,i);class It extends g{constructor(t){super(),q(this,"options"),q(this,"view"),q(this,"_type"),q(this,"_maxWidth"),q(this,"children",[]),t&&(t.maxWidth&&(this._maxWidth=t.maxWidth),this.init(t)),t?.items?.forEach(i=>this.addChild(i)),this.on("added",()=>this.arrangeChildren()),this.on("childAdded",()=>this.arrangeChildren())}init(t){this.options=t,t?.type&&(this.type=t.type),t?.children&&t.children.forEach(i=>this.addChild(i))}set type(t){this._type=t,this.arrangeChildren()}get type(){return this._type}set elementsMargin(t){if(!this.options)throw new Error("List has not been initiated!");this.options.elementsMargin=t,this.arrangeChildren()}get elementsMargin(){return this.options?.elementsMargin??0}set padding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.padding=t,this.options.vertPadding=t,this.options.horPadding=t,this.options.leftPadding=t,this.options.rightPadding=t,this.options.topPadding=t,this.options.bottomPadding=t,this.arrangeChildren()}get padding(){return this.options?.padding??0}set vertPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.vertPadding=t,this.options.topPadding=t,this.options.bottomPadding=t,this.arrangeChildren()}get vertPadding(){return this.options?.vertPadding??this.padding??0}set horPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.horPadding=t,this.options.leftPadding=t,this.options.rightPadding=t,this.arrangeChildren()}get horPadding(){return this.options?.horPadding??this.padding??0}set leftPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.leftPadding=t,this.arrangeChildren()}get leftPadding(){return this.options?.leftPadding??this.horPadding}set rightPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.rightPadding=t,this.arrangeChildren()}get rightPadding(){return this.options?.rightPadding??this.horPadding}set topPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.topPadding=t,this.arrangeChildren()}get topPadding(){return this.options?.topPadding??this.vertPadding}set bottomPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.bottomPadding=t,this.arrangeChildren()}get bottomPadding(){return this.options?.bottomPadding??this.vertPadding}arrangeChildren(){let t=0,i=this.leftPadding,e=this.topPadding;const h=this.options?.elementsMargin??0;let n=this.maxWidth??this.parent?.width;this.rightPadding&&(n-=this.rightPadding),this.children.forEach((r,o)=>{switch(this.type){case"vertical":r.y=e,r.x=i,e+=h+r.height;break;case"horizontal":r.x=i,r.y=e,i+=h+r.width;break;case"bidirectional":default:r.x=i,r.y=e,r.x+r.width>n&&o>0&&(e+=h+t,i=this.leftPadding,r.x=i,r.y=e,t=0),t=Math.max(t,r.height),i+=h+r.width;break}})}removeItem(t){const i=this.children[t];i&&(this.removeChild(i),this.arrangeChildren())}set maxWidth(t){this._maxWidth=t,this.arrangeChildren()}get maxWidth(){return this._maxWidth}}var xi=Object.defineProperty,yi=(s,t,i)=>t in s?xi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,F=(s,t,i)=>yi(s,typeof t!="symbol"?t+"":t,i);class ee extends g{constructor(t){super(),F(this,"target"),F(this,"border",new S),F(this,"_targetMask"),F(this,"maskData"),F(this,"borderWidth"),F(this,"borderColor"),t?.target&&this.init(t)}init({target:t,mask:i,borderWidth:e,borderColor:h}){this.target&&this.removeChild(this.target),this.target=w(t),this.addChild(this.border,this.target),i&&this.applyMask(i),e&&this.setBorder(e,h)}applyMask(t){this.maskData=t,this._targetMask=w(t),this.addChild(this._targetMask),this.target.mask=this._targetMask}setBorder(t,i){if(this.borderWidth=t,this.borderColor=i,this.showBorder(),this.maskData){const e=typeof this.maskData=="string"?V.from(this.maskData):this.maskData.clone(!0);e.width+=t*2,e.height+=t*2,this.mask=e,this.addChild(e),this._targetMask.position.set(t)}}showBorder(){const t=this.borderWidth*2;this.border.clear().rect(0,0,this.target.width+t,this.target.height+t).fill(this.borderColor),this.target.x=this.borderWidth,this.target.y=this.borderWidth}hideBorder(){this.border.clear()}}var Si=Object.defineProperty,Ci=(s,t,i)=>t in s?Si(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,B=(s,t,i)=>Ci(s,typeof t!="symbol"?t+"":t,i);class se extends g{constructor(t){super(),B(this,"items",[]),B(this,"innerView"),B(this,"value"),B(this,"selected"),B(this,"onChange"),B(this,"options"),t&&this.init(t),this.onChange=new f.Signal}init(t){this.options=t,this.value=t.items[t.selectedItem||0].labelText?.text,this.selected=t.selectedItem??0,this.innerView?(this.innerView.type=t.type,this.innerView.elementsMargin=t.elementsMargin):this.innerView=new It({type:t.type,elementsMargin:t.elementsMargin}),this.addItems(t.items),this.addChild(this.innerView),this.selectItem(this.selected)}addItems(t){t.forEach((i,e)=>{i.onChange.connect(()=>this.selectItem(e)),this.items.push(i),this.innerView.addChild(i)})}removeItems(t){t.forEach(i=>{const e=this.items[i];e&&(e.onChange.disconnectAll(),this.innerView.removeChild(e),this.items.splice(i,1))})}selectItem(t){this.items.forEach((i,e)=>{i.forceCheck(e===t)}),this.selected!==t&&this.onChange.emit(t,this.items[t].labelText?.text),this.value=this.options.items[t].labelText?.text,this.selected=t}}var Vi=Object.defineProperty,Pi=(s,t,i)=>t in s?Vi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,J=(s,t,i)=>Pi(s,typeof t!="symbol"?t+"":t,i);class ki{constructor(t={}){J(this,"x"),J(this,"ax"),J(this,"dx"),J(this,"tx"),J(this,"_options"),this.x=0,this.ax=0,this.dx=0,this.tx=0,this._options=t,this._options.max=t.max||160,this._options.damp=t.damp||.8,this._options.springiness=t.springiness||.1}update(){this.ax=(this.tx-this.x)*this._options.springiness,this.dx+=this.ax,this.dx*=this._options.damp,this.dx<-this._options.max?this.dx=-this._options.max:this.dx>this._options.max&&(this.dx=this._options.max),this.x+=this.dx}reset(){this.x=0,this.ax=0,this.dx=0,this.tx=0}get max(){return this._options.max}set max(t){this._options.max=t}get damp(){return this._options.damp}set damp(t){this._options.damp=t}get springiness(){return this._options.springiness}set springiness(t){this._options.springiness=t}}var Ii=Object.defineProperty,Ti=(s,t,i)=>t in s?Ii(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,D=(s,t,i)=>Ti(s,typeof t!="symbol"?t+"":t,i);class Ai{constructor(){D(this,"done"),D(this,"to"),D(this,"_spring"),D(this,"_pos"),D(this,"_speed"),D(this,"_correctSpeed"),this._spring=new ki,this._pos=0,this.to=0}start(t,i,e){this._speed=t,this._pos=i,this.to=e,this.done=!1,this._spring.x=this._pos,this._spring.tx=this.to;const h=this.to-this._pos,n=Math.abs(h)/h,r=Math.abs(this._speed)/this._speed;n!==r?this._correctSpeed=!0:this._correctSpeed=!1}update(){if(this._correctSpeed)this._speed*=.6,Math.abs(this._speed)<2&&(this._correctSpeed=!1),this._pos+=this._speed,this._spring.x=this._pos;else{const t=this.to-this._pos;Math.abs(t)<.05?(this._pos=this.to,this.done=!0):(this._spring.tx=this.to,this._spring.update(),this._pos=this._spring.x)}return this._pos}cancel(){}}var Oi=Object.defineProperty,Mi=(s,t,i)=>t in s?Oi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,v=(s,t,i)=>Mi(s,typeof t!="symbol"?t+"":t,i);class Ct{constructor(t={}){v(this,"position",0),v(this,"constrain",!0),v(this,"min",0),v(this,"max",0),v(this,"maxSpeed",400),v(this,"_ease"),v(this,"_offset",0),v(this,"_prev",0),v(this,"_speed",0),v(this,"_hasStopped"),v(this,"_targetSpeed",0),v(this,"_speedChecker",0),v(this,"_grab",0),v(this,"_activeEase"),this.constrain=t.constrain??!0,this.maxSpeed=t.maxSpeed??400,this._ease=t.ease??new Ai}set value(t){this._speed=0,this.position=t}get value(){return this.position}grab(t){this._grab=t,this._offset=this.position-t,this._speedChecker=0,this._targetSpeed=this._speed=0,this._hasStopped=!1}hold(t){this._speedChecker++,this.position=t+this._offset,this._speedChecker>1&&(this._targetSpeed=this.position-this._prev),this._speed+=(this._targetSpeed-this._speed)/2,this._speed>this.maxSpeed?this._speed=this.maxSpeed:this._speed<-this.maxSpeed&&(this._speed=-this.maxSpeed),this._prev=this.position,this.constrain&&(this._activeEase=null,this.position>this.min?this.position-=(this.position-this.min)/1.5:this.position<this.max&&(this.position+=(this.max-this.position)/1.5))}slide(t=!1){this._hasStopped||(this.constrain?this._updateConstrain(t):this._updateDefault())}get moveAmount(){return-(this.position-this._offset-this._grab)}_updateDefault(){this._speed*=.9,this.position+=this._speed,(this._speed<0?this._speed*-1:this._speed)<.01&&(this._hasStopped=!0)}_updateConstrain(t=!1){const i=this.max;t?(this.value>0&&(this.value=0),this.value>0&&(this.value=0),this.value<this.max&&(this.value=this.max),this.value<this.max&&(this.value=this.max)):this.position>this.min||this.position<i||this._activeEase?(this._activeEase||(this._activeEase=this._ease,this.position>this.min?this._activeEase.start(this._speed,this.position,this.min):this._activeEase.start(this._speed,this.position,i)),this.position=this._activeEase.update(),this._activeEase.done&&(this.position=this._activeEase.to,this._speed=0,this._activeEase=null)):this._updateDefault()}}var Ei=Object.defineProperty,Fi=(s,t,i)=>t in s?Ei(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,I=(s,t,i)=>Fi(s,typeof t!="symbol"?t+"":t,i);class Bi{constructor(t){I(this,"xAxis"),I(this,"yAxis"),I(this,"_isDown"),I(this,"_globalPosition"),I(this,"_frame"),I(this,"_bounds"),I(this,"_dirty"),I(this,"disableEasing",!1),this.xAxis=new Ct({ease:t.xEase,maxSpeed:t.maxSpeed,constrain:t.constrain}),this.yAxis=new Ct({ease:t.yEase,maxSpeed:t.maxSpeed,constrain:t.constrain}),this.disableEasing=t.disableEasing??!1,this._frame=new at,this._bounds=new at,this._globalPosition=new Ft}pointerDown(t){this._globalPosition=t,this.xAxis.grab(t.x),this.yAxis.grab(t.y),this._isDown=!0}pointerUp(){this._isDown=!1}pointerMove(t){this._globalPosition=t}update(){this._dirty&&(this._dirty=!1,this.xAxis.min=this._bounds.left,this.xAxis.min=this._bounds.right-this._frame.width,this.xAxis.min=this._bounds.top,this.xAxis.min=this._bounds.bottom-this._frame.height),this._isDown?(this.xAxis.hold(this._globalPosition.x),this.yAxis.hold(this._globalPosition.y)):(this.xAxis.slide(this.disableEasing),this.yAxis.slide(this.disableEasing))}resize(t,i){this._frame.x=0,this._frame.width=t,this._frame.y=0,this._frame.height=i,this._dirty=!0}setBounds(t,i,e,h){this._bounds.x=t,this._bounds.width=i-t,this._bounds.y=e,this._bounds.height=h-e,this._dirty=!0}get x(){return this.xAxis.value}get y(){return this.yAxis.value}}var Di=Object.defineProperty,Ui=(s,t,i)=>t in s?Di(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,d=(s,t,i)=>Ui(s,typeof t!="symbol"?t+"":t,i);class Li extends g{constructor(t){super(),d(this,"background"),d(this,"borderMask"),d(this,"lastWidth"),d(this,"lastHeight"),d(this,"_width",0),d(this,"_height",0),d(this,"_dimensionChanged",!1),d(this,"list"),d(this,"_trackpad"),d(this,"isDragging",0),d(this,"interactiveStorage",[]),d(this,"visibleItems",[]),d(this,"pressedChild"),d(this,"ticker",lt.shared),d(this,"options"),d(this,"stopRenderHiddenItemsTimeout"),d(this,"onMouseScrollBinding",this.onMouseScroll.bind(this)),d(this,"dragStarTouchPoint"),d(this,"isOver",!1),d(this,"proximityRange"),d(this,"proximityStatusCache",[]),d(this,"lastScrollX"),d(this,"lastScrollY"),d(this,"proximityCheckFrameCounter",0),d(this,"onProximityChange",new f.Signal),d(this,"onScroll",new f.Signal),t&&this.init(t),this.ticker.add(this.update,this)}init(t){this.options=t,this.setBackground(t.background),this._width=t.width|this.background.width,this._height=t.height|this.background.height,this.proximityRange=t.proximityRange??0,this.list||(this.list=new It,super.addChild(this.list)),this.list.init({type:t.type,elementsMargin:t.elementsMargin,padding:t.padding,vertPadding:t.vertPadding,horPadding:t.horPadding,topPadding:t.topPadding,bottomPadding:t.bottomPadding,leftPadding:t.leftPadding,rightPadding:t.rightPadding}),this.addItems(t.items),this.hasBounds&&(this.addMask(),this.makeScrollable()),this._trackpad.xAxis.value=0,this._trackpad.yAxis.value=0,this.options.globalScroll=t.globalScroll??!0,this.options.shiftScroll=t.shiftScroll??!1,this.resize()}get hasBounds(){return!!this._width||!!this._height}addItems(t){t?.length&&t.forEach(i=>this.addItem(i))}removeItems(){this.proximityStatusCache.length=0,this.list.removeChildren()}addItem(...t){if(t.length>1)t.forEach(i=>this.addItem(i));else{const i=t[0];(!i.width||!i.height)&&console.error("ScrollBox item should have size"),i.eventMode="static",this.list.addChild(i),this.proximityStatusCache.push(!1),this.options.disableDynamicRendering||(i.renderable=this.isItemVisible(i))}return this.resize(),t[0]}removeItem(t){this.list.removeItem(t),this.proximityStatusCache.splice(t,1),this.resize()}isItemVisible(t,i=0){let e=!1;const h=this.list;if(this.isVertical||this.isBidirectional){const n=t.y+h.y;n+t.height>=-i&&n<=this.options.height+i&&(e=!0)}if(this.isHorizontal||this.isBidirectional){const n=t.x+h.x;n+t.width>=-i&&n<=this.options.width+i&&(e=!0)}return e}get items(){return this.list?.children??[]}setBackground(t){this.background&&this.removeChild(this.background),this.options.background=t,this.background=new S,this.addChildAt(this.background,0),this.resize()}addMask(){this.borderMask||(this.borderMask=new S,super.addChild(this.borderMask),this.mask=this.borderMask),this.resize()}makeScrollable(){this._trackpad||(this._trackpad=new Bi({disableEasing:this.options.disableEasing})),this.on("pointerdown",t=>{this.renderAllItems(),this.isDragging=1,this.dragStarTouchPoint=this.worldTransform.applyInverse(t.global),this._trackpad.pointerDown(this.dragStarTouchPoint);const i=this.list.worldTransform.applyInverse(t.global);this.visibleItems.forEach(e=>{e.x<i.x&&e.x+e.width>i.x&&e.y<i.y&&e.y+e.height>i.y&&(this.pressedChild=e)})}),this.on("pointerup",()=>{this.isDragging=0,this._trackpad.pointerUp(),this.restoreItemsInteractivity(),this.pressedChild=null,this.stopRenderHiddenItems()}),this.on("pointerover",()=>{this.isOver=!0}),this.on("pointerout",()=>{this.isOver=!1}),this.on("pointerupoutside",()=>{this.isDragging=0,this._trackpad.pointerUp(),this.restoreItemsInteractivity(),this.pressedChild=null,this.stopRenderHiddenItems()}),this.on("globalpointermove",t=>{if(!this.isDragging)return;const i=this.worldTransform.applyInverse(t.global);if(this.dragStarTouchPoint){const e=this.options.dragTrashHold??10;if(this.isHorizontal||this.isBidirectional){const h=i.x-this.dragStarTouchPoint.x;Math.abs(h)>e&&(this.isDragging=2)}if(this.isVertical||this.isBidirectional){const h=i.y-this.dragStarTouchPoint.y;Math.abs(h)>e&&(this.isDragging=2)}}this.dragStarTouchPoint&&this.isDragging!==2||(this._trackpad.pointerMove(i),this.pressedChild&&(this.revertClick(this.pressedChild),this.pressedChild=null),this.isBidirectional?this.onScroll?.emit({x:this.scrollX,y:this.scrollY}):this.onScroll?.emit(this.isVertical?this.scrollY:this.scrollX))}),document.addEventListener("wheel",this.onMouseScrollBinding,!0)}setInteractive(t){this.eventMode=t?"static":"auto"}get listHeight(){return this.list.height+this.list.topPadding+this.list.bottomPadding}get listWidth(){return this.list.width+this.list.leftPadding+this.list.rightPadding}resize(t=!1){if(this.hasBounds){if(this.renderAllItems(),this.borderMask&&(t||this._dimensionChanged||this.lastWidth!==this.listWidth||this.lastHeight!==this.listHeight)){this.options.width||(this._width+=this.listWidth),this.options.height||(this._height+=this.listHeight),this.borderMask.clear().roundRect(0,0,this._width,this._height,this.options.radius|0).fill(16711935).stroke(0),this.borderMask.eventMode="none";const i=this.options.background;this.background.clear().roundRect(0,0,this._width,this._height,this.options.radius|0).fill({color:i??0,alpha:i?1:1e-7}),this.isBidirectional?this.setInteractive(this.listWidth>this._width||this.listHeight>this._height):this.isHorizontal?this.setInteractive(this.listWidth>this._width):this.setInteractive(this.listHeight>this._height),this.lastWidth=this.listWidth,this.lastHeight=this.listHeight}if(this._trackpad){const i=this.borderMask.width-this.list.width-this.list.leftPadding-this.list.rightPadding,e=this.borderMask.height-this.list.height-this.list.topPadding-this.list.bottomPadding;this.isBidirectional?(this._trackpad.yAxis.max=-Math.abs(e),this._trackpad.xAxis.max=-Math.abs(i)):this.isVertical?this._trackpad.yAxis.max=-Math.abs(e):this.isHorizontal&&(this._trackpad.xAxis.max=-Math.abs(i))}this._dimensionChanged?(this.list.arrangeChildren(),this.stopRenderHiddenItems(),this._dimensionChanged=!1):(t&&this.list.arrangeChildren(),this.updateVisibleItems()),this.lastScrollX=null,this.lastScrollY=null}}onMouseScroll(t){if(!this.isOver&&!this.options.globalScroll)return;this.renderAllItems();const i=!!this.options.shiftScroll,e=i?typeof t.deltaX<"u"||typeof t.deltaY<"u":typeof t.deltaX<"u",h=typeof t.deltaY<"u";if((this.isHorizontal||this.isBidirectional)&&e){const n=i||this.isBidirectional?t.deltaX:t.deltaY,r=this.list.x-n;if(this.listWidth<this._width)this._trackpad.xAxis.value=0;else{const o=this._width-this.listWidth,a=0;this._trackpad.xAxis.value=Math.min(a,Math.max(o,r))}}if((this.isVertical||this.isBidirectional)&&h){const n=this.list.y-t.deltaY;if(this.listHeight<this._height)this._trackpad.yAxis.value=0;else{const r=this._height-this.listHeight,o=0;this._trackpad.yAxis.value=Math.min(o,Math.max(r,n))}}this.isBidirectional&&(e||h)?this.onScroll?.emit({x:this._trackpad.xAxis.value,y:this._trackpad.yAxis.value}):this.isHorizontal&&e?this.onScroll?.emit(this._trackpad.xAxis.value):this.isVertical&&h&&this.onScroll?.emit(this._trackpad.yAxis.value),this.stopRenderHiddenItems()}scrollBottom(){this.interactive?this.scrollTo(this.list.children.length-1):this.scrollTop()}scrollTop(){this.renderAllItems(),this._trackpad.xAxis.value=0,this._trackpad.yAxis.value=0,this.stopRenderHiddenItems()}renderAllItems(){clearTimeout(this.stopRenderHiddenItemsTimeout),this.stopRenderHiddenItemsTimeout=null,!this.options.disableDynamicRendering&&this.items.forEach(t=>{t.renderable=!0})}stopRenderHiddenItems(){this.options.disableDynamicRendering||(this.stopRenderHiddenItemsTimeout&&(clearTimeout(this.stopRenderHiddenItemsTimeout),this.stopRenderHiddenItemsTimeout=null),this.stopRenderHiddenItemsTimeout=setTimeout(()=>this.updateVisibleItems(),2e3))}updateVisibleItems(){this.visibleItems.length=0,this.items.forEach(t=>{t.renderable=this.isItemVisible(t),this.visibleItems.push(t)})}scrollTo(t){if(!this.interactive)return;const i=this.list.children[t];i&&(this.renderAllItems(),this._trackpad.xAxis.value=this.isHorizontal||this.isBidirectional?this._width-i.x-i.width-this.list.rightPadding:0,this._trackpad.yAxis.value=this.isVertical||this.isBidirectional?this._height-i.y-i.height-this.list.bottomPadding:0,this.stopRenderHiddenItems())}scrollToPosition({x:t,y:i}){t===void 0&&i===void 0||(this.renderAllItems(),t!==void 0&&(this.scrollX=-t),i!==void 0&&(this.scrollY=-i),this.stopRenderHiddenItems())}get height(){return this._height}set height(t){this._height=t,this._dimensionChanged=!0,this.resize(),this.scrollTop()}get width(){return this._width}set width(t){this._width=t,this._dimensionChanged=!0,this.resize(),this.scrollTop()}setSize(t,i){typeof t=="object"?(i=t.height??t.width,t=t.width):i=i??t,this._width=t,this._height=i,this._dimensionChanged=!0,this.resize(),this.scrollTop()}getSize(t){return t=t||{width:0,height:0},t.width=this._width,t.height=this._height,t}get scrollX(){return this._trackpad.xAxis.value}set scrollX(t){this._trackpad.xAxis.value=t}get scrollY(){return this._trackpad.yAxis.value}set scrollY(t){this._trackpad.yAxis.value=t}update(){this.list&&(this._trackpad.update(),(this.isHorizontal||this.isBidirectional)&&this.list.x!==this._trackpad.x&&(this.list.x=this._trackpad.x),(this.isVertical||this.isBidirectional)&&this.list.y!==this._trackpad.y&&(this.list.y=this._trackpad.y),!this.options.disableProximityCheck&&(this._trackpad.x!==this.lastScrollX||this._trackpad.y!==this.lastScrollY)&&(this.proximityCheckFrameCounter++,this.proximityCheckFrameCounter>=(this.options.proximityDebounce??10)&&(this.items.forEach((t,i)=>{const e=this.isItemVisible(t,this.proximityRange),h=this.proximityStatusCache[i];e!==h&&(this.proximityStatusCache[i]=e,this.onProximityChange.emit({item:t,index:i,inRange:e}))}),this.lastScrollX=this._trackpad.x,this.lastScrollY=this._trackpad.y,this.proximityCheckFrameCounter=0)))}destroy(t){this.ticker.remove(this.update,this),document.removeEventListener("wheel",this.onMouseScrollBinding,!0),this.background.destroy(),this.list.destroy(),super.destroy(t)}restoreItemsInteractivity(){this.interactiveStorage.forEach(t=>{t.item.eventMode=t.eventMode}),this.interactiveStorage.length=0}revertClick(t){t.eventMode!=="auto"&&(y.any?t.emit("pointerupoutside",null):t.emit("mouseupoutside",null),this.interactiveStorage.push({item:t,eventMode:t.eventMode}),t.eventMode="auto"),t instanceof g&&t.children&&t.children.forEach(i=>this.revertClick(i))}get scrollHeight(){return this.list.height}get scrollWidth(){return this.list.width}get isVertical(){return(this.options.type??"vertical")==="vertical"}get isHorizontal(){return this.options.type==="horizontal"}get isBidirectional(){return this.options.type==="bidirectional"}}var Ri=Object.defineProperty,Hi=(s,t,i)=>t in s?Ri(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,A=(s,t,i)=>Hi(s,typeof t!="symbol"?t+"":t,i);const Ni=5;class he extends g{constructor(t){super(),A(this,"view",new g),A(this,"openButton"),A(this,"closeButton"),A(this,"openView"),A(this,"scrollBox"),A(this,"value"),A(this,"onSelect"),this.addChild(this.view),this.onSelect=new f.Signal,t&&this.init(t)}init({closedBG:t,textStyle:i,TextClass:e,items:h,openBG:n,selected:r,selectedTextOffset:o,scrollBox:a,visibleItems:l}){e=e??O,this.openView&&this.openView!==n&&this.view.removeChild(this.openView),this.openButton?(this.openButton.defaultView=w(t),this.openButton.textView=new e({text:h?.items?h.items[0]:"",style:i}),this.openButton.textOffset=o):(this.openButton=new rt({defaultView:t,text:new e({text:h?.items?h.items[0]:"",style:i}),textOffset:o}),this.openButton.onPress.connect(()=>this.toggle()),this.addChild(this.openButton)),this.openView!==n&&(this.openView=w(n),this.view.visible=!1,this.view.addChild(this.openView)),this.closeButton?(this.closeButton.defaultView=new S().rect(0,0,this.openButton.width,this.openButton.height).fill({color:0,alpha:1e-5}),this.closeButton.textView=new e({text:h?.items?h.items[0]:"",style:i}),this.openButton.textOffset=o):(this.closeButton=new rt({defaultView:new S().rect(0,0,this.openButton.width,this.openButton.height).fill({color:0,alpha:1e-5}),text:new e({text:h?.items?h.items[0]:"",style:i}),textOffset:o}),this.closeButton.onPress.connect(()=>this.toggle()),this.view.addChild(this.closeButton)),this.scrollBox?this.scrollBox.removeItems():(this.scrollBox=new Li,this.view.addChild(this.scrollBox)),this.scrollBox.init({type:"vertical",elementsMargin:0,width:this.openButton.width,height:this.openButton.height*(l??Ni),radius:0,padding:0,...a}),this.scrollBox.y=this.openButton.height,a?.offset&&(this.scrollBox.x=a.offset.x??0,this.scrollBox.y+=a.offset.y??0),this.addItems(h,r)}addItems(t,i=0){this.convertItemsToButtons(t).forEach((e,h)=>{const n=e.text;h===i&&(this.openButton.text=n,this.closeButton.text=n),e.onPress.connect(()=>{this.value=h,this.onSelect.emit(h,n),this.openButton.text=n,this.closeButton.text=n,this.close()}),this.scrollBox.addItem(e)})}removeItem(t){this.scrollBox.removeItem(t)}toggle(){this.view.visible=!this.view.visible,this.openButton.visible=!this.openButton.visible}open(){this.view.visible=!0,this.openButton.visible=!1}close(){this.view.visible=!1,this.openButton.visible=!0}convertItemsToButtons({items:t,backgroundColor:i,hoverColor:e,width:h,height:n,textStyle:r,TextClass:o,radius:a}){o=o??O;const l=[];return t.forEach(p=>{const M=new S().roundRect(0,0,h,n,a).fill(i),U=e??i,E=new S().roundRect(0,0,h,n,a).fill(U),st=new o({text:p,style:r}),ht=new rt({defaultView:M,hoverView:E,text:st});l.push(ht)}),l}}var Wi=Object.defineProperty,$i=(s,t,i)=>t in s?Wi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[t]=i,ot=(s,t,i)=>$i(s,typeof t!="symbol"?t+"":t,i);class ne extends Pt{constructor(t){super({slider1:t.slider,value1:t.value,...t}),ot(this,"sliderOptions"),ot(this,"onUpdate",new f.Signal),ot(this,"onChange",new f.Signal),this.sliderOptions=t,this.step=t.step||1,this.value=t.value??this.min,this.updateSlider()}get value(){return this._value1}set value(t){t!==this._value1&&(t<this.min&&(t=this.min),t>this.max&&(t=this.max),this._value1=t,this.updateSlider(),this.onUpdate?.emit(this.value))}set max(t){super.max=t,this.updateSlider()}get max(){return super.max}set min(t){super.min=t,this.updateSlider()}get min(){return super.min}set step(t){super.step=t,this.updateSlider()}get step(){return super.step}set slider(t){this.slider1=t,this.updateSlider()}update(t){if(super.update(t),!this.dragging)return;const i=t.currentTarget,{x:e}=i.parent.worldTransform.applyInverse(t.global),h=e/(this.bg?.width||1),n=this.min+h*(this.max-this.min);this.value=Math.round(n/this.step)*this.step}change(){this.onChange?.emit(this.value)}updateSlider(){if(this.progress=((this.value??this.min)-this.min)/(this.max-this.min)*100,this._slider1.x=this.bg?.width/100*this.progress-this._slider1.width/2,this._slider1.y=this.bg?.height/2,this.sliderOptions?.showValue){this.value1Text.text=`${Math.round(this.value)}`;const t=this._slider1.x+this._slider1.width/2,i=this._slider1.y;this.value1Text.x=t+(this.sliderOptions.valueTextOffset?.x??0),this.value1Text.y=i+(this.sliderOptions.valueTextOffset?.y??0)}}set width(t){super.width=t,this.updateSlider()}get width(){return super.width}set height(t){super.height=t,this.updateSlider()}get height(){return super.height}setSize(t,i){super.setSize(t,i),this.updateSlider()}}export{Jt as Button,Kt as ButtonContainer,Qi as CheckBox,Zi as CircularProgressBar,te as DoubleSlider,rt as FancyButton,ie as Input,It as List,ee as MaskedFrame,oi as ProgressBar,se as RadioGroup,Li as ScrollBox,he as Select,ne as Slider,Zt as Switcher};
|