@vincentt-xr/sdk 2.0.0-alpha.10 → 2.0.0-alpha.11
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/GROUNDING.md +90 -8
- package/dist/{CanonicalHeadFrame-D_0OzdB9.cjs → CanonicalHeadFrame-CZFvPzN_.cjs} +1 -1
- package/dist/{CanonicalHeadFrame-DdUqF6Fv.js → CanonicalHeadFrame-vn-jM9fG.js} +3 -3
- package/dist/{DebuggerUI-D-rcPa54.js → DebuggerUI-DDpU-nBF.js} +1 -1
- package/dist/{DebuggerUI-CVuV-VJ5.cjs → DebuggerUI-Db-1VtQJ.cjs} +1 -1
- package/dist/{FaceRetouch-C1AxBNex.js → FaceRetouch-D2xH5OpW.js} +4 -4
- package/dist/{FaceRetouch-D7kryDE6.cjs → FaceRetouch-DHhn1nSV.cjs} +1 -1
- package/dist/TextLabel-Ctp-a7g9.cjs +2 -0
- package/dist/{TextLabel-c9BCucOI.js → TextLabel-Dgt-uNN9.js} +312 -289
- package/dist/{bodyMaskMaterial-Cs2awskk.js → bodyMaskMaterial-C3aXItLo.js} +1 -1
- package/dist/{bodyMaskMaterial-CBWub5t_.cjs → bodyMaskMaterial-Q6rYywwW.cjs} +1 -1
- package/dist/{cache-2x3CUJuY.js → cache-C85JjyZA.js} +2 -2
- package/dist/{cache-DL1Dbz6k.cjs → cache-DFqZYsHC.cjs} +1 -1
- package/dist/components/ScreenImage/ScreenImage.d.ts +3 -0
- package/dist/components/ScreenShape/index.d.ts +3 -0
- package/dist/components/ScreenText/index.d.ts +4 -1
- package/dist/components/SegmentationOverlay/settings.d.ts +2 -2
- package/dist/components/TextLabel/TextLabel.d.ts +1 -1
- package/dist/{contexts-Y_FhdnIv.js → contexts-B5GODwuV.js} +2 -2
- package/dist/{contexts-DQc7zyqT.cjs → contexts-CSz9stBV.cjs} +1 -1
- package/dist/coordinates/index.d.ts +1 -1
- package/dist/coordinates/viewport.d.ts +10 -0
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui.cjs +1 -1
- package/dist/debug-ui.js +11 -11
- package/dist/{drawNormalizedCrop-DG3gtJxf.js → drawNormalizedCrop-BLfB484W.js} +5 -5
- package/dist/{drawNormalizedCrop-C4KFaRne.cjs → drawNormalizedCrop-DaGT5mZ5.cjs} +1 -1
- package/dist/entries/core.d.ts +1 -1
- package/dist/face-effects.cjs +1 -1
- package/dist/face-effects.js +17 -17
- package/dist/footage-input/index.d.ts +46 -0
- package/dist/{getFaceInfo-BzlwHMjX.cjs → getFaceInfo-BbcKq8PJ.cjs} +1 -1
- package/dist/{getFaceInfo-BafgGT27.js → getFaceInfo-D_tCSQC7.js} +1 -1
- package/dist/{index-DiIoHK_4.js → index-B9DdHE4u.js} +1 -1
- package/dist/{index-Dv3WnY9n.cjs → index-Bxb_UcfF.cjs} +3 -3
- package/dist/{index-iIQ9jBDb.js → index-CNt8esFO.js} +1 -1
- package/dist/{index-CKRN-xJp.js → index-CTqQJj5p.js} +1249 -1175
- package/dist/{index-BZoBxyLn.js → index-CXaj3tOT.js} +365 -360
- package/dist/{index-C-Mryx_u.cjs → index-CYwAL_d7.cjs} +1 -1
- package/dist/{index-ItufYyHH.cjs → index-CelqbDSR.cjs} +1 -1
- package/dist/{index-vr2ichWQ.js → index-D10O6vqR.js} +2 -2
- package/dist/{index-S3gqudT6.cjs → index-DIYaENN3.cjs} +1 -1
- package/dist/{index-CUldCMRl.js → index-DlP4xxaT.js} +1 -1
- package/dist/{index-D-4w34GO.cjs → index-DzdKBXGE.cjs} +1 -1
- package/dist/index-J3Qy6hi3.cjs +1 -0
- package/dist/{index-By_LCo2V.cjs → index-LC2Xs08E.cjs} +1 -1
- package/dist/{index-Cyk_VIZE.js → index-WkEZBuB4.js} +4 -4
- package/dist/instructions.cjs +1 -1
- package/dist/instructions.js +8 -8
- package/dist/{internal-Bb9ZXbpr.cjs → internal-DS8Pdlsm.cjs} +1 -1
- package/dist/{internal-Gt1wn6Z3.js → internal-TD4QhIry.js} +3 -3
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/{landmarks-BEjJXcnE.cjs → landmarks-BP6RbRHN.cjs} +1 -1
- package/dist/{landmarks-DtCAFV_m.js → landmarks-vLy5QKt6.js} +1 -1
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +40 -40
- package/dist/main.cjs +1 -1
- package/dist/main.js +234 -230
- package/dist/particles.cjs +1 -1
- package/dist/particles.js +5 -5
- package/dist/product.cjs +1 -1
- package/dist/product.js +2 -2
- package/dist/{providers-CEZQgz2s.cjs → providers-BRSbw214.cjs} +1 -1
- package/dist/{providers-CRuaD8bi.js → providers-DmJlgrDD.js} +3 -3
- package/dist/{renderGroups-BADrepA1.cjs → renderGroups-B0N58SIA.cjs} +1 -1
- package/dist/{renderGroups-CNB99dZ2.js → renderGroups-BcQYy_J2.js} +1 -1
- package/dist/{renderPasses-DgxUKn9b.cjs → renderPasses-Bt8k0dkm.cjs} +1 -1
- package/dist/{renderPasses-DuapJA6V.js → renderPasses-DIPTIU_x.js} +4 -4
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/screen2d/coordinates.d.ts +37 -0
- package/dist/{segmentation-BOZJdWFC.js → segmentation-CZs5aVvY.js} +1 -1
- package/dist/{segmentation-J8GoNBvP.cjs → segmentation-Cz7oeNcS.cjs} +1 -1
- package/dist/{selectors-QB2qsaxy.cjs → selectors-Bq6tSgOY.cjs} +1 -1
- package/dist/{selectors-BvJepq6H.js → selectors-K5JKCWxw.js} +1 -1
- package/dist/{session-BVX859as.cjs → session-3aCMNb8W.cjs} +1 -1
- package/dist/{session-Cz8aie4K.js → session-DHBNTyJJ.js} +1 -1
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +75 -75
- package/dist/{trigger-D9L4GPmQ.js → trigger-BwZ81ENx.js} +7 -7
- package/dist/{trigger-DZ9vU7jo.cjs → trigger-UjeJY5uh.cjs} +1 -1
- package/dist/{useBodies-BYzJpQ4L.js → useBodies-BMKHXAOL.js} +2 -2
- package/dist/{useBodies-Cxpmx6Bb.cjs → useBodies-CXomEo0i.cjs} +1 -1
- package/dist/{useFaceInfo-DlLRAVNw.cjs → useFaceInfo-BEMMiZxw.cjs} +1 -1
- package/dist/{useFaceInfo-BzEUj2OI.js → useFaceInfo-BNVdnprN.js} +4 -4
- package/dist/{useFaceResultReader-Cc4Qrutf.js → useFaceResultReader-B15wn6RB.js} +1 -1
- package/dist/{useFaceResultReader-D3jOQNKz.cjs → useFaceResultReader-D9qibKmm.cjs} +1 -1
- package/dist/{useIrisTracking-Bz4uLDa7.js → useIrisTracking-CYm-KDIZ.js} +10 -10
- package/dist/{useIrisTracking-DRGWgoNy.cjs → useIrisTracking-DExhnhlt.cjs} +1 -1
- package/dist/{useXRCapabilities-B1KLckqw.js → useXRCapabilities-ClWlG5_Y.js} +1 -1
- package/dist/{useXRCapabilities-CZlPUBjF.cjs → useXRCapabilities-D-EhcDzM.cjs} +1 -1
- package/dist/utils/useEditOverrides.d.ts +26 -0
- package/docs/api/face-info.mdx +1 -1
- package/docs/api/screen-space-coordinates.mdx +17 -9
- package/docs/api/session-lifecycle.mdx +29 -0
- package/package.json +1 -1
- package/settings.json +64 -13
- package/dist/TextLabel-XE0rQSDn.cjs +0 -2
- package/dist/index-Sho4F4it.cjs +0 -1
package/GROUNDING.md
CHANGED
|
@@ -48,6 +48,8 @@ so shared behavior stays reusable instead of duplicated in large components:
|
|
|
48
48
|
- `lib/debug-ui/screen-text-settings/` — panel orchestrator plus reusable
|
|
49
49
|
sections, controls, settings, styles, transform helpers, and types.
|
|
50
50
|
- `lib/render/` — render-group, render-pass, and layer-stack internals.
|
|
51
|
+
- `lib/footage-input/` — the page-local footage input `<XRProvider>` registers
|
|
52
|
+
when framed, for the Vincentt harness (not exported from any door).
|
|
51
53
|
- `lib/hand/`, `lib/screen-image/`, and `lib/screen-text/` — domain-level
|
|
52
54
|
primitives, presets, settings, and tests that used to live flat in `lib/`.
|
|
53
55
|
|
|
@@ -88,9 +90,31 @@ nothing to an app bundle.
|
|
|
88
90
|
"version": "2.0.0-alpha.9",
|
|
89
91
|
"components": {
|
|
90
92
|
"ScreenText": {
|
|
93
|
+
"element": "screenText",
|
|
91
94
|
"props": {
|
|
92
|
-
"fontSize": {
|
|
93
|
-
|
|
95
|
+
"fontSize": {
|
|
96
|
+
"type": "number",
|
|
97
|
+
"min": 1,
|
|
98
|
+
"step": 1,
|
|
99
|
+
"unit": "px",
|
|
100
|
+
"label": "Font size",
|
|
101
|
+
"supported": true
|
|
102
|
+
},
|
|
103
|
+
"letterSpacing": {
|
|
104
|
+
"type": "number",
|
|
105
|
+
"min": 0,
|
|
106
|
+
"max": 1,
|
|
107
|
+
"step": 0.01,
|
|
108
|
+
"unit": "ratio",
|
|
109
|
+
"label": "Letter spacing"
|
|
110
|
+
},
|
|
111
|
+
"screenTransform.position": {
|
|
112
|
+
"type": "vec2",
|
|
113
|
+
"step": 1,
|
|
114
|
+
"unit": "px",
|
|
115
|
+
"label": "Position",
|
|
116
|
+
"supported": true
|
|
117
|
+
}
|
|
94
118
|
}
|
|
95
119
|
}
|
|
96
120
|
}
|
|
@@ -105,6 +129,11 @@ nothing to an app bundle.
|
|
|
105
129
|
written in source. An `enum` lists its values in `enum`.
|
|
106
130
|
- `min`, `max`, `step` and `unit` (`px`, `m`, `deg`, `rad`, `ratio`) apply to
|
|
107
131
|
`number`, `vec2`, `vec3` and `euler`; `label` to any type.
|
|
132
|
+
- `element` puts a component on the editor's **supported list** as one list kind
|
|
133
|
+
(`screenText`, `screenImage`, `screenShape`), and `supported: true` marks the
|
|
134
|
+
settings the editor shows for it. The editor shows only supported settings on
|
|
135
|
+
listed components; a component without `element` is "made by code" there.
|
|
136
|
+
Declared settings without `supported` stay in the file for other tools.
|
|
108
137
|
|
|
109
138
|
Declared today: `ScreenText`, `TextLabel`, `ScreenSpaceUI` (`depth`),
|
|
110
139
|
`ScreenImage`, `ScreenShape`, `PersonCutout`, and the instruction components'
|
|
@@ -131,11 +160,49 @@ double-quoted. A tag on a shared props type (`TextLabelProps`,
|
|
|
131
160
|
`ScreenTransform2DSettings`) declares the setting for every exported component
|
|
132
161
|
that reaches it.
|
|
133
162
|
|
|
163
|
+
**SDK authors: put a component on the supported list with `@editorElement`** on
|
|
164
|
+
the component's own declaration: the list kind, then the dotted paths of the
|
|
165
|
+
settings the editor should show. Each path must be a `@tweak` setting that
|
|
166
|
+
component reaches.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
/**
|
|
170
|
+
* @editorElement screenShape transform.position transform.size transform.rotation settings.fillColor
|
|
171
|
+
*/
|
|
172
|
+
export const ScreenShape = (props: ScreenShapeProps) => {
|
|
173
|
+
/* ... */
|
|
174
|
+
};
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Listed today: `ScreenText` (`fontSize`, `color`, `screenTransform.position`,
|
|
178
|
+
`.size`, `.rotation`), `ScreenImage` (`transform.position`, `.size`,
|
|
179
|
+
`.rotation`) and `ScreenShape` (`transform.position`, `.size`, `.rotation`,
|
|
180
|
+
`settings.fillColor`).
|
|
181
|
+
|
|
134
182
|
`pnpm settings:generate` rewrites `settings.json`; commit the result. CI runs
|
|
135
183
|
`pnpm settings:check` and fails when the file does not match the tags or the
|
|
136
184
|
`package.json` version, so a version bump regenerates it too. The generator
|
|
137
185
|
also fails on a malformed tag, an unknown key or unit, a type that does not fit
|
|
138
|
-
the prop, and a `@tweak` that no exported component reaches.
|
|
186
|
+
the prop, and a `@tweak` that no exported component reaches. It also fails on
|
|
187
|
+
an `@editorElement` with an unknown kind, no settings, a path that is not a
|
|
188
|
+
`@tweak` setting of that component, a second tag on one component, or a tag
|
|
189
|
+
that is not on an exported component.
|
|
190
|
+
|
|
191
|
+
### Live preview of unsaved editor changes
|
|
192
|
+
|
|
193
|
+
In the console's visual editor, an unsaved change to `color` on `<ScreenText>`
|
|
194
|
+
or `<TextLabel>` shows in the running app at once. Its other changes show after
|
|
195
|
+
Save, which rebuilds the app. The editor's build defines a small override store
|
|
196
|
+
on the page, and those two components read it for `color`. Published and
|
|
197
|
+
preview builds have no store, so they render the props exactly as written.
|
|
198
|
+
App code does nothing for this and must not define or read
|
|
199
|
+
`__VCT_EDIT_OVERRIDES__`.
|
|
200
|
+
|
|
201
|
+
SDK authors: to make another prop live, add its name to the component's
|
|
202
|
+
`LIVE_EDITABLE` list (`lib/components/ScreenText/index.tsx`,
|
|
203
|
+
`lib/components/TextLabel/TextLabel.tsx`). The hook is
|
|
204
|
+
`useEditOverrides(props, keys)` in `lib/utils/useEditOverrides.ts`. Call it with
|
|
205
|
+
the component's own props object, before destructuring.
|
|
139
206
|
|
|
140
207
|
---
|
|
141
208
|
|
|
@@ -2646,18 +2713,22 @@ the greppable `FACE_BLENDSHAPE_NAMES` constant exported from
|
|
|
2646
2713
|
`@vincentt-xr/sdk/tracking`. This includes `eyeBlinkLeft`, `eyeBlinkRight`,
|
|
2647
2714
|
`eyeWideLeft`, `eyeWideRight`, and `jawOpen`; do not guess string names.
|
|
2648
2715
|
|
|
2649
|
-
Use `
|
|
2650
|
-
|
|
2651
|
-
|
|
2716
|
+
Use `normalizedToTransform2DPixels` with the tracker input/display viewport size
|
|
2717
|
+
to put a face landmark into a Screen Image/Text/Shape `transform.position`
|
|
2718
|
+
(`feedToTransform2D` is the same call for a feed point). It undoes the uniform,
|
|
2719
|
+
contain-fitted scale `resolveScreenTransform2D` applies, so the object sits on
|
|
2720
|
+
the landmark at every canvas aspect ratio; `normalizedToScreenPixels` stretches
|
|
2721
|
+
per axis and agrees with it only at 9:16. The tracker input is already the SDK
|
|
2722
|
+
feed; do not apply media cover/mirroring a second time.
|
|
2652
2723
|
Never mutate or mirror `FaceInfo.landmarks` in place, manually project them,
|
|
2653
2724
|
infer a persistent face ID, or copy numeric landmark indices/thresholds into
|
|
2654
2725
|
application code.
|
|
2655
2726
|
|
|
2656
2727
|
```ts
|
|
2657
|
-
const nose =
|
|
2728
|
+
const nose = normalizedToTransform2DPixels({
|
|
2658
2729
|
point: face.landmarks[FACE_LANDMARK_INDICES["face.noseTip"]],
|
|
2659
2730
|
viewportSize,
|
|
2660
|
-
});
|
|
2731
|
+
}); // → transform.position of a ScreenShape / ScreenText / ScreenImage
|
|
2661
2732
|
```
|
|
2662
2733
|
|
|
2663
2734
|
Effect House mapping: `FaceInfo.landmarks` replaces `pointsArray`, `bounds`
|
|
@@ -6634,6 +6705,7 @@ idle ──setMediaSource──> media-bound ──start──> running ──st
|
|
|
6634
6705
|
- **Camera constraints.** The webcam bind asks for 24–60 fps and `camRes` width; a camera that cannot promise the minimum (cheap, virtual or fake devices) is retried once with a soft frame-rate request, so a slow camera binds instead of failing with `OverconstrainedError` (which now reads as `unsupported` when even the relaxed request fails).
|
|
6635
6706
|
- **Visibility.** The session always retries `video.play()` when a hidden tab returns (iOS Safari pauses the camera track). `<XRProvider lifecycle={{ pauseWhenHidden: true }}>` additionally pauses the whole session while hidden and resumes on return; a session the app paused itself stays paused.
|
|
6636
6707
|
- `useXRLifecycle()` (`@vincentt-xr/sdk/low-level`) subscribes to the state: `"idle" | "media-bound" | "running" | "paused" | "stopped"`.
|
|
6708
|
+
- **Platform footage in a console frame (internal; apps need no code).** When the app runs framed (the Vincentt console's editor), `<XRProvider>` exposes a page-local footage input that the Vincentt harness drives so the creator can preview the app on platform sample clips and stills, or switch back to the camera. It is not an import and not an API to call: do not write footage-switching code, read it, or remove it. It only acts once the session is `running` (the app's own source binds first), the latest pick wins, and leaving the camera for footage stops the camera tracks. A top-level page, a published app opened directly and a phone never register it. To keep the app on its own input in the editor, open the harness console channel with `platformFootage: false` (a harness option, not an SDK prop).
|
|
6637
6709
|
|
|
6638
6710
|
Full contract and manual steps: `docs/api/session-lifecycle.mdx`; example: `/session-health`.
|
|
6639
6711
|
|
|
@@ -7416,6 +7488,16 @@ const placementRay = screenPointToRay({
|
|
|
7416
7488
|
- Use `normalizedToScreenPixels` / `screenPixelsToNormalized` for normalized
|
|
7417
7489
|
viewport coordinates with top-left origin — a feed point is one. They do not
|
|
7418
7490
|
undo the camera crop; `feedToSource` with the session's `FeedCrop` does.
|
|
7491
|
+
- **Two screen spaces.** The `*ScreenPixels` helpers stretch the 720 × 1280
|
|
7492
|
+
design canvas over each axis of the viewport (canvas-based primitives,
|
|
7493
|
+
`coordinateSpace="canvas"`). A `ScreenTransform2DSettings` (`ScreenShape`,
|
|
7494
|
+
`ScreenText`, `ScreenImage`, scene objects) is contain-fitted by
|
|
7495
|
+
`resolveScreenTransform2D`: one uniform scale, `screenTransform2DScale`, for
|
|
7496
|
+
its position and size. The two agree only at 9:16. To place a tracked point in
|
|
7497
|
+
a transform use `normalizedToTransform2DPixels` / `feedToTransform2D` (inverse
|
|
7498
|
+
`transform2DPixelsToNormalized`); to size it from viewport pixels use
|
|
7499
|
+
`viewportSizeToTransform2DPixels`. Mixing the stretching helpers into a
|
|
7500
|
+
transform drifts toward the centre on any other canvas (#345).
|
|
7419
7501
|
- Use `mediaToScreenPixels` / `screenPixelsToMedia` with the shared
|
|
7420
7502
|
`XRMediaLayout` for camera/image pixels. They apply cover/contain offsets,
|
|
7421
7503
|
scaling, and optional display mirroring; do not manually repeat that math.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const T=require("react/jsx-runtime"),I=require("react"),q=require("@react-three/fiber"),M=require("three"),l=require("./index-Sho4F4it.cjs"),w=require("./index-S3gqudT6.cjs"),G=require("./selectors-QB2qsaxy.cjs"),b=require("./similarityFit-BFqHND2e.cjs"),F=require("./useLandmarkPoseFit-Bg-h9BPb.cjs");function h(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const C=h(M),k=Float32Array.from([0,-3.4064,5.97951,0,-1.12686,7.4756,0,-2.08902,6.05827,-.46393,.95536,6.63358,0,-.46317,7.58658,0,.36567,7.24287,0,2.47326,5.78863,-4.25308,2.57765,3.2797,0,4.01904,5.28476,0,4.88598,5.38526,0,8.26178,4.48153,0,-3.70681,5.86492,0,-3.9183,5.56943,0,-3.99444,5.21948,0,-4.5424,5.40475,0,-4.74558,5.52946,0,-5.01957,5.60145,0,-5.36512,5.53544,0,-6.14962,5.07137,0,-1.50109,7.1122,-.41611,-1.46645,6.44766,-7.08796,5.4348,.09962,-2.62864,2.0359,3.84812,-3.19836,1.98582,3.79695,-3.77515,2.0394,3.64619,-4.46582,2.42295,3.15517,-2.16429,2.18987,3.85182,-3.20823,3.22393,4.11582,-2.6738,3.20534,4.0922,-3.74519,3.16529,3.97241,-4.16102,3.05907,3.71955,-5.06201,1.93442,2.77609,-2.26666,-7.42577,4.38981,-4.44586,2.66399,3.17342,-7.21453,2.26301,.07315,-5.79979,2.34955,2.20406,-2.84494,-.72087,4.43313,-.71145,-3.32935,5.87704,-.60603,-3.92456,5.44492,-1.43161,-3.50095,5.49619,-1.91491,-3.80315,5.02893,-1.13104,-3.97394,5.18965,-1.56355,-4.08276,4.84226,-2.65011,-5.00365,4.18848,-.42705,-1.09413,7.36053,-.4964,-.47566,7.44036,-5.25331,3.88158,3.36316,-1.7187,.97461,4.55836,-1.60863,-.94252,5.81419,-1.65127,-.61087,5.58132,-4.7655,-.70155,3.53463,-.47831,.29577,7.10101,-3.73496,4.50823,4.55045,-4.5886,4.30204,4.04848,-6.27933,6.61543,1.42585,-1.22094,4.14217,5.10603,-2.19349,3.10032,4.00058,-3.10264,-4.35298,4.09591,-6.71968,-4.78864,-1.7454,-1.19382,-1.30679,5.73775,-.72977,-1.59371,5.83321,-2.45621,-4.34262,4.28388,-2.20482,-4.30451,4.1625,-4.98589,4.80246,3.75198,-1.59229,-1.25771,5.45695,-2.64455,4.52465,4.92156,-2.76029,5.10097,5.01599,-3.52396,8.00598,3.72916,-5.59976,5.71547,2.72426,-3.06393,6.56614,4.52998,-5.72097,4.25458,2.83085,-6.37439,4.78559,1.59169,-.67273,-3.68802,5.7378,-1.26256,-3.78769,5.41778,-1.73255,-3.95277,5.00058,-1.04362,-1.46497,5.66246,-2.32123,-4.32907,4.25816,-2.05685,-4.47767,4.52088,-2.15308,-4.27632,4.03809,-.94687,-1.03525,6.51227,-1.46913,-4.03635,4.60491,-1.02434,-3.98985,4.92669,-.53342,-3.99322,5.1382,-.76972,-6.09539,4.98588,-.69961,-5.29185,5.4483,-.66969,-4.94977,5.50961,-.63095,-4.6951,5.44937,-.58322,-4.51798,5.33987,-1.53717,-4.42321,4.74547,-1.6156,-4.47594,4.81363,-1.72905,-4.61868,4.85446,-1.83862,-4.82875,4.82374,-2.36825,-3.10624,4.8681,-7.54224,-1.04928,-2.43132,0,-1.724,6.60139,-1.82661,-4.39953,4.39902,-1.92956,-4.41183,4.49705,-.59744,-2.01369,5.86646,-1.40563,-1.7142,5.24109,-.66245,-1.81932,5.86376,-2.34234,.57222,4.2943,-3.32732,.10486,4.11386,-1.72617,-.91916,5.27336,-5.1332,7.4856,2.66044,-4.53864,6.31991,3.68342,-3.98656,5.10949,4.46631,-2.16968,-5.44043,4.45587,-1.39563,5.01196,5.31603,-1.6195,6.59922,4.92111,-1.8914,8.23638,4.275,-4.19583,2.23521,3.3751,-5.73334,1.41174,2.43173,-1.85989,2.35576,3.84318,-4.98861,3.07465,3.08386,-1.30326,1.41645,4.83109,-1.30576,-.67278,6.41596,-6.46517,.93712,1.68987,-5.25866,.94581,2.97431,-4.43234,.7221,3.52261,-3.30068,.86164,3.87278,-2.43018,1.13149,4.03903,-1.82073,1.46795,4.22412,-.56322,2.30769,5.56679,-6.33814,-.52928,1.88118,-5.5877,3.20807,2.68784,-.24262,-1.46286,7.07149,-1.61125,.33933,4.89542,-7.74309,2.365,-2.00517,-1.39114,1.85105,4.449,-1.78579,-.97828,4.85047,-4.67096,2.66446,3.08407,-1.33397,-.28376,6.09705,-7.2709,-2.89092,-2.25245,-1.85643,2.58525,3.7579,-.92339,.07308,6.67194,-5.00059,-6.13513,1.89252,-5.08528,-7.17859,.71471,-7.15929,-.81182,-.07204,-5.84305,-5.24802,.92409,-6.84726,3.66292,.72469,-2.41294,-8.25885,4.11921,-.17991,-1.68986,6.5733,-2.10366,-.16395,4.56612,-6.40757,2.23602,1.56084,-3.67007,2.36015,3.63523,-3.17719,2.29427,3.7757,-2.19612,-4.59832,4.47979,-6.23488,-1.94443,1.66354,-1.29292,-9.29592,4.09406,-3.21065,-8.53328,2.802,-4.06893,-7.99311,1.92512,0,6.54539,5.02731,0,-9.40338,4.26449,-2.72403,2.3158,3.77715,-2.28846,2.39889,3.6976,-1.99831,2.49655,3.68915,-6.13004,3.39926,2.03852,-2.28846,2.8865,3.77503,-2.72403,2.96181,3.87177,-3.17719,2.96414,3.87697,-3.67007,2.92771,3.72432,-4.01839,2.85736,3.48298,-7.55581,4.10681,-.99192,-4.01839,2.4837,3.4409,0,-2.52194,5.93226,-1.77622,-2.68395,5.21312,-1.22224,-1.18244,5.95247,-.73149,-2.53668,5.81534,0,3.27103,5.23601,-4.13527,-6.99664,2.67197,-3.31181,-7.66081,3.38296,-1.3137,-8.63999,4.70246,-5.94052,-6.22363,-.63147,-1.99831,2.74384,3.74403,-.90145,1.23699,5.75426,0,-8.76524,4.89144,-2.30898,-8.9742,3.60907,-6.95415,-2.43984,-.13116,-1.09882,-4.45879,5.12073,-1.18112,-4.58,5.18956,-1.25582,-4.7879,5.23705,-1.32509,-5.10651,5.20501,-1.54639,-5.81939,4.75789,-1.95375,-4.18389,4.43171,-2.1178,-4.13709,4.5551,-2.28534,-4.0512,4.58244,-2.85016,-3.66572,4.48499,-5.27854,-2.23894,2.86122,-.94671,1.90763,5.19678,-1.31417,3.10491,4.2314,-1.78,2.86,3.88155,-1.84511,-4.09888,4.24726,-5.43619,-4.03048,2.10985,-.76644,3.18213,4.86145,-1.93862,-6.61441,4.52109,0,1.05941,6.7746,-.51657,1.58357,6.14836,0,1.72837,6.31675,-1.24681,.2303,5.68104,0,-7.94219,5.18117,0,-6.9915,5.15348,-.99783,-6.93092,4.97958,-3.28881,-5.38251,3.79575,-2.31163,-1.56624,4.59009,-2.68025,-6.11157,4.09615,-3.83293,-1.53733,4.13773,-2.96186,-2.27421,4.44094,-4.3869,-2.68329,3.64389,-1.2173,-7.83446,4.96929,-1.54237,-.13684,5.20101,-3.87838,-6.04176,3.31108,-3.08404,-6.80984,3.8142,-3.74732,-4.50354,3.72645,-6.09413,-3.20599,1.47348,-4.58899,-4.72873,2.98322,-6.58323,-3.94127,.07027,-3.49258,-3.19582,4.1302,-1.25554,.80234,5.30755,-1.12612,-.9336,6.53878,-1.44311,-1.14277,5.90513,-.92304,-.52904,7.00342,-1.75539,3.52912,4.3277,-2.63259,3.71383,4.36463,-3.38806,3.72198,4.30903,-4.07577,3.67541,4.07606,-4.62291,3.47469,3.64632,-5.17175,2.53575,2.67087,-7.29733,.76317,-.04877,-4.70683,1.651,3.10953,-4.07171,1.47682,3.47694,-3.26982,1.47066,3.73195,-2.52757,1.61731,3.86544,-1.97089,1.85851,3.96178,-1.57954,2.09794,4.085,-7.66418,.67313,-2.43587,-1.39704,-1.34014,5.63038,-.88484,.65874,6.23323,-.7671,-.96803,7.07793,-.46021,-1.33411,6.78745,-.74862,-1.06799,6.7983,-1.23641,-1.58557,5.48049,-.38731,-1.40999,6.95771,-.31993,-1.60793,6.50868,-1.63963,2.5563,3.86374,-1.25565,2.46714,4.2038,-1.03136,2.38266,4.61585,-4.25308,2.7723,3.3153,-4.53,2.91,3.33968,.46393,.95536,6.63358,4.25308,2.57765,3.2797,.41611,-1.46645,6.44766,7.08796,5.4348,.09962,2.62864,2.0359,3.84812,3.19836,1.98582,3.79695,3.77515,2.0394,3.64619,4.46582,2.42295,3.15517,2.16429,2.18987,3.85182,3.20823,3.22393,4.11582,2.6738,3.20534,4.0922,3.74519,3.16529,3.97241,4.16102,3.05907,3.71955,5.06201,1.93442,2.77609,2.26666,-7.42577,4.38981,4.44586,2.66399,3.17342,7.21453,2.26301,.07315,5.79979,2.34955,2.20406,2.84494,-.72087,4.43313,.71145,-3.32935,5.87704,.60603,-3.92456,5.44492,1.43161,-3.50095,5.49619,1.91491,-3.80315,5.02893,1.13104,-3.97394,5.18965,1.56355,-4.08276,4.84226,2.65011,-5.00365,4.18848,.42705,-1.09413,7.36053,.4964,-.47566,7.44036,5.25331,3.88158,3.36316,1.7187,.97461,4.55836,1.60863,-.94252,5.81419,1.65127,-.61087,5.58132,4.7655,-.70155,3.53463,.47831,.29577,7.10101,3.73496,4.50823,4.55045,4.5886,4.30204,4.04848,6.27933,6.61543,1.42585,1.22094,4.14217,5.10603,2.19349,3.10032,4.00058,3.10264,-4.35298,4.09591,6.71968,-4.78864,-1.7454,1.19382,-1.30679,5.73775,.72977,-1.59371,5.83321,2.45621,-4.34262,4.28388,2.20482,-4.30451,4.1625,4.98589,4.80246,3.75198,1.59229,-1.25771,5.45695,2.64455,4.52465,4.92156,2.76029,5.10097,5.01599,3.52396,8.00598,3.72916,5.59976,5.71547,2.72426,3.06393,6.56614,4.52998,5.72097,4.25458,2.83085,6.37439,4.78559,1.59169,.67273,-3.68802,5.7378,1.26256,-3.78769,5.41778,1.73255,-3.95277,5.00058,1.04362,-1.46497,5.66246,2.32123,-4.32907,4.25816,2.05685,-4.47767,4.52088,2.15308,-4.27632,4.03809,.94687,-1.03525,6.51227,1.46913,-4.03635,4.60491,1.02434,-3.98985,4.92669,.53342,-3.99322,5.1382,.76972,-6.09539,4.98588,.69961,-5.29185,5.4483,.66969,-4.94977,5.50961,.63095,-4.6951,5.44937,.58322,-4.51798,5.33987,1.53717,-4.42321,4.74547,1.6156,-4.47594,4.81363,1.72905,-4.61868,4.85446,1.83862,-4.82875,4.82374,2.36825,-3.10624,4.8681,7.54224,-1.04928,-2.43132,1.82661,-4.39953,4.39902,1.92956,-4.41183,4.49705,.59744,-2.01369,5.86646,1.40563,-1.7142,5.24109,.66245,-1.81932,5.86376,2.34234,.57222,4.2943,3.32732,.10486,4.11386,1.72617,-.91916,5.27336,5.1332,7.4856,2.66044,4.53864,6.31991,3.68342,3.98656,5.10949,4.46631,2.16968,-5.44043,4.45587,1.39563,5.01196,5.31603,1.6195,6.59922,4.92111,1.8914,8.23638,4.275,4.19583,2.23521,3.3751,5.73334,1.41174,2.43173,1.85989,2.35576,3.84318,4.98861,3.07465,3.08386,1.30326,1.41645,4.83109,1.30576,-.67278,6.41596,6.46517,.93712,1.68987,5.25866,.94581,2.97431,4.43234,.7221,3.52261,3.30068,.86164,3.87278,2.43018,1.13149,4.03903,1.82073,1.46795,4.22412,.56322,2.30769,5.56679,6.33814,-.52928,1.88118,5.5877,3.20807,2.68784,.24262,-1.46286,7.07149,1.61125,.33933,4.89542,7.74309,2.365,-2.00517,1.39114,1.85105,4.449,1.78579,-.97828,4.85047,4.67096,2.66446,3.08407,1.33397,-.28376,6.09705,7.2709,-2.89092,-2.25245,1.85643,2.58525,3.7579,.92339,.07308,6.67194,5.00059,-6.13513,1.89252,5.08528,-7.17859,.71471,7.15929,-.81182,-.07204,5.84305,-5.24802,.92409,6.84726,3.66292,.72469,2.41294,-8.25885,4.11921,.17991,-1.68986,6.5733,2.10366,-.16395,4.56612,6.40757,2.23602,1.56084,3.67007,2.36015,3.63523,3.17719,2.29427,3.7757,2.19612,-4.59832,4.47979,6.23488,-1.94443,1.66354,1.29292,-9.29592,4.09406,3.21065,-8.53328,2.802,4.06893,-7.99311,1.92512,2.72403,2.3158,3.77715,2.28846,2.39889,3.6976,1.99831,2.49655,3.68915,6.13004,3.39926,2.03852,2.28846,2.8865,3.77503,2.72403,2.96181,3.87177,3.17719,2.96414,3.87697,3.67007,2.92771,3.72432,4.01839,2.85736,3.48298,7.55581,4.10681,-.99192,4.01839,2.4837,3.4409,1.77622,-2.68395,5.21312,1.22224,-1.18244,5.95247,.73149,-2.53668,5.81534,4.13527,-6.99664,2.67197,3.31181,-7.66081,3.38296,1.3137,-8.63999,4.70246,5.94052,-6.22363,-.63147,1.99831,2.74384,3.74403,.90145,1.23699,5.75426,2.30898,-8.9742,3.60907,6.95415,-2.43984,-.13116,1.09882,-4.45879,5.12073,1.18112,-4.58,5.18956,1.25582,-4.7879,5.23705,1.32509,-5.10651,5.20501,1.54639,-5.81939,4.75789,1.95375,-4.18389,4.43171,2.1178,-4.13709,4.5551,2.28534,-4.0512,4.58244,2.85016,-3.66572,4.48499,5.27854,-2.23894,2.86122,.94671,1.90763,5.19678,1.31417,3.10491,4.2314,1.78,2.86,3.88155,1.84511,-4.09888,4.24726,5.43619,-4.03048,2.10985,.76644,3.18213,4.86145,1.93862,-6.61441,4.52109,.51657,1.58357,6.14836,1.24681,.2303,5.68104,.99783,-6.93092,4.97958,3.28881,-5.38251,3.79575,2.31163,-1.56624,4.59009,2.68025,-6.11157,4.09615,3.83293,-1.53733,4.13773,2.96186,-2.27421,4.44094,4.3869,-2.68329,3.64389,1.2173,-7.83446,4.96929,1.54237,-.13684,5.20101,3.87838,-6.04176,3.31108,3.08404,-6.80984,3.8142,3.74732,-4.50354,3.72645,6.09413,-3.20599,1.47348,4.58899,-4.72873,2.98322,6.58323,-3.94127,.07027,3.49258,-3.19582,4.1302,1.25554,.80234,5.30755,1.12612,-.9336,6.53878,1.44311,-1.14277,5.90513,.92304,-.52904,7.00342,1.75539,3.52912,4.3277,2.63259,3.71383,4.36463,3.38806,3.72198,4.30903,4.07577,3.67541,4.07606,4.62291,3.47469,3.64632,5.17175,2.53575,2.67087,7.29733,.76317,-.04877,4.70683,1.651,3.10953,4.07171,1.47682,3.47694,3.26982,1.47066,3.73195,2.52757,1.61731,3.86544,1.97089,1.85851,3.96178,1.57954,2.09794,4.085,7.66418,.67313,-2.43587,1.39704,-1.34014,5.63038,.88484,.65874,6.23323,.7671,-.96803,7.07793,.46021,-1.33411,6.78745,.74862,-1.06799,6.7983,1.23641,-1.58557,5.48049,.38731,-1.40999,6.95771,.31993,-1.60793,6.50868,1.63963,2.5563,3.86374,1.25565,2.46714,4.2038,1.03136,2.38266,4.61585,4.25308,2.7723,3.3153,4.53,2.91,3.33968]),N=[[1,0,-1.1269,7.4756],[4,0,-.4632,7.5866],[5,0,.3657,7.2429],[6,0,2.4733,5.7886],[8,0,4.019,5.2848],[9,0,4.886,5.3853],[10,0,8.2618,4.4815],[33,-4.4459,2.664,3.1734],[50,-4.7655,-.7016,3.5346],[67,-3.524,8.006,3.7292],[93,-7.5422,-1.0493,-2.4313],[103,-5.1332,7.4856,2.6604],[109,-1.8914,8.2364,4.275],[127,-7.7431,2.365,-2.0052],[133,-1.8564,2.5852,3.7579],[151,0,6.5454,5.0273],[168,0,3.271,5.236],[195,0,1.0594,6.7746],[197,0,1.7284,6.3167],[234,-7.6642,.6731,-2.4359],[263,4.4459,2.664,3.1734],[280,4.7655,-.7016,3.5346],[297,3.524,8.006,3.7292],[323,7.5422,-1.0493,-2.4313],[332,5.1332,7.4856,2.6604],[338,1.8914,8.2364,4.275],[356,7.7431,2.365,-2.0052],[362,1.8564,2.5852,3.7579],[454,7.6642,.6731,-2.4359],[463,1.6396,2.5563,3.8637],[243,-1.6396,2.5563,3.8637]],v=[0,-.46317,7.58658],_=Float64Array.from(N.flatMap(([,t,n,e])=>[t,n,e])),A=N.map(([t])=>t),j=(t,n)=>{const e=n??{scale:1,quaternion:new C.Quaternion,translation:new C.Vector3,rms:0,worldUnitsPerCm:1,count:0};return b.solveSimilarity(_,t,e),e.worldUnitsPerCm=e.scale,e.count=A.length,e},H=F.LANDMARK_POSE_FIT_DEFAULT_SMOOTHING,U={x:0,y:.5},W={x:1,y:.5},r=new C.Vector3,D=new C.Vector3,E=(t,{faceIndex:n,offset:e,smoothing:a=H,enabled:x=!0,onFit:P,onTrackingChange:g}={})=>{const s=w.useTrackerContext(),O=n??((s==null?void 0:s.type)==="face"?s.faceIndex:void 0)??0,c=G.useXRModelNode(l.XRModel.FACE_TRACKER),{camera:i}=q.useThree(),p=I.useCallback(d=>{var f,m;const u=(m=(f=c==null?void 0:c.detectionResults)==null?void 0:f.faceLandmarks)==null?void 0:m[O];if(!u||u.length<468)return!1;l.feedToWorld(U,i,r,0),l.feedToWorld(W,i,D,0);const y=r.distanceTo(D);for(let o=0;o<A.length;o+=1){const L=u[A[o]],R=-(L.z??0)*y;l.feedToWorld(L,i,r,R),d[o*3]=r.x,d[o*3+1]=r.y,d[o*3+2]=R}return!0},[i,O,c]);F.useLandmarkPoseFit(t,{canonical:_,readLive:p,offset:e,smoothing:a,enabled:x,onFit:P,onTrackingChange:g})},S=I.createContext(!1),K=({children:t,...n})=>{const e=I.useRef(null);return E(e,n),T.jsx(S.Provider,{value:!0,children:T.jsx("group",{ref:e,children:t})})};exports.CANONICAL_FACE_POSITIONS=k;exports.CANONICAL_HEAD_ANCHOR=v;exports.CANONICAL_HEAD_FIT_DEFAULT_SMOOTHING=H;exports.CANONICAL_RIGID_INDICES=A;exports.CANONICAL_RIGID_LANDMARKS=N;exports.CANONICAL_RIGID_POINTS=_;exports.CanonicalHeadFrame=K;exports.CanonicalHeadFrameContext=S;exports.solveCanonicalHeadPose=j;exports.useCanonicalHeadFit=E;
|
|
1
|
+
"use strict";const T=require("react/jsx-runtime"),I=require("react"),q=require("@react-three/fiber"),M=require("three"),l=require("./index-J3Qy6hi3.cjs"),w=require("./index-DIYaENN3.cjs"),G=require("./selectors-Bq6tSgOY.cjs"),b=require("./similarityFit-BFqHND2e.cjs"),F=require("./useLandmarkPoseFit-Bg-h9BPb.cjs");function h(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const C=h(M),k=Float32Array.from([0,-3.4064,5.97951,0,-1.12686,7.4756,0,-2.08902,6.05827,-.46393,.95536,6.63358,0,-.46317,7.58658,0,.36567,7.24287,0,2.47326,5.78863,-4.25308,2.57765,3.2797,0,4.01904,5.28476,0,4.88598,5.38526,0,8.26178,4.48153,0,-3.70681,5.86492,0,-3.9183,5.56943,0,-3.99444,5.21948,0,-4.5424,5.40475,0,-4.74558,5.52946,0,-5.01957,5.60145,0,-5.36512,5.53544,0,-6.14962,5.07137,0,-1.50109,7.1122,-.41611,-1.46645,6.44766,-7.08796,5.4348,.09962,-2.62864,2.0359,3.84812,-3.19836,1.98582,3.79695,-3.77515,2.0394,3.64619,-4.46582,2.42295,3.15517,-2.16429,2.18987,3.85182,-3.20823,3.22393,4.11582,-2.6738,3.20534,4.0922,-3.74519,3.16529,3.97241,-4.16102,3.05907,3.71955,-5.06201,1.93442,2.77609,-2.26666,-7.42577,4.38981,-4.44586,2.66399,3.17342,-7.21453,2.26301,.07315,-5.79979,2.34955,2.20406,-2.84494,-.72087,4.43313,-.71145,-3.32935,5.87704,-.60603,-3.92456,5.44492,-1.43161,-3.50095,5.49619,-1.91491,-3.80315,5.02893,-1.13104,-3.97394,5.18965,-1.56355,-4.08276,4.84226,-2.65011,-5.00365,4.18848,-.42705,-1.09413,7.36053,-.4964,-.47566,7.44036,-5.25331,3.88158,3.36316,-1.7187,.97461,4.55836,-1.60863,-.94252,5.81419,-1.65127,-.61087,5.58132,-4.7655,-.70155,3.53463,-.47831,.29577,7.10101,-3.73496,4.50823,4.55045,-4.5886,4.30204,4.04848,-6.27933,6.61543,1.42585,-1.22094,4.14217,5.10603,-2.19349,3.10032,4.00058,-3.10264,-4.35298,4.09591,-6.71968,-4.78864,-1.7454,-1.19382,-1.30679,5.73775,-.72977,-1.59371,5.83321,-2.45621,-4.34262,4.28388,-2.20482,-4.30451,4.1625,-4.98589,4.80246,3.75198,-1.59229,-1.25771,5.45695,-2.64455,4.52465,4.92156,-2.76029,5.10097,5.01599,-3.52396,8.00598,3.72916,-5.59976,5.71547,2.72426,-3.06393,6.56614,4.52998,-5.72097,4.25458,2.83085,-6.37439,4.78559,1.59169,-.67273,-3.68802,5.7378,-1.26256,-3.78769,5.41778,-1.73255,-3.95277,5.00058,-1.04362,-1.46497,5.66246,-2.32123,-4.32907,4.25816,-2.05685,-4.47767,4.52088,-2.15308,-4.27632,4.03809,-.94687,-1.03525,6.51227,-1.46913,-4.03635,4.60491,-1.02434,-3.98985,4.92669,-.53342,-3.99322,5.1382,-.76972,-6.09539,4.98588,-.69961,-5.29185,5.4483,-.66969,-4.94977,5.50961,-.63095,-4.6951,5.44937,-.58322,-4.51798,5.33987,-1.53717,-4.42321,4.74547,-1.6156,-4.47594,4.81363,-1.72905,-4.61868,4.85446,-1.83862,-4.82875,4.82374,-2.36825,-3.10624,4.8681,-7.54224,-1.04928,-2.43132,0,-1.724,6.60139,-1.82661,-4.39953,4.39902,-1.92956,-4.41183,4.49705,-.59744,-2.01369,5.86646,-1.40563,-1.7142,5.24109,-.66245,-1.81932,5.86376,-2.34234,.57222,4.2943,-3.32732,.10486,4.11386,-1.72617,-.91916,5.27336,-5.1332,7.4856,2.66044,-4.53864,6.31991,3.68342,-3.98656,5.10949,4.46631,-2.16968,-5.44043,4.45587,-1.39563,5.01196,5.31603,-1.6195,6.59922,4.92111,-1.8914,8.23638,4.275,-4.19583,2.23521,3.3751,-5.73334,1.41174,2.43173,-1.85989,2.35576,3.84318,-4.98861,3.07465,3.08386,-1.30326,1.41645,4.83109,-1.30576,-.67278,6.41596,-6.46517,.93712,1.68987,-5.25866,.94581,2.97431,-4.43234,.7221,3.52261,-3.30068,.86164,3.87278,-2.43018,1.13149,4.03903,-1.82073,1.46795,4.22412,-.56322,2.30769,5.56679,-6.33814,-.52928,1.88118,-5.5877,3.20807,2.68784,-.24262,-1.46286,7.07149,-1.61125,.33933,4.89542,-7.74309,2.365,-2.00517,-1.39114,1.85105,4.449,-1.78579,-.97828,4.85047,-4.67096,2.66446,3.08407,-1.33397,-.28376,6.09705,-7.2709,-2.89092,-2.25245,-1.85643,2.58525,3.7579,-.92339,.07308,6.67194,-5.00059,-6.13513,1.89252,-5.08528,-7.17859,.71471,-7.15929,-.81182,-.07204,-5.84305,-5.24802,.92409,-6.84726,3.66292,.72469,-2.41294,-8.25885,4.11921,-.17991,-1.68986,6.5733,-2.10366,-.16395,4.56612,-6.40757,2.23602,1.56084,-3.67007,2.36015,3.63523,-3.17719,2.29427,3.7757,-2.19612,-4.59832,4.47979,-6.23488,-1.94443,1.66354,-1.29292,-9.29592,4.09406,-3.21065,-8.53328,2.802,-4.06893,-7.99311,1.92512,0,6.54539,5.02731,0,-9.40338,4.26449,-2.72403,2.3158,3.77715,-2.28846,2.39889,3.6976,-1.99831,2.49655,3.68915,-6.13004,3.39926,2.03852,-2.28846,2.8865,3.77503,-2.72403,2.96181,3.87177,-3.17719,2.96414,3.87697,-3.67007,2.92771,3.72432,-4.01839,2.85736,3.48298,-7.55581,4.10681,-.99192,-4.01839,2.4837,3.4409,0,-2.52194,5.93226,-1.77622,-2.68395,5.21312,-1.22224,-1.18244,5.95247,-.73149,-2.53668,5.81534,0,3.27103,5.23601,-4.13527,-6.99664,2.67197,-3.31181,-7.66081,3.38296,-1.3137,-8.63999,4.70246,-5.94052,-6.22363,-.63147,-1.99831,2.74384,3.74403,-.90145,1.23699,5.75426,0,-8.76524,4.89144,-2.30898,-8.9742,3.60907,-6.95415,-2.43984,-.13116,-1.09882,-4.45879,5.12073,-1.18112,-4.58,5.18956,-1.25582,-4.7879,5.23705,-1.32509,-5.10651,5.20501,-1.54639,-5.81939,4.75789,-1.95375,-4.18389,4.43171,-2.1178,-4.13709,4.5551,-2.28534,-4.0512,4.58244,-2.85016,-3.66572,4.48499,-5.27854,-2.23894,2.86122,-.94671,1.90763,5.19678,-1.31417,3.10491,4.2314,-1.78,2.86,3.88155,-1.84511,-4.09888,4.24726,-5.43619,-4.03048,2.10985,-.76644,3.18213,4.86145,-1.93862,-6.61441,4.52109,0,1.05941,6.7746,-.51657,1.58357,6.14836,0,1.72837,6.31675,-1.24681,.2303,5.68104,0,-7.94219,5.18117,0,-6.9915,5.15348,-.99783,-6.93092,4.97958,-3.28881,-5.38251,3.79575,-2.31163,-1.56624,4.59009,-2.68025,-6.11157,4.09615,-3.83293,-1.53733,4.13773,-2.96186,-2.27421,4.44094,-4.3869,-2.68329,3.64389,-1.2173,-7.83446,4.96929,-1.54237,-.13684,5.20101,-3.87838,-6.04176,3.31108,-3.08404,-6.80984,3.8142,-3.74732,-4.50354,3.72645,-6.09413,-3.20599,1.47348,-4.58899,-4.72873,2.98322,-6.58323,-3.94127,.07027,-3.49258,-3.19582,4.1302,-1.25554,.80234,5.30755,-1.12612,-.9336,6.53878,-1.44311,-1.14277,5.90513,-.92304,-.52904,7.00342,-1.75539,3.52912,4.3277,-2.63259,3.71383,4.36463,-3.38806,3.72198,4.30903,-4.07577,3.67541,4.07606,-4.62291,3.47469,3.64632,-5.17175,2.53575,2.67087,-7.29733,.76317,-.04877,-4.70683,1.651,3.10953,-4.07171,1.47682,3.47694,-3.26982,1.47066,3.73195,-2.52757,1.61731,3.86544,-1.97089,1.85851,3.96178,-1.57954,2.09794,4.085,-7.66418,.67313,-2.43587,-1.39704,-1.34014,5.63038,-.88484,.65874,6.23323,-.7671,-.96803,7.07793,-.46021,-1.33411,6.78745,-.74862,-1.06799,6.7983,-1.23641,-1.58557,5.48049,-.38731,-1.40999,6.95771,-.31993,-1.60793,6.50868,-1.63963,2.5563,3.86374,-1.25565,2.46714,4.2038,-1.03136,2.38266,4.61585,-4.25308,2.7723,3.3153,-4.53,2.91,3.33968,.46393,.95536,6.63358,4.25308,2.57765,3.2797,.41611,-1.46645,6.44766,7.08796,5.4348,.09962,2.62864,2.0359,3.84812,3.19836,1.98582,3.79695,3.77515,2.0394,3.64619,4.46582,2.42295,3.15517,2.16429,2.18987,3.85182,3.20823,3.22393,4.11582,2.6738,3.20534,4.0922,3.74519,3.16529,3.97241,4.16102,3.05907,3.71955,5.06201,1.93442,2.77609,2.26666,-7.42577,4.38981,4.44586,2.66399,3.17342,7.21453,2.26301,.07315,5.79979,2.34955,2.20406,2.84494,-.72087,4.43313,.71145,-3.32935,5.87704,.60603,-3.92456,5.44492,1.43161,-3.50095,5.49619,1.91491,-3.80315,5.02893,1.13104,-3.97394,5.18965,1.56355,-4.08276,4.84226,2.65011,-5.00365,4.18848,.42705,-1.09413,7.36053,.4964,-.47566,7.44036,5.25331,3.88158,3.36316,1.7187,.97461,4.55836,1.60863,-.94252,5.81419,1.65127,-.61087,5.58132,4.7655,-.70155,3.53463,.47831,.29577,7.10101,3.73496,4.50823,4.55045,4.5886,4.30204,4.04848,6.27933,6.61543,1.42585,1.22094,4.14217,5.10603,2.19349,3.10032,4.00058,3.10264,-4.35298,4.09591,6.71968,-4.78864,-1.7454,1.19382,-1.30679,5.73775,.72977,-1.59371,5.83321,2.45621,-4.34262,4.28388,2.20482,-4.30451,4.1625,4.98589,4.80246,3.75198,1.59229,-1.25771,5.45695,2.64455,4.52465,4.92156,2.76029,5.10097,5.01599,3.52396,8.00598,3.72916,5.59976,5.71547,2.72426,3.06393,6.56614,4.52998,5.72097,4.25458,2.83085,6.37439,4.78559,1.59169,.67273,-3.68802,5.7378,1.26256,-3.78769,5.41778,1.73255,-3.95277,5.00058,1.04362,-1.46497,5.66246,2.32123,-4.32907,4.25816,2.05685,-4.47767,4.52088,2.15308,-4.27632,4.03809,.94687,-1.03525,6.51227,1.46913,-4.03635,4.60491,1.02434,-3.98985,4.92669,.53342,-3.99322,5.1382,.76972,-6.09539,4.98588,.69961,-5.29185,5.4483,.66969,-4.94977,5.50961,.63095,-4.6951,5.44937,.58322,-4.51798,5.33987,1.53717,-4.42321,4.74547,1.6156,-4.47594,4.81363,1.72905,-4.61868,4.85446,1.83862,-4.82875,4.82374,2.36825,-3.10624,4.8681,7.54224,-1.04928,-2.43132,1.82661,-4.39953,4.39902,1.92956,-4.41183,4.49705,.59744,-2.01369,5.86646,1.40563,-1.7142,5.24109,.66245,-1.81932,5.86376,2.34234,.57222,4.2943,3.32732,.10486,4.11386,1.72617,-.91916,5.27336,5.1332,7.4856,2.66044,4.53864,6.31991,3.68342,3.98656,5.10949,4.46631,2.16968,-5.44043,4.45587,1.39563,5.01196,5.31603,1.6195,6.59922,4.92111,1.8914,8.23638,4.275,4.19583,2.23521,3.3751,5.73334,1.41174,2.43173,1.85989,2.35576,3.84318,4.98861,3.07465,3.08386,1.30326,1.41645,4.83109,1.30576,-.67278,6.41596,6.46517,.93712,1.68987,5.25866,.94581,2.97431,4.43234,.7221,3.52261,3.30068,.86164,3.87278,2.43018,1.13149,4.03903,1.82073,1.46795,4.22412,.56322,2.30769,5.56679,6.33814,-.52928,1.88118,5.5877,3.20807,2.68784,.24262,-1.46286,7.07149,1.61125,.33933,4.89542,7.74309,2.365,-2.00517,1.39114,1.85105,4.449,1.78579,-.97828,4.85047,4.67096,2.66446,3.08407,1.33397,-.28376,6.09705,7.2709,-2.89092,-2.25245,1.85643,2.58525,3.7579,.92339,.07308,6.67194,5.00059,-6.13513,1.89252,5.08528,-7.17859,.71471,7.15929,-.81182,-.07204,5.84305,-5.24802,.92409,6.84726,3.66292,.72469,2.41294,-8.25885,4.11921,.17991,-1.68986,6.5733,2.10366,-.16395,4.56612,6.40757,2.23602,1.56084,3.67007,2.36015,3.63523,3.17719,2.29427,3.7757,2.19612,-4.59832,4.47979,6.23488,-1.94443,1.66354,1.29292,-9.29592,4.09406,3.21065,-8.53328,2.802,4.06893,-7.99311,1.92512,2.72403,2.3158,3.77715,2.28846,2.39889,3.6976,1.99831,2.49655,3.68915,6.13004,3.39926,2.03852,2.28846,2.8865,3.77503,2.72403,2.96181,3.87177,3.17719,2.96414,3.87697,3.67007,2.92771,3.72432,4.01839,2.85736,3.48298,7.55581,4.10681,-.99192,4.01839,2.4837,3.4409,1.77622,-2.68395,5.21312,1.22224,-1.18244,5.95247,.73149,-2.53668,5.81534,4.13527,-6.99664,2.67197,3.31181,-7.66081,3.38296,1.3137,-8.63999,4.70246,5.94052,-6.22363,-.63147,1.99831,2.74384,3.74403,.90145,1.23699,5.75426,2.30898,-8.9742,3.60907,6.95415,-2.43984,-.13116,1.09882,-4.45879,5.12073,1.18112,-4.58,5.18956,1.25582,-4.7879,5.23705,1.32509,-5.10651,5.20501,1.54639,-5.81939,4.75789,1.95375,-4.18389,4.43171,2.1178,-4.13709,4.5551,2.28534,-4.0512,4.58244,2.85016,-3.66572,4.48499,5.27854,-2.23894,2.86122,.94671,1.90763,5.19678,1.31417,3.10491,4.2314,1.78,2.86,3.88155,1.84511,-4.09888,4.24726,5.43619,-4.03048,2.10985,.76644,3.18213,4.86145,1.93862,-6.61441,4.52109,.51657,1.58357,6.14836,1.24681,.2303,5.68104,.99783,-6.93092,4.97958,3.28881,-5.38251,3.79575,2.31163,-1.56624,4.59009,2.68025,-6.11157,4.09615,3.83293,-1.53733,4.13773,2.96186,-2.27421,4.44094,4.3869,-2.68329,3.64389,1.2173,-7.83446,4.96929,1.54237,-.13684,5.20101,3.87838,-6.04176,3.31108,3.08404,-6.80984,3.8142,3.74732,-4.50354,3.72645,6.09413,-3.20599,1.47348,4.58899,-4.72873,2.98322,6.58323,-3.94127,.07027,3.49258,-3.19582,4.1302,1.25554,.80234,5.30755,1.12612,-.9336,6.53878,1.44311,-1.14277,5.90513,.92304,-.52904,7.00342,1.75539,3.52912,4.3277,2.63259,3.71383,4.36463,3.38806,3.72198,4.30903,4.07577,3.67541,4.07606,4.62291,3.47469,3.64632,5.17175,2.53575,2.67087,7.29733,.76317,-.04877,4.70683,1.651,3.10953,4.07171,1.47682,3.47694,3.26982,1.47066,3.73195,2.52757,1.61731,3.86544,1.97089,1.85851,3.96178,1.57954,2.09794,4.085,7.66418,.67313,-2.43587,1.39704,-1.34014,5.63038,.88484,.65874,6.23323,.7671,-.96803,7.07793,.46021,-1.33411,6.78745,.74862,-1.06799,6.7983,1.23641,-1.58557,5.48049,.38731,-1.40999,6.95771,.31993,-1.60793,6.50868,1.63963,2.5563,3.86374,1.25565,2.46714,4.2038,1.03136,2.38266,4.61585,4.25308,2.7723,3.3153,4.53,2.91,3.33968]),N=[[1,0,-1.1269,7.4756],[4,0,-.4632,7.5866],[5,0,.3657,7.2429],[6,0,2.4733,5.7886],[8,0,4.019,5.2848],[9,0,4.886,5.3853],[10,0,8.2618,4.4815],[33,-4.4459,2.664,3.1734],[50,-4.7655,-.7016,3.5346],[67,-3.524,8.006,3.7292],[93,-7.5422,-1.0493,-2.4313],[103,-5.1332,7.4856,2.6604],[109,-1.8914,8.2364,4.275],[127,-7.7431,2.365,-2.0052],[133,-1.8564,2.5852,3.7579],[151,0,6.5454,5.0273],[168,0,3.271,5.236],[195,0,1.0594,6.7746],[197,0,1.7284,6.3167],[234,-7.6642,.6731,-2.4359],[263,4.4459,2.664,3.1734],[280,4.7655,-.7016,3.5346],[297,3.524,8.006,3.7292],[323,7.5422,-1.0493,-2.4313],[332,5.1332,7.4856,2.6604],[338,1.8914,8.2364,4.275],[356,7.7431,2.365,-2.0052],[362,1.8564,2.5852,3.7579],[454,7.6642,.6731,-2.4359],[463,1.6396,2.5563,3.8637],[243,-1.6396,2.5563,3.8637]],v=[0,-.46317,7.58658],_=Float64Array.from(N.flatMap(([,t,n,e])=>[t,n,e])),A=N.map(([t])=>t),j=(t,n)=>{const e=n??{scale:1,quaternion:new C.Quaternion,translation:new C.Vector3,rms:0,worldUnitsPerCm:1,count:0};return b.solveSimilarity(_,t,e),e.worldUnitsPerCm=e.scale,e.count=A.length,e},H=F.LANDMARK_POSE_FIT_DEFAULT_SMOOTHING,U={x:0,y:.5},W={x:1,y:.5},r=new C.Vector3,D=new C.Vector3,E=(t,{faceIndex:n,offset:e,smoothing:a=H,enabled:x=!0,onFit:P,onTrackingChange:g}={})=>{const s=w.useTrackerContext(),O=n??((s==null?void 0:s.type)==="face"?s.faceIndex:void 0)??0,c=G.useXRModelNode(l.XRModel.FACE_TRACKER),{camera:i}=q.useThree(),p=I.useCallback(d=>{var f,m;const u=(m=(f=c==null?void 0:c.detectionResults)==null?void 0:f.faceLandmarks)==null?void 0:m[O];if(!u||u.length<468)return!1;l.feedToWorld(U,i,r,0),l.feedToWorld(W,i,D,0);const y=r.distanceTo(D);for(let o=0;o<A.length;o+=1){const L=u[A[o]],R=-(L.z??0)*y;l.feedToWorld(L,i,r,R),d[o*3]=r.x,d[o*3+1]=r.y,d[o*3+2]=R}return!0},[i,O,c]);F.useLandmarkPoseFit(t,{canonical:_,readLive:p,offset:e,smoothing:a,enabled:x,onFit:P,onTrackingChange:g})},S=I.createContext(!1),K=({children:t,...n})=>{const e=I.useRef(null);return E(e,n),T.jsx(S.Provider,{value:!0,children:T.jsx("group",{ref:e,children:t})})};exports.CANONICAL_FACE_POSITIONS=k;exports.CANONICAL_HEAD_ANCHOR=v;exports.CANONICAL_HEAD_FIT_DEFAULT_SMOOTHING=H;exports.CANONICAL_RIGID_INDICES=A;exports.CANONICAL_RIGID_LANDMARKS=N;exports.CANONICAL_RIGID_POINTS=_;exports.CanonicalHeadFrame=K;exports.CanonicalHeadFrameContext=S;exports.solveCanonicalHeadPose=j;exports.useCanonicalHeadFit=E;
|
|
@@ -2,9 +2,9 @@ import { jsx as _ } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback as H, useRef as S, createContext as g } from "react";
|
|
3
3
|
import { useThree as h } from "@react-three/fiber";
|
|
4
4
|
import * as l from "three";
|
|
5
|
-
import { j as w, n as d } from "./index-
|
|
6
|
-
import { u as P } from "./index-
|
|
7
|
-
import { b as y } from "./selectors-
|
|
5
|
+
import { j as w, n as d } from "./index-CTqQJj5p.js";
|
|
6
|
+
import { u as P } from "./index-D10O6vqR.js";
|
|
7
|
+
import { b as y } from "./selectors-K5JKCWxw.js";
|
|
8
8
|
import { s as M } from "./similarityFit-Bbz-R8AY.js";
|
|
9
9
|
import { L as k, u as v } from "./useLandmarkPoseFit-Bmb3h6Mw.js";
|
|
10
10
|
const Y = /* @__PURE__ */ Float32Array.from([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as u } from "react/jsx-runtime";
|
|
2
2
|
import { useState as k, useEffect as w } from "react";
|
|
3
3
|
import { createPortal as R } from "react-dom";
|
|
4
|
-
import { f as i } from "./internal-
|
|
4
|
+
import { f as i } from "./internal-TD4QhIry.js";
|
|
5
5
|
const v = {
|
|
6
6
|
position: "fixed",
|
|
7
7
|
top: "10px",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),M=require("react-dom"),s=require("./internal-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),M=require("react-dom"),s=require("./internal-DS8Pdlsm.cjs"),b={position:"fixed",top:"10px",left:"10px",zIndex:9999,fontFamily:"'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace",fontSize:"12px",color:"#fff",pointerEvents:"auto",userSelect:"none"},j={background:"rgba(0, 0, 0, 0.85)",borderRadius:"6px",padding:"12px 16px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.5)",backdropFilter:"blur(10px)",border:"1px solid rgba(255, 255, 255, 0.1)",minWidth:"240px"},z={...j,padding:"8px 12px",minWidth:"auto"},k={display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",paddingBottom:"8px",borderBottom:"1px solid rgba(255, 255, 255, 0.2)"},R={fontSize:"13px",fontWeight:"bold",color:"#00ff9f",letterSpacing:"0.5px",textTransform:"uppercase"},N={display:"flex",gap:"6px"},g={background:"rgba(255, 255, 255, 0.1)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"4px",color:"#fff",padding:"4px 8px",fontSize:"11px",cursor:"pointer",transition:"all 0.2s"},w={display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"},i={display:"flex",flexDirection:"column",gap:"4px"},o={fontSize:"10px",color:"rgba(255, 255, 255, 0.6)",textTransform:"uppercase",letterSpacing:"0.5px"},a={fontSize:"16px",fontWeight:"bold",color:"#fff"},m={...a,color:"#00ff9f"},h={...a,color:"#ffaa00"},y={...a,color:"#ff4444"},l={fontSize:"11px",color:"rgba(255, 255, 255, 0.5)",marginLeft:"4px"},D={width:"100%",height:"4px",background:"rgba(255, 255, 255, 0.2)",borderRadius:"2px",overflow:"hidden",marginTop:"4px"},I=t=>({width:`${t}%`,height:"100%",background:t>90?"#ff4444":t>70?"#ffaa00":"#00ff9f",transition:"width 0.3s ease, background 0.3s ease"}),B={fontSize:"9px",color:"rgba(255, 255, 255, 0.4)",marginTop:"8px",textAlign:"center",fontStyle:"italic"};function c(t,n){return n==="fps"?t>=30?m:t>=20?h:y:t<=40?m:t<=60?h:y}const E={...b,position:"static",top:"auto",left:"auto",zIndex:"auto"};function U({metrics:t,collapsed:n,onCollapse:v,onClose:S,position:p="top-left",keyboardShortcut:T="ctrl+shift+d",docked:d=!1}){const[x,C]=u.useState(null);if(u.useEffect(()=>{if(d)return;const r=document.createElement("div");return r.id="xr-debugger-overlay",document.body.appendChild(r),C(r),()=>{document.body.removeChild(r)}},[d]),!d&&!x)return null;const P={...b,...p==="top-right"&&{left:"auto",right:"10px"},...p==="bottom-left"&&{top:"auto",bottom:"10px"},...p==="bottom-right"&&{top:"auto",bottom:"10px",left:"auto",right:"10px"}},f=e.jsx("div",{style:d?E:P,children:e.jsxs("div",{style:n?z:j,children:[e.jsxs("div",{style:k,children:[e.jsx("div",{style:R,children:n?"AR Debugger":"AR Performance"}),e.jsxs("div",{style:N,children:[e.jsx("button",{style:g,onClick:()=>v(!n),onMouseEnter:r=>{r.currentTarget.style.background="rgba(255, 255, 255, 0.2)"},onMouseLeave:r=>{r.currentTarget.style.background="rgba(255, 255, 255, 0.1)"},children:n?"+":"−"}),e.jsx("button",{style:g,onClick:S,onMouseEnter:r=>{r.currentTarget.style.background="rgba(255, 255, 255, 0.2)"},onMouseLeave:r=>{r.currentTarget.style.background="rgba(255, 255, 255, 0.1)"},children:"✕"})]})]}),!n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:w,children:[e.jsxs("div",{style:i,children:[e.jsx("div",{style:o,children:"Camera FPS"}),e.jsxs("div",{children:[e.jsx("span",{style:c(t.cameraFPS,"fps"),children:s.formatNumber(t.cameraFPS,0)}),e.jsx("span",{style:l,children:"fps"})]})]}),e.jsxs("div",{style:i,children:[e.jsx("div",{style:o,children:"Resolution"}),e.jsx("span",{style:a,children:t.resolution})]}),e.jsxs("div",{style:i,children:[e.jsx("div",{style:o,children:"Detection"}),e.jsxs("div",{children:[e.jsx("span",{style:c(t.detectionTime,"time"),children:s.formatNumber(t.detectionTime,1)}),e.jsx("span",{style:l,children:"ms"})]})]}),e.jsxs("div",{style:i,children:[e.jsx("div",{style:o,children:"Rendering"}),e.jsxs("div",{children:[e.jsx("span",{style:c(t.renderTime,"time"),children:s.formatNumber(t.renderTime,1)}),e.jsx("span",{style:l,children:"ms"})]})]}),e.jsxs("div",{style:i,children:[e.jsx("div",{style:o,children:"Effective FPS"}),e.jsxs("div",{children:[e.jsx("span",{style:c(t.effectiveFPS,"fps"),children:s.formatNumber(t.effectiveFPS,0)}),e.jsx("span",{style:l,children:"fps"})]})]}),e.jsxs("div",{style:i,children:[e.jsx("div",{style:o,children:"Memory"}),t.memory?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("span",{style:a,children:s.formatNumber(t.memory.used,0)}),e.jsxs("span",{style:l,children:["/ ",s.formatNumber(t.memory.total,0)," MB"]})]}),e.jsx("div",{style:D,children:e.jsx("div",{style:I(t.memory.percentage)})})]}):e.jsx("span",{style:a,children:"N/A"})]})]}),t.modelPerformance.length>0&&e.jsx(e.Fragment,{children:e.jsxs("div",{style:{borderTop:"1px solid rgba(255, 255, 255, 0.15)",marginTop:"12px",paddingTop:"12px"},children:[e.jsx("div",{style:o,children:"Model Performance"}),e.jsx("div",{style:{marginTop:"8px",display:"flex",flexDirection:"column",gap:"6px"},children:t.modelPerformance.map((r,F)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"11px"},children:[e.jsx("span",{style:{color:"rgba(255, 255, 255, 0.7)"},children:r.name}),e.jsxs("div",{children:[e.jsx("span",{style:c(r.processingTime,"time"),children:s.formatNumber(r.processingTime,1)}),e.jsx("span",{style:l,children:"ms"})]})]},F))})]})}),e.jsxs("div",{style:B,children:["Press ",T.toUpperCase()," to toggle"]})]})]})});return d?f:M.createPortal(f,x)}exports.DebuggerUI=U;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { F as v, a as q, b as B, c as N, d as J, e as d, f as R } from "./renderPasses-
|
|
1
|
+
import { F as v, a as q, b as B, c as N, d as J, e as d, f as R } from "./renderPasses-DIPTIU_x.js";
|
|
2
2
|
import * as S from "three";
|
|
3
3
|
import { jsx as _, jsxs as ge } from "react/jsx-runtime";
|
|
4
4
|
import { useMemo as M, useEffect as Q } from "react";
|
|
5
|
-
import { j as fe } from "./index-
|
|
6
|
-
import { u as be } from "./landmarks-
|
|
5
|
+
import { j as fe } from "./index-CTqQJj5p.js";
|
|
6
|
+
import { u as be } from "./landmarks-vLy5QKt6.js";
|
|
7
7
|
import { F as ve, r as Se, a as ye } from "./renderState-CJNmj5jz.js";
|
|
8
8
|
import { useThree as ke, useFrame as xe } from "@react-three/fiber";
|
|
9
|
-
import { c as Ee } from "./selectors-
|
|
9
|
+
import { c as Ee } from "./selectors-K5JKCWxw.js";
|
|
10
10
|
import { f as Me } from "./FaceSurface-DmP9AEeC.js";
|
|
11
11
|
import { c as Re, d as we } from "./landmarkMask-DHivVjJm.js";
|
|
12
12
|
const ht = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const i=require("./renderPasses-DgxUKn9b.cjs"),xe=require("three"),M=require("react/jsx-runtime"),_=require("react"),Ce=require("./index-Sho4F4it.cjs"),Le=require("./landmarks-BEjJXcnE.cjs"),Y=require("./renderState-apSfg4eR.cjs"),oe=require("@react-three/fiber"),we=require("./selectors-QB2qsaxy.cjs"),Ie=require("./FaceSurface-CHAMEeG1.cjs"),re=require("./landmarkMask-CvN-L5NT.cjs");function Pe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const f=Pe(xe),Oe=[{label:"Wireframe",value:i.FACE_MESH_MATERIAL_TYPES.wireframe},{label:"Basic",value:i.FACE_MESH_MATERIAL_TYPES.basic},{label:"Standard",value:i.FACE_MESH_MATERIAL_TYPES.standard},{label:"Physical",value:i.FACE_MESH_MATERIAL_TYPES.physical},{label:"Toon",value:i.FACE_MESH_MATERIAL_TYPES.toon},{label:"Normal",value:i.FACE_MESH_MATERIAL_TYPES.normal},{label:"Matcap",value:i.FACE_MESH_MATERIAL_TYPES.matcap},{label:"Shader",value:i.FACE_MESH_MATERIAL_TYPES.shader}],De=[{label:"Original Face",value:i.FACE_MESH_SHADER_PRESETS.originalFace},{label:"Composite",value:i.FACE_MESH_SHADER_PRESETS.composite}],Ue=[{label:"Front",value:i.FACE_MESH_SIDES.front},{label:"Back",value:i.FACE_MESH_SIDES.back},{label:"Double",value:i.FACE_MESH_SIDES.double}],Ne=[{label:"None",value:i.FACE_MESH_TEXTURE_MAPS.none},{label:"UV Map 1",value:i.FACE_MESH_TEXTURE_MAPS.canonical},{label:"UV Map 2",value:i.FACE_MESH_TEXTURE_MAPS.style2}],He=[{label:"None",value:i.FACE_MESH_ALPHA_MAPS.none},{label:"Default Mask",value:i.FACE_MESH_ALPHA_MAPS.canonical}],Be=[{label:"Solid",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.solid},{label:"Gradient",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.gradient},{label:"Image URL",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.imageUrl},{label:"Media URL",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.mediaUrl}],Xe=[{label:"Normal",value:i.FACE_MESH_BLEND_MODES.normal},{label:"Add",value:i.FACE_MESH_BLEND_MODES.add},{label:"Subtract",value:i.FACE_MESH_BLEND_MODES.subtract},{label:"Multiply",value:i.FACE_MESH_BLEND_MODES.multiply},{label:"Screen",value:i.FACE_MESH_BLEND_MODES.screen},{label:"Overlay",value:i.FACE_MESH_BLEND_MODES.overlay},{label:"Soft Light",value:i.FACE_MESH_BLEND_MODES.softLight},{label:"Hard Light",value:i.FACE_MESH_BLEND_MODES.hardLight},{label:"Lighten",value:i.FACE_MESH_BLEND_MODES.lighten},{label:"Darken",value:i.FACE_MESH_BLEND_MODES.darken},{label:"Difference",value:i.FACE_MESH_BLEND_MODES.difference},{label:"Exclusion",value:i.FACE_MESH_BLEND_MODES.exclusion}],ie=["both","left","right"],le=["shader","image"],ce={eye:"both",mode:"shader",color:"#4fa3ff",textureUrl:"",tintImage:!1,scale:1,opacity:.85,targetFps:0,smoothing:0,leadMs:80,mirrored:!1,faceIndex:0,holdMs:250},Ke=[{key:"eye",label:"Eye",type:"select",options:ie.map(e=>({label:e,value:e}))},{key:"mode",label:"Material",type:"select",options:le.map(e=>({label:e,value:e}))},{key:"color",label:"Color / tint",type:"color"},{key:"textureUrl",label:"Image URL (image mode)",type:"text"},{key:"tintImage",label:"Tint image with color",type:"boolean"},{key:"scale",label:"Scale (× iris radius)",type:"number",min:.2,max:4,step:.05},{key:"opacity",label:"Opacity",type:"number",min:0,max:1,step:.05},{key:"targetFps",label:"Face FPS (0 = session)",type:"number",min:0,max:60,step:1},{key:"smoothing",label:"Smoothing (0 = raw)",type:"number",min:0,max:60,step:1},{key:"leadMs",label:"Lead between samples (ms)",type:"number",min:0,max:200,step:10},{key:"mirrored",label:"Mirror material",type:"boolean"},{key:"faceIndex",label:"Face index",type:"number",min:0,max:3,step:1},{key:"holdMs",label:"Hold (ms)",type:"number",min:0,max:1e3,step:10}],Ge=e=>({...ce,...e}),Ye=(e,t)=>({...e,...t}),je=["lips","contour","blush","highlighter","eyeshadow","eyeliner","brows"],O=["matte","satin","gloss","shimmer","metallic","glitter"],ze=["both","left","right"],ue=["lips","blush","contour","highlighter","brows"],D={matte:{shine:0,sparkleDensity:0,sparkleSize:.25},satin:{shine:.3,sparkleDensity:0,sparkleSize:.25},gloss:{shine:.8,sparkleDensity:0,sparkleSize:.25},shimmer:{shine:.5,sparkleDensity:.6,sparkleSize:.25},metallic:{shine:.7,sparkleDensity:0,sparkleSize:.25},glitter:{shine:.7,sparkleDensity:.35,sparkleSize:.8}},me=["shine","sparkleDensity","sparkleSize"],P=[.1,1.5],T={lips:{nude:"#b9826f",rosewood:"#9e5a5a",mauve:"#a0606e",softPink:"#d88a95",coral:"#e0645a",peach:"#e8907a",classicRed:"#a3202d",brick:"#8e3b2c",berry:"#7b2846",plum:"#5e2a45",wine:"#5a1a28",chocolate:"#5b3a2e"},contour:{fair:"#c9a08a",light:"#b48a72",medium:"#98705a",tan:"#7f5a45",deep:"#5e4032",rich:"#432c22",bronzeLight:"#b9805a",bronzeDeep:"#8a5532"},blush:{softPink:"#e8a0a8",rose:"#d97a85",peach:"#f0a07c",coral:"#ec7b67",apricot:"#f2a86b",mauve:"#c0828f",berry:"#b04a68",brick:"#b4574a",terracotta:"#c4694c",plum:"#8f4a68"},highlighter:{pearl:"#f6eee6",champagne:"#f2dcc0",gold:"#e9c27a",roseGold:"#eab3a0",bronzeGlow:"#d29a66",lilacPearl:"#e6d6ef"},eyeshadow:{ivory:"#f3e6d3",champagne:"#e9d2b0",sand:"#d2b48c",taupe:"#8f7a6e",warmBrown:"#8b5a3c",coolBrown:"#6e5a50",espresso:"#3e2a22",charcoal:"#3a3a3c",black:"#141414",bronze:"#a8743f",copper:"#b5653a",gold:"#d4ae5a",roseGold:"#d49a8a",plum:"#6b3a5a",burgundy:"#6e2433",olive:"#6f6a3a",navy:"#23314f",emerald:"#1f6b52",teal:"#1f6f73",lilac:"#b8a0cf",silver:"#c5c7cb"},eyeliner:{black:"#0d0d0d",brownBlack:"#231a16",brown:"#4a3226",charcoal:"#33343a",navy:"#1c2848",plum:"#4f2442",emerald:"#145a44",bronze:"#8a5a2e",gold:"#c9a14e",white:"#f5f3ef"},brows:{blonde:"#a88a62",taupe:"#7c6a5c",softBrown:"#6b4f3c",mediumBrown:"#57402f",darkBrown:"#3d2c22",softBlack:"#252020",auburn:"#7a4030",grey:"#8a8580"}},v=e=>Object.keys(T[e]),pe={lips:v("lips"),contour:v("contour"),blush:v("blush"),highlighter:v("highlighter"),eyeshadow:v("eyeshadow"),eyeliner:v("eyeliner"),brows:v("brows")},U=e=>ue.includes(e),z=(e,t)=>typeof t=="string"&&Object.prototype.hasOwnProperty.call(T[e],t),se=(e,t)=>t==="custom"||t==="auto"&&U(e)||z(e,t);function de(e,t){return t==="auto"?U(e)?"auto":void 0:z(e,t)?T[e][t]:void 0}const w=e=>{const t=e.trim().toLowerCase(),o=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);return o?`#${o[1]}${o[1]}${o[2]}${o[2]}${o[3]}${o[3]}`:t},We=(e,t)=>Object.values(T[e]).some(o=>w(o)===t),he=(e,t,o,r,n)=>{const a=se(e,t),s=a?t:se(e,r)?r:"custom",l=typeof o=="string"&&o.trim()?o.trim():void 0;if(s==="custom")return{shade:s,color:l??n};const u=s==="auto"?n:de(e,s)??n;if(l!==void 0){const c=w(l),g=a&&(We(e,c)||c===w(n));if(c!==w(u)&&!g)return{shade:"custom",color:l}}return{shade:s,color:u}},W=e=>{const t=e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase();return t[0].toUpperCase()+t.slice(1)},Se=e=>[{label:"Custom color",value:"custom"},...U(e)?[{label:"Auto (own color)",value:"auto"}]:[],...pe[e].map(t=>({label:W(t),value:t}))],V=["lipstick","gloss","matte","tint","metallic","gradient","shimmer","glitter"],ge=["texture","solid"],Ee=["outward","vertical","horizontal"],fe={enabled:!0,preset:"custom",shade:"custom",maskMode:"outer-and-inner-lips",colorMode:"texture",color:"#e85d75",opacity:.8,coverage:.8,finish:"satin",...D.satin,sparkleColor:"",intensity:1,shading:1,gloss:.35,roughness:.5,highlightColor:"#ffffff",gradientColor:"#ffd6de",gradientAmount:0,gradientDirection:"outward",edgeSoftness:.12,innerLipColor:"#7a1f36",innerLipAmount:0,innerLipWidth:.35,splitLips:!1,lowerLipColor:"#e85d75",lowerLipOpacity:.8,textureScaleX:1,textureScaleY:1,textureOffsetX:0,textureOffsetY:0,textureRotation:0,textureFlipX:!1,textureFlipY:!1},q={lipstick:{finish:"satin",coverage:.85,color:"#c0304f",opacity:.85,intensity:1,shading:1,gloss:.35,roughness:.5,highlightColor:"#ffffff",gradientAmount:0},gloss:{finish:"gloss",coverage:.45,color:"#e05a7a",opacity:.7,intensity:1,shading:1,gloss:.95,roughness:.12,highlightColor:"#ffffff",gradientAmount:0},matte:{finish:"matte",coverage:.95,color:"#a8323e",opacity:.92,intensity:1,shading:1,gloss:0,roughness:1,highlightColor:"#ffffff",gradientAmount:0},tint:{finish:"matte",coverage:.3,color:"#ff6b81",opacity:.4,intensity:1,shading:1,gloss:.1,roughness:.7,highlightColor:"#ffffff",gradientAmount:0},metallic:{finish:"metallic",coverage:.9,color:"#b5485a",opacity:.9,intensity:1,shading:1,gloss:1,roughness:.3,highlightColor:"#f3c46b",gradientAmount:0},gradient:{finish:"satin",coverage:.8,color:"#d6336c",opacity:.8,intensity:1,shading:1,gloss:.3,roughness:.5,highlightColor:"#ffffff",gradientColor:"#f9c2cf",gradientAmount:.85,gradientDirection:"outward"},shimmer:{finish:"shimmer",coverage:.7,color:"#c8577a",opacity:.8,intensity:1,shading:1,gloss:.4,roughness:.45,highlightColor:"#ffffff",gradientAmount:0},glitter:{finish:"glitter",coverage:.5,color:"#b8406a",opacity:.8,intensity:1,shading:1,gloss:.5,roughness:.35,highlightColor:"#ffffff",gradientAmount:0}},$=e=>typeof e=="string"&&V.includes(e),p=(e,t,o,r)=>typeof e=="number"&&Number.isFinite(e)?Math.min(o,Math.max(t,e)):r,Ve=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,x=(e,t)=>typeof e=="string"&&e.trim()?e:t,qe=(e,t)=>typeof e=="string"?e.trim():t,C=(e,t)=>typeof e=="boolean"?e:t,K=(e,t,o)=>typeof t=="string"&&e.includes(t)?t:o,$e=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),be=(e={})=>{const t=$(e.preset)?e.preset:"custom",o=$e(e),r={...fe,...t==="custom"?{}:q[t]},n=K(O,o.finish,r.finish),a={...r,...D[n]},s={...a,...o},{shade:l,color:u}=he("lips",o.shade,o.color,a.shade,a.color);return{enabled:C(s.enabled,a.enabled),preset:t,shade:l,maskMode:s.maskMode==="outer-lips"?"outer-lips":"outer-and-inner-lips",colorMode:K(ge,s.colorMode,a.colorMode),color:u,opacity:p(s.opacity,0,1,a.opacity),coverage:p(s.coverage,0,1,a.coverage),finish:n,shine:p(s.shine,0,1,a.shine),sparkleDensity:p(s.sparkleDensity,0,1,a.sparkleDensity),sparkleSize:p(s.sparkleSize,...P,a.sparkleSize),sparkleColor:qe(s.sparkleColor,a.sparkleColor),intensity:p(s.intensity,0,1,a.intensity),shading:p(s.shading,0,1,a.shading),gloss:p(s.gloss,0,1,a.gloss),roughness:p(s.roughness,0,1,a.roughness),highlightColor:x(s.highlightColor,a.highlightColor),gradientColor:x(s.gradientColor,a.gradientColor),gradientAmount:p(s.gradientAmount,0,1,a.gradientAmount),gradientDirection:K(Ee,s.gradientDirection,a.gradientDirection),edgeSoftness:p(s.edgeSoftness,0,1,a.edgeSoftness),innerLipColor:x(s.innerLipColor,a.innerLipColor),innerLipAmount:p(s.innerLipAmount,0,1,a.innerLipAmount),innerLipWidth:p(s.innerLipWidth,0,1,a.innerLipWidth),splitLips:C(s.splitLips,a.splitLips),lowerLipColor:x(s.lowerLipColor,a.lowerLipColor),lowerLipOpacity:p(s.lowerLipOpacity,0,1,a.lowerLipOpacity),textureScaleX:p(s.textureScaleX,.05,20,a.textureScaleX),textureScaleY:p(s.textureScaleY,.05,20,a.textureScaleY),textureOffsetX:p(s.textureOffsetX,-2,2,a.textureOffsetX),textureOffsetY:p(s.textureOffsetY,-2,2,a.textureOffsetY),textureRotation:Ve(s.textureRotation,a.textureRotation),textureFlipX:C(s.textureFlipX,a.textureFlipX),textureFlipY:C(s.textureFlipY,a.textureFlipY)}},Ze=(e,t)=>{const o=Object.keys(e).some(a=>t[a]===void 0),r=Object.fromEntries(Object.entries(t).filter(([a,s])=>s!==void 0&&(o||s!==e[a]))),n={...e};if(r.preset!==e.preset&&$(r.preset)&&Object.assign(n,q[r.preset]),Object.assign(n,r),n.finish!==e.finish&&O.includes(n.finish)){Object.assign(n,D[n.finish]);for(const a of me)r[a]!==void 0&&(n[a]=r[a])}return r.color===void 0?n.shade!=="custom"&&delete n.color:r.shade===void 0&&r.color!==e.color&&(n.shade="custom"),be(n)},d={min:0,max:1,step:.01},Je=[{key:"enabled",label:"On",type:"boolean"},{key:"preset",label:"Preset",type:"select",options:[{label:"Custom",value:"custom"},...V.map(e=>({label:e[0].toUpperCase()+e.slice(1),value:e}))]},{key:"shade",label:"Shade",type:"select",options:Se("lips")},{key:"maskMode",label:"Mask mode",type:"select",options:[{label:"Outer + inner lips (mouth cut out)",value:"outer-and-inner-lips"},{label:"Outer lips (mouth included)",value:"outer-lips"}]},{key:"colorMode",label:"Color mode",type:"select",options:[{label:"Design texture",value:"texture"},{label:"Procedural (solid / gradient)",value:"solid"}]},{key:"color",label:"Tint color",type:"color"},{key:"opacity",label:"Opacity",type:"number",...d},{key:"coverage",label:"Coverage (sheer → opaque)",type:"number",...d},{key:"finish",label:"Finish",type:"select",options:O.map(e=>({label:W(e),value:e}))},{key:"shine",label:"Shine",type:"number",...d},{key:"sparkleColor",label:"Sparkle color (blank = from shade)",type:"text"},{key:"sparkleDensity",label:"Sparkle density",type:"number",...d},{key:"sparkleSize",label:"Sparkle size (mm)",type:"number",min:P[0],max:P[1],step:.05},{key:"intensity",label:"Tint intensity",type:"number",...d},{key:"shading",label:"Follow light (0 = flat)",type:"number",...d},{key:"gloss",label:"Gloss",type:"number",...d},{key:"roughness",label:"Roughness",type:"number",...d},{key:"highlightColor",label:"Highlight color",type:"color"},{key:"gradientColor",label:"Gradient color",type:"color"},{key:"gradientAmount",label:"Gradient amount",type:"number",...d},{key:"gradientDirection",label:"Gradient direction",type:"select",options:[{label:"Mouth line → outer edge",value:"outward"},{label:"Bottom → top",value:"vertical"},{label:"Person's right → left corner",value:"horizontal"}]},{key:"edgeSoftness",label:"Edge softness",type:"number",...d},{key:"innerLipColor",label:"Inner lip color",type:"color"},{key:"innerLipAmount",label:"Inner lip amount",type:"number",...d},{key:"innerLipWidth",label:"Inner lip width",type:"number",...d},{key:"splitLips",label:"Separate lower lip",type:"boolean"},{key:"lowerLipColor",label:"Lower lip color",type:"color"},{key:"lowerLipOpacity",label:"Lower lip opacity",type:"number",...d},{key:"textureScaleX",label:"Texture scale X",type:"number",min:.1,max:10,step:.05},{key:"textureScaleY",label:"Texture scale Y",type:"number",min:.1,max:10,step:.05},{key:"textureOffsetX",label:"Texture offset X",type:"number",min:-1,max:1,step:.01},{key:"textureOffsetY",label:"Texture offset Y",type:"number",min:-1,max:1,step:.01},{key:"textureRotation",label:"Texture rotation°",type:"number",min:-180,max:180,step:1},{key:"textureFlipX",label:"Flip horizontal",type:"boolean"},{key:"textureFlipY",label:"Flip vertical",type:"boolean"}],Qe=(e,t,o=new f.Matrix3)=>{const r=(t.minU+t.maxU)/2,n=(t.minV+t.maxV)/2,a=t.maxU-t.minU,s=t.maxV-t.minV,l=-f.MathUtils.degToRad(e.textureRotation),u=Math.cos(l),c=Math.sin(l),g=(e.textureFlipX?-1:1)/Math.max(e.textureScaleX,.001),h=(e.textureFlipY?-1:1)/Math.max(e.textureScaleY,.001),S=g*u,b=-g*c,m=h*c,y=h*u,k=r+e.textureOffsetX*a,B=n+e.textureOffsetY*s,te=r-(S*k+b*B),X=n-(m*k+y*B);return o.set(S,b,te,m,y,X,0,0,1)},et=["eachOther","photo","canonicalTexture","faceTexture"],Z=["natural","keepColors","raw"],F={preset:"natural",matchSkinTone:1,matchLighting:1,edgeMatch:1,edgeSoftness:1.2,edgeInset:.3,ownEyes:!0,ownMouth:!0,featureSoftness:.25,detail:1,smoothing:.35,amount:1},N={natural:{matchSkinTone:1,matchLighting:1,edgeMatch:1,edgeSoftness:1.2,ownEyes:!0,ownMouth:!0,detail:1},keepColors:{matchSkinTone:0,matchLighting:.7,edgeMatch:1,edgeSoftness:1},raw:{matchSkinTone:0,matchLighting:0,edgeMatch:0,edgeSoftness:.4}},J=e=>typeof e=="string"&&Z.includes(e),ve=e=>_e(e)?"keepColors":"natural",_e=e=>{var t;return(e==null?void 0:e.kind)==="canonicalTexture"||(e==null?void 0:e.kind)==="faceTexture"&&((t=e.face)==null?void 0:t.kind)==="canonical"},ye=.1,ke=(e,t,o,r)=>typeof e=="number"&&Number.isFinite(e)?Math.min(o,Math.max(t,e)):r,ne=(e,t)=>typeof e=="boolean"?e:t,tt=(e,t,o)=>typeof t=="string"&&e.includes(t)?t:o,Q=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),R={matchSkinTone:[0,1],matchLighting:[0,1],edgeMatch:[0,1],edgeSoftness:[.3,3],edgeInset:[0,1.5],featureSoftness:[.1,.6],detail:[0,1],smoothing:[0,1],amount:[0,1]},Me=(e,t)=>Object.entries(N[t]).every(([o,r])=>e[o]===r),j=(e={},t={})=>{const o=e.preset??ve(t.source),r=J(o)?o:"custom",n={...F,..._e(t.source)?{featureSoftness:ye}:{},...r==="custom"?{}:N[r]},a={...n,...Q(e)},s=R,l=c=>ke(a[c],s[c][0],s[c][1],n[c]),u={preset:r,matchSkinTone:l("matchSkinTone"),matchLighting:l("matchLighting"),edgeMatch:l("edgeMatch"),edgeSoftness:l("edgeSoftness"),edgeInset:l("edgeInset"),ownEyes:ne(a.ownEyes,n.ownEyes),ownMouth:ne(a.ownMouth,n.ownMouth),featureSoftness:l("featureSoftness"),detail:l("detail"),smoothing:l("smoothing"),amount:l("amount")};return r!=="custom"&&!Me(u,r)&&(u.preset="custom"),u},at=(e,t)=>{const o=Object.fromEntries(Object.entries(t).filter(([n,a])=>n!=="preset"&&a!==void 0&&a!==e[n])),r=t.preset;return J(r)&&(r!==e.preset||!Me(e,r))?j({...e,...N[r],...o,preset:r}):j({...e,...o,preset:r==="custom"?"custom":e.preset})},E={min:0,max:1,step:.01},I=(e,t)=>({min:R[e][0],max:R[e][1],step:t}),ot={natural:"Natural",keepColors:"Keep colors",raw:"Raw"},rt=[{key:"preset",label:"Preset",type:"select",options:[{label:"Custom",value:"custom"},...Z.map(e=>({label:ot[e],value:e}))]},{key:"matchSkinTone",label:"Match skin tone",type:"number",...E},{key:"matchLighting",label:"Match lighting",type:"number",...E},{key:"edgeMatch",label:"Match at the edge",type:"number",...E},{key:"edgeSoftness",label:"Edge softness (cm)",type:"number",...I("edgeSoftness",.05)},{key:"edgeInset",label:"Edge inset (cm)",type:"number",...I("edgeInset",.05)},{key:"ownEyes",label:"Keep own eyes",type:"boolean"},{key:"ownMouth",label:"Keep own mouth",type:"boolean"},{key:"featureSoftness",label:"Eye and mouth rim (cm)",type:"number",...I("featureSoftness",.01)},{key:"detail",label:"Detail",type:"number",...E},{key:"smoothing",label:"Smoothing",type:"number",...E},{key:"amount",label:"Amount",type:"number",...E}],H=["leftLeft","rightRight","flip","upsideDown"],Ae={leftLeft:"your left half twice",rightRight:"your right half twice",flip:"left and right swapped",upsideDown:"eyes and mouth upside down"},st=e=>typeof e=="string"&&H.includes(e),Fe={variant:"leftLeft",matchLighting:1,edgeSoftness:1.2,smoothing:.35,amount:1},Re=(e={})=>{const t=Fe,o={...t,...Q(e)},r=R,n=a=>ke(o[a],r[a][0],r[a][1],t[a]);return{variant:tt(H,o.variant,t.variant),matchLighting:n("matchLighting"),edgeSoftness:n("edgeSoftness"),smoothing:n("smoothing"),amount:n("amount")}},nt=(e,t)=>Re({...e,...Q(t)}),it=[{key:"variant",label:"Variant",type:"select",options:H.map(e=>({label:Ae[e],value:e}))},{key:"matchLighting",label:"Match lighting",type:"number",...E},{key:"edgeSoftness",label:"Edge softness (cm)",type:"number",...I("edgeSoftness",.05)},{key:"smoothing",label:"Smoothing",type:"number",...E},{key:"amount",label:"Amount",type:"number",...E}],lt=e=>({matchSkinTone:0,matchLighting:e.matchLighting,edgeMatch:e.matchLighting,edgeSoftness:e.edgeSoftness,edgeInset:F.edgeInset,ownEyes:!1,ownMouth:!1,featureSoftness:F.featureSoftness,detail:F.detail,smoothing:e.smoothing,amount:e.amount}),ct=Object.freeze({...Ie.faceSurfaceBlending,transparent:!1,depthTest:!0,depthWrite:!1,toneMapped:!1}),ut=`
|
|
1
|
+
"use strict";const i=require("./renderPasses-Bt8k0dkm.cjs"),xe=require("three"),M=require("react/jsx-runtime"),_=require("react"),Ce=require("./index-J3Qy6hi3.cjs"),Le=require("./landmarks-BP6RbRHN.cjs"),Y=require("./renderState-apSfg4eR.cjs"),oe=require("@react-three/fiber"),we=require("./selectors-Bq6tSgOY.cjs"),Ie=require("./FaceSurface-CHAMEeG1.cjs"),re=require("./landmarkMask-CvN-L5NT.cjs");function Pe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const f=Pe(xe),Oe=[{label:"Wireframe",value:i.FACE_MESH_MATERIAL_TYPES.wireframe},{label:"Basic",value:i.FACE_MESH_MATERIAL_TYPES.basic},{label:"Standard",value:i.FACE_MESH_MATERIAL_TYPES.standard},{label:"Physical",value:i.FACE_MESH_MATERIAL_TYPES.physical},{label:"Toon",value:i.FACE_MESH_MATERIAL_TYPES.toon},{label:"Normal",value:i.FACE_MESH_MATERIAL_TYPES.normal},{label:"Matcap",value:i.FACE_MESH_MATERIAL_TYPES.matcap},{label:"Shader",value:i.FACE_MESH_MATERIAL_TYPES.shader}],De=[{label:"Original Face",value:i.FACE_MESH_SHADER_PRESETS.originalFace},{label:"Composite",value:i.FACE_MESH_SHADER_PRESETS.composite}],Ue=[{label:"Front",value:i.FACE_MESH_SIDES.front},{label:"Back",value:i.FACE_MESH_SIDES.back},{label:"Double",value:i.FACE_MESH_SIDES.double}],Ne=[{label:"None",value:i.FACE_MESH_TEXTURE_MAPS.none},{label:"UV Map 1",value:i.FACE_MESH_TEXTURE_MAPS.canonical},{label:"UV Map 2",value:i.FACE_MESH_TEXTURE_MAPS.style2}],He=[{label:"None",value:i.FACE_MESH_ALPHA_MAPS.none},{label:"Default Mask",value:i.FACE_MESH_ALPHA_MAPS.canonical}],Be=[{label:"Solid",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.solid},{label:"Gradient",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.gradient},{label:"Image URL",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.imageUrl},{label:"Media URL",value:i.FACE_MESH_MASK_TEXTURE_SOURCES.mediaUrl}],Xe=[{label:"Normal",value:i.FACE_MESH_BLEND_MODES.normal},{label:"Add",value:i.FACE_MESH_BLEND_MODES.add},{label:"Subtract",value:i.FACE_MESH_BLEND_MODES.subtract},{label:"Multiply",value:i.FACE_MESH_BLEND_MODES.multiply},{label:"Screen",value:i.FACE_MESH_BLEND_MODES.screen},{label:"Overlay",value:i.FACE_MESH_BLEND_MODES.overlay},{label:"Soft Light",value:i.FACE_MESH_BLEND_MODES.softLight},{label:"Hard Light",value:i.FACE_MESH_BLEND_MODES.hardLight},{label:"Lighten",value:i.FACE_MESH_BLEND_MODES.lighten},{label:"Darken",value:i.FACE_MESH_BLEND_MODES.darken},{label:"Difference",value:i.FACE_MESH_BLEND_MODES.difference},{label:"Exclusion",value:i.FACE_MESH_BLEND_MODES.exclusion}],ie=["both","left","right"],le=["shader","image"],ce={eye:"both",mode:"shader",color:"#4fa3ff",textureUrl:"",tintImage:!1,scale:1,opacity:.85,targetFps:0,smoothing:0,leadMs:80,mirrored:!1,faceIndex:0,holdMs:250},Ke=[{key:"eye",label:"Eye",type:"select",options:ie.map(e=>({label:e,value:e}))},{key:"mode",label:"Material",type:"select",options:le.map(e=>({label:e,value:e}))},{key:"color",label:"Color / tint",type:"color"},{key:"textureUrl",label:"Image URL (image mode)",type:"text"},{key:"tintImage",label:"Tint image with color",type:"boolean"},{key:"scale",label:"Scale (× iris radius)",type:"number",min:.2,max:4,step:.05},{key:"opacity",label:"Opacity",type:"number",min:0,max:1,step:.05},{key:"targetFps",label:"Face FPS (0 = session)",type:"number",min:0,max:60,step:1},{key:"smoothing",label:"Smoothing (0 = raw)",type:"number",min:0,max:60,step:1},{key:"leadMs",label:"Lead between samples (ms)",type:"number",min:0,max:200,step:10},{key:"mirrored",label:"Mirror material",type:"boolean"},{key:"faceIndex",label:"Face index",type:"number",min:0,max:3,step:1},{key:"holdMs",label:"Hold (ms)",type:"number",min:0,max:1e3,step:10}],Ge=e=>({...ce,...e}),Ye=(e,t)=>({...e,...t}),je=["lips","contour","blush","highlighter","eyeshadow","eyeliner","brows"],O=["matte","satin","gloss","shimmer","metallic","glitter"],ze=["both","left","right"],ue=["lips","blush","contour","highlighter","brows"],D={matte:{shine:0,sparkleDensity:0,sparkleSize:.25},satin:{shine:.3,sparkleDensity:0,sparkleSize:.25},gloss:{shine:.8,sparkleDensity:0,sparkleSize:.25},shimmer:{shine:.5,sparkleDensity:.6,sparkleSize:.25},metallic:{shine:.7,sparkleDensity:0,sparkleSize:.25},glitter:{shine:.7,sparkleDensity:.35,sparkleSize:.8}},me=["shine","sparkleDensity","sparkleSize"],P=[.1,1.5],T={lips:{nude:"#b9826f",rosewood:"#9e5a5a",mauve:"#a0606e",softPink:"#d88a95",coral:"#e0645a",peach:"#e8907a",classicRed:"#a3202d",brick:"#8e3b2c",berry:"#7b2846",plum:"#5e2a45",wine:"#5a1a28",chocolate:"#5b3a2e"},contour:{fair:"#c9a08a",light:"#b48a72",medium:"#98705a",tan:"#7f5a45",deep:"#5e4032",rich:"#432c22",bronzeLight:"#b9805a",bronzeDeep:"#8a5532"},blush:{softPink:"#e8a0a8",rose:"#d97a85",peach:"#f0a07c",coral:"#ec7b67",apricot:"#f2a86b",mauve:"#c0828f",berry:"#b04a68",brick:"#b4574a",terracotta:"#c4694c",plum:"#8f4a68"},highlighter:{pearl:"#f6eee6",champagne:"#f2dcc0",gold:"#e9c27a",roseGold:"#eab3a0",bronzeGlow:"#d29a66",lilacPearl:"#e6d6ef"},eyeshadow:{ivory:"#f3e6d3",champagne:"#e9d2b0",sand:"#d2b48c",taupe:"#8f7a6e",warmBrown:"#8b5a3c",coolBrown:"#6e5a50",espresso:"#3e2a22",charcoal:"#3a3a3c",black:"#141414",bronze:"#a8743f",copper:"#b5653a",gold:"#d4ae5a",roseGold:"#d49a8a",plum:"#6b3a5a",burgundy:"#6e2433",olive:"#6f6a3a",navy:"#23314f",emerald:"#1f6b52",teal:"#1f6f73",lilac:"#b8a0cf",silver:"#c5c7cb"},eyeliner:{black:"#0d0d0d",brownBlack:"#231a16",brown:"#4a3226",charcoal:"#33343a",navy:"#1c2848",plum:"#4f2442",emerald:"#145a44",bronze:"#8a5a2e",gold:"#c9a14e",white:"#f5f3ef"},brows:{blonde:"#a88a62",taupe:"#7c6a5c",softBrown:"#6b4f3c",mediumBrown:"#57402f",darkBrown:"#3d2c22",softBlack:"#252020",auburn:"#7a4030",grey:"#8a8580"}},v=e=>Object.keys(T[e]),pe={lips:v("lips"),contour:v("contour"),blush:v("blush"),highlighter:v("highlighter"),eyeshadow:v("eyeshadow"),eyeliner:v("eyeliner"),brows:v("brows")},U=e=>ue.includes(e),z=(e,t)=>typeof t=="string"&&Object.prototype.hasOwnProperty.call(T[e],t),se=(e,t)=>t==="custom"||t==="auto"&&U(e)||z(e,t);function de(e,t){return t==="auto"?U(e)?"auto":void 0:z(e,t)?T[e][t]:void 0}const w=e=>{const t=e.trim().toLowerCase(),o=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);return o?`#${o[1]}${o[1]}${o[2]}${o[2]}${o[3]}${o[3]}`:t},We=(e,t)=>Object.values(T[e]).some(o=>w(o)===t),he=(e,t,o,r,n)=>{const a=se(e,t),s=a?t:se(e,r)?r:"custom",l=typeof o=="string"&&o.trim()?o.trim():void 0;if(s==="custom")return{shade:s,color:l??n};const u=s==="auto"?n:de(e,s)??n;if(l!==void 0){const c=w(l),g=a&&(We(e,c)||c===w(n));if(c!==w(u)&&!g)return{shade:"custom",color:l}}return{shade:s,color:u}},W=e=>{const t=e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase();return t[0].toUpperCase()+t.slice(1)},Se=e=>[{label:"Custom color",value:"custom"},...U(e)?[{label:"Auto (own color)",value:"auto"}]:[],...pe[e].map(t=>({label:W(t),value:t}))],V=["lipstick","gloss","matte","tint","metallic","gradient","shimmer","glitter"],ge=["texture","solid"],Ee=["outward","vertical","horizontal"],fe={enabled:!0,preset:"custom",shade:"custom",maskMode:"outer-and-inner-lips",colorMode:"texture",color:"#e85d75",opacity:.8,coverage:.8,finish:"satin",...D.satin,sparkleColor:"",intensity:1,shading:1,gloss:.35,roughness:.5,highlightColor:"#ffffff",gradientColor:"#ffd6de",gradientAmount:0,gradientDirection:"outward",edgeSoftness:.12,innerLipColor:"#7a1f36",innerLipAmount:0,innerLipWidth:.35,splitLips:!1,lowerLipColor:"#e85d75",lowerLipOpacity:.8,textureScaleX:1,textureScaleY:1,textureOffsetX:0,textureOffsetY:0,textureRotation:0,textureFlipX:!1,textureFlipY:!1},q={lipstick:{finish:"satin",coverage:.85,color:"#c0304f",opacity:.85,intensity:1,shading:1,gloss:.35,roughness:.5,highlightColor:"#ffffff",gradientAmount:0},gloss:{finish:"gloss",coverage:.45,color:"#e05a7a",opacity:.7,intensity:1,shading:1,gloss:.95,roughness:.12,highlightColor:"#ffffff",gradientAmount:0},matte:{finish:"matte",coverage:.95,color:"#a8323e",opacity:.92,intensity:1,shading:1,gloss:0,roughness:1,highlightColor:"#ffffff",gradientAmount:0},tint:{finish:"matte",coverage:.3,color:"#ff6b81",opacity:.4,intensity:1,shading:1,gloss:.1,roughness:.7,highlightColor:"#ffffff",gradientAmount:0},metallic:{finish:"metallic",coverage:.9,color:"#b5485a",opacity:.9,intensity:1,shading:1,gloss:1,roughness:.3,highlightColor:"#f3c46b",gradientAmount:0},gradient:{finish:"satin",coverage:.8,color:"#d6336c",opacity:.8,intensity:1,shading:1,gloss:.3,roughness:.5,highlightColor:"#ffffff",gradientColor:"#f9c2cf",gradientAmount:.85,gradientDirection:"outward"},shimmer:{finish:"shimmer",coverage:.7,color:"#c8577a",opacity:.8,intensity:1,shading:1,gloss:.4,roughness:.45,highlightColor:"#ffffff",gradientAmount:0},glitter:{finish:"glitter",coverage:.5,color:"#b8406a",opacity:.8,intensity:1,shading:1,gloss:.5,roughness:.35,highlightColor:"#ffffff",gradientAmount:0}},$=e=>typeof e=="string"&&V.includes(e),p=(e,t,o,r)=>typeof e=="number"&&Number.isFinite(e)?Math.min(o,Math.max(t,e)):r,Ve=(e,t)=>typeof e=="number"&&Number.isFinite(e)?e:t,x=(e,t)=>typeof e=="string"&&e.trim()?e:t,qe=(e,t)=>typeof e=="string"?e.trim():t,C=(e,t)=>typeof e=="boolean"?e:t,K=(e,t,o)=>typeof t=="string"&&e.includes(t)?t:o,$e=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),be=(e={})=>{const t=$(e.preset)?e.preset:"custom",o=$e(e),r={...fe,...t==="custom"?{}:q[t]},n=K(O,o.finish,r.finish),a={...r,...D[n]},s={...a,...o},{shade:l,color:u}=he("lips",o.shade,o.color,a.shade,a.color);return{enabled:C(s.enabled,a.enabled),preset:t,shade:l,maskMode:s.maskMode==="outer-lips"?"outer-lips":"outer-and-inner-lips",colorMode:K(ge,s.colorMode,a.colorMode),color:u,opacity:p(s.opacity,0,1,a.opacity),coverage:p(s.coverage,0,1,a.coverage),finish:n,shine:p(s.shine,0,1,a.shine),sparkleDensity:p(s.sparkleDensity,0,1,a.sparkleDensity),sparkleSize:p(s.sparkleSize,...P,a.sparkleSize),sparkleColor:qe(s.sparkleColor,a.sparkleColor),intensity:p(s.intensity,0,1,a.intensity),shading:p(s.shading,0,1,a.shading),gloss:p(s.gloss,0,1,a.gloss),roughness:p(s.roughness,0,1,a.roughness),highlightColor:x(s.highlightColor,a.highlightColor),gradientColor:x(s.gradientColor,a.gradientColor),gradientAmount:p(s.gradientAmount,0,1,a.gradientAmount),gradientDirection:K(Ee,s.gradientDirection,a.gradientDirection),edgeSoftness:p(s.edgeSoftness,0,1,a.edgeSoftness),innerLipColor:x(s.innerLipColor,a.innerLipColor),innerLipAmount:p(s.innerLipAmount,0,1,a.innerLipAmount),innerLipWidth:p(s.innerLipWidth,0,1,a.innerLipWidth),splitLips:C(s.splitLips,a.splitLips),lowerLipColor:x(s.lowerLipColor,a.lowerLipColor),lowerLipOpacity:p(s.lowerLipOpacity,0,1,a.lowerLipOpacity),textureScaleX:p(s.textureScaleX,.05,20,a.textureScaleX),textureScaleY:p(s.textureScaleY,.05,20,a.textureScaleY),textureOffsetX:p(s.textureOffsetX,-2,2,a.textureOffsetX),textureOffsetY:p(s.textureOffsetY,-2,2,a.textureOffsetY),textureRotation:Ve(s.textureRotation,a.textureRotation),textureFlipX:C(s.textureFlipX,a.textureFlipX),textureFlipY:C(s.textureFlipY,a.textureFlipY)}},Ze=(e,t)=>{const o=Object.keys(e).some(a=>t[a]===void 0),r=Object.fromEntries(Object.entries(t).filter(([a,s])=>s!==void 0&&(o||s!==e[a]))),n={...e};if(r.preset!==e.preset&&$(r.preset)&&Object.assign(n,q[r.preset]),Object.assign(n,r),n.finish!==e.finish&&O.includes(n.finish)){Object.assign(n,D[n.finish]);for(const a of me)r[a]!==void 0&&(n[a]=r[a])}return r.color===void 0?n.shade!=="custom"&&delete n.color:r.shade===void 0&&r.color!==e.color&&(n.shade="custom"),be(n)},d={min:0,max:1,step:.01},Je=[{key:"enabled",label:"On",type:"boolean"},{key:"preset",label:"Preset",type:"select",options:[{label:"Custom",value:"custom"},...V.map(e=>({label:e[0].toUpperCase()+e.slice(1),value:e}))]},{key:"shade",label:"Shade",type:"select",options:Se("lips")},{key:"maskMode",label:"Mask mode",type:"select",options:[{label:"Outer + inner lips (mouth cut out)",value:"outer-and-inner-lips"},{label:"Outer lips (mouth included)",value:"outer-lips"}]},{key:"colorMode",label:"Color mode",type:"select",options:[{label:"Design texture",value:"texture"},{label:"Procedural (solid / gradient)",value:"solid"}]},{key:"color",label:"Tint color",type:"color"},{key:"opacity",label:"Opacity",type:"number",...d},{key:"coverage",label:"Coverage (sheer → opaque)",type:"number",...d},{key:"finish",label:"Finish",type:"select",options:O.map(e=>({label:W(e),value:e}))},{key:"shine",label:"Shine",type:"number",...d},{key:"sparkleColor",label:"Sparkle color (blank = from shade)",type:"text"},{key:"sparkleDensity",label:"Sparkle density",type:"number",...d},{key:"sparkleSize",label:"Sparkle size (mm)",type:"number",min:P[0],max:P[1],step:.05},{key:"intensity",label:"Tint intensity",type:"number",...d},{key:"shading",label:"Follow light (0 = flat)",type:"number",...d},{key:"gloss",label:"Gloss",type:"number",...d},{key:"roughness",label:"Roughness",type:"number",...d},{key:"highlightColor",label:"Highlight color",type:"color"},{key:"gradientColor",label:"Gradient color",type:"color"},{key:"gradientAmount",label:"Gradient amount",type:"number",...d},{key:"gradientDirection",label:"Gradient direction",type:"select",options:[{label:"Mouth line → outer edge",value:"outward"},{label:"Bottom → top",value:"vertical"},{label:"Person's right → left corner",value:"horizontal"}]},{key:"edgeSoftness",label:"Edge softness",type:"number",...d},{key:"innerLipColor",label:"Inner lip color",type:"color"},{key:"innerLipAmount",label:"Inner lip amount",type:"number",...d},{key:"innerLipWidth",label:"Inner lip width",type:"number",...d},{key:"splitLips",label:"Separate lower lip",type:"boolean"},{key:"lowerLipColor",label:"Lower lip color",type:"color"},{key:"lowerLipOpacity",label:"Lower lip opacity",type:"number",...d},{key:"textureScaleX",label:"Texture scale X",type:"number",min:.1,max:10,step:.05},{key:"textureScaleY",label:"Texture scale Y",type:"number",min:.1,max:10,step:.05},{key:"textureOffsetX",label:"Texture offset X",type:"number",min:-1,max:1,step:.01},{key:"textureOffsetY",label:"Texture offset Y",type:"number",min:-1,max:1,step:.01},{key:"textureRotation",label:"Texture rotation°",type:"number",min:-180,max:180,step:1},{key:"textureFlipX",label:"Flip horizontal",type:"boolean"},{key:"textureFlipY",label:"Flip vertical",type:"boolean"}],Qe=(e,t,o=new f.Matrix3)=>{const r=(t.minU+t.maxU)/2,n=(t.minV+t.maxV)/2,a=t.maxU-t.minU,s=t.maxV-t.minV,l=-f.MathUtils.degToRad(e.textureRotation),u=Math.cos(l),c=Math.sin(l),g=(e.textureFlipX?-1:1)/Math.max(e.textureScaleX,.001),h=(e.textureFlipY?-1:1)/Math.max(e.textureScaleY,.001),S=g*u,b=-g*c,m=h*c,y=h*u,k=r+e.textureOffsetX*a,B=n+e.textureOffsetY*s,te=r-(S*k+b*B),X=n-(m*k+y*B);return o.set(S,b,te,m,y,X,0,0,1)},et=["eachOther","photo","canonicalTexture","faceTexture"],Z=["natural","keepColors","raw"],F={preset:"natural",matchSkinTone:1,matchLighting:1,edgeMatch:1,edgeSoftness:1.2,edgeInset:.3,ownEyes:!0,ownMouth:!0,featureSoftness:.25,detail:1,smoothing:.35,amount:1},N={natural:{matchSkinTone:1,matchLighting:1,edgeMatch:1,edgeSoftness:1.2,ownEyes:!0,ownMouth:!0,detail:1},keepColors:{matchSkinTone:0,matchLighting:.7,edgeMatch:1,edgeSoftness:1},raw:{matchSkinTone:0,matchLighting:0,edgeMatch:0,edgeSoftness:.4}},J=e=>typeof e=="string"&&Z.includes(e),ve=e=>_e(e)?"keepColors":"natural",_e=e=>{var t;return(e==null?void 0:e.kind)==="canonicalTexture"||(e==null?void 0:e.kind)==="faceTexture"&&((t=e.face)==null?void 0:t.kind)==="canonical"},ye=.1,ke=(e,t,o,r)=>typeof e=="number"&&Number.isFinite(e)?Math.min(o,Math.max(t,e)):r,ne=(e,t)=>typeof e=="boolean"?e:t,tt=(e,t,o)=>typeof t=="string"&&e.includes(t)?t:o,Q=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),R={matchSkinTone:[0,1],matchLighting:[0,1],edgeMatch:[0,1],edgeSoftness:[.3,3],edgeInset:[0,1.5],featureSoftness:[.1,.6],detail:[0,1],smoothing:[0,1],amount:[0,1]},Me=(e,t)=>Object.entries(N[t]).every(([o,r])=>e[o]===r),j=(e={},t={})=>{const o=e.preset??ve(t.source),r=J(o)?o:"custom",n={...F,..._e(t.source)?{featureSoftness:ye}:{},...r==="custom"?{}:N[r]},a={...n,...Q(e)},s=R,l=c=>ke(a[c],s[c][0],s[c][1],n[c]),u={preset:r,matchSkinTone:l("matchSkinTone"),matchLighting:l("matchLighting"),edgeMatch:l("edgeMatch"),edgeSoftness:l("edgeSoftness"),edgeInset:l("edgeInset"),ownEyes:ne(a.ownEyes,n.ownEyes),ownMouth:ne(a.ownMouth,n.ownMouth),featureSoftness:l("featureSoftness"),detail:l("detail"),smoothing:l("smoothing"),amount:l("amount")};return r!=="custom"&&!Me(u,r)&&(u.preset="custom"),u},at=(e,t)=>{const o=Object.fromEntries(Object.entries(t).filter(([n,a])=>n!=="preset"&&a!==void 0&&a!==e[n])),r=t.preset;return J(r)&&(r!==e.preset||!Me(e,r))?j({...e,...N[r],...o,preset:r}):j({...e,...o,preset:r==="custom"?"custom":e.preset})},E={min:0,max:1,step:.01},I=(e,t)=>({min:R[e][0],max:R[e][1],step:t}),ot={natural:"Natural",keepColors:"Keep colors",raw:"Raw"},rt=[{key:"preset",label:"Preset",type:"select",options:[{label:"Custom",value:"custom"},...Z.map(e=>({label:ot[e],value:e}))]},{key:"matchSkinTone",label:"Match skin tone",type:"number",...E},{key:"matchLighting",label:"Match lighting",type:"number",...E},{key:"edgeMatch",label:"Match at the edge",type:"number",...E},{key:"edgeSoftness",label:"Edge softness (cm)",type:"number",...I("edgeSoftness",.05)},{key:"edgeInset",label:"Edge inset (cm)",type:"number",...I("edgeInset",.05)},{key:"ownEyes",label:"Keep own eyes",type:"boolean"},{key:"ownMouth",label:"Keep own mouth",type:"boolean"},{key:"featureSoftness",label:"Eye and mouth rim (cm)",type:"number",...I("featureSoftness",.01)},{key:"detail",label:"Detail",type:"number",...E},{key:"smoothing",label:"Smoothing",type:"number",...E},{key:"amount",label:"Amount",type:"number",...E}],H=["leftLeft","rightRight","flip","upsideDown"],Ae={leftLeft:"your left half twice",rightRight:"your right half twice",flip:"left and right swapped",upsideDown:"eyes and mouth upside down"},st=e=>typeof e=="string"&&H.includes(e),Fe={variant:"leftLeft",matchLighting:1,edgeSoftness:1.2,smoothing:.35,amount:1},Re=(e={})=>{const t=Fe,o={...t,...Q(e)},r=R,n=a=>ke(o[a],r[a][0],r[a][1],t[a]);return{variant:tt(H,o.variant,t.variant),matchLighting:n("matchLighting"),edgeSoftness:n("edgeSoftness"),smoothing:n("smoothing"),amount:n("amount")}},nt=(e,t)=>Re({...e,...Q(t)}),it=[{key:"variant",label:"Variant",type:"select",options:H.map(e=>({label:Ae[e],value:e}))},{key:"matchLighting",label:"Match lighting",type:"number",...E},{key:"edgeSoftness",label:"Edge softness (cm)",type:"number",...I("edgeSoftness",.05)},{key:"smoothing",label:"Smoothing",type:"number",...E},{key:"amount",label:"Amount",type:"number",...E}],lt=e=>({matchSkinTone:0,matchLighting:e.matchLighting,edgeMatch:e.matchLighting,edgeSoftness:e.edgeSoftness,edgeInset:F.edgeInset,ownEyes:!1,ownMouth:!1,featureSoftness:F.featureSoftness,detail:F.detail,smoothing:e.smoothing,amount:e.amount}),ct=Object.freeze({...Ie.faceSurfaceBlending,transparent:!1,depthTest:!0,depthWrite:!1,toneMapped:!1}),ut=`
|
|
2
2
|
varying vec2 vUv;
|
|
3
3
|
|
|
4
4
|
void main() {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const H=require("react/jsx-runtime"),T=require("react"),Me=require("@react-three/fiber"),xe=require("./context-hA0Rb2Xa.cjs"),Oe=require("three");function Le(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const Ce=Le(Oe),Fe=({children:t,depth:e=0})=>{const{camera:n,size:r}=Me.useThree(),a=T.useMemo(()=>{if(!n.isPerspectiveCamera)return{width:10,height:10};const i=n,l=Math.abs(i.position.z-e),f=i.fov*Math.PI/180,s=2*Math.tan(f/2)*l;return{width:s*(r.width/r.height),height:s}},[n,r,e]);return H.jsx(xe.ScreenSpaceContext.Provider,{value:a,children:H.jsx("group",{position:[0,0,e],children:t})})},We="__VCT_EDIT_OVERRIDES__";function Ye(){const t=globalThis[We];return t&&typeof t.subscribe=="function"&&typeof t.version=="function"&&typeof t.get=="function"?t:void 0}const ke=()=>()=>{},fe=()=>0;function ue(t,e){const n=Ye();if(T.useSyncExternalStore(n?n.subscribe:ke,n?n.version:fe,fe),!n)return t;const r=n.get(t);if(!r)return t;let a=null;for(const i of e)Object.prototype.hasOwnProperty.call(r,i)&&(a??(a={...t}),a[i]=r[i]);return a??t}const be=T.forwardRef(({texture:t,name:e,overlay:n,opacity:r,position:a,rotation:i,scale:l,visible:f,renderOrder:s},h)=>H.jsxs("mesh",{ref:h,name:e,position:a,rotation:i,scale:l,visible:f,renderOrder:s,children:[H.jsx("planeGeometry",{args:[1,1]}),H.jsx("meshBasicMaterial",{map:t,transparent:!0,opacity:r,depthTest:!n,depthWrite:!n})]}));be.displayName="TextLabelMesh";const Pe={color:"#ffffff",strokeWidth:0,strokeOpacity:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowOpacity:1,fontWeight:"bold",fontStyle:"normal",fontFamily:"Arial, sans-serif",fontSize:48,textAlign:"center",verticalAlign:"center",minFontSize:12,letterSpacing:0,lineSpacing:.3,bgColor:"rgba(20,40,110,0.88)",bgFillMode:"solid",bgOpacity:1,bgFit:"full",bgTextureFit:"cover",bgTextureFlipX:!1,bgTextureFlipY:!1,borderWidth:0,borderRadius:24,padding:32,aspect:2.5,resolution:512,opacity:1,underline:!1,strikethrough:!1,bendPreset:"arc",bendStrength:0},me=t=>{T.useEffect(()=>()=>{t==null||t.dispose()},[t])};function He(t,e,n){return n==="left"?e:n==="right"?t-e:t/2}function Xe(t,e,n,r,a){return a==="top"?e+n/2:a==="bottom"?t-e-r+n/2:t/2-(r-n)/2}function Ae(t,e,n,r){return r==="full"||n==="left"?0:n==="right"?t-e:(t-e)/2}function Se(t,e,n,r){return`${t} ${e} ${n}px ${r}`}function E(t,e){const n=Math.max(0,Math.min(e,1));return t*n*.08}function ye(t,e){const n=Math.max(0,Math.min(e,1));return t*(1.2+n*.6)}function we(t,e){"letterSpacing"in t&&(t.letterSpacing=`${e}px`)}function ve(t){"letterSpacing"in t&&(t.letterSpacing="0px")}function A(t,e,n){we(t,n);const r=t.measureText(e).width;return ve(t),r}function U(t,e,n,r){return Math.max(1,Math.floor((t-e*2)/ye(n,r)))}function pe(t,e,n,r,a){return e.length<=r&&e.every(i=>A(t,i,a)<=n)}function J(t,e,n,r,a,i,l,f){t.font=Se(r,a,i,l);const s=e.split(" "),h=[];let o="";for(const d of s){const c=o?`${o} ${d}`:d;A(t,c,f)>n&&o?(h.push(o),o=d):o=c}return o&&h.push(o),h}function he(t,e,n,r,a,i,l,f){const h=e.split(/\r?\n/).flatMap(o=>o.trim().length===0?[""]:J(t,o,n,r,a,i,l,f));return h.length>0?h:[e]}function Te(t,e,n,r,a){const i=r?"...":"";let l=e.trimEnd();for(;l.length>0&&A(t,`${l}${i}`,a)>n;)l=l.slice(0,-1).trimEnd();return`${l}${i}`}function K(t,e,n,r,a){return e.map((i,l)=>{if(A(t,i,a)<=n)return i;const f=l===e.length-1;return Te(t,i,n,r==="ellipsis"&&f,a)})}function ce(t,e,n,r,a,i){if(e.length<=n)return K(t,e,r,a?"ellipsis":"clip",i);const l=e.slice(0,n),f=l[n-1];return l[n-1]=Te(t,f,r,a,i),K(t,l,r,a?"ellipsis":"clip",i)}function Be(t){const{ctx:e,text:n,explicitLines:r,maxWidth:a,maxHeight:i,padding:l,fontStyle:f,fontWeight:s,fontSize:h,fontFamily:o,letterSpacing:d,lineSpacing:c,overflow:u,resizeToFit:S,minFontSize:g}=t;let b=h,m=E(b,d),y=r??he(e,n,a,f,s,b,o,m),v=U(i,l,b,c);const L=S===!0||u==="shrink";for(;L&&!pe(e,y,a,v,m)&&b>g&&(b=Math.max(g,b-4),m=E(b,d),y=r??he(e,n,a,f,s,b,o,m),v=U(i,l,b,c),b!==g););return u==="ellipsis"?y=ce(e,y,v,a,!0,m):u==="clamp"||u==="shrink"?y=ce(e,y,v,a,!1,m):u!=="clip"&&(y=K(e,y,a,void 0,m)),{fontSize:b,lines:y}}function ze(t){const{ctx:e,text:n,maxWidth:r,maxHeight:a,padding:i,fontStyle:l,fontWeight:f,fontSize:s,fontFamily:h,letterSpacing:o,lineSpacing:d}=t;let c=s,u=J(e,n,r,l,f,c,h,E(c,o));const S=U(a,i,c,d);return u.length>S&&(c=Math.max(12,Math.round(c*.75)),u=J(e,n,r,l,f,c,h,E(c,o))),{fontSize:c,lines:u}}function Q(t,e){return typeof OffscreenCanvas<"u"?new OffscreenCanvas(t,e):(()=>{const n=document.createElement("canvas");return n.width=t,n.height=e,n})()}function Ee(t,e){const n=e.width-e.padding*2,a=Array.isArray(e.lines)||e.text.includes(`
|
|
2
|
+
`)||e.overflow!==void 0||e.resizeToFit!==void 0?Be({ctx:t,text:e.text,explicitLines:e.lines,maxWidth:n,maxHeight:e.height,padding:e.padding,fontStyle:e.fontStyle,fontWeight:e.fontWeight,fontSize:e.fontSize,fontFamily:e.fontFamily,overflow:e.overflow,resizeToFit:e.resizeToFit,minFontSize:e.minFontSize,letterSpacing:e.letterSpacing,lineSpacing:e.lineSpacing}):ze({ctx:t,text:e.text,maxWidth:n,maxHeight:e.height,padding:e.padding,fontStyle:e.fontStyle,fontWeight:e.fontWeight,fontSize:e.fontSize,fontFamily:e.fontFamily,letterSpacing:e.letterSpacing,lineSpacing:e.lineSpacing}),i=a.fontSize,l=a.lines;t.font=Se(e.fontStyle,e.fontWeight,i,e.fontFamily);const f=E(i,e.letterSpacing),s=ye(i,e.lineSpacing),h=Math.max(i,i+(l.length-1)*s),o=Xe(e.height,e.padding,i,h,e.verticalAlign),d=l.map(c=>A(t,c,f));return{fontSize:i,resolvedLines:l,letterSpacingPx:f,lineHeight:s,startY:o,textBlockWidth:Math.min(e.width,Math.max(0,Math.max(...d,0))+e.padding*2),textBlockHeight:Math.min(e.height,h+e.padding*2),textX:He(e.width,e.padding,e.textAlign)}}function Re(t,e,n,r,a,i){t.beginPath(),t.moveTo(e+i,n),t.lineTo(e+r-i,n),t.quadraticCurveTo(e+r,n,e+r,n+i),t.lineTo(e+r,n+a-i),t.quadraticCurveTo(e+r,n+a,e+r-i,n+a),t.lineTo(e+i,n+a),t.quadraticCurveTo(e,n+a,e,n+a-i),t.lineTo(e,n+i),t.quadraticCurveTo(e,n,e+i,n),t.closePath()}function ge(t,e,n){return typeof t!="number"||Number.isNaN(t)||t<=0?e:Math.min(t,n)}function Ie(t,e){const n=Ae(e.canvasWidth,e.panelWidth,e.textAlign,e.bgFit),r=(e.canvasHeight-e.panelHeight)/2,a=Math.min(e.borderRadius,Math.min(e.panelWidth,e.panelHeight)/2);Re(t,n,r,e.panelWidth,e.panelHeight,a),De(t,{panelX:n,panelY:r,panelWidth:e.panelWidth,panelHeight:e.panelHeight,bgColor:e.bgColor,bgFillMode:e.bgFillMode,bgOpacity:e.bgOpacity,bgGradientStops:e.bgGradientStops,bgTextureImage:e.bgTextureImage,bgTextureFit:e.bgTextureFit,bgTextureFlipX:e.bgTextureFlipX,bgTextureFlipY:e.bgTextureFlipY}),e.borderColor&&e.borderWidth>0&&(t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,t.stroke())}function De(t,e){if(t.save(),t.globalAlpha=Math.max(0,Math.min(e.bgOpacity,1)),e.bgFillMode==="gradient"&&e.bgGradientStops&&e.bgGradientStops.length>1){const n=t.createLinearGradient(e.panelX,e.panelY,e.panelX+e.panelWidth,e.panelY+e.panelHeight);[...e.bgGradientStops].sort((r,a)=>r.position-a.position).forEach(r=>n.addColorStop(Math.max(0,Math.min(r.position,1)),r.color)),t.fillStyle=n,t.fill(),t.restore();return}if(e.bgTextureImage){t.clip(),_e(t,{image:e.bgTextureImage,x:e.panelX,y:e.panelY,width:e.panelWidth,height:e.panelHeight,fit:e.bgTextureFit,flipX:e.bgTextureFlipX,flipY:e.bgTextureFlipY}),t.restore();return}t.fillStyle=e.bgColor,t.fill(),t.restore()}function _e(t,e){const{image:n,x:r,y:a,width:i,height:l,fit:f,flipX:s,flipY:h}=e,o="naturalWidth"in n?n.naturalWidth:"videoWidth"in n?n.videoWidth:n.width,d="naturalHeight"in n?n.naturalHeight:"videoHeight"in n?n.videoHeight:n.height;let c=i,u=l,S=r,g=a;if(f!=="stretch"&&o>0&&d>0){const b=f==="cover"?Math.max(i/o,l/d):Math.min(i/o,l/d);c=o*b,u=d*b,S=r+(i-c)/2,g=a+(l-u)/2}t.save(),(s||h)&&(t.translate(s?r+i:0,h?a+l:0),t.scale(s?-1:1,h?-1:1),S=s?-(S-r)-c+r:S,g=h?-(g-a)-u+a:g),t.drawImage(n,S,g,c,u),t.restore()}function je(t,e,n,r,a,i){const l=a/72,f=Math.abs(l),s=1-Math.min(1,Math.abs(e)),h=Math.min(1,Math.abs(e)),o=r<=1?.5:n/(r-1),d=Math.sin(o*Math.PI*2-Math.PI/2),c=Math.sin(o*Math.PI*2.7-Math.PI/2)*(.65+o*.35),u=a*e*e,S=2*a*e/i,g={xOffset:0,yOffset:0,rotation:0,scaleX:1,scaleY:1};switch(t){case"arc":return{...g,yOffset:u,rotation:Math.atan(S)};case"arc-lower":return{...g,yOffset:u*.55,scaleY:Math.max(.2,1+l*e*e*.45)};case"arc-upper":return{...g,yOffset:-u*.55,scaleY:Math.max(.2,1-l*e*e*.45)};case"arch":return{...g,yOffset:u};case"bulge":return{...g,scaleY:Math.max(.2,1+l*s*.75)};case"shell-lower":return{...g,yOffset:a*.45*o*s,scaleY:Math.max(.2,1+l*o*s)};case"shell-upper":return{...g,yOffset:-a*.45*(1-o)*s,scaleY:Math.max(.2,1+l*(1-o)*s)};case"flag":return{...g,yOffset:a*.65*c,rotation:Math.atan(a/Math.max(i,1)*Math.cos(o*Math.PI*2.7)*1.6)};case"wave":return{...g,yOffset:a*.6*d,rotation:Math.atan(a/Math.max(i,1)*Math.cos(o*Math.PI*2)*1.4)};case"fish":return{...g,scaleX:Math.max(.25,1-f*h*.55),scaleY:Math.max(.2,1+l*s)};case"rise":return{...g,yOffset:a*e};case"fisheye":return{...g,yOffset:a*.18*e*s,scaleX:Math.max(.25,1+l*s*.7),scaleY:Math.max(.2,1+l*s*.7)};case"inflate":return{...g,scaleX:Math.max(.25,1+l*s*.6),scaleY:Math.max(.2,1+l*s*.6)};case"squeeze":return{...g,scaleY:Math.max(.2,1-l*s*.8)};case"twist":return{...g,yOffset:a*e,rotation:l*e*.45,scaleY:Math.max(.2,1+l*e*.25)};default:return g}}function X(t,e,n,r,a,i,l="arc",f=0){if(f!==0){Ge(t,e,n,r,a,i,l,f);return}we(t,a),i==="fill"?t.fillText(e,n,r):t.strokeText(e,n,r),ve(t)}function Ge(t,e,n,r,a,i,l,f){const s=Array.from(e);if(s.length===0)return;const h=s.map(m=>t.measureText(m).width),o=h.reduce((m,y)=>m+y,0)+a*Math.max(0,s.length-1),d=t.textAlign,c=d==="right"?n-o:d==="center"?n-o/2:n,S=Math.max(-100,Math.min(f,100))/100*72,g=Math.max(o/2,1);let b=c;for(let m=0;m<s.length;m++){const y=s[m],v=h[m],L=b+v/2,W=(L-c-o/2)/g,O=je(l,W,m,s.length,S,g);t.save(),t.translate(L+O.xOffset,r+O.yOffset),t.rotate(O.rotation),t.scale(O.scaleX,O.scaleY),t.textAlign="center",i==="fill"?t.fillText(y,0,0):t.strokeText(y,0,0),t.restore(),b+=v+a}}function de(t,e,n,r,a,i,l,f,s){const h=A(t,e,f),o=a==="center"?n-h/2:a==="right"?n-h:n,d=s==="underline"?l*.42:-l*.08,c=r+d;t.save(),t.strokeStyle=i,t.lineWidth=Math.max(2,l*.06),t.lineCap="round",t.beginPath(),t.moveTo(o,c),t.lineTo(o+h,c),t.stroke(),t.restore()}function $e(t,e){for(let n=0;n<e.lines.length;n++){const r=e.lines[n],a=e.startY+n*e.lineHeight;for(const i of e.shadowLayers)t.save(),t.shadowColor=i.color,t.shadowBlur=i.blur,t.shadowOffsetX=i.offsetX??0,t.shadowOffsetY=i.offsetY??0,t.globalAlpha=i.opacity??1,t.fillStyle=e.color,X(t,r,e.textX,a,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength),t.restore();for(const i of e.strokeLayers)t.save(),t.lineJoin="round",t.miterLimit=2,t.lineWidth=i.width,t.strokeStyle=i.color,t.globalAlpha=i.opacity??1,X(t,r,e.textX,a,e.letterSpacingPx,"stroke",e.bendPreset,e.bendStrength),t.restore();t.save(),t.fillStyle=e.color,t.globalAlpha=1,X(t,r,e.textX,a,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength),t.restore(),e.underline&&de(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"underline"),e.strikethrough&&de(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"strikethrough")}}function qe(t,e){const n=Math.max(0,Math.min(e.intensity,1));if(n<=0)return;const r=Math.max(0,Math.min(e.range,1)),a=r*72,i=Math.max(-.5,Math.min(e.horizontalAngle,.5))*80,l=Math.max(-.5,Math.min(e.verticalAngle,.5))*80;for(let f=0;f<e.lines.length;f++){const s=e.startY+f*e.lineHeight;t.save(),t.globalAlpha=n,t.shadowColor=e.color,t.shadowBlur=a,t.shadowOffsetX=i,t.shadowOffsetY=l,e.style==="contoured"?(t.lineJoin="round",t.miterLimit=2,t.lineWidth=Math.max(2,r*42),t.strokeStyle=e.color,X(t,e.lines[f],e.textX,s,e.letterSpacingPx,"stroke",e.bendPreset,e.bendStrength)):(t.fillStyle=e.color,X(t,e.lines[f],e.textX,s,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength)),t.restore()}}function Ne(t,e){const n=Q(e.width,e.height),r=n.getContext("2d");r.clearRect(0,0,e.width,e.height),r.font=e.font,r.fillStyle="#ffffff",r.textAlign=e.textAlign,r.textBaseline="middle";for(let l=0;l<e.lines.length;l++)X(r,e.lines[l],e.textX,e.startY+l*e.lineHeight,e.letterSpacingPx,"fill",e.bendPreset,e.bendStrength);const a=Q(e.width,e.height),i=a.getContext("2d");i.clearRect(0,0,e.width,e.height),i.save(),i.globalAlpha=e.opacity,i.filter=e.blur>0?`blur(${e.blur}px)`:"none",i.drawImage(n,e.offsetX,e.offsetY),i.restore(),i.globalCompositeOperation="destination-in",i.drawImage(n,0,0),i.globalCompositeOperation="source-in",i.globalAlpha=e.opacity,i.fillStyle=e.color,i.fillRect(0,0,e.width,e.height),t.drawImage(a,0,0)}function Ve(t){const{width:e,height:n,color:r,strokeLayers:a,strokeColor:i,strokeWidth:l,strokeOpacity:f,shadowLayers:s,innerShadow:h,glow:o,shadowColor:d,shadowBlur:c,shadowOffsetX:u,shadowOffsetY:S,shadowOpacity:g,textAlign:b,bgFillMode:m,bgOpacity:y,bgFit:v,bgAutoSize:L,bgWidth:W,bgHeight:O,bgGradientStops:C,bgTextureImage:F,bgTextureFit:R,bgTextureFlipX:I,bgTextureFlipY:D,underline:_,strikethrough:j,bendPreset:Y,bendStrength:k}=t;let{fontSize:p,bgColor:B}=t;const G=[...a??[],...i&&l>0?[{color:i,width:l,opacity:f}]:[]].filter(x=>x.width>0),$=[...s??[],...d&&(c>0||u!==0||S!==0)?[{color:d,blur:c,offsetX:u,offsetY:S,opacity:g}]:[]].filter(x=>x.blur>0||(x.offsetX??0)!==0||(x.offsetY??0)!==0);let P;const z=Q(e,n),M=z.getContext("2d");M.clearRect(0,0,e,n),M.fillStyle=r,M.textAlign=b,M.textBaseline="middle";const w=Ee(M,t);if(p=w.fontSize,B!=="transparent"){const x=L===!0,q=ge(x?void 0:W,v==="text"||x?w.textBlockWidth:e,e),N=ge(x?void 0:O,v==="text"||x?w.textBlockHeight:n,n);Ie(M,{canvasWidth:e,canvasHeight:n,textAlign:b,bgFit:v,panelWidth:q,panelHeight:N,bgColor:B,bgFillMode:m,bgOpacity:y,bgGradientStops:C,bgTextureImage:F,bgTextureFit:R,bgTextureFlipX:I,bgTextureFlipY:D,borderColor:t.borderColor,borderWidth:t.borderWidth,borderRadius:t.borderRadius})}return o&&qe(M,{lines:w.resolvedLines,textX:w.textX,startY:w.startY,lineHeight:w.lineHeight,letterSpacingPx:w.letterSpacingPx,bendPreset:Y,bendStrength:k,color:o.color,style:o.style,intensity:o.intensity??.5,range:o.range??.5,horizontalAngle:o.horizontalAngle??0,verticalAngle:o.verticalAngle??0}),$e(M,{lines:w.resolvedLines,textX:w.textX,startY:w.startY,lineHeight:w.lineHeight,textAlign:b,color:r,fontSize:p,letterSpacingPx:w.letterSpacingPx,bendPreset:Y,bendStrength:k,shadowLayers:$,strokeLayers:G,underline:_,strikethrough:j}),h&&Ne(M,{width:e,height:n,font:M.font,lines:w.resolvedLines,textX:w.textX,startY:w.startY,lineHeight:w.lineHeight,letterSpacingPx:w.letterSpacingPx,bendPreset:Y,bendStrength:k,textAlign:b,color:h.color,opacity:h.opacity??1,blur:h.blur,offsetX:h.offsetX??0,offsetY:h.offsetY??0}),P=new Ce.CanvasTexture(z),P.needsUpdate=!0,P}function Ue(t,e){const{lines:n,color:r,strokeLayers:a,outlineEnabled:i,strokeColor:l,strokeWidth:f,strokeOpacity:s,shadowLayers:h,shadowEnabled:o,innerShadow:d,glow:c,shadowColor:u,shadowBlur:S,shadowOffsetX:g,shadowOffsetY:b,shadowOpacity:m,fontWeight:y,fontStyle:v,fontFamily:L,fontSize:W,textAlign:O,verticalAlign:C,overflow:F,resizeToFit:R,minFontSize:I,letterSpacing:D,lineSpacing:_,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:p,bgWidth:B,bgHeight:G,bgGradientStops:$,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:M,borderColor:w,borderWidth:x,borderRadius:q,padding:N,aspect:Z,resolution:V,underline:ee,strikethrough:te,bendPreset:ne,bendStrength:re}=t,ie=T.useMemo(()=>i===!1?[]:a,[i,a]),ae=T.useMemo(()=>o===!1?[]:h,[o,h]),le=void 0,oe=T.useMemo(()=>({text:e.text,lines:n,color:r,strokeLayers:ie,strokeColor:i===!1?void 0:l,strokeWidth:i===!1?0:f,strokeOpacity:s,shadowLayers:ae,innerShadow:d,glow:c,shadowColor:o===!1?void 0:u,shadowBlur:o===!1?0:S,shadowOffsetX:o===!1?0:g,shadowOffsetY:o===!1?0:b,shadowOpacity:m,fontWeight:y,fontStyle:v,fontFamily:L,fontSize:W,textAlign:O,verticalAlign:C,overflow:F,resizeToFit:R,minFontSize:I,letterSpacing:D,lineSpacing:_,bgColor:e.bgColor,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:p,bgWidth:B,bgHeight:G,bgGradientStops:$,bgTextureImage:le,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:M,borderColor:w,borderWidth:x,borderRadius:q,padding:N,height:V,width:Math.round(V*Math.max(Z,.1)),underline:ee,strikethrough:te,bendPreset:ne,bendStrength:re}),[e.text,e.bgColor,n,r,ie,i,l,f,s,ae,d,c,o,u,S,g,b,m,y,v,L,W,O,C,F,R,I,D,_,j,Y,k,p,B,G,$,le,P,z,M,w,x,q,N,Z,V,ee,te,ne,re]),se=T.useMemo(()=>Ve(oe),[oe]);return me(se),se}const Je=["color"];function Ke(t){const e=ue(t,Je),n={...Pe,...e},{text:r,bgColor:a,opacity:i,name:l,overlay:f=!0,position:s,rotation:h,scale:o,visible:d,renderOrder:c}=n,[u,S]=T.useState(null),[g,b]=T.useState(null),m=T.useRef(r);m.current!==r&&(m.current=r,u!==null&&S(null));const y=T.useRef(a);y.current!==a&&(y.current=a,g!==null&&b(null));const v=T.useRef(null),O=Ue(n,{text:u??r,bgColor:g??a});return T.useEffect(()=>{const C=v.current;if(C)return C.userData.setText=F=>S(F),C.userData.setBgColor=F=>b(F),()=>{delete C.userData.setText,delete C.userData.setBgColor}},[]),H.jsx(be,{ref:v,name:l,texture:O,overlay:f,opacity:i,position:s,rotation:h,scale:o,visible:d,renderOrder:c})}exports.ScreenSpaceUI=Fe;exports.TextLabel=Ke;exports.useEditOverrides=ue;exports.useOwnedTexture=me;
|