@needle-tools/engine 5.1.8 → 5.1.9

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 (64) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{needle-engine.bundle-X7Y4A-EO.min.js → needle-engine.bundle-CHq9xqXv.min.js} +144 -144
  3. package/dist/{needle-engine.bundle-D8gP8Nd0.umd.cjs → needle-engine.bundle-DYPk7VZg.umd.cjs} +146 -146
  4. package/dist/{needle-engine.bundle-CaD5rOJ0.js → needle-engine.bundle-XZ6cKssu.js} +6086 -6052
  5. package/dist/needle-engine.d.ts +49 -25
  6. package/dist/needle-engine.js +251 -251
  7. package/dist/needle-engine.min.js +1 -1
  8. package/dist/needle-engine.umd.cjs +1 -1
  9. package/lib/engine/api.d.ts +1 -1
  10. package/lib/engine/api.js +1 -1
  11. package/lib/engine/api.js.map +1 -1
  12. package/lib/engine/engine_init.js +2 -2
  13. package/lib/engine/engine_init.js.map +1 -1
  14. package/lib/engine/engine_license.d.ts +7 -7
  15. package/lib/engine/engine_license.js +71 -71
  16. package/lib/engine/engine_license.js.map +1 -1
  17. package/lib/engine/engine_networking_blob.js +3 -3
  18. package/lib/engine/engine_networking_blob.js.map +1 -1
  19. package/lib/engine/engine_utils_qrcode.js +2 -2
  20. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  21. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  22. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  23. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  24. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  25. package/lib/engine/webcomponents/needle-engine.ar-overlay.js +11 -0
  26. package/lib/engine/webcomponents/needle-engine.ar-overlay.js.map +1 -1
  27. package/lib/engine/webcomponents/needle-engine.js +2 -2
  28. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  29. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  30. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  31. package/lib/engine/xr/NeedleXRSession.d.ts +7 -2
  32. package/lib/engine/xr/NeedleXRSession.js +65 -5
  33. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  34. package/lib/engine/xr/TempXRContext.js +2 -2
  35. package/lib/engine/xr/TempXRContext.js.map +1 -1
  36. package/lib/engine-components/Component.d.ts +2 -1
  37. package/lib/engine-components/Component.js.map +1 -1
  38. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  39. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  40. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +35 -18
  41. package/lib/engine-components/webxr/WebXRImageTracking.js +93 -78
  42. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  43. package/lib/engine-components/webxr/WebXRImageTracking.utils.d.ts +35 -0
  44. package/lib/engine-components/webxr/WebXRImageTracking.utils.js +96 -0
  45. package/lib/engine-components/webxr/WebXRImageTracking.utils.js.map +1 -0
  46. package/package.json +1 -1
  47. package/plugins/common/license.js +4 -4
  48. package/plugins/vite/license.js +4 -4
  49. package/src/engine/api.ts +1 -1
  50. package/src/engine/engine_init.ts +2 -2
  51. package/src/engine/engine_license.ts +68 -68
  52. package/src/engine/engine_networking_blob.ts +3 -3
  53. package/src/engine/engine_utils_qrcode.ts +2 -2
  54. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  55. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  56. package/src/engine/webcomponents/needle-engine.ar-overlay.ts +13 -0
  57. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  58. package/src/engine/webcomponents/needle-engine.ts +2 -2
  59. package/src/engine/xr/NeedleXRSession.ts +68 -8
  60. package/src/engine/xr/TempXRContext.ts +2 -2
  61. package/src/engine-components/Component.ts +2 -1
  62. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  63. package/src/engine-components/webxr/WebXRImageTracking.ts +120 -66
  64. package/src/engine-components/webxr/WebXRImageTracking.utils.ts +105 -0
@@ -0,0 +1,96 @@
1
+ import { isDevEnvironment } from "../../engine/debug/index.js";
2
+ import { getParam } from "../../engine/engine_utils.js";
3
+ // Kept in a dedicated module (with only lightweight imports) so the marker-loading logic can be unit
4
+ // tested without pulling in the heavy WebXRImageTracking / USDZ exporter import graph.
5
+ const debug = getParam("debugimagetracking");
6
+ /**
7
+ * Cache of decoded marker bitmaps, keyed by image url.
8
+ * Also read by the USDZ exporter (see {@link WebXRImageTracking}) to embed the marker into the .usdz.
9
+ */
10
+ export const _imageElements = new Map();
11
+ const _imageLoadingPromises = new Map();
12
+ /**
13
+ * Resolve marker bitmaps for the given tracked-image models and append them to `args.trackedImages`
14
+ * (the list handed to `navigator.xr.requestSession`).
15
+ *
16
+ * Every valid marker is awaited so that images which are still decoding when the XR session is
17
+ * requested get included instead of being silently dropped (which previously caused markers to only
18
+ * work after re-entering AR). Loading happens in parallel and never rejects: a marker that can not be
19
+ * loaded is skipped individually so a single unavailable image can not fail the whole session request.
20
+ *
21
+ * @param models The configured tracked-image models
22
+ * @param args The session init object; `trackedImages` is created if missing and appended to
23
+ * @param load Injectable loader (defaults to {@link loadImage}); resolves the decoded bitmap or null
24
+ * @returns Map of `trackedImages` index -> model for the appended images (used to resolve results)
25
+ */
26
+ export async function collectTrackedImages(models, args, load = loadImage) {
27
+ const indexMap = new Map();
28
+ if (!args.trackedImages)
29
+ args.trackedImages = [];
30
+ if (!models)
31
+ return indexMap;
32
+ const valid = models.filter(m => !!m.image?.length && m.widthInMeters > 0);
33
+ // Load in parallel and wait for all of them. Guard every load with a catch so that a rejecting
34
+ // loader is treated as "unavailable" (null) rather than aborting the whole session request.
35
+ const bitmaps = await Promise.all(valid.map(m => load(m.image).catch(() => null)));
36
+ for (let i = 0; i < valid.length; i++) {
37
+ const model = valid[i];
38
+ const bitmap = bitmaps[i];
39
+ if (bitmap) {
40
+ indexMap.set(args.trackedImages.length, model);
41
+ args.trackedImages.push({ image: bitmap, widthInMeters: model.widthInMeters });
42
+ }
43
+ else if (isDevEnvironment() || debug) {
44
+ console.warn(`[WebXRImageTracking] Marker image could not be loaded, skipping: ${model.image}`);
45
+ }
46
+ }
47
+ return indexMap;
48
+ }
49
+ /**
50
+ * Load and decode a marker image into an {@link ImageBitmap}, caching it in {@link _imageElements}.
51
+ * Idempotent: concurrent or repeated calls for the same URL share a single in-flight load.
52
+ *
53
+ * Resolves to `null` and never rejects when the image can not be fetched or decoded, so callers can
54
+ * skip an unavailable marker without failing the surrounding XR session request. A failed load clears
55
+ * its cache entry so a later attempt (e.g. re-entering AR) can retry.
56
+ */
57
+ export async function loadImage(url) {
58
+ const cached = _imageElements.get(url);
59
+ if (cached)
60
+ return cached;
61
+ const pending = _imageLoadingPromises.get(url);
62
+ if (pending)
63
+ return pending;
64
+ const promise = new Promise(res => {
65
+ _imageElements.set(url, null); // placeholder to dedupe concurrent loads
66
+ if (isDevEnvironment() || debug)
67
+ console.debug(`[WebXRImageTracking] Start loading image for tracking: ${url}`);
68
+ const imageElement = document.createElement("img");
69
+ imageElement.addEventListener("load", async () => {
70
+ try {
71
+ const img = await createImageBitmap(imageElement);
72
+ _imageElements.set(url, img);
73
+ if (isDevEnvironment() || debug)
74
+ console.debug(`[WebXRImageTracking] Loaded image for tracking: ${url}`);
75
+ res(img);
76
+ }
77
+ catch (err) {
78
+ console.error(`[WebXRImageTracking] Failed to decode marker image for tracking: ${url}`, err);
79
+ _imageElements.delete(url); // allow a retry later (e.g. re-entering AR)
80
+ res(null);
81
+ }
82
+ });
83
+ imageElement.addEventListener("error", (evt) => {
84
+ console.error(`[WebXRImageTracking] Failed to load marker image for tracking: ${url}`, evt);
85
+ _imageElements.delete(url); // allow a retry later (e.g. re-entering AR)
86
+ res(null);
87
+ });
88
+ imageElement.src = url;
89
+ });
90
+ _imageLoadingPromises.set(url, promise);
91
+ promise.finally(() => {
92
+ _imageLoadingPromises.delete(url);
93
+ });
94
+ return promise;
95
+ }
96
+ //# sourceMappingURL=WebXRImageTracking.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebXRImageTracking.utils.js","sourceRoot":"","sources":["../../../src/engine-components/webxr/WebXRImageTracking.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAIxD,qGAAqG;AACrG,uFAAuF;AAEvF,MAAM,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoC,IAAI,GAAG,EAAE,CAAC;AACzE,MAAM,qBAAqB,GAA6C,IAAI,GAAG,EAAE,CAAC;AAElF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACtC,MAA6D,EAC7D,IAA8E,EAC9E,OAAqD,SAAS;IAE9D,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC5D,IAAI,CAAC,IAAI,CAAC,aAAa;QAAE,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IACjD,IAAI,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IAC3E,+FAA+F;IAC/F,4FAA4F;IAC5F,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE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-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.",
5
5
  "main": "dist/needle-engine.min.js",
6
6
  "exports": {
@@ -127,7 +127,7 @@ async function requestNeedleCloud(path, options) {
127
127
  * @param {DefaultOptions & {accessToken?:string, team:string|undefined}} opts
128
128
  */
129
129
  export async function replaceLicense(code, opts) {
130
- const index = code?.indexOf("DCMbeC");
130
+ const index = code?.indexOf("_xUlE");
131
131
  if (index >= 0) {
132
132
  const licenseResult = await resolveLicense(opts);
133
133
  if (!licenseResult) {
@@ -136,18 +136,18 @@ export async function replaceLicense(code, opts) {
136
136
  const end = code.indexOf(";", index);
137
137
  if (end >= 0) {
138
138
  const line = code.substring(index, end);
139
- const replaced = "DCMbeC = \"" + licenseResult.type + "\"";
139
+ const replaced = "_xUlE = \"" + licenseResult.type + "\"";
140
140
  code = code.replace(line, replaced);
141
141
  }
142
142
 
143
143
  // Also inject JWT if available
144
144
  if (licenseResult.jwt) {
145
- const jwtIndex = code.indexOf("_$QDa");
145
+ const jwtIndex = code.indexOf("$YQu");
146
146
  if (jwtIndex >= 0) {
147
147
  const jwtEnd = code.indexOf(";", jwtIndex);
148
148
  if (jwtEnd >= 0) {
149
149
  const jwtLine = code.substring(jwtIndex, jwtEnd);
150
- const jwtReplaced = "_$QDa = \"" + licenseResult.jwt + "\"";
150
+ const jwtReplaced = "$YQu = \"" + licenseResult.jwt + "\"";
151
151
  code = code.replace(jwtLine, jwtReplaced);
152
152
  }
153
153
  }
@@ -49,12 +49,12 @@ export function needleLicense(command, config, userSettings) {
49
49
  let modified = false;
50
50
 
51
51
  // Replace license type
52
- const index = src.indexOf("DCMbeC");
52
+ const index = src.indexOf("_xUlE");
53
53
  if (index >= 0) {
54
54
  const end = src.indexOf(";", index);
55
55
  if (end >= 0) {
56
56
  const line = src.substring(index, end);
57
- const replaced = "DCMbeC = \"" + licenseResult.type + "\"";
57
+ const replaced = "_xUlE = \"" + licenseResult.type + "\"";
58
58
  src = src.replace(line, replaced);
59
59
  modified = true;
60
60
  }
@@ -62,12 +62,12 @@ export function needleLicense(command, config, userSettings) {
62
62
 
63
63
  // Replace license JWT (same pattern)
64
64
  if (licenseResult.jwt) {
65
- const jwtIndex = src.indexOf("_$QDa");
65
+ const jwtIndex = src.indexOf("$YQu");
66
66
  if (jwtIndex >= 0) {
67
67
  const jwtEnd = src.indexOf(";", jwtIndex);
68
68
  if (jwtEnd >= 0) {
69
69
  const jwtLine = src.substring(jwtIndex, jwtEnd);
70
- const jwtReplaced = "_$QDa = \"" + licenseResult.jwt + "\"";
70
+ const jwtReplaced = "$YQu = \"" + licenseResult.jwt + "\"";
71
71
  src = src.replace(jwtLine, jwtReplaced);
72
72
  modified = true;
73
73
  }
package/src/engine/api.ts CHANGED
@@ -230,7 +230,7 @@ export * from "./engine_input.js";
230
230
  export { InstancingUtil } from "./engine_instancing.js";
231
231
 
232
232
  /** License checking utilities */
233
- export { __sKHtRdk, _VIq, LuMYUbW } from "./engine_license.js";
233
+ export { _$qxlHFE, $iNNlsg, _iXmRJVD } from "./engine_license.js";
234
234
 
235
235
 
236
236
  // ============================================================================
@@ -8,7 +8,7 @@ import { initBuiltinTypes } from "./codegen/register_types.js";
8
8
  import { initSpatialConsole } from "./debug/debug_spatial_console.js";
9
9
  import { initAddressableSerializers } from "./engine_addressables.js";
10
10
  import { ensureAudioContextIsResumed } from "./engine_audio.js";
11
- import { __jwMeHQW } from "./engine_license.js";
11
+ import { _$FgmvbDMW } from "./engine_license.js";
12
12
  import { initNeedleLoader } from "./engine_loaders.js";
13
13
  import { initPhysics } from "./engine_physics_rapier.js";
14
14
  import { initBuiltinSerializers } from "./engine_serialization_builtin_serializer.js";
@@ -59,7 +59,7 @@ export function initEngine() {
59
59
  initPhysics();
60
60
  initXR();
61
61
  initSpatialConsole();
62
- __jwMeHQW();
62
+ _$FgmvbDMW();
63
63
 
64
64
  // Must be last. customElements.define() upgrades existing <needle-engine>
65
65
  // elements synchronously, which can trigger context.create() and dispatch
@@ -9,19 +9,19 @@ import { DeviceUtilities, getParam } from "./engine_utils.js";
9
9
 
10
10
  const debug = getParam("__debuglic__");
11
11
 
12
- const _vyy: ((result: boolean) => void)[] = [];
12
+ const _$JpwdW: ((result: boolean) => void)[] = [];
13
13
 
14
14
  // DO NOT EDIT MANUALLY
15
- let DCMbeC: string = "";
15
+ let _xUlE: string = "";
16
16
  // eslint-disable-next-line prefer-const
17
- let _$QDa: string = "";
17
+ let $YQu: string = "";
18
18
 
19
19
  if (debug) {
20
- console.log("License Type: " + DCMbeC);
21
- if (_$QDa) {
22
- console.log("License JWT: " + _$QDa);
20
+ console.log("License Type: " + _xUlE);
21
+ if ($YQu) {
22
+ console.log("License JWT: " + $YQu);
23
23
  try {
24
- const payload = JSON.parse(atob(_$QDa.split(".")[1].replace(/-/g, '+').replace(/_/g, '/')));
24
+ const payload = JSON.parse(atob($YQu.split(".")[1].replace(/-/g, '+').replace(/_/g, '/')));
25
25
  console.log("License JWT payload:", payload);
26
26
  }
27
27
  catch { console.log("License JWT payload: (failed to decode)"); }
@@ -32,8 +32,8 @@ if (debug) {
32
32
  }
33
33
 
34
34
  /** @internal */
35
- export function LuMYUbW() {
36
- switch (DCMbeC) {
35
+ export function _iXmRJVD() {
36
+ switch (_xUlE) {
37
37
  case "pro":
38
38
  case "enterprise":
39
39
  return true;
@@ -42,8 +42,8 @@ export function LuMYUbW() {
42
42
  }
43
43
 
44
44
  /** @internal */
45
- export function _VIq() {
46
- switch (DCMbeC) {
45
+ export function $iNNlsg() {
46
+ switch (_xUlE) {
47
47
  case "indie":
48
48
  return true;
49
49
  }
@@ -51,8 +51,8 @@ export function _VIq() {
51
51
  }
52
52
 
53
53
  /** @internal */
54
- export function _qGnTHBt() {
55
- switch (DCMbeC) {
54
+ export function BWKK() {
55
+ switch (_xUlE) {
56
56
  case "edu":
57
57
  return true;
58
58
  }
@@ -60,20 +60,20 @@ export function _qGnTHBt() {
60
60
  }
61
61
 
62
62
  /** @internal */
63
- export function __sKHtRdk() {
64
- return LuMYUbW() || _VIq() || _qGnTHBt();
63
+ export function _$qxlHFE() {
64
+ return _iXmRJVD() || $iNNlsg() || BWKK();
65
65
  }
66
66
 
67
67
 
68
68
  /** @internal */
69
- export function __YcMNHT(cb: (result: boolean) => void) {
70
- if (LuMYUbW() || _VIq() || _qGnTHBt())
69
+ export function $LDKVfeT(cb: (result: boolean) => void) {
70
+ if (_iXmRJVD() || $iNNlsg() || BWKK())
71
71
  return cb(true);
72
- _vyy.push(cb);
72
+ _$JpwdW.push(cb);
73
73
  }
74
74
 
75
- function __GhIoUnR(result: boolean) {
76
- for (const cb of _vyy) {
75
+ function _$UmxBO(result: boolean) {
76
+ for (const cb of _$JpwdW) {
77
77
  try {
78
78
  cb(result);
79
79
  }
@@ -88,7 +88,7 @@ function __GhIoUnR(result: boolean) {
88
88
 
89
89
  // ECDSA P-256 public key for verifying license JWTs (verification-only, safe to ship)
90
90
  /* eslint-disable no-secrets/no-secrets -- public key, not a secret */
91
- const _ZlcqTFZ = {
91
+ const _$jgGCcE = {
92
92
  kty: "EC",
93
93
  crv: "P-256",
94
94
  x: "A34nyKMjhQYVgzeE4tyLUYdx34TAKogDa7v7PRaO9Lg",
@@ -112,7 +112,7 @@ function base64urlDecode(str: string): Uint8Array {
112
112
  * Verify a JWT license token and return the `type` claim if valid.
113
113
  * Returns null if the JWT is missing, malformed, or has an invalid signature.
114
114
  */
115
- async function $XibkUuV(jwt: string): Promise<string | null> {
115
+ async function _$jlNUf(jwt: string): Promise<string | null> {
116
116
  if (!jwt) return null;
117
117
  try {
118
118
  const parts = jwt.split(".");
@@ -122,7 +122,7 @@ async function $XibkUuV(jwt: string): Promise<string | null> {
122
122
 
123
123
  const key = await crypto.subtle.importKey(
124
124
  "jwk",
125
- _ZlcqTFZ,
125
+ _$jgGCcE,
126
126
  { name: "ECDSA", namedCurve: "P-256" },
127
127
  false,
128
128
  ["verify"]
@@ -182,24 +182,24 @@ async function $XibkUuV(jwt: string): Promise<string | null> {
182
182
  }
183
183
 
184
184
  /** Verify the injected JWT and update the license type if valid.
185
- * The engine ONLY trusts the JWT — the plain DCMbeC string is ignored. */
185
+ * The engine ONLY trusts the JWT — the plain _xUlE string is ignored. */
186
186
  let _jwtVerificationPromise: Promise<void> | undefined = undefined;
187
- async function _eHTHvyky(): Promise<void> {
188
- // NOTE: do NOT add an `if (!_$QDa) return` guard here.
187
+ async function $yoiJPs(): Promise<void> {
188
+ // NOTE: do NOT add an `if (!$YQu) return` guard here.
189
189
  // esbuild (Vite dependency pre-bundling) would see the variable as constant ""
190
190
  // and tree-shake the entire JWT verification code path.
191
- const jwt = _$QDa;
191
+ const jwt = $YQu;
192
192
  // Clear after reading — this reassignment also prevents esbuild from
193
193
  // constant-folding the variable (it now has multiple assignment sites).
194
- _$QDa = "";
195
- const verifiedType = await $XibkUuV(jwt);
194
+ $YQu = "";
195
+ const verifiedType = await _$jlNUf(jwt);
196
196
  if (verifiedType) {
197
- DCMbeC = verifiedType;
197
+ _xUlE = verifiedType;
198
198
  if (debug) console.log("License type set from verified JWT: " + verifiedType);
199
- __GhIoUnR(__sKHtRdk());
199
+ _$UmxBO(_$qxlHFE());
200
200
  }
201
201
  else {
202
- DCMbeC = "basic";
202
+ _xUlE = "basic";
203
203
  if (debug && jwt) console.warn("JWT verification failed — license reset to basic");
204
204
  }
205
205
  }
@@ -650,18 +650,18 @@ export namespace Telemetry {
650
650
  }
651
651
 
652
652
 
653
- export function __jwMeHQW() {
653
+ export function _$FgmvbDMW() {
654
654
 
655
- if(DCMbeC === "") DCMbeC = "basic";
655
+ if(_xUlE === "") _xUlE = "basic";
656
656
 
657
657
  // Start JWT verification — must be here (not top-level) to avoid tree-shaking
658
- _jwtVerificationPromise = _eHTHvyky();
658
+ _jwtVerificationPromise = $yoiJPs();
659
659
 
660
660
  Telemetry.init();
661
661
  ContextRegistry.registerCallback(ContextEvent.ContextRegistered, evt => {
662
- __dwrTPO(evt.context);
663
- RENdB(evt.context);
664
- setTimeout(() => _$lKMhQuj(evt.context), 2000);
662
+ _$XHf(evt.context);
663
+ $HVsWDxs(evt.context);
664
+ setTimeout(() => qRfAszSq(evt.context), 2000);
665
665
  });
666
666
  // ContextCreated fires after the renderer exists, so the canvas is available for context-loss monitoring
667
667
  ContextRegistry.registerCallback(ContextEvent.ContextCreated, evt => {
@@ -670,17 +670,17 @@ export function __jwMeHQW() {
670
670
  });
671
671
  }
672
672
 
673
- export let __pRlh: Promise<void> | undefined = undefined;
673
+ export let _$vVym: Promise<void> | undefined = undefined;
674
674
  let applicationIsForbidden = false;
675
675
  let applicationForbiddenText = "";
676
- async function __DmsXa() {
676
+ async function $lSDygug() {
677
677
  // Only perform the runtime license check once
678
- if (__pRlh) return __pRlh;
678
+ if (_$vVym) return _$vVym;
679
679
  // Wait for JWT verification to complete first (if running)
680
680
  if (_jwtVerificationPromise) {
681
681
  await _jwtVerificationPromise;
682
682
  }
683
- if (DCMbeC === "basic") {
683
+ if (_xUlE === "basic") {
684
684
  try {
685
685
  const licenseUrl = "https://needle.tools/api/v1/needle-engine/check?location=" + encodeURIComponent(window.location.href) + "&version=" + VERSION + "&generator=" + encodeURIComponent(GENERATOR);
686
686
  const res = await fetch(licenseUrl, {
@@ -692,29 +692,29 @@ async function __DmsXa() {
692
692
  if (res?.status === 200) {
693
693
  applicationIsForbidden = false;
694
694
  if (debug) console.log("License check succeeded");
695
- DCMbeC = "pro";
696
- __GhIoUnR(true);
695
+ _xUlE = "pro";
696
+ _$UmxBO(true);
697
697
  }
698
698
  else if (res?.status === 403) {
699
- __GhIoUnR(false);
699
+ _$UmxBO(false);
700
700
  applicationIsForbidden = true;
701
701
  applicationForbiddenText = await res.text();
702
702
  }
703
703
  else {
704
- __GhIoUnR(false);
704
+ _$UmxBO(false);
705
705
  if (debug) console.log("License check failed with status " + res?.status);
706
706
  }
707
707
  }
708
708
  catch (err) {
709
- __GhIoUnR(false);
709
+ _$UmxBO(false);
710
710
  if (debug) console.error("License check failed", err);
711
711
  }
712
712
  }
713
- else if (debug) console.log("Runtime license check is skipped because license is already applied as \"" + DCMbeC + "\"");
713
+ else if (debug) console.log("Runtime license check is skipped because license is already applied as \"" + _xUlE + "\"");
714
714
  }
715
- __pRlh = __DmsXa();
715
+ _$vVym = $lSDygug();
716
716
 
717
- async function RENdB(ctx: IContext) {
717
+ async function $HVsWDxs(ctx: IContext) {
718
718
  function createForbiddenElement() {
719
719
  const div = document.createElement("div");
720
720
  div.className = "needle-forbidden";
@@ -779,40 +779,40 @@ async function RENdB(ctx: IContext) {
779
779
  }, 500)
780
780
  }
781
781
 
782
- async function __dwrTPO(ctx: IContext) {
782
+ async function _$XHf(ctx: IContext) {
783
783
  try {
784
- if (!LuMYUbW() && !_VIq()) {
785
- return _BDcq(ctx);
784
+ if (!_iXmRJVD() && !$iNNlsg()) {
785
+ return $MfDiSn(ctx);
786
786
  }
787
787
  }
788
788
  catch (err) {
789
789
  if (debug) console.log("License check failed", err)
790
- return _BDcq(ctx)
790
+ return $MfDiSn(ctx)
791
791
  }
792
- if (debug) _BDcq(ctx)
792
+ if (debug) $MfDiSn(ctx)
793
793
  }
794
794
 
795
795
 
796
796
 
797
- async function _BDcq(ctx: IContext) {
797
+ async function $MfDiSn(ctx: IContext) {
798
798
 
799
799
  // if the engine loads faster than the license check, we need to capture the ready event here
800
800
  let isReady = false;
801
801
  ctx.domElement.addEventListener("ready", () => isReady = true);
802
802
 
803
- await __pRlh?.catch(() => { });
803
+ await _$vVym?.catch(() => { });
804
804
 
805
805
 
806
- if (LuMYUbW() || _VIq()) return;
807
- if (__sKHtRdk() === false) _oFDigtof();
806
+ if (_iXmRJVD() || $iNNlsg()) return;
807
+ if (_$qxlHFE() === false) __qjjvQNJb();
808
808
 
809
809
  // check if the engine is already ready (meaning has finished loading)
810
810
  if (isReady) {
811
- DWOdshYS(ctx);
811
+ $RnnJzy(ctx);
812
812
  }
813
813
  else {
814
814
  ctx.domElement.addEventListener("ready", () => {
815
- DWOdshYS(ctx);
815
+ $RnnJzy(ctx);
816
816
  });
817
817
  }
818
818
  }
@@ -820,7 +820,7 @@ async function _BDcq(ctx: IContext) {
820
820
  // const licenseElementIdentifier = "needle-license-element";
821
821
  // const licenseDuration = 10000;
822
822
  // const licenseDelay = 1200;
823
- function DWOdshYS(ctx: IContext) {
823
+ function $RnnJzy(ctx: IContext) {
824
824
 
825
825
  const style = `
826
826
  position: relative;
@@ -833,7 +833,7 @@ function DWOdshYS(ctx: IContext) {
833
833
  padding: 10px;
834
834
  padding-left: 30px;
835
835
  `;
836
- if (DCMbeC === "edu") {
836
+ if (_xUlE === "edu") {
837
837
  if (navigator.webdriver) {
838
838
  console.log("This project is supported by Needle for Education – https://needle.tools");
839
839
  }
@@ -890,7 +890,7 @@ function DWOdshYS(ctx: IContext) {
890
890
  }
891
891
  }, 1000);
892
892
 
893
- if (_qGnTHBt()) {
893
+ if (BWKK()) {
894
894
  const removeDelay = 20_000;
895
895
  setTimeout(() => {
896
896
  clearInterval(interval);
@@ -899,7 +899,7 @@ function DWOdshYS(ctx: IContext) {
899
899
  const intervalInMinutes = 5;
900
900
  setTimeout(() => {
901
901
  if (ctx.domElement.parentNode)
902
- DWOdshYS(ctx);
902
+ $RnnJzy(ctx);
903
903
  }, 1000 * 60 * intervalInMinutes)
904
904
  }, removeDelay);
905
905
  }
@@ -910,7 +910,7 @@ function DWOdshYS(ctx: IContext) {
910
910
  const base64Logo = "data:image/webp;base64,UklGRrABAABXRUJQVlA4WAoAAAAQAAAAHwAAHwAAQUxQSKEAAAARN6CmbSM4WR7vdARON11EBDq3fLiNbVtVzpMCPlKAEzsx0Y/x+Ovuv4dn0EFE/ydAvz6YggXzgh5sVgXM/zOC/4sii7qgGvB5N7hmuQYwkvazWAu1JPW41FXSHq6pnaQWvqYH18Fc0j1hO/BFTtIeSBlJi5w6qIIO7IOrwhFsB2Yxukif0FTRLpXswHR8MxbslKe9VZsn/Ub5C7YFOpqSTABWUDgg6AAAAFAGAJ0BKiAAIAA+7VyoTqmkpCI3+qgBMB2JbACdMt69DwMIQBLhkTO6XwY00UEDK6cNIDnuNibPf0EgAP7Y1myuiQHLDsF/0h5unrGh6WAbv7aegg2ZMd3uRKfT/3SJztcaujYfTvMXspfCTmYcoO6a+vhC3ss4M8uM58t4siiu59I4aOl59e9Sr6xoxYlHf2v+NnBNpJYeJf8jABQAId/PXuBkLEFkiCucgSGEcfhvajql/j3reCGl0M5/9gQWy7ayNPs+wlvIxFnNfSlfuND4CZOCyxOHhRqOmHN4ULHo3tCSrUNvgAA=";
911
911
 
912
912
  let lastLogTime = 0;
913
- async function _oFDigtof(_logo?: string) {
913
+ async function __qjjvQNJb(_logo?: string) {
914
914
  const now = Date.now();
915
915
  if (now - lastLogTime < 2000) return;
916
916
  lastLogTime = now;
@@ -943,7 +943,7 @@ async function _oFDigtof(_logo?: string) {
943
943
  }
944
944
 
945
945
 
946
- async function _$lKMhQuj(context: IContext) {
946
+ async function qRfAszSq(context: IContext) {
947
947
  // isAllowed() now also covers cross-origin-isolated pages (where beacons can't be sent)
948
948
  // and Do Not Track / GPC.
949
949
  if (!Telemetry.isAllowed(context)) {
@@ -957,7 +957,7 @@ async function _$lKMhQuj(context: IContext) {
957
957
 
958
958
  // current url without query parameters
959
959
  const currentUrl = window.location.href.split("?")[0];
960
- const license = DCMbeC;
960
+ const license = _xUlE;
961
961
 
962
962
  const beaconData = {
963
963
  license,
@@ -1,7 +1,7 @@
1
1
  import { FileLoader } from "three";
2
2
 
3
3
  import { showBalloonWarning } from "./debug/index.js";
4
- import { __sKHtRdk } from "./engine_license.js";
4
+ import { _$qxlHFE } from "./engine_license.js";
5
5
  import { delay } from "./engine_utils.js";
6
6
  import { md5AsBytes, md5Hex, sha256Base64 } from "./engine_utils_hash.js";
7
7
 
@@ -45,7 +45,7 @@ export namespace BlobStorage {
45
45
  */
46
46
  export function canUpload(info: { filesize: number }) {
47
47
  const sizeInMB = info.filesize / 1024 / 1024;
48
- if (__sKHtRdk()) {
48
+ if (_$qxlHFE()) {
49
49
  return sizeInMB < maxSizeInMB;
50
50
  }
51
51
  return sizeInMB < maxFreeSizeInMB;
@@ -100,7 +100,7 @@ export namespace BlobStorage {
100
100
  console.warn(`Your file is too large for uploading (${filesizeInMB.toFixed(1)}MB). Max allowed size is ${maxSizeInMB}MB`);
101
101
  return null;
102
102
  }
103
- else if (!__sKHtRdk() && filesizeInMB > maxFreeSizeInMB) {
103
+ else if (!_$qxlHFE() && filesizeInMB > maxFreeSizeInMB) {
104
104
  if (opts?.silent !== true) showBalloonWarning(`File is too large for uploading. Please get a <a href=\"https://needle.tools/pricing\" target=\"_blank\">commercial license</a> to upload files larger than 5MB`);
105
105
  console.warn(`Your file is too large for uploading (${filesizeInMB.toFixed(1)}MB). Max size is 5MB for non-commercial users. Please get a commercial license at https://needle.tools/pricing for larger files (up to 50MB)`);
106
106
  return null;
@@ -4,7 +4,7 @@ import { Quaternion, Vector2, Vector3, Vector4 } from "three";
4
4
 
5
5
  import { needleLogoOnlySVG } from "./assets/index.js";
6
6
  import { isDevEnvironment } from "./debug/debug.js";
7
- import { __sKHtRdk } from "./engine_license.js";
7
+ import { _$qxlHFE } from "./engine_license.js";
8
8
  import { InternalAttributeUtils } from "./engine_utils_attributes.js";
9
9
  import type { NeedleEngineWebComponent } from "./webcomponents/needle-engine.js";
10
10
 
@@ -135,7 +135,7 @@ async function internalRenderQRCodeOverlays(canvas: HTMLCanvasElement, args: { s
135
135
  console.debug("[QR Code] No web component found")
136
136
  }
137
137
 
138
- const canUseCustomLogo = __sKHtRdk();
138
+ const canUseCustomLogo = _$qxlHFE();
139
139
 
140
140
  // Query logo src from needle-engine attribute.
141
141
  // For any supported attribute it's possible to use "falsey" values (e.g. "0" or "false" to disable the logo in the QR code)
@@ -2,7 +2,7 @@ import { Mesh, Object3D, TextureLoader, Vector4 } from "three";
2
2
  import ThreeMeshUI from "three-mesh-ui";
3
3
 
4
4
  import { addNewComponent } from "../../engine_components.js";
5
- import { __sKHtRdk } from "../../engine_license.js";
5
+ import { _$qxlHFE } from "../../engine_license.js";
6
6
  import { OneEuroFilterXYZ } from "../../engine_math.js";
7
7
  import type { Context } from "../../engine_setup.js";
8
8
  import { lookAtObject } from "../../engine_three_utils.js";
@@ -321,7 +321,7 @@ export class NeedleSpatialMenu {
321
321
  }
322
322
  if (this.menu) {
323
323
  const index = this.menu.children.indexOf(this._poweredByNeedleElement as any);
324
- if (!this._showNeedleLogo && __sKHtRdk()) {
324
+ if (!this._showNeedleLogo && _$qxlHFE()) {
325
325
  if (index >= 0) {
326
326
  this._poweredByNeedleElement.removeFromParent();
327
327
  this.markDirty();
@@ -1,6 +1,6 @@
1
1
  import { showBalloonMessage } from "../../debug/debug.js";
2
2
  import type { Context } from "../../engine_context.js";
3
- import { __sKHtRdk, __YcMNHT, Telemetry } from "../../engine_license.js";
3
+ import { _$qxlHFE, $LDKVfeT, Telemetry } from "../../engine_license.js";
4
4
  import { isLocalNetwork } from "../../engine_networking_utils.js";
5
5
  import { HTMLElementBase } from "../../engine_ssr.js";
6
6
  import { DeviceUtilities, getParam } from "../../engine_utils.js";
@@ -784,8 +784,8 @@ export class NeedleMenuElement extends HTMLElementBase {
784
784
  try {
785
785
  // if the user has a license then we CAN hide the needle logo
786
786
  // calling this method immediately will cause an issue with vite bundling tho
787
- window.requestAnimationFrame(() => __YcMNHT(res => {
788
- if (res == true && __sKHtRdk() && !debugNonCommercial) {
787
+ window.requestAnimationFrame(() => $LDKVfeT(res => {
788
+ if (res == true && _$qxlHFE() && !debugNonCommercial) {
789
789
  let visible = this._userRequestedLogoVisible;
790
790
  if (visible === undefined) visible = false;
791
791
  this.___onSetLogoVisible(visible);
@@ -836,7 +836,7 @@ export class NeedleMenuElement extends HTMLElementBase {
836
836
  // ensure the menu is not hidden or removed
837
837
  const requiredParent = this?.parentNode;
838
838
  if (this.style.display != "flex" || this.style.visibility != "visible" || this.style.opacity != "1" || requiredParent != this._domElement?.shadowRoot) {
839
- if (!__sKHtRdk()) {
839
+ if (!_$qxlHFE()) {
840
840
  const change = changeEventCounter++;
841
841
  // if a user doesn't have a local pro license *but* for development the menu is hidden then we show a warning
842
842
  if (isLocalNetwork() && this._userRequestedMenuVisible === false) {
@@ -932,7 +932,7 @@ export class NeedleMenuElement extends HTMLElementBase {
932
932
  showNeedleLogo(visible: boolean) {
933
933
  this._userRequestedLogoVisible = visible;
934
934
  if (!visible) {
935
- if (!__sKHtRdk() || debugNonCommercial) {
935
+ if (!_$qxlHFE() || debugNonCommercial) {
936
936
  console.warn("[Needle Engine] You need a commercial license to hide the Needle Engine logo in production.");
937
937
  const localNetwork = isLocalNetwork()
938
938
  if (!localNetwork) return;