@vincentt-xr/sdk 2.0.0-alpha.21 → 2.0.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/GROUNDING.md +138 -2
  2. package/components.json +61 -1
  3. package/dist/{CanonicalHeadFrame-CQe2YX9a.js → CanonicalHeadFrame-ZSfpHH_w.js} +3 -3
  4. package/dist/{DebuggerUI-CKYrYmod.js → DebuggerUI-C_c1B-2p.js} +1 -1
  5. package/dist/{FaceRetouch-l7y4oZBu.js → FaceRetouch-4tV3RYa-.js} +4 -4
  6. package/dist/{TextLabel-C-AibH5A.cjs → TextLabel-DWBSNwRA.cjs} +2 -2
  7. package/dist/{TextLabel-fEF1o3wE.js → TextLabel-XSfkeWDJ.js} +172 -172
  8. package/dist/{bodyMaskMaterial-BOdSJUEM.js → bodyMaskMaterial-BF6Gm6hz.js} +1 -1
  9. package/dist/{cache-Mu-VO_6E.js → cache-CbX-0Rgn.js} +2 -2
  10. package/dist/components/Button/index.d.ts +1 -1
  11. package/dist/components/CaptureShareScreen/index.d.ts +27 -0
  12. package/dist/components/FaceSwap/settings.d.ts +1 -1
  13. package/dist/components/HtmlRegion/index.d.ts +1 -1
  14. package/dist/components/IntroScreen/index.d.ts +31 -0
  15. package/dist/components/Light/index.d.ts +1 -1
  16. package/dist/components/Model/index.d.ts +1 -1
  17. package/dist/components/Object3D/index.d.ts +1 -1
  18. package/dist/components/PaintedFace/index.d.ts +1 -1
  19. package/dist/components/ScreenShape/index.d.ts +8 -0
  20. package/dist/components/ScreenText/liveEditable.d.ts +1 -1
  21. package/dist/components/SplashScreen/index.d.ts +38 -0
  22. package/dist/components/TextLabel/TextLabel.d.ts +3 -0
  23. package/dist/components/index.d.ts +3 -0
  24. package/dist/contexts-awO81p6d.cjs +1 -0
  25. package/dist/contexts-hhxufDg2.js +714 -0
  26. package/dist/debug-ui/media-source.js +1 -1
  27. package/dist/debug-ui.cjs +1 -1
  28. package/dist/debug-ui.js +11 -11
  29. package/dist/{drawNormalizedCrop-D606u5-F.js → drawNormalizedCrop-8RzfrVNS.js} +5 -5
  30. package/dist/editor-defs/live.d.ts +28 -0
  31. package/dist/editor-defs/live.generated.d.ts +2 -0
  32. package/dist/editor-defs/types.d.ts +1 -1
  33. package/dist/editor-scenes.cjs +1 -1
  34. package/dist/editor-scenes.js +419 -40
  35. package/dist/entries/core.d.ts +10 -0
  36. package/dist/entries/editor-scenes.d.ts +1 -6
  37. package/dist/face-effects.cjs +67 -67
  38. package/dist/face-effects.js +1276 -1275
  39. package/dist/{getFaceInfo-Mt44zlej.js → getFaceInfo-B1pPvyh9.js} +1 -1
  40. package/dist/hooks/captureStore.d.ts +25 -0
  41. package/dist/hooks/useCapture.d.ts +28 -0
  42. package/dist/hooks/useShare.d.ts +37 -0
  43. package/dist/{index-CbBCl2ZU.js → index-BTVIMj8H.js} +2 -2
  44. package/dist/{index-BDxJWWyy.js → index-BmeB_V6I.js} +48 -48
  45. package/dist/{index-D5NbXaCn.js → index-CW4yk2jC.js} +272 -263
  46. package/dist/{index-B0EYdofX.js → index-Cw6HeUjE.js} +1 -1
  47. package/dist/{index-Bn72laBn.js → index-DSrRFuRp.js} +1 -1
  48. package/dist/{index-CM3jkleV.js → index-DTkbQ5OA.js} +27 -25
  49. package/dist/{index-CicO_Tnw.js → index-Dmhh2RjM.js} +1 -1
  50. package/dist/index-hEANh5cP.cjs +21 -0
  51. package/dist/{index-fDwL47CM.cjs → index-rCxTueDx.cjs} +2 -2
  52. package/dist/instructions.cjs +1 -1
  53. package/dist/instructions.js +8 -8
  54. package/dist/{internal-BoFDq5hC.js → internal-DDcTDvPS.js} +3 -3
  55. package/dist/internal.js +2 -2
  56. package/dist/{landmarks-C3LvDhMt.js → landmarks-BB8jyfJA.js} +1 -1
  57. package/dist/live.generated-Do4jgrUN.js +116 -0
  58. package/dist/live.generated-n5ZV_2Gt.cjs +1 -0
  59. package/dist/low-level.cjs +1 -1
  60. package/dist/low-level.js +17 -17
  61. package/dist/main.cjs +1 -1
  62. package/dist/main.js +1081 -884
  63. package/dist/overlay/consumer.d.ts +36 -0
  64. package/dist/overlay/grammar.d.ts +74 -0
  65. package/dist/overlay/region.d.ts +23 -0
  66. package/dist/particles.js +5 -5
  67. package/dist/product.js +2 -2
  68. package/dist/{providers-Bxt_MfPK.js → providers-Q4H0Ii-y.js} +3 -3
  69. package/dist/{renderGroups-uYPzUa66.js → renderGroups-LVQ0Af0t.js} +1 -1
  70. package/dist/{renderPasses-C0wu5Cwg.js → renderPasses-DYc2-EBT.js} +7 -7
  71. package/dist/scene-object.cjs +1 -1
  72. package/dist/scene-object.js +2 -2
  73. package/dist/{segmentation-DccvYBBO.js → segmentation-BWHRt2hE.js} +1 -1
  74. package/dist/{selectors-J06V0eDb.js → selectors-kj5g3uv2.js} +3 -3
  75. package/dist/{session-CYiWfcvz.js → session-CMz1ao3i.js} +1 -1
  76. package/dist/tracking.js +25 -25
  77. package/dist/{trigger-CQviD4xp.js → trigger-8fpI9g9S.js} +7 -7
  78. package/dist/{useBodies-DOuwRuew.js → useBodies-CH4ZUECn.js} +2 -2
  79. package/dist/useEditOverrides-BmvpLYPU.js +85 -0
  80. package/dist/useEditOverrides-DMAMGzlF.cjs +1 -0
  81. package/dist/{useFaceInfo-XUGYTdfN.js → useFaceInfo-BV77B-r4.js} +4 -4
  82. package/dist/{useFaceResultReader-D8wXbF1L.js → useFaceResultReader-DgOPK1Z6.js} +1 -1
  83. package/dist/{useIrisTracking-B0uLWgNE.js → useIrisTracking-D6mv7coz.js} +10 -10
  84. package/dist/useLiveProps-Bz9wifGN.cjs +1 -0
  85. package/dist/useLiveProps-CMkyV6Dt.js +28 -0
  86. package/dist/{useXRCapabilities-DPUOvpdf.js → useXRCapabilities-FAY2ve86.js} +1 -1
  87. package/dist/utils/useEditOverlay.d.ts +33 -0
  88. package/dist/utils/useEditOverrides.d.ts +10 -0
  89. package/dist/utils/useLiveProps.d.ts +8 -0
  90. package/package.json +1 -1
  91. package/settings.json +1 -1
  92. package/dist/contexts-CSz9stBV.cjs +0 -1
  93. package/dist/contexts-Cl-4dUOI.js +0 -667
  94. package/dist/index-BkjRuUdW.cjs +0 -21
  95. package/dist/useEditOverrides-BBkK8cN2.js +0 -41
  96. package/dist/useEditOverrides-CgapHJzA.cjs +0 -1
package/GROUNDING.md CHANGED
@@ -10,7 +10,7 @@ or spelunk `node_modules` for the API.
10
10
  The API is split into task-domain entry points. Import each symbol from the door
11
11
  this reference shows for it; the imports here are literal.
12
12
 
13
- - `@vincentt-xr/sdk` — **core**: providers, scene, `Scenes` / `Scene` (screens the editor can jump between), screen-space layout, runtime renderers (`Transform3D`, `MeshRenderer`, `SceneObjectRenderer`), `TextLabel`, `Panel`, `SpriteAnimation`, `VideoBackground`, `AspectRatioContainer`, capture/share (`useFrameCapture`, `useMediaRecorder`, `dataURLtoFile`), audio, capability detection (`useXRCapabilities`, `detectXRCapabilities`, `resolveTrackerSupport`), camera permission (`CameraPermissionGate`, `useCameraPermission`), adaptive quality (`useXRQuality`, `XRQualityController`), persistent tracking config (`useXRTrackingConfig`), asset lifecycle (`useXRAsset`, `XRAssetCache`, `defineTextureAsset` / `defineGltfAsset` / `defineVideoAsset`).
13
+ - `@vincentt-xr/sdk` — **core**: providers, scene, `Scenes` / `Scene` (screens the editor can jump between), screen-space layout, runtime renderers (`Transform3D`, `MeshRenderer`, `SceneObjectRenderer`), `TextLabel`, `Panel`, `SpriteAnimation`, `VideoBackground`, `AspectRatioContainer`, capture/share (`useCapture`, `useShare`, `CaptureShareScreen`, `SplashScreen`, `IntroScreen`, `useFrameCapture`, `useMediaRecorder`, `dataURLtoFile`), audio, capability detection (`useXRCapabilities`, `detectXRCapabilities`, `resolveTrackerSupport`), camera permission (`CameraPermissionGate`, `useCameraPermission`), adaptive quality (`useXRQuality`, `XRQualityController`), persistent tracking config (`useXRTrackingConfig`), asset lifecycle (`useXRAsset`, `XRAssetCache`, `defineTextureAsset` / `defineGltfAsset` / `defineVideoAsset`).
14
14
  - `@vincentt-xr/sdk/scene-object` — **public authoring state**: scene-object/component types, factories, selectors, and immutable store operations.
15
15
  - `@vincentt-xr/sdk/tracking` — **trackers**: face/hand/gesture/body/holistic/segmentation, `TrackingAnchor`, `GestureTrigger`, full-body pose / move triggers (`BodyTrigger`, `useBodyTrigger`), the bare `FaceMesh`, `useFaceResults`, gestures, iris, device calibration (`useXRCalibration`), multi-subject policy (`selectSubject`, `useFaceInfo({ subject })`), the hand rig and hand try-on (`HandRig`, `HandOccluder`, `HandAttachment`, `WristAttachment`, `ForearmOccluder`, `HandTattoo`, `HandNails`), touch objects (`HandTouch`, `Touchable`), the SDK-hosted hand, glove and body models (`sdkModelAsset`), the body avatar (`BodyRig`), body occlusion and attachments (`BodyOccluder`, `BodyAttachment`), the body's depth for shaders (`useBodyDepthTexture`), 3D body poses (`BodyPose`) and up to two people with stable ids (`useBodyIds`, `useBodySubject`, `bodyId` / `subject` on every body feature).
16
16
  - `@vincentt-xr/sdk/instructions` — **instructions**: prompts that ask for a hand gesture, face expression or body pose with a 3D hint and your copy (`HandInstruction`, `FaceInstruction`, `BodyInstruction`), the generic `Instruction` layout, the detector hooks (`useHandGesture`, `useFaceExpression`, `useBodyPose`, `useInstructionHold`), the vocabularies + `define*` helpers + pure classifiers, and the hint kit (`useGhostModel`, `HintStage`, `sampleHintLoop`, blends, ghost materials).
@@ -278,7 +278,7 @@ const [scene, setScene] = useState("start");
278
278
  - Use `Scenes` once in the 3D tree (inside `<Canvas>`) and once in the HTML tree, each with the same ids. A scene present in only one tree is fine.
279
279
  - `id` is the name code and comments refer to. Give it lowercase letters, digits, `-` or `_` (1 to 64). It is not editable in the editor and never changes when a creator renames a scene.
280
280
  - `label` is the name shown in the editor's scene list; the editor edits only `label`.
281
- - A published app renders exactly the switch above. The editor's own build swaps in a `Scenes` that can show a chosen scene and catches a scene that throws; app code never imports it (`@vincentt-xr/sdk/editor-scenes` is not for app authors) and must not read `__VCT_EDIT_OVERRIDES__`.
281
+ - A published app renders exactly the switch above. The editor's own build swaps in a `Scenes` that can show a chosen scene and catches a scene that throws; app code never imports it (`@vincentt-xr/sdk/editor-scenes` is not for app authors) and must not read `__VCT_EDIT_OVERRIDES__` or `__VCT_EDIT_OVERLAY__`. The same entry registers the editor's overlay consumer, which shows unsaved edits at known components' props and an `HtmlRegion`'s pending source as a plan rendered with `createElement` from a tag and attribute allowlist (slots reuse the region's own direct children); the core entry carries only an empty slot for it.
282
282
 
283
283
  ### Editable shape — how to write a project the visual editor can edit
284
284
 
@@ -8465,6 +8465,77 @@ time for `starting`, `recording`, `paused`, `stopping`, and `completed`, then
8465
8465
  previews the resulting `recordedBlob` in a video player. Photo and recording
8466
8466
  flows were verified with a real webcam on 26 July 2026.
8467
8467
 
8468
+ ### `useCapture()` and `useShare()` - Take a photo, share it
8469
+
8470
+ `useCapture()` grabs a photo (or records video) of the live canvas and keeps the newest one page-wide
8471
+ as `latest` (`{ kind, blob, url }`), so a Button handler and `<CaptureShareScreen>` see the same
8472
+ capture. It is built on `useMediaRecorder` for video. `useShare()` shares or saves a capture.
8473
+ Both are meant to be called from a tap or click handler (a `Button`'s `onTap` works). Captured
8474
+ media is runtime only, never an editor value.
8475
+
8476
+ ```tsx
8477
+ import { Button, CaptureShareScreen, useCapture, useShare } from "@vincentt-xr/sdk";
8478
+
8479
+ const { takePhoto, startVideo, stopVideo, isRecording, latest, clear } = useCapture({
8480
+ audio: false,
8481
+ });
8482
+ const { share, save, canShareFile } = useShare();
8483
+
8484
+ <Button name="Snap" label="Take photo" onTap={() => void takePhoto()} />;
8485
+ <CaptureShareScreen name="Share screen" shareText="Look at this" shareLink="https://example.com" />;
8486
+ ```
8487
+
8488
+ - `takePhoto(): Promise<CapturedMedia | null>`, `startVideo(): Promise<void>`, `stopVideo(): void`,
8489
+ `clear()` (the viewer's retake). With no live user gesture, `takePhoto` and `startVideo` do
8490
+ nothing and `takePhoto` returns `null`.
8491
+ - `share(media, { text?, url?, title?, filename? }): Promise<"shared" | "dismissed" | "downloaded" | "blocked">`.
8492
+ `url` is used only when it is `https://`; `text` is capped at 280 characters.
8493
+ - `save(media, filename?): boolean` downloads the file.
8494
+ - Web Share needs a user gesture; sharing files also needs a secure context (https) and
8495
+ `navigator.canShare({ files })`. Where that is missing, `share` downloads the file instead
8496
+ (`"downloaded"`). A dismissed sheet is `"dismissed"` and does nothing else.
8497
+
8498
+ `<CaptureShareScreen>` (listed under Editable components) shows `latest` with Save, Share and
8499
+ Retake buttons once a photo exists; the editor shows it with a placeholder image.
8500
+
8501
+ ### Splash screen
8502
+
8503
+ `<SplashScreen>` is a loading screen with a logo, title and subtitle. Pass it to `XRScene`; it stays
8504
+ up at least `minimumShowTime` milliseconds (capped at 10000), counted from when `XRScene` mounts.
8505
+
8506
+ ```tsx
8507
+ import { SplashScreen, XRScene } from "@vincentt-xr/sdk";
8508
+
8509
+ <XRScene
8510
+ loadingComponent={<SplashScreen logo="/images/logo.png" title="Welcome" minimumShowTime={1500} />}
8511
+ />;
8512
+ ```
8513
+
8514
+ `logo` must be a project path (`/images/...`); colours are `#hex`, `rgb()` or `hsl()`. It exists only
8515
+ while loading, so the editor shows it only with `pinVisible`, which does nothing in a published app.
8516
+
8517
+ ### Instructions screen
8518
+
8519
+ `<IntroScreen>` is a full-page instructions and camera permission screen: image, title, body and one
8520
+ button. Do not confuse it with `Instruction`, the in-scene gesture cue. The button calls `onContinue`
8521
+ synchronously from the tap, which the browser needs to show the camera prompt; start the session there.
8522
+
8523
+ ```tsx
8524
+ import { IntroScreen } from "@vincentt-xr/sdk";
8525
+
8526
+ <IntroScreen
8527
+ title="Before you start"
8528
+ body="Allow the camera and hold your phone at arm's length."
8529
+ image="/images/steps.png"
8530
+ buttonLabel="Start"
8531
+ onContinue={() => start()}
8532
+ />;
8533
+ ```
8534
+
8535
+ The screen hides itself after the tap. Without `onContinue` the button does nothing and the editor
8536
+ lists the screen as Not wired yet. The editor shows `onContinue` read-only and never changes it.
8537
+ `image` must be a project path; `pinVisible` keeps it visible in Edit and does nothing when published.
8538
+
8468
8539
  ---
8469
8540
 
8470
8541
  ## Audio
@@ -8885,6 +8956,28 @@ Insert:
8885
8956
  <Button label="Button" />
8886
8957
  ```
8887
8958
 
8959
+ ### `<CaptureShareScreen>` - Capture and share
8960
+
8961
+ Import: `import { CaptureShareScreen } from "@vincentt-xr/sdk"`.
8962
+ The screen shown after the viewer takes a photo: Save, Share and Retake buttons. Take the photo from a tap with `useCapture().takePhoto()`; nothing is captured or shared without the viewer's tap. `shareLink` must be https. Share falls back to a download where the browser cannot share files.
8963
+
8964
+ | Prop | Label | Control |
8965
+ | ------------- | ----------------- | ------------------------ |
8966
+ | `saveLabel` | Save label | shortText, max 40 chars |
8967
+ | `shareLabel` | Share label | shortText, max 40 chars |
8968
+ | `retakeLabel` | Retake label | shortText, max 40 chars |
8969
+ | `shareText` | Share text | longText, max 280 chars |
8970
+ | `shareLink` | Share link | link, max 2048 chars |
8971
+ | `caption` | Caption | shortText, max 120 chars |
8972
+ | `background` | Background colour | colour |
8973
+ | `color` | Text colour | colour |
8974
+
8975
+ Insert:
8976
+
8977
+ ```tsx
8978
+ <CaptureShareScreen />
8979
+ ```
8980
+
8888
8981
  ### `<HtmlRegion>` - Text block
8889
8982
 
8890
8983
  Import: `import { HtmlRegion } from "@vincentt-xr/sdk"`.
@@ -8899,6 +8992,28 @@ Insert:
8899
8992
  <HtmlRegion />
8900
8993
  ```
8901
8994
 
8995
+ ### `<IntroScreen>` - Instructions
8996
+
8997
+ Import: `import { IntroScreen } from "@vincentt-xr/sdk"`.
8998
+ Instructions and camera permission screen. Wire `onContinue` to the session start; it runs straight from the viewer's tap, which the camera prompt needs. Without `onContinue` it is listed as Not wired yet. `pinVisible` is editor-only.
8999
+
9000
+ | Prop | Label | Control |
9001
+ | ------------- | ----------------- | ----------------------- |
9002
+ | `title` | Title | shortText, max 80 chars |
9003
+ | `body` | Instructions | longText, max 500 chars |
9004
+ | `image` | Image | file, accepts image |
9005
+ | `buttonLabel` | Button label | shortText, max 40 chars |
9006
+ | `onContinue` | When continued | code |
9007
+ | `background` | Background colour | colour |
9008
+ | `color` | Text colour | colour |
9009
+ | `pinVisible` | Show in editor | switch |
9010
+
9011
+ Insert:
9012
+
9013
+ ```tsx
9014
+ <IntroScreen />
9015
+ ```
9016
+
8902
9017
  ### `<Light>` - Light
8903
9018
 
8904
9019
  Import: `import { Light } from "@vincentt-xr/sdk"`.
@@ -9034,4 +9149,25 @@ Insert:
9034
9149
  />
9035
9150
  ```
9036
9151
 
9152
+ ### `<SplashScreen>` - Splash
9153
+
9154
+ Import: `import { SplashScreen } from "@vincentt-xr/sdk"`.
9155
+ Loading screen: `<XRScene loadingComponent={<SplashScreen />} />`. `pinVisible` is editor-only.
9156
+
9157
+ | Prop | Label | Control |
9158
+ | ----------------- | ----------------- | ------------------------ |
9159
+ | `logo` | Logo | file, accepts image |
9160
+ | `title` | Title | shortText, max 80 chars |
9161
+ | `subtitle` | Subtitle | shortText, max 160 chars |
9162
+ | `background` | Background colour | colour |
9163
+ | `color` | Text colour | colour |
9164
+ | `minimumShowTime` | Minimum show time | number, 0.., ms |
9165
+ | `pinVisible` | Show in editor | switch |
9166
+
9167
+ Insert:
9168
+
9169
+ ```tsx
9170
+ <SplashScreen />
9171
+ ```
9172
+
9037
9173
  <!-- editable-components:end -->
package/components.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": "vincentt.components/1",
3
3
  "package": "@vincentt-xr/sdk",
4
- "version": "2.0.0-alpha.21",
4
+ "version": "2.0.0-alpha.23",
5
5
  "components": {
6
6
  "AudioPlayer": {
7
7
  "kind": "sound",
@@ -46,6 +46,24 @@
46
46
  },
47
47
  "insert": { "jsx": "<Button label=\"Button\" />" }
48
48
  },
49
+ "CaptureShareScreen": {
50
+ "kind": "screen",
51
+ "label": "Capture and share",
52
+ "tree": "html",
53
+ "from": "@vincentt-xr/sdk",
54
+ "nameFrom": "fixed",
55
+ "props": {
56
+ "saveLabel": { "control": "shortText", "label": "Save label", "maxLength": 40 },
57
+ "shareLabel": { "control": "shortText", "label": "Share label", "maxLength": 40 },
58
+ "retakeLabel": { "control": "shortText", "label": "Retake label", "maxLength": 40 },
59
+ "shareText": { "control": "longText", "label": "Share text", "maxLength": 280 },
60
+ "shareLink": { "control": "link", "label": "Share link", "maxLength": 2048 },
61
+ "caption": { "control": "shortText", "label": "Caption", "maxLength": 120 },
62
+ "background": { "control": "colour", "label": "Background colour", "group": "Style" },
63
+ "color": { "control": "colour", "label": "Text colour", "group": "Style" }
64
+ },
65
+ "insert": { "jsx": "<CaptureShareScreen />" }
66
+ },
49
67
  "HtmlRegion": {
50
68
  "kind": "region",
51
69
  "label": "Text block",
@@ -55,6 +73,24 @@
55
73
  "props": {},
56
74
  "insert": { "jsx": "<HtmlRegion />" }
57
75
  },
76
+ "IntroScreen": {
77
+ "kind": "screen",
78
+ "label": "Instructions",
79
+ "tree": "html",
80
+ "from": "@vincentt-xr/sdk",
81
+ "nameFrom": "fixed",
82
+ "props": {
83
+ "title": { "control": "shortText", "label": "Title", "maxLength": 80 },
84
+ "body": { "control": "longText", "label": "Instructions", "maxLength": 500 },
85
+ "image": { "control": "file", "label": "Image", "accept": "image" },
86
+ "buttonLabel": { "control": "shortText", "label": "Button label", "maxLength": 40 },
87
+ "onContinue": { "control": "code", "label": "When continued" },
88
+ "background": { "control": "colour", "label": "Background colour", "group": "Style" },
89
+ "color": { "control": "colour", "label": "Text colour", "group": "Style" },
90
+ "pinVisible": { "control": "switch", "label": "Show in editor", "group": "Preview" }
91
+ },
92
+ "insert": { "jsx": "<IntroScreen />" }
93
+ },
58
94
  "Light": {
59
95
  "kind": "light",
60
96
  "label": "Light",
@@ -218,6 +254,30 @@
218
254
  "insert": {
219
255
  "jsx": "<ScreenText text=\"Your text\" screenTransform={{ position: { x: 0, y: 0 }, size: { width: 600, height: 120 } }} />"
220
256
  }
257
+ },
258
+ "SplashScreen": {
259
+ "kind": "screen",
260
+ "label": "Splash",
261
+ "tree": "html",
262
+ "from": "@vincentt-xr/sdk",
263
+ "nameFrom": "fixed",
264
+ "props": {
265
+ "logo": { "control": "file", "label": "Logo", "accept": "image" },
266
+ "title": { "control": "shortText", "label": "Title", "maxLength": 80 },
267
+ "subtitle": { "control": "shortText", "label": "Subtitle", "maxLength": 160 },
268
+ "background": { "control": "colour", "label": "Background colour", "group": "Style" },
269
+ "color": { "control": "colour", "label": "Text colour", "group": "Style" },
270
+ "minimumShowTime": {
271
+ "control": "number",
272
+ "label": "Minimum show time",
273
+ "showWhenAbsent": true,
274
+ "min": 0,
275
+ "step": 100,
276
+ "unit": "ms"
277
+ },
278
+ "pinVisible": { "control": "switch", "label": "Show in editor", "group": "Preview" }
279
+ },
280
+ "insert": { "jsx": "<SplashScreen />" }
221
281
  }
222
282
  }
223
283
  }
@@ -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-BDxJWWyy.js";
6
- import { u as P } from "./index-CbBCl2ZU.js";
7
- import { b as y } from "./selectors-J06V0eDb.js";
5
+ import { j as w, n as d } from "./index-BmeB_V6I.js";
6
+ import { u as P } from "./index-BTVIMj8H.js";
7
+ import { b as y } from "./selectors-kj5g3uv2.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-BoFDq5hC.js";
4
+ import { f as i } from "./internal-DDcTDvPS.js";
5
5
  const v = {
6
6
  position: "fixed",
7
7
  top: "10px",
@@ -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-C0wu5Cwg.js";
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-DYc2-EBT.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-BDxJWWyy.js";
6
- import { u as be } from "./landmarks-C3LvDhMt.js";
5
+ import { j as fe } from "./index-BmeB_V6I.js";
6
+ import { u as be } from "./landmarks-BB8jyfJA.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-J06V0eDb.js";
9
+ import { c as Ee } from "./selectors-kj5g3uv2.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,2 +1,2 @@
1
- "use strict";const H=require("react/jsx-runtime"),x=require("react"),ve=require("@react-three/fiber"),Me=require("./context-hA0Rb2Xa.cjs"),Te=require("./useEditOverrides-CgapHJzA.cjs"),xe=require("three");function Oe(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=Oe(xe),Le=({children:t,depth:e=0})=>{const{camera:n,size:r}=ve.useThree(),a=x.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(Me.ScreenSpaceContext.Provider,{value:a,children:H.jsx("group",{position:[0,0,e],children:t})})},de=x.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})]}));de.displayName="TextLabelMesh";const Fe={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},ue=t=>{x.useEffect(()=>()=>{t==null||t.dispose()},[t])};function We(t,e,n){return n==="left"?e:n==="right"?t-e:t/2}function Ye(t,e,n,r,a){return a==="top"?e+n/2:a==="bottom"?t-e-r+n/2:t/2-(r-n)/2}function ke(t,e,n,r){return r==="full"||n==="left"?0:n==="right"?t-e:(t-e)/2}function be(t,e,n,r){return`${t} ${e} ${n}px ${r}`}function R(t,e){const n=Math.max(0,Math.min(e,1));return t*n*.08}function me(t,e){const n=Math.max(0,Math.min(e,1));return t*(1.2+n*.6)}function Se(t,e){"letterSpacing"in t&&(t.letterSpacing=`${e}px`)}function ye(t){"letterSpacing"in t&&(t.letterSpacing="0px")}function p(t,e,n){Se(t,n);const r=t.measureText(e).width;return ye(t),r}function J(t,e,n,r){return Math.max(1,Math.floor((t-e*2)/me(n,r)))}function Pe(t,e,n,r,a){return e.length<=r&&e.every(i=>p(t,i,a)<=n)}function V(t,e,n,r,a,i,l,f){t.font=be(r,a,i,l);const s=e.split(" "),h=[];let o="";for(const d of s){const c=o?`${o} ${d}`:d;p(t,c,f)>n&&o?(h.push(o),o=d):o=c}return o&&h.push(o),h}function fe(t,e,n,r,a,i,l,f){const h=e.split(/\r?\n/).flatMap(o=>o.trim().length===0?[""]:V(t,o,n,r,a,i,l,f));return h.length>0?h:[e]}function we(t,e,n,r,a){const i=r?"...":"";let l=e.trimEnd();for(;l.length>0&&p(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(p(t,i,a)<=n)return i;const f=l===e.length-1;return we(t,i,n,r==="ellipsis"&&f,a)})}function he(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]=we(t,f,r,a,i),K(t,l,r,a?"ellipsis":"clip",i)}function He(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=R(b,d),y=r??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c);const C=S===!0||u==="shrink";for(;C&&!Pe(e,y,a,v,m)&&b>g&&(b=Math.max(g,b-4),m=R(b,d),y=r??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c),b!==g););return u==="ellipsis"?y=he(e,y,v,a,!0,m):u==="clamp"||u==="shrink"?y=he(e,y,v,a,!1,m):u!=="clip"&&(y=K(e,y,a,void 0,m)),{fontSize:b,lines:y}}function Xe(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=V(e,n,r,l,f,c,h,R(c,o));const S=J(a,i,c,d);return u.length>S&&(c=Math.max(12,Math.round(c*.75)),u=V(e,n,r,l,f,c,h,R(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 pe(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?He({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}):Xe({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=be(e.fontStyle,e.fontWeight,i,e.fontFamily);const f=R(i,e.letterSpacing),s=me(i,e.lineSpacing),h=Math.max(i,i+(l.length-1)*s),o=Ye(e.height,e.padding,i,h,e.verticalAlign),d=l.map(c=>p(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:We(e.width,e.padding,e.textAlign)}}function Ae(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 ce(t,e,n){return typeof t!="number"||Number.isNaN(t)||t<=0?e:Math.min(t,n)}function Be(t,e){const n=ke(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);Ae(t,n,r,e.panelWidth,e.panelHeight,a),ze(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 ze(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(),Re(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 Re(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 Ie(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){Ee(t,e,n,r,a,i,l,f);return}Se(t,a),i==="fill"?t.fillText(e,n,r):t.strokeText(e,n,r),ye(t)}function Ee(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],C=b+v/2,W=(C-c-o/2)/g,O=Ie(l,W,m,s.length,S,g);t.save(),t.translate(C+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 ge(t,e,n,r,a,i,l,f,s){const h=p(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 De(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&&ge(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"underline"),e.strikethrough&&ge(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"strikethrough")}}function $e(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 je(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 qe(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:C,bgWidth:W,bgHeight:O,bgGradientStops:L,bgTextureImage:F,bgTextureFit:I,bgTextureFlipX:E,bgTextureFlipY:D,underline:$,strikethrough:j,bendPreset:Y,bendStrength:k}=t;let{fontSize:A,bgColor:B}=t;const q=[...a??[],...i&&l>0?[{color:i,width:l,opacity:f}]:[]].filter(T=>T.width>0),G=[...s??[],...d&&(c>0||u!==0||S!==0)?[{color:d,blur:c,offsetX:u,offsetY:S,opacity:g}]:[]].filter(T=>T.blur>0||(T.offsetX??0)!==0||(T.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=pe(M,t);if(A=w.fontSize,B!=="transparent"){const T=C===!0,_=ce(T?void 0:W,v==="text"||T?w.textBlockWidth:e,e),N=ce(T?void 0:O,v==="text"||T?w.textBlockHeight:n,n);Be(M,{canvasWidth:e,canvasHeight:n,textAlign:b,bgFit:v,panelWidth:_,panelHeight:N,bgColor:B,bgFillMode:m,bgOpacity:y,bgGradientStops:L,bgTextureImage:F,bgTextureFit:I,bgTextureFlipX:E,bgTextureFlipY:D,borderColor:t.borderColor,borderWidth:t.borderWidth,borderRadius:t.borderRadius})}return o&&$e(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}),De(M,{lines:w.resolvedLines,textX:w.textX,startY:w.startY,lineHeight:w.lineHeight,textAlign:b,color:r,fontSize:A,letterSpacingPx:w.letterSpacingPx,bendPreset:Y,bendStrength:k,shadowLayers:G,strokeLayers:q,underline:$,strikethrough:j}),h&&je(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 Ge(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:C,fontSize:W,textAlign:O,verticalAlign:L,overflow:F,resizeToFit:I,minFontSize:E,letterSpacing:D,lineSpacing:$,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:A,bgWidth:B,bgHeight:q,bgGradientStops:G,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:M,borderColor:w,borderWidth:T,borderRadius:_,padding:N,aspect:Z,resolution:U,underline:ee,strikethrough:te,bendPreset:ne,bendStrength:re}=t,ie=x.useMemo(()=>i===!1?[]:a,[i,a]),ae=x.useMemo(()=>o===!1?[]:h,[o,h]),le=void 0,oe=x.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:C,fontSize:W,textAlign:O,verticalAlign:L,overflow:F,resizeToFit:I,minFontSize:E,letterSpacing:D,lineSpacing:$,bgColor:e.bgColor,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:A,bgWidth:B,bgHeight:q,bgGradientStops:G,bgTextureImage:le,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:M,borderColor:w,borderWidth:T,borderRadius:_,padding:N,height:U,width:Math.round(U*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,C,W,O,L,F,I,E,D,$,j,Y,k,A,B,q,G,le,P,z,M,w,T,_,N,Z,U,ee,te,ne,re]),se=x.useMemo(()=>qe(oe),[oe]);return ue(se),se}const _e=["color"];function Ne(t){const e=Te.useEditOverrides(t,_e),n={...Fe,...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]=x.useState(null),[g,b]=x.useState(null),m=x.useRef(r);m.current!==r&&(m.current=r,u!==null&&S(null));const y=x.useRef(a);y.current!==a&&(y.current=a,g!==null&&b(null));const v=x.useRef(null),O=Ge(n,{text:u??r,bgColor:g??a});return x.useEffect(()=>{const L=v.current;if(L)return L.userData.setText=F=>S(F),L.userData.setBgColor=F=>b(F),()=>{delete L.userData.setText,delete L.userData.setBgColor}},[]),H.jsx(de,{ref:v,name:l,texture:O,overlay:f,opacity:i,position:s,rotation:h,scale:o,visible:d,renderOrder:c})}exports.ScreenSpaceUI=Le;exports.TextLabel=Ne;exports.useOwnedTexture=ue;
1
+ "use strict";const H=require("react/jsx-runtime"),x=require("react"),Te=require("@react-three/fiber"),Me=require("./context-hA0Rb2Xa.cjs"),de=require("./useEditOverrides-DMAMGzlF.cjs"),xe=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(xe),Oe=({children:t,depth:e=0})=>{const{camera:n,size:r}=Te.useThree(),a=x.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(Me.ScreenSpaceContext.Provider,{value:a,children:H.jsx("group",{position:[0,0,e],children:t})})},ue=x.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})]}));ue.displayName="TextLabelMesh";const Fe={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},be=t=>{x.useEffect(()=>()=>{t==null||t.dispose()},[t])};function We(t,e,n){return n==="left"?e:n==="right"?t-e:t/2}function Ye(t,e,n,r,a){return a==="top"?e+n/2:a==="bottom"?t-e-r+n/2:t/2-(r-n)/2}function ke(t,e,n,r){return r==="full"||n==="left"?0:n==="right"?t-e:(t-e)/2}function me(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 Se(t,e){const n=Math.max(0,Math.min(e,1));return t*(1.2+n*.6)}function ye(t,e){"letterSpacing"in t&&(t.letterSpacing=`${e}px`)}function we(t){"letterSpacing"in t&&(t.letterSpacing="0px")}function A(t,e,n){ye(t,n);const r=t.measureText(e).width;return we(t),r}function J(t,e,n,r){return Math.max(1,Math.floor((t-e*2)/Se(n,r)))}function Pe(t,e,n,r,a){return e.length<=r&&e.every(i=>A(t,i,a)<=n)}function V(t,e,n,r,a,i,l,f){t.font=me(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 fe(t,e,n,r,a,i,l,f){const h=e.split(/\r?\n/).flatMap(o=>o.trim().length===0?[""]:V(t,o,n,r,a,i,l,f));return h.length>0?h:[e]}function ve(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 ve(t,i,n,r==="ellipsis"&&f,a)})}function he(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]=ve(t,f,r,a,i),K(t,l,r,a?"ellipsis":"clip",i)}function He(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??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c);const C=S===!0||u==="shrink";for(;C&&!Pe(e,y,a,v,m)&&b>g&&(b=Math.max(g,b-4),m=E(b,d),y=r??fe(e,n,a,f,s,b,o,m),v=J(i,l,b,c),b!==g););return u==="ellipsis"?y=he(e,y,v,a,!0,m):u==="clamp"||u==="shrink"?y=he(e,y,v,a,!1,m):u!=="clip"&&(y=K(e,y,a,void 0,m)),{fontSize:b,lines:y}}function Xe(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=V(e,n,r,l,f,c,h,E(c,o));const S=J(a,i,c,d);return u.length>S&&(c=Math.max(12,Math.round(c*.75)),u=V(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 Ae(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?He({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}):Xe({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=me(e.fontStyle,e.fontWeight,i,e.fontFamily);const f=E(i,e.letterSpacing),s=Se(i,e.lineSpacing),h=Math.max(i,i+(l.length-1)*s),o=Ye(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:We(e.width,e.padding,e.textAlign)}}function pe(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 ce(t,e,n){return typeof t!="number"||Number.isNaN(t)||t<=0?e:Math.min(t,n)}function Be(t,e){const n=ke(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);pe(t,n,r,e.panelWidth,e.panelHeight,a),ze(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 ze(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(),Ee(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 Ee(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 Ie(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){Re(t,e,n,r,a,i,l,f);return}ye(t,a),i==="fill"?t.fillText(e,n,r):t.strokeText(e,n,r),we(t)}function Re(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],C=b+v/2,W=(C-c-o/2)/g,L=Ie(l,W,m,s.length,S,g);t.save(),t.translate(C+L.xOffset,r+L.yOffset),t.rotate(L.rotation),t.scale(L.scaleX,L.scaleY),t.textAlign="center",i==="fill"?t.fillText(y,0,0):t.strokeText(y,0,0),t.restore(),b+=v+a}}function ge(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 De(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&&ge(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"underline"),e.strikethrough&&ge(t,r,e.textX,a,e.textAlign,e.color,e.fontSize,e.letterSpacingPx,"strikethrough")}}function $e(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 je(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 qe(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:C,bgWidth:W,bgHeight:L,bgGradientStops:O,bgTextureImage:F,bgTextureFit:I,bgTextureFlipX:R,bgTextureFlipY:D,underline:$,strikethrough:j,bendPreset:Y,bendStrength:k}=t;let{fontSize:p,bgColor:B}=t;const q=[...a??[],...i&&l>0?[{color:i,width:l,opacity:f}]:[]].filter(M=>M.width>0),G=[...s??[],...d&&(c>0||u!==0||S!==0)?[{color:d,blur:c,offsetX:u,offsetY:S,opacity:g}]:[]].filter(M=>M.blur>0||(M.offsetX??0)!==0||(M.offsetY??0)!==0);let P;const z=Q(e,n),T=z.getContext("2d");T.clearRect(0,0,e,n),T.fillStyle=r,T.textAlign=b,T.textBaseline="middle";const w=Ae(T,t);if(p=w.fontSize,B!=="transparent"){const M=C===!0,_=ce(M?void 0:W,v==="text"||M?w.textBlockWidth:e,e),N=ce(M?void 0:L,v==="text"||M?w.textBlockHeight:n,n);Be(T,{canvasWidth:e,canvasHeight:n,textAlign:b,bgFit:v,panelWidth:_,panelHeight:N,bgColor:B,bgFillMode:m,bgOpacity:y,bgGradientStops:O,bgTextureImage:F,bgTextureFit:I,bgTextureFlipX:R,bgTextureFlipY:D,borderColor:t.borderColor,borderWidth:t.borderWidth,borderRadius:t.borderRadius})}return o&&$e(T,{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}),De(T,{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:G,strokeLayers:q,underline:$,strikethrough:j}),h&&je(T,{width:e,height:n,font:T.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 Ge(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:C,fontSize:W,textAlign:L,verticalAlign:O,overflow:F,resizeToFit:I,minFontSize:R,letterSpacing:D,lineSpacing:$,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:p,bgWidth:B,bgHeight:q,bgGradientStops:G,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:T,borderColor:w,borderWidth:M,borderRadius:_,padding:N,aspect:Z,resolution:U,underline:ee,strikethrough:te,bendPreset:ne,bendStrength:re}=t,ie=x.useMemo(()=>i===!1?[]:a,[i,a]),ae=x.useMemo(()=>o===!1?[]:h,[o,h]),le=void 0,oe=x.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:C,fontSize:W,textAlign:L,verticalAlign:O,overflow:F,resizeToFit:I,minFontSize:R,letterSpacing:D,lineSpacing:$,bgColor:e.bgColor,bgFillMode:j,bgOpacity:Y,bgFit:k,bgAutoSize:p,bgWidth:B,bgHeight:q,bgGradientStops:G,bgTextureImage:le,bgTextureFit:P,bgTextureFlipX:z,bgTextureFlipY:T,borderColor:w,borderWidth:M,borderRadius:_,padding:N,height:U,width:Math.round(U*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,C,W,L,O,F,I,R,D,$,j,Y,k,p,B,q,G,le,P,z,T,w,M,_,N,Z,U,ee,te,ne,re]),se=x.useMemo(()=>qe(oe),[oe]);return be(se),se}const _e=["color"],Ne={color:de.isLiveColour};function Ue(t){const e=de.useEditOverrides(t,_e,Ne),n={...Fe,...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]=x.useState(null),[g,b]=x.useState(null),m=x.useRef(r);m.current!==r&&(m.current=r,u!==null&&S(null));const y=x.useRef(a);y.current!==a&&(y.current=a,g!==null&&b(null));const v=x.useRef(null),L=Ge(n,{text:u??r,bgColor:g??a});return x.useEffect(()=>{const O=v.current;if(O)return O.userData.setText=F=>S(F),O.userData.setBgColor=F=>b(F),()=>{delete O.userData.setText,delete O.userData.setBgColor}},[]),H.jsx(ue,{ref:v,name:l,texture:L,overlay:f,opacity:i,position:s,rotation:h,scale:o,visible:d,renderOrder:c})}exports.ScreenSpaceUI=Oe;exports.TextLabel=Ue;exports.useOwnedTexture=be;