@quick-threejs/reactive 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.module-Da11YIUG.cjs +29 -0
- package/dist/app.module-Dg_0i25D.js +2640 -0
- package/dist/common/constants/event.constants.d.ts +2 -0
- package/dist/common/constants/index.d.ts +1 -0
- package/dist/common/enums/camera.enum.d.ts +4 -0
- package/dist/common/enums/index.d.ts +2 -0
- package/dist/common/enums/lifecycle.enum.d.ts +10 -0
- package/dist/common/index.d.ts +5 -0
- package/dist/common/interfaces/canvas.interface.d.ts +6 -0
- package/dist/common/interfaces/core.interface.d.ts +11 -0
- package/dist/common/interfaces/event.interface.d.ts +10 -0
- package/dist/common/interfaces/index.d.ts +5 -0
- package/dist/common/interfaces/module.interface.d.ts +19 -0
- package/dist/common/interfaces/resource.interface.d.ts +14 -0
- package/dist/common/models/app-proxy-event-handler.model.d.ts +32 -0
- package/dist/common/models/index.d.ts +7 -0
- package/dist/common/models/launch-app-props.model.d.ts +8 -0
- package/dist/common/models/proxy-event-handler.model.d.ts +19 -0
- package/dist/common/models/proxy-event-observables.model.d.ts +20 -0
- package/dist/common/models/proxy-event-subjects.models.d.ts +19 -0
- package/dist/common/models/register-props.model.d.ts +75 -0
- package/dist/common/models/register-proxy-event-handler.model.d.ts +17 -0
- package/dist/common/types/index.d.ts +1 -0
- package/dist/common/types/object.type.d.ts +13 -0
- package/dist/core/app/app.component.d.ts +7 -0
- package/dist/core/app/app.controller.d.ts +10 -0
- package/dist/core/app/app.module-worker.d.ts +5 -0
- package/dist/core/app/app.module.d.ts +35 -0
- package/dist/core/app/camera/camera.component.d.ts +18 -0
- package/dist/core/app/camera/camera.controller.d.ts +12 -0
- package/dist/core/app/camera/camera.module.d.ts +20 -0
- package/dist/core/app/debug/debug.component.d.ts +28 -0
- package/dist/core/app/debug/debug.controller.d.ts +9 -0
- package/dist/core/app/debug/debug.module.d.ts +17 -0
- package/dist/core/app/renderer/renderer.component.d.ts +19 -0
- package/dist/core/app/renderer/renderer.controller.d.ts +15 -0
- package/dist/core/app/renderer/renderer.module.d.ts +17 -0
- package/dist/core/app/sizes/sizes.component.d.ts +10 -0
- package/dist/core/app/sizes/sizes.controller.d.ts +12 -0
- package/dist/core/app/sizes/sizes.module.d.ts +19 -0
- package/dist/core/app/timer/timer.component.d.ts +8 -0
- package/dist/core/app/timer/timer.controller.d.ts +14 -0
- package/dist/core/app/timer/timer.module.d.ts +19 -0
- package/dist/core/app/world/world.component.d.ts +5 -0
- package/dist/core/app/world/world.controller.d.ts +5 -0
- package/dist/core/app/world/world.module.d.ts +14 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/loader/loader.component.d.ts +25 -0
- package/dist/core/loader/loader.controller.d.ts +9 -0
- package/dist/core/loader/loader.module-worker.d.ts +3 -0
- package/dist/core/loader/loader.module.d.ts +34 -0
- package/dist/core/register/register.component.d.ts +13 -0
- package/dist/core/register/register.controller.d.ts +77 -0
- package/dist/core/register/register.module.d.ts +46 -0
- package/dist/core/register/register.util.d.ts +10 -0
- package/dist/main.cjs +12 -0
- package/dist/main.d.ts +2 -28
- package/dist/main.js +2575 -4018
- package/dist/main.worker.d.ts +1 -14
- package/dist/worker.cjs +3 -0
- package/dist/worker.js +318 -0
- package/package.json +18 -11
- package/dist/main.d.mts +0 -28
- package/dist/main.js.map +0 -1
- package/dist/main.mjs +0 -4245
- package/dist/main.mjs.map +0 -1
- package/dist/main.worker-CJCIoHnh.d.mts +0 -728
- package/dist/main.worker-CJCIoHnh.d.ts +0 -728
- package/dist/main.worker.d.mts +0 -14
- package/dist/main.worker.js +0 -3564
- package/dist/main.worker.js.map +0 -1
- package/dist/main.worker.mjs +0 -3550
- package/dist/main.worker.mjs.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TimerComponent } from './timer.component';
|
|
2
|
+
import { RendererComponent } from '../renderer/renderer.component';
|
|
3
|
+
import { TimerController } from './timer.controller';
|
|
4
|
+
import { Module } from '../../../common/interfaces/module.interface';
|
|
5
|
+
export declare class TimerModule implements Module {
|
|
6
|
+
private readonly component;
|
|
7
|
+
private readonly controller;
|
|
8
|
+
private readonly rendererComponent;
|
|
9
|
+
constructor(component: TimerComponent, controller: TimerController, rendererComponent: RendererComponent);
|
|
10
|
+
init(startTimer?: boolean): void;
|
|
11
|
+
clock(): import('three').Clock;
|
|
12
|
+
frame(): number;
|
|
13
|
+
delta(value?: number): number;
|
|
14
|
+
deltaRatio(value?: number): number;
|
|
15
|
+
enabled(value?: boolean): boolean;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
enabled$(): import('rxjs').Observable<boolean>;
|
|
18
|
+
step$(): import('rxjs').Observable<import('../../../common').StepPayload>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Scene } from 'three';
|
|
2
|
+
import { WorldComponent } from './world.component';
|
|
3
|
+
import { WorldController } from './world.controller';
|
|
4
|
+
import { Module } from '../../../common/interfaces/module.interface';
|
|
5
|
+
export declare class WorldModule implements Module {
|
|
6
|
+
private readonly component;
|
|
7
|
+
private readonly controller;
|
|
8
|
+
constructor(component: WorldComponent, controller: WorldController);
|
|
9
|
+
init(): void;
|
|
10
|
+
dispose(): void;
|
|
11
|
+
scene(value?: Scene): Scene;
|
|
12
|
+
enabled(value?: boolean): boolean;
|
|
13
|
+
get enable$(): import('rxjs').Observable<boolean>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AudioLoader, CubeTextureLoader, ImageBitmapLoader, LoadingManager } from 'three';
|
|
2
|
+
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
|
+
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
4
|
+
import { LoadedResourceItem, Resource } from '../../common/interfaces/resource.interface';
|
|
5
|
+
export declare class LoaderComponent {
|
|
6
|
+
readonly loadingManager: LoadingManager;
|
|
7
|
+
readonly loaders: {
|
|
8
|
+
dracoLoader?: DRACOLoader;
|
|
9
|
+
gltfLoader?: GLTFLoader;
|
|
10
|
+
textureLoader?: ImageBitmapLoader;
|
|
11
|
+
cubeTextureLoader?: CubeTextureLoader;
|
|
12
|
+
audioLoader?: AudioLoader;
|
|
13
|
+
videoLoader?: LoaderComponent["videoLoader"];
|
|
14
|
+
};
|
|
15
|
+
resources: Resource[];
|
|
16
|
+
items: {
|
|
17
|
+
[name: Resource["name"]]: LoadedResourceItem;
|
|
18
|
+
};
|
|
19
|
+
toLoad: number;
|
|
20
|
+
loaded: number;
|
|
21
|
+
private get videoLoader();
|
|
22
|
+
private _setLoaders;
|
|
23
|
+
setResources(resources: Resource[]): void;
|
|
24
|
+
init(resources?: Resource[]): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
import { ProgressedResource } from '../../common/interfaces/resource.interface';
|
|
3
|
+
export declare class LoaderController {
|
|
4
|
+
readonly lifecycle$$: Subject<unknown>;
|
|
5
|
+
readonly progress$$: Subject<ProgressedResource>;
|
|
6
|
+
readonly progress$: import('rxjs').Observable<ProgressedResource>;
|
|
7
|
+
readonly lifecycle$: import('rxjs').Observable<unknown>;
|
|
8
|
+
readonly progressCompleted$: import('rxjs').Observable<ProgressedResource>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
2
|
+
import { WorkerThreadModule } from '@quick-threejs/utils';
|
|
3
|
+
import { LoaderController } from './loader.controller';
|
|
4
|
+
import { LoaderComponent } from './loader.component';
|
|
5
|
+
import { Module } from '../../common/interfaces/module.interface';
|
|
6
|
+
import { LoadedResourceItem, Resource } from '../../common/interfaces/resource.interface';
|
|
7
|
+
export declare class LoaderModule implements Module, WorkerThreadModule {
|
|
8
|
+
private readonly controller;
|
|
9
|
+
private readonly component;
|
|
10
|
+
constructor(controller: LoaderController, component: LoaderComponent);
|
|
11
|
+
private _handleLoadedResource;
|
|
12
|
+
setDracoLoader(dracoDecoderPath: string, linkWithGltfLoader?: boolean): void;
|
|
13
|
+
load(): void;
|
|
14
|
+
items(): {
|
|
15
|
+
[name: string]: LoadedResourceItem;
|
|
16
|
+
};
|
|
17
|
+
loaders(): {
|
|
18
|
+
dracoLoader?: DRACOLoader;
|
|
19
|
+
gltfLoader?: import('three/examples/jsm/loaders/GLTFLoader').GLTFLoader;
|
|
20
|
+
textureLoader?: import('three').ImageBitmapLoader;
|
|
21
|
+
cubeTextureLoader?: import('three').CubeTextureLoader;
|
|
22
|
+
audioLoader?: import('three').AudioLoader;
|
|
23
|
+
videoLoader?: LoaderComponent["videoLoader"];
|
|
24
|
+
};
|
|
25
|
+
resources(): Resource[];
|
|
26
|
+
loaded(): number;
|
|
27
|
+
toLoad(): number;
|
|
28
|
+
init(resources?: Resource[]): void;
|
|
29
|
+
dispose(): void;
|
|
30
|
+
lifecycle$(): import('rxjs').Observable<unknown>;
|
|
31
|
+
progress$(): import('rxjs').Observable<import('../../common/interfaces/resource.interface').ProgressedResource>;
|
|
32
|
+
progressCompleted$(): import('rxjs').Observable<import('../../common/interfaces/resource.interface').ProgressedResource>;
|
|
33
|
+
}
|
|
34
|
+
export declare const loaderModule: LoaderModule;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WorkerThreadResolution } from '@quick-threejs/utils';
|
|
2
|
+
import { default as GUI } from 'three/examples/jsm/libs/lil-gui.module.min.js';
|
|
3
|
+
import { default as Stats } from 'stats.js';
|
|
4
|
+
import { ExposedAppModule } from '../app/app.module-worker';
|
|
5
|
+
export declare class RegisterComponent {
|
|
6
|
+
readonly workerPool: import('@quick-threejs/utils').WorkerPool;
|
|
7
|
+
canvas: HTMLCanvasElement;
|
|
8
|
+
worker: WorkerThreadResolution<ExposedAppModule>["worker"];
|
|
9
|
+
thread: WorkerThreadResolution<ExposedAppModule>["thread"];
|
|
10
|
+
gui?: GUI;
|
|
11
|
+
stats?: Stats;
|
|
12
|
+
init(app: WorkerThreadResolution<ExposedAppModule>): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
import { RegisterComponent } from './register.component';
|
|
3
|
+
import { RegisterLifecycleState } from '../../common/enums/lifecycle.enum';
|
|
4
|
+
import { ProxyEventHandlersModel } from '../../common/models/proxy-event-handler.model';
|
|
5
|
+
export declare class RegisterController extends ProxyEventHandlersModel {
|
|
6
|
+
private readonly component;
|
|
7
|
+
private canvas;
|
|
8
|
+
readonly lifecycle$$: Subject<RegisterLifecycleState>;
|
|
9
|
+
readonly lifecycle$: import('rxjs').Observable<RegisterLifecycleState>;
|
|
10
|
+
constructor(component: RegisterComponent);
|
|
11
|
+
init(canvas: HTMLCanvasElement): void;
|
|
12
|
+
preventDefaultHandler(e: Event): {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
getScreenSizes(): {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
windowWidth: number;
|
|
19
|
+
windowHeight: number;
|
|
20
|
+
};
|
|
21
|
+
uiEventHandler(e: UIEvent): {
|
|
22
|
+
type: string;
|
|
23
|
+
top: number;
|
|
24
|
+
left: number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
windowWidth: number;
|
|
28
|
+
windowHeight: number;
|
|
29
|
+
};
|
|
30
|
+
mouseEventHandler(e: PointerEvent): {
|
|
31
|
+
button: number;
|
|
32
|
+
clientX: number;
|
|
33
|
+
clientY: number;
|
|
34
|
+
ctrlKey: boolean;
|
|
35
|
+
metaKey: boolean;
|
|
36
|
+
pageX: number;
|
|
37
|
+
pageY: number;
|
|
38
|
+
shiftKey: boolean;
|
|
39
|
+
pointerType: string;
|
|
40
|
+
type?: string;
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
windowWidth: number;
|
|
44
|
+
windowHeight: number;
|
|
45
|
+
};
|
|
46
|
+
touchEventHandler(e: TouchEvent): {
|
|
47
|
+
type: string;
|
|
48
|
+
touches: {
|
|
49
|
+
pageX: number;
|
|
50
|
+
pageY: number;
|
|
51
|
+
}[];
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
windowWidth: number;
|
|
55
|
+
windowHeight: number;
|
|
56
|
+
};
|
|
57
|
+
wheelEventHandler(e: WheelEvent): {
|
|
58
|
+
deltaX: number;
|
|
59
|
+
deltaY: number;
|
|
60
|
+
type?: string;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
windowWidth: number;
|
|
64
|
+
windowHeight: number;
|
|
65
|
+
};
|
|
66
|
+
keyEventHandler(e: KeyboardEvent): {
|
|
67
|
+
ctrlKey: boolean;
|
|
68
|
+
metaKey: boolean;
|
|
69
|
+
shiftKey: boolean;
|
|
70
|
+
keyCode: number;
|
|
71
|
+
type?: string;
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
windowWidth: number;
|
|
75
|
+
windowHeight: number;
|
|
76
|
+
} | undefined;
|
|
77
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RegisterComponent } from './register.component';
|
|
2
|
+
import { RegisterController } from './register.controller';
|
|
3
|
+
import { LoaderModule } from '../loader/loader.module';
|
|
4
|
+
import { ExposedLoaderModule } from '../loader/loader.module-worker';
|
|
5
|
+
import { ExposedAppModule } from '../app/app.module-worker';
|
|
6
|
+
import { RegisterPropsModel } from '../../common/models/register-props.model';
|
|
7
|
+
import { RegisterLifecycleState } from '../../common/enums/lifecycle.enum';
|
|
8
|
+
import { RegisterProxyEventHandlersModel } from '../../common/models/register-proxy-event-handler.model';
|
|
9
|
+
import { ProgressedResource, Resource } from '../../common/interfaces/resource.interface';
|
|
10
|
+
import { Module } from '../../common/interfaces/module.interface';
|
|
11
|
+
export declare class RegisterModule extends RegisterProxyEventHandlersModel implements Module {
|
|
12
|
+
private readonly component;
|
|
13
|
+
private readonly controller;
|
|
14
|
+
private readonly registerProps;
|
|
15
|
+
constructor(component: RegisterComponent, controller: RegisterController, registerProps: RegisterPropsModel);
|
|
16
|
+
private _initCanvas;
|
|
17
|
+
private _initComponent;
|
|
18
|
+
private _initController;
|
|
19
|
+
private _initWorkerThread;
|
|
20
|
+
private _initProxyEvents;
|
|
21
|
+
init(): Promise<void>;
|
|
22
|
+
loadResources(props: {
|
|
23
|
+
resources: Resource[];
|
|
24
|
+
disposeOnComplete?: boolean;
|
|
25
|
+
onMainThread?: boolean;
|
|
26
|
+
immediateLoad?: boolean;
|
|
27
|
+
onProgress?: (resource: ProgressedResource) => unknown;
|
|
28
|
+
onProgressComplete?: (resource: ProgressedResource) => unknown;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
load: LoaderModule["load"];
|
|
31
|
+
items: ReturnType<LoaderModule["items"]>;
|
|
32
|
+
loaders: ReturnType<LoaderModule["loaders"]>;
|
|
33
|
+
toLoad: ReturnType<LoaderModule["toLoad"]>;
|
|
34
|
+
loaded: ReturnType<LoaderModule["loaded"]>;
|
|
35
|
+
resources: ReturnType<LoaderModule["resources"]>;
|
|
36
|
+
worker?: import('threads').Worker;
|
|
37
|
+
thread?: import('threads').ModuleThread<ExposedLoaderModule> | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
workerPool(): import('@quick-threejs/utils').WorkerPool;
|
|
40
|
+
canvas(): HTMLCanvasElement;
|
|
41
|
+
worker(): import('threads/dist/types/master').Worker | undefined;
|
|
42
|
+
thread(): import('threads').ModuleThread<ExposedAppModule> | undefined;
|
|
43
|
+
gui(): import('three/examples/jsm/libs/lil-gui.module.min').default | undefined;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
lifecycle$(): import('rxjs').Observable<RegisterLifecycleState>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RegisterPropsModel } from '../../common/models/register-props.model';
|
|
2
|
+
import { RegisterModule } from './register.module';
|
|
3
|
+
/**
|
|
4
|
+
* @description Register the main logic of the app.
|
|
5
|
+
*
|
|
6
|
+
* @remark __🏁 Should be called on your main thread. Separated from the worker thread implementation__
|
|
7
|
+
*
|
|
8
|
+
* @param props Quick-three register properties.
|
|
9
|
+
*/
|
|
10
|
+
export declare const register: (props: RegisterPropsModel) => RegisterModule;
|
package/dist/main.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";var fe=Object.defineProperty;var me=(l,e,t)=>e in l?fe(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var A=(l,e,t)=>me(l,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./app.module-Da11YIUG.cjs"),u=require("three"),k=require("rxjs"),L=require("@quick-threejs/utils"),se=require("stats.js");function ee(l,e){return function(t){w.injectable()(t),w.instance.register(t,t,{lifecycle:l})}}const j=new WeakMap;class ge extends u.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,s,n){const r=new u.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{this.parse(i,t,n)},s,n)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,u.SRGBColorSpace,s).catch(s)}decodeDracoFile(e,t,s,n,r=u.LinearSRGBColorSpace,i=()=>{}){const a={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:r};return this.decodeGeometry(e,a).then(t).catch(i)}decodeGeometry(e,t){const s=JSON.stringify(t);if(j.has(e)){const o=j.get(e);if(o.key===s)return o.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(o=>(n=o,new Promise((c,h)=>{n._callbacks[r]={resolve:c,reject:h},n.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(o=>this._createGeometry(o.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),j.set(e,{key:s,promise:a}),a}_createGeometry(e){const t=new u.BufferGeometry;e.index&&t.setIndex(new u.BufferAttribute(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const n=e.attributes[s],r=n.name,i=n.array,a=n.itemSize,o=new u.BufferAttribute(i,a);r==="color"&&(this._assignVertexColorSpace(o,n.vertexColorSpace),o.normalized=!(i instanceof Float32Array)),t.setAttribute(r,o)}return t}_assignVertexColorSpace(e,t){if(t!==u.SRGBColorSpace)return;const s=new u.Color;for(let n=0,r=e.count;n<r;n++)s.fromBufferAttribute(e,n),u.ColorManagement.toWorkingColorSpace(s,u.SRGBColorSpace),e.setXYZ(n,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new u.FileLoader(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise((n,r)=>{s.load(e,n,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(s=>{const n=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const r=Ae.toString(),i=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
2
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(r){const i=r.data;switch(i.type){case"decode":n._callbacks[i.id].resolve(i);break;case"error":n._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,r){return n._taskLoad>r._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function Ae(){let l,e;onmessage=function(i){const a=i.data;switch(a.type){case"init":l=a.decoderConfig,e=new Promise(function(h){l.onModuleLoaded=function(d){h({draco:d})},DracoDecoderModule(l)});break;case"decode":const o=a.buffer,c=a.taskConfig;e.then(h=>{const d=h.draco,p=new d.Decoder;try{const f=t(d,p,new Int8Array(o),c),m=f.attributes.map(y=>y.array.buffer);f.index&&m.push(f.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:f},m)}catch(f){console.error(f),self.postMessage({type:"error",id:a.id,error:f.message})}finally{d.destroy(p)}});break}};function t(i,a,o,c){const h=c.attributeIDs,d=c.attributeTypes;let p,f;const m=a.GetEncodedGeometryType(o);if(m===i.TRIANGULAR_MESH)p=new i.Mesh,f=a.DecodeArrayToMesh(o,o.byteLength,p);else if(m===i.POINT_CLOUD)p=new i.PointCloud,f=a.DecodeArrayToPointCloud(o,o.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const y={index:null,attributes:[]};for(const g in h){const b=self[d[g]];let T,E;if(c.useUniqueIDs)E=h[g],T=a.GetAttributeByUniqueId(p,E);else{if(E=a.GetAttributeId(p,i[h[g]]),E===-1)continue;T=a.GetAttribute(p,E)}const x=n(i,a,p,g,b,T);g==="color"&&(x.vertexColorSpace=c.vertexColorSpace),y.attributes.push(x)}return m===i.TRIANGULAR_MESH&&(y.index=s(i,a,p)),i.destroy(p),y}function s(i,a,o){const h=o.num_faces()*3,d=h*4,p=i._malloc(d);a.GetTrianglesUInt32Array(o,d,p);const f=new Uint32Array(i.HEAPF32.buffer,p,h).slice();return i._free(p),{array:f,itemSize:1}}function n(i,a,o,c,h,d){const p=d.num_components(),m=o.num_points()*p,y=m*h.BYTES_PER_ELEMENT,g=r(i,h),b=i._malloc(y);a.GetAttributeDataArrayForAllPoints(o,d,g,y,b);const T=new h(i.HEAPF32.buffer,b,m).slice();return i._free(b),{name:c,array:T,itemSize:p}}function r(i,a){switch(a){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}var be=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,we=(l,e,t,s)=>{for(var n=s>1?void 0:s?ye(e,t):e,r=l.length-1,i;r>=0;r--)(i=l[r])&&(n=(s?i(e,t,n):i(n))||n);return s&&n&&be(e,t,n),n};let W=class{constructor(){A(this,"lifecycle$$",new k.Subject);A(this,"progress$$",new k.Subject);A(this,"progress$",this.progress$$.pipe());A(this,"lifecycle$",this.lifecycle$$.pipe());A(this,"progressCompleted$",this.progress$.pipe(k.filter(l=>l.toLoad===l.loaded)))}};W=we([ee(w.Lifecycle.ResolutionScoped)],W);function ie(l,e){if(e===u.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),l;if(e===u.TriangleFanDrawMode||e===u.TriangleStripDrawMode){let t=l.getIndex();if(t===null){const i=[],a=l.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)i.push(o);l.setIndex(i),t=l.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),l}const s=t.count-2,n=[];if(e===u.TriangleFanDrawMode)for(let i=1;i<=s;i++)n.push(t.getX(0)),n.push(t.getX(i)),n.push(t.getX(i+1));else for(let i=0;i<s;i++)i%2===0?(n.push(t.getX(i)),n.push(t.getX(i+1)),n.push(t.getX(i+2))):(n.push(t.getX(i+2)),n.push(t.getX(i+1)),n.push(t.getX(i)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=l.clone();return r.setIndex(n),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),l}class _e extends u.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Le(t)}),this.register(function(t){return new Se(t)}),this.register(function(t){return new Ne(t)}),this.register(function(t){return new $e(t)}),this.register(function(t){return new Fe(t)}),this.register(function(t){return new Me(t)}),this.register(function(t){return new Ce(t)}),this.register(function(t){return new Ie(t)}),this.register(function(t){return new Pe(t)}),this.register(function(t){return new ve(t)}),this.register(function(t){return new De(t)}),this.register(function(t){return new Re(t)}),this.register(function(t){return new ke(t)}),this.register(function(t){return new Oe(t)}),this.register(function(t){return new xe(t)}),this.register(function(t){return new He(t)}),this.register(function(t){return new Be(t)})}load(e,t,s,n){const r=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const c=u.LoaderUtils.extractUrlBase(e);i=u.LoaderUtils.resolveURL(c,this.path)}else i=u.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){n?n(c):console.error(c),r.manager.itemError(e),r.manager.itemEnd(e)},o=new u.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{r.parse(c,i,function(h){t(h),r.manager.itemEnd(e)},a)}catch(h){a(h)}},s,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let r;const i={},a={},o=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===de){try{i[_.KHR_BINARY_GLTF]=new Ge(e)}catch(d){n&&n(d);return}r=JSON.parse(i[_.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new et(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const d=this.pluginCallbacks[h](c);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[d.name]=d,i[d.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const d=r.extensionsUsed[h],p=r.extensionsRequired||[];switch(d){case _.KHR_MATERIALS_UNLIT:i[d]=new Ee;break;case _.KHR_DRACO_MESH_COMPRESSION:i[d]=new je(r,this.dracoLoader);break;case _.KHR_TEXTURE_TRANSFORM:i[d]=new Ue;break;case _.KHR_MESH_QUANTIZATION:i[d]=new Ve;break;default:p.indexOf(d)>=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}c.setExtensions(i),c.setPlugins(a),c.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,r){s.parse(e,t,n,r)})}}function Te(){let l={};return{get:function(e){return l[e]},add:function(e,t){l[e]=t},remove:function(e){delete l[e]},removeAll:function(){l={}}}}const _={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class xe{constructor(e){this.parser=e,this.name=_.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const r=t[s];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const r=t.json,o=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let c;const h=new u.Color(16777215);o.color!==void 0&&h.setRGB(o.color[0],o.color[1],o.color[2],u.LinearSRGBColorSpace);const d=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new u.DirectionalLight(h),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new u.PointLight(h),c.distance=d;break;case"spot":c=new u.SpotLight(h),c.distance=d,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),c.decay=2,C(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=t.createUniqueName(o.name||"light_"+e),n=Promise.resolve(c),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,r=s.json.nodes[e],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(t.cache,a,o)})}}class Ee{constructor(){this.name=_.KHR_MATERIALS_UNLIT}getMaterialType(){return u.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new u.Color(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const i=r.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],u.LinearSRGBColorSpace),e.opacity=i[3]}r.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",r.baseColorTexture,u.SRGBColorSpace))}return Promise.all(n)}}class ve{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class Le{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],i=n.extensions[this.name];if(i.clearcoatFactor!==void 0&&(t.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&r.push(s.assignTexture(t,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&r.push(s.assignTexture(t,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(r.push(s.assignTexture(t,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const a=i.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new u.Vector2(a,a)}return Promise.all(r)}}class Se{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class Re{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],i=n.extensions[this.name];return i.iridescenceFactor!==void 0&&(t.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&r.push(s.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(t.iridescenceIOR=i.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&r.push(s.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(r)}}class Me{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new u.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const i=n.extensions[this.name];if(i.sheenColorFactor!==void 0){const a=i.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace)}return i.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&r.push(s.assignTexture(t,"sheenColorMap",i.sheenColorTexture,u.SRGBColorSpace)),i.sheenRoughnessTexture!==void 0&&r.push(s.assignTexture(t,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(r)}}class Ce{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],i=n.extensions[this.name];return i.transmissionFactor!==void 0&&(t.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&r.push(s.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(r)}}class Ie{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],i=n.extensions[this.name];t.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&r.push(s.assignTexture(t,"thicknessMap",i.thicknessTexture)),t.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return t.attenuationColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),Promise.all(r)}}class Pe{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class De{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],i=n.extensions[this.name];t.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&r.push(s.assignTexture(t,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return t.specularColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),i.specularColorTexture!==void 0&&r.push(s.assignTexture(t,"specularColorMap",i.specularColorTexture,u.SRGBColorSpace)),Promise.all(r)}}class Oe{constructor(e){this.parser=e,this.name=_.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],i=n.extensions[this.name];return t.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&r.push(s.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(r)}}class ke{constructor(e){this.parser=e,this.name=_.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],i=n.extensions[this.name];return i.anisotropyStrength!==void 0&&(t.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(t.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&r.push(s.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(r)}}class Ne{constructor(e){this.parser=e,this.name=_.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],i=t.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,i)}}class $e{constructor(e){this.parser=e,this.name=_.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,r=n.textures[e];if(!r.extensions||!r.extensions[t])return null;const i=r.extensions[t],a=n.images[i.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return s.loadTextureImage(e,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Fe{constructor(e){this.parser=e,this.name=_.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,r=n.textures[e];if(!r.extensions||!r.extensions[t])return null;const i=r.extensions[t],a=n.images[i.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return s.loadTextureImage(e,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class He{constructor(e){this.name=_.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,h=n.count,d=n.byteStride,p=new Uint8Array(a,o,c);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(h,d,p,n.mode,n.filter).then(function(f){return f.buffer}):i.ready.then(function(){const f=new ArrayBuffer(h*d);return i.decodeGltfBuffer(new Uint8Array(f),h,d,p,n.mode,n.filter),f})})}else return null}}class Be{constructor(e){this.name=_.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const c of n.primitives)if(c.mode!==v.TRIANGLES&&c.mode!==v.TRIANGLE_STRIP&&c.mode!==v.TRIANGLE_FAN&&c.mode!==void 0)return null;const i=s.extensions[this.name].attributes,a=[],o={};for(const c in i)a.push(this.parser.getDependency("accessor",i[c]).then(h=>(o[c]=h,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const h=c.pop(),d=h.isGroup?h.children:[h],p=c[0].count,f=[];for(const m of d){const y=new u.Matrix4,g=new u.Vector3,b=new u.Quaternion,T=new u.Vector3(1,1,1),E=new u.InstancedMesh(m.geometry,m.material,p);for(let x=0;x<p;x++)o.TRANSLATION&&g.fromBufferAttribute(o.TRANSLATION,x),o.ROTATION&&b.fromBufferAttribute(o.ROTATION,x),o.SCALE&&T.fromBufferAttribute(o.SCALE,x),E.setMatrixAt(x,y.compose(g,b,T));for(const x in o)if(x==="_COLOR_0"){const R=o[x];E.instanceColor=new u.InstancedBufferAttribute(R.array,R.itemSize,R.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&m.geometry.setAttribute(x,o[x]);u.Object3D.prototype.copy.call(E,m),this.parser.assignFinalMaterial(E),f.push(E)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}}const de="glTF",F=12,re={JSON:1313821514,BIN:5130562};class Ge{constructor(e){this.name=_.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,F),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==de)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-F,r=new DataView(e,F);let i=0;for(;i<n;){const a=r.getUint32(i,!0);i+=4;const o=r.getUint32(i,!0);if(i+=4,o===re.JSON){const c=new Uint8Array(e,F+i,a);this.content=s.decode(c)}else if(o===re.BIN){const c=F+i;this.body=e.slice(c,c+a)}i+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class je{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=_.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,r=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,a={},o={},c={};for(const h in i){const d=Y[h]||h.toLowerCase();a[d]=i[h]}for(const h in e.attributes){const d=Y[h]||h.toLowerCase();if(i[h]!==void 0){const p=s.accessors[e.attributes[h]],f=N[p.componentType];c[d]=f.name,o[d]=p.normalized===!0}}return t.getDependency("bufferView",r).then(function(h){return new Promise(function(d,p){n.decodeDracoFile(h,function(f){for(const m in f.attributes){const y=f.attributes[m],g=o[m];g!==void 0&&(y.normalized=g)}d(f)},a,c,u.LinearSRGBColorSpace,p)})})}}class Ue{constructor(){this.name=_.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Ve{constructor(){this.name=_.KHR_MESH_QUANTIZATION}}class ue extends u.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,r=e*n*3+n;for(let i=0;i!==n;i++)t[i]=s[r+i];return t}interpolate_(e,t,s,n){const r=this.resultBuffer,i=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,h=n-t,d=(s-t)/h,p=d*d,f=p*d,m=e*c,y=m-c,g=-2*f+3*p,b=f-p,T=1-g,E=b-p+d;for(let x=0;x!==a;x++){const R=i[y+x+a],I=i[y+x+o]*h,S=i[m+x+a],$=i[m+x]*h;r[x]=T*R+E*I+g*S+b*$}return r}}const Ke=new u.Quaternion;class ze extends ue{interpolate_(e,t,s,n){const r=super.interpolate_(e,t,s,n);return Ke.fromArray(r).normalize().toArray(r),r}}const v={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},N={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},oe={9728:u.NearestFilter,9729:u.LinearFilter,9984:u.NearestMipmapNearestFilter,9985:u.LinearMipmapNearestFilter,9986:u.NearestMipmapLinearFilter,9987:u.LinearMipmapLinearFilter},ae={33071:u.ClampToEdgeWrapping,33648:u.MirroredRepeatWrapping,10497:u.RepeatWrapping},U={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Y={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},D={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Xe={CUBICSPLINE:void 0,LINEAR:u.InterpolateLinear,STEP:u.InterpolateDiscrete},V={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function We(l){return l.DefaultMaterial===void 0&&(l.DefaultMaterial=new u.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:u.FrontSide})),l.DefaultMaterial}function O(l,e,t){for(const s in t.extensions)l[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function C(l,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(l.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ye(l,e,t){let s=!1,n=!1,r=!1;for(let c=0,h=e.length;c<h;c++){const d=e[c];if(d.POSITION!==void 0&&(s=!0),d.NORMAL!==void 0&&(n=!0),d.COLOR_0!==void 0&&(r=!0),s&&n&&r)break}if(!s&&!n&&!r)return Promise.resolve(l);const i=[],a=[],o=[];for(let c=0,h=e.length;c<h;c++){const d=e[c];if(s){const p=d.POSITION!==void 0?t.getDependency("accessor",d.POSITION):l.attributes.position;i.push(p)}if(n){const p=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):l.attributes.normal;a.push(p)}if(r){const p=d.COLOR_0!==void 0?t.getDependency("accessor",d.COLOR_0):l.attributes.color;o.push(p)}}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o)]).then(function(c){const h=c[0],d=c[1],p=c[2];return s&&(l.morphAttributes.position=h),n&&(l.morphAttributes.normal=d),r&&(l.morphAttributes.color=p),l.morphTargetsRelative=!0,l})}function qe(l,e){if(l.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)l.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(l.morphTargetInfluences.length===t.length){l.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)l.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Je(l){let e;const t=l.extensions&&l.extensions[_.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+K(t.attributes):e=l.indices+":"+K(l.attributes)+":"+l.mode,l.targets!==void 0)for(let s=0,n=l.targets.length;s<n;s++)e+=":"+K(l.targets[s]);return e}function K(l){let e="";const t=Object.keys(l).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+l[t[s]]+";";return e}function q(l){switch(l){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Qe(l){return l.search(/\.jpe?g($|\?)/i)>0||l.search(/^data\:image\/jpeg/)===0?"image/jpeg":l.search(/\.webp($|\?)/i)>0||l.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ze=new u.Matrix4;class et{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Te,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,n=-1,r=!1,i=-1;if(typeof navigator<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=s&&o?parseInt(o[1],10):-1,r=a.indexOf("Firefox")>-1,i=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||r&&i<98?this.textureLoader=new u.TextureLoader(this.options.manager):this.textureLoader=new u.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new u.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(i){const a={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:s,userData:{}};return O(r,a,n),C(a,n),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){const i=t[n].joints;for(let a=0,o=i.length;a<o;a++)e[i[a]].isBone=!0}for(let n=0,r=e.length;n<r;n++){const i=e[n];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(s[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),r=(i,a)=>{const o=this.associations.get(i);o!=null&&this.associations.set(a,o);for(const[c,h]of i.children.entries())r(h,a.children[c])};return r(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const r=e(t[n]);r&&s.push(r)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":n=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(r,i){return s.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[_.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(r,i){s.load(u.LoaderUtils.resolveURL(t.uri,n.path),r,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,r=t.byteOffset||0;return s.slice(r,r+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const i=U[n.type],a=N[n.componentType],o=n.normalized===!0,c=new a(n.count*i);return Promise.resolve(new u.BufferAttribute(c,i,o))}const r=[];return n.bufferView!==void 0?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),n.sparse!==void 0&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(i){const a=i[0],o=U[n.type],c=N[n.componentType],h=c.BYTES_PER_ELEMENT,d=h*o,p=n.byteOffset||0,f=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,m=n.normalized===!0;let y,g;if(f&&f!==d){const b=Math.floor(p/f),T="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+b+":"+n.count;let E=t.cache.get(T);E||(y=new c(a,b*f,n.count*f/h),E=new u.InterleavedBuffer(y,f/h),t.cache.add(T,E)),g=new u.InterleavedBufferAttribute(E,o,p%f/h,m)}else a===null?y=new c(n.count*o):y=new c(a,p,n.count*o),g=new u.BufferAttribute(y,o,m);if(n.sparse!==void 0){const b=U.SCALAR,T=N[n.sparse.indices.componentType],E=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,R=new T(i[1],E,n.sparse.count*b),I=new c(i[2],x,n.sparse.count*o);a!==null&&(g=new u.BufferAttribute(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let S=0,$=R.length;S<$;S++){const P=R[S];if(g.setX(P,I[S*o]),o>=2&&g.setY(P,I[S*o+1]),o>=3&&g.setZ(P,I[S*o+2]),o>=4&&g.setW(P,I[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=m}return g})}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,i=t.images[r];let a=this.textureLoader;if(i.uri){const o=s.manager.getHandler(i.uri);o!==null&&(a=o)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,s){const n=this,r=this.json,i=r.textures[e],a=r.images[t],o=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(t,s).then(function(h){h.flipY=!1,h.name=i.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const p=(r.samplers||{})[i.sampler]||{};return h.magFilter=oe[p.magFilter]||u.LinearFilter,h.minFilter=oe[p.minFilter]||u.LinearMipmapLinearFilter,h.wrapS=ae[p.wrapS]||u.RepeatWrapping,h.wrapT=ae[p.wrapT]||u.RepeatWrapping,n.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(e,t){const s=this,n=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const i=n.images[e],a=self.URL||self.webkitURL;let o=i.uri||"",c=!1;if(i.bufferView!==void 0)o=s.getDependency("bufferView",i.bufferView).then(function(d){c=!0;const p=new Blob([d],{type:i.mimeType});return o=a.createObjectURL(p),o});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(o).then(function(d){return new Promise(function(p,f){let m=p;t.isImageBitmapLoader===!0&&(m=function(y){const g=new u.Texture(y);g.needsUpdate=!0,p(g)}),t.load(u.LoaderUtils.resolveURL(d,r.path),m,void 0,f)})}).then(function(d){return c===!0&&a.revokeObjectURL(o),C(d,i),d.userData.mimeType=i.mimeType||Qe(i.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),d});return this.sourceCache[e]=h,h}assignTexture(e,t,s,n){const r=this;return this.getDependency("texture",s.index).then(function(i){if(!i)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(i=i.clone(),i.channel=s.texCoord),r.extensions[_.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[_.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(i);i=r.extensions[_.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.associations.set(i,o)}}return n!==void 0&&(i.colorSpace=n),e[t]=i,i})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,i=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new u.PointsMaterial,u.Material.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(e.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new u.LineBasicMaterial,u.Material.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(n||r||i){let a="ClonedMaterial:"+s.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),r&&(o.vertexColors=!0),i&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}e.material=s}getMaterialType(){return u.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,r=s.materials[e];let i;const a={},o=r.extensions||{},c=[];if(o[_.KHR_MATERIALS_UNLIT]){const d=n[_.KHR_MATERIALS_UNLIT];i=d.getMaterialType(),c.push(d.extendParams(a,r,t))}else{const d=r.pbrMetallicRoughness||{};if(a.color=new u.Color(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){const p=d.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],u.LinearSRGBColorSpace),a.opacity=p[3]}d.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",d.baseColorTexture,u.SRGBColorSpace)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",d.metallicRoughnessTexture))),i=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=u.DoubleSide);const h=r.alphaMode||V.OPAQUE;if(h===V.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===V.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==u.MeshBasicMaterial&&(c.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new u.Vector2(1,1),r.normalTexture.scale!==void 0)){const d=r.normalTexture.scale;a.normalScale.set(d,d)}if(r.occlusionTexture!==void 0&&i!==u.MeshBasicMaterial&&(c.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==u.MeshBasicMaterial){const d=r.emissiveFactor;a.emissive=new u.Color().setRGB(d[0],d[1],d[2],u.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&i!==u.MeshBasicMaterial&&c.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,u.SRGBColorSpace)),Promise.all(c).then(function(){const d=new i(a);return r.name&&(d.name=r.name),C(d,r),t.associations.set(d,{materials:e}),r.extensions&&O(n,d,r),d})}createUniqueName(e){const t=u.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function r(a){return s[_.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(o){return le(o,a,t)})}const i=[];for(let a=0,o=e.length;a<o;a++){const c=e[a],h=Je(c),d=n[h];if(d)i.push(d.promise);else{let p;c.extensions&&c.extensions[_.KHR_DRACO_MESH_COMPRESSION]?p=r(c):p=le(new u.BufferGeometry,c,t),n[h]={primitive:c,promise:p},i.push(p)}}return Promise.all(i)}loadMesh(e){const t=this,s=this.json,n=this.extensions,r=s.meshes[e],i=r.primitives,a=[];for(let o=0,c=i.length;o<c;o++){const h=i[o].material===void 0?We(this.cache):this.getDependency("material",i[o].material);a.push(h)}return a.push(t.loadGeometries(i)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),h=o[o.length-1],d=[];for(let f=0,m=h.length;f<m;f++){const y=h[f],g=i[f];let b;const T=c[f];if(g.mode===v.TRIANGLES||g.mode===v.TRIANGLE_STRIP||g.mode===v.TRIANGLE_FAN||g.mode===void 0)b=r.isSkinnedMesh===!0?new u.SkinnedMesh(y,T):new u.Mesh(y,T),b.isSkinnedMesh===!0&&b.normalizeSkinWeights(),g.mode===v.TRIANGLE_STRIP?b.geometry=ie(b.geometry,u.TriangleStripDrawMode):g.mode===v.TRIANGLE_FAN&&(b.geometry=ie(b.geometry,u.TriangleFanDrawMode));else if(g.mode===v.LINES)b=new u.LineSegments(y,T);else if(g.mode===v.LINE_STRIP)b=new u.Line(y,T);else if(g.mode===v.LINE_LOOP)b=new u.LineLoop(y,T);else if(g.mode===v.POINTS)b=new u.Points(y,T);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(b.geometry.morphAttributes).length>0&&qe(b,r),b.name=t.createUniqueName(r.name||"mesh_"+e),C(b,r),g.extensions&&O(n,b,g),t.assignFinalMaterial(b),d.push(b)}for(let f=0,m=d.length;f<m;f++)t.associations.set(d[f],{meshes:e,primitives:f});if(d.length===1)return r.extensions&&O(n,d[0],r),d[0];const p=new u.Group;r.extensions&&O(n,p,r),t.associations.set(p,{meshes:e});for(let f=0,m=d.length;f<m;f++)p.add(d[f]);return p})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new u.PerspectiveCamera(u.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new u.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),C(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,r=t.joints.length;n<r;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const r=n.pop(),i=n,a=[],o=[];for(let c=0,h=i.length;c<h;c++){const d=i[c];if(d){a.push(d);const p=new u.Matrix4;r!==null&&p.fromArray(r.array,c*16),o.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new u.Skeleton(a,o)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],r=n.name?n.name:"animation_"+e,i=[],a=[],o=[],c=[],h=[];for(let d=0,p=n.channels.length;d<p;d++){const f=n.channels[d],m=n.samplers[f.sampler],y=f.target,g=y.node,b=n.parameters!==void 0?n.parameters[m.input]:m.input,T=n.parameters!==void 0?n.parameters[m.output]:m.output;y.node!==void 0&&(i.push(this.getDependency("node",g)),a.push(this.getDependency("accessor",b)),o.push(this.getDependency("accessor",T)),c.push(m),h.push(y))}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(h)]).then(function(d){const p=d[0],f=d[1],m=d[2],y=d[3],g=d[4],b=[];for(let T=0,E=p.length;T<E;T++){const x=p[T],R=f[T],I=m[T],S=y[T],$=g[T];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const P=s._createAnimationTracks(x,R,I,S,$);if(P)for(let G=0;G<P.length;G++)b.push(P[G])}return new u.AnimationClip(r,void 0,b)})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(r){const i=s._getNodeRef(s.meshCache,n.mesh,r);return n.weights!==void 0&&i.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),i})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],r=s._loadNodeShallow(e),i=[],a=n.children||[];for(let c=0,h=a.length;c<h;c++)i.push(s.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([r,Promise.all(i),o]).then(function(c){const h=c[0],d=c[1],p=c[2];p!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(p,Ze)});for(let f=0,m=d.length;f<m;f++)h.add(d[f]);return h})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],i=r.name?n.createUniqueName(r.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return o&&a.push(o),r.camera!==void 0&&a.push(n.getDependency("camera",r.camera).then(function(c){return n._getNodeRef(n.cameraCache,r.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let h;if(r.isBone===!0?h=new u.Bone:c.length>1?h=new u.Group:c.length===1?h=c[0]:h=new u.Object3D,h!==c[0])for(let d=0,p=c.length;d<p;d++)h.add(c[d]);if(r.name&&(h.userData.name=r.name,h.name=i),C(h,r),r.extensions&&O(s,h,r),r.matrix!==void 0){const d=new u.Matrix4;d.fromArray(r.matrix),h.applyMatrix4(d)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);return n.associations.has(h)||n.associations.set(h,{}),n.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,r=new u.Group;s.name&&(r.name=n.createUniqueName(s.name)),C(r,s),s.extensions&&O(t,r,s);const i=s.nodes||[],a=[];for(let o=0,c=i.length;o<c;o++)a.push(n.getDependency("node",i[o]));return Promise.all(a).then(function(o){for(let h=0,d=o.length;h<d;h++)r.add(o[h]);const c=h=>{const d=new Map;for(const[p,f]of n.associations)(p instanceof u.Material||p instanceof u.Texture)&&d.set(p,f);return h.traverse(p=>{const f=n.associations.get(p);f!=null&&d.set(p,f)}),d};return n.associations=c(r),r})}_createAnimationTracks(e,t,s,n,r){const i=[],a=e.name?e.name:e.uuid,o=[];D[r.path]===D.weights?e.traverse(function(p){p.morphTargetInfluences&&o.push(p.name?p.name:p.uuid)}):o.push(a);let c;switch(D[r.path]){case D.weights:c=u.NumberKeyframeTrack;break;case D.rotation:c=u.QuaternionKeyframeTrack;break;case D.position:case D.scale:c=u.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:c=u.NumberKeyframeTrack;break;case 2:case 3:default:c=u.VectorKeyframeTrack;break}break}const h=n.interpolation!==void 0?Xe[n.interpolation]:u.InterpolateLinear,d=this._getArrayFromAccessor(s);for(let p=0,f=o.length;p<f;p++){const m=new c(o[p]+"."+D[r.path],t.array,d,h);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),i.push(m)}return i}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=q(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof u.QuaternionKeyframeTrack?ze:ue;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function tt(l,e,t){const s=e.attributes,n=new u.Box3;if(s.POSITION!==void 0){const a=t.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new u.Vector3(o[0],o[1],o[2]),new u.Vector3(c[0],c[1],c[2])),a.normalized){const h=q(N[a.componentType]);n.min.multiplyScalar(h),n.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const a=new u.Vector3,o=new u.Vector3;for(let c=0,h=r.length;c<h;c++){const d=r[c];if(d.POSITION!==void 0){const p=t.json.accessors[d.POSITION],f=p.min,m=p.max;if(f!==void 0&&m!==void 0){if(o.setX(Math.max(Math.abs(f[0]),Math.abs(m[0]))),o.setY(Math.max(Math.abs(f[1]),Math.abs(m[1]))),o.setZ(Math.max(Math.abs(f[2]),Math.abs(m[2]))),p.normalized){const y=q(N[p.componentType]);o.multiplyScalar(y)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}l.boundingBox=n;const i=new u.Sphere;n.getCenter(i.center),i.radius=n.min.distanceTo(n.max)/2,l.boundingSphere=i}function le(l,e,t){const s=e.attributes,n=[];function r(i,a){return t.getDependency("accessor",i).then(function(o){l.setAttribute(a,o)})}for(const i in s){const a=Y[i]||i.toLowerCase();a in l.attributes||n.push(r(s[i],a))}if(e.indices!==void 0&&!l.index){const i=t.getDependency("accessor",e.indices).then(function(a){l.setIndex(a)});n.push(i)}return u.ColorManagement.workingColorSpace!==u.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${u.ColorManagement.workingColorSpace}" not supported.`),C(l,e),tt(l,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Ye(l,e.targets,t):l})}var nt=Object.defineProperty,st=Object.getOwnPropertyDescriptor,it=(l,e,t,s)=>{for(var n=s>1?void 0:s?st(e,t):e,r=l.length-1,i;r>=0;r--)(i=l[r])&&(n=(s?i(e,t,n):i(n))||n);return s&&n&&nt(e,t,n),n};let J=class{constructor(){A(this,"loadingManager",new u.LoadingManager);A(this,"loaders",{});A(this,"resources",[]);A(this,"items",{});A(this,"toLoad",0);A(this,"loaded",0)}get videoLoader(){return{load:(l,e)=>{let t=document.createElement("video");t.muted=!0,t.loop=!0,t.controls=!1,t.playsInline=!0,t.src=l,t.autoplay=!0;const s=()=>{if(!t)return;t.play();const n=new u.VideoTexture(t),r=n.dispose.bind(n);n.dispose=()=>{n.userData.element=void 0,t==null||t.remove(),t=void 0,r()},e(n),n.userData.element=t,t.removeEventListener("canplaythrough",s)};t.addEventListener("canplaythrough",s)}}}_setLoaders(){this.loaders.gltfLoader=new _e(this.loadingManager),this.loaders.textureLoader=new u.ImageBitmapLoader(this.loadingManager),this.loaders.cubeTextureLoader=new u.CubeTextureLoader(this.loadingManager),this.loaders.audioLoader=new u.AudioLoader(this.loadingManager),this.loaders.videoLoader=this.videoLoader}setResources(l){this.resources=l,this.toLoad=this.resources.length,this.loaded=0}init(l=[]){this.resources=l,this._setLoaders()}};J=it([ee(w.Lifecycle.ResolutionScoped)],J);var rt=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,at=(l,e,t,s)=>{for(var n=s>1?void 0:s?ot(e,t):e,r=l.length-1,i;r>=0;r--)(i=l[r])&&(n=(s?i(e,t,n):i(n))||n);return s&&n&&rt(e,t,n),n},ce=(l,e)=>(t,s)=>e(t,s,l);exports.LoaderModule=class{constructor(e,t){this.controller=e,this.component=t,typeof self<"u"&&(self.onmessage=s=>{var r;const n=(r=s==null?void 0:s.data)==null?void 0:r.resources;n&&this.init(n)})}_handleLoadedResource(e,t){this.component.items[e.name]=t,this.component.loaded++,this.controller.progress$$.next({file:t,resource:e,loaded:this.component.loaded,toLoad:this.component.toLoad})}setDracoLoader(e,t=!0){this.component.loaders.dracoLoader=new ge(this.component.loadingManager),this.component.loaders.dracoLoader.setDecoderPath(e),t&&this.component.loaders.gltfLoader&&this.component.loaders.gltfLoader.setDRACOLoader(this.component.loaders.dracoLoader)}load(){var t,s,n,r,i;const e=this.component.resources[0];if(e){this.controller.progress$$.next({resource:e,loaded:this.component.loaded,toLoad:this.component.toLoad});for(const a of this.component.resources)this.component.items[a.name]||(a.type==="gltfModel"&&typeof a.path=="string"&&((t=this.component.loaders.gltfLoader)==null||t.load(a.path,o=>this._handleLoadedResource(a,o))),a.type==="texture"&&typeof a.path=="string"&&((s=this.component.loaders.textureLoader)==null||s.load(a.path,o=>{this._handleLoadedResource(a,new u.CanvasTexture(o))})),a.type==="cubeTexture"&&typeof a.path=="object"&&((n=this.component.loaders.cubeTextureLoader)==null||n.load(a.path,o=>this._handleLoadedResource(a,o))),a.type==="video"&&typeof a.path=="string"&&((r=this.component.loaders.videoLoader)==null||r.load(a.path,o=>this._handleLoadedResource(a,o))),a.type==="audio"&&typeof a.path=="string"&&((i=this.component.loaders.audioLoader)==null||i.load(a.path,o=>{this._handleLoadedResource(a,o)})))}}items(){return this.component.items}loaders(){return this.component.loaders}resources(){return this.component.resources}loaded(){return this.component.loaded}toLoad(){return this.component.toLoad}init(e=[]){this.component.init(e)}dispose(){this.controller.lifecycle$$.complete(),this.controller.progress$$.complete()}lifecycle$(){return this.controller.lifecycle$}progress$(){return this.controller.progress$}progressCompleted$(){return this.controller.progressCompleted$}};exports.LoaderModule=at([ee(w.Lifecycle.ResolutionScoped),ce(0,w.inject(W)),ce(1,w.inject(J))],exports.LoaderModule);const lt=w.instance.resolve(exports.LoaderModule);/**
|
|
3
|
+
* lil-gui
|
|
4
|
+
* https://lil-gui.georgealways.com
|
|
5
|
+
* @version 0.17.0
|
|
6
|
+
* @author George Michael Brower
|
|
7
|
+
* @license MIT
|
|
8
|
+
*/class M{constructor(e,t,s,n,r="div"){this.parent=e,this.object=t,this.property=s,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(n),this.$name=document.createElement("div"),this.$name.classList.add("name"),M.nextNameID=M.nextNameID||0,this.$name.id="lil-gui-name-"+ ++M.nextNameID,this.$widget=document.createElement(r),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(s)}name(e){return this._name=e,this.$name.innerHTML=e,this}onChange(e){return this._onChange=e,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(e=!0){return this.disable(!e)}disable(e=!0){return e===this._disabled||(this._disabled=e,this.domElement.classList.toggle("disabled",e),this.$disable.toggleAttribute("disabled",e)),this}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(e){const t=this.parent.add(this.object,this.property,e);return t.name(this._name),this.destroy(),t}min(e){return this}max(e){return this}step(e){return this}decimals(e){return this}listen(e=!0){return this._listening=e,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const e=this.save();e!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=e}getValue(){return this.object[this.property]}setValue(e){return this.object[this.property]=e,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(e){return this.setValue(e),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class ct extends M{constructor(e,t,s){super(e,t,s,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function Q(l){let e,t;return(e=l.match(/(#|0x)?([a-f0-9]{6})/i))?t=e[2]:(e=l.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?t=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=l.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(t=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!t&&"#"+t}const ht={isPrimitive:!0,match:l=>typeof l=="string",fromHexString:Q,toHexString:Q},H={isPrimitive:!0,match:l=>typeof l=="number",fromHexString:l=>parseInt(l.substring(1),16),toHexString:l=>"#"+l.toString(16).padStart(6,0)},dt={isPrimitive:!1,match:Array.isArray,fromHexString(l,e,t=1){const s=H.fromHexString(l);e[0]=(s>>16&255)/255*t,e[1]=(s>>8&255)/255*t,e[2]=(255&s)/255*t},toHexString:([l,e,t],s=1)=>H.toHexString(l*(s=255/s)<<16^e*s<<8^t*s<<0)},ut={isPrimitive:!1,match:l=>Object(l)===l,fromHexString(l,e,t=1){const s=H.fromHexString(l);e.r=(s>>16&255)/255*t,e.g=(s>>8&255)/255*t,e.b=(255&s)/255*t},toHexString:({r:l,g:e,b:t},s=1)=>H.toHexString(l*(s=255/s)<<16^e*s<<8^t*s<<0)},pt=[ht,H,dt,ut];class ft extends M{constructor(e,t,s,n){var r;super(e,t,s,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(r=this.initialValue,pt.find(i=>i.match(r))),this._rgbScale=n,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const i=Q(this.$text.value);i&&this._setValueFromHexString(i)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class z extends M{constructor(e,t,s){super(e,t,s,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",n=>{n.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class mt extends M{constructor(e,t,s,n,r,i){super(e,t,s,"number"),this._initInput(),this.min(n),this.max(r);const a=i!==void 0;this.step(a?i:this._getImplicitStep(),a),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=100*t+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const e=h=>{const d=parseFloat(this.$input.value);isNaN(d)||(this._snapClampSetValue(d+h),this.$input.value=this.getValue())};let t,s,n,r,i,a=!1;const o=h=>{if(a){const d=h.clientX-t,p=h.clientY-s;Math.abs(p)>5?(h.preventDefault(),this.$input.blur(),a=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(d)>5&&c()}if(!a){const d=h.clientY-n;i-=d*this._step*this._arrowKeyMultiplier(h),r+i>this._max?i=this._max-r:r+i<this._min&&(i=this._min-r),this._snapClampSetValue(r+i)}n=h.clientY},c=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",c)};this.$input.addEventListener("input",()=>{let h=parseFloat(this.$input.value);isNaN(h)||(this._stepExplicit&&(h=this._snap(h)),this.setValue(this._clamp(h)))}),this.$input.addEventListener("keydown",h=>{h.code==="Enter"&&this.$input.blur(),h.code==="ArrowUp"&&(h.preventDefault(),e(this._step*this._arrowKeyMultiplier(h))),h.code==="ArrowDown"&&(h.preventDefault(),e(this._step*this._arrowKeyMultiplier(h)*-1))}),this.$input.addEventListener("wheel",h=>{this._inputFocused&&(h.preventDefault(),e(this._step*this._normalizeMouseWheel(h)))},{passive:!1}),this.$input.addEventListener("mousedown",h=>{t=h.clientX,s=n=h.clientY,a=!0,r=this.getValue(),i=0,window.addEventListener("mousemove",o),window.addEventListener("mouseup",c)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=p=>{const f=this.$slider.getBoundingClientRect();let m=(y=p,g=f.left,b=f.right,T=this._min,E=this._max,(y-g)/(b-g)*(E-T)+T);var y,g,b,T,E;this._snapClampSetValue(m)},t=p=>{e(p.clientX)},s=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",s)};let n,r,i=!1;const a=p=>{p.preventDefault(),this._setDraggingStyle(!0),e(p.touches[0].clientX),i=!1},o=p=>{if(i){const f=p.touches[0].clientX-n,m=p.touches[0].clientY-r;Math.abs(f)>Math.abs(m)?a(p):(window.removeEventListener("touchmove",o),window.removeEventListener("touchend",c))}else p.preventDefault(),e(p.touches[0].clientX)},c=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",o),window.removeEventListener("touchend",c)},h=this._callOnFinishChange.bind(this);let d;this.$slider.addEventListener("mousedown",p=>{this._setDraggingStyle(!0),e(p.clientX),window.addEventListener("mousemove",t),window.addEventListener("mouseup",s)}),this.$slider.addEventListener("touchstart",p=>{p.touches.length>1||(this._hasScrollBar?(n=p.touches[0].clientX,r=p.touches[0].clientY,i=!0):a(p),window.addEventListener("touchmove",o,{passive:!1}),window.addEventListener("touchend",c))},{passive:!1}),this.$slider.addEventListener("wheel",p=>{if(Math.abs(p.deltaX)<Math.abs(p.deltaY)&&this._hasScrollBar)return;p.preventDefault();const f=this._normalizeMouseWheel(p)*this._step;this._snapClampSetValue(this.getValue()+f),this.$input.value=this.getValue(),clearTimeout(d),d=setTimeout(h,400)},{passive:!1})}_setDraggingStyle(e,t="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle("lil-gui-"+t,e)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(e){let{deltaX:t,deltaY:s}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(t=0,s=-e.wheelDelta/120,s*=this._stepExplicit?1:10),t+-s}_arrowKeyMultiplier(e){let t=this._stepExplicit?1:10;return e.shiftKey?t*=10:e.altKey&&(t/=10),t}_snap(e){const t=Math.round(e/this._step)*this._step;return parseFloat(t.toPrecision(15))}_clamp(e){return e<this._min&&(e=this._min),e>this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class gt extends M{constructor(e,t,s,n){super(e,t,s,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(n)?n:Object.values(n),this._names=Array.isArray(n)?n:Object.keys(n),this._names.forEach(r=>{const i=document.createElement("option");i.innerHTML=r,this.$select.appendChild(i)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.innerHTML=t===-1?e:this._names[t],this}}class At extends M{constructor(e,t,s){super(e,t,s,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",n=>{n.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let he=!1;class te{constructor({parent:e,autoPlace:t=e===void 0,container:s,width:n,title:r="Controls",injectStyles:i=!0,touchStyles:a=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",o=>{o.code!=="Enter"&&o.code!=="Space"||(o.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(r),a&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!he&&i&&(function(o){const c=document.createElement("style");c.innerHTML=o;const h=document.querySelector("head link[rel=stylesheet], head style");h?document.head.insertBefore(c,h):document.head.appendChild(c)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),he=!0),s?s.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),n&&this.domElement.style.setProperty("--width",n+"px"),this.domElement.addEventListener("keydown",o=>o.stopPropagation()),this.domElement.addEventListener("keyup",o=>o.stopPropagation())}add(e,t,s,n,r){if(Object(s)===s)return new gt(this,e,t,s);const i=e[t];switch(typeof i){case"number":return new mt(this,e,t,s,n,r);case"boolean":return new ct(this,e,t);case"string":return new At(this,e,t);case"function":return new z(this,e,t)}console.error(`gui.add failed
|
|
9
|
+
property:`,t,`
|
|
10
|
+
object:`,e,`
|
|
11
|
+
value:`,i)}addColor(e,t,s=1){return new ft(this,e,t,s)}addFolder(e){return new te({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(s=>{s instanceof z||s._name in e.controllers&&s.load(e.controllers[s._name])}),t&&e.folders&&this.folders.forEach(s=>{s._title in e.folders&&s.load(e.folders[s._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(s=>{if(!(s instanceof z)){if(s._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${s._name}"`);t.controllers[s._name]=s.save()}}),e&&this.folders.forEach(s=>{if(s._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${s._title}"`);t.folders[s._title]=s.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const s=r=>{r.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",s))};this.$children.addEventListener("transitionend",s);const n=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=n+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}var bt=Object.defineProperty,yt=Object.getOwnPropertyDescriptor,wt=(l,e,t,s)=>{for(var n=s>1?void 0:s?yt(e,t):e,r=l.length-1,i;r>=0;r--)(i=l[r])&&(n=(s?i(e,t,n):i(n))||n);return s&&n&&bt(e,t,n),n};let B=class{constructor(){A(this,"workerPool",L.createWorkerPool());A(this,"canvas");A(this,"worker");A(this,"thread");A(this,"gui");A(this,"stats")}init(l){this.worker=l.worker,this.thread=l.thread,this.gui=new te,this.stats=se&&new se,this.stats.showPanel(0),window&&(window.document.body.appendChild(this.stats.dom),window.innerWidth<=450&&this.gui.close())}};B=wt([w.singleton()],B);var _t=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,xt=(l,e,t,s)=>{for(var n=s>1?void 0:s?Tt(e,t):e,r=l.length-1,i;r>=0;r--)(i=l[r])&&(n=(s?i(e,t,n):i(n))||n);return s&&n&&_t(e,t,n),n},Et=(l,e)=>(t,s)=>e(t,s,l);let Z=class extends w.ProxyEventHandlersModel{constructor(e){super();A(this,"canvas");A(this,"lifecycle$$",new k.Subject);A(this,"lifecycle$",this.lifecycle$$.pipe());this.component=e}init(e){this.canvas=e;for(const t of w.PROXY_EVENT_LISTENERS){const s=t.startsWith("mouse")||t.startsWith("pointer")||t.startsWith("touch")?this.mouseEventHandler:t.startsWith("key")?this.keyEventHandler:t==="resize"?this.uiEventHandler:t==="wheel"?this.wheelEventHandler:this.preventDefaultHandler;this[`${t}$`]=k.fromEvent(t==="resize"?window:e,t).pipe(k.map(s.bind(this)),k.filter(n=>!(t==="keydown"&&!n))),this[`${t}$`].subscribe(n=>{var r,i;(i=(r=this.component.thread)==null?void 0:r[t])==null||i.call(r,n)})}}preventDefaultHandler(e){return e.preventDefault(),{type:e.type}}getScreenSizes(){return{width:this.canvas.width,height:this.canvas.height,windowWidth:(window==null?void 0:window.innerWidth)??0,windowHeight:(window==null?void 0:window.innerHeight)??0}}uiEventHandler(e){const t=this.canvas.getBoundingClientRect();return{...this.getScreenSizes(),type:e.type,top:t.top,left:t.left}}mouseEventHandler(e){return{...this.getScreenSizes(),...L.copyProperties(e,["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pageX","pageY"])}}touchEventHandler(e){const t=[],s={type:e.type,touches:t};for(let n=0;n<e.touches.length;++n){const r=e.touches[n];t.push({pageX:(r==null?void 0:r.pageX)??0,pageY:(r==null?void 0:r.pageY)??0})}return{...this.getScreenSizes(),...s}}wheelEventHandler(e){return e.preventDefault(),{...this.getScreenSizes(),...L.copyProperties(e,["deltaX","deltaY"])}}keyEventHandler(e){if(w.KEYBOARD_EVENT_CODES.includes(e.code))return e.preventDefault(),{...this.getScreenSizes(),...L.copyProperties(e,["ctrlKey","metaKey","shiftKey","keyCode"])}}};Z=xt([w.singleton(),Et(0,w.inject(B))],Z);class ne{constructor(){A(this,"location");A(this,"canvas");A(this,"fullScreen");A(this,"defaultCamera");A(this,"startTimer");A(this,"enableDebug");A(this,"axesSizes");A(this,"gridSizes");A(this,"withMiniCamera");A(this,"onReady")}}class pe{constructor(){A(this,"contextmenu$");A(this,"resize$");A(this,"mousedown$");A(this,"mousemove$");A(this,"mouseup$");A(this,"pointerdown$");A(this,"pointermove$");A(this,"pointercancel$");A(this,"pointerup$");A(this,"touchstart$");A(this,"touchmove$");A(this,"touchend$");A(this,"wheel$");A(this,"keydown$")}}var vt=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,St=(l,e,t,s)=>{for(var n=s>1?void 0:s?Lt(e,t):e,r=l.length-1,i;r>=0;r--)(i=l[r])&&(n=(s?i(e,t,n):i(n))||n);return s&&n&&vt(e,t,n),n},X=(l,e)=>(t,s)=>e(t,s,l);exports.RegisterModule=class extends pe{constructor(e,t,s){super(),this.component=e,this.controller=t,this.registerProps=s,this.init()}async _initCanvas(){try{if(this.component.canvas=document.createElement("canvas"),this.registerProps.canvas instanceof HTMLCanvasElement&&(this.component.canvas=this.registerProps.canvas),typeof this.registerProps.canvas=="string"){const e=document.querySelector(this.registerProps.canvas);e instanceof HTMLCanvasElement&&(this.component.canvas=e)}this.component.canvas.parentElement||document.body.appendChild(this.component.canvas)}catch(e){console.error(`🛑 Unable to initialize the canvas:
|
|
12
|
+
${(e==null?void 0:e.message)??"Something went wrong"}`)}}async _initComponent(){this.component.init({worker:this.component.worker,thread:this.component.thread})}async _initController(){var e,t,s;this.controller.init(this.component.canvas),!(!this.component.thread||!this.component.worker)&&((t=(e=this.component.thread)==null?void 0:e.resize)==null||t.call(e,{...this.controller.uiEventHandler({type:"resize"})}),(s=this.component.thread)==null||s.lifecycle$().subscribe(n=>{var r,i;n===w.AppLifecycleState.STEP_STARTED&&((r=this.component.stats)==null||r.begin()),n===w.AppLifecycleState.STEP_ENDED&&((i=this.component.stats)==null||i.end())}))}async _initWorkerThread(){const e=this.component.canvas.transferControlToOffscreen();e.width=this.component.canvas.clientWidth,e.height=this.component.canvas.clientHeight;const t=await this.component.workerPool.run({payload:{path:this.registerProps.location,subject:{...L.excludeProperties(this.registerProps,["canvas","location","onReady"]),canvas:e},transferSubject:[e]}});if(!t.thread||!t.worker)throw new Error("Unable to retrieve app worker info.");this.component.worker=t.worker,this.component.thread=t.thread}async _initProxyEvents(){w.PROXY_EVENT_LISTENERS.forEach(e=>this[`${e}$`]=()=>{var t;return(t=this.controller)==null?void 0:t[`${e}$`]})}async init(){var e,t;await this._initCanvas(),await this._initWorkerThread(),await this._initComponent(),await this._initController(),await this._initProxyEvents(),this.controller.lifecycle$$.next(w.RegisterLifecycleState.INITIALIZED),(t=(e=this.registerProps).onReady)==null||t.call(e,this)}async loadResources(e){var s,n,r,i,a,o,c,h,d;const t=await this.component.workerPool.run({payload:{path:"../loader/loader.module-worker.ts",subject:{resources:e.resources}}});return(s=t.thread)==null||s.progress$().subscribe(p=>{var f;(f=e.onProgress)==null||f.call(e,p)}),(n=t.thread)==null||n.progressCompleted$().subscribe(p=>{var f,m;(f=e.onProgressComplete)==null||f.call(e,p),(e.disposeOnComplete||e.disposeOnComplete===void 0)&&((m=t.thread)==null||m.dispose())}),(e.immediateLoad||e.immediateLoad===void 0)&&await((r=t.thread)==null?void 0:r.load()),{...t,load:await((i=t.thread)==null?void 0:i.load),items:await((a=t.thread)==null?void 0:a.items()),loaders:await((o=t.thread)==null?void 0:o.items()),toLoad:await((c=t.thread)==null?void 0:c.toLoad()),loaded:await((h=t.thread)==null?void 0:h.loaded()),resources:await((d=t.thread)==null?void 0:d.resources())}}workerPool(){return this.component.workerPool}canvas(){return this.component.canvas}worker(){return this.component.worker}thread(){return this.component.thread}gui(){return this.component.gui}dispose(){this.component.workerPool.terminateAll(),this.controller.lifecycle$$.next(w.RegisterLifecycleState.DISPOSED)}lifecycle$(){return this.controller.lifecycle$}};exports.RegisterModule=St([w.singleton(),X(0,w.inject(B)),X(1,w.inject(Z)),X(2,w.inject(ne))],exports.RegisterModule);const Rt=l=>{if(typeof(l==null?void 0:l.location)!="string"&&!((l==null?void 0:l.location)instanceof URL))throw new Error("Invalid register props detected. location path is required");return l.defaultCamera=l!=null&&l.defaultCamera&&l.defaultCamera in w.DefaultCameraType?l.defaultCamera:w.DefaultCameraType.PERSPECTIVE,l.withMiniCamera=L.isUndefined(l.withMiniCamera)||!L.isBoolean(l.withMiniCamera)?!1:l.withMiniCamera,l.startTimer=L.isUndefined(l.startTimer)||!L.isBoolean(l.startTimer)?!0:l.startTimer,l.fullScreen=L.isUndefined(l.fullScreen)||!L.isBoolean(l.fullScreen)?!0:l.fullScreen,l.onReady=L.isFunction(l.onReady)?l.onReady:void 0,w.instance.register(ne,{useValue:l}),w.instance.resolve(exports.RegisterModule)};class Mt{constructor(){A(this,"onReady")}}exports.AppLifecycleState=w.AppLifecycleState;Object.defineProperty(exports,"AppModule",{enumerable:!0,get:()=>w.AppModule});exports.AppProxyEventHandlersModel=w.AppProxyEventHandlersModel;exports.DefaultCameraType=w.DefaultCameraType;exports.KEYBOARD_EVENT_CODES=w.KEYBOARD_EVENT_CODES;exports.PROXY_EVENT_LISTENERS=w.PROXY_EVENT_LISTENERS;exports.ProxyEventHandlersModel=w.ProxyEventHandlersModel;exports.ProxyEventObservablesModel=w.ProxyEventObservablesModel;exports.ProxyEventSubjectsModel=w.ProxyEventSubjectsModel;exports.RegisterLifecycleState=w.RegisterLifecycleState;exports.appModule=w.appModule;exports.LaunchAppProps=Mt;exports.RegisterPropsModel=ne;exports.RegisterProxyEventHandlersModel=pe;exports.loaderModule=lt;exports.register=Rt;
|
package/dist/main.d.ts
CHANGED
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
import { SerializerImplementation } from 'threads';
|
|
4
|
-
import '@quick-threejs/utils';
|
|
5
|
-
import 'rxjs';
|
|
6
|
-
import 'three';
|
|
7
|
-
import 'three/examples/jsm/controls/OrbitControls.js';
|
|
8
|
-
import 'three/examples/jsm/controls/OrbitControls';
|
|
9
|
-
import 'three/examples/jsm/libs/lil-gui.module.min';
|
|
10
|
-
import 'threads/dist/types/master';
|
|
11
|
-
import 'three/examples/jsm/libs/lil-gui.module.min.js';
|
|
12
|
-
import 'stats.js';
|
|
13
|
-
import 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
14
|
-
import 'three/examples/jsm/loaders/GLTFLoader';
|
|
15
|
-
import 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
16
|
-
|
|
17
|
-
declare const object3DSerializer: SerializerImplementation;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @description Register the main logic of the app.
|
|
21
|
-
*
|
|
22
|
-
* @remark __🏁 Should be called on your main thread. Separated from the worker thread implementation__
|
|
23
|
-
*
|
|
24
|
-
* @param props Quick-three register properties.
|
|
25
|
-
*/
|
|
26
|
-
declare const register: (props: RegisterPropsModel) => RegisterModule;
|
|
27
|
-
|
|
28
|
-
export { RegisterModule, RegisterPropsModel, object3DSerializer, register };
|
|
1
|
+
export * from './core';
|
|
2
|
+
export * from './common';
|