@3driseai/3drise-viewer 0.1.24 → 0.1.26
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/animationsV2/ClipPlayer.d.ts +13 -0
- package/dist/animationsV2/ClipPlayer.d.ts.map +1 -0
- package/dist/animationsV2/ClipPlayer.js +140 -0
- package/dist/animationsV2/ClipsRuntime.d.ts +111 -0
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -0
- package/dist/animationsV2/ClipsRuntime.js +476 -0
- package/dist/animationsV2/appliers.d.ts +16 -0
- package/dist/animationsV2/appliers.d.ts.map +1 -0
- package/dist/animationsV2/appliers.js +204 -0
- package/dist/animationsV2/clipUtils.d.ts +33 -0
- package/dist/animationsV2/clipUtils.d.ts.map +1 -0
- package/dist/animationsV2/clipUtils.js +164 -0
- package/dist/animationsV2/elementSettings.d.ts +15 -0
- package/dist/animationsV2/elementSettings.d.ts.map +1 -0
- package/dist/animationsV2/elementSettings.js +16 -0
- package/dist/animationsV2/index.d.ts +16 -0
- package/dist/animationsV2/index.d.ts.map +1 -0
- package/dist/animationsV2/index.js +12 -0
- package/dist/animationsV2/nodeTracks.d.ts +13 -0
- package/dist/animationsV2/nodeTracks.d.ts.map +1 -0
- package/dist/animationsV2/nodeTracks.js +165 -0
- package/dist/animationsV2/normalize.d.ts +4 -0
- package/dist/animationsV2/normalize.d.ts.map +1 -0
- package/dist/animationsV2/normalize.js +49 -0
- package/dist/animationsV2/sequenceUtils.d.ts +57 -0
- package/dist/animationsV2/sequenceUtils.d.ts.map +1 -0
- package/dist/animationsV2/sequenceUtils.js +120 -0
- package/dist/animationsV2/types.d.ts +95 -0
- package/dist/animationsV2/types.d.ts.map +1 -0
- package/dist/animationsV2/types.js +8 -0
- package/dist/api/sceneHandle.d.ts +102 -0
- package/dist/api/sceneHandle.d.ts.map +1 -0
- package/dist/api/sceneHandle.js +237 -0
- package/dist/components/CameraController.d.ts.map +1 -1
- package/dist/components/CameraController.js +3 -44
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +0 -34
- package/dist/components/CreatedObject.d.ts.map +1 -1
- package/dist/components/CreatedObject.js +19 -1
- package/dist/components/EnvironmentManager.d.ts.map +1 -1
- package/dist/components/EnvironmentManager.js +6 -4
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +5 -1
- package/dist/components/ObjectsRenderer.d.ts +5 -1
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +24 -3
- package/dist/components/Ocean.d.ts.map +1 -1
- package/dist/components/Ocean.js +0 -63
- package/dist/components/ProjectLoader.d.ts +9 -3
- package/dist/components/ProjectLoader.d.ts.map +1 -1
- package/dist/components/ProjectLoader.js +5 -4
- package/dist/components/SceneBuilder.d.ts +9 -1
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SceneBuilder.js +30 -5
- package/dist/components/SkyController.d.ts.map +1 -1
- package/dist/components/SkyController.js +0 -39
- package/dist/components/Stars.d.ts.map +1 -1
- package/dist/components/Stars.js +3 -46
- package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
- package/dist/components/terrain/TerrainSurface.js +0 -5
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.js +0 -6
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/useInteraction.d.ts +7 -7
- package/dist/hooks/useInteraction.d.ts.map +1 -1
- package/dist/hooks/useInteraction.js +87 -233
- package/dist/hooks/useLightConfig.d.ts.map +1 -1
- package/dist/hooks/useLightConfig.js +7 -0
- package/dist/hooks/useLightLive.d.ts.map +1 -1
- package/dist/hooks/useLightLive.js +2 -0
- package/dist/hooks/useLightTargets.d.ts +7 -0
- package/dist/hooks/useLightTargets.d.ts.map +1 -0
- package/dist/hooks/useLightTargets.js +132 -0
- package/dist/hooks/useObjectAnimation.d.ts.map +1 -1
- package/dist/hooks/useObjectAnimation.js +0 -2
- package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.js +0 -5
- package/dist/hooks/useRuntimeSettings.d.ts +15 -0
- package/dist/hooks/useRuntimeSettings.d.ts.map +1 -0
- package/dist/hooks/useRuntimeSettings.js +22 -0
- package/dist/hooks/useSequenceAnimation.d.ts.map +1 -1
- package/dist/hooks/useSequenceAnimation.js +27 -9
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/interactions/index.d.ts +3 -0
- package/dist/interactions/index.d.ts.map +1 -0
- package/dist/interactions/index.js +1 -0
- package/dist/interactions/runner.d.ts +9 -0
- package/dist/interactions/runner.d.ts.map +1 -0
- package/dist/interactions/runner.js +23 -0
- package/dist/operations/catalogue/displayImage.d.ts +3 -0
- package/dist/operations/catalogue/displayImage.d.ts.map +1 -0
- package/dist/operations/catalogue/displayImage.js +39 -0
- package/dist/operations/catalogue/fade.d.ts +3 -0
- package/dist/operations/catalogue/fade.d.ts.map +1 -0
- package/dist/operations/catalogue/fade.js +44 -0
- package/dist/operations/catalogue/focus.d.ts +3 -0
- package/dist/operations/catalogue/focus.d.ts.map +1 -0
- package/dist/operations/catalogue/focus.js +22 -0
- package/dist/operations/catalogue/glow.d.ts +3 -0
- package/dist/operations/catalogue/glow.d.ts.map +1 -0
- package/dist/operations/catalogue/glow.js +49 -0
- package/dist/operations/catalogue/materialFx.d.ts +6 -0
- package/dist/operations/catalogue/materialFx.d.ts.map +1 -0
- package/dist/operations/catalogue/materialFx.js +13 -0
- package/dist/operations/catalogue/moveToFront.d.ts +3 -0
- package/dist/operations/catalogue/moveToFront.d.ts.map +1 -0
- package/dist/operations/catalogue/moveToFront.js +25 -0
- package/dist/operations/catalogue/visibility.d.ts +3 -0
- package/dist/operations/catalogue/visibility.d.ts.map +1 -0
- package/dist/operations/catalogue/visibility.js +24 -0
- package/dist/operations/catalogue/zoom.d.ts +3 -0
- package/dist/operations/catalogue/zoom.d.ts.map +1 -0
- package/dist/operations/catalogue/zoom.js +32 -0
- package/dist/operations/index.d.ts +5 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +4 -0
- package/dist/operations/registry.d.ts +11 -0
- package/dist/operations/registry.d.ts.map +1 -0
- package/dist/operations/registry.js +21 -0
- package/dist/operations/runtime.d.ts +22 -0
- package/dist/operations/runtime.d.ts.map +1 -0
- package/dist/operations/runtime.js +161 -0
- package/dist/operations/types.d.ts +96 -0
- package/dist/operations/types.d.ts.map +1 -0
- package/dist/operations/types.js +3 -0
- package/dist/operations/useOperationsRuntime.d.ts +3 -0
- package/dist/operations/useOperationsRuntime.d.ts.map +1 -0
- package/dist/operations/useOperationsRuntime.js +31 -0
- package/package.json +2 -2
|
@@ -15,6 +15,17 @@ function lerp(a, b, t) {
|
|
|
15
15
|
function lerpVec3(a, b, t) {
|
|
16
16
|
return [lerp(a[0], b[0], t), lerp(a[1], b[1], t), lerp(a[2], b[2], t)];
|
|
17
17
|
}
|
|
18
|
+
/** Transform lerp for one step at progress p (non-path). */
|
|
19
|
+
function applyTransform(obj, step, p) {
|
|
20
|
+
obj.position.set(...lerpVec3(step.fromPosition, step.toPosition, p));
|
|
21
|
+
obj.rotation.set(...lerpVec3(step.fromRotation, step.toRotation, p));
|
|
22
|
+
obj.scale.set(...lerpVec3(step.fromScale, step.toScale, p));
|
|
23
|
+
}
|
|
24
|
+
/** Transform + material for one step at progress p (non-path). */
|
|
25
|
+
function applyTransformAndMaterial(obj, step, p) {
|
|
26
|
+
applyTransform(obj, step, p);
|
|
27
|
+
interpolateMaterialProps(obj, step.materialFrom, step.materialTo, p);
|
|
28
|
+
}
|
|
18
29
|
/** Get material-related properties from a transition properties record */
|
|
19
30
|
function extractMaterialProps(props) {
|
|
20
31
|
if (!props)
|
|
@@ -67,7 +78,8 @@ export const useSequenceAnimation = (objectId, objectSource) => {
|
|
|
67
78
|
const transition = event.step.transitions[transitionIndex];
|
|
68
79
|
const stagger = event.step.stagger || 0;
|
|
69
80
|
const staggerOffsetMs = transitionIndex * stagger * 1000;
|
|
70
|
-
|
|
81
|
+
// `?? 1`, not `|| 1`: a 0 duration is an instant change (actions), not a missing value.
|
|
82
|
+
const d = event.step.duration ?? 1;
|
|
71
83
|
const ease = event.step.ease || 'linear';
|
|
72
84
|
const { properties, pathId = null } = transition;
|
|
73
85
|
// Visibility shortcut
|
|
@@ -120,6 +132,18 @@ export const useSequenceAnimation = (objectId, objectSource) => {
|
|
|
120
132
|
visibilityOverride: null,
|
|
121
133
|
pathId,
|
|
122
134
|
});
|
|
135
|
+
// Instant step (an action, or a 0-length animation step): land on `to` now.
|
|
136
|
+
// The manager emits stepStart and sequenceEnd in the same tick for these, and
|
|
137
|
+
// sequenceEnd clears stepRef, so waiting for useFrame would apply nothing.
|
|
138
|
+
if (d === 0) {
|
|
139
|
+
stopPathAnimation();
|
|
140
|
+
if (resolvedObject && stepRef.current) {
|
|
141
|
+
applyTransformAndMaterial(resolvedObject, stepRef.current, 1);
|
|
142
|
+
}
|
|
143
|
+
updateStepRef(null);
|
|
144
|
+
updateProgressRef(1);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
123
147
|
updateProgressRef(0);
|
|
124
148
|
if (pathId) {
|
|
125
149
|
startPathAnimation(pathId, d, { ease });
|
|
@@ -176,15 +200,9 @@ export const useSequenceAnimation = (objectId, objectSource) => {
|
|
|
176
200
|
resolvedObject.scale.set(...sca);
|
|
177
201
|
}
|
|
178
202
|
else {
|
|
179
|
-
|
|
180
|
-
const pos = lerpVec3(step.fromPosition, step.toPosition, p);
|
|
181
|
-
const rot = lerpVec3(step.fromRotation, step.toRotation, p);
|
|
182
|
-
const sca = lerpVec3(step.fromScale, step.toScale, p);
|
|
183
|
-
resolvedObject.position.set(...pos);
|
|
184
|
-
resolvedObject.rotation.set(...rot);
|
|
185
|
-
resolvedObject.scale.set(...sca);
|
|
203
|
+
applyTransform(resolvedObject, step, p);
|
|
186
204
|
}
|
|
187
|
-
//
|
|
205
|
+
// Material properties
|
|
188
206
|
interpolateMaterialProps(resolvedObject, step.materialFrom, step.materialTo, p);
|
|
189
207
|
if (p >= 1) {
|
|
190
208
|
updateProgressRef(1);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { FontInfo } from '@3driseai/3drise-core';
|
|
2
2
|
export { AnimationsManager as animationsManager, fontManager } from '@3driseai/3drise-core';
|
|
3
3
|
export * from './types';
|
|
4
4
|
export * from './components';
|
|
5
5
|
export * from './hooks';
|
|
6
|
+
export { createSceneHandle } from './api/sceneHandle';
|
|
7
|
+
export * from './animationsV2';
|
|
8
|
+
export * from './interactions';
|
|
9
|
+
export * from './operations';
|
|
10
|
+
export type { SceneHandle, SceneHandleEvent, SceneHandleEventType, SceneActionInfo, SceneClipInfo, SceneSequenceInfo, ScenePlayOptions, ScenePlayback } from './api/sceneHandle';
|
|
6
11
|
export type { PathAnimationOptions as PathAnimationHookOptions } from './hooks/usePathAnimation';
|
|
7
12
|
export { cameraManager } from './utils/CameraSingleton';
|
|
8
13
|
export { applyAnchorSettings, createCurves, createSunPosition, randomRange, } from './utils/utils3d';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,iBAAiB,IAAI,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG5F,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;A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EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,11 @@ export * from './types/index.js';
|
|
|
6
6
|
export * from './components/index.js';
|
|
7
7
|
// Hooks (hooks/index.ts owns the list)
|
|
8
8
|
export * from './hooks/index.js';
|
|
9
|
+
// External control of a loaded project (ProjectLoader ref / onSceneReady)
|
|
10
|
+
export { createSceneHandle } from './api/sceneHandle.js';
|
|
11
|
+
export * from './animationsV2/index.js';
|
|
12
|
+
export * from './interactions/index.js';
|
|
13
|
+
export * from './operations/index.js';
|
|
9
14
|
// Utils
|
|
10
15
|
export { cameraManager } from './utils/CameraSingleton.js';
|
|
11
16
|
export { applyAnchorSettings, createCurves, createSunPosition, randomRange, } from './utils/utils3d.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACpF,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { runInteraction, setInteractionRunner, ObjectHoverContext } from './runner.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CreatedObjectSettings, Interaction } from '@3driseai/3drise-core';
|
|
2
|
+
type Runner = (objectId: string, interaction: Interaction) => boolean;
|
|
3
|
+
export declare function setInteractionRunner(next: Runner): () => void;
|
|
4
|
+
/** Run an interaction now. False when no scene is mounted or the object is not there. */
|
|
5
|
+
export declare function runInteraction(objectId: string, interaction: Interaction): boolean;
|
|
6
|
+
export type ObjectHoverHandler = (createdObject: CreatedObjectSettings, ref: any, trigger: 'mouseEnter' | 'mouseLeave') => void;
|
|
7
|
+
export declare const ObjectHoverContext: import("react").Context<ObjectHoverHandler>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/interactions/runner.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEhF,KAAK,MAAM,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC;AAGtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,IAAI,CAG7D;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAElF;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,aAAa,EAAE,qBAAqB,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,KAAK,IAAI,CAAC;AAChI,eAAO,MAAM,kBAAkB,6CAAiD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Interaction runner + hover bridge
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// runInteraction(objectId, interaction) — run an interaction as if it were
|
|
6
|
+
// triggered (the studio's "Try it"). ObjectsRenderer registers the runner.
|
|
7
|
+
//
|
|
8
|
+
// ObjectHoverContext — ObjectsRenderer hands CreatedObject the hover handler, so
|
|
9
|
+
// 'mouseEnter' / 'mouseLeave' interactions fire without threading a prop through
|
|
10
|
+
// every renderer.
|
|
11
|
+
//
|
|
12
|
+
import { createContext } from 'react';
|
|
13
|
+
let runner = null;
|
|
14
|
+
export function setInteractionRunner(next) {
|
|
15
|
+
runner = next;
|
|
16
|
+
return () => { if (runner === next)
|
|
17
|
+
runner = null; };
|
|
18
|
+
}
|
|
19
|
+
/** Run an interaction now. False when no scene is mounted or the object is not there. */
|
|
20
|
+
export function runInteraction(objectId, interaction) {
|
|
21
|
+
return runner ? runner(objectId, interaction) : false;
|
|
22
|
+
}
|
|
23
|
+
export const ObjectHoverContext = createContext(null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayImage.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/displayImage.ts"],"names":[],"mappings":";AAGA,wBA4BG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { texturesManager } from '@3driseai/3drise-core';
|
|
2
|
+
import { defineOperation } from '../types.js';
|
|
3
|
+
export default defineOperation({
|
|
4
|
+
value: 'displayImage',
|
|
5
|
+
label: 'Show image',
|
|
6
|
+
description: "Show the clicked frame's image on the target",
|
|
7
|
+
multi: false,
|
|
8
|
+
toggles: false,
|
|
9
|
+
usableIn: ['interaction'],
|
|
10
|
+
galleryOnly: true,
|
|
11
|
+
async apply(target, _p, ctx) {
|
|
12
|
+
const url = ctx.self?.userData?.url;
|
|
13
|
+
if (!url)
|
|
14
|
+
return;
|
|
15
|
+
let applier;
|
|
16
|
+
let meshWithMap = null;
|
|
17
|
+
target.traverse((child) => {
|
|
18
|
+
if (!applier && typeof child.userData?.applyTexture === 'function')
|
|
19
|
+
applier = child.userData.applyTexture;
|
|
20
|
+
else if (!meshWithMap && child.material)
|
|
21
|
+
meshWithMap = child;
|
|
22
|
+
});
|
|
23
|
+
if (applier) {
|
|
24
|
+
applier(url);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!meshWithMap)
|
|
28
|
+
return;
|
|
29
|
+
const name = url.split('/').pop()?.split('.')[0] || `texture-${Date.now()}`;
|
|
30
|
+
try {
|
|
31
|
+
const loaded = await texturesManager.loadTexture(name, url, 'images');
|
|
32
|
+
meshWithMap.material.map = loaded;
|
|
33
|
+
meshWithMap.material.needsUpdate = true;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// a missing image leaves the target as it was
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fade.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/fade.ts"],"names":[],"mappings":";AAMA,wBAoCG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { gsap } from 'gsap';
|
|
2
|
+
import { defineOperation } from '../types.js';
|
|
3
|
+
import { forEachMaterial } from './materialFx.js';
|
|
4
|
+
const KEY = '__opFade';
|
|
5
|
+
export default defineOperation({
|
|
6
|
+
value: 'fade',
|
|
7
|
+
label: 'Fade out',
|
|
8
|
+
description: 'Fade the targets away (to a set opacity)',
|
|
9
|
+
multi: true,
|
|
10
|
+
toggles: true,
|
|
11
|
+
usableIn: ['interaction', 'action'],
|
|
12
|
+
params: {
|
|
13
|
+
opacity: { type: 'number', label: 'To opacity', default: 0, min: 0, max: 1, step: 0.05, hint: '0 hides the object when the fade ends' },
|
|
14
|
+
duration: { type: 'number', label: 'Duration', default: 1, min: 0, max: 10, step: 0.05, unit: 's' },
|
|
15
|
+
},
|
|
16
|
+
apply(target, p) {
|
|
17
|
+
const to = Number(p.opacity);
|
|
18
|
+
forEachMaterial(target, (mat) => {
|
|
19
|
+
if (!mat.userData[KEY])
|
|
20
|
+
mat.userData[KEY] = { opacity: mat.opacity, transparent: mat.transparent };
|
|
21
|
+
mat.transparent = true;
|
|
22
|
+
mat.needsUpdate = true;
|
|
23
|
+
gsap.killTweensOf(mat, 'opacity');
|
|
24
|
+
gsap.to(mat, {
|
|
25
|
+
opacity: to, duration: Number(p.duration), ease: 'power2.inOut',
|
|
26
|
+
onComplete: () => { if (to <= 0)
|
|
27
|
+
target.visible = false; },
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
revert(target, p) {
|
|
32
|
+
target.visible = true;
|
|
33
|
+
forEachMaterial(target, (mat) => {
|
|
34
|
+
const orig = mat.userData[KEY];
|
|
35
|
+
if (!orig)
|
|
36
|
+
return;
|
|
37
|
+
gsap.killTweensOf(mat, 'opacity');
|
|
38
|
+
gsap.to(mat, {
|
|
39
|
+
opacity: orig.opacity, duration: Number(p.duration), ease: 'power2.inOut',
|
|
40
|
+
onComplete: () => { mat.transparent = orig.transparent; mat.needsUpdate = true; delete mat.userData[KEY]; },
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/focus.ts"],"names":[],"mappings":";AAGA,wBAmBG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
import { DEFAULT_EASE, defineOperation } from '../types.js';
|
|
3
|
+
export default defineOperation({
|
|
4
|
+
value: 'focus',
|
|
5
|
+
label: 'Look at',
|
|
6
|
+
description: 'Turn the camera to face the target, without moving it',
|
|
7
|
+
multi: false,
|
|
8
|
+
toggles: true,
|
|
9
|
+
usableIn: ['interaction', 'action'],
|
|
10
|
+
exclusive: { group: 'camera', release: 'handover' },
|
|
11
|
+
params: {
|
|
12
|
+
duration: { type: 'number', label: 'Duration', default: 1, min: 0, max: 10, step: 0.05, unit: 's' },
|
|
13
|
+
},
|
|
14
|
+
apply(target, p, ctx) {
|
|
15
|
+
ctx.saveCameraHome();
|
|
16
|
+
const at = target.getWorldPosition(new Vector3());
|
|
17
|
+
void ctx.tools.animateCamera({}, Number(p.duration), DEFAULT_EASE, [at.x, at.y, at.z]);
|
|
18
|
+
},
|
|
19
|
+
revert(_target, p, ctx) {
|
|
20
|
+
ctx.restoreCameraHome(Number(p.duration), DEFAULT_EASE);
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glow.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/glow.ts"],"names":[],"mappings":";AAMA,wBAyCG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { gsap } from 'gsap';
|
|
2
|
+
import { defineOperation } from '../types.js';
|
|
3
|
+
import { forEachMaterial, isLit, toColor } from './materialFx.js';
|
|
4
|
+
const KEY = '__opGlow';
|
|
5
|
+
export default defineOperation({
|
|
6
|
+
value: 'glow',
|
|
7
|
+
label: 'Glow',
|
|
8
|
+
description: 'Light the targets up with an emissive glow',
|
|
9
|
+
multi: true,
|
|
10
|
+
toggles: true,
|
|
11
|
+
usableIn: ['interaction', 'action'],
|
|
12
|
+
params: {
|
|
13
|
+
color: { type: 'color', label: 'Colour', default: '#3380ff' },
|
|
14
|
+
intensity: { type: 'number', label: 'Intensity', default: 3, min: 0, max: 20, step: 0.1 },
|
|
15
|
+
duration: { type: 'number', label: 'Duration', default: 0.4, min: 0, max: 10, step: 0.05, unit: 's' },
|
|
16
|
+
},
|
|
17
|
+
apply(target, p) {
|
|
18
|
+
const color = toColor(String(p.color));
|
|
19
|
+
forEachMaterial(target, (mat) => {
|
|
20
|
+
if (!isLit(mat))
|
|
21
|
+
return;
|
|
22
|
+
if (!mat.userData[KEY]) {
|
|
23
|
+
mat.userData[KEY] = { emissive: mat.emissive.getHex(), intensity: mat.emissiveIntensity, toneMapped: mat.toneMapped };
|
|
24
|
+
}
|
|
25
|
+
mat.toneMapped = false;
|
|
26
|
+
gsap.killTweensOf(mat);
|
|
27
|
+
gsap.killTweensOf(mat.emissive);
|
|
28
|
+
gsap.to(mat, { emissiveIntensity: Number(p.intensity), duration: Number(p.duration), ease: 'power2.out' });
|
|
29
|
+
gsap.to(mat.emissive, { r: color.r, g: color.g, b: color.b, duration: Number(p.duration), ease: 'power2.out' });
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
revert(target, p) {
|
|
33
|
+
forEachMaterial(target, (mat) => {
|
|
34
|
+
if (!isLit(mat))
|
|
35
|
+
return;
|
|
36
|
+
const orig = mat.userData[KEY];
|
|
37
|
+
if (!orig)
|
|
38
|
+
return;
|
|
39
|
+
const c = toColor('#000000').setHex(orig.emissive);
|
|
40
|
+
gsap.killTweensOf(mat);
|
|
41
|
+
gsap.killTweensOf(mat.emissive);
|
|
42
|
+
gsap.to(mat, {
|
|
43
|
+
emissiveIntensity: orig.intensity, duration: Number(p.duration), ease: 'power2.in',
|
|
44
|
+
onComplete: () => { mat.toneMapped = orig.toneMapped; delete mat.userData[KEY]; },
|
|
45
|
+
});
|
|
46
|
+
gsap.to(mat.emissive, { r: c.r, g: c.g, b: c.b, duration: Number(p.duration), ease: 'power2.in' });
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Color, MeshStandardMaterial } from 'three';
|
|
2
|
+
import type { Material, Object3D } from 'three';
|
|
3
|
+
export declare function forEachMaterial(root: Object3D, fn: (mat: Material) => void): void;
|
|
4
|
+
export declare const isLit: (m: Material) => m is MeshStandardMaterial;
|
|
5
|
+
export declare const toColor: (hex: string) => Color;
|
|
6
|
+
//# sourceMappingURL=materialFx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialFx.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/materialFx.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAwB,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhD,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,QAM1E;AAED,eAAO,MAAM,KAAK,GAAI,GAAG,QAAQ,KAAG,CAAC,IAAI,oBACiC,CAAC;AAE3E,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,UAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Material helpers shared by glow / fade. Originals are kept on the material's
|
|
2
|
+
// userData under op-specific keys, so glow and fade can stack and revert exactly.
|
|
3
|
+
import { Color, MeshPhysicalMaterial, MeshStandardMaterial } from 'three';
|
|
4
|
+
export function forEachMaterial(root, fn) {
|
|
5
|
+
root.traverse((child) => {
|
|
6
|
+
if (!child.isMesh && !child.isPoints && !child.isLine)
|
|
7
|
+
return;
|
|
8
|
+
const mats = Array.isArray(child.material) ? child.material : [child.material];
|
|
9
|
+
mats.forEach((m) => m && fn(m));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export const isLit = (m) => m instanceof MeshStandardMaterial || m instanceof MeshPhysicalMaterial;
|
|
13
|
+
export const toColor = (hex) => new Color(hex);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moveToFront.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/moveToFront.ts"],"names":[],"mappings":";AAEA,wBAuBG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DEFAULT_EASE, defineOperation } from '../types.js';
|
|
2
|
+
export default defineOperation({
|
|
3
|
+
value: 'moveToFront',
|
|
4
|
+
label: 'Bring to front',
|
|
5
|
+
description: 'Bring the target in front of the camera',
|
|
6
|
+
multi: false,
|
|
7
|
+
toggles: true,
|
|
8
|
+
usableIn: ['interaction', 'action'],
|
|
9
|
+
exclusive: { group: 'front', release: 'revert' },
|
|
10
|
+
params: {
|
|
11
|
+
distance: { type: 'number', label: 'Distance', default: 2, min: 0.1, max: 100, step: 0.1 },
|
|
12
|
+
width: { type: 'number', label: 'Scale X', default: 6, min: 0.01, max: 100, step: 0.1 },
|
|
13
|
+
height: { type: 'number', label: 'Scale Y', default: 4, min: 0.01, max: 100, step: 0.1 },
|
|
14
|
+
duration: { type: 'number', label: 'Duration', default: 1, min: 0, max: 10, step: 0.05, unit: 's' },
|
|
15
|
+
},
|
|
16
|
+
apply(target, p, ctx) {
|
|
17
|
+
ctx.tools.moveToFront(target, {
|
|
18
|
+
distance: Number(p.distance), scale: [Number(p.width), Number(p.height)],
|
|
19
|
+
duration: Number(p.duration), ease: DEFAULT_EASE,
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
revert(target, p, ctx) {
|
|
23
|
+
ctx.tools.restoreTransform(target, { duration: Number(p.duration), ease: DEFAULT_EASE });
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/visibility.ts"],"names":[],"mappings":";AAIA,wBAmBG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineOperation } from '../types.js';
|
|
2
|
+
const KEY = '__opVisible';
|
|
3
|
+
export default defineOperation({
|
|
4
|
+
value: 'visibility',
|
|
5
|
+
label: 'Show / hide',
|
|
6
|
+
description: 'Hide (or show) the targets instantly',
|
|
7
|
+
multi: true,
|
|
8
|
+
toggles: true,
|
|
9
|
+
usableIn: ['interaction', 'action'],
|
|
10
|
+
params: {
|
|
11
|
+
mode: { type: 'select', label: 'Make it', default: 'hide', options: [{ value: 'hide', label: 'Hidden' }, { value: 'show', label: 'Visible' }] },
|
|
12
|
+
},
|
|
13
|
+
apply(target, p) {
|
|
14
|
+
if (target.userData[KEY] === undefined)
|
|
15
|
+
target.userData[KEY] = target.visible;
|
|
16
|
+
target.visible = p.mode === 'show';
|
|
17
|
+
},
|
|
18
|
+
revert(target) {
|
|
19
|
+
if (target.userData[KEY] === undefined)
|
|
20
|
+
return;
|
|
21
|
+
target.visible = target.userData[KEY];
|
|
22
|
+
delete target.userData[KEY];
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/zoom.ts"],"names":[],"mappings":";AAGA,wBA2BG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from 'three';
|
|
2
|
+
import { DEFAULT_EASE, defineOperation } from '../types.js';
|
|
3
|
+
export default defineOperation({
|
|
4
|
+
value: 'zoom',
|
|
5
|
+
label: 'Zoom to',
|
|
6
|
+
description: 'Fly the camera close to the target, facing it',
|
|
7
|
+
multi: false,
|
|
8
|
+
toggles: true,
|
|
9
|
+
usableIn: ['interaction', 'action'],
|
|
10
|
+
exclusive: { group: 'camera', release: 'handover' },
|
|
11
|
+
params: {
|
|
12
|
+
distance: { type: 'number', label: 'Distance', default: 2, min: 0.1, max: 100, step: 0.1 },
|
|
13
|
+
duration: { type: 'number', label: 'Duration', default: 1, min: 0, max: 10, step: 0.05, unit: 's' },
|
|
14
|
+
},
|
|
15
|
+
apply(target, p, ctx) {
|
|
16
|
+
const pose = ctx.tools.cameraPose();
|
|
17
|
+
if (!pose)
|
|
18
|
+
return;
|
|
19
|
+
ctx.saveCameraHome();
|
|
20
|
+
const camPos = new Vector3(...pose.position);
|
|
21
|
+
const at = target.getWorldPosition(new Vector3());
|
|
22
|
+
// Stand in front of the target, on the side the camera is already on.
|
|
23
|
+
const forward = new Vector3(0, 0, 1).applyQuaternion(target.getWorldQuaternion(new Quaternion()));
|
|
24
|
+
if (forward.dot(camPos.clone().sub(at).normalize()) < 0)
|
|
25
|
+
forward.negate();
|
|
26
|
+
const to = at.clone().add(forward.multiplyScalar(Number(p.distance)));
|
|
27
|
+
void ctx.tools.animateCamera({ position: [to.x, to.y, to.z] }, Number(p.duration), DEFAULT_EASE, [at.x, at.y, at.z]);
|
|
28
|
+
},
|
|
29
|
+
revert(_target, p, ctx) {
|
|
30
|
+
ctx.restoreCameraHome(Number(p.duration), DEFAULT_EASE);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export { OPERATIONS, getOperation, operationsFor, resolveParams } from './registry';
|
|
3
|
+
export { runEffect, applyOperation, revertOperation, isOperationOn, resolveEffectTargets, runActionEffects, areActionEffectsOn, subscribeActionEffects, registerOperationTools, } from './runtime';
|
|
4
|
+
export { useOperationsRuntime } from './useOperationsRuntime';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EACH,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAC/E,gBAAgB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,sBAAsB,GACvF,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export { OPERATIONS, getOperation, operationsFor, resolveParams } from './registry.js';
|
|
3
|
+
export { runEffect, applyOperation, revertOperation, isOperationOn, resolveEffectTargets, runActionEffects, areActionEffectsOn, subscribeActionEffects, registerOperationTools, } from './runtime.js';
|
|
4
|
+
export { useOperationsRuntime } from './useOperationsRuntime.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OperationName } from '@3driseai/3drise-core';
|
|
2
|
+
import type { OperationDefinition, OperationParams, OperationSource } from './types';
|
|
3
|
+
export declare const OPERATIONS: OperationDefinition[];
|
|
4
|
+
export declare const getOperation: (name: OperationName) => OperationDefinition | undefined;
|
|
5
|
+
/** Operations offered in a context (gallery-only ones only on gallery objects). */
|
|
6
|
+
export declare const operationsFor: (source: OperationSource, opts?: {
|
|
7
|
+
gallery?: boolean;
|
|
8
|
+
}) => OperationDefinition[];
|
|
9
|
+
/** Defaults overlaid with the effect's own values (unknown keys dropped). */
|
|
10
|
+
export declare function resolveParams(def: OperationDefinition, overrides?: OperationParams): OperationParams;
|
|
11
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/operations/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AASrF,eAAO,MAAM,UAAU,EAAE,mBAAmB,EAAqE,CAAC;AAIlH,eAAO,MAAM,YAAY,GAAI,MAAM,aAAa,KAAG,mBAAmB,GAAG,SAA6B,CAAC;AAEvG,mFAAmF;AACnF,eAAO,MAAM,aAAa,GAAI,QAAQ,eAAe,EAAE,OAAM;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,mBAAmB,EAClB,CAAC;AAE5F,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,GAAG,EAAE,mBAAmB,EAAE,SAAS,CAAC,EAAE,eAAe,GAAG,eAAe,CAOpG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import glow from './catalogue/glow.js';
|
|
2
|
+
import fade from './catalogue/fade.js';
|
|
3
|
+
import visibility from './catalogue/visibility.js';
|
|
4
|
+
import zoom from './catalogue/zoom.js';
|
|
5
|
+
import focus from './catalogue/focus.js';
|
|
6
|
+
import moveToFront from './catalogue/moveToFront.js';
|
|
7
|
+
import displayImage from './catalogue/displayImage.js';
|
|
8
|
+
export const OPERATIONS = [glow, fade, visibility, zoom, focus, moveToFront, displayImage];
|
|
9
|
+
const byName = new Map(OPERATIONS.map(o => [o.value, o]));
|
|
10
|
+
export const getOperation = (name) => byName.get(name);
|
|
11
|
+
/** Operations offered in a context (gallery-only ones only on gallery objects). */
|
|
12
|
+
export const operationsFor = (source, opts = {}) => OPERATIONS.filter(o => o.usableIn.includes(source) && (!o.galleryOnly || opts.gallery));
|
|
13
|
+
/** Defaults overlaid with the effect's own values (unknown keys dropped). */
|
|
14
|
+
export function resolveParams(def, overrides) {
|
|
15
|
+
const out = {};
|
|
16
|
+
for (const [key, spec] of Object.entries(def.params ?? {})) {
|
|
17
|
+
const v = overrides?.[key];
|
|
18
|
+
out[key] = v === undefined || v === null ? spec.default : v;
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
import type { ActionSequence, OperationEffect, OperationName } from '@3driseai/3drise-core';
|
|
3
|
+
import type { OperationDefinition, OperationParams, OperationTools } from './types';
|
|
4
|
+
/** Register the mounted scene's tools. Returns the unregister. */
|
|
5
|
+
export declare function registerOperationTools(t: OperationTools): () => void;
|
|
6
|
+
export declare function isOperationOn(op: OperationName, target: Object3D): boolean;
|
|
7
|
+
export declare function applyOperation(def: OperationDefinition, target: Object3D, params: OperationParams, self?: Object3D | null): boolean;
|
|
8
|
+
export declare function revertOperation(def: OperationDefinition, target: Object3D): boolean;
|
|
9
|
+
/** The objects an effect acts on: 'self', object ids, narrowed to model nodes. */
|
|
10
|
+
export declare function resolveEffectTargets(effect: OperationEffect, self?: Object3D | null): Object3D[];
|
|
11
|
+
/**
|
|
12
|
+
* Run one effect.
|
|
13
|
+
* trigger interactions: toggle when the operation toggles, else apply
|
|
14
|
+
* apply / revert / toggle explicit
|
|
15
|
+
*/
|
|
16
|
+
export declare function runEffect(effect: OperationEffect, mode: 'trigger' | 'apply' | 'revert' | 'toggle', self?: Object3D | null): void;
|
|
17
|
+
/** Apply or undo an action's effects directly (the editor's "Try it"). */
|
|
18
|
+
export declare function runActionEffects(action: ActionSequence, mode: 'apply' | 'revert'): void;
|
|
19
|
+
export declare const areActionEffectsOn: (actionId: string) => boolean;
|
|
20
|
+
/** Subscribe to action-effects on/off changes (studio badges). */
|
|
21
|
+
export declare function subscribeActionEffects(fn: () => void): () => void;
|
|
22
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/operations/runtime.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAgB,MAAM,uBAAuB,CAAC;AAG1G,OAAO,KAAK,EAAoB,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA2BtG,kEAAkE;AAClE,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,IAAI,CAQpE;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAE1E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAkBnI;AAED,wBAAgB,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