@blocklet/discuss-kit-ux 1.6.243 → 1.6.245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat/hooks.d.ts +7 -0
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input/input.d.ts +1 -0
- package/dist/{editor-N32Ffdew.mjs → editor-DnJ6aon9.mjs} +1 -1
- package/dist/{index-Cy-AzaWZ.mjs → index-B9C3Sh2v.mjs} +1003 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +62 -61
- package/dist/index.umd.js +1082 -147
- package/package.json +7 -4
|
@@ -9,10 +9,11 @@ import { Labels2, LabelPicker } from "@blocklet/labels";
|
|
|
9
9
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
10
10
|
import { useTheme, ThemeProvider, styled } from "@mui/material/styles";
|
|
11
11
|
import { create as create$1, styled as styled$1 } from "@arcblock/ux/lib/Theme";
|
|
12
|
-
import { useEffect, useRef,
|
|
12
|
+
import require$$0, { useEffect, useRef, useState, createElement, useContext, useMemo, isValidElement, lazy, Suspense, createContext, Fragment as Fragment$1, forwardRef, useCallback } from "react";
|
|
13
13
|
import { Box, useTheme as useTheme$1, useMediaQuery, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Dialog as Dialog$1, DialogTitle, DialogContent, DialogActions, DialogContentText, Button as Button$1, Divider, Skeleton, IconButton as IconButton$2, InputBase, tooltipClasses as tooltipClasses$1, Backdrop, Autocomplete, Typography as Typography$1, TextField as TextField$1, InputAdornment, Badge as Badge$1, Paper, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
14
14
|
import isNil from "lodash/isNil";
|
|
15
15
|
import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
|
|
16
|
+
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
16
17
|
import { $getRoot, $createParagraphNode, $createTextNode, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection } from "lexical";
|
|
17
18
|
import { $isRootTextContentEmpty } from "@lexical/text";
|
|
18
19
|
import joinUrl from "url-join";
|
|
@@ -65,6 +66,7 @@ import CircularProgress from "@mui/material/CircularProgress";
|
|
|
65
66
|
import { Helmet } from "react-helmet";
|
|
66
67
|
import { Flipper, Flipped } from "react-flip-toolkit";
|
|
67
68
|
import grey$1 from "@mui/material/colors/grey";
|
|
69
|
+
import cmp from "semver-compare";
|
|
68
70
|
import bridge from "@arcblock/bridge";
|
|
69
71
|
import Fab from "@mui/material/Fab";
|
|
70
72
|
import debounce from "lodash/debounce";
|
|
@@ -535,7 +537,8 @@ const useMeasure = () => {
|
|
|
535
537
|
const size = useSize(ref);
|
|
536
538
|
return [ref, size || { width: 0, height: 0 }];
|
|
537
539
|
};
|
|
538
|
-
const BlockletEditor$2 =
|
|
540
|
+
const BlockletEditor$2 = lazyWithPreload(() => import("@blocklet/editor"));
|
|
541
|
+
const preloadInput = () => BlockletEditor$2.preload();
|
|
539
542
|
const Input = ({
|
|
540
543
|
initialContent = "",
|
|
541
544
|
send,
|
|
@@ -3913,9 +3916,923 @@ function ChannelGroup({ size = "normal", chat, children, ...rest }) {
|
|
|
3913
3916
|
] })
|
|
3914
3917
|
] });
|
|
3915
3918
|
}
|
|
3919
|
+
function getAugmentedNamespace(n) {
|
|
3920
|
+
if (n.__esModule)
|
|
3921
|
+
return n;
|
|
3922
|
+
var f = n.default;
|
|
3923
|
+
if (typeof f == "function") {
|
|
3924
|
+
var a = function a2() {
|
|
3925
|
+
if (this instanceof a2) {
|
|
3926
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
3927
|
+
}
|
|
3928
|
+
return f.apply(this, arguments);
|
|
3929
|
+
};
|
|
3930
|
+
a.prototype = f.prototype;
|
|
3931
|
+
} else
|
|
3932
|
+
a = {};
|
|
3933
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
3934
|
+
Object.keys(n).forEach(function(k) {
|
|
3935
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
3936
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
3937
|
+
enumerable: true,
|
|
3938
|
+
get: function() {
|
|
3939
|
+
return n[k];
|
|
3940
|
+
}
|
|
3941
|
+
});
|
|
3942
|
+
});
|
|
3943
|
+
return a;
|
|
3944
|
+
}
|
|
3945
|
+
var lib = {};
|
|
3946
|
+
var useInterval$1 = {};
|
|
3947
|
+
Object.defineProperty(useInterval$1, "__esModule", {
|
|
3948
|
+
value: true
|
|
3949
|
+
});
|
|
3950
|
+
useInterval$1.default = useInterval;
|
|
3951
|
+
var _react$2 = require$$0;
|
|
3952
|
+
function useInterval(callback, delay) {
|
|
3953
|
+
const savedCallback = (0, _react$2.useRef)();
|
|
3954
|
+
(0, _react$2.useEffect)(() => {
|
|
3955
|
+
savedCallback.current = callback;
|
|
3956
|
+
}, [callback]);
|
|
3957
|
+
(0, _react$2.useEffect)(() => {
|
|
3958
|
+
function tick() {
|
|
3959
|
+
savedCallback.current();
|
|
3960
|
+
}
|
|
3961
|
+
if (delay !== null) {
|
|
3962
|
+
const id2 = setInterval(tick, delay);
|
|
3963
|
+
return () => clearInterval(id2);
|
|
3964
|
+
}
|
|
3965
|
+
}, [delay]);
|
|
3966
|
+
}
|
|
3967
|
+
var useStorage$1 = {};
|
|
3968
|
+
const privateData = /* @__PURE__ */ new WeakMap();
|
|
3969
|
+
const wrappers = /* @__PURE__ */ new WeakMap();
|
|
3970
|
+
function pd(event) {
|
|
3971
|
+
const retv = privateData.get(event);
|
|
3972
|
+
console.assert(
|
|
3973
|
+
retv != null,
|
|
3974
|
+
"'this' is expected an Event object, but got",
|
|
3975
|
+
event
|
|
3976
|
+
);
|
|
3977
|
+
return retv;
|
|
3978
|
+
}
|
|
3979
|
+
function setCancelFlag(data) {
|
|
3980
|
+
if (data.passiveListener != null) {
|
|
3981
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
3982
|
+
console.error(
|
|
3983
|
+
"Unable to preventDefault inside passive event listener invocation.",
|
|
3984
|
+
data.passiveListener
|
|
3985
|
+
);
|
|
3986
|
+
}
|
|
3987
|
+
return;
|
|
3988
|
+
}
|
|
3989
|
+
if (!data.event.cancelable) {
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
data.canceled = true;
|
|
3993
|
+
if (typeof data.event.preventDefault === "function") {
|
|
3994
|
+
data.event.preventDefault();
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
function Event(eventTarget, event) {
|
|
3998
|
+
privateData.set(this, {
|
|
3999
|
+
eventTarget,
|
|
4000
|
+
event,
|
|
4001
|
+
eventPhase: 2,
|
|
4002
|
+
currentTarget: eventTarget,
|
|
4003
|
+
canceled: false,
|
|
4004
|
+
stopped: false,
|
|
4005
|
+
immediateStopped: false,
|
|
4006
|
+
passiveListener: null,
|
|
4007
|
+
timeStamp: event.timeStamp || Date.now()
|
|
4008
|
+
});
|
|
4009
|
+
Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
|
|
4010
|
+
const keys = Object.keys(event);
|
|
4011
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
4012
|
+
const key = keys[i];
|
|
4013
|
+
if (!(key in this)) {
|
|
4014
|
+
Object.defineProperty(this, key, defineRedirectDescriptor(key));
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
Event.prototype = {
|
|
4019
|
+
/**
|
|
4020
|
+
* The type of this event.
|
|
4021
|
+
* @type {string}
|
|
4022
|
+
*/
|
|
4023
|
+
get type() {
|
|
4024
|
+
return pd(this).event.type;
|
|
4025
|
+
},
|
|
4026
|
+
/**
|
|
4027
|
+
* The target of this event.
|
|
4028
|
+
* @type {EventTarget}
|
|
4029
|
+
*/
|
|
4030
|
+
get target() {
|
|
4031
|
+
return pd(this).eventTarget;
|
|
4032
|
+
},
|
|
4033
|
+
/**
|
|
4034
|
+
* The target of this event.
|
|
4035
|
+
* @type {EventTarget}
|
|
4036
|
+
*/
|
|
4037
|
+
get currentTarget() {
|
|
4038
|
+
return pd(this).currentTarget;
|
|
4039
|
+
},
|
|
4040
|
+
/**
|
|
4041
|
+
* @returns {EventTarget[]} The composed path of this event.
|
|
4042
|
+
*/
|
|
4043
|
+
composedPath() {
|
|
4044
|
+
const currentTarget = pd(this).currentTarget;
|
|
4045
|
+
if (currentTarget == null) {
|
|
4046
|
+
return [];
|
|
4047
|
+
}
|
|
4048
|
+
return [currentTarget];
|
|
4049
|
+
},
|
|
4050
|
+
/**
|
|
4051
|
+
* Constant of NONE.
|
|
4052
|
+
* @type {number}
|
|
4053
|
+
*/
|
|
4054
|
+
get NONE() {
|
|
4055
|
+
return 0;
|
|
4056
|
+
},
|
|
4057
|
+
/**
|
|
4058
|
+
* Constant of CAPTURING_PHASE.
|
|
4059
|
+
* @type {number}
|
|
4060
|
+
*/
|
|
4061
|
+
get CAPTURING_PHASE() {
|
|
4062
|
+
return 1;
|
|
4063
|
+
},
|
|
4064
|
+
/**
|
|
4065
|
+
* Constant of AT_TARGET.
|
|
4066
|
+
* @type {number}
|
|
4067
|
+
*/
|
|
4068
|
+
get AT_TARGET() {
|
|
4069
|
+
return 2;
|
|
4070
|
+
},
|
|
4071
|
+
/**
|
|
4072
|
+
* Constant of BUBBLING_PHASE.
|
|
4073
|
+
* @type {number}
|
|
4074
|
+
*/
|
|
4075
|
+
get BUBBLING_PHASE() {
|
|
4076
|
+
return 3;
|
|
4077
|
+
},
|
|
4078
|
+
/**
|
|
4079
|
+
* The target of this event.
|
|
4080
|
+
* @type {number}
|
|
4081
|
+
*/
|
|
4082
|
+
get eventPhase() {
|
|
4083
|
+
return pd(this).eventPhase;
|
|
4084
|
+
},
|
|
4085
|
+
/**
|
|
4086
|
+
* Stop event bubbling.
|
|
4087
|
+
* @returns {void}
|
|
4088
|
+
*/
|
|
4089
|
+
stopPropagation() {
|
|
4090
|
+
const data = pd(this);
|
|
4091
|
+
data.stopped = true;
|
|
4092
|
+
if (typeof data.event.stopPropagation === "function") {
|
|
4093
|
+
data.event.stopPropagation();
|
|
4094
|
+
}
|
|
4095
|
+
},
|
|
4096
|
+
/**
|
|
4097
|
+
* Stop event bubbling.
|
|
4098
|
+
* @returns {void}
|
|
4099
|
+
*/
|
|
4100
|
+
stopImmediatePropagation() {
|
|
4101
|
+
const data = pd(this);
|
|
4102
|
+
data.stopped = true;
|
|
4103
|
+
data.immediateStopped = true;
|
|
4104
|
+
if (typeof data.event.stopImmediatePropagation === "function") {
|
|
4105
|
+
data.event.stopImmediatePropagation();
|
|
4106
|
+
}
|
|
4107
|
+
},
|
|
4108
|
+
/**
|
|
4109
|
+
* The flag to be bubbling.
|
|
4110
|
+
* @type {boolean}
|
|
4111
|
+
*/
|
|
4112
|
+
get bubbles() {
|
|
4113
|
+
return Boolean(pd(this).event.bubbles);
|
|
4114
|
+
},
|
|
4115
|
+
/**
|
|
4116
|
+
* The flag to be cancelable.
|
|
4117
|
+
* @type {boolean}
|
|
4118
|
+
*/
|
|
4119
|
+
get cancelable() {
|
|
4120
|
+
return Boolean(pd(this).event.cancelable);
|
|
4121
|
+
},
|
|
4122
|
+
/**
|
|
4123
|
+
* Cancel this event.
|
|
4124
|
+
* @returns {void}
|
|
4125
|
+
*/
|
|
4126
|
+
preventDefault() {
|
|
4127
|
+
setCancelFlag(pd(this));
|
|
4128
|
+
},
|
|
4129
|
+
/**
|
|
4130
|
+
* The flag to indicate cancellation state.
|
|
4131
|
+
* @type {boolean}
|
|
4132
|
+
*/
|
|
4133
|
+
get defaultPrevented() {
|
|
4134
|
+
return pd(this).canceled;
|
|
4135
|
+
},
|
|
4136
|
+
/**
|
|
4137
|
+
* The flag to be composed.
|
|
4138
|
+
* @type {boolean}
|
|
4139
|
+
*/
|
|
4140
|
+
get composed() {
|
|
4141
|
+
return Boolean(pd(this).event.composed);
|
|
4142
|
+
},
|
|
4143
|
+
/**
|
|
4144
|
+
* The unix time of this event.
|
|
4145
|
+
* @type {number}
|
|
4146
|
+
*/
|
|
4147
|
+
get timeStamp() {
|
|
4148
|
+
return pd(this).timeStamp;
|
|
4149
|
+
},
|
|
4150
|
+
/**
|
|
4151
|
+
* The target of this event.
|
|
4152
|
+
* @type {EventTarget}
|
|
4153
|
+
* @deprecated
|
|
4154
|
+
*/
|
|
4155
|
+
get srcElement() {
|
|
4156
|
+
return pd(this).eventTarget;
|
|
4157
|
+
},
|
|
4158
|
+
/**
|
|
4159
|
+
* The flag to stop event bubbling.
|
|
4160
|
+
* @type {boolean}
|
|
4161
|
+
* @deprecated
|
|
4162
|
+
*/
|
|
4163
|
+
get cancelBubble() {
|
|
4164
|
+
return pd(this).stopped;
|
|
4165
|
+
},
|
|
4166
|
+
set cancelBubble(value) {
|
|
4167
|
+
if (!value) {
|
|
4168
|
+
return;
|
|
4169
|
+
}
|
|
4170
|
+
const data = pd(this);
|
|
4171
|
+
data.stopped = true;
|
|
4172
|
+
if (typeof data.event.cancelBubble === "boolean") {
|
|
4173
|
+
data.event.cancelBubble = true;
|
|
4174
|
+
}
|
|
4175
|
+
},
|
|
4176
|
+
/**
|
|
4177
|
+
* The flag to indicate cancellation state.
|
|
4178
|
+
* @type {boolean}
|
|
4179
|
+
* @deprecated
|
|
4180
|
+
*/
|
|
4181
|
+
get returnValue() {
|
|
4182
|
+
return !pd(this).canceled;
|
|
4183
|
+
},
|
|
4184
|
+
set returnValue(value) {
|
|
4185
|
+
if (!value) {
|
|
4186
|
+
setCancelFlag(pd(this));
|
|
4187
|
+
}
|
|
4188
|
+
},
|
|
4189
|
+
/**
|
|
4190
|
+
* Initialize this event object. But do nothing under event dispatching.
|
|
4191
|
+
* @param {string} type The event type.
|
|
4192
|
+
* @param {boolean} [bubbles=false] The flag to be possible to bubble up.
|
|
4193
|
+
* @param {boolean} [cancelable=false] The flag to be possible to cancel.
|
|
4194
|
+
* @deprecated
|
|
4195
|
+
*/
|
|
4196
|
+
initEvent() {
|
|
4197
|
+
}
|
|
4198
|
+
};
|
|
4199
|
+
Object.defineProperty(Event.prototype, "constructor", {
|
|
4200
|
+
value: Event,
|
|
4201
|
+
configurable: true,
|
|
4202
|
+
writable: true
|
|
4203
|
+
});
|
|
4204
|
+
if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
|
|
4205
|
+
Object.setPrototypeOf(Event.prototype, window.Event.prototype);
|
|
4206
|
+
wrappers.set(window.Event.prototype, Event);
|
|
4207
|
+
}
|
|
4208
|
+
function defineRedirectDescriptor(key) {
|
|
4209
|
+
return {
|
|
4210
|
+
get() {
|
|
4211
|
+
return pd(this).event[key];
|
|
4212
|
+
},
|
|
4213
|
+
set(value) {
|
|
4214
|
+
pd(this).event[key] = value;
|
|
4215
|
+
},
|
|
4216
|
+
configurable: true,
|
|
4217
|
+
enumerable: true
|
|
4218
|
+
};
|
|
4219
|
+
}
|
|
4220
|
+
function defineCallDescriptor(key) {
|
|
4221
|
+
return {
|
|
4222
|
+
value() {
|
|
4223
|
+
const event = pd(this).event;
|
|
4224
|
+
return event[key].apply(event, arguments);
|
|
4225
|
+
},
|
|
4226
|
+
configurable: true,
|
|
4227
|
+
enumerable: true
|
|
4228
|
+
};
|
|
4229
|
+
}
|
|
4230
|
+
function defineWrapper(BaseEvent, proto) {
|
|
4231
|
+
const keys = Object.keys(proto);
|
|
4232
|
+
if (keys.length === 0) {
|
|
4233
|
+
return BaseEvent;
|
|
4234
|
+
}
|
|
4235
|
+
function CustomEvent2(eventTarget, event) {
|
|
4236
|
+
BaseEvent.call(this, eventTarget, event);
|
|
4237
|
+
}
|
|
4238
|
+
CustomEvent2.prototype = Object.create(BaseEvent.prototype, {
|
|
4239
|
+
constructor: { value: CustomEvent2, configurable: true, writable: true }
|
|
4240
|
+
});
|
|
4241
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
4242
|
+
const key = keys[i];
|
|
4243
|
+
if (!(key in BaseEvent.prototype)) {
|
|
4244
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
4245
|
+
const isFunc = typeof descriptor.value === "function";
|
|
4246
|
+
Object.defineProperty(
|
|
4247
|
+
CustomEvent2.prototype,
|
|
4248
|
+
key,
|
|
4249
|
+
isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key)
|
|
4250
|
+
);
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
return CustomEvent2;
|
|
4254
|
+
}
|
|
4255
|
+
function getWrapper(proto) {
|
|
4256
|
+
if (proto == null || proto === Object.prototype) {
|
|
4257
|
+
return Event;
|
|
4258
|
+
}
|
|
4259
|
+
let wrapper = wrappers.get(proto);
|
|
4260
|
+
if (wrapper == null) {
|
|
4261
|
+
wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
|
|
4262
|
+
wrappers.set(proto, wrapper);
|
|
4263
|
+
}
|
|
4264
|
+
return wrapper;
|
|
4265
|
+
}
|
|
4266
|
+
function wrapEvent(eventTarget, event) {
|
|
4267
|
+
const Wrapper = getWrapper(Object.getPrototypeOf(event));
|
|
4268
|
+
return new Wrapper(eventTarget, event);
|
|
4269
|
+
}
|
|
4270
|
+
function isStopped(event) {
|
|
4271
|
+
return pd(event).immediateStopped;
|
|
4272
|
+
}
|
|
4273
|
+
function setEventPhase(event, eventPhase) {
|
|
4274
|
+
pd(event).eventPhase = eventPhase;
|
|
4275
|
+
}
|
|
4276
|
+
function setCurrentTarget(event, currentTarget) {
|
|
4277
|
+
pd(event).currentTarget = currentTarget;
|
|
4278
|
+
}
|
|
4279
|
+
function setPassiveListener(event, passiveListener) {
|
|
4280
|
+
pd(event).passiveListener = passiveListener;
|
|
4281
|
+
}
|
|
4282
|
+
const listenersMap = /* @__PURE__ */ new WeakMap();
|
|
4283
|
+
const CAPTURE = 1;
|
|
4284
|
+
const BUBBLE = 2;
|
|
4285
|
+
const ATTRIBUTE = 3;
|
|
4286
|
+
function isObject(x) {
|
|
4287
|
+
return x !== null && typeof x === "object";
|
|
4288
|
+
}
|
|
4289
|
+
function getListeners(eventTarget) {
|
|
4290
|
+
const listeners = listenersMap.get(eventTarget);
|
|
4291
|
+
if (listeners == null) {
|
|
4292
|
+
throw new TypeError(
|
|
4293
|
+
"'this' is expected an EventTarget object, but got another value."
|
|
4294
|
+
);
|
|
4295
|
+
}
|
|
4296
|
+
return listeners;
|
|
4297
|
+
}
|
|
4298
|
+
function defineEventAttributeDescriptor(eventName) {
|
|
4299
|
+
return {
|
|
4300
|
+
get() {
|
|
4301
|
+
const listeners = getListeners(this);
|
|
4302
|
+
let node = listeners.get(eventName);
|
|
4303
|
+
while (node != null) {
|
|
4304
|
+
if (node.listenerType === ATTRIBUTE) {
|
|
4305
|
+
return node.listener;
|
|
4306
|
+
}
|
|
4307
|
+
node = node.next;
|
|
4308
|
+
}
|
|
4309
|
+
return null;
|
|
4310
|
+
},
|
|
4311
|
+
set(listener) {
|
|
4312
|
+
if (typeof listener !== "function" && !isObject(listener)) {
|
|
4313
|
+
listener = null;
|
|
4314
|
+
}
|
|
4315
|
+
const listeners = getListeners(this);
|
|
4316
|
+
let prev = null;
|
|
4317
|
+
let node = listeners.get(eventName);
|
|
4318
|
+
while (node != null) {
|
|
4319
|
+
if (node.listenerType === ATTRIBUTE) {
|
|
4320
|
+
if (prev !== null) {
|
|
4321
|
+
prev.next = node.next;
|
|
4322
|
+
} else if (node.next !== null) {
|
|
4323
|
+
listeners.set(eventName, node.next);
|
|
4324
|
+
} else {
|
|
4325
|
+
listeners.delete(eventName);
|
|
4326
|
+
}
|
|
4327
|
+
} else {
|
|
4328
|
+
prev = node;
|
|
4329
|
+
}
|
|
4330
|
+
node = node.next;
|
|
4331
|
+
}
|
|
4332
|
+
if (listener !== null) {
|
|
4333
|
+
const newNode = {
|
|
4334
|
+
listener,
|
|
4335
|
+
listenerType: ATTRIBUTE,
|
|
4336
|
+
passive: false,
|
|
4337
|
+
once: false,
|
|
4338
|
+
next: null
|
|
4339
|
+
};
|
|
4340
|
+
if (prev === null) {
|
|
4341
|
+
listeners.set(eventName, newNode);
|
|
4342
|
+
} else {
|
|
4343
|
+
prev.next = newNode;
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
},
|
|
4347
|
+
configurable: true,
|
|
4348
|
+
enumerable: true
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4351
|
+
function defineEventAttribute(eventTargetPrototype, eventName) {
|
|
4352
|
+
Object.defineProperty(
|
|
4353
|
+
eventTargetPrototype,
|
|
4354
|
+
`on${eventName}`,
|
|
4355
|
+
defineEventAttributeDescriptor(eventName)
|
|
4356
|
+
);
|
|
4357
|
+
}
|
|
4358
|
+
function defineCustomEventTarget(eventNames) {
|
|
4359
|
+
function CustomEventTarget() {
|
|
4360
|
+
EventTarget.call(this);
|
|
4361
|
+
}
|
|
4362
|
+
CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
|
|
4363
|
+
constructor: {
|
|
4364
|
+
value: CustomEventTarget,
|
|
4365
|
+
configurable: true,
|
|
4366
|
+
writable: true
|
|
4367
|
+
}
|
|
4368
|
+
});
|
|
4369
|
+
for (let i = 0; i < eventNames.length; ++i) {
|
|
4370
|
+
defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
|
|
4371
|
+
}
|
|
4372
|
+
return CustomEventTarget;
|
|
4373
|
+
}
|
|
4374
|
+
function EventTarget() {
|
|
4375
|
+
if (this instanceof EventTarget) {
|
|
4376
|
+
listenersMap.set(this, /* @__PURE__ */ new Map());
|
|
4377
|
+
return;
|
|
4378
|
+
}
|
|
4379
|
+
if (arguments.length === 1 && Array.isArray(arguments[0])) {
|
|
4380
|
+
return defineCustomEventTarget(arguments[0]);
|
|
4381
|
+
}
|
|
4382
|
+
if (arguments.length > 0) {
|
|
4383
|
+
const types = new Array(arguments.length);
|
|
4384
|
+
for (let i = 0; i < arguments.length; ++i) {
|
|
4385
|
+
types[i] = arguments[i];
|
|
4386
|
+
}
|
|
4387
|
+
return defineCustomEventTarget(types);
|
|
4388
|
+
}
|
|
4389
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4390
|
+
}
|
|
4391
|
+
EventTarget.prototype = {
|
|
4392
|
+
/**
|
|
4393
|
+
* Add a given listener to this event target.
|
|
4394
|
+
* @param {string} eventName The event name to add.
|
|
4395
|
+
* @param {Function} listener The listener to add.
|
|
4396
|
+
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
|
|
4397
|
+
* @returns {void}
|
|
4398
|
+
*/
|
|
4399
|
+
addEventListener(eventName, listener, options) {
|
|
4400
|
+
if (listener == null) {
|
|
4401
|
+
return;
|
|
4402
|
+
}
|
|
4403
|
+
if (typeof listener !== "function" && !isObject(listener)) {
|
|
4404
|
+
throw new TypeError("'listener' should be a function or an object.");
|
|
4405
|
+
}
|
|
4406
|
+
const listeners = getListeners(this);
|
|
4407
|
+
const optionsIsObj = isObject(options);
|
|
4408
|
+
const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
|
|
4409
|
+
const listenerType = capture ? CAPTURE : BUBBLE;
|
|
4410
|
+
const newNode = {
|
|
4411
|
+
listener,
|
|
4412
|
+
listenerType,
|
|
4413
|
+
passive: optionsIsObj && Boolean(options.passive),
|
|
4414
|
+
once: optionsIsObj && Boolean(options.once),
|
|
4415
|
+
next: null
|
|
4416
|
+
};
|
|
4417
|
+
let node = listeners.get(eventName);
|
|
4418
|
+
if (node === void 0) {
|
|
4419
|
+
listeners.set(eventName, newNode);
|
|
4420
|
+
return;
|
|
4421
|
+
}
|
|
4422
|
+
let prev = null;
|
|
4423
|
+
while (node != null) {
|
|
4424
|
+
if (node.listener === listener && node.listenerType === listenerType) {
|
|
4425
|
+
return;
|
|
4426
|
+
}
|
|
4427
|
+
prev = node;
|
|
4428
|
+
node = node.next;
|
|
4429
|
+
}
|
|
4430
|
+
prev.next = newNode;
|
|
4431
|
+
},
|
|
4432
|
+
/**
|
|
4433
|
+
* Remove a given listener from this event target.
|
|
4434
|
+
* @param {string} eventName The event name to remove.
|
|
4435
|
+
* @param {Function} listener The listener to remove.
|
|
4436
|
+
* @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
|
|
4437
|
+
* @returns {void}
|
|
4438
|
+
*/
|
|
4439
|
+
removeEventListener(eventName, listener, options) {
|
|
4440
|
+
if (listener == null) {
|
|
4441
|
+
return;
|
|
4442
|
+
}
|
|
4443
|
+
const listeners = getListeners(this);
|
|
4444
|
+
const capture = isObject(options) ? Boolean(options.capture) : Boolean(options);
|
|
4445
|
+
const listenerType = capture ? CAPTURE : BUBBLE;
|
|
4446
|
+
let prev = null;
|
|
4447
|
+
let node = listeners.get(eventName);
|
|
4448
|
+
while (node != null) {
|
|
4449
|
+
if (node.listener === listener && node.listenerType === listenerType) {
|
|
4450
|
+
if (prev !== null) {
|
|
4451
|
+
prev.next = node.next;
|
|
4452
|
+
} else if (node.next !== null) {
|
|
4453
|
+
listeners.set(eventName, node.next);
|
|
4454
|
+
} else {
|
|
4455
|
+
listeners.delete(eventName);
|
|
4456
|
+
}
|
|
4457
|
+
return;
|
|
4458
|
+
}
|
|
4459
|
+
prev = node;
|
|
4460
|
+
node = node.next;
|
|
4461
|
+
}
|
|
4462
|
+
},
|
|
4463
|
+
/**
|
|
4464
|
+
* Dispatch a given event.
|
|
4465
|
+
* @param {Event|{type:string}} event The event to dispatch.
|
|
4466
|
+
* @returns {boolean} `false` if canceled.
|
|
4467
|
+
*/
|
|
4468
|
+
dispatchEvent(event) {
|
|
4469
|
+
if (event == null || typeof event.type !== "string") {
|
|
4470
|
+
throw new TypeError('"event.type" should be a string.');
|
|
4471
|
+
}
|
|
4472
|
+
const listeners = getListeners(this);
|
|
4473
|
+
const eventName = event.type;
|
|
4474
|
+
let node = listeners.get(eventName);
|
|
4475
|
+
if (node == null) {
|
|
4476
|
+
return true;
|
|
4477
|
+
}
|
|
4478
|
+
const wrappedEvent = wrapEvent(this, event);
|
|
4479
|
+
let prev = null;
|
|
4480
|
+
while (node != null) {
|
|
4481
|
+
if (node.once) {
|
|
4482
|
+
if (prev !== null) {
|
|
4483
|
+
prev.next = node.next;
|
|
4484
|
+
} else if (node.next !== null) {
|
|
4485
|
+
listeners.set(eventName, node.next);
|
|
4486
|
+
} else {
|
|
4487
|
+
listeners.delete(eventName);
|
|
4488
|
+
}
|
|
4489
|
+
} else {
|
|
4490
|
+
prev = node;
|
|
4491
|
+
}
|
|
4492
|
+
setPassiveListener(
|
|
4493
|
+
wrappedEvent,
|
|
4494
|
+
node.passive ? node.listener : null
|
|
4495
|
+
);
|
|
4496
|
+
if (typeof node.listener === "function") {
|
|
4497
|
+
try {
|
|
4498
|
+
node.listener.call(this, wrappedEvent);
|
|
4499
|
+
} catch (err) {
|
|
4500
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
4501
|
+
console.error(err);
|
|
4502
|
+
}
|
|
4503
|
+
}
|
|
4504
|
+
} else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
|
|
4505
|
+
node.listener.handleEvent(wrappedEvent);
|
|
4506
|
+
}
|
|
4507
|
+
if (isStopped(wrappedEvent)) {
|
|
4508
|
+
break;
|
|
4509
|
+
}
|
|
4510
|
+
node = node.next;
|
|
4511
|
+
}
|
|
4512
|
+
setPassiveListener(wrappedEvent, null);
|
|
4513
|
+
setEventPhase(wrappedEvent, 0);
|
|
4514
|
+
setCurrentTarget(wrappedEvent, null);
|
|
4515
|
+
return !wrappedEvent.defaultPrevented;
|
|
4516
|
+
}
|
|
4517
|
+
};
|
|
4518
|
+
Object.defineProperty(EventTarget.prototype, "constructor", {
|
|
4519
|
+
value: EventTarget,
|
|
4520
|
+
configurable: true,
|
|
4521
|
+
writable: true
|
|
4522
|
+
});
|
|
4523
|
+
if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
|
|
4524
|
+
Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
|
|
4525
|
+
}
|
|
4526
|
+
const eventTargetShim = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4527
|
+
__proto__: null,
|
|
4528
|
+
EventTarget,
|
|
4529
|
+
default: EventTarget,
|
|
4530
|
+
defineEventAttribute
|
|
4531
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4532
|
+
const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(eventTargetShim);
|
|
4533
|
+
Object.defineProperty(useStorage$1, "__esModule", {
|
|
4534
|
+
value: true
|
|
4535
|
+
});
|
|
4536
|
+
useStorage$1.default = useStorage;
|
|
4537
|
+
var _react$1 = require$$0;
|
|
4538
|
+
var _eventTargetShim = require$$1$1;
|
|
4539
|
+
const evtTarget = new _eventTargetShim.EventTarget();
|
|
4540
|
+
function useStorage(storage, keyPrefix) {
|
|
4541
|
+
return (key, defaultValue) => {
|
|
4542
|
+
const storeKey = "".concat(keyPrefix, ".").concat(key);
|
|
4543
|
+
const raw = storage.getItem(storeKey);
|
|
4544
|
+
const [value, setValue] = (0, _react$1.useState)(raw ? JSON.parse(raw) : defaultValue);
|
|
4545
|
+
const updater = (updatedValue) => {
|
|
4546
|
+
setValue(updatedValue);
|
|
4547
|
+
storage.setItem(storeKey, JSON.stringify(updatedValue));
|
|
4548
|
+
evtTarget.dispatchEvent(new CustomEvent("storage_change", {
|
|
4549
|
+
detail: {
|
|
4550
|
+
key
|
|
4551
|
+
}
|
|
4552
|
+
}));
|
|
4553
|
+
};
|
|
4554
|
+
if (defaultValue != null && !raw) {
|
|
4555
|
+
updater(defaultValue);
|
|
4556
|
+
}
|
|
4557
|
+
(0, _react$1.useEffect)(() => {
|
|
4558
|
+
const listener = (_ref) => {
|
|
4559
|
+
let {
|
|
4560
|
+
detail
|
|
4561
|
+
} = _ref;
|
|
4562
|
+
if (detail.key === key) {
|
|
4563
|
+
const _raw = storage.getItem(storeKey);
|
|
4564
|
+
if (_raw !== raw) {
|
|
4565
|
+
setValue(JSON.parse(_raw));
|
|
4566
|
+
}
|
|
4567
|
+
}
|
|
4568
|
+
};
|
|
4569
|
+
evtTarget.addEventListener("storage_change", listener);
|
|
4570
|
+
return () => evtTarget.removeEventListener("storage_change", listener);
|
|
4571
|
+
});
|
|
4572
|
+
return [value, updater];
|
|
4573
|
+
};
|
|
4574
|
+
}
|
|
4575
|
+
var useBrowser$1 = {};
|
|
4576
|
+
var appleIphone = /iPhone/i;
|
|
4577
|
+
var appleIpod = /iPod/i;
|
|
4578
|
+
var appleTablet = /iPad/i;
|
|
4579
|
+
var appleUniversal = /\biOS-universal(?:.+)Mac\b/i;
|
|
4580
|
+
var androidPhone = /\bAndroid(?:.+)Mobile\b/i;
|
|
4581
|
+
var androidTablet = /Android/i;
|
|
4582
|
+
var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i;
|
|
4583
|
+
var amazonTablet = /Silk/i;
|
|
4584
|
+
var windowsPhone = /Windows Phone/i;
|
|
4585
|
+
var windowsTablet = /\bWindows(?:.+)ARM\b/i;
|
|
4586
|
+
var otherBlackBerry = /BlackBerry/i;
|
|
4587
|
+
var otherBlackBerry10 = /BB10/i;
|
|
4588
|
+
var otherOpera = /Opera Mini/i;
|
|
4589
|
+
var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
|
|
4590
|
+
var otherFirefox = /Mobile(?:.+)Firefox\b/i;
|
|
4591
|
+
var isAppleTabletOnIos13 = function(navigator2) {
|
|
4592
|
+
return typeof navigator2 !== "undefined" && navigator2.platform === "MacIntel" && typeof navigator2.maxTouchPoints === "number" && navigator2.maxTouchPoints > 1 && typeof MSStream === "undefined";
|
|
4593
|
+
};
|
|
4594
|
+
function createMatch(userAgent) {
|
|
4595
|
+
return function(regex) {
|
|
4596
|
+
return regex.test(userAgent);
|
|
4597
|
+
};
|
|
4598
|
+
}
|
|
4599
|
+
function isMobile(param) {
|
|
4600
|
+
var nav = {
|
|
4601
|
+
userAgent: "",
|
|
4602
|
+
platform: "",
|
|
4603
|
+
maxTouchPoints: 0
|
|
4604
|
+
};
|
|
4605
|
+
if (!param && typeof navigator !== "undefined") {
|
|
4606
|
+
nav = {
|
|
4607
|
+
userAgent: navigator.userAgent,
|
|
4608
|
+
platform: navigator.platform,
|
|
4609
|
+
maxTouchPoints: navigator.maxTouchPoints || 0
|
|
4610
|
+
};
|
|
4611
|
+
} else if (typeof param === "string") {
|
|
4612
|
+
nav.userAgent = param;
|
|
4613
|
+
} else if (param && param.userAgent) {
|
|
4614
|
+
nav = {
|
|
4615
|
+
userAgent: param.userAgent,
|
|
4616
|
+
platform: param.platform,
|
|
4617
|
+
maxTouchPoints: param.maxTouchPoints || 0
|
|
4618
|
+
};
|
|
4619
|
+
}
|
|
4620
|
+
var userAgent = nav.userAgent;
|
|
4621
|
+
var tmp = userAgent.split("[FBAN");
|
|
4622
|
+
if (typeof tmp[1] !== "undefined") {
|
|
4623
|
+
userAgent = tmp[0];
|
|
4624
|
+
}
|
|
4625
|
+
tmp = userAgent.split("Twitter");
|
|
4626
|
+
if (typeof tmp[1] !== "undefined") {
|
|
4627
|
+
userAgent = tmp[0];
|
|
4628
|
+
}
|
|
4629
|
+
var match = createMatch(userAgent);
|
|
4630
|
+
var result = {
|
|
4631
|
+
apple: {
|
|
4632
|
+
phone: match(appleIphone) && !match(windowsPhone),
|
|
4633
|
+
ipod: match(appleIpod),
|
|
4634
|
+
tablet: !match(appleIphone) && (match(appleTablet) || isAppleTabletOnIos13(nav)) && !match(windowsPhone),
|
|
4635
|
+
universal: match(appleUniversal),
|
|
4636
|
+
device: (match(appleIphone) || match(appleIpod) || match(appleTablet) || match(appleUniversal) || isAppleTabletOnIos13(nav)) && !match(windowsPhone)
|
|
4637
|
+
},
|
|
4638
|
+
amazon: {
|
|
4639
|
+
phone: match(amazonPhone),
|
|
4640
|
+
tablet: !match(amazonPhone) && match(amazonTablet),
|
|
4641
|
+
device: match(amazonPhone) || match(amazonTablet)
|
|
4642
|
+
},
|
|
4643
|
+
android: {
|
|
4644
|
+
phone: !match(windowsPhone) && match(amazonPhone) || !match(windowsPhone) && match(androidPhone),
|
|
4645
|
+
tablet: !match(windowsPhone) && !match(amazonPhone) && !match(androidPhone) && (match(amazonTablet) || match(androidTablet)),
|
|
4646
|
+
device: !match(windowsPhone) && (match(amazonPhone) || match(amazonTablet) || match(androidPhone) || match(androidTablet)) || match(/\bokhttp\b/i)
|
|
4647
|
+
},
|
|
4648
|
+
windows: {
|
|
4649
|
+
phone: match(windowsPhone),
|
|
4650
|
+
tablet: match(windowsTablet),
|
|
4651
|
+
device: match(windowsPhone) || match(windowsTablet)
|
|
4652
|
+
},
|
|
4653
|
+
other: {
|
|
4654
|
+
blackberry: match(otherBlackBerry),
|
|
4655
|
+
blackberry10: match(otherBlackBerry10),
|
|
4656
|
+
opera: match(otherOpera),
|
|
4657
|
+
firefox: match(otherFirefox),
|
|
4658
|
+
chrome: match(otherChrome),
|
|
4659
|
+
device: match(otherBlackBerry) || match(otherBlackBerry10) || match(otherOpera) || match(otherFirefox) || match(otherChrome)
|
|
4660
|
+
},
|
|
4661
|
+
any: false,
|
|
4662
|
+
phone: false,
|
|
4663
|
+
tablet: false
|
|
4664
|
+
};
|
|
4665
|
+
result.any = result.apple.device || result.android.device || result.windows.device || result.other.device;
|
|
4666
|
+
result.phone = result.apple.phone || result.android.phone || result.windows.phone;
|
|
4667
|
+
result.tablet = result.apple.tablet || result.android.tablet || result.windows.tablet;
|
|
4668
|
+
return result;
|
|
4669
|
+
}
|
|
4670
|
+
const esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4671
|
+
__proto__: null,
|
|
4672
|
+
default: isMobile
|
|
4673
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4674
|
+
const require$$1 = /* @__PURE__ */ getAugmentedNamespace(esm);
|
|
4675
|
+
Object.defineProperty(useBrowser$1, "__esModule", {
|
|
4676
|
+
value: true
|
|
4677
|
+
});
|
|
4678
|
+
useBrowser$1.default = useBrowser;
|
|
4679
|
+
var _react = require$$0;
|
|
4680
|
+
var _ismobilejs = _interopRequireDefault(require$$1);
|
|
4681
|
+
function _interopRequireDefault(obj) {
|
|
4682
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
4683
|
+
}
|
|
4684
|
+
function ownKeys(e, r) {
|
|
4685
|
+
var t = Object.keys(e);
|
|
4686
|
+
if (Object.getOwnPropertySymbols) {
|
|
4687
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
4688
|
+
r && (o = o.filter(function(r2) {
|
|
4689
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
4690
|
+
})), t.push.apply(t, o);
|
|
4691
|
+
}
|
|
4692
|
+
return t;
|
|
4693
|
+
}
|
|
4694
|
+
function _objectSpread(e) {
|
|
4695
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
4696
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
4697
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
4698
|
+
_defineProperty(e, r2, t[r2]);
|
|
4699
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
4700
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
4701
|
+
});
|
|
4702
|
+
}
|
|
4703
|
+
return e;
|
|
4704
|
+
}
|
|
4705
|
+
function _defineProperty(obj, key, value) {
|
|
4706
|
+
key = _toPropertyKey(key);
|
|
4707
|
+
if (key in obj) {
|
|
4708
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
4709
|
+
} else {
|
|
4710
|
+
obj[key] = value;
|
|
4711
|
+
}
|
|
4712
|
+
return obj;
|
|
4713
|
+
}
|
|
4714
|
+
function _toPropertyKey(t) {
|
|
4715
|
+
var i = _toPrimitive(t, "string");
|
|
4716
|
+
return "symbol" == typeof i ? i : String(i);
|
|
4717
|
+
}
|
|
4718
|
+
function _toPrimitive(t, r) {
|
|
4719
|
+
if ("object" != typeof t || !t)
|
|
4720
|
+
return t;
|
|
4721
|
+
var e = t[Symbol.toPrimitive];
|
|
4722
|
+
if (void 0 !== e) {
|
|
4723
|
+
var i = e.call(t, r || "default");
|
|
4724
|
+
if ("object" != typeof i)
|
|
4725
|
+
return i;
|
|
4726
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4727
|
+
}
|
|
4728
|
+
return ("string" === r ? String : Number)(t);
|
|
4729
|
+
}
|
|
4730
|
+
const DID_WALLET_TAG = "ABTWallet";
|
|
4731
|
+
function getDIDWalletVersion(userAgent) {
|
|
4732
|
+
var _result$groups;
|
|
4733
|
+
const reg = new RegExp("".concat(DID_WALLET_TAG, "/(?<version>[0-9.]+)"), "g");
|
|
4734
|
+
const result = reg.exec(userAgent);
|
|
4735
|
+
const version = result === null || result === void 0 ? void 0 : (_result$groups = result.groups) === null || _result$groups === void 0 ? void 0 : _result$groups.version;
|
|
4736
|
+
return version;
|
|
4737
|
+
}
|
|
4738
|
+
function useBrowser() {
|
|
4739
|
+
var _window, _window$navigator;
|
|
4740
|
+
const userAgent = (_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent;
|
|
4741
|
+
const [browser] = (0, _react.useState)({
|
|
4742
|
+
wallet: userAgent.indexOf(DID_WALLET_TAG) > -1,
|
|
4743
|
+
walletVersion: getDIDWalletVersion(userAgent),
|
|
4744
|
+
wechat: /MicroMessenger/i.test(userAgent),
|
|
4745
|
+
mobile: _objectSpread({
|
|
4746
|
+
apple: {
|
|
4747
|
+
phone: false,
|
|
4748
|
+
ipod: false,
|
|
4749
|
+
tablet: false,
|
|
4750
|
+
device: false
|
|
4751
|
+
},
|
|
4752
|
+
amazon: {
|
|
4753
|
+
phone: false,
|
|
4754
|
+
tablet: false,
|
|
4755
|
+
device: false
|
|
4756
|
+
},
|
|
4757
|
+
android: {
|
|
4758
|
+
phone: false,
|
|
4759
|
+
tablet: false,
|
|
4760
|
+
device: false
|
|
4761
|
+
},
|
|
4762
|
+
windows: {
|
|
4763
|
+
phone: false,
|
|
4764
|
+
tablet: false,
|
|
4765
|
+
device: false
|
|
4766
|
+
},
|
|
4767
|
+
other: {
|
|
4768
|
+
blackberry: false,
|
|
4769
|
+
blackberry10: false,
|
|
4770
|
+
opera: false,
|
|
4771
|
+
firefox: false,
|
|
4772
|
+
chrome: false,
|
|
4773
|
+
device: false
|
|
4774
|
+
},
|
|
4775
|
+
phone: false,
|
|
4776
|
+
tablet: false,
|
|
4777
|
+
any: false
|
|
4778
|
+
}, (0, _ismobilejs.default)(userAgent))
|
|
4779
|
+
});
|
|
4780
|
+
return browser;
|
|
4781
|
+
}
|
|
4782
|
+
(function(exports) {
|
|
4783
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4784
|
+
value: true
|
|
4785
|
+
});
|
|
4786
|
+
Object.defineProperty(exports, "useBrowser", {
|
|
4787
|
+
enumerable: true,
|
|
4788
|
+
get: function get() {
|
|
4789
|
+
return _useBrowser.default;
|
|
4790
|
+
}
|
|
4791
|
+
});
|
|
4792
|
+
Object.defineProperty(exports, "useInterval", {
|
|
4793
|
+
enumerable: true,
|
|
4794
|
+
get: function get() {
|
|
4795
|
+
return _useInterval.default;
|
|
4796
|
+
}
|
|
4797
|
+
});
|
|
4798
|
+
Object.defineProperty(exports, "useStorage", {
|
|
4799
|
+
enumerable: true,
|
|
4800
|
+
get: function get() {
|
|
4801
|
+
return _useStorage.default;
|
|
4802
|
+
}
|
|
4803
|
+
});
|
|
4804
|
+
var _useInterval = _interopRequireDefault2(useInterval$1);
|
|
4805
|
+
var _useStorage = _interopRequireDefault2(useStorage$1);
|
|
4806
|
+
var _useBrowser = _interopRequireDefault2(useBrowser$1);
|
|
4807
|
+
function _interopRequireDefault2(obj) {
|
|
4808
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
4809
|
+
}
|
|
4810
|
+
})(lib);
|
|
4811
|
+
const useChatInWallet = () => {
|
|
4812
|
+
const navigate = useNavigate();
|
|
4813
|
+
const { walletVersion, mobile } = lib.useBrowser();
|
|
4814
|
+
const isChatInWalletV2 = useMemo(() => {
|
|
4815
|
+
try {
|
|
4816
|
+
const targetVersion = mobile.apple.device ? "5.3.2" : "5.3.0";
|
|
4817
|
+
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
4818
|
+
} catch (e) {
|
|
4819
|
+
console.error(e);
|
|
4820
|
+
return false;
|
|
4821
|
+
}
|
|
4822
|
+
}, [walletVersion, mobile]);
|
|
4823
|
+
const navigateToChat = ({ id: id2, title }) => {
|
|
4824
|
+
if (isChatInWalletV2) {
|
|
4825
|
+
navigate(`/chat-in-wallet/${id2}`);
|
|
4826
|
+
} else {
|
|
4827
|
+
bridge.call("clickChat", { id: id2, title });
|
|
4828
|
+
}
|
|
4829
|
+
};
|
|
4830
|
+
return { navigateToChat, isChatInWalletV2 };
|
|
4831
|
+
};
|
|
3916
4832
|
function ChatList({ inWallet, ...rest }) {
|
|
3917
4833
|
const { t } = useLocaleContext();
|
|
3918
4834
|
const { orderedChats, activeChatId, setActiveChat, getOppositeUser, hasUnreadMessages, getLastMessageText } = useChatContext();
|
|
4835
|
+
const { navigateToChat } = useChatInWallet();
|
|
3919
4836
|
const renderItem = (chat) => {
|
|
3920
4837
|
if (chat.type === "notification") {
|
|
3921
4838
|
return /* @__PURE__ */ jsx(SystemUser, { name: t("chat.notification") });
|
|
@@ -3985,7 +4902,7 @@ function ChatList({ inWallet, ...rest }) {
|
|
|
3985
4902
|
const getTitle = webTitleMap[chat.type] || webTitleMap.default;
|
|
3986
4903
|
return getTitle();
|
|
3987
4904
|
};
|
|
3988
|
-
|
|
4905
|
+
navigateToChat({ id: chat.id, title: getWebTitle() });
|
|
3989
4906
|
} else {
|
|
3990
4907
|
setActiveChat(chat);
|
|
3991
4908
|
}
|
|
@@ -4642,6 +5559,7 @@ function RoomTitle({ title }) {
|
|
|
4642
5559
|
}
|
|
4643
5560
|
function ChatRoom({ chat, inWallet, ...rest }) {
|
|
4644
5561
|
var _a2;
|
|
5562
|
+
const { isChatInWalletV2 } = useChatInWallet();
|
|
4645
5563
|
const { t } = useLocaleContext();
|
|
4646
5564
|
const theme = useTheme();
|
|
4647
5565
|
const downSm = useMediaQuery((currentTheme) => currentTheme.breakpoints.down("sm"));
|
|
@@ -4740,6 +5658,23 @@ function ChatRoom({ chat, inWallet, ...rest }) {
|
|
|
4740
5658
|
]
|
|
4741
5659
|
}
|
|
4742
5660
|
),
|
|
5661
|
+
!!inWallet && isChatInWalletV2 && /* @__PURE__ */ jsxs(
|
|
5662
|
+
Box$1,
|
|
5663
|
+
{
|
|
5664
|
+
sx: {
|
|
5665
|
+
display: "flex",
|
|
5666
|
+
alignItems: "center",
|
|
5667
|
+
flex: "0 0 auto",
|
|
5668
|
+
height: 52,
|
|
5669
|
+
px: 2.5,
|
|
5670
|
+
borderBottom: "1px solid #e5e5e5"
|
|
5671
|
+
},
|
|
5672
|
+
children: [
|
|
5673
|
+
downSm && /* @__PURE__ */ jsx(Back, { iconOnly: true, url: "/chat-in-wallet" }),
|
|
5674
|
+
renderRoomHeader()
|
|
5675
|
+
]
|
|
5676
|
+
}
|
|
5677
|
+
),
|
|
4743
5678
|
/* @__PURE__ */ jsx(Box$1, { sx: { flex: 1, overflow: "hidden", background: theme.palette.grey[50] }, children: /* @__PURE__ */ jsx(MessageList, { chat }) }),
|
|
4744
5679
|
/* @__PURE__ */ jsx(
|
|
4745
5680
|
Box$1,
|
|
@@ -4898,6 +5833,7 @@ function UserSearch({ sx, ...rest }) {
|
|
|
4898
5833
|
const { client: client2, isInWallet, chats, setActiveChat, createDM } = useChatContext();
|
|
4899
5834
|
const [inputValue, setInputValue] = useState("");
|
|
4900
5835
|
const [open, setOpen] = useState(false);
|
|
5836
|
+
const { navigateToChat } = useChatInWallet();
|
|
4901
5837
|
const { data, loading } = useRequest(
|
|
4902
5838
|
async () => {
|
|
4903
5839
|
if (!open) {
|
|
@@ -4974,10 +5910,10 @@ function UserSearch({ sx, ...rest }) {
|
|
|
4974
5910
|
const chat = chats.find((x) => x.id === chatId);
|
|
4975
5911
|
if (isInWallet) {
|
|
4976
5912
|
if (chat) {
|
|
4977
|
-
|
|
5913
|
+
navigateToChat({ id: chat.id, title: newValue.fullName });
|
|
4978
5914
|
} else {
|
|
4979
5915
|
const dm = await createDM(newValue.did);
|
|
4980
|
-
|
|
5916
|
+
navigateToChat({ id: dm.id, title: newValue.fullName });
|
|
4981
5917
|
}
|
|
4982
5918
|
} else if (chat) {
|
|
4983
5919
|
setActiveChat(chat);
|
|
@@ -5546,7 +6482,7 @@ function Pagination({
|
|
|
5546
6482
|
}
|
|
5547
6483
|
);
|
|
5548
6484
|
}
|
|
5549
|
-
const Editor = lazy(() => import("./editor-
|
|
6485
|
+
const Editor = lazy(() => import("./editor-DnJ6aon9.mjs"));
|
|
5550
6486
|
function LazyEditor(props) {
|
|
5551
6487
|
const fallback = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
5552
6488
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -11726,87 +12662,88 @@ function SegmentedControl({ value, options, onChange, sx, ...rest }) {
|
|
|
11726
12662
|
) });
|
|
11727
12663
|
}
|
|
11728
12664
|
export {
|
|
11729
|
-
|
|
12665
|
+
ChatHeaderAddon as $,
|
|
11730
12666
|
Avatar as A,
|
|
11731
12667
|
Badge as B,
|
|
11732
12668
|
CommentInput as C,
|
|
11733
12669
|
DefaultEditorConfigProvider as D,
|
|
11734
|
-
|
|
11735
|
-
|
|
12670
|
+
CommentsProvider as E,
|
|
12671
|
+
BinaryThumb as F,
|
|
11736
12672
|
GithubReaction as G,
|
|
11737
|
-
|
|
12673
|
+
EmptyStatus as H,
|
|
11738
12674
|
ImagePathFixerPlugin as I,
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
12675
|
+
BlogListWrapper as J,
|
|
12676
|
+
BlogCard as K,
|
|
12677
|
+
BlogPermaLink as L,
|
|
11742
12678
|
Menu as M,
|
|
11743
|
-
|
|
11744
|
-
|
|
12679
|
+
getBlogLink as N,
|
|
12680
|
+
CoverImage as O,
|
|
11745
12681
|
Pagination as P,
|
|
11746
|
-
|
|
12682
|
+
CoverImageUpload as Q,
|
|
11747
12683
|
RelativeTime as R,
|
|
11748
12684
|
ScrollableEditorWrapper as S,
|
|
11749
|
-
|
|
11750
|
-
|
|
12685
|
+
AccessControl as T,
|
|
12686
|
+
useAuthzContext as U,
|
|
11751
12687
|
VideoPathFixerPlugin as V,
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
12688
|
+
AuthzProvider as W,
|
|
12689
|
+
ChatClient as X,
|
|
12690
|
+
Chat as Y,
|
|
12691
|
+
ChatInWallet as Z,
|
|
12692
|
+
ChatListInWallet as _,
|
|
11757
12693
|
isEmptyContent as a,
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
12694
|
+
useChatContext as a0,
|
|
12695
|
+
ChatProvider as a1,
|
|
12696
|
+
UnreadNotificationContext as a2,
|
|
12697
|
+
useUnreadNotification as a3,
|
|
12698
|
+
UnreadNotificationProvider as a4,
|
|
12699
|
+
Confirm as a5,
|
|
12700
|
+
ConfirmContext as a6,
|
|
12701
|
+
useConfirm as a7,
|
|
12702
|
+
ConfirmProvider as a8,
|
|
12703
|
+
SecureLabelPicker as a9,
|
|
12704
|
+
useApiErrorHandler as aa,
|
|
12705
|
+
useDefaultApiErrorHandler as ab,
|
|
12706
|
+
DefaultApiErrorHandler as ac,
|
|
12707
|
+
Back as ad,
|
|
12708
|
+
LazyEditor as ae,
|
|
12709
|
+
EditorPreview as af,
|
|
12710
|
+
DirtyPromptContainer as ag,
|
|
12711
|
+
ConfirmNavigation as ah,
|
|
12712
|
+
UploaderContext as ai,
|
|
12713
|
+
useUploader as aj,
|
|
12714
|
+
UploaderTrigger as ak,
|
|
12715
|
+
UploaderProvider as al,
|
|
12716
|
+
composeImageUrl as am,
|
|
12717
|
+
usePointUpContext as an,
|
|
12718
|
+
PointUpProvider as ao,
|
|
12719
|
+
ButtonGroup as ap,
|
|
12720
|
+
SegmentedControl as aq,
|
|
12721
|
+
create as ar,
|
|
12722
|
+
getWsClient as as,
|
|
12723
|
+
useSubscription as at,
|
|
11787
12724
|
Input as b,
|
|
11788
12725
|
useChanged as c,
|
|
11789
12726
|
useSessionContext as d,
|
|
11790
12727
|
utils as e,
|
|
11791
|
-
|
|
12728
|
+
preferences as f,
|
|
11792
12729
|
getExcerptSync as g,
|
|
11793
|
-
|
|
12730
|
+
typography as h,
|
|
11794
12731
|
inferInitialEditorState as i,
|
|
11795
|
-
|
|
11796
|
-
|
|
12732
|
+
themeOverrides as j,
|
|
12733
|
+
InternalThemeProvider as k,
|
|
11797
12734
|
lexical as l,
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
12735
|
+
Avatars as m,
|
|
12736
|
+
AuthorInfo as n,
|
|
12737
|
+
SystemUser as o,
|
|
12738
|
+
preloadInput as p,
|
|
12739
|
+
PostContent as q,
|
|
11803
12740
|
routes as r,
|
|
11804
12741
|
stringify as s,
|
|
11805
12742
|
translations as t,
|
|
11806
12743
|
useNow as u,
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
12744
|
+
PostComponent as v,
|
|
12745
|
+
Comment as w,
|
|
12746
|
+
CommentList as x,
|
|
12747
|
+
CommentsContext as y,
|
|
12748
|
+
useCommentsContext as z
|
|
11812
12749
|
};
|