hybrid_plus
Version:
Hybrid Flutter Javascript SDK
932 lines (931 loc) • 27.6 kB
JavaScript
var re = Object.defineProperty;
var ne = (e, r, n) => r in e ? re(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
var g = (e, r, n) => (ne(e, typeof r != "symbol" ? r + "" : r, n), n);
let R;
const te = new Uint8Array(16);
function oe() {
if (!R && (R = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !R))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
return R(te);
}
const i = [];
for (let e = 0; e < 256; ++e)
i.push((e + 256).toString(16).slice(1));
function ue(e, r = 0) {
return i[e[r + 0]] + i[e[r + 1]] + i[e[r + 2]] + i[e[r + 3]] + "-" + i[e[r + 4]] + i[e[r + 5]] + "-" + i[e[r + 6]] + i[e[r + 7]] + "-" + i[e[r + 8]] + i[e[r + 9]] + "-" + i[e[r + 10]] + i[e[r + 11]] + i[e[r + 12]] + i[e[r + 13]] + i[e[r + 14]] + i[e[r + 15]];
}
const ce = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), x = {
randomUUID: ce
};
function ie(e, r, n) {
if (x.randomUUID && !r && !e)
return x.randomUUID();
e = e || {};
const t = e.random || (e.rng || oe)();
return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, ue(t);
}
class z {
constructor(r) {
g(this, "_enabled");
g(this, "_PREFIX");
this._enabled = r ?? !1, this._PREFIX = "Hybrid JS SDK ";
}
/**
* 是否启用日志
* @returns {boolean}
*/
get enabled() {
return this._enabled;
}
/**
* 是否禁用日志
* @returns {boolean}
*/
get disabled() {
return !this._enabled;
}
/**
* 启用日志打印
*/
enable() {
this._enabled = !0;
}
/**
* 关闭日志打印
*/
disable() {
this._enabled = !1;
}
/**
* 打印日志
* @params {[]} [arguments]
*/
log(r) {
const n = [];
for (let t = 0; t < r.length; t++)
n[t] = r[t];
this._enabled && console.log(this._PREFIX + "[Log]: " + n.join(""));
}
/**
* 打印警告
* @params {[]} [arguments]
*/
warn(r) {
const n = [];
for (let t = 0; t < r.length; t++)
n[t] = r[t];
this._enabled && console.warn(this._PREFIX + "[Warn]: " + n.join(""));
}
/**
* 打印错误
* @params {[]} [arguments]
*/
error(r) {
const n = [];
for (let t = 0; t < r.length; t++)
n[t] = r[t];
this._enabled && console.error(this._PREFIX + "[Error]: " + n.join(""));
}
}
function h(e) {
return Object.prototype.toString.call(e) === "[object Function]";
}
function B(e) {
return e == null || e == null;
}
function le() {
let e;
return (e = window == null ? void 0 : window.navigator) === null || e === void 0 ? void 0 : e.userAgent.includes("hybrid");
}
function de() {
return typeof window < "u" && Object.prototype.toString.call(window) === "[object Window]";
}
const N = 5e3;
class ae {
/**
* Core 构造方法
* @param {Logger} logger 日志打印工具
* @param {number} timeout 通信超时时间
*/
constructor(r, n) {
g(this, "_deviceReady");
g(this, "_inject");
g(this, "_logger");
g(this, "_timeout");
g(this, "_errorCallback");
this._deviceReady = window.deviceReady || !0, this._inject = !1, this._logger = B(r) ? new z(!0) : r, this._timeout = B(n) ? N : n, ge();
}
/**
* 设备是否准备就绪
* @returns boolean
* @memberof Core
*/
get isDeviceReady() {
return this._deviceReady;
}
/**
* 日志打印工具
* @returns Logger
* @memberof Core
*/
get logger() {
return this._logger;
}
/**
* 通信超时事件
* @returns number
* @memberof Core
*/
get timeout() {
return this._timeout;
}
/**
* 初始化配置项
* @param {CoreOptions} [options]
* @returns {boolean}
* @memberof Core
*/
init(r) {
const n = this, t = B(r);
if (n._logger || (n._logger = new z(!1)), !t && r.debug && (n._logger.enable(), n._logger.warn("SDK 已开启调试模式")), !de()) {
n._logger.error("不支持非浏览器环境");
return;
}
if (n._logger.warn("SDK 已" + (!t && r.auth ? "开启" : "关闭") + "接口鉴权"), n._timeout = t ? N : r.timeout, n._logger.warn("SDK 设置的超时时间为: " + n._timeout + "ms"), !le()) {
n._logger.error("请在 Flutter APP 内打开应用");
return;
}
}
/**
* 在 Flutter 准备就绪时触发,api的调用需要保证在该回调函数触发后调用
* @param {Function} [fn] 回调函数
* @memberof Core
*/
onDeviceReady(r) {
const n = this;
return new Promise(function(t) {
const c = function() {
return r && h(r) && r();
};
n.isDeviceReady ? (t(), c()) : window.deviceReady ? (n._deviceReady = !0, t(), c()) : document.addEventListener("deviceReady", function() {
n._logger.warn("设备已就绪!(deviceReady 事件被触发)"), n._deviceReady = !0, t(), c();
}, !1);
});
}
/**
* 注册error函数, 在SDK发生错误/异常时执行
* @param {Function} [fn] 回调函数
* @memberof Core
*/
error(r) {
if (!h(r)) {
this._logger.error("错误监听回调仅支持函数参数");
return;
}
this._errorCallback = r;
}
/**
* 执行error回调函数
* @param {unknown} error 错误对象
* @memberof Core
*/
onError(r) {
this._errorCallback && h(this._errorCallback) && this._errorCallback(r);
}
}
const f = new ae(), se = f.init, ve = f.isDeviceReady, fe = f.error, E = f.logger, S = [], Q = window.Hybrid, V = function(e) {
try {
return JSON.parse(e);
} catch {
return e;
}
};
function ge() {
window.onNativeError ?? (window.onNativeError = (e) => {
if (!e)
return;
const { uuid: r, message: n } = V(e);
if (B(r))
return;
const t = S.findIndex((s) => s.uuid == r);
if (t == -1)
return;
const c = S[t];
E.error(c.api + " 接口调用失败"), f.onError(c.api + " 调用失败: " + n), c.timer && clearTimeout(c.timer), c.onError !== null && c.onError !== void 0 && h(c.onError) && c.onError(n), c.reject(n), S.splice(t, 1);
}), window.onNativeSuccess ?? (window.onNativeSuccess = (e) => {
if (!e)
return;
const { uuid: r, response: n } = V(e);
if (B(r))
return;
const t = S.findIndex((s) => s.uuid == r);
if (t == -1)
return;
const c = S[t];
E.log(c.api + " 调用成功: " + JSON.stringify(n, null, 4)), c.timer && clearTimeout(c.timer), c.onSuccess !== null && c.onSuccess !== void 0 && h(c.onSuccess) && c.onSuccess(n), c.resolve(n), S.splice(t, 1);
});
}
function o(e, r, n, t, c, s) {
return s === void 0 && (s = !0), new Promise(function(C, F) {
const H = e + "." + r, Z = s ? setTimeout(function(w) {
w === void 0 && (w = "接口调用超时"), E.warn(H + " 接口调用响应超时,请重试"), c && h(c) && c(w), F(w);
}, f.timeout) : 0, L = ie(), p = JSON.stringify({ service: e, action: r, uuid: L, args: n }), ee = function() {
E.log("准备调用 " + H), S.push({
uuid: L,
resolve: C,
reject: F,
timer: Z,
onSuccess: t,
onError: c,
api: H
}), Q.postMessage(p);
};
try {
f.onDeviceReady(ee).then(() => {
});
} catch (w) {
f.onError(w);
}
});
}
function u(e, r, n) {
const t = e + "." + r;
E.log("同步调用 " + t);
const c = JSON.stringify({ service: e, action: r, args: n }), s = function() {
E.log("准备调用 " + t), Q.postMessage(c);
};
f.onDeviceReady(s).then(() => {
});
}
const k = "Hybrid_Auth", Se = "Hybrid_Server", D = "Hybrid_Device", _ = "Hybrid_File", l = "Hybrid_Appbar", m = "Hybrid_Cachet", O = "Hybrid_User", I = "Hybrid_Image", j = "Hybrid_Contacts", y = "Hybrid_Dialog", A = "Hybrid_Video", P = "Hybrid_Network", _e = "Hybrid_Location", d = "Hybrid_Util", M = "Hybrid_Storage", a = "Hybrid_Bluetooth", T = "Hybrid_App", b = "Hybrid_WebView", v = "Hybrid_Audio", ye = "Hybrid_Config";
function be(e) {
return o(k, "getUserTicket", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function we(e) {
let r, n, t;
return typeof e == "string" ? r = e : e != null && typeof e == "object" && (r = e.userTicket, n = e.onSuccess, t = e.onError), o(k, "refreshUserTicket", r, n, t, !1);
}
function he(e) {
return o(k, "getToken", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Ee(e) {
let r, n, t;
return typeof e == "string" ? r = e : e != null && typeof e == "object" && (r = e.token, n = e.onSuccess, t = e.onError), o(k, "refreshToken", r, n, t, !1);
}
const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getToken: he,
getUserTicket: be,
refreshToken: Ee,
refreshUserTicket: we
}, Symbol.toStringTag, { value: "Module" }));
function Ie(e) {
return o(D, "biometric", e.reason, e === void 0 ? void 0 : e.onSuccess, e === void 0 ? void 0 : e.onError, !1);
}
function Be(e) {
return o(D, "setOrientation", e);
}
function Re(e) {
return o(D, "getDeviceInfo", null, e === null || e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function ke(e) {
return u(D, "toggleKeepScreenOn", e);
}
const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
biometric: Ie,
getDeviceInfo: Re,
setOrientation: Be,
toggleKeepScreenOn: ke
}, Symbol.toStringTag, { value: "Module" }));
function Oe(e) {
return o(Se, "getServerInfo", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
const Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getServerInfo: Oe
}, Symbol.toStringTag, { value: "Module" }));
function Te(e) {
return o(l, "isDisplay", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Ce() {
return u(l, "setDisplay", !0);
}
function He() {
return u(l, "setDisplay", !1);
}
function je(e) {
return u(l, "setTitle", e);
}
function Pe(e) {
return u(l, "setBackground", e);
}
function Me(e) {
return u(l, "setForeground", e);
}
function Ue(e) {
return o(l, "isBackButtonDisplay", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Fe() {
return u(l, "setBackButtonDisplay", !0);
}
function Le() {
return u(l, "setBackButtonDisplay", !1);
}
function xe(e) {
return u(l, "setBackButtonAction", e);
}
function ze() {
return u(l, "setBackButtonAction", void 0);
}
function Ne(e) {
return u(l, "setActions", e);
}
function Ve() {
return u(l, "setActions", void 0);
}
function Ye(e) {
return o(l, "getStatusBarHeight", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function We(e) {
return o(l, "setSystemUIOverlayStyle", e);
}
function $e(e) {
return o(l, "getAppbarHeight", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
clearActions: Ve,
clearBackButtonAction: ze,
dismiss: He,
dismissBackButton: Le,
getAppbarHeight: $e,
getStatusBarHeight: Ye,
isBackButtonDisplay: Ue,
isDisplay: Te,
setActions: Ne,
setBackButtonAction: xe,
setBackground: Pe,
setForeground: Me,
setSystemUIOverlayStyle: We,
setTitle: je,
show: Ce,
showBackButton: Fe
}, Symbol.toStringTag, { value: "Module" }));
function Xe(e) {
return o(m, "isDisplay", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Je() {
return u(m, "setDisplay", !0);
}
function Ge() {
return u(m, "setDisplay", !1);
}
function qe(e) {
return u(m, "setBackground", e);
}
function Qe(e) {
return u(m, "setForeground", e);
}
function Ze(e) {
return u(m, "setBorderColor", e);
}
const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
dismiss: Ge,
isDisplay: Xe,
setBackground: qe,
setBorderColor: Ze,
setForeground: Qe,
show: Je
}, Symbol.toStringTag, { value: "Module" }));
function er(e) {
return o(O, "getCurrentLoginAccount", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function rr(e) {
return o(O, "getCurrentUserInfo", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function nr(e) {
return o(O, "getUserInfoById", e.userId, e === void 0 ? void 0 : e.onSuccess, e === void 0 ? void 0 : e.onError);
}
function tr(e) {
return u(O, "showUserInfoById", e);
}
const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getCurrentLoginAccount: er,
getCurrentUserInfo: rr,
getUserInfoById: nr,
showUserInfoById: tr
}, Symbol.toStringTag, { value: "Module" }));
var U = /* @__PURE__ */ ((e) => (e[e.camera = 0] = "camera", e[e.gallery = 1] = "gallery", e))(U || {});
function ur(e) {
return o(I, "pickImage", {
...e,
source: U.camera
}, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function cr(e) {
return o(I, "pickImage", {
...e,
source: U.gallery
}, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function ir(e) {
return u(I, "previewImages", e);
}
function lr(e) {
return o(I, "saveImageToAlbum", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function dr(e) {
return o(I, "addWaterMark", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, e.upload != !0);
}
function ar(e) {
return o(I, "toBase64", e.path, e === void 0 ? void 0 : e.onSuccess, e === void 0 ? void 0 : e.onError);
}
const sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
addWaterMark: dr,
pickImage: cr,
previewImages: ir,
saveImageToAlbum: lr,
takePhoto: ur,
toBase64: ar
}, Symbol.toStringTag, { value: "Module" }));
function vr(e) {
return o(_, "pickFile", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function fr(e) {
return o(_, "openFile", e.path, e === void 0 ? void 0 : e.onSuccess, e === void 0 ? void 0 : e.onError, !1);
}
function gr(e) {
return o(_, "openNetworkFile", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function Sr(e) {
return o(_, "isFileExist", e.path, e === void 0 ? void 0 : e.onSuccess, e === void 0 ? void 0 : e.onError, !0);
}
function _r(e) {
return o(_, "download", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function yr(e) {
return o(_, "upload", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function br(e) {
return o(_, "getFileDirectory", e.path, e === void 0 ? void 0 : e.onSuccess, e === void 0 ? void 0 : e.onError, !0);
}
const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
download: _r,
getFileDirectory: br,
isFileExist: Sr,
openFile: fr,
openNetworkFile: gr,
pickFile: vr,
upload: yr
}, Symbol.toStringTag, { value: "Module" }));
function hr(e) {
return o(j, "pickEmployee", e, e === null || e == null ? void 0 : e.onSuccess, e === null || e == null ? void 0 : e.onError, !1);
}
function Er(e) {
return o(j, "pickEmployees", e, e === null || e == null ? void 0 : e.onSuccess, e === null || e == null ? void 0 : e.onError, !1);
}
function mr(e) {
return o(j, "getMobileContacts", e, e === null || e == null ? void 0 : e.onSuccess, e === null || e == null ? void 0 : e.onError, !1);
}
const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getMobileContacts: mr,
pickEmployee: hr,
pickEmployees: Er
}, Symbol.toStringTag, { value: "Module" }));
function Br(e) {
return o(y, "showActionSheet", e.items, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function Rr(e) {
return o(y, "showConfirmDialog", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function kr(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(y, "showInputDialog", t, r, n, !1);
}
function Dr(e) {
return u(y, "showSnackBar", e);
}
function Or(e) {
return u(y, "showToast", e);
}
function Ar(e) {
return u(y, "showLoading", e);
}
function Tr() {
return u(y, "dismissLoading");
}
const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
dismissLoading: Tr,
showActionSheet: Br,
showConfirmDialog: Rr,
showInputDialog: kr,
showLoading: Ar,
showSnackBar: Dr,
showToast: Or
}, Symbol.toStringTag, { value: "Module" }));
function Hr(e) {
return o(A, "pickVideo", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function jr(e) {
return o(A, "recordVideo", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function Pr(e) {
return u(A, "playVideo", e);
}
function Mr(e) {
return u(A, "playLiveStream", e);
}
const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
pickVideo: Hr,
playLiveStream: Mr,
playVideo: Pr,
recordVideo: jr
}, Symbol.toStringTag, { value: "Module" }));
function Fr(e) {
return o(P, "getConnectivityState", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Lr(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(P, "request", t, r, n, !1);
}
function xr(e) {
return o(P, "getCurrentWifi", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getConnectivityState: Fr,
getCurrentWifi: xr,
request: Lr
}, Symbol.toStringTag, { value: "Module" }));
function Nr(e) {
return o(_e, "getLocation", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
const Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getLocation: Nr
}, Symbol.toStringTag, { value: "Module" }));
function Yr(e) {
if (typeof e == "string")
return u(d, "tel", e);
{
const { number: r, onSuccess: n, onError: t } = e;
return o(d, "tel", r, n, t);
}
}
function Wr(e) {
if (typeof e == "string")
return u(d, "sms", e);
{
const { number: r, onSuccess: n, onError: t } = e;
return o(d, "sms", r, n, t);
}
}
function $r(e) {
if (typeof e == "string")
return u(d, "mailTo", e);
{
const { address: r, onSuccess: n, onError: t } = e;
return o(d, "mailTo", r, n, t);
}
}
function Kr(e) {
return o(d, "scanQRCode", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError, !1);
}
function Xr(e) {
const { path: r, onSuccess: n, onError: t } = e;
return o(d, "voiceToText", r, n, t, !1);
}
function Jr(e) {
return u(d, "copyText", e);
}
function Gr() {
return u(d, "vibrate", void 0);
}
function qr(e) {
const { content: r, onSuccess: n, onError: t } = e;
return o(d, "generateBarcode", r, n, t);
}
function Qr(e) {
return u(d, "share", e);
}
function Zr(e) {
let r, n, t;
if (Array.isArray(e))
r = e;
else if (e != null) {
const { onSuccess: c, onError: s, ...C } = e;
r = C, n = c, t = s;
}
return o(d, "shareFiles", r, n, t, !1);
}
const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
copyText: Jr,
generateBarcode: qr,
mailto: $r,
scanQRCode: Kr,
share: Qr,
shareFiles: Zr,
sms: Wr,
tel: Yr,
vibrate: Gr,
voiceToText: Xr
}, Symbol.toStringTag, { value: "Module" })), Y = [], W = [], $ = [], K = [], X = [], J = [], G = [], q = [];
function en(e) {
Y.push(e), (window.onDetach === null || window.onDetach === void 0) && (window.onDetach = () => {
for (const r of Y)
r();
});
}
function rn(e) {
W.push(e), (window.onResume === null || window.onResume === void 0) && (window.onResume = () => {
for (const r of W)
r();
});
}
function nn(e) {
$.push(e), (window.onInactive === null || window.onInactive === void 0) && (window.onInactive = () => {
for (const r of $)
r();
});
}
function tn(e) {
K.push(e), (window.onHide === null || window.onHide === void 0) && (window.onHide = () => {
for (const r of K)
r();
});
}
function on(e) {
X.push(e), (window.onPause === null || window.onPause === void 0) && (window.onPause = () => {
for (const r of X)
r();
});
}
function un(e) {
J.push(e), (window.onShow === null || window.onShow === void 0) && (window.onShow = () => {
for (const r of J)
r();
});
}
function cn(e) {
G.push(e), (window.onRestart === null || window.onRestart === void 0) && (window.onRestart = () => {
for (const r of G)
r();
});
}
function ln(e) {
q.push(e), (window.onStateChange === null || window.onStateChange === void 0) && (window.onStateChange = (r) => {
for (const n of q)
n(r);
}, console.log(window.onStateChange));
}
function dn(e) {
window.onPopInvoked = e, console.log(window.onPopInvoked);
}
function an() {
window.onPopInvoked = void 0;
}
const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
bindBackButtonEvent: dn,
bindDetachEvent: en,
bindHideEvent: tn,
bindInactiveEvent: nn,
bindPausedEvent: on,
bindRestartEvent: cn,
bindResumeEvent: rn,
bindShowEvent: un,
bingAppLifecycleStateListener: ln,
unbindBackButtonEvent: an
}, Symbol.toStringTag, { value: "Module" }));
function vn(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(M, "set", t, r, n);
}
function fn(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(M, "get", t, r, n);
}
function gn(e) {
const { onSuccess: r, onError: n, appId: t } = e;
return o(M, "clear", t, r, n);
}
const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
clear: gn,
get: fn,
set: vn
}, Symbol.toStringTag, { value: "Module" }));
function _n(e) {
return o(a, "turnOn", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function yn(e) {
return o(a, "isSupported", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function bn(e) {
return o(a, "isScanningNow", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function wn(e) {
return o(a, "adapterStateNow", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function hn(e) {
return o(a, "adapterName", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function En(e) {
window.onBluetoothScanResults = e;
}
function mn() {
window.onBluetoothScanResults = null;
}
function In(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(a, "startScan", t, r, n, !1);
}
function Bn() {
return u(a, "stopScan", null);
}
function Rn(e) {
return o(a, "getBondedDevices", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function kn(e) {
return o(a, "getSystemDevices", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Dn(e) {
return o(a, "getConnectedDevices", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function On(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(a, "connect", t, r, n, !1);
}
function An(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(a, "disconnect", t, r, n, !1);
}
function Tn(e) {
window.onBluetoothAdapterStateChange = e, u(a, "addAdapterStateListener");
}
function Cn() {
window.onBluetoothAdapterStateChange = null, u(a, "cancelAdapterStateListener");
}
const Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
adapterName: hn,
adapterStateNow: wn,
bindAdapterStateListener: Tn,
bindScanResultListener: En,
connect: On,
disconnect: An,
getBondedDevices: Rn,
getConnectedDevices: Dn,
getSystemDevices: kn,
isScanningNow: bn,
isSupported: yn,
startScan: In,
stopScan: Bn,
turnOn: _n,
unbindAdapterStateListener: Cn,
unbindScanResultListener: mn
}, Symbol.toStringTag, { value: "Module" }));
function jn(e) {
return o(b, "getAppId", null, e === null || e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Pn() {
return u(b, "clearCache");
}
function Mn(e) {
return u(b, "exit", e);
}
function Un(e) {
return u(b, "addWaterMark", e);
}
function Fn() {
return u(b, "removeWaterMark");
}
function Ln(e) {
return u(b, "setBackgroundColor", e);
}
function xn() {
return u(b, "clearBackgroundColor");
}
const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
addWaterMark: Un,
clearBackgroundColor: xn,
clearCache: Pn,
exit: Mn,
getAppId: jn,
removeWaterMark: Fn,
setBackgroundColor: Ln
}, Symbol.toStringTag, { value: "Module" }));
function Nn(e) {
return o(T, "getPrimaryColor", null, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Vn(e) {
return o(T, "getAppInfo", null, e === null || e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Yn(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(T, "route", t, r, n, !1);
}
function Wn(e) {
const { onSuccess: r, onError: n, ...t } = e;
return o(T, "openWebView", t, r, n, !1);
}
function $n() {
return u(d, "clearCache");
}
const Kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
clearCache: $n,
getAppInfo: Vn,
getPrimaryColor: Nn,
openWebView: Wn,
route: Yn
}, Symbol.toStringTag, { value: "Module" }));
function Xn(e) {
return o(v, "openRecorder", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Jn(e) {
return o(v, "closeRecorder", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function Gn(e) {
return o(v, "startRecord", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function qn() {
return u(v, "pauseRecord", void 0);
}
function Qn() {
return u(v, "resumeRecord", void 0);
}
function Zn() {
return u(v, "cancelRecord", void 0);
}
function pn(e) {
return o(v, "stopRecord", void 0, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
function et(e) {
return u(v, "openRecorder", e);
}
function rt() {
return u(v, "pauseAudio", void 0);
}
function nt() {
return u(v, "resumeAudio", void 0);
}
function tt() {
return u(v, "stopAudio", void 0);
}
const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
cancelRecord: Zn,
closeRecorder: Jn,
openRecorder: Xn,
pauseAudio: rt,
pauseRecord: qn,
playAudio: et,
resumeAudio: nt,
resumeRecord: Qn,
startRecord: Gn,
stopAudio: tt,
stopRecord: pn
}, Symbol.toStringTag, { value: "Module" }));
function ut(e) {
return o(ye, "checkApi", e, e == null ? void 0 : e.onSuccess, e == null ? void 0 : e.onError);
}
const it = me, lt = De, dt = Ae, at = Ke, st = pe, vt = or, ft = sr, gt = wr, St = Ir, _t = Cr, yt = Ur, bt = zr, wt = Vr, ht = pr, Et = sn, mt = Sn, It = Hn, Bt = zn, Rt = Kn, kt = ot, Dt = se, Ot = ve, At = ut, Tt = o, Ct = u, Ht = fe;
export {
Rt as app,
at as appbar,
kt as audio,
it as auth,
It as bluetooth,
st as cachet,
At as checkApi,
St as contacts,
lt as device,
_t as dialog,
Ht as error,
Et as event,
Tt as exec,
Ct as execSync,
gt as file,
ft as image,
Dt as init,
Ot as isDeviceReady,
wt as location,
bt as network,
dt as server,
mt as storage,
vt as user,
ht as util,
yt as video,
Bt as webview
};