minerender 2.1.0-alpha.117 → 2.1.0-alpha.119

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.
@@ -2925,11 +2925,12 @@ interface FlyControlsEventMap {
2925
2925
  type FlyAction = "forward" | "back" | "left" | "right" | "up" | "down" | "sprint";
2926
2926
  /**
2927
2927
  * Creative-flight camera controls: WASD moves horizontally along the view direction, space and shift
2928
- * move up and down, control sprints, and the mouse turns the camera (pointer lock, or drag).
2928
+ * move up and down, R sprints, and the mouse turns the camera (pointer lock, or drag).
2929
2929
  *
2930
2930
  * Call {@link FlyControls.update} with the elapsed seconds once per frame; the `change` event marks the
2931
2931
  * renderer dirty while keys are held. Speeds use scene units (16 per block). The element becomes focusable
2932
- * and keys apply while it has focus or the pointer is locked. The wheel changes the speed, as in vanilla
2932
+ * and keys apply while it has focus or the pointer is locked. A key pressed with Control, Alt, or Command
2933
+ * stays a browser shortcut unless that modifier is bound. The wheel changes the speed, as in vanilla
2933
2934
  * spectator mode. Touch input uses the left half of the element as a joystick and the right half for looking.
2934
2935
  */
2935
2936
  declare class FlyControls extends Controls<FlyControlsEventMap, Camera> {
@@ -2961,9 +2962,13 @@ declare class FlyControls extends Controls<FlyControlsEventMap, Camera> {
2961
2962
  private _position0;
2962
2963
  private _quaternion0;
2963
2964
  private _dragPointer?;
2965
+ private _dragX;
2966
+ private _dragY;
2964
2967
  private _dragMoved;
2968
+ private _dragTravel;
2965
2969
  private _joystick?;
2966
2970
  private _locked;
2971
+ private _madeFocusable;
2967
2972
  private _lastTime?;
2968
2973
  private readonly _onKeyDown;
2969
2974
  private readonly _onKeyUp;
@@ -3001,12 +3006,15 @@ declare class FlyControls extends Controls<FlyControlsEventMap, Camera> {
3001
3006
  /**
3002
3007
  * Advances movement by `delta` seconds (measured since the previous call when omitted)
3003
3008
  * and dispatches `change` when the camera moved.
3009
+ * A step longer than 0.1 s is applied as 0.1 s.
3004
3010
  */
3005
3011
  update(delta?: number): void;
3006
3012
  private move;
3007
3013
  private notifyChange;
3008
3014
  private releaseKeys;
3009
3015
  private handleKey;
3016
+ /** A key pressed with Control, Alt, or Command stays a browser shortcut unless that modifier is bound to an action. */
3017
+ private isBrowserShortcut;
3010
3018
  private actionFor;
3011
3019
  private handlePointerDown;
3012
3020
  private onJoystickSide;
@@ -3062,6 +3070,7 @@ declare class Renderer implements Disposable {
3062
3070
  /**
3063
3071
  * Replaces renderer-owned controls with the selected mode, keeping the camera where it is.
3064
3072
  * Switching to orbit controls targets the point the camera looks at, at the previous orbit distance.
3073
+ * The previous controls object is disposed, so its listeners and settings do not carry over.
3065
3074
  * Returns the new controls, or undefined when controls were disabled at construction or after disposal.
3066
3075
  */
3067
3076
  setControlsMode(mode: ControlsMode): Maybe<RendererControls>;
@@ -3378,6 +3387,13 @@ type SceneObjectDefinition = SceneSkinDefinition | SceneBlockDefinition | SceneM
3378
3387
  /** Validates and copies a scene document without requesting assets or changing the active asset version. */
3379
3388
  declare function parseSceneDocument(value: unknown): SceneDocument;
3380
3389
 
3390
+ /** Maximum UTF-8 JSON size and compressed size for a scene link. */
3391
+ declare const SCENE_DOCUMENT_MAX_BYTES: number;
3392
+ /** Validates a scene and encodes its UTF-8 JSON as `v1.<unpadded base64url>`, using zlib-wrapped deflate. */
3393
+ declare function encodeSceneDocument(value: unknown): Promise<string>;
3394
+ /** Decodes and validates a scene link, limiting compressed input and decompressed JSON to SCENE_DOCUMENT_MAX_BYTES. */
3395
+ declare function decodeSceneDocument(value: string): Promise<SceneDocument>;
3396
+
3381
3397
  interface LoadedSceneObject {
3382
3398
  readonly root: Group;
3383
3399
  readonly object: SceneObject;
@@ -4146,4 +4162,4 @@ declare class NodeRenderer extends Renderer {
4146
4162
  dispose(): void;
4147
4163
  }
4148
4164
 
4149
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
4165
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
@@ -2925,11 +2925,12 @@ interface FlyControlsEventMap {
2925
2925
  type FlyAction = "forward" | "back" | "left" | "right" | "up" | "down" | "sprint";
2926
2926
  /**
2927
2927
  * Creative-flight camera controls: WASD moves horizontally along the view direction, space and shift
2928
- * move up and down, control sprints, and the mouse turns the camera (pointer lock, or drag).
2928
+ * move up and down, R sprints, and the mouse turns the camera (pointer lock, or drag).
2929
2929
  *
2930
2930
  * Call {@link FlyControls.update} with the elapsed seconds once per frame; the `change` event marks the
2931
2931
  * renderer dirty while keys are held. Speeds use scene units (16 per block). The element becomes focusable
2932
- * and keys apply while it has focus or the pointer is locked. The wheel changes the speed, as in vanilla
2932
+ * and keys apply while it has focus or the pointer is locked. A key pressed with Control, Alt, or Command
2933
+ * stays a browser shortcut unless that modifier is bound. The wheel changes the speed, as in vanilla
2933
2934
  * spectator mode. Touch input uses the left half of the element as a joystick and the right half for looking.
2934
2935
  */
2935
2936
  declare class FlyControls extends Controls<FlyControlsEventMap, Camera> {
@@ -2961,9 +2962,13 @@ declare class FlyControls extends Controls<FlyControlsEventMap, Camera> {
2961
2962
  private _position0;
2962
2963
  private _quaternion0;
2963
2964
  private _dragPointer?;
2965
+ private _dragX;
2966
+ private _dragY;
2964
2967
  private _dragMoved;
2968
+ private _dragTravel;
2965
2969
  private _joystick?;
2966
2970
  private _locked;
2971
+ private _madeFocusable;
2967
2972
  private _lastTime?;
2968
2973
  private readonly _onKeyDown;
2969
2974
  private readonly _onKeyUp;
@@ -3001,12 +3006,15 @@ declare class FlyControls extends Controls<FlyControlsEventMap, Camera> {
3001
3006
  /**
3002
3007
  * Advances movement by `delta` seconds (measured since the previous call when omitted)
3003
3008
  * and dispatches `change` when the camera moved.
3009
+ * A step longer than 0.1 s is applied as 0.1 s.
3004
3010
  */
3005
3011
  update(delta?: number): void;
3006
3012
  private move;
3007
3013
  private notifyChange;
3008
3014
  private releaseKeys;
3009
3015
  private handleKey;
3016
+ /** A key pressed with Control, Alt, or Command stays a browser shortcut unless that modifier is bound to an action. */
3017
+ private isBrowserShortcut;
3010
3018
  private actionFor;
3011
3019
  private handlePointerDown;
3012
3020
  private onJoystickSide;
@@ -3062,6 +3070,7 @@ declare class Renderer implements Disposable {
3062
3070
  /**
3063
3071
  * Replaces renderer-owned controls with the selected mode, keeping the camera where it is.
3064
3072
  * Switching to orbit controls targets the point the camera looks at, at the previous orbit distance.
3073
+ * The previous controls object is disposed, so its listeners and settings do not carry over.
3065
3074
  * Returns the new controls, or undefined when controls were disabled at construction or after disposal.
3066
3075
  */
3067
3076
  setControlsMode(mode: ControlsMode): Maybe<RendererControls>;
@@ -3378,6 +3387,13 @@ type SceneObjectDefinition = SceneSkinDefinition | SceneBlockDefinition | SceneM
3378
3387
  /** Validates and copies a scene document without requesting assets or changing the active asset version. */
3379
3388
  declare function parseSceneDocument(value: unknown): SceneDocument;
3380
3389
 
3390
+ /** Maximum UTF-8 JSON size and compressed size for a scene link. */
3391
+ declare const SCENE_DOCUMENT_MAX_BYTES: number;
3392
+ /** Validates a scene and encodes its UTF-8 JSON as `v1.<unpadded base64url>`, using zlib-wrapped deflate. */
3393
+ declare function encodeSceneDocument(value: unknown): Promise<string>;
3394
+ /** Decodes and validates a scene link, limiting compressed input and decompressed JSON to SCENE_DOCUMENT_MAX_BYTES. */
3395
+ declare function decodeSceneDocument(value: string): Promise<SceneDocument>;
3396
+
3381
3397
  interface LoadedSceneObject {
3382
3398
  readonly root: Group;
3383
3399
  readonly object: SceneObject;
@@ -4146,4 +4162,4 @@ declare class NodeRenderer extends Renderer {
4146
4162
  dispose(): void;
4147
4163
  }
4148
4164
 
4149
- export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
4165
+ export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, type AnvilChunk, type AnvilEntityChunk, type AnvilExternalChunkReader, type AnvilParseOptions, AnvilParser, type AnvilRegion, type AnvilRegionReader, AnvilWorldSource, type AnvilWorldSourceOptions, ArchiveAssetSource, type ArchiveAssetSourceOptions, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, type BannerPattern, type BannerPatternDraw, BannerPatterns, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Biome, type BiomeColorKind, Biomes, type BitmapFont, type BitmapGlyph, type Block, BlockEntities, type BlockEntityEntry, type BlockEntityIndex, type BlockEntityPart, type BlockEntityRotation, type BlockFluidState, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, BlockStateResolver, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, CUBE_FACES, CUBE_FACE_OFFSETS, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, ChunkData, Colormaps, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsMode, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, DYE_COLORS, type DebugOptions, type DecoratedPotSide, DecoratedPots, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type DyeColor, ENTITY_ANIMATION_CHANNELS, type ElementFace, type ElementRotation, Entities, type EntityAnimation, type EntityAnimationBone, type EntityAnimationChannel, type EntityAnimationFile, type EntityAnimationKeyframe, type EntityAnimationOptions, EntityAnimationPlayer, type EntityAnimationPose, type EntityLayer, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, type EntityModelPass, EntityObject, type EntityObjectOptions, type EntityRenderMode, type EntityTransformOp, Env, type EnvProvider, type ExtractableImageData, type FluidKind, FluidModelObject, type FluidQuads, type FluidRules, type FluidSample, type FluidSampler, type FlyAction, FlyControls, type FlyControlsEventMap, Fonts, type FrameCallback, type FromTo, GUI_CONTAINER_LAYOUTS, Geometries, type GuiBookButtonState, type GuiBookOptions, type GuiBossBarColor, type GuiBossBarOptions, type GuiContainerType, GuiHelper, type GuiItemLayer, type GuiLayer, GuiLight, GuiObject, type GuiObjectOptions, type GuiRecipe, type GuiRecipeIngredient, type GuiRecipeOptions, type GuiSpriteScaling, type GuiText, type GuiTextLayer, type GuiTextLayout, type GuiTextOptions, type GuiTextRun, type GuiTextStyle, type GuiTextureLayer, type GuiTooltipOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, ItemDefaults, ItemGlint, type ItemModel, type ItemModelContext, type ItemModelTextures, type ItemTintColor, type ItemTintSource, ItemTints, type ListAsset, LitematicaParser, type LitematicaRegion, type LitematicaStructure, type LoadedSceneDocument, type LoadedSceneObject, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderData, type MineRenderDataManifest, type MineRenderDatasets, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MineRenderWorldOptions, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, ModelCulling, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockEntity, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, NodeCache, NodeEnv, type NodeImageOptions, NodeRenderer, type NodeRendererOptions, OrbitControls, type PackFormat, PackFormats, PackMetadata, PersistentCache, PlayerHeadTextures, type PositionedGuiGlyph, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererControls, type RendererFrame, type RendererOptions, type RendererSurface, type RequestConfig, RequestError, type RequestResponse, Requests, type ResolvedBlockEntity, type ResolvedMineRenderData, type ResponseParser, SCENE_DOCUMENT_MAX_BYTES, SKIN_PARTS, type SceneBlockDefinition, type SceneDocument, SceneDocumentLoader, type SceneEntityDefinition, SceneExporter, type SceneGLTFExportOptions, type SceneGuiDefinition, type SceneGuiLayer, SceneInspector, type SceneItemContext, type SceneModelDefinition, SceneObject, type SceneObjectDefinition, type SceneObjectDefinitionBase, type SceneObjectOptions, type SceneSkinDefinition, type SceneSkinPosePart, SceneStats, SceneStatsDisplay, SchematicParser, type SchematicParserOptions, type SectionAtlasSize, type SectionFluidInput, type SectionFluidKind, type SectionFluids, type SectionGeometryInput, type SectionGeometryPage, SectionMesh, type SectionMeshEntry, type SectionMeshTemplate, SectionModels, type SectionTemplateData, SectionWorker, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type SpecialItemPart, type SpecialItemRenderer, SpecialItems, SpongeSchematicParser, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, type VideoExportOptions, VideoExporter, type WorldChunkSource, WorldStreamer, type WorldStreamerOptions, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, buildFluidQuads, buildSectionGeometry, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createFluidGeometry, createGuiTextGeometry, createGuiTextureGeometry, createImage, decodeSceneDocument, encodeSceneDocument, entityAnimationTime, estimateBytesUsed, fluidKindOf, getBlockFluidState, getFluidKind, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isFlyControls, isGuiObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isResourceLocation, isSceneObject, isTransformable, isTripleArray, isVector3, layoutGuiText, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, parseSceneDocument, prefix, registerNodeEnv, resolveBlockFluidState, resolveLegacyBlock, resolveLegacyBlockState, sampleEntityAnimation, sampleEntityKeyframes, sampleFluid, sectionGeometryTransferables, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode, trimCanvas, yieldToEventLoop };
@@ -7672,6 +7672,7 @@ __export(index_node_exports, {
7672
7672
  Renderer: () => Renderer,
7673
7673
  RequestError: () => RequestError,
7674
7674
  Requests: () => Requests,
7675
+ SCENE_DOCUMENT_MAX_BYTES: () => SCENE_DOCUMENT_MAX_BYTES,
7675
7676
  SKIN_PARTS: () => SKIN_PARTS,
7676
7677
  SceneDocumentLoader: () => SceneDocumentLoader,
7677
7678
  SceneExporter: () => SceneExporter,
@@ -7723,6 +7724,8 @@ __export(index_node_exports, {
7723
7724
  createGuiTextGeometry: () => createGuiTextGeometry,
7724
7725
  createGuiTextureGeometry: () => createGuiTextureGeometry,
7725
7726
  createImage: () => createImage,
7727
+ decodeSceneDocument: () => decodeSceneDocument,
7728
+ encodeSceneDocument: () => encodeSceneDocument,
7726
7729
  entityAnimationTime: () => entityAnimationTime,
7727
7730
  estimateBytesUsed: () => estimateBytesUsed,
7728
7731
  fluidKindOf: () => fluidKindOf,
@@ -13441,6 +13444,8 @@ var import_three35 = require("three");
13441
13444
  var VANILLA_FLY_SPEED = 10.89;
13442
13445
  var PITCH_LIMIT = Math.PI / 2;
13443
13446
  var MOVE_EPSILON = 1e-6;
13447
+ var MAX_STEP_SECONDS = 0.1;
13448
+ var CLICK_SLOP_PIXELS = 4;
13444
13449
  var _euler = new import_three35.Euler(0, 0, 0, "YXZ");
13445
13450
  var _forward = new import_three35.Vector3();
13446
13451
  var _right = new import_three35.Vector3();
@@ -13475,7 +13480,8 @@ var FlyControls = class extends import_three35.Controls {
13475
13480
  right: ["KeyD", "ArrowRight"],
13476
13481
  up: ["Space"],
13477
13482
  down: ["ShiftLeft", "ShiftRight"],
13478
- sprint: ["ControlLeft", "ControlRight"]
13483
+ // Not Control: Ctrl+W closes the browser tab on Windows and Linux, and a page cannot block it.
13484
+ sprint: ["KeyR"]
13479
13485
  };
13480
13486
  this._pressed = /* @__PURE__ */ new Set();
13481
13487
  this._velocity = new import_three35.Vector3();
@@ -13483,8 +13489,12 @@ var FlyControls = class extends import_three35.Controls {
13483
13489
  this._lastQuaternion = new import_three35.Quaternion();
13484
13490
  this._position0 = new import_three35.Vector3();
13485
13491
  this._quaternion0 = new import_three35.Quaternion();
13492
+ this._dragX = 0;
13493
+ this._dragY = 0;
13486
13494
  this._dragMoved = false;
13495
+ this._dragTravel = 0;
13487
13496
  this._locked = false;
13497
+ this._madeFocusable = false;
13488
13498
  this._onKeyDown = (event) => this.handleKey(event, true);
13489
13499
  this._onKeyUp = (event) => this.handleKey(event, false);
13490
13500
  this._onPointerDown = (event) => this.handlePointerDown(event);
@@ -13514,7 +13524,10 @@ var FlyControls = class extends import_three35.Controls {
13514
13524
  element.addEventListener("wheel", this._onWheel, { passive: false });
13515
13525
  element.addEventListener("blur", this._onBlur);
13516
13526
  element.style.touchAction = "none";
13517
- if (element.tabIndex < 0) element.tabIndex = 0;
13527
+ if (element.tabIndex < 0) {
13528
+ element.tabIndex = 0;
13529
+ this._madeFocusable = true;
13530
+ }
13518
13531
  }
13519
13532
  disconnect() {
13520
13533
  const element = this.domElement;
@@ -13532,6 +13545,10 @@ var FlyControls = class extends import_three35.Controls {
13532
13545
  element.removeEventListener("wheel", this._onWheel);
13533
13546
  element.removeEventListener("blur", this._onBlur);
13534
13547
  element.style.touchAction = "auto";
13548
+ if (this._madeFocusable) {
13549
+ element.removeAttribute("tabindex");
13550
+ this._madeFocusable = false;
13551
+ }
13535
13552
  this.unlock();
13536
13553
  this._locked = false;
13537
13554
  this.releaseKeys();
@@ -13602,6 +13619,7 @@ var FlyControls = class extends import_three35.Controls {
13602
13619
  /**
13603
13620
  * Advances movement by `delta` seconds (measured since the previous call when omitted)
13604
13621
  * and dispatches `change` when the camera moved.
13622
+ * A step longer than 0.1 s is applied as 0.1 s.
13605
13623
  */
13606
13624
  update(delta) {
13607
13625
  if (delta === void 0) {
@@ -13613,7 +13631,7 @@ var FlyControls = class extends import_three35.Controls {
13613
13631
  this._velocity.set(0, 0, 0);
13614
13632
  return;
13615
13633
  }
13616
- if (delta > 0) this.move(delta);
13634
+ if (delta > 0) this.move(Math.min(delta, MAX_STEP_SECONDS));
13617
13635
  this.notifyChange();
13618
13636
  }
13619
13637
  move(delta) {
@@ -13660,15 +13678,21 @@ var FlyControls = class extends import_three35.Controls {
13660
13678
  this._pressed.clear();
13661
13679
  }
13662
13680
  handleKey(event, down) {
13681
+ if (event.code === "MetaLeft" || event.code === "MetaRight") this.releaseKeys();
13663
13682
  const action = this.actionFor(event.code);
13664
13683
  if (!action) return;
13665
13684
  const ownsInput = this.enabled && (this._locked || event.target === this.domElement);
13666
- if (down && !ownsInput) return;
13685
+ if (down && (!ownsInput || this.isBrowserShortcut(event))) return;
13667
13686
  const pressed = this._pressed.has(action);
13668
13687
  if (down) this._pressed.add(action);
13669
13688
  else this._pressed.delete(action);
13670
13689
  if (ownsInput || this.enabled && pressed) event.preventDefault();
13671
13690
  }
13691
+ /** A key pressed with Control, Alt, or Command stays a browser shortcut unless that modifier is bound to an action. */
13692
+ isBrowserShortcut(event) {
13693
+ const bound = (modifier) => Object.values(this.keys).some((codes) => codes.some((code) => code.startsWith(modifier)));
13694
+ return event.ctrlKey && !bound("Control") || event.altKey && !bound("Alt") || event.metaKey && !bound("Meta");
13695
+ }
13672
13696
  actionFor(code) {
13673
13697
  for (const action in this.keys) {
13674
13698
  if (this.keys[action].includes(code)) return action;
@@ -13688,7 +13712,10 @@ var FlyControls = class extends import_three35.Controls {
13688
13712
  if (this._dragPointer !== void 0) return;
13689
13713
  if (event.pointerType === "mouse" && event.button !== 0 && event.button !== 2) return;
13690
13714
  this._dragPointer = event.pointerId;
13715
+ this._dragX = event.clientX;
13716
+ this._dragY = event.clientY;
13691
13717
  this._dragMoved = false;
13718
+ this._dragTravel = 0;
13692
13719
  element.setPointerCapture?.(event.pointerId);
13693
13720
  }
13694
13721
  onJoystickSide(event) {
@@ -13704,8 +13731,20 @@ var FlyControls = class extends import_three35.Controls {
13704
13731
  return;
13705
13732
  }
13706
13733
  if (!this._locked && event.pointerId !== this._dragPointer) return;
13707
- const dx = event.movementX ?? 0;
13708
- const dy = event.movementY ?? 0;
13734
+ let dx, dy;
13735
+ if (this._locked) {
13736
+ dx = event.movementX ?? 0;
13737
+ dy = event.movementY ?? 0;
13738
+ } else {
13739
+ dx = event.clientX - this._dragX;
13740
+ dy = event.clientY - this._dragY;
13741
+ this._dragX = event.clientX;
13742
+ this._dragY = event.clientY;
13743
+ if (!this._dragMoved) {
13744
+ this._dragTravel += Math.hypot(dx, dy);
13745
+ if (this._dragTravel <= CLICK_SLOP_PIXELS) return;
13746
+ }
13747
+ }
13709
13748
  if (!dx && !dy) return;
13710
13749
  this._dragMoved = true;
13711
13750
  this.turn(dx, dy);
@@ -15657,6 +15696,7 @@ var Renderer = class _Renderer {
15657
15696
  /**
15658
15697
  * Replaces renderer-owned controls with the selected mode, keeping the camera where it is.
15659
15698
  * Switching to orbit controls targets the point the camera looks at, at the previous orbit distance.
15699
+ * The previous controls object is disposed, so its listeners and settings do not carry over.
15660
15700
  * Returns the new controls, or undefined when controls were disabled at construction or after disposal.
15661
15701
  */
15662
15702
  setControlsMode(mode) {
@@ -16282,6 +16322,79 @@ function parseSceneDocument(value) {
16282
16322
  return JSON.parse(JSON.stringify(input));
16283
16323
  }
16284
16324
 
16325
+ // src/scene/SceneDocumentCodec.ts
16326
+ var SCENE_DOCUMENT_MAX_BYTES = 1024 * 1024;
16327
+ async function readBounded(stream, label) {
16328
+ const reader = stream.getReader();
16329
+ const chunks = [];
16330
+ let size = 0;
16331
+ try {
16332
+ while (true) {
16333
+ const { value, done } = await reader.read();
16334
+ if (done) break;
16335
+ size += value.byteLength;
16336
+ if (size > SCENE_DOCUMENT_MAX_BYTES) throw new RangeError(`${label} exceeds ${SCENE_DOCUMENT_MAX_BYTES} bytes`);
16337
+ chunks.push(value);
16338
+ }
16339
+ } catch (error) {
16340
+ await reader.cancel().catch(() => {
16341
+ });
16342
+ throw error;
16343
+ } finally {
16344
+ reader.releaseLock();
16345
+ }
16346
+ const bytes = new Uint8Array(size);
16347
+ let offset = 0;
16348
+ for (const chunk of chunks) {
16349
+ bytes.set(chunk, offset);
16350
+ offset += chunk.byteLength;
16351
+ }
16352
+ return bytes;
16353
+ }
16354
+ function encodeBase64(bytes) {
16355
+ let binary = "";
16356
+ for (let offset = 0; offset < bytes.length; offset += 32768) {
16357
+ binary += String.fromCharCode(...bytes.subarray(offset, offset + 32768));
16358
+ }
16359
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
16360
+ }
16361
+ async function encodeSceneDocument(value) {
16362
+ const scene = parseSceneDocument(value);
16363
+ const bytes = new TextEncoder().encode(JSON.stringify(scene));
16364
+ if (bytes.byteLength > SCENE_DOCUMENT_MAX_BYTES) {
16365
+ throw new RangeError(`Scene document exceeds ${SCENE_DOCUMENT_MAX_BYTES} bytes`);
16366
+ }
16367
+ const compressed = await readBounded(new Blob([bytes]).stream().pipeThrough(new CompressionStream("deflate")), "Encoded scene");
16368
+ return `v1.${encodeBase64(compressed)}`;
16369
+ }
16370
+ async function decodeSceneDocument(value) {
16371
+ if (!value.startsWith("v1.")) throw new Error("Unsupported scene encoding version; expected v1");
16372
+ const encoded = value.slice(3);
16373
+ if (encoded.length > Math.ceil(SCENE_DOCUMENT_MAX_BYTES * 4 / 3)) {
16374
+ throw new RangeError(`Encoded scene exceeds ${SCENE_DOCUMENT_MAX_BYTES} bytes`);
16375
+ }
16376
+ if (!/^[A-Za-z0-9_-]+$/.test(encoded) || encoded.length % 4 === 1) {
16377
+ throw new Error("Invalid scene base64url encoding");
16378
+ }
16379
+ const binary = atob(encoded.replace(/-/g, "+").replace(/_/g, "/"));
16380
+ const compressed = Uint8Array.from(binary, (character) => character.charCodeAt(0));
16381
+ if (encodeBase64(compressed) !== encoded) throw new Error("Invalid scene base64url encoding");
16382
+ let bytes;
16383
+ try {
16384
+ bytes = await readBounded(new Blob([compressed]).stream().pipeThrough(new DecompressionStream("deflate")), "Scene document");
16385
+ } catch (error) {
16386
+ if (error instanceof RangeError) throw error;
16387
+ throw new Error("Invalid compressed scene document");
16388
+ }
16389
+ let json;
16390
+ try {
16391
+ json = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
16392
+ } catch {
16393
+ throw new Error("Invalid UTF-8 scene document");
16394
+ }
16395
+ return parseSceneDocument(json);
16396
+ }
16397
+
16285
16398
  // src/scene/SceneDocumentLoader.ts
16286
16399
  var import_three40 = require("three");
16287
16400
  init_AssetKey();
@@ -19370,6 +19483,7 @@ var NodeRenderer = class _NodeRenderer extends Renderer {
19370
19483
  Renderer,
19371
19484
  RequestError,
19372
19485
  Requests,
19486
+ SCENE_DOCUMENT_MAX_BYTES,
19373
19487
  SKIN_PARTS,
19374
19488
  SceneDocumentLoader,
19375
19489
  SceneExporter,
@@ -19421,6 +19535,8 @@ var NodeRenderer = class _NodeRenderer extends Renderer {
19421
19535
  createGuiTextGeometry,
19422
19536
  createGuiTextureGeometry,
19423
19537
  createImage,
19538
+ decodeSceneDocument,
19539
+ encodeSceneDocument,
19424
19540
  entityAnimationTime,
19425
19541
  estimateBytesUsed,
19426
19542
  fluidKindOf,