@trimjs/web-app 0.1.3 → 0.1.4

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.
package/dist/index.js CHANGED
@@ -1,9 +1,35 @@
1
- var we = Object.defineProperty;
2
- var ve = (r, e, t) => e in r ? we(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var A = (r, e, t) => ve(r, typeof e != "symbol" ? e + "" : e, t);
4
- class Ee {
1
+ var $e = Object.defineProperty, Pe = Object.defineProperties;
2
+ var Me = Object.getOwnPropertyDescriptors;
3
+ var ee = Object.getOwnPropertySymbols;
4
+ var Ce = Object.prototype.hasOwnProperty, Fe = Object.prototype.propertyIsEnumerable;
5
+ var B = (r, e, t) => e in r ? $e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, D = (r, e) => {
6
+ for (var t in e || (e = {}))
7
+ Ce.call(e, t) && B(r, t, e[t]);
8
+ if (ee)
9
+ for (var t of ee(e))
10
+ Fe.call(e, t) && B(r, t, e[t]);
11
+ return r;
12
+ }, j = (r, e) => Pe(r, Me(e));
13
+ var $ = (r, e, t) => B(r, typeof e != "symbol" ? e + "" : e, t);
14
+ var w = (r, e, t) => new Promise((n, o) => {
15
+ var i = (a) => {
16
+ try {
17
+ c(t.next(a));
18
+ } catch (h) {
19
+ o(h);
20
+ }
21
+ }, s = (a) => {
22
+ try {
23
+ c(t.throw(a));
24
+ } catch (h) {
25
+ o(h);
26
+ }
27
+ }, c = (a) => a.done ? n(a.value) : Promise.resolve(a.value).then(i, s);
28
+ c((t = t.apply(r, e)).next());
29
+ });
30
+ class Te {
5
31
  constructor() {
6
- A(this, "debug", !1);
32
+ $(this, "debug", !1);
7
33
  }
8
34
  /**
9
35
  * 设置 debug 模式
@@ -22,52 +48,68 @@ class Ee {
22
48
  * 输出日志(只在 debug 模式下)
23
49
  * @param args 日志参数
24
50
  */
25
- log(...e) {
26
- this.debug && console.log("[Trim App]", ...e);
51
+ log() {
52
+ if (this.debug) {
53
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
54
+ t[n] = arguments[n];
55
+ console.log("[Trim App]", ...t);
56
+ }
27
57
  }
28
58
  /**
29
59
  * 输出警告日志(只在 debug 模式下)
30
60
  * @param args 日志参数
31
61
  */
32
- warn(...e) {
33
- this.debug && console.warn("[Trim App]", ...e);
62
+ warn() {
63
+ if (this.debug) {
64
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
65
+ t[n] = arguments[n];
66
+ console.warn("[Trim App]", ...t);
67
+ }
34
68
  }
35
69
  /**
36
70
  * 输出错误日志(只在 debug 模式下)
37
71
  * @param args 日志参数
38
72
  */
39
- error(...e) {
40
- this.debug && console.error("[Trim App]", ...e);
73
+ error() {
74
+ if (this.debug) {
75
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
76
+ t[n] = arguments[n];
77
+ console.error("[Trim App]", ...t);
78
+ }
41
79
  }
42
80
  /**
43
81
  * 输出信息日志(只在 debug 模式下)
44
82
  * @param args 日志参数
45
83
  */
46
- info(...e) {
47
- this.debug && console.info("[Trim App]", ...e);
84
+ info() {
85
+ if (this.debug) {
86
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
87
+ t[n] = arguments[n];
88
+ console.info("[Trim App]", ...t);
89
+ }
48
90
  }
49
91
  }
50
- const d = new Ee();
51
- function Se(r) {
92
+ const d = new Te();
93
+ function _e(r) {
52
94
  const e = /FNOS\/([\d.]+)|FNAppType\/(\w+)|FNAppVer\/([\d.]+)/g, t = {};
53
95
  let n;
54
96
  for (; (n = e.exec(r)) !== null; )
55
97
  n[1] && (t.fnOSVersion = n[1]), n[2] && (t.fnAppType = n[2]), n[3] && (t.fnAppVersion = n[3]);
56
98
  return t;
57
99
  }
58
- const ce = () => Se(navigator.userAgent).fnAppVersion;
59
- let ae = !1;
100
+ const pe = () => _e(navigator.userAgent).fnAppVersion;
101
+ let de = !1;
60
102
  window.addEventListener("flutterInAppWebViewPlatformReady", () => {
61
- ae = !0;
103
+ de = !0;
62
104
  });
63
- const Ae = () => new Promise((r) => {
105
+ const Oe = () => new Promise((r) => {
64
106
  var e;
65
- ae || (e = window.flutter_inappwebview) != null && e._platformReady ? (d.log("flutter_inappwebview is ready"), r(window.flutter_inappwebview)) : window.addEventListener("flutterInAppWebViewPlatformReady", () => {
107
+ de || (e = window.flutter_inappwebview) != null && e._platformReady ? (d.log("flutter_inappwebview is ready"), r(window.flutter_inappwebview)) : window.addEventListener("flutterInAppWebViewPlatformReady", () => {
66
108
  d.log("flutter_inappwebview is ready"), r(window.flutter_inappwebview);
67
109
  });
68
- }), $e = async (r, e, t) => {
110
+ }), Re = (r, e, t) => w(void 0, null, function* () {
69
111
  d.log(`callHandler: ${e}, params: ${t}`);
70
- const n = await r.callHandler(e, t);
112
+ const n = yield r.callHandler(e, t);
71
113
  if (n)
72
114
  try {
73
115
  const o = JSON.parse(n);
@@ -78,17 +120,17 @@ const Ae = () => new Promise((r) => {
78
120
  return d.error(`error: ${o}`), null;
79
121
  }
80
122
  return null;
81
- }, Q = /* @__PURE__ */ new Map();
82
- function Pe() {
123
+ }), te = /* @__PURE__ */ new Map();
124
+ function xe() {
83
125
  window.fnAppMessage = (r) => {
84
126
  d.log("app-message", r);
85
- const e = JSON.parse(r), t = Q.get(e.reqId);
86
- t && (t(e), Q.delete(e.reqId));
127
+ const e = JSON.parse(r), t = te.get(e.reqId);
128
+ t && (t(e), te.delete(e.reqId));
87
129
  };
88
130
  }
89
- ce() && Pe();
90
- var T = /* @__PURE__ */ ((r) => (r.Call = "call", r.Reply = "reply", r.Syn = "syn", r.SynAck = "synAck", r.Ack = "ack", r))(T || {}), k = /* @__PURE__ */ ((r) => (r.Fulfilled = "fulfilled", r.Rejected = "rejected", r))(k || {}), z = /* @__PURE__ */ ((r) => (r.ConnectionDestroyed = "ConnectionDestroyed", r.ConnectionTimeout = "ConnectionTimeout", r.NoIframeSrc = "NoIframeSrc", r))(z || {}), le = /* @__PURE__ */ ((r) => (r.DataCloneError = "DataCloneError", r))(le || {}), R = /* @__PURE__ */ ((r) => (r.Message = "message", r))(R || {});
91
- const Me = (r, e) => {
131
+ pe() && xe();
132
+ var O = /* @__PURE__ */ ((r) => (r.Call = "call", r.Reply = "reply", r.Syn = "syn", r.SynAck = "synAck", r.Ack = "ack", r))(O || {}), q = /* @__PURE__ */ ((r) => (r.Fulfilled = "fulfilled", r.Rejected = "rejected", r))(q || {}), X = /* @__PURE__ */ ((r) => (r.ConnectionDestroyed = "ConnectionDestroyed", r.ConnectionTimeout = "ConnectionTimeout", r.NoIframeSrc = "NoIframeSrc", r))(X || {}), he = /* @__PURE__ */ ((r) => (r.DataCloneError = "DataCloneError", r))(he || {}), I = /* @__PURE__ */ ((r) => (r.Message = "message", r))(I || {});
133
+ const De = (r, e) => {
92
134
  const t = [];
93
135
  let n = !1;
94
136
  return {
@@ -101,9 +143,9 @@ const Me = (r, e) => {
101
143
  n ? o() : t.push(o);
102
144
  }
103
145
  };
104
- }, _e = (r) => (...e) => {
146
+ }, Ie = (r) => (...e) => {
105
147
  r && console.log("[Penpal]", ...e);
106
- }, G = ({
148
+ }, re = ({
107
149
  name: r,
108
150
  message: e,
109
151
  stack: t
@@ -111,10 +153,10 @@ const Me = (r, e) => {
111
153
  name: r,
112
154
  message: e,
113
155
  stack: t
114
- }), Ce = (r) => {
156
+ }), Ve = (r) => {
115
157
  const e = new Error();
116
158
  return Object.keys(r).forEach((t) => e[t] = r[t]), e;
117
- }, Fe = (r, e, t) => {
159
+ }, je = (r, e, t) => {
118
160
  const {
119
161
  localName: n,
120
162
  local: o,
@@ -122,44 +164,44 @@ const Me = (r, e) => {
122
164
  originForSending: s,
123
165
  originForReceiving: c
124
166
  } = r;
125
- let f = !1;
126
- const w = (b) => {
127
- if (b.source !== i || b.data.penpal !== T.Call)
167
+ let a = !1;
168
+ const h = (v) => {
169
+ if (v.source !== i || v.data.penpal !== O.Call)
128
170
  return;
129
- if (c !== "*" && b.origin !== c) {
171
+ if (c !== "*" && v.origin !== c) {
130
172
  t(
131
- `${n} received message from origin ${b.origin} which did not match expected origin ${c}`
173
+ `${n} received message from origin ${v.origin} which did not match expected origin ${c}`
132
174
  );
133
175
  return;
134
176
  }
135
- const v = b.data, { methodName: g, args: p, id: m } = v;
177
+ const A = v.data, { methodName: g, args: p, id: m } = A;
136
178
  t(`${n}: Received ${g}() call`);
137
- const a = (y) => (S) => {
138
- if (t(`${n}: Sending ${g}() reply`), f) {
179
+ const l = (y) => (S) => {
180
+ if (t(`${n}: Sending ${g}() reply`), a) {
139
181
  t(
140
182
  `${n}: Unable to send ${g}() reply due to destroyed connection`
141
183
  );
142
184
  return;
143
185
  }
144
- const $ = {
145
- penpal: T.Reply,
186
+ const P = {
187
+ penpal: O.Reply,
146
188
  id: m,
147
189
  resolution: y,
148
190
  returnValue: S
149
191
  };
150
- y === k.Rejected && S instanceof Error && ($.returnValue = G(S), $.returnValueIsError = !0);
192
+ y === q.Rejected && S instanceof Error && (P.returnValue = re(S), P.returnValueIsError = !0);
151
193
  try {
152
- i.postMessage($, s);
194
+ i.postMessage(P, s);
153
195
  } catch (M) {
154
- if (M.name === le.DataCloneError) {
155
- const _ = {
156
- penpal: T.Reply,
196
+ if (M.name === he.DataCloneError) {
197
+ const C = {
198
+ penpal: O.Reply,
157
199
  id: m,
158
- resolution: k.Rejected,
159
- returnValue: G(M),
200
+ resolution: q.Rejected,
201
+ returnValue: re(M),
160
202
  returnValueIsError: !0
161
203
  };
162
- i.postMessage(_, s);
204
+ i.postMessage(C, s);
163
205
  }
164
206
  throw M;
165
207
  }
@@ -167,110 +209,110 @@ const Me = (r, e) => {
167
209
  new Promise(
168
210
  (y) => y(e[g].apply(e, p))
169
211
  ).then(
170
- a(k.Fulfilled),
171
- a(k.Rejected)
212
+ l(q.Fulfilled),
213
+ l(q.Rejected)
172
214
  );
173
215
  };
174
- return o.addEventListener(R.Message, w), () => {
175
- f = !0, o.removeEventListener(R.Message, w);
216
+ return o.addEventListener(I.Message, h), () => {
217
+ a = !0, o.removeEventListener(I.Message, h);
176
218
  };
177
219
  };
178
- let Te = 0;
179
- const Oe = () => ++Te, ue = ".", fe = (r) => r ? r.split(ue) : [], Re = (r) => r.join(ue), xe = (r, e) => {
180
- const t = fe(e || "");
181
- return t.push(r), Re(t);
182
- }, De = (r, e, t) => {
183
- const n = fe(e);
184
- return n.reduce((o, i, s) => (typeof o[i] > "u" && (o[i] = {}), s === n.length - 1 && (o[i] = t), o[i]), r), r;
185
- }, pe = (r, e) => {
220
+ let We = 0;
221
+ const qe = () => ++We, ge = ".", ye = (r) => r ? r.split(ge) : [], Ne = (r) => r.join(ge), Le = (r, e) => {
222
+ const t = ye(e || "");
223
+ return t.push(r), Ne(t);
224
+ }, He = (r, e, t) => {
225
+ const n = ye(e);
226
+ return n.reduce((o, i, s) => (typeof o[i] == "undefined" && (o[i] = {}), s === n.length - 1 && (o[i] = t), o[i]), r), r;
227
+ }, me = (r, e) => {
186
228
  const t = {};
187
229
  return Object.keys(r).forEach((n) => {
188
- const o = r[n], i = xe(n, e);
189
- typeof o == "object" && Object.assign(t, pe(o, i)), typeof o == "function" && (t[i] = o);
230
+ const o = r[n], i = Le(n, e);
231
+ typeof o == "object" && Object.assign(t, me(o, i)), typeof o == "function" && (t[i] = o);
190
232
  }), t;
191
- }, Ie = (r) => {
233
+ }, ke = (r) => {
192
234
  const e = {};
193
235
  for (const t in r)
194
- De(e, t, r[t]);
236
+ He(e, t, r[t]);
195
237
  return e;
196
- }, ke = (r, e, t, n, o) => {
238
+ }, Ue = (r, e, t, n, o) => {
197
239
  const {
198
240
  localName: i,
199
241
  local: s,
200
242
  remote: c,
201
- originForSending: f,
202
- originForReceiving: w
243
+ originForSending: a,
244
+ originForReceiving: h
203
245
  } = e;
204
- let b = !1;
246
+ let v = !1;
205
247
  o(`${i}: Connecting call sender`);
206
- const v = (p) => (...m) => {
248
+ const A = (p) => (...m) => {
207
249
  o(`${i}: Sending ${p}() call`);
208
- let a;
250
+ let l;
209
251
  try {
210
- c.closed && (a = !0);
211
- } catch {
212
- a = !0;
252
+ c.closed && (l = !0);
253
+ } catch (y) {
254
+ l = !0;
213
255
  }
214
- if (a && n(), b) {
256
+ if (l && n(), v) {
215
257
  const y = new Error(
216
258
  `Unable to send ${p}() call due to destroyed connection`
217
259
  );
218
- throw y.code = z.ConnectionDestroyed, y;
260
+ throw y.code = X.ConnectionDestroyed, y;
219
261
  }
220
262
  return new Promise((y, S) => {
221
- const $ = Oe(), M = (C) => {
222
- if (C.source !== c || C.data.penpal !== T.Reply || C.data.id !== $)
263
+ const P = qe(), M = (F) => {
264
+ if (F.source !== c || F.data.penpal !== O.Reply || F.data.id !== P)
223
265
  return;
224
- if (w !== "*" && C.origin !== w) {
266
+ if (h !== "*" && F.origin !== h) {
225
267
  o(
226
- `${i} received message from origin ${C.origin} which did not match expected origin ${w}`
268
+ `${i} received message from origin ${F.origin} which did not match expected origin ${h}`
227
269
  );
228
270
  return;
229
271
  }
230
- const V = C.data;
272
+ const N = F.data;
231
273
  o(`${i}: Received ${p}() reply`), s.removeEventListener(
232
- R.Message,
274
+ I.Message,
233
275
  M
234
276
  );
235
- let j = V.returnValue;
236
- V.returnValueIsError && (j = Ce(j)), (V.resolution === k.Fulfilled ? y : S)(
237
- j
277
+ let L = N.returnValue;
278
+ N.returnValueIsError && (L = Ve(L)), (N.resolution === q.Fulfilled ? y : S)(
279
+ L
238
280
  );
239
281
  };
240
- s.addEventListener(R.Message, M);
241
- const _ = {
242
- penpal: T.Call,
243
- id: $,
282
+ s.addEventListener(I.Message, M);
283
+ const C = {
284
+ penpal: O.Call,
285
+ id: P,
244
286
  methodName: p,
245
287
  args: m
246
288
  };
247
- c.postMessage(_, f);
289
+ c.postMessage(C, a);
248
290
  });
249
- }, g = t.reduce((p, m) => (p[m] = v(m), p), {});
250
- return Object.assign(r, Ie(g)), () => {
251
- b = !0;
291
+ }, g = t.reduce((p, m) => (p[m] = A(m), p), {});
292
+ return Object.assign(r, ke(g)), () => {
293
+ v = !0;
252
294
  };
253
- }, Ve = (r, e) => {
295
+ }, Be = (r, e) => {
254
296
  let t;
255
297
  return r !== void 0 && (t = window.setTimeout(() => {
256
298
  const n = new Error(
257
299
  `Connection timed out after ${r}ms`
258
300
  );
259
- n.code = z.ConnectionTimeout, e(n);
301
+ n.code = X.ConnectionTimeout, e(n);
260
302
  }, r)), () => {
261
303
  clearTimeout(t);
262
304
  };
263
- }, je = "@fn/micro-app-postmate", We = "0.1.2", qe = "module", Ne = "src/index.ts", Le = {
305
+ }, Je = "@fn/micro-app-postmate", Ye = "0.1.2", ze = "module", Ke = "src/index.ts", Qe = {
264
306
  dev: "vite",
265
307
  build: "tsc -b && vite build",
266
308
  lint: "eslint ."
267
- }, He = [
309
+ }, Ge = [
268
310
  "src",
269
311
  "dist"
270
- ], Ue = {
312
+ ], Xe = {
271
313
  "@fn/micro-app-event": "^0.0.1",
272
314
  rxjs: "^7.8.0"
273
- }, Be = {
315
+ }, Ze = {
274
316
  "@eslint/js": "^9.13.0",
275
317
  "@fn/micro-app-event": "workspace:*",
276
318
  eslint: "^9.13.0",
@@ -279,19 +321,19 @@ const Oe = () => ++Te, ue = ".", fe = (r) => r ? r.split(ue) : [], Re = (r) => r
279
321
  "typescript-eslint": "^8.11.0",
280
322
  rxjs: "^7.8.0",
281
323
  vite: "^5.4.10"
282
- }, Je = {
324
+ }, et = {
283
325
  registry: "http://verdaccio.teiron-inc.cn:4873"
284
- }, Ye = {
285
- name: je,
286
- version: We,
287
- type: qe,
288
- main: Ne,
289
- scripts: Le,
290
- files: He,
291
- peerDependencies: Ue,
292
- devDependencies: Be,
293
- publishConfig: Je
294
- }, ze = (r, e, t, n, o) => {
326
+ }, tt = {
327
+ name: Je,
328
+ version: Ye,
329
+ type: ze,
330
+ main: Ke,
331
+ scripts: Qe,
332
+ files: Ge,
333
+ peerDependencies: Xe,
334
+ devDependencies: Ze,
335
+ publishConfig: et
336
+ }, rt = (r, e, t, n, o) => {
295
337
  const { destroy: i, onDestroy: s } = n;
296
338
  return (c) => {
297
339
  if (!(r instanceof RegExp ? r.test(c.origin) : r === "*" || r === c.origin)) {
@@ -301,27 +343,27 @@ const Oe = () => ++Te, ue = ".", fe = (r) => r ? r.split(ue) : [], Re = (r) => r
301
343
  return;
302
344
  }
303
345
  o("Child: Handshake - Received SYN-ACK, responding with ACK");
304
- const w = c.origin === "null" ? "*" : c.origin, b = {
305
- penpal: T.Ack,
346
+ const h = c.origin === "null" ? "*" : c.origin, v = {
347
+ penpal: O.Ack,
306
348
  methodNames: Object.keys(e),
307
349
  config: t
308
350
  };
309
- window.parent.postMessage(b, w);
310
- const v = {
351
+ window.parent.postMessage(v, h);
352
+ const A = {
311
353
  localName: "Child",
312
354
  local: window,
313
355
  remote: window.parent,
314
- originForSending: w,
356
+ originForSending: h,
315
357
  originForReceiving: c.origin
316
- }, g = Fe(
317
- v,
358
+ }, g = je(
359
+ A,
318
360
  e,
319
361
  o
320
362
  );
321
363
  s(g);
322
- const p = {}, m = ke(
364
+ const p = {}, m = Ue(
323
365
  p,
324
- v,
366
+ A,
325
367
  c.data.methodNames,
326
368
  i,
327
369
  o
@@ -329,23 +371,23 @@ const Oe = () => ++Te, ue = ".", fe = (r) => r ? r.split(ue) : [], Re = (r) => r
329
371
  return s(m), p;
330
372
  };
331
373
  };
332
- function X(r, e) {
374
+ function ne(r, e) {
333
375
  console == null || console.warn(`[fnApp warn]: ${r}`, e);
334
376
  }
335
- function Z(r, e) {
377
+ function ie(r, e) {
336
378
  console == null || console.error(`[fnApp error]: ${r}`, e);
337
379
  }
338
- const I = "_fn_all_event", ee = "事件订阅数量为空", W = window.__POWERED_BY_FNAPP__ ? window.__FNAPP.inject.appEventObjMap : /* @__PURE__ */ new Map();
339
- class te {
380
+ const W = "_fn_all_event", oe = "事件订阅数量为空", H = window.__POWERED_BY_FNAPP__ ? window.__FNAPP.inject.appEventObjMap : /* @__PURE__ */ new Map();
381
+ class se {
340
382
  constructor(e, t) {
341
- A(this, "id");
342
- A(this, "appName");
343
- A(this, "eventObj");
344
- A(this, "getEventCallBackLength", (e) => {
383
+ $(this, "id");
384
+ $(this, "appName");
385
+ $(this, "eventObj");
386
+ $(this, "getEventCallBackLength", (e) => {
345
387
  var t;
346
388
  return ((t = this.eventObj[e]) == null ? void 0 : t.length) || 0;
347
389
  });
348
- this.id = e, this.appName = t, this.$clear(), W.get(this.id) || W.set(this.id, {}), this.eventObj = W.get(this.id);
390
+ this.id = e, this.appName = t, this.$clear(), H.get(this.id) || H.set(this.id, {}), this.eventObj = H.get(this.id);
349
391
  }
350
392
  // 监听事件
351
393
  $on(e, t) {
@@ -354,7 +396,7 @@ class te {
354
396
  }
355
397
  /** 任何$emit都会导致监听函数触发,第一个参数为事件名,后续的参数为$emit的参数 */
356
398
  $onAll(e) {
357
- return this.$on(I, e);
399
+ return this.$on(W, e);
358
400
  }
359
401
  // 一次性监听事件
360
402
  $once(e, t) {
@@ -364,7 +406,7 @@ class te {
364
406
  $off(e, t) {
365
407
  const n = this.eventObj[e];
366
408
  if (!e || !n || !n.length)
367
- return X(`${e} ${ee}`), this;
409
+ return ne(`${e} ${oe}`), this;
368
410
  let o, i = n.length;
369
411
  for (; i--; )
370
412
  if (o = n[i], o === t) {
@@ -375,7 +417,7 @@ class te {
375
417
  }
376
418
  // 取消监听$onAll
377
419
  $offAll(e) {
378
- return this.$off(I, e);
420
+ return this.$off(W, e);
379
421
  }
380
422
  // 发送事件
381
423
  $emit(e, ...t) {
@@ -384,7 +426,7 @@ class te {
384
426
  // 发送事件
385
427
  $pureEmit(e, ...t) {
386
428
  let n = 0, o = 0;
387
- return W.forEach((i) => {
429
+ return H.forEach((i) => {
388
430
  if (i[e])
389
431
  for (let s = i[e].length - 1; s >= 0; s--) {
390
432
  n++;
@@ -392,46 +434,46 @@ class te {
392
434
  c.$__once && i[e].splice(s, 1);
393
435
  try {
394
436
  c(...t);
395
- } catch (f) {
396
- Z(f);
437
+ } catch (a) {
438
+ ie(a);
397
439
  }
398
440
  }
399
- if (i[I])
400
- for (let s = i[I].length - 1; s >= 0; s--) {
441
+ if (i[W])
442
+ for (let s = i[W].length - 1; s >= 0; s--) {
401
443
  n++;
402
- const c = i[I][s];
403
- c.$__once && i[I].splice(s, 1);
444
+ const c = i[W][s];
445
+ c.$__once && i[W].splice(s, 1);
404
446
  try {
405
447
  c(...t);
406
- } catch (f) {
407
- Z(f);
448
+ } catch (a) {
449
+ ie(a);
408
450
  }
409
451
  }
410
- }), (!e || n === 0 && o === 0) && X(`${e} ${ee}`), this;
452
+ }), (!e || n === 0 && o === 0) && ne(`${e} ${oe}`), this;
411
453
  }
412
454
  // 清空当前所有的监听事件
413
455
  $clear() {
414
- const e = W.get(this.id) || {};
456
+ const e = H.get(this.id) || {};
415
457
  return Object.keys(e).forEach((n) => delete e[n]), this;
416
458
  }
417
459
  }
418
- var U = function(r, e) {
419
- return U = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
460
+ var z = function(r, e) {
461
+ return z = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
420
462
  t.__proto__ = n;
421
463
  } || function(t, n) {
422
464
  for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
423
- }, U(r, e);
465
+ }, z(r, e);
424
466
  };
425
- function de(r, e) {
467
+ function be(r, e) {
426
468
  if (typeof e != "function" && e !== null)
427
469
  throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
428
- U(r, e);
470
+ z(r, e);
429
471
  function t() {
430
472
  this.constructor = r;
431
473
  }
432
474
  r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
433
475
  }
434
- function re(r) {
476
+ function ce(r) {
435
477
  var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], n = 0;
436
478
  if (t) return t.call(r);
437
479
  if (r && typeof r.length == "number") return {
@@ -441,7 +483,7 @@ function re(r) {
441
483
  };
442
484
  throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
443
485
  }
444
- function B(r, e) {
486
+ function K(r, e) {
445
487
  var t = typeof Symbol == "function" && r[Symbol.iterator];
446
488
  if (!t) return r;
447
489
  var n = t.call(r), o, i = [], s;
@@ -458,21 +500,21 @@ function B(r, e) {
458
500
  }
459
501
  return i;
460
502
  }
461
- function J(r, e, t) {
503
+ function Q(r, e, t) {
462
504
  if (t || arguments.length === 2) for (var n = 0, o = e.length, i; n < o; n++)
463
505
  (i || !(n in e)) && (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
464
506
  return r.concat(i || Array.prototype.slice.call(e));
465
507
  }
466
- function O(r) {
508
+ function R(r) {
467
509
  return typeof r == "function";
468
510
  }
469
- function Ke(r) {
511
+ function nt(r) {
470
512
  var e = function(n) {
471
513
  Error.call(n), n.stack = new Error().stack;
472
514
  }, t = r(e);
473
515
  return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
474
516
  }
475
- var L = Ke(function(r) {
517
+ var J = nt(function(r) {
476
518
  return function(t) {
477
519
  r(this), this.message = t ? t.length + ` errors occurred during unsubscription:
478
520
  ` + t.map(function(n, o) {
@@ -481,13 +523,13 @@ var L = Ke(function(r) {
481
523
  `) : "", this.name = "UnsubscriptionError", this.errors = t;
482
524
  };
483
525
  });
484
- function ne(r, e) {
526
+ function ae(r, e) {
485
527
  if (r) {
486
528
  var t = r.indexOf(e);
487
529
  0 <= t && r.splice(t, 1);
488
530
  }
489
531
  }
490
- var K = function() {
532
+ var Z = function() {
491
533
  function r(e) {
492
534
  this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
493
535
  }
@@ -499,42 +541,42 @@ var K = function() {
499
541
  if (s)
500
542
  if (this._parentage = null, Array.isArray(s))
501
543
  try {
502
- for (var c = re(s), f = c.next(); !f.done; f = c.next()) {
503
- var w = f.value;
504
- w.remove(this);
544
+ for (var c = ce(s), a = c.next(); !a.done; a = c.next()) {
545
+ var h = a.value;
546
+ h.remove(this);
505
547
  }
506
- } catch (a) {
507
- e = { error: a };
548
+ } catch (l) {
549
+ e = { error: l };
508
550
  } finally {
509
551
  try {
510
- f && !f.done && (t = c.return) && t.call(c);
552
+ a && !a.done && (t = c.return) && t.call(c);
511
553
  } finally {
512
554
  if (e) throw e.error;
513
555
  }
514
556
  }
515
557
  else
516
558
  s.remove(this);
517
- var b = this.initialTeardown;
518
- if (O(b))
559
+ var v = this.initialTeardown;
560
+ if (R(v))
519
561
  try {
520
- b();
521
- } catch (a) {
522
- i = a instanceof L ? a.errors : [a];
562
+ v();
563
+ } catch (l) {
564
+ i = l instanceof J ? l.errors : [l];
523
565
  }
524
- var v = this._finalizers;
525
- if (v) {
566
+ var A = this._finalizers;
567
+ if (A) {
526
568
  this._finalizers = null;
527
569
  try {
528
- for (var g = re(v), p = g.next(); !p.done; p = g.next()) {
570
+ for (var g = ce(A), p = g.next(); !p.done; p = g.next()) {
529
571
  var m = p.value;
530
572
  try {
531
- ie(m);
532
- } catch (a) {
533
- i = i ?? [], a instanceof L ? i = J(J([], B(i)), B(a.errors)) : i.push(a);
573
+ le(m);
574
+ } catch (l) {
575
+ i = i != null ? i : [], l instanceof J ? i = Q(Q([], K(i)), K(l.errors)) : i.push(l);
534
576
  }
535
577
  }
536
- } catch (a) {
537
- n = { error: a };
578
+ } catch (l) {
579
+ n = { error: l };
538
580
  } finally {
539
581
  try {
540
582
  p && !p.done && (o = g.return) && o.call(g);
@@ -544,13 +586,13 @@ var K = function() {
544
586
  }
545
587
  }
546
588
  if (i)
547
- throw new L(i);
589
+ throw new J(i);
548
590
  }
549
591
  }, r.prototype.add = function(e) {
550
592
  var t;
551
593
  if (e && e !== this)
552
594
  if (this.closed)
553
- ie(e);
595
+ le(e);
554
596
  else {
555
597
  if (e instanceof r) {
556
598
  if (e.closed || e._hasParent(this))
@@ -567,57 +609,57 @@ var K = function() {
567
609
  this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
568
610
  }, r.prototype._removeParent = function(e) {
569
611
  var t = this._parentage;
570
- t === e ? this._parentage = null : Array.isArray(t) && ne(t, e);
612
+ t === e ? this._parentage = null : Array.isArray(t) && ae(t, e);
571
613
  }, r.prototype.remove = function(e) {
572
614
  var t = this._finalizers;
573
- t && ne(t, e), e instanceof r && e._removeParent(this);
615
+ t && ae(t, e), e instanceof r && e._removeParent(this);
574
616
  }, r.EMPTY = function() {
575
617
  var e = new r();
576
618
  return e.closed = !0, e;
577
619
  }(), r;
578
620
  }();
579
- K.EMPTY;
580
- function he(r) {
581
- return r instanceof K || r && "closed" in r && O(r.remove) && O(r.add) && O(r.unsubscribe);
621
+ Z.EMPTY;
622
+ function we(r) {
623
+ return r instanceof Z || r && "closed" in r && R(r.remove) && R(r.add) && R(r.unsubscribe);
582
624
  }
583
- function ie(r) {
584
- O(r) ? r() : r.unsubscribe();
625
+ function le(r) {
626
+ R(r) ? r() : r.unsubscribe();
585
627
  }
586
- var ge = {
628
+ var ve = {
587
629
  onUnhandledError: null,
588
630
  onStoppedNotification: null,
589
631
  Promise: void 0,
590
632
  useDeprecatedSynchronousErrorHandling: !1,
591
633
  useDeprecatedNextContext: !1
592
- }, Qe = {
634
+ }, it = {
593
635
  setTimeout: function(r, e) {
594
636
  for (var t = [], n = 2; n < arguments.length; n++)
595
637
  t[n - 2] = arguments[n];
596
- return setTimeout.apply(void 0, J([r, e], B(t)));
638
+ return setTimeout.apply(void 0, Q([r, e], K(t)));
597
639
  },
598
640
  clearTimeout: function(r) {
599
641
  return clearTimeout(r);
600
642
  },
601
643
  delegate: void 0
602
644
  };
603
- function Ge(r) {
604
- Qe.setTimeout(function() {
645
+ function ot(r) {
646
+ it.setTimeout(function() {
605
647
  throw r;
606
648
  });
607
649
  }
608
- function oe() {
650
+ function ue() {
609
651
  }
610
- function Xe(r) {
652
+ function st(r) {
611
653
  r();
612
654
  }
613
- var ye = function(r) {
614
- de(e, r);
655
+ var Ee = function(r) {
656
+ be(e, r);
615
657
  function e(t) {
616
658
  var n = r.call(this) || this;
617
- return n.isStopped = !1, t ? (n.destination = t, he(t) && t.add(n)) : n.destination = rt, n;
659
+ return n.isStopped = !1, t ? (n.destination = t, we(t) && t.add(n)) : n.destination = ut, n;
618
660
  }
619
661
  return e.create = function(t, n, o) {
620
- return new Y(t, n, o);
662
+ return new G(t, n, o);
621
663
  }, e.prototype.next = function(t) {
622
664
  this.isStopped || this._next(t);
623
665
  }, e.prototype.error = function(t) {
@@ -641,11 +683,11 @@ var ye = function(r) {
641
683
  this.unsubscribe();
642
684
  }
643
685
  }, e;
644
- }(K), Ze = Function.prototype.bind;
645
- function H(r, e) {
646
- return Ze.call(r, e);
686
+ }(Z), ct = Function.prototype.bind;
687
+ function Y(r, e) {
688
+ return ct.call(r, e);
647
689
  }
648
- var et = function() {
690
+ var at = function() {
649
691
  function r(e) {
650
692
  this.partialObserver = e;
651
693
  }
@@ -655,7 +697,7 @@ var et = function() {
655
697
  try {
656
698
  t.next(e);
657
699
  } catch (n) {
658
- N(n);
700
+ U(n);
659
701
  }
660
702
  }, r.prototype.error = function(e) {
661
703
  var t = this.partialObserver;
@@ -663,68 +705,68 @@ var et = function() {
663
705
  try {
664
706
  t.error(e);
665
707
  } catch (n) {
666
- N(n);
708
+ U(n);
667
709
  }
668
710
  else
669
- N(e);
711
+ U(e);
670
712
  }, r.prototype.complete = function() {
671
713
  var e = this.partialObserver;
672
714
  if (e.complete)
673
715
  try {
674
716
  e.complete();
675
717
  } catch (t) {
676
- N(t);
718
+ U(t);
677
719
  }
678
720
  }, r;
679
- }(), Y = function(r) {
680
- de(e, r);
721
+ }(), G = function(r) {
722
+ be(e, r);
681
723
  function e(t, n, o) {
682
724
  var i = r.call(this) || this, s;
683
- if (O(t) || !t)
725
+ if (R(t) || !t)
684
726
  s = {
685
- next: t ?? void 0,
686
- error: n ?? void 0,
687
- complete: o ?? void 0
727
+ next: t != null ? t : void 0,
728
+ error: n != null ? n : void 0,
729
+ complete: o != null ? o : void 0
688
730
  };
689
731
  else {
690
732
  var c;
691
- i && ge.useDeprecatedNextContext ? (c = Object.create(t), c.unsubscribe = function() {
733
+ i && ve.useDeprecatedNextContext ? (c = Object.create(t), c.unsubscribe = function() {
692
734
  return i.unsubscribe();
693
735
  }, s = {
694
- next: t.next && H(t.next, c),
695
- error: t.error && H(t.error, c),
696
- complete: t.complete && H(t.complete, c)
736
+ next: t.next && Y(t.next, c),
737
+ error: t.error && Y(t.error, c),
738
+ complete: t.complete && Y(t.complete, c)
697
739
  }) : s = t;
698
740
  }
699
- return i.destination = new et(s), i;
741
+ return i.destination = new at(s), i;
700
742
  }
701
743
  return e;
702
- }(ye);
703
- function N(r) {
704
- Ge(r);
744
+ }(Ee);
745
+ function U(r) {
746
+ ot(r);
705
747
  }
706
- function tt(r) {
748
+ function lt(r) {
707
749
  throw r;
708
750
  }
709
- var rt = {
751
+ var ut = {
710
752
  closed: !0,
711
- next: oe,
712
- error: tt,
713
- complete: oe
714
- }, nt = function() {
753
+ next: ue,
754
+ error: lt,
755
+ complete: ue
756
+ }, ft = function() {
715
757
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
716
758
  }();
717
- function it(r) {
759
+ function pt(r) {
718
760
  return r;
719
761
  }
720
- function ot(r) {
721
- return r.length === 0 ? it : r.length === 1 ? r[0] : function(t) {
762
+ function dt(r) {
763
+ return r.length === 0 ? pt : r.length === 1 ? r[0] : function(t) {
722
764
  return r.reduce(function(n, o) {
723
765
  return o(n);
724
766
  }, t);
725
767
  };
726
768
  }
727
- var st = function() {
769
+ var ht = function() {
728
770
  function r(e) {
729
771
  e && (this._subscribe = e);
730
772
  }
@@ -732,10 +774,10 @@ var st = function() {
732
774
  var t = new r();
733
775
  return t.source = this, t.operator = e, t;
734
776
  }, r.prototype.subscribe = function(e, t, n) {
735
- var o = this, i = at(e) ? e : new Y(e, t, n);
736
- return Xe(function() {
737
- var s = o, c = s.operator, f = s.source;
738
- i.add(c ? c.call(i, f) : f ? o._subscribe(i) : o._trySubscribe(i));
777
+ var o = this, i = yt(e) ? e : new G(e, t, n);
778
+ return st(function() {
779
+ var s = o, c = s.operator, a = s.source;
780
+ i.add(c ? c.call(i, a) : a ? o._subscribe(i) : o._trySubscribe(i));
739
781
  }), i;
740
782
  }, r.prototype._trySubscribe = function(e) {
741
783
  try {
@@ -745,13 +787,13 @@ var st = function() {
745
787
  }
746
788
  }, r.prototype.forEach = function(e, t) {
747
789
  var n = this;
748
- return t = se(t), new t(function(o, i) {
749
- var s = new Y({
790
+ return t = fe(t), new t(function(o, i) {
791
+ var s = new G({
750
792
  next: function(c) {
751
793
  try {
752
794
  e(c);
753
- } catch (f) {
754
- i(f), s.unsubscribe();
795
+ } catch (a) {
796
+ i(a), s.unsubscribe();
755
797
  }
756
798
  },
757
799
  error: i,
@@ -762,15 +804,15 @@ var st = function() {
762
804
  }, r.prototype._subscribe = function(e) {
763
805
  var t;
764
806
  return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e);
765
- }, r.prototype[nt] = function() {
807
+ }, r.prototype[ft] = function() {
766
808
  return this;
767
809
  }, r.prototype.pipe = function() {
768
810
  for (var e = [], t = 0; t < arguments.length; t++)
769
811
  e[t] = arguments[t];
770
- return ot(e)(this);
812
+ return dt(e)(this);
771
813
  }, r.prototype.toPromise = function(e) {
772
814
  var t = this;
773
- return e = se(e), new e(function(n, o) {
815
+ return e = fe(e), new e(function(n, o) {
774
816
  var i;
775
817
  t.subscribe(function(s) {
776
818
  return i = s;
@@ -784,121 +826,116 @@ var st = function() {
784
826
  return new r(e);
785
827
  }, r;
786
828
  }();
787
- function se(r) {
829
+ function fe(r) {
788
830
  var e;
789
- return (e = r ?? ge.Promise) !== null && e !== void 0 ? e : Promise;
831
+ return (e = r != null ? r : ve.Promise) !== null && e !== void 0 ? e : Promise;
790
832
  }
791
- function ct(r) {
792
- return r && O(r.next) && O(r.error) && O(r.complete);
833
+ function gt(r) {
834
+ return r && R(r.next) && R(r.error) && R(r.complete);
793
835
  }
794
- function at(r) {
795
- return r && r instanceof ye || ct(r) && he(r);
836
+ function yt(r) {
837
+ return r && r instanceof Ee || gt(r) && we(r);
796
838
  }
797
- const lt = () => {
839
+ const mt = () => {
798
840
  try {
799
841
  clearTimeout(void 0);
800
- } catch {
842
+ } catch (r) {
801
843
  return !1;
802
844
  }
803
845
  return !0;
804
- }, ut = (r = {}) => {
805
- const { parentOrigin: e = "*", timeout: t, debug: n = !1, config: o = {} } = r, i = _e(n), s = Me("App", i), { destroy: c, onDestroy: f } = s, w = () => {
846
+ }, bt = (r = {}) => {
847
+ const { parentOrigin: e = "*", timeout: t, debug: n = !1, config: o = {} } = r, i = Ie(n), s = De("App", i), { destroy: c, onDestroy: a } = s, h = () => {
806
848
  i("Child: Handshake - Sending SYN");
807
- const v = { penpal: T.Syn }, g = e instanceof RegExp ? "*" : e;
808
- window.parent.postMessage(v, g);
849
+ const A = { penpal: O.Syn }, g = e instanceof RegExp ? "*" : e;
850
+ window.parent.postMessage(A, g);
809
851
  };
810
852
  return {
811
853
  promise: new Promise(
812
- (v, g) => {
813
- const p = Ve(t, c), m = (a) => {
814
- if (lt() && !(a.source !== parent || !a.data) && a.data.penpal === T.SynAck) {
815
- const y = a.data, S = new te(y.id, y.appName), $ = new te(y.id + "/api", y.appName), M = y.id, _ = {}, C = (l) => "api/" + l, V = {
816
- $emit: (l, ...u) => {
817
- S.getEventCallBackLength(l) > 0 ? S.$pureEmit(l, ...u) : _ == null || _.$off(l, () => {
854
+ (A, g) => {
855
+ const p = Be(t, c), m = (l) => {
856
+ if (mt() && !(l.source !== parent || !l.data) && l.data.penpal === O.SynAck) {
857
+ const y = l.data, S = new se(y.id, y.appName), P = new se(y.id + "/api", y.appName), M = y.id, C = {}, F = (u) => "api/" + u, N = {
858
+ $emit: (u, ...f) => {
859
+ S.getEventCallBackLength(u) > 0 ? S.$pureEmit(u, ...f) : C == null || C.$off(u, () => {
818
860
  }, !0);
819
861
  },
820
- onQueryResult: (l) => {
821
- $.$pureEmit(C(l.reqid), l);
862
+ onQueryResult: (u) => {
863
+ P.$pureEmit(F(u.reqid), u);
822
864
  },
823
- onOsNotify: (l) => {
865
+ onOsNotify: (u) => {
824
866
  }
825
- }, j = (l) => function(h) {
826
- const P = C(l);
827
- $.$on(P, function D(E) {
828
- h.next(E), E.reqid && E.result === "succ" && (h.complete(), $.$off(P, D));
867
+ }, L = (u) => function(b) {
868
+ const x = F(u);
869
+ P.$on(x, function _(E) {
870
+ b.next(E), E.reqid && E.result === "succ" && (b.complete(), P.$off(x, _));
829
871
  });
830
- }, me = pe(V), x = ze(
872
+ }, Ae = me(N), V = rt(
831
873
  e,
832
- me,
833
- {
834
- ...o,
835
- postmateVersion: Ye.version
836
- },
874
+ Ae,
875
+ j(D({}, o), {
876
+ postmateVersion: tt.version
877
+ }),
837
878
  s,
838
879
  i
839
880
  )(
840
- a
841
- ), F = {}, q = x.bus;
842
- if (q) {
843
- const l = (u, h, P) => {
844
- P ? (h.$__once = !0, S.$once(u, h)) : S.$on(u, h), F[u] ? F[u].push(h) : (F[u] = [h], q.$on(u, M));
881
+ l
882
+ ), T = {}, k = V.bus;
883
+ if (k) {
884
+ const u = (f, b, x) => {
885
+ x ? (b.$__once = !0, S.$once(f, b)) : S.$on(f, b), T[f] ? T[f].push(b) : (T[f] = [b], k.$on(f, M));
845
886
  };
846
- Object.assign(_, q, {
847
- $on: l,
848
- $off: (u, h, P) => {
849
- var D;
850
- if (F[u]) {
851
- const E = F[u].indexOf(h);
852
- E > -1 && (F[u].splice(E, 1), S.$off(u, h));
887
+ Object.assign(C, k, {
888
+ $on: u,
889
+ $off: (f, b, x) => {
890
+ var _;
891
+ if (T[f]) {
892
+ const E = T[f].indexOf(b);
893
+ E > -1 && (T[f].splice(E, 1), S.$off(f, b));
853
894
  }
854
- P && delete F[u], (D = F[u]) != null && D.length || (q.$off(u, M), delete F[u]);
895
+ x && delete T[f], (_ = T[f]) != null && _.length || (k.$off(f, M), delete T[f]);
855
896
  },
856
- $once: (u, h) => {
857
- l(u, h, !0);
897
+ $once: (f, b) => {
898
+ u(f, b, !0);
858
899
  }
859
900
  });
860
901
  }
861
- const be = {
862
- ...x,
863
- bus: _,
864
- query: async (l, u) => {
865
- const h = (l == null ? void 0 : l.reqid) || await x.genReqId();
866
- return new Promise((P, D) => {
867
- x.query(
868
- {
869
- ...l,
870
- reqid: h
871
- },
872
- u
902
+ const Se = j(D({}, V), {
903
+ bus: C,
904
+ query: (u, f) => w(void 0, null, function* () {
905
+ const b = (u == null ? void 0 : u.reqid) || (yield V.genReqId());
906
+ return new Promise((x, _) => {
907
+ V.query(
908
+ j(D({}, u), {
909
+ reqid: b
910
+ }),
911
+ f
873
912
  ).then((E) => {
874
- (E == null ? void 0 : E.result) === "succ" ? P(E) : D(E);
913
+ (E == null ? void 0 : E.result) === "succ" ? x(E) : _(E);
875
914
  });
876
915
  });
877
- },
878
- createObservableQuery: async (l, u = {}) => {
879
- const h = (l == null ? void 0 : l.reqid) || await x.genReqId(), P = new st(
880
- j(h)
916
+ }),
917
+ createObservableQuery: (b, ...x) => w(void 0, [b, ...x], function* (u, f = {}) {
918
+ const _ = (u == null ? void 0 : u.reqid) || (yield V.genReqId()), E = new ht(
919
+ L(_)
881
920
  );
882
- return x.query(
883
- {
884
- ...l,
885
- reqid: h
886
- },
887
- {
888
- ...u,
921
+ return V.query(
922
+ j(D({}, u), {
923
+ reqid: _
924
+ }),
925
+ j(D({}, f), {
889
926
  observable: !0
890
- }
891
- ), P;
892
- }
893
- };
894
- x && (window.removeEventListener(R.Message, m), p(), v({
895
- methods: be,
896
- config: a.data.config
927
+ })
928
+ ), E;
929
+ })
930
+ });
931
+ V && (window.removeEventListener(I.Message, m), p(), A({
932
+ methods: Se,
933
+ config: l.data.config
897
934
  }));
898
935
  }
899
936
  };
900
- window.addEventListener(R.Message, m), w(), f((a) => {
901
- window.removeEventListener(R.Message, m), a && g(a);
937
+ window.addEventListener(I.Message, m), h(), a((l) => {
938
+ window.removeEventListener(I.Message, m), l && g(l);
902
939
  });
903
940
  }
904
941
  ),
@@ -906,36 +943,43 @@ const lt = () => {
906
943
  c();
907
944
  }
908
945
  };
909
- }, ft = (r) => ut({
946
+ }, wt = (r) => bt({
910
947
  debug: r == null ? void 0 : r.debug
911
948
  }).promise;
912
- class ht {
913
- constructor(e = {}) {
914
- A(this, "options");
915
- A(this, "flutterInAppWebView", null);
916
- A(this, "osConnector", null);
917
- A(this, "initPromise");
918
- A(this, "isWeb", !0);
949
+ class At {
950
+ constructor() {
951
+ $(this, "options");
952
+ $(this, "flutterInAppWebView", null);
953
+ $(this, "osConnector", null);
954
+ $(this, "initPromise");
955
+ $(this, "isWeb", !0);
956
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
919
957
  this.options = e, e.debug && (d.setDebug(!0), d.log("Trim App initialized with debug mode")), d.log("Options:", e), this.initPromise = this.init();
920
958
  }
921
- async init() {
922
- return d.log("Starting initialization..."), new Promise((e) => {
923
- ce() ? (this.isWeb = !1, d.log("Initializing mobile platform..."), Ae().then((t) => {
924
- this.flutterInAppWebView = t, d.log("Mobile platform initialized"), e();
925
- })) : (this.isWeb = !0, d.log("Initializing web platform..."), ft().then((t) => {
926
- this.osConnector = t, d.log("Web platform initialized"), e();
927
- }));
959
+ init() {
960
+ return w(this, null, function* () {
961
+ return d.log("Starting initialization..."), new Promise((e) => {
962
+ pe() ? (this.isWeb = !1, d.log("Initializing mobile platform..."), Oe().then((t) => {
963
+ this.flutterInAppWebView = t, d.log("Mobile platform initialized"), e();
964
+ })) : (this.isWeb = !0, d.log("Initializing web platform..."), wt().then((t) => {
965
+ this.osConnector = t, d.log("Web platform initialized"), e();
966
+ }));
967
+ });
928
968
  });
929
969
  }
930
- async callAppMethod(e, t) {
931
- return this.flutterInAppWebView ? $e(this.flutterInAppWebView, e, t) : null;
970
+ callAppMethod(e, t) {
971
+ return w(this, null, function* () {
972
+ return this.flutterInAppWebView ? Re(this.flutterInAppWebView, e, t) : null;
973
+ });
932
974
  }
933
975
  /**
934
976
  * 等待初始化完成
935
977
  * @returns Promise
936
978
  */
937
- async ready() {
938
- return this.initPromise;
979
+ ready() {
980
+ return w(this, null, function* () {
981
+ return this.initPromise;
982
+ });
939
983
  }
940
984
  /**
941
985
  * 获取配置
@@ -947,97 +991,110 @@ class ht {
947
991
  * 更新配置
948
992
  */
949
993
  setOptions(e) {
950
- this.options = { ...this.options, ...e }, e.debug !== void 0 && d.setDebug(e.debug), d.log("Options updated:", this.options);
994
+ this.options = D(D({}, this.options), e), e.debug !== void 0 && d.setDebug(e.debug), d.log("Options updated:", this.options);
951
995
  }
952
996
  // 调用 app 的方法
953
997
  /**
954
998
  * 获取平台配置
955
999
  */
956
- async getPlatformConfig() {
957
- var e;
958
- if (await this.initPromise, this.isWeb) {
959
- const t = await ((e = this.osConnector) == null ? void 0 : e.methods.getPlatformConfig());
960
- if (!t)
961
- throw new Error("Failed to get platform config");
962
- return t;
963
- } else {
964
- const t = await this.callAppMethod("getAppMessage");
965
- if (!t)
966
- throw new Error("Failed to get platform config");
967
- return {
968
- theme: t.nightMode,
969
- language: t.language,
970
- appVersion: t.appVersion,
971
- systemVersion: t.systemVersion,
972
- format: {
973
- date: t.dateFormat,
974
- time: t.timeFormat
975
- }
976
- };
977
- }
1000
+ getPlatformConfig() {
1001
+ return w(this, null, function* () {
1002
+ var e;
1003
+ if (yield this.initPromise, this.isWeb) {
1004
+ const t = yield (e = this.osConnector) == null ? void 0 : e.methods.getPlatformConfig();
1005
+ if (!t)
1006
+ throw new Error("Failed to get platform config");
1007
+ return t;
1008
+ } else {
1009
+ const t = yield this.callAppMethod("getAppMessage");
1010
+ if (!t)
1011
+ throw new Error("Failed to get platform config");
1012
+ return {
1013
+ theme: t.nightMode,
1014
+ language: t.language,
1015
+ appVersion: t.appVersion,
1016
+ systemVersion: t.systemVersion,
1017
+ format: {
1018
+ date: t.dateFormat,
1019
+ time: t.timeFormat
1020
+ }
1021
+ };
1022
+ }
1023
+ });
978
1024
  }
979
1025
  /**
980
1026
  * setTitle - 设置标题
981
1027
  * @param title 标题文本
982
1028
  */
983
- async setTitle(e) {
984
- var t;
985
- return await this.initPromise, d.log("Setting title:", e), this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.setTitle(e) : this.callAppMethod("updateTitle", e);
1029
+ setTitle(e) {
1030
+ return w(this, null, function* () {
1031
+ var t;
1032
+ return yield this.initPromise, d.log("Setting title:", e), this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.setTitle(e) : this.callAppMethod("updateTitle", e);
1033
+ });
986
1034
  }
987
1035
  /**
988
1036
  * setExitPageTips - 设置退出页面提示
989
1037
  * @param params 提示参数
990
1038
  */
991
- async setExitPageTips(e) {
992
- var t;
993
- return await this.initPromise, this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.setExitPageTips(e) : this.callAppMethod(
994
- "setExitPageTips",
995
- e ? JSON.stringify(e) : ""
996
- );
1039
+ setExitPageTips(e) {
1040
+ return w(this, null, function* () {
1041
+ var t;
1042
+ return yield this.initPromise, this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.setExitPageTips(e) : this.callAppMethod("setExitPageTips", e ? JSON.stringify(e) : "");
1043
+ });
997
1044
  }
998
1045
  /**
999
1046
  * 通过应用打开某个文件
1000
1047
  */
1001
- async openFile(e) {
1002
- var t;
1003
- return await this.initPromise, d.log("Opening file:", e), this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.openFile(e) : this.callAppMethod("openFile", e);
1048
+ openFile(e) {
1049
+ return w(this, null, function* () {
1050
+ var t;
1051
+ return yield this.initPromise, d.log("Opening file:", e), this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.openFile(e) : this.callAppMethod("openFile", e);
1052
+ });
1004
1053
  }
1005
1054
  /**
1006
1055
  * 打开文件管理器
1007
1056
  */
1008
- async openFileManager(e) {
1009
- var t;
1010
- return await this.initPromise, d.log("Opening file manager:", e), this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.openFileManagerApp(e) : this.callAppMethod("openFileManager", e);
1057
+ openFileManager(e) {
1058
+ return w(this, null, function* () {
1059
+ var t;
1060
+ return yield this.initPromise, d.log("Opening file manager:", e), this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.openFileManagerApp(e) : this.callAppMethod("openFileManager", e);
1061
+ });
1011
1062
  }
1012
1063
  /**
1013
1064
  * 关闭应用
1014
1065
  */
1015
- async close() {
1016
- var e;
1017
- return await this.initPromise, this.isWeb ? (e = this.osConnector) == null ? void 0 : e.methods.close() : this.callAppMethod("exitPage");
1066
+ close() {
1067
+ return w(this, null, function* () {
1068
+ var e;
1069
+ return yield this.initPromise, this.isWeb ? (e = this.osConnector) == null ? void 0 : e.methods.close() : this.callAppMethod("exitPage");
1070
+ });
1018
1071
  }
1019
1072
  /**
1020
1073
  * 请求接口
1021
1074
  */
1022
- async query(e, t) {
1023
- var n;
1024
- if (await this.initPromise, this.isWeb) {
1025
- const o = await ((n = this.osConnector) == null ? void 0 : n.methods.query(e, t));
1026
- if (!o)
1027
- throw new Error("Failed to query");
1028
- return o;
1029
- } else
1030
- throw new Error("query is not supported on mobile platform");
1075
+ query(e, t) {
1076
+ return w(this, null, function* () {
1077
+ var n;
1078
+ if (yield this.initPromise, this.isWeb) {
1079
+ const o = yield (n = this.osConnector) == null ? void 0 : n.methods.query(e, t);
1080
+ if (!o)
1081
+ throw new Error("Failed to query");
1082
+ return o;
1083
+ } else
1084
+ throw new Error("query is not supported on mobile platform");
1085
+ });
1031
1086
  }
1032
1087
  /**
1033
1088
  * 选择文件
1034
1089
  */
1035
- async pickFile(e) {
1036
- var t;
1037
- return await this.initPromise, this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.pickFile(e) : this.callAppMethod("openFolder", JSON.stringify(e));
1090
+ pickFile(e) {
1091
+ return w(this, null, function* () {
1092
+ var t;
1093
+ return yield this.initPromise, this.isWeb ? (t = this.osConnector) == null ? void 0 : t.methods.pickFile(e) : this.callAppMethod("openFolder", JSON.stringify(e));
1094
+ });
1038
1095
  }
1039
1096
  }
1040
1097
  export {
1041
- ht as TrimApp,
1042
- ht as default
1098
+ At as TrimApp,
1099
+ At as default
1043
1100
  };