@vunk/plus 1.12.2 → 1.13.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.
Files changed (173) hide show
  1. package/components/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
  2. package/components/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
  3. package/components/agent-chat-provider/index.cjs +1 -0
  4. package/components/agent-chat-provider/index.mjs +113 -187
  5. package/components/agent-chat-provider/src/index.vue.d.ts +3 -2
  6. package/components/avatar/index.cjs +1 -0
  7. package/components/avatar/index.mjs +25 -31
  8. package/components/avatar/src/index.vue.d.ts +40 -39
  9. package/components/broadcasting-markdown/__tests__/const.test.d.ts +1 -0
  10. package/components/broadcasting-markdown/__tests__/utils.test.d.ts +1 -0
  11. package/components/broadcasting-markdown/index.cjs +5 -0
  12. package/components/broadcasting-markdown/index.mjs +346 -4376
  13. package/components/broadcasting-markdown/src/howler-speech.vue.d.ts +18 -24
  14. package/components/broadcasting-markdown/src/index.vue.d.ts +101 -51
  15. package/components/broadcasting-markdown/src/paragraph.vue.d.ts +17 -29
  16. package/components/broadcasting-markdown/src/speech-error.vue.d.ts +2 -59
  17. package/components/bubble-list/index.cjs +1 -0
  18. package/components/bubble-list/index.mjs +220 -302
  19. package/components/bubble-list/src/core/index.vue.d.ts +40 -885
  20. package/components/bubble-list/src/core/loading.vue.d.ts +3 -0
  21. package/components/bubble-list/src/index.vue.d.ts +29 -1321
  22. package/components/bubble-templates/index.cjs +1 -0
  23. package/components/bubble-templates/index.mjs +34 -49
  24. package/components/bubble-templates/src/index.vue.d.ts +3 -224
  25. package/components/chat-independent/index.cjs +1 -0
  26. package/components/chat-independent/index.mjs +105 -212
  27. package/components/chat-independent/src/index.vue.d.ts +20 -2712
  28. package/components/components.css +1 -0
  29. package/components/drawer/index.cjs +1 -0
  30. package/components/drawer/index.mjs +53 -94
  31. package/components/drawer/src/ctx.d.ts +22 -22
  32. package/components/drawer/src/index.vue.d.ts +84 -557
  33. package/components/index.cjs +1 -0
  34. package/components/index.d.ts +1 -0
  35. package/components/lottie-animation/index.cjs +1 -0
  36. package/components/lottie-animation/index.mjs +36 -55
  37. package/components/lottie-animation/src/index.vue.d.ts +3 -2
  38. package/components/metahuman-broadcasting/index.cjs +1 -0
  39. package/components/metahuman-broadcasting/index.mjs +89 -140
  40. package/components/metahuman-broadcasting/src/index.vue.d.ts +16 -718
  41. package/components/monaco-editor/index.cjs +1 -0
  42. package/components/monaco-editor/index.mjs +68 -95
  43. package/components/monaco-editor/src/index.vue.d.ts +3 -2
  44. package/components/monaco-environment/index.cjs +1 -0
  45. package/components/monaco-environment/index.mjs +23 -38
  46. package/components/monaco-environment/src/index.vue.d.ts +2 -1
  47. package/components/pixi-frame/index.cjs +1 -0
  48. package/components/pixi-frame/index.mjs +941 -1969
  49. package/components/pixi-frame/src/apng.vue.d.ts +17 -73
  50. package/components/pixi-frame/src/bitmap-generator.vue.d.ts +24 -66
  51. package/components/pixi-frame/src/bitmap.vue.d.ts +28 -80
  52. package/components/pixi-frame/src/buffer-image.vue.d.ts +29 -97
  53. package/components/pixi-frame/src/core.vue.d.ts +20 -75
  54. package/components/pixi-frame/src/index.vue.d.ts +302 -237
  55. package/components/pixi-frame/src/provider.vue.d.ts +12 -1
  56. package/components/pixi-frame/src/video.vue.d.ts +17 -71
  57. package/components/pixi-frame/src/view.vue.d.ts +4 -16
  58. package/components/recorder-button/index.cjs +1 -0
  59. package/components/recorder-button/index.mjs +140 -269
  60. package/components/recorder-button/src/index.vue.d.ts +67 -66
  61. package/components/routes-menu-content/index.cjs +1 -0
  62. package/components/routes-menu-content/index.mjs +150 -229
  63. package/components/routes-menu-content/src/index.vue.d.ts +27 -26
  64. package/components/routes-menu-content/src/item/core/index.vue.d.ts +27 -26
  65. package/components/routes-menu-content/src/item/index.vue.d.ts +27 -26
  66. package/components/scrollbar/index.cjs +1 -0
  67. package/components/scrollbar/index.mjs +288 -567
  68. package/components/scrollbar/src/bar.vue.d.ts +6 -133
  69. package/components/scrollbar/src/index.vue.d.ts +66 -337
  70. package/components/scrollbar/src/thumb.vue.d.ts +3 -80
  71. package/components/sender/index.cjs +1 -0
  72. package/components/sender/index.mjs +156 -285
  73. package/components/sender/src/SenderHeader.vue.d.ts +14 -221
  74. package/components/sender/src/index.vue.d.ts +16 -505
  75. package/components/speech-button/index.cjs +1 -0
  76. package/components/speech-button/index.mjs +98 -144
  77. package/components/speech-button/src/LoadingIcon.vue.d.ts +2 -1
  78. package/components/speech-button/src/RecordingIcon.vue.d.ts +2 -1
  79. package/components/speech-button/src/index.vue.d.ts +6 -5
  80. package/components/table-columns/index.cjs +1 -0
  81. package/components/table-columns/index.mjs +48 -78
  82. package/components/table-columns/src/ctx.d.ts +10 -10
  83. package/components/table-columns/src/el-ctx.d.ts +1 -1
  84. package/components/table-columns/src/index.vue.d.ts +24 -23
  85. package/components/tables-v1/index.cjs +1 -0
  86. package/components/tables-v1/index.mjs +99 -160
  87. package/components/tables-v1/src/ctx.d.ts +28 -28
  88. package/components/tables-v1/src/el-ctx.d.ts +2 -2
  89. package/components/tables-v1/src/index.vue.d.ts +88 -2243
  90. package/components/tables-v1-checkbox/index.cjs +98 -0
  91. package/components/tables-v1-checkbox/index.mjs +1594 -3735
  92. package/components/tables-v1-checkbox/src/ctx.d.ts +26 -26
  93. package/components/tables-v1-checkbox/src/index.vue.d.ts +176 -2330
  94. package/components/text/index.cjs +1 -0
  95. package/components/text/index.mjs +70 -108
  96. package/components/text/src/ctx.d.ts +31 -31
  97. package/components/text/src/index.vue.d.ts +92 -1819
  98. package/components/thinking/index.cjs +1 -0
  99. package/components/thinking/index.mjs +127 -227
  100. package/components/thinking/src/index.vue.d.ts +22 -2044
  101. package/components/typing-markdown/index.cjs +1 -0
  102. package/components/typing-markdown/index.mjs +61 -201
  103. package/components/typing-markdown/src/index.vue.d.ts +3 -2
  104. package/components/vditor/index.cjs +1 -0
  105. package/components/vditor/index.mjs +121 -195
  106. package/components/vditor/src/ctx.d.ts +2 -2
  107. package/components/vditor/src/handle-fullscreen.vue.d.ts +3 -2
  108. package/components/vditor/src/handle-value.vue.d.ts +3 -2
  109. package/components/vditor/src/index.vue.d.ts +5 -4
  110. package/components/xgplayer/index.cjs +1 -0
  111. package/components/xgplayer/index.mjs +49 -90
  112. package/components/xgplayer/src/core.vue.d.ts +13 -18
  113. package/components/xgplayer/src/index.vue.d.ts +13 -67
  114. package/composables/el-breakpoints/index.cjs +1 -0
  115. package/composables/el-breakpoints/index.d.ts +10 -10
  116. package/composables/el-breakpoints/index.mjs +10 -12
  117. package/composables/index.cjs +1 -0
  118. package/composables/index.d.ts +1 -0
  119. package/composables/recorder/index.cjs +1 -0
  120. package/composables/recorder/index.mjs +9172 -14803
  121. package/element/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
  122. package/element/bubble/index.cjs +3 -0
  123. package/element/bubble/index.d.ts +1 -1
  124. package/element/bubble/index.mjs +1 -1
  125. package/element/bubble/src/index.vue.d.ts +22 -22
  126. package/element/index.css +1 -1
  127. package/element/thinking/index.cjs +1 -0
  128. package/element/thinking/index.d.ts +1 -1
  129. package/element/thinking/index.mjs +1 -1
  130. package/element/thinking/src/index.vue.d.ts +26 -26
  131. package/element/thinking/src/types.d.ts +10 -0
  132. package/icons/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
  133. package/icons/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
  134. package/icons/end/index.cjs +1 -0
  135. package/icons/end/index.mjs +21 -26
  136. package/icons/end/src/index.vue.d.ts +3 -0
  137. package/icons/keyboard/index.cjs +1 -0
  138. package/icons/keyboard/index.mjs +21 -26
  139. package/icons/keyboard/src/index.vue.d.ts +3 -0
  140. package/icons/start/index.cjs +1 -0
  141. package/icons/start/index.mjs +21 -26
  142. package/icons/start/src/index.vue.d.ts +3 -0
  143. package/icons/voice/index.cjs +1 -0
  144. package/icons/voice/index.mjs +26 -44
  145. package/icons/voice/src/index.vue.d.ts +2 -3
  146. package/index.css +2 -558
  147. package/index.d.ts +1 -0
  148. package/package.json +78 -87
  149. package/shared/data/index.cjs +1 -0
  150. package/shared/data/index.mjs +16 -22
  151. package/shared/types/index.cjs +1 -0
  152. package/shared/types/index.d.ts +1 -0
  153. package/components/LinkOutlined.mjs +0 -1321
  154. package/components/_commonjsHelpers.mjs +0 -7
  155. package/components/_plugin-vue_export-helper.mjs +0 -9
  156. package/components/bubble-list/index.css +0 -70
  157. package/components/bubble-templates/index.css +0 -4
  158. package/components/chat-independent/index.css +0 -47
  159. package/components/drawer/index.css +0 -124
  160. package/components/index2.mjs +0 -78
  161. package/components/lottie-animation/index.css +0 -4
  162. package/components/monaco-editor/index.css +0 -4
  163. package/components/pixi-frame/index.css +0 -4
  164. package/components/recorder-button/index.css +0 -69
  165. package/components/sender/index.css +0 -22
  166. package/components/speech-button/index.css +0 -10
  167. package/components/tables-v1/index.css +0 -7
  168. package/components/tables-v1-checkbox/index.css +0 -8
  169. package/components/thinking/index.css +0 -125
  170. package/components/typing-markdown/index.css +0 -31
  171. package/components/vditor/index.css +0 -12
  172. package/components/xgplayer/index.css +0 -1
  173. package/icons/_plugin-vue_export-helper.mjs +0 -9
@@ -1,1003 +1,465 @@
1
- import { provide, inject, watchEffect, onBeforeUnmount, defineComponent, useId, ref, onMounted, renderSlot, watch, computed, openBlock, createElementBlock, resolveComponent, createBlock, withCtx, createVNode } from 'vue';
2
- import { TickerStatus } from '@vunk/shared/enum';
3
- export { TickerStatus } from '@vunk/shared/enum';
4
- import { Deferred, sleep } from '@vunk/shared/promise';
5
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from '../_commonjsHelpers.mjs';
6
- import { Application, Sprite, Assets, Texture, ImageSource, BufferImageSource } from 'pixi.js';
7
- import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
8
- import { pickObject } from '@vunk/shared/object';
9
- import { useModelComputed, useDeferred } from '@vunk/core/composables';
10
-
11
- var lib = {exports: {}};
12
-
13
- (function (module, exports) {
14
- (function webpackUniversalModuleDefinition(root, factory) {
15
- module.exports = factory();
16
- })(commonjsGlobal, function() {
17
- return /******/ (function(modules) { // webpackBootstrap
18
- /******/ // The module cache
19
- /******/ var installedModules = {};
20
-
21
- /******/ // The require function
22
- /******/ function __webpack_require__(moduleId) {
23
-
24
- /******/ // Check if module is in cache
25
- /******/ if(installedModules[moduleId])
26
- /******/ return installedModules[moduleId].exports;
27
-
28
- /******/ // Create a new module (and put it into the cache)
29
- /******/ var module = installedModules[moduleId] = {
30
- /******/ exports: {},
31
- /******/ id: moduleId,
32
- /******/ loaded: false
33
- /******/ };
34
-
35
- /******/ // Execute the module function
36
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
37
-
38
- /******/ // Flag the module as loaded
39
- /******/ module.loaded = true;
40
-
41
- /******/ // Return the exports of the module
42
- /******/ return module.exports;
43
- /******/ }
44
-
45
-
46
- /******/ // expose the modules object (__webpack_modules__)
47
- /******/ __webpack_require__.m = modules;
48
-
49
- /******/ // expose the module cache
50
- /******/ __webpack_require__.c = installedModules;
51
-
52
- /******/ // __webpack_public_path__
53
- /******/ __webpack_require__.p = "";
54
-
55
- /******/ // Load entry module and return exports
56
- /******/ return __webpack_require__(0);
57
- /******/ })
58
- /************************************************************************/
59
- /******/ ([
60
- /* 0 */
61
- /***/ (function(module, exports, __webpack_require__) {
62
-
63
- Object.defineProperty(exports, "__esModule", {
64
- value: true
65
- });
66
- exports.isNotPNG = isNotPNG;
67
- exports.isNotAPNG = isNotAPNG;
68
- exports.default = parseAPNG;
69
-
70
- var _crc = __webpack_require__(1);
71
-
72
- var _crc2 = _interopRequireDefault(_crc);
73
-
74
- var _structs = __webpack_require__(2);
75
-
76
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
77
-
78
- var errNotPNG = new Error('Not a PNG');
79
- var errNotAPNG = new Error('Not an animated PNG');
80
-
81
- function isNotPNG(err) {
82
- return err === errNotPNG;
83
- }
84
- function isNotAPNG(err) {
85
- return err === errNotAPNG;
86
- }
87
-
88
- // '\x89PNG\x0d\x0a\x1a\x0a'
89
- var PNGSignature = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
90
-
91
- /**
92
- * Parse APNG data
93
- * @param {ArrayBuffer} buffer
94
- * @return {APNG|Error}
95
- */
96
- function parseAPNG(buffer) {
97
- var bytes = new Uint8Array(buffer);
98
-
99
- if (Array.prototype.some.call(PNGSignature, function (b, i) {
100
- return b !== bytes[i];
101
- })) {
102
- return errNotPNG;
103
- }
104
-
105
- // fast animation test
106
- var isAnimated = false;
107
- eachChunk(bytes, function (type) {
108
- return !(isAnimated = type === 'acTL');
109
- });
110
- if (!isAnimated) {
111
- return errNotAPNG;
112
- }
113
-
114
- var preDataParts = [],
115
- postDataParts = [];
116
- var headerDataBytes = null,
117
- frame = null,
118
- frameNumber = 0,
119
- apng = new _structs.APNG();
120
-
121
- eachChunk(bytes, function (type, bytes, off, length) {
122
- var dv = new DataView(bytes.buffer);
123
- switch (type) {
124
- case 'IHDR':
125
- headerDataBytes = bytes.subarray(off + 8, off + 8 + length);
126
- apng.width = dv.getUint32(off + 8);
127
- apng.height = dv.getUint32(off + 12);
128
- break;
129
- case 'acTL':
130
- apng.numPlays = dv.getUint32(off + 8 + 4);
131
- break;
132
- case 'fcTL':
133
- if (frame) {
134
- apng.frames.push(frame);
135
- frameNumber++;
136
- }
137
- frame = new _structs.Frame();
138
- frame.width = dv.getUint32(off + 8 + 4);
139
- frame.height = dv.getUint32(off + 8 + 8);
140
- frame.left = dv.getUint32(off + 8 + 12);
141
- frame.top = dv.getUint32(off + 8 + 16);
142
- var delayN = dv.getUint16(off + 8 + 20);
143
- var delayD = dv.getUint16(off + 8 + 22);
144
- if (delayD === 0) {
145
- delayD = 100;
146
- }
147
- frame.delay = 1000 * delayN / delayD;
148
- // https://bugzilla.mozilla.org/show_bug.cgi?id=125137
149
- // https://bugzilla.mozilla.org/show_bug.cgi?id=139677
150
- // https://bugzilla.mozilla.org/show_bug.cgi?id=207059
151
- if (frame.delay <= 10) {
152
- frame.delay = 100;
153
- }
154
- apng.playTime += frame.delay;
155
- frame.disposeOp = dv.getUint8(off + 8 + 24);
156
- frame.blendOp = dv.getUint8(off + 8 + 25);
157
- frame.dataParts = [];
158
- if (frameNumber === 0 && frame.disposeOp === 2) {
159
- frame.disposeOp = 1;
160
- }
161
- break;
162
- case 'fdAT':
163
- if (frame) {
164
- frame.dataParts.push(bytes.subarray(off + 8 + 4, off + 8 + length));
165
- }
166
- break;
167
- case 'IDAT':
168
- if (frame) {
169
- frame.dataParts.push(bytes.subarray(off + 8, off + 8 + length));
170
- }
171
- break;
172
- case 'IEND':
173
- postDataParts.push(subBuffer(bytes, off, 12 + length));
174
- break;
175
- default:
176
- preDataParts.push(subBuffer(bytes, off, 12 + length));
177
- }
178
- });
179
-
180
- if (frame) {
181
- apng.frames.push(frame);
182
- }
183
-
184
- if (apng.frames.length == 0) {
185
- return errNotAPNG;
186
- }
187
-
188
- var preBlob = new Blob(preDataParts),
189
- postBlob = new Blob(postDataParts);
190
-
191
- apng.frames.forEach(function (frame) {
192
- var bb = [];
193
- bb.push(PNGSignature);
194
- headerDataBytes.set(makeDWordArray(frame.width), 0);
195
- headerDataBytes.set(makeDWordArray(frame.height), 4);
196
- bb.push(makeChunkBytes('IHDR', headerDataBytes));
197
- bb.push(preBlob);
198
- frame.dataParts.forEach(function (p) {
199
- return bb.push(makeChunkBytes('IDAT', p));
200
- });
201
- bb.push(postBlob);
202
- frame.imageData = new Blob(bb, { 'type': 'image/png' });
203
- delete frame.dataParts;
204
- bb = null;
205
- });
206
-
207
- return apng;
208
- }
209
-
210
- /**
211
- * @param {Uint8Array} bytes
212
- * @param {function(string, Uint8Array, int, int): boolean} callback
213
- */
214
- function eachChunk(bytes, callback) {
215
- var dv = new DataView(bytes.buffer);
216
- var off = 8,
217
- type = void 0,
218
- length = void 0,
219
- res = void 0;
220
- do {
221
- length = dv.getUint32(off);
222
- type = readString(bytes, off + 4, 4);
223
- res = callback(type, bytes, off, length);
224
- off += 12 + length;
225
- } while (res !== false && type != 'IEND' && off < bytes.length);
226
- }
227
-
228
- /**
229
- *
230
- * @param {Uint8Array} bytes
231
- * @param {number} off
232
- * @param {number} length
233
- * @return {string}
234
- */
235
- function readString(bytes, off, length) {
236
- var chars = Array.prototype.slice.call(bytes.subarray(off, off + length));
237
- return String.fromCharCode.apply(String, chars);
238
- }
239
-
240
- /**
241
- *
242
- * @param {string} x
243
- * @return {Uint8Array}
244
- */
245
- function makeStringArray(x) {
246
- var res = new Uint8Array(x.length);
247
- for (var i = 0; i < x.length; i++) {
248
- res[i] = x.charCodeAt(i);
249
- }
250
- return res;
251
- }
252
-
253
- /**
254
- * @param {Uint8Array} bytes
255
- * @param {int} start
256
- * @param {int} length
257
- * @return {Uint8Array}
258
- */
259
- function subBuffer(bytes, start, length) {
260
- var a = new Uint8Array(length);
261
- a.set(bytes.subarray(start, start + length));
262
- return a;
263
- }
264
-
265
- /**
266
- * @param {string} type
267
- * @param {Uint8Array} dataBytes
268
- * @return {Uint8Array}
269
- */
270
- var makeChunkBytes = function makeChunkBytes(type, dataBytes) {
271
- var crcLen = type.length + dataBytes.length;
272
- var bytes = new Uint8Array(crcLen + 8);
273
- var dv = new DataView(bytes.buffer);
274
-
275
- dv.setUint32(0, dataBytes.length);
276
- bytes.set(makeStringArray(type), 4);
277
- bytes.set(dataBytes, 8);
278
- var crc = (0, _crc2.default)(bytes, 4, crcLen);
279
- dv.setUint32(crcLen + 4, crc);
280
- return bytes;
281
- };
282
-
283
- var makeDWordArray = function makeDWordArray(x) {
284
- return new Uint8Array([x >>> 24 & 0xff, x >>> 16 & 0xff, x >>> 8 & 0xff, x & 0xff]);
285
- };
286
-
287
- /***/ }),
288
- /* 1 */
289
- /***/ (function(module, exports) {
290
-
291
- Object.defineProperty(exports, "__esModule", {
292
- value: true
293
- });
294
-
295
- exports.default = function (bytes) {
296
- var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
297
- var length = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : bytes.length - start;
298
-
299
- var crc = -1;
300
- for (var _i = start, l = start + length; _i < l; _i++) {
301
- crc = crc >>> 8 ^ table[(crc ^ bytes[_i]) & 0xFF];
302
- }
303
- return crc ^ -1;
304
- };
305
-
306
- var table = new Uint32Array(256);
307
-
308
- for (var i = 0; i < 256; i++) {
309
- var c = i;
310
- for (var k = 0; k < 8; k++) {
311
- c = (c & 1) !== 0 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;
312
- }
313
- table[i] = c;
314
- }
315
-
316
- /**
317
- *
318
- * @param {Uint8Array} bytes
319
- * @param {number} start
320
- * @param {number} length
321
- * @return {number}
322
- */
323
-
324
- /***/ }),
325
- /* 2 */
326
- /***/ (function(module, exports, __webpack_require__) {
327
-
328
- Object.defineProperty(exports, "__esModule", {
329
- value: true
330
- });
331
- exports.Frame = exports.APNG = undefined;
332
-
333
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
334
-
335
- var _player = __webpack_require__(3);
336
-
337
- var _player2 = _interopRequireDefault(_player);
338
-
339
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
340
-
341
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
342
-
343
- /**
344
- * @property {number} currFrameNumber
345
- * @property {Frame} currFrame
346
- * @property {boolean} paused
347
- * @property {boolean} ended
348
- */
349
- exports.APNG = function () {
350
- function APNG() {
351
- _classCallCheck(this, APNG);
352
-
353
- this.width = 0;
354
- this.height = 0;
355
- this.numPlays = 0;
356
- this.playTime = 0;
357
- this.frames = [];
358
- }
359
- /** @type {number} */
360
-
361
- /** @type {number} */
362
-
363
- /** @type {number} */
364
-
365
- /** @type {number} */
366
-
367
- /** @type {Frame[]} */
368
-
369
-
370
- _createClass(APNG, [{
371
- key: 'createImages',
372
-
373
-
374
- /**
375
- *
376
- * @return {Promise.<*>}
377
- */
378
- value: function createImages() {
379
- return Promise.all(this.frames.map(function (f) {
380
- return f.createImage();
381
- }));
382
- }
383
-
384
- /**
385
- *
386
- * @param {CanvasRenderingContext2D} context
387
- * @param {boolean} autoPlay
388
- * @return {Promise.<Player>}
389
- */
390
-
391
- }, {
392
- key: 'getPlayer',
393
- value: function getPlayer(context) {
394
- var _this = this;
395
-
396
- var autoPlay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
397
-
398
- return this.createImages().then(function () {
399
- return new _player2.default(_this, context, autoPlay);
400
- });
401
- }
402
- }]);
403
-
404
- return APNG;
405
- }();
406
-
407
- exports.Frame = function () {
408
- function Frame() {
409
- _classCallCheck(this, Frame);
410
-
411
- this.left = 0;
412
- this.top = 0;
413
- this.width = 0;
414
- this.height = 0;
415
- this.delay = 0;
416
- this.disposeOp = 0;
417
- this.blendOp = 0;
418
- this.imageData = null;
419
- this.imageElement = null;
420
- }
421
- /** @type {number} */
422
-
423
- /** @type {number} */
424
-
425
- /** @type {number} */
426
-
427
- /** @type {number} */
428
-
429
- /** @type {number} */
430
-
431
- /** @type {number} */
432
-
433
- /** @type {number} */
434
-
435
- /** @type {Blob} */
436
-
437
- /** @type {HTMLImageElement} */
438
-
439
-
440
- _createClass(Frame, [{
441
- key: 'createImage',
442
- value: function createImage() {
443
- var _this2 = this;
444
-
445
- if (this.imageElement) {
446
- return Promise.resolve();
447
- }
448
- return new Promise(function (resolve, reject) {
449
- var url = URL.createObjectURL(_this2.imageData);
450
- _this2.imageElement = document.createElement('img');
451
- _this2.imageElement.onload = function () {
452
- URL.revokeObjectURL(url);
453
- resolve();
454
- };
455
- _this2.imageElement.onerror = function () {
456
- URL.revokeObjectURL(url);
457
- _this2.imageElement = null;
458
- reject(new Error("Image creation error"));
459
- };
460
- _this2.imageElement.src = url;
461
- });
462
- }
463
- }]);
464
-
465
- return Frame;
466
- }();
467
-
468
- /***/ }),
469
- /* 3 */
470
- /***/ (function(module, exports, __webpack_require__) {
471
-
472
- Object.defineProperty(exports, "__esModule", {
473
- value: true
474
- });
475
-
476
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
477
-
478
- var _events = __webpack_require__(4);
479
-
480
- var _events2 = _interopRequireDefault(_events);
481
-
482
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
483
-
484
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
485
-
486
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
487
-
488
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
489
-
490
- var _class = function (_EventEmitter) {
491
- _inherits(_class, _EventEmitter);
492
-
493
- /**
494
- * @param {APNG} apng
495
- * @param {CanvasRenderingContext2D} context
496
- * @param {boolean} autoPlay
497
- */
498
-
499
- /** @type {number} */
500
-
501
-
502
- /** @type {boolean} */
503
-
504
- /** @type {ImageData} */
505
-
506
-
507
- /** @type {APNG} */
508
-
509
- /** @type {CanvasRenderingContext2D} */
510
- function _class(apng, context, autoPlay) {
511
- _classCallCheck(this, _class);
512
-
513
- var _this = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this));
514
-
515
- _this.playbackRate = 1.0;
516
- _this._currentFrameNumber = 0;
517
- _this._ended = false;
518
- _this._paused = true;
519
- _this._numPlays = 0;
520
- _this._rafId = null;
521
-
522
- _this._apng = apng;
523
- _this.context = context;
524
- _this.stop();
525
- if (autoPlay) {
526
- _this.play();
527
- }
528
- return _this;
529
- }
530
-
531
- /**
532
- *
533
- * @return {number}
534
- */
535
-
536
- /** @type {number|null} */
537
-
538
- /** @type {boolean} */
539
-
540
- /** @type {number} */
541
-
542
- /** @type {Frame} */
543
-
544
- /** @type {number} */
545
-
546
-
547
- _createClass(_class, [{
548
- key: 'renderNextFrame',
549
- value: function renderNextFrame() {
550
- this._currentFrameNumber = (this._currentFrameNumber + 1) % this._apng.frames.length;
551
- if (this._currentFrameNumber === this._apng.frames.length - 1) {
552
- this._numPlays++;
553
- if (this._apng.numPlays !== 0 && this._numPlays >= this._apng.numPlays) {
554
- this._ended = true;
555
- this._paused = true;
556
- }
557
- }
558
-
559
- if (this._prevFrame && this._prevFrame.disposeOp == 1) {
560
- this.context.clearRect(this._prevFrame.left, this._prevFrame.top, this._prevFrame.width, this._prevFrame.height);
561
- } else if (this._prevFrame && this._prevFrame.disposeOp == 2) {
562
- this.context.putImageData(this._prevFrameData, this._prevFrame.left, this._prevFrame.top);
563
- }
564
-
565
- var frame = this.currentFrame;
566
- this._prevFrame = frame;
567
- this._prevFrameData = null;
568
- if (frame.disposeOp == 2) {
569
- this._prevFrameData = this.context.getImageData(frame.left, frame.top, frame.width, frame.height);
570
- }
571
- if (frame.blendOp == 0) {
572
- this.context.clearRect(frame.left, frame.top, frame.width, frame.height);
573
- }
574
-
575
- this.context.drawImage(frame.imageElement, frame.left, frame.top);
576
-
577
- this.emit('frame', this._currentFrameNumber);
578
- if (this._ended) {
579
- this.emit('end');
580
- }
581
- }
582
-
583
- // playback
584
-
585
- }, {
586
- key: 'play',
587
- value: function play() {
588
- var _this2 = this;
589
-
590
- if (this._rafId) {
591
- cancelAnimationFrame(this._rafId);
592
- }
593
-
594
- this.emit('play');
595
-
596
- if (this._ended) {
597
- this.stop();
598
- }
599
- this._paused = false;
600
-
601
- var nextRenderTime = performance.now() + this.currentFrame.delay / this.playbackRate;
602
- var tick = function tick(now) {
603
- if (_this2._ended || _this2._paused) {
604
- return;
605
- }
606
- if (now >= nextRenderTime) {
607
- while (now - nextRenderTime >= _this2._apng.playTime / _this2.playbackRate) {
608
- nextRenderTime += _this2._apng.playTime / _this2.playbackRate;
609
- _this2._numPlays++;
610
- }
611
- do {
612
- _this2.renderNextFrame();
613
- nextRenderTime += _this2.currentFrame.delay / _this2.playbackRate;
614
- } while (!_this2._ended && !_this2._paused && now > nextRenderTime);
615
- }
616
- _this2._rafId = requestAnimationFrame(tick);
617
- };
618
- this._rafId = requestAnimationFrame(tick);
619
- }
620
- }, {
621
- key: 'pause',
622
- value: function pause() {
623
- if (!this._paused) {
624
- if (this._rafId) {
625
- cancelAnimationFrame(this._rafId);
626
- this._rafId = null;
627
- }
628
- this.emit('pause');
629
- this._paused = true;
630
- }
631
- }
632
- }, {
633
- key: 'stop',
634
- value: function stop() {
635
- if (this._rafId) {
636
- cancelAnimationFrame(this._rafId);
637
- this._rafId = null;
638
- }
639
- this.emit('stop');
640
- this._numPlays = 0;
641
- this._ended = false;
642
- this._paused = true;
643
- // render first frame
644
- this._currentFrameNumber = -1;
645
- this.context.clearRect(0, 0, this._apng.width, this._apng.height);
646
- this.renderNextFrame();
647
- }
648
- }, {
649
- key: 'currentFrameNumber',
650
- get: function get() {
651
- return this._currentFrameNumber;
652
- }
653
-
654
- /**
655
- *
656
- * @return {Frame}
657
- */
658
-
659
- }, {
660
- key: 'currentFrame',
661
- get: function get() {
662
- return this._apng.frames[this._currentFrameNumber];
663
- }
664
- }, {
665
- key: 'paused',
666
- get: function get() {
667
- return this._paused;
668
- }
669
- }, {
670
- key: 'ended',
671
- get: function get() {
672
- return this._ended;
673
- }
674
- }]);
675
-
676
- return _class;
677
- }(_events2.default);
678
-
679
- exports.default = _class;
680
-
681
- /***/ }),
682
- /* 4 */
683
- /***/ (function(module, exports) {
684
-
685
- // Copyright Joyent, Inc. and other Node contributors.
686
- //
687
- // Permission is hereby granted, free of charge, to any person obtaining a
688
- // copy of this software and associated documentation files (the
689
- // "Software"), to deal in the Software without restriction, including
690
- // without limitation the rights to use, copy, modify, merge, publish,
691
- // distribute, sublicense, and/or sell copies of the Software, and to permit
692
- // persons to whom the Software is furnished to do so, subject to the
693
- // following conditions:
694
- //
695
- // The above copyright notice and this permission notice shall be included
696
- // in all copies or substantial portions of the Software.
697
- //
698
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
699
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
700
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
701
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
702
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
703
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
704
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
705
-
706
- function EventEmitter() {
707
- this._events = this._events || {};
708
- this._maxListeners = this._maxListeners || undefined;
709
- }
710
- module.exports = EventEmitter;
711
-
712
- // Backwards-compat with node 0.10.x
713
- EventEmitter.EventEmitter = EventEmitter;
714
-
715
- EventEmitter.prototype._events = undefined;
716
- EventEmitter.prototype._maxListeners = undefined;
717
-
718
- // By default EventEmitters will print a warning if more than 10 listeners are
719
- // added to it. This is a useful default which helps finding memory leaks.
720
- EventEmitter.defaultMaxListeners = 10;
721
-
722
- // Obviously not all Emitters should be limited to 10. This function allows
723
- // that to be increased. Set to zero for unlimited.
724
- EventEmitter.prototype.setMaxListeners = function(n) {
725
- if (!isNumber(n) || n < 0 || isNaN(n))
726
- throw TypeError('n must be a positive number');
727
- this._maxListeners = n;
728
- return this;
729
- };
730
-
731
- EventEmitter.prototype.emit = function(type) {
732
- var er, handler, len, args, i, listeners;
733
-
734
- if (!this._events)
735
- this._events = {};
736
-
737
- // If there is no 'error' event listener then throw.
738
- if (type === 'error') {
739
- if (!this._events.error ||
740
- (isObject(this._events.error) && !this._events.error.length)) {
741
- er = arguments[1];
742
- if (er instanceof Error) {
743
- throw er; // Unhandled 'error' event
744
- } else {
745
- // At least give some kind of context to the user
746
- var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
747
- err.context = er;
748
- throw err;
749
- }
750
- }
751
- }
752
-
753
- handler = this._events[type];
754
-
755
- if (isUndefined(handler))
756
- return false;
757
-
758
- if (isFunction(handler)) {
759
- switch (arguments.length) {
760
- // fast cases
761
- case 1:
762
- handler.call(this);
763
- break;
764
- case 2:
765
- handler.call(this, arguments[1]);
766
- break;
767
- case 3:
768
- handler.call(this, arguments[1], arguments[2]);
769
- break;
770
- // slower
771
- default:
772
- args = Array.prototype.slice.call(arguments, 1);
773
- handler.apply(this, args);
774
- }
775
- } else if (isObject(handler)) {
776
- args = Array.prototype.slice.call(arguments, 1);
777
- listeners = handler.slice();
778
- len = listeners.length;
779
- for (i = 0; i < len; i++)
780
- listeners[i].apply(this, args);
781
- }
782
-
783
- return true;
784
- };
785
-
786
- EventEmitter.prototype.addListener = function(type, listener) {
787
- var m;
788
-
789
- if (!isFunction(listener))
790
- throw TypeError('listener must be a function');
791
-
792
- if (!this._events)
793
- this._events = {};
794
-
795
- // To avoid recursion in the case that type === "newListener"! Before
796
- // adding it to the listeners, first emit "newListener".
797
- if (this._events.newListener)
798
- this.emit('newListener', type,
799
- isFunction(listener.listener) ?
800
- listener.listener : listener);
801
-
802
- if (!this._events[type])
803
- // Optimize the case of one listener. Don't need the extra array object.
804
- this._events[type] = listener;
805
- else if (isObject(this._events[type]))
806
- // If we've already got an array, just append.
807
- this._events[type].push(listener);
808
- else
809
- // Adding the second element, need to change to array.
810
- this._events[type] = [this._events[type], listener];
811
-
812
- // Check for listener leak
813
- if (isObject(this._events[type]) && !this._events[type].warned) {
814
- if (!isUndefined(this._maxListeners)) {
815
- m = this._maxListeners;
816
- } else {
817
- m = EventEmitter.defaultMaxListeners;
818
- }
819
-
820
- if (m && m > 0 && this._events[type].length > m) {
821
- this._events[type].warned = true;
822
- console.error('(node) warning: possible EventEmitter memory ' +
823
- 'leak detected. %d listeners added. ' +
824
- 'Use emitter.setMaxListeners() to increase limit.',
825
- this._events[type].length);
826
- if (typeof console.trace === 'function') {
827
- // not supported in IE 10
828
- console.trace();
829
- }
830
- }
831
- }
832
-
833
- return this;
834
- };
835
-
836
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
837
-
838
- EventEmitter.prototype.once = function(type, listener) {
839
- if (!isFunction(listener))
840
- throw TypeError('listener must be a function');
841
-
842
- var fired = false;
843
-
844
- function g() {
845
- this.removeListener(type, g);
846
-
847
- if (!fired) {
848
- fired = true;
849
- listener.apply(this, arguments);
850
- }
851
- }
852
-
853
- g.listener = listener;
854
- this.on(type, g);
855
-
856
- return this;
857
- };
858
-
859
- // emits a 'removeListener' event iff the listener was removed
860
- EventEmitter.prototype.removeListener = function(type, listener) {
861
- var list, position, length, i;
862
-
863
- if (!isFunction(listener))
864
- throw TypeError('listener must be a function');
865
-
866
- if (!this._events || !this._events[type])
867
- return this;
868
-
869
- list = this._events[type];
870
- length = list.length;
871
- position = -1;
872
-
873
- if (list === listener ||
874
- (isFunction(list.listener) && list.listener === listener)) {
875
- delete this._events[type];
876
- if (this._events.removeListener)
877
- this.emit('removeListener', type, listener);
878
-
879
- } else if (isObject(list)) {
880
- for (i = length; i-- > 0;) {
881
- if (list[i] === listener ||
882
- (list[i].listener && list[i].listener === listener)) {
883
- position = i;
884
- break;
885
- }
886
- }
887
-
888
- if (position < 0)
889
- return this;
890
-
891
- if (list.length === 1) {
892
- list.length = 0;
893
- delete this._events[type];
894
- } else {
895
- list.splice(position, 1);
896
- }
897
-
898
- if (this._events.removeListener)
899
- this.emit('removeListener', type, listener);
900
- }
901
-
902
- return this;
903
- };
904
-
905
- EventEmitter.prototype.removeAllListeners = function(type) {
906
- var key, listeners;
907
-
908
- if (!this._events)
909
- return this;
910
-
911
- // not listening for removeListener, no need to emit
912
- if (!this._events.removeListener) {
913
- if (arguments.length === 0)
914
- this._events = {};
915
- else if (this._events[type])
916
- delete this._events[type];
917
- return this;
918
- }
919
-
920
- // emit removeListener for all listeners on all events
921
- if (arguments.length === 0) {
922
- for (key in this._events) {
923
- if (key === 'removeListener') continue;
924
- this.removeAllListeners(key);
925
- }
926
- this.removeAllListeners('removeListener');
927
- this._events = {};
928
- return this;
929
- }
930
-
931
- listeners = this._events[type];
932
-
933
- if (isFunction(listeners)) {
934
- this.removeListener(type, listeners);
935
- } else if (listeners) {
936
- // LIFO order
937
- while (listeners.length)
938
- this.removeListener(type, listeners[listeners.length - 1]);
939
- }
940
- delete this._events[type];
941
-
942
- return this;
943
- };
944
-
945
- EventEmitter.prototype.listeners = function(type) {
946
- var ret;
947
- if (!this._events || !this._events[type])
948
- ret = [];
949
- else if (isFunction(this._events[type]))
950
- ret = [this._events[type]];
951
- else
952
- ret = this._events[type].slice();
953
- return ret;
954
- };
955
-
956
- EventEmitter.prototype.listenerCount = function(type) {
957
- if (this._events) {
958
- var evlistener = this._events[type];
959
-
960
- if (isFunction(evlistener))
961
- return 1;
962
- else if (evlistener)
963
- return evlistener.length;
964
- }
965
- return 0;
966
- };
967
-
968
- EventEmitter.listenerCount = function(emitter, type) {
969
- return emitter.listenerCount(type);
970
- };
971
-
972
- function isFunction(arg) {
973
- return typeof arg === 'function';
974
- }
975
-
976
- function isNumber(arg) {
977
- return typeof arg === 'number';
978
- }
979
-
980
- function isObject(arg) {
981
- return typeof arg === 'object' && arg !== null;
982
- }
983
-
984
- function isUndefined(arg) {
985
- return arg === void 0;
986
- }
987
-
988
-
989
- /***/ })
990
- /******/ ])
991
- });
992
- } (lib));
993
-
994
- var libExports = lib.exports;
995
- var parseAPNG = /*@__PURE__*/getDefaultExportFromCjs(libExports);
996
-
997
- const props = {
1
+ import { inject as fe, provide as de, watchEffect as B, onBeforeUnmount as S, defineComponent as C, useId as ne, ref as U, onMounted as ae, renderSlot as V, watch as Q, computed as J, createElementBlock as me, openBlock as H, resolveComponent as K, createBlock as Y, withCtx as he, createVNode as ve } from "vue";
2
+ import { TickerStatus as m } from "@vunk/shared/enum";
3
+ import { TickerStatus as Ye } from "@vunk/shared/enum";
4
+ import { Deferred as ge, sleep as Z } from "@vunk/shared/promise";
5
+ import { Application as _e, Sprite as ye, Assets as R, Texture as ee, ImageSource as oe, BufferImageSource as we } from "pixi.js";
6
+ import { pickObject as se } from "@vunk/shared/object";
7
+ import { useModelComputed as ie, useDeferred as be } from "@vunk/core/composables";
8
+ import { _ as xe } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
9
+ function Fe(o) {
10
+ return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
11
+ }
12
+ var X = { exports: {} }, ke = X.exports, ue;
13
+ function Pe() {
14
+ return ue || (ue = 1, (function(o, P) {
15
+ (function(r, p) {
16
+ o.exports = p();
17
+ })(ke, function() {
18
+ return (
19
+ /******/
20
+ (function(t) {
21
+ var r = {};
22
+ function p(l) {
23
+ if (r[l])
24
+ return r[l].exports;
25
+ var v = r[l] = {
26
+ /******/
27
+ exports: {},
28
+ /******/
29
+ id: l,
30
+ /******/
31
+ loaded: !1
32
+ /******/
33
+ };
34
+ return t[l].call(v.exports, v, v.exports, p), v.loaded = !0, v.exports;
35
+ }
36
+ return p.m = t, p.c = r, p.p = "", p(0);
37
+ })([
38
+ /* 0 */
39
+ /***/
40
+ (function(t, r, p) {
41
+ Object.defineProperty(r, "__esModule", {
42
+ value: !0
43
+ }), r.isNotPNG = a, r.isNotAPNG = u, r.default = s;
44
+ var l = p(1), v = w(l), _ = p(2);
45
+ function w(f) {
46
+ return f && f.__esModule ? f : { default: f };
47
+ }
48
+ var e = new Error("Not a PNG"), n = new Error("Not an animated PNG");
49
+ function a(f) {
50
+ return f === e;
51
+ }
52
+ function u(f) {
53
+ return f === n;
54
+ }
55
+ var i = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
56
+ function s(f) {
57
+ var g = new Uint8Array(f);
58
+ if (Array.prototype.some.call(i, function(T, D) {
59
+ return T !== g[D];
60
+ }))
61
+ return e;
62
+ var c = !1;
63
+ if (b(g, function(T) {
64
+ return !(c = T === "acTL");
65
+ }), !c)
66
+ return n;
67
+ var x = [], I = [], N = null, k = null, M = 0, O = new _.APNG();
68
+ if (b(g, function(T, D, E, $) {
69
+ var L = new DataView(D.buffer);
70
+ switch (T) {
71
+ case "IHDR":
72
+ N = D.subarray(E + 8, E + 8 + $), O.width = L.getUint32(E + 8), O.height = L.getUint32(E + 12);
73
+ break;
74
+ case "acTL":
75
+ O.numPlays = L.getUint32(E + 8 + 4);
76
+ break;
77
+ case "fcTL":
78
+ k && (O.frames.push(k), M++), k = new _.Frame(), k.width = L.getUint32(E + 8 + 4), k.height = L.getUint32(E + 8 + 8), k.left = L.getUint32(E + 8 + 12), k.top = L.getUint32(E + 8 + 16);
79
+ var pe = L.getUint16(E + 8 + 20), te = L.getUint16(E + 8 + 22);
80
+ te === 0 && (te = 100), k.delay = 1e3 * pe / te, k.delay <= 10 && (k.delay = 100), O.playTime += k.delay, k.disposeOp = L.getUint8(E + 8 + 24), k.blendOp = L.getUint8(E + 8 + 25), k.dataParts = [], M === 0 && k.disposeOp === 2 && (k.disposeOp = 1);
81
+ break;
82
+ case "fdAT":
83
+ k && k.dataParts.push(D.subarray(E + 8 + 4, E + 8 + $));
84
+ break;
85
+ case "IDAT":
86
+ k && k.dataParts.push(D.subarray(E + 8, E + 8 + $));
87
+ break;
88
+ case "IEND":
89
+ I.push(y(D, E, 12 + $));
90
+ break;
91
+ default:
92
+ x.push(y(D, E, 12 + $));
93
+ }
94
+ }), k && O.frames.push(k), O.frames.length == 0)
95
+ return n;
96
+ var G = new Blob(x), W = new Blob(I);
97
+ return O.frames.forEach(function(T) {
98
+ var D = [];
99
+ D.push(i), N.set(d(T.width), 0), N.set(d(T.height), 4), D.push(F("IHDR", N)), D.push(G), T.dataParts.forEach(function(E) {
100
+ return D.push(F("IDAT", E));
101
+ }), D.push(W), T.imageData = new Blob(D, { type: "image/png" }), delete T.dataParts, D = null;
102
+ }), O;
103
+ }
104
+ function b(f, g) {
105
+ var c = new DataView(f.buffer), x = 8, I = void 0, N = void 0, k = void 0;
106
+ do
107
+ N = c.getUint32(x), I = h(f, x + 4, 4), k = g(I, f, x, N), x += 12 + N;
108
+ while (k !== !1 && I != "IEND" && x < f.length);
109
+ }
110
+ function h(f, g, c) {
111
+ var x = Array.prototype.slice.call(f.subarray(g, g + c));
112
+ return String.fromCharCode.apply(String, x);
113
+ }
114
+ function A(f) {
115
+ for (var g = new Uint8Array(f.length), c = 0; c < f.length; c++)
116
+ g[c] = f.charCodeAt(c);
117
+ return g;
118
+ }
119
+ function y(f, g, c) {
120
+ var x = new Uint8Array(c);
121
+ return x.set(f.subarray(g, g + c)), x;
122
+ }
123
+ var F = function(g, c) {
124
+ var x = g.length + c.length, I = new Uint8Array(x + 8), N = new DataView(I.buffer);
125
+ N.setUint32(0, c.length), I.set(A(g), 4), I.set(c, 8);
126
+ var k = (0, v.default)(I, 4, x);
127
+ return N.setUint32(x + 4, k), I;
128
+ }, d = function(g) {
129
+ return new Uint8Array([g >>> 24 & 255, g >>> 16 & 255, g >>> 8 & 255, g & 255]);
130
+ };
131
+ }),
132
+ /* 1 */
133
+ /***/
134
+ (function(t, r) {
135
+ Object.defineProperty(r, "__esModule", {
136
+ value: !0
137
+ }), r.default = function(w) {
138
+ for (var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : w.length - e, a = -1, u = e, i = e + n; u < i; u++)
139
+ a = a >>> 8 ^ p[(a ^ w[u]) & 255];
140
+ return a ^ -1;
141
+ };
142
+ for (var p = new Uint32Array(256), l = 0; l < 256; l++) {
143
+ for (var v = l, _ = 0; _ < 8; _++)
144
+ v = (v & 1) !== 0 ? 3988292384 ^ v >>> 1 : v >>> 1;
145
+ p[l] = v;
146
+ }
147
+ }),
148
+ /* 2 */
149
+ /***/
150
+ (function(t, r, p) {
151
+ Object.defineProperty(r, "__esModule", {
152
+ value: !0
153
+ }), r.Frame = r.APNG = void 0;
154
+ var l = /* @__PURE__ */ (function() {
155
+ function n(a, u) {
156
+ for (var i = 0; i < u.length; i++) {
157
+ var s = u[i];
158
+ s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(a, s.key, s);
159
+ }
160
+ }
161
+ return function(a, u, i) {
162
+ return u && n(a.prototype, u), i && n(a, i), a;
163
+ };
164
+ })(), v = p(3), _ = w(v);
165
+ function w(n) {
166
+ return n && n.__esModule ? n : { default: n };
167
+ }
168
+ function e(n, a) {
169
+ if (!(n instanceof a))
170
+ throw new TypeError("Cannot call a class as a function");
171
+ }
172
+ r.APNG = (function() {
173
+ function n() {
174
+ e(this, n), this.width = 0, this.height = 0, this.numPlays = 0, this.playTime = 0, this.frames = [];
175
+ }
176
+ return l(n, [{
177
+ key: "createImages",
178
+ /**
179
+ *
180
+ * @return {Promise.<*>}
181
+ */
182
+ value: function() {
183
+ return Promise.all(this.frames.map(function(u) {
184
+ return u.createImage();
185
+ }));
186
+ }
187
+ /**
188
+ *
189
+ * @param {CanvasRenderingContext2D} context
190
+ * @param {boolean} autoPlay
191
+ * @return {Promise.<Player>}
192
+ */
193
+ }, {
194
+ key: "getPlayer",
195
+ value: function(u) {
196
+ var i = this, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
197
+ return this.createImages().then(function() {
198
+ return new _.default(i, u, s);
199
+ });
200
+ }
201
+ }]), n;
202
+ })(), r.Frame = (function() {
203
+ function n() {
204
+ e(this, n), this.left = 0, this.top = 0, this.width = 0, this.height = 0, this.delay = 0, this.disposeOp = 0, this.blendOp = 0, this.imageData = null, this.imageElement = null;
205
+ }
206
+ return l(n, [{
207
+ key: "createImage",
208
+ value: function() {
209
+ var u = this;
210
+ return this.imageElement ? Promise.resolve() : new Promise(function(i, s) {
211
+ var b = URL.createObjectURL(u.imageData);
212
+ u.imageElement = document.createElement("img"), u.imageElement.onload = function() {
213
+ URL.revokeObjectURL(b), i();
214
+ }, u.imageElement.onerror = function() {
215
+ URL.revokeObjectURL(b), u.imageElement = null, s(new Error("Image creation error"));
216
+ }, u.imageElement.src = b;
217
+ });
218
+ }
219
+ }]), n;
220
+ })();
221
+ }),
222
+ /* 3 */
223
+ /***/
224
+ (function(t, r, p) {
225
+ Object.defineProperty(r, "__esModule", {
226
+ value: !0
227
+ });
228
+ var l = /* @__PURE__ */ (function() {
229
+ function i(s, b) {
230
+ for (var h = 0; h < b.length; h++) {
231
+ var A = b[h];
232
+ A.enumerable = A.enumerable || !1, A.configurable = !0, "value" in A && (A.writable = !0), Object.defineProperty(s, A.key, A);
233
+ }
234
+ }
235
+ return function(s, b, h) {
236
+ return b && i(s.prototype, b), h && i(s, h), s;
237
+ };
238
+ })(), v = p(4), _ = w(v);
239
+ function w(i) {
240
+ return i && i.__esModule ? i : { default: i };
241
+ }
242
+ function e(i, s) {
243
+ if (!(i instanceof s))
244
+ throw new TypeError("Cannot call a class as a function");
245
+ }
246
+ function n(i, s) {
247
+ if (!i)
248
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
249
+ return s && (typeof s == "object" || typeof s == "function") ? s : i;
250
+ }
251
+ function a(i, s) {
252
+ if (typeof s != "function" && s !== null)
253
+ throw new TypeError("Super expression must either be null or a function, not " + typeof s);
254
+ i.prototype = Object.create(s && s.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), s && (Object.setPrototypeOf ? Object.setPrototypeOf(i, s) : i.__proto__ = s);
255
+ }
256
+ var u = (function(i) {
257
+ a(s, i);
258
+ function s(b, h, A) {
259
+ e(this, s);
260
+ var y = n(this, (s.__proto__ || Object.getPrototypeOf(s)).call(this));
261
+ return y.playbackRate = 1, y._currentFrameNumber = 0, y._ended = !1, y._paused = !0, y._numPlays = 0, y._rafId = null, y._apng = b, y.context = h, y.stop(), A && y.play(), y;
262
+ }
263
+ return l(s, [{
264
+ key: "renderNextFrame",
265
+ value: function() {
266
+ this._currentFrameNumber = (this._currentFrameNumber + 1) % this._apng.frames.length, this._currentFrameNumber === this._apng.frames.length - 1 && (this._numPlays++, this._apng.numPlays !== 0 && this._numPlays >= this._apng.numPlays && (this._ended = !0, this._paused = !0)), this._prevFrame && this._prevFrame.disposeOp == 1 ? this.context.clearRect(this._prevFrame.left, this._prevFrame.top, this._prevFrame.width, this._prevFrame.height) : this._prevFrame && this._prevFrame.disposeOp == 2 && this.context.putImageData(this._prevFrameData, this._prevFrame.left, this._prevFrame.top);
267
+ var h = this.currentFrame;
268
+ this._prevFrame = h, this._prevFrameData = null, h.disposeOp == 2 && (this._prevFrameData = this.context.getImageData(h.left, h.top, h.width, h.height)), h.blendOp == 0 && this.context.clearRect(h.left, h.top, h.width, h.height), this.context.drawImage(h.imageElement, h.left, h.top), this.emit("frame", this._currentFrameNumber), this._ended && this.emit("end");
269
+ }
270
+ // playback
271
+ }, {
272
+ key: "play",
273
+ value: function() {
274
+ var h = this;
275
+ this._rafId && cancelAnimationFrame(this._rafId), this.emit("play"), this._ended && this.stop(), this._paused = !1;
276
+ var A = performance.now() + this.currentFrame.delay / this.playbackRate, y = function F(d) {
277
+ if (!(h._ended || h._paused)) {
278
+ if (d >= A) {
279
+ for (; d - A >= h._apng.playTime / h.playbackRate; )
280
+ A += h._apng.playTime / h.playbackRate, h._numPlays++;
281
+ do
282
+ h.renderNextFrame(), A += h.currentFrame.delay / h.playbackRate;
283
+ while (!h._ended && !h._paused && d > A);
284
+ }
285
+ h._rafId = requestAnimationFrame(F);
286
+ }
287
+ };
288
+ this._rafId = requestAnimationFrame(y);
289
+ }
290
+ }, {
291
+ key: "pause",
292
+ value: function() {
293
+ this._paused || (this._rafId && (cancelAnimationFrame(this._rafId), this._rafId = null), this.emit("pause"), this._paused = !0);
294
+ }
295
+ }, {
296
+ key: "stop",
297
+ value: function() {
298
+ this._rafId && (cancelAnimationFrame(this._rafId), this._rafId = null), this.emit("stop"), this._numPlays = 0, this._ended = !1, this._paused = !0, this._currentFrameNumber = -1, this.context.clearRect(0, 0, this._apng.width, this._apng.height), this.renderNextFrame();
299
+ }
300
+ }, {
301
+ key: "currentFrameNumber",
302
+ get: function() {
303
+ return this._currentFrameNumber;
304
+ }
305
+ /**
306
+ *
307
+ * @return {Frame}
308
+ */
309
+ }, {
310
+ key: "currentFrame",
311
+ get: function() {
312
+ return this._apng.frames[this._currentFrameNumber];
313
+ }
314
+ }, {
315
+ key: "paused",
316
+ get: function() {
317
+ return this._paused;
318
+ }
319
+ }, {
320
+ key: "ended",
321
+ get: function() {
322
+ return this._ended;
323
+ }
324
+ }]), s;
325
+ })(_.default);
326
+ r.default = u;
327
+ }),
328
+ /* 4 */
329
+ /***/
330
+ (function(t, r) {
331
+ function p() {
332
+ this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0;
333
+ }
334
+ t.exports = p, p.EventEmitter = p, p.prototype._events = void 0, p.prototype._maxListeners = void 0, p.defaultMaxListeners = 10, p.prototype.setMaxListeners = function(e) {
335
+ if (!v(e) || e < 0 || isNaN(e))
336
+ throw TypeError("n must be a positive number");
337
+ return this._maxListeners = e, this;
338
+ }, p.prototype.emit = function(e) {
339
+ var n, a, u, i, s, b;
340
+ if (this._events || (this._events = {}), e === "error" && (!this._events.error || _(this._events.error) && !this._events.error.length)) {
341
+ if (n = arguments[1], n instanceof Error)
342
+ throw n;
343
+ var h = new Error('Uncaught, unspecified "error" event. (' + n + ")");
344
+ throw h.context = n, h;
345
+ }
346
+ if (a = this._events[e], w(a))
347
+ return !1;
348
+ if (l(a))
349
+ switch (arguments.length) {
350
+ // fast cases
351
+ case 1:
352
+ a.call(this);
353
+ break;
354
+ case 2:
355
+ a.call(this, arguments[1]);
356
+ break;
357
+ case 3:
358
+ a.call(this, arguments[1], arguments[2]);
359
+ break;
360
+ // slower
361
+ default:
362
+ i = Array.prototype.slice.call(arguments, 1), a.apply(this, i);
363
+ }
364
+ else if (_(a))
365
+ for (i = Array.prototype.slice.call(arguments, 1), b = a.slice(), u = b.length, s = 0; s < u; s++)
366
+ b[s].apply(this, i);
367
+ return !0;
368
+ }, p.prototype.addListener = function(e, n) {
369
+ var a;
370
+ if (!l(n))
371
+ throw TypeError("listener must be a function");
372
+ return this._events || (this._events = {}), this._events.newListener && this.emit(
373
+ "newListener",
374
+ e,
375
+ l(n.listener) ? n.listener : n
376
+ ), this._events[e] ? _(this._events[e]) ? this._events[e].push(n) : this._events[e] = [this._events[e], n] : this._events[e] = n, _(this._events[e]) && !this._events[e].warned && (w(this._maxListeners) ? a = p.defaultMaxListeners : a = this._maxListeners, a && a > 0 && this._events[e].length > a && (this._events[e].warned = !0, console.error(
377
+ "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",
378
+ this._events[e].length
379
+ ), typeof console.trace == "function" && console.trace())), this;
380
+ }, p.prototype.on = p.prototype.addListener, p.prototype.once = function(e, n) {
381
+ if (!l(n))
382
+ throw TypeError("listener must be a function");
383
+ var a = !1;
384
+ function u() {
385
+ this.removeListener(e, u), a || (a = !0, n.apply(this, arguments));
386
+ }
387
+ return u.listener = n, this.on(e, u), this;
388
+ }, p.prototype.removeListener = function(e, n) {
389
+ var a, u, i, s;
390
+ if (!l(n))
391
+ throw TypeError("listener must be a function");
392
+ if (!this._events || !this._events[e])
393
+ return this;
394
+ if (a = this._events[e], i = a.length, u = -1, a === n || l(a.listener) && a.listener === n)
395
+ delete this._events[e], this._events.removeListener && this.emit("removeListener", e, n);
396
+ else if (_(a)) {
397
+ for (s = i; s-- > 0; )
398
+ if (a[s] === n || a[s].listener && a[s].listener === n) {
399
+ u = s;
400
+ break;
401
+ }
402
+ if (u < 0)
403
+ return this;
404
+ a.length === 1 ? (a.length = 0, delete this._events[e]) : a.splice(u, 1), this._events.removeListener && this.emit("removeListener", e, n);
405
+ }
406
+ return this;
407
+ }, p.prototype.removeAllListeners = function(e) {
408
+ var n, a;
409
+ if (!this._events)
410
+ return this;
411
+ if (!this._events.removeListener)
412
+ return arguments.length === 0 ? this._events = {} : this._events[e] && delete this._events[e], this;
413
+ if (arguments.length === 0) {
414
+ for (n in this._events)
415
+ n !== "removeListener" && this.removeAllListeners(n);
416
+ return this.removeAllListeners("removeListener"), this._events = {}, this;
417
+ }
418
+ if (a = this._events[e], l(a))
419
+ this.removeListener(e, a);
420
+ else if (a)
421
+ for (; a.length; )
422
+ this.removeListener(e, a[a.length - 1]);
423
+ return delete this._events[e], this;
424
+ }, p.prototype.listeners = function(e) {
425
+ var n;
426
+ return !this._events || !this._events[e] ? n = [] : l(this._events[e]) ? n = [this._events[e]] : n = this._events[e].slice(), n;
427
+ }, p.prototype.listenerCount = function(e) {
428
+ if (this._events) {
429
+ var n = this._events[e];
430
+ if (l(n))
431
+ return 1;
432
+ if (n)
433
+ return n.length;
434
+ }
435
+ return 0;
436
+ }, p.listenerCount = function(e, n) {
437
+ return e.listenerCount(n);
438
+ };
439
+ function l(e) {
440
+ return typeof e == "function";
441
+ }
442
+ function v(e) {
443
+ return typeof e == "number";
444
+ }
445
+ function _(e) {
446
+ return typeof e == "object" && e !== null;
447
+ }
448
+ function w(e) {
449
+ return e === void 0;
450
+ }
451
+ })
452
+ /******/
453
+ ])
454
+ );
455
+ });
456
+ })(X)), X.exports;
457
+ }
458
+ var Ae = Pe();
459
+ const Ee = /* @__PURE__ */ Fe(Ae), q = {
998
460
  url: {
999
461
  type: String,
1000
- requierd: false
462
+ requierd: !1
1001
463
  },
1002
464
  data: {
1003
465
  type: Array,
@@ -1008,14 +470,14 @@ const props = {
1008
470
  */
1009
471
  loop: {
1010
472
  type: Boolean,
1011
- default: false
473
+ default: !1
1012
474
  },
1013
475
  /**
1014
476
  * @description v-model:status 控制动画状态
1015
477
  */
1016
478
  status: {
1017
479
  type: String,
1018
- default: TickerStatus.pending
480
+ default: m.pending
1019
481
  },
1020
482
  frameRate: {
1021
483
  type: Number,
@@ -1034,551 +496,318 @@ const props = {
1034
496
  */
1035
497
  prerender: {
1036
498
  type: Boolean,
1037
- default: false
499
+ default: !1
1038
500
  },
1039
501
  visible: {
1040
502
  type: Boolean,
1041
- default: true
503
+ default: !0
1042
504
  }
1043
- };
1044
- const emits = {
505
+ }, j = {
1045
506
  "update:status": null,
1046
507
  "update:data": null,
1047
- "setData": null
1048
- };
1049
-
1050
- const appInjectKey = /* @__PURE__ */ Symbol("appInjectKey");
1051
- function initPixiApp() {
1052
- const application = new Application();
1053
- const whenDef = new Deferred();
1054
- const context = {
1055
- whenDef,
1056
- when: () => whenDef.promise
508
+ setData: null
509
+ }, le = /* @__PURE__ */ Symbol("appInjectKey");
510
+ function Ie() {
511
+ const o = new _e(), P = new ge(), t = {
512
+ whenDef: P,
513
+ when: () => P.promise
1057
514
  };
1058
- provide(appInjectKey, {
1059
- application,
1060
- context
1061
- });
1062
- return { application, context };
515
+ return de(le, {
516
+ application: o,
517
+ context: t
518
+ }), { application: o, context: t };
1063
519
  }
1064
- function usePixiApp() {
1065
- const core = inject(appInjectKey);
1066
- if (!core) {
520
+ function ce() {
521
+ const o = fe(le);
522
+ if (!o)
1067
523
  throw new Error("Pixi app not provided");
1068
- }
1069
- return core;
524
+ return o;
1070
525
  }
1071
-
1072
- function useSprite(props) {
1073
- const autoResize = props.autoResize ?? true;
1074
- const resize = props.resize ?? defaultResize;
1075
- const { application: app, context } = usePixiApp();
1076
- const sprite = new Sprite();
1077
- app.stage.addChild(sprite);
1078
- watchEffect(() => {
1079
- sprite.visible = props.visible ?? true;
1080
- });
1081
- watchEffect(() => {
1082
- props.label && (sprite.label = props.label);
1083
- });
1084
- autoResize && context.when().then((app2) => {
1085
- if (sprite.texture) {
1086
- resizeSprite();
1087
- app2.renderer.on("resize", resizeSprite);
1088
- }
526
+ function z(o) {
527
+ const P = o.autoResize ?? !0, t = o.resize ?? _, { application: r, context: p } = ce(), l = new ye();
528
+ r.stage.addChild(l), B(() => {
529
+ l.visible = o.visible ?? !0;
530
+ }), B(() => {
531
+ o.label && (l.label = o.label);
532
+ }), P && p.when().then((w) => {
533
+ l.texture && (v(), w.renderer.on("resize", v));
1089
534
  });
1090
- function resizeSprite() {
1091
- if (!app.renderer?.screen)
535
+ function v() {
536
+ if (!r.renderer?.screen)
1092
537
  return;
1093
- const meta = sprite.texture._meta;
1094
- resize({
1095
- application: app,
1096
- sprite,
1097
- meta
538
+ const w = l.texture._meta;
539
+ t({
540
+ application: r,
541
+ sprite: l,
542
+ meta: w
1098
543
  });
1099
544
  }
1100
- onBeforeUnmount(() => {
1101
- app.renderer.off("resize", resizeSprite);
1102
- app.stage.removeChild(sprite);
545
+ S(() => {
546
+ r.renderer.off("resize", v), r.stage.removeChild(l);
1103
547
  });
1104
- function defaultResize() {
1105
- const scaleX = app.screen.width / sprite.texture.width;
1106
- const scaleY = app.screen.height / sprite.texture.height;
1107
- const scale = Math.min(scaleX, scaleY);
1108
- sprite.scale.set(scale);
1109
- sprite.x = (app.screen.width - sprite.width) / 2;
1110
- sprite.y = (app.screen.height - sprite.height) / 2;
548
+ function _() {
549
+ const w = r.screen.width / l.texture.width, e = r.screen.height / l.texture.height, n = Math.min(w, e);
550
+ l.scale.set(n), l.x = (r.screen.width - l.width) / 2, l.y = (r.screen.height - l.height) / 2;
1111
551
  }
1112
552
  return {
1113
- sprite,
1114
- resizeSprite,
1115
- application: app
553
+ sprite: l,
554
+ resizeSprite: v,
555
+ application: r
1116
556
  };
1117
557
  }
1118
-
1119
- var _sfc_main$8 = /* @__PURE__ */ defineComponent({
558
+ const Ne = /* @__PURE__ */ C({
1120
559
  __name: "apng",
1121
560
  props: {
1122
- ...props,
561
+ ...q,
1123
562
  url: {
1124
563
  type: String,
1125
- required: true
564
+ required: !0
1126
565
  }
1127
566
  },
1128
- emits,
1129
- setup(__props, { expose: __expose, emit: __emit }) {
1130
- __expose();
1131
- const props = __props;
1132
- const emit = __emit;
1133
- const compId = useId();
1134
- const getAlias = (frameIndex) => `${compId}-apng-frame-${frameIndex}`;
1135
- const { sprite, resizeSprite } = useSprite(props);
1136
- const frames = ref([]);
1137
- const index = ref(0);
1138
- const isLoaded = ref(false);
1139
- const error = ref("");
1140
- const textureMap = /* @__PURE__ */ new Map();
1141
- let timer = null;
1142
- let reusableCanvas = null;
1143
- let reusableCtx = null;
1144
- onMounted(() => loadAPNG(props.url));
1145
- function getReusableCanvas(width, height) {
1146
- if (!reusableCanvas) {
1147
- reusableCanvas = document.createElement("canvas");
1148
- reusableCtx = reusableCanvas.getContext("2d", {
1149
- willReadFrequently: true
1150
- });
1151
- }
1152
- if (reusableCanvas.width !== width || reusableCanvas.height !== height) {
1153
- reusableCanvas.width = width;
1154
- reusableCanvas.height = height;
1155
- }
1156
- return { canvas: reusableCanvas, ctx: reusableCtx };
567
+ emits: j,
568
+ setup(o, { emit: P }) {
569
+ const t = o, r = P, p = ne(), l = (c) => `${p}-apng-frame-${c}`, { sprite: v, resizeSprite: _ } = z(t), w = U([]), e = U(0), n = U(!1), a = U(""), u = /* @__PURE__ */ new Map();
570
+ let i = null, s = null, b = null;
571
+ ae(() => A(t.url));
572
+ function h(c, x) {
573
+ return s || (s = document.createElement("canvas"), b = s.getContext("2d", {
574
+ willReadFrequently: !0
575
+ })), (s.width !== c || s.height !== x) && (s.width = c, s.height = x), { canvas: s, ctx: b };
1157
576
  }
1158
- async function loadAPNG(url) {
577
+ async function A(c) {
1159
578
  try {
1160
- error.value = "";
1161
- isLoaded.value = false;
1162
- await cleanup();
1163
- const response = await fetch(url);
1164
- if (!response.ok) {
1165
- throw new Error(`\u52A0\u8F7DAPNG\u5931\u8D25: ${response.status}`);
1166
- }
1167
- const arrayBuffer = await response.arrayBuffer();
1168
- const apng = parseAPNG(arrayBuffer);
1169
- if (apng instanceof Error) {
1170
- throw new TypeError(`APNG\u89E3\u6790\u5931\u8D25: ${apng.message}`);
1171
- }
1172
- const { canvas, ctx } = getReusableCanvas(apng.width, apng.height);
1173
- const framePromises = apng.frames.map(async (frame, frameIndex) => {
1174
- ctx.clearRect(0, 0, canvas.width, canvas.height);
1175
- await frame.createImage();
1176
- const img = frame.imageElement;
1177
- ctx.drawImage(img, frame.left, frame.top);
1178
- const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
1179
- const alias = getAlias(frameIndex);
1180
- textureMap.set(alias, void 0);
1181
- ctx.putImageData(imageData, 0, 0);
1182
- const dataUrl = canvas.toDataURL();
1183
- Assets.add({ alias, src: dataUrl });
1184
- const texture = await Assets.load(alias);
1185
- textureMap.set(alias, texture);
1186
- if (frameIndex === 0) {
1187
- sprite.texture = texture;
1188
- resizeSprite();
1189
- }
1190
- return alias;
579
+ a.value = "", n.value = !1, await g();
580
+ const x = await fetch(c);
581
+ if (!x.ok)
582
+ throw new Error(`加载APNG失败: ${x.status}`);
583
+ const I = await x.arrayBuffer(), N = Ee(I);
584
+ if (N instanceof Error)
585
+ throw new TypeError(`APNG解析失败: ${N.message}`);
586
+ const { canvas: k, ctx: M } = h(N.width, N.height), O = N.frames.map(async (G, W) => {
587
+ M.clearRect(0, 0, k.width, k.height), await G.createImage();
588
+ const T = G.imageElement;
589
+ M.drawImage(T, G.left, G.top);
590
+ const D = M.getImageData(0, 0, k.width, k.height), E = l(W);
591
+ u.set(E, void 0), M.putImageData(D, 0, 0);
592
+ const $ = k.toDataURL();
593
+ R.add({ alias: E, src: $ });
594
+ const L = await R.load(E);
595
+ return u.set(E, L), W === 0 && (v.texture = L, _()), E;
1191
596
  });
1192
- frames.value = await Promise.all(framePromises);
1193
- isLoaded.value = true;
1194
- } catch (err) {
1195
- console.error("\u52A0\u8F7DAPNG\u5931\u8D25:", err);
1196
- error.value = err instanceof Error ? err.message : "\u52A0\u8F7DAPNG\u5931\u8D25";
1197
- emit("update:status", TickerStatus.stopped);
597
+ w.value = await Promise.all(O), n.value = !0;
598
+ } catch (x) {
599
+ console.error("加载APNG失败:", x), a.value = x instanceof Error ? x.message : "加载APNG失败", r("update:status", m.stopped);
1198
600
  }
1199
601
  }
1200
- function startFrameLoop() {
1201
- if (timer !== null)
1202
- return;
1203
- timer = window.setInterval(() => {
1204
- if (frames.value.length === 0 || props.status !== TickerStatus.playing) {
602
+ function y() {
603
+ i === null && (i = window.setInterval(() => {
604
+ if (w.value.length === 0 || t.status !== m.playing)
1205
605
  return;
1206
- }
1207
- const currentTexture = textureMap.get(
1208
- getAlias(index.value)
606
+ const c = u.get(
607
+ l(e.value)
1209
608
  );
1210
- if (currentTexture) {
1211
- const originIndex = index.value - 1;
1212
- if (originIndex >= 0 && !props.loop) {
1213
- Promise.resolve().then(() => sleep(500)).then(() => {
1214
- Assets.unload(getAlias(originIndex));
1215
- textureMap.delete(getAlias(originIndex));
1216
- });
1217
- }
1218
- sprite.texture = currentTexture;
1219
- resizeSprite();
1220
- index.value = props.loop ? (index.value + 1) % frames.value.length : index.value + 1;
1221
- } else {
1222
- if (!props.loop)
1223
- emit("update:status", TickerStatus.paused);
1224
- }
1225
- }, 1e3 / props.frameRate);
609
+ if (c) {
610
+ const x = e.value - 1;
611
+ x >= 0 && !t.loop && Promise.resolve().then(() => Z(500)).then(() => {
612
+ R.unload(l(x)), u.delete(l(x));
613
+ }), v.texture = c, _(), e.value = t.loop ? (e.value + 1) % w.value.length : e.value + 1;
614
+ } else
615
+ t.loop || r("update:status", m.paused);
616
+ }, 1e3 / t.frameRate));
1226
617
  }
1227
- function play() {
1228
- if (!isLoaded.value || frames.value.length <= 1) {
1229
- return;
1230
- }
1231
- emit("update:status", TickerStatus.playing);
1232
- startFrameLoop();
618
+ function F() {
619
+ !n.value || w.value.length <= 1 || (r("update:status", m.playing), y());
1233
620
  }
1234
- function pause() {
1235
- if (timer !== null) {
1236
- clearInterval(timer);
1237
- timer = null;
1238
- }
1239
- emit("update:status", TickerStatus.paused);
621
+ function d() {
622
+ i !== null && (clearInterval(i), i = null), r("update:status", m.paused);
1240
623
  }
1241
- function stop() {
1242
- if (timer !== null) {
1243
- clearInterval(timer);
1244
- timer = null;
1245
- }
1246
- index.value = 0;
1247
- const firstTexture = textureMap.get(getAlias(0));
1248
- if (firstTexture) {
1249
- sprite.texture = firstTexture;
1250
- resizeSprite();
1251
- }
1252
- emit("update:status", TickerStatus.stopped);
624
+ function f() {
625
+ i !== null && (clearInterval(i), i = null), e.value = 0;
626
+ const c = u.get(l(0));
627
+ c && (v.texture = c, _()), r("update:status", m.stopped);
1253
628
  }
1254
- async function cleanup() {
1255
- if (timer !== null) {
1256
- clearInterval(timer);
1257
- timer = null;
1258
- }
1259
- const unloadPromises = [];
1260
- for (const [alias, texture] of textureMap) {
1261
- if (texture && texture !== Texture.EMPTY) {
1262
- unloadPromises.push(Assets.unload(alias));
1263
- }
1264
- }
1265
- await Promise.all(unloadPromises);
1266
- textureMap.clear();
1267
- frames.value = [];
1268
- index.value = 0;
1269
- isLoaded.value = false;
1270
- error.value = "";
1271
- if (reusableCanvas) {
1272
- reusableCanvas.width = 0;
1273
- reusableCanvas.height = 0;
1274
- }
629
+ async function g() {
630
+ i !== null && (clearInterval(i), i = null);
631
+ const c = [];
632
+ for (const [x, I] of u)
633
+ I && I !== ee.EMPTY && c.push(R.unload(x));
634
+ await Promise.all(c), u.clear(), w.value = [], e.value = 0, n.value = !1, a.value = "", s && (s.width = 0, s.height = 0);
1275
635
  }
1276
- watchEffect(() => {
1277
- switch (props.status) {
1278
- case TickerStatus.play:
1279
- play();
636
+ return B(() => {
637
+ switch (t.status) {
638
+ case m.play:
639
+ F();
1280
640
  break;
1281
- case TickerStatus.pause:
1282
- pause();
641
+ case m.pause:
642
+ d();
1283
643
  break;
1284
- case TickerStatus.stop:
1285
- stop();
644
+ case m.stop:
645
+ f();
1286
646
  break;
1287
647
  }
1288
- });
1289
- onBeforeUnmount(async () => {
1290
- await cleanup();
1291
- reusableCanvas = null;
1292
- reusableCtx = null;
1293
- });
1294
- const __returned__ = { props, emit, compId, getAlias, sprite, resizeSprite, frames, index, isLoaded, error, textureMap, get timer() {
1295
- return timer;
1296
- }, set timer(v) {
1297
- timer = v;
1298
- }, get reusableCanvas() {
1299
- return reusableCanvas;
1300
- }, set reusableCanvas(v) {
1301
- reusableCanvas = v;
1302
- }, get reusableCtx() {
1303
- return reusableCtx;
1304
- }, set reusableCtx(v) {
1305
- reusableCtx = v;
1306
- }, getReusableCanvas, loadAPNG, startFrameLoop, play, pause, stop, cleanup };
1307
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1308
- return __returned__;
648
+ }), S(async () => {
649
+ await g(), s = null, b = null;
650
+ }), (c, x) => V(c.$slots, "default");
1309
651
  }
1310
- });
1311
-
1312
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
1313
- return renderSlot(_ctx.$slots, "default");
1314
- }
1315
- var ApngComp = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/apng.vue"]]);
1316
-
1317
- var _sfc_main$7 = /* @__PURE__ */ defineComponent({
652
+ }), Ge = /* @__PURE__ */ C({
1318
653
  __name: "bitmap-generator",
1319
654
  props: {
1320
- ...pickObject(props, {
655
+ ...se(q, {
1321
656
  excludes: ["loop"]
1322
657
  }),
1323
658
  generator: {
1324
659
  type: Object,
1325
- required: true
660
+ required: !0
1326
661
  }
1327
662
  },
1328
663
  emits: {
1329
664
  "update:status": null,
1330
- "load": (e) => e
665
+ load: (o) => o
1331
666
  },
1332
- setup(__props, { expose: __expose, emit: __emit }) {
1333
- __expose();
1334
- const props = __props;
1335
- const emit = __emit;
1336
- const { sprite, resizeSprite, application } = useSprite(props);
1337
- const texture = new Texture({
1338
- dynamic: true
667
+ setup(o, { emit: P }) {
668
+ const t = o, r = P, { sprite: p, resizeSprite: l, application: v } = z(t), _ = new ee({
669
+ dynamic: !0
1339
670
  });
1340
- sprite.texture = texture;
1341
- function updateTextureFromBitmap(bitmap) {
1342
- texture.source.destroy();
1343
- const source = new ImageSource({
1344
- resource: bitmap
671
+ p.texture = _;
672
+ function w(i) {
673
+ _.source.destroy();
674
+ const s = new oe({
675
+ resource: i
1345
676
  });
1346
- texture.source = source;
1347
- texture.update();
1348
- resizeSprite();
677
+ _.source = s, _.update(), l();
1349
678
  }
1350
- emit("load", {
1351
- application,
1352
- sprite
1353
- });
1354
- watch(() => props.status, (newStatus) => {
1355
- newStatus === TickerStatus.play && play();
1356
- newStatus === TickerStatus.pause && pause();
1357
- newStatus === TickerStatus.stop && stop();
1358
- }, { immediate: true });
1359
- function drawFrame() {
1360
- if (props.status !== TickerStatus.playing) {
1361
- return;
1362
- }
1363
- props.generator.next().then(({ value, done }) => {
1364
- if (done) {
1365
- return emit("update:status", TickerStatus.stopped);
1366
- }
1367
- updateTextureFromBitmap(value);
679
+ r("load", {
680
+ application: v,
681
+ sprite: p
682
+ }), Q(() => t.status, (i) => {
683
+ i === m.play && n(), i === m.pause && a(), i === m.stop && u();
684
+ }, { immediate: !0 });
685
+ function e() {
686
+ t.status === m.playing && t.generator.next().then(({ value: i, done: s }) => {
687
+ if (s)
688
+ return r("update:status", m.stopped);
689
+ w(i);
1368
690
  });
1369
691
  }
1370
- function play() {
1371
- application.ticker.minFPS = props.frameRate;
1372
- application.ticker.maxFPS = props.frameRate;
1373
- emit("update:status", TickerStatus.playing);
1374
- application.ticker.add(drawFrame);
692
+ function n() {
693
+ v.ticker.minFPS = t.frameRate, v.ticker.maxFPS = t.frameRate, r("update:status", m.playing), v.ticker.add(e);
1375
694
  }
1376
- function pause() {
1377
- application.ticker.remove(drawFrame);
1378
- emit("update:status", TickerStatus.paused);
695
+ function a() {
696
+ v.ticker.remove(e), r("update:status", m.paused);
1379
697
  }
1380
- function stop() {
1381
- application.ticker.remove(drawFrame);
1382
- emit("update:status", TickerStatus.stopped);
698
+ function u() {
699
+ v.ticker.remove(e), r("update:status", m.stopped);
1383
700
  }
1384
- onBeforeUnmount(() => {
1385
- stop();
1386
- texture.destroy();
1387
- });
1388
- const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTextureFromBitmap, drawFrame, play, pause, stop };
1389
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1390
- return __returned__;
701
+ return S(() => {
702
+ u(), _.destroy();
703
+ }), (i, s) => V(i.$slots, "default");
1391
704
  }
1392
- });
1393
-
1394
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
1395
- return renderSlot(_ctx.$slots, "default");
1396
- }
1397
- var bitmapGenerator = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/bitmap-generator.vue"]]);
1398
-
1399
- var _sfc_main$6 = /* @__PURE__ */ defineComponent({
705
+ }), De = /* @__PURE__ */ C({
1400
706
  __name: "bitmap",
1401
707
  props: {
1402
- ...pickObject(props, {
708
+ ...se(q, {
1403
709
  excludes: ["loop"]
1404
710
  }),
1405
711
  data: {
1406
712
  type: void 0,
1407
- required: true
713
+ required: !0
1408
714
  },
1409
715
  frameIndex: {
1410
716
  type: Number
1411
717
  }
1412
718
  },
1413
719
  emits: {
1414
- ...emits,
1415
- "load": (e) => e,
720
+ ...j,
721
+ load: (o) => o,
1416
722
  "update:frameIndex": null,
1417
- "notFound": (_index) => true
723
+ notFound: (o) => !0
1418
724
  },
1419
- setup(__props, { expose: __expose, emit: __emit }) {
1420
- __expose();
1421
- const props = __props;
1422
- const emit = __emit;
1423
- const { sprite, resizeSprite, application } = useSprite(props);
1424
- const texture = new Texture({
1425
- dynamic: true
725
+ setup(o, { emit: P }) {
726
+ const t = o, r = P, { sprite: p, resizeSprite: l, application: v } = z(t), _ = new ee({
727
+ dynamic: !0
1426
728
  });
1427
- sprite.texture = texture;
1428
- function updateTextureFromBitmap(bitmap) {
1429
- texture.source?.resource?.close();
1430
- texture.source?.destroy();
1431
- const source = new ImageSource({
1432
- resource: bitmap
729
+ p.texture = _;
730
+ function w(d) {
731
+ _.source?.resource?.close(), _.source?.destroy();
732
+ const f = new oe({
733
+ resource: d
1433
734
  });
1434
- texture.source = source;
1435
- texture.update();
1436
- resizeSprite();
735
+ _.source = f, _.update(), l();
1437
736
  }
1438
- emit("load", {
1439
- application,
1440
- sprite
737
+ r("load", {
738
+ application: v,
739
+ sprite: p
1441
740
  });
1442
- const index = useModelComputed({
741
+ const e = ie({
1443
742
  default: 0,
1444
743
  key: "frameIndex"
1445
- }, props, emit);
1446
- const lastScheduledClearIndex = ref(-1);
1447
- function scheduleClearFrame(frameIndex) {
1448
- if (frameIndex <= lastScheduledClearIndex.value)
1449
- return;
1450
- lastScheduledClearIndex.value = frameIndex;
1451
- sleep(0).then(() => {
1452
- emit("setData", {
1453
- k: frameIndex,
744
+ }, t, r), n = U(-1);
745
+ function a(d) {
746
+ d <= n.value || (n.value = d, Z(0).then(() => {
747
+ r("setData", {
748
+ k: d,
1454
749
  v: null
1455
750
  });
1456
- });
751
+ }));
1457
752
  }
1458
- let animationId = null;
1459
- let lastFrameTime = 0;
1460
- let frameCount = 0;
1461
- let lastFpsUpdateTime = 0;
1462
- function startFrameLoop() {
1463
- if (animationId !== null)
753
+ let u = null, i = 0, s = 0, b = 0;
754
+ function h() {
755
+ if (u !== null)
1464
756
  return;
1465
- lastFrameTime = performance.now();
1466
- lastFpsUpdateTime = lastFrameTime;
1467
- frameCount = 0;
1468
- function renderFrame() {
1469
- const now = performance.now();
1470
- const frameDuration = 1e3 / props.frameRate;
1471
- const delta = now - lastFrameTime;
1472
- if (delta >= frameDuration) {
1473
- lastFrameTime = now - delta % frameDuration;
1474
- drawFrame();
1475
- frameCount++;
1476
- const elapsed = now - lastFpsUpdateTime;
1477
- if (elapsed >= 1e3) {
1478
- const currentFps = Math.round(frameCount * 1e3 / elapsed);
1479
- console.log(`[Bitmap] FPS: ${currentFps}`);
1480
- frameCount = 0;
1481
- lastFpsUpdateTime = now;
757
+ i = performance.now(), b = i, s = 0;
758
+ function d() {
759
+ const g = performance.now(), c = 1e3 / t.frameRate, x = g - i;
760
+ if (x >= c) {
761
+ i = g - x % c, f(), s++;
762
+ const I = g - b;
763
+ if (I >= 1e3) {
764
+ const N = Math.round(s * 1e3 / I);
765
+ console.log(`[Bitmap] FPS: ${N}`), s = 0, b = g;
1482
766
  }
1483
767
  }
1484
- if (props.status === TickerStatus.playing) {
1485
- animationId = requestAnimationFrame(renderFrame);
1486
- } else {
1487
- animationId = null;
1488
- }
768
+ t.status === m.playing ? u = requestAnimationFrame(d) : u = null;
1489
769
  }
1490
- function drawFrame() {
1491
- if (props.data.length === 0 || props.status !== TickerStatus.playing) {
770
+ function f() {
771
+ if (t.data.length === 0 || t.status !== m.playing)
1492
772
  return;
1493
- }
1494
- const bitmap = props.data[index.value];
1495
- if (bitmap) {
1496
- const originIndex = index.value - 1;
1497
- if (originIndex >= 0) {
1498
- scheduleClearFrame(originIndex);
1499
- }
1500
- updateTextureFromBitmap(bitmap);
1501
- index.value = index.value + 1;
1502
- } else {
773
+ const g = t.data[e.value];
774
+ if (g) {
775
+ const c = e.value - 1;
776
+ c >= 0 && a(c), w(g), e.value = e.value + 1;
777
+ } else
1503
778
  console.warn(
1504
- `Bitmap for index ${index.value} not found. Ensure the data is loaded.`
1505
- );
1506
- emit("notFound", index.value);
1507
- }
779
+ `Bitmap for index ${e.value} not found. Ensure the data is loaded.`
780
+ ), r("notFound", e.value);
1508
781
  }
1509
- animationId = requestAnimationFrame(renderFrame);
782
+ u = requestAnimationFrame(d);
1510
783
  }
1511
- watchEffect(() => {
1512
- if (props.prerender && index.value === 0 && props.data.length > 0 && props.data[0]) {
1513
- updateTextureFromBitmap(props.data[0]);
1514
- }
1515
- });
1516
- watch(() => props.status, (newStatus) => {
1517
- newStatus === TickerStatus.play && play();
1518
- newStatus === TickerStatus.pause && pause();
1519
- newStatus === TickerStatus.stop && stop();
1520
- }, { immediate: true });
1521
- function play() {
1522
- if (props.data.length > 0) {
1523
- emit("update:status", TickerStatus.playing);
1524
- startFrameLoop();
1525
- } else {
1526
- emit("update:status", TickerStatus.stopped);
1527
- }
784
+ B(() => {
785
+ t.prerender && e.value === 0 && t.data.length > 0 && t.data[0] && w(t.data[0]);
786
+ }), Q(() => t.status, (d) => {
787
+ d === m.play && A(), d === m.pause && y(), d === m.stop && F();
788
+ }, { immediate: !0 });
789
+ function A() {
790
+ t.data.length > 0 ? (r("update:status", m.playing), h()) : r("update:status", m.stopped);
1528
791
  }
1529
- function pause() {
1530
- emit("update:status", TickerStatus.paused);
792
+ function y() {
793
+ r("update:status", m.paused);
1531
794
  }
1532
- function stop() {
1533
- emit("update:status", TickerStatus.stopped);
1534
- if (animationId !== null) {
1535
- cancelAnimationFrame(animationId);
1536
- animationId = null;
1537
- }
1538
- emit("update:data", []);
1539
- index.value = 0;
1540
- lastScheduledClearIndex.value = -1;
795
+ function F() {
796
+ r("update:status", m.stopped), u !== null && (cancelAnimationFrame(u), u = null), r("update:data", []), e.value = 0, n.value = -1;
1541
797
  }
1542
- onBeforeUnmount(() => {
1543
- stop();
1544
- texture.destroy();
1545
- });
1546
- const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTextureFromBitmap, index, lastScheduledClearIndex, scheduleClearFrame, get animationId() {
1547
- return animationId;
1548
- }, set animationId(v) {
1549
- animationId = v;
1550
- }, get lastFrameTime() {
1551
- return lastFrameTime;
1552
- }, set lastFrameTime(v) {
1553
- lastFrameTime = v;
1554
- }, get frameCount() {
1555
- return frameCount;
1556
- }, set frameCount(v) {
1557
- frameCount = v;
1558
- }, get lastFpsUpdateTime() {
1559
- return lastFpsUpdateTime;
1560
- }, set lastFpsUpdateTime(v) {
1561
- lastFpsUpdateTime = v;
1562
- }, startFrameLoop, play, pause, stop };
1563
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1564
- return __returned__;
798
+ return S(() => {
799
+ F(), _.destroy();
800
+ }), (d, f) => V(d.$slots, "default");
1565
801
  }
1566
- });
1567
-
1568
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
1569
- return renderSlot(_ctx.$slots, "default");
1570
- }
1571
- var Bitmap = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/bitmap.vue"]]);
1572
-
1573
- var _sfc_main$5 = /* @__PURE__ */ defineComponent({
802
+ }), je = /* @__PURE__ */ C({
1574
803
  __name: "buffer-image",
1575
804
  props: {
1576
- ...pickObject(props, {
805
+ ...se(q, {
1577
806
  excludes: ["loop"]
1578
807
  }),
1579
808
  data: {
1580
809
  type: Array,
1581
- required: true
810
+ required: !0
1582
811
  },
1583
812
  /**
1584
813
  * Pixel format for BufferImageSource.
@@ -1593,525 +822,285 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
1593
822
  },
1594
823
  height: {
1595
824
  type: Number,
1596
- required: true
825
+ required: !0
1597
826
  },
1598
827
  width: {
1599
828
  type: Number,
1600
- required: true
829
+ required: !0
1601
830
  }
1602
831
  },
1603
832
  emits: {
1604
- ...emits,
1605
- "load": (e) => e,
833
+ ...j,
834
+ load: (o) => o,
1606
835
  "update:frameIndex": null,
1607
- "notFound": (_index) => true
836
+ notFound: (o) => !0
1608
837
  },
1609
- setup(__props, { expose: __expose, emit: __emit }) {
1610
- __expose();
1611
- const props = __props;
1612
- const emit = __emit;
1613
- const { sprite, resizeSprite, application } = useSprite(props);
1614
- const texture = new Texture({
1615
- dynamic: true
838
+ setup(o, { emit: P }) {
839
+ const t = o, r = P, { sprite: p, resizeSprite: l, application: v } = z(t), _ = new ee({
840
+ dynamic: !0
1616
841
  });
1617
- sprite.texture = texture;
1618
- function updateTexture(resource) {
1619
- texture.source?.destroy();
1620
- const source = new BufferImageSource({
1621
- resource,
1622
- height: props.height,
1623
- width: props.width,
1624
- format: props.format
842
+ p.texture = _;
843
+ function w(d) {
844
+ _.source?.destroy();
845
+ const f = new we({
846
+ resource: d,
847
+ height: t.height,
848
+ width: t.width,
849
+ format: t.format
1625
850
  });
1626
- texture.source = source;
1627
- texture.update();
1628
- resizeSprite();
851
+ _.source = f, _.update(), l();
1629
852
  }
1630
- emit("load", {
1631
- application,
1632
- sprite
853
+ r("load", {
854
+ application: v,
855
+ sprite: p
1633
856
  });
1634
- const index = useModelComputed({
857
+ const e = ie({
1635
858
  default: 0,
1636
859
  key: "frameIndex"
1637
- }, props, emit);
1638
- const lastScheduledClearIndex = ref(-1);
1639
- function scheduleClearFrame(frameIndex) {
1640
- if (frameIndex <= lastScheduledClearIndex.value)
1641
- return;
1642
- lastScheduledClearIndex.value = frameIndex;
1643
- sleep(0).then(() => {
1644
- emit("setData", {
1645
- k: frameIndex,
860
+ }, t, r), n = U(-1);
861
+ function a(d) {
862
+ d <= n.value || (n.value = d, Z(0).then(() => {
863
+ r("setData", {
864
+ k: d,
1646
865
  v: null
1647
866
  });
1648
- });
867
+ }));
1649
868
  }
1650
- let animationId = null;
1651
- let lastFrameTime = 0;
1652
- let frameCount = 0;
1653
- let lastFpsUpdateTime = 0;
1654
- function startFrameLoop() {
1655
- if (animationId !== null)
869
+ let u = null, i = 0, s = 0, b = 0;
870
+ function h() {
871
+ if (u !== null)
1656
872
  return;
1657
- lastFrameTime = performance.now();
1658
- lastFpsUpdateTime = lastFrameTime;
1659
- frameCount = 0;
1660
- function renderFrame() {
1661
- const now = performance.now();
1662
- const frameDuration = 1e3 / props.frameRate;
1663
- const delta = now - lastFrameTime;
1664
- if (delta >= frameDuration) {
1665
- lastFrameTime = now - delta % frameDuration;
1666
- drawFrame();
1667
- frameCount++;
1668
- const elapsed = now - lastFpsUpdateTime;
1669
- if (elapsed >= 1e3) {
1670
- const currentFps = Math.round(frameCount * 1e3 / elapsed);
1671
- console.log(`[Bitmap] FPS: ${currentFps}`);
1672
- frameCount = 0;
1673
- lastFpsUpdateTime = now;
873
+ i = performance.now(), b = i, s = 0;
874
+ function d() {
875
+ const g = performance.now(), c = 1e3 / t.frameRate, x = g - i;
876
+ if (x >= c) {
877
+ i = g - x % c, f(), s++;
878
+ const I = g - b;
879
+ if (I >= 1e3) {
880
+ const N = Math.round(s * 1e3 / I);
881
+ console.log(`[Bitmap] FPS: ${N}`), s = 0, b = g;
1674
882
  }
1675
883
  }
1676
- if (props.status === TickerStatus.playing) {
1677
- animationId = requestAnimationFrame(renderFrame);
1678
- } else {
1679
- animationId = null;
1680
- }
884
+ t.status === m.playing ? u = requestAnimationFrame(d) : u = null;
1681
885
  }
1682
- function drawFrame() {
1683
- if (props.data.length === 0 || props.status !== TickerStatus.playing) {
886
+ function f() {
887
+ if (t.data.length === 0 || t.status !== m.playing)
1684
888
  return;
1685
- }
1686
- const bitmap = props.data[index.value];
1687
- if (bitmap) {
1688
- const originIndex = index.value - 1;
1689
- if (originIndex >= 0) {
1690
- scheduleClearFrame(originIndex);
1691
- }
1692
- updateTexture(bitmap);
1693
- index.value = index.value + 1;
1694
- } else {
889
+ const g = t.data[e.value];
890
+ if (g) {
891
+ const c = e.value - 1;
892
+ c >= 0 && a(c), w(g), e.value = e.value + 1;
893
+ } else
1695
894
  console.warn(
1696
- `Bitmap for index ${index.value} not found. Ensure the data is loaded.`
1697
- );
1698
- emit("notFound", index.value);
1699
- }
895
+ `Bitmap for index ${e.value} not found. Ensure the data is loaded.`
896
+ ), r("notFound", e.value);
1700
897
  }
1701
- animationId = requestAnimationFrame(renderFrame);
898
+ u = requestAnimationFrame(d);
1702
899
  }
1703
- watchEffect(() => {
1704
- if (props.prerender && index.value === 0 && props.data.length > 0 && props.data[0]) {
1705
- updateTexture(props.data[0]);
1706
- }
1707
- });
1708
- watch(() => props.status, (newStatus) => {
1709
- newStatus === TickerStatus.play && play();
1710
- newStatus === TickerStatus.pause && pause();
1711
- newStatus === TickerStatus.stop && stop();
1712
- }, { immediate: true });
1713
- function play() {
1714
- if (props.data.length > 0) {
1715
- emit("update:status", TickerStatus.playing);
1716
- startFrameLoop();
1717
- } else {
1718
- emit("update:status", TickerStatus.stopped);
1719
- }
900
+ B(() => {
901
+ t.prerender && e.value === 0 && t.data.length > 0 && t.data[0] && w(t.data[0]);
902
+ }), Q(() => t.status, (d) => {
903
+ d === m.play && A(), d === m.pause && y(), d === m.stop && F();
904
+ }, { immediate: !0 });
905
+ function A() {
906
+ t.data.length > 0 ? (r("update:status", m.playing), h()) : r("update:status", m.stopped);
1720
907
  }
1721
- function pause() {
1722
- emit("update:status", TickerStatus.paused);
908
+ function y() {
909
+ r("update:status", m.paused);
1723
910
  }
1724
- function stop() {
1725
- emit("update:status", TickerStatus.stopped);
1726
- if (animationId !== null) {
1727
- cancelAnimationFrame(animationId);
1728
- animationId = null;
1729
- }
1730
- emit("update:data", []);
1731
- index.value = 0;
1732
- lastScheduledClearIndex.value = -1;
911
+ function F() {
912
+ r("update:status", m.stopped), u !== null && (cancelAnimationFrame(u), u = null), r("update:data", []), e.value = 0, n.value = -1;
1733
913
  }
1734
- onBeforeUnmount(() => {
1735
- stop();
1736
- texture.destroy();
1737
- });
1738
- const __returned__ = { props, emit, sprite, resizeSprite, application, texture, updateTexture, index, lastScheduledClearIndex, scheduleClearFrame, get animationId() {
1739
- return animationId;
1740
- }, set animationId(v) {
1741
- animationId = v;
1742
- }, get lastFrameTime() {
1743
- return lastFrameTime;
1744
- }, set lastFrameTime(v) {
1745
- lastFrameTime = v;
1746
- }, get frameCount() {
1747
- return frameCount;
1748
- }, set frameCount(v) {
1749
- frameCount = v;
1750
- }, get lastFpsUpdateTime() {
1751
- return lastFpsUpdateTime;
1752
- }, set lastFpsUpdateTime(v) {
1753
- lastFpsUpdateTime = v;
1754
- }, startFrameLoop, play, pause, stop };
1755
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1756
- return __returned__;
914
+ return S(() => {
915
+ F(), _.destroy();
916
+ }), (d, f) => V(d.$slots, "default");
1757
917
  }
1758
- });
1759
-
1760
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
1761
- return renderSlot(_ctx.$slots, "default");
1762
- }
1763
- var bufferImage = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/buffer-image.vue"]]);
1764
-
1765
- var _sfc_main$4 = /* @__PURE__ */ defineComponent({
918
+ }), ze = /* @__PURE__ */ C({
1766
919
  __name: "core",
1767
920
  props: {
1768
- ...props,
921
+ ...q,
1769
922
  data: {
1770
923
  type: void 0,
1771
- required: true
924
+ required: !0
1772
925
  },
1773
926
  frameIndex: {
1774
927
  type: Number
1775
928
  }
1776
929
  },
1777
930
  emits: {
1778
- ...emits,
1779
- "load": (e) => e,
931
+ ...j,
932
+ load: (o) => o,
1780
933
  "update:frameIndex": null,
1781
- "notFound": (_index) => true
934
+ notFound: (o) => !0
1782
935
  },
1783
- setup(__props, { expose: __expose, emit: __emit }) {
1784
- __expose();
1785
- const props = __props;
1786
- const emit = __emit;
1787
- const compId = useId();
1788
- const getAlias = (key) => `${compId}-${key}`;
1789
- const { sprite, resizeSprite, application } = useSprite(props);
1790
- const textureMap = /* @__PURE__ */ new Map();
1791
- const completedIndex = ref(0);
1792
- const enabledData = computed(() => {
1793
- return props.data.slice(completedIndex.value);
1794
- });
1795
- watchEffect(() => {
1796
- for (const key in enabledData.value) {
1797
- const theKey = +key + completedIndex.value;
1798
- const alias = `${compId}-${theKey}`;
1799
- const src = typeof enabledData.value[key] === "string" ? enabledData.value[key] : enabledData.value[key]?.src;
1800
- if (!src) {
1801
- continue;
1802
- }
1803
- if (textureMap.has(alias)) {
1804
- continue;
1805
- }
1806
- Assets.add({
1807
- alias,
1808
- src,
936
+ setup(o, { emit: P }) {
937
+ const t = o, r = P, p = ne(), l = (F) => `${p}-${F}`, { sprite: v, resizeSprite: _, application: w } = z(t), e = /* @__PURE__ */ new Map(), n = U(0), a = J(() => t.data.slice(n.value));
938
+ B(() => {
939
+ for (const F in a.value) {
940
+ const d = +F + n.value, f = `${p}-${d}`, g = typeof a.value[F] == "string" ? a.value[F] : a.value[F]?.src;
941
+ g && (e.has(f) || (R.add({
942
+ alias: f,
943
+ src: g,
1809
944
  loadParser: "loadTextures"
1810
- });
1811
- textureMap.set(alias, void 0);
1812
- Assets.load(alias).then((res) => {
1813
- res._meta = enabledData.value[key];
1814
- textureMap.set(alias, res);
1815
- if (props.prerender && theKey === 0) {
1816
- sprite.texture = res;
1817
- resizeSprite();
1818
- }
1819
- });
945
+ }), e.set(f, void 0), R.load(f).then((c) => {
946
+ c._meta = a.value[F], e.set(f, c), t.prerender && d === 0 && (v.texture = c, _());
947
+ })));
1820
948
  }
949
+ }), r("load", {
950
+ application: w,
951
+ sprite: v
1821
952
  });
1822
- emit("load", {
1823
- application,
1824
- sprite
1825
- });
1826
- const index = useModelComputed({
953
+ const u = ie({
1827
954
  default: 0,
1828
955
  key: "frameIndex"
1829
- }, props, emit);
1830
- let animationId = null;
1831
- let lastFrameTime = 0;
1832
- function startFrameLoop() {
1833
- if (animationId !== null)
956
+ }, t, r);
957
+ let i = null, s = 0;
958
+ function b() {
959
+ if (i !== null)
1834
960
  return;
1835
- lastFrameTime = performance.now();
1836
- function renderFrame() {
1837
- const now = performance.now();
1838
- const frameDuration = 1e3 / props.frameRate;
1839
- const delta = now - lastFrameTime;
1840
- if (delta >= frameDuration) {
1841
- lastFrameTime = now - delta % frameDuration;
1842
- drawFrame();
1843
- }
1844
- if (props.status === TickerStatus.playing) {
1845
- animationId = requestAnimationFrame(renderFrame);
1846
- } else {
1847
- animationId = null;
1848
- }
961
+ s = performance.now();
962
+ function F() {
963
+ const f = performance.now(), g = 1e3 / t.frameRate, c = f - s;
964
+ c >= g && (s = f - c % g, d()), t.status === m.playing ? i = requestAnimationFrame(F) : i = null;
1849
965
  }
1850
- function drawFrame() {
1851
- if (props.data.length === 0 || props.status !== TickerStatus.playing) {
966
+ function d() {
967
+ if (t.data.length === 0 || t.status !== m.playing)
1852
968
  return;
1853
- }
1854
- const currentTexture = textureMap.get(
1855
- getAlias(index.value)
969
+ const f = e.get(
970
+ l(u.value)
1856
971
  );
1857
- if (currentTexture) {
1858
- const originTexture = sprite.texture;
1859
- const originIndex = index.value - 1;
1860
- if (originTexture && originIndex >= 0 && !props.loop) {
1861
- Promise.resolve(sleep(500)).then(() => Assets.unload(
1862
- getAlias(originIndex)
1863
- )).then(() => {
1864
- textureMap.set(
1865
- getAlias(originIndex),
1866
- void 0
1867
- );
1868
- emit("setData", {
1869
- k: originIndex,
1870
- v: ""
1871
- });
1872
- completedIndex.value = originIndex;
1873
- });
1874
- }
1875
- sprite.texture = currentTexture;
1876
- resizeSprite();
1877
- index.value = props.loop ? (index.value + 1) % props.data.length : index.value + 1;
1878
- } else {
972
+ if (f) {
973
+ const g = v.texture, c = u.value - 1;
974
+ g && c >= 0 && !t.loop && Promise.resolve(Z(500)).then(() => R.unload(
975
+ l(c)
976
+ )).then(() => {
977
+ e.set(
978
+ l(c),
979
+ void 0
980
+ ), r("setData", {
981
+ k: c,
982
+ v: ""
983
+ }), n.value = c;
984
+ }), v.texture = f, _(), u.value = t.loop ? (u.value + 1) % t.data.length : u.value + 1;
985
+ } else
1879
986
  console.warn(
1880
- `Texture for index ${index.value} not found. Ensure the texture is loaded.`
1881
- );
1882
- emit("notFound", index.value);
1883
- if (!props.loop)
1884
- emit("update:status", TickerStatus.paused);
1885
- }
987
+ `Texture for index ${u.value} not found. Ensure the texture is loaded.`
988
+ ), r("notFound", u.value), t.loop || r("update:status", m.paused);
1886
989
  }
1887
- animationId = requestAnimationFrame(renderFrame);
990
+ i = requestAnimationFrame(F);
1888
991
  }
1889
- watch(() => props.status, (newStatus) => {
1890
- newStatus === TickerStatus.play && play();
1891
- newStatus === TickerStatus.pause && pause();
1892
- newStatus === TickerStatus.stop && stop();
1893
- }, { immediate: true });
1894
- function play() {
1895
- if (props.data.length > 0) {
1896
- emit("update:status", TickerStatus.playing);
1897
- startFrameLoop();
1898
- } else {
1899
- emit("update:status", TickerStatus.stopped);
1900
- }
992
+ Q(() => t.status, (F) => {
993
+ F === m.play && h(), F === m.pause && A(), F === m.stop && y();
994
+ }, { immediate: !0 });
995
+ function h() {
996
+ t.data.length > 0 ? (r("update:status", m.playing), b()) : r("update:status", m.stopped);
1901
997
  }
1902
- function pause() {
1903
- emit("update:status", TickerStatus.paused);
998
+ function A() {
999
+ r("update:status", m.paused);
1904
1000
  }
1905
- function stop() {
1906
- emit("update:status", TickerStatus.stopped);
1907
- if (animationId !== null) {
1908
- cancelAnimationFrame(animationId);
1909
- animationId = null;
1910
- }
1911
- emit("update:data", []);
1912
- textureMap.clear();
1913
- index.value = 0;
1001
+ function y() {
1002
+ r("update:status", m.stopped), i !== null && (cancelAnimationFrame(i), i = null), r("update:data", []), e.clear(), u.value = 0;
1914
1003
  }
1915
- onBeforeUnmount(() => {
1916
- const entries = Array.from(textureMap.entries());
1917
- entries.forEach(([alias, texture]) => {
1918
- if (texture) {
1919
- Assets.unload(alias);
1920
- }
1921
- });
1922
- stop();
1923
- });
1924
- const __returned__ = { props, emit, compId, getAlias, sprite, resizeSprite, application, textureMap, completedIndex, enabledData, index, get animationId() {
1925
- return animationId;
1926
- }, set animationId(v) {
1927
- animationId = v;
1928
- }, get lastFrameTime() {
1929
- return lastFrameTime;
1930
- }, set lastFrameTime(v) {
1931
- lastFrameTime = v;
1932
- }, startFrameLoop, play, pause, stop };
1933
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1934
- return __returned__;
1004
+ return S(() => {
1005
+ Array.from(e.entries()).forEach(([d, f]) => {
1006
+ f && R.unload(d);
1007
+ }), y();
1008
+ }), (F, d) => V(F.$slots, "default");
1935
1009
  }
1936
- });
1937
-
1938
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
1939
- return renderSlot(_ctx.$slots, "default");
1940
- }
1941
- var core = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/core.vue"]]);
1942
-
1943
- var _sfc_main$3 = /* @__PURE__ */ defineComponent({
1010
+ }), Le = /* @__PURE__ */ C({
1944
1011
  __name: "provider",
1945
- setup(__props, { expose: __expose }) {
1946
- __expose();
1947
- initPixiApp();
1948
- const __returned__ = {};
1949
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
1950
- return __returned__;
1012
+ setup(o) {
1013
+ return Ie(), (P, t) => V(P.$slots, "default");
1951
1014
  }
1952
- });
1953
-
1954
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
1955
- return renderSlot(_ctx.$slots, "default");
1956
- }
1957
- var ProviderComp = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/provider.vue"]]);
1958
-
1959
- var _sfc_main$2 = /* @__PURE__ */ defineComponent({
1015
+ }), Re = /* @__PURE__ */ C({
1960
1016
  __name: "video",
1961
1017
  props: {
1962
- ...props,
1018
+ ...q,
1963
1019
  url: {
1964
1020
  type: String,
1965
- required: true
1021
+ required: !0
1966
1022
  }
1967
1023
  },
1968
- emits,
1969
- setup(__props, { expose: __expose, emit: __emit }) {
1970
- __expose();
1971
- const props = __props;
1972
- const emit = __emit;
1973
- const compId = useId();
1974
- const getAlias = () => `${compId}-video`;
1975
- const { sprite, resizeSprite } = useSprite(props);
1976
- const texture = ref();
1977
- const video = computed(() => {
1978
- if (texture.value?.source && texture.value.source.resource) {
1979
- const resource = texture.value.source.resource;
1980
- if (resource instanceof HTMLVideoElement) {
1981
- return resource;
1982
- }
1024
+ emits: j,
1025
+ setup(o, { emit: P }) {
1026
+ const t = o, r = P, p = ne(), l = () => `${p}-video`, { sprite: v, resizeSprite: _ } = z(t), w = U(), e = J(() => {
1027
+ if (w.value?.source && w.value.source.resource) {
1028
+ const y = w.value.source.resource;
1029
+ if (y instanceof HTMLVideoElement)
1030
+ return y;
1983
1031
  }
1984
1032
  return null;
1985
- });
1986
- const readyDef = useDeferred();
1987
- const videoError = ref("");
1988
- readyDef.promise.then(() => {
1989
- if (props.status === TickerStatus.play) {
1990
- play();
1991
- }
1992
- });
1993
- watchEffect(() => {
1994
- video.value && (video.value.loop = props.loop);
1995
- });
1996
- onMounted(() => loadVideoTexture(props.url));
1997
- async function loadVideoTexture(url) {
1033
+ }), n = be(), a = U("");
1034
+ n.promise.then(() => {
1035
+ t.status === m.play && b();
1036
+ }), B(() => {
1037
+ e.value && (e.value.loop = t.loop);
1038
+ }), ae(() => u(t.url));
1039
+ async function u(y) {
1998
1040
  try {
1999
- videoError.value = "";
2000
- const alias = getAlias();
2001
- if (Assets.cache.has(alias)) {
2002
- await Assets.unload(alias);
2003
- }
2004
- Assets.add({ alias, src: url });
2005
- const videoTexture = await Assets.load(alias);
2006
- texture.value = videoTexture;
2007
- sprite.texture = videoTexture;
2008
- if (video.value) {
2009
- video.value.loop = props.loop;
2010
- video.value.muted = true;
2011
- video.value.crossOrigin = "anonymous";
2012
- setupVideoEvents(video.value);
2013
- readyDef.resolve();
2014
- }
2015
- resizeSprite();
2016
- return videoTexture;
2017
- } catch (error) {
2018
- console.error("\u52A0\u8F7D\u89C6\u9891\u7EB9\u7406\u5931\u8D25:", error);
2019
- videoError.value = "\u89C6\u9891\u52A0\u8F7D\u5931\u8D25";
2020
- return null;
1041
+ a.value = "";
1042
+ const F = l();
1043
+ R.cache.has(F) && await R.unload(F), R.add({ alias: F, src: y });
1044
+ const d = await R.load(F);
1045
+ return w.value = d, v.texture = d, e.value && (e.value.loop = t.loop, e.value.muted = !0, e.value.crossOrigin = "anonymous", i(e.value), n.resolve()), _(), d;
1046
+ } catch (F) {
1047
+ return console.error("加载视频纹理失败:", F), a.value = "视频加载失败", null;
2021
1048
  }
2022
1049
  }
2023
- function setupVideoEvents(video2) {
2024
- video2.addEventListener("play", () => {
2025
- if (props.status !== TickerStatus.playing) {
2026
- emit("update:status", TickerStatus.playing);
2027
- }
2028
- });
2029
- video2.addEventListener("pause", () => {
2030
- if (props.status !== TickerStatus.paused) {
2031
- emit("update:status", TickerStatus.paused);
2032
- }
2033
- });
2034
- video2.addEventListener("ended", () => {
2035
- if (props.loop) {
2036
- video2.currentTime = 0;
2037
- video2.play();
2038
- } else {
2039
- emit("update:status", TickerStatus.stopped);
2040
- }
2041
- });
2042
- video2.addEventListener("error", (e) => {
2043
- const error = video2.error;
2044
- let errorMessage = "\u89C6\u9891\u64AD\u653E\u5931\u8D25";
2045
- if (error) {
2046
- switch (error.code) {
2047
- case error.MEDIA_ERR_ABORTED:
2048
- errorMessage = "\u89C6\u9891\u64AD\u653E\u88AB\u4E2D\u6B62";
1050
+ function i(y) {
1051
+ y.addEventListener("play", () => {
1052
+ t.status !== m.playing && r("update:status", m.playing);
1053
+ }), y.addEventListener("pause", () => {
1054
+ t.status !== m.paused && r("update:status", m.paused);
1055
+ }), y.addEventListener("ended", () => {
1056
+ t.loop ? (y.currentTime = 0, y.play()) : r("update:status", m.stopped);
1057
+ }), y.addEventListener("error", (F) => {
1058
+ const d = y.error;
1059
+ let f = "视频播放失败";
1060
+ if (d)
1061
+ switch (d.code) {
1062
+ case d.MEDIA_ERR_ABORTED:
1063
+ f = "视频播放被中止";
2049
1064
  break;
2050
- case error.MEDIA_ERR_NETWORK:
2051
- errorMessage = "\u7F51\u7EDC\u9519\u8BEF\u5BFC\u81F4\u89C6\u9891\u64AD\u653E\u5931\u8D25";
1065
+ case d.MEDIA_ERR_NETWORK:
1066
+ f = "网络错误导致视频播放失败";
2052
1067
  break;
2053
- case error.MEDIA_ERR_DECODE:
2054
- errorMessage = "\u89C6\u9891\u89E3\u7801\u5931\u8D25";
1068
+ case d.MEDIA_ERR_DECODE:
1069
+ f = "视频解码失败";
2055
1070
  break;
2056
- case error.MEDIA_ERR_SRC_NOT_SUPPORTED:
2057
- errorMessage = "\u4E0D\u652F\u6301\u7684\u89C6\u9891\u683C\u5F0F";
1071
+ case d.MEDIA_ERR_SRC_NOT_SUPPORTED:
1072
+ f = "不支持的视频格式";
2058
1073
  break;
2059
1074
  }
2060
- }
2061
- console.error("\u89C6\u9891\u64AD\u653E\u9519\u8BEF:", errorMessage, e);
2062
- videoError.value = errorMessage;
2063
- emit("update:status", TickerStatus.stopped);
1075
+ console.error("视频播放错误:", f, F), a.value = f, r("update:status", m.stopped);
2064
1076
  });
2065
1077
  }
2066
- async function cleanupVideo() {
2067
- if (texture.value) {
2068
- const alias = getAlias();
2069
- texture.value.destroy(true);
2070
- texture.value = void 0;
2071
- if (Assets.cache.has(alias)) {
2072
- await Assets.unload(alias);
2073
- }
1078
+ async function s() {
1079
+ if (w.value) {
1080
+ const y = l();
1081
+ w.value.destroy(!0), w.value = void 0, R.cache.has(y) && await R.unload(y);
2074
1082
  }
2075
- videoError.value = "";
1083
+ a.value = "";
2076
1084
  }
2077
- watchEffect(() => {
2078
- props.status === TickerStatus.play && play();
2079
- props.status === TickerStatus.pause && pause();
2080
- props.status === TickerStatus.stop && stop();
1085
+ B(() => {
1086
+ t.status === m.play && b(), t.status === m.pause && h(), t.status === m.stop && A();
1087
+ }), S(() => {
1088
+ s();
2081
1089
  });
2082
- onBeforeUnmount(() => {
2083
- cleanupVideo();
2084
- });
2085
- function play() {
2086
- if (video.value) {
2087
- video.value.play().catch((error) => {
2088
- console.error("\u89C6\u9891\u64AD\u653E\u5931\u8D25:", error);
2089
- videoError.value = "\u89C6\u9891\u64AD\u653E\u5931\u8D25";
2090
- });
2091
- }
1090
+ function b() {
1091
+ e.value && e.value.play().catch((y) => {
1092
+ console.error("视频播放失败:", y), a.value = "视频播放失败";
1093
+ });
2092
1094
  }
2093
- function pause() {
2094
- video.value?.pause();
1095
+ function h() {
1096
+ e.value?.pause();
2095
1097
  }
2096
- function stop() {
2097
- if (video.value) {
2098
- video.value.pause();
2099
- video.value.currentTime = 0;
2100
- }
2101
- emit("update:status", TickerStatus.stopped);
1098
+ function A() {
1099
+ e.value && (e.value.pause(), e.value.currentTime = 0), r("update:status", m.stopped);
2102
1100
  }
2103
- const __returned__ = { props, emit, compId, getAlias, sprite, resizeSprite, texture, video, readyDef, videoError, loadVideoTexture, setupVideoEvents, cleanupVideo, play, pause, stop };
2104
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2105
- return __returned__;
1101
+ return (y, F) => V(y.$slots, "default");
2106
1102
  }
2107
- });
2108
-
2109
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
2110
- return renderSlot(_ctx.$slots, "default");
2111
- }
2112
- var VideoComp = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/video.vue"]]);
2113
-
2114
- var _sfc_main$1 = /* @__PURE__ */ defineComponent({
1103
+ }), Te = /* @__PURE__ */ C({
2115
1104
  __name: "view",
2116
1105
  props: {
2117
1106
  defaultOptions: {
@@ -2119,114 +1108,97 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
2119
1108
  default: () => ({})
2120
1109
  }
2121
1110
  },
2122
- setup(__props, { expose: __expose }) {
2123
- __expose();
2124
- const props = __props;
2125
- const { application: app, context } = usePixiApp();
2126
- const appRef = ref();
2127
- onMounted(async () => {
2128
- await app.init({
2129
- resizeTo: appRef.value,
2130
- ...props.defaultOptions
2131
- });
2132
- context.whenDef.resolve(app);
2133
- appRef.value.appendChild(app.canvas);
2134
- });
2135
- const __returned__ = { props, app, context, appRef };
2136
- Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
2137
- return __returned__;
1111
+ setup(o) {
1112
+ const P = o, { application: t, context: r } = ce(), p = U();
1113
+ return ae(async () => {
1114
+ await t.init({
1115
+ resizeTo: p.value,
1116
+ ...P.defaultOptions
1117
+ }), r.whenDef.resolve(t), p.value.appendChild(t.canvas);
1118
+ }), (l, v) => (H(), me("div", {
1119
+ ref_key: "appRef",
1120
+ ref: p,
1121
+ class: "vk-pixi-frame"
1122
+ }, null, 512));
2138
1123
  }
2139
- });
2140
-
2141
- const _hoisted_1 = {
2142
- ref: "appRef",
2143
- class: "vk-pixi-frame"
2144
- };
2145
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
2146
- return openBlock(), createElementBlock(
2147
- "div",
2148
- _hoisted_1,
2149
- null,
2150
- 512
2151
- /* NEED_PATCH */
2152
- );
2153
- }
2154
- var ViewComp = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/view.vue"]]);
2155
-
2156
- var _sfc_main = defineComponent({
1124
+ }), Oe = C({
2157
1125
  name: "VkPixiFrame",
2158
1126
  components: {
2159
- ApngComp,
1127
+ ApngComp: Ne,
2160
1128
  // CoreComp,
2161
- ProviderComp,
2162
- ViewComp,
2163
- VideoComp,
2164
- Bitmap
1129
+ ProviderComp: Le,
1130
+ ViewComp: Te,
1131
+ VideoComp: Re,
1132
+ Bitmap: De
2165
1133
  },
2166
- props,
2167
- emits,
2168
- setup(props2) {
2169
- const isApng = computed(() => {
2170
- if (!props2.url)
2171
- return false;
2172
- const url = props2.url.toLowerCase();
2173
- return url.includes(".png") && !url.includes(".mp4") && !url.includes(".webm");
2174
- });
2175
- const isVideo = computed(() => {
2176
- if (!props2.url)
2177
- return false;
2178
- const url = props2.url.toLowerCase();
2179
- return url.includes(".mp4") || url.includes(".webm") || url.includes(".mov");
1134
+ props: q,
1135
+ emits: j,
1136
+ setup(o) {
1137
+ const P = J(() => {
1138
+ if (!o.url)
1139
+ return !1;
1140
+ const r = o.url.toLowerCase();
1141
+ return r.includes(".png") && !r.includes(".mp4") && !r.includes(".webm");
1142
+ }), t = J(() => {
1143
+ if (!o.url)
1144
+ return !1;
1145
+ const r = o.url.toLowerCase();
1146
+ return r.includes(".mp4") || r.includes(".webm") || r.includes(".mov");
2180
1147
  });
2181
1148
  return {
2182
- isApng,
2183
- isVideo
1149
+ isApng: P,
1150
+ isVideo: t
2184
1151
  };
2185
1152
  }
2186
1153
  });
2187
-
2188
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2189
- const _component_ViewComp = resolveComponent("ViewComp");
2190
- const _component_ApngComp = resolveComponent("ApngComp");
2191
- const _component_VideoComp = resolveComponent("VideoComp");
2192
- const _component_Bitmap = resolveComponent("Bitmap");
2193
- const _component_ProviderComp = resolveComponent("ProviderComp");
2194
- return openBlock(), createBlock(_component_ProviderComp, null, {
2195
- default: withCtx(() => [
2196
- createVNode(_component_ViewComp),
2197
- _ctx.isApng && _ctx.url ? (openBlock(), createBlock(_component_ApngComp, {
1154
+ function Ue(o, P, t, r, p, l) {
1155
+ const v = K("ViewComp"), _ = K("ApngComp"), w = K("VideoComp"), e = K("Bitmap"), n = K("ProviderComp");
1156
+ return H(), Y(n, null, {
1157
+ default: he(() => [
1158
+ ve(v),
1159
+ o.isApng && o.url ? (H(), Y(_, {
2198
1160
  key: 0,
2199
- url: _ctx.url,
2200
- loop: _ctx.loop,
2201
- status: _ctx.status,
2202
- "onUpdate:status": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:status", $event))
2203
- }, null, 8, ["url", "loop", "status"])) : _ctx.isVideo && _ctx.url ? (openBlock(), createBlock(_component_VideoComp, {
1161
+ url: o.url,
1162
+ loop: o.loop,
1163
+ status: o.status,
1164
+ "onUpdate:status": P[0] || (P[0] = (a) => o.$emit("update:status", a))
1165
+ }, null, 8, ["url", "loop", "status"])) : o.isVideo && o.url ? (H(), Y(w, {
2204
1166
  key: 1,
2205
- url: _ctx.url,
2206
- loop: _ctx.loop,
2207
- status: _ctx.status,
2208
- "onUpdate:status": _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:status", $event))
2209
- }, null, 8, ["url", "loop", "status"])) : (openBlock(), createBlock(_component_Bitmap, {
1167
+ url: o.url,
1168
+ loop: o.loop,
1169
+ status: o.status,
1170
+ "onUpdate:status": P[1] || (P[1] = (a) => o.$emit("update:status", a))
1171
+ }, null, 8, ["url", "loop", "status"])) : (H(), Y(e, {
2210
1172
  key: 2,
2211
- data: _ctx.data,
2212
- loop: _ctx.loop,
2213
- status: _ctx.status,
2214
- onSetData: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("setData", $event)),
2215
- "onUpdate:status": _cache[3] || (_cache[3] = ($event) => _ctx.$emit("update:status", $event))
1173
+ data: o.data,
1174
+ loop: o.loop,
1175
+ status: o.status,
1176
+ onSetData: P[2] || (P[2] = (a) => o.$emit("setData", a)),
1177
+ "onUpdate:status": P[3] || (P[3] = (a) => o.$emit("update:status", a))
2216
1178
  }, null, 8, ["data", "loop", "status"]))
2217
1179
  ]),
2218
1180
  _: 1
2219
- /* STABLE */
2220
1181
  });
2221
1182
  }
2222
- var VkPixiFrame = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/pixi-frame/src/index.vue"]]);
2223
-
2224
- var types = /*#__PURE__*/Object.freeze({
2225
- __proto__: null
2226
- });
2227
-
2228
- VkPixiFrame.install = (app) => {
2229
- app.component(VkPixiFrame.name || "VkPixiFrame", VkPixiFrame);
1183
+ const re = /* @__PURE__ */ xe(Oe, [["render", Ue]]), Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1184
+ __proto__: null
1185
+ }, Symbol.toStringTag, { value: "Module" }));
1186
+ re.install = (o) => {
1187
+ o.component(re.name || "VkPixiFrame", re);
1188
+ };
1189
+ export {
1190
+ Ye as TickerStatus,
1191
+ re as VkPixiFrame,
1192
+ Ne as VkPixiFrameApng,
1193
+ De as VkPixiFrameBitmap,
1194
+ Ge as VkPixiFrameBitmapGenerator,
1195
+ je as VkPixiFrameBufferImage,
1196
+ ze as VkPixiFrameCore,
1197
+ Le as VkPixiFrameProvider,
1198
+ Re as VkPixiFrameVideo,
1199
+ Te as VkPixiFrameView,
1200
+ Ke as __VkPixiFrame,
1201
+ re as default,
1202
+ ce as usePixiApp,
1203
+ z as useSprite
2230
1204
  };
2231
-
2232
- export { VkPixiFrame, ApngComp as VkPixiFrameApng, Bitmap as VkPixiFrameBitmap, bitmapGenerator as VkPixiFrameBitmapGenerator, bufferImage as VkPixiFrameBufferImage, core as VkPixiFrameCore, ProviderComp as VkPixiFrameProvider, VideoComp as VkPixiFrameVideo, ViewComp as VkPixiFrameView, types as __VkPixiFrame, VkPixiFrame as default, usePixiApp, useSprite };