@arcblock/terminal 2.13.70 → 3.0.1

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/lib/Player.js CHANGED
@@ -1,418 +1,158 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = Player;
7
- var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _useInterval = _interopRequireDefault(require("@arcblock/react-hooks/lib/useInterval"));
10
- var _ahooks = require("ahooks");
11
- var _noop = _interopRequireDefault(require("lodash/noop"));
12
- var _Terminal = _interopRequireDefault(require("./Terminal"));
13
- require("./player.css");
14
- var _util = require("./util");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
21
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable react/no-unused-prop-types */
22
- function Player(props) {
23
- const options = Object.assign({}, _util.defaultOptions, props.options);
24
- const {
25
- frames,
26
- totalDuration
27
- } = (0, _util.formatFrames)(props.frames, options);
28
- const terminalOptions = {
29
- cols: options.cols,
30
- rows: options.rows,
31
- cursorStyle: options.cursorStyle,
32
- fontFamily: options.fontFamily,
33
- fontSize: options.fontSize,
34
- lineHeight: options.lineHeight,
35
- letterSpacing: options.letterSpacing,
36
- allowTransparency: true,
1
+ import { jsxs as f, jsx as n } from "react/jsx-runtime";
2
+ import { useRef as S, useState as O, useReducer as W, useEffect as b } from "react";
3
+ import l from "prop-types";
4
+ import H from "@arcblock/react-hooks/lib/useInterval";
5
+ import { useSize as I } from "ahooks";
6
+ import y from "lodash/isUndefined";
7
+ import h from "lodash/noop";
8
+ import A from "./Terminal.js";
9
+ /* empty css */
10
+ import { defaultOptions as U, formatFrames as L, defaultState as X, isFrameAt as F, findFrameAt as P, getPlayerClass as _, getFrameClass as $, formatTime as G } from "./util.js";
11
+ function K(C) {
12
+ const i = Object.assign({}, C);
13
+ y(i.onComplete) && (i.onComplete = h), y(i.onStart) && (i.onStart = h), y(i.onStop) && (i.onStop = h), y(i.onPause) && (i.onPause = h), y(i.onTick) && (i.onTick = h), y(i.onJump) && (i.onJump = h);
14
+ const t = Object.assign({}, U, i.options), { frames: u, totalDuration: m } = L(i.frames, t), R = {
15
+ cols: t.cols,
16
+ rows: t.rows,
17
+ cursorStyle: t.cursorStyle,
18
+ fontFamily: t.fontFamily,
19
+ fontSize: t.fontSize,
20
+ lineHeight: t.lineHeight,
21
+ letterSpacing: t.letterSpacing,
22
+ allowTransparency: !0,
37
23
  scrollback: 0
38
24
  // theme: options.theme,
39
- };
40
- const stateReducer = (state, action) => {
41
- // console.log(`dispatch.${action.type}`, action.payload);
42
- switch (action.type) {
43
- case 'jump':
44
- return _objectSpread(_objectSpread({}, state), {}, {
45
- isPlaying: false
46
- }, action.payload);
47
- case 'start':
48
- return _objectSpread(_objectSpread({}, state), {}, {
49
- isStarted: true,
50
- lastTickTime: Date.now()
51
- });
52
- case 'play':
53
- return _objectSpread(_objectSpread({}, state), {}, {
54
- isPlaying: true,
55
- lastTickTime: Date.now()
56
- }, action.payload);
57
- case 'pause':
58
- return _objectSpread(_objectSpread({}, state), {}, {
59
- isPlaying: false
60
- }, action.payload);
61
- case 'tickStart':
62
- return _objectSpread(_objectSpread({}, state), {}, {
63
- isRendering: true,
64
- lastTickTime: Date.now()
65
- }, action.payload);
66
- case 'tickEnd':
67
- return _objectSpread(_objectSpread({}, state), {}, {
68
- isRendering: false,
69
- lastTickTime: Date.now()
70
- }, action.payload);
71
- case 'reset':
72
- return _objectSpread(_objectSpread({}, state), {}, {
25
+ }, B = (a, e) => {
26
+ switch (e.type) {
27
+ case "jump":
28
+ return { ...a, isPlaying: !1, ...e.payload };
29
+ case "start":
30
+ return { ...a, isStarted: !0, lastTickTime: Date.now() };
31
+ case "play":
32
+ return {
33
+ ...a,
34
+ isPlaying: !0,
35
+ lastTickTime: Date.now(),
36
+ ...e.payload
37
+ };
38
+ case "pause":
39
+ return { ...a, isPlaying: !1, ...e.payload };
40
+ case "tickStart":
41
+ return {
42
+ ...a,
43
+ isRendering: !0,
44
+ lastTickTime: Date.now(),
45
+ ...e.payload
46
+ };
47
+ case "tickEnd":
48
+ return {
49
+ ...a,
50
+ isRendering: !1,
51
+ lastTickTime: Date.now(),
52
+ ...e.payload
53
+ };
54
+ case "reset":
55
+ return {
56
+ ...a,
73
57
  currentFrame: 0,
74
- currentTime: 0
75
- }, action.payload);
58
+ currentTime: 0,
59
+ ...e.payload
60
+ };
76
61
  default:
77
- return _objectSpread(_objectSpread({}, state), {}, {
78
- lastTickTime: Date.now()
79
- }, action.payload);
62
+ return { ...a, lastTickTime: Date.now(), ...e.payload };
80
63
  }
81
- };
82
- const terminal = (0, _react.useRef)(null);
83
- const progress = (0, _react.useRef)(null);
84
- const container = (0, _react.useRef)(null);
85
- const [maxWidth, setMaxWidth] = (0, _react.useState)(0);
86
- const size = (0, _ahooks.useSize)(document.body);
87
- const [state, dispatch] = (0, _react.useReducer)(stateReducer, _util.defaultState);
88
- const width = (size === null || size === void 0 ? void 0 : size.width) || 0;
89
- (0, _react.useEffect)(() => {
90
- if (!terminal.current) {
91
- return;
92
- }
93
- try {
94
- const COLUMN_WIDTH = 972 / 121;
95
- const child = container.current.getBoundingClientRect();
96
- let containerWidth = child.x < 0 ? child.width + child.x : child.width;
97
- if (container.current.parentNode) {
98
- const parent = container.current.parentNode.getBoundingClientRect();
99
- if (child.width > parent.width) {
100
- containerWidth = parent.width;
64
+ }, o = S(null), k = S(null), d = S(null), [D, M] = O(0), v = I(document.body), [r, c] = W(B, X), j = (v == null ? void 0 : v.width) || 0;
65
+ b(() => {
66
+ if (o.current)
67
+ try {
68
+ const a = 8.03305785123967, e = d.current.getBoundingClientRect();
69
+ let s = e.x < 0 ? e.width + e.x : e.width;
70
+ if (d.current.parentNode) {
71
+ const x = d.current.parentNode.getBoundingClientRect();
72
+ e.width > x.width && (s = x.width);
101
73
  }
74
+ t.controls && (s -= 12);
75
+ const T = Math.ceil(s / a), E = Math.min(Math.max(T, 40), t.cols);
76
+ o.current.resize(E, t.rows);
77
+ } catch {
102
78
  }
103
- if (options.controls) {
104
- containerWidth -= 12;
105
- }
106
- const colContainer = Math.ceil(containerWidth / COLUMN_WIDTH);
107
- const cols = Math.min(Math.max(colContainer, 40), options.cols);
108
- terminal.current.resize(cols, options.rows);
109
- } catch (err) {
110
- // Do nothing
111
- }
112
- // eslint-disable-next-line react-hooks/exhaustive-deps
113
- }, [width, maxWidth]);
114
-
115
- // console.log('main.render', state, { totalFrame: frames.length, totalDuration });
116
- // Render a frame
117
- const renderFrame = (frameIndex, done) => {
118
- const frame = frames[frameIndex];
119
- if (frame.content) {
120
- if (state.requireReset) {
121
- terminal.current.reset();
122
- }
123
- terminal.current.write(frame.content, () => {
124
- if (typeof done === 'function') {
125
- done();
79
+ }, [j, D]);
80
+ const w = (a, e) => {
81
+ const s = u[a];
82
+ s.content && (r.requireReset && o.current.reset(), o.current.write(s.content, () => {
83
+ typeof e == "function" && e();
84
+ }));
85
+ }, p = (a) => {
86
+ typeof i[a] == "function" && i[a]({ state: r, frames: u, options: t });
87
+ }, N = (a) => {
88
+ o.current.reset();
89
+ const e = P(u, a);
90
+ for (let s = 0; s < e; s++)
91
+ w(s);
92
+ }, q = (a) => {
93
+ if (!k.current || !o.current || !r.isStarted)
94
+ return !1;
95
+ const e = k.current.getBoundingClientRect().width, s = a.nativeEvent.offsetX, T = Math.floor(m * s / e);
96
+ return c({ type: "jump", payload: { currentTime: T } }), N(T), p("onJump"), !1;
97
+ }, g = () => (r.isStarted === !1 && (c({ type: "start" }), o.current.reset()), c({ type: "play" }), p("onStart"), !1), J = () => (c({ type: "pause" }), p("onPause"), !1), z = () => (r.currentFrame === u.length - 1 && r.currentTime === m && (c({ type: "reset" }), o.current.reset()), p("onPlay"), g());
98
+ return b(() => {
99
+ if (o.current) {
100
+ if (d.current)
101
+ try {
102
+ M(d.current.getBoundingClientRect().width);
103
+ } catch {
126
104
  }
127
- });
128
- }
129
- };
130
-
131
- // Emit a event
132
- const emitEvent = name => {
133
- if (typeof props[name] === 'function') {
134
- props[name]({
135
- state,
136
- frames,
137
- options
138
- });
139
- }
140
- };
141
- const doJump = time => {
142
- terminal.current.reset();
143
- const toFrameIndex = (0, _util.findFrameAt)(frames, time);
144
- for (let i = 0; i < toFrameIndex; i++) {
145
- renderFrame(i);
146
- }
147
- };
148
- const onJump = e => {
149
- if (!progress.current || !terminal.current || !state.isStarted) {
150
- return false;
151
- }
152
- const length = progress.current.getBoundingClientRect().width;
153
- const position = e.nativeEvent.offsetX;
154
- // console.log('onJump', { length, position, e });
155
-
156
- const currentTime = Math.floor(totalDuration * position / length);
157
- dispatch({
158
- type: 'jump',
159
- payload: {
160
- currentTime
161
- }
162
- });
163
- doJump(currentTime);
164
- emitEvent('onJump');
165
- return false;
166
- };
167
- const onStart = () => {
168
- if (state.isStarted === false) {
169
- dispatch({
170
- type: 'start'
171
- });
172
- terminal.current.reset();
173
- }
174
- dispatch({
175
- type: 'play'
176
- });
177
- emitEvent('onStart');
178
- return false;
179
- };
180
- const onPause = () => {
181
- dispatch({
182
- type: 'pause'
183
- });
184
- emitEvent('onPause');
185
- return false;
186
- };
187
- const onPlay = () => {
188
- if (state.currentFrame === frames.length - 1 && state.currentTime === totalDuration) {
189
- dispatch({
190
- type: 'reset'
191
- });
192
- terminal.current.reset();
193
- }
194
- emitEvent('onPlay');
195
- return onStart();
196
- };
197
-
198
- // Render thumbnailTime
199
- (0, _react.useEffect)(() => {
200
- if (!terminal.current) {
201
- return;
202
- }
203
- if (container.current) {
204
- try {
205
- setMaxWidth(container.current.getBoundingClientRect().width);
206
- } catch (e) {
207
- // Do nothing
208
- }
209
- }
210
- if (options.autoplay) {
211
- onStart();
212
- } else {
213
- doJump(Math.min(Math.abs(options.thumbnailTime), totalDuration));
214
- }
215
- // eslint-disable-next-line react-hooks/exhaustive-deps
216
- }, []);
217
-
218
- // Tick intervals
219
- (0, _useInterval.default)(() => {
220
- if (state.isRendering) {
221
- return false;
222
- }
223
- const tickDelay = Date.now() - state.lastTickTime;
224
- const newState = {};
225
- if (state.currentTime < totalDuration) {
226
- newState.currentTime = state.currentTime + tickDelay;
227
- }
228
- if (state.currentTime > totalDuration) {
229
- newState.currentTime = totalDuration;
230
- }
231
- const alreadyRendered = (0, _util.isFrameAt)(frames, newState.currentTime, state.currentFrame);
232
- if (state.currentFrame !== -1 && alreadyRendered) {
233
- return dispatch({
234
- type: 'tick',
235
- payload: newState
236
- });
237
- }
238
-
239
- // Reached the end
240
- if (state.currentFrame === frames.length - 1) {
241
- emitEvent('onComplete');
242
- if (options.repeat) {
243
- // console.log('tick.restart', newState, state);
244
- return dispatch({
245
- type: 'reset',
246
- payload: newState
247
- });
248
- }
249
-
250
- // console.log('tick.end', newState, state);
251
- newState.currentTime = 0;
252
- newState.currentFrame = 0;
253
- newState.requireReset = true;
254
- newState.isStarted = false;
255
- return dispatch({
256
- type: 'pause',
257
- payload: newState
258
- });
259
- }
260
-
261
- // Check if current time belongs to the next frame's duration
262
- if ((0, _util.isFrameAt)(newState.currentTime, state.currentFrame + 1)) {
263
- newState.currentFrame = state.currentFrame + 1;
264
- } else {
265
- newState.currentFrame = (0, _util.findFrameAt)(frames, newState.currentTime);
266
- }
267
-
268
- // console.log('tick.tick', newState, state);
269
- dispatch({
270
- type: 'tickStart',
271
- payload: newState
272
- });
273
- return renderFrame(newState.currentFrame, () => {
274
- if (state.requireReset) {
275
- newState.requireReset = false;
276
- }
277
- dispatch({
278
- type: 'tickEnd',
279
- payload: newState
280
- });
281
- return emitEvent('onTick');
282
- });
283
- }, state.isPlaying ? 8 : null);
284
-
285
- // If controls are enabled, we need to disable frameBox
286
- if (options.controls) {
287
- options.frameBox.title = null;
288
- options.frameBox.type = null;
289
- options.frameBox.style = {};
290
- if (options.theme.background === 'transparent') {
291
- options.frameBox.style.background = 'black';
292
- } else {
293
- options.frameBox.style.background = options.theme.background;
294
- }
295
- options.frameBox.style.padding = '10px';
296
- options.frameBox.style.paddingBottom = '40px';
297
- }
298
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
299
- className: (0, _util.getPlayerClass)(options, state),
300
- ref: container,
301
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
302
- className: "cover",
303
- onClick: onStart
304
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
305
- className: "start",
306
- onClick: onStart,
307
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
308
- style: {
309
- enableBackground: 'new 0 0 30 30'
310
- },
311
- viewBox: "0 0 30 30",
312
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("polygon", {
313
- points: "6.583,3.186 5,4.004 5,15 26,15 26.483,14.128 "
314
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("polygon", {
315
- points: "6.583,26.814 5,25.996 5,15 26,15 26.483,15.872 "
316
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
317
- cx: "26",
318
- cy: "15",
319
- r: "1"
320
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
321
- cx: "6",
322
- cy: "4",
323
- r: "1"
324
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
325
- cx: "6",
326
- cy: "26",
327
- r: "1"
328
- })]
329
- })
330
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
331
- className: "terminal",
332
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
333
- className: (0, _util.getFrameClass)(options),
334
- style: options.frameBox.style || {},
335
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
336
- className: "terminal-titlebar",
337
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
338
- className: "buttons",
339
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
340
- className: "close-button"
341
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
342
- className: "minimize-button"
343
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
344
- className: "maximize-button"
345
- })]
346
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
347
- className: "title",
348
- children: options.frameBox.title || ''
349
- })]
350
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
351
- className: "terminal-body",
352
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Terminal.default, {
353
- ref: terminal,
354
- options: terminalOptions
355
- })
356
- })]
357
- })
358
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
359
- className: "controller",
360
- children: [state.isPlaying && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
361
- className: "pause",
362
- onClick: onPause,
363
- title: "Pause",
364
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
365
- className: "icon"
366
- })
367
- }), !state.isPlaying && state.isStarted && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
368
- className: "play",
369
- onClick: onPlay,
370
- title: "Play",
371
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
372
- className: "icon"
373
- })
374
- }), !state.isPlaying && !state.isStarted && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
375
- className: "play",
376
- onClick: onStart,
377
- title: "Start",
378
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
379
- className: "icon"
380
- })
381
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
382
- className: "timer",
383
- children: (0, _util.formatTime)(state.currentTime)
384
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
385
- className: "progressbar-wrapper",
386
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
387
- className: "progressbar",
388
- ref: progress,
389
- onClick: onJump,
390
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
391
- className: "progress",
392
- style: {
393
- width: "".concat(state.currentTime / totalDuration * 100, "%")
394
- }
395
- })
396
- })
397
- })]
398
- })]
399
- });
105
+ t.autoplay ? g() : N(Math.min(Math.abs(t.thumbnailTime), m));
106
+ }
107
+ }, []), H(
108
+ () => {
109
+ if (r.isRendering)
110
+ return !1;
111
+ const a = Date.now() - r.lastTickTime, e = {};
112
+ r.currentTime < m && (e.currentTime = r.currentTime + a), r.currentTime > m && (e.currentTime = m);
113
+ const s = F(u, e.currentTime, r.currentFrame);
114
+ return r.currentFrame !== -1 && s ? c({ type: "tick", payload: e }) : r.currentFrame === u.length - 1 ? (p("onComplete"), t.repeat ? c({ type: "reset", payload: e }) : (e.currentTime = 0, e.currentFrame = 0, e.requireReset = !0, e.isStarted = !1, c({ type: "pause", payload: e }))) : (F(e.currentTime, r.currentFrame + 1) ? e.currentFrame = r.currentFrame + 1 : e.currentFrame = P(u, e.currentTime), c({ type: "tickStart", payload: e }), w(e.currentFrame, () => (r.requireReset && (e.requireReset = !1), c({ type: "tickEnd", payload: e }), p("onTick"))));
115
+ },
116
+ r.isPlaying ? 8 : null
117
+ ), t.controls && (t.frameBox.title = null, t.frameBox.type = null, t.frameBox.style = {}, t.theme.background === "transparent" ? t.frameBox.style.background = "black" : t.frameBox.style.background = t.theme.background, t.frameBox.style.padding = "10px", t.frameBox.style.paddingBottom = "40px"), /* @__PURE__ */ f("div", { className: _(t, r), ref: d, children: [
118
+ /* @__PURE__ */ n("div", { className: "cover", onClick: g }),
119
+ /* @__PURE__ */ n("div", { className: "start", onClick: g, children: /* @__PURE__ */ f("svg", { style: { enableBackground: "new 0 0 30 30" }, viewBox: "0 0 30 30", children: [
120
+ /* @__PURE__ */ n("polygon", { points: "6.583,3.186 5,4.004 5,15 26,15 26.483,14.128 " }),
121
+ /* @__PURE__ */ n("polygon", { points: "6.583,26.814 5,25.996 5,15 26,15 26.483,15.872 " }),
122
+ /* @__PURE__ */ n("circle", { cx: "26", cy: "15", r: "1" }),
123
+ /* @__PURE__ */ n("circle", { cx: "6", cy: "4", r: "1" }),
124
+ /* @__PURE__ */ n("circle", { cx: "6", cy: "26", r: "1" })
125
+ ] }) }),
126
+ /* @__PURE__ */ n("div", { className: "terminal", children: /* @__PURE__ */ f("div", { className: $(t), style: t.frameBox.style || {}, children: [
127
+ /* @__PURE__ */ f("div", { className: "terminal-titlebar", children: [
128
+ /* @__PURE__ */ f("div", { className: "buttons", children: [
129
+ /* @__PURE__ */ n("div", { className: "close-button" }),
130
+ /* @__PURE__ */ n("div", { className: "minimize-button" }),
131
+ /* @__PURE__ */ n("div", { className: "maximize-button" })
132
+ ] }),
133
+ /* @__PURE__ */ n("div", { className: "title", children: t.frameBox.title || "" })
134
+ ] }),
135
+ /* @__PURE__ */ n("div", { className: "terminal-body", children: /* @__PURE__ */ n(A, { ref: o, options: R }) })
136
+ ] }) }),
137
+ /* @__PURE__ */ f("div", { className: "controller", children: [
138
+ r.isPlaying && /* @__PURE__ */ n("div", { className: "pause", onClick: J, title: "Pause", children: /* @__PURE__ */ n("span", { className: "icon" }) }),
139
+ !r.isPlaying && r.isStarted && /* @__PURE__ */ n("div", { className: "play", onClick: z, title: "Play", children: /* @__PURE__ */ n("span", { className: "icon" }) }),
140
+ !r.isPlaying && !r.isStarted && /* @__PURE__ */ n("div", { className: "play", onClick: g, title: "Start", children: /* @__PURE__ */ n("span", { className: "icon" }) }),
141
+ /* @__PURE__ */ n("div", { className: "timer", children: G(r.currentTime) }),
142
+ /* @__PURE__ */ n("div", { className: "progressbar-wrapper", children: /* @__PURE__ */ n("div", { className: "progressbar", ref: k, onClick: q, children: /* @__PURE__ */ n("div", { className: "progress", style: { width: `${r.currentTime / m * 100}%` } }) }) })
143
+ ] })
144
+ ] });
400
145
  }
401
- Player.propTypes = {
402
- frames: _propTypes.default.array.isRequired,
403
- options: _propTypes.default.object.isRequired,
404
- onComplete: _propTypes.default.func,
405
- onStart: _propTypes.default.func,
406
- onStop: _propTypes.default.func,
407
- onPause: _propTypes.default.func,
408
- onTick: _propTypes.default.func,
409
- onJump: _propTypes.default.func
146
+ K.propTypes = {
147
+ frames: l.array.isRequired,
148
+ options: l.object.isRequired,
149
+ onComplete: l.func,
150
+ onStart: l.func,
151
+ onStop: l.func,
152
+ onPause: l.func,
153
+ onTick: l.func,
154
+ onJump: l.func
155
+ };
156
+ export {
157
+ K as default
410
158
  };
411
- Player.defaultProps = {
412
- onComplete: _noop.default,
413
- onStart: _noop.default,
414
- onStop: _noop.default,
415
- onPause: _noop.default,
416
- onTick: _noop.default,
417
- onJump: _noop.default
418
- };