@aippy/runtime 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,11 @@
1
- import { c as createError } from "../errors-DAz5_jDJ.js";
2
- class CameraAPI {
3
- stream = null;
1
+ var h = Object.defineProperty;
2
+ var p = (n, e, t) => e in n ? h(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var m = (n, e, t) => p(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { c as a } from "../errors-CDEBaBxB.js";
5
+ class g {
6
+ constructor() {
7
+ m(this, "stream", null);
8
+ }
4
9
  /**
5
10
  * Check if camera is supported
6
11
  */
@@ -10,23 +15,21 @@ class CameraAPI {
10
15
  /**
11
16
  * Get camera stream
12
17
  */
13
- async getStream(options = {}) {
14
- if (!this.isSupported()) {
15
- throw createError("Camera API is not supported", "NOT_SUPPORTED");
16
- }
18
+ async getStream(e = {}) {
19
+ if (!this.isSupported())
20
+ throw a("Camera API is not supported", "NOT_SUPPORTED");
17
21
  try {
18
- const constraints = {
22
+ const t = {
19
23
  video: {
20
- width: options.width,
21
- height: options.height,
22
- facingMode: options.facingMode || "environment"
24
+ width: e.width,
25
+ height: e.height,
26
+ facingMode: e.facingMode || "environment"
23
27
  }
24
28
  };
25
- this.stream = await navigator.mediaDevices.getUserMedia(constraints);
26
- return this.stream;
27
- } catch (error) {
28
- throw createError(
29
- `Failed to access camera: ${error instanceof Error ? error.message : "Unknown error"}`,
29
+ return this.stream = await navigator.mediaDevices.getUserMedia(t), this.stream;
30
+ } catch (t) {
31
+ throw a(
32
+ `Failed to access camera: ${t instanceof Error ? t.message : "Unknown error"}`,
30
33
  "PERMISSION_DENIED"
31
34
  );
32
35
  }
@@ -34,43 +37,30 @@ class CameraAPI {
34
37
  /**
35
38
  * Capture photo from stream
36
39
  */
37
- async capturePhoto(options = {}) {
38
- if (!this.stream) {
39
- throw createError("No camera stream available", "NOT_SUPPORTED");
40
- }
40
+ async capturePhoto(e = {}) {
41
+ if (!this.stream)
42
+ throw a("No camera stream available", "NOT_SUPPORTED");
41
43
  try {
42
- const video = document.createElement("video");
43
- video.srcObject = this.stream;
44
- video.play();
45
- const canvas = document.createElement("canvas");
46
- const ctx = canvas.getContext("2d");
47
- if (!ctx) {
48
- throw createError("Failed to get canvas context", "UNKNOWN_ERROR");
49
- }
50
- canvas.width = options.width || video.videoWidth;
51
- canvas.height = options.height || video.videoHeight;
52
- ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
53
- const format = options.format || "jpeg";
54
- const quality = options.quality === "high" ? 0.9 : options.quality === "medium" ? 0.7 : 0.5;
55
- const blob = await new Promise((resolve, reject) => {
56
- canvas.toBlob((blob2) => {
57
- if (blob2) {
58
- resolve(blob2);
59
- } else {
60
- reject(new Error("Failed to create blob"));
61
- }
62
- }, `image/${format}`, quality);
63
- });
64
- const dataUrl = canvas.toDataURL(`image/${format}`, quality);
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
+ throw a("Failed to get canvas context", "UNKNOWN_ERROR");
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, s = await new Promise((u, w) => {
51
+ o.toBlob((l) => {
52
+ l ? u(l) : w(new Error("Failed to create blob"));
53
+ }, `image/${r}`, c);
54
+ }), d = o.toDataURL(`image/${r}`, c);
65
55
  return {
66
- blob,
67
- dataUrl,
68
- width: canvas.width,
69
- height: canvas.height
56
+ blob: s,
57
+ dataUrl: d,
58
+ width: o.width,
59
+ height: o.height
70
60
  };
71
- } catch (error) {
72
- throw createError(
73
- `Failed to capture photo: ${error instanceof Error ? error.message : "Unknown error"}`,
61
+ } catch (t) {
62
+ throw a(
63
+ `Failed to capture photo: ${t instanceof Error ? t.message : "Unknown error"}`,
74
64
  "UNKNOWN_ERROR"
75
65
  );
76
66
  }
@@ -79,14 +69,11 @@ class CameraAPI {
79
69
  * Stop camera stream
80
70
  */
81
71
  stopStream() {
82
- if (this.stream) {
83
- this.stream.getTracks().forEach((track) => track.stop());
84
- this.stream = null;
85
- }
72
+ this.stream && (this.stream.getTracks().forEach((e) => e.stop()), this.stream = null);
86
73
  }
87
74
  }
88
- const camera = new CameraAPI();
89
- class GeolocationAPI {
75
+ const f = new g();
76
+ class v {
90
77
  /**
91
78
  * Check if geolocation is supported
92
79
  */
@@ -96,92 +83,88 @@ class GeolocationAPI {
96
83
  /**
97
84
  * Get current position
98
85
  */
99
- async getCurrentPosition(options = {}) {
100
- if (!this.isSupported()) {
101
- throw createError("Geolocation API is not supported", "NOT_SUPPORTED");
102
- }
103
- return new Promise((resolve, reject) => {
104
- const geoOptions = {
105
- enableHighAccuracy: options.enableHighAccuracy ?? true,
106
- timeout: options.timeout ?? 1e4,
107
- maximumAge: options.maximumAge ?? 6e4
86
+ async getCurrentPosition(e = {}) {
87
+ if (!this.isSupported())
88
+ throw a("Geolocation API is not supported", "NOT_SUPPORTED");
89
+ return new Promise((t, o) => {
90
+ const i = {
91
+ enableHighAccuracy: e.enableHighAccuracy ?? !0,
92
+ timeout: e.timeout ?? 1e4,
93
+ maximumAge: e.maximumAge ?? 6e4
108
94
  };
109
95
  navigator.geolocation.getCurrentPosition(
110
- (position) => {
111
- const result = {
112
- latitude: position.coords.latitude,
113
- longitude: position.coords.longitude,
114
- accuracy: position.coords.accuracy,
115
- altitude: position.coords.altitude ?? void 0,
116
- altitudeAccuracy: position.coords.altitudeAccuracy ?? void 0,
117
- heading: position.coords.heading ?? void 0,
118
- speed: position.coords.speed ?? void 0,
119
- timestamp: position.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
120
106
  };
121
- resolve(result);
107
+ t(c);
122
108
  },
123
- (error) => {
124
- let errorCode = "UNKNOWN_ERROR";
125
- let errorMessage = "Unknown geolocation error";
126
- switch (error.code) {
127
- case error.PERMISSION_DENIED:
128
- errorCode = "PERMISSION_DENIED";
129
- errorMessage = "Geolocation permission denied";
109
+ (r) => {
110
+ let c = "UNKNOWN_ERROR", s = "Unknown geolocation error";
111
+ switch (r.code) {
112
+ case r.PERMISSION_DENIED:
113
+ c = "PERMISSION_DENIED", s = "Geolocation permission denied";
130
114
  break;
131
- case error.POSITION_UNAVAILABLE:
132
- errorMessage = "Position unavailable";
115
+ case r.POSITION_UNAVAILABLE:
116
+ s = "Position unavailable";
133
117
  break;
134
- case error.TIMEOUT:
135
- errorMessage = "Geolocation timeout";
118
+ case r.TIMEOUT:
119
+ s = "Geolocation timeout";
136
120
  break;
137
121
  }
138
- reject(createError(errorMessage, errorCode));
122
+ o(a(s, c));
139
123
  },
140
- geoOptions
124
+ i
141
125
  );
142
126
  });
143
127
  }
144
128
  /**
145
129
  * Watch position changes
146
130
  */
147
- watchPosition(callback, options = {}) {
148
- if (!this.isSupported()) {
149
- throw createError("Geolocation API is not supported", "NOT_SUPPORTED");
150
- }
151
- const geoOptions = {
152
- enableHighAccuracy: options.enableHighAccuracy ?? true,
153
- timeout: options.timeout ?? 1e4,
154
- maximumAge: options.maximumAge ?? 6e4
131
+ watchPosition(e, t = {}) {
132
+ if (!this.isSupported())
133
+ throw a("Geolocation API is not supported", "NOT_SUPPORTED");
134
+ const o = {
135
+ enableHighAccuracy: t.enableHighAccuracy ?? !0,
136
+ timeout: t.timeout ?? 1e4,
137
+ maximumAge: t.maximumAge ?? 6e4
155
138
  };
156
139
  return navigator.geolocation.watchPosition(
157
- (position) => {
158
- const result = {
159
- latitude: position.coords.latitude,
160
- longitude: position.coords.longitude,
161
- accuracy: position.coords.accuracy,
162
- altitude: position.coords.altitude ?? void 0,
163
- altitudeAccuracy: position.coords.altitudeAccuracy ?? void 0,
164
- heading: position.coords.heading ?? void 0,
165
- speed: position.coords.speed ?? void 0,
166
- timestamp: position.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
167
150
  };
168
- callback(result);
151
+ e(r);
169
152
  },
170
- (error) => {
171
- console.error("Geolocation watch error:", error);
153
+ (i) => {
154
+ console.error("Geolocation watch error:", i);
172
155
  },
173
- geoOptions
156
+ o
174
157
  );
175
158
  }
176
159
  /**
177
160
  * Clear position watch
178
161
  */
179
- clearWatch(watchId) {
180
- navigator.geolocation.clearWatch(watchId);
162
+ clearWatch(e) {
163
+ navigator.geolocation.clearWatch(e);
181
164
  }
182
165
  }
183
- const geolocation = new GeolocationAPI();
184
- class SensorsAPI {
166
+ const N = new v();
167
+ class E {
185
168
  /**
186
169
  * Check if device orientation is supported
187
170
  */
@@ -198,107 +181,93 @@ class SensorsAPI {
198
181
  * Get device orientation data
199
182
  */
200
183
  async getOrientation() {
201
- if (!this.isOrientationSupported()) {
202
- throw createError("Device orientation API is not supported", "NOT_SUPPORTED");
203
- }
204
- return new Promise((resolve, reject) => {
205
- const handleOrientation = (event) => {
206
- window.removeEventListener("deviceorientation", handleOrientation);
207
- resolve({
208
- x: event.alpha ?? 0,
209
- y: event.beta ?? 0,
210
- z: event.gamma ?? 0,
184
+ if (!this.isOrientationSupported())
185
+ throw a("Device orientation API is not supported", "NOT_SUPPORTED");
186
+ return new Promise((e, t) => {
187
+ const o = (i) => {
188
+ window.removeEventListener("deviceorientation", o), e({
189
+ x: i.alpha ?? 0,
190
+ y: i.beta ?? 0,
191
+ z: i.gamma ?? 0,
211
192
  timestamp: Date.now()
212
193
  });
213
194
  };
214
- window.addEventListener("deviceorientation", handleOrientation);
215
- setTimeout(() => {
216
- window.removeEventListener("deviceorientation", handleOrientation);
217
- reject(createError("Device orientation timeout", "UNKNOWN_ERROR"));
195
+ window.addEventListener("deviceorientation", o), setTimeout(() => {
196
+ window.removeEventListener("deviceorientation", o), t(a("Device orientation timeout", "UNKNOWN_ERROR"));
218
197
  }, 5e3);
219
198
  });
220
199
  }
221
200
  /**
222
201
  * Watch device orientation changes
223
202
  */
224
- watchOrientation(callback) {
225
- if (!this.isOrientationSupported()) {
226
- throw createError("Device orientation API is not supported", "NOT_SUPPORTED");
227
- }
228
- const handleOrientation = (event) => {
229
- callback({
230
- x: event.alpha ?? 0,
231
- y: event.beta ?? 0,
232
- z: event.gamma ?? 0,
203
+ watchOrientation(e) {
204
+ if (!this.isOrientationSupported())
205
+ throw a("Device orientation API is not supported", "NOT_SUPPORTED");
206
+ const t = (o) => {
207
+ e({
208
+ x: o.alpha ?? 0,
209
+ y: o.beta ?? 0,
210
+ z: o.gamma ?? 0,
233
211
  timestamp: Date.now()
234
212
  });
235
213
  };
236
- window.addEventListener("deviceorientation", handleOrientation);
237
- return () => {
238
- window.removeEventListener("deviceorientation", handleOrientation);
214
+ return window.addEventListener("deviceorientation", t), () => {
215
+ window.removeEventListener("deviceorientation", t);
239
216
  };
240
217
  }
241
218
  /**
242
219
  * Get device motion data
243
220
  */
244
221
  async getMotion() {
245
- if (!this.isMotionSupported()) {
246
- throw createError("Device motion API is not supported", "NOT_SUPPORTED");
247
- }
248
- return new Promise((resolve, reject) => {
249
- const handleMotion = (event) => {
250
- window.removeEventListener("devicemotion", handleMotion);
251
- resolve({
252
- x: event.acceleration?.x ?? 0,
253
- y: event.acceleration?.y ?? 0,
254
- z: event.acceleration?.z ?? 0,
222
+ if (!this.isMotionSupported())
223
+ throw a("Device motion API is not supported", "NOT_SUPPORTED");
224
+ return new Promise((e, t) => {
225
+ const o = (i) => {
226
+ window.removeEventListener("devicemotion", o), e({
227
+ x: i.acceleration?.x ?? 0,
228
+ y: i.acceleration?.y ?? 0,
229
+ z: i.acceleration?.z ?? 0,
255
230
  timestamp: Date.now()
256
231
  });
257
232
  };
258
- window.addEventListener("devicemotion", handleMotion);
259
- setTimeout(() => {
260
- window.removeEventListener("devicemotion", handleMotion);
261
- reject(createError("Device motion timeout", "UNKNOWN_ERROR"));
233
+ window.addEventListener("devicemotion", o), setTimeout(() => {
234
+ window.removeEventListener("devicemotion", o), t(a("Device motion timeout", "UNKNOWN_ERROR"));
262
235
  }, 5e3);
263
236
  });
264
237
  }
265
238
  /**
266
239
  * Watch device motion changes
267
240
  */
268
- watchMotion(callback) {
269
- if (!this.isMotionSupported()) {
270
- throw createError("Device motion API is not supported", "NOT_SUPPORTED");
271
- }
272
- const handleMotion = (event) => {
273
- callback({
274
- x: event.acceleration?.x ?? 0,
275
- y: event.acceleration?.y ?? 0,
276
- z: event.acceleration?.z ?? 0,
241
+ watchMotion(e) {
242
+ if (!this.isMotionSupported())
243
+ throw a("Device motion API is not supported", "NOT_SUPPORTED");
244
+ const t = (o) => {
245
+ e({
246
+ x: o.acceleration?.x ?? 0,
247
+ y: o.acceleration?.y ?? 0,
248
+ z: o.acceleration?.z ?? 0,
277
249
  timestamp: Date.now()
278
250
  });
279
251
  };
280
- window.addEventListener("devicemotion", handleMotion);
281
- return () => {
282
- window.removeEventListener("devicemotion", handleMotion);
252
+ return window.addEventListener("devicemotion", t), () => {
253
+ window.removeEventListener("devicemotion", t);
283
254
  };
284
255
  }
285
256
  /**
286
257
  * Request permission for motion sensors (iOS 13+)
287
258
  */
288
259
  async requestPermission() {
289
- if (!this.isMotionSupported()) {
290
- return false;
291
- }
260
+ if (!this.isMotionSupported())
261
+ return !1;
292
262
  try {
293
- const permission = await navigator.permissions?.query({ name: "accelerometer" });
294
- return permission?.state === "granted";
263
+ return (await navigator.permissions?.query({ name: "accelerometer" }))?.state === "granted";
295
264
  } catch {
296
- return false;
265
+ return !1;
297
266
  }
298
267
  }
299
268
  }
300
- const sensors = new SensorsAPI();
301
- class FileSystemAPI {
269
+ const R = new E();
270
+ class O {
302
271
  /**
303
272
  * Check if file system access is supported
304
273
  */
@@ -309,39 +278,33 @@ class FileSystemAPI {
309
278
  * Check if legacy file input is supported
310
279
  */
311
280
  isLegacySupported() {
312
- return typeof document !== "undefined" && "createElement" in document;
281
+ return typeof document < "u" && "createElement" in document;
313
282
  }
314
283
  /**
315
284
  * Open file picker (modern API)
316
285
  */
317
- async openFilePicker(options = {}) {
318
- if (!this.isSupported()) {
319
- throw createError("File System Access API is not supported", "NOT_SUPPORTED");
320
- }
286
+ async openFilePicker(e = {}) {
287
+ if (!this.isSupported())
288
+ throw a("File System Access API is not supported", "NOT_SUPPORTED");
321
289
  try {
322
- const pickerOptions = {
323
- types: options.accept ? [{
290
+ const t = {
291
+ types: e.accept ? [{
324
292
  description: "Files",
325
293
  accept: Object.fromEntries(
326
- options.accept.map((type) => [type, [type]])
294
+ e.accept.map((r) => [r, [r]])
327
295
  )
328
296
  }] : void 0,
329
- multiple: options.multiple ?? false
330
- };
331
- const fileHandles = await window.showOpenFilePicker(pickerOptions);
332
- const files = await Promise.all(
333
- fileHandles.map(async (handle) => handle.getFile())
297
+ multiple: e.multiple ?? !1
298
+ }, o = await window.showOpenFilePicker(t), i = await Promise.all(
299
+ o.map(async (r) => r.getFile())
334
300
  );
335
301
  return {
336
- files,
337
- paths: files.map((file) => file.name)
302
+ files: i,
303
+ paths: i.map((r) => r.name)
338
304
  };
339
- } catch (error) {
340
- if (error instanceof Error && error.name === "AbortError") {
341
- throw createError("File picker was cancelled", "PERMISSION_DENIED");
342
- }
343
- throw createError(
344
- `Failed to open file picker: ${error instanceof Error ? error.message : "Unknown error"}`,
305
+ } catch (t) {
306
+ throw t instanceof Error && t.name === "AbortError" ? a("File picker was cancelled", "PERMISSION_DENIED") : a(
307
+ `Failed to open file picker: ${t instanceof Error ? t.message : "Unknown error"}`,
345
308
  "PERMISSION_DENIED"
346
309
  );
347
310
  }
@@ -349,55 +312,38 @@ class FileSystemAPI {
349
312
  /**
350
313
  * Open file picker (legacy fallback)
351
314
  */
352
- async openFilePickerLegacy(options = {}) {
353
- if (!this.isLegacySupported()) {
354
- throw createError("File input is not supported", "NOT_SUPPORTED");
355
- }
356
- return new Promise((resolve, reject) => {
357
- const input = document.createElement("input");
358
- input.type = "file";
359
- input.multiple = options.multiple ?? false;
360
- input.accept = options.accept?.join(",") ?? "";
361
- input.onchange = (event) => {
362
- const target = event.target;
363
- const files = Array.from(target.files || []);
364
- resolve({
365
- files,
366
- paths: files.map((file) => file.name)
315
+ async openFilePickerLegacy(e = {}) {
316
+ if (!this.isLegacySupported())
317
+ throw a("File input is not supported", "NOT_SUPPORTED");
318
+ return new Promise((t, o) => {
319
+ const i = document.createElement("input");
320
+ i.type = "file", i.multiple = e.multiple ?? !1, i.accept = e.accept?.join(",") ?? "", i.onchange = (r) => {
321
+ const c = r.target, s = Array.from(c.files || []);
322
+ t({
323
+ files: s,
324
+ paths: s.map((d) => d.name)
367
325
  });
368
- };
369
- input.oncancel = () => {
370
- reject(createError("File picker was cancelled", "PERMISSION_DENIED"));
371
- };
372
- input.click();
326
+ }, i.oncancel = () => {
327
+ o(a("File picker was cancelled", "PERMISSION_DENIED"));
328
+ }, i.click();
373
329
  });
374
330
  }
375
331
  /**
376
332
  * Open file picker with fallback
377
333
  */
378
- async openFile(options = {}) {
379
- if (this.isSupported()) {
380
- return await this.openFilePicker(options);
381
- } else {
382
- return await this.openFilePickerLegacy(options);
383
- }
334
+ async openFile(e = {}) {
335
+ return this.isSupported() ? await this.openFilePicker(e) : await this.openFilePickerLegacy(e);
384
336
  }
385
337
  /**
386
338
  * Save file
387
339
  */
388
- async saveFile(blob, filename) {
340
+ async saveFile(e, t) {
389
341
  try {
390
- const url = URL.createObjectURL(blob);
391
- const a = document.createElement("a");
392
- a.href = url;
393
- a.download = filename;
394
- document.body.appendChild(a);
395
- a.click();
396
- document.body.removeChild(a);
397
- URL.revokeObjectURL(url);
398
- } catch (error) {
399
- throw createError(
400
- `Failed to save file: ${error instanceof Error ? error.message : "Unknown error"}`,
342
+ const o = URL.createObjectURL(e), i = document.createElement("a");
343
+ i.href = o, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(o);
344
+ } catch (o) {
345
+ throw a(
346
+ `Failed to save file: ${o instanceof Error ? o.message : "Unknown error"}`,
401
347
  "UNKNOWN_ERROR"
402
348
  );
403
349
  }
@@ -405,53 +351,45 @@ class FileSystemAPI {
405
351
  /**
406
352
  * Read file as text
407
353
  */
408
- async readAsText(file) {
409
- return new Promise((resolve, reject) => {
410
- const reader = new FileReader();
411
- reader.onload = () => resolve(reader.result);
412
- reader.onerror = () => reject(createError("Failed to read file", "UNKNOWN_ERROR"));
413
- reader.readAsText(file);
354
+ async readAsText(e) {
355
+ return new Promise((t, o) => {
356
+ const i = new FileReader();
357
+ i.onload = () => t(i.result), i.onerror = () => o(a("Failed to read file", "UNKNOWN_ERROR")), i.readAsText(e);
414
358
  });
415
359
  }
416
360
  /**
417
361
  * Read file as data URL
418
362
  */
419
- async readAsDataURL(file) {
420
- return new Promise((resolve, reject) => {
421
- const reader = new FileReader();
422
- reader.onload = () => resolve(reader.result);
423
- reader.onerror = () => reject(createError("Failed to read file", "UNKNOWN_ERROR"));
424
- reader.readAsDataURL(file);
363
+ async readAsDataURL(e) {
364
+ return new Promise((t, o) => {
365
+ const i = new FileReader();
366
+ i.onload = () => t(i.result), i.onerror = () => o(a("Failed to read file", "UNKNOWN_ERROR")), i.readAsDataURL(e);
425
367
  });
426
368
  }
427
369
  }
428
- const fileSystem = new FileSystemAPI();
429
- function vibrate(pattern) {
430
- return new Promise((resolve) => {
431
- if ("vibrate" in navigator) {
432
- navigator.vibrate(pattern);
433
- resolve();
434
- } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.aippyListener) {
435
- const data = {
370
+ const S = new O();
371
+ function D(n) {
372
+ return new Promise((e) => {
373
+ if ("vibrate" in navigator)
374
+ navigator.vibrate(n), e();
375
+ else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.aippyListener) {
376
+ const t = {
436
377
  command: "navigator.vibrate",
437
- parameters: pattern
378
+ parameters: n
438
379
  };
439
- window.webkit.messageHandlers.aippyListener.postMessage(data);
440
- resolve();
441
- } else {
442
- console.warn("Vibration not supported in this environment");
443
- resolve();
444
- }
380
+ window.webkit.messageHandlers.aippyListener.postMessage(t), e();
381
+ } else
382
+ console.warn("Vibration not supported in this environment"), e();
445
383
  });
446
384
  }
447
385
  export {
448
- CameraAPI,
449
- FileSystemAPI,
450
- GeolocationAPI,
451
- SensorsAPI,
452
- camera,
453
- fileSystem,
454
- geolocation,
455
- sensors,
456
- vibrate
386
+ g as CameraAPI,
387
+ O as FileSystemAPI,
388
+ v as GeolocationAPI,
389
+ E as SensorsAPI,
390
+ f as camera,
391
+ S as fileSystem,
392
+ N as geolocation,
393
+ R as sensors,
394
+ D as vibrate
457
395
  };