react-input-emoji 5.4.1 → 5.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/index.es.js +659 -1165
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +659 -1165
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -5,15 +5,12 @@ import t from 'prop-types';
|
|
5
5
|
function styleInject(css, ref) {
|
6
6
|
if (ref === void 0) ref = {};
|
7
7
|
var insertAt = ref.insertAt;
|
8
|
-
|
9
8
|
if (!css || typeof document === 'undefined') {
|
10
9
|
return;
|
11
10
|
}
|
12
|
-
|
13
11
|
var head = document.head || document.getElementsByTagName('head')[0];
|
14
12
|
var style = document.createElement('style');
|
15
13
|
style.type = 'text/css';
|
16
|
-
|
17
14
|
if (insertAt === 'top') {
|
18
15
|
if (head.firstChild) {
|
19
16
|
head.insertBefore(style, head.firstChild);
|
@@ -23,7 +20,6 @@ function styleInject(css, ref) {
|
|
23
20
|
} else {
|
24
21
|
head.appendChild(style);
|
25
22
|
}
|
26
|
-
|
27
23
|
if (style.styleSheet) {
|
28
24
|
style.styleSheet.cssText = css;
|
29
25
|
} else {
|
@@ -34,377 +30,355 @@ function styleInject(css, ref) {
|
|
34
30
|
var css_248z = ".react-input-emoji--container {\n color: #4b4b4b;\n text-rendering: optimizeLegibility;\n background-color: #fff;\n border: 1px solid #fff;\n border-radius: 21px;\n margin: 5px 10px;\n box-sizing: border-box;\n flex: 1 1 auto;\n font-size: 15px;\n font-family: sans-serif;\n font-weight: 400;\n line-height: 20px;\n min-height: 20px;\n min-width: 0;\n outline: none;\n width: inherit;\n will-change: width;\n vertical-align: baseline;\n border: 1px solid #eaeaea;\n margin-right: 0;\n}\n\n.react-input-emoji--wrapper {\n display: flex;\n overflow: hidden;\n flex: 1;\n position: relative;\n padding-right: 0;\n vertical-align: baseline;\n outline: none;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n.react-input-emoji--input {\n font-weight: 400;\n max-height: 100px;\n min-height: 20px;\n outline: none;\n overflow-x: hidden;\n overflow-y: auto;\n position: relative;\n white-space: pre-wrap;\n word-wrap: break-word;\n z-index: 1;\n width: 100%;\n user-select: text;\n padding: 9px 12px 11px;\n text-align: left;\n}\n\n.react-input-emoji--input img {\n vertical-align: middle;\n width: 18px !important;\n height: 18px !important;\n display: inline !important;\n margin-left: 1px;\n margin-right: 1px;\n}\n\n.react-input-emoji--overlay {\n position: fixed;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 9;\n}\n\n.react-input-emoji--placeholder {\n color: #a0a0a0;\n pointer-events: none;\n position: absolute;\n user-select: none;\n z-index: 2;\n left: 16px;\n top: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n width: calc(100% - 22px);\n}\n\n.react-input-emoji--button {\n position: relative;\n display: block;\n text-align: center;\n padding: 0 10px;\n overflow: hidden;\n transition: color 0.1s ease-out;\n margin: 0;\n box-shadow: none;\n background: none;\n border: none;\n outline: none;\n cursor: pointer;\n flex-shrink: 0;\n}\n\n.react-input-emoji--button svg {\n fill: #858585;\n}\n\n.react-input-emoji--button__show svg {\n fill: #128b7e;\n}\n\n.react-emoji {\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n}\n\n.react-emoji-picker--container {\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.react-emoji-picker--wrapper {\n position: absolute;\n bottom: 0;\n right: 0;\n height: 435px;\n width: 352px;\n overflow: hidden;\n z-index: 10;\n}\n\n.react-emoji-picker {\n position: absolute;\n top: 0;\n left: 0;\n animation: slidein 0.1s ease-in-out;\n}\n\n.react-emoji-picker__show {\n top: 0;\n}\n\n.react-input-emoji--mention--container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 10;\n}\n\n.react-input-emoji--mention--list {\n background-color: #fafafa;\n border: 1px solid #eaeaea;\n border-radius: 4px;\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n gap: 5px;\n flex-direction: column;\n position: absolute;\n bottom: 0;\n width: 100%;\n left: 0;\n}\n\n.react-input-emoji--mention--item {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 5px 10px;\n background-color: transparent;\n width: 100%;\n margin: 0;\n border: 0;\n}\n\n.react-input-emoji--mention--item__selected {\n background-color: #eeeeee;\n}\n\n.react-input-emoji--mention--item--img {\n width: 34px;\n height: 34px;\n border-radius: 50%;\n}\n\n.react-input-emoji--mention--item--name {\n font-size: 16px;\n color: #333;\n}\n\n.react-input-emoji--mention--item--name__selected {\n color: green;\n}\n\n.react-input-emoji--mention--text {\n color: #039be5;\n}\n\n.react-input-emoji--mention--loading {\n background-color: #fafafa;\n border: 1px solid #eaeaea;\n border-radius: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 10px 0;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n}\n\n.react-input-emoji--mention--loading--spinner,\n.react-input-emoji--mention--loading--spinner::after {\n border-radius: 50%;\n width: 10em;\n height: 10em;\n}\n\n.react-input-emoji--mention--loading--spinner {\n margin: 1px auto;\n font-size: 2px;\n position: relative;\n text-indent: -9999em;\n border-top: 1.1em solid rgba(0, 0, 0, 0.1);\n border-right: 1.1em solid rgba(0, 0, 0, 0.1);\n border-bottom: 1.1em solid rgba(0, 0, 0, 0.1);\n border-left: 1.1em solid rgba(0, 0, 0, 0.4);\n transform: translateZ(0);\n animation: load8 1.1s infinite linear;\n}\n\n@keyframes load8 {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n@keyframes slidein {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n";
|
35
31
|
styleInject(css_248z);
|
36
32
|
|
37
|
-
function
|
38
|
-
var
|
39
|
-
|
33
|
+
function _iterableToArrayLimit(r, l) {
|
34
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
35
|
+
if (null != t) {
|
36
|
+
var e,
|
37
|
+
n,
|
38
|
+
i,
|
39
|
+
u,
|
40
|
+
a = [],
|
41
|
+
f = !0,
|
42
|
+
o = !1;
|
43
|
+
try {
|
44
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
45
|
+
if (Object(t) !== t) return;
|
46
|
+
f = !1;
|
47
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
48
|
+
} catch (r) {
|
49
|
+
o = !0, n = r;
|
50
|
+
} finally {
|
51
|
+
try {
|
52
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
53
|
+
} finally {
|
54
|
+
if (o) throw n;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return a;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
function ownKeys(e, r) {
|
61
|
+
var t = Object.keys(e);
|
40
62
|
if (Object.getOwnPropertySymbols) {
|
41
|
-
var
|
42
|
-
|
43
|
-
return Object.getOwnPropertyDescriptor(
|
44
|
-
})),
|
63
|
+
var o = Object.getOwnPropertySymbols(e);
|
64
|
+
r && (o = o.filter(function (r) {
|
65
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
66
|
+
})), t.push.apply(t, o);
|
45
67
|
}
|
46
|
-
|
47
|
-
return keys;
|
68
|
+
return t;
|
48
69
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
70
|
+
function _objectSpread2(e) {
|
71
|
+
for (var r = 1; r < arguments.length; r++) {
|
72
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
73
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
74
|
+
_defineProperty(e, r, t[r]);
|
75
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
76
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
57
77
|
});
|
58
78
|
}
|
59
|
-
|
60
|
-
return target;
|
79
|
+
return e;
|
61
80
|
}
|
62
|
-
|
63
81
|
function _regeneratorRuntime() {
|
64
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
65
|
-
|
66
82
|
_regeneratorRuntime = function () {
|
67
|
-
return
|
83
|
+
return e;
|
68
84
|
};
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
85
|
+
var t,
|
86
|
+
e = {},
|
87
|
+
r = Object.prototype,
|
88
|
+
n = r.hasOwnProperty,
|
89
|
+
o = Object.defineProperty || function (t, e, r) {
|
90
|
+
t[e] = r.value;
|
91
|
+
},
|
92
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
93
|
+
a = i.iterator || "@@iterator",
|
94
|
+
c = i.asyncIterator || "@@asyncIterator",
|
95
|
+
u = i.toStringTag || "@@toStringTag";
|
96
|
+
function define(t, e, r) {
|
97
|
+
return Object.defineProperty(t, e, {
|
98
|
+
value: r,
|
81
99
|
enumerable: !0,
|
82
100
|
configurable: !0,
|
83
101
|
writable: !0
|
84
|
-
}),
|
102
|
+
}), t[e];
|
85
103
|
}
|
86
|
-
|
87
104
|
try {
|
88
105
|
define({}, "");
|
89
|
-
} catch (
|
90
|
-
define = function (
|
91
|
-
return
|
106
|
+
} catch (t) {
|
107
|
+
define = function (t, e, r) {
|
108
|
+
return t[e] = r;
|
92
109
|
};
|
93
110
|
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
return function (method, arg) {
|
102
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
103
|
-
|
104
|
-
if ("completed" === state) {
|
105
|
-
if ("throw" === method) throw arg;
|
106
|
-
return doneResult();
|
107
|
-
}
|
108
|
-
|
109
|
-
for (context.method = method, context.arg = arg;;) {
|
110
|
-
var delegate = context.delegate;
|
111
|
-
|
112
|
-
if (delegate) {
|
113
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
114
|
-
|
115
|
-
if (delegateResult) {
|
116
|
-
if (delegateResult === ContinueSentinel) continue;
|
117
|
-
return delegateResult;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
122
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
123
|
-
context.dispatchException(context.arg);
|
124
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
125
|
-
state = "executing";
|
126
|
-
var record = tryCatch(innerFn, self, context);
|
127
|
-
|
128
|
-
if ("normal" === record.type) {
|
129
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
130
|
-
return {
|
131
|
-
value: record.arg,
|
132
|
-
done: context.done
|
133
|
-
};
|
134
|
-
}
|
135
|
-
|
136
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
137
|
-
}
|
138
|
-
};
|
139
|
-
}(innerFn, self, context), generator;
|
111
|
+
function wrap(t, e, r, n) {
|
112
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
113
|
+
a = Object.create(i.prototype),
|
114
|
+
c = new Context(n || []);
|
115
|
+
return o(a, "_invoke", {
|
116
|
+
value: makeInvokeMethod(t, r, c)
|
117
|
+
}), a;
|
140
118
|
}
|
141
|
-
|
142
|
-
function tryCatch(fn, obj, arg) {
|
119
|
+
function tryCatch(t, e, r) {
|
143
120
|
try {
|
144
121
|
return {
|
145
122
|
type: "normal",
|
146
|
-
arg:
|
123
|
+
arg: t.call(e, r)
|
147
124
|
};
|
148
|
-
} catch (
|
125
|
+
} catch (t) {
|
149
126
|
return {
|
150
127
|
type: "throw",
|
151
|
-
arg:
|
128
|
+
arg: t
|
152
129
|
};
|
153
130
|
}
|
154
131
|
}
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
132
|
+
e.wrap = wrap;
|
133
|
+
var h = "suspendedStart",
|
134
|
+
l = "suspendedYield",
|
135
|
+
f = "executing",
|
136
|
+
s = "completed",
|
137
|
+
y = {};
|
159
138
|
function Generator() {}
|
160
|
-
|
161
139
|
function GeneratorFunction() {}
|
162
|
-
|
163
140
|
function GeneratorFunctionPrototype() {}
|
164
|
-
|
165
|
-
|
166
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
141
|
+
var p = {};
|
142
|
+
define(p, a, function () {
|
167
143
|
return this;
|
168
144
|
});
|
169
|
-
var
|
170
|
-
|
171
|
-
|
172
|
-
var
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
return this._invoke(method, arg);
|
145
|
+
var d = Object.getPrototypeOf,
|
146
|
+
v = d && d(d(values([])));
|
147
|
+
v && v !== r && n.call(v, a) && (p = v);
|
148
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
149
|
+
function defineIteratorMethods(t) {
|
150
|
+
["next", "throw", "return"].forEach(function (e) {
|
151
|
+
define(t, e, function (t) {
|
152
|
+
return this._invoke(e, t);
|
178
153
|
});
|
179
154
|
});
|
180
155
|
}
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
invoke("
|
191
|
-
}
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
}, function (error) {
|
196
|
-
return invoke("throw", error, resolve, reject);
|
156
|
+
function AsyncIterator(t, e) {
|
157
|
+
function invoke(r, o, i, a) {
|
158
|
+
var c = tryCatch(t[r], t, o);
|
159
|
+
if ("throw" !== c.type) {
|
160
|
+
var u = c.arg,
|
161
|
+
h = u.value;
|
162
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
163
|
+
invoke("next", t, i, a);
|
164
|
+
}, function (t) {
|
165
|
+
invoke("throw", t, i, a);
|
166
|
+
}) : e.resolve(h).then(function (t) {
|
167
|
+
u.value = t, i(u);
|
168
|
+
}, function (t) {
|
169
|
+
return invoke("throw", t, i, a);
|
197
170
|
});
|
198
171
|
}
|
199
|
-
|
200
|
-
reject(record.arg);
|
172
|
+
a(c.arg);
|
201
173
|
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
}
|
174
|
+
var r;
|
175
|
+
o(this, "_invoke", {
|
176
|
+
value: function (t, n) {
|
177
|
+
function callInvokeWithMethodAndArg() {
|
178
|
+
return new e(function (e, r) {
|
179
|
+
invoke(t, n, e, r);
|
180
|
+
});
|
181
|
+
}
|
182
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
210
183
|
}
|
211
|
-
|
212
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
213
|
-
};
|
184
|
+
});
|
214
185
|
}
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
186
|
+
function makeInvokeMethod(e, r, n) {
|
187
|
+
var o = h;
|
188
|
+
return function (i, a) {
|
189
|
+
if (o === f) throw new Error("Generator is already running");
|
190
|
+
if (o === s) {
|
191
|
+
if ("throw" === i) throw a;
|
192
|
+
return {
|
193
|
+
value: t,
|
194
|
+
done: !0
|
195
|
+
};
|
223
196
|
}
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
197
|
+
for (n.method = i, n.arg = a;;) {
|
198
|
+
var c = n.delegate;
|
199
|
+
if (c) {
|
200
|
+
var u = maybeInvokeDelegate(c, n);
|
201
|
+
if (u) {
|
202
|
+
if (u === y) continue;
|
203
|
+
return u;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
207
|
+
if (o === h) throw o = s, n.arg;
|
208
|
+
n.dispatchException(n.arg);
|
209
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
210
|
+
o = f;
|
211
|
+
var p = tryCatch(e, r, n);
|
212
|
+
if ("normal" === p.type) {
|
213
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
214
|
+
return {
|
215
|
+
value: p.arg,
|
216
|
+
done: n.done
|
217
|
+
};
|
218
|
+
}
|
219
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
220
|
+
}
|
221
|
+
};
|
232
222
|
}
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
223
|
+
function maybeInvokeDelegate(e, r) {
|
224
|
+
var n = r.method,
|
225
|
+
o = e.iterator[n];
|
226
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
227
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
228
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
229
|
+
var a = i.arg;
|
230
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
231
|
+
}
|
232
|
+
function pushTryEntry(t) {
|
233
|
+
var e = {
|
234
|
+
tryLoc: t[0]
|
237
235
|
};
|
238
|
-
1 in
|
236
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
239
237
|
}
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
238
|
+
function resetTryEntry(t) {
|
239
|
+
var e = t.completion || {};
|
240
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
244
241
|
}
|
245
|
-
|
246
|
-
function Context(tryLocsList) {
|
242
|
+
function Context(t) {
|
247
243
|
this.tryEntries = [{
|
248
244
|
tryLoc: "root"
|
249
|
-
}],
|
245
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
250
246
|
}
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
if (
|
256
|
-
if (
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
next =
|
261
|
-
|
262
|
-
|
263
|
-
return next.value = undefined, next.done = !0, next;
|
264
|
-
};
|
265
|
-
|
266
|
-
return next.next = next;
|
247
|
+
function values(e) {
|
248
|
+
if (e || "" === e) {
|
249
|
+
var r = e[a];
|
250
|
+
if (r) return r.call(e);
|
251
|
+
if ("function" == typeof e.next) return e;
|
252
|
+
if (!isNaN(e.length)) {
|
253
|
+
var o = -1,
|
254
|
+
i = function next() {
|
255
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
256
|
+
return next.value = t, next.done = !0, next;
|
257
|
+
};
|
258
|
+
return i.next = i;
|
267
259
|
}
|
268
260
|
}
|
269
|
-
|
270
|
-
return {
|
271
|
-
next: doneResult
|
272
|
-
};
|
261
|
+
throw new TypeError(typeof e + " is not iterable");
|
273
262
|
}
|
274
|
-
|
275
|
-
|
263
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
264
|
+
value: GeneratorFunctionPrototype,
|
265
|
+
configurable: !0
|
266
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
267
|
+
value: GeneratorFunction,
|
268
|
+
configurable: !0
|
269
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
270
|
+
var e = "function" == typeof t && t.constructor;
|
271
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
272
|
+
}, e.mark = function (t) {
|
273
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
274
|
+
}, e.awrap = function (t) {
|
276
275
|
return {
|
277
|
-
|
278
|
-
done: !0
|
276
|
+
__await: t
|
279
277
|
};
|
280
|
-
}
|
281
|
-
|
282
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
283
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
284
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
285
|
-
}, exports.mark = function (genFun) {
|
286
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
287
|
-
}, exports.awrap = function (arg) {
|
288
|
-
return {
|
289
|
-
__await: arg
|
290
|
-
};
|
291
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
278
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
292
279
|
return this;
|
293
|
-
}),
|
294
|
-
void 0 ===
|
295
|
-
var
|
296
|
-
return
|
297
|
-
return
|
280
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
281
|
+
void 0 === i && (i = Promise);
|
282
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
283
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
284
|
+
return t.done ? t.value : a.next();
|
298
285
|
});
|
299
|
-
}, defineIteratorMethods(
|
286
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
300
287
|
return this;
|
301
|
-
}), define(
|
288
|
+
}), define(g, "toString", function () {
|
302
289
|
return "[object Generator]";
|
303
|
-
}),
|
304
|
-
var
|
305
|
-
|
306
|
-
for (var
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
290
|
+
}), e.keys = function (t) {
|
291
|
+
var e = Object(t),
|
292
|
+
r = [];
|
293
|
+
for (var n in e) r.push(n);
|
294
|
+
return r.reverse(), function next() {
|
295
|
+
for (; r.length;) {
|
296
|
+
var t = r.pop();
|
297
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
312
298
|
}
|
313
|
-
|
314
299
|
return next.done = !0, next;
|
315
300
|
};
|
316
|
-
},
|
301
|
+
}, e.values = values, Context.prototype = {
|
317
302
|
constructor: Context,
|
318
|
-
reset: function (
|
319
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
303
|
+
reset: function (e) {
|
304
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
320
305
|
},
|
321
306
|
stop: function () {
|
322
307
|
this.done = !0;
|
323
|
-
var
|
324
|
-
if ("throw" ===
|
308
|
+
var t = this.tryEntries[0].completion;
|
309
|
+
if ("throw" === t.type) throw t.arg;
|
325
310
|
return this.rval;
|
326
311
|
},
|
327
|
-
dispatchException: function (
|
328
|
-
if (this.done) throw
|
329
|
-
var
|
330
|
-
|
331
|
-
|
332
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
312
|
+
dispatchException: function (e) {
|
313
|
+
if (this.done) throw e;
|
314
|
+
var r = this;
|
315
|
+
function handle(n, o) {
|
316
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
333
317
|
}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
if (
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
if (
|
345
|
-
if (this.prev <
|
346
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
347
|
-
} else if (hasCatch) {
|
348
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
318
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
319
|
+
var i = this.tryEntries[o],
|
320
|
+
a = i.completion;
|
321
|
+
if ("root" === i.tryLoc) return handle("end");
|
322
|
+
if (i.tryLoc <= this.prev) {
|
323
|
+
var c = n.call(i, "catchLoc"),
|
324
|
+
u = n.call(i, "finallyLoc");
|
325
|
+
if (c && u) {
|
326
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
327
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
328
|
+
} else if (c) {
|
329
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
349
330
|
} else {
|
350
|
-
if (!
|
351
|
-
if (this.prev <
|
331
|
+
if (!u) throw new Error("try statement without catch or finally");
|
332
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
352
333
|
}
|
353
334
|
}
|
354
335
|
}
|
355
336
|
},
|
356
|
-
abrupt: function (
|
357
|
-
for (var
|
358
|
-
var
|
359
|
-
|
360
|
-
|
361
|
-
var finallyEntry = entry;
|
337
|
+
abrupt: function (t, e) {
|
338
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
339
|
+
var o = this.tryEntries[r];
|
340
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
341
|
+
var i = o;
|
362
342
|
break;
|
363
343
|
}
|
364
344
|
}
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
345
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
346
|
+
var a = i ? i.completion : {};
|
347
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
369
348
|
},
|
370
|
-
complete: function (
|
371
|
-
if ("throw" ===
|
372
|
-
return "break" ===
|
349
|
+
complete: function (t, e) {
|
350
|
+
if ("throw" === t.type) throw t.arg;
|
351
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
373
352
|
},
|
374
|
-
finish: function (
|
375
|
-
for (var
|
376
|
-
var
|
377
|
-
if (
|
353
|
+
finish: function (t) {
|
354
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
355
|
+
var r = this.tryEntries[e];
|
356
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
378
357
|
}
|
379
358
|
},
|
380
|
-
catch: function (
|
381
|
-
for (var
|
382
|
-
var
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
var thrown = record.arg;
|
389
|
-
resetTryEntry(entry);
|
359
|
+
catch: function (t) {
|
360
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
361
|
+
var r = this.tryEntries[e];
|
362
|
+
if (r.tryLoc === t) {
|
363
|
+
var n = r.completion;
|
364
|
+
if ("throw" === n.type) {
|
365
|
+
var o = n.arg;
|
366
|
+
resetTryEntry(r);
|
390
367
|
}
|
391
|
-
|
392
|
-
return thrown;
|
368
|
+
return o;
|
393
369
|
}
|
394
370
|
}
|
395
|
-
|
396
371
|
throw new Error("illegal catch attempt");
|
397
372
|
},
|
398
|
-
delegateYield: function (
|
373
|
+
delegateYield: function (e, r, n) {
|
399
374
|
return this.delegate = {
|
400
|
-
iterator: values(
|
401
|
-
resultName:
|
402
|
-
nextLoc:
|
403
|
-
}, "next" === this.method && (this.arg =
|
375
|
+
iterator: values(e),
|
376
|
+
resultName: r,
|
377
|
+
nextLoc: n
|
378
|
+
}, "next" === this.method && (this.arg = t), y;
|
404
379
|
}
|
405
|
-
},
|
380
|
+
}, e;
|
406
381
|
}
|
407
|
-
|
408
382
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
409
383
|
try {
|
410
384
|
var info = gen[key](arg);
|
@@ -413,35 +387,30 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
413
387
|
reject(error);
|
414
388
|
return;
|
415
389
|
}
|
416
|
-
|
417
390
|
if (info.done) {
|
418
391
|
resolve(value);
|
419
392
|
} else {
|
420
393
|
Promise.resolve(value).then(_next, _throw);
|
421
394
|
}
|
422
395
|
}
|
423
|
-
|
424
396
|
function _asyncToGenerator(fn) {
|
425
397
|
return function () {
|
426
398
|
var self = this,
|
427
|
-
|
399
|
+
args = arguments;
|
428
400
|
return new Promise(function (resolve, reject) {
|
429
401
|
var gen = fn.apply(self, args);
|
430
|
-
|
431
402
|
function _next(value) {
|
432
403
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
433
404
|
}
|
434
|
-
|
435
405
|
function _throw(err) {
|
436
406
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
437
407
|
}
|
438
|
-
|
439
408
|
_next(undefined);
|
440
409
|
});
|
441
410
|
};
|
442
411
|
}
|
443
|
-
|
444
412
|
function _defineProperty(obj, key, value) {
|
413
|
+
key = _toPropertyKey(key);
|
445
414
|
if (key in obj) {
|
446
415
|
Object.defineProperty(obj, key, {
|
447
416
|
value: value,
|
@@ -452,35 +421,26 @@ function _defineProperty(obj, key, value) {
|
|
452
421
|
} else {
|
453
422
|
obj[key] = value;
|
454
423
|
}
|
455
|
-
|
456
424
|
return obj;
|
457
425
|
}
|
458
|
-
|
459
426
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
460
427
|
if (source == null) return {};
|
461
428
|
var target = {};
|
462
429
|
var sourceKeys = Object.keys(source);
|
463
430
|
var key, i;
|
464
|
-
|
465
431
|
for (i = 0; i < sourceKeys.length; i++) {
|
466
432
|
key = sourceKeys[i];
|
467
433
|
if (excluded.indexOf(key) >= 0) continue;
|
468
434
|
target[key] = source[key];
|
469
435
|
}
|
470
|
-
|
471
436
|
return target;
|
472
437
|
}
|
473
|
-
|
474
438
|
function _objectWithoutProperties(source, excluded) {
|
475
439
|
if (source == null) return {};
|
476
|
-
|
477
440
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
478
|
-
|
479
441
|
var key, i;
|
480
|
-
|
481
442
|
if (Object.getOwnPropertySymbols) {
|
482
443
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
483
|
-
|
484
444
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
485
445
|
key = sourceSymbolKeys[i];
|
486
446
|
if (excluded.indexOf(key) >= 0) continue;
|
@@ -488,60 +448,23 @@ function _objectWithoutProperties(source, excluded) {
|
|
488
448
|
target[key] = source[key];
|
489
449
|
}
|
490
450
|
}
|
491
|
-
|
492
451
|
return target;
|
493
452
|
}
|
494
|
-
|
495
453
|
function _slicedToArray(arr, i) {
|
496
454
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
497
455
|
}
|
498
|
-
|
499
456
|
function _toConsumableArray(arr) {
|
500
457
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
501
458
|
}
|
502
|
-
|
503
459
|
function _arrayWithoutHoles(arr) {
|
504
460
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
505
461
|
}
|
506
|
-
|
507
462
|
function _arrayWithHoles(arr) {
|
508
463
|
if (Array.isArray(arr)) return arr;
|
509
464
|
}
|
510
|
-
|
511
465
|
function _iterableToArray(iter) {
|
512
466
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
513
467
|
}
|
514
|
-
|
515
|
-
function _iterableToArrayLimit(arr, i) {
|
516
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
517
|
-
|
518
|
-
if (_i == null) return;
|
519
|
-
var _arr = [];
|
520
|
-
var _n = true;
|
521
|
-
var _d = false;
|
522
|
-
|
523
|
-
var _s, _e;
|
524
|
-
|
525
|
-
try {
|
526
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
527
|
-
_arr.push(_s.value);
|
528
|
-
|
529
|
-
if (i && _arr.length === i) break;
|
530
|
-
}
|
531
|
-
} catch (err) {
|
532
|
-
_d = true;
|
533
|
-
_e = err;
|
534
|
-
} finally {
|
535
|
-
try {
|
536
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
537
|
-
} finally {
|
538
|
-
if (_d) throw _e;
|
539
|
-
}
|
540
|
-
}
|
541
|
-
|
542
|
-
return _arr;
|
543
|
-
}
|
544
|
-
|
545
468
|
function _unsupportedIterableToArray(o, minLen) {
|
546
469
|
if (!o) return;
|
547
470
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
@@ -550,35 +473,44 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
550
473
|
if (n === "Map" || n === "Set") return Array.from(o);
|
551
474
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
552
475
|
}
|
553
|
-
|
554
476
|
function _arrayLikeToArray(arr, len) {
|
555
477
|
if (len == null || len > arr.length) len = arr.length;
|
556
|
-
|
557
478
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
558
|
-
|
559
479
|
return arr2;
|
560
480
|
}
|
561
|
-
|
562
481
|
function _nonIterableSpread() {
|
563
482
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
564
483
|
}
|
565
|
-
|
566
484
|
function _nonIterableRest() {
|
567
485
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
568
486
|
}
|
487
|
+
function _toPrimitive(input, hint) {
|
488
|
+
if (typeof input !== "object" || input === null) return input;
|
489
|
+
var prim = input[Symbol.toPrimitive];
|
490
|
+
if (prim !== undefined) {
|
491
|
+
var res = prim.call(input, hint || "default");
|
492
|
+
if (typeof res !== "object") return res;
|
493
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
494
|
+
}
|
495
|
+
return (hint === "string" ? String : Number)(input);
|
496
|
+
}
|
497
|
+
function _toPropertyKey(arg) {
|
498
|
+
var key = _toPrimitive(arg, "string");
|
499
|
+
return typeof key === "symbol" ? key : String(key);
|
500
|
+
}
|
569
501
|
|
570
502
|
/* eslint-disable valid-jsdoc */
|
571
503
|
// @ts-check
|
504
|
+
|
572
505
|
var TRANSPARENT_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
506
|
+
|
573
507
|
/**
|
574
508
|
* Replace all text with emoji with an image html tag
|
575
509
|
* @param {string} text
|
576
510
|
* @return {string}
|
577
511
|
*/
|
578
|
-
|
579
512
|
function replaceAllTextEmojis(text) {
|
580
513
|
var allEmojis = getAllEmojisFromText(text);
|
581
|
-
|
582
514
|
if (allEmojis) {
|
583
515
|
allEmojis = _toConsumableArray(new Set(allEmojis)); // remove duplicates
|
584
516
|
|
@@ -586,9 +518,9 @@ function replaceAllTextEmojis(text) {
|
|
586
518
|
text = replaceAll(text, emoji, getInputEmojiHTML(emoji));
|
587
519
|
});
|
588
520
|
}
|
589
|
-
|
590
521
|
return text;
|
591
522
|
}
|
523
|
+
|
592
524
|
/**
|
593
525
|
* Replace all occurrencies in a string
|
594
526
|
* @param {string} str
|
@@ -596,77 +528,67 @@ function replaceAllTextEmojis(text) {
|
|
596
528
|
* @param {string} replace
|
597
529
|
* @return {string}
|
598
530
|
*/
|
599
|
-
|
600
531
|
function replaceAll(str, find, replace) {
|
601
532
|
return str.replace(new RegExp(find, "g"), replace);
|
602
533
|
}
|
534
|
+
|
603
535
|
/**
|
604
536
|
* Get all emojis from the text
|
605
537
|
* @param {string} text
|
606
538
|
* @return {string[]}
|
607
539
|
*/
|
608
|
-
|
609
|
-
|
610
540
|
function getAllEmojisFromText(text) {
|
611
541
|
return text.match(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/g);
|
612
|
-
}
|
542
|
+
}
|
613
543
|
|
544
|
+
// eslint-disable-next-line valid-jsdoc
|
614
545
|
/**
|
615
546
|
*
|
616
547
|
* @param { import("../types/types").EmojiMartItem } emoji
|
617
548
|
* @return {string}
|
618
549
|
*/
|
619
|
-
|
620
|
-
|
621
550
|
function getImageEmoji(emoji) {
|
622
551
|
var _emojiPickerEl$shadow;
|
623
|
-
|
624
552
|
/** @type {HTMLElement | null} */
|
625
553
|
var emojiPickerEl = document.querySelector('em-emoji-picker');
|
626
|
-
|
627
554
|
if (!emojiPickerEl) {
|
628
555
|
return getInputEmojiNativeHTML(emoji["native"]);
|
629
556
|
}
|
630
|
-
/** @type {HTMLSpanElement | null=} */
|
631
|
-
|
632
|
-
|
633
|
-
var emojiSpanEl = emojiPickerEl === null || emojiPickerEl === void 0 ? void 0 : (_emojiPickerEl$shadow = emojiPickerEl.shadowRoot) === null || _emojiPickerEl$shadow === void 0 ? void 0 : _emojiPickerEl$shadow.querySelector("[title=\"".concat(emoji.name, "\"] > span > span"));
|
634
557
|
|
558
|
+
/** @type {HTMLSpanElement | null=} */
|
559
|
+
var emojiSpanEl = emojiPickerEl === null || emojiPickerEl === void 0 || (_emojiPickerEl$shadow = emojiPickerEl.shadowRoot) === null || _emojiPickerEl$shadow === void 0 ? void 0 : _emojiPickerEl$shadow.querySelector("[title=\"".concat(emoji.name, "\"] > span > span"));
|
635
560
|
if (!emojiSpanEl) {
|
636
561
|
return getInputEmojiNativeHTML(emoji["native"]);
|
637
562
|
}
|
638
|
-
|
639
563
|
var style = replaceAll(emojiSpanEl.style.cssText, '"', "'");
|
640
564
|
return getInputEmojiHTML(style, emoji["native"]);
|
641
|
-
}
|
565
|
+
}
|
642
566
|
|
567
|
+
// eslint-disable-next-line valid-jsdoc
|
643
568
|
/**
|
644
569
|
*
|
645
570
|
* @param {string} style
|
646
571
|
* @param {string} emoji
|
647
572
|
* @returns
|
648
573
|
*/
|
649
|
-
|
650
574
|
function getInputEmojiHTML(style, emoji) {
|
651
575
|
return "<img style=\"".concat(style, "; display: inline-block\" data-emoji=\"").concat(emoji, "\" src=\"").concat(TRANSPARENT_GIF, "\" />");
|
652
576
|
}
|
577
|
+
|
653
578
|
/**
|
654
579
|
*
|
655
580
|
* @param {string} emoji
|
656
581
|
* @returns
|
657
582
|
*/
|
658
|
-
|
659
|
-
|
660
583
|
function getInputEmojiNativeHTML(emoji) {
|
661
584
|
return "<span class=\"width: 18px; height: 18px; display: inline-block; margin: 0 1px;\">".concat(emoji, "</span>");
|
662
585
|
}
|
586
|
+
|
663
587
|
/**
|
664
588
|
*
|
665
589
|
* @param {string} html
|
666
590
|
* @return {string}
|
667
591
|
*/
|
668
|
-
|
669
|
-
|
670
592
|
function replaceAllTextEmojiToString(html) {
|
671
593
|
var container = document.createElement("div");
|
672
594
|
container.innerHTML = html;
|
@@ -678,37 +600,35 @@ function replaceAllTextEmojiToString(html) {
|
|
678
600
|
}
|
679
601
|
|
680
602
|
// @ts-check
|
603
|
+
|
681
604
|
/**
|
682
605
|
*
|
683
606
|
* @param {string} html
|
684
607
|
*/
|
685
|
-
|
686
608
|
function handlePasteHtmlAtCaret(html) {
|
687
609
|
var sel;
|
688
610
|
var range;
|
689
|
-
|
690
611
|
if (window.getSelection) {
|
691
612
|
// IE9 and non-IE
|
692
613
|
sel = window.getSelection();
|
693
614
|
if (sel === null) return;
|
694
|
-
|
695
615
|
if (sel.getRangeAt && sel.rangeCount) {
|
696
616
|
range = sel.getRangeAt(0);
|
697
|
-
range.deleteContents();
|
698
|
-
// non-standard and not supported in all browsers (IE9, for one)
|
617
|
+
range.deleteContents();
|
699
618
|
|
619
|
+
// Range.createContextualFragment() would be useful here but is
|
620
|
+
// non-standard and not supported in all browsers (IE9, for one)
|
700
621
|
var el = document.createElement("div");
|
701
622
|
el.innerHTML = html;
|
702
623
|
var frag = document.createDocumentFragment();
|
703
624
|
var node;
|
704
625
|
var lastNode;
|
705
|
-
|
706
626
|
while (node = el.firstChild) {
|
707
627
|
lastNode = frag.appendChild(node);
|
708
628
|
}
|
629
|
+
range.insertNode(frag);
|
709
630
|
|
710
|
-
|
711
|
-
|
631
|
+
// Preserve the selection
|
712
632
|
if (lastNode) {
|
713
633
|
range = range.cloneRange();
|
714
634
|
range.setStartAfter(lastNode);
|
@@ -719,34 +639,32 @@ function handlePasteHtmlAtCaret(html) {
|
|
719
639
|
}
|
720
640
|
}
|
721
641
|
}
|
642
|
+
|
722
643
|
/**
|
723
644
|
*
|
724
645
|
* @param {{text: string, html: string}} props
|
725
646
|
* @return {number}
|
726
647
|
*/
|
727
|
-
|
728
648
|
function totalCharacters(_ref2) {
|
729
649
|
var text = _ref2.text,
|
730
|
-
|
650
|
+
html = _ref2.html;
|
731
651
|
var textCount = text.length;
|
732
652
|
var emojisCount = (html.match(/<img/g) || []).length;
|
733
653
|
return textCount + emojisCount;
|
734
|
-
}
|
654
|
+
}
|
655
|
+
|
735
656
|
/**
|
736
657
|
* Set caret to the end of text value
|
737
658
|
* @param {React.MutableRefObject<HTMLDivElement| null>} input
|
738
659
|
*/
|
739
|
-
|
740
660
|
function moveCaretToEnd(input) {
|
741
661
|
var range;
|
742
662
|
var selection;
|
743
|
-
|
744
663
|
if (document.createRange && input.current) {
|
745
664
|
range = document.createRange();
|
746
665
|
range.selectNodeContents(input.current);
|
747
666
|
range.collapse(false);
|
748
667
|
selection = window.getSelection();
|
749
|
-
|
750
668
|
if (selection) {
|
751
669
|
selection.removeAllRanges();
|
752
670
|
selection.addRange(range);
|
@@ -758,39 +676,34 @@ function moveCaretToEnd(input) {
|
|
758
676
|
* @param {HTMLDivElement} inputDiv
|
759
677
|
* @return {string}
|
760
678
|
*/
|
761
|
-
|
762
679
|
function removeHtmlExceptBr(inputDiv) {
|
763
680
|
var temp = inputDiv.innerHTML.replace(/<br\s*\/?>/gi, '[BR]'); // temporarily replace <br> with placeholder
|
764
|
-
|
765
681
|
var stripped = temp.replace(/<[^>]+>/g, ''); // strip all html tags
|
766
|
-
|
767
682
|
var _final = stripped.replace(/\[BR\]/gi, '</br>'); // replace placeholders with <br>
|
768
|
-
|
769
|
-
|
770
683
|
return _final;
|
771
684
|
}
|
772
685
|
|
773
686
|
// @ts-check
|
687
|
+
|
774
688
|
/**
|
775
689
|
* @typedef {import('../types/types').SanitizeFn} SanitizeFn
|
776
690
|
*/
|
777
|
-
// eslint-disable-next-line valid-jsdoc
|
778
691
|
|
692
|
+
// eslint-disable-next-line valid-jsdoc
|
779
693
|
/**
|
780
694
|
* @param {boolean} shouldReturn
|
781
695
|
*/
|
782
|
-
|
783
696
|
function useSanitize(shouldReturn) {
|
784
697
|
/** @type {React.MutableRefObject<SanitizeFn[]>} */
|
785
698
|
var sanitizeFnsRef = useRef([]);
|
786
699
|
var sanitizedTextRef = useRef("");
|
787
|
-
/** @type {(fn: SanitizeFn) => void} */
|
788
700
|
|
701
|
+
/** @type {(fn: SanitizeFn) => void} */
|
789
702
|
var addSanitizeFn = useCallback(function (fn) {
|
790
703
|
sanitizeFnsRef.current.push(fn);
|
791
704
|
}, []);
|
792
|
-
/** @type {(html: string) => string} */
|
793
705
|
|
706
|
+
/** @type {(html: string) => string} */
|
794
707
|
var sanitize = useCallback(function (html) {
|
795
708
|
var result = sanitizeFnsRef.current.reduce(function (acc, fn) {
|
796
709
|
return fn(acc);
|
@@ -805,30 +718,30 @@ function useSanitize(shouldReturn) {
|
|
805
718
|
sanitizedTextRef: sanitizedTextRef
|
806
719
|
};
|
807
720
|
}
|
721
|
+
|
808
722
|
/**
|
809
723
|
*
|
810
724
|
* @param {string} html
|
811
725
|
* @param {boolean} shouldReturn
|
812
726
|
* @return {string}
|
813
727
|
*/
|
814
|
-
|
815
728
|
function replaceAllHtmlToString(html, shouldReturn) {
|
816
729
|
var container = document.createElement("div");
|
817
730
|
container.innerHTML = html;
|
818
731
|
var text;
|
819
|
-
|
820
732
|
if (shouldReturn) {
|
821
733
|
text = removeHtmlExceptBr(container);
|
822
734
|
} else {
|
823
735
|
text = container.innerText || "";
|
824
|
-
}
|
825
|
-
|
736
|
+
}
|
826
737
|
|
738
|
+
// remove all ↵ for safari
|
827
739
|
text = text.replace(/\n/gi, "");
|
828
740
|
return text;
|
829
741
|
}
|
830
742
|
|
831
743
|
// @ts-check
|
744
|
+
|
832
745
|
/**
|
833
746
|
* @typedef {Object} Props
|
834
747
|
* @property {React.Ref<any>} ref
|
@@ -841,27 +754,22 @@ function replaceAllHtmlToString(html, shouldReturn) {
|
|
841
754
|
*
|
842
755
|
* @param {Props} props
|
843
756
|
*/
|
844
|
-
|
845
757
|
function useExpose(_ref) {
|
846
758
|
var ref = _ref.ref,
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
759
|
+
textInputRef = _ref.textInputRef,
|
760
|
+
setValue = _ref.setValue,
|
761
|
+
emitChange = _ref.emitChange;
|
851
762
|
var _useSanitize = useSanitize(),
|
852
|
-
|
853
|
-
|
854
|
-
|
763
|
+
sanitize = _useSanitize.sanitize,
|
764
|
+
sanitizedTextRef = _useSanitize.sanitizedTextRef;
|
855
765
|
useImperativeHandle(ref, function () {
|
856
766
|
return {
|
857
767
|
get value() {
|
858
768
|
return sanitizedTextRef.current;
|
859
769
|
},
|
860
|
-
|
861
770
|
set value(value) {
|
862
771
|
setValue(value);
|
863
772
|
},
|
864
|
-
|
865
773
|
focus: function focus() {
|
866
774
|
if (textInputRef.current === null) return;
|
867
775
|
textInputRef.current.focus();
|
@@ -870,7 +778,6 @@ function useExpose(_ref) {
|
|
870
778
|
if (textInputRef.current !== null) {
|
871
779
|
sanitize(textInputRef.current.html);
|
872
780
|
}
|
873
|
-
|
874
781
|
emitChange();
|
875
782
|
}
|
876
783
|
};
|
@@ -879,13 +786,13 @@ function useExpose(_ref) {
|
|
879
786
|
|
880
787
|
// @ts-check
|
881
788
|
|
789
|
+
// eslint-disable-next-line valid-jsdoc
|
882
790
|
/**
|
883
791
|
* useEmit
|
884
792
|
* @param {React.MutableRefObject<import('../text-input').Ref | null>} textInputRef
|
885
793
|
* @param {(size: {width: number, height: number}) => void} onResize
|
886
794
|
* @param {(text: string) => void} onChange
|
887
795
|
*/
|
888
|
-
|
889
796
|
function useEmit(textInputRef, onResize, onChange) {
|
890
797
|
/** @type {React.MutableRefObject<{width: number; height: number} | null>} */
|
891
798
|
var currentSizeRef = useRef(null);
|
@@ -894,11 +801,9 @@ function useEmit(textInputRef, onResize, onChange) {
|
|
894
801
|
if (textInputRef.current !== null) {
|
895
802
|
var currentSize = currentSizeRef.current;
|
896
803
|
var nextSize = textInputRef.current.size;
|
897
|
-
|
898
804
|
if ((!currentSize || currentSize.width !== nextSize.width || currentSize.height !== nextSize.height) && typeof onResize === "function") {
|
899
805
|
onResize(nextSize);
|
900
806
|
}
|
901
|
-
|
902
807
|
currentSizeRef.current = nextSize;
|
903
808
|
}
|
904
809
|
}, [onResize, textInputRef]);
|
@@ -906,7 +811,6 @@ function useEmit(textInputRef, onResize, onChange) {
|
|
906
811
|
if (typeof onChangeFn.current === "function") {
|
907
812
|
onChangeFn.current(sanitizedText);
|
908
813
|
}
|
909
|
-
|
910
814
|
if (typeof onResize === "function") {
|
911
815
|
checkAndEmitResize();
|
912
816
|
}
|
@@ -920,6 +824,7 @@ function useEmit(textInputRef, onResize, onChange) {
|
|
920
824
|
}
|
921
825
|
|
922
826
|
var _excluded = ["placeholder", "style", "tabIndex", "className", "onChange"];
|
827
|
+
|
923
828
|
/**
|
924
829
|
* @typedef {Object} Props
|
925
830
|
* @property {(event: React.KeyboardEvent) => void} onKeyDown
|
@@ -949,47 +854,39 @@ var _excluded = ["placeholder", "style", "tabIndex", "className", "onChange"];
|
|
949
854
|
* focus: () => void;
|
950
855
|
* }} Ref
|
951
856
|
*/
|
952
|
-
// eslint-disable-next-line valid-jsdoc
|
953
857
|
|
858
|
+
// eslint-disable-next-line valid-jsdoc
|
954
859
|
/** @type {React.ForwardRefRenderFunction<Ref, Props>} */
|
955
|
-
|
956
860
|
var TextInput = function TextInput(_ref, ref) {
|
957
861
|
var placeholder = _ref.placeholder,
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
862
|
+
style = _ref.style,
|
863
|
+
tabIndex = _ref.tabIndex,
|
864
|
+
className = _ref.className,
|
865
|
+
onChange = _ref.onChange,
|
866
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
964
867
|
useImperativeHandle(ref, function () {
|
965
868
|
return {
|
966
869
|
appendContent: function appendContent(html) {
|
967
870
|
if (textInputRef.current) {
|
968
871
|
textInputRef.current.focus();
|
969
872
|
}
|
970
|
-
|
971
873
|
handlePasteHtmlAtCaret(html);
|
972
|
-
|
973
874
|
if (textInputRef.current) {
|
974
875
|
textInputRef.current.focus();
|
975
876
|
}
|
976
|
-
|
977
877
|
if (textInputRef.current && placeholderRef.current && textInputRef.current.innerHTML.trim() === "") {
|
978
878
|
placeholderRef.current.style.visibility = "visible";
|
979
879
|
} else if (placeholderRef.current) {
|
980
880
|
placeholderRef.current.style.visibility = "hidden";
|
981
881
|
}
|
982
|
-
|
983
882
|
if (textInputRef.current && typeof onChange === 'function') {
|
984
883
|
onChange(textInputRef.current.innerHTML);
|
985
884
|
}
|
986
885
|
},
|
987
|
-
|
988
886
|
set html(value) {
|
989
887
|
if (textInputRef.current) {
|
990
888
|
textInputRef.current.innerHTML = value;
|
991
889
|
}
|
992
|
-
|
993
890
|
if (placeholderRef.current) {
|
994
891
|
if (value.trim() === "") {
|
995
892
|
placeholderRef.current.style.visibility = "visible";
|
@@ -997,22 +894,18 @@ var TextInput = function TextInput(_ref, ref) {
|
|
997
894
|
placeholderRef.current.style.visibility = "hidden";
|
998
895
|
}
|
999
896
|
}
|
1000
|
-
|
1001
897
|
if (typeof onChange === 'function' && textInputRef.current) {
|
1002
898
|
onChange(textInputRef.current.innerHTML);
|
1003
899
|
}
|
1004
900
|
},
|
1005
|
-
|
1006
901
|
get html() {
|
1007
902
|
if (!textInputRef.current) return '';
|
1008
903
|
return textInputRef.current.innerHTML;
|
1009
904
|
},
|
1010
|
-
|
1011
905
|
get text() {
|
1012
906
|
if (!textInputRef.current) return '';
|
1013
907
|
return textInputRef.current.innerText;
|
1014
908
|
},
|
1015
|
-
|
1016
909
|
get size() {
|
1017
910
|
if (!textInputRef.current) {
|
1018
911
|
return {
|
@@ -1020,41 +913,36 @@ var TextInput = function TextInput(_ref, ref) {
|
|
1020
913
|
height: 0
|
1021
914
|
};
|
1022
915
|
}
|
1023
|
-
|
1024
916
|
return {
|
1025
917
|
width: textInputRef.current.offsetWidth,
|
1026
918
|
height: textInputRef.current.offsetHeight
|
1027
919
|
};
|
1028
920
|
},
|
1029
|
-
|
1030
921
|
focus: function focus() {
|
1031
922
|
if (!textInputRef.current) return;
|
1032
923
|
textInputRef.current.focus();
|
1033
924
|
}
|
1034
925
|
};
|
1035
926
|
});
|
1036
|
-
/** @type {React.MutableRefObject<HTMLDivElement | null>} */
|
1037
927
|
|
928
|
+
/** @type {React.MutableRefObject<HTMLDivElement | null>} */
|
1038
929
|
var placeholderRef = useRef(null);
|
1039
930
|
/** @type {React.MutableRefObject<HTMLDivElement | null>} */
|
1040
|
-
|
1041
931
|
var textInputRef = useRef(null);
|
932
|
+
|
1042
933
|
/**
|
1043
934
|
*
|
1044
935
|
* @param {React.KeyboardEvent} event
|
1045
936
|
*/
|
1046
|
-
|
1047
937
|
function handleKeyDown(event) {
|
1048
938
|
if (event.key === "Enter" && (event.shiftKey === true || event.ctrlKey === true) && props.shouldReturn) {
|
1049
939
|
event.preventDefault();
|
1050
|
-
|
1051
940
|
if (textInputRef.current) {
|
1052
941
|
textInputRef.current.innerHTML = "".concat(textInputRef.current.innerHTML, "</br></br>");
|
1053
942
|
moveCaretToEnd(textInputRef);
|
1054
943
|
return;
|
1055
944
|
}
|
1056
945
|
}
|
1057
|
-
|
1058
946
|
if (event.key === "Enter") {
|
1059
947
|
props.onEnter(event);
|
1060
948
|
} else if (event.key === "ArrowUp") {
|
@@ -1066,40 +954,33 @@ var TextInput = function TextInput(_ref, ref) {
|
|
1066
954
|
placeholderRef.current.style.visibility = "hidden";
|
1067
955
|
}
|
1068
956
|
}
|
1069
|
-
|
1070
957
|
props.onKeyDown(event);
|
1071
958
|
}
|
1072
|
-
/** */
|
1073
|
-
|
1074
959
|
|
960
|
+
/** */
|
1075
961
|
function handleClick() {
|
1076
962
|
props.onFocus();
|
1077
963
|
}
|
964
|
+
|
1078
965
|
/**
|
1079
966
|
*
|
1080
967
|
* @param {React.KeyboardEvent} event
|
1081
968
|
*/
|
1082
|
-
|
1083
|
-
|
1084
969
|
function handleKeyUp(event) {
|
1085
970
|
props.onKeyUp(event);
|
1086
971
|
var input = textInputRef.current;
|
1087
|
-
|
1088
972
|
if (placeholderRef.current) {
|
1089
973
|
var _input$innerText;
|
1090
|
-
|
1091
|
-
if ((input === null || input === void 0 ? void 0 : (_input$innerText = input.innerText) === null || _input$innerText === void 0 ? void 0 : _input$innerText.trim()) === "") {
|
974
|
+
if ((input === null || input === void 0 || (_input$innerText = input.innerText) === null || _input$innerText === void 0 ? void 0 : _input$innerText.trim()) === "") {
|
1092
975
|
placeholderRef.current.style.visibility = "visible";
|
1093
976
|
} else {
|
1094
977
|
placeholderRef.current.style.visibility = "hidden";
|
1095
978
|
}
|
1096
979
|
}
|
1097
|
-
|
1098
980
|
if (typeof onChange === 'function' && textInputRef.current) {
|
1099
981
|
onChange(textInputRef.current.innerHTML);
|
1100
982
|
}
|
1101
983
|
}
|
1102
|
-
|
1103
984
|
return /*#__PURE__*/React.createElement("div", {
|
1104
985
|
className: "react-input-emoji--container",
|
1105
986
|
style: style
|
@@ -1122,7 +1003,6 @@ var TextInput = function TextInput(_ref, ref) {
|
|
1122
1003
|
"data-testid": "react-input-emoji--input"
|
1123
1004
|
})));
|
1124
1005
|
};
|
1125
|
-
|
1126
1006
|
var TextInputWithRef = /*#__PURE__*/forwardRef(TextInput);
|
1127
1007
|
|
1128
1008
|
/**
|
@@ -1130,6 +1010,7 @@ var TextInputWithRef = /*#__PURE__*/forwardRef(TextInput);
|
|
1130
1010
|
* @property {boolean} showPicker
|
1131
1011
|
* @property {(event: React.MouseEvent) => void} toggleShowPicker
|
1132
1012
|
* @property {HTMLDivElement=} buttonElement
|
1013
|
+
* @property {React.MutableRefObject=} buttonRef
|
1133
1014
|
*/
|
1134
1015
|
|
1135
1016
|
/**
|
@@ -1137,28 +1018,28 @@ var TextInputWithRef = /*#__PURE__*/forwardRef(TextInput);
|
|
1137
1018
|
* @param {Props} props
|
1138
1019
|
* @return {JSX.Element}
|
1139
1020
|
*/
|
1140
|
-
|
1141
1021
|
function EmojiPickerButton(_ref) {
|
1142
1022
|
var showPicker = _ref.showPicker,
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1023
|
+
toggleShowPicker = _ref.toggleShowPicker,
|
1024
|
+
buttonElement = _ref.buttonElement,
|
1025
|
+
buttonRef = _ref.buttonRef;
|
1026
|
+
var localButtonRef = useRef(null);
|
1147
1027
|
var _useState = useState(false),
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1028
|
+
_useState2 = _slicedToArray(_useState, 2),
|
1029
|
+
showCustomButtonContent = _useState2[0],
|
1030
|
+
setShowCustomButtonContent = _useState2[1];
|
1152
1031
|
useEffect(function () {
|
1153
|
-
var _buttonElement$childN, _buttonElement$childN2;
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1032
|
+
var _buttonRef$current$ch, _buttonRef$current, _buttonElement$childN, _buttonElement$childN2;
|
1033
|
+
if (((_buttonRef$current$ch = buttonRef === null || buttonRef === void 0 || (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || (_buttonRef$current = _buttonRef$current.childNodes) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.length) !== null && _buttonRef$current$ch !== void 0 ? _buttonRef$current$ch : 0) > 2) {
|
1034
|
+
localButtonRef.current.appendChild(buttonRef.current.childNodes[0]);
|
1035
|
+
setShowCustomButtonContent(true);
|
1036
|
+
} else if (((_buttonElement$childN = buttonElement === null || buttonElement === void 0 || (_buttonElement$childN2 = buttonElement.childNodes) === null || _buttonElement$childN2 === void 0 ? void 0 : _buttonElement$childN2.length) !== null && _buttonElement$childN !== void 0 ? _buttonElement$childN : 0) > 2) {
|
1037
|
+
localButtonRef.current.appendChild(buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.childNodes[0]);
|
1157
1038
|
setShowCustomButtonContent(true);
|
1158
1039
|
}
|
1159
1040
|
}, [buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.childNodes]);
|
1160
1041
|
return /*#__PURE__*/React.createElement("button", {
|
1161
|
-
ref:
|
1042
|
+
ref: localButtonRef,
|
1162
1043
|
type: "button",
|
1163
1044
|
className: "react-input-emoji--button".concat(showPicker ? " react-input-emoji--button__show" : ""),
|
1164
1045
|
onClick: toggleShowPicker
|
@@ -1178,7 +1059,6 @@ function EmojiPickerButton(_ref) {
|
|
1178
1059
|
function $parcel$interopDefault(a) {
|
1179
1060
|
return a && a.__esModule ? a.default : a;
|
1180
1061
|
}
|
1181
|
-
|
1182
1062
|
function $c770c458706daa72$export$2e2bcd8739ae039(obj, key, value) {
|
1183
1063
|
if (key in obj) Object.defineProperty(obj, key, {
|
1184
1064
|
value: value,
|
@@ -1188,40 +1068,32 @@ function $c770c458706daa72$export$2e2bcd8739ae039(obj, key, value) {
|
|
1188
1068
|
});else obj[key] = value;
|
1189
1069
|
return obj;
|
1190
1070
|
}
|
1191
|
-
|
1192
1071
|
var $fb96b826c0c5f37a$var$n,
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1072
|
+
$fb96b826c0c5f37a$export$41c562ebe57d11e2,
|
1073
|
+
$fb96b826c0c5f37a$var$u,
|
1074
|
+
$fb96b826c0c5f37a$var$t,
|
1075
|
+
$fb96b826c0c5f37a$var$r,
|
1076
|
+
$fb96b826c0c5f37a$var$o,
|
1077
|
+
$fb96b826c0c5f37a$var$e = {},
|
1078
|
+
$fb96b826c0c5f37a$var$c = [],
|
1079
|
+
$fb96b826c0c5f37a$var$s = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
1202
1080
|
function $fb96b826c0c5f37a$var$a(n1, l1) {
|
1203
1081
|
for (var u1 in l1) n1[u1] = l1[u1];
|
1204
|
-
|
1205
1082
|
return n1;
|
1206
1083
|
}
|
1207
|
-
|
1208
1084
|
function $fb96b826c0c5f37a$var$h(n2) {
|
1209
1085
|
var l2 = n2.parentNode;
|
1210
1086
|
l2 && l2.removeChild(n2);
|
1211
1087
|
}
|
1212
|
-
|
1213
1088
|
function $fb96b826c0c5f37a$export$c8a8987d4410bf2d(l3, u2, i1) {
|
1214
1089
|
var t1,
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1090
|
+
r1,
|
1091
|
+
o1,
|
1092
|
+
f1 = {};
|
1219
1093
|
for (o1 in u2) "key" == o1 ? t1 = u2[o1] : "ref" == o1 ? r1 = u2[o1] : f1[o1] = u2[o1];
|
1220
|
-
|
1221
1094
|
if (arguments.length > 2 && (f1.children = arguments.length > 3 ? $fb96b826c0c5f37a$var$n.call(arguments, 2) : i1), "function" == typeof l3 && null != l3.defaultProps) for (o1 in l3.defaultProps) void 0 === f1[o1] && (f1[o1] = l3.defaultProps[o1]);
|
1222
1095
|
return $fb96b826c0c5f37a$var$y(l3, f1, t1, r1, null);
|
1223
1096
|
}
|
1224
|
-
|
1225
1097
|
function $fb96b826c0c5f37a$var$y(n3, i2, t2, r2, o2) {
|
1226
1098
|
var f2 = {
|
1227
1099
|
type: n3,
|
@@ -1240,46 +1112,35 @@ function $fb96b826c0c5f37a$var$y(n3, i2, t2, r2, o2) {
|
|
1240
1112
|
};
|
1241
1113
|
return null == o2 && null != $fb96b826c0c5f37a$export$41c562ebe57d11e2.vnode && $fb96b826c0c5f37a$export$41c562ebe57d11e2.vnode(f2), f2;
|
1242
1114
|
}
|
1243
|
-
|
1244
1115
|
function $fb96b826c0c5f37a$export$7d1e3a5e95ceca43() {
|
1245
1116
|
return {
|
1246
1117
|
current: null
|
1247
1118
|
};
|
1248
1119
|
}
|
1249
|
-
|
1250
1120
|
function $fb96b826c0c5f37a$export$ffb0004e005737fa(n4) {
|
1251
1121
|
return n4.children;
|
1252
1122
|
}
|
1253
|
-
|
1254
1123
|
function $fb96b826c0c5f37a$export$16fa2f45be04daa8(n5, l4) {
|
1255
1124
|
this.props = n5, this.context = l4;
|
1256
1125
|
}
|
1257
|
-
|
1258
1126
|
function $fb96b826c0c5f37a$var$k(n6, l5) {
|
1259
1127
|
if (null == l5) return n6.__ ? $fb96b826c0c5f37a$var$k(n6.__, n6.__.__k.indexOf(n6) + 1) : null;
|
1260
|
-
|
1261
1128
|
for (var u3; l5 < n6.__k.length; l5++) if (null != (u3 = n6.__k[l5]) && null != u3.__e) return u3.__e;
|
1262
|
-
|
1263
1129
|
return "function" == typeof n6.type ? $fb96b826c0c5f37a$var$k(n6) : null;
|
1264
1130
|
}
|
1265
|
-
|
1266
1131
|
function $fb96b826c0c5f37a$var$b(n7) {
|
1267
1132
|
var l6, u4;
|
1268
|
-
|
1269
1133
|
if (null != (n7 = n7.__) && null != n7.__c) {
|
1270
1134
|
for (n7.__e = n7.__c.base = null, l6 = 0; l6 < n7.__k.length; l6++) if (null != (u4 = n7.__k[l6]) && null != u4.__e) {
|
1271
1135
|
n7.__e = n7.__c.base = u4.__e;
|
1272
1136
|
break;
|
1273
1137
|
}
|
1274
|
-
|
1275
1138
|
return $fb96b826c0c5f37a$var$b(n7);
|
1276
1139
|
}
|
1277
1140
|
}
|
1278
|
-
|
1279
1141
|
function $fb96b826c0c5f37a$var$m(n8) {
|
1280
1142
|
(!n8.__d && (n8.__d = !0) && $fb96b826c0c5f37a$var$t.push(n8) && !$fb96b826c0c5f37a$var$g.__r++ || $fb96b826c0c5f37a$var$o !== $fb96b826c0c5f37a$export$41c562ebe57d11e2.debounceRendering) && (($fb96b826c0c5f37a$var$o = $fb96b826c0c5f37a$export$41c562ebe57d11e2.debounceRendering) || $fb96b826c0c5f37a$var$r)($fb96b826c0c5f37a$var$g);
|
1281
1143
|
}
|
1282
|
-
|
1283
1144
|
function $fb96b826c0c5f37a$var$g() {
|
1284
1145
|
for (var n9; $fb96b826c0c5f37a$var$g.__r = $fb96b826c0c5f37a$var$t.length;) n9 = $fb96b826c0c5f37a$var$t.sort(function (n10, l7) {
|
1285
1146
|
return n10.__v.__b - l7.__v.__b;
|
@@ -1288,18 +1149,16 @@ function $fb96b826c0c5f37a$var$g() {
|
|
1288
1149
|
n11.__d && (r3 = (t3 = (l8 = n11).__v).__e, (o3 = l8.__P) && (u5 = [], (i3 = $fb96b826c0c5f37a$var$a({}, t3)).__v = t3.__v + 1, $fb96b826c0c5f37a$var$j(o3, t3, i3, l8.__n, void 0 !== o3.ownerSVGElement, null != t3.__h ? [r3] : null, u5, null == r3 ? $fb96b826c0c5f37a$var$k(t3) : r3, t3.__h), $fb96b826c0c5f37a$var$z(u5, t3), t3.__e != r3 && $fb96b826c0c5f37a$var$b(t3)));
|
1289
1150
|
});
|
1290
1151
|
}
|
1291
|
-
|
1292
1152
|
function $fb96b826c0c5f37a$var$w(n12, l9, u6, i4, t4, r4, o4, f3, s1, a1) {
|
1293
1153
|
var h1,
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1154
|
+
v1,
|
1155
|
+
p1,
|
1156
|
+
_1,
|
1157
|
+
b1,
|
1158
|
+
m1,
|
1159
|
+
g1,
|
1160
|
+
w1 = i4 && i4.__k || $fb96b826c0c5f37a$var$c,
|
1161
|
+
A1 = w1.length;
|
1303
1162
|
for (u6.__k = [], h1 = 0; h1 < l9.length; h1++) if (null != (_1 = u6.__k[h1] = null == (_1 = l9[h1]) || "boolean" == typeof _1 ? null : "string" == typeof _1 || "number" == typeof _1 || "bigint" == typeof _1 ? $fb96b826c0c5f37a$var$y(null, _1, null, null, _1) : Array.isArray(_1) ? $fb96b826c0c5f37a$var$y($fb96b826c0c5f37a$export$ffb0004e005737fa, {
|
1304
1163
|
children: _1
|
1305
1164
|
}, null, null, null) : _1.__b > 0 ? $fb96b826c0c5f37a$var$y(_1.type, _1.props, _1.key, null, _1.__v) : _1)) {
|
@@ -1308,54 +1167,40 @@ function $fb96b826c0c5f37a$var$w(n12, l9, u6, i4, t4, r4, o4, f3, s1, a1) {
|
|
1308
1167
|
w1[v1] = void 0;
|
1309
1168
|
break;
|
1310
1169
|
}
|
1311
|
-
|
1312
1170
|
p1 = null;
|
1313
1171
|
}
|
1314
1172
|
$fb96b826c0c5f37a$var$j(n12, _1, p1 = p1 || $fb96b826c0c5f37a$var$e, t4, r4, o4, f3, s1, a1), b1 = _1.__e, (v1 = _1.ref) && p1.ref != v1 && (g1 || (g1 = []), p1.ref && g1.push(p1.ref, null, _1), g1.push(v1, _1.__c || b1, _1)), null != b1 ? (null == m1 && (m1 = b1), "function" == typeof _1.type && _1.__k === p1.__k ? _1.__d = s1 = $fb96b826c0c5f37a$var$x(_1, s1, n12) : s1 = $fb96b826c0c5f37a$var$P(n12, _1, p1, w1, b1, s1), "function" == typeof u6.type && (u6.__d = s1)) : s1 && p1.__e == s1 && s1.parentNode != n12 && (s1 = $fb96b826c0c5f37a$var$k(p1));
|
1315
1173
|
}
|
1316
|
-
|
1317
1174
|
for (u6.__e = m1, h1 = A1; h1--;) null != w1[h1] && ("function" == typeof u6.type && null != w1[h1].__e && w1[h1].__e == u6.__d && (u6.__d = $fb96b826c0c5f37a$var$k(i4, h1 + 1)), $fb96b826c0c5f37a$var$N(w1[h1], w1[h1]));
|
1318
|
-
|
1319
1175
|
if (g1) for (h1 = 0; h1 < g1.length; h1++) $fb96b826c0c5f37a$var$M(g1[h1], g1[++h1], g1[++h1]);
|
1320
1176
|
}
|
1321
|
-
|
1322
1177
|
function $fb96b826c0c5f37a$var$x(n13, l10, u7) {
|
1323
1178
|
for (var i5, t5 = n13.__k, r5 = 0; t5 && r5 < t5.length; r5++) (i5 = t5[r5]) && (i5.__ = n13, l10 = "function" == typeof i5.type ? $fb96b826c0c5f37a$var$x(i5, l10, u7) : $fb96b826c0c5f37a$var$P(u7, i5, i5, t5, i5.__e, l10));
|
1324
|
-
|
1325
1179
|
return l10;
|
1326
1180
|
}
|
1327
|
-
|
1328
1181
|
function $fb96b826c0c5f37a$export$47e4c5b300681277(n14, l11) {
|
1329
1182
|
return l11 = l11 || [], null == n14 || "boolean" == typeof n14 || (Array.isArray(n14) ? n14.some(function (n15) {
|
1330
1183
|
$fb96b826c0c5f37a$export$47e4c5b300681277(n15, l11);
|
1331
1184
|
}) : l11.push(n14)), l11;
|
1332
1185
|
}
|
1333
|
-
|
1334
1186
|
function $fb96b826c0c5f37a$var$P(n16, l12, u8, i6, t6, r6) {
|
1335
1187
|
var o5, f4, e1;
|
1336
1188
|
if (void 0 !== l12.__d) o5 = l12.__d, l12.__d = void 0;else if (null == u8 || t6 != r6 || null == t6.parentNode) n: if (null == r6 || r6.parentNode !== n16) n16.appendChild(t6), o5 = null;else {
|
1337
1189
|
for (f4 = r6, e1 = 0; (f4 = f4.nextSibling) && e1 < i6.length; e1 += 2) if (f4 == t6) break n;
|
1338
|
-
|
1339
1190
|
n16.insertBefore(t6, r6), o5 = r6;
|
1340
1191
|
}
|
1341
1192
|
return void 0 !== o5 ? o5 : t6.nextSibling;
|
1342
1193
|
}
|
1343
|
-
|
1344
1194
|
function $fb96b826c0c5f37a$var$C(n17, l13, u9, i7, t7) {
|
1345
1195
|
var r7;
|
1346
|
-
|
1347
1196
|
for (r7 in u9) "children" === r7 || "key" === r7 || r7 in l13 || $fb96b826c0c5f37a$var$H(n17, r7, null, u9[r7], i7);
|
1348
|
-
|
1349
1197
|
for (r7 in l13) t7 && "function" != typeof l13[r7] || "children" === r7 || "key" === r7 || "value" === r7 || "checked" === r7 || u9[r7] === l13[r7] || $fb96b826c0c5f37a$var$H(n17, r7, l13[r7], u9[r7], i7);
|
1350
1198
|
}
|
1351
|
-
|
1352
1199
|
function $fb96b826c0c5f37a$var$$(n18, l14, u10) {
|
1353
1200
|
"-" === l14[0] ? n18.setProperty(l14, u10) : n18[l14] = null == u10 ? "" : "number" != typeof u10 || $fb96b826c0c5f37a$var$s.test(l14) ? u10 : u10 + "px";
|
1354
1201
|
}
|
1355
|
-
|
1356
1202
|
function $fb96b826c0c5f37a$var$H(n19, l15, u11, i8, t8) {
|
1357
1203
|
var r8;
|
1358
|
-
|
1359
1204
|
n: if ("style" === l15) {
|
1360
1205
|
if ("string" == typeof u11) n19.style.cssText = u11;else {
|
1361
1206
|
if ("string" == typeof i8 && (n19.style.cssText = i8 = ""), i8) for (l15 in i8) u11 && l15 in u11 || $fb96b826c0c5f37a$var$$(n19.style, l15, "");
|
@@ -1369,31 +1214,27 @@ function $fb96b826c0c5f37a$var$H(n19, l15, u11, i8, t8) {
|
|
1369
1214
|
"function" == typeof u11 || (null != u11 && (!1 !== u11 || "a" === l15[0] && "r" === l15[1]) ? n19.setAttribute(l15, u11) : n19.removeAttribute(l15));
|
1370
1215
|
}
|
1371
1216
|
}
|
1372
|
-
|
1373
1217
|
function $fb96b826c0c5f37a$var$I(n20) {
|
1374
1218
|
this.l[n20.type + !1]($fb96b826c0c5f37a$export$41c562ebe57d11e2.event ? $fb96b826c0c5f37a$export$41c562ebe57d11e2.event(n20) : n20);
|
1375
1219
|
}
|
1376
|
-
|
1377
1220
|
function $fb96b826c0c5f37a$var$T(n21) {
|
1378
1221
|
this.l[n21.type + !0]($fb96b826c0c5f37a$export$41c562ebe57d11e2.event ? $fb96b826c0c5f37a$export$41c562ebe57d11e2.event(n21) : n21);
|
1379
1222
|
}
|
1380
|
-
|
1381
1223
|
function $fb96b826c0c5f37a$var$j(n22, u12, i9, t9, r9, o6, f5, e2, c1) {
|
1382
1224
|
var s2,
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1225
|
+
h2,
|
1226
|
+
v2,
|
1227
|
+
y1,
|
1228
|
+
p2,
|
1229
|
+
k1,
|
1230
|
+
b2,
|
1231
|
+
m2,
|
1232
|
+
g2,
|
1233
|
+
x1,
|
1234
|
+
A2,
|
1235
|
+
P1 = u12.type;
|
1394
1236
|
if (void 0 !== u12.constructor) return null;
|
1395
1237
|
null != i9.__h && (c1 = i9.__h, e2 = u12.__e = i9.__e, u12.__h = null, o6 = [e2]), (s2 = $fb96b826c0c5f37a$export$41c562ebe57d11e2.__b) && s2(u12);
|
1396
|
-
|
1397
1238
|
try {
|
1398
1239
|
n: if ("function" == typeof P1) {
|
1399
1240
|
if (m2 = u12.props, g2 = (s2 = P1.contextType) && t9[s2.__c], x1 = s2 ? g2 ? g2.props.value : s2.__ : t9, i9.__c ? b2 = (h2 = u12.__c = i9.__c).__ = h2.__E : ("prototype" in P1 && P1.prototype.render ? u12.__c = h2 = new P1(m2, x1) : (u12.__c = h2 = new $fb96b826c0c5f37a$export$16fa2f45be04daa8(m2, x1), h2.constructor = P1, h2.render = $fb96b826c0c5f37a$var$O), g2 && g2.sub(h2), h2.props = m2, h2.state || (h2.state = {}), h2.context = x1, h2.__n = t9, v2 = h2.__d = !0, h2.__h = []), null == h2.__s && (h2.__s = h2.state), null != P1.getDerivedStateFromProps && (h2.__s == h2.state && (h2.__s = $fb96b826c0c5f37a$var$a({}, h2.__s)), $fb96b826c0c5f37a$var$a(h2.__s, P1.getDerivedStateFromProps(m2, h2.__s))), y1 = h2.props, p2 = h2.state, v2) null == P1.getDerivedStateFromProps && null != h2.componentWillMount && h2.componentWillMount(), null != h2.componentDidMount && h2.__h.push(h2.componentDidMount);else {
|
@@ -1403,20 +1244,17 @@ function $fb96b826c0c5f37a$var$j(n22, u12, i9, t9, r9, o6, f5, e2, c1) {
|
|
1403
1244
|
}), h2.__h.length && f5.push(h2);
|
1404
1245
|
break n;
|
1405
1246
|
}
|
1406
|
-
|
1407
1247
|
null != h2.componentWillUpdate && h2.componentWillUpdate(m2, h2.__s, x1), null != h2.componentDidUpdate && h2.__h.push(function () {
|
1408
1248
|
h2.componentDidUpdate(y1, p2, k1);
|
1409
1249
|
});
|
1410
1250
|
}
|
1411
1251
|
h2.context = x1, h2.props = m2, h2.state = h2.__s, (s2 = $fb96b826c0c5f37a$export$41c562ebe57d11e2.__r) && s2(u12), h2.__d = !1, h2.__v = u12, h2.__P = n22, s2 = h2.render(h2.props, h2.state, h2.context), h2.state = h2.__s, null != h2.getChildContext && (t9 = $fb96b826c0c5f37a$var$a($fb96b826c0c5f37a$var$a({}, t9), h2.getChildContext())), v2 || null == h2.getSnapshotBeforeUpdate || (k1 = h2.getSnapshotBeforeUpdate(y1, p2)), A2 = null != s2 && s2.type === $fb96b826c0c5f37a$export$ffb0004e005737fa && null == s2.key ? s2.props.children : s2, $fb96b826c0c5f37a$var$w(n22, Array.isArray(A2) ? A2 : [A2], u12, i9, t9, r9, o6, f5, e2, c1), h2.base = u12.__e, u12.__h = null, h2.__h.length && f5.push(h2), b2 && (h2.__E = h2.__ = null), h2.__e = !1;
|
1412
1252
|
} else null == o6 && u12.__v === i9.__v ? (u12.__k = i9.__k, u12.__e = i9.__e) : u12.__e = $fb96b826c0c5f37a$var$L(i9.__e, u12, i9, t9, r9, o6, f5, c1);
|
1413
|
-
|
1414
1253
|
(s2 = $fb96b826c0c5f37a$export$41c562ebe57d11e2.diffed) && s2(u12);
|
1415
1254
|
} catch (n24) {
|
1416
1255
|
u12.__v = null, (c1 || null != o6) && (u12.__e = e2, u12.__h = !!c1, o6[o6.indexOf(e2)] = null), $fb96b826c0c5f37a$export$41c562ebe57d11e2.__e(n24, u12, i9);
|
1417
1256
|
}
|
1418
1257
|
}
|
1419
|
-
|
1420
1258
|
function $fb96b826c0c5f37a$var$z(n25, u13) {
|
1421
1259
|
$fb96b826c0c5f37a$export$41c562ebe57d11e2.__c && $fb96b826c0c5f37a$export$41c562ebe57d11e2.__c(u13, n25), n25.some(function (u14) {
|
1422
1260
|
try {
|
@@ -1428,40 +1266,34 @@ function $fb96b826c0c5f37a$var$z(n25, u13) {
|
|
1428
1266
|
}
|
1429
1267
|
});
|
1430
1268
|
}
|
1431
|
-
|
1432
1269
|
function $fb96b826c0c5f37a$var$L(l16, u15, i10, t10, r10, o7, f6, c2) {
|
1433
1270
|
var s3,
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1271
|
+
a2,
|
1272
|
+
v3,
|
1273
|
+
y2 = i10.props,
|
1274
|
+
p3 = u15.props,
|
1275
|
+
d1 = u15.type,
|
1276
|
+
_2 = 0;
|
1441
1277
|
if ("svg" === d1 && (r10 = !0), null != o7) {
|
1442
1278
|
for (; _2 < o7.length; _2++) if ((s3 = o7[_2]) && "setAttribute" in s3 == !!d1 && (d1 ? s3.localName === d1 : 3 === s3.nodeType)) {
|
1443
1279
|
l16 = s3, o7[_2] = null;
|
1444
1280
|
break;
|
1445
1281
|
}
|
1446
1282
|
}
|
1447
|
-
|
1448
1283
|
if (null == l16) {
|
1449
1284
|
if (null === d1) return document.createTextNode(p3);
|
1450
1285
|
l16 = r10 ? document.createElementNS("http://www.w3.org/2000/svg", d1) : document.createElement(d1, p3.is && p3), o7 = null, c2 = !1;
|
1451
1286
|
}
|
1452
|
-
|
1453
1287
|
if (null === d1) y2 === p3 || c2 && l16.data === p3 || (l16.data = p3);else {
|
1454
1288
|
if (o7 = o7 && $fb96b826c0c5f37a$var$n.call(l16.childNodes), a2 = (y2 = i10.props || $fb96b826c0c5f37a$var$e).dangerouslySetInnerHTML, v3 = p3.dangerouslySetInnerHTML, !c2) {
|
1455
1289
|
if (null != o7) for (y2 = {}, _2 = 0; _2 < l16.attributes.length; _2++) y2[l16.attributes[_2].name] = l16.attributes[_2].value;
|
1456
1290
|
(v3 || a2) && (v3 && (a2 && v3.__html == a2.__html || v3.__html === l16.innerHTML) || (l16.innerHTML = v3 && v3.__html || ""));
|
1457
1291
|
}
|
1458
|
-
|
1459
1292
|
if ($fb96b826c0c5f37a$var$C(l16, p3, y2, r10, c2), v3) u15.__k = [];else if (_2 = u15.props.children, $fb96b826c0c5f37a$var$w(l16, Array.isArray(_2) ? _2 : [_2], u15, i10, t10, r10 && "foreignObject" !== d1, o7, f6, o7 ? o7[0] : i10.__k && $fb96b826c0c5f37a$var$k(i10, 0), c2), null != o7) for (_2 = o7.length; _2--;) null != o7[_2] && $fb96b826c0c5f37a$var$h(o7[_2]);
|
1460
1293
|
c2 || ("value" in p3 && void 0 !== (_2 = p3.value) && (_2 !== y2.value || _2 !== l16.value || "progress" === d1 && !_2) && $fb96b826c0c5f37a$var$H(l16, "value", _2, y2.value, !1), "checked" in p3 && void 0 !== (_2 = p3.checked) && _2 !== l16.checked && $fb96b826c0c5f37a$var$H(l16, "checked", _2, y2.checked, !1));
|
1461
1294
|
}
|
1462
1295
|
return l16;
|
1463
1296
|
}
|
1464
|
-
|
1465
1297
|
function $fb96b826c0c5f37a$var$M(n28, u16, i11) {
|
1466
1298
|
try {
|
1467
1299
|
"function" == typeof n28 ? n28(u16) : n28.current = u16;
|
@@ -1469,10 +1301,8 @@ function $fb96b826c0c5f37a$var$M(n28, u16, i11) {
|
|
1469
1301
|
$fb96b826c0c5f37a$export$41c562ebe57d11e2.__e(n29, i11);
|
1470
1302
|
}
|
1471
1303
|
}
|
1472
|
-
|
1473
1304
|
function $fb96b826c0c5f37a$var$N(n30, u17, i12) {
|
1474
1305
|
var t11, r11;
|
1475
|
-
|
1476
1306
|
if ($fb96b826c0c5f37a$export$41c562ebe57d11e2.unmount && $fb96b826c0c5f37a$export$41c562ebe57d11e2.unmount(n30), (t11 = n30.ref) && (t11.current && t11.current !== n30.__e || $fb96b826c0c5f37a$var$M(t11, null, u17)), null != (t11 = n30.__c)) {
|
1477
1307
|
if (t11.componentWillUnmount) try {
|
1478
1308
|
t11.componentWillUnmount();
|
@@ -1481,20 +1311,16 @@ function $fb96b826c0c5f37a$var$N(n30, u17, i12) {
|
|
1481
1311
|
}
|
1482
1312
|
t11.base = t11.__P = null;
|
1483
1313
|
}
|
1484
|
-
|
1485
1314
|
if (t11 = n30.__k) for (r11 = 0; r11 < t11.length; r11++) t11[r11] && $fb96b826c0c5f37a$var$N(t11[r11], u17, "function" != typeof n30.type);
|
1486
1315
|
i12 || null == n30.__e || $fb96b826c0c5f37a$var$h(n30.__e), n30.__e = n30.__d = void 0;
|
1487
1316
|
}
|
1488
|
-
|
1489
1317
|
function $fb96b826c0c5f37a$var$O(n32, l, u18) {
|
1490
1318
|
return this.constructor(n32, u18);
|
1491
1319
|
}
|
1492
|
-
|
1493
1320
|
function $fb96b826c0c5f37a$export$b3890eb0ae9dca99(u19, i13, t12) {
|
1494
1321
|
var r12, o8, f7;
|
1495
1322
|
$fb96b826c0c5f37a$export$41c562ebe57d11e2.__ && $fb96b826c0c5f37a$export$41c562ebe57d11e2.__(u19, i13), o8 = (r12 = "function" == typeof t12) ? null : t12 && t12.__k || i13.__k, f7 = [], $fb96b826c0c5f37a$var$j(i13, u19 = (!r12 && t12 || i13).__k = $fb96b826c0c5f37a$export$c8a8987d4410bf2d($fb96b826c0c5f37a$export$ffb0004e005737fa, null, [u19]), o8 || $fb96b826c0c5f37a$var$e, $fb96b826c0c5f37a$var$e, void 0 !== i13.ownerSVGElement, !r12 && t12 ? [t12] : o8 ? null : i13.firstChild ? $fb96b826c0c5f37a$var$n.call(i13.childNodes) : null, f7, !r12 && t12 ? t12 : o8 ? o8.__e : i13.firstChild, r12), $fb96b826c0c5f37a$var$z(f7, u19);
|
1496
1323
|
}
|
1497
|
-
|
1498
1324
|
$fb96b826c0c5f37a$var$n = $fb96b826c0c5f37a$var$c.slice, $fb96b826c0c5f37a$export$41c562ebe57d11e2 = {
|
1499
1325
|
__e: function (n39, l22) {
|
1500
1326
|
for (var u23, i16, t14; l22 = l22.__;) if ((u23 = l22.__c) && !u23.__) try {
|
@@ -1502,7 +1328,6 @@ $fb96b826c0c5f37a$var$n = $fb96b826c0c5f37a$var$c.slice, $fb96b826c0c5f37a$expor
|
|
1502
1328
|
} catch (l23) {
|
1503
1329
|
n39 = l23;
|
1504
1330
|
}
|
1505
|
-
|
1506
1331
|
throw n39;
|
1507
1332
|
}
|
1508
1333
|
}, $fb96b826c0c5f37a$var$u = 0, $fb96b826c0c5f37a$export$16fa2f45be04daa8.prototype.setState = function (n41, l24) {
|
@@ -1512,14 +1337,11 @@ $fb96b826c0c5f37a$var$n = $fb96b826c0c5f37a$var$c.slice, $fb96b826c0c5f37a$expor
|
|
1512
1337
|
this.__v && (this.__e = !0, n42 && this.__h.push(n42), $fb96b826c0c5f37a$var$m(this));
|
1513
1338
|
}, $fb96b826c0c5f37a$export$16fa2f45be04daa8.prototype.render = $fb96b826c0c5f37a$export$ffb0004e005737fa, $fb96b826c0c5f37a$var$t = [], $fb96b826c0c5f37a$var$r = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, $fb96b826c0c5f37a$var$g.__r = 0;
|
1514
1339
|
var $bd9dd35321b03dd4$var$o = 0;
|
1515
|
-
|
1516
1340
|
function $bd9dd35321b03dd4$export$34b9dba7ce09269b(_1, e1, n, t, f) {
|
1517
1341
|
var l,
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1342
|
+
s,
|
1343
|
+
u = {};
|
1521
1344
|
for (s in e1) "ref" == s ? l = e1[s] : u[s] = e1[s];
|
1522
|
-
|
1523
1345
|
var a = {
|
1524
1346
|
type: _1,
|
1525
1347
|
props: u,
|
@@ -1540,20 +1362,17 @@ function $bd9dd35321b03dd4$export$34b9dba7ce09269b(_1, e1, n, t, f) {
|
|
1540
1362
|
if ("function" == typeof _1 && (l = _1.defaultProps)) for (s in l) void 0 === u[s] && (u[s] = l[s]);
|
1541
1363
|
return ($fb96b826c0c5f37a$export$41c562ebe57d11e2).vnode && ($fb96b826c0c5f37a$export$41c562ebe57d11e2).vnode(a), a;
|
1542
1364
|
}
|
1543
|
-
|
1544
1365
|
function $f72b75cf796873c7$var$set(key, value) {
|
1545
1366
|
try {
|
1546
1367
|
window.localStorage[`emoji-mart.${key}`] = JSON.stringify(value);
|
1547
1368
|
} catch (error) {}
|
1548
1369
|
}
|
1549
|
-
|
1550
1370
|
function $f72b75cf796873c7$var$get(key) {
|
1551
1371
|
try {
|
1552
1372
|
const value = window.localStorage[`emoji-mart.${key}`];
|
1553
1373
|
if (value) return JSON.parse(value);
|
1554
1374
|
} catch (error) {}
|
1555
1375
|
}
|
1556
|
-
|
1557
1376
|
var $f72b75cf796873c7$export$2e2bcd8739ae039 = {
|
1558
1377
|
set: $f72b75cf796873c7$var$set,
|
1559
1378
|
get: $f72b75cf796873c7$var$get
|
@@ -1593,7 +1412,6 @@ const $c84d045dcc34faf5$var$VERSIONS = [{
|
|
1593
1412
|
v: 1,
|
1594
1413
|
emoji: "\uD83D\uDE43"
|
1595
1414
|
}];
|
1596
|
-
|
1597
1415
|
function $c84d045dcc34faf5$var$latestVersion() {
|
1598
1416
|
for (const {
|
1599
1417
|
v: v,
|
@@ -1602,76 +1420,68 @@ function $c84d045dcc34faf5$var$latestVersion() {
|
|
1602
1420
|
if ($c84d045dcc34faf5$var$isSupported(emoji)) return v;
|
1603
1421
|
}
|
1604
1422
|
}
|
1605
|
-
|
1606
1423
|
function $c84d045dcc34faf5$var$noCountryFlags() {
|
1607
1424
|
if ($c84d045dcc34faf5$var$isSupported("\uD83C\uDDE8\uD83C\uDDE6")) return false;
|
1608
1425
|
return true;
|
1609
1426
|
}
|
1610
|
-
|
1611
1427
|
function $c84d045dcc34faf5$var$isSupported(emoji) {
|
1612
1428
|
if ($c84d045dcc34faf5$var$CACHE.has(emoji)) return $c84d045dcc34faf5$var$CACHE.get(emoji);
|
1613
1429
|
const supported = $c84d045dcc34faf5$var$isEmojiSupported(emoji);
|
1614
1430
|
$c84d045dcc34faf5$var$CACHE.set(emoji, supported);
|
1615
1431
|
return supported;
|
1616
|
-
}
|
1617
|
-
|
1618
|
-
|
1432
|
+
}
|
1433
|
+
// https://github.com/koala-interactive/is-emoji-supported
|
1619
1434
|
const $c84d045dcc34faf5$var$isEmojiSupported = (() => {
|
1620
1435
|
let ctx = null;
|
1621
|
-
|
1622
1436
|
try {
|
1623
1437
|
if (!navigator.userAgent.includes("jsdom")) ctx = document.createElement("canvas").getContext("2d", {
|
1624
1438
|
willReadFrequently: true
|
1625
1439
|
});
|
1626
|
-
} catch {}
|
1627
|
-
|
1628
|
-
|
1440
|
+
} catch {}
|
1441
|
+
// Not in browser env
|
1629
1442
|
if (!ctx) return () => false;
|
1630
1443
|
const CANVAS_HEIGHT = 25;
|
1631
1444
|
const CANVAS_WIDTH = 20;
|
1632
|
-
const textSize = Math.floor(CANVAS_HEIGHT / 2);
|
1633
|
-
|
1445
|
+
const textSize = Math.floor(CANVAS_HEIGHT / 2);
|
1446
|
+
// Initialize convas context
|
1634
1447
|
ctx.font = textSize + "px Arial, Sans-Serif";
|
1635
1448
|
ctx.textBaseline = "top";
|
1636
1449
|
ctx.canvas.width = CANVAS_WIDTH * 2;
|
1637
1450
|
ctx.canvas.height = CANVAS_HEIGHT;
|
1638
1451
|
return unicode => {
|
1639
|
-
ctx.clearRect(0, 0, CANVAS_WIDTH * 2, CANVAS_HEIGHT);
|
1640
|
-
|
1452
|
+
ctx.clearRect(0, 0, CANVAS_WIDTH * 2, CANVAS_HEIGHT);
|
1453
|
+
// Draw in red on the left
|
1641
1454
|
ctx.fillStyle = "#FF0000";
|
1642
|
-
ctx.fillText(unicode, 0, 22);
|
1643
|
-
|
1455
|
+
ctx.fillText(unicode, 0, 22);
|
1456
|
+
// Draw in blue on right
|
1644
1457
|
ctx.fillStyle = "#0000FF";
|
1645
1458
|
ctx.fillText(unicode, CANVAS_WIDTH, 22);
|
1646
1459
|
const a = ctx.getImageData(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT).data;
|
1647
1460
|
const count = a.length;
|
1648
|
-
let i = 0;
|
1649
|
-
|
1650
|
-
for (; i < count && !a[i + 3]; i += 4);
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1461
|
+
let i = 0;
|
1462
|
+
// Search the first visible pixel
|
1463
|
+
for (; i < count && !a[i + 3]; i += 4);
|
1464
|
+
// No visible pixel
|
1465
|
+
if (i >= count) return false;
|
1466
|
+
// Emoji has immutable color, so we check the color of the emoji in two different colors
|
1654
1467
|
// the result show be the same.
|
1655
|
-
|
1656
1468
|
const x = CANVAS_WIDTH + i / 4 % CANVAS_WIDTH;
|
1657
1469
|
const y = Math.floor(i / 4 / CANVAS_WIDTH);
|
1658
1470
|
const b = ctx.getImageData(x, y, 1, 1).data;
|
1659
|
-
if (a[i] !== b[0] || a[i + 2] !== b[2]) return false;
|
1471
|
+
if (a[i] !== b[0] || a[i + 2] !== b[2]) return false;
|
1472
|
+
// Some emojis are a contraction of different ones, so if it's not
|
1660
1473
|
// supported, it will show multiple characters
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1474
|
+
if (ctx.measureText(unicode).width >= CANVAS_WIDTH) return false;
|
1475
|
+
// Supported
|
1664
1476
|
return true;
|
1665
1477
|
};
|
1666
1478
|
})();
|
1667
|
-
|
1668
1479
|
var $c84d045dcc34faf5$export$2e2bcd8739ae039 = {
|
1669
1480
|
latestVersion: $c84d045dcc34faf5$var$latestVersion,
|
1670
1481
|
noCountryFlags: $c84d045dcc34faf5$var$noCountryFlags
|
1671
1482
|
};
|
1672
1483
|
const $b22cfd0a55410b4f$var$DEFAULTS = ["+1", "grinning", "kissing_heart", "heart_eyes", "laughing", "stuck_out_tongue_winking_eye", "sweat_smile", "joy", "scream", "disappointed", "unamused", "weary", "sob", "sunglasses", "heart"];
|
1673
1484
|
let $b22cfd0a55410b4f$var$Index = null;
|
1674
|
-
|
1675
1485
|
function $b22cfd0a55410b4f$var$add(emoji) {
|
1676
1486
|
$b22cfd0a55410b4f$var$Index || ($b22cfd0a55410b4f$var$Index = ($f72b75cf796873c7$export$2e2bcd8739ae039).get("frequently") || {});
|
1677
1487
|
const emojiId = emoji.id || emoji;
|
@@ -1681,7 +1491,6 @@ function $b22cfd0a55410b4f$var$add(emoji) {
|
|
1681
1491
|
($f72b75cf796873c7$export$2e2bcd8739ae039).set("last", emojiId);
|
1682
1492
|
($f72b75cf796873c7$export$2e2bcd8739ae039).set("frequently", $b22cfd0a55410b4f$var$Index);
|
1683
1493
|
}
|
1684
|
-
|
1685
1494
|
function $b22cfd0a55410b4f$var$get({
|
1686
1495
|
maxFrequentRows: maxFrequentRows,
|
1687
1496
|
perLine: perLine
|
@@ -1689,51 +1498,39 @@ function $b22cfd0a55410b4f$var$get({
|
|
1689
1498
|
if (!maxFrequentRows) return [];
|
1690
1499
|
$b22cfd0a55410b4f$var$Index || ($b22cfd0a55410b4f$var$Index = ($f72b75cf796873c7$export$2e2bcd8739ae039).get("frequently"));
|
1691
1500
|
let emojiIds = [];
|
1692
|
-
|
1693
1501
|
if (!$b22cfd0a55410b4f$var$Index) {
|
1694
1502
|
$b22cfd0a55410b4f$var$Index = {};
|
1695
|
-
|
1696
1503
|
for (let i in $b22cfd0a55410b4f$var$DEFAULTS.slice(0, perLine)) {
|
1697
1504
|
const emojiId = $b22cfd0a55410b4f$var$DEFAULTS[i];
|
1698
1505
|
$b22cfd0a55410b4f$var$Index[emojiId] = perLine - i;
|
1699
1506
|
emojiIds.push(emojiId);
|
1700
1507
|
}
|
1701
|
-
|
1702
1508
|
return emojiIds;
|
1703
1509
|
}
|
1704
|
-
|
1705
1510
|
const max = maxFrequentRows * perLine;
|
1706
1511
|
const last = ($f72b75cf796873c7$export$2e2bcd8739ae039).get("last");
|
1707
|
-
|
1708
1512
|
for (let emojiId in $b22cfd0a55410b4f$var$Index) emojiIds.push(emojiId);
|
1709
|
-
|
1710
1513
|
emojiIds.sort((a, b) => {
|
1711
1514
|
const aScore = $b22cfd0a55410b4f$var$Index[b];
|
1712
1515
|
const bScore = $b22cfd0a55410b4f$var$Index[a];
|
1713
1516
|
if (aScore == bScore) return a.localeCompare(b);
|
1714
1517
|
return aScore - bScore;
|
1715
1518
|
});
|
1716
|
-
|
1717
1519
|
if (emojiIds.length > max) {
|
1718
1520
|
const removedIds = emojiIds.slice(max);
|
1719
1521
|
emojiIds = emojiIds.slice(0, max);
|
1720
|
-
|
1721
1522
|
for (let removedId of removedIds) {
|
1722
1523
|
if (removedId == last) continue;
|
1723
1524
|
delete $b22cfd0a55410b4f$var$Index[removedId];
|
1724
1525
|
}
|
1725
|
-
|
1726
1526
|
if (last && emojiIds.indexOf(last) == -1) {
|
1727
1527
|
delete $b22cfd0a55410b4f$var$Index[emojiIds[emojiIds.length - 1]];
|
1728
1528
|
emojiIds.splice(-1, 1, last);
|
1729
1529
|
}
|
1730
|
-
|
1731
1530
|
($f72b75cf796873c7$export$2e2bcd8739ae039).set("frequently", $b22cfd0a55410b4f$var$Index);
|
1732
1531
|
}
|
1733
|
-
|
1734
1532
|
return emojiIds;
|
1735
1533
|
}
|
1736
|
-
|
1737
1534
|
var $b22cfd0a55410b4f$export$2e2bcd8739ae039 = {
|
1738
1535
|
add: $b22cfd0a55410b4f$var$add,
|
1739
1536
|
get: $b22cfd0a55410b4f$var$get,
|
@@ -1839,7 +1636,6 @@ var $b247ea80b67298d5$export$2e2bcd8739ae039 = {
|
|
1839
1636
|
let $7adb23b0109cc36a$export$dbe3113d60765c1a = null;
|
1840
1637
|
let $7adb23b0109cc36a$export$2d0294657ab35f1b = null;
|
1841
1638
|
const $7adb23b0109cc36a$var$fetchCache = {};
|
1842
|
-
|
1843
1639
|
async function $7adb23b0109cc36a$var$fetchJSON(src) {
|
1844
1640
|
if ($7adb23b0109cc36a$var$fetchCache[src]) return $7adb23b0109cc36a$var$fetchCache[src];
|
1845
1641
|
const response = await fetch(src);
|
@@ -1847,11 +1643,9 @@ async function $7adb23b0109cc36a$var$fetchJSON(src) {
|
|
1847
1643
|
$7adb23b0109cc36a$var$fetchCache[src] = json;
|
1848
1644
|
return json;
|
1849
1645
|
}
|
1850
|
-
|
1851
1646
|
let $7adb23b0109cc36a$var$promise = null;
|
1852
1647
|
let $7adb23b0109cc36a$var$initCallback = null;
|
1853
1648
|
let $7adb23b0109cc36a$var$initialized = false;
|
1854
|
-
|
1855
1649
|
function $7adb23b0109cc36a$export$2cd8252107eb640b(options, {
|
1856
1650
|
caller: caller
|
1857
1651
|
} = {}) {
|
@@ -1861,7 +1655,6 @@ function $7adb23b0109cc36a$export$2cd8252107eb640b(options, {
|
|
1861
1655
|
if (options) $7adb23b0109cc36a$var$_init(options);else if (caller && !$7adb23b0109cc36a$var$initialized) console.warn(`\`${caller}\` requires data to be initialized first. Promise will be pending until \`init\` is called.`);
|
1862
1656
|
return $7adb23b0109cc36a$var$promise;
|
1863
1657
|
}
|
1864
|
-
|
1865
1658
|
async function $7adb23b0109cc36a$var$_init(props) {
|
1866
1659
|
$7adb23b0109cc36a$var$initialized = true;
|
1867
1660
|
let {
|
@@ -1872,7 +1665,6 @@ async function $7adb23b0109cc36a$var$_init(props) {
|
|
1872
1665
|
emojiVersion || (emojiVersion = ($b247ea80b67298d5$export$2e2bcd8739ae039).emojiVersion.value);
|
1873
1666
|
set || (set = ($b247ea80b67298d5$export$2e2bcd8739ae039).set.value);
|
1874
1667
|
locale || (locale = ($b247ea80b67298d5$export$2e2bcd8739ae039).locale.value);
|
1875
|
-
|
1876
1668
|
if (!$7adb23b0109cc36a$export$2d0294657ab35f1b) {
|
1877
1669
|
$7adb23b0109cc36a$export$2d0294657ab35f1b = (typeof props.data === "function" ? await props.data() : props.data) || (await $7adb23b0109cc36a$var$fetchJSON(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/sets/${emojiVersion}/${set}.json`));
|
1878
1670
|
$7adb23b0109cc36a$export$2d0294657ab35f1b.emoticons = {};
|
@@ -1881,7 +1673,6 @@ async function $7adb23b0109cc36a$var$_init(props) {
|
|
1881
1673
|
id: "frequent",
|
1882
1674
|
emojis: []
|
1883
1675
|
});
|
1884
|
-
|
1885
1676
|
for (const alias in $7adb23b0109cc36a$export$2d0294657ab35f1b.aliases) {
|
1886
1677
|
const emojiId = $7adb23b0109cc36a$export$2d0294657ab35f1b.aliases[alias];
|
1887
1678
|
const emoji = $7adb23b0109cc36a$export$2d0294657ab35f1b.emojis[emojiId];
|
@@ -1889,14 +1680,12 @@ async function $7adb23b0109cc36a$var$_init(props) {
|
|
1889
1680
|
emoji.aliases || (emoji.aliases = []);
|
1890
1681
|
emoji.aliases.push(alias);
|
1891
1682
|
}
|
1892
|
-
|
1893
1683
|
$7adb23b0109cc36a$export$2d0294657ab35f1b.originalCategories = $7adb23b0109cc36a$export$2d0294657ab35f1b.categories;
|
1894
1684
|
} else $7adb23b0109cc36a$export$2d0294657ab35f1b.categories = $7adb23b0109cc36a$export$2d0294657ab35f1b.categories.filter(c => {
|
1895
1685
|
const isCustom = !!c.name;
|
1896
1686
|
if (!isCustom) return true;
|
1897
1687
|
return false;
|
1898
1688
|
});
|
1899
|
-
|
1900
1689
|
$7adb23b0109cc36a$export$dbe3113d60765c1a = (typeof props.i18n === "function" ? await props.i18n() : props.i18n) || (locale == "en" ? (/*@__PURE__*/$parcel$interopDefault($8d50d93417ef682a$exports)) : await $7adb23b0109cc36a$var$fetchJSON(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/i18n/${locale}.json`));
|
1901
1690
|
if (props.custom) for (let i in props.custom) {
|
1902
1691
|
i = parseInt(i);
|
@@ -1907,7 +1696,6 @@ async function $7adb23b0109cc36a$var$_init(props) {
|
|
1907
1696
|
category.name || (category.name = $7adb23b0109cc36a$export$dbe3113d60765c1a.categories.custom);
|
1908
1697
|
if (prevCategory && !category.icon) category.target = prevCategory.target || prevCategory;
|
1909
1698
|
$7adb23b0109cc36a$export$2d0294657ab35f1b.categories.push(category);
|
1910
|
-
|
1911
1699
|
for (const emoji of category.emojis) $7adb23b0109cc36a$export$2d0294657ab35f1b.emojis[emoji.id] = emoji;
|
1912
1700
|
}
|
1913
1701
|
if (props.categories) $7adb23b0109cc36a$export$2d0294657ab35f1b.categories = $7adb23b0109cc36a$export$2d0294657ab35f1b.originalCategories.filter(c => {
|
@@ -1919,18 +1707,14 @@ async function $7adb23b0109cc36a$var$_init(props) {
|
|
1919
1707
|
});
|
1920
1708
|
let latestVersionSupport = null;
|
1921
1709
|
let noCountryFlags = null;
|
1922
|
-
|
1923
1710
|
if (set == "native") {
|
1924
1711
|
latestVersionSupport = ($c84d045dcc34faf5$export$2e2bcd8739ae039).latestVersion();
|
1925
1712
|
noCountryFlags = props.noCountryFlags || ($c84d045dcc34faf5$export$2e2bcd8739ae039).noCountryFlags();
|
1926
1713
|
}
|
1927
|
-
|
1928
1714
|
let categoryIndex = $7adb23b0109cc36a$export$2d0294657ab35f1b.categories.length;
|
1929
1715
|
let resetSearchIndex = false;
|
1930
|
-
|
1931
1716
|
while (categoryIndex--) {
|
1932
1717
|
const category = $7adb23b0109cc36a$export$2d0294657ab35f1b.categories[categoryIndex];
|
1933
|
-
|
1934
1718
|
if (category.id == "frequent") {
|
1935
1719
|
let {
|
1936
1720
|
maxFrequentRows: maxFrequentRows,
|
@@ -1943,48 +1727,38 @@ async function $7adb23b0109cc36a$var$_init(props) {
|
|
1943
1727
|
perLine: perLine
|
1944
1728
|
});
|
1945
1729
|
}
|
1946
|
-
|
1947
1730
|
if (!category.emojis || !category.emojis.length) {
|
1948
1731
|
$7adb23b0109cc36a$export$2d0294657ab35f1b.categories.splice(categoryIndex, 1);
|
1949
1732
|
continue;
|
1950
1733
|
}
|
1951
|
-
|
1952
1734
|
const {
|
1953
1735
|
categoryIcons: categoryIcons
|
1954
1736
|
} = props;
|
1955
|
-
|
1956
1737
|
if (categoryIcons) {
|
1957
1738
|
const icon = categoryIcons[category.id];
|
1958
1739
|
if (icon && !category.icon) category.icon = icon;
|
1959
1740
|
}
|
1960
|
-
|
1961
1741
|
let emojiIndex = category.emojis.length;
|
1962
|
-
|
1963
1742
|
while (emojiIndex--) {
|
1964
1743
|
const emojiId = category.emojis[emojiIndex];
|
1965
1744
|
const emoji = emojiId.id ? emojiId : $7adb23b0109cc36a$export$2d0294657ab35f1b.emojis[emojiId];
|
1966
|
-
|
1967
1745
|
const ignore = () => {
|
1968
1746
|
category.emojis.splice(emojiIndex, 1);
|
1969
1747
|
};
|
1970
|
-
|
1971
1748
|
if (!emoji || props.exceptEmojis && props.exceptEmojis.includes(emoji.id)) {
|
1972
1749
|
ignore();
|
1973
1750
|
continue;
|
1974
1751
|
}
|
1975
|
-
|
1976
1752
|
if (latestVersionSupport && emoji.version > latestVersionSupport) {
|
1977
1753
|
ignore();
|
1978
1754
|
continue;
|
1979
1755
|
}
|
1980
|
-
|
1981
1756
|
if (noCountryFlags && category.id == "flags") {
|
1982
1757
|
if (!($e6eae5155b87f591$export$bcb25aa587e9cb13).includes(emoji.id)) {
|
1983
1758
|
ignore();
|
1984
1759
|
continue;
|
1985
1760
|
}
|
1986
1761
|
}
|
1987
|
-
|
1988
1762
|
if (!emoji.search) {
|
1989
1763
|
resetSearchIndex = true;
|
1990
1764
|
emoji.search = "," + [[emoji.id, false], [emoji.name, true], [emoji.keywords, false], [emoji.emoticons, false]].map(([strings, split]) => {
|
@@ -1998,65 +1772,51 @@ async function $7adb23b0109cc36a$var$_init(props) {
|
|
1998
1772
|
$7adb23b0109cc36a$export$2d0294657ab35f1b.emoticons[emoticon] = emoji.id;
|
1999
1773
|
}
|
2000
1774
|
let skinIndex = 0;
|
2001
|
-
|
2002
1775
|
for (const skin of emoji.skins) {
|
2003
1776
|
if (!skin) continue;
|
2004
1777
|
skinIndex++;
|
2005
1778
|
const {
|
2006
1779
|
native: native
|
2007
1780
|
} = skin;
|
2008
|
-
|
2009
1781
|
if (native) {
|
2010
1782
|
$7adb23b0109cc36a$export$2d0294657ab35f1b.natives[native] = emoji.id;
|
2011
1783
|
emoji.search += `,${native}`;
|
2012
1784
|
}
|
2013
|
-
|
2014
1785
|
const skinShortcodes = skinIndex == 1 ? "" : `:skin-tone-${skinIndex}:`;
|
2015
1786
|
skin.shortcodes = `:${emoji.id}:${skinShortcodes}`;
|
2016
1787
|
}
|
2017
1788
|
}
|
2018
1789
|
}
|
2019
1790
|
}
|
2020
|
-
|
2021
1791
|
if (resetSearchIndex) ($c4d155af13ad4d4b$export$2e2bcd8739ae039).reset();
|
2022
1792
|
$7adb23b0109cc36a$var$initCallback();
|
2023
1793
|
}
|
2024
|
-
|
2025
1794
|
function $7adb23b0109cc36a$export$75fe5f91d452f94b(props, defaultProps, element) {
|
2026
1795
|
props || (props = {});
|
2027
1796
|
const _props = {};
|
2028
|
-
|
2029
1797
|
for (let k in defaultProps) _props[k] = $7adb23b0109cc36a$export$88c9ddb45cea7241(k, props, defaultProps, element);
|
2030
|
-
|
2031
1798
|
return _props;
|
2032
1799
|
}
|
2033
|
-
|
2034
1800
|
function $7adb23b0109cc36a$export$88c9ddb45cea7241(propName, props, defaultProps, element) {
|
2035
1801
|
const defaults = defaultProps[propName];
|
2036
1802
|
let value = element && element.getAttribute(propName) || (props[propName] != null && props[propName] != undefined ? props[propName] : null);
|
2037
1803
|
if (!defaults) return value;
|
2038
|
-
|
2039
1804
|
if (value != null && defaults.value && typeof defaults.value != typeof value) {
|
2040
1805
|
if (typeof defaults.value == "boolean") value = value == "false" ? false : true;else value = defaults.value.constructor(value);
|
2041
1806
|
}
|
2042
|
-
|
2043
1807
|
if (defaults.transform && value) value = defaults.transform(value);
|
2044
1808
|
if (value == null || defaults.choices && defaults.choices.indexOf(value) == -1) value = defaults.value;
|
2045
1809
|
return value;
|
2046
1810
|
}
|
2047
|
-
|
2048
1811
|
const $c4d155af13ad4d4b$var$SHORTCODES_REGEX = /^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/;
|
2049
1812
|
let $c4d155af13ad4d4b$var$Pool = null;
|
2050
|
-
|
2051
1813
|
function $c4d155af13ad4d4b$var$get(emojiId) {
|
2052
1814
|
if (emojiId.id) return emojiId;
|
2053
1815
|
return ($7adb23b0109cc36a$export$2d0294657ab35f1b).emojis[emojiId] || ($7adb23b0109cc36a$export$2d0294657ab35f1b).emojis[($7adb23b0109cc36a$export$2d0294657ab35f1b).aliases[emojiId]] || ($7adb23b0109cc36a$export$2d0294657ab35f1b).emojis[($7adb23b0109cc36a$export$2d0294657ab35f1b).natives[emojiId]];
|
2054
1816
|
}
|
2055
|
-
|
2056
1817
|
function $c4d155af13ad4d4b$var$reset() {
|
2057
1818
|
$c4d155af13ad4d4b$var$Pool = null;
|
2058
1819
|
}
|
2059
|
-
|
2060
1820
|
async function $c4d155af13ad4d4b$var$search(value, {
|
2061
1821
|
maxResults: maxResults,
|
2062
1822
|
caller: caller
|
@@ -2072,12 +1832,10 @@ async function $c4d155af13ad4d4b$var$search(value, {
|
|
2072
1832
|
if (!values.length) return;
|
2073
1833
|
let pool = $c4d155af13ad4d4b$var$Pool || ($c4d155af13ad4d4b$var$Pool = Object.values(($7adb23b0109cc36a$export$2d0294657ab35f1b).emojis));
|
2074
1834
|
let results, scores;
|
2075
|
-
|
2076
1835
|
for (const value1 of values) {
|
2077
1836
|
if (!pool.length) break;
|
2078
1837
|
results = [];
|
2079
1838
|
scores = {};
|
2080
|
-
|
2081
1839
|
for (const emoji of pool) {
|
2082
1840
|
if (!emoji.search) continue;
|
2083
1841
|
const score = emoji.search.indexOf(`,${value1}`);
|
@@ -2086,10 +1844,8 @@ async function $c4d155af13ad4d4b$var$search(value, {
|
|
2086
1844
|
scores[emoji.id] || (scores[emoji.id] = 0);
|
2087
1845
|
scores[emoji.id] += emoji.id == value1 ? 0 : score + 1;
|
2088
1846
|
}
|
2089
|
-
|
2090
1847
|
pool = results;
|
2091
1848
|
}
|
2092
|
-
|
2093
1849
|
if (results.length < 2) return results;
|
2094
1850
|
results.sort((a, b) => {
|
2095
1851
|
const aScore = scores[a.id];
|
@@ -2100,7 +1856,6 @@ async function $c4d155af13ad4d4b$var$search(value, {
|
|
2100
1856
|
if (results.length > maxResults) results = results.slice(0, maxResults);
|
2101
1857
|
return results;
|
2102
1858
|
}
|
2103
|
-
|
2104
1859
|
var $c4d155af13ad4d4b$export$2e2bcd8739ae039 = {
|
2105
1860
|
search: $c4d155af13ad4d4b$var$search,
|
2106
1861
|
get: $c4d155af13ad4d4b$var$get,
|
@@ -2108,15 +1863,12 @@ var $c4d155af13ad4d4b$export$2e2bcd8739ae039 = {
|
|
2108
1863
|
SHORTCODES_REGEX: $c4d155af13ad4d4b$var$SHORTCODES_REGEX
|
2109
1864
|
};
|
2110
1865
|
const $e6eae5155b87f591$export$bcb25aa587e9cb13 = ["checkered_flag", "crossed_flags", "pirate_flag", "rainbow-flag", "transgender_flag", "triangular_flag_on_post", "waving_black_flag", "waving_white_flag"];
|
2111
|
-
|
2112
1866
|
function $693b183b0a78708f$export$9cb4719e2e525b7a(a, b) {
|
2113
1867
|
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((val, index) => val == b[index]);
|
2114
1868
|
}
|
2115
|
-
|
2116
1869
|
async function $693b183b0a78708f$export$e772c8ff12451969(frames = 1) {
|
2117
1870
|
for (let _ in [...Array(frames).keys()]) await new Promise(requestAnimationFrame);
|
2118
1871
|
}
|
2119
|
-
|
2120
1872
|
function $693b183b0a78708f$export$d10ac59fbe52a745(emoji, {
|
2121
1873
|
skinIndex = 0
|
2122
1874
|
} = {}) {
|
@@ -2124,7 +1876,6 @@ function $693b183b0a78708f$export$d10ac59fbe52a745(emoji, {
|
|
2124
1876
|
skinIndex = 0;
|
2125
1877
|
return emoji.skins[skinIndex];
|
2126
1878
|
})();
|
2127
|
-
|
2128
1879
|
const emojiData = {
|
2129
1880
|
id: emoji.id,
|
2130
1881
|
name: emoji.name,
|
@@ -2139,7 +1890,6 @@ function $693b183b0a78708f$export$d10ac59fbe52a745(emoji, {
|
|
2139
1890
|
if (emoji.emoticons && emoji.emoticons.length) emojiData.emoticons = emoji.emoticons;
|
2140
1891
|
return emojiData;
|
2141
1892
|
}
|
2142
|
-
|
2143
1893
|
const $fcccfb36ed0cde68$var$categories = {
|
2144
1894
|
activity: {
|
2145
1895
|
outline: /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)("svg", {
|
@@ -2323,23 +2073,19 @@ var $fcccfb36ed0cde68$export$2e2bcd8739ae039 = {
|
|
2323
2073
|
categories: $fcccfb36ed0cde68$var$categories,
|
2324
2074
|
search: $fcccfb36ed0cde68$var$search
|
2325
2075
|
};
|
2326
|
-
|
2327
2076
|
function $254755d3f438722f$export$2e2bcd8739ae039(props) {
|
2328
2077
|
let {
|
2329
2078
|
id: id,
|
2330
2079
|
skin: skin,
|
2331
2080
|
emoji: emoji
|
2332
2081
|
} = props;
|
2333
|
-
|
2334
2082
|
if (props.shortcodes) {
|
2335
2083
|
const matches = props.shortcodes.match(($c4d155af13ad4d4b$export$2e2bcd8739ae039).SHORTCODES_REGEX);
|
2336
|
-
|
2337
2084
|
if (matches) {
|
2338
2085
|
id = matches[1];
|
2339
2086
|
if (matches[2]) skin = matches[2];
|
2340
2087
|
}
|
2341
2088
|
}
|
2342
|
-
|
2343
2089
|
emoji || (emoji = ($c4d155af13ad4d4b$export$2e2bcd8739ae039).get(id || props.native));
|
2344
2090
|
if (!emoji) return props.fallback;
|
2345
2091
|
const emojiSkin = emoji.skins[skin - 1] || emoji.skins[0];
|
@@ -2374,18 +2120,14 @@ function $254755d3f438722f$export$2e2bcd8739ae039(props) {
|
|
2374
2120
|
})
|
2375
2121
|
});
|
2376
2122
|
}
|
2377
|
-
|
2378
2123
|
const $6f57cc9cd54c5aaa$var$WindowHTMLElement = typeof window !== "undefined" && window.HTMLElement ? window.HTMLElement : Object;
|
2379
|
-
|
2380
2124
|
class $6f57cc9cd54c5aaa$export$2e2bcd8739ae039 extends $6f57cc9cd54c5aaa$var$WindowHTMLElement {
|
2381
2125
|
static get observedAttributes() {
|
2382
2126
|
return Object.keys(this.Props);
|
2383
2127
|
}
|
2384
|
-
|
2385
2128
|
update(props = {}) {
|
2386
2129
|
for (let k in props) this.attributeChangedCallback(k, null, props[k]);
|
2387
2130
|
}
|
2388
|
-
|
2389
2131
|
attributeChangedCallback(attr, _, newValue) {
|
2390
2132
|
if (!this.component) return;
|
2391
2133
|
const value = ($7adb23b0109cc36a$export$88c9ddb45cea7241)(attr, {
|
@@ -2398,16 +2140,13 @@ class $6f57cc9cd54c5aaa$export$2e2bcd8739ae039 extends $6f57cc9cd54c5aaa$var$Win
|
|
2398
2140
|
this.component.forceUpdate();
|
2399
2141
|
}
|
2400
2142
|
}
|
2401
|
-
|
2402
2143
|
disconnectedCallback() {
|
2403
2144
|
this.disconnected = true;
|
2404
2145
|
if (this.component && this.component.unregister) this.component.unregister();
|
2405
2146
|
}
|
2406
|
-
|
2407
2147
|
constructor(props = {}) {
|
2408
2148
|
super();
|
2409
2149
|
this.props = props;
|
2410
|
-
|
2411
2150
|
if (props.parent || props.ref) {
|
2412
2151
|
let ref = null;
|
2413
2152
|
const parent = props.parent || (ref = props.ref && props.ref.current);
|
@@ -2415,23 +2154,19 @@ class $6f57cc9cd54c5aaa$export$2e2bcd8739ae039 extends $6f57cc9cd54c5aaa$var$Win
|
|
2415
2154
|
if (parent) parent.appendChild(this);
|
2416
2155
|
}
|
2417
2156
|
}
|
2418
|
-
|
2419
2157
|
}
|
2420
|
-
|
2421
2158
|
class $26f27c338a96b1a6$export$2e2bcd8739ae039 extends ($6f57cc9cd54c5aaa$export$2e2bcd8739ae039) {
|
2422
2159
|
setShadow() {
|
2423
2160
|
this.attachShadow({
|
2424
2161
|
mode: "open"
|
2425
2162
|
});
|
2426
2163
|
}
|
2427
|
-
|
2428
2164
|
injectStyles(styles) {
|
2429
2165
|
if (!styles) return;
|
2430
2166
|
const style = document.createElement("style");
|
2431
2167
|
style.textContent = styles;
|
2432
2168
|
this.shadowRoot.insertBefore(style, this.shadowRoot.firstChild);
|
2433
2169
|
}
|
2434
|
-
|
2435
2170
|
constructor(props, {
|
2436
2171
|
styles: styles
|
2437
2172
|
} = {}) {
|
@@ -2439,9 +2174,7 @@ class $26f27c338a96b1a6$export$2e2bcd8739ae039 extends ($6f57cc9cd54c5aaa$export
|
|
2439
2174
|
this.setShadow();
|
2440
2175
|
this.injectStyles(styles);
|
2441
2176
|
}
|
2442
|
-
|
2443
2177
|
}
|
2444
|
-
|
2445
2178
|
var $3d90f6e46fb2dd47$export$2e2bcd8739ae039 = {
|
2446
2179
|
fallback: "",
|
2447
2180
|
id: "",
|
@@ -2459,41 +2192,34 @@ var $3d90f6e46fb2dd47$export$2e2bcd8739ae039 = {
|
|
2459
2192
|
set: ($b247ea80b67298d5$export$2e2bcd8739ae039).set,
|
2460
2193
|
skin: ($b247ea80b67298d5$export$2e2bcd8739ae039).skin
|
2461
2194
|
};
|
2462
|
-
|
2463
2195
|
class $331b4160623139bf$export$2e2bcd8739ae039 extends ($6f57cc9cd54c5aaa$export$2e2bcd8739ae039) {
|
2464
2196
|
async connectedCallback() {
|
2465
2197
|
const props = ($7adb23b0109cc36a$export$75fe5f91d452f94b)(this.props, ($3d90f6e46fb2dd47$export$2e2bcd8739ae039), this);
|
2466
2198
|
props.element = this;
|
2467
|
-
|
2468
2199
|
props.ref = component => {
|
2469
2200
|
this.component = component;
|
2470
2201
|
};
|
2471
|
-
|
2472
2202
|
await ($7adb23b0109cc36a$export$2cd8252107eb640b)();
|
2473
2203
|
if (this.disconnected) return;
|
2474
|
-
($fb96b826c0c5f37a$export$b3890eb0ae9dca99)( /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)(($254755d3f438722f$export$2e2bcd8739ae039), {
|
2204
|
+
($fb96b826c0c5f37a$export$b3890eb0ae9dca99)( /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)(($254755d3f438722f$export$2e2bcd8739ae039), {
|
2205
|
+
...props
|
2475
2206
|
}), this);
|
2476
2207
|
}
|
2477
|
-
|
2478
2208
|
constructor(props) {
|
2479
2209
|
super(props);
|
2480
2210
|
}
|
2481
|
-
|
2482
2211
|
}
|
2483
|
-
|
2484
2212
|
($c770c458706daa72$export$2e2bcd8739ae039)($331b4160623139bf$export$2e2bcd8739ae039, "Props", ($3d90f6e46fb2dd47$export$2e2bcd8739ae039));
|
2485
2213
|
if (typeof customElements !== "undefined" && !customElements.get("em-emoji")) customElements.define("em-emoji", $331b4160623139bf$export$2e2bcd8739ae039);
|
2486
2214
|
var $1a9a8ef576b7773d$var$r,
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2215
|
+
$1a9a8ef576b7773d$var$i = [],
|
2216
|
+
$1a9a8ef576b7773d$var$c = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__b,
|
2217
|
+
$1a9a8ef576b7773d$var$f = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__r,
|
2218
|
+
$1a9a8ef576b7773d$var$e = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).diffed,
|
2219
|
+
$1a9a8ef576b7773d$var$a = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__c,
|
2220
|
+
$1a9a8ef576b7773d$var$v = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).unmount;
|
2494
2221
|
function $1a9a8ef576b7773d$var$x() {
|
2495
2222
|
var t6;
|
2496
|
-
|
2497
2223
|
for ($1a9a8ef576b7773d$var$i.sort(function (n11, t7) {
|
2498
2224
|
return n11.__v.__b - t7.__v.__b;
|
2499
2225
|
}); t6 = $1a9a8ef576b7773d$var$i.pop();) if (t6.__P) try {
|
@@ -2502,7 +2228,6 @@ function $1a9a8ef576b7773d$var$x() {
|
|
2502
2228
|
t6.__H.__h = [], ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__e(u4, t6.__v);
|
2503
2229
|
}
|
2504
2230
|
}
|
2505
|
-
|
2506
2231
|
($fb96b826c0c5f37a$export$41c562ebe57d11e2).__b = function (n12) {
|
2507
2232
|
$1a9a8ef576b7773d$var$c && $1a9a8ef576b7773d$var$c(n12);
|
2508
2233
|
}, ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__r = function (n13) {
|
@@ -2514,11 +2239,10 @@ function $1a9a8ef576b7773d$var$x() {
|
|
2514
2239
|
var o6 = t8.__c;
|
2515
2240
|
o6 && o6.__H && o6.__H.__h.length && (1 !== $1a9a8ef576b7773d$var$i.push(o6) && $1a9a8ef576b7773d$var$r === ($fb96b826c0c5f37a$export$41c562ebe57d11e2).requestAnimationFrame || (($1a9a8ef576b7773d$var$r = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).requestAnimationFrame) || function (n14) {
|
2516
2241
|
var t9,
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2242
|
+
u5 = function () {
|
2243
|
+
clearTimeout(r9), $1a9a8ef576b7773d$var$b && cancelAnimationFrame(t9), setTimeout(n14);
|
2244
|
+
},
|
2245
|
+
r9 = setTimeout(u5, 100);
|
2522
2246
|
$1a9a8ef576b7773d$var$b && (t9 = requestAnimationFrame(u5));
|
2523
2247
|
})($1a9a8ef576b7773d$var$x));
|
2524
2248
|
}, ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__c = function (t10, u6) {
|
@@ -2536,7 +2260,7 @@ function $1a9a8ef576b7773d$var$x() {
|
|
2536
2260
|
}, ($fb96b826c0c5f37a$export$41c562ebe57d11e2).unmount = function (t12) {
|
2537
2261
|
$1a9a8ef576b7773d$var$v && $1a9a8ef576b7773d$var$v(t12);
|
2538
2262
|
var u7,
|
2539
|
-
|
2263
|
+
r11 = t12.__c;
|
2540
2264
|
r11 && r11.__H && (r11.__H.__.forEach(function (n17) {
|
2541
2265
|
try {
|
2542
2266
|
$1a9a8ef576b7773d$var$g(n17);
|
@@ -2546,105 +2270,80 @@ function $1a9a8ef576b7773d$var$x() {
|
|
2546
2270
|
}), u7 && ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__e(u7, r11.__v));
|
2547
2271
|
};
|
2548
2272
|
var $1a9a8ef576b7773d$var$b = "function" == typeof requestAnimationFrame;
|
2549
|
-
|
2550
2273
|
function $1a9a8ef576b7773d$var$g(n19) {
|
2551
2274
|
var r12 = n19.__c;
|
2552
2275
|
"function" == typeof r12 && (n19.__c = void 0, r12());
|
2553
2276
|
}
|
2554
|
-
|
2555
2277
|
function $1a9a8ef576b7773d$var$j(n20) {
|
2556
2278
|
n20.__c = n20.__();
|
2557
2279
|
}
|
2558
|
-
|
2559
2280
|
function $dc040a17866866fa$var$S(n1, t1) {
|
2560
2281
|
for (var e1 in t1) n1[e1] = t1[e1];
|
2561
|
-
|
2562
2282
|
return n1;
|
2563
2283
|
}
|
2564
|
-
|
2565
2284
|
function $dc040a17866866fa$var$C(n2, t2) {
|
2566
2285
|
for (var e2 in n2) if ("__source" !== e2 && !(e2 in t2)) return !0;
|
2567
|
-
|
2568
2286
|
for (var r1 in t2) if ("__source" !== r1 && n2[r1] !== t2[r1]) return !0;
|
2569
|
-
|
2570
2287
|
return !1;
|
2571
2288
|
}
|
2572
|
-
|
2573
2289
|
function $dc040a17866866fa$export$221d75b3f55bb0bd(n3) {
|
2574
2290
|
this.props = n3;
|
2575
2291
|
}
|
2576
|
-
|
2577
2292
|
($dc040a17866866fa$export$221d75b3f55bb0bd.prototype = new ($fb96b826c0c5f37a$export$16fa2f45be04daa8)()).isPureReactComponent = !0, $dc040a17866866fa$export$221d75b3f55bb0bd.prototype.shouldComponentUpdate = function (n6, t5) {
|
2578
2293
|
return $dc040a17866866fa$var$C(this.props, n6) || $dc040a17866866fa$var$C(this.state, t5);
|
2579
2294
|
};
|
2580
2295
|
var $dc040a17866866fa$var$w = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__b;
|
2581
|
-
|
2582
2296
|
($fb96b826c0c5f37a$export$41c562ebe57d11e2).__b = function (n7) {
|
2583
2297
|
n7.type && n7.type.__f && n7.ref && (n7.props.ref = n7.ref, n7.ref = null), $dc040a17866866fa$var$w && $dc040a17866866fa$var$w(n7);
|
2584
2298
|
};
|
2585
|
-
|
2586
2299
|
var $dc040a17866866fa$var$A = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__e;
|
2587
|
-
|
2588
2300
|
($fb96b826c0c5f37a$export$41c562ebe57d11e2).__e = function (n12, t10, e6) {
|
2589
2301
|
if (n12.then) {
|
2590
2302
|
for (var r5, u1 = t10; u1 = u1.__;) if ((r5 = u1.__c) && r5.__c) return null == t10.__e && (t10.__e = e6.__e, t10.__k = e6.__k), r5.__c(n12, t10);
|
2591
2303
|
}
|
2592
|
-
|
2593
2304
|
$dc040a17866866fa$var$A(n12, t10, e6);
|
2594
2305
|
};
|
2595
|
-
|
2596
2306
|
var $dc040a17866866fa$var$O = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).unmount;
|
2597
|
-
|
2598
2307
|
function $dc040a17866866fa$export$74bf444e3cd11ea5() {
|
2599
2308
|
this.__u = 0, this.t = null, this.__b = null;
|
2600
2309
|
}
|
2601
|
-
|
2602
2310
|
function $dc040a17866866fa$var$U(n13) {
|
2603
2311
|
var t11 = n13.__.__c;
|
2604
2312
|
return t11 && t11.__e && t11.__e(n13);
|
2605
2313
|
}
|
2606
|
-
|
2607
2314
|
function $dc040a17866866fa$export$998bcd577473dd93() {
|
2608
2315
|
this.u = null, this.o = null;
|
2609
2316
|
}
|
2610
|
-
|
2611
2317
|
($fb96b826c0c5f37a$export$41c562ebe57d11e2).unmount = function (n17) {
|
2612
2318
|
var t13 = n17.__c;
|
2613
2319
|
t13 && t13.__R && t13.__R(), t13 && !0 === n17.__h && (n17.type = null), $dc040a17866866fa$var$O && $dc040a17866866fa$var$O(n17);
|
2614
2320
|
}, ($dc040a17866866fa$export$74bf444e3cd11ea5.prototype = new ($fb96b826c0c5f37a$export$16fa2f45be04daa8)()).__c = function (n18, t14) {
|
2615
2321
|
var e8 = t14.__c,
|
2616
|
-
|
2322
|
+
r7 = this;
|
2617
2323
|
null == r7.t && (r7.t = []), r7.t.push(e8);
|
2618
|
-
|
2619
2324
|
var u4 = $dc040a17866866fa$var$U(r7.__v),
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2325
|
+
o1 = !1,
|
2326
|
+
i1 = function () {
|
2327
|
+
o1 || (o1 = !0, e8.__R = null, u4 ? u4(l1) : l1());
|
2328
|
+
};
|
2625
2329
|
e8.__R = i1;
|
2626
|
-
|
2627
2330
|
var l1 = function () {
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
}
|
2636
|
-
}
|
2331
|
+
if (! --r7.__u) {
|
2332
|
+
if (r7.state.__e) {
|
2333
|
+
var n19 = r7.state.__e;
|
2334
|
+
r7.__v.__k[0] = function n22(t17, e9, r8) {
|
2335
|
+
return t17 && (t17.__v = null, t17.__k = t17.__k && t17.__k.map(function (t18) {
|
2336
|
+
return n22(t18, e9, r8);
|
2337
|
+
}), t17.__c && t17.__c.__P === e9 && (t17.__e && r8.insertBefore(t17.__e, t17.__d), t17.__c.__e = !0, t17.__c.__P = r8)), t17;
|
2338
|
+
}(n19, n19.__c.__P, n19.__c.__O);
|
2339
|
+
}
|
2340
|
+
var t15;
|
2341
|
+
for (r7.setState({
|
2342
|
+
__e: r7.__b = null
|
2343
|
+
}); t15 = r7.t.pop();) t15.forceUpdate();
|
2637
2344
|
}
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
for (r7.setState({
|
2642
|
-
__e: r7.__b = null
|
2643
|
-
}); t15 = r7.t.pop();) t15.forceUpdate();
|
2644
|
-
}
|
2645
|
-
},
|
2646
|
-
c1 = !0 === t14.__h;
|
2647
|
-
|
2345
|
+
},
|
2346
|
+
c1 = !0 === t14.__h;
|
2648
2347
|
r7.__u++ || c1 || r7.setState({
|
2649
2348
|
__e: r7.__b = r7.__v.__k[0]
|
2650
2349
|
}), n18.then(i1, i1);
|
@@ -2654,8 +2353,7 @@ function $dc040a17866866fa$export$998bcd577473dd93() {
|
|
2654
2353
|
if (this.__b) {
|
2655
2354
|
if (this.__v.__k) {
|
2656
2355
|
var e10 = document.createElement("div"),
|
2657
|
-
|
2658
|
-
|
2356
|
+
r9 = this.__v.__k[0].__c;
|
2659
2357
|
this.__v.__k[0] = function n24(t20, e13, r12) {
|
2660
2358
|
return t20 && (t20.__c && t20.__c.__H && (t20.__c.__H.__.forEach(function (n25) {
|
2661
2359
|
"function" == typeof n25.__c && n25.__c();
|
@@ -2664,41 +2362,33 @@ function $dc040a17866866fa$export$998bcd577473dd93() {
|
|
2664
2362
|
})), t20;
|
2665
2363
|
}(this.__b, e10, r9.__O = r9.__P);
|
2666
2364
|
}
|
2667
|
-
|
2668
2365
|
this.__b = null;
|
2669
2366
|
}
|
2670
|
-
|
2671
2367
|
var u5 = t19.__e && ($fb96b826c0c5f37a$export$c8a8987d4410bf2d)(($fb96b826c0c5f37a$export$ffb0004e005737fa), null, n23.fallback);
|
2672
2368
|
return u5 && (u5.__h = null), [($fb96b826c0c5f37a$export$c8a8987d4410bf2d)(($fb96b826c0c5f37a$export$ffb0004e005737fa), null, t19.__e ? null : n23.children), u5];
|
2673
2369
|
};
|
2674
|
-
|
2675
2370
|
var $dc040a17866866fa$var$T = function (n26, t22, e14) {
|
2676
2371
|
if (++e14[1] === e14[0] && n26.o.delete(t22), n26.props.revealOrder && ("t" !== n26.props.revealOrder[0] || !n26.o.size)) for (e14 = n26.u; e14;) {
|
2677
2372
|
for (; e14.length > 3;) e14.pop()();
|
2678
|
-
|
2679
2373
|
if (e14[1] < e14[0]) break;
|
2680
2374
|
n26.u = e14 = e14[2];
|
2681
2375
|
}
|
2682
2376
|
};
|
2683
|
-
|
2684
2377
|
($dc040a17866866fa$export$998bcd577473dd93.prototype = new ($fb96b826c0c5f37a$export$16fa2f45be04daa8)()).__e = function (n33) {
|
2685
2378
|
var t25 = this,
|
2686
|
-
|
2687
|
-
|
2379
|
+
e16 = $dc040a17866866fa$var$U(t25.__v),
|
2380
|
+
r13 = t25.o.get(n33);
|
2688
2381
|
return r13[0]++, function (u6) {
|
2689
2382
|
var o2 = function () {
|
2690
2383
|
t25.props.revealOrder ? (r13.push(u6), $dc040a17866866fa$var$T(t25, n33, r13)) : u6();
|
2691
2384
|
};
|
2692
|
-
|
2693
2385
|
e16 ? e16(o2) : o2();
|
2694
2386
|
};
|
2695
2387
|
}, $dc040a17866866fa$export$998bcd577473dd93.prototype.render = function (n34) {
|
2696
2388
|
this.u = null, this.o = new Map();
|
2697
2389
|
var t26 = ($fb96b826c0c5f37a$export$47e4c5b300681277)(n34.children);
|
2698
2390
|
n34.revealOrder && "b" === n34.revealOrder[0] && t26.reverse();
|
2699
|
-
|
2700
2391
|
for (var e17 = t26.length; e17--;) this.o.set(t26[e17], this.u = [1, 0, this.u]);
|
2701
|
-
|
2702
2392
|
return n34.children;
|
2703
2393
|
}, $dc040a17866866fa$export$998bcd577473dd93.prototype.componentDidUpdate = $dc040a17866866fa$export$998bcd577473dd93.prototype.componentDidMount = function () {
|
2704
2394
|
var n35 = this;
|
@@ -2706,14 +2396,12 @@ var $dc040a17866866fa$var$T = function (n26, t22, e14) {
|
|
2706
2396
|
$dc040a17866866fa$var$T(n35, e18, t27);
|
2707
2397
|
});
|
2708
2398
|
};
|
2709
|
-
|
2710
2399
|
var $dc040a17866866fa$var$j = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103,
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
};
|
2716
|
-
|
2400
|
+
$dc040a17866866fa$var$P = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,
|
2401
|
+
$dc040a17866866fa$var$V = "undefined" != typeof document,
|
2402
|
+
$dc040a17866866fa$var$z = function (n36) {
|
2403
|
+
return ("undefined" != typeof Symbol && "symbol" == typeof Symbol() ? /fil|che|rad/i : /fil|che|ra/i).test(n36);
|
2404
|
+
};
|
2717
2405
|
($fb96b826c0c5f37a$export$16fa2f45be04daa8).prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function (n39) {
|
2718
2406
|
Object.defineProperty(($fb96b826c0c5f37a$export$16fa2f45be04daa8).prototype, n39, {
|
2719
2407
|
configurable: !0,
|
@@ -2730,54 +2418,42 @@ var $dc040a17866866fa$var$j = "undefined" != typeof Symbol && Symbol.for && Symb
|
|
2730
2418
|
});
|
2731
2419
|
});
|
2732
2420
|
var $dc040a17866866fa$var$H = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).event;
|
2733
|
-
|
2734
2421
|
function $dc040a17866866fa$var$Z() {}
|
2735
|
-
|
2736
2422
|
function $dc040a17866866fa$var$Y() {
|
2737
2423
|
return this.cancelBubble;
|
2738
2424
|
}
|
2739
|
-
|
2740
2425
|
function $dc040a17866866fa$var$q() {
|
2741
2426
|
return this.defaultPrevented;
|
2742
2427
|
}
|
2743
|
-
|
2744
2428
|
($fb96b826c0c5f37a$export$41c562ebe57d11e2).event = function (n40) {
|
2745
2429
|
return $dc040a17866866fa$var$H && (n40 = $dc040a17866866fa$var$H(n40)), n40.persist = $dc040a17866866fa$var$Z, n40.isPropagationStopped = $dc040a17866866fa$var$Y, n40.isDefaultPrevented = $dc040a17866866fa$var$q, n40.nativeEvent = n40;
|
2746
2430
|
};
|
2747
|
-
|
2748
2431
|
var $dc040a17866866fa$var$J = {
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
},
|
2754
|
-
|
2755
|
-
|
2432
|
+
configurable: !0,
|
2433
|
+
get: function () {
|
2434
|
+
return this.class;
|
2435
|
+
}
|
2436
|
+
},
|
2437
|
+
$dc040a17866866fa$var$K = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).vnode;
|
2756
2438
|
($fb96b826c0c5f37a$export$41c562ebe57d11e2).vnode = function (n41) {
|
2757
2439
|
var t31 = n41.type,
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2440
|
+
e21 = n41.props,
|
2441
|
+
r14 = e21;
|
2761
2442
|
if ("string" == typeof t31) {
|
2762
2443
|
var u7 = -1 === t31.indexOf("-");
|
2763
|
-
|
2764
2444
|
for (var o3 in r14 = {}, e21) {
|
2765
2445
|
var i2 = e21[o3];
|
2766
2446
|
$dc040a17866866fa$var$V && "children" === o3 && "noscript" === t31 || "value" === o3 && "defaultValue" in e21 && null == i2 || ("defaultValue" === o3 && "value" in e21 && null == e21.value ? o3 = "value" : "download" === o3 && !0 === i2 ? i2 = "" : /ondoubleclick/i.test(o3) ? o3 = "ondblclick" : /^onchange(textarea|input)/i.test(o3 + t31) && !$dc040a17866866fa$var$z(e21.type) ? o3 = "oninput" : /^onfocus$/i.test(o3) ? o3 = "onfocusin" : /^onblur$/i.test(o3) ? o3 = "onfocusout" : /^on(Ani|Tra|Tou|BeforeInp)/.test(o3) ? o3 = o3.toLowerCase() : u7 && $dc040a17866866fa$var$P.test(o3) ? o3 = o3.replace(/[A-Z0-9]/, "-$&").toLowerCase() : null === i2 && (i2 = void 0), r14[o3] = i2);
|
2767
2447
|
}
|
2768
|
-
|
2769
2448
|
"select" == t31 && r14.multiple && Array.isArray(r14.value) && (r14.value = ($fb96b826c0c5f37a$export$47e4c5b300681277)(e21.children).forEach(function (n42) {
|
2770
2449
|
n42.props.selected = -1 != r14.value.indexOf(n42.props.value);
|
2771
2450
|
})), "select" == t31 && null != r14.defaultValue && (r14.value = ($fb96b826c0c5f37a$export$47e4c5b300681277)(e21.children).forEach(function (n43) {
|
2772
2451
|
n43.props.selected = r14.multiple ? -1 != r14.defaultValue.indexOf(n43.props.value) : r14.defaultValue == n43.props.value;
|
2773
2452
|
})), n41.props = r14, e21.class != e21.className && ($dc040a17866866fa$var$J.enumerable = "className" in e21, null != e21.className && (r14.class = e21.className), Object.defineProperty(r14, "className", $dc040a17866866fa$var$J));
|
2774
2453
|
}
|
2775
|
-
|
2776
2454
|
n41.$$typeof = $dc040a17866866fa$var$j, $dc040a17866866fa$var$K && $dc040a17866866fa$var$K(n41);
|
2777
2455
|
};
|
2778
|
-
|
2779
2456
|
var $dc040a17866866fa$var$Q = ($fb96b826c0c5f37a$export$41c562ebe57d11e2).__r;
|
2780
|
-
|
2781
2457
|
($fb96b826c0c5f37a$export$41c562ebe57d11e2).__r = function (n44) {
|
2782
2458
|
$dc040a17866866fa$var$Q && $dc040a17866866fa$var$Q(n44), n44.__c;
|
2783
2459
|
};
|
@@ -2785,13 +2461,11 @@ const $ec8c39fdad15601a$var$THEME_ICONS = {
|
|
2785
2461
|
light: "outline",
|
2786
2462
|
dark: "solid"
|
2787
2463
|
};
|
2788
|
-
|
2789
2464
|
class $ec8c39fdad15601a$export$2e2bcd8739ae039 extends ($dc040a17866866fa$export$221d75b3f55bb0bd) {
|
2790
2465
|
renderIcon(category) {
|
2791
2466
|
const {
|
2792
2467
|
icon: icon
|
2793
2468
|
} = category;
|
2794
|
-
|
2795
2469
|
if (icon) {
|
2796
2470
|
if (icon.svg) return /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)("span", {
|
2797
2471
|
class: "flex",
|
@@ -2803,12 +2477,10 @@ class $ec8c39fdad15601a$export$2e2bcd8739ae039 extends ($dc040a17866866fa$export
|
|
2803
2477
|
src: icon.src
|
2804
2478
|
});
|
2805
2479
|
}
|
2806
|
-
|
2807
2480
|
const categoryIcons = ($fcccfb36ed0cde68$export$2e2bcd8739ae039).categories[category.id] || ($fcccfb36ed0cde68$export$2e2bcd8739ae039).categories.custom;
|
2808
2481
|
const style = this.props.icons == "auto" ? $ec8c39fdad15601a$var$THEME_ICONS[this.props.theme] : this.props.icons;
|
2809
2482
|
return categoryIcons[style] || categoryIcons;
|
2810
2483
|
}
|
2811
|
-
|
2812
2484
|
render() {
|
2813
2485
|
let selectedCategoryIndex = null;
|
2814
2486
|
return /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)("nav", {
|
@@ -2848,7 +2520,6 @@ class $ec8c39fdad15601a$export$2e2bcd8739ae039 extends ($dc040a17866866fa$export
|
|
2848
2520
|
})
|
2849
2521
|
});
|
2850
2522
|
}
|
2851
|
-
|
2852
2523
|
constructor() {
|
2853
2524
|
super();
|
2854
2525
|
this.categories = ($7adb23b0109cc36a$export$2d0294657ab35f1b).categories.filter(category => {
|
@@ -2858,29 +2529,22 @@ class $ec8c39fdad15601a$export$2e2bcd8739ae039 extends ($dc040a17866866fa$export
|
|
2858
2529
|
categoryId: this.categories[0].id
|
2859
2530
|
};
|
2860
2531
|
}
|
2861
|
-
|
2862
2532
|
}
|
2863
|
-
|
2864
2533
|
class $e0d4dda61265ff1e$export$2e2bcd8739ae039 extends ($dc040a17866866fa$export$221d75b3f55bb0bd) {
|
2865
2534
|
shouldComponentUpdate(nextProps) {
|
2866
2535
|
for (let k in nextProps) {
|
2867
2536
|
if (k == "children") continue;
|
2868
2537
|
if (nextProps[k] != this.props[k]) return true;
|
2869
2538
|
}
|
2870
|
-
|
2871
2539
|
return false;
|
2872
2540
|
}
|
2873
|
-
|
2874
2541
|
render() {
|
2875
2542
|
return this.props.children;
|
2876
2543
|
}
|
2877
|
-
|
2878
2544
|
}
|
2879
|
-
|
2880
2545
|
const $89bd6bb200cc8fef$var$Performance = {
|
2881
2546
|
rowsPerRender: 10
|
2882
2547
|
};
|
2883
|
-
|
2884
2548
|
class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export$16fa2f45be04daa8) {
|
2885
2549
|
getInitialState(props = this.props) {
|
2886
2550
|
return {
|
@@ -2888,7 +2552,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
2888
2552
|
theme: this.initTheme(props.theme)
|
2889
2553
|
};
|
2890
2554
|
}
|
2891
|
-
|
2892
2555
|
componentWillMount() {
|
2893
2556
|
this.dir = ($7adb23b0109cc36a$export$dbe3113d60765c1a).rtl ? "rtl" : "ltr";
|
2894
2557
|
this.refs = {
|
@@ -2901,17 +2564,14 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
2901
2564
|
skinToneRadio: ($fb96b826c0c5f37a$export$7d1e3a5e95ceca43)()
|
2902
2565
|
};
|
2903
2566
|
this.initGrid();
|
2904
|
-
|
2905
2567
|
if (this.props.stickySearch == false && this.props.searchPosition == "sticky") {
|
2906
2568
|
console.warn("[EmojiMart] Deprecation warning: `stickySearch` has been renamed `searchPosition`.");
|
2907
2569
|
this.props.searchPosition = "static";
|
2908
2570
|
}
|
2909
2571
|
}
|
2910
|
-
|
2911
2572
|
componentDidMount() {
|
2912
2573
|
this.register();
|
2913
2574
|
this.shadowRoot = this.base.parentNode;
|
2914
|
-
|
2915
2575
|
if (this.props.autoFocus) {
|
2916
2576
|
const {
|
2917
2577
|
searchInput: searchInput
|
@@ -2919,32 +2579,25 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
2919
2579
|
if (searchInput.current) searchInput.current.focus();
|
2920
2580
|
}
|
2921
2581
|
}
|
2922
|
-
|
2923
2582
|
componentWillReceiveProps(nextProps) {
|
2924
2583
|
this.nextState || (this.nextState = {});
|
2925
|
-
|
2926
2584
|
for (const k1 in nextProps) this.nextState[k1] = nextProps[k1];
|
2927
|
-
|
2928
2585
|
clearTimeout(this.nextStateTimer);
|
2929
2586
|
this.nextStateTimer = setTimeout(() => {
|
2930
2587
|
let requiresGridReset = false;
|
2931
|
-
|
2932
2588
|
for (const k in this.nextState) {
|
2933
2589
|
this.props[k] = this.nextState[k];
|
2934
2590
|
if (k === "custom" || k === "categories") requiresGridReset = true;
|
2935
2591
|
}
|
2936
|
-
|
2937
2592
|
delete this.nextState;
|
2938
2593
|
const nextState = this.getInitialState();
|
2939
2594
|
if (requiresGridReset) return this.reset(nextState);
|
2940
2595
|
this.setState(nextState);
|
2941
2596
|
});
|
2942
2597
|
}
|
2943
|
-
|
2944
2598
|
componentWillUnmount() {
|
2945
2599
|
this.unregister();
|
2946
2600
|
}
|
2947
|
-
|
2948
2601
|
async reset(nextState = {}) {
|
2949
2602
|
await ($7adb23b0109cc36a$export$2cd8252107eb640b)(this.props);
|
2950
2603
|
this.initGrid();
|
@@ -2954,35 +2607,28 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
2954
2607
|
this.observeRows();
|
2955
2608
|
});
|
2956
2609
|
}
|
2957
|
-
|
2958
2610
|
register() {
|
2959
2611
|
document.addEventListener("click", this.handleClickOutside);
|
2960
2612
|
this.observe();
|
2961
2613
|
}
|
2962
|
-
|
2963
2614
|
unregister() {
|
2964
2615
|
document.removeEventListener("click", this.handleClickOutside);
|
2965
2616
|
this.unobserve();
|
2966
2617
|
}
|
2967
|
-
|
2968
2618
|
observe() {
|
2969
2619
|
this.observeCategories();
|
2970
2620
|
this.observeRows();
|
2971
2621
|
}
|
2972
|
-
|
2973
2622
|
unobserve({
|
2974
2623
|
except = []
|
2975
2624
|
} = {}) {
|
2976
2625
|
if (!Array.isArray(except)) except = [except];
|
2977
|
-
|
2978
2626
|
for (const observer of this.observers) {
|
2979
2627
|
if (except.includes(observer)) continue;
|
2980
2628
|
observer.disconnect();
|
2981
2629
|
}
|
2982
|
-
|
2983
2630
|
this.observers = [].concat(except);
|
2984
2631
|
}
|
2985
|
-
|
2986
2632
|
initGrid() {
|
2987
2633
|
const {
|
2988
2634
|
categories: categories
|
@@ -2993,7 +2639,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
2993
2639
|
this.navKey = navKey;
|
2994
2640
|
this.grid = [];
|
2995
2641
|
this.grid.setsize = 0;
|
2996
|
-
|
2997
2642
|
const addRow = (rows, category) => {
|
2998
2643
|
const row = [];
|
2999
2644
|
row.__categoryId = category.id;
|
@@ -3006,27 +2651,22 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3006
2651
|
rows.push(rowRef);
|
3007
2652
|
return row;
|
3008
2653
|
};
|
3009
|
-
|
3010
2654
|
for (let category1 of categories) {
|
3011
2655
|
const rows = [];
|
3012
2656
|
let row = addRow(rows, category1);
|
3013
|
-
|
3014
2657
|
for (let emoji of category1.emojis) {
|
3015
2658
|
if (row.length == this.getPerLine()) row = addRow(rows, category1);
|
3016
2659
|
this.grid.setsize += 1;
|
3017
2660
|
row.push(emoji);
|
3018
2661
|
}
|
3019
|
-
|
3020
2662
|
this.refs.categories.set(category1.id, {
|
3021
2663
|
root: ($fb96b826c0c5f37a$export$7d1e3a5e95ceca43)(),
|
3022
2664
|
rows: rows
|
3023
2665
|
});
|
3024
2666
|
}
|
3025
2667
|
}
|
3026
|
-
|
3027
2668
|
initTheme(theme) {
|
3028
2669
|
if (theme != "auto") return theme;
|
3029
|
-
|
3030
2670
|
if (!this.darkMedia) {
|
3031
2671
|
this.darkMedia = matchMedia("(prefers-color-scheme: dark)");
|
3032
2672
|
if (this.darkMedia.media.match(/^not/)) return "light";
|
@@ -3037,24 +2677,20 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3037
2677
|
});
|
3038
2678
|
});
|
3039
2679
|
}
|
3040
|
-
|
3041
2680
|
return this.darkMedia.matches ? "dark" : "light";
|
3042
2681
|
}
|
3043
|
-
|
3044
2682
|
initDynamicPerLine(props = this.props) {
|
3045
2683
|
if (!props.dynamicWidth) return;
|
3046
2684
|
const {
|
3047
2685
|
element: element,
|
3048
2686
|
emojiButtonSize: emojiButtonSize
|
3049
2687
|
} = props;
|
3050
|
-
|
3051
2688
|
const calculatePerLine = () => {
|
3052
2689
|
const {
|
3053
2690
|
width: width
|
3054
2691
|
} = element.getBoundingClientRect();
|
3055
2692
|
return Math.floor(width / emojiButtonSize);
|
3056
2693
|
};
|
3057
|
-
|
3058
2694
|
const observer = new ResizeObserver(() => {
|
3059
2695
|
this.unobserve({
|
3060
2696
|
except: observer
|
@@ -3073,29 +2709,24 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3073
2709
|
this.observers.push(observer);
|
3074
2710
|
return calculatePerLine();
|
3075
2711
|
}
|
3076
|
-
|
3077
2712
|
getPerLine() {
|
3078
2713
|
return this.state.perLine || this.props.perLine;
|
3079
2714
|
}
|
3080
|
-
|
3081
2715
|
getEmojiByPos([p1, p2]) {
|
3082
2716
|
const grid = this.state.searchResults || this.grid;
|
3083
2717
|
const emoji = grid[p1] && grid[p1][p2];
|
3084
2718
|
if (!emoji) return;
|
3085
2719
|
return ($c4d155af13ad4d4b$export$2e2bcd8739ae039).get(emoji);
|
3086
2720
|
}
|
3087
|
-
|
3088
2721
|
observeCategories() {
|
3089
2722
|
const navigation = this.refs.navigation.current;
|
3090
2723
|
if (!navigation) return;
|
3091
2724
|
const visibleCategories = new Map();
|
3092
|
-
|
3093
2725
|
const setFocusedCategory = categoryId => {
|
3094
2726
|
if (categoryId != navigation.state.categoryId) navigation.setState({
|
3095
2727
|
categoryId: categoryId
|
3096
2728
|
});
|
3097
2729
|
};
|
3098
|
-
|
3099
2730
|
const observerOptions = {
|
3100
2731
|
root: this.refs.scroll.current,
|
3101
2732
|
threshold: [0.0, 1.0]
|
@@ -3105,31 +2736,26 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3105
2736
|
const id = entry.target.dataset.id;
|
3106
2737
|
visibleCategories.set(id, entry.intersectionRatio);
|
3107
2738
|
}
|
3108
|
-
|
3109
2739
|
const ratios = [...visibleCategories];
|
3110
|
-
|
3111
2740
|
for (const [id, ratio] of ratios) if (ratio) {
|
3112
2741
|
setFocusedCategory(id);
|
3113
2742
|
break;
|
3114
2743
|
}
|
3115
2744
|
}, observerOptions);
|
3116
|
-
|
3117
2745
|
for (const {
|
3118
2746
|
root: root
|
3119
2747
|
} of this.refs.categories.values()) observer.observe(root.current);
|
3120
|
-
|
3121
2748
|
this.observers.push(observer);
|
3122
2749
|
}
|
3123
|
-
|
3124
2750
|
observeRows() {
|
3125
|
-
const visibleRows = {
|
2751
|
+
const visibleRows = {
|
2752
|
+
...this.state.visibleRows
|
3126
2753
|
};
|
3127
2754
|
const observer = new IntersectionObserver(entries => {
|
3128
2755
|
for (const entry of entries) {
|
3129
2756
|
const index = parseInt(entry.target.dataset.index);
|
3130
2757
|
if (entry.isIntersecting) visibleRows[index] = true;else delete visibleRows[index];
|
3131
2758
|
}
|
3132
|
-
|
3133
2759
|
this.setState({
|
3134
2760
|
visibleRows: visibleRows
|
3135
2761
|
});
|
@@ -3137,26 +2763,21 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3137
2763
|
root: this.refs.scroll.current,
|
3138
2764
|
rootMargin: `${this.props.emojiButtonSize * ($89bd6bb200cc8fef$var$Performance.rowsPerRender + 5)}px 0px ${this.props.emojiButtonSize * $89bd6bb200cc8fef$var$Performance.rowsPerRender}px`
|
3139
2765
|
});
|
3140
|
-
|
3141
2766
|
for (const {
|
3142
2767
|
rows: rows
|
3143
2768
|
} of this.refs.categories.values()) {
|
3144
2769
|
for (const row of rows) if (row.current) observer.observe(row.current);
|
3145
2770
|
}
|
3146
|
-
|
3147
2771
|
this.observers.push(observer);
|
3148
2772
|
}
|
3149
|
-
|
3150
2773
|
preventDefault(e) {
|
3151
2774
|
e.preventDefault();
|
3152
2775
|
}
|
3153
|
-
|
3154
2776
|
unfocusSearch() {
|
3155
2777
|
const input = this.refs.searchInput.current;
|
3156
2778
|
if (!input) return;
|
3157
2779
|
input.blur();
|
3158
2780
|
}
|
3159
|
-
|
3160
2781
|
navigate({
|
3161
2782
|
e: e,
|
3162
2783
|
input: input,
|
@@ -3168,53 +2789,42 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3168
2789
|
const grid = this.state.searchResults || this.grid;
|
3169
2790
|
if (!grid.length) return;
|
3170
2791
|
let [p1, p2] = this.state.pos;
|
3171
|
-
|
3172
2792
|
const pos = (() => {
|
3173
2793
|
if (p1 == 0) {
|
3174
2794
|
if (p2 == 0 && !e.repeat && (left || up)) return null;
|
3175
2795
|
}
|
3176
|
-
|
3177
2796
|
if (p1 == -1) {
|
3178
2797
|
if (!e.repeat && (right || down) && input.selectionStart == input.value.length) return [0, 0];
|
3179
2798
|
return null;
|
3180
2799
|
}
|
3181
|
-
|
3182
2800
|
if (left || right) {
|
3183
2801
|
let row = grid[p1];
|
3184
2802
|
const increment = left ? -1 : 1;
|
3185
2803
|
p2 += increment;
|
3186
|
-
|
3187
2804
|
if (!row[p2]) {
|
3188
2805
|
p1 += increment;
|
3189
2806
|
row = grid[p1];
|
3190
|
-
|
3191
2807
|
if (!row) {
|
3192
2808
|
p1 = left ? 0 : grid.length - 1;
|
3193
2809
|
p2 = left ? 0 : grid[p1].length - 1;
|
3194
2810
|
return [p1, p2];
|
3195
2811
|
}
|
3196
|
-
|
3197
2812
|
p2 = left ? row.length - 1 : 0;
|
3198
2813
|
}
|
3199
|
-
|
3200
2814
|
return [p1, p2];
|
3201
2815
|
}
|
3202
|
-
|
3203
2816
|
if (up || down) {
|
3204
2817
|
p1 += up ? -1 : 1;
|
3205
2818
|
const row = grid[p1];
|
3206
|
-
|
3207
2819
|
if (!row) {
|
3208
2820
|
p1 = up ? 0 : grid.length - 1;
|
3209
2821
|
p2 = up ? 0 : grid[p1].length - 1;
|
3210
2822
|
return [p1, p2];
|
3211
2823
|
}
|
3212
|
-
|
3213
2824
|
if (!row[p2]) p2 = row.length - 1;
|
3214
2825
|
return [p1, p2];
|
3215
2826
|
}
|
3216
2827
|
})();
|
3217
|
-
|
3218
2828
|
if (pos) e.preventDefault();else {
|
3219
2829
|
if (this.state.pos[0] > -1) this.setState({
|
3220
2830
|
pos: [-1, -1]
|
@@ -3230,7 +2840,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3230
2840
|
});
|
3231
2841
|
});
|
3232
2842
|
}
|
3233
|
-
|
3234
2843
|
scrollTo({
|
3235
2844
|
categoryId: categoryId,
|
3236
2845
|
row: row
|
@@ -3241,13 +2850,11 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3241
2850
|
const scrollRect = scroll.getBoundingClientRect();
|
3242
2851
|
let scrollTop = 0;
|
3243
2852
|
if (row >= 0) categoryId = grid[row].__categoryId;
|
3244
|
-
|
3245
2853
|
if (categoryId) {
|
3246
2854
|
const ref = this.refs[categoryId] || this.refs.categories.get(categoryId).root;
|
3247
2855
|
const categoryRect = ref.current.getBoundingClientRect();
|
3248
2856
|
scrollTop = categoryRect.top - (scrollRect.top - scroll.scrollTop) + 1;
|
3249
2857
|
}
|
3250
|
-
|
3251
2858
|
if (row >= 0) {
|
3252
2859
|
if (!row) scrollTop = 0;else {
|
3253
2860
|
const rowIndex = grid[row].__index;
|
@@ -3256,11 +2863,9 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3256
2863
|
if (rowTop < scroll.scrollTop) scrollTop = rowTop;else if (rowBot > scroll.scrollTop + scrollRect.height) scrollTop = rowBot - scrollRect.height;else return;
|
3257
2864
|
}
|
3258
2865
|
}
|
3259
|
-
|
3260
2866
|
this.ignoreMouse();
|
3261
2867
|
scroll.scrollTop = scrollTop;
|
3262
2868
|
}
|
3263
|
-
|
3264
2869
|
ignoreMouse() {
|
3265
2870
|
this.mouseIsIgnored = true;
|
3266
2871
|
clearTimeout(this.ignoreMouseTimer);
|
@@ -3268,7 +2873,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3268
2873
|
delete this.mouseIsIgnored;
|
3269
2874
|
}, 100);
|
3270
2875
|
}
|
3271
|
-
|
3272
2876
|
handleEmojiOver(pos) {
|
3273
2877
|
if (this.mouseIsIgnored || this.state.showSkins) return;
|
3274
2878
|
this.setState({
|
@@ -3276,7 +2880,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3276
2880
|
keyboard: false
|
3277
2881
|
});
|
3278
2882
|
}
|
3279
|
-
|
3280
2883
|
handleEmojiClick({
|
3281
2884
|
e: e,
|
3282
2885
|
emoji: emoji,
|
@@ -3284,7 +2887,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3284
2887
|
}) {
|
3285
2888
|
if (!this.props.onEmojiSelect) return;
|
3286
2889
|
if (!emoji && pos) emoji = this.getEmojiByPos(pos);
|
3287
|
-
|
3288
2890
|
if (emoji) {
|
3289
2891
|
const emojiData = ($693b183b0a78708f$export$d10ac59fbe52a745)(emoji, {
|
3290
2892
|
skinIndex: this.state.skin - 1
|
@@ -3293,7 +2895,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3293
2895
|
this.props.onEmojiSelect(emojiData, e);
|
3294
2896
|
}
|
3295
2897
|
}
|
3296
|
-
|
3297
2898
|
closeSkins() {
|
3298
2899
|
if (!this.state.showSkins) return;
|
3299
2900
|
this.setState({
|
@@ -3303,13 +2904,11 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3303
2904
|
this.base.removeEventListener("click", this.handleBaseClick);
|
3304
2905
|
this.base.removeEventListener("keydown", this.handleBaseKeydown);
|
3305
2906
|
}
|
3306
|
-
|
3307
2907
|
handleSkinMouseOver(tempSkin) {
|
3308
2908
|
this.setState({
|
3309
2909
|
tempSkin: tempSkin
|
3310
2910
|
});
|
3311
2911
|
}
|
3312
|
-
|
3313
2912
|
handleSkinClick(skin) {
|
3314
2913
|
this.ignoreMouse();
|
3315
2914
|
this.closeSkins();
|
@@ -3319,7 +2918,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3319
2918
|
});
|
3320
2919
|
($f72b75cf796873c7$export$2e2bcd8739ae039).set("skin", skin);
|
3321
2920
|
}
|
3322
|
-
|
3323
2921
|
renderNav() {
|
3324
2922
|
return /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)(($ec8c39fdad15601a$export$2e2bcd8739ae039), {
|
3325
2923
|
ref: this.refs.navigation,
|
@@ -3331,7 +2929,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3331
2929
|
onClick: this.handleCategoryClick
|
3332
2930
|
}, this.navKey);
|
3333
2931
|
}
|
3334
|
-
|
3335
2932
|
renderPreview() {
|
3336
2933
|
const emoji = this.getEmojiByPos(this.state.pos);
|
3337
2934
|
const noSearchResults = this.state.searchResults && !this.state.searchResults.length;
|
@@ -3376,7 +2973,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3376
2973
|
}), !emoji && this.props.skinTonePosition == "preview" && this.renderSkinToneButton()]
|
3377
2974
|
});
|
3378
2975
|
}
|
3379
|
-
|
3380
2976
|
renderEmojiButton(emoji, {
|
3381
2977
|
pos: pos,
|
3382
2978
|
posinset: posinset,
|
@@ -3432,7 +3028,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3432
3028
|
})
|
3433
3029
|
}, key);
|
3434
3030
|
}
|
3435
|
-
|
3436
3031
|
renderSearch() {
|
3437
3032
|
const renderSkinTone = this.props.previewPosition == "none" || this.props.skinTonePosition == "search";
|
3438
3033
|
return /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)("div", {
|
@@ -3466,7 +3061,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3466
3061
|
})]
|
3467
3062
|
});
|
3468
3063
|
}
|
3469
|
-
|
3470
3064
|
renderSearchResults() {
|
3471
3065
|
const {
|
3472
3066
|
searchResults: searchResults
|
@@ -3500,7 +3094,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3500
3094
|
})]
|
3501
3095
|
});
|
3502
3096
|
}
|
3503
|
-
|
3504
3097
|
renderCategories() {
|
3505
3098
|
const {
|
3506
3099
|
categories: categories
|
@@ -3567,7 +3160,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3567
3160
|
})
|
3568
3161
|
});
|
3569
3162
|
}
|
3570
|
-
|
3571
3163
|
renderSkinToneButton() {
|
3572
3164
|
if (this.props.skinTonePosition == "none") return null;
|
3573
3165
|
return /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)("div", {
|
@@ -3595,7 +3187,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3595
3187
|
})
|
3596
3188
|
});
|
3597
3189
|
}
|
3598
|
-
|
3599
3190
|
renderLiveRegion() {
|
3600
3191
|
const emoji = this.getEmojiByPos(this.state.pos);
|
3601
3192
|
const contents = emoji ? emoji.name : "";
|
@@ -3605,7 +3196,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3605
3196
|
children: contents
|
3606
3197
|
});
|
3607
3198
|
}
|
3608
|
-
|
3609
3199
|
renderSkins() {
|
3610
3200
|
const skinToneButton = this.refs.skinToneButton.current;
|
3611
3201
|
const skinToneButtonRect = skinToneButton.getBoundingClientRect();
|
@@ -3660,7 +3250,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3660
3250
|
})
|
3661
3251
|
});
|
3662
3252
|
}
|
3663
|
-
|
3664
3253
|
render() {
|
3665
3254
|
const lineWidth = this.props.perLine * this.props.emojiButtonSize;
|
3666
3255
|
return /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)("section", {
|
@@ -3689,14 +3278,12 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3689
3278
|
}), this.props.navPosition == "bottom" && this.renderNav(), this.props.previewPosition == "bottom" && this.renderPreview(), this.state.showSkins && this.renderSkins(), this.renderLiveRegion()]
|
3690
3279
|
});
|
3691
3280
|
}
|
3692
|
-
|
3693
3281
|
constructor(props) {
|
3694
3282
|
super();
|
3695
3283
|
($c770c458706daa72$export$2e2bcd8739ae039)(this, "handleClickOutside", e => {
|
3696
3284
|
const {
|
3697
3285
|
element: element
|
3698
3286
|
} = this.props;
|
3699
|
-
|
3700
3287
|
if (e.target != element) {
|
3701
3288
|
if (this.state.showSkins) this.closeSkins();
|
3702
3289
|
if (this.props.onClickOutside) this.props.onClickOutside(e);
|
@@ -3704,7 +3291,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3704
3291
|
});
|
3705
3292
|
($c770c458706daa72$export$2e2bcd8739ae039)(this, "handleBaseClick", e => {
|
3706
3293
|
if (!this.state.showSkins) return;
|
3707
|
-
|
3708
3294
|
if (!e.target.closest(".menu")) {
|
3709
3295
|
e.preventDefault();
|
3710
3296
|
e.stopImmediatePropagation();
|
@@ -3713,7 +3299,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3713
3299
|
});
|
3714
3300
|
($c770c458706daa72$export$2e2bcd8739ae039)(this, "handleBaseKeydown", e => {
|
3715
3301
|
if (!this.state.showSkins) return;
|
3716
|
-
|
3717
3302
|
if (e.key == "Escape") {
|
3718
3303
|
e.preventDefault();
|
3719
3304
|
e.stopImmediatePropagation();
|
@@ -3734,12 +3319,10 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3734
3319
|
value: value
|
3735
3320
|
} = input;
|
3736
3321
|
const searchResults = await ($c4d155af13ad4d4b$export$2e2bcd8739ae039).search(value);
|
3737
|
-
|
3738
3322
|
const afterRender = () => {
|
3739
3323
|
if (!this.refs.scroll.current) return;
|
3740
3324
|
this.refs.scroll.current.scrollTop = 0;
|
3741
3325
|
};
|
3742
|
-
|
3743
3326
|
if (!searchResults) return this.setState({
|
3744
3327
|
searchResults: searchResults,
|
3745
3328
|
pos: [-1, -1]
|
@@ -3748,7 +3331,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3748
3331
|
const grid = [];
|
3749
3332
|
grid.setsize = searchResults.length;
|
3750
3333
|
let row = null;
|
3751
|
-
|
3752
3334
|
for (let emoji of searchResults) {
|
3753
3335
|
if (!grid.length || row.length == this.getPerLine()) {
|
3754
3336
|
row = [];
|
@@ -3756,10 +3338,8 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3756
3338
|
row.__index = grid.length;
|
3757
3339
|
grid.push(row);
|
3758
3340
|
}
|
3759
|
-
|
3760
3341
|
row.push(emoji);
|
3761
3342
|
}
|
3762
|
-
|
3763
3343
|
this.ignoreMouse();
|
3764
3344
|
this.setState({
|
3765
3345
|
searchResults: grid,
|
@@ -3770,7 +3350,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3770
3350
|
// const specialKey = e.altKey || e.ctrlKey || e.metaKey
|
3771
3351
|
const input = e.currentTarget;
|
3772
3352
|
e.stopImmediatePropagation();
|
3773
|
-
|
3774
3353
|
switch (e.key) {
|
3775
3354
|
case "ArrowLeft":
|
3776
3355
|
// if (specialKey) return
|
@@ -3781,7 +3360,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3781
3360
|
left: true
|
3782
3361
|
});
|
3783
3362
|
break;
|
3784
|
-
|
3785
3363
|
case "ArrowRight":
|
3786
3364
|
// if (specialKey) return
|
3787
3365
|
// e.preventDefault()
|
@@ -3791,7 +3369,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3791
3369
|
right: true
|
3792
3370
|
});
|
3793
3371
|
break;
|
3794
|
-
|
3795
3372
|
case "ArrowUp":
|
3796
3373
|
// if (specialKey) return
|
3797
3374
|
// e.preventDefault()
|
@@ -3801,7 +3378,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3801
3378
|
up: true
|
3802
3379
|
});
|
3803
3380
|
break;
|
3804
|
-
|
3805
3381
|
case "ArrowDown":
|
3806
3382
|
// if (specialKey) return
|
3807
3383
|
// e.preventDefault()
|
@@ -3811,7 +3387,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3811
3387
|
down: true
|
3812
3388
|
});
|
3813
3389
|
break;
|
3814
|
-
|
3815
3390
|
case "Enter":
|
3816
3391
|
e.preventDefault();
|
3817
3392
|
this.handleEmojiClick({
|
@@ -3819,7 +3394,6 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3819
3394
|
pos: this.state.pos
|
3820
3395
|
});
|
3821
3396
|
break;
|
3822
|
-
|
3823
3397
|
case "Escape":
|
3824
3398
|
e.preventDefault();
|
3825
3399
|
if (this.state.searchResults) this.clearSearch();else this.unfocusSearch();
|
@@ -3871,32 +3445,26 @@ class $89bd6bb200cc8fef$export$2e2bcd8739ae039 extends ($fb96b826c0c5f37a$export
|
|
3871
3445
|
...this.getInitialState(props)
|
3872
3446
|
};
|
3873
3447
|
}
|
3874
|
-
|
3875
3448
|
}
|
3876
|
-
|
3877
3449
|
class $efa000751917694d$export$2e2bcd8739ae039 extends ($26f27c338a96b1a6$export$2e2bcd8739ae039) {
|
3878
3450
|
async connectedCallback() {
|
3879
3451
|
const props = ($7adb23b0109cc36a$export$75fe5f91d452f94b)(this.props, ($b247ea80b67298d5$export$2e2bcd8739ae039), this);
|
3880
3452
|
props.element = this;
|
3881
|
-
|
3882
3453
|
props.ref = component => {
|
3883
3454
|
this.component = component;
|
3884
3455
|
};
|
3885
|
-
|
3886
3456
|
await ($7adb23b0109cc36a$export$2cd8252107eb640b)(props);
|
3887
3457
|
if (this.disconnected) return;
|
3888
|
-
($fb96b826c0c5f37a$export$b3890eb0ae9dca99)( /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)(($89bd6bb200cc8fef$export$2e2bcd8739ae039), {
|
3458
|
+
($fb96b826c0c5f37a$export$b3890eb0ae9dca99)( /*#__PURE__*/($bd9dd35321b03dd4$export$34b9dba7ce09269b)(($89bd6bb200cc8fef$export$2e2bcd8739ae039), {
|
3459
|
+
...props
|
3889
3460
|
}), this.shadowRoot);
|
3890
3461
|
}
|
3891
|
-
|
3892
3462
|
constructor(props) {
|
3893
3463
|
super(props, {
|
3894
3464
|
styles: (/*@__PURE__*/$parcel$interopDefault($329d53ba9fd7125f$exports))
|
3895
3465
|
});
|
3896
3466
|
}
|
3897
|
-
|
3898
3467
|
}
|
3899
|
-
|
3900
3468
|
($c770c458706daa72$export$2e2bcd8739ae039)($efa000751917694d$export$2e2bcd8739ae039, "Props", ($b247ea80b67298d5$export$2e2bcd8739ae039));
|
3901
3469
|
if (typeof customElements !== "undefined" && !customElements.get("em-emoji-picker")) customElements.define("em-emoji-picker", $efa000751917694d$export$2e2bcd8739ae039);
|
3902
3470
|
var $329d53ba9fd7125f$exports = {};
|
@@ -3907,7 +3475,8 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
|
|
3907
3475
|
const instance = (useRef)(null);
|
3908
3476
|
if (instance.current) instance.current.update(props);
|
3909
3477
|
(useEffect)(() => {
|
3910
|
-
instance.current = new ($efa000751917694d$export$2e2bcd8739ae039)({
|
3478
|
+
instance.current = new ($efa000751917694d$export$2e2bcd8739ae039)({
|
3479
|
+
...props,
|
3911
3480
|
ref: ref
|
3912
3481
|
});
|
3913
3482
|
return () => {
|
@@ -3933,23 +3502,20 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
|
|
3933
3502
|
* @param {Props} props
|
3934
3503
|
* @return {React.FC}
|
3935
3504
|
*/
|
3936
|
-
|
3937
3505
|
function EmojiPicker(props) {
|
3938
3506
|
var theme = props.theme,
|
3939
|
-
|
3940
|
-
|
3941
|
-
|
3942
|
-
|
3943
|
-
/** @type {string[]} */
|
3507
|
+
onSelectEmoji = props.onSelectEmoji,
|
3508
|
+
disableRecent = props.disableRecent,
|
3509
|
+
customEmojis = props.customEmojis,
|
3510
|
+
language = props.language;
|
3944
3511
|
|
3512
|
+
/** @type {string[]} */
|
3945
3513
|
var categories = useMemo(function () {
|
3946
3514
|
/** @type {string[]} */
|
3947
3515
|
var categoryies = [];
|
3948
|
-
|
3949
3516
|
if (!disableRecent) {
|
3950
3517
|
categoryies.push("frequent");
|
3951
3518
|
}
|
3952
|
-
|
3953
3519
|
categoryies = [].concat(_toConsumableArray(categoryies), ["people", "nature", "foods", "activity", "places", "objects", "symbols", "flags"]);
|
3954
3520
|
return categoryies;
|
3955
3521
|
}, [disableRecent]);
|
@@ -3957,7 +3523,6 @@ function EmojiPicker(props) {
|
|
3957
3523
|
if (!language) {
|
3958
3524
|
return undefined;
|
3959
3525
|
}
|
3960
|
-
|
3961
3526
|
return require("@emoji-mart/data/i18n/".concat(language !== null && language !== void 0 ? language : 'en', ".json"));
|
3962
3527
|
}, [language]);
|
3963
3528
|
return /*#__PURE__*/React.createElement($e5534fc185f7111e$export$2e2bcd8739ae039, {
|
@@ -3971,7 +3536,6 @@ function EmojiPicker(props) {
|
|
3971
3536
|
i18n: i18n
|
3972
3537
|
});
|
3973
3538
|
}
|
3974
|
-
|
3975
3539
|
var EmojiPicker$1 = /*#__PURE__*/memo(EmojiPicker);
|
3976
3540
|
|
3977
3541
|
/**
|
@@ -3990,15 +3554,14 @@ var EmojiPicker$1 = /*#__PURE__*/memo(EmojiPicker);
|
|
3990
3554
|
* @param {Props} props
|
3991
3555
|
* @return {JSX.Element}
|
3992
3556
|
*/
|
3993
|
-
|
3994
3557
|
function EmojiPickerContainer(_ref) {
|
3995
3558
|
var showPicker = _ref.showPicker,
|
3996
|
-
|
3997
|
-
|
3998
|
-
|
3999
|
-
|
4000
|
-
|
4001
|
-
|
3559
|
+
theme = _ref.theme,
|
3560
|
+
handleSelectEmoji = _ref.handleSelectEmoji,
|
3561
|
+
disableRecent = _ref.disableRecent,
|
3562
|
+
customEmojis = _ref.customEmojis,
|
3563
|
+
position = _ref.position,
|
3564
|
+
language = _ref.language;
|
4002
3565
|
return /*#__PURE__*/React.createElement("div", {
|
4003
3566
|
className: "react-emoji-picker--container"
|
4004
3567
|
}, showPicker && /*#__PURE__*/React.createElement("div", {
|
@@ -4021,6 +3584,7 @@ function EmojiPickerContainer(_ref) {
|
|
4021
3584
|
}
|
4022
3585
|
|
4023
3586
|
var EMOJI_PICKER_CONTAINER_HEIGHT = 435;
|
3587
|
+
|
4024
3588
|
/**
|
4025
3589
|
* @typedef {import('../types/types').SanitizeFn} SanitizeFn
|
4026
3590
|
*/
|
@@ -4039,42 +3603,37 @@ var EMOJI_PICKER_CONTAINER_HEIGHT = 435;
|
|
4039
3603
|
* @property {(fn: PolluteFn) => void} addPolluteFn
|
4040
3604
|
* @property {(html: string) => void} appendContent
|
4041
3605
|
* @property {HTMLDivElement=} buttonElement
|
3606
|
+
* @property {React.MutableRefObject=} buttonRef
|
4042
3607
|
* @property {import('../types/types').Languages=} language
|
4043
3608
|
*/
|
4044
|
-
// eslint-disable-next-line valid-jsdoc
|
4045
3609
|
|
3610
|
+
// eslint-disable-next-line valid-jsdoc
|
4046
3611
|
/** @type {React.FC<Props>} */
|
4047
|
-
|
4048
3612
|
var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
4049
3613
|
var theme = props.theme,
|
4050
|
-
|
4051
|
-
|
4052
|
-
|
4053
|
-
|
4054
|
-
|
4055
|
-
|
4056
|
-
|
4057
|
-
|
4058
|
-
|
3614
|
+
keepOpened = props.keepOpened,
|
3615
|
+
disableRecent = props.disableRecent,
|
3616
|
+
customEmojis = props.customEmojis,
|
3617
|
+
addSanitizeFn = props.addSanitizeFn,
|
3618
|
+
addPolluteFn = props.addPolluteFn,
|
3619
|
+
appendContent = props.appendContent,
|
3620
|
+
buttonElement = props.buttonElement,
|
3621
|
+
buttonRef = props.buttonRef,
|
3622
|
+
language = props.language;
|
4059
3623
|
var _useState = useState(false),
|
4060
|
-
|
4061
|
-
|
4062
|
-
|
3624
|
+
_useState2 = _slicedToArray(_useState, 2),
|
3625
|
+
showPicker = _useState2[0],
|
3626
|
+
setShowPicker = _useState2[1];
|
4063
3627
|
/** @type {[HTMLDivElement | undefined, React.Dispatch<React.SetStateAction<HTMLDivElement | undefined>>]} */
|
4064
|
-
|
4065
|
-
|
4066
3628
|
var _useState3 = useState(),
|
4067
|
-
|
4068
|
-
|
4069
|
-
|
3629
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
3630
|
+
customButton = _useState4[0],
|
3631
|
+
setCustomButton = _useState4[1];
|
4070
3632
|
/** @type {['above' | 'below' | undefined, React.Dispatch<React.SetStateAction<'above' | 'below' | undefined>>]} */
|
4071
|
-
|
4072
|
-
|
4073
3633
|
var _useState5 = useState(),
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
3634
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
3635
|
+
emojiPickerPosition = _useState6[0],
|
3636
|
+
setEmojiPickerPosition = _useState6[1];
|
4078
3637
|
useEffect(function () {
|
4079
3638
|
addSanitizeFn(replaceAllTextEmojiToString);
|
4080
3639
|
}, [addSanitizeFn]);
|
@@ -4090,24 +3649,21 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
|
4090
3649
|
/** @type {HTMLElement} */
|
4091
3650
|
// @ts-ignore
|
4092
3651
|
var element = event.target;
|
4093
|
-
|
4094
3652
|
if (element.classList.contains("react-input-emoji--button") || element.classList.contains("react-input-emoji--button--icon")) {
|
4095
3653
|
return;
|
4096
3654
|
}
|
4097
|
-
|
4098
3655
|
setShowPicker(false);
|
4099
3656
|
}
|
4100
|
-
|
4101
3657
|
document.addEventListener("click", checkClickOutside);
|
4102
3658
|
return function () {
|
4103
3659
|
document.removeEventListener("click", checkClickOutside);
|
4104
3660
|
};
|
4105
3661
|
}, []);
|
3662
|
+
|
4106
3663
|
/**
|
4107
3664
|
*
|
4108
3665
|
* @param {React.MouseEvent} event
|
4109
3666
|
*/
|
4110
|
-
|
4111
3667
|
function toggleShowPicker(event) {
|
4112
3668
|
event.stopPropagation();
|
4113
3669
|
event.preventDefault();
|
@@ -4116,18 +3672,18 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
|
4116
3672
|
return !currentShowPicker;
|
4117
3673
|
});
|
4118
3674
|
}
|
3675
|
+
|
4119
3676
|
/**
|
4120
3677
|
*
|
4121
3678
|
* @param {React.MouseEvent} event
|
4122
3679
|
* @return {'above' | 'below'}
|
4123
3680
|
*/
|
4124
|
-
|
4125
|
-
|
4126
3681
|
function calcTopPosition(event) {
|
4127
3682
|
var btn = event.currentTarget;
|
4128
3683
|
var btnRect = btn.getBoundingClientRect();
|
4129
|
-
var popoverHeight = EMOJI_PICKER_CONTAINER_HEIGHT;
|
3684
|
+
var popoverHeight = EMOJI_PICKER_CONTAINER_HEIGHT;
|
4130
3685
|
|
3686
|
+
// Decide to display above or below based on available space
|
4131
3687
|
if (btnRect.top >= popoverHeight) {
|
4132
3688
|
// Display above
|
4133
3689
|
return 'above';
|
@@ -4135,30 +3691,31 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
|
4135
3691
|
// Display below
|
4136
3692
|
return 'below';
|
4137
3693
|
}
|
4138
|
-
}
|
3694
|
+
}
|
4139
3695
|
|
3696
|
+
// eslint-disable-next-line valid-jsdoc
|
4140
3697
|
/**
|
4141
3698
|
*
|
4142
3699
|
* @param {import("../types/types").EmojiMartItem} emoji
|
4143
3700
|
*/
|
4144
|
-
|
4145
|
-
|
4146
3701
|
function handleSelectEmoji(emoji) {
|
4147
3702
|
appendContent(getImageEmoji(emoji));
|
4148
|
-
|
4149
3703
|
if (!keepOpened) {
|
4150
3704
|
setShowPicker(function (currentShowPicker) {
|
4151
3705
|
return !currentShowPicker;
|
4152
3706
|
});
|
4153
3707
|
}
|
4154
3708
|
}
|
4155
|
-
|
4156
3709
|
useEffect(function () {
|
4157
|
-
|
3710
|
+
var _buttonRef$current;
|
3711
|
+
if (buttonRef !== null && buttonRef !== void 0 && (_buttonRef$current = buttonRef.current) !== null && _buttonRef$current !== void 0 && _buttonRef$current.style) {
|
3712
|
+
buttonRef.current.style.position = "relative";
|
3713
|
+
setCustomButton(buttonRef.current);
|
3714
|
+
} else if (buttonElement !== null && buttonElement !== void 0 && buttonElement.style) {
|
4158
3715
|
buttonElement.style.position = "relative";
|
4159
3716
|
setCustomButton(buttonElement);
|
4160
3717
|
}
|
4161
|
-
}, [buttonElement]);
|
3718
|
+
}, [buttonRef, buttonElement]);
|
4162
3719
|
return customButton ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EmojiPickerContainer, {
|
4163
3720
|
showPicker: showPicker,
|
4164
3721
|
theme: theme,
|
@@ -4170,7 +3727,8 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
|
4170
3727
|
}), /*#__PURE__*/React.createElement(EmojiPickerButton, {
|
4171
3728
|
showPicker: showPicker,
|
4172
3729
|
toggleShowPicker: toggleShowPicker,
|
4173
|
-
buttonElement: customButton
|
3730
|
+
buttonElement: customButton,
|
3731
|
+
buttonRef: buttonRef
|
4174
3732
|
})), customButton) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EmojiPickerContainer, {
|
4175
3733
|
showPicker: showPicker,
|
4176
3734
|
theme: theme,
|
@@ -4196,37 +3754,34 @@ function getTextFromAtToCaret() {
|
|
4196
3754
|
if (!range) return null;
|
4197
3755
|
var text = range.text.substring(range.begin, range.end);
|
4198
3756
|
return text || null;
|
4199
|
-
}
|
3757
|
+
}
|
4200
3758
|
|
3759
|
+
// eslint-disable-next-line valid-jsdoc
|
4201
3760
|
/** */
|
4202
|
-
|
4203
3761
|
function deleteTextFromAtToCaret() {
|
4204
3762
|
var range = getRangeFromAtToCaret();
|
4205
|
-
if (!range) return;
|
3763
|
+
if (!range) return;
|
4206
3764
|
|
3765
|
+
// @ts-ignore
|
4207
3766
|
range.element.deleteData(range.begin, range.end - range.begin);
|
4208
3767
|
}
|
3768
|
+
|
4209
3769
|
/**
|
4210
3770
|
*
|
4211
3771
|
* @return {{begin: number, end: number, text: string, element: Node} | null}
|
4212
3772
|
*/
|
4213
|
-
|
4214
3773
|
function getRangeFromAtToCaret() {
|
4215
3774
|
var elementWithFocus = getElementWithFocus();
|
4216
|
-
|
4217
3775
|
if (!elementWithFocus) {
|
4218
3776
|
return null;
|
4219
3777
|
}
|
4220
|
-
|
4221
3778
|
var element = elementWithFocus.element,
|
4222
|
-
|
3779
|
+
caretOffset = elementWithFocus.caretOffset;
|
4223
3780
|
var text = element.textContent;
|
4224
3781
|
var lastAt = text.lastIndexOf("@");
|
4225
|
-
|
4226
3782
|
if (lastAt === -1 || lastAt >= caretOffset || lastAt !== 0 && text[lastAt - 1] !== " ") {
|
4227
3783
|
return null;
|
4228
3784
|
}
|
4229
|
-
|
4230
3785
|
return {
|
4231
3786
|
begin: lastAt,
|
4232
3787
|
end: caretOffset,
|
@@ -4234,49 +3789,46 @@ function getRangeFromAtToCaret() {
|
|
4234
3789
|
element: element
|
4235
3790
|
};
|
4236
3791
|
}
|
3792
|
+
|
4237
3793
|
/**
|
4238
3794
|
*
|
4239
3795
|
* @return {{element: Node, caretOffset: number}}
|
4240
3796
|
*/
|
4241
|
-
|
4242
|
-
|
4243
3797
|
function getElementWithFocus() {
|
4244
3798
|
var element = getSelectionStart();
|
4245
|
-
|
4246
3799
|
if (element === null) {
|
4247
3800
|
return null;
|
4248
3801
|
}
|
4249
|
-
|
4250
3802
|
var caretOffset = 0;
|
4251
|
-
|
4252
3803
|
if (typeof window.getSelection != "undefined") {
|
4253
3804
|
var range = window.getSelection().getRangeAt(0);
|
4254
3805
|
var preCaretRange = range.cloneRange();
|
4255
3806
|
preCaretRange.selectNodeContents(element);
|
4256
3807
|
preCaretRange.setEnd(range.endContainer, range.endOffset);
|
4257
3808
|
caretOffset = preCaretRange.toString().length;
|
4258
|
-
} else if (
|
4259
|
-
|
3809
|
+
} else if (
|
3810
|
+
// @ts-ignore
|
3811
|
+
typeof document.selection != "undefined" &&
|
3812
|
+
// @ts-ignore
|
4260
3813
|
document.selection.type != "Control") {
|
4261
3814
|
// @ts-ignore
|
4262
|
-
var textRange = document.selection.createRange();
|
4263
|
-
|
3815
|
+
var textRange = document.selection.createRange();
|
3816
|
+
// @ts-ignore
|
4264
3817
|
var preCaretTextRange = document.body.createTextRange();
|
4265
3818
|
preCaretTextRange.moveToElementText(element);
|
4266
3819
|
preCaretTextRange.setEndPoint("EndToEnd", textRange);
|
4267
3820
|
caretOffset = preCaretTextRange.text.length;
|
4268
3821
|
}
|
4269
|
-
|
4270
3822
|
return {
|
4271
3823
|
element: element,
|
4272
3824
|
caretOffset: caretOffset
|
4273
3825
|
};
|
4274
3826
|
}
|
3827
|
+
|
4275
3828
|
/**
|
4276
3829
|
*
|
4277
3830
|
* @return {Node | null}
|
4278
3831
|
*/
|
4279
|
-
|
4280
3832
|
function getSelectionStart() {
|
4281
3833
|
var node = document.getSelection().anchorNode;
|
4282
3834
|
return (node === null || node === void 0 ? void 0 : node.nodeType) == 3 ? node : null;
|
@@ -4285,113 +3837,93 @@ function getSelectionStart() {
|
|
4285
3837
|
/**
|
4286
3838
|
* @typedef {import('../types/types').MentionUser} MentionUser
|
4287
3839
|
*/
|
4288
|
-
// eslint-disable-next-line valid-jsdoc
|
4289
3840
|
|
3841
|
+
// eslint-disable-next-line valid-jsdoc
|
4290
3842
|
/**
|
4291
3843
|
*
|
4292
3844
|
* @param {(text: string) => Promise<MentionUser[]>=} searchMention
|
4293
3845
|
* @returns {{mentionSearchText: string | null, mentionUsers: MentionUser[], onKeyUp: (event: React.KeyboardEvent) => void, onFocus: () => void, onSelectUser: () => void, loading: boolean}}
|
4294
3846
|
*/
|
4295
|
-
|
4296
3847
|
function useMention(searchMention) {
|
3848
|
+
var _ref2;
|
4297
3849
|
var _useState = useState(false),
|
4298
|
-
|
4299
|
-
|
4300
|
-
|
4301
|
-
/** @type {[MentionUser[], React.Dispatch<React.SetStateAction<MentionUser[]>>]} */
|
4302
|
-
|
3850
|
+
_useState2 = _slicedToArray(_useState, 2),
|
3851
|
+
loading = _useState2[0],
|
3852
|
+
setLoading = _useState2[1];
|
4303
3853
|
|
3854
|
+
/** @type {[MentionUser[], React.Dispatch<React.SetStateAction<MentionUser[]>>]} */
|
4304
3855
|
var _useState3 = useState([]),
|
4305
|
-
|
4306
|
-
|
4307
|
-
|
4308
|
-
/** @type {[string | null, React.Dispatch<React.SetStateAction<string | null>>]} */
|
4309
|
-
|
3856
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
3857
|
+
mentionUsers = _useState4[0],
|
3858
|
+
setMentionUsers = _useState4[1];
|
4310
3859
|
|
3860
|
+
/** @type {[string | null, React.Dispatch<React.SetStateAction<string | null>>]} */
|
4311
3861
|
var _useState5 = useState(null),
|
4312
|
-
|
4313
|
-
|
4314
|
-
|
4315
|
-
|
3862
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
3863
|
+
mentionSearchText = _useState6[0],
|
3864
|
+
setMentionSearchText = _useState6[1];
|
4316
3865
|
var onSelectUser = useCallback(function () {
|
4317
3866
|
deleteTextFromAtToCaret();
|
4318
3867
|
setMentionUsers([]);
|
4319
3868
|
}, []);
|
4320
|
-
/** */
|
4321
3869
|
|
3870
|
+
/** */
|
4322
3871
|
var checkMentionText = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
4323
3872
|
var metionText, users;
|
4324
3873
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
4325
|
-
while (1) {
|
4326
|
-
|
4327
|
-
|
4328
|
-
|
4329
|
-
|
4330
|
-
|
4331
|
-
if (!(metionText === null)) {
|
4332
|
-
_context.next = 6;
|
4333
|
-
break;
|
4334
|
-
}
|
4335
|
-
|
4336
|
-
setMentionUsers([]);
|
4337
|
-
_context.next = 12;
|
3874
|
+
while (1) switch (_context.prev = _context.next) {
|
3875
|
+
case 0:
|
3876
|
+
metionText = getTextFromAtToCaret();
|
3877
|
+
setMentionSearchText(metionText);
|
3878
|
+
if (!(metionText === null)) {
|
3879
|
+
_context.next = 6;
|
4338
3880
|
break;
|
4339
|
-
|
4340
|
-
|
4341
|
-
|
4342
|
-
|
4343
|
-
|
4344
|
-
|
4345
|
-
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
4350
|
-
|
4351
|
-
|
4352
|
-
|
4353
|
-
|
3881
|
+
}
|
3882
|
+
setMentionUsers([]);
|
3883
|
+
_context.next = 12;
|
3884
|
+
break;
|
3885
|
+
case 6:
|
3886
|
+
setLoading(true);
|
3887
|
+
_context.next = 9;
|
3888
|
+
return searchMention(metionText);
|
3889
|
+
case 9:
|
3890
|
+
users = _context.sent;
|
3891
|
+
setLoading(false);
|
3892
|
+
setMentionUsers(users);
|
3893
|
+
case 12:
|
3894
|
+
case "end":
|
3895
|
+
return _context.stop();
|
4354
3896
|
}
|
4355
3897
|
}, _callee);
|
4356
3898
|
})), [searchMention]);
|
4357
|
-
/** @type {(event: React.KeyboardEvent) => void} */
|
4358
3899
|
|
4359
|
-
|
4360
|
-
|
3900
|
+
/** @type {(event: React.KeyboardEvent) => void} */
|
3901
|
+
var onKeyUp = useCallback(function (_x) {
|
3902
|
+
return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
|
4361
3903
|
var _getElementWithFocus;
|
4362
|
-
|
4363
3904
|
var elementWithFocus;
|
4364
3905
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
4365
|
-
while (1) {
|
4366
|
-
|
4367
|
-
|
4368
|
-
|
4369
|
-
|
4370
|
-
|
4371
|
-
|
4372
|
-
|
4373
|
-
|
4374
|
-
|
4375
|
-
|
4376
|
-
|
4377
|
-
|
4378
|
-
|
4379
|
-
|
4380
|
-
|
4381
|
-
|
4382
|
-
|
4383
|
-
case 3:
|
4384
|
-
case "end":
|
4385
|
-
return _context2.stop();
|
4386
|
-
}
|
3906
|
+
while (1) switch (_context2.prev = _context2.next) {
|
3907
|
+
case 0:
|
3908
|
+
if (!(typeof searchMention !== "function")) {
|
3909
|
+
_context2.next = 2;
|
3910
|
+
break;
|
3911
|
+
}
|
3912
|
+
return _context2.abrupt("return");
|
3913
|
+
case 2:
|
3914
|
+
if (event.key === "Backspace" && (_getElementWithFocus = getElementWithFocus()) !== null && _getElementWithFocus !== void 0 && _getElementWithFocus.element.parentElement.hasAttribute("data-mention-id")) {
|
3915
|
+
elementWithFocus = getElementWithFocus();
|
3916
|
+
elementWithFocus.element.parentElement.remove();
|
3917
|
+
} else if (!["ArrowUp", "ArrowDown", "Esc", "Escape"].includes(event.key)) {
|
3918
|
+
checkMentionText();
|
3919
|
+
}
|
3920
|
+
case 3:
|
3921
|
+
case "end":
|
3922
|
+
return _context2.stop();
|
4387
3923
|
}
|
4388
3924
|
}, _callee2);
|
4389
|
-
}));
|
4390
|
-
|
4391
|
-
return function (_x) {
|
4392
|
-
return _ref2.apply(this, arguments);
|
4393
|
-
};
|
4394
|
-
}(), [checkMentionText, searchMention]);
|
3925
|
+
}))).apply(this, arguments);
|
3926
|
+
}, [checkMentionText, searchMention]);
|
4395
3927
|
var onFocus = useCallback(function () {
|
4396
3928
|
checkMentionText();
|
4397
3929
|
}, [checkMentionText]);
|
@@ -4424,21 +3956,18 @@ function useMention(searchMention) {
|
|
4424
3956
|
/**
|
4425
3957
|
* @typedef {{prevUser: () => void; nextUser: () => void;}} Ref
|
4426
3958
|
*/
|
4427
|
-
// eslint-disable-next-line valid-jsdoc
|
4428
3959
|
|
3960
|
+
// eslint-disable-next-line valid-jsdoc
|
4429
3961
|
/** @type {React.ForwardRefRenderFunction<Ref, Props>} */
|
4430
|
-
|
4431
3962
|
var MentionUserList = function MentionUserList(_ref, ref) {
|
4432
3963
|
var users = _ref.users,
|
4433
|
-
|
4434
|
-
|
4435
|
-
|
4436
|
-
|
3964
|
+
mentionSearchText = _ref.mentionSearchText,
|
3965
|
+
onSelect = _ref.onSelect,
|
3966
|
+
addEventListener = _ref.addEventListener;
|
4437
3967
|
var _useState = useState(0),
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4441
|
-
|
3968
|
+
_useState2 = _slicedToArray(_useState, 2),
|
3969
|
+
selectedUser = _useState2[0],
|
3970
|
+
setSelectedUser = _useState2[1];
|
4442
3971
|
useImperativeHandle(ref, function () {
|
4443
3972
|
return {
|
4444
3973
|
prevUser: function prevUser() {
|
@@ -4446,7 +3975,6 @@ var MentionUserList = function MentionUserList(_ref, ref) {
|
|
4446
3975
|
if (currentSelectedUser === 0) {
|
4447
3976
|
return 0;
|
4448
3977
|
}
|
4449
|
-
|
4450
3978
|
return currentSelectedUser - 1;
|
4451
3979
|
});
|
4452
3980
|
},
|
@@ -4455,7 +3983,6 @@ var MentionUserList = function MentionUserList(_ref, ref) {
|
|
4455
3983
|
if (currentSelectedUser === users.length - 1) {
|
4456
3984
|
return users.length - 1;
|
4457
3985
|
}
|
4458
|
-
|
4459
3986
|
return currentSelectedUser + 1;
|
4460
3987
|
});
|
4461
3988
|
}
|
@@ -4464,24 +3991,22 @@ var MentionUserList = function MentionUserList(_ref, ref) {
|
|
4464
3991
|
useEffect(function () {
|
4465
3992
|
setSelectedUser(0);
|
4466
3993
|
}, [users]);
|
3994
|
+
|
4467
3995
|
/**
|
4468
3996
|
*
|
4469
3997
|
* @param {string} selectedText
|
4470
3998
|
* @param {string} rest
|
4471
3999
|
* @return {string}
|
4472
4000
|
*/
|
4473
|
-
|
4474
4001
|
function getMentionSelectedNameEl(selectedText, rest) {
|
4475
4002
|
return "<span class=\"react-input-emoji--mention--item--name__selected\" data-testid=\"metion-selected-word\">".concat(selectedText, "</span>").concat(rest);
|
4476
4003
|
}
|
4477
|
-
/** @type {(MentionUser & {nameHtml: string})[]} */
|
4478
|
-
|
4479
4004
|
|
4005
|
+
/** @type {(MentionUser & {nameHtml: string})[]} */
|
4480
4006
|
var usersFiltered = useMemo(function () {
|
4481
4007
|
var searchText = mentionSearchText ? mentionSearchText.substring(1).toLocaleLowerCase() : "";
|
4482
4008
|
return users.map(function (user) {
|
4483
4009
|
var nameHtml = user.name;
|
4484
|
-
|
4485
4010
|
if (mentionSearchText && mentionSearchText.length > 1) {
|
4486
4011
|
if (user.name.toLowerCase().startsWith(searchText)) {
|
4487
4012
|
nameHtml = getMentionSelectedNameEl(user.name.substring(0, searchText.length), user.name.substring(searchText.length));
|
@@ -4491,24 +4016,22 @@ var MentionUserList = function MentionUserList(_ref, ref) {
|
|
4491
4016
|
if (name.toLocaleLowerCase().startsWith(searchText)) {
|
4492
4017
|
return getMentionSelectedNameEl(name.substring(0, searchText.length), name.substring(searchText.length));
|
4493
4018
|
}
|
4494
|
-
|
4495
4019
|
return name;
|
4496
4020
|
}).join(" ");
|
4497
4021
|
}
|
4498
4022
|
}
|
4499
|
-
|
4500
4023
|
return _objectSpread2(_objectSpread2({}, user), {}, {
|
4501
4024
|
nameHtml: nameHtml
|
4502
4025
|
});
|
4503
4026
|
});
|
4504
|
-
}, [mentionSearchText, users]);
|
4027
|
+
}, [mentionSearchText, users]);
|
4505
4028
|
|
4029
|
+
// eslint-disable-next-line valid-jsdoc
|
4506
4030
|
/**
|
4507
4031
|
*
|
4508
4032
|
* @param {MentionUser} user
|
4509
4033
|
* @returns {(event: React.MouseEvent) => void} event
|
4510
4034
|
*/
|
4511
|
-
|
4512
4035
|
function handleClick(user) {
|
4513
4036
|
return function (event) {
|
4514
4037
|
event.stopPropagation();
|
@@ -4516,7 +4039,6 @@ var MentionUserList = function MentionUserList(_ref, ref) {
|
|
4516
4039
|
onSelect(user);
|
4517
4040
|
};
|
4518
4041
|
}
|
4519
|
-
|
4520
4042
|
useEffect(function () {
|
4521
4043
|
var unsubscribe = addEventListener("enter", function (event) {
|
4522
4044
|
event.stopPropagation();
|
@@ -4551,7 +4073,6 @@ var MentionUserList = function MentionUserList(_ref, ref) {
|
|
4551
4073
|
})));
|
4552
4074
|
}));
|
4553
4075
|
};
|
4554
|
-
|
4555
4076
|
var MentionUserListWithRef = /*#__PURE__*/forwardRef(MentionUserList);
|
4556
4077
|
MentionUserListWithRef.propTypes = {
|
4557
4078
|
users: t.array.isRequired
|
@@ -4576,32 +4097,27 @@ MentionUserListWithRef.propTypes = {
|
|
4576
4097
|
* @property {(html: string) => void} appendContent
|
4577
4098
|
* @property {(fn: SanitizeFn) => void} addSanitizeFn
|
4578
4099
|
*/
|
4579
|
-
// eslint-disable-next-line valid-jsdoc
|
4580
4100
|
|
4101
|
+
// eslint-disable-next-line valid-jsdoc
|
4581
4102
|
/** @type {React.FC<Props>} */
|
4582
|
-
|
4583
4103
|
var MentionWrapper = function MentionWrapper(_ref) {
|
4584
4104
|
var searchMention = _ref.searchMention,
|
4585
|
-
|
4586
|
-
|
4587
|
-
|
4588
|
-
|
4105
|
+
addEventListener = _ref.addEventListener,
|
4106
|
+
appendContent = _ref.appendContent,
|
4107
|
+
addSanitizeFn = _ref.addSanitizeFn;
|
4589
4108
|
/** @type {React.MutableRefObject<import('./mention-user-list').Ref | null>} */
|
4590
4109
|
var metionUserListRef = useRef(null);
|
4591
|
-
|
4592
4110
|
var _useState = useState(false),
|
4593
|
-
|
4594
|
-
|
4595
|
-
|
4596
|
-
|
4111
|
+
_useState2 = _slicedToArray(_useState, 2),
|
4112
|
+
showUserList = _useState2[0],
|
4113
|
+
setShowUserList = _useState2[1];
|
4597
4114
|
var _useMention = useMention(searchMention),
|
4598
|
-
|
4599
|
-
|
4600
|
-
|
4601
|
-
|
4602
|
-
|
4603
|
-
|
4604
|
-
|
4115
|
+
mentionSearchText = _useMention.mentionSearchText,
|
4116
|
+
mentionUsers = _useMention.mentionUsers,
|
4117
|
+
loading = _useMention.loading,
|
4118
|
+
onKeyUp = _useMention.onKeyUp,
|
4119
|
+
onFocus = _useMention.onFocus,
|
4120
|
+
onSelectUser = _useMention.onSelectUser;
|
4605
4121
|
useEffect(function () {
|
4606
4122
|
addSanitizeFn(function (html) {
|
4607
4123
|
var container = document.createElement("div");
|
@@ -4621,7 +4137,6 @@ var MentionWrapper = function MentionWrapper(_ref) {
|
|
4621
4137
|
function checkClickOutside() {
|
4622
4138
|
setShowUserList(false);
|
4623
4139
|
}
|
4624
|
-
|
4625
4140
|
document.addEventListener("click", checkClickOutside);
|
4626
4141
|
return function () {
|
4627
4142
|
document.removeEventListener("click", checkClickOutside);
|
@@ -4641,13 +4156,11 @@ var MentionWrapper = function MentionWrapper(_ref) {
|
|
4641
4156
|
function handleKeyDown(event) {
|
4642
4157
|
switch (event.key) {
|
4643
4158
|
case "Esc": // IE/Edge specific value
|
4644
|
-
|
4645
4159
|
case "Escape":
|
4646
4160
|
setShowUserList(false);
|
4647
4161
|
break;
|
4648
4162
|
}
|
4649
4163
|
}
|
4650
|
-
|
4651
4164
|
var unsubscribe = addEventListener("keyDown", handleKeyDown);
|
4652
4165
|
return function () {
|
4653
4166
|
unsubscribe();
|
@@ -4677,16 +4190,15 @@ var MentionWrapper = function MentionWrapper(_ref) {
|
|
4677
4190
|
};
|
4678
4191
|
}
|
4679
4192
|
}, [addEventListener, showUserList]);
|
4193
|
+
|
4680
4194
|
/**
|
4681
4195
|
*
|
4682
4196
|
* @param {MetionUser} user
|
4683
4197
|
*/
|
4684
|
-
|
4685
4198
|
function handleSelect(user) {
|
4686
4199
|
onSelectUser();
|
4687
4200
|
appendContent("<span class=\"react-input-emoji--mention--text\" data-mention-id=\"".concat(user.id, "\" data-mention-name=\"").concat(user.name, "\">@").concat(user.name, "</span> "));
|
4688
4201
|
}
|
4689
|
-
|
4690
4202
|
return /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement("div", {
|
4691
4203
|
className: "react-input-emoji--mention--container"
|
4692
4204
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -4708,8 +4220,8 @@ var MentionWrapper = function MentionWrapper(_ref) {
|
|
4708
4220
|
};
|
4709
4221
|
|
4710
4222
|
// @ts-check
|
4711
|
-
// eslint-disable-next-line valid-jsdoc
|
4712
4223
|
|
4224
|
+
// eslint-disable-next-line valid-jsdoc
|
4713
4225
|
/**
|
4714
4226
|
* @template T
|
4715
4227
|
* @returns {import('../types/types').ListenerObj<T>}
|
@@ -4731,22 +4243,20 @@ function createObserver() {
|
|
4731
4243
|
return listener(event);
|
4732
4244
|
});
|
4733
4245
|
},
|
4734
|
-
|
4735
4246
|
get currentListerners() {
|
4736
4247
|
return listeners;
|
4737
4248
|
}
|
4738
|
-
|
4739
4249
|
};
|
4740
4250
|
}
|
4741
4251
|
|
4742
4252
|
// @ts-check
|
4253
|
+
|
4743
4254
|
/**
|
4744
4255
|
* @typedef {import('../types/types').TextInputListeners} TextInputListeners
|
4745
4256
|
*/
|
4746
|
-
// eslint-disable-next-line valid-jsdoc
|
4747
4257
|
|
4258
|
+
// eslint-disable-next-line valid-jsdoc
|
4748
4259
|
/** */
|
4749
|
-
|
4750
4260
|
function useEventListeners() {
|
4751
4261
|
/** @type {TextInputListeners} */
|
4752
4262
|
var listeners = useMemo(function () {
|
@@ -4760,11 +4270,11 @@ function useEventListeners() {
|
|
4760
4270
|
blur: createObserver()
|
4761
4271
|
};
|
4762
4272
|
}, []);
|
4273
|
+
|
4763
4274
|
/**
|
4764
4275
|
* @template {keyof TextInputListeners} T, K
|
4765
4276
|
* @type {(event: keyof TextInputListeners, fn: import('../types/types').Listerner<any>) => () => void}
|
4766
4277
|
*/
|
4767
|
-
|
4768
4278
|
var addEventListener = useCallback(function (event, fn) {
|
4769
4279
|
return listeners[event].subscribe(fn);
|
4770
4280
|
}, [listeners]);
|
@@ -4775,23 +4285,23 @@ function useEventListeners() {
|
|
4775
4285
|
}
|
4776
4286
|
|
4777
4287
|
// @ts-check
|
4288
|
+
|
4778
4289
|
/**
|
4779
4290
|
* @typedef {import('../types/types').PolluteFn} PolluteFn
|
4780
4291
|
*/
|
4781
|
-
// eslint-disable-next-line valid-jsdoc
|
4782
4292
|
|
4293
|
+
// eslint-disable-next-line valid-jsdoc
|
4783
4294
|
/** */
|
4784
|
-
|
4785
4295
|
function usePollute() {
|
4786
4296
|
/** @type {React.MutableRefObject<PolluteFn[]>} */
|
4787
4297
|
var polluteFnsRef = useRef([]);
|
4788
|
-
/** @type {(fn: PolluteFn) => void} */
|
4789
4298
|
|
4299
|
+
/** @type {(fn: PolluteFn) => void} */
|
4790
4300
|
var addPolluteFn = useCallback(function (fn) {
|
4791
4301
|
polluteFnsRef.current.push(fn);
|
4792
4302
|
}, []);
|
4793
|
-
/** @type {(html: string) => string} */
|
4794
4303
|
|
4304
|
+
/** @type {(html: string) => string} */
|
4795
4305
|
var pollute = useCallback(function (text) {
|
4796
4306
|
var result = polluteFnsRef.current.reduce(function (acc, fn) {
|
4797
4307
|
return fn(acc);
|
@@ -4805,6 +4315,7 @@ function usePollute() {
|
|
4805
4315
|
}
|
4806
4316
|
|
4807
4317
|
// @ts-check
|
4318
|
+
|
4808
4319
|
/**
|
4809
4320
|
* @typedef {import('./types/types').MentionUser} MetionUser
|
4810
4321
|
*/
|
@@ -4841,6 +4352,7 @@ function usePollute() {
|
|
4841
4352
|
* @property {import('./types/types').Languages=} language
|
4842
4353
|
* @property {(text: string) => Promise<MetionUser[]>=} searchMention
|
4843
4354
|
* @property {HTMLDivElement=} buttonElement
|
4355
|
+
* @property {React.MutableRefObject=} buttonRef
|
4844
4356
|
*/
|
4845
4357
|
|
4846
4358
|
/**
|
@@ -4849,57 +4361,58 @@ function usePollute() {
|
|
4849
4361
|
* @param {React.Ref<any>} ref
|
4850
4362
|
* @return {JSX.Element}
|
4851
4363
|
*/
|
4852
|
-
|
4853
4364
|
function InputEmoji(props, ref) {
|
4854
4365
|
var onChange = props.onChange,
|
4855
|
-
|
4856
|
-
|
4857
|
-
|
4858
|
-
|
4859
|
-
|
4860
|
-
|
4861
|
-
|
4862
|
-
|
4863
|
-
|
4864
|
-
|
4865
|
-
|
4866
|
-
|
4867
|
-
|
4868
|
-
|
4869
|
-
|
4870
|
-
|
4871
|
-
|
4872
|
-
|
4873
|
-
|
4874
|
-
|
4875
|
-
|
4876
|
-
|
4877
|
-
|
4878
|
-
|
4879
|
-
|
4366
|
+
onEnter = props.onEnter,
|
4367
|
+
shouldReturn = props.shouldReturn,
|
4368
|
+
onResize = props.onResize,
|
4369
|
+
onClick = props.onClick,
|
4370
|
+
onFocus = props.onFocus,
|
4371
|
+
onBlur = props.onBlur,
|
4372
|
+
onKeyDown = props.onKeyDown,
|
4373
|
+
theme = props.theme,
|
4374
|
+
cleanOnEnter = props.cleanOnEnter,
|
4375
|
+
placeholder = props.placeholder,
|
4376
|
+
maxLength = props.maxLength,
|
4377
|
+
keepOpened = props.keepOpened,
|
4378
|
+
inputClass = props.inputClass,
|
4379
|
+
disableRecent = props.disableRecent,
|
4380
|
+
tabIndex = props.tabIndex,
|
4381
|
+
value = props.value,
|
4382
|
+
customEmojis = props.customEmojis,
|
4383
|
+
language = props.language,
|
4384
|
+
searchMention = props.searchMention,
|
4385
|
+
buttonElement = props.buttonElement,
|
4386
|
+
buttonRef = props.buttonRef,
|
4387
|
+
borderRadius = props.borderRadius,
|
4388
|
+
borderColor = props.borderColor,
|
4389
|
+
fontSize = props.fontSize,
|
4390
|
+
fontFamily = props.fontFamily;
|
4880
4391
|
|
4392
|
+
/** @type {React.MutableRefObject<import('./text-input').Ref | null>} */
|
4881
4393
|
var textInputRef = useRef(null);
|
4882
|
-
|
4883
4394
|
var _useEventListeners = useEventListeners(),
|
4884
|
-
|
4885
|
-
|
4886
|
-
|
4395
|
+
addEventListener = _useEventListeners.addEventListener,
|
4396
|
+
listeners = _useEventListeners.listeners;
|
4887
4397
|
var _useSanitize = useSanitize(props.shouldReturn),
|
4888
|
-
|
4889
|
-
|
4890
|
-
|
4891
|
-
|
4398
|
+
addSanitizeFn = _useSanitize.addSanitizeFn,
|
4399
|
+
sanitize = _useSanitize.sanitize,
|
4400
|
+
sanitizedTextRef = _useSanitize.sanitizedTextRef;
|
4892
4401
|
var _usePollute = usePollute(),
|
4893
|
-
|
4894
|
-
|
4895
|
-
|
4402
|
+
addPolluteFn = _usePollute.addPolluteFn,
|
4403
|
+
pollute = _usePollute.pollute;
|
4896
4404
|
var updateHTML = useCallback(function () {
|
4897
4405
|
var nextValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
4898
4406
|
if (textInputRef.current === null) return;
|
4899
4407
|
textInputRef.current.html = replaceAllTextEmojis(nextValue);
|
4900
4408
|
sanitizedTextRef.current = nextValue;
|
4901
4409
|
}, [sanitizedTextRef]);
|
4902
|
-
var setValue = useCallback(
|
4410
|
+
var setValue = useCallback(
|
4411
|
+
/**
|
4412
|
+
*
|
4413
|
+
* @param {string} value
|
4414
|
+
*/
|
4415
|
+
function (value) {
|
4903
4416
|
updateHTML(value);
|
4904
4417
|
}, [updateHTML]);
|
4905
4418
|
var emitChange = useEmit(textInputRef, onResize, onChange);
|
@@ -4914,9 +4427,11 @@ function InputEmoji(props, ref) {
|
|
4914
4427
|
setValue(value);
|
4915
4428
|
}
|
4916
4429
|
}, [sanitizedTextRef, setValue, value]);
|
4917
|
-
|
4918
|
-
|
4919
|
-
|
4430
|
+
|
4431
|
+
// useEffect(() => {
|
4432
|
+
// updateHTML();
|
4433
|
+
// }, [updateHTML]);
|
4434
|
+
|
4920
4435
|
useEffect(function () {
|
4921
4436
|
/**
|
4922
4437
|
* Handle keydown event
|
@@ -4927,34 +4442,26 @@ function InputEmoji(props, ref) {
|
|
4927
4442
|
if (typeof maxLength !== "undefined" && event.key !== "Backspace" && textInputRef.current !== null && totalCharacters(textInputRef.current) >= maxLength) {
|
4928
4443
|
event.preventDefault();
|
4929
4444
|
}
|
4930
|
-
|
4931
4445
|
if (event.key === "Enter" && textInputRef.current) {
|
4932
4446
|
event.preventDefault();
|
4933
4447
|
var text = sanitize(textInputRef.current.html);
|
4934
4448
|
emitChange(sanitizedTextRef.current);
|
4935
|
-
|
4936
4449
|
if (typeof onEnter === "function" && listeners.enter.currentListerners.length === 0) {
|
4937
4450
|
onEnter(text);
|
4938
4451
|
}
|
4939
|
-
|
4940
4452
|
if (cleanOnEnter && listeners.enter.currentListerners.length === 0) {
|
4941
4453
|
updateHTML("");
|
4942
4454
|
}
|
4943
|
-
|
4944
4455
|
if (typeof onKeyDown === "function") {
|
4945
4456
|
onKeyDown(event.nativeEvent);
|
4946
4457
|
}
|
4947
|
-
|
4948
4458
|
return false;
|
4949
4459
|
}
|
4950
|
-
|
4951
4460
|
if (typeof onKeyDown === "function") {
|
4952
4461
|
onKeyDown(event.nativeEvent);
|
4953
4462
|
}
|
4954
|
-
|
4955
4463
|
return true;
|
4956
4464
|
}
|
4957
|
-
|
4958
4465
|
var unsubscribe = addEventListener("keyDown", handleKeydown);
|
4959
4466
|
return function () {
|
4960
4467
|
unsubscribe();
|
@@ -4966,12 +4473,10 @@ function InputEmoji(props, ref) {
|
|
4966
4473
|
if (typeof onClick === "function") {
|
4967
4474
|
onClick();
|
4968
4475
|
}
|
4969
|
-
|
4970
4476
|
if (typeof onFocus === "function") {
|
4971
4477
|
onFocus();
|
4972
4478
|
}
|
4973
4479
|
}
|
4974
|
-
|
4975
4480
|
var unsubscribe = addEventListener("focus", handleFocus);
|
4976
4481
|
return function () {
|
4977
4482
|
unsubscribe();
|
@@ -4984,79 +4489,70 @@ function InputEmoji(props, ref) {
|
|
4984
4489
|
onBlur();
|
4985
4490
|
}
|
4986
4491
|
}
|
4987
|
-
|
4988
4492
|
var unsubscribe = addEventListener("blur", handleBlur);
|
4989
4493
|
return function () {
|
4990
4494
|
unsubscribe();
|
4991
4495
|
};
|
4992
4496
|
}, [addEventListener, onBlur]);
|
4497
|
+
|
4993
4498
|
/**
|
4994
4499
|
*
|
4995
4500
|
* @param {string} html
|
4996
4501
|
*/
|
4997
|
-
|
4998
4502
|
function handleTextInputChange(html) {
|
4999
4503
|
sanitize(html);
|
5000
|
-
|
4504
|
+
if (value !== sanitizedTextRef.current) {
|
4505
|
+
emitChange(sanitizedTextRef.current);
|
4506
|
+
}
|
5001
4507
|
}
|
4508
|
+
|
5002
4509
|
/**
|
5003
4510
|
*
|
5004
4511
|
* @param {string} html
|
5005
4512
|
*/
|
5006
|
-
|
5007
|
-
|
5008
4513
|
function appendContent(html) {
|
5009
4514
|
if (typeof maxLength !== "undefined" && textInputRef.current !== null && totalCharacters(textInputRef.current) >= maxLength) {
|
5010
4515
|
return;
|
5011
4516
|
}
|
5012
|
-
|
5013
4517
|
if (textInputRef.current !== null) {
|
5014
4518
|
textInputRef.current.appendContent(html);
|
5015
4519
|
}
|
5016
4520
|
}
|
4521
|
+
|
5017
4522
|
/**
|
5018
4523
|
* Handle copy of current selected text
|
5019
4524
|
* @param {React.ClipboardEvent} event
|
5020
4525
|
*/
|
5021
|
-
|
5022
|
-
|
5023
4526
|
function handleCopy(event) {
|
5024
4527
|
var selection = window.getSelection();
|
5025
|
-
|
5026
4528
|
if (selection !== null) {
|
5027
4529
|
var selectedText = '';
|
5028
|
-
|
5029
4530
|
if (selection.anchorNode && selection.anchorNode.nodeType === Node.ELEMENT_NODE) {
|
5030
4531
|
// @ts-ignore
|
5031
4532
|
selectedText = selection.anchorNode.innerHTML;
|
5032
4533
|
} else if (selection.anchorNode && selection.anchorNode.nodeType === Node.TEXT_NODE) {
|
5033
4534
|
var _selection$anchorNode;
|
5034
|
-
|
5035
4535
|
selectedText = (_selection$anchorNode = selection.anchorNode.textContent) !== null && _selection$anchorNode !== void 0 ? _selection$anchorNode : '';
|
5036
4536
|
}
|
5037
|
-
|
5038
4537
|
var text = replaceAllTextEmojiToString(selectedText);
|
5039
4538
|
event.clipboardData.setData("text", text);
|
5040
4539
|
event.preventDefault();
|
5041
4540
|
}
|
5042
4541
|
}
|
4542
|
+
|
5043
4543
|
/**
|
5044
4544
|
* Handle past on input
|
5045
4545
|
* @param {React.ClipboardEvent} event
|
5046
4546
|
*/
|
5047
|
-
|
5048
|
-
|
5049
4547
|
function handlePaste(event) {
|
5050
4548
|
event.preventDefault();
|
5051
4549
|
var content;
|
5052
|
-
|
5053
4550
|
if (event.clipboardData) {
|
5054
4551
|
content = event.clipboardData.getData("text/plain");
|
5055
4552
|
content = pollute(content);
|
5056
4553
|
document.execCommand("insertHTML", false, content);
|
5057
4554
|
}
|
5058
4555
|
}
|
5059
|
-
|
5060
4556
|
return /*#__PURE__*/React.createElement("div", {
|
5061
4557
|
className: "react-emoji"
|
5062
4558
|
}, /*#__PURE__*/React.createElement(MentionWrapper, {
|
@@ -5095,15 +4591,13 @@ function InputEmoji(props, ref) {
|
|
5095
4591
|
addPolluteFn: addPolluteFn,
|
5096
4592
|
appendContent: appendContent,
|
5097
4593
|
buttonElement: buttonElement,
|
4594
|
+
buttonRef: buttonRef,
|
5098
4595
|
language: language
|
5099
4596
|
}));
|
5100
4597
|
}
|
5101
|
-
|
5102
4598
|
var InputEmojiWithRef = /*#__PURE__*/forwardRef(InputEmoji);
|
5103
4599
|
InputEmojiWithRef.defaultProps = {
|
5104
|
-
theme:
|
5105
|
-
/** @type {const} */
|
5106
|
-
"auto",
|
4600
|
+
theme: /** @type {const} */"auto",
|
5107
4601
|
height: 30,
|
5108
4602
|
placeholder: "Type a message",
|
5109
4603
|
borderRadius: 21,
|