@3driseai/3drise-core 1.0.19 → 1.0.21

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.
Files changed (155) hide show
  1. package/dist/animations/index.d.ts +2 -0
  2. package/dist/animations/index.d.ts.map +1 -0
  3. package/dist/animations/index.js +1 -0
  4. package/dist/animations/trackGenerators.d.ts +140 -0
  5. package/dist/animations/trackGenerators.d.ts.map +1 -0
  6. package/dist/animations/trackGenerators.js +443 -0
  7. package/dist/autoAnimate/bounds.d.ts +7 -0
  8. package/dist/autoAnimate/bounds.d.ts.map +1 -0
  9. package/dist/autoAnimate/bounds.js +23 -0
  10. package/dist/autoAnimate/composer.d.ts +30 -0
  11. package/dist/autoAnimate/composer.d.ts.map +1 -0
  12. package/dist/autoAnimate/composer.js +251 -0
  13. package/dist/autoAnimate/describeScene.d.ts +105 -0
  14. package/dist/autoAnimate/describeScene.d.ts.map +1 -0
  15. package/dist/autoAnimate/describeScene.js +165 -0
  16. package/dist/autoAnimate/draft.d.ts +59 -0
  17. package/dist/autoAnimate/draft.d.ts.map +1 -0
  18. package/dist/autoAnimate/draft.js +2 -0
  19. package/dist/autoAnimate/index.d.ts +14 -0
  20. package/dist/autoAnimate/index.d.ts.map +1 -0
  21. package/dist/autoAnimate/index.js +9 -0
  22. package/dist/autoAnimate/recipes.d.ts +87 -0
  23. package/dist/autoAnimate/recipes.d.ts.map +1 -0
  24. package/dist/autoAnimate/recipes.js +224 -0
  25. package/dist/autoAnimate/rng.d.ts +10 -0
  26. package/dist/autoAnimate/rng.d.ts.map +1 -0
  27. package/dist/autoAnimate/rng.js +16 -0
  28. package/dist/autoAnimate/sceneAnalyzer.d.ts +7 -0
  29. package/dist/autoAnimate/sceneAnalyzer.d.ts.map +1 -0
  30. package/dist/autoAnimate/sceneAnalyzer.js +291 -0
  31. package/dist/autoAnimate/types.d.ts +124 -0
  32. package/dist/autoAnimate/types.d.ts.map +1 -0
  33. package/dist/autoAnimate/types.js +1 -0
  34. package/dist/autoAnimate/validator.d.ts +10 -0
  35. package/dist/autoAnimate/validator.d.ts.map +1 -0
  36. package/dist/autoAnimate/validator.js +59 -0
  37. package/dist/data/effectsDefaults.d.ts +4 -0
  38. package/dist/data/effectsDefaults.d.ts.map +1 -1
  39. package/dist/data/effectsDefaults.js +393 -2
  40. package/dist/data/gridsDefaults.d.ts +5 -0
  41. package/dist/data/gridsDefaults.d.ts.map +1 -0
  42. package/dist/data/gridsDefaults.js +419 -0
  43. package/dist/data/index.d.ts +1 -0
  44. package/dist/data/index.d.ts.map +1 -1
  45. package/dist/data/index.js +1 -0
  46. package/dist/data/particlesDefaults.d.ts +3 -1
  47. package/dist/data/particlesDefaults.d.ts.map +1 -1
  48. package/dist/data/particlesDefaults.js +78 -0
  49. package/dist/environment/cloudConfigs.d.ts +313 -0
  50. package/dist/environment/cloudConfigs.d.ts.map +1 -0
  51. package/dist/environment/cloudConfigs.js +342 -0
  52. package/dist/environment/index.d.ts +5 -0
  53. package/dist/environment/index.d.ts.map +1 -0
  54. package/dist/environment/index.js +6 -0
  55. package/dist/environment/landscapeConfigs.d.ts +220 -0
  56. package/dist/environment/landscapeConfigs.d.ts.map +1 -0
  57. package/dist/environment/landscapeConfigs.js +256 -0
  58. package/dist/environment/oceanConfigs.d.ts +293 -0
  59. package/dist/environment/oceanConfigs.d.ts.map +1 -0
  60. package/dist/environment/oceanConfigs.js +380 -0
  61. package/dist/environment/terrainConfigs.d.ts +254 -0
  62. package/dist/environment/terrainConfigs.d.ts.map +1 -0
  63. package/dist/environment/terrainConfigs.js +292 -0
  64. package/dist/index.d.ts +4 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +4 -0
  67. package/dist/properties/index.d.ts +4 -0
  68. package/dist/properties/index.d.ts.map +1 -0
  69. package/dist/properties/index.js +3 -0
  70. package/dist/properties/registry.d.ts +44 -0
  71. package/dist/properties/registry.d.ts.map +1 -0
  72. package/dist/properties/registry.js +343 -0
  73. package/dist/properties/tables/effectsProperties.d.ts +40 -0
  74. package/dist/properties/tables/effectsProperties.d.ts.map +1 -0
  75. package/dist/properties/tables/effectsProperties.js +512 -0
  76. package/dist/properties/tables/geometryProperties.d.ts +38 -0
  77. package/dist/properties/tables/geometryProperties.d.ts.map +1 -0
  78. package/dist/properties/tables/geometryProperties.js +91 -0
  79. package/dist/properties/tables/getPropertyConfig.d.ts +3 -0
  80. package/dist/properties/tables/getPropertyConfig.d.ts.map +1 -0
  81. package/dist/properties/tables/getPropertyConfig.js +16 -0
  82. package/dist/properties/tables/gridProperties.d.ts +6 -0
  83. package/dist/properties/tables/gridProperties.d.ts.map +1 -0
  84. package/dist/properties/tables/gridProperties.js +199 -0
  85. package/dist/properties/tables/index.d.ts +8 -0
  86. package/dist/properties/tables/index.d.ts.map +1 -0
  87. package/dist/properties/tables/index.js +7 -0
  88. package/dist/properties/tables/lightProperties.d.ts +14 -0
  89. package/dist/properties/tables/lightProperties.d.ts.map +1 -0
  90. package/dist/properties/tables/lightProperties.js +263 -0
  91. package/dist/properties/tables/materialBounds.d.ts +33 -0
  92. package/dist/properties/tables/materialBounds.d.ts.map +1 -0
  93. package/dist/properties/tables/materialBounds.js +180 -0
  94. package/dist/properties/tables/optionalProperties.d.ts +83 -0
  95. package/dist/properties/tables/optionalProperties.d.ts.map +1 -0
  96. package/dist/properties/tables/optionalProperties.js +710 -0
  97. package/dist/properties/tables/particlesProperties.d.ts +17 -0
  98. package/dist/properties/tables/particlesProperties.d.ts.map +1 -0
  99. package/dist/properties/tables/particlesProperties.js +334 -0
  100. package/dist/properties/types.d.ts +43 -0
  101. package/dist/properties/types.d.ts.map +1 -0
  102. package/dist/properties/types.js +12 -0
  103. package/dist/services/ShadersLibrary.d.ts +1 -1
  104. package/dist/services/ShadersLibrary.d.ts.map +1 -1
  105. package/dist/shaders/ApollonianGridMaterial.d.ts +70 -0
  106. package/dist/shaders/ApollonianGridMaterial.d.ts.map +1 -0
  107. package/dist/shaders/ApollonianGridMaterial.js +289 -0
  108. package/dist/shaders/ConformalGridMaterial.d.ts +91 -0
  109. package/dist/shaders/ConformalGridMaterial.d.ts.map +1 -0
  110. package/dist/shaders/ConformalGridMaterial.js +335 -0
  111. package/dist/shaders/HilbertGridMaterial.d.ts +79 -0
  112. package/dist/shaders/HilbertGridMaterial.d.ts.map +1 -0
  113. package/dist/shaders/HilbertGridMaterial.js +329 -0
  114. package/dist/shaders/LensingGridMaterial.d.ts +73 -0
  115. package/dist/shaders/LensingGridMaterial.d.ts.map +1 -0
  116. package/dist/shaders/LensingGridMaterial.js +253 -0
  117. package/dist/shaders/ParastichyGridMaterial.d.ts +76 -0
  118. package/dist/shaders/ParastichyGridMaterial.d.ts.map +1 -0
  119. package/dist/shaders/ParastichyGridMaterial.js +282 -0
  120. package/dist/shaders/PhyllotaxisGridMaterial.d.ts +85 -0
  121. package/dist/shaders/PhyllotaxisGridMaterial.d.ts.map +1 -0
  122. package/dist/shaders/PhyllotaxisGridMaterial.js +532 -0
  123. package/dist/shaders/TruchetGridMaterial.d.ts +76 -0
  124. package/dist/shaders/TruchetGridMaterial.d.ts.map +1 -0
  125. package/dist/shaders/TruchetGridMaterial.js +290 -0
  126. package/dist/shaders/WallpaperGridMaterial.d.ts.map +1 -1
  127. package/dist/shaders/WallpaperGridMaterial.js +6 -1
  128. package/dist/shaders/index.d.ts +7 -0
  129. package/dist/shaders/index.d.ts.map +1 -1
  130. package/dist/shaders/index.js +7 -0
  131. package/dist/three/GalleryLayoutV.d.ts.map +1 -1
  132. package/dist/three/GalleryLayoutV.js +0 -10
  133. package/dist/three/SceneBuilderV.d.ts.map +1 -1
  134. package/dist/three/SceneBuilderV.js +1 -7
  135. package/dist/types/generativeEffects.d.ts +0 -4
  136. package/dist/types/generativeEffects.d.ts.map +1 -1
  137. package/dist/types/generativeParticles.d.ts +175 -2
  138. package/dist/types/generativeParticles.d.ts.map +1 -1
  139. package/dist/types/objectSettings.d.ts +45 -4
  140. package/dist/types/objectSettings.d.ts.map +1 -1
  141. package/dist/types/scene3d.d.ts +3 -3
  142. package/dist/types/scene3d.d.ts.map +1 -1
  143. package/dist/utils/generativeAnimatable.d.ts +1 -1
  144. package/dist/utils/generativeAnimatable.d.ts.map +1 -1
  145. package/dist/utils/generativeAnimatable.js +7 -1
  146. package/dist/utils/getAnimatableProperties.d.ts +12 -1
  147. package/dist/utils/getAnimatableProperties.d.ts.map +1 -1
  148. package/dist/utils/getAnimatableProperties.js +35 -138
  149. package/dist/utils/index.d.ts +1 -0
  150. package/dist/utils/index.d.ts.map +1 -1
  151. package/dist/utils/index.js +1 -0
  152. package/dist/utils/objectEffects.d.ts +6 -0
  153. package/dist/utils/objectEffects.d.ts.map +1 -0
  154. package/dist/utils/objectEffects.js +5 -0
  155. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ export * from './trackGenerators';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/animations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './trackGenerators.js';
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Track generators — motion math baked into ordinary clip keyframes.
3
+ *
4
+ * A generator is a small parameter object (oscillate / orbit / spin / noise /
5
+ * pulse / tween / expr). `bakeTrack` turns it into keyframes the Animations V2
6
+ * runtime already understands, so the viewer, the timeline and the published
7
+ * scene never change: users get editable keys, the aiAgent gets a vocabulary
8
+ * of motion instead of hand-typed keyframes. `expandStagger` clones one track
9
+ * (keys or generator) across many objects with a time offset — the ripple.
10
+ *
11
+ * ZERO dependencies on purpose: this file is copied verbatim into aiAgent
12
+ * (CommonJS; it cannot import core, which is ESM — see particlesCatalog.ts for
13
+ * the same pattern). Source of truth: packages/core/src/animations/trackGenerators.ts.
14
+ * When it changes, copy the whole file over aiAgent/src/skills/createAnimation/trackGenerators.ts.
15
+ *
16
+ * Values: number, [x,y,z] vectors (per-component math), '#rrggbb' colours
17
+ * (tween / pulse only) and booleans (tween only: a step).
18
+ */
19
+ export type GenValue = number | number[] | string | boolean;
20
+ /** Structurally the viewer's ClipKeyframe (id, t, value, ease). */
21
+ export interface GenKeyframe {
22
+ id: string;
23
+ t: number;
24
+ value: GenValue;
25
+ ease?: string;
26
+ }
27
+ export declare const GENERATOR_TYPES: readonly ["oscillate", "orbit", "spin", "noise", "pulse", "tween", "expr"];
28
+ export type GeneratorType = typeof GENERATOR_TYPES[number];
29
+ export type GeneratorAxis = 'x' | 'y' | 'z';
30
+ /**
31
+ * Flat on purpose (strict structured output on every LLM provider accepts a flat
32
+ * object with nullable fields; unions are unreliable). Unused fields are ignored.
33
+ */
34
+ export interface TrackGenerator {
35
+ type: GeneratorType;
36
+ /** Start value. null/undefined = the authored value (`base`). tween / pulse / expr. */
37
+ from?: GenValue | null;
38
+ /** End value (tween; null with `from` set = the authored value) or peak (pulse). */
39
+ to?: GenValue | null;
40
+ /** Amplitude: number (all components) or [x,y,z] (per component; 0 leaves a component still). oscillate / noise. */
41
+ amp?: GenValue | null;
42
+ /** Hz. oscillate / noise. Default 0.5 (oscillate), 1 (noise). */
43
+ freq?: number | null;
44
+ /** Radians. oscillate: phase offset. orbit: start angle (default = where the object already is). */
45
+ phase?: number | null;
46
+ /** Seconds per revolution. orbit / spin. Negative = the other way. */
47
+ period?: number | null;
48
+ /** How many cycles / revolutions fit in the window. Alternative to freq / period. tween: repeats. */
49
+ cycles?: number | null;
50
+ /** tween: go back on every other cycle. */
51
+ yoyo?: boolean | null;
52
+ /** Ease of the tween / pulse segments. Default easeInOutCubic. */
53
+ ease?: string | null;
54
+ /** orbit: [x,y,z]; null = scene centre (option) or origin. */
55
+ center?: number[] | null;
56
+ /** orbit: null = the object's current distance from the centre. */
57
+ radius?: number | null;
58
+ /** orbit: axis of revolution (default y). spin: axis that turns (default y). */
59
+ axis?: GeneratorAxis | null;
60
+ /** orbit: vertical bob as a fraction of the radius (0 = flat); zero at the start angle. */
61
+ tilt?: number | null;
62
+ /** noise: octaves (default 2). */
63
+ octaves?: number | null;
64
+ /** noise / expr noise() / stagger random: deterministic seed. */
65
+ seed?: number | null;
66
+ /** expr: a formula — see EXPR_HELP. */
67
+ expr?: string | null;
68
+ /** Window inside the clip, seconds. Default 0..duration. */
69
+ start?: number | null;
70
+ end?: number | null;
71
+ }
72
+ export interface BakeOptions {
73
+ /** Clip duration, seconds. */
74
+ duration: number;
75
+ /** Authored value of the path (the object's current value). */
76
+ base?: GenValue;
77
+ /** Index / count inside a stagger group (expr: i, n). */
78
+ i?: number;
79
+ n?: number;
80
+ /** Default orbit centre. */
81
+ sceneCenter?: number[];
82
+ /** Samples per second for smooth generators. Default 20. */
83
+ sampleRate?: number;
84
+ /** Cap on keys per track. Default 600. */
85
+ maxKeys?: number;
86
+ makeId?: () => string;
87
+ }
88
+ export declare const EXPR_HELP: string;
89
+ /** Smooth 1D value noise, -1..1, period-free. */
90
+ export declare function noise1d(x: number, seed?: number, octaves?: number): number;
91
+ type Scope = Record<string, number>;
92
+ /** Compile an expression once; evaluate many times. Throws on a syntax error or unknown name. */
93
+ export declare function compileExpr(src: string): (scope: Scope) => number;
94
+ /**
95
+ * Bake a generator into keyframes. Smooth generators are sampled (linear ease
96
+ * between samples, the curve is in the samples); tween / pulse / spin emit exact
97
+ * keys with eases. Returns [] when the generator cannot apply to the base value
98
+ * (e.g. oscillate on a colour) — the caller reports it.
99
+ */
100
+ export declare function bakeTrack(gen: TrackGenerator, opts: BakeOptions): GenKeyframe[];
101
+ export type StaggerOrder = 'listed' | 'random' | 'byX' | 'byY' | 'byZ' | 'distanceFrom';
102
+ export interface StaggerSpec {
103
+ /** Object ids. */
104
+ targets: string[];
105
+ /** Seconds between consecutive members. */
106
+ offset: number;
107
+ order?: StaggerOrder | null;
108
+ /** distanceFrom: [x,y,z]; null = scene centre. */
109
+ origin?: number[] | null;
110
+ /** random order: seed. */
111
+ seed?: number | null;
112
+ /** The template. Exactly one of keys / gen. */
113
+ track: {
114
+ path: string;
115
+ keys?: GenKeyframe[] | null;
116
+ gen?: TrackGenerator | null;
117
+ };
118
+ }
119
+ export interface StaggerObject {
120
+ id: string;
121
+ /** World position, for ordering. */
122
+ position?: number[];
123
+ /** Authored value of `track.path` on this object (the base). */
124
+ base?: GenValue;
125
+ }
126
+ export interface StaggeredTrack {
127
+ state: string;
128
+ path: string;
129
+ keys: GenKeyframe[];
130
+ }
131
+ /** Order the ids; unknown ids are dropped. */
132
+ export declare function orderStagger(spec: StaggerSpec, objects: Record<string, StaggerObject>, sceneCenter?: number[]): string[];
133
+ /**
134
+ * One track per target: the template baked (or its keys cloned) for that object's
135
+ * base value, shifted by index * offset. The clip's duration should be
136
+ * max(key.t) afterwards — the caller owns that.
137
+ */
138
+ export declare function expandStagger(spec: StaggerSpec, objects: Record<string, StaggerObject>, opts: Omit<BakeOptions, 'base' | 'i' | 'n'>): StaggeredTrack[];
139
+ export {};
140
+ //# sourceMappingURL=trackGenerators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackGenerators.d.ts","sourceRoot":"","sources":["../../src/animations/trackGenerators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5D,mEAAmE;AACnE,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,4EAA6E,CAAC;AAC1G,MAAM,MAAM,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,aA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CAAC;QAAC,IAAI,CAAC,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,CAAC;CACrF;AAED,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,gEAAgE;IAChE,IAAI,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAA;CAAE;AAEpF,8CAA8C;AAC9C,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAgBxH;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,cAAc,EAAE,CActJ"}
@@ -0,0 +1,443 @@
1
+ /**
2
+ * Track generators — motion math baked into ordinary clip keyframes.
3
+ *
4
+ * A generator is a small parameter object (oscillate / orbit / spin / noise /
5
+ * pulse / tween / expr). `bakeTrack` turns it into keyframes the Animations V2
6
+ * runtime already understands, so the viewer, the timeline and the published
7
+ * scene never change: users get editable keys, the aiAgent gets a vocabulary
8
+ * of motion instead of hand-typed keyframes. `expandStagger` clones one track
9
+ * (keys or generator) across many objects with a time offset — the ripple.
10
+ *
11
+ * ZERO dependencies on purpose: this file is copied verbatim into aiAgent
12
+ * (CommonJS; it cannot import core, which is ESM — see particlesCatalog.ts for
13
+ * the same pattern). Source of truth: packages/core/src/animations/trackGenerators.ts.
14
+ * When it changes, copy the whole file over aiAgent/src/skills/createAnimation/trackGenerators.ts.
15
+ *
16
+ * Values: number, [x,y,z] vectors (per-component math), '#rrggbb' colours
17
+ * (tween / pulse only) and booleans (tween only: a step).
18
+ */
19
+ export const GENERATOR_TYPES = ['oscillate', 'orbit', 'spin', 'noise', 'pulse', 'tween', 'expr'];
20
+ export const EXPR_HELP = 'Variables: t (seconds since the window start), u (0..1 progress), d (window length), T (clip time), ' +
21
+ 'base (authored value, per component for vectors), k (component index 0..2), i, n (position in a stagger group), PI, E. ' +
22
+ 'Functions: sin cos tan abs min max floor ceil round sqrt pow exp log sign fract mod(a,b) clamp(x,lo,hi) ' +
23
+ 'lerp(a,b,u) smoothstep(lo,hi,x) step(edge,x) noise(x[,seed]) (-1..1, smooth) rand(seed) (0..1, constant). ' +
24
+ 'Operators + - * / % ^, parentheses, unary minus. Example: "base + 0.2*sin(2*PI*0.5*t + i*0.6)".';
25
+ // =============================================================================
26
+ // Small helpers
27
+ // =============================================================================
28
+ const TAU = Math.PI * 2;
29
+ let idCounter = 0;
30
+ const defaultId = () => `temp-key-${Date.now().toString(36)}-${(idCounter++).toString(36)}`;
31
+ const round = (n) => Math.round(n * 10000) / 10000;
32
+ const isVec = (v) => Array.isArray(v) && v.every(x => typeof x === 'number');
33
+ const isColor = (v) => typeof v === 'string' && /^#[0-9a-f]{6}$/i.test(v);
34
+ const AXIS_INDEX = { x: 0, y: 1, z: 2 };
35
+ function hashSeed(seed) {
36
+ let h = (seed | 0) ^ 0x9e3779b9;
37
+ h = Math.imul(h ^ (h >>> 16), 0x85ebca6b);
38
+ h = Math.imul(h ^ (h >>> 13), 0xc2b2ae35);
39
+ return (h ^ (h >>> 16)) >>> 0;
40
+ }
41
+ /** Deterministic 0..1 for an integer lattice point. */
42
+ function latticeRand(x, seed) {
43
+ let h = hashSeed(seed + Math.imul(x | 0, 374761393));
44
+ h = Math.imul(h ^ (h >>> 15), 2246822519);
45
+ return ((h ^ (h >>> 13)) >>> 0) / 4294967296;
46
+ }
47
+ /** Smooth 1D value noise, -1..1, period-free. */
48
+ export function noise1d(x, seed = 0, octaves = 1) {
49
+ let sum = 0, ampSum = 0, amp = 1, f = 1;
50
+ for (let o = 0; o < Math.max(1, octaves | 0); o++) {
51
+ const xf = x * f;
52
+ const x0 = Math.floor(xf);
53
+ const frac = xf - x0;
54
+ const s = frac * frac * (3 - 2 * frac);
55
+ const a = latticeRand(x0, seed + o * 7919) * 2 - 1;
56
+ const b = latticeRand(x0 + 1, seed + o * 7919) * 2 - 1;
57
+ sum += (a + (b - a) * s) * amp;
58
+ ampSum += amp;
59
+ amp *= 0.5;
60
+ f *= 2;
61
+ }
62
+ return sum / ampSum;
63
+ }
64
+ function hexToRgb(hex) {
65
+ const n = parseInt(hex.slice(1), 16);
66
+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
67
+ }
68
+ function rgbToHex([r, g, b]) {
69
+ const c = (v) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0');
70
+ return `#${c(r)}${c(g)}${c(b)}`;
71
+ }
72
+ /** Per-component view of a value: numbers → [n], vectors as-is. */
73
+ function components(v, fallbackLen = 1) {
74
+ if (typeof v === 'number')
75
+ return [v];
76
+ if (isVec(v))
77
+ return v.slice();
78
+ return new Array(fallbackLen).fill(0);
79
+ }
80
+ function fromComponents(c, like) {
81
+ return isVec(like) ? c.map(round) : round(c[0]);
82
+ }
83
+ /** Broadcast a number / vector parameter to `len` components. */
84
+ function spread(v, len, fallback) {
85
+ if (typeof v === 'number')
86
+ return new Array(len).fill(v);
87
+ if (isVec(v))
88
+ return Array.from({ length: len }, (_, k) => v[k] ?? 0);
89
+ return new Array(len).fill(fallback);
90
+ }
91
+ function windowOf(gen, duration) {
92
+ const start = Math.max(0, gen.start ?? 0);
93
+ const end = Math.min(duration, gen.end ?? duration);
94
+ return { start, end: Math.max(start, end), length: Math.max(0, end - start) };
95
+ }
96
+ const FUNCS = {
97
+ sin: Math.sin, cos: Math.cos, tan: Math.tan, abs: Math.abs, floor: Math.floor, ceil: Math.ceil,
98
+ round: Math.round, sqrt: Math.sqrt, exp: Math.exp, log: Math.log, sign: Math.sign,
99
+ min: (...a) => Math.min(...a), max: (...a) => Math.max(...a), pow: Math.pow,
100
+ fract: x => x - Math.floor(x),
101
+ mod: (a, b) => (b === 0 ? 0 : a - b * Math.floor(a / b)),
102
+ clamp: (x, lo, hi) => Math.min(hi, Math.max(lo, x)),
103
+ lerp: (a, b, u) => a + (b - a) * u,
104
+ smoothstep: (lo, hi, x) => { const u = Math.min(1, Math.max(0, (x - lo) / (hi - lo || 1))); return u * u * (3 - 2 * u); },
105
+ step: (edge, x) => (x < edge ? 0 : 1),
106
+ noise: (x, seed = 0) => noise1d(x, seed | 0, 2),
107
+ rand: (seed = 0) => latticeRand(0, seed | 0),
108
+ };
109
+ function tokenize(src) {
110
+ const out = [];
111
+ let i = 0;
112
+ while (i < src.length) {
113
+ const c = src[i];
114
+ if (/\s/.test(c)) {
115
+ i++;
116
+ continue;
117
+ }
118
+ if (/[0-9.]/.test(c)) {
119
+ const m = /^(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?/.exec(src.slice(i));
120
+ if (!m)
121
+ throw new Error(`bad number at ${i}`);
122
+ out.push({ k: 'num', v: parseFloat(m[0]) });
123
+ i += m[0].length;
124
+ continue;
125
+ }
126
+ if (/[a-zA-Z_]/.test(c)) {
127
+ const m = /^[a-zA-Z_][a-zA-Z0-9_]*/.exec(src.slice(i));
128
+ out.push({ k: 'id', v: m[0] });
129
+ i += m[0].length;
130
+ continue;
131
+ }
132
+ if ('+-*/%^(),'.includes(c)) {
133
+ out.push({ k: 'op', v: c });
134
+ i++;
135
+ continue;
136
+ }
137
+ throw new Error(`unexpected "${c}" at ${i}`);
138
+ }
139
+ return out;
140
+ }
141
+ /** Compile an expression once; evaluate many times. Throws on a syntax error or unknown name. */
142
+ export function compileExpr(src) {
143
+ const toks = tokenize(src);
144
+ let p = 0;
145
+ const peek = () => toks[p];
146
+ const take = () => toks[p++];
147
+ const isOp = (v) => peek()?.k === 'op' && peek().v === v;
148
+ function primary() {
149
+ const t = take();
150
+ if (!t)
151
+ throw new Error('unexpected end');
152
+ if (t.k === 'num') {
153
+ const v = t.v;
154
+ return () => v;
155
+ }
156
+ if (t.k === 'id') {
157
+ const name = t.v;
158
+ if (isOp('(')) {
159
+ take();
160
+ const args = [];
161
+ if (!isOp(')')) {
162
+ do {
163
+ args.push(expr());
164
+ } while (isOp(',') && take());
165
+ }
166
+ if (!isOp(')'))
167
+ throw new Error(`expected ) after ${name}(`);
168
+ take();
169
+ const fn = FUNCS[name];
170
+ if (!fn)
171
+ throw new Error(`unknown function ${name}`);
172
+ return s => fn(...args.map(a => a(s)));
173
+ }
174
+ if (name === 'PI')
175
+ return () => Math.PI;
176
+ if (name === 'E')
177
+ return () => Math.E;
178
+ return s => { const v = s[name]; if (v === undefined)
179
+ throw new Error(`unknown variable ${name}`); return v; };
180
+ }
181
+ if (t.k === 'op' && t.v === '(') {
182
+ const e = expr();
183
+ if (!isOp(')'))
184
+ throw new Error('expected )');
185
+ take();
186
+ return e;
187
+ }
188
+ if (t.k === 'op' && t.v === '-') {
189
+ const e = unary();
190
+ return s => -e(s);
191
+ }
192
+ if (t.k === 'op' && t.v === '+')
193
+ return unary();
194
+ throw new Error(`unexpected ${t.v}`);
195
+ }
196
+ function unary() { return primary(); }
197
+ function power() {
198
+ const b = unary();
199
+ if (isOp('^')) {
200
+ take();
201
+ const e = power();
202
+ return s => Math.pow(b(s), e(s));
203
+ }
204
+ return b;
205
+ }
206
+ function term() {
207
+ let l = power();
208
+ while (isOp('*') || isOp('/') || isOp('%')) {
209
+ const op = take().v;
210
+ const r = power();
211
+ const ll = l;
212
+ l = op === '*' ? s => ll(s) * r(s) : op === '/' ? s => { const d = r(s); return d === 0 ? 0 : ll(s) / d; } : s => FUNCS.mod(ll(s), r(s));
213
+ }
214
+ return l;
215
+ }
216
+ function expr() {
217
+ let l = term();
218
+ while (isOp('+') || isOp('-')) {
219
+ const op = take().v;
220
+ const r = term();
221
+ const ll = l;
222
+ l = op === '+' ? s => ll(s) + r(s) : s => ll(s) - r(s);
223
+ }
224
+ return l;
225
+ }
226
+ const root = expr();
227
+ if (p < toks.length)
228
+ throw new Error(`unexpected ${toks[p].v}`);
229
+ return s => { const v = root(s); return Number.isFinite(v) ? v : 0; };
230
+ }
231
+ // =============================================================================
232
+ // bakeTrack
233
+ // =============================================================================
234
+ /**
235
+ * Bake a generator into keyframes. Smooth generators are sampled (linear ease
236
+ * between samples, the curve is in the samples); tween / pulse / spin emit exact
237
+ * keys with eases. Returns [] when the generator cannot apply to the base value
238
+ * (e.g. oscillate on a colour) — the caller reports it.
239
+ */
240
+ export function bakeTrack(gen, opts) {
241
+ const makeId = opts.makeId ?? defaultId;
242
+ const w = windowOf(gen, opts.duration);
243
+ const base = gen.from ?? opts.base;
244
+ const key = (t, value, ease) => ease ? { id: makeId(), t: round(t), value, ease } : { id: makeId(), t: round(t), value };
245
+ switch (gen.type) {
246
+ // tween: `from` given and `to` null = tween INTO the authored value (an entrance).
247
+ case 'tween': return bakeTween(gen.from != null && gen.to == null && opts.base !== undefined ? { ...gen, to: opts.base } : gen, w, base, key);
248
+ case 'pulse': return bakePulse(gen, w, base, key);
249
+ case 'spin': return bakeSpin(gen, w, base, key);
250
+ case 'oscillate':
251
+ case 'orbit':
252
+ case 'noise':
253
+ case 'expr':
254
+ return bakeSampled(gen, w, base, opts, key);
255
+ default: return [];
256
+ }
257
+ }
258
+ function lerpValue(a, b, u) {
259
+ if (typeof a === 'number' && typeof b === 'number')
260
+ return round(a + (b - a) * u);
261
+ if (isVec(a) && isVec(b))
262
+ return a.map((x, k) => round(x + ((b[k] ?? x) - x) * u));
263
+ if (isColor(a) && isColor(b)) {
264
+ const A = hexToRgb(a), B = hexToRgb(b);
265
+ return rgbToHex(A.map((x, k) => x + (B[k] - x) * u));
266
+ }
267
+ return u < 1 ? a : b;
268
+ }
269
+ function bakeTween(gen, w, base, key) {
270
+ if (base === undefined || gen.to === undefined || gen.to === null)
271
+ return [];
272
+ const from = base, to = gen.to;
273
+ const ease = gen.ease ?? 'easeInOutCubic';
274
+ const cycles = Math.max(1, Math.round(gen.cycles ?? 1));
275
+ const seg = w.length / cycles;
276
+ const out = [];
277
+ if (typeof from === 'boolean' || typeof to === 'boolean') {
278
+ // A step: switch at the window start, back at the end if yoyo.
279
+ out.push(key(w.start, from, 'step'), key(w.start + seg, to, 'step'));
280
+ if (gen.yoyo)
281
+ out.push(key(w.end, from, 'step'));
282
+ return out;
283
+ }
284
+ for (let c = 0; c < cycles; c++) {
285
+ const t0 = w.start + c * seg;
286
+ const forward = !gen.yoyo || c % 2 === 0;
287
+ out.push(key(t0, forward ? from : to, ease));
288
+ // Without yoyo a repeat restarts from `from`: land on `to` just before the jump.
289
+ if (!gen.yoyo && c < cycles - 1)
290
+ out.push(key(t0 + seg - 0.01, to, 'step'));
291
+ }
292
+ const lastForward = !gen.yoyo || (cycles - 1) % 2 === 0;
293
+ out.push(key(w.end, lastForward ? to : from));
294
+ return out;
295
+ }
296
+ function bakePulse(gen, w, base, key) {
297
+ if (base === undefined || gen.to === undefined || gen.to === null)
298
+ return [];
299
+ const ease = gen.ease ?? 'easeInOutSine';
300
+ const cycles = Math.max(1, Math.round(gen.cycles ?? (gen.freq ? w.length * gen.freq : 1)));
301
+ const seg = w.length / cycles;
302
+ const out = [];
303
+ for (let c = 0; c < cycles; c++) {
304
+ const t0 = w.start + c * seg;
305
+ out.push(key(t0, base, ease), key(t0 + seg / 2, gen.to, ease));
306
+ }
307
+ out.push(key(w.end, base));
308
+ return out;
309
+ }
310
+ function bakeSpin(gen, w, base, key) {
311
+ if (base === undefined || typeof base === 'string' || typeof base === 'boolean')
312
+ return [];
313
+ const revolutions = gen.period ? w.length / gen.period : (gen.cycles ?? 1);
314
+ const delta = TAU * revolutions;
315
+ const comps = components(base);
316
+ const end = comps.slice();
317
+ if (isVec(base))
318
+ end[AXIS_INDEX[gen.axis ?? 'y']] += delta;
319
+ else
320
+ end[0] += delta;
321
+ return [key(w.start, base, 'linear'), key(w.end, fromComponents(end, base))];
322
+ }
323
+ function bakeSampled(gen, w, base, opts, key) {
324
+ if (base === undefined || typeof base === 'string' || typeof base === 'boolean')
325
+ return [];
326
+ if (w.length <= 0)
327
+ return [];
328
+ const rate = Math.max(1, opts.sampleRate ?? 20);
329
+ const maxKeys = Math.max(2, opts.maxKeys ?? 600);
330
+ const count = Math.min(maxKeys, Math.max(2, Math.round(w.length * rate) + 1));
331
+ const dt = w.length / (count - 1);
332
+ const comps = components(base);
333
+ const len = comps.length;
334
+ const sample = sampler(gen, base, comps, len, w, opts);
335
+ if (!sample)
336
+ return [];
337
+ const out = [];
338
+ for (let s = 0; s < count; s++) {
339
+ const t = s * dt;
340
+ const v = sample(t);
341
+ out.push(key(w.start + t, fromComponents(v, base), s < count - 1 ? 'linear' : undefined));
342
+ }
343
+ return out;
344
+ }
345
+ /** Returns f(t) → components, t relative to the window start. */
346
+ function sampler(gen, base, comps, len, w, opts) {
347
+ const i = opts.i ?? 0, n = opts.n ?? 1;
348
+ switch (gen.type) {
349
+ case 'oscillate': {
350
+ const amp = spread(gen.amp, len, len === 1 ? 1 : 0);
351
+ if (len > 1 && gen.amp == null)
352
+ amp[1] = 1; // default: bob on y
353
+ const freq = gen.freq ?? (gen.cycles ? gen.cycles / (w.length || 1) : 0.5);
354
+ const phase = gen.phase ?? 0;
355
+ return t => comps.map((b, k) => b + amp[k] * Math.sin(TAU * freq * t + phase));
356
+ }
357
+ case 'noise': {
358
+ const amp = spread(gen.amp, len, len === 1 ? 1 : 0);
359
+ if (len > 1 && gen.amp == null)
360
+ amp.fill(1);
361
+ const freq = gen.freq ?? 1;
362
+ const seed = (gen.seed ?? 0) + i * 101;
363
+ const oct = gen.octaves ?? 2;
364
+ return t => comps.map((b, k) => b + amp[k] * noise1d(t * freq + k * 37.1, seed + k * 1000, oct));
365
+ }
366
+ case 'orbit': {
367
+ if (len < 3)
368
+ return null;
369
+ const axis = gen.axis ?? 'y';
370
+ const [ia, ib, iup] = axis === 'y' ? [0, 2, 1] : axis === 'x' ? [1, 2, 0] : [0, 1, 2];
371
+ const c = gen.center ?? opts.sceneCenter ?? [0, 0, 0];
372
+ const da = comps[ia] - (c[ia] ?? 0), db = comps[ib] - (c[ib] ?? 0);
373
+ const radius = gen.radius ?? (Math.hypot(da, db) || 1);
374
+ const phase0 = gen.phase ?? ((da || db) ? Math.atan2(db, da) : 0);
375
+ const period = gen.period ?? ((w.length / (gen.cycles ?? 1)) || 1);
376
+ const tilt = gen.tilt ?? 0;
377
+ const up0 = comps[iup];
378
+ return t => {
379
+ const th = phase0 + TAU * t / period;
380
+ const v = comps.slice();
381
+ v[ia] = (c[ia] ?? 0) + radius * Math.cos(th);
382
+ v[ib] = (c[ib] ?? 0) + radius * Math.sin(th);
383
+ v[iup] = up0 + tilt * radius * Math.sin(th - phase0); // 0 at the start: no jump
384
+ return v;
385
+ };
386
+ }
387
+ case 'expr': {
388
+ if (!gen.expr)
389
+ return null;
390
+ const fn = compileExpr(gen.expr); // throws → caller reports
391
+ const scope = { i, n, d: w.length, t: 0, u: 0, T: 0, base: 0, k: 0 };
392
+ return t => comps.map((b, k) => {
393
+ scope.t = t;
394
+ scope.u = w.length ? t / w.length : 0;
395
+ scope.T = w.start + t;
396
+ scope.base = b;
397
+ scope.k = k;
398
+ return fn(scope);
399
+ });
400
+ }
401
+ default: return null;
402
+ }
403
+ }
404
+ /** Order the ids; unknown ids are dropped. */
405
+ export function orderStagger(spec, objects, sceneCenter) {
406
+ const ids = spec.targets.filter(id => objects[id]);
407
+ const order = spec.order ?? 'listed';
408
+ if (order === 'listed')
409
+ return ids;
410
+ if (order === 'random') {
411
+ const seed = spec.seed ?? 0;
412
+ return ids.map((id, k) => ({ id, r: latticeRand(k, seed) })).sort((a, b) => a.r - b.r).map(x => x.id);
413
+ }
414
+ const pos = (id) => objects[id].position ?? [0, 0, 0];
415
+ if (order === 'distanceFrom') {
416
+ const o = spec.origin ?? sceneCenter ?? [0, 0, 0];
417
+ const d = (id) => { const p = pos(id); return Math.hypot(p[0] - o[0], p[1] - o[1], p[2] - o[2]); };
418
+ return ids.slice().sort((a, b) => d(a) - d(b));
419
+ }
420
+ const k = order === 'byX' ? 0 : order === 'byY' ? 1 : 2;
421
+ return ids.slice().sort((a, b) => pos(a)[k] - pos(b)[k]);
422
+ }
423
+ /**
424
+ * One track per target: the template baked (or its keys cloned) for that object's
425
+ * base value, shifted by index * offset. The clip's duration should be
426
+ * max(key.t) afterwards — the caller owns that.
427
+ */
428
+ export function expandStagger(spec, objects, opts) {
429
+ const ids = orderStagger(spec, objects, opts.sceneCenter);
430
+ const makeId = opts.makeId ?? defaultId;
431
+ const n = ids.length;
432
+ return ids.map((id, i) => {
433
+ const shift = i * Math.max(0, spec.offset);
434
+ let keys;
435
+ if (spec.track.gen) {
436
+ keys = bakeTrack(spec.track.gen, { ...opts, base: objects[id].base, i, n, makeId });
437
+ }
438
+ else {
439
+ keys = (spec.track.keys ?? []).map(k => ({ ...k, id: makeId() }));
440
+ }
441
+ return { state: id, path: spec.track.path, keys: keys.map(k => ({ ...k, t: round(k.t + shift) })) };
442
+ });
443
+ }
@@ -0,0 +1,7 @@
1
+ import type { Bounds, V3 } from './types';
2
+ export declare function makeBounds(min: V3, max: V3): Bounds;
3
+ export declare function boundsAround(center: V3, half: V3): Bounds;
4
+ export declare function unionBounds(list: Bounds[]): Bounds | null;
5
+ export declare const distance: (a: V3, b: V3) => number;
6
+ export declare const EMPTY_BOUNDS: Bounds;
7
+ //# sourceMappingURL=bounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounds.d.ts","sourceRoot":"","sources":["../../src/autoAnimate/bounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,UAAU,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,CAInD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,CAKzD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAWzD;AAED,eAAO,MAAM,QAAQ,GAAI,GAAG,EAAE,EAAE,GAAG,EAAE,WAAsD,CAAC;AAE5F,eAAO,MAAM,YAAY,EAAE,MAA4C,CAAC"}
@@ -0,0 +1,23 @@
1
+ export function makeBounds(min, max) {
2
+ const size = [max[0] - min[0], max[1] - min[1], max[2] - min[2]];
3
+ const center = [(min[0] + max[0]) / 2, (min[1] + max[1]) / 2, (min[2] + max[2]) / 2];
4
+ return { min, max, center, size, radius: Math.hypot(size[0], size[1], size[2]) / 2 };
5
+ }
6
+ export function boundsAround(center, half) {
7
+ return makeBounds([center[0] - half[0], center[1] - half[1], center[2] - half[2]], [center[0] + half[0], center[1] + half[1], center[2] + half[2]]);
8
+ }
9
+ export function unionBounds(list) {
10
+ if (!list.length)
11
+ return null;
12
+ const min = [Infinity, Infinity, Infinity];
13
+ const max = [-Infinity, -Infinity, -Infinity];
14
+ for (const b of list) {
15
+ for (let i = 0; i < 3; i++) {
16
+ min[i] = Math.min(min[i], b.min[i]);
17
+ max[i] = Math.max(max[i], b.max[i]);
18
+ }
19
+ }
20
+ return makeBounds(min, max);
21
+ }
22
+ export const distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);
23
+ export const EMPTY_BOUNDS = makeBounds([-1, -1, -1], [1, 1, 1]);
@@ -0,0 +1,30 @@
1
+ import type { DraftClip, DraftSequence } from './draft';
2
+ import { type StyleName } from './recipes';
3
+ import { type GenerationIssue } from './validator';
4
+ import type { AnalyzeOptions, SceneInput, SceneProfile } from './types';
5
+ export type AutoTemplate = 'intro' | 'ambient';
6
+ export type LengthName = 'short' | 'medium' | 'long';
7
+ export interface GenerateOptions {
8
+ template: AutoTemplate;
9
+ style: StyleName;
10
+ length: LengthName;
11
+ driver?: DraftSequence['driver'];
12
+ seed?: number;
13
+ /** Ids for new clips / sequences / tracks / keys (the studio's temp ids). */
14
+ makeId?: (prefix: string) => string;
15
+ /** Keys already used by the project's clips and sequences. */
16
+ takenKeys?: string[];
17
+ /** A profile computed with live measurements; otherwise analysed here from settings. */
18
+ profile?: SceneProfile;
19
+ analyze?: AnalyzeOptions;
20
+ /** Start the sequence when the published project loads. */
21
+ autoplay?: boolean;
22
+ }
23
+ export interface GenerateResult {
24
+ clips: DraftClip[];
25
+ sequence: DraftSequence;
26
+ profile: SceneProfile;
27
+ issues: GenerationIssue[];
28
+ }
29
+ export declare function generateAnimation(input: SceneInput, options: GenerateOptions): GenerateResult;
30
+ //# sourceMappingURL=composer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../src/autoAnimate/composer.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAuB,aAAa,EAA0B,MAAM,SAAS,CAAC;AACrG,OAAO,EAEkF,KAAK,SAAS,EACtG,MAAM,WAAW,CAAC;AACnB,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAA+B,UAAU,EAAE,YAAY,EAAM,MAAM,SAAS,CAAC;AAEzG,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;AAC/C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,eAAe;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC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