@aippy/runtime 0.2.4-dev.7 โ†’ 0.2.4-dev.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.
@@ -1,4 +1,4 @@
1
- import { a as d, A as f, C as u, E as A, R as _, b as m, c as R, p as g } from "../runtime-BdIpqmWa.js";
1
+ import { a as d, A as f, C as u, E as A, R as _, b as m, c as R, p as g } from "../runtime-DjBdOttl.js";
2
2
  const s = {
3
3
  mode: "development",
4
4
  debug: !1,
@@ -22,7 +22,7 @@ function c(e) {
22
22
  }
23
23
  };
24
24
  }
25
- const r = "0.2.4-dev.7", a = {
25
+ const r = "0.2.4-dev.9", a = {
26
26
  version: r
27
27
  }, i = a.version, t = "@aippy/runtime";
28
28
  function p() {
@@ -39,6 +39,7 @@ export declare class AippyRuntime {
39
39
  receiveChannel: ReceiveChannel;
40
40
  private seq;
41
41
  private motionListeners;
42
+ private noListenersWarned;
42
43
  /**
43
44
  * Unified native data receiver - Routes to specific handlers based on message type
44
45
  * Called by native code via: window.aippyRuntime.receiveMessage(message)
@@ -1,10 +1,10 @@
1
- var v = Object.defineProperty;
2
- var f = (a, t, e) => t in a ? v(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var w = (a, t, e) => f(a, typeof t != "symbol" ? t + "" : t, e);
4
- import { c as s, b as E } from "../runtime-BdIpqmWa.js";
5
- class P {
1
+ var L = Object.defineProperty;
2
+ var k = (n, e, t) => e in n ? L(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var R = (n, e, t) => k(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { c as s, b as T } from "../runtime-DjBdOttl.js";
5
+ class _ {
6
6
  constructor() {
7
- w(this, "stream", null);
7
+ R(this, "stream", null);
8
8
  }
9
9
  /**
10
10
  * Check if camera is supported
@@ -15,21 +15,21 @@ class P {
15
15
  /**
16
16
  * Get camera stream
17
17
  */
18
- async getStream(t = {}) {
18
+ async getStream(e = {}) {
19
19
  if (!this.isSupported())
20
20
  throw s("Camera API is not supported", "NOT_SUPPORTED");
21
21
  try {
22
- const e = {
22
+ const t = {
23
23
  video: {
24
- width: t.width,
25
- height: t.height,
26
- facingMode: t.facingMode || "environment"
24
+ width: e.width,
25
+ height: e.height,
26
+ facingMode: e.facingMode || "environment"
27
27
  }
28
28
  };
29
- return this.stream = await navigator.mediaDevices.getUserMedia(e), this.stream;
30
- } catch (e) {
29
+ return this.stream = await navigator.mediaDevices.getUserMedia(t), this.stream;
30
+ } catch (t) {
31
31
  throw s(
32
- `Failed to access camera: ${e instanceof Error ? e.message : "Unknown error"}`,
32
+ `Failed to access camera: ${t instanceof Error ? t.message : "Unknown error"}`,
33
33
  "PERMISSION_DENIED"
34
34
  );
35
35
  }
@@ -37,30 +37,30 @@ class P {
37
37
  /**
38
38
  * Capture photo from stream
39
39
  */
40
- async capturePhoto(t = {}) {
40
+ async capturePhoto(e = {}) {
41
41
  if (!this.stream)
42
42
  throw s("No camera stream available", "NOT_SUPPORTED");
43
43
  try {
44
- const e = document.createElement("video");
45
- e.srcObject = this.stream, e.play();
46
- const i = document.createElement("canvas"), o = i.getContext("2d");
47
- if (!o)
44
+ const t = document.createElement("video");
45
+ t.srcObject = this.stream, t.play();
46
+ const o = document.createElement("canvas"), i = o.getContext("2d");
47
+ if (!i)
48
48
  throw s("Failed to get canvas context", "UNKNOWN_ERROR");
49
- i.width = t.width || e.videoWidth, i.height = t.height || e.videoHeight, o.drawImage(e, 0, 0, i.width, i.height);
50
- const n = t.format || "jpeg", d = t.quality === "high" ? 0.9 : t.quality === "medium" ? 0.7 : 0.5, r = await new Promise((l, u) => {
51
- i.toBlob((p) => {
52
- p ? l(p) : u(new Error("Failed to create blob"));
53
- }, `image/${n}`, d);
54
- }), c = i.toDataURL(`image/${n}`, d);
49
+ o.width = e.width || t.videoWidth, o.height = e.height || t.videoHeight, i.drawImage(t, 0, 0, o.width, o.height);
50
+ const r = e.format || "jpeg", c = e.quality === "high" ? 0.9 : e.quality === "medium" ? 0.7 : 0.5, a = await new Promise((u, m) => {
51
+ o.toBlob((l) => {
52
+ l ? u(l) : m(new Error("Failed to create blob"));
53
+ }, `image/${r}`, c);
54
+ }), d = o.toDataURL(`image/${r}`, c);
55
55
  return {
56
- blob: r,
57
- dataUrl: c,
58
- width: i.width,
59
- height: i.height
56
+ blob: a,
57
+ dataUrl: d,
58
+ width: o.width,
59
+ height: o.height
60
60
  };
61
- } catch (e) {
61
+ } catch (t) {
62
62
  throw s(
63
- `Failed to capture photo: ${e instanceof Error ? e.message : "Unknown error"}`,
63
+ `Failed to capture photo: ${t instanceof Error ? t.message : "Unknown error"}`,
64
64
  "UNKNOWN_ERROR"
65
65
  );
66
66
  }
@@ -69,11 +69,11 @@ class P {
69
69
  * Stop camera stream
70
70
  */
71
71
  stopStream() {
72
- this.stream && (this.stream.getTracks().forEach((t) => t.stop()), this.stream = null);
72
+ this.stream && (this.stream.getTracks().forEach((e) => e.stop()), this.stream = null);
73
73
  }
74
74
  }
75
- const M = new P();
76
- class O {
75
+ const C = new _();
76
+ class F {
77
77
  /**
78
78
  * Check if geolocation is supported
79
79
  */
@@ -83,244 +83,258 @@ class O {
83
83
  /**
84
84
  * Get current position
85
85
  */
86
- async getCurrentPosition(t = {}) {
86
+ async getCurrentPosition(e = {}) {
87
87
  if (!this.isSupported())
88
88
  throw s("Geolocation API is not supported", "NOT_SUPPORTED");
89
- return new Promise((e, i) => {
90
- const o = {
91
- enableHighAccuracy: t.enableHighAccuracy ?? !0,
92
- timeout: t.timeout ?? 1e4,
93
- maximumAge: t.maximumAge ?? 6e4
89
+ return new Promise((t, o) => {
90
+ const i = {
91
+ enableHighAccuracy: e.enableHighAccuracy ?? !0,
92
+ timeout: e.timeout ?? 1e4,
93
+ maximumAge: e.maximumAge ?? 6e4
94
94
  };
95
95
  navigator.geolocation.getCurrentPosition(
96
- (n) => {
97
- const d = {
98
- latitude: n.coords.latitude,
99
- longitude: n.coords.longitude,
100
- accuracy: n.coords.accuracy,
101
- altitude: n.coords.altitude ?? void 0,
102
- altitudeAccuracy: n.coords.altitudeAccuracy ?? void 0,
103
- heading: n.coords.heading ?? void 0,
104
- speed: n.coords.speed ?? void 0,
105
- timestamp: n.timestamp
96
+ (r) => {
97
+ const c = {
98
+ latitude: r.coords.latitude,
99
+ longitude: r.coords.longitude,
100
+ accuracy: r.coords.accuracy,
101
+ altitude: r.coords.altitude ?? void 0,
102
+ altitudeAccuracy: r.coords.altitudeAccuracy ?? void 0,
103
+ heading: r.coords.heading ?? void 0,
104
+ speed: r.coords.speed ?? void 0,
105
+ timestamp: r.timestamp
106
106
  };
107
- e(d);
107
+ t(c);
108
108
  },
109
- (n) => {
110
- let d = "UNKNOWN_ERROR", r = "Unknown geolocation error";
111
- switch (n.code) {
112
- case n.PERMISSION_DENIED:
113
- d = "PERMISSION_DENIED", r = "Geolocation permission denied";
109
+ (r) => {
110
+ let c = "UNKNOWN_ERROR", a = "Unknown geolocation error";
111
+ switch (r.code) {
112
+ case r.PERMISSION_DENIED:
113
+ c = "PERMISSION_DENIED", a = "Geolocation permission denied";
114
114
  break;
115
- case n.POSITION_UNAVAILABLE:
116
- r = "Position unavailable";
115
+ case r.POSITION_UNAVAILABLE:
116
+ a = "Position unavailable";
117
117
  break;
118
- case n.TIMEOUT:
119
- r = "Geolocation timeout";
118
+ case r.TIMEOUT:
119
+ a = "Geolocation timeout";
120
120
  break;
121
121
  }
122
- i(s(r, d));
122
+ o(s(a, c));
123
123
  },
124
- o
124
+ i
125
125
  );
126
126
  });
127
127
  }
128
128
  /**
129
129
  * Watch position changes
130
130
  */
131
- watchPosition(t, e = {}) {
131
+ watchPosition(e, t = {}) {
132
132
  if (!this.isSupported())
133
133
  throw s("Geolocation API is not supported", "NOT_SUPPORTED");
134
- const i = {
135
- enableHighAccuracy: e.enableHighAccuracy ?? !0,
136
- timeout: e.timeout ?? 1e4,
137
- maximumAge: e.maximumAge ?? 6e4
134
+ const o = {
135
+ enableHighAccuracy: t.enableHighAccuracy ?? !0,
136
+ timeout: t.timeout ?? 1e4,
137
+ maximumAge: t.maximumAge ?? 6e4
138
138
  };
139
139
  return navigator.geolocation.watchPosition(
140
- (o) => {
141
- const n = {
142
- latitude: o.coords.latitude,
143
- longitude: o.coords.longitude,
144
- accuracy: o.coords.accuracy,
145
- altitude: o.coords.altitude ?? void 0,
146
- altitudeAccuracy: o.coords.altitudeAccuracy ?? void 0,
147
- heading: o.coords.heading ?? void 0,
148
- speed: o.coords.speed ?? void 0,
149
- timestamp: o.timestamp
140
+ (i) => {
141
+ const r = {
142
+ latitude: i.coords.latitude,
143
+ longitude: i.coords.longitude,
144
+ accuracy: i.coords.accuracy,
145
+ altitude: i.coords.altitude ?? void 0,
146
+ altitudeAccuracy: i.coords.altitudeAccuracy ?? void 0,
147
+ heading: i.coords.heading ?? void 0,
148
+ speed: i.coords.speed ?? void 0,
149
+ timestamp: i.timestamp
150
150
  };
151
- t(n);
151
+ e(r);
152
152
  },
153
- (o) => {
154
- console.error("Geolocation watch error:", o);
153
+ (i) => {
154
+ console.error("Geolocation watch error:", i);
155
155
  },
156
- i
156
+ o
157
157
  );
158
158
  }
159
159
  /**
160
160
  * Clear position watch
161
161
  */
162
- clearWatch(t) {
163
- navigator.geolocation.clearWatch(t);
162
+ clearWatch(e) {
163
+ navigator.geolocation.clearWatch(e);
164
164
  }
165
165
  }
166
- const U = new O();
167
- function m() {
166
+ const X = new F();
167
+ function P() {
168
168
  return "DeviceMotionEvent" in window;
169
169
  }
170
- function g() {
170
+ function I() {
171
171
  return "DeviceOrientationEvent" in window;
172
172
  }
173
- function h() {
174
- const a = typeof window < "u", t = a && !!window.webkit, e = t && !!window.webkit?.messageHandlers, i = e && !!window.webkit?.messageHandlers?.aippyListener;
173
+ function b() {
174
+ const n = typeof window < "u", e = n && !!window.webkit, t = e && !!window.webkit?.messageHandlers, o = t && !!window.webkit?.messageHandlers?.aippyListener;
175
175
  return console.log("๐Ÿ” [Aippy Sensors] hasNativeBridge check:", {
176
- hasWindow: a,
177
- hasWebkit: t,
178
- hasMessageHandlers: e,
179
- hasAippyListener: i,
180
- result: i
181
- }), i;
176
+ hasWindow: n,
177
+ hasWebkit: e,
178
+ hasMessageHandlers: t,
179
+ hasAippyListener: o,
180
+ result: o
181
+ }), o;
182
+ }
183
+ function D() {
184
+ return typeof window < "u" && typeof window.orientation < "u" ? window.orientation : typeof window < "u" && window.screen?.orientation?.angle !== void 0 ? window.screen.orientation.angle : 0;
182
185
  }
183
- async function y() {
184
- if (console.log("๐Ÿ” [Aippy Sensors] requestMotionPermission called"), h())
186
+ function f(n, e, t) {
187
+ switch (t) {
188
+ case 0:
189
+ return [n, e];
190
+ case 180:
191
+ return [-n, -e];
192
+ case 90:
193
+ return [e, -n];
194
+ case -90:
195
+ return [-e, n];
196
+ default:
197
+ return [n, e];
198
+ }
199
+ }
200
+ async function U() {
201
+ if (console.log("๐Ÿ” [Aippy Sensors] requestMotionPermission called"), b())
185
202
  return console.log("โœ… [Aippy Sensors] Native bridge available, skipping permission request"), !0;
186
- if (!m())
203
+ if (!P())
187
204
  return console.warn("โŒ [Aippy Sensors] Device motion not supported"), !1;
188
- const a = typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function";
189
- if (console.log("๐Ÿ” [Aippy Sensors] Permission API available:", a), a)
205
+ const n = typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function";
206
+ if (console.log("๐Ÿ” [Aippy Sensors] Permission API available:", n), n)
190
207
  try {
191
208
  console.log("๐Ÿ™ [Aippy Sensors] Requesting device motion permission...");
192
- const t = await DeviceMotionEvent.requestPermission();
193
- return console.log("๐Ÿ“‹ [Aippy Sensors] Permission result:", t), t === "granted";
194
- } catch (t) {
195
- return console.error("โŒ [Aippy Sensors] Permission request failed:", t), !1;
209
+ const e = await DeviceMotionEvent.requestPermission();
210
+ return console.log("๐Ÿ“‹ [Aippy Sensors] Permission result:", e), e === "granted";
211
+ } catch (e) {
212
+ return console.warn("โŒ [Aippy Sensors] Permission request failed:", e), !1;
196
213
  }
197
214
  return console.log("โœ… [Aippy Sensors] No permission needed (granted by default)"), !0;
198
215
  }
199
- function S(a) {
216
+ function x(n) {
200
217
  console.log("๐Ÿ”ง [Aippy Sensors] watchMotionNative - Setting up native bridge listener");
201
- const t = E.addMotionListener((e) => {
202
- console.log("๐Ÿ“ฆ [Aippy Sensors] watchMotionNative - Received native data:", e);
203
- const i = {
218
+ const e = T.addMotionListener((t) => {
219
+ const o = D(), i = t.gravity?.x ?? 0, r = t.gravity?.y ?? 0, c = t.gravity?.z ?? 0, a = t.acceleration?.x ?? 0, d = t.acceleration?.y ?? 0, u = t.acceleration?.z ?? 0, [m, l] = f(i, r, o), [h, v] = f(a, d, o), g = -m, y = -l, E = {
204
220
  gravity: {
205
- x: e.gravity?.x ?? 0,
206
- y: e.gravity?.y ?? 0,
207
- z: e.gravity?.z ?? 0
221
+ x: g,
222
+ y,
223
+ z: c
224
+ // Z่ฝดไธๅ—ๅฑๅน•ๆ—‹่ฝฌๅฝฑๅ“
208
225
  },
209
226
  acceleration: {
210
- x: e.acceleration?.x ?? 0,
211
- y: e.acceleration?.y ?? 0,
212
- z: e.acceleration?.z ?? 0
227
+ x: h,
228
+ y: v,
229
+ z: u
230
+ // Z่ฝดไธๅ—ๅฑๅน•ๆ—‹่ฝฌๅฝฑๅ“
213
231
  },
214
232
  accelerationIncludingGravity: {
215
- x: (e.gravity?.x ?? 0) + (e.acceleration?.x ?? 0),
216
- y: (e.gravity?.y ?? 0) + (e.acceleration?.y ?? 0),
217
- z: (e.gravity?.z ?? 0) + (e.acceleration?.z ?? 0)
233
+ x: g + h,
234
+ y: y + v,
235
+ z: c + u
218
236
  },
219
237
  rotation: {
220
- alpha: e.rotation?.alpha ?? 0,
221
- beta: e.rotation?.beta ?? 0,
222
- gamma: e.rotation?.gamma ?? 0
238
+ alpha: t.rotation?.alpha ?? 0,
239
+ beta: t.rotation?.beta ?? 0,
240
+ gamma: t.rotation?.gamma ?? 0
223
241
  },
224
242
  timestamp: Date.now()
225
243
  };
226
- console.log("โœจ [Aippy Sensors] watchMotionNative - Transformed data:", i), a(i);
244
+ n(E);
227
245
  });
228
- return console.log("โœ… [Aippy Sensors] watchMotionNative - Listener setup complete"), t;
246
+ return console.log("โœ… [Aippy Sensors] watchMotionNative - Listener setup complete"), e;
229
247
  }
230
- function N(a, t = !0) {
231
- if (!m())
248
+ function G(n, e = !0) {
249
+ if (!P())
232
250
  throw s("Device motion API is not supported", "NOT_SUPPORTED");
233
- let e = !1, i = null;
234
- const o = (r) => {
235
- if (!e) return;
236
- const c = {
251
+ let t = !1, o = null;
252
+ const i = (a) => {
253
+ if (!t) return;
254
+ const d = D();
255
+ let u, m, l;
256
+ if (a.acceleration) {
257
+ const w = a.accelerationIncludingGravity, p = a.acceleration;
258
+ u = (w?.x ?? 0) - (p?.x ?? 0), m = (w?.y ?? 0) - (p?.y ?? 0), l = (w?.z ?? 0) - (p?.z ?? 0);
259
+ } else {
260
+ const w = a.accelerationIncludingGravity, p = 9.8;
261
+ u = (w?.x ?? 0) / p, m = (w?.y ?? 0) / p, l = (w?.z ?? 0) / p;
262
+ }
263
+ const h = a.acceleration?.x ?? 0, v = a.acceleration?.y ?? 0, g = a.acceleration?.z ?? 0, [y, E] = f(u, m, d), [O, S] = f(h, v, d), A = -y, N = -E, M = {
237
264
  gravity: {
238
- x: r.acceleration?.x ?? 0,
239
- y: r.acceleration?.y ?? 0,
240
- z: r.acceleration?.z ?? 0
265
+ x: A,
266
+ y: N,
267
+ z: l
268
+ // Z่ฝดไธๅ—ๅฑๅน•ๆ—‹่ฝฌๅฝฑๅ“
241
269
  },
242
270
  acceleration: {
243
- x: r.acceleration?.x ?? 0,
244
- y: r.acceleration?.y ?? 0,
245
- z: r.acceleration?.z ?? 0
271
+ x: O,
272
+ y: S,
273
+ z: g
274
+ // Z่ฝดไธๅ—ๅฑๅน•ๆ—‹่ฝฌๅฝฑๅ“
246
275
  },
247
276
  accelerationIncludingGravity: {
248
- x: r.accelerationIncludingGravity?.x ?? 0,
249
- y: r.accelerationIncludingGravity?.y ?? 0,
250
- z: r.accelerationIncludingGravity?.z ?? 0
277
+ x: A + O,
278
+ y: N + S,
279
+ z: l + g
251
280
  },
252
281
  rotation: {
253
- alpha: r.rotationRate?.alpha ?? 0,
254
- beta: r.rotationRate?.beta ?? 0,
255
- gamma: r.rotationRate?.gamma ?? 0
282
+ alpha: a.rotationRate?.alpha ?? 0,
283
+ beta: a.rotationRate?.beta ?? 0,
284
+ gamma: a.rotationRate?.gamma ?? 0
256
285
  },
257
286
  timestamp: Date.now()
258
287
  };
259
- if (r.acceleration) {
260
- const l = r.accelerationIncludingGravity, u = r.acceleration;
261
- c.gravity = {
262
- x: (l?.x ?? 0) - (u?.x ?? 0),
263
- y: (l?.y ?? 0) - (u?.y ?? 0),
264
- z: (l?.z ?? 0) - (u?.z ?? 0)
265
- };
266
- } else {
267
- const l = r.accelerationIncludingGravity, u = 9.8;
268
- c.gravity = {
269
- x: (l?.x ?? 0) / u,
270
- y: (l?.y ?? 0) / u,
271
- z: (l?.z ?? 0) / u
272
- };
273
- }
274
- a(c);
275
- }, n = async () => {
276
- t && !await y() || (e = !0, window.addEventListener("devicemotion", o));
288
+ n(M);
289
+ }, r = async () => {
290
+ e && !await U() || (t = !0, window.addEventListener("devicemotion", i));
277
291
  };
278
292
  return (async () => {
279
- if (typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function" && t) {
280
- const c = async () => {
281
- i = null, await n();
293
+ if (typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function" && e) {
294
+ const d = async () => {
295
+ o = null, await r();
282
296
  };
283
- window.addEventListener("click", c, { once: !0 }), window.addEventListener("touchstart", c, { once: !0 }), i = () => {
284
- window.removeEventListener("click", c), window.removeEventListener("touchstart", c);
297
+ window.addEventListener("click", d, { once: !0 }), window.addEventListener("touchstart", d, { once: !0 }), o = () => {
298
+ window.removeEventListener("click", d), window.removeEventListener("touchstart", d);
285
299
  };
286
300
  } else
287
- await n();
301
+ await r();
288
302
  })(), () => {
289
- e = !1, window.removeEventListener("devicemotion", o), i && (i(), i = null);
303
+ t = !1, window.removeEventListener("devicemotion", i), o && (o(), o = null);
290
304
  };
291
305
  }
292
- function D(a, t = !0) {
293
- const e = h();
294
- return console.log(`๐ŸŽฏ [Aippy Sensors] watchMotion - Using ${e ? "NATIVE BRIDGE" : "WEB API"} mode`), e ? (console.log("๐Ÿ“ฑ [Aippy Sensors] Starting native bridge motion listener"), S(a)) : (console.log("๐ŸŒ [Aippy Sensors] Starting Web API motion listener (may require permission)"), N(a, t));
306
+ function Y(n, e = !0) {
307
+ const t = b();
308
+ return console.log(`๐ŸŽฏ [Aippy Sensors] watchMotion - Using ${t ? "NATIVE BRIDGE" : "WEB API"} mode`), t ? (console.log("๐Ÿ“ฑ [Aippy Sensors] Starting native bridge motion listener"), x(n)) : (console.log("๐ŸŒ [Aippy Sensors] Starting Web API motion listener (may require permission)"), G(n, e));
295
309
  }
296
- function L(a) {
297
- if (!g())
310
+ function B(n) {
311
+ if (!I())
298
312
  throw s("Device orientation API is not supported", "NOT_SUPPORTED");
299
- const t = (e) => {
300
- const i = {
301
- alpha: e.alpha ?? 0,
302
- beta: e.beta ?? 0,
303
- gamma: e.gamma ?? 0,
313
+ const e = (t) => {
314
+ const o = {
315
+ alpha: t.alpha ?? 0,
316
+ beta: t.beta ?? 0,
317
+ gamma: t.gamma ?? 0,
304
318
  timestamp: Date.now()
305
319
  };
306
- a(i);
320
+ n(o);
307
321
  };
308
- return window.addEventListener("deviceorientation", t), () => {
309
- window.removeEventListener("deviceorientation", t);
322
+ return window.addEventListener("deviceorientation", e), () => {
323
+ window.removeEventListener("deviceorientation", e);
310
324
  };
311
325
  }
312
- class A {
326
+ class z {
313
327
  /**
314
328
  * Check if device orientation is supported
315
329
  */
316
330
  isOrientationSupported() {
317
- return g();
331
+ return I();
318
332
  }
319
333
  /**
320
334
  * Check if device motion is supported
321
335
  */
322
336
  isMotionSupported() {
323
- return m();
337
+ return P();
324
338
  }
325
339
  /**
326
340
  * Get device orientation data
@@ -328,17 +342,17 @@ class A {
328
342
  async getOrientation() {
329
343
  if (!this.isOrientationSupported())
330
344
  throw s("Device orientation API is not supported", "NOT_SUPPORTED");
331
- return new Promise((t, e) => {
332
- const i = (o) => {
333
- window.removeEventListener("deviceorientation", i), t({
334
- x: o.alpha ?? 0,
335
- y: o.beta ?? 0,
336
- z: o.gamma ?? 0,
345
+ return new Promise((e, t) => {
346
+ const o = (i) => {
347
+ window.removeEventListener("deviceorientation", o), e({
348
+ x: i.alpha ?? 0,
349
+ y: i.beta ?? 0,
350
+ z: i.gamma ?? 0,
337
351
  timestamp: Date.now()
338
352
  });
339
353
  };
340
- window.addEventListener("deviceorientation", i), setTimeout(() => {
341
- window.removeEventListener("deviceorientation", i), e(s("Device orientation timeout", "UNKNOWN_ERROR"));
354
+ window.addEventListener("deviceorientation", o), setTimeout(() => {
355
+ window.removeEventListener("deviceorientation", o), t(s("Device orientation timeout", "UNKNOWN_ERROR"));
342
356
  }, 5e3);
343
357
  });
344
358
  }
@@ -346,19 +360,19 @@ class A {
346
360
  * Watch device orientation changes
347
361
  * @deprecated Use watchOrientation() function instead
348
362
  */
349
- watchOrientation(t) {
363
+ watchOrientation(e) {
350
364
  if (!this.isOrientationSupported())
351
365
  throw s("Device orientation API is not supported", "NOT_SUPPORTED");
352
- const e = (i) => {
353
- t({
354
- x: i.alpha ?? 0,
355
- y: i.beta ?? 0,
356
- z: i.gamma ?? 0,
366
+ const t = (o) => {
367
+ e({
368
+ x: o.alpha ?? 0,
369
+ y: o.beta ?? 0,
370
+ z: o.gamma ?? 0,
357
371
  timestamp: Date.now()
358
372
  });
359
373
  };
360
- return window.addEventListener("deviceorientation", e), () => {
361
- window.removeEventListener("deviceorientation", e);
374
+ return window.addEventListener("deviceorientation", t), () => {
375
+ window.removeEventListener("deviceorientation", t);
362
376
  };
363
377
  }
364
378
  /**
@@ -367,17 +381,17 @@ class A {
367
381
  async getMotion() {
368
382
  if (!this.isMotionSupported())
369
383
  throw s("Device motion API is not supported", "NOT_SUPPORTED");
370
- return new Promise((t, e) => {
371
- const i = (o) => {
372
- window.removeEventListener("devicemotion", i), t({
373
- x: o.acceleration?.x ?? 0,
374
- y: o.acceleration?.y ?? 0,
375
- z: o.acceleration?.z ?? 0,
384
+ return new Promise((e, t) => {
385
+ const o = (i) => {
386
+ window.removeEventListener("devicemotion", o), e({
387
+ x: i.acceleration?.x ?? 0,
388
+ y: i.acceleration?.y ?? 0,
389
+ z: i.acceleration?.z ?? 0,
376
390
  timestamp: Date.now()
377
391
  });
378
392
  };
379
- window.addEventListener("devicemotion", i), setTimeout(() => {
380
- window.removeEventListener("devicemotion", i), e(s("Device motion timeout", "UNKNOWN_ERROR"));
393
+ window.addEventListener("devicemotion", o), setTimeout(() => {
394
+ window.removeEventListener("devicemotion", o), t(s("Device motion timeout", "UNKNOWN_ERROR"));
381
395
  }, 5e3);
382
396
  });
383
397
  }
@@ -385,30 +399,30 @@ class A {
385
399
  * Watch device motion changes
386
400
  * @deprecated Use watchMotion() function instead
387
401
  */
388
- watchMotion(t) {
402
+ watchMotion(e) {
389
403
  if (!this.isMotionSupported())
390
404
  throw s("Device motion API is not supported", "NOT_SUPPORTED");
391
- const e = (i) => {
392
- t({
393
- x: i.acceleration?.x ?? 0,
394
- y: i.acceleration?.y ?? 0,
395
- z: i.acceleration?.z ?? 0,
405
+ const t = (o) => {
406
+ e({
407
+ x: o.acceleration?.x ?? 0,
408
+ y: o.acceleration?.y ?? 0,
409
+ z: o.acceleration?.z ?? 0,
396
410
  timestamp: Date.now()
397
411
  });
398
412
  };
399
- return window.addEventListener("devicemotion", e), () => {
400
- window.removeEventListener("devicemotion", e);
413
+ return window.addEventListener("devicemotion", t), () => {
414
+ window.removeEventListener("devicemotion", t);
401
415
  };
402
416
  }
403
417
  /**
404
418
  * Request permission for motion sensors (iOS 13+)
405
419
  */
406
420
  async requestPermission() {
407
- return y();
421
+ return U();
408
422
  }
409
423
  }
410
- const x = new A();
411
- class R {
424
+ const K = new z();
425
+ class W {
412
426
  /**
413
427
  * Check if file system access is supported
414
428
  */
@@ -424,28 +438,28 @@ class R {
424
438
  /**
425
439
  * Open file picker (modern API)
426
440
  */
427
- async openFilePicker(t = {}) {
441
+ async openFilePicker(e = {}) {
428
442
  if (!this.isSupported())
429
443
  throw s("File System Access API is not supported", "NOT_SUPPORTED");
430
444
  try {
431
- const e = {
432
- types: t.accept ? [{
445
+ const t = {
446
+ types: e.accept ? [{
433
447
  description: "Files",
434
448
  accept: Object.fromEntries(
435
- t.accept.map((n) => [n, [n]])
449
+ e.accept.map((r) => [r, [r]])
436
450
  )
437
451
  }] : void 0,
438
- multiple: t.multiple ?? !1
439
- }, i = await window.showOpenFilePicker(e), o = await Promise.all(
440
- i.map(async (n) => n.getFile())
452
+ multiple: e.multiple ?? !1
453
+ }, o = await window.showOpenFilePicker(t), i = await Promise.all(
454
+ o.map(async (r) => r.getFile())
441
455
  );
442
456
  return {
443
- files: o,
444
- paths: o.map((n) => n.name)
457
+ files: i,
458
+ paths: i.map((r) => r.name)
445
459
  };
446
- } catch (e) {
447
- throw e instanceof Error && e.name === "AbortError" ? s("File picker was cancelled", "PERMISSION_DENIED") : s(
448
- `Failed to open file picker: ${e instanceof Error ? e.message : "Unknown error"}`,
460
+ } catch (t) {
461
+ throw t instanceof Error && t.name === "AbortError" ? s("File picker was cancelled", "PERMISSION_DENIED") : s(
462
+ `Failed to open file picker: ${t instanceof Error ? t.message : "Unknown error"}`,
449
463
  "PERMISSION_DENIED"
450
464
  );
451
465
  }
@@ -453,38 +467,38 @@ class R {
453
467
  /**
454
468
  * Open file picker (legacy fallback)
455
469
  */
456
- async openFilePickerLegacy(t = {}) {
470
+ async openFilePickerLegacy(e = {}) {
457
471
  if (!this.isLegacySupported())
458
472
  throw s("File input is not supported", "NOT_SUPPORTED");
459
- return new Promise((e, i) => {
460
- const o = document.createElement("input");
461
- o.type = "file", o.multiple = t.multiple ?? !1, o.accept = t.accept?.join(",") ?? "", o.onchange = (n) => {
462
- const d = n.target, r = Array.from(d.files || []);
463
- e({
464
- files: r,
465
- paths: r.map((c) => c.name)
473
+ return new Promise((t, o) => {
474
+ const i = document.createElement("input");
475
+ i.type = "file", i.multiple = e.multiple ?? !1, i.accept = e.accept?.join(",") ?? "", i.onchange = (r) => {
476
+ const c = r.target, a = Array.from(c.files || []);
477
+ t({
478
+ files: a,
479
+ paths: a.map((d) => d.name)
466
480
  });
467
- }, o.oncancel = () => {
468
- i(s("File picker was cancelled", "PERMISSION_DENIED"));
469
- }, o.click();
481
+ }, i.oncancel = () => {
482
+ o(s("File picker was cancelled", "PERMISSION_DENIED"));
483
+ }, i.click();
470
484
  });
471
485
  }
472
486
  /**
473
487
  * Open file picker with fallback
474
488
  */
475
- async openFile(t = {}) {
476
- return this.isSupported() ? await this.openFilePicker(t) : await this.openFilePickerLegacy(t);
489
+ async openFile(e = {}) {
490
+ return this.isSupported() ? await this.openFilePicker(e) : await this.openFilePickerLegacy(e);
477
491
  }
478
492
  /**
479
493
  * Save file
480
494
  */
481
- async saveFile(t, e) {
495
+ async saveFile(e, t) {
482
496
  try {
483
- const i = URL.createObjectURL(t), o = document.createElement("a");
484
- o.href = i, o.download = e, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(i);
485
- } catch (i) {
497
+ const o = URL.createObjectURL(e), i = document.createElement("a");
498
+ i.href = o, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(o);
499
+ } catch (o) {
486
500
  throw s(
487
- `Failed to save file: ${i instanceof Error ? i.message : "Unknown error"}`,
501
+ `Failed to save file: ${o instanceof Error ? o.message : "Unknown error"}`,
488
502
  "UNKNOWN_ERROR"
489
503
  );
490
504
  }
@@ -492,51 +506,51 @@ class R {
492
506
  /**
493
507
  * Read file as text
494
508
  */
495
- async readAsText(t) {
496
- return new Promise((e, i) => {
497
- const o = new FileReader();
498
- o.onload = () => e(o.result), o.onerror = () => i(s("Failed to read file", "UNKNOWN_ERROR")), o.readAsText(t);
509
+ async readAsText(e) {
510
+ return new Promise((t, o) => {
511
+ const i = new FileReader();
512
+ i.onload = () => t(i.result), i.onerror = () => o(s("Failed to read file", "UNKNOWN_ERROR")), i.readAsText(e);
499
513
  });
500
514
  }
501
515
  /**
502
516
  * Read file as data URL
503
517
  */
504
- async readAsDataURL(t) {
505
- return new Promise((e, i) => {
506
- const o = new FileReader();
507
- o.onload = () => e(o.result), o.onerror = () => i(s("Failed to read file", "UNKNOWN_ERROR")), o.readAsDataURL(t);
518
+ async readAsDataURL(e) {
519
+ return new Promise((t, o) => {
520
+ const i = new FileReader();
521
+ i.onload = () => t(i.result), i.onerror = () => o(s("Failed to read file", "UNKNOWN_ERROR")), i.readAsDataURL(e);
508
522
  });
509
523
  }
510
524
  }
511
- const T = new R();
512
- function k(a) {
513
- return new Promise((t) => {
525
+ const $ = new W();
526
+ function j(n) {
527
+ return new Promise((e) => {
514
528
  if ("vibrate" in navigator)
515
- navigator.vibrate(a), t();
529
+ navigator.vibrate(n), e();
516
530
  else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.aippyListener) {
517
- const e = {
531
+ const t = {
518
532
  command: "navigator.vibrate",
519
- parameters: a
533
+ parameters: n
520
534
  };
521
- window.webkit.messageHandlers.aippyListener.postMessage(e), t();
535
+ window.webkit.messageHandlers.aippyListener.postMessage(t), e();
522
536
  } else
523
- console.warn("Vibration not supported in this environment"), t();
537
+ console.warn("Vibration not supported in this environment"), e();
524
538
  });
525
539
  }
526
540
  export {
527
- P as CameraAPI,
528
- R as FileSystemAPI,
529
- O as GeolocationAPI,
530
- A as SensorsAPI,
531
- M as camera,
532
- T as fileSystem,
533
- U as geolocation,
534
- h as hasNativeBridge,
535
- m as isMotionSupported,
536
- g as isOrientationSupported,
537
- y as requestMotionPermission,
538
- x as sensors,
539
- k as vibrate,
540
- D as watchMotion,
541
- L as watchOrientation
541
+ _ as CameraAPI,
542
+ W as FileSystemAPI,
543
+ F as GeolocationAPI,
544
+ z as SensorsAPI,
545
+ C as camera,
546
+ $ as fileSystem,
547
+ X as geolocation,
548
+ b as hasNativeBridge,
549
+ P as isMotionSupported,
550
+ I as isOrientationSupported,
551
+ U as requestMotionPermission,
552
+ K as sensors,
553
+ j as vibrate,
554
+ Y as watchMotion,
555
+ B as watchOrientation
542
556
  };
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_CONFIG as o, SDK_NAME as t, VERSION as r, getConfigFromEnv as i, getVersionInfo as s, mergeConfig as n } from "../core/index.js";
2
- import { a as m, A as c, C as d, E as f, R as u, b as l, c as A, p as S } from "../runtime-BdIpqmWa.js";
2
+ import { a as m, A as c, C as d, E as f, R as u, b as l, c as A, p as S } from "../runtime-DjBdOttl.js";
3
3
  import { CameraAPI as C, FileSystemAPI as R, GeolocationAPI as x, SensorsAPI as M, camera as P, fileSystem as I, geolocation as g, hasNativeBridge as y, isMotionSupported as O, isOrientationSupported as b, requestMotionPermission as v, sensors as D, vibrate as h, watchMotion as w, watchOrientation as F } from "../device/index.js";
4
4
  import { c as T, a as V, P as _, b as k, p as G, d as H } from "../pwa-8DGmPqLV.js";
5
5
  import { a as q, b as B } from "../useTweaks-QxMRmg7i.js";
@@ -1,12 +1,12 @@
1
1
  var u = Object.defineProperty;
2
- var m = (o, e, t) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var c = (o, e, t) => m(o, typeof e != "symbol" ? e + "" : e, t);
2
+ var m = (o, e, n) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
3
+ var r = (o, e, n) => m(o, typeof e != "symbol" ? e + "" : e, n);
4
4
  class d extends Error {
5
- constructor(t, i = "AIPPY_ERROR", n) {
6
- super(t);
7
- c(this, "code");
8
- c(this, "context");
9
- this.name = "AippyRuntimeError", this.code = i, this.context = n;
5
+ constructor(n, i = "AIPPY_ERROR", t) {
6
+ super(n);
7
+ r(this, "code");
8
+ r(this, "context");
9
+ this.name = "AippyRuntimeError", this.code = i, this.context = t;
10
10
  }
11
11
  }
12
12
  const R = {
@@ -16,12 +16,12 @@ const R = {
16
16
  NETWORK_ERROR: "NETWORK_ERROR",
17
17
  UNKNOWN_ERROR: "UNKNOWN_ERROR"
18
18
  };
19
- function w(o, e = "UNKNOWN_ERROR", t) {
20
- return new d(o, R[e], t);
19
+ function g(o, e = "UNKNOWN_ERROR", n) {
20
+ return new d(o, R[e], n);
21
21
  }
22
22
  class a {
23
23
  constructor(e) {
24
- c(this, "cancelled", !1);
24
+ r(this, "cancelled", !1);
25
25
  this.cancelFn = e;
26
26
  }
27
27
  cancel() {
@@ -31,28 +31,28 @@ class a {
31
31
  return this.cancelled;
32
32
  }
33
33
  }
34
- class y {
34
+ class f {
35
35
  constructor() {
36
- c(this, "listeners", /* @__PURE__ */ new Map());
36
+ r(this, "listeners", /* @__PURE__ */ new Map());
37
37
  }
38
- addEventListener(e, t) {
39
- this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(t);
38
+ addEventListener(e, n) {
39
+ this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(n);
40
40
  }
41
- removeEventListener(e, t) {
41
+ removeEventListener(e, n) {
42
42
  const i = this.listeners.get(e);
43
43
  if (i) {
44
- const n = i.indexOf(t);
45
- n > -1 && i.splice(n, 1);
44
+ const t = i.indexOf(n);
45
+ t > -1 && i.splice(t, 1);
46
46
  }
47
47
  }
48
- emit(e, t) {
48
+ emit(e, n) {
49
49
  const i = this.listeners.get(e);
50
- i && i.forEach((n) => n(t));
50
+ i && i.forEach((t) => t(n));
51
51
  }
52
52
  }
53
- class f {
53
+ class y {
54
54
  constructor() {
55
- c(this, "emitter", new y());
55
+ r(this, "emitter", new f());
56
56
  }
57
57
  /**
58
58
  * Emit a message to subscribers
@@ -63,9 +63,9 @@ class f {
63
63
  /**
64
64
  * Subscribe to messages on a specific endpoint
65
65
  */
66
- subscribe(e, t) {
67
- const i = (n) => {
68
- t(n);
66
+ subscribe(e, n) {
67
+ const i = (t) => {
68
+ n(t);
69
69
  };
70
70
  return this.emitter.addEventListener(e, i), new a(() => {
71
71
  this.emitter.removeEventListener(e, i);
@@ -74,18 +74,19 @@ class f {
74
74
  /**
75
75
  * Subscribe to a single message (auto-unsubscribe after first message)
76
76
  */
77
- once(e, t) {
78
- const i = this.subscribe(e, (n) => {
79
- i.cancel(), t(n);
77
+ once(e, n) {
78
+ const i = this.subscribe(e, (t) => {
79
+ i.cancel(), n(t);
80
80
  });
81
81
  return i;
82
82
  }
83
83
  }
84
84
  class h {
85
85
  constructor() {
86
- c(this, "receiveChannel", new f());
87
- c(this, "seq", 0);
88
- c(this, "motionListeners", []);
86
+ r(this, "receiveChannel", new y());
87
+ r(this, "seq", 0);
88
+ r(this, "motionListeners", []);
89
+ r(this, "noListenersWarned", !1);
89
90
  }
90
91
  /**
91
92
  * Unified native data receiver - Routes to specific handlers based on message type
@@ -115,10 +116,10 @@ class h {
115
116
  isTweaksMessage(e) {
116
117
  if (typeof e != "object" || e === null || "endpoint" in e || "payload" in e)
117
118
  return !1;
118
- const t = Object.keys(e);
119
- return t.length === 0 ? !1 : t.some((n) => {
120
- const r = e[n];
121
- return typeof r == "object" && r !== null && "value" in r;
119
+ const n = Object.keys(e);
120
+ return n.length === 0 ? !1 : n.some((t) => {
121
+ const c = e[t];
122
+ return typeof c == "object" && c !== null && "value" in c;
122
123
  });
123
124
  }
124
125
  /**
@@ -128,37 +129,37 @@ class h {
128
129
  * @param callback - Callback to handle received data
129
130
  * @returns Cancellable subscription
130
131
  */
131
- createSubscription(e, t, i) {
132
- const n = (this.seq++).toString(), r = {
133
- command: t.command,
132
+ createSubscription(e, n, i) {
133
+ const t = (this.seq++).toString(), c = {
134
+ command: n.command,
134
135
  parameters: {
135
- type: t.type,
136
+ type: n.type,
136
137
  action: "subscribe",
137
- endpoint: n
138
+ endpoint: t
138
139
  }
139
140
  };
140
- console.log("๐Ÿ“จ [Aippy Runtime] Creating subscription with message:", JSON.stringify(r, null, 2));
141
- const p = this.receiveChannel.subscribe(n, (s) => {
142
- if (console.log(`๐Ÿ“ฌ [Aippy Runtime] Received data on endpoint ${n}:`, s), s.error !== void 0) {
141
+ console.log("๐Ÿ“จ [Aippy Runtime] Creating subscription with message:", JSON.stringify(c, null, 2));
142
+ const l = this.receiveChannel.subscribe(t, (s) => {
143
+ if (console.log(`๐Ÿ“ฌ [Aippy Runtime] Received data on endpoint ${t}:`, s), s.error !== void 0) {
143
144
  console.warn("โš ๏ธ [Aippy Runtime] Received error, skipping:", s.error);
144
145
  return;
145
146
  }
146
147
  i(s);
147
148
  });
148
149
  try {
149
- console.log("๐Ÿ“ค [Aippy Runtime] Sending postMessage to native iOS:", r), e.postMessage(r), console.log("โœ… [Aippy Runtime] postMessage sent successfully");
150
+ console.log("๐Ÿ“ค [Aippy Runtime] Sending postMessage to native iOS:", c), e.postMessage(c), console.log("โœ… [Aippy Runtime] postMessage sent successfully");
150
151
  } catch (s) {
151
152
  console.error("โŒ [Aippy Runtime] Failed to send postMessage:", s);
152
153
  }
153
154
  return new a(() => {
154
- console.log(`๐Ÿ”Œ [Aippy Runtime] Unsubscribing from endpoint ${n}`), p.cancel();
155
+ console.log(`๐Ÿ”Œ [Aippy Runtime] Unsubscribing from endpoint ${t}`), l.cancel();
155
156
  try {
156
157
  const s = {
157
- command: t.command,
158
+ command: n.command,
158
159
  parameters: {
159
- type: t.type,
160
+ type: n.type,
160
161
  action: "unsubscribe",
161
- endpoint: n
162
+ endpoint: t
162
163
  }
163
164
  };
164
165
  e.postMessage(s), console.log("โœ… [Aippy Runtime] Unsubscribe message sent:", s);
@@ -174,27 +175,27 @@ class h {
174
175
  */
175
176
  addMotionListener(e) {
176
177
  console.log("๐ŸŽฌ [Aippy Runtime] addMotionListener called"), this.motionListeners.push(e), console.log(`๐Ÿ“ [Aippy Runtime] Total motion listeners: ${this.motionListeners.length}`);
177
- const t = window.webkit?.messageHandlers?.aippyListener;
178
- if (!t)
178
+ const n = window.webkit?.messageHandlers?.aippyListener;
179
+ if (!n)
179
180
  return console.warn("โš ๏ธ [Aippy Runtime] No webkit message handler found, using fallback mode"), () => {
180
- const n = this.motionListeners.indexOf(e);
181
- n > -1 && this.motionListeners.splice(n, 1);
181
+ const t = this.motionListeners.indexOf(e);
182
+ t > -1 && this.motionListeners.splice(t, 1);
182
183
  };
183
184
  console.log("โœ… [Aippy Runtime] Webkit handler found, creating subscription");
184
185
  const i = this.createSubscription(
185
- t,
186
+ n,
186
187
  {
187
188
  command: "navigator.motion",
188
189
  type: "motion"
189
190
  },
190
- (n) => {
191
- console.log("๐Ÿ“ฅ [Aippy Runtime] Received motion data from native:", n), n.motion && e(n.motion);
191
+ (t) => {
192
+ console.log("๐Ÿ“ฅ [Aippy Runtime] Received motion data from native:", t), t.motion && e(t.motion);
192
193
  }
193
194
  );
194
195
  return () => {
195
196
  console.log("๐Ÿงน [Aippy Runtime] Cleaning up motion listener"), i.cancel();
196
- const n = this.motionListeners.indexOf(e);
197
- n > -1 && this.motionListeners.splice(n, 1);
197
+ const t = this.motionListeners.indexOf(e);
198
+ t > -1 && this.motionListeners.splice(t, 1);
198
199
  };
199
200
  }
200
201
  /**
@@ -203,22 +204,22 @@ class h {
203
204
  * @param data - Motion data from iOS
204
205
  */
205
206
  broadcastMotionData(e) {
206
- if (console.log(`๐Ÿ“ข [Aippy Runtime] broadcastMotionData called, listeners: ${this.motionListeners.length}`), this.motionListeners.length === 0) {
207
- console.warn("โš ๏ธ [Aippy Runtime] No motion listeners to broadcast to");
207
+ if (this.motionListeners.length === 0) {
208
+ this.noListenersWarned || (console.warn("โš ๏ธ [Aippy Runtime] No motion listeners to broadcast to"), this.noListenersWarned = !0);
208
209
  return;
209
210
  }
210
- const t = e.motion || e;
211
- console.log("๐Ÿ“Š [Aippy Runtime] Broadcasting motion data:", t), this.motionListeners.forEach((i, n) => {
211
+ const n = e.motion || e;
212
+ this.motionListeners.forEach((i) => {
212
213
  try {
213
- console.log(`๐Ÿ“ฒ [Aippy Runtime] Calling listener #${n + 1}`), i(t);
214
- } catch (r) {
215
- console.error(`โš ๏ธ [Aippy Runtime] Error in motion listener #${n + 1}:`, r);
214
+ i(n);
215
+ } catch (t) {
216
+ console.error("โš ๏ธ [Aippy Runtime] Error in motion listener:", t);
216
217
  }
217
218
  });
218
219
  }
219
220
  }
220
- function g(o) {
221
- if (console.log("๐ŸŽฏ [Aippy Runtime] processMotionData called by iOS with data:", o), !o || typeof o != "object") {
221
+ function w(o) {
222
+ if (!o || typeof o != "object") {
222
223
  console.warn("โš ๏ธ [Aippy Runtime] Invalid motion data type:", typeof o);
223
224
  return;
224
225
  }
@@ -226,17 +227,17 @@ function g(o) {
226
227
  console.warn("โš ๏ธ [Aippy Runtime] Motion data missing valid motion field");
227
228
  return;
228
229
  }
229
- console.log("โœ… [Aippy Runtime] Motion data validated, broadcasting to listeners"), l.broadcastMotionData(o);
230
+ p.broadcastMotionData(o);
230
231
  }
231
- const l = new h();
232
- typeof window < "u" && (window.aippyRuntime = l, window.processMotionData = g);
232
+ const p = new h();
233
+ typeof window < "u" && (window.aippyRuntime = p, window.processMotionData = w);
233
234
  export {
234
235
  d as A,
235
236
  a as C,
236
237
  R as E,
237
- f as R,
238
+ y as R,
238
239
  h as a,
239
- l as b,
240
- w as c,
241
- g as p
240
+ p as b,
241
+ g as c,
242
+ w as p
242
243
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aippy/runtime",
3
- "version": "0.2.4-dev.7",
3
+ "version": "0.2.4-dev.9",
4
4
  "description": "Aippy Runtime SDK - Runtime SDK for Aippy projects",
5
5
  "private": false,
6
6
  "type": "module",