layershift 0.3.0 → 0.4.1

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 (48) hide show
  1. package/README.md +46 -43
  2. package/dist/components/layershift.js +264 -1119
  3. package/dist/npm/layershift.es.js +2277 -3774
  4. package/dist/types/components/layershift/global.d.ts +2 -2
  5. package/dist/types/components/layershift/index.d.ts +5 -1
  6. package/dist/types/components/layershift/index.d.ts.map +1 -1
  7. package/dist/types/components/layershift/layershift-element.d.ts +39 -9
  8. package/dist/types/components/layershift/layershift-element.d.ts.map +1 -1
  9. package/dist/types/components/layershift/lifecycle.d.ts +6 -0
  10. package/dist/types/components/layershift/lifecycle.d.ts.map +1 -1
  11. package/dist/types/components/layershift/portal-element.d.ts +11 -3
  12. package/dist/types/components/layershift/portal-element.d.ts.map +1 -1
  13. package/dist/types/components/layershift/types.d.ts +22 -9
  14. package/dist/types/components/layershift/types.d.ts.map +1 -1
  15. package/dist/types/depth-analysis.d.ts +10 -6
  16. package/dist/types/depth-analysis.d.ts.map +1 -1
  17. package/dist/types/{parallax-renderer.d.ts → depth-effect-renderer.d.ts} +63 -15
  18. package/dist/types/depth-effect-renderer.d.ts.map +1 -0
  19. package/dist/types/depth-estimator.d.ts +96 -0
  20. package/dist/types/depth-estimator.d.ts.map +1 -0
  21. package/dist/types/input-handler.d.ts +8 -2
  22. package/dist/types/input-handler.d.ts.map +1 -1
  23. package/dist/types/media-source.d.ts +76 -0
  24. package/dist/types/media-source.d.ts.map +1 -0
  25. package/dist/types/portal-renderer.d.ts +2 -1
  26. package/dist/types/portal-renderer.d.ts.map +1 -1
  27. package/dist/types/precomputed-depth.d.ts +5 -0
  28. package/dist/types/precomputed-depth.d.ts.map +1 -1
  29. package/dist/types/renderer-base.d.ts +13 -8
  30. package/dist/types/renderer-base.d.ts.map +1 -1
  31. package/dist/types/shared/channel-to-renderer.d.ts +72 -0
  32. package/dist/types/shared/channel-to-renderer.d.ts.map +1 -0
  33. package/dist/types/shared/filter-config.d.ts +184 -0
  34. package/dist/types/shared/filter-config.d.ts.map +1 -0
  35. package/dist/types/video-source.d.ts +0 -1
  36. package/dist/types/video-source.d.ts.map +1 -1
  37. package/package.json +9 -3
  38. package/dist/types/gpu-backend.d.ts +0 -37
  39. package/dist/types/gpu-backend.d.ts.map +0 -1
  40. package/dist/types/parallax-renderer-webgpu.d.ts +0 -103
  41. package/dist/types/parallax-renderer-webgpu.d.ts.map +0 -1
  42. package/dist/types/parallax-renderer.d.ts.map +0 -1
  43. package/dist/types/portal-renderer-webgpu.d.ts +0 -199
  44. package/dist/types/portal-renderer-webgpu.d.ts.map +0 -1
  45. package/dist/types/render-pass-webgpu.d.ts +0 -76
  46. package/dist/types/render-pass-webgpu.d.ts.map +0 -1
  47. package/dist/types/webgpu-utils.d.ts +0 -42
  48. package/dist/types/webgpu-utils.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * JSX IntrinsicElements declaration for the <layershift-parallax> custom element.
2
+ * JSX IntrinsicElements declaration for the <layershift-effect> custom element.
3
3
  *
4
4
  * Reference this file in your tsconfig.json to get TypeScript support
5
5
  * for the custom element in React/JSX projects:
@@ -14,7 +14,7 @@ import type { LayershiftProps } from './types';
14
14
  declare global {
15
15
  namespace JSX {
16
16
  interface IntrinsicElements {
17
- 'layershift-parallax': React.DetailedHTMLProps<
17
+ 'layershift-effect': React.DetailedHTMLProps<
18
18
  React.HTMLAttributes<HTMLElement> & {
19
19
  src?: string;
20
20
  'depth-src'?: string;
@@ -2,12 +2,16 @@
2
2
  * Entry point for Layershift Web Components.
3
3
  *
4
4
  * Importing this module registers all effect elements with the browser:
5
- * - <layershift-parallax> — Depth-aware parallax video effect
5
+ * - <layershift-effect> — Depth-aware video effect
6
6
  * - <layershift-portal> — Logo-shaped video portal with depth parallax
7
7
  */
8
8
  import { LayershiftElement } from './layershift-element';
9
9
  import { LayershiftPortalElement } from './portal-element';
10
10
  export { LayershiftElement };
11
+ /**
12
+ * @deprecated Use `LayershiftElement` with a filter-config.json instead.
13
+ * The portal element will be removed in a future major version.
14
+ */
11
15
  export { LayershiftPortalElement };
12
16
  export type { LayershiftProps } from './types';
13
17
  export type { LayershiftEventMap, LayershiftReadyDetail, LayershiftPlayDetail, LayershiftPauseDetail, LayershiftLoopDetail, LayershiftFrameDetail, LayershiftErrorDetail, } from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,YAAY,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B;;;GAGG;AACH,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,YAAY,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,SAAS,CAAC"}
@@ -1,29 +1,38 @@
1
1
  /**
2
- * <layershift-parallax> Web Component
2
+ * <layershift-effect> Web Component
3
3
  *
4
- * A self-contained Custom Element that renders a depth-aware parallax
4
+ * A self-contained Custom Element that renders a depth-aware
5
5
  * video effect. Encapsulates the entire WebGL pipeline inside a
6
6
  * Shadow DOM — consumers just drop in the tag and provide asset URLs.
7
7
  *
8
8
  * Usage:
9
- * <layershift-parallax
9
+ * <layershift-effect
10
10
  * src="video.mp4"
11
11
  * depth-src="depth-data.bin"
12
12
  * depth-meta="depth-meta.json"
13
- * ></layershift-parallax>
13
+ * ></layershift-effect>
14
14
  */
15
+ import type { ChannelLayer } from '../../shared/filter-config';
15
16
  import type { ManagedElement } from './lifecycle';
16
17
  export declare class LayershiftElement extends HTMLElement implements ManagedElement {
17
- static readonly TAG_NAME = "layershift-parallax";
18
+ static readonly TAG_NAME = "layershift-effect";
18
19
  static get observedAttributes(): string[];
19
20
  readonly reinitAttributes: string[];
21
+ canInit(): boolean;
20
22
  private shadow;
21
23
  private container;
22
24
  private renderer;
23
25
  private inputHandler;
24
- private video;
26
+ private source;
27
+ private depthEstimator;
25
28
  private loopCount;
26
29
  private readonly lifecycle;
30
+ /**
31
+ * Depth-adaptive fallback values computed once during init from the
32
+ * depth analysis profile. Stored so that updateConfig() can pass them
33
+ * to channelsToRendererConfig() without re-running depth analysis.
34
+ */
35
+ private depthFallback;
27
36
  constructor();
28
37
  private getAttrFloat;
29
38
  private getAttrBool;
@@ -32,13 +41,16 @@ export declare class LayershiftElement extends HTMLElement implements ManagedEle
32
41
  private get parallaxMax();
33
42
  private get overscan();
34
43
  private get quality();
44
+ /** @deprecated WebGPU backend removed — always uses WebGL2 for render parity with the editor. */
35
45
  private get gpuBackend();
46
+ private get sourceType();
47
+ private get depthModel();
36
48
  private get shouldAutoplay();
37
49
  private get shouldLoop();
38
50
  private get shouldMute();
39
51
  /**
40
52
  * Dispatch a namespaced custom event that bubbles through Shadow DOM.
41
- * All events use the `layershift-parallax:` prefix and are `composed`
53
+ * All events use the `layershift-effect:` prefix and are `composed`
42
54
  * so consumers can listen on the host element from the light DOM.
43
55
  */
44
56
  private emit;
@@ -46,13 +58,31 @@ export declare class LayershiftElement extends HTMLElement implements ManagedEle
46
58
  * Attach native video event listeners and re-dispatch them
47
59
  * as namespaced custom events on the host element.
48
60
  */
49
- private attachVideoEventListeners;
61
+ private attachSourceEventListeners;
50
62
  connectedCallback(): void;
51
63
  disconnectedCallback(): void;
52
64
  attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
53
65
  setupShadowDOM(): void;
66
+ /**
67
+ * Fetch and parse a FilterConfig JSON file.
68
+ * Returns null if the attribute is absent or the fetch fails.
69
+ */
70
+ private fetchFilterConfig;
71
+ /**
72
+ * Build renderer config from HTML attributes (legacy parallax-only path).
73
+ */
74
+ private buildLegacyConfig;
54
75
  doInit(signal: AbortSignal): Promise<void>;
55
- private createVideoElement;
76
+ /**
77
+ * Push new channel parameters to the renderer at runtime.
78
+ *
79
+ * This is the primary API for external controls (overlays, drawers,
80
+ * host-page UIs) to drive effect parameters without reinitializing
81
+ * the WebGL pipeline. Safe to call on every slider change.
82
+ *
83
+ * @param channels - The updated ChannelLayer[] from the controls store.
84
+ */
85
+ updateConfig(channels: ChannelLayer[]): void;
56
86
  doDispose(): void;
57
87
  }
58
88
  //# sourceMappingURL=layershift-element.d.ts.map
@@ -1 +1 @@
1
- {"version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K,UAAU,GAAiE;IAIvF;;;;OAIG;IACH,OAAO,CAAC,IAAI;IAUZ;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAyBlC,iBAAiB,IAAI,IAAI;IAIzB,oBAAoB,IAAI,IAAI;IAI5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM1F,cAAc,IAAI,IAAI;IAkCtB;;;OAGG;YACW,iBAAiB;IA+B/B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA6BnB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA4QhD;;;;;;;;OAQG;IACH,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI;IA0B5C,SAAS,IAAI,IAAI;CAiBlB"}
@@ -50,6 +50,12 @@ export interface ManagedElement {
50
50
  * Does NOT need to handle the abort controller — the manager owns that.
51
51
  */
52
52
  doDispose(): void;
53
+ /**
54
+ * Optional custom readiness check. When provided, replaces the default
55
+ * gate (all reinitAttributes must be present) with element-specific
56
+ * logic — e.g. camera mode doesn't require src/depth-src/depth-meta.
57
+ */
58
+ canInit?(): boolean;
53
59
  }
54
60
  /**
55
61
  * Lifecycle state managed on behalf of the element. Attached as a private
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAEpC,2DAA2D;IAC3D,cAAc,IAAI,IAAI,CAAC;IAEvB;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3C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S;IAC7B,OAAO,CAAC,OAAO,CAA+B;gBAElC,OAAO,EAAE,WAAW,GAAG,cAAc;IAMjD,WAAW,IAAI,IAAI;IAKnB,cAAc,IAAI,IAAI;IAMtB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAepF,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,eAAe,IAAI,IAAI;YAOT,OAAO;IAgCrB,OAAO,CAAC,UAAU;CAKnB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,sBAAsB,GAAG,qBAAqB,GAAG,IAAI,GAAG,IAAI,CAInG"}
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * <layershift-portal> Web Component
3
3
  *
4
+ * @deprecated Use `<layershift-effect>` with a filter-config.json instead.
5
+ * The portal element will be removed in a future major version.
6
+ * See https://layershift.io/docs/migration for details.
7
+ *
4
8
  * A self-contained Custom Element that renders video through a logo-shaped
5
9
  * portal with depth-aware parallax, emissive interior compositing, geometric
6
10
  * chamfer lighting, and dimensional boundary effects. Encapsulates the
@@ -19,11 +23,13 @@ export declare class LayershiftPortalElement extends HTMLElement implements Mana
19
23
  static readonly TAG_NAME = "layershift-portal";
20
24
  static get observedAttributes(): string[];
21
25
  readonly reinitAttributes: string[];
26
+ canInit(): boolean;
22
27
  private shadow;
23
28
  private container;
24
29
  private renderer;
25
30
  private inputHandler;
26
- private video;
31
+ private source;
32
+ private depthEstimator;
27
33
  private mesh;
28
34
  private loopCount;
29
35
  private readonly lifecycle;
@@ -32,12 +38,14 @@ export declare class LayershiftPortalElement extends HTMLElement implements Mana
32
38
  private getAttrBool;
33
39
  private getAttrColor;
34
40
  private getAttrVec3;
41
+ private get sourceType();
35
42
  private get parallaxX();
36
43
  private get parallaxY();
37
44
  private get parallaxMax();
38
45
  private get overscan();
39
46
  private get pomSteps();
40
47
  private get quality();
48
+ /** @deprecated WebGPU backend removed — always uses WebGL2 for render parity with the editor. */
41
49
  private get gpuBackend();
42
50
  private get rimIntensity();
43
51
  private get rimWidth();
@@ -74,17 +82,17 @@ export declare class LayershiftPortalElement extends HTMLElement implements Mana
74
82
  private get edgeOcclusionWidth();
75
83
  private get edgeOcclusionStrength();
76
84
  private get lightDirection3();
85
+ private get depthModel();
77
86
  private get shouldAutoplay();
78
87
  private get shouldLoop();
79
88
  private get shouldMute();
80
89
  private emit;
81
- private attachVideoEventListeners;
90
+ private attachSourceEventListeners;
82
91
  connectedCallback(): void;
83
92
  disconnectedCallback(): void;
84
93
  attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
85
94
  setupShadowDOM(): void;
86
95
  doInit(signal: AbortSignal): Promise<void>;
87
- private createVideoElement;
88
96
  doDispose(): void;
89
97
  }
90
98
  //# sourceMappingURL=portal-element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"portal-element.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/portal-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAoBH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmMlD,qBAAa,uBAAwB,SAAQ,WAAY,YAAW,cAAc;IAChF,MAAM,CAAC,QAAQ,CAAC,QAAQ,uBAAuB;IAE/C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAoBxC;IAED,QAAQ,CAAC,gBAAgB,WAAkD;IAE3E,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,QAAQ,CAAsD;IACtE,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;;IAU7C,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC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ElH,OAAO,KAAK,aAAa,GAAkF;IAC3G,OAAO,KAAK,YAAY,GAAgF;IACxG,OAAO,KAAK,SAAS,GAA4F;IAEjH,OAAO,KAAK,YAAY,GAAgF;IACxG,OAAO,KAAK,YAAY,GAAgF;IACxG,OAAO,KAAK,YAAY,GAAkG;IAC1H,OAAO,KAAK,cAAc,GAAoF;IAC9G,OAAO,KAAK,eAAe,GAAsF;IACjH,OAAO,KAAK,gBAAgB,GAAwF;IAEpH,OAAO,KAAK,kBAAkB,GAA6F;IAC3H,OAAO,KAAK,qBAAqB,GAAmG;IACpI,OAAO,KAAK,eAAe,GAAqG;IAChI,OAAO,KAAK,UAAU,GAA8D;IACpF,OAAO,KAAK,cAAc,GAAuE;IACjG,OAAO,KAAK,UAAU,GAA+D;IACrF,OAAO,KAAK,UAAU,GAAiE;IAIvF,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,0BAA0B;IAyBlC,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAI5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM1F,cAAc,IAAI,IAAI;IAkChB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA2NhD,SAAS,IAAI,IAAI;CAiBlB"}
@@ -25,7 +25,7 @@ export interface LayershiftReadyDetail {
25
25
  /** Depth analysis profile (present when depth data was analyzed). */
26
26
  depthProfile?: import('../../depth-analysis').DepthProfile;
27
27
  /** Parameters derived from depth analysis (present when depth data was analyzed). */
28
- derivedParams?: import('../../depth-analysis').DerivedParallaxParams;
28
+ derivedParams?: import('../../depth-analysis').DerivedEffectParams;
29
29
  }
30
30
  /** Fired when video starts playing. */
31
31
  export interface LayershiftPlayDetail {
@@ -48,23 +48,35 @@ export interface LayershiftFrameDetail {
48
48
  export interface LayershiftErrorDetail {
49
49
  message: string;
50
50
  }
51
+ /** Fired during depth model download with progress updates. */
52
+ export interface LayershiftModelProgressDetail {
53
+ /** Bytes received so far. */
54
+ receivedBytes: number;
55
+ /** Total bytes (from Content-Length header), or null if unknown. */
56
+ totalBytes: number | null;
57
+ /** Download fraction 0–1 (0 if total is unknown). */
58
+ fraction: number;
59
+ /** Human-readable status label (e.g. "Downloading depth model…"). */
60
+ label: string;
61
+ }
51
62
  /**
52
- * Map of all custom events dispatched by `<layershift-parallax>`.
63
+ * Map of all custom events dispatched by `<layershift-effect>`.
53
64
  *
54
65
  * Usage with addEventListener:
55
66
  * ```ts
56
- * el.addEventListener('layershift-parallax:ready', (e) => {
67
+ * el.addEventListener('layershift-effect:ready', (e) => {
57
68
  * console.log(e.detail.videoWidth, e.detail.duration);
58
69
  * });
59
70
  * ```
60
71
  */
61
72
  export interface LayershiftEventMap {
62
- 'layershift-parallax:ready': CustomEvent<LayershiftReadyDetail>;
63
- 'layershift-parallax:play': CustomEvent<LayershiftPlayDetail>;
64
- 'layershift-parallax:pause': CustomEvent<LayershiftPauseDetail>;
65
- 'layershift-parallax:loop': CustomEvent<LayershiftLoopDetail>;
66
- 'layershift-parallax:frame': CustomEvent<LayershiftFrameDetail>;
67
- 'layershift-parallax:error': CustomEvent<LayershiftErrorDetail>;
73
+ 'layershift-effect:ready': CustomEvent<LayershiftReadyDetail>;
74
+ 'layershift-effect:play': CustomEvent<LayershiftPlayDetail>;
75
+ 'layershift-effect:pause': CustomEvent<LayershiftPauseDetail>;
76
+ 'layershift-effect:loop': CustomEvent<LayershiftLoopDetail>;
77
+ 'layershift-effect:frame': CustomEvent<LayershiftFrameDetail>;
78
+ 'layershift-effect:error': CustomEvent<LayershiftErrorDetail>;
79
+ 'layershift-effect:model-progress': CustomEvent<LayershiftModelProgressDetail>;
68
80
  }
69
81
  /** Props for the <layershift-portal> Web Component. */
70
82
  export interface LayershiftPortalProps {
@@ -199,5 +211,6 @@ export interface LayershiftPortalEventMap {
199
211
  'layershift-portal:loop': CustomEvent<LayershiftPortalLoopDetail>;
200
212
  'layershift-portal:frame': CustomEvent<LayershiftPortalFrameDetail>;
201
213
  'layershift-portal:error': CustomEvent<LayershiftPortalErrorDetail>;
214
+ 'layershift-portal:model-progress': CustomEvent<LayershiftModelProgressDetail>;
202
215
  }
203
216
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC7C,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAMD,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,YAAY,CAAC,EAAE,OAAO,sBAAsB,EAAE,YAAY,CAAC;IAC3D,qFAAqF;IACrF,aAAa,CAAC,EAA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WAAW,CAAC,6BAA6B,CAAC,CAAC;CAChF"}
@@ -6,7 +6,7 @@
6
6
  * 1. `analyzeDepthFrames()` — computes a statistical DepthProfile from
7
7
  * precomputed depth frames (histogram, percentiles, bimodality).
8
8
  *
9
- * 2. `deriveParallaxParams()` — maps a DepthProfile to concrete parallax
9
+ * 2. `deriveEffectParams()` — maps a DepthProfile to concrete effect
10
10
  * renderer parameters using continuous functions with algebraic
11
11
  * calibration guarantees.
12
12
  *
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * Both functions run once at initialization. analyzeDepthFrames samples
22
22
  * up to 5 deterministically-chosen frames (~1.3M pixels at 512×512),
23
- * completing in <5ms. deriveParallaxParams is O(1) arithmetic.
23
+ * completing in <5ms. deriveEffectParams is O(1) arithmetic.
24
24
  *
25
25
  * ## Determinism
26
26
  *
@@ -62,7 +62,7 @@ export interface DepthProfile {
62
62
  * Parallax parameters derived from depth analysis.
63
63
  * All values are clamped to safe bounds.
64
64
  */
65
- export interface DerivedParallaxParams {
65
+ export interface DerivedEffectParams {
66
66
  parallaxStrength: number;
67
67
  contrastLow: number;
68
68
  contrastHigh: number;
@@ -82,7 +82,7 @@ export interface DerivedParallaxParams {
82
82
  * @param width - Frame width in pixels (e.g. 512).
83
83
  * @param height - Frame height in pixels (e.g. 512).
84
84
  * @returns DepthProfile with all statistics. If frames is empty, returns
85
- * a degenerate profile that will trigger rejection in deriveParallaxParams.
85
+ * a degenerate profile that will trigger rejection in deriveEffectParams.
86
86
  */
87
87
  export declare function analyzeDepthFrames(frames: Uint8Array[], width: number, height: number): DepthProfile;
88
88
  /**
@@ -98,7 +98,11 @@ export declare function analyzeDepthFrames(frames: Uint8Array[], width: number,
98
98
  * or stdDev < 0.02), returns the exact calibrated defaults.
99
99
  *
100
100
  * @param profile - DepthProfile from analyzeDepthFrames().
101
- * @returns DerivedParallaxParams with all values clamped to safe bounds.
101
+ * @returns DerivedEffectParams with all values clamped to safe bounds.
102
102
  */
103
- export declare function deriveParallaxParams(profile: DepthProfile): DerivedParallaxParams;
103
+ export declare function deriveEffectParams(profile: DepthProfile): DerivedEffectParams;
104
+ /** @deprecated Use DerivedEffectParams instead. */
105
+ export type DerivedParallaxParams = DerivedEffectParams;
106
+ /** @deprecated Use deriveEffectParams instead. */
107
+ export declare const deriveParallaxParams: typeof deriveEffectParams;
104
108
  //# sourceMappingURL=depth-analysis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"depth-analysis.d.ts","sourceRoot":"","sources":["../../src/depth-analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IAEb,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IAEX,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IAEZ,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IAEZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IAEZ,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAC;IAEvB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAyBD;;;;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kBAAkB,CAChC,MAAM,EAAE,UAAU,EAAE,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,YAAY,CAgFd;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,mBAAmB,CAwD7E;AAoKD,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACxD,kDAAkD;AAClD,eAAO,MAAM,oBAAoB,2BAAqB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parallax Renderer — GPU-accelerated depth-aware video parallax.
2
+ * Depth Effect Renderer — GPU-accelerated depth-aware video effects.
3
3
  *
4
4
  * Renders a single fullscreen quad textured with the source video
5
5
  * and a precomputed depth map using pure WebGL 2. A custom fragment
@@ -17,7 +17,7 @@
17
17
  * Reads raw depth (UNIT 2), writes filtered depth (UNIT 1) via FBO.
18
18
  * Runs at RVFC rate (~5fps, only when depth data changes).
19
19
  *
20
- * 2. **Parallax pass** — per-pixel depth-based displacement.
20
+ * 2. **Effect pass** — per-pixel depth-based displacement, blur, glow, color-shift.
21
21
  * Reads video (UNIT 0) + filtered depth (UNIT 1), renders to screen.
22
22
  * Runs at RAF rate (60-120fps).
23
23
  *
@@ -27,14 +27,17 @@
27
27
  *
28
28
  * ## Texture memory
29
29
  *
30
- * 3 textures total: 1 video (RGBA), 1 raw depth (R8), 1 filtered depth (R8).
30
+ * 7 textures total: 1 video (RGBA), 1 raw depth (R8), 1 filtered depth (R8),
31
+ * 4 curve LUTs (R8, 256×1 each: displacement, blur, glow, color-shift).
31
32
  * The raw depth texture is uploaded from CPU when depth changes (~5fps).
32
33
  * The filtered depth texture is rendered via FBO bilateral filter pass.
34
+ * The curve LUT textures are uploaded when the curve editor changes.
33
35
  */
34
36
  import type { QualityTier } from './quality';
35
37
  import { RendererBase } from './renderer-base';
38
+ import type { MediaSource } from './media-source';
36
39
  /** Configuration subset relevant to the parallax renderer. */
37
- export interface ParallaxRendererConfig {
40
+ export interface DepthEffectConfig {
38
41
  parallaxStrength: number;
39
42
  pomEnabled: boolean;
40
43
  pomSteps: number;
@@ -57,39 +60,79 @@ export interface ParallaxRendererConfig {
57
60
  verticalReduction?: number;
58
61
  dofStart?: number;
59
62
  dofStrength?: number;
63
+ /** Maximum blur radius in UV space, from blur channel params. */
64
+ blurRadius?: number;
65
+ /** Glow color [r, g, b] each 0-1. */
66
+ glowColor?: [number, number, number];
67
+ /** Glow spread radius in UV space. */
68
+ glowRadius?: number;
69
+ /** Glow edge softness (0-1). */
70
+ glowSoftness?: number;
71
+ /** Enable tilted focal plane blur (Scheimpflug simulation). */
72
+ tiltEnabled?: boolean;
73
+ /** Precomputed tan(fov/2) for pseudo-world reconstruction. */
74
+ tiltHalfTanFov?: number;
75
+ /** Blur ramp width in pseudo-world-space units. */
76
+ tiltTransitionWidth?: number;
77
+ /** Maximum blur intensity for tilted plane DOF (0-1). */
78
+ tiltPeakIntensity?: number;
60
79
  }
61
- export declare class ParallaxRenderer extends RendererBase {
80
+ export declare class DepthEffectRenderer extends RendererBase {
62
81
  private gl;
63
82
  private quadVao;
64
83
  private bilateralPass;
65
- private parallaxPass;
84
+ private effectPass;
66
85
  private readonly textures;
67
86
  private readonly videoSlot;
68
87
  private readonly filteredDepthSlot;
69
88
  private readonly rawDepthSlot;
89
+ private readonly displacementLutSlot;
90
+ private readonly blurLutSlot;
91
+ private readonly glowLutSlot;
92
+ private readonly colorShiftLutSlot;
70
93
  /** Resolved config with all optional shader params filled from defaults. */
71
- private readonly config;
94
+ private config;
72
95
  /**
73
96
  * Create the renderer and attach its canvas to the DOM.
74
97
  *
75
98
  * @param parent - The container element that the WebGL canvas is
76
99
  * appended to. The renderer sizes itself to fill this element.
77
- * @param config - Parallax-specific settings (strength, POM, overscan).
100
+ * @param config - Effect settings (strength, POM, overscan, glow, color-shift).
78
101
  * Optional shader parameters are merged with calibrated defaults.
79
102
  */
80
- constructor(parent: HTMLElement, config: ParallaxRendererConfig);
103
+ constructor(parent: HTMLElement, config: DepthEffectConfig);
81
104
  /**
82
105
  * Set up the scene: create video texture, depth textures + FBO, and
83
106
  * set static shader uniforms.
84
107
  *
85
- * Call this once after the video element and depth data are loaded.
108
+ * Call this once after the media source and depth data are loaded.
86
109
  *
87
- * @param video - The <video> element to sample color frames from.
88
- * Must already have metadata loaded (videoWidth/videoHeight set).
110
+ * @param source - The media source to sample color frames from.
111
+ * Must already have dimensions available (width/height set).
89
112
  * @param depthWidth - Width of the precomputed depth map (e.g. 512).
90
113
  * @param depthHeight - Height of the precomputed depth map (e.g. 512).
91
114
  */
92
- initialize(video: HTMLVideoElement, depthWidth: number, depthHeight: number): void;
115
+ initialize(source: MediaSource, depthWidth: number, depthHeight: number): void;
116
+ /**
117
+ * Update shader parameters at runtime without re-creating the renderer.
118
+ *
119
+ * Merges the provided partial config into the resolved config and
120
+ * re-uploads only the affected uniforms to the GPU. Safe to call
121
+ * from a store subscription on every slider change — no allocations,
122
+ * just a handful of `gl.uniform*` calls.
123
+ */
124
+ updateConfig(partial: Partial<DepthEffectConfig>): void;
125
+ /**
126
+ * Upload new curve LUT data to the GPU.
127
+ * Call this whenever the curve editor changes.
128
+ */
129
+ updateCurveLUTs(displacementLUT: Uint8Array | null, blurLUT: Uint8Array | null, glowLUT?: Uint8Array | null, colorShiftLUT?: Uint8Array | null, colorShiftParams?: {
130
+ hueShift: number;
131
+ saturation: number;
132
+ brightness: number;
133
+ tintStrength: number;
134
+ tintColor: [number, number, number];
135
+ }): void;
93
136
  /**
94
137
  * Create render passes and shared fullscreen quad VAO.
95
138
  *
@@ -97,6 +140,11 @@ export declare class ParallaxRenderer extends RendererBase {
97
140
  * cache. They share a single VAO for the fullscreen quad geometry.
98
141
  */
99
142
  private initGPUResources;
143
+ /**
144
+ * Upload a 256-entry curve LUT to a texture slot.
145
+ * Creates the texture on first call, updates via texSubImage2D thereafter.
146
+ */
147
+ private uploadLUT;
100
148
  /**
101
149
  * Main render loop — called every animation frame at display refresh rate.
102
150
  *
@@ -130,9 +178,9 @@ export declare class ParallaxRenderer extends RendererBase {
130
178
  protected disposeRenderer(): void;
131
179
  /** Rebuild GPU state after context restoration. */
132
180
  protected onContextRestored(): void;
133
- /** Dispose all textures via the registry (video, rawDepth, filteredDepth). */
181
+ /** Dispose all textures via the registry (video, rawDepth, filteredDepth, LUTs). */
134
182
  private disposeTextures;
135
183
  /** Dispose render passes and shared VAO. */
136
184
  private disposeGPUResources;
137
185
  }
138
- //# sourceMappingURL=parallax-renderer.d.ts.map
186
+ //# sourceMappingURL=depth-effect-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depth-effect-renderer.d.ts","sourceRoot":"","sources":["../../src/depth-effect-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAUH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAelD,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAE/B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,qCAAqC;IACrC,SAAS,CAAC,EAAE,CAAC,MAAM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eAAe,CACb,eAAe,EAAE,UAAU,GAAG,IAAI,EAClC,OAAO,EAAE,UAAU,GAAG,IAAI,EAC1B,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,EAC3B,aAAa,CAAC,EAAE,UAAU,GAAG,IAAI,EACjC,gBAAgB,CAAC,EAAE;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC,GACA,IAAI;IAwDP;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;;OAGG;IACH,OAAO,CAAC,SAAS;IAyBjB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;IA8C/B;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAqB9C;;;;;;OAMG;IACH,SAAS,CAAC,yBAAyB,IAAI,IAAI;IA0B3C,iCAAiC;IACjC,SAAS,CAAC,eAAe,IAAI,IAAI;IAYjC,mDAAmD;IACnD,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAwBnC,oFAAoF;IACpF,OAAO,CAAC,eAAe;IAOvB,4CAA4C;IAC5C,OAAO,CAAC,mBAAmB;CAmB5B"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Browser-based monocular depth estimation using Depth Anything v2 via ONNX Runtime Web.
3
+ *
4
+ * Runs inference on the main thread:
5
+ * - **WebGPU EP** (preferred): GPU-accelerated, ~200ms/frame on modern hardware.
6
+ * - **WASM EP** (fallback): Uses onnxruntime's built-in proxy worker for off-thread execution.
7
+ *
8
+ * A double-buffer pattern bridges async inference (~5fps) with the synchronous
9
+ * `readDepth()` contract that the renderer expects every frame at 60fps.
10
+ *
11
+ * @see ADR-014 for the architectural decision and rationale.
12
+ */
13
+ import type { TextureImageSource } from './media-source';
14
+ /** Progress information emitted during model download. */
15
+ export interface ModelDownloadProgress {
16
+ /** Bytes received so far. */
17
+ receivedBytes: number;
18
+ /** Total bytes (from Content-Length header), or null if unknown. */
19
+ totalBytes: number | null;
20
+ /** Download fraction 0–1 (0 if total is unknown). */
21
+ fraction: number;
22
+ /** Human-readable status label. */
23
+ label: string;
24
+ }
25
+ /** Callback invoked during model download with progress updates. */
26
+ export type OnModelProgress = (progress: ModelDownloadProgress) => void;
27
+ export declare class DepthEstimator {
28
+ private readonly depthWidth;
29
+ private readonly depthHeight;
30
+ private ort;
31
+ private session;
32
+ private inputName;
33
+ private outputName;
34
+ private frontBuffer;
35
+ private backBuffer;
36
+ private inferenceInFlight;
37
+ private readyResolve;
38
+ private readonly readyPromise;
39
+ private captureCanvas;
40
+ private captureCtx;
41
+ private disposed;
42
+ constructor(depthWidth: number, depthHeight: number);
43
+ /**
44
+ * Load the ONNX model and prepare the inference session.
45
+ *
46
+ * Downloads the model with progress tracking, then creates the ONNX
47
+ * session from the in-memory buffer. Tries WebGPU EP first
48
+ * (GPU-accelerated on main thread), falls back to WASM EP.
49
+ */
50
+ init(modelUrl: string, onProgress?: OnModelProgress): Promise<void>;
51
+ /** Wait for model loading and session creation to complete. */
52
+ waitUntilReady(): Promise<void>;
53
+ /**
54
+ * Submit a frame for depth estimation. Non-blocking.
55
+ *
56
+ * If a previous inference is still in-flight, the frame is silently
57
+ * dropped. This naturally throttles to the model's inference rate (~5fps),
58
+ * matching the precomputed depth cadence.
59
+ */
60
+ submitFrame(source: TextureImageSource): void;
61
+ /**
62
+ * Submit a single frame and wait for the result.
63
+ *
64
+ * Used for still images where we need depth before rendering starts.
65
+ */
66
+ submitFrameAndWait(source: TextureImageSource): Promise<Uint8Array>;
67
+ /** Return the latest available depth buffer. Always synchronous. */
68
+ getLatestDepth(): Uint8Array;
69
+ dispose(): void;
70
+ private runInference;
71
+ /**
72
+ * Convert RGBA ImageData → NCHW float32 tensor with ImageNet normalisation.
73
+ */
74
+ private preprocess;
75
+ /**
76
+ * Bilinear resize from model output dimensions → depth texture dimensions,
77
+ * normalise to full [0, 255] range, and write into `backBuffer`.
78
+ *
79
+ * Depth Anything v2 (like v1) outputs inverse depth (disparity-like):
80
+ * higher raw values = closer to camera. This matches the convention used
81
+ * by the precompute pipeline (`normalizeToUint8` in scripts/precompute-depth.ts),
82
+ * so no inversion is applied: 255 = nearest, 0 = farthest.
83
+ */
84
+ private postProcess;
85
+ }
86
+ /**
87
+ * Create and initialise a DepthEstimator.
88
+ *
89
+ * Returns a ready-to-use estimator. The front buffer starts as flat
90
+ * mid-gray (128) so the renderer can start immediately while the first
91
+ * real inference result arrives asynchronously.
92
+ *
93
+ * @param onProgress — Optional callback for download progress updates.
94
+ */
95
+ export declare function createDepthEstimator(modelUrl: string, depthWidth: number, depthHeight: number, onProgress?: OnModelProgress): Promise<DepthEstimator>;
96
+ //# sourceMappingURL=depth-estimator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depth-estimator.d.ts","sourceRoot":"","sources":["../../src/depth-estimator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMzD,0DAA0D;AAC1D,MAAM,WAAW,qBAAqB;IACpC,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oEAAoE;AACpE,MAAM,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAkCxE,qBAAa,cAAc;IA0BvB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAzB9B,OAAO,CAAC,GAAG,CAA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