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